mirror of
https://github.com/divnix/digga.git
synced 2024-10-04 02:27:45 +03:00
games: add gamemode service
This commit is contained in:
parent
9983d0d2df
commit
a0cef270aa
@ -1 +1,6 @@
|
||||
[ ./services/torrent/qbittorrent.nix ./security/mitigations.nix ]
|
||||
[
|
||||
./services/torrent/qbittorrent.nix
|
||||
./security/mitigations.nix
|
||||
./services/hardware/wii-u-gc-adapter.nix
|
||||
./services/games/gamemode.nix
|
||||
]
|
||||
|
36
modules/services/games/gamemode.nix
Normal file
36
modules/services/games/gamemode.nix
Normal file
@ -0,0 +1,36 @@
|
||||
{ config, lib, options, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let cfg = config.services.gamemode;
|
||||
in {
|
||||
options.services.gamemode = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Whether to enable the gamemoded systemd user service.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
environment.systemPackages = [ pkgs.gamemode ];
|
||||
|
||||
services.dbus.packages = [ pkgs.gamemode ];
|
||||
|
||||
systemd.user.services.gamemoded = {
|
||||
description = "gamemoded";
|
||||
|
||||
serviceConfig = {
|
||||
Type = "dbus";
|
||||
BusName = "com.feralinteractive.GameMode";
|
||||
NotifyAccess = "main";
|
||||
ExecStart = "${pkgs.gamemode}/bin/gamemoded";
|
||||
};
|
||||
|
||||
wantedBy = [ "graphical-session.target" ];
|
||||
partOf = [ "graphical-session.target" ];
|
||||
};
|
||||
};
|
||||
}
|
@ -5,4 +5,6 @@ final: prev: {
|
||||
purs = prev.callPackage ./shells/zsh/purs { };
|
||||
pure = prev.callPackage ./shells/zsh/pure { };
|
||||
wii-u-gc-adapter = prev.callPackage ./misc/drivers/wii-u-gc-adapter { };
|
||||
libinih = prev.callPackage ./development/libraries/libinih { };
|
||||
gamemode = prev.callPackage ./os-specific/linux/gamemode { };
|
||||
}
|
||||
|
20
pkgs/development/libraries/libinih/default.nix
Normal file
20
pkgs/development/libraries/libinih/default.nix
Normal file
@ -0,0 +1,20 @@
|
||||
{ stdenv, meson, ninja, fetchFromGitHub, ... }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
name = "libinih";
|
||||
version = "r50";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "benhoyt";
|
||||
repo = "inih";
|
||||
rev = "${version}";
|
||||
hash = "sha256-GF+TVEysaXJxSBBjMsTr2IQvRKlzdEu3rlPQ88PE3nI=";
|
||||
};
|
||||
|
||||
buildInputs = [ meson ninja ];
|
||||
|
||||
mesonFlags = ''
|
||||
-Ddefault_library=shared
|
||||
-Ddistro_install=true
|
||||
'';
|
||||
}
|
32
pkgs/os-specific/linux/gamemode/default.nix
Normal file
32
pkgs/os-specific/linux/gamemode/default.nix
Normal file
@ -0,0 +1,32 @@
|
||||
{ stdenv, appstream, meson, ninja, pkgsi686Linux, polkit, pkgconfig, systemd
|
||||
, dbus, libinih, fetchFromGitHub, ... }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "gamemode";
|
||||
version = "1.5.1";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "FeralInteractive";
|
||||
repo = "gamemode";
|
||||
rev = "${version}";
|
||||
hash = "sha256-x3VM7HJL4+zLDBdCm0ekc0UX33lrRWlOieJjihhA5L4=";
|
||||
};
|
||||
|
||||
prePatch = ''
|
||||
substituteInPlace daemon/gamemode-tests.c --replace "/usr/bin/gamemoderun" $out/bin/gamemoderun
|
||||
substituteInPlace daemon/gamemode-gpu.c --replace "/usr/bin/pkexec" ${polkit}/bin/pkexec
|
||||
substituteInPlace daemon/gamemode-context.c --replace "/usr/bin/pkexec" ${polkit}/bin/pkexec
|
||||
substituteInPlace lib/gamemode_client.h --replace 'dlopen("' 'dlopen("${
|
||||
placeholder "out"
|
||||
}/lib/'
|
||||
'';
|
||||
|
||||
buildInputs = [ meson ninja pkgconfig systemd dbus libinih ];
|
||||
|
||||
mesonFlags = ''
|
||||
-Dwith-util=false
|
||||
-Dwith-examples=false
|
||||
-Dwith-systemd-user-unit-dir=${placeholder "out"}/lib/systemd/user
|
||||
'';
|
||||
|
||||
}
|
@ -1,9 +1,5 @@
|
||||
{ unstablePkgs, ... }: {
|
||||
imports = [
|
||||
../graphical
|
||||
./udev.nix
|
||||
../../modules/services/hardware/wii-u-gc-adapter.nix
|
||||
];
|
||||
imports = [ ../graphical ./udev.nix ];
|
||||
environment.systemPackages = with unstablePkgs; [
|
||||
retroarchBare
|
||||
steam
|
||||
@ -14,6 +10,8 @@
|
||||
|
||||
services.wii-u-gc-adapter.enable = true;
|
||||
|
||||
services.gamemode.enable = true;
|
||||
|
||||
# fps games on laptop need this
|
||||
services.xserver.libinput.disableWhileTyping = false;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user