mirror of
https://github.com/nix-community/home-manager.git
synced 2026-12-06 04:40:17 +00:00
Source the OS and Home Manager POSIX environment scripts when Nushell starts so runtime HOME and USER expansions and profile paths match managed POSIX shells.
31 lines
668 B
Nix
31 lines
668 B
Nix
{
|
|
stateVersion,
|
|
loadSessionVariables ? null,
|
|
}:
|
|
{ lib, ... }:
|
|
{
|
|
home.stateVersion = stateVersion;
|
|
programs.nushell = {
|
|
enable = true;
|
|
}
|
|
// lib.optionalAttrs (loadSessionVariables != null) { inherit loadSessionVariables; };
|
|
|
|
nmt.script =
|
|
let
|
|
enabled =
|
|
if loadSessionVariables != null then
|
|
loadSessionVariables
|
|
else
|
|
lib.versionAtLeast stateVersion "26.11";
|
|
envFile = "home-files/.config/nushell/env.nu";
|
|
in
|
|
if enabled then
|
|
''
|
|
assertFileRegex ${envFile} '^source /nix/store/[^/]*-hm-session-vars.nu$'
|
|
''
|
|
else
|
|
''
|
|
assertPathNotExists ${envFile}
|
|
'';
|
|
}
|