diff options
author | makefu <github@syntax-fehler.de> | 2016-07-27 00:05:59 +0200 |
---|---|---|
committer | makefu <github@syntax-fehler.de> | 2016-07-27 00:05:59 +0200 |
commit | 88a220f78825c1bfc60f0e885e02eacc0b7cd6a9 (patch) | |
tree | 291c61ea7177d790f6d2c4692d2c7c8ec1cbacc5 /makefu/1systems | |
parent | b308c77e7af47bd4994ef23b59a7e40975485f9b (diff) |
m 1 omo: configure mergerfs
Diffstat (limited to 'makefu/1systems')
-rw-r--r-- | makefu/1systems/omo.nix | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/makefu/1systems/omo.nix b/makefu/1systems/omo.nix index e11abd40d..ead8f49b6 100644 --- a/makefu/1systems/omo.nix +++ b/makefu/1systems/omo.nix @@ -4,6 +4,7 @@ { config, pkgs, lib, ... }: let + toMapper = id: "/media/crypt${builtins.toString id}"; byid = dev: "/dev/disk/by-id/" + dev; keyFile = byid "usb-Verbatim_STORE_N_GO_070B3CEE0B223954-0:0"; rootDisk = byid "ata-SanDisk_SD8SNAT128G1122_162099420904"; @@ -33,7 +34,8 @@ let # all physical disks # TODO callPackage ../3modules/MonitorDisks { disks = allDisks } - allDisks = [ rootDisk cryptDisk0 cryptDisk1 cryptDisk2 ]; + dataDisks = [ cryptDisk0 cryptDisk1 cryptDisk2 ]; + allDisks = [ rootDisk ] ++ dataDisks; in { imports = [ @@ -73,25 +75,34 @@ in { virtualisation.docker.enable = true; - # HDD Array stuff - environment.systemPackages = [ pkgs.mergerfs ]; services.smartd.devices = builtins.map (x: { device = x; }) allDisks; - makefu.snapraid = let - toMapper = id: "/media/crypt${builtins.toString id}"; - in { + makefu.snapraid = { enable = true; disks = map toMapper [ 0 1 ]; parity = toMapper 2; }; + # TODO create folders in /media + system.activationScripts.createCryptFolders = '' + ${lib.concatMapStringsSep "\n" + (d: "install -m 755 -d " + (toMapper d) ) + [ 0 1 2 "X" ]} + ''; + environment.systemPackages = [ pkgs.mergerfs ]; fileSystems = let cryptMount = name: { "/media/${name}" = { device = "/dev/mapper/${name}"; fsType = "xfs"; };}; in cryptMount "crypt0" // cryptMount "crypt1" - // cryptMount "crypt2"; + // cryptMount "crypt2" + // { "/media/cryptX" = { + device = (lib.concatMapStringsSep ":" (d: (toMapper d)) [ 0 1 2 ]); + fsType = "mergerfs"; + options = [ "defaults" "allow_other" ]; + }; + }; powerManagement.powerUpCommands = lib.concatStrings (map (disk: '' ${pkgs.hdparm}/sbin/hdparm -S 100 ${disk} |