Skip to content

Generate --subpath for local targets #107

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kirelagin
Copy link

@kirelagin kirelagin commented Jul 18, 2018

Suppose there is a package with the following structure:

  • hpack/
    • common.yaml some useful hpack defiitions
  • lib/
    • package.yaml sources ../hpack/common.yaml
    • ...
  • stack.yaml

A call to cabal2nix ./lib will generate a broken expression because it will have src = ./lib which will cause nix to copy the lib directory into the store and then ../hpack/common.yaml will be unavailable.
The correct invocation is cabal2nix . --subpath lib.

Some packages may need access to files outside of their subdirectory
(e.g. hpack files may source other hpack files). Therefore it is
important to keep the integrity of the project directory and specify
individual subdirectories by passing `--subpath` to `cabal2nix`.

Since `stack` does not support specifying subdirs for file paths (unlike
git repositories), it is impossible to tell in general where is the root
of the dependency. But we can at least do this for local targets.
@domenkozar
Copy link
Contributor

There is a test failing in travis ci.

@kirelagin
Copy link
Author

Looking at the travis log it is hard to tell what exactly fails, but I suspect it is the last line of scripts/travis.sh:

test $(grep "src = ../dep1" hmpd.nix | wc -l) -eq 1

It is definitely wrong now, but I don’t know how to fix it, because I don’t know what it is supposed to test. Maybe @jmitchell can help me with this. It was introduced in a88e4ea, so probably taking a look at DEVOPS-282, which I don’t have access to, could help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants