about summary refs log tree commit diff stats
path: root/modules/home/conf/taskwarrior/hooks/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'modules/home/conf/taskwarrior/hooks/default.nix')
-rw-r--r--modules/home/conf/taskwarrior/hooks/default.nix114
1 files changed, 0 insertions, 114 deletions
diff --git a/modules/home/conf/taskwarrior/hooks/default.nix b/modules/home/conf/taskwarrior/hooks/default.nix
deleted file mode 100644
index ef97e1b5..00000000
--- a/modules/home/conf/taskwarrior/hooks/default.nix
+++ /dev/null
@@ -1,114 +0,0 @@
-{
-  sysLib,
-  pkgs,
-  lib,
-  config,
-  ...
-}: let
-  mkProject = project: subproject:
-    if builtins.isString subproject
-    then {
-      name = "${project.name}.${subproject}";
-      prefix = null;
-    }
-    else let
-      name = builtins.elemAt (builtins.attrNames subproject) 0;
-    in {
-      name = "${project.name}.${name}";
-      subprojects = builtins.elemAt (builtins.attrValues subproject) 0;
-      prefix = null;
-    };
-
-  mkProjectName = project:
-    if builtins.hasAttr "subprojects" project
-    then
-      lib.lists.flatten ([project.name]
-        ++ (builtins.map mkProjectName
-          (builtins.map (mkProject project) project.subprojects)))
-    else [project.name];
-  projects = lib.lists.unique (lib.lists.naturalSort (lib.lists.flatten (builtins.map mkProjectName (import ../projects {}))));
-  projects_newline = builtins.concatStringsSep "\n" projects;
-  projects_comma = builtins.concatStringsSep ", " projects;
-  projects_pipe = builtins.concatStringsSep "|" projects;
-
-  enforce_policies = sysLib.writeShellScript {
-    name = "bin";
-    src = ./scripts/on-add_enforce-policies.sh;
-    dependencies = with pkgs; [dash jq taskwarrior gnused gnugrep];
-    replacementStrings = {
-      PROJECTS_NEWLINE = projects_newline;
-      PROJECTS_COMMA = projects_comma;
-    };
-  };
-  track_timewarrior = pkgs.stdenv.mkDerivation {
-    name = "track_timewarrior.taskwarrior-hook";
-    nativeBuildInputs = [
-      pkgs.makeWrapper
-    ];
-    buildInputs = [
-      pkgs.timewarrior
-      pkgs.taskwarrior
-      # TODO: Use a `taskw` package, that actually supports newer python variants <2024-07-13>
-      (pkgs.python311.withPackages (pythonPackages:
-        with pythonPackages; [
-          taskw
-        ]))
-    ];
-    dontUnpack = true;
-    installPhase = ''
-      install -Dm755 ${./scripts/on-modify_track-timewarrior.py} $out/bin/bin
-      wrapProgram $out/bin/bin \
-      --prefix PATH : ${lib.makeBinPath [pkgs.taskwarrior pkgs.timewarrior]}
-    '';
-  };
-  track_total_active_time = pkgs.stdenv.mkDerivation {
-    name = "track_total_active_time.taskwarrior-hook";
-    nativeBuildInputs = [
-      pkgs.makeWrapper
-    ];
-    buildInputs = [
-      pkgs.taskwarrior
-      # TODO: Use a `taskw` package, that actually supports newer python variants <2024-07-13>
-      (pkgs.python311.withPackages (pythonPackages:
-        with pythonPackages; [
-          taskw
-        ]))
-    ];
-    dontUnpack = true;
-    installPhase = ''
-      install -Dm755 ${./scripts/on-modify_track-total-active-time.py} $out/bin/bin
-      wrapProgram $out/bin/bin \
-      --prefix PATH : ${lib.makeBinPath [pkgs.taskwarrior]}
-    '';
-  };
-
-  mkSyncGitRepo = type: {
-    name = "${hookPath}/${type}_sync-git-repo";
-    value = {
-      source = "${sysLib.writeShellScript {
-        name = "bin";
-        src = ./scripts + "/${type}_sync-git-repo.sh";
-        dependencies = with pkgs; [dash taskwarrior git];
-      }}/bin/bin";
-    };
-  };
-  sync_git_repos =
-    builtins.listToAttrs (builtins.map mkSyncGitRepo ["on-add" "on-modify"]);
-  hookPath = config.programs.taskwarrior.config.hooks.location;
-in {
-  options.soispha.taskwarrior.projects = lib.mkOption {
-    type = lib.types.attrs;
-  };
-  config = {
-    soispha.taskwarrior.projects = {
-      inherit projects_newline projects_comma projects projects_pipe;
-    };
-    home.file =
-      {
-        "${hookPath}/on-add_enforce-policies".source = "${enforce_policies}/bin/bin";
-        "${hookPath}/on-modify_track-timewarrior".source = "${track_timewarrior}/bin/bin";
-        "${hookPath}/on-modify_track-total-active-time".source = "${track_total_active_time}/bin/bin";
-      }
-      // sync_git_repos;
-  };
-}