How to debug "cycle detected in references"

I’ve made patches to unbreak haskellPackages.tensorflow:

https://github.com/mikesperber/nixpkgs/commit/7ddcf0472d5999d8d770387ed429fe40b7178902

This works fine on macOS.

Before turning this into a pull request, I’m trying to test on Linux, and am using the nixos/nix docker container. There, however,

nix-build '<nixpkgs>' -A haskellPackages.proto-lens-protoc_0_5_0_0

gives me:

checking for references to /tmp/nix-build-proto-lens-protoc-0.5.0.0.drv-0/ in /nix/store/ns5kcp2hgwhxj429n46v2x7nd3g5v5lr-proto-lens-protoc-0.5.0.0-doc...
cycle detected in the references of '/nix/store/ns5kcp2hgwhxj429n46v2x7nd3g5v5lr-proto-lens-protoc-0.5.0.0-doc' from '/nix/store/wlyp3bc5ss6pxf234mv34wkyfsjjn5y3-proto-lens-protoc-0.5.0.0'
error: build of '/nix/store/ljbx8iy14j8dr97p8ad8gjpzfakkkvq8-proto-lens-protoc-0.5.0.0.drv' failed

I’m clueless on how to debug this. Help would be super-appreciated!

1 Like

For what it is worth, I checked out https://github.com/mikesperber/nixpkgs/commit/7ddcf0472d5999d8d770387ed429fe40b7178902 and ran nix-build -A haskellPackages.proto-lens-protoc_0_5_0_0. It built fine. I didn’t see the error message you posted.

$ pwd
/home/me/programming/nixpkgs
$ git rev-parse HEAD
7ddcf0472d5999d8d770387ed429fe40b7178902
$ nix-build -A haskellPackages.proto-lens-protoc_0_5_0_0
/nix/store/wlyp3bc5ss6pxf234mv34wkyfsjjn5y3-proto-lens-protoc-0.5.0.0

I’m on NixOS.

My guess is that your <nixpkgs> isn’t pointing to the right place?


edit: Also, I should add that I don’t have any idea what could actually be causing the error you posted. I don’t think I have seen that before.

If I had been able to reproduce the error, I was going to try to disable tests for all the proto-lens packages. But I don’t have a good idea of whether that would have helped.

Thanks for looking into this! (Belatedly, sorry!)

This turned out to depend on the version of Nix itself and the order of updating the Nix Docker image. Not enough to file a reasonable bug report, I’m afraid.