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

58 lines
1.8 KiB
Nix
Raw Normal View History

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