about summary refs log tree commit diff
path: root/singularity.scm
diff options
context:
space:
mode:
Diffstat (limited to 'singularity.scm')
-rw-r--r--singularity.scm42
1 files changed, 42 insertions, 0 deletions
diff --git a/singularity.scm b/singularity.scm
new file mode 100644
index 0000000..9a4c0ce
--- /dev/null
+++ b/singularity.scm
@@ -0,0 +1,42 @@
+(use-modules (gnu packages linux)
+             (guix download)
+             (guix packages))
+
+(package
+  (inherit singularity)
+  (version (package-version singularity))
+  (source (origin
+            (inherit (package-source singularity))
+            (snippet
+             '(begin
+                ;; We put the singularity setuid binaries under
+                ;; /usr/local. The Guix package puts it under
+                ;; /run/privileged/bin. But, we cannot do that since
+                ;; /run is mounted noexec on octopus.
+                (substitute* (find-files "libexec/cli" "\\.exec$")
+                  (("\\$SINGULARITY_libexecdir/singularity/bin/([a-z]+)-suid"
+                    _ program)
+                   (string-append "/usr/local/libexec/singularity/bin/singularity-"
+                                  program "-helper")))
+
+                ;; The remaining snippet code below is copied from the
+                ;; Guix package.
+                
+                ;; Do not create directories in /var.
+                (substitute* "Makefile.in"
+                  (("\\$\\(MAKE\\) .*install-data-hook") ""))
+
+                ;; The original source overrides PATH so that it
+                ;; points to /bin, /usr/local/bin, etc., which
+                ;; obviously doesn't work on Guix System. Leave PATH
+                ;; unchanged so we refer to the installed Coreutils,
+                ;; grep, etc.
+                (substitute* "bin/singularity.in"
+                  (("^PATH=.*" all)
+                   (string-append "#" all "\n")))
+
+                ;; These squashfs mount options are apparently no
+                ;; longer supported since Linux-libre 5.4.5.
+                (substitute* "src/lib/image/squashfs/mount.c"
+                  (("\"errors=remount-ro\"")
+                   "NULL")))))))