Names of files and directories should be in lowercase, with
dashes between words — not in camel case. For instance, it should be
all-packages.nix
, not
allPackages.nix
or
AllPackages.nix
.
Each package should be stored in its own directory somewhere in
the pkgs/
tree, i.e. in
pkgs/
.
Below are some rules for picking the right category for a package.
Many packages fall under several categories; what matters is the
primary purpose of a package. For example, the
category
/subcategory
/...
/pkgname
libxml2
package builds both a library and some
tools; but it’s a library foremost, so it goes under
pkgs/development/libraries
.
When in doubt, consider refactoring the
pkgs/
tree, e.g. creating new categories or
splitting up an existing category.
development/libraries
(e.g. libxml2
)
development/compilers
(e.g. gcc
)
development/interpreters
(e.g. guile
)
development/tools/parsing
(e.g. bison
, flex
)
development/tools/build-managers
(e.g. gnumake
)
development/tools/misc
(e.g. binutils
)
development/misc
(A tool is a relatively small program, especially one intented to be used non-interactively.)
tools/networking
(e.g. wget
)
tools/text
(e.g. diffutils
)
tools/system
(e.g. cron
)
tools/archivers
(e.g. zip
, tar
)
tools/compression
(e.g. gzip
, bzip2
)
tools/security
(e.g. nmap
, gnupg
)
tools/misc
shells
(e.g. bash
)
servers/http
(e.g. apache-httpd
)
servers/x11
(e.g. xorg
— this includes the client libraries and programs)
servers/misc
desktops
(e.g. kde
, gnome
, enlightenment
)
applications/window-managers
(e.g. awesome
, compiz
, stumpwm
)
A (typically large) program with a distinct user interface, primarily used interactively.
applications/version-management
(e.g. subversion
)
applications/video
(e.g. vlc
)
applications/graphics
(e.g. gimp
)
applications/networking/mailreaders
(e.g. thunderbird
)
applications/networking/newsreaders
(e.g. pan
)
applications/networking/browsers
(e.g. firefox
)
applications/networking/misc
applications/misc
data/fonts
data/sgml+xml/schemas/xml-dtd
(e.g. docbook
)
(Okay, these are executable...)
data/sgml+xml/stylesheets/xslt
(e.g. docbook-xsl
)
games
misc
Because every version of a package in Nixpkgs creates a potential maintenance burden, old versions of a package should not be kept unless there is a good reason to do so. For instance, Nixpkgs contains several versions of GCC because other packages don’t build with the latest version of GCC. Other examples are having both the latest stable and latest pre-release version of a package, or to keep several major releases of an application that differ significantly in functionality.
If there is only one version of a package, its Nix expression
should be named e2fsprogs/default.nix
. If there
are multiple versions, this should be reflected in the filename,
e.g. e2fsprogs/1.41.8.nix
and
e2fsprogs/1.41.9.nix
. The version in the
filename should leave out unnecessary detail. For instance, if we
keep the latest Firefox 2.0.x and 3.5.x versions in Nixpkgs, they
should be named firefox/2.0.nix
and
firefox/3.5.nix
, respectively (which, at a given
point, might contain versions 2.0.0.20
and
3.5.4
). If a version requires many auxiliary
files, you can use a subdirectory for each version,
e.g. firefox/2.0/default.nix
and
firefox/3.5/default.nix
.
All versions of a package must be included
in all-packages.nix
to make sure that they
evaluate correctly.