forked from mistlehq/mistle
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
150 lines (138 loc) · 5.02 KB
/
Copy pathflake.nix
File metadata and controls
150 lines (138 loc) · 5.02 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
{
description = "Mistle local development shell (Nix-first)";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
nodejs = if pkgs ? nodejs_25 then pkgs.nodejs_25 else pkgs.nodejs;
docsNodejs = if pkgs ? nodejs_22 then pkgs.nodejs_22 else pkgs.nodejs;
codexVersion = "0.142.5";
opencodeVersion = "1.17.13";
codexReleaseAsset =
{
x86_64-linux = {
fileName = "codex-x86_64-unknown-linux-musl.tar.gz";
binaryName = "codex-x86_64-unknown-linux-musl";
hash = "sha256-y5M+w8thv0tfyI7s9eYUmCn6phclNbbvCvsBVL60qrg=";
};
aarch64-linux = {
fileName = "codex-aarch64-unknown-linux-musl.tar.gz";
binaryName = "codex-aarch64-unknown-linux-musl";
hash = "sha256-sYx1xJZFkY+uI766CrQcBfB5QWAVEKJFG6l/5RlXPDg=";
};
x86_64-darwin = {
fileName = "codex-x86_64-apple-darwin.tar.gz";
binaryName = "codex-x86_64-apple-darwin";
hash = "sha256-OWmjMytf4/Hfar0jcU5tkBFgRHUk7reOoSKRq8h7OWA=";
};
aarch64-darwin = {
fileName = "codex-aarch64-apple-darwin.tar.gz";
binaryName = "codex-aarch64-apple-darwin";
hash = "sha256-cVaxmWJzXJz7VVzde6voxA55dogfhxK3gRmSGdLjpwc=";
};
}
.${system}
or (throw "Unsupported system for pinned Codex CLI: ${system}");
opencodeReleaseAsset =
{
x86_64-linux = {
fileName = "opencode-linux-x64-baseline.tar.gz";
hash = "sha256-MBwkXdgbqA7ft9bu51V/WP4PUXRUH7iRQLdl5VTrxf0=";
unpackPhase = ''tar -xzf "$src"'';
};
aarch64-linux = {
fileName = "opencode-linux-arm64.tar.gz";
hash = "sha256-u6zN03Sqq2bNl8f4rRwICqOTYQ+l+A7o38AH+VAK+vk=";
unpackPhase = ''tar -xzf "$src"'';
};
x86_64-darwin = {
fileName = "opencode-darwin-x64-baseline.zip";
hash = "sha256-Fyzk79Ot/tZ4YWzMcFkvrCT0JPHclsI88dKrA30lXmk=";
unpackPhase = ''unzip "$src"'';
};
aarch64-darwin = {
fileName = "opencode-darwin-arm64.zip";
hash = "sha256-3QFtPiazR9Z1qybEXR4odUWRLVxMSfoHcLYi1KE2fiM=";
unpackPhase = ''unzip "$src"'';
};
}
.${system}
or (throw "Unsupported system for pinned OpenCode CLI: ${system}");
codexPinned = pkgs.stdenvNoCC.mkDerivation {
pname = "codex";
version = codexVersion;
src = pkgs.fetchurl {
url =
"https://github.com/openai/codex/releases/download/rust-v${codexVersion}/${codexReleaseAsset.fileName}";
hash = codexReleaseAsset.hash;
};
dontConfigure = true;
dontBuild = true;
unpackPhase = ''
tar -xzf "$src"
'';
installPhase = ''
mkdir -p "$out/bin"
install -m755 "${codexReleaseAsset.binaryName}" "$out/bin/codex"
'';
};
opencodePinned = pkgs.stdenvNoCC.mkDerivation {
pname = "opencode";
version = opencodeVersion;
src = pkgs.fetchurl {
url =
"https://github.com/anomalyco/opencode/releases/download/v${opencodeVersion}/${opencodeReleaseAsset.fileName}";
hash = opencodeReleaseAsset.hash;
};
nativeBuildInputs = [ pkgs.unzip ];
dontConfigure = true;
dontBuild = true;
unpackPhase = opencodeReleaseAsset.unpackPhase;
installPhase = ''
mkdir -p "$out/bin"
install -m755 opencode "$out/bin/opencode"
'';
};
commonPackages = [
pkgs.typos
pkgs.llvm
pkgs.pnpm
pkgs.rustc
pkgs.cargo
pkgs.rustfmt
pkgs.clippy
pkgs.rust-analyzer
pkgs.ripgrep
pkgs.cloudflared
pkgs.docker
pkgs.git
pkgs.git-cliff
pkgs.jq
pkgs.ripgrep
];
commonShellHook = ''
export COREPACK_ENABLE_DOWNLOAD_PROMPT=0
export RUST_SRC_PATH=${pkgs.rustPlatform.rustLibSrc}
'';
in
{
packages.codex = codexPinned;
packages.opencode = opencodePinned;
devShells.default = pkgs.mkShell {
packages = [nodejs codexPinned opencodePinned] ++ commonPackages;
shellHook = ''
${commonShellHook}
export PATH=${codexPinned}/bin:$PATH
export PATH=${opencodePinned}/bin:$PATH
'';
};
devShells.docs = pkgs.mkShell {
packages = [docsNodejs] ++ commonPackages;
shellHook = commonShellHook;
};
});
}