haskell-nix icon indicating copy to clipboard operation
haskell-nix copied to clipboard

Missing dependencies that fiailed when using GHCJS

Open Rizary opened this issue 7 years ago • 3 comments

Hi, I run nix-build based on ghcjs' compiler. Which is based on nixpkgs, it uses ghc7103. But when I build, i got the following error:

Configuring tasty-ant-xml-1.0.4...
Setup: At least the following dependencies are missing:
directory >=1.2.6.2, filepath >=1.4.1.0
builder for ‘/nix/store/wv8ynf0cpfn8b72y5lqa2bzyn50g9vgy-tasty-ant-xml-1.0.4.drv’ failed with exit code 1
cannot build derivation ‘/nix/store/k9czcd3m6992n87gnza7wphwcqqgibfv-scientific-0.3.4.10.drv’: 1 dependencies couldn't be built
building path(s) ‘/nix/store/i830s057add78giqm80prjndissmwkvp-tasty-hunit-0.9.2’
cannot build derivation ‘/nix/store/lf2285k67bbc97bv6mk4kh32mdk4rj93-aeson-1.0.2.1.drv’: 1 dependencies couldn't be built

i've insert the missing dependencies in my release.nix in my previous attempt (this is because at first i'm using reflex, and now just plain ghcjs)

after searching around, i found this issue : https://github.com/NixOS/nixpkgs/issues/22008.

THis is the same as my first problem ini here : https://github.com/NixOS/nixpkgs/issues/23915

So in this situation, how we manage manage the environment of our compiler? I've add another built but the result as same.

Rizary avatar Mar 19 '17 17:03 Rizary

Here is my release.nix file:

{ compiler ? "ghcjs" }:

let

  config = rec {
    allowUnfree = true;
    allowBroken = true;
    packageOverrides = pkgs: rec {
      haskell = pkgs.haskell // {
        packages = pkgs.haskell.packages // {
	  "${compiler}" = pkgs.haskell.packages.${compiler}.override {
            overrides = self: super: rec {         
	  
              frontend = self.callPackage ./default.nix {};
	 
	    };
	  };
	};
      };
    };
    permittedInsecurePackages = [ "webkitgtk-2.4.11" ];
  };

  pkgs = import <nixpkgs> { inherit config; };

in
  { frontend = pkgs.haskell.packages.${compiler}.frontend; }

my default.nix:

{ mkDerivation, base, ghcjs-dom, mtl, stdenv }:
mkDerivation {
  pname = "frontend";
  version = "0.0.0.1";
  src = ./.;
  isLibrary = false;
  isExecutable = true;
  executableHaskellDepends = [ base ghcjs-dom mtl ];
  license = stdenv.lib.licenses.mpl20;
}

and my cabal file:

name:                frontend
version:             0.0.0.1
-- synopsis:            
-- description:         
license:             MPL-2.0
license-file:        LICENSE
author:             tes
maintainer:          tes
-- copyright:           
category:            Web
build-type:          Simple
extra-source-files:  ChangeLog.md
cabal-version:       >=1.10

executable frontend
  main-is:             Main.hs
  -- other-modules:       
  -- other-extensions:    
  build-depends:       base >=4.7 && <5
                     , mtl >=2.1 && <2.3
                     , ghcjs-dom >=0.5 && <0.6

  hs-source-dirs:      src
  default-language:    Haskell2010

I already try to override package in compiler with tasty-ant-xml-1.0.2 but the compiler still recognize the tasty-ant-xml-1.0.4.

Rizary avatar Mar 19 '17 22:03 Rizary

To work around this I hacked my configuration-ghc-7.10.x.nix file to disable the test suites for aeson and scientific:

diff --git a/pkgs/development/haskell-modules/configuration-ghc-7.10.x.nix b/pkgs/development/haskell-modules/configuration-ghc-7.10.x.nix
index 6a7fe29..9b63e72 100644
--- a/pkgs/development/haskell-modules/configuration-ghc-7.10.x.nix
+++ b/pkgs/development/haskell-modules/configuration-ghc-7.10.x.nix
@@ -195,7 +195,7 @@ self: super: {
   mono-traversable = addBuildDepend super.mono-traversable self.semigroups;
   attoparsec = addBuildDepends super.attoparsec (with self; [semigroups fail]);
   Glob = addBuildDepends super.Glob (with self; [semigroups]);
-  aeson = disableCabalFlag (addBuildDepend super.aeson self.semigroups) "old-locale";
+  aeson = dontCheck (disableCabalFlag (addBuildDepend super.aeson self.semigroups) "old-locale");
   bytes = addBuildDepend super.bytes self.doctest;
   case-insensitive = addBuildDepend super.case-insensitive self.semigroups;
   hoauth2 = overrideCabal super.hoauth2 (drv: { testDepends = (drv.testDepends or []) ++ [ self.wai self.warp ]; });
@@ -204,6 +204,7 @@ self: super: {
   lens = addBuildDepends super.lens (with self; [doctest generic-deriving nats simple-reflect]);
   optparse-applicative = addBuildDepend super.optparse-applicative self.semigroups;
   QuickCheck = addBuildDepend super.QuickCheck self.semigroups;
+  scientific = dontCheck super.scientific;
   semigroups = addBuildDepends super.semigroups (with self; [hashable tagged text unordered-containers]);
   texmath = addBuildDepend super.texmath self.network-uri;
   yesod-auth-oauth2 = overrideCabal super.yesod-auth-oauth2 (drv: { testDepends = (drv.testDepends or []) ++ [ self.load-env self.yesod ]; });

I don't like modifying nixpkgs directly, but my usual methods of overriding packages via ~/.nixpkgs/config.nix were ignored.

stepcut avatar Mar 23 '17 14:03 stepcut

@stepcut thank you for the response..

and after trying to setup my project, i just import some library in reflex-platform then below is my code:


{ reflex-platform ? import ./deps/reflex-platform {} , compiler ? "ghc"}:

let
  nixpkgs = reflex-platform.nixpkgs;
  config = rec {
    allowUnfree = true;
    allowBroken = true;
    packageOverrides = pkgs: rec {
      haskellPackages = pkgs.haskellPackages.override {
        overrides = self: super: rec {
	  frontend = import ./frontend { inherit reflex-platform compiler; };
	};
      };
    };
    permittedInsecurePackages = [ "webkitgtk-2.4.11" ];
  };

  pkgs = import <nixpkgs> { inherit config; } // { inherit nixpkgs; };
    
  
in
  { frontend = pkgs.haskellPackages.frontend; }

I don't know whether this is best practice from this haskell-nix tutorial.

Rizary avatar Mar 24 '17 18:03 Rizary