break core out to own config

This commit is contained in:
2025-11-03 20:03:21 -06:00
parent 8eae778b23
commit 1192cef3ed
12 changed files with 711 additions and 1 deletions

View File

@@ -0,0 +1,20 @@
{
pkgs,
lib,
config,
...
}: let
program = "btop";
cfg = config.dots.${program};
#sec = sops.secrets;
in {
options.dots.${program} = {
enable = lib.mkEnableOption "enables ${program}";
};
config = lib.mkIf cfg.enable {
programs.${program} = {
enable = true;
};
};
}

View File

@@ -0,0 +1,25 @@
{
pkgs,
lib,
config,
...
}: {
imports = [
./librewolf
./firefox
./kitty
./dunst
./btop
./waybar
./stylix
./hypr
./tofi
./nvf
./lf
./zsh
./ssh
./gpg
./git
./xdg
];
}

View File

@@ -0,0 +1,30 @@
{
pkgs,
config,
lib,
inputs,
...
}: let
program = "git";
cfg = config.dots.${program};
#sec = sops.secrets;
in {
options.dots.${program} = {
enable = lib.mkEnableOption "enables ${program}";
};
config = lib.mkIf cfg.enable {
# configure git
programs.${program} = {
enable = true;
userName = "blake";
userEmail = "me@blakedheld.xyz";
extraConfig = {
init.defaultBranch = "trunk";
core.editor = "nvim";
pull.rebase = true;
push.autoSetupRemote = true;
};
};
};
}

View File

@@ -0,0 +1,30 @@
{
pkgs,
lib,
config,
...
}: let
program = "gpg";
cfg = config.dots.${program};
#sec = sops.secrets;
in {
options.dots.${program} = {
enable = lib.mkEnableOption "enables ${program}";
};
config = lib.mkIf cfg.enable {
programs.${program} = {
enable = true;
};
services.gpg-agent = {
enable = true;
enableSshSupport = true;
pinentry.package = pkgs.pinentry-qt;
pinentry.program = "pinentry-qt";
};
# install pinentry programs conditionaly based on os
home.packages =
lib.optional pkgs.stdenv.isDarwin pkgs.pinentry_mac
++ lib.optional pkgs.stdenv.isLinux pkgs.pinentry-qt;
};
}

View File

@@ -0,0 +1,5 @@
# general
set forcekitty
set chafasixel

View File

@@ -0,0 +1,32 @@
{
pkgs,
lib,
config,
...
}: let
program = "lf";
cfg = config.dots.${program};
#sec = sops.secrets;
in {
options.dots.${program} = {
enable = lib.mkEnableOption "enables ${program}";
};
config = lib.mkIf cfg.enable {
# just using the normal lfrc
programs.${program} = {
enable = false;
};
# install it to userspace
home.packages = with pkgs; [lf ctpv trashy];
# link configs
xdg.configFile."lf/lfrc" = {
source = config.lib.file.mkOutOfStoreSymlink "/home/blake/.nix/users/blake/dots/lf/lfrc";
};
xdg.configFile."ctpv/config" = {
source = config.lib.file.mkOutOfStoreSymlink "/home/blake/.nix/users/blake/dots/lf/ctpv_config";
};
};
}

View File

