about summary refs log tree commit diff
path: root/modules/programs
diff options
context:
space:
mode:
authorsternenseemann <sternenseemann@systemli.org>2024-09-14 14:12:19 +0200
committersternenseemann <sternenseemann@systemli.org>2024-09-14 14:12:19 +0200
commit3f90b433f7a90696ec97f7b4a6a0ec660beabc02 (patch)
tree7463cad5dd53efa1eda421e91bb1a5a748be2608 /modules/programs
parentb9c4841302d5db07595073137f69bbf1130c96ce (diff)
modules/programs/foot: remove global section hack, use [main]
Diffstat (limited to 'modules/programs')
-rw-r--r--modules/programs/foot/default.nix34
1 files changed, 9 insertions, 25 deletions
diff --git a/modules/programs/foot/default.nix b/modules/programs/foot/default.nix
index 5e10f7f8..9a42fec0 100644
--- a/modules/programs/foot/default.nix
+++ b/modules/programs/foot/default.nix
@@ -25,27 +25,8 @@ let
     description = "INI atom (bool, int, float or string)";
   };
 
-  # pkgs.formats.ini doesn't allow top-level bindings
-  # without a section, so we have to wrap it a bit
   # TODO(sterni): multiple binds
-  format = {
-    type = with lib.types;
-      (attrsOf (either iniAtom (attrsOf iniAtom))) // {
-        description = ''
-          attribute set of either top-level INI atoms (bool, int, float or string) or attribute sets (sections) of INI atoms
-        '';
-      };
-    generate = name: value:
-      let
-        isSection = builtins.isAttrs;
-        topLevel = lib.filterAttrs (_: v: !(isSection v)) value;
-        sections = lib.filterAttrs (_: v: isSection v) value;
-      in
-        pkgs.writeText name ''
-          ${toKeyValue {} topLevel}
-          ${toINI {} sections}
-        '';
-  };
+  format = pkgs.formats.ini {};
 
   prettyPrint = lib.generators.toPretty {};
 
@@ -151,10 +132,11 @@ let
     let
       withoutNulls =
         lib.filterAttrsRecursive (_: x: x != null) settings;
-      attrTransforms =
-        (lib.genAttrs fontOptions (n: (_: buildIniFontList))) // {
-          key-bindings =
-            lib.genAttrs commandBindOptions (n: (_: buildIniCommandBind));
+      attrTransforms = {
+        main =
+          lib.genAttrs fontOptions (n: (_: buildIniFontList));
+        key-bindings =
+          lib.genAttrs commandBindOptions (n: (_: buildIniCommandBind));
         };
     in
       mapAttrsByAttrs withoutNulls attrTransforms;
@@ -166,7 +148,9 @@ in {
     settings = lib.mkOption {
       type = lib.types.submodule {
         freeformType = format.type;
-        options = (lib.genAttrs fontOptions mkFontOption) // {
+        options = {
+          main =
+            lib.genAttrs fontOptions mkFontOption;
           key-bindings =
             lib.genAttrs commandBindOptions mkCommandBindOption;
         };