Commit Graph
2837 Commits
Author SHA1 Message Date
Ryan Yin 8b22aec1bb fix(restic): drop a stale btrfs snapshot before taking a new one
Cleanup runs as ExecStopPost, which a power loss mid-backup skips; the
leftover @restic-snapshot then failed every later run.

Assisted-by: Claude Code (claude-opus-5-5)
2026-11-01 10:51:51 -06:00
Ryan Yin 32620ed9db chore(aquamarine): drop pcie_aspm=off
It was a precaution for the R9700 links, never an observed problem, and
on BIOS 1013 the FADT already disables ASPM ("ACPI FADT declares the
system doesn't support PCIe ASPM"), so the parameter did nothing.

Assisted-by: Claude Code (claude-opus-5-5)
2026-11-01 10:51:51 -06:00
Ryan Yin dd2bd44bc2 fix(youko): apply /data tmpfiles in a pass of their own
89d7a9bd made systemd-tmpfiles-setup RequiresMountsFor the five nofail
USB-disk mounts. One failed mount then skipped every tmpfiles rule on the
host, and sysinit.target waited for the disks and the LUKS unlock even on
success.

Leave the boot-wide pass as upstream ships it and add data-tmpfiles:
`systemd-tmpfiles --prefix=/data` with WantsMountsFor on the /data mounts,
ordered before the services that use them.

Assisted-by: Claude Code (claude-opus-5-5)
2026-11-01 10:51:51 -06:00
Ryan Yin 905c3c6e1f docs(workarounds): retire WA-017, clarify WA-026, refresh WA-023
- WA-017: keyd(1) documents `control = layer(control)` etc. as the
  default modifier bindings, so a keyd bump will never keep right-hand
  modifiers distinct; the passthrough is intentional config. Say so in
  peripherals.nix and drop the row.
- WA-026: installOnHost + restarting microvm@<guest> is the fallback
  microvm.nix's own deploy.rebuild uses; only the in-place sshSwitch is
  broken, so the removal condition is now about that.
- WA-023: locked versions are 2.35.3 (latest) and 2.34.9 (stable).

Assisted-by: Claude Code (claude-opus-5-5)
2026-11-01 10:14:27 -06:00
Ryan Yin e4c2548a93 refactor: replace redundant mkForce with plain values and mkDefault
Each of these overrode a value nothing else set at a higher priority:

- qemu-guest: btrbk, hardwareTools and cloud-init have no competing
  definition on the guests.
- mdns: nixpkgs' sunshine module sets avahi.publish.* with mkDefault.
- computer-use: i18n now sets the time zone with mkDefault.
- darwin terminal: the shared ghostty/kitty font sizes are now mkDefault.
- shoukei: sunshine is mkDefault false in remote-desktop.nix, zram's
  memoryPercent is mkDefault 50; supportedFilesystems now merges instead
  of discarding the fsType entries other modules add.
- youko: nothing enables docker.
- nixpak: pasta.enable and sockets.pipewire are mkDefault in the shared
  modules, sockets.pulse already was.

Every NixOS host's toplevel drvPath is unchanged; on fern and frieren the
terminal font sizes and time zone evaluate to the same values.

Assisted-by: Claude Code (claude-opus-5-5)
2026-11-01 10:14:27 -06:00
Ryan Yin 4bd428776e fix(darwin): pass the Homebrew mirror env through onActivation.extraEnv
nix-darwin runs `brew bundle` as `sudo --preserve-env=PATH ... env ...`,
so the variables the mkBefore'd activation snippet exported never reached
brew; activation was using the default upstream endpoints. Set them via
homebrew.onActivation.extraEnv, which nix-darwin puts on the `env` command
line (evaluated on fern), and drop the snippet.

Assisted-by: Claude Code (claude-opus-5-5)
2026-11-01 10:14:27 -06:00
Ryan Yin a5fac14ab3 docs(workarounds): drop WA-034, removed with the gateway's fake-IP IPv6
bb899876 moved the proxy gateway to fake-IP for IPv6 and removed
aquamarine's getaddrinfo precedence table, so the row's removal condition
has been met since 2026-10-14; only the row and a comment pointer lingered.

Assisted-by: Claude Code (claude-opus-5-5)
2026-11-01 10:14:27 -06:00
Ryan Yin f7a92ac704 chore(nvme): drop default_ps_max_latency_us=100000, the kernel default
drivers/nvme/host/core.c defaults default_ps_max_latency_us to 100000, so
the "relaxed" APST cap on ai and its copy on aquamarine set the value the
kernel already uses. Keep ai's history and rollback recipe as a comment,
and stop the aquamarine pcie_aspm=off comment from citing WA-008, which
never covered it. Removes WA-008.

Assisted-by: Claude Code (claude-opus-5-5)
2026-11-01 10:14:27 -06:00
Ryan Yin b5c573592b chore(ai): drop the nvidia-drm.fbdev kernel param the module already sets
hardware.nvidia.modesetting.enable makes nixpkgs' nvidia module add
nvidia-drm.modeset=1 and, for drivers >= 545, nvidia-drm.fbdev=1 to
moduleParams, which reach modprobe via extraModprobeConfig (evaluated:
"options nvidia-drm fbdev=1 modeset=1" on ai with 595.x).

Assisted-by: Claude Code (claude-opus-5-5)
2026-11-01 10:14:27 -06:00
Ryan Yin 455c03d1fd chore(security): drop the Comodo AAA root blacklist both platforms now carry
nixpkgs' security/ca.nix and nix-darwin's security/pki module both append
"Comodo AAA Services root" to the cacert blacklist themselves, so the
explicit entry only duplicated it. Removes WA-040.

Assisted-by: Claude Code (claude-opus-5-5)
2026-11-01 10:14:27 -06:00
Ryan Yin 1904323e38 chore(tuios): use the nixpkgs package instead of the upstream flake
nixpkgs packages tuios 0.11.1, the same tag the flake input pinned, so
the extra input (and its nix-fast-build/treefmt-nix lock entries) only
duplicated it. Removes WA-005.

Assisted-by: Claude Code (claude-opus-5-5)
2026-11-01 10:14:27 -06:00
Ryan Yin 993dbee7ab chore(smartctl-exporter): drop the #329 pin now that nixpkgs ships 0.15.0
nixpkgs packages smartctl_exporter 0.15.0, which contains PR #329. The
overlay pinned 6274decc ("0.14.0-unstable-2026-09-28"), so it had been
downgrading the package since the last nixpkgs bump. Removes WA-001.

Assisted-by: Claude Code (claude-opus-5-5)
2026-11-01 10:14:27 -06:00
Ryan Yin 88ff500dfc chore(wechat): use nixpkgs-master now that NixOS/nixpkgs#560225 is merged 2026-11-01 23:34:00 +08:00
ryan4yin | 二花 5c4318b2c9 feat(aquamarine): suspend after idle & wake-on-lan (#503) 2026-11-01 23:28:47 +08:00
ryan4yin | 二花 0888f87075 feat(power): monitor homelab power and reduce aquamarine idle draw (#501)
Assisted-by: DeepSeek Harness (deepseek-flash)
2026-11-01 20:53:41 +08:00
Ryan Yin a97400df69 fix(systemd): sandbox privileged hardware oneshots
Assisted-by: DeepSeek Harness (deepseek-flash)
2026-11-01 20:49:51 +08:00
Ryan Yin e0cb3eab75 fix(grafana): restore datasources and GPU power metric
Assisted-by: DeepSeek Harness (deepseek-flash)
2026-11-01 20:49:05 +08:00
ryan4yin | 二花 bc0df6a800 fix(openrgb): apply declarative off profile at boot (#502)
Assisted-by: DeepSeek Harness (deepseek-flash)
2026-11-01 20:31:02 +08:00
ryan4yin | 二花 f3b741f5a0 feat(builders): enable aquamarine on remaining physical hosts (#500)
Enable the existing remote-builder module on shoryu, shushou and
youko, and authorize their SSH host keys on aquamarine.

Kana and Ruby are VM guests with no need to build; leave their local
store and build behavior unchanged.

Assisted-by: DeepSeek Harness (deepseek-flash)
2026-11-01 04:44:43 -06:00
ryan4yin | 二花 58d1af8f9d feat(youko): add pull-through cache for two Nix upstreams (#499)
Run nginx on youko as a loopback pull-through HTTP cache for
cache.nixos.org and cache.numtide.com, exposed by Caddy at
https://nix-cache.writefor.fun.

Assisted-by: DeepSeek Harness (deepseek-flash)
2026-11-01 18:27:43 +08:00
Ryan Yin 9fe86de51d flake.lock: Update
Flake lock file updates:

• Updated input 'llm-agents':
    'github:numtide/llm-agents.nix/e452052b9efb54fd59f8a06cbc09978fb542a3c2?narHash=sha256-pU0HWLzBuoGIYLMIjoZNqiALCAUl9JwV6ujIyOZO3i4%3D' (2026-10-29)
  → 'github:numtide/llm-agents.nix/8efcba308a6b12a92441cb4df624e484bad9e18a?narHash=sha256-i4UBJIugcPJxG4xKnlsypbTb8QfPX%2BkagQYF9oswO/c%3D' (2026-11-01)
• Updated input 'llm-agents/nixpkgs':
    'github:NixOS/nixpkgs/e62746b0b472753ef019baceab6f1e2e52014980?narHash=sha256-sx1f99WGrDfJ83KKuQrqGPmot0rnDgmpLJDzpU2oHQQ%3D' (2026-10-28)
  → 'github:NixOS/nixpkgs/885ba4d038f10c3d17d7a92e8c3cc185b99c9158?narHash=sha256-e/yiZ31gXRROBDcnOtT3YwDQ73NVG9Cepccbt86LIn8%3D' (2026-10-30)
2026-11-01 16:58:11 +08:00
Ryan Yin af084f1eb4 feat(npm): use npmmirror for npm fetches
Set the user-level npm/pnpm registry to npmmirror, and make Nix builds use the same mirror through nixpkgs' npmRegistryOverrides and rewriteURL. The configured Nixpkgs policy is also applied to myNurPkgs and Colmena's nodeNixpkgs so NUR packages such as dsh use the mirror while preserving Colmena parity.
2026-11-01 16:57:57 +08:00
ryan4yin | 二花 89d7a9bd82 fix(youko): wait for data mounts before tmpfiles setup (#498)
systemd-tmpfiles-setup only orders itself after local-fs.target, but the nofail /data submounts can complete later. It then sees /data as the read-only fallback tmpfs and fails to create the Transmission, Immich, RustFS and restic directories at boot.

Add RequiresMountsFor for the data mounts and cover the generated unit dependency with an eval test.
2026-11-01 16:36:00 +08:00
ryan4yin | 二花 c277c81cd6 feat(nixpak): sandbox six desktop apps (#497)
* feat(nixpak): sandbox six desktop apps

* chore(nixpak): trim OBS plugin set

* fix(nixpak): enable OBS on aarch64

* fix(nixpak): let imv read the full home directory

* fix(home): drop redundant freerdp package

* fix(nixpak): grant OBS access to V4L2 camera devices

* fix(nixpak): expose V4L2 sysfs to OBS

* fix(nixpak): expose NVIDIA encode library to OBS

* docs(nixpak): record OBS interactive validation

* docs(nixpak): record OBS RTMP validation

* fix(nixpak): run MuseScore via XWayland and PulseAudio

* docs(nixpak): explain app sandboxing rationale

* fix(nixpak): route MuseScore ALSA through PipeWire
2026-11-01 01:24:47 -05:00
Ryan Yin 5e5ceae108 docs(nixpak): record slicer runtime validation 2026-11-01 11:52:08 +08:00
Ryan Yin 98d1c2d6e7 fix(nixpak): allow WebKit network portals for slicers 2026-11-01 11:46:58 +08:00
ryan4yin | 二花 c3990cc4be feat(nixpak): sandbox Bambu Studio and OrcaSlicer (#495)
Assisted-by: DeepSeek Harness (deepseek-flash)
2026-11-01 11:43:35 +08:00
ryan4yin | 二花 1a939e2c9a fix(nixpak): use host fontconfig in sandboxes (#496)
Reuse the host fontconfig for Nixpak GUI apps so host and sandboxed apps resolve fonts consistently.

Assisted-by: DeepSeek Harness (deepseek-flash)
2026-11-01 11:26:25 +08:00
Ryan Yin d54b49b799 docs(nixpak): document intentional Firefox media limits 2026-11-01 10:49:52 +08:00
ryan4yin | 二花 3e6d89b3c4 feat(nixpak): sandbox Foliate and Krita (#494)
Assisted-by: DeepSeek Harness (deepseek-flash)
2026-11-01 10:34:47 +08:00
ryan4yin | 二花 090a7b622b refactor(nixpak): split policy checks into per-app suites (#493)
* refactor(nixpak): split policy checks into per-app suites

Make hardening/tests/policy.nix a small loader that auto-discovers one suite per app under hardening/tests/policy. Shared checks live in policy-lib.nix and common expectations are generated by mkAppPolicy; app files only declare differences and special cases. The loader also discovers wrappers from hardening/nixpaks and fails when wrapper/suite inventory or check names diverge.

Assisted-by: DeepSeek Harness (deepseek-flash)

* fix(nixpak): reject duplicate per-app policy checks

mkAppPolicy merges generated and custom checks, so an extraChecks key could silently override a standard assertion. Fail explicitly when a per-app check name is defined twice.

Assisted-by: DeepSeek Harness (deepseek-flash)
2026-11-01 10:05:15 +08:00
Ryan Yin 7a00fead7d fix(tuios): force xterm-kitty inside panes 2026-11-01 09:43:04 +08:00
Ryan Yin 9152e82916 chore(niri): remove pyclipsync clipboard bridge
WeChat and QQ now use native Wayland, so the X11/Wayland clipboard bridge
is no longer needed. Remove the flake input, home-manager module wiring,
lock entries, and stale documentation reference.

Assisted-by: DeepSeek Harness (deepseek-flash)
2026-11-01 09:37:15 +08:00
Ryan Yin 87b7a23cf3 docs(nixpak): consolidate runtime validation notes
Merge the three runtime-validation files into one concise record, update the interactive browser and Zoom results, and document the intentional Chromium host-loopback and Brave/Edge no-media exceptions. Tighten the remaining cookie-crypto workaround and the smoke-test prerequisites.

Assisted-by: DeepSeek Harness (deepseek-flash)
2026-11-01 09:24:23 +08:00
ryan4yin | 二花 ccffddc864 feat(wechat): native nixpkgs package with app-scoped data (#492)
Switch to the native deb package from nixpkgs-patched (#560225), remove the AppImage/FHS bwrap layer, and enable native Wayland while keeping the X11 fallback.

Keep only WeChat state under one app-scoped HOME and bind the host Documents and Downloads directories like the other desktop apps. User-selected files also go through the XDG FileChooser portal. Remove the launcher, activation script, and compatibility symlinks.

Assisted-by: DeepSeek Harness (deepseek-flash)
2026-11-01 00:09:27 +08:00
Ryan Yin 30cb22500f fix(niri): route Zoom screen sharing through xdg-desktop-portal-wlr 0.8.2
niri 26.04 exposes DMA-BUF only, which Zoom 7.2.1 rejects. xdg-desktop-portal-wlr 0.8.2 provides the working SHM path; 0.8.4 regresses Zoom SelectSources.

Assisted-by: DeepSeek Harness (deepseek-flash)
2026-10-31 22:44:16 +08:00
ryan4yin | 二花 818965a11f feat(nixpak): unify desktop app sandboxes (#491)
* refactor(nixpak): unify desktop app sandboxes

Move common GUI, portal, and network policy into reusable modules and migrate browsers plus Zoom/WeChat/QQ/Telegram to the same boundary.

Assisted-by: DeepSeek Harness (deepseek-flash)
2026-10-31 22:27:58 +08:00
ryan4yin | 二花 707da35996 feat(nixpak): clear env, drop system bus, isolate network (#490)
* fix(nixpak): stop exposing the system D-Bus to apps
* fix(nixpak): bind only the PulseAudio socket
* feat(nixpak): run apps in a new session tied to the launcher
* feat(nixpak): start apps from an allowlisted environment
* feat(nixpak): isolate app networking with pasta
* fix(nixpak): keep Firefox on the host network

Assisted-by: Claude Code (claude-opus-5-5)
2026-10-31 16:39:25 +08:00
ryan4yin | 二花 3a6f03814e Merge pull request #489 from ryan4yin/harden-incident-110
feat(security): harden homelab SSH, service sandboxing and audit trail
2026-10-31 01:12:55 +08:00
Ryan Yin 56edac8252 fix(transmission): grant the AppArmor lock permission
nixpkgs' transmission 4.1.4 profile grants rw on the daemon's config directory
but not k, while 4.1.4 takes a fcntl lock on
~/.config/transmission-daemon/lock, so the daemon exited at startup with
"Another process is already using". Include rwk for that one file only.

WA-044, drop once the nixpkgs profile carries the permission.

Assisted-by: Claude Code (claude-opus-5-5)
2026-10-31 01:09:16 +08:00
Ryan Yin 560a6cc2d8 fix(preservation): mount /etc/ssh in initrd so key changes apply on boot
NixOS copies mode-carrying /etc entries such as authorized_keys.d during
stage-2 activation, which runs before systemd starts. preservation mounted the
persisted /etc/ssh from preservation.target afterwards and hid that copy, so a
key change only took effect on `switch`: revoking a key and rebooting silently
restored the old one.

Prepare the mount in initrd, before activation runs, and cover it with a VM
test that seeds a stale authorized_keys file, reboots, and asserts the declared
key replaced it. The same test fails on that assertion with inInitrd disabled.

Verified on all four hosts: /persistent/etc/ssh/authorized_keys.d/root is now
rewritten at boot instead of keeping the timestamp of the last switch.

Assisted-by: Claude Code (claude-opus-5-5)
2026-10-31 01:09:16 +08:00
Ryan Yin 7dc4e7a39f feat(security): harden homelab SSH, services and audit trail
The homelab hosts accept root SSH with long-lived file keys, run several
exposed services with almost no systemd sandboxing, and keep no audit trail of
privileged actions. Close those three gaps, weighing each measure against its
cost instead of adopting a policy wholesale.

SSH
- Turn off KbdInteractiveAuthentication: nixpkgs defaults it to true and PAM
  then still accepts the Unix password despite PasswordAuthentication = false.
- authorizedKeysInHomedir = false: only keys declared in Nix take effect;
  youko keeps Gitea's forced-command file through `Match User gitea`.
- Pin aquamarine's passphrase-free remote-builder keys to
  `restrict,command="nix-daemon --stdio --store daemon"`, so builds run in the
  system daemon instead of an audited root login session.

systemd sandboxing
- Add the mylib.systemdHardening preset and apply it to the exposed, weakly
  sandboxed services: caddy 7.8 -> 1.5, vmalert 8.2 -> 1.4, rustfs 6.6 -> 1.4,
  whisper-asr 7.7 -> 1.6. An eval test pins the key restrictions.
- Rejected: a global all-keys policy (<=0.2 score gains on services nixpkgs
  already sandboxes) and per-service confinement (bind paths to maintain).

auditd on all four hosts, reusing nixpkgs' loader and unit
- Audit login sessions only: a first `-a never,task -F auid=unset` rule keeps
  services out of the per-syscall audit path. A compromised service is
  therefore unrecorded until it opens a session.
- Record root commands, credential and host-key access, writes to SSH, account,
  PAM, Nix-trust and audit configuration, module loads and session denials.
- Rejected: global denial logging, service-UID watches and
  --loginuid-immutable (the kernel already records loginuid changes).

Verified on all four hosts after deployment: zero failed units, k3s 6/6 Ready,
and the exposed services healthy.

Assisted-by: Claude Code (claude-opus-5-5)
2026-10-31 01:09:15 +08:00
Ryan Yin 0376697cef docs(agents): record why rules omit principle names 2026-10-30 18:59:09 +08:00
Ryan Yin def7d8f754 feat(niri): enable on-demand VRR for games
Turn on adaptive sync at the output only when a game window opts in, keeping desktop compositing fixed-rate to avoid idle/low-load VRR flicker. The Steam/Proton game rule enables VRR alongside the fullscreen rule.

Assisted-by: DeepSeek Harness (deepseek-flash)
2026-10-30 00:47:51 +08:00
Ryan Yin 005627d883 fix(niri): let untitled Proton windows go fullscreen
XWayland/Proton windows can commit before they set a title. Excluding empty titles made Phantom Blade Zero miss the fullscreen rule and stay composited. Keep excluding the launcher announcement popup by title.

VRR is intentionally not enabled here: on-demand VRR caused display corruption in this game and is tracked separately.

Assisted-by: DeepSeek Harness (deepseek-flash)
2026-10-30 00:46:22 +08:00
ryan4yin | 二花 e8e9691f2d chore(nix): update nixpkgs to e62746b and refresh flake inputs (#488)
* chore(nix): update nixpkgs to e62746b and fix 26.11 breakage

Bump nixpkgs to e62746b and preservation to 00be7f7, then adapt to the removals and renamed options in the new revision: drop the removed boot.initrd.systemd.enable settings, trim the stale emSign CA blacklist on Linux while keeping it for the older Darwin input, and migrate Avahi publishing to settings.publish. Work around sunshine still setting the legacy Avahi options and keep dsh-nu on its tested Nushell 0.115.1. Patch NUR dsh's pnpm call to pass nodejs = null, and update pyclipsync for the stdenv.hostPlatform.system rename.

* chore(nix): refresh flake inputs for 26.11

- update nixpkgs-darwin to the same e62746b revision as nixpkgs
- make dsh-nu follow main nixpkgs and patch its testedWith manifest for the resolved Nushell
- refresh floating inputs; update lanzaboote, tuios, and ponytail
- drop the nixpkgs-2505 and rust-overlay workarounds
- keep pyclipsync on main and simplify the cross-platform CA blacklist
- adopt home-manager's Nushell loadSessionVariables default

* fix(gitea): use ROOT_URL for nixpkgs 26.11

nixpkgs removed the legacy settings.server.DOMAIN option; the existing ROOT_URL already carries the public URL.

* chore(nix): update dsh-nu to 0.7.0

Assisted-by: DeepSeek Harness (deepseek-flash)
2026-10-30 00:39:01 +08:00
Ryan Yin 4fcdb79719 docs(agents): answer challenges before continuing work
A user question or challenge is the current task; resolve it before doing unrelated work.

Assisted-by: DeepSeek Harness (deepseek-flash)
2026-10-29 21:40:46 +08:00
Ryan Yin ba1515f094 docs(agents): ask for SSH access instead of falling back
A missing GitHub SSH key is a credential boundary, not a reason to switch transports silently.

Assisted-by: DeepSeek Harness (deepseek-flash)
2026-10-29 21:39:16 +08:00
Ryan Yin 13afe01441 docs(agents): prefer upstream fixes over local workarounds
Clarify that minimality means the smallest best-practice change, not a local patch around an upstream defect.

Assisted-by: DeepSeek Harness (deepseek-flash)
2026-10-29 21:37:41 +08:00
Ryan Yin 7e579d6aca fix(monitoring): order nvidia exporter after network-online
The nvidia exporter binds the host's static LAN IPv4, but unlike the node and smartctl exporters it was not ordered after network-online.target. On boot it lost the race with networkd, hit the systemd start limit, and stayed failed until manually restarted.
2026-10-29 21:28:08 +08:00