Is it possible to create a fileset from a derivation output path?

I’m trying to create a fileset from a derivation, something like:

pkgs.lib.fileset.fileFilter (file: true) pkgs.linux-firmware

This doesn’t work as-is because the derivation evaluates to a “string” type, not a proper “path” type.

However, attempting to convert the string to a path with /. + pkgs.linux-firmware doesn’t work, instead it complains that error: a string that refers to a store path cannot be appended to a path.

Is there no way to do this without copying the files from the output path of the derivation to a temporary directory first?

This isn’t supported, see nixpkgs/lib/fileset at master · NixOS/nixpkgs · GitHub for why and Function for transforming store path contents · Issue #264541 · NixOS/nixpkgs · GitHub for a discussion on alternatives

1 Like