Personal Nix setup
at main 2.0 kB view raw
1{ lib, config, inputs, pkgs, user, ... }: 2 3with lib; 4let 5 cfg = config.modules.apps; 6in { 7 options.modules.apps.games = { 8 enable = mkOption { 9 default = false; 10 example = true; 11 description = "Whether to enable games."; 12 type = types.bool; 13 }; 14 15 hdr = mkOption { 16 default = cfg.games.enable; 17 example = true; 18 description = "Whether to enable HDR."; 19 type = types.bool; 20 }; 21 }; 22 23 config = mkIf (cfg.enable && cfg.games.enable) { 24 boot.kernel.sysctl = { 25 "kernel.unprivileged_userns_clone" = true; 26 }; 27 28 environment.sessionVariables = { 29 PROTONPATH = "${pkgs.proton-ge-bin.steamcompattool}/"; 30 }; 31 32 hardware.steam-hardware.enable = true; 33 users.users."${user}".extraGroups = [ "gamemode" ]; 34 35 environment.systemPackages = [ 36 (pkgs.lutris.override { 37 extraPkgs = (pkgs: with pkgs; [ gamemode ]); 38 }) 39 ]; 40 41 programs = { 42 gamemode.enable = true; 43 gamescope = { 44 enable = true; 45 package = pkgs.gamescope.overrideAttrs (old: { 46 enableWsi = true; 47 enableExecutable = true; 48 NIX_CFLAGS_COMPILE = [ "-fno-fast-math" "-fno-omit-frame-pointer" ]; 49 }); 50 env = { 51 PROTON_ENABLE_WAYLAND = "1"; 52 PROTON_ENABLE_HDR = "1"; 53 }; 54 args = [ 55 "--backend" "wayland" 56 "--adaptive-sync" 57 "--expose-wayland" 58 "--hdr-enabled" 59 "--immediate-flips" 60 "--force-grab-cursor" 61 "--rt" 62 "-f" 63 "-S" "fit" 64 "-W" "2560" 65 "-H" "1440" 66 "-r" "360" 67 ]; 68 }; 69 steam = { 70 enable = true; 71 package = pkgs.steam.override { 72 extraPkgs = pkgs: [ pkgs.gamemode ]; 73 }; 74 remotePlay.openFirewall = true; 75 extraCompatPackages = [ pkgs.proton-ge-bin ]; 76 }; 77 }; 78 79 networking.hosts."0.0.0.0" = [ "ipv6check-http.steamserver.net" ]; 80 }; 81}