tvl-depot/users/grfn/xanthous/server/module.nix
Griffin Smith e9c3d2f6d9 feat(gs/mugwump): Run xanthous server
Add a nixos module for running the xanthous server in a docker
container, and install it on mugwump including a prometheus scrape
config.

Change-Id: Ifeb315845b7eef2ee33af98fa3f71acdd3d9fe6b
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3812
Reviewed-by: grfn <grfn@gws.fyi>
Tested-by: BuildkiteCI
2021-11-07 23:02:23 +00:00

41 lines
1,011 B
Nix

{ config, lib, pkgs, depot, ... }:
let
cfg = config.services.xanthous-server;
in {
options = with lib; {
services.xanthous-server = {
enable = mkEnableOption "xanthous server";
port = mkOption {
type = types.int;
default = 2222;
description = "Port to listen to for SSH connections";
};
metricsPort = mkOption {
type = types.int;
default = 9000;
description = "Port to listen to for prometheus metrics";
};
image = mkOption {
type = types.package;
default = depot.users.grfn.xanthous.server.docker;
description = "OCI image file to run";
};
};
};
config = lib.mkIf cfg.enable {
virtualisation.oci-containers.containers."xanthous-server" = {
autoStart = true;
image = "${cfg.image.imageName}:${cfg.image.imageTag}";
imageFile = cfg.image;
ports = [
"${toString cfg.port}:22"
"${toString cfg.metricsPort}:9000"
];
};
};
}