Skip to content

Commit 58a7582

Browse files
authored
Merge pull request #156 from CORAAL/fix_laptopStandby
fix nvidia standby
2 parents 13d7b67 + 17b7cf4 commit 58a7582

File tree

3 files changed

+63
-0
lines changed

3 files changed

+63
-0
lines changed

modules/default/default.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
./system.nix
1717
./update.nix
1818
./version.nix
19+
./standBy.nix
1920
];
2021

2122
}

modules/default/nvidia.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ in
4949

5050
dynamicBoost.enable = cfg.laptop;
5151
powerManagement.enable = cfg.laptop;
52+
5253
};
5354
};
5455
}

modules/default/standBy.nix

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
{
2+
lib,
3+
config,
4+
pkgs,
5+
...
6+
}:
7+
8+
{
9+
10+
options.glf.standBy.enable = lib.mkOption {
11+
description = "Enable Standby fix";
12+
type = lib.types.bool;
13+
default = true;
14+
};
15+
16+
config = lib.mkIf config.glf.standBy.enable {
17+
18+
boot.kernelParams = [
19+
"nvidia.NVreg_PreserveVideoMemoryAllocations=1"
20+
"NVreg_TemporaryFilePath=/var/tmp"
21+
];
22+
23+
systemd = {
24+
services."gnome-suspend" = {
25+
description = "suspend gnome shell";
26+
before = [
27+
"systemd-suspend.service"
28+
"systemd-hibernate.service"
29+
"nvidia-suspend.service"
30+
"nvidia-hibernate.service"
31+
];
32+
wantedBy = [
33+
"systemd-suspend.service"
34+
"systemd-hibernate.service"
35+
];
36+
serviceConfig = {
37+
Type = "oneshot";
38+
ExecStart = ''${pkgs.procps}/bin/pkill -f -STOP ${pkgs.gnome-shell}/bin/gnome-shell'';
39+
};
40+
};
41+
services."gnome-resume" = {
42+
description = "resume gnome shell";
43+
after = [
44+
"systemd-suspend.service"
45+
"systemd-hibernate.service"
46+
"nvidia-resume.service"
47+
];
48+
wantedBy = [
49+
"systemd-suspend.service"
50+
"systemd-hibernate.service"
51+
];
52+
serviceConfig = {
53+
Type = "oneshot";
54+
ExecStart = ''${pkgs.procps}/bin/pkill -f -CONT ${pkgs.gnome-shell}/bin/gnome-shell'';
55+
};
56+
};
57+
};
58+
59+
};
60+
61+
}

0 commit comments

Comments
 (0)