.. | ||
_4/_4th | ||
_9/_9base | ||
a4/a4 | ||
aa/aarch64-esr-decoder | ||
ac/action-validator | ||
af/afterstep | ||
ai/airscan | ||
al | ||
ao/aocl-utils | ||
ar | ||
as | ||
aw/aws-azure-login | ||
ba | ||
be/berry | ||
bi | ||
bm/bmake | ||
bo | ||
br/bruno | ||
ca | ||
cd | ||
ce/celluloid | ||
ci | ||
cl | ||
cn/cntb | ||
co | ||
cr/create-react-app | ||
ct/ctx | ||
de/debianutils | ||
di/dialog | ||
dj/djent | ||
dm/dmenu-bluetooth | ||
do | ||
dx | ||
dy/dyalog | ||
ec | ||
ek/eksctl | ||
el/elvish | ||
en/engage | ||
es/esbuild-config | ||
eu/eudev | ||
ez/eza | ||
fl/fleng | ||
fo/fortune-kind | ||
ga | ||
gb/gbar | ||
ge/germinal | ||
gh | ||
gi | ||
gm/gmic | ||
go/goat | ||
gr/grimblast | ||
gu | ||
ha | ||
he | ||
hy | ||
i3/i3bar-river | ||
ic/icewm | ||
if/ifrextractor-rs | ||
im | ||
in | ||
ir/ironbar | ||
ji/jinja2-cli | ||
ju/justbuild | ||
ka/katriawm | ||
ke/kermit-terminal | ||
kt/ktfmt | ||
ku/kubectl-neat | ||
la/labwc | ||
le | ||
li | ||
ll/llama-cpp | ||
lu/luastatus | ||
lx/lxd-to-incus | ||
ma | ||
me/mermaid-cli | ||
mf/mfoc-hardnested | ||
mi | ||
mk/mksh | ||
ml/mlx42 | ||
na/nawk | ||
ne | ||
nf/nfft | ||
ni | ||
nl/nls | ||
no/notion | ||
ns/nsxiv | ||
nu/nuget | ||
oe/oelint-adv | ||
op/openpgl | ||
or/orchard | ||
ou/outputcheck | ||
pa/passes | ||
pd/pdepend | ||
pe | ||
ph/phpdocumentor | ||
pl/platformsh | ||
po/poethepoet | ||
pp/ppsspp | ||
pr | ||
px/pxder | ||
py/pyp | ||
qu/quicktype | ||
ra | ||
rc/rc | ||
re | ||
ri | ||
ro | ||
rs | ||
ru/rusti-cal | ||
sa/samrewritten | ||
sc | ||
se/searxng | ||
sh | ||
si | ||
sl | ||
sm/smallwm | ||
so/sound-of-sorting | ||
sp | ||
ss/sssnake | ||
st/static-server | ||
su | ||
sy/symbolicator | ||
tc/tcsh | ||
th | ||
ti | ||
tm/tmuxifier | ||
tr | ||
tu/tuxmux | ||
tx/txr | ||
uc | ||
ud | ||
ui/uiua | ||
un | ||
up | ||
ux/uxn | ||
wa | ||
wi/windowmaker | ||
wo/wonderdraft | ||
xm/xmldiff | ||
xo/xorriso | ||
xs/xscreensaver | ||
ye/yeahwm | ||
yt/ytui-music | ||
zc/zcfan | ||
zi/zitadel | ||
zp/zpaqfranz | ||
zx/zxpy | ||
README.md |
Name-based package directories
The structure of this directory maps almost directly to top-level package attributes. This is the recommended way to add new top-level packages to Nixpkgs when possible.
Packages found in the named-based structure do not need to be explicitly added to the
top-level/all-packages.nix
file unless they require overriding the default value
of an implicit attribute (see below).
Example
The top-level package pkgs.some-package
may be declared by setting up this file structure:
pkgs
└── by-name
├── so
┊ ├── some-package
┊ └── package.nix
Where some-package
is the package name and so
is the lowercased 2-letter prefix of the package name.
The package.nix
may look like this:
# A function taking an attribute set as an argument
{
# Get access to top-level attributes for use as dependencies
lib,
stdenv,
libbar,
# Make this derivation configurable using `.override { enableBar = true }`
enableBar ? false,
}:
# The return value must be a derivation
stdenv.mkDerivation {
# ...
buildInputs =
lib.optional enableBar libbar;
}
You can also split up the package definition into more files in the same directory if necessary.
Once defined, the package can be built from the Nixpkgs root directory using:
nix-build -A some-package
See the general package conventions for more information on package definitions.
Changing implicit attribute defaults
The above expression is called using these arguments by default:
{
lib = pkgs.lib;
stdenv = pkgs.stdenv;
libbar = pkgs.libbar;
}
But the package might need pkgs.libbar_2
instead.
While the function could be changed to take libbar_2
directly as an argument,
this would change the .override
interface, breaking code like .override { libbar = ...; }
.
So instead it is preferable to use the same generic parameter name libbar
and override its value in pkgs/top-level/all-packages.nix
:
libfoo = callPackage ../by-name/so/some-package/package.nix {
libbar = libbar_2;
};
Manual migration guidelines
Most packages are still defined in all-packages.nix
and the category hierarchy.
Please hold off migrating your maintained packages to this directory.
-
An automated migration for the majority of packages is being worked on. In order to save on contributor and reviewer time, packages should only be migrated manually afterwards if they couldn't be migrated automatically.
-
Manual migrations should only be lightly encouraged if the relevant code is being worked on anyways. For example with a package update or refactoring.
-
Manual migrations should not remove definitions from
all-packages.nix
with custom arguments. That is a backwards-incompatible change because it changes the.override
interface. Such packages may still be moved topkgs/by-name
however, while keeping the definition inall-packages.nix
. See also changing implicit attribute defaults.
Limitations
There's some limitations as to which packages can be defined using this structure:
-
Only packages defined using
pkgs.callPackage
. This excludes packages defined usingpkgs.python3Packages.callPackage ...
.Instead use the category hierarchy for such attributes.
-
Only top-level packages. This excludes packages for other package sets like
pkgs.pythonPackages.*
.Refer to the definition and documentation of the respective package set to figure out how such packages can be declared.
Validation
CI performs certain checks on the pkgs/by-name
structure.
This is done using the nixpkgs-check-by-name
tool.
The version of this tool used is the one that corresponds to the NixOS channel of the PR base branch.
See here for details.
The tool can be run locally using
nix-build -A tests.nixpkgs-check-by-name
result/bin/nixpkgs-check-by-name .