Add options.my.setup & append aliases to extra.zshrc

This commit is contained in:
Henrik Lissner 2020-01-12 19:46:39 -05:00
parent 110f74396a
commit db5c77001f
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -49,6 +49,12 @@ with lib;
description = "..."; description = "...";
}; };
setup = mkOption {
type = types.lines;
default = "";
description = "...";
};
zsh = { zsh = {
rc = mkOption { rc = mkOption {
type = types.lines; type = types.lines;
@ -70,7 +76,6 @@ with lib;
my.user.packages = config.my.packages; my.user.packages = config.my.packages;
my.env.PATH = [ "$PATH" ]; my.env.PATH = [ "$PATH" ];
environment.shellAliases = config.my.alias;
environment.extraInit = environment.extraInit =
let exportLines = mapAttrsToList (n: v: "export ${n}=\"${v}\"") config.my.env; let exportLines = mapAttrsToList (n: v: "export ${n}=\"${v}\"") config.my.env;
in '' in ''
@ -78,7 +83,14 @@ with lib;
${config.my.init} ${config.my.init}
''; '';
my.home.xdg.configFile."zsh/extra.zshrc".text = config.my.zsh.rc; my.home.xdg.configFile."zsh/extra.zshrc".text =
let aliasLines = mapAttrsToList (n: v: "alias ${n}=\"${v}\"") config.my.alias;
in ''
${concatStringsSep "\n" aliasLines}
${config.my.zsh.rc}
'';
my.home.xdg.configFile."zsh/extra.zshenv".text = config.my.zsh.env; my.home.xdg.configFile."zsh/extra.zshenv".text = config.my.zsh.env;
system.userActivationScripts.mySetup = config.my.setup;
}; };
} }