nixpkgs/pkgs/tools/admin/lxd/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

95 lines
2.3 KiB
Nix
Raw Normal View History

2022-09-30 02:14:19 +00:00
{ lib
, hwdata
, pkg-config
, lxc
, buildGoModule
, fetchurl
, acl
, libcap
, dqlite
, raft-canonical
, sqlite
2022-09-30 02:14:19 +00:00
, udev
2020-04-26 03:16:56 +00:00
, installShellFiles
2020-12-06 08:59:59 +00:00
, nixosTests
2023-05-27 18:57:27 +00:00
, gitUpdater
, callPackage
2018-03-16 09:58:54 +00:00
}:
2016-06-03 13:55:03 +00:00
2022-09-30 02:14:19 +00:00
buildGoModule rec {
2023-06-30 02:53:51 +00:00
pname = "lxd-unwrapped";
2023-12-12 16:18:52 +00:00
version = "5.20";
2016-06-03 13:55:03 +00:00
2018-03-16 09:58:54 +00:00
src = fetchurl {
2023-07-19 13:16:20 +00:00
url = "https://github.com/canonical/lxd/releases/download/lxd-${version}/lxd-${version}.tar.gz";
2023-12-12 16:18:52 +00:00
hash = "sha256-L5WLdX9M3mTQ81eNoL2p7lllo6cOwJVu3fgofRKQFn8=";
2016-06-03 13:55:03 +00:00
};
vendorHash = null;
2022-09-30 02:14:19 +00:00
postPatch = ''
substituteInPlace shared/usbid/load.go \
--replace "/usr/share/misc/usb.ids" "${hwdata}/share/hwdata/usb.ids"
'';
excludedPackages = [ "test" "lxd/db/generate" "lxd-agent" "lxd-migrate" ];
2023-06-30 02:53:51 +00:00
nativeBuildInputs = [ installShellFiles pkg-config ];
2022-09-30 02:14:19 +00:00
buildInputs = [
lxc
acl
libcap
dqlite.dev
raft-canonical.dev
sqlite
2022-09-30 02:14:19 +00:00
udev.dev
];
ldflags = [ "-s" "-w" ];
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)"
'';
2018-10-13 09:44:54 +00:00
# build static binaries: https://github.com/canonical/lxd/blob/6fd175c45e65cd475d198db69d6528e489733e19/Makefile#L43-L51
postBuild = ''
make lxd-agent lxd-migrate
'';
2022-09-30 02:14:19 +00:00
preCheck =
let skippedTests = [
"TestValidateConfig"
"TestConvertNetworkConfig"
"TestConvertStorageConfig"
"TestSnapshotCommon"
"TestContainerTestSuite"
]; in
''
# Disable tests requiring local operations
buildFlagsArray+=("-run" "[^(${builtins.concatStringsSep "|" skippedTests})]")
'';
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
'';
2020-12-06 08:59:59 +00:00
passthru.tests.lxd = nixosTests.lxd;
passthru.tests.lxd-to-incus = nixosTests.incus.lxd-to-incus;
passthru.ui = callPackage ./ui.nix { };
2023-05-27 18:57:27 +00:00
passthru.updateScript = gitUpdater {
2023-07-19 13:16:20 +00:00
url = "https://github.com/canonical/lxd.git";
2023-05-27 18:57:27 +00:00
rev-prefix = "lxd-";
};
2020-12-06 08:59:59 +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}";
2023-12-13 09:28:32 +00:00
license = with licenses; [ asl20 agpl3 ];
maintainers = teams.lxc.members;
2016-06-03 13:55:03 +00:00
platforms = platforms.linux;
};
}