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

Build cycle detected when using niv on darwin-aarch64(M1) with unstable #217549

Closed
SumOys opened this issue Feb 21, 2023 · 4 comments
Closed

Build cycle detected when using niv on darwin-aarch64(M1) with unstable #217549

SumOys opened this issue Feb 21, 2023 · 4 comments
Labels
0.kind: bug Something is broken

Comments

@SumOys
Copy link

SumOys commented Feb 21, 2023

We're currently using nix with niv for local development. When using nix-shell with a dependency on niv, our Mac/M1 developers are getting the following error:

error: cycle detected in build of '/nix/store/7rkj3afc2yy6k3yv5dlalqzcpf12lar5-niv-0.2.21.drv' in the references of output 'bin' from output 'out'

This only occurs on MacOS and not on Linux/x86_64.

One of our M1 devs did an update to the latest unstable today. This is the package tar we're currently using:

{
    "nixpkgs": {
        "branch": "nixpkgs-unstable",
        "description": "Nix Packages collection",
        "homepage": "",
        "owner": "NixOS",
        "repo": "nixpkgs",
        "rev": "5ab8b5ae26e6a4b781bdebdfd131c054f0b96e70",
        "sha256": "082hx5m40c5zk8lzd35a23vf1vsw9qf7akirlcb2n86i67wa92hl",
        "type": "tarball",
        "url": "https://github.com/NixOS/nixpkgs/archive/5ab8b5ae26e6a4b781bdebdfd131c054f0b96e70.tar.gz",
        "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
    }
}

Our shell.nix looks like the following:

let sources = import ./nix/sources.nix { }; in
{ nixpkgs ? sources.nixpkgs or <nixpkgs>, pkgs ? import nixpkgs {} }:

let
  shellDeps = with pkgs; [
    ruby_3_1
    rubyPackages_3_1.typhoeus
    chromedriver
    cmake
    delta
    jc
    jq
    just
    git-gone
    glibcLocales
    gnumake
    libiconv
    libssh2
    libxml2
    libxslt
    locale
    lsof
    makeWrapper
    minio
    minio-client
    niv
    nodejs-16_x
    nodePackages.typescript-language-server
    openssl
    parallel
    pkg-config
    postgresql_14
    procps
    python310Packages.supervisor
    redis
    ripgrep
    sd
    sqlite
    tmux
    ugrep
    unzip
    vips
    which
    (yarn.override { nodejs = nodejs-16_x; })
    zlib
  ];
in
pkgs.mkShell {
  buildInputs = shellDeps;

  shellHook = ''
    mkdir -p "$PWD/vendor/nix/gems" "$PWD/node_modules"
    export GEM_HOME="$PWD/vendor/nix/gems"
    export GEM_PATH="$GEM_HOME"
    bundle config --local build.sassc --disable-lto
    bundle config build.nokogiri --use-system-libraries
    bundle config --local path "$PWD/vendor/nix/gems"
    export NODE_PATH="$PWD/node_modules"
    export NPM_CONFIG_PREFIX="$PWD/node_modules"
    export PATH=$PATH:"$GEM_HOME/bin":"$NODE_PATH/.bin":"$PWD/bin"
    export CHROMEDRIVER_VERSION="110.0.5481.77"
    export SPRING_TMP_PATH="$PWD/vendor/nix/spring"
    export SPRING_LOG="$PWD/log/spring.log"
  '';
}

The abbreviated build log looks like this:

these 4 derivations will be built:
  /nix/store/73zqzws8dsjh366zcj0wjmzvv2x9z8i3-pinpointDependencies.js.drv
  /nix/store/7rkj3afc2yy6k3yv5dlalqzcpf12lar5-niv-0.2.21.drv
  /nix/store/fnsi71p0m0rm40mvalzsnp1pk35jdhm4-reconstructpackagelock.js.drv
  /nix/store/iykqyrq2fngz9zw0nkihq76ajlwgfr71-typescript-language-server-3.1.0.drv
these 312 paths will be fetched (266.15 MiB download, 2796.21 MiB unpacked):
  /nix/store/0711r28csqirlaw5vdc6zw90xy73sx2y-extensible-exceptions-0.1.1.4
  /nix/store/0a2yh7d9swlm4p7w1mjjbyhhjw5bz8z5-transformers-compat-0.7.2-doc
  /nix/store/0d2c0j1fc95api6zflhs1b7mrilg91vs-zlib-0.6.3.0-doc
  /nix/store/0dhngsjn1rnhizc8c4rba2fc96zmcfzr-logging-facade-0.3.1-doc
  /nix/store/0hm6xc2d7qdpbbgfxxpafa9vwqqq65ac-time-compat-1.9.6.1
  /nix/store/0hn6201p2m1vxzqk10s4id01732f36r0-semigroupoids-5.3.7
...
...
...
Using ghc version 9.2.6 found on system at:
/nix/store/v1zc918176y0gb05q110h9fq8wma1pdq-ghc-9.2.6/bin/ghc
Using ghc-pkg version 9.2.6 found on system at:
/nix/store/v1zc918176y0gb05q110h9fq8wma1pdq-ghc-9.2.6/bin/ghc-pkg-9.2.6
No ghcjs found
No ghcjs-pkg found
No greencard found
Using haddock version 2.26.0 found on system at:
/nix/store/v1zc918176y0gb05q110h9fq8wma1pdq-ghc-9.2.6/bin/haddock-ghc-9.2.6
No happy found
Using haskell-suite found on system at: haskell-suite-dummy-location
Using haskell-suite-pkg found on system at: haskell-suite-pkg-dummy-location
No hmake found
Using hpc version 0.68 found on system at:
/nix/store/v1zc918176y0gb05q110h9fq8wma1pdq-ghc-9.2.6/bin/hpc
Using hsc2hs version 0.68.8 found on system at:
/nix/store/v1zc918176y0gb05q110h9fq8wma1pdq-ghc-9.2.6/bin/hsc2hs
No hscolour found
No jhc found
Using ld found on system at:
/nix/store/gvakch9ff8vlg3k03ivfz7b9s221l7xa-cctools-binutils-darwin-wrapper-973.0.1/bin/ld
No pkg-config found
Using runghc version 9.2.6 found on system at:
/nix/store/v1zc918176y0gb05q110h9fq8wma1pdq-ghc-9.2.6/bin/runghc-9.2.6
Using strip found on system at:
/nix/store/agjhf1m0xsvmdjkk8kc7bp3pic9lsfrb-clang-wrapper-11.1.0/bin/strip
Using tar found on system at:
/nix/store/f95f6h1l39xfrcgxj4pv9ng5rzpv17c7-gnutar-1.34/bin/tar
No uhc found
building
Preprocessing library for niv-0.2.21..
Building library for niv-0.2.21..
[ 1 of 19] Compiling Data.Aeson.Extended ( src/Data/Aeson/Extended.hs, dist/build/Data/Aeson/Extended.o, dist/build/Data/Aeson/Extended.dyn_o )
[ 2 of 19] Compiling Data.HashMap.Strict.Extended ( src/Data/HashMap/Strict/Extended.hs, dist/build/Data/HashMap/Strict/Extended.o, dist/build/Data/HashMap/Strict/Extended.dyn_o )
[ 3 of 19] Compiling Niv.Logger       ( src/Niv/Logger.hs, dist/build/Niv/Logger.o, dist/build/Niv/Logger.dyn_o )
[ 4 of 19] Compiling Data.Text.Extended ( src/Data/Text/Extended.hs, dist/build/Data/Text/Extended.o, dist/build/Data/Text/Extended.dyn_o )
[ 5 of 19] Compiling Niv.GitHub.API   ( src/Niv/GitHub/API.hs, dist/build/Niv/GitHub/API.o, dist/build/Niv/GitHub/API.dyn_o )
[ 6 of 19] Compiling Niv.Update       ( src/Niv/Update.hs, dist/build/Niv/Update.o, dist/build/Niv/Update.dyn_o )
[ 7 of 19] Compiling Niv.Sources      ( src/Niv/Sources.hs, dist/build/Niv/Sources.o, dist/build/Niv/Sources.dyn_o )
[ 8 of 19] Compiling Niv.Sources.Test ( src/Niv/Sources/Test.hs, dist/build/Niv/Sources/Test.o, dist/build/Niv/Sources/Test.dyn_o )
[ 9 of 19] Compiling Niv.GitHub       ( src/Niv/GitHub.hs, dist/build/Niv/GitHub.o, dist/build/Niv/GitHub.dyn_o )
[10 of 19] Compiling Niv.GitHub.Test  ( src/Niv/GitHub/Test.hs, dist/build/Niv/GitHub/Test.o, dist/build/Niv/GitHub/Test.dyn_o )
[11 of 19] Compiling Niv.Cmd          ( src/Niv/Cmd.hs, dist/build/Niv/Cmd.o, dist/build/Niv/Cmd.dyn_o )
[12 of 19] Compiling Niv.Local.Cmd    ( src/Niv/Local/Cmd.hs, dist/build/Niv/Local/Cmd.o, dist/build/Niv/Local/Cmd.dyn_o )
[13 of 19] Compiling Niv.GitHub.Cmd   ( src/Niv/GitHub/Cmd.hs, dist/build/Niv/GitHub/Cmd.o, dist/build/Niv/GitHub/Cmd.dyn_o )
[14 of 19] Compiling Niv.Git.Cmd      ( src/Niv/Git/Cmd.hs, dist/build/Niv/Git/Cmd.o, dist/build/Niv/Git/Cmd.dyn_o )
[15 of 19] Compiling Niv.Git.Test     ( src/Niv/Git/Test.hs, dist/build/Niv/Git/Test.o, dist/build/Niv/Git/Test.dyn_o )
[16 of 19] Compiling Niv.Update.Test  ( src/Niv/Update/Test.hs, dist/build/Niv/Update/Test.o, dist/build/Niv/Update/Test.dyn_o )
[17 of 19] Compiling Niv.Test         ( src/Niv/Test.hs, dist/build/Niv/Test.o, dist/build/Niv/Test.dyn_o )
[18 of 19] Compiling Paths_niv        ( dist/build/autogen/Paths_niv.hs, dist/build/Paths_niv.o, dist/build/Paths_niv.dyn_o )
[19 of 19] Compiling Niv.Cli          ( src/Niv/Cli.hs, dist/build/Niv/Cli.o, dist/build/Niv/Cli.dyn_o )
Preprocessing executable 'niv' for niv-0.2.21..
Building executable 'niv' for niv-0.2.21..
[1 of 3] Compiling Niv              ( app/Niv.hs, dist/build/niv/niv-tmp/Niv.o )
[2 of 3] Compiling NivTest          ( app/NivTest.hs, dist/build/niv/niv-tmp/NivTest.o )
[3 of 3] Compiling Paths_niv        ( dist/build/niv/autogen/Paths_niv.hs, dist/build/niv/niv-tmp/Paths_niv.o )
Linking dist/build/niv/niv ...
Preprocessing test suite 'unit' for niv-0.2.21..
Building test suite 'unit' for niv-0.2.21..
[1 of 3] Compiling Niv              ( app/Niv.hs, dist/build/unit/unit-tmp/Niv.o )
[2 of 3] Compiling NivTest          ( app/NivTest.hs, dist/build/unit/unit-tmp/NivTest.o )
[3 of 3] Compiling Paths_niv        ( dist/build/unit/autogen/Paths_niv.hs, dist/build/unit/unit-tmp/Paths_niv.o )
Linking dist/build/unit/unit ...
running tests
Running 1 test suites...
Test suite unit: RUNNING...
niv
  update
    simply runs:                          OK
    picks first:                          OK
    loads:                                OK
    survives checks:                      OK
    isn't too eager:                      OK
    dirty forces update:                  OK
    should run when no changes:           OK
    templates expand:                     OK
  github
    inits properly:                       OK
    updates:                              OK
    updates once:                         OK
    doesn't override rev:                 OK
    falls back to URL:                    OK
  sources.nix
    has latest version:                   OK
  git
    repository parse
      goo:                                OK
      [email protected]:nmattia/niv:         OK
      ssh://[email protected]/stedolan/jq:   OK
      https://github.com/stedolan/jq.git: OK
      https://github.com/stedolan/jq:     OK
      ~/path/to/repo.git:                 OK
    updates
      rev is updated:                     OK
      git is called once:                 OK

