-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce memreserver to fix unrecoverable suspend on NixOS 24.11 and…
… AMD APU
- Loading branch information
Showing
6 changed files
with
83 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Imported from https://github.com/NixOS/nixpkgs/pull/225819 to fix GH-959 | ||
|
||
{ | ||
config, | ||
lib, | ||
pkgs, | ||
... | ||
}: | ||
|
||
with lib; | ||
{ | ||
options = { | ||
hardware.memreserver = { | ||
enable = mkOption { | ||
default = false; | ||
type = types.bool; | ||
description = lib.mdDoc '' | ||
Enable memreserver sleep hook. | ||
Makes sure that GPUs with dedicated VRAM can suspend correctly. | ||
''; | ||
}; | ||
}; | ||
}; | ||
|
||
config = mkIf config.hardware.memreserver.enable { | ||
systemd.services.memreserver = { | ||
description = "Sleep hook which frees up RAM needed to evacuate GPU VRAM into"; | ||
before = [ "sleep.target" ]; | ||
wantedBy = [ "sleep.target" ]; | ||
serviceConfig = { | ||
Type = "oneshot"; | ||
ExecStart = "${pkgs.my.memreserver}/bin/memreserver"; | ||
}; | ||
}; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Imported from https://github.com/NixOS/nixpkgs/pull/225819 to fix GH-959 | ||
|
||
{ | ||
lib, | ||
stdenv, | ||
fetchFromGitLab, | ||
meson, | ||
ninja, | ||
pkg-config, | ||
libdrm, | ||
}: | ||
|
||
stdenv.mkDerivation rec { | ||
pname = "memreserver"; | ||
version = "unstable-2023-04-01"; | ||
|
||
src = fetchFromGitLab { | ||
domain = "git.dolansoft.org"; | ||
owner = "lorenz"; | ||
repo = pname; | ||
rev = "480253e565dab935df1d1c4e615ebc8a8dc81ba4"; | ||
hash = "sha256-HjcrH98hH2zKdsHolYCFugL39sT1VjroVhRf8a8dpIA="; | ||
}; | ||
|
||
nativeBuildInputs = [ | ||
meson | ||
ninja | ||
pkg-config | ||
]; | ||
buildInputs = [ libdrm ]; | ||
|
||
meta = with lib; { | ||
homepage = "https://git.dolansoft.org/lorenz/memreserver"; | ||
description = "Sleep hook which frees up RAM needed to evacuate GPU VRAM into"; | ||
license = licenses.mit; | ||
maintainers = with maintainers; [ lorenz ]; | ||
}; | ||
} |