nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 144 lines 3.5 kB view raw
1{ 2 lib, 3 stdenv, 4 rustPlatform, 5 fetchFromGitHub, 6 protobuf, 7 8 # nativeBuildInputs 9 cmake, 10 openssl, 11 perl, 12 pkg-config, 13 14 # buildInputs 15 rdkafka, 16 17 # tests 18 cacert, 19 versionCheckHook, 20 21 # passthru 22 testers, 23 restate, 24 nix-update-script, 25}: 26rustPlatform.buildRustPackage (finalAttrs: { 27 pname = "restate"; 28 version = "1.5.6"; 29 30 src = fetchFromGitHub { 31 owner = "restatedev"; 32 repo = "restate"; 33 tag = "v${finalAttrs.version}"; 34 hash = "sha256-N27cKlJxQtE+/fMnaTlWyM3QeOIkt5M79t9PzB69eqw="; 35 }; 36 37 cargoHash = "sha256-JnlqKESW2VBv902/qZqEr5rEDSLhnpQ/nZdYHU6tBMI="; 38 39 env = { 40 PROTOC = lib.getExe protobuf; 41 PROTOC_INCLUDE = "${protobuf}/include"; 42 43 VERGEN_GIT_SHA = "v${finalAttrs.version}"; 44 45 # rustflags as defined in the upstream's .cargo/config.toml 46 RUSTFLAGS = 47 let 48 target = stdenv.hostPlatform.config; 49 targetFlags = lib.fix (self: { 50 build = [ 51 "-C force-unwind-tables" 52 "--cfg uuid_unstable" 53 "--cfg tokio_unstable" 54 ]; 55 56 "aarch64-unknown-linux-gnu" = self.build ++ [ 57 # Enable frame pointers to support Parca (https://github.com/parca-dev/parca-agent/pull/1805) 58 "-C force-frame-pointers=yes" 59 "--cfg tokio_taskdump" 60 ]; 61 62 "x86_64-unknown-linux-musl" = self.build ++ [ 63 "-C link-self-contained=yes" 64 "--cfg tokio_taskdump" 65 ]; 66 67 "aarch64-unknown-linux-musl" = self.build ++ [ 68 # Enable frame pointers to support Parca (https://github.com/parca-dev/parca-agent/pull/1805) 69 "-C force-frame-pointers=yes" 70 "-C link-self-contained=yes" 71 "--cfg tokio_taskdump" 72 ]; 73 }); 74 in 75 lib.concatStringsSep " " (lib.attrsets.attrByPath [ target ] targetFlags.build targetFlags); 76 77 # Have to be set to dynamically link librdkafka 78 CARGO_FEATURE_DYNAMIC_LINKING = 1; 79 }; 80 81 nativeBuildInputs = [ 82 cmake 83 openssl 84 perl 85 pkg-config 86 rustPlatform.bindgenHook 87 ]; 88 89 buildInputs = [ 90 rdkafka 91 ]; 92 93 nativeCheckInputs = [ 94 cacert 95 ]; 96 97 useNextest = true; 98 # Feature resolution seems to be failing due to this https://github.com/rust-lang/cargo/issues/7754 99 auditable = false; 100 101 checkFlags = [ 102 # Error: deadline has elapsed 103 "--skip" 104 "replicated_loglet" 105 # TIMEOUT [ 180.006s] 106 "--skip" 107 "fast_forward_over_trim_gap" 108 # TIMEOUT (could be related to https://github.com/resytatedev/restate/issues/3043) 109 "--skip" 110 "restatectl_smoke_test" 111 ]; 112 113 __darwinAllowLocalNetworking = true; 114 115 nativeInstallCheckInputs = [ 116 versionCheckHook 117 ]; 118 doInstallCheck = true; 119 120 passthru = { 121 tests.restateCliVersion = testers.testVersion { 122 package = restate; 123 command = "restate --version"; 124 }; 125 tests.restateServerVersion = testers.testVersion { 126 package = restate; 127 command = "restate-server --version"; 128 }; 129 tests.restateCtlVersion = testers.testVersion { 130 package = restate; 131 command = "restatectl --version"; 132 }; 133 updateScript = nix-update-script { }; 134 }; 135 136 meta = { 137 description = "Platform for developing distributed fault-tolerant applications"; 138 homepage = "https://restate.dev"; 139 changelog = "https://github.com/restatedev/restate/releases/tag/v${finalAttrs.version}"; 140 mainProgram = "restate"; 141 license = lib.licenses.bsl11; 142 maintainers = with lib.maintainers; [ myypo ]; 143 }; 144})