Skip to content

Instantly share code, notes, and snippets.

@idontgetoutmuch
Created March 22, 2021 15:55
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/00dd8f0a6e6e3f860213d439ce233b5d to your computer and use it in GitHub Desktop.
Save idontgetoutmuch/00dd8f0a6e6e3f860213d439ce233b5d 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.overrideAttrs (oldAttrs: rec {
src = nixpkgs.fetchgit {
url = https://github.com/tmcdonell/accelerate-blas;
rev = "4e59e73f8545db76ea5d4570fb118af4080b0385";
sha256 = "0mxcs2q3k8frkpd43vzdsp8cssnwjfqnnvnambcrrvx26fwrbgxl";
};
version = "0.3.0.0";
configureFlags = "-f -llvm-ptx";
doCheck = false;
});
my-accelerate = pkgs.haskellPackages.accelerate.overrideAttrs (oldAttrs: rec {
src = nixpkgs.fetchgit {
url = https://github.com/tmcdonell/accelerate;
rev = "49a39ea6e3d2d13cbfa8605dcb57a29ef13db1f9";
sha256 = "0wwrb1z6yc5xy7b1wqjncmkw6qnmf9xrffrqn89z6md4n3dinw7n";
};
version = "1.3.0.0";
doCheck = false;
});
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 = my-accelerate;
accelerate-blas = 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