about summary refs log tree commit diff
path: root/pkgs/pkgs-lib/formats.nix
diff options
context:
space:
mode:
authorJulien Moutinho <julm+nixpkgs@sourcephile.fr>2020-05-26 20:54:52 +0200
committerJulien Moutinho <julm+nixpkgs@sourcephile.fr>2022-05-12 01:56:15 +0200
commit8514800c42a2d292fcc81b6ecc9f0f10eef60868 (patch)
treec4ed1bd151757ed6b070fe8c67c629f9a75bcee4 /pkgs/pkgs-lib/formats.nix
parent9b6223d1fa2dcb23462a8451d7fafcff8616f16a (diff)
nixos/public-inbox: init
Diffstat (limited to 'pkgs/pkgs-lib/formats.nix')
-rw-r--r--pkgs/pkgs-lib/formats.nix11
1 files changed, 11 insertions, 0 deletions
diff --git a/pkgs/pkgs-lib/formats.nix b/pkgs/pkgs-lib/formats.nix
index 5e17519d4ce18..e6e6a95c1f4a1 100644
--- a/pkgs/pkgs-lib/formats.nix
+++ b/pkgs/pkgs-lib/formats.nix
@@ -123,6 +123,17 @@ rec {
 
   };
 
+  gitIni = { listsAsDuplicateKeys ? false, ... }@args: {
+
+    type = with lib.types; let
+
+      iniAtom = (ini args).type/*attrsOf*/.functor.wrapped/*attrsOf*/.functor.wrapped;
+
+    in attrsOf (attrsOf (either iniAtom (attrsOf iniAtom)));
+
+    generate = name: value: pkgs.writeText name (lib.generators.toGitINI value);
+  };
+
   toml = {}: json {} // {
     type = with lib.types; let
       valueType = oneOf [