nfs fix
This commit is contained in:
parent
475ab0df9b
commit
7ed7224d53
2 changed files with 26 additions and 20 deletions
|
|
@ -32,26 +32,32 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable (
|
||||||
services.autofs = {
|
|
||||||
enable = true;
|
|
||||||
timeout = 300;
|
|
||||||
autoMaster =
|
|
||||||
let
|
let
|
||||||
# Build server list: primary host followed by replicas
|
# Build server list: primary host followed by replicas
|
||||||
allHosts = [ cfg.remoteHost ] ++ cfg.replicas;
|
allHosts = [ cfg.remoteHost ] ++ cfg.replicas;
|
||||||
# Format as "host1:/path host2:/path host3:/path"
|
# Format as "host1,host2,host3:/path" for NFS replicas
|
||||||
locations = concatStringsSep " " (map (host: "${host}:${cfg.remotePath}") allHosts);
|
locations = "${concatStringsSep "," allHosts}:${cfg.remotePath}";
|
||||||
in
|
in
|
||||||
''
|
{
|
||||||
${cfg.mountPoint} -fstype=nfs4,rw,soft,intr,noatime ${locations}
|
services.autofs = {
|
||||||
|
enable = true;
|
||||||
|
timeout = 300;
|
||||||
|
autoMaster = ''
|
||||||
|
/- /etc/auto.nfs --timeout=300
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Create the auto.nfs map file
|
||||||
|
environment.etc."auto.nfs".text = ''
|
||||||
|
${cfg.mountPoint} -fstype=nfs4,rw,soft,intr,noatime ${locations}
|
||||||
|
'';
|
||||||
|
|
||||||
systemd.tmpfiles.rules = [
|
systemd.tmpfiles.rules = [
|
||||||
"d ${cfg.mountPoint} 0755 root root -"
|
"d ${cfg.mountPoint} 0755 root root -"
|
||||||
];
|
];
|
||||||
|
|
||||||
environment.systemPackages = [ pkgs.nfs-utils ];
|
environment.systemPackages = [ pkgs.nfs-utils ];
|
||||||
};
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ in
|
||||||
services.nfs.server = {
|
services.nfs.server = {
|
||||||
enable = true;
|
enable = true;
|
||||||
exports = ''
|
exports = ''
|
||||||
${cfg.exportPath} ${concatStringsSep " " (map (net: "${net}(rw,sync,no_subtree_check,no_root_squash)") cfg.allowedNetworks)}
|
${cfg.exportPath} ${concatStringsSep " " (map (net: "${net}(rw,sync,no_subtree_check,no_root_squash,fsid=0)") cfg.allowedNetworks)}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue