NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.31k stars 13.54k forks source link

Build failure: Miso Sample app #313998

Open grahamegee opened 3 months ago

grahamegee commented 3 months ago

Steps To Reproduce

Steps to reproduce the behavior:

$ nix-env -iA cachix -f https://cachix.org/api/v1/install
$ cachix use miso-haskell
$ git clone https://github.com/dmjio/miso
$ cd miso/sample-app
$ nix-build 

Build log

error:
       … in the left operand of the update (//) operator
         at /nix/store/9r1vhvri4ba913g4vyg5jqrhg6pb9amn-source/pkgs/development/haskell-modules/lib.nix:39:7:
           38|     mkDerivation = drv: (args.mkDerivation drv).override f;
           39|   })) // {
             |       ^
           40|     overrideScope = scope: overrideCabal (drv.overrideScope scope) f;

       … in the left operand of the update (//) operator
         at /nix/store/9r1vhvri4ba913g4vyg5jqrhg6pb9amn-source/pkgs/development/haskell-modules/lib.nix:39:7:
           38|     mkDerivation = drv: (args.mkDerivation drv).override f;
           39|   })) // {
             |       ^
           40|     overrideScope = scope: overrideCabal (drv.overrideScope scope) f;

       … while evaluating a branch condition
         at /nix/store/9r1vhvri4ba913g4vyg5jqrhg6pb9amn-source/lib/customisation.nix:72:7:
           71|     in
           72|       if builtins.isAttrs ff then (ff // {
             |       ^
           73|         override = newArgs: makeOverridable f (overrideWith newArgs);

       (stack trace truncated; use '--show-trace' to show the full trace)

       error: cannot coerce null to a string: null

Additional context

Previously raised and closed in the Miso project here back in 2022. Is this something that maintainers here are aware of?

Notify maintainers

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
- system: `"aarch64-darwin"`
 - host os: `Darwin 23.5.0, macOS 14.5`
 - multi-user?: `yes`
 - sandbox: `no`
 - version: `nix-env (Nix) 2.21.2`
 - nixpkgs: `/nix/store/0kl2p60mvnpscnza21p8583sz3f60jxf-source`

Add a :+1: reaction to issues you find important.

cdepillabout commented 2 months ago

@grahamegee Unless I'm misunderstanding something, I don't think this Nixpkgs repo is the correct place to report problems with the miso sample apps not building.

I imagine you'd have more luck reporting on the miso issue tracker.

Feel free to respond if this is actually some sort of Nixpkgs problem, and we can reopen this issue.

cdepillabout commented 2 months ago

Oh, I just read https://github.com/dmjio/miso/issues/705 and the miso devs seem to say that they think this is some sort of Nixpkgs problem.

I'll reopen this, but we'd appreciate if someone could investigate exactly what is going on, and pinpoint what is causing the error here.

axman6 commented 2 months ago

The error above comes from the very simple default.nix for the miso repo's sample app:

with (import (builtins.fetchTarball {
  url = "https://github.com/dmjio/miso/archive/refs/tags/1.8.tar.gz";
}) {});
pkgs.haskell.packages.ghcjs.callCabal2nix "app" ./. {}

so it doesn't look like a lot could be going wrong on the miso side (unless it uses some cabal features cabal2nix doesn't support?).

ishamf commented 1 month ago

I got something similar, not entirely sure if it's the same issue or not.

Likely relevant part:

       … while evaluating a path segment
         at /nix/store/9r1vhvri4ba913g4vyg5jqrhg6pb9amn-source/pkgs/build-support/cc-wrapper/default.nix:151:12:
          150|     + (if nativeTools then ''
          151|       echo ${if targetPlatform.isDarwin then cc else nativePrefix} > $out/nix-support/orig-cc
             |            ^
          152|

       error: cannot coerce null to a string: null

Full trace: https://gist.github.com/ishamf/bd96b7a76cedb1a60bed0bcbe6ece449

It seems to point to this line.

I'm using an M1 Mac. So I assume that isDarwin is true. So it seems cc is null?

At the top of the file I see a few assertions

assert nativeTools -> !propagateDoc && nativePrefix != "";
assert !nativeTools -> cc != null && coreutils != null && gnugrep != null;

This seems to imply that cc should be used only if nativeTools is false. But the problem line uses it in this case.

So it seems either the assertion or the code is wrong. Or there is a missing assertion regarding to isDarwin, and the values of cc and nativeTools need to be updated for Mac somewhere.

Unfortunately I'm not very familiar with Nix, so I can't check it further.