Skip to content

Commit

Permalink
nvidia-container-toolkit: only mount existing paths in the host
Browse files Browse the repository at this point in the history
  • Loading branch information
ereslibre committed Aug 16, 2024
1 parent b764d78 commit b4b1b39
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
options = mountOptions;
};
jqAddMountExpression = ".containerEdits.mounts[.containerEdits.mounts | length] |= . +";
allJqMounts = lib.concatMap
existingJqMounts = lib.concatMap
(mount:
["${lib.getExe jq} '${jqAddMountExpression} ${builtins.toJSON (mkMount mount)}'"])
mounts;
(builtins.filter (mount: builtins.pathExists mount.hostPath) mounts);
in
writeScriptBin "nvidia-cdi-generator"
''
Expand All @@ -33,5 +33,5 @@ function cdiGenerate {
}
cdiGenerate | \
${lib.concatStringsSep " | " allJqMounts} > $RUNTIME_DIRECTORY/nvidia-container-toolkit.json
${lib.concatStringsSep " | " existingJqMounts} > $RUNTIME_DIRECTORY/nvidia-container-toolkit.json
''

0 comments on commit b4b1b39

Please sign in to comment.