diff mbox series

[bug#41704,V2] services: nix: Set NIX_CONF_DIR environment variable.

Message ID 87bllkoabn.fsf@nckx
State Accepted
Headers show
Series [bug#41704,V2] services: nix: Set NIX_CONF_DIR environment variable. | expand

Checks

Context Check Description
cbaines/applying patch fail View Laminar job

Commit Message

kasper.andersson--- via Guix-patches" via June 15, 2020, 11:08 a.m. UTC
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
     (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

Comments

Peng Mei Yu June 16, 2020, 10:58 a.m. UTC | #1
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
diff mbox series

Patch

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)))))))