mirror of
https://github.com/nix-community/home-manager.git
synced 2025-11-08 11:36: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:
parent
817ca5e948
commit
db876d1d9f
1 changed files with 28 additions and 1 deletions
|
|
@ -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 ];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue