packages feed

cabal2nix 1.55 → 1.56

raw patch · 10 files changed

+62/−45 lines, 10 files

Files

README.md view
@@ -47,9 +47,10 @@ depend on network access. Run the utility with `--help` to see the complete list of supported command line flags. -To add a new package to Nix, the following steps need to be performed:+To add a new package to Nix, checkout the Nixpkgs project from+https://github.com/nixos/nixpkgs.git and run -    $ cd $NIXPKGS_ALL/pkgs/development/libraries/haskell+    $ cd pkgs/development/libraries/haskell     $ mkdir foo     $ cabal2nix cabal://foo-1.0 >foo/default.nix @@ -67,37 +68,38 @@ `meta.maintainers` and `meta.platforms` attribute if these aren't configured yet. Generally speaking, running -    $ hackage4nix $NIXPKGS_ALL+    $ hackage4nix pkgs -should be a *no-op* --- i.e. no files should change! If there are-changes, these indicate that a file has been modified manually, and then-these changes must be investigated to find out what is going on.+in your checked-out copy of the Nixpkgs tree should be a *no-op* ---+i.e. no files should change! If there are changes, these indicate that a+file has been modified manually, and then these changes must be+investigated to find out what is going on.  Last but not least, `hackage4nix` generates a list of all updates available from Hackage. (Run `cabal update` to make sure that your local copy of the Hackage database is up-to-date!) For example: -    $ hackage4nix $NIXPKGS_ALL+    $ hackage4nix pkgs     The following updates are available:      WebBits-Html-1.0.1:-      cabal2nix cabal://WebBits-Html-1.0.2 >$NIXPKGS_ALL/pkgs/development/libraries/haskell/WebBits-Html/default.nix+      cabal2nix cabal://WebBits-Html-1.0.2 >pkgs/pkgs/development/libraries/haskell/WebBits-Html/default.nix      happstack-server-6.1.6:-      cabal2nix cabal://happstack-server-6.2.1 >$NIXPKGS_ALL/pkgs/development/libraries/haskell/happstack/happstack-server.nix-      cabal2nix cabal://happstack-server-6.2.2 >$NIXPKGS_ALL/pkgs/development/libraries/haskell/happstack/happstack-server.nix+      cabal2nix cabal://happstack-server-6.2.1 >pkgs/pkgs/development/libraries/haskell/happstack/happstack-server.nix+      cabal2nix cabal://happstack-server-6.2.2 >pkgs/pkgs/development/libraries/haskell/happstack/happstack-server.nix      primitive-0.3.1:-      cabal2nix cabal://primitive-0.4 >$NIXPKGS_ALL/pkgs/development/libraries/haskell/primitive/default.nix+      cabal2nix cabal://primitive-0.4 >pkgs/pkgs/development/libraries/haskell/primitive/default.nix      repa-2.1.1.5:-      cabal2nix cabal://repa-2.1.1.6 >$NIXPKGS_ALL/pkgs/development/libraries/haskell/repa/default.nix+      cabal2nix cabal://repa-2.1.1.6 >pkgs/pkgs/development/libraries/haskell/repa/default.nix      unix-compat-0.2.2.1:-      cabal2nix cabal://unix-compat-0.3 >$NIXPKGS_ALL/pkgs/development/libraries/haskell/unix-compat/default.nix+      cabal2nix cabal://unix-compat-0.3 >pkgs/pkgs/development/libraries/haskell/unix-compat/default.nix      vector-0.7.1:-      cabal2nix cabal://vector-0.8 >$NIXPKGS_ALL/pkgs/development/libraries/haskell/vector/default.nix+      cabal2nix cabal://vector-0.8 >pkgs/pkgs/development/libraries/haskell/vector/default.nix  These updates can be performed automatically by running the `cabal2nix` command given by `hackage4nix`. If there is more than one possible
cabal2nix.cabal view
@@ -1,5 +1,5 @@ Name:                   cabal2nix-Version:                1.55+Version:                1.56 Copyright:              Peter Simons, Andres Loeh License:                BSD3 License-File:           LICENSE@@ -34,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.55/cabal2nix.cabal-  > cabal2nix cabal://cabal2nix-1.55+  > cabal2nix http://hackage.haskell.org/packages/archive/cabal2nix/1.56/cabal2nix.cabal+  > cabal2nix cabal://cabal2nix-1.56   .   If the @--sha256@ option has not been specified, cabal2nix calls   @nix-prefetch-url@ to determine the hash automatically. This causes
src/Cabal2Nix/Flags.hs view
@@ -11,8 +11,9 @@                                   , enable "Pairing", enable "XMPP", enable "DNS"                                   , enable "Production", enable "TDFA"]  | name == "haskeline"          = [enable "terminfo"]+ | name == "hslua"              = [enable "system-lua"]  | name == "reactive-banana-wx" = [disable "buildExamples"]- | name == "xmobar"             = [enable "with_xft"]+ | name == "xmobar"             = [enable "with_xft", enable "with_iwlib"]  | name == "xmonad-extras"      = [disable "with_hlist", enable "with_split", enable "with_parsec"]  | otherwise                    = [] 
src/Cabal2Nix/Generate.hs view
@@ -33,11 +33,12 @@   , testTarget     = ""   , phaseOverrides = ""   , metaSection    = Meta-                   { homepage    = Cabal.homepage descr-                   , description = Cabal.synopsis descr-                   , license     = fromCabalLicense (Cabal.license descr)-                   , platforms   = []-                   , maintainers = []+                   { homepage       = Cabal.homepage descr+                   , description    = Cabal.synopsis descr+                   , license        = fromCabalLicense (Cabal.license descr)+                   , platforms      = []+                   , hydraPlatforms = []+                   , maintainers    = []                    }   }   where
src/Cabal2Nix/Hackage.hs view
@@ -45,7 +45,7 @@   where getHackageHash = do             let command = "exec nix-prefetch-url 2>/dev/tty " ++ hackagePath pkg TarGz             handle handlePrefetchError (readProcess "bash" ["-c", command] "")-        handlePrefetchError (SomeException _) = do+        handlePrefetchError (SomeException _) =            error $ "\nError: Cannot compute hash. (Not a hackage project?)\n" ++                   "Specify hash explicitly via --sha256 and add appropriate \"src\" attribute " ++                   "to resulting nix expression."
src/Cabal2Nix/Name.hs view
@@ -48,6 +48,7 @@ libNixName "icui18n"            = return "icu" libNixName "icuuc"              = return "icu" libNixName "idn"                = return "libidn"+libNixName "IL"                 = return "libdevil" libNixName "iw"                 = return "wirelesstools" libNixName "jpeg"               = return "libjpeg" libNixName "libglade-2.0"       = return "libglade"
src/Cabal2Nix/PostProcess.hs view
@@ -35,6 +35,7 @@   | pname == "hflags"           = deriv { metaSection = metaSection { license = Unknown (Just "Apache-2.0") } }   | pname == "HFuse"            = deriv { phaseOverrides = hfusePreConfigure }   | pname == "highlighting-kate"= highlightingKatePostProcessing deriv+  | pname == "HList"            = deriv { buildTools = "diffutils":buildTools }   | pname == "hmatrix"          = deriv { extraLibs = "gsl":"liblapack":"blas":extraLibs }   | pname == "hspec"            = deriv { doCheck = False }   | pname == "idris"            = deriv { buildTools = "happy":buildTools, extraLibs = "gmp":"boehmgc":extraLibs }@@ -116,7 +117,7 @@   , "  #!/bin/sh"   , "  COMMAND=\\$1"   , "  shift"-  , "  eval exec $out/ghc-mod \\$COMMAND \\$( ${self.ghc.GHCGetPackages} ${self.ghc.ghcVersion} | tr \" \" \"\\n\" | tail -n +2 | paste -d \" \" - - | sed 's/.*/-g \"&\"/' | tr \"\\n\" \" \") \"\\$@\""+  , "  eval exec $out/ghc-mod \\$COMMAND \\$( ${self.ghc.GHCGetPackages} ${self.ghc.version} | tr \" \" \"\\n\" | tail -n +2 | paste -d \" \" - - | sed 's/.*/-g \"&\"/' | tr \"\\n\" \" \") \"\\$@\""   , "  EOF"   , "  chmod +x $out/bin/ghc-mod"   , "'';"
src/Distribution/NixOS/Derivation/Cabal.hs view
@@ -102,8 +102,8 @@                   ++ map text (configureFlags deriv)  -- | A very incomplete parser that extracts 'pname', 'version',--- 'sha256', 'platforms', 'maintainers', and 'runHaddock' from the given--- Nix expression.+-- 'sha256', 'platforms', 'hydraPlatforms', 'maintainers', 'doCheck',+-- 'jailbreak', and 'runHaddock' from the given Nix expression.  parseDerivation :: String -> Maybe Derivation parseDerivation buf@@ -113,6 +113,7 @@   , Just vers <- simpleParse vers'   , [sha]     <- buf `regsubmatch` "sha256 *= *\"([^\"]+)\""   , plats     <- buf `regsubmatch` "platforms *= *([^;]+);"+  , hplats    <- buf `regsubmatch` "hydraPlatforms *= *([^;]+);"   , maint     <- buf `regsubmatch` "maintainers *= *\\[([^\"]+)]"   , noHaddock <- buf `regsubmatch` "noHaddock *= *(true|false) *;"   , jailBreak <- buf `regsubmatch` "jailbreak *= *(true|false) *;"@@ -136,11 +137,12 @@                   , testTarget     = ""                   , phaseOverrides = ""                   , metaSection  = Meta-                                   { homepage    = ""-                                   , description = ""-                                   , license     = Unknown Nothing-                                   , maintainers = concatMap words maint-                                   , platforms   = concatMap words (map (map (\c -> if c == '+' then ' ' else c)) plats)+                                   { homepage       = ""+                                   , description    = ""+                                   , license        = Unknown Nothing+                                   , maintainers    = concatMap words maint+                                   , platforms      = concatMap words (map (map (\c -> if c == '+' then ' ' else c)) plats)+                                   , hydraPlatforms = concatMap words (map (map (\c -> if c == '+' then ' ' else c)) hplats)                                    }                   }   | otherwise = Nothing
src/Distribution/NixOS/Derivation/Meta.hs view
@@ -30,8 +30,7 @@ -- >   homepage = "http://example.org"; -- >   description = "an example package"; -- >   license = "unknown";--- >   platforms =--- >     stdenv.lib.platforms.unix ++ stdenv.lib.platforms.cygwin;+-- >   platforms = stdenv.lib.platforms.unix ++ stdenv.lib.platforms.cygwin; -- >   maintainers = [ stdenv.lib.maintainers.joe stdenv.lib.maintainers.jane ]; -- > }; --@@ -39,11 +38,12 @@ -- but no parsing as of now!  data Meta = Meta-  { homepage    :: String       -- ^ URL of the package homepage-  , description :: String       -- ^ short description of the package-  , license     :: License      -- ^ licensing terms-  , platforms   :: [String]     -- ^ list of supported platforms from @pkgs\/lib\/platforms.nix@-  , maintainers :: [String]     -- ^ list of maintainers from @pkgs\/lib\/maintainers.nix@+  { homepage       :: String    -- ^ URL of the package homepage+  , description    :: String    -- ^ short description of the package+  , license        :: License   -- ^ licensing terms+  , platforms      :: [String]  -- ^ list of supported platforms (from @pkgs\/lib\/platforms.nix@)+  , hydraPlatforms :: [String]  -- ^ list of platforms built by Hydra (from @pkgs\/lib\/platforms.nix@)+  , maintainers    :: [String]  -- ^ list of maintainers from @pkgs\/lib\/maintainers.nix@   }   deriving (Show, Eq, Ord) @@ -59,10 +59,14 @@     , onlyIf (description meta) $ attr "description" $ string (description meta)     , attr "license" $ disp (license meta)     , onlyIf (platforms meta) $ sep-      [ text "platforms" <+> equals-      , nest 2 (fsep $ punctuate (text " ++") $ map text (platforms meta)) <> semi-      ]+      [ text "platforms" <+> equals, renderPlatformList (platforms meta) ]+    , onlyIf (hydraPlatforms meta) $ sep+      [ text "hydraPlatforms" <+> equals, renderPlatformList (hydraPlatforms meta) ]     , listattr "maintainers" (maintainers meta)     ]   , rbrace <> semi   ]++renderPlatformList :: [String] -> Doc+renderPlatformList plats =+  nest 2 (fsep $ punctuate (text " ++") $ map text plats) <> semi
src/hackage4nix.hs view
@@ -111,6 +111,7 @@         let Pkg deriv path regenerate = nix             maints = maintainers (metaSection deriv)             plats  = platforms (metaSection deriv)+            hplats = hydraPlatforms (metaSection deriv)         modify (Set.insert nix)         when regenerate $ do           msgDebug ("re-generate " ++ path)@@ -123,8 +124,9 @@               meta    = metaSection deriv'               plats'  = if null plats then platforms meta else plats               deriv'' = deriv' { metaSection = meta-                                               { maintainers = maints -- ++ ["andres","simons"]-                                               , platforms   = plats'+                                               { maintainers    = maints -- ++ ["andres","simons"]+                                               , platforms      = plats'+                                               , hydraPlatforms = hplats                                                }                                }           io $ writeFile path (show (disp (normalize deriv'')))@@ -149,7 +151,7 @@ genCabal2NixCmdline (Pkg deriv path _) = unwords $ ["cabal2nix"] ++ opts ++ ['>':path']   where     meta = metaSection deriv-    opts = [cabal] ++ maints' ++ plats'+    opts = [cabal] ++ maints' ++ plats' ++ hplats'                    ++ (if jailbreak deriv then ["--jailbreak"] else [])                    ++ (if runHaddock deriv then [] else ["--no-haddock"])                    ++ (if doCheck deriv then [] else ["--no-check"])@@ -158,6 +160,9 @@     plats'       | ["self.ghc.meta.platforms"] == platforms meta = []       | otherwise                                     = [ "--platform=" ++ p | p <- platforms meta ]+    hplats'+      | ["self.ghc.meta.platforms"] == platforms meta = []+      | otherwise                                     = [ "--hydra-platform=" ++ p | p <- platforms meta ]     path'       | path =~ "/[0-9\\.]+\\.nix$" = replaceFileName path (display (version deriv) <.> "nix")       | otherwise                   = path