This commit is contained in:
2025-12-11 20:46:47 +00:00
parent a0e4d98402
commit 5d7d490636
56 changed files with 582 additions and 582 deletions

15
profiles/atuin.nix Normal file
View File

@@ -0,0 +1,15 @@
{
programs.atuin = {
enable = true;
enableFishIntegration = true;
flags = [
"--disable-up-arrow"
];
settings = {
style = "compact";
inline_height = 0;
show_help = false;
show_tabs = false;
};
};
}

5
profiles/bash.nix Normal file
View File

@@ -0,0 +1,5 @@
{
programs.zsh = {
enable = true;
};
}

21
profiles/bat.nix Normal file
View File

@@ -0,0 +1,21 @@
{pkgs, ...}: {
programs.bat = {
enable = true;
config = {
theme = "Catppuccin Latte";
pager = "ov";
};
themes = {
"Catppuccin Latte" = {
src =
pkgs.fetchFromGitHub {
owner = "catppuccin";
repo = "bat";
rev = "6810349b28055dce54076712fc05fc68da4b8ec0";
sha256 = "lJapSgRVENTrbmpVyn+UQabC9fpV1G1e+CdlJ090uvg=";
};
file = "themes/Catppuccin Latte.tmTheme";
};
};
};
}

33
profiles/core.nix Normal file
View File

@@ -0,0 +1,33 @@
{pkgs, ...}: {
programs.fish.enable = true;
nixpkgs = {
config = {
allowUnfree = true;
};
};
nix = {
package = pkgs.nix;
settings = {
trusted-users = [
"@admin"
];
substituters = [
"https://nix-community.cachix.org"
"https://cache.nixos.org"
];
trusted-public-keys = [
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
];
};
gc = {
automatic = true;
options = "--delete-older-than 30d";
};
extraOptions = ''
experimental-features = nix-command flakes
'';
};
}

60
profiles/darwin.nix Normal file
View File

@@ -0,0 +1,60 @@
{
constants,
pkgs,
user,
...
}: {
system = {
primaryUser = user;
stateVersion = constants.stateVersions.darwin;
defaults = {
NSGlobalDomain = {
# null equals "Light"
AppleInterfaceStyle = null;
AppleShowAllExtensions = true;
ApplePressAndHoldEnabled = false;
KeyRepeat = 2;
InitialKeyRepeat = 15;
"com.apple.mouse.tapBehavior" = 1;
"com.apple.sound.beep.volume" = 0.0;
"com.apple.sound.beep.feedback" = 0;
};
dock = {
autohide = true;
show-recents = false;
launchanim = true;
orientation = "bottom";
tilesize = 60;
};
finder = {
_FXShowPosixPathInTitle = false;
};
trackpad = {
Clicking = true;
TrackpadThreeFingerDrag = true;
};
};
};
nix = {
settings.trusted-users = ["@admin" "${user}"];
gc.interval = {
Weekday = 0;
Hour = 2;
Minute = 0;
};
};
users.users.${user} = {
name = "${user}";
home = "/Users/${user}";
isHidden = false;
shell = pkgs.fish;
};
home-manager.useGlobalPkgs = true;
}

6
profiles/direnv.nix Normal file
View File

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

125
profiles/dock.nix Normal file
View File

@@ -0,0 +1,125 @@
{
config,
pkgs,
lib,
user,
...
}:
with lib; let
cfg = config.local.dock;
inherit (pkgs) stdenv dockutil;
in {
options = {
local.dock = {
enable =
mkOption {
description = "Enable dock";
default = stdenv.isDarwin;
example = false;
};
entries =
mkOption {
description = "Entries on the Dock";
type = with types;
listOf (submodule {
options = {
path = lib.mkOption {type = str;};
section =
lib.mkOption {
type = str;
default = "apps";
};
options =
lib.mkOption {
type = str;
default = "";
};
};
});
default = [
{path = "/Applications/Helium.app/";}
{path = "${config.users.users.${user}.home}/Applications/Home Manager Apps/Ghostty.app/";}
{path = "/System/Applications/Calendar.app/";}
{path = "/System/Applications/Mail.app/";}
{path = "/System/Applications/Notes.app/";}
{path = "/System/Applications/Music.app/";}
{path = "/System/Applications/System Settings.app/";}
{
path = "${config.users.users.${user}.home}/Downloads";
section = "others";
options = "--sort name --view grid --display stack";
}
];
};
username =
mkOption {
description = "Username to apply the dock settings to";
type = types.str;
default = user;
};
};
};
config =
mkIf cfg.enable (
let
normalize = path:
if hasSuffix ".app" path
then path + "/"
else path;
entryURI = path:
"file://"
+ (
builtins.replaceStrings
[
" "
"!"
"\""
"#"
"$"
"%"
"&"
"'"
"("
")"
]
[
"%20"
"%21"
"%22"
"%23"
"%24"
"%25"
"%26"
"%27"
"%28"
"%29"
]
(normalize path)
);
wantURIs = concatMapStrings (entry: "${entryURI entry.path}\n") cfg.entries;
createEntries =
concatMapStrings (
entry: "${dockutil}/bin/dockutil --no-restart --add '${entry.path}' --section ${entry.section} ${entry.options}\n"
)
cfg.entries;
in {
system.activationScripts.postActivation.text = ''
echo >&2 "Setting up the Dock for ${cfg.username}..."
su ${cfg.username} -s /bin/sh <<-'USERBLOCK'
haveURIs="$(${dockutil}/bin/dockutil --list | ${pkgs.coreutils}/bin/cut -f2)"
if ! diff -wu <(echo -n "$haveURIs") <(echo -n '${wantURIs}') >&2 ; then
echo >&2 "Resetting Dock."
${dockutil}/bin/dockutil --no-restart --remove all
${createEntries}
killall Dock
else
echo >&2 "Dock setup complete."
fi
USERBLOCK
'';
}
);
}

6
profiles/eza.nix Normal file
View File

@@ -0,0 +1,6 @@
{
programs.eza = {
enable = true;
enableFishIntegration = true;
};
}

40
profiles/fail2ban.nix Normal file
View File

@@ -0,0 +1,40 @@
{...}: {
services.fail2ban = {
enable = true;
maxretry = 5;
bantime = "10m";
bantime-increment = {
enable = true;
multipliers = "1 2 4 8 16 32 64";
maxtime = "168h";
overalljails = true;
};
jails = {
sshd = {
settings = {
enabled = true;
port = "ssh";
filter = "sshd";
maxretry = 3;
};
};
gitea = {
settings = {
enabled = true;
filter = "gitea";
logpath = "/var/lib/gitea/log/gitea.log";
maxretry = 10;
findtime = 3600;
bantime = 900;
action = "iptables-allports";
};
};
};
};
environment.etc."fail2ban/filter.d/gitea.local".text = ''
[Definition]
failregex = .*(Failed authentication attempt|invalid credentials|Attempted access of unknown user).* from <HOST>
ignoreregex =
'';
}

54
profiles/fish.nix Normal file
View File

@@ -0,0 +1,54 @@
{
programs.fish = {
enable = true;
functions = {
open_project = ''
set -l base "$HOME/Projects"
set -l choice (fd -t d -d 1 -a . "$base/Personal" "$base/Work" \
| string replace -r -- "^$base/" "" \
| fzf --prompt "project > ")
test -n "$choice"; and cd "$base/$choice"
'';
};
interactiveShellInit = ''
set fish_greeting
set fish_color_normal 4c4f69
set fish_color_command 1e66f5
set fish_color_param dd7878
set fish_color_keyword d20f39
set fish_color_quote 40a02b
set fish_color_redirection ea76cb
set fish_color_end fe640b
set fish_color_comment 8c8fa1
set fish_color_error d20f39
set fish_color_gray 9ca0b0
set fish_color_selection --background=ccd0da
set fish_color_search_match --background=ccd0da
set fish_color_option 40a02b
set fish_color_operator ea76cb
set fish_color_escape e64553
set fish_color_autosuggestion 9ca0b0
set fish_color_cancel d20f39
set fish_color_cwd df8e1d
set fish_color_user 179299
set fish_color_host 1e66f5
set fish_color_host_remote 40a02b
set fish_color_status d20f39
set fish_pager_color_progress 9ca0b0
set fish_pager_color_prefix ea76cb
set fish_pager_color_completion 4c4f69
set fish_pager_color_description 9ca0b0
set -gx LS_COLORS "$(vivid generate catppuccin-latte)"
set -gx COLORTERM truecolor
set -gx COLORFGBG "15;0"
set -gx TERM_BACKGROUND light
for mode in default insert
bind --mode $mode \cp open_project
end
'';
};
}

24
profiles/fzf.nix Normal file
View File

@@ -0,0 +1,24 @@
{
programs.fzf = {
enable = true;
enableFishIntegration = true;
};
home.sessionVariables = {
FZF_DEFAULT_OPTS = ''
--bind=alt-k:up,alt-j:down
--expect=tab,enter
--layout=reverse
--delimiter='\t'
--with-nth=1
--preview-window='border-rounded' --prompt=' ' --marker=' ' --pointer=' '
--separator='' --scrollbar='' --layout='reverse'
--color=bg+:#CCD0DA,bg:#EFF1F5,spinner:#DC8A78,hl:#D20F39
--color=fg:#4C4F69,header:#D20F39,info:#8839EF,pointer:#DC8A78
--color=marker:#7287FD,fg+:#4C4F69,prompt:#8839EF,hl+:#D20F39
--color=selected-bg:#BCC0CC
--color=border:#9CA0B0,label:#4C4F69
'';
};
}

22
profiles/ghostty.nix Normal file
View File

@@ -0,0 +1,22 @@
{pkgs, ...}: {
programs.ghostty = {
enable = true;
package = pkgs.ghostty-bin;
settings = {
command = "${pkgs.fish}/bin/fish";
theme = "Catppuccin Latte";
window-padding-x = 12;
window-padding-y = 3;
window-padding-balance = true;
font-family = "TX-02 SemiCondensed";
font-size = 16.5;
cursor-style = "block";
mouse-hide-while-typing = true;
mouse-scroll-multiplier = 1.25;
shell-integration = "detect";
shell-integration-features = "no-cursor";
clipboard-read = "allow";
clipboard-write = "allow";
};
};
}

211
profiles/git.nix Normal file
View File

