Skip to content

notthebee/nix-config

Folders and files

NameName
Last commit message
Last commit date

Latest commit

8928785 · Mar 21, 2025
Mar 21, 2025
Mar 21, 2025
Mar 21, 2025
Jan 22, 2025
Nov 20, 2024
Jan 20, 2025
Oct 25, 2024
Oct 25, 2024
Jun 28, 2023
Jan 20, 2025
Mar 21, 2025
Mar 21, 2025
Mar 21, 2025

Repository files navigation

nix-config

Configuration files for my NixOS and nix-darwin machines.

Very much a work in progress.

Installation runbook (NixOS)

Create a root password using the TTY

sudo su
passwd

From your host, copy the public SSH key to the server

export NIXOS_HOST=192.168.2.xxx
ssh-add ~/.ssh/notthebee
ssh-copy-id -i ~/.ssh/notthebee root@$NIXOS_HOST

SSH into the host with agent forwarding enabled (for the secrets repo access)

ssh -A root@$NIXOS_HOST

Enable flakes

mkdir -p ~/.config/nix
echo "experimental-features = nix-command flakes" >> ~/.config/nix/nix.conf

Partition and mount the drives using disko

DISK='/dev/disk/by-id/ata-Samsung_SSD_870_EVO_250GB_S6PENL0T902873K'
DISK2='/dev/disk/by-id/ata-Samsung_SSD_870_EVO_250GB_S6PE58S586SAER'

curl https://raw.githubusercontent.com/notthebee/nix-config/main/disko/zfs-root/default.nix \
    -o /tmp/disko.nix
sed -i "s|to-be-filled-during-installation|$DISK|" /tmp/disko.nix
nix --experimental-features "nix-command flakes" run github:nix-community/disko \
    -- -m destroy,format,mount /tmp/disko.nix

Install git and git-crypt

nix-env -f '<nixpkgs>' -iA git
nix-env -f '<nixpkgs>' -iA git-crypt

Clone this repository

mkdir -p /mnt/etc/nixos
git clone https://github.com/notthebee/nix-config.git /mnt/etc/nixos

Put the private and GPG key into place (required for secret management)

mkdir -p /mnt/home/notthebee/.ssh
exit
scp ~/.ssh/notthebee root@$NIXOS_HOST:/mnt/home/notthebee/.ssh
scp ~/.ssh/git-crypt-nix root@$NIXOS_HOST:/mnt/home/notthebee/.ssh
ssh root@$NIXOS_HOST
chmod 700 /mnt/home/notthebee/.ssh
chmod 600 /mnt/home/notthebee/.ssh/*

Unlock the git-crypt vault

cd /mnt/etc/nixos
chown -R root:root .
git-crypt unlock /mnt/home/notthebee/.ssh/git-crypt-nix

Install the system

nixos-install \
--root "/mnt" \
--no-root-passwd \
--flake "git+file:///mnt/etc/nixos#hostname" # alison, emily, etc.

Unmount the filesystems

umount "/mnt/boot/efis/*"
umount -Rl "/mnt"
zpool export -a

Reboot

reboot

About

Configuration files for my NixOS and nix-darwin machines

Resources

License

Stars

Watchers

Forks