stack: accept the modern snapshot: key as well as resolver:#2532
Open
hamishmack wants to merge 1 commit into
Open
stack: accept the modern snapshot: key as well as resolver:#2532hamishmack wants to merge 1 commit into
snapshot: key as well as resolver:#2532hamishmack wants to merge 1 commit into
Conversation
Stack >= 2.15.1 renamed the `resolver:` stack.yaml key to `snapshot:`
(both are accepted; `stack new` now emits `snapshot:`). haskell.nix
only recognised `resolver:`, so a project with a `snapshot:`-only
stack.yaml failed with:
stack-repos: AesonException "Error in $: key \"resolver\" not found"
- nix-tools Stack2nix/Stack.hs: accept `snapshot` as a synonym in both
the `FromJSON Stack` and `FromJSON StackSnapshot` instances.
- lib/fetch-resolver.nix: match `snapshot:` as well as `resolver:` when
locating a resolver that points to another file.
Fixes #2506.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stack 2.15.1 renamed the top-level
resolver:key instack.yamltosnapshot:(both remain accepted, andstack newnow emitssnapshot:). haskell.nix only recognisedresolver:, so a project with asnapshot:-onlystack.yamlfails during project evaluation with:(see #2506).
Changes
nix-tools/nix-tools/lib/Stack2nix/Stack.hs— acceptsnapshotas a synonym forresolverin both theFromJSON StackandFromJSON StackSnapshotinstances (s .: "resolver" <|> s .: "snapshot").<|>is already imported and used by theLocationinstance.lib/fetch-resolver.nix— match^snapshot:as well as^resolver:when locating a resolver that points to another file.Verification
lib/fetch-resolver.nix: evaluated on asnapshot: lts-22.0stack.yamlreturns"lts-22.0"; aresolver: lts-21.0one still returns"lts-21.0".stack-reposfrom this source and ran it:snapshot: lts-22.0→ succeeds (repos.jsonproduced) — previously crashed withkey "resolver" not found.resolver: lts-21.0→ still succeeds (no regression).Fixes #2506.