From c072526cfa616b46f71752bf072230f236da9f20 Mon Sep 17 00:00:00 2001 From: Karl Hallsby Date: Fri, 26 Jun 2020 20:38:40 +0200 Subject: [PATCH] mbsync: set the submodule's names field according to parameter This is the same method as is used in creating an email account, named `` under `accounts.email.accounts.`. This allows the user to specify groups and channels, in a list-like format, but still gets the "namespacing" to more easily handle the options available in each of these locations. --- modules/programs/mbsync-accounts.nix | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/modules/programs/mbsync-accounts.nix b/modules/programs/mbsync-accounts.nix index 11bc8e23..883e46c4 100644 --- a/modules/programs/mbsync-accounts.nix +++ b/modules/programs/mbsync-accounts.nix @@ -8,9 +8,11 @@ let perAccountGroups = { name, config, ... }: { options = { - groupName = mkOption { + name = mkOption { type = types.str; + # Make value of name the same as the name used with the dot prefix default = name; + readOnly = true; description = '' The name of this group for this account. These names are different than some others, because they will hide channel names that are the same. @@ -18,7 +20,7 @@ let }; channels = mkOption { - type = types.listOf (types.submodule groupChannel); + type = types.attrsOf (types.submodule channel); default = { }; description = '' List of channels that should be grouped together into this group. When @@ -33,11 +35,12 @@ let }; # Options for configuring channel(s) that will be composed together into a group. - groupChannel = { config, ... }: { + channel = { name, config, ... }: { options = { name = mkOption { type = types.str; - default = "DEFAULT"; + default = name; + readOnly = true; description = '' The unique name for THIS channel in THIS group. The group will refer to this channel by this name.