packages feed

cabal2nix 1.49 → 1.50

raw patch · 6 files changed

+45/−40 lines, 6 files

Files

README.md view
@@ -108,32 +108,23 @@  ## Current State of Affairs -The tool-chain is stable. As of today, 2011-08-30, almost all Haskell+The tool-chain is stable. As of today, 2013-04-12, virtually all Haskell packages available in Nix have been generated automatically from their-Cabal files. The exceptions are:--*   "Bad packages" that cannot be generated automatically because there-    is no proper Cabal file for them, or because their builds are so-    complicated that the `cabal.nix` build doesn't suffice to do the-    trick. The list of bad packages is hard-coded into-    [`hackage4nix.hs`](http://github.com/NixOS/cabal2nix/blob/master/src/Hackage4Nix.hs),-    in the functions `badPackagePaths` and `patchedPackages`. Any-    package list in there is going to be ignored by `hackage4nix`.+Cabal files. There are only a handful of exceptions, which we cannot+generate because these packages aren't available on Hackage. The list of+those packages is hard-coded into the+[`hackage4nix.hs`](http://github.com/NixOS/cabal2nix/blob/master/src/Hackage4Nix.hs)+binary in the function `badPackagePaths`. -*   "Patched packages" cannot be generated automatically, because their-    build instructions need patches that `cabal2nix` doesn't (yet) know-    about. There is a hard-coded list of patched packages in-    [`hackage4nix`](http://github.com/NixOS/cabal2nix/blob/master/src/Hackage4Nix.hs).-    Furthermore, all build expressions that define any of the attributes+Furthermore, Hackage4Nix will not re-generate packages that have been+patched, i.e. that define any of the following attributes:          (pre|post)Configure         (pre|post)Install         patchPhase         patches -    are considered "patched". That list of attributes is hard-coded in-    [`hackage4nix.hs`](http://github.com/NixOS/cabal2nix/blob/master/src/Hackage4Nix.hs)-    in the function `regenerateDerivation`.+These packages are considered for updates, however.  The complete list of Haskell packages available in Nix is generated by the tool [`package-list`](http://github.com/peti/package-list),
cabal2nix.cabal view
@@ -1,5 +1,5 @@ Name:                   cabal2nix-Version:                1.49+Version:                1.50 Copyright:              Peter Simons, Andres Loeh License:                BSD3 License-File:           LICENSE@@ -22,6 +22,7 @@   >   -m MAINTAINER  --maintainer=MAINTAINER  maintainer of this package (may be specified multiple times)   >   -p PLATFORM    --platform=PLATFORM      supported build platforms (may be specified multiple times)   >                  --no-check               don't run regression test suites of this package+  >                  --jailbreak              don't honor version restrictions on build inputs   >   > Recognized URI schemes:   >@@ -33,8 +34,8 @@   .   The only required argument is the path to the cabal file. For example:   .-  > cabal2nix http://hackage.haskell.org/packages/archive/cabal2nix/1.49/cabal2nix.cabal-  > cabal2nix cabal://cabal2nix-1.49+  > cabal2nix http://hackage.haskell.org/packages/archive/cabal2nix/1.50/cabal2nix.cabal+  > cabal2nix cabal://cabal2nix-1.50   .   If the @--sha256@ option has not been specified, cabal2nix calls   @nix-prefetch-url@ to determine the hash automatically. This causes
src/Cabal2Nix.hs view
@@ -23,6 +23,7 @@   , optPlatform :: [String]   , optHaddock :: Bool   , optDoCheck :: Bool+  , optJailbreak :: Bool   }   deriving (Show) @@ -35,6 +36,7 @@   , optPlatform = []   , optHaddock = True   , optDoCheck = True+  , optJailbreak = False   }  options :: [OptDescr (Configuration -> Configuration)]@@ -45,6 +47,7 @@   , Option "p" ["platform"]   (ReqArg (\x o -> o { optPlatform = x : optPlatform o }) "PLATFORM")        "supported build platforms (may be specified multiple times)"   , Option ""  ["no-haddock"] (NoArg (\o -> o { optHaddock = False }))                                   "don't run Haddock when building this package"   , Option ""  ["no-check"]   (NoArg (\o -> o { optDoCheck = False }))                                   "don't run regression test suites of this package"+  , Option ""  ["jailbreak"]  (NoArg (\o -> o { optJailbreak = True }))                                  "don't honor version restrictions on build inputs"   ]  usage :: String@@ -83,7 +86,7 @@   let packageId = package (packageDescription cabal)   sha <- if null (optSha256 cfg) then hashPackage packageId else return (optSha256 cfg) -  let deriv  = (cabal2nix cabal) { sha256 = sha, runHaddock = optHaddock cfg }+  let deriv  = (cabal2nix cabal) { sha256 = sha, runHaddock = optHaddock cfg, jailbreak = optJailbreak cfg }       deriv' = deriv { metaSection = (metaSection deriv)                                      { maintainers = optMaintainer cfg                                      , platforms   = optPlatform cfg
src/Cabal2Nix/Name.hs view
@@ -18,6 +18,7 @@ -- identity mappings to incicate that I have verified their correctness. libNixName :: String -> [String] libNixName "adns"               = return "adns"+libNixName "alsa"               = return "alsaLib" libNixName "cairo-pdf"          = return "cairo" libNixName "cairo-ps"           = return "cairo" libNixName "cairo"              = return "cairo"@@ -59,6 +60,7 @@ libNixName "xft"                = return "libXft" libNixName "xml2"               = return "libxml2" libNixName "Xrandr"             = return "libXrandr"+libNixName "Xss"                = return "libXScrnSaver" libNixName "zmq"                = return "zeromq" libNixName "z"                  = return "zlib" libNixName x                    = return x
src/Cabal2Nix/PostProcess.hs view
@@ -24,6 +24,7 @@   | pname == "gtksourceview2"   = deriv { extraLibs = "pkgconfig":"libc":extraLibs }   | pname == "haddock"          = deriv { buildTools = "alex":"happy":buildTools }   | pname == "happy"            = deriv { buildTools = "perl":buildTools }+  | pname == "haskeline"        = deriv { buildDepends = "utf8String":buildDepends }   | pname == "haskell-src"      = deriv { buildTools = "happy":buildTools }   | pname == "haskell-src-meta" = deriv { buildDepends = "uniplate":buildDepends }   | pname == "highlighting-kate"= highlightingKatePostProcessing deriv
src/Hackage4Nix.hs view
@@ -71,8 +71,7 @@     (False,_)    -> io (readDirectory dirOrFile) >>= mapM_ (discoverNixFiles yield . (dirOrFile </>))  regenerateDerivation :: Derivation -> String -> Bool-regenerateDerivation deriv buf = (pname deriv `notElem` patchedPackages) &&-                                 not (buf =~ "(pre|post)Configure|(pre|post)Install|patchPhase|patches")+regenerateDerivation deriv buf = not (buf =~ "(pre|post)Configure|(pre|post)Install|patchPhase|patches")  parseNixFile :: FilePath -> String -> Hackage4Nix (Maybe Pkg) parseNixFile path buf@@ -80,8 +79,6 @@                = msgDebug ("ignore non-cabal package " ++ path) >> return Nothing   | any (`isSuffixOf`path) badPackagePaths                = msgDebug ("ignore known bad package " ++ path) >> return Nothing-  | buf =~ "src = (fetchurl|fetchgit|sourceFromHead)"-               = msgDebug ("ignore non-hackage package " ++ path) >> return Nothing   | Just deriv <- parseDerivation buf                = return (Just (Pkg deriv path (regenerateDerivation deriv buf)))   | otherwise = msgInfo ("failed to parse file " ++ path) >> return Nothing@@ -97,8 +94,9 @@ discoverUpdates :: String -> Version -> Hackage4Nix [Version] discoverUpdates name vers = do   db <- asks _hackageDb-  let versions = DB.keys (fromJust (DB.lookup name db))-  return (filter (>vers) versions)+  case DB.lookup name db of+    Just pkgs -> return (filter (>vers) (DB.keys pkgs))+    Nothing   -> fail ("discoverUpdates cannot find package " ++ show name ++ " on Hackage")  updateNixPkgs :: [FilePath] -> Hackage4Nix () updateNixPkgs paths = do@@ -114,11 +112,15 @@         when regenerate $ do           msgDebug ("re-generate " ++ path)           pkg <- getCabalPackage (pname deriv) (version deriv)-          let deriv'  = (cabal2nix pkg) { sha256 = sha256 deriv, runHaddock = runHaddock deriv, jailbreak = jailbreak deriv, doCheck = doCheck deriv }+          let deriv'  = (cabal2nix pkg) { sha256 = sha256 deriv+                                        , runHaddock = runHaddock deriv+                                        , doCheck = doCheck deriv+                                        , jailbreak = jailbreak deriv+                                        }               meta    = metaSection deriv'               plats'  = if null plats then platforms meta else plats               deriv'' = deriv' { metaSection = meta-                                               { maintainers = maints -- ++ ["andres"]+                                               { maintainers = maints -- ++ ["andres","simons"]                                                , platforms   = plats'                                                }                                }@@ -144,7 +146,10 @@ genCabal2NixCmdline (Pkg deriv path _) = unwords $ ["cabal2nix"] ++ opts ++ ['>':path']   where     meta = metaSection deriv-    opts = [cabal] ++ maints' ++ plats' ++ (if runHaddock deriv then [] else ["--no-haddock"]) ++ (if doCheck deriv then [] else ["--no-check"])+    opts = [cabal] ++ maints' ++ plats'+                   ++ (if jailbreak deriv then ["--jailbreak"] else [])+                   ++ (if runHaddock deriv then [] else ["--no-haddock"])+                   ++ (if doCheck deriv then [] else ["--no-check"])     cabal = "cabal://" ++ display (packageId deriv)     maints' = [ "--maintainer=" ++ normalizeMaintainer m | m <- maintainers meta ]     plats'@@ -199,16 +204,18 @@   return ()  --- Packages that we cannot parse.+-- Packages that cabal2nix cannot generate build expressions for.  badPackagePaths :: [FilePath]-badPackagePaths = [ "haskell-platform/2011.2.0.1.nix", "haskell-platform/2011.4.0.0.nix"+badPackagePaths = [ -- These expression are not found on Hackage:+                    "haskell-platform/2009.2.0.2.nix", "haskell-platform/2010.1.0.0.nix"+                  , "haskell-platform/2010.2.0.0.nix", "haskell-platform/2011.2.0.0.nix"+                  , "haskell-platform/2011.2.0.1.nix", "haskell-platform/2011.4.0.0.nix"                   , "haskell-platform/2012.2.0.0.nix", "haskell-platform/2012.4.0.0.nix"-                  , "top-level/all-packages.nix",      "top-level/haskell-packages.nix"+                  , "haskell-platform/2013.2.0.0.nix", "compilers/flapjax/default.nix"+                  , "pkgs/games/uqm/3dovideo.nix"+                    -- Our primitive parser cannot handle these files.+                  , "top-level/all-packages.nix", "top-level/haskell-packages.nix"+                    -- This build is way too complicated to maintain it automatically.+                  , "pkgs/development/compilers/pakcs/default.nix"                   ]---- Packages that we cannot regenerate automatically yet. This list--- should be empty.--patchedPackages :: [String]-patchedPackages = []