me
/
guix
Archived
1
0
Fork 0

services: nix: Add more configuration fields.

* gnu/services/nix.scm (<nix-configuration>)[build-directory]: New field.
(nix-service-etc, nix-shepherd-service): Take them into account.
* doc/guix.texi (Nix): Update it.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Petr Hodina 2022-10-31 16:12:38 +01:00 committed by Ludovic Courtès
parent bbcd06e56c
commit 22acc0b029
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
2 changed files with 17 additions and 3 deletions

View File

@ -37209,6 +37209,15 @@ The Nix package to use.
@item @code{sandbox} (default: @code{#t}) @item @code{sandbox} (default: @code{#t})
Specifies whether builds are sandboxed by default. Specifies whether builds are sandboxed by default.
@item @code{build-directory} (default: @code{"/tmp"})
The directory where build directory are stored during builds.
This is useful to change if, for example, the default location does not
have enough space to hold build trees for big packages.
This is similar to setting the @env{TMPDIR} environment variable for
@command{guix-daemon}. @ref{Build Environment Setup, @env{TMPDIR}},
for more info.
@item @code{build-sandbox-items} (default: @code{'()}) @item @code{build-sandbox-items} (default: @code{'()})
This is a list of strings or objects appended to the This is a list of strings or objects appended to the
@code{build-sandbox-items} field of the configuration file. @code{build-sandbox-items} field of the configuration file.

View File

@ -54,6 +54,8 @@
(default nix)) (default nix))
(sandbox nix-configuration-sandbox ;boolean (sandbox nix-configuration-sandbox ;boolean
(default #t)) (default #t))
(build-directory nix-configuration-build-directory ;string
(default "/tmp"))
(build-sandbox-items nix-configuration-build-sandbox-items ;list of strings (build-sandbox-items nix-configuration-build-sandbox-items ;list of strings
(default '())) (default '()))
(extra-config nix-configuration-extra-config ;list of strings (extra-config nix-configuration-extra-config ;list of strings
@ -106,7 +108,7 @@ GID."
(define nix-service-etc (define nix-service-etc
(match-lambda (match-lambda
(($ <nix-configuration> package sandbox build-sandbox-items extra-config) (($ <nix-configuration> package sandbox build-directory build-sandbox-items extra-config)
(let ((ref-file (references-file package))) (let ((ref-file (references-file package)))
`(("nix/nix.conf" `(("nix/nix.conf"
,(computed-file ,(computed-file
@ -130,7 +132,7 @@ GID."
(define nix-shepherd-service (define nix-shepherd-service
;; Return a <shepherd-service> for Nix. ;; Return a <shepherd-service> for Nix.
(match-lambda (match-lambda
(($ <nix-configuration> package _ _ _ extra-options) (($ <nix-configuration> package _ build-directory _ _ extra-options)
(list (list
(shepherd-service (shepherd-service
(provision '(nix-daemon)) (provision '(nix-daemon))
@ -138,7 +140,10 @@ GID."
(requirement '()) (requirement '())
(start #~(make-forkexec-constructor (start #~(make-forkexec-constructor
(list (string-append #$package "/bin/nix-daemon") (list (string-append #$package "/bin/nix-daemon")
#$@extra-options))) #$@extra-options)
#:environment-variables
(list (string-append "TMPDIR=" build-directory)
"PATH=/run/current-system/profile/bin")))
(respawn? #f) (respawn? #f)
(stop #~(make-kill-destructor))))))) (stop #~(make-kill-destructor)))))))