Files
infrastructure/doc/src/anleitung/create.md
kalipso 73893438cb
All checks were successful
Evaluate Hydra Jobs / eval-hydra-jobs (push) Successful in 4m2s
[docs] add vmWithDisko documentation
2024-12-11 11:56:55 +01:00

2.8 KiB

Create host with disko-install

How to use disko-install is described here: https://github.com/nix-community/disko/blob/master/docs/disko-install.md

Here are the exact steps to get bakunin running:
First create machines/hostname/configuration.nix
Add hosts nixosConfiguration in machines/configurations.nix
Boot nixos installer on the Machine.

# establish network connection
wpa_passphrase "network" "password" > wpa.conf
wpa_supplicant -B -i wlp3s0 -c wpa.conf
ping 8.8.8.8
# if that works continue

# generate a base hardware config
nixos-generate-config --root /tmp/config --no-filesystems

# get the infra repo
nix-shell -p git
git clone https://git.dynamicdiscord.de/kalipso/infrastructure
cd infrastructure

# add the new generated hardware config (and import in hosts configuration.nix)
cp /tmp/config/etc/nixos/hardware-configuration.nix machines/bakunin/

# check which harddrive we want to install the system on
lsblk #choose harddrive, in this case /dev/sda

# run nixos-install on that harddrive
sudo nix --extra-experimental-features flakes --extra-experimental-features nix-command run 'github:nix-community/disko/latest#disko-install' -- --flake .#bakunin --disk main /dev/sda

# this failed with out of memory
# running again showed: no disk left on device
# it seems the usb stick i used for flashing is way to small
# it is only 
# with a bigger one (more than 8 gig i guess) it should work
# instead the disko-install tool i try the old method - first partitioning using disko and then installing the system
# for that i needed to adjust ./machines/modules/disko/btrfs-laptop.nix and set the disk to "/dev/sda"

sudo nix --extra-experimental-features "flakes nix-command" run 'github:nix-community/disko/latest' -- --mode format --flake .#bakunin

# failed with no space left on device.
# problem is lots of data is written to the local /nix/store which is mounted on tmpfs in ram
# it seems that a workaround could be modifying the bootable stick to contain a swap partition to extend tmpfs storage

Testing Disko

Testing disko partitioning is working quite well. Just run the following and check the datasets in the vm:

nix run -L .\#nixosConfigurations.fanny.config.system.build.vmWithDisko

Only problem is that encryption is not working, so it needs to be commented out. For testing host fanny the following parts in ./machines/modules/disko/fanny.nix need to be commented out(for both pools!):

datasets = {
  encrypted = {
    options = {
      encryption = "aes-256-gcm"; #THIS ONE
      keyformat = "passphrase"; #THIS ONE
      keylocation = "file:///tmp/root.key"; #THIS ONE
    };
    # use this to read the key during boot
     postCreateHook = '' #THIS ONE 
       zfs set keylocation="prompt" "zroot/$name"; #THIS ONE 
     ''; #THIS ONE