mirror of
https://github.com/nix-community/dream2nix.git
synced 2024-12-23 14:31:55 +03:00
a27d3894ae
* add derived graph * rework graph sanitizing based on list keys * figure out details for builder * format stuff! * try get groups working * nodejs: fixups for new v3 builder Co-authored-by: Johannes Kirschbauer <hsjobeki@gmail.com> --------- Co-authored-by: DavHau <hsngrmpf+github@gmail.com>
118 lines
2.2 KiB
Nix
118 lines
2.2 KiB
Nix
{lib ? import <nixpkgs/lib>, ...}: let
|
|
util = import ../../../lib/internal/graphUtils.nix {inherit lib;};
|
|
in {
|
|
test_simple = {
|
|
expr = util.sanitizeGraph {
|
|
root = {
|
|
name = "a";
|
|
version = "1.0.0";
|
|
};
|
|
graph = {
|
|
a."1.0.0" = {
|
|
dependencies = {
|
|
b.version = "1.0.0";
|
|
};
|
|
dev = true;
|
|
};
|
|
b."1.0.0" = {
|
|
dependencies = {
|
|
a.version = "1.0.0";
|
|
};
|
|
dev = true;
|
|
};
|
|
};
|
|
};
|
|
expected = [
|
|
{
|
|
isRoot = true;
|
|
key = ["a" "1.0.0"];
|
|
name = "a";
|
|
version = "1.0.0";
|
|
}
|
|
{
|
|
dev = true;
|
|
key = ["b" "1.0.0"];
|
|
name = "b";
|
|
parent = {
|
|
name = "a";
|
|
version = "1.0.0";
|
|
};
|
|
version = "1.0.0";
|
|
}
|
|
];
|
|
};
|
|
test_two_cycles = {
|
|
expr = util.sanitizeGraph {
|
|
root = {
|
|
name = "a";
|
|
version = "1.0.0";
|
|
};
|
|
graph = {
|
|
a."1.0.0" = {
|
|
dependencies = {
|
|
c.version = "1.0.0";
|
|
};
|
|
dev = true;
|
|
};
|
|
b."1.0.0" = {
|
|
dependencies = {
|
|
c.version = "1.0.0";
|
|
};
|
|
dev = true;
|
|
};
|
|
c."1.0.0" = {
|
|
dependencies = {
|
|
d.version = "1.0.0";
|
|
};
|
|
dev = true;
|
|
};
|
|
d."1.0.0" = {
|
|
dependencies = {
|
|
a.version = "1.0.0";
|
|
b.version = "1.0.0";
|
|
};
|
|
dev = true;
|
|
};
|
|
};
|
|
};
|
|
expected = [
|
|
{
|
|
isRoot = true;
|
|
key = ["a" "1.0.0"];
|
|
name = "a";
|
|
version = "1.0.0";
|
|
}
|
|
{
|
|
dev = true;
|
|
key = ["c" "1.0.0"];
|
|
name = "c";
|
|
parent = {
|
|
name = "a";
|
|
version = "1.0.0";
|
|
};
|
|
version = "1.0.0";
|
|
}
|
|
{
|
|
dev = true;
|
|
key = ["d" "1.0.0"];
|
|
name = "d";
|
|
parent = {
|
|
name = "c";
|
|
version = "1.0.0";
|
|
};
|
|
version = "1.0.0";
|
|
}
|
|
{
|
|
dev = true;
|
|
key = ["b" "1.0.0"];
|
|
name = "b";
|
|
parent = {
|
|
name = "d";
|
|
version = "1.0.0";
|
|
};
|
|
version = "1.0.0";
|
|
}
|
|
];
|
|
};
|
|
}
|