docs: update session-vars info about fish shell

The docs implied that fish was not really supported, but if fish is
managed by Home Manager, the generated config does use fenv to source
the session-vars file. Update the installation instructions and FAQ to
mention that fish does work, and mention fenv in the README.
This commit is contained in:
Romanos Skiadas 2021-09-04 11:22:58 +03:00 committed by Robert Helgesson
parent bd747c5a53
commit 2952168ed5
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
3 changed files with 17 additions and 8 deletions

View file

@ -107,9 +107,8 @@ Currently the easiest way to install Home Manager is as follows:
$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh $HOME/.nix-profile/etc/profile.d/hm-session-vars.sh
``` ```
file in your shell configuration. Unfortunately, in this specific file in your shell configuration. This file can be sourced
case we currently only support POSIX.2-like shells such as directly by POSIX.2-like shells such as [Bash][] or [Z shell][].
[Bash][] or [Z shell][].
For example, if you use Bash then add For example, if you use Bash then add
@ -124,7 +123,9 @@ Currently the easiest way to install Home Manager is as follows:
. "/etc/profiles/per-user/$USER/etc/profile.d/hm-session-vars.sh" . "/etc/profiles/per-user/$USER/etc/profile.d/hm-session-vars.sh"
``` ```
to your `~/.profile` file. to your `~/.profile` file. For fish shell, it is possible to use
[foreign-env](https://github.com/oh-my-fish/plugin-foreign-env) to
source the file.
If instead of using channels you want to run Home Manager from a Git If instead of using channels you want to run Home Manager from a Git
checkout of the repository then you can use the checkout of the repository then you can use the

View file

@ -43,15 +43,21 @@ The solution is typically to uninstall the package from the environment using `n
You could also opt to unistall _all_ of the packages from your profile with `nix-env --uninstall '*'`. You could also opt to unistall _all_ of the packages from your profile with `nix-env --uninstall '*'`.
=== Why are the session variables not set? === Why are the session variables not set?
:foreign-env: https://github.com/oh-my-fish/plugin-foreign-env
Home Manager is only able to set session variables automatically if it manages your Bash or Z shell configuration. If you don't want to let Home Manager manage your shell then you will have to manually source the `~/.nix-profile/etc/profile.d/hm-session-vars.sh` file in an appropriate way. In Bash and Z shell this can be done by adding Home Manager is only able to set session variables automatically if it manages your Bash, Z shell, or fish shell configuration. If you don't want to let Home Manager manage your shell then you will have to manually source the `~/.nix-profile/etc/profile.d/hm-session-vars.sh` file in an appropriate way. In Bash and Z shell this can be done by adding
[source,bash] [source,bash]
---- ----
. "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh" . "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh"
---- ----
to your `.profile` and `.zshrc` files, respectively. The `hm-session-vars.sh` file should work in most Bourne-like shells. to your `.profile` and `.zshrc` files, respectively. The `hm-session-vars.sh` file should work in most Bourne-like shells. For fish shell, it is possible to source it using {foreign-env}[the foreign-env plugin]
[source,bash]
----
fenv source "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh" > /dev/null
----
=== How to set up a configuration for multiple users/machines? === How to set up a configuration for multiple users/machines?
:post-your-homenix: https://www.reddit.com/r/NixOS/comments/9bb9h9/post_your_homemanager_homenix_file/ :post-your-homenix: https://www.reddit.com/r/NixOS/comments/9bb9h9/post_your_homemanager_homenix_file/

View file

@ -86,7 +86,7 @@ file in your shell configuration. Alternatively source
+ +
when managing home configuration together with system configuration. when managing home configuration together with system configuration.
+ +
Unfortunately, we currently only support POSIX.2-like shells such as This file can be sourced directly by POSIX.2-like shells such as
https://www.gnu.org/software/bash/[Bash] or https://www.gnu.org/software/bash/[Bash] or
http://zsh.sourceforge.net/[Z shell]. http://zsh.sourceforge.net/[Z shell].
+ +
@ -97,7 +97,9 @@ For example, if you use Bash then add
. "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh" . "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh"
---- ----
+ +
to your `~/.profile` file. to your `~/.profile` file. For fish shell, it is possible to use
https://github.com/oh-my-fish/plugin-foreign-env[foreign-env] to
source the file.
If instead of using channels you want to run Home Manager from a Git If instead of using channels you want to run Home Manager from a Git
checkout of the repository then you can use the checkout of the repository then you can use the