about summary refs log tree commit diff
path: root/singularity.scm
blob: 9a4c0ceb7411d77702165b041018b3efff6067d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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")))))))