diff options
author | Silvan Mosberger <contact@infinisil.com> | 2023-11-24 00:15:43 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-24 00:15:43 +0100 |
commit | 7486aee82e46634dbe997ab4510cc54691a19bf5 (patch) | |
tree | 98576a1c80fcc3ac1d8da6e77714847cfaa875f9 /lib/fileset/internal.nix | |
parent | e03c9c3f1be4994c63b27ce60d41f13ebfeb3cad (diff) | |
parent | 6816f28c960c523e6a30f2ad4a1cc812251f5ffb (diff) |
Merge pull request #266362 from tweag/fileset.fileFilter-ext
`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 2fddf0d022858..35d556e78391c 100644 --- a/lib/fileset/internal.nix +++ b/lib/fileset/internal.nix @@ -52,6 +52,7 @@ let concatStringsSep substring stringLength + hasSuffix ; in @@ -797,9 +798,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 |