some refactoring

This commit is contained in:
cnst
2024-10-19 11:09:45 +02:00
parent 946125fb09
commit 2cbe3a0ff9
15 changed files with 204 additions and 26 deletions

View File

@@ -13,11 +13,14 @@
./home/gaming/steam
./home/terminal/alacritty
./home/terminal/foot
./home/terminal/kitty
./home/terminal/wezterm
./home/terminal/zellij
./home/cli/alacritty
./home/cli/bash
./home/cli/foot
./home/cli/jujutsu
./home/cli/kitty
./home/cli/wezterm
./home/cli/zellij
./home/cli/zsh
./home/userd/blueman-applet
./home/userd/copyq

View File

@@ -4,10 +4,10 @@
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.home.terminal.alacritty;
cfg = config.home.cli.alacritty;
in {
options = {
home.terminal.alacritty.enable = mkEnableOption "Enables firefox";
home.cli.alacritty.enable = mkEnableOption "Enables firefox";
};
config = mkIf cfg.enable {
programs.alacritty = {

View File

@@ -0,0 +1,17 @@
{
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.home.cli.bash;
in {
options = {
home.cli.bash.enable = mkEnableOption "Enables bash";
};
config = mkIf cfg.enable {
programs.bash = {
enable = true;
};
};
}

View File

@@ -5,10 +5,10 @@
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.home.terminal.foot;
cfg = config.home.cli.foot;
in {
options = {
home.terminal.foot.enable = mkEnableOption "Enables foot terminal";
home.cli.foot.enable = mkEnableOption "Enables foot cli";
};
config = mkIf cfg.enable {
programs.foot = {
@@ -162,7 +162,7 @@ in {
# font-increase=Control+plus Control+equal Control+KP_Add
# font-decrease=Control+minus Control+KP_Subtract
# font-reset=Control+0 Control+KP_0
# spawn-terminal=Control+Shift+n
# spawn-cli=Control+Shift+n
# minimize=none
# maximize=none
# fullscreen=none

View File

@@ -0,0 +1,53 @@
{
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.home.cli.jujutsu;
in {
options = {
home.cli.jujutsu.enable = mkEnableOption "Enables jujutsu";
};
config = mkIf cfg.enable {
programs.jujutsu = {
enable = true;
settings = {
user = {
name = config.programs.git.userName;
email = config.programs.git.userEmail;
};
# ui = {
# diff-editor = lib.mkIf config.programs.neovim.enable [
# "nvim"
# "-c"
# "DiffEditor $left $right $output"
# ];
# pager = "less -FRX";
# };
# signing = let
# gitCfg = config.programs.git.extraConfig;
# in {
# backend = "gpg";
# sign-all = gitCfg.commit.gpgSign;
# key = gitCfg.user.signing.key;
# };
templates = {
draft_commit_description = ''
concat(
description,
indent("JJ: ", concat(
"\n",
"Change summary:\n",
indent(" ", diff.summary()),
"\n",
"Full change:\n",
indent(" ", diff.git()),
)),
)
'';
};
};
};
};
}

View File

@@ -4,10 +4,10 @@
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.home.terminal.kitty;
cfg = config.home.cli.kitty;
in {
options = {
home.terminal.kitty.enable = mkEnableOption "Enables kitty terminal";
home.cli.kitty.enable = mkEnableOption "Enables kitty cli";
};
config = mkIf cfg.enable {
programs.kitty = {

View File

@@ -9,10 +9,10 @@
weztermPkg = pkgs.wezterm;
# weztermFlake = inputs.wezterm.packages.${pkgs.system}.default;
inherit (lib) mkIf mkEnableOption;
cfg = config.home.terminal.wezterm;
cfg = config.home.cli.wezterm;
in {
options = {
home.terminal.wezterm.enable = mkEnableOption "Enables wezterm terminal";
home.cli.wezterm.enable = mkEnableOption "Enables wezterm cli";
};
config = mkIf cfg.enable {
programs.wezterm = {

View File

@@ -4,10 +4,10 @@
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.home.terminal.zellij;
cfg = config.home.cli.zellij;
in {
options = {
home.terminal.zellij.enable = mkEnableOption "Enables zellij";
home.cli.zellij.enable = mkEnableOption "Enables zellij";
};
config = mkIf cfg.enable {
programs.zellij = {

View File

@@ -0,0 +1,96 @@
{
config,
lib,
pkgs,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.home.cli.zsh;
inherit (lib.meta) getExe;
inherit (pkgs) eza bat;
in {
options = {
home.cli.zsh.enable = mkEnableOption "Enables zsh home configuration";
};
config = mkIf cfg.enable {
programs.zsh = {
enable = true;
dotDir = ".config/zsh";
enableCompletion = true;
autosuggestion.enable = true;
syntaxHighlighting.enable = true;
shellAliases = {
cat = "${getExe bat} --style=plain";
ls = "${getExe eza} -h --git --icons --color=auto --group-directories-first -s extension";
la = "${getExe eza} -lah --tree";
tree = "${getExe eza} --tree --icons=always";
extract = "extract.sh";
usermodules = "$EDITOR /home/$USER/.nix-config/users/$USER/modules.nix";
umod = "$EDITOR /home/$USER/.nix-config/users/$USER/modules.nix";
systemmodules = "$EDITOR /home/$USER/.nix-config/hosts/$HOST/modules.nix";
smod = "$EDITOR /home/$USER/.nix-config/hosts/$HOST/modules.nix";
nixcleanboot = "sudo nix run /home/$USER/.nix-config#cleanup-boot";
nixclean = "nh clean all --keep 3";
nixdev = "nix develop ~/.nix-config -c $SHELL";
nixconfig = "cd /home/$USER/.nix-config/";
ll = "ls -l";
nixupdate = "nh os switch -v -H $HOST";
nixup = "nh os switch -H $HOST";
flakeupdate = "nh os switch -u -v -H $HOST";
flakeup = "nh os switch -u -H $HOST";
".." = "cd ..";
"..." = "cd ../../";
"...." = "cd ../../../";
"....." = "cd ../../../../";
"......" = "cd ../../../../../";
};
history = {
size = 1000;
path = "${config.xdg.dataHome}/zsh/history";
};
oh-my-zsh = {
enable = true;
plugins = [
"git"
];
theme = "robbyrussell";
};
profileExtra = ''
export PATH="$HOME/.local/bin:$PATH"
'';
initExtraFirst = ''
autoload -U colors && colors
'';
initExtra = ''
ZSH_THEME_GIT_PROMPT_PREFIX="%F{143}(%F{167}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%f "
ZSH_THEME_GIT_PROMPT_DIRTY="%F{143}) %F{202}%1{%}"
ZSH_THEME_GIT_PROMPT_CLEAN="%F{143})"
ZSH_THEME_RUBY_PROMPT_PREFIX="%F{167}"
ZSH_THEME_RUBY_PROMPT_SUFFIX="%f"
# Check if we're in a nix-shell or nix develop environment
if [[ -n "$IN_NIX_SHELL" ]]; then
PROMPT='%F{red}DEV%f%F{143}%~%f $(git_prompt_info)$(virtualenv_prompt_info)
%F{143}$ '
else
PROMPT='%F{143}%~%f $(git_prompt_info)$(virtualenv_prompt_info)
%F{143}$ '
fi
RPROMPT='$(ruby_prompt_info)'
VIRTUAL_ENV_DISABLE_PROMPT=0
ZSH_THEME_VIRTUAL_ENV_PROMPT_PREFIX=" %F{66}🐍 "
ZSH_THEME_VIRTUAL_ENV_PROMPT_SUFFIX="%f"
ZSH_THEME_VIRTUALENV_PREFIX=$ZSH_THEME_VIRTUAL_ENV_PROMPT_PREFIX
ZSH_THEME_VIRTUALENV_SUFFIX=$ZSH_THEME_VIRTUAL_ENV_PROMPT_SUFFIX
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=241'
microfetch
'';
};
};
}

View File

@@ -7,7 +7,7 @@
cfg = config.system.utils.zsh;
in {
options = {
system.utils.zsh.enable = mkEnableOption "Enables android tools";
system.utils.zsh.enable = mkEnableOption "Enables zsh shell";
};
config = mkIf cfg.enable {
programs.zsh.enable = cfg.enable;