[Nix-dev] getPkgConfig considered harmful

David Guibert david.guibert at gmail.com
Mon May 17 19:35:56 CEST 2010


Hi,

In a personal repo, I'm trying Eelco's proposition about callPackage
explained here
http://thread.gmane.org/gmane.linux.distributions.nixos/3753/focus=3764 or
http://wiki.nixos.org/wiki/Open_issues:derivation_styles#get-args-in-file_2.

I think it can solve this issue...

On 17/05/2010 12:14, Lluís Batlle i Rossell wrote:
> Michael Raskind and me just hit the problem described by kosmikus, related to
> getPkgConfig "ikiwiki" "git" ...
> 
> because we have configuration set for git, for example.
> git = { svnSupport = true; } 
> 
> I support the change kosmikus proposed, of using the
> getConfig [ "global" "git" ] option instead of getConfig [ "git" ].
> 
> OTH, I don't like much the current usage of getPkgConfig. I can't propose
> anything better though. I'd go with getConfig alone.

In all-packages.nix, the function callPackage looks like:
"""
callPackage = f: args:
    makeOverridable f ((builtins.intersectAttrs (builtins.functionArgs f)
      (pkgs // pkgs.gnome // pkgs.gtkLibs // pkgs.xorg //
       pkgs.pythonPackages // pkgs.perlPackages // pkgs.gtkLibs //
       gst_all
      )) // args);
"""
The list of packages (pkgs // pkgs.gnome // ...) is intersected with the
the arguments of every function written using "{arg1, arg2, ...}: " to
set them without duplication.

*In this list* we can add "config", so that global options can be then
defined as usual. And when needed we could override the packages...
"""
config = {
# enable svn support globally
    svnSupport = true;
    packageOverrides = pkgs : {
#override ikiwiki to enable locally git
        ikiwiki = pkgs.ikiwiki.override {
            gitSupport = true;
        };
    };
};
"""
-- 
Regards, David



More information about the nix-dev mailing list