add worblehat daemons

This commit is contained in:
Vegard Bieker Matthey
2026-03-17 16:51:59 +01:00
parent 6fc6954531
commit da7dc422ca
2 changed files with 59 additions and 2 deletions

View File

@@ -23,7 +23,7 @@
dibbler.url = "git+https://git.pvv.ntnu.no/Projects/dibbler.git?ref=main"; dibbler.url = "git+https://git.pvv.ntnu.no/Projects/dibbler.git?ref=main";
dibbler.inputs.nixpkgs.follows = "nixpkgs"; dibbler.inputs.nixpkgs.follows = "nixpkgs";
worblehat.url = "git+https://git.pvv.ntnu.no/Projects/worblehat.git?ref=main"; worblehat.url = "git+https://git.pvv.ntnu.no/Projects/worblehat.git?ref=stable_deps";
worblehat.inputs.nixpkgs.follows = "nixpkgs"; worblehat.inputs.nixpkgs.follows = "nixpkgs";
matrix-next.url = "github:dali99/nixos-matrix-modules/v0.8.0"; matrix-next.url = "github:dali99/nixos-matrix-modules/v0.8.0";
@@ -196,7 +196,8 @@
inputs.dibbler.nixosModules.default inputs.dibbler.nixosModules.default
inputs.worblehat.nixosModules.default inputs.worblehat.nixosModules.default
]; ];
overlays = [ overlays =
[
inputs.dibbler.overlays.default inputs.dibbler.overlays.default
inputs.worblehat.overlays.default inputs.worblehat.overlays.default
]; ];

View File

@@ -79,6 +79,28 @@ in
}; };
}; };
deadline-daemon = {
enable = lib.mkEnableOption "" // {
description = ''
Whether to enable the worblehat deadline-daemon service,
which periodically checks for upcoming deadlines and notifies users.
Note that this service is independent of the main worblehat service,
and must be enabled separately.
'';
};
onCalendar = lib.mkOption {
type = lib.types.str;
description = ''
How often to trigger rendering the map,
in the format of a systemd timer onCalendar configuration.
See {manpage}`systemd.timer(5)`.
'';
default = "*-*-* 10:15:00";
};
};
}; };
config = lib.mkIf cfg.enable ( config = lib.mkIf cfg.enable (
@@ -256,6 +278,40 @@ in
services.getty.autologinUser = "drumknotty"; services.getty.autologinUser = "drumknotty";
}) })
(lib.mkIf cfg.deadline-daemon.enable {
systemd.timers.worblehat-deadline-daemon = {
description = "Worblehat Deadline Daemon";
wantedBy = [ "timers.target" ];
timerConfig = {
OnCalendar = cfg.deadline-daemon.onCalendar;
Persistent = true;
};
};
systemd.services.worblehat-deadline-daemon = {
description = "Worblehat Deadline Daemon";
wantedBy = [ "multi-user.target" ];
after = [ "network.target" ];
serviceConfig = {
Type = "oneshot";
CPUSchedulingPolicy = "idle";
IOSchedulingClass = "idle";
ExecStart =
let
worblehatArgs = lib.cli.toCommandLineShellGNU { } {
config = "/etc/worblehat/config.toml";
};
in
"${lib.getExe cfg.package} ${worblehatArgs} deadline-daemon";
User = "worblehat";
Group = "worblehat";
};
};
})
] ]
); );
} }