Repository navigation
Closed
Description
Use case
We self-host Maple on a VPS next to our own app. Our hosts are moving to NixOS for declarative config and atomic rollback. Today Maple is the only part of that setup we must run as Docker containers.
This is related to #352 (self-host outside Cloudflare) and to the goal stated there of an easy, one-click self-host. Nix would be one more way to get there, not a replacement for Docker.
How self-host looks today (as we read the repo)
docker-compose.ymlrunspostgres(17,wal_level=logical),electric,api,web,ingest(Rust),alerting,scraperandotel-collector. ClickHouse is external (docs/self-hosted-clickhouse.md).- The app images build from the monorepo with
turbo prune+bun install(e.g.apps/api/Dockerfile). Self-hosting the full stack outside Cloudflare — working Miniflare-based deployment, offering fixes upstream #352 reports that some of these Docker paths have drifted from the Workers-based runtime. deploy/docker-agent,deploy/k8s-infraanddeploy/maple-otelcover the collector side, not the app services.
Please correct us if any of this is wrong.
Proposal (your choice)
(a) Nix in the repo
- A
flake.nixwithpackagesfor each deployable app: the Bun apps (for example with bun2nix frombun.lock),apps/ingestwith the Rust tooling, the collector, and maybe themapleCLI. - A
nixosModules.maplewith options such as: listen ports, Postgres URL, Electric URL, ClickHouse URL, OTLP ingest endpoint, and secrets read from files (MAPLE_INGEST_KEY_ENCRYPTION_KEY,MAPLE_INGEST_KEY_LOOKUP_HMAC_KEY, …) instead of env values in the Nix store. - A NixOS VM test (
nixosTests) that starts the stack and checks/health, so CI catches drift.
(b) Clear build and run steps only
- You publish, per service, the build command, the run command, the required env vars and the required backing services.
- The community packages Maple in nixpkgs from those steps. You maintain no Nix code.
We can help test either path on a real NixOS 26.05 host.
Questions that decide it
- Would you accept and maintain a
flake.nix(and a NixOS module) in the tree, or do you prefer (b)? - Which services are required for a minimal self-host? For example: are
electric,scraperandalertingoptional, and is a single-orgMAPLE_AUTH_MODE=self_hostedsetup with Postgres + ClickHouse enough? - Are the app images built from stable commands we could mirror (the
turbo prune+bun installsteps in the Dockerfiles), or is the Workers/alchemy runtime the only supported way to runapi,alertingandelectric-syncnow?
Metadata
Metadata
Assignees
Labels
No labels
Activity
Makisuo commentedon Nov 9, 2026
Shipped in #2410: the repo is now a Nix flake with a NixOS module.
Docs: https://maple.dev/docs/self-hosting/platforms/nixos
Your three questions
packages.<system>.maple,nixosModules.mapleand a NixOS VM test (nix/test.nix) that CI runs on every change to the flake. After each stable release, the release workflow opens a PR that re-pins the flake.maplebinary with OTLP ingest, an embedded ClickHouse (chDB), the query API and the dashboard on one port. No Postgres, Electric, external ClickHouse, scraper or alerting. It is the same server asghcr.io/mapletechlabs/maple, single tenant, guarded by an ingest key and an access token.docker-compose.ymlhave drifted (Self-hosting the full stack outside Cloudflare — working Miniflare-based deployment, offering fixes upstream #352). The flake does not package them; it packages Maple Local.What the module does
LoadCredential, so they never enter the Nix store. Both are required off loopback, and an empty file refuses to start (exit 78) instead of serving without auth.mapleuser with its store in/var/lib/maple. Store-changing commands:sudo -u maple HOME=/var/lib/maple maple checkpoint.maple updateis disabled; upgrade withnix flake update maple.Maple is FSL-1.1-ALv2, which nixpkgs counts as unfree. The flake's own package and the module default build without any setting;
overlays.defaultneedsmaplein yourallowUnfreePredicate.The VM test covers ingest, auth, CLI reads, a checkpoint and a restart, but it has not run on a real NixOS 26.05 host yet. We would gladly take you up on testing it on yours; please open an issue with anything that breaks.
feat(self-host): Nix flake and NixOS module for Maple Local (MapleTec…