depot/packages/lib/tools.nix

28 lines
844 B
Nix
Raw Normal View History

2021-06-05 23:59:06 +03:00
rec {
dirfilter = type: path:
(let root = builtins.readDir path;
in builtins.filter (x: builtins.getAttr x root == type)
(builtins.attrNames root));
absolutify = path: ../../. + ("/" + path);
mkpatchlist = pkg:
map (patch: absolutify (builtins.concatStringsSep "/" [ pkg patch ]))
(dirfilter "regular" (absolutify pkg));
patch = super: patchdir:
super.overrideAttrs
(attrs: { patches = (attrs.patches or [ ]) ++ (mkpatchlist patchdir); });
patch-rename = super: pname: patchdir:
super.overrideAttrs (attrs: {
patches = (attrs.patches or [ ]) ++ (mkpatchlist patchdir);
inherit pname;
});
patch-rename-direct = super: renameWith: patchdir:
super.overrideAttrs (attrs: {
patches = (attrs.patches or [ ]) ++ (mkpatchlist patchdir);
name = renameWith attrs;
});
}