-
Notifications
You must be signed in to change notification settings - Fork 52
/
steam.nix
111 lines (95 loc) · 3.47 KB
/
steam.nix
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
{ config, lib, pkgs, ... }:
let
inherit (lib)
mkDefault
mkIf
mkMerge
;
cfg = config.jovian.steam;
in
{
config = mkIf cfg.enable (mkMerge [
{
warnings = []
++ lib.optional (!config.networking.networkmanager.enable)
"The Steam Deck UI integrates with NetworkManager (networking.networkmanager.enable) which is not enabled. NetworkManager is required to complete the first-time setup process.";
}
{
security.wrappers.gamescope = {
owner = "root";
group = "root";
source = "${pkgs.gamescope}/bin/gamescope";
capabilities = "cap_sys_nice+pie";
};
security.wrappers.galileo-mura-extractor = {
owner = "root";
group = "root";
source = "${pkgs.galileo-mura}/bin/galileo-mura-extractor";
setuid = true;
};
}
{
# Enable the usual desktop Steam stuff
programs.steam.enable = mkDefault true;
# Enable MTU probing, as vendor does
# See: https://github.com/ValveSoftware/SteamOS/issues/1006
# See also: https://www.reddit.com/r/SteamDeck/comments/ymqvbz/ubisoft_connect_connection_lost_stuck/j36kk4w/?context=3
boot.kernel.sysctl."net.ipv4.tcp_mtu_probing" = true;
hardware.graphics = {
enable32Bit = true;
extraPackages = [ pkgs.gamescope-wsi ];
extraPackages32 = [ pkgs.pkgsi686Linux.gamescope-wsi ];
};
hardware.pulseaudio.support32Bit = true;
hardware.steam-hardware.enable = mkDefault true;
environment.systemPackages = [ pkgs.gamescope-session pkgs.steamos-polkit-helpers pkgs.steamos-manager ];
systemd.packages = [ pkgs.gamescope-session pkgs.steamos-manager ];
# Vendor patch: https://raw.githubusercontent.com/Jovian-Experiments/PKGBUILDs-mirror/cdaeca26642d59fc9109e98ac9ce2efe5261df1b/0001-Add-systemd-service.patch
systemd.user.services.wakehook = {
wantedBy = ["gamescope-session.service"];
after = ["gamescope-session.service"];
serviceConfig = {
ExecStart = lib.getExe pkgs.wakehook;
Restart = "always";
};
};
systemd.user.services.steamos-manager = {
overrideStrategy = "asDropin";
wantedBy = [ "gamescope-session.service" ];
};
services.dbus.packages = [ pkgs.steamos-manager ];
services.displayManager.sessionPackages = [ pkgs.gamescope-session ];
# Conflicts with powerbuttond
services.logind.extraConfig = ''
HandlePowerKey=ignore
'';
services.udev.packages = [
pkgs.powerbuttond
];
# This rule allows the user to configure Wi-Fi in Deck UI.
#
# Steam modifies the system network configs via
# `org.freedesktop.NetworkManager.settings.modify.system`,
# which normally requires being in the `networkmanager` group.
security.polkit.extraConfig = ''
// Jovian-NixOS/steam: Allow users to configure Wi-Fi in Deck UI
polkit.addRule(function(action, subject) {
if (
action.id.indexOf("org.freedesktop.NetworkManager") == 0 &&
subject.isInGroup("users") &&
subject.local &&
subject.active
) {
return polkit.Result.YES;
}
});
'';
jovian.steam.environment = {
# We don't support adopting a drive, yet.
STEAM_ALLOW_DRIVE_ADOPT = mkDefault "0";
# Ejecting doesn't work, either.
STEAM_ALLOW_DRIVE_UNMOUNT = mkDefault "0";
};
}
]);
}