nixpkgs/pkgs/servers/unifi/default.nix
Badi Abdul-Wahid df3566c956 unifi, nixos/unifi: support LTS (5.6.36) and release (5.7.20)
Ubiquiti has both a LTS and current version of their Unifi controller software.

The latter adds new features, but may drop support for some devices.

This adds the capability to use either for the unifi module but defaults
to the LTS version, which was the previous behavior.
2018-04-28 00:27:33 +02:00

54 lines
1.1 KiB
Nix

{ stdenv
, dpkg
, fetchurl
, unzip
, useLTS ? false
}:
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 {
url = "https://dl.ubnt.com/unifi/${version}/unifi_sysvinit_all.deb";
inherit sha256;
};
buildInputs = [ dpkg ];
unpackPhase = ''
dpkg-deb -x $src ./
'';
doConfigure = false;
installPhase = ''
mkdir -p $out
cd ./usr/lib/unifi
cp -ar dl lib webapps $out
'';
meta = with stdenv.lib; {
homepage = http://www.ubnt.com/;
description = "Controller for Ubiquiti UniFi accesspoints";
license = licenses.unfree;
platforms = platforms.unix;
maintainers = with maintainers; [ wkennington ];
};
}