ATproto FR#
French-language directory and blog for the AT Protocol ecosystem.
Development#
nix develop
npm install
npm run dev
Deployment with NixOS#
The flake provides a NixOS module that packages the source code and all npm dependencies in the Nix store. No git clone or npm install needed on the server.
How it works#
Since astro build fetches data from AT Protocol APIs at build time (PLC directory, Bluesky, PDS), the full build can't run inside the Nix sandbox. Instead:
packages.default— packages the source +node_modulesinto the Nix store viabuildNpmPackagesystemd.services.atproto-fr-build— runsastro builddirectly from the Nix store, writing output to a writabledataDirsystemd.timers.atproto-fr-build— triggers rebuilds on a schedule (default: hourly)
Cached API data (public/data/) is written to dataDir via the ATPROTO_FR_DATA_DIR env var and preserved across rebuilds, so the resolvedAt-based DID caching works.
1. Add the flake input#
{
inputs = {
atproto-fr.url = "github:your-user/atproto-fr";
};
}
2. Get the npm dependency hash#
nix build .#default 2>&1 | grep 'got:'
Replace the sha256-FIXME in flake.nix with the hash from the output.
3. Import the module and enable the service#
{ inputs, ... }: {
imports = [ inputs.atproto-fr.nixosModules.default ];
services.atproto-fr = {
enable = true;
package = inputs.atproto-fr.packages.${system}.default;
interval = "hourly"; # systemd calendar expression
};
}
4. Serve with Caddy#
services.caddy = {
enable = true;
virtualHosts."atproto.fr" = {
extraConfig = ''
root * /var/lib/atproto-fr/dist
file_server
encode gzip
handle_errors {
rewrite * /404.html
file_server
}
'';
};
};
5. Trigger an initial build#
# Trigger first build manually
systemctl start atproto-fr-build
# Verify the timer is active
systemctl list-timers atproto-fr-build
Module options#
| Option | Default | Description |
|---|---|---|
enable |
false |
Enable the rebuild service |
package |
— | The atproto-fr package (source + node_modules) |
dataDir |
/var/lib/atproto-fr |
Writable directory for build output and cached data |
interval |
"hourly" |
Systemd calendar expression |
user |
"atproto-fr" |
System user for builds |
group |
"atproto-fr" |
System group for builds |