@@ -0,0 +1,114 @@
# blake's lf config
# --- folder specific ---
# timesheets show recent first
setlocal ~/documents/holocron/work/nhc/timesheets/2024/ reverse
# --- options ---
# file previews
set previewer ctpv
set cleaner ctpvclear
&ctpv -s $id
&ctpvquit $id
# mouse
set mouse true
# search
set ignorecase true
# --- mappings ---
# shortcuts
map gb cd /holocron
map gn cd ~/.nix
# navigation
map [ half-up
map ] half-down
# files & archives
map ad mkdir
map af mkfile
map ab mkbak
map ae extract
map aa archive
# trash
map gt cd ~/.local/share/Trash/files
map <delete> trash
map <s-delete> $trash restore
# --- functions ---
# extract any archive
cmd extract %{{
set -f
case $f in
*.tar.bz|*.tar.bz2|*.tbz|*.tbz2) tar xjvf $f;;
*.tar.gz|*.tgz) tar xzvf $f;;
*.tar.xz|*.txz) tar xJvf $f;;
*.zip) unzip $f;;
*.rar) unrar x $f;;
*.7z) 7z x $f;;
esac
}}
cmd archive %{{
echo "enter archive name: " ; read archive_name
if [ -z "$archive_name" ]; then
echo "No archive name provided."
exit 1
fi
IFS="$(printf '\n\t')"
file_list=()
for x in $fx; do
file_list+=("$x")
done
case "$archive_name" in
*.tar.bz|*.tar.bz2|*.tbz|*.tbz2) tar cjf "$archive_name" "${file_list[@]}" ;;
*.tar.gz|*.tgz) tar czf "$archive_name" "${file_list[@]}" ;;
*.tar.xz|*.txz) tar cJf "$archive_name" "${file_list[@]}" ;;
*.zip) zip -r "$archive_name" "${file_list[@]}" ;;
*.rar) rar a "$archive_name" "${file_list[@]}" ;;
*.7z) 7z a "$archive_name" "${file_list[@]}" ;;
*) echo "Unsupported archive format" ;;
esac
}}
# move files to trash
cmd trash %IFS="$(printf '\n\t')"; trash put $fx
# make a directory
cmd mkdir %{{
echo "enter directory name: " ; read dir
if [ -n "$dir" ]; then
mkdir -p "$dir" && echo "'$dir' created."
else
echo "no dir name provided"
fi
}}
# make a file
cmd mkfile %{{
echo "enter file name: " ; read file
if [ -n "$file" ]; then
touch "$file" && echo "'$file' created."
else
echo "no file name provided"
fi
}}
# make backup
cmd mkbak %{{
for x in $fx; do
cp -r $x $x.bak
done
}}

View File

@@ -0,0 +1,196 @@
{
pkgs,
config,
lib,
inputs,
...
}: let
program = "nvf";
cfg = config.dots.${program};
#sec = sops.secrets;
in {
options.dots.${program} = {
enable = lib.mkEnableOption "enables ${program}";
};
imports = [
inputs.nvf.homeManagerModules.default
];
config = lib.mkIf cfg.enable {
programs.${program} = {
enable = true;
settings = {
vim = {
globals = {
mapleader = " ";
maplocalleader = " ";
};
vimAlias = true;
lsp.enable = true;
statusline.lualine.enable = true;
telescope.enable = true;
autocomplete.nvim-cmp.enable = true;
autopairs.nvim-autopairs.enable = true;
keymaps = [
# visual line movement (insert mode)
{
key = "<Up>";
mode = ["i"];
action = "<C-o>gk";
desc = "Visual Line Up (Insert)";
}
{
key = "<Down>";
mode = ["i"];
action = "<C-o>gj";
desc = "Visual Line Down (Insert)";
}
# visual line movement (normal/visual)
{
key = "<Up>";
mode = [
"n"
"v"
];
action = "g<Up>";
desc = "Visual Line Up";
}
{
key = "<Down>";
mode = [
"n"
"v"
];
action = "g<Down>";
desc = "Visual Line Down";
}
# lsp
#{ key = "gd"; mode = [ "n" ]; action = "<cmd>lua vim.lsp.buf.definition()<CR>"; desc = "Go to definition"; }
#{ key = "K"; mode = [ "n" ]; action = "<cmd>lua vim.lsp.buf.hover()<CR>"; desc = "Hover info"; }
#{ key = "<leader>f"; mode = [ "n" ]; action = "<cmd>lua vim.lsp.buf.format({ async = true })<CR>"; desc = "Format buffer"; }
{
key = "gd";
mode = ["n"];
silent = true;
action = "<cmd>lua vim.lsp.buf.definition()<CR>";
desc = "Go to definition";
}
# Hover info
{
key = "K";
mode = ["n"];
silent = true;
action = "<cmd>lua vim.lsp.buf.hover()<CR>";
desc = "Hover info";
}
# Format buffer (Alejandra for Nix)
{
key = "<leader>F";
mode = ["n"];
silent = true;
action = "<cmd>lua vim.lsp.buf.format({ async = true })<CR>";
desc = "Format buffer";
}
# Code actions / quickfix
{
key = "<leader>a";
mode = ["n"];
silent = true;
action = "<cmd>lua vim.lsp.buf.code_action()<CR>";
desc = "Code action";
}
# Rename symbol
{
key = "<leader>r";
mode = ["n"];
silent = true;
action = "<cmd>lua vim.lsp.buf.rename()<CR>";
desc = "Rename symbol";
}
# Diagnostics
{
key = "<leader>e";
mode = ["n"];
silent = true;
action = "<cmd>lua vim.diagnostic.open_float()<CR>";
desc = "Show diagnostic";
}
{
key = "[d";
mode = ["n"];
silent = true;
action = "<cmd>lua vim.diagnostic.goto_prev()<CR>";
desc = "Previous diagnostic";
}
{
key = "]d";
mode = ["n"];
silent = true;
action = "<cmd>lua vim.diagnostic.goto_next()<CR>";
desc = "Next diagnostic";
}
];
options = {
clipboard = "unnamedplus";
# line numbers
number = true;
numberwidth = 2;
relativenumber = true;
# tabs and indentation
tabstop = 2;
shiftwidth = 2;
softtabstop = -1;
expandtab = true;
smarttab = true;
autoindent = true;
# search
ignorecase = true;
smartcase = true;
# files and backups
backup = false;
writebackup = false;
undofile = true;
swapfile = true;
# wrapping
wrap = true;
linebreak = true;
breakindent = true;
termguicolors = true;
autoread = true;
};
languages = {
enableTreesitter = true;
nix = {
enable = true;
format = {
enable = true;
type = "alejandra";
#type = "nixfmt";
};
};
markdown.enable = true;
rust.enable = true;
lua.enable = true;
};
};
};
};
};
}

