summaryrefslogtreecommitdiff
path: root/modules/root/nas.nix
blob: 0e11196932d3219d3d681fedacf3abf84e433304 (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
{ lib, config, ... } :
let
	mkNetworkFileSystem = device : {
		device = "${device}";
		fsType = "nfs";
		options = [ "noauto" "defaults" ];
	};
in {
	options = {
		nas = {
			enable = lib.mkEnableOption "enable network shares";
			home.enable = lib.mkEnableOption "enable home network shares";
			office.enable = lib.mkEnableOption "enable office network shares";
		};
	};

	config = lib.mkIf config.nas.enable {
		fileSystems = lib.optionalAttrs config.nas.home.enable {
			"/media/Storage/Media"   = mkNetworkFileSystem "truenas-home:/mnt/Storage/Media";
			"/media/Storage/Backups" = mkNetworkFileSystem "truenas-home:/mnt/Storage/Backups";
			"/media/Storage/Tapes"   = mkNetworkFileSystem "truenas-home:/mnt/Storage/Backups/Tapes";
			"/media/Family Photos"   = mkNetworkFileSystem "truenas-home:/mnt/Media/Photos";
		} // lib.optionalAttrs config.nas.office.enable {
			"/media/chexx/chexx"     = mkNetworkFileSystem "truenas-office:/mnt/Storage/chexx";
			"/media/chexx/tkdocs"    = mkNetworkFileSystem "truenas-office:/mnt/Storage/Users/Tim-Keller";
			"/media/chexx/scans"     = mkNetworkFileSystem "truenas-office:/mnt/Storage/Scans";
		};
	};
}