NixOS declare mounts in loop
I have a lot of NFS mounts on my system, which all have the same options. I would love to combine these to reduce code, but I am not how to do it/if it is even possible. What I have gotten so far is this:
fileSystems =
let attrs = builtins.listToAttrs [
{ mount = "/mnt/Foo"; dev = "192.168.0.1:/mnt/Foo"; }
{ mount = "/mnt/Bar"; dev = "192.168.0.1:/mnt/Bar"; }
];
in {
mount = {
depends = ["/"];
device = dev;
fsType = "nfs";
options = [
"rsize=8192"
"wsize=8192"
"_netdev"
"nfsvers=4"
"x-systemd.automount"
"noauto"
"x-systemd.idle-timeout=600"
"nofail"
"x-systemd.automount"
];
};
};
But this only works for the first entry. Is there a way to get it working for multiple entries?