From 5a0a85aed973c1fe71b6c31edfa3d5ff14dc2621 Mon Sep 17 00:00:00 2001 From: Lukas Wurzinger Date: Sun, 29 Dec 2024 22:20:56 +0100 Subject: [PATCH 01/10] stuff --- .envrc | 10 +- .gitignore | 3 + devenv.nix | 14 ++ flake.lock | 277 ++++++++++++++++++++-- flake.nix | 28 ++- home/bash/.bashrc | 9 +- home/bottom/.config/bottom/bottom.toml | 15 ++ home/gitui/.config/gitui/key_bindings.ron | 31 +++ home/ssh/.ssh/config | 2 + home/yazi/.config/yazi/theme.toml | 191 +++++++++++++++ home/yazi/.config/yazi/yazi.toml | 205 ++++++++++++++++ 11 files changed, 766 insertions(+), 19 deletions(-) create mode 100644 devenv.nix create mode 100644 home/bottom/.config/bottom/bottom.toml create mode 100644 home/gitui/.config/gitui/key_bindings.ron create mode 100644 home/yazi/.config/yazi/theme.toml create mode 100644 home/yazi/.config/yazi/yazi.toml diff --git a/.envrc b/.envrc index 3550a30..cb982f0 100644 --- a/.envrc +++ b/.envrc @@ -1 +1,9 @@ -use flake +watch_file flake.nix +watch_file flake.lock + +DEVENV_ROOT_FILE="$(mktemp)" +printf %s "$PWD" > "$DEVENV_ROOT_FILE" +if ! use flake . --override-input devenv-root "file+file://$DEVENV_ROOT_FILE" +then + echo "devenv could not be built. The devenv environment was not loaded. Make the necessary changes to devenv.nix and hit enter to try again." >&2 +fi diff --git a/.gitignore b/.gitignore index 9b42106..55281ec 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,4 @@ .direnv/ +.devenv/ + +.pre-commit-config.yaml diff --git a/devenv.nix b/devenv.nix new file mode 100644 index 0000000..67c93b5 --- /dev/null +++ b/devenv.nix @@ -0,0 +1,14 @@ +{ + pre-commit.hooks = { + # Nix + alejandra.enable = true; + deadnix.enable = true; + statix.enable = true; + + # Flakes + flake-checker.enable = true; + + # Shell + shellcheck.enable = true; + }; +} diff --git a/flake.lock b/flake.lock index 0e97f2c..e69b4dc 100644 --- a/flake.lock +++ b/flake.lock @@ -1,15 +1,97 @@ { "nodes": { - "flake-parts": { + "cachix": { "inputs": { - "nixpkgs-lib": "nixpkgs-lib" + "devenv": [ + "devenv" + ], + "flake-compat": [ + "devenv" + ], + "git-hooks": [ + "devenv" + ], + "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1726153070, - "narHash": "sha256-HO4zgY0ekfwO5bX0QH/3kJ/h4KvUDFZg8YpkNwIbg1U=", + "lastModified": 1728672398, + "narHash": "sha256-KxuGSoVUFnQLB2ZcYODW7AVPAh9JqRlD5BrfsC/Q4qs=", + "owner": "cachix", + "repo": "cachix", + "rev": "aac51f698309fd0f381149214b7eee213c66ef0a", + "type": "github" + }, + "original": { + "owner": "cachix", + "ref": "latest", + "repo": "cachix", + "type": "github" + } + }, + "devenv": { + "inputs": { + "cachix": "cachix", + "flake-compat": "flake-compat", + "git-hooks": "git-hooks", + "nix": "nix", + "nixpkgs": "nixpkgs_3" + }, + "locked": { + "lastModified": 1735241861, + "narHash": "sha256-n8Ww/v5eCKi0+zGe+5nfAPpxGsYu4MRWokWyzryswS4=", + "owner": "cachix", + "repo": "devenv", + "rev": "991abff153b995192bf36655394246fc97ba8627", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "devenv", + "type": "github" + } + }, + "devenv-root": { + "flake": false, + "locked": { + "narHash": "sha256-d6xi4mKdjkX2JFicDIv5niSzpyI0m/Hnm8GGAIU04kY=", + "type": "file", + "url": "file:///dev/null" + }, + "original": { + "type": "file", + "url": "file:///dev/null" + } + }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": [ + "devenv", + "nix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1712014858, + "narHash": "sha256-sB4SWl2lX95bExY2gMFG5HIzvva5AVMJd4Igm+GpZNw=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "bcef6817a8b2aa20a5a6dbb19b43e63c5bf8619a", + "rev": "9126214d0a59633752a136528f5f3b9aa8565b7d", "type": "github" }, "original": { @@ -18,13 +100,130 @@ "type": "github" } }, + "flake-parts_2": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1733312601, + "narHash": "sha256-4pDvzqnegAfRkPwO3wmwBhVi/Sye1mzps0zHWYnP88c=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "205b12d8b7cd4802fbcb8e8ef6a0f1408781a4f9", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "git-hooks": { + "inputs": { + "flake-compat": [ + "devenv" + ], + "gitignore": "gitignore", + "nixpkgs": [ + "devenv", + "nixpkgs" + ], + "nixpkgs-stable": [ + "devenv" + ] + }, + "locked": { + "lastModified": 1730302582, + "narHash": "sha256-W1MIJpADXQCgosJZT8qBYLRuZls2KSiKdpnTVdKBuvU=", + "owner": "cachix", + "repo": "git-hooks.nix", + "rev": "af8a16fe5c264f5e9e18bcee2859b40a656876cf", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "git-hooks.nix", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "devenv", + "git-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709087332, + "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "libgit2": { + "flake": false, + "locked": { + "lastModified": 1697646580, + "narHash": "sha256-oX4Z3S9WtJlwvj0uH9HlYcWv+x1hqp8mhXl7HsLu2f0=", + "owner": "libgit2", + "repo": "libgit2", + "rev": "45fd9ed7ae1a9b74b957ef4f337bc3c8b3df01b5", + "type": "github" + }, + "original": { + "owner": "libgit2", + "repo": "libgit2", + "type": "github" + } + }, + "nix": { + "inputs": { + "flake-compat": [ + "devenv" + ], + "flake-parts": "flake-parts", + "libgit2": "libgit2", + "nixpkgs": "nixpkgs_2", + "nixpkgs-23-11": [ + "devenv" + ], + "nixpkgs-regression": [ + "devenv" + ], + "pre-commit-hooks": [ + "devenv" + ] + }, + "locked": { + "lastModified": 1727438425, + "narHash": "sha256-X8ES7I1cfNhR9oKp06F6ir4Np70WGZU5sfCOuNBEwMg=", + "owner": "domenkozar", + "repo": "nix", + "rev": "f6c5ae4c1b2e411e6b1e6a8181cc84363d6a7546", + "type": "github" + }, + "original": { + "owner": "domenkozar", + "ref": "devenv-2.24", + "repo": "nix", + "type": "github" + } + }, "nixpkgs": { "locked": { - "lastModified": 1726243404, - "narHash": "sha256-sjiGsMh+1cWXb53Tecsm4skyFNag33GPbVgCdfj3n9I=", + "lastModified": 1730531603, + "narHash": "sha256-Dqg6si5CqIzm87sp57j5nTaeBbWhHFaVyG7V6L8k3lY=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "345c263f2f53a3710abe117f28a5cb86d0ba4059", + "rev": "7ffd9ae656aec493492b44d0ddfb28e79a1ea25d", "type": "github" }, "original": { @@ -36,20 +235,70 @@ }, "nixpkgs-lib": { "locked": { - "lastModified": 1725233747, - "narHash": "sha256-Ss8QWLXdr2JCBPcYChJhz4xJm+h/xjl4G0c0XlP6a74=", + "lastModified": 1733096140, + "narHash": "sha256-1qRH7uAUsyQI7R1Uwl4T+XvdNv778H0Nb5njNrqvylY=", "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/356624c12086a18f2ea2825fed34523d60ccc4e3.tar.gz" + "url": "https://github.com/NixOS/nixpkgs/archive/5487e69da40cbd611ab2cadee0b4637225f7cfae.tar.gz" }, "original": { "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/356624c12086a18f2ea2825fed34523d60ccc4e3.tar.gz" + "url": "https://github.com/NixOS/nixpkgs/archive/5487e69da40cbd611ab2cadee0b4637225f7cfae.tar.gz" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1717432640, + "narHash": "sha256-+f9c4/ZX5MWDOuB1rKoWj+lBNm0z0rs4CK47HBLxy1o=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "88269ab3044128b7c2f4c7d68448b2fb50456870", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "release-24.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_3": { + "locked": { + "lastModified": 1716977621, + "narHash": "sha256-Q1UQzYcMJH4RscmpTkjlgqQDX5yi1tZL0O345Ri6vXQ=", + "owner": "cachix", + "repo": "devenv-nixpkgs", + "rev": "4267e705586473d3e5c8d50299e71503f16a6fb6", + "type": "github" + }, + "original": { + "owner": "cachix", + "ref": "rolling", + "repo": "devenv-nixpkgs", + "type": "github" + } + }, + "nixpkgs_4": { + "locked": { + "lastModified": 1735291276, + "narHash": "sha256-NYVcA06+blsLG6wpAbSPTCyLvxD/92Hy4vlY9WxFI1M=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "634fd46801442d760e09493a794c4f15db2d0cbb", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" } }, "root": { "inputs": { - "flake-parts": "flake-parts", - "nixpkgs": "nixpkgs" + "devenv": "devenv", + "devenv-root": "devenv-root", + "flake-parts": "flake-parts_2", + "nixpkgs": "nixpkgs_4" } } }, diff --git a/flake.nix b/flake.nix index e6e57f7..ac67885 100644 --- a/flake.nix +++ b/flake.nix @@ -3,7 +3,14 @@ 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; + }; + devenv.url = "github:cachix/devenv"; }; outputs = { @@ -12,6 +19,10 @@ ... } @ inputs: flake-parts.lib.mkFlake {inherit inputs;} { + imports = [ + inputs.devenv.flakeModule + ]; + systems = nixpkgs.lib.systems.flakeExposed; perSystem = { @@ -21,10 +32,21 @@ }: { packages.plow = pkgs.callPackage ./plow {}; - devShells.default = pkgs.mkShellNoCC { - PLOW_FROM = "./home"; + devenv.shells.default = { + devenv.root = let + devenvRootFileContent = builtins.readFile inputs.devenv-root.outPath; + in + pkgs.lib.mkIf (devenvRootFileContent != "") devenvRootFileContent; - packages = [self'.packages.plow]; + env.PLOW_FROM = "./home"; + + imports = [ + ./devenv.nix + ]; + + packages = [ + self'.packages.plow + ]; }; }; }; diff --git a/home/bash/.bashrc b/home/bash/.bashrc index fc25da9..85d8a4a 100644 --- a/home/bash/.bashrc +++ b/home/bash/.bashrc @@ -1 +1,8 @@ -source /etc/bash.bashrc +# shellcheck shell=bash + +for rc in /etc/bashrc /etc/*.bashrc; do + if [[ -e $rc ]]; then + # shellcheck disable=SC1090 + source "$rc" + fi +done diff --git a/home/bottom/.config/bottom/bottom.toml b/home/bottom/.config/bottom/bottom.toml new file mode 100644 index 0000000..f276947 --- /dev/null +++ b/home/bottom/.config/bottom/bottom.toml @@ -0,0 +1,15 @@ +[flags] +rate = "1s" +retention = "10m" + +temperature_type = "celsius" + +battery = true +enable_cache_memory = true + +tree = true +show_table_scroll_position = true +process_command = false + +[styles] +theme = "gruvbox" diff --git a/home/gitui/.config/gitui/key_bindings.ron b/home/gitui/.config/gitui/key_bindings.ron new file mode 100644 index 0000000..edfc963 --- /dev/null +++ b/home/gitui/.config/gitui/key_bindings.ron @@ -0,0 +1,31 @@ +( + open_help: Some(( code: F(1), modifiers: "")), + + move_left: Some(( code: Char('h'), modifiers: "")), + move_right: Some(( code: Char('l'), modifiers: "")), + move_up: Some(( code: Char('k'), modifiers: "")), + move_down: Some(( code: Char('j'), modifiers: "")), + + popup_up: Some(( code: Char('p'), modifiers: "CONTROL")), + popup_down: Some(( code: Char('n'), modifiers: "CONTROL")), + page_up: Some(( code: Char('b'), modifiers: "CONTROL")), + page_down: Some(( code: Char('f'), modifiers: "CONTROL")), + home: Some(( code: Char('g'), modifiers: "")), + end: Some(( code: Char('G'), modifiers: "SHIFT")), + shift_up: Some(( code: Char('K'), modifiers: "SHIFT")), + shift_down: Some(( code: Char('J'), modifiers: "SHIFT")), + + edit_file: Some(( code: Char('I'), modifiers: "SHIFT")), + + status_reset_item: Some(( code: Char('U'), modifiers: "SHIFT")), + + diff_reset_lines: Some(( code: Char('u'), modifiers: "")), + diff_stage_lines: Some(( code: Char('s'), modifiers: "")), + + stashing_save: Some(( code: Char('w'), modifiers: "")), + stashing_toggle_index: Some(( code: Char('m'), modifiers: "")), + + stash_open: Some(( code: Char('l'), modifiers: "")), + + abort_merge: Some(( code: Char('M'), modifiers: "SHIFT")), +) diff --git a/home/ssh/.ssh/config b/home/ssh/.ssh/config index 7a61ca4..39f4d46 100644 --- a/home/ssh/.ssh/config +++ b/home/ssh/.ssh/config @@ -1,3 +1,5 @@ +Include local/* + Host * Compression yes ServerAliveInterval 60 diff --git a/home/yazi/.config/yazi/theme.toml b/home/yazi/.config/yazi/theme.toml new file mode 100644 index 0000000..2ae22f1 --- /dev/null +++ b/home/yazi/.config/yazi/theme.toml @@ -0,0 +1,191 @@ +# : 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 new file mode 100644 index 0000000..ea50279 --- /dev/null +++ b/home/yazi/.config/yazi/yazi.toml @@ -0,0 +1,205 @@ +"$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 From d45aacbead4c5fa8efe7c375153521eae1822f92 Mon Sep 17 00:00:00 2001 From: Lukas Wurzinger Date: Fri, 3 Jan 2025 21:37:12 +0100 Subject: [PATCH 02/10] fix python --- home/helix/.config/helix/languages.toml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/home/helix/.config/helix/languages.toml b/home/helix/.config/helix/languages.toml index cef97d7..53b2495 100644 --- a/home/helix/.config/helix/languages.toml +++ b/home/helix/.config/helix/languages.toml @@ -1,3 +1,8 @@ [[language]] name = "gotmpl" file-types = ["tmpl"] + +[[language]] +name = "python" +language-servers = [ "basedpyright" ] +formatter = {command = 'ruff', args = ["format", "--quiet", "-"]} From b7e9b356d8e43430f20e04b4b6a02ea90efc38f2 Mon Sep 17 00:00:00 2001 From: Lukas Wurzinger Date: Sun, 5 Jan 2025 15:22:27 +0100 Subject: [PATCH 03/10] clean dead links --- .gitignore | 2 ++ flake.nix | 1 + plow/plow.bash | 50 ++++++++++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 51 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 55281ec..106935f 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ .devenv/ .pre-commit-config.yaml + +.plowcache diff --git a/flake.nix b/flake.nix index ac67885..222e809 100644 --- a/flake.nix +++ b/flake.nix @@ -39,6 +39,7 @@ pkgs.lib.mkIf (devenvRootFileContent != "") devenvRootFileContent; env.PLOW_FROM = "./home"; + env.PLOW_CACHE = "./.plowcache"; imports = [ ./devenv.nix diff --git a/plow/plow.bash b/plow/plow.bash index 5ad0e12..37d3210 100755 --- a/plow/plow.bash +++ b/plow/plow.bash @@ -4,9 +4,30 @@ set -o errexit set -o nounset set -o pipefail +progname="$0" + +error() { + local line + for line in "$@"; do + echo "$progname: $line" 1>&2 + done + + exit 1 +} + shopt -s nullglob globstar -opts=$(getopt --options f:t:Fivm: --longoptions=from:,to:,force,interactive,verbose,directory-mode: --name "$0" -- "$@") +if [[ ! -v PLOW_CACHE ]]; then + PLOW_CACHE=.plowcache +fi + +opts=$( + getopt \ + --options f:t:Fivm: \ + --longoptions from:,to:,force,interactive,verbose,directory-mode: \ + --name "$0" \ + -- "$@" +) eval set -- "$opts" @@ -14,6 +35,7 @@ from=${PLOW_FROM:-$PWD} to=${PLOW_TO:-$HOME} lnflags=() mkdirflags=() +rmflags=() while true; do case "$1" in -f | --from) @@ -26,15 +48,18 @@ while true; do ;; -F | --force) lnflags+=(--force) + rmflags+=(--force) shift ;; -i | --interactive) lnflags+=(--interactive) + rmflags+=(--interactive) shift ;; -v | --verbose) lnflags+=(--verbose) mkdirflags+=(--verbose) + rmflags+=(--verbose) shift ;; -m | --directory-mode) @@ -62,13 +87,34 @@ fi shopt -s dotglob +cache=() +if [[ -n "$PLOW_CACHE" ]]; then + if [[ -e "$PLOW_CACHE" ]]; then + while IFS= read -r link; do + cache+=("$link") + done < "$PLOW_CACHE" + fi + + : > "$PLOW_CACHE" +fi + for choice in "${choices[@]}"; do prefix=$from/$choice for target in "$prefix"/**/*; do if [[ -f "$target" ]]; then link=$to${target#"$prefix"} - mkdir --parents "${mkdirflags[@]}" -- "$(dirname -- "$link")" + parent=$(dirname -- "$link") + mkdir --parents "${mkdirflags[@]}" -- "$parent" ln --symbolic "${lnflags[@]}" -- "$target" "$link" + if [[ -n "$PLOW_CACHE" ]]; then + echo "$link" >> "$PLOW_CACHE" + fi fi done done + +for link in "${cache[@]}"; do + if [[ -L "$link" && ! -f "$link" ]]; then + rm "${rmflags[@]}" -- "$link" + fi +done From 4f6281d4d518a753e43f3e189e5c573b0232abbb Mon Sep 17 00:00:00 2001 From: Lukas Wurzinger Date: Sun, 5 Jan 2025 15:23:39 +0100 Subject: [PATCH 04/10] suggest --verbose --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5642066..6c8c0a3 100644 --- a/README.md +++ b/README.md @@ -11,11 +11,11 @@ pacman --sync - < packages.txt ## Installing dotfiles ```shell -plow --force +plow --force --verbose ``` or... ```shell -plow --force --from ./home --to ~ +plow --force --verbose --from ./home --to ~ ``` From fa30c4d8269312de36a6d774314bd8cc7edba06e Mon Sep 17 00:00:00 2001 From: Lukas Wurzinger Date: Sun, 5 Jan 2025 15:24:37 +0100 Subject: [PATCH 05/10] naming --- plow/plow.bash | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plow/plow.bash b/plow/plow.bash index 37d3210..e408b2f 100755 --- a/plow/plow.bash +++ b/plow/plow.bash @@ -21,7 +21,7 @@ if [[ ! -v PLOW_CACHE ]]; then PLOW_CACHE=.plowcache fi -opts=$( +args=$( getopt \ --options f:t:Fivm: \ --longoptions from:,to:,force,interactive,verbose,directory-mode: \ @@ -29,7 +29,7 @@ opts=$( -- "$@" ) -eval set -- "$opts" +eval set -- "$args" from=${PLOW_FROM:-$PWD} to=${PLOW_TO:-$HOME} From 92f097cb82736b0061c413003662d7f5ddac9880 Mon Sep 17 00:00:00 2001 From: Lukas Wurzinger Date: Sat, 1 Mar 2025 22:34:30 +0100 Subject: [PATCH 06/10] =?UTF-8?q?pluh=20=F0=9F=97=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 8 +- flake.lock | 65 ++++---- flake.nix | 5 + .../.config/VSCodium/User/settings.json | 5 + home/fish/.config/fish/config.fish | 14 +- home/nix/.config/nix/nix.conf | 2 + packages.txt | 12 -- plow/plow.bash | 148 +++++++++--------- 8 files changed, 127 insertions(+), 132 deletions(-) create mode 100644 home/codium/.config/VSCodium/User/settings.json delete mode 100644 packages.txt diff --git a/README.md b/README.md index 6c8c0a3..e307f26 100644 --- a/README.md +++ b/README.md @@ -2,13 +2,7 @@ My dotfiles. -## Installing packages - -```shell -pacman --sync - < packages.txt -``` - -## Installing dotfiles +## Usage ```shell plow --force --verbose diff --git a/flake.lock b/flake.lock index e69b4dc..ce483c2 100644 --- a/flake.lock +++ b/flake.lock @@ -14,11 +14,11 @@ "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1728672398, - "narHash": "sha256-KxuGSoVUFnQLB2ZcYODW7AVPAh9JqRlD5BrfsC/Q4qs=", + "lastModified": 1737621947, + "narHash": "sha256-8HFvG7fvIFbgtaYAY2628Tb89fA55nPm2jSiNs0/Cws=", "owner": "cachix", "repo": "cachix", - "rev": "aac51f698309fd0f381149214b7eee213c66ef0a", + "rev": "f65a3cd5e339c223471e64c051434616e18cc4f5", "type": "github" }, "original": { @@ -37,11 +37,11 @@ "nixpkgs": "nixpkgs_3" }, "locked": { - "lastModified": 1735241861, - "narHash": "sha256-n8Ww/v5eCKi0+zGe+5nfAPpxGsYu4MRWokWyzryswS4=", + "lastModified": 1740851740, + "narHash": "sha256-urr8VnD7dXWd6io9DmwVlboa0Or9ygsahx1UAft7ZxY=", "owner": "cachix", "repo": "devenv", - "rev": "991abff153b995192bf36655394246fc97ba8627", + "rev": "56e488989b3d72cd8e30ddd419e879658609bf88", "type": "github" }, "original": { @@ -65,11 +65,11 @@ "flake-compat": { "flake": false, "locked": { - "lastModified": 1696426674, - "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "lastModified": 1733328505, + "narHash": "sha256-NeCCThCEP3eCl2l/+27kNNK7QrwZB1IJCrXfrbv5oqU=", "owner": "edolstra", "repo": "flake-compat", - "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec", "type": "github" }, "original": { @@ -105,11 +105,11 @@ "nixpkgs-lib": "nixpkgs-lib" }, "locked": { - "lastModified": 1733312601, - "narHash": "sha256-4pDvzqnegAfRkPwO3wmwBhVi/Sye1mzps0zHWYnP88c=", + "lastModified": 1738453229, + "narHash": "sha256-7H9XgNiGLKN1G1CgRh0vUL4AheZSYzPm+zmZ7vxbJdo=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "205b12d8b7cd4802fbcb8e8ef6a0f1408781a4f9", + "rev": "32ea77a06711b758da0ad9bd6a844c5740a87abd", "type": "github" }, "original": { @@ -127,17 +127,14 @@ "nixpkgs": [ "devenv", "nixpkgs" - ], - "nixpkgs-stable": [ - "devenv" ] }, "locked": { - "lastModified": 1730302582, - "narHash": "sha256-W1MIJpADXQCgosJZT8qBYLRuZls2KSiKdpnTVdKBuvU=", + "lastModified": 1740849354, + "narHash": "sha256-oy33+t09FraucSZ2rZ6qnD1Y1c8azKKmQuCvF2ytUko=", "owner": "cachix", "repo": "git-hooks.nix", - "rev": "af8a16fe5c264f5e9e18bcee2859b40a656876cf", + "rev": "4a709a8ce9f8c08fa7ddb86761fe488ff7858a07", "type": "github" }, "original": { @@ -203,11 +200,11 @@ ] }, "locked": { - "lastModified": 1727438425, - "narHash": "sha256-X8ES7I1cfNhR9oKp06F6ir4Np70WGZU5sfCOuNBEwMg=", + "lastModified": 1734114420, + "narHash": "sha256-n52PUzub5jZWc8nI/sR7UICOheU8rNA+YZ73YaHeCBg=", "owner": "domenkozar", "repo": "nix", - "rev": "f6c5ae4c1b2e411e6b1e6a8181cc84363d6a7546", + "rev": "bde6a1a0d1f2af86caa4d20d23eca019f3d57eee", "type": "github" }, "original": { @@ -219,11 +216,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1730531603, - "narHash": "sha256-Dqg6si5CqIzm87sp57j5nTaeBbWhHFaVyG7V6L8k3lY=", + "lastModified": 1733212471, + "narHash": "sha256-M1+uCoV5igihRfcUKrr1riygbe73/dzNnzPsmaLCmpo=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "7ffd9ae656aec493492b44d0ddfb28e79a1ea25d", + "rev": "55d15ad12a74eb7d4646254e13638ad0c4128776", "type": "github" }, "original": { @@ -235,14 +232,14 @@ }, "nixpkgs-lib": { "locked": { - "lastModified": 1733096140, - "narHash": "sha256-1qRH7uAUsyQI7R1Uwl4T+XvdNv778H0Nb5njNrqvylY=", + "lastModified": 1738452942, + "narHash": "sha256-vJzFZGaCpnmo7I6i416HaBLpC+hvcURh/BQwROcGIp8=", "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/5487e69da40cbd611ab2cadee0b4637225f7cfae.tar.gz" + "url": "https://github.com/NixOS/nixpkgs/archive/072a6db25e947df2f31aab9eccd0ab75d5b2da11.tar.gz" }, "original": { "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/5487e69da40cbd611ab2cadee0b4637225f7cfae.tar.gz" + "url": "https://github.com/NixOS/nixpkgs/archive/072a6db25e947df2f31aab9eccd0ab75d5b2da11.tar.gz" } }, "nixpkgs_2": { @@ -263,11 +260,11 @@ }, "nixpkgs_3": { "locked": { - "lastModified": 1716977621, - "narHash": "sha256-Q1UQzYcMJH4RscmpTkjlgqQDX5yi1tZL0O345Ri6vXQ=", + "lastModified": 1733477122, + "narHash": "sha256-qamMCz5mNpQmgBwc8SB5tVMlD5sbwVIToVZtSxMph9s=", "owner": "cachix", "repo": "devenv-nixpkgs", - "rev": "4267e705586473d3e5c8d50299e71503f16a6fb6", + "rev": "7bd9e84d0452f6d2e63b6e6da29fe73fac951857", "type": "github" }, "original": { @@ -279,11 +276,11 @@ }, "nixpkgs_4": { "locked": { - "lastModified": 1735291276, - "narHash": "sha256-NYVcA06+blsLG6wpAbSPTCyLvxD/92Hy4vlY9WxFI1M=", + "lastModified": 1740695751, + "narHash": "sha256-D+R+kFxy1KsheiIzkkx/6L63wEHBYX21OIwlFV8JvDs=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "634fd46801442d760e09493a794c4f15db2d0cbb", + "rev": "6313551cd05425cd5b3e63fe47dbc324eabb15e4", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 222e809..3756beb 100644 --- a/flake.nix +++ b/flake.nix @@ -13,6 +13,11 @@ devenv.url = "github:cachix/devenv"; }; + nixConfig = { + extra-trusted-public-keys = "devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw="; + extra-substituters = "https://devenv.cachix.org"; + }; + outputs = { nixpkgs, flake-parts, diff --git a/home/codium/.config/VSCodium/User/settings.json b/home/codium/.config/VSCodium/User/settings.json new file mode 100644 index 0000000..f47b70c --- /dev/null +++ b/home/codium/.config/VSCodium/User/settings.json @@ -0,0 +1,5 @@ +{ + "workbench.colorTheme": "Orbi Blue", + "files.insertFinalNewline": true, + "nix.enableLanguageServer": true +} diff --git a/home/fish/.config/fish/config.fish b/home/fish/.config/fish/config.fish index b4135c8..6bbbc85 100644 --- a/home/fish/.config/fish/config.fish +++ b/home/fish/.config/fish/config.fish @@ -12,10 +12,10 @@ if status is-interactive set fish_cursor_replace_one underscore blink set fish_cursor_visual block - if set -q XDG_CONFIG_HOME - set -x RIPGREP_CONFIG_PATH $XDG_CONFIG_HOME/ripgrep/ripgreprc - else - set -x RIPGREP_CONFIG_PATH ~/.config/ripgrep/ripgreprc + begin + set --local parent $XDG_CONFIG_HOME + test -z $parent && set parent ~/.config + set --export RIPGREP_CONFIG_PATH $parent/ripgrep/ripgreprc end if type -q direnv @@ -27,9 +27,13 @@ if status is-interactive end if type -q nix - fish_add_path ~/.local/state/nix/profile/bin + set --local parent $XDG_STATE_HOME + test -z $parent && set parent ~/.local/state + fish_add_path $parent/nix/profile/bin end + fish_add_path ~/.local/bin + abbr --add l ls abbr --add lsa ls -a abbr --add la ls -a diff --git a/home/nix/.config/nix/nix.conf b/home/nix/.config/nix/nix.conf index 77b7f88..9c11c3e 100644 --- a/home/nix/.config/nix/nix.conf +++ b/home/nix/.config/nix/nix.conf @@ -1,3 +1,5 @@ auto-optimise-store = true experimental-features = nix-command flakes use-xdg-base-directories = true +substituters = https://cache.nixos.org https://fossar.cachix.org +trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= fossar.cachix.org-1:Zv6FuqIboeHPWQS7ysLCJ7UT7xExb4OE8c4LyGb5AsE= diff --git a/packages.txt b/packages.txt deleted file mode 100644 index a70138c..0000000 --- a/packages.txt +++ /dev/null @@ -1,12 +0,0 @@ -bash -direnv -fd -fish -git -gitui -helix -nix -ripgrep -starship -wl-clipboard -zellij diff --git a/plow/plow.bash b/plow/plow.bash index e408b2f..f733bc3 100755 --- a/plow/plow.bash +++ b/plow/plow.bash @@ -7,26 +7,26 @@ set -o pipefail progname="$0" error() { - local line - for line in "$@"; do - echo "$progname: $line" 1>&2 - done + local line + for line in "$@"; do + echo "$progname: $line" 1>&2 + done - exit 1 + exit 1 } shopt -s nullglob globstar -if [[ ! -v PLOW_CACHE ]]; then - PLOW_CACHE=.plowcache +if [[ ! -v PLOW_CACHE || -z $PLOW_CACHE ]]; then + PLOW_CACHE=.plowcache fi args=$( - getopt \ - --options f:t:Fivm: \ - --longoptions from:,to:,force,interactive,verbose,directory-mode: \ - --name "$0" \ - -- "$@" + getopt \ + --options f:t:Fivm: \ + --longoptions from:,to:,force,interactive,verbose,directory-mode: \ + --name "$0" \ + -- "$@" ) eval set -- "$args" @@ -37,84 +37,84 @@ lnflags=() mkdirflags=() rmflags=() while true; do - case "$1" in - -f | --from) - from=$2 - shift 2 - ;; - -t | --to) - to=$2 - shift 2 - ;; - -F | --force) - lnflags+=(--force) - rmflags+=(--force) - shift - ;; - -i | --interactive) - lnflags+=(--interactive) - rmflags+=(--interactive) - shift - ;; - -v | --verbose) - lnflags+=(--verbose) - mkdirflags+=(--verbose) - rmflags+=(--verbose) - shift - ;; - -m | --directory-mode) - mkdirflags+=(--mode "$2") - shift 2 - ;; - --) - shift - break - ;; - esac + case "$1" in + -f | --from) + from=$2 + shift 2 + ;; + -t | --to) + to=$2 + shift 2 + ;; + -F | --force) + lnflags+=(--force) + rmflags+=(--force) + shift + ;; + -i | --interactive) + lnflags+=(--interactive) + rmflags+=(--interactive) + shift + ;; + -v | --verbose) + lnflags+=(--verbose) + mkdirflags+=(--verbose) + rmflags+=(--verbose) + shift + ;; + -m | --directory-mode) + mkdirflags+=(--mode "$2") + shift 2 + ;; + --) + shift + break + ;; + esac done from=$(realpath --strip -- "$from") to=$(realpath --strip -- "$to") -if (( $# > 0 )); then - choices=("$@") +if (($# > 0)); then + choices=("$@") else - choices=() - for dir in "$from"/*/; do - choices+=("$(basename -- "$dir")") - done + choices=() + for dir in "$from"/*/; do + choices+=("$(basename -- "$dir")") + done fi shopt -s dotglob cache=() -if [[ -n "$PLOW_CACHE" ]]; then - if [[ -e "$PLOW_CACHE" ]]; then - while IFS= read -r link; do - cache+=("$link") - done < "$PLOW_CACHE" - fi +if [[ -n $PLOW_CACHE ]]; then + if [[ -r $PLOW_CACHE ]]; then + while IFS= read -r link; do + cache+=("$link") + done <"$PLOW_CACHE" + fi - : > "$PLOW_CACHE" + : >"$PLOW_CACHE" fi for choice in "${choices[@]}"; do - prefix=$from/$choice - for target in "$prefix"/**/*; do - if [[ -f "$target" ]]; then - link=$to${target#"$prefix"} - parent=$(dirname -- "$link") - mkdir --parents "${mkdirflags[@]}" -- "$parent" - ln --symbolic "${lnflags[@]}" -- "$target" "$link" - if [[ -n "$PLOW_CACHE" ]]; then - echo "$link" >> "$PLOW_CACHE" - fi - fi - done + prefix=$from/$choice + for target in "$prefix"/**/*; do + if [[ -f $target ]]; then + link=$to${target#"$prefix"} + parent=$(dirname -- "$link") + mkdir --parents "${mkdirflags[@]}" -- "$parent" + ln --symbolic "${lnflags[@]}" -- "$target" "$link" + if [[ -n "$PLOW_CACHE" ]]; then + echo "$link" >>"$PLOW_CACHE" + fi + fi + done done for link in "${cache[@]}"; do - if [[ -L "$link" && ! -f "$link" ]]; then - rm "${rmflags[@]}" -- "$link" - fi + if [[ -L "$link" && ! -f "$link" ]]; then + rm "${rmflags[@]}" -- "$link" + fi done From 64596a073ca5b4e90caa1aa67d58e1c5deba8a5e Mon Sep 17 00:00:00 2001 From: Lukas Wurzinger Date: Tue, 25 Mar 2025 18:48:52 +0100 Subject: [PATCH 07/10] 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 From c5b629b295e2b6d1f5c6840d2ca12cc0d7e8c925 Mon Sep 17 00:00:00 2001 From: Lukas Wurzinger Date: Tue, 25 Mar 2025 20:31:09 +0100 Subject: [PATCH 08/10] less --- home/git/.config/git/config | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/home/git/.config/git/config b/home/git/.config/git/config index 26d0b10..b89e227 100644 --- a/home/git/.config/git/config +++ b/home/git/.config/git/config @@ -4,8 +4,8 @@ [core] # Global gitignore excludesFile = ~/.config/git/ignore - # Don't paginate output by default - pager = cat + # Paginate output + pager = less # Use Codium as default editor editor = codium --wait # Don't consider trailing space change as a cause for merge conflicts From 69165bbbf7d7bd16c18058b71cc5476e36585bcf Mon Sep 17 00:00:00 2001 From: Lukas Wurzinger Date: Sun, 11 May 2025 23:58:28 +0200 Subject: [PATCH 09/10] stuff --- .gitignore | 5 +- flake.lock | 165 ++++++++++++++++++------ flake.nix | 35 ++--- home/git/.config/git/config | 12 +- home/git/.config/git/config-work | 4 + home/helix/.config/helix/config.toml | 24 +--- home/helix/.config/helix/languages.toml | 8 ++ home/nix/.config/nix/nix.conf | 4 +- home/zk/.config/zk/config.toml | 50 +++++++ 9 files changed, 213 insertions(+), 94 deletions(-) create mode 100644 home/git/.config/git/config-work create mode 100644 home/zk/.config/zk/config.toml diff --git a/.gitignore b/.gitignore index 106935f..318ef8a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,3 @@ .direnv/ -.devenv/ -.pre-commit-config.yaml - -.plowcache +.weavehist diff --git a/flake.lock b/flake.lock index ce483c2..f72543f 100644 --- a/flake.lock +++ b/flake.lock @@ -3,22 +3,25 @@ "cachix": { "inputs": { "devenv": [ + "weave", "devenv" ], "flake-compat": [ + "weave", "devenv" ], "git-hooks": [ + "weave", "devenv" ], - "nixpkgs": "nixpkgs" + "nixpkgs": "nixpkgs_2" }, "locked": { - "lastModified": 1737621947, - "narHash": "sha256-8HFvG7fvIFbgtaYAY2628Tb89fA55nPm2jSiNs0/Cws=", + "lastModified": 1742042642, + "narHash": "sha256-D0gP8srrX0qj+wNYNPdtVJsQuFzIng3q43thnHXQ/es=", "owner": "cachix", "repo": "cachix", - "rev": "f65a3cd5e339c223471e64c051434616e18cc4f5", + "rev": "a624d3eaf4b1d225f918de8543ed739f2f574203", "type": "github" }, "original": { @@ -34,14 +37,14 @@ "flake-compat": "flake-compat", "git-hooks": "git-hooks", "nix": "nix", - "nixpkgs": "nixpkgs_3" + "nixpkgs": "nixpkgs_4" }, "locked": { - "lastModified": 1740851740, - "narHash": "sha256-urr8VnD7dXWd6io9DmwVlboa0Or9ygsahx1UAft7ZxY=", + "lastModified": 1743783972, + "narHash": "sha256-5wPsNCnWmeLpLxavsftA9L7tnYgtlexV7FwLegxtpy4=", "owner": "cachix", "repo": "devenv", - "rev": "56e488989b3d72cd8e30ddd419e879658609bf88", + "rev": "2f53e2f867e0c2ba18b880e66169366e5f8ca554", "type": "github" }, "original": { @@ -79,8 +82,27 @@ } }, "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1743550720, + "narHash": "sha256-hIshGgKZCgWh6AYJpJmRgFdR3WUbkY04o82X05xqQiY=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "c621e8422220273271f52058f618c94e405bb0f5", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_2": { "inputs": { "nixpkgs-lib": [ + "weave", "devenv", "nix", "nixpkgs" @@ -100,16 +122,16 @@ "type": "github" } }, - "flake-parts_2": { + "flake-parts_3": { "inputs": { - "nixpkgs-lib": "nixpkgs-lib" + "nixpkgs-lib": "nixpkgs-lib_2" }, "locked": { - "lastModified": 1738453229, - "narHash": "sha256-7H9XgNiGLKN1G1CgRh0vUL4AheZSYzPm+zmZ7vxbJdo=", + "lastModified": 1743550720, + "narHash": "sha256-hIshGgKZCgWh6AYJpJmRgFdR3WUbkY04o82X05xqQiY=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "32ea77a06711b758da0ad9bd6a844c5740a87abd", + "rev": "c621e8422220273271f52058f618c94e405bb0f5", "type": "github" }, "original": { @@ -121,20 +143,22 @@ "git-hooks": { "inputs": { "flake-compat": [ + "weave", "devenv" ], "gitignore": "gitignore", "nixpkgs": [ + "weave", "devenv", "nixpkgs" ] }, "locked": { - "lastModified": 1740849354, - "narHash": "sha256-oy33+t09FraucSZ2rZ6qnD1Y1c8azKKmQuCvF2ytUko=", + "lastModified": 1742649964, + "narHash": "sha256-DwOTp7nvfi8mRfuL1escHDXabVXFGT1VlPD1JHrtrco=", "owner": "cachix", "repo": "git-hooks.nix", - "rev": "4a709a8ce9f8c08fa7ddb86761fe488ff7858a07", + "rev": "dcf5072734cb576d2b0c59b2ac44f5050b5eac82", "type": "github" }, "original": { @@ -146,6 +170,7 @@ "gitignore": { "inputs": { "nixpkgs": [ + "weave", "devenv", "git-hooks", "nixpkgs" @@ -184,27 +209,31 @@ "nix": { "inputs": { "flake-compat": [ + "weave", "devenv" ], - "flake-parts": "flake-parts", + "flake-parts": "flake-parts_2", "libgit2": "libgit2", - "nixpkgs": "nixpkgs_2", + "nixpkgs": "nixpkgs_3", "nixpkgs-23-11": [ + "weave", "devenv" ], "nixpkgs-regression": [ + "weave", "devenv" ], "pre-commit-hooks": [ + "weave", "devenv" ] }, "locked": { - "lastModified": 1734114420, - "narHash": "sha256-n52PUzub5jZWc8nI/sR7UICOheU8rNA+YZ73YaHeCBg=", + "lastModified": 1741798497, + "narHash": "sha256-E3j+3MoY8Y96mG1dUIiLFm2tZmNbRvSiyN7CrSKuAVg=", "owner": "domenkozar", "repo": "nix", - "rev": "bde6a1a0d1f2af86caa4d20d23eca019f3d57eee", + "rev": "f3f44b2baaf6c4c6e179de8cbb1cc6db031083cd", "type": "github" }, "original": { @@ -215,6 +244,52 @@ } }, "nixpkgs": { + "locked": { + "lastModified": 1746663147, + "narHash": "sha256-Ua0drDHawlzNqJnclTJGf87dBmaO/tn7iZ+TCkTRpRc=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "dda3dcd3fe03e991015e9a74b22d35950f264a54", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-lib": { + "locked": { + "lastModified": 1743296961, + "narHash": "sha256-b1EdN3cULCqtorQ4QeWgLMrd5ZGOjLSLemfa00heasc=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "e4822aea2a6d1cdd36653c134cacfd64c97ff4fa", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, + "nixpkgs-lib_2": { + "locked": { + "lastModified": 1743296961, + "narHash": "sha256-b1EdN3cULCqtorQ4QeWgLMrd5ZGOjLSLemfa00heasc=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "e4822aea2a6d1cdd36653c134cacfd64c97ff4fa", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, + "nixpkgs_2": { "locked": { "lastModified": 1733212471, "narHash": "sha256-M1+uCoV5igihRfcUKrr1riygbe73/dzNnzPsmaLCmpo=", @@ -230,19 +305,7 @@ "type": "github" } }, - "nixpkgs-lib": { - "locked": { - "lastModified": 1738452942, - "narHash": "sha256-vJzFZGaCpnmo7I6i416HaBLpC+hvcURh/BQwROcGIp8=", - "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/072a6db25e947df2f31aab9eccd0ab75d5b2da11.tar.gz" - }, - "original": { - "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/072a6db25e947df2f31aab9eccd0ab75d5b2da11.tar.gz" - } - }, - "nixpkgs_2": { + "nixpkgs_3": { "locked": { "lastModified": 1717432640, "narHash": "sha256-+f9c4/ZX5MWDOuB1rKoWj+lBNm0z0rs4CK47HBLxy1o=", @@ -258,7 +321,7 @@ "type": "github" } }, - "nixpkgs_3": { + "nixpkgs_4": { "locked": { "lastModified": 1733477122, "narHash": "sha256-qamMCz5mNpQmgBwc8SB5tVMlD5sbwVIToVZtSxMph9s=", @@ -274,13 +337,13 @@ "type": "github" } }, - "nixpkgs_4": { + "nixpkgs_5": { "locked": { - "lastModified": 1740695751, - "narHash": "sha256-D+R+kFxy1KsheiIzkkx/6L63wEHBYX21OIwlFV8JvDs=", + "lastModified": 1743827369, + "narHash": "sha256-rpqepOZ8Eo1zg+KJeWoq1HAOgoMCDloqv5r2EAa9TSA=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "6313551cd05425cd5b3e63fe47dbc324eabb15e4", + "rev": "42a1c966be226125b48c384171c44c651c236c22", "type": "github" }, "original": { @@ -291,11 +354,31 @@ } }, "root": { + "inputs": { + "flake-parts": "flake-parts", + "nixpkgs": "nixpkgs", + "weave": "weave" + } + }, + "weave": { "inputs": { "devenv": "devenv", "devenv-root": "devenv-root", - "flake-parts": "flake-parts_2", - "nixpkgs": "nixpkgs_4" + "flake-parts": "flake-parts_3", + "nixpkgs": "nixpkgs_5" + }, + "locked": { + "lastModified": 1744154589, + "narHash": "sha256-W56RJmip2eup9o7uF/C7XHbamqqC5JXcDZ3AQ8M5jVI=", + "ref": "refs/heads/main", + "rev": "0d6662bdc7c73aa323074b11c6a14b0a6a041d8e", + "revCount": 2, + "type": "git", + "url": "https://codeberg.org/helvetica/weave.git" + }, + "original": { + "type": "git", + "url": "https://codeberg.org/helvetica/weave.git" } } }, diff --git a/flake.nix b/flake.nix index 4094722..470cecf 100644 --- a/flake.nix +++ b/flake.nix @@ -4,11 +4,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; - }; - devenv.url = "github:cachix/devenv"; + weave.url = "git+https://codeberg.org/helvetica/weave.git"; }; nixConfig = { @@ -22,13 +18,10 @@ ... } @ inputs: flake-parts.lib.mkFlake {inherit inputs;} { - imports = [ - inputs.devenv.flakeModule - ]; - systems = nixpkgs.lib.systems.flakeExposed; perSystem = { + system, pkgs, self', lib, @@ -39,23 +32,17 @@ directory = ./packages; }; - devenv.shells.default = { - devenv.root = let - devenvRootFileContent = builtins.readFile inputs.devenv-root.outPath; - in - pkgs.lib.mkIf (devenvRootFileContent != "") devenvRootFileContent; - - env.PLOW_FROM = "./home"; - env.PLOW_CACHE = "./.plowcache"; - - imports = [ - ./devenv.nix - ]; - + devShells.default = pkgs.mkShellNoCC { packages = [ - self'.packages.plow - self'.packages.codeinit + inputs.weave.packages.${system}.default ]; + + shellHook = '' + root=$(git rev-parse --show-toplevel) + + export WEAVE_FROM=$root/home + export WEAVE_HIST=$root/.weavecache + ''; }; }; }; diff --git a/home/git/.config/git/config b/home/git/.config/git/config index b89e227..6c6a102 100644 --- a/home/git/.config/git/config +++ b/home/git/.config/git/config @@ -6,8 +6,8 @@ excludesFile = ~/.config/git/ignore # Paginate output pager = less - # Use Codium as default editor - editor = codium --wait + # Use Helix as default editor + editor = hx # Don't consider trailing space change as a cause for merge conflicts whitespace = -trailing-space [init] @@ -36,12 +36,12 @@ wordRegex = . # Display submodule-related information (commit listings) submodule = log - # Use VSCode as default diff tool when running `git difftool` - tool = codium + # Use Helix as default diff tool when running `git difftool` (TODO) + # tool = helix [difftool] prompt = false -[difftool "codium"] - cmd = codium --wait --diff -- "$LOCAL" "$REMOTE" +# [difftool "helix"] +# cmd = hx --wait --diff -- "$LOCAL" "$REMOTE" [fetch] # Auto-fetch submodule changes (won't auto-update) recurseSubmodules = on-demand diff --git a/home/git/.config/git/config-work b/home/git/.config/git/config-work new file mode 100644 index 0000000..aa693bf --- /dev/null +++ b/home/git/.config/git/config-work @@ -0,0 +1,4 @@ +[user] + name = Lukas Wurzinger + email = lukas@wrz.one + signingkey = ~/.ssh/id_ed25519.pub diff --git a/home/helix/.config/helix/config.toml b/home/helix/.config/helix/config.toml index ed3136d..be1dc83 100644 --- a/home/helix/.config/helix/config.toml +++ b/home/helix/.config/helix/config.toml @@ -50,7 +50,6 @@ after-delay.enable = true after-delay.timeout = 3000 [keys.normal] -# Nicities esc = ["collapse_selection", "keep_primary_selection"] C-h = "select_prev_sibling" @@ -65,13 +64,7 @@ C-r = "redo" x = "extend_line" -# Vim-like -V = ["select_mode", "extend_to_line_bounds"] -C = ["extend_to_line_end", "yank_main_selection_to_clipboard", "delete_selection", "insert_mode"] -D = ["extend_to_line_end", "yank_main_selection_to_clipboard", "delete_selection"] -G = "goto_last_line" - -# Vim-like but also generally useful +# Vim "{" = ["goto_prev_paragraph", "collapse_selection"] "}" = ["goto_next_paragraph", "collapse_selection"] @@ -84,7 +77,9 @@ a = ["append_mode", "collapse_selection"] u = ["undo", "collapse_selection"] -## Search for word under cursor +G = "goto_last_line" + +# Search for word under cursor "*" = ["move_char_right", "move_prev_word_start", "move_next_word_end", "search_selection", "search_next"] "#" = ["move_char_right", "move_prev_word_start", "move_next_word_end", "search_selection", "search_prev"] @@ -92,20 +87,13 @@ u = ["undo", "collapse_selection"] esc = ["collapse_selection", "normal_mode"] [keys.select] -# Nicities esc = ["collapse_selection", "keep_primary_selection", "normal_mode"] ";" = ["collapse_selection", "normal_mode"] x = "extend_line" -# Vim-like -V = ["select_mode", "extend_to_line_bounds"] -C = ["extend_to_line_end", "yank_main_selection_to_clipboard", "delete_selection", "insert_mode"] -D = ["extend_to_line_end", "yank_main_selection_to_clipboard", "delete_selection"] -G = "goto_last_line" - -# Vim-like but also generally useful +# Vim "{" = ["goto_prev_paragraph", "collapse_selection"] "}" = ["goto_next_paragraph", "collapse_selection"] @@ -115,3 +103,5 @@ a = "select_textobject_around" 0 = "goto_first_nonwhitespace" "^" = "goto_line_start" "$" = "goto_line_end" + +G = "goto_last_line" diff --git a/home/helix/.config/helix/languages.toml b/home/helix/.config/helix/languages.toml index 53b2495..b5c3b0f 100644 --- a/home/helix/.config/helix/languages.toml +++ b/home/helix/.config/helix/languages.toml @@ -6,3 +6,11 @@ file-types = ["tmpl"] name = "python" language-servers = [ "basedpyright" ] formatter = {command = 'ruff', args = ["format", "--quiet", "-"]} + +[language-server] +zk-lsp = { command = "zk", args = [ "lsp" ] } + +[[language]] +name = "markdown" +roots = [ ".zk" ] +language-servers = [ "zk-lsp" ] diff --git a/home/nix/.config/nix/nix.conf b/home/nix/.config/nix/nix.conf index 9c11c3e..503ae08 100644 --- a/home/nix/.config/nix/nix.conf +++ b/home/nix/.config/nix/nix.conf @@ -1,5 +1,5 @@ auto-optimise-store = true experimental-features = nix-command flakes use-xdg-base-directories = true -substituters = https://cache.nixos.org https://fossar.cachix.org -trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= fossar.cachix.org-1:Zv6FuqIboeHPWQS7ysLCJ7UT7xExb4OE8c4LyGb5AsE= +substituters = https://cache.nixos.org https://cosmic.cachix.org/ https://cache.nixos.org/ https://fossar.cachix.org https://cosmic.cachix.org +trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= cosmic.cachix.org-1:Dya9IyXD4xdBehWjrkPv6rtxpmMdRel02smYzA85dPE= fossar.cachix.org-1:Zv6FuqIboeHPWQS7ysLCJ7UT7xExb4OE8c4LyGb5AsE= diff --git a/home/zk/.config/zk/config.toml b/home/zk/.config/zk/config.toml new file mode 100644 index 0000000..fbe23d8 --- /dev/null +++ b/home/zk/.config/zk/config.toml @@ -0,0 +1,50 @@ +[notebook] +dir = "~/Notes" + +[note] +language = "en" +default-title = "Untitled" +filename = "{{id}}-{{slug title}}" +extension = "md" +template = "default.md" + +id-charset = "alphanum" +id-length = 4 +id-case = "lower" + +[extra] +author = "Helvetica" + +[group.journal] +paths = ["journal/weekly", "journal/daily"] + +[group.journal.note] +filename = "{{format-date now}}" + +[format.markdown] +hashtags = true +colon-tags = true + +[tool] +editor = "hx" +# shell = "/bin/bash" +# pager = "less -FIRX" +fzf-preview = "bat -p --color always {-1}" + +[filter] +recents = "--sort created- --created-after 'last two weeks'" + +[alias] +# Edit the last modified note. +edlast = "zk edit --limit 1 --sort modified- $@" +# Edit the notes selected interactively among the notes created the last two weeks. +recent = "zk edit --sort created- --created-after 'last two weeks' --interactive" +# Show a random note. +lucky = "zk list --quiet --format full --sort random --limit 1" + +[lsp] +[lsp.diagnostics] +# Report titles of wiki-links as hints. +wiki-title = "hint" +# Warn for dead links between notes. +dead-link = "error" From 441a6b68d6306efd37d707687b4cd694a641ba48 Mon Sep 17 00:00:00 2001 From: Lukas Wurzinger Date: Mon, 12 May 2025 18:41:46 +0200 Subject: [PATCH 10/10] simplify --- .envrc | 10 +- flake.nix | 14 +- .../.config/VSCodium/User/settings.json | 6 - packages/codeinit/codeinit.bash | 29 ----- packages/codeinit/package.nix | 6 - packages/plow/package.nix | 6 - packages/plow/plow.bash | 120 ------------------ 7 files changed, 2 insertions(+), 189 deletions(-) delete mode 100644 home/codium/.config/VSCodium/User/settings.json delete mode 100755 packages/codeinit/codeinit.bash delete mode 100644 packages/codeinit/package.nix delete mode 100644 packages/plow/package.nix delete mode 100755 packages/plow/plow.bash diff --git a/.envrc b/.envrc index cb982f0..3550a30 100644 --- a/.envrc +++ b/.envrc @@ -1,9 +1 @@ -watch_file flake.nix -watch_file flake.lock - -DEVENV_ROOT_FILE="$(mktemp)" -printf %s "$PWD" > "$DEVENV_ROOT_FILE" -if ! use flake . --override-input devenv-root "file+file://$DEVENV_ROOT_FILE" -then - echo "devenv could not be built. The devenv environment was not loaded. Make the necessary changes to devenv.nix and hit enter to try again." >&2 -fi +use flake diff --git a/flake.nix b/flake.nix index 470cecf..814d592 100644 --- a/flake.nix +++ b/flake.nix @@ -7,11 +7,6 @@ weave.url = "git+https://codeberg.org/helvetica/weave.git"; }; - nixConfig = { - extra-trusted-public-keys = "devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw="; - extra-substituters = "https://devenv.cachix.org"; - }; - outputs = { nixpkgs, flake-parts, @@ -23,15 +18,8 @@ perSystem = { system, pkgs, - self', - lib, ... }: { - packages = lib.packagesFromDirectoryRecursive { - inherit (pkgs) callPackage; - directory = ./packages; - }; - devShells.default = pkgs.mkShellNoCC { packages = [ inputs.weave.packages.${system}.default @@ -41,7 +29,7 @@ root=$(git rev-parse --show-toplevel) export WEAVE_FROM=$root/home - export WEAVE_HIST=$root/.weavecache + export WEAVE_HIST=$root/.weavehist ''; }; }; diff --git a/home/codium/.config/VSCodium/User/settings.json b/home/codium/.config/VSCodium/User/settings.json deleted file mode 100644 index 826cfdf..0000000 --- a/home/codium/.config/VSCodium/User/settings.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "workbench.colorTheme": "Orbi Blue", - "files.insertFinalNewline": true, - "nix.enableLanguageServer": true, - "php.suggest.basic": false -} diff --git a/packages/codeinit/codeinit.bash b/packages/codeinit/codeinit.bash deleted file mode 100755 index da634ad..0000000 --- a/packages/codeinit/codeinit.bash +++ /dev/null @@ -1,29 +0,0 @@ -#!/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 deleted file mode 100644 index a09519d..0000000 --- a/packages/codeinit/package.nix +++ /dev/null @@ -1,6 +0,0 @@ -{writeShellApplication}: -writeShellApplication { - name = "codeinit"; - - text = builtins.readFile ./codeinit.bash; -} diff --git a/packages/plow/package.nix b/packages/plow/package.nix deleted file mode 100644 index 30a0c52..0000000 --- a/packages/plow/package.nix +++ /dev/null @@ -1,6 +0,0 @@ -{writeShellApplication}: -writeShellApplication { - name = "plow"; - - text = builtins.readFile ./plow.bash; -} diff --git a/packages/plow/plow.bash b/packages/plow/plow.bash deleted file mode 100755 index f733bc3..0000000 --- a/packages/plow/plow.bash +++ /dev/null @@ -1,120 +0,0 @@ -#!/usr/bin/env bash - -set -o errexit -set -o nounset -set -o pipefail - -progname="$0" - -error() { - local line - for line in "$@"; do - echo "$progname: $line" 1>&2 - done - - exit 1 -} - -shopt -s nullglob globstar - -if [[ ! -v PLOW_CACHE || -z $PLOW_CACHE ]]; then - PLOW_CACHE=.plowcache -fi - -args=$( - getopt \ - --options f:t:Fivm: \ - --longoptions from:,to:,force,interactive,verbose,directory-mode: \ - --name "$0" \ - -- "$@" -) - -eval set -- "$args" - -from=${PLOW_FROM:-$PWD} -to=${PLOW_TO:-$HOME} -lnflags=() -mkdirflags=() -rmflags=() -while true; do - case "$1" in - -f | --from) - from=$2 - shift 2 - ;; - -t | --to) - to=$2 - shift 2 - ;; - -F | --force) - lnflags+=(--force) - rmflags+=(--force) - shift - ;; - -i | --interactive) - lnflags+=(--interactive) - rmflags+=(--interactive) - shift - ;; - -v | --verbose) - lnflags+=(--verbose) - mkdirflags+=(--verbose) - rmflags+=(--verbose) - shift - ;; - -m | --directory-mode) - mkdirflags+=(--mode "$2") - shift 2 - ;; - --) - shift - break - ;; - esac -done - -from=$(realpath --strip -- "$from") -to=$(realpath --strip -- "$to") - -if (($# > 0)); then - choices=("$@") -else - choices=() - for dir in "$from"/*/; do - choices+=("$(basename -- "$dir")") - done -fi - -shopt -s dotglob - -cache=() -if [[ -n $PLOW_CACHE ]]; then - if [[ -r $PLOW_CACHE ]]; then - while IFS= read -r link; do - cache+=("$link") - done <"$PLOW_CACHE" - fi - - : >"$PLOW_CACHE" -fi - -for choice in "${choices[@]}"; do - prefix=$from/$choice - for target in "$prefix"/**/*; do - if [[ -f $target ]]; then - link=$to${target#"$prefix"} - parent=$(dirname -- "$link") - mkdir --parents "${mkdirflags[@]}" -- "$parent" - ln --symbolic "${lnflags[@]}" -- "$target" "$link" - if [[ -n "$PLOW_CACHE" ]]; then - echo "$link" >>"$PLOW_CACHE" - fi - fi - done -done - -for link in "${cache[@]}"; do - if [[ -L "$link" && ! -f "$link" ]]; then - rm "${rmflags[@]}" -- "$link" - fi -done