diff --git a/hosts/hyp-01/default.nix b/hosts/hyp-01/default.nix index fb4ed38..2993340 100644 --- a/hosts/hyp-01/default.nix +++ b/hosts/hyp-01/default.nix @@ -5,7 +5,6 @@ { networking.hostName = "hyp-01"; networking.hostId = "ae2c05d3"; - nixpkgs.hostPlatform = "x86_64-linux"; imports = [ inputs.disko.nixosModules.disko diff --git a/hosts/hyp-01/modules/boot.nix b/hosts/hyp-01/modules/boot.nix index a4caca0..fa3aaf9 100644 --- a/hosts/hyp-01/modules/boot.nix +++ b/hosts/hyp-01/modules/boot.nix @@ -3,5 +3,6 @@ boot.loader.systemd-boot.enable = false; boot.loader.grub = { enable = true; + efiSupport = false; }; } diff --git a/hosts/hyp-01/modules/disko.nix b/hosts/hyp-01/modules/disko.nix index b0c9455..3962c3a 100644 --- a/hosts/hyp-01/modules/disko.nix +++ b/hosts/hyp-01/modules/disko.nix @@ -9,82 +9,60 @@ in type = "disk"; device = disk1; content = { - type = "gpt"; - efiGptPartitionFirst = false; - partitions = { - boot = { - priority = 1; - type = "EF02"; - size = "32M"; - content = { - type = "filesystem"; - format = "vfat"; - mountpoint = null; - }; - hybrid = { - mbrPartitionType = "0x0c"; - mbrBootableFlag = false; - }; - }; - esp = { + type = "table"; + format = "mbr"; + partitions = [ + { + name = "boot-primary"; size = "1G"; - type = "EF00"; + bootable = true; + type = "EF02"; content = { type = "filesystem"; format = "vfat"; mountpoint = "/boot"; mountOptions = [ "nofail" ]; }; - }; - zfs = { + } + { + name = "zfs-a"; size = "100%"; content = { type = "zfs"; pool = "zroot"; }; - }; - }; + } + ]; }; }; disk2 = { type = "disk"; device = disk2; content = { - type = "gpt"; - efiGptPartitionFirst = false; - partitions = { - boot = { - priority = 1; - type = "EF02"; - size = "32M"; - content = { - type = "filesystem"; - format = "vfat"; - mountpoint = null; - }; - hybrid = { - mbrPartitionType = "0x0c"; - mbrBootableFlag = false; - }; - }; - esp = { + type = "table"; + format = "mbr"; + partitions = [ + { + name = "boot-secondary"; size = "1G"; - type = "EF00"; + bootable = true; + type = "EF02"; content = { type = "filesystem"; format = "vfat"; mountpoint = "/boot-fallback"; mountOptions = [ "nofail" ]; }; - }; - zfs = { + } + { + name = "zfs-b"; size = "100%"; content = { type = "zfs"; pool = "zroot"; }; - }; - }; + } + ]; }; }; }; @@ -126,14 +104,8 @@ in boot.loader.grub = { device = disk1; - version = 2; - zfsSupport = true; - efiSupport = true; + mirroredBoots = [ - { - devices = [ disk1 ]; - path = "/boot"; - } { devices = [ disk2 ]; path = "/boot-fallback"; diff --git a/hosts/hyp-01/modules/impermanence.nix b/hosts/hyp-01/modules/impermanence.nix index fa4ec52..2d50d54 100644 --- a/hosts/hyp-01/modules/impermanence.nix +++ b/hosts/hyp-01/modules/impermanence.nix @@ -1,5 +1,7 @@ +{ lib, ... }: { boot.initrd.systemd.enable = true; + boot.initrd.postDeviceCommands = lib.mkAfter "zfs mount -a"; fileSystems."/" = { device = "none"; @@ -11,14 +13,10 @@ ]; }; - fileSystems."/persist".neededForBoot = true; - environment.persistence."/persist" = { directories = [ "/etc/nixos" - "/etc/secrets" "/var/log" - "/var/lib/nixos" ]; files = [ "/etc/machine-id" diff --git a/hosts/hyp-01/modules/networking.nix b/hosts/hyp-01/modules/networking.nix index b90b3a6..ecfd10e 100644 --- a/hosts/hyp-01/modules/networking.nix +++ b/hosts/hyp-01/modules/networking.nix @@ -1,9 +1,4 @@ -{ - config, - lib, - pkgs, - ... -}: +{ config, lib, ... }: { options = { networking.hyp-01.ipv4.address = lib.mkOption { @@ -45,36 +40,12 @@ systemd.network.networks."10-uplink".networkConfig.Address = config.networking.hyp-01.ipv6.address; - boot.kernelParams = [ "ip=dhcp" ]; - boot.initrd = { - availableKernelModules = [ "e1000e" ]; + boot.initrd.systemd.network.networks."10-uplink" = config.systemd.networks."10-uplink"; - systemd = - let - askPass = pkgs.writeShellScriptBin "zfs-askpass" '' - systemd-tty-ask-password-agent --watch - ''; - in - { - enable = true; - storePaths = [ "${askPass}/bin/zfs-askpass" ]; - users.root.shell = "${askPass}/bin/zfs-askpass"; - }; - - network = { - enable = true; - - ssh = { - enable = true; - port = 2222; - authorizedKeys = [ - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPnthKtz0fE4yQ/X10cJgKVCjYCNkRNoqV28xAhD7h2M cardno:22_498_026" - ]; - hostKeys = [ - "/etc/secrets/initrd/ssh_host_ed25519_key" - ]; - }; - }; + boot.initrd.network = { + enable = true; }; + + boot.initrd.kernelModules = [ "igb" ]; }; } diff --git a/hosts/hyp-01/modules/users.nix b/hosts/hyp-01/modules/users.nix index 5a142c6..ac65bda 100644 --- a/hosts/hyp-01/modules/users.nix +++ b/hosts/hyp-01/modules/users.nix @@ -17,6 +17,4 @@ in ]; openssh.authorizedKeys.keys = [ sshKey ]; }; - - programs.zsh.enable = true; }