Specifically,
- directly export `modules/lib/dag.nix` instead of renaming
attributes,
- run through utilities to reuse code where possible,
- expose `lib.hm.dag.isEntry` and reuse it in
`modules/lib/types-dag.nix`,
- reuse utilities through `lib` set instead of passing imports to
functions, and
- eta reduction of `map`, `entryAnywhere`, `entryAfter` and
`entryBefore`.
Removes the `uniq` constraint on `after` and `before` so that we can
merge multiple definitions for the same DAG entry:
{
dag = mkMerge [
{
foo = lib.hm.dag.entryBefore [ "bar" ] {
# definition 1
};
}
{
foo = lib.hm.dag.entryBefore [ "qux" ] {
# definition 2
};
}
{
foo = {
# definition 3
};
}
];
}
In this example `foo` will come before `bar` and `qux`.
This makes definitions like
home.activation.foo = mkIf false "bar"
work, where previously they would complain about
`home.activation.foobar.data` being used but not defined.
The crucial part is that we don't call `convertAllToDags` in
`dagOf.merge`, because we need to process `mkIf`/`mkMerge` properties
first. So we let `attrEquivalent.merge` do its job normally, but give
it a type `dagEntryOf` that does the conversion.
Ideally this shouldn't require so much boilerplate; I'd like to
implement something like
types.changeInto dagContentType elemType dagEntryAnywhere
in Nixpkgs.
Given an inner type, the former function generates a type that expect
DAG option values. The latter function is only present to temporarily
allow the `programs.ssh.matchBlocks` to keep accepting list values.