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

Conflicts: src/Cabal2Nix/Hackage.hs src/cabal2nix.hs

commitf72934126fc4a698bdec3232467f653f446aa924 authorBenno Fünfstück <benno.fuenfstueck@gmail.com> dateThu 17 Jul 2014, 13:14 (12 years ago) parent58dbc292ba6c55
10 files changed+128−32
cabal2nix.cabal+8−5 release.nix+33 src/Cabal2Nix/Flags.hs+3−1 src/Cabal2Nix/Generate.hs+1 src/Cabal2Nix/Name.hs+4 src/Cabal2Nix/Package.hs+9−9 src/Cabal2Nix/PostProcess.hs+43−13 src/Distribution/NixOS/Derivation/Cabal.hs+8−1 src/cabal2nix.hs+8−2 src/hackage4nix.hs+11−1
cabal2nix.cabal+8−5
@@ -1,5 +1,5 @@
11Name: cabal2nix
2−Version: 1.62
2+Version: 1.67
33Copyright: Peter Simons, Andres Loeh
44License: BSD3
55License-File: LICENSE
@@ -10,7 +10,7 @@ Category: Distribution
1010Synopsis: Convert Cabal files into Nix build instructions
1111Cabal-Version: >= 1.8
1212Build-Type: Custom
13−Tested-With: GHC >= 6.12.3 && <= 7.8.1
13+Tested-With: GHC >= 6.10.4 && <= 7.8.3
1414Data-files: README.md
1515Description:
1616 The @cabal2nix@ utility converts Cabal files into Nix build instructions. The
@@ -18,11 +18,14 @@ Description:
1818 .
1919 > Usage: cabal2nix [options] url-to-cabal-file
2020 > -h --help show this help text
21+ > --hackage-db=FILEPATH path to the local hackage db in tar format
2122 > --sha256=HASH sha256 hash of source tarball
2223 > -m MAINTAINER --maintainer=MAINTAINER maintainer of this package (may be specified multiple times)
2324 > -p PLATFORM --platform=PLATFORM supported build platforms (may be specified multiple times)
24− > --no-check don't run regression test suites of this package
2525 > --jailbreak don't honor version restrictions on build inputs
26+ > --no-haddock don't run Haddock when building this package
27+ > --no-check don't run regression test suites of this package
28+ > --no-hyperlink-source don't add pretty-printed source code to the documentation
2629 >
2730 > Recognized URI schemes:
2831 >
@@ -34,8 +37,8 @@ Description:
3437 .
3538 The only required argument is the path to the cabal file. For example:
3639 .
37− > cabal2nix http://hackage.haskell.org/packages/archive/cabal2nix/1.62/cabal2nix.cabal
38− > cabal2nix cabal://cabal2nix-1.62
40+ > cabal2nix http://hackage.haskell.org/packages/archive/cabal2nix/1.67/cabal2nix.cabal
41+ > cabal2nix cabal://cabal2nix-1.67
3942 .
4043 If the @--sha256@ option has not been specified, cabal2nix calls
4144 @nix-prefetch-url@ to determine the hash automatically. This causes
release.nixnew file+33
@@ -0,0 +1,33 @@
1+/* Build instructions for the continuous integration system Hydra. */
2+
3+{ cabal2nixSrc ? { outPath = ./.; revCount = 0; gitTag = "dirty"; }
4+, supportedPlatforms ? [ "x86_64-linux" ]
5+, supportedCompilers ? ["ghc6104" "ghc6123" "ghc704" "ghc722" "ghc742" "ghc763" "ghc783" "ghcHEAD"]
6+}:
7+
8+let
9+ genAttrs = (import <nixpkgs> { }).lib.genAttrs;
10+in
11+{
12+ cabal2nix = genAttrs supportedCompilers (ghcVer: genAttrs supportedPlatforms (system:
13+ let
14+ pkgs = import <nixpkgs> { inherit system; };
15+ haskellPackages = pkgs.lib.getAttrFromPath ["haskellPackages_${ghcVer}"] pkgs;
16+ in
17+ haskellPackages.cabal.mkDerivation (self: {
18+ pname = "cabal2nix";
19+ src = cabal2nixSrc;
20+ version = cabal2nixSrc.gitTag;
21+ isLibrary = false;
22+ isExecutable = true;
23+ buildDepends = with haskellPackages; [ Cabal filepath hackageDb HTTP mtl regexPosix ];
24+ testDepends = with haskellPackages; [ doctest ];
25+ doCheck = self.stdenv.lib.versionOlder "7.6" self.ghc.version;
26+ meta = {
27+ homepage = "http://github.com/NixOS/cabal2nix";
28+ description = "Convert Cabal files into Nix build instructions";
29+ license = self.stdenv.lib.licenses.bsd3;
30+ maintainers = [ self.stdenv.lib.maintainers.simons ];
31+ };
32+ })));
33+}
src/Cabal2Nix/Flags.hs+3−1
@@ -5,6 +5,7 @@ import Distribution.PackageDescription
55
66configureCabalFlags :: PackageIdentifier -> FlagAssignment
77configureCabalFlags (PackageIdentifier (PackageName name) _)
8+ | name == "arithmoi" = [disable "llvm"]
89 | name == "accelerate-examples"= [disable "opencl"]
910 | name == "git-annex" = [ enable "S3", enable "WebDAV", enable "Inotify"
1011 , enable "Dbus", enable "Assistant", enable "Webapp"
@@ -15,7 +16,8 @@ configureCabalFlags (PackageIdentifier (PackageName name) _)
1516 | name == "idris" = [enable "llvm", enable "gmp", enable "ffi"]
1617 | name == "io-streams" = [enable "NoInteractiveTests"]
1718 | name == "reactive-banana-wx" = [disable "buildExamples"]
18− | name == "xmobar" = [enable "with_xft", enable "with_iwlib", enable "with_alsa"]
19+ | name == "snap-server" = [enable "openssl"]
20+ | name == "xmobar" = [enable "all_extensions"]
1921 | name == "xmonad-extras" = [disable "with_hlist", enable "with_split", enable "with_parsec"]
2022 | name == "yi" = [enable "pango"]
2123 | otherwise = []
src/Cabal2Nix/Generate.hs+1
@@ -31,6 +31,7 @@ cabal2nix cabal = normalize $ postProcess MkDerivation
3131 , jailbreak = False
3232 , doCheck = True
3333 , testTarget = ""
34+ , hyperlinkSource = True
3435 , phaseOverrides = ""
3536 , metaSection = Meta
3637 { homepage = Cabal.homepage descr
src/Cabal2Nix/Name.hs+4
@@ -20,10 +20,12 @@ libNixName :: String -> [String]
2020libNixName "adns" = return "adns"
2121libNixName "alsa" = return "alsaLib"
2222libNixName "asound" = return "alsaLib"
23+libNixName "bz2" = return "bzip2"
2324libNixName "cairo-pdf" = return "cairo"
2425libNixName "cairo-ps" = return "cairo"
2526libNixName "cairo" = return "cairo"
2627libNixName "cairo-svg" = return "cairo"
28+libNixName "crypt" = [] -- provided by glibc
2729libNixName "crypto" = return "openssl"
2830libNixName "dl" = [] -- provided by glibc
2931libNixName "gconf-2.0" = return "gconf"
@@ -54,6 +56,7 @@ libNixName "icuuc" = return "icu"
5456libNixName "idn" = return "libidn"
5557libNixName "IL" = return "libdevil"
5658libNixName "iw" = return "wirelesstools"
59+libNixName "jack" = return "jackaudio"
5760libNixName "jpeg" = return "libjpeg"
5861libNixName "libglade-2.0" = return "libglade"
5962libNixName "libgsasl" = return "gsasl"
@@ -84,6 +87,7 @@ libNixName "xml2" = return "libxml2"
8487libNixName "Xrandr" = return "libXrandr"
8588libNixName "Xss" = return "libXScrnSaver"
8689libNixName "Xtst" = return "libXtst"
90+libNixName "Xxf86vm" = return "libXxf86vm"
8791libNixName "zmq" = return "zeromq"
8892libNixName "z" = return "zlib"
8993libNixName x = return x
src/Cabal2Nix/Package.hs+9−9
@@ -24,15 +24,15 @@ data Package = Package
2424 , cabal :: Cabal.GenericPackageDescription
2525 }
2626
27−getPackage :: Source -> IO Package
28−getPackage source = do
29− (derivSource, pkgDesc) <- fetchOrFromDB source
27+getPackage :: Maybe String -> Source -> IO Package
28+getPackage optHackageDB source = do
29+ (derivSource, pkgDesc) <- fetchOrFromDB optHackageDB source
3030 flip Package pkgDesc <$> maybe (sourceFromHackage (sourceHash source) $ showPackageIdentifier pkgDesc) return derivSource
3131
3232
33−fetchOrFromDB :: Source -> IO (Maybe DerivationSource, Cabal.GenericPackageDescription)
34−fetchOrFromDB src
35− | "cabal://" `isPrefixOf` sourceUrl src = fmap ((,) Nothing) . fromDB . drop (length "cabal://") $ sourceUrl src
33+fetchOrFromDB :: Maybe String -> Source -> IO (Maybe DerivationSource, Cabal.GenericPackageDescription)
34+fetchOrFromDB optHackageDB src
35+ | "cabal://" `isPrefixOf` sourceUrl src = fmap ((,) Nothing) . fromDB optHackageDB . drop (length "cabal://") $ sourceUrl src
3636 | otherwise = do
3737 r <- fetch cabalFromPath src
3838 case r of
@@ -40,9 +40,9 @@ fetchOrFromDB src
4040 Just (derivSource, (externalSource, pkgDesc)) ->
4141 return (derivSource <$ guard externalSource, pkgDesc)
4242
43−fromDB :: String -> IO Cabal.GenericPackageDescription
44−fromDB pkg = do
45− pkgDesc <- (lookupVersion <=< DB.lookup name) <$> DB.readHackage
43+fromDB :: Maybe String -> String -> IO Cabal.GenericPackageDescription
44+fromDB optHackageDB pkg = do
45+ pkgDesc <- (lookupVersion <=< DB.lookup name) <$> maybe DB.readHackage DB.readHackage' optHackageDB
4646 case pkgDesc of
4747 Just r -> return r
4848 Nothing -> hPutStrLn stderr "*** no such package in the cabal database (did you run cabal update?). " >> exitFailure
src/Cabal2Nix/PostProcess.hs+43−13
@@ -14,6 +14,7 @@ postProcess deriv@(MkDerivation {..})
1414 = deriv { buildTools = "perl":buildTools }
1515 | pname == "alex" && version >= Version [3,1] []
1616 = deriv { buildTools = "perl":"happy":buildTools }
17+ | pname == "bindings-GLFW" = deriv { extraLibs = "libXext":"libXfixes":extraLibs }
1718 | pname == "cabal2nix" = deriv { doCheck = True, phaseOverrides = cabal2nixDoCheckHook }
1819 | pname == "cabal-install" && version >= Version [0,14] []
1920 = deriv { phaseOverrides = cabalInstallPostInstall }
@@ -36,19 +37,27 @@ postProcess deriv@(MkDerivation {..})
3637 | pname == "gloss-raster" = deriv { extraLibs = "llvm":extraLibs }
3738 | pname == "GLUT" = deriv { extraLibs = "glut":"libSM":"libICE":"libXmu":"libXi":"mesa":extraLibs }
3839 | pname == "gtk" = deriv { extraLibs = "pkgconfig":"libc":extraLibs, buildDepends = delete "gio" buildDepends }
40+ | pname == "gtkglext" = deriv { pkgConfDeps = "pangox_compat":pkgConfDeps }
41+ | pname == "gtk2hs-buildtools"= deriv { buildDepends = "hashtables":buildDepends }
3942 | pname == "gtksourceview2" = deriv { extraLibs = "pkgconfig":"libc":extraLibs }
40− | pname == "haddock" = deriv { buildTools = "alex":"happy":buildTools }
43+ | pname == "haddock" && version < Version [2,14] []
44+ = deriv { buildTools = "alex":"happy":buildTools }
4145 | pname == "happy" = deriv { buildTools = "perl":buildTools }
4246 | pname == "haskeline" = deriv { buildDepends = "utf8String":buildDepends }
4347 | pname == "haskell-src" = deriv { buildTools = "happy":buildTools }
4448 | pname == "haskell-src-meta" = deriv { buildDepends = "uniplate":buildDepends }
4549 | 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\";" }
4651 | pname == "HFuse" = deriv { phaseOverrides = hfusePreConfigure }
4752 | pname == "highlighting-kate"= highlightingKatePostProcessing deriv
53+ | pname == "hlibgit2" = deriv { testDepends = "git":testDepends }
4854 | pname == "HList" = deriv { buildTools = "diffutils":buildTools }
4955 | pname == "hmatrix" = deriv { extraLibs = "gsl":"liblapack":"blas":extraLibs }
5056 | pname == "hoogle" = deriv { testTarget = "--test-option=--no-net" }
5157 | pname == "hspec" = deriv { doCheck = False }
58+ | pname == "HTTP" && version >= Version [4000,2,14] []
59+ = deriv { runHaddock = True, phaseOverrides = httpNoHaddock }
60+ | pname == "GlomeVec" = deriv { buildTools = "llvm":buildTools }
5261 | pname == "idris" = deriv { buildTools = "happy":buildTools, extraLibs = "gmp":"boehmgc":extraLibs }
5362 | pname == "language-c-quote" = deriv { buildTools = "alex":"happy":buildTools }
5463 | pname == "language-java" = deriv { buildDepends = "syb":buildDepends }
@@ -58,6 +67,7 @@ postProcess deriv@(MkDerivation {..})
5867 | pname == "llvm-base" = deriv { extraLibs = "llvm":extraLibs }
5968 | pname == "llvm-general" = deriv { doCheck = False }
6069 | pname == "llvm-general-pure"= deriv { doCheck = False }
70+ | pname == "MFlow" = deriv { buildTools = "cpphs":buildTools }
6171 | pname == "markdown-unlit" = deriv { runHaddock = True, phaseOverrides = markdownUnlitNoHaddock }
6272 | pname == "multiarg" = deriv { buildDepends = "utf8String":buildDepends }
6373 | pname == "mime-mail" = deriv { extraFunctionArgs = ["sendmail ? \"sendmail\""], phaseOverrides = mimeMailConfigureFlags }
@@ -70,17 +80,27 @@ postProcess deriv@(MkDerivation {..})
7080 | pname == "pcap" = deriv { extraLibs = "libpcap":extraLibs }
7181 | pname == "persistent" = deriv { extraLibs = "sqlite3":extraLibs }
7282 | pname == "poppler" = deriv { extraLibs = "libc":extraLibs }
83+ | pname == "QuickCheck" && version >= Version [2,7,3] []
84+ = deriv { runHaddock = True, phaseOverrides = quickCheckNoHaddock }
7385 | pname == "repa-algorithms" = deriv { extraLibs = "llvm":extraLibs }
7486 | pname == "repa-examples" = deriv { extraLibs = "llvm":extraLibs }
7587 | pname == "SDL-image" = deriv { extraLibs = "SDL_image":extraLibs }
7688 | pname == "SDL-mixer" = deriv { extraLibs = "SDL_mixer":extraLibs }
7789 | pname == "SDL-ttf" = deriv { extraLibs = "SDL_ttf":extraLibs }
7890 | pname == "sloane" = deriv { phaseOverrides = sloanePostInstall }
91+ | pname == "split" && version == Version [0,2,2] []
92+ = deriv { doCheck = True, phaseOverrides = splitDoCheck }
7993 | pname == "structured-haskell-mode" = deriv { buildTools = "emacs":buildTools, phaseOverrides = structuredHaskellModePostInstall }
8094 | pname == "svgcairo" = deriv { extraLibs = "libc":extraLibs }
95+ | pname == "syb" && version == Version [0,4,2] []
96+ = deriv { doCheck = True, phaseOverrides = sybDoCheck }
97+ | pname == "tar" = deriv { runHaddock = True, phaseOverrides = tarNoHaddock }
8198 | pname == "terminfo" = deriv { extraLibs = "ncurses":extraLibs }
99+ | pname == "text-icu" = deriv { doCheck = True, phaseOverrides = textIcuDoCheckHook }
82100 | pname == "threadscope" = deriv { configureFlags = "--ghc-options=-rtsopts":configureFlags }
83− | pname == "unix-time" = deriv { phaseOverrides = unixTimeConfigureFlags }
101+ | pname == "transformers" && version >= Version [0,4,1] []
102+ = deriv { runHaddock = True, phaseOverrides = transformersNoHaddock }
103+ | pname == "tz" = deriv { extraFunctionArgs = ["pkgs_tzdata"], phaseOverrides = "preConfigure = \"export TZDIR=${pkgs_tzdata}/share/zoneinfo\";" }
84104 | pname == "vacuum" = deriv { extraLibs = "ghcPaths":extraLibs }
85105 | pname == "wxc" = deriv { extraLibs = "wxGTK":"mesa":"libX11":extraLibs, phaseOverrides = wxcPostInstall }
86106 | pname == "wxcore" = deriv { extraLibs = "wxGTK":"mesa":"libX11":extraLibs }
@@ -122,7 +142,8 @@ cudaConfigurePhase = unlines
122142
123143ghcModPostInstall :: String
124144ghcModPostInstall = unlines
125− [ "postInstall = ''"
145+ [ "configureFlags = \"--datasubdir=${self.pname}-${self.version}\";"
146+ , "postInstall = ''"
126147 , " cd $out/share/$pname-$version"
127148 , " make"
128149 , " rm Makefile"
@@ -165,7 +186,7 @@ darcsInstallPostInstall = unlines
165186
166187highlightingKatePostProcessing :: Derivation -> Derivation
167188highlightingKatePostProcessing deriv@(MkDerivation {..}) = deriv
168− { phaseOverrides = "prePatch = \"sed -i -e 's|regex-pcre-builtin|regex-pcre|' highlighting-kate.cabal\";"
189+ { phaseOverrides = "prePatch = \"sed -i -e 's|regex-pcre-builtin >= .*|regex-pcre|' highlighting-kate.cabal\";"
169190 , buildDepends = "regex-pcre" : filter (/="regex-pcre-builtin") buildDepends
170191 }
171192
@@ -176,6 +197,10 @@ xmonadPostInstall = unlines
176197 , " mkdir -p $out/share/man/man1"
177198 , " mv \"$out/\"**\"/man/\"*.1 $out/share/man/man1/"
178199 , "'';"
200+ , "patches = ["
201+ , " # Patch to make xmonad use XMONAD_{GHC,XMESSAGE} (if available)."
202+ , " ./xmonad_ghc_var_0.11.patch"
203+ , "];"
179204 ]
180205
181206gitAnnexOverrides :: String
@@ -204,11 +229,6 @@ hfusePreConfigure :: String
204229hfusePreConfigure = unlines
205230 [ "preConfigure = ''"
206231 , " sed -i -e \"s@ Extra-Lib-Dirs: /usr/local/lib@ Extra-Lib-Dirs: ${fuse}/lib@\" HFuse.cabal"
207− , " sed -i -e \"s/LANGUAGE FlexibleContexts/LANGUAGE FlexibleContexts, RankNTypes/\" System/Fuse.hsc"
208− , " sed -i -e \"s/E(Exception/E(catch, Exception, IOException/\" System/Fuse.hsc"
209− , " sed -i -e \"s/IO(catch,/IO(/\" System/Fuse.hsc"
210− , " sed -i -e \"s/IO.catch/ E.catch/\" System/Fuse.hsc"
211− , " sed -i -e \"s/const exitFailure/\\\\\\\\(_ :: IOException) -> exitFailure/\" System/Fuse.hsc"
212232 , "'';"
213233 ]
214234
@@ -234,12 +254,22 @@ doctestNoHaddock = markdownUnlitNoHaddock
234254cabal2nixDoCheckHook :: String
235255cabal2nixDoCheckHook = "doCheck = self.stdenv.lib.versionOlder \"7.6\" self.ghc.version;"
236256
257+textIcuDoCheckHook :: String
258+textIcuDoCheckHook = "doCheck = !self.stdenv.isDarwin;"
259+
237260eitherNoHaddock :: String
238261eitherNoHaddock = "noHaddock = self.stdenv.lib.versionOlder self.ghc.version \"7.6\";"
239262
263+httpNoHaddock, quickCheckNoHaddock, tarNoHaddock, transformersNoHaddock :: String
264+httpNoHaddock = "noHaddock = self.stdenv.lib.versionOlder self.ghc.version \"6.11\";"
265+quickCheckNoHaddock = httpNoHaddock
266+tarNoHaddock = httpNoHaddock
267+transformersNoHaddock = httpNoHaddock
268+
240269agdaPostInstall :: String
241270agdaPostInstall = unlines
242271 [ "postInstall = ''"
272+ , " $out/bin/agda -c --no-main $out/share/Agda-*/lib/prim/Agda/Primitive.agda"
243273 , " $out/bin/agda-mode compile"
244274 , "'';"
245275 ]
@@ -253,10 +283,6 @@ structuredHaskellModePostInstall = unlines
253283 , "'';"
254284 ]
255285
256−unixTimeConfigureFlags :: String
257−unixTimeConfigureFlags =
258− "configureFlags = self.stdenv.lib.optionalString self.enableSharedLibraries \"--ghc-option=-fPIC\";"
259−
260286sloanePostInstall :: String
261287sloanePostInstall = unlines
262288 [ "postInstall = ''"
@@ -269,3 +295,7 @@ mimeMailConfigureFlags :: String
269295mimeMailConfigureFlags = unlines
270296 [ "configureFlags = \"--ghc-option=-DMIME_MAIL_SENDMAIL_PATH=\\\"${sendmail}\\\"\";"
271297 ]
298+
299+sybDoCheck, splitDoCheck :: String
300+sybDoCheck = "doCheck = self.stdenv.lib.versionOlder self.ghc.version \"7.9\";"
301+splitDoCheck = sybDoCheck
src/Distribution/NixOS/Derivation/Cabal.hs+8−1
@@ -59,6 +59,7 @@ data Derivation = MkDerivation
5959 , jailbreak :: Bool
6060 , doCheck :: Bool
6161 , testTarget :: String
62+ , hyperlinkSource :: Bool
6263 , phaseOverrides :: String
6364 , metaSection :: Meta
6465 }
@@ -72,7 +73,10 @@ instance Package Derivation where
7273 packageId deriv = PackageIdentifier (PackageName (pname deriv)) (version deriv)
7374
7475renderDerivation :: Derivation -> Doc
75−renderDerivation deriv = funargs (map text ("cabal" : inputs)) $$ vcat
76+renderDerivation deriv =
77+ text "# This file was auto-generated by cabal2nix. Please do NOT edit manually!" $$
78+ text "" $$
79+ funargs (map text ("cabal" : inputs)) $$ vcat
7680 [ text ""
7781 , text "cabal.mkDerivation" <+> lparen <> text "self" <> colon <+> lbrace
7882 , nest 2 $ vcat $
@@ -91,6 +95,7 @@ renderDerivation deriv = funargs (map text ("cabal" : inputs)) $$ vcat
9195 , boolattr "jailbreak" (jailbreak deriv) (jailbreak deriv)
9296 , boolattr "doCheck" (not (doCheck deriv)) (doCheck deriv)
9397 , onlyIf (testTarget deriv) $ attr "testTarget" $ string (testTarget deriv)
98+ , boolattr "hyperlinkSource" (not (hyperlinkSource deriv)) (hyperlinkSource deriv)
9499 , onlyIf (phaseOverrides deriv) $ vcat ((map text . lines) (phaseOverrides deriv))
95100 , disp (metaSection deriv)
96101 ]
@@ -136,6 +141,7 @@ parseDerivation buf
136141 , noHaddock <- buf `regsubmatch` "noHaddock *= *(true|false) *;"
137142 , jailBreak <- buf `regsubmatch` "jailbreak *= *(true|false) *;"
138143 , docheck <- buf `regsubmatch` "doCheck *= *(true|false) *;"
144+ , hyperlSrc <- buf `regsubmatch` "hyperlinkSource *= *(true|false) *;"
139145 = Just MkDerivation
140146 { pname = name
141147 , version = vers
@@ -159,6 +165,7 @@ parseDerivation buf
159165 , jailbreak = jailBreak == ["true"]
160166 , doCheck = docheck == ["true"] || null docheck
161167 , testTarget = ""
168+ , hyperlinkSource = hyperlSrc == ["true"] || null hyperlSrc
162169 , phaseOverrides = ""
163170 , metaSection = Meta
164171 { homepage = ""
src/cabal2nix.hs+8−2
@@ -24,6 +24,8 @@ data Configuration = Configuration
2424 , optDoCheck :: Bool
2525 , optJailbreak :: Bool
2626 , optRevision :: String
27+ , optHyperlinkSource :: Bool
28+ , optHackageDb :: Maybe FilePath
2729 }
2830 deriving (Show)
2931
@@ -38,18 +40,22 @@ defaultConfiguration = Configuration
3840 , optDoCheck = True
3941 , optJailbreak = False
4042 , optRevision = ""
43+ , optHyperlinkSource = True
44+ , optHackageDb = Nothing
4145 }
4246
4347options :: [OptDescr (Configuration -> Configuration)]
4448options =
4549 [ Option "h" ["help"] (NoArg (\o -> o { optPrintHelp = True })) "show this help text"
50+ , Option "" ["hackage-db"] (ReqArg (\x o -> o { optHackageDb = Just x }) "FILEPATH") "path to the local hackage db in tar format"
4651 , Option "" ["sha256"] (ReqArg (\x o -> o { optSha256 = Just x }) "HASH") "sha256 hash of source tarball"
4752 , Option "m" ["maintainer"] (ReqArg (\x o -> o { optMaintainer = x : optMaintainer o }) "MAINTAINER") "maintainer of this package (may be specified multiple times)"
4853 , Option "p" ["platform"] (ReqArg (\x o -> o { optPlatform = x : optPlatform o }) "PLATFORM") "supported build platforms (may be specified multiple times)"
54+ , Option "" ["jailbreak"] (NoArg (\o -> o { optJailbreak = True })) "don't honor version restrictions on build inputs"
4955 , Option "" ["no-haddock"] (NoArg (\o -> o { optHaddock = False })) "don't run Haddock when building this package"
5056 , Option "" ["no-check"] (NoArg (\o -> o { optDoCheck = False })) "don't run regression test suites of this package"
51− , Option "" ["jailbreak"] (NoArg (\o -> o { optJailbreak = True })) "don't honor version restrictions on build inputs"
5257 , Option "" ["rev"] (ReqArg (\x o -> o { optRevision = x }) "REVISION") "revision, only used when fetching from VCS"
58+ , Option "" ["no-hyperlink-source"] (NoArg (\o -> o { optHyperlinkSource = False })) "don't add pretty-printed source code to the documentation"
5359 ]
5460
5561usage :: String
@@ -83,7 +89,7 @@ main = bracket (return ()) (\() -> hFlush stdout >> hFlush stderr) $ \() -> do
8389 when (optPrintHelp cfg) (putStr usage >> exitSuccess)
8490 when (length args /= 1) (cmdlineError "*** exactly one url-to-cabal-file must be specified\n")
8591
86− pkg <- getPackage $ Source (head args) (optRevision cfg) (optSha256 cfg)
92+ pkg <- getPackage (optHackageDb cfg) $ Source (head args) (optRevision cfg) (optSha256 cfg)
8793
8894 let deriv = (cabal2nix $ cabal pkg) { src = source pkg, runHaddock = optHaddock cfg, jailbreak = optJailbreak cfg }
8995 deriv' = deriv { metaSection = (metaSection deriv)
src/hackage4nix.hs+11−1
@@ -120,6 +120,7 @@ updateNixPkgs paths = do
120120 , runHaddock = runHaddock deriv
121121 , doCheck = doCheck deriv
122122 , jailbreak = jailbreak deriv
123+ , hyperlinkSource = hyperlinkSource deriv
123124 }
124125 meta = metaSection deriv'
125126 plats' = if null plats then platforms meta else plats
@@ -228,7 +229,16 @@ badPackagePaths = [ -- These expression are not found on Hackage:
228229 , "top-level/all-packages.nix", "top-level/haskell-packages.nix"
229230 -- This build is way too complicated to maintain it automatically.
230231 , "pkgs/development/compilers/pakcs/default.nix"
232+ , "pkgs/development/libraries/haskell/hoogle/local.nix"
233+ -- Requires platform-specific magic that I don't want to add to cabal2nix.
234+ , "pkgs/development/libraries/haskell/fsnotify/default.nix"
231235 -- Not registered on Hackage.
232− , "pkgs/tools/networking/sproxy/default.nix"
236+ , "pkgs/development/compilers/agda/stdlib-0.7.nix"
237+ , "pkgs/development/compilers/agda/stdlib-0.8.nix"
238+ , "pkgs/development/compilers/cryptol/1.8.x.nix"
239+ , "pkgs/development/compilers/cryptol/2.0.x.nix"
240+ , "pkgs/development/compilers/jhc/default.nix"
241+ , "pkgs/development/tools/haskell/cabal-delete/default.nix"
233242 , "pkgs/tools/networking/sproxy-web/default.nix"
243+ , "pkgs/tools/networking/sproxy/default.nix"
234244 ]