1ecc3302b1
Add _netdev, x-systemd.requires/after network-online.target, x-systemd.automatic-mount=force, and x-systemd.mount-timeout=90 to improve NFS mount reliability on boot and network changes.
51 lines
1.2 KiB
Nix
51 lines
1.2 KiB
Nix
{ config, lib, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
cfg = config.roles.nfs-mounts;
|
|
in
|
|
{
|
|
options.roles.nfs-mounts = {
|
|
enable = mkEnableOption "Enable default NFS mounts";
|
|
server = mkOption {
|
|
type = types.str;
|
|
default = "10.0.0.43";
|
|
description = "IP address or hostname of the NFS server";
|
|
};
|
|
remotePath = mkOption {
|
|
type = types.str;
|
|
default = "/media";
|
|
description = "Remote path to mount from the NFS server";
|
|
};
|
|
mountPoint = mkOption {
|
|
type = types.str;
|
|
default = "/media";
|
|
description = "Local mount point for the NFS share";
|
|
};
|
|
# TODO: implement requireMount
|
|
requireMount = mkOption {
|
|
type = types.bool;
|
|
description = "Hard fail if the NFS mounts are not available";
|
|
default = false;
|
|
};
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
fileSystems.${cfg.mountPoint} = {
|
|
device = "${cfg.server}:${cfg.remotePath}";
|
|
fsType = "nfs";
|
|
options = [
|
|
"defaults"
|
|
"nofail"
|
|
"softreval"
|
|
"_netdev"
|
|
"x-systemd.requires=network-online.target"
|
|
"x-systemd.after=network-online.target"
|
|
"x-systemd.automatic-mount=force"
|
|
"x-systemd.mount-timeout=90"
|
|
];
|
|
};
|
|
};
|
|
}
|