Harden secret recipes, document Serena/REA caveats, overwrite stale home-manager backups

The Telegram secret recipes no longer depend on openssl (the host does not
install it): they read 16 bytes from /dev/urandom with od and check the
length before anything is encrypted, so a failure cannot store an empty
secret. README, secrets/README.md and the proxy-suite header and warning
agree.

README: Serena's dashboard is started but not opened and listens on
127.0.0.1 only; the nix-ld note for REA now distinguishes standalone npm
executables from .node add-ons; the Serena pin notes mention the
stdenv.isLinux/isDarwin warnings.

home-manager.overwriteBackup = true so a rewritten gtk.css or qt6ct.conf
does not make a later switch fail on an existing .hm-backup.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JZ16yf4acmaSiHq81vyQ6Z
This commit is contained in:
Claude committed 2026-10-13 01:43:30 +00:00
1 parent ca224d5e66
commit 9407c0e453
4 files changed
+34 -17

No files matched your search

+21 -10
View File
@@ -232,7 +232,7 @@ missing it generates new ones and saves them back to the stick.
| `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`) |
| `tg-ws-proxy-secret.age` | the hex secret (32 hex digits, generated below) | 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
@@ -248,8 +248,8 @@ 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
s=$(od -An -N16 -tx1 /dev/urandom | tr -d ' \n') && [ "${#s}" -eq 32 ] && 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
@@ -441,7 +441,7 @@ in `host.nix`). It installs, for the owner (user scope):
|---|---|
| `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 `serena` | Serena, semantic code retrieval and editing; the `serena` flake input pinned to a release tag, started per project (`--project-from-cwd`; the dashboard is started but not opened in a browser, and listens only on 127.0.0.1) |
| 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 |
@@ -464,19 +464,25 @@ 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 the `nix-ld` aspect. REA's skill
and caveman are fetched with fixed hashes.
Standalone executables shipped by npm packages rely on the `nix-ld` aspect;
`.node` add-ons loaded by the Nix-built `node` do not. 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).
`settings.json`, which is merged). `home-manager.overwriteBackup = true`
(`modules/core/home-manager.nix`) lets later switches replace an older
`*.hm-backup` instead of stopping.
Bump a pin:
- Serena: change the tag of the `serena` input in `flake.nix`, then
`nix flake update serena`.
`nix flake update serena`. Serena v1.7.0's own flake uses the deprecated
`stdenv.isLinux` / `stdenv.isDarwin` (the two warnings seen at every
evaluation); a future nixpkgs update may remove them and require bumping the
`serena` input.
- 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`.
@@ -575,8 +581,13 @@ Telegram proxy.
`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.
it now manages (GTK/Qt/Kvantum configs, `~/.claude/skills/*`) to `*.hm-backup`.
`home-manager.overwriteBackup = true` (`modules/core/home-manager.nix`)
replaces an older backup, so this should only happen if that setting was
removed: look at the backup, then delete it. Files such as
`~/.config/gtk-3.0/gtk.css` or `~/.config/qt6ct/qt6ct.conf` can be rewritten
by Noctalia's GTK template or the qt*ct tools; the next switch backs the
rewritten file up again.
- **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`.
+3
View File
@@ -10,6 +10,9 @@
useGlobalPkgs = true;
useUserPackages = true;
backupFileExtension = "hm-backup";
# gtk.css and qt6ct.conf may be rewritten by Noctalia's GTK template or qt*ct;
# without this a later switch fails ("would be clobbered") on the old .hm-backup.
overwriteBackup = true;
extraSpecialArgs = { inherit inputs; };
};
};
+3 -4
View File
@@ -1,6 +1,6 @@
# proxy-suite (github:FUFSoB/proxy-suite-flake): zapret DPI bypass, the
# Telegram WebSocket proxy and the GUI. The MTProto secret is an agenix secret:
# secrets/tg-ws-proxy-secret.age the secret (`openssl rand -hex 16`)
# secrets/tg-ws-proxy-secret.age the secret (32 hex digits)
# (nix run .#secret-from-file -- tg-ws-proxy-secret.age <file>)
# proxy-suite reads it through systemd LoadCredential, so root ownership is
# enough. Without the file the Telegram proxy stays off and a warning says so.
@@ -59,9 +59,8 @@ in
warnings = lib.optional (!hasTgSecret) ''
The Telegram WebSocket proxy (services.proxy-suite.tgWsProxy) is off:
secrets/tg-ws-proxy-secret.age is missing. Create a new secret with
`openssl rand -hex 16`, then `nix run .#secret-from-file -- tg-ws-proxy-secret.age <file>`
and `git add` it.
secrets/tg-ws-proxy-secret.age is missing. Create it with the command in
secrets/README.md (32 random hex digits) and `git add` it.
'';
};
}
+7 -3
View File
@@ -23,7 +23,7 @@ switched off, and the build prints a warning that names the missing file.
| File | Content | Used by | Without the file |
| ------------------------ | --------------------------------------- | ------------------------------------------------ | ------------------------------------------ |
| `gitea-runner-token.age` | One line `TOKEN=<registration token>` | `modules/dev/gitea-runner.nix` (`tokenFile`) | The runner "performance" is not configured |
| `tg-ws-proxy-secret.age` | The hex secret (`openssl rand -hex 16`) | `modules/network/proxy-suite.nix` (`secretFile`) | `services.proxy-suite.tgWsProxy` stays off |
| `tg-ws-proxy-secret.age` | The hex secret (32 hex digits) | `modules/network/proxy-suite.nix` (`secretFile`) | `services.proxy-suite.tgWsProxy` stays off |
Both are decrypted to `/run/agenix/<name>` (root, mode `0400`) and read by the
service units. No `.nix` file contains a secret value.
@@ -39,7 +39,9 @@ printf 'TOKEN=%s\n' "$t" | nix run .#secret-from-file -- gitea-runner-token.age
unset t
# Telegram proxy secret: a fresh random value.
openssl rand -hex 16 | tee /dev/stderr | nix run .#secret-from-file -- tg-ws-proxy-secret.age - -i ~/.ssh/id_ed25519
s=$(od -An -N16 -tx1 /dev/urandom | tr -d ' \n') && [ "${#s}" -eq 32 ] && echo "$s" >&2 \
&& printf '%s\n' "$s" | nix run .#secret-from-file -- tg-ws-proxy-secret.age - -i ~/.ssh/id_ed25519
unset s
```
The second command also prints the secret once, because the Telegram clients
@@ -55,5 +57,7 @@ new Telegram secret, and store the new values with the commands above. To
replace an existing file later, add `--force`:
```sh
openssl rand -hex 16 | nix run .#secret-from-file -- tg-ws-proxy-secret.age - --force -i ~/.ssh/id_ed25519
s=$(od -An -N16 -tx1 /dev/urandom | tr -d ' \n') && [ "${#s}" -eq 32 ] \
&& printf '%s\n' "$s" | nix run .#secret-from-file -- tg-ws-proxy-secret.age - --force -i ~/.ssh/id_ed25519
unset s
```