summary refs log tree commit diff
diff options
context:
space:
mode:
authorArtturin <Artturin@artturin.com>2023-06-29 18:36:25 +0300
committerArtturin <Artturin@artturin.com>2023-06-29 18:41:34 +0300
commitce54db6fe127c5199e088273fa0b275ef7f1cb44 (patch)
tree4d1391be197ef446922407fc78c3619777254718
parent7076a89db0770da2c8e0b57f7158eb90345f6c11 (diff)
downloadnixpkgs-ce54db6fe127c5199e088273fa0b275ef7f1cb44.tar
nixpkgs-ce54db6fe127c5199e088273fa0b275ef7f1cb44.tar.gz
nixpkgs-ce54db6fe127c5199e088273fa0b275ef7f1cb44.tar.bz2
nixpkgs-ce54db6fe127c5199e088273fa0b275ef7f1cb44.tar.lz
nixpkgs-ce54db6fe127c5199e088273fa0b275ef7f1cb44.tar.xz
nixpkgs-ce54db6fe127c5199e088273fa0b275ef7f1cb44.tar.zst
nixpkgs-ce54db6fe127c5199e088273fa0b275ef7f1cb44.zip
lib.generators.toINIWithGlobalSection: give sections a default
often sections aren't needed when using globalSection

currently one has to `sections = { }` when using only globalSection

```
lib.generators.toINIWithGlobalSection { } {
  globalSection = {
    background_color = "1d202199";
  };
  sections = { };
};
````
-rw-r--r--lib/generators.nix2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/generators.nix b/lib/generators.nix
index 496845fc9ae..a2dddedd2d3 100644
--- a/lib/generators.nix
+++ b/lib/generators.nix
@@ -168,7 +168,7 @@ rec {
     mkKeyValue    ? mkKeyValueDefault {} "=",
     # allow lists as values for duplicate keys
     listsAsDuplicateKeys ? false
-  }: { globalSection, sections }:
+  }: { globalSection, sections ? {} }:
     ( if globalSection == {}
       then ""
       else (toKeyValue { inherit mkKeyValue listsAsDuplicateKeys; } globalSection)