1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-11-08 11:36:05 +01:00
home-manager/tests/lib/generators/toscfg-example.nix
Anton Mosich 89a9fa0f3f generators: rewrite toSCFG
The former toSCFG implementation had several shortcomings which
did not consider a few possibilities SCFG provides. Details were lined
out in #7465.
The new interface needs more verbosity, but reflects better the
properties of the SCFG format. I also chose to use the names used in the
[Specification].

[Specification]: https://git.sr.ht/~emersion/scfg#specification-draft
2025-10-20 17:10:44 +02:00

62 lines
1.2 KiB
Nix

{ lib, ... }:
{
home.file."toscfg-example-result.txt".text = lib.hm.generators.toSCFG { } (
lib.singleton {
name = "dir";
children = lib.singleton {
name = "blk1";
params = [
"p1"
''"p2"''
];
children = [
{
name = "sub1";
params = [
"arg11"
"arg12"
];
}
{
name = "sub2";
params = [
"arg21"
"arg22"
];
}
{
name = "sub2";
params = [
"arg1"
"arg2"
];
}
{
name = "sub3";
params = [
"arg31"
"arg32"
];
children = [
{ name = "sub sub1"; }
{
name = "sub-sub2";
params = [
"arg321"
"arg322"
];
}
];
}
];
};
}
);
nmt.script = ''
assertFileContent \
home-files/toscfg-example-result.txt \
${./toscfg-example-result.txt}
'';
}