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,30 +27,28 @@ 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" ];
options = "bind";
what = what;
where = where;
}) [
{
what = "${pkgs.unifi}/dl"; what = "${pkgs.unifi}/dl";
where = "${stateDir}/dl"; where = "${stateDir}/dl";
options = "bind";
} }
{ {
bindsTo = [ "unifi.service" ];
requiredBy = [ "unifi.service" ];
before = [ "unifi.service" ];
what = "${pkgs.unifi}/lib"; what = "${pkgs.unifi}/lib";
where = "${stateDir}/lib"; where = "${stateDir}/lib";
options = "bind";
} }
{ {
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";
} }
]; ];