Add shell.nix

This commit is contained in:
John Wiegley 2018-04-03 22:12:48 -07:00
parent 735c5ca15a
commit 5ccc2ce72c
1 changed files with 52 additions and 0 deletions

52
shell.nix Normal file
View File

@ -0,0 +1,52 @@
{ nixpkgs ? import <nixpkgs> {}, compiler ? "default", doBenchmark ? false }:
let
inherit (nixpkgs) pkgs;
f = { mkDerivation, ansi-wl-pprint, base, containers, criterion
, data-fix, deepseq, deriving-compat, directory, filepath, Glob
, parsers, regex-tdfa, regex-tdfa-text, semigroups, split, stdenv
, tasty, tasty-hunit, tasty-th, text, transformers, trifecta
, unordered-containers, these, optparse-applicative, free
, interpolate, process, exceptions, bytestring, mtl, monadlist
, base16-bytestring, cryptohash, template-haskell, syb
}:
mkDerivation {
pname = "hnix";
version = "0.4.0";
src = ./.;
isLibrary = true;
isExecutable = true;
libraryHaskellDepends = [
ansi-wl-pprint base containers data-fix deepseq deriving-compat
parsers regex-tdfa regex-tdfa-text semigroups text transformers
trifecta unordered-containers these free process directory
filepath exceptions bytestring mtl monadlist base16-bytestring
cryptohash template-haskell syb
];
executableHaskellDepends = [
ansi-wl-pprint base containers data-fix deepseq optparse-applicative
text transformers unordered-containers template-haskell
];
testHaskellDepends = [
base containers data-fix directory filepath Glob split tasty
tasty-hunit tasty-th text transformers interpolate
];
benchmarkHaskellDepends = [ base containers criterion text ];
homepage = "http://github.com/jwiegley/hnix";
description = "Haskell implementation of the Nix language";
license = stdenv.lib.licenses.bsd3;
};
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