Stack: configure-options on commandline

Created on 5 Jun 2019  Â·  8Comments  Â·  Source: commercialhaskell/stack

In #4750 configure-options was added. However it seems that you cannot currently pass this option to stack build on the command-line, the same way you can pass ghc-options. Is this possible/desirable?

In particular I want to use it so that I can change the --datadir for something I am building, without having to edit a stack.yaml beforehand.

options parsing discuss enhancement question

All 8 comments

I'm personally not a fan of adding something like this to the command line, it would make it too easy to accidentally create additional implicit snapshots.

My particular use case is to do

git clone https://github.com/ucsd-progsys/liquidhaskell.git
cd liquidhaskell
stack install

in an automated fashion. (Dockerfile)

LH however has additional data files (a "prelude") that it needs to function. I don't want to clog up my image with LHs .stack-work, which contains those files, by default.

Is there some better way to do this through stack, other than echoing into stack.yaml, or should I just use cabal directly instead here?

I don't think configure-options and --datadir will do what you're looking for, unless I'm completely misunderstanding you. Wherever you point the --datadir, those files will be in the image. You probably need to run something like stack install && rm -rf /path/to/data/files in order to ensure they don't end up in the Docker image.

I think something is being lost in translation here.

Here's what I want to do:
Inside a dockerfile
1) Clone LH
2) stack install LH
3) Delete .stack-work (and the cloned directory in general), as it contains a lot of compilation artifacts that I do not need.

  • This however is not directly possible. LH has a directory called include, which, by default, gets copied into
    .stack-work/install/x86_64-linux-tinfo6/lts-13.20/8.6.5/share/x86_64-linux-ghc-8.6.5/liquidhaskell-0.8.6.0/ (for example).
    By using cabals --datadir (passed through configure-options), I can redirect this to wherever I want. However I can only specify this through configure-options in the stack.yaml currently, making me have to somehow edit LHs stack.yaml before building it.

OK, that makes more sense to me. I think the only way to achieve what
you're looking for is modifying the stack.yaml, such as via calls to echo
like you mentioned.

On Sun, Jun 23, 2019 at 12:01 PM Georgi Lyubenov notifications@github.com
wrote:

I think something is being lost in translation here.

Here's what I want to do:
Inside a dockerfile

  1. Clone LH
  2. stack install LH
  3. Delete .stack-work (and the cloned directory in general), as it
    contains a lot of compilation artifacts that I do not need.

  4. This however is not directly possible. LH has a directory called
    include
    https://github.com/ucsd-progsys/liquidhaskell/tree/develop/include,
    which, by default, gets copied into

    .stack-work/install/x86_64-linux-tinfo6/lts-13.20/8.6.5/share/x86_64-linux-ghc-8.6.5/liquidhaskell-0.8.6.0/
    .
    By using cabals --datadir (passed through configure-options), I can
    redirect this to wherever I want. However I can only specify this through
    configure-options currently, making me have to somehow edit LHs
    stack.yaml before building it.

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/commercialhaskell/stack/issues/4852?email_source=notifications&email_token=AAAMCB5Q24ROH6WL52O4AXTP343WFA5CNFSM4HTWVTFKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODYKZ3DA#issuecomment-504733068,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAAMCB43D5PQ6SHO6JXQBVLP343WFANCNFSM4HTWVTFA
.

Closing

So in conclusion this is something undesirable for Stack?

Personally, I don't think it's a good idea to add it. I'm open to others having other ideas.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Toxaris picture Toxaris  Â·  4Comments

domenkozar picture domenkozar  Â·  3Comments

abhinav picture abhinav  Â·  4Comments

igrep picture igrep  Â·  3Comments

s5k6 picture s5k6  Â·  3Comments