Commit graph

101 commits

Author SHA1 Message Date
Sridhar Ratnakumar
776c4425b0 incus-pet: shared /nix/store, restart-to-deploy, drop anywhen flake input
The incus-pet CLI gains three big changes that together cut per-container
disk usage by ~5GB, drop nix-rebuild + nix-copy from the deploy path, and
make `deploy` actually pull latest on every invocation. anywhen migrates
from a host-installed service to an incus-pet container in the process.

* Shared /nix/store mount. Each container gets host's /nix/store
  bind-mounted read-only (with shift=true for idmapped unprivileged
  containers). Zero per-container duplication of nixpkgs closures. The
  CLI builds toplevels on the host; the container sees them via the
  shared mount, no `nix copy` needed.

* Restart-to-deploy. switch-to-configuration is removed entirely (it
  was stalling on dbus-broker reload and hitting the same lock-
  contention bug across redeploys). New activation: update
  /nix/var/nix/profiles/system, repoint /sbin/init through the profile
  symlink, `incus restart`. The new toplevel's own init script handles
  /etc setup on boot. Trade-off: ~5s of container reboot per deploy.

* Marshaling flake exposes only nixosModules.default. No nixpkgs
  input, no nixosConfigurations entry. The CLI picks nixpkgs at build
  time (pinned to nixos-25.11 — matches the LXC image baseline, dodges
  unstable regressions) and assembles the full nixosSystem via
  `nix build --impure --expr`. Lets us bump nixpkgs without touching
  per-deploy state.

* `nix flake update --refresh` on every deploy. Was `nix flake lock`,
  which only locks first-seen inputs — re-deploying `github:srid/anywhen`
  stayed pinned at the first commit ever resolved. Now every deploy
  bumps the target input to the current tip of its ref and bypasses
  nix's fetcher cache.

