From: Fabio Natali <me@fabionatali.com>
To: Trev <trev@trevdev.ca>, help-guix@gnu.org
Subject: Re: Guix Home, .local/bin executable scripts
Date: Sun, 25 Sep 2022 14:27:05 +0100 [thread overview]
Message-ID: <87illby47q.fsf@reckondigital.com> (raw)
In-Reply-To: <874jww2xse.fsf@codinator.mail-host-address-is-not-set>
Hey Trev,
Thanks for your help!
On 2022-09-24, 15:49 -0700, Trev <trev@trevdev.ca> wrote:
> If the thing is being moved to your store for any reason you may want
> to explicitly update the permissions. I had to do this when I
> packaged PHP composer for personal use. Things tend to go into the
> store as read-only.
I see, yes, I followed your advice and ended up adding an explicit
`chmod' command.
> You can patch a shebang or anything else with substitute by doing the
> following from within a gexp where #$bash happens to be the bash
> package reference so long as it is in the right lexical scope. See
> (with-imported-modules) in the manual.
>
> (substitute* "scripts/hello.sh"
> ("#!/bin/bash" (string-append #$bash "/bin/bash")))
This was a great starting point. Thanks to this and some fantastic
support on IRC, I was able to get to this working version:
,----
| (define my/home-hello-service
| (service
| home-files-service-type
| `((".local/bin/hello.sh"
| ,(computed-file
| "hello.sh"
| (with-imported-modules
| '((guix build utils))
| #~(begin
| (use-modules (guix build utils))
| (copy-file #$(local-file "scripts/hello.sh") #$output)
| (substitute*
| #$output (("/bin/bash") #$(file-append bash-minimal "/bin/bash")))
| (chmod #$output #o555))))))))
`----
It was quite a learning curve, but I'm happy I got that working.
Thanks, best, Fabio.
prev parent reply other threads:[~2022-09-25 13:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-24 20:06 Guix Home, .local/bin executable scripts Fabio Natali
2022-09-24 22:49 ` Trev
2022-09-25 13:27 ` Fabio Natali [this message]
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=87illby47q.fsf@reckondigital.com \
--to=me@fabionatali.com \
--cc=help-guix@gnu.org \
--cc=trev@trevdev.ca \
/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.
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).