2019-06-16 21:59:06 +02:00
|
|
|
{ stdenv, pkgconfig, lxc, buildGoPackage, fetchurl
|
2018-06-28 20:59:07 +02:00
|
|
|
, makeWrapper, acl, rsync, gnutar, xz, btrfs-progs, gzip, dnsmasq
|
2019-09-29 14:02:49 +02:00
|
|
|
, squashfsTools, iproute, iptables, ebtables, libcap, libco-canonical, dqlite
|
|
|
|
, raft-canonical, sqlite-replication
|
2018-11-20 07:36:56 +01:00
|
|
|
, writeShellScriptBin, apparmor-profiles, apparmor-parser
|
2019-07-09 18:47:19 +02:00
|
|
|
, criu
|
2019-02-04 09:19:14 +01:00
|
|
|
, bash
|
2018-03-16 10:58:54 +01:00
|
|
|
}:
|
2016-06-03 15:55:03 +02:00
|
|
|
|
|
|
|
buildGoPackage rec {
|
2019-03-12 18:56:47 +01:00
|
|
|
pname = "lxd";
|
2019-09-29 14:02:49 +02:00
|
|
|
version = "3.18";
|
2016-06-03 15:55:03 +02:00
|
|
|
|
|
|
|
goPackagePath = "github.com/lxc/lxd";
|
|
|
|
|
2018-03-16 10:58:54 +01:00
|
|
|
src = fetchurl {
|
2019-03-12 18:56:47 +01:00
|
|
|
url = "https://github.com/lxc/lxd/releases/download/${pname}-${version}/${pname}-${version}.tar.gz";
|
2019-09-29 14:02:49 +02:00
|
|
|
sha256 = "1p8g2gbwgn3kln5rxddpc2fxk8bvf026wjiqip2b0vvpi7h3955h";
|
2016-06-03 15:55:03 +02:00
|
|
|
};
|
|
|
|
|
2018-03-16 10:58:54 +01:00
|
|
|
preBuild = ''
|
|
|
|
# unpack vendor
|
|
|
|
pushd go/src/github.com/lxc/lxd
|
2019-09-29 14:02:49 +02:00
|
|
|
rm _dist/src/github.com/lxc/lxd
|
|
|
|
cp -r _dist/src/* ../../..
|
2018-03-16 10:58:54 +01:00
|
|
|
popd
|
|
|
|
'';
|
2016-06-03 15:55:03 +02:00
|
|
|
|
2018-10-13 11:44:54 +02:00
|
|
|
buildFlags = [ "-tags libsqlite3" ];
|
|
|
|
|
2018-03-16 10:58:54 +01:00
|
|
|
postInstall = ''
|
2019-02-08 07:54:38 +01:00
|
|
|
# test binaries, code generation
|
|
|
|
rm $bin/bin/{deps,macaroon-identity,generate}
|
2018-03-16 10:58:54 +01:00
|
|
|
|
2019-02-04 09:19:14 +01:00
|
|
|
wrapProgram $bin/bin/lxd --prefix PATH : ${stdenv.lib.makeBinPath [
|
2019-07-09 18:47:19 +02:00
|
|
|
acl rsync gnutar xz btrfs-progs gzip dnsmasq squashfsTools iproute iptables ebtables bash criu
|
2018-11-20 07:36:56 +01:00
|
|
|
(writeShellScriptBin "apparmor_parser" ''
|
|
|
|
exec '${apparmor-parser}/bin/apparmor_parser' -I '${apparmor-profiles}/etc/apparmor.d' "$@"
|
|
|
|
'')
|
2018-03-16 10:58:54 +01:00
|
|
|
]}
|
2019-07-09 18:53:01 +02:00
|
|
|
|
|
|
|
mkdir -p "$bin/share/bash-completion/completions/"
|
|
|
|
cp -av go/src/github.com/lxc/lxd/scripts/bash/lxd-client "$bin/share/bash-completion/completions/lxc"
|
2018-03-16 10:58:54 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
nativeBuildInputs = [ pkgconfig makeWrapper ];
|
2019-09-29 14:02:49 +02:00
|
|
|
buildInputs = [ lxc acl libcap libco-canonical.dev dqlite.dev
|
|
|
|
raft-canonical.dev sqlite-replication ];
|
2016-06-03 15:55:03 +02:00
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
description = "Daemon based on liblxc offering a REST API to manage containers";
|
2017-06-20 02:02:54 +02:00
|
|
|
homepage = https://linuxcontainers.org/lxd/;
|
2016-06-03 15:55:03 +02:00
|
|
|
license = licenses.asl20;
|
2019-09-29 14:02:49 +02:00
|
|
|
maintainers = with maintainers; [ fpletz wucke13 ];
|
2016-06-03 15:55:03 +02:00
|
|
|
platforms = platforms.linux;
|
|
|
|
};
|
|
|
|
}
|