1
Fork 0
mirror of https://github.com/RGBCube/ncc synced 2025-07-28 10:37:44 +00:00

nushell: import home variables properly

This commit is contained in:
RGBCube 2025-07-19 20:05:30 +03:00
parent cdf2edfa69
commit f03a18219e
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 flatten getExe listToAttrs mapAttrs mapAttrsToList mkIf optionalAttrs readFile removeAttrs replaceStrings; inherit (lib) attrNames attrValues concatStringsSep const enabled filter flatten foldl' getExe head last listToAttrs mapAttrs mapAttrsToList match mkIf nameValuePair optionalAttrs readFile removeAttrs replaceStrings splitString;
in { in {
environment = optionalAttrs config.isLinux { environment = optionalAttrs config.isLinux {
sessionVariables.SHELLS = getExe pkgs.nushell; sessionVariables.SHELLS = getExe pkgs.nushell;
@ -83,20 +83,18 @@ in {
homeSearchVariables = config'.home.sessionSearchVariables homeSearchVariables = config'.home.sessionSearchVariables
|> mapAttrs (const <| concatStringsSep ":"); |> mapAttrs (const <| concatStringsSep ":");
# homeVariablesExtra = pkgs.runCommand "home-variables-extra.env" {} '' homeVariablesExtra = pkgs.runCommand "home-variables-extra.env" {} ''
# alias export=echo bash -ic '
# # echo foo > $out alias export=echo
# # FIXME source ${config'.home.sessionVariablesPackage}/etc/profile.d/hm-session-vars.sh
# eval $(cat ${config'.home.sessionVariablesPackage}/etc/profile.d/hm-session-vars.sh) > $out ' > $out
# '' ''
# # |> (aaa: (_: break _) aaa) |> readFile
# |> readFile |> splitString "\n"
# |> splitString "\n" |> filter (s: s != "")
# |> filter (s: s != "") |> map (match "([^=]+)=(.*)")
# |> map (match "([^=]+)=(.*)") |> map (keyAndValue: nameValuePair (head keyAndValue) (last keyAndValue))
# |> map (keyAndValue: nameValuePair (first keyAndValue) (last keyAndValue)) |> foldl' (x: y: x // y) {};
# |> foldl' (x: y: x // y) {};
homeVariablesExtra = {};
in environmentVariables in environmentVariables
// homeVariables // homeVariables
// homeSearchVariables // homeSearchVariables