git.iko.soy/typeable/stackage2nix
on master help sign in
Upd Nix derivation structure
commit9e8eaaec38e2d013d967c82244ac35a217868fd2 authorDmitry Bushev <bushevdv@gmail.com> dateWed 20 Dec 2017, 15:33 (9 years ago) parentaac58fa
2 files changed+18−24
src/Distribution/Nixpkgs/Haskell/FromStack/Package.hs+2−2 src/Distribution/Nixpkgs/Haskell/Stack/PrettyPrinting.hs+16−22
src/Distribution/Nixpkgs/Haskell/FromStack/Package.hs+2−2
@@ -106,9 +106,9 @@ isFromHackage b = case view (reference . Nix.path) b of
106106
107107pPrintOutConfig :: SystemInfo -> [Node] -> Doc
108108pPrintOutConfig systemInfo nodes = vcat
109− [ "{ pkgs }:"
109+ [ "{ pkgs, haskellLib }:"
110110 , ""
111− , "with pkgs.haskell.lib; self: super: {"
111+ , "with haskellLib; self: super: {"
112112 , ""
113113 , " # core packages"
114114 , nest 2 $ vcat $
src/Distribution/Nixpkgs/Haskell/Stack/PrettyPrinting.hs+16−22
@@ -42,15 +42,11 @@ overridePackages = PP.packageSetConfig . PP.cat . F.toList . fmap callPackage
4242
4343importStackagePackages :: FilePath -> Doc
4444importStackagePackages path = hsep
45− [ funarg "self", "import", disp (fromString path :: Nix.FilePath), "{"
46− , "inherit pkgs stdenv;"
47− , "inherit (self) callPackage;"
48− , "}"
49− ]
45+ ["import", disp (fromString path :: Nix.FilePath)]
5046
51−callStackageConfig :: FilePath -> Doc
52−callStackageConfig path = hsep
53− [ "callPackage", disp (fromString path :: Nix.FilePath), "{}"]
47+importStackageConfig :: FilePath -> Doc
48+importStackageConfig path = hsep
49+ ["import ", disp (fromString path :: Nix.FilePath), "{ inherit pkgs haskellLib; }"]
5450
5551overrideHaskellPackages :: OverrideConfig -> NonEmpty Derivation -> Doc
5652overrideHaskellPackages oc packages =
@@ -67,8 +63,9 @@ overrideHaskellPackages oc packages =
6763 , "let"
6864 , nest 2 "inherit (stdenv.lib) extends;"
6965 , nest 2 $ vcat
70− [ attr "stackagePackages" . importStackagePackages $ oc ^. ocStackagePackages
71− , attr "stackageConfig" . callStackageConfig $ oc ^. ocStackageConfig ]
66+ [ attr "haskellLib" "callPackage (nixpkgs.path + \"/pkgs/development/haskell-modules/lib.nix\") {}"
67+ , attr "stackagePackages" . importStackagePackages $ oc ^. ocStackagePackages
68+ , attr "stackageConfig" . importStackageConfig $ oc ^. ocStackageConfig ]
7269 , nest 2 $ vcat
7370 [ "stackPackages ="
7471 , nest 2 $ overridePackages packages <> semi
@@ -82,10 +79,10 @@ overrideHaskellPackages oc packages =
8279 , "in callPackage (nixpkgs.path + \"/pkgs/development/haskell-modules\") {"
8380 , nest 2 $ vcat
8481 [ attr "ghc" ("pkgs.haskell.compiler." <> toNixGhcVersion (oc ^. ocGhc))
85− , attr "compilerConfig" "self: extends pkgOverrides (extends stackageConfig (stackagePackages self))"
86− , attr "haskellLib" "callPackage (nixpkgs.path + \"/pkgs/development/haskell-modules/lib.nix\") {}"
87− , attr "initialPackages" "args: self: {}"
82+ , attr "compilerConfig" "self: extends pkgOverrides (stackageConfig self)"
83+ , attr "initialPackages" "stackagePackages"
8884 , attr "configurationCommon" "args: self: super: {}"
85+ , "inherit haskellLib;"
8986 ]
9087 , "}"
9188 ]
@@ -101,20 +98,17 @@ pPrintHaskellPackages oc =
10198 [ "nixpkgs ? import " <> nixpkgs <> " {}"
10299 ]
103100 , ""
104− , "with nixpkgs;"
105− , "let"
106− , nest 2 "inherit (stdenv.lib) extends;"
101+ , "with nixpkgs; let"
107102 , nest 2 $ vcat
108− [ attr "stackagePackages" . importStackagePackages $ oc ^. ocStackagePackages
109− , attr "stackageConfig" . callStackageConfig $ oc ^. ocStackageConfig
103+ [ attr "haskellLib" "callPackage (nixpkgs.path + /pkgs/development/haskell-modules/lib.nix) {}"
110104 ]
111105 , "in callPackage (nixpkgs.path + /pkgs/development/haskell-modules) {"
112106 , nest 2 $ vcat
113107 [ 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: {}"
108+ , attr "compilerConfig" . importStackageConfig $ oc ^. ocStackageConfig
109+ , attr "initialPackages" . importStackagePackages $ oc ^. ocStackagePackages
110+ , attr "configurationCommon" "if builtins.pathExists ./configuration-common.nix then import ./configuration-common.nix else args: self: super: {}"
111+ , "inherit haskellLib;"
118112 ]
119113 , "}"
120114 ]