diff options
author | aszlig <aszlig@redmoonstudios.org> | 2015-05-09 09:12:16 +0200 |
---|---|---|
committer | aszlig <aszlig@redmoonstudios.org> | 2015-05-09 09:12:16 +0200 |
commit | a47f7ff84e80461d8b877060e33cce6ff1190553 (patch) | |
tree | 77afefa8f3554e3c4ec5e2d60cad20af7adc0d89 /modules/user/aszlig | |
parent | 73d78ef74b078db8a393f52b9fdc8fda511dda6f (diff) |
modules/programs: Add module for taskwarrior.
This comes with a patch to chainload taskwarrior configs and defaults to the config supplied by the module. So if we want to play around with different configuration values, it's easy to do by just adding a ~/.taskrc. Note that the patch uses nestlevel 2 for ~/.taskrc, because if we would use the default (1), the default configuration would be applied prior to parsing ~/.taskrc, which of course would balk our plan. Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Diffstat (limited to 'modules/user/aszlig')
-rw-r--r-- | modules/user/aszlig/programs/taskwarrior/config.patch | 48 | ||||
-rw-r--r-- | modules/user/aszlig/programs/taskwarrior/default.nix | 36 |
2 files changed, 84 insertions, 0 deletions
diff --git a/modules/user/aszlig/programs/taskwarrior/config.patch b/modules/user/aszlig/programs/taskwarrior/config.patch new file mode 100644 index 00000000..d2dde96f --- /dev/null +++ b/modules/user/aszlig/programs/taskwarrior/config.patch @@ -0,0 +1,48 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index ee5b6c7..7f7bdef 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -46,6 +46,9 @@ SET (TASK_DOCDIR share/doc/task CACHE STRING "Installation directory for doc fi + SET (TASK_RCDIR "${TASK_DOCDIR}/rc" CACHE STRING "Installation directory for configuration files") + SET (TASK_BINDIR bin CACHE STRING "Installation directory for the binary") + ++SET (SYSTEM_TASKRC "${CMAKE_INSTALL_PREFIX}/etc/taskrc" ++ CACHE STRING "System-wide taskrc") ++ + message ("-- Looking for SHA1 references") + if (EXISTS ${CMAKE_SOURCE_DIR}/.git/index) + set (HAVE_COMMIT true) +diff --git a/cmake.h.in b/cmake.h.in +index fbeb807..001a450 100644 +--- a/cmake.h.in ++++ b/cmake.h.in +@@ -16,6 +16,7 @@ + + /* Installation details */ + #define TASK_RCDIR "${CMAKE_INSTALL_PREFIX}/${TASK_RCDIR}" ++#define SYSTEM_TASKRC "${SYSTEM_TASKRC}" + + /* Localization */ + #define PACKAGE_LANGUAGE ${PACKAGE_LANGUAGE} +diff --git a/src/Context.cpp b/src/Context.cpp +index 6dedd5e..04ced17 100644 +--- a/src/Context.cpp ++++ b/src/Context.cpp +@@ -148,7 +148,8 @@ int Context::initialize (int argc, const char** argv) + } + + config.clear (); +- config.load (rc_file); ++ config.load (SYSTEM_TASKRC); ++ config.load (rc_file, 2); + CLI::applyOverrides (argc, argv); + + //////////////////////////////////////////////////////////////////////////// +@@ -173,7 +174,6 @@ int Context::initialize (int argc, const char** argv) + } + + tdb2.set_location (data_dir); +- createDefaultConfig (); + + //////////////////////////////////////////////////////////////////////////// + // diff --git a/modules/user/aszlig/programs/taskwarrior/default.nix b/modules/user/aszlig/programs/taskwarrior/default.nix new file mode 100644 index 00000000..99d428de --- /dev/null +++ b/modules/user/aszlig/programs/taskwarrior/default.nix @@ -0,0 +1,36 @@ +{ config, pkgs, lib, ... }: + +let + cfg = config.vuizvui.user.aszlig.programs.taskwarrior; + + taskrc = pkgs.writeText "taskrc.in" '' + data.location=~/.task + include @out@/share/doc/task/rc/dark-yellow-green.theme + + color=on + dateformat=Y-m-d + dateformat.annotation=Y-m-d + dateformat.edit=Y-m-d H:N:S + dateformat.holiday=YMD + dateformat.info=Y-m-d H:N:S + dateformat.report=Y-m-d + weekstart=Monday + ''; + + taskwarrior = pkgs.taskwarrior.overrideDerivation (t: { + patches = (t.patches or []) ++ [ ./config.patch ]; + postInstall = (t.postInstall or "") + '' + mkdir -p "$out/etc" + substituteAll "${taskrc}" "$out/etc/taskrc" + ''; + }); + +in { + options.vuizvui.user.aszlig.programs.taskwarrior = { + enable = lib.mkEnableOption "aszlig's TaskWarrior"; + }; + + config = lib.mkIf cfg.enable { + environment.systemPackages = lib.singleton taskwarrior; + }; +} |