feat(ops): Add NixOS module for atward

Very standard, nothing fancy.

Change-Id: Ibb286f221a4752abfb62e971b98e9496357040f5
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3090
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
This commit is contained in:
Vincent Ambo 2021-05-04 00:43:08 +02:00 committed by tazjin
parent 5b45eae276
commit 790c0d938e
2 changed files with 35 additions and 0 deletions

31
ops/modules/atward.nix Normal file
View file

@ -0,0 +1,31 @@
{ depot, config, lib, pkgs, ... }:
let
cfg = config.services.depot.atward;
description = "atward - (attempt to) cleverly route queries";
in {
options.services.depot.atward = {
enable = lib.mkEnableOption description;
port = lib.mkOption {
type = lib.types.int;
default = 28973;
description = "Port on which atward should listen";
};
};
config = lib.mkIf cfg.enable {
systemd.services.atward = {
inherit description;
script = "${depot.web.atward}/bin/atward";
wantedBy = [ "multi-user.target" ];
serviceConfig = {
DynamicUser = true;
Restart = "always";
};
environment.ATWARD_PORT = toString cfg.port;
};
};
}