1
Fork 0
mirror of https://github.com/RGBCube/ncc synced 2025-07-28 02:27: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 { 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; package = pkgs.nushell;
in { in {
@ -7,11 +7,6 @@ in {
home-manager.sharedModules = [(homeArgs: let home-manager.sharedModules = [(homeArgs: let
config' = homeArgs.config; config' = homeArgs.config;
in {
programs.nushell = enabled {
inherit package;
configFile.text = readFile ./config.nu;
environmentVariables = let environmentVariables = let
variablesMap = { variablesMap = {
@ -34,9 +29,6 @@ in {
homeVariables = config'.home.sessionVariables; homeVariables = config'.home.sessionVariables;
homeSearchVariables = config'.home.sessionSearchVariables
|> mapAttrs (const <| concatStringsSep ":");
homeVariablesExtra = pkgs.runCommand "home-variables-extra.env" {} '' homeVariablesExtra = pkgs.runCommand "home-variables-extra.env" {} ''
bash -ic ' bash -ic '
${variablesMap ${variablesMap
@ -53,15 +45,23 @@ in {
|> map (match "([^=]+)=(.*)") |> map (match "([^=]+)=(.*)")
|> map (keyAndValue: nameValuePair (head keyAndValue) (last keyAndValue)) |> map (keyAndValue: nameValuePair (head keyAndValue) (last keyAndValue))
|> foldl' (x: y: x // y) {}; |> foldl' (x: y: x // y) {};
homeSearchVariables = config'.home.sessionSearchVariables
|> mapAttrs (const <| concatStringsSep ":");
in environmentVariables in environmentVariables
// homeVariables // homeVariables
// homeSearchVariables
// homeVariablesExtra // 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" ] // { configFile.text = readFile ./config.nu;
cdtmp = "cd (mktemp --directory)";
}; inherit (config.environment) shellAliases;
inherit environmentVariables;
}; };
})]; })];
} }