Add back *.nix files for the sake of Travis

This commit is contained in:
John Wiegley 2018-01-22 18:38:04 -08:00
parent 054eb3ced5
commit 8b47c8b143
5 changed files with 82 additions and 3 deletions

2
.gitignore vendored
View File

@ -3,5 +3,3 @@
**/#*
**/.#*
result
/default.nix
/shell.nix

View File

@ -4,4 +4,4 @@ env:
language: nix
script: nix-build --argstr compiler "$GHCVERSION"
script: nix-build build.nix --argstr compiler "$GHCVERSION"

9
build.nix Normal file
View File

@ -0,0 +1,9 @@
{ nixpkgs ? import <nixpkgs> {}, compiler ? null }:
let
haskellPackages = if compiler == null
# use the current default version
then nixpkgs.pkgs.haskellPackages
else nixpkgs.pkgs.haskell.packages.${compiler};
in
haskellPackages.callPackage ./default.nix {}

27
default.nix Normal file
View File

@ -0,0 +1,27 @@
{ mkDerivation, ansi-wl-pprint, base, containers, criterion
, data-fix, deepseq, deriving-compat, parsers, regex-tdfa
, regex-tdfa-text, semigroups, stdenv, tasty, tasty-hunit, tasty-th
, text, transformers, trifecta, unordered-containers
}:
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
];
executableHaskellDepends = [
ansi-wl-pprint base containers data-fix deepseq
];
testHaskellDepends = [
base containers data-fix tasty tasty-hunit tasty-th text
];
benchmarkHaskellDepends = [ base containers criterion text ];
homepage = "http://github.com/jwiegley/hnix";
description = "Haskell implementation of the Nix language";
license = stdenv.lib.licenses.bsd3;
}

45
shell.nix Normal file
View File

@ -0,0 +1,45 @@
{ nixpkgs ? import <darwin> {}, compiler ? "default", doBenchmark ? false }:
let
inherit (nixpkgs) pkgs;
f = { mkDerivation, ansi-wl-pprint, base, containers, criterion
, data-fix, deepseq, deriving-compat, parsers, regex-tdfa
, regex-tdfa-text, semigroups, stdenv, tasty, tasty-hunit, tasty-th
, text, transformers, trifecta, unordered-containers
}:
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
];
executableHaskellDepends = [
ansi-wl-pprint base containers data-fix deepseq
];
testHaskellDepends = [
base containers data-fix tasty tasty-hunit tasty-th text
];
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