+ #t))
+ ;; Source /etc/fish/config.fish from $__fish_sysconf_dir/config.fish.
+ (add-before 'install 'patch-fish-config
+ (lambda _
+ (let ((port (open-file "etc/config.fish" "a")))
+ (display (string-append
+ "\n\n"
+ "# Patched by Guix.\n"
+ "# Source /etc/fish/config.fish.\n"
+ "if test -f /etc/fish/config.fish\n"
+ " source /etc/fish/config.fish\n"
+ "end\n")
+ port)
+ (close-port port))
+ #t))
+ ;; Enable completions, functions and configurations in user's and
+ ;; system's guix profiles by adding them to __extra_* variables.
+ (add-before 'install 'patch-fish-extra-paths
+ (lambda _
+ (let ((port (open-file "share/__fish_build_paths.fish" "a")))
+ (display
+ (string-append
+ "\n\n"
+ "# Patched by Guix.\n"
+ "# Enable completions, functions and configurations in user's"
+ " and system's guix profiles by adding them to __extra_*"
+ " variables.\n"
+ "set -l __guix_profile_paths ~/.guix-profile"
+ " /run/current-system/profile\n"
+ "set __extra_completionsdir"
+ " $__guix_profile_paths\"/etc/fish/completions\""
+ " $__guix_profile_paths\"/share/fish/vendor_completions.d\""
+ " $__extra_completionsdir\n"
+ "set __extra_functionsdir"
+ " $__guix_profile_paths\"/etc/fish/functions\""
+ " $__guix_profile_paths\"/share/fish/vendor_functions.d\""
+ " $__extra_functionsdir\n"
+ "set __extra_confdir"
+ " $__guix_profile_paths\"/etc/fish/conf.d\""
+ " $__guix_profile_paths\"/share/fish/vendor_conf.d\""
+ " $__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))