Is elm2nix broken?

Following the instruction on:
gives me this error:

error: anonymous function at /nix/store/<sha>/nixpkgs/pkgs/development/compilers/elm/fetchElmDeps.nix:3:1 called without required argument 'registryDat', at /tmp/elm-todomvc/default.nix:23:20

I looked at the fetchElmDeps.nix file:
and it seems to now take 3 arguments but the default.nix file generated by elm2nix init only gives it 2.
I modified the default.nix file to have:

    buildPhase = pkgs.elmPackages.fetchElmDeps {
       elmPackages = import srcs;
       registryDat = versionsDat;
       elmVersion = "0.19.0";

and that leads to the error:

-- PROBLEM LOADING PACKAGE LIST ------------------------------------------------

I need the list of published packages to verify your dependencies, so I tried to

But my HTTP library is giving me the following error message:

    ConnectionFailure Network.Socket.getAddrInfo (called with preferred socket type/protocol: AddrInfo {addrFlags = [AI_ADDRCONFIG], addrFamily = AF_UNSPEC, addrSocketType = Stream, addrProtocol = 0, addrAddress = <assumed to be undefined>, addrCanonName = <assumed to be undefined>}, host name: Just "", service name: Just "443"): does not exist (Name or service not known)

which looks like it is from elm.
Is there a workaround for the problem?

It appears that elm2nix was broken by commit 5235b190459. My impression from looking at this is that it’s trying to pre-fetch all of the dependency information with elm2nix, which should in theory mean it doesn’t need to fetch the package list. Maybe the new registry.dat file is different than the old versions.dat file.

As for the error itself, this is happening because derivations aren’t allowed network access by default, they only get network access if they are a “fixed-output derivation”, which means they specify the output hash that is then checked against their results to ensure that they’re fully reproducible (e.g. they fetched the same data each time). In theory you could try adding a hash to your derivation, but I don’t know if it’s reproducible (i.e. will produce the same hash each time), and I believe the expected behavior here is that it doesn’t fetch the package list at all.

I guess what I’d suggest for the short term is to run the elm2nix output against a snapshot of nixpkgs that predates that commit (or against the nixos-19.09 channel).

See for what looks like a fix to these issues.

Thank you @lilyball and @Jerith gonna have a look at these when I work on the side project again. Can’t wait till my Haskell is good enough for me to fix such things :smiley:

1 Like