Dendritic flake-parts layout, Stylix theming, agenix secrets, Claude Code tooling, nix-ld #1
@@ -3,13 +3,26 @@
|
||||
Declarative NixOS for one AMD desktop (`desktop`, user `faumaray`), installable
|
||||
from a USB stick with a single command.
|
||||
|
||||
The canonical remote is Gitea: <https://git.faumaray.com/faumaray/NixOsConfig>
|
||||
(`origin`). GitHub (<https://github.com/Faumaray/NixOsConfig>, remote `github`)
|
||||
is a secondary remote.
|
||||
|
||||
## Features
|
||||
|
||||
- **Flake** with home-manager, agenix, disko, lanzaboote and nixos-hardware.
|
||||
- **Flake** in the dendritic layout (flake-parts + import-tree) with
|
||||
home-manager, agenix, disko, lanzaboote, nixos-hardware and Stylix.
|
||||
- **Hyprland** (from its own flake, current git) under UWSM with the
|
||||
**Noctalia v5** shell, WezTerm, Neovim, zsh + starship.
|
||||
**Noctalia v5** shell, WezTerm, Neovim, zsh + starship and Dolphin. SDDM logs
|
||||
the user straight into the session (autologin).
|
||||
- **Stylix theming**: Catppuccin Mocha, Monaspace and Inter fonts, Bibata cursor
|
||||
and Papirus icons for GTK, Qt, the TTY, Hyprland, Noctalia, WezTerm and the
|
||||
command-line tools, all from one file.
|
||||
- **Gaming**: Steam with Proton-GE, gamescope, gamemode, MangoHud.
|
||||
- **Full AMD**: AMD CPU, Radeon GPU (Mesa, LACT, optional ROCm).
|
||||
- **Network**: proxy-suite (zapret, Telegram WebSocket proxy), AmneziaVPN,
|
||||
NetworkManager with the OpenVPN plugin.
|
||||
- **Dev**: Docker (rootless and rootful), a Gitea Actions runner, and **Claude
|
||||
Code** with codebase-memory-mcp, Serena, REA and caveman.
|
||||
- **Disks via disko, btrfs, no encryption**:
|
||||
- NVMe: ESP (`/boot`, 2G) + btrfs `nixos` with `@root @home @nix @log @swap`
|
||||
(16G swapfile).
|
||||
@@ -24,45 +37,165 @@ from a USB stick with a single command.
|
||||
## Layout
|
||||
|
||||
```
|
||||
flake.nix inputs and outputs
|
||||
lib/ mkHost, mkInstaller
|
||||
overlays/ hyprland (upstream), noctalia, additions (./pkgs), modifications
|
||||
flake.nix inputs and nixConfig; outputs = flake-parts over import-tree of modules/
|
||||
flake.lock pinned inputs (committed)
|
||||
modules/ every .nix file below is a flake-parts module (import-tree)
|
||||
flake/ glue: systems, meta (shared data), hosts -> nixosConfigurations,
|
||||
overlays, packages, apps, dev shell, formatter, checks
|
||||
users/ meta.owner: the user's identity (faumaray.nix)
|
||||
core/ the `core` aspect every host imports: nix, boot, locale, networking,
|
||||
users, home-manager, facts for install-system
|
||||
boot/ secure-boot (lanzaboote) or systemd-boot
|
||||
hardware/ amd (CPU, GPU, LACT), rocm (optional, not imported by desktop)
|
||||
security/ secrets (agenix), ssh (server and client)
|
||||
network/ vpn (AmneziaVPN), proxy-suite (zapret, Telegram proxy)
|
||||
dev/ docker, gitea-runner
|
||||
desktop/ hyprland (+ its Lua files), noctalia, audio, fonts, wezterm, xdg, apps
|
||||
theme/ stylix: scheme, fonts, cursor, icons, target list
|
||||
cli/ shell, git, neovim
|
||||
gaming/ steam
|
||||
ai/ claude-code
|
||||
installer/ the installer ISO
|
||||
hosts/desktop/ host.nix (aspects + host-only values), hardware.nix, disks.nix
|
||||
hosts/desktop/ written by install-system: hardware-configuration.nix, disk-ids.json (not modules)
|
||||
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
|
||||
.claude/, CLAUDE.md project settings and instructions for Claude Code sessions
|
||||
```
|
||||
|
||||
### How it is organised
|
||||
### How it is organised (dendritic)
|
||||
|
||||
- `lib.mkHost` builds a host from `hosts/<name>` 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.<module>.enable`,
|
||||
switched on in `hosts/desktop/home.nix`.
|
||||
- To add a machine: copy `hosts/desktop`, register it in `flake.nix`
|
||||
(`myLib.mkHost { hostname = "..."; }`).
|
||||
- **Every `.nix` file under `modules/` is a flake-parts module.** `flake.nix`
|
||||
only declares inputs; its `outputs` is
|
||||
`flake-parts.lib.mkFlake { inherit inputs; } (inputs.import-tree ./modules)`.
|
||||
import-tree imports every file below `modules/` (paths containing `/_` are
|
||||
skipped), so there are no import lists: `git add` a new file and it is part of
|
||||
the flake.
|
||||
- **An aspect is one feature**, published as `flake.modules.nixos.<name>` (a
|
||||
NixOS module) and/or `flake.modules.homeManager.<name>` (a home-manager
|
||||
module). One file can define both halves, e.g. `modules/security/ssh.nix`
|
||||
(server and client). Importing an aspect turns the feature on: there are no
|
||||
`enable` options. Alternatives are separate aspects (`secure-boot` or
|
||||
`systemd-boot`). `core` is the always-on basics, merged from
|
||||
`modules/core/*.nix` and the agenix import in `modules/security/secrets.nix`.
|
||||
- **A host picks aspects.** `modules/hosts/desktop/host.nix` sets
|
||||
`configurations.nixos.desktop.module`: the list of NixOS aspects, the owner's
|
||||
home-manager aspects and the values that belong to this machine only (time
|
||||
zone, locale, keyboard layouts, firewall, `stateVersion`s). `hardware.nix` and
|
||||
`disks.nix` add to the same module. `modules/flake/nixos.nix` turns every
|
||||
`configurations.nixos.<name>` into `nixosConfigurations.<name>` and
|
||||
`checks.<system>.nixos-<name>`.
|
||||
- **A combined aspect attaches its home-manager half to the owner** from its
|
||||
NixOS half (`home-manager.users.<owner>.imports`), so the host imports it
|
||||
once. Home-manager-only aspects (`shell`, `git`, `neovim`, `wezterm`, `xdg`,
|
||||
`apps`, `claude-code`) are listed in the host's `home-manager.users.<owner>`
|
||||
block.
|
||||
- **Shared data** is two typed top-level flake-parts options (schema in
|
||||
`modules/flake/meta.nix`, not a flake output): `meta.owner` (name, full name,
|
||||
e-mail, uid, SSH keys; the values are in `modules/users/faumaray.nix`) and
|
||||
`meta.secretsDir` (default `./secrets`). A file reads them from the
|
||||
flake-parts `config`, bound in a `let` *before* any NixOS or home-manager
|
||||
module (inside `{ config, ... }:` of those, `config` is the NixOS or
|
||||
home-manager configuration), so both halves get the values by closure.
|
||||
- **Host values are plain NixOS options** (`time.timeZone`,
|
||||
`services.xserver.xkb`, ...), set in `host.nix`. A home-manager half reads
|
||||
them, and everything else on the system side (`osConfig.age.secrets`, ...),
|
||||
through `osConfig`, home-manager's handle on the NixOS configuration.
|
||||
- The only custom option left is the read-only `config.my` in
|
||||
`modules/core/install-facts.nix`, a compatibility view of the real
|
||||
configuration that `install-system` evaluates; aspects never read it.
|
||||
|
||||
> 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.
|
||||
Rules of thumb:
|
||||
|
||||
- A third-party module is imported by exactly one aspect (agenix and
|
||||
home-manager: `core`; lanzaboote: `secure-boot`; Stylix: `theme`; disko: the
|
||||
host's `disks.nix`). Importing it twice declares its options twice.
|
||||
- A dynamic attribute such as `users.users.${owner.name}` may appear only once
|
||||
per attribute set: put everything for the owner into one block.
|
||||
- A secret is declared (`age.secrets.<name>`) only when
|
||||
`meta.secretsDir + "/<name>.age"` exists, with a `warnings` entry otherwise.
|
||||
Never put a secret value into a `.nix` file.
|
||||
|
||||
#### Add an aspect
|
||||
|
||||
1. Create `modules/<area>/<name>.nix` with a header comment (what it does; for a
|
||||
combined aspect, what each half does).
|
||||
2. Define `flake.modules.nixos.<name>` and/or `flake.modules.homeManager.<name>`.
|
||||
A combined aspect adds its home-manager half from the NixOS half:
|
||||
|
||||
```nix
|
||||
{ config, ... }:
|
||||
let
|
||||
# flake-parts' config: read shared values here, before the `config` argument
|
||||
# of a NixOS or home-manager module shadows the name.
|
||||
inherit (config.meta) owner;
|
||||
hmFoo = config.flake.modules.homeManager.foo;
|
||||
in
|
||||
{
|
||||
flake.modules.nixos.foo =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
environment.systemPackages = [ pkgs.hello ];
|
||||
home-manager.users.${owner.name}.imports = [ hmFoo ];
|
||||
};
|
||||
|
||||
flake.modules.homeManager.foo =
|
||||
{ osConfig, ... }:
|
||||
{
|
||||
programs.git.settings.user.email = owner.email;
|
||||
home.sessionVariables.KB_LAYOUT = osConfig.services.xserver.xkb.layout;
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
3. If Stylix supports the program, add `stylix.targets.<program>.enable = true;`
|
||||
to `modules/theme/stylix.nix` (its home-manager half for user programs).
|
||||
4. Add the name to the NixOS list (or the home-manager list) in
|
||||
`modules/hosts/<host>/host.nix`.
|
||||
5. `git add` the new file (flakes only see tracked files), run `nix fmt` and
|
||||
`nix flake check --no-build`.
|
||||
|
||||
#### Add a host
|
||||
|
||||
1. Create `hosts/<new>/` with `disk-ids.json`
|
||||
(`{"system": "/dev/disk/by-id/nvme-CHANGE-ME", "data": "/dev/disk/by-id/ata-CHANGE-ME"}`)
|
||||
and a placeholder `hardware-configuration.nix` (`hosts/desktop/`'s is a
|
||||
template). `install-system` rewrites both and needs the directory to exist.
|
||||
2. Copy `modules/hosts/desktop/` to `modules/hosts/<new>/`. In each file replace
|
||||
`configurations.nixos.desktop` with `configurations.nixos.<new>` and the
|
||||
`hosts/desktop/` paths; adjust the aspect lists, time zone and keyboard
|
||||
layouts, firewall, disks and the `stateVersion`s.
|
||||
3. `git add` everything, then `nix run .#install -- --host <new>` on the target.
|
||||
If a second host needs the same disk layout, lift `disks.nix` into a shared
|
||||
aspect at that point.
|
||||
|
||||
### Flake outputs
|
||||
|
||||
| Output | Contents |
|
||||
|---|---|
|
||||
| `nixosConfigurations` | `desktop`, `installer` |
|
||||
| `packages.x86_64-linux` | `create-keys`, `install-system`, `iso`, `secret-from-file`, `set-password`, `switch-system` |
|
||||
| `apps.x86_64-linux` | `create-keys`, `install`, `secret-from-file`, `set-password`, `switch` |
|
||||
| `checks.x86_64-linux` | `create-keys`, `formatting`, `install-system`, `nixos-desktop`, `secret-from-file`, `set-password`, `switch-system` |
|
||||
| `devShells.x86_64-linux` | `default` (`nix develop`: agenix, disko, age, ssh-to-age, sbctl, git, nixfmt, nixd, shellcheck) |
|
||||
| `formatter.x86_64-linux` | `nix fmt` (nixfmt; skips the generated `hosts/*/hardware-configuration.nix`) |
|
||||
| `overlays` | `hyprland`, `noctalia`, `additions`, `modifications`, and `default`, which composes the four |
|
||||
| `modules` | `nixos.<aspect>`, `homeManager.<aspect>` |
|
||||
|
||||
`checks.x86_64-linux.nixos-desktop` is the host's toplevel: with `--no-build`,
|
||||
`nix flake check` evaluates the whole host down to its derivation, without it
|
||||
the host is built. `formatting` is the nixfmt check; the five tools are checks
|
||||
too (their shellcheck runs when they are built).
|
||||
|
||||
## 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.
|
||||
login password then is `changeme` (with a warning), there is no SSH key, the
|
||||
Gitea runner is not configured and the Telegram proxy is off (a warning each).
|
||||
|
||||
```sh
|
||||
git clone <this repo> nixos-config && cd nixos-config
|
||||
git clone https://git.faumaray.com/faumaray/NixOsConfig nixos-config && cd nixos-config
|
||||
|
||||
# 1. Host SSH key (the agenix identity) and Secure Boot keys -> keys/desktop/
|
||||
nix run .#create-keys
|
||||
@@ -91,6 +224,46 @@ Copy the whole directory, **including `keys/`**, to the USB stick (and back
|
||||
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.
|
||||
|
||||
### Secrets
|
||||
|
||||
| File in `secrets/` | Content | Consumer |
|
||||
|---|---|---|
|
||||
| `faumaray-password.age` | hashed login password (`mkpasswd -m yescrypt`; `set-password`) | the user account (`modules/core/users.nix`) |
|
||||
| `ssh-id_ed25519.age`, `ssh-id_ed25519_work.age` | private SSH keys (+ optional plain `.pub` files) | linked to `~/.ssh/<key>` (`modules/security/ssh.nix`) |
|
||||
| `gitea-runner-token.age` | one line `TOKEN=<registration token>` | Gitea runner `performance`, `tokenFile` (`modules/dev/gitea-runner.nix`) |
|
||||
| `tg-ws-proxy-secret.age` | the hex secret (`openssl rand -hex 16`) | Telegram proxy, `secretFile` (`modules/network/proxy-suite.nix`) |
|
||||
|
||||
The last two are new: the runner token and the Telegram secret used to be
|
||||
plaintext in the Nix files. Create them the same way as the others (the
|
||||
recipients are already listed in `secrets/secrets.nix`; `secret-from-file` runs
|
||||
`git add` for you):
|
||||
|
||||
```sh
|
||||
# Gitea runner: a fresh registration token from the Gitea runners page.
|
||||
# The editor opens; type one line: TOKEN=<registration token>
|
||||
(cd secrets && agenix -e gitea-runner-token.age -i ~/.ssh/id_ed25519)
|
||||
# or without an editor (the token lands in your shell history):
|
||||
printf 'TOKEN=%s\n' '<registration token>' \
|
||||
| nix run .#secret-from-file -- gitea-runner-token.age - -i ~/.ssh/id_ed25519
|
||||
|
||||
# Telegram proxy: a new secret; note it, the Telegram clients need it in the proxy link
|
||||
s=$(openssl rand -hex 16) && echo "$s"
|
||||
printf '%s\n' "$s" | nix run .#secret-from-file -- tg-ws-proxy-secret.age - -i ~/.ssh/id_ed25519
|
||||
unset s
|
||||
|
||||
git add secrets/gitea-runner-token.age secrets/tg-ws-proxy-secret.age # agenix -e does not
|
||||
```
|
||||
|
||||
(`-` reads the plaintext from stdin, so no plaintext file is left behind; add
|
||||
`--force` to replace an existing file. Show a stored secret again with
|
||||
`age -d -i ~/.ssh/id_ed25519 secrets/tg-ws-proxy-secret.age`.)
|
||||
|
||||
**Rotate the old values.** They are in the git history, so treat them as leaked:
|
||||
create a new runner registration token in Gitea and a new MTProto secret, and
|
||||
update the Telegram clients with the new proxy link. Until the two files exist a
|
||||
switch removes the runner instance and turns the Telegram proxy off, each with
|
||||
an evaluation warning.
|
||||
|
||||
## Install from USB
|
||||
|
||||
Needs a UEFI PC and network. **The NixOS installer image is not Secure Boot
|
||||
@@ -163,7 +336,8 @@ Useful options: `--host`, `--flake DIR`, `--keys-dir DIR`, `--select-disks`,
|
||||
|
||||
## After the installation
|
||||
|
||||
Reboot, remove the stick, log in (greetd/tuigreet: pick **Hyprland**).
|
||||
Reboot, remove the stick. SDDM logs `faumaray` in automatically and starts
|
||||
Hyprland (UWSM session); the login password is for `sudo` and the TTYs.
|
||||
|
||||
**Secure Boot** (lanzaboote). The keys exist but the firmware does not trust them yet:
|
||||
|
||||
@@ -188,22 +362,142 @@ Reboot, remove the stick, log in (greetd/tuigreet: pick **Hyprland**).
|
||||
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.
|
||||
launcher, `Super+S` control center, `Super+,` settings. Its colours come from
|
||||
Stylix (see Theming). Changes made in the settings window are stored by
|
||||
Noctalia and override `modules/desktop/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`.
|
||||
`hosts/desktop/disk-ids.json` and `hosts/desktop/hardware-configuration.nix`
|
||||
(and `flake.lock` if it changed).
|
||||
|
||||
## Theming (Stylix)
|
||||
|
||||
One palette for the whole desktop, applied by [Stylix](https://github.com/nix-community/stylix).
|
||||
Everything is set in `modules/theme/stylix.nix`: the NixOS half holds the scheme,
|
||||
fonts, cursor, icons and the system-wide targets, the home-manager half the
|
||||
per-program targets.
|
||||
|
||||
| Setting | Value |
|
||||
|---|---|
|
||||
| Scheme | Catppuccin Mocha (16 colours inline, so evaluation needs no import-from-derivation), polarity dark |
|
||||
| Fonts | monospace Monaspace Radon, sans Inter, serif Noto Serif, emoji Noto Color Emoji; WezTerm and Noctalia keep Monaspace Krypton through a per-target override |
|
||||
| Cursor | Bibata-Modern-Classic, 24 |
|
||||
| Icons | Papirus-Dark (Papirus-Light for a light scheme) |
|
||||
| Wallpaper | none: Noctalia draws it |
|
||||
|
||||
Targets are opt-in (`stylix.autoEnable = false`), so Stylix touches only what is
|
||||
listed:
|
||||
|
||||
- NixOS: `console` (TTY palette), `fontconfig`, `font-packages`, `gtk`.
|
||||
- home-manager: `gtk`, `qt` (qt5ct/qt6ct + Kvantum), `hyprland`, `noctalia`,
|
||||
`wezterm`, `bat`, `btop`, `fzf`, `starship`, `mpv`, `zathura`.
|
||||
- Everything else is off, `neovim` and `firefox` on purpose (see below).
|
||||
|
||||
How to change it:
|
||||
|
||||
- **Turn a target off**: set `stylix.targets.<name>.enable = false;` (or delete
|
||||
the line) in the matching half of `modules/theme/stylix.nix`. This is also the
|
||||
way back for one program if you dislike the new look.
|
||||
- **Change the scheme**: edit the `base16Scheme` colours, or point it at a
|
||||
packaged scheme, `"${pkgs.base16-schemes}/share/themes/<name>.yaml"` (that is
|
||||
import-from-derivation: evaluation then builds it). For a light scheme also
|
||||
set `stylix.polarity`, and change `gtk.colorScheme` and the dconf
|
||||
`color-scheme` (both fixed to dark in the home-manager half).
|
||||
- **Noctalia follows the palette**: Stylix's `noctalia` target writes a custom
|
||||
palette `stylix` (`~/.config/noctalia/palettes/stylix.json`) and selects it.
|
||||
Its opacity part is off, so Noctalia keeps its own panel opacities, and the
|
||||
shell font stays Monaspace Krypton. Settings changed in Noctalia's own window
|
||||
still override the file.
|
||||
- **Hyprland**: Stylix sets the border, group, shadow and background colours
|
||||
after `settings.lua` is loaded, so the colour literals in that file no longer
|
||||
take effect; disable the `hyprland` target to use your own.
|
||||
- **Neovim keeps catppuccin on purpose.** `modules/cli/neovim/init.lua` sets its
|
||||
own colorscheme and lualine theme; Stylix's neovim target would append
|
||||
mini.base16 after it and clear the highlight groups they created. The palette
|
||||
is Catppuccin Mocha either way, so the look matches.
|
||||
- Firefox is not themed: Stylix needs a profile declared in home-manager, which
|
||||
would hide your existing one.
|
||||
|
||||
Visible changes compared with the configuration before Stylix:
|
||||
|
||||
- The TTY uses the Catppuccin palette.
|
||||
- GTK apps use `adw-gtk3` with Stylix CSS and Inter 12 (was `adw-gtk3-dark`);
|
||||
the default serif font is Noto Serif (was DejaVu Serif).
|
||||
- Qt apps (Dolphin, Telegram, TeamSpeak) use Kvantum with the palette (was
|
||||
adwaita-dark).
|
||||
- Hyprland borders, groups and shadows use the palette (blue/surface; they were
|
||||
the Hyprland default cyan/grey).
|
||||
- Noctalia uses the `stylix` palette and WezTerm the generated `stylix` scheme;
|
||||
bat, btop, fzf, starship, mpv and zathura follow the palette.
|
||||
|
||||
## Claude Code tools
|
||||
|
||||
`modules/ai/claude-code.nix` is a home-manager-only aspect (`claude-code`, listed
|
||||
in `host.nix`). It installs, for the owner (user scope):
|
||||
|
||||
| What | Details |
|
||||
|---|---|
|
||||
| `claude` | Claude Code from nixpkgs (unfree, allowed in `core`) |
|
||||
| MCP `codememory` | codebase-memory-mcp (DeusData), a code knowledge graph; the CLI is on PATH, indexes live in `~/.cache/codebase-memory-mcp`. To use another server, replace this one `mcpServers` entry |
|
||||
| MCP `serena` | Serena, semantic code retrieval and editing; the `serena` flake input pinned to a release tag, started per project (`--project-from-cwd`, no browser dashboard) |
|
||||
| MCP `rea` | REA (Reverse Engineer Anything), `npx --yes rea-agents@<pinned version> mcp`; wrapper `rea` on PATH, plus REA's skill `reverse-engineer-anything` from the same npm release |
|
||||
| plugin `caveman` | skills, commands, agents and hooks (JuliusBrussee/caveman at a pinned tag); its default mode is off, `/caveman` turns it on per session |
|
||||
|
||||
Where it lands in the home:
|
||||
|
||||
- `~/.claude/settings.json`: merged on every switch and still writable
|
||||
(`mutableSettings`); the aspect only sets `env.MCP_TIMEOUT`. It sets no model,
|
||||
effort, permissions or hooks, so a repository's own `.claude/settings.json`
|
||||
applies as before.
|
||||
- `~/.claude/skills/claude-code-home-manager` (home-manager's generated plugin
|
||||
that carries the three MCP servers; their tools are named
|
||||
`mcp__plugin_hm_<server>__<tool>`), `~/.claude/skills/caveman` and
|
||||
`~/.claude/skills/reverse-engineer-anything`.
|
||||
- `~/.config/caveman/config.json` = `{"defaultMode": "off"}`, written once if
|
||||
missing (caveman may change it later).
|
||||
- On PATH: `codebase-memory-mcp`, `serena`, `rea` and `node` (caveman's hooks need
|
||||
it). `~/.claude.json` (Claude Code's own state) is not touched.
|
||||
|
||||
What is not hermetic or worth knowing:
|
||||
|
||||
- **REA runs from npm**: the first start downloads the pinned version and its
|
||||
dependencies into `~/.npm` (needs network; the dependency tree is not pinned).
|
||||
Its prebuilt native binaries rely on `programs.nix-ld` (enabled). REA's skill
|
||||
and caveman are fetched with fixed hashes.
|
||||
- **Serena writes `.serena/` into every project it activates** (it is in this
|
||||
repository's `.gitignore`). It is built locally from its lock file, not
|
||||
downloaded from a binary cache, so the first switch takes longer.
|
||||
- Plugins run code: caveman's hooks run `node` scripts in every session.
|
||||
- The first switch moves existing files at these paths to `*.hm-backup` (not
|
||||
`settings.json`, which is merged).
|
||||
|
||||
Bump a pin:
|
||||
|
||||
- Serena: change the tag of the `serena` input in `flake.nix`, then
|
||||
`nix flake update serena`.
|
||||
- REA: change `reaVersion` in `modules/ai/claude-code.nix`, then
|
||||
`nix store prefetch-file --unpack --hash-type sha256 https://registry.npmjs.org/rea-agents/-/rea-agents-<version>.tgz`
|
||||
and put the printed hash into `hash`.
|
||||
- caveman: change `tag`, then `nix flake prefetch github:JuliusBrussee/caveman/<tag>`
|
||||
and put its hash into `hash`.
|
||||
|
||||
## Day-2
|
||||
|
||||
```sh
|
||||
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
|
||||
nh os switch # rebuild + activate (flake: ~/nixos-config); also nh os boot | nh os test
|
||||
nix run .#switch # the same through the repo helper switch-system (-- boot | test)
|
||||
nix flake update # new inputs, then switch (one input: nix flake update stylix)
|
||||
nix fmt # nixfmt over the whole tree
|
||||
nix flake check --no-build # evaluates every check, including the whole desktop host
|
||||
nix build .#checks.x86_64-linux.nixos-desktop # builds the whole system without activating it
|
||||
```
|
||||
|
||||
`nix flake check --no-build` builds nothing, so a failure that only shows at
|
||||
build time (for example Noctalia validating its generated `config.toml`) appears
|
||||
in the `nixos-desktop` build or in the switch itself. After `nix flake update`
|
||||
build first.
|
||||
|
||||
Roll back: pick an older generation in the boot menu, or
|
||||
`sudo nixos-rebuild switch --rollback`.
|
||||
|
||||
@@ -216,30 +510,62 @@ 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`.
|
||||
then add `Projects = { };` to `homeFolders` in `modules/hosts/desktop/disks.nix`
|
||||
(subvolume name defaults to `@projects`) and switch.
|
||||
|
||||
**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.
|
||||
|
||||
### Verify in a fresh session
|
||||
|
||||
From the repository root of a fresh clone or shell (new files must be
|
||||
`git add`ed first), these confirm that the configuration evaluates:
|
||||
|
||||
```sh
|
||||
nix flake check --no-build # ends with: all checks passed!
|
||||
nix eval --raw .#nixosConfigurations.desktop.config.system.build.toplevel.drvPath
|
||||
nix eval --raw .#packages.x86_64-linux.iso.drvPath
|
||||
nix build .#checks.x86_64-linux.formatting # nixfmt check, same formatter as `nix fmt`
|
||||
nix flake show # the outputs listed under "Flake outputs"
|
||||
```
|
||||
|
||||
The two `nix eval` lines print a `/nix/store/...-nixos-system-desktop-26.11...drv`
|
||||
and the ISO's `.drv`. The only warnings to expect are `stdenv.isLinux is
|
||||
deprecated` and `stdenv.isDarwin is deprecated` (Serena's pinned uv2nix and
|
||||
another input), `unknown flake output 'modules'` (the flake-parts `modules`
|
||||
output), and, until `secrets/gitea-runner-token.age` and
|
||||
`secrets/tg-ws-proxy-secret.age` exist, one warning each for the runner and the
|
||||
Telegram proxy.
|
||||
|
||||
## 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;` in `hosts/desktop/default.nix` and run
|
||||
`switch-system boot`. `sbctl enroll-keys` refusing to run means the firmware
|
||||
is not in Setup Mode.
|
||||
the firmware and boot. To go back to plain systemd-boot replace `secure-boot`
|
||||
with `systemd-boot` in the `imports` list of `modules/hosts/desktop/host.nix`
|
||||
and run `nh os boot` (or `nix run .#switch -- boot`); the installer's closing
|
||||
hint still names the old option for this, follow this README instead.
|
||||
`sbctl enroll-keys` refusing to run means the firmware is not in Setup Mode.
|
||||
- **Secrets do not decrypt** (no password, no `~/.ssh/id_ed25519`). The host key
|
||||
in `secrets/secrets.nix` must match `/etc/ssh/ssh_host_ed25519_key.pub` on the
|
||||
machine. Test: `sudo age -d -i /etc/ssh/ssh_host_ed25519_key secrets/<name>.age`.
|
||||
Fix `secrets.nix`, re-encrypt (`agenix -r -i <your key>`), `git add`, switch.
|
||||
Meanwhile log in with `changeme` (when no password secret is defined) and
|
||||
run `passwd`.
|
||||
- **The Gitea runner or the Telegram proxy is gone after a switch.** The two
|
||||
service secrets do not exist yet; see "Secrets" under First-time setup. The
|
||||
evaluation warning names the missing file.
|
||||
- **The SSD is missing or fails.** Its mounts use `nofail` and a 10 s timeout, so
|
||||
the system still boots from the NVMe. Files written to `~/Games` meanwhile 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 add` it.
|
||||
- **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`.
|
||||
- **Slow first build / compiling Hyprland, Noctalia or Serena.** The binary caches in
|
||||
`flake.nix` (`nixConfig`) must be accepted; use `--accept-flake-config`. Serena
|
||||
is always built locally.
|
||||
- **A switch stops at an existing `*.hm-backup` file.** Home-manager moves files
|
||||
it now manages (GTK/Qt/Kvantum configs, `~/.claude/skills/*`) to `*.hm-backup`
|
||||
and refuses to overwrite an older backup: look at it, then delete it.
|
||||
- **WezTerm starts with default colours or fonts after an update.** WezTerm drops
|
||||
its whole config silently when a value does not parse (Stylix writes the
|
||||
palette). `WEZTERM_LOG=debug wezterm show-keys` must log `Reloaded configuration`.
|
||||
Reference in new issue
Block a user