-
Notifications
You must be signed in to change notification settings - Fork 0
Custom Snapshot
WARNING: Do not modify the existing snapshots! It will make dragons fly out of your nose! Create a new one!
Exception:
- only adding a new package
Stack supports custom snapshots since version 1.3. The idea is that you're able to create a file specifying all the packages you want, include those extra dependencies, and make stack use it as if it came from Stackage.
compiler: ghc-7.10.2
flags:
aeson:
old-locale: false
packages:
- aeson-diff-0.1.1.2
Note: start by just adding custom dependencies to extra-deps. Once this change is approved and merged, make a separate task for creating a new snapshot.
-
Update a
stack.yamlto make it use the latest Stackage lts release via theresolverflag. -
Add as extra dependencies everything else needed.
-
Build and test everything via
stack test. -
Create a new stack snapshot .yaml file with a different name from the last resolver
-
Copy the lts constraints from stackage into the yaml file. You can take the cabal.config from stackage for example, but you will need to remove the packages whose version is 'installed').
-
Generate the extra-dependencies packages constraints, and put those at the top of the package list
stack exec -- ghc-pkg list
$(stack exec -- ghc-pkg list | egrep 'stack-work' | sed 's/:$ //' | sed 's/^/-f /' | xargs) | sed 's/^ / -/' -
Make sure there are no packages that come from the "packages" section of your stack.yaml
-
Remove any packages from the lts constraints that are also in the extra-dependencies constraints
-
Update stack.yaml to use the new resolver and make sure it all compiles:
resolver: name: your-snapshot location: "./your-snapshot.yaml"
-
Wipe out old custom snapshots to free disk space