Code
nix
Flake configuration for NixOS hosts (pxl, rxl) and a nix-darwin host (txl). Linux stack: niri WM · DankMaterialShell (DMS) + native dms-greeter · alacritty + fish. macOS stack: aerospace WM · alacritty + fish · nix packages for everything CLI, homebrew for GUI casks only.
Structure
nix/
├── flake.nix # Flake inputs & host definitions (pxl, rxl, txl)
├── install.sh # Guided installer for fresh NixOS setups
├── deploy.sh # Switch & rebuild helper script
├── hosts/ # System configurations
│ ├── common/ # Shared NixOS base (audio, fonts, DMS, greeter)
│ ├── pxl/ # Desktop: Secure Boot & Windows dual-boot
│ ├── rxl/ # Laptop: Disko LUKS+LVM & TPM2 auto-unlock
│ └── txl/ # MacBook: nix-darwin & Homebrew GUI casks
└── home/ # User environments (Home Manager)
├── common/ # Shared shell, tools, editors, terminal & font settings
├── linux/ # Linux desktop environment (niri WM, DMS, Wayland)
└── darwin/ # macOS desktop environment (aerospace WM)
NixOS systems combine hosts/common + hosts/<host> with home/common + home/linux. macOS (txl) combines hosts/txl with home/common + home/darwin.
Hosts
| Host | Device | OS | Bootloader | Storage / Partitions | Features |
|---|---|---|---|---|---|
pxl |
Desktop | NixOS | lanzaboote (Secure Boot) | Manual Ext4 | Windows dual-boot, sbctl |
rxl |
Framework 13 | NixOS | systemd-boot | Disko (LUKS + LVM) | TPM2 auto-unlock, fingerprint |
txl |
MacBook | macOS | Apple Bootloader | APFS | nix-darwin, Homebrew casks |
Installation
1. Fresh NixOS Install (rxl)
Automated installation using disko with LVM inside LUKS encryption: an Ext4 root volume and 40 GiB swap for hibernation. The EFI partition is unencrypted.
- Boot the NixOS live ISO and connect to the internet.
- Clone this repository:
git clone https://github.com/tobikli/nix.git ~/nix && cd ~/nix - Locate your target disk ID:
lsblk -o NAME,ID-LINK,SIZE,MODEL - Set the
devicepath inhosts/rxl/disko.nix(replaceCHANGEME). - Run the installer:
sudo ./install.sh rxl - Set the user password before rebooting:
sudo nixos-enter --root /mnt -c 'passwd tobias' sudo reboot - (Optional) After the first boot, enroll TPM2 auto-unlock for the LUKS container:
sudo systemd-cryptenroll --tpm2-device=auto --tpm2-pcrs=0+7 /dev/disk/by-partlabel/disk-main-luks
2. Dual-Boot NixOS Install (pxl)
Manual installation for systems sharing a disk or secondary drive with Windows and using Secure Boot.
- Boot the NixOS live ISO and connect to the internet.
- Clone this repository:
git clone https://github.com/tobikli/nix.git ~/nix && cd ~/nix - Partition and format your Linux partitions manually, then mount them to
/mnt(e.g. root to/mnt, EFI to/mnt/boot). - Verify the Windows EFI partition path in
hosts/pxl/default.nix(defaults to/dev/nvme1n1p1). On each rebuild, NixOS automatically copies the Microsoft boot files to/boot/EFI/Microsoftsosystemd-bootauto-discovers Windows. - Prepare the lanzaboote signing keys under
/mnt/var/lib/sbctlbefore installing. The configuredpkiBundleis/var/lib/sbctlin the installed system;install.shdoes not create these keys. For a new key set, usesbctlfrom the live environment with the target paths, or first install with Secure Boot/lanzaboote disabled and enable it after creating keys on the installed system. - Run the installer:
sudo ./install.sh pxl - Set the user password before rebooting:
sudo nixos-enter --root /mnt -c 'passwd tobias' sudo reboot - To enable Secure Boot, enter UEFI Setup Mode and enroll the existing signing keys with
sbctlfrom the installed system:sudo sbctl enroll-keys --microsoft
3. macOS Setup (txl)
- Prerequisite: Create a macOS account named
tobias(matchingusers.users.tobiasinhosts/txl/default.nix) via the standard macOS Setup Assistant. - Install Nix using the Determinate Systems installer:
curl -fsSL https://install.determinate.systems/nix | sh -s -- install - Install Homebrew if it is not already available. This configuration manages its packages but does not install Homebrew itself.
- Clone this repository:
git clone https://github.com/tobikli/nix.git ~/nix && cd ~/nix - Bootstrap
nix-darwinand switch:
Note: Homebrew is managed declaratively by nix-darwin for GUI casks (sudo nix run nix-darwin -- switch --flake .#txlhosts/txl/default.nix). Undeclared casks are cleaned up on activation.
Deploy & Daily Usage
Rebuild and switch configurations directly from this repository:
sudo ./deploy.sh # Auto-detects host via hostname
sudo ./deploy.sh <host> # Rebuild a specific host (pxl, rxl, txl)
Inside fish, these functions use the repository at ~/nix and select the host via hostname -s:
nrs: Rebuild and switch (nixos-rebuild switchordarwin-rebuild switch)nrb: On NixOS, build and set the configuration for the next boot without changing the running system (nixos-rebuild boot). On macOS, build without activating (darwin-rebuild build).
Fonts & Editors
home/common/font.nix defines the shared font families:
systemFont: Inter, used by Linux GTK/GNOME, DMS, media overlays, and the default sans-serif font.monospaceFont: JetBrainsMono Nerd Font Mono, used by Emacs, Alacritty, VS Code (including its terminal), and Linux's default monospace font.
The editor/terminal base size is sizePt = 15. linuxScale = 0.8 produces 12pt on Linux while macOS keeps 15pt. VS Code's CSS pixel sizes are derived automatically (16px and 20px respectively). System UI and overlay sizes remain defined in their respective modules; serif and emoji defaults remain separate.
Change font families and editor sizes in this one file, then rebuild. If selecting a different font, also ensure its package is installed via hosts/common/default.nix (Linux) or hosts/txl/default.nix (macOS).
Emacs uses the native Wayland emacs-pgtk build on Linux and the native macOS build on Darwin. Its configuration and theme live in home/common/emacs/; Home Manager generates ~/.emacs.d/init.el with the shared font setting.
In Niri, Super + mouse wheel up/down focuses columns left/right (wheel up moves left, wheel down moves right). Desktop bindings live in home/linux/niri.nix.
Adding a Host
- Create
hosts/<name>/default.nix(anddisko.nixorhardware-configuration.nix). - Add a
nixosConfigurations.<name>ordarwinConfigurations.<name>entry inflake.nix. - Deploy with
sudo ./deploy.sh <name>.

