From f4817e31485e763cdf2dad6b021895f964033aba Mon Sep 17 00:00:00 2001 From: clover caruso Date: Mon, 1 Sep 2025 12:37:58 -0700 Subject: [PATCH 1/4] clover: configure jujutsu log to look really nice so far, part of my strategy has been tagging incomplete commits with "WIP" and then renaming them once i'm ready to push them. here, the default log revset will just show all WIPs, and the custom display template will very clearly highlight them along with the usual conventional commit stuff. --- modules/home/default.nix | 6 ++ users/clover/home.nix | 187 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 192 insertions(+), 1 deletion(-) diff --git a/modules/home/default.nix b/modules/home/default.nix index 38811b880fb60af75ae564d2ba787a1a7c7f2dd7..64fbd631b34421db740a329ea8f752b863bf684d 100644 --- a/modules/home/default.nix +++ b/modules/home/default.nix @@ -152,6 +152,12 @@ in }; ui = { default-command = "log"; + diff-formatter = [ + "${pkgs.difftastic}/bin/difft" + "--color=always" + "$left" + "$right" + ]; pager = "${pkgs.bat}/bin/bat --style=plain"; }; }; diff --git a/users/clover/home.nix b/users/clover/home.nix index de5840b081b97253c5991ee78fac02dba651a767..d8674c7e5fa8fa528ad15e36ffdd837513f16db1 100644 --- a/users/clover/home.nix +++ b/users/clover/home.nix @@ -81,7 +81,192 @@ in # use a git-specific email git.userEmail = "git@paperclover.net"; - jujutsu.enable = true; + jujutsu = { + enable = true; + # my workflow is based on creating changes and editing them. while they + # are in progress the description starts with "WIP: " + settings = rec { + colors = { + bookmark = "green"; + bookmarks = colors.bookmark; + local_bookmarks = colors.bookmarks; + remote_bookmarks = colors.bookmark; + "working_copy bookmark" = "bright green"; + "working_copy bookmarks" = colors."working_copy bookmark"; + "working_copy local_bookmarks" = colors."working_copy bookmark"; + "working_copy remote_bookmarks" = colors."working_copy bookmark"; + + "author" = { + fg = "white"; + bold = false; + italic = true; + }; + "working_copy author" = colors.author; + + desc = { + bold = false; + fg = "bright white"; + }; + description = colors.desc; + cc_wip = { + fg = "bright yellow"; + bold = true; + reverse = true; + }; + cc_header = { + bold = true; + fg = "bright white"; + }; + cc_feat = "green"; + cc_fix = "red"; + cc_hotfix = "red"; + cc_chore = "yellow"; + cc_test = "blue"; + cc_other = "blue"; + cc_scope = { + fg = "cyan"; + bold = false; + italic = true; + }; + + active_marker = { + fg = "bright magenta"; + bold = true; + reverse = true; + }; + conflict_marker = { + fg = "bright red"; + bold = true; + reverse = true; + }; + + timestamp = "bright black"; + commit_id = { + fg = "bright black"; + bold = false; + }; + muted = "bright black"; + }; + # ui.graph.style = "square"; + revsets = { + log = "ancestors(description(regex:\"^(WIP:|\\\\s*$)\"), 3) | ancestors(immutable_heads(), 2) | ancestors(visible_heads(), 2)"; + short-prefixes = "(trunk()..@)::"; + }; + templates.log = "hl_wip(self)"; + + template-aliases = { + # log template, highlighting the WIP commits by making everything else faded out + "hl_wip(commit)" = '' + if(commit.root(), format_root_commit(commit), + label("__commit__", + format_short_commit_header(commit) ++ "\n" ++ + format_commit_description(commit) + ) + ) + ''; + + "format_commit_description(commit)" = '' + label("desc", format_commit_firstline(commit.description().first_line())) ++ + "\n" ++ if( + commit.description().starts_with("WIP:") || commit.current_working_copy(), + commit.description().remove_prefix(commit.description().first_line()).remove_prefix("\n").trim_end() ++ "\n ", + if(commit.description().remove_prefix(commit.description().first_line()).trim().len() > 0, + label("muted", lines_collapsed(commit.description().lines().filter(|x| x.trim().len() > 0).len() - 1)), + " " + ) + ) + ''; + "lines_collapsed(count)" = + ''("[" ++ stringify(count ++ " line" ++ if(count == 1, "", "s")) ++ " collapsed]\n")''; + "format_commit_firstline(line)" = '' + if(line.starts_with("WIP:"), + label("cc_wip", " WIP ") ++ " " ++ format_commit_firstline_a_wip(line.remove_prefix("WIP:").trim()), + format_commit_firstline_a_wip(line) + ) + ''; + "format_commit_firstline_a_wip(line)" = '' + if(line.starts_with("feat:") || line.starts_with("feat("), + label("cc_feat", "feat") ++ format_commit_firstline_a_cc_type(line.remove_prefix("feat")), + if(line.starts_with("fix:") || line.starts_with("fix("), + label("cc_fix", "fix") ++ format_commit_firstline_a_cc_type(line.remove_prefix("fix")), + if(line.starts_with("hotfix:") || line.starts_with("hotfix("), + label("cc_hotfix", "hotfix") ++ format_commit_firstline_a_cc_type(line.remove_prefix("hotfix")), + if(line.starts_with("chore:") || line.starts_with("chore("), + label("cc_chore", "chore") ++ format_commit_firstline_a_cc_type(line.remove_prefix("chore")), + if(line.starts_with("test:") || line.starts_with("test("), + label("cc_other", "test") ++ format_commit_firstline_a_cc_type(line.remove_prefix("test")), + if(line.starts_with("refactor:") || line.starts_with("refactor("), + label("cc_other", "refactor") ++ format_commit_firstline_a_cc_type(line.remove_prefix("refactor")), + if(line.starts_with("perf:") || line.starts_with("perf("), + label("cc_other", "perf") ++ format_commit_firstline_a_cc_type(line.remove_prefix("perf")), + if(line.starts_with("lib:") || line.starts_with("lib("), + label("cc_other", "lib") ++ format_commit_firstline_a_cc_type(line.remove_prefix("lib")), + label("cc_header", line) + )))))))) + ''; + "format_commit_firstline_a_cc_type(rest)" = '' + if(rest.starts_with("(") && rest.contains(")"), + format_firstline_cc_scope(rest, index_of_close_paren(rest)), + format_firstline_a_cc(rest)) + ''; + "format_firstline_cc_scope(rest, index)" = '' + label("cc_scope", rest.substr(0, index)) ++ format_firstline_a_cc(rest.substr(index, rest.len())) + ''; + "format_firstline_a_cc(rest)" = '' + if(rest.starts_with(":"), + label("muted", ":") ++ label("cc_header", rest.remove_prefix(":")), + label("cc_header", rest) + ) + ''; + # sorry! + "index_of_close_paren(line)" = '' + stringify(if(line.substr(1, 2) == ")", "A", + if(line.substr(2, 3) == ")", "AA", + if(line.substr(3, 4) == ")", "AAA", + if(line.substr(4, 5) == ")", "AAAA", + if(line.substr(5, 6) == ")", "AAAAA", + if(line.substr(6, 7) == ")", "AAAAAA", + if(line.substr(7, 8) == ")", "AAAAAAA", + if(line.substr(8, 9) == ")", "AAAAAAAA", + if(line.substr(9, 10) == ")","AAAAAAAAA", + if(line.substr(10, 11) == ")", "AAAAAAAAAA", + if(line.substr(11, 12) == ")", "AAAAAAAAAAA", + if(line.substr(12, 13) == ")", "AAAAAAAAAAAA", + if(line.substr(13, 14) == ")", "AAAAAAAAAAAAA", + if(line.substr(14, 15) == ")", "AAAAAAAAAAAAAA", + if(line.substr(15, 16) == ")", "AAAAAAAAAAAAAAA", + if(line.substr(16, 17) == ")", "AAAAAAAAAAAAAAAA", + if(line.substr(17, 18) == ")", "AAAAAAAAAAAAAAAAA", + if(line.substr(18, 19) == ")", "AAAAAAAAAAAAAAAAAA", + if(line.substr(19, 20) == ")", "AAAAAAAAAAAAAAAAAAA", + if(line.substr(20, 21) == ")", "AAAAAAAAAAAAAAAAAAAA", + "AAAAAAAAAAAAAAAAAAAAA" + ))))))))))))))))))))).len() + 1 + ''; + + "format_short_signature(signature)" = "signature.name()"; + "format_timestamp(timestamp)" = "timestamp.ago()"; + "format_short_commit_header(commit)" = '' + separate(" ", + if(commit.current_working_copy(), label("active_marker", " ACTIVE ")), + if(commit.conflict(), label("conflict_marker", " CONFLICT ")), + format_short_change_id_with_hidden_and_divergent_info(commit), + format_short_signature(commit.author()), + label("muted", "|"), + if(commit.description().trim().len() > 0, label("muted", format_timestamp(commit_timestamp(commit)))), + commit.bookmarks(), + commit.tags(), + commit.working_copies(), + label("muted", "(") ++ + format_short_commit_id(commit.commit_id()) ++ + label("muted", ")"), + if(config("ui.show-cryptographic-signatures").as_boolean(), + format_short_cryptographic_signature(commit.signature())), + ) + ''; + }; + }; + }; ssh = { enable = true; -- 2.54.0 From 168c36042b1a70c406e4d195d34c20c482a3cde3 Mon Sep 17 00:00:00 2001 From: clover caruso Date: Wed, 24 Sep 2025 11:59:26 -0700 Subject: [PATCH 2/4] clover: setup work environment switch command gets some new features to account for the fact my work device hostname contains info about the company i work for. --- .gitignore | 3 ++- flake.nix | 6 ++++++ switch | 21 ++++++++++++++++----- users/clover/home.nix | 12 ++---------- users/clover/paperback/home.nix | 4 ---- users/clover/work/home.nix | 23 +++++++++++++++++++++++ 6 files changed, 49 insertions(+), 20 deletions(-) create mode 100644 users/clover/work/home.nix diff --git a/.gitignore b/.gitignore index b12e90ad5ad4ae77215e74cdf66de71da19ef3cc..fd9d1ca548f88694b09655ec42567e08161475b9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ -flake.lock .DS_STORE +.hostname +flake.lock result result-* diff --git a/flake.nix b/flake.nix index 28101b0755d19ad6d382be93307cd255f30fc903..cebe693a0da4cbaf4b7f067231349b803ff3d5b3 100644 --- a/flake.nix +++ b/flake.nix @@ -133,6 +133,12 @@ host = "paperback"; system = "aarch64-darwin"; }; + # clover's work macbook pro + darwinConfigurations.clover-work-mac = mkSystem "clover-work-mac" { + user = "clover"; + host = "work"; + system = "aarch64-darwin"; + }; # fish's cattop nixosConfigurations.cattop = mkSystem "cattop" { diff --git a/switch b/switch index 3c267596a89ce1a79011f5431c6d73cc4e2a25ec..bf5697d655d9362730c9db9854db34b7950154fc 100755 --- a/switch +++ b/switch @@ -1,12 +1,23 @@ #!/bin/sh nh_subcommand="os" fallback_command="nixos-rebuild" -if [ "$(uname -o)" = "darwin" ]; then - nh_subcommand="darwin" - fallback_command="nix run .#darwin-rebuild" +hostname_file="$(dirname "$0")/.hostname" +if [ -n "$1" ]; then + hostname="$1" +elif [ -f "$hostname_file" ]; then + hostname=$(cat "$hostname_file") +fi +if [ -z "$hostname" ]; then + hostname="$(hostname)" +fi +printf "%s" "$hostname" >"$hostname_file" +if [ "$(uname -o)" = "Darwin" ]; then + nh_subcommand="darwin" + fallback_command="nix run .#darwin-rebuild" + hostname="darwinConfigurations.$hostname" fi if command -v nh >/dev/null; then - nh $nh_subcommand switch . + nh $nh_subcommand switch '.#'"$hostname" else - $fallback_command -- switch --flake . + $fallback_command -- switch --flake '.#'"$hostname" fi diff --git a/users/clover/home.nix b/users/clover/home.nix index d8674c7e5fa8fa528ad15e36ffdd837513f16db1..8ac1b46d4bddc71134455dbb08b2264fb8be802a 100644 --- a/users/clover/home.nix +++ b/users/clover/home.nix @@ -10,9 +10,7 @@ in let # packages to always install all = [ - (ffmpeg.override { - withSvtav1 = true; - }) + ffmpeg-full ripgrep uv nh @@ -22,6 +20,7 @@ in desktop = [ git-town lazygit + jjui ]; # packages to install on all servers server = [ ]; @@ -278,12 +277,5 @@ in "nas.paperclover.net" = zenith; }; }; - neovide = { - enable = !hostServer; - settings = { - font.normal = "AT Name Mono"; - font.size = 13; - }; - }; }; } diff --git a/users/clover/paperback/home.nix b/users/clover/paperback/home.nix index 711130f295df837f03f7c41ca2efc7cc64491798..47d88a2034872f1efc7c06355eef2e3b004436b3 100644 --- a/users/clover/paperback/home.nix +++ b/users/clover/paperback/home.nix @@ -3,7 +3,6 @@ # these programs are not globally installed to reduce distractions. # most of these are needed for my work environment. programs = { - bun.enable = true; zsh.profileExtra = '' _bun() { local context state line @@ -12,7 +11,6 @@ ''; }; home.packages = with pkgs; [ - doppler deno nodejs_22 rustup @@ -22,7 +20,5 @@ yt-dlp spotdl zig - ssm-session-manager-plugin - awscli ]; } diff --git a/users/clover/work/home.nix b/users/clover/work/home.nix new file mode 100644 index 0000000000000000000000000000000000000000..5407bdbbc9bd19929d875a24a72da914e4233d31 --- /dev/null +++ b/users/clover/work/home.nix @@ -0,0 +1,23 @@ +{ pkgs, ... }: +{ + programs = { + zsh.profileExtra = '' + _bun() { + local context state line + _arguments -C '*:file:_files' + } + ''; + }; + home.packages = with pkgs; [ + (bun.overrideAttrs (_: { + version = "1.1.17"; # blocked on bugs + })) + doppler + deno + nodejs_24 + rustup + typescript + ssm-session-manager-plugin + awscli + ]; +} -- 2.54.0 From 7dc7c912ee419bb57834d22886da8172ef691583 Mon Sep 17 00:00:00 2001 From: clover caruso Date: Wed, 24 Sep 2025 12:22:26 -0700 Subject: [PATCH 3/4] clover: pin bun version --- users/clover/work/home.nix | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/users/clover/work/home.nix b/users/clover/work/home.nix index 5407bdbbc9bd19929d875a24a72da914e4233d31..a5fb595349707f6b857c0e40e4208e08ccdeb756 100644 --- a/users/clover/work/home.nix +++ b/users/clover/work/home.nix @@ -9,8 +9,12 @@ ''; }; home.packages = with pkgs; [ - (bun.overrideAttrs (_: { - version = "1.1.17"; # blocked on bugs + (bun.overrideAttrs (_: rec { + version = "1.1.17"; + src = fetchurl { + url = "https://github.com/oven-sh/bun/releases/download/bun-v${version}/bun-darwin-aarch64.zip"; + hash = "sha256-aULgRZ9evcGUhKJ6slLJOg3IEzUeNfIkJF8RDP3YUlo="; + }; })) doppler deno -- 2.54.0 From 7fd3f19d2b7d0c7ccd42d903f574ccfab32ac07d Mon Sep 17 00:00:00 2001 From: clover caruso Date: Wed, 24 Sep 2025 13:52:21 -0700 Subject: [PATCH 4/4] clover: fix ghostty theme breaking change --- users/clover/home.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/users/clover/home.nix b/users/clover/home.nix index 8ac1b46d4bddc71134455dbb08b2264fb8be802a..4f799cb1e39b41021b6abfc173356266bfab50b0 100644 --- a/users/clover/home.nix +++ b/users/clover/home.nix @@ -48,7 +48,7 @@ in shader = "cursor-smear-black.glsl"; package = null; settings = { - theme = "light:farmhouse-light,dark:ChallengerDeep"; + theme = "light:Farmhouse Light,dark:Challenger Deep"; font-family = "AT Name Mono"; adjust-cursor-thickness = 1; background-opacity = 0.9; @@ -60,7 +60,7 @@ in zsh = { enable = true; shellAliases = { - switch = "nh darwin switch ~/config"; + switch = "~/config/switch"; gg = "lazygit"; ga = "git add"; g = "git status"; -- 2.54.0