# 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) + btrfs `nixos` with `@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`. - **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` (also `nix 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 .#` 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.mkHost` builds a host from `hosts/` plus every module in `modules/nixos`. A module does nothing until its `my.*` option is switched on, so the host file stays short and declarative. - Overlays are composed in `overlays/default.nix`. `overlays/additions.nix` adds everything in `pkgs/`; `overlays/modifications.nix` changes 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..enable`, switched on in `hosts/desktop/home.nix`. - To add a machine: copy `hosts/desktop`, register it in `flake.nix` (`myLib.mkHost { hostname = "..."; }`). > No `flake.lock` is committed yet. The first build (or `install-system`) > locks all inputs with `nix flake lock`; commit the resulting `flake.lock` so > 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. ```sh git clone 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 .age -i `. 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//` 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 1. Boot the official NixOS ISO (minimal or graphical, e.g. with Ventoy), connect to the network (`nmtui`). 2. Mount the stick that holds the repository and `keys/`. **Not below `/mnt`**, that is where the new system is mounted: ```sh sudo -i mkdir -p /media/usb && mount /dev/disk/by-label/