diff options
author | Silvan Mosberger <silvan.mosberger@tweag.io> | 2023-11-09 01:29:38 +0100 |
---|---|---|
committer | Silvan Mosberger <silvan.mosberger@tweag.io> | 2023-11-23 21:05:23 +0100 |
commit | 6816f28c960c523e6a30f2ad4a1cc812251f5ffb (patch) | |
tree | e0e55722da9d20df977371e6b8f4db0800ed453a /lib/fileset/internal.nix | |
parent | 3d480d4ae70b95abc065f8d64db2df51c079f356 (diff) |
lib.fileset.fileFilter: Predicate attribute for file extension
Diffstat (limited to 'lib/fileset/internal.nix')
-rw-r--r-- | lib/fileset/internal.nix | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/fileset/internal.nix b/lib/fileset/internal.nix index 23d7b847204c9..e2f4ba3ca3feb 100644 --- a/lib/fileset/internal.nix +++ b/lib/fileset/internal.nix @@ -52,6 +52,7 @@ let concatStringsSep substring stringLength + hasSuffix ; in @@ -796,9 +797,11 @@ rec { if predicate { inherit name type; + hasExt = ext: hasSuffix ".${ext}" name; + # To ensure forwards compatibility with more arguments being added in the future, # adding an attribute which can't be deconstructed :) - "lib.fileset.fileFilter: The predicate function passed as the first argument must be able to handle extra attributes for future compatibility. If you're using `{ name, file }:`, use `{ name, file, ... }:` instead." = null; + "lib.fileset.fileFilter: The predicate function passed as the first argument must be able to handle extra attributes for future compatibility. If you're using `{ name, file, hasExt }:`, use `{ name, file, hasExt, ... }:` instead." = null; } then type |