-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathguest.nix
39 lines (36 loc) · 1.58 KB
/
guest.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
{ pkgs, lib, config, inputs, ... }@args:
with lib;
{
config = mkIf (builtins.hasAttr "vgpuPatcher" config.hardware.nvidia.package) {
systemd.services.nvidia-gridd = {
description = "NVIDIA Grid Daemon";
wants = [ "network-online.target" "nvidia-persistenced.service" ];
after = [ "systemd-resolved.service" "network-online.target" "nvidia-persistenced.service" ];
wantedBy = [ "multi-user.target" ];
environment = { LD_LIBRARY_PATH = "${getOutput "out" config.hardware.nvidia.package}/lib"; };
serviceConfig = {
Type = "forking";
# make sure /var/lib/nvidia exists, otherwise service will fail
ExecStartPre = "${pkgs.coreutils}/bin/mkdir -p /var/lib/nvidia";
ExecStart = "${getBin config.hardware.nvidia.package}/bin/nvidia-gridd";
ExecStopPost = "${pkgs.coreutils}/bin/rm -rf /var/run/nvidia-gridd";
};
restartIfChanged = false;
};
systemd.services.nvidia-topologyd = {
description = "NVIDIA Topology Daemon";
wantedBy = [ "multi-user.target" ];
serviceConfig = {
Type = "forking";
ExecStart = "${getBin config.hardware.nvidia.package}/bin/nvidia-topologyd";
};
restartIfChanged = false;
};
environment.etc = {
"nvidia/gridd.conf.template".source = config.hardware.nvidia.package + /gridd.conf.template;
"nvidia/nvidia-topologyd.conf.template".source = config.hardware.nvidia.package + /nvidia-topologyd.conf.template;
};
# nvidia modeset MUST be enabled in order to work correctly
hardware.nvidia.modesetting.enable = true;
};
}