nixpkgs/pkgs/servers/unifi/default.nix

54 lines
1.1 KiB
Nix
Raw Normal View History

2017-05-01 23:00:09 +02:00
{ stdenv
, dpkg
, fetchurl
, unzip
, useLTS ? false
2017-05-01 23:00:09 +02:00
}:
2014-08-05 23:00:10 +02:00
let
versions = {
stable = {
version = "5.7.20";
sha256 = "1ylj4i5mcv6z9n32275ccdf1rqk74zilqsih3r6xzhm30pxrd8dd";
};
lts = {
version = "5.6.36";
sha256 = "075q7vm56fdsjwh72y2cb1pirl2pxdkvqnhvd3bf1c2n64mvp6bi";
};
};
selectedVersion =
let attr = if useLTS then "lts" else "stable";
in versions."${attr}";
in
stdenv.mkDerivation {
name = "unifi-controller-${selectedVersion.version}";
src = with selectedVersion; fetchurl {
2017-11-08 08:28:38 +01:00
url = "https://dl.ubnt.com/unifi/${version}/unifi_sysvinit_all.deb";
inherit sha256;
2014-08-05 23:00:10 +02:00
};
2017-05-01 23:00:09 +02:00
buildInputs = [ dpkg ];
2014-08-05 23:00:10 +02:00
2017-05-01 23:00:09 +02:00
unpackPhase = ''
dpkg-deb -x $src ./
2014-08-05 23:00:10 +02:00
'';
2017-05-01 23:00:09 +02:00
doConfigure = false;
2014-08-05 23:00:10 +02:00
installPhase = ''
mkdir -p $out
2017-05-01 23:00:09 +02:00
cd ./usr/lib/unifi
cp -ar dl lib webapps $out
2014-08-05 23:00:10 +02:00
'';
meta = with stdenv.lib; {
homepage = http://www.ubnt.com/;
description = "Controller for Ubiquiti UniFi accesspoints";
license = licenses.unfree;
platforms = platforms.unix;
2014-08-06 04:47:55 +02:00
maintainers = with maintainers; [ wkennington ];
2014-08-05 23:00:10 +02:00
};
}