39 lines
1.2 KiB
Nix
39 lines
1.2 KiB
Nix
{
|
|
lib,
|
|
path,
|
|
|
|
overlayAttrname ? "den-outputs",
|
|
}:
|
|
|
|
assert lib.assertMsg (!lib.hasInfix "." overlayAttrname) (lib.pipe ''
|
|
overlayAttrname must not contain a dot (.),
|
|
because dot is used to reference package in a package set
|
|
inside nix-update-script.
|
|
'' [
|
|
lib.lines
|
|
(lib.concatStringsSep " ")
|
|
]);
|
|
|
|
let
|
|
updateScript = import (path + /maintainers/scripts/update.nix);
|
|
functionArgs = lib.functionArgs updateScript;
|
|
nameInFunctionArgs = name: lib.elem name (lib.attrNames functionArgs);
|
|
in
|
|
{
|
|
__functionArgs = functionArgs // { packages = false; };
|
|
__functor = _: args: let
|
|
# args.outputs should be an attrset of packages to update
|
|
overlay = _: _: {
|
|
"${overlayAttrname}" = args.packages;
|
|
};
|
|
in updateScript (lib.filterAttrs (name: _: nameInFunctionArgs name) args // {
|
|
include-overlays =
|
|
if !args ? updateScript then [ overlay ]
|
|
else if lib.isList args.updateScript then [ overlay ] ++ args.updateScript
|
|
else args.updateScript;
|
|
} // lib.optionalAttrs (args ? package) {
|
|
package = "${overlayAttrname}.${args.package}";
|
|
} // lib.optionalAttrs (args ? path) {
|
|
path = if lib.stringLength args.path == 0 then overlayAttrname else "${overlayAttrname}.${args.path}";
|
|
});
|
|
}
|