2021-11-02 07:26:56 +00:00
|
|
|
{ lib, hwdata, pkg-config, lxc, buildGoPackage, fetchurl, fetchpatch
|
2021-09-05 00:29:55 +01:00
|
|
|
, makeWrapper, acl, rsync, gnutar, xz, btrfs-progs, gzip, dnsmasq, attr
|
2020-03-15 15:03:26 +00:00
|
|
|
, squashfsTools, iproute2, iptables, libcap
|
2021-05-15 18:13:37 +01:00
|
|
|
, dqlite, raft-canonical, sqlite-replication, udev
|
2018-11-20 06:36:56 +00:00
|
|
|
, writeShellScriptBin, apparmor-profiles, apparmor-parser
|
2019-07-09 17:47:19 +01:00
|
|
|
, criu
|
2019-02-04 08:19:14 +00:00
|
|
|
, bash
|
2020-04-26 04:16:56 +01:00
|
|
|
, installShellFiles
|
2020-12-06 08:59:59 +00:00
|
|
|
, nixosTests
|
2018-03-16 09:58:54 +00:00
|
|
|
}:
|
2016-06-03 14:55:03 +01:00
|
|
|
|
|
|
|
buildGoPackage rec {
|
2019-03-12 17:56:47 +00:00
|
|
|
pname = "lxd";
|
2022-02-12 04:20:00 +00:00
|
|
|
version = "4.23";
|
2016-06-03 14:55:03 +01:00
|
|
|
|
|
|
|
goPackagePath = "github.com/lxc/lxd";
|
|
|
|
|
2018-03-16 09:58:54 +00:00
|
|
|
src = fetchurl {
|
2021-05-08 05:20:00 +01:00
|
|
|
url = "https://linuxcontainers.org/downloads/lxd/lxd-${version}.tar.gz";
|
2022-02-12 04:20:00 +00:00
|
|
|
sha256 = "sha256-bPzH9MRirgl3b/wkkYIRhEvryvy/5M2Y9LLPqD4IL8U=";
|
2016-06-03 14:55:03 +01:00
|
|
|
};
|
|
|
|
|
2020-05-03 13:34:25 +01:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace shared/usbid/load.go \
|
|
|
|
--replace "/usr/share/misc/usb.ids" "${hwdata}/share/hwdata/usb.ids"
|
|
|
|
'';
|
|
|
|
|
2018-03-16 09:58:54 +00:00
|
|
|
preBuild = ''
|
2021-07-14 05:20:00 +01: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 18:13:37 +01:00
|
|
|
makeFlagsArray+=("-tags libsqlite3")
|
|
|
|
'';
|
2018-10-13 10:44:54 +01:00
|
|
|
|
2018-03-16 09:58:54 +00:00
|
|
|
postInstall = ''
|
2019-02-08 06:54:38 +00:00
|
|
|
# test binaries, code generation
|
2020-04-28 02:50:57 +01:00
|
|
|
rm $out/bin/{deps,macaroon-identity,generate}
|
2018-03-16 09:58:54 +00:00
|
|
|
|
2021-01-15 09:19:50 +00:00
|
|
|
wrapProgram $out/bin/lxd --prefix PATH : ${lib.makeBinPath (
|
2020-03-15 15:03:26 +00:00
|
|
|
[ iptables ]
|
2021-09-05 00:29:55 +01:00
|
|
|
++ [ acl rsync gnutar xz btrfs-progs gzip dnsmasq squashfsTools iproute2 bash criu attr ]
|
2020-06-05 11:57:18 +01:00
|
|
|
++ [ (writeShellScriptBin "apparmor_parser" ''
|
|
|
|
exec '${apparmor-parser}/bin/apparmor_parser' -I '${apparmor-profiles}/etc/apparmor.d' "$@"
|
|
|
|
'') ]
|
|
|
|
)
|
|
|
|
}
|
2019-07-09 17:53:01 +01:00
|
|
|
|
2021-03-06 04:20:00 +00:00
|
|
|
installShellCompletion --bash --name lxd go/src/github.com/lxc/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;
|
|
|
|
|
2021-01-17 09:17:16 +00:00
|
|
|
nativeBuildInputs = [ installShellFiles pkg-config makeWrapper ];
|
2021-05-15 18:13:37 +01:00
|
|
|
buildInputs = [ lxc acl libcap dqlite.dev raft-canonical.dev
|
|
|
|
sqlite-replication udev.dev ];
|
2016-06-03 14:55:03 +01:00
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2016-06-03 14:55:03 +01:00
|
|
|
description = "Daemon based on liblxc offering a REST API to manage containers";
|
2020-04-02 10:20:00 +01:00
|
|
|
homepage = "https://linuxcontainers.org/lxd/";
|
2016-06-03 14:55:03 +01:00
|
|
|
license = licenses.asl20;
|
2021-08-08 12:02:00 +01:00
|
|
|
maintainers = with maintainers; [ fpletz wucke13 marsam ];
|
2016-06-03 14:55:03 +01:00
|
|
|
platforms = platforms.linux;
|
|
|
|
};
|
|
|
|
}
|