git.iko.soy/typeable/stackage2nix
on master help sign in
Add: set ghc version from build plan
commit4bc87ffdee2e55fe838786a7546332d5fbe32f56 authorDmitry Bushev <bushevdv@gmail.com> dateMon 12 Jun 2017, 01:09 (9 years ago) parentbe94366
5 files changed+19−10
src/Distribution/Nixpkgs/Haskell/Stack/PrettyPrinting.hs+7−4 src/Runner.hs+7−5 stack.yaml+2−1 stack2nix.cabal+1 test.sh+2
src/Distribution/Nixpkgs/Haskell/Stack/PrettyPrinting.hs+7−4
@@ -11,12 +11,13 @@ import Distribution.Nixpkgs.Haskell.Derivation
1111import Distribution.Nixpkgs.Haskell.Packages.PrettyPrinting as PP
1212import Distribution.Package
1313import Distribution.Text
14+import Distribution.Version (Version(..))
1415import qualified Language.Nix.FilePath as Nix
1516import Language.Nix.PrettyPrinting as PP
1617
1718
1819data OverrideConfig = OverrideConfig
19− { _ocGhc :: !String
20+ { _ocGhc :: !Version
2021 , _ocStackagePackages :: !FilePath
2122 , _ocStackageConfig :: !FilePath }
2223
@@ -74,10 +75,12 @@ overrideHaskellPackages oc packages = vcat
7475 ]
7576 , "in callPackage <nixpkgs/pkgs/development/haskell-modules> {"
7677 , nest 2 $ vcat
77− [ attr "ghc" ("pkgs.haskell.compiler." <> ghc)
78+ [ attr "ghc" ("pkgs.haskell.compiler." <> toNixGhcVersion (oc ^. ocGhc))
7879 , attr "compilerConfig" "self: extends stackageConfig (stackagePackages self)"
7980 , attr "overrides" "self: pkgOverrides self"]
8081 , "}"
8182 ]
82− where
83− ghc = oc ^. ocGhc . to text
83+
84+toNixGhcVersion :: Version -> Doc
85+toNixGhcVersion =
86+ (<>) "ghc" . text . filter (/= '.') . show . disp
src/Runner.hs+7−5
@@ -3,9 +3,11 @@ module Runner ( run ) where
33import Control.Lens
44import Distribution.Nixpkgs.Haskell.Stack
55import Distribution.Nixpkgs.Haskell.Stack.PrettyPrinting as PP
6+import Distribution.Version (Version(..))
67import Options.Applicative
78import Runner.Cli
89import Stack.Config
10+import Stackage.Types
911
1012import qualified Stackage2nix as S2n
1113
@@ -24,12 +26,12 @@ run = do
2426 , S2n.optNixpkgsMap = Nothing
2527 , S2n.optOutPackages = opts ^. optStackageOutPackages
2628 , S2n.optOutConfig = opts ^. optStackageOutConfig }
27− _ <- S2n.run s2nOptions
29+ buildPlan <- S2n.run s2nOptions
2830
2931 -- generate haskell packages override
3032 let
3133 pkgConfig = mkPackageConfig (opts ^. optPlatform) (opts ^. optCompilerId)
32− overrideConfig = mkOverrideConfig opts
34+ overrideConfig = mkOverrideConfig opts (siGhcVersion $ bpSystemInfo buildPlan)
3335 packages <- traverse (packageDerivation pkgConfig (opts ^. optHackageDb))
3436 $ stackYaml ^. scPackages
3537 let
@@ -38,8 +40,8 @@ run = do
3840 writeFile (opts ^. optOutFile) (show out)
3941 putStrLn $ "\nDerivation was written to " ++ opts ^. optOutFile
4042
41−mkOverrideConfig :: Options -> OverrideConfig
42−mkOverrideConfig opts = OverrideConfig
43− { _ocGhc = "ghc802"
43+mkOverrideConfig :: Options -> Version -> OverrideConfig
44+mkOverrideConfig opts ghcVersion = OverrideConfig
45+ { _ocGhc = ghcVersion
4446 , _ocStackagePackages = opts ^. optStackageOutPackages
4547 , _ocStackageConfig = opts ^. optStackageOutConfig }
stack.yaml+2−1
@@ -2,10 +2,11 @@ resolver: lts-8.15
22packages:
33- '.'
44- location: ../cabal2nix
5+ extra-dep: true
56#- location:
67 #git: https://github.com/4e6/cabal2nix.git
78 #commit: 5da88077431fca9ec4d63ce3ad22cd1fe935ad93
8− extra-dep: true
9+ #extra-dep: true
910extra-deps:
1011- distribution-nixpkgs-1.1
1112- hopenssl-2.2
stack2nix.cabal+1
@@ -38,6 +38,7 @@ library
3838 , network-uri
3939 , optparse-applicative
4040 , pretty
41+ , stackage-curator
4142 , text
4243 , yaml
4344 default-language: Haskell2010
test.sh+2
@@ -2,6 +2,8 @@
22
33VERSION=${VERSION:-8.15}
44
5+set -x
6+
57stack2nix \
68 --stackage-build-plan "$HOME/projects/fpco/lts-haskell/lts-$VERSION.yaml" \
79 --all-cabal-hashes "$HOME/projects/commercialhaskell/all-cabal-hashes" \