Closed hhefesto closed 4 years ago
Being able to override a haskell.nix haskell package would definitely be a nice workaround (https://github.com/input-output-hk/haskell.nix/issues/510). But seems to be that this isn't supported yet.
Generally, hackage packages should work with haskell.nix
out of the box, so thanks for filing an issue. The GHC library is a bit of a pain for various reasons, unfortunately. You may need to set reinstallableLibGhc = true
(like here). That's a bit obscure, I know, but it's often a remedy for weird issues with the GHC library.
Overriding a haskell.nix
package with one from somewhere else is just not going to work, unfortunately. We build Haskell packages component-by-component, which e.g. the nixpkgs infrastructure doesn't, so things just won't line up.
setting reinstallableLibGhc = true
worked!
I first ran into a weird problem were it misplaced the haskell alex
package.
trace: Using latest index state for telomare!
trace: Using index-state: 2020-10-14T00:00:00Z for telomare
error: Neither the Haskell package set or the Nixpkgs package set contain the package: alex (build tool dependency).
If this is a system dependency:
You may need to augment the system package mapping in haskell.nix so that it can be found.
If this is a Haskell dependency:
If you are using Stackage, make sure that you are using a snapshot that contains the package. Otherwise you may need to update the Hackage snapshot you are using, usually by updating haskell.nix.
(use '--show-trace' to show detailed location information)
Which got fixed by specifying alex
in our overlay (which I learned from you).
For completeness this is our working default.nix:
{ # Fetch the latest haskell.nix and import its default.nix
haskellNix ? import (builtins.fetchTarball "https://github.com/input-output-hk/haskell.nix/archive/ef6ca0f431fe3830c25cb2d185367245c1cce894.tar.gz") {}
# haskellNix ? import (builtins.fetchTarball "https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz") {}
# # For LLVM
# , enableLLVMAssertions ? true # TODO: Fix
, compiler ? "ghc884"
}:
let
# haskell.nix provides access to the nixpkgs pins which are used by our CI,
# hence you will be more likely to get cache hits when using these.
# But you can also just use your own, e.g. '<nixpkgs>'.
nixpkgsSrc = haskellNix.sources.nixpkgs-2003;
# haskell.nix provides some arguments to be passed to nixpkgs, including some
# patches and also the haskell.nix functionality itself as an overlay.
nixpkgsArgs = haskellNix.nixpkgsArgs;
telomare_jumper = pkgs.stdenv.mkDerivation {
name = "telomareJumper";
src = ./cbits;
buildInputs = [ pkgs.boehmgc ];
};
telomareOverlays = [ (self: super: {
jumper = telomare_jumper;
gc = self.boehmgc;
llvm-config = self.llvm_9;
alex = self.haskellPackages.alex;
}) ];
# import nixpkgs with overlays
pkgs = (import nixpkgsSrc (nixpkgsArgs // { overlays = nixpkgsArgs.overlays ++ telomareOverlays;}));
in
pkgs.haskell-nix.cabalProject {
src = pkgs.haskell-nix.cleanSourceHaskell {
src = ./.;
name = "telomare";
};
compiler-nix-name = compiler;
pkg-def-extras = with pkgs.haskell.lib; [
(hackage: {
llvm-hs = hackage.llvm-hs."9.0.1".revisions.default;
llvm-hs-pure = hackage.llvm-hs-pure."9.0.0".revisions.default;
})
];
# modules = [];
modules = [
{ reinstallableLibGhc = true; }
];
}
the derive-storable-plugin
reference is in the cabal file under the library's build-depends
Firstly, hello and thank you for your time on this. I really like haskell.nix: it has make a lot of things simpler. <3
To the business in hand: Currently unable to build
derive-storable-plugin
Compile error:
Warning worth noting:
Got the same error trying to build another project with a local reference to this package in
project.cabal
Successful ways of building this package:
On channel nixos-20.09:
Was also able to build using a standard nix-shell provided by haskell.nix with
cabal new-build
Was also able to build with
nix-build
usingpkgs.haskellPackages.callPackage
on the output ofcabal2nix cabal://derive-storable-plugin-0.2.3.0
on channel nixos-20.03Also tried with ghc865 and cabal 3.0.0.0 and with derive-storable-plugin-0.2.2.0 (channel nixos-20.03)
If I'm interpreting this right, hackage also marks it as healthy: https://matrix.hackage.haskell.org/#/package/derive-storable-plugin
Thanks!