diff options
author | Someone Serge <sergei.kozlukov@aalto.fi> | 2024-01-08 17:03:15 +0000 |
---|---|---|
committer | Someone Serge <sergei.kozlukov@aalto.fi> | 2024-01-10 20:47:55 +0000 |
commit | 562dd639328c5da2fa5291c0f9d9860adf8f57a4 (patch) | |
tree | 4f8f85c0fdbbabbae43407df905339cdd32103f8 /pkgs/applications/virtualization/singularity/generic.nix | |
parent | 231aca2b973e4f82703303fb3d4dce692d0aa4ee (diff) |
apptainer: fix nvliblist.conf-based --nv
(cherry picked from commit 680bbed84fd37e5a46330e1c9b63a7a60a9e4933)
Diffstat (limited to 'pkgs/applications/virtualization/singularity/generic.nix')
-rw-r--r-- | pkgs/applications/virtualization/singularity/generic.nix | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/pkgs/applications/virtualization/singularity/generic.nix b/pkgs/applications/virtualization/singularity/generic.nix index 6fd2905d9d4e9..85992e2abce9d 100644 --- a/pkgs/applications/virtualization/singularity/generic.nix +++ b/pkgs/applications/virtualization/singularity/generic.nix @@ -27,6 +27,7 @@ in , buildGoModule , runCommandLocal # Native build inputs +, addDriverRunpath , makeWrapper , pkg-config , util-linux @@ -55,6 +56,9 @@ in , hello # Overridable configurations , enableNvidiaContainerCli ? true + # --nvccli currently requires extra privileges: + # https://github.com/apptainer/apptainer/issues/1893#issuecomment-1881240800 +, forceNvcCli ? false # Compile with seccomp support # SingularityCE 3.10.0 and above requires explicit --without-seccomp when libseccomp is not available. , enableSeccomp ? true @@ -66,6 +70,7 @@ in # Whether to compile with SUID support , enableSuid ? false , starterSuidPath ? null +, substituteAll # newuidmapPath and newgidmapPath are to support --fakeroot # where those SUID-ed executables are unavailable from the FHS system PATH. # Path to SUID-ed newuidmap executable @@ -95,6 +100,10 @@ in (buildGoModule { inherit pname version src; + patches = lib.optionals (projectName == "apptainer") [ + (substituteAll { src = ./apptainer/0001-ldCache-patch-for-driverLink.patch; inherit (addDriverRunpath) driverLink; }) + ]; + # Override vendorHash with the output got from # nix-prefetch -E "{ sha256 }: ((import ./. { }).apptainer.override { vendorHash = sha256; }).goModules" # or with `null` when using vendored source tarball. @@ -220,7 +229,7 @@ in wrapProgram "$out/bin/${projectName}" \ --prefix PATH : "''${defaultPathInputs// /\/bin:}''${defaultPathInputs:+/bin:}" # Make changes in the config file - ${lib.optionalString enableNvidiaContainerCli '' + ${lib.optionalString forceNvcCli '' substituteInPlace "$out/etc/${projectName}/${projectName}.conf" \ --replace "use nvidia-container-cli = no" "use nvidia-container-cli = yes" ''} @@ -291,7 +300,7 @@ in let unwrapped = writeShellScriptBin "apptainer-cuda-saxpy" '' - ${lib.getExe finalAttrs.finalPackage} exec --nv $@ ${finalAttrs.passthru.gpuChecks.image-saxpy} saxpy + ${lib.getExe finalAttrs.finalPackage} exec --nv $@ ${finalAttrs.passthru.tests.image-saxpy} saxpy ''; in runCommand "run-apptainer-cuda-saxpy" |