NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.93k stars 13.96k forks source link

Haskell's lib/links causes conflicts on Darwin #41069

Open puffnfresh opened 6 years ago

puffnfresh commented 6 years ago

Issue description

I told my coworker they might want to use haskellPackages.pointfree and haskellPackages.ghcid.

installing 'pointfree-1.1.1.3'
installing 'ghcid-0.6.10'
building '/nix/store/6w4ka8hvpa2bizmgkcj90zsa6g5c19kg-user-environment.drv'...
error: packages '/nix/store/vhd71bm9z197sbhkykqjqg157kzgyzzg-pointfree-1.1.1.3/lib/links/libHStext-1.2.3.0-GmbS1eycnDHLhZQQeWF5x-ghc8.2.2.dylib' 
and '/nix/store/bx3r5mkdpd41ych837vn2aba01gichg5-ghcid-0.6.10/lib/links/libHStext-1.2.3.0-GmbS1eycnDHLhZQQeWF5x-ghc8.2.2.dylib' 
have the same priority 5; use 'nix-env --set-flag priority NUMBER INSTALLED_PKGNAME'
to change the priority of one of the conflicting packages (0 being the highest priority)

Steps to reproduce

$ nix-env -f '<nixpkgs>' -iA haskellPackages.pointfree haskellPackages.ghcid

Technical details

Mac OS X 10.13.3

andreabedini commented 6 years ago

I would use haskell.lib.justStaticExecutables here, my 2c

robx commented 5 years ago

I see the same with elm and elm-format:

error: packages '/nix/store/sy70d8694bzb5zmcya8f085ha7mjyfry-elm-0.19.0/lib/links/libHStransformers-compat-0.6.2-DR0vsQLKu2k3Tes0C8KQG1-ghc8.2.2.dylib' and '/nix/store/qspdc70dh6hqhv3svmsq20mbqwfnjc53-elm-format-0.8.1/lib/links/libHStransformers-compat-0.6.2-DR0vsQLKu2k3Tes0C8KQG1-ghc8.2.2.dylib' have the same priority 5; use 'nix-env --set-flag priority NUMBER INSTALLED_PKGNAME' to change the priority of one of the conflicting packages (0 being the highest priority)
domenkozar commented 5 years ago

Elm was fixed, for haskell this awaits multiple outputs split of bin.

steshaw commented 5 years ago

I noticed that on the nixpkgs-unstable channel at 20.03pre192821.b425012fdf4, Brian's installation problem is resolved.

$ nix-env -f '<nixpkgs>' -iA haskellPackages.pointfree haskellPackages.ghcid
installing 'pointfree-1.1.1.5'
installing 'ghcid-0.7.5'
$ 

I found this issue because I had a similar problem:

$ nix-env -f '<nixpkgs>' -iA haskellPackages.hindent haskellPackages.brittany
installing 'hindent-5.3.1'
installing 'brittany-0.12.0.0'
building '/nix/store/kcxahsm7wdw9slrz1lgsk1qxc86a7hrd-user-environment.drv'...
error: packages '/nix/store/r1is2997yll2mdfyjl8kmh4k5wvb7hjy-hindent-5.3.1/lib/links/libHShashable-1.2.7.0-DVIM6jhr9aVIFByzF7F0EB-ghc8.6.5.dylib' and '/nix/store/3d0y0c9wvxby0j7qm3l860czpyxdhs17-brittany-0.12.0.0/lib/links/libHShashable-1.2.7.0-DVIM6jhr9aVIFByzF7F0EB-ghc8.6.5.dylib' have the same priority 5; use 'nix-env --set-flag priority NUMBER INSTALLED_PKGNAME' to change the priority of one of the conflicting packages (0 being the highest priority)
builder for '/nix/store/kcxahsm7wdw9slrz1lgsk1qxc86a7hrd-user-environment.drv' failed with exit code 1
error: build of '/nix/store/kcxahsm7wdw9slrz1lgsk1qxc86a7hrd-user-environment.drv' failed

I followed @andreabedini's suggestion and can get a shell with hindent and brittany:

$ nix-shell --packages 'haskell.lib.justStaticExecutables haskellPackages.hindent''haskell.lib.justStaticExecutables haskellPackages.brittany'

However, if using a shell, the following works as well:

$ nix-shell --packages haskellPackages.hindent haskellPackages.brittany

I found that haskell.lib.justStaticExecutables can be used without error in an overlay:

    brittany = self.haskell.lib.justStaticExecutables self.haskellPackages.brittany;
    hindent = self.haskell.lib.justStaticExecutables self.haskellPackages.hindent;

I was wondering if it's possible to use haskell.lib.justStaticExecutables with nix-env -i to install into the user's profile?

I'd like to understand these problems better. @domenkozar, is there an issue for "multiple output splits of bin"? I found a few closed issues and pull requests. #43795 seems to be related.

domenkozar commented 5 years ago

Try using self.haskell.lib.enableSeparateBinOutput and grep nixpkgs where it's applied for ghcid. Same could be used for the rest of haskell packages.

steshaw commented 5 years ago

Thanks, @domenkozar, that works in my Haskell overlay. I can now simply install with nix-env -iA nixpkgs.brittany nixpkgs.hindent.

Is it preferable to use enableSeparateBinOutput over justStaticExecutables? Both seem to work equally well for my use case.

domenkozar commented 5 years ago

The difference is:

anka-213 commented 5 years ago

I've had the same problem, but with a conflict between stack and cabal-install.

An interesting thing is that both are symlinks that point to the same file. If nix would look at where symlinks point during a conflict, these problems would go away.

xave commented 4 years ago

Is there any resolution to this issue and is it really as simple as pointing symlinks to the same place? I'm having to override libraries for every package because of conflicts between haskell library dylibs.

For instance, I am trying to install regex-base and regex-posix. The dylib they are complaining about is the same file with the same hash: DXu8ShLVgKTKig28mYwARV-ghc8.8.3.dylib

Is this not supposed to be the type of scenario at which nix excels?

anka-213 commented 4 years ago

@xave Both of those are libraries without executables and should be installed with haskellPackages.ghcWithPackages (p: [ p.regex-base p.regex-posix ]), otherwise ghc won't detect them anyways. For executables, the trick is to use haskell.lib.justStaticExecutables haskellPackages.programName as mentioned above.

But yes, I agree that it is a bit annoying.

stale[bot] commented 3 years ago

I marked this as stale due to inactivity. → More info