2024-01-23 16:14:27 -05:00
|
|
|
# TODO: move this to NAS?
|
2024-01-24 21:57:24 -05:00
|
|
|
{lib, ...}: let
|
|
|
|
inherit (lib) concatMapStringsSep concatStringsSep;
|
|
|
|
in {
|
2024-01-23 16:14:27 -05:00
|
|
|
services.nfs.server = {
|
|
|
|
enable = true;
|
|
|
|
createMountPoints = true;
|
|
|
|
|
2024-01-24 21:57:24 -05:00
|
|
|
exports = let
|
|
|
|
mkExport = dir: opts: ips: "/export${dir} ${
|
|
|
|
concatMapStringsSep " "
|
|
|
|
(ip: ip + "(${concatStringsSep "," opts})")
|
|
|
|
ips
|
|
|
|
}";
|
|
|
|
|
|
|
|
mkRootExport = opts: ips:
|
|
|
|
mkExport "" (opts ++ ["crossmnt" "fsid=0"]) ips;
|
|
|
|
|
|
|
|
allowedIps = ["10.0.0.244" "100.64.0.8" "10.0.0.159" "100.64.0.9"];
|
|
|
|
options = ["rw" "no_root_squash" "no_subtree_check"];
|
|
|
|
in ''
|
|
|
|
${mkRootExport options allowedIps}
|
|
|
|
${mkExport "/caddy" options allowedIps}
|
|
|
|
${mkExport "/headscale" options allowedIps}
|
2024-01-23 16:14:27 -05:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
}
|