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

Error "cycle detected" when building under specific circumstances #167

Closed
Eisfunke opened this issue Jun 7, 2023 · 7 comments · Fixed by #168
Closed

Error "cycle detected" when building under specific circumstances #167

Eisfunke opened this issue Jun 7, 2023 · 7 comments · Fixed by #168
Labels
bug Something isn't working

Comments

@Eisfunke
Copy link

Eisfunke commented Jun 7, 2023

Under certain circumstances I don't quite understand yet, I'm running intocycle detected errors with recent versions of haskell-flake.

I've narrowed it down to the combination of having a Paths_ (see here) defined under other-modules and using pandocunder build-depends in the cabal file, removing either one "fixes" the problem. I have absolutely no clue what happens there that doesn't seem to happen with the other packages I use.

I've created a minimal reproducing example here: https://git.eisfunke.com/software/experiments/-/tree/haskell-flake-mwe

This seems to be broken since the refactor for modular overrides in commit 996f5c2.
nix build works in my example with github:srid/haskell-flake?rev=74210fa80a49f1b6f67223debdbf1494596ff9f2 (the commit before the mentioned one).
But with github:srid/haskell-flake?rev=996f5c2cdc67285c4990df378976f9dbf26f8401 I get:

error: cycle detected in build of '/nix/store/3a103gj9pw8c9ibrhmc62r7df3vrqbwi-example-0.1.0.0.drv' in the references of output 'bin' from output 'out'
@roberth
Copy link
Collaborator

roberth commented Jun 7, 2023

It sets separateBinOutput to true whenever there's an executable since that commit.
Support for this upstream in Nixpkgs Haskell is spotty, which is why it's opt-in. We probably shouldn't set separateBinOutput by default either.

@roberth
Copy link
Collaborator

roberth commented Jun 7, 2023

Note that NixOS/nix#494 is a breaking change as it needs broad support in Nix's installed base before being useful, so even if someone were to prioritize an implementation effort, it would take a significant amount of time for the feature to materialize as a good default solution.

I'd suggest to remove the separateBinOutput default from haskell-flake.

@srid
Copy link
Owner

srid commented Jun 7, 2023

I'd suggest to remove the separateBinOutput default from haskell-flake.

Will do.

Support for this upstream in Nixpkgs Haskell is spotty, which is why it's opt-in.

Is there an upstream issue for this?

@srid srid added the bug Something isn't working label Jun 7, 2023
@srid srid pinned this issue Jun 7, 2023
@roberth
Copy link
Collaborator

roberth commented Jun 7, 2023

upstream issue

Not an issue, but the best context I could find

@Eisfunke
Copy link
Author

Eisfunke commented Jun 7, 2023

Thank you all for the quick reaction, help and fix! <3 That fixes the problem for me! (although I'm still wondering why this only happened for me with the Paths_ module and the pandoc dependency...)

@roberth
Copy link
Collaborator

roberth commented Jun 7, 2023

Normally I'd say nix why-depends, but I don't think that works for invalid paths.
That said, you might be able to grep it yourself. If it's not a remote build, the outputs are actually added to the store directory temporarily iirc; just not registered in the store db, so they'll be cleaned up during the next store gc.

@Eisfunke
Copy link
Author

Eisfunke commented Jun 7, 2023

Yeah, while researching the problem I came across the same tip that the paths should be in the store directory, but for some reason they weren't for me (Nix 2.13.3). When I run nix build in my MWE above, the output store paths mentioned in the output ofnix log (nix path-info doesn't work for invalid paths) simply don't exist. Maybe it was changed or I've got something peculiar in my Nix config..

But anyway, it works now, so it's not really important ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants