Stack: Combine stack-info-yaml argument and config.yaml

Created on 5 Feb 2017  ·  12Comments  ·  Source: commercialhaskell/stack

There are two config files that Stack uses for the global URL settings, namely config.yaml (typically in $STACK_ROOT) and the arguments passed to stack-setup-yaml. The typical reason to modify either seems to be that you want to make Stack always hit a local mirror (either for caching, reproducibility, or due to network blocks). If you want to modify one, you probably want to modify the other. They are both set in different ways, sourced from different places, and have different non-overlapping subsets of information. Combining them into one would simplify lives for people who need to modify these things.

enhancement

Most helpful comment

(+1) This would really help getting stack into work environments where local mirroring of packages are required.

All 12 comments

Note that the stack-setup-yaml file is far more convenient (passed on the command line, able to be set in stack.yaml) so would be my preference of the model to follow.

I'd love when Stack could run totally offline. I'm following the Stack list thread and would like to see this all being made easier. So, those two files are described as:

  • stack-setup.yaml (default): Stack's dependencies.
  • config.yaml (no default): User's global configuration

Could we see an example of the options you need from both files without sensitive info?

For stack-setup.yaml I take the default, delete 90%+ of it, and then rewrite http://... to http://myinternalserver/...`.

For config.yaml I take https://github.com/commercialhaskell/stack/blob/master/doc/yaml_configuration.md#package-indices and https://github.com/commercialhaskell/stack/blob/master/doc/yaml_configuration.md#urls, slap them together, and do the same http:// trick.

To make it easy, you'd really want to just set "for http:// read http://mylocalserver/ or C:/mylocalcache/, and once, rather than a few 100 times over two files.

(+1)

This should make it easier to configure stack to work in environments where local servers are required.

I've set up a fully worked example at https://github.com/ndmitchell/offline-stack#readme which is tested to ensure it works. I suggest using that as a template.

Great setup @ndmitchell

(+1) This would really help getting stack into work environments where local mirroring of packages are required.

“Using Stack offline” would also probably help with bad connections (#3088, just closed as duplicate), and with people behind firewalls that block S3 (I forget which is the issue, should also be merged here).

BTW, beyhond the topic of this issue, it’d be great to support mirroring with a less cumbersome procedure if possible, or at least to integrate or link to instructions from the Stack docs. Not sure if this is the correct issue to track all that, sorry if I got this wrong (should look at all this more closely if I get time).

@Blaisorblade, try https://github.com/AleXoundOS/haskell-stack-mirror-script
It's not so cumbersome you may think. But sure this could be done more easily.

@AleXoundOS Thank you for this, it sounds like what we need. One question -- will it also download GHC, so that when we run stack-setup on a host with no GHC it can automatically download/build it from the local server? Or is there another way to do that?

@dpacbach, yes it mirrors all executables required for stack setup to operate.
(but don't forget to supply custom url to the tweaked setup-info-yaml file)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

symbiont-joseph-kachmar picture symbiont-joseph-kachmar  ·  3Comments

Toxaris picture Toxaris  ·  4Comments

bitemyapp picture bitemyapp  ·  3Comments

silky picture silky  ·  3Comments

jwaldmann picture jwaldmann  ·  4Comments