summaryrefslogtreecommitdiff
path: root/Biz/Bild
diff options
context:
space:
mode:
Diffstat (limited to 'Biz/Bild')
-rw-r--r--Biz/Bild/Deps/Haskell.nix126
-rw-r--r--Biz/Bild/Rules.nix31
2 files changed, 77 insertions, 80 deletions
diff --git a/Biz/Bild/Deps/Haskell.nix b/Biz/Bild/Deps/Haskell.nix
index 5e06a5d..001cdb2 100644
--- a/Biz/Bild/Deps/Haskell.nix
+++ b/Biz/Bild/Deps/Haskell.nix
@@ -1,64 +1,66 @@
+hpkgs:
+with hpkgs;
[
- "MonadRandom"
- "QuickCheck"
- "acid-state"
- "aeson"
- "async"
- "bytestring"
- "clay"
- "cmark"
- "config-ini"
- "containers"
- "directory"
- "docopt"
- "ekg"
- "envy"
- "fast-logger"
- "filepath"
- "ghcjs-base"
- "github"
- "haskeline"
- "http-types"
- "ixset"
- "katip"
- "lucid"
- "miso"
- "monad-logger"
- "monad-metrics"
- "mtl"
- "network-uri"
- "optparse-simple"
- "parsec"
- "process"
- "protolude"
- "quickcheck-instances"
- "random"
- "regex-applicative"
- "req"
- "safecopy"
- "scotty"
- "servant"
- "servant-auth"
- "servant-auth-server"
- "servant-lucid"
- "servant-server"
- "split"
- "stm"
- "string-quote"
- "stripe-haskell"
- "tasty"
- "text"
- "time"
- "transformers"
- "unagi-chan"
- "unix"
- "unordered-containers"
- "uuid"
- "vector"
- "wai"
- "wai-app-static"
- "wai-extra"
- "wai-middleware-metrics"
- "warp"
- "x509"
+ MonadRandom
+ QuickCheck
+ acid-state
+ aeson
+ async
+ bytestring
+ clay
+ cmark
+ config-ini
+ containers
+ directory
+ docopt
+ ekg
+ envy
+ fast-logger
+ filepath
+ ghcjs-base
+ github
+ haskeline
+ http-types
+ ixset
+ katip
+ lucid
+ miso
+ monad-logger
+ monad-metrics
+ mtl
+ network-uri
+ optparse-simple
+ parsec
+ process
+ protolude
+ quickcheck-instances
+ random
+ regex-applicative
+ req
+ safecopy
+ scotty
+ servant
+ servant-auth
+ servant-auth-server
+ servant-lucid
+ servant-server
+ split
+ stm
+ string-quote
+ stripe-haskell
+ tasty
+ text
+ time
+ transformers
+ unagi-chan
+ unix
+ unordered-containers
+ uuid
+ vector
+ wai
+ wai-app-static
+ wai-extra
+ wai-middleware-metrics
+ warp
+ x509
]
diff --git a/Biz/Bild/Rules.nix b/Biz/Bild/Rules.nix
index f5f016f..9a7ad77 100644
--- a/Biz/Bild/Rules.nix
+++ b/Biz/Bild/Rules.nix
@@ -13,14 +13,14 @@ let
lines = s: lib.strings.splitString "\n" s;
removeNull = ls: builtins.filter (x: x != null) ls;
- depsToPackageSet = packageSet: deps:
+ selectAttrs = deps: packageSet:
lib.attrsets.attrVals deps packageSet;
# returns true if a is a subset of b, where a and b are attrsets
subset = a: b: builtins.all
(x: builtins.elem x b) a;
- haskellDeps = import ./Deps/Haskell.nix;
+ haskellDeps = hpkgs: import ./Deps/Haskell.nix hpkgs;
# gather data needed for compiling by analyzing the main module
analyze = main: rec {
@@ -45,25 +45,20 @@ let
(lines content)));
};
- mkGhc = compiler: (deps: compiler (hp:
- if (subset deps haskellDeps)
- then depsToPackageSet hp deps
- else throw ''
- missing from nix/haskell-deps.nix:
- ${toString (lib.lists.subtractLists haskellDeps deps)}
- ''));
-
- ghc_ = mkGhc pkgs.haskell.packages.${ghcCompiler}.ghcWithHoogle;
- ghcjs_ = mkGhc pkgs.haskell.packages.${ghcjsCompiler}.ghcWithPackages;
-in {
+ mkGhcPackageSet = pkgs.haskell.packages.${ghcCompiler}.ghcWithHoogle;
+ mkGhcjsPackageSet = pkgs.haskell.packages.${ghcjsCompiler}.ghcWithPackages;
+
+in rec {
+ ghcPackageSetFull = mkGhcPackageSet haskellDeps;
+
ghc = main:
let
data = analyze main;
- ghc = ghc_ data.deps;
+ ghc = mkGhcPackageSet (hp: selectAttrs data.deps hp);
in stdenv.mkDerivation {
name = data.module;
src = ../../.;
- nativeBuildInputs = [ ghc ] ++ depsToPackageSet nixpkgs data.sysdeps;
+ nativeBuildInputs = [ ghc ] ++ selectAttrs data.sysdeps nixpkgs;
strictDeps = true;
buildPhase = ''
mkdir -p $out/bin
@@ -82,7 +77,7 @@ in {
ghcjs = main:
let
data = analyze main;
- ghcjs = ghcjs_ data.deps;
+ ghcjs = mkGhcjsPackageSet (hp: selectAttrs data.dep hp);
in stdenv.mkDerivation {
name = data.module;
src = ../../.;
@@ -108,9 +103,9 @@ in {
name = "bizdev";
buildInputs = [
# haskell deps
- (ghc_ haskellDeps)
+ (mkGhcPackageSet haskellDeps)
# ghcjs doesn't need everything, and many things fail to build
- (ghcjs_ [
+ (mkGhcjsPackageSet [
"aeson"
"clay"
"containers"