refactor(nixos): use Home Manager session variables

This commit was merged in pull request #127.
This commit is contained in:
2026-10-04 22:22:55 -04:00
parent 4a8e8920ea
commit a7db0b745c
4 changed files with 7 additions and 16 deletions

View File

@@ -9,10 +9,6 @@ let
cfg = config.modules.shell.fish; # NOLINT(let_order)
commandsOf = shortcuts: lib.mapAttrs (_name: shortcut: shortcut.command) shortcuts;
shortcuts = lib.attrByPath [ config.networking.hostName ] { } config.registry.shell-shortcut;
exportEnvVar = name: value: ''
set -gx ${name} ${lib.escapeShellArg value}
'';
envVars = lib.attrByPath [ config.networking.hostName ] { } config.registry.env-var;
user = config.user.name;
in
{
@@ -106,9 +102,7 @@ in
};
# Rendered by home-manager into ~/.config/fish/config.fish.
interactiveShellInit = lib.concatStringsSep "\n" (
(lib.mapAttrsToList exportEnvVar envVars) ++ [ (builtins.readFile ./config.fish) ]
);
interactiveShellInit = builtins.readFile ./config.fish;
};
};
};

View File

@@ -14,8 +14,9 @@ in
lib.mkEnableOption "Python tools for the primary user's shell environment";
config = lib.mkIf cfg.enable {
registry.env-var.${config.networking.hostName}.PYTHON_TOOLCHAIN_ROOT = "${pkgs.python3}";
home-manager.users.${user}.home.packages = [ pkgs.python3 ];
home-manager.users.${user}.home = {
sessionVariables.PYTHON_TOOLCHAIN_ROOT = "${pkgs.python3}";
packages = [ pkgs.python3 ];
};
};
}

View File

@@ -24,9 +24,9 @@ in
lib.mkEnableOption "Rust tools for the primary user's shell environment";
config = lib.mkIf cfg.enable {
registry.env-var.${config.networking.hostName}.RUST_TOOLCHAIN_ROOT = "${toolchain}";
home-manager.users.${user} = {
home.sessionVariables.RUST_TOOLCHAIN_ROOT = "${toolchain}";
home.packages = [
toolchain
pkgs.rust-analyzer