The home-environment example on Guix manual has an error

  • Done
  • quality assurance status badge
Details
3 participants
  • Andrew Tropin
  • Ludovic Courtès
  • Luis Henrique Gomes Higino
Owner
unassigned
Submitted by
Luis Henrique Gomes Higino
Severity
normal

Debbugs page

Luis Henrique Gomes Higino wrote 3 years ago
(address . bug-guix@gnu.org)
87y26175m0.fsf@gmail.com
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
Andrew Tropin wrote 3 years ago
87edzx9eey.fsf@trop.in
On 2021-11-06 09:50, Luis Henrique Gomes Higino wrote:

Toggle quote (102 lines)
> 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.
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(-)

Toggle diff (25 lines)
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
--
Best regards,
Andrew Tropin
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEKEGaxlA4dEDH6S/6IgjSCVjB3rAFAmKi78UACgkQIgjSCVjB
3rAQGg/5AYjJTgMnUR8m+uTyBSeuhMa44ThP6yh++Nz+MMZB2ACqZqO6iOVG9xZn
uba+3knfXX1KS03xf8Leohv6TUe0y00abFpYNnVJ3ubnvJK70dV/iLFSVrzOgDbG
E4jYF6hD8KTWgoEMqZHkQN2URNPdWZt3hK9H4l9xTzM4uo/ev4X7L9Cat60mHc/e
y1+9TZqNBblPC8CBdnGvdZEEVeZOQvZjV8n6lgEmK1kW1SsEH5/gUL1bRjAIP4uq
l0iOSbErfKknhzwBwer/TjNtkMLadchvBHz/Jup5kIWuY/fJX3Z0O2KOgo5bgoNk
wITMnFZ6QMXGpDuLy53Cany+8tu4FG1ogKvn+OJyB1WvbMUDJKqjFgeD8dfPBzE3
roiHdacUDAB3Z0LuzFmadu52i9rCZZKtI1nv2+5aOZBuKLAH+za4wgOQ7zs5pEFa
nnBWDWKfe+B7dA1aZOSyrrH89Zh7a4g9NnJmFkorNW8Nmn1DHLbHBzcw7eUYnIxn
qxONmHQh5+lJIcAiBZWjWglnKUoycv3MsONPzgZ8M/3h/mh0kzBrR3v7fV+araVy
kFXbPoywwJAyXFje5/8BTqOnFp09jMpGFDxSMtvRmlkS4kj3Ti51L2DYe/7sL1A3
qEHOjVIjj4H5s5RWk10ho9T/8+kQZCGjA4TciELsTRNc9hskhAk=
=UVde
-----END PGP SIGNATURE-----

Ludovic Courtès wrote 3 years ago
(name . Andrew Tropin)(address . andrew@trop.in)
87tu8s27no.fsf@gnu.org
Hi,

Andrew Tropin <andrew@trop.in> skribis:

Toggle quote (8 lines)
> 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.

Applied, thanks!

Ludo’.
Closed
?
Your comment

This issue is archived.

To comment on this conversation send an email to 51639@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 51639
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch
You may also tag this issue. See list of standard tags. For example, to set the confirmed and easy tags
mumi command -t +confirmed -t +easy
Or, remove the moreinfo tag and set the help tag
mumi command -t -moreinfo -t +help