GNU bug report logs - #51639
The home-environment example on Guix manual has an error

Previous Next

Package: guix;

Reported by: Luis Henrique Gomes Higino <luishenriquegh2701 <at> gmail.com>

Date: Sat, 6 Nov 2021 15:39:04 UTC

Severity: normal

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 51639 in the body.
You can then email your comments to 51639 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guix <at> gnu.org:
bug#51639; Package guix. (Sat, 06 Nov 2021 15:39:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to Luis Henrique Gomes Higino <luishenriquegh2701 <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Sat, 06 Nov 2021 15:39:04 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Luis Henrique Gomes Higino <luishenriquegh2701 <at> gmail.com>
To: bug-guix <at> gnu.org
Subject: The home-environment example on Guix manual has an error
Date: Sat, 06 Nov 2021 09:50:34 -0300
Hi,

the example present in the 11.1 section of the guix manual ((guix)
Declaring the Home Environment) uses a list of strings in the
bash-profile field of home-bash-configuration, which is incorrect, 
as it
expects a list of file-like objects.

The example is as follows:

 (use-modules (gnu home)
              (gnu home services)
              (gnu home services shells)
              (gnu services)
              (gnu packages admin)
              (guix gexp))
 
 
 (home-environment
  (packages (list htop))
  (services
   (list
    (service home-bash-service-type
             (home-bash-configuration
              (guix-defaults? #t)
              (bash-profile '("\
 export HISTFILE=$XDG_CACHE_HOME/.bash_history"))))
 
    (simple-service 'test-config
                    home-files-service-type
                    (list `("config/test.conf"
                            ,(plain-file "tmp-file.txt"
                                         "the content of 
                                         ~/.config/test.conf")))))))

Running "guix home build" with a file containing this returns this 
error:

 building 
 /gnu/store/cvmpzmvb0p73dvbf813rcmpplj6fnbk8-bash_profile.drv...
 Backtrace:
            8 (primitive-load 
            "/gnu/store/w6nikzvdk66d1b8x579ra0vz0wl?")
 In ice-9/ports.scm:
    463:17  7 (call-with-output-file _ _ #:binary _ #:encoding _)
 In ice-9/eval.scm:
     159:9  6 (_ #(#(#<directory (guile-user) 7ffff3bb3f00>) 
     #<outp?>))
     163:9  5 (_ #(#(#<directory (guile-user) 7ffff3bb3f00>) 
     #<outp?>))
     155:9  4 (_ #(#(#<directory (guile-user) 7ffff3bb3f00>) 
     #<outp?>))
     159:9  3 (_ #(#(#<directory (guile-user) 7ffff3bb3f00>) 
     #<outp?>))
 In ice-9/boot-9.scm:
     152:2  2 (with-fluid* _ _ _)
 In ice-9/ports.scm:
    440:11  1 (call-with-input-file "     export 
    HISTFILE=$XDG_CACHE?" ?)
 In unknown file:
            0 (open-file "     export 
            HISTFILE=$XDG_CACHE_HOME/.bash?" ?)
 
 ERROR: In procedure open-file:
 In procedure open-file: No such file or directory: "     export 
 HISTFILE=$XDG_CACHE_HOME/.bash_history"
 builder for 
 `/gnu/store/cvmpzmvb0p73dvbf813rcmpplj6fnbk8-bash_profile.drv' 
 failed with exit code 1

I believe it should be changed to something like this:

 (use-modules (gnu home)
              (gnu home services)
              (gnu home services shells)
              (gnu services)
              (gnu packages admin)
              (guix gexp))
 
 
 (home-environment
  (packages (list htop))
  (services
   (list
    (service home-bash-service-type
             (home-bash-configuration
              (guix-defaults? #t)
              (bash-profile (list (plain-file "bash-profile" "\
 export HISTFILE=$XDG_CACHE_HOME/.bash_history")))))
 
    (simple-service 'test-config
                    home-files-service-type
                    (list `("config/test.conf"
                            ,(plain-file "tmp-file.txt"
                                         "the content of 
                                         ~/.config/test.conf")))))))

This manages to build correctly.

Greetings,
Luis

-- 
Luis H. Higino




Information forwarded to bug-guix <at> gnu.org:
bug#51639; Package guix. (Fri, 10 Jun 2022 07:17:02 GMT) Full text and rfc822 format available.

Message #8 received at 51639 <at> debbugs.gnu.org (full text, mbox):

From: Andrew Tropin <andrew <at> trop.in>
To: Luis Henrique Gomes Higino <luishenriquegh2701 <at> gmail.com>,
 51639 <at> debbugs.gnu.org
Cc: Oleg Pykhalov <go.wigust <at> gmail.com>,
 Ludovic Courtès <ludo <at> gnu.org>
Subject: Re: bug#51639: The home-environment example on Guix manual has an
 error
Date: Fri, 10 Jun 2022 10:16:21 +0300
[Message part 1 (text/plain, inline)]
On 2021-11-06 09:50, Luis Henrique Gomes Higino wrote:

> Hi,
>
> the example present in the 11.1 section of the guix manual ((guix)
> Declaring the Home Environment) uses a list of strings in the
> bash-profile field of home-bash-configuration, which is incorrect, 
> as it
> expects a list of file-like objects.
>
> The example is as follows:
>
>   (use-modules (gnu home)
>                (gnu home services)
>                (gnu home services shells)
>                (gnu services)
>                (gnu packages admin)
>                (guix gexp))
>   
>   
>   (home-environment
>    (packages (list htop))
>    (services
>     (list
>      (service home-bash-service-type
>               (home-bash-configuration
>                (guix-defaults? #t)
>                (bash-profile '("\
>   export HISTFILE=$XDG_CACHE_HOME/.bash_history"))))
>   
>      (simple-service 'test-config
>                      home-files-service-type
>                      (list `("config/test.conf"
>                              ,(plain-file "tmp-file.txt"
>                                           "the content of 
>                                           ~/.config/test.conf")))))))
>
> Running "guix home build" with a file containing this returns this 
> error:
>
>   building 
>   /gnu/store/cvmpzmvb0p73dvbf813rcmpplj6fnbk8-bash_profile.drv...
>   Backtrace:
>              8 (primitive-load 
>              "/gnu/store/w6nikzvdk66d1b8x579ra0vz0wl?")
>   In ice-9/ports.scm:
>      463:17  7 (call-with-output-file _ _ #:binary _ #:encoding _)
>   In ice-9/eval.scm:
>       159:9  6 (_ #(#(#<directory (guile-user) 7ffff3bb3f00>) 
>       #<outp?>))
>       163:9  5 (_ #(#(#<directory (guile-user) 7ffff3bb3f00>) 
>       #<outp?>))
>       155:9  4 (_ #(#(#<directory (guile-user) 7ffff3bb3f00>) 
>       #<outp?>))
>       159:9  3 (_ #(#(#<directory (guile-user) 7ffff3bb3f00>) 
>       #<outp?>))
>   In ice-9/boot-9.scm:
>       152:2  2 (with-fluid* _ _ _)
>   In ice-9/ports.scm:
>      440:11  1 (call-with-input-file "     export 
>      HISTFILE=$XDG_CACHE?" ?)
>   In unknown file:
>              0 (open-file "     export 
>              HISTFILE=$XDG_CACHE_HOME/.bash?" ?)
>   
>   ERROR: In procedure open-file:
>   In procedure open-file: No such file or directory: "     export 
>   HISTFILE=$XDG_CACHE_HOME/.bash_history"
>   builder for 
>   `/gnu/store/cvmpzmvb0p73dvbf813rcmpplj6fnbk8-bash_profile.drv' 
>   failed with exit code 1
>
> I believe it should be changed to something like this:
>
>   (use-modules (gnu home)
>                (gnu home services)
>                (gnu home services shells)
>                (gnu services)
>                (gnu packages admin)
>                (guix gexp))
>   
>   
>   (home-environment
>    (packages (list htop))
>    (services
>     (list
>      (service home-bash-service-type
>               (home-bash-configuration
>                (guix-defaults? #t)
>                (bash-profile (list (plain-file "bash-profile" "\
>   export HISTFILE=$XDG_CACHE_HOME/.bash_history")))))
>   
>      (simple-service 'test-config
>                      home-files-service-type
>                      (list `("config/test.conf"
>                              ,(plain-file "tmp-file.txt"
>                                           "the content of 
>                                           ~/.config/test.conf")))))))
>
> This manages to build correctly.
>
> Greetings,
> Luis

Hi, you are right!  Sorry for long reply.

[0001-doc-Update-example-of-a-minimalistic-home-environmen.patch (text/x-patch, inline)]
From b1b448078a5382caf906c84064094f25aef7c689 Mon Sep 17 00:00:00 2001
From: Andrew Tropin <andrew <at> trop.in>
Date: Fri, 10 Jun 2022 10:08:24 +0300
Subject: [PATCH] doc: Update example of a minimalistic home environment.

* doc/he-config-bare-bones.scm: Adujst example according to changes in
bash-service-type and home-files-service-type.
---
 doc/he-config-bare-bones.scm | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/doc/he-config-bare-bones.scm b/doc/he-config-bare-bones.scm
index d2e4736e29..f948d85277 100644
--- a/doc/he-config-bare-bones.scm
+++ b/doc/he-config-bare-bones.scm
@@ -13,12 +13,13 @@
    (service home-bash-service-type
             (home-bash-configuration
              (guix-defaults? #t)
-             (bash-profile '("\
-export HISTFILE=$XDG_CACHE_HOME/.bash_history"))))
+             (bash-profile (list (plain-file "bash-profile" "\
+export HISTFILE=$XDG_CACHE_HOME/.bash_history")))))
 
    (simple-service 'test-config
-                   home-files-service-type
-                   (list `("config/test.conf"
+                   home-xdg-configuration-files-service-type
+                   (list `("test.conf"
                            ,(plain-file "tmp-file.txt"
-                                        "the content of ~/.config/test.conf")))))))
+                                        "the content of
+                                          ~/.config/test.conf")))))))
 
-- 
2.36.1

[Message part 3 (text/plain, inline)]
-- 
Best regards,
Andrew Tropin
[signature.asc (application/pgp-signature, inline)]

Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Fri, 10 Jun 2022 09:25:02 GMT) Full text and rfc822 format available.

Notification sent to Luis Henrique Gomes Higino <luishenriquegh2701 <at> gmail.com>:
bug acknowledged by developer. (Fri, 10 Jun 2022 09:25:02 GMT) Full text and rfc822 format available.

Message #13 received at 51639-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Andrew Tropin <andrew <at> trop.in>
Cc: Oleg Pykhalov <go.wigust <at> gmail.com>,
 Luis Henrique Gomes Higino <luishenriquegh2701 <at> gmail.com>,
 51639-done <at> debbugs.gnu.org
Subject: Re: bug#51639: The home-environment example on Guix manual has an
 error
Date: Fri, 10 Jun 2022 11:24:11 +0200
Hi,

Andrew Tropin <andrew <at> trop.in> skribis:

> From b1b448078a5382caf906c84064094f25aef7c689 Mon Sep 17 00:00:00 2001
> From: Andrew Tropin <andrew <at> trop.in>
> Date: Fri, 10 Jun 2022 10:08:24 +0300
> Subject: [PATCH] doc: Update example of a minimalistic home environment.
>
> * doc/he-config-bare-bones.scm: Adujst example according to changes in
> bash-service-type and home-files-service-type.

Applied, thanks!

Ludo’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 08 Jul 2022 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 264 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.