Repro of erronous behaviour in Source tree abstraction
As I described in a writeup about usage of the current Source Tree Abstraction branch in NixOS via an overlay in its PR thread, there is currently an issue with file filtration indirections which managed to break my home-manager configuration indirectly.
This project started as an attempt to min-repro it, but expanded into an attempt to also discover the various other cases which may have sourced the breakage.
It is my hope that this may be used as a basis for some test cases for the Source Tree Abstractions feature, and that it may assist its author in bringing this extremely desirable feature into upstream Nix as soon as possible, to make flakes worth using within the context of larger codebases.
The following runs with the apparently-key filtration step enabled, which produces a failure.
# Pure mode fails with directory forbidden for the "subdir.d" directory's produced derivation
nix build github:Dessix/repro-nix-lst-filterbreak
# Impure mode fails with directory not found for the "subdir.d" directory's produced derivation
nix build github:Dessix/repro-nix-lst-filterbreak --impure
The following runs without the filtration step, preventing failure from the discovered bug.
While this is the only current source of repros, it may still be worth considering the other scenarios for more-permanent regression tests.
# Both of the following seem to work just fine, pure or impure
nix build github:Dessix/repro-nix-lst-filterbreak#noRepro --print-out-paths
nix build github:Dessix/repro-nix-lst-filterbreak#noRepro --print-out-paths --impure
To run a full suite of repro scenarios on current upstream Nix and compare them with the Source Tree Abstraction branch, execute the following in your shell:
Warning The following script will build (up to) two versions of Nix for comparison, and will then generate a bash script that is expected to be run outside of a sandboxed context, as it will then call
nix
to produce test cases, and then invokesnix-build
to run each individual test case.
nix build github:Dessix/repro-nix-lst-filterbreak#report.fullReportGenerator --print-out-paths
# Or, for impure-mode generation of the script (generated cases are always a mix of pure and impure tests!):
nix build github:Dessix/repro-nix-lst-filterbreak#report.fullReportGenerator --print-out-paths --impure
And then run the generated bash script at the produced output path.
Warning You should generally not run scripts generated by builds without reading them. Read it.
The script will generate a report of the various combinations of file sourcing behaviours on standard and Lazy-Source-Trees Nix.
The result (as of writing) shows significant failures around indirection of paths using builtins.path
for filtration, even when no filtration is actually performed.
For any failure cases shown in the report, the command above the failure can be copy-pasted to rerun that specific test with detailed nix logs.