lib/removePackages: Match names by regex
This commit is contained in:
parent
81fab8da3b
commit
fa507f5f71
1 changed files with 6 additions and 4 deletions
|
@ -1,8 +1,10 @@
|
|||
{ nixpkgs, ... }:
|
||||
|
||||
let
|
||||
inherit (builtins) elem filter;
|
||||
inherit (builtins) match filter foldl';
|
||||
inherit (nixpkgs.lib.strings) getName;
|
||||
in pkgOrNameList: pkgList:
|
||||
let nameList = map (pkg: getName pkg) pkgOrNameList;
|
||||
in filter (pkg: !elem (getName pkg) nameList) pkgList
|
||||
|
||||
fold = name: acc: regex:
|
||||
if acc == false then false
|
||||
else match regex name == null;
|
||||
in regexList: filter (pkg: foldl' (getName pkg |> fold) true regexList)
|
||||
|
|
Loading…
Reference in a new issue