about summary refs log tree commit diff
path: root/genenetwork/packages.scm
blob: 8354f9fedf7e62b0644eedb33273d414bab5eacf (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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
;;; genenetwork-machines --- Guix configuration for genenetwork machines
;;; Copyright © 2026 the GeneNetwork team
;;;
;;; This file is part of genenetwork-machines.
;;;
;;; genenetwork-machines is free software: you can redistribute it
;;; and/or modify it under the terms of the GNU General Public License
;;; as published by the Free Software Foundation, either version 3 of
;;; the License, or (at your option) any later version.
;;;
;;; genenetwork-machines is distributed in the hope that it will be
;;; useful, but WITHOUT ANY WARRANTY; without even the implied
;;; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
;;; See the GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with genenetwork-machines.  If not, see
;;; <https://www.gnu.org/licenses/>.

;;; Packages shared by the genenetwork system containers.

(define-module (genenetwork packages)
  #:export (shepherd-for-containers)
  #:use-module (gnu)
  #:use-module ((gnu packages admin) #:select (shepherd-1.0))
  #:use-module (guix packages)
  #:use-module (guix utils))

(define shepherd-for-containers
  ;; shepherd 1.0.9 as PID 1 reads SIGCHLD through signalfd(2): a
  ;; fiber suspends on the signalfd waiting for epoll to wake it.  In
  ;; the run-guix-container daemon sandbox (nested containers) that
  ;; wake-up never fires: children are reaped but the process monitor
  ;; never learns, so any service start that waits for a child's exit
  ;; status -- the stock nginx shepherd's `nginx -t` one-shot and its
  ;; `invoke`-based start, i.e. every spawn-command/system*/invoke in
  ;; a start method -- blocks forever in "starting".  forkexec-based
  ;; starts are unaffected.  Force the classic sigaction + self-pipe
  ;; mechanism (SHEPHERD_DISABLE_SIGNALFD, still available upstream
  ;; as an escape hatch), which works in this environment.
  (package
    (inherit shepherd-1.0)
    (arguments
     (substitute-keyword-arguments (package-arguments shepherd-1.0)
       ;; The upstream test suite does not survive this daemon's build
       ;; sandbox; the containers' own test suites
       ;; (run_container_tests.sh, run_bnw_container_tests.sh, ...)
       ;; cover the deployments instead.
       ((#:tests? _ #f) #f)
       ((#:phases phases #~%standard-phases)
        #~(modify-phases #$phases
            (add-after 'unpack 'prefer-self-pipe-signals
              (lambda _
                (substitute* "modules/shepherd.scm"
                  (("\\(getenv \\\"SHEPHERD_DISABLE_SIGNALFD\\\"\\)")
                   "1"))
                ;; Rewriting the file makes it newer than the prebuilt
                ;; man pages, which would make `make' want to
                ;; regenerate them with help2man (not among the
                ;; native inputs).  Reset the timestamp to the
                ;; SOURCE_DATE_EPOCH the sources were unpacked with.
                (utime "modules/shepherd.scm" 1 1)))))))))