From a7db0b745ca3442b303858fb28a71f6ed54af6ed Mon Sep 17 00:00:00 2001 From: alexion Date: Sun, 4 Oct 2026 22:22:55 -0400 Subject: [PATCH] refactor(nixos): use Home Manager session variables --- configs/nixos/modules/shell/fish/default.nix | 8 +------- configs/nixos/modules/shell/python.nix | 7 ++++--- configs/nixos/modules/shell/rust.nix | 4 ++-- configs/nixos/registry/env-var.nix | 4 ---- 4 files changed, 7 insertions(+), 16 deletions(-) delete mode 100644 configs/nixos/registry/env-var.nix diff --git a/configs/nixos/modules/shell/fish/default.nix b/configs/nixos/modules/shell/fish/default.nix index fd7bebc..1728b67 100644 --- a/configs/nixos/modules/shell/fish/default.nix +++ b/configs/nixos/modules/shell/fish/default.nix @@ -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; }; }; }; diff --git a/configs/nixos/modules/shell/python.nix b/configs/nixos/modules/shell/python.nix index b33bedf..baf41c2 100644 --- a/configs/nixos/modules/shell/python.nix +++ b/configs/nixos/modules/shell/python.nix @@ -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 ]; + }; }; } diff --git a/configs/nixos/modules/shell/rust.nix b/configs/nixos/modules/shell/rust.nix index 5901c38..71c621c 100644 --- a/configs/nixos/modules/shell/rust.nix +++ b/configs/nixos/modules/shell/rust.nix @@ -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 diff --git a/configs/nixos/registry/env-var.nix b/configs/nixos/registry/env-var.nix deleted file mode 100644 index 8a6fd91..0000000 --- a/configs/nixos/registry/env-var.nix +++ /dev/null @@ -1,4 +0,0 @@ -{ lib, ... }: -{ - type = lib.types.str; -}