GNU bug report logs -
#36021
[PATCH] search-paths: 'environment-variable-definition' output for fish
Previous Next
Full log
View this message in rfc822 format
Hi Dan,
Dan Frumin writes:
> Some background on this patch:
> Right now whenever I do any Guix operation that requires me to modify
> environment variables (e.g. installing a Guile library requires me to update
> $GUILE_LOAD_PATH afterwards), Guix helpful tells me what commands I have to run
> to update the variables.
>
> However, those commands are currently in bash/POSIX(?) format `export
> VAR=VALUE`. I've modified the `environment-variable-definition` function to
> support the syntax for Fish shell as well. I don't know if this method of
> looking at the $SHELL variable is sound, but it works on my machine.
>
> Documentation for the `set' function in Fish: https://fishshell.com/docs/current/commands.html#set
>
> PS: this is my first non-package patch for Guix so I apologize if there is something wrong with the patch
I think this patch will cause more trouble than good. Does this patch
replaces etc/profile with fish syntax script? etc/profile is supposed
to be in POSIX shell syntax. Fish shell has it's own configuration
files in /etc/fish/config.fish and /etc/fish/conf.d/*.fish. If you
really want to generate fish syntax scripts, please put them in
/etc/fish/config.fish or /etc/fish/conf.d/*.fish.
See:
1. https://lists.gnu.org/archive/html/guix-devel/2019-01/msg00071.html
2. https://lists.gnu.org/archive/html/guix-devel/2019-01/msg00333.html
3. https://issues.guix.gnu.org/issue/34153
Have you tried the fish-foreign-env package? You can source bash
scripts in fish via `fenv source ~/.guix-profile/etc/profile`. That's how
the fish shell in Guix set up environment variables upon login.
Perhaps we can handle this better. Do you have any suggestions? My
idea:
1. The fish-foreign-env package is very useful but it's not installed by
default in order to avoid polluting user's profiles according to the
Guix convention. In this case I think it's a useful utility rather than
pollution. Do you want it to be installed together with the fish
package by default?
2. etc/profile is supposed to be sourced by a login shell. And we
should avoid sourcing it from a non-login shell. That's why I made the
fish package in Guix only sources it upon login. That means starting a
new fish shell won't source it automatically. So please source it
manually if you need the new environment variables (fenv source
~/.guix-profile/etc/profile).
3. We can write better documentations explaining how to deal with fish
shell in Guix. There's an old discussion about having a Guix wiki or
a Guix book.
--
Meiyo Peng
https://www.pengmeiyu.com/
This bug report was last modified 6 years and 11 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.