2026-05-08 20:53:52 +00:00
|
|
|
{ config, inputs, lib, pkgs, ... }:
|
2025-07-16 09:32:19 -07:00
|
|
|
with lib;
|
|
|
|
|
let
|
2026-05-08 20:53:52 +00:00
|
|
|
timecard-bot-pkg = inputs.timecard-bot.packages.x86_64-linux.default;
|
2025-07-16 09:32:19 -07:00
|
|
|
in
|
|
|
|
|
{
|
|
|
|
|
options.myModules.timecardbot.enable = mkEnableOption "custom timecardbot configuration";
|
|
|
|
|
|
|
|
|
|
config = mkIf config.myModules.timecardbot.enable {
|
2025-09-26 19:08:26 +00:00
|
|
|
environment.systemPackages = with pkgs; [
|
|
|
|
|
timecard-bot-pkg
|
|
|
|
|
];
|
|
|
|
|
sops.secrets.timecarder-env = {
|
|
|
|
|
format = "dotenv";
|
|
|
|
|
group = "timecarder";
|
|
|
|
|
mode = "0440";
|
|
|
|
|
owner = "timecarder";
|
|
|
|
|
restartUnits = ["timecarder.service"];
|
|
|
|
|
sopsFile = ../../secrets/timecarder.env;
|
|
|
|
|
};
|
|
|
|
|
systemd.services.timecarder = {
|
|
|
|
|
after=["network.target" "network-online.target"];
|
|
|
|
|
description="Timecarder Matrix bot";
|
|
|
|
|
requires=["network-online.target"];
|
|
|
|
|
serviceConfig = {
|
|
|
|
|
EnvironmentFile="/var/run/secrets/timecarder-env";
|
|
|
|
|
Type = "simple";
|
|
|
|
|
User = "timecarder";
|
|
|
|
|
Group = "timecarder";
|
|
|
|
|
ExecStart = "${timecard-bot-pkg}/bin/timecardbot";
|
|
|
|
|
TimeoutStopSec = "5s";
|
|
|
|
|
PrivateTmp = true;
|
|
|
|
|
WorkingDirectory = "/tmp";
|
|
|
|
|
};
|
|
|
|
|
wantedBy = ["multi-user.target"];
|
|
|
|
|
};
|
|
|
|
|
users.groups.timecarder = {};
|
|
|
|
|
users.users.timecarder = {
|
|
|
|
|
group = "timecarder";
|
|
|
|
|
isSystemUser = true;
|
|
|
|
|
};
|
2025-07-16 09:32:19 -07:00
|
|
|
};
|
|
|
|
|
}
|