20 fetchNpmPackage = {name, version, hash, js_prod_file, js_dev_file, ...} @ args:
23 url = "https://registry.npmjs.org/${name}/-/${baseNameOf name}-${version}.tgz";
28 { src = js_prod_file; dst = "./src/environmentd/src/http/static/js/vendor/${name}.js"; }
29 { src = js_prod_file; dst = "./src/prof-http/src/http/static/js/vendor/${name}.js"; }
30 { src = js_dev_file; dst = "./src/environmentd/src/http/static-dev/js/vendor/${name}.js"; }
31 { src = js_dev_file; dst = "./src/prof-http/src/http/static-dev/js/vendor/${name}.js"; }
32 ] ++ lib.optionals (args ? css_file) [
33 { src = css_file; dst = "./src/environmentd/src/http/static/css/vendor/${name}.css"; }
34 { src = css_file; dst = "./src/prof-http/src/http/static/css/vendor/${name}.css"; }
36 ++ lib.optionals (args ? extra_file) [
37 { src = extra_file.src; dst = "./src/environmentd/src/http/static/${extra_file.dst}";}
38 { src = extra_file.src; dst = "./src/prof-http/src/http/static/${extra_file.dst}";}
41 lib.concatStringsSep "\n" (lib.forEach files ({src, dst}: ''
42 mkdir -p "${dirOf dst}"
43 cp "${package}/${src}" "${dst}"
46 npmPackages = import ./npm_deps.nix;
48 rustPlatform.buildRustPackage rec {
49 pname = "materialize";
51 MZ_DEV_BUILD_SHA = "9f8cf75b461d288335cb6a7a73aaa670bab4a466";
53 src = fetchFromGitHub {
54 owner = "MaterializeInc";
57 hash = "sha256-+cvTCiTbuaPYPIyDxQlMWdJA5/6cbMoiTcSmjj5KPjs=";
58 fetchSubmodules = true;
62 ${lib.concatStringsSep "\n" (map fetchNpmPackage npmPackages)}
63 substituteInPlace ./misc/dist/materialized.service \
64 --replace /usr/bin $out/bin \
65 --replace _Materialize root
66 substituteInPlace ./src/catalog/build.rs \
67 --replace '&[ ' '&["."'
70 # needed for internal protobuf c wrapper library
71 env.PROTOC = "${protobuf}/bin/protoc";
72 env.PROTOC_INCLUDE = "${protobuf}/include";
73 # needed to dynamically link rdkafka
74 env.CARGO_FEATURE_DYNAMIC_LINKING=1;
77 lockFile = ./Cargo.lock;
79 "columnation-0.1.0" = "sha256-VRDQqIVLayEnMHeth4cjsS/FYah3B3mwYEGnv8jpKs8=";
80 "differential-dataflow-0.12.0" = "sha256-cEmtDXOZSy4rDFZ7gCd7lx6wH+m1S9vphjb+wO4MSAM=";
81 "eventsource-client-0.11.0" = "sha256-FeEWV2yy1et5mna0TyAnakXlcIR42Aq97Lfjjlom8T0=";
82 "launchdarkly-server-sdk-1.0.0" = "sha256-fSWiV9mNf5WBkWDNckiUR3URQ8lJ4GZURxbYO/753sU=";
83 "librocksdb-sys-0.11.0+8.3.2" = "sha256-bnAvH2z9n26MYFhTN/+Yz+7lEdNKKmHJOoHkxTdZGvw=";
84 "openssh-0.9.9" = "sha256-2jaQN6PhavUtlWwqCn2VXEg213uj7BQ+FIrhnL3rb8Q=";
85 "postgres-0.19.5" = "sha256-i0mURHTCMrgaW1DD1CihWMdZ3zoNI14dCpq/ja8RW9E=";
86 "postgres_array-0.11.0" = "sha256-ealgPVExRIFUt0QVao8H7Q7u/PTuCbpGrk6Tm5jVwZ0=";
87 "proptest-1.0.0" = "sha256-sJbPQIVeHZZiRXssRpJWRbD9l8QnfwVcpGu6knjAe5o=";
88 "rdkafka-0.29.0" = "sha256-48CMvJ4PoVfKyiNMSpCGBtj36j2CF1E8a/QQ/urfiPc=";
89 "reqwest-middleware-0.2.3" = "sha256-zzlQycH5dmgM8ew1gy8m5r6Q2ib7LXnUeX69M3ih+sY=";
90 "serde-value-0.7.0" = "sha256-ewEYsf1+9MmLuSm5KbO326ngGB79i00lAp2NMHuuxw8=";
91 "timely-0.12.0" = "sha256-wJtHJ9ygPVusN5Io8SjZGo1r7lcrrcauESSC+9038AU=";
92 "tonic-build-0.9.2" = "sha256-cGvHjgmdr3NU1phwUfMvEE6uU12fOlhTlL2LoWeOO4I=";
93 "tracing-opentelemetry-0.22.0" = "sha256-mawDGrue/e3dPYVG0ANs9nZ+xmQyd1YTWH8QmE6VD0U=";
101 rustPlatform.bindgenHook
103 # Provides the mig command used by the krb5-src build script
104 ++ lib.optional stdenv.hostPlatform.isDarwin bootstrap_cmds;
106 # Needed to get openssl-sys to use pkg-config.
107 OPENSSL_NO_VENDOR = 1;
109 buildInputs = [ openssl rdkafka libclang ]
110 ++ lib.optionals stdenv.hostPlatform.isDarwin [ libiconv DiskArbitration Foundation ];
112 # the check phase requires linking with rocksdb which can be a problem since
113 # the rust rocksdb crate is not updated very often.
116 # Skip tests that use the network
120 "--skip test_client_errors"
121 "--skip test_client_all_subjects"
122 "--skip test_client_subject_and_references"
123 "--skip test_no_block"
124 "--skip test_safe_mode"
128 cargoBuildFlags = [ "--bin environmentd --bin clusterd" ];
131 install --mode=444 -D ./misc/dist/materialized.service $out/etc/systemd/system/materialized.service
135 homepage = "https://materialize.com";
136 description = "Streaming SQL materialized view engine for real-time applications";
137 license = licenses.bsl11;
138 platforms = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" ];
139 maintainers = [ maintainers.petrosagg ];