From 665bd1d1f4062d10dfac1e7038dd45b22d29beb5 Mon Sep 17 00:00:00 2001 From: Henrik Date: Wed, 15 Oct 2025 20:34:14 +0200 Subject: [PATCH] updated disko setup --- nix/configuration.nix | 6 ++++- nix/disko.nix | 27 ++++++++++++---------- nix/hardware-configuration.nix | 17 -------------- nix/vps/hetzner/aarch64.nix | 11 +++++++++ nix/vps/hetzner/hardware-configuration.nix | 10 ++++++++ 5 files changed, 41 insertions(+), 30 deletions(-) delete mode 100644 nix/hardware-configuration.nix create mode 100644 nix/vps/hetzner/aarch64.nix create mode 100644 nix/vps/hetzner/hardware-configuration.nix diff --git a/nix/configuration.nix b/nix/configuration.nix index 4357b1e..4f346c1 100644 --- a/nix/configuration.nix +++ b/nix/configuration.nix @@ -4,7 +4,7 @@ imports = [ ./users/users.nix ./modules/ssh.nix - ./hardware-configuration.nix + ./vps/hetzner/hardware-configuration.nix ./modules/zsh.nix ]; @@ -14,6 +14,10 @@ # Bootloader. boot.loader.grub.enable = true; + + boot.initrd.kernelModules = [ "virtio_gpu" ]; + boot.kernelParams = [ "console=tty" ]; + networking.hostName = "matrix"; # time zone diff --git a/nix/disko.nix b/nix/disko.nix index 1031611..cddefa0 100644 --- a/nix/disko.nix +++ b/nix/disko.nix @@ -1,4 +1,4 @@ - +# other examples, see https://github.com/nix-community/disko/blob/master/example/ { disko.devices = { disk = { @@ -8,26 +8,29 @@ content = { type = "gpt"; partitions = { - boot = { - size = "1M"; - type = "EF02"; - priority = 1; - }; ESP = { - size = "512M"; + size = "500M"; type = "EF00"; content = { type = "filesystem"; format = "vfat"; mountpoint = "/boot"; + mountOptions = [ "umask=0077" ]; }; }; - root = { + luks = { size = "100%"; content = { - type = "filesystem"; - format = "ext4"; - mountpoint = "/"; + type = "luks"; + name = "crypted"; + settings.allowDiscards = true; # Enable SSD TRIM support + passwordFile = "/tmp/secret.key"; # install time key file location + # additionalKeyFiles = [ "/tmp/additionalSecret.key" ]; + content = { + type = "filesystem"; + format = "ext4"; + mountpoint = "/"; + }; }; }; }; @@ -35,4 +38,4 @@ }; }; }; -} +} \ No newline at end of file diff --git a/nix/hardware-configuration.nix b/nix/hardware-configuration.nix deleted file mode 100644 index 3245a75..0000000 --- a/nix/hardware-configuration.nix +++ /dev/null @@ -1,17 +0,0 @@ -{ config, lib, pkgs, modulesPath, ... }: - -{ - imports = [ - (modulesPath + "/profiles/qemu-guest.nix") - ]; - - boot.initrd.availableKernelModules = [ "ata_piix" "virtio_pci" "virtio_blk" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ ]; - boot.extraModulePackages = [ ]; - - networking.useDHCP = lib.mkDefault true; - - # aarch64-linux? - nixpkgs.hostPlatform = lib.mkDefault "aarch64-linux"; -} \ No newline at end of file diff --git a/nix/vps/hetzner/aarch64.nix b/nix/vps/hetzner/aarch64.nix new file mode 100644 index 0000000..25231cd --- /dev/null +++ b/nix/vps/hetzner/aarch64.nix @@ -0,0 +1,11 @@ +{ config, lib, ... }: + +{ + # Specific settings for Hetzner Cloud AArch64 instances + # https://wiki.nixos.org/wiki/Install_NixOS_on_Hetzner_Cloud#AArch64_(CAX_instance_type)_specifics + boot.initrd.kernelModules = [ "virtio_gpu" ]; + boot.kernelParams = [ "console=tty" ]; + + # aarch64-linux + nixpkgs.hostPlatform = lib.mkDefault "aarch64-linux"; +} \ No newline at end of file diff --git a/nix/vps/hetzner/hardware-configuration.nix b/nix/vps/hetzner/hardware-configuration.nix new file mode 100644 index 0000000..480f133 --- /dev/null +++ b/nix/vps/hetzner/hardware-configuration.nix @@ -0,0 +1,10 @@ +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = [ + (modulesPath + "/profiles/qemu-guest.nix") + ./aarch64.nix + ]; + + networking.useDHCP = lib.mkDefault true; +} \ No newline at end of file