miso icon indicating copy to clipboard operation
miso copied to clipboard

nix-build of the sample app throws error: cannot coerce null to a string

Open DavSanchez opened this issue 2 years ago • 2 comments

Hi guys, I don't know much about nix, but this seems like it needs to be fixed from this side.

Describe the bug There is not much else to add. I attach the traces below.

To Reproduce Steps to reproduce the behavior: Just follow the Quick start

$ 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
error: cannot coerce null to a string

       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|
(use '--show-trace' to show detailed location information)

Expected behavior The sample application should build and run without issues.

Desktop (please complete the following information):

  • OS: macOS 12.3.1 (M1)

Additional context

$ nix-build --show-trace
error: cannot coerce null to a string

       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|

       … while evaluating the attribute 'installPhase' of the derivation 'cc-native'

       at /nix/store/9r1vhvri4ba913g4vyg5jqrhg6pb9amn-source/pkgs/build-support/cc-wrapper/default.nix:96:3:

           95| stdenv.mkDerivation {
           96|   name = targetPrefix
             |   ^
           97|     + (if name != "" then name else stdenv.lib.removePrefix targetPrefix "${ccName}-wrapper")

       … while evaluating the attribute 'disallowedReferences' of the derivation 'perl-5.28.2'

       at /nix/store/9r1vhvri4ba913g4vyg5jqrhg6pb9amn-source/pkgs/development/interpreters/perl/default.nix:29:5:

           28|
           29|     name = "perl-${version}";
             |     ^
           30|

       … while evaluating the attribute 'nativeBuildInputs' of the derivation 'openssl-1.0.2r'

       at /nix/store/9r1vhvri4ba913g4vyg5jqrhg6pb9amn-source/pkgs/development/libraries/openssl/default.nix:11:5:

           10|   common = args@{ version, sha256, patches ? [], withDocs ? false }: stdenv.mkDerivation rec {
           11|     name = "openssl-${version}";
             |     ^
           12|

       … while evaluating the attribute 'configureFlags' of the derivation 'curl-7.64.1'

       at /nix/store/9r1vhvri4ba913g4vyg5jqrhg6pb9amn-source/pkgs/tools/networking/curl/default.nix:27:3:

           26| stdenv.mkDerivation rec {
           27|   name = "curl-7.64.1";
             |   ^
           28|

       … while evaluating the attribute 'buildInputs' of the derivation 'nix-2.2.2'

       at /nix/store/9r1vhvri4ba913g4vyg5jqrhg6pb9amn-source/pkgs/tools/package-management/nix/default.nix:28:14:

           27|      nix = stdenv.mkDerivation rec {
           28|       inherit name src;
             |              ^
           29|       version = lib.getVersion name;

       … while evaluating 'optionalAttrs'

       at /nix/store/9r1vhvri4ba913g4vyg5jqrhg6pb9amn-source/lib/attrsets.nix:331:25:

          330|   */
          331|   optionalAttrs = cond: as: if cond then as else {};
             |                         ^
          332|

       … from call site

       at /nix/store/9r1vhvri4ba913g4vyg5jqrhg6pb9amn-source/pkgs/development/haskell-modules/generic-builder.nix:511:4:

          510| // optionalAttrs (installPhase != "")   { inherit installPhase; }
          511| // optionalAttrs (postInstall != "")    { inherit postInstall; }
             |    ^
          512| // optionalAttrs (preFixup != "")       { inherit preFixup; }

       … while evaluating anonymous lambda

       at /nix/store/9r1vhvri4ba913g4vyg5jqrhg6pb9amn-source/pkgs/development/haskell-modules/generic-builder.nix:240:20:

          239|   '';
          240| in stdenv.lib.fix (drv:
             |                    ^
          241|

       … from call site

       at /nix/store/9r1vhvri4ba913g4vyg5jqrhg6pb9amn-source/lib/fixed-points.nix:19:20:

           18|   # details.
           19|   fix = f: let x = f x; in x;
             |                    ^
           20|

       … while evaluating 'fix'

       at /nix/store/9r1vhvri4ba913g4vyg5jqrhg6pb9amn-source/lib/fixed-points.nix:19:9:

           18|   # details.
           19|   fix = f: let x = f x; in x;
             |         ^
           20|

       … from call site

       at /nix/store/9r1vhvri4ba913g4vyg5jqrhg6pb9amn-source/pkgs/development/haskell-modules/generic-builder.nix:240:4:

          239|   '';
          240| in stdenv.lib.fix (drv:
             |    ^
          241|

       … while evaluating anonymous lambda

       at /nix/store/9r1vhvri4ba913g4vyg5jqrhg6pb9amn-source/pkgs/development/haskell-modules/generic-builder.nix:12:1:

           11|
           12| { pname
             | ^
           13| , dontStrip ? (ghc.isGhcjs or false)

       … from call site

       at /nix/store/9r1vhvri4ba913g4vyg5jqrhg6pb9amn-source/lib/customisation.nix:69:12:

           68|     let
           69|       ff = f origArgs;
             |            ^
           70|       overrideWith = newArgs: origArgs // (if lib.isFunction newArgs then newArgs origArgs else newArgs);

       … while evaluating 'makeOverridable'

       at /nix/store/9r1vhvri4ba913g4vyg5jqrhg6pb9amn-source/lib/customisation.nix:67:24:

           66|   */
           67|   makeOverridable = f: origArgs:
             |                        ^
           68|     let

       … from call site

       at /nix/store/9r1vhvri4ba913g4vyg5jqrhg6pb9amn-source/lib/customisation.nix:73:29:

           72|       if builtins.isAttrs ff then (ff // {
           73|         override = newArgs: makeOverridable f (overrideWith newArgs);
             |                             ^
           74|         overrideDerivation = fdrv:

       … while evaluating 'override'

       at /nix/store/9r1vhvri4ba913g4vyg5jqrhg6pb9amn-source/lib/customisation.nix:73:20:

           72|       if builtins.isAttrs ff then (ff // {
           73|         override = newArgs: makeOverridable f (overrideWith newArgs);
             |                    ^
           74|         overrideDerivation = fdrv:

       … from call site

       at /nix/store/9r1vhvri4ba913g4vyg5jqrhg6pb9amn-source/pkgs/development/haskell-modules/lib.nix:38:25:

           37|   overrideCabal = drv: f: (drv.override (args: args // {
           38|     mkDerivation = drv: (args.mkDerivation drv).override f;
             |                         ^
           39|   })) // {

       … while evaluating 'mkDerivation'

       at /nix/store/9r1vhvri4ba913g4vyg5jqrhg6pb9amn-source/pkgs/development/haskell-modules/lib.nix:38:20:

           37|   overrideCabal = drv: f: (drv.override (args: args // {
           38|     mkDerivation = drv: (args.mkDerivation drv).override f;
             |                    ^
           39|   })) // {

       … from call site

       at /nix/store/9r1vhvri4ba913g4vyg5jqrhg6pb9amn-source/pkgs/development/haskell-modules/hackage-packages.nix:45165:6:

        45164|      }:
        45165|      mkDerivation {
             |      ^
        45166|        pname = "cabal2nix";

       … while evaluating anonymous lambda

       at /nix/store/9r1vhvri4ba913g4vyg5jqrhg6pb9amn-source/pkgs/development/haskell-modules/hackage-packages.nix:45159:6:

        45158|   "cabal2nix" = callPackage
        45159|     ({ mkDerivation, aeson, ansi-wl-pprint, base, bytestring, Cabal
             |      ^
        45160|      , containers, deepseq, directory, distribution-nixpkgs, filepath

       … from call site

       at /nix/store/9r1vhvri4ba913g4vyg5jqrhg6pb9amn-source/pkgs/development/haskell-modules/make-package-set.nix:87:27:

           86|       # this wraps the `drv` function to add a `overrideScope` function to the result.
           87|       drvScope = allArgs: drv allArgs // {
             |                           ^
           88|         overrideScope = f:

       … while evaluating 'drvScope'

       at /nix/store/9r1vhvri4ba913g4vyg5jqrhg6pb9amn-source/pkgs/development/haskell-modules/make-package-set.nix:87:18:

           86|       # this wraps the `drv` function to add a `overrideScope` function to the result.
           87|       drvScope = allArgs: drv allArgs // {
             |                  ^
           88|         overrideScope = f:

       … from call site

       at /nix/store/9r1vhvri4ba913g4vyg5jqrhg6pb9amn-source/lib/customisation.nix:69:12:

           68|     let
           69|       ff = f origArgs;
             |            ^
           70|       overrideWith = newArgs: origArgs // (if lib.isFunction newArgs then newArgs origArgs else newArgs);

       … while evaluating 'makeOverridable'

       at /nix/store/9r1vhvri4ba913g4vyg5jqrhg6pb9amn-source/lib/customisation.nix:67:24:

           66|   */
           67|   makeOverridable = f: origArgs:
             |                        ^
           68|     let

       … from call site

       at /nix/store/9r1vhvri4ba913g4vyg5jqrhg6pb9amn-source/lib/customisation.nix:73:29:

           72|       if builtins.isAttrs ff then (ff // {
           73|         override = newArgs: makeOverridable f (overrideWith newArgs);
             |                             ^
           74|         overrideDerivation = fdrv:

       … while evaluating 'override'

       at /nix/store/9r1vhvri4ba913g4vyg5jqrhg6pb9amn-source/lib/customisation.nix:73:20:

           72|       if builtins.isAttrs ff then (ff // {
           73|         override = newArgs: makeOverridable f (overrideWith newArgs);
             |                    ^
           74|         overrideDerivation = fdrv:

       … from call site

       at /nix/store/9r1vhvri4ba913g4vyg5jqrhg6pb9amn-source/pkgs/development/haskell-modules/lib.nix:37:28:

           36|    */
           37|   overrideCabal = drv: f: (drv.override (args: args // {
             |                            ^
           38|     mkDerivation = drv: (args.mkDerivation drv).override f;

       … while evaluating 'overrideCabal'

       at /nix/store/9r1vhvri4ba913g4vyg5jqrhg6pb9amn-source/pkgs/development/haskell-modules/lib.nix:37:24:

           36|    */
           37|   overrideCabal = drv: f: (drv.override (args: args // {
             |                        ^
           38|     mkDerivation = drv: (args.mkDerivation drv).override f;

       … from call site

       at /nix/store/9r1vhvri4ba913g4vyg5jqrhg6pb9amn-source/pkgs/top-level/all-packages.nix:1171:15:

         1170|
         1171|   cabal2nix = haskell.lib.overrideCabal (haskell.lib.generateOptparseApplicativeCompletion "cabal2nix" haskellPackages.cabal2nix) (drv: {
             |               ^
         1172|     isLibrary = false;

       … while evaluating the attribute 'buildPackages.cabal2nix'

       at /nix/store/9r1vhvri4ba913g4vyg5jqrhg6pb9amn-source/pkgs/top-level/all-packages.nix:1171:3:

         1170|
         1171|   cabal2nix = haskell.lib.overrideCabal (haskell.lib.generateOptparseApplicativeCompletion "cabal2nix" haskellPackages.cabal2nix) (drv: {
             |   ^
         1172|     isLibrary = false;

       … while evaluating anonymous lambda

       at /nix/store/9r1vhvri4ba913g4vyg5jqrhg6pb9amn-source/pkgs/stdenv/generic/make-derivation.nix:134:17:

          133|           (map (drv: drv.__spliced.buildBuild or drv) depsBuildBuild)
          134|           (map (drv: drv.nativeDrv or drv) nativeBuildInputs
             |                 ^
          135|              ++ lib.optional separateDebugInfo' ../../build-support/setup-hooks/separate-debug-info.sh

       … from call site

       … while evaluating 'getOutput'

       at /nix/store/9r1vhvri4ba913g4vyg5jqrhg6pb9amn-source/lib/attrsets.nix:464:23:

          463|   */
          464|   getOutput = output: pkg:
             |                       ^
          465|     if pkg.outputUnspecified or false

       … from call site

       … while evaluating the attribute 'nativeBuildInputs' of the derivation 'cabal2nix-app'

       at /nix/store/9r1vhvri4ba913g4vyg5jqrhg6pb9amn-source/pkgs/development/haskell-modules/make-package-set.nix:126:7:

          125|     in pkgs.buildPackages.stdenv.mkDerivation {
          126|       name = "cabal2nix-${name}";
             |       ^
          127|       nativeBuildInputs = [ pkgs.buildPackages.cabal2nix ];

       … while realising the context of a path

       at /nix/store/9r1vhvri4ba913g4vyg5jqrhg6pb9amn-source/pkgs/development/haskell-modules/make-package-set.nix:83:54:

           82|       # info that callPackage uses to determine the arguments).
           83|       drv = if stdenv.lib.isFunction fn then fn else import fn;
             |                                                      ^
           84|       auto = builtins.intersectAttrs (stdenv.lib.functionArgs drv) scope;

       … while evaluating 'drvScope'

       at /nix/store/9r1vhvri4ba913g4vyg5jqrhg6pb9amn-source/pkgs/development/haskell-modules/make-package-set.nix:87:18:

           86|       # this wraps the `drv` function to add a `overrideScope` function to the result.
           87|       drvScope = allArgs: drv allArgs // {
             |                  ^
           88|         overrideScope = f:

       … from call site

       at /nix/store/9r1vhvri4ba913g4vyg5jqrhg6pb9amn-source/lib/customisation.nix:69:12:

           68|     let
           69|       ff = f origArgs;
             |            ^
           70|       overrideWith = newArgs: origArgs // (if lib.isFunction newArgs then newArgs origArgs else newArgs);

       … while evaluating 'makeOverridable'

       at /nix/store/9r1vhvri4ba913g4vyg5jqrhg6pb9amn-source/lib/customisation.nix:67:24:

           66|   */
           67|   makeOverridable = f: origArgs:
             |                        ^
           68|     let

       … from call site

       at /nix/store/9r1vhvri4ba913g4vyg5jqrhg6pb9amn-source/pkgs/development/haskell-modules/make-package-set.nix:97:8:

           96|       };
           97|     in stdenv.lib.makeOverridable drvScope (auto // manualArgs);
             |        ^
           98|

       … while evaluating 'callPackageWithScope'

       at /nix/store/9r1vhvri4ba913g4vyg5jqrhg6pb9amn-source/pkgs/development/haskell-modules/make-package-set.nix:74:37:

           73|   # here `bar` is a manual argument.
           74|   callPackageWithScope = scope: fn: manualArgs:
             |                                     ^
           75|     let

       … from call site

       at /nix/store/9r1vhvri4ba913g4vyg5jqrhg6pb9amn-source/pkgs/development/haskell-modules/make-package-set.nix:114:28:

          113|   defaultScope = mkScope self;
          114|   callPackage = drv: args: callPackageWithScope defaultScope drv args;
             |                            ^
          115|

       … while evaluating 'callPackage'

       at /nix/store/9r1vhvri4ba913g4vyg5jqrhg6pb9amn-source/pkgs/development/haskell-modules/make-package-set.nix:114:22:

          113|   defaultScope = mkScope self;
          114|   callPackage = drv: args: callPackageWithScope defaultScope drv args;
             |                      ^
          115|

       … from call site

       at /nix/store/9r1vhvri4ba913g4vyg5jqrhg6pb9amn-source/pkgs/development/haskell-modules/make-package-set.nix:158:20:

          157|   callPackageKeepDeriver = src: args:
          158|     overrideCabal (self.callPackage src args) (orig: {
             |                    ^
          159|       preConfigure = ''

       … while evaluating 'overrideCabal'

       at /nix/store/9r1vhvri4ba913g4vyg5jqrhg6pb9amn-source/pkgs/development/haskell-modules/lib.nix:37:24:

           36|    */
           37|   overrideCabal = drv: f: (drv.override (args: args // {
             |                        ^
           38|     mkDerivation = drv: (args.mkDerivation drv).override f;

       … from call site

       at /nix/store/9r1vhvri4ba913g4vyg5jqrhg6pb9amn-source/pkgs/development/haskell-modules/make-package-set.nix:158:5:

          157|   callPackageKeepDeriver = src: args:
          158|     overrideCabal (self.callPackage src args) (orig: {
             |     ^
          159|       preConfigure = ''

       … while evaluating 'callPackageKeepDeriver'

       at /nix/store/9r1vhvri4ba913g4vyg5jqrhg6pb9amn-source/pkgs/development/haskell-modules/make-package-set.nix:157:33:

          156|   # annoyance.
          157|   callPackageKeepDeriver = src: args:
             |                                 ^
          158|     overrideCabal (self.callPackage src args) (orig: {

       … from call site

       at /nix/store/9r1vhvri4ba913g4vyg5jqrhg6pb9amn-source/pkgs/development/haskell-modules/make-package-set.nix:209:25:

          208|         };
          209|       in overrideCabal (callPackageKeepDeriver expr args) (orig: {
             |                         ^
          210|            inherit src;

       … while evaluating 'overrideCabal'

       at /nix/store/9r1vhvri4ba913g4vyg5jqrhg6pb9amn-source/pkgs/development/haskell-modules/lib.nix:37:24:

           36|    */
           37|   overrideCabal = drv: f: (drv.override (args: args // {
             |                        ^
           38|     mkDerivation = drv: (args.mkDerivation drv).override f;

       … from call site

       at /nix/store/9r1vhvri4ba913g4vyg5jqrhg6pb9amn-source/pkgs/development/haskell-modules/make-package-set.nix:209:10:

          208|         };
          209|       in overrideCabal (callPackageKeepDeriver expr args) (orig: {
             |          ^
          210|            inherit src;

       … while evaluating 'callCabal2nixWithOptions'

       at /nix/store/9r1vhvri4ba913g4vyg5jqrhg6pb9amn-source/pkgs/development/haskell-modules/make-package-set.nix:198:66:

          197|     # Creates a Haskell package from a source package by calling cabal2nix on the source.
          198|     callCabal2nixWithOptions = name: src: extraCabal2nixOptions: args:
             |                                                                  ^
          199|       let

       … from call site

       at /nix/store/9r1vhvri4ba913g4vyg5jqrhg6pb9amn-source/pkgs/development/haskell-modules/make-package-set.nix:213:38:

          212|
          213|     callCabal2nix = name: src: args: self.callCabal2nixWithOptions name src "" args;
             |                                      ^
          214|

       … while evaluating 'callCabal2nix'

       at /nix/store/9r1vhvri4ba913g4vyg5jqrhg6pb9amn-source/pkgs/development/haskell-modules/make-package-set.nix:213:32:

          212|
          213|     callCabal2nix = name: src: args: self.callCabal2nixWithOptions name src "" args;
             |                                ^
          214|

       … from call site

       at /Users/david/Developer/miso/sample-app/default.nix:4:1:

            3| }) {});
            4| pkgs.haskell.packages.ghcjs.callCabal2nix "app" ./. {}
             | ^

DavSanchez avatar May 01 '22 21:05 DavSanchez

Looks like this cc-wrapper is causing this, I have checked the nixpkgs repo and it seems the problematic check is still there, but not sure how to solve it yet...

DavSanchez avatar May 03 '22 21:05 DavSanchez

Seems like an M1 specific error. I’d triage the nixpkgs issue tracker.

dmjio avatar May 04 '22 00:05 dmjio

+1

herson avatar Nov 13 '22 10:11 herson