-
Notifications
You must be signed in to change notification settings - Fork 247
Add snapshots attribute #151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# This provides a package set for each snapshot in Stackage. | ||
# | ||
# It allows you to use a bare snapshot without having to invoke | ||
# mkStackPkgSet with a stack.yaml project. | ||
# | ||
# A particular package in a snapshot would be accessed with: | ||
# snapshots."lts-13.18".conduit | ||
|
||
{ lib, mkPkgSet, stackage }: | ||
|
||
with lib; | ||
|
||
let | ||
mkSnapshot = name: pkg-def: (mkPkgSet { | ||
inherit pkg-def; | ||
pkg-def-extras = pkg-def-extras name; | ||
}).config.hsPkgs; | ||
|
||
# Tests whether snapshot name is an LTS within | ||
# the half-open version interval [start, end). | ||
ltsInRange = start: end: name: let | ||
components = splitString "-" name; | ||
version = concatStringsSep "-" (drop 1 components); | ||
in | ||
assert length components >= 2; | ||
head components == "lts" | ||
&& versionAtLeast version start | ||
&& versionOlder version end; | ||
|
||
# A function to get pkg-def-extras with build fixes for certain | ||
# snapshots. | ||
pkg-def-extras = let | ||
fixes = { | ||
# Work around a mismatch between stackage metadata and the | ||
# libraries shipped with GHC. | ||
# https://github.com/commercialhaskell/stackage/issues/4466 | ||
fix-ghc-transformers = { | ||
predicate = ltsInRange "12" "14"; | ||
extra = hackage: { | ||
packages = { | ||
"transformers" = (((hackage.transformers)."0.5.6.2").revisions).default; | ||
"process" = (((hackage.process)."1.6.5.0").revisions).default; | ||
}; | ||
}; | ||
}; | ||
|
||
# Add hsc2hs to the snapshot. This is a build tool for many | ||
# packages. Stackage does not include it in the snapshots | ||
# because it is expected that hsc2hs comes with ghc. | ||
fix-hsc2hs = { | ||
extra = hackage: { | ||
packages = { | ||
"hsc2hs" = (((hackage.hsc2hs)."0.68.4").revisions).default; | ||
}; | ||
}; | ||
}; | ||
}; | ||
|
||
applyFix = name: fix: optional ((fix.predicate or (const true)) name) fix.extra; | ||
|
||
in | ||
name: concatLists (mapAttrsToList (_: applyFix name) fixes); | ||
|
||
in | ||
mapAttrs mkSnapshot stackage |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ stdenv, haskellPackages }: | ||
|
||
with stdenv.lib; | ||
|
||
stdenv.mkDerivation { | ||
name = "shell-for-test"; | ||
|
||
buildCommand = '' | ||
######################################################################## | ||
# test snapshot ghcWithHoogle | ||
|
||
printf "checking that the latest LTS snapshot has the lens package...\n" >& 2 | ||
test -d ${haskellPackages.lens.components.library} | ||
|
||
touch $out | ||
''; | ||
|
||
meta.platforms = platforms.all; | ||
} |
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.
Uh oh!
There was an error while loading. Please reload this page.