Talk:Games: Difference between revisions
imported>Rapenne-s m add signature |
imported>Dietr1ch No edit summary |
||
Line 8: | Line 8: | ||
--[[User:Rapenne-s|Rapenne-s]] ([[User talk:Rapenne-s|talk]]) 20:00, 20 October 2022 (UTC) | --[[User:Rapenne-s|Rapenne-s]] ([[User talk:Rapenne-s|talk]]) 20:00, 20 October 2022 (UTC) | ||
== Using a games group == | |||
I've been using a games group to handle permissions to adjust some limits (through gamemoderun usage from steam and lutris/wine) | |||
This is the excerpt of my config. In it's current form it might be helpful to some, but it requires some additional work before it can be added to the Wiki, like diving into the reasoning, and maybe explaining how to use `gamemoderun` on steam and/or other platforms. | |||
<syntaxHighlight lang=nix> | |||
users.users.dietr1ch = { | |||
extraGroups = [ | |||
"games" | |||
]; | |||
}; | |||
</syntaxHighlight> | |||
<syntaxHighlight lang=nix> | |||
programs = { | |||
gamemode = { | |||
enable = true; | |||
settings = { | |||
general = { | |||
inhibit_screensaver = 0; | |||
renice = 0; | |||
softrealtime = "auto"; | |||
}; | |||
}; | |||
}; | |||
}; | |||
users.groups = { | |||
# Users that will play games | |||
"games" = { | |||
gid = 666; | |||
}; | |||
}; | |||
environment = { | |||
systemPackages = with pkgs; [ | |||
gamemode | |||
]; | |||
}; | |||
services = { | |||
udev = { | |||
extraRules = '' | |||
KERNEL=="cpu_dma_latency", GROUP="games" | |||
''; | |||
}; | |||
}; | |||
security = { | |||
sudo = { | |||
extraRules = [ | |||
{ | |||
groups = [ | |||
"games" | |||
]; | |||
commands = [ | |||
{ | |||
command = "${pkgs.gamemode}/bin/gamemoderun"; | |||
options = [ "NOPASSWD" ]; | |||
} | |||
{ | |||
command = "${pkgs.gamemode}/libexec/cpugovctl"; | |||
options = [ "NOPASSWD" ]; | |||
} | |||
{ | |||
command = "${pkgs.gamemode}/libexec/gpuclockctl"; | |||
options = [ "NOPASSWD" ]; | |||
} | |||
]; | |||
} | |||
]; | |||
}; | |||
pam = { | |||
# Higher resource limits. Used by Lutris/Wine. | |||
loginLimits = [ | |||
{ domain = "@games"; item = "nofile"; type = "soft"; value = "1048576"; } | |||
{ domain = "@games"; item = "nofile"; type = "hard"; value = "1048576"; } | |||
{ domain = "@games"; type = "-"; item = "rtprio"; value = 98; } | |||
{ domain = "@games"; type = "-"; item = "memlock"; value = "unlimited"; } | |||
{ domain = "@games"; type = "-"; item = "nice"; value = -11; } | |||
]; | |||
}; | |||
}; | |||
</syntaxHighlight> |