Stream: haskell-flake

Topic: Failed to parse `cabal.project`


view this post on Zulip Neeraj (Feb 20 2024 at 10:03):

Failed to parse /nix/store/hk9ikz0hwh3swvqmcwmgcr5dxw1f736p-source/cabal.project: {"type":"error","value":{"context":"parsec.string","msg":"expected string 'packages:'","offset":0,"str":"-- Generated by stackage-to-hackage
with-compiler: ghc-8.10.7 .......
Sample cabal.project

-- Generated by stackage-to-hackage

with-compiler: ghc-8.10.7

packages:
    ./

source-repository-package
    type: git
    location: https://github.com/aravindgopall/hsaml2.git
    tag: d4ecf51a0bf3733eb1ff8724a691b0200b3355ee

allow-older: *
allow-newer: *

view this post on Zulip Srid (Feb 20 2024 at 12:00):

@Neeraj The cabal.project parser is pretty limited.

Move packages: to the first line, and see if that works.

view this post on Zulip Srid (Feb 20 2024 at 12:01):

And it will only recognizes packages, not others. You have to specify them in Nix.

view this post on Zulip Srid (Feb 20 2024 at 12:03):

The first two lines should look like:

❯ head -n 2 cabal.project
packages:
    ./

view this post on Zulip Srid (Feb 20 2024 at 12:04):

Srid said:

And it will only recognizes packages, not others. You have to specify them in Nix.

For eg., source-repository-package should be specified as flake inputs and used as a dependency override. See https://community.flake.parts/haskell-flake/dependency#path

view this post on Zulip Srid (Feb 21 2024 at 12:44):

(Oops, I realized I linked to haskell-flake docs but of course you'd use the same callCabal2nix function to specify these source-repository-package using flake inputs)

view this post on Zulip Neeraj (Feb 22 2024 at 08:26):

How to exclude cabal.project so that nix will not parse it?

view this post on Zulip Neeraj (Feb 22 2024 at 08:46):

got it. Using nix-filter solved it


Last updated: Sep 16 2024 at 20:16 UTC