flake.nix now only declares inputs and calls flake-parts with import-tree
over ./modules: every .nix file under modules/ is a flake-parts module.
Features are aspects (flake.modules.nixos.<name> and
flake.modules.homeManager.<name>); importing an aspect enables it, so the
my.* option modules and their enable flags are gone.
- Add the flake-parts glue: modules/flake/ (systems, shared meta data,
host construction through configurations.nixos, overlays, packages,
apps, dev shell, formatter, checks), modules/users/faumaray.nix
(meta.owner) and modules/core/{nixpkgs,home-manager,install-facts}.nix.
config.my is kept as one read-only derived option so install-system
keeps working unchanged.
- Add the aspects that are already final: secrets, ssh, hyprland,
wezterm, git, stylix, proxy-suite, gitea-runner and claude-code, and
the desktop host (modules/hosts/desktop/{host,hardware,disks}.nix).
- Port the always-on basics to the `core` aspect (nix, boot, locale,
networking, users), lanzaboote and plain systemd-boot to the
`secure-boot` and `systemd-boot` aspects, and the installer ISO to
modules/installer/iso.nix. Behaviour is unchanged; the time zone,
default locale, XKB layouts and the firewall setting now live in
modules/hosts/desktop/host.nix.
- Move the Lua files (Hyprland settings, binds, rules; Neovim init.lua)
with git mv, byte-identical.
- Add bare stubs, marked STUB, for the aspects that the next phase
ports: amd, rocm, gaming, vpn, docker, noctalia, audio, fonts, xdg,
apps, shell and neovim. The host evaluates with them, but those
features are not configured until they are ported.
- Remove lib/, overlays/, apps/, modules/nixos/, modules/home/,
modules/installer/default.nix and hosts/desktop/{default,disks,home}.nix.
- flake.lock: add flake-parts, import-tree, stylix and serena with their
transitive inputs (22 new nodes); every existing pin is unchanged.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JZ16yf4acmaSiHq81vyQ6Z
NixOS flake: Hyprland + Noctalia gaming desktop
Declarative NixOS for one AMD desktop (desktop, user faumaray), installable
from a USB stick with a single command.
Features
- Flake with home-manager, agenix, disko, lanzaboote and nixos-hardware.
- Hyprland (from its own flake, current git) under UWSM with the Noctalia v5 shell, WezTerm, Neovim, zsh + starship.
- Gaming: Steam with Proton-GE, gamescope, gamemode, MangoHud.
- Full AMD: AMD CPU, Radeon GPU (Mesa, LACT, optional ROCm).
- Disks via disko, btrfs, no encryption:
- NVMe: ESP (
/boot, 2G) + btrfsnixoswith@root @home @nix @log @swap(16G swapfile). - SATA SSD: btrfs
data, one subvolume per folder, mounted into the home:~/Games ~/Downloads ~/Documents ~/Music ~/Pictures ~/Videos ~/Storage.
- NVMe: ESP (
- Secure Boot with lanzaboote (keys in
/var/lib/sbctl). - Secrets with agenix, decrypted by the machine's SSH host key
(
/etc/ssh/ssh_host_ed25519_key). Every secret is optional. - Installer:
install-system(alsonix run .#install) and a bootable ISO with this repository baked in (nix build .#iso).
Layout
flake.nix inputs and outputs
lib/ mkHost, mkInstaller
overlays/ hyprland (upstream), noctalia, additions (./pkgs), modifications
pkgs/ install-system, create-keys, set-password, secret-from-file, switch-system
apps/ the same tools as `nix run .#<app>`
modules/nixos/ NixOS modules, options under my.*
modules/home/ home-manager modules, options under my.home.*
modules/installer/ the installer ISO
hosts/desktop/ default.nix (the host), disks.nix, disk-ids.json, hardware-configuration.nix, home.nix
secrets/ secrets.nix (recipients) and the encrypted *.age files
keys/ PRIVATE keys, gitignored, lives only on your USB stick
How it is organised
lib.mkHostbuilds a host fromhosts/<name>plus every module inmodules/nixos. A module does nothing until itsmy.*option is switched on, so the host file stays short and declarative.- Overlays are composed in
overlays/default.nix.overlays/additions.nixadds everything inpkgs/;overlays/modifications.nixchanges existing packages. Put your own tweaks there. my.*options (NixOS):my.user,my.locale,my.boot.secureBoot.enable,my.hardware.amd,my.disks,my.desktop.hyprland.enable,my.gaming.enable,my.secrets. Home-manager side:my.home.<module>.enable, switched on inhosts/desktop/home.nix.- To add a machine: copy
hosts/desktop, register it inflake.nix(myLib.mkHost { hostname = "..."; }).
No
flake.lockis committed yet. The first build (orinstall-system) locks all inputs withnix flake lock; commit the resultingflake.lockso installs and the ISO are reproducible.
First-time setup (on your current machine)
Everything here is optional. Without it the system still installs; the
login password then is changeme (with a warning) and there is no SSH key.
git clone <this repo> nixos-config && cd nixos-config
# 1. Host SSH key (the agenix identity) and Secure Boot keys -> keys/desktop/
nix run .#create-keys
# 2. Open secrets/secrets.nix and replace the two placeholder keys:
# host = the public key create-keys printed
# faumaray = your own public key (cat ~/.ssh/id_ed25519.pub)
# 3. Login password (asks twice, stores secrets/faumaray-password.age)
nix run .#set-password -- -i ~/.ssh/id_ed25519
# 4. Your SSH key, installed as ~/.ssh/id_ed25519 on the new system
nix run .#secret-from-file -- ssh-id_ed25519.age ~/.ssh/id_ed25519 -i ~/.ssh/id_ed25519
cp ~/.ssh/id_ed25519.pub secrets/ssh-id_ed25519.pub
# 5. Commit. Flakes only see tracked files; keys/ is gitignored on purpose.
git add -A && git commit -m "Add secrets"
-i is only a check: it proves your private key can decrypt what was just
written. Edit secrets later with cd secrets && agenix -e <name>.age -i <your key>.
Copy the whole directory, including keys/, to the USB stick (and back
keys/ up: it holds the host key and the Secure Boot keys).
keys/<host>/ contains ssh_host_ed25519_key(.pub) and sbctl/{keys,GUID}.
The installer copies them to /etc/ssh and /var/lib/sbctl; if they are
missing it generates new ones and saves them back to the stick.
Install from USB
Needs a UEFI PC and network. The NixOS installer image is not Secure Boot
signed: disable Secure Boot in the firmware while installing (you enable it
again afterwards, see below). install-system erases the two chosen disks.
Path A: official NixOS ISO + this repository on a stick
-
Boot the official NixOS ISO (minimal or graphical, e.g. with Ventoy), connect to the network (
nmtui). -
Mount the stick that holds the repository and
keys/. Not below/mnt, that is where the new system is mounted:sudo -i mkdir -p /media/usb && mount /dev/disk/by-label/<LABEL> /media/usb -
Run the installer from the repository:
cd /media/usb/nixos-config nix --extra-experimental-features 'nix-command flakes' run --accept-flake-config .#installIf Nix complains about the repository ownership or a read-only stick, copy it first:
cp -r /media/usb/nixos-config /root/ && cd /root/nixos-config.
Path B: the custom ISO
nix build .#iso # result/iso/nixos-*.iso, this repository included
sudo dd if=result/iso/nixos-*.iso of=/dev/sdX bs=4M status=progress conv=fsync
(check sdX with lsblk first; or just copy the file to a Ventoy stick).
Boot it, then:
nmtui # if you need Wi-Fi
sudo mkdir -p /media/keys && sudo mount /dev/disk/by-label/<LABEL> /media/keys # stick with keys/
sudo install-system
The ISO ships the flake in /etc/nixos-config (read-only; install-system
works on a copy) and finds keys/ on mounted sticks. Point at it explicitly
with --keys-dir /media/keys/keys. If you changed secrets after building the
ISO, use Path A or rebuild the ISO.
What install-system does
- Checks root, UEFI and the flake; copies it to
/root/nixos-configif it is read-only or not a usable git repository (keys/is never copied into a flake, it would end up in the world-readable Nix store). - If
hosts/desktop/disk-ids.jsonstill hasCHANGE-ME(or a disk does not exist), lists the disks and asks for the system NVMe and the data SSD. The live USB is skipped. The choice is written todisk-ids.json. - Shows both disks (model, size) and wipes them only after you type the host
name.
--yesskips this prompt. - Runs disko, writes
hosts/desktop/hardware-configuration.nixfrom the real hardware (nixos-generate-config --no-filesystems). - Installs the host key, checks that it can decrypt
secrets/*.age; if not it stops before installing and explains how to fix it. - Puts the Secure Boot keys into
/mnt/var/lib/sbctl. nixos-install --flake .#desktop, asks for a login password if there is no password secret, and copies the repository to~/nixos-configof the new system.
Useful options: --host, --flake DIR, --keys-dir DIR, --select-disks,
--disko-mode mount (re-run after a failure without wiping anything), --help.
After the installation
Reboot, remove the stick, log in (greetd/tuigreet: pick Hyprland).
Secure Boot (lanzaboote). The keys exist but the firmware does not trust them yet:
-
Enter the firmware setup and put Secure Boot into Setup Mode ("Reset to Setup Mode" / clear the Platform Key; keep the factory db/dbx).
-
Boot NixOS (Secure Boot still off or in Setup Mode), then:
sudo sbctl enroll-keys --microsoft -
Reboot, enable Secure Boot in the firmware, and check:
bootctl status | grep -i "secure boot" # Secure Boot: enabled (user) sudo sbctl status
--microsoft keeps Microsoft's keys so firmware option ROMs (GPU) still work.
Steam: Settings > Storage > add ~/Games/SteamLibrary (on the data SSD).
Proton-GE appears under the compatibility tool list.
Noctalia starts with the session (a systemd user service). Super+Space
launcher, Super+S control center, Super+, settings. Changes made in the
settings window are stored by Noctalia and override modules/home/noctalia.nix;
move what you want to keep into that file.
Commit the files the installer generated:
hosts/desktop/disk-ids.json, hosts/desktop/hardware-configuration.nix, flake.lock.
Day-2
switch-system # nh os switch (or: switch-system boot | test)
nix flake update # new inputs, then switch-system
nix fmt # nixfmt
nix flake check --no-build
Roll back: pick an older generation in the boot menu, or
sudo nixos-rebuild switch --rollback.
Add a folder on the SSD later (example Projects):
sudo mkdir -p /mnt/data
sudo mount -o subvolid=5 /dev/disk/by-label/data /mnt/data # top level of the data fs
sudo btrfs subvolume create /mnt/data/@projects
sudo umount /mnt/data
then add Projects = { }; to homeFolders in hosts/desktop/disks.nix
(subvolume name defaults to @projects) and run switch-system.
Change a secret: cd secrets && agenix -e faumaray-password.age -i ~/.ssh/id_ed25519
(or run set-password / secret-from-file again with --force), git add, switch.
Troubleshooting
- The PC does not boot after enabling Secure Boot. Disable Secure Boot in
the firmware and boot. To go back to plain systemd-boot set
my.boot.secureBoot.enable = false;inhosts/desktop/default.nixand runswitch-system boot.sbctl enroll-keysrefusing to run means the firmware is not in Setup Mode. - Secrets do not decrypt (no password, no
~/.ssh/id_ed25519). The host key insecrets/secrets.nixmust match/etc/ssh/ssh_host_ed25519_key.pubon the machine. Test:sudo age -d -i /etc/ssh/ssh_host_ed25519_key secrets/<name>.age. Fixsecrets.nix, re-encrypt (agenix -r -i <your key>),git add, switch. Meanwhile log in withchangeme(when no password secret is defined) and runpasswd. - The SSD is missing or fails. Its mounts use
nofailand a 10 s timeout, so the system still boots from the NVMe. Files written to~/Gamesmeanwhile land on the NVMe and are hidden once the SSD is mounted again. - A new file is "not found" by Nix. Flakes only see git-tracked files:
git addit. - The installer stopped halfway. Run it again with
--disko-mode mount(and the same--flake); partitions and the already installed host key are reused. - Slow first build / compiling Hyprland or Noctalia. The binary caches in
flake.nix(nixConfig) must be accepted; use--accept-flake-config.