A pretty cool system on wayland with some cool widgets.
- niri scrollable-tiling wayland compositor, with eww widgets and stylix theming
- sops-nix for secrets (age-encrypted, committed to the repo)
- impermanence on btrfs subvolumes —
/is wiped at every boot, only whitelisted paths persist - home-manager, niri-flake, nixvim/nvchad, lanzaboote (secure boot is wired up but off by default)
setup/default.nix <- THE config. user, host, locale, toggles. start here
hardware-configuration.nix <- disks/mounts (machine-specific, regenerate per install)
sys/ <- system-level modules (boot, core, nvidia, wayland)
usrs/ <- home-manager config (niri, eww, shell, apps)
secrets/ <- sops-encrypted payloads, deployed at boot
devshell/ <- `nix develop` gives you the `secrets` util
Almost everything personal lives in setup/default.nix:
userName/hostName— the host is built asnixosConfigurations.<hostName>, so changinghostNamechanges what you pass to--flake .#<hostName>timeZone,defaultLocale,extraLocalelite— start withlite = trueon a fresh install. It gates everything that assumes this machine: the nvidia driver module and the plasma6 session. Withlite = trueyou get niri + core apps on anything; flip it tofalseonly on hardware that actually has those things (or flip individualincludes.<name>flags for fine control)symLinks— home dirs (Documents,Downloads, ...) are symlinked onto/datvia tmpfiles rules. Point these at wherever your data disk is, or make/data symlink itself
Note: changing
userNamewon't move your stuff — it creates a fresh home directory.
This config expects btrfs subvolumes with an ephemeral root:
/dev/nvme0n1p5 -> /boot (vfat, ESP)
/dev/nvme0n1p6 -> / (btrfs subvol @, wiped every boot)
/nix (btrfs subvol @nix)
/persist (btrfs subvol @persist, neededForBoot)
/dev/sda1 -> /dat (btrfs, documents/media/code; home dirs symlink into it)
Everything outside /persist is blank at boot. The
persistence module whitelists /home (all of it), /var/log, /var/lib/{bluetooth,nixos,NetworkManager,...},
/etc/machine-id, and the sops key.
Managed by sops-nix: payloads are encrypted in secrets/ with age, committed
to the repo, and deployed at boot with 0600 permissions. Every tracked payload deploys
to ~/.config/secrets/<name> automatically — there is no allowlist. The personal bits
(deploy-path pins, env-var names, root-owned payloads) live in setup.secrets in
setup/default.nix.
The age key must exist in two places, identical:
~/.config/sops/age/keys.txt— for editing secrets/var/lib/sops-nix/key.txt— for decrypting at boot (backed up to/persistby impermanence)
Back this key up somewhere offline. Every secret in the repo is unrecoverable without it.
To use your own key instead of mine (you should):
$ nix shell nixpkgs#age
$ age-keygen -o ~/.config/sops/age/keys.txt
$ mkdir -p /var/lib/sops-nix && cp ~/.config/sops/age/keys.txt /var/lib/sops-nix/key.txtThen put your public key in .sops.yaml and re-encrypt everything:
sops updatekeys secrets/*.
Manage payloads from the devshell:
$ nix develop
$ secrets add <name> <file> # stage, encrypt, git add; prints where it will deploy
$ secrets edit <name> # decrypt, open $EDITOR, re-encrypt
$ secrets rename <old> <new> # git mv, no re-encryption needed
$ secrets rm <name> # remove a payload
$ secrets list # encryption, git-tracking, deploy path, env varStaging a payload is all it takes: secrets add <name> <file> + rebuild. To also export
it as an env var, add "<name>" = "<VAR>" to setup.secrets.envNames — sops-nix renders
~/.config/secrets/env, which .bashrc sources. So an API token is:
$ secrets add openrouter-api-key ./token # + one line in setup.secrets.envNames
$ sudo nixos-rebuild switch --flake .#qat # $OPENROUTER_API_KEY now set in bashsecrets add <name> <file> → register it in userSecrets + envNames → rebuild.
Boot a NixOS ISO, then partition like this (tip: set the esp flag on the boot partition with gparted):
p1 vfat 1G+ /boot (ESP)
p2 btrfs rest / /nix /persist subvolumes
(+ optional data disk for /dat)
Create the subvolumes and mount everything:
# mkfs
mkfs.fat -F 32 /dev/<efi-part>
mkfs.btrfs -L nixos /dev/<root-part>
# create subvolumes
mount /dev/<root-part> /mnt
btrfs subvolume create /mnt/@
btrfs subvolume create /mnt/@nix
btrfs subvolume create /mnt/@persist
umount /mnt
# mount the real layout
mount -o subvol=@,compress=zstd,noatime /dev/<root-part> /mnt
mount --mkdir -o subvol=@nix,compress=zstd,noatime /dev/<root-part> /mnt/nix
mount --mkdir -o subvol=@persist,compress=zstd,noatime /dev/<root-part> /mnt/persist
mount --mkdir /dev/<efi-part> /mnt/boot
mount --mkdir -o compress=zstd,noatime /dev/<data-part> /mnt/dat # optionalNote:
/persistmust stayneededForBoot = truein hardware-configuration.nix — sops secrets and impermanence both need it mounted before the system activates. If younixos-generate-config, re-add thesubvol=options andneededForBootafterwards.
Now make it yours:
- Edit
setup/default.nix— at minimumuserName,hostName,timeZone, the locales, andlite = true(leaves out nvidia/plasma6; flip it later if your hardware wants them) - Update the device UUIDs in hardware-configuration.nix
to match your disks (
lsblk -f) - Generate your own age key and re-encrypt the secrets (see above) — you can't decrypt mine
- Create your own password hash — the user password is a sops secret:
Add
$ mkpasswd -m sha-512 > /tmp/hash # then from the devshell: $ secrets add yor-password-hash /tmp/hash
"yor-password-hash"tosetup.secrets.root(it deploys root-owned for user creation) and pointhashedPasswordFileat it.
Clone and install:
$ git clone https://github.com/yorqat/nixo.git && cd nixo
$ nixos-install --root /mnt --flake .#<hostName>Warning: flakes ignore untracked files. If you added anything new (secrets payloads included),
git addit before installing/rebuilding, or sops silently deploys nothing.
Reboot, log in through sddm (niri session is in there alongside plasma6).
Note: make sure
/home/<userName>is actually owned by your user (ls -ld /home/<userName>). With impermanence +users.mutableUsers = falsenothing fixes it for you — NixOS only creates+chowns the home when it doesn't exist yet, and with mutable users off a root-owned home stays root-owned (e.g. if it was pre-created or copied over from a live environment). If needed, fix it once:sudo chown -R <userName>:users /home/<userName>
$ nixos-rebuild switch --flake .#<hostName> -vNote: if you update hardware or change mount points, regenerate:
$ nixos-generate-config --show-hardware-config > hardware-configuration.nix— then re-check thesubvol=options andneededForBootnote above.
Gotchas learned the hard way:
sudo nixos-rebuildre-rootsflake.lock. If evals then fail with "Permission denied":sudo chown $USER:users flake.lock- secrets payloads live under
secrets/as whole-file binary format — don't rename them by hand, usesecrets rename - to sanity-check a change without switching:
nix eval .#nixosConfigurations.<hostName>.config.system.build.toplevel.drvPath
