summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorWilliam A. Kennington III <william@wkennington.com>2014-08-05 23:15:49 -0500
committerWilliam A. Kennington III <william@wkennington.com>2014-08-05 23:15:49 -0500
commit377454ff0ef8f2e643f37edb953760e0dc1503f4 (patch)
tree753c94a1e0eacf17375346a8faf275a0e2ea410f /nixos
parent12ad29226c4186e1e3a8633061e61a651a36a4a5 (diff)
downloadnixlib-377454ff0ef8f2e643f37edb953760e0dc1503f4.tar
nixlib-377454ff0ef8f2e643f37edb953760e0dc1503f4.tar.gz
nixlib-377454ff0ef8f2e643f37edb953760e0dc1503f4.tar.bz2
nixlib-377454ff0ef8f2e643f37edb953760e0dc1503f4.tar.lz
nixlib-377454ff0ef8f2e643f37edb953760e0dc1503f4.tar.xz
nixlib-377454ff0ef8f2e643f37edb953760e0dc1503f4.tar.zst
nixlib-377454ff0ef8f2e643f37edb953760e0dc1503f4.zip
nixos/unifi: Explain and simplify the bind mount configuration
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/services/networking/unifi.nix42
1 files 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";