mirror of
https://github.com/nix-community/home-manager
synced 2024-11-26 21:19:45 +01:00
parent
28f2dd612e
commit
472d7731d6
3 changed files with 19 additions and 4 deletions
|
@ -6,11 +6,22 @@ let
|
||||||
|
|
||||||
cfg = config.programs.git;
|
cfg = config.programs.git;
|
||||||
|
|
||||||
|
# generation for multiple ini values
|
||||||
|
mkKeyValue = k: v:
|
||||||
|
let
|
||||||
|
mkKeyValue = generators.mkKeyValueDefault {} "=" k;
|
||||||
|
in
|
||||||
|
concatStringsSep "\n" (map mkKeyValue (toList v));
|
||||||
|
|
||||||
|
gitToIni = generators.toINI { inherit mkKeyValue; };
|
||||||
|
|
||||||
gitIniType = with types;
|
gitIniType = with types;
|
||||||
let
|
let
|
||||||
primitiveType = either bool (either int str);
|
primitiveType = either str (either bool int);
|
||||||
|
multipleType = either primitiveType (listOf primitiveType);
|
||||||
|
sectionType = attrsOf multipleType;
|
||||||
in
|
in
|
||||||
attrsOf (attrsOf primitiveType);
|
attrsOf sectionType;
|
||||||
|
|
||||||
signModule = types.submodule {
|
signModule = types.submodule {
|
||||||
options = {
|
options = {
|
||||||
|
@ -64,7 +75,7 @@ let
|
||||||
};
|
};
|
||||||
|
|
||||||
config.path = mkIf (config.contents != {}) (
|
config.path = mkIf (config.contents != {}) (
|
||||||
mkDefault (pkgs.writeText "contents" (generators.toINI {} config.contents))
|
mkDefault (pkgs.writeText "contents" (gitToIni config.contents))
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -175,7 +186,7 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
xdg.configFile = {
|
xdg.configFile = {
|
||||||
"git/config".text = generators.toINI {} cfg.iniContent;
|
"git/config".text = gitToIni cfg.iniContent;
|
||||||
|
|
||||||
"git/ignore" = mkIf (cfg.ignores != []) {
|
"git/ignore" = mkIf (cfg.ignores != []) {
|
||||||
text = concatStringsSep "\n" cfg.ignores + "\n";
|
text = concatStringsSep "\n" cfg.ignores + "\n";
|
||||||
|
|
|
@ -8,6 +8,8 @@ gpgSign=true
|
||||||
[extra]
|
[extra]
|
||||||
boolean=true
|
boolean=true
|
||||||
integer=38
|
integer=38
|
||||||
|
multiple=1
|
||||||
|
multiple=2
|
||||||
name=value
|
name=value
|
||||||
|
|
||||||
[filter "lfs"]
|
[filter "lfs"]
|
||||||
|
|
|
@ -31,6 +31,7 @@ in
|
||||||
extraConfig = {
|
extraConfig = {
|
||||||
extra = {
|
extra = {
|
||||||
name = "value";
|
name = "value";
|
||||||
|
multiple = [1];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
ignores = [ "*~" "*.swp" ];
|
ignores = [ "*~" "*.swp" ];
|
||||||
|
@ -59,6 +60,7 @@ in
|
||||||
aliases.a2 = mkForce "baz";
|
aliases.a2 = mkForce "baz";
|
||||||
extraConfig.extra.boolean = true;
|
extraConfig.extra.boolean = true;
|
||||||
extraConfig.extra.integer = 38;
|
extraConfig.extra.integer = 38;
|
||||||
|
extraConfig.extra.multiple = [2];
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue