with builtins; with import ; {pkgs, lib, config, hostName, ...}: with lib; let cfg = config.services.guzzlords; in let islandToExportList = guzzlordName: island: conf: if (island == config.networking.hostName) then ['' ${conf.path} ${guzzlordName}(rw,nohide,insecure,no_subtree_check) ''] else []; guzzlordToIslandConfigs = (guzzlordName: conf: (attrValues (mapAttrs (islandToExportList guzzlordName) conf.islands))); in { config = let exports = join-string "\n" (flatten (attrValues (mapAttrs guzzlordToIslandConfigs cfg))); in mkIf (exports != "") { services.nfs.server = { inherit exports; enable = true; statdPort = 4000; lockdPort = 4001; mountdPort = 4002; }; networking.firewall = { allowedTCPPorts = [111 2049 4000 4001 4002 20048]; allowedUDPPorts = [111 2049 4000 4001 4002 20048]; }; }; }