@@ -0,0 +1,211 @@
{...}: let
name = "Christoph Schmatzler";
in {
programs.git = {
enable = true;
ignores = ["*.swp"];
settings = {
user.name = name;
init.defaultBranch = "main";
core = {
editor = "vim";
autocrlf = "input";
pager = "delta";
};
pull.rebase = true;
rebase.autoStash = true;
interactive.diffFilter = "delta --color-only";
delta = {
navigate = true;
line-numbers = true;
syntax-theme = "GitHub";
side-by-side = true;
pager = "less -FRX";
};
pager = {
diff = "delta";
log = "delta";
show = "delta";
};
};
lfs = {
enable = true;
};
};
home.shellAliases = {
g = "git";
ga = "git add";
gaa = "git add --all";
gapa = "git add --patch";
gau = "git add --update";
gav = "git add --verbose";
gap = "git apply";
gapt = "git apply --3way";
gb = "git branch";
gba = "git branch --all";
gbd = "git branch --delete";
gbD = "git branch --delete --force";
gbl = "git blame -w";
gbnm = "git branch --no-merged";
gbr = "git branch --remote";
gbs = "git bisect";
gbsb = "git bisect bad";
gbsg = "git bisect good";
gbsn = "git bisect new";
gbso = "git bisect old";
gbsr = "git bisect reset";
gbss = "git bisect start";
gc = "git commit --verbose";
gca = "git commit --verbose --all";
gcam = "git commit --all --message";
gcas = "git commit --all --signoff";
gcasm = "git commit --all --signoff --message";
gcb = "git checkout -b";
gcB = "git checkout -B";
gcf = "git config --list";
gclean = "git clean --interactive -d";
gcl = "git clone --recurse-submodules";
gclf = "git clone --recursive --shallow-submodules --filter=blob:none --also-filter-submodules";
gcm = "git checkout main";
gcmsg = "git commit --message";
gcn = "git commit --verbose --no-edit";
gco = "git checkout";
gcor = "git checkout --recurse-submodules";
gcount = "git shortlog --summary --numbered";
gcp = "git cherry-pick";
gcpa = "git cherry-pick --abort";
gcpc = "git cherry-pick --continue";
gcs = "git commit --gpg-sign";
gcss = "git commit --gpg-sign --signoff";
gcssm = "git commit --gpg-sign --signoff --message";
gcsm = "git commit --signoff --message";
gd = "git diff";
gdca = "git diff --cached";
gdcw = "git diff --cached --word-diff";
gds = "git diff --staged";
gdw = "git diff --word-diff";
gdt = "git diff-tree --no-commit-id --name-only -r";
gdup = "git diff @{upstream}";
gf = "git fetch";
gfa = "git fetch --all --tags --prune";
gfo = "git fetch origin";
gfg = "git ls-files | grep";
gg = "git gui citool";
gga = "git gui citool --amend";
ggpull = "git pull origin \"$(git branch --show-current)\"";
ggpush = "git push origin \"$(git branch --show-current)\"";
ggsup = "git branch --set-upstream-to=origin/$(git branch --show-current)";
ghh = "git help";
gignore = "git update-index --assume-unchanged";
gignored = "git ls-files -v | grep \"^[[:lower:]]\"";
gl = "git pull";
glg = "git log --stat";
glgp = "git log --stat --patch";
glgg = "git log --graph";
glgga = "git log --graph --decorate --all";
glgm = "git log --graph --max-count=10";
glo = "git log --oneline --decorate";
glog = "git log --oneline --decorate --graph";
gloga = "git log --oneline --decorate --graph --all";
glol = "git log --graph --pretty=\"%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset\"";
glola = "git log --graph --pretty=\"%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset\" --all";
glols = "git log --graph --pretty=\"%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset\" --stat";
glod = "git log --graph --pretty=\"%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset\"";
glods = "git log --graph --pretty=\"%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset\" --date=short";
gluc = "git pull upstream $(git branch --show-current)";
glum = "git pull upstream main";
gm = "git merge";
gma = "git merge --abort";
gmc = "git merge --continue";
gms = "git merge --squash";
gmff = "git merge --ff-only";
gmtl = "git mergetool --no-prompt";
gmtlvim = "git mergetool --no-prompt --tool=vimdiff";
gmum = "git merge upstream/main";
gmom = "git merge origin/main";
gp = "git push";
gpd = "git push --dry-run";
gpf = "git push --force-with-lease";
gpod = "git push origin --delete";
gpoat = "git push origin --all && git push origin --tags";
gpr = "git pull --rebase";
gpra = "git pull --rebase --autostash";
gprav = "git pull --rebase --autostash -v";
gprom = "git pull --rebase origin main";
gpromi = "git pull --rebase=interactive origin main";
gprv = "git pull --rebase -v";
gprum = "git pull --rebase upstream main";
gprumi = "git pull --rebase=interactive upstream main";
gpsup = "git push --set-upstream origin $(git branch --show-current)";
gpsupf = "git push --set-upstream origin $(git branch --show-current) --force-with-lease";
gpv = "git push --verbose";
gpu = "git push upstream";
gr = "git remote";
gra = "git remote add";
grb = "git rebase";
grba = "git rebase --abort";
grbc = "git rebase --continue";
grbd = "git rebase develop";
grbi = "git rebase --interactive";
grbm = "git rebase main";
grbo = "git rebase --onto";
grbom = "git rebase origin/main";
grbs = "git rebase --skip";
grbum = "git rebase upstream/main";
grev = "git revert";
greva = "git revert --abort";
grevc = "git revert --continue";
grf = "git reflog";
grh = "git reset";
grhh = "git reset --hard";
grhk = "git reset --keep";
grhs = "git reset --soft";
grm = "git rm";
grmc = "git rm --cached";
grmv = "git remote rename";
groh = "git reset origin/$(git branch --show-current) --hard";
grrm = "git remote remove";
grs = "git restore";
grset = "git remote set-url";
grss = "git restore --source";
grst = "git restore --staged";
grt = "cd \"$(git rev-parse --show-toplevel || echo .)\"";
gru = "git reset --";
grup = "git remote update";
grv = "git remote --verbose";
gsb = "git status --short --branch";
gsh = "git show";
gsi = "git submodule init";
gsps = "git show --pretty=short --show-signature";
gss = "git status --short";
gst = "git status";
gsta = "git stash push";
gstaa = "git stash apply";
gstall = "git stash --all";
gstc = "git stash clear";
gstd = "git stash drop";
gstl = "git stash list";
gstp = "git stash pop";
gsts = "git stash show --patch";
gstu = "git stash push --include-untracked";
gsu = "git submodule update";
gsw = "git switch";
gswc = "git switch --create";
gswd = "git switch develop";
gswm = "git switch main";
gta = "git tag --annotate";
gts = "git tag --sign";
gtv = "git tag | sort -V";
gunignore = "git update-index --no-assume-unchanged";
gunwip = "git rev-list --max-count=1 --format=\"%s\" HEAD | grep -q \"\\--wip--\" && git reset HEAD~1";
gwch = "git whatchanged -p --abbrev-commit --pretty=medium";
gwipe = "git reset --hard && git clean --force -df";
gwt = "git worktree";
gwta = "git worktree add";
gwtls = "git worktree list";
gwtmv = "git worktree move";
gwtrm = "git worktree remove";
gwip = "git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify --no-gpg-sign --message \"--wip-- [skip ci]\"";
};
}

40
profiles/gitea.nix Normal file
View File

