7 cfg = config.programs.gamescope;
12 lib.optional (cfg.args != [ ])
13 ''--add-flags "${builtins.toString cfg.args}"''
14 ++ builtins.attrValues (builtins.mapAttrs (var: val: "--set-default ${var} ${val}") cfg.env);
16 pkgs.runCommand "gamescope" { nativeBuildInputs = [ pkgs.makeBinaryWrapper ]; } ''
18 makeWrapper ${cfg.package}/bin/gamescope $out/bin/gamescope --inherit-argv0 \
19 ${builtins.toString wrapperArgs}
20 ln -s ${cfg.package}/bin/gamescopectl $out/bin/gamescopectl
24 options.programs.gamescope = {
25 enable = lib.mkEnableOption "gamescope, the SteamOS session compositing window manager";
27 package = lib.mkPackageOption pkgs "gamescope" { };
29 capSysNice = lib.mkOption {
30 type = lib.types.bool;
33 Add cap_sys_nice capability to the GameScope
34 binary so that it may renice itself.
39 type = lib.types.listOf lib.types.str;
41 example = [ "--rt" "--prefer-vk-device 8086:9bc4" ];
43 Arguments passed to GameScope on startup.
48 type = lib.types.attrsOf lib.types.str;
50 example = lib.literalExpression ''
51 # for Prime render offload on Nvidia laptops.
52 # Also requires `hardware.nvidia.prime.offload.enable`.
54 __NV_PRIME_RENDER_OFFLOAD = "1";
55 __VK_LAYER_NV_optimus = "NVIDIA_only";
56 __GLX_VENDOR_LIBRARY_NAME = "nvidia";
60 Default environment variables available to the GameScope process, overridable at runtime.
65 config = lib.mkIf cfg.enable {
66 security.wrappers = lib.mkIf cfg.capSysNice {
70 source = "${gamescope}/bin/gamescope";
71 capabilities = "cap_sys_nice+pie";
75 environment.systemPackages = lib.mkIf (!cfg.capSysNice) [ gamescope ];
78 meta.maintainers = with lib.maintainers; [ nrdxp ];