all-packages.nix: Provide a shorter way to specify packages

There are zillions of lines of the form

  foo = callPackage ../bla/foo { };

in all-packages.nix. To get rid of this verbosity, you can now list
such packages in pkgs/auto-packages.nix. This is just a list of
package file names, e.g.

  development/libraries/libogg
  development/libraries/libvorbis
  tools/archivers/gnutar

If the package needs non-default function arguments, or if its
intended attribute name is different from its file name, then you
cannot put it in auto-packages.nix and instead need to specify it in
all-packages.nix.

If Nix had a glob function (https://github.com/NixOS/nix/pull/235), we
could even get rid of auto-packages.nix and have package expressions
be discovered automatically. However, that might not be desirable
because of the need to traverse the file system to find packages we
may not even use.
This commit is contained in:
Eelco Dolstra 2014-07-22 15:58:18 +02:00
parent beb47fa3b6
commit ece61b7cc8
2 changed files with 32 additions and 18 deletions

16
pkgs/auto-packages.nix Normal file
View File

@ -0,0 +1,16 @@
/* A list of file names of package Nix expressions, whose base names
match the intended attribute names, and that do not need to be
called with any overrides. Thus, listing ./foo.nix here is
equivalent to defining the attribute
foo = callPackage ./foo.nix { };
in all-packages.nix. */
[
build-support/libredirect
development/libraries/libogg
development/libraries/libvorbis
tools/archivers/gnutar
tools/system/acct
]

View File

@ -130,11 +130,19 @@ let
in pkgs;
# The package compositions. Yes, this isn't properly indented.
# The package compositions.
pkgsFun = pkgs: overrides:
with helperFunctions;
let defaultScope = pkgs // pkgs.xorg; self = self_ // overrides;
self_ = with self; helperFunctions // {
let
defaultScope = pkgs // pkgs.xorg;
autoPackages = lib.listToAttrs
(map (fn: { name = baseNameOf (toString fn); value = pkgs.callPackage fn { }; })
(import ../auto-packages.nix));
self = self_ // autoPackages // overrides;
self_ = with self; helperFunctions //
# Yes, this isn't properly indented.
{
# Make some arguments passed to all-packages.nix available
inherit system stdenvType platform;
@ -361,8 +369,6 @@ let
inherit url;
};
libredirect = callPackage ../build-support/libredirect { };
makeDesktopItem = import ../build-support/make-desktopitem {
inherit stdenv;
};
@ -427,8 +433,6 @@ let
### TOOLS
acct = callPackage ../tools/system/acct { };
acoustidFingerprinter = callPackage ../tools/audio/acoustid-fingerprinter {
ffmpeg = ffmpeg_1;
};
@ -1159,8 +1163,6 @@ let
gnused = callPackage ../tools/text/gnused { };
gnutar = callPackage ../tools/archivers/gnutar { };
gnuvd = callPackage ../tools/misc/gnuvd { };
goaccess = callPackage ../tools/misc/goaccess { };
@ -5366,8 +5368,6 @@ let
libofx = callPackage ../development/libraries/libofx { };
libogg = callPackage ../development/libraries/libogg { };
liboggz = callPackage ../development/libraries/liboggz { };
liboil = callPackage ../development/libraries/liboil { };
@ -5534,8 +5534,6 @@ let
libvterm = callPackage ../development/libraries/libvterm { };
libvorbis = callPackage ../development/libraries/libvorbis { };
libwebp = callPackage ../development/libraries/libwebp { };
libwmf = callPackage ../development/libraries/libwmf { };
@ -10417,13 +10415,13 @@ let
callPackage = newScope pkgs.cinnamon;
inherit (gnome3) gnome_common libgnomekbd gnome-menus zenity;
muffin = callPackage ../desktops/cinnamon/muffin.nix { } ;
muffin = callPackage ../desktops/cinnamon/muffin.nix { };
cinnamon-control-center = callPackage ../desktops/cinnamon/cinnamon-control-center.nix{ };
cinnamon-control-center = callPackage ../desktops/cinnamon/cinnamon-control-center.nix { };
cinnamon-settings-daemon = callPackage ../desktops/cinnamon/cinnamon-settings-daemon.nix{ };
cinnamon-settings-daemon = callPackage ../desktops/cinnamon/cinnamon-settings-daemon.nix { };
cinnamon-session = callPackage ../desktops/cinnamon/cinnamon-session.nix{ } ;
cinnamon-session = callPackage ../desktops/cinnamon/cinnamon-session.nix { };
cinnamon-desktop = callPackage ../desktops/cinnamon/cinnamon-desktop.nix { };