This repository was archived by the owner on Mar 18, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
185 lines (175 loc) · 6.79 KB
/
flake.nix
File metadata and controls
185 lines (175 loc) · 6.79 KB
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
systems.url = "github:nix-systems/default";
# Claude loop scripts (ralph_wiggum) - private repo, use git+ssh
prompts = {
url = "git+ssh://git@github.com/fuww/prompts.git";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, systems, prompts, ... }:
let
forEachSystem = nixpkgs.lib.genAttrs (import systems);
beadsRustVersion = "0.1.19";
beadsRustHashes = {
"x86_64-linux" = "sha256-rL0PabvZxOLr+iOmZfmpB2tgoCxc/CQLVDFB8NRWHYY=";
"x86_64-darwin" = "sha256-98srAx9fRr7NDbzVjIs4za7KONicVgPkZEimSaZ85/w=";
"aarch64-darwin" = "sha256-p8cZ6+c4LUSMU1Cvz+lus6NfYYTWFilCD2Jt2G+PGSg=";
};
beadsRustTargets = {
"x86_64-linux" = "linux_amd64";
"x86_64-darwin" = "darwin_amd64";
"aarch64-darwin" = "darwin_arm64";
};
prekVersion = "0.3.3";
prekHashes = {
"x86_64-linux" = "sha256-RPYzZ6h/zqvoYrByNARmRc4SFAix7Y6nquANClQMonE=";
"x86_64-darwin" = "sha256-C2VVXSvSrdaySh8r5Rz+5tDIN4klYLrywhY72vr+0zg=";
"aarch64-linux" = "sha256-hckriLkcvhVIouYWMq8ASgnH8rtHXANzy7DFI6hI4gQ=";
"aarch64-darwin" = "sha256-EsHigdTUhOqm1QKATGqMd6sG8f3SLF/UbAL4euXzwa8=";
};
prekTargets = {
"x86_64-linux" = "x86_64-unknown-linux-gnu";
"x86_64-darwin" = "x86_64-apple-darwin";
"aarch64-linux" = "aarch64-unknown-linux-gnu";
"aarch64-darwin" = "aarch64-apple-darwin";
};
codexVersion = "0.106.0";
codexHashes = {
"x86_64-linux" = "sha256-T3D3t3V+JawmyiN1TRGzzLPeGSyCYP1rTylKNcssZ3w=";
};
codexVendorDirs = {
"x86_64-linux" = "x86_64-unknown-linux-musl";
};
geminiVersion = "0.31.0";
geminiHash = "sha256-b/xQN42G06Iu82MOKqLb8ybuBfvdtx/dlefI1YfXVeQ=";
in
{
devShells = forEachSystem
(system:
let
pkgs = import nixpkgs {
inherit system;
};
beads-rust = pkgs.stdenv.mkDerivation {
pname = "beads-rust";
version = beadsRustVersion;
src = pkgs.fetchurl {
url = "https://github.com/Dicklesworthstone/beads_rust/releases/download/v${beadsRustVersion}/br-v${beadsRustVersion}-${beadsRustTargets.${system}}.tar.gz";
hash = beadsRustHashes.${system};
};
sourceRoot = ".";
installPhase = ''
mkdir -p $out/bin
cp br $out/bin/
chmod +x $out/bin/br
'';
meta = {
description = "AI-supervised issue tracker (Rust rewrite)";
homepage = "https://github.com/Dicklesworthstone/beads_rust";
license = pkgs.lib.licenses.mit;
};
};
prek = pkgs.stdenv.mkDerivation {
pname = "prek";
version = prekVersion;
src = pkgs.fetchurl {
url = "https://github.com/j178/prek/releases/download/v${prekVersion}/prek-${prekTargets.${system}}.tar.gz";
hash = prekHashes.${system};
};
sourceRoot = ".";
installPhase = ''
mkdir -p $out/bin
cp prek-${prekTargets.${system}}/prek $out/bin/
chmod +x $out/bin/prek
'';
meta = {
description = "Better pre-commit, re-engineered in Rust";
homepage = "https://github.com/j178/prek";
license = pkgs.lib.licenses.mit;
};
};
codex = pkgs.stdenv.mkDerivation {
pname = "codex";
version = codexVersion;
src = pkgs.fetchurl {
url = "https://registry.npmjs.org/@openai/codex/-/codex-${codexVersion}-linux-x64.tgz";
hash = codexHashes.${system};
};
sourceRoot = ".";
unpackPhase = ''
tar xzf $src
'';
installPhase = ''
mkdir -p $out/bin
cp package/vendor/${codexVendorDirs.${system}}/codex/codex $out/bin/codex
chmod +x $out/bin/codex
'';
meta = {
description = "OpenAI Codex CLI coding agent";
homepage = "https://github.com/openai/codex";
license = pkgs.lib.licenses.asl20;
};
};
gemini-cli = pkgs.stdenv.mkDerivation {
pname = "gemini-cli";
version = geminiVersion;
src = pkgs.fetchurl {
url = "https://github.com/google-gemini/gemini-cli/releases/download/v${geminiVersion}/gemini.js";
hash = geminiHash;
};
dontUnpack = true;
nativeBuildInputs = [ pkgs.makeWrapper ];
installPhase = ''
mkdir -p $out/lib $out/bin
cp $src $out/lib/gemini.js
makeWrapper ${pkgs.nodejs}/bin/node $out/bin/gemini \
--add-flags "$out/lib/gemini.js"
'';
meta = {
description = "Google Gemini CLI coding agent";
homepage = "https://github.com/google-gemini/gemini-cli";
license = pkgs.lib.licenses.asl20;
};
};
in
{
default = pkgs.mkShell {
packages = [
beads-rust
prek
gemini-cli
] ++ (pkgs.lib.optionals (codexHashes ? ${system}) [ codex ]) ++ (with pkgs; [
git
gh
jujutsu
ripgrep
(python3.withPackages (ps: with ps; [
pip
]))
]);
shellHook = ''
prek install
# === Claude Loop Setup (ralph_wiggum) ===
_LOOP_SRC="${prompts}/ralph_wiggum"
# Symlink loop.sh (always from central repo)
if [[ ! -L ./loop.sh ]] || [[ "$(readlink ./loop.sh 2>/dev/null)" != "$_LOOP_SRC/loop.sh" ]]; then
rm -f ./loop.sh 2>/dev/null || true
ln -sf "$_LOOP_SRC/loop.sh" ./loop.sh
fi
# Symlink PROMPT_*.md unless local override exists (regular file)
for _p in PROMPT_build.md PROMPT_plan.md PROMPT_review.md; do
if [[ -f "./$_p" ]] && [[ ! -L "./$_p" ]]; then
: # Local override exists, keep it
else
ln -sf "$_LOOP_SRC/$_p" "./$_p" 2>/dev/null || true
fi
done
echo " Beads: $(br --version)"
echo ""
'';
};
});
};
}