add Nix expression for static/cross compilation
This commit is contained in:
parent
26cdfa7994
commit
74c7db11a8
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,2 +1 @@
|
||||
dist
|
||||
default.nix
|
||||
|
47
default.nix
Normal file
47
default.nix
Normal file
@ -0,0 +1,47 @@
|
||||
{ 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, snappy
|
||||
}:
|
||||
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
|
||||
];
|
||||
executableSystemDepends = [ 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
|
Loading…
Reference in New Issue
Block a user