mirror of
https://github.com/CHN-beta/nixos.git
synced 2026-01-12 07:29:23 +08:00
36 lines
1.0 KiB
Nix
36 lines
1.0 KiB
Nix
inputs:
|
|
{
|
|
options.nixos.system.fileSystems.mount.nfs = let inherit (inputs.lib) mkOption types; in mkOption
|
|
{
|
|
type = types.nullOr (types.attrsOf types.nonEmptyStr); default = null;
|
|
};
|
|
config = let inherit (inputs.config.nixos.system.fileSystems.mount) nfs; in inputs.lib.mkIf (nfs != null)
|
|
{
|
|
fileSystems = builtins.listToAttrs (builtins.map
|
|
(device:
|
|
{
|
|
name = device.value;
|
|
value =
|
|
{
|
|
device = device.name;
|
|
fsType = "nfs";
|
|
neededForBoot = true;
|
|
# retry 15 minutes before giving up
|
|
options = [ "retry=15,x-systemd.device-timeout=15min" ];
|
|
};
|
|
})
|
|
(inputs.localLib.attrsToList nfs));
|
|
boot.initrd =
|
|
{
|
|
network.enable = true;
|
|
systemd.extraBin =
|
|
{
|
|
"ifconfig" = "${inputs.pkgs.nettools}/bin/ifconfig";
|
|
"mount.nfs" = "${inputs.pkgs.nfs-utils}/bin/mount.nfs";
|
|
"mount.nfs4" = "${inputs.pkgs.nfs-utils}/bin/mount.nfs4";
|
|
};
|
|
};
|
|
services.rpcbind.enable = true;
|
|
};
|
|
}
|