@@ -0,0 +1,40 @@
{...}: {
networking.firewall.allowedTCPPorts = [80 443];
services.gitea = {
enable = true;
database = {
type = "sqlite3";
path = "/var/lib/gitea/data/gitea.db";
};
settings = {
server = {
ROOT_URL = "https://git.schmatzler.com/";
DOMAIN = "git.schmatzler.com";
HTTP_ADDR = "127.0.0.1";
HTTP_PORT = 3000;
};
service.DISABLE_REGISTRATION = true;
security.INSTALL_LOCK = true;
session = {
COOKIE_SECURE = true;
SAME_SITE = "strict";
};
api.ENABLE_SWAGGER = false;
server.LANDING_PAGE = "explore";
};
};
services.caddy = {
enable = true;
virtualHosts."git.schmatzler.com".extraConfig = ''
header {
Strict-Transport-Security "max-age=31536000; includeSubDomains"
X-Content-Type-Options "nosniff"
X-Frame-Options "DENY"
Referrer-Policy "strict-origin-when-cross-origin"
}
reverse_proxy localhost:3000
'';
};
}

24
profiles/home.nix Normal file
View File

@@ -0,0 +1,24 @@
{
pkgs,
lib,
constants,
inputs,
...
}: let
setWallpaperScript = import ./wallpaper.nix {inherit pkgs;};
in {
programs.home-manager.enable = true;
home = {
packages = pkgs.callPackage ./packages.nix {inherit inputs;};
stateVersion = constants.stateVersions.homeManager;
activation =
lib.mkIf pkgs.stdenv.isDarwin {
"setWallpaper" =
lib.hm.dag.entryAfter ["revealHomeLibraryDirectory"] ''
echo "[+] Setting wallpaper"
${setWallpaperScript}/bin/set-wallpaper-script
'';
};
};
}

10
profiles/homebrew.nix Normal file
View File

@@ -0,0 +1,10 @@
{
homebrew = {
enable = true;
casks = [
"helium-browser"
"pearcleaner"
"tidal"
];
};
}

5
profiles/jjui.nix Normal file
View File

@@ -0,0 +1,5 @@
{
programs.jjui = {
enable = true;
};
}

47
profiles/jujutsu.nix Normal file
View File

@@ -0,0 +1,47 @@
{
programs.jujutsu = {
enable = true;
settings = {
user = {
name = "Christoph Schmatzler";
email = "christoph@schmatzler.com";
};
git = {
sign-on-push = true;
subprocess = true;
write-change-id-header = true;
};
diff = {
tool = "delta";
};
ui = {
default-command = "status";
diff-formatter = ":git";
pager = ["delta" "--pager" "less -FRX"];
diff-editor = ["nvim" "-c" "DiffEditor $left $right $output"];
};
aliases = {
n = ["new"];
tug = ["bookmark" "move" "--from" "closest_bookmark(@-)" "--to" "@-"];
stack = ["log" "-r" "ancestors((trunk()..@)::bookmarks() | @, 2)"];
retrunk = ["rebase" "-d" "trunk()"];
};
revset-aliases = {
"closest_bookmark(to)" = "heads(::to & bookmarks())";
};
templates = {
draft_commit_description = ''
concat(
coalesce(description, default_commit_description, "\n"),
surround(
"\nJJ: This commit contains the following changes:\n", "",
indent("JJ: ", diff.stat(72)),
),
"\nJJ: ignore-rest\n",
diff.git(),
)
'';
};
};
};
}

58
profiles/lazygit.nix Normal file
View File

@@ -0,0 +1,58 @@
{
programs.lazygit = {
enable = true;
settings = {
git = {
commit.signOff = true;
pagers = [
{
delta = {
colorArg = "always";
pager = "DELTA_FEATURES=decorations delta --light --paging=never --line-numbers --hyperlinks --hyperlinks-file-link-format=\"lazygit-edit://{path}:{line}\"";
};
}
];
};
gui = {
authorColors = {
"*" = "#7287fd";
};
theme = {
activeBorderColor = [
"#8839ef"
"bold"
];
inactiveBorderColor = [
"#6c6f85"
];
optionsTextColor = [
"#1e66f5"
];
selectedLineBgColor = [
"#ccd0da"
];
cherryPickedCommitBgColor = [
"#bcc0cc"
];
cherryPickedCommitFgColor = [
"#8839ef"
];
defaultFgColor = [
"#4c4f69"
];
searchingActiveBorderColor = [
"#df8e1d"
];
unstagedChangesColor = [
"#d20f39"
];
};
};
};
};
home.shellAliases = {
lg = "lazygit";
};
}

10
profiles/mise.nix Normal file
View File

@@ -0,0 +1,10 @@
{
programs.mise = {
enable = true;
enableFishIntegration = true;
enableZshIntegration = true;
settings = {
auto_install = false;
};
};
}

View File

@@ -0,0 +1,34 @@
{
programs.nixvim = {
autoGroups = {
Christoph = {};
};
autoCmd = [
{
event = "BufWritePre";
group = "Christoph";
pattern = "*";
command = "%s/\\s\\+$//e";
}
{
event = "BufReadPost";
group = "Christoph";
pattern = "*";
command = "normal zR";
}
{
event = "FileReadPost";
group = "Christoph";
pattern = "*";
command = "normal zR";
}
{
event = "FileType";
group = "Christoph";
pattern = "*.ex,*.exs,*.heex";
command = "setlocal expandtab tabstop=2 shiftwidth=2 softtabstop=2";
}
];
};
}

View File

@@ -0,0 +1,38 @@
{
imports = [
./autocmd.nix
./mappings.nix
./options.nix
./plugins/blink-cmp.nix
./plugins/conform.nix
./plugins/copilot.nix
./plugins/grug-far.nix
./plugins/harpoon.nix
./plugins/hunk.nix
./plugins/lsp.nix
./plugins/mini.nix
./plugins/oil.nix
./plugins/toggleterm.nix
./plugins/treesitter.nix
./plugins/zk.nix
];
programs.nixvim = {
enable = true;
defaultEditor = true;
luaLoader.enable = true;
colorschemes.catppuccin = {
enable = true;
settings = {
flavour = "latte";
};
};
extraConfigLua = ''
vim.ui.select = MiniPick.ui_select
'';
};
home.shellAliases = {
v = "nvim";
};
}

View File

