Unified home and system modules!

This commit is contained in:
marc
2022-11-19 11:58:21 +01:00
parent cfcc374a69
commit 890b05d352
45 changed files with 389 additions and 566 deletions

22
modules/shell/utils.nix Normal file
View File

@@ -0,0 +1,22 @@
{ config, lib, pkgs, ... }:
let
cfg = config.samfelag.modules.shell.utils;
in
{
options.samfelag.modules.shell.utils = {
enable = lib.mkEnableOption "Basic shell utils";
};
config = lib.mkIf cfg.enable {
environment.systemPackages = with pkgs; [
bat
exa
fd
fzf
jq
ripgrep
tldr
];
hm.xdg.configFile."shell".source = ../../config/.config/shell;
};
}

68
modules/shell/zsh.nix Normal file
View File

@@ -0,0 +1,68 @@
{ config, lib, pkgs, ... }:
let
cfg = config.samfelag.modules.shell.zsh;
in
{
options.samfelag.modules.shell.zsh = {
enable = lib.mkEnableOption "zsh";
};
config = lib.mkIf cfg.enable {
environment.systemPackages = with pkgs; [
zsh
zsh-powerlevel10k
(nerdfonts.override { fonts = [ "Iosevka" ]; })
];
hm.programs.zsh = {
enable = true;
dotDir = ".config/zsh";
enableAutosuggestions = true;
enableCompletion = true;
enableSyntaxHighlighting = true;
initExtra = ''
# Source generic (bash) configuration
if [ -d $HOME/.config/shell/sh ]; then
for rc in $HOME/.config/shell/sh/*.sh; do
emulate bash -c ". $rc"
done
fi
# Source zsh specific configuration
if [[ -d $HOME/.config/shell/zsh ]]; then
for rc in $HOME/.config/shell/zsh/*.zsh; do
source $rc
done
fi
'';
initExtraBeforeCompInit = ''
# p10k instant prompt
P10K_INSTANT_PROMPT="$XDG_CACHE_HOME/p10k-instant-prompt-''${(%):-%n}.zsh"
[[ ! -r "$P10K_INSTANT_PROMPT" ]] || source "$P10K_INSTANT_PROMPT"
'';
oh-my-zsh = {
enable = true;
plugins = [
"git"
# "zsh-vi-mode"
];
};
plugins = [
{
file = "powerlevel10k.zsh-theme";
name = "powerlevel10k";
src = "${pkgs.zsh-powerlevel10k}/share/zsh-powerlevel10k";
}
];
};
hm.xdg.configFile."zsh/.p10k.zsh".source = ../../config/.config/zsh/.p10k.zsh;
};
}