* [bug#41704] [PATCH] services: nix: Set NIX_CONF_DIR environment variable.
@ 2020-06-04 7:01 Peng Mei Yu
2020-06-04 9:09 ` [bug#41704] [PATCH V2] " Peng Mei Yu
0 siblings, 1 reply; 6+ messages in thread
From: Peng Mei Yu @ 2020-06-04 7:01 UTC (permalink / raw)
To: 41704; +Cc: Peng Mei Yu
* 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
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [bug#41704] [PATCH V2] services: nix: Set NIX_CONF_DIR environment variable.
2020-06-04 7:01 [bug#41704] [PATCH] services: nix: Set NIX_CONF_DIR environment variable Peng Mei Yu
@ 2020-06-04 9:09 ` Peng Mei Yu
2020-06-09 7:52 ` Ludovic Courtès
0 siblings, 1 reply; 6+ messages in thread
From: Peng Mei Yu @ 2020-06-04 9:09 UTC (permalink / raw)
To: 41704; +Cc: Peng Mei Yu
* gnu/services/nix.scm (nix-shepherd-service): Set NIX_CONF_DIR environment
variable to "/etc/nix".
---
gnu/services/nix.scm | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/gnu/services/nix.scm b/gnu/services/nix.scm
index dfe33991d0..d5a057d2ee 100644
--- a/gnu/services/nix.scm
+++ b/gnu/services/nix.scm
@@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2019 Oleg Pykhalov <go.wigust@gmail.com>
+;;; Copyright © 2020 Peng Mei Yu <pengmeiyu@riseup.net>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -96,7 +97,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
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [bug#41704] [PATCH V2] services: nix: Set NIX_CONF_DIR environment variable.
2020-06-04 9:09 ` [bug#41704] [PATCH V2] " Peng Mei Yu
@ 2020-06-09 7:52 ` Ludovic Courtès
2020-06-14 8:10 ` Peng Mei Yu
0 siblings, 1 reply; 6+ messages in thread
From: Ludovic Courtès @ 2020-06-09 7:52 UTC (permalink / raw)
To: Peng Mei Yu; +Cc: 41704
[-- Attachment #1: Type: text/plain, Size: 307 bytes --]
Hi,
Peng Mei Yu <pengmeiyu@riseup.net> skribis:
> * gnu/services/nix.scm (nix-shepherd-service): Set NIX_CONF_DIR environment
> variable to "/etc/nix".
Does the (untested) patch below solve the problem for you?
Perhaps it’s more appropriate than setting NIX_CONF_DIR.
Thanks,
Ludo’.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 602 bytes --]
diff --git a/gnu/packages/package-management.scm b/gnu/packages/package-management.scm
index b1c96f18e7..b3c21473ed 100644
--- a/gnu/packages/package-management.scm
+++ b/gnu/packages/package-management.scm
@@ -551,6 +551,7 @@ out) and returning a package that uses that as its 'source'."
(base32
"1hbqsrp1ii2sfq8x2mahjrl2182qck76n8blrl1jfz3xq99m6i15"))))
(build-system gnu-build-system)
+ (arguments '(#:configure-flags '("--sysconfdir=/etc")))
(native-inputs `(("pkg-config" ,pkg-config)))
(inputs `(("boost" ,boost)
("brotli" ,brotli)
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [bug#41704] [PATCH V2] services: nix: Set NIX_CONF_DIR environment variable.
2020-06-09 7:52 ` Ludovic Courtès
@ 2020-06-14 8:10 ` Peng Mei Yu
2020-06-15 11:08 ` Tobias Geerinckx-Rice via Guix-patches via
0 siblings, 1 reply; 6+ messages in thread
From: Peng Mei Yu @ 2020-06-14 8:10 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: 41704
Hi,
Ludovic Courtès writes:
>> * gnu/services/nix.scm (nix-shepherd-service): Set NIX_CONF_DIR environment
>> variable to "/etc/nix".
>
> Does the (untested) patch below solve the problem for you?
>
> Perhaps it’s more appropriate than setting NIX_CONF_DIR.
>
> Thanks,
> Ludo’.
>
> diff --git a/gnu/packages/package-management.scm b/gnu/packages/package-management.scm
> index b1c96f18e7..b3c21473ed 100644
> --- a/gnu/packages/package-management.scm
> +++ b/gnu/packages/package-management.scm
> @@ -551,6 +551,7 @@ out) and returning a package that uses that as its 'source'."
> (base32
> "1hbqsrp1ii2sfq8x2mahjrl2182qck76n8blrl1jfz3xq99m6i15"))))
> (build-system gnu-build-system)
> + (arguments '(#:configure-flags '("--sysconfdir=/etc")))
> (native-inputs `(("pkg-config" ,pkg-config)))
> (inputs `(("boost" ,boost)
> ("brotli" ,brotli)
No. I should have mentioned earlier. With this patch, the install
phase will fail.
#+begin_example
MKDIR /etc/profile.d/
install: cannot change permissions of ‘/etc/profile.d/’: No such file or directory
make: *** [scripts/local.mk:10: /etc/profile.d/] Error 1
command "make" "install" failed with status 2
builder for `/gnu/store/c2lw5faljg1zh5ng4nb0inslq4b0fh9c-nix-2.3.5.drv' failed with exit code 1
build of /gnu/store/c2lw5faljg1zh5ng4nb0inslq4b0fh9c-nix-2.3.5.drv failed
View build log at '/var/log/guix/drvs/c2/lw5faljg1zh5ng4nb0inslq4b0fh9c-nix-2.3.5.drv.bz2'.
guix build: error: build of `/gnu/store/c2lw5faljg1zh5ng4nb0inslq4b0fh9c-nix-2.3.5.drv' failed
#+end_example
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.
--
Peng Mei Yu
https://www.pengmeiyu.com/
^ permalink raw reply [flat|nested] 6+ messages in thread
* [bug#41704] [PATCH V2] services: nix: Set NIX_CONF_DIR environment variable.
2020-06-14 8:10 ` Peng Mei Yu
@ 2020-06-15 11:08 ` Tobias Geerinckx-Rice via Guix-patches via
2020-06-16 10:58 ` bug#41704: " Peng Mei Yu
0 siblings, 1 reply; 6+ messages in thread
From: Tobias Geerinckx-Rice via Guix-patches via @ 2020-06-15 11:08 UTC (permalink / raw)
To: Peng Mei Yu; +Cc: Ludovic Courtès, 41704
[-- Attachment #1: Type: text/plain, Size: 1758 bytes --]
Hi Peng Mei Yu,
I agree with Ludo' that fixing this at the package level is more
‘appropriate’ than in the service.
Peng Mei Yu 写道:
> 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.
Kind regards,
T G-R
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]
^ permalink raw reply related [flat|nested] 6+ messages in thread
* bug#41704: [PATCH V2] services: nix: Set NIX_CONF_DIR environment variable.
2020-06-15 11:08 ` Tobias Geerinckx-Rice via Guix-patches via
@ 2020-06-16 10:58 ` Peng Mei Yu
0 siblings, 0 replies; 6+ messages in thread
From: Peng Mei Yu @ 2020-06-16 10:58 UTC (permalink / raw)
To: Tobias Geerinckx-Rice; +Cc: Ludovic Courtès, 41704-done
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
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-06-16 10:59 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-06-04 7:01 [bug#41704] [PATCH] services: nix: Set NIX_CONF_DIR environment variable Peng Mei Yu
2020-06-04 9:09 ` [bug#41704] [PATCH V2] " Peng Mei Yu
2020-06-09 7:52 ` Ludovic Courtès
2020-06-14 8:10 ` Peng Mei Yu
2020-06-15 11:08 ` Tobias Geerinckx-Rice via Guix-patches via
2020-06-16 10:58 ` bug#41704: " Peng Mei Yu
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.