2024-04-02 03:30:51 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
hwdata,
|
|
|
|
pkg-config,
|
|
|
|
lxc,
|
2024-07-10 01:01:02 +00:00
|
|
|
buildGoModule,
|
2024-07-02 11:59:04 +00:00
|
|
|
fetchFromGitHub,
|
2024-04-02 03:30:51 +00:00
|
|
|
acl,
|
|
|
|
libcap,
|
|
|
|
dqlite,
|
|
|
|
raft-canonical,
|
|
|
|
sqlite,
|
|
|
|
udev,
|
|
|
|
installShellFiles,
|
|
|
|
nixosTests,
|
2024-07-02 11:59:04 +00:00
|
|
|
nix-update-script,
|
2018-03-16 09:58:54 +00:00
|
|
|
}:
|
2016-06-03 13:55:03 +00:00
|
|
|
|
2024-07-10 01:01:02 +00:00
|
|
|
buildGoModule rec {
|
2024-04-02 03:59:10 +00:00
|
|
|
pname = "lxd-unwrapped-lts";
|
|
|
|
# major/minor are used in updateScript to pin to LTS
|
2024-07-02 12:10:11 +00:00
|
|
|
version = "5.21.1";
|
2016-06-03 13:55:03 +00:00
|
|
|
|
2024-07-02 11:59:04 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "canonical";
|
|
|
|
repo = "lxd";
|
|
|
|
rev = "refs/tags/lxd-${version}";
|
2024-07-02 12:10:11 +00:00
|
|
|
hash = "sha256-6php6dThpyADOY+2PZ38WxK2jPKd61D0OCwTKjAhAUg=";
|
2016-06-03 13:55:03 +00:00
|
|
|
};
|
|
|
|
|
2024-07-02 12:10:11 +00:00
|
|
|
vendorHash = "sha256-iGW2FQjuqANadFuMHa+2VXiUgoU0VFBJYUyh0pMIdWY=";
|
2022-09-30 02:14:19 +00:00
|
|
|
|
2020-05-03 12:34:25 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace shared/usbid/load.go \
|
|
|
|
--replace "/usr/share/misc/usb.ids" "${hwdata}/share/hwdata/usb.ids"
|
|
|
|
'';
|
|
|
|
|
2024-04-02 03:30:51 +00:00
|
|
|
excludedPackages = [
|
|
|
|
"test"
|
|
|
|
"lxd/db/generate"
|
|
|
|
"lxd-agent"
|
|
|
|
"lxd-migrate"
|
|
|
|
];
|
2022-04-30 04:20:00 +00:00
|
|
|
|
2024-04-02 03:30:51 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
installShellFiles
|
|
|
|
pkg-config
|
|
|
|
];
|
2022-09-30 02:14:19 +00:00
|
|
|
buildInputs = [
|
|
|
|
lxc
|
|
|
|
acl
|
|
|
|
libcap
|
|
|
|
dqlite.dev
|
|
|
|
raft-canonical.dev
|
2022-12-23 18:31:49 +00:00
|
|
|
sqlite
|
2022-09-30 02:14:19 +00:00
|
|
|
udev.dev
|
|
|
|
];
|
|
|
|
|
2024-04-02 03:30:51 +00:00
|
|
|
ldflags = [
|
|
|
|
"-s"
|
|
|
|
"-w"
|
|
|
|
];
|
2022-09-30 02:14:19 +00:00
|
|
|
tags = [ "libsqlite3" ];
|
|
|
|
|
2018-03-16 09:58:54 +00:00
|
|
|
preBuild = ''
|
2023-07-19 13:16:20 +00:00
|
|
|
# required for go-dqlite. See: https://github.com/canonical/lxd/pull/8939
|
2021-07-14 04:20:00 +00:00
|
|
|
export CGO_LDFLAGS_ALLOW="(-Wl,-wrap,pthread_create)|(-Wl,-z,now)"
|
2021-05-15 17:13:37 +00:00
|
|
|
'';
|
2018-10-13 09:44:54 +00:00
|
|
|
|
2023-07-19 13:17:54 +00:00
|
|
|
# build static binaries: https://github.com/canonical/lxd/blob/6fd175c45e65cd475d198db69d6528e489733e19/Makefile#L43-L51
|
|
|
|
postBuild = ''
|
|
|
|
make lxd-agent lxd-migrate
|
|
|
|
'';
|
|
|
|
|
2024-01-07 10:10:58 +00:00
|
|
|
checkFlags =
|
2024-04-02 03:30:51 +00:00
|
|
|
let
|
|
|
|
skippedTests = [
|
|
|
|
"TestValidateConfig"
|
|
|
|
"TestConvertNetworkConfig"
|
|
|
|
"TestConvertStorageConfig"
|
|
|
|
"TestSnapshotCommon"
|
|
|
|
"TestContainerTestSuite"
|
|
|
|
];
|
|
|
|
in
|
2024-01-07 10:10:58 +00:00
|
|
|
[ "-skip=^${builtins.concatStringsSep "$|^" skippedTests}$" ];
|
2022-09-30 02:14:19 +00:00
|
|
|
|
2018-03-16 09:58:54 +00:00
|
|
|
postInstall = ''
|
2022-09-30 02:14:19 +00:00
|
|
|
installShellCompletion --bash --name lxd ./scripts/bash/lxd-client
|
2018-03-16 09:58:54 +00:00
|
|
|
'';
|
|
|
|
|
2024-07-02 11:59:04 +00:00
|
|
|
passthru = {
|
|
|
|
tests.lxd = nixosTests.lxd;
|
|
|
|
tests.lxd-to-incus = nixosTests.incus.lxd-to-incus;
|
|
|
|
|
|
|
|
updateScript = nix-update-script {
|
|
|
|
extraArgs = [
|
|
|
|
"--version-regex"
|
|
|
|
"lxd-(5.21.*)"
|
|
|
|
];
|
|
|
|
};
|
2023-05-27 18:57:27 +00:00
|
|
|
};
|
2020-12-06 08:59:59 +00:00
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2016-06-03 13:55:03 +00:00
|
|
|
description = "Daemon based on liblxc offering a REST API to manage containers";
|
2023-07-19 13:16:20 +00:00
|
|
|
homepage = "https://ubuntu.com/lxd";
|
|
|
|
changelog = "https://github.com/canonical/lxd/releases/tag/lxd-${version}";
|
2024-04-02 03:30:51 +00:00
|
|
|
license = with licenses; [
|
|
|
|
asl20
|
|
|
|
agpl3Plus
|
|
|
|
];
|
2023-12-02 14:38:44 +00:00
|
|
|
maintainers = teams.lxc.members;
|
2016-06-03 13:55:03 +00:00
|
|
|
platforms = platforms.linux;
|
|
|
|
};
|
|
|
|
}
|