Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Source roots result in /nix/store/<hash>-<hash>-source #10627

Open
edolstra opened this issue Apr 30, 2024 · 2 comments
Open

Source roots result in /nix/store/<hash>-<hash>-source #10627

edolstra opened this issue Apr 30, 2024 · 2 comments
Labels
breaking Changes we can't make without breaking old expressions, changing hashes, etc bug flakes language The Nix expression language; parser, interpreter, primops, evaluation, etc

Comments

@edolstra
Copy link
Member

edolstra commented Apr 30, 2024

Describe the bug

In a flake with a derivation attribute like

src = ./.;

the tree gets copied into the store as /nix/store/<hash1>-<hash2>-source. This is because (pre lazy-trees) the basename of the tree is /nix/store/<hash2>-source.

This double-copying is obviously undesirable, but we can't fix it without a breaking change (i.e. without changing derivation paths).

On lazy-trees, we can at least avoid writing /nix/store/<hash2>-source to disk, but we do need to hash the input to compute <hash2>. (See c5ae41d.)

Steps To Reproduce

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior

A clear and concise description of what you expected to happen.

nix-env --version output

Additional context

Add any other context about the problem here.

Priorities

Add 👍 to issues you find important.

@KiaraGrouwstra
Copy link

KiaraGrouwstra commented May 14, 2024

we could already improve on the user experience here by warning the user to avoid such paths.

@roberth roberth added language The Nix expression language; parser, interpreter, primops, evaluation, etc breaking Changes we can't make without breaking old expressions, changing hashes, etc labels Jul 5, 2024
@roberth
Copy link
Member

roberth commented Jul 5, 2024

This is a pre-flakes behavior that would be a breaking change.

we could already improve on the user experience here by warning the user to avoid such paths.

I believe this would trigger quite often, and without being all that actionable for most users.

We'd better address the root cause, which is putting flakes in the store in the first place, making this problem prevalent instead of niche.

We could do so with either

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking Changes we can't make without breaking old expressions, changing hashes, etc bug flakes language The Nix expression language; parser, interpreter, primops, evaluation, etc
Projects
None yet
Development

No branches or pull requests

3 participants