mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 23:13:19 +00:00
Merge pull request #327914 from 0z13/nvidia-container-toolkit-device-name
nixos/nvidia-container-toolkit: add device-name-strategy option
This commit is contained in:
commit
ba99ba8ea7
@ -1,4 +1,5 @@
|
||||
{
|
||||
deviceNameStrategy,
|
||||
glibc,
|
||||
jq,
|
||||
lib,
|
||||
@ -25,6 +26,7 @@ writeScriptBin "nvidia-cdi-generator"
|
||||
function cdiGenerate {
|
||||
${lib.getExe' nvidia-container-toolkit "nvidia-ctk"} cdi generate \
|
||||
--format json \
|
||||
--device-name-strategy ${deviceNameStrategy} \
|
||||
--ldconfig-path ${lib.getExe' glibc "ldconfig"} \
|
||||
--library-search-path ${lib.getLib nvidia-driver}/lib \
|
||||
--nvidia-ctk-path ${lib.getExe' nvidia-container-toolkit "nvidia-ctk"}
|
||||
|
@ -52,6 +52,17 @@
|
||||
'';
|
||||
};
|
||||
|
||||
device-name-strategy = lib.mkOption {
|
||||
default = "index";
|
||||
type = lib.types.enum [ "index" "uuid" "type-index" ];
|
||||
description = ''
|
||||
Specify the strategy for generating device names,
|
||||
passed to `nvidia-ctk cdi generate`. This will affect how
|
||||
you reference the device using `nvidia.com/gpu=` in
|
||||
the container runtime.
|
||||
'';
|
||||
};
|
||||
|
||||
mount-nvidia-docker-1-directories = lib.mkOption {
|
||||
default = true;
|
||||
type = lib.types.bool;
|
||||
@ -119,6 +130,7 @@
|
||||
script = pkgs.callPackage ./cdi-generate.nix {
|
||||
inherit (config.hardware.nvidia-container-toolkit) mounts;
|
||||
nvidia-driver = config.hardware.nvidia.package;
|
||||
deviceNameStrategy = config.hardware.nvidia-container-toolkit.device-name-strategy;
|
||||
};
|
||||
in
|
||||
lib.getExe script;
|
||||
|
Loading…
Reference in New Issue
Block a user