git.iko.soy/typeable/stackage2nix
on master help sign in
Sort Stackage packages (#34)
commitb3131d3cdf65e6bddb65de1ee8d993b0b9083de6 authorDmitry Bushev <bushevdv@gmail.com> dateThu 14 Sep 2017, 00:42 (9 years ago) parentbbb8841
1 file changed+17−14
src/Runner.hs+17−14
src/Runner.hs+17−14
@@ -59,22 +59,25 @@ run = do
5959 stackagePackages <- traverse (uncurry (buildNodeM s2nPackageSetConfig s2nPackageConfig))
6060 $ Map.toList (bpPackages buildPlan)
6161
62− -- Find all reachable dependencies in stackage set to stick into
63− -- stackage packages file. This is performed on the full stackage
64− -- set rather than pruning stackage packages beforehand because
65− -- stackage does not concern itself with build tools while cabal2nix
66− -- does: pruning only after generating full set of packages allows
67− -- us to make sure all those extra dependencies are explicitly
68− -- listed as well.
69− let reachableStackagePackages = case opts ^. optOutPackagesClosure of
70− True -> flip reachableDependencies stackagePackages
71− -- Originally reachable nodes are root nodes
72− $ L.filter (\n -> mkPackageName (nodeName n) `Set.member` reachable) stackagePackages
73− False -> stackagePackages
62+ let
63+ -- Find all reachable dependencies in stackage set to stick into
64+ -- stackage packages file. This is performed on the full stackage
65+ -- set rather than pruning stackage packages beforehand because
66+ -- stackage does not concern itself with build tools while cabal2nix
67+ -- does: pruning only after generating full set of packages allows
68+ -- us to make sure all those extra dependencies are explicitly
69+ -- listed as well.
70+ reachableStackagePackages = case opts ^. optOutPackagesClosure of
71+ True -> flip reachableDependencies stackagePackages
72+ -- Originally reachable nodes are root nodes
73+ $ L.filter (\n -> mkPackageName (nodeName n) `Set.member` reachable) stackagePackages
74+ False -> stackagePackages
75+ -- Sort final packages to make the order consistent
76+ nodes = L.sortOn nodeName reachableStackagePackages
7477 writeOutFile buildPlanFile (opts ^. optOutStackagePackages)
75− $ pPrintOutPackages (view nodeDerivation <$> reachableStackagePackages)
78+ $ pPrintOutPackages (view nodeDerivation <$> nodes)
7679 writeOutFile buildPlanFile (opts ^. optOutStackageConfig)
77− $ pPrintOutConfig (bpSystemInfo buildPlan) reachableStackagePackages
80+ $ pPrintOutConfig (bpSystemInfo buildPlan) nodes
7881 writeOutFile (stackYaml ^. syFilePath) (opts ^. optOutDerivation)
7982 $ PP.overrideHaskellPackages overrideConfig stackConfPackages
8083