nixpkgs/pkgs/by-name
Weijia Wang 10b5f09f36
Merge pull request #320263 from quantenzitrone/chow
CHOWTapeModel,Chow{Centaur,Phaser,Kick}: rename to chow-{tape-model,centaur,phaser,kick}
2024-06-18 10:22:36 +02:00
..
_0/_0xpropo
_2/_2ship2harkinian
_4
_6/_64gram _64gram: 1.1.27 -> 1.1.29 2024-06-16 18:13:28 +00:00
_9/_9base
a4/a4
a5/a52dec
aa
ab
ac
ad Merge pull request #319550 from fabaff/ad-miner-bump 2024-06-14 09:33:00 +02:00
ae
af
ag
ai
al
am amazon-ssm-agent: remove overrideEtc parameter 2024-06-12 11:50:17 +02:00
an ananicy-cpp: fix license 2024-06-16 22:13:30 +02:00
ao/aocl-utils
ap apt: 2.9.4 -> 2.9.5 2024-06-15 09:30:52 +00:00
ar arxiv-latex-cleaner: 1.0.5 -> 1.0.6 2024-06-17 05:14:24 +00:00
as aseprite: add vigress8 to maintainers 2024-06-17 13:55:13 +04:00
at atlauncher: 3.4.36.5 -> 3.4.36.6 2024-06-16 15:08:16 +04:00
au Merge pull request #316901 from doronbehar/pkg/autotools-language-server 2024-06-18 09:52:14 +03:00
av
aw
ax
ay Merge pull request #316891 from r-ryantm/auto-update/ayatana-indicator-session 2024-06-16 12:11:33 +02:00
ba Merge pull request #310617 from wentasah/package/python-babeltrace 2024-06-18 09:47:22 +03:00
bc
bd
be Merge pull request #319684 from r-ryantm/auto-update/beekeeper-studio 2024-06-16 22:38:28 +02:00
bi Merge pull request #318744 from Bot-wxt1221/updatebilibili 2024-06-18 01:15:56 +08:00
bk/bk
bl Merge pull request #260000 from lelgenio/init-blade-formatter 2024-06-12 01:19:56 +02:00
bm/bmake
bn/bngblaster
bo Merge pull request #315183 from jopejoe1/fix-pname 2024-06-16 12:34:01 +00:00
bp
bq/bqn
br bruno: fix build failure on darwin 2024-06-14 21:15:26 -03:00
bs
bt btrfs-assistant: cleanup 2024-06-13 19:08:23 -05:00
bu
by
c2
c-
ca Merge pull request #315143 from isabelroses/update-catppuccin 2024-06-18 02:23:25 +08:00
cb
cc
cd cdecl: 16.4.1 -> 17.0 2024-06-14 02:51:28 +00:00
ce cent: 1.3.3 -> 1.3.4 2024-06-12 01:06:38 +00:00
cg
ch ChowKick: rename to chow-kick 2024-06-16 15:56:52 +02:00
ci cimg: fix hash 2024-06-16 10:20:19 +02:00
cl
cm
cn/cntb
co Merge pull request #319736 from r-ryantm/auto-update/cockpit 2024-06-16 22:37:16 +02:00
cp
cr cryptor: add desktop item 2024-06-12 23:12:24 +02:00
cs
ct/ctx
cu cue: 0.9.0 -> 0.9.1 2024-06-14 19:13:30 +08:00
cv/cvemap
cy
cz/czkawka
da Merge pull request #311867 from luftmensch-luftmensch/datatrove_0.2.0 2024-06-11 19:48:02 +02:00
db Merge pull request #320205 from yzx9/update-dbeaver-bin-darwin 2024-06-16 20:26:25 +02:00
dc/dc3dd
dd
de debianutils: 5.18 -> 5.19 2024-06-17 10:50:30 +00:00
dg/dgoss
dh/dhcpig
di Merge pull request #315183 from jopejoe1/fix-pname 2024-06-16 12:34:01 +00:00
dj/djent
dm dmarc-report-converter: 0.8.0 -> 0.8.1 2024-06-17 12:01:26 +00:00
dn
do Merge pull request #315183 from jopejoe1/fix-pname 2024-06-16 12:34:01 +00:00
dp
dr
ds
dt dtools: 2.108.0 -> 2.109.0 2024-06-15 08:28:13 +00:00
du dune3d: fix darwin build 2024-06-11 15:00:05 +02:00
dv/dvb-apps
dx
dy dynamodb-local: 2.5.0 -> 2.5.1 2024-06-12 04:17:23 +00:00
e1/e1s
ea
eb
ec
ed eduvpn-client: 4.2.1 -> 4.3.1 2024-06-15 16:14:50 +02:00
ee/eepers
ei
ej/ejsonkms
ek/eksctl eksctl: 0.181.0 -> 0.182.0 2024-06-11 23:33:10 +00:00
el
em
en
ep Merge pull request #319035 from wegank/epoll-shim-bump 2024-06-16 00:02:44 +02:00
er
es
et
eu
ev
ew/eww
ex
ez/eza eza: 0.18.17 -> 0.18.18 2024-06-13 14:42:36 +00:00
fa
fb/fbset
fc
fe
ff Merge pull request #318611 from r-ryantm/auto-update/fflogs 2024-06-11 20:03:09 +00:00
fg/fgqcanvas
fi Merge pull request #320666 from r-ryantm/auto-update/files-cli 2024-06-18 05:23:59 +00:00
fj/fjo
fl flashmq: 1.14.0 -> 1.15.1 2024-06-17 12:40:39 +00:00
fm
fn/fnott
fo forgejo: 7.0.3 -> 7.0.4 2024-06-13 20:04:37 +02:00
fr freecell-solver: 6.8.0 -> 6.10.0 2024-06-15 03:38:27 +00:00
fs
ft/fte
fu
fv
fw/fwupd fwupd: 1.9.20 -> 1.9.21 2024-06-14 08:21:16 +02:00
fy/fypp
fz fzf-make: 0.32.0 -> 0.33.0 2024-06-11 04:34:20 +00:00
g3/g3kb-switch
ga gamescope: don't patch out force_fallback_for 2024-06-14 03:57:20 -04:00
gb
gc
gd
ge
gf
gg/gg
gh ghciwatch: 0.5.16 -> 1.0.0 2024-06-17 00:45:09 +00:00
gi gitu: 0.20.1 -> 0.21.0 2024-06-17 01:01:55 +00:00
gl
gm gmic-qt: 3.3.6 -> 3.4.0 2024-06-16 19:35:26 +02:00
gn
go google-chrome: 125.0.6422.141 -> 126.0.6478.61 2024-06-15 12:45:57 +05:30
gp
gr graphite-cli: 1.3.6 -> 1.3.8 2024-06-17 12:51:24 -04:00
gt
gu
gv/gvisor
gx/gxml
h8/h8mail
ha Merge pull request #320662 from r-ryantm/auto-update/havn 2024-06-18 10:18:56 +02:00
hb/hb-honeypot
hd
he
hi highs: 1.7.0 -> 1.7.1 2024-06-11 14:14:41 +00:00
hj/hjson-go
hn/hn-text hn-text: init at 0.1.4 2024-06-12 05:22:40 +08:00
ho home-manager: 0-unstable-2024-06-04 -> 0-unstable-2024-06-13 2024-06-14 11:25:27 +00:00
ht
hu
hy hyprland: 0.40.0-unstable-2024-05-05 -> 0.41.1 2024-06-14 22:37:40 +05:30
i2/i2p
i3
ia
ic icewm: 3.5.1 -> 3.6.0 2024-06-16 13:21:22 +00:00
id ida-free: fix desktop item 2024-06-14 14:16:50 +02:00
if/ifrextractor-rs
ig igvm-tooling: add katexochen as maintainer 2024-06-13 12:05:50 +02:00
ii
ij/ijhttp
im immich-go: 0.17.0 -> 0.17.1 2024-06-16 08:50:10 +02:00
in
io/ioq3-scion
ip
ir irrd: 4.4.2 -> 4.4.4; fix build (#319522) 2024-06-13 17:27:40 +02:00
is/iscc
it
iw/iw
iz/izrss
ja Merge pull request #315183 from jopejoe1/fix-pname 2024-06-16 12:34:01 +00:00
jd/jdt-language-server
je
ji
jj/jj
jn
jo Merge pull request #320291 from JulienMalka/init-joularjx 2024-06-17 00:00:48 +02:00
jq/jq-zsh-plugin
jr/jrl-cmakemodules
js/jsoncons jsoncons: 0.175.0 -> 0.176.0 2024-06-11 03:51:29 +00:00
jt/jtdx
ju just: 1.28.0 -> 1.29.1 2024-06-15 22:07:54 +02:00
ka
kc
kd
ke Merge pull request #318917 from jzbor/update-kermit-terminal 2024-06-11 11:04:29 +02:00
kg/kgeotag
ki kitex: init at 0.10.0 2024-06-12 15:20:19 +08:00
kl/klog-time-tracker
km
kn
ko Merge pull request #318627 from msanft/kontemplate/build-go-module 2024-06-17 20:40:19 +02:00
kp/kplex
kr
ks
kt ktls-utils: 0.10 -> 0.11 2024-06-14 16:31:23 +00:00
ku kubo: 0.28.0 -> 0.29.0 2024-06-11 15:47:09 +02:00
kx
ky
la Merge pull request #303238 from kanielrkirby/new-pkg/lazysql 2024-06-16 21:21:58 +02:00
lb
lc lc0: 0.30.0 -> 0.31.0 2024-06-17 01:14:21 +00:00
ld
le Merge pull request #320506 from r-ryantm/auto-update/lefthook 2024-06-17 13:03:11 +00:00
li Merge pull request #320295 from quantenzitrone/librearp 2024-06-18 10:22:18 +02:00
lk/lk-jwt-service
ll
lm
ln/lngen
lo local-ai: 2.15.0 -> 2.16.0 2024-06-15 22:15:55 +02:00
lp
ls
lt/ltris
lu lunar-client: 3.2.9 -> 3.2.10 2024-06-15 01:38:04 +00:00
lw/lwgrp
lx
lz
m1/m1ddc
m2
ma marwaita-x: 1.2 -> 1.2.1 2024-06-17 15:47:20 +00:00
mb
mc
md
me media-downloader: add aleksana as maintainer 2024-06-17 04:30:50 +08:00
mf
mg
mi miru: 5.1.0 -> 5.1.3 2024-06-17 01:25:35 +00:00
mk
ml/mlx42
mo mousam: 1.2.0 -> 1.3.1 2024-06-12 04:18:06 +00:00
mp
mq
ms
mu multiplex: init at 0.1.4 2024-06-17 03:13:41 +08:00
my myks: 4.1.3 -> 4.2.0 2024-06-14 03:59:11 +00:00
n2/n2
na namespace-cli: 0.0.374 -> 0.0.376 2024-06-13 15:08:10 +00:00
nb
nc
nd/ndstrim
ne Merge pull request #320119 from emilazy/remove-myself-from-unused-packages 2024-06-16 01:19:51 +02:00
nf
ng
nh nh: 3.5.16 -> 3.5.17 2024-06-18 02:11:26 +00:00
ni nickel: 1.6.0 -> 1.7.0 2024-06-16 20:13:46 +00:00
nl
nm/nmap-parse
nn/nncp
no nom: 2.5.0 -> 2.5.1 2024-06-17 00:55:40 +02:00
np
nr nrf-udev: init at 1.0.1 2024-06-15 20:40:11 +02:00
ns
nt/ntfs2btrfs
nu nuclei-templates: 9.8.8 -> 9.8.9 2024-06-14 18:27:41 +00:00
nv
nw nwg-panel: move to pkgs/by-name 2024-06-16 16:50:14 +09:00
nx/nxengine-evo
oa
ob
oc ocis-bin: 5.0.1 -> 5.0.5 2024-06-11 12:25:26 +01:00
oe/oelint-adv
of
oh oh-my-posh: 21.3.0 -> 21.9.1 2024-06-15 02:11:50 +00:00
oi
ok/okolors
ol Merge pull request #320390 from r-ryantm/auto-update/ols 2024-06-17 16:33:23 -04:00
om omnictl: 0.37.0 -> 0.37.5 2024-06-14 11:02:19 +00:00
on
oo/oo7
op python3Packages.open-webui: add rapidocr-onnxruntime deps 2024-06-17 21:08:41 +02:00
or orbiton: migrate to by-name 2024-06-17 18:00:30 +04:00
os
ot oterm: 0.2.8 -> 0.2.9 2024-06-16 09:41:07 +02:00
ou
ov
ow
pa
pc/pcsx2
pd pdpmake: 1.4.2 -> 1.4.3 2024-06-13 04:44:48 +00:00
pe
pf/pfft
pg Merge pull request #269460 from tie/pghero 2024-06-11 01:00:56 +02:00
ph Merge pull request #315183 from jopejoe1/fix-pname 2024-06-16 12:34:01 +00:00
pi Merge pull request #315183 from jopejoe1/fix-pname 2024-06-16 12:34:01 +00:00
pk
pl Merge pull request #319694 from r-ryantm/auto-update/plumber 2024-06-18 01:10:41 +08:00
pm pmtiles: 1.19.2 -> 1.20.0 2024-06-11 15:00:56 +00:00
pn
po Merge pull request #320365 from fabaff/poutine 2024-06-17 11:01:30 +02:00
pp/ppsspp
pq
pr Merge pull request #311908 from srhb/prometheus-jmx-javaagent 2024-06-17 08:46:00 +02:00
ps/ps_mem
pt
pu Merge pull request #315679 from pyrox0/purescm-src-fix 2024-06-15 02:15:25 +08:00
pv/pvsneslib
pw pwalarmctl: init at 0.1.0 2024-06-12 10:44:12 +02:00
px/pxder
py pyprland: 2.3.7 -> 2.3.8 2024-06-17 00:23:27 +00:00
pz/pzip
qa/qadwaitadecorations
qc/qcm
qd/qdirstat
qg/qgrep
qp/qpoases
qr
qs
qt/qtractor
qu Merge pull request #316758 from eclairevoyant/quickemu 2024-06-13 20:35:08 +02:00
r0/r0vm r0vm: 0.21.0 -> 1.0.1 2024-06-14 15:05:57 +02:00
r1/r10k
ra Merge pull request #319898 from Cryolitia/rpi 2024-06-15 10:19:27 -03:00
rc Merge pull request #319666 from OPNA2608/update/rcu 2024-06-16 22:08:17 +02:00
rd/rdwatool
re Merge pull request #304735 from DanNixon/release-plz 2024-06-18 01:28:15 +02:00
rh/rHttp
ri river: 0.3.2 -> 0.3.3 2024-06-16 14:14:05 +05:30
rk
rl/rl_json
rm
rn/rnd-name
ro roddhjav-apparmor-rules: 0-unstable-2024-06-11 -> 0-unstable-2024-06-12 2024-06-13 00:23:28 +00:00
rp/rpcs3
rq
rs
rt
ru
rw/rwpspread maintainers: rename nu-nu-ko to fsnkty 2024-06-15 14:21:38 +12:00
ry
s0/s0ix-selftest-tool
s3
sa sarasa-gothic: 1.0.13 -> 1.0.14 2024-06-16 02:46:07 +00:00
sb/sbom-utility
sc Merge pull request #312366 from r-ryantm/auto-update/scc 2024-06-12 21:48:35 +02:00
sd
se searxng: fix answerers 2024-06-11 15:13:58 +02:00
sg/sgfutils
sh show-midi: add desktop item 2024-06-12 23:12:37 +02:00
si
sk Merge pull request #317258 from vigress8/upd-aseprite 2024-06-17 12:21:32 -03:00
sl slumber: 1.3.2 -> 1.4.0 2024-06-12 07:41:28 +00:00
sm
sn snx-rs: 2.2.0 -> 2.2.3 2024-06-17 09:30:48 +02:00
so Merge pull request #318527 from TomaSajt/sourcery 2024-06-16 14:10:28 -03:00
sp SPAdes: refactor 2024-06-16 20:18:13 -03:00
sq sqlite-vss: remove elohmeier as maintainer 2024-06-14 09:18:15 +02:00
sr Merge pull request #308346 from thecaralice/srgn 2024-06-12 00:30:46 +02:00
ss
st Merge pull request #320491 from aaronjheng/starlark 2024-06-17 20:43:58 +00:00
su Merge pull request #319297 from onny/sublime-music2 2024-06-15 16:53:51 +02:00
sv Merge pull request #317550 from r-ryantm/auto-update/svelte-language-server 2024-06-12 00:40:18 +02:00
sw Merge pull request #318906 from matteo-pacini/swiftlint 2024-06-16 19:28:47 +02:00
sx
sy Sylk: rename to sylk (#320306) 2024-06-16 22:09:50 -03:00
t-/t-rex
ta Merge pull request #319457 from r-ryantm/auto-update/tailscale-nginx-auth 2024-06-16 22:45:42 +02:00
tb/tbump tbump: init at 6.11.0 2024-06-12 21:43:07 +02:00
tc/tcsh tcsh: 6.24.12 -> 6.24.13 2024-06-13 13:41:09 +03:00
td
te tenv: 2.0.3 -> 2.0.7 2024-06-16 17:04:38 +00:00
tg/tgpt
th
ti tinymist: 0.11.10 -> 0.11.11 2024-06-17 08:25:20 +02:00
tk
tl
tm tmsu: migrate to buildGoModule 2024-06-11 09:44:52 +02:00
to
tp
tr treefmt2: 2.0.0-rc4 -> 2.0.0-rc5 (#320482) 2024-06-17 17:13:15 +02:00
tt
tu
tw
tx/txr
ty typos-lsp: 0.1.18 -> 0.1.19 2024-06-16 16:39:57 +00:00
uc
ud
ue
ug
uh/uhttpmock_1_0
ui
um/umpire
un unciv: install icon for desktop item 2024-06-12 23:32:04 +02:00
up Merge pull request #318165 from r-ryantm/auto-update/upbound 2024-06-14 23:48:13 +02:00
us usql: 0.19.2 -> 0.19.3 2024-06-14 13:51:17 +00:00
ut
uu/uuu
uv/uv python311Packages.uv: 0.2.10 -> 0.2.11 2024-06-14 16:39:10 +00:00
uw/uwhoisd
ux uxn: 1.0-unstable-2024-06-05 -> 1.0-unstable-2024-06-14 2024-06-15 17:36:53 +00:00
va
vc vcpkg-tool: 2024-04-23 -> 2024-06-10 2024-06-13 03:02:28 +00:00
vd/vdhcoapp
ve vesktop: fix icon file locations 2024-06-16 14:29:56 -07:00
vg/vgm2x
vi
vk/vkd3d vkd3d: 1.11 -> 1.12 2024-06-14 15:39:10 -03:00
vl vlc: add update script 2024-06-16 10:59:08 +02:00
vm/vms-empire
vo/voidmap
vp Merge pull request #319473 from r-ryantm/auto-update/vpl-gpu-rt 2024-06-14 12:10:47 +00:00
vs/vscode-js-debug vscode-js-debug: init at 1.90.0 2024-06-12 11:56:58 +02:00
vu
vv/vvvvvv
vz/vzic
wa warp-terminal: 0.2024.06.04.08.02.stable_02 -> 0.2024.06.11.08.02.stable_01 2024-06-14 07:28:09 +00:00
wb
we
wh whistle: 2.9.71 -> 2.9.73 2024-06-15 09:09:57 +00:00
wi Merge pull request #308949 from amarshall/librusty_v8-source-provenance 2024-06-12 12:46:47 +02:00
wl Merge pull request #318200 from Scrumplex/pkgs/wlx-overlay-s/0.4.0 2024-06-10 22:34:37 +00:00
wo workout-tracker: 0.15.0 -> 1.15.2 2024-06-14 15:25:59 +00:00
wp maintainers: rename nu-nu-ko to fsnkty 2024-06-15 14:21:38 +12:00
ws Merge pull request #317840 from NeverBehave/pkg-ws-tunnel-rust 2024-06-13 13:31:08 -04:00
wt
wx/wxc wxc: init at 1.0.0.2 2024-06-16 08:42:49 +00:00
wy/wyoming-satellite
x1/x16
x5/x509-limbo
xa/xarcan
xc
xd xdg-terminal-exec: 0.9.3 -> 0.10.0 2024-06-13 04:12:15 +00:00
xe xemu: 0.7.122 -> 0.7.123 2024-06-13 03:18:39 +00:00
xf/xfs-undelete
xh/xhosts
xi
xl/xlights
xm
xn/xnlinkfinder
xo
xp xplr: 0.21.8 -> 0.21.9 2024-06-16 16:45:33 +00:00
xr/xr-hardware
xs xscreensaver: 6.08 -> 6.09 2024-06-11 02:57:19 +00:00
xu/xunit-viewer xunit-viewer: Add basic tests 2024-06-16 14:30:49 +02:00
xw/xwayland-run
ya yamlscript: 0.1.59 -> 0.1.61 2024-06-13 22:18:35 +00:00
yc/ycmd
yd/ydotool
ye
yg/yggdrasil
yj/yj
yo youtrack: use jdk21 2024-06-15 10:11:19 +02:00
ys/ysfx
yt yt-dlg: install desktop item 2024-06-12 23:22:04 +02:00
yu
za zabbix-agent2-plugin-postgresql: 6.4.14 -> 6.4.15 2024-06-11 09:19:45 +00:00
zb/zbus-xmlgen
zc/zcfan
ze
zf/zfind zfind: 0.4.0 -> 0.4.3 2024-06-14 19:11:20 +02:00
zi
zl/zluda
zm/zmkBATx
zo
zp
zs zsh-wd: 0.7.0 -> 0.7.1 2024-06-13 15:53:43 +00:00
zu/zug
zw/zwave-js-server
zx zxtune: add desktop item 2024-06-12 23:12:49 +02:00
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 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.

You can locally emulate the CI check using

$ ./maintainers/scripts/check-by-name.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;
}