Skip to content

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

Closed
@nkarl

Description

@nkarl

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions