Hi all,
I've been trying out stack and would love to use it in our projects at Prezi, so I was thinking how we could integrate it with our workflow. To understand my proposal, let me explain first what we are doing today. We have several Haskell projects, depending on each other, often also using and producing artifacts for other languages (such as C++ and Haxe). To fit our projects into the company's build infrastructure, we developed a Gradle plugin for Haskell development and use it for all our Haskell projects, running them both on our development machines and on Jenkins nodes. All these builds are producing binary artifacts for Linux and OSX, stored on an Artifactory server. The plugin uses Gradle's dependency management to get these binary artifacts, and wraps cabal to set up the appropriate package database chain.
The idea is that each binary dependency is a GHC package database, and to build a project we pass all it's dependencies' package DB in appropriate order, on top of the global package DB (we skip the user package DB). Our "bottom" project (which is the one goes immediately on top of the global package DB in every build) is a special project which only installs commonly used libraries but has no custom code, a bit similar to the snapshots of stack.
Stack would fit into this system quite well, if we'd have a way to put additional package DB layers between the snapshot DB and the local package DB. If a few constraints are enforced, this would not break the reproducibility of stack build:
- all the binary deps must be built on the same snapshot
- they have to be layered on each other in the correct order
- they are built on the same platform (OS version and GHC version)
If we assume that these constraints are enforced by the user (which in our case would be done by our Gradle plugin), it would be easy to add a new block to stack.yaml such as 'extra-bin-deps' or 'extra-package-dbs', and just use the listed package DBs in addition to the snapshot and the local DB everywhere.
A more full solution would be if binary dependency support would get first-class support in stack, in this case it could package it's local package DB together with metadata and use these packages to find out the correct layering order and do more checks.
So, what do you think? If this is something that could be added to stack, I'd be happy to work on it of course. I'm also interested in other ideas how we could use stack in our build environment, without giving up on our binary artifacts.