(address . guix-patches@gnu.org)
Hi,
This patch series updates fish shell to 3.0.0 and enable fish to source
/etc/profile using fish-foreign-env.
From da8487fe9b9a0a0308f7b929f9e95e8e8297de26 Mon Sep 17 00:00:00 2001
From: Meiyo Peng <meiyo.peng@gmail.com>
Date: Sun, 20 Jan 2019 21:41:21 +0800
Subject: [PATCH 2/3] gnu: Add fish-foreign-env.
* gnu/packages/shells.scm (fish-foreign-env): New variable.
---
gnu/packages/shells.scm | 50 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 50 insertions(+)
Toggle diff (77 lines)
diff --git a/gnu/packages/shells.scm b/gnu/packages/shells.scm
index e92b2fcc6..8e2ca2a9a 100644
--- a/gnu/packages/shells.scm
+++ b/gnu/packages/shells.scm
@@ -30,6 +30,7 @@
#:use-module (gnu packages)
#:use-module (gnu packages autotools)
#:use-module (gnu packages base)
+ #:use-module (gnu packages bash)
#:use-module (gnu packages bison)
#:use-module (gnu packages documentation)
#:use-module (gnu packages groff)
@@ -45,6 +46,7 @@
#:use-module (gnu packages scheme)
#:use-module (guix build-system gnu)
#:use-module (guix build-system python)
+ #:use-module (guix build-system trivial)
#:use-module (guix download)
#:use-module (guix git-download)
#:use-module (guix licenses)
@@ -182,6 +184,54 @@ and syntax highlighting.")
(home-page "https://fishshell.com/")
(license gpl2)))
+(define-public fish-foreign-env
+ (package
+ (name "fish-foreign-env")
+ (version "0.20190116")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/oh-my-fish/plugin-foreign-env.git")
+ (commit "dddd9213272a0ab848d474d0cbde12ad034e65bc")))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "00xqlyl3lffc5l0viin1nyp819wf81fncqyz87jx8ljjdhilmgbs"))))
+ (build-system trivial-build-system)
+ (arguments
+ '(#:modules ((guix build utils))
+ #:builder
+ (begin
+ (use-modules (guix build utils))
+ (let* ((source (assoc-ref %build-inputs "source"))
+ (out (assoc-ref %outputs "out"))
+ (func-path (string-append out "/share/fish/functions")))
+ (mkdir-p func-path)
+ (copy-recursively (string-append source "/functions")
+ func-path)
+
+ ;; Embed absolute paths.
+ (substitute* `(,(string-append func-path "/fenv.fish")
+ ,(string-append func-path "/fenv.apply.fish")
+ ,(string-append func-path "/fenv.main.fish"))
+ (("bash")
+ (string-append (assoc-ref %build-inputs "bash") "/bin/bash"))
+ (("sed")
+ (string-append (assoc-ref %build-inputs "sed") "/bin/sed"))
+ ((" tr ")
+ (string-append " " (assoc-ref %build-inputs "coreutils")
+ "/bin/tr ")))))))
+ (inputs
+ `(("bash" ,bash)
+ ("coreutils" ,coreutils)
+ ("sed" ,sed)))
+ (home-page "https://github.com/oh-my-fish/plugin-foreign-env")
+ (synopsis "Foreign environment interface for fish shell")
+ (description "@code{fish-foreign-env} wraps bash script execution in a way
+that environment variables that are exported or modified get imported back
+into fish.")
+ (license expat)))
+
(define-public rc
(package
(name "rc")
--
2.20.1
From aadeb9dea8aff0db8a339cc11d006abff4736fdb Mon Sep 17 00:00:00 2001
From: Meiyo Peng <meiyo.peng@gmail.com>
Date: Sun, 20 Jan 2019 21:42:15 +0800
Subject: [PATCH 3/3] gnu: fish: Use fish-foreign-env to source /etc/profile.
* gnu/packages/shells.scm (fish): Use fish-foreign-env to source /etc/profile
when user logs in.
---
gnu/packages/shells.scm | 22 +++++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)
Toggle diff (42 lines)
diff --git a/gnu/packages/shells.scm b/gnu/packages/shells.scm
index 8e2ca2a9a..d0561559e 100644
--- a/gnu/packages/shells.scm
+++ b/gnu/packages/shells.scm
@@ -102,7 +102,8 @@ direct descendant of NetBSD's Almquist Shell (@command{ash}).")
(base32 "1kzjd0n0sfslkd36lzrvvvgy3qwkd9y466bkrqlnhd5h9dhx77ga"))))
(build-system gnu-build-system)
(inputs
- `(("groff" ,groff) ; for 'fish --help'
+ `(("fish-foreign-env" ,fish-foreign-env)
+ ("groff" ,groff) ; for 'fish --help'
("ncurses" ,ncurses)
("pcre2" ,pcre2) ; don't use the bundled PCRE2
("python" ,python))) ; for fish_config and manpage completions
@@ -170,6 +171,25 @@ direct descendant of NetBSD's Almquist Shell (@command{ash}).")
" $__extra_confdir\n")
port)
(close-port port))
+ #t))
+ ;; Use fish-foreign-env to source /etc/profile.
+ (add-before 'install 'source-etc-profile
+ (lambda* (#:key inputs #:allow-other-keys)
+ (let ((port (open-file "share/__fish_build_paths.fish" "a")))
+ (display
+ (string-append
+ "\n\n"
+ "# Patched by Guix.\n"
+ "# Use fish-foreign-env to source /etc/profile.\n"
+ "if status is-login\n"
+ " set fish_function_path "
+ (assoc-ref inputs "fish-foreign-env") "/share/fish/functions"
+ " $__fish_datadir/functions\n"
+ " fenv source /etc/profile\n"
+ " set -e fish_function_path\n"
+ "end\n")
+ port)
+ (close-port port))
#t)))))
(synopsis "The friendly interactive shell")
(description
--
2.20.1