Merge {build,shell,default}.nix into default.nix

cabal2nix generates all of them in one go.
This commit is contained in:
Domen Kožar 2018-01-28 21:58:33 +00:00
parent a28a8397cd
commit b821021cac
No known key found for this signature in database
GPG Key ID: C2FFBCAFD2C24246
5 changed files with 45 additions and 86 deletions

View File

@ -1,7 +1,4 @@
all: default.nix shell.nix
all: default.nix
default.nix: hnix.cabal
cabal2nix . > $@
shell.nix: hnix.cabal
cabal2nix --shell . > $@

View File

@ -13,7 +13,7 @@ Tested with Nix v1.10.
$ git clone https://github.com/jwiegley/hnix.git
...
$ cd hnix
$ cabal2nix --shell . > shell.nix
$ cabal2nix --shell . > default.nix
$ nix-shell
...
$ cabal test

View File

@ -1,9 +0,0 @@
{ 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 {}

View File

@ -1,27 +1,43 @@
{ 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;
}
{ nixpkgs ? import <nixpkgs> {}, compiler ? "default" }:
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};
drv = haskellPackages.callPackage f {};
in
if pkgs.lib.inNixShell then drv.env else drv

View File

@ -1,45 +0,0 @@
{ 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