Skip to content

Instantly share code, notes, and snippets.

@idontgetoutmuch
Created February 29, 2020 12:46
Show Gist options
  • Save idontgetoutmuch/e248e5f11458a0e2372116d0e327614e to your computer and use it in GitHub Desktop.
Save idontgetoutmuch/e248e5f11458a0e2372116d0e327614e to your computer and use it in GitHub Desktop.
let
default_nixpkgs = (import <nixpkgs> {}).fetchFromGitHub {
owner = "NixOS";
repo = "nixpkgs";
rev = "2797ddee7ddebbb1292ea7673c42d77bc82b8515";
sha256 = "1gym77dlfpvflv6l5iq7nq5cqzlxw29pw6gv904s1qd88hw3y5rp";
};
in
{ nixpkgs ? default_nixpkgs, compiler ? "default", doBenchmark ? false }:
let
hsOverlay = self: super: {
haskell = super.haskell // {
packages = super.haskell.packages // {
"${compiler}" = super.haskell.packages."${compiler}".override {
overrides = haskellSelf: haskellSuper: {
splitmix = (pkgs.haskell.lib.dontCheck (pkgs.haskellPackages.callCabal2nix "splitmix" (
self.fetchFromGitHub {
owner = "phadej";
repo = "splitmix";
rev = "fcf2d95181c0d4c39dbaf80cd28b6498f24e5f74";
sha256 = "1yfmc766jki1s0pr4hrp29ngfyxznz71vg303b7hrvin411q8w4l";
}) { }));
random = (pkgs.haskell.lib.dontCheck (pkgs.haskellPackages.callCabal2nix "random" (
self.fetchFromGitHub {
owner = "idontgetoutmuch";
repo = "random";
rev = "023e812545d2fac849ae64058d64590a63d2fe89";
sha256 = "1yfmc766jki1s0pr4hrp29ngfyxznz71vg303b7hrvin411q8w4l";
}) { }));
};
};
};
};
};
orig_pkgs = import nixpkgs {};
pkgs = import orig_pkgs.path { overlays = [ hsOverlay ]; };
in
let
f = { mkDerivation, base, mwc-random, pcg-random, random, splitmix, stdenv,
tf-random }:
mkDerivation {
pname = "random-tests";
version = "0.1.0.0";
src = ./.;
libraryHaskellDepends = [ base mwc-random pcg-random random splitmix
tf-random ];
license = stdenv.lib.licenses.bsd3;
};
haskellPackages = if compiler == "default"
then pkgs.haskellPackages
else pkgs.haskell.packages.${compiler};
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