2022-09-30 04:14:19 +02:00
|
|
|
{ lib
|
|
|
|
, hwdata
|
|
|
|
, pkg-config
|
|
|
|
, lxc
|
|
|
|
, buildGoModule
|
|
|
|
, fetchurl
|
|
|
|
, makeWrapper
|
|
|
|
, acl
|
|
|
|
, rsync
|
|
|
|
, gnutar
|
|
|
|
, xz
|
|
|
|
, btrfs-progs
|
|
|
|
, gzip
|
|
|
|
, dnsmasq
|
|
|
|
, attr
|
|
|
|
, squashfsTools
|
|
|
|
, iproute2
|
|
|
|
, iptables
|
|
|
|
, libcap
|
|
|
|
, dqlite
|
|
|
|
, raft-canonical
|
2022-12-23 19:31:49 +01:00
|
|
|
, sqlite
|
2022-09-30 04:14:19 +02:00
|
|
|
, udev
|
|
|
|
, writeShellScriptBin
|
|
|
|
, apparmor-profiles
|
|
|
|
, apparmor-parser
|
2019-07-09 18:47:19 +02:00
|
|
|
, criu
|
2019-02-04 09:19:14 +01:00
|
|
|
, bash
|
2020-04-26 05:16:56 +02:00
|
|
|
, installShellFiles
|
2020-12-06 09:59:59 +01:00
|
|
|
, nixosTests
|
2018-03-16 10:58:54 +01:00
|
|
|
}:
|
2016-06-03 15:55:03 +02:00
|
|
|
|
2022-09-30 04:14:19 +02:00
|
|
|
buildGoModule rec {
|
2019-03-12 18:56:47 +01:00
|
|
|
pname = "lxd";
|
2022-12-13 23:40:38 +01:00
|
|
|
version = "5.9";
|
2016-06-03 15:55:03 +02:00
|
|
|
|
2018-03-16 10:58:54 +01:00
|
|
|
src = fetchurl {
|
2022-05-28 06:20:00 +02:00
|
|
|
urls = [
|
|
|
|
"https://linuxcontainers.org/downloads/lxd/lxd-${version}.tar.gz"
|
|
|
|
"https://github.com/lxc/lxd/releases/download/lxd-${version}/lxd-${version}.tar.gz"
|
|
|
|
];
|
2022-12-13 23:40:38 +01:00
|
|
|
sha256 = "sha256-okz3++PlUno03tp+jpLxfAWlFJhyOCH2mxRtHo5YEX8=";
|
2016-06-03 15:55:03 +02:00
|
|
|
};
|
|
|
|
|
2022-09-30 04:14:19 +02:00
|
|
|
vendorSha256 = null;
|
|
|
|
|
2020-05-03 14:34:25 +02:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace shared/usbid/load.go \
|
|
|
|
--replace "/usr/share/misc/usb.ids" "${hwdata}/share/hwdata/usb.ids"
|
|
|
|
'';
|
|
|
|
|
2022-04-30 06:20:00 +02:00
|
|
|
excludedPackages = [ "test" "lxd/db/generate" ];
|
|
|
|
|
2022-09-30 04:14:19 +02:00
|
|
|
nativeBuildInputs = [ installShellFiles pkg-config makeWrapper ];
|
|
|
|
buildInputs = [
|
|
|
|
lxc
|
|
|
|
acl
|
|
|
|
libcap
|
|
|
|
dqlite.dev
|
|
|
|
raft-canonical.dev
|
2022-12-23 19:31:49 +01:00
|
|
|
sqlite
|
2022-09-30 04:14:19 +02:00
|
|
|
udev.dev
|
|
|
|
];
|
|
|
|
|
|
|
|
ldflags = [ "-s" "-w" ];
|
|
|
|
tags = [ "libsqlite3" ];
|
|
|
|
|
2018-03-16 10:58:54 +01:00
|
|
|
preBuild = ''
|
2021-07-14 06:20:00 +02:00
|
|
|
# required for go-dqlite. See: https://github.com/lxc/lxd/pull/8939
|
|
|
|
export CGO_LDFLAGS_ALLOW="(-Wl,-wrap,pthread_create)|(-Wl,-z,now)"
|
2021-05-15 19:13:37 +02:00
|
|
|
'';
|
2018-10-13 11:44:54 +02:00
|
|
|
|
2022-09-30 04:14:19 +02:00
|
|
|
preCheck =
|
|
|
|
let skippedTests = [
|
|
|
|
"TestValidateConfig"
|
|
|
|
"TestConvertNetworkConfig"
|
|
|
|
"TestConvertStorageConfig"
|
|
|
|
"TestSnapshotCommon"
|
|
|
|
"TestContainerTestSuite"
|
|
|
|
]; in
|
|
|
|
''
|
|
|
|
# Disable tests requiring local operations
|
|
|
|
buildFlagsArray+=("-run" "[^(${builtins.concatStringsSep "|" skippedTests})]")
|
|
|
|
'';
|
|
|
|
|
2018-03-16 10:58:54 +01:00
|
|
|
postInstall = ''
|
2021-01-15 10:19:50 +01:00
|
|
|
wrapProgram $out/bin/lxd --prefix PATH : ${lib.makeBinPath (
|
2020-03-15 16:03:26 +01:00
|
|
|
[ iptables ]
|
2021-09-05 01:29:55 +02:00
|
|
|
++ [ acl rsync gnutar xz btrfs-progs gzip dnsmasq squashfsTools iproute2 bash criu attr ]
|
2020-06-05 12:57:18 +02:00
|
|
|
++ [ (writeShellScriptBin "apparmor_parser" ''
|
|
|
|
exec '${apparmor-parser}/bin/apparmor_parser' -I '${apparmor-profiles}/etc/apparmor.d' "$@"
|
|
|
|
'') ]
|
|
|
|
)
|
|
|
|
}
|
2019-07-09 18:53:01 +02:00
|
|
|
|
2022-09-30 04:14:19 +02:00
|
|
|
installShellCompletion --bash --name lxd ./scripts/bash/lxd-client
|
2018-03-16 10:58:54 +01:00
|
|
|
'';
|
|
|
|
|
2020-12-06 09:59:59 +01:00
|
|
|
passthru.tests.lxd = nixosTests.lxd;
|
2022-05-03 12:24:13 +02:00
|
|
|
passthru.tests.lxd-nftables = nixosTests.lxd-nftables;
|
2020-12-06 09:59:59 +01:00
|
|
|
|
2021-01-11 08:54:33 +01:00
|
|
|
meta = with lib; {
|
2016-06-03 15:55:03 +02:00
|
|
|
description = "Daemon based on liblxc offering a REST API to manage containers";
|
2020-04-02 11:20:00 +02:00
|
|
|
homepage = "https://linuxcontainers.org/lxd/";
|
2022-06-24 06:20:00 +02:00
|
|
|
changelog = "https://github.com/lxc/lxd/releases/tag/lxd-${version}";
|
2016-06-03 15:55:03 +02:00
|
|
|
license = licenses.asl20;
|
2022-08-03 14:13:56 +02:00
|
|
|
maintainers = with maintainers; [ marsam ];
|
2016-06-03 15:55:03 +02:00
|
|
|
platforms = platforms.linux;
|
|
|
|
};
|
|
|
|
}
|