1
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs synced 2024-10-19 03:47:13 -04:00
nixpkgs/pkgs
Eelco Dolstra d17f0f9cbc * Use callPackage for most packages in all-packages.nix.
`callPackage' was described here:

    http://www.mail-archive.com/nix-dev@cs.uu.nl/msg02624.html

  It allows all-packages.nix to be shortened significantly (from 10152
  to 6980 lines) by automatically filling in package functions'
  required arguments from `pkgs'.  That is, a function

    { stdenv, fetchurl, libfoo, libbar }: ...

  can now be called as

    callPackage ./<bla>.nix { };

  rather than

    import ./<bla>.nix {
      inherit stdenv fetchurl libfoo libbar;
    };

  This reduces boring typing work when adding a dependency and reduces
  the number of trivial commits to all-packages.nix.

  Overrides or arguments that don't exist in `pkgs' can be passed
  explicitly, e.g.,

    callPackage ./<bla>.nix {
      libfoo = libfoo_1_2_3;
    };

  The conversion was done automatically with a magic Perl regexp.  I
  checked that `nix-env' produces the same results before and after
  (except for three packages that depend on webkit, which uses
  deepOverride).

  `callPackage' applies `makeOverridable' automatically, so almost
  every package now exports an `override' function.

  There are two downsides to using callPackage:

  - Evaluation is a bit slower (about 15% on `nix-env -qa --drv-path
    \*').

  - There can be unexpected results for functions that have default
    argument values.  For instance, a function

      { libfoo ? null }: ...

    called using `callPackage' will be passed a `libfoo' argument
    provided that `pkgs.libfoo' exists.  If this is used to control
    whether a package has to have a certain dependency, you need to
    explicitly write:

    callPackage ./<bla>.nix {
      libfoo = null;
    };

svn path=/nixpkgs/trunk/; revision=22885
2010-08-02 16:26:58 +00:00
..
applications svn path=/nixpkgs/trunk/; revision=22880 2010-08-02 16:01:55 +00:00
build-support
data
desktops
development svn path=/nixpkgs/trunk/; revision=22874 2010-08-02 12:55:54 +00:00
games
lib Moved 'zip' function from nixos/lib/build-vms.nix 2010-08-02 16:10:01 +00:00
misc
os-specific * Add callPackage etc. 2010-08-02 13:57:57 +00:00
servers
shells
stdenv
test
tools pkgs/tools/networking/nbd: install the README file to $out/share/doc 2010-08-02 13:37:36 +00:00
top-level * Use callPackage for most packages in all-packages.nix. 2010-08-02 16:26:58 +00:00