diff options
-rw-r--r-- | biz.nix | 22 | ||||
-rw-r--r-- | overlay.nix | 15 |
2 files changed, 27 insertions, 10 deletions
@@ -34,16 +34,15 @@ in { ghc = pkgs.haskell.packages.ghc865.ghcWithHoogle (hp: if (subset deps allDeps) then depsToPackageSet hp deps - else throw ("missing from deps.nix: ${toString (lib.lists.subtractLists allDeps deps)}") - ); + else throw + "missing from deps.nix: ${toString (lib.lists.subtractLists allDeps deps)}"); in stdenv.mkDerivation { name = module; - version = "0"; src = ./.; nativeBuildInputs = [ ghc ]; strictDeps = true; buildPhase = '' - mkdir -p $out/{bin,static} ${baseNameOf relpath} + mkdir -p $out/bin # compile with ghc ${ghc}/bin/ghc -Werror -i. \ --make ${main} \ @@ -59,21 +58,24 @@ in { relpath = builtins.replaceStrings ["${root}/"] [""] (builtins.toString main); module = builtins.replaceStrings ["/" ".hs"] ["." ""] relpath; content = builtins.readFile main; - exe = builtins.head (lists.flatten (seq + exe = builtins.head (lists.flatten (removeNull (map (builtins.match "^-- : exe ([[:alnum:]._-]*)$") (lines content)))); - deps = lists.flatten (seq + deps = lists.flatten (removeNull (map (builtins.match "^-- : dep ([[:alnum:]._-]*)$") (lines content))); - ghcjs = ghcjs_.ghcWithPackages (hp: depsToPackageSet hp deps); + ghcjs = pkgs.haskell.packages.ghcjs.ghcWithPackages (hp: + if (subset deps allDeps) + then depsToPackageSet hp deps + else throw + "missing from deps.nix: ${toString (lib.lists.subtractLists allDeps deps)}"); in stdenv.mkDerivation { name = module; - version = "0"; src = ./.; nativeBuildInputs = [ ghcjs ]; strictDeps = true; buildPhase = '' - mkdir -p $out/{bin,static} ${baseNameOf relpath} + mkdir -p $out/static # compile with ghcjs ${ghcjs}/bin/ghcjs -Werror -i. \ --make ${main} \ @@ -81,7 +83,7 @@ in { -o ${exe} # optimize js output ${pkgs.closurecompiler}/bin/closure-compiler \ - ${exe}.jsexe/all.js > $out/static/${exe} + ${exe}/all.js > $out/static/${exe} ''; installPhase = "exit 0"; } // { env = ghcjs; }; diff --git a/overlay.nix b/overlay.nix index 77bf9b4..dcadf34 100644 --- a/overlay.nix +++ b/overlay.nix @@ -7,12 +7,25 @@ let rev = "cc7729b1b42a79e261091ff7835f7fc2a7ae3cee"; sha256 = "1vd67976lvi5l4qq18zy6j44apynkl44ps04p8vwfx4gzr895dyp"; }; + jsaddleSrc = super.pkgs.fetchFromGitHub { + owner = "ghcjs"; + repo = "jsaddle"; + rev = "1e39844"; + sha256 = "1qrjrjagmrrlcalys33636w5cb67db52i183masb7xd93wir8963"; + }; + misoSrc = super.pkgs.fetchFromGitHub { + owner = "dmjio"; + repo = "miso"; + rev = "1.5"; + sha256 = "00al7gw760vzzlqpf035k4n4li0rdymcjpxn184z9nc4m92cjv9z"; + }; in { haskell = super.haskell // { packages = super.haskell.packages // { ghc865 = super.haskell.packages.ghc865.override (old: { overrides = with super.pkgs.haskell.lib; self: super: { clay = self.callCabal2nix "clay" claySrc {}; + miso = self.callCabal2nix "miso" misoSrc {}; wai-middleware-metrics = dontCheck super.wai-middleware-metrics; }; }); @@ -22,7 +35,9 @@ in { base-compat-batteries = dontCheck super.http-types; clay = dontCheck (self.callCabal2nix "clay" claySrc {}); comonad = dontCheck super.comonad; + jsaddle-warp = dontCheck (self.callCabal2nix "jsaddle-warp" "${jsaddleSrc}/jsaddle-warp" {}); http-types = dontCheck super.http-types; + miso = self.callCabal2nix "miso" misoSrc {}; network-uri= dontCheck super.network-uri; scientific = dontCheck super.scientific; # takes forever servant = dontCheck super.servant; |