39 lines
1,021 B
Nix
39 lines
1,021 B
Nix
{ config, lib, ... }:
|
|
|
|
let
|
|
cfg = config.homelab.fileSystems.media.video;
|
|
|
|
remotePath = "/mnt/SMALL/MEDIA/VIDEO";
|
|
|
|
maxPermissions = permissions:
|
|
if builtins.elem "write" permissions then "rw"
|
|
else "ro";
|
|
permissionsOption = maxPermissions cfg.permissions;
|
|
in {
|
|
options.homelab.fileSystems.media.video = {
|
|
enable = lib.mkEnableOption "MEDIA/VIDEO dataset";
|
|
hostPath = lib.mkOption {
|
|
type = lib.types.path;
|
|
default = "/srv/video";
|
|
description = "Mountpath on host";
|
|
};
|
|
permissions = lib.mkOption {
|
|
type = lib.types.listOf (lib.types.enum [ "read" "write" ]);
|
|
default = [ "read" ];
|
|
description = "Mount options permissions";
|
|
};
|
|
};
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
homelab.nfsMounts."${cfg.hostPath}" = {
|
|
device = "192.168.0.11:${remotePath}";
|
|
readOnly = permissionsOption == "ro";
|
|
extraOptions = [
|
|
"auto"
|
|
"rsize=1048576" "wsize=1048576"
|
|
"timeo=600" "retrans=2"
|
|
"_netdev"
|
|
];
|
|
};
|
|
};
|
|
}
|