From: 宋文武 <iyzsong@gmail.com>
To: guix-devel@gnu.org
Subject: use zsh and fish as login shell
Date: Sat, 06 Dec 2014 16:04:58 +0800 [thread overview]
Message-ID: <87388txkyd.fsf@gmail.com> (raw)
In-Reply-To: <87bnnifikk.fsf@gmail.com>
[-- 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!
next prev parent reply other threads:[~2014-12-06 8:05 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` 宋文武 [this message]
2014-12-06 15:09 ` use zsh and fish " 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87388txkyd.fsf@gmail.com \
--to=iyzsong@gmail.com \
--cc=guix-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.