1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-21 13:10:33 +00:00

* Add callPackage etc.

svn path=/nixpkgs/trunk/; revision=22876
This commit is contained in:
Eelco Dolstra 2010-08-02 13:57:57 +00:00
parent 9ef0f1b935
commit fd268b4852
3 changed files with 96 additions and 61 deletions

View file

@ -63,4 +63,29 @@ rec {
x) else x;
/* Call the package function in the file `fn' with the required
arguments automatically. The function is called with the
arguments `args', but any missing arguments are obtained from
`autoArgs'. This function is intended to be partially
parameterised, e.g.,
callPackage = callPackageWith pkgs;
pkgs = {
libfoo = callPackage ./foo.nix { };
libbar = callPackage ./bar.nix { };
};
If the `libbar' function expects an argument named `libfoo', it is
automatically passed as an argument. Overrides or missing
arguments can be supplied in `args', e.g.
libbar = callPackage ./bar.nix {
libfoo = null;
enableX11 = true;
};
*/
callPackageWith = autoArgs: fn: args:
let f = import fn; in
makeOverridable f ((builtins.intersectAttrs (builtins.functionArgs f) autoArgs) // args);
}

View file

@ -1,4 +1,5 @@
args: with args;
{ stdenv, fetchurl, kernel, perl }:
stdenv.mkDerivation {
name = "ndiswrapper-1.53-stable";
@ -21,7 +22,7 @@ stdenv.mkDerivation {
'';
# should we use unstable?
src = args.fetchurl {
src = fetchurl {
url = http://downloads.sourceforge.net/ndiswrapper/ndiswrapper-1.53.tar.gz;
sha256 = "00622nxa3q9n8v7qdz274d0nzz9r13lx77xi27s5bnk0mkila03q";
};

View file

@ -99,6 +99,17 @@ let
pkgs = pkgsFun __overrides; # the overriden, final packages
# We use `callPackage' to be able to omit function arguments that
# can be obtained from `pkgs' or `pkgs.xorg' (i.e. `defaultScope').
# Use `newScope' for sets of packages in `pkgs' (see e.g. `gtkLibs'
# below).
callPackage = newScope {};
newScope = extra: lib.callPackageWith (defaultScope // extra);
defaultScope = pkgs // pkgs.xorg;
# The package compositions. Yes, this isn't properly indented.
pkgsFun = __overrides: with helperFunctions; helperFunctions // rec {
@ -1168,9 +1179,7 @@ let
inherit stdenv fetchgit libuuid lzo zlib acl;
};
multitran = recurseIntoAttrs (let
inherit fetchurl stdenv help2man;
in rec {
multitran = recurseIntoAttrs (let callPackage = newScope pkgs.multitran; in rec {
multitrandata = import ../tools/text/multitran/data {
inherit fetchurl stdenv;
};
@ -4217,11 +4226,11 @@ let
inherit (gnome) gtk;
};
gtkLibs = recurseIntoAttrs gtkLibs220;
gtkLibs = gtkLibs220;
glib = gtkLibs.glib;
gtkLibs1x = rec {
gtkLibs1x = recurseIntoAttrs (let callPackage = newScope pkgs.gtkLibs1x; in rec {
glib = import ../development/libraries/glib/1.2.x.nix {
inherit fetchurl stdenv;
@ -4231,9 +4240,9 @@ let
inherit fetchurl stdenv x11 glib;
};
};
});
gtkLibs216 = rec {
gtkLibs216 = recurseIntoAttrs (let callPackage = newScope pkgs.gtkLibs216; in rec {
glib = import ../development/libraries/glib/2.20.x.nix {
inherit fetchurl stdenv pkgconfig gettext perl;
@ -4264,13 +4273,13 @@ let
inherit fetchurl stdenv pkgconfig gtk atk glibmm cairomm pangomm;
};
};
});
gtkLibs218 = rec {
gtkLibs218 = recurseIntoAttrs (let callPackage = newScope pkgs.gtkLibs218; in rec {
glib = import ../development/libraries/glib/2.22.x.nix {
inherit fetchurl stdenv pkgconfig gettext perl;
libiconv = if (stdenv.system == "i686-freebsd") then libiconv else null;
libiconv = if stdenv.system == "i686-freebsd" then libiconv else null;
};
glibmm = import ../development/libraries/glibmm/2.22.x.nix {
@ -4298,13 +4307,13 @@ let
inherit fetchurl stdenv pkgconfig gtk atk glibmm cairomm pangomm;
};
};
});
gtkLibs220 = rec {
gtkLibs220 = recurseIntoAttrs (let callPackage = newScope pkgs.gtkLibs220; in rec {
glib = makeOverridable (import ../development/libraries/glib/2.24.x.nix) {
inherit fetchurl stdenv pkgconfig gettext perl zlib;
libiconv = if (stdenv.system == "i686-freebsd") then libiconv else null;
libiconv = if stdenv.system == "i686-freebsd" then libiconv else null;
};
glibmm = import ../development/libraries/glibmm/2.22.x.nix {
@ -4332,7 +4341,7 @@ let
inherit fetchurl stdenv pkgconfig gtk atk glibmm cairomm pangomm;
};
};
});
gtkmozembedsharp = import ../development/libraries/gtkmozembed-sharp {
inherit fetchurl stdenv mono pkgconfig monoDLLFixer;
@ -6603,7 +6612,7 @@ let
for a specific kernel. This function can then be called for
whatever kernel you're using. */
linuxPackagesFor = kernel: rec {
linuxPackagesFor = kernel: self: let callPackage = newScope self; in rec {
inherit kernel;
@ -6617,6 +6626,14 @@ let
inherit fetchurl stdenv kernel;
};
aufs2 = import ../os-specific/linux/aufs2 {
inherit fetchurl stdenv kernel perl;
};
aufs2_util = import ../os-specific/linux/aufs2-util {
inherit fetchurl stdenv kernel aufs2;
};
blcr = import ../os-specific/linux/blcr/0.8.2.nix {
inherit fetchurl stdenv kernel perl makeWrapper autoconf automake;
libtool = libtool_1_5; # libtool 2 causes a fork bomb
@ -6722,31 +6739,23 @@ let
inherit stdenv fetchurl lib patchelf cdrkit kernel;
inherit (xlibs) libX11 libXt libXext libXmu libXcomposite libXfixes;
};
} // (if kernel.features ? aufsBase then rec {
aufs2 = import ../os-specific/linux/aufs2 {
inherit fetchurl stdenv kernel perl;
};
aufs2_util = import ../os-specific/linux/aufs2-util {
inherit fetchurl stdenv kernel aufs2;
};
} else {});
# Build the kernel modules for the some of the kernels.
linuxPackages_2_6_25 = recurseIntoAttrs (linuxPackagesFor linux_2_6_25);
linuxPackages_2_6_27 = recurseIntoAttrs (linuxPackagesFor linux_2_6_27);
linuxPackages_2_6_28 = recurseIntoAttrs (linuxPackagesFor linux_2_6_28);
linuxPackages_2_6_29 = recurseIntoAttrs (linuxPackagesFor linux_2_6_29);
linuxPackages_2_6_31 = recurseIntoAttrs (linuxPackagesFor linux_2_6_31);
linuxPackages_2_6_32 = recurseIntoAttrs (linuxPackagesFor linux_2_6_32);
linuxPackages_2_6_25 = recurseIntoAttrs (linuxPackagesFor linux_2_6_25 pkgs.linuxPackages_2_6_25);
linuxPackages_2_6_27 = recurseIntoAttrs (linuxPackagesFor linux_2_6_27 pkgs.linuxPackages_2_6_27);
linuxPackages_2_6_28 = recurseIntoAttrs (linuxPackagesFor linux_2_6_28 pkgs.linuxPackages_2_6_28);
linuxPackages_2_6_29 = recurseIntoAttrs (linuxPackagesFor linux_2_6_29 pkgs.linuxPackages_2_6_29);
linuxPackages_2_6_31 = recurseIntoAttrs (linuxPackagesFor linux_2_6_31 pkgs.linuxPackages_2_6_31);
linuxPackages_2_6_32 = recurseIntoAttrs (linuxPackagesFor linux_2_6_32 pkgs.linuxPackages_2_6_32);
linuxPackages_2_6_32_systemtap =
recurseIntoAttrs (linuxPackagesFor linux_2_6_32_systemtap);
linuxPackages_2_6_33 = recurseIntoAttrs (linuxPackagesFor linux_2_6_33);
linuxPackages_2_6_34 = recurseIntoAttrs (linuxPackagesFor linux_2_6_34);
recurseIntoAttrs (linuxPackagesFor linux_2_6_32_systemtap pkgs.linuxPackages_2_6_32_systemtap);
linuxPackages_2_6_33 = recurseIntoAttrs (linuxPackagesFor linux_2_6_33 pkgs.linuxPackages_2_6_33);
linuxPackages_2_6_34 = recurseIntoAttrs (linuxPackagesFor linux_2_6_34 pkgs.linuxPackages_2_6_34);
# The current default kernel / kernel modules.
linux = linux_2_6_32;
linuxPackages = linuxPackagesFor linux;
linuxPackages = linuxPackages_2_6_32;
keyutils = import ../os-specific/linux/keyutils {
inherit fetchurl stdenv;