diff --git a/configuration.nix b/configuration.nix index 386fb0c..56d4c1e 100644 --- a/configuration.nix +++ b/configuration.nix @@ -7,7 +7,6 @@ { imports = [ (modulesPath + "/installer/scan/not-detected.nix") - (modulesPath + "/profiles/qemu-guest.nix") ./disk-config.nix ]; boot.loader.grub = { @@ -24,8 +23,14 @@ ]; users.users.root.openssh.authorizedKeys.keys = [ - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHDuOIycRP7Ney136ro/doWj1kttJUqmbGz6OC2nia09 michael.huebner@ptspaper.de" + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHDuOIycRP7Ney136ro/doWj1kttJUqmbGz6OC2nia09 michael.huebner@ptspaper.de" ]; + # # even though we have raid 1, we only boot from the first disk with the zfs setup + # boot.loader.grub.devices = [ "/dev/nvme0n1" ]; + # # this was generated with `head -c4 /dev/urandom | od -A none -t x4` + # networking.hostId = "32fd1c31"; + + system.stateVersion = "24.05"; } diff --git a/disk-config.nix b/disk-config.nix index ff93a4e..3b1afdc 100644 --- a/disk-config.nix +++ b/disk-config.nix @@ -1,4 +1,3 @@ -# Example to create a bios compatible gpt partition { disko.devices = { disk = { @@ -8,21 +7,19 @@ content = { type = "gpt"; partitions = { - ESP = { - size = "1024M"; + boot = { + size = "500M"; type = "EF00"; content = { - type = "filesystem"; - format = "vfat"; - mountpoint = "/boot"; - mountOptions = [ "umask=0077" ]; + type = "mdraid"; + name = "boot"; }; }; - zfs = { + primary = { size = "100%"; content = { - type = "zfs"; - pool = "zroot"; + type = "lvm_pv"; + vg = "pool"; }; }; }; @@ -34,38 +31,56 @@ content = { type = "gpt"; partitions = { - zfs = { + boot = { + size = "500M"; + type = "EF00"; + content = { + type = "mdraid"; + name = "boot"; + }; + }; + primary = { size = "100%"; content = { - type = "zfs"; - pool = "zroot"; + type = "lvm_pv"; + vg = "pool"; }; }; }; }; }; }; - zpool = { - zroot = { - type = "zpool"; - mode = "mirror"; - # Workaround: cannot import 'zroot': I/O error in disko tests - options.cachefile = "none"; - rootFsOptions = { - compression = "zstd"; - "com.sun:auto-snapshot" = "true"; + mdadm = { + boot = { + type = "mdadm"; + level = 1; + metadata = "1.0"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + mountOptions = [ "umask=0077" ]; }; - mountpoint = "/"; - postCreateHook = "zfs list -t snapshot -H -o name | grep -E '^zroot@blank$' || zfs snapshot zroot@blank"; - - datasets = { - zfs_fs = { - type = "zfs_fs"; - mountpoint = "/zfs_fs"; + }; + }; + lvm_vg = { + pool = { + type = "lvm_vg"; + lvs = { + root = { + size = "100%"; + lvm_type = "mirror"; + content = { + type = "filesystem"; + format = "ext4"; + mountpoint = "/"; + mountOptions = [ + "defaults" + ]; + }; }; }; }; }; }; -} - +} \ No newline at end of file