1
Fork 0
mirror of https://github.com/RGBCube/ncc synced 2025-07-27 18:17:44 +00:00

nushell: cleanup

This commit is contained in:
RGBCube 2025-07-19 21:09:15 +03:00
parent b12e780bb1
commit 6f368a10c3
Signed by: RGBCube
SSH key fingerprint: SHA256:CzqbPcfwt+GxFYNnFVCqoN5Itn4YFrshg1TrnACpA5M

View file

@ -1,5 +1,5 @@
{ config, lib, pkgs, ... }: let
inherit (lib) attrNames attrValues concatStringsSep const enabled filter flatten foldl' head last listToAttrs mapAttrs mapAttrsToList match nameValuePair readFile removeAttrs replaceStrings splitString;
inherit (lib) attrNames attrValues concatStringsSep const enabled filter filterAttrs flatten foldl' head last listToAttrs mapAttrs mapAttrsToList match nameValuePair readFile replaceStrings splitString;
package = pkgs.nushell;
in {
@ -7,11 +7,6 @@ in {
home-manager.sharedModules = [(homeArgs: let
config' = homeArgs.config;
in {
programs.nushell = enabled {
inherit package;
configFile.text = readFile ./config.nu;
environmentVariables = let
variablesMap = {
@ -34,9 +29,6 @@ in {
homeVariables = config'.home.sessionVariables;
homeSearchVariables = config'.home.sessionSearchVariables
|> mapAttrs (const <| concatStringsSep ":");
homeVariablesExtra = pkgs.runCommand "home-variables-extra.env" {} ''
bash -ic '
${variablesMap
@ -53,15 +45,23 @@ in {
|> map (match "([^=]+)=(.*)")
|> map (keyAndValue: nameValuePair (head keyAndValue) (last keyAndValue))
|> foldl' (x: y: x // y) {};
homeSearchVariables = config'.home.sessionSearchVariables
|> mapAttrs (const <| concatStringsSep ":");
in environmentVariables
// homeVariables
// homeSearchVariables
// homeVariablesExtra
|> mapAttrs (const <| replaceStrings (attrNames variablesMap) (attrValues variablesMap));
// homeSearchVariables
|> mapAttrs (const <| replaceStrings (attrNames variablesMap) (attrValues variablesMap))
|> filterAttrs (name: const <| name != "TERM");
in {
programs.nushell = enabled {
inherit package;
shellAliases = removeAttrs config.environment.shellAliases [ "ls" "l" ] // {
cdtmp = "cd (mktemp --directory)";
};
configFile.text = readFile ./config.nu;
inherit (config.environment) shellAliases;
inherit environmentVariables;
};
})];
}