hosts | added systemd service for primary workstation

This commit is contained in:
Don Harper 2025-09-02 21:01:49 -05:00
parent fe017602e4
commit 25ef9fe1ac
2 changed files with 71 additions and 0 deletions

View file

@ -48,6 +48,7 @@ in {
./detect-reboot-needed.nix
./kmscon.nix
./systemd.nix
./systemd-primary.nix
./auto-cpufreq.nix
./tlp.nix
./upgrade-diff.nix

View file

@ -0,0 +1,70 @@
{
pkgs,
lib,
config,
...
}: let
cfg = config.primary;
in {
options.primary = mkIf cfg.enable {
systemd = {
user = {
services = {
do_agenda = {
description = "Send today's agenda";
unitConfig = {Type = "simple";};
serviceConfig = {
Type = "oneshot";
Environment = "PATH=/run/current-system/sw/bin:/etc/profiles/per-user/don/bin:/home/don/bin";
ExecStart = "/home/don/bin/do_agenda";
};
};
do_agenda_tomorrow = {
description = "Send tomorrow's agenda";
unitConfig = {Type = "simple";};
serviceConfig = {
Type = "oneshot";
Environment = "PATH=/run/current-system/sw/bin:/etc/profiles/per-user/don/bin:/home/don/bin";
ExecStart = "/home/don/bin/do_agenda_tomorrow";
};
};
gosleep = {
description = "Adjust tailscale MTU based on location";
unitConfig = {Type = "simple";};
serviceConfig = {
Type = "oneshot";
Environment = "PATH=/run/current-system/sw/bin:/etc/profiles/per-user/don/bin:/home/don/bin";
ExecStart = "/home/don/bin/gosleep";
};
};
};
timers = {
do_agenda = {
wantedBy = ["timers.target"];
partOf = ["do_agenda.service"];
timerConfig = {
OnCalendar = "05:00";
Unit = "do_agenda.service";
};
};
do_agenda_tomorrow = {
wantedBy = ["timers.target"];
partOf = ["do_agenda_tomorrow.service"];
timerConfig = {
OnCalendar = "20:00";
Unit = "do_agenda_tomorrow.service";
};
};
gosleep = {
wantedBy = ["timers.target"];
partOf = ["gosleep.service"];
timerConfig = {
OnCalendar = "1m";
Unit = "gosleep.service";
};
};
};
};
};
};
}