View File

@@ -0,0 +1,52 @@
{
pkgs,
lib,
config,
...
}: let
program = "ssh";
cfg = config.dots.${program};
#sec = sops.secrets;
in {
options.dots.${program} = {
enable = lib.mkEnableOption "enables ${program}";
};
config = lib.mkIf cfg.enable {
programs.ssh = {
enable = true;
#enableDefaultConfig = false;
matchBlocks = {
"git.blakedheld.xyz" = {
user = "gitea";
identityFile = "~/.ssh/id_snowbelle";
};
"git.snowbelle.lan" = {
user = "gitea";
identityFile = "~/.ssh/id_snowbelle";
};
"bebe" = {
hostname = "10.10.0.1";
user = "root";
identityFile = "~/.ssh/id_snowbelle";
};
};
};
# import sshkeys from keyring
#home.file.".ssh/id_snowbelle".source = config.lib.file.mkOutOfStoreSymlink /home/blake/.nix/.keyring/ssh/id_snowbelle;
#home.file.".ssh/id_snowbelle.pub".source = config.lib.file.mkOutOfStoreSymlink /home/blake/.nix/.keyring/ssh/id_snowbelle.pub;
# manage secrets with sops
sops.secrets = {
"id_snowbelle" = {
mode = "0600";
path = "/home/blake/.ssh/id_snowbelle";
};
"id_snowbelle.pub" = {
mode = "644";
path = "/home/blake/.ssh/id_snowbelle.pub";
};
};
};
}

View File

@@ -0,0 +1,51 @@
{
pkgs,
lib,
config,
...
}: let
program = "xdg";
cfg = config.dots.${program};
#sec = sops.secrets;
in {
options.dots.${program} = {
enable = lib.mkEnableOption "enables ${program}";
};
config = lib.mkIf cfg.enable {
home.packages = with pkgs; [xdg-ninja];
xdg =
if pkgs.system == "x86_64-darwin"
then {}
else {
enable = true;
configHome = "/home/blake/.config";
cacheHome = "/home/blake/.cache";
dataHome = "/home/blake/.local/share";
stateHome = "/home/blake/.local/state";
userDirs = {
enable = true;
# writes ~/.config/user-dirs.dirs
desktop = "/home/blake/desktop";
download = "/home/blake/downloads";
documents = "/home/blake/documents";
pictures = "/home/blake/pictures";
videos = "/home/blake/videos";
music = "/home/blake/music";
publicShare = "/home/blake/public";
templates = "/home/blake/templates";
};
};
# misc env variables to get things out of ~ (<3 xdg-ninja)
home.sessionVariables =
if pkgs.system == "x86_64-darwin"
then {}
else {
GOPATH = "$XDG_DATA_HOME/go";
_JAVA_OPTIONS = ''-Djava.util.prefs.userRoot="$XDG_CONFIG_HOME"/java'';
};
};
}

View File

