fork/home-manager
git clone https://git.julia.blue/fork/home-manager
b01eb1eb
master
1{ config , lib , pkgs , ...} : 2 3with lib ; 4 5let 6 7cfg = config . accounts . contact ; 8 9localModule = name : 10types . submodule { 11options = { 12path = mkOption { 13type = types . str ; 14default = " ${ cfg . basePath } / ${ name } " ; 15defaultText = "‹accounts.contact.basePath›/‹name›" ; 16description = "The path of the storage." ; 17}; 18 19type = mkOption { 20type = types . enum [ "filesystem" "singlefile" ]; 21description = "The type of the storage." ; 22}; 23 24fileExt = mkOption { 25type = types . nullOr types . str ; 26default = null ; 27description = "The file extension to use." ; 28}; 29 30encoding = mkOption { 31type = types . nullOr types . str ; 32default = null ; 33description = '' 34File encoding for items, both content and file name. 35Defaults to UTF-8. 36'' ; 37}; 38}; 39}; 40 41remoteModule = types . submodule { 42options = { 43type = mkOption { 44type = types . enum [ "carddav" "http" "google_contacts" ]; 45description = "The type of the storage." ; 46}; 47 48url = mkOption { 49type = types . nullOr types . str ; 50default = null ; 51description = "The URL of the storage." ; 52}; 53 54userName = mkOption { 55type = types . nullOr types . str ; 56default = null ; 57description = "User name for authentication." ; 58}; 59 60# userNameCommand = mkOption { 61# type = types.nullOr (types.listOf types.str); 62# default = null; 63# example = [ "~/get-username.sh" ]; 64# description = '' 65# A command that prints the user name to standard output. 66# ''; 67# }; 68 69passwordCommand = mkOption { 70type = types . nullOr ( types . listOf types . str ); 71default = null ; 72example = [ "pass" "caldav" ]; 73description = '' 74A command that prints the password to standard output. 75'' ; 76}; 77}; 78}; 79 80contactOpts = { name , config , ...} :{ 81options = { 82name = mkOption { 83type = types . str ; 84readOnly = true ; 85description = '' 86Unique identifier of the contact account. This is set to the 87attribute name of the contact configuration. 88'' ; 89}; 90 91local = mkOption { 92type = types . nullOr ( localModule name ); 93default = null ; 94description = '' 95Local configuration for the contacts. 96'' ; 97}; 98 99remote = mkOption { 100type = types . nullOr remoteModule ; 101default = null ; 102description = '' 103Remote configuration for the contacts. 104'' ; 105}; 106}; 107 108config = { name = name ; }; 109}; 110 111in { 112options . accounts . contact = { 113basePath = mkOption { 114type = types . str ; 115apply = p : 116if hasPrefix "/" p then p else " ${ config . home . homeDirectory } / ${ p } " ; 117description = '' 118The base directory in which to save contacts. May be a 119relative path, in which case it is relative the home 120directory. 121'' ; 122}; 123 124accounts = mkOption { 125type = types . attrsOf ( types . submodule [ 126contactOpts 127( import ../programs/vdirsyncer-accounts.nix ) 128( import ../programs/khal-accounts.nix ) 129]); 130default = { }; 131description = "List of contacts." ; 132}; 133}; 134}