NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.02k stars 14.03k forks source link

[RFC] Replace `assert` with `meta.broken` #36229

Closed 7c6f434c closed 2 years ago

7c6f434c commented 6 years ago

Issue description

A lot of Nixpkgs packages currently use assert. Most of the uses of assert had been introduced before meta.broken has been implemented. Using meta.broken with an expression condition has benefits, for example, it can be queried via meta.available and catching assertions requires builtins.tryEval, and it is always better not to add more uses of tryEval. See also #36226. Apparently enthusiastically supported by @Ericson2314

Tracking

My model of assertions: an assertion happens in a .nix file inside pkgs/ in a line not starting with a # in the beginning of the line or after one of (){}, before end of line (with condition on the next line) or one of (){}.

Sanity check:

find -name '*.nix' |
  xargs grep -E '^(|[ (){}]|[^#].*[ ()])assert(|[() {}].*)$' -L   |
  xargs grep '\<assert\>' |
  grep -v '"assert' | grep -v '-assert' | grep -v 'assert-'

(files without assertions as defined above that still have assert as a alphanumeric string as a grep word have assert either as a part of a dash-separated name, or inside quotes)

stdenv is a separate thing, the uses of assert — like in lib, which is outside pkgs — do not have a convenient meta.broken around.

Re: asserts for licenses: should there be lib.licenses.unsatisfied, like unfree but without a permanent override available (I guess $NIXPKGS_ALLOW_UNSATISFIED_LICENSEis enough for all debugging purposes)? The motivation is the same as with things that go tometa.broken: inspection ofname/meta`.

Progress countdown:

find -name '*.nix' |
   xargs grep -E '^(|[ (){}]|[^#].*[ ()])assert(|[() {}].*)$' -l |
   grep -v '^[.]/stdenv/' | wc -l

→ 528

List of files:

./misc/drivers/hplip/default.nix
./misc/drivers/hplip/3.16.11.nix
./misc/drivers/gutenprint/bin.nix
./misc/ghostscript/default.nix
./misc/vscode-extensions/vscode-utils.nix
./misc/vscode-extensions/python/default.nix
./misc/vscode-extensions/cpptools/default.nix
./misc/gnash/default.nix
./misc/vim-plugins/vim-utils.nix
./misc/emulators/dolphin-emu/master.nix
./misc/emulators/pcsx2/default.nix
./misc/emulators/retroarch/kodi-advanced-launchers.nix
./misc/emulators/wine/staging.nix
./misc/emulators/wine/base.nix
./misc/emulators/ppsspp/default.nix
./misc/foldingathome/default.nix
./tools/typesetting/htmldoc/default.nix
./tools/typesetting/asciidoc/default.nix
./tools/typesetting/tex/nix/default.nix
./tools/typesetting/tex/dblatex/default.nix
./tools/networking/i2pd/default.nix
./tools/networking/miniupnpd/default.nix
./tools/networking/libreswan/default.nix
./tools/networking/haproxy/default.nix
./tools/networking/curl/default.nix
./tools/networking/openssh/default.nix
./tools/networking/p2p/amule/default.nix
./tools/networking/filegive/default.nix
./tools/networking/mtr/default.nix
./tools/networking/logmein-hamachi/default.nix
./tools/networking/ssmtp/default.nix
./tools/networking/openvpn/default.nix
./tools/networking/openconnect/default.nix
./tools/networking/chrony/default.nix
./tools/networking/ntp/default.nix
./tools/networking/netrw/default.nix
./tools/archivers/zip/default.nix
./tools/misc/trash-cli/default.nix
./tools/misc/hdf5/default.nix
./tools/misc/hdf5/1_8.nix
./tools/misc/remind/default.nix
./tools/misc/grub/2.0x.nix
./tools/misc/pk2cmd/default.nix
./tools/misc/megacli/default.nix
./tools/misc/coreutils/default.nix
./tools/misc/brltty/default.nix
./tools/filesystems/yandex-disk/default.nix
./tools/filesystems/squashfs/default.nix
./tools/filesystems/nixpart/0.4/cryptsetup.nix
./tools/filesystems/nixpart/0.4/blivet.nix
./tools/filesystems/ceph/generic.nix
./tools/backup/bareos/default.nix
./tools/backup/bup/default.nix
./tools/video/rtmpdump/default.nix
./tools/audio/beets/default.nix
./tools/audio/aucdtect/default.nix
./tools/inputmethods/ibus/default.nix
./tools/inputmethods/uim/default.nix
./tools/security/pass/default.nix
./tools/security/nmap/default.nix
./tools/security/enpass/default.nix
./tools/security/gnupg/20.nix
./tools/security/gnupg/22.nix
./tools/package-management/disnix/dysnomia/default.nix
./tools/package-management/checkinstall/default.nix
./tools/X11/xdg-utils/default.nix
./tools/X11/setroot/default.nix
./tools/graphics/gnuplot/default.nix
./tools/graphics/graphviz/base.nix
./tools/text/gawk/default.nix
./tools/text/xml/xpf/default.nix
./tools/compression/xdelta/default.nix
./tools/compression/xdelta/unstable.nix
./tools/system/storebrowse/default.nix
./shells/bash/4.4.nix
./data/fonts/iosevka/default.nix
./build-support/vm/default.nix
./build-support/trivial-builders.nix
./build-support/fetchipfs/default.nix
./build-support/replace-dependency.nix
./build-support/bintools-wrapper/default.nix
./build-support/fetchmavenartifact/default.nix
./build-support/fetchgit/default.nix
./build-support/closure-info.nix
./build-support/dotnetenv/build-solution.nix
./build-support/gcc-wrapper-old/default.nix
./build-support/fetchurl/default.nix
./build-support/fetchrepoproject/default.nix
./build-support/fetchdocker/generic-fetcher.nix
./build-support/fetchdocker/default.nix
./build-support/rust/default.nix
./build-support/ocaml/default.nix
./build-support/cc-wrapper/default.nix
./servers/apcupsd/default.nix
./servers/samba/3.x.nix
./servers/mpd/default.nix
./servers/dns/pdns-recursor/default.nix
./servers/dns/bind/default.nix
./servers/uhub/default.nix
./servers/sql/oracle-xe/default.nix
./servers/freeradius/default.nix
./servers/xmpp/prosody/default.nix
./servers/http/hiawatha/default.nix
./servers/http/apache-httpd/2.4.nix
./servers/http/lighttpd/default.nix
./servers/home-assistant/default.nix
./servers/varnish/modules.nix
./servers/x11/xorg/overrides.nix
./servers/mail/nullmailer/default.nix
./servers/monitoring/zabbix/2.0.nix
./servers/monitoring/zabbix/2.2.nix
./development/guile-modules/guile-lib/default.nix
./development/mobile/xcodeenv/build-app.nix
./development/mobile/androidenv/androidndk_r8e.nix
./development/mobile/androidenv/androidndk.nix
./development/mobile/androidenv/build-app.nix
./development/mobile/titaniumenv/examples/kitchensink/default.nix
./development/mobile/titaniumenv/build-app.nix
./development/mobile/flashtool/default.nix
./development/tools/database/liquibase/default.nix
./development/tools/build-managers/apache-maven/default.nix
./development/tools/build-managers/cmake/default.nix
./development/tools/build-managers/cmake/2.8.nix
./development/tools/build-managers/gnumake/4.2/default.nix
./development/tools/build-managers/gnumake/4.2/head.nix
./development/tools/github/github-release/default.nix
./development/tools/phantomjs/default.nix
./development/tools/misc/dialog/default.nix
./development/tools/misc/avrdude/default.nix
./development/tools/misc/trv/default.nix
./development/tools/misc/gdb/default.nix
./development/tools/misc/creduce/default.nix
./development/tools/misc/saleae-logic/default.nix
./development/tools/misc/ninka/default.nix
./development/tools/profiling/oprofile/default.nix
./development/tools/analysis/radare/default.nix
./development/tools/analysis/smatch/default.nix
./development/tools/analysis/radare2/default.nix
./development/tools/analysis/verasco/default.nix
./development/tools/neoload/default.nix
./development/tools/ocaml/ocp-indent/1.5.2.nix
./development/tools/ocaml/ocp-indent/default.nix
./development/tools/ocaml/cppo/default.nix
./development/tools/ocaml/merlin/default.nix
./development/tools/ocaml/ocp-index/default.nix
./development/tools/ocaml/opam/default.nix
./development/tools/ocaml/camlp5/5.15.nix
./development/ocaml-modules/ocamlnat/default.nix
./development/ocaml-modules/reactivedata/default.nix
./development/ocaml-modules/vg/default.nix
./development/ocaml-modules/eliom/default.nix
./development/ocaml-modules/lablgtk-extras/default.nix
./development/ocaml-modules/qcheck/default.nix
./development/ocaml-modules/sqlite3EZ/default.nix
./development/ocaml-modules/camlimages/4.1.nix
./development/ocaml-modules/sawja/default.nix
./development/ocaml-modules/otfm/default.nix
./development/ocaml-modules/uucp/default.nix
./development/ocaml-modules/cstruct/ppx.nix
./development/ocaml-modules/cstruct/lwt.nix
./development/ocaml-modules/cstruct/unix.nix
./development/ocaml-modules/cstruct/1.9.0.nix
./development/ocaml-modules/zarith/default.nix
./development/ocaml-modules/gg/default.nix
./development/ocaml-modules/wtf8/default.nix
./development/ocaml-modules/uunf/default.nix
./development/ocaml-modules/cryptokit/default.nix
./development/ocaml-modules/fix/default.nix
./development/ocaml-modules/extlib/default.nix
./development/ocaml-modules/logs/default.nix
./development/ocaml-modules/tuntap/default.nix
./development/ocaml-modules/bolt/default.nix
./development/ocaml-modules/tyxml/default.nix
./development/ocaml-modules/lambda-term/default.nix
./development/ocaml-modules/dtoa/default.nix
./development/ocaml-modules/pprint/default.nix
./development/ocaml-modules/biniou/1.0.nix
./development/ocaml-modules/fieldslib/default.nix
./development/ocaml-modules/cmdliner/default.nix
./development/ocaml-modules/cmdliner/0.9.nix
./development/ocaml-modules/xmlm/default.nix
./development/ocaml-modules/functory/default.nix
./development/ocaml-modules/enumerate/default.nix
./development/compilers/gcc/5/default.nix
./development/compilers/gcc/7/default.nix
./development/compilers/gcc/4.5/default.nix
./development/compilers/gcc/4.5/sources.nix
./development/compilers/gcc/4.8/default.nix
./development/compilers/gcc/4.9/default.nix
./development/compilers/gcc/snapshot/default.nix
./development/compilers/gcc/6/default.nix
./development/compilers/ghc/7.8.4.nix
./development/compilers/ghc/7.8.4-binary.nix
./development/compilers/ghc/8.2.1-binary.nix
./development/compilers/ghc/7.0.4-binary.nix
./development/compilers/ghc/head.nix
./development/compilers/ghc/8.2.2.nix
./development/compilers/ghc/8.0.2.nix
./development/compilers/ghc/8.4.1.nix
./development/compilers/ghc/7.10.3-binary.nix
./development/compilers/ghc/7.4.2.nix
./development/compilers/ghc/7.6.3.nix
./development/compilers/ghc/7.4.2-binary.nix
./development/compilers/ghc/7.10.3.nix
./development/compilers/ghc/7.0.4.nix
./development/compilers/gcl/default.nix
./development/compilers/gcl/2.6.13-pre.nix
./development/compilers/compcert/default.nix
./development/compilers/sbcl/bootstrap.nix
./development/compilers/oraclejdk/jdk-linux-base.nix
./development/compilers/oraclejdk/jdk9-linux.nix
./development/compilers/gnu-smalltalk/default.nix
./development/compilers/nvidia-cg-toolkit/default.nix
./development/compilers/llvm/3.9/llvm.nix
./development/compilers/ccl/default.nix
./development/compilers/ghdl/default.nix
./development/compilers/ocaml/generic.nix
./development/compilers/mezzo/default.nix
./development/ruby-modules/bundled-common/functions.nix
./development/ruby-modules/bundled-common/default.nix
./development/python-modules/gurobipy/darwin.nix
./development/python-modules/gurobipy/linux.nix
./development/python-modules/tensorflow/default.nix
./development/python-modules/matplotlib/default.nix
./development/python-modules/libvirt/default.nix
./development/python-modules/nipype/default.nix
./development/python-modules/cryptography/default.nix
./development/python-modules/pythonix/default.nix
./development/python-modules/rarfile/default.nix
./development/python-modules/wxPython/3.0.nix
./development/python-modules/faker/default.nix
./development/python-modules/h5py/default.nix
./development/python-modules/Theano/default.nix
./development/interpreters/elixir/generic-builder.nix
./development/interpreters/perl/default.nix
./development/interpreters/python/cpython/2.7/default.nix
./development/interpreters/python/cpython/3.6/default.nix
./development/interpreters/python/cpython/3.5/default.nix
./development/interpreters/python/cpython/3.4/default.nix
./development/interpreters/python/pypy/2.7/default.nix
./development/interpreters/lfe/generic-builder.nix
./development/interpreters/eff/default.nix
./development/interpreters/erlang/generic-builder.nix
./development/interpreters/clisp/default.nix
./development/interpreters/clisp/hg.nix
./development/haskell-modules/generic-builder.nix
./development/haskell-modules/lib.nix
./development/haskell-modules/with-packages-wrapper.nix
./development/libraries/glib/default.nix
./development/libraries/libinput/default.nix
./development/libraries/xgboost/default.nix
./development/libraries/qt-3/default.nix
./development/libraries/libxslt/default.nix
./development/libraries/openjpeg/generic.nix
./development/libraries/gloox/default.nix
./development/libraries/libevent/default.nix
./development/libraries/faac/default.nix
./development/libraries/libinfinity/default.nix
./development/libraries/ucommon/default.nix
./development/libraries/qt-5/modules/qtbase.nix
./development/libraries/SDL/default.nix
./development/libraries/openal-soft/default.nix
./development/libraries/gnutls/generic.nix
./development/libraries/oracle-instantclient/default.nix
./development/libraries/vapoursynth/default.nix
./development/libraries/neon/default.nix
./development/libraries/neon/0.29.nix
./development/libraries/libguestfs/default.nix
./development/libraries/libav/default.nix
./development/libraries/gstreamer/libav/default.nix
./development/libraries/gstreamer/bad/default.nix
./development/libraries/sqlcipher/default.nix
./development/libraries/qtkeychain/default.nix
./development/libraries/hwloc/default.nix
./development/libraries/libsidplayfp/default.nix
./development/libraries/webkitgtk/2.18.nix
./development/libraries/webkitgtk/2.4.nix
./development/libraries/v8/3.14.nix
./development/libraries/v8/default.nix
./development/libraries/v8/3.16.14.nix
./development/libraries/libass/default.nix
./development/libraries/science/math/fenics/default.nix
./development/libraries/science/math/caffe2/default.nix
./development/libraries/cairo/default.nix
./development/libraries/freetds/default.nix
./development/libraries/audio/suil/default.nix
./development/libraries/libwebp/default.nix
./development/libraries/libextractor/default.nix
./development/libraries/blitz/default.nix
./development/libraries/wayland/default.nix
./development/libraries/wayland/1.9.nix
./development/libraries/dbus/default.nix
./development/libraries/libpng/default.nix
./development/libraries/libpng/12.nix
./development/libraries/gss/default.nix
./development/libraries/libvpx/default.nix
./development/libraries/libvpx/git.nix
./development/libraries/libarchive/default.nix
./development/libraries/wtk/default.nix
./development/libraries/libbluray/default.nix
./development/libraries/libgcrypt/default.nix
./development/libraries/libgcrypt/1.5.nix
./development/libraries/gnutls-kdh/generic.nix
./development/libraries/physics/geant4/default.nix
./development/libraries/gtk+/3.x.nix
./development/libraries/gtk+/2.x.nix
./development/libraries/java/swt/default.nix
./development/libraries/lame/default.nix
./development/libraries/pcre/default.nix
./development/libraries/wxwidgets/2.8/default.nix
./development/libraries/wxwidgets/3.0/default.nix
./development/libraries/wxwidgets/2.9/default.nix
./development/libraries/fftw/default.nix
./development/libraries/ceres-solver/default.nix
./development/libraries/SDL2/default.nix
./development/libraries/avahi/default.nix
./development/libraries/nghttp2/default.nix
./development/libraries/png++/default.nix
./development/libraries/ffmpeg/generic.nix
./development/libraries/phonon/default.nix
./development/libraries/phonon/backends/vlc.nix
./development/libraries/phonon/backends/gstreamer.nix
./development/libraries/ffmpeg-full/default.nix
./development/libraries/apr-util/default.nix
./development/libraries/glibc/common-2.27.nix
./development/libraries/glibc/default.nix
./development/libraries/glibc/common.nix
./development/libraries/glibc/2.27.nix
./development/libraries/libftdi/1.x.nix
./development/libraries/boost/generic.nix
./development/libraries/sqlite/default.nix
./development/libraries/scmccid/default.nix
./development/arduino/arduino-core/default.nix
./top-level/all-packages.nix
./top-level/python-packages.nix
./top-level/splice.nix
./top-level/impure.nix
./top-level/release-cross.nix
./top-level/php-packages.nix
./games/factorio/default.nix
./games/minecraft/default.nix
./games/tinyfugue/default.nix
./games/dwarf-fortress/wrapper/default.nix
./games/dwarf-fortress/game.nix
./games/ue4demos/default.nix
./games/sdlmame/default.nix
./games/terraria-server/default.nix
./games/steam/runtime-wrapped.nix
./games/zandronum/fmod.nix
./games/oilrush/default.nix
./games/0ad/game.nix
./games/0ad/wrapper.nix
./games/residualvm/default.nix
./games/planetaryannihilation/default.nix
./games/tibia/default.nix
./games/uqm/default.nix
./games/adom/default.nix
./desktops/gnome-3/misc/libgda/default.nix
./desktops/gnome-3/core/gconf/default.nix
./desktops/gnome-2/platform/GConf/default.nix
./desktops/gnome-2/desktop/libgweather/default.nix
./desktops/xfce/panel-plugins/xfce4-pulseaudio-plugin.nix
./os-specific/gnu/hurd/default.nix
./os-specific/gnu/default.nix
./os-specific/gnu/mach/default.nix
./os-specific/gnu/libpthread/default.nix
./os-specific/windows/pthread-w32/default.nix
./os-specific/windows/wxMSW-2.8/default.nix
./os-specific/darwin/native-x11-and-opengl/default.nix
./os-specific/darwin/apple-source-releases/CF/default.nix
./os-specific/darwin/binutils/default.nix
./os-specific/darwin/cctools/port.nix
./os-specific/darwin/ios-cross/default.nix
./os-specific/linux/prl-tools/default.nix
./os-specific/linux/kernel-headers/default.nix
./os-specific/linux/ply/default.nix
./os-specific/linux/amdgpu-pro/default.nix
./os-specific/linux/psmisc/default.nix
./os-specific/linux/libcap/default.nix
./os-specific/linux/ati-drivers/default.nix
./os-specific/linux/busybox/default.nix
./os-specific/linux/drbd/default.nix
./os-specific/linux/usbguard/default.nix
./os-specific/linux/phc-intel/default.nix
./os-specific/linux/lm-sensors/default.nix
./os-specific/linux/libselinux/default.nix
./os-specific/linux/guvcview/default.nix
./os-specific/linux/shadow/default.nix
./os-specific/linux/sch_cake/default.nix
./os-specific/linux/audit/default.nix
./os-specific/linux/exfat/default.nix
./os-specific/linux/bluez/bluez5_28.nix
./os-specific/linux/bluez/default.nix
./os-specific/linux/e1000e/default.nix
./os-specific/linux/lsscsi/default.nix
./os-specific/linux/mdadm/default.nix
./os-specific/linux/uclibc/default.nix
./os-specific/linux/nvidia-x11/generic.nix
./os-specific/linux/facetimehd/default.nix
./os-specific/linux/conky/default.nix
./os-specific/linux/kernel/hardened-config.nix
./os-specific/linux/kernel/manual-config.nix
./os-specific/linux/kernel/generic.nix
./os-specific/linux/kernel/perf.nix
./os-specific/linux/libcap-ng/default.nix
./os-specific/linux/ldm/default.nix
./os-specific/linux/blcr/default.nix
./os-specific/linux/upower/default.nix
./os-specific/linux/xf86-input-multitouch/default.nix
./os-specific/linux/cpufrequtils/default.nix
./os-specific/linux/mwprocapture/default.nix
./os-specific/linux/pmount/default.nix
./os-specific/linux/spl/default.nix
./os-specific/linux/pam_usb/default.nix
./os-specific/linux/dpdk/default.nix
./os-specific/linux/cryptsetup/default.nix
./os-specific/linux/jool/default.nix
./os-specific/linux/wireguard/default.nix
./os-specific/linux/systemd/default.nix
./os-specific/linux/systemd/cryptsetup-generator.nix
./applications/search/recoll/default.nix
./applications/virtualization/bochs/default.nix
./applications/virtualization/8086tiny/default.nix
./applications/virtualization/virt-viewer/default.nix
./applications/virtualization/xen/4.8.nix
./applications/virtualization/xen/4.5.nix
./applications/networking/dropbox/default.nix
./applications/networking/sync/rsync/default.nix
./applications/networking/p2p/qbittorrent/default.nix
./applications/networking/mumble/default.nix
./applications/networking/sniffers/wireshark/default.nix
./applications/networking/instant-messengers/rambox/fetchNodeModules.nix
./applications/networking/instant-messengers/viber/default.nix
./applications/networking/instant-messengers/gajim/default.nix
./applications/networking/instant-messengers/profanity/default.nix
./applications/networking/instant-messengers/jackline/default.nix
./applications/networking/instant-messengers/jitsi/default.nix
./applications/networking/newsreaders/pan/default.nix
./applications/networking/browsers/w3m/default.nix
./applications/networking/browsers/mozilla-plugins/trezor/default.nix
./applications/networking/browsers/qutebrowser/default.nix
./applications/networking/browsers/firefox/common.nix
./applications/networking/browsers/firefox/wrapper.nix
./applications/networking/browsers/midori/default.nix
./applications/networking/browsers/lynx/default.nix
./applications/networking/browsers/firefox-bin/default.nix
./applications/networking/browsers/elinks/default.nix
./applications/networking/ike/default.nix
./applications/networking/remote/freerdp/legacy.nix
./applications/networking/mailreaders/sylpheed/default.nix
./applications/networking/mailreaders/mutt/default.nix
./applications/networking/mailreaders/thunderbird-bin/default.nix
./applications/networking/irc/weechat/default.nix
./applications/networking/irc/quassel/default.nix
./applications/misc/girara/default.nix
./applications/misc/gnuradio-rds/default.nix
./applications/misc/polybar/default.nix
./applications/misc/ranger/default.nix
./applications/misc/kdbplus/default.nix
./applications/misc/playonlinux/default.nix
./applications/misc/ipmiview/default.nix
./applications/misc/xpdf/default.nix
./applications/misc/adobe-reader/default.nix
./applications/misc/llpp/default.nix
./applications/misc/gnuradio-osmosdr/default.nix
./applications/misc/gqrx/default.nix
./applications/misc/lilyterm/default.nix
./applications/misc/gnuradio-ais/default.nix
./applications/misc/gnuradio-gsm/default.nix
./applications/misc/xxkb/default.nix
./applications/misc/gnuradio-nacl/default.nix
./applications/misc/zathura/core/default.nix
./applications/misc/ikiwiki/default.nix
./applications/video/mpv/default.nix
./applications/video/avidemux/default.nix
./applications/video/kodi/default.nix
./applications/video/miro/default.nix
./applications/video/mkvtoolnix/default.nix
./applications/video/bomi/default.nix
./applications/video/mplayer/default.nix
./applications/video/vlc/default.nix
./applications/video/aegisub/default.nix
./applications/science/math/mxnet/default.nix
./applications/science/math/giac/default.nix
./applications/science/math/caffe/default.nix
./applications/science/math/cntk/default.nix
./applications/science/math/ripser/default.nix
./applications/science/logic/coq/8.3.nix
./applications/science/logic/acgtk/default.nix
./applications/science/logic/verifast/default.nix
./applications/science/molecular-dynamics/lammps/default.nix
./applications/science/machine-learning/sc2-headless/default.nix
./applications/science/machine-learning/shogun/default.nix
./applications/audio/yoshimi/default.nix
./applications/audio/fmit/default.nix
./applications/audio/deadbeef/default.nix
./applications/audio/google-musicmanager/default.nix
./applications/audio/pulseaudio-dlna/default.nix
./applications/audio/spotify/default.nix
./applications/audio/tomahawk/default.nix
./applications/audio/projectm/default.nix
./applications/audio/ncmpcpp/default.nix
./applications/audio/aumix/default.nix
./applications/audio/lash/default.nix
./applications/audio/cantata/default.nix
./applications/audio/cmus/default.nix
./applications/version-management/git-and-tools/git-recent/default.nix
./applications/version-management/subversion/default.nix
./applications/version-management/monotone/default.nix
./applications/version-management/monotone-viz/graphviz-2.0.nix
./applications/window-managers/notion/default.nix
./applications/window-managers/fvwm/default.nix
./applications/window-managers/xmonad-log-applet/default.nix
./applications/office/mendeley/default.nix
./applications/graphics/exrdisplay/default.nix
./applications/graphics/draftsight/default.nix
./applications/graphics/sane/xsane.nix
./applications/graphics/seg3d/default.nix
./applications/graphics/gqview/default.nix
./applications/editors/nano/default.nix
./applications/editors/eclipse/default.nix
./applications/editors/eclipse/plugins.nix
./applications/editors/sublime3/default.nix
./applications/editors/sublime/default.nix
./applications/editors/jetbrains/default.nix
./applications/editors/vim/qvim.nix
./applications/editors/music/tuxguitar/default.nix
./applications/editors/emacs/default.nix
shlevy commented 6 years ago

:+1: from me. I think some asserts are true sanity checks about argument compatibility, but the rest should switch to meta.

7c6f434c commented 6 years ago

Is there any reason not to move argument compatibility sanity checks to meta.broken, too? After all, a package with withGtk==true and gtk == null is for all practical purposes broken…

Ericson2314 commented 6 years ago

Additinally, with https://github.com/NixOS/nixpkgs/issues/36226 I don't think there is any more reason for somePkg ? null. I mean, it isn't like we're using packages in nixpkgs in a smaller package set, right?.

7c6f434c commented 6 years ago

Well, sometimes these have to be extracted from a nested package set (like pythonPackages)

Ericson2314 commented 6 years ago

I'd say, if the assert only results from user error, and not any arbitrary broken packages situation, then the assert is fine. For example:

{ withFoo ? foo.meta.available, foo }:

assert withFoo -> foo.meta.available;

The assertion respects the default, so it would only fail in the presence of user overrides. And users should in fact only do overrides to make things less enabled. If some optional feature is needed downstream, but it in that downstream package's meta.broken.

rnhmjoj commented 6 years ago

So, I want to make sure I understand correctly. For example is this ok?

{ x11Support ? stdenv.isLinux, mesa }:

assert x11Support -> libX11.meta.available && libXext.meta.available [...];

[...]
buildInputs = [...] ++ optionals x11Support [ libX11 libXext mesa libXxf86vm ];
7c6f434c commented 6 years ago

@Ericson2314 from time to time people use some kind of a deep override; it would be nice if a global deep override of libxcb to null worked in a comprehensible way.

What is the benefit of not putting this condition into meta.broken?

oxij commented 6 years ago

:+1: on the idea, as this is on SLNOS TODO list too.

SLNOS motivation: derivations should be lazy (#33057) as this gives a lot of nice bonuses.

But I also completely agree with

I think some asserts are true sanity checks about argument compatibility, but the rest should switch to meta.

My motivation: I want to fuzz package builds that depend on package options (use flags).

I want to check that all allowed combinations of flags actually build and (eventually) that all disallowed don't.

The latter would be implemented with tests for flags (or combinations of them). Possible tests include:

In general, most asserts are either of the two kinds:

I think the second kind should simply not exist (https://github.com/NixOS/nixpkgs/issues/35906#issuecomment-369465393). When all derivations are lazy you don't need to null them to hide the ones that won't work on a given system, after #33057 you can still access their attributes, hence you don't need to check they are not nulls anymore. nulls now just get in the way of debugging actual package dependencies.

Switching the first kind of asserts from assert to broken is fine for me, but I would prefer we switch to several tiers of those (names are subject to change):

I also would like those to be more verbose than just bools. Say, like asserts and warnings of NixOS.

Also note that all of this plays really well when you explicitly mark the use flags. Are you still sure you don't want them (#12877. Wink, wink!)?

7c6f434c commented 6 years ago

Of all things, running X during a build is trivial: https://github.com/7c6f434c/lang-os/blob/master/firefox-profile.nix

Whether we want it is another question.

USE flags, multiple kinds of brokenness etc. require maintenance effort to continue making sense, which makes achieving buy-in harder…

Ericson2314 commented 6 years ago

@oxij look up rust portability lint. Fuzzing would never exhaust space but we could with SAT solver.

@rmhnjoj. I don't think so, because a Linux host platform does not always ensure those packages are available. If it did however, that would be good.

7c6f434c commented 6 years ago

The problem is that we are talking about build failures, and that cannot be just fed to SAT solver. The only thing you can hope for is increasing the chance of a problem being found per minute of build.

oxij commented 6 years ago

I think you over-complicate the problem. Most of the time you can see if the buildInput list is correct by the configure output log. It's super-cheap. So you can reasonably exhaustively check use flags for most of the packages of nixpkgs.

For packages with massive amounts of use flags (like ffmpeg) fuzzing *Support flags one by one would already be uber-helpful and would find 99% of the errors in minutes.

I imagine that to work like this:

All of that would not work with overrides with nulls.

To answer https://github.com/NixOS/nixpkgs/issues/35906#issuecomment-370157300

null provides a way to quickly remove some dependencies without adding extra support into packages.

I agree. But I consider that to be a hack and I think it should be treated as a hack. Normally, things should be put under flags.

Also, note that the composition of use flags and fuzzing makes maintenance burden less, not more: you add a new use flag, then you add the corresponding buildInputs, ask the fuzzer to fuzz it, get to see whenever the build would be likely to succeed and do what you expect in seconds instead of hours.

7c6f434c commented 6 years ago

Also, note that the composition of use flags and fuzzing makes maintenance burden less, not more: you add a new use flag, then you add the corresponding buildInputs, ask the fuzzer to fuzz it, get to see whenever the build would be likely to succeed and do what you expect in seconds instead of hours.

I think we don't have enough acceptance for multiple versions to have people even look at the fuzzer.

oxij commented 6 years ago

(Posting this as a separate comment to refer back to specifically this. This seems like a good place as any to remind you that all of those ideas I constantly talk here combined produce some awesome benefits.)

Writing this despite the fact that, most likely, unless I frustrate myself to the point at which this thread will become a flamewar with many non-pretty words, this would just get ignored :(

Anyway.

Anybody skeptic of that not having nulls can be made short and beautiful is requested to proceed to read pkgs/applications/audio/cmus/default.nix on master (because it's an exemplary expression of AFAIK the best thing that can be done with master's infrastructure), and then proceed to imagine an expression that has no duplication of

{ stdenv,
...
, cddbSupport ? true, libcddb ? null
...
}:

let

  opts = [
    ...
    (mkFlag cddbSupport    "CONFIG_CDDB=y"    libcddb)
    ...
  ];

in

stdenv.mkDerivation {
  ...
  configureFlags = ... ++ concatMap (a: a.flags) opts);
  buildInputs = ... ++ concatMap (a: a.deps) opts;
};

kind, but instead does this

{ lib }: with lib; mkUFDerivation (attrs: with attrs; {
  required   = mkRequired [ "stdenv" "pkgconfig" ];

  # mkYNFlag : (defaultValue : Bool) -> (configureFlag : String) -> (buildInputs : [ String ]) -> mkUFDerivationMagic

  darwin     = mkYNFlag stdenv.isDarwin null         [ "CoreAudio" ];
  alsa       = mkYNFlag stdenv.isLinux  "ALSA"       [ "alsaLib" ];
  jack       = mkYNFlag false           "JACK"       [ "libjack" ];
  samplerate = mkYNFlag useFlags.jack   "SAMPLERATE" [ "libsamplerate" ];
  ...
  cddb       = mkYNFlag true            "CDDB"       [ "libcddb" ];
  ...
}) (attrs: with attrs; stdenv.mkDerivation {
  ...
  nativeBuildInputs = [ pkgconfig ];

  configureFlags = useFlags.configureFlags;

  buildInputs = useFlags.buildInputs;
  ...
})

Isn't that much better than what master has?

SLNOS says "Yes!". Hence let me introduce you into how the above works line by line.

Calling this, as you might have noticed, does require a slightly different kind of infrastructure behind callPackage.

Merging such expressions with changes to nixpkgs is paniful, so SLNOS doesn't use them much (yet).

However, in the light of that expression above I fail to see why nixpkgs goes out of the way to reject use flags (#12877). Like, seriously, just, WHY?!

Now, to completely blow your mind, look at the above expression and then remind yourself that many, if not most, packages in nixpkgs differ only in deps, src and some meta attributes, the rest is very copy-pastey.

Wouldn't it be cool if all you needed to do to define most packages was: call some magical lib.mkUFNoCopyPasteyDerivation, specify use flags with deps, specify src, meta.license and meta.description, and it figures out the rest for you (homepage from src, platforms from deps, etc).

Now, do you see the hidden agenda behind #35075 and

As a side note, meta.platforms should be checked (or just autogenerated, or maybe both, maybe with config.checkMetaPlatforms or something) against platforms produced by intersecting platforms of derivations from buildInputs. But I have not implemented that properly yet.

of https://github.com/NixOS/nixpkgs/issues/35906#issuecomment-369465393 ?

Do you want to welcome such an agenda now (if you do, I can port mkUFDerivation infra to nixpkgs) or do you want to wait another 3-5 years until, maybe, somebody with commit access implements something like this (usually, worse) with little to no discussion. Let me remind you that this is, pretty much, my experience with nixpkgs merge process, e.g. see anything nixos related from https://github.com/NixOS/nixpkgs/pulls?page=1&q=is%3Apr+author%3Aoxij+is%3Aunmerged&utf8=%E2%9C%93 , which gave birth to SLNOS.

I want SLNOS to be less than a 100 patches on top of master (most of which would be in OS department), but master makes good things hard to archive in less than 400, which is really painful to merge all the time.

Why can't nixpkgs move in a better direction with use flags? Seriously. So much time is wasted by nixpkgs contributors doing copy-pastey things, and then by SLNOS contributors undoing those things and merging with SLNOS. So frustrating! Grrr.

Can't anything be done with bikeshedding and "not invented here" syndrome in nixpkgs? Like, did you read GuixSD's sources yet? No? You should go read GuixSD's sources! Grrr.

/cc @edolstra @shlevy @vcunat on this

7c6f434c commented 6 years ago

Oh well. The real problem is: you say «worse», what you mean is it allows strictly less, I agree that the solution in Nixpkgs will be worse, but there is the position that it will do less and will be in some sense more lightweight and so it will be in some sense «better».

I have already implemented and committed multiple solutions to remove duplication between buildInputs and the function parameters, and all of them were explicitly criticised (not silently ignored) even when I was only committing them into packages that nobody but me updated. So I assume that some things will never happen — not because of stalling or problems with decision-making, but because of explicit opposition of many people. Powerful usable overrides are considered harmful, oh well. I don't want so many overrides to justify not using Hydra binaries for the rest of the system.

Also, I tried to keep a couple of latest versions by default for libraries, and that also was explicitly rejected. I think there is some idea about too many combinations making things untestable or the exact use pattern of library versions hard to establish or risk of having different default dependency versions for downstream packages and problems when combining them further downstream.

The thing that happens with 3–5 years and limited implementation is not based as much on NIH, as on accumulation of support for some feature that makes reverting a small enough implementation unattractive.

The detail with packageOverrides is that the complicated packageOverrides expression is really a one-time cost, not per-package.

Ignoring all these flags etc. and just passing null leads to shorter default-case expressions anyway (and that is what too many people care about). As for nulls not allowing to check something — why exactly? I can check for null just fine.

Copy-pastey expressions are not enough. when they are enough, if I fully buy all the idea that a separate version should not be specified, come at 16 non-blank lines with 10 lines to actually fill. Platforms from deps is iffy, unifying deps and arguments meets pushback, and the rest actually requires human input. So when you find out that people want the most limited packages possible, there is just nothing to generate.

It is probably better to make as much of the distinctions inside Nixpkgs as possible library functions, and not these splits into the lists like nativeBuildInputs. The most expensive part of Nixpkgs is the leaf package expressions, and if one could just give them a different stdenv.mkDerivation, the package version/patch database could be maintained together by everyone and the stdenvs could be different.

In the context of meta.broken, that probably means putting everything into meta.broken; maybe with optional-trace-generating wrappers around groups of conditions to hint whether the failure is likely to be a buildtime or a runtime one.

oxij commented 6 years ago

I have already implemented and committed multiple solutions to remove duplication between buildInputs and the function parameters, and all of them were

I'm not aware of anything except composableDerivation and things similar to how cmus expression is done. Any pointers?

I think there is some idea about too many combinations making things untestable or the exact use pattern of library versions hard to establish or risk of having different default dependency versions for downstream packages and problems when combining them further downstream.

I can get behind that argument. But I also see a solution: simply hide non-default versions by default with something like knownVulnerabilities, e.g. knownBetterVersions :) You need it? And it doesn't meet the default nixpkgs inclusion conditions? You just have to enable it explicitly.

The thing that happens with 3–5 years and limited implementation is not based as much on NIH, as on accumulation of support for some feature that makes reverting a small enough implementation unattractive.

That is another plausible explanation, yes, but seeing how NixOS slowly adopts things that were proposed and wholeheartedly rejected years ago I wonder if that is actually the case.

My experience shows that most people hate reading others' source code. In SLNOS we have "show you did your research first" rule (which, you might have noticed, I try to follow in my nixpkgs PRs too). Anything non-trivial has to provide relevant references like "it's a remake of/solution to such and such nixpkgs/Triton/GuixSD/Gentoo/Arch/Debian/etc PR/issue/etc".

and just passing null leads to shorter default-case expressions anyway (and that is what too many people care about).

Eh? My whole point that it is not. Did you read the above?

As for nulls not allowing to check something — why exactly? I can check for null just fine.

By

it can also properly check any deps between flags (which .override fails to do and nulls forbid you to even think about, btw)

I mean that flags are strictly more expressive than nulls. How do you properly disable x11Support? You set it to false. How you do that with nulls? You override all the X11 libraries with nulls? Seriously? Flag dependencies are easy to check, ad-hoc null overrides are much harder to check properly (expressions get large and ugly pretty fast).

But if one almost never overrides things because hydra cache then, yes, all of that is purely academic.

Platforms from deps is iffy,

But completely optional and independent from the rest of the above (it's just that I like the idea). Because I like all the ideas that lead to more automation. Computers are cheap. My time is very limited. I hate cross-compiling shit for hours at a time to find out that what I actually needed is not actually supported.

unifying deps and arguments meets pushback,

"Yes, but why?"

and the rest actually requires human input.

If you mean "the expressions need to be rewritten" then, yes, they do.

So when you find out that people want the most limited packages possible, there is just nothing to generate.

=/

It is probably better to make as much of the distinctions inside Nixpkgs as possible library functions, and not these splits into the lists like nativeBuildInputs.

It just came to me that you can do that with the SLNOS mkUFDerivation too, like so

mkUFDerivation (x: {
  native = mkNativeBuildInputs [ "pkgconfig" ];
}) body

and a proper stdenv.mkDerivation (or whatever else) wrapper in the wrapper.

The most expensive part of Nixpkgs is the leaf package expressions, and if one could just give them a different stdenv.mkDerivation, the package version/patch database could be maintained together by everyone and the stdenvs could be different.

Hm. That is quite an interesting idea, actually. But I don't see that working for complicated packages with intricate interplay between inputs and build phases, but most packages can be written this way, yes.

I don't see that happening in nixpkgs, though. Such a thing is just too far away from what the core of contributors cares about.

In the context of meta.broken, that probably means putting everything into meta.broken; maybe with optional-trace-generating wrappers around groups of conditions to hint whether the failure is likely to be a buildtime or a runtime one.

Eh? But why? It isn't like nix-env depends specifically on meta.broken or something. We can do pretty much whatever with meta attributes. Why not do something fuzzable then?

aneeshusa commented 6 years ago

I find that I run into a bad interaction of having asserts at the top level of a package expression with overrides. Namely, if an assert fires due to an a change from an overlay, then a future use of .override on that package which would normally pass the assert doesn't work. An example (not that I actually want to remove http2 support, but can't remember which package I was working with when this bit me):

# in an overlay
self: super: {
  nghttp2 = null; # causes curl to fire assert, as curl defaults http2Support to true
  curl = super.curl.override { http2Support = false; } # doesn't fix the issue; happens too late
}

The only way I've found to fix this is to make the assert lazier by placing it right before nghttp2 is used, i.e. replace

optional http2Support nghttp2 ++

with

optional http2Support (assert nghttp2 != null; nghttp2) ++

While I do like having these checks, it's a bit annoying to have to manually lazy-ify each one. I hope a better design here can avoid this problem; I haven't spent the time to read through this thread and all the proposals, but for example I think something like https://github.com/NixOS/nixpkgs/issues/36229#issuecomment-370138378 might still be prone to this issue.

7c6f434c commented 6 years ago

I have already implemented and committed multiple solutions to remove duplication between buildInputs and the function parameters, and all of them were I'm not aware of anything except composableDerivation and things similar to how cmus expression is done. Any pointers?

Well, for example helperArgNames (up to beginning 2016)

You need it? And it doesn't meet the default nixpkgs inclusion conditions? You just have to enable it explicitly.

I wonder is a bot could maintain nixpkgs-attic repository, which would automatically make the version-addressed snapshots of Nixpkgs master. If some version is not present in master anymore, it just stops getting any changes. A policy could be that the versions that are still present in Nixpkgs should be changed there (this would be ‘‘enforced’’ by the bot actually overwriting the changes), and for old versions anything goes if someone cares.

That is another plausible explanation, yes, but seeing how NixOS slowly adopts things that were proposed and wholeheartedly rejected years ago I wonder if that is actually the case.

I have seen the full spectrum of reactions to changes from committers pushed to master — reverts, negotiating the scale down, complaints with no action. Basically, there is a desire for minimalism, but then there are practical considerations that slowly erode the will to oppose the feature creep.

and just passing null leads to shorter default-case expressions anyway (and that is what too many people care about). Eh? My whole point that it is not. Did you read the above?

Yes. Passing the null often allows the expression that doesn't care. Your list of supported overrides is in itself longer than many expressions I have written.

How do you properly disable x11Support? You set it to false. How you do that with nulls?

Just libX11. Yes, flags are more expressive, but they are more explicit, and have to be paid some attention during package updates, and that last part means they will not gain support in the next three years.

But if one almost never overrides things because hydra cache then, yes, all of that is purely academic.

Most high-volume Nixpkgs committers don't use a complex set of overrides (either because Hydra or because they want a set of expressions that receives the most community testing), so your arguments for USE flag — valid arguments — are arguing for an undesirable tradeoff.

unifying deps and arguments meets pushback, "Yes, but why?"

Maybe evaluation times, actually. Or evaluation RAM footprint. Maybe also the distant hope of having static typechecking for Nix one day.

and the rest actually requires human input. If you mean "the expressions need to be rewritten" then, yes, they do.

No, I mean that of the 8 remaining lines, you can generate zero with Nix. You cannot set maintainer, you do need human input for platforms, you cannot calculate the license in pure Nix.

Hm. That is quite an interesting idea, actually. But I don't see that working for complicated packages with intricate interplay between inputs and build phases, but most packages can be written this way, yes.

Maintaining the interplay between flags and build phases is something that a lot of people in Nixpkgs want to avoid. So this will have to live in a separate repo.

We-ell, if you can beat LibreOffice into submission without going mad, I can Just Commit It and I know from experience that people just take whatever LibreOffice version someone else updates. As long as it resembles a working LibreOffice version. And I also will gratefully accept work from someone else for LibreOffice updates.

In general if the expression is hard enough to get right even for one set of options, I would expect supporting more build variants to be even harder.

I don't see that happening in nixpkgs, though. Such a thing is just too far away from what the core of contributors cares about.

Nixpkgs packages have pressure to minimalism. We just need to steer it into a direction that is slightly more convenient to parse from outside. I mean, most Nixpkgs expressions are already there — if you pass them fake stdenv, you get all the valuable information there is (inputs, version, patches) with little effort.

In the context of meta.broken, that probably means putting everything into meta.broken; maybe with optional-trace-generating wrappers around groups of conditions to hint whether the failure is likely to be a buildtime or a runtime one. Eh? But why? It isn't like nix-env depends specifically on meta.broken or something. We can do pretty much whatever with meta attributes. Why not do something fuzzable then?

I have been in a discussion whether some attributes in meta should not ever exist. A wrapper function which is just a trace-if-desired could be simpler to negotiate into Nixpkgs mainline, and easy to override in the downstream use-case.

7c6f434c commented 6 years ago

I think meta.broken is currently lazy enough.

oxij commented 6 years ago

@aneeshusa, right. This exactly my point in

It's shorter than your shortest packageOverrides thing with nulls and it can also properly check any deps between flags (which .override fails to do and nulls forbid you to even think about, btw).

nulls are evil.

oxij commented 6 years ago

Well, for example helperArgNames (up to beginning 2016)

Hm. From what I can surmise from git log -S helperArgNames and #4210 the issue with builderDefsPackage was that it was more copy-pastey than plain mkDerivations for packages with small number of flags (which is the most packages of nixpkgs), that is. See e.g. cc9547dcf99f63e1046b25b9273bbc4b3999b341 or 8878e8ec05845b92fc5bca7f22c5bb0a0f19dad4. This is not the case with mkUFDerivation.

Any more examples? I seriously want to know why every other attempt failed. Please teach me what to search with. I looked at git log --numstat pkgs/build-support/ | grep -E '^\s*0\s*[1-9][0-9]*' | sed 's/^[^p]*//' | sort | uniq but there's nothing else (except already mentioned builder-defs) that looks like it might be the thing I want.

ATM I see no drawbacks to mkUFDerivation except marginally longer evaluation times.

I wonder is a bot could maintain nixpkgs-attic repository

If nix could partially evaluate and dump code as data (Guix has this for free because they do it in LISP, btw) mkUFDerivation would cost nothing and attic bot could be implemented pretty easily by just partially evaluating, dumping, and then deduplicating expressions from all-packages.nix on every master commit.

Yes. Passing the null often allows the expression that doesn't care. Your list of supported overrides is in itself longer than many expressions I have written.

In which case you could just dump all of it into required and get exactly the same lack of extensibility.

so your arguments for USE flag — valid arguments — are arguing for an undesirable tradeoff.

But I also argue that adding fuzzing on top of mkUFDerivation changes that tradeoff. Well, whatever. I see your point, you see my point.

Maybe also the distant hope of having static typechecking for Nix one day.

A-ha-ha. (It would be cool, indeed, but knowing how nixpkgs does things now: "a-ha-ha".) I do want to write an alternative interpreter (with incremental and partial evaluation) for nix in Haskell or Rust eventually, though.

you do need human input for platforms, you cannot calculate the license in pure Nix

Well, actually... You know about my fascination with autogenerating platforms already. But you could do that for licenses too. I actually did implement a license checker for checkMeta that checked that you didn't link (with buildInputs) against GPL packages in non-GPL packages. And got a ton, A TON, of evaluation errors :) The reality is that nobody actually cares about the licenses. If you start properly checking them nothing ever evaluates. But the moral of that story is that if people did actually care about the licenses, you could derive them from package deps too. Just sayin'.

We-ell, if you can beat LibreOffice into submission without going mad, I can Just Commit It and I know from experience that people just take whatever LibreOffice version someone else updates. As long as it resembles a working LibreOffice version. And I also will gratefully accept work from someone else for LibreOffice updates.

:) No thanks. But I'll ask in SLNOS. But the positive result is unlikely. :)

In general if the expression is hard enough to get right even for one set of options, I would expect supporting more build variants to be even harder.

I think fuzzing changes that.

I don't see that happening in nixpkgs, though. Such a thing is just too far away from what the core of contributors cares about.

Nixpkgs packages have pressure to minimalism. We just need to steer it into a direction that is slightly more convenient to parse from outside. I mean, most Nixpkgs expressions are already there — if you pass them fake stdenv, you get all the valuable information there is (inputs, version, patches) with little effort.

... but no information about the options. Since options are the hardest part of an expression, it seems easier to me to maintain a parallel set of expressions that "borrow" src, patches and meta from master's expressions and do the rest themselves.

I have been in a discussion whether some attributes in meta should not ever exist. A wrapper function which is just a trace-if-desired could be simpler to negotiate into Nixpkgs mainline, and easy to override in the downstream use-case.

I agree. Fuzzing, though.

7c6f434c commented 6 years ago

Well, for example helperArgNames (up to beginning 2016) Hm. From what I can surmise from git log -S helperArgNames and #4210 the issue with builderDefsPackage was that it was more copy-pastey than plain mkDerivations for packages with small number of flags

helperArgNames were criticised separately (and later iterations builderDefsPackage were non-copy-pastey)

I wonder is a bot could maintain nixpkgs-attic repository If nix could partially evaluate and dump code as data (Guix has this for free because they do it in LISP, btw)

Well, Lisp gives you dumping the code, but not proper partial evaluation…

With Nix2.0 nix edit, though, it is possible to just grab the leaf package file without even parsing Nix code. Of course, there are packages that won't work like that, but they are a minority.

Yes. Passing the null often allows the expression that doesn't care. Your list of supported overrides is in itself longer than many expressions I have written. In which case you could just dump all of it into required and get exactly the same lack of extensibility.

In the current style I can still pass null. Of course, with required I can pass something with an empty outPath

so your arguments for USE flag — valid arguments — are arguing for an undesirable tradeoff. Well, whatever. I see your point, you see my point.

I think our value disagreement is mostly that I want to have my LibreOffice from a publically mirrored repository, so I won't simply use SLNOS for everything. Instrumentally, I would also prefer to have the package-database maintenance in Nixpkgs a viable shared resource.

Maybe also the distant hope of having static typechecking for Nix one day. knowing how nixpkgs does things now: "a-ha-ha".

Hey, that's the point that you do not need to change Nixpkgs much, you can just maintain a small list of weird places (outside Nixpkgs mainline).

you do need human input for platforms, you cannot calculate the license in pure Nix The reality is that nobody actually cares about the licenses. If you start properly checking them nothing ever evaluates. But the moral of that story is that if people did actually care about the licenses, you could derive them from package deps too.

It is a fun legal exercise just how optional your GPL optional dependency should be before you can say «the source tarball is MIT but once you enable libSomething support the binary is GPLv3+».

Anyway, the dependencies set a bound on the license, but they don't actually guarantee that the output license is exactly that.

In general if the expression is hard enough to get right even for one set of options, I would expect supporting more build variants to be even harder. I think fuzzing changes that.

Sorry, no. If you need to negotiate with build system to get one variant working, you need to negotiate even more about multiple variants working. Fuzzing may help you notice when it breaks, but when it breaks, it needs fixing, and the initial assumption is that this fixing is complicated.

I will gladly and gratefully accept a counterexample in the form of a working configurable LibreOffice package, but

No, thanks.

... but no information about the options. Since options are the hardest part of an expression, it seems easier to me to maintain a parallel set of expressions that "borrow" src, patches and meta from master's expressions and do the rest themselves.

Are you saying that adding options/use-flags everywhere more than doubles the effort?

I have been in a discussion whether some attributes in meta should not ever exist. A wrapper function which is just a trace-if-desired could be simpler to negotiate into Nixpkgs mainline, and easy to override in the downstream use-case. I agree. Fuzzing, though.

What about fuzzing? You just replace «pick the warning» function with «these kinds of problems are just ignored».

oxij commented 6 years ago

Well, Lisp gives you dumping the code, but not proper partial evaluation…

But eval for LISP is 15 lines of LISP, so you can just write another interpreter right there... It will be slow, though.

In the current style I can still pass null. Of course, with required I can pass something with an empty outPath

Fine. I see you want things to be dirty sometimes, I get the usefulness of that. mkUFDerivation needs to support nulls somehow. Will do.

I think our value disagreement is mostly that I want to have my LibreOffice from a publically mirrored repository, so I won't simply use SLNOS for everything. Instrumentally, I would also prefer to have the package-database maintenance in Nixpkgs a viable shared resource.

Wait, do I hear you saying that if I port mkUFDerivation just to make LibreOffice build sanely, the upstream will adopt the patchset?

Hey, that's the point that you do not need to change Nixpkgs much, you can just maintain a small list of weird places (outside Nixpkgs mainline).

Fair enough.

Anyway, the dependencies set a bound on the license, but they don't actually guarantee that the output license is exactly that.

True, but if you don't do any legal gymnastics most of the time you get no actual choice except GPL. (And I think it's a good thing.)

Sorry, no.

Well, ok, fair enough.

Are you saying that adding options/use-flags everywhere more than doubles the effort?

For packages with a bunch of options/use-flags? Of course. It can be 10x-100x more effort. Look at ffmpeg on master. It's so bad that master has two completely different expressions for ffmpeg-3.4 (ffmpeg generic, and ffmpeg-full). Options are hard. Hence mkUFDerivation.

What about fuzzing? You just replace «pick the warning» function with «these kinds of problems are just ignored».

It seems to me that this way you would just push currently explicit structures of possible problems like meta.broken, meta.knownVulnerabilities, etc into a function arguments. Some kind of modular handling for those things is due, though, I agree. How about replacing those things with meta.issues of { kind : String, condition = true : Bool, reason : String, ... } type, e.g.

  meta.issues = [
    { kind = "broken.won't-build"; condition = x11Support; reason = "x11 support is broken ATM"; }
    { kind = "broken.won't-work"; condition = pulseaudioSupport; reason = "pulseaudio support is buggy"; }
    { kind = "vulnerable"; id = "CVE-XXXX-XX-XX-XXXX"; }
  ];

? "."-separated strings can be made into lists to make it parse less. Common kinds can be made in lib functions like markBroken condition reason or whatnot.

Most of the OP seems to be pretty easy with that.

7c6f434c commented 6 years ago

Well, Lisp gives you dumping the code, but not proper partial evaluation… But eval for LISP is 15 lines of LISP, so you can just write another interpreter right there... It will be slow, though.

But Guile isn't LISP 1.5, it's larger and more complicated. But yes, you can go quite far; although it is enough for a parser to be available inside the language — Julia would be fine as well.

In the current style I can still pass null. Of course, with required I can pass something with an empty outPath… Fine. I see you want things to be dirty sometimes, I get the usefulness of that. mkUFDerivation needs to support nulls somehow. Will do.

Actually, requiring having meta and just allowing an empty outPath (up to: literally "") could be a better way. I just want global guarantees, after all (and I am not a SLNOS user and unlikely to migrate to SLNOS as the primary package source), so maybe I want tradeoffs incompatible with yours.

I think our value disagreement is mostly that I want to have my LibreOffice from a publically mirrored repository, so I won't simply use SLNOS for everything. Instrumentally, I would also prefer to have the package-database maintenance in Nixpkgs a viable shared resource. Wait, do I hear you saying that if I port mkUFDerivation just to make LibreOffice build sanely, the upstream will adopt the patchset?

There is my position and then there is overall reaction. And then there is usage for LibreOffice and usage in general.

If it turns out to be saner than now (not a very high bar, but a nontrivial one — it still has to work with the existing upstream build system) — I guess it has a very high probability to get adopted specifically in LibreOffice. Spreading it will still not be feasible.

I will just say that I am not rejecting a working LO update, whatever the style and merge the PR. I hope that the tolerance level for this specific package is high enough for noone to want to revert.

True, but if you don't do any legal gymnastics most of the time you get no actual choice except GPL. (And I think it's a good thing.)

«Most of the time» is a measure-dependent notion…

Are you saying that adding options/use-flags everywhere more than doubles the effort? For packages with a bunch of options/use-flags? Of course. It can be 10x-100x more effort. Look at ffmpeg on master. It's so bad that master has two completely different expressions for ffmpeg-3.4 (ffmpeg generic, and ffmpeg-full). Options are hard. Hence mkUFDerivation.

I think they just default in the opposite direction.

What about fuzzing? You just replace «pick the warning» function with «these kinds of problems are just ignored». It seems to me that this way you would just push currently explicit structures of possible problems like meta.broken, meta.knownVulnerabilities, etc into a function arguments. Some kind of modular handling for those things is due, though, I agree. How about replacing those things with meta.issues of { kind : String, condition = true : Bool, reason : String, ... } type, e.g.

 meta.issues = [
   { kind = "broken.won't-build"; condition = x11Support; reason = "x11 support is broken ATM"; }
   { kind = "broken.won't-work"; condition = pulseaudioSupport; reason = "pulseaudio support is buggy"; }
   { kind = "vulnerable"; id = "CVE-XXXX-XX-XX-XXXX"; }
 ];

? "."-separated strings can be made into lists to make it parse less. Common kinds can be made in lib functions like markBroken condition reason or whatnot.

Most of the OP seems to be pretty easy with that.

Hm. I like it. Not sure I want to push for such a change before 18.03, though. This «kill all assert» thing has the benefit of clearly not being doable quickly, so nobody will try until the release.

danbst commented 6 years ago

I've proposed a similar PR a while ago https://github.com/NixOS/nixpkgs/pull/32019. This would fix https://github.com/NixOS/nixpkgs/issues/11226#issuecomment-345906810 and https://github.com/NixOS/nixpkgs/issues/31884

It took only 20 files to edit to make nixpkgs evaluatable on non-cross setup. Also, note that some asserts are used as license checks, so can't be treated as "broken"

7c6f434c commented 6 years ago

Also, note that some asserts are used as license checks, so can't be treated as "broken"

Hm. I wonder if creating lib.licenses.unsatisfied (like unfree only worse) and setting it when the EULA has not been accepted is a good idea (asserts are annoying for overrides and for checking meta).

Asserts inside stdenv are OK, of course (I started in pkgs to exclude lib but forgot about stdenv).

7c6f434c commented 6 years ago

Updated the description re: license check and re: stdenv exclusion

Ekleog commented 5 years ago

@7c6f434c Care to turn this into a proper RFC, so that a “definitive” decision could be made?

stale[bot] commented 4 years ago

Thank you for your contributions.

This has been automatically marked as stale because it has had no activity for 180 days.

If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.

Here are suggestions that might help resolve this more quickly:

  1. Search for maintainers and people that previously touched the related code and @ mention them in a comment.
  2. Ask on the NixOS Discourse.
  3. Ask on the #nixos channel on irc.freenode.net.
siraben commented 3 years ago

Still relevant.

piegamesde commented 2 years ago

Closing this. This issue is so outdated, we'd need somebody motivated to evaluate the current situation and open a new issue. I don't think this will require an RFC though.