38 lines
1.3 KiB
Nix
38 lines
1.3 KiB
Nix
{
|
|
config,
|
|
pkgs,
|
|
makeEnable,
|
|
lib,
|
|
...
|
|
}:
|
|
makeEnable config "myModules.nvidia" false {
|
|
environment.systemPackages = with pkgs; [
|
|
nvidia-container-toolkit
|
|
nvidia-container-toolkit.tools
|
|
];
|
|
hardware.nvidia-container-toolkit = {
|
|
enable = true;
|
|
mount-nvidia-executables = true;
|
|
# additionalEdit = ''
|
|
# ${lib.getExe pkgs.jq} '
|
|
# .devices |= map(
|
|
# .containerEdits.hooks |= map(select(.args | index("nvidia-cdi-hook") < 0))
|
|
# )' | ${lib.getExe pkgs.jq} '.containerEdits.hooks |= map(select(.args | index("nvidia-cdi-hook") < 0 ))' '';
|
|
};
|
|
hardware.nvidia.open = true;
|
|
hardware.graphics.enable32Bit = true;
|
|
hardware.graphics.extraPackages = [config.hardware.nvidia.package.out];
|
|
hardware.graphics.extraPackages32 = [config.hardware.nvidia.package.lib32];
|
|
systemd.services.nvidia-container-toolkit-cdi-generator.serviceConfig = {
|
|
# During `nixos-rebuild switch`, the NVIDIA userspace package can be newer
|
|
# than the already-loaded kernel module. In that transient state NVML exits
|
|
# with a driver/library mismatch, but the generator succeeds again after the
|
|
# reboot that loads the matching module.
|
|
SuccessExitStatus = ["1"];
|
|
};
|
|
services.xserver = {
|
|
videoDrivers = ["nvidia"];
|
|
};
|
|
# nixpkgs.config.cudaSupport = true;
|
|
}
|