Filtered derivation as source

Hi, I’m trying to use a nix store path from a derivation as source for another derivation.

If I do

src = foo-drv

works well, but If I try to filter:

src = (pkgs.lib.sourceByRegex foo-drv [ "^barbaz.*$" ]);

I get this error:

error: the string '8q0w1n73p6djbqnxd6r91bab4ds08hkr-foo-drv' is not allowed to refer to a store path (such as '!out! /nix/store/dd85asnp5c1h8ll8ma747czxik9bclsf-foo-drv.drv')

Any hint? Thanks!

Don’t know, but if going mad you may try builtins.unsafeDiscardStringContext :grin:

It works TYVM!

But finally i take another path, derivation output only one file and exporting it with builtins.readFile.