Skip to content

Instantly share code, notes, and snippets.

@frio
Created September 8, 2019 22:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save frio/03a2731903bf40ae0c11b2c99a24dedf to your computer and use it in GitHub Desktop.
Save frio/03a2731903bf40ae0c11b2c99a24dedf to your computer and use it in GitHub Desktop.
diff --git a/daemon/gamemode-config.c b/daemon/gamemode-config.c
index 6b8f5d9..c1fe921 100644
--- a/daemon/gamemode-config.c
+++ b/daemon/gamemode-config.c
@@ -346,7 +346,7 @@ static void load_config_files(GameModeConfig *self)
bool protected;
};
struct ConfigLocation locations[CONFIG_NUM_LOCATIONS] = {
- { "/usr/share/gamemode", true }, /* shipped default config */
+ { "@gamemode@/share/gamemode", true }, /* shipped default config */
{ "/etc", true }, /* administrator config */
{ config_location_home, false }, /* $XDG_CONFIG_HOME or $HOME/.config/ */
{ config_location_local, false } /* local data eg. $PWD */
{ stdenv
, lib
, fetchFromGitHub
, meson
, ninja
, pkgconfig
, cmake
, systemd
, dbus
# , withDaemon ? true
, pkexecPath ? "/run/wrappers/bin/pkexec"
}:
# TODO?: see linux-steam-integration, produce a 32-bit and 64-bit build for the client lib?
stdenv.mkDerivation rec {
name = "gamemode-${version}";
version = "1.4";
src = fetchFromGitHub {
owner = "FeralInteractive";
repo = "gamemode";
rev = "${version}";
sha256 = "19s73yblbv8c7dw41sb713cjy1y6wr2srn9wvqdcsqgc159z4sj2";
fetchSubmodules = true;
};
nativeBuildInputs = [ meson ninja pkgconfig cmake ];
buildInputs = [ systemd dbus ];
patches = [
./config-file-locations.patch
./dlopen.patch
./polkit.patch
];
postPatch = ''
substituteInPlace daemon/gamemode-config.c --subst-var-by gamemode $out
# I had some other patches here, but they weren't useful
'';
# As far as I can tell, this only disables placing a SystemD unit file.
# We intend to build our own with a NixOS module, so, that's fine.
mesonFlags = [
"-Dwith-systemd=false"
"-Dwith-examples=false"
]
# TODO: this has to be commented for now, because gamemoded only
# compiles the gamemoderun shell-script if the daemon is also enabled.
# In the future, I'll try and commit upstream enabling the two to be
# deployed independently (so that 32-bit chroot envs can use gamemoderun
# without also compiling a daemon), as that seems healthier than patching
# locally.
# ++ (if (!withDaemon) then [
# "-Dwith-daemon=false"
# ] else []
# );
meta = with stdenv.lib; {
description = "gamemode";
longDescription = ''
GameMode is a daemon/lib combo for Linux that allows games to request a
set of optimisations be temporarily applied to the host OS and/or a game
process.
'';
homepage = https://github.com/FeralInteractive/gamemode;
license = licenses.mit;
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment