nixos-config/modules/home-manager/programs/nushell.nix

19 lines
636 B
Nix
Raw Normal View History

# This is just an extended implementation of exporting Nushell session
# variables since the one from home-manager is only in POSIX sh script.
{ config, lib, pkgs, ... }:
2025-01-29 04:48:19 +00:00
let cfg = config.programs.nushell;
in {
config.programs.nushell.extraEnv = let
2025-01-29 04:48:19 +00:00
exportToNuEnv = vars:
lib.concatStringsSep "\n"
(lib.mapAttrsToList (n: v: ''$env.${n} = "${v}"'') vars);
in lib.mkBefore (''
${exportToNuEnv config.home.sessionVariables}
'' + lib.optionalString (config.home.sessionPath != [ ]) ''
$env.PATH = $env.PATH | split row ':' | prepend [
${lib.concatStringsSep " " config.home.sessionPath}
]
'');
}