* Running a shell command with home-run-on-change-service-type
@ 2022-12-19 18:46 Elias Kueny
2022-12-20 10:12 ` Jelle Licht
0 siblings, 1 reply; 3+ messages in thread
From: Elias Kueny @ 2022-12-19 18:46 UTC (permalink / raw)
To: help-guix
Hello,
I'm trying to extend the home-run-on-change-service-type service to run the fish command "fisher update" when the file ~/.config/fish/fish_plugins changed, so that fisher plugins are installed or removed by guix home reconfigure.
My service definitions are:
> (define-module (modules shells)
> #:use-module (guix gexp)
> #:use-module (gnu packages)
> #:use-module (gnu services)
> #:use-module (gnu home services)
> #:use-module (gnu home services shells))
>
> (define-public fish-services
> (list
> (simple-service 'fisher-update-on-change
> home-run-on-change-service-type
> `(("files/.config/fish/fish_plugins"
> #~(system* #$(file-append fish "/bin/fish") "-c" "fisher update"))))
>
> (simple-service 'fish-home-xdg-configuration-service
> home-xdg-configuration-files-service-type
> `(("fish/fish_plugins"
> ,(local-file "../config/fish/fish_plugins"))))))
The file change is detected on reconfigure, and then it throws an error: ice-9/boot-9.scm:1685:16: In procedure raise-exception: error: gexp: unbound variable (full backtrace below).
Could somebody tell me what is wrong with the G-expression? I don't understand which variable is unbound.
Backtrace:
> In guix/ui.scm:
> 2238:10 19 (run-guix-command _ . _)
> In ice-9/boot-9.scm:
> 1752:10 18 (with-exception-handler _ _ #:unwind? _ # _)
> In guix/status.scm:
> 835:3 17 (_)
> 815:4 16 (call-with-status-report _ _)
> In guix/scripts/home.scm:
> 513:4 15 (_)
> In ice-9/boot-9.scm:
> 1752:10 14 (with-exception-handler _ _ #:unwind? _ # _)
> In guix/store.scm:
> 661:37 13 (thunk)
> 1300:8 12 (call-with-build-handler _ _)
> 1300:8 11 (call-with-build-handler #<procedure 7f0af683c210 at g…> …)
> 2170:25 10 (run-with-store #<store-connection 256.99 7f0af90534b0> …)
> In guix/scripts/home.scm:
> 447:16 9 (_ _)
> In unknown file:
> 8 (primitive-load "/gnu/store/x8s6yhdzc79c1yfjwwwi4hq00s4…")
> In ice-9/eval.scm:
> 619:8 7 (_ #(#(#(#(#(#(#(#(#(#(#<…> …) …) …) …) …) …) …) …) …) …))
> 619:8 6 (_ #(#(#(#(#(#(#(#(#(#(#<…> …) …) …) …) …) …) …) …) …) …))
> In srfi/srfi-1.scm:
> 634:9 5 (for-each #<procedure primitive-eval (exp)> _)
> In ice-9/eval.scm:
> 191:27 4 (_ #f)
> 223:20 3 (proc #<directory (guile-user) 7f0b0f512c80>)
> In unknown file:
> 2 (%resolve-variable (7 . gexp) #<directory (guile-user) …>)
> In ice-9/boot-9.scm:
> 1685:16 1 (raise-exception _ #:continuable? _)
> 1685:16 0 (raise-exception _ #:continuable? _)
>
> ice-9/boot-9.scm:1685:16: In procedure raise-exception:
> error: gexp: unbound variable
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Running a shell command with home-run-on-change-service-type
2022-12-19 18:46 Running a shell command with home-run-on-change-service-type Elias Kueny
@ 2022-12-20 10:12 ` Jelle Licht
2022-12-20 18:16 ` Elias Kueny
0 siblings, 1 reply; 3+ messages in thread
From: Jelle Licht @ 2022-12-20 10:12 UTC (permalink / raw)
To: Elias Kueny, help-guix
Elias Kueny <elias.kueny@posteo.net> writes:
Hello Elias!
Buyer beware; I am not a G-expression guru. Having said that...
> Hello,
>
> I'm trying to extend the home-run-on-change-service-type service to run the fish command "fisher update" when the file ~/.config/fish/fish_plugins changed, so that fisher plugins are installed or removed by guix home reconfigure.
>
> My service definitions are:
>
>> (define-module (modules shells)
>> #:use-module (guix gexp)
>> #:use-module (gnu packages)
>> #:use-module (gnu services)
>> #:use-module (gnu home services)
>> #:use-module (gnu home services shells))
>>
>> (define-public fish-services
>> (list
>> (simple-service 'fisher-update-on-change
>> home-run-on-change-service-type
>> `(("files/.config/fish/fish_plugins"
>> #~(system* #$(file-append fish "/bin/fish") "-c" "fisher update"))))
... here you quasi-quote the service extension configuration with
"`". To make use of a gexp in the expression, we need to unquote the gexp
expression, so replace "#~" by ",#~".
HTH and gets you unstuck!
- Jelle
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Running a shell command with home-run-on-change-service-type
2022-12-20 10:12 ` Jelle Licht
@ 2022-12-20 18:16 ` Elias Kueny
0 siblings, 0 replies; 3+ messages in thread
From: Elias Kueny @ 2022-12-20 18:16 UTC (permalink / raw)
To: Jelle Licht; +Cc: help-guix
On Tue, Dec 20 2022, Jelle Licht wrote:
> ... here you quasi-quote the service extension configuration with
> "`". To make use of a gexp in the expression, we need to unquote the gexp
> expression, so replace "#~" by ",#~".
Thank you, this was the solution!
I expected that replacing the quasi-quote by a normal quote would also do, but apparently no, as it gives the same error as before. And after I changed "#~" by ",#~" as you suggested, "#$(file-append fish "/bin/fish")" started throwing a different error.
But this now works so it's good enough for me:
> (simple-service 'fisher-update-on-change
> home-run-on-change-service-type
> `(("files/.config/fish/fish_plugins"
> ,#~(system* "fish" "-c" "fisher update"))))
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-12-20 18:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-19 18:46 Running a shell command with home-run-on-change-service-type Elias Kueny
2022-12-20 10:12 ` Jelle Licht
2022-12-20 18:16 ` Elias Kueny
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).