Move modules inside /nixos

This commit is contained in:
2025-01-19 00:04:10 +00:00
parent 404e747037
commit b00cd5c2b3
58 changed files with 0 additions and 0 deletions

View File

@ -0,0 +1,39 @@
{ config, lib, pkgs, ... }:
let cfg = config.modules.shell.git;
in {
options.modules.shell.git = {
enable = lib.mkOption {
default = false;
example = true;
};
};
config = lib.mkIf cfg.enable {
home.programs.git = {
enable = true;
aliases = {
amend = "commit --amend";
lg = "log --color --graph --abbrev-commit --";
ls = "ls-files";
unadd = "reset HEAD";
undo-commit = "reset --soft \"HEAD^\"";
};
userEmail = "jordan@vimium.com";
userName = "Jordan Holt";
signing = {
key = "B8CFFF61F1CCF520";
signByDefault = true;
};
extraConfig = {
rebase.autosquash = true;
push.default = "current";
pull.rebase = true;
};
};
home.configFile = {
"git/ignore".source = ./ignore;
};
};
}

View File

@ -0,0 +1,24 @@
# CMake
cmake-build-*/
# Linux trash folder
.Trash-*
# Swap
[._]*.s[a-v][a-z]
[._]*.sw[a-p]
[._]s[a-rt-v][a-z]
[._]ss[a-gi-z]
[._]sw[a-p]
# Session
Session.vim
Sessionx.vim
# Temporary
.netrwhist
*~
# Auto-generated tag files
tags
# Persistent undo
[._]*.un~

View File

