git.iko.soy/typeable/stackage2nix
on master help sign in
Add default.nix file when generated from resolver
commit39774d04acfe2588b1723e1cbef48537d8e02dbb authorDmitry Bushev <bushevdv@gmail.com> dateSat 28 Oct 2017, 20:05 (9 years ago) parent7ff5d11
2 files changed+34
src/Distribution/Nixpkgs/Haskell/Stack/PrettyPrinting.hs+31 src/Runner.hs+3
src/Distribution/Nixpkgs/Haskell/Stack/PrettyPrinting.hs+31
@@ -84,6 +84,37 @@ overrideHaskellPackages oc packages =
8484 [ attr "ghc" ("pkgs.haskell.compiler." <> toNixGhcVersion (oc ^. ocGhc))
8585 , attr "compilerConfig" "self: extends pkgOverrides (extends stackageConfig (stackagePackages self))"
8686 , attr "haskellLib" "callPackage (nixpkgs.path + \"/pkgs/development/haskell-modules/lib.nix\") {}"
87+ , attr "initialPackages" "args: self: {}"
88+ , attr "configurationCommon" "args: self: super: {}"
89+ ]
90+ , "}"
91+ ]
92+
93+pPrintHaskellPackages :: OverrideConfig -> Doc
94+pPrintHaskellPackages oc =
95+ let
96+ nixpkgs = if oc ^. ocNixpkgs . to fromString == systemNixpkgs
97+ then systemNixpkgs
98+ else (disp . (fromString :: FilePath -> Nix.FilePath)) (oc ^. ocNixpkgs)
99+ in vcat
100+ [ funargs
101+ [ "nixpkgs ? import " <> nixpkgs <> " {}"
102+ ]
103+ , ""
104+ , "with nixpkgs;"
105+ , "let"
106+ , nest 2 "inherit (stdenv.lib) extends;"
107+ , nest 2 $ vcat
108+ [ attr "stackagePackages" . importStackagePackages $ oc ^. ocStackagePackages
109+ , attr "stackageConfig" . callStackageConfig $ oc ^. ocStackageConfig
110+ ]
111+ , "in callPackage (nixpkgs.path + /pkgs/development/haskell-modules) {"
112+ , nest 2 $ vcat
113+ [ attr "ghc" ("pkgs.haskell.compiler." <> toNixGhcVersion (oc ^. ocGhc))
114+ , attr "compilerConfig" "self: extends stackageConfig (stackagePackages self)"
115+ , attr "haskellLib" "callPackage (nixpkgs.path + /pkgs/development/haskell-modules/lib.nix) {}"
116+ , attr "initialPackages" "args: self: {}"
117+ , attr "configurationCommon" "args: self: super: {}"
87118 ]
88119 , "}"
89120 ]
src/Runner.hs+3
@@ -98,11 +98,14 @@ run = do
9898 buildPlan
9999 nodes <- traverse (uncurry (buildNode packageSetConfig packageConfig))
100100 $ Map.toAscList (bpPackages buildPlan)
101+ let overrideConfig = mkOverrideConfig opts (siGhcVersion $ bpSystemInfo buildPlan)
101102
102103 writeOutFile buildPlanFile (opts ^. optOutStackagePackages)
103104 $ pPrintOutPackages (view nodeDerivation <$> nodes)
104105 writeOutFile buildPlanFile (opts ^. optOutStackageConfig)
105106 $ pPrintOutConfig (bpSystemInfo buildPlan) nodes
107+ writeOutFile buildPlanFile (opts ^. optOutDerivation)
108+ $ PP.pPrintHaskellPackages overrideConfig
106109
107110writeOutFile :: Show source => source -> FilePath -> Doc -> IO ()
108111writeOutFile source filePath contents =