unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
* Adding shell commands the .profile with guix home
@ 2024-02-01 12:59 Andrew Stubbs
  2024-02-05  0:38 ` Carlo Zancanaro
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Stubbs @ 2024-02-01 12:59 UTC (permalink / raw)
  To: help-guix

Hi,

I'm trying to figure out how to run a shell command once on SSH login,
but not in nested shells. Traditionally I've simply appended it to
.profile, but I want to switch to use guix home and I can't figure out
how. (I got my environment variables and arbitrary dot-files done.)

The manual suggests that "home-shell-profile-configuration" is the way
to go, but there's no example given.

I found this example from an old mailing list post:

(service home-shell-profile-service-type
         (home-shell-profile-configuration
          (profile '("echo hi" "source ~/.xprofile"))))

But that fails:
 error: (service home-shell-profile-service-type
(home-shell-profile-configuration (profile (quote ("echo hi" "source
~/.xprofile"))))): invalid field specifier

What's the correct way to do this, please?

Thanks

Andrew


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

* Re: Adding shell commands the .profile with guix home
  2024-02-01 12:59 Adding shell commands the .profile with guix home Andrew Stubbs
@ 2024-02-05  0:38 ` Carlo Zancanaro
  2024-02-05 12:23   ` Andrew Stubbs
  0 siblings, 1 reply; 3+ messages in thread
From: Carlo Zancanaro @ 2024-02-05  0:38 UTC (permalink / raw)
  To: Andrew Stubbs; +Cc: help-guix

HI Andrew,

On Thu, Feb 01 2024, Andrew Stubbs wrote:
> The manual suggests that "home-shell-profile-configuration" is the way
> to go, but there's no example given.

The home-shell-profile-service-type is the way to go, but due to the way
the service is included (as an essential service), you need to add items
to the configuration using a service extension.

> What's the correct way to do this, please?

The example you provided might look like this instead:

  (simple-service 'sourcing-xprofile home-shell-profile-service-type
                  (list (plain-file "shell-profile" "echo hi; source ~/.xprofile")))

The items of the list can be any "file-like" gexp (e.g. the results of
local-file, mixed-text-file, file-append).

I hope that helps,

Carlo


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

* Re: Adding shell commands the .profile with guix home
  2024-02-05  0:38 ` Carlo Zancanaro
@ 2024-02-05 12:23   ` Andrew Stubbs
  0 siblings, 0 replies; 3+ messages in thread
From: Andrew Stubbs @ 2024-02-05 12:23 UTC (permalink / raw)
  To: Carlo Zancanaro; +Cc: help-guix

Thanks, this is what I needed.

Can we get something like this example added to the manual? I now see
that the bash example is similar, but this stuff was really not
obvious to me. The "type text-config" is also presented, throughout
the manual, entirely without explanation, but maybe that would be
clear to me if I knew more about scheme/guile?

Thanks again

Andrew

On Mon, 5 Feb 2024 at 00:38, Carlo Zancanaro <carlo@zancanaro.id.au> wrote:
>
> HI Andrew,
>
> On Thu, Feb 01 2024, Andrew Stubbs wrote:
> > The manual suggests that "home-shell-profile-configuration" is the way
> > to go, but there's no example given.
>
> The home-shell-profile-service-type is the way to go, but due to the way
> the service is included (as an essential service), you need to add items
> to the configuration using a service extension.
>
> > What's the correct way to do this, please?
>
> The example you provided might look like this instead:
>
>   (simple-service 'sourcing-xprofile home-shell-profile-service-type
>                   (list (plain-file "shell-profile" "echo hi; source ~/.xprofile")))
>
> The items of the list can be any "file-like" gexp (e.g. the results of
> local-file, mixed-text-file, file-append).
>
> I hope that helps,
>
> Carlo


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

end of thread, other threads:[~2024-02-05 12:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-01 12:59 Adding shell commands the .profile with guix home Andrew Stubbs
2024-02-05  0:38 ` Carlo Zancanaro
2024-02-05 12:23   ` Andrew Stubbs

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).