I've run into a similar situation as: Workarounds for Haskell / cabal packages with constraints with Nix and Cabal?
Essentially I have a Haskell library that has dependency of
time >= 1.9.2
(time library within the cabal package repository).
It seems that this version does not currently exist in nixpkgs
, doing a nix build
results in a error of:
...
CallStack (from HasCallStack):
die', called at libraries/Cabal/Cabal/Distribution/Simple/Configure.hs:950:20 in Cabal-2.4.0.1:Distribution.Simple.Configure
configureFinalizedPackage, called at libraries/Cabal/Cabal/Distribution/Simple/Configure.hs:460:12 in Cabal-2.4.0.1:Distribution.Simple.Configure
configure, called at libraries/Cabal/Cabal/Distribution/Simple.hs:596:20 in Cabal-2.4.0.1:Distribution.Simple
confHook, called at libraries/Cabal/Cabal/Distribution/Simple/UserHooks.hs:67:5 in Cabal-2.4.0.1:Distribution.Simple.UserHooks
configureAction, called at libraries/Cabal/Cabal/Distribution/Simple.hs:178:19 in Cabal-2.4.0.1:Distribution.Simple
defaultMainHelper, called at libraries/Cabal/Cabal/Distribution/Simple.hs:115:27 in Cabal-2.4.0.1:Distribution.Simple
defaultMain, called at Setup.hs:2:8 in main:Main
Setup: Encountered missing dependencies:
time >=1.9.2
...
What are possible solutions here? I've also noticed the following issue but not sure if it's related: https://github.com/haskell/cabal/issues/5223
Possible solutions I've thought of:
- Override the Haskell
time
package, I assume it's a tedious process though? - Use cabal's native package management. My concern here is though that it won't be able to fully utilize Nix's store cache, so I'd end up building a lot more libraries? I did find (https://www.haskell.org/cabal/users-guide/nix-integration.html) but it isn't clear what this actually does?
- 'jailbreaking' the time library
Attempting 1:
myHaskellPackages = haskellPackages.override {
overrides = self: super: rec {
time = self.callCabal2nix "time" (builtins.fetchGit {
url = "git@github.com:haskell/time.git";
rev = "5d2046f79cf5451f48b17529abec85349333aa9f";
}) {};
};
};
variant = if doBenchmark then myHaskellPackages.lib.doBenchmark else pkgs.lib.id;
drv = variant (myHaskellPackages.callPackage f {});
Strangely results in:
nix-shell
error: infinite recursion encountered, at undefined position
(use '--show-trace' to show detailed location information)
Attempting 2:
Bare in mind I don't have thorough knowledge of cabal, but I'm just documenting what I've tried:
cabal new-update
Downloading the latest package list from hackage.haskell.org
To revert to previous state run:
cabal new-update 'hackage.haskell.org,2019-08-10T14:09:42Z'
cabal new-build
Resolving dependencies...
cabal: Could not resolve dependencies:
[__0] trying: platinumpitanga-1.0.0.0 (user goal)
[__1] next goal: turtle (dependency of platinumpitanga)
[__1] rejecting: turtle-1.5.13/installed-1Sp... (conflict: platinumpitanga =>
time>=1.9.2, turtle => time==1.8.0.2/installed-1.8...)
[__1] trying: turtle-1.5.14
[__2] next goal: time (dependency of platinumpitanga)
[__2] rejecting: time-1.8.0.2/installed-1.8... (conflict: platinumpitanga =>
time>=1.9.2)
[__2] rejecting: time-1.9.3, time-1.9.2 (conflict: turtle => time<1.9)
[__2] rejecting: time-1.9.1, time-1.9, time-1.8.0.4, time-1.8.0.3,
time-1.8.0.2, time-1.8.0.1, time-1.8, time-1.7.0.1, time-1.7, time-1.6.0.1,
time-1.6, time-1.5.0.1, time-1.5, time-1.4.2, time-1.4.1, time-1.4.0.2,
time-1.4.0.1, time-1.4, time-1.3, time-1.2.0.5, time-1.2.0.4, time-1.2.0.3,
time-1.2.0.2, time-1.2.0.1, time-1.2, time-1.1.4, time-1.1.3, time-1.1.2.4,
time-1.1.2.3, time-1.1.2.2, time-1.1.2.1, time-1.1.2.0, time-1.0 (conflict:
platinumpitanga => time>=1.9.2)
[__2] fail (backjumping, conflict set: platinumpitanga, time, turtle)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: time, platinumpitanga, turtle
cabal new-build --allow-newer
...
Building library for lens-simple-0.1.0.9..
[1 of 1] Compiling Lens.Simple ( Lens/Simple.hs, dist/build/Lens/Simple.o )
Lens/Simple.hs:13:7: error:
Not in scope: `_Left'
Perhaps you meant data constructor `Left' (imported from Prelude)
|
13 | , _Left, _Right
| ^^^^^
...
Attempting 3:
myHaskellPackages = pkgs.haskellPackages.override {
overrides = self: super: rec {
turtle = pkgs.haskell.lib.doJailbreak super.turtle;
};
};
Seems to have resulted in the same error:
...
CallStack (from HasCallStack):
die', called at libraries/Cabal/Cabal/Distribution/Simple/Configure.hs:950:20 in Cabal-2.4.0.1:Distribution.Simple.Configure
configureFinalizedPackage, called at libraries/Cabal/Cabal/Distribution/Simple/Configure.hs:460:12 in Cabal-2.4.0.1:Distribution.Simple.Configure
configure, called at libraries/Cabal/Cabal/Distribution/Simple.hs:596:20 in Cabal-2.4.0.1:Distribution.Simple
confHook, called at libraries/Cabal/Cabal/Distribution/Simple/UserHooks.hs:67:5 in Cabal-2.4.0.1:Distribution.Simple.UserHooks
configureAction, called at libraries/Cabal/Cabal/Distribution/Simple.hs:178:19 in Cabal-2.4.0.1:Distribution.Simple
defaultMainHelper, called at libraries/Cabal/Cabal/Distribution/Simple.hs:115:27 in Cabal-2.4.0.1:Distribution.Simple
defaultMain, called at Setup.hs:2:8 in main:Main
Setup: Encountered missing dependencies:
time >=1.9.2
builder for '/nix/store/67109ylsjfw8vpdv0q5b90d2bwx8zii0-platinumpitanga-1.0.0.0.drv' failed with exit code 1
error: build of '/nix/store/67109ylsjfw8vpdv0q5b90d2bwx8zii0-platinumpitanga-1.0.0.0.drv' failed
Update...
So apparently overriding a 'core' library like time
doesn't actually work (?)... I've tried to instead define something like:
myHaskellPackages = pkgs.haskell.packages.${compiler}.override {
overrides = self: super: rec {
timezz = pkgs.haskell.packages.${compiler}.callHackageDirect
{
pkg = "time";
ver = "1.9.3";
sha256 = "1bs74nj2qc83i2d78xf1hn79f37g8wjgak2bwn5bnwb31pl0bl7r";
}
{};
};
};
And then use timezz
as a dependency instead of time
... But it fails to build the time library due to:
Documentation installed in:
/nix/store/9s5hbq3pzippwcylb3x501rja2vxip1c-platinumpitanga-1.0.0.0-doc/share/doc/platinumpitanga-1.0.0.0
Configuration files installed in:
/nix/store/26qkhjjq0ry8mxx6myp0h7m21d35x84z-platinumpitanga-1.0.0.0/etc
No alex found
Using ar found on system at:
/nix/store/0y7jmqnj48ikjh37n3dl9kqw9hnn68nq-binutils-2.31.1/bin/ar
No c2hs found
No cpphs found
No doctest found
Using gcc version 7.4.0 given by user at:
/nix/store/ghzg4kg0sjif58smj2lfm2bdvjwim85y-gcc-wrapper-7.4.0/bin/gcc
Using ghc version 8.6.4 found on system at:
/nix/store/gvshp9yvc6gql09r3cyryj2zgsnfk6br-ghc-8.6.4/bin/ghc
Using ghc-pkg version 8.6.4 found on system at:
/nix/store/gvshp9yvc6gql09r3cyryj2zgsnfk6br-ghc-8.6.4/bin/ghc-pkg
No ghcjs found
No ghcjs-pkg found
No greencard found
Using haddock version 2.22.0 found on system at:
/nix/store/gvshp9yvc6gql09r3cyryj2zgsnfk6br-ghc-8.6.4/bin/haddock
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.67 found on system at:
/nix/store/gvshp9yvc6gql09r3cyryj2zgsnfk6br-ghc-8.6.4/bin/hpc
Using hsc2hs version 0.68.5 found on system at:
/nix/store/gvshp9yvc6gql09r3cyryj2zgsnfk6br-ghc-8.6.4/bin/hsc2hs
Using hscolour version 1.24 found on system at:
/nix/store/xnn0093zfkxsvjyr6g7w1l534hrb1p57-hscolour-1.24.4/bin/HsColour
No jhc found
Using ld found on system at:
/nix/store/rbpyfy6413aqpik9aj6p3a2syd1mda68-binutils-wrapper-2.31.1/bin/ld
No pkg-config found
Using runghc version 8.6.4 found on system at:
/nix/store/gvshp9yvc6gql09r3cyryj2zgsnfk6br-ghc-8.6.4/bin/runghc
Using strip version 2.31 found on system at:
/nix/store/0y7jmqnj48ikjh37n3dl9kqw9hnn68nq-binutils-2.31.1/bin/strip
Using tar found on system at:
/nix/store/wmxqm38g1y1y7sd7s9vg7an3klffaiyz-gnutar-1.31/bin/tar
No uhc found
*** abort because of serious configure-time warning from Cabal
builder for '/nix/store/3dsr8m5frzyn0lcmf4v0b80fq55b2vp6-platinumpitanga-1.0.0.0.drv' failed with exit code 1
error: build of '/nix/store/3dsr8m5frzyn0lcmf4v0b80fq55b2vp6-platinumpitanga-1.0.0.0.drv' failed