* /sbin/init repoint. The NixOS LXC image hard-links /sbin/init to its
  own toplevel's init path. Without switch-to-configuration, `incus
  restart` re-execs that old init, which sets up /etc from the old
  toplevel — running services keep using the OLD anywhen binary even
  though the profile pointer moved. CLI now also does
  `ln -sfn /nix/var/nix/profiles/system/init /sbin/init` so the profile
  actually drives boot. Idempotent.

* Host gcroot via `nix-store --add-root --indirect`. Container's nix DB
  doesn't know about the path (it lives behind the shared mount), so
  without a host-side gcroot the host could nix-collect-garbage the
  running system out from under the container. Symlink at
  ~/.local/state/incus-pet/<name>/system. Only the LATEST toplevel is
  pinned per app — no rollback today (file a 5-line ring buffer when
  rollback matters).

* anywhen flake input removed. `modules/nixos/linux/anywhen.nix` is
  gone; the host config no longer imports anywhen as a flake input.
  The deploy command takes the flake ref as an argument, so locking it
  here was just bloat. `just pureintent anywhen-deploy` runs the
  current invocation.

* pureintent ops recipes. New `configurations/nixos/pureintent/mod.just`
  with anywhen-{deploy,rm,backup,restore,status,shell}. Namespaced via
  `mod pureintent` so each host's recipes live behind their own prefix.

* Drop ssh from deploy path. Bootstrap still pushes the operator's
  pubkey (for interactive debugging), but activation goes through
  `incus exec` exclusively. No NIX_SSHOPTS, no nix-copy-via-ssh,
  no host-key TOFU dance during deploys.

Tested end-to-end on pureintent: anywhen migrated from host-installed
(21-task SQLite DB at /var/lib/anywhen) to an incus-pet container with
the DB intact; hello-web deployed fresh with shared /nix/store; both
serve over the tailscale proxy at 100.122.32.106:{6111,8081}; lock
bumps + new toplevels confirmed after master advances.
2026-05-23 18:50:10 -04:00
Sridhar Ratnakumar
0794bcc151
incus-pet: per-app incus container CLI; drop webapps/ (#118)
* incus-pet: per-app incus container CLI ("pet PaaS"); drop webapps/

Phase 1 of the incus-pet design. Adds the deployment infrastructure
under modules/nixos/linux/incus/ — a CLI, a container-essentials NixOS
module, a SKILL.md for agent-driven adoption — and deletes the webapps/
tree (nspawn-based, weaker isolation defaults, no live consumers).

Pairs with srid/anywhen#15 (nixosModules.incus on the anywhen flake)
for end-to-end deployment of anywhen as an incus container.

Surface added:

- modules/nixos/linux/incus/container.nix    container essentials
  (sshd, hostname, flakes, firewall, base packages); imported by the
  marshaling flake incus-pet generates per app
- modules/nixos/linux/incus/incus-pet/       CLI tree:
    default.nix   writeShellApplication; subcommands deploy/list/rm
    SKILL.md      3-branch agent recipe (deploy / wrapper / add
                  contract upstream)
    README.md     human docs with the full network-model section
- modules/flake-parts/incus-pet.nix          exposes packages.incus-pet

Surface removed:

- modules/nixos/linux/anywhen.nix            anywhen runs as a
  container now, not as a host-installed service
- configurations/nixos/pureintent            drops the anywhen import
  and the services.anywhen.host wiring
- webapps/                                   deleted entirely

Port convention: every containerized service binds 8080 inside its
own netns. The host-side <listen-ip>:<host-port> is unique per app,
chosen at first deploy via --port + --listen (or INCUS_PET_LISTEN
env), and recorded in container metadata so re-deploys are flagless.

Run:
  nix run .#incus-pet -- deploy github:srid/anywhen \
    --port 7700 --listen 100.122.32.106

See modules/nixos/linux/incus/incus-pet/README.md for the operator
flow and the network model in full.

* incus-pet: fixes discovered while deploying the hello-web example

Three small fixes that fall out of doing the first live deploy on
pureintent. None change the design — they make the documented flow
actually work against the real images:nixos/25.11 container image and
the real `nixos-rebuild --target-host` activation path.

* container.nix imports `${modulesPath}/virtualisation/lxc-container.nix`
  so the rebuilt config knows it's a container — without it,
  `nixos-rebuild` fails the `boot.loader.grub.devices` / `fileSystems`
  assertions. Same module the upstream NixOS incus image's
  /etc/nixos/configuration.nix imports.

* container.nix carries the same dbus-broker reload workaround
  pureintent already has (NixOS#180175-ish symptom — broker has long-
  lived clients holding the bus, reload times out,
  switch-to-configuration exits 4 despite activation succeeding).

* incus-pet/default.nix:
  - bootstrap step simplified: the official nixos/25.11 image already
    runs sshd via systemd socket activation on :22 — we only need to
    push the operator's pubkey. The earlier in-container
    `nixos-rebuild switch` is unnecessary (and breaks because the
    image ships without a nixpkgs channel).
  - `NIX_SSHOPTS='-o StrictHostKeyChecking=accept-new'` for the
    --target-host rebuild (fresh containers have fresh host keys).
  - `incus config set <name> key=value` form (the space-separated
    form deprecated in incus 6.x; was emitting a warning per metadata
    key on every deploy).
  - Image baseline `images:nixos/25.05` → `images:nixos/25.11`
    (25.05 isn't published on the LXC image server; 25.11 is the
    current stable).

End-to-end verified: `incus-pet deploy github:srid/anywhen` deploys
into a container reachable on the host's tailscale IP; the same path
works for the hello-web example (stacked PR).

* incus-pet: hello-web example flake — minimal contract demonstration

Self-contained reference under
modules/nixos/linux/incus/incus-pet/example/hello-web/ that satisfies
the incus-pet contract in the smallest possible form:

  - packages.<sys>.default    a darkhttpd wrapper that serves a
                              one-page index.html, reading HOST/PORT
                              from the environment
  - nixosModules.default      services.hello-web.{enable, package,
                              host, port} + a DynamicUser=true systemd
                              unit
  - nixosModules.incus        the deploy contract: services.hello-web
                              bound to 8080, hostname "hello-web"

Useful as a copy-paste template for new apps. Less moving parts than
the anywhen reference (no bun, no SQLite, no state dir, no e2e tests
to keep green) — just three flake outputs and a static HTML response.

Live-deployed end-to-end on pureintent during this PR's bring-up:

  $ incus-pet deploy path:./.../example/hello-web hello-web \
      --port 8081 --listen 100.122.32.106
  $ curl http://100.122.32.106:8081/
  <!doctype html>
  <h1>Hello from incus-pet</h1>

Idempotent re-deploy verified (no flags needed — host-port + listen
read back from container metadata; container name auto-detected from
incus.container.hostname).

* incus-pet: drop anywhen wiring from this PR — defer to follow-up

Per request: keep this PR strictly to the incus-pet infrastructure +
the hello-web example. The anywhen migration (replacing the host-
installed services.anywhen on pureintent with an incus-pet container)
lands in a separate follow-up PR after srid/anywhen#15 merges.

Restored from master:
- modules/nixos/linux/anywhen.nix             (was deleted)
- configurations/nixos/pureintent/default.nix (had anywhen import
                                              + services.anywhen.host
                                              removed; now back)
- flake.nix anywhen.url                       (was repinned to
                                              incus-contract; back to
                                              abject-turn)
- flake.lock anywhen entry                    (matches the abject-turn
                                              pin again)

The hello-web example remains the live verification for this PR.
2026-05-23 16:28:46 -04:00
Sridhar Ratnakumar
f99a34959d i 2026-05-23 10:27:31 -04:00
Sridhar Ratnakumar
4c648e912c
Enable incus on pureintent (#113)
* Enable incus on pureintent, rename lxd.nix, drop unused flake-parts

- Add incus module import to pureintent and bind the UI to its
  Tailscale IP (no firewall change needed since tailscale0 is trusted).
- Rename modules/nixos/linux/lxd.nix -> incus.nix since the module
  configures virtualisation.incus, and enable the bundled web UI.
- Drop the unused modules/flake-parts/incus-image helper; the
  `images:nixos/*` community images cover container/VM launches.

* Move incus module into a directory with a README

The troubleshooting notes used to live as comments in the module; they
belong in docs alongside a quick-start on launching containers/VMs and
configuring the UI listener.

* Expand incus README with VM gotchas

Document the sharp edges hit while bringing up a NixOS VM for the first
time: secureboot, memory/cpu/disk limits (with the error signatures
that point at each), configuring the guest (flakes, firewall), and a
three-step guide to exposing a service from inside.
2026-04-19 11:21:39 -04:00
Sridhar Ratnakumar
05abe3cb3e hm: backup always 2026-03-18 10:46:15 -04:00
Sridhar Ratnakumar
989628a919 Stuff 2026-01-19 13:46:26 -05:00
Sridhar Ratnakumar
12778e5393 beszel 2025-12-24 10:46:27 -05:00
Sridhar Ratnakumar
992dccbc0e bash 2025-09-08 02:57:22 +02:00
Sridhar Ratnakumar
e9c556ba9a vira: hm service 2025-09-08 00:45:52 +02:00
Sridhar Ratnakumar
2e88b90003 Unused 2025-09-07 16:40:08 -04:00
Sridhar Ratnakumar
a80f5d820f vira: up 2025-09-07 10:09:23 -04:00
Sridhar Ratnakumar
4fe4e73c52 Update vira 2025-09-06 16:56:39 -04:00
Sridhar Ratnakumar
3bc5b05c42 vira on nginx 2025-09-04 22:01:44 -04:00
Sridhar Ratnakumar
ae259fa0a2 pureintent: vira! 2025-09-04 21:05:59 -04:00
Sridhar Ratnakumar
0cd61dd5b3 emaletter: disable for now (key expired) 2025-09-03 11:28:02 -04:00
Sridhar Ratnakumar
8b1202be2b sudo: require password 2025-08-30 10:36:46 -04:00
Sridhar Ratnakumar
93370fe6a0 sudo: nah 2025-08-28 22:40:14 -04:00
Sridhar Ratnakumar
10c8e2992e Fix warnings 2025-08-27 12:22:05 -04:00
Sridhar Ratnakumar
2e54d35ed1 General cleanup: Not using Linux GUI 2025-08-24 13:47:55 -04:00
Sridhar Ratnakumar
10eb6ddfe4 vira: mv 2025-08-24 13:38:32 -04:00
Sridhar Ratnakumar
d5eaa97e36 et 2025-08-24 13:25:13 -04:00
Sridhar Ratnakumar
8a30111de8 gh: more repos 2025-08-19 15:45:14 -04:00
Sridhar Ratnakumar
331e095175 Add vira module (unused) 2025-08-14 14:00:40 -04:00
Sridhar Ratnakumar
a7bb3b306c gh: add imako 2025-08-03 14:23:42 -04:00
Sridhar Ratnakumar
07e6d4f29d gh: add emaletter 2025-08-01 22:12:31 -04:00
Sridhar Ratnakumar
7a5cea9c57 Add nixos tartvm 2025-07-28 17:17:18 -04:00
Sridhar Ratnakumar
564b6ac7a3
Re-installed macOS; Re-initialize Tart VM (#94) 2025-07-27 16:19:31 -04:00
Sridhar Ratnakumar
6751a82499 gh: add repo 2025-07-25 15:35:57 -04:00
Sridhar Ratnakumar
8e2b69729f gh: add srid 2025-07-23 14:32:43 -04:00
Sridhar Ratnakumar
4dab26ede5 gh: add ema 2025-07-22 19:30:32 -04:00
Sridhar Ratnakumar
7aa2a1d247 ci: more for emanote 2025-07-20 15:45:46 -04:00
Sridhar Ratnakumar
a560d9c662 gh: inc emanote 2025-07-20 10:31:31 -04:00
Sridhar Ratnakumar
017d697f96 gh: adjust ci 2025-07-13 20:18:06 -04:00
Sridhar Ratnakumar
e8583b974b gh: more runners 2025-07-13 18:04:36 -04:00
Sridhar Ratnakumar
93ce021477 github-runner: enable on darwin 2025-07-13 17:49:55 -04:00
Sridhar Ratnakumar
638712f997 isNormalUser: make overridable 2025-06-15 07:52:01 +10:00
Sridhar Ratnakumar
bdf96bdd37 Disable hyprland cache 2025-04-30 17:32:32 +10:00
Sridhar Ratnakumar
78f33425f7 nix run nixpkgs-unstable#... 2025-04-21 08:20:56 +10:00
Sridhar Ratnakumar
e614cd39fd pureintent: re-install; and pin nixos 24.11
remove netadata as well.
2025-03-28 19:24:20 -04:00
Sridhar Ratnakumar
5aedccc18d For emanote arm build 2025-03-23 14:13:54 -04:00
Sridhar Ratnakumar
2e24bebafc
Use incus (#77) 2025-01-21 15:19:24 -05:00
Sridhar Ratnakumar
25b0475947 gh: add heist-extra 2025-01-19 13:15:21 -05:00
Sridhar Ratnakumar
f33ae745f2 gh: enable gc 2025-01-18 14:42:19 -05:00
Sridhar Ratnakumar
639ba8c344 gh: add om, etc. 2025-01-18 14:25:11 -05:00
Sridhar Ratnakumar
41c8f5db91 pureintent: Re-enable github runners 2025-01-17 15:52:29 -05:00
Sridhar Ratnakumar
2118dd93ac Note about apple display brightness 2025-01-05 17:13:37 -05:00
Sridhar Ratnakumar
3c64a77f1f Limit boot entries on NixOS 2025-01-02 11:02:59 -05:00
Sridhar Ratnakumar
62a64f54ca hyprland: use ghostty 2024-12-27 10:10:21 -05:00
Sridhar Ratnakumar
68834596c1 Update nixpkgs, etc. + Hyprland 2024-12-16 14:23:31 -05:00
Sridhar Ratnakumar
8d7dc3582e logseq 2024-12-13 15:33:19 -05:00