diff --git a/modules/accounts/calendar.nix b/modules/accounts/calendar.nix
index 1a9876375..237cc1178 100644
--- a/modules/accounts/calendar.nix
+++ b/modules/accounts/calendar.nix
@@ -11,6 +11,7 @@ let
path = mkOption {
type = types.str;
default = "${cfg.basePath}/${name}";
+ defaultText = "‹accounts.contact.basePath›/‹name›";
description = "The path of the storage.";
};
@@ -46,7 +47,7 @@ let
url = mkOption {
type = types.nullOr types.str;
default = null;
- description = "The url of the storage.";
+ description = "The URL of the storage.";
};
userName = mkOption {
@@ -55,23 +56,21 @@ let
description = "User name for authentication.";
};
- userNameCommand = mkOption {
- type = types.nullOr (types.listOf types.str);
- default = null;
- example = [ "~/get-username.sh" ];
- description = ''
- A command that prints the user name to standard
- output.
- '';
- };
+ # userNameCommand = mkOption {
+ # type = types.nullOr (types.listOf types.str);
+ # default = null;
+ # example = [ "~/get-username.sh" ];
+ # description = ''
+ # A command that prints the user name to standard output.
+ # '';
+ # };
passwordCommand = mkOption {
type = types.nullOr (types.listOf types.str);
default = null;
example = [ "pass" "caldav" ];
description = ''
- A command that prints the password to standard
- output.
+ A command that prints the password to standard output.
'';
};
};
@@ -88,7 +87,6 @@ let
'';
};
-
primary = mkOption {
type = types.bool;
default = false;
@@ -101,14 +99,13 @@ let
primaryCollection = mkOption {
type = types.str;
description = ''
- The primary collection of the account. Required when an account has
- multiple collections.
+ The primary collection of the account. Required when an
+ account has multiple collections.
'';
};
local = mkOption {
type = types.nullOr (localModule name);
-
default = null;
description = ''
Local configuration for the calendar.
@@ -117,7 +114,6 @@ let
remote = mkOption {
type = types.nullOr remoteModule;
-
default = null;
description = ''
Remote configuration for the calendar.
@@ -125,12 +121,9 @@ let
};
};
- config = mkMerge [
- {
- name = name;
- khal.type = mkOptionDefault null;
- }
- ];
+ config = {
+ name = name;
+ };
};
in
@@ -139,10 +132,14 @@ in
options.accounts.calendar = {
basePath = mkOption {
type = types.str;
- default = "${config.home.homeDirectory}/.calendars/";
- defaultText = "$HOME/.calendars";
+ apply = p:
+ if hasPrefix "/" p
+ then p
+ else "${config.home.homeDirectory}/${p}";
description = ''
- The base directory in which to save calendars.
+ The base directory in which to save calendars. May be a
+ relative path, in which case it is relative the home
+ directory.
'';
};
@@ -168,7 +165,7 @@ in
[{
assertion = length primaries <= 1;
message =
- "Must have at most one primary calendar accounts but found "
+ "Must have at most one primary calendar account but found "
+ toString (length primaries)
+ ", namely "
+ concatStringsSep ", " primaries;
diff --git a/modules/accounts/contacts.nix b/modules/accounts/contacts.nix
index f1c22398c..8fd993442 100644
--- a/modules/accounts/contacts.nix
+++ b/modules/accounts/contacts.nix
@@ -11,6 +11,7 @@ let
path = mkOption {
type = types.str;
default = "${cfg.basePath}/${name}";
+ defaultText = "‹accounts.contact.basePath›/‹name›";
description = "The path of the storage.";
};
@@ -46,7 +47,7 @@ let
url = mkOption {
type = types.nullOr types.str;
default = null;
- description = "The url of the storage.";
+ description = "The URL of the storage.";
};
userName = mkOption {
@@ -55,23 +56,21 @@ let
description = "User name for authentication.";
};
- userNameCommand = mkOption {
- type = types.nullOr (types.listOf types.str);
- default = null;
- example = [ "~/get-username.sh" ];
- description = ''
- A command that prints the user name to standard
- output.
- '';
- };
+ # userNameCommand = mkOption {
+ # type = types.nullOr (types.listOf types.str);
+ # default = null;
+ # example = [ "~/get-username.sh" ];
+ # description = ''
+ # A command that prints the user name to standard output.
+ # '';
+ # };
passwordCommand = mkOption {
type = types.nullOr (types.listOf types.str);
default = null;
example = [ "pass" "caldav" ];
description = ''
- A command that prints the password to standard
- output.
+ A command that prints the password to standard output.
'';
};
};
@@ -105,11 +104,9 @@ let
};
};
- config = mkMerge [
- {
- name = name;
- }
- ];
+ config = {
+ name = name;
+ };
};
in
@@ -118,10 +115,14 @@ in
options.accounts.contact = {
basePath = mkOption {
type = types.str;
- default = "${config.home.homeDirectory}/.contacts/";
- defaultText = "$HOME/.contacts";
+ apply = p:
+ if hasPrefix "/" p
+ then p
+ else "${config.home.homeDirectory}/${p}";
description = ''
- The base directory in which to save contacts.
+ The base directory in which to save contacts. May be a
+ relative path, in which case it is relative the home
+ directory.
'';
};
@@ -135,6 +136,4 @@ in
description = "List of contacts.";
};
};
- config = mkIf (cfg.accounts != {}) {
- };
}
diff --git a/modules/programs/khal-accounts.nix b/modules/programs/khal-accounts.nix
index cb615b29c..ad94adc99 100644
--- a/modules/programs/khal-accounts.nix
+++ b/modules/programs/khal-accounts.nix
@@ -8,19 +8,10 @@ with lib;
readOnly = mkOption {
type = types.bool;
+ default = false;
description = ''
Keep khal from making any changes to this account.
'';
- default = false;
- };
-
- glob = mkOption {
- type = types.str;
- default = "*";
- description = ''
- The glob expansion to be searched for events or birthdays when type
- is set to discover.
- '';
};
};
}
diff --git a/modules/programs/khal-calendar-accounts.nix b/modules/programs/khal-calendar-accounts.nix
index 617a39b62..12f1aeed2 100644
--- a/modules/programs/khal-calendar-accounts.nix
+++ b/modules/programs/khal-calendar-accounts.nix
@@ -6,7 +6,18 @@ with lib;
options.khal = {
type = mkOption {
type = types.nullOr (types.enum [ "calendar" "discover"]);
+ default = null;
description = ''
+ There is no description of this option.
+ '';
+ };
+
+ glob = mkOption {
+ type = types.str;
+ default = "*";
+ description = ''
+ The glob expansion to be searched for events or birthdays when
+ type is set to discover.
'';
};
};
diff --git a/modules/programs/khal.nix b/modules/programs/khal.nix
index 97f9ad404..2e8c98310 100644
--- a/modules/programs/khal.nix
+++ b/modules/programs/khal.nix
@@ -7,17 +7,30 @@ let
cfg = config.programs.khal;
- khalCalendarAccounts = filterAttrs (_: a: a.khal.enable)
- (config.accounts.calendar.accounts);
+ khalCalendarAccounts =
+ filterAttrs (_: a: a.khal.enable) config.accounts.calendar.accounts;
- khalContactAccounts = mapAttrs (_: v: v // {type = "birthdays";})
- (filterAttrs (_: a: a.khal.enable)
- (config.accounts.contact.accounts));
+ khalContactAccounts =
+ mapAttrs (_: v: v // { type = "birthdays"; })
+ (filterAttrs (_: a: a.khal.enable) config.accounts.contact.accounts);
khalAccounts = khalCalendarAccounts // khalContactAccounts;
- primaryAccount = findSingle (a: a.primary) null null
+ primaryAccount =
+ findSingle (a: a.primary) null null
(mapAttrsToList (n: v: v // {name= n;}) khalAccounts);
+
+ genCalendarStr = name: value:
+ concatStringsSep "\n" (
+ [
+ "[[${name}]]"
+ "path = ${value.local.path + "/" + (optionalString (value.khal.type == "discover") value.khal.glob)}"
+ ]
+ ++ optional (value.khal.readOnly) "readonly = True"
+ ++ optional (!isNull value.khal.type) "type = ${value.khal.type}"
+ ++ ["\n"]
+ );
+
in
{
@@ -29,36 +42,27 @@ in
home.packages = [ pkgs.khal ];
xdg.configFile."khal/config".text = concatStringsSep "\n" (
- [
- "[calendars]"
- ]
- ++ (mapAttrsToList (name: value: concatStringsSep "\n"
- ([
- ''[[${name}]]''
- ''path = ${value.local.path + "/" + (optionalString (value.khal.type == "discover") value.khal.glob)}''
+ [
+ "[calendars]"
]
- ++ optional (value.khal.readOnly) "readonly = True"
- ++ optional (!isNull value.khal.type) "type = ${value.khal.type}"
- ++ ["\n"]
- )
- ) khalAccounts)
- ++
- [
- (generators.toINI {} {
- default = optionalAttrs (!isNull primaryAccount) {
- default_calendar = if isNull primaryAccount.primaryCollection then primaryAccount.name else primaryAccount.primaryCollection;
- };
+ ++ mapAttrsToList genCalendarStr khalAccounts
+ ++
+ [
+ (generators.toINI {} {
+ default = optionalAttrs (!isNull primaryAccount) {
+ default_calendar = if isNull primaryAccount.primaryCollection then primaryAccount.name else primaryAccount.primaryCollection;
+ };
- locale = {
- timeformat = "%H:%M";
- dateformat = "%Y-%m-%d";
- longdateformat = "%Y-%m-%d";
- datetimeformat = "%Y-%m-%d %H:%M";
- longdatetimeformat = "%Y-%m-%d %H:%M";
- weeknumbers = "right";
- };
- })
- ]
+ locale = {
+ timeformat = "%H:%M";
+ dateformat = "%Y-%m-%d";
+ longdateformat = "%Y-%m-%d";
+ datetimeformat = "%Y-%m-%d %H:%M";
+ longdatetimeformat = "%Y-%m-%d %H:%M";
+ weeknumbers = "right";
+ };
+ })
+ ]
);
};
}
diff --git a/modules/programs/vdirsyncer-accounts.nix b/modules/programs/vdirsyncer-accounts.nix
index 96789bae7..6b2e9796e 100644
--- a/modules/programs/vdirsyncer-accounts.nix
+++ b/modules/programs/vdirsyncer-accounts.nix
@@ -21,14 +21,18 @@ in
};
conflictResolution = mkOption {
- type = types.nullOr (types.either (types.enum ["remote wins" "local wins"]) (types.listOf types.str));
+ type =
+ types.nullOr
+ (types.either
+ (types.enum ["remote wins" "local wins"])
+ (types.listOf types.str));
default = null;
description = ''
- What to do in case of a conflict between the storages.
- Either "remote wins"
- or "local wins"
- or a list that contains a command to run.
- By default, an error message is printed.
+ What to do in case of a conflict between the storages. Either
+ remote wins or
+ local wins or
+ a list that contains a command to run. By default, an error
+ message is printed.
'';
};
@@ -38,8 +42,9 @@ in
description = ''
What should happen if synchronization in one direction
is impossible due to one storage being read-only.
- Defaults to "revert".
- See
+ Defaults to revert.
+
+ See
for more information.
'';
@@ -50,8 +55,8 @@ in
default = [];
example = [ "color" "displayname" ];
description = ''
- Metadata keys that should be synchronized
- when vdirsyncer metasync is executed.
+ Metadata keys that should be synchronized when vdirsyncer
+ metasync is executed.
'';
};
@@ -69,12 +74,11 @@ in
};
};
});
-
default = null;
description = ''
- A time range to synchronize. start and end
- can be any Python expression that returns
- a datetime.datetime object.
+ A time range to synchronize. start and end can be any Python
+ expression that returns a datetime.datetime
+ object.
'';
example = {
start = "datetime.now() - timedelta(days=365)";
@@ -86,10 +90,9 @@ in
type = types.nullOr (types.listOf types.str);
default = null;
description = ''
- Kinds of items to show. The default is to
- show everything. This depends on particular
- features of the server, the results are not
- validated.
+ Kinds of items to show. The default is to show everything.
+ This depends on particular features of the server, the results
+ are not validated.
'';
};
@@ -103,9 +106,9 @@ in
type = types.nullOr types.str;
default = null;
description = ''
- Optional. SHA1 or MD5 fingerprint of the expected server certificate.
-
- See
+ Optional. SHA1 or MD5 fingerprint of the expected server certificate.
+
+ See
for more information.
'';
@@ -115,7 +118,7 @@ in
type = types.nullOr (types.enum ["basic" "digest" "guess"]);
default = null;
description = ''
- Authentication settings. The default is "basic".
+ Authentication settings. The default is basic.
'';
};
@@ -123,8 +126,8 @@ in
type = types.nullOr (types.either types.str (types.listOf types.str));
default = null;
description = ''
- Either a path to a certificate with a client certificate
- and the key or a list of paths to the files with them.
+ Either a path to a certificate with a client certificate and
+ the key or a list of paths to the files with them.
'';
};
@@ -132,8 +135,8 @@ in
type = types.nullOr types.str;
default = null;
description = ''
- The user agent to report to the server.
- Defaults to "vdirsyncer".
+ The user agent to report to the server. Defaults to
+ vdirsyncer.
'';
};
@@ -153,8 +156,7 @@ in
type = types.nullOr types.str;
default = null;
description = ''
- A file path where access tokens
- are stored.
+ A file path where access tokens are stored.
'';
};
@@ -165,10 +167,8 @@ in
description = ''
A command that prints the OAuth credentials to standard
output.
-
- OAuth credentials, obtained from the Google API Manager.
-
- See
+
+ See
for more information.
'';
@@ -181,10 +181,8 @@ in
description = ''
A command that prints the OAuth credentials to standard
output.
-
- OAuth credentials, obtained from the Google API Manager.
-
- See
+
+ See
for more information.
'';