diff options
| -rw-r--r-- | etc/gnu-store.mount.in | 3 | ||||
| -rw-r--r-- | etc/guix-daemon.service.in | 22 |
2 files changed, 21 insertions, 4 deletions
diff --git a/etc/gnu-store.mount.in b/etc/gnu-store.mount.in index c94f2db72be..f9918c9e52e 100644 --- a/etc/gnu-store.mount.in +++ b/etc/gnu-store.mount.in | |||
| @@ -2,10 +2,9 @@ | |||
| 2 | Description=Read-only @storedir@ for GNU Guix | 2 | Description=Read-only @storedir@ for GNU Guix |
| 3 | DefaultDependencies=no | 3 | DefaultDependencies=no |
| 4 | ConditionPathExists=@storedir@ | 4 | ConditionPathExists=@storedir@ |
| 5 | Before=guix-daemon.service | ||
| 6 | 5 | ||
| 7 | [Install] | 6 | [Install] |
| 8 | WantedBy=guix-daemon.service | 7 | WantedBy=multi-user.target |
| 9 | 8 | ||
| 10 | [Mount] | 9 | [Mount] |
| 11 | What=@storedir@ | 10 | What=@storedir@ |
diff --git a/etc/guix-daemon.service.in b/etc/guix-daemon.service.in index 5c43d9b7f1b..6a5ef97f9b3 100644 --- a/etc/guix-daemon.service.in +++ b/etc/guix-daemon.service.in | |||
| @@ -5,11 +5,29 @@ | |||
| 5 | [Unit] | 5 | [Unit] |
| 6 | Description=Build daemon for GNU Guix | 6 | Description=Build daemon for GNU Guix |
| 7 | 7 | ||
| 8 | # Start before 'gnu-store.mount' to get a writable view of the store. | ||
| 9 | Before=gnu-store.mount | ||
| 10 | |||
| 8 | [Service] | 11 | [Service] |
| 9 | ExecStart=@localstatedir@/guix/profiles/per-user/root/current-guix/bin/guix-daemon \ | 12 | ExecStart=@localstatedir@/guix/profiles/per-user/root/current-guix/bin/guix-daemon \ |
| 10 | --build-users-group=guixbuild --discover=no \ | 13 | --discover=no \ |
| 11 | --substitute-urls='@GUIX_SUBSTITUTE_URLS@' | 14 | --substitute-urls='@GUIX_SUBSTITUTE_URLS@' |
| 12 | Environment='GUIX_LOCPATH=@localstatedir@/guix/profiles/per-user/root/guix-profile/lib/locale' LC_ALL=en_US.utf8 | 15 | Environment='GUIX_STATE_DIRECTORY=@localstatedir@/guix' 'GUIX_LOCPATH=@localstatedir@/guix/profiles/per-user/root/guix-profile/lib/locale' LC_ALL=en_US.utf8 |
| 16 | |||
| 17 | # Run under a dedicated unprivileged user account. | ||
| 18 | User=guix-daemon | ||
| 19 | |||
| 20 | # Bind-mount the store read-write in a private namespace, to counter the | ||
| 21 | # effect of 'gnu-store.mount'. | ||
| 22 | PrivateMounts=true | ||
| 23 | BindPaths=@storedir@ | ||
| 24 | |||
| 25 | # Provide the CAP_CHOWN capability so that guix-daemon can create and chown | ||
| 26 | # /var/guix/profiles/per-user/$USER and also chown failed build directories | ||
| 27 | # when using '--keep-failed'. Note that guix-daemon explicitly drops ambient | ||
| 28 | # capabilities before executing build processes so they don't inherit them. | ||
| 29 | AmbientCapabilities=CAP_CHOWN | ||
| 30 | |||
| 13 | StandardOutput=journal | 31 | StandardOutput=journal |
| 14 | StandardError=journal | 32 | StandardError=journal |
| 15 | 33 | ||
