about summary refs log tree commit diff stats
path: root/modules/common
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2025-04-04 11:53:08 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2025-04-04 11:53:08 +0200
commitff491badbb3675c97454449e4e05f060d6ff1df7 (patch)
tree2423b0e8da91b9ab3d3467650bfdf767f4b417ad /modules/common
parentfeat(pkgs/neorg): Rewrite in rust (diff)
downloadnixos-config-ff491badbb3675c97454449e4e05f060d6ff1df7.zip
feat(modules/legacy/taskwarrior): Migrate to by-name
Diffstat (limited to '')
-rw-r--r--modules/common/default.nix5
-rw-r--r--modules/common/hooks/default.nix8
-rwxr-xr-xmodules/common/hooks/scripts/sync-git-repo.sh13
-rw-r--r--modules/common/projects.json132
4 files changed, 157 insertions, 1 deletions
diff --git a/modules/common/default.nix b/modules/common/default.nix
index 01c6a41a..7b3713d0 100644
--- a/modules/common/default.nix
+++ b/modules/common/default.nix
@@ -185,7 +185,10 @@
       firefox.enable = true;
       mpv.enable = true;
       swaylock.enable = true;
-      taskwarrior.enable = true;
+      taskwarrior = {
+        enable = true;
+        hooks = import ./hooks {inherit pkgs lib config;};
+      };
       yambar.enable = true;
       yt.enable = true;
       zathura.enable = true;
diff --git a/modules/common/hooks/default.nix b/modules/common/hooks/default.nix
new file mode 100644
index 00000000..e2d12807
--- /dev/null
+++ b/modules/common/hooks/default.nix
@@ -0,0 +1,8 @@
+{
+  pkgs,
+  lib,
+  config,
+}: {
+  sync-git-repos = config.lib.taskwarrior.mkHook "on-add" [pkgs.git] ./scripts/sync-git-repo.sh;
+  sync-git-repos-mod = config.lib.taskwarrior.mkHook "on-modify" [pkgs.git] ./scripts/sync-git-repo.sh;
+}
diff --git a/modules/common/hooks/scripts/sync-git-repo.sh b/modules/common/hooks/scripts/sync-git-repo.sh
new file mode 100755
index 00000000..ad7368f3
--- /dev/null
+++ b/modules/common/hooks/scripts/sync-git-repo.sh
@@ -0,0 +1,13 @@
+#!/usr/bin/env sh
+
+task_data="$(task _get rc.data.location)"
+[ "$task_data" ] || die "Taskwarrior should have a location set"
+
+cd "$task_data" || die "(BUG?): Your data.location path is not accessable"
+
+[ -d ./.git/ ] || git init
+
+git add .
+git commit --message="chore: Update" --no-gpg-sign
+
+# vim: ft=sh
diff --git a/modules/common/projects.json b/modules/common/projects.json
new file mode 100644
index 00000000..48a10f03
--- /dev/null
+++ b/modules/common/projects.json
@@ -0,0 +1,132 @@
+{
+  "3d-printer": {
+    "prefix": "hardware"
+  },
+  "aoc": {
+    "prefix": "programming/advent_of_code"
+  },
+  "book": {
+    "prefix": "book"
+  },
+  "buy": {
+    "prefix": "buy",
+    "subprojects": {
+      "books": {},
+      "pc": {}
+    }
+  },
+  "camera": {
+    "prefix": "programming/zig"
+  },
+  "hardware": {
+    "prefix": "research"
+  },
+  "input": {
+    "prefix": "research",
+    "subprojects": {
+      "dotfiles": {},
+      "read-things": {}
+    }
+  },
+  "latex": {
+    "prefix": "programming/latex"
+  },
+  "me": {
+    "subprojects": {
+      "bank": {},
+      "google": {},
+      "health": {},
+      "sweden": {}
+    }
+  },
+  "possible-projects": {
+    "prefix": "research"
+  },
+  "presentation": {
+    "prefix": "research"
+  },
+  "school": {
+    "prefix": "research",
+    "subprojects": {
+      "biologie": {},
+      "chemie": {
+        "subprojects": {
+          "facharbeit": {}
+        }
+      },
+      "deutsch": {},
+      "english": {},
+      "extern": {
+        "subprojects": {
+          "bwinf": {},
+          "dsa": {}
+        }
+      },
+      "geographie": {},
+      "geschichte": {},
+      "infomatik": {},
+      "klausuren": {},
+      "latein": {},
+      "mathematik": {},
+      "musik": {},
+      "philosophie": {},
+      "physik": {},
+      "sozialkunde": {},
+      "sport": {}
+    }
+  },
+  "server": {
+    "prefix": "config",
+    "subprojects": {
+      "b-peetz": {},
+      "blog": {},
+      "ci": {},
+      "email": {},
+      "nix-sync": {},
+      "sudo-less": {}
+    }
+  },
+  "serverphone": {
+    "prefix": "programming/rust"
+  },
+  "smartphone": {
+    "prefix": "hardware",
+    "subprojects": {
+      "airdrop": {},
+      "airplay": {}
+    }
+  },
+  "system": {
+    "prefix": "config",
+    "subprojects": {
+      "backup": {},
+      "bar": {},
+      "email": {},
+      "firefox": {},
+      "gpg": {},
+      "keyboard": {},
+      "laptop": {},
+      "nvim": {},
+      "rss": {},
+      "shell": {},
+      "task": {},
+      "wm": {},
+      "youtube": {}
+    }
+  },
+  "timesinks": {
+    "subprojects": {
+      "games": {},
+      "music": {},
+      "netflix": {},
+      "youtube": {}
+    }
+  },
+  "trinitrix": {
+    "prefix": "programming/rust",
+    "subprojects": {
+      "documentation": {},
+      "testing": {}
+    }
+  }
+}