git.iko.soy/typeable/cabal2nix
on master help sign in
Merge remote-tracking branch 'origin/master' into feature-local-only

Conflicts: src/Distribution/NixOS/Derivation/Cabal.hs src/hackage4nix.hs

commit5f0d5a2b214dc05a03060337ddebf467c3e71798 authorBenno Fünfstück <benno.fuenfstueck@gmail.com> dateSat 16 Aug 2014, 15:09 (12 years ago) parentc26bde63cf0fa5
13 files changed+134−78
cabal2nix.cabal+5−3 release.nix+3−2 src/Cabal2Nix/Flags.hs+2−4 src/Cabal2Nix/Generate.hs+1 src/Cabal2Nix/Name.hs+1−1 src/Cabal2Nix/Normalize.hs+11−1 src/Cabal2Nix/PostProcess.hs+8−9 src/Distribution/NixOS/Derivation/Cabal.hs+13−14 src/Distribution/NixOS/Derivation/Meta.hs+15−11 src/Distribution/NixOS/PrettyPrinting.hs+3−3 src/Distribution/NixOS/Regex.hs+25 src/hackage4nix.hs+46−30 test/doc-test.hs+1
cabal2nix.cabal+5−3
@@ -1,5 +1,5 @@
11Name: cabal2nix
2−Version: 1.67
2+Version: 1.69
33Copyright: Peter Simons, Andres Loeh
44License: BSD3
55License-File: LICENSE
@@ -37,8 +37,8 @@ Description:
3737 .
3838 The only required argument is the path to the cabal file. For example:
3939 .
40− > cabal2nix http://hackage.haskell.org/packages/archive/cabal2nix/1.67/cabal2nix.cabal
41− > cabal2nix cabal://cabal2nix-1.67
40+ > cabal2nix http://hackage.haskell.org/packages/archive/cabal2nix/1.69/cabal2nix.cabal
41+ > cabal2nix cabal://cabal2nix-1.69
4242 .
4343 If the @--sha256@ option has not been specified, cabal2nix calls
4444 @nix-prefetch-url@ to determine the hash automatically. This causes
@@ -68,6 +68,7 @@ Executable cabal2nix
6868 Distribution.NixOS.Derivation.License
6969 Distribution.NixOS.Derivation.Meta
7070 Distribution.NixOS.PrettyPrinting
71+ Distribution.NixOS.Regex
7172
7273Executable hackage4nix
7374 main-is: hackage4nix.hs
@@ -88,6 +89,7 @@ Executable hackage4nix
8889 Distribution.NixOS.Derivation.License
8990 Distribution.NixOS.Derivation.Meta
9091 Distribution.NixOS.PrettyPrinting
92+ Distribution.NixOS.Regex
9193
9294Test-Suite doctest-cabal2nix
9395 type: exitcode-stdio-1.0
release.nix+3−2
@@ -1,8 +1,9 @@
11/* Build instructions for the continuous integration system Hydra. */
22
33{ cabal2nixSrc ? { outPath = ./.; revCount = 0; gitTag = "dirty"; }
4−, supportedPlatforms ? [ "x86_64-linux" ]
5−, supportedCompilers ? ["ghc6104" "ghc6123" "ghc704" "ghc722" "ghc742" "ghc763" "ghc783" "ghcHEAD"]
4+, releaseBuild ? false
5+, supportedPlatforms ? if releaseBuild then ["i686-linux" "x86_64-linux" "x86_64-darwin"] else ["x86_64-linux"]
6+, supportedCompilers ? if releaseBuild then ["ghc783"] else ["ghc6104" "ghc6123" "ghc704" "ghc722" "ghc742" "ghc763" "ghc783" "ghcHEAD"]
67}:
78
89let
src/Cabal2Nix/Flags.hs+2−4
@@ -7,10 +7,8 @@ configureCabalFlags :: PackageIdentifier -> FlagAssignment
77configureCabalFlags (PackageIdentifier (PackageName name) _)
88 | name == "arithmoi" = [disable "llvm"]
99 | name == "accelerate-examples"= [disable "opencl"]
10− | name == "git-annex" = [ enable "S3", enable "WebDAV", enable "Inotify"
11− , enable "Dbus", enable "Assistant", enable "Webapp"
12− , enable "Pairing", enable "XMPP", enable "DNS"
13− , enable "Production", enable "TDFA"]
10+ | name == "folds" = [disable "test-hlint"]
11+ | name == "git-annex" = [enable "Assistant" , enable "Production"]
1412 | name == "haskeline" = [enable "terminfo"]
1513 | name == "hslua" = [enable "system-lua"]
1614 | name == "idris" = [enable "llvm", enable "gmp", enable "ffi"]
src/Cabal2Nix/Generate.hs+1
@@ -32,6 +32,7 @@ cabal2nix cabal = normalize $ postProcess MkDerivation
3232 , doCheck = True
3333 , testTarget = ""
3434 , hyperlinkSource = True
35+ , enableSplitObjs = True
3536 , phaseOverrides = ""
3637 , metaSection = Meta
3738 { homepage = Cabal.homepage descr
src/Cabal2Nix/Name.hs+1−1
@@ -56,7 +56,7 @@ libNixName "icuuc" = return "icu"
5656libNixName "idn" = return "libidn"
5757libNixName "IL" = return "libdevil"
5858libNixName "iw" = return "wirelesstools"
59−libNixName "jack" = return "jackaudio"
59+libNixName "jack" = return "jack2"
6060libNixName "jpeg" = return "libjpeg"
6161libNixName "libglade-2.0" = return "libglade"
6262libNixName "libgsasl" = return "gsasl"
src/Cabal2Nix/Normalize.hs+11−1
@@ -8,6 +8,7 @@ import Cabal2Nix.CorePackages
88import Data.List
99import Data.Char
1010import Data.Function
11+import Distribution.NixOS.Regex ( regsubmatch )
1112
1213normalize :: Derivation -> Derivation
1314normalize deriv@(MkDerivation {..}) = deriv
@@ -50,9 +51,18 @@ normalizeNixLibs = normalizeList . concatMap libNixName
5051normalizeNixBuildTools :: [String] -> [String]
5152normalizeNixBuildTools = normalizeList . concatMap buildToolNixName
5253
54+-- |Strip the "self.ghc.meta.platforms" prefix from platform names, filter
55+-- duplicates, and sort the resulting list alphabetically.
56+--
57+-- >>> normalizeMaintainers ["self.stdenv.lib.maintainers.foobar", "foobar"]
58+-- ["foobar"]
59+--
60+-- >>> normalizeMaintainers ["any.prefix.is.recognized.yo", "abc.def"]
61+-- ["def","yo"]
62+
5363normalizeMaintainers :: [String] -> [String]
5464normalizeMaintainers maints = normalizeList
55− [ if '.' `elem` m then m else "self.stdenv.lib.maintainers." ++ m | m <- maints ]
65+ [ (m `regsubmatch` "^([^.].*\\.)?([^.]+)$") !! 1 | m <- maints ]
5666
5767normalizePlatforms :: [String] -> [String]
5868normalizePlatforms [] = ["self.ghc.meta.platforms"]
src/Cabal2Nix/PostProcess.hs+8−9
@@ -2,8 +2,8 @@
22
33module Cabal2Nix.PostProcess ( postProcess ) where
44
5−import Distribution.NixOS.Derivation.Cabal
65import Data.List
6+import Distribution.NixOS.Derivation.Cabal
77
88postProcess :: Derivation -> Derivation
99postProcess deriv@(MkDerivation {..})
@@ -19,6 +19,7 @@ postProcess deriv@(MkDerivation {..})
1919 | pname == "cabal-install" && version >= Version [0,14] []
2020 = deriv { phaseOverrides = cabalInstallPostInstall }
2121 | pname == "cairo" = deriv { extraLibs = "pkgconfig":"libc":"cairo":"zlib":extraLibs }
22+ | pname == "cookie" = deriv { phaseOverrides = cookieDoCheckHook }
2223 | pname == "cuda" = deriv { phaseOverrides = cudaConfigurePhase, extraLibs = "cudatoolkit":"nvidia_x11":"self.stdenv.gcc":extraLibs }
2324 | pname == "darcs" = deriv { phaseOverrides = darcsInstallPostInstall }
2425 | pname == "dns" = deriv { testTarget = "spec" }
@@ -36,7 +37,7 @@ postProcess deriv@(MkDerivation {..})
3637 | pname == "glib" = deriv { extraLibs = "pkgconfig":"libc":extraLibs }
3738 | pname == "gloss-raster" = deriv { extraLibs = "llvm":extraLibs }
3839 | pname == "GLUT" = deriv { extraLibs = "glut":"libSM":"libICE":"libXmu":"libXi":"mesa":extraLibs }
39− | pname == "gtk" = deriv { extraLibs = "pkgconfig":"libc":extraLibs, buildDepends = delete "gio" buildDepends }
40+ | pname == "gtk" = deriv { extraLibs = "pkgconfig":"libc":extraLibs }
4041 | pname == "gtkglext" = deriv { pkgConfDeps = "pangox_compat":pkgConfDeps }
4142 | pname == "gtk2hs-buildtools"= deriv { buildDepends = "hashtables":buildDepends }
4243 | pname == "gtksourceview2" = deriv { extraLibs = "pkgconfig":"libc":extraLibs }
@@ -46,13 +47,11 @@ postProcess deriv@(MkDerivation {..})
4647 | pname == "haskeline" = deriv { buildDepends = "utf8String":buildDepends }
4748 | pname == "haskell-src" = deriv { buildTools = "happy":buildTools }
4849 | pname == "haskell-src-meta" = deriv { buildDepends = "uniplate":buildDepends }
49− | pname == "hflags" = deriv { metaSection = metaSection { license = Unknown (Just "Apache-2.0") } }
50− | pname == "hfsevents" = deriv { buildTools = "gccApple":buildTools, phaseOverrides = "configureFlags = \"--ghc-option=-pgmc=${gccApple}/bin/gcc\";" }
5150 | pname == "HFuse" = deriv { phaseOverrides = hfusePreConfigure }
5251 | pname == "highlighting-kate"= highlightingKatePostProcessing deriv
5352 | pname == "hlibgit2" = deriv { testDepends = "git":testDepends }
5453 | pname == "HList" = deriv { buildTools = "diffutils":buildTools }
55− | pname == "hmatrix" = deriv { extraLibs = "gsl":"liblapack":"blas":extraLibs }
54+ | pname == "hmatrix" = deriv { extraLibs = "liblapack":"blas": filter (/= "lapack") extraLibs }
5655 | pname == "hoogle" = deriv { testTarget = "--test-option=--no-net" }
5756 | pname == "hspec" = deriv { doCheck = False }
5857 | pname == "HTTP" && version >= Version [4000,2,14] []
@@ -96,8 +95,8 @@ postProcess deriv@(MkDerivation {..})
9695 = deriv { doCheck = True, phaseOverrides = sybDoCheck }
9796 | pname == "tar" = deriv { runHaddock = True, phaseOverrides = tarNoHaddock }
9897 | pname == "terminfo" = deriv { extraLibs = "ncurses":extraLibs }
99− | pname == "text-icu" = deriv { doCheck = True, phaseOverrides = textIcuDoCheckHook }
10098 | pname == "threadscope" = deriv { configureFlags = "--ghc-options=-rtsopts":configureFlags }
99+ | pname == "thyme" = deriv { buildTools = "cpphs":buildTools }
101100 | pname == "transformers" && version >= Version [0,4,1] []
102101 = deriv { runHaddock = True, phaseOverrides = transformersNoHaddock }
103102 | pname == "tz" = deriv { extraFunctionArgs = ["pkgs_tzdata"], phaseOverrides = "preConfigure = \"export TZDIR=${pkgs_tzdata}/share/zoneinfo\";" }
@@ -254,8 +253,8 @@ doctestNoHaddock = markdownUnlitNoHaddock
254253cabal2nixDoCheckHook :: String
255254cabal2nixDoCheckHook = "doCheck = self.stdenv.lib.versionOlder \"7.6\" self.ghc.version;"
256255
257−textIcuDoCheckHook :: String
258−textIcuDoCheckHook = "doCheck = !self.stdenv.isDarwin;"
256+cookieDoCheckHook :: String
257+cookieDoCheckHook = "doCheck = self.stdenv.lib.versionOlder \"7.8\" self.ghc.version;"
259258
260259eitherNoHaddock :: String
261260eitherNoHaddock = "noHaddock = self.stdenv.lib.versionOlder self.ghc.version \"7.6\";"
@@ -269,7 +268,7 @@ transformersNoHaddock = httpNoHaddock
269268agdaPostInstall :: String
270269agdaPostInstall = unlines
271270 [ "postInstall = ''"
272− , " $out/bin/agda -c --no-main $out/share/Agda-*/lib/prim/Agda/Primitive.agda"
271+ , " $out/bin/agda -c --no-main $(find $out/share -name Primitive.agda)"
273272 , " $out/bin/agda-mode compile"
274273 , "'';"
275274 ]
src/Distribution/NixOS/Derivation/Cabal.hs+13−14
@@ -23,6 +23,7 @@ module Distribution.NixOS.Derivation.Cabal
2323import Distribution.NixOS.Derivation.Meta
2424import Distribution.NixOS.Fetch
2525import Distribution.NixOS.PrettyPrinting
26+import Distribution.NixOS.Regex hiding ( empty )
2627import Distribution.Package
2728import Distribution.Text
2829#ifdef __HADDOCK__
@@ -33,7 +34,6 @@ import Data.Version
3334import Data.List
3435import Data.Char
3536import Data.Function
36−import Text.Regex.Posix hiding ( empty )
3737
3838-- | A represtation of Nix expressions for building Haskell packages.
3939-- The data type correspond closely to the definition of
@@ -60,6 +60,7 @@ data Derivation = MkDerivation
6060 , doCheck :: Bool
6161 , testTarget :: String
6262 , hyperlinkSource :: Bool
63+ , enableSplitObjs :: Bool
6364 , phaseOverrides :: String
6465 , metaSection :: Meta
6566 }
@@ -79,18 +80,19 @@ renderDerivation deriv =
7980 funargs (map text ("cabal" : inputs)) $$ vcat
8081 [ text ""
8182 , text "cabal.mkDerivation" <+> lparen <> text "self" <> colon <+> lbrace
82− , nest 2 $ vcat $
83+ , nest 2 $ vcat
8384 [ attr "pname" $ string (pname deriv)
8485 , attr "version" $ doubleQuotes (disp (version deriv))
8586 , sourceAttr (src deriv)
8687 , boolattr "isLibrary" (not (isLibrary deriv) || isExecutable deriv) (isLibrary deriv)
8788 , boolattr "isExecutable" (not (isLibrary deriv) || isExecutable deriv) (isExecutable deriv)
88− , listattr "buildDepends" (buildDepends deriv)
89− , listattr "testDepends" (testDepends deriv)
90− , listattr "buildTools" (buildTools deriv)
91− , listattr "extraLibraries" (extraLibs deriv)
92− , listattr "pkgconfigDepends" (pkgConfDeps deriv)
89+ , listattr "buildDepends" empty (buildDepends deriv)
90+ , listattr "testDepends" empty (testDepends deriv)
91+ , listattr "buildTools" empty (buildTools deriv)
92+ , listattr "extraLibraries" empty (extraLibs deriv)
93+ , listattr "pkgconfigDepends" empty (pkgConfDeps deriv)
9394 , onlyIf renderedFlags $ attr "configureFlags" $ doubleQuotes (sep renderedFlags)
95+ , boolattr "enableSplitObjs" (not (enableSplitObjs deriv)) (enableSplitObjs deriv)
9496 , boolattr "noHaddock" (not (runHaddock deriv)) (not (runHaddock deriv))
9597 , boolattr "jailbreak" (jailbreak deriv) (jailbreak deriv)
9698 , boolattr "doCheck" (not (doCheck deriv)) (doCheck deriv)
@@ -137,11 +139,12 @@ parseDerivation buf
137139 , rev <- buf `regsubmatch` "rev *= *\"([^\"]+)\""
138140 , hplats <- buf `regsubmatch` "hydraPlatforms *= *([^;]+);"
139141 , plats <- buf `regsubmatch` "platforms *= *([^;]+);"
140− , maint <- buf `regsubmatch` "maintainers *= *\\[([^\"]+)]"
142+ , maint <- buf `regsubmatch` "maintainers *= *(with [^;]+;)? \\[([^\"]+)]"
141143 , noHaddock <- buf `regsubmatch` "noHaddock *= *(true|false) *;"
142144 , jailBreak <- buf `regsubmatch` "jailbreak *= *(true|false) *;"
143145 , docheck <- buf `regsubmatch` "doCheck *= *(true|false) *;"
144146 , hyperlSrc <- buf `regsubmatch` "hyperlinkSource *= *(true|false) *;"
147+ , splitObj <- buf `regsubmatch` "enableSplitObjs *= *(true|false) *;"
145148 = Just MkDerivation
146149 { pname = name
147150 , version = vers
@@ -166,19 +169,15 @@ parseDerivation buf
166169 , doCheck = docheck == ["true"] || null docheck
167170 , testTarget = ""
168171 , hyperlinkSource = hyperlSrc == ["true"] || null hyperlSrc
172+ , enableSplitObjs = splitObj /= ["false"]
169173 , phaseOverrides = ""
170174 , metaSection = Meta
171175 { homepage = ""
172176 , description = ""
173177 , license = Unknown Nothing
174− , maintainers = concatMap words maint
178+ , maintainers = if null maint then [] else concatMap words (tail maint)
175179 , platforms = concatMap words (map (map (\c -> if c == '+' then ' ' else c)) plats)
176180 , hydraPlatforms = concatMap words (map (map (\c -> if c == '+' then ' ' else c)) hplats)
177181 }
178182 }
179183 | otherwise = Nothing
180−
181−regsubmatch :: String -> String -> [String]
182−regsubmatch buf patt = let (_,_,_,x) = f in x
183− where f :: (String,String,String,[String])
184− f = match (makeRegexOpts compExtended execBlank patt) buf
src/Distribution/NixOS/Derivation/Meta.hs+15−11
@@ -23,16 +23,20 @@ import Distribution.Text
2323
2424-- | A representation of the @meta@ section used in Nix expressions.
2525--
26−-- > > putStrLn (display (Meta "http://example.org" "an example package" (Unknown Nothing)
27−-- > > ["stdenv.lib.platforms."++x | x<-["unix","cygwin"]]
28−-- > > ["stdenv.lib.maintainers."++x | x<-["joe","jane"]]))
29−-- > meta = {
30−-- > homepage = "http://example.org";
31−-- > description = "an example package";
32−-- > license = "unknown";
33−-- > platforms = stdenv.lib.platforms.unix ++ stdenv.lib.platforms.cygwin;
34−-- > maintainers = [ stdenv.lib.maintainers.joe stdenv.lib.maintainers.jane ];
35−-- > };
26+-- >>> :{
27+-- putStrLn (display (Meta "http://example.org" "an example package" (Unknown Nothing)
28+-- ["stdenv.lib.platforms."++x | x <- ["unix","cygwin"]]
29+-- ["stdenv.lib.platforms.none"]
30+-- ["joe","jane"]))
31+-- :}
32+-- meta = {
33+-- homepage = "http://example.org";
34+-- description = "an example package";
35+-- license = "unknown";
36+-- platforms = stdenv.lib.platforms.unix ++ stdenv.lib.platforms.cygwin;
37+-- hydraPlatforms = stdenv.lib.platforms.none;
38+-- maintainers = with self.stdenv.lib.maintainers; [ joe jane ];
39+-- };
3640--
3741-- Note that the "Text" instance definition provides pretty-printing,
3842-- but no parsing as of now!
@@ -62,7 +66,7 @@ renderMeta meta = vcat
6266 [ text "platforms" <+> equals, renderPlatformList (platforms meta) ]
6367 , onlyIf (hydraPlatforms meta) $ sep
6468 [ text "hydraPlatforms" <+> equals, renderPlatformList (hydraPlatforms meta) ]
65− , listattr "maintainers" (maintainers meta)
69+ , listattr "maintainers" (text "with self.stdenv.lib.maintainers;") (maintainers meta)
6670 ]
6771 , rbrace <> semi
6872 ]
src/Distribution/NixOS/PrettyPrinting.hs+3−3
@@ -31,9 +31,9 @@ onlyIf p d = if not (null p) then d else empty
3131boolattr :: String -> Bool -> Bool -> Doc
3232boolattr n p v = if p then attr n (bool v) else empty
3333
34−listattr :: String -> [String] -> Doc
35−listattr n vs = onlyIf vs $
36− sep [ text n <+> equals <+> lbrack,
34+listattr :: String -> Doc -> [String] -> Doc
35+listattr n prefix vs = onlyIf vs $
36+ sep [ text n <+> equals <+> prefix <+> lbrack,
3737 nest 2 $ fsep $ map text vs,
3838 rbrack <> semi
3939 ]
src/Distribution/NixOS/Regex.hsnew file+25
@@ -0,0 +1,25 @@
1+{-# LANGUAGE PatternGuards, CPP #-}
2+{- |
3+ Module : Distribution.NixOS.Derivation.Cabal
4+ License : BSD3
5+
6+ Maintainer : nix-dev@cs.uu.nl
7+ Stability : provisional
8+ Portability : PatternGuards
9+
10+ A represtation of Nix expressions based on Cabal builder defined in
11+ @pkgs\/development\/libraries\/haskell\/cabal\/cabal.nix@.
12+-}
13+
14+module Distribution.NixOS.Regex
15+ ( module Text.Regex.Posix
16+ , regsubmatch
17+ )
18+ where
19+
20+import Text.Regex.Posix
21+
22+regsubmatch :: String -> String -> [String]
23+regsubmatch buf patt = let (_,_,_,x) = f in x
24+ where f :: (String,String,String,[String])
25+ f = match (makeRegexOpts compExtended execBlank patt) buf
src/hackage4nix.hs+46−30
@@ -72,7 +72,7 @@ discoverNixFiles yield dirOrFile = do
7272 (False,_) -> io (readDirectory dirOrFile) >>= mapM_ (discoverNixFiles yield . (dirOrFile </>))
7373
7474regenerateDerivation :: Derivation -> String -> Bool
75−regenerateDerivation _ buf = not (buf =~ "(pre|post)Configure|(pre|post)Install|patchPhase|patches")
75+regenerateDerivation _ buf = not (buf =~ "(pre|post)Configure|(pre|post)Install|patchPhase|patches|broken")
7676
7777parseNixFile :: FilePath -> String -> Hackage4Nix (Maybe Pkg)
7878parseNixFile path buf
@@ -103,36 +103,53 @@ discoverUpdates name vers = do
103103
104104updateNixPkgs :: [FilePath] -> Hackage4Nix ()
105105updateNixPkgs paths = do
106− msgDebug $ "updating = " ++ show paths
107− forM_ paths $ \fileOrDir ->
106+ -- Traverse the given directorcy structure and discover all available
107+ -- Haskell packages.
108+ forM_ paths $ \fileOrDir -> do
109+ msgDebug $ "scanning " ++ show fileOrDir
108110 flip discoverNixFiles fileOrDir $ \file -> do
109111 nix' <- io (readFile file) >>= parseNixFile file
110− flip (maybe (return ())) nix' $ \nix -> do
111− let Pkg deriv path regenerate = nix
112− maints = maintainers (metaSection deriv)
113− plats = platforms (metaSection deriv)
114− hplats = hydraPlatforms (metaSection deriv)
112+ flip (maybe (return ())) nix' $ \nix ->
115113 modify (Set.insert nix)
116− when regenerate $ do
117− msgDebug ("re-generate " ++ path)
118− pkg <- getCabalPackage (pname deriv) (version deriv)
119− let deriv' = (cabal2nix pkg) { src = src deriv
120− , runHaddock = runHaddock deriv
121− , doCheck = doCheck deriv
122− , jailbreak = jailbreak deriv
123− , hyperlinkSource = hyperlinkSource deriv
124− }
125− meta = metaSection deriv'
126− plats' = if null plats then platforms meta else plats
127− deriv'' = deriv' { metaSection = meta
128− { maintainers = maints -- ++ ["andres","simons"]
129− , platforms = plats'
130− , hydraPlatforms = hplats
131− }
132− }
133− io $ writeFile path (show (disp (normalize deriv'')))
134− pkgset <- gets selectLatestVersions
135− updates' <- forM (Set.elems pkgset) $ \pkg -> do
114+
115+ -- Re-generate all Haskell packages in-place (unless
116+ -- 'regenerateDerivation' decided that this particular package
117+ -- shouldn't be touched.
118+ latestVersions <- gets selectLatestVersions
119+ let latestVersionMap :: [(String,Version)]
120+ latestVersionMap = [ (pname deriv, version deriv) | Pkg deriv _ _ <- Set.toList latestVersions ]
121+ let isLatest :: Derivation -> Bool
122+ isLatest deriv = maybe False (version deriv ==) (lookup (pname deriv) latestVersionMap)
123+ get >>= \pkgset -> forM_ (Set.toList pkgset) $ \nix -> do
124+ let Pkg deriv path regenerate = nix
125+ maints = maintainers (metaSection deriv)
126+ plats = platforms (metaSection deriv)
127+ hplats = if isLatest deriv then hydraPlatforms (metaSection deriv) else ["self.stdenv.lib.platforms.none"]
128+
129+ when regenerate $ do
130+ msgDebug ("re-generate " ++ path)
131+ pkg <- getCabalPackage (pname deriv) (version deriv)
132+ let deriv' = (cabal2nix pkg) { src = src deriv
133+ , runHaddock = runHaddock deriv
134+ , doCheck = doCheck deriv
135+ , jailbreak = jailbreak deriv
136+ , hyperlinkSource = hyperlinkSource deriv
137+ , enableSplitObjs = enableSplitObjs deriv
138+ }
139+ meta = metaSection deriv'
140+ plats' = if null plats then platforms meta else plats
141+ deriv'' = deriv' { metaSection = meta
142+ { maintainers = maints
143+ , platforms = plats'
144+ , hydraPlatforms = hplats
145+ }
146+ }
147+ io $ writeFile path (show (disp (normalize deriv'')))
148+
149+ -- Discover available updates and print the appropriate cabal2nix
150+ -- command line to the console for the user to execute at his/her
151+ -- discretion.
152+ updates' <- forM (Set.elems latestVersions) $ \pkg -> do
136153 let Pkg deriv _ _ = pkg
137154 updates <- discoverUpdates (pname deriv) (version deriv)
138155 return (pkg,updates)
@@ -233,8 +250,7 @@ badPackagePaths = [ -- These expression are not found on Hackage:
233250 -- Requires platform-specific magic that I don't want to add to cabal2nix.
234251 , "pkgs/development/libraries/haskell/fsnotify/default.nix"
235252 -- Not registered on Hackage.
236− , "pkgs/development/compilers/agda/stdlib-0.7.nix"
237− , "pkgs/development/compilers/agda/stdlib-0.8.nix"
253+ , "pkgs/development/compilers/agda/stdlib.nix"
238254 , "pkgs/development/compilers/cryptol/1.8.x.nix"
239255 , "pkgs/development/compilers/cryptol/2.0.x.nix"
240256 , "pkgs/development/compilers/jhc/default.nix"
test/doc-test.hs+1
@@ -29,6 +29,7 @@ main = do
2929 , "src/Distribution/NixOS/Derivation/Meta.hs"
3030 , "src/Distribution/NixOS/Fetch.hs"
3131 , "src/Distribution/NixOS/PrettyPrinting.hs"
32+ , "src/Distribution/NixOS/Regex.hs"
3233 ]
3334 doctest $ "src/cabal2nix.hs" : libs
3435 doctest $ "src/hackage4nix.hs" : libs