@don.dfh We’re limited by what the underlying builtins.path/builtins.filterSource
primitive can do, which doesn’t support renaming files.
However I’d also argue it shouldn’t be in scope, because the job of lib.fileset
(or the builtins
) is to exactly pick the files that you want to be able to influence derivations. Past that, you can use derivations to further transform them in any way necessary, including renaming, changing and adding files. All of these operations don’t change the selected files.
We do lack a nice general function to do that, but it would be fairly easy to add: Check out Function for transforming store path contents · Issue #264541 · NixOS/nixpkgs · GitHub, where I’m proposing a pkgs.transformStorePath
.