mirror of
https://github.com/SebastianWendel/nixpkgs.git
synced 2024-09-20 04:19:00 +02:00
Merge pull request #256500 from adamcstephens/incus/init
incus: init at 0.1
This commit is contained in:
commit
f6caf65a4a
56
pkgs/by-name/co/cowsql/package.nix
Normal file
56
pkgs/by-name/co/cowsql/package.nix
Normal file
|
@ -0,0 +1,56 @@
|
|||
{ lib
|
||||
, stdenv
|
||||
, fetchFromGitHub
|
||||
, autoreconfHook
|
||||
, pkg-config
|
||||
, libuv
|
||||
, raft-cowsql
|
||||
, sqlite
|
||||
, incus
|
||||
, unstableGitUpdater
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "cowsql";
|
||||
version = "unstable-2023-09-21";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "cowsql";
|
||||
repo = "cowsql";
|
||||
rev = "b728f0a43b9ad416f9c5fa1fda8b205c7a469d80";
|
||||
hash = "sha256-B4ORrsUTfk/7glSpDndw1fCfFmd72iFr+2Xm5CryeZQ=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [
|
||||
autoreconfHook
|
||||
pkg-config
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
libuv
|
||||
raft-cowsql.dev
|
||||
sqlite
|
||||
];
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
doCheck = true;
|
||||
|
||||
outputs = [ "dev" "out" ];
|
||||
|
||||
passthru = {
|
||||
tests = {
|
||||
inherit incus;
|
||||
};
|
||||
|
||||
updateScript = unstableGitUpdater { };
|
||||
};
|
||||
|
||||
meta = with lib; {
|
||||
description = "Embeddable, replicated and fault tolerant SQL engine";
|
||||
homepage = "https://github.com/cowsql/cowsql";
|
||||
license = licenses.lgpl3Only;
|
||||
maintainers = with maintainers; [ adamcstephens ];
|
||||
platforms = platforms.unix;
|
||||
};
|
||||
}
|
97
pkgs/by-name/in/incus-unwrapped/package.nix
Normal file
97
pkgs/by-name/in/incus-unwrapped/package.nix
Normal file
|
@ -0,0 +1,97 @@
|
|||
{ lib
|
||||
, buildGoModule
|
||||
, fetchFromGitHub
|
||||
, acl
|
||||
, cowsql
|
||||
, hwdata
|
||||
, libcap
|
||||
, lxc
|
||||
, pkg-config
|
||||
, sqlite
|
||||
, udev
|
||||
, installShellFiles
|
||||
, gitUpdater
|
||||
}:
|
||||
|
||||
buildGoModule rec {
|
||||
pname = "incus-unwrapped";
|
||||
version = "0.1";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "lxc";
|
||||
repo = "incus";
|
||||
rev = "refs/tags/incus-${version}";
|
||||
hash = "sha256-DCNMhfSzIpu5Pdg2TiFQ7GgLEScqt/Xqm2X+VSdeaME=";
|
||||
};
|
||||
|
||||
vendorHash = "sha256-Pk0/SfGCqXdXvNHbokSV8ajFHeOv0+Et0JytRCoBLU4=";
|
||||
|
||||
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"
|
||||
];
|
||||
|
||||
nativeBuildInputs = [
|
||||
installShellFiles
|
||||
pkg-config
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
lxc
|
||||
acl
|
||||
libcap
|
||||
cowsql.dev
|
||||
sqlite
|
||||
udev.dev
|
||||
];
|
||||
|
||||
ldflags = [ "-s" "-w" ];
|
||||
tags = [ "libsqlite3" ];
|
||||
|
||||
preBuild = ''
|
||||
# required for go-cowsql.
|
||||
export 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 = ''
|
||||
installShellCompletion --bash --name incus ./scripts/bash/incus
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
updateScript = gitUpdater {
|
||||
rev-prefix = "incus-";
|
||||
};
|
||||
};
|
||||
|
||||
meta = {
|
||||
description = "Powerful system container and virtual machine manager";
|
||||
homepage = "https://linuxcontainers.org/incus";
|
||||
changelog = "https://github.com/lxc/incus/releases/tag/incus-${version}";
|
||||
license = lib.licenses.asl20;
|
||||
maintainers = with lib.maintainers; [ adamcstephens ];
|
||||
platforms = lib.platforms.linux;
|
||||
};
|
||||
}
|
115
pkgs/by-name/in/incus/package.nix
Normal file
115
pkgs/by-name/in/incus/package.nix
Normal file
|
@ -0,0 +1,115 @@
|
|||
{ lib
|
||||
, incus-unwrapped
|
||||
, linkFarm
|
||||
, makeWrapper
|
||||
, stdenv
|
||||
, symlinkJoin
|
||||
, writeShellScriptBin
|
||||
, acl
|
||||
, apparmor-parser
|
||||
, apparmor-profiles
|
||||
, attr
|
||||
, bash
|
||||
, btrfs-progs
|
||||
, criu
|
||||
, dnsmasq
|
||||
, gnutar
|
||||
, gptfdisk
|
||||
, gzip
|
||||
, iproute2
|
||||
, iptables
|
||||
, OVMF
|
||||
, qemu_kvm
|
||||
, qemu-utils
|
||||
, rsync
|
||||
, spice-gtk
|
||||
, squashfsTools
|
||||
, virtiofsd
|
||||
, xz
|
||||
}:
|
||||
let
|
||||
binPath = lib.makeBinPath [
|
||||
acl
|
||||
attr
|
||||
bash
|
||||
btrfs-progs
|
||||
criu
|
||||
dnsmasq
|
||||
gnutar
|
||||
gptfdisk
|
||||
gzip
|
||||
iproute2
|
||||
iptables
|
||||
qemu_kvm
|
||||
qemu-utils
|
||||
rsync
|
||||
squashfsTools
|
||||
virtiofsd
|
||||
xz
|
||||
|
||||
(writeShellScriptBin "apparmor_parser" ''
|
||||
exec '${apparmor-parser}/bin/apparmor_parser' -I '${apparmor-profiles}/etc/apparmor.d' "$@"
|
||||
'')
|
||||
];
|
||||
|
||||
clientBinPath = [
|
||||
spice-gtk
|
||||
];
|
||||
|
||||
ovmf-2mb = OVMF.override {
|
||||
secureBoot = true;
|
||||
csmSupport = false;
|
||||
fdSize2MB = true;
|
||||
};
|
||||
|
||||
ovmf-4mb = OVMF.override {
|
||||
secureBoot = true;
|
||||
csmSupport = false;
|
||||
fdSize4MB = true;
|
||||
};
|
||||
|
||||
ovmf-4mb-csm = OVMF.override {
|
||||
secureBoot = true;
|
||||
csmSupport = false;
|
||||
fdSize2MB = false;
|
||||
fdSize4MB = true;
|
||||
};
|
||||
|
||||
ovmf-prefix = if stdenv.hostPlatform.isAarch64 then "AAVMF" else "OVMF";
|
||||
|
||||
# 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_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 {
|
||||
name = "incus-${incus-unwrapped.version}";
|
||||
|
||||
paths = [ incus-unwrapped ];
|
||||
|
||||
nativeBuildInputs = [ makeWrapper ];
|
||||
|
||||
postBuild = ''
|
||||
wrapProgram $out/bin/incusd --prefix PATH : ${lib.escapeShellArg binPath}:${qemu_kvm}/libexec:$out/bin --set INCUS_OVMF_PATH ${ovmf}
|
||||
|
||||
wrapProgram $out/bin/incus --prefix PATH : ${lib.makeBinPath clientBinPath}
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
inherit (incus-unwrapped) tests;
|
||||
};
|
||||
|
||||
inherit (incus-unwrapped) meta pname version;
|
||||
}
|
39
pkgs/by-name/lx/lxd-to-incus/package.nix
Normal file
39
pkgs/by-name/lx/lxd-to-incus/package.nix
Normal file
|
@ -0,0 +1,39 @@
|
|||
{ lib
|
||||
, buildGoModule
|
||||
, fetchFromGitHub
|
||||
, gitUpdater
|
||||
}:
|
||||
|
||||
buildGoModule rec {
|
||||
pname = "lxd-to-incus";
|
||||
version = "0.1";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "lxc";
|
||||
repo = "incus";
|
||||
# use commit which fixes 0.1 versioning, use tags for > 0.1
|
||||
rev = "253a06bd8506bf42628d32ccbca6409d051465ec";
|
||||
hash = "sha256-LXCTrZEDnFTJpqVH+gnG9HaV1wcvTFsVv2tAWabWYmg=";
|
||||
};
|
||||
|
||||
modRoot = "cmd/lxd-to-incus";
|
||||
|
||||
vendorHash = "sha256-Kk5sx8UYuip/qik5ez/pxi+DmzjkPIHNYUHVvBm9f9g=";
|
||||
|
||||
# required for go-cowsql.
|
||||
CGO_LDFLAGS_ALLOW="(-Wl,-wrap,pthread_create)|(-Wl,-z,now)";
|
||||
|
||||
passthru = {
|
||||
updateScript = gitUpdater {
|
||||
rev-prefix = "incus-";
|
||||
};
|
||||
};
|
||||
|
||||
meta = {
|
||||
description = "LXD to Incus migration tool";
|
||||
homepage = "https://linuxcontainers.org/incus";
|
||||
license = lib.licenses.asl20;
|
||||
maintainers = with lib.maintainers; [ adamcstephens ];
|
||||
platforms = lib.platforms.linux;
|
||||
};
|
||||
}
|
23
pkgs/by-name/ra/raft-cowsql/disable-missing-dir-test.patch
Normal file
23
pkgs/by-name/ra/raft-cowsql/disable-missing-dir-test.patch
Normal file
|
@ -0,0 +1,23 @@
|
|||
diff --git a/test/unit/test_uv_fs.c b/test/unit/test_uv_fs.c
|
||||
index 638c39c..c8758d2 100644
|
||||
--- a/test/unit/test_uv_fs.c
|
||||
+++ b/test/unit/test_uv_fs.c
|
||||
@@ -40,18 +40,6 @@ TEST(UvFsCheckDir, exists, DirSetUp, DirTearDown, 0, NULL)
|
||||
return MUNIT_OK;
|
||||
}
|
||||
|
||||
-/* If the directory doesn't exist, it an error is returned. */
|
||||
-TEST(UvFsCheckDir, doesNotExist, DirSetUp, DirTearDown, 0, NULL)
|
||||
-{
|
||||
- const char *parent = data;
|
||||
- char errmsg[RAFT_ERRMSG_BUF_SIZE];
|
||||
- char dir[128];
|
||||
- sprintf(errmsg, "%s/sub", parent);
|
||||
- sprintf(errmsg, "directory '%s' does not exist", dir);
|
||||
- CHECK_DIR_ERROR(dir, RAFT_NOTFOUND, errmsg);
|
||||
- return MUNIT_OK;
|
||||
-}
|
||||
-
|
||||
/* If the process can't access the directory, an error is returned. */
|
||||
TEST(UvFsCheckDir, permissionDenied, NULL, NULL, 0, NULL)
|
||||
{
|
16
pkgs/by-name/ra/raft-cowsql/disable-net-tests.patch
Normal file
16
pkgs/by-name/ra/raft-cowsql/disable-net-tests.patch
Normal file
|
@ -0,0 +1,16 @@
|
|||
diff --git a/Makefile.am b/Makefile.am
|
||||
index 2137932..93abdb6 100644
|
||||
--- a/Makefile.am
|
||||
+++ b/Makefile.am
|
||||
@@ -198,11 +198,7 @@ test_integration_uv_SOURCES = \
|
||||
test/integration/test_uv_bootstrap.c \
|
||||
test/integration/test_uv_load.c \
|
||||
test/integration/test_uv_recover.c \
|
||||
- test/integration/test_uv_recv.c \
|
||||
- test/integration/test_uv_send.c \
|
||||
test/integration/test_uv_set_term.c \
|
||||
- test/integration/test_uv_tcp_connect.c \
|
||||
- test/integration/test_uv_tcp_listen.c \
|
||||
test/integration/test_uv_snapshot_put.c \
|
||||
test/integration/test_uv_truncate.c \
|
||||
test/integration/test_uv_work.c
|
56
pkgs/by-name/ra/raft-cowsql/package.nix
Normal file
56
pkgs/by-name/ra/raft-cowsql/package.nix
Normal file
|
@ -0,0 +1,56 @@
|
|||
{ lib
|
||||
, stdenv
|
||||
, fetchFromGitHub
|
||||
, autoreconfHook
|
||||
, libuv
|
||||
, lz4
|
||||
, pkg-config
|
||||
, incus
|
||||
, gitUpdater
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "raft-cowsql";
|
||||
version = "0.17.3";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "cowsql";
|
||||
repo = "raft";
|
||||
rev = "refs/tags/v${version}";
|
||||
hash = "sha256-Ad09giGVsAVtm/0GRU/OaZx7BGjL5TlU8BrzFaFlE9k=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ autoreconfHook pkg-config ];
|
||||
buildInputs = [ libuv lz4 ];
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
patches = [
|
||||
# network tests either hang indefinitely, or fail outright
|
||||
./disable-net-tests.patch
|
||||
|
||||
# missing dir check is flaky
|
||||
./disable-missing-dir-test.patch
|
||||
];
|
||||
|
||||
preConfigure = ''
|
||||
substituteInPlace configure --replace /usr/bin/ " "
|
||||
'';
|
||||
|
||||
doCheck = true;
|
||||
|
||||
outputs = [ "dev" "out" ];
|
||||
|
||||
passthru.tests = {
|
||||
inherit incus;
|
||||
updateScript = gitUpdater { };
|
||||
};
|
||||
|
||||
meta = with lib; {
|
||||
description = "Asynchronous C implementation of the Raft consensus protocol";
|
||||
homepage = "https://github.com/cowsql/raft";
|
||||
license = licenses.lgpl3Only;
|
||||
platforms = platforms.linux;
|
||||
maintainers = with maintainers; [ adamcstephens ];
|
||||
};
|
||||
}
|
|
@ -10687,6 +10687,7 @@ with pkgs;
|
|||
autoreconfHook = buildPackages.autoreconfHook269;
|
||||
};
|
||||
lxcfs = callPackage ../os-specific/linux/lxcfs { };
|
||||
|
||||
lxd = callPackage ../tools/admin/lxd/wrapper.nix { };
|
||||
lxd-unwrapped = callPackage ../tools/admin/lxd { };
|
||||
|
||||
|
|
Loading…
Reference in a new issue