Skip to content

cabal2nix does not generate framework dependencies on macOS #470

Open
@harendra-kumar

Description

@harendra-kumar

The streamly cabal file has the following stanza:

library

    if os(darwin)
      frameworks:    Cocoa
      include-dirs:  src/Streamly/Internal
      c-sources:     src/Streamly/Internal/Data/Time/Darwin.c
                   , src/Streamly/Internal/FileSystem/Event/Darwin.m
      exposed-modules:
                     Streamly.Internal.FileSystem.Event.Darwin

When cabal2nix is used on this file it does not generate a Cocoa framework dependency, therefore the nix-shell fails. After adding the dependency manually it works.

How to reproduce:

$ git clone https://github.com/composewell/streamly.git
$ cd streamly
$ mv benchmark/streamly-benchmarks.cabal benchmark/streamly-benchmarks.cabal.bak
$ rm default.nix
$ cabal2nix --shell . > shell.nix
$ cabal build streamly

The build will fail because of Cocoa framework dependency.

We have added the dependency manually in the shell derivation:

        buildInputs =
            if builtins.currentSystem == "x86_64-darwin"
            then [nixpkgs.darwin.apple_sdk.frameworks.Cocoa]
            else [];

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions