-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 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 <[email protected]> Update modules/programs/todoman.nix Co-authored-by: Robert Helgesson <[email protected]> * fix: correct config name * chore: add test --------- Co-authored-by: Robert Helgesson <[email protected]>
- Loading branch information
Showing
6 changed files
with
94 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -478,6 +478,12 @@ | |
github = "mainrs"; | ||
githubId = 5113257; | ||
}; | ||
mikilio = { | ||
name = "mikilio"; | ||
email = "[email protected]"; | ||
github = "mikilio"; | ||
githubId = 86004375; | ||
}; | ||
kmaasrud = { | ||
name = "Knut Magnus Aasrud"; | ||
email = "[email protected]"; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
{ 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 | ||
]; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
programs.todoman = { | ||
enable = true; | ||
glob = "*/*"; | ||
extraConfig = '' | ||
date_format = "%d.%m.%Y" | ||
default_list = "test" | ||
''; | ||
}; | ||
|
||
accounts.calendar.basePath = "base/path/calendar"; | ||
|
||
test.stubs = { todoman = { }; }; | ||
|
||
nmt.script = '' | ||
configFile=home-files/.config/todoman/config.py | ||
assertFileExists $configFile | ||
assertFileContent $configFile ${./todoman-config-expected} | ||
''; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{ todoman-config = ./config.nix; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
path = "/home/hm-user/base/path/calendar/*/*" | ||
date_format = "%d.%m.%Y" | ||
default_list = "test" |