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

View file

@ -6,6 +6,7 @@ let
inherit (lib) range; inherit (lib) range;
in { in {
imports = [ imports = [
"${depot.path}/ops/modules/atward.nix"
"${depot.path}/ops/modules/automatic-gc.nix" "${depot.path}/ops/modules/automatic-gc.nix"
"${depot.path}/ops/modules/clbot.nix" "${depot.path}/ops/modules/clbot.nix"
"${depot.path}/ops/modules/irccat.nix" "${depot.path}/ops/modules/irccat.nix"
@ -273,6 +274,9 @@ in {
}; };
}; };
}; };
# Run atward, the search engine redirection thing.
atward.enable = true;
}; };
services.postgresql = { services.postgresql = {

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;
};
};
}