Skip to content

Commit

Permalink
Fix shellAliases (#106)
Browse files Browse the repository at this point in the history
`project.shellAliases` wasn’t being referenced anywhere, so the aliases
were never added to the devShells. This fixes that.
  • Loading branch information
sellout authored Dec 2, 2024
2 parents 287e442 + 4fe9c0f commit 49e6ddf
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions modules/project-environment.nix
Original file line number Diff line number Diff line change
Expand Up @@ -513,8 +513,27 @@ in {
+ cfg.sessionVariablesExtra;
};

project.packages.shellAliases = let
aliasesStr =
lib.concatLines
(lib.mapAttrsToList (k: v: "alias ${k}=${lib.escapeShellArg v}")
cfg.shellAliases);
in
pkgs.writeTextFile {
name = "pm-shell-aliases.sh";
destination = "/etc/profile.d/pm-shell-aliases.sh";
text = ''
# Only source this once.
if [[ -v __PM_SHELL_ALIASES_SOURCED ]]; then return; fi
export __PM_SHELL_ALIASES_SOURCED=1
${aliasesStr}
'';
};

project.devPackages = [
cfg.packages.sessionVariables
cfg.packages.shellAliases
];

# A dummy entry acting as a boundary between the activation
Expand Down Expand Up @@ -738,6 +757,7 @@ in {

extraProfileCommands = ''
source ${cfg.packages.sessionVariables}/etc/profile.d/pm-session-vars.sh
source ${cfg.packages.shellAliases}/etc/profile.d/pm-shell-aliases.sh
'';

devShells = {
Expand Down

0 comments on commit 49e6ddf

Please sign in to comment.