summary refs log tree commit diff
path: root/nixos/modules/services/networking
diff options
context:
space:
mode:
authorBadi Abdul-Wahid <abdulwahidc@gmail.com>2018-03-25 16:49:54 -0400
committerRobin Gloster <mail@glob.in>2018-04-28 00:27:33 +0200
commitdf3566c9560b3305bd33faf4bc7580dc55f4f71e (patch)
tree43b1489bda7e83f26052e380dd7c16993895a2de /nixos/modules/services/networking
parent68d144b6eda1d1b0412b86596f688f179b43d257 (diff)
downloadnixlib-df3566c9560b3305bd33faf4bc7580dc55f4f71e.tar
nixlib-df3566c9560b3305bd33faf4bc7580dc55f4f71e.tar.gz
nixlib-df3566c9560b3305bd33faf4bc7580dc55f4f71e.tar.bz2
nixlib-df3566c9560b3305bd33faf4bc7580dc55f4f71e.tar.lz
nixlib-df3566c9560b3305bd33faf4bc7580dc55f4f71e.tar.xz
nixlib-df3566c9560b3305bd33faf4bc7580dc55f4f71e.tar.zst
nixlib-df3566c9560b3305bd33faf4bc7580dc55f4f71e.zip
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.
Diffstat (limited to 'nixos/modules/services/networking')
-rw-r--r--nixos/modules/services/networking/unifi.nix37
1 files changed, 32 insertions, 5 deletions
diff --git a/nixos/modules/services/networking/unifi.nix b/nixos/modules/services/networking/unifi.nix
index 8e5f0bfc070d..94958bfdd83e 100644
--- a/nixos/modules/services/networking/unifi.nix
+++ b/nixos/modules/services/networking/unifi.nix
@@ -4,22 +4,22 @@ let
   cfg = config.services.unifi;
   stateDir = "/var/lib/unifi";
   cmd = ''
-    @${pkgs.jre}/bin/java java \
+    @${cfg.jrePackage}/bin/java java \
         ${optionalString (cfg.initialJavaHeapSize != null) "-Xms${(toString cfg.initialJavaHeapSize)}m"} \
         ${optionalString (cfg.maximumJavaHeapSize != null) "-Xmx${(toString cfg.maximumJavaHeapSize)}m"} \
         -jar ${stateDir}/lib/ace.jar
   '';
   mountPoints = [
     {
-      what = "${pkgs.unifi}/dl";
+      what = "${cfg.unifiPackage}/dl";
       where = "${stateDir}/dl";
     }
     {
-      what = "${pkgs.unifi}/lib";
+      what = "${cfg.unifiPackage}/lib";
       where = "${stateDir}/lib";
     }
     {
-      what = "${pkgs.mongodb}/bin";
+      what = "${cfg.mongodbPackage}/bin";
       where = "${stateDir}/bin";
     }
     {
@@ -41,6 +41,33 @@ in
       '';
     };
 
+    services.unifi.jrePackage = mkOption {
+      type = types.package;
+      default = pkgs.jre8;
+      defaultText = "pkgs.jre8";
+      description = ''
+        The JRE package to use. Check the release notes to ensure it is supported.
+      '';
+    };
+
+    services.unifi.unifiPackage = mkOption {
+      type = types.package;
+      default = pkgs.unifiLTS;
+      defaultText = "pkgs.unifiLTS";
+      description = ''
+        The unifi package to use.
+      '';
+    };
+
+    services.unifi.mongodbPackage = mkOption {
+      type = types.package;
+      default = pkgs.mongodb;
+      defaultText = "pkgs.mongodb";
+      description = ''
+        The mongodb package to use.
+      '';
+    };
+
     services.unifi.dataDir = mkOption {
       type = types.str;
       default = "${stateDir}/data";
@@ -137,7 +164,7 @@ in
         rm -rf "${stateDir}/webapps"
         mkdir -p "${stateDir}/webapps"
         chown unifi "${stateDir}/webapps"
-        ln -s "${pkgs.unifi}/webapps/ROOT" "${stateDir}/webapps/ROOT"
+        ln -s "${cfg.unifiPackage}/webapps/ROOT" "${stateDir}/webapps/ROOT"
       '';
 
       postStop = ''