Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flake-compat is not compatible with Nix Flakes #64

Open
9999years opened this issue Mar 9, 2024 · 0 comments · May be fixed by #65
Open

flake-compat is not compatible with Nix Flakes #64

9999years opened this issue Mar 9, 2024 · 0 comments · May be fixed by #65

Comments

@9999years
Copy link

Since 0f9255e, default.nix has used builtins.storePath, which is not available in pure evaluation mode (e.g. when used in a Flake).

This makes it challenging to use flake-compat to incrementally migrate to Nix flakes.

Stack trace
       … while evaluating the file '/nix/store/g10gzvphg32jxpga3rkqymyzhj1fvx33-source/default.nix':

       … while evaluating the attribute 'defaultNix'
         at /nix/store/8kpx53qi52yhjai1vdw8zpa95iqa61bv-source/default.nix:229:5:
          228|   rec {
          229|     defaultNix =
             |     ^
          230|       (builtins.removeAttrs result ["__functor"])

       … in the left operand of the update (//) operator
         at /nix/store/8kpx53qi52yhjai1vdw8zpa95iqa61bv-source/default.nix:231:7:
          230|       (builtins.removeAttrs result ["__functor"])
          231|       // (if result ? defaultPackage.${system} then { default = result.defaultPackage.${system}; } else {})
             |       ^
          232|       // (if result ? packages.${system}.default then { default = result.packages.${system}.default; } else {});

       … while calling the 'removeAttrs' builtin
         at /nix/store/8kpx53qi52yhjai1vdw8zpa95iqa61bv-source/default.nix:230:8:
          229|     defaultNix =
          230|       (builtins.removeAttrs result ["__functor"])
             |        ^
          231|       // (if result ? defaultPackage.${system} then { default = result.defaultPackage.${system}; } else {})

       … from call site
         at /nix/store/8kpx53qi52yhjai1vdw8zpa95iqa61bv-source/default.nix:224:10:
          223|     else if lockFile.version >= 5 && lockFile.version <= 7
          224|     then allNodes.${lockFile.root}
             |          ^
          225|     else throw "lock file '${lockFilePath}' has unsupported version ${toString lockFile.version}";

       … while calling anonymous lambda
         at /nix/store/8kpx53qi52yhjai1vdw8zpa95iqa61bv-source/default.nix:156:13:
          155|     builtins.mapAttrs
          156|       (key: node:
             |             ^
          157|         let

       … in the condition of the assert statement
         at /nix/store/8kpx53qi52yhjai1vdw8zpa95iqa61bv-source/default.nix:211:13:
          210|           if node.flake or true then
          211|             assert builtins.isFunction flake.outputs;
             |             ^
          212|             result

       … while calling the 'isFunction' builtin
         at /nix/store/8kpx53qi52yhjai1vdw8zpa95iqa61bv-source/default.nix:211:20:
          210|           if node.flake or true then
          211|             assert builtins.isFunction flake.outputs;
             |                    ^
          212|             result

       … while calling the 'import' builtin
         at /nix/store/8kpx53qi52yhjai1vdw8zpa95iqa61bv-source/default.nix:167:19:
          166|
          167|           flake = import (outPath + "/flake.nix");
             |                   ^
          168|

       … while realising the context of a path

       … while calling the 'storePath' builtin
         at /nix/store/8kpx53qi52yhjai1vdw8zpa95iqa61bv-source/default.nix:115:15:
          114|               # If it's already a store path, don't copy it again.
          115|               builtins.storePath src
             |               ^
          116|             else

       error: 'builtins.storePath' is not allowed in pure evaluation mode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant