guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

04/04: services: nix: Add more configuration fields.


From: guix-commits
Subject: 04/04: services: nix: Add more configuration fields.
Date: Tue, 13 Dec 2022 11:53:15 -0500 (EST)

civodul pushed a commit to branch master
in repository guix.

commit 22acc0b0291cc067a6a3ce36c7ca8e5f68fe4db6
Author: Petr Hodina <phodina@protonmail.com>
AuthorDate: Mon Oct 31 16:12:38 2022 +0100

    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>
---
 doc/guix.texi        |  9 +++++++++
 gnu/services/nix.scm | 11 ++++++++---
 2 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index aacf748838..b270964542 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -37209,6 +37209,15 @@ The Nix package to use.
 @item @code{sandbox} (default: @code{#t})
 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{'()})
 This is a list of strings or objects appended to the
 @code{build-sandbox-items} field of the configuration file.
diff --git a/gnu/services/nix.scm b/gnu/services/nix.scm
index df04a85c22..dcf994b603 100644
--- a/gnu/services/nix.scm
+++ b/gnu/services/nix.scm
@@ -54,6 +54,8 @@
                        (default nix))
   (sandbox             nix-configuration-sandbox ;boolean
                        (default #t))
+  (build-directory     nix-configuration-build-directory ;string
+                       (default "/tmp"))
   (build-sandbox-items nix-configuration-build-sandbox-items ;list of strings
                        (default '()))
   (extra-config        nix-configuration-extra-config ;list of strings
@@ -106,7 +108,7 @@ GID."
 
 (define nix-service-etc
   (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)))
        `(("nix/nix.conf"
           ,(computed-file
@@ -130,7 +132,7 @@ GID."
 (define nix-shepherd-service
   ;; Return a <shepherd-service> for Nix.
   (match-lambda
-    (($ <nix-configuration> package _ _ _ extra-options)
+    (($ <nix-configuration> package _ build-directory _ _ extra-options)
      (list
       (shepherd-service
        (provision '(nix-daemon))
@@ -138,7 +140,10 @@ GID."
        (requirement '())
        (start #~(make-forkexec-constructor
                  (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)
        (stop #~(make-kill-destructor)))))))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]