Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 235 lines 5.2 kB view raw
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 python3, 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 libxml2, 31 xmlsec, 32 libxslt, 33 flock, 34 powershell, 35 uv, 36 bun, 37 dotnet-sdk_9, 38 php, 39 procps, 40 cargo, 41 coreutils, 42 withEnterpriseFeatures ? false, 43}: 44 45let 46 pname = "windmill"; 47 version = "1.474.0"; 48 49 src = fetchFromGitHub { 50 owner = "windmill-labs"; 51 repo = "windmill"; 52 rev = "v${version}"; 53 hash = "sha256-9BtItmqyW4NbG4istssAYn4CWlfYAv33CE1enL+5LtE="; 54 }; 55in 56rustPlatform.buildRustPackage (finalAttrs: { 57 inherit pname version src; 58 sourceRoot = "${src.name}/backend"; 59 60 env = { 61 SQLX_OFFLINE = "true"; 62 FRONTEND_BUILD_DIR = "${finalAttrs.passthru.web-ui}/share/windmill-frontend"; 63 RUSTY_V8_ARCHIVE = librusty_v8; 64 }; 65 66 cargoHash = "sha256-6htM6p09mPUQmS+QVBDO7Y/tuwweHgA+W/E3XTNunB8="; 67 68 buildFeatures = [ 69 "embedding" 70 "parquet" 71 "prometheus" 72 "openidconnect" 73 "cloud" 74 "jemalloc" 75 "deno_core" 76 "license" 77 "http_trigger" 78 "zip" 79 "oauth2" 80 "kafka" 81 "otel" 82 "dind" 83 "php" 84 "mysql" 85 "mssql" 86 "bigquery" 87 "websocket" 88 "python" 89 "smtp" 90 "csharp" 91 "static_frontend" 92 # "rust" # compiler environment is incomplete 93 ] 94 ++ (lib.optionals withEnterpriseFeatures [ 95 "enterprise" 96 "enterprise_saml" 97 "tantivy" 98 "stripe" 99 ]); 100 101 patches = [ 102 ./download.py.config.proto.patch 103 ./python_executor.patch 104 ./run.ansible.config.proto.patch 105 ./run.bash.config.proto.patch 106 ./run.bun.config.proto.patch 107 ./run.csharp.config.proto.patch 108 ./run.go.config.proto.patch 109 ./run.php.config.proto.patch 110 ./run.powershell.config.proto.patch 111 ./run.python3.config.proto.patch 112 ./run.rust.config.proto.patch 113 ./rust_executor.patch 114 ./swagger-cli.patch 115 ]; 116 117 postPatch = '' 118 substituteInPlace windmill-common/src/utils.rs \ 119 --replace-fail 'unknown-version' 'v${version}' 120 121 substituteInPlace windmill-worker/src/python_executor.rs \ 122 --replace-fail 'unknown_system_python_version' '${python3.version}' 123 ''; 124 125 buildInputs = [ 126 openssl 127 rustfmt 128 lld 129 (lib.getLib stdenv.cc.cc) 130 libxml2 131 xmlsec 132 libxslt 133 ]; 134 135 nativeBuildInputs = [ 136 pkg-config 137 makeWrapper 138 cmake # for libz-ng-sys crate 139 perl 140 ]; 141 142 # needs a postgres database running 143 doCheck = false; 144 145 # TODO; Check if the rpath is still required 146 # patchelf --set-rpath ${lib.makeLibraryPath [ openssl ]} $out/bin/windmill 147 postFixup = '' 148 wrapProgram "$out/bin/windmill" \ 149 --prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ stdenv.cc.cc ]} \ 150 --prefix PATH : ${ 151 lib.makeBinPath [ 152 python3 # uv searches PATH for system python 153 procps # bash_executor 154 coreutils # bash_executor 155 ] 156 } \ 157 --set PYTHON_PATH "${python3}/bin/python3" \ 158 --set GO_PATH "${go}/bin/go" \ 159 --set DENO_PATH "${deno}/bin/deno" \ 160 --set NSJAIL_PATH "${nsjail}/bin/nsjail" \ 161 --set FLOCK_PATH "${flock}/bin/flock" \ 162 --set BASH_PATH "${bash}/bin/bash" \ 163 --set POWERSHELL_PATH "${powershell}/bin/pwsh" \ 164 --set BUN_PATH "${bun}/bin/bun" \ 165 --set UV_PATH "${uv}/bin/uv" \ 166 --set DOTNET_PATH "${dotnet-sdk_9}/bin/dotnet" \ 167 --set DOTNET_ROOT "${dotnet-sdk_9}/share/dotnet" \ 168 --set PHP_PATH "${php}/bin/php" \ 169 --set CARGO_PATH "${cargo}/bin/cargo" 170 ''; 171 172 passthru.web-ui = buildNpmPackage { 173 inherit version src; 174 175 pname = "windmill-ui"; 176 177 sourceRoot = "${src.name}/frontend"; 178 179 npmDepsHash = "sha256-liWoAgAIgU8+J1x2mR7bGl9MOpCuGIf0Qa1nEouFnBU="; 180 181 # without these you get a 182 # FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory 183 env.NODE_OPTIONS = "--max-old-space-size=8192"; 184 185 postUnpack = '' 186 cp ${src}/openflow.openapi.yaml . 187 ''; 188 189 preBuild = '' 190 npm run generate-backend-client 191 ''; 192 193 buildInputs = [ 194 pixman 195 cairo 196 pango 197 ]; 198 nativeBuildInputs = [ 199 pkg-config 200 ]; 201 202 installPhase = '' 203 mkdir -p $out/share 204 mv build $out/share/windmill-frontend 205 ''; 206 }; 207 208 passthru.updateScript = _experimental-update-script-combinators.sequence [ 209 (nix-update-script { 210 extraArgs = [ 211 "--subpackage" 212 "web-ui" 213 ]; 214 }) 215 (./update-librusty.sh) 216 ]; 217 218 meta = { 219 changelog = "https://github.com/windmill-labs/windmill/blob/${src.rev}/CHANGELOG.md"; 220 description = "Open-source developer platform to turn scripts into workflows and UIs"; 221 homepage = "https://windmill.dev"; 222 license = lib.licenses.agpl3Only; 223 maintainers = with lib.maintainers; [ 224 dit7ya 225 happysalada 226 ]; 227 mainProgram = "windmill"; 228 # limited by librusty_v8 229 # nsjail not available on darwin 230 platforms = [ 231 "x86_64-linux" 232 "aarch64-linux" 233 ]; 234 }; 235})