iac/nixos/flake.nix
Sergei Poljanski 0ee1c600e6
All checks were successful
nixos / nixos (push) Successful in 26s
services: run asxpio from its flake, beside the container
asxpi/asxpio now exports the app (bundlerEnv, ImageMagick 7) and a
module running the site and its monitor worker as hardened systemd
services. services runs the site on :3001 next to the container on ops;
no route yet, and the monitor stays off until the container's stops.
pg_hba lets the asxpio role in from 10.10.0.20 too (restarts Postgres
once); the settings and secrets, copied from the container's
environment with the database and Garage on ops' private address, are
in services' sops file. Renovate automerges its bumps like the other
apps'.

Assisted-by: Claude:opus-5-5
2026-11-17 14:12:45 +04:00

110 lines
3.3 KiB
Nix

{
description = "asxp.io servers";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-26.05";
# For the few packages 26.05 has older than what production runs
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
sops-nix = {
url = "github:Mic92/sops-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
# The deploy agent (modules/comin.nix)
comin = {
url = "github:nlewo/comin/v0.14.0";
inputs.nixpkgs.follows = "nixpkgs";
inputs.treefmt-nix.inputs.nixpkgs.follows = "nixpkgs";
};
# The apps, each from its own repository (hosts/asxpio-services/apps.nix).
# ref names the branch, rev the commit deployed: Renovate moves rev
# along the branch (renovate.json); without it Renovate cannot.
blog = {
url = "git+https://git.asxp.io/asxpi/blog?ref=main&rev=bbd489cc1dec05e1d52a86aeb9eff27080eece51";
inputs.nixpkgs.follows = "nixpkgs-unstable"; # only HTML ships
};
czsk = {
url = "git+https://git.asxp.io/czsk/czsk?ref=main&rev=25c73b9c0ac1c1bf56812e844d7f55b0a39d46eb";
inputs.nixpkgs.follows = "nixpkgs";
};
# Ruby 4.0 and its gems come from the app's own nixpkgs: what its CI
# tested is what runs
asxpio.url = "git+https://git.asxp.io/asxpi/asxpio?ref=main&rev=4c0b6c3eef88123d4357e03eb1115cabcd6ff790";
datacenterbingo.url = "git+https://git.asxp.io/asxpi/datacenterbingo?ref=main&rev=adc6e824e592704968754165acd017f5f8292c28";
# services.crawler-alert (hosts/asxpio-ops/crawler.nix)
crawler-alert = {
url = "git+https://git.asxp.io/asxpi/traefik-crawlers-statistics?ref=main";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{
nixpkgs,
nixpkgs-unstable,
sops-nix,
comin,
crawler-alert,
blog,
czsk,
datacenterbingo,
asxpio,
...
}:
let
mkHost =
modules:
nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs.unstable = nixpkgs-unstable.legacyPackages.x86_64-linux;
modules = [
sops-nix.nixosModules.sops
comin.nixosModules.comin
./modules/hetzner.nix
./modules/base.nix
./modules/shell.nix
./modules/podman.nix
./modules/wireguard.nix
./modules/alert.nix
./modules/backup.nix
./modules/comin.nix
./modules/monitoring-agent.nix
]
++ modules;
};
in
{
# `nix develop ./nixos`: every tool the READMEs call
devShells.x86_64-linux.default =
let
pkgs = nixpkgs.legacyPackages.x86_64-linux;
in
pkgs.mkShell {
packages = with pkgs; [
opentofu
hcloud
nixos-rebuild
sops
ssh-to-age
age
restic
rclone
jq
openssh
];
};
nixosConfigurations = {
asxpio-ops = mkHost [
./hosts/asxpio-ops
crawler-alert.nixosModules.default
];
asxpio-services = mkHost [
./hosts/asxpio-services
blog.nixosModules.default
czsk.nixosModules.default
datacenterbingo.nixosModules.default
asxpio.nixosModules.default
];
};
};
}