mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-24 02:00:41 +03:00
39 lines
1 KiB
Nix
39 lines
1 KiB
Nix
![]() |
{ config, lib, pkgs, ... }:
|
||
|
|
||
|
{
|
||
|
|
||
|
options = {
|
||
|
|
||
|
hardware.nvidia-container-toolkit-cdi-generator.enable = lib.mkOption {
|
||
|
default = false;
|
||
|
internal = true;
|
||
|
visible = false;
|
||
|
type = lib.types.bool;
|
||
|
description = lib.mdDoc ''
|
||
|
Enable dynamic CDI configuration for NVidia devices by running
|
||
|
nvidia-container-toolkit on boot.
|
||
|
'';
|
||
|
};
|
||
|
|
||
|
};
|
||
|
|
||
|
config = {
|
||
|
|
||
|
systemd.services.nvidia-container-toolkit-cdi-generator = lib.mkIf config.hardware.nvidia-container-toolkit-cdi-generator.enable {
|
||
|
description = "Container Device Interface (CDI) for Nvidia generator";
|
||
|
wantedBy = [ "multi-user.target" ];
|
||
|
after = [ "systemd-udev-settle.service" ];
|
||
|
serviceConfig = {
|
||
|
RuntimeDirectory = "cdi";
|
||
|
RemainAfterExit = true;
|
||
|
ExecStart = let
|
||
|
script = (pkgs.writeScriptBin "nvidia-cdi-generator"
|
||
|
(import ./cdi-generate.nix { inherit config lib pkgs; })); in (lib.getExe script);
|
||
|
Type = "oneshot";
|
||
|
};
|
||
|
};
|
||
|
|
||
|
};
|
||
|
|
||
|
}
|