packages feed

cabal2nix 1.71 → 1.72

raw patch · 10 files changed

+44/−23 lines, 10 filesdep ~Cabal

Dependency ranges changed: Cabal

Files

README.md view
@@ -4,7 +4,7 @@ ## Overview over the tool-chain  There are two utilities, `cabal2nix` and `hackage4nix`, that automate-maintenance to a large extend. We intend to merge them into one program,+maintenance to a large extent. We intend to merge them into one program, eventually, but the necessary re-factoring hasn't been done yet since this is not a high priority. 
cabal2nix.cabal view
@@ -1,5 +1,5 @@ Name:                   cabal2nix-Version:                1.71+Version:                1.72 Copyright:              Peter Simons, Andres Loeh License:                BSD3 License-File:           LICENSE@@ -18,6 +18,7 @@   .   > Usage: cabal2nix [options] url-to-cabal-file-or-repo   >   -h             --help                   show this help text+  >   -v             --version                print version   >                  --hackage-db=FILEPATH    path to the local hackage db in tar format   >                  --sha256=HASH            sha256 hash of source tarball   >   -m MAINTAINER  --maintainer=MAINTAINER  maintainer of this package (may be specified multiple times)@@ -38,8 +39,8 @@   .   The only required argument is the path to the cabal file. For example:   .-  > cabal2nix http://hackage.haskell.org/packages/archive/cabal2nix/1.71/cabal2nix.cabal-  > cabal2nix cabal://cabal2nix-1.71+  > cabal2nix http://hackage.haskell.org/packages/archive/cabal2nix/1.72/cabal2nix.cabal+  > cabal2nix cabal://cabal2nix-1.72   .   If the @--sha256@ option has not been specified, cabal2nix calls   @nix-prefetch-url@ to determine the hash automatically. This causes@@ -69,6 +70,7 @@                         Cabal2Nix.Name                         Cabal2Nix.Normalize                         Cabal2Nix.PostProcess+                        Cabal2Nix.Version                         Distribution.NixOS.Fetch                         Distribution.NixOS.Derivation.Cabal                         Distribution.NixOS.Derivation.License
src/Cabal2Nix/Flags.hs view
@@ -13,7 +13,7 @@  | name == "haste-compiler"     = [enable "portable"]  | name == "hslua"              = [enable "system-lua"]  | name == "hxt"                = [enable "network-uri"]- | name == "idris"              = [enable "llvm", enable "gmp", enable "ffi"]+ | name == "idris"              = [enable "gmp", enable "ffi"]  | name == "io-streams"         = [enable "NoInteractiveTests"]  | name == "pandoc"             = [enable "https", enable "make-pandoc-man-pages"]  | name == "reactive-banana-wx" = [disable "buildExamples"]
src/Cabal2Nix/Name.hs view
@@ -81,6 +81,7 @@ libNixName "sqlite3"                            = return "sqlite" libNixName "ssl"                                = return "openssl" libNixName "stdc++"                             = []  -- in stdenv+libNixName "systemd-journal"                    = return "systemd" libNixName "webkit-1.0"                         = return "webkit" libNixName "X11"                                = return "libX11" libNixName "Xext"                               = return "libXext"
src/Cabal2Nix/Package.hs view
@@ -26,6 +26,7 @@   { source :: DerivationSource   , cabal :: Cabal.GenericPackageDescription   }+  deriving (Show)  getPackage :: Maybe String -> Source -> IO Package getPackage optHackageDB source = do@@ -83,7 +84,7 @@    -- Use the cached hash (either from cache file or given on cmdline via sha256 opt)   -- if available, otherwise download from hackage to compute hash.-  maybeHash <- runMaybeT $ cachedHash <|> derivHash . fst <$> fetchWith (False, "url") (Source url "" Nothing)+  maybeHash <- runMaybeT $ cachedHash <|> derivHash . fst <$> fetchWith (False, "url", []) (Source url "" Nothing)   case maybeHash of     Just hash ->       -- We need to force the hash here. If we didn't do this, then when reading the
src/Cabal2Nix/PostProcess.hs view
@@ -87,6 +87,7 @@   | pname == "pcap"             = deriv { extraLibs = "libpcap":extraLibs }   | pname == "persistent"       = deriv { extraLibs = "sqlite3":extraLibs }   | pname == "poppler"          = deriv { extraLibs = "libc":extraLibs }+  | pname == "purescript"       = deriv { testDepends = "nodejs":testDepends }   | pname == "QuickCheck" && version >= Version [2,7,3] []                                 = deriv { runHaddock = True, phaseOverrides = quickCheckNoHaddock }   | pname == "repa-algorithms"  = deriv { extraLibs = "llvm":extraLibs }
+ src/Cabal2Nix/Version.hs view
@@ -0,0 +1,7 @@+module Cabal2Nix.Version where++import Data.Version (showVersion)+import Paths_cabal2nix (version)++version :: String+version = showVersion Paths_cabal2nix.version
src/Distribution/NixOS/Fetch.hs view
@@ -23,7 +23,7 @@ data Source = Source   { sourceUrl       :: String       -- ^ URL to fetch from.   , sourceRevision  :: String       -- ^ Revision to use. For protocols where this doesn't make sense (such as HTTP), this-                                   --   should be the empty string.+                                    --   should be the empty string.   , sourceHash      :: Maybe String -- ^ The expected hash of the source, if available.   } deriving (Show, Eq, Ord) @@ -48,12 +48,12 @@ fetch f = runMaybeT . fetchers where   fetchers :: Source -> MaybeT IO (DerivationSource, a)   fetchers source = msum . (fetchLocal source :) $ map (\fetcher -> fetchWith fetcher source >>= process)-    [ (False, "zip")-    , (False, "url")-    , (True, "git")-    , (True, "hg")-    , (True, "svn")-    , (True, "bzr")+    [ (False, "zip", [])+    , (False, "url", [])+    , (True, "git", ["--fetch-submodules"])+    , (True, "hg", [])+    , (True, "svn", [])+    , (True, "bzr", [])     ]    -- | Remove '/' from the end of the path. Nix doesn't accept paths that@@ -74,15 +74,15 @@   localArchive :: FilePath -> MaybeT IO (DerivationSource, a)   localArchive path = do     absolutePath <- liftIO $ canonicalizePath path-    unpacked <- snd <$> fetchWith (False, "zip") (Source ("file://" ++ absolutePath) "" Nothing)+    unpacked <- snd <$> fetchWith (False, "zip", []) (Source ("file://" ++ absolutePath) "" Nothing)     process (DerivationSource "" absolutePath "" "", unpacked)    process :: (DerivationSource, FilePath) -> MaybeT IO (DerivationSource, a)   process (derivSource, file) = (,) derivSource <$> f file  -- | Like 'fetch', but allows to specify which script to use.-fetchWith :: (Bool, String) -> Source -> MaybeT IO (DerivationSource, FilePath)-fetchWith (supportsRev, kind) source = do+fetchWith :: (Bool, String, [String]) -> Source -> MaybeT IO (DerivationSource, FilePath)+fetchWith (supportsRev, kind, addArgs) source = do   unless ((sourceRevision source /= "") || isNothing (sourceHash source) || not supportsRev) $     liftIO (hPutStrLn stderr "** need a revision for VCS when the hash is given. skipping.") >> mzero @@ -106,7 +106,7 @@    script = "nix-prefetch-" ++ kind     args :: [String]-   args = sourceUrl source : [ sourceRevision source | supportsRev ] ++ maybeToList (sourceHash source)+   args = addArgs ++ sourceUrl source : [ sourceRevision source | supportsRev ] ++ maybeToList (sourceHash source)     processOutputWithRev :: [String] -> IO (DerivationSource, FilePath)    processOutputWithRev [rev,hash,path] = return (DerivationSource kind (sourceUrl source) (extractRevision rev) hash, path)
src/cabal2nix.hs view
@@ -3,7 +3,8 @@ import Cabal2Nix.Generate ( cabal2nix ) import Cabal2Nix.Normalize ( normalize ) import Cabal2Nix.Package-import Distribution.NixOS.Derivation.Cabal+import Cabal2Nix.Version+import Distribution.NixOS.Derivation.Cabal hiding ( version ) import Distribution.NixOS.Fetch  import Control.Exception ( bracket )@@ -47,6 +48,7 @@ options :: [OptDescr (Configuration -> Configuration)] options =   [ Option "h" ["help"]       (NoArg (\o -> o { optPrintHelp = True }))                                  "show this help text"+  , Option "v" ["version"]    (NoArg (\o -> o { optPrintVersion = True }))                               "print version"   , Option ""  ["hackage-db"] (ReqArg (\x o -> o { optHackageDb = Just x }) "FILEPATH")                  "path to the local hackage db in tar format"   , Option ""  ["sha256"]     (ReqArg (\x o -> o { optSha256 = Just x }) "HASH")                         "sha256 hash of source tarball"   , Option "m" ["maintainer"] (ReqArg (\x o -> o { optMaintainer = x : optMaintainer o }) "MAINTAINER")  "maintainer of this package (may be specified multiple times)"@@ -87,11 +89,16 @@                   (_,_,errs) -> cmdlineError (concatMap ("*** "++) errs)    when (optPrintHelp cfg) (putStr usage >> exitSuccess)+  when (optPrintVersion cfg) (putStrLn version >> exitSuccess)   when (length args /= 1) (cmdlineError "*** exactly one url-to-cabal-file must be specified\n")    pkg <- getPackage (optHackageDb cfg) $ Source (head args) (optRevision cfg) (optSha256 cfg) -  let deriv  = (cabal2nix $ cabal pkg) { src = source pkg, runHaddock = optHaddock cfg, jailbreak = optJailbreak cfg }+  let deriv  = (cabal2nix $ cabal pkg) { src = source pkg+                                       , runHaddock = optHaddock cfg+                                       , jailbreak = optJailbreak cfg+                                       , hyperlinkSource = optHyperlinkSource cfg+                                       }       deriv' = deriv { metaSection = (metaSection deriv)                                      { maintainers = optMaintainer cfg                                      , platforms   = optPlatform cfg
test/doc-test.hs view
@@ -16,16 +16,18 @@  main :: IO () main = do-  let libs = [ "src/Cabal2Nix/License.hs"+  let libs = [ "dist/build/autogen/Paths_cabal2nix.hs"+             , "src/Cabal2Nix/License.hs"              , "src/Cabal2Nix/CorePackages.hs"              , "src/Cabal2Nix/Flags.hs"              , "src/Cabal2Nix/Generate.hs"-             , "src/Cabal2Nix/Package.hs"-             , "src/Cabal2Nix/Normalize.hs"              , "src/Cabal2Nix/Name.hs"+             , "src/Cabal2Nix/Normalize.hs"+             , "src/Cabal2Nix/Package.hs"              , "src/Cabal2Nix/PostProcess.hs"-             , "src/Distribution/NixOS/Derivation/License.hs"+             , "src/Cabal2Nix/Version.hs"              , "src/Distribution/NixOS/Derivation/Cabal.hs"+             , "src/Distribution/NixOS/Derivation/License.hs"              , "src/Distribution/NixOS/Derivation/Meta.hs"              , "src/Distribution/NixOS/Fetch.hs"              , "src/Distribution/NixOS/PrettyPrinting.hs"