about summary refs log tree commit diff stats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--hm/soispha/conf/taskwarrior/default.nix53
-rw-r--r--hm/soispha/conf/taskwarrior/projects/default.nixbin764 -> 928 bytes
2 files changed, 43 insertions, 10 deletions
diff --git a/hm/soispha/conf/taskwarrior/default.nix b/hm/soispha/conf/taskwarrior/default.nix
index 8753aa7b..7482efa8 100644
--- a/hm/soispha/conf/taskwarrior/default.nix
+++ b/hm/soispha/conf/taskwarrior/default.nix
@@ -1,5 +1,6 @@
 {
   nixosConfig,
+  lib,
   ...
 }: {
   imports = [
@@ -11,17 +12,49 @@
   };
 
   programs.taskwarrior = let
-    mkContext = project: {
-      inherit (project) name;
-      value = {
-        read = "project:${project.name}";
-        write = "project:${project.name}";
-        rc = {
-          neorg_path = "${project.prefix}/${project.name}/index.norg";
-        };
+    projects = import ./projects {};
+
+    mkContext = project:
+      if builtins.hasAttr "subprojects" project
+      then
+        lib.lists.flatten (
+          (builtins.map mkContext (builtins.map (mkProject project) project.subprojects))
+          ++ (mkContext (builtins.removeAttrs project ["subprojects"]))
+        )
+      else [
+        {
+          inherit (project) name;
+          value = {
+            read = "project:${project.name}";
+            write = "project:${project.name}";
+            rc = {
+              neorg_path =
+                if builtins.hasAttr "neorg_path" project
+                then project.neorg_path
+                else "${project.prefix}/${project.name}/index.norg";
+            };
+          };
+        }
+      ];
+    mkProject = project: subproject:
+      if builtins.isString subproject
+      then {
+        name = "${project.name}.${subproject}";
+        neorg_path =
+          if builtins.hasAttr "neorg_path_prefix" project
+          then "${project.neorg_path_prefix}/${subproject}/index.norg"
+          else "${project.prefix}/${project.name}/${subproject}/index.norg";
+      }
+      else let
+        name = builtins.elemAt (builtins.attrNames subproject) 0;
+      in {
+        name = "${project.name}.${name}";
+        neorg_path_prefix = "${project.prefix}/${project.name}/${name}";
+        subprojects = builtins.elemAt (builtins.attrValues subproject) 0;
       };
-    };
-    context = builtins.listToAttrs (builtins.map mkContext (import ./projects {}));
+
+    context =
+      builtins.listToAttrs (lib.lists.flatten (builtins.map mkContext projects));
   in {
     enable = true;
     colorTheme = ./nord.theme;
diff --git a/hm/soispha/conf/taskwarrior/projects/default.nix b/hm/soispha/conf/taskwarrior/projects/default.nix
index de9c18dc..0b22e55a 100644
--- a/hm/soispha/conf/taskwarrior/projects/default.nix
+++ b/hm/soispha/conf/taskwarrior/projects/default.nix
Binary files differ