Skip to content

Instantly share code, notes, and snippets.

@ocharles
Last active December 20, 2019 15:18
Show Gist options
  • Save ocharles/76e595f0013a66efbc355afb8795070b to your computer and use it in GitHub Desktop.
Save ocharles/76e595f0013a66efbc355afb8795070b to your computer and use it in GitHub Desktop.
haskellPackages =
pkgs.haskellPackages.override {
overrides = self: super:
let
mk-packagedb =
packages:
pkgs.runCommand "make-package-db" {}
''
mkdir $out
${ pkgs.lib.concatMapStringsSep
"\n"
( pkg: "cp -f ${pkg}/lib/ghc-8.6.5/package.conf.d/*.conf $out/" )
packages }
${self.ghc}/bin/ghc-pkg --package-db="$out" recache
'';
in
{
ghc-nix =
self.callPackage ../ghc-nix {};
fused-effects =
( pkgs.haskell.lib.overrideCabal
super.fused-effects
( args:
{ configureFlags = [ "-w ${self.ghc-nix}/bin/ghc-nix" ];
buildTools = [ pkgs.which nix ];
postConfigure = "ls -l /build/package.conf.d ; echo $PACKAGE_DB";
}
) ).overrideAttrs ( oldAttrs: {
requiredSystemFeatures = [ "recursive-nix" ];
NIX_PATH = pkgs.path;
PACKAGE_DB = mk-packagedb ( builtins.filter ( x: x != null ) ( super.fused-effects.buildInputs ++ super.fused-effects.propagatedBuildInputs ) );
});
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment