From 732d92c7e7925deb01ad5582b16d8a04f5f15ca1 Mon Sep 17 00:00:00 2001 From: Jordan Holt Date: Mon, 1 Jan 2024 22:50:31 +0000 Subject: [PATCH] Add disko config for hypnos --- hosts/hypnos/README.md | 2 +- hosts/hypnos/disko-config.nix | 123 ++++++++++++++++++++++++++++++++++ 2 files changed, 124 insertions(+), 1 deletion(-) create mode 100644 hosts/hypnos/disko-config.nix diff --git a/hosts/hypnos/README.md b/hosts/hypnos/README.md index 772e58f..01134a7 100644 --- a/hosts/hypnos/README.md +++ b/hosts/hypnos/README.md @@ -13,7 +13,7 @@ ### Disks Device | Partitions _(filesystem, size, usage)_ --- | --- -Apple SSD SM0512F | `/dev/nvme01` (ZFS, 500 GiB, NixOS Root) +Apple SSD SM0512F | `/dev/sda1` (EFI, 256 MiB, NixOS Boot)
`/dev/sda2` (ZFS, 500 GiB, NixOS Root) #### ZFS pool layout ``` diff --git a/hosts/hypnos/disko-config.nix b/hosts/hypnos/disko-config.nix new file mode 100644 index 0000000..9780e65 --- /dev/null +++ b/hosts/hypnos/disko-config.nix @@ -0,0 +1,123 @@ +{ + disko.devices = { + disk = { + main = { + type = "disk"; + device = "/dev/disk/by-id/ata-APPLE_SSD_SM0512F_S1K5NYBF736152"; + content = { + type = "gpt"; + partitions = { + ESP = { + size = "256M"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + }; + }; + zfs = { + size = "100%"; + content = { + type = "zfs"; + pool = "rpool"; + }; + }; + }; + }; + }; + }; + zpool = { + rpool = { + type = "zpool"; + options = { + ashift = "12"; + }; + rootFsOptions = { + canmount = "off"; + mountpoint = "none"; + dnodesize = "auto"; + xattr = "sa"; + }; + mountpoint = "/"; + postCreateHook = "zfs snapshot zroot@blank"; + datasets = { + local = { + options = { + mountpoint = "none"; + }; + }; + "local/nix" = { + mountpoint = "/nix"; + options = { + atime = "off"; + mountpoint = "legacy"; + }; + }; + "local/tmp" = { + mountpoint = "/tmp"; + options = { + setuid = "off"; + devices = "off"; + mountpoint = "legacy"; + }; + }; + system = { + options = { + mountpoint = "none"; + encryption = "aes-256-gcm"; + keyformat = "passphrase"; + keylocation = "file:///tmp/secret.key"; + }; + # use this to read the key during boot + postCreateHook = '' + zfs set keylocation="prompt" "rpool/$name"; + ''; + }; + "system/var" = { + mountpoint = "/var"; + options = { + mountpoint = "legacy"; + }; + }; + "system/var/tmp" = { + mountpoint = "/var/tmp"; + options = { + devices = "off"; + mountpoint = "legacy"; + }; + }; + "system/var/log" = { + mountpoint = "/var/log"; + options = { + compression = "on"; + acltype = "posix"; + mountpoint = "legacy"; + }; + }; + user = { + options = { + mountpoint = "none"; + encryption = "aes-256-gcm"; + keyformat = "passphrase"; + keylocation = "file:///tmp/secret.key"; + }; + # use this to read the key during boot + postCreateHook = '' + zfs set keylocation="prompt" "rpool/$name"; + ''; + }; + "user/home" = { + mountpoint = "/home"; + options = { + setuid = "off"; + devices = "off"; + mountpoint = "legacy"; + }; + }; + }; + }; + }; + }; +} +