From 5396a84b1dcf44b4edb32a56172a3aff677f2aae Mon Sep 17 00:00:00 2001 From: Yueh-Shun Li Date: Sun, 11 Aug 2024 10:58:06 +0800 Subject: [PATCH] singularity-tools: string-interpolate and and quote members in contents String-interpolation converts path objects inside `contents` into store paths to ensure they are properly included in the result image. See tests.trivial-builders.references for the necessity of string-interpolation. Quote each string-interpolated content member to accomodates spaces inside. --- pkgs/build-support/singularity-tools/default.nix | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkgs/build-support/singularity-tools/default.nix b/pkgs/build-support/singularity-tools/default.nix index 4eed6abae016..12e35720faf6 100644 --- a/pkgs/build-support/singularity-tools/default.nix +++ b/pkgs/build-support/singularity-tools/default.nix @@ -120,7 +120,12 @@ lib.makeExtensible (final: { cp -ar "$f" "./$f" done - for c in ${toString contents} ; do + # TODO(@ShamrockLee): + # Once vmTools.runInLinuxVMm works with `__structuredAttrs = true` (#334705), + # set __structuredAttrs = true and pass contents as an attribute + # so that we could loop with `for c in ''${contents[@]}` + # instead of expanding all the paths in contents into the Bash string. + for c in ${lib.escapeShellArgs contents} ; do for f in "$c"/bin/* ; do if [ ! -e "bin/$(basename "$f")" ] ; then ln -s "$f" bin/