Skip to content

Instantly share code, notes, and snippets.

@codedmart
Created July 14, 2015 02:44
Show Gist options
  • Select an option

  • Save codedmart/1a795dd98d94db01cb69 to your computer and use it in GitHub Desktop.

Select an option

Save codedmart/1a795dd98d94db01cb69 to your computer and use it in GitHub Desktop.
[1 of 1] Compiling Network.Wai.Middleware.Cors ( src/Network/Wai/Middleware/Cors.hs, dist/build/Network/Wai/Middleware/Cors.o )
src/Network/Wai/Middleware/Cors.hs:115:1: Warning:
Defined but not used: type constructor or class ‘ReqMonad’
src/Network/Wai/Middleware/Cors.hs:348:19: Warning:
This binding for ‘respOrigin’ shadows the existing binding
bound at src/Network/Wai/Middleware/Cors.hs:340:13
In-place registering wai-cors-0.2.3...
Preprocessing test suite 'phantomjs' for wai-cors-0.2.3...
[1 of 2] Compiling Server ( test/Server.hs, dist/build/phantomjs/phantomjs-tmp/Server.dyn_o )
[2 of 2] Compiling Main ( test/PhantomJS.hs, dist/build/phantomjs/phantomjs-tmp/Main.dyn_o )
Linking dist/build/phantomjs/phantomjs ...
running tests
Running 1 test suites...
Test suite phantomjs: RUNNING...
Missing PhantomJS exectuable: in order to run this test-suite PhantomJS must be availabe on the system
Test suite phantomjs: FAIL
Test suite logged to: dist/test/wai-cors-0.2.3-phantomjs.log
0 of 1 test suites (0 of 1 test cases) passed.
builder for ‘/nix/store/afr29jn3qhx0n4xs15kxxcswwxiw90as-haskell-wai-cors-0.2.3.drv’ failed with exit code 1
cannot build derivation ‘/nix/store/dzwcg59pyr16s7g1d2gr5nhsm7f85yvg-ghc-7.10.1.drv’: 1 dependencies couldn't be built
error: build of ‘/nix/store/dzwcg59pyr16s7g1d2gr5nhsm7f85yvg-ghc-7.10.1.drv’ failed
{ nixpkgs ? import <nixpkgs> {}, compiler ? "ghc7101" }:
let
inherit (nixpkgs) pkgs;
f = { mkDerivation, aeson, base, bcrypt, bytestring, cmdargs
, configurator, either, either-unwrap, http-types, mmorph, mtl
, network, random, resource-pool, rethinkdb, safe, servant-server
, stdenv, text, time, transformers, transformers-compat
, unordered-containers, utf8-string, uuid, wai, wai-cors, warp
}:
mkDerivation {
pname = "myProject";
version = "0.1.0.0";
src = ./.;
isLibrary = false;
isExecutable = true;
buildDepends = [
aeson base bcrypt bytestring cmdargs configurator either
either-unwrap http-types mmorph mtl network random resource-pool
rethinkdb safe servant-server text time transformers
transformers-compat unordered-containers utf8-string uuid wai
wai-cors warp
];
license = stdenv.lib.licenses.mit;
};
drv = pkgs.haskell.packages.${compiler}.callPackage f {};
in
if pkgs.lib.inNixShell then drv.env else drv
@rah-mblox
Copy link
Copy Markdown

Completely untested but as a start try changing

  drv = pkgs.haskell.packages.${compiler}.callPackage f {};

to

  hask = pkgs.haskell.packages.${compiler};
  drv = hask.callPackage f {
    wai-cors = pkgs.haskell.lib.overrideCabal hask.wai-cors (drv: {
      buildDepends = drv.buildDepends ++ [pkgs.phantomjs];
      patchPhase = ''
        substituteInPlace test/PhantomJS.hs \
          --replace '"phantomjs"' '"${pkgs.phantomjs}/bin/phantomjs"'
      '';
    };
  };

You can use something like the above until the nixpkgs version of wai-cors has been fixed.

@rah-mblox
Copy link
Copy Markdown

Alternatively

  hask = pkgs.haskell.packages.${compiler};
  drv = hask.callPackage f {
    wai-cors = pkgs.haskell.lib.dontCheck hask.wai-cors;
  };

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment