From b821021cac83ea2e6ecdc823622239db1145cfa4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Domen=20Ko=C5=BEar?= Date: Sun, 28 Jan 2018 21:58:33 +0000 Subject: [PATCH] Merge {build,shell,default}.nix into default.nix cabal2nix generates all of them in one go. --- Makefile | 5 +--- README.md | 2 +- build.nix | 9 ------- default.nix | 70 ++++++++++++++++++++++++++++++++--------------------- shell.nix | 45 ---------------------------------- 5 files changed, 45 insertions(+), 86 deletions(-) delete mode 100644 build.nix delete mode 100644 shell.nix diff --git a/Makefile b/Makefile index 0ef5d91..608abb0 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,4 @@ -all: default.nix shell.nix +all: default.nix default.nix: hnix.cabal - cabal2nix . > $@ - -shell.nix: hnix.cabal cabal2nix --shell . > $@ diff --git a/README.md b/README.md index c80b23d..eba0fb2 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/build.nix b/build.nix deleted file mode 100644 index ea97fbf..0000000 --- a/build.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ nixpkgs ? import {}, 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 {} diff --git a/default.nix b/default.nix index 82d4f85..ca25502 100644 --- a/default.nix +++ b/default.nix @@ -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 {}, 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 diff --git a/shell.nix b/shell.nix deleted file mode 100644 index b626814..0000000 --- a/shell.nix +++ /dev/null @@ -1,45 +0,0 @@ -{ nixpkgs ? import {}, 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