unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* use zsh as login shell
@ 2014-11-27 15:58 宋文武
  2014-11-27 20:15 ` Ludovic Courtès
  2014-12-05 13:57 ` 宋文武
  0 siblings, 2 replies; 18+ messages in thread
From: 宋文武 @ 2014-11-27 15:58 UTC (permalink / raw)
  To: guix-devel

Currently, zsh doesn't work out of box.

IMO, we should use `/etc/environment' for system variables:
    LANG=en_US.UTF-8
    PATH=/run/current-system/profile/bin:/run/setuid-programs
And add `pam_env.so' to /etc/pam.d/login, to make tty login work.

With `/etc/profile', `/etc/zlogin' just:
    source /etc/environment
to make `bash -l' and `zsh -l' work.

And `~/.bash_profile', `~/.zlogin' for user variables:
    [[ $- == *i* ]] && source ~/.bashrc # only for bash
    
    export PATH=$PATH:$HOME/.guix-profile/bin

Use `~/.bashrc', `~/.zshrc' for interactive settings:
    PS1='$ '
    alias ls='ls -p --color'
    # $(guix package --search-paths)?


Note:
  non-login interactive should inherit env from parent,
  eg: `env -i $(which bash)' spawn a shell with no PATH (what I expect).

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

* Re: use zsh as login shell
  2014-11-27 15:58 use zsh as login shell 宋文武
@ 2014-11-27 20:15 ` Ludovic Courtès
  2014-11-28 15:06   ` 宋文武
  2014-11-28 15:11   ` use zsh " 宋文武
  2014-12-05 13:57 ` 宋文武
  1 sibling, 2 replies; 18+ messages in thread
From: Ludovic Courtès @ 2014-11-27 20:15 UTC (permalink / raw)
  To: 宋文武; +Cc: guix-devel

宋文武 <iyzsong@gmail.com> skribis:

> Currently, zsh doesn't work out of box.

On the standalone system, right?

> IMO, we should use `/etc/environment' for system variables:
>     LANG=en_US.UTF-8
>     PATH=/run/current-system/profile/bin:/run/setuid-programs
> And add `pam_env.so' to /etc/pam.d/login, to make tty login work.
>
> With `/etc/profile', `/etc/zlogin' just:
>     source /etc/environment
> to make `bash -l' and `zsh -l' work.

Is ‘pam env’ needed at all if /etc/profile and /etc/zlogin are provided
anyway?

> And `~/.bash_profile', `~/.zlogin' for user variables:
>     [[ $- == *i* ]] && source ~/.bashrc # only for bash
>     
>     export PATH=$PATH:$HOME/.guix-profile/bin

OK.  It would be best to have $HOME/.guix-profile/bin in PATH installed
by /etc/{profile,zlogin}, though, so that it works out of the box.

> Use `~/.bashrc', `~/.zshrc' for interactive settings:
>     PS1='$ '
>     alias ls='ls -p --color'
>     # $(guix package --search-paths)?

OK.

Thanks for the very good summary!  I never had this clear an
understanding of all this.

Would you like to submit a patch?  The relevant parts are in (gnu
system) for /etc/profile, in (gnu system shadow) for the .bashrc
template, and in (gnu services base) for the PAM settings of the ‘login’
command.

Ludo’.

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

* Re: use zsh as login shell
  2014-11-27 20:15 ` Ludovic Courtès
@ 2014-11-28 15:06   ` 宋文武
  2014-11-28 22:26     ` Ludovic Courtès
  2014-11-28 15:11   ` use zsh " 宋文武
  1 sibling, 1 reply; 18+ messages in thread
From: 宋文武 @ 2014-11-28 15:06 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

Ludovic Courtès <ludo@gnu.org> writes:

> 宋文武 <iyzsong@gmail.com> skribis:
>
>> Currently, zsh doesn't work out of box.
>
> On the standalone system, right?
Yes.
>
>> IMO, we should use `/etc/environment' for system variables:
>>     LANG=en_US.UTF-8
>>     PATH=/run/current-system/profile/bin:/run/setuid-programs
>> And add `pam_env.so' to /etc/pam.d/login, to make tty login work.
>>
>> With `/etc/profile', `/etc/zlogin' just:
>>     source /etc/environment
>> to make `bash -l' and `zsh -l' work.
>
> Is ‘pam env’ needed at all if /etc/profile and /etc/zlogin are provided
> anyway?
Yes, it's redundant.
Now I think the better way is just provide /etc/environment.
then `bash -l' would take ~/.bash_profile and ~/.profile.
We can have a default ~/.bash_profile like:
    source /etc/environment
    export PATH=$PATH:$HOME/.guix-profile/bin

And install skeletons only when needed by using:
    (operating-system
      (skeletons (list bash-profile)))

WDYT?
>
>> And `~/.bash_profile', `~/.zlogin' for user variables:
>>     [[ $- == *i* ]] && source ~/.bashrc # only for bash
>>     
>>     export PATH=$PATH:$HOME/.guix-profile/bin
>
> OK.  It would be best to have $HOME/.guix-profile/bin in PATH installed
> by /etc/{profile,zlogin}, though, so that it works out of the box.
>
>> Use `~/.bashrc', `~/.zshrc' for interactive settings:
>>     PS1='$ '
>>     alias ls='ls -p --color'
>>     # $(guix package --search-paths)?
>
> OK.
>
> Thanks for the very good summary!  I never had this clear an
> understanding of all this.
In fact, I'm confused about this even now :)
>
> Would you like to submit a patch?  The relevant parts are in (gnu
> system) for /etc/profile, in (gnu system shadow) for the .bashrc
> template, and in (gnu services base) for the PAM settings of the ‘login’
> command.
Sure, I'll try to write a patch, thanks for the direction.
>
> Ludo’.

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

* Re: use zsh as login shell
  2014-11-27 20:15 ` Ludovic Courtès
  2014-11-28 15:06   ` 宋文武
