mirror of
https://github.com/RGBCube/ncc
synced 2025-07-28 10:37:44 +00:00
nushell: fix global profile importing
This commit is contained in:
parent
b5351ab1f9
commit
cdf2edfa69
1 changed files with 27 additions and 4 deletions
|
@ -1,5 +1,5 @@
|
|||
{ config, lib, pkgs, ... }: let
|
||||
inherit (lib) attrValues const enabled getExe mapAttrs mkIf optionalAttrs readFile removeAttrs replaceString;
|
||||
inherit (lib) attrNames attrValues concatStringsSep const enabled flatten getExe listToAttrs mapAttrs mapAttrsToList mkIf optionalAttrs readFile removeAttrs replaceStrings;
|
||||
in {
|
||||
environment = optionalAttrs config.isLinux {
|
||||
sessionVariables.SHELLS = getExe pkgs.nushell;
|
||||
|
@ -60,9 +60,29 @@ in {
|
|||
'';
|
||||
|
||||
environmentVariables = let
|
||||
variablesMap = {
|
||||
HOME = config'.home.homeDirectory;
|
||||
USER = config'.home.username;
|
||||
|
||||
XDG_CACHE_HOME = config'.xdg.cacheHome;
|
||||
XDG_CONFIG_HOME = config'.xdg.configHome;
|
||||
XDG_DATA_HOME = config'.xdg.dataHome;
|
||||
XDG_STATE_HOME = config'.xdg.stateHome;
|
||||
}
|
||||
|> mapAttrsToList (name: value: [
|
||||
{ name = "\$${name}"; inherit value; }
|
||||
{ name = "\${${name}}"; inherit value; }
|
||||
])
|
||||
|> flatten
|
||||
|> listToAttrs;
|
||||
|
||||
environmentVariables = config.environment.variables;
|
||||
|
||||
homeVariables = config'.home.sessionVariables;
|
||||
homeVariables = config'.home.sessionVariables;
|
||||
|
||||
homeSearchVariables = config'.home.sessionSearchVariables
|
||||
|> mapAttrs (const <| concatStringsSep ":");
|
||||
|
||||
# homeVariablesExtra = pkgs.runCommand "home-variables-extra.env" {} ''
|
||||
# alias export=echo
|
||||
# # echo foo > $out
|
||||
|
@ -77,8 +97,11 @@ in {
|
|||
# |> map (keyAndValue: nameValuePair (first keyAndValue) (last keyAndValue))
|
||||
# |> foldl' (x: y: x // y) {};
|
||||
homeVariablesExtra = {};
|
||||
in environmentVariables // homeVariables // homeVariablesExtra
|
||||
|> mapAttrs (const <| replaceString "$HOME" config'.home.homeDirectory);
|
||||
in environmentVariables
|
||||
// homeVariables
|
||||
// homeSearchVariables
|
||||
// homeVariablesExtra
|
||||
|> mapAttrs (const <| replaceStrings (attrNames variablesMap) (attrValues variablesMap));
|
||||
|
||||
shellAliases = removeAttrs config.environment.shellAliases [ "ls" "l" ] // {
|
||||
cdtmp = "cd (mktemp --directory)";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue