blob: 525456e4fdc9854188f248c728954001c7276421 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
{ lib, config, ... } :
let
mkNetworkFileSystem = device: automount: {
device = "${device}";
fsType = "nfs";
options = [ "defaults" ] ++ lib.optionals automount [ "noauto" ];
};
in {
options = {
nas = {
enable = lib.mkEnableOption "enable network shares";
home = {
enable = lib.mkEnableOption "enable home network shares";
automount = lib.mkEnableOption "automount home network shares";
};
office = {
enable = lib.mkEnableOption "enable office network shares";
automount = lib.mkEnableOption "automount home network shares";
};
};
};
config = lib.mkIf config.nas.enable {
fileSystems = lib.optionalAttrs config.nas.home.enable {
"/media/Storage/Media" = mkNetworkFileSystem "truenas-home:/mnt/Storage/Media" config.nas.home.automount;
"/media/Storage/Backups" = mkNetworkFileSystem "truenas-home:/mnt/Storage/Backups" config.nas.home.automount;
"/media/Storage/Tapes" = mkNetworkFileSystem "truenas-home:/mnt/Storage/Backups/Tapes" config.nas.home.automount;
"/media/Family Photos" = mkNetworkFileSystem "truenas-home:/mnt/Media/Photos" config.nas.home.automount;
} // lib.optionalAttrs config.nas.office.enable {
"/media/chexx/chexx" = mkNetworkFileSystem "truenas-office:/mnt/Storage/chexx" config.nas.office.automount;
"/media/chexx/tkdocs" = mkNetworkFileSystem "truenas-office:/mnt/Storage/Users/Tim-Keller" config.nas.office.automount;
"/media/chexx/scans" = mkNetworkFileSystem "truenas-office:/mnt/Storage/Scans" config.nas.office.automount;
};
# TODO auto mkdirz
};
}
|