@ 2014-11-28 15:11   ` 宋文武
  1 sibling, 0 replies; 18+ messages in thread
From: 宋文武 @ 2014-11-28 15:11 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

Ludovic Courtès <ludo@gnu.org> writes:

> 宋文武 <iyzsong@gmail.com> skribis:
>
>> Currently, zsh doesn't work out of box.
>
> On the standalone system, right?
Yes.
>
>> IMO, we should use `/etc/environment' for system variables:
>>     LANG=en_US.UTF-8
>>     PATH=/run/current-system/profile/bin:/run/setuid-programs
>> And add `pam_env.so' to /etc/pam.d/login, to make tty login work.
>>
>> With `/etc/profile', `/etc/zlogin' just:
>>     source /etc/environment
>> to make `bash -l' and `zsh -l' work.
>
> Is ‘pam env’ needed at all if /etc/profile and /etc/zlogin are provided
> anyway?
Yes, it's redundant.
Now I think the better way is just provide /etc/environment.
then `bash -l' would take ~/.bash_profile and ~/.profile.
We can have a default ~/.bash_profile like:
    source /etc/environment
    export PATH=$PATH:$HOME/.guix-profile/bin

And install skeletons only when needed by using:
    (operating-system
      (skeletons (list bash-profile)))

WDYT?
>
>> And `~/.bash_profile', `~/.zlogin' for user variables:
>>     [[ $- == *i* ]] && source ~/.bashrc # only for bash
>>     
>>     export PATH=$PATH:$HOME/.guix-profile/bin
>
> OK.  It would be best to have $HOME/.guix-profile/bin in PATH installed
> by /etc/{profile,zlogin}, though, so that it works out of the box.
>
>> Use `~/.bashrc', `~/.zshrc' for interactive settings:
>>     PS1='$ '
>>     alias ls='ls -p --color'
>>     # $(guix package --search-paths)?
>
> OK.
>
> Thanks for the very good summary!  I never had this clear an
> understanding of all this.
In fact, I'm confused about this even now :)
>
> Would you like to submit a patch?  The relevant parts are in (gnu
> system) for /etc/profile, in (gnu system shadow) for the .bashrc
> template, and in (gnu services base) for the PAM settings of the ‘login’
> command.
Sure, I'll try to write a patch, thanks for the direction.
>
> Ludo’.

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

* Re: use zsh as login shell
  2014-11-28 15:06   ` 宋文武
@ 2014-11-28 22:26     ` Ludovic Courtès
  2014-11-29  3:24       ` 宋文武
  0 siblings, 1 reply; 18+ messages in thread
From: Ludovic Courtès @ 2014-11-28 22:26 UTC (permalink / raw)
  To: 宋文武; +Cc: guix-devel

宋文武 <iyzsong@gmail.com> skribis:

> Ludovic Courtès <ludo@gnu.org> writes:
>
>> 宋文武 <iyzsong@gmail.com> skribis:

[...]

>>> IMO, we should use `/etc/environment' for system variables:
>>>     LANG=en_US.UTF-8
>>>     PATH=/run/current-system/profile/bin:/run/setuid-programs
>>> And add `pam_env.so' to /etc/pam.d/login, to make tty login work.
>>>
>>> With `/etc/profile', `/etc/zlogin' just:
>>>     source /etc/environment
>>> to make `bash -l' and `zsh -l' work.
>>
>> Is ‘pam env’ needed at all if /etc/profile and /etc/zlogin are provided
>> anyway?
> Yes, it's redundant.
> Now I think the better way is just provide /etc/environment.
> then `bash -l' would take ~/.bash_profile and ~/.profile.
> We can have a default ~/.bash_profile like:
>     source /etc/environment
>     export PATH=$PATH:$HOME/.guix-profile/bin

Currently, the .bashrc skeleton sources /etc/profile.

So, instead of what you suggest, what about having:

  1. /etc/profile and /etc/zlogin (?) both source /etc/environment,
     which uses plain Bourne syntax.

  2. PATH is defined in /etc/environment and includes
     ~/.guix-profile/bin.

  3. The skeleton for ~/.bash_profile sources /etc/profile, /etc/bashrc,
     and ~/.bashrc.

  4. The definition of PS1 is moved from /etc/profile to /etc/bashrc.

  5. The skeleton for ~/.bashrc sources /etc/bashrc.

?

(I was reading the Bash manual to make sure (info "(bash) Bash Startup
Files"), and as an exercise, I’ve cleaned up my own ~/.bashrc and
~/.bash_profile accordingly, which fixes the issue I reported a couple
of weeks ago regarding ‘guix environment’.)

Thanks,
Ludo’.

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

* Re: use zsh as login shell
  2014-11-28 22:26     ` Ludovic Courtès
@ 2014-11-29  3:24       ` 宋文武
  2014-12-01 12:57         ` Ludovic Courtès
  0 siblings, 1 reply; 18+ messages in thread
From: 宋文武 @ 2014-11-29  3:24 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

Ludovic Courtès <ludo@gnu.org> writes:

> 宋文武 <iyzsong@gmail.com> skribis:
>
>> Ludovic Courtès <ludo@gnu.org> writes:
>>
>>> 宋文武 <iyzsong@gmail.com> skribis:
>
> [...]
>
>>>> IMO, we should use `/etc/environment' for system variables:
>>>>     LANG=en_US.UTF-8
>>>>     PATH=/run/current-system/profile/bin:/run/setuid-programs
>>>> And add `pam_env.so' to /etc/pam.d/login, to make tty login work.
>>>>
>>>> With `/etc/profile', `/etc/zlogin' just:
>>>>     source /etc/environment
>>>> to make `bash -l' and `zsh -l' work.
>>>
>>> Is ‘pam env’ needed at all if /etc/profile and /etc/zlogin are provided
>>> anyway?
>> Yes, it's redundant.
>> Now I think the better way is just provide /etc/environment.
>> then `bash -l' would take ~/.bash_profile and ~/.profile.
>> We can have a default ~/.bash_profile like:
>>     source /etc/environment
>>     export PATH=$PATH:$HOME/.guix-profile/bin
>
> Currently, the .bashrc skeleton sources /etc/profile.
>
> So, instead of what you suggest, what about having:
>
>   1. /etc/profile and /etc/zlogin (?) both source /etc/environment,
>      which uses plain Bourne syntax.
>
>   2. PATH is defined in /etc/environment and includes
>      ~/.guix-profile/bin.
/etc/environment is defined by pam_env to be a simple KEY=VAL file, with no
support for varibales substitute. If we do not use pam_env (linux specified?),
I think we should let /etc/zlogin source /etc/profile instead.

And we don't want /etc/zlogin when not using zsh at all,
IIUC while skeletons is configurable at the top os-expr, /etc/zlogin is
not. 
>
>   3. The skeleton for ~/.bash_profile sources /etc/profile, /etc/bashrc,
>      and ~/.bashrc.
>
>   4. The definition of PS1 is moved from /etc/profile to /etc/bashrc.
>
>   5. The skeleton for ~/.bashrc sources /etc/bashrc.
It seem too much, what I suggested is:
    for login, su (pam_env): /etc/environment
    for login shell:         ~/.bash_profile, ~/.zlogin
    for interactive:         ~/.bashrc, ~/.zshrc
skeletons only installed when needed :)
>
> ?
>
> (I was reading the Bash manual to make sure (info "(bash) Bash Startup
> Files"), and as an exercise, I’ve cleaned up my own ~/.bashrc and
> ~/.bash_profile accordingly, which fixes the issue I reported a couple
> of weeks ago regarding ‘guix environment’.)
>
> Thanks,
> Ludo’.

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

* Re: use zsh as login shell
  2014-11-29  3:24       ` 宋文武
