Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ stdenv 2, lib 3, fetchFromGitHub 4, fetchzip 5, rustPlatform 6, bootstrap_cmds 7, DiskArbitration 8, Foundation 9, cmake 10, libiconv 11, openssl 12, perl 13, pkg-config}: 14 15let 16 fetchNpmPackage = {name, version, hash, js_prod_file, js_dev_file, ...} @ args: 17 let 18 package = fetchzip { 19 url = "https://registry.npmjs.org/${name}/-/${baseNameOf name}-${version}.tgz"; 20 inherit hash; 21 }; 22 23 static = "./src/materialized/src/http/static"; 24 cssVendor = "./src/materialized/src/http/static/css/vendor"; 25 jsProdVendor = "./src/materialized/src/http/static/js/vendor"; 26 jsDevVendor = "./src/materialized/src/http/static-dev/js/vendor"; 27 28 files = with args; [ 29 { src = js_prod_file; dst = "${jsProdVendor}/${name}.js"; } 30 { src = js_dev_file; dst = "${jsDevVendor}/${name}.js"; } 31 ] ++ lib.optional (args ? css_file) { src = css_file; dst = "${cssVendor}/${name}.css"; } 32 ++ lib.optional (args ? extra_file) { src = extra_file.src; dst = "${static}/${extra_file.dst}"; }; 33 in 34 lib.concatStringsSep "\n" (lib.forEach files ({src, dst}: '' 35 mkdir -p "${dirOf dst}" 36 cp "${package}/${src}" "${dst}" 37 '')); 38 39 npmPackages = import ./npm_deps.nix; 40in 41rustPlatform.buildRustPackage rec { 42 pname = "materialize"; 43 version = "0.17.0"; 44 MZ_DEV_BUILD_SHA = "9f8cf75b461d288335cb6a7a73aaa670bab4a466"; 45 46 src = fetchFromGitHub { 47 owner = "MaterializeInc"; 48 repo = pname; 49 rev = "v${version}"; 50 hash = "sha256-wKYU5S77VoOX7UA9/d21Puz9NYs/om08eNM69/m3Orc="; 51 }; 52 53 cargoLock = { 54 lockFile = ./Cargo.lock; 55 outputHashes = { 56 "criterion-0.3.5" = "sha256-gXhwLw99kC08zxHdY6l5LF5EVzAAFasI4GLnopLwhEU="; 57 "differential-dataflow-0.12.0" = "sha256-sDy4502XqCuXqRtwLWuaHSgfX7v9NNochhfpI6n8DrM="; 58 "headers-0.3.5" = "sha256-ipxMfuPgoeH2uR4Im/XBdnxT00+LGzTgW7Ed2armYOU="; 59 "mzcloud-1.0.0" = "sha256-Nt9YCG+DFCCOMbKaNhOD78WF/z3qB5ymUIp6Wep2A9A="; 60 "parquet-format-async-temp-0.2.0" = "sha256-UUQv/90egmwQK0CZCztinEskvWcZ40rKWbJoWYz2oLQ="; 61 "postgres-0.19.1" = "sha256-zH7PF4p7wJCSYpuydTL3HPcOjPU9SlTy6IJREOe2l7U="; 62 "postgres_array-0.11.0" = "sha256-M1nMsQfxK0ay4JxoPqm2cl4Cp8mVZlVUAfWDhhv9nA4="; 63 "prometheus-0.10.0" = "sha256-NTnKt1RGiZ8AxsU8UzhLhpfEi24Pos5kR9g22Mmt444="; 64 "protobuf-3.0.0-alpha.2" = "sha256-8gBGQqAtKJelcBCxnDESanlblBLQ1Th7khHxUkDw7To="; 65 "pubnub-core-0.1.0" = "sha256-YuGEFaStfrhb0ygjVFm2a2eJla9ABc5ifXKuvJxUvgk="; 66 "rdkafka-0.28.0" = "sha256-u2gBTzu+IvXTDvcZGzPaVpSVOgAKhTth7GLwob4urDs="; 67 "timely-0.12.0" = "sha256-PHaDRNm7MezXJWhILWJHTeiCWO3iLUp94Z0V2dreCMk="; 68 }; 69 }; 70 71 nativeBuildInputs = [ cmake perl pkg-config ] 72 # Provides the mig command used by the krb5-src build script 73 ++ lib.optional stdenv.isDarwin bootstrap_cmds; 74 75 # Needed to get openssl-sys to use pkg-config. 76 OPENSSL_NO_VENDOR = 1; 77 78 buildInputs = [ openssl ] 79 ++ lib.optionals stdenv.isDarwin [ libiconv DiskArbitration Foundation ]; 80 81 # Skip tests that use the network 82 checkFlags = [ 83 "--exact" 84 "--skip test_client" 85 "--skip test_client_errors" 86 "--skip test_client_all_subjects" 87 "--skip test_client_subject_and_references" 88 "--skip test_no_block" 89 "--skip test_safe_mode" 90 "--skip test_tls" 91 ]; 92 93 postPatch = '' 94 ${lib.concatStringsSep "\n" (map fetchNpmPackage npmPackages)} 95 substituteInPlace ./misc/dist/materialized.service \ 96 --replace /usr/bin $out/bin \ 97 --replace _Materialize root 98 ''; 99 100 cargoBuildFlags = [ "--bin materialized" ]; 101 102 postInstall = '' 103 install --mode=444 -D ./misc/dist/materialized.service $out/etc/systemd/system/materialized.service 104 ''; 105 106 meta = with lib; { 107 homepage = "https://materialize.com"; 108 description = "A streaming SQL materialized view engine for real-time applications"; 109 license = licenses.bsl11; 110 platforms = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" ]; 111 maintainers = [ maintainers.petrosagg ]; 112 }; 113}