fix: Separate nfs config
This commit is contained in:
parent
c541fa4e6e
commit
48fb68c2fd
5 changed files with 100 additions and 64 deletions
5
modules/fileSystems/media/default.nix
Normal file
5
modules/fileSystems/media/default.nix
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
imports = [
|
||||
./video
|
||||
];
|
||||
}
|
||||
42
modules/fileSystems/media/video/default.nix
Normal file
42
modules/fileSystems/media/video/default.nix
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
{ 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 {
|
||||
fileSystems."${cfg.hostPath}" = {
|
||||
device = "192.168.0.11:${remotePath}";
|
||||
fsType = "nfs";
|
||||
options = [
|
||||
permissionsOption
|
||||
"auto"
|
||||
"nfsvers=4.2"
|
||||
"async" "soft"
|
||||
"rsize=1048576" "wsize=1048576"
|
||||
"timeo=600" "retry=50" "retrans=2" "actimeo=1800" "lookupcache=all"
|
||||
"_netdev" "nosuid" "tcp"
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue