Skip to content
Permalink
Browse files

unifi and mongo

  • Loading branch information
peterhoeg committed Jul 12, 2018
1 parent dae9cf6 commit e52f004c940496917b70a4f6721f6ac1fcd2a2ff
Showing with 11 additions and 6 deletions.
  1. +11 −6 nixos/modules/services/networking/unifi.nix
@@ -1,5 +1,7 @@
{ config, lib, pkgs, utils, ... }:

with lib;

let
cfg = config.services.unifi;
stateDir = "/var/lib/unifi";
@@ -60,11 +62,11 @@ in
};

services.unifi.mongodbPackage = mkOption {
type = types.package;
default = pkgs.mongodb;
defaultText = "pkgs.mongodb";
type = types.orNull types.package;
default = null;
defaultText = "null";
description = ''
The mongodb package to use.
The external mongodb package to use. If null, use the internal server.
'';
};

@@ -145,10 +147,13 @@ in
where = where;
}) mountPoints;

systemd.services.unifi = {
systemd.services.unifi = let
externalMongo = cfg.mongoDbPackage != null;
in {
description = "UniFi controller daemon";
wantedBy = [ "multi-user.target" ];
after = [ "network.target" ] ++ systemdMountPoints;
after = [ "network.target" ] ++ systemdMountPoints ++ lib.optional externalMongo "mongodb.service";
wants = lib.optional externalMongo "mongodb.service";
partOf = systemdMountPoints;
bindsTo = systemdMountPoints;
unitConfig.RequiresMountsFor = stateDir;

0 comments on commit e52f004

Please sign in to comment.
You can’t perform that action at this time.