Skip to content

Commit

Permalink
Add filterListByPackageName to helper function
Browse files Browse the repository at this point in the history
* Add filterListByPackageName to helper functions
  * This function makes it easier to check if a list of packages
    contains a package with a name that contains a specific string
  • Loading branch information
evanjs committed Dec 6, 2020
1 parent 6845506 commit 546b7e6
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion overlays/libs/helpers.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{ lib, ... }:
with lib;
{
rec {

# TODO: Improve error-handling/provide error messages that specify the expected inputs for each function, etc

Expand All @@ -12,4 +12,10 @@ with lib;

# are we running on a NixOS system?
isNixOS = builtins.readDir /etc ? NIXOS;

# find the packages in the given <list> that contain <query>
filterListByPackageName = list: query: lib.lists.filter (x: lib.strings.hasInfix query (lib.strings.getName x)) list;

# find the packages in systemPackages that contain <query>
#filterSystemPackagesByPackageName = query: filterListByPackageName query environment.systemPackages;
}

0 comments on commit 546b7e6

Please sign in to comment.