From 377454ff0ef8f2e643f37edb953760e0dc1503f4 Mon Sep 17 00:00:00 2001 From: "William A. Kennington III" Date: Tue, 5 Aug 2014 23:15:49 -0500 Subject: [PATCH] nixos/unifi: Explain and simplify the bind mount configuration --- nixos/modules/services/networking/unifi.nix | 42 ++++++++++----------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/nixos/modules/services/networking/unifi.nix b/nixos/modules/services/networking/unifi.nix index b6f957ddde84..634f760328f7 100644 --- a/nixos/modules/services/networking/unifi.nix +++ b/nixos/modules/services/networking/unifi.nix @@ -27,32 +27,30 @@ in home = "${stateDir}"; }; - systemd.mounts = [ - { + # We must create the binary directories as bind mounts instead of symlinks + # This is because the controller resolves all symlinks to absolute paths + # to be used as the working directory. + systemd.mounts = map ({ what, where }: { bindsTo = [ "unifi.service" ]; requiredBy = [ "unifi.service" ]; before = [ "unifi.service" ]; - what = "${pkgs.unifi}/dl"; - where = "${stateDir}/dl"; options = "bind"; - } - { - bindsTo = [ "unifi.service" ]; - requiredBy = [ "unifi.service" ]; - before = [ "unifi.service" ]; - what = "${pkgs.unifi}/lib"; - where = "${stateDir}/lib"; - options = "bind"; - } - { - bindsTo = [ "unifi.service" ]; - requiredBy = [ "unifi.service" ]; - before = [ "unifi.service" ]; - what = "${pkgs.mongodb}/bin"; - where = "${stateDir}/bin"; - options = "bind"; - } - ]; + what = what; + where = where; + }) [ + { + what = "${pkgs.unifi}/dl"; + where = "${stateDir}/dl"; + } + { + what = "${pkgs.unifi}/lib"; + where = "${stateDir}/lib"; + } + { + what = "${pkgs.mongodb}/bin"; + where = "${stateDir}/bin"; + } + ]; systemd.services.unifi = { description = "UniFi controller daemon";