From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?utf-8?B?5a6L5paH5q2m?= Subject: use zsh and fish as login shell Date: Sat, 06 Dec 2014 16:04:58 +0800 Message-ID: <87388txkyd.fsf@gmail.com> References: <87k32gtz2p.fsf@gmail.com> <87mw7cjt7b.fsf@gnu.org> <87mw7b74ar.fsf@gmail.com> <8761dzynah.fsf@gnu.org> <87vblyy9ia.fsf@gmail.com> <87egsjcyst.fsf@gnu.org> <87wq6aun7b.fsf@gmail.com> <87oarjqadw.fsf@gnu.org> <87bnnifikk.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:42221) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XxAMk-0006Tv-Oe for guix-devel@gnu.org; Sat, 06 Dec 2014 03:05:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XxAMb-0000d6-MT for guix-devel@gnu.org; Sat, 06 Dec 2014 03:05:22 -0500 Received: from mail-pd0-x229.google.com ([2607:f8b0:400e:c02::229]:42292) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XxAMb-0000bj-EN for guix-devel@gnu.org; Sat, 06 Dec 2014 03:05:13 -0500 Received: by mail-pd0-f169.google.com with SMTP id z10so2136081pdj.0 for ; Sat, 06 Dec 2014 00:05:12 -0800 (PST) Received: from akarin ([59.172.247.101]) by mx.google.com with ESMTPSA id dj1sm30805637pbb.48.2014.12.06.00.05.09 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 06 Dec 2014 00:05:11 -0800 (PST) In-Reply-To: <87bnnifikk.fsf@gmail.com> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: guix-devel@gnu.org --=-=-= Content-Type: text/plain 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: --=-=-= Content-Type: text/plain Content-Disposition: attachment; filename=env.scm (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")))) --=-=-= Content-Type: text/plain WDYT? Since I'm new to Guile, please don't be hesitate to correct me (style, name, etc..). Thanks! --=-=-=--