self: super: let inherit (super) lib mylib; pushBack = x: xs: if builtins.elem x xs then lib.remove x xs ++ [ x ] else xs; in # Import files and subdirectories like they are overlays. lib.fix (builtins.foldl' (lib.flip lib.extends) (_: super) ( [ (self: super: { callObsolescentPackage = path: args: let override = self.callPackage path args; upstream = lib.optionalAttrs (override ? "name") (super.${(builtins.parseDrvName override.name).name} or {}); in if upstream ? "name" && override ? "name" && builtins.compareVersions upstream.name override.name != -1 then builtins.trace "Upstream `${upstream.name}' gets overridden by `${override.name}'." override else override; }) ] ++ map (name: import (./. + "/${name}")) (pushBack "override" (builtins.attrNames (lib.filterAttrs mylib.isNixDirEntry (builtins.readDir ./.)))) ) )