IGNOU Telegram Bot v2.0

This commit is contained in:
roshan 2023-02-19 19:35:17 +05:30
commit 9668553828
7 changed files with 500 additions and 0 deletions

50
nix/module.nix Normal file
View file

@ -0,0 +1,50 @@
inputs: {
config,
lib,
pkgs,
...
}:
let
cfg = config.services.ignou;
ignou = inputs.self.packages.${pkgs.stdenv.hostPlatform.system}.default;
in
with lib;
{
options = {
services.ignou = {
enable = mkEnableOption "Enable the IGNOU Bot service";
BOT_TOKEN = mkOption {
type = types.str;
description = "Telegram Bot Token";
};
};
};
config = mkIf cfg.enable {
systemd.services.ignou = {
description = "IGNOU Telegram Bot";
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
Type = "oneshot";
ExecStart = "${ignou}/bin/start-bot";
};
environment = {
BOT_TOKEN = cfg.BOT_TOKEN;
};
};
};
}