Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 141 lines 3.5 kB view raw
1{ 2 lib, 3 stdenv, 4 rustPlatform, 5 fetchFromGitea, 6 openssl, 7 pkg-config, 8 protobuf, 9 cacert, 10 nixosTests, 11}: 12let 13 generic = 14 { 15 version, 16 hash, 17 cargoHash, 18 cargoPatches ? [ ], 19 eol ? false, 20 broken ? false, 21 }: 22 rustPlatform.buildRustPackage { 23 pname = "garage"; 24 inherit version; 25 26 src = fetchFromGitea { 27 domain = "git.deuxfleurs.fr"; 28 owner = "Deuxfleurs"; 29 repo = "garage"; 30 rev = "v${version}"; 31 inherit hash; 32 }; 33 34 postPatch = '' 35 # Starting in 0.9.x series, Garage is using mold in local development 36 # and this leaks in this packaging, we remove it to use the default linker. 37 rm .cargo/config.toml || true 38 ''; 39 40 inherit cargoHash cargoPatches; 41 42 nativeBuildInputs = [ 43 protobuf 44 pkg-config 45 ]; 46 47 buildInputs = [ 48 openssl 49 ]; 50 51 checkInputs = [ 52 cacert 53 ]; 54 55 OPENSSL_NO_VENDOR = true; 56 57 # See https://git.deuxfleurs.fr/Deuxfleurs/garage/src/tag/v0.8.2/nix/compile.nix#L192-L198 58 # on version changes for checking if changes are required here 59 buildFeatures = [ 60 "kubernetes-discovery" 61 "bundled-libs" 62 ] 63 ++ lib.optional (lib.versionOlder version "1.0") "sled" 64 ++ [ 65 "metrics" 66 "k2v" 67 "telemetry-otlp" 68 "lmdb" 69 "sqlite" 70 "consul-discovery" 71 ]; 72 73 # To make integration tests pass, we include the optional k2v feature here, 74 # but in buildFeatures only for version 0.8+, where it's enabled by default. 75 # See: https://garagehq.deuxfleurs.fr/documentation/reference-manual/k2v/ 76 checkFeatures = [ 77 "k2v" 78 "kubernetes-discovery" 79 "bundled-libs" 80 ] 81 ++ lib.optional (lib.versionOlder version "1.0") "sled" 82 ++ [ 83 "lmdb" 84 "sqlite" 85 ]; 86 87 disabledTests = [ 88 # Upstream told us this test is flakey. 89 "k2v::poll::test_poll_item" 90 ]; 91 92 passthru.tests = 93 lib.optionalAttrs (lib.versionAtLeast version "1") 94 nixosTests."garage_${lib.versions.major version}"; 95 96 meta = { 97 description = "S3-compatible object store for small self-hosted geo-distributed deployments"; 98 changelog = "https://git.deuxfleurs.fr/Deuxfleurs/garage/releases/tag/v${version}"; 99 homepage = "https://garagehq.deuxfleurs.fr"; 100 license = lib.licenses.agpl3Only; 101 maintainers = with lib.maintainers; [ 102 adamcstephens 103 nickcao 104 _0x4A6F 105 teutat3s 106 ]; 107 knownVulnerabilities = (lib.optional eol "Garage version ${version} is EOL"); 108 inherit broken; 109 mainProgram = "garage"; 110 }; 111 }; 112in 113rec { 114 garage_0_9_4 = generic { 115 version = "0.9.4"; 116 hash = "sha256-2ZaxenwaVGYYUjUJaGgnGpZNQprQV9+Jns2sXM6cowk="; 117 cargoHash = "sha256-ittesFz1GUGipQecsmMA+GEaVoUY+C9DtEvsO0HFNCc="; 118 cargoPatches = [ ./update-time.patch ]; 119 eol = true; 120 }; 121 122 garage_1_2_0 = generic { 123 version = "1.2.0"; 124 hash = "sha256-JoOwCbChSL7mjegnLHOH2Abfmsnw9BwNsjFj7nqBN6o="; 125 cargoHash = "sha256-vcvD0Fn/etnAuXrM3+rj16cqpEmW2nzRmrjXsftKTFE="; 126 }; 127 128 garage_2_0_0 = generic { 129 version = "2.0.0"; 130 hash = "sha256-dn7FoouF+5qmW6fcC20bKQSc6D2G9yrWdBK3uN3bF58="; 131 cargoHash = "sha256-6VM/EesrUIaQOeDGqzb0kOqMz4hW7zBJUnaRQ9C3cqc="; 132 }; 133 134 garage_0_9 = garage_0_9_4; 135 136 garage_1 = garage_1_2_0; 137 138 garage_2 = garage_2_0_0; 139 140 garage = garage_1; 141}