My NixOS configuration and other infrastructure related things
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Go to file
Simon Bruder 426e9dd4c7
WIP: machines: Add ayu
2 years ago
.git-crypt Add 1 git-crypt collaborator 3 years ago
machines WIP: machines: Add ayu 2 years ago
modules tools/adb: Use proper way to determine if x86_64 2 years ago
nix Update sources 2 years ago
pkgs osu-lazer-container: Ensure state directory exists 2 years ago
users/simon nvim: Add nix snippet for sha256 hash 2 years ago
.envrc Initial commit 3 years ago
.gitattributes Initial commit 3 years ago
.gitignore Ignore all results 3 years ago
LICENSE Initial commit 3 years ago Remove dotfiles from README 3 years ago
deploy.nix WIP: machines: Add ayu 2 years ago
shell.nix Add deploy script 3 years ago

NixOS configuration

How to install

This guide describes how to install this configuration (or any NixOS configuration) with GPT and legacy (BIOS) boot.

If you do not have a wired connection, first set up wifi

wpa_passphrase "SSID" "PSK" | sudo wpa_supplicant -B -i wlp4s0 -c/dev/stdin

Create the partition table (enter the indented lines in the repl).

sudo parted /dev/sdX
  mktable GPT
  mkpart primary 1MiB 2MiB
  mkpart primary 2MiB 500MiB
  mkpart primary 500MiB 100%
  set 1 bios_grub on
  disk_toggle pmbr_boot

Format encrypted partition and open it

sudo cryptsetup luksFormat /dev/sdX3
sudo cryptsetup luksOpen /dev/sdX3 HOSTNAME-pv

Create LVM (replace 8G with desired swap size)

sudo pvcreate /dev/mapper/HOSTNAME-pv
sudo vgcreate HOSTNAME-vg /dev/mapper/HOSTNAME-pv
sudo lvcreate -L 8G -n swap HOSTNAME-vg
sudo lvcreate -l '100%FREE' -n root HOSTNAME-vg

Hint: If you have to reboot to the installation system later because something went wrong and you need access to the LVM (but dont know LVM), do the following after opening the luks partition: sudo vgchange -ay

Create filesystems

sudo mkfs.ext2 /dev/sdX2
sudo mkfs.ext4 -L root /dev/HOSTNAME-vg/root
sudo mkswap -L swap /dev/HOSTNAME-vg/swap

Mount the file systems and activate swap

sudo mount /dev/HOSTNAME-vg/root /mnt
sudo mkdir /mnt/boot
sudo mount /dev/sdX2 /mnt/boot
sudo swapon /dev/HOSTNAME-vg/swap

Create the configuration (see below) and copy this repository to your new home directory (e.g. /mnt/home/simon/nixos).

Add a symlink as the global configuration

sudo mkdir -p /mnt/etc/nixos/
sudo ln -s ../../home/simon/nixos/machines/nunotaba/configuration.nix /mnt/etc/nixos/configuration.nix

Generate hardware configuration and copy hardware configuration to machine configuration

sudo nixos-generate-config --root /mnt/
sudo mv /mnt/etc/nixos/hardware-configuration.nix /mnt/home/simon/nixos/machines/nunotaba/hardware-configuration.nix
sudo ln -s ../../home/simon/nixos/machines/nunotaba/hardware-configuration.nix /mnt/etc/nixos/hardware-configuration.nix

Install NixOS sudo nixos-install --no-root-passwd

Enter the target as a container and set a user password

sudo cp /etc/resolv.conf /mnt/etc/ # see
passwd simon
^D # nixos-enter
sudo rm /mnt/etc/resolv.conf

How to add new device

  • Copy the config from the device that is similar to the new one
  • Import profiles/modules you want
  • Change settings in configuration.nix
  • Change secrets


MIT License