about summary refs log tree commit diff
diff options
context:
space:
mode:
authoraszlig <aszlig@redmoonstudios.org>2016-11-09 19:09:41 +0100
committeraszlig <aszlig@redmoonstudios.org>2016-11-09 19:09:41 +0100
commit6344a262176a78b724c14122c2db7f9f1fa0ddb3 (patch)
tree374b57c14aedc052f8354ad51c4ef4b4ba2b85eb
parentad5d806dfaf9c006a5d9c37dd74080387c0200bf (diff)
modules/git: Fix/flesh out type for Git config
We need to properly separate attrsOf from the nested attrsOf because
otherwise the either type isn't able to distinguish between both types
during merging of the subtypes.

Now we have sub sections which is '[section "subsection"]' in Git's
config syntax and attrsOf (attrsOf ...) on our side and simple sections
like '[section]' which is just a plain attrsOf. This way we have an
additional type constraint in that we can't mix up subsections with
sections by the same name.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
-rw-r--r--modules/user/aszlig/programs/git/default.nix5
1 files changed, 3 insertions, 2 deletions
diff --git a/modules/user/aszlig/programs/git/default.nix b/modules/user/aszlig/programs/git/default.nix
index 62f0218c..3cfdc742 100644
--- a/modules/user/aszlig/programs/git/default.nix
+++ b/modules/user/aszlig/programs/git/default.nix
@@ -45,8 +45,9 @@ in {
       description = "System-wide default config for Git";
 
       type = with types; let
-        value = either (either bool int) str;
-      in attrsOf (either (attrsOf value) value);
+        options = attrsOf (either (either bool int) str);
+        subSection = addCheck (attrsOf options) (s: all isAttrs (attrValues s));
+      in attrsOf (either subSection options);
 
       default = {};
       example = {