From 014e1f6ecc23950e35ae4b9097e27286ecacbc10 Mon Sep 17 00:00:00 2001 From: Adam Stephens Date: Wed, 31 Jan 2024 23:07:29 -0500 Subject: incus: move unwrapped to incus dir --- pkgs/by-name/in/incus-unwrapped/package.nix | 107 ---------------------------- pkgs/by-name/in/incus/package.nix | 5 +- pkgs/by-name/in/incus/unwrapped.nix | 107 ++++++++++++++++++++++++++++ 3 files changed, 111 insertions(+), 108 deletions(-) delete mode 100644 pkgs/by-name/in/incus-unwrapped/package.nix create mode 100644 pkgs/by-name/in/incus/unwrapped.nix (limited to 'pkgs/by-name/in') diff --git a/pkgs/by-name/in/incus-unwrapped/package.nix b/pkgs/by-name/in/incus-unwrapped/package.nix deleted file mode 100644 index d415e873f5741..0000000000000 --- a/pkgs/by-name/in/incus-unwrapped/package.nix +++ /dev/null @@ -1,107 +0,0 @@ -{ lib -, buildGoModule -, fetchFromGitHub -, acl -, cowsql -, hwdata -, libcap -, lxc -, pkg-config -, sqlite -, udev -, installShellFiles -, nix-update-script -, nixosTests -}: - -buildGoModule rec { - pname = "incus-unwrapped"; - version = "0.5.1"; - - src = fetchFromGitHub { - owner = "lxc"; - repo = "incus"; - rev = "refs/tags/v${version}"; - hash = "sha256-3eWkQT2P69ZfN62H9B4WLnmlUOGkpzRR0rctgchP+6A="; - }; - - vendorHash = "sha256-2ZJU7WshN4UIbJv55bFeo9qiAQ/wxu182mnz7pE60xA="; - - postPatch = '' - substituteInPlace internal/usbid/load.go \ - --replace "/usr/share/misc/usb.ids" "${hwdata}/share/hwdata/usb.ids" - ''; - - excludedPackages = [ - "cmd/incus-agent" - "cmd/incus-migrate" - "cmd/lxd-to-incus" - "test/mini-oidc" - ]; - - nativeBuildInputs = [ - installShellFiles - pkg-config - ]; - - buildInputs = [ - lxc - acl - libcap - cowsql.dev - sqlite - udev.dev - ]; - - ldflags = [ "-s" "-w" ]; - tags = [ "libsqlite3" ]; - - # required for go-cowsql. - CGO_LDFLAGS_ALLOW = "(-Wl,-wrap,pthread_create)|(-Wl,-z,now)"; - - postBuild = '' - make incus-agent incus-migrate - ''; - - preCheck = - let skippedTests = [ - "TestValidateConfig" - "TestConvertNetworkConfig" - "TestConvertStorageConfig" - "TestSnapshotCommon" - "TestContainerTestSuite" - ]; in - '' - # Disable tests requiring local operations - buildFlagsArray+=("-run" "[^(${builtins.concatStringsSep "|" skippedTests})]") - ''; - - postInstall = '' - # use custom bash completion as it has extra logic for e.g. instance names - installShellCompletion --bash --name incus ./scripts/bash/incus - - installShellCompletion --cmd incus \ - --fish <($out/bin/incus completion fish) \ - --zsh <($out/bin/incus completion zsh) - ''; - - - passthru = { - tests.incus = nixosTests.incus; - - updateScript = nix-update-script { - extraArgs = [ - "-vr" "v\(.*\)" - ]; - }; - }; - - meta = { - description = "Powerful system container and virtual machine manager"; - homepage = "https://linuxcontainers.org/incus"; - changelog = "https://github.com/lxc/incus/releases/tag/v${version}"; - license = lib.licenses.asl20; - maintainers = lib.teams.lxc.members; - platforms = lib.platforms.linux; - }; -} diff --git a/pkgs/by-name/in/incus/package.nix b/pkgs/by-name/in/incus/package.nix index d4a9ef55c611d..4f69ffe8201f5 100644 --- a/pkgs/by-name/in/incus/package.nix +++ b/pkgs/by-name/in/incus/package.nix @@ -1,5 +1,5 @@ { lib -, incus-unwrapped +, callPackage , linkFarm , makeWrapper , stdenv @@ -37,6 +37,8 @@ , xz }: let + incus-unwrapped = callPackage ./unwrapped.nix {}; + binPath = lib.makeBinPath [ acl attr @@ -127,6 +129,7 @@ symlinkJoin { passthru = { inherit (incus-unwrapped) tests; + unwrapped = incus-unwrapped; }; inherit (incus-unwrapped) meta pname version; diff --git a/pkgs/by-name/in/incus/unwrapped.nix b/pkgs/by-name/in/incus/unwrapped.nix new file mode 100644 index 0000000000000..d415e873f5741 --- /dev/null +++ b/pkgs/by-name/in/incus/unwrapped.nix @@ -0,0 +1,107 @@ +{ lib +, buildGoModule +, fetchFromGitHub +, acl +, cowsql +, hwdata +, libcap +, lxc +, pkg-config +, sqlite +, udev +, installShellFiles +, nix-update-script +, nixosTests +}: + +buildGoModule rec { + pname = "incus-unwrapped"; + version = "0.5.1"; + + src = fetchFromGitHub { + owner = "lxc"; + repo = "incus"; + rev = "refs/tags/v${version}"; + hash = "sha256-3eWkQT2P69ZfN62H9B4WLnmlUOGkpzRR0rctgchP+6A="; + }; + + vendorHash = "sha256-2ZJU7WshN4UIbJv55bFeo9qiAQ/wxu182mnz7pE60xA="; + + postPatch = '' + substituteInPlace internal/usbid/load.go \ + --replace "/usr/share/misc/usb.ids" "${hwdata}/share/hwdata/usb.ids" + ''; + + excludedPackages = [ + "cmd/incus-agent" + "cmd/incus-migrate" + "cmd/lxd-to-incus" + "test/mini-oidc" + ]; + + nativeBuildInputs = [ + installShellFiles + pkg-config + ]; + + buildInputs = [ + lxc + acl + libcap + cowsql.dev + sqlite + udev.dev + ]; + + ldflags = [ "-s" "-w" ]; + tags = [ "libsqlite3" ]; + + # required for go-cowsql. + CGO_LDFLAGS_ALLOW = "(-Wl,-wrap,pthread_create)|(-Wl,-z,now)"; + + postBuild = '' + make incus-agent incus-migrate + ''; + + preCheck = + let skippedTests = [ + "TestValidateConfig" + "TestConvertNetworkConfig" + "TestConvertStorageConfig" + "TestSnapshotCommon" + "TestContainerTestSuite" + ]; in + '' + # Disable tests requiring local operations + buildFlagsArray+=("-run" "[^(${builtins.concatStringsSep "|" skippedTests})]") + ''; + + postInstall = '' + # use custom bash completion as it has extra logic for e.g. instance names + installShellCompletion --bash --name incus ./scripts/bash/incus + + installShellCompletion --cmd incus \ + --fish <($out/bin/incus completion fish) \ + --zsh <($out/bin/incus completion zsh) + ''; + + + passthru = { + tests.incus = nixosTests.incus; + + updateScript = nix-update-script { + extraArgs = [ + "-vr" "v\(.*\)" + ]; + }; + }; + + meta = { + description = "Powerful system container and virtual machine manager"; + homepage = "https://linuxcontainers.org/incus"; + changelog = "https://github.com/lxc/incus/releases/tag/v${version}"; + license = lib.licenses.asl20; + maintainers = lib.teams.lxc.members; + platforms = lib.platforms.linux; + }; +} -- cgit 1.4.1 From 42742010df39e2bcfe413f2bd83be5770e41fb62 Mon Sep 17 00:00:00 2001 From: Adam Stephens Date: Wed, 31 Jan 2024 23:09:57 -0500 Subject: incus: reformat with nixfmt-rfc-style --- pkgs/by-name/in/incus/package.nix | 136 ++++++++++++++++++++++-------------- pkgs/by-name/in/incus/unwrapped.nix | 60 +++++++++------- 2 files changed, 117 insertions(+), 79 deletions(-) (limited to 'pkgs/by-name/in') diff --git a/pkgs/by-name/in/incus/package.nix b/pkgs/by-name/in/incus/package.nix index 4f69ffe8201f5..4f1253975efa9 100644 --- a/pkgs/by-name/in/incus/package.nix +++ b/pkgs/by-name/in/incus/package.nix @@ -1,43 +1,44 @@ -{ lib -, callPackage -, linkFarm -, makeWrapper -, stdenv -, symlinkJoin -, writeShellScriptBin -, acl -, apparmor-parser -, apparmor-profiles -, attr -, bash -, btrfs-progs -, cdrkit -, criu -, dnsmasq -, e2fsprogs -, getent -, gnutar -, gptfdisk -, gzip -, iproute2 -, iptables -, kmod -, lvm2 -, minio -, nftables -, OVMF -, qemu_kvm -, qemu-utils -, rsync -, spice-gtk -, squashfsTools -, thin-provisioning-tools -, util-linux -, virtiofsd -, xz +{ + lib, + callPackage, + linkFarm, + makeWrapper, + stdenv, + symlinkJoin, + writeShellScriptBin, + acl, + apparmor-parser, + apparmor-profiles, + attr, + bash, + btrfs-progs, + cdrkit, + criu, + dnsmasq, + e2fsprogs, + getent, + gnutar, + gptfdisk, + gzip, + iproute2, + iptables, + kmod, + lvm2, + minio, + nftables, + OVMF, + qemu_kvm, + qemu-utils, + rsync, + spice-gtk, + squashfsTools, + thin-provisioning-tools, + util-linux, + virtiofsd, + xz, }: let - incus-unwrapped = callPackage ./unwrapped.nix {}; + incus-unwrapped = callPackage ./unwrapped.nix { }; binPath = lib.makeBinPath [ acl @@ -72,9 +73,7 @@ let '') ]; - clientBinPath = [ - spice-gtk - ]; + clientBinPath = [ spice-gtk ]; ovmf-2mb = OVMF.override { secureBoot = true; @@ -100,18 +99,51 @@ let # mimic ovmf from https://github.com/canonical/incus-pkg-snap/blob/3abebe1dfeb20f9b7729556960c7e9fe6ad5e17c/snapcraft.yaml#L378 # also found in /snap/incus/current/share/qemu/ on a snap install ovmf = linkFarm "incus-ovmf" [ - { name = "OVMF_CODE.2MB.fd"; path = "${ovmf-2mb.fd}/FV/${ovmf-prefix}_CODE.fd"; } - { name = "OVMF_CODE.4MB.CSM.fd"; path = "${ovmf-4mb-csm.fd}/FV/${ovmf-prefix}_CODE.fd"; } - { name = "OVMF_CODE.4MB.fd"; path = "${ovmf-4mb.fd}/FV/${ovmf-prefix}_CODE.fd"; } - { name = "OVMF_CODE.fd"; path = "${ovmf-2mb.fd}/FV/${ovmf-prefix}_CODE.fd"; } + { + name = "OVMF_CODE.2MB.fd"; + path = "${ovmf-2mb.fd}/FV/${ovmf-prefix}_CODE.fd"; + } + { + name = "OVMF_CODE.4MB.CSM.fd"; + path = "${ovmf-4mb-csm.fd}/FV/${ovmf-prefix}_CODE.fd"; + } + { + name = "OVMF_CODE.4MB.fd"; + path = "${ovmf-4mb.fd}/FV/${ovmf-prefix}_CODE.fd"; + } + { + name = "OVMF_CODE.fd"; + path = "${ovmf-2mb.fd}/FV/${ovmf-prefix}_CODE.fd"; + } - { name = "OVMF_VARS.2MB.fd"; path = "${ovmf-2mb.fd}/FV/${ovmf-prefix}_VARS.fd"; } - { name = "OVMF_VARS.2MB.ms.fd"; path = "${ovmf-2mb.fd}/FV/${ovmf-prefix}_VARS.fd"; } - { name = "OVMF_VARS.4MB.CSM.fd"; path = "${ovmf-4mb-csm.fd}/FV/${ovmf-prefix}_VARS.fd"; } - { name = "OVMF_VARS.4MB.fd"; path = "${ovmf-4mb.fd}/FV/${ovmf-prefix}_VARS.fd"; } - { name = "OVMF_VARS.4MB.ms.fd"; path = "${ovmf-4mb.fd}/FV/${ovmf-prefix}_VARS.fd"; } - { name = "OVMF_VARS.fd"; path = "${ovmf-2mb.fd}/FV/${ovmf-prefix}_VARS.fd"; } - { name = "OVMF_VARS.ms.fd"; path = "${ovmf-2mb.fd}/FV/${ovmf-prefix}_VARS.fd"; } + { + name = "OVMF_VARS.2MB.fd"; + path = "${ovmf-2mb.fd}/FV/${ovmf-prefix}_VARS.fd"; + } + { + name = "OVMF_VARS.2MB.ms.fd"; + path = "${ovmf-2mb.fd}/FV/${ovmf-prefix}_VARS.fd"; + } + { + name = "OVMF_VARS.4MB.CSM.fd"; + path = "${ovmf-4mb-csm.fd}/FV/${ovmf-prefix}_VARS.fd"; + } + { + name = "OVMF_VARS.4MB.fd"; + path = "${ovmf-4mb.fd}/FV/${ovmf-prefix}_VARS.fd"; + } + { + name = "OVMF_VARS.4MB.ms.fd"; + path = "${ovmf-4mb.fd}/FV/${ovmf-prefix}_VARS.fd"; + } + { + name = "OVMF_VARS.fd"; + path = "${ovmf-2mb.fd}/FV/${ovmf-prefix}_VARS.fd"; + } + { + name = "OVMF_VARS.ms.fd"; + path = "${ovmf-2mb.fd}/FV/${ovmf-prefix}_VARS.fd"; + } ]; in symlinkJoin { diff --git a/pkgs/by-name/in/incus/unwrapped.nix b/pkgs/by-name/in/incus/unwrapped.nix index d415e873f5741..a8e67fb872b3e 100644 --- a/pkgs/by-name/in/incus/unwrapped.nix +++ b/pkgs/by-name/in/incus/unwrapped.nix @@ -1,17 +1,18 @@ -{ lib -, buildGoModule -, fetchFromGitHub -, acl -, cowsql -, hwdata -, libcap -, lxc -, pkg-config -, sqlite -, udev -, installShellFiles -, nix-update-script -, nixosTests +{ + lib, + buildGoModule, + fetchFromGitHub, + acl, + cowsql, + hwdata, + libcap, + lxc, + pkg-config, + sqlite, + udev, + installShellFiles, + nix-update-script, + nixosTests, }: buildGoModule rec { @@ -53,7 +54,10 @@ buildGoModule rec { udev.dev ]; - ldflags = [ "-s" "-w" ]; + ldflags = [ + "-s" + "-w" + ]; tags = [ "libsqlite3" ]; # required for go-cowsql. @@ -64,13 +68,15 @@ buildGoModule rec { ''; preCheck = - let skippedTests = [ - "TestValidateConfig" - "TestConvertNetworkConfig" - "TestConvertStorageConfig" - "TestSnapshotCommon" - "TestContainerTestSuite" - ]; in + let + skippedTests = [ + "TestValidateConfig" + "TestConvertNetworkConfig" + "TestConvertStorageConfig" + "TestSnapshotCommon" + "TestContainerTestSuite" + ]; + in '' # Disable tests requiring local operations buildFlagsArray+=("-run" "[^(${builtins.concatStringsSep "|" skippedTests})]") @@ -85,15 +91,15 @@ buildGoModule rec { --zsh <($out/bin/incus completion zsh) ''; - passthru = { tests.incus = nixosTests.incus; updateScript = nix-update-script { - extraArgs = [ - "-vr" "v\(.*\)" - ]; - }; + extraArgs = [ + "-vr" + "v(.*)" + ]; + }; }; meta = { -- cgit 1.4.1 From cf372500be7a9068c431b7f68da2c31a6c3f60ea Mon Sep 17 00:00:00 2001 From: Adam Stephens Date: Thu, 1 Feb 2024 08:18:24 -0500 Subject: incus: add support for multiple releases Incus LTS will be added in a few months, and this prepares for maintaining two releases --- pkgs/by-name/in/incus/latest.nix | 5 +++++ pkgs/by-name/in/incus/package.nix | 15 +++++++++------ pkgs/by-name/in/incus/unwrapped.nix | 18 +++++++++++++----- 3 files changed, 27 insertions(+), 11 deletions(-) create mode 100644 pkgs/by-name/in/incus/latest.nix (limited to 'pkgs/by-name/in') 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" ]; -- cgit 1.4.1 From a55e16ad8d215cf96b5415bccd418b61b99936ab Mon Sep 17 00:00:00 2001 From: Adam Stephens Date: Thu, 1 Feb 2024 08:20:29 -0500 Subject: incus: add statically compiled client The incus client can be used from non-Linux systems, and as a standalone binary. Therefore, compile the client separately, and give it a separate passthru so users can install `incus.client`. --- pkgs/by-name/in/incus/client.nix | 53 +++++++++++++++++++++++++++++++++++++++ pkgs/by-name/in/incus/package.nix | 3 +++ 2 files changed, 56 insertions(+) create mode 100644 pkgs/by-name/in/incus/client.nix (limited to 'pkgs/by-name/in') diff --git a/pkgs/by-name/in/incus/client.nix b/pkgs/by-name/in/incus/client.nix new file mode 100644 index 0000000000000..46bf691c6951b --- /dev/null +++ b/pkgs/by-name/in/incus/client.nix @@ -0,0 +1,53 @@ +{ + lts ? false, + + lib, + buildGoModule, + fetchFromGitHub, + installShellFiles, +}: +let + releaseFile = if lts then ./lts.nix else ./latest.nix; + inherit (import releaseFile) version hash vendorHash; +in + +buildGoModule rec { + pname = "incus-client"; + + inherit vendorHash version; + + src = fetchFromGitHub { + owner = "lxc"; + repo = "incus"; + rev = "refs/tags/v${version}"; + inherit hash; + }; + + CGO_ENABLED = 0; + + nativeBuildInputs = [ installShellFiles ]; + + subPackages = [ "cmd/incus" ]; + + postInstall = '' + # use custom bash completion as it has extra logic for e.g. instance names + installShellCompletion --bash --name incus ./scripts/bash/incus + + installShellCompletion --cmd incus \ + --fish <($out/bin/incus completion fish) \ + --zsh <($out/bin/incus completion zsh) + ''; + + # don't run the full incus test suite + doCheck = false; + + meta = { + description = "Powerful system container and virtual machine manager"; + homepage = "https://linuxcontainers.org/incus"; + changelog = "https://github.com/lxc/incus/releases/tag/v${version}"; + license = lib.licenses.asl20; + maintainers = lib.teams.lxc.members; + platforms = lib.platforms.unix; + mainProgram = "incus"; + }; +} diff --git a/pkgs/by-name/in/incus/package.nix b/pkgs/by-name/in/incus/package.nix index a9ada155b74b4..c91d08c2f5a5c 100644 --- a/pkgs/by-name/in/incus/package.nix +++ b/pkgs/by-name/in/incus/package.nix @@ -41,6 +41,7 @@ }: let unwrapped = callPackage ./unwrapped.nix { inherit lts; }; + client = callPackage ./client.nix { inherit lts; }; binPath = lib.makeBinPath [ acl @@ -164,6 +165,8 @@ symlinkJoin { passthru = { inherit (unwrapped) tests; + client = client; + unwrapped = unwrapped; }; -- cgit 1.4.1 From 5f087b3221142436513d2941392d09d5e8a922c5 Mon Sep 17 00:00:00 2001 From: Adam Stephens Date: Thu, 1 Feb 2024 08:22:55 -0500 Subject: incus: lxd-to-incus is now part of main package Previously upstream was packaging this separately due to the inclusion of lxd in the go dependencies. This has been dropped and the package has been merged into the main go.mod file. --- nixos/tests/incus/lxd-to-incus.nix | 2 -- pkgs/by-name/in/incus/lts.nix | 3 ++ pkgs/by-name/lx/lxd-to-incus/package.nix | 48 -------------------------------- 3 files changed, 3 insertions(+), 50 deletions(-) create mode 100644 pkgs/by-name/in/incus/lts.nix delete mode 100644 pkgs/by-name/lx/lxd-to-incus/package.nix (limited to 'pkgs/by-name/in') diff --git a/nixos/tests/incus/lxd-to-incus.nix b/nixos/tests/incus/lxd-to-incus.nix index 42a47a6a07af5..c0fc98c224df1 100644 --- a/nixos/tests/incus/lxd-to-incus.nix +++ b/nixos/tests/incus/lxd-to-incus.nix @@ -18,8 +18,6 @@ import ../make-test-python.nix ( nodes.machine = { lib, ... }: { - environment.systemPackages = [ pkgs.lxd-to-incus ]; - virtualisation = { diskSize = 6144; cores = 2; diff --git a/pkgs/by-name/in/incus/lts.nix b/pkgs/by-name/in/incus/lts.nix new file mode 100644 index 0000000000000..d70793f94dfa1 --- /dev/null +++ b/pkgs/by-name/in/incus/lts.nix @@ -0,0 +1,3 @@ +# this release doesn't exist yet, but satisfay the by-name checks +# will be added as incus-lts in all-packages.nix once ready +{ } diff --git a/pkgs/by-name/lx/lxd-to-incus/package.nix b/pkgs/by-name/lx/lxd-to-incus/package.nix deleted file mode 100644 index eb63c986b8144..0000000000000 --- a/pkgs/by-name/lx/lxd-to-incus/package.nix +++ /dev/null @@ -1,48 +0,0 @@ -{ lib -, buildGoModule -, fetchFromGitHub -, fetchpatch -, nix-update-script -}: - -buildGoModule rec { - pname = "lxd-to-incus"; - version = "0.4.0"; - - src = fetchFromGitHub { - owner = "lxc"; - repo = "incus"; - rev = "refs/tags/v${version}"; - hash = "sha256-crWepf5j3Gd1lhya2DGIh/to7l+AnjKJPR+qUd9WOzw="; - }; - - patches = [ - # create migration touch file, remove > 0.4.0 - (fetchpatch { - url = "https://github.com/lxc/incus/commit/edc5fd2a9baccfb7b6814a440e2947cbb580afcf.diff"; - hash = "sha256-ffQfMFrKDPuLU4jVbG/VGHSO3DmeHw30ATJ8yxJAoHQ="; - }) - ]; - - modRoot = "cmd/lxd-to-incus"; - - vendorHash = "sha256-cBAqJz3Y4CqyxTt7u/4mXoQPKmKgQ3gYJV1NiC/H+TA="; - - CGO_ENABLED = 0; - - passthru = { - updateScript = nix-update-script { - extraArgs = [ - "-vr" "v\(.*\)" - ]; - }; - }; - - meta = { - description = "LXD to Incus migration tool"; - homepage = "https://linuxcontainers.org/incus"; - license = lib.licenses.asl20; - maintainers = lib.teams.lxc.members; - platforms = lib.platforms.linux; - }; -} -- cgit 1.4.1 From 273b448b6a3fe0961b939bea8f2c4e202e489448 Mon Sep 17 00:00:00 2001 From: Adam Stephens Date: Fri, 2 Feb 2024 22:12:15 -0500 Subject: incus: fix update script Working with the wrapper causes pain, so to update target incus.unwrapped, or in the future incus-lts.unwrapped --- pkgs/by-name/in/incus/latest.nix | 2 +- pkgs/by-name/in/incus/package.nix | 9 ++++----- pkgs/by-name/in/incus/unwrapped.nix | 18 +++++++++--------- 3 files changed, 14 insertions(+), 15 deletions(-) (limited to 'pkgs/by-name/in') diff --git a/pkgs/by-name/in/incus/latest.nix b/pkgs/by-name/in/incus/latest.nix index bc4ae13403bef..0c0c32ba9af37 100644 --- a/pkgs/by-name/in/incus/latest.nix +++ b/pkgs/by-name/in/incus/latest.nix @@ -1,5 +1,5 @@ { - version = "0.5.1"; hash = "sha256-3eWkQT2P69ZfN62H9B4WLnmlUOGkpzRR0rctgchP+6A="; + version = "0.5.1"; vendorHash = "sha256-2ZJU7WshN4UIbJv55bFeo9qiAQ/wxu182mnz7pE60xA="; } diff --git a/pkgs/by-name/in/incus/package.nix b/pkgs/by-name/in/incus/package.nix index c91d08c2f5a5c..8a10f6eef7fd6 100644 --- a/pkgs/by-name/in/incus/package.nix +++ b/pkgs/by-name/in/incus/package.nix @@ -42,6 +42,7 @@ let unwrapped = callPackage ./unwrapped.nix { inherit lts; }; client = callPackage ./client.nix { inherit lts; }; + name = "incus${lib.optionalString lts "-lts"}"; binPath = lib.makeBinPath [ acl @@ -150,7 +151,7 @@ let ]; in symlinkJoin { - name = "incus-${unwrapped.version}"; + name = "${name}-${unwrapped.version}"; paths = [ unwrapped ]; @@ -163,11 +164,9 @@ symlinkJoin { ''; passthru = { - inherit (unwrapped) tests; - - client = client; + inherit client unwrapped; - unwrapped = unwrapped; + inherit (unwrapped) tests; }; inherit (unwrapped) meta pname version; diff --git a/pkgs/by-name/in/incus/unwrapped.nix b/pkgs/by-name/in/incus/unwrapped.nix index 96bf1a6f6525c..73257c5839406 100644 --- a/pkgs/by-name/in/incus/unwrapped.nix +++ b/pkgs/by-name/in/incus/unwrapped.nix @@ -4,6 +4,7 @@ lib, buildGoModule, fetchFromGitHub, + writeShellScript, acl, cowsql, hwdata, @@ -13,24 +14,24 @@ sqlite, udev, installShellFiles, - nix-update-script, nixosTests, }: let releaseFile = if lts then ./lts.nix else ./latest.nix; inherit (import releaseFile) version hash vendorHash; + name = "incus${lib.optionalString lts "-lts"}"; in buildGoModule rec { - pname = "incus-unwrapped"; + pname = "${name}-unwrapped"; inherit vendorHash version; src = fetchFromGitHub { owner = "lxc"; repo = "incus"; - rev = "refs/tags/v${version}"; + rev = "v${version}"; inherit hash; }; @@ -102,12 +103,11 @@ buildGoModule rec { passthru = { tests.incus = nixosTests.incus; - updateScript = nix-update-script { - extraArgs = [ - "-vr" - "v(.*)" - ]; - }; + updateScript = writeShellScript "update-incus" '' + nix-update ${name}.unwrapped -vr 'v(.*)' --override-filename pkgs/by-name/in/incus/${ + if lts then "lts" else "latest" + }.nix + ''; }; meta = { -- cgit 1.4.1