From 64596a073ca5b4e90caa1aa67d58e1c5deba8a5e Mon Sep 17 00:00:00 2001 From: Lukas Wurzinger Date: Tue, 25 Mar 2025 18:48:52 +0100 Subject: [PATCH] what --- flake.nix | 9 +- home/bash/.bashrc | 21 ++ .../.config/VSCodium/User/settings.json | 3 +- home/fish/.config/fish/config.fish | 5 + home/git/.config/git/config | 117 +++++++++- home/git/.config/git/config-personal | 4 + home/git/.config/git/ignore | 6 +- home/yazi/.config/yazi/theme.toml | 191 ---------------- home/yazi/.config/yazi/yazi.toml | 205 ------------------ packages/codeinit/codeinit.bash | 29 +++ packages/codeinit/package.nix | 6 + plow/default.nix => packages/plow/package.nix | 0 {plow => packages/plow}/plow.bash | 0 13 files changed, 192 insertions(+), 404 deletions(-) create mode 100644 home/git/.config/git/config-personal delete mode 100644 home/yazi/.config/yazi/theme.toml delete mode 100644 home/yazi/.config/yazi/yazi.toml create mode 100755 packages/codeinit/codeinit.bash create mode 100644 packages/codeinit/package.nix rename plow/default.nix => packages/plow/package.nix (100%) rename {plow => packages/plow}/plow.bash (100%) diff --git a/flake.nix b/flake.nix index 3756beb..4094722 100644 --- a/flake.nix +++ b/flake.nix @@ -3,9 +3,7 @@ inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; - flake-parts.url = "github:hercules-ci/flake-parts"; - devenv-root = { url = "file+file:///dev/null"; flake = false; @@ -33,9 +31,13 @@ perSystem = { pkgs, self', + lib, ... }: { - packages.plow = pkgs.callPackage ./plow {}; + packages = lib.packagesFromDirectoryRecursive { + inherit (pkgs) callPackage; + directory = ./packages; + }; devenv.shells.default = { devenv.root = let @@ -52,6 +54,7 @@ packages = [ self'.packages.plow + self'.packages.codeinit ]; }; }; diff --git a/home/bash/.bashrc b/home/bash/.bashrc index 85d8a4a..3357c37 100644 --- a/home/bash/.bashrc +++ b/home/bash/.bashrc @@ -1,8 +1,29 @@ # shellcheck shell=bash +shopt -s autocd globstar nullglob extglob checkwinsize + for rc in /etc/bashrc /etc/*.bashrc; do if [[ -e $rc ]]; then # shellcheck disable=SC1090 source "$rc" fi done + +if hash direnv 2>/dev/null; then + eval "$(direnv hook bash)" +fi + +if hash starship 2>/dev/null; then + eval "$(starship init bash)" +fi + +if hash nix 2>/dev/null; then + export PATH=${XDG_STATE_HOME:-~/.local/state}/nix/profile/bin:$PATH +fi + +if hash hx 2>/dev/null; then + export EDITOR=hx + export VISUAL=hx +fi + +export PATH=~/.local/bin:$PATH diff --git a/home/codium/.config/VSCodium/User/settings.json b/home/codium/.config/VSCodium/User/settings.json index f47b70c..826cfdf 100644 --- a/home/codium/.config/VSCodium/User/settings.json +++ b/home/codium/.config/VSCodium/User/settings.json @@ -1,5 +1,6 @@ { "workbench.colorTheme": "Orbi Blue", "files.insertFinalNewline": true, - "nix.enableLanguageServer": true + "nix.enableLanguageServer": true, + "php.suggest.basic": false } diff --git a/home/fish/.config/fish/config.fish b/home/fish/.config/fish/config.fish index 6bbbc85..67ad10c 100644 --- a/home/fish/.config/fish/config.fish +++ b/home/fish/.config/fish/config.fish @@ -32,6 +32,11 @@ if status is-interactive fish_add_path $parent/nix/profile/bin end + if type -q hx + set --export EDITOR hx + set --export VISUAL hx + end + fish_add_path ~/.local/bin abbr --add l ls diff --git a/home/git/.config/git/config b/home/git/.config/git/config index f759e09..26d0b10 100644 --- a/home/git/.config/git/config +++ b/home/git/.config/git/config @@ -1,12 +1,123 @@ [user] - name = Lukas Wurzinger - email = lukas@wrz.one - signingkey = ~/.ssh/id_ed25519.pub + # Error when the user has not explicitly been configured + useConfigOnly = true [core] + # Global gitignore excludesFile = ~/.config/git/ignore + # Don't paginate output by default + pager = cat + # Use Codium as default editor + editor = codium --wait + # Don't consider trailing space change as a cause for merge conflicts + whitespace = -trailing-space [init] defaultBranch = main [gpg] + # Use SSH keys for signing format = ssh [commit] + # Sign commits gpgsign = true +[push] + # Avoid having to manually set up remote branches + autoSetupRemote = true +[help] + # Only display suggestions + autoCorrect = 0 +[color] + # Pretty + ui = auto +[diff] + # Use better, descriptive initials (c, i, w) instead of a/b. + mnemonicPrefix = true + # Show renames/moves as such + renames = true + # When using --word-diff, assume --word-diff-regex=. + wordRegex = . + # Display submodule-related information (commit listings) + submodule = log + # Use VSCode as default diff tool when running `git difftool` + tool = codium +[difftool] + prompt = false +[difftool "codium"] + cmd = codium --wait --diff -- "$LOCAL" "$REMOTE" +[fetch] + # Auto-fetch submodule changes (won't auto-update) + recurseSubmodules = on-demand +[grep] + break = true + heading = true + lineNumber = true + # Consider most regexes to be ERE + extendedRegexp = true +[log] + # Use abbrev SHAs whenever possible/relevant instead of full 40 chars + abbrevCommit = true + # Automatically --follow when given a single path + follow = true +[merge] + # Display common-ancestor blocks in conflict hunks + conflictStyle = diff3 + # Disable fast-forward merges as default merge strategy + ff = false +[mergetool] + # Clean up backup files created by merge tools on tool exit + keepBackup = false + # Clean up temp files created by merge tools on tool exit + keepTemporaries = false + # Put the temp files in a dedicated dir anyway + writeToTemp = true + # Auto-accept file prompts when launching merge tools + prompt = false +[push] + # Default push should only push the current branch to its push target, regardless of its remote name + default = upstream + # When pushing, also push tags whose commit-ishs are now reachable upstream + followTags = true +[rebase] + # Automatically stash CWD and stage when running rebase + autoStash = true +[status] + # Display submodule rev change summaries in status + submoduleSummary = true + # Recursively traverse untracked directories to display all contents + showUntrackedFiles = all +[tag] + # Sort tags as version numbers whenever applicable + sort = version:refname +[alias] + # List available aliases + aliases = !git config --get-regexp '^alias\\.' | sed -E 's/^alias\\.//' + # Command shortcuts + ci = commit + co = checkout + st = status + sw = switch + rs = restore + # Update last commit with staged files without editing the commit message + oops = commit --amend --no-edit + # Ensure that force-pushing won't lose someone else's work (only mine) + push-with-lease = push --force-with-lease + # Replay each commit during rebase with the standard commit command which will trigger hooks + rebase-with-hooks = rebase --exec 'git reset --soft HEAD~1 && git commit -C HEAD@{1}' + # Review commit log + review = log --graph + # List local commits that were not pushed to remote repository + log-local = log @{push}.. + review-local = review @{push}.. + # Edit last commit message + reword = commit --amend + # Undo last commit but keep changed files in stage + uncommit = reset --soft HEAD~1 + # Remove file(s) from Git but not from disk + untrack = rm --cached -- + +[includeIf "gitdir:~/Personal/"] + path = config-personal + +[includeIf "gitdir:~/Work/"] + path = config-work + +[include] + path = config-local diff --git a/home/git/.config/git/config-personal b/home/git/.config/git/config-personal new file mode 100644 index 0000000..aa693bf --- /dev/null +++ b/home/git/.config/git/config-personal @@ -0,0 +1,4 @@ +[user] + name = Lukas Wurzinger + email = lukas@wrz.one + signingkey = ~/.ssh/id_ed25519.pub diff --git a/home/git/.config/git/ignore b/home/git/.config/git/ignore index c117e58..1d70d7d 100644 --- a/home/git/.config/git/ignore +++ b/home/git/.config/git/ignore @@ -47,5 +47,9 @@ zig-cache/ zig-out/ +.devenv* +devenv.local.nix + .direnv/ -.devenv/ + +.pre-commit-config.yaml diff --git a/home/yazi/.config/yazi/theme.toml b/home/yazi/.config/yazi/theme.toml deleted file mode 100644 index 2ae22f1..0000000 --- a/home/yazi/.config/yazi/theme.toml +++ /dev/null @@ -1,191 +0,0 @@ -# : Manager {{{ - -[manager] -cwd = { fg = "#94e2d5" } - -# Hovered -hovered = { reversed = true } -preview_hovered = { underline = true } - -# Find -find_keyword = { fg = "#f9e2af", bold = true, italic = true, underline = true } -find_position = { fg = "#f5c2e7", bg = "reset", bold = true, italic = true } - -# Marker -marker_copied = { fg = "#a6e3a1", bg = "#a6e3a1" } -marker_cut = { fg = "#f38ba8", bg = "#f38ba8" } -marker_marked = { fg = "#94e2d5", bg = "#94e2d5" } -marker_selected = { fg = "#f9e2af", bg = "#f9e2af" } - -# Tab -tab_active = { reversed = true } -tab_inactive = {} -tab_width = 1 - -# Count -count_copied = { fg = "#1e1e2e", bg = "#a6e3a1" } -count_cut = { fg = "#1e1e2e", bg = "#f38ba8" } -count_selected = { fg = "#1e1e2e", bg = "#f9e2af" } - -# Border -border_symbol = "│" -border_style = { fg = "#7f849c" } - -# : }}} - - -# : Mode {{{ - -[mode] - -normal_main = { fg = "#1e1e2e", bg = "#89b4fa", bold = true } -normal_alt = { fg = "#89b4fa", bg = "#313244" } - -# Select mode -select_main = { fg = "#1e1e2e", bg = "#a6e3a1", bold = true } -select_alt = { fg = "#a6e3a1", bg = "#313244" } - -# Unset mode -unset_main = { fg = "#1e1e2e", bg = "#f2cdcd", bold = true } -unset_alt = { fg = "#f2cdcd", bg = "#313244" } - -# : }}} - - -# : Status bar {{{ - -[status] -separator_open = "" -separator_close = "" - -# Progress -progress_label = { fg = "#ffffff", bold = true } -progress_normal = { fg = "#89b4fa", bg = "#45475a" } -progress_error = { fg = "#f38ba8", bg = "#45475a" } - -# Permissions -perm_sep = { fg = "#7f849c" } -perm_type = { fg = "#89b4fa" } -perm_read = { fg = "#f9e2af" } -perm_write = { fg = "#f38ba8" } -perm_exec = { fg = "#a6e3a1" } - -# TODO: -- remove these once Yazi 0.4 gets released -separator_style = { fg = "#313244", bg = "#313244" } -mode_normal = { fg = "#1e1e2e", bg = "#89b4fa", bold = true } -mode_select = { fg = "#1e1e2e", bg = "#a6e3a1", bold = true } -mode_unset = { fg = "#1e1e2e", bg = "#f2cdcd", bold = true } -permissions_t = { fg = "#89b4fa" } -permissions_r = { fg = "#f9e2af" } -permissions_w = { fg = "#f38ba8" } -permissions_x = { fg = "#a6e3a1" } -permissions_s = { fg = "#7f849c" } -# TODO: remove these once Yazi 0.4 gets released -- - -# : }}} - - -# : Pick {{{ - -[pick] -border = { fg = "#89b4fa" } -active = { fg = "#f5c2e7", bold = true } -inactive = {} - -# TODO: -- remove these once Yazi 0.4 gets released -[select] -border = { fg = "#89b4fa" } -active = { fg = "#f5c2e7", bold = true } -inactive = {} -# TODO: remove these once Yazi 0.4 gets released -- - -# : }}} - - -# : Input {{{ - -[input] -border = { fg = "#89b4fa" } -title = {} -value = {} -selected = { reversed = true } - -# : }}} - - -# : Completion {{{ - -[completion] -border = { fg = "#89b4fa" } - -# : }}} - - -# : Tasks {{{ - -[tasks] -border = { fg = "#89b4fa" } -title = {} -hovered = { fg = "#f5c2e7", underline = true } - -# : }}} - - -# : Which {{{ - -[which] -mask = { bg = "#313244" } -cand = { fg = "#94e2d5" } -rest = { fg = "#9399b2" } -desc = { fg = "#f5c2e7" } -separator = "  " -separator_style = { fg = "#585b70" } - -# : }}} - - -# : Help {{{ - -[help] -on = { fg = "#94e2d5" } -run = { fg = "#f5c2e7" } -hovered = { reversed = true, bold = true } -footer = { fg = "#313244", bg = "#cdd6f4" } - -# : }}} - - -# : Notify {{{ - -[notify] -title_info = { fg = "#a6e3a1" } -title_warn = { fg = "#f9e2af" } -title_error = { fg = "#f38ba8" } - -# : }}} - - -# : File-specific styles {{{ - -[filetype] - -rules = [ - # Images - { mime = "image/*", fg = "#94e2d5" }, - - # Media - { mime = "{audio,video}/*", fg = "#f9e2af" }, - - # Archives - { mime = "application/*zip", fg = "#f5c2e7" }, - { mime = "application/x-{tar,bzip*,7z-compressed,xz,rar}", fg = "#f5c2e7" }, - - # Documents - { mime = "application/{pdf,doc,rtf}", fg = "#a6e3a1" }, - - # Fallback - { name = "*", fg = "#cdd6f4" }, - { name = "*/", fg = "#89b4fa" } -] - -# : }}} diff --git a/home/yazi/.config/yazi/yazi.toml b/home/yazi/.config/yazi/yazi.toml deleted file mode 100644 index ea50279..0000000 --- a/home/yazi/.config/yazi/yazi.toml +++ /dev/null @@ -1,205 +0,0 @@ -"$schema" = "https://yazi-rs.github.io/schemas/yazi.json" - -[manager] -sort_by = "natural" -sort_sensitive = true -sort_reverse = false -sort_dir_first = true -sort_translit = true - -linemode = "size" -show_hidden = false -show_symlink = true -scrolloff = 5 -title_format = "Yazi: {cwd}" - -[preview] -wrap = "no" -tab_size = 4 - -[opener] -# TODO - -edit = [ - { run = '${EDITOR:-hx} "$@"', desc = "$EDITOR", block = true, for = "unix" }, -] -open = [ - { run = 'xdg-open -- "$1"', desc = "Open", for = "unix" }, -] -reveal = [ - { run = 'xdg-open -- "$(dirname -- "$1")"', desc = "Reveal", for = "unix" }, - { run = '''exiftool -- "$1"; echo "Press enter to exit"; read _''', block = true, desc = "Show EXIF", for = "unix" }, -] -extract = [ - { run = 'ya pub extract --list "$@"', desc = "Extract here", for = "unix" }, -] -play = [ - { run = 'xdg-open -- "$@"', orphan = true, for = "unix" }, - { run = '''mediainfo "$1"; echo "Press enter to exit"; read _''', block = true, desc = "Show media info", for = "unix" }, -] - -[open] -# TODO - -rules = [ - # Folder - { name = "*/", use = [ "edit", "open", "reveal" ] }, - # Text - { mime = "text/*", use = [ "edit", "reveal" ] }, - # Image - { mime = "image/*", use = [ "open", "reveal" ] }, - # Media - { mime = "{audio,video}/*", use = [ "play", "reveal" ] }, - # Archive - { mime = "application/{zip,rar,7z*,tar,gzip,xz,zstd,bzip*,lzma,compress,archive,cpio,arj,xar,ms-cab*}", use = [ "extract", "reveal" ] }, - # JSON - { mime = "application/{json,ndjson}", use = [ "edit", "reveal" ] }, - { mime = "*/javascript", use = [ "edit", "reveal" ] }, - # Empty file - { mime = "inode/empty", use = [ "edit", "reveal" ] }, - # Fallback - { name = "*", use = [ "open", "reveal" ] }, -] - -[plugin] -# TODO - -fetchers = [ - # Mimetype - { id = "mime", name = "*", run = "mime", if = "!mime", prio = "high" }, -] -spotters = [ - { name = "*/", run = "folder" }, - # Code - { mime = "text/*", run = "code" }, - { mime = "*/{xml,javascript,wine-extension-ini}", run = "code" }, - # Image - { mime = "image/{avif,hei?,jxl,svg+xml}", run = "magick" }, - { mime = "image/*", run = "image" }, - # Video - { mime = "video/*", run = "video" }, - # Fallback - { name = "*", run = "file" }, -] -preloaders = [ - # Image - { mime = "image/{avif,hei?,jxl,svg+xml}", run = "magick" }, - { mime = "image/*", run = "image" }, - # Video - { mime = "video/*", run = "video" }, - # PDF - { mime = "application/pdf", run = "pdf" }, - # Font - { mime = "font/*", run = "font" }, - { mime = "application/ms-opentype", run = "font" }, -] -previewers = [ - { name = "*/", run = "folder", sync = true }, - # Code - { mime = "text/*", run = "code" }, - { mime = "*/{xml,javascript,wine-extension-ini}", run = "code" }, - # JSON - { mime = "application/{json,ndjson}", run = "json" }, - # Image - { mime = "image/{avif,hei?,jxl,svg+xml}", run = "magick" }, - { mime = "image/*", run = "image" }, - # Video - { mime = "video/*", run = "video" }, - # PDF - { mime = "application/pdf", run = "pdf" }, - # Archive - { mime = "application/{zip,rar,7z*,tar,gzip,xz,zstd,bzip*,lzma,compress,archive,cpio,arj,xar,ms-cab*}", run = "archive" }, - { mime = "application/{debian*-package,redhat-package-manager,rpm,android.package-archive}", run = "archive" }, - { name = "*.{AppImage,appimage}", run = "archive" }, - # Virtual Disk / Disk Image - { mime = "application/{iso9660-image,qemu-disk,ms-wim,apple-diskimage}", run = "archive" }, - { mime = "application/virtualbox-{vhd,vhdx}", run = "archive" }, - { name = "*.{img,fat,ext,ext2,ext3,ext4,squashfs,ntfs,hfs,hfsx}", run = "archive" }, - # Font - { mime = "font/*", run = "font" }, - { mime = "application/ms-opentype", run = "font" }, - # Empty file - { mime = "inode/empty", run = "empty" }, - # Fallback - { name = "*", run = "file" }, -] - -[input] -# TODO - -cursor_blink = false - -# cd -cd_title = "Change directory:" -cd_origin = "top-center" -cd_offset = [ 0, 2, 50, 3 ] - -# create -create_title = [ "Create:", "Create (dir):" ] -create_origin = "top-center" -create_offset = [ 0, 2, 50, 3 ] - -# rename -rename_title = "Rename:" -rename_origin = "hovered" -rename_offset = [ 0, 1, 50, 3 ] - -# filter -filter_title = "Filter:" -filter_origin = "top-center" -filter_offset = [ 0, 2, 50, 3 ] - -# find -find_title = [ "Find next:", "Find previous:" ] -find_origin = "top-center" -find_offset = [ 0, 2, 50, 3 ] - -# search -search_title = "Search via {n}:" -search_origin = "top-center" -search_offset = [ 0, 2, 50, 3 ] - -# shell -shell_title = [ "Shell:", "Shell (block):" ] -shell_origin = "top-center" -shell_offset = [ 0, 2, 50, 3 ] - -[confirm] -# TODO - -# trash -trash_title = "Trash {n} selected file{s}?" -trash_origin = "center" -trash_offset = [ 0, 0, 70, 20 ] - -# delete -delete_title = "Permanently delete {n} selected file{s}?" -delete_origin = "center" -delete_offset = [ 0, 0, 70, 20 ] - -# overwrite -overwrite_title = "Overwrite file?" -overwrite_content = "Will overwrite the following file:" -overwrite_origin = "center" -overwrite_offset = [ 0, 0, 50, 15 ] - -# quit -quit_title = "Quit?" -quit_content = "The following task is still running, are you sure you want to quit?" -quit_origin = "center" -quit_offset = [ 0, 0, 50, 15 ] - -[pick] -# TODO - -open_title = "Open with:" -open_origin = "hovered" -open_offset = [ 0, 1, 50, 7 ] - -[which] -# TODO - -sort_by = "none" -sort_sensitive = false -sort_reverse = false -sort_translit = false diff --git a/packages/codeinit/codeinit.bash b/packages/codeinit/codeinit.bash new file mode 100755 index 0000000..da634ad --- /dev/null +++ b/packages/codeinit/codeinit.bash @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +set -o errexit +set -o nounset +set -o pipefail + +extensions=( + anishde12020.orbi + jnoortheen.nix-ide + llvm-vs-code-extensions.vscode-clangd + mkhl.direnv + phpactor.vscode-phpactor + rust-lang.rust-analyzer + tamasfe.even-better-toml + vscodevim.vim + xdebug.php-debug + "$@" +) + +if ! hash codium; then + exit 1 +fi + +args=() +for ext in "${extensions[@]}"; do + args+=(--install-extension "$ext") +done + +codium "${args[@]}" diff --git a/packages/codeinit/package.nix b/packages/codeinit/package.nix new file mode 100644 index 0000000..a09519d --- /dev/null +++ b/packages/codeinit/package.nix @@ -0,0 +1,6 @@ +{writeShellApplication}: +writeShellApplication { + name = "codeinit"; + + text = builtins.readFile ./codeinit.bash; +} diff --git a/plow/default.nix b/packages/plow/package.nix similarity index 100% rename from plow/default.nix rename to packages/plow/package.nix diff --git a/plow/plow.bash b/packages/plow/plow.bash similarity index 100% rename from plow/plow.bash rename to packages/plow/plow.bash