@@ -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 ]