about summary refs log tree commit diff
path: root/pkgs/tools/filesystems/garage
diff options
context:
space:
mode:
authorRaito Bezarius <masterancpp@gmail.com>2022-10-15 22:40:34 +0200
committerRaito Bezarius <masterancpp@gmail.com>2022-12-30 15:12:44 +0100
commit1db2175e7ab291b64590076dcad16354bdf6a6e3 (patch)
tree99629a126cb3e3580caf5744334f9707393ea527 /pkgs/tools/filesystems/garage
parent04f4be9a29f41ad2b0907942a1820da2ada1431e (diff)
downloadnixlib-1db2175e7ab291b64590076dcad16354bdf6a6e3.tar
nixlib-1db2175e7ab291b64590076dcad16354bdf6a6e3.tar.gz
nixlib-1db2175e7ab291b64590076dcad16354bdf6a6e3.tar.bz2
nixlib-1db2175e7ab291b64590076dcad16354bdf6a6e3.tar.lz
nixlib-1db2175e7ab291b64590076dcad16354bdf6a6e3.tar.xz
nixlib-1db2175e7ab291b64590076dcad16354bdf6a6e3.tar.zst
nixlib-1db2175e7ab291b64590076dcad16354bdf6a6e3.zip
nixos/garage: provide multiple versions to provide an upgrade path when using NixOS service
- Add mention to release notes 23.05
- Introduce Garage v0.8
- Protect against unexpected upgrade with stateVersion
- Test matrix over 0.7 × 0.8
Diffstat (limited to 'pkgs/tools/filesystems/garage')
-rw-r--r--pkgs/tools/filesystems/garage/default.nix120
1 files changed, 80 insertions, 40 deletions
diff --git a/pkgs/tools/filesystems/garage/default.nix b/pkgs/tools/filesystems/garage/default.nix
index bdb04e36a633..63ac77057d4a 100644
--- a/pkgs/tools/filesystems/garage/default.nix
+++ b/pkgs/tools/filesystems/garage/default.nix
@@ -1,50 +1,90 @@
 { lib, stdenv, rustPlatform, fetchFromGitea, openssl, pkg-config, protobuf
-, testers, Security, garage }:
-
-rustPlatform.buildRustPackage rec {
-  pname = "garage";
-  version = "0.7.3";
-
-  src = fetchFromGitea {
-    domain = "git.deuxfleurs.fr";
-    owner = "Deuxfleurs";
-    repo = "garage";
-    rev = "v${version}";
-    sha256 = "sha256-WDhe2L+NalMoIy2rhfmv8KCNDMkcqBC9ezEKKocihJg=";
-  };
+, testers, Security, garage, nixosTests }:
+let
+  generic = { version, sha256, cargoSha256, eol ? false }: rustPlatform.buildRustPackage {
+    pname = "garage";
+    inherit version;
 
-  cargoSha256 = "sha256-5m4c8/upBYN8nuysDhGKEnNVJjEGC+yLrraicrAQOfI=";
+    src = fetchFromGitea {
+      domain = "git.deuxfleurs.fr";
+      owner = "Deuxfleurs";
+      repo = "garage";
+      rev = "v${version}";
+      inherit sha256;
+    };
 
-  nativeBuildInputs = [ protobuf pkg-config ];
+    inherit cargoSha256;
 
-  buildInputs = [
-    openssl
-  ] ++ lib.optional stdenv.isDarwin Security;
+    nativeBuildInputs = [ protobuf pkg-config ];
 
-  OPENSSL_NO_VENDOR = true;
+    buildInputs = [
+      openssl
+    ] ++ lib.optional stdenv.isDarwin Security;
 
-  # See https://git.deuxfleurs.fr/Deuxfleurs/garage/src/tag/v0.7.2/default.nix#L84-L98
-  # on version changes for checking if changes are required here
-  buildFeatures = [
-    "kubernetes-discovery"
-  ];
+    OPENSSL_NO_VENDOR = true;
 
-  # To make integration tests pass, we include the optional k2v feature here,
-  # but not in buildFeatures. See:
-  # https://garagehq.deuxfleurs.fr/documentation/reference-manual/k2v/
-  checkFeatures = [
-    "k2v"
-    "kubernetes-discovery"
-  ];
+    # See https://git.deuxfleurs.fr/Deuxfleurs/garage/src/tag/v0.7.2/default.nix#L84-L98
+    # on version changes for checking if changes are required here
+    buildFeatures = [
+      "kubernetes-discovery"
+    ] ++
+    (lib.optional (lib.versionAtLeast version "0.8") [
+      "bundled-libs"
+      "sled"
+      "metrics"
+      "k2v"
+      "telemetry-otlp"
+      "lmdb"
+      "sqlite"
+    ]);
 
-  passthru = {
-    tests.version = testers.testVersion { package = garage; };
-  };
+    # To make integration tests pass, we include the optional k2v feature here,
+    # but not in buildFeatures. See:
+    # https://garagehq.deuxfleurs.fr/documentation/reference-manual/k2v/
+    checkFeatures = [
+      "k2v"
+      "kubernetes-discovery"
+    ] ++
+    (lib.optional (lib.versionAtLeast version "0.8") [
+      "bundled-libs"
+      "sled"
+      "metrics"
+      "telemetry-otlp"
+      "lmdb"
+      "sqlite"
+    ]);
 
-  meta = {
-    description = "S3-compatible object store for small self-hosted geo-distributed deployments";
-    homepage = "https://garagehq.deuxfleurs.fr";
-    license = lib.licenses.agpl3Only;
-    maintainers = with lib.maintainers; [ nickcao _0x4A6F teutat3s ];
+    passthru = nixosTests.garage;
+
+    meta = {
+      description = "S3-compatible object store for small self-hosted geo-distributed deployments";
+      homepage = "https://garagehq.deuxfleurs.fr";
+      license = lib.licenses.agpl3Only;
+      maintainers = with lib.maintainers; [ nickcao _0x4A6F teutat3s raitobezarius ];
+      knownVulnerabilities = (lib.optional eol "Garage version ${version} is EOL");
+    };
   };
-}
+in
+  rec {
+    # Until Garage hits 1.0, 0.7.3 is equivalent to 7.3.0 for now, therefore
+    # we have to keep all the numbers in the version to handle major/minor/patch level.
+    # for <1.0.
+
+    garage_0_7_3 = generic {
+      version = "0.7.3";
+      sha256 = "sha256-WDhe2L+NalMoIy2rhfmv8KCNDMkcqBC9ezEKKocihJg=";
+      cargoSha256 = "sha256-5m4c8/upBYN8nuysDhGKEnNVJjEGC+yLrraicrAQOfI=";
+    };
+
+    garage_0_7 = garage_0_7_3;
+
+    garage_0_8_0 = generic {
+      version = "0.8.0";
+      sha256 = "sha256-c2RhHfg0+YV2E9Ckl1YSc+0nfzbHPIt0JgtT0DND9lA=";
+      cargoSha256 = "sha256-vITXckNOiJbMuQW6/8p7dsZThkjxg/zUy3AZBbn33no=";
+    };
+
+    garage_0_8 = garage_0_8_0;
+
+    garage = garage_0_8;
+  }