@ 2014-12-01 12:57         ` Ludovic Courtès
  2014-12-02 14:43           ` 宋文武
  0 siblings, 1 reply; 18+ messages in thread
From: Ludovic Courtès @ 2014-12-01 12:57 UTC (permalink / raw)
  To: 宋文武; +Cc: guix-devel

宋文武 <iyzsong@gmail.com> skribis:

> Ludovic Courtès <ludo@gnu.org> writes:
>
>> 宋文武 <iyzsong@gmail.com> skribis:
>>
>>> Ludovic Courtès <ludo@gnu.org> writes:

[...]

>> So, instead of what you suggest, what about having:
>>
>>   1. /etc/profile and /etc/zlogin (?) both source /etc/environment,
>>      which uses plain Bourne syntax.
>>
>>   2. PATH is defined in /etc/environment and includes
>>      ~/.guix-profile/bin.
> /etc/environment is defined by pam_env to be a simple KEY=VAL file, with no
> support for varibales substitute. If we do not use pam_env (linux specified?),
> I think we should let /etc/zlogin source /etc/profile instead.

Yes, but they would contain almost the same lines, right?  To what
extent is zsh Bourne- or Bash-compatible?  Does ‘export foo=bar’ work
for zsh?

If it does, let’s just keep /etc/profile, and use it for both zsh and
Bash.

> And we don't want /etc/zlogin when not using zsh at all,
> IIUC while skeletons is configurable at the top os-expr, /etc/zlogin is
> not. 

It’s OK to have a 2-KiB /etc/zlogin, even when one doesn’t use zsh.

>>   3. The skeleton for ~/.bash_profile sources /etc/profile, /etc/bashrc,
>>      and ~/.bashrc.
>>
>>   4. The definition of PS1 is moved from /etc/profile to /etc/bashrc.
>>
>>   5. The skeleton for ~/.bashrc sources /etc/bashrc.
> It seem too much, what I suggested is:
>     for login, su (pam_env): /etc/environment
>     for login shell:         ~/.bash_profile, ~/.zlogin
>     for interactive:         ~/.bashrc, ~/.zshrc
> skeletons only installed when needed :)

As a first step, what about always installing the skeletons?  Then we
can see whether/how to refine that.

Thanks,
Ludo’.

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

* Re: use zsh as login shell
  2014-12-01 12:57         ` Ludovic Courtès
@ 2014-12-02 14:43           ` 宋文武
  2014-12-04 23:10             ` Ludovic Courtès
  0 siblings, 1 reply; 18+ messages in thread
From: 宋文武 @ 2014-12-02 14:43 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

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

Ludovic Courtès <ludo@gnu.org> writes:

> 宋文武 <iyzsong@gmail.com> skribis:
>
>> Ludovic Courtès <ludo@gnu.org> writes:
>>
>>> 宋文武 <iyzsong@gmail.com> skribis:
>>>
>>>> Ludovic Courtès <ludo@gnu.org> writes:
>
> [...]
>
>>> So, instead of what you suggest, what about having:
>>>
>>>   1. /etc/profile and /etc/zlogin (?) both source /etc/environment,
>>>      which uses plain Bourne syntax.
>>>
>>>   2. PATH is defined in /etc/environment and includes
>>>      ~/.guix-profile/bin.
>> /etc/environment is defined by pam_env to be a simple KEY=VAL file, with no
>> support for varibales substitute. If we do not use pam_env (linux specified?),
>> I think we should let /etc/zlogin source /etc/profile instead.
>
> Yes, but they would contain almost the same lines, right?  To what
> extent is zsh Bourne- or Bash-compatible?  Does ‘export foo=bar’ work
> for zsh?
It does.
>
> If it does, let’s just keep /etc/profile, and use it for both zsh and
> Bash.
>
>> And we don't want /etc/zlogin when not using zsh at all,
>> IIUC while skeletons is configurable at the top os-expr, /etc/zlogin is
>> not. 
>
> It’s OK to have a 2-KiB /etc/zlogin, even when one doesn’t use zsh.
>
>>>   3. The skeleton for ~/.bash_profile sources /etc/profile, /etc/bashrc,
>>>      and ~/.bashrc.
>>>
>>>   4. The definition of PS1 is moved from /etc/profile to /etc/bashrc.
>>>
>>>   5. The skeleton for ~/.bashrc sources /etc/bashrc.
>> It seem too much, what I suggested is:
>>     for login, su (pam_env): /etc/environment
>>     for login shell:         ~/.bash_profile, ~/.zlogin
>>     for interactive:         ~/.bashrc, ~/.zshrc
>> skeletons only installed when needed :)
>
> As a first step, what about always installing the skeletons?  Then we
> can see whether/how to refine that.
No problem.
>
> Thanks,
> Ludo’.

And this is what I have so far:

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-Add-etc-environment.patch --]
[-- Type: text/x-patch, Size: 8033 bytes --]

From 1e400957b29a47f63548df39b36a7c0f1d8a37d9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@gmail.com>
Date: Tue, 2 Dec 2014 21:40:52 +0800
Subject: [PATCH] gnu: Add /etc/environment.

* gnu/system.scm (default-/etc/environment): New procedure.
  (etc-directory)[profile]: Remove it.
  (etc-directory)[environment]: Add it.
* gnu/system/linux.scm (unix-pam-service): Add #:readenv? parameter.
* gnu/services/base.scm (mingetty-service): Pass #t as #:readenv?
  to unix-pam-service.
* gnu/system/shadow.scm (default-skeletons): Add .bash_profile. Adjust .bashrc.
---
 gnu/services/base.scm |  3 ++-
 gnu/system.scm        | 40 ++++++++++++++++++++--------------------
 gnu/system/linux.scm  | 26 ++++++++++++++++----------
 gnu/system/shadow.scm | 18 +++++++++++++++---
 4 files changed, 53 insertions(+), 34 deletions(-)

diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index 712222b..b8dedd7 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -372,7 +372,8 @@ the ``message of the day''."
        ;; duplicates are removed.
        (list (unix-pam-service "login"
                                #:allow-empty-passwords? allow-empty-passwords?
-                               #:motd motd)))))))
+                               #:motd motd
+                               #:readenv? #t)))))))
 
 (define* (nscd-service #:key (glibc (canonical-package glibc)))
   "Return a service that runs libc's name service cache daemon (nscd)."
diff --git a/gnu/system.scm b/gnu/system.scm
index 731f9de..b0cf59f 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -351,6 +351,21 @@ This is the GNU system.  Welcome.\n")
   "Return the default /etc/hosts file."
   (text-file "hosts" (local-host-aliases host-name)))
 
+(define* (default-/etc/environment #:key locale timezone)
+  "Return the default /etc/environment file."
+  (let* ((profile "/run/current-system/profile")
+         (path (string-join (list "/run/setuid-programs"
+                                  (string-append profile "/bin")
+                                  (string-append profile "/sbin"))
+                            ":")))
+    (text-file* "environment" "\
+LANG=" locale "
+TZ=" timezone "
+TZDIR=" tzdata "/share/zoneinfo
+LINUX_MODULE_DIRECTORY=/run/booted-system/kernel/lib/modules
+PATH=" path "
+INFOPATH=/run/current-system/profile/share/info\n")))
+
 (define* (etc-directory #:key
                         (locale "C") (timezone "Europe/Paris")
                         (issue "Hello!\n")
@@ -375,25 +390,10 @@ This is the GNU system.  Welcome.\n")
        (nsswitch   (text-file "nsswitch.conf"
                               "hosts: files dns\n"))
 
-       ;; TODO: Generate bashrc from packages' search-paths.
-       (bashrc    (text-file* "bashrc"  "
-export PS1='\\u@\\h \\w\\$ '
-
-export LC_ALL=\"" locale "\"
-export TZ=\"" timezone "\"
-export TZDIR=\"" tzdata "/share/zoneinfo\"
-
-# Tell 'modprobe' & co. where to look for modules.
-export LINUX_MODULE_DIRECTORY=/run/booted-system/kernel/lib/modules
-
-export PATH=$HOME/.guix-profile/bin:/run/current-system/profile/bin
-export PATH=/run/setuid-programs:/run/current-system/profile/sbin:$PATH
-export CPATH=$HOME/.guix-profile/include:" profile "/include
-export LIBRARY_PATH=$HOME/.guix-profile/lib:" profile "/lib
-export INFOPATH=$HOME/.guix-profile/share/info:/run/current-system/profile/share/info
-alias ls='ls -p --color'
-alias ll='ls -l'
-"))
+       ;; Default system-wide environment varibales.
+       (environment (default-/etc/environment #:locale locale
+                                              #:timezone timezone))
+
        (skel      (skeleton-directory skeletons)))
     (file-union "etc"
                 `(("services" ,#~(string-append #$net-base "/etc/services"))
@@ -405,7 +405,7 @@ alias ll='ls -l'
                   ("nsswitch.conf" ,#~#$nsswitch)
                   ("skel" ,#~#$skel)
                   ("shells" ,#~#$shells)
-                  ("profile" ,#~#$bashrc)
+                  ("environment" ,#~#$environment)
                   ("hosts" ,#~#$hosts-file)
                   ("localtime" ,#~(string-append #$tzdata "/share/zoneinfo/"
                                                  #$timezone))
diff --git a/gnu/system/linux.scm b/gnu/system/linux.scm
index 8cddedf..f479251 100644
--- a/gnu/system/linux.scm
+++ b/gnu/system/linux.scm
@@ -127,10 +127,11 @@ dumped in /etc/pam.d/NAME, where NAME is the name of SERVICE."
   (let ((unix (pam-entry
                (control "required")
                (module "pam_unix.so"))))
-    (lambda* (name #:key allow-empty-passwords? motd)
+    (lambda* (name #:key allow-empty-passwords? motd readenv?)
       "Return a standard Unix-style PAM service for NAME.  When
 ALLOW-EMPTY-PASSWORDS? is true, allow empty passwords.  When MOTD is true, it
-should be the name of a file used as the message-of-the-day."
+should be the name of a file used as the message-of-the-day.  When READENV? is
+true, honor system-wide environment variables."
       ;; See <http://www.linux-pam.org/Linux-PAM-html/sag-configuration-example.html>.
       (let ((name* name))
         (pam-service
@@ -143,14 +144,19 @@ should be the name of a file used as the message-of-the-day."
                           (arguments '("nullok")))
                          unix)))
          (password (list unix))
-         (session (if motd
-                      (list unix
-                            (pam-entry
-                             (control "optional")
-                             (module "pam_motd.so")
-                             (arguments
-                              (list #~(string-append "motd=" #$motd)))))
-                      (list unix))))))))
+         (session (let ((motd-entry
+                         (if motd
+                             (pam-entry
+                              (control "optional")
+                              (module "pam_motd.so")
+                              (arguments
+                               (list #~(string-append "motd=" #$motd))))))
+                        (env-entry
+                         (if readenv?
+                             (pam-entry
+                              (control "required")
+                              (module "pam_env.so")))))
+                    (filter pam-entry? (list unix motd-entry env-entry)))))))))
 
 (define (rootok-pam-service command)
   "Return a PAM service for COMMAND such that 'root' does not need to
diff --git a/gnu/system/shadow.scm b/gnu/system/shadow.scm
index 6970021..926c385 100644
--- a/gnu/system/shadow.scm
+++ b/gnu/system/shadow.scm
@@ -115,9 +115,20 @@
         (copy-file (car (find-files #$guile-wm "wm-init-sample.scm"))
                    #$output)))
 
-  (mlet %store-monad ((bashrc (text-file "bashrc" "\
-# Allow non-login shells such as an xterm to get things right.
-test -f /etc/profile && source /etc/profile\n"))
+  (mlet %store-monad ((bash-profile (text-file "bash_profile" "\
+# honor ~/.bashrc if the shell is interactive
+[[ $- == *i* ]] && source ~/.bashrc
+
+# load system-wide environment varibales
+source /etc/environment
+
+# common varibales for user profile
+export PATH=$HOME/.guix-profile/bin:$HOME/.guix-profile/sbin:$PATH
+export INFOPATH=$HOME/.guix-profile/share/info:$INFOPATH\n"))
+                      (bashrc (text-file "bashrc" "\
+PS1='\\u@\\h \\w\\$ '
+alias ls='ls -p --color'
+alias ll='ls -l'\n"))
                       (guile-wm (gexp->derivation "guile-wm" copy-guile-wm
                                                   #:modules
                                                   '((guix build utils))))
@@ -128,6 +139,7 @@ XTerm*metaSendsEscape: true\n"))
 # Tell GDB where to look for separate debugging files.
 set debug-file-directory ~/.guix-profile/lib/debug\n")))
     (return `((".bashrc" ,bashrc)
+              (".bash_profile" ,bash-profile)
               (".Xdefaults" ,xdefaults)
               (".guile-wm" ,guile-wm)
               (".gdbinit" ,gdbinit)))))
-- 
2.1.2


[-- Attachment #3: Type: text/plain, Size: 64 bytes --]


It only work when just one mingeety-service is enabled. Why :?

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

* Re: use zsh as login shell
  2014-12-02 14:43           ` 宋文武
@ 2014-12-04 23:10             ` Ludovic Courtès
  2014-12-05  5:11               ` Mark H Weaver
  2014-12-05 11:21               ` 宋文武
  0 siblings, 2 replies; 18+ messages in thread
From: Ludovic Courtès @ 2014-12-04 23:10 UTC (permalink / raw)
  To: 宋文武; +Cc: guix-devel

宋文武 <iyzsong@gmail.com> skribis:

> Ludovic Courtès <ludo@gnu.org> writes:
>
>> 宋文武 <iyzsong@gmail.com> skribis:

[...]

>>>>   3. The skeleton for ~/.bash_profile sources /etc/profile, /etc/bashrc,
>>>>      and ~/.bashrc.
>>>>
>>>>   4. The definition of PS1 is moved from /etc/profile to /etc/bashrc.
>>>>
>>>>   5. The skeleton for ~/.bashrc sources /etc/bashrc.
>>> It seem too much, what I suggested is:
>>>     for login, su (pam_env): /etc/environment
>>>     for login shell:         ~/.bash_profile, ~/.zlogin
>>>     for interactive:         ~/.bashrc, ~/.zshrc
>>> skeletons only installed when needed :)
>>
>> As a first step, what about always installing the skeletons?  Then we
>> can see whether/how to refine that.

[...]

> From 1e400957b29a47f63548df39b36a7c0f1d8a37d9 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@gmail.com>
> Date: Tue, 2 Dec 2014 21:40:52 +0800
> Subject: [PATCH] gnu: Add /etc/environment.
>
> * gnu/system.scm (default-/etc/environment): New procedure.
>   (etc-directory)[profile]: Remove it.
>   (etc-directory)[environment]: Add it.
> * gnu/system/linux.scm (unix-pam-service): Add #:readenv? parameter.
> * gnu/services/base.scm (mingetty-service): Pass #t as #:readenv?
>   to unix-pam-service.
> * gnu/system/shadow.scm (default-skeletons): Add .bash_profile. Adjust .bashrc.

So you ended up choosing pam_env?  I thought we had concluded that it
wasn’t needed, no?  If it can be avoided, it’s better to do so, IMO.

> +  (mlet %store-monad ((bash-profile (text-file "bash_profile" "\
> +# honor ~/.bashrc if the shell is interactive
> +[[ $- == *i* ]] && source ~/.bashrc

I don’t think the test is needed, because ~/.bash_profile is only read
by interactive Bash.

> +# load system-wide environment varibales
> +source /etc/environment
> +
> +# common varibales for user profile
> +export PATH=$HOME/.guix-profile/bin:$HOME/.guix-profile/sbin:$PATH
> +export INFOPATH=$HOME/.guix-profile/share/info:$INFOPATH\n"))
> +                      (bashrc (text-file "bashrc" "\
> +PS1='\\u@\\h \\w\\$ '

I think PS1 should go to /etc/profile.  WDYT?

Thanks!

Ludo’.

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

* Re: use zsh as login shell
  2014-12-04 23:10             ` Ludovic Courtès
@ 2014-12-05  5:11               ` Mark H Weaver
  2014-12-05 18:54                 ` Ludovic Courtès
  2014-12-05 11:21               ` 宋文武
  1 sibling, 1 reply; 18+ messages in thread
From: Mark H Weaver @ 2014-12-05  5:11 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

ludo@gnu.org (Ludovic Courtès) writes:

> 宋文武 <iyzsong@gmail.com> skribis:
>
>> +  (mlet %store-monad ((bash-profile (text-file "bash_profile" "\
>> +# honor ~/.bashrc if the shell is interactive
>> +[[ $- == *i* ]] && source ~/.bashrc
>
> I don’t think the test is needed, because ~/.bash_profile is only read
> by interactive Bash.

Indeed.  However, it would be good to check if ~/.bashrc exists.
Section 6.2 of the Bash manual suggests this:

  if [ -f ~/.bashrc ]; then . ~/.bashrc; fi

>> +# load system-wide environment varibales
>> +source /etc/environment
>> +
>> +# common varibales for user profile
>> +export PATH=$HOME/.guix-profile/bin:$HOME/.guix-profile/sbin:$PATH
>> +export INFOPATH=$HOME/.guix-profile/share/info:$INFOPATH\n"))
>> +                      (bashrc (text-file "bashrc" "\
>> +PS1='\\u@\\h \\w\\$ '
>
> I think PS1 should go to /etc/profile.  WDYT?

I agree with 宋文武 that the PS1 setting belongs in the default
~/.bashrc skeleton.  I would prefer to keep settings like this, that are
purely a matter of personal taste, out of system-wide files.  Also,
/etc/profile is read by other shells, and I don't know that the syntax
above is portable.

    Regards,
      Mark

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

* Re: use zsh as login shell
  2014-12-04 23:10             ` Ludovic Courtès
  2014-12-05  5:11               ` Mark H Weaver
@ 2014-12-05 11:21               ` 宋文武
  2014-12-06  8:04                 ` use zsh and fish " 宋文武
  1 sibling, 1 reply; 18+ messages in thread
From: 宋文武 @ 2014-12-05 11:21 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

Ludovic Courtès <ludo@gnu.org> writes:

> 宋文武 <iyzsong@gmail.com> skribis:
>
>> Ludovic Courtès <ludo@gnu.org> writes:
>>
>>> 宋文武 <iyzsong@gmail.com> skribis:
>
> [...]
>
>>>>>   3. The skeleton for ~/.bash_profile sources /etc/profile, /etc/bashrc,
>>>>>      and ~/.bashrc.
>>>>>
>>>>>   4. The definition of PS1 is moved from /etc/profile to /etc/bashrc.
>>>>>
>>>>>   5. The skeleton for ~/.bashrc sources /etc/bashrc.
>>>> It seem too much, what I suggested is:
>>>>     for login, su (pam_env): /etc/environment
>>>>     for login shell:         ~/.bash_profile, ~/.zlogin
>>>>     for interactive:         ~/.bashrc, ~/.zshrc
>>>> skeletons only installed when needed :)
>>>
>>> As a first step, what about always installing the skeletons?  Then we
>>> can see whether/how to refine that.
>
> [...]
>
>> From 1e400957b29a47f63548df39b36a7c0f1d8a37d9 Mon Sep 17 00:00:00 2001
>> From: =?UTF-8?q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@gmail.com>
>> Date: Tue, 2 Dec 2014 21:40:52 +0800
>> Subject: [PATCH] gnu: Add /etc/environment.
>>
>> * gnu/system.scm (default-/etc/environment): New procedure.
>>   (etc-directory)[profile]: Remove it.
>>   (etc-directory)[environment]: Add it.
>> * gnu/system/linux.scm (unix-pam-service): Add #:readenv? parameter.
>> * gnu/services/base.scm (mingetty-service): Pass #t as #:readenv?
>>   to unix-pam-service.
>> * gnu/system/shadow.scm (default-skeletons): Add .bash_profile. Adjust .bashrc.
>
> So you ended up choosing pam_env?  I thought we had concluded that it
> wasn’t needed, no?  If it can be avoided, it’s better to do so, IMO.
Ok, I'll take this approach this weekend :)
>
>> +  (mlet %store-monad ((bash-profile (text-file "bash_profile" "\
>> +# honor ~/.bashrc if the shell is interactive
>> +[[ $- == *i* ]] && source ~/.bashrc
>
> I don’t think the test is needed, because ~/.bash_profile is only read
> by interactive Bash.
Yes, I'll do what Mark H Weaver suggest.
>
>> +# load system-wide environment varibales
>> +source /etc/environment
>> +
>> +# common varibales for user profile
>> +export PATH=$HOME/.guix-profile/bin:$HOME/.guix-profile/sbin:$PATH
>> +export INFOPATH=$HOME/.guix-profile/share/info:$INFOPATH\n"))
>> +                      (bashrc (text-file "bashrc" "\
>> +PS1='\\u@\\h \\w\\$ '
>
> I think PS1 should go to /etc/profile.  WDYT?
+1 for Mark.
>
> Thanks!
>
> Ludo’.

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

* Re: use zsh as login shell
  2014-11-27 15:58 use zsh as login shell 宋文武
  2014-11-27 20:15 ` Ludovic Courtès
@ 2014-12-05 13:57 ` 宋文武
  2014-12-06 22:35   ` /etc/profile and .zshrc skeleton Ludovic Courtès
  1 sibling, 1 reply; 18+ messages in thread
From: 宋文武 @ 2014-12-05 13:57 UTC (permalink / raw)
  To: guix-devel

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

Here are my new patches:
Yeh, just add ~/.zshrc to source /etc/profie is enough.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-system-Cleanup-bash-startup-files.patch --]
[-- Type: text/x-patch, Size: 3730 bytes --]

From 42ccd7a445c9676db6d2c7b2b0583db45be245aa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@gmail.com>
Date: Fri, 5 Dec 2014 20:01:07 +0800
Subject: [PATCH 1/2] system: Cleanup bash startup files.

* gnu/system.scm (etc-directory) (bashrc): Rename to (profile).
  'CPATH', 'LIBRARY_PATH': Remove.
  'PS1', 'alias ls', 'alias ll': Move to ...
* gnu/system/shadow.scm (default-skeletons):
  (.bashrc): ... here. Don't source /etc/profile.
  (.bash_profile): New skeleton.
---
 gnu/system.scm        | 13 ++++---------
 gnu/system/shadow.scm | 13 +++++++++----
 2 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/gnu/system.scm b/gnu/system.scm
index e1ed1a2..a851ff2 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -384,10 +384,9 @@ This is the GNU system.  Welcome.\n")
        (nsswitch   (text-file "nsswitch.conf"
                               "hosts: files dns\n"))
 
-       ;; TODO: Generate bashrc from packages' search-paths.
-       (bashrc    (text-file* "bashrc"  "
-export PS1='\\u@\\h \\w\\$ '
-
+       ;; Startup file for POSIX-compliant login shells, which set system-wide
+       ;; environment variables.
+       (profile    (text-file* "profile"  "\
 export LC_ALL=\"" locale "\"
 export TZ=\"" timezone "\"
 export TZDIR=\"" tzdata "/share/zoneinfo\"
@@ -397,11 +396,7 @@ export LINUX_MODULE_DIRECTORY=/run/booted-system/kernel/lib/modules
 
 export PATH=$HOME/.guix-profile/bin:/run/current-system/profile/bin
 export PATH=/run/setuid-programs:/run/current-system/profile/sbin:$PATH
-export CPATH=$HOME/.guix-profile/include:" profile "/include
-export LIBRARY_PATH=$HOME/.guix-profile/lib:" profile "/lib
 export INFOPATH=$HOME/.guix-profile/share/info:/run/current-system/profile/share/info
-alias ls='ls -p --color'
-alias ll='ls -l'
 "))
        (skel      (skeleton-directory skeletons)))
     (file-union "etc"
@@ -414,7 +409,7 @@ alias ll='ls -l'
                   ("nsswitch.conf" ,#~#$nsswitch)
                   ("skel" ,#~#$skel)
                   ("shells" ,#~#$shells)
-                  ("profile" ,#~#$bashrc)
+                  ("profile" ,#~#$profile)
                   ("hosts" ,#~#$hosts-file)
                   ("localtime" ,#~(string-append #$tzdata "/share/zoneinfo/"
                                                  #$timezone))
diff --git a/gnu/system/shadow.scm b/gnu/system/shadow.scm
index 6970021..4a2322b 100644
--- a/gnu/system/shadow.scm
+++ b/gnu/system/shadow.scm
@@ -115,9 +115,13 @@
         (copy-file (car (find-files #$guile-wm "wm-init-sample.scm"))
                    #$output)))
 
-  (mlet %store-monad ((bashrc (text-file "bashrc" "\
-# Allow non-login shells such as an xterm to get things right.
-test -f /etc/profile && source /etc/profile\n"))
+  (mlet %store-monad ((profile (text-file "bash_profile" "\
+# Honor per-interactive-shell startup file
+if [ -f ~/.bashrc ]; then . ~/.bashrc; fi\n"))
+                      (bashrc (text-file "bashrc" "\
+PS1='\\u@\\h \\w\\$ '
+alias ls='ls -p --color'
+alias ll='ls -l'\n"))
                       (guile-wm (gexp->derivation "guile-wm" copy-guile-wm
                                                   #:modules
                                                   '((guix build utils))))
@@ -127,7 +131,8 @@ XTerm*metaSendsEscape: true\n"))
                       (gdbinit   (text-file "gdbinit" "\
 # Tell GDB where to look for separate debugging files.
 set debug-file-directory ~/.guix-profile/lib/debug\n")))
-    (return `((".bashrc" ,bashrc)
+    (return `((".bash_profile" ,profile)
+              (".bashrc" ,bashrc)
               (".Xdefaults" ,xdefaults)
               (".guile-wm" ,guile-wm)
               (".gdbinit" ,gdbinit)))))
-- 
2.1.2


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-system-Add-skeleton-.zshrc.patch --]
[-- Type: text/x-patch, Size: 1324 bytes --]

From 043e4d9b6743654e048d3495cb5bfa592d17e6c4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@gmail.com>
Date: Fri, 5 Dec 2014 21:17:49 +0800
Subject: [PATCH 2/2] system: Add skeleton '.zshrc'.

* gnu/system/shadow.scm (default-skeletons): Add .zshrc.
---
 gnu/system/shadow.scm | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/gnu/system/shadow.scm b/gnu/system/shadow.scm
index 4a2322b..a0b9f56 100644
--- a/gnu/system/shadow.scm
+++ b/gnu/system/shadow.scm
@@ -122,6 +122,9 @@ if [ -f ~/.bashrc ]; then . ~/.bashrc; fi\n"))
 PS1='\\u@\\h \\w\\$ '
 alias ls='ls -p --color'
 alias ll='ls -l'\n"))
+                      (zshrc (text-file "zshrc" "\
+# Honor system-wide environment variables
+source /etc/profile\n"))
                       (guile-wm (gexp->derivation "guile-wm" copy-guile-wm
                                                   #:modules
                                                   '((guix build utils))))
@@ -133,6 +136,7 @@ XTerm*metaSendsEscape: true\n"))
 set debug-file-directory ~/.guix-profile/lib/debug\n")))
     (return `((".bash_profile" ,profile)
               (".bashrc" ,bashrc)
+              (".zshrc" ,zshrc)
               (".Xdefaults" ,xdefaults)
               (".guile-wm" ,guile-wm)
               (".gdbinit" ,gdbinit)))))
-- 
2.1.2


[-- Attachment #4: Type: text/plain, Size: 284 bytes --]


I find `su` to bash will give a non-useable shell with
PATH set to '/sbin:/bin:/usr/sbin:/usr/bin'. This is because su/pam
reset the PATH to this default value. To solve this, we can add
/etc/environment and use pam_env.so for su. (imo not worth it :)

`su -l` and `sudo` work fine.

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

* Re: use zsh as login shell
  2014-12-05  5:11               ` Mark H Weaver
@ 2014-12-05 18:54                 ` Ludovic Courtès
  0 siblings, 0 replies; 18+ messages in thread
From: Ludovic Courtès @ 2014-12-05 18:54 UTC (permalink / raw)
  To: Mark H Weaver; +Cc: guix-devel

Mark H Weaver <mhw@netris.org> skribis:

> ludo@gnu.org (Ludovic Courtès) writes:
>
>> 宋文武 <iyzsong@gmail.com> skribis:
>>
>>> +  (mlet %store-monad ((bash-profile (text-file "bash_profile" "\
>>> +# honor ~/.bashrc if the shell is interactive
>>> +[[ $- == *i* ]] && source ~/.bashrc
>>
>> I don’t think the test is needed, because ~/.bash_profile is only read
>> by interactive Bash.
>
> Indeed.  However, it would be good to check if ~/.bashrc exists.
> Section 6.2 of the Bash manual suggests this:
>
>   if [ -f ~/.bashrc ]; then . ~/.bashrc; fi

Yes.

>>> +# load system-wide environment varibales
>>> +source /etc/environment
>>> +
>>> +# common varibales for user profile
>>> +export PATH=$HOME/.guix-profile/bin:$HOME/.guix-profile/sbin:$PATH
>>> +export INFOPATH=$HOME/.guix-profile/share/info:$INFOPATH\n"))
>>> +                      (bashrc (text-file "bashrc" "\
>>> +PS1='\\u@\\h \\w\\$ '
>>
>> I think PS1 should go to /etc/profile.  WDYT?
>
> I agree with 宋文武 that the PS1 setting belongs in the default
> ~/.bashrc skeleton.  I would prefer to keep settings like this, that are
> purely a matter of personal taste, out of system-wide files.  Also,
> /etc/profile is read by other shells, and I don't know that the syntax
> above is portable.

OK, that makes sense to me.

Ludo’.

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

* use zsh and fish as login shell
  2014-12-05 11:21               ` 宋文武
@ 2014-12-06  8:04                 ` 宋文武
  2014-12-06 15:09                   ` Ludovic Courtès
  0 siblings, 1 reply; 18+ messages in thread
From: 宋文武 @ 2014-12-06  8:04 UTC (permalink / raw)
  To: guix-devel

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

My previous patches for bash/zsh did not put fish into consider.
It's not POSIX-compliant, I have to generate a different config file.

Gentoo/Exherho create different files for differnt shells, eg:
  /etc/profile.env for sh
  /etc/profile.csh for csh
both comming from /etc/env.d.

So, I could do something similar:

[-- Attachment #2: env.scm --]
[-- Type: text/plain, Size: 2605 bytes --]

(use-modules (guix monads)
             (guix store)
             (guix gexp)
             (guix packages)
             (guix utils)
             (gnu packages base))


(define* (%default-environ #:key locale timezone)
  "Return the default environment variables as a alist."
  (mlet %store-monad ((tzdir (package-file tzdata "share/zoneinfo")))
    (let ((path '("/run/setuid-programs"
                  "$HOME/.guix-profile/bin"
                  "$HOME/.guix-profile/sbin"
                  "/run/current-system/profile/bin"
                  "/run/current-system/profile/sbin"))
          (infopath '("$HOME/.guix-profile/share/info"
                      "/run/current-system/profile/share/info"))
          ;; Tell 'modprobe' & co. where to look for modules.
          (linux-module-directory
           "/run/booted-system/kernel/lib/modules"))
      (return `(("LANG" . ,locale)
                ("TZ" . ,timezone)
                ("TZDIR" . ,tzdir)
                ("LINUX_MODULE_DIRECTORY" . ,linux-module-directory)
                ("PATH" . ,path)
                ("INFOPATH" . ,infopath))))))

(define (%default-/etc/profile menv)
  "Return the default /etc/profile."
  (mlet %store-monad ((env menv))
    (define (sh-setenv name value)
      (format #f "export ~a=~a\n"
              name
              (if (list? value)
                  (string-join value ":")
                  value)))
    (text-file "profile"
               (apply string-append
                      (map (lambda (e)
                             (sh-setenv (car e) (cdr e)))
                           env)))))

(define (%default-/etc/zlogin)
  "Return the default /etc/zlogin."
  (text-file "zlogin" "source /etc/profile/n"))

(define (%default-/etc/fish/config.fish menv)
  "Return the default /etc/fish/config.fish."
  (mlet %store-monad ((env menv))
    (define (fish-setenv name value)
      (format #f "    set -gx ~a ~a\n"
              name
              (if (list? value)
                  (string-join value " ")
                  value)))
    (text-file "config.fish" (string-append
                              "if status --is-login\n"
                              (apply string-append
                                     (map (lambda (e)
                                            (fish-setenv (car e) (cdr e)))
                                          env))
                              "end\n"))))

(display (run-with-store (open-connection)
           (%default-/etc/fish/config.fish
            (%default-environ #:locale "en_US.utf8"
                              #:timezone "Asia/Shanghai"))))

[-- Attachment #3: Type: text/plain, Size: 101 bytes --]


WDYT?

Since I'm new to Guile, please don't be hesitate to correct me (style,
name, etc..).
Thanks!

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

* Re: use zsh and fish as login shell
  2014-12-06  8:04                 ` use zsh and fish " 宋文武
@ 2014-12-06 15:09                   ` Ludovic Courtès
  0 siblings, 0 replies; 18+ messages in thread
From: Ludovic Courtès @ 2014-12-06 15:09 UTC (permalink / raw)
  To: 宋文武; +Cc: guix-devel

宋文武 <iyzsong@gmail.com> skribis:

> My previous patches for bash/zsh did not put fish into consider.
> It's not POSIX-compliant, I have to generate a different config file.
>
> Gentoo/Exherho create different files for differnt shells, eg:
>   /etc/profile.env for sh
>   /etc/profile.csh for csh

It seems that /etc/profile is the standard name for Bourne shells, so I
would leave it under that name.

OK for /etc/profile.csh.

> both comming from /etc/env.d.

I don’t see a need to an /etc/env.d directory.

What about finalizing your previous patch, taking into account Mark’s
comments and mine, and then discussing Fish/csh support separately?
That would be easier for me.

Thanks!

Ludo’.

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

* /etc/profile and .zshrc skeleton
  2014-12-05 13:57 ` 宋文武
@ 2014-12-06 22:35   ` Ludovic Courtès
  2014-12-07  4:06     ` 宋文武
  0 siblings, 1 reply; 18+ messages in thread
From: Ludovic Courtès @ 2014-12-06 22:35 UTC (permalink / raw)
  To: 宋文武; +Cc: guix-devel

(I think I had overlooked this email earlier today, sorry for the
confusion.)

宋文武 <iyzsong@gmail.com> skribis:

> From 42ccd7a445c9676db6d2c7b2b0583db45be245aa Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@gmail.com>
> Date: Fri, 5 Dec 2014 20:01:07 +0800
> Subject: [PATCH 1/2] system: Cleanup bash startup files.
>
> * gnu/system.scm (etc-directory) (bashrc): Rename to (profile).
>   'CPATH', 'LIBRARY_PATH': Remove.
>   'PS1', 'alias ls', 'alias ll': Move to ...
> * gnu/system/shadow.scm (default-skeletons):
>   (.bashrc): ... here. Don't source /etc/profile.
>   (.bash_profile): New skeleton.

One last thing: I think CPATH and LIBRARY_PATH (and eventually
additional search path variables) should remain in /etc/profile.

WDYT?

> From 043e4d9b6743654e048d3495cb5bfa592d17e6c4 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@gmail.com>
> Date: Fri, 5 Dec 2014 21:17:49 +0800
> Subject: [PATCH 2/2] system: Add skeleton '.zshrc'.
>
> * gnu/system/shadow.scm (default-skeletons): Add .zshrc.

OK.

Ludo’.

PS: In the future it may be easier for review to have one thread per
    patch, as per ‘git send-email’.

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

* Re: /etc/profile and .zshrc skeleton
  2014-12-06 22:35   ` /etc/profile and .zshrc skeleton Ludovic Courtès
@ 2014-12-07  4:06     ` 宋文武
  2014-12-07 20:35       ` Ludovic Courtès
  0 siblings, 1 reply; 18+ messages in thread
From: 宋文武 @ 2014-12-07  4:06 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

Ludovic Courtès <ludo@gnu.org> writes:

> (I think I had overlooked this email earlier today, sorry for the
> confusion.)
Sorry for my mess.
>
> 宋文武 <iyzsong@gmail.com> skribis:
>
>> From 42ccd7a445c9676db6d2c7b2b0583db45be245aa Mon Sep 17 00:00:00 2001
>> From: =?UTF-8?q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@gmail.com>
>> Date: Fri, 5 Dec 2014 20:01:07 +0800
>> Subject: [PATCH 1/2] system: Cleanup bash startup files.
>>
>> * gnu/system.scm (etc-directory) (bashrc): Rename to (profile).
>>   'CPATH', 'LIBRARY_PATH': Remove.
>>   'PS1', 'alias ls', 'alias ll': Move to ...
>> * gnu/system/shadow.scm (default-skeletons):
>>   (.bashrc): ... here. Don't source /etc/profile.
>>   (.bash_profile): New skeleton.
>
> One last thing: I think CPATH and LIBRARY_PATH (and eventually
> additional search path variables) should remain in /etc/profile.
I'll prefer use `guix environment' for dev, just install applications to
profile.
>
> WDYT?
>
>> From 043e4d9b6743654e048d3495cb5bfa592d17e6c4 Mon Sep 17 00:00:00 2001
>> From: =?UTF-8?q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@gmail.com>
>> Date: Fri, 5 Dec 2014 21:17:49 +0800
>> Subject: [PATCH 2/2] system: Add skeleton '.zshrc'.
>>
>> * gnu/system/shadow.scm (default-skeletons): Add .zshrc.
Ah, this should be ~/.zlogin.
>
> OK.
>
> Ludo’.
>
> PS: In the future it may be easier for review to have one thread per
>     patch, as per ‘git send-email’.
Ok, I just wait for the msmtp to use git send-email :)

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

* Re: /etc/profile and .zshrc skeleton
  2014-12-07  4:06     ` 宋文武
@ 2014-12-07 20:35       ` Ludovic Courtès
  0 siblings, 0 replies; 18+ messages in thread
From: Ludovic Courtès @ 2014-12-07 20:35 UTC (permalink / raw)
  To: 宋文武; +Cc: guix-devel

宋文武 <iyzsong@gmail.com> skribis:

> Ludovic Courtès <ludo@gnu.org> writes:

>> One last thing: I think CPATH and LIBRARY_PATH (and eventually
>> additional search path variables) should remain in /etc/profile.
> I'll prefer use `guix environment' for dev, just install applications to
> profile.

I agree that ‘guix environment’ is usually the preferred approach.

Yet, I thought it may be better to keep the other approach working out
of the box by default, to avoid unnecessary user frustration.

Thinking more, there are a number of other search path environment
variables that would be candidate for /etc/profile: GUILE_LOAD_PATH,
PKG_CONFIG_PATH, MANPATH, PERL5LIB, etc.  But perhaps some of them are
better left handled by the user?  How would we draw the line between
those that /etc/profile defines by default, and those that users have to
define by themselves?

Thanks,
Ludo’.

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

end of thread, other threads:[~2014-12-07 20:36 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-27 15:58 use zsh as login shell 宋文武
2014-11-27 20:15 ` Ludovic Courtès
2014-11-28 15:06   ` 宋文武
2014-11-28 22:26     ` Ludovic Courtès
2014-11-29  3:24       ` 宋文武
2014-12-01 12:57         ` Ludovic Courtès
2014-12-02 14:43           ` 宋文武
2014-12-04 23:10             ` Ludovic Courtès
2014-12-05  5:11               ` Mark H Weaver
2014-12-05 18:54                 ` Ludovic Courtès
2014-12-05 11:21               ` 宋文武
2014-12-06  8:04                 ` use zsh and fish " 宋文武
2014-12-06 15:09                   ` Ludovic Courtès
2014-11-28 15:11   ` use zsh " 宋文武
2014-12-05 13:57 ` 宋文武
2014-12-06 22:35   ` /etc/profile and .zshrc skeleton Ludovic Courtès
2014-12-07  4:06     ` 宋文武
2014-12-07 20:35       ` Ludovic Courtès

Code repositories for project(s) associated with this public inbox

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

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