Aha, thanks, this works great! Indeed, I was missing those two pieces, and there was also one other slight misconception I had to get past: it turns out that I implicitly thought 'stack build' meant 'do whatever is in the local stack.yaml', but I guess it actually means 'build the package in the working directory (using stack.yaml to guide how that should happen)'. So when I put 'packages: []' and tried to 'stack build' of course I got an error saying that it could not find a package. But once I figured out that I have to say 'stack build package1 package2 ...' it works great. Thanks again for the help --- and also thanks to Neil for the example.
-Brent On Monday, February 12, 2018 at 3:42:49 AM UTC-6, Michael Snoyman wrote: > > IIUC, you're looking to define a `stack.yaml` file which will set up all > of the packages and settings, and then have a script you run to tell Stack > to build the appropriate packages. That sounds fine; I think the pieces > you're missing are: > > * In order to say "I have no local packages," include the line `packages: > []` in your `stack.yaml` > * You can use the `flags` section in your `stack.yaml` to override default > cabal flags, see > https://docs.haskellstack.org/en/stable/yaml_configuration/#flags > > On Mon, Feb 12, 2018 at 6:14 AM, Brent Yorgey <byo...@gmail.com > <javascript:>> wrote: > >> Hi all, >> >> I have a specific goal and I'm hoping you can help me figure out the best >> way to accomplish it using stack (or perhaps even using other tools if they >> make more sense). I am working on a LaTeX document which contains embedded >> Haskell code for generating diagrams ( >> https://github.com/byorgey/series-formelles). When the LaTeX file is >> compiled, a certain executable (diagrams-builder-pgf) needs to be present, >> which in turn uses the GHC API to compile and run the code embedded in the >> LaTeX document. In order for this to work, various libraries (diagrams-lib, >> diagrams-pgf, palette, etc...) need to be present in the GHC package >> database; I also need a specific version of GHC. Getting this environment >> set up properly, with compatible versions of everything, can be a pain; I >> would like to create a script that others can run in order to reproducibly >> get a proper environment set up to be able to build the LaTeX document. >> >> Stack seems like the obvious choice but I have run into a few >> difficulties trying to get it set up: first of all, as you can tell from my >> description above, I do not actually have a Haskell package. There is no >> Haskell library or executable I am trying to build. But as far as I can >> tell, a stack project is supposed to contain one or more Haskell packages. >> I could try to make a "fake" Haskell package whose dependencies describe >> the things I want to end up being present in the package DB but I am not >> sure of the best way to do this, and it seems rather kludgy. Really what I >> want is just a sandbox, but I can't really use a cabal sandbox because as >> far as I know that will just use whatever GHC version someone has >> installed, and I need a particular GHC version. Secondly, in order to >> install the diagrams-builder-pgf executable, I need to pass a certain flag >> to the diagrams-builder package when it is built, but I'm not clear on >> exactly how to do this using stack. >> >> So, what do you think? Is there a good way to do this with stack? Or >> should I look at some other way to get this set up? Thanks in advance for >> any ideas or advice. I'm happy to answer questions or provide further >> information. >> >> -Brent >> >> -- >> You received this message because you are subscribed to the Google Groups >> "haskell-stack" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to haskell-stac...@googlegroups.com <javascript:>. >> To post to this group, send email to haskel...@googlegroups.com >> <javascript:>. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/haskell-stack/559b2f4d-bfa4-4b4e-9750-32de4d9a4a7c%40googlegroups.com >> >> <https://groups.google.com/d/msgid/haskell-stack/559b2f4d-bfa4-4b4e-9750-32de4d9a4a7c%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > > -- You received this message because you are subscribed to the Google Groups "haskell-stack" group. To unsubscribe from this group and stop receiving emails from it, send an email to haskell-stack+unsubscr...@googlegroups.com. To post to this group, send email to haskell-stack@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/haskell-stack/2f3f53b5-1ada-4725-a94b-794a9b7f326c%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.