git.iko.soy/typeable/cabal2nix
on master help sign in
Don't mix cabal flags and general-purpose configure flags in the same type.
e90b404Peter Simons
cabal2nix.cabal+3−3
@@ -1,5 +1,5 @@
1Name: cabal2nix
1Name: cabal2nix
2−Version: 1.17
2+Version: 1.18
3Copyright: Peter Simons, Andres Loeh
3Copyright: Peter Simons, Andres Loeh
4License: BSD3
4License: BSD3
5License-File: LICENSE
5License-File: LICENSE
@@ -46,7 +46,7 @@ Executable cabal2nix
46 main-is: Cabal2Nix.hs
46 main-is: Cabal2Nix.hs
47 hs-source-dirs: src
47 hs-source-dirs: src
48 Build-Depends: base >= 3 && < 5, regex-posix, pretty, Cabal >= 1.8,
48 Build-Depends: base >= 3 && < 5, regex-posix, pretty, Cabal >= 1.8,
49− filepath, directory, process, HTTP, nixos-types
49+ filepath, directory, process, HTTP, nixos-types >= 1.2
50 Extensions: PatternGuards, RecordWildCards, CPP
50 Extensions: PatternGuards, RecordWildCards, CPP
51 Ghc-Options: -Wall
51 Ghc-Options: -Wall
52 other-modules: Cabal2Nix.CorePackages
52 other-modules: Cabal2Nix.CorePackages
@@ -62,7 +62,7 @@ Executable hackage4nix
62 main-is: Hackage4Nix.hs
62 main-is: Hackage4Nix.hs
63 hs-source-dirs: src
63 hs-source-dirs: src
64 Build-Depends: base >= 3 && < 5, regex-posix, pretty, Cabal >= 1.8,
64 Build-Depends: base >= 3 && < 5, regex-posix, pretty, Cabal >= 1.8,
65− mtl, containers, directory, filepath, nixos-types >= 1.1,
65+ mtl, containers, directory, filepath, nixos-types >= 1.2,
66 hackage-db
66 hackage-db
67 Extensions: PatternGuards, RecordWildCards, CPP
67 Extensions: PatternGuards, RecordWildCards, CPP
68 Ghc-Options: -Wall
68 Ghc-Options: -Wall
src/Cabal2Nix/Flags.hs+7−9
@@ -1,16 +1,14 @@
1−module Cabal2Nix.Flags ( pkgConfigureFlags ) where
1+module Cabal2Nix.Flags ( configureCabalFlags ) where
2
2
3import Distribution.Package
3import Distribution.Package
4import Distribution.PackageDescription
4import Distribution.PackageDescription
5
5
6−pkgConfigureFlags :: PackageIdentifier -> (FlagAssignment,[String])
6+configureCabalFlags :: PackageIdentifier -> FlagAssignment
7−pkgConfigureFlags (PackageIdentifier (PackageName name) _)
7+configureCabalFlags (PackageIdentifier (PackageName name) _)
8− | name == "pandoc" = ([enable "highlighting", enable "threaded"],[])
8+ | name == "pandoc" = [enable "highlighting", enable "threaded"]
9− | name == "threadscope" = ([], ["--ghc-options=-rtsopts"])
10− | name == "X11-xft" = ([], ["--extra-include-dirs=${freetype}/include/freetype2"])
11− | name == "xmonad-extras" = ([disable "with_hlist", disable "with_mpd"], [])
9+ | name == "xmonad-extras" = [disable "with_hlist", disable "with_mpd"]
12− | name == "xmobar" = ([enable "with_xft"], [])
10+ | name == "xmobar" = [enable "with_xft"]
13− | otherwise = ([],[])
11+ | otherwise = []
14
12
15enable :: String -> (FlagName,Bool)
13enable :: String -> (FlagName,Bool)
16enable name = (FlagName name, True)
14enable name = (FlagName name, True)
src/Cabal2Nix/Generate.hs+3−2
@@ -24,7 +24,8 @@ cabal2nix cabal = normalize $ postProcess $ MkDerivation
24 , buildTools = map unDep tools
24 , buildTools = map unDep tools
25 , extraLibs = libs
25 , extraLibs = libs
26 , pkgConfDeps = pcs
26 , pkgConfDeps = pcs
27− , configureFlags = pkgConfigureFlags pkg
27+ , configureFlags = []
28+ , cabalFlags = configureCabalFlags pkg
28 , runHaddock = True
29 , runHaddock = True
29 , metaSection = Meta
30 , metaSection = Meta
30 { homepage = Cabal.homepage descr
31 { homepage = Cabal.homepage descr
@@ -44,7 +45,7 @@ cabal2nix cabal = normalize $ postProcess $ MkDerivation
44 libs = concatMap Cabal.extraLibs (libDeps ++ exeDeps)
45 libs = concatMap Cabal.extraLibs (libDeps ++ exeDeps)
45 pcs = map unDep (concatMap Cabal.pkgconfigDepends (libDeps ++ exeDeps))
46 pcs = map unDep (concatMap Cabal.pkgconfigDepends (libDeps ++ exeDeps))
46 Right (tpkg, _) = finalizePackageDescription
47 Right (tpkg, _) = finalizePackageDescription
47− (fst (pkgConfigureFlags pkg))
48+ (configureCabalFlags pkg)
48 (const True)
49 (const True)
49 (Platform I386 Linux) -- shouldn't be hardcoded
50 (Platform I386 Linux) -- shouldn't be hardcoded
50 (CompilerId GHC (Version [7,0,4] [])) -- dito
51 (CompilerId GHC (Version [7,0,4] [])) -- dito
src/Cabal2Nix/PostProcess.hs+4−1
@@ -30,8 +30,11 @@ postProcess deriv@(MkDerivation {..})
30 | pname == "SDL-ttf" = deriv { extraLibs = "SDL_ttf":extraLibs }
30 | pname == "SDL-ttf" = deriv { extraLibs = "SDL_ttf":extraLibs }
31 | pname == "svgcairo" = deriv { extraLibs = "libc":extraLibs }
31 | pname == "svgcairo" = deriv { extraLibs = "libc":extraLibs }
32 | pname == "terminfo" = deriv { extraLibs = "ncurses":extraLibs }
32 | pname == "terminfo" = deriv { extraLibs = "ncurses":extraLibs }
33+ | pname == "threadscope" = deriv { configureFlags = "--ghc-options=-rtsopts":configureFlags }
33 | pname == "vacuum" = deriv { extraLibs = "ghcPaths":extraLibs }
34 | pname == "vacuum" = deriv { extraLibs = "ghcPaths":extraLibs }
34 | pname == "wxcore" = deriv { extraLibs = "wxGTK":"mesa":"libX11":extraLibs }
35 | pname == "wxcore" = deriv { extraLibs = "wxGTK":"mesa":"libX11":extraLibs }
35 | pname == "X11" = deriv { extraLibs = "libXinerama":"libXext":extraLibs }
36 | pname == "X11" = deriv { extraLibs = "libXinerama":"libXext":extraLibs }
36− | pname == "X11-xft" = deriv { extraLibs = "pkgconfig":"freetype":"fontconfig":extraLibs }
37+ | pname == "X11-xft" = deriv { extraLibs = "pkgconfig":"freetype":"fontconfig":extraLibs
38+ , configureFlags = "--extra-include-dirs=${freetype}/include/freetype2":configureFlags
39+ }
37 | otherwise = deriv
40 | otherwise = deriv