1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-12-25 03:17:13 +00:00
nixpkgs/pkgs/by-name
2024-12-10 09:24:35 -04:00
..
_0
_1
_2
_3
_4
_5/_5etools
_6
_7
_9
a2
a4/a4
a5/a52dec
aa
ab
ac
ad
ae
af
ag
ah
ai
aj/aj-snapshot
ak/akira-unstable
al
am
an
ao/aocl-utils
ap
aq
ar
as
at
au
av
aw
ax
ay
az
b3/b3sum
b4
b6/b612
ba
bb
bc
bd
be
bf
bg
bi
bj/bjumblr
bk
bl
bm
bn/bngblaster
bo
bp
bq
br
bs
bt
bu
bv
bw
by
bz/bzrtp
c-
c2
c3
c6/c64-debugger
ca cargo-temp: 0.2.22 -> 0.3.0 (#362635) 2024-12-10 20:09:57 +08:00
cb
cc
cd
ce
cf
cg
ch chance: 4.0.0 -> 4.0.1 (#363827) 2024-12-10 20:26:49 +08:00
ci
cj
ck
cl
cm
cn
co codeql: 2.19.3 -> 2.19.4 (#363359) 2024-12-10 11:06:04 +00:00
cp
cq/cq
cr
cs
ct
cu
cv
cw
cx
cy
cz
d-
d2
da databricks-cli: 0.234.0 -> 0.236.0 (#363361) 2024-12-10 11:04:24 +00:00
db
dc
dd
de
df
dg
dh
di
dj
dk
dl
dm
dn
do
dp
dq
dr
ds
dt
du
dv
dw
dx
dy
dz/dzen2
e1
e2
ea
eb
ec
ed
ee/eepers
ef
eg
ei
ej
ek
el
em
en
eo
ep
eq
er
es
et
eu
ev
ew
ex exo: 0-unstable-2024-11-30 -> 0-unstable-2024-12-07 2024-12-10 12:28:51 +00:00
ey
ez
f1
f2
f3/f3
f5/f5_6
fa
fb
fc
fd
fe
ff
fg
fh
fi
fj/fjo
fl flameshot: 12.1.0-unstable-2024-09-01 -> 12.1.0-unstable-2024-12-03 (#362828) 2024-12-10 20:16:05 +08:00
fm
fn
fo
fp
fq/fq
fr
fs
ft
fu
fv
fw
fx
fy
fz
g-/g-wrap
g1/g15daemon
g2/g203-led
g3/g3kb-switch
g8/g810-led
g9/g933-utils
ga
gb
gc
gd
ge
gf
gg
gh
gi git-repo: 2.48 -> 2.49.3 (#363817) 2024-12-10 11:20:09 +00:00
gj
gk/gk-cli
gl
gm
gn
go
gp
gq
gr
gs
gt
gu
gv
gw
gx
gy
gz
h2
h5/h5utils
h8/h8mail
ha
hb
hc
hd
he
hf
hh
hi
hj/hjson-go
hl/hledger-check-fancyassertions
hm
hn
ho
hp
hq/hqplayerd
hr
hs
ht
hu
hv/hvm
hw
hx/hxtools
hy
i-/i-dot-ming
i2
i3
i8/i810switch
ia
ib
ic
id
if
ig
ih/ihp-new
ii
ij
ik
il
im
in
io
ip
iq
ir
is
it
iu/iucode-tool
iv
iw
ix/ix
iz/izrss
j/j
j4/j4-dmenu-desktop
ja
jb
jc
jd
je
jf
jg/jgmenu
jh
ji
jj/jj
jm
jn
jo
jp
jq
jr
js
jt
ju
jw
jx
jy/jython
k0/k0sctl
k2
k3
k4/k40-whisperer
k6/k6
k8
k9/k9s
ka
kb
kc
kd
ke
kf/kfilt
kg/kgeotag
kh
ki
kl
km
kn
ko
kp
kr
ks
kt
ku
kv
kw
kx
ky
l2/l2md
la
lb
lc
ld
le
lf/lftp
lg
lh
li
lk
ll
lm
ln
lo
lp
lr
ls
lt
lu
lv
lw
lx
ly
lz
m-/m-cli
m1
m2
m3/m33-linux
m4
m8/m8c
ma
mb
mc
md
me
mf
mg
mh/mhddfs
mi clash-meta: 1.18.10 -> 1.19.0 (#363558) 2024-12-10 11:08:02 +00:00
mj
mk
ml
mm
mn
mo
mp
mq
mr
ms
mt
mu
mv
mw/mw
mx
my
n2
n3/n3
n8/n8n
n9
na
nb
nc
nd
ne
nf
ng
nh
ni
nj/njam
nk
nl
nm
nn
no
np
nq
nr
ns
nt
nu
nv
nw
nx
ny
nz
oa
ob
oc
od
oe
of
og
oh
oi
ok
ol
om
on
oo
op
oq
or
os
ot
ou
ov
ow
ox
p0/p0f
p1/p11-kit
p2/p2pool
p3/p3x-onenote
p4/p4d
p9/p910nd
pa
pb
pc
pd
pe
pf
pg
ph
pi picocrypt: 1.44 -> 1.45 (#363345) 2024-12-10 20:07:15 +08:00
pk
pl
pm
pn
po
pp
pq
pr
ps
pt
pu
pv
pw
px
py
pz/pzip
q-/q-text-as-data
q2/q2pro
qa
qb
qc
qd
qe
qg
qh
qi/qidi-slicer-bin
qm
qn/qnial
qo
qp
qq
qr
qs
qt qtscrcpy: 3.0.0 -> 3.0.1 (#363525) 2024-12-10 20:01:14 +08:00
qu
qw/qwerty-fr
r0/r0vm
r1
r2
r5/r53-ddns
ra
rb
rc
rd
re
rf
rg
rh
ri
rk
rl
rm
rn
ro
rp
rq
rr
rs
rt
ru runescape: fix fhsenv version (#363179) 2024-12-10 20:33:30 +08:00
rv/rvvm
rw
rx
ry
rz/rzip
s-
s0/s0ix-selftest-tool
s2
s3
s4/s4cmd
s5
s7/s7
s9/s9fes
sa
sb
sc scooter: 0.1.2 -> 0.2.1 (#363590) 2024-12-10 20:23:32 +08:00
sd
se
sf
sg
sh
si
sj/sjasmplus
sk
sl
sm
sn
so
sp
sq
sr
ss
st stm32cubemx: 6.12.1 -> 6.13.0 (#363379) 2024-12-10 20:07:50 +08:00
su
sv
sw
sx
sy
sz
t-/t-rex
t1
t4/t4kcommon
ta
tb
tc
td
te
tf
tg
th
ti
tk
tl
tm
tn
to
tp
tq/tqsl
tr
ts
tt
tu
tv
tw
tx
ty
tz
u-
u0/u001-font
u2/u2ps
u3/u3-tool
u9/u9fs
ua
ub
uc
ud
ue
uf
ug
uh
ui
uk/ukmm
ul
um
un
up
uq
ur
us
ut
uu
uv
uw
ux
v2
v4/v4l2-relayd
va
vb
vc
vd
ve
vf/vfkit
vg
vh
vi
vk
vl
vm
vn
vo
vp
vr
vs
vt
vu
vv
vw
vx/vxl
vy
vz/vzic
w3/w3m
w_
wa watchlog: 1.240.0 -> 1.242.0 2024-12-10 12:52:23 +00:00
wb
wc
wd
we
wf
wg
wh
wi
wk/wkhtmltopdf
wl
wm
wo
wp
wq
wr
ws
wt
wu
wv
ww/wwcd
wx
wy
x-/x-create-mouse-void
x1
x2
x3/x3270
x4
x8/x86info
xa
xb
xc
xd
xe
xf
xg
xh
xi
xj
xk
xl
xm
xn
xo
xp
xq
xr
xs
xt
xu
xv
xw
xx
xy/xylib
xz
ya
yc/ycmd
yd
ye
yg
yj/yj
yl/yle-dl
ym
yo
yp/ypbind-mt
yq/yq-go
ys/ysfx
yt
yu
yx/yx
yy/yyjson
z-/z-lua
z8/z88dk
za
zb
zc
zd
ze
zf
zg
zi
zk
zl
zm
zn
zo
zp
zr
zs
zt
zu
zv/zvbi
zw/zwave-js-server
zx
zy/zydis
zz
README.md

Name-based package directories

The structure of this directory maps almost directly to top-level package attributes. Add new top-level packages to Nixpkgs using this mechanism whenever possible.

Packages found in the name-based structure are automatically included, without needing to be added to all-packages.nix. However if the implicit attribute defaults need to be changed for a package, this must still be declared in all-packages.nix.

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 attribute name corresponding to the package, and so is the lowercase 2-letter prefix of the attribute 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. Since it would take a lot of contributor and reviewer time to migrate all packages manually, an automated migration is planned, though it is expected to still take some time to get done. If you're interested in helping out with this effort, please see this ticket.

Since only PRs to packages in pkgs/by-name can be automatically merged, if package maintainers would like to use this feature, they are welcome to migrate their packages to pkgs/by-name. To lessen PR traffic, they're encouraged to also perform some more general maintenance on the package in the same PR, though this is not required and must not be expected.

Note that callPackage definitions in all-packages.nix with custom arguments should not be removed. That is a backwards-incompatible change because it changes the .override interface. Such packages may still be moved to pkgs/by-name however, in order to avoid the slightly superficial choice of directory / category in which the default.nix file was placed, but please keep the definition in all-packages.nix using callPackage. See also changing implicit attribute defaults.

Definitions like the following however, can be transitioned:

# all-packages.nix
fooWithBaz = foo.override {
  bar = baz;
};
# turned into pkgs/by-name/fo/fooWithBaz/package.nix with:
{
  foo,
  baz,
}:

foo.override {
  bar = baz;
}

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-vet tool.

You can locally emulate the CI check using

$ ./ci/nixpkgs-vet.sh master

See here for more info.

Recommendation for new packages with multiple versions

These checks of the pkgs/by-name structure can cause problems in combination:

  1. New top-level packages using callPackage must be defined via pkgs/by-name.
  2. Packages in pkgs/by-name cannot refer to files outside their own directory.

This means that outside pkgs/by-name, multiple already-present top-level packages can refer to some common file. If you open a PR to another instance of such a package, CI will fail check 1, but if you try to move the package to pkgs/by-name, it will fail check 2.

This is often the case for packages with multiple versions, such as

{
  foo_1 = callPackage ../tools/foo/1.nix { };
  foo_2 = callPackage ../tools/foo/2.nix { };
}

The best way to resolve this is to not use callPackage directly, such that check 1 doesn't trigger. This can be done by using inherit on a local package set:

{
  inherit
    ({
      foo_1 = callPackage ../tools/foo/1.nix { };
      foo_2 = callPackage ../tools/foo/2.nix { };
    })
    foo_1
    foo_2
    ;
}

While this may seem pointless, this can in fact help with future package set refactorings, because it establishes a clear connection between related attributes.

Further possible refactorings

This is not required, but the above solution also allows refactoring the definitions into a separate file:

{
  inherit (import ../tools/foo pkgs)
    foo_1 foo_2;
}
# pkgs/tools/foo/default.nix
pkgs: {
  foo_1 = callPackage ./1.nix { };
  foo_2 = callPackage ./2.nix { };
}

Alternatively using callPackages if callPackage isn't used underneath and you want the same .override arguments for all attributes:

{
  inherit (callPackages ../tools/foo { })
    foo_1 foo_2;
}
# pkgs/tools/foo/default.nix
{
  stdenv
}: {
  foo_1 = stdenv.mkDerivation { /* ... */ };
  foo_2 = stdenv.mkDerivation { /* ... */ };
}

Exposing the package set

This is not required, but the above solution also allows exposing the package set as an attribute:

{
  foo-versions = import ../tools/foo pkgs;
  # Or using callPackages
  # foo-versions = callPackages ../tools/foo { };

  inherit (foo-versions) foo_1 foo_2;
}