git.iko.soy/typeable/cabal2nix
on master help sign in
Merge branch 'master' into feature-local-only
f729341Benno Fünfstück
cabal2nix.cabal+8−5
@@ -1,5 +1,5 @@
1Name: cabal2nix
1Name: cabal2nix
2−Version: 1.62
2+Version: 1.67
3Copyright: Peter Simons, Andres Loeh
3Copyright: Peter Simons, Andres Loeh
4License: BSD3
4License: BSD3
5License-File: LICENSE
5License-File: LICENSE
@@ -10,7 +10,7 @@ Category: Distribution
10Synopsis: Convert Cabal files into Nix build instructions
10Synopsis: Convert Cabal files into Nix build instructions
11Cabal-Version: >= 1.8
11Cabal-Version: >= 1.8
12Build-Type: Custom
12Build-Type: Custom
13−Tested-With: GHC >= 6.12.3 && <= 7.8.1
13+Tested-With: GHC >= 6.10.4 && <= 7.8.3
14Data-files: README.md
14Data-files: README.md
15Description:
15Description:
16 The @cabal2nix@ utility converts Cabal files into Nix build instructions. The
16 The @cabal2nix@ utility converts Cabal files into Nix build instructions. The
@@ -18,11 +18,14 @@ Description:
18 .
18 .
19 > Usage: cabal2nix [options] url-to-cabal-file
19 > Usage: cabal2nix [options] url-to-cabal-file
20 > -h --help show this help text
20 > -h --help show this help text
21+ > --hackage-db=FILEPATH path to the local hackage db in tar format
21 > --sha256=HASH sha256 hash of source tarball
22 > --sha256=HASH sha256 hash of source tarball
22 > -m MAINTAINER --maintainer=MAINTAINER maintainer of this package (may be specified multiple times)
23 > -m MAINTAINER --maintainer=MAINTAINER maintainer of this package (may be specified multiple times)
23 > -p PLATFORM --platform=PLATFORM supported build platforms (may be specified multiple times)
24 > -p PLATFORM --platform=PLATFORM supported build platforms (may be specified multiple times)
24− > --no-check don't run regression test suites of this package
25 > --jailbreak don't honor version restrictions on build inputs
25 > --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
26 >
29 >
27 > Recognized URI schemes:
30 > Recognized URI schemes:
28 >
31 >
@@ -34,8 +37,8 @@ Description:
34 .
37 .
35 The only required argument is the path to the cabal file. For example:
38 The only required argument is the path to the cabal file. For example:
36 .
39 .
37− > cabal2nix http://hackage.haskell.org/packages/archive/cabal2nix/1.62/cabal2nix.cabal
40+ > cabal2nix http://hackage.haskell.org/packages/archive/cabal2nix/1.67/cabal2nix.cabal
38− > cabal2nix cabal://cabal2nix-1.62
41+ > cabal2nix cabal://cabal2nix-1.67
39 .
42 .
40 If the @--sha256@ option has not been specified, cabal2nix calls
43 If the @--sha256@ option has not been specified, cabal2nix calls
41 @nix-prefetch-url@ to determine the hash automatically. This causes
44 @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
5
5
6configureCabalFlags :: PackageIdentifier -> FlagAssignment
6configureCabalFlags :: PackageIdentifier -> FlagAssignment
7configureCabalFlags (PackageIdentifier (PackageName name) _)
7configureCabalFlags (PackageIdentifier (PackageName name) _)
8+ | name == "arithmoi" = [disable "llvm"]
8 | name == "accelerate-examples"= [disable "opencl"]
9 | name == "accelerate-examples"= [disable "opencl"]
9 | name == "git-annex" = [ enable "S3", enable "WebDAV", enable "Inotify"
10 | name == "git-annex" = [ enable "S3", enable "WebDAV", enable "Inotify"
10 , enable "Dbus", enable "Assistant", enable "Webapp"
11 , enable "Dbus", enable "Assistant", enable "Webapp"
@@ -15,7 +16,8 @@ configureCabalFlags (PackageIdentifier (PackageName name) _)
15 | name == "idris" = [enable "llvm", enable "gmp", enable "ffi"]
16 | name == "idris" = [enable "llvm", enable "gmp", enable "ffi"]
16 | name == "io-streams" = [enable "NoInteractiveTests"]
17 | name == "io-streams" = [enable "NoInteractiveTests"]
17 | name == "reactive-banana-wx" = [disable "buildExamples"]
18 | 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"]
19 | name == "xmonad-extras" = [disable "with_hlist", enable "with_split", enable "with_parsec"]
21 | name == "xmonad-extras" = [disable "with_hlist", enable "with_split", enable "with_parsec"]
20 | name == "yi" = [enable "pango"]
22 | name == "yi" = [enable "pango"]
21 | otherwise = []
23 | otherwise = []
src/Cabal2Nix/Generate.hs+1
@@ -31,6 +31,7 @@ cabal2nix cabal = normalize $ postProcess MkDerivation
31 , jailbreak = False
31 , jailbreak = False
32 , doCheck = True
32 , doCheck = True
33 , testTarget = ""
33 , testTarget = ""
34+ , hyperlinkSource = True
34 , phaseOverrides = ""
35 , phaseOverrides = ""
35 , metaSection = Meta
36 , metaSection = Meta
36 { homepage = Cabal.homepage descr
37 { homepage = Cabal.homepage descr
src/Cabal2Nix/Name.hs+4
@@ -20,10 +20,12 @@ libNixName :: String -> [String]
20libNixName "adns" = return "adns"
20libNixName "adns" = return "adns"
21libNixName "alsa" = return "alsaLib"
21libNixName "alsa" = return "alsaLib"
22libNixName "asound" = return "alsaLib"
22libNixName "asound" = return "alsaLib"
23+libNixName "bz2" = return "bzip2"
23libNixName "cairo-pdf" = return "cairo"
24libNixName "cairo-pdf" = return "cairo"
24libNixName "cairo-ps" = return "cairo"
25libNixName "cairo-ps" = return "cairo"
25libNixName "cairo" = return "cairo"
26libNixName "cairo" = return "cairo"
26libNixName "cairo-svg" = return "cairo"
27libNixName "cairo-svg" = return "cairo"
28+libNixName "crypt" = [] -- provided by glibc
27libNixName "crypto" = return "openssl"
29libNixName "crypto" = return "openssl"
28libNixName "dl" = [] -- provided by glibc
30libNixName "dl" = [] -- provided by glibc
29libNixName "gconf-2.0" = return "gconf"
31libNixName "gconf-2.0" = return "gconf"
@@ -54,6 +56,7 @@ libNixName "icuuc" = return "icu"
54libNixName "idn" = return "libidn"
56libNixName "idn" = return "libidn"
55libNixName "IL" = return "libdevil"
57libNixName "IL" = return "libdevil"
56libNixName "iw" = return "wirelesstools"
58libNixName "iw" = return "wirelesstools"
59+libNixName "jack" = return "jackaudio"
57libNixName "jpeg" = return "libjpeg"
60libNixName "jpeg" = return "libjpeg"
58libNixName "libglade-2.0" = return "libglade"
61libNixName "libglade-2.0" = return "libglade"
59libNixName "libgsasl" = return "gsasl"
62libNixName "libgsasl" = return "gsasl"
@@ -84,6 +87,7 @@ libNixName "xml2" = return "libxml2"
84libNixName "Xrandr" = return "libXrandr"
87libNixName "Xrandr" = return "libXrandr"
85libNixName "Xss" = return "libXScrnSaver"
88libNixName "Xss" = return "libXScrnSaver"
86libNixName "Xtst" = return "libXtst"
89libNixName "Xtst" = return "libXtst"
90+libNixName "Xxf86vm" = return "libXxf86vm"
87libNixName "zmq" = return "zeromq"
91libNixName "zmq" = return "zeromq"
88libNixName "z" = return "zlib"
92libNixName "z" = return "zlib"
89libNixName x = return x
93libNixName x = return x
src/Cabal2Nix/Package.hs+9−9
@@ -24,15 +24,15 @@ data Package = Package
24 , cabal :: Cabal.GenericPackageDescription
24 , cabal :: Cabal.GenericPackageDescription
25 }
25 }
26
26
27−getPackage :: Source -> IO Package
27+getPackage :: Maybe String -> Source -> IO Package
28−getPackage source = do
28+getPackage optHackageDB source = do
29− (derivSource, pkgDesc) <- fetchOrFromDB source
29+ (derivSource, pkgDesc) <- fetchOrFromDB optHackageDB source
30 flip Package pkgDesc <$> maybe (sourceFromHackage (sourceHash source) $ showPackageIdentifier pkgDesc) return derivSource
30 flip Package pkgDesc <$> maybe (sourceFromHackage (sourceHash source) $ showPackageIdentifier pkgDesc) return derivSource
31
31
32
32
33−fetchOrFromDB :: Source -> IO (Maybe DerivationSource, Cabal.GenericPackageDescription)
33+fetchOrFromDB :: Maybe String -> Source -> IO (Maybe DerivationSource, Cabal.GenericPackageDescription)
34−fetchOrFromDB src
34+fetchOrFromDB optHackageDB src
35− | "cabal://" `isPrefixOf` sourceUrl src = fmap ((,) Nothing) . fromDB . drop (length "cabal://") $ sourceUrl src
35+ | "cabal://" `isPrefixOf` sourceUrl src = fmap ((,) Nothing) . fromDB optHackageDB . drop (length "cabal://") $ sourceUrl src
36 | otherwise = do
36 | otherwise = do
37 r <- fetch cabalFromPath src
37 r <- fetch cabalFromPath src
38 case r of
38 case r of
@@ -40,9 +40,9 @@ fetchOrFromDB src
40 Just (derivSource, (externalSource, pkgDesc)) ->
40 Just (derivSource, (externalSource, pkgDesc)) ->
41 return (derivSource <$ guard externalSource, pkgDesc)
41 return (derivSource <$ guard externalSource, pkgDesc)
42
42
43−fromDB :: String -> IO Cabal.GenericPackageDescription
43+fromDB :: Maybe String -> String -> IO Cabal.GenericPackageDescription
44−fromDB pkg = do
44+fromDB optHackageDB pkg = do
45− pkgDesc <- (lookupVersion <=< DB.lookup name) <$> DB.readHackage
45+ pkgDesc <- (lookupVersion <=< DB.lookup name) <$> maybe DB.readHackage DB.readHackage' optHackageDB
46 case pkgDesc of
46 case pkgDesc of
47 Just r -> return r
47 Just r -> return r
48 Nothing -> hPutStrLn stderr "*** no such package in the cabal database (did you run cabal update?). " >> exitFailure
48 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 {..})
14 = deriv { buildTools = "perl":buildTools }
14 = deriv { buildTools = "perl":buildTools }
15 | pname == "alex" && version >= Version [3,1] []
15 | pname == "alex" && version >= Version [3,1] []
16 = deriv { buildTools = "perl":"happy":buildTools }
16 = deriv { buildTools = "perl":"happy":buildTools }
17+ | pname == "bindings-GLFW" = deriv { extraLibs = "libXext":"libXfixes":extraLibs }
17 | pname == "cabal2nix" = deriv { doCheck = True, phaseOverrides = cabal2nixDoCheckHook }
18 | pname == "cabal2nix" = deriv { doCheck = True, phaseOverrides = cabal2nixDoCheckHook }
18 | pname == "cabal-install" && version >= Version [0,14] []
19 | pname == "cabal-install" && version >= Version [0,14] []
19 = deriv { phaseOverrides = cabalInstallPostInstall }
20 = deriv { phaseOverrides = cabalInstallPostInstall }
@@ -36,19 +37,27 @@ postProcess deriv@(MkDerivation {..})
36 | pname == "gloss-raster" = deriv { extraLibs = "llvm":extraLibs }
37 | pname == "gloss-raster" = deriv { extraLibs = "llvm":extraLibs }
37 | pname == "GLUT" = deriv { extraLibs = "glut":"libSM":"libICE":"libXmu":"libXi":"mesa":extraLibs }
38 | pname == "GLUT" = deriv { extraLibs = "glut":"libSM":"libICE":"libXmu":"libXi":"mesa":extraLibs }
38 | pname == "gtk" = deriv { extraLibs = "pkgconfig":"libc":extraLibs, buildDepends = delete "gio" buildDepends }
39 | 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 }
39 | pname == "gtksourceview2" = deriv { extraLibs = "pkgconfig":"libc":extraLibs }
42 | pname == "gtksourceview2" = deriv { extraLibs = "pkgconfig":"libc":extraLibs }
43+ | pname == "haddock" && version < Version [2,14] []
40− | pname == "haddock" = deriv { buildTools = "alex":"happy":buildTools }
44+ = deriv { buildTools = "alex":"happy":buildTools }
41 | pname == "happy" = deriv { buildTools = "perl":buildTools }
45 | pname == "happy" = deriv { buildTools = "perl":buildTools }
42 | pname == "haskeline" = deriv { buildDepends = "utf8String":buildDepends }
46 | pname == "haskeline" = deriv { buildDepends = "utf8String":buildDepends }
43 | pname == "haskell-src" = deriv { buildTools = "happy":buildTools }
47 | pname == "haskell-src" = deriv { buildTools = "happy":buildTools }
44 | pname == "haskell-src-meta" = deriv { buildDepends = "uniplate":buildDepends }
48 | pname == "haskell-src-meta" = deriv { buildDepends = "uniplate":buildDepends }
45 | pname == "hflags" = deriv { metaSection = metaSection { license = Unknown (Just "Apache-2.0") } }
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\";" }
46 | pname == "HFuse" = deriv { phaseOverrides = hfusePreConfigure }
51 | pname == "HFuse" = deriv { phaseOverrides = hfusePreConfigure }
47 | pname == "highlighting-kate"= highlightingKatePostProcessing deriv
52 | pname == "highlighting-kate"= highlightingKatePostProcessing deriv
53+ | pname == "hlibgit2" = deriv { testDepends = "git":testDepends }
48 | pname == "HList" = deriv { buildTools = "diffutils":buildTools }
54 | pname == "HList" = deriv { buildTools = "diffutils":buildTools }
49 | pname == "hmatrix" = deriv { extraLibs = "gsl":"liblapack":"blas":extraLibs }
55 | pname == "hmatrix" = deriv { extraLibs = "gsl":"liblapack":"blas":extraLibs }
50 | pname == "hoogle" = deriv { testTarget = "--test-option=--no-net" }
56 | pname == "hoogle" = deriv { testTarget = "--test-option=--no-net" }
51 | pname == "hspec" = deriv { doCheck = False }
57 | 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 }
52 | pname == "idris" = deriv { buildTools = "happy":buildTools, extraLibs = "gmp":"boehmgc":extraLibs }
61 | pname == "idris" = deriv { buildTools = "happy":buildTools, extraLibs = "gmp":"boehmgc":extraLibs }
53 | pname == "language-c-quote" = deriv { buildTools = "alex":"happy":buildTools }
62 | pname == "language-c-quote" = deriv { buildTools = "alex":"happy":buildTools }
54 | pname == "language-java" = deriv { buildDepends = "syb":buildDepends }
63 | pname == "language-java" = deriv { buildDepends = "syb":buildDepends }
@@ -58,6 +67,7 @@ postProcess deriv@(MkDerivation {..})
58 | pname == "llvm-base" = deriv { extraLibs = "llvm":extraLibs }
67 | pname == "llvm-base" = deriv { extraLibs = "llvm":extraLibs }
59 | pname == "llvm-general" = deriv { doCheck = False }
68 | pname == "llvm-general" = deriv { doCheck = False }
60 | pname == "llvm-general-pure"= deriv { doCheck = False }
69 | pname == "llvm-general-pure"= deriv { doCheck = False }
70+ | pname == "MFlow" = deriv { buildTools = "cpphs":buildTools }
61 | pname == "markdown-unlit" = deriv { runHaddock = True, phaseOverrides = markdownUnlitNoHaddock }
71 | pname == "markdown-unlit" = deriv { runHaddock = True, phaseOverrides = markdownUnlitNoHaddock }
62 | pname == "multiarg" = deriv { buildDepends = "utf8String":buildDepends }
72 | pname == "multiarg" = deriv { buildDepends = "utf8String":buildDepends }
63 | pname == "mime-mail" = deriv { extraFunctionArgs = ["sendmail ? \"sendmail\""], phaseOverrides = mimeMailConfigureFlags }
73 | pname == "mime-mail" = deriv { extraFunctionArgs = ["sendmail ? \"sendmail\""], phaseOverrides = mimeMailConfigureFlags }
@@ -70,17 +80,27 @@ postProcess deriv@(MkDerivation {..})
70 | pname == "pcap" = deriv { extraLibs = "libpcap":extraLibs }
80 | pname == "pcap" = deriv { extraLibs = "libpcap":extraLibs }
71 | pname == "persistent" = deriv { extraLibs = "sqlite3":extraLibs }
81 | pname == "persistent" = deriv { extraLibs = "sqlite3":extraLibs }
72 | pname == "poppler" = deriv { extraLibs = "libc":extraLibs }
82 | pname == "poppler" = deriv { extraLibs = "libc":extraLibs }
83+ | pname == "QuickCheck" && version >= Version [2,7,3] []
84+ = deriv { runHaddock = True, phaseOverrides = quickCheckNoHaddock }
73 | pname == "repa-algorithms" = deriv { extraLibs = "llvm":extraLibs }
85 | pname == "repa-algorithms" = deriv { extraLibs = "llvm":extraLibs }
74 | pname == "repa-examples" = deriv { extraLibs = "llvm":extraLibs }
86 | pname == "repa-examples" = deriv { extraLibs = "llvm":extraLibs }
75 | pname == "SDL-image" = deriv { extraLibs = "SDL_image":extraLibs }
87 | pname == "SDL-image" = deriv { extraLibs = "SDL_image":extraLibs }
76 | pname == "SDL-mixer" = deriv { extraLibs = "SDL_mixer":extraLibs }
88 | pname == "SDL-mixer" = deriv { extraLibs = "SDL_mixer":extraLibs }
77 | pname == "SDL-ttf" = deriv { extraLibs = "SDL_ttf":extraLibs }
89 | pname == "SDL-ttf" = deriv { extraLibs = "SDL_ttf":extraLibs }
78 | pname == "sloane" = deriv { phaseOverrides = sloanePostInstall }
90 | pname == "sloane" = deriv { phaseOverrides = sloanePostInstall }
91+ | pname == "split" && version == Version [0,2,2] []
92+ = deriv { doCheck = True, phaseOverrides = splitDoCheck }
79 | pname == "structured-haskell-mode" = deriv { buildTools = "emacs":buildTools, phaseOverrides = structuredHaskellModePostInstall }
93 | pname == "structured-haskell-mode" = deriv { buildTools = "emacs":buildTools, phaseOverrides = structuredHaskellModePostInstall }
80 | pname == "svgcairo" = deriv { extraLibs = "libc":extraLibs }
94 | 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 }
81 | pname == "terminfo" = deriv { extraLibs = "ncurses":extraLibs }
98 | pname == "terminfo" = deriv { extraLibs = "ncurses":extraLibs }
99+ | pname == "text-icu" = deriv { doCheck = True, phaseOverrides = textIcuDoCheckHook }
82 | pname == "threadscope" = deriv { configureFlags = "--ghc-options=-rtsopts":configureFlags }
100 | 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\";" }
84 | pname == "vacuum" = deriv { extraLibs = "ghcPaths":extraLibs }
104 | pname == "vacuum" = deriv { extraLibs = "ghcPaths":extraLibs }
85 | pname == "wxc" = deriv { extraLibs = "wxGTK":"mesa":"libX11":extraLibs, phaseOverrides = wxcPostInstall }
105 | pname == "wxc" = deriv { extraLibs = "wxGTK":"mesa":"libX11":extraLibs, phaseOverrides = wxcPostInstall }
86 | pname == "wxcore" = deriv { extraLibs = "wxGTK":"mesa":"libX11":extraLibs }
106 | pname == "wxcore" = deriv { extraLibs = "wxGTK":"mesa":"libX11":extraLibs }
@@ -122,7 +142,8 @@ cudaConfigurePhase = unlines
122
142
123ghcModPostInstall :: String
143ghcModPostInstall :: String
124ghcModPostInstall = unlines
144ghcModPostInstall = unlines
145+ [ "configureFlags = \"--datasubdir=${self.pname}-${self.version}\";"
125− [ "postInstall = ''"
146+ , "postInstall = ''"
126 , " cd $out/share/$pname-$version"
147 , " cd $out/share/$pname-$version"
127 , " make"
148 , " make"
128 , " rm Makefile"
149 , " rm Makefile"
@@ -165,7 +186,7 @@ darcsInstallPostInstall = unlines
165
186
166highlightingKatePostProcessing :: Derivation -> Derivation
187highlightingKatePostProcessing :: Derivation -> Derivation
167highlightingKatePostProcessing deriv@(MkDerivation {..}) = deriv
188highlightingKatePostProcessing 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\";"
169 , buildDepends = "regex-pcre" : filter (/="regex-pcre-builtin") buildDepends
190 , buildDepends = "regex-pcre" : filter (/="regex-pcre-builtin") buildDepends
170 }
191 }
171
192
@@ -176,6 +197,10 @@ xmonadPostInstall = unlines
176 , " mkdir -p $out/share/man/man1"
197 , " mkdir -p $out/share/man/man1"
177 , " mv \"$out/\"**\"/man/\"*.1 $out/share/man/man1/"
198 , " mv \"$out/\"**\"/man/\"*.1 $out/share/man/man1/"
178 , "'';"
199 , "'';"
200+ , "patches = ["
201+ , " # Patch to make xmonad use XMONAD_{GHC,XMESSAGE} (if available)."
202+ , " ./xmonad_ghc_var_0.11.patch"
203+ , "];"
179 ]
204 ]
180
205
181gitAnnexOverrides :: String
206gitAnnexOverrides :: String
@@ -204,11 +229,6 @@ hfusePreConfigure :: String
204hfusePreConfigure = unlines
229hfusePreConfigure = unlines
205 [ "preConfigure = ''"
230 [ "preConfigure = ''"
206 , " sed -i -e \"s@ Extra-Lib-Dirs: /usr/local/lib@ Extra-Lib-Dirs: ${fuse}/lib@\" HFuse.cabal"
231 , " 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"
212 , "'';"
232 , "'';"
213 ]
233 ]
214
234
@@ -234,12 +254,22 @@ doctestNoHaddock = markdownUnlitNoHaddock
234cabal2nixDoCheckHook :: String
254cabal2nixDoCheckHook :: String
235cabal2nixDoCheckHook = "doCheck = self.stdenv.lib.versionOlder \"7.6\" self.ghc.version;"
255cabal2nixDoCheckHook = "doCheck = self.stdenv.lib.versionOlder \"7.6\" self.ghc.version;"
236
256
257+textIcuDoCheckHook :: String
258+textIcuDoCheckHook = "doCheck = !self.stdenv.isDarwin;"
259+
237eitherNoHaddock :: String
260eitherNoHaddock :: String
238eitherNoHaddock = "noHaddock = self.stdenv.lib.versionOlder self.ghc.version \"7.6\";"
261eitherNoHaddock = "noHaddock = self.stdenv.lib.versionOlder self.ghc.version \"7.6\";"
239
262
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+
240agdaPostInstall :: String
269agdaPostInstall :: String
241agdaPostInstall = unlines
270agdaPostInstall = unlines
242 [ "postInstall = ''"
271 [ "postInstall = ''"
272+ , " $out/bin/agda -c --no-main $out/share/Agda-*/lib/prim/Agda/Primitive.agda"
243 , " $out/bin/agda-mode compile"
273 , " $out/bin/agda-mode compile"
244 , "'';"
274 , "'';"
245 ]
275 ]
@@ -253,10 +283,6 @@ structuredHaskellModePostInstall = unlines
253 , "'';"
283 , "'';"
254 ]
284 ]
255
285
256−unixTimeConfigureFlags :: String
257−unixTimeConfigureFlags =
258− "configureFlags = self.stdenv.lib.optionalString self.enableSharedLibraries \"--ghc-option=-fPIC\";"
259−
260sloanePostInstall :: String
286sloanePostInstall :: String
261sloanePostInstall = unlines
287sloanePostInstall = unlines
262 [ "postInstall = ''"
288 [ "postInstall = ''"
@@ -269,3 +295,7 @@ mimeMailConfigureFlags :: String
269mimeMailConfigureFlags = unlines
295mimeMailConfigureFlags = unlines
270 [ "configureFlags = \"--ghc-option=-DMIME_MAIL_SENDMAIL_PATH=\\\"${sendmail}\\\"\";"
296 [ "configureFlags = \"--ghc-option=-DMIME_MAIL_SENDMAIL_PATH=\\\"${sendmail}\\\"\";"
271 ]
297 ]
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
59 , jailbreak :: Bool
59 , jailbreak :: Bool
60 , doCheck :: Bool
60 , doCheck :: Bool
61 , testTarget :: String
61 , testTarget :: String
62+ , hyperlinkSource :: Bool
62 , phaseOverrides :: String
63 , phaseOverrides :: String
63 , metaSection :: Meta
64 , metaSection :: Meta
64 }
65 }
@@ -72,7 +73,10 @@ instance Package Derivation where
72 packageId deriv = PackageIdentifier (PackageName (pname deriv)) (version deriv)
73 packageId deriv = PackageIdentifier (PackageName (pname deriv)) (version deriv)
73
74
74renderDerivation :: Derivation -> Doc
75renderDerivation :: Derivation -> Doc
76+renderDerivation deriv =
77+ text "# This file was auto-generated by cabal2nix. Please do NOT edit manually!" $$
78+ text "" $$
75−renderDerivation deriv = funargs (map text ("cabal" : inputs)) $$ vcat
79+ funargs (map text ("cabal" : inputs)) $$ vcat
76 [ text ""
80 [ text ""
77 , text "cabal.mkDerivation" <+> lparen <> text "self" <> colon <+> lbrace
81 , text "cabal.mkDerivation" <+> lparen <> text "self" <> colon <+> lbrace
78 , nest 2 $ vcat $
82 , nest 2 $ vcat $
@@ -91,6 +95,7 @@ renderDerivation deriv = funargs (map text ("cabal" : inputs)) $$ vcat
91 , boolattr "jailbreak" (jailbreak deriv) (jailbreak deriv)
95 , boolattr "jailbreak" (jailbreak deriv) (jailbreak deriv)
92 , boolattr "doCheck" (not (doCheck deriv)) (doCheck deriv)
96 , boolattr "doCheck" (not (doCheck deriv)) (doCheck deriv)
93 , onlyIf (testTarget deriv) $ attr "testTarget" $ string (testTarget deriv)
97 , onlyIf (testTarget deriv) $ attr "testTarget" $ string (testTarget deriv)
98+ , boolattr "hyperlinkSource" (not (hyperlinkSource deriv)) (hyperlinkSource deriv)
94 , onlyIf (phaseOverrides deriv) $ vcat ((map text . lines) (phaseOverrides deriv))
99 , onlyIf (phaseOverrides deriv) $ vcat ((map text . lines) (phaseOverrides deriv))
95 , disp (metaSection deriv)
100 , disp (metaSection deriv)
96 ]
101 ]
@@ -136,6 +141,7 @@ parseDerivation buf
136 , noHaddock <- buf `regsubmatch` "noHaddock *= *(true|false) *;"
141 , noHaddock <- buf `regsubmatch` "noHaddock *= *(true|false) *;"
137 , jailBreak <- buf `regsubmatch` "jailbreak *= *(true|false) *;"
142 , jailBreak <- buf `regsubmatch` "jailbreak *= *(true|false) *;"
138 , docheck <- buf `regsubmatch` "doCheck *= *(true|false) *;"
143 , docheck <- buf `regsubmatch` "doCheck *= *(true|false) *;"
144+ , hyperlSrc <- buf `regsubmatch` "hyperlinkSource *= *(true|false) *;"
139 = Just MkDerivation
145 = Just MkDerivation
140 { pname = name
146 { pname = name
141 , version = vers
147 , version = vers
@@ -159,6 +165,7 @@ parseDerivation buf
159 , jailbreak = jailBreak == ["true"]
165 , jailbreak = jailBreak == ["true"]
160 , doCheck = docheck == ["true"] || null docheck
166 , doCheck = docheck == ["true"] || null docheck
161 , testTarget = ""
167 , testTarget = ""
168+ , hyperlinkSource = hyperlSrc == ["true"] || null hyperlSrc
162 , phaseOverrides = ""
169 , phaseOverrides = ""
163 , metaSection = Meta
170 , metaSection = Meta
164 { homepage = ""
171 { homepage = ""
src/cabal2nix.hs+8−2
@@ -24,6 +24,8 @@ data Configuration = Configuration
24 , optDoCheck :: Bool
24 , optDoCheck :: Bool
25 , optJailbreak :: Bool
25 , optJailbreak :: Bool
26 , optRevision :: String
26 , optRevision :: String
27+ , optHyperlinkSource :: Bool
28+ , optHackageDb :: Maybe FilePath
27 }
29 }
28 deriving (Show)
30 deriving (Show)
29
31
@@ -38,18 +40,22 @@ defaultConfiguration = Configuration
38 , optDoCheck = True
40 , optDoCheck = True
39 , optJailbreak = False
41 , optJailbreak = False
40 , optRevision = ""
42 , optRevision = ""
43+ , optHyperlinkSource = True
44+ , optHackageDb = Nothing
41 }
45 }
42
46
43options :: [OptDescr (Configuration -> Configuration)]
47options :: [OptDescr (Configuration -> Configuration)]
44options =
48options =
45 [ Option "h" ["help"] (NoArg (\o -> o { optPrintHelp = True })) "show this help text"
49 [ 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"
46 , Option "" ["sha256"] (ReqArg (\x o -> o { optSha256 = Just x }) "HASH") "sha256 hash of source tarball"
51 , Option "" ["sha256"] (ReqArg (\x o -> o { optSha256 = Just x }) "HASH") "sha256 hash of source tarball"
47 , Option "m" ["maintainer"] (ReqArg (\x o -> o { optMaintainer = x : optMaintainer o }) "MAINTAINER") "maintainer of this package (may be specified multiple times)"
52 , Option "m" ["maintainer"] (ReqArg (\x o -> o { optMaintainer = x : optMaintainer o }) "MAINTAINER") "maintainer of this package (may be specified multiple times)"
48 , Option "p" ["platform"] (ReqArg (\x o -> o { optPlatform = x : optPlatform o }) "PLATFORM") "supported build platforms (may be specified multiple times)"
53 , 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"
49 , Option "" ["no-haddock"] (NoArg (\o -> o { optHaddock = False })) "don't run Haddock when building this package"
55 , Option "" ["no-haddock"] (NoArg (\o -> o { optHaddock = False })) "don't run Haddock when building this package"
50 , Option "" ["no-check"] (NoArg (\o -> o { optDoCheck = False })) "don't run regression test suites of this package"
56 , 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"
52 , Option "" ["rev"] (ReqArg (\x o -> o { optRevision = x }) "REVISION") "revision, only used when fetching from VCS"
57 , 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"
53 ]
59 ]
54
60
55usage :: String
61usage :: String
@@ -83,7 +89,7 @@ main = bracket (return ()) (\() -> hFlush stdout >> hFlush stderr) $ \() -> do
83 when (optPrintHelp cfg) (putStr usage >> exitSuccess)
89 when (optPrintHelp cfg) (putStr usage >> exitSuccess)
84 when (length args /= 1) (cmdlineError "*** exactly one url-to-cabal-file must be specified\n")
90 when (length args /= 1) (cmdlineError "*** exactly one url-to-cabal-file must be specified\n")
85
91
86− pkg <- getPackage $ Source (head args) (optRevision cfg) (optSha256 cfg)
92+ pkg <- getPackage (optHackageDb cfg) $ Source (head args) (optRevision cfg) (optSha256 cfg)
87
93
88 let deriv = (cabal2nix $ cabal pkg) { src = source pkg, runHaddock = optHaddock cfg, jailbreak = optJailbreak cfg }
94 let deriv = (cabal2nix $ cabal pkg) { src = source pkg, runHaddock = optHaddock cfg, jailbreak = optJailbreak cfg }
89 deriv' = deriv { metaSection = (metaSection deriv)
95 deriv' = deriv { metaSection = (metaSection deriv)
src/hackage4nix.hs+11−1
@@ -120,6 +120,7 @@ updateNixPkgs paths = do
120 , runHaddock = runHaddock deriv
120 , runHaddock = runHaddock deriv
121 , doCheck = doCheck deriv
121 , doCheck = doCheck deriv
122 , jailbreak = jailbreak deriv
122 , jailbreak = jailbreak deriv
123+ , hyperlinkSource = hyperlinkSource deriv
123 }
124 }
124 meta = metaSection deriv'
125 meta = metaSection deriv'
125 plats' = if null plats then platforms meta else plats
126 plats' = if null plats then platforms meta else plats
@@ -228,7 +229,16 @@ badPackagePaths = [ -- These expression are not found on Hackage:
228 , "top-level/all-packages.nix", "top-level/haskell-packages.nix"
229 , "top-level/all-packages.nix", "top-level/haskell-packages.nix"
229 -- This build is way too complicated to maintain it automatically.
230 -- This build is way too complicated to maintain it automatically.
230 , "pkgs/development/compilers/pakcs/default.nix"
231 , "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"
231 -- Not registered on Hackage.
235 -- 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"
233 , "pkgs/tools/networking/sproxy-web/default.nix"
242 , "pkgs/tools/networking/sproxy-web/default.nix"
243+ , "pkgs/tools/networking/sproxy/default.nix"
234 ]
244 ]