haskell.nix icon indicating copy to clipboard operation
haskell.nix copied to clipboard

Adding package in `nonReinstallablePkgs` through extra hackage does not work

Open L-as opened this issue 2 years ago • 2 comments

It has to be removed from nonReinstallablePkgs. This makes somewhat sense, but a warning/error or similar would be great even if it can't be "fixed". In my case, it was bytestring, and removing just that from nonReinstallablePkgs the following:

cabal-doctest-lib-cabal-doctest> unpacking sources
cabal-doctest-lib-cabal-doctest> unpacking source archive /nix/store/ypm2gcmr53q3a2dgszp8v84axnmg8qqi-cabal-doctest-1.0.9.tar.gz
cabal-doctest-lib-cabal-doctest> source root is cabal-doctest-1.0.9
cabal-doctest-lib-cabal-doctest> setting SOURCE_DATE_EPOCH to timestamp 1000000000 of file cabal-doctest-1.0.9/src/Distribution/Extra/Doctest.hs
cabal-doctest-lib-cabal-doctest> patching sources
cabal-doctest-lib-cabal-doctest> configuring
cabal-doctest-lib-cabal-doctest> Configure flags:
cabal-doctest-lib-cabal-doctest> --prefix=/nix/store/m8ai6kmx19vnrd5ghbp2ihwg9rbnxc2d-cabal-doctest-lib-cabal-doctest-1.0.9 lib:cabal-doctest --package-db=clear --package-db=/nix/store/b24yl9q41sigv483bz587k53r5g41f5k-cabal-doctest-lib-cabal-doctest-1.0.9-config/lib/ghc-9.2.4/package.conf.d --exact-configuration --dependency=Cabal=Cabal-3.6.3.0 --dependency=array=array-0.5.4.0 --dependency=base=base-4.16.3.0 --dependency=binary=binary-0.8.9.0 --dependency=containers=containers-0.6.5.1 --dependency=deepseq=deepseq-1.4.6.1 --dependency=directory=directory-1.3.6.2 --dependency=exceptions=exceptions-0.10.4 --dependency=filepath=filepath-1.4.2.2 --dependency=ghc=ghc-9.2.4 --dependency=ghc-bignum=ghc-bignum-1.2 --dependency=ghc-boot=ghc-boot-9.2.4 --dependency=ghc-boot-th=ghc-boot-th-9.2.4 --dependency=ghc-compact=ghc-compact-0.1.0.0 --dependency=ghc-heap=ghc-heap-9.2.4 --dependency=ghc-prim=ghc-prim-0.8.0 --dependency=hpc=hpc-0.6.1.0 --dependency=integer-gmp=integer-gmp-1.1 --dependency=mtl=mtl-2.2.2 --dependency=parsec=parsec-3.1.15.0 --dependency=pretty=pretty-1.1.3.6 --dependency=process=process-1.6.13.2 --dependency=rts=rts --dependency=stm=stm-2.5.0.2 --dependency=template-haskell=template-haskell-2.18.0.0 --dependency=terminfo=terminfo-0.4.1.5 --dependency=text=text-1.2.5.0 --dependency=time=time-1.11.1.1 --dependency=transformers=transformers-0.5.6.2 --dependency=unix=unix-2.7.2.2 --dependency=xhtml=xhtml-3000.2.2.1 --with-ghc=ghc --with-ghc-pkg=ghc-pkg --with-hsc2hs=hsc2hs --with-gcc=cc --with-ld=ld.gold --ghc-option=-optl-fuse-ld=gold --ld-option=-fuse-ld=gold --with-ar=ar --with-strip=strip --disable-executable-stripping --disable-library-stripping --disable-library-profiling --disable-profiling --enable-static --enable-shared --disable-coverage --enable-library-for-ghci --datadir=/nix/store/6mk06i5g6vfnv7x3cyjbfivq325a2fjm-cabal-doctest-lib-cabal-doctest-1.0.9-data/share/ghc-9.2.4 --enable-split-sections
cabal-doctest-lib-cabal-doctest> Configuring library for cabal-doctest-1.0.9..
cabal-doctest-lib-cabal-doctest> Error:
cabal-doctest-lib-cabal-doctest>     The following packages are broken because other packages they depend on are missing. These broken packages must be rebuilt before they can be used.
cabal-doctest-lib-cabal-doctest> installed package Cabal-3.6.3.0 is broken due to missing package bytestring-0.11.3.1
cabal-doctest-lib-cabal-doctest> installed package binary-0.8.9.0 is broken due to missing package bytestring-0.11.3.1
cabal-doctest-lib-cabal-doctest> installed package parsec-3.1.15.0 is broken due to missing package bytestring-0.11.3.1
cabal-doctest-lib-cabal-doctest> installed package text-1.2.5.0 is broken due to missing package bytestring-0.11.3.1
cabal-doctest-lib-cabal-doctest> installed package unix-2.7.2.2 is broken due to missing package bytestring-0.11.3.1
error: builder for '/nix/store/6k5jyfrdyy4mvy6rif6lmydzlib1x94h-cabal-doctest-lib-cabal-doctest-1.0.9.drv' failed with exit code 1;

Any hints on how to fix this?

L-as avatar Sep 12 '22 14:09 L-as

Adding it through source-repository-package also seems not to work.

L-as avatar Sep 12 '22 14:09 L-as

This is annoying and there are two potential fixes:

  • Automate nonReinstallablePkgs. If the planned version of a package or one of its dependencies does not match the version in the GHC derivation we should treat it as if it was not in nonReinstallablePkgs at all. The "or one of its dependencies" part of this will be tricky (we could just hard code a mapping for the small number of packages in the GHC derivation).

  • Eliminate more things from nonReinstallablePkgs. If it can be in "extra hackage" does it really need to be in the default nonReinstallablePkgs?

I like the second option best (if it is possible). One barrier is that the source is not always in hackage (or worse still the source shipped with GHC may differ from hackage). Perhaps we could add those here: https://github.com/input-output-hk/haskell.nix/blob/6c7f9d0042c05595ccdc2a9cd54ae66fd4cf6f30/builder/hspkg-builder.nix#L26-L31

hamishmack avatar Sep 13 '22 00:09 hamishmack