summaryrefslogtreecommitdiff
path: root/modules/timers.nix
diff options
context:
space:
mode:
authorKyren223 <Kyren223@proton.me>2025-06-05 13:42:54 +0300
committerKyren223 <Kyren223@proton.me>2025-06-05 13:42:54 +0300
commitd2f9cb70ad60c3429df3b414d5bb33944ef685c4 (patch)
tree1a1a0ab23fc2491decab14466618d2018bada9e2 /modules/timers.nix
parentbecb29ef63162549aa119acc4ad6727e7bc43226 (diff)
Moved timers into their own nix module, fixed issues with sops, upgraded
gitea.py to use env vars for secrets, added a timer to run every 5 hours to mirror repos from github to gitea
Diffstat (limited to 'modules/timers.nix')
-rw-r--r--modules/timers.nix68
1 files changed, 68 insertions, 0 deletions
diff --git a/modules/timers.nix b/modules/timers.nix
new file mode 100644
index 0000000..9c6f4a4
--- /dev/null
+++ b/modules/timers.nix
@@ -0,0 +1,68 @@
+{ config, pkgs, ... }: {
+
+ systemd.timers."git-auto-sync" = {
+ wantedBy = [ "timers.target" ];
+ timerConfig = {
+ OnBootSec = "5m";
+ OnUnitActiveSec = "5m";
+ Unit = "git-auto-sync.service";
+ };
+ };
+
+ systemd.services."git-auto-sync" = {
+ script = "$HOME/scripts/git-auto-sync.sh";
+ path = [
+ pkgs.git
+ pkgs.gh
+ pkgs.keychain
+ pkgs.openssh
+ ];
+ serviceConfig = { Type = "oneshot"; User = "kyren"; };
+ };
+
+ ###########################################################################
+
+ systemd.timers."k-sleep-tracker" = {
+ wantedBy = [ "timers.target" ];
+ timerConfig = {
+ OnBootSec = "1m";
+ OnUnitActiveSec = "1m";
+ Unit = "k-sleep-tracker.service";
+ };
+ };
+
+ systemd.services."k-sleep-tracker" = {
+ script = "$HOME/projects/k/bin/k tracker sleep";
+ serviceConfig = { Type = "oneshot"; User = "kyren"; };
+ };
+
+ ###########################################################################
+
+ systemd.timers."git-auto-mirror" = {
+ wantedBy = [ "timers.target" ];
+ timerConfig = {
+ OnBootSec = "1m";
+ OnUnitActiveSec = "5h";
+ Unit = "git-auto-mirror.service";
+ };
+ };
+
+ sops.secrets.gitea-sync-token = { owner = "kyren"; };
+ sops.secrets.github-mirror-token = { owner = "kyren"; };
+ systemd.services."git-auto-mirror" = {
+ script = "python $HOME/scripts/gitea.py";
+ path = [
+ (pkgs.python312.withPackages (pypkgs: [
+ pypkgs.matplotlib
+ pypkgs.pandas
+ pypkgs.pygithub
+ ]))
+ ];
+ environment = {
+ GITEA_TOKEN_FILE = config.sops.secrets.gitea-sync-token.path;
+ GITHUB_TOKEN_FILE = config.sops.secrets.github-mirror-token.path;
+ };
+ serviceConfig = { Type = "oneshot"; User = "kyren"; };
+ };
+
+}