nmattia / niv

Easy dependency management for Nix projects
https://github.com/nmattia/niv
MIT License
1.52k stars 74 forks source link

Apple M1 issue #355

Closed anandsuresh closed 1 year ago

anandsuresh commented 1 year ago

Seeing this error running nix v2.10.3 on an Apple M1 Mac. Please do let me know what additional information I can provide to help debug this issue.

error: cycle detected in build of '/nix/store/m2g27f6hqz71lh9g0sbp2zn5mcdkrqyq-niv-0.2.19.drv' in the references of output 'bin' from output 'out'
nmattia commented 1 year ago

Seems to be the same as https://github.com/nmattia/niv/issues/343 and https://github.com/nmattia/niv/issues/332 and https://github.com/NixOS/nixpkgs/issues/155722, right?

thedavidmeister commented 1 year ago

yeah i get that too, and heard others with it

setting the system to x86_64-darwin helps with niv but then causes other issues for me because the system is really aarch64-darwin

purcell commented 1 year ago

Odd, I had niv working fine on this arch until a few weeks ago, then presumably as the result of a routine nixpkgs (unstable) bump in my config, I started getting this issue.

nmattia commented 1 year ago

Same here, recent nixpkgs update causes this again

nmattia commented 1 year ago

This is an upstream issue in nixpkgs:

And here's a workaround:

  niv =
    let
      # Workaround for https://github.com/NixOS/nixpkgs/issues/140774
      fixCyclicReference = drv:
        pkgs.haskell.lib.overrideCabal drv (_: {
          enableSeparateBinOutput = false;
        });
    in
    fixCyclicReference pkgs.haskellPackages.niv;

I'll close this ticket but please go and make some noise on the ticket upstream!

ostrolucky commented 1 year ago

I'm nix beginner and I have no idea where to put that snippet of code

anandsuresh commented 1 year ago

I assume the intent is to use this code as an overlay when instantiating nixpkgs?

nmattia commented 1 year ago

Not necessarily, you can use it anywhere you'd normally use pkgs.niv: https://github.com/nmattia/homies/blob/4d2f7828c926bf1a3d9030d967f430a17d3b8048/packages.nix#L44-L52

ostrolucky commented 1 year ago

I assume the intent is to use this code as an overlay when instantiating nixpkgs?

No, intent is to install niv CLI, so I can run eg. niv add command