1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
{
lib,
stdenv,
fetchFromGitHub,
rustPlatform,
gitMinimal,
installShellFiles,
installAgentSkills,
versionCheckHook,
writableTmpDirAsHomeHook,
nix-update-script,
}:
rustPlatform.buildRustPackage (finalAttrs: {
pname = "worktrunk";
version = "0.74.0";
src = fetchFromGitHub {
owner = "max-sixty";
repo = "worktrunk";
tag = "v${finalAttrs.version}";
hash = "sha256-uSGGnQ8VmkbSuy8RrdRXEc4thNTlXfdsIolp2wWrGAk=";
};
cargoHash = "sha256-Py/zcsUHT9IGjRDbTntwTaQ9G60auZKVD9G/16bRFuI=";
cargoBuildFlags = [ "--package=worktrunk" ];
# vergen-gitcl calls `git describe` at build time; VERGEN_IDEMPOTENT makes it
# fall back gracefully when no git history is available (Nix sandbox).
env.VERGEN_IDEMPOTENT = "1";
nativeBuildInputs = [
installShellFiles
installAgentSkills
# wt reads config from $HOME when generating completions
writableTmpDirAsHomeHook
];
dontInstallAgentSkills = true;
postInstall = ''
installSkill skills/worktrunk worktrunk
installSkill skills/wt-switch-create worktrunk
''
+ lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
installShellCompletion --cmd wt \
--bash <($out/bin/wt config shell completions bash) \
--fish <($out/bin/wt config shell completions fish) \
--nushell <($out/bin/wt config shell completions nu) \
--zsh <($out/bin/wt config shell completions zsh)
'';
nativeCheckInputs = [ gitMinimal ];
checkFlags = [
# Expects `which` on PATH
"--skip=output::commit_generation::tests::test_command_exists_known_command"
# Integration tests use insta snapshots with environment-specific paths
"--skip=integration_tests::"
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
# These tests probe the live process table — on macOS that means libproc
# (`proc_listallpids` / `proc_pidinfo`). Inside the Nix darwin sandbox,
# those calls are denied. The build process can't even read its own pid
# from the table, so two tests panic:
"--skip=shell::utils::tests::test_process_name_and_ppid_self"
"--skip=shell::utils::tests::test_probe_reports_invoked_name_for_sh"
];
doInstallCheck = true;
nativeInstallCheckInputs = [ versionCheckHook ];
passthru.updateScript = nix-update-script { };
meta = {
description = "Git worktree manager for parallel AI agent workflows";
longDescription = ''
worktrunk wraps git worktree with a simpler interface and integrates with
AI coding tools like Claude Code, Cursor, and Aider.
'';
homepage = "https://worktrunk.dev/";
changelog = "https://github.com/max-sixty/worktrunk/blob/v${finalAttrs.version}/CHANGELOG.md";
license = with lib.licenses; [
mit
asl20
];
platforms = lib.platforms.unix;
mainProgram = "wt";
maintainers = with lib.maintainers; [
siriobalmelli
DuskyElf
yzx9
];
};
})
|