From 2952168ed59aa369a560563de2e00eab19f42d1b Mon Sep 17 00:00:00 2001 From: Romanos Skiadas Date: Sat, 4 Sep 2021 11:22:58 +0300 Subject: [PATCH] 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. --- README.md | 9 +++++---- docs/faq.adoc | 10 ++++++++-- docs/installation.adoc | 6 ++++-- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 45327ba7..e012d930 100644 --- a/README.md +++ b/README.md @@ -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 ``` - file in your shell configuration. Unfortunately, in this specific - case we currently only support POSIX.2-like shells such as - [Bash][] or [Z shell][]. + file in your shell configuration. This file can be sourced + directly by POSIX.2-like shells such as [Bash][] or [Z shell][]. 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" ``` - 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 checkout of the repository then you can use the diff --git a/docs/faq.adoc b/docs/faq.adoc index 2c9c1f16..78a13a56 100644 --- a/docs/faq.adoc +++ b/docs/faq.adoc @@ -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Ā '*'`. === 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] ---- . "$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? :post-your-homenix: https://www.reddit.com/r/NixOS/comments/9bb9h9/post_your_homemanager_homenix_file/ diff --git a/docs/installation.adoc b/docs/installation.adoc index 51899d47..24cb83cd 100644 --- a/docs/installation.adoc +++ b/docs/installation.adoc @@ -86,7 +86,7 @@ file in your shell configuration. Alternatively source + 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 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" ---- + -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 checkout of the repository then you can use the