base: move some shared configuration to shared
This commit is contained in:
parent
6fe9af56e7
commit
fe306085f4
11 changed files with 273 additions and 227 deletions
75
modules/shared/base/zsh/default.nix
Normal file
75
modules/shared/base/zsh/default.nix
Normal file
|
@ -0,0 +1,75 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
username = config.chvp.username;
|
||||
base = (home: {
|
||||
home.packages = [ pkgs.autojump ];
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
autosuggestion.enable = true;
|
||||
syntaxHighlighting.enable = true;
|
||||
autocd = true;
|
||||
dotDir = ".config/zsh";
|
||||
history = {
|
||||
expireDuplicatesFirst = true;
|
||||
path = "${config.chvp.cachePrefix}${home}/.local/share/zsh/history";
|
||||
};
|
||||
initExtra = ''
|
||||
nshell() {
|
||||
local -a drvs
|
||||
for attr in "$@"; do
|
||||
drvs+=(nixpkgs#$attr)
|
||||
done
|
||||
local paths="$(nix build --no-link --print-out-paths $drvs)"
|
||||
for p in $paths; do
|
||||
export PATH="$p/bin:$PATH"
|
||||
done
|
||||
}
|
||||
|
||||
nrun() {
|
||||
local drv="$1"
|
||||
shift 1
|
||||
nix run nixpkgs#$drv $@
|
||||
}
|
||||
|
||||
nsrun() {
|
||||
local drv="$1"
|
||||
shift 1
|
||||
nix shell nixpkgs#$drv -c $@
|
||||
}
|
||||
'';
|
||||
shellAliases = {
|
||||
gupd = "gfa && gprom";
|
||||
};
|
||||
sessionVariables = { DEFAULT_USER = "charlotte"; };
|
||||
oh-my-zsh = {
|
||||
enable = true;
|
||||
plugins = [
|
||||
"autojump"
|
||||
"common-aliases"
|
||||
"extract"
|
||||
"history-substring-search"
|
||||
"git"
|
||||
"systemd"
|
||||
"tmux"
|
||||
];
|
||||
theme = "robbyrussell";
|
||||
};
|
||||
};
|
||||
});
|
||||
in
|
||||
{
|
||||
options.chvp.base.zsh.usersToConfigure = lib.mkOption {
|
||||
default = [ username ];
|
||||
};
|
||||
|
||||
config = {
|
||||
programs.zsh.enable = true;
|
||||
} // {
|
||||
home-manager.users = builtins.foldl' (a: b: a // b) { } (
|
||||
builtins.map
|
||||
(name: { "${name}" = { ... }: (base config.users.users.${name}.home); })
|
||||
config.chvp.base.zsh.usersToConfigure
|
||||
);
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue