nix-community / home-manager

Manage a user environment using Nix [maintainer=@rycee]
https://nix-community.github.io/home-manager/
MIT License
6.36k stars 1.7k forks source link

Make `home.sessionVariables` work with nushell #4313

Open Kreyren opened 11 months ago

Kreyren commented 11 months ago

Description

Currently i have to set the following:

  home.sessionVariables = {
    SHELL = "nu";
    TERM = "alacritty";
    EDITOR = "vim";
  };

  programs.nushell.extraEnv = ''
    # FIXME(Krey): This should be handled in `home.sessionVariables`
    $env.SHELL = "nu";
    $env.TERM = "alacritty"
    $env.EDITOR = "vim";

    # Include local binaries
    $env.PATH = ($env.PATH | split row (char esep) | append ($env.HOME | path join '.local/bin'));
  ''; 

Because home.sessionVariables doesn't export the variables for nushell -> Make it work with nushell too?

Expected workflow:

  home.sessionVariables = {
    SHELL = "nu";
    TERM = "alacritty";
    EDITOR = "vim";
  };

  programs.nushell.extraEnv = ''
-    # FIXME(Krey): This should be handled in `home.sessionVariables`
-    $env.SHELL = "nu";
-    $env.TERM = "alacritty"
-    $env.EDITOR = "vim";
-
    # Include local binaries
    $env.PATH = ($env.PATH | split row (char esep) | append ($env.HOME | path join '.local/bin'));
  ''; 
Suyashtnt commented 10 months ago

It's been a few months now. Are there any plans for this?

bluskript commented 9 months ago

quick fix that I haven't had time to cook into a PR / probably has compat problems:

    environmentVariables = builtins.mapAttrs (name: value: "\"${builtins.toString value}\"") config.home.sessionVariables;
stale[bot] commented 6 months ago

Thank you for your contribution! I marked this issue as stale due to inactivity. Please be considerate of people watching this issue and receiving notifications before commenting 'I have this issue too'. We welcome additional information that will help resolve this issue. Please read the relevant sections below before commenting.

If you are the original author of the issue

* If this is resolved, please consider closing it so that the maintainers know not to focus on this. * If this might still be an issue, but you are not interested in promoting its resolution, please consider closing it while encouraging others to take over and reopen an issue if they care enough. * If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.

If you are not the original author of the issue

* If you are also experiencing this issue, please add details of your situation to help with the debugging process. * If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.

Memorandum on closing issues

Don't be afraid to manually close an issue, even if it holds valuable information. Closed issues stay in the system for people to search, read, cross-reference, or even reopen – nothing is lost! Closing obsolete issues is an important way to help maintainers focus their time and effort.

heisfer commented 1 month ago

Maybe we could make use of https://github.com/tesujimath/nu_plugin_bash_env this plugin?