all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Changing user-account's shell
@ 2019-04-17 19:59 Tanguy Le Carrour
  2019-04-18 14:45 ` Ludovic Courtès
       [not found] ` <87d0lkz5jw.fsf@ambrevar.xyz>
  0 siblings, 2 replies; 8+ messages in thread
From: Tanguy Le Carrour @ 2019-04-17 19:59 UTC (permalink / raw)
  To: help-guix

Hi Guix!

I'm trying to set my user's shell through the Guix configuration system,
but without success.

The syntax I use is:

    (use-package-modules ... shells)

    (operating-system
      ;; ...
      (users (cons (user-account
                    ;; ...
                    (shell (file-append fish "/bin/fish")))
               %base-user-accounts))

It's from `gnu/system/shadow.scm:112`.

I also found a slightly different syntax in thomassgn's config [1]:

    (shell #~(string-append #$bash "/bin/bash"))

… but it does not work either!

[1]: https://notabug.org/thomassgn/guixsd-configuration/src/master/config.scm


Am I doing something wrong?! Any help would be welcome!


-- 
Tanguy

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

* Re: Changing user-account's shell
  2019-04-17 19:59 Changing user-account's shell Tanguy Le Carrour
@ 2019-04-18 14:45 ` Ludovic Courtès
  2019-04-18 20:51   ` Tanguy Le Carrour
       [not found] ` <87d0lkz5jw.fsf@ambrevar.xyz>
  1 sibling, 1 reply; 8+ messages in thread
From: Ludovic Courtès @ 2019-04-18 14:45 UTC (permalink / raw)
  To: Tanguy Le Carrour; +Cc: help-guix

Hello Tanguy,

Tanguy Le Carrour <tanguy@bioneland.org> skribis:

> I'm trying to set my user's shell through the Guix configuration system,
> but without success.
>
> The syntax I use is:
>
>     (use-package-modules ... shells)
>
>     (operating-system
>       ;; ...
>       (users (cons (user-account
>                     ;; ...
>                     (shell (file-append fish "/bin/fish")))
>                %base-user-accounts))
>
> It's from `gnu/system/shadow.scm:112`.

Could you tell us what command you run and what error message you got?
At first sight this looks good to me.

Thanks,
Ludo’.

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

* Re: Changing user-account's shell
       [not found] ` <87d0lkz5jw.fsf@ambrevar.xyz>
@ 2019-04-18 20:22   ` Tanguy Le Carrour
  2019-04-19  6:53     ` Pierre Neidhardt
  0 siblings, 1 reply; 8+ messages in thread
From: Tanguy Le Carrour @ 2019-04-18 20:22 UTC (permalink / raw)
  To: Pierre Neidhardt; +Cc: help-guix

Le 04/17, Pierre Neidhardt a écrit :
> I've never changed my shell in Guix, so things might be different here,
> but I know that many other distributions expect a Bourne-compatible
> login shell or else there will be issues when parsing some startup
> scripts.

I've been happily using Fish as my default shell (defined in `/etc/passwd`)
for years! First on Debian, then on Parabola/Arch. And everything has
been perfectly fine so far.


> The recommended alternative (again, on other systems) is to drop into
> fish from .bashrc.
> 
> https://wiki.archlinux.org/index.php/Fish#Setting_fish_as_interactive_shell_only

Thanks! The Arch community has **really** done a great job with its wiki!
Unfortunately, calling Fish from Bash is not really sexy! This is what I
do on systems where I cannot set my default shell and I don't like to have to
do one extra ctrl+d to close a terminal. ^_^'


-- 
Tanguy

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

* Re: Changing user-account's shell
  2019-04-18 14:45 ` Ludovic Courtès
@ 2019-04-18 20:51   ` Tanguy Le Carrour
  2019-04-19 12:04     ` Ludovic Courtès
  0 siblings, 1 reply; 8+ messages in thread
From: Tanguy Le Carrour @ 2019-04-18 20:51 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: help-guix

Le 04/18, Ludovic Courtès a écrit :
> Tanguy Le Carrour <tanguy@bioneland.org> skribis:
> > I'm trying to set my user's shell through the Guix configuration system,
> > but without success.
> > […]
> >       (users (cons (user-account
> >                     ;; ...
> >                     (shell (file-append fish "/bin/fish")))
> >                %base-user-accounts))
> > […] 
> Could you tell us what command you run and what error message you got?
> At first sight this looks good to me.

I run `sudo -E guix system reconfigure my_config.scm` and I don't get
any error message.

The "funny" thing is, if I add a second user to the system, setting
Fish as its default shell, it's added with Fish as its default shell!

If I remove `(shell (file-append fish "/bin/fish"))` from the newly
created account and re-run `guix system reconfigure`, the shell is still
Fish.

If I add `(shell (file-append bash "/bin/bash"))` to the newly
created account and re-run `guix system reconfigure`, the shell is still
Fish.

Bug or feature?!

Regards

-- 
Tanguy

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

* Re: Changing user-account's shell
  2019-04-18 20:22   ` Tanguy Le Carrour
@ 2019-04-19  6:53     ` Pierre Neidhardt
  2019-04-19 21:24       ` Tanguy Le Carrour
  0 siblings, 1 reply; 8+ messages in thread
From: Pierre Neidhardt @ 2019-04-19  6:53 UTC (permalink / raw)
  To: Tanguy Le Carrour; +Cc: help-guix

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

Tanguy Le Carrour <tanguy@bioneland.org> writes:

> Le 04/17, Pierre Neidhardt a écrit :
>> I've never changed my shell in Guix, so things might be different here,
>> but I know that many other distributions expect a Bourne-compatible
>> login shell or else there will be issues when parsing some startup
>> scripts.
>
> I've been happily using Fish as my default shell (defined in `/etc/passwd`)
> for years! First on Debian, then on Parabola/Arch. And everything has
> been perfectly fine so far.

Watch out, because errors would probably be silent and remain lurking in
the shadows.

>> The recommended alternative (again, on other systems) is to drop into
>> fish from .bashrc.
>> 
>> https://wiki.archlinux.org/index.php/Fish#Setting_fish_as_interactive_shell_only
>
> Thanks! The Arch community has **really** done a great job with its wiki!
> Unfortunately, calling Fish from Bash is not really sexy! This is what I
> do on systems where I cannot set my default shell and I don't like to have to
> do one extra ctrl+d to close a terminal. ^_^'

You would not, because when you run

--8<---------------cut here---------------start------------->8---
exec fish "$@"
--8<---------------cut here---------------end--------------->8---

it replaces the Bash process, so exiting Fish would effectively
terminate the direct child process of the terminal which would then close
automatically.

-- 
Pierre Neidhardt
https://ambrevar.xyz/

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

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

* Re: Changing user-account's shell
  2019-04-18 20:51   ` Tanguy Le Carrour
@ 2019-04-19 12:04     ` Ludovic Courtès
  2019-04-19 21:30       ` Tanguy Le Carrour
  0 siblings, 1 reply; 8+ messages in thread
From: Ludovic Courtès @ 2019-04-19 12:04 UTC (permalink / raw)
  To: Tanguy Le Carrour; +Cc: help-guix

Hi Tanguy,

Tanguy Le Carrour <tanguy@bioneland.org> skribis:

> Le 04/18, Ludovic Courtès a écrit :
>> Tanguy Le Carrour <tanguy@bioneland.org> skribis:
>> > I'm trying to set my user's shell through the Guix configuration system,
>> > but without success.
>> > […]
>> >       (users (cons (user-account
>> >                     ;; ...
>> >                     (shell (file-append fish "/bin/fish")))
>> >                %base-user-accounts))
>> > […] 
>> Could you tell us what command you run and what error message you got?
>> At first sight this looks good to me.
>
> I run `sudo -E guix system reconfigure my_config.scm` and I don't get
> any error message.
>
> The "funny" thing is, if I add a second user to the system, setting
> Fish as its default shell, it's added with Fish as its default shell!
>
> If I remove `(shell (file-append fish "/bin/fish"))` from the newly
> created account and re-run `guix system reconfigure`, the shell is still
> Fish.
>
> If I add `(shell (file-append bash "/bin/bash"))` to the newly
> created account and re-run `guix system reconfigure`, the shell is still
> Fish.
>
> Bug or feature?!

I say “feature”, but we can discuss it.  :-)

The (gnu build accounts) module, which populates /etc/passwd, considers
the user shell to be “state”—i.e., something the user can change with
‘chsh’ and which is preserved, pretty much like passwords changed with
‘passwd’.  This happens here:

  https://git.savannah.gnu.org/cgit/guix.git/tree/gnu/build/accounts.scm#n486

Thus, when you reconfigure, if the user already exists, its current
shell is preserved, regardless of what you put in the configuration.

I think this is what makes the most sense on a multi-user system: users
shouldn’t have to ask the admins to change their shell.

On a single-user system, it’s a bit different, but you can do both: use
‘chsh’, and adjust your OS config so that it’s correct from the start
when you reinstall.

WDYT?

Thanks,
Ludo’.

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

* Re: Changing user-account's shell
  2019-04-19  6:53     ` Pierre Neidhardt
@ 2019-04-19 21:24       ` Tanguy Le Carrour
  0 siblings, 0 replies; 8+ messages in thread
From: Tanguy Le Carrour @ 2019-04-19 21:24 UTC (permalink / raw)
  To: Pierre Neidhardt; +Cc: help-guix

Le 04/19, Pierre Neidhardt a écrit :
> Tanguy Le Carrour <tanguy@bioneland.org> writes:
> > Unfortunately, calling Fish from Bash is not really sexy! This is what I
> > do on systems where I cannot set my default shell and I don't like to have to
> > do one extra ctrl+d to close a terminal. ^_^'
> 
> You would not, because when you run
> 
> --8<---------------cut here---------------start------------->8---
> exec fish "$@"
> --8<---------------cut here---------------end--------------->8---
> 
> it replaces the Bash process, so exiting Fish would effectively
> terminate the direct child process of the terminal which would then close
> automatically.

Oh oh oh… and now I understand the difference between `fish` and `exec
fish`! ^_^' … It works perfectly!

I still don't know if I'll go for this solution or the `chsh` as
suggested by Ludo'.

Regards

-- 
Tanguy

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

* Re: Changing user-account's shell
  2019-04-19 12:04     ` Ludovic Courtès
@ 2019-04-19 21:30       ` Tanguy Le Carrour
  0 siblings, 0 replies; 8+ messages in thread
From: Tanguy Le Carrour @ 2019-04-19 21:30 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: help-guix

Le 04/19, Ludovic Courtès a écrit :
> Tanguy Le Carrour <tanguy@bioneland.org> skribis:
> > Le 04/18, Ludovic Courtès a écrit :
> >> Tanguy Le Carrour <tanguy@bioneland.org> skribis:
> >> > I'm trying to set my user's shell through the Guix configuration system,
> >> > but without success.
> >> > […]
> > Bug or feature?!
> 
> I say “feature”, but we can discuss it.  :-)
> 
> The (gnu build accounts) module, which populates /etc/passwd, considers
> the user shell to be “state”
> […]
> WDYT?

Definitively Feature! You've convinced me!
But, I guess, it will still feel weird for a little while not to see
the exact "state" describe in my config be applied on `reconfigure`.

I was thinking that maybe this could be documented like `password` is:

    You would normally leave this field to ‘#f’, initialize user
    passwords as ‘root’ with the ‘passwd’ command, and then let
    users change it with ‘passwd’.  Passwords set with ‘passwd’
    are of course preserved across reboot and reconfiguration.

Something like:

    … and then let users change it with `chsh`. Shells set with `chsh`
    are of course preserved across reboot and reconfiguration.

Anyway, thanks for your time geeks!

-- 
Tanguy

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

end of thread, other threads:[~2019-04-19 21:30 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-17 19:59 Changing user-account's shell Tanguy Le Carrour
2019-04-18 14:45 ` Ludovic Courtès
2019-04-18 20:51   ` Tanguy Le Carrour
2019-04-19 12:04     ` Ludovic Courtès
2019-04-19 21:30       ` Tanguy Le Carrour
     [not found] ` <87d0lkz5jw.fsf@ambrevar.xyz>
2019-04-18 20:22   ` Tanguy Le Carrour
2019-04-19  6:53     ` Pierre Neidhardt
2019-04-19 21:24       ` 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.