bisc/default.nix

49 lines
1.5 KiB
Nix

{ nixpkgs ? <nixpkgs>
, static ? false
, compiler ? "default"
, doBenchmark ? false
, system ? builtins.currentSystem
}:
let
basepkgs = import nixpkgs { inherit system; };
pkgs = if static then basepkgs.pkgsStatic else basepkgs.pkgs;
f = { mkDerivation, base, bytestring, configurator, data-default
, directory, exceptions, filepath, leveldb-haskell, mtl, selda
, selda-sqlite, lib, text, optparse-applicative
}:
mkDerivation {
pname = "bisc";
version = "0.3.0.0";
src = ./.;
isLibrary = false;
isExecutable = true;
executableHaskellDepends = [
base bytestring configurator data-default directory exceptions
filepath leveldb-haskell mtl selda selda-sqlite text
optparse-applicative
];
executableSystemDepends = [ pkgs.snappy ];
buildFlags = lib.optionals static [
"--ld-option=-lstdc++"
"--ld-option=-lsnappy"
];
homepage = "https://maxwell.ydns.eu/git/rnhmjoj/bisc";
description = "A small tool that clears cookies (and more)";
license = lib.licenses.gpl3;
};
ghc = if static then pkgs.haskell.packages.integer-simple.ghc8104
else 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 (ghc.callPackage f {});
in
if pkgs.lib.inNixShell then drv.env else drv