help-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Guix Home, .local/bin executable scripts


From: Fabio Natali
Subject: Guix Home, .local/bin executable scripts
Date: Sat, 24 Sep 2022 21:06:18 +0100

Dear All,

I've recently started exploring Guix Home. I was able to create a few
simple services for some of my apps, e.g. Emacs.

I've now come to a point where I'd like to add some executables to my
configuration, e.g. some of my `.local/bin' scripts.

Consider this `hello.sh' script, for example:

,----
| #!/bin/bash
| 
| echo "Hello World" | sed "s/World/Guix/"
`----

The following service copies `hello.sh' to the expected destination and
does so while preserving the correct permissions (`#:recursive #t'),
i.e. the file is executable.

,----
| (define my/home-hello-service
|   (service
|    (service-type
|     (name 'home-hello)
|     (extensions
|      (list
|       (service-extension
|        home-files-service-type
|        (lambda (config)
|          `((".local/bin/hello.sh"
|             ,(local-file "scripts/hello.sh" #:recursive? #t)))))))
|     (default-value #f)
|     (description "My valuable Hello World script."))))
`----

The script shows up in my Guix Home but it won't work - I suppose that
`/bin/bash' should be replaced with the correct Bash store path?

,----
| ~$ hello.sh
| -bash: ~/.local/bin/hello.sh: /bin/bash: bad interpreter: No such file or 
directory
`----

I've been looking at the docs and found something that feels related to
my problem (e.g. `computed-file', `substitute*', ...?) but I'd
appreciate if someone could point me in the right direction.

Thanks, best, Fabio.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]