@@ -0,0 +1,156 @@
{
pkgs,
lib,
config,
...
}: let
program = "zsh";
cfg = config.dots.${program};
#sec = sops.secrets;
in {
options.dots.${program} = {
enable = lib.mkEnableOption "enables ${program}";
};
config = lib.mkIf cfg.enable {
# export some defaults
home.sessionVariables = {
EDITOR = "nvim";
PAGER = "less";
};
programs.${program} = {
enable = true;
dotDir = ".config/zsh";
autocd = true;
enableCompletion = true;
autosuggestion = {
enable = true;
highlight = "underline";
};
history = {
size = 10000;
save = 10000;
share = true;
append = true;
extended = true;
path = "$XDG_STATE_HOME/zsh/history";
};
shellAliases = {
# --- zsh ---
cfz = "nvim $HOME/.config/zsh/.zshrc";
src = "source $HOME/.config/zsh/.zshrc";
# --- config editing ---
cfh = "nvim $HOME/.config/hypr/hyprland.conf";
cfl = "nvim $HOME/.config/lf/lfrc";
# --- navigation ---
ls = "ls --color=auto --group-directories-first";
ll = "ls -lh --color=auto --group-directories-first";
la = "ls -Alh --color=auto --group-directories-first";
".." = "cd ..";
"..." = "cd ../..";
fs = "du -h | sort -h";
ds = "du -hs";
# --- shortcuts ---
vswap = "cd ~/.local/state/nvim/swap";
rswap = "rm ~/.local/state/nvim/swap/*";
v = "nvim";
sv = "sudo nvim";
vim = "nvim";
# --- safety ---
cp = "cp -iv";
mv = "mv -iv";
rm = "rm -Iv";
# --- colors ---
grep = "grep --color=auto";
fgrep = "fgrep --color=auto";
egrep = "egrep --color=auto";
# --- scripts ---
rebuild = "sh ~/.nix/bin/rebuild.sh";
perms = "sudo sh ~/.nix/bin/perms.sh";
bb = "sudo sh ~/.nix/bin/lf_borg.sh";
# --- git ---
status = "git status";
add = "git add";
commit = "git commit -am";
push = "git push";
pull = "git pull";
dotfiles = "/usr/bin/git --git-dir=$HOME/.dotfiles --work-tree=$HOME";
dtf = "/usr/bin/git --git-dir=$HOME/.dotfiles --work-tree=$HOME";
sec = "sops ~/.nix/secrets/secrets.yaml";
# --- systemd ---
stat = "sudo systemctl status";
restart = "sudo systemctl restart";
start = "sudo systemctl start";
stop = "sudo systemctl stop";
jou = "sudo journalctl -xeu";
live = "sudo journalctl -o short-iso -n 50 -fu";
# --- system ---
peace = "systemctl poweroff";
love = "systemctl reboot";
lock = "loginctl lock-session";
};
initContent = ''
# the prompt
PS1='%F{0}%K{126}%B[%n@%m]%b%k%f:%F{015}%B[%~]%b%f%F{015}%S$%s%f '
# lf changes working dir on exit
alias lf='lfcd'
lfcd () {cd "$(command lf -print-last-dir "$@")"}
'';
syntaxHighlighting = {
enable = true;
highlighters = ["main" "brackets" "pattern" "regexp" "cursor" "root"];
styles = {
"default" = "none";
"unknown-token" = "fg=red";
"reserved-word" = "fg=red";
"alias" = "fg=cyan,underline";
"suffix-alias" = "fg=cyan,underline";
"builtin" = "fg=cyan";
"function" = "fg=cyan";
"command" = "fg=cyan,bold";
"path" = "fg=cyan,underline";
"precommand" = "fg=cyan,underline";
"commandseparator" = "fg=white";
"globbing" = "fg=white";
"history-expansion" = "fg=white";
"hashed-command" = "fg=magenta";
"single-hyphen-option" = "fg=blue";
"double-hyphen-option" = "fg=blue";
"back-quoted-argument" = "fg=yellow";
"single-quoted-argument" = "fg=white";
"double-quoted-argument" = "fg=white";
"dollar-double-quoted-argument" = "fg=blue";
"back-double-quoted-argument" = "fg=blue";
};
};
# zplug = {
# enable = true;
# zplugHome = "$XDG_STATE_HOME/zsh/zplug";
# plugins = [
# {name = "zsh-users/zsh-syntax-highlighting";}
# ];
# };
};
# rid the world of ~/.zshenv
#home.file.".zshenv".enable = false;
};
}

View File

@@ -15,7 +15,6 @@
lf.enable = true;
kitty.enable = true;
librewolf.enable = true;
firefox.enable = true;
stylix.enable = true;
waybar.enable = true;
dunst.enable = true;