tests/modules/dependencies: test all package examples

This commit is contained in:
Gaetan Lepage 2025-04-11 15:42:21 +02:00 committed by nix-infra-bot
parent e9a85eed8b
commit 72ce6dbdf5

View file

@ -20,4 +20,29 @@
enable = lib.meta.availableOn pkgs.stdenv.hostPlatform depOption.package.default;
}) options.dependencies;
};
all-examples =
{
lib,
pkgs,
options,
...
}:
{
dependencies = lib.pipe options.dependencies [
(lib.filterAttrs (_: depOption: depOption.package ? example))
(lib.mapAttrs (
_: depOption:
let
packageName = depOption.package.example.text;
packagePath = lib.splitString "." packageName;
package = lib.attrByPath packagePath (throw "${packageName} not found in pkgs") pkgs;
in
{
enable = lib.meta.availableOn pkgs.stdenv.hostPlatform package;
inherit package;
}
))
];
};
}