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

Attribute resourceRepo missing when evaluating call-cabal-project-to-nix.nix #2252

Open
nkarl opened this issue Sep 20, 2024 · 3 comments · May be fixed by #2254
Open

Attribute resourceRepo missing when evaluating call-cabal-project-to-nix.nix #2252

nkarl opened this issue Sep 20, 2024 · 3 comments · May be fixed by #2254
Labels
bug Something isn't working

Comments

@nkarl
Copy link

nkarl commented Sep 20, 2024

Describe the bug

I am attempting to produce a Nix flake of the Plutus Pioneer Program so that I could use nix develop instead of Docker (I got some network problem which caused the Docker image to fail at a cloning step repeatedly).

I followed this guide to integrate with the existing cabal.project file and eliminated the sha256 reference problem with the dependencies.

However, the next problem is that Nix failed to evaluate call-cabal-project-to-nix because the attribute sourceRepo is missing from x, which I assume is the variable for the source object.

This is a deeply nested function call, so it isn't immediately clear to me how to I can pass the correct attribute to it. Furthermore, the fetching functions seem to be dependent on the remote resources, which appears to be missing the mentioned attribute.

$ nix develop --show-trace
warning: Git tree '/path/to/ppp' is dirty
error:
$ nix develop                                                           
warning: Git tree '/path/to/ppp' is dirty
error:
       … while calling the 'head' builtin
         at /nix/store/g2ysyzdx76m4z7lnmyddcwdz25lx7kn1-source/lib/attrsets.nix:1575:11:
         1574|         || pred here (elemAt values 1) (head values) then
         1575|           head values
             |           ^
         1576|         elsein the left operand of the update (//) operator
         at /nix/store/mv77dn0m12d9s74bkrzfl4x5q5im09f2-source/src/core/mkHaskellProject.nix:175:35:
          174|
          175|       packages = project.packages // extra-packages;
             |                                   ^
          176|

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

       error: attribute 'sourceRepo' missing
       at /nix/store/b0mfwir5lq04p8cpcrajidknn3gh4bbq-source/lib/call-cabal-project-to-nix.nix:261:82:
          260|       #   as built by a darwin builder, and fetch it from a cache
          261|       sourceReposEval = builtins.map (x: (fetchPackageRepo evalPackages.fetchgit x.sourceRepo)) sourceRepoPackageResult.sourceRepos;
             |                                                                                  ^
          262|       sourceReposBuild = builtins.map (x: (fetchPackageRepo pkgs.fetchgit x.sourceRepo).fetched) sourceRepoPackageResult.sourceRepos;

System information:

  • x86_64-linux
  • GHC 8.10.7 (template default)
  • Haskell.nix version (template default)

Steps To Reproduce

  1. clone the PPP repo:
git clone --depth 1 http://github.com/nkarl/plutus-pioneer-program.git
  1. Init flake
cd code && nix flake init --template github:input-output-hk/iogx#haskell --impure
  1. Set the SHA256 hashes for dependencies in cabal.project.
source-repository-package
    --sha256: 0i40hp1mdbljjcj4pn3n6zahblkb2jmpm8l4wnb36bya1pzf66fx

-- Direct dependency.
source-repository-package
    --sha256: 10pb0yfp80jhb9ryn65a4rha2lxzsn2vlhcc6xphrrkf4x5lhzqc

-- Direct dependency.
source-repository-package
    --sha256: 0da1vn2l6iyfxcjk58qal1l4755v92zi6yppmjmqvxf1gacyf9px

-- Direct dependency.
source-repository-package
    --sha256: 1b9ppgavqad78a2z1zxv7v4jasjz6zz0mxkr0zx0bbcd0i00jajf

-- Should follow cardano-wallet.
source-repository-package
    --sha256: 129r5kyiw10n2021bkdvnr270aiiwyq58h472d151ph0r7wpslgp

-- This is needed because we rely on an unreleased feature
-- https://github.com/input-output-hk/cardano-ledger/pull/3111
source-repository-package
    --sha256: 1jg1h05gcms119mw7fz798xpj3hr5h426ga934vixmgf88m1jmfx

Additional Context

I am still new to Nix so I am not sure how to resolve this problem.

@nkarl nkarl added the bug Something isn't working label Sep 20, 2024
@Reedme-21
Copy link

Contact the Support page to resolve your request.
Note: You can also initiate a chat with the live agent on the chat button to get more information about your request via Live Chat
@nkarl

@hamishmack
Copy link
Collaborator

It looks like there is a bug in the haskell.nix cabal.project parser. It does handle trailing whitespace correctly.

Workaround is to delete the trailing white space from the cabal.project file. The problem line is the last type: git in the file.

@nkarl
Copy link
Author

nkarl commented Sep 24, 2024

Thanks for the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants