Skip to content

Instantly share code, notes, and snippets.

@idontgetoutmuch
Created February 28, 2018 18:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save idontgetoutmuch/d2cbff65a4abc992c43f50909c99cb55 to your computer and use it in GitHub Desktop.
Save idontgetoutmuch/d2cbff65a4abc992c43f50909c99cb55 to your computer and use it in GitHub Desktop.
{ nixpkgs ? import <nixpkgs> { overlays = [(self: super: {gsl = super.gsl.overrideAttrs (o: {CFLAGS = "-DDEBUG";});})]; }
, compiler ? "ghc822"
, doBenchmark ? false }:
let
inherit (nixpkgs) pkgs;
f = { mkDerivation, ad, array, base, bytestring, cassava, containers
, datasets, diagrams-lib, diagrams-rasterific, foldl, Frames, ghc-prim, gsl
, hmatrix, hmatrix-gsl
, inline-r, julia, lens, mtl, pipes, plots, random-fu, R, random-source
, stdenv, template-haskell, text, typelits-witnesses, vector, vinyl }:
mkDerivation {
pname = "variational";
version = "0.1.0.0";
src = ./.;
isLibrary = false;
isExecutable = true;
executableHaskellDepends = [
ad
array
base
bytestring
cassava
containers
datasets
diagrams-lib
diagrams-rasterific
foldl
Frames
ghc-prim
hmatrix
hmatrix-gsl
inline-r
lens
mtl
pipes
plots
random-fu
random-source
template-haskell
text
typelits-witnesses
vector
vinyl
];
executableSystemDepends = [
gsl
julia
R
pkgs.rPackages.anytime
pkgs.rPackages.ggplot2
pkgs.rPackages.maptools
pkgs.rPackages.reshape2
pkgs.rPackages.rgeos
pkgs.rPackages.rgdal
pkgs.rPackages.rstan ];
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;
patched-hmatrix = pkgs.haskellPackages.hmatrix.overrideAttrs (oldAttrs: rec {
src = nixpkgs.fetchgit {
url = git://github.com/albertoruiz/hmatrix;
rev = "d83b17190029c11e3ab8b504e5cdc917f5863120";
sha256 = "11wr59wg21rky59j3kkd3ba6aqns9gkh0r1fnhwhn3fp7zfhanqn";
};
postUnpack = ''
sourceRoot=''${sourceRoot}/packages/base
echo Source root reset to ''${sourceRoot}
'';
});
patched-hmatrix-gsl = pkgs.haskellPackages.hmatrix-gsl.overrideAttrs (oldAttrs: rec {
src = nixpkgs.fetchgit {
url = git://github.com/albertoruiz/hmatrix;
rev = "d83b17190029c11e3ab8b504e5cdc917f5863120";
sha256 = "11wr59wg21rky59j3kkd3ba6aqns9gkh0r1fnhwhn3fp7zfhanqn";
};
postUnpack = ''
sourceRoot=''${sourceRoot}/packages/gsl
echo Source root reset to ''${sourceRoot}
'';
});
drv = variant (haskellPackages.callPackage f {
hmatrix = patched-hmatrix;
hmatrix-gsl = patched-hmatrix-gsl; });
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