2021-11-07 23:01:44 +01:00
|
|
|
{ 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;
|
2024-02-12 04:00:40 +01:00
|
|
|
default = depot.users.aspen.xanthous.server.docker;
|
2021-11-07 23:01:44 +01:00
|
|
|
description = "OCI image file to run";
|
|
|
|
};
|
2021-11-08 16:54:40 +01:00
|
|
|
|
|
|
|
ed25519SecretKeyFile = mkOption {
|
|
|
|
type = with types; uniq string;
|
|
|
|
description = "Path to the ed25519 secret key for the server";
|
|
|
|
};
|
2021-11-07 23:01:44 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
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"
|
|
|
|
];
|
2021-11-13 15:33:45 +01:00
|
|
|
environment.SECRET_KEY_FILE = "/secret-key";
|
|
|
|
volumes = [ "/etc/secrets/xanthous-server-secret-key:/secret-key" ];
|
2021-11-07 23:01:44 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|