From db876d1d9f8dedfa4fed2e830ca99b1219e0828f Mon Sep 17 00:00:00 2001 From: Anton Mosich Date: Tue, 2 Sep 2025 15:20:15 +0200 Subject: [PATCH] programs/senpai: use new toSCFG interface I did not want to break any current configurations, and as it seems that senpai doesn't rely on any of the patterns that weren't possible with the old toSCFG generator. --- modules/programs/senpai.nix | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/modules/programs/senpai.nix b/modules/programs/senpai.nix index 43837f0c8..36127f9f7 100644 --- a/modules/programs/senpai.nix +++ b/modules/programs/senpai.nix @@ -103,7 +103,34 @@ in } ]; home.packages = [ cfg.package ]; - xdg.configFile."senpai/senpai.scfg".text = lib.hm.generators.toSCFG { } cfg.config; + xdg.configFile."senpai/senpai.scfg".text = + let + attrsToDirectiveList = lib.mapAttrsToList ( + name: value: + { + inherit name; + } + // ( + if (builtins.typeOf value != "set") then + { + params = lib.toList value; + } + else + let + children = lib.filterAttrs (n: _: n != "_params") value; + in + ( + lib.optionalAttrs (value ? "_params") { + params = value._params; + } + // lib.optionalAttrs (children != { }) { + children = attrsToDirectiveList children; + } + ) + ) + ); + in + lib.hm.generators.toSCFG { } (attrsToDirectiveList cfg.config); }; meta.maintainers = [ lib.maintainers.malte-v ];