Files
TheaninovOS/modules/nixos/services/nfsclient.nix
T
2026-08-26 09:04:34 +02:00

40 lines
734 B
Nix

{
lib,
config,
...
}:
with lib;
let
cfg = config.services.nfsclient;
in
{
options.services.nfsclient = {
enable = mkEnableOption "Enable shared directory";
ip = mkOption {
type = types.str;
};
exportedDirs = mkOption {
type = types.listOf types.str;
};
};
config = mkIf cfg.enable {
boot.supportedFilesystems = [ "nfs" ];
fileSystems = builtins.listToAttrs (
lib.map (dir: {
name = "/mnt/${dir}";
value = {
device = "${cfg.ip}:/shared";
fsType = "nfs4";
options = [
"x-systemd.idle-timeout=600"
"x-systemd.automount"
"noauto"
];
};
}) cfg.exportedDirs
);
};
}