nixos/unifi: Explain and simplify the bind mount configuration

This commit is contained in:
William A. Kennington III 2014-08-05 23:15:49 -05:00
parent 12ad29226c
commit 377454ff0e

View File

@ -27,32 +27,30 @@ in
home = "${stateDir}"; 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" ]; bindsTo = [ "unifi.service" ];
requiredBy = [ "unifi.service" ]; requiredBy = [ "unifi.service" ];
before = [ "unifi.service" ]; before = [ "unifi.service" ];
what = "${pkgs.unifi}/dl";
where = "${stateDir}/dl";
options = "bind"; options = "bind";
} what = what;
{ where = where;
bindsTo = [ "unifi.service" ]; }) [
requiredBy = [ "unifi.service" ]; {
before = [ "unifi.service" ]; what = "${pkgs.unifi}/dl";
what = "${pkgs.unifi}/lib"; where = "${stateDir}/dl";
where = "${stateDir}/lib"; }
options = "bind"; {
} what = "${pkgs.unifi}/lib";
{ where = "${stateDir}/lib";
bindsTo = [ "unifi.service" ]; }
requiredBy = [ "unifi.service" ]; {
before = [ "unifi.service" ]; what = "${pkgs.mongodb}/bin";
what = "${pkgs.mongodb}/bin"; where = "${stateDir}/bin";
where = "${stateDir}/bin"; }
options = "bind"; ];
}
];
systemd.services.unifi = { systemd.services.unifi = {
description = "UniFi controller daemon"; description = "UniFi controller daemon";