anchor.diff:              # buildInputs can be extended by the client by using extraBuildInputs,
               # but often propagatedBuildInputs is preferable anyway
               buildInputs = [ghc] ++ self.extraBuildInputs;
  -            extraBuildInputs = [];
  +            extraBuildInputs = self.buildTools ++
  +                               (if self.pkgconfigDepends == [] then [] else [pkgconfig]) ++
  +                               (if self.isLibrary then [] else self.buildDepends ++ self.extraLibraries ++ self.pkgconfigDepends);
   
               # we make sure that propagatedBuildInputs is defined, so that we don't
               # have to check for its existence
  -            propagatedBuildInputs = [];
  +            propagatedBuildInputs = if self.isLibrary then self.buildDepends ++ self.extraLibraries ++ self.pkgconfigDepends else [];
   
               # library directories that have to be added to the Cabal files
               extraLibDirs = [];
  +
  +            # build-depends Cabal field
  +            buildDepends = [];
  +
  +            # build-tools Cabal field
  +            buildTools = [];
  +
  +            # extra-libraries Cabal field
  +            extraLibraries = [];
  +
  +            # pkgconfig-depends Cabal field
  +            pkgconfigDepends = [];
  +
  +            isLibrary = ! self.isExecutable;
  +            isExecutable = false;
   
               libraryProfiling =
                 if enableLibraryProfiling then ["--enable-library-profiling"]
  
positive.code:             # in Cabal derivations.
              inherit stdenv ghc;
            };
      in  stdenv.mkDerivation ((rec { f = defaults f // args f; }).f);
  }
  
negative.code:             # all packages with haskell- to avoid name clashes for libraries;
              # if that is not desired (for applications), name can be set to
              # fname.
              name = if self.isLibrary then
                       if enableLibraryProfiling then
                         "haskell-${self.pname}-ghc${ghc.ghc.version}-${self.version}-profiling"
                       else
                         "haskell-${self.pname}-ghc${ghc.ghc.version}-${self.version}"
                     else
                       "${self.pname}-${self.version}";
  
              # the default download location for Cabal packages is Hackage,
              # you still have to specify the checksum
  