nixpkgs/pkgs/top-level/release-small.nix
Emily 8725e466ef release: forbid use of lib.fileset in Nixpkgs
Due to Nix bug <https://github.com/NixOS/nix/issues/11503>,
`builtins.filterSource` and chroot stores interact in a confusing
and broken way that breaks `lib.fileset`. This means that uses of
the API inside Nixpkgs keep breaking the NixOS installer, blocking
the channel. The resulting error messages are inscrutable (they look
like “the installer test is trying to download `curl`…?” and
eventually bottom out in a derivation that has the wrong `outPath`
because of the chroot store causing an incorrect `lib.fileset` result).

Whenever this happens, someone (well, in practice K900 or I)
has to bisect the change that introduced it and remove the use of
`lib.fileset`. This has happened at least three times in the past
four months (I believe I might actually be missing one here, but
these are the ones I remember and could easily dig up):

* <https://github.com/NixOS/nixpkgs/pull/340046>
* <https://github.com/NixOS/nixpkgs/pull/352491>
* <https://github.com/NixOS/nixpkgs/pull/369459>

The options I see here are:

1. Forbid use of `lib.fileset` within Nixpkgs until the Nix bug is
   fixed. This is the approach taken here. External users of Nixpkgs
   can continue to use the API as normal, but using it from within
   something that affects any release jobset `outPath`s will cause an
   evaluation failure with a hopefully‐helpful error message.

2. Forbid `lib.fileset` and also all of the other library APIs that use
   `builtins.filterSource`. I’m happy to do this, but so far none of
   those have broken the installer, so I decided to start small and
   worry about the others if they end up causing a problem in practice.

3. Forbid `builtins.filterSource` directly. This is hard and would
   require more invasive `builtins.scopedImport` crimes to do at
   evaluation time. I think this would realistically have to be done in
   something like nixpkgs-vet instead and I didn’t have much luck
   shoehorning a check like this into that codebase when I tried.

4. Fix the Nix bug. This would be great! But also it doesn’t seem to be
   happening any time soon, it seems difficult to fix in a way that
   doesn’t subtly break compatibility with the previous semantics, and
   arguably the fix would need backporting all the way back to 2.3
   given our minimum version policy.

5. Do nothing; have people continue to innocuously use `lib.fileset`
   throughout Nixpkgs, breaking the installer whenever one of them
   sneaks in to that closure, causing the channel to be blocked and
   requiring expensive bisections to narrow down the inscrutable test
   failure to the package using `lib.fileset`, which then needs moving
   back off it. This sucks for the people who keep having to track it
   down, holds back important channel bumps, and the criteria for when
   it’s okay to use `lib.fileset` are not realistically possible to
   teach to all contributors.

I'd be happy to work on (2) as an alternative; (3) would be difficult
and seems like overkill, (4) is not really something I trust myself
to do and wouldn’t address the immediate problem, and (5) isn’t
sustainable. I think that the current approach here is the best
trade‐off for now, as `lib.fileset` seems to be the only prominent
user of the `builtins.filterSource` API that works with full store
paths, exposing it to the Nix bug. It’s unfortunate to lose the
nice API, but since we can’t rely on it to produce correct results
and the channels keep getting blocked as a result, I don’t think
we really have an alternative right now.
2024-12-31 15:01:04 +00:00

179 lines
3.2 KiB
Nix

/*
A small release file, with few packages to be built. The aim is to reduce
the load on Hydra when testing the `stdenv-updates' branch.
*/
{
nixpkgs ? {
outPath = (import ../../lib).cleanSource ../..;
revCount = 1234;
shortRev = "abcdef";
},
supportedSystems ? [
"x86_64-linux"
"x86_64-darwin"
],
# Attributes passed to nixpkgs. Don't build packages marked as unfree.
nixpkgsArgs ? {
config = {
allowUnfree = false;
inHydra = true;
};
__allowFileset = false;
},
}:
let
release-lib = import ./release-lib.nix {
inherit supportedSystems nixpkgsArgs;
};
inherit (release-lib)
all
linux
darwin
mapTestOn
unix
;
in
{
tarball = import ./make-tarball.nix {
inherit nixpkgs;
officialRelease = false;
};
}
// (mapTestOn ({
aspell = all;
at = linux;
autoconf = all;
automake = all;
avahi = unix; # Cygwin builds fail
bash = all;
bashInteractive = all;
bc = all;
binutils = linux;
bind = linux;
bsdiff = all;
bzip2 = all;
cmake = all;
coreutils = all;
cpio = all;
cron = linux;
cups = linux;
dbus = linux;
diffutils = all;
e2fsprogs = linux;
emacs = linux;
file = all;
findutils = all;
flex = all;
gcc = all;
glibc = linux;
glibcLocales = linux;
gnugrep = all;
gnum4 = all;
gnumake = all;
gnupatch = all;
gnupg = linux;
gnuplot = unix; # Cygwin builds fail
gnused = all;
gnutar = all;
gnutls = linux;
grub2 = linux;
guile = linux; # tests fail on Cygwin
gzip = all;
hddtemp = linux;
hdparm = linux;
hello = all;
host = linux;
iana-etc = linux;
icewm = linux;
idutils = all;
inetutils = linux;
iputils = linux;
qemu = linux;
qemu_kvm = linux;
lapack-reference = linux;
less = all;
lftp = all;
libtool = all;
libtool_2 = all;
libxml2 = all;
libxslt = all;
lout = linux;
lsof = linux;
ltrace = linux;
lvm2 = linux;
lynx = linux;
xz = linux;
man = linux;
man-pages = linux;
mc = all;
mdadm = linux;
mesa = linux;
mingetty = linux;
mktemp = all;
monotone = linux;
mutt = linux;
mysql = linux;
# netcat broken on darwin
netcat = linux;
nfs-utils = linux;
nix = all;
nixUnstable = all;
nss_ldap = linux;
nssmdns = linux;
ntfs3g = linux;
ntp = linux;
openssh = linux;
openssl = all;
pan = linux;
pciutils = linux;
perl = all;
pkg-config = all;
pmccabe = linux;
procps = linux;
python3 = unix; # Cygwin builds fail
readline = all;
rlwrap = all;
rpcbind = linux;
rsync = linux;
screen = linux ++ darwin;
scrot = linux;
sdparm = linux;
smartmontools = all;
sqlite = unix; # Cygwin builds fail
squid = linux;
msmtp = linux;
stdenv = all;
strace = linux;
su = linux;
sudo = linux;
sysklogd = linux;
syslinux = [ "i686-linux" ];
tcl = linux;
tcpdump = linux;
texinfo = all;
time = linux;
tinycc = linux;
udev = linux;
unzip = all;
usbutils = linux;
util-linux = linux;
util-linuxMinimal = linux;
w3m = all;
webkitgtk_4_0 = linux;
wget = all;
which = all;
wirelesstools = linux;
wpa_supplicant = linux;
xfsprogs = linux;
xkeyboard_config = linux;
zip = all;
tests-stdenv-gcc-stageCompare = all;
}))