nixpkgs/pkgs/by-name
Peder Bergebakken Sundt e9b7a38612
Merge pull request #273830 from surfaceflinger/anime4k-init
anime4k: init at 4.0.1
2023-12-17 14:30:43 +01:00
..
_4/_4th
_9/_9base
a4/a4
aa
ab/aba
ac
ad
ae/aeron-cpp
af/afterstep
ai
al
am/amazon-ssm-agent
an/anime4k
ao/aocl-utils
ap
ar
as
at/athens
au/auto-epp
av/avr-sim
aw
ax/axmldec
ay/ayatana-indicator-messages
ba
be
bi
bk/bk
bl/bluetility
bm/bmake
bn/bngblaster
bo
br
bu
c2
ca
cb/cbmbasic
cd
ce
cg/cgl
ch/changelog-d
ci
cl
cm
cn/cntb
co
cp/cpu-x
cr
ct/ctx
cy
da/dark-mode-notify
db/dbus-cpp
de
di
dj/djent
dm/dmenu-bluetooth
do
dr/drone-scp
dt/dtcmp
du
dv/dvb-apps
dx
dy/dyalog
ec
ei/eiwd
ek/eksctl
el/elvish
em
en
er/eriscmd
es/esbuild-config
eu/eudev
ez/eza
fa
fc
fe/feather
ff
fi/firewalk
fl
fm
fn/fnott
fo
fr
ga
gb/gbar
gc
ge
gh
gi
gl/glycin-loaders
gm/gmic
go
gr
gu
ha
hd/hdrop
he
hi/hifile
hj/hjson-go
ho
hy
i3
ia/ia-writer-quattro
ic/icewm
id/idsk
if/ifrextractor-rs
im
in
ir/ironbar
ja
ji
jo/joycond-cemuhook
ju/justbuild
ka/katriawm
kc/kconfig-frontends
kd/kdsingleapplication
ke
kg/kgeotag
ki/kikit
km/kmsvnc
ko
ks/kseexpr
kt/ktfmt
ku
la
lc/lcab
le
li
ll
ln/lngen
lo/loupe
lu
lw/lwgrp
lx/lxd-to-incus
m2
ma
mc/mcuboot-imgtool
me
mf/mfoc-hardnested
mi
mk/mksh
ml/mlx42
mo
mp/mpifileutils
ms/msolve
mu/mus
my/mystmd
n2/n2
na
ne
nf/nfft
nh/nh
ni
nl/nls
nn/nncp
no
nr/nrpl
ns
nu
nw/nwg-drawer
oa
oc
oe/oelint-adv
of/offpunk
oh/oh-my-fish
on
op
or/orchard
ot
ou/outputcheck
ow/owncloud-client
pa
pd
pe
pg/pgmoneta
ph
pi
pl
po
pp/ppsspp
pr
pt/pterm
pw/pw3270
px/pxder
py
pz/pzip
qa/qadwaitadecorations
qr/qrtool
qu
ra
rc
re
ri
ro
rp/rpcs3
rq/rqbit
rs
rt/rtl-sdr-osmocom
ru
sa
sc
sd/sdcc
se
sg/sgfutils
sh
si
sl
sm
sn
so
sp
ss/sssnake
st
su
sv/svix-server
sw
sx/sxhkd
sy
ta
tc/tcsh
te
th
ti
tk/tkdiff
tl/tlrc
tm/tmuxifier
to/torrentstream
tp
tr
tt/ttop
tu
tx/txr
ty
uc
ud
ui
un
up
us/usql
ut/ut
uu/uuu
ux/uxn
va/valijson
vc
ve
vg/vgm2x
vi
wa
wb/wb32-dfu-updater
we/websecprobe
wh
wi
wl/wl-gammarelay-rs
wo
wp/wp-cli
ws/wslay
wt/wtfis
xa/xarcan
xd
xm/xmldiff
xo
xs
ye/yeahwm
yg/yggdrasil
yt
yu/yunfaavatar
za/zapzap
zb/zbus-xmlgen
zc/zcfan
ze/zesarux
zi/zitadel
zp
zs/zs
zu/zug
zw/zwave-js-server
zx
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.

  1. 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.

  2. Manual migrations should only be lightly encouraged if the relevant code is being worked on anyways. For example with a package update or refactoring.

  3. 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 to pkgs/by-name however, while keeping the definition in all-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 using pkgs.python3Packages.callPackage ....

    Instead:

    • Either change the package definition to work with pkgs.callPackage.
    • Or use the category hierarchy.
  • 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 .