- Clone this repo and move in it:
git clone https://github.com/TGuimbert/dotfiles.git
cd dotfiles
- Run disko command to format the disk(s)
NEW_HOSTNAME=<hostname>
sudo nix --experimental-features "nix-command flakes" run github:nix-community/disko -- --mode disko ./systems/x86_64-linux/$NEW_HOSTNAME/disks.nix
- Add a password for the main user with:
sudo -s
mkpasswd -s > /mnt/persistent/tguimbert-password
exit
- Disable lanzaboote setup and enable systemd boot:
nano systems/x86_64-linux/$NEW_HOSTNAME/default.nix
- Install NixOS:
sudo nixos-install --no-root-password --flake ./#$NEW_HOSTNAME
After the reboot
- Check that
UEFI
andsystemd-boot
are used and thatSecure Boot
is disabled:
bootctl status
- Enable secure boot in the config and rebuild:
sudo nixos-rebuild switch --flake .
- Create secure boot keys:
sudo sbctl create-keys
- Sign the created keys by rebuilding:
sudo nixos-rebuild switch --flake .
- Verify that everything is good (only bzImage.efi should not be signed):
sudo sbctl verify
- Reboot and enable Secure Boot and its setup in the BIOS menu
- Enroll the keys in the BIOS:
sudo sbctl enroll-keys --microsoft
- Reboot
- Check the everything is good:
bootctl status
- Don't forget to put a password on the BIOS menu!
Use Yubikey to unlock LUKS partition
- Backup LUKS header
sudo cryptsetup luksHeaderBackup /dev/nvme0n1p2 --header-backup-file /run/media/tguimbert/<usb-key-name>/luks_backup.bin
- Enroll Yubikey
sudo systemd-cryptenroll /dev/nvme0n1p2 --fido2-device=auto
- Create a Recovery Key (don't forget to write it somewhere)
sudo systemd-cryptenroll /dev/nvme0n1p2 --recovery-key
- Create a new password if needed (don't forget that the keyboard if in QWERTY during boot)
sudo systemd-cryptenroll /dev/nvme0n1p2 --password
- Remove first key if needed
sudo systemd-cryptenroll /dev/nvme0n1p2 --wipe-slot=0
- Test all the keys!
Other setups
- Generate an SSH key and add it to Github:
ssh-keygen -t ed25519-sk -O verify-required
mv ~/.ssh/id_ed25519_sk.pub ~/.ssh/id_ed25519_sk.pub.hidden
cat ~/.ssh/id_ed25519_sk.pub.hidden
The main idea on the filesystem are the following:
- The /boot is not encrypted
- The rest of the disk is encrypted with a single LUKS partition
- BTRFS is used
- Different subvolumes are used to differentiate the Impermanence lifecycles:
root
is backed up and wiped at every rebootnix
is permanent to hold the Nix storepersistent
is permanent to hold the stateful fileslog
is permanent to help debug thingshome
is backed up and wiped at every reboot- Separating it from
root
allows to have different backup lifecycles
- Separating it from
snapshot
is permanent to hold theroot
andhome
backupsswap
is a swapfile