From ac776695313a2da0ee99ba328da474f606a7a9d9 Mon Sep 17 00:00:00 2001 From: Yueh-Shun Li Date: Tue, 22 Aug 2023 18:05:31 +0800 Subject: apptainer, singularity: make LOCALSTATEDIR internal by default Use "$out/var/lib" as LOCALSTATEDIR configuration value by default intsead of "/var/lib" as a way toward top-level-directory independent runtime. Add input argument externalLocalStateDir to optionally specify the path to external LOCALSTATEDIR if not null. Add NixOS module option programs.singularity.enableExternalLocalStateDir (default to true) to use "/var/lib" as LOCALSTATEDIR. --- pkgs/applications/virtualization/singularity/generic.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'pkgs/applications/virtualization') diff --git a/pkgs/applications/virtualization/singularity/generic.nix b/pkgs/applications/virtualization/singularity/generic.nix index 2e4d589d158ee..7451bcf6b96f2 100644 --- a/pkgs/applications/virtualization/singularity/generic.nix +++ b/pkgs/applications/virtualization/singularity/generic.nix @@ -71,6 +71,8 @@ in , newuidmapPath ? null # Path to SUID-ed newgidmap executable , newgidmapPath ? null + # External LOCALSTATEDIR +, externalLocalStateDir ? null # Remove the symlinks to `singularity*` when projectName != "singularity" , removeCompat ? false # Workaround #86349 @@ -106,6 +108,7 @@ in inherit enableSeccomp enableSuid + externalLocalStateDir projectName removeCompat starterSuidPath @@ -141,7 +144,7 @@ in configureScript = "./mconfig"; configureFlags = [ - "--localstatedir=/var/lib" + "--localstatedir=${if externalLocalStateDir != null then externalLocalStateDir else "${placeholder "out"}/var/lib"}" "--runstatedir=/var/run" ] ++ lib.optional (!enableSeccomp) "--without-seccomp" -- cgit 1.4.1