GNU bug report logs -
#41704
[PATCH] services: nix: Set NIX_CONF_DIR environment variable.
Previous Next
Reported by: Peng Mei Yu <pengmeiyu <at> riseup.net>
Date: Thu, 4 Jun 2020 08:36:01 UTC
Severity: normal
Tags: patch
Done: Peng Mei Yu <pengmeiyu <at> riseup.net>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Your bug report
#41704: [PATCH] services: nix: Set NIX_CONF_DIR environment variable.
which was filed against the guix-patches package, has been closed.
The explanation is attached below, along with your original report.
If you require more details, please reply to 41704 <at> debbugs.gnu.org.
--
41704: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=41704
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
Hi,
Tobias Geerinckx-Rice writes:
> I agree with Ludo' that fixing this at the package level is more ‘appropriate’
> than in the service.
I agree too.
>> There is no obvious way to fix the error, so setting NIX_CONF_DIR is
>> easier. Perhaps someone can fix the nix package with a clean patch.
>> That would be better.
>
> Obvious is different things to different people, but here's my go-to approach.
> Override the relevant variables during the install phase without changing any
> run-time settings:
>
> #+begin_example
> diff --git a/gnu/packages/package-management.scm
> b/gnu/packages/package-management.scm
> index c1e6657dff..fefa17a162 100644
> --- a/gnu/packages/package-management.scm
> +++ b/gnu/packages/package-management.scm
> @@ -551,6 +551,19 @@ out) and returning a package that uses that as its
> 'source'."
> (base32
> "1hbqsrp1ii2sfq8x2mahjrl2182qck76n8blrl1jfz3xq99m6i15"))))
> (build-system gnu-build-system)
> + (arguments
> + `(#:configure-flags
> + (list "--sysconfdir=/etc")
> + #:phases
> + (modify-phases %standard-phases
> + (replace 'install
> + (lambda* (#:key (make-flags '()) outputs #:allow-other-keys)
> + (let* ((out (assoc-ref outputs "out"))
> + (etc (string-append out "/etc")))
> + (apply invoke "make" "install"
> + (string-append "sysconfdir=" etc)
> + (string-append "profiledir=" etc "/profile.d")
> + make-flags)))))))
> (native-inputs `(("pkg-config" ,pkg-config)))
> (inputs `(("boost" ,boost)
> ("brotli" ,brotli)
> #+end_example
>
> It installs correctly. I didn't test the service.
This is the clean patch I was asking for. The service works well on my
computer. Thank you. Please push this patch.
--
Peng Mei Yu
[Message part 3 (message/rfc822, inline)]
* gnu/services/nix.scm (nix-shepherd-service): Set NIX_CONF_DIR environment
variable to "/etc/nix".
---
gnu/services/nix.scm | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/gnu/services/nix.scm b/gnu/services/nix.scm
index dfe33991d0..2cdddd8866 100644
--- a/gnu/services/nix.scm
+++ b/gnu/services/nix.scm
@@ -96,7 +96,9 @@ GID."
(documentation "Run nix-daemon.")
(requirement '())
(start #~(make-forkexec-constructor
- (list (string-append #$nix "/bin/nix-daemon"))))
+ (list (string-append #$nix "/bin/nix-daemon"))
+ #:environment-variables
+ '("NIX_CONF_DIR=/etc/nix")))
(respawn? #f)
(stop #~(make-kill-destructor)))))
--
2.26.2
This bug report was last modified 4 years and 339 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.