input-output-hk / stack2nix

Generate nix expressions for Haskell projects
MIT License
99 stars 32 forks source link

Getting "anonymous function called without required argument 'CoreServices'" when following nix installation instructions. #162

Open fghibellini opened 5 years ago

fghibellini commented 5 years ago

when I run nix-build in the project root I get:

error: anonymous function at /Users/<user>/code/stack2nix/stack2nix.nix:15630:10 called without required argument 'CoreServices', at /nix/store/ydnxlkpdy47jffbb9sim11hb43xjrnhr-872502aa56bd4d574fcfe9cfef9066c9e8ee2894.tar.gz-unpacked/pkgs/development/haskell-modules/make-package-set.nix:87:27
(use '--show-trace' to show detailed location information)

System:

macOS High Sierra


> nix-build --version
nix-build (Nix) 2.1.3
chrissound commented 5 years ago

Seem to run into a similar issue:

1417:10 called without required argument 'Win32', at /nix/store/64ifnp2lmldnvc1wvxyav8r5lh55nzgk-nixos-18.09.2474.222950952f1/nixos/pkgs/development/haskell-modules/make-package-set.nix:87:27

Where the relevant line refers to:

"Win32-notify" = callPackage
  ({ mkDerivation, base, containers, directory, stdenv, Win32 }:
   mkDerivation {
     pname = "Win32-notify";
     version = "0.3.0.3";
     sha256 = "0c21dbe06cb1ce3b3e5f1aace0b7ee359b36e7cb057f8fe2c28c943150044116";
     isLibrary = true;
     isExecutable = true;
     libraryHaskellDepends = [ base containers directory Win32 ];
     doHaddock = false;
     doCheck = false;
     description = "A binding to part of the Win32 library for file notification";
     license = stdenv.lib.licenses.bsd3;
   }) {};
domenkozar commented 5 years ago

These are all overrides that need to be specified manually. Should add a doc section how it's done.

chrissound commented 5 years ago

I think it is going to be similar to what is described here: https://nixos.org/nixpkgs/manual/#how-to-create-nix-builds-for-your-own-private-haskell-packages (which is how cabal2nix is used)?

shmish111 commented 5 years ago

I've seen the following which looks like a stack2nix bug to me?

      "hfsevents" = callPackage
        ({ mkDerivation, base, bytestring, cereal, Cocoa, CoreServices, mtl
         , stdenv, text, unix
         }:
         mkDerivation {
           pname = "hfsevents";
           version = "0.1.6";
           sha256 = "74c3f3f3a5e55fff320c352a2d481069ff915860a0ab970864c6a0e6b65d3f05";
           libraryHaskellDepends = [ base bytestring cereal mtl text unix ];
           librarySystemDepends = [ Cocoa ];
           libraryToolDepends = [ CoreServices ];
           doHaddock = false;
           doCheck = false;
           homepage = "http://github.com/luite/hfsevents";
           description = "File/folder watching for OS X";
           license = stdenv.lib.licenses.bsd3;
           platforms = [ "x86_64-darwin" ];
         }) {inherit (pkgs.darwin.apple_sdk.frameworks) Cocoa;};

If I add CoreServices to the last line inherit (pkgs.darwin.apple_sdk.frameworks) Cocoa CoreServices; it builds correctly, it seems that stack2nix is ignoring the requirement of libraryToolDepends?

mavenraven commented 5 years ago

+1, doesn't build on OS X :/.

nuttycom commented 4 years ago

+1 @shmish111's fix works for me.