git: use attrsOf instead of attrs

This makes sure that values added to

    programs.git.aliases

or

    programs.git.extraConfig

are merged as expected.

Also add a few option examples.
This commit is contained in:
Robert Helgesson 2019-02-01 01:06:18 +01:00
parent 0590c2a4f6
commit 445c0b1482
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
3 changed files with 50 additions and 30 deletions

View file

@ -6,6 +6,12 @@ let
cfg = config.programs.git;
gitIniType = with types;
let
primitiveType = either bool (either int str);
in
attrsOf (attrsOf primitiveType);
signModule = types.submodule {
options = {
key = mkOption {
@ -80,8 +86,9 @@ in
};
aliases = mkOption {
type = types.attrs;
type = types.attrsOf types.str;
default = {};
example = { co = "checkout"; };
description = "Git aliases to define.";
};
@ -92,13 +99,16 @@ in
};
extraConfig = mkOption {
type = types.either types.attrs types.lines;
type = types.either types.lines gitIniType;
default = {};
example = {
core = { whitespace = "trailing-space,space-before-tab"; };
};
description = "Additional configuration to add.";
};
iniContent = mkOption {
type = types.attrsOf types.attrs;
type = gitIniType;
internal = true;
};