diff --git a/README.md b/README.md index da0ddff..d0e12b9 100644 --- a/README.md +++ b/README.md @@ -119,6 +119,7 @@ $ inv setup-secret --hosts buildXX ```console $ nixos-generate-config --root /tmp +# optional, in most cases one can roles/hardware/hetzner-amd.nix $ scp buildXX.nix-community.org:/tmp/etc/nixos/hardware-configuration.nix buildXX/hardware-configuration.nix ``` diff --git a/build01/configuration.nix b/build01/configuration.nix index f461d55..68738e4 100644 --- a/build01/configuration.nix +++ b/build01/configuration.nix @@ -11,11 +11,10 @@ # nixos-enter { imports = [ - ./hardware-configuration.nix - ../roles/dev-packages.nix ../roles/clone-nixpkgs.nix ../roles/common.nix + ../roles/hardware/hetzner-amd.nix ../roles/hetzner-network.nix ../roles/raid.nix ../roles/builder diff --git a/build01/hardware-configuration.nix b/build01/hardware-configuration.nix deleted file mode 100644 index be2dd51..0000000 --- a/build01/hardware-configuration.nix +++ /dev/null @@ -1,26 +0,0 @@ -# Do not modify this file! It was generated by ‘nixos-generate-config’ -# and may be overwritten by future invocations. Please make changes -# to /etc/nixos/configuration.nix instead. -{ config, lib, pkgs, modulesPath, ... }: - -{ - imports = [ "${modulesPath}/installer/scan/not-detected.nix" ]; - - boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "sd_mod" ]; - boot.kernelModules = [ "kvm-amd" ]; - - fileSystems."/" = { - device = "zroot/root/nixos"; - fsType = "zfs"; - }; - - fileSystems."/home" = { - device = "zroot/root/home"; - fsType = "zfs"; - }; - - fileSystems."/boot" = { - device = "/dev/disk/by-uuid/6b1b00a5-2d03-4a33-ac59-c8031e543c66"; - fsType = "ext4"; - }; -} diff --git a/build02/configuration.nix b/build02/configuration.nix index b80404a..38a5f08 100644 --- a/build02/configuration.nix +++ b/build02/configuration.nix @@ -2,11 +2,9 @@ { imports = [ - ./hardware-configuration.nix - ./nixpkgs-update.nix - ../roles/common.nix + ../roles/hardware/hetzner-amd.nix ../roles/hetzner-network.nix ../roles/hercules-ci ../roles/nginx.nix diff --git a/build02/hardware-configuration.nix b/build02/hardware-configuration.nix deleted file mode 100644 index e7e25a0..0000000 --- a/build02/hardware-configuration.nix +++ /dev/null @@ -1,30 +0,0 @@ -# Do not modify this file! It was generated by ‘nixos-generate-config’ -# and may be overwritten by future invocations. Please make changes -# to /etc/nixos/configuration.nix instead. -{ config, lib, pkgs, modulesPath, ... }: - -{ - imports = - [ (modulesPath + "/installer/scan/not-detected.nix") - ]; - - boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ "kvm-amd" ]; - boot.extraModulePackages = [ ]; - - fileSystems."/" = - { device = "zroot/root/nixos"; - fsType = "zfs"; - }; - - fileSystems."/home" = - { device = "zroot/root/home"; - fsType = "zfs"; - }; - - fileSystems."/boot" = - { device = "/dev/disk/by-uuid/38c6201e-5686-4984-bca1-45b606ecdde8"; - fsType = "ext4"; - }; -} diff --git a/build03/configuration.nix b/build03/configuration.nix index 9e2e33c..a51316e 100644 --- a/build03/configuration.nix +++ b/build03/configuration.nix @@ -10,10 +10,9 @@ # $ zpool import -f zroot && mount -t zfs zroot/root/nixos /mnt && mount -t zfs zroot/root/home /mnt/home && mount /dev/md[0-9]* /mnt/boot # $ nixos-enter imports = [ - ./hardware-configuration.nix - ../roles/buildkite.nix ../roles/common.nix + ../roles/hardware/hetzner-amd.nix ../roles/hercules-ci ../roles/hetzner-network.nix ../roles/nginx.nix diff --git a/build03/hardware-configuration.nix b/build03/hardware-configuration.nix deleted file mode 100644 index 77e3eca..0000000 --- a/build03/hardware-configuration.nix +++ /dev/null @@ -1,33 +0,0 @@ -# Do not modify this file! It was generated by ‘nixos-generate-config’ -# and may be overwritten by future invocations. Please make changes -# to /etc/nixos/configuration.nix instead. -{ config, lib, pkgs, modulesPath, ... }: - -{ - imports = - [ (modulesPath + "/installer/scan/not-detected.nix") - ]; - - boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ "kvm-amd" ]; - boot.extraModulePackages = [ ]; - - fileSystems."/" = - { device = "zroot/root/nixos"; - fsType = "zfs"; - }; - - fileSystems."/home" = - { device = "zroot/root/home"; - fsType = "zfs"; - }; - - fileSystems."/boot" = - { device = "/dev/disk/by-uuid/0d4f251e-2d79-4769-85a3-4c56e757d545"; - fsType = "ext4"; - }; - - swapDevices = [ ]; - -} diff --git a/roles/hardware/hetzner-amd.nix b/roles/hardware/hetzner-amd.nix new file mode 100644 index 0000000..1e54571 --- /dev/null +++ b/roles/hardware/hetzner-amd.nix @@ -0,0 +1,38 @@ +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = [ + "${modulesPath}/installer/scan/not-detected.nix" + ]; + + boot.initrd.availableKernelModules = [ + "xhci_pci" + "ahci" + # SATA ssd (only build01) + "sd_mod" + # NVME + "nvme" + ]; + boot.kernelModules = [ + "kvm-amd" + ]; + + fileSystems."/" = { + device = "zroot/root/nixos"; + fsType = "zfs"; + }; + + fileSystems."/home" = { + device = "zroot/root/home"; + fsType = "zfs"; + # We don't want servers to go in systemd rescue mode, but rather having + # failed mounts show up in monitoring + options = [ "nofail" ]; + }; + + fileSystems."/boot" = { + device = "/dev/md127"; + fsType = "ext4"; + options = [ "nofail" ]; + }; +}