@@ -42,15 +42,11 @@ overridePackages = PP.packageSetConfig . PP.cat . F.toList . fmap callPackage
43importStackagePackages :: FilePath -> Doc
43importStackagePackages :: FilePath -> Doc
44importStackagePackages path = hsep
44importStackagePackages path = hsep
45− [ funarg "self", "import", disp (fromString path :: Nix.FilePath), "{"
45+ ["import", disp (fromString path :: Nix.FilePath)]
46− , "inherit pkgs stdenv;"
47− , "inherit (self) callPackage;"
51−callStackageConfig :: FilePath -> Doc
47+importStackageConfig :: FilePath -> Doc
52−callStackageConfig path = hsep
48+importStackageConfig path = hsep
53− [ "callPackage", disp (fromString path :: Nix.FilePath), "{}"]
49+ ["import ", disp (fromString path :: Nix.FilePath), "{ inherit pkgs haskellLib; }"]
55overrideHaskellPackages :: OverrideConfig -> NonEmpty Derivation -> Doc
51overrideHaskellPackages :: OverrideConfig -> NonEmpty Derivation -> Doc
56overrideHaskellPackages oc packages =
52overrideHaskellPackages oc packages =
@@ -67,8 +63,9 @@ overrideHaskellPackages oc packages =
68 , nest 2 "inherit (stdenv.lib) extends;"
64 , nest 2 "inherit (stdenv.lib) extends;"
69 , nest 2 $ vcat
65 , nest 2 $ vcat
66+ [ attr "haskellLib" "callPackage (nixpkgs.path + \"/pkgs/development/haskell-modules/lib.nix\") {}"
70− [ attr "stackagePackages" . importStackagePackages $ oc ^. ocStackagePackages
67+ , attr "stackagePackages" . importStackagePackages $ oc ^. ocStackagePackages
71− , attr "stackageConfig" . callStackageConfig $ oc ^. ocStackageConfig ]
68+ , attr "stackageConfig" . importStackageConfig $ oc ^. ocStackageConfig ]
72 , nest 2 $ vcat
69 , nest 2 $ vcat
73 [ "stackPackages ="
70 [ "stackPackages ="
74 , nest 2 $ overridePackages packages <> semi
71 , nest 2 $ overridePackages packages <> semi
@@ -82,10 +79,10 @@ overrideHaskellPackages oc packages =
82 , "in callPackage (nixpkgs.path + \"/pkgs/development/haskell-modules\") {"
79 , "in callPackage (nixpkgs.path + \"/pkgs/development/haskell-modules\") {"
83 , nest 2 $ vcat
80 , nest 2 $ vcat
84 [ attr "ghc" ("pkgs.haskell.compiler." <> toNixGhcVersion (oc ^. ocGhc))
81 [ attr "ghc" ("pkgs.haskell.compiler." <> toNixGhcVersion (oc ^. ocGhc))
85− , attr "compilerConfig" "self: extends pkgOverrides (extends stackageConfig (stackagePackages self))"
82+ , attr "compilerConfig" "self: extends pkgOverrides (stackageConfig self)"
86− , attr "haskellLib" "callPackage (nixpkgs.path + \"/pkgs/development/haskell-modules/lib.nix\") {}"
83+ , attr "initialPackages" "stackagePackages"
87− , attr "initialPackages" "args: self: {}"
88 , attr "configurationCommon" "args: self: super: {}"
84 , attr "configurationCommon" "args: self: super: {}"
85+ , "inherit haskellLib;"
@@ -101,20 +98,17 @@ pPrintHaskellPackages oc =
101 [ "nixpkgs ? import " <> nixpkgs <> " {}"
98 [ "nixpkgs ? import " <> nixpkgs <> " {}"
104− , "with nixpkgs;"
101+ , "with nixpkgs; let"
106− , nest 2 "inherit (stdenv.lib) extends;"
107 , nest 2 $ vcat
102 , nest 2 $ vcat
108− [ attr "stackagePackages" . importStackagePackages $ oc ^. ocStackagePackages
103+ [ attr "haskellLib" "callPackage (nixpkgs.path + /pkgs/development/haskell-modules/lib.nix) {}"
109− , attr "stackageConfig" . callStackageConfig $ oc ^. ocStackageConfig
111 , "in callPackage (nixpkgs.path + /pkgs/development/haskell-modules) {"
105 , "in callPackage (nixpkgs.path + /pkgs/development/haskell-modules) {"
112 , nest 2 $ vcat
106 , nest 2 $ vcat
113 [ attr "ghc" ("pkgs.haskell.compiler." <> toNixGhcVersion (oc ^. ocGhc))
107 [ attr "ghc" ("pkgs.haskell.compiler." <> toNixGhcVersion (oc ^. ocGhc))
114− , attr "compilerConfig" "self: extends stackageConfig (stackagePackages self)"
108+ , attr "compilerConfig" . importStackageConfig $ oc ^. ocStackageConfig
115− , attr "haskellLib" "callPackage (nixpkgs.path + /pkgs/development/haskell-modules/lib.nix) {}"
116− , attr "initialPackages" "args: self: {}"
109+ , attr "initialPackages" . importStackagePackages $ oc ^. ocStackagePackages
117− , attr "configurationCommon" "args: self: super: {}"
110+ , attr "configurationCommon" "if builtins.pathExists ./configuration-common.nix then import ./configuration-common.nix else args: self: super: {}"
111+ , "inherit haskellLib;"