miku: Use upstream gamemode

This commit is contained in:
PapaTutuWawa 2021-10-22 21:40:21 +02:00
parent 466c8752b1
commit 80450caa7a
5 changed files with 44 additions and 105 deletions

View File

@ -9,7 +9,8 @@ in mkHost config {
overlays = [ "nur" "unstable" "simple" "custom" "emacs" ]; overlays = [ "nur" "unstable" "simple" "custom" "emacs" ];
hardwareImports = [ "amdgpu" "amd" ]; hardwareImports = [ "amdgpu" "amd" ];
programImports = [ programImports = [
"zsh" "git" "mpv" "tmux" "emacs" "firefox" "gnome-terminal" "gnome" "i18n" "gamemode" "zsh" "git" "mpv" "tmux" "emacs" "firefox" "i18n" "gamemode" #"gnome-terminal" "gnome"
"alacritty" "sway" "waybar" "kanshi"
"distributed-build/builder.nix" "distributed-build/builder.nix"
"music" "music"
]; ];
@ -32,10 +33,10 @@ in mkHost config {
emacsPgtkGcc emacsPgtkGcc
gajim gajim
virt-manager unstable.qemu scream virt-manager unstable.qemu scream
gamemode # Custom package #gamemode # Custom package
key-mapper # Custom package key-mapper # Custom package
replaysorcery # Custom package replaysorcery # Custom package
evdev-proxy # Custom package #evdev-proxy # Custom package
vfio-isolate # Custom Package vfio-isolate # Custom Package
steam-wrapped steam-wrapped
discord-wrapped # Custom package discord-wrapped # Custom package
@ -45,6 +46,7 @@ in mkHost config {
anime-dl trackma # Custom package anime-dl trackma # Custom package
unstable.thunderbird unstable.thunderbird
multimc-wrapped # Custom package multimc-wrapped # Custom package
nwg-launchers
]; ];
extraOptions = old: { extraOptions = old: {
system.autoUpgrade.channel = "https://nixos.org/channels/nixos-unstable"; system.autoUpgrade.channel = "https://nixos.org/channels/nixos-unstable";
@ -52,6 +54,7 @@ in mkHost config {
programs = { programs = {
mpv.primaryScreen = "C27F398"; mpv.primaryScreen = "C27F398";
adb.enable = true; adb.enable = true;
sway.enable = true;
}; };
boot = { boot = {
@ -77,12 +80,21 @@ in mkHost config {
"kvm.report_ignored_msrs=N" "kvm.report_ignored_msrs=N"
"fbcon=rotate:1" "fbcon=rotate:1"
"quiet" "quiet"
"tsc=unstable"
]; ];
extraModulePackages = [ pkgs.linuxPackages.vendor-reset ]; extraModulePackages = [ pkgs.linuxPackages_xanmod.vendor-reset ];
#extraModulePackages = [ pkgs.linuxPackages.vendor-reset ];
# NOTE: A regression appears to have happend between 5.10 and 5.12 # NOTE: A regression appears to have happend between 5.10 and 5.12
# which leads to the RX590 to have the fence fallback timer on # which leads to the RX590 to have the fence fallback timer on
# sdma0 time out (whatever this means). Maybe bisect? # sdma0 time out (whatever this means). Maybe bisect?
#kernelPackages = pkgs.linuxPackages_zen; kernelPackages = pkgs.linuxPackages_xanmod;
};
xdg.portal = {
enable = true;
extraPortals = [
pkgs.xdg-desktop-portal-wlr
];
}; };
services = { services = {
ratbagd.enable = true; ratbagd.enable = true;
@ -91,23 +103,15 @@ in mkHost config {
connman.extraConfig = '' connman.extraConfig = ''
WriteResolvConf=false WriteResolvConf=false
''; '';
udev.packages = with pkgs; [ key-mapper ]; udev = {
}; packages = with pkgs; [ key-mapper ];
extraRules = ''
security = { KERNEL=="uinput", GROUP="input", MODE="0660"
pam.loginLimits = [ '';
{ };
domain = "@gamemode"; xserver.displayManager.gdm = {
item = "-"; enable = true;
type = "nice"; wayland = true;
value = "-10";
}
];
wrappers = {
gamemoded = {
source = "${pkgs.gamemode}/bin/gamemoded";
capabilities = "cap_sys_nice+ep";
};
}; };
}; };
@ -152,22 +156,6 @@ in mkHost config {
Restart = "always"; Restart = "always";
}; };
}; };
# TODO: Remove once in stable or I decide to use unstable
gamemode = {
description = "A daemon/lib combo for Linux that allows games to request a set of optimisations be temporarily applied to the host OS.";
wantedBy = [ "default.target" ];
environment.PATH = lib.mkForce (pkgs.linkFarm "pkexec" [
{
name = "pkexec";
path = "${config.security.wrapperDir}/pkexec";
}
]);
serviceConfig = {
Type = "simple";
ExecStart = "${config.security.wrapperDir}/gamemoded";
Restart = "always";
};
};
superpaper = { superpaper = {
description = "A cross-platform multi monitor wallpaper manager."; description = "A cross-platform multi monitor wallpaper manager.";
wantedBy = [ "default.target" ]; wantedBy = [ "default.target" ];

View File

@ -1,7 +1,21 @@
{ ... }: { ... }:
{ {
home-manager.users.alexander.xdg.configFile = { config.programs.gamemode = {
"gamemode/gamemode.ini".source = ./gamemode.ini; enable = true;
enableRenice = true;
settings = {
general = {
reaper_freq = 5;
desiredgov = "performance";
igpu_desiredgov = "powersave";
igpu_power_threshold = 0.3;
softrealtime = "on";
renice = 0;
ioprio = 0;
inhibit_screensaver = 1;
};
};
}; };
} }

View File

@ -7,13 +7,11 @@ let
discord-system-electron = pkgs.callPackage ./applications/networking/instant-messengers/discord { discord-system-electron = pkgs.callPackage ./applications/networking/instant-messengers/discord {
# Wayland # Wayland
# NOTE: electron under Wayland has no window titlebars # NOTE: electron under Wayland has no window titlebars
#extraStartupArgs = "--enable-features=UseOzonePlatform --ozone-platform=wayland"; extraStartupArgs = "--enable-features=UseOzonePlatform --ozone-platform=wayland";
#extraStartupArgs = "--enable-features=UseOzonePlatform --ozone-platform=wayland --enable-features=WebRTCPipeWireCapturer";
#extraStartupArgs = "--enable-features=UseOzonePlatform --ozone-platform=wayland --enable-features=WebRTCPipeWireCapturer"; #extraStartupArgs = "--enable-features=UseOzonePlatform --ozone-platform=wayland --enable-features=WebRTCPipeWireCapturer";
}; };
wrapInSandbox = pkgs.callPackage ./sandbox.nix {}; wrapInSandbox = pkgs.callPackage ./sandbox.nix {};
in { in {
gamemode = pkgs.callPackage ./tools/games/gamemode { };
key-mapper = pkgs.callPackage ./tools/games/key-mapper {}; key-mapper = pkgs.callPackage ./tools/games/key-mapper {};
vfio-isolate = pkgs.callPackage ./tools/virtualisation/vfio-isolate {}; vfio-isolate = pkgs.callPackage ./tools/virtualisation/vfio-isolate {};
mopidy-funkwhale = pkgs.callPackage ./applications/audio/mopidy/funkwhale.nix {}; mopidy-funkwhale = pkgs.callPackage ./applications/audio/mopidy/funkwhale.nix {};
@ -40,6 +38,7 @@ in {
discord-wrapped = wrapInSandbox { discord-wrapped = wrapInSandbox {
name = "discord"; name = "discord";
package = pkgs.unstable.discord; package = pkgs.unstable.discord;
#package = discord-system-electron;
binaryName = "discord"; binaryName = "discord";
mountInHome = [ ".config/discord" ".config/BetterDiscord" ]; mountInHome = [ ".config/discord" ".config/BetterDiscord" ];
additionalBlacklist = [ "/mnt" ]; additionalBlacklist = [ "/mnt" ];

View File

@ -1,50 +0,0 @@
{ stdenv, lib,
meson, ninja, dbus, systemd, pkgconfig, cmake, inih,
fetchFromGitHub, fetchpatch }:
stdenv.mkDerivation rec {
pname = "gamemode";
version = "1.6.1";
src = fetchFromGitHub {
owner = "FeralInteractive";
repo = pname;
rev = version;
sha256 = "17dck7dzkmzq52f2yrs930fdg2inr7nipvnwpd0jqrwgk2fhwk9z";
};
patches = [
(fetchpatch {
url = "https://github.com/FeralInteractive/gamemode/commit/be44b7091baa33be6dda60392e4c06c2f398ee72.patch";
sha256 = "TlDUETs4+N3pvrVd0FQGlGmC+6ByhJ2E7gKXa7suBtE=";
})
./preload-nix-workaround.patch
];
nativeBuildInputs = [
meson ninja pkgconfig cmake
];
buildInputs = [
dbus systemd inih
];
mesonFlags = [
"-Dwith-systemd-user-unit-dir=${placeholder "out"}/lib/systemd/user"
];
postPatch = ''
substituteInPlace data/gamemoderun \
--subst-var-by libraryPath ${lib.makeLibraryPath ([
(placeholder "lib")
])}
'';
meta = with lib; {
description = "Optimise Linux system performance on demand";
homepage = "https://github.com/FeralInteractive/gamemode";
license = licenses.bsd3;
maintainers = [ ];
platforms = platforms.linux;
};
}

View File

@ -1,12 +0,0 @@
diff --git a/data/gamemoderun b/data/gamemoderun
index 573b3e4..6f2799e 100755
--- a/data/gamemoderun
+++ b/data/gamemoderun
@@ -5,5 +5,6 @@ GAMEMODEAUTO_NAME="libgamemodeauto.so.0"
# ld will find the right path to load the library, including for 32-bit apps.
LD_PRELOAD="${GAMEMODEAUTO_NAME}${LD_PRELOAD:+:$LD_PRELOAD}"
+LD_LIBRARY_PATH="@libraryPath@${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
-exec env LD_PRELOAD="${LD_PRELOAD}" $GAMEMODERUNEXEC "$@"
+exec env LD_PRELOAD="${LD_PRELOAD}" LD_LIBRARY_PATH="${LD_LIBRARY_PATH}" $GAMEMODERUNEXEC "$@"