@@ -0,0 +1,296 @@
{
programs.nixvim.keymaps = [
# clipboard - OSC52 yank and paste
{
mode = ["n" "v"];
key = "<leader>y";
action = ''"+y'';
options.desc = "Yank to system clipboard (OSC52)";
}
# e - explore/edit
{
mode = "n";
key = "<leader>ef";
action = ":lua require('oil').open()<CR>";
options.desc = "File directory";
}
{
mode = "n";
key = "<leader>er";
action = ":lua require('grug-far').open()<CR>";
options.desc = "Search and replace";
}
# f - find
{
mode = "n";
key = "<leader>f/";
action = ":Pick history scope='/'<CR>";
options.desc = "'/' history";
}
{
mode = "n";
key = "<leader>f:";
action = ":Pick history scope=':'<CR>";
options.desc = "':' history";
}
{
mode = "n";
key = "<leader>fa";
action = ":Pick git_hunks scope='staged'<CR>";
options.desc = "Added hunks (all)";
}
{
mode = "n";
key = "<leader>fA";
action = ":Pick git_hunks path='%' scope='staged'<CR>";
options.desc = "Added hunks (buffer)";
}
{
mode = "n";
key = "<leader>fb";
action = ":Pick buffers<CR>";
options.desc = "Buffers";
}
{
mode = "n";
key = "<leader>fd";
action = ":Pick diagnostic scope='all'<CR>";
options.desc = "Diagnostic (workspace)";
}
{
mode = "n";
key = "<leader>fD";
action = ":Pick diagnostic scope='current'<CR>";
options.desc = "Diagnostic (buffer)";
}
{
mode = "n";
key = "<leader>ff";
action = ":Pick files<CR>";
options.desc = "Search files";
}
{
mode = "n";
key = "<leader>fg";
action = ":Pick grep_live<CR>";
options.desc = "Grep";
}
{
mode = "n";
key = "<leader>fm";
action = ":Pick git_hunks<CR>";
options.desc = "Modified hunks (all)";
}
{
mode = "n";
key = "<leader>fM";
action = ":Pick git_hunks path='%'<CR>";
options.desc = "Modified hunks (buffer)";
}
{
mode = "n";
key = "<leader>fr";
action = ":Pick lsp scope='references'<CR>";
options.desc = "References (LSP)";
}
{
mode = "n";
key = "<leader>fs";
action = ":Pick lsp scope='workspace_symbol'<CR>";
options.desc = "Symbols (LSP, workspace)";
}
{
mode = "n";
key = "<leader>fS";
action = ":Pick lsp scope='document_symbol'<CR>";
options.desc = "Symbols (LSP, buffer)";
}
{
mode = "n";
key = "<leader>fv";
action = ":Pick visit_paths cwd=\"\"<CR>";
options.desc = "Visit paths (all)";
}
{
mode = "n";
key = "<leader>fV";
action = ":Pick visit_paths<CR>";
options.desc = "Visit paths (cwd)";
}
# g - git
{
mode = "n";
key = "<leader>gd";
action = ":DiffviewOpen<CR>";
}
{
mode = "n";
key = "<leader>gg";
action.__raw = ''
function()
require('toggleterm.terminal').Terminal:new({ cmd = 'jjui', direction = 'float' }):toggle()
end
'';
options.desc = "jjui";
}
# l - lsp/formatter
{
mode = "n";
key = "<leader>la";
action = ":lua vim.lsp.buf.code_action()<CR>";
options.desc = "Actions";
}
{
mode = "n";
key = "<leader>ld";
action = ":lua vim.diagnostic.open_float({ severity = { min = vim.diagnostic.severity.HINT } })<CR>";
options.desc = "Diagnostics popup";
}
{
mode = "n";
key = "<leader>lf";
action = ":lua require('conform').format({ lsp_fallback = true })<CR>";
options.desc = "Format";
}
{
mode = "n";
key = "<leader>li";
action = ":lua vim.lsp.buf.hover()<CR>";
options.desc = "Information";
}
{
mode = "n";
key = "<leader>lj";
action = ":lua vim.diagnostic.goto_next()<CR>";
options.desc = "Next diagnostic";
}
{
mode = "n";
key = "<leader>lk";
action = ":lua vim.diagnostic.goto_prev()<CR>";
options.desc = "Prev diagnostic";
}
{
mode = "n";
key = "<leader>lr";
action = ":lua vim.lsp.buf.rename()<CR>";
options.desc = "Rename";
}
{
mode = "n";
key = "<leader>lR";
action = ":lua vim.lsp.buf.references()<CR>";
options.desc = "References";
}
{
mode = "n";
key = "<leader>ls";
action = ":lua vim.lsp.buf.definition()<CR>";
options.desc = "Source definition";
}
# other
{
mode = "n";
key = "<leader>j";
action = ":lua require('mini.jump2d').start(require('mini.jump2d').builtin_opts.query)<CR>";
options.desc = "Jump to character";
}
{
mode = "n";
key = "<leader>a";
action = ":lua require('harpoon'):list():add()<CR>";
options.desc = "Add harpoon";
}
{
mode = "n";
key = "<C-e>";
action = ":lua require('harpoon').ui:toggle_quick_menu(require('harpoon'):list())<CR>";
options.desc = "Toggle harpoon quick menu";
}
{
mode = "n";
key = "<leader>1";
action = ":lua require('harpoon'):list():select(1)<CR>";
options.desc = "Go to harpoon 1";
}
{
mode = "n";
key = "<leader>2";
action = ":lua require('harpoon'):list():select(2)<CR>";
options.desc = "Go to harpoon 2";
}
{
mode = "n";
key = "<leader>3";
action = ":lua require('harpoon'):list():select(3)<CR>";
options.desc = "Go to harpoon 3";
}
{
mode = "n";
key = "<leader>4";
action = ":lua require('harpoon'):list():select(4)<CR>";
options.desc = "Go to harpoon 4";
}
# z - zk (notes)
{
mode = "n";
key = "<leader>zn";
action = ":ZkNew { title = vim.fn.input('Title: ') }<CR>";
options.desc = "New note";
}
{
mode = "n";
key = "<leader>zo";
action = ":ZkNotes { sort = { 'modified' } }<CR>";
options.desc = "Open notes";
}
{
mode = "n";
key = "<leader>zt";
action = ":ZkTags<CR>";
options.desc = "Browse tags";
}
{
mode = "n";
key = "<leader>zf";
action = ":ZkNotes { sort = { 'modified' }, match = { vim.fn.input('Search: ') } }<CR>";
options.desc = "Find notes";
}
{
mode = "v";
key = "<leader>zf";
action = ":'<,'>ZkMatch<CR>";
options.desc = "Find notes matching selection";
}
{
mode = "n";
key = "<leader>zb";
action = ":ZkBacklinks<CR>";
options.desc = "Backlinks";
}
{
mode = "n";
key = "<leader>zl";
action = ":ZkLinks<CR>";
options.desc = "Outbound links";
}
{
mode = "n";
key = "<leader>zi";
action = ":ZkInsertLink<CR>";
options.desc = "Insert link";
}
{
mode = "v";
key = "<leader>zi";
action = ":'<,'>ZkInsertLinkAtSelection<CR>";
options.desc = "Insert link at selection";
}
{
mode = "v";
key = "<leader>zc";
action = ":'<,'>ZkNewFromTitleSelection<CR>";
options.desc = "Create note from selection";
}
];
}

