minimise nesting in /home

This commit is contained in:
xunuwu 2025-06-06 12:58:39 +02:00
parent caa2a3d7c5
commit 383d9f878e
Signed by: xun
SSH key fingerprint: SHA256:Uot/1WoAjWAeqLOHA5vYy4phhVydsH7jCPmBjaPZfgI
37 changed files with 40 additions and 45 deletions

12
home/cli/comma.nix Normal file
View file

@ -0,0 +1,12 @@
{inputs, ...}: {
imports = [inputs.nix-index-database.hmModules.nix-index];
programs = {
nix-index-database.comma.enable = true;
nix-index = {
enableBashIntegration = false;
enableFishIntegration = false;
enableZshIntegration = false;
};
};
}

7
home/cli/direnv.nix Normal file
View file

@ -0,0 +1,7 @@
{
programs.direnv = {
enable = true;
enableZshIntegration = true;
nix-direnv.enable = true;
};
}

8
home/cli/fish.nix Normal file
View file

@ -0,0 +1,8 @@
{
programs.fish = {
enable = true;
interactiveShellInit = ''
set fish_greeting
'';
};
}

28
home/cli/git.nix Normal file
View file

@ -0,0 +1,28 @@
{
config,
pkgs,
...
}: {
programs.git = {
enable = true;
delta.enable = true;
lfs.enable = true;
ignores = ["*~" ".direnv"];
signing = {
key = "${config.home.homeDirectory}/.ssh/id_ed25519";
signByDefault = true;
};
extraConfig = {
gpg.format = "ssh";
push.autoSetupRemote = true;
pull.rebase = true;
rebase.autostash = true;
};
userEmail = "xunuwu@gmail.com";
userName = "xunuwu";
};
}

4
home/cli/github.nix Normal file
View file

@ -0,0 +1,4 @@
{
programs.gh.enable = true;
programs.gh-dash.enable = true;
}

22
home/cli/irssi.nix Normal file
View file

@ -0,0 +1,22 @@
{pkgs, ...}: {
programs.irssi = {
enable = true;
networks = {
liberachat = {
nick = "wheat";
server = {
address = "irc.libera.chat";
port = 6697;
autoConnect = true;
};
channels = {
nixos.autoJoin = false;
};
};
};
};
home.file.".irssi/default.theme".source = pkgs.fetchurl {
url = "https://irssi-import.github.io/themes/h3rbz.theme";
hash = "sha256-2nB+jvDXPgkMXTd6f305R2aBt/D4kbsIGbqcIllHADo=";
};
}

16
home/cli/jujutsu.nix Normal file
View file

@ -0,0 +1,16 @@
{config, ...}: {
programs.jujutsu = {
enable = true;
settings = {
user = {
email = config.programs.git.userEmail;
name = config.programs.git.userName;
};
signing = {
behavior = "own";
backend = "ssh";
key = config.programs.git.signing.key;
};
};
};
}

24
home/cli/tmux.nix Normal file
View file

@ -0,0 +1,24 @@
{
programs.tmux = {
enable = true;
baseIndex = 1;
clock24 = true;
mouse = true;
escapeTime = 0;
extraConfig = ''
bind '"' split-window -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"
bind c new-window -c "#{pane_current_path}";
set -g status-style bg=default
setw -g window-status-current-style fg=#be95ff
set -g status-justify absolute-centre
set -g status-interval 5
set -g status-right "#[fg=#25be6a]#(free -h | awk 'NR==2{print $3\"/\"$2}')"
set -ag status-right "#[fg=default] %a %d %b %H:%M"
set-option -g default-terminal "xterm-256color"
set-option -ga terminal-overrides ",xterm-256color:Tc"
'';
};
}

29
home/cli/xdg.nix Normal file
View file

@ -0,0 +1,29 @@
# TODO: move this somewhere more reasonable
{
config,
pkgs,
...
}: let
home = config.home.homeDirectory;
in {
xdg = {
enable = true;
cacheHome = config.home.homeDirectory + "/.local/cache";
userDirs = {
enable = true;
desktop = home + "/desktop";
documents = home + "/docs";
download = home + "/down";
music = home + "/music";
pictures = home + "/pics";
publicShare = home + "/share";
videos = home + "/vids";
extraConfig = {
XDG_SCREENSHOTS_DIR = config.xdg.userDirs.pictures + "/screenshots";
};
};
};
home.packages = [pkgs.xdg-utils];
}

77
home/cli/zsh.nix Normal file
View file

@ -0,0 +1,77 @@
{config, ...}: {
programs.fzf.enable = true;
programs.zsh = {
enable = true;
autocd = true;
enableCompletion = true;
autosuggestion.enable = true;
dotDir = ".config/zsh";
defaultKeymap = "emacs";
history = {
expireDuplicatesFirst = true;
extended = true;
save = 100 * 1000;
path = "${config.xdg.dataHome}/zsh_history";
};
initContent = ''
unsetopt beep
## KEYBINDS ##
bindkey "^[[1;5D" backward-word
bindkey "^[[1;5C" forward-word
# improve ^w behaviour
WORDCHARS=
# pretty completion menu
zstyle ':completion:*' menu select
# shift-tab in completion menu
bindkey '^[[Z' reverse-menu-complete
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}' # Case insensitive completion
## MISC ##
setopt extendedglob
# Show completion categories
zstyle ':completion:*:*:*:*:descriptions' format '%F{magenta}<-%d->%f'
## PROMPT ##
function preexec() {
timer=$(date +%s%3N)
}
function precmd_timer() {
if [ $timer ]; then
now=$(date +%s%3N)
elapsed=$(($now-$timer))
if [[ elapsed -gt 100 ]]; then
export RPROMPT="%F{cyan}''${elapsed}ms %f"
else
unset RPROMPT
fi
unset timer
fi
}
autoload -Uz vcs_info
precmd_vcs_info() {
vcs_info
export vcs_info_msg_0_="''${vcs_info_msg_0_:0:20}''${vcs_info_msg_0_[21]:+...}" # truncate the branch name
}
precmd_functions+=( precmd_vcs_info precmd_timer )
zstyle ':vcs_info:git:*' formats ' %b '
setopt prompt_subst
PROMPT='%F{blue}[%F{magenta}%n%F{blue}@%F{magenta}%M%F{blue}] %~%f %F{green}''${vcs_info_msg_0_}%f%(?..%F{red}| %? )%#%f '
'';
};
}