input-output-hk / devx

The Developer Experience Shell - This repo contains a nix develop shell for haskell. Its primary purpose is to help get a development shell for haskell quickly and across multiple operating systems (and architectures).
Apache License 2.0
37 stars 9 forks source link

`$CABAL_PROJECT_LOCAL_TEMPLATE` broken & inconvenient to use #95

Closed KtorZ closed 10 months ago

KtorZ commented 11 months ago

When entering the nix shell, the following message is shown:

 Quirks:
    if you have the zlib, HsOpenSSL, or digest package in your dependency tree, please make sure to
    echo "$CABAL_PROJECT_LOCAL_TEMPLATE" > cabal.project.local

Firstly, the content of the $CABAL_PROJECT_LOCAL_TEMPLATE is broken as it's missing newlines / carriage returns. Thus adding it to cabal.project.local with the provided instruction result in a build failure as cabal chokes on it.

Second, it is actually inconvenient to use for two reasons:

  1. On a local setup, this may conflict with a local cabal.project.local and sadly, because the extra-lib referenced in this variable are paths on the nix store, we can't really get around by 'hard coding' them in the cabal.project.local since they may change on a new index-state or constraints solving.

  2. The fact it is stored in an environment variable which only exists from within the nix-shell is annoying. It prevents using it in combination with --command for example since escaping doesn't work. For similar reason, when used from within a Makefile it gets in the way pretty quickly.

Possible / suggested resolution: to address (1) and (2), I'd be more convenient to have a one-time command to run that would output the extra cabal constraints on stdout or to a file for a given dependency set. This way, this operation can be done as part of a configuration step and need not to rely on environment variables.

angerman commented 10 months ago

@yvan-sraka I agree with @KtorZ suggestion to turn this into a command, what do you think? Could you please take a look at this?