From 680380e7075b04353e48fbfce8932939d8974d3b Mon Sep 17 00:00:00 2001 From: Thomas Boerger Date: Mon, 14 Nov 2022 22:12:19 +0100 Subject: [PATCH] fix: hopefully last try for niflheim --- README.md | 29 ++++++++++++++++++++++ machines/niflheim/filesystems.nix | 7 ++---- scripts/niflheim-partitions | 41 ++++++++++++++----------------- 3 files changed, 49 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index d7fb4a8..0bee55d 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,35 @@ nixos-rebuild switch \ --flake github:tboerger/nixos-config#chnum ``` +## Niflheim + +### Bootstrap + +Copy `/etc/ssh/ssh_host_ed25519_key.pub` into [secrets](./secrets/secrets.nix) +and rekey the secrets via [agenix][agenix]. After pushing the rekeyed secrets +execute these commands: + +```console +sudo loadkeys de +sudo nix-shell --packages nixUnstable + +bash -c "$(curl -fsSL https://raw.githubusercontent.com/tboerger/nixos-config/master/scripts/niflheim-partitions)" + +mkdir -p /mnt/etc/ssh +cp /etc/ssh/ssh_host_* /mnt/etc/ssh/ +nixos-install --no-root-password --root /mnt --flake github:tboerger/nixos-config#niflheim +``` + +### Updates + +If the repository had been cloned you could just execute `make switch`, +otherwise there is still this long option to update the deployment: + +```console +nixos-rebuild switch \ + --flake github:tboerger/nixos-config#niflheim +``` + ## Asgard ### Bootstrap diff --git a/machines/niflheim/filesystems.nix b/machines/niflheim/filesystems.nix index 9f6fa0b..9210c76 100644 --- a/machines/niflheim/filesystems.nix +++ b/machines/niflheim/filesystems.nix @@ -30,10 +30,7 @@ }; fileSystems."/boot" = { - device = "/dev/disk/by-label/boot"; - fsType = "ext4"; - options = [ - "noatime" - ]; + device = "/dev/disk/by-label/boot1"; + fsType = "vfat"; }; } diff --git a/scripts/niflheim-partitions b/scripts/niflheim-partitions index 4ca1ee7..8453dd5 100755 --- a/scripts/niflheim-partitions +++ b/scripts/niflheim-partitions @@ -49,18 +49,20 @@ sync echo "-----> Create sda partitions" parted -a opt --script /dev/disk/by-path/pci-0000:00:1f.2-ata-1.0 \ mklabel gpt \ - mkpart non-fs 0 2 \ - mkpart primary 2 100% \ - set 1 bios_grub on \ + mkpart primary fat32 0% 1GiB \ + mkpart primary 1GiB 100% \ + set 1 esp on \ + name 1 boot1 \ set 2 lvm on \ name 2 tank1 echo "-----> Create sdb partitions" parted -a opt --script /dev/disk/by-path/pci-0000:00:1f.2-ata-2.0 \ mklabel gpt \ - mkpart non-fs 0 2 \ - mkpart primary 2 100% \ - set 1 bios_grub on \ + mkpart primary fat32 0% 1GiB \ + mkpart primary 1GiB 100% \ + set 1 esp on \ + name 1 boot2 \ set 2 lvm on \ name 2 tank2 @@ -70,20 +72,16 @@ echo yes | mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/disk/by-partl # echo "-----> Create sdc partitions" # parted -a opt --script /dev/disk/by-path/pci-0000:00:1f.2-ata-3.0 \ # mklabel gpt \ -# mkpart primary 0 2 \ -# mkpart primary 2 100% \ -# set 1 bios_grub on \ -# set 2 lvm on \ -# name 2 tank3 +# mkpart primary 0 100% \ +# set 1 lvm on \ +# name 1 tank3 # echo "-----> Create sdd partitions" # parted -a opt --script /dev/disk/by-path/pci-0000:00:1f.2-ata-4.0 \ # mklabel gpt \ -# mkpart primary 0 2 \ -# mkpart primary 2 100% \ -# set 1 bios_grub on \ -# set 2 lvm on \ -# name 2 tank4 +# mkpart primary 0 100% \ +# set 1 lvm on \ +# name 1 tank4 # echo "-----> Create raid2 volume" # echo yes | mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/disk/by-partlabel/tank3 /dev/disk/by-partlabel/tank4 @@ -102,17 +100,14 @@ echo "-----> Create swap volume" lvcreate -y --size $(cat /proc/meminfo | grep MemTotal | cut -d':' -f2 | sed 's/ //g') --name swap system echo "-----> Create root volume" -lvcreate -y --size 1G --name root system +lvcreate -y --size 10G --name root system echo "-----> Create nix volume" -lvcreate -y --size 50G --name nix system +lvcreate -y --size 45G --name nix system echo "-----> Create home volume" lvcreate -y --size 1G --name home system -echo "-----> Create boot volume" -lvcreate -y --size 1G --name boot system - echo "-----> Enable swap partition" mkswap -L swap /dev/system/swap swapon /dev/system/swap @@ -139,8 +134,8 @@ mkdir -p /mnt/home mount -t ext4 /dev/system/home /mnt/home echo "-----> Create boot filesystem" -mkfs.vfat -F32 -n boot /dev/system/boot +mkfs.vfat -F32 -n boot1 /dev/disk/by-partlabel/boot1 echo "-----> Mount boot filesystem" mkdir -p /mnt/boot -mount /dev/system/boot /mnt/boot +mount /dev/disk/by-label/boot1 /mnt/boot