labs/tidepool/src/exports/packages.nix

46 lines
989 B
Nix
Raw Normal View History

{
config,
lib,
}: let
2024-06-13 17:22:57 +00:00
lib' = config.lib;
2024-06-14 11:47:54 +00:00
cfg = config.exports;
in {
options = {
exports.packages = lib.options.create {
2024-06-14 11:47:54 +00:00
type = lib.types.attrs.of (lib.types.function (lib.types.nullish lib.types.derivation));
default.value = {};
};
exported.packages = lib.options.create {
2024-06-14 11:47:54 +00:00
type = lib.types.attrs.of (lib.types.attrs.of lib.types.derivation);
default.value = {};
};
};
config = {
2024-06-14 11:47:54 +00:00
exported.packages = let
all = lib.attrs.generate lib'.systems.doubles.all (
system: let
packages =
builtins.mapAttrs
(name: resolve: resolve system)
cfg.packages;
available =
lib.attrs.filter
(name: package: package != null)
packages;
in
available
);
available =
lib.attrs.filter
(system: packages: builtins.length (builtins.attrNames packages) != 0)
all;
in
available;
};
}