all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* "Command not found" when using `home-mcron-service`
@ 2024-01-15  9:38 Tanguy LE CARROUR
  2024-01-15 12:03 ` Nils Landt
  0 siblings, 1 reply; 10+ messages in thread
From: Tanguy LE CARROUR @ 2024-01-15  9:38 UTC (permalink / raw)
  To: Help Guix

Dear Guix,

I had stop using `home-mcron-service` some times ago, for I had
a problem with my home shepherd. Now that this problem seems to be
fixed 🤞, I've tried to re-enable `home-mcron-service` and, while it runs,
it cannot find the commands to execute!?

I used to have this config:

```scheme
(service home-mcron-service-type
        (home-mcron-configuration
         (jobs (list
                 #~(job '(next-minute (range 0 60 5)) "notmuch new")
                 #~(job '(next-hour) "vdirsyncer sync")))))
```

But I now have `notmuch new: sh: line 1: notmuch: command not found` in
my logs.

So, I changed it to:

```scheme
(gnu packages dav)  ; vdirsyncer
(gnu packages mail)  ; notmuch
; […]
(service home-mcron-service-type
        (home-mcron-configuration
         (jobs (list
                 #~(job '(next-minute (range 0 60 5)) (string-append #$notmuch "/bin/notmuch new"))
                 #~(job '(next-hour) (string-append #$vdirsyncer "/bin/vdirsyncer sync"))))))
```

And now Mcron finds `notmuch` (and `vdirsyncer`), but… Notmuch has hooks
that depend on other commands and I now have the following error message
in my logs:

```
2024-01-15 10:20:00 6198 /gnu/store/[…]-notmuch-0.37/bin/notmuch new: […]/.config/notmuch/default/hooks/pre-new: line 3: mbsync: command not found
```

`mbsync` is in my profile, but Mcron cannot find it.
Do I have to declare all the required packages… somehow?! 🤔

Any help welcome!

Regards,

-- 
Tanguy


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: "Command not found" when using `home-mcron-service`
  2024-01-15  9:38 "Command not found" when using `home-mcron-service` Tanguy LE CARROUR
@ 2024-01-15 12:03 ` Nils Landt
  2024-01-15 12:30   ` Tanguy LE CARROUR
  0 siblings, 1 reply; 10+ messages in thread
From: Nils Landt @ 2024-01-15 12:03 UTC (permalink / raw)
  To: Tanguy LE CARROUR, Help Guix

> Tanguy LE CARROUR <tanguy@bioneland.org> hat am 15.01.2024 10:38 CET geschrieben:
>
> ```scheme
> (gnu packages dav)  ; vdirsyncer
> (gnu packages mail)  ; notmuch
> ; […]
> (service home-mcron-service-type
>         (home-mcron-configuration
>          (jobs (list
>                  #~(job '(next-minute (range 0 60 5)) (string-append #$notmuch "/bin/notmuch new"))
>                  #~(job '(next-hour) (string-append #$vdirsyncer "/bin/vdirsyncer sync"))))))
> ```
> 
> And now Mcron finds `notmuch` (and `vdirsyncer`), but… Notmuch has hooks
> that depend on other commands and I now have the following error message
> in my logs:
> 
> ```
> 2024-01-15 10:20:00 6198 /gnu/store/[…]-notmuch-0.37/bin/notmuch new: […]/.config/notmuch/default/hooks/pre-new: line 3: mbsync: command not found
> ```
> 
> `mbsync` is in my profile, but Mcron cannot find it.
> Do I have to declare all the required packages… somehow?! 🤔

That sounds like it's related to this issue I reported: https://issues.guix.gnu.org/65471

If I'm correct, setting the PATH environment variable in the mcron job should fix it.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: "Command not found" when using `home-mcron-service`
  2024-01-15 12:03 ` Nils Landt
@ 2024-01-15 12:30   ` Tanguy LE CARROUR
  2024-01-15 12:43     ` Tanguy LE CARROUR
  2024-01-15 18:11     ` Nils Landt
  0 siblings, 2 replies; 10+ messages in thread
From: Tanguy LE CARROUR @ 2024-01-15 12:30 UTC (permalink / raw)
  To: Help Guix, Nils Landt

Hi Nils,

Quoting Nils Landt (2024-01-15 13:03:06)
> > Tanguy LE CARROUR <tanguy@bioneland.org> hat am 15.01.2024 10:38 CET geschrieben:
> >
> > ```scheme
> > (gnu packages dav)  ; vdirsyncer
> > (gnu packages mail)  ; notmuch
> > ; […]
> > (service home-mcron-service-type
> >         (home-mcron-configuration
> >          (jobs (list
> >                  #~(job '(next-minute (range 0 60 5)) (string-append #$notmuch "/bin/notmuch new"))
> >                  #~(job '(next-hour) (string-append #$vdirsyncer "/bin/vdirsyncer sync"))))))
> > ```
> > 
> > And now Mcron finds `notmuch` (and `vdirsyncer`), but… Notmuch has hooks
> > that depend on other commands and I now have the following error message
> > in my logs:
> > 
> > ```
> > 2024-01-15 10:20:00 6198 /gnu/store/[…]-notmuch-0.37/bin/notmuch new: […]/.config/notmuch/default/hooks/pre-new: line 3: mbsync: command not found
> > ```
> > 
> > `mbsync` is in my profile, but Mcron cannot find it.
> > Do I have to declare all the required packages… somehow?! 🤔
> 
> That sounds like it's related to this issue I reported:
> https://issues.guix.gnu.org/65471

It looks like, indeed!


> If I'm correct, setting the PATH environment variable in the mcron job
> should fix it.

You mean inside the `#~(job …)`? Sorry, but… how would you do that? 😅
And this means that I would have to do it for every single job? 🤔
Sounds suboptimal to me.

I'll ping #65471 to see if a consensus has been reached. 🤞

-- 
Tanguy


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: "Command not found" when using `home-mcron-service`
  2024-01-15 12:30   ` Tanguy LE CARROUR
@ 2024-01-15 12:43     ` Tanguy LE CARROUR
  2024-01-15 15:25       ` Oleg Pykhalov
  2024-01-15 18:11     ` Nils Landt
  1 sibling, 1 reply; 10+ messages in thread
From: Tanguy LE CARROUR @ 2024-01-15 12:43 UTC (permalink / raw)
  To: Help Guix, Nils Landt

Quoting Tanguy LE CARROUR (2024-01-15 13:30:35)
> Quoting Nils Landt (2024-01-15 13:03:06)
> > > Tanguy LE CARROUR <tanguy@bioneland.org> hat am 15.01.2024 10:38 CET geschrieben:
> > > […]
> > > `mbsync` is in my profile, but Mcron cannot find it.
> > > Do I have to declare all the required packages… somehow?! 🤔
> > 
> > That sounds like it's related to this issue I reported:
> > https://issues.guix.gnu.org/65471
> 
> It looks like, indeed!

Actually, there's a "small" difference: I'm not using Debian, but… Guix System! 🤔

-- 
Tanguy


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: "Command not found" when using `home-mcron-service`
  2024-01-15 12:43     ` Tanguy LE CARROUR
@ 2024-01-15 15:25       ` Oleg Pykhalov
  2024-01-15 16:17         ` Tanguy LE CARROUR
  0 siblings, 1 reply; 10+ messages in thread
From: Oleg Pykhalov @ 2024-01-15 15:25 UTC (permalink / raw)
  To: Tanguy LE CARROUR; +Cc: Help Guix, Nils Landt

[-- Attachment #1: Type: text/plain, Size: 1679 bytes --]

Tanguy LE CARROUR <tanguy@bioneland.org> writes:

> If I'm correct, setting the PATH environment variable in the mcron job
> should fix it.
>
> You mean inside the `#~(job …)`? Sorry, but… how would you do that? 😅
> And this means that I would have to do it for every single job? 🤔
> Sounds suboptimal to me.



> Quoting Tanguy LE CARROUR (2024-01-15 13:30:35)
>> Quoting Nils Landt (2024-01-15 13:03:06)
>> > > Tanguy LE CARROUR <tanguy@bioneland.org> hat am 15.01.2024 10:38 CET
>> > > geschrieben:
>> > > […]
>> > > `mbsync` is in my profile, but Mcron cannot find it.
>> > > Do I have to declare all the required packages… somehow?! 🤔
>> > 
>> > That sounds like it's related to this issue I reported:
>> > https://issues.guix.gnu.org/65471
>> 
>> It looks like, indeed!
>
> Actually, there's a "small" difference: I'm not using Debian, but… Guix
> System! 🤔

The Home service matches Guix System in this case, so currently
specification of a full path to a binary is required.

It's possible to do in several ways:

1) Use full path to the binary with ungexp, e.g.

preferred and cleaner:

    #$(file-append notmuch "/bin/notmuch")

or:
    (string-append #$notmuch "/bin/notmuch")

Hint: make sure notmuch is defined, e.g. at the top of a file:

    (use-modules (gnu packages mail))


2) Symlink resolving in a Guix profile, e.g.:

    "/home/user123/.guix-profile/bin/notmuch"

or

    (readlink "/home/user123/.guix-profile/bin/notmuch")


I would recommend for 1) because of reproducibility and easier to track
in future, especially if you have a lot of self managed services.


Oleg.

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: "Command not found" when using `home-mcron-service`
  2024-01-15 15:25       ` Oleg Pykhalov
@ 2024-01-15 16:17         ` Tanguy LE CARROUR
  2024-01-15 17:13           ` Oleg Pykhalov
  0 siblings, 1 reply; 10+ messages in thread
From: Tanguy LE CARROUR @ 2024-01-15 16:17 UTC (permalink / raw)
  To: Oleg Pykhalov; +Cc: Help Guix, Nils Landt

Hi Oleg,

Quoting Oleg Pykhalov (2024-01-15 16:25:27)
> The Home service matches Guix System in this case, so currently
> specification of a full path to a binary is required.
> 
> It's possible to do in several ways:
> 
> 1) Use full path to the binary with ungexp, e.g.
> 
> preferred and cleaner:
> 
>     #$(file-append notmuch "/bin/notmuch")
> 
> or:
>     (string-append #$notmuch "/bin/notmuch")
> 
> Hint: make sure notmuch is defined, e.g. at the top of a file:
> 
>     (use-modules (gnu packages mail))

I tried this one! 😁
The `string-append` version I mean.

`mcron` can then find `notmuch`, but `notmuch` has some hooks that depend
on other commands; `mbsync` and `afew` in my case. For this, I cannot really
provide the full path? 🤔 … actually, I could, but then it would be
`/home/USER/.guix-home/profile/bin/mbsync`, not the actual path.

This should work, but I can help be find it a bit weird, because it
propagates to quite a number of files. 😞
And the same goes for `vdirsyncer` that relies on `pass`…

Oh, actually, I've just figured out that this doesn't actually work,
because my `USER` is not the same on all my computers! 😱
And I cannot rely on `$HOME` because it's not supported by all the
configuration files that are affected.

So I would definitively favour a solution where the PATH is set once and
for all by Mcron.

Regards,

-- 
Tanguy


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: "Command not found" when using `home-mcron-service`
  2024-01-15 16:17         ` Tanguy LE CARROUR
@ 2024-01-15 17:13           ` Oleg Pykhalov
  2024-01-16  7:22             ` Tanguy LE CARROUR
  0 siblings, 1 reply; 10+ messages in thread
From: Oleg Pykhalov @ 2024-01-15 17:13 UTC (permalink / raw)
  To: Tanguy LE CARROUR; +Cc: Help Guix, Nils Landt

[-- Attachment #1: Type: text/plain, Size: 1541 bytes --]

Tanguy LE CARROUR <tanguy@bioneland.org> writes:

> Quoting Oleg Pykhalov (2024-01-15 16:25:27)
>> The Home service matches Guix System in this case, so currently
>> specification of a full path to a binary is required.
>> 
>> It's possible to do in several ways:
>> 
>> 1) Use full path to the binary with ungexp, e.g.
>> 
>> preferred and cleaner:
>> 
>>     #$(file-append notmuch "/bin/notmuch")
>> 
>> or:
>>     (string-append #$notmuch "/bin/notmuch")
>> 
>> Hint: make sure notmuch is defined, e.g. at the top of a file:
>> 
>>     (use-modules (gnu packages mail))
>
> I tried this one! 😁
> The `string-append` version I mean.
>
> `mcron` can then find `notmuch`, but `notmuch` has some hooks that depend
> on other commands; `mbsync` and `afew` in my case. For this, I cannot really
> provide the full path? 🤔 … actually, I could, but then it would be
> `/home/USER/.guix-home/profile/bin/mbsync`, not the actual path.

Is the hook a script?  If it is, then the script should have the PATH,
which can be added to the script itself.

> This should work, but I can help be find it a bit weird, because it
> propagates to quite a number of files. 😞
> And the same goes for `vdirsyncer` that relies on `pass`…

Is ‘vdirsyncer’ relies on the ‘pass’ by default, or is your
configuration specific thing?

‘vdirsyncer’ package recipe should be modified in the first case, to
make it work for everyone.

In case of specific configuration a wrapper can be used.


Oleg.

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: "Command not found" when using `home-mcron-service`
  2024-01-15 12:30   ` Tanguy LE CARROUR
  2024-01-15 12:43     ` Tanguy LE CARROUR
@ 2024-01-15 18:11     ` Nils Landt
  2024-01-16  7:10       ` Tanguy LE CARROUR
  1 sibling, 1 reply; 10+ messages in thread
From: Nils Landt @ 2024-01-15 18:11 UTC (permalink / raw)
  To: Tanguy LE CARROUR, Help Guix


> Tanguy LE CARROUR <tanguy@bioneland.org> hat am 15.01.2024 13:30 CET geschrieben:
> > If I'm correct, setting the PATH environment variable in the mcron job
> > should fix it.
> 
> You mean inside the `#~(job …)`? Sorry, but… how would you do that? 😅

Haven't tried it, but something like:

#~(job '(next-minute (range 0 60 5)) (string-append #$bash " -c \"PATH=$HOME/.guix-home/profile/bin " #$notmuch "/bin/notmuch new\""))

> And this means that I would have to do it for every single job? 🤔

Yes.

> Sounds suboptimal to me.

Agreed! Alternatively, you could install the dependent packages (like pass) in guix system, not guix home.

> So I would definitively favour a solution where the PATH is set once and
> for all by Mcron.

I'm pretty sure this does not exist for mcron.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: "Command not found" when using `home-mcron-service`
  2024-01-15 18:11     ` Nils Landt
@ 2024-01-16  7:10       ` Tanguy LE CARROUR
  0 siblings, 0 replies; 10+ messages in thread
From: Tanguy LE CARROUR @ 2024-01-16  7:10 UTC (permalink / raw)
  To: Help Guix, Nils Landt

Hi Nils,


Quoting Nils Landt (2024-01-15 19:11:25)
> 
> > Tanguy LE CARROUR <tanguy@bioneland.org> hat am 15.01.2024 13:30 CET geschrieben:
> > > If I'm correct, setting the PATH environment variable in the mcron job
> > > should fix it.
> > 
> > You mean inside the `#~(job …)`? Sorry, but… how would you do that? 😅
> 
> Haven't tried it, but something like:
> 
> #~(job '(next-minute (range 0 60 5)) (string-append #$bash " -c \"PATH=$HOME/.guix-home/profile/bin " #$notmuch "/bin/notmuch new\""))

Thanks. I'll give it a try. But based on Oleg's answer, I might go with
modifying all my config files to substitute absolute paths…

Regards,

-- 
Tanguy


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: "Command not found" when using `home-mcron-service`
  2024-01-15 17:13           ` Oleg Pykhalov
@ 2024-01-16  7:22             ` Tanguy LE CARROUR
  0 siblings, 0 replies; 10+ messages in thread
From: Tanguy LE CARROUR @ 2024-01-16  7:22 UTC (permalink / raw)
  To: Oleg Pykhalov; +Cc: Help Guix, Nils Landt

Hi Oleg,


Quoting Oleg Pykhalov (2024-01-15 18:13:13)
> Tanguy LE CARROUR <tanguy@bioneland.org> writes:
> > `mcron` can then find `notmuch`, but `notmuch` has some hooks that depend
> > on other commands; `mbsync` and `afew` in my case. For this, I cannot really
> > provide the full path? 🤔 … actually, I could, but then it would be
> > `/home/USER/.guix-home/profile/bin/mbsync`, not the actual path.
> 
> Is the hook a script?  If it is, then the script should have the PATH,
> which can be added to the script itself.

Yes, indeed. Notmuch uses hooks scripts that I provide.
So far, I was relying on `home-xdg-configuration-files-service-type`
to copy them.

```scheme
(service home-xdg-configuration-files-service-type
  `(("notmuch/default/hooks" ,(local-file "tanguy.home/notmuch_hooks" #:recursive? #t))
    ; […]
  ))
```

Now I have to find an easy way to substitute some content in them.
I'll give it a try with `find-files` and `substitute` unless you can
suggest a better way… 🤞


> > This should work, but I can help be find it a bit weird, because it
> > propagates to quite a number of files. 😞
> > And the same goes for `vdirsyncer` that relies on `pass`…
> 
> Is ‘vdirsyncer’ relies on the ‘pass’ by default, or is your
> configuration specific thing?
>
> ‘vdirsyncer’ package recipe should be modified in the first case, to
> make it work for everyone.
> 
> In case of specific configuration a wrapper can be used.

Configuration specific! Fortunately I have a not-yet-submitted home
service for that. So I can easily insert the absolute path! 🥳

Regards,

-- 
Tanguy


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2024-01-16  7:23 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-15  9:38 "Command not found" when using `home-mcron-service` Tanguy LE CARROUR
2024-01-15 12:03 ` Nils Landt
2024-01-15 12:30   ` Tanguy LE CARROUR
2024-01-15 12:43     ` Tanguy LE CARROUR
2024-01-15 15:25       ` Oleg Pykhalov
2024-01-15 16:17         ` Tanguy LE CARROUR
2024-01-15 17:13           ` Oleg Pykhalov
2024-01-16  7:22             ` Tanguy LE CARROUR
2024-01-15 18:11     ` Nils Landt
2024-01-16  7:10       ` Tanguy LE CARROUR

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.