View File

@@ -0,0 +1,17 @@
{
programs.nixvim = {
globals = {
clipboard = "osc52";
};
opts = {
expandtab = false;
tabstop = 2;
ignorecase = true;
list = false;
mouse = "";
relativenumber = true;
shiftwidth = 2;
smartcase = true;
};
};
}

View File

@@ -0,0 +1,17 @@
{
programs.nixvim.plugins.blink-cmp = {
enable = true;
settings = {
signature.enabled = true;
completion = {
accept = {
auto_brackets = {
enabled = true;
semantic_token_resolution.enabled = false;
};
};
documentation.auto_show = true;
};
};
};
}

View File

@@ -0,0 +1,14 @@
{
programs.nixvim.plugins.conform-nvim = {
enable = true;
settings = {
format_on_save = {};
formatters_by_ft = {
nix = ["alejandra"];
javascript = ["prettier"];
typescript = ["prettier"];
vue = ["prettier"];
};
};
};
}

View File

@@ -0,0 +1,15 @@
{
programs.nixvim.plugins.copilot-lua = {
enable = true;
settings = {
panel.enabled = false;
suggestion = {
enabled = true;
auto_trigger = true;
keymap = {
accept = "<Tab>";
};
};
};
};
}

View File

@@ -0,0 +1,7 @@
{
programs.nixvim.plugins = {
grug-far = {
enable = true;
};
};
}

View File

@@ -0,0 +1,7 @@
{
programs.nixvim.plugins = {
harpoon = {
enable = true;
};
};
}

View File

@@ -0,0 +1,7 @@
{
programs.nixvim.plugins = {
hunk = {
enable = true;
};
};
}

View File

@@ -0,0 +1,16 @@
{
programs.nixvim.plugins = {
lsp = {
enable = true;
inlayHints = true;
servers = {
nil_ls.enable = true;
cssls.enable = true;
dockerls.enable = true;
yamlls.enable = true;
vtsls.enable = true;
zk.enable = true;
};
};
};
}

View File

@@ -0,0 +1,157 @@
{
programs.nixvim.plugins.mini = {
enable = true;
modules = {
ai = {
custom_textobjects = {
B.__raw = "require('mini.extra').gen_ai_spec.buffer()";
F.__raw = "require('mini.ai').gen_spec.treesitter({ a = '@function.outer', i = '@function.inner' })";
};
};
align = {};
basics = {
options = {
basic = true;
extra_ui = true;
};
mappings = {
basic = false;
};
autocommands = {
basic = true;
};
};
bracketed = {};
clue = {
clues.__raw = ''
{
{ mode = 'n', keys = '<Leader>e', desc = '+Explore/+Edit' },
{ mode = 'n', keys = '<Leader>f', desc = '+Find' },
{ mode = 'n', keys = '<Leader>g', desc = '+Git' },
{ mode = 'n', keys = '<Leader>l', desc = '+LSP' },
{ mode = 'x', keys = '<Leader>l', desc = '+LSP' },
require("mini.clue").gen_clues.builtin_completion(),
require("mini.clue").gen_clues.g(),
require("mini.clue").gen_clues.marks(),
require("mini.clue").gen_clues.registers(),
require("mini.clue").gen_clues.windows({ submode_resize = true }),
require("mini.clue").gen_clues.z(),
}
'';
triggers = [
{
mode = "n";
keys = "<Leader>";
}
{
mode = "x";
keys = "<Leader>";
}
{
mode = "n";
keys = "[";
}
{
mode = "n";
keys = "]";
}
{
mode = "x";
keys = "[";
}
{
mode = "x";
keys = "]";
}
{
mode = "i";
keys = "<C-x>";
}
{
mode = "n";
keys = "g";
}
{
mode = "x";
keys = "g";
}
{
mode = "n";
keys = "\"";
}
{
mode = "x";
keys = "\"";
}
{
mode = "i";
keys = "<C-r>";
}
{
mode = "c";
keys = "<C-r>";
}
{
mode = "n";
keys = "<C-w>";
}
{
mode = "n";
keys = "z";
}
{
mode = "x";
keys = "z";
}
{
mode = "n";
keys = "'";
}
{
mode = "n";
keys = "`";
}
{
mode = "x";
keys = "'";
}
{
mode = "x";
keys = "`";
}
];
};
comment = {};
diff = {};
extra = {};
git = {};
icons = {};
indentscope = {
settings = {
symbol = "|";
};
};
jump = {};
jump2d = {
settings = {
spotter.__raw = "require('mini.jump2d').gen_spotter.pattern('[^%s%p]+')";
labels = "asdfghjkl";
view = {
dim = true;
n_steps_ahead = 2;
};
};
};
move = {};
pairs = {};
pick = {};
starter = {};
statusline = {};
surround = {};
trailspace = {};
visits = {};
};
mockDevIcons = true;
};
}

View File

@@ -0,0 +1,27 @@
{
programs.nixvim.plugins.oil = {
enable = true;
settings = {
keymaps = {
"<C-r>" = "actions.refresh";
"<leader>qq" = "actions.close";
};
skip_confirm_for_simple_edits = true;
constrain_cursor = "editable";
default_file_explorer = true;
view_options = {
show_hidden = true;
};
win_options = {
concealcursor = "ncv";
conceallevel = 3;
cursorcolumn = false;
foldcolumn = "0";
list = false;
signcolumn = "no";
spell = false;
wrap = false;
};
};
};
}

