Skip to content

Latest commit

 

History

History
126 lines (92 loc) · 5.42 KB

new-system-installation.md

File metadata and controls

126 lines (92 loc) · 5.42 KB

Setup Instructions for a new System (guideline)

Rough guidelines for setting up a new system with this repo as config.

Credit to pimey-nixos for giving me the idea to just write this down as a guide (for myself), and to provide a nice, non-convoluted, useful config as reference.

Before: General Resources & Links

(Optional) Creating a recovery USB stick from a pre-installed Windows

If the system had a pre-installed windows, it probably came without an explicit key, which is instead implicitly available from the recovery partition. However, since we will be erasing this as well, we need to backup the recovery information before formatting the drive.

  1. In Windows, search for something like "recovery medium" ("Wiederherstellungsmedium") in the start menu, and follow the steps to create a bootable USB stick with the recovery information.
  2. If desired, use usbimager to copy the USB stick to an image file, so the stick can be used for something else again.

Flashing a bootable USB stick and booting the installer

  1. Download installer from official site, check "Older Releases" to also see unstable installers etc.
  • It's also possible to configure & build the installer manually, e.g., to boot a newer kernel (for wifi etc.).
  1. Use usbimager to flash the iso to an usb stick
  2. Boot from the usb stick.
  • If rebooting from windows, might be necessary to hold shift while clicking shutdown, otherwise it might go into "fast boot" mode or something.
  • Will have to turn safe boot off for booting from the usb stick.
  • "Calamares" is the installer version with the nice GUI installer (useful for setting keyboard layout).
  1. In the installer, setup wifi, and continue the dialog until the keyboard layout has been set (to de neo2); setxkbmap will not work since the installer is probably already running wayland.

Formatting Partitions

References:

Basic Steps

Use gdisk/sgdisk Arch wiki for this process.

Use sgdisk -L to list partition types.

Just using gdisk is super nice, very simple, also contains possibility to list & search for partition types while creating a partition! Use this!

compression=on automatically uses the "best" compression format instead; I just use that. -o acltype=posixacl is required wherever /var is mounted, also just nice to have in general.

This script is from pimey-nixos (partition.sh), and contains the basic steps for a ZFS setup with encryption, but no swap. Probably a good idea to execute these by hand, I like that better (for how rarely I will be doing it). Also, just a useful reference, but I prefer gdisk, a swap partition, and the acltype-stuff, so also just a guideline.

#!/usr/bin/env bash
set -euo pipefail

sgdisk -n3:1M:+512M -t3:EF00 $DISK # type EF00 is EFI System Partition
sgdisk -n1:0:0 -t1:BF01 $DISK # type BF01 is "Solaris /usr & Mac ZFS", this is used everywhere

echo "Creating a ZFS setup on ${DISK}"
zpool create \
    -o ashift=12 \
    -o altroot="/mnt" \
    -O mountpoint=none \
    -O encryption=aes-256-gcm \
    -O keyformat=passphrase \
    -O atime=off \
    -O compression=lz4 \
    -O xattr=sa \
    zroot $DISK-part1

zfs create -o mountpoint=legacy zroot/root
zfs create -o mountpoint=legacy zroot/root/nixos
zfs create -o mountpoint=legacy zroot/home

mount -t zfs zroot/root/nixos /mnt
mkdir /mnt/home
mount -t zfs zroot/home /mnt/home

mkfs.vfat $DISK-part3
mkdir /mnt/boot
mount $DISK-part3 /mnt/boot

Swap

If swap is desired, it has to be an unencrypted, non-ZFS partition/mountpoint. This is not very cool, but otherwise hibernate is impossible/can break stuff.

Swap size:

  • Without hibernate, about sqrt(RAM); so 32GB Ram -> ~6-8 GB swap
  • With hibernate, about RAM + sqrt(RAM); so 32GB Ram -> ~38-40 GB swap
  • Got these numbers from some website, I think these were recommended Ubuntu numbers or something.
mkswap /dev/...
swapon /dev/...

Set Up Installation

mkdir -p /mnt/home/felix
cd /mnt/home/felix
git clone https://github.com/futile/nixos-config.git nixos # works, since repo is public :)
cd
nixos-generate-config --root /mnt
  • Wrangle generated files in /mnt/etc/nixos into this repo, creating a new host in /hosts, and adding an entry to flake.nix.
  • cd /mnt/etc && mv nixos nixos-old && ln -s /home/felix/nixos; will need to be done after reboot at latest.
  • Run nixos-install --flake /mnt/home/felix/nixos#<new-host-name>.
  • Reboot & pray :)

Post-Install Stuff

  • tide configure
  • mkdir -p ~/GoogleDrive && systemctl --user restart google-drive-ocamlfuse.service
  • KeepassXC: Settings -> Enable Browser Integration (Chrome and Chromium for Vivaldi!)
  • doom sync (will take some time :))
  • ssh-keygen ... && ssh-add <generated-key>; check GitHub for further instructions
  • Upload key to GitHub: Settings -> SSH-Keys -> ...
  • Vivaldi: Activate sync, PW in KeepassXC