@ -0,0 +1,34 @@
source $ZDOTDIR/config.zsh
if [ ! -d "$ZGEN_DIR" ]; then
echo "Installing jandamm/zgenom"
git clone https://github.com/jandamm/zgenom "$ZGEN_DIR"
fi
source $ZGEN_DIR/zgenom.zsh
zgenom autoupdate
if ! zgenom saved; then
echo "Initializing zgenom"
rm -f $ZDOTDIR/*.zwc(N) \
$XDG_CACHE_HOME/zsh/*(N) \
$ZGEN_INIT.zwc
zgenom load junegunn/fzf shell
zgenom load zdharma-continuum/fast-syntax-highlighting
zgenom load zsh-users/zsh-completions src
zgenom load zsh-users/zsh-history-substring-search
zgenom load softmoth/zsh-vim-mode
zgenom save
zgenom compile $ZDOTDIR
fi
## Bootstrap interactive sessions
if [[ $TERM != dumb ]]; then
autoload -Uz compinit && compinit -u -d $ZSH_CACHE/zcompdump
source $ZDOTDIR/keybinds.zsh
source $ZDOTDIR/completion.zsh
source $ZDOTDIR/aliases.zsh
fi

View File

@ -0,0 +1,25 @@
#!/bin/sh
# Verbose file operations
alias \
cp="cp -iv" \
mv="mv -iv" \
rm="rm -v" \
mkdir="mkdir -v"
# Colorize commands
alias \
ls="ls -h --color=auto --group-directories-first"
# Abbreviations
alias \
e="$EDITOR" \
f="$FILE" \
g="git" \
m="neomutt" \
n="$FILE" \
v="$EDITOR"
# XDG fixes
alias \
mbsync="mbsync -c $XDG_CONFIG_HOME/isync/mbsyncrc -a"

View File

@ -0,0 +1,6 @@
fpath+=( $ZDOTDIR/completions )
# Don't offer history completion; we have fzf, C-r, and
# zsh-history-substring-search for that.
ZSH_AUTOSUGGEST_STRATEGY=(completion)
ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE=30

View File

@ -0,0 +1,99 @@
####
## zsh configuration
####
## Colors
autoload -U colors && colors
## Completion
setopt HASH_LIST_ALL
unsetopt AUTO_NAME_DIRS
autoload -Uz compinit
zstyle ':completion:*' menu select
zmodload zsh/complist
compinit
_comp_options+=(globdots) # Include hidden files
## Directories
setopt AUTO_PUSHD
setopt CDABLE_VARS
setopt PUSHD_IGNORE_DUPS
setopt PUSHD_SILENT
setopt PUSHD_TO_HOME
unsetopt AUTO_CD
## Expansion and globbing
setopt EXTENDED_GLOB
unsetopt GLOB_DOTS
unsetopt NOMATCH
## History
HISTFILE="${XDG_DATA_HOME:-${HOME}/.local/share}/zsh/history"
HISTSIZE=1000000
SAVEHIST=1000000
[[ !( -f "${HISTFILE}" ) ]] && mkdir -p $(dirname ${HISTFILE})
setopt APPEND_HISTORY
setopt BANG_HIST
setopt EXTENDED_HISTORY
setopt HIST_IGNORE_ALL_DUPS
setopt HIST_IGNORE_DUPS
setopt HIST_IGNORE_SPACE
setopt HIST_SAVE_NO_DUPS
setopt HIST_VERIFY
setopt INC_APPEND_HISTORY_TIME
setopt SHARE_HISTORY
## I/O
setopt INTERACTIVE_COMMENTS
setopt MULTIOS
unsetopt CLOBBER
## Jobs
setopt LONG_LIST_JOBS
setopt AUTO_RESUME
unsetopt BG_NICE
unsetopt NOTIFY
unsetopt HUP
unsetopt CHECK_JOBS
## Shell emulation
setopt APPEND_CREATE
## Prompt
PS1="%B%{$fg[magenta]%}%~%{$reset_color%} $%b "
## Window title
precmd () { print -Pn "\e]0;%n@%m: %~\a" }
preexec () { print -Pn "\e]0;%n@%m: $1\a" }
## Vi mode
bindkey -v
export KEYTIMEOUT=1
## Zsh line editor
unsetopt BEEP
####
## Plugins
####
export ZGEN_AUTOLOAD_COMPINIT=0
# zsh-vim-mode
export MODE_INDICATOR=""
export MODE_CURSOR_VIINS="#b77ee0 blinking bar"
export MODE_CURSOR_REPLACE="$MODE_CURSOR_VIINS #ff3334"
export MODE_CURSOR_VICMD="#b77ee0 block"
export MODE_CURSOR_SEARCH="#e7c547 steady underline"
export MODE_CURSOR_VISUAL="$MODE_CURSOR_VICMD steady bar"
export MODE_CURSOR_VLINE="$MODE_CURSOR_VISUAL #54ced6"
# fzf
if (( $+commands[fd] )); then
export FZF_DEFAULT_OPTS="--reverse --ansi"
export FZF_DEFAULT_COMMAND="fd ."
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
export FZF_ALT_C_COMMAND="fd -t d . $HOME"
fi

View File

@ -0,0 +1,53 @@
{ config, lib, pkgs, ... }:
let cfg = config.modules.shell.zsh;
in {
options.modules.shell.zsh = {
enable = lib.mkOption {
default = false;
example = true;
};
};
config = lib.mkIf cfg.enable {
users.defaultUserShell = pkgs.zsh;
programs.zsh = {
enable = true;
enableCompletion = true;
enableGlobalCompInit = false;
promptInit = "";
};
user.packages = with pkgs; [
fd
unstable.fzf
jq
nix-zsh-completions
nnn
ripgrep
zsh
];
env = {
ZDOTDIR = "$XDG_CONFIG_HOME/zsh";
ZSH_CACHE = "$XDG_CACHE_HOME/zsh";
ZGEN_DIR = "$XDG_DATA_HOME/zgenom";
};
home.configFile = {
"zsh/.zshrc".source = ./.zshrc;
"zsh/aliases.zsh".source = ./aliases.zsh;
"zsh/completion.zsh".source = ./completion.zsh;
"zsh/config.zsh".source = ./config.zsh;
"zsh/keybinds.zsh".source = ./keybinds.zsh;
};
system.userActivationScripts.cleanupZgen = ''
rm -rf $ZDOTDIR/.*.zwc
rm -f $ZDOTDIR/.zcompdump
rm -rf $ZSH_CACHE
rm -fv $ZGEN_DIR/init.zsh{,.zwc}
'';
};
}

View File

@ -0,0 +1,12 @@
####
## Keybindings
####
stty stop undef
bindkey -s '^f' 'cd "$(dirname "$(fzf)")"\n'
bindkey -M vicmd 'k' history-substring-search-up
bindkey -M vicmd 'j' history-substring-search-down
if (( $+commands[fzf] )); then
bindkey '^R' fzf-history-widget
fi