[Nix-dev] [PATCH] Enable freetype support in xmobar using PostProcess.hs, Flags.hs

Peter Simons simons at cryp.to
Mon Sep 19 19:13:58 CEST 2011


Hi Alexander,

your patch is applied in the latest version of cabal2nix (in a slightly
modified form):

 > --- a/src/Cabal2Nix/Flags.hs
 > +++ b/src/Cabal2Nix/Flags.hs
 > @@ -9,6 +9,7 @@ pkgConfigureFlags (PackageIdentifier (PackageName name) _)
 >   | name == "threadscope"        = ([], ["--ghc-options=-rtsopts"])
 >   | name == "X11-xft"            = ([], ["--extra-include-dirs=${freetype}/include/freetype2"])
 >   | name == "xmonad-extras"      = ([disable "with_hlist", disable "with_mpd"], [])
 > + | name == "xmobar"             = ([], ["--flags=with_xft"])
 >   | otherwise                    = ([],[])

The logic in that list is as follows: the first value of the tuple defines
Cabal flags that may be set or unset. The second value defines "additional"
parameters to be passed at configure time, such as "--extra-include-dirs",
etc. The 'with_xft' flag can be set by adding 'enable "with_xft"' in the
first list. The difference between those two kinds of settings is that Cabal
flags modify the way the Cabal file is processed, whereas the second kind of
settings are relevant only for the actual build.


 > --- a/src/Cabal2Nix/PostProcess.hs
 > +++ b/src/Cabal2Nix/PostProcess.hs
 > @@ -34,4 +34,5 @@ postProcess deriv@(MkDerivation {..})
 >    | pname == "wxcore"           = deriv { extraLibs = "wxGTK":"mesa":"libX11":extraLibs }
 >    | pname == "X11"              = deriv { extraLibs = "libXinerama":"libXext":extraLibs }
 >    | pname == "X11-xft"          = deriv { extraLibs = "pkgconfig":"freetype":"fontconfig":extraLibs }
 > +  | pname == "xmobar"           = deriv { buildDepends = "X11Xft":buildDepends }
 >    | otherwise                   = deriv

Cabal2nix automatically picks up that additional dependency when the Cabal
flag is configured as described above.

Thank you very much for the patch!

Take care,
Peter



More information about the nix-dev mailing list