| ... | ... | @@ -1,4 +1,9 @@ |
| 1 | | { pkgs, host, ... }: |
| 1 | { |
| 2 | config, |
| 3 | pkgs, |
| 4 | host, |
| 5 | ... |
| 6 | }: |
| 2 | 7 | let |
| 3 | 8 | hostServer = false; |
| 4 | 9 | in |
| ... | ... | @@ -16,18 +21,15 @@ in |
| 16 | 21 | nh |
| 17 | 22 | autofmt |
| 18 | 23 | gnupg |
| 24 | nodejs_24 |
| 19 | 25 | ]; |
| 20 | 26 | # packages to install for desktop environments (non-server) |
| 21 | 27 | desktop = [ |
| 22 | | lazygit |
| 23 | | jjui |
| 24 | 28 | ]; |
| 25 | 29 | # packages to install on all servers |
| 26 | 30 | server = [ ]; |
| 27 | 31 | # packages to install on macOS desktops |
| 28 | | darwin = [ |
| 29 | | raycast |
| 30 | | ]; |
| 32 | darwin = [ ]; |
| 31 | 33 | # packages to install on linux desktops |
| 32 | 34 | linux = [ |
| 33 | 35 | ]; |
| ... | ... | @@ -59,6 +61,7 @@ in |
| 59 | 61 | # zsh is the shell i use |
| 60 | 62 | zsh = { |
| 61 | 63 | enable = true; |
| 64 | dotDir = "${config.xdg.configHome}/zsh"; |
| 62 | 65 | shellAliases = { |
| 63 | 66 | switch = "~/config/switch"; |
| 64 | 67 | |
| ... | ... | @@ -66,8 +69,7 @@ in |
| 66 | 69 | jf = "jj git fetch"; |
| 67 | 70 | e = "jj edit"; |
| 68 | 71 | d = "jj desc"; |
| 69 | | bup = "jj b m --from 'parents(@)' --to '@'"; |
| 70 | | push = "jj git push"; |
| 72 | bup = "jj b m --from 'heads(::@- & bookmarks())' --to '@'"; |
| 71 | 73 | moveself = "jj rebase -r @ -d"; |
| 72 | 74 | logall = "jj log -r 'all()'"; |
| 73 | 75 | cherry = "jj git fetch && jj split -i -p -m 'SPLIT_CHANGES' && jj edit -r 'description(\"SPLIT_CHANGES\")' && jj desc -m '' --edit"; |
| ... | ... | @@ -83,28 +85,42 @@ in |
| 83 | 85 | uv run --project "$dirname" "$@" |
| 84 | 86 | } |
| 85 | 87 | |
| 86 | | function pr() { |
| 87 | | message=$(jj log -r '@' -T 'description' --no-graph) |
| 88 | | if [[ -z "$message" ]] || [[ "$message" = "WIP:"* ]]; then |
| 89 | | jj desc |
| 88 | function bun() { |
| 89 | if [[ "$1" = "build" ]]; then |
| 90 | command bun run "$@" |
| 91 | elif [[ "$1" = "bundle" ]]; then |
| 92 | shift |
| 93 | command bun build "$@" |
| 94 | else |
| 95 | command bun "$@" |
| 90 | 96 | fi |
| 91 | | if [ -n "$1" ]; then |
| 92 | | jj git push --named "clo/$1"=@ |
| 93 | | branch="clo/$1" |
| 97 | } |
| 98 | |
| 99 | function jj() { |
| 100 | if [[ "$*" = "git push"* ]] && [[ "$*" != *"--dry-run"* ]]; then |
| 101 | command jj "$@" --dry-run |
| 102 | printf "Press any key to continue... " |
| 103 | read -r |
| 104 | command jj "$@" |
| 94 | 105 | else |
| 95 | | branch="$(jj log -r '@' -T '"clo/push-" ++ change_id.short()' --no-graph)" |
| 96 | | jj git push -c @ |
| 106 | command jj "$@" |
| 97 | 107 | fi |
| 98 | | open "$(git remote get-url origin | sed 's/git@github\.com:/https:\/\/github.com\//' | sed 's/\.git$//')/compare/master...$branch" |
| 99 | 108 | } |
| 100 | 109 | ''; |
| 101 | 110 | }; |
| 102 | 111 | |
| 103 | | # use a git-specific email |
| 104 | | git.userEmail = "git@paperclover.net"; |
| 105 | | git.signing = { |
| 106 | | signByDefault = true; |
| 107 | | key = "C0D577FD799F9D11"; |
| 112 | git = { |
| 113 | # use a git-specific email |
| 114 | settings.user.email = "git@paperclover.net"; |
| 115 | settings.gpg.ssh.allowedSignersFile = "${pkgs.writeText "allowed_signers" '' |
| 116 | git@paperclover.net ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAVa1aq1LEj/VXHJYlR5HJpK65lS/9jOL/dAB9ZS1chd |
| 117 | ''}"; |
| 118 | # signing |
| 119 | signing = { |
| 120 | signByDefault = true; |
| 121 | key = "~/.ssh/id_ed25519"; |
| 122 | format = "ssh"; |
| 123 | }; |
| 108 | 124 | }; |
| 109 | 125 | |
| 110 | 126 | jujutsu = { |
| ... | ... | @@ -175,137 +191,39 @@ in |
| 175 | 191 | }; |
| 176 | 192 | # ui.graph.style = "square"; |
| 177 | 193 | revsets = { |
| 178 | | log = "ancestors(description(regex:\"^(WIP:|\\\\s+$)\"):: | working_copies() | bookmarks(\"master\")::remote_bookmarks(\"master\") | bookmarks(glob:\"clo/*\")::, 5)"; |
| 179 | 194 | short-prefixes = "(trunk()..@)::"; |
| 180 | 195 | }; |
| 181 | | # templates.log = "hl_wip(self)"; |
| 182 | | |
| 183 | | template-aliases = { |
| 184 | | # log template, highlighting the WIP commits by making everything else faded out |
| 185 | | "hl_wip(commit)" = '' |
| 186 | | if(commit.root(), format_root_commit(commit), |
| 187 | | label("__commit__", |
| 188 | | format_short_commit_header(commit) ++ "\n" ++ |
| 189 | | format_commit_description(commit) |
| 190 | | ) |
| 191 | | ) |
| 192 | | ''; |
| 193 | | |
| 194 | | "format_commit_description(commit)" = '' |
| 195 | | label("desc", format_commit_firstline(commit.description().first_line())) ++ |
| 196 | | "\n" ++ if( |
| 197 | | commit.description().starts_with("WIP:") || commit.current_working_copy(), |
| 198 | | commit.description().remove_prefix(commit.description().first_line()).remove_prefix("\n").trim_end() ++ "\n ", |
| 199 | | if(commit.description().remove_prefix(commit.description().first_line()).trim().len() > 0, |
| 200 | | label("muted", lines_collapsed(commit.description().lines().filter(|x| x.trim().len() > 0).len() - 1)), |
| 201 | | " " |
| 202 | | ) |
| 203 | | ) |
| 204 | | ''; |
| 205 | | "lines_collapsed(count)" = |
| 206 | | ''("[" ++ stringify(count ++ " line" ++ if(count == 1, "", "s")) ++ " collapsed]\n")''; |
| 207 | | "format_commit_firstline(line)" = '' |
| 208 | | if(line.starts_with("WIP:"), |
| 209 | | label("cc_wip", " WIP ") ++ " " ++ format_commit_firstline_a_wip(line.remove_prefix("WIP:").trim()), |
| 210 | | format_commit_firstline_a_wip(line) |
| 211 | | ) |
| 212 | | ''; |
| 213 | | "format_commit_firstline_a_wip(line)" = '' |
| 214 | | if(line.starts_with("feat:") || line.starts_with("feat("), |
| 215 | | label("cc_feat", "feat") ++ format_commit_firstline_a_cc_type(line.remove_prefix("feat")), |
| 216 | | if(line.starts_with("fix:") || line.starts_with("fix("), |
| 217 | | label("cc_fix", "fix") ++ format_commit_firstline_a_cc_type(line.remove_prefix("fix")), |
| 218 | | if(line.starts_with("hotfix:") || line.starts_with("hotfix("), |
| 219 | | label("cc_hotfix", "hotfix") ++ format_commit_firstline_a_cc_type(line.remove_prefix("hotfix")), |
| 220 | | if(line.starts_with("chore:") || line.starts_with("chore("), |
| 221 | | label("cc_chore", "chore") ++ format_commit_firstline_a_cc_type(line.remove_prefix("chore")), |
| 222 | | if(line.starts_with("test:") || line.starts_with("test("), |
| 223 | | label("cc_other", "test") ++ format_commit_firstline_a_cc_type(line.remove_prefix("test")), |
| 224 | | if(line.starts_with("refactor:") || line.starts_with("refactor("), |
| 225 | | label("cc_other", "refactor") ++ format_commit_firstline_a_cc_type(line.remove_prefix("refactor")), |
| 226 | | if(line.starts_with("perf:") || line.starts_with("perf("), |
| 227 | | label("cc_other", "perf") ++ format_commit_firstline_a_cc_type(line.remove_prefix("perf")), |
| 228 | | if(line.starts_with("lib:") || line.starts_with("lib("), |
| 229 | | label("cc_other", "lib") ++ format_commit_firstline_a_cc_type(line.remove_prefix("lib")), |
| 230 | | label("cc_header", line) |
| 231 | | )))))))) |
| 232 | | ''; |
| 233 | | "format_commit_firstline_a_cc_type(rest)" = '' |
| 234 | | if(rest.starts_with("(") && rest.contains(")"), |
| 235 | | format_firstline_cc_scope(rest, index_of_close_paren(rest)), |
| 236 | | format_firstline_a_cc(rest)) |
| 237 | | ''; |
| 238 | | "format_firstline_cc_scope(rest, index)" = '' |
| 239 | | label("cc_scope", rest.substr(0, index)) ++ format_firstline_a_cc(rest.substr(index, rest.len())) |
| 240 | | ''; |
| 241 | | "format_firstline_a_cc(rest)" = '' |
| 242 | | if(rest.starts_with(":"), |
| 243 | | label("muted", ":") ++ label("cc_header", rest.remove_prefix(":")), |
| 244 | | label("cc_header", rest) |
| 245 | | ) |
| 246 | | ''; |
| 247 | | # sorry! |
| 248 | | "index_of_close_paren(line)" = '' |
| 249 | | stringify(if(line.substr(1, 2) == ")", "A", |
| 250 | | if(line.substr(2, 3) == ")", "AA", |
| 251 | | if(line.substr(3, 4) == ")", "AAA", |
| 252 | | if(line.substr(4, 5) == ")", "AAAA", |
| 253 | | if(line.substr(5, 6) == ")", "AAAAA", |
| 254 | | if(line.substr(6, 7) == ")", "AAAAAA", |
| 255 | | if(line.substr(7, 8) == ")", "AAAAAAA", |
| 256 | | if(line.substr(8, 9) == ")", "AAAAAAAA", |
| 257 | | if(line.substr(9, 10) == ")","AAAAAAAAA", |
| 258 | | if(line.substr(10, 11) == ")", "AAAAAAAAAA", |
| 259 | | if(line.substr(11, 12) == ")", "AAAAAAAAAAA", |
| 260 | | if(line.substr(12, 13) == ")", "AAAAAAAAAAAA", |
| 261 | | if(line.substr(13, 14) == ")", "AAAAAAAAAAAAA", |
| 262 | | if(line.substr(14, 15) == ")", "AAAAAAAAAAAAAA", |
| 263 | | if(line.substr(15, 16) == ")", "AAAAAAAAAAAAAAA", |
| 264 | | if(line.substr(16, 17) == ")", "AAAAAAAAAAAAAAAA", |
| 265 | | if(line.substr(17, 18) == ")", "AAAAAAAAAAAAAAAAA", |
| 266 | | if(line.substr(18, 19) == ")", "AAAAAAAAAAAAAAAAAA", |
| 267 | | if(line.substr(19, 20) == ")", "AAAAAAAAAAAAAAAAAAA", |
| 268 | | if(line.substr(20, 21) == ")", "AAAAAAAAAAAAAAAAAAAA", |
| 269 | | "AAAAAAAAAAAAAAAAAAAAA" |
| 270 | | ))))))))))))))))))))).len() + 1 |
| 271 | | ''; |
| 272 | | |
| 273 | | "format_short_signature(signature)" = "signature.name()"; |
| 274 | | "format_timestamp(timestamp)" = "timestamp.ago()"; |
| 275 | | "format_short_commit_header(commit)" = '' |
| 276 | | separate(" ", |
| 277 | | if(commit.current_working_copy(), label("active_marker", " ACTIVE ")), |
| 278 | | if(commit.conflict(), label("conflict_marker", " CONFLICT ")), |
| 279 | | format_short_change_id_with_hidden_and_divergent_info(commit), |
| 280 | | format_short_signature(commit.author()), |
| 281 | | label("muted", "|"), |
| 282 | | if(commit.description().trim().len() > 0, label("muted", format_timestamp(commit_timestamp(commit)))), |
| 283 | | commit.bookmarks(), |
| 284 | | commit.tags(), |
| 285 | | commit.working_copies(), |
| 286 | | label("muted", "(") ++ |
| 287 | | format_short_commit_id(commit.commit_id()) ++ |
| 288 | | label("muted", ")"), |
| 289 | | if(config("ui.show-cryptographic-signatures").as_boolean(), |
| 290 | | format_short_cryptographic_signature(commit.signature())), |
| 291 | | ) |
| 292 | | ''; |
| 196 | aliases = { |
| 197 | "ab" = [ "abandon" ]; |
| 198 | # "ai" = [ |
| 199 | # "util" |
| 200 | # "exec" |
| 201 | # "--" |
| 202 | # "~/jj-ai-sync.sh" |
| 203 | # ]; |
| 293 | 204 | }; |
| 294 | | |
| 295 | 205 | }; |
| 296 | 206 | }; |
| 297 | 207 | |
| 298 | 208 | ssh = { |
| 299 | 209 | enable = true; |
| 210 | enableDefaultConfig = false; |
| 300 | 211 | extraConfig = '' |
| 212 | Include ~/.orbstack/ssh/config* |
| 213 | |
| 301 | 214 | SetEnv TERM=xterm-256color |
| 302 | 215 | ''; |
| 303 | 216 | matchBlocks = rec { |
| 217 | "*" = { }; |
| 304 | 218 | zenith = { |
| 305 | 219 | user = "clo"; |
| 306 | | port = 222; |
| 220 | port = 22; |
| 221 | }; |
| 222 | "git.paperclover.net" = zenith; |
| 223 | "paperclover.net" = { |
| 224 | user = "clo"; |
| 225 | port = 22; |
| 307 | 226 | }; |
| 308 | | "nas.paperclover.net" = zenith; |
| 309 | 227 | }; |
| 310 | 228 | }; |
| 311 | 229 | }; |