about summary refs log tree commit diff
path: root/machines/profpatsch/mikiya.nix
diff options
context:
space:
mode:
authorProfpatsch <mail@profpatsch.de>2018-05-23 15:10:50 +0200
committerProfpatsch <mail@profpatsch.de>2018-05-23 15:11:30 +0200
commitad57deb1314d71a08dbdea487de488583220758c (patch)
treeae8720e3b186eb839669b6bd797e4ea1f0c0bf10 /machines/profpatsch/mikiya.nix
parent4516ffff69d52356615a2123751fd8d226bcef40 (diff)
machines/profpatsch: add mikiya
Diffstat (limited to 'machines/profpatsch/mikiya.nix')
-rw-r--r--machines/profpatsch/mikiya.nix68
1 files changed, 68 insertions, 0 deletions
diff --git a/machines/profpatsch/mikiya.nix b/machines/profpatsch/mikiya.nix
new file mode 100644
index 00000000..d0a4c267
--- /dev/null
+++ b/machines/profpatsch/mikiya.nix
@@ -0,0 +1,68 @@
+{ config, lib, pkgs, ... }:
+
+let
+  myLib  = import ./lib.nix  { inherit pkgs lib; };
+  myPkgs = import ./pkgs.nix { inherit pkgs lib myLib; };
+
+  mkDevice = category: num: uuid: {
+    name = "mikiya-${category}-crypt-${toString num}";
+    device = "/dev/disk/by-uuid/${uuid}";
+    keyFile = "/root/raid.key";
+  };
+
+  systemDevice = "/dev/disk/by-id/ata-MKNSSDCR60GB-DX_MKN1140A0000025162";
+  systemPartition = {
+    name = "mikiya-root";
+    device = "/dev/disk/by-uuid/56910867-ed83-438a-b67c-c057e662c89e";
+  };
+
+  raidDevices = lib.imap (mkDevice "raid") [
+    "f0069e04-d058-40b3-8f13-92f11c4c2546"
+  ];
+
+
+
+in {
+  imports = [ ./base-server.nix ];
+
+  config = {
+
+    vuizvui.user.profpatsch.server.sshPort = 22;
+    boot = {
+      loader.grub.device = systemDevice;
+      initrd = {
+        network = {
+          enable = true;
+          ssh.enable = true;
+          ssh.authorizedKeys = myLib.authKeys;
+        };
+
+        # decrypt root device
+        luks.devices = [systemPartition];
+      };
+    };
+
+    fileSystems."/" = {
+      device = "/dev/mapper/mikiya-root";
+      fsType = "ext4";
+      options = [ "ssd" ];
+    };
+
+    /*
+    # decrypt RAID with key from root
+    environment.etc.crypttab.text =
+      let luksDevice = dev: "${dev.name} ${dev.device} ${dev.keyFile} luks";
+      in concatMapStringsSep "\n" luksDevice raidDevices;
+
+    powerManagement = {
+      # spin down raid drives after 30 minutes
+      powerUpCommand =
+        let driveStandby = drive: "${pkgs.hdparm}/sbin/hdparm -S 241 ${drive.device}";
+        in concatMapStringsSep "\n" driveStandby raidDevices;
+    */
+
+    users.users = { inherit (myLib) philip; };
+
+  };
+
+}