git.iko.soy/typeable/cabal2nix
on master help sign in
Remove support for Stackage Nightly.

Our generated package sets follow the latest LTS release now.

commitca03454f39c0ee9a3a0d3f2d43dbdb38ba771884 authorPeter Simons <simons@cryp.to> dateWed 14 Sep 2016, 19:25 (10 years ago) parent9d0fb31
2 files changed+2−52
hackage2nix/Main.hs+2−46 update-nixpkgs.sh−6
hackage2nix/Main.hs+2−46
@@ -46,7 +46,6 @@ data CLI = CLI
4646 , preferredVersionsFile :: Maybe FilePath
4747 , nixpkgsRepository :: FilePath
4848 , ltsHaskellRepository :: FilePath
49− , stackageNightlyRepository :: FilePath
5049 , configFile :: FilePath
5150 , targetPlatform :: Platform
5251 }
@@ -60,7 +59,6 @@ main = do
6059 <*> optional (strOption (long "preferred-versions" <> help "path to Hackage preferred-versions file" <> value "hackage/preferred-versions" <> showDefault <> metavar "PATH"))
6160 <*> strOption (long "nixpkgs" <> help "path to Nixpkgs repository" <> value "nixpkgs" <> showDefaultWith id <> metavar "PATH")
6261 <*> strOption (long "lts-haskell" <> help "path to LTS Haskell repository" <> value "lts-haskell" <> showDefaultWith id <> metavar "PATH")
63− <*> strOption (long "stackage-nightly" <> help "path to Stackage Nightly repository" <> value "stackage-nightly" <> showDefaultWith id <> metavar "PATH")
6462 <*> strOption (long "config" <> help "path to configuration file inside of Nixpkgs" <> value "pkgs/development/haskell-modules/configuration-hackage2nix.yaml" <> showDefaultWith id <> metavar "PATH")
6563 <*> option (fmap fromString str) (long "platform" <> help "target platform to generate package set for" <> value "x86_64-linux" <> showDefaultWith display <> metavar "PLATFORM")
6664
@@ -83,10 +81,9 @@ main = do
8381 . Map.delete "type" -- TODO: https://github.com/NixOS/cabal2nix/issues/163
8482 hackage <- fixup <$> readHackage hackageRepository
8583 lts <- readLTSHaskell ltsHaskellRepository
86− nightly <- readStackageNightly stackageNightlyRepository
8784 let
8885 config :: Configuration
89− config = config' { defaultPackageOverrides = [ Dependency n (thisVersion (Stackage.version spec)) | (n, spec) <- Map.toList (packages nightly) ] }
86+ config = config' { defaultPackageOverrides = [ Dependency n (thisVersion (Stackage.version spec)) | (n, spec) <- Map.toList (packages lts) ] }
9087
9188 hackagePackagesFile :: FilePath
9289 hackagePackagesFile = nixpkgsRepository </> "pkgs/development/haskell-modules/hackage-packages.nix"
@@ -114,7 +111,7 @@ main = do
114111 [ Map.singleton name (Set.singleton (resolveConstraint c hackage)) | c@(Dependency name _) <- extraPackages config ]
115112
116113 stackagePackageSet :: Map PackageName (Map Version Spec)
117− stackagePackageSet = Map.fromListWith (Map.unionWith mergeSpecs) [ (n, Map.singleton (Stackage.version spec) spec) | snapshot <- [nightly,lts], (n, spec) <- Map.toList (packages snapshot) ]
114+ stackagePackageSet = Map.fromListWith (Map.unionWith mergeSpecs) [ (n, Map.singleton (Stackage.version spec) spec) | snapshot <- [lts], (n, spec) <- Map.toList (packages snapshot) ]
118115
119116 db :: PackageMultiSet
120117 db = Map.unionsWith Set.union [ Map.map Set.singleton generatedDefaultPackageSet
@@ -187,47 +184,6 @@ main = do
187184 mapM_ (\pkg -> hPutStrLn h pkg >> hPutStrLn h "") pkgs
188185 hPutStrLn h "}"
189186
190− forM_ [lts] $ \Snapshot {..} -> liftIO $ do
191− let allPackages :: PackageSet
192− allPackages = Map.difference
193− (Map.fromList [ (name, Stackage.version spec) | (name, spec) <- Map.toList packages ] `Map.union` generatedDefaultPackageSet)
194− corePackages'
195−
196− ltsConfigFile :: FilePath
197− ltsConfigFile = nixpkgsRepository </> "pkgs/development/haskell-modules/configuration-lts.nix"
198−
199− corePackages' :: PackageSet
200− corePackages' = corePackages `Map.union` Map.fromList [("Cabal", Version [] []), ("rts", Version [] [])]
201−
202− withFile ltsConfigFile WriteMode $ \h -> do
203− hPutStrLn h "{ pkgs }:"
204− hPutStrLn h ""
205− hPutStrLn h "with import ./lib.nix { inherit pkgs; };"
206− hPutStrLn h ""
207− hPutStrLn h "self: super: {"
208− hPutStrLn h ""
209− hPutStrLn h " # core libraries provided by the compiler"
210− forM_ (Map.keys corePackages') $ \n ->
211− unless (n == "ghc") (hPutStrLn h (" " ++ unPackageName n ++ " = null;"))
212− hPutStrLn h ""
213− hPutStrLn h (" # " ++ show (pPrint snapshot) ++ " packages")
214− forM_ (Map.toList allPackages) $ \(name, v) -> do
215− let pkgId = PackageIdentifier name v
216−
217− isInDefaultPackageSet :: Bool
218− isInDefaultPackageSet = maybe False (== v) (Map.lookup name generatedDefaultPackageSet)
219−
220− isInStackage :: Bool
221− isInStackage = isJust (Map.lookup name packages)
222− case (isInStackage,isInDefaultPackageSet) of
223− (True,True) -> return () -- build is visible and enabled
224− (True,False) -> hPutStrLn h (" " ++ show (unPackageName name) ++ " = doDistribute super." ++ show (mangle pkgId) ++ ";")
225− (False,True) -> hPutStrLn h (" " ++ show (unPackageName name) ++ " = dontDistribute super." ++ show (unPackageName name) ++ ";")
226− (False,False) -> fail ("logic error processing " ++ display pkgId ++ " in " ++ show (pPrint snapshot))
227− hPutStrLn h ""
228− hPutStrLn h "}"
229−
230−
231187isFromHackage :: Binding -> Bool
232188isFromHackage b = case view (reference . path) b of
233189 ["self",_] -> True
update-nixpkgs.sh−6
@@ -26,11 +26,6 @@ git pull -q
2626ltshaskell=$(git rev-parse --verify HEAD)
2727cd ..
2828
29−cd stackage-nightly
30−git pull -q
31−stackagenightly=$(git rev-parse --verify HEAD)
32−cd ..
33−
3429cd hackage
3530git pull -q
3631rm -f preferred-versions
@@ -60,7 +55,6 @@ This update was generated by hackage2nix $cabal2nix using the following inputs:
6055
6156 - Hackage: https://github.com/commercialhaskell/all-cabal-hashes/commit/$hackage
6257 - LTS Haskell: https://github.com/fpco/lts-haskell/commit/$ltshaskell
63− - Stackage Nightly: https://github.com/fpco/stackage-nightly/commit/$stackagenightly
6458EOF
6559 git push -q
6660fi