diff --git a/modules/programs/khal-accounts.nix b/modules/programs/khal-accounts.nix index cf04a65c..846e18fa 100644 --- a/modules/programs/khal-accounts.nix +++ b/modules/programs/khal-accounts.nix @@ -15,27 +15,11 @@ with lib; }; color = mkOption { - type = types.nullOr (types.enum [ - "black" - "white" - "brown" - "yellow" - "dark gray" - "dark green" - "dark blue" - "light gray" - "light green" - "light blue" - "dark magenta" - "dark cyan" - "dark red" - "light magenta" - "light cyan" - "light red" - ]); + type = types.nullOr types.str; default = null; description = '' Color in which events in this calendar are displayed. + For instance 'light green' or an RGB color '#ff0000' ''; example = "light green"; }; diff --git a/modules/programs/khal.nix b/modules/programs/khal.nix index c8037e53..52e77963 100644 --- a/modules/programs/khal.nix +++ b/modules/programs/khal.nix @@ -45,10 +45,11 @@ let + (optionalString (value.khal.type == "birthdays" && value.khal ? thisCollection) value.khal.thisCollection) - }" - ] ++ optional (value.khal.readOnly) "readonly = True" ++ [ - (toKeyValueIfDefined (getAttrs [ "type" "color" "priority" ] value.khal)) - ] ++ [ "\n" ]); + }\n " + ] ++ optional (value.khal.readOnly) "readonly = True" + ++ optional (value.khal.color != null) "color = '${value.khal.color}'" + ++ [ (toKeyValueIfDefined (getAttrs [ "type" "priority" ] value.khal)) ] + ++ [ "\n" ]); localeFormatOptions = let T = lib.types; diff --git a/tests/modules/programs/khal/config.nix b/tests/modules/programs/khal/config.nix index 50218e15..017a04ac 100644 --- a/tests/modules/programs/khal/config.nix +++ b/tests/modules/programs/khal/config.nix @@ -19,6 +19,7 @@ khal = { enable = true; readOnly = true; + color = "#ff0000"; type = "calendar"; }; local.type = "filesystem"; diff --git a/tests/modules/programs/khal/khal-config-expected b/tests/modules/programs/khal/khal-config-expected index a4cf7a30..157d650b 100644 --- a/tests/modules/programs/khal/khal-config-expected +++ b/tests/modules/programs/khal/khal-config-expected @@ -1,7 +1,9 @@ [calendars] [[test]] path = /home/hm-user/$XDG_CONFIG_HOME/cal/test/ + readonly = True +color = '#ff0000' priority=10 type=calendar @@ -9,6 +11,7 @@ type=calendar [[testcontacts-automaticallyCollected]] path = /home/hm-user/$XDG_CONFIG_HOME/card/testcontacts/automaticallyCollected + priority=10 type=birthdays @@ -16,6 +19,7 @@ type=birthdays [[testcontacts-default]] path = /home/hm-user/$XDG_CONFIG_HOME/card/testcontacts/default + priority=10 type=birthdays @@ -23,6 +27,7 @@ type=birthdays [[testcontactsNoCollections]] path = /home/hm-user/$XDG_CONFIG_HOME/card/testcontactsNoCollections/ + priority=10 type=birthdays