about summary refs log tree commit diff
path: root/pkgs/tools/admin/lxd/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/tools/admin/lxd/default.nix')
-rw-r--r--pkgs/tools/admin/lxd/default.nix38
1 files changed, 26 insertions, 12 deletions
diff --git a/pkgs/tools/admin/lxd/default.nix b/pkgs/tools/admin/lxd/default.nix
index 64ec5e9b418e..cfbb90fdc308 100644
--- a/pkgs/tools/admin/lxd/default.nix
+++ b/pkgs/tools/admin/lxd/default.nix
@@ -1,23 +1,37 @@
-{ stdenv, lib, pkgconfig, lxc, buildGoPackage, fetchFromGitHub }:
+{ stdenv, lib, pkgconfig, lxc, buildGoPackage, fetchurl
+, makeWrapper, acl, rsync, gnutar, xz, btrfs-progs, gzip, dnsmasq, squashfsTools, iproute, iptables
+}:
 
 buildGoPackage rec {
-  name = "lxd-${version}";
-  version = "2.16";
-  rev = "lxd-${version}";
+  name = "lxd-3.0.0";
 
   goPackagePath = "github.com/lxc/lxd";
 
-  src = fetchFromGitHub {
-    inherit rev;
-    owner = "lxc";
-    repo = "lxd";
-    sha256 = "0i2mq9m8k9kznwz1i0xb48plp1ffpzvbdrvqvagis4sm17yab3fn";
+  src = fetchurl {
+    url = "https://github.com/lxc/lxd/releases/download/${name}/${name}.tar.gz";
+    sha256 = "0m5prdf9sk8k5bws1zva4n9ycggmy76wnjr6wb423066pszz24ww";
   };
 
-  goDeps = ./deps.nix;
+  preBuild = ''
+    # unpack vendor
+    pushd go/src/github.com/lxc/lxd
+    rm dist/src/github.com/lxc/lxd
+    cp -r dist/src/* ../../..
+    rm -r dist
+    popd
+  '';
 
-  nativeBuildInputs = [ pkgconfig ];
-  buildInputs = [ lxc ];
+  postInstall = ''
+    # binaries from test/
+    rm $bin/bin/{deps,macaroon-identity}
+
+    wrapProgram $bin/bin/lxd --prefix PATH ":" ${stdenv.lib.makeBinPath [
+      acl rsync gnutar xz btrfs-progs gzip dnsmasq squashfsTools iproute iptables
+    ]}
+  '';
+
+  nativeBuildInputs = [ pkgconfig makeWrapper ];
+  buildInputs = [ lxc acl ];
 
   meta = with stdenv.lib; {
     description = "Daemon based on liblxc offering a REST API to manage containers";