View File

@@ -0,0 +1,20 @@
{
programs.nixvim.plugins.toggleterm = {
enable = true;
settings = {
open_mapping = null;
direction = "float";
float_opts = {
border = "curved";
winblend = 3;
};
size = 20;
hide_numbers = true;
shade_terminals = true;
shading_factor = 2;
start_in_insert = true;
close_on_exit = true;
shell = "fish";
};
};
}

View File

@@ -0,0 +1,22 @@
{pkgs, ...}: {
programs.nixvim.plugins.treesitter = {
enable = true;
settings = {
highlight.enable = true;
indent.enable = true;
};
grammarPackages = with pkgs.vimPlugins.nvim-treesitter.builtGrammars; [
bash
elixir
fish
heex
json
markdown
nix
toml
tsx
typescript
yaml
];
};
}

View File

@@ -0,0 +1,6 @@
{
programs.nixvim.plugins.zk = {
enable = true;
settings = {};
};
}

58
profiles/nixos.nix Normal file
View File

@@ -0,0 +1,58 @@
{
pkgs,
user,
constants,
...
}: {
security.sudo.enable = true;
system.stateVersion = constants.stateVersions.nixos;
time.timeZone = "UTC";
nix = {
settings.trusted-users = ["${user}"];
gc.dates = "weekly";
nixPath = ["nixos-config=/home/${user}/.local/share/src/nixos-config:/etc/nixos"];
};
boot = {
loader = {
systemd-boot = {
enable = true;
configurationLimit = 42;
};
efi.canTouchEfiVariables = true;
};
initrd.availableKernelModules = [
"xhci_pci"
"ahci"
"nvme"
"usbhid"
"usb_storage"
"sd_mod"
];
kernelPackages = pkgs.linuxPackages_latest;
};
users.users = {
${user} = {
isNormalUser = true;
home = "/home/${user}";
extraGroups = [
"wheel"
"sudo"
"network"
"systemd-journal"
"docker"
];
shell = pkgs.fish;
openssh.authorizedKeys.keys = constants.sshKeys;
};
root = {
openssh.authorizedKeys.keys = constants.sshKeys;
};
};
home-manager.useGlobalPkgs = true;
}

View File

@@ -0,0 +1,8 @@
{pkgs}:
pkgs.writeShellScriptBin "open-project" ''
TARGET=$(fd -t d --exact-depth 1 . $HOME/Projects |
sed "s~$HOME/Projects/~~" |
fzf --prompt "project > ")
zellij run -i -- /${pkgs.fish}/bin/fish -c "cd $HOME/Projects/$TARGET; fish"
''

26
profiles/opencode.nix Normal file
View File

@@ -0,0 +1,26 @@
{
inputs,
pkgs,
...
}: {
programs.opencode = {
enable = true;
package = inputs.nix-ai-tools.packages.${pkgs.system}.opencode;
settings = {
theme = "catppuccin";
instructions = [
"CLAUDE.md"
"AGENT.md"
"AGENTS.md"
];
formatter = {
mix = {
disabled = true;
};
};
};
};
home.sessionVariables = {
OPENCODE_EXPERIMENTAL_EXA = "true";
};
}

56
profiles/packages.nix Normal file
View File

@@ -0,0 +1,56 @@
{
pkgs,
inputs,
...
}:
with pkgs;
[
(callPackage ./open-project.nix {})
age
alejandra
ast-grep
bun
delta
devenv
dig
docker
docker-compose
fastfetch
fd
gh
git
gnumake
gnupg
hledger
htop
hyperfine
jq
killall
lsof
nurl
openssh
postgresql_17
sd
sops
sqlite
tokei
tree
tree-sitter
unzip
vivid
ov
zip
]
++ lib.optionals stdenv.isDarwin [
_1password-gui
dockutil
mas
raycast
tailscale
xcodes
]
++ lib.optionals stdenv.isLinux [
gcc15
lm_sensors
ghostty.terminfo
]

21
profiles/ripgrep.nix Normal file
View File

@@ -0,0 +1,21 @@
{
programs.ripgrep = {
enable = true;
arguments = [
"--max-columns=150"
"--max-columns-preview"
"--smart-case"
"--colors=column:none"
"--colors=column:fg:4"
"--colors=column:style:underline"
"--colors=line:none"
"--colors=line:fg:4"
"--colors=match:none"
"--colors=match:bg:0"
"--colors=match:fg:6"
"--colors=path:none"
"--colors=path:fg:14"
"--colors=path:style:bold"
];
};
}

25
profiles/ssh.nix Normal file
View File

@@ -0,0 +1,25 @@
{
pkgs,
lib,
user,
...
}: {
programs.ssh = {
enable = true;
enableDefaultConfig = false;
includes = [
(lib.mkIf pkgs.stdenv.hostPlatform.isLinux "/home/${user}/.ssh/config_external")
(lib.mkIf pkgs.stdenv.hostPlatform.isDarwin "/Users/${user}/.ssh/config_external")
];
matchBlocks = {
"*" = {};
"github.com" = {
identitiesOnly = true;
identityFile = [
(lib.mkIf pkgs.stdenv.hostPlatform.isLinux "/home/${user}/.ssh/id_ed25519")
(lib.mkIf pkgs.stdenv.hostPlatform.isDarwin "/Users/${user}/.ssh/id_ed25519")
];
};
};
};
}

45
profiles/starship.nix Normal file
View File

