summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2020-03-12 15:44:26 +0100
committerLudovic Courtès <ludo@gnu.org>2020-03-12 18:32:16 +0100
commit22464cf32abcd38311eb29001a23b26f8c4c54dc (patch)
tree7a1efa01d8a5e9adf88c8ccc4227b73b272d466e
parentcf2ac04f13d9266c7c8a2ebd2e85ef593231ac9d (diff)
downloadguix-22464cf32abcd38311eb29001a23b26f8c4c54dc.tar.gz
gnu: singularity: Wrap programs so they find Coreutils.
* gnu/packages/linux.scm (singularity)[arguments]: Add 'set-PATH' phase.
-rw-r--r--gnu/packages/linux.scm14
1 files changed, 13 insertions, 1 deletions
diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index b6048a8cfb..e864e17800 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -3494,7 +3494,19 @@ thanks to the use of namespaces.")
                (("if ! singularity_which mksquashfs") "if 0")
                (("if ! mksquashfs")
                 (string-append "if ! " (which "mksquashfs"))))
-             #t)))))
+             #t))
+         (add-after 'install 'set-PATH
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             ;; Have the 'singularity' and 'run-singularity' self-sufficient.
+             (let ((out (assoc-ref outputs "out"))
+                   (coreutils (assoc-ref inputs "coreutils")))
+               (wrap-program (string-append out "/bin/singularity")
+                 `("PATH" ":" = (,(string-append coreutils "/bin"))))
+               (substitute* (string-append out "/bin/run-singularity")
+                 (("/usr/bin/env singularity")
+                  (string-append (which "env") " "
+                                 out "/bin/singularity")))
+               #t))))))
     (inputs
      `(("libarchive" ,libarchive)
        ("python" ,python-wrapper)