unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: Andrew Tropin <andrew@trop.in>
To: Luis Henrique Gomes Higino <luishenriquegh2701@gmail.com>,
	51639@debbugs.gnu.org
Cc: "Oleg Pykhalov" <go.wigust@gmail.com>, "Ludovic Courtès" <ludo@gnu.org>
Subject: bug#51639: The home-environment example on Guix manual has an error
Date: Fri, 10 Jun 2022 10:16:21 +0300	[thread overview]
Message-ID: <87edzx9eey.fsf@trop.in> (raw)
In-Reply-To: <87y26175m0.fsf@gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 3592 bytes --]

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.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-doc-Update-example-of-a-minimalistic-home-environmen.patch --]
[-- Type: text/x-patch, Size: 1496 bytes --]

From b1b448078a5382caf906c84064094f25aef7c689 Mon Sep 17 00:00:00 2001
From: Andrew Tropin <andrew@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


[-- Attachment #1.3: Type: text/plain, Size: 37 bytes --]


-- 
Best regards,
Andrew Tropin

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

  reply	other threads:[~2022-06-10  7:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-06 12:50 bug#51639: The home-environment example on Guix manual has an error Luis Henrique Gomes Higino
2022-06-10  7:16 ` Andrew Tropin [this message]
2022-06-10  9:24   ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87edzx9eey.fsf@trop.in \
    --to=andrew@trop.in \
    --cc=51639@debbugs.gnu.org \
    --cc=go.wigust@gmail.com \
    --cc=ludo@gnu.org \
    --cc=luishenriquegh2701@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).