@@ -0,0 +1,45 @@
{
programs.starship = {
enable = true;
enableFishIntegration = true;
settings = {
add_newline = true;
command_timeout = 2000;
format = "[$directory$\{custom.jj}]($style)$character";
character = {
error_symbol = "[ ](bold #e64553)";
success_symbol = "[](bold #40a02b)[](bold #df8e1d)[](bold #dc8a78)";
};
directory = {
truncation_length = 2;
truncation_symbol = "/";
repo_root_style = "bold cyan";
repo_root_format = "[$repo_root]($repo_root_style)[$path]($style)[$read_only]($read_only_style) ";
};
custom.jj = {
command = ''
jj log --revisions @ --no-graph --ignore-working-copy --color always --limit 1 --template '
separate(" ",
change_id.shortest(4),
bookmarks,
"|",
concat(
if(conflict, "💥"),
if(divergent, "🚧"),
if(hidden, "👻"),
if(immutable, "🔒"),
),
raw_escape_sequence("\x1b[1;32m") ++ if(empty, "(empty)"),
raw_escape_sequence("\x1b[1;32m") ++ coalesce(
truncate_end(29, description.first_line(), ""),
"(no description set)",
) ++ raw_escape_sequence("\x1b[0m"),
)
'
'';
when = "jj --ignore-working-copy root";
symbol = "🥋";
};
};
};
}

53
profiles/syncthing.nix Normal file
View File

@@ -0,0 +1,53 @@
{
user,
pkgs,
...
}: let
isDarwin = pkgs.stdenv.isDarwin;
homeDir =
if isDarwin
then "/Users/${user}"
else "/home/${user}";
group =
if isDarwin
then "staff"
else "users";
in {
services.syncthing = {
enable = true;
openDefaultPorts = !isDarwin;
dataDir = "${homeDir}/.local/share/syncthing";
configDir = "${homeDir}/.config/syncthing";
user = "${user}";
group = group;
guiAddress = "0.0.0.0:8384";
overrideFolders = true;
overrideDevices = true;
settings = {
devices = {
"tahani" = {
id = "6B7OZZF-TEAMUGO-FBOELXP-Z4OY7EU-5ZHLB5T-V6Z3UDB-Q2DYR43-QBYW6QM";
addresses = ["tcp://tahani:22000"];
};
"jason" = {
id = "42II2VO-QYPJG26-ZS3MB2I-AOPVZ67-JJNSE76-U54CO5Y-634A5OG-ECU4YQA";
addresses = ["tcp://jason:22000"];
};
"chidi" = {
id = "N7W6SUT-QO6J4BE-T3Y65SM-OFGYGNV-TGYBJPX-JVN4Z72-AENZ247-KWXOQA6";
addresses = ["tcp://chidi:22000"];
};
};
folders = {
"nixos-config" = {
path = "${homeDir}/nixos-config";
devices = ["tahani" "jason" "chidi"];
};
};
options.globalAnnounceEnabled = false;
};
};
}

15
profiles/tailscale.nix Normal file
View File

@@ -0,0 +1,15 @@
{
lib,
pkgs,
...
}: {
services.tailscale =
{
enable = true;
}
// lib.optionalAttrs pkgs.stdenv.isLinux {
openFirewall = true;
permitCertUid = "caddy";
useRoutingFeatures = "server";
};
}

11
profiles/wallpaper.nix Normal file
View File

@@ -0,0 +1,11 @@
{pkgs}: let
wallpaper =
pkgs.fetchurl {
url = "https://misc-assets.raycast.com/wallpapers/bright-rain.png";
sha256 = "sha256-wQT4I2X3gS6QFsEb7MdRsn4oX7FNkflukXPGMFbJZ10=";
};
in
pkgs.writeShellScriptBin "set-wallpaper-script" ''
set -e
/usr/bin/osascript -e "tell application \"Finder\" to set desktop picture to POSIX file \"${wallpaper}\""
''

60
profiles/zellij.nix Normal file
View File

@@ -0,0 +1,60 @@
{
lib,
pkgs,
...
}: {
programs.zellij =
{
enable = true;
settings = {
theme = "catppuccin-latte";
default_layout = "default";
default_shell = "${pkgs.fish}/bin/fish";
pane_frames = false;
show_startup_tips = false;
show_release_notes = false;
};
}
// lib.optionalAttrs pkgs.stdenv.isLinux {
enableFishIntegration = true;
};
xdg.configFile."zellij/layouts/default.kdl".text = ''
layout {
default_tab_template {
pane split_direction="vertical" {
pane
}
pane size=1 borderless=true {
plugin location="file:${pkgs.zjstatus}/bin/zjstatus.wasm" {
hide_frame_for_single_pane "true"
format_left "{mode}#[fg=#1e66f5,bg=#eff1f5,bold] {session}#[bg=#eff1f5] {tabs}"
format_right "{datetime}"
format_space "#[bg=#eff1f5]"
mode_normal "#[fg=#eff1f5,bg=#1e66f5] "
mode_locked "#[fg=#eff1f5,bg=#fe640b] L "
mode_tab "#[fg=#eff1f5,bg=#40a02b] T "
mode_pane "#[fg=#eff1f5,bg=#8839ef] P "
mode_session "#[fg=#eff1f5,bg=#04a5e5] S "
mode_resize "#[fg=#eff1f5,bg=#df8e1d] R "
mode_move "#[fg=#eff1f5,bg=#ea76cb] M "
mode_search "#[fg=#eff1f5,bg=#d20f39] S "
tab_normal "#[fg=#acb0be,bg=#eff1f5] {index} {name} {fullscreen_indicator}{sync_indicator}{floating_indicator}"
tab_active "#[fg=#eff1f5,bg=#1e66f5,bold,underline] {index} {name} {fullscreen_indicator}{sync_indicator}{floating_indicator}"
tab_fullscreen_indicator " "
tab_sync_indicator " "
tab_floating_indicator "󰉈 "
datetime "#[fg=#4c4f69,bg=#eff1f5] {format} "
datetime_format "%A, %d %b %Y %H:%M"
datetime_timezone "Europe/Berlin"
}
}
}
}
'';
}

9
profiles/zk.nix Normal file
View File

@@ -0,0 +1,9 @@
{
programs.zk = {
enable = true;
settings = {};
};
home.sessionVariables = {
ZK_NOTEBOOK_DIR = "$HOME/Projects/Personal/Zettelkasten";
};
}

6
profiles/zoxide.nix Normal file
View File

@@ -0,0 +1,6 @@
{
programs.zoxide = {
enable = true;
enableFishIntegration = true;
};
}

5
profiles/zsh.nix Normal file
View File

@@ -0,0 +1,5 @@
{
programs.zsh = {
enable = true;
};
}