1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2025-01-11 11:39:49 +01:00
home-manager/modules/programs/todoman.nix
Kilian Mio d4aebb947a
todoman: add todoman module (#5252)
* todoman: add todoman module

Adds Mikilio as maintainer for new module for todoman a standards-based
task manager based on iCalendar

Apply suggestions from code review

Co-authored-by: Robert Helgesson <robert@rycee.net>

Update modules/programs/todoman.nix

Co-authored-by: Robert Helgesson <robert@rycee.net>

* fix: correct config name

* chore: add test

---------

Co-authored-by: Robert Helgesson <robert@rycee.net>
2025-01-09 12:25:50 +01:00

62 lines
1.4 KiB
Nix

{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.programs.todoman;
format = pkgs.formats.keyValue { };
in {
meta.maintainers = [ hm.maintainers.mikilio ];
options.programs.todoman = {
enable = lib.mkEnableOption "todoman";
glob = mkOption {
type = types.str;
default = "*";
description = ''
The glob expansion which matches all directories relevant.
'';
example = "*/*";
};
extraConfig = mkOption {
type = types.lines;
default = "";
description = ''
Text for configuration of todoman.
The syntax is Python.
See [docs](`https://todoman.readthedocs.io/en/stable/man.html#id5`).
for the full list of options.
'';
example = ''
date_format = "%Y-%m-%d";
time_format = "%H:%M";
default_list = "Personal";
default_due = 48;
'';
};
};
config = mkIf cfg.enable {
assertions = [{
assertion = config.accounts.calendar ? basePath;
message = ''
A base directory for calendars must be specified via
`accounts.calendar.basePath` to generate config for todoman
'';
}];
home.packages = [ pkgs.todoman ];
xdg.configFile."todoman/config.py".text = lib.concatLines [
''path = "${config.accounts.calendar.basePath}/${cfg.glob}"''
cfg.extraConfig
];
};
}