My Nix configuration to provision Nix-powered machines and images.
- BTRFS zstd compression enable by default
- nix-sops for secret management
desktopdx
(bare-metal NixOS): main PC desktop, for gaming and developmentworkpcdx
(bare-metal NixOS): work PC desktopmacbookdx
(Mac): Macbook Air, for development and casual entertainmentwinpcdx
(WSL): WSL environment in Windows PCbastiondx
(Proxmox LXC): bastion host, as Tailscale exit node and DNS AdBlockersyoi
(Home Manager only): remote code-server at code.syoi.orgsysspcdx
(WSL Tarball): WSL Tarball building for importing to PCs in SYSS
TODO: Update section for updated folder structure
The configuration is organized as multiple profiles (minimal, standard and desktop) and additional host-specific configs. The idea is to keep config structure reusable without complicated and hard-to-trace tree structures.
configuration.minimal.nix
: Minimal package set and settings. For ISO and containersconfiguration.nix
: Standard package set and settings. For headless servers. Includesconfiguration.minimal.nix
.configuration.desktop.nix
: Desktop package set and settings. For desktop. Includesconfiguration.nix
.
darwin-configuration.nix
: Settings for Macs. Manually merged fromconfiguration.desktop.nix
,configuraton.nix
andconfiguration.minimal.nix
and removed incompatiable settings.
home.nix
: Standard home configuration.home.desktop.nix
: Desktop home configuration. Includeshome.nix
.
- Build installation ISO (
nix build .#iso
) and burn ISO to USB - Boot up USB
- Add SSH keys to authorized_keys
- Run Ansible scripts in
tools
directory to prepare installation - Add public key of
/mnt/etc/sops-nix/key.txt
to.sops.yaml
and update keys - Run
nixos-generate-config --root /mnt --show-hardware-config
and copy result tohosts/$HOSTNAME/hardware-configuration.nix
- Clone repo and
nixos-install --flake ".#host"
Currently building from tarball is not tested.
- Download and install NixOS-WSL
- Setup Nix flakes by enabling flags and install git in
/etc/nixos/configuration.nix
- Install
age
and generate an age key at/etc/sops-nix/key.txt
- Add public key of generated age key to
.sops.yaml
and update keys - Switch to configuration as usual with
nixos-build switch --flake ".#host"
Note: You should make sure dotfiles/p10k.conf.d/.p10k.zsh
is in LF
instead
of CRLF
checked out by Git for Windows.
- Build tarball by
nix build .#container
- Upload tarball to Proxmox
- Create LXC container with tarball template
- Mark down IP and change root password if necessary. See instructions here and here. Note that users configurations are not built into the tarball
- Apply configuration with
nixos-build switch --flake ".#container"
. Note that this apply is expected to fail - Reboot and reapply configuration
- Follow Nix and Home Manager installation if they are not yet installed
- Clone repo and
home-manager switch --flake ".#host"