2024-04-10 18:52:57 +02:00
|
|
|
{ config, lib, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
cfg = config.programs.todoman;
|
2024-04-10 21:08:59 +02:00
|
|
|
iniFormat = pkgs.formats.ini { };
|
2024-04-10 18:52:57 +02:00
|
|
|
|
|
|
|
in {
|
2024-04-10 19:13:24 +02:00
|
|
|
|
|
|
|
meta.maintainers = [ maintainers.mikilio ];
|
|
|
|
|
2024-04-10 18:52:57 +02:00
|
|
|
options.todoman = {
|
2024-04-10 19:13:24 +02:00
|
|
|
enable = lib.mkEnableOption
|
|
|
|
"Enable todoman a standards-based task manager based on iCalendar";
|
2024-04-10 18:52:57 +02:00
|
|
|
|
|
|
|
glob = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "*";
|
|
|
|
description = ''
|
|
|
|
The glob expansion which matches all directories relevant.
|
|
|
|
'';
|
|
|
|
};
|
2024-04-10 21:08:59 +02:00
|
|
|
settings = mkOption {
|
|
|
|
type = iniFormat.type;
|
|
|
|
default = { };
|
2024-04-10 18:52:57 +02:00
|
|
|
description = ''
|
2024-04-10 21:08:59 +02:00
|
|
|
Configuration for todoman
|
2024-04-10 18:52:57 +02:00
|
|
|
|
2024-04-10 21:08:59 +02:00
|
|
|
See [docs](`https://todoman.readthedocs.io/en/stable/man.html#id5`).
|
|
|
|
for the full list of options.
|
2024-04-10 18:52:57 +02:00
|
|
|
'';
|
2024-04-10 21:08:59 +02:00
|
|
|
example = literalExpression ''
|
|
|
|
{
|
|
|
|
date_format = "%Y-%m-%d";
|
|
|
|
time_format = "%H:%M";
|
|
|
|
default_list = "Personal";
|
|
|
|
default_due = 48;
|
|
|
|
};
|
2024-04-10 18:52:57 +02:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2024-04-10 21:08:59 +02:00
|
|
|
extraConfig = mkOption {
|
|
|
|
type = types.lines;
|
|
|
|
default = "";
|
2024-04-10 18:52:57 +02:00
|
|
|
description = ''
|
2024-04-10 21:08:59 +02:00
|
|
|
Additional lines for configuration of todoman
|
2024-04-10 18:52:57 +02:00
|
|
|
|
2024-04-10 21:08:59 +02:00
|
|
|
See [docs](`https://todoman.readthedocs.io/en/stable/man.html#id5`).
|
|
|
|
for the full list of options.
|
2024-04-10 18:52:57 +02:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
2024-04-10 21:08:59 +02:00
|
|
|
assertions = [{
|
|
|
|
assertion = accounts.calendar ? basePath;
|
|
|
|
message = ''
|
|
|
|
A base directory for calendars must be specified via
|
|
|
|
`accounts.calendar.basePath` to generate config for todoman
|
|
|
|
'';
|
|
|
|
}];
|
2024-04-10 18:52:57 +02:00
|
|
|
|
|
|
|
home.packages = [ pkgs.todoman ];
|
|
|
|
|
2024-04-10 21:08:59 +02:00
|
|
|
xdg.configFile."todoman/config.py" =
|
|
|
|
mkIf (cfg.settings != { } && cfg.extraConfig != "") {
|
|
|
|
text = lib.concatLines [
|
|
|
|
''path = "~/${config.accounts.calendar.basePath}${cfg.glob}"''
|
|
|
|
(generators.toINI { } cfg.settings)
|
|
|
|
cfg.extraConfig
|
|
|
|
];
|
|
|
|
};
|
2024-04-10 18:52:57 +02:00
|
|
|
};
|
|
|
|
}
|