Something went wrong. Try again.
Experimental AT protocol email hosting
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131# sovrn packages and NixOS modules. Hosts are deployed by the fleet# (~/projects/servers), which imports the modules below.## Layout (see nix/README.md):# nix/overlay.nix pkgs.sovrn.*: Stalwart (nixpkgs, version-pinned), stalwart-cli, the vlpds image# nix/pkgs/ our own derivations# nix/modules/ NixOS modules: services, roles/*# nix/stalwart/ Stalwart apply plans (JSON)# nix/tests/ NixOS VM tests (checks)# nix/scripts/ dev process runners (devenv.nix), gen-secret## Dev (devenv.nix) applies the same overlay, so dev and hosts run the same# Stalwart build; both run the vlpds image pinned in nix/vlpds-image.nix.{ description = "sovrn services and NixOS modules";
inputs = { # nixos-unstable: the only channel that ships stalwart_0_16 (26.05 has # 0.15.5). Pinned by flake.lock; the Stalwart version is additionally # asserted in nix/overlay.nix. Decision (2026-09-30): stay on pinned # unstable, relying on staging (mx99) + VM tests to catch breakage, and # move to nixos-26.11 once it's released (bug below in the epic). nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; flake-utils.url = "github:numtide/flake-utils"; };
outputs = { self, nixpkgs, flake-utils, }: let overlay = import ./nix/overlay.nix; in { overlays.default = overlay;
# For the fleet (~/projects/servers), which deploys every host and can # put several projects on one machine. Host plumbing (disk, boot, # network, SSH) is the fleet's; these are only sovrn's own pieces. # services options (sovrn.fleet, sovrn.cell.*, sovrn.metrics.*), # secrets, the Stalwart/sovrnd/vlpds modules (off until a # role enables them), the sovrn user; brings the overlay # metrics the metrics box (sovrn.metrics.hostname) # cell a cell: Stalwart, sovrnd, Caddy edge (exclusive host) # relay the backup MX relay (sovrn.relay.*) # pds a node of the region's vlpds cluster (sovrn.pds.*): on # the region's cell and on its backup host # telemetryEdge metrics and logs to the metrics box, for hosts with # no sovrn role (sovrn.telemetry.edge.*; the roles above # bring their own) nixosModules = { services = { imports = [ ./nix/modules/services.nix ]; nixpkgs.overlays = [ overlay ]; }; metrics.imports = [ self.nixosModules.services ./nix/modules/roles/metrics.nix ]; cell.imports = [ self.nixosModules.services ./nix/modules/roles/cell.nix ]; relay.imports = [ self.nixosModules.services ./nix/modules/roles/relay.nix ]; pds = { imports = [ self.nixosModules.services ]; sovrn.pds.enable = true; }; telemetryEdge = { imports = [ self.nixosModules.services ]; sovrn.telemetry.edge.enable = true; }; }; } // flake-utils.lib.eachSystem [ "x86_64-linux" "aarch64-linux" ] ( system: let pkgs = import nixpkgs { inherit system; overlays = [ overlay ]; }; in { packages = { inherit (pkgs.sovrn) stalwart stalwart-cli vlpds-image bulwark-image sovrnd mailfront backup-route-sync metrics-healthz ; }; # `nix run .#gen-secret -- NAME HOST`: a fresh value for one of # sovrn's per-host secrets (the fleet's `just gen-host-secrets`). apps.gen-secret = { type = "app"; program = nixpkgs.lib.getExe ( pkgs.writeShellApplication { name = "gen-secret"; runtimeInputs = [ pkgs.coreutils pkgs.wireguard-tools ]; text = builtins.readFile ./nix/scripts/gen-secret.sh; } ); }; } # NixOS VM tests (need KVM): nix build .#checks.x86_64-linux.<name> -L // nixpkgs.lib.optionalAttrs (system == "x86_64-linux") { checks.metrics = pkgs.testers.runNixOSTest (import ./nix/tests/metrics.nix { inherit overlay; }); checks.stalwart = pkgs.testers.runNixOSTest (import ./nix/tests/stalwart.nix { inherit overlay; }); checks.stalwart-plan = import ./nix/tests/stalwart-plan.nix { inherit pkgs; }; checks.cell = pkgs.testers.runNixOSTest (import ./nix/tests/cell.nix { inherit overlay; }); checks.relay = pkgs.testers.runNixOSTest (import ./nix/tests/relay.nix { inherit overlay; }); checks.backup = pkgs.testers.runNixOSTest (import ./nix/tests/backup.nix { inherit overlay; }); checks.restore = pkgs.testers.runNixOSTest (import ./nix/tests/restore.nix { inherit overlay; }); checks.telemetry = pkgs.testers.runNixOSTest (import ./nix/tests/telemetry.nix { inherit overlay; }); checks.pds = pkgs.testers.runNixOSTest (import ./nix/tests/pds.nix { inherit overlay; }); } );}