Skip to content

filterSource: error: store path <PATH> is not allowed to have references #5410

@balsoft

Description

@balsoft

Describe the bug

Before 4806f2f, it was possible to have references in paths being filtered. I think this was actually incorrect, since the resulting path lost all references (at least that's what #5347 (comment) implies). The comment also says that

This also makes builtins.{path,filterSource} work on derivation outputs if IFD is enabled.

However, actually filterSource did work on derivation outputs before then, for some reason. This was used in crate2nix, among other projects. Now it doesn't work with crate2nix, since the output of the derivation we're filtering (and then importing from) contains references.

Steps To Reproduce

$ nix build --no-eval-cache github:soywod/himalaya/767eee95f52f86000b76f2f10dde951046214bff
error: store path '/nix/store/wn9mdf67b6ah1555d2cm0gl53gix8cm2-himalaya-crate2nix' is not allowed to have references
(use '--show-trace' to show detailed location information)

Expected behavior

The derivation is built, as on Nix before that commit.

I suppose the solution is to allow the filtered paths to have references, but then scan the new, filtered path for references afterwards. Just passing through references may result in dangling references if the filter cleans some of them out.

Nix version

nix (Nix) 2.5pre20211008_4c17ebe

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions