Skip to content

Commit 4d1cbd6

Browse files
committed
fix(shell:aliases|nu): workaround to support exa aliases option
1 parent 6459296 commit 4d1cbd6

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

profiles/homeProfiles/shells/nushell/default.nix

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,25 @@
88
inherit (config.home) username sessionVariables;
99
l = flake.inputs.nixpkgs.lib // builtins;
1010

11-
# FIXME: hardcoded
11+
exaCfg = config.programs.exa;
12+
13+
# FIXME: hardcoded -- note also that we can't rely on variable expansion to resolve paths in env.nu
1214
userConfigDir = "~/.config/dotfield/users/${username}/config/nushell";
1315

1416
/*
17+
@partial
1518
replaceVars :: [String] -> (String -> String)
1619
*/
1720
replaceVars = names:
1821
l.replaceStrings
1922
(l.map (v: "$" + v) names)
2023
(l.map (v: "$env.${v}") names);
2124

25+
/*
26+
replaceVars' :: String -> String
27+
*/
28+
replaceVars' = replaceVars commonNames;
29+
2230
commonNames = [
2331
"HOME"
2432
"EDITOR"
@@ -37,7 +45,7 @@
3745
lib.concatStringsSep "\n"
3846
(lib.mapAttrsToList
3947
(name: value: let
40-
value' = replaceVars commonNames value;
48+
value' = replaceVars' value;
4149
in "$env.${name} = `${value'}`")
4250
attrs);
4351
in {
@@ -63,4 +71,14 @@ in {
6371
xdg.configFile."nushell/home.nu".source = pkgs.writeText "home.nu" ''
6472
${attrsToEnvDecls sessionVariables}
6573
'';
74+
75+
# FIXME: needs PR to upstream `exa` module for fix to use
76+
# `home.shellAliases`, not shell-specific options
77+
home.shellAliases = lib.mkIf (exaCfg.enable && exaCfg.enableAliases) {
78+
ls = "exa";
79+
ll = "exa -l";
80+
la = "exa -a";
81+
lt = "exa --tree";
82+
lla = "exa -la";
83+
};
6684
}

0 commit comments

Comments
 (0)