git.iko.soy/typeable/stackage2nix
on master help sign in
Upd Nix derivation structure
9e8eaaeDmitry Bushev
src/Distribution/Nixpkgs/Haskell/FromStack/Package.hs+2−2
@@ -106,9 +106,9 @@ isFromHackage b = case view (reference . Nix.path) b of
106
106
107pPrintOutConfig :: SystemInfo -> [Node] -> Doc
107pPrintOutConfig :: SystemInfo -> [Node] -> Doc
108pPrintOutConfig systemInfo nodes = vcat
108pPrintOutConfig systemInfo nodes = vcat
109− [ "{ pkgs }:"
109+ [ "{ pkgs, haskellLib }:"
110 , ""
110 , ""
111− , "with pkgs.haskell.lib; self: super: {"
111+ , "with haskellLib; self: super: {"
112 , ""
112 , ""
113 , " # core packages"
113 , " # core packages"
114 , nest 2 $ vcat $
114 , 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
42
42
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;"
48− , "}"
49− ]
50
46
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; }"]
54
50
55overrideHaskellPackages :: OverrideConfig -> NonEmpty Derivation -> Doc
51overrideHaskellPackages :: OverrideConfig -> NonEmpty Derivation -> Doc
56overrideHaskellPackages oc packages =
52overrideHaskellPackages oc packages =
@@ -67,8 +63,9 @@ overrideHaskellPackages oc packages =
67 , "let"
63 , "let"
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;"
89 ]
86 ]
90 , "}"
87 , "}"
91 ]
88 ]
@@ -101,20 +98,17 @@ pPrintHaskellPackages oc =
101 [ "nixpkgs ? import " <> nixpkgs <> " {}"
98 [ "nixpkgs ? import " <> nixpkgs <> " {}"
102 ]
99 ]
103 , ""
100 , ""
104− , "with nixpkgs;"
101+ , "with nixpkgs; let"
105− , "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
110 ]
104 ]
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;"
118 ]
112 ]
119 , "}"
113 , "}"
120 ]
114 ]