2022-09-30 11:47:45 +00:00
|
|
|
{ lib
|
|
|
|
, hwdata
|
|
|
|
, pkg-config
|
|
|
|
, lxc
|
|
|
|
, buildGoModule
|
|
|
|
, fetchurl
|
|
|
|
, acl
|
|
|
|
, libcap
|
|
|
|
, dqlite
|
|
|
|
, raft-canonical
|
2022-12-28 21:21:41 +00:00
|
|
|
, sqlite
|
2022-09-30 11:47:45 +00:00
|
|
|
, udev
|
2020-05-03 17:38:23 +00:00
|
|
|
, installShellFiles
|
2021-06-06 07:54:09 +00:00
|
|
|
, nixosTests
|
2023-07-15 17:15:38 +00:00
|
|
|
, gitUpdater
|
|
|
|
, callPackage
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
2022-09-30 11:47:45 +00:00
|
|
|
buildGoModule rec {
|
2023-07-15 17:15:38 +00:00
|
|
|
pname = "lxd-unwrapped";
|
2023-08-04 22:07:22 +00:00
|
|
|
version = "5.16";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2023-08-04 22:07:22 +00:00
|
|
|
url = "https://github.com/canonical/lxd/releases/download/lxd-${version}/lxd-${version}.tar.gz";
|
|
|
|
hash = "sha256-evtNPZvnx8rzr/tJkEp0E7BhUBWHBSJdMtZJQk3VZI8=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2023-04-29 16:46:19 +00:00
|
|
|
vendorHash = null;
|
2022-09-30 11:47:45 +00:00
|
|
|
|
2020-05-15 21:57:56 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace shared/usbid/load.go \
|
|
|
|
--replace "/usr/share/misc/usb.ids" "${hwdata}/share/hwdata/usb.ids"
|
|
|
|
'';
|
|
|
|
|
2023-08-04 22:07:22 +00:00
|
|
|
excludedPackages = [ "test" "lxd/db/generate" "lxd-agent" "lxd-migrate" ];
|
2022-04-27 09:35:20 +00:00
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
nativeBuildInputs = [ installShellFiles pkg-config ];
|
2022-09-30 11:47:45 +00:00
|
|
|
buildInputs = [
|
|
|
|
lxc
|
|
|
|
acl
|
|
|
|
libcap
|
|
|
|
dqlite.dev
|
|
|
|
raft-canonical.dev
|
2022-12-28 21:21:41 +00:00
|
|
|
sqlite
|
2022-09-30 11:47:45 +00:00
|
|
|
udev.dev
|
|
|
|
];
|
|
|
|
|
|
|
|
ldflags = [ "-s" "-w" ];
|
|
|
|
tags = [ "libsqlite3" ];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
preBuild = ''
|
2023-08-04 22:07:22 +00:00
|
|
|
# required for go-dqlite. See: https://github.com/canonical/lxd/pull/8939
|
2021-07-16 19:40:57 +00:00
|
|
|
export CGO_LDFLAGS_ALLOW="(-Wl,-wrap,pthread_create)|(-Wl,-z,now)"
|
2021-05-28 09:39:13 +00:00
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-08-04 22:07:22 +00:00
|
|
|
# build static binaries: https://github.com/canonical/lxd/blob/6fd175c45e65cd475d198db69d6528e489733e19/Makefile#L43-L51
|
|
|
|
postBuild = ''
|
|
|
|
make lxd-agent lxd-migrate
|
|
|
|
'';
|
|
|
|
|
2022-09-30 11:47:45 +00:00
|
|
|
preCheck =
|
|
|
|
let skippedTests = [
|
|
|
|
"TestValidateConfig"
|
|
|
|
"TestConvertNetworkConfig"
|
|
|
|
"TestConvertStorageConfig"
|
|
|
|
"TestSnapshotCommon"
|
|
|
|
"TestContainerTestSuite"
|
|
|
|
]; in
|
|
|
|
''
|
|
|
|
# Disable tests requiring local operations
|
|
|
|
buildFlagsArray+=("-run" "[^(${builtins.concatStringsSep "|" skippedTests})]")
|
|
|
|
'';
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
postInstall = ''
|
2022-09-30 11:47:45 +00:00
|
|
|
installShellCompletion --bash --name lxd ./scripts/bash/lxd-client
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2021-06-06 07:54:09 +00:00
|
|
|
passthru.tests.lxd = nixosTests.lxd;
|
2022-05-18 14:49:53 +00:00
|
|
|
passthru.tests.lxd-nftables = nixosTests.lxd-nftables;
|
2023-07-15 17:15:38 +00:00
|
|
|
passthru.tests.lxd-ui = nixosTests.lxd-ui;
|
|
|
|
passthru.ui = callPackage ./ui.nix { };
|
|
|
|
passthru.updateScript = gitUpdater {
|
2023-08-04 22:07:22 +00:00
|
|
|
url = "https://github.com/canonical/lxd.git";
|
2023-07-15 17:15:38 +00:00
|
|
|
rev-prefix = "lxd-";
|
|
|
|
};
|
2021-06-06 07:54:09 +00:00
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Daemon based on liblxc offering a REST API to manage containers";
|
2023-08-04 22:07:22 +00:00
|
|
|
homepage = "https://ubuntu.com/lxd";
|
|
|
|
changelog = "https://github.com/canonical/lxd/releases/tag/lxd-${version}";
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.asl20;
|
2023-02-02 18:25:31 +00:00
|
|
|
maintainers = with maintainers; [ marsam adamcstephens ];
|
2020-04-24 23:36:52 +00:00
|
|
|
platforms = platforms.linux;
|
|
|
|
};
|
|
|
|
}
|