-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodule.nix
More file actions
74 lines (65 loc) · 2.28 KB
/
Copy pathmodule.nix
File metadata and controls
74 lines (65 loc) · 2.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# SPDX-License-Identifier: GPL-3.0-or-later
#
# module.nix — NixOS module for gamesteam.
#
# Builds gamesteam against the *consuming* system's pkgs (via callPackage), so
# it works on any architecture and needs no nixpkgs.follows. It also enables the
# daemons/capabilities the wrapper depends on — installing the binaries alone
# would leave gamemode and gamescope's --rt silently doing nothing.
{ config, lib, pkgs, ... }:
let
cfg = config.programs.gamesteam;
in
{
options.programs.gamesteam = {
enable = lib.mkEnableOption "gamesteam, a universal GPU-aware Steam/Proton launch wrapper";
package = lib.mkOption {
type = lib.types.package;
default = pkgs.callPackage ./package.nix { };
defaultText = lib.literalExpression "pkgs.callPackage ./package.nix { }";
description = "The gamesteam package to install.";
};
gamescope.enable = lib.mkOption {
type = lib.types.bool;
default = true;
description = ''
Enable {option}`programs.gamescope` with `capSysNice` so gamesteam's
`--rt` realtime scheduling is permitted. Disable if you configure
gamescope yourself.
'';
};
gamemode.enable = lib.mkOption {
type = lib.types.bool;
default = true;
description = ''
Enable {option}`programs.gamemode` (daemon + polkit rules). Without it,
`gamemoderun` is inert. Disable if gamemode is enabled elsewhere.
'';
};
powerProfilesDaemon.enable = lib.mkOption {
type = lib.types.bool;
default = true;
description = ''
Enable {option}`services.power-profiles-daemon` so gamesteam can switch
to the performance profile for the session (restored on exit). Set to
`false` if you use TLP — the two conflict. gamesteam tolerates the daemon
being absent and simply skips the profile switch.
'';
};
};
config = lib.mkIf cfg.enable (lib.mkMerge [
{ environment.systemPackages = [ cfg.package ]; }
(lib.mkIf cfg.gamescope.enable {
programs.gamescope = {
enable = true;
capSysNice = true;
};
})
(lib.mkIf cfg.gamemode.enable {
programs.gamemode.enable = true;
})
(lib.mkIf cfg.powerProfilesDaemon.enable {
services.power-profiles-daemon.enable = true;
})
]);
}