git.iko.soy/typeable/stackage2nix
on master help sign in
Add default.nix file when generated from resolver
39774d0Dmitry Bushev
src/Distribution/Nixpkgs/Haskell/Stack/PrettyPrinting.hs+31
@@ -84,6 +84,37 @@ overrideHaskellPackages oc packages =
84 [ attr "ghc" ("pkgs.haskell.compiler." <> toNixGhcVersion (oc ^. ocGhc))
84 [ attr "ghc" ("pkgs.haskell.compiler." <> toNixGhcVersion (oc ^. ocGhc))
85 , attr "compilerConfig" "self: extends pkgOverrides (extends stackageConfig (stackagePackages self))"
85 , attr "compilerConfig" "self: extends pkgOverrides (extends stackageConfig (stackagePackages self))"
86 , attr "haskellLib" "callPackage (nixpkgs.path + \"/pkgs/development/haskell-modules/lib.nix\") {}"
86 , 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: {}"
87 ]
118 ]
88 , "}"
119 , "}"
89 ]
120 ]
src/Runner.hs+3
@@ -98,11 +98,14 @@ run = do
98 buildPlan
98 buildPlan
99 nodes <- traverse (uncurry (buildNode packageSetConfig packageConfig))
99 nodes <- traverse (uncurry (buildNode packageSetConfig packageConfig))
100 $ Map.toAscList (bpPackages buildPlan)
100 $ Map.toAscList (bpPackages buildPlan)
101+ let overrideConfig = mkOverrideConfig opts (siGhcVersion $ bpSystemInfo buildPlan)
101
102
102 writeOutFile buildPlanFile (opts ^. optOutStackagePackages)
103 writeOutFile buildPlanFile (opts ^. optOutStackagePackages)
103 $ pPrintOutPackages (view nodeDerivation <$> nodes)
104 $ pPrintOutPackages (view nodeDerivation <$> nodes)
104 writeOutFile buildPlanFile (opts ^. optOutStackageConfig)
105 writeOutFile buildPlanFile (opts ^. optOutStackageConfig)
105 $ pPrintOutConfig (bpSystemInfo buildPlan) nodes
106 $ pPrintOutConfig (bpSystemInfo buildPlan) nodes
107+ writeOutFile buildPlanFile (opts ^. optOutDerivation)
108+ $ PP.pPrintHaskellPackages overrideConfig
106
109
107writeOutFile :: Show source => source -> FilePath -> Doc -> IO ()
110writeOutFile :: Show source => source -> FilePath -> Doc -> IO ()
108writeOutFile source filePath contents =
111writeOutFile source filePath contents =