From 7ec22b6e5204cdfe60f47874429deabf817e1dc2 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Tue, 18 Mar 2025 18:09:26 +0100 Subject: [PATCH] pkgs/den-update-script: init --- pkgs/by-name/de/den-update-script/package.nix | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 pkgs/by-name/de/den-update-script/package.nix diff --git a/pkgs/by-name/de/den-update-script/package.nix b/pkgs/by-name/de/den-update-script/package.nix new file mode 100644 index 0000000..662e3ce --- /dev/null +++ b/pkgs/by-name/de/den-update-script/package.nix @@ -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}"; + }); +}