dream2nix icon indicating copy to clipboard operation
dream2nix copied to clipboard

error: cannot coerce null to a string

Open yajo opened this issue 2 years ago • 3 comments

I was trying to use dream2nix in Copier, but it failed.

Steps:

  1. Clone https://github.com/copier-org/copier/commit/ba8d2452cd310c3efc48f3213ab9ef8d1a6f6b51
  2. Apply fail.patch
  3. Run nix develop --show-trace

Result:

error: cannot coerce null to a string

       at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/strings.nix:257:48:

          256|   hasInfix = infix: content:
          257|     builtins.match ".*${escapeRegex infix}.*" "${content}" != null;
             |                                                ^
          258|

       … while evaluating 'hasInfix'

       at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/strings.nix:256:21:

          255|   */
          256|   hasInfix = infix: content:
             |                     ^
          257|     builtins.match ".*${escapeRegex infix}.*" "${content}" != null;

       … from call site

       at /nix/store/sp2zn7gb4rrxlwg2hyghrid88slyf5xx-source/src/subsystems/python/translators/poetry/default.nix:35:17:

           34|     fakeStdenv = {
           35|       isLinux = l.hasInfix "-linux" system;
             |                 ^
           36|       isDarwin = l.hasInfix "-darwin" system;

       … while evaluating the attribute 'isLinux'

       at /nix/store/sp2zn7gb4rrxlwg2hyghrid88slyf5xx-source/src/subsystems/python/translators/poetry/default.nix:35:7:

           34|     fakeStdenv = {
           35|       isLinux = l.hasInfix "-linux" system;
             |       ^
           36|       isDarwin = l.hasInfix "-darwin" system;

       … while evaluating 'withPlatforms'

       at /nix/store/a826l87xg0230ispkyv0rbia8hxxhsa7-source/pep425.nix:100:23:

           99|           else (p: p == "any");
          100|       withPlatforms = x: lib.lists.any withPlatform (splitString "." x.platform);
             |                       ^
          101|       filterWheel = x:

       … from call site

       at /nix/store/a826l87xg0230ispkyv0rbia8hxxhsa7-source/pep425.nix:105:45:

          104|         in
          105|         (withPython pythonVer abiTag f) && (withPlatforms f);
             |                                             ^
          106|       filtered = builtins.filter filterWheel filesWithoutSources;

       … while evaluating 'filterWheel'

       at /nix/store/a826l87xg0230ispkyv0rbia8hxxhsa7-source/pep425.nix:101:21:

          100|       withPlatforms = x: lib.lists.any withPlatform (splitString "." x.platform);
          101|       filterWheel = x:
             |                     ^
          102|         let

       … from call site

       … while evaluating 'selectWheel'

       at /nix/store/a826l87xg0230ispkyv0rbia8hxxhsa7-source/pep425.nix:72:17:

           71|   #
           72|   selectWheel = files:
             |                 ^
           73|     let

       … from call site

       at /nix/store/sp2zn7gb4rrxlwg2hyghrid88slyf5xx-source/src/subsystems/python/translators/poetry/default.nix:64:16:

           63|     computeSource = sourceName: files: let
           64|       wheels = pep425.selectWheel files;
             |                ^
           65|       sdists = builtins.filter (x: !(lib.hasSuffix ".whl" x.file)) files;

       … while evaluating 'hasSuffix'

       at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/strings.nix:235:5:

          234|     # Input string
          235|     content:
             |     ^
          236|     let

       … from call site

       at /nix/store/sp2zn7gb4rrxlwg2hyghrid88slyf5xx-source/src/subsystems/python/translators/poetry/default.nix:70:17:

           69|         else builtins.head sdists;
           70|       isWheel = l.hasSuffix "whl" candidate.file;
             |                 ^
           71|       suffix =

       … while evaluating 'computeSource'

       at /nix/store/sp2zn7gb4rrxlwg2hyghrid88slyf5xx-source/src/subsystems/python/translators/poetry/default.nix:63:33:

           62|
           63|     computeSource = sourceName: files: let
             |                                 ^
           64|       wheels = pep425.selectWheel files;

       … from call site

       at /nix/store/sp2zn7gb4rrxlwg2hyghrid88slyf5xx-source/src/subsystems/python/translators/poetry/default.nix:136:16:

          135|               package.name
          136|               (computeSource package.name package.files))
             |                ^
          137|             poetryLock.package

       … while evaluating anonymous lambda

       at /nix/store/sp2zn7gb4rrxlwg2hyghrid88slyf5xx-source/src/modules/utils.dream-lock/implementation.nix:249:14:

          248|       l.mapAttrs
          249|       (name: versions:
             |              ^
          250|         l.mapAttrs

       … from call site

       … while evaluating anonymous lambda

       at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/attrsets.nix:547:54:

          546|      */
          547|   recursiveUpdate = recursiveUpdateUntil (path: lhs: rhs: !(isAttrs lhs && isAttrs rhs));
             |                                                      ^
          548|

       … from call site

       at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/attrsets.nix:521:12:

          520|         if length values == 1
          521|         || pred here (elemAt values 1) (head values) then
             |            ^
          522|           head values

       … while evaluating anonymous lambda

       at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/attrsets.nix:518:24:

          517|     let f = attrPath:
          518|       zipAttrsWith (n: values:
             |                        ^
          519|         let here = attrPath ++ [n]; in

       … from call site

       … while evaluating 'flatten'

       at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/lists.nix:138:13:

          137|   */
          138|   flatten = x:
             |             ^
          139|     if isList x

       … from call site

       at /nix/store/sp2zn7gb4rrxlwg2hyghrid88slyf5xx-source/src/modules/utils.dream-lock/implementation.nix:97:15:

           96|             (name: versions:
           97|               l.flatten (l.attrValues versions))
             |               ^
           98|             dependencyGraph));

       … while evaluating anonymous lambda

       at /nix/store/sp2zn7gb4rrxlwg2hyghrid88slyf5xx-source/src/modules/utils.dream-lock/implementation.nix:96:20:

           95|           (l.mapAttrsToList
           96|             (name: versions:
             |                    ^
           97|               l.flatten (l.attrValues versions))

       … from call site

       at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/attrsets.nix:356:16:

          355|   mapAttrsToList = f: attrs:
          356|     map (name: f name attrs.${name}) (attrNames attrs);
             |                ^
          357|

       … while evaluating anonymous lambda

       at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/attrsets.nix:356:10:

          355|   mapAttrsToList = f: attrs:
          356|     map (name: f name attrs.${name}) (attrNames attrs);
             |          ^
          357|

       … from call site

       … while evaluating 'flatten'

       at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/lists.nix:138:13:

          137|   */
          138|   flatten = x:
             |             ^
          139|     if isList x

       … from call site

       at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/lists.nix:140:24:

          139|     if isList x
          140|     then concatMap (y: flatten y) x
             |                        ^
          141|     else [x];

       … while evaluating anonymous lambda

       at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/lists.nix:140:21:

          139|     if isList x
          140|     then concatMap (y: flatten y) x
             |                     ^
          141|     else [x];

       … from call site

       at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/lists.nix:140:10:

          139|     if isList x
          140|     then concatMap (y: flatten y) x
             |          ^
          141|     else [x];

       … while evaluating 'flatten'

       at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/lists.nix:138:13:

          137|   */
          138|   flatten = x:
             |             ^
          139|     if isList x

       … from call site

       at /nix/store/sp2zn7gb4rrxlwg2hyghrid88slyf5xx-source/src/modules/utils.dream-lock/implementation.nix:94:10:

           93|         l.unique
           94|         (l.flatten
             |          ^
           95|           (l.mapAttrsToList

       … while invoking 'zipAttrsWith'

       at /nix/store/sp2zn7gb4rrxlwg2hyghrid88slyf5xx-source/src/modules/utils.dream-lock/implementation.nix:115:7:

          114|     packageVersions =
          115|       l.zipAttrsWith
             |       ^
          116|       (name: versions: l.unique (l.flatten versions))

       … while evaluating the attribute 'packageVersions'

       at /nix/store/sp2zn7gb4rrxlwg2hyghrid88slyf5xx-source/src/modules/utils.dream-lock/implementation.nix:152:14:

          151|     interface = {
          152|       inherit
             |              ^
          153|         defaultPackageName

       … while evaluating 'mapAttrsToList'

       at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/attrsets.nix:355:23:

          354|   */
          355|   mapAttrsToList = f: attrs:
             |                       ^
          356|     map (name: f name attrs.${name}) (attrNames attrs);

       … from call site

       at /nix/store/sp2zn7gb4rrxlwg2hyghrid88slyf5xx-source/src/subsystems/python/builders/simple-python/default.nix:28:8:

           27|       l.flatten
           28|       (l.mapAttrsToList
             |        ^
           29|         (name: versions:

       … while evaluating 'flatten'

       at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/lists.nix:138:13:

          137|   */
          138|   flatten = x:
             |             ^
          139|     if isList x

       … from call site

       at /nix/store/sp2zn7gb4rrxlwg2hyghrid88slyf5xx-source/src/subsystems/python/builders/simple-python/default.nix:27:7:

           26|     allDependencySources' =
           27|       l.flatten
             |       ^
           28|       (l.mapAttrsToList

       … while evaluating the attribute 'buildPhase' of the derivation 'python3.10-copier'

       at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/pkgs/stdenv/generic/make-derivation.nix:270:7:

          269|     // (lib.optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) {
          270|       name =
             |       ^
          271|         let

yajo avatar Feb 07 '23 20:02 yajo

I'm having the same issue while trying to follow this guide.

b3nj5m1n avatar Mar 04 '23 17:03 b3nj5m1n

I was able to get around this issue by adding: subsystemInfo.system = "x86_64-linux" (or whatever your system is) to my projects.toml file.

BrittonR avatar Mar 10 '23 23:03 BrittonR

That workaround is not good because I have more than 1 system to build for.

Applying it, I get a different error:

error:
       … while evaluating the attribute 'buildPhase' of the derivation 'python3.10-mrchef'

       at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/pkgs/stdenv/generic/make-derivation.nix:270:7:

          269|     // (lib.optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) {
          270|       name =
             |       ^
          271|         let

       … while evaluating call site

       at /nix/store/0d53cvh3si4sxsi61021xc74g84cpf0x-source/src/subsystems/python/builders/simple-python/default.nix:27:7:

           26|     allDependencySources' =
           27|       l.flatten
             |       ^
           28|       (l.mapAttrsToList

       … while calling 'flatten'

       at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/lists.nix:138:13:

          137|   */
          138|   flatten = x:
             |             ^
          139|     if isList x

       … while evaluating call site

       at /nix/store/0d53cvh3si4sxsi61021xc74g84cpf0x-source/src/subsystems/python/builders/simple-python/default.nix:28:8:

           27|       l.flatten
           28|       (l.mapAttrsToList
             |        ^
           29|         (name: versions:

       … while calling 'mapAttrsToList'

       at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/attrsets.nix:355:23:

          354|   */
          355|   mapAttrsToList = f: attrs:
             |                       ^
          356|     map (name: f name attrs.${name}) (attrNames attrs);

       … while evaluating the attribute 'packageVersions'

       at /nix/store/0d53cvh3si4sxsi61021xc74g84cpf0x-source/src/modules/utils.dream-lock/implementation.nix:152:14:

          151|     interface = {
          152|       inherit
             |              ^
          153|         defaultPackageName

       … while evaluating call site

       at /nix/store/0d53cvh3si4sxsi61021xc74g84cpf0x-source/src/modules/utils.dream-lock/implementation.nix:94:10:

           93|         l.unique
           94|         (l.flatten
             |          ^
           95|           (l.mapAttrsToList

       … while calling 'flatten'

       at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/lists.nix:138:13:

          137|   */
          138|   flatten = x:
             |             ^
          139|     if isList x

       … while evaluating call site

       at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/lists.nix:140:10:

          139|     if isList x
          140|     then concatMap (y: flatten y) x
             |          ^
          141|     else [x];

       … while calling anonymous lambda

       at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/lists.nix:140:21:

          139|     if isList x
          140|     then concatMap (y: flatten y) x
             |                     ^
          141|     else [x];

       … while evaluating call site

       at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/lists.nix:140:24:

          139|     if isList x
          140|     then concatMap (y: flatten y) x
             |                        ^
          141|     else [x];

       … while calling 'flatten'

       at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/lists.nix:138:13:

          137|   */
          138|   flatten = x:
             |             ^
          139|     if isList x

       … while evaluating call site

       at «none»:0: (source not available)

       … while calling anonymous lambda

       at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/attrsets.nix:356:10:

          355|   mapAttrsToList = f: attrs:
          356|     map (name: f name attrs.${name}) (attrNames attrs);
             |          ^
          357|

       … while evaluating call site

       at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/attrsets.nix:356:16:

          355|   mapAttrsToList = f: attrs:
          356|     map (name: f name attrs.${name}) (attrNames attrs);
             |                ^
          357|

       … while calling anonymous lambda

       at /nix/store/0d53cvh3si4sxsi61021xc74g84cpf0x-source/src/modules/utils.dream-lock/implementation.nix:96:20:

           95|           (l.mapAttrsToList
           96|             (name: versions:
             |                    ^
           97|               l.flatten (l.attrValues versions))

       … while evaluating call site

       at /nix/store/0d53cvh3si4sxsi61021xc74g84cpf0x-source/src/modules/utils.dream-lock/implementation.nix:97:15:

           96|             (name: versions:
           97|               l.flatten (l.attrValues versions))
             |               ^
           98|             dependencyGraph));

       … while calling 'flatten'

       at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/lists.nix:138:13:

          137|   */
          138|   flatten = x:
             |             ^
          139|     if isList x

       … while evaluating call site

       at «none»:0: (source not available)

       … while calling anonymous lambda

       at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/attrsets.nix:518:24:

          517|     let f = attrPath:
          518|       zipAttrsWith (n: values:
             |                        ^
          519|         let here = attrPath ++ [n]; in

       … while evaluating call site

       at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/attrsets.nix:521:12:

          520|         if length values == 1
          521|         || pred here (elemAt values 1) (head values) then
             |            ^
          522|           head values

       … while calling anonymous lambda

       at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/attrsets.nix:547:54:

          546|      */
          547|   recursiveUpdate = recursiveUpdateUntil (path: lhs: rhs: !(isAttrs lhs && isAttrs rhs));
             |                                                      ^
          548|

       … while evaluating call site

       at «none»:0: (source not available)

       … while calling anonymous lambda

       at /nix/store/0d53cvh3si4sxsi61021xc74g84cpf0x-source/src/modules/utils.dream-lock/implementation.nix:249:14:

          248|       l.mapAttrs
          249|       (name: versions:
             |              ^
          250|         l.mapAttrs

       … while evaluating call site

       at /nix/store/0d53cvh3si4sxsi61021xc74g84cpf0x-source/src/subsystems/python/translators/poetry/default.nix:136:16:

          135|               package.name
          136|               (computeSource package.name package.files))
             |                ^
          137|             poetryLock.package

       … while calling 'computeSource'

       at /nix/store/0d53cvh3si4sxsi61021xc74g84cpf0x-source/src/subsystems/python/translators/poetry/default.nix:63:33:

           62|
           63|     computeSource = sourceName: files: let
             |                                 ^
           64|       wheels = pep425.selectWheel files;

       … while evaluating call site

       at /nix/store/0d53cvh3si4sxsi61021xc74g84cpf0x-source/src/subsystems/python/translators/poetry/default.nix:70:17:

           69|         else builtins.head sdists;
           70|       isWheel = l.hasSuffix "whl" candidate.file;
             |                 ^
           71|       suffix =

       … while calling 'hasSuffix'

       at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/strings.nix:235:5:

          234|     # Input string
          235|     content:
             |     ^
          236|     let

       error: list index 0 is out of bounds

       at /nix/store/0d53cvh3si4sxsi61021xc74g84cpf0x-source/src/subsystems/python/translators/poetry/default.nix:69:14:

           68|         then builtins.head wheels
           69|         else builtins.head sdists;
             |              ^
           70|       isWheel = l.hasSuffix "whl" candidate.file;

yajo avatar Jul 10 '23 12:07 yajo