#461 Nix flake and NixOS module
–
- github
- github/openchronology/timeline-app
- github/openchronology/timeline-app#461
- issue
- state:closed
Support installing OpenChronology with Nix and on NixOS. ## Packages: a `flake.nix` at the repository's root Built from source, so they work on any architecture Nix supports and could later go to nixpkgs: - **`openchronology-server`:** the server and the Next.js platform. `buildNpmPackage` builds from `package-lock.json`, with a checked-in hash of the npm dependencies; nothing is fetched during the build. - **`och-convert`:** the `.och` file converter (Rust). - **`openchronology-desktop`:** the Tauri desktop app (Linux). - **`pgmp`:** the PostgreSQL extension the server needs, pinned to the same commit as `deploy/Dockerfile.postgres`. ## A NixOS module: `services.openchronology` It does on NixOS what the Debian package's scripts do: - **Database:** turns on PostgreSQL with pgmp, and creates the database and its role. - **Services:** systemd units for the server, the mail worker, and the optional syslog and journald importers, under a dedicated user. - **Migrations:** run before the server starts. - **Settings:** options for the site's origin, port and other configuration. Secrets come from an `environmentFile`, so they stay out of the Nix store. - **Web server:** an optional nginx virtual host with ACME certificates. ## Checks - **NixOS VM test** (`nixosTest`): boots a machine with the module, waits for `/healthz`, signs up and saves a timeline. CI runs it for changes to the packaging and on releases. - **Binary cache:** releases push to a Cachix cache once the `CACHIX_AUTH_TOKEN` secret is set; without it, the step says so and skips. ## Later The same derivations can be submitted to nixpkgs. https://github.com/openchronology/timeline-app/issues/461