aa122cbae7
This CL can be used to compare the style of nixpkgs-fmt against other formatters (nixpkgs, alejandra). Change-Id: I87c6abff6bcb546b02ead15ad0405f81e01b6d9e Reviewed-on: https://cl.tvl.fyi/c/depot/+/4397 Tested-by: BuildkiteCI Reviewed-by: sterni <sternenseemann@systemli.org> Reviewed-by: lukegb <lukegb@tvl.fyi> Reviewed-by: wpcarro <wpcarro@gmail.com> Reviewed-by: Profpatsch <mail@profpatsch.de> Reviewed-by: kanepyork <rikingcoding@gmail.com> Reviewed-by: tazjin <tazjin@tvl.su> Reviewed-by: cynthia <cynthia@tvl.fyi> Reviewed-by: edef <edef@edef.eu> Reviewed-by: eta <tvl@eta.st> Reviewed-by: grfn <grfn@gws.fyi>
68 lines
1.6 KiB
Nix
68 lines
1.6 KiB
Nix
# Run the owothia IRC bot.
|
|
{ depot, config, lib, pkgs, ... }:
|
|
|
|
let
|
|
cfg = config.services.depot.owothia;
|
|
description = "owothia - i'm a service owo";
|
|
in
|
|
{
|
|
options.services.depot.owothia = {
|
|
enable = lib.mkEnableOption description;
|
|
|
|
secretsFile = lib.mkOption {
|
|
type = lib.types.str;
|
|
description = "File path from which systemd should read secrets";
|
|
default = "/run/agenix/owothia";
|
|
};
|
|
|
|
owoChance = lib.mkOption {
|
|
type = lib.types.int;
|
|
description = "How likely is owo?";
|
|
default = 200;
|
|
};
|
|
|
|
ircServer = lib.mkOption {
|
|
type = lib.types.str;
|
|
description = "IRC server hostname";
|
|
};
|
|
|
|
ircPort = lib.mkOption {
|
|
type = lib.types.int;
|
|
description = "IRC server port";
|
|
};
|
|
|
|
ircIdent = lib.mkOption {
|
|
type = lib.types.str;
|
|
description = "IRC username";
|
|
default = "owothia";
|
|
};
|
|
|
|
ircChannels = lib.mkOption {
|
|
type = with lib.types; listOf str;
|
|
description = "IRC channels to join";
|
|
default = [ "#tvl" ];
|
|
};
|
|
};
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
systemd.services.owothia = {
|
|
inherit description;
|
|
script = "${depot.fun.owothia}/bin/owothia";
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
serviceConfig = {
|
|
DynamicUser = true;
|
|
Restart = "always";
|
|
EnvironmentFile = cfg.secretsFile;
|
|
};
|
|
|
|
environment = {
|
|
OWO_CHANCE = toString cfg.owoChance;
|
|
IRC_SERVER = cfg.ircServer;
|
|
IRC_PORT = toString cfg.ircPort;
|
|
IRC_IDENT = cfg.ircIdent;
|
|
IRC_CHANNELS = builtins.toJSON cfg.ircChannels;
|
|
};
|
|
};
|
|
};
|
|
}
|