An easy-to-host PDS on the ATProtocol, iPhone and MacOS. Maintain control of your keys and data, always.
Nix Packaging and Deployment#
Last verified: 2026-03-09
Purpose#
Provides Nix-native build outputs (binary, container image) and a NixOS module for declarative relay deployment. Keeps all Nix packaging logic out of the top-level flake.nix.
Contracts#
module.nix (NixOS module)#
- Exposes:
services.ezpdsoption namespace (enable, package, configFile, settings.*) - Guarantees:
settings.*options generate a Nix-store TOML config passed via--configconfigFileoverrides allsettings.*— when set, generated TOML is not used (escape hatch for agenix/sops-nix secret injection)database_url = nullis omitted from generated TOML (relay derives path from data_dir)public_urlis required; evaluation fails if unset- Dedicated
ezpdssystem user/group created automatically - systemd service runs with hardening: ProtectSystem=strict, ProtectHome, NoNewPrivileges, PrivateTmp
- StateDirectory "ezpds" managed by systemd (mode 0750)
- ReadWritePaths always includes cfg.settings.data_dir — required when data_dir is not /var/lib/ezpds, since ProtectSystem=strict blocks writes elsewhere
- Expects: Caller provides
services.ezpds.settings.public_url(or a completeconfigFile)
docker.nix#
- Exposes: Called by flake.nix to produce
packages.<system>.docker-image - Guarantees: Produces an OCI image tarball loadable via
docker load - Expects: Linux builder (not exposed on macOS)
Dependencies#
- Uses:
crates/relay/binary (viapackages.<system>.relay) - Used by: flake.nix (imports module.nix, calls docker.nix)
Key Decisions#
lib.types.strfor paths (data_dir, configFile): avoids Nix store coercion of runtime paths- configFile escape hatch: secrets must not land in world-readable Nix store
- systemd hardening on by default: defense-in-depth for a network-facing service
Invariants#
- module.nix must remain a standalone NixOS module importable without the flake
- ExecStart always passes
--config <path>(never bare invocation)
Key Files#
module.nix- NixOS module for relay deploymentdocker.nix- Docker image builder