pkgs/den-update-script: init
This commit is contained in:
parent
3fb3b7771f
commit
7ec22b6e52
1 changed files with 39 additions and 0 deletions
39
pkgs/by-name/de/den-update-script/package.nix
Normal file
39
pkgs/by-name/de/den-update-script/package.nix
Normal file
|
@ -0,0 +1,39 @@
|
|||
{
|
||||
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}";
|
||||
});
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue