Skip to content

Instantly share code, notes, and snippets.

@Rizary
Last active June 16, 2018 10:39
Show Gist options
  • Save Rizary/82bf44430df040f1f14eb86e286b8dab to your computer and use it in GitHub Desktop.
Save Rizary/82bf44430df040f1f14eb86e286b8dab to your computer and use it in GitHub Desktop.
setup for using cabal-install as buildinputs
{ nixpkgs ? import <nixpkgs> {}
, compiler ? "ghc822"
}:
let
inherit (nixpkgs) pkgs;
newCabal = import ./nixdeps/cabal.nix;
haskellPackages = pkgs.haskell.packages.${compiler};
modifiedHaskellPackages = haskellPackages.override {
overrides = newPackages: oldPackages: {
Cabal = newPackages.callCabal2nix "Cabal" "${newCabal}/Cabal" {};
cabal-install = newPackages.callCabal2nix "cabal-install" "${newCabal}/cabal-install" {};
text = newPackages.callCabal2nix "text" (import ./nixdeps/text.nix) {};
parsec = newPackages.callCabal2nix "parsec" (import ./nixdeps/parsec.nix) {};
hashable = newPackages.callCabal2nix "hashable" (import ./nixdeps/hashable.nix) {};
HUnit = newPackages.callCabal2nix "hunit" (import ./nixdeps/hunit.nix) {};
};
};
cabal-install = modifiedHaskellPackages.cabal-install;
Cabal = modifiedHaskellPackages.Cabal;
in
pkgs.stdenv.mkDerivation rec {
name = "abc";
src = ./.;
buildInputs = [cabal-install];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment