about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAdam Stephens <adam@valkor.net>2024-02-01 08:18:24 -0500
committerAdam Stephens <adam@valkor.net>2024-02-02 12:58:39 -0500
commitcf372500be7a9068c431b7f68da2c31a6c3f60ea (patch)
tree6a601bc37cc539787b67f90cb446dec1f12f89d5
parent42742010df39e2bcfe413f2bd83be5770e41fb62 (diff)
incus: add support for multiple releases
Incus LTS will be added in a few months, and this prepares for
maintaining two releases
-rw-r--r--pkgs/by-name/in/incus/latest.nix5
-rw-r--r--pkgs/by-name/in/incus/package.nix15
-rw-r--r--pkgs/by-name/in/incus/unwrapped.nix18
3 files changed, 27 insertions, 11 deletions
diff --git a/pkgs/by-name/in/incus/latest.nix b/pkgs/by-name/in/incus/latest.nix
new file mode 100644
index 0000000000000..bc4ae13403bef
--- /dev/null
+++ b/pkgs/by-name/in/incus/latest.nix
@@ -0,0 +1,5 @@
+{
+  version = "0.5.1";
+  hash = "sha256-3eWkQT2P69ZfN62H9B4WLnmlUOGkpzRR0rctgchP+6A=";
+  vendorHash = "sha256-2ZJU7WshN4UIbJv55bFeo9qiAQ/wxu182mnz7pE60xA=";
+}
diff --git a/pkgs/by-name/in/incus/package.nix b/pkgs/by-name/in/incus/package.nix
index 4f1253975efa9..a9ada155b74b4 100644
--- a/pkgs/by-name/in/incus/package.nix
+++ b/pkgs/by-name/in/incus/package.nix
@@ -1,4 +1,6 @@
 {
+  lts ? false,
+
   lib,
   callPackage,
   linkFarm,
@@ -38,7 +40,7 @@
   xz,
 }:
 let
-  incus-unwrapped = callPackage ./unwrapped.nix { };
+  unwrapped = callPackage ./unwrapped.nix { inherit lts; };
 
   binPath = lib.makeBinPath [
     acl
@@ -147,9 +149,9 @@ let
   ];
 in
 symlinkJoin {
-  name = "incus-${incus-unwrapped.version}";
+  name = "incus-${unwrapped.version}";
 
-  paths = [ incus-unwrapped ];
+  paths = [ unwrapped ];
 
   nativeBuildInputs = [ makeWrapper ];
 
@@ -160,9 +162,10 @@ symlinkJoin {
   '';
 
   passthru = {
-    inherit (incus-unwrapped) tests;
-    unwrapped = incus-unwrapped;
+    inherit (unwrapped) tests;
+
+    unwrapped = unwrapped;
   };
 
-  inherit (incus-unwrapped) meta pname version;
+  inherit (unwrapped) meta pname version;
 }
diff --git a/pkgs/by-name/in/incus/unwrapped.nix b/pkgs/by-name/in/incus/unwrapped.nix
index a8e67fb872b3e..96bf1a6f6525c 100644
--- a/pkgs/by-name/in/incus/unwrapped.nix
+++ b/pkgs/by-name/in/incus/unwrapped.nix
@@ -1,4 +1,6 @@
 {
+  lts ? false,
+
   lib,
   buildGoModule,
   fetchFromGitHub,
@@ -15,28 +17,34 @@
   nixosTests,
 }:
 
+let
+  releaseFile = if lts then ./lts.nix else ./latest.nix;
+  inherit (import releaseFile) version hash vendorHash;
+in
+
 buildGoModule rec {
   pname = "incus-unwrapped";
-  version = "0.5.1";
+
+  inherit vendorHash version;
 
   src = fetchFromGitHub {
     owner = "lxc";
     repo = "incus";
     rev = "refs/tags/v${version}";
-    hash = "sha256-3eWkQT2P69ZfN62H9B4WLnmlUOGkpzRR0rctgchP+6A=";
+    inherit hash;
   };
 
-  vendorHash = "sha256-2ZJU7WshN4UIbJv55bFeo9qiAQ/wxu182mnz7pE60xA=";
-
   postPatch = ''
     substituteInPlace internal/usbid/load.go \
       --replace "/usr/share/misc/usb.ids" "${hwdata}/share/hwdata/usb.ids"
   '';
 
   excludedPackages = [
+    # statically compile these
     "cmd/incus-agent"
     "cmd/incus-migrate"
-    "cmd/lxd-to-incus"
+
+    # oidc test requires network
     "test/mini-oidc"
   ];