Skip to content

Instantly share code, notes, and snippets.

@apeyroux
Created April 4, 2019 18:25
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 apeyroux/457efc911ab97d52cafb57797bf0a59a to your computer and use it in GitHub Desktop.
Save apeyroux/457efc911ab97d52cafb57797bf0a59a to your computer and use it in GitHub Desktop.
{ nixpkgs ? (import <nixpkgs> {}).pkgsMusl, compiler ? "default", doBenchmark ? false }:
let
inherit (nixpkgs) pkgs;
f = { mkDerivation, aeson, base, bytestring, directory, filepath
, hasql, optparse-applicative, stdenv, text, time
}:
mkDerivation {
pname = "atrc-audit";
version = "0.1.0.0";
src = ./.;
isLibrary = false;
isExecutable = true;
executableHaskellDepends = [
aeson base bytestring directory hasql filepath optparse-applicative
text time
];
license = stdenv.lib.licenses.bsd3;
enableSharedExecutables = false;
enableSharedLibraries = false;
configureFlags = [
"--ghc-option=-optl=-pthread"
"--ghc-option=-optl=-static -fPIC"
"--ghc-option=-optl=-L${pkgs.gmp6.override { withStatic = true; }}/lib"
"--ghc-option=-optl=-L${pkgs.zlib.static}/lib"
"--ghc-option=-optl=-L${pkgs.glibc.static}/lib"
];
};
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