Skip to content

Instantly share code, notes, and snippets.

@idontgetoutmuch
Created March 22, 2021 14:40
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/88a3a7fc4ad4e4e7326fa313bdf2e172 to your computer and use it in GitHub Desktop.
Save idontgetoutmuch/88a3a7fc4ad4e4e7326fa313bdf2e172 to your computer and use it in GitHub Desktop.
{ nixpkgs ? import <nixpkgs> { config.allowBroken = true; }, compiler ? "default", doBenchmark ? false }:
let
inherit (nixpkgs) pkgs;
f = { mkDerivation, accelerate, accelerate-fft
, accelerate-llvm-native, base, stdenv, mwc-random-accelerate
, random-fu, hmatrix
, accelerate-blas
}:
mkDerivation {
pname = "lorri-test";
version = "0.1.0.0";
src = ./.;
isLibrary = false;
isExecutable = true;
executableHaskellDepends = [
accelerate
accelerate-llvm-native
mwc-random-accelerate
hmatrix
accelerate-blas
random-fu
base
];
homepage = "https://github.com/idontgetoutmuch/whatever";
description = "Whatever";
license = stdenv.lib.licenses.bsd3;
};
my-accelerate-blas = pkgs.haskellPackages.accelerate-blas.overrideAttrs (oldAttrs: rec {
configureFlags = "-f -llvm-ptx";
});
haskellPackages = if compiler == "default"
then pkgs.haskellPackages
else pkgs.haskell.packages.${compiler};
myHaskellPackages = haskellPackages.override {
overrides = self: super: with pkgs.haskell.lib; {
accelerate-llvm-native = dontCheck super.accelerate-llvm-native;
accelerate-blas = dontCheck my-accelerate-blas;
};
};
variant = if doBenchmark then pkgs.haskell.lib.doBenchmark else pkgs.lib.id;
drv = variant (myHaskellPackages.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