All 22 tests passed (0.00s)
Test suite unit: PASS
Test suite logged to: dist/test/niv-0.2.21-unit.log
1 of 1 test suites (1 of 1 test cases) passed.
haddockPhase
installing
Installing library in /nix/store/h0k4sd7k71grcbzpjysnx6c7xi6ycaa5-niv-0.2.21/lib/ghc-9.2.6/aarch64-osx-ghc-9.2.6/niv-0.2.21-DXwqGvpnUTe5xoBYbNF1aL
Installing executable niv in /nix/store/ylqw47fkhq31dxs6lkh56jyx6m903dk8-niv-0.2.21-bin/bin
Warning: The directory
/nix/store/ylqw47fkhq31dxs6lkh56jyx6m903dk8-niv-0.2.21-bin/bin is not in the
system search path.
/nix/store/7wm5arz8k1yqv5ciziwygk3nigpr75px-cctools-binutils-darwin-973.0.1/bin/strip: warning: changes being made to the file will invalidate the code signature in: /nix/store/ylqw47fkhq31dxs6lkh56jyx6m903dk8-niv-0.2.21-bin/bin/niv
Registering library for niv-0.2.21..
post-installation fixup
checking for references to /private/tmp/nix-build-niv-0.2.21.drv-0/ in /nix/store/h0k4sd7k71grcbzpjysnx6c7xi6ycaa5-niv-0.2.21...
patching script interpreter paths in /nix/store/h0k4sd7k71grcbzpjysnx6c7xi6ycaa5-niv-0.2.21
stripping (with command strip and flags -S) in  /nix/store/h0k4sd7k71grcbzpjysnx6c7xi6ycaa5-niv-0.2.21/lib
checking for references to /private/tmp/nix-build-niv-0.2.21.drv-0/ in /nix/store/nshlkrmy6w7j4gzzmlssir1cdzck4ich-niv-0.2.21-data...
patching script interpreter paths in /nix/store/nshlkrmy6w7j4gzzmlssir1cdzck4ich-niv-0.2.21-data
checking for references to /private/tmp/nix-build-niv-0.2.21.drv-0/ in /nix/store/ylqw47fkhq31dxs6lkh56jyx6m903dk8-niv-0.2.21-bin...
patching script interpreter paths in /nix/store/ylqw47fkhq31dxs6lkh56jyx6m903dk8-niv-0.2.21-bin
stripping (with command strip and flags -S) in  /nix/store/ylqw47fkhq31dxs6lkh56jyx6m903dk8-niv-0.2.21-bin/bin
error: cycle detected in build of '/nix/store/7rkj3afc2yy6k3yv5dlalqzcpf12lar5-niv-0.2.21.drv' in the references of output 'bin' from output 'out'

The last known working Nix package was on this package tar:

{
    "nixpkgs": {
        "branch": "nixpkgs-unstable",
        "description": "Nix Packages collection",
        "homepage": "",
        "owner": "NixOS",
        "repo": "nixpkgs",
        "rev": "a5f661b80e4c163510a5013b585a040a5c7ef55e",
        "sha256": "0v0f5h31iqmcx61nylhn111j7r56m8lx04xllh0p4d13k2gl0hc5",
        "type": "tarball",
        "url": "https://github.com/NixOS/nixpkgs/archive/a5f661b80e4c163510a5013b585a040a5c7ef55e.tar.gz",
        "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
    }
}
@SumOys SumOys added the 0.kind: bug Something is broken label Feb 21, 2023
@SumOys
Copy link
Author

SumOys commented Feb 21, 2023

Complete Build log:

build.log

@siraben
Copy link
Member

siraben commented Feb 23, 2023

I can also replicate this issue.

@Patryk27
Copy link
Member

Patryk27 commented Feb 24, 2023

I can also confirm the issue; for a workaround, the x86_64-darwin package seems to work (assuming one has Rosetta active):

$ nix shell nixpkgs#legacyPackages.x86_64-darwin.niv

@Patryk27
Copy link
Member

Patryk27 commented Feb 25, 2023

Okie, seems to be a duplicate of:
#140774

There's already a fix pending:
#216857 (which I've just confirmed to revive Niv as well)

The problem can be also worked around:
#140774 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug Something is broken
Projects
None yet
Development

No branches or pull requests

3 participants