Files
config/profiles/mounts/common-nfs.nix
2025-02-06 13:13:21 +01:00

41 lines
994 B
Nix

{ config, options, pkgs, lib, ... }:
# https://wiki.nixos.org/wiki/NFS
# TODO: use tailscale if enabled
# TODO: wireguard/tailscale
# TODO: nfsv4 and idmapping
#boot.kernelParams = [ "nfs.nfs4_disable_idmapping=0" "nfsd.nfs4_disable_idmapping=0" ];
let
cfg = config.pbsds.nfs-lazy-mount;
in
{
options.pbsds.nfs-lazy-mount.enable = lib.mkEnableOption "nfs-lazy-mount";
options.pbsds.nfs-lazy-mount.nfsOptions = lib.mkOption {
type = with lib.types; listOf str;
default = [];
internal = true;
};
# same default as `fileSystems.<name>.options`
# https://search.nixos.org/options?channel=unstable&query=fileSystems.%3Cname%3E.options
# https://man.archlinux.org/man/core/util-linux/mount.8.en
config.pbsds.nfs-lazy-mount.nfsOptions = lib.mkMerge [
# nixos default
[ "defaults" ]
(lib.mkIf cfg.enable [
# lazy mount
"x-systemd.automount"
"noauto"
# disconnect after 10 minutes
"x-systemd.idle-timeout=600"
])
];
}