taskwarrior: change config file location and use relative theme paths (#2455)
After taskwarrior 2.6.0, its default config file now locates at `$XDG_CONFIG_HOME/task/taskrc`, and builtin themes can be included via relative paths.
This commit is contained in:
parent
c4c761ba55
commit
df931a59a5
|
@ -37,6 +37,10 @@ https://github.com/nix-community/home-manager/issues/1906[issue #1906].
|
||||||
+
|
+
|
||||||
You can replicate your old configuration by moving those options to <<opt-programs.rofi.theme>>. Keep in mind that the syntax is different so you may need to do some changes.
|
You can replicate your old configuration by moving those options to <<opt-programs.rofi.theme>>. Keep in mind that the syntax is different so you may need to do some changes.
|
||||||
|
|
||||||
|
* Taskwarrior version 2.6.0 respects XDG Specification for the config file now.
|
||||||
|
Option <<opt-programs.taskwarrior.config>> and friends now generate the config file at
|
||||||
|
`$XDG_CONFIG_HOME/task/taskrc` instead of `~/.taskrc`.
|
||||||
|
|
||||||
[[sec-release-21.11-state-version-changes]]
|
[[sec-release-21.11-state-version-changes]]
|
||||||
=== State Version Changes
|
=== State Version Changes
|
||||||
|
|
||||||
|
|
|
@ -2241,6 +2241,15 @@ in
|
||||||
A new module is available: 'wayland.windowManager.sway.swaynag'.
|
A new module is available: 'wayland.windowManager.sway.swaynag'.
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
time = "2021-11-23T20:26:37+00:00";
|
||||||
|
message = ''
|
||||||
|
Taskwarrior version 2.6.0 respects XDG Specification for the config file now.
|
||||||
|
Option 'opt-programs.taskwarrior.config' and friends now generate the config file at
|
||||||
|
'$XDG_CONFIG_HOME/task/taskrc' instead of '~/.taskrc'.
|
||||||
|
'';
|
||||||
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,16 +6,6 @@ let
|
||||||
|
|
||||||
cfg = config.programs.taskwarrior;
|
cfg = config.programs.taskwarrior;
|
||||||
|
|
||||||
themePath = theme: "${pkgs.taskwarrior}/share/doc/task/rc/${theme}.theme";
|
|
||||||
|
|
||||||
includeTheme = location:
|
|
||||||
if location == null then
|
|
||||||
""
|
|
||||||
else if isString location then
|
|
||||||
"include ${themePath location}"
|
|
||||||
else
|
|
||||||
"include ${location}";
|
|
||||||
|
|
||||||
formatValue = value:
|
formatValue = value:
|
||||||
if isBool value then
|
if isBool value then
|
||||||
if value then "true" else "false"
|
if value then "true" else "false"
|
||||||
|
@ -59,7 +49,7 @@ in {
|
||||||
'';
|
'';
|
||||||
description = ''
|
description = ''
|
||||||
Key-value configuration written to
|
Key-value configuration written to
|
||||||
<filename>~/.taskrc</filename>.
|
<filename>$XDG_CONFIG_HOME/task/taskrc</filename>.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -89,7 +79,7 @@ in {
|
||||||
default = "";
|
default = "";
|
||||||
description = ''
|
description = ''
|
||||||
Additional content written at the end of
|
Additional content written at the end of
|
||||||
<filename>~/.taskrc</filename>.
|
<filename>$XDG_CONFIG_HOME/task/taskrc</filename>.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -98,9 +88,12 @@ in {
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
home.packages = [ pkgs.taskwarrior ];
|
home.packages = [ pkgs.taskwarrior ];
|
||||||
|
|
||||||
home.file.".taskrc".text = ''
|
xdg.configFile."task/taskrc".text = ''
|
||||||
data.location=${cfg.dataLocation}
|
data.location=${cfg.dataLocation}
|
||||||
${includeTheme cfg.colorTheme}
|
${optionalString (cfg.colorTheme != null) (if isString cfg.colorTheme then
|
||||||
|
"include ${cfg.colorTheme}.theme"
|
||||||
|
else
|
||||||
|
"include ${cfg.colorTheme}")}
|
||||||
|
|
||||||
${concatStringsSep "\n" (mapAttrsToList formatPair cfg.config)}
|
${concatStringsSep "\n" (mapAttrsToList formatPair cfg.config)}
|
||||||
|
|
||||||
|
|
|
@ -87,6 +87,7 @@ import nmt {
|
||||||
./modules/programs/sm64ex
|
./modules/programs/sm64ex
|
||||||
./modules/programs/ssh
|
./modules/programs/ssh
|
||||||
./modules/programs/starship
|
./modules/programs/starship
|
||||||
|
./modules/programs/taskwarrior
|
||||||
./modules/programs/texlive
|
./modules/programs/texlive
|
||||||
./modules/programs/tmux
|
./modules/programs/tmux
|
||||||
./modules/programs/topgrade
|
./modules/programs/topgrade
|
||||||
|
|
1
tests/modules/programs/taskwarrior/default.nix
Normal file
1
tests/modules/programs/taskwarrior/default.nix
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{ taskwarrior = ./taskwarrior.nix; }
|
40
tests/modules/programs/taskwarrior/taskwarrior.nix
Normal file
40
tests/modules/programs/taskwarrior/taskwarrior.nix
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
|
||||||
|
{
|
||||||
|
config = {
|
||||||
|
programs.taskwarrior = {
|
||||||
|
enable = true;
|
||||||
|
colorTheme = "dark-violets-256";
|
||||||
|
dataLocation = "/some/data/location";
|
||||||
|
config = {
|
||||||
|
urgency.user.tag.next.coefficient = 42.42;
|
||||||
|
urgency.blocked.coefficient = -42;
|
||||||
|
};
|
||||||
|
extraConfig = ''
|
||||||
|
include /my/stuff
|
||||||
|
urgency.user.tag.test.coefficient=-42.42
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
test.stubs.taskwarrior = { };
|
||||||
|
|
||||||
|
nmt.script = ''
|
||||||
|
assertFileExists home-files/.config/task/taskrc
|
||||||
|
assertFileContent home-files/.config/task/taskrc ${
|
||||||
|
pkgs.writeText "taskwarrior.expected" ''
|
||||||
|
data.location=/some/data/location
|
||||||
|
include dark-violets-256.theme
|
||||||
|
|
||||||
|
urgency.blocked.coefficient=-42
|
||||||
|
urgency.user.tag.next.coefficient=42.420000
|
||||||
|
|
||||||
|
include /my/stuff
|
||||||
|
urgency.user.tag.test.coefficient=-42.42
|
||||||
|
|
||||||
|
''
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in a new issue