lol
1{
2 lib,
3 callPackage,
4 rustPlatform,
5 fetchFromGitHub,
6 buildNpmPackage,
7 bash,
8 cmake,
9 cairo,
10 deno,
11 go,
12 lld,
13 makeWrapper,
14 nsjail,
15 openssl,
16 pango,
17 pixman,
18 pkg-config,
19 python312,
20 rustfmt,
21 stdenv,
22 perl,
23 _experimental-update-script-combinators,
24 nix-update-script,
25 librusty_v8 ? (
26 callPackage ./librusty_v8.nix {
27 inherit (callPackage ./fetchers.nix { }) fetchLibrustyV8;
28 }
29 ),
30 ui_builder ? (callPackage ./ui_builder.nix { }),
31 libxml2,
32 xmlsec,
33 libxslt,
34 flock,
35 powershell,
36 uv,
37 bun,
38 dotnet-sdk_9,
39 php,
40 procps,
41 cargo,
42 coreutils,
43 withEnterpriseFeatures ? false,
44 withClosedSourceFeatures ? false,
45}:
46
47let
48 pname = "windmill";
49 version = "1.549.1";
50
51 src = fetchFromGitHub {
52 owner = "windmill-labs";
53 repo = "windmill";
54 rev = "v${version}";
55 hash = "sha256-+4cYZCD8iqrrckYWTDCM++SogptXXahfCKN6O8E8HuE=";
56 };
57in
58rustPlatform.buildRustPackage (finalAttrs: {
59 inherit pname version src;
60 sourceRoot = "${src.name}/backend";
61
62 env = {
63 SQLX_OFFLINE = "true";
64 FRONTEND_BUILD_DIR = "${finalAttrs.passthru.web-ui}/share/windmill-frontend";
65 RUSTY_V8_ARCHIVE = librusty_v8;
66 };
67
68 cargoHash = "sha256-m7/72IRbzllAfAlbjKsjGrTaiXzpj2TufLKrTpKLbUU=";
69
70 buildFeatures = [
71 "agent_worker_server"
72 # "benchmark" # DO NOT ACTIVATE, this is for benchmark testing
73 #"bigquery"
74 "cloud"
75 "csharp"
76 "default"
77 "deno_core"
78 "dind"
79 #"duckdb"
80 "embedding"
81 "flow_testing"
82 "gcp_trigger"
83 "http_trigger"
84 #"java"
85 "jemalloc"
86 "kafka"
87 "license"
88 "loki"
89 "mcp"
90 "mqtt_trigger"
91 #"mssql"
92 #"mysql"
93 "nats"
94 #"nu"
95 "oauth2"
96 "openidconnect"
97 #"oracledb"
98 "parquet"
99 "php"
100 "postgres_trigger"
101 "python"
102 #"ruby"
103 #"rust" # compiler environment is incomplete
104 "scoped_cache"
105 "smtp"
106 "sqlx"
107 "sqs_trigger"
108 "static_frontend"
109 "websocket"
110 "zip"
111 ]
112 ++ (lib.optionals withEnterpriseFeatures [
113 "enterprise_saml"
114 "enterprise"
115 "otel"
116 "prometheus"
117 "stripe"
118 "tantivy"
119 ])
120 ++ (lib.optionals withClosedSourceFeatures [ "private" ]);
121
122 patches = [
123 ./download.py.config.proto.patch
124 ./python_executor.patch
125 ./python_versions.patch
126 ./run.ansible.config.proto.patch
127 ./run.bash.config.proto.patch
128 ./run.bun.config.proto.patch
129 ./run.csharp.config.proto.patch
130 ./run.go.config.proto.patch
131 ./run.php.config.proto.patch
132 ./run.powershell.config.proto.patch
133 ./run.python3.config.proto.patch
134 ./run.rust.config.proto.patch
135 ./rust_executor.patch
136 ];
137
138 postPatch = ''
139 substituteInPlace windmill-common/src/utils.rs \
140 --replace-fail 'unknown-version' 'v${version}'
141 '';
142
143 buildInputs = [
144 openssl
145 rustfmt
146 lld
147 (lib.getLib stdenv.cc.cc)
148 libxml2
149 xmlsec
150 libxslt
151 ];
152
153 nativeBuildInputs = [
154 pkg-config
155 makeWrapper
156 cmake # for libz-ng-sys crate
157 perl
158 ];
159
160 # needs a postgres database running
161 doCheck = false;
162
163 postFixup = ''
164 wrapProgram "$out/bin/windmill" \
165 --prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ stdenv.cc.cc ]} \
166 --prefix PATH : ${
167 lib.makeBinPath [
168 # uv searches for python on path as well!
169 python312
170
171 procps # bash_executor
172 coreutils # bash_executor
173 ]
174 } \
175 --set PYTHON_PATH "${python312}/bin/python3" \
176 --set GO_PATH "${go}/bin/go" \
177 --set DENO_PATH "${deno}/bin/deno" \
178 --set NSJAIL_PATH "${nsjail}/bin/nsjail" \
179 --set FLOCK_PATH "${flock}/bin/flock" \
180 --set BASH_PATH "${bash}/bin/bash" \
181 --set POWERSHELL_PATH "${powershell}/bin/pwsh" \
182 --set BUN_PATH "${bun}/bin/bun" \
183 --set UV_PATH "${uv}/bin/uv" \
184 --set DOTNET_PATH "${dotnet-sdk_9}/bin/dotnet" \
185 --set DOTNET_ROOT "${dotnet-sdk_9}/share/dotnet" \
186 --set PHP_PATH "${php}/bin/php" \
187 --set CARGO_PATH "${cargo}/bin/cargo"
188 '';
189
190 passthru.web-ui = buildNpmPackage {
191 inherit version src;
192
193 pname = "windmill-ui";
194
195 sourceRoot = "${src.name}/frontend";
196
197 npmDepsHash = "sha256-2CBqPDEqKGDIGo7ARK3sxTkFNsTxIa6V1QCtSKDkj4I=";
198
199 # without these you get a
200 # FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
201 env.NODE_OPTIONS = "--max-old-space-size=8192";
202
203 postUnpack = ''
204 cp ${src}/openflow.openapi.yaml .
205 '';
206
207 # WORKS
208 npmFlags = [
209 # Skip "postinstall" script that attempts to download and unpack ui-builder (patching out the url with nix-store path doesn't work)
210 "--ignore-scripts"
211 ];
212
213 preBuild = ''
214 npm run generate-backend-client
215 '';
216
217 buildInputs = [
218 pixman
219 cairo
220 pango
221 ];
222 nativeBuildInputs = [
223 pkg-config
224 ];
225
226 installPhase = ''
227 mkdir -p $out/share
228 mv build $out/share/windmill-frontend
229
230 mkdir -p $out/share/windmill-frontend/static
231 ln -s ${ui_builder} $out/share/windmill-frontend/static/ui_builder
232 '';
233 };
234
235 passthru.updateScript = _experimental-update-script-combinators.sequence [
236 (nix-update-script {
237 extraArgs = [
238 "--subpackage"
239 "web-ui"
240 ];
241 })
242 (./update-librusty.sh)
243 (./update-ui_builder.sh)
244 ];
245
246 meta = {
247 changelog = "https://github.com/windmill-labs/windmill/blob/${src.rev}/CHANGELOG.md";
248 description = "Open-source developer platform to turn scripts into workflows and UIs";
249 homepage = "https://windmill.dev";
250 license = lib.licenses.agpl3Only;
251 maintainers = with lib.maintainers; [
252 dit7ya
253 happysalada
254 ];
255 mainProgram = "windmill";
256 # limited by librusty_v8
257 # nsjail not available on darwin
258 platforms = [
259 "x86_64-linux"
260 "aarch64-linux"
261 ];
262 };
263})