1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-11-08 19:46:05 +01:00

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.
This commit is contained in:
Anton Mosich 2025-09-02 15:20:15 +02:00 committed by Matthieu Coudron
parent 817ca5e948
commit db876d1d9f

View file

@ -103,7 +103,34 @@ in
} }
]; ];
home.packages = [ cfg.package ]; 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 ]; meta.maintainers = [ lib.maintainers.malte-v ];