Trying to use a flake with
direnv to enable a development environment, I get the error
store path '/nix/store/<hash>-<my-flake-name>' is not allowed to have references
However, an explicit
nix develop succeeds, and thereafter,
direnv also succeeds.
direnv fails with this error every time I check out a different commit, or modify (or even
touch) the flake, I have got into the habit of using the hacky workaround
nix develop -c true && cd - && cd -
nix developgets around the error and puts me in a state which
- the two
cd -s nudge
direnvinto action to that it loads the new environment.
This works and gets me around the error, but
- it’s very annoying
- collaborators will be stupmed when trying to use this environment and are faced with this error
I observe this behaviour on Linux, but (if memory serves me correctly, I don’t have direct access to a Mac) not on Darwin.
Can you suggest what might be causing this, and how to get rid of the problem?
A sample repository that exhibits this behaviour can be found here. To trigger the error:
- Ensure you have
cdinto the repository root.
- Approve with
The error should appear.
After getting around the error with
nix develop -c true && cd - && cd - it can be triggered again by any of these actions:
- modifying the flake
- checking out any other commit