labs/foundation/src/exports/default.nix

39 lines
713 B
Nix
Raw Normal View History

2024-06-05 02:04:40 +00:00
{
lib,
config,
}: let
options = {
packages = lib.options.create {
default.value = {};
type = lib.types.attrs.of lib.types.package;
};
};
in {
options = {
exports = {
inherit (options) packages;
resolved = {
inherit (options) packages;
};
};
};
config = {
exports.resolved =
builtins.mapAttrs (
name: value:
lib.attrs.filter
(
name: value:
if value ? meta && value.meta ? platforms
then builtins.elem config.aux.system value.meta.platforms
else true
)
value
)
(builtins.removeAttrs config.exports ["resolved"]);
};
}