From 98848a9fffc8f4a2f456770654648f04bf92d5e2 Mon Sep 17 00:00:00 2001 From: makefu Date: Sun, 3 Jan 2016 06:07:35 +0100 Subject: ma 1 omo: actually build the host --- makefu/1systems/omo.nix | 48 ++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 40 insertions(+), 8 deletions(-) (limited to 'makefu/1systems/omo.nix') diff --git a/makefu/1systems/omo.nix b/makefu/1systems/omo.nix index 6ae79398a..08923d1c2 100644 --- a/makefu/1systems/omo.nix +++ b/makefu/1systems/omo.nix @@ -6,32 +6,64 @@ { imports = - [ # Include the results of the hardware scan. + [ + # TODO: unlock home partition via ssh ../2configs/fs/single-partition-ext4.nix ../2configs/tinc-basic-retiolum.nix + ../2configs/zsh-user.nix ../2configs/exim-retiolum.nix + ../2configs/smart-monitor.nix ]; krebs.build.host = config.krebs.hosts.omo; + services.smartd.devices = [ + { device = "/dev/sda"; } + { device = "/dev/sdb"; } + { device = "/dev/sdc"; } + { device = "/dev/sdd"; } + { device = "/dev/sde"; } + ]; # AMD E350 + fileSystems."/home" = { + device = "/dev/mapper/home"; + fsType = "ext4"; + }; + powerManagement.powerUpCommands = '' + for i in a b c d e f g h i;do + ${pkgs.hdparm}/sbin/hdparm -S 100 /dev/sd$i + ${pkgs.hdparm}/sbin/hdparm -B 127 /dev/sd$i + ${pkgs.hdparm}/sbin/hdparm -y /dev/sd$i + ''; boot = { - loader.grub.device = "/dev/sda"; + initrd.luks = { + devices = [ + { name = "home"; + device = "/dev/disk/by-uuid/85bff22e-dcbb-4246-b030-faf6c1782995"; + keyFileSize = 4096; + keyFile = "/dev/disk/by-id/usb-Verbatim_STORE_N_GO_070B3CEE0B223954-0:0"; } + ]; + }; + loader.grub.device = "/dev/disk/by-id/ata-INTEL_SSDSA2M080G2GC_CVPO003402PB080BGN"; initrd.availableKernelModules = [ - "usb_storage" "ahci" - "xhci_hcd" - "ata_piix" - "uhci_hcd" + "ohci_pci" "ehci_pci" + "pata_atiixp" + "firewire_ohci" + "usb_storage" + "usbhid" ]; - kernelModules = [ ]; + kernelModules = [ "kvm-amd" ]; extraModulePackages = [ ]; }; + networking.firewall.allowedUDPPorts = [ 655 ]; hardware.enableAllFirmware = true; hardware.cpu.amd.updateMicrocode = true; - networking.firewall.allowPing = true; + #zramSwap.enable = true; + zramSwap.numDevices = 2; + } -- cgit v1.2.3 From 6cb83cd17413be412836041d8235793ff53e66f5 Mon Sep 17 00:00:00 2001 From: makefu Date: Sun, 3 Jan 2016 23:07:55 +0100 Subject: m 1 omo: act as mail client --- makefu/1systems/omo.nix | 1 + 1 file changed, 1 insertion(+) (limited to 'makefu/1systems/omo.nix') diff --git a/makefu/1systems/omo.nix b/makefu/1systems/omo.nix index 08923d1c2..d7d3dba00 100644 --- a/makefu/1systems/omo.nix +++ b/makefu/1systems/omo.nix @@ -13,6 +13,7 @@ ../2configs/zsh-user.nix ../2configs/exim-retiolum.nix ../2configs/smart-monitor.nix + ../2configs/mail-client.nix ]; krebs.build.host = config.krebs.hosts.omo; services.smartd.devices = [ -- cgit v1.2.3 From d73c8df6e4246f34e7a98091bc3c7dab9f90fdde Mon Sep 17 00:00:00 2001 From: makefu Date: Tue, 5 Jan 2016 16:07:13 +0100 Subject: k 5 snapraid: is part of upstream --- makefu/1systems/omo.nix | 49 ++++++++++++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 21 deletions(-) (limited to 'makefu/1systems/omo.nix') diff --git a/makefu/1systems/omo.nix b/makefu/1systems/omo.nix index d7d3dba00..65a25a2a1 100644 --- a/makefu/1systems/omo.nix +++ b/makefu/1systems/omo.nix @@ -2,9 +2,18 @@ # your system. Help is available in the configuration.nix(5) man page # and in the NixOS manual (accessible by running ‘nixos-help’). -{ config, pkgs, ... }: - -{ +{ config, pkgs, lib, ... }: +let + byid = dev: "/dev/disk/by-id/" + dev; + keyFile = "/dev/disk/by-id/usb-Verbatim_STORE_N_GO_070B3CEE0B223954-0:0"; + rootDisk = byid "ata-INTEL_SSDSA2M080G2GC_CVPO003402PB080BGN"; + homePartition = byid "ata-INTEL_SSDSA2M080G2GC_CVPO003402PB080BGN-part3"; + cryptDisk0 = byid "ata-ST2000DM001-1CH164_Z240XTT6"; + cryptDisk1 = byid "ata-TP02000GB_TPW151006050068"; + cryptDisk2 = byid "ata-WDC_WD20EARS-00MVWB0_WD-WCAZA5548487"; + # all physical disks + allDisks = [ rootDisk cryptDisk0 cryptDisk1 cryptDisk2 ]; +in { imports = [ # TODO: unlock home partition via ssh @@ -16,35 +25,33 @@ ../2configs/mail-client.nix ]; krebs.build.host = config.krebs.hosts.omo; - services.smartd.devices = [ - { device = "/dev/sda"; } - { device = "/dev/sdb"; } - { device = "/dev/sdc"; } - { device = "/dev/sdd"; } - { device = "/dev/sde"; } - ]; + services.smartd.devices = builtins.map (x: { device = x; }) allDisks; # AMD E350 fileSystems."/home" = { device = "/dev/mapper/home"; fsType = "ext4"; }; - powerManagement.powerUpCommands = '' - for i in a b c d e f g h i;do - ${pkgs.hdparm}/sbin/hdparm -S 100 /dev/sd$i - ${pkgs.hdparm}/sbin/hdparm -B 127 /dev/sd$i - ${pkgs.hdparm}/sbin/hdparm -y /dev/sd$i - ''; + powerManagement.powerUpCommands = lib.concatStrings (map (disk: '' + ${pkgs.hdparm}/sbin/hdparm -S 100 ${disk} + ${pkgs.hdparm}/sbin/hdparm -B 127 ${disk} + ${pkgs.hdparm}/sbin/hdparm -y ${disk} + '') allDisks); boot = { initrd.luks = { - devices = [ - { name = "home"; - device = "/dev/disk/by-uuid/85bff22e-dcbb-4246-b030-faf6c1782995"; + devices = let + usbkey = name: device: { + inherit name device keyFile; keyFileSize = 4096; - keyFile = "/dev/disk/by-id/usb-Verbatim_STORE_N_GO_070B3CEE0B223954-0:0"; } + }; + in [ + (usbkey "home" homePartition) + (usbkey "crypt0" cryptDisk0) + (usbkey "crypt1" cryptDisk1) + (usbkey "crypt2" cryptDisk2) ]; }; - loader.grub.device = "/dev/disk/by-id/ata-INTEL_SSDSA2M080G2GC_CVPO003402PB080BGN"; + loader.grub.device = rootDisk; initrd.availableKernelModules = [ "ahci" -- cgit v1.2.3 From 719b8fb7a8b9b4992200c222b37bd9a6744c25ec Mon Sep 17 00:00:00 2001 From: makefu Date: Tue, 5 Jan 2016 16:21:01 +0100 Subject: ma 3 snapraid: init, configuration for omo --- makefu/1systems/omo.nix | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) (limited to 'makefu/1systems/omo.nix') diff --git a/makefu/1systems/omo.nix b/makefu/1systems/omo.nix index 65a25a2a1..e19205a95 100644 --- a/makefu/1systems/omo.nix +++ b/makefu/1systems/omo.nix @@ -8,6 +8,10 @@ let keyFile = "/dev/disk/by-id/usb-Verbatim_STORE_N_GO_070B3CEE0B223954-0:0"; rootDisk = byid "ata-INTEL_SSDSA2M080G2GC_CVPO003402PB080BGN"; homePartition = byid "ata-INTEL_SSDSA2M080G2GC_CVPO003402PB080BGN-part3"; + # cryptsetup luksFormat $dev --cipher aes-xts-plain64 -s 512 -h sha512 + # cryptsetup luksAddKey $dev tmpkey + # cryptsetup luksOpen $dev crypt0 + # mkfs.xfs /dev/mapper/crypt0 -L crypt0 cryptDisk0 = byid "ata-ST2000DM001-1CH164_Z240XTT6"; cryptDisk1 = byid "ata-TP02000GB_TPW151006050068"; cryptDisk2 = byid "ata-WDC_WD20EARS-00MVWB0_WD-WCAZA5548487"; @@ -23,15 +27,30 @@ in { ../2configs/exim-retiolum.nix ../2configs/smart-monitor.nix ../2configs/mail-client.nix + ../3modules ]; krebs.build.host = config.krebs.hosts.omo; services.smartd.devices = builtins.map (x: { device = x; }) allDisks; - - # AMD E350 - fileSystems."/home" = { - device = "/dev/mapper/home"; - fsType = "ext4"; + makefu.snapraid = let + toMapper = id: "/media/crypt${builtins.toString id}"; + in { + enable = true; + disks = map toMapper [ 0 1 ]; + parity = toMapper 2; }; + # AMD E350 + fileSystems = let + cryptMount = name: + { "/media/${name}" = { device = "/dev/mapper/${name}"; fsType = "xfs"; };}; + in { + "/home" = { + device = "/dev/mapper/home"; + fsType = "ext4"; + }; + } // cryptMount "crypt0" + // cryptMount "crypt1" + // cryptMount "crypt2"; + powerManagement.powerUpCommands = lib.concatStrings (map (disk: '' ${pkgs.hdparm}/sbin/hdparm -S 100 ${disk} ${pkgs.hdparm}/sbin/hdparm -B 127 ${disk} -- cgit v1.2.3 [cgit] Unable to lock slot /tmp/cgit/15100000.lock: No such file or directory (2)