fix(fish): export Rust toolchain root

This commit is contained in:
2026-09-02 08:38:56 -04:00
parent d4d554205a
commit 17d69e51e6
3 changed files with 14 additions and 3 deletions

View File

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

View File

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

View File

@@ -0,0 +1,4 @@
{ lib, ... }:
{
type = lib.types.str;
}