1

Problem. I am building a nix expression godot-haskell from its GitHub repo which

  • Has/requires git submodules to compile properly
  • Takes an optional build argument godot-api that I'd like to use

If I manually clone this repo (recursively via git clone --recursive), and then

let 
  # ...
  godot-haskell = haskellPackages.callPackage /local/path/to/default.nix { api-json = godot-api; };
  # ...
in 
  # ...

then everything works fine! But if instead I try to do this non-locally:

godot-haskell-nix = "${fetchFromGitHub {
  fetchSubmodules = true;
  owner = "SimulaVR";
  repo = "godot-haskell";
  rev =  "df592f8e12647ed58d7ba6da4cf40a382d83725e";
  sha256 = "05wp8lzj2xqwkif8hw9l4byw0dfm3y3jaccsvjif4izfwycj91r8";
  }}/default.nix";

godot-haskell = haskellPackages.callPackage godot-haskell-nix { api-json = godot-api; };  # <- With the `api-json` build argument

then I get

error: anonymous function at /nix/store/xnf67r119iazf828ixny8wjyzl01hwsg-source/default.nix:1:1 called with unexpected argument 'api-json', at /nix/store/7knlwgidnagqrckm5h051i4rxjf3l68z-nixpkgs-20.03pre211220.1144ee55385/nixpkgs/pkgs/development/haskell-modules/make-package-set.nix:87:27
(use '--show-trace' to show detailed location information)

Question: Why does this work fine when done locally, but suddenly fail when using fetchFromGitHub? How to get around this error?

George
  • 6,927
  • 4
  • 34
  • 67
  • Possibly useful: https://stackoverflow.com/questions/56414329/how-do-i-override-a-haskell-package-with-a-git-local-package-with-nix-when-usi/56416694 – Chris Stryczynski Feb 28 '20 at 20:19

1 Answers1

1

cat /nix/store/xnf67r119iazf828ixny8wjyzl01hwsg-source/default.nix shows:

{ mkDerivation, aeson, ansi-wl-pprint, base, bytestring, c2hs
, casing, colour, containers, hpack, lens, linear, mtl, parsec
, parsers, stdenv, stm, template-haskell, text
, unordered-containers, vector
}:

mkDerivation {
  pname = "godot-haskell";
  version = "3.1.0.0";
  src = ./.;
  libraryHaskellDepends = [
    aeson ansi-wl-pprint base bytestring casing colour containers lens
    linear mtl parsec parsers stm template-haskell text
    unordered-containers vector
  ];
  libraryToolDepends = [ c2hs hpack ];
  doHaddock = false;
  preConfigure = "hpack";
  homepage = "https://github.com/KaneTW/godot-haskell#readme";
  description = "Haskell bindings for the Godot game engine API";
  license = stdenv.lib.licenses.bsd3;
}

No api-json argument! So the difference isn't in how nix is evaluating the local files vs the fetchFromGitHub ones, the difference is that they're not the same content!

Sure enough, I had a look at revision df592f8e12647ed58d7ba6da4cf40a382d83725e of that repo. It's the latest commmit on the master branch. However the link you included in your question goes to the simula branch, which includes commits that haven't made it to master yet.

Try using rev = "45f15cf95e5a7228bed0739e020d4c404c3af49e"; (you'll have to update the nix hash as well, of course).

Ben
  • 68,572
  • 20
  • 126
  • 174