94 lines
1.9 KiB
Nix
94 lines
1.9 KiB
Nix
{
|
|
pkgs,
|
|
lib,
|
|
config,
|
|
...
|
|
}:
|
|
|
|
{
|
|
options = {
|
|
steamos = {
|
|
amdvlk = lib.mkOption {
|
|
type = lib.types.bool;
|
|
default = false;
|
|
};
|
|
};
|
|
};
|
|
|
|
config = {
|
|
users.users.steam = {
|
|
isNormalUser = true;
|
|
uid = 1010;
|
|
password = "steam";
|
|
extraGroups = [
|
|
"video"
|
|
"input"
|
|
"audio"
|
|
"networkmanager"
|
|
];
|
|
shell = pkgs.bash;
|
|
};
|
|
|
|
services.xserver.enable = false;
|
|
|
|
# Современные видеодрайверы
|
|
hardware = {
|
|
graphics = {
|
|
enable = true;
|
|
enable32Bit = true;
|
|
};
|
|
|
|
amdgpu.amdvlk = lib.mkIf config.steamos.amdvlk {
|
|
enable = true;
|
|
support32Bit.enable = true;
|
|
};
|
|
};
|
|
|
|
programs = {
|
|
gamescope = {
|
|
enable = true;
|
|
capSysNice = true;
|
|
};
|
|
steam = {
|
|
enable = true;
|
|
gamescopeSession.enable = true;
|
|
|
|
remotePlay.openFirewall = true; # Open ports in the firewall for Steam Remote Play
|
|
dedicatedServer.openFirewall = true; # Open ports in the firewall for Source Dedicated Server
|
|
localNetworkGameTransfers.openFirewall = true;
|
|
};
|
|
};
|
|
services.getty.autologinUser = "steam";
|
|
environment = {
|
|
loginShellInit = ''
|
|
[[ "$(tty)" = "/dev/tty1" ]] && ./gs.sh
|
|
'';
|
|
};
|
|
|
|
home-manager.users.steam = {
|
|
home.file."gs.sh" = {
|
|
text = ''
|
|
#!/usr/bin/env bash
|
|
set -xeuo pipefail
|
|
|
|
gamescopeArgs=(
|
|
--adaptive-sync # VRR support
|
|
--hdr-enabled
|
|
--rt
|
|
--steam
|
|
-S DP-1
|
|
)
|
|
steamArgs=(
|
|
-pipewire-dmabuf
|
|
-tenfoot
|
|
--console
|
|
)
|
|
|
|
exec gamescope "$${gamescopeArgs[@]}" -- steam "$${steamArgs[@]}"
|
|
'';
|
|
executable = true;
|
|
};
|
|
};
|
|
};
|
|
}
|