This repository contains my personal NixOS and home-manager configuration.
- Identify your USB drive
let DISK = lsblk --output=name,type --filter='TYPE=="disk"' | from ssv --aligned-columns | get NAME | input list
- Write the ISO to the USB drive (replace /dev/sdX)
clan flash write --flake . \ --ssh-pubkey ~/.ssh/id_ed25519_sk.pub \ --keymap us \ --language en_US.UTF-8 \ --disk main $DISK \ flash-installer
- Boot the prepared USB drive
- Ensure the machine has an uplink (nmtui is available)
- Get the IP of the machine
- Create a configuration.nix for the machine
let MACHINE = input "Machine name: " clan machines create $MACHINE
- Generate a facter report for the machine
let INSTALLER_IP = input "Machine ip: " clan machines init-hardware-config \ --target-host $"root@($INSTALLER_IP)" \ $MACHINE
- Try to apply the disk configuration to get the list of disks for the machine
clan templates apply disk luks-ext4 $MACHINE --set mainDisk ""
- Create the disko.nix for the machine based on the luks-ext4 template
let DISK_PATH = input "Disk path (/dev/disk/by-id/SOME_ID): " clan templates apply disk luks-ext4 $MACHINE --set mainDisk $DISK_PATH
- Install the system
clan machines install $MACHINE --target-host $"root@($INSTALLER_IP)"
- Change the user password
passwd
- Setup directories in home
mkdir ~/.ssh ~/code ~/.config/Yubico
- Plug in the yubikey and fetch the ssh key
cd ~/.ssh ssh-keygen -K ssh-add id_ed25519_sk_rk_yubikey
- Generate u2f_keys file from yubikey
nix run nixpkgs#pam_u2f | save ~/.config/Yubico/u2f_keys
- Clone and symlink the dotfiles
sudo mv /etc/nixos /etc/nixos.backup git clone git@github.com:friedow/dotfiles.git ~/code/friedow/dotfiles sudo ln -s ~/code/friedow/dotfiles /etc/nixos
Use yubikey-manager to change the yubikey pin
nix shell nixpkgs#yubikey-manager
ykman fido access change-pinGenerate pam keys
nix run nixpkgs#pam_u2f > /home/christian/.config/Yubico/u2f_keys
Guide: https://developers.yubico.com/SSH/Securing_SSH_with_FIDO2.html
Generating new SSH Keys stored on a yubikey:
ssh-keygen -t ed25519-sk -O resident -O application=ssh:yubikey -O verify-required
Copying SSH keys stored on a yubikey to the local system:
cd /home/christian/.ssh && ssh-keygen -K
Manage credentials with the yubikey manager:
nix run nixpkgs#yubikey-manager fido credentials list