Created
November 1, 2020 11:01
-
-
Save srhb/b406a8e18badfb1f3c8ffce903a1e6e4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ nixpkgs ? import <nixpkgs> { config.allowBroken = true; }, | |
compiler ? "default", | |
doBenchmark ? false | |
}: | |
let | |
inherit (nixpkgs) pkgs; | |
extension = with pkgs.haskell.lib; hself: hsuper: { | |
random-source = doJailbreak hsuper.random-source; | |
random-fu = doJailbreak hsuper.random-fu; | |
}; | |
f = { mkDerivation, base, hmatrix, random, random-fu, stdenv, vector }: | |
mkDerivation { | |
pname = "mypackage"; | |
version = "0.1.0.0"; | |
src = ./.; | |
isLibrary = true; | |
isExecutable = true; | |
libraryHaskellDepends = [base hmatrix random random-fu vector]; | |
executableHaskellDepends = [base hmatrix random-fu]; | |
license = stdenv.lib.licenses.bsd3; | |
}; | |
haskellPackages = if compiler == "default" | |
then pkgs.haskellPackages.extend extension | |
else pkgs.haskell.packages.${compiler}.extend extension; | |
variant = if doBenchmark then pkgs.haskell.lib.doBenchmark else pkgs.lib.id; | |
drv = variant (haskellPackages.callPackage f {}); | |
in | |
if pkgs.lib.inNixShell then drv.env else drv |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment