about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBen Siraphob <bensiraphob@gmail.com>2021-01-22 00:00:13 +0700
committerJonathan Ringer <jonringer@users.noreply.github.com>2021-01-21 19:11:02 -0800
commit66e44425c6dfecbea68a5d6dc221ccd56561d4f1 (patch)
tree0a5bf7d41356ad47b4e6f0a737bf16c9a4a5b01e
parent046d24424ef32cca1227519f93f41b5ec8133f31 (diff)
pkgs/development/libraries: stdenv.lib -> lib
-rw-r--r--pkgs/development/libraries/AntTweakBar/default.nix8
-rw-r--r--pkgs/development/libraries/CGAL/4.nix4
-rw-r--r--pkgs/development/libraries/CGAL/default.nix4
-rw-r--r--pkgs/development/libraries/CoinMP/default.nix4
-rw-r--r--pkgs/development/libraries/LAStools/default.nix4
-rw-r--r--pkgs/development/libraries/LASzip/LASzip2.nix4
-rw-r--r--pkgs/development/libraries/LASzip/default.nix8
-rw-r--r--pkgs/development/libraries/NSPlist/default.nix4
-rw-r--r--pkgs/development/libraries/PlistCpp/default.nix4
-rw-r--r--pkgs/development/libraries/SDL/default.nix8
-rw-r--r--pkgs/development/libraries/SDL2/default.nix8
-rw-r--r--pkgs/development/libraries/SDL2_gfx/default.nix8
-rw-r--r--pkgs/development/libraries/SDL2_image/default.nix8
-rw-r--r--pkgs/development/libraries/SDL2_mixer/default.nix8
-rw-r--r--pkgs/development/libraries/SDL2_net/default.nix8
-rw-r--r--pkgs/development/libraries/SDL2_ttf/default.nix8
-rw-r--r--pkgs/development/libraries/SDL_Pango/default.nix4
-rw-r--r--pkgs/development/libraries/SDL_gfx/default.nix6
-rw-r--r--pkgs/development/libraries/SDL_gpu/default.nix4
-rw-r--r--pkgs/development/libraries/SDL_image/default.nix6
-rw-r--r--pkgs/development/libraries/SDL_mixer/default.nix2
-rw-r--r--pkgs/development/libraries/SDL_net/default.nix6
-rw-r--r--pkgs/development/libraries/SDL_sixel/default.nix4
-rw-r--r--pkgs/development/libraries/SDL_stretch/default.nix4
-rw-r--r--pkgs/development/libraries/SDL_ttf/default.nix6
-rw-r--r--pkgs/development/libraries/Xaw3d/default.nix6
-rw-r--r--pkgs/development/libraries/a52dec/default.nix6
-rw-r--r--pkgs/development/libraries/aalib/default.nix8
-rw-r--r--pkgs/development/libraries/abseil-cpp/default.nix4
-rw-r--r--pkgs/development/libraries/accountsservice/default.nix4
-rw-r--r--pkgs/development/libraries/ace/default.nix4
-rw-r--r--pkgs/development/libraries/acl/default.nix4
-rw-r--r--pkgs/development/libraries/afflib/default.nix10
-rw-r--r--pkgs/development/libraries/aften/default.nix4
-rw-r--r--pkgs/development/libraries/agda/agda-prelude/default.nix8
-rw-r--r--pkgs/development/libraries/agda/functional-linear-algebra/default.nix2
-rw-r--r--pkgs/development/libraries/agda/iowa-stdlib/default.nix8
-rw-r--r--pkgs/development/libraries/agda/standard-library/default.nix8
-rw-r--r--pkgs/development/libraries/agg/default.nix6
-rw-r--r--pkgs/development/libraries/alembic/default.nix4
-rw-r--r--pkgs/development/libraries/allegro/5.nix4
-rw-r--r--pkgs/development/libraries/allegro/default.nix4
-rw-r--r--pkgs/development/libraries/alure/default.nix4
-rw-r--r--pkgs/development/libraries/alure2/default.nix4
-rw-r--r--pkgs/development/libraries/amdvlk/default.nix4
-rw-r--r--pkgs/development/libraries/aml/default.nix4
-rw-r--r--pkgs/development/libraries/amrnb/default.nix4
-rw-r--r--pkgs/development/libraries/amrwb/default.nix4
-rw-r--r--pkgs/development/libraries/amtk/default.nix6
-rw-r--r--pkgs/development/libraries/apache-activemq/default.nix6
-rw-r--r--pkgs/development/libraries/appstream-glib/default.nix6
-rw-r--r--pkgs/development/libraries/appstream/default.nix4
-rw-r--r--pkgs/development/libraries/apr-util/default.nix6
-rw-r--r--pkgs/development/libraries/apr/default.nix12
-rw-r--r--pkgs/development/libraries/aqbanking/default.nix4
-rw-r--r--pkgs/development/libraries/aqbanking/gwenhywfar.nix8
-rw-r--r--pkgs/development/libraries/aqbanking/libchipcard.nix4
-rw-r--r--pkgs/development/libraries/aravis/default.nix36
-rw-r--r--pkgs/development/libraries/arb/default.nix8
-rw-r--r--pkgs/development/libraries/argp-standalone/default.nix12
-rw-r--r--pkgs/development/libraries/argtable/default.nix4
-rw-r--r--pkgs/development/libraries/arguments/default.nix4
-rw-r--r--pkgs/development/libraries/aribb25/default.nix2
-rw-r--r--pkgs/development/libraries/armadillo/default.nix4
-rw-r--r--pkgs/development/libraries/arrayfire/default.nix14
-rw-r--r--pkgs/development/libraries/asio/generic.nix6
-rw-r--r--pkgs/development/libraries/aspell/default.nix8
-rw-r--r--pkgs/development/libraries/aspell/dictionaries.nix2
-rw-r--r--pkgs/development/libraries/assimp/default.nix4
-rw-r--r--pkgs/development/libraries/at-spi2-atk/default.nix6
-rw-r--r--pkgs/development/libraries/at-spi2-core/default.nix8
-rw-r--r--pkgs/development/libraries/atk/default.nix12
-rw-r--r--pkgs/development/libraries/atkmm/default.nix8
-rw-r--r--pkgs/development/libraries/attr/default.nix4
-rw-r--r--pkgs/development/libraries/aubio/default.nix4
-rw-r--r--pkgs/development/libraries/audiality2/default.nix4
-rw-r--r--pkgs/development/libraries/audio/libbass/default.nix6
-rw-r--r--pkgs/development/libraries/audio/libbs2b/default.nix6
-rw-r--r--pkgs/development/libraries/audio/libgme/default.nix6
-rw-r--r--pkgs/development/libraries/audio/libinstpatch/default.nix4
-rw-r--r--pkgs/development/libraries/audio/libmysofa/default.nix4
-rw-r--r--pkgs/development/libraries/audio/libsmf/default.nix4
-rw-r--r--pkgs/development/libraries/audio/lilv/default.nix4
-rw-r--r--pkgs/development/libraries/audio/lv2/default.nix6
-rw-r--r--pkgs/development/libraries/audio/lvtk/default.nix4
-rw-r--r--pkgs/development/libraries/audio/mbelib/default.nix4
-rw-r--r--pkgs/development/libraries/audio/ntk/default.nix8
-rw-r--r--pkgs/development/libraries/audio/qm-dsp/default.nix4
-rw-r--r--pkgs/development/libraries/audio/raul/default.nix4
-rw-r--r--pkgs/development/libraries/audio/rtaudio/default.nix4
-rw-r--r--pkgs/development/libraries/audio/rtmidi/default.nix8
-rw-r--r--pkgs/development/libraries/audio/sratom/default.nix4
-rw-r--r--pkgs/development/libraries/audio/suil/default.nix2
-rw-r--r--pkgs/development/libraries/audio/vamp-plugin-sdk/default.nix4
-rw-r--r--pkgs/development/libraries/audio/zita-alsa-pcmi/default.nix8
-rw-r--r--pkgs/development/libraries/audio/zita-convolver/default.nix10
-rw-r--r--pkgs/development/libraries/audio/zita-resampler/default.nix8
-rw-r--r--pkgs/development/libraries/audiofile/default.nix6
-rw-r--r--pkgs/development/libraries/avahi/default.nix26
-rw-r--r--pkgs/development/libraries/avro-c++/default.nix8
-rw-r--r--pkgs/development/libraries/avro-c/default.nix4
-rw-r--r--pkgs/development/libraries/ayatana-ido/default.nix4
-rw-r--r--pkgs/development/libraries/babl/default.nix6
-rw-r--r--pkgs/development/libraries/bamf/default.nix4
-rw-r--r--pkgs/development/libraries/bcg729/default.nix4
-rw-r--r--pkgs/development/libraries/bctoolbox/default.nix4
-rw-r--r--pkgs/development/libraries/beecrypt/default.nix6
-rw-r--r--pkgs/development/libraries/beignet/default.nix4
-rw-r--r--pkgs/development/libraries/belcard/default.nix4
-rw-r--r--pkgs/development/libraries/belle-sip/default.nix4
-rw-r--r--pkgs/development/libraries/belr/default.nix4
-rw-r--r--pkgs/development/libraries/biblesync/default.nix6
-rw-r--r--pkgs/development/libraries/bobcat/default.nix4
-rw-r--r--pkgs/development/libraries/boehm-gc/7.6.6.nix4
-rw-r--r--pkgs/development/libraries/boehm-gc/default.nix4
-rw-r--r--pkgs/development/libraries/boolstuff/default.nix6
-rw-r--r--pkgs/development/libraries/boost-process/default.nix4
-rw-r--r--pkgs/development/libraries/boost/1.67.nix4
-rw-r--r--pkgs/development/libraries/boost/generic.nix8
-rw-r--r--pkgs/development/libraries/bootil/default.nix8
-rw-r--r--pkgs/development/libraries/boringssl/default.nix4
-rw-r--r--pkgs/development/libraries/botan/generic.nix6
-rw-r--r--pkgs/development/libraries/box2d/default.nix4
-rw-r--r--pkgs/development/libraries/boxfort/default.nix4
-rw-r--r--pkgs/development/libraries/brigand/default.nix4
-rw-r--r--pkgs/development/libraries/buddy/default.nix6
-rw-r--r--pkgs/development/libraries/bullet/default.nix14
-rw-r--r--pkgs/development/libraries/bullet/roboschool-fork.nix12
-rw-r--r--pkgs/development/libraries/bulletml/default.nix4
-rw-r--r--pkgs/development/libraries/bwidget/default.nix6
-rw-r--r--pkgs/development/libraries/bzrtp/default.nix4
-rw-r--r--pkgs/development/libraries/c-ares/default.nix6
-rw-r--r--pkgs/development/libraries/c-blosc/default.nix4
-rw-r--r--pkgs/development/libraries/caf/default.nix4
-rw-r--r--pkgs/development/libraries/cairo/default.nix14
-rw-r--r--pkgs/development/libraries/cairomm/default.nix8
-rw-r--r--pkgs/development/libraries/capnproto/default.nix4
-rw-r--r--pkgs/development/libraries/capstone/default.nix12
-rw-r--r--pkgs/development/libraries/catch/default.nix4
-rw-r--r--pkgs/development/libraries/catch2/default.nix4
-rw-r--r--pkgs/development/libraries/ccrtp/default.nix8
-rw-r--r--pkgs/development/libraries/cctz/default.nix8
-rw-r--r--pkgs/development/libraries/cddlib/default.nix4
-rw-r--r--pkgs/development/libraries/cdk/default.nix4
-rw-r--r--pkgs/development/libraries/cdo/default.nix10
-rw-r--r--pkgs/development/libraries/cegui/default.nix4
-rw-r--r--pkgs/development/libraries/celt/generic.nix6
-rw-r--r--pkgs/development/libraries/cereal/default.nix4
-rw-r--r--pkgs/development/libraries/ceres-solver/default.nix6
-rw-r--r--pkgs/development/libraries/cfitsio/default.nix6
-rw-r--r--pkgs/development/libraries/cgui/default.nix4
-rw-r--r--pkgs/development/libraries/check/default.nix6
-rw-r--r--pkgs/development/libraries/chipmunk/default.nix4
-rw-r--r--pkgs/development/libraries/chmlib/default.nix4
-rw-r--r--pkgs/development/libraries/chromaprint/default.nix2
-rw-r--r--pkgs/development/libraries/cimg/default.nix4
-rw-r--r--pkgs/development/libraries/civetweb/default.nix4
-rw-r--r--pkgs/development/libraries/cl/default.nix4
-rw-r--r--pkgs/development/libraries/classads/default.nix6
-rw-r--r--pkgs/development/libraries/clearsilver/default.nix4
-rw-r--r--pkgs/development/libraries/clfft/default.nix4
-rw-r--r--pkgs/development/libraries/clipp/default.nix4
-rw-r--r--pkgs/development/libraries/clipper/default.nix4
-rw-r--r--pkgs/development/libraries/cln/default.nix4
-rw-r--r--pkgs/development/libraries/cloog-ppl/default.nix6
-rw-r--r--pkgs/development/libraries/cloog/0.18.0.nix6
-rw-r--r--pkgs/development/libraries/cloog/default.nix6
-rw-r--r--pkgs/development/libraries/clucene-core/2.x.nix10
-rw-r--r--pkgs/development/libraries/clucene-core/default.nix4
-rw-r--r--pkgs/development/libraries/clutter-gst/default.nix10
-rw-r--r--pkgs/development/libraries/clutter-gtk/default.nix10
-rw-r--r--pkgs/development/libraries/clutter/default.nix10
-rw-r--r--pkgs/development/libraries/cm256cc/default.nix4
-rw-r--r--pkgs/development/libraries/cmark-gfm/default.nix4
-rw-r--r--pkgs/development/libraries/cmark/default.nix4
-rw-r--r--pkgs/development/libraries/cminpack/default.nix6
-rw-r--r--pkgs/development/libraries/cmocka/default.nix4
-rw-r--r--pkgs/development/libraries/cmrt/default.nix4
-rw-r--r--pkgs/development/libraries/codec2/default.nix4
-rw-r--r--pkgs/development/libraries/cogl/default.nix16
-rw-r--r--pkgs/development/libraries/coin3d/default.nix4
-rw-r--r--pkgs/development/libraries/comedilib/default.nix6
-rw-r--r--pkgs/development/libraries/concurrencykit/default.nix4
-rw-r--r--pkgs/development/libraries/cpp-hocon/default.nix4
-rw-r--r--pkgs/development/libraries/cpp-ipfs-api/default.nix4
-rw-r--r--pkgs/development/libraries/cpp-netlib/default.nix4
-rw-r--r--pkgs/development/libraries/cpp-utilities/default.nix4
-rw-r--r--pkgs/development/libraries/cppcms/default.nix4
-rw-r--r--pkgs/development/libraries/cppdb/default.nix4
-rw-r--r--pkgs/development/libraries/cpptest/default.nix6
-rw-r--r--pkgs/development/libraries/cppunit/default.nix4
-rw-r--r--pkgs/development/libraries/cpputest/default.nix8
-rw-r--r--pkgs/development/libraries/cppzmq/default.nix4
-rw-r--r--pkgs/development/libraries/cracklib/default.nix2
-rw-r--r--pkgs/development/libraries/crc32c/default.nix4
-rw-r--r--pkgs/development/libraries/crcpp/default.nix4
-rw-r--r--pkgs/development/libraries/cre2/default.nix4
-rw-r--r--pkgs/development/libraries/criterion/default.nix4
-rw-r--r--pkgs/development/libraries/crypto++/default.nix4
-rw-r--r--pkgs/development/libraries/csfml/default.nix4
-rw-r--r--pkgs/development/libraries/ctl/default.nix4
-rw-r--r--pkgs/development/libraries/ctpl/default.nix4
-rw-r--r--pkgs/development/libraries/ctpp2/default.nix4
-rw-r--r--pkgs/development/libraries/ctypes_sh/default.nix4
-rw-r--r--pkgs/development/libraries/cudd/default.nix4
-rw-r--r--pkgs/development/libraries/curlcpp/default.nix4
-rw-r--r--pkgs/development/libraries/curlpp/default.nix4
-rw-r--r--pkgs/development/libraries/cutee/default.nix4
-rw-r--r--pkgs/development/libraries/cwiid/default.nix4
-rw-r--r--pkgs/development/libraries/cxx-prettyprint/default.nix6
-rw-r--r--pkgs/development/libraries/cxxtest/default.nix4
-rw-r--r--pkgs/development/libraries/cxxtools/default.nix8
-rw-r--r--pkgs/development/libraries/cyrus-sasl/default.nix2
-rw-r--r--pkgs/development/libraries/czmq/default.nix4
-rw-r--r--pkgs/development/libraries/dav1d/default.nix12
-rw-r--r--pkgs/development/libraries/db/db-4.8.nix2
-rw-r--r--pkgs/development/libraries/db/db-5.3.nix2
-rw-r--r--pkgs/development/libraries/db/db-6.0.nix4
-rw-r--r--pkgs/development/libraries/db/db-6.2.nix4
-rw-r--r--pkgs/development/libraries/db/generic.nix10
-rw-r--r--pkgs/development/libraries/dbus-cplusplus/default.nix4
-rw-r--r--pkgs/development/libraries/dbus-glib/default.nix8
-rw-r--r--pkgs/development/libraries/dbus-sharp-glib/dbus-sharp-glib-1.0.nix4
-rw-r--r--pkgs/development/libraries/dbus-sharp-glib/default.nix4
-rw-r--r--pkgs/development/libraries/dbus-sharp/dbus-sharp-1.0.nix4
-rw-r--r--pkgs/development/libraries/dbus-sharp/default.nix4
-rw-r--r--pkgs/development/libraries/dbus/default.nix2
-rw-r--r--pkgs/development/libraries/dbxml/default.nix4
-rw-r--r--pkgs/development/libraries/dclib/default.nix4
-rw-r--r--pkgs/development/libraries/dclxvi/default.nix6
-rw-r--r--pkgs/development/libraries/dconf/default.nix16
-rw-r--r--pkgs/development/libraries/dee/default.nix4
-rw-r--r--pkgs/development/libraries/discord-rpc/default.nix8
-rw-r--r--pkgs/development/libraries/dleyna-connector-dbus/default.nix4
-rw-r--r--pkgs/development/libraries/dleyna-core/default.nix4
-rw-r--r--pkgs/development/libraries/dleyna-renderer/default.nix4
-rw-r--r--pkgs/development/libraries/dleyna-server/default.nix4
-rw-r--r--pkgs/development/libraries/dlib/default.nix2
-rw-r--r--pkgs/development/libraries/docopt_cpp/default.nix4
-rw-r--r--pkgs/development/libraries/doctest/default.nix4
-rw-r--r--pkgs/development/libraries/dotconf/default.nix4
-rw-r--r--pkgs/development/libraries/double-conversion/default.nix2
-rw-r--r--pkgs/development/libraries/dqlite/default.nix4
-rw-r--r--pkgs/development/libraries/draco/default.nix4
-rw-r--r--pkgs/development/libraries/drumstick/default.nix4
-rw-r--r--pkgs/development/libraries/dssi/default.nix4
-rw-r--r--pkgs/development/libraries/duckdb/default.nix4
-rw-r--r--pkgs/development/libraries/dxflib/default.nix6
-rw-r--r--pkgs/development/libraries/dyncall/default.nix4
-rw-r--r--pkgs/development/libraries/easyloggingpp/default.nix10
-rw-r--r--pkgs/development/libraries/eccodes/default.nix6
-rw-r--r--pkgs/development/libraries/eclib/default.nix6
-rw-r--r--pkgs/development/libraries/editline/default.nix4
-rw-r--r--pkgs/development/libraries/eigen/2.0.nix8
-rw-r--r--pkgs/development/libraries/eigen/default.nix6
-rw-r--r--pkgs/development/libraries/embree/2.x.nix4
-rw-r--r--pkgs/development/libraries/embree/default.nix2
-rw-r--r--pkgs/development/libraries/enchant/1.x.nix4
-rw-r--r--pkgs/development/libraries/enchant/2.x.nix4
-rw-r--r--pkgs/development/libraries/enet/default.nix8
-rw-r--r--pkgs/development/libraries/entt/default.nix4
-rw-r--r--pkgs/development/libraries/epoxy/default.nix4
-rw-r--r--pkgs/development/libraries/ethash/default.nix4
-rw-r--r--pkgs/development/libraries/eventlog/default.nix6
-rw-r--r--pkgs/development/libraries/exempi/default.nix6
-rw-r--r--pkgs/development/libraries/exiv2/default.nix8
-rw-r--r--pkgs/development/libraries/exosip/default.nix4
-rw-r--r--pkgs/development/libraries/expat/default.nix4
-rw-r--r--pkgs/development/libraries/faac/default.nix4
-rw-r--r--pkgs/development/libraries/faad2/default.nix4
-rw-r--r--pkgs/development/libraries/farbfeld/default.nix4
-rw-r--r--pkgs/development/libraries/farstream/default.nix4
-rw-r--r--pkgs/development/libraries/fast-cpp-csv-parser/default.nix4
-rw-r--r--pkgs/development/libraries/fastjson/default.nix4
-rw-r--r--pkgs/development/libraries/fastpbkdf2/default.nix4
-rw-r--r--pkgs/development/libraries/faudio/default.nix4
-rw-r--r--pkgs/development/libraries/fcgi/default.nix4
-rw-r--r--pkgs/development/libraries/fcppt/default.nix4
-rw-r--r--pkgs/development/libraries/fdk-aac/default.nix4
-rw-r--r--pkgs/development/libraries/fflas-ffpack/default.nix8
-rw-r--r--pkgs/development/libraries/ffmpeg-full/default.nix10
-rw-r--r--pkgs/development/libraries/ffmpeg-sixel/default.nix4
-rw-r--r--pkgs/development/libraries/ffmpeg/generic.nix6
-rw-r--r--pkgs/development/libraries/ffmpegthumbnailer/default.nix4
-rw-r--r--pkgs/development/libraries/ffms/default.nix4
-rw-r--r--pkgs/development/libraries/fftw/default.nix2
-rw-r--r--pkgs/development/libraries/filter-audio/default.nix4
-rw-r--r--pkgs/development/libraries/flann/default.nix8
-rw-r--r--pkgs/development/libraries/flatbuffers/default.nix6
-rw-r--r--pkgs/development/libraries/flatcc/default.nix4
-rw-r--r--pkgs/development/libraries/flatpak/default.nix6
-rw-r--r--pkgs/development/libraries/flint/default.nix12
-rw-r--r--pkgs/development/libraries/flite/default.nix8
-rw-r--r--pkgs/development/libraries/fltk/1.4.nix8
-rw-r--r--pkgs/development/libraries/fltk/default.nix8
-rw-r--r--pkgs/development/libraries/fmt/default.nix4
-rw-r--r--pkgs/development/libraries/folks/default.nix10
-rw-r--r--pkgs/development/libraries/folly/default.nix6
-rw-r--r--pkgs/development/libraries/fontconfig/default.nix6
-rw-r--r--pkgs/development/libraries/forge/default.nix4
-rw-r--r--pkgs/development/libraries/fox/default.nix6
-rw-r--r--pkgs/development/libraries/fox/fox-1.6.nix8
-rw-r--r--pkgs/development/libraries/fplll/20160331.nix8
-rw-r--r--pkgs/development/libraries/fplll/default.nix4
-rw-r--r--pkgs/development/libraries/frame/default.nix10
-rw-r--r--pkgs/development/libraries/freealut/default.nix8
-rw-r--r--pkgs/development/libraries/freeglut/default.nix6
-rw-r--r--pkgs/development/libraries/freetds/default.nix6
-rw-r--r--pkgs/development/libraries/freetype/default.nix6
-rw-r--r--pkgs/development/libraries/frei0r/default.nix6
-rw-r--r--pkgs/development/libraries/fribidi/default.nix6
-rw-r--r--pkgs/development/libraries/fstrcmp/default.nix4
-rw-r--r--pkgs/development/libraries/fstrm/default.nix4
-rw-r--r--pkgs/development/libraries/ftgl/default.nix8
-rw-r--r--pkgs/development/libraries/funambol/default.nix4
-rw-r--r--pkgs/development/libraries/galario/default.nix14
-rw-r--r--pkgs/development/libraries/gamenetworkingsockets/default.nix4
-rw-r--r--pkgs/development/libraries/gamin/default.nix12
-rw-r--r--pkgs/development/libraries/ganv/default.nix4
-rw-r--r--pkgs/development/libraries/garmintools/default.nix6
-rw-r--r--pkgs/development/libraries/gbenchmark/default.nix4
-rw-r--r--pkgs/development/libraries/gcab/default.nix6
-rw-r--r--pkgs/development/libraries/gcc/libstdc++/5.nix4
-rw-r--r--pkgs/development/libraries/gcr/default.nix6
-rw-r--r--pkgs/development/libraries/gd/default.nix6
-rw-r--r--pkgs/development/libraries/gdal/2.4.0.nix14
-rw-r--r--pkgs/development/libraries/gdal/default.nix14
-rw-r--r--pkgs/development/libraries/gdal/gdal-1_11.nix8
-rw-r--r--pkgs/development/libraries/gdata-sharp/default.nix4
-rw-r--r--pkgs/development/libraries/gdcm/default.nix10
-rw-r--r--pkgs/development/libraries/gdk-pixbuf/default.nix12
-rw-r--r--pkgs/development/libraries/gdk-pixbuf/xlib.nix4
-rw-r--r--pkgs/development/libraries/gdl/default.nix6
-rw-r--r--pkgs/development/libraries/gdome2/default.nix4
-rw-r--r--pkgs/development/libraries/gecode/3.nix4
-rw-r--r--pkgs/development/libraries/gecode/default.nix6
-rw-r--r--pkgs/development/libraries/gegl/4.0.nix8
-rw-r--r--pkgs/development/libraries/gegl/default.nix6
-rw-r--r--pkgs/development/libraries/geis/default.nix4
-rw-r--r--pkgs/development/libraries/genann/default.nix4
-rw-r--r--pkgs/development/libraries/geoclue/default.nix6
-rw-r--r--pkgs/development/libraries/geocode-glib/default.nix6
-rw-r--r--pkgs/development/libraries/geoip/default.nix8
-rw-r--r--pkgs/development/libraries/geos/default.nix6
-rw-r--r--pkgs/development/libraries/getdata/default.nix4
-rw-r--r--pkgs/development/libraries/getdns/default.nix4
-rw-r--r--pkgs/development/libraries/gettext/default.nix6
-rw-r--r--pkgs/development/libraries/gexiv2/default.nix6
-rw-r--r--pkgs/development/libraries/gfbgraph/default.nix6
-rw-r--r--pkgs/development/libraries/gflags/default.nix4
-rw-r--r--pkgs/development/libraries/ggz_base_libs/default.nix4
-rw-r--r--pkgs/development/libraries/giblib/default.nix6
-rw-r--r--pkgs/development/libraries/giflib/4.1.nix4
-rw-r--r--pkgs/development/libraries/giflib/default.nix12
-rw-r--r--pkgs/development/libraries/giflib/libungif.nix4
-rw-r--r--pkgs/development/libraries/gio-sharp/default.nix4
-rw-r--r--pkgs/development/libraries/git2/default.nix10
-rw-r--r--pkgs/development/libraries/givaro/3.7.nix8
-rw-r--r--pkgs/development/libraries/givaro/3.nix8
-rw-r--r--pkgs/development/libraries/givaro/default.nix10
-rw-r--r--pkgs/development/libraries/gjs/default.nix8
-rw-r--r--pkgs/development/libraries/gl2ps/default.nix4
-rw-r--r--pkgs/development/libraries/glbinding/default.nix4
-rw-r--r--pkgs/development/libraries/gle/default.nix8
-rw-r--r--pkgs/development/libraries/glew/1.10.nix6
-rw-r--r--pkgs/development/libraries/glew/default.nix6
-rw-r--r--pkgs/development/libraries/glfw/2.x.nix6
-rw-r--r--pkgs/development/libraries/glfw/3.x.nix2
-rw-r--r--pkgs/development/libraries/glib-networking/default.nix6
-rw-r--r--pkgs/development/libraries/glib-testing/default.nix4
-rw-r--r--pkgs/development/libraries/glib/default.nix8
-rw-r--r--pkgs/development/libraries/glibc/default.nix20
-rw-r--r--pkgs/development/libraries/glibc/locales.nix6
-rw-r--r--pkgs/development/libraries/glibmm/default.nix8
-rw-r--r--pkgs/development/libraries/glm/default.nix8
-rw-r--r--pkgs/development/libraries/globalarrays/default.nix4
-rw-r--r--pkgs/development/libraries/globalplatform/default.nix4
-rw-r--r--pkgs/development/libraries/globalplatform/gppcscconnectionplugin.nix4
-rw-r--r--pkgs/development/libraries/glog/default.nix2
-rw-r--r--pkgs/development/libraries/gloox/default.nix4
-rw-r--r--pkgs/development/libraries/glpk/default.nix8
-rw-r--r--pkgs/development/libraries/glui/default.nix4
-rw-r--r--pkgs/development/libraries/gmime/2.nix4
-rw-r--r--pkgs/development/libraries/gmime/3.nix4
-rw-r--r--pkgs/development/libraries/gmm/default.nix4
-rw-r--r--pkgs/development/libraries/gmp/4.3.2.nix10
-rw-r--r--pkgs/development/libraries/gmp/5.1.x.nix10
-rw-r--r--pkgs/development/libraries/gmp/6.x.nix10
-rw-r--r--pkgs/development/libraries/gmtk/default.nix4
-rw-r--r--pkgs/development/libraries/gnet/default.nix4
-rw-r--r--pkgs/development/libraries/gnome-menus/default.nix6
-rw-r--r--pkgs/development/libraries/gnome-online-accounts/default.nix4
-rw-r--r--pkgs/development/libraries/gnome-sharp/default.nix2
-rw-r--r--pkgs/development/libraries/gnome-video-effects/default.nix6
-rw-r--r--pkgs/development/libraries/gnu-config/default.nix4
-rw-r--r--pkgs/development/libraries/gnu-efi/default.nix6
-rw-r--r--pkgs/development/libraries/gobject-introspection/default.nix12
-rw-r--r--pkgs/development/libraries/goffice/default.nix8
-rw-r--r--pkgs/development/libraries/gom/default.nix6
-rw-r--r--pkgs/development/libraries/goocanvas/2.x.nix4
-rw-r--r--pkgs/development/libraries/goocanvas/default.nix8
-rw-r--r--pkgs/development/libraries/goocanvasmm/default.nix6
-rw-r--r--pkgs/development/libraries/google-cloud-cpp/default.nix4
-rw-r--r--pkgs/development/libraries/gpgme/default.nix2
-rw-r--r--pkgs/development/libraries/grail/default.nix10
-rw-r--r--pkgs/development/libraries/grantlee/default.nix4
-rw-r--r--pkgs/development/libraries/graphene-hardened-malloc/default.nix4
-rw-r--r--pkgs/development/libraries/graphene/default.nix4
-rw-r--r--pkgs/development/libraries/grib-api/default.nix10
-rw-r--r--pkgs/development/libraries/grilo-plugins/default.nix8
-rw-r--r--pkgs/development/libraries/grilo/default.nix6
-rw-r--r--pkgs/development/libraries/grpc/default.nix8
-rw-r--r--pkgs/development/libraries/gsasl/default.nix8
-rw-r--r--pkgs/development/libraries/gsettings-desktop-schemas/default.nix6
-rw-r--r--pkgs/development/libraries/gsettings-qt/default.nix4
-rw-r--r--pkgs/development/libraries/gsignond/default.nix4
-rw-r--r--pkgs/development/libraries/gsignond/plugins/lastfm.nix4
-rw-r--r--pkgs/development/libraries/gsignond/plugins/mail.nix4
-rw-r--r--pkgs/development/libraries/gsignond/plugins/oauth.nix4
-rw-r--r--pkgs/development/libraries/gsignond/plugins/sasl.nix4
-rw-r--r--pkgs/development/libraries/gsl/default.nix8
-rw-r--r--pkgs/development/libraries/gsl/gsl-1_16.nix8
-rw-r--r--pkgs/development/libraries/gsm/default.nix6
-rw-r--r--pkgs/development/libraries/gsmlib/default.nix4
-rw-r--r--pkgs/development/libraries/gsoap/default.nix4
-rw-r--r--pkgs/development/libraries/gsound/default.nix6
-rw-r--r--pkgs/development/libraries/gspell/default.nix6
-rw-r--r--pkgs/development/libraries/gss/default.nix8
-rw-r--r--pkgs/development/libraries/gssdp/default.nix6
-rw-r--r--pkgs/development/libraries/gstreamer/bad/default.nix6
-rw-r--r--pkgs/development/libraries/gstreamer/devtools/default.nix4
-rw-r--r--pkgs/development/libraries/gstreamer/ges/default.nix4
-rw-r--r--pkgs/development/libraries/gstreamer/good/default.nix6
-rw-r--r--pkgs/development/libraries/gstreamer/gstreamermm/default.nix6
-rw-r--r--pkgs/development/libraries/gstreamer/rtsp-server/default.nix4
-rw-r--r--pkgs/development/libraries/gstreamer/vaapi/default.nix4
-rw-r--r--pkgs/development/libraries/gtdialog/default.nix8
-rw-r--r--pkgs/development/libraries/gtest/default.nix4
-rw-r--r--pkgs/development/libraries/gthree/default.nix4
-rw-r--r--pkgs/development/libraries/gtk-engine-bluecurve/default.nix8
-rw-r--r--pkgs/development/libraries/gtk-engine-murrine/default.nix8
-rw-r--r--pkgs/development/libraries/gtk-engines/default.nix6
-rw-r--r--pkgs/development/libraries/gtk-layer-shell/default.nix4
-rw-r--r--pkgs/development/libraries/gtk-mac-integration/default.nix4
-rw-r--r--pkgs/development/libraries/gtk-sharp-beans/default.nix4
-rw-r--r--pkgs/development/libraries/gtk-sharp/2.0.nix2
-rw-r--r--pkgs/development/libraries/gtk-sharp/3.0.nix6
-rw-r--r--pkgs/development/libraries/gtk/2.x.nix4
-rw-r--r--pkgs/development/libraries/gtk/3.x.nix6
-rw-r--r--pkgs/development/libraries/gtkd/default.nix4
-rw-r--r--pkgs/development/libraries/gtkdatabox/default.nix6
-rw-r--r--pkgs/development/libraries/gtkimageview/default.nix6
-rw-r--r--pkgs/development/libraries/gtkmathview/default.nix6
-rw-r--r--pkgs/development/libraries/gtkmm/2.x.nix8
-rw-r--r--pkgs/development/libraries/gtkmm/3.x.nix6
-rw-r--r--pkgs/development/libraries/gtksourceview/3.x.nix6
-rw-r--r--pkgs/development/libraries/gtksourceview/4.x.nix6
-rw-r--r--pkgs/development/libraries/gtksourceviewmm/4.x.nix6
-rw-r--r--pkgs/development/libraries/gtksourceviewmm/default.nix6
-rw-r--r--pkgs/development/libraries/gtkspell/3.nix4
-rw-r--r--pkgs/development/libraries/gtkspell/default.nix4
-rw-r--r--pkgs/development/libraries/gtkspellmm/default.nix4
-rw-r--r--pkgs/development/libraries/gts/default.nix10
-rw-r--r--pkgs/development/libraries/gumbo/default.nix4
-rw-r--r--pkgs/development/libraries/gupnp-av/default.nix6
-rw-r--r--pkgs/development/libraries/gupnp-dlna/default.nix6
-rw-r--r--pkgs/development/libraries/gupnp-igd/default.nix6
-rw-r--r--pkgs/development/libraries/gupnp/default.nix6
-rw-r--r--pkgs/development/libraries/gusb/default.nix4
-rw-r--r--pkgs/development/libraries/gvfs/default.nix12
-rw-r--r--pkgs/development/libraries/half/default.nix4
-rw-r--r--pkgs/development/libraries/hamlib/default.nix8
-rw-r--r--pkgs/development/libraries/harfbuzz/default.nix10
-rw-r--r--pkgs/development/libraries/hawknl/default.nix6
-rw-r--r--pkgs/development/libraries/hdf5-blosc/default.nix4
-rw-r--r--pkgs/development/libraries/hidapi/default.nix8
-rw-r--r--pkgs/development/libraries/highfive/default.nix6
-rw-r--r--pkgs/development/libraries/hiredis/default.nix4
-rw-r--r--pkgs/development/libraries/hivex/default.nix6
-rw-r--r--pkgs/development/libraries/hotpatch/default.nix4
-rw-r--r--pkgs/development/libraries/howard-hinnant-date/default.nix4
-rw-r--r--pkgs/development/libraries/hpx/default.nix8
-rw-r--r--pkgs/development/libraries/hspell/default.nix4
-rw-r--r--pkgs/development/libraries/htmlcxx/default.nix4
-rw-r--r--pkgs/development/libraries/http-parser/default.nix4
-rw-r--r--pkgs/development/libraries/hunspell/default.nix6
-rw-r--r--pkgs/development/libraries/hunspell/dictionaries.nix34
-rw-r--r--pkgs/development/libraries/hwloc/default.nix6
-rw-r--r--pkgs/development/libraries/hyena/default.nix6
-rw-r--r--pkgs/development/libraries/hyperscan/default.nix8
-rw-r--r--pkgs/development/libraries/hyphen/default.nix4
-rw-r--r--pkgs/development/libraries/icu/base.nix12
-rw-r--r--pkgs/development/libraries/id3lib/default.nix4
-rw-r--r--pkgs/development/libraries/idnkit/default.nix4
-rw-r--r--pkgs/development/libraries/ijs/default.nix4
-rw-r--r--pkgs/development/libraries/iksemel/default.nix4
-rw-r--r--pkgs/development/libraries/ilbc/default.nix4
-rw-r--r--pkgs/development/libraries/ilixi/default.nix4
-rw-r--r--pkgs/development/libraries/ilmbase/default.nix4
-rw-r--r--pkgs/development/libraries/iml/default.nix8
-rw-r--r--pkgs/development/libraries/imlib/default.nix4
-rw-r--r--pkgs/development/libraries/imlib2/default.nix6
-rw-r--r--pkgs/development/libraries/impy/default.nix4
-rw-r--r--pkgs/development/libraries/inchi/default.nix4
-rw-r--r--pkgs/development/libraries/incrtcl/default.nix6
-rw-r--r--pkgs/development/libraries/indicator-application/gtk3.nix4
-rw-r--r--pkgs/development/libraries/indilib/default.nix4
-rw-r--r--pkgs/development/libraries/inih/default.nix4
-rw-r--r--pkgs/development/libraries/iniparser/default.nix6
-rw-r--r--pkgs/development/libraries/intel-gmmlib/default.nix4
-rw-r--r--pkgs/development/libraries/intel-media-driver/default.nix10
-rw-r--r--pkgs/development/libraries/intel-media-sdk/default.nix4
-rw-r--r--pkgs/development/libraries/ip2location-c/default.nix4
-rw-r--r--pkgs/development/libraries/irrlicht/default.nix6
-rw-r--r--pkgs/development/libraries/irrlicht/mac.nix6
-rw-r--r--pkgs/development/libraries/isl/0.11.1.nix6
-rw-r--r--pkgs/development/libraries/isl/0.14.1.nix6
-rw-r--r--pkgs/development/libraries/isl/0.17.1.nix6
-rw-r--r--pkgs/development/libraries/isl/0.20.0.nix6
-rw-r--r--pkgs/development/libraries/iso-codes/default.nix4
-rw-r--r--pkgs/development/libraries/itk/4.x.nix10
-rw-r--r--pkgs/development/libraries/itk/default.nix8
-rw-r--r--pkgs/development/libraries/itktcl/default.nix6
-rw-r--r--pkgs/development/libraries/jama/default.nix4
-rw-r--r--pkgs/development/libraries/jansson/default.nix4
-rw-r--r--pkgs/development/libraries/java/commons/bcel/default.nix8
-rw-r--r--pkgs/development/libraries/java/commons/bsf/default.nix6
-rw-r--r--pkgs/development/libraries/java/commons/compress/default.nix8
-rw-r--r--pkgs/development/libraries/java/commons/fileupload/default.nix8
-rw-r--r--pkgs/development/libraries/java/commons/io/default.nix8
-rw-r--r--pkgs/development/libraries/java/commons/lang/default.nix8
-rw-r--r--pkgs/development/libraries/java/commons/logging/default.nix6
-rw-r--r--pkgs/development/libraries/java/commons/math/default.nix8
-rw-r--r--pkgs/development/libraries/java/cup/default.nix8
-rw-r--r--pkgs/development/libraries/java/dbus-java/default.nix4
-rw-r--r--pkgs/development/libraries/java/geoipjava/default.nix8
-rw-r--r--pkgs/development/libraries/java/gwt-dragdrop/default.nix4
-rw-r--r--pkgs/development/libraries/java/gwt-widgets/default.nix4
-rw-r--r--pkgs/development/libraries/java/hsqldb/default.nix6
-rw-r--r--pkgs/development/libraries/java/httpunit/default.nix4
-rw-r--r--pkgs/development/libraries/java/hydra-ant-logger/default.nix4
-rw-r--r--pkgs/development/libraries/java/jdom/default.nix4
-rw-r--r--pkgs/development/libraries/java/jflex/default.nix6
-rw-r--r--pkgs/development/libraries/java/junit/default.nix4
-rw-r--r--pkgs/development/libraries/java/junixsocket/default.nix8
-rw-r--r--pkgs/development/libraries/java/libmatthew-java/default.nix4
-rw-r--r--pkgs/development/libraries/java/lombok/default.nix8
-rw-r--r--pkgs/development/libraries/java/lucene/default.nix4
-rw-r--r--pkgs/development/libraries/java/mockobjects/default.nix4
-rw-r--r--pkgs/development/libraries/java/rhino/default.nix4
-rw-r--r--pkgs/development/libraries/java/saxon/default.nix8
-rw-r--r--pkgs/development/libraries/java/smack/default.nix6
-rw-r--r--pkgs/development/libraries/java/swt/default.nix2
-rw-r--r--pkgs/development/libraries/jbig2dec/default.nix6
-rw-r--r--pkgs/development/libraries/jbigkit/default.nix8
-rw-r--r--pkgs/development/libraries/jcal/default.nix4
-rw-r--r--pkgs/development/libraries/jemalloc/common.nix6
-rw-r--r--pkgs/development/libraries/jitterentropy/default.nix8
-rw-r--r--pkgs/development/libraries/json-c/default.nix4
-rw-r--r--pkgs/development/libraries/json-glib/default.nix8
-rw-r--r--pkgs/development/libraries/jsoncpp/default.nix4
-rw-r--r--pkgs/development/libraries/jsonrpc-glib/default.nix6
-rw-r--r--pkgs/development/libraries/judy/default.nix8
-rw-r--r--pkgs/development/libraries/jxrlib/default.nix6
-rw-r--r--pkgs/development/libraries/kerberos/heimdal.nix4
-rw-r--r--pkgs/development/libraries/kerberos/krb5.nix4
-rw-r--r--pkgs/development/libraries/keybinder/default.nix4
-rw-r--r--pkgs/development/libraries/keybinder3/default.nix4
-rw-r--r--pkgs/development/libraries/keystone/default.nix4
-rw-r--r--pkgs/development/libraries/khronos-ocl-icd-loader/default.nix6
-rw-r--r--pkgs/development/libraries/kissfft/default.nix4
-rw-r--r--pkgs/development/libraries/kmsxx/default.nix6
-rw-r--r--pkgs/development/libraries/kpmcore/default.nix2
-rw-r--r--pkgs/development/libraries/kyotocabinet/default.nix6
-rw-r--r--pkgs/development/libraries/l-smash/default.nix4
-rw-r--r--pkgs/development/libraries/lame/default.nix4
-rw-r--r--pkgs/development/libraries/languagemachines/frog.nix4
-rw-r--r--pkgs/development/libraries/languagemachines/frogdata.nix4
-rw-r--r--pkgs/development/libraries/languagemachines/libfolia.nix4
-rw-r--r--pkgs/development/libraries/languagemachines/mbt.nix4
-rw-r--r--pkgs/development/libraries/languagemachines/ticcutils.nix4
-rw-r--r--pkgs/development/libraries/languagemachines/timbl.nix4
-rw-r--r--pkgs/development/libraries/languagemachines/timblserver.nix4
-rw-r--r--pkgs/development/libraries/languagemachines/ucto.nix4
-rw-r--r--pkgs/development/libraries/languagemachines/uctodata.nix4
-rw-r--r--pkgs/development/libraries/lasem/default.nix8
-rw-r--r--pkgs/development/libraries/lasso/default.nix4
-rw-r--r--pkgs/development/libraries/lcms/default.nix6
-rw-r--r--pkgs/development/libraries/lcms2/default.nix4
-rw-r--r--pkgs/development/libraries/ldacbt/default.nix4
-rw-r--r--pkgs/development/libraries/ldb/default.nix4
-rw-r--r--pkgs/development/libraries/ldns/default.nix6
-rw-r--r--pkgs/development/libraries/leatherman/default.nix4
-rw-r--r--pkgs/development/libraries/lensfun/default.nix6
-rw-r--r--pkgs/development/libraries/leptonica/default.nix6
-rw-r--r--pkgs/development/libraries/lesstif/default.nix4
-rw-r--r--pkgs/development/libraries/leveldb/default.nix6
-rw-r--r--pkgs/development/libraries/levmar/default.nix6
-rw-r--r--pkgs/development/libraries/lib3ds/default.nix4
-rw-r--r--pkgs/development/libraries/lib3mf/default.nix4
-rw-r--r--pkgs/development/libraries/libAfterImage/default.nix4
-rw-r--r--pkgs/development/libraries/libHX/default.nix4
-rw-r--r--pkgs/development/libraries/libLAS/default.nix12
-rw-r--r--pkgs/development/libraries/libaacs/default.nix4
-rw-r--r--pkgs/development/libraries/libaal/default.nix8
-rw-r--r--pkgs/development/libraries/libabigail/default.nix4
-rw-r--r--pkgs/development/libraries/libabw/default.nix4
-rw-r--r--pkgs/development/libraries/libaccounts-glib/default.nix4
-rw-r--r--pkgs/development/libraries/libaec/default.nix4
-rw-r--r--pkgs/development/libraries/libagar/default.nix4
-rw-r--r--pkgs/development/libraries/libagar/libagar_test.nix4
-rw-r--r--pkgs/development/libraries/libamqpcpp/default.nix4
-rw-r--r--pkgs/development/libraries/libantlr3c/default.nix6
-rw-r--r--pkgs/development/libraries/libao/default.nix2
-rw-r--r--pkgs/development/libraries/libaom/default.nix4
-rw-r--r--pkgs/development/libraries/libaosd/default.nix4
-rw-r--r--pkgs/development/libraries/libarchive/default.nix18
-rw-r--r--pkgs/development/libraries/libargon2/default.nix4
-rw-r--r--pkgs/development/libraries/libasr/default.nix4
-rw-r--r--pkgs/development/libraries/libass/default.nix4
-rw-r--r--pkgs/development/libraries/libassuan/default.nix4
-rw-r--r--pkgs/development/libraries/libast/default.nix4
-rw-r--r--pkgs/development/libraries/libasyncns/default.nix6
-rw-r--r--pkgs/development/libraries/libatomic_ops/default.nix12
-rw-r--r--pkgs/development/libraries/libaudclient/default.nix4
-rw-r--r--pkgs/development/libraries/libav/default.nix8
-rw-r--r--pkgs/development/libraries/libavc1394/default.nix6
-rw-r--r--pkgs/development/libraries/libavif/default.nix4
-rw-r--r--pkgs/development/libraries/libayatana-appindicator/default.nix2
-rw-r--r--pkgs/development/libraries/libayatana-indicator/default.nix2
-rw-r--r--pkgs/development/libraries/libb2/default.nix6
-rw-r--r--pkgs/development/libraries/libb64/default.nix6
-rw-r--r--pkgs/development/libraries/libbacktrace/default.nix4
-rw-r--r--pkgs/development/libraries/libbap/default.nix4
-rw-r--r--pkgs/development/libraries/libbdplus/default.nix4
-rw-r--r--pkgs/development/libraries/libbfd/default.nix4
-rw-r--r--pkgs/development/libraries/libblockdev/default.nix6
-rw-r--r--pkgs/development/libraries/libblocksruntime/default.nix4
-rw-r--r--pkgs/development/libraries/libbluedevil/default.nix6
-rw-r--r--pkgs/development/libraries/libbluray/default.nix8
-rw-r--r--pkgs/development/libraries/libbsd/default.nix4
-rw-r--r--pkgs/development/libraries/libbson/default.nix4
-rw-r--r--pkgs/development/libraries/libburn/default.nix4
-rw-r--r--pkgs/development/libraries/libbytesize/default.nix4
-rw-r--r--pkgs/development/libraries/libcaca/default.nix10
-rw-r--r--pkgs/development/libraries/libcacard/default.nix4
-rw-r--r--pkgs/development/libraries/libcanberra/default.nix6
-rw-r--r--pkgs/development/libraries/libcangjie/default.nix8
-rw-r--r--pkgs/development/libraries/libcbor/default.nix4
-rw-r--r--pkgs/development/libraries/libcdaudio/default.nix6
-rw-r--r--pkgs/development/libraries/libcddb/default.nix8
-rw-r--r--pkgs/development/libraries/libcdio-paranoia/default.nix10
-rw-r--r--pkgs/development/libraries/libcdio/default.nix6
-rw-r--r--pkgs/development/libraries/libcdr/default.nix6
-rw-r--r--pkgs/development/libraries/libcec/default.nix8
-rw-r--r--pkgs/development/libraries/libcec/platform.nix6
-rw-r--r--pkgs/development/libraries/libcef/default.nix6
-rw-r--r--pkgs/development/libraries/libcello/default.nix8
-rw-r--r--pkgs/development/libraries/libchamplain/default.nix6
-rw-r--r--pkgs/development/libraries/libchardet/default.nix4
-rw-r--r--pkgs/development/libraries/libchewing/default.nix4
-rw-r--r--pkgs/development/libraries/libchop/default.nix4
-rw-r--r--pkgs/development/libraries/libck/default.nix4
-rw-r--r--pkgs/development/libraries/libclc/default.nix4
-rw-r--r--pkgs/development/libraries/libcli/default.nix4
-rw-r--r--pkgs/development/libraries/libcloudproviders/default.nix4
-rw-r--r--pkgs/development/libraries/libclthreads/default.nix4
-rw-r--r--pkgs/development/libraries/libclxclient/default.nix4
-rw-r--r--pkgs/development/libraries/libcmis/default.nix4
-rw-r--r--pkgs/development/libraries/libco-canonical/default.nix4
-rw-r--r--pkgs/development/libraries/libcollectdclient/default.nix6
-rw-r--r--pkgs/development/libraries/libcommuni/default.nix4
-rw-r--r--pkgs/development/libraries/libconfig/default.nix4
-rw-r--r--pkgs/development/libraries/libconfuse/default.nix4
-rw-r--r--pkgs/development/libraries/libcouchbase/default.nix4
-rw-r--r--pkgs/development/libraries/libcrafter/default.nix8
-rw-r--r--pkgs/development/libraries/libcredis/default.nix4
-rw-r--r--pkgs/development/libraries/libcrossguid/default.nix4
-rw-r--r--pkgs/development/libraries/libcryptui/default.nix6
-rw-r--r--pkgs/development/libraries/libcsptr/default.nix4
-rw-r--r--pkgs/development/libraries/libctb/default.nix4
-rw-r--r--pkgs/development/libraries/libctemplate/default.nix4
-rw-r--r--pkgs/development/libraries/libcue/default.nix4
-rw-r--r--pkgs/development/libraries/libcutl/default.nix4
-rw-r--r--pkgs/development/libraries/libdaemon/default.nix8
-rw-r--r--pkgs/development/libraries/libdap/default.nix4
-rw-r--r--pkgs/development/libraries/libdatrie/default.nix6
-rw-r--r--pkgs/development/libraries/libdazzle/default.nix6
-rw-r--r--pkgs/development/libraries/libdbi-drivers/default.nix4
-rw-r--r--pkgs/development/libraries/libdbi/default.nix4
-rw-r--r--pkgs/development/libraries/libdbusmenu-qt/default.nix4
-rw-r--r--pkgs/development/libraries/libdbusmenu-qt/qt-5.5.nix4
-rw-r--r--pkgs/development/libraries/libdc1394/default.nix8
-rw-r--r--pkgs/development/libraries/libde265/default.nix8
-rw-r--r--pkgs/development/libraries/libdevil/default.nix8
-rw-r--r--pkgs/development/libraries/libdigidoc/default.nix8
-rw-r--r--pkgs/development/libraries/libdigidocpp/default.nix4
-rw-r--r--pkgs/development/libraries/libdiscid/default.nix8
-rw-r--r--pkgs/development/libraries/libdivecomputer/default.nix4
-rw-r--r--pkgs/development/libraries/libdivsufsort/default.nix6
-rw-r--r--pkgs/development/libraries/libdmtx/default.nix6
-rw-r--r--pkgs/development/libraries/libdnet/default.nix8
-rw-r--r--pkgs/development/libraries/libdv/default.nix6
-rw-r--r--pkgs/development/libraries/libdvbpsi/default.nix6
-rw-r--r--pkgs/development/libraries/libdvdcss/default.nix6
-rw-r--r--pkgs/development/libraries/libdvdnav/4.2.1.nix8
-rw-r--r--pkgs/development/libraries/libdvdnav/default.nix8
-rw-r--r--pkgs/development/libraries/libdvdread/4.9.9.nix8
-rw-r--r--pkgs/development/libraries/libdvdread/default.nix8
-rw-r--r--pkgs/development/libraries/libdwarf/default.nix6
-rw-r--r--pkgs/development/libraries/libdwg/default.nix8
-rw-r--r--pkgs/development/libraries/libdynd/default.nix4
-rw-r--r--pkgs/development/libraries/libe-book/default.nix8
-rw-r--r--pkgs/development/libraries/libe57format/default.nix4
-rw-r--r--pkgs/development/libraries/libeatmydata/default.nix6
-rw-r--r--pkgs/development/libraries/libeb/default.nix4
-rw-r--r--pkgs/development/libraries/libebml/default.nix4
-rw-r--r--pkgs/development/libraries/libebur128/default.nix4
-rw-r--r--pkgs/development/libraries/libechonest/default.nix6
-rw-r--r--pkgs/development/libraries/libedit/default.nix4
-rw-r--r--pkgs/development/libraries/libee/default.nix6
-rw-r--r--pkgs/development/libraries/libelf-freebsd/default.nix6
-rw-r--r--pkgs/development/libraries/libelf/default.nix12
-rw-r--r--pkgs/development/libraries/libelfin/default.nix4
-rw-r--r--pkgs/development/libraries/libepc/default.nix6
-rw-r--r--pkgs/development/libraries/liberfa/default.nix4
-rw-r--r--pkgs/development/libraries/liberio/default.nix4
-rw-r--r--pkgs/development/libraries/libesmtp/default.nix4
-rw-r--r--pkgs/development/libraries/libestr/default.nix4
-rw-r--r--pkgs/development/libraries/libev/default.nix10
-rw-r--r--pkgs/development/libraries/libevdev/default.nix4
-rw-r--r--pkgs/development/libraries/libevdevplus/default.nix4
-rw-r--r--pkgs/development/libraries/libevent/default.nix16
-rw-r--r--pkgs/development/libraries/libewf/default.nix8
-rw-r--r--pkgs/development/libraries/libexecinfo/default.nix12
-rw-r--r--pkgs/development/libraries/libexif/default.nix4
-rw-r--r--pkgs/development/libraries/libextractor/default.nix16
-rw-r--r--pkgs/development/libraries/libexttextcat/default.nix4
-rw-r--r--pkgs/development/libraries/libf2c/default.nix6
-rw-r--r--pkgs/development/libraries/libfakekey/default.nix4
-rw-r--r--pkgs/development/libraries/libfaketime/default.nix8
-rw-r--r--pkgs/development/libraries/libff/default.nix6
-rw-r--r--pkgs/development/libraries/libffcall/default.nix4
-rw-r--r--pkgs/development/libraries/libffi/default.nix4
-rw-r--r--pkgs/development/libraries/libfido2/default.nix6
-rw-r--r--pkgs/development/libraries/libfilezilla/default.nix6
-rw-r--r--pkgs/development/libraries/libfishsound/default.nix4
-rw-r--r--pkgs/development/libraries/libfixposix/default.nix4
-rw-r--r--pkgs/development/libraries/libfm/default.nix6
-rw-r--r--pkgs/development/libraries/libfprint/default.nix4
-rw-r--r--pkgs/development/libraries/libfpx/default.nix6
-rw-r--r--pkgs/development/libraries/libfreefare/default.nix6
-rw-r--r--pkgs/development/libraries/libfsm/default.nix4
-rw-r--r--pkgs/development/libraries/libftdi/1.x.nix10
-rw-r--r--pkgs/development/libraries/libfyaml/default.nix4
-rw-r--r--pkgs/development/libraries/libgadu/default.nix6
-rw-r--r--pkgs/development/libraries/libgaminggear/default.nix6
-rw-r--r--pkgs/development/libraries/libgcrypt/1.5.nix6
-rw-r--r--pkgs/development/libraries/libgcrypt/default.nix16
-rw-r--r--pkgs/development/libraries/libgda/default.nix10
-rw-r--r--pkgs/development/libraries/libgdamm/default.nix6
-rw-r--r--pkgs/development/libraries/libgdata/default.nix6
-rw-r--r--pkgs/development/libraries/libgdiplus/default.nix10
-rw-r--r--pkgs/development/libraries/libgee/default.nix6
-rw-r--r--pkgs/development/libraries/libgeotiff/default.nix8
-rw-r--r--pkgs/development/libraries/libgepub/default.nix6
-rw-r--r--pkgs/development/libraries/libgig/default.nix4
-rw-r--r--pkgs/development/libraries/libgit2-glib/default.nix6
-rw-r--r--pkgs/development/libraries/libgksu/default.nix8
-rw-r--r--pkgs/development/libraries/libglvnd/default.nix4
-rw-r--r--pkgs/development/libraries/libgnome-keyring/default.nix6
-rw-r--r--pkgs/development/libraries/libgnomekbd/default.nix6
-rw-r--r--pkgs/development/libraries/libgnurl/default.nix4
-rw-r--r--pkgs/development/libraries/libgpg-error/default.nix2
-rw-r--r--pkgs/development/libraries/libgphoto2/default.nix8
-rw-r--r--pkgs/development/libraries/libgpod/default.nix2
-rw-r--r--pkgs/development/libraries/libgringotts/default.nix4
-rw-r--r--pkgs/development/libraries/libgroove/default.nix4
-rw-r--r--pkgs/development/libraries/libgrss/default.nix6
-rw-r--r--pkgs/development/libraries/libgsf/default.nix8
-rw-r--r--pkgs/development/libraries/libgssglue/default.nix4
-rw-r--r--pkgs/development/libraries/libgtop/default.nix6
-rw-r--r--pkgs/development/libraries/libgudev/default.nix6
-rw-r--r--pkgs/development/libraries/libguestfs/default.nix12
-rw-r--r--pkgs/development/libraries/libgumath/default.nix4
-rw-r--r--pkgs/development/libraries/libgweather/default.nix6
-rw-r--r--pkgs/development/libraries/libgxps/default.nix6
-rw-r--r--pkgs/development/libraries/libhandy/0.x.nix4
-rw-r--r--pkgs/development/libraries/libhandy/default.nix6
-rw-r--r--pkgs/development/libraries/libhangul/default.nix4
-rw-r--r--pkgs/development/libraries/libharu/default.nix8
-rw-r--r--pkgs/development/libraries/libhdhomerun/default.nix6
-rw-r--r--pkgs/development/libraries/libheif/default.nix8
-rw-r--r--pkgs/development/libraries/libhttpseverywhere/default.nix6
-rw-r--r--pkgs/development/libraries/libiberty/default.nix8
-rw-r--r--pkgs/development/libraries/libibmad/default.nix4
-rw-r--r--pkgs/development/libraries/libibumad/default.nix4
-rw-r--r--pkgs/development/libraries/libical/default.nix2
-rw-r--r--pkgs/development/libraries/libicns/default.nix4
-rw-r--r--pkgs/development/libraries/libid3tag/default.nix4
-rw-r--r--pkgs/development/libraries/libidn/default.nix8
-rw-r--r--pkgs/development/libraries/libidn2/default.nix10
-rw-r--r--pkgs/development/libraries/libiec61883/default.nix4
-rw-r--r--pkgs/development/libraries/libieee1284/default.nix4
-rw-r--r--pkgs/development/libraries/libiio/default.nix2
-rw-r--r--pkgs/development/libraries/libimagequant/default.nix4
-rw-r--r--pkgs/development/libraries/libime/default.nix4
-rw-r--r--pkgs/development/libraries/libimobiledevice/default.nix4
-rw-r--r--pkgs/development/libraries/libinfinity/default.nix14
-rw-r--r--pkgs/development/libraries/libinjection/default.nix4
-rw-r--r--pkgs/development/libraries/libinklevel/default.nix4
-rw-r--r--pkgs/development/libraries/libinotify-kqueue/default.nix4
-rw-r--r--pkgs/development/libraries/libinput/default.nix6
-rw-r--r--pkgs/development/libraries/libiodbc/default.nix8
-rw-r--r--pkgs/development/libraries/libipfix/default.nix4
-rw-r--r--pkgs/development/libraries/libipt/default.nix4
-rw-r--r--pkgs/development/libraries/libiptcdata/default.nix6
-rw-r--r--pkgs/development/libraries/libircclient/default.nix4
-rw-r--r--pkgs/development/libraries/libirecovery/default.nix4
-rw-r--r--pkgs/development/libraries/libiscsi/default.nix4
-rw-r--r--pkgs/development/libraries/libisds/default.nix4
-rw-r--r--pkgs/development/libraries/libisoburn/default.nix4
-rw-r--r--pkgs/development/libraries/libisofs/default.nix4
-rw-r--r--pkgs/development/libraries/libite/default.nix4
-rw-r--r--pkgs/development/libraries/libivykis/default.nix4
-rw-r--r--pkgs/development/libraries/libixp-hg/default.nix8
-rw-r--r--pkgs/development/libraries/libjcat/default.nix4
-rw-r--r--pkgs/development/libraries/libjpeg-turbo/default.nix6
-rw-r--r--pkgs/development/libraries/libjpeg/default.nix8
-rw-r--r--pkgs/development/libraries/libjreen/default.nix6
-rw-r--r--pkgs/development/libraries/libjson-rpc-cpp/default.nix6
-rw-r--r--pkgs/development/libraries/libjson/default.nix4
-rw-r--r--pkgs/development/libraries/libkate/default.nix4
-rw-r--r--pkgs/development/libraries/libkeyfinder/default.nix4
-rw-r--r--pkgs/development/libraries/libkml/default.nix6
-rw-r--r--pkgs/development/libraries/libksba/default.nix4
-rw-r--r--pkgs/development/libraries/libksi/default.nix4
-rw-r--r--pkgs/development/libraries/libktorrent/default.nix4
-rw-r--r--pkgs/development/libraries/liblangtag/default.nix8
-rw-r--r--pkgs/development/libraries/liblastfm/default.nix6
-rw-r--r--pkgs/development/libraries/liblastfmSF/default.nix4
-rw-r--r--pkgs/development/libraries/liblaxjson/default.nix4
-rw-r--r--pkgs/development/libraries/liblcf/default.nix4
-rw-r--r--pkgs/development/libraries/liblinear/default.nix6
-rw-r--r--pkgs/development/libraries/liblinphone/default.nix4
-rw-r--r--pkgs/development/libraries/liblo/default.nix8
-rw-r--r--pkgs/development/libraries/liblockfile/default.nix8
-rw-r--r--pkgs/development/libraries/liblogging/default.nix4
-rw-r--r--pkgs/development/libraries/liblognorm/default.nix4
-rw-r--r--pkgs/development/libraries/liblouis/default.nix4
-rw-r--r--pkgs/development/libraries/liblqr-1/default.nix4
-rw-r--r--pkgs/development/libraries/liblscp/default.nix4
-rw-r--r--pkgs/development/libraries/libltc/default.nix4
-rw-r--r--pkgs/development/libraries/liblxi/default.nix4
-rw-r--r--pkgs/development/libraries/libmad/default.nix6
-rw-r--r--pkgs/development/libraries/libmanette/default.nix6
-rw-r--r--pkgs/development/libraries/libmatchbox/default.nix6
-rw-r--r--pkgs/development/libraries/libmatheval/default.nix8
-rw-r--r--pkgs/development/libraries/libmatroska/default.nix4
-rw-r--r--pkgs/development/libraries/libmaxminddb/default.nix4
-rw-r--r--pkgs/development/libraries/libmbim/default.nix4
-rw-r--r--pkgs/development/libraries/libmcrypt/default.nix4
-rw-r--r--pkgs/development/libraries/libmd/default.nix4
-rw-r--r--pkgs/development/libraries/libmediaart/default.nix6
-rw-r--r--pkgs/development/libraries/libmediainfo/default.nix4
-rw-r--r--pkgs/development/libraries/libmemcached/default.nix10
-rw-r--r--pkgs/development/libraries/libmesode/default.nix4
-rw-r--r--pkgs/development/libraries/libmhash/default.nix4
-rw-r--r--pkgs/development/libraries/libmicrodns/default.nix4
-rw-r--r--pkgs/development/libraries/libmicrohttpd/generic.nix4
-rw-r--r--pkgs/development/libraries/libmikmod/default.nix6
-rw-r--r--pkgs/development/libraries/libmilter/default.nix4
-rw-r--r--pkgs/development/libraries/libminc/default.nix4
-rw-r--r--pkgs/development/libraries/libmkv/default.nix8
-rw-r--r--pkgs/development/libraries/libmms/default.nix4
-rw-r--r--pkgs/development/libraries/libmng/default.nix4
-rw-r--r--pkgs/development/libraries/libmnl/default.nix6
-rw-r--r--pkgs/development/libraries/libmodbus/default.nix4
-rw-r--r--pkgs/development/libraries/libmodplug/default.nix4
-rw-r--r--pkgs/development/libraries/libmodule/default.nix4
-rw-r--r--pkgs/development/libraries/libmodulemd/default.nix4
-rw-r--r--pkgs/development/libraries/libmongo-client/default.nix4
-rw-r--r--pkgs/development/libraries/libmowgli/default.nix4
-rw-r--r--pkgs/development/libraries/libmp3splt/default.nix4
-rw-r--r--pkgs/development/libraries/libmpack/default.nix4
-rw-r--r--pkgs/development/libraries/libmpc/default.nix6
-rw-r--r--pkgs/development/libraries/libmpcdec/default.nix6
-rw-r--r--pkgs/development/libraries/libmpeg2/default.nix10
-rw-r--r--pkgs/development/libraries/libmrss/default.nix8
-rw-r--r--pkgs/development/libraries/libmspack/default.nix6
-rw-r--r--pkgs/development/libraries/libmtp/default.nix4
-rw-r--r--pkgs/development/libraries/libmusicbrainz/5.x.nix4
-rw-r--r--pkgs/development/libraries/libmusicbrainz/default.nix4
-rw-r--r--pkgs/development/libraries/libmwaw/default.nix8
-rw-r--r--pkgs/development/libraries/libmx/default.nix4
-rw-r--r--pkgs/development/libraries/libmypaint/default.nix4
-rw-r--r--pkgs/development/libraries/libmysqlconnectorcpp/default.nix6
-rw-r--r--pkgs/development/libraries/libnabo/default.nix4
-rw-r--r--pkgs/development/libraries/libnatpmp/default.nix4
-rw-r--r--pkgs/development/libraries/libnats-c/default.nix4
-rw-r--r--pkgs/development/libraries/libnatspec/default.nix6
-rw-r--r--pkgs/development/libraries/libndctl/default.nix4
-rw-r--r--pkgs/development/libraries/libndp/default.nix4
-rw-r--r--pkgs/development/libraries/libndtypes/default.nix4
-rw-r--r--pkgs/development/libraries/libnest2d/default.nix4
-rw-r--r--pkgs/development/libraries/libnet/default.nix4
-rw-r--r--pkgs/development/libraries/libnetfilter_acct/default.nix4
-rw-r--r--pkgs/development/libraries/libnetfilter_conntrack/default.nix4
-rw-r--r--pkgs/development/libraries/libnetfilter_cthelper/default.nix6
-rw-r--r--pkgs/development/libraries/libnetfilter_cttimeout/default.nix6
-rw-r--r--pkgs/development/libraries/libnetfilter_log/default.nix4
-rw-r--r--pkgs/development/libraries/libnetfilter_queue/default.nix4
-rw-r--r--pkgs/development/libraries/libnfc/default.nix4
-rw-r--r--pkgs/development/libraries/libnfnetlink/default.nix6
-rw-r--r--pkgs/development/libraries/libnfs/default.nix6
-rw-r--r--pkgs/development/libraries/libnftnl/default.nix4
-rw-r--r--pkgs/development/libraries/libngspice/default.nix4
-rw-r--r--pkgs/development/libraries/libnice/default.nix4
-rw-r--r--pkgs/development/libraries/libnih/default.nix6
-rw-r--r--pkgs/development/libraries/libnixxml/default.nix4
-rw-r--r--pkgs/development/libraries/libnotify/default.nix6
-rw-r--r--pkgs/development/libraries/libnova/default.nix4
-rw-r--r--pkgs/development/libraries/libnsl/default.nix4
-rw-r--r--pkgs/development/libraries/libnxml/default.nix8
-rw-r--r--pkgs/development/libraries/liboauth/default.nix4
-rw-r--r--pkgs/development/libraries/libodfgen/default.nix8
-rw-r--r--pkgs/development/libraries/libofa/default.nix4
-rw-r--r--pkgs/development/libraries/libofx/default.nix6
-rw-r--r--pkgs/development/libraries/libogg/default.nix6
-rw-r--r--pkgs/development/libraries/liboggz/default.nix4
-rw-r--r--pkgs/development/libraries/liboil/default.nix8
-rw-r--r--pkgs/development/libraries/libomxil-bellagio/default.nix6
-rw-r--r--pkgs/development/libraries/liboop/default.nix4
-rw-r--r--pkgs/development/libraries/libopcodes/default.nix4
-rw-r--r--pkgs/development/libraries/libopenaptx/default.nix4
-rw-r--r--pkgs/development/libraries/liboping/default.nix4
-rw-r--r--pkgs/development/libraries/libopus/default.nix10
-rw-r--r--pkgs/development/libraries/libopusenc/default.nix4
-rw-r--r--pkgs/development/libraries/libosinfo/default.nix4
-rw-r--r--pkgs/development/libraries/libosmium/default.nix4
-rw-r--r--pkgs/development/libraries/libosmpbf/default.nix6
-rw-r--r--pkgs/development/libraries/libossp-uuid/default.nix6
-rw-r--r--pkgs/development/libraries/libotr/default.nix4
-rw-r--r--pkgs/development/libraries/libow/default.nix4
-rw-r--r--pkgs/development/libraries/libowfat/default.nix4
-rw-r--r--pkgs/development/libraries/libp11/default.nix4
-rw-r--r--pkgs/development/libraries/libpam-wrapper/default.nix6
-rw-r--r--pkgs/development/libraries/libpaper/default.nix6
-rw-r--r--pkgs/development/libraries/libpar2/default.nix8
-rw-r--r--pkgs/development/libraries/libpcap/default.nix4
-rw-r--r--pkgs/development/libraries/libpeas/default.nix6
-rw-r--r--pkgs/development/libraries/libpfm/default.nix6
-rw-r--r--pkgs/development/libraries/libpgf/default.nix8
-rw-r--r--pkgs/development/libraries/libphonenumber/default.nix4
-rw-r--r--pkgs/development/libraries/libpinyin/default.nix4
-rw-r--r--pkgs/development/libraries/libpipeline/default.nix6
-rw-r--r--pkgs/development/libraries/libplacebo/default.nix4
-rw-r--r--pkgs/development/libraries/libplist/default.nix12
-rw-r--r--pkgs/development/libraries/libpng/12.nix4
-rw-r--r--pkgs/development/libraries/libpng/default.nix6
-rw-r--r--pkgs/development/libraries/libpointmatcher/default.nix4
-rw-r--r--pkgs/development/libraries/libportal/default.nix4
-rw-r--r--pkgs/development/libraries/libproxy/default.nix8
-rw-r--r--pkgs/development/libraries/libpseudo/default.nix4
-rw-r--r--pkgs/development/libraries/libpsl/default.nix8
-rw-r--r--pkgs/development/libraries/libpst/default.nix4
-rw-r--r--pkgs/development/libraries/libqalculate/default.nix6
-rw-r--r--pkgs/development/libraries/libqb/default.nix4
-rw-r--r--pkgs/development/libraries/libqglviewer/default.nix6
-rw-r--r--pkgs/development/libraries/libqmi/default.nix4
-rw-r--r--pkgs/development/libraries/libr3/default.nix4
-rw-r--r--pkgs/development/libraries/libraspberrypi/default.nix4
-rw-r--r--pkgs/development/libraries/libraw/default.nix4
-rw-r--r--pkgs/development/libraries/libraw1394/default.nix4
-rw-r--r--pkgs/development/libraries/librdf/raptor.nix8
-rw-r--r--pkgs/development/libraries/librdf/raptor2.nix8
-rw-r--r--pkgs/development/libraries/librdf/rasqal.nix8
-rw-r--r--pkgs/development/libraries/librdf/redland.nix14
-rw-r--r--pkgs/development/libraries/libre/default.nix12
-rw-r--r--pkgs/development/libraries/librealsense/default.nix2
-rw-r--r--pkgs/development/libraries/librelp/default.nix4
-rw-r--r--pkgs/development/libraries/librem/default.nix12
-rw-r--r--pkgs/development/libraries/librep/default.nix4
-rw-r--r--pkgs/development/libraries/libresample/default.nix8
-rw-r--r--pkgs/development/libraries/librest/default.nix6
-rw-r--r--pkgs/development/libraries/librevenge/default.nix8
-rw-r--r--pkgs/development/libraries/librevisa/default.nix4
-rw-r--r--pkgs/development/libraries/librime/default.nix4
-rw-r--r--pkgs/development/libraries/libroxml/default.nix4
-rw-r--r--pkgs/development/libraries/librseq/default.nix4
-rw-r--r--pkgs/development/libraries/librsvg/default.nix8
-rw-r--r--pkgs/development/libraries/librsync/0.9.nix10
-rw-r--r--pkgs/development/libraries/librsync/default.nix4
-rw-r--r--pkgs/development/libraries/librtprocess/default.nix4
-rw-r--r--pkgs/development/libraries/libs3/default.nix4
-rw-r--r--pkgs/development/libraries/libsamplerate/default.nix6
-rw-r--r--pkgs/development/libraries/libsass/default.nix4
-rw-r--r--pkgs/development/libraries/libschrift/default.nix4
-rw-r--r--pkgs/development/libraries/libscrypt/default.nix8
-rw-r--r--pkgs/development/libraries/libsearpc/default.nix4
-rw-r--r--pkgs/development/libraries/libseccomp/default.nix4
-rw-r--r--pkgs/development/libraries/libsecret/default.nix6
-rw-r--r--pkgs/development/libraries/libserialport/default.nix8
-rw-r--r--pkgs/development/libraries/libshout/default.nix8
-rw-r--r--pkgs/development/libraries/libsieve/default.nix4
-rw-r--r--pkgs/development/libraries/libsigcxx/1.2.nix4
-rw-r--r--pkgs/development/libraries/libsigcxx/default.nix6
-rw-r--r--pkgs/development/libraries/libsignal-protocol-c/default.nix4
-rw-r--r--pkgs/development/libraries/libsignon-glib/default.nix4
-rw-r--r--pkgs/development/libraries/libsigsegv/default.nix6
-rw-r--r--pkgs/development/libraries/libsixel/default.nix4
-rw-r--r--pkgs/development/libraries/libskk/default.nix8
-rw-r--r--pkgs/development/libraries/libslirp/default.nix4
-rw-r--r--pkgs/development/libraries/libsmartcols/default.nix8
-rw-r--r--pkgs/development/libraries/libsmi/default.nix6
-rw-r--r--pkgs/development/libraries/libsnark/default.nix6
-rw-r--r--pkgs/development/libraries/libsndfile/default.nix8
-rw-r--r--pkgs/development/libraries/libsodium/default.nix4
-rw-r--r--pkgs/development/libraries/libsolv/default.nix4
-rw-r--r--pkgs/development/libraries/libsoundio/default.nix10
-rw-r--r--pkgs/development/libraries/libsoup/default.nix4
-rw-r--r--pkgs/development/libraries/libspatialindex/default.nix6
-rw-r--r--pkgs/development/libraries/libspectre/default.nix6
-rw-r--r--pkgs/development/libraries/libspf2/default.nix4
-rw-r--r--pkgs/development/libraries/libspiro/default.nix4
-rw-r--r--pkgs/development/libraries/libspotify/default.nix14
-rw-r--r--pkgs/development/libraries/libsrs2/default.nix2
-rw-r--r--pkgs/development/libraries/libssh/default.nix4
-rw-r--r--pkgs/development/libraries/libssh2/default.nix6
-rw-r--r--pkgs/development/libraries/libstatgrab/default.nix6
-rw-r--r--pkgs/development/libraries/libstroke/default.nix6
-rw-r--r--pkgs/development/libraries/libstrophe/default.nix4
-rw-r--r--pkgs/development/libraries/libsurvive/default.nix4
-rw-r--r--pkgs/development/libraries/libsvm/default.nix6
-rw-r--r--pkgs/development/libraries/libsystemtap/default.nix6
-rw-r--r--pkgs/development/libraries/libtap/default.nix6
-rw-r--r--pkgs/development/libraries/libtar/default.nix4
-rw-r--r--pkgs/development/libraries/libtasn1/default.nix4
-rw-r--r--pkgs/development/libraries/libtcod/default.nix8
-rw-r--r--pkgs/development/libraries/libtelnet/default.nix8
-rw-r--r--pkgs/development/libraries/libtermkey/default.nix2
-rw-r--r--pkgs/development/libraries/libthai/default.nix4
-rw-r--r--pkgs/development/libraries/libtheora/default.nix6
-rw-r--r--pkgs/development/libraries/libthreadar/default.nix4
-rw-r--r--pkgs/development/libraries/libtiff/default.nix4
-rw-r--r--pkgs/development/libraries/libtins/default.nix8
-rw-r--r--pkgs/development/libraries/libtomcrypt/default.nix4
-rw-r--r--pkgs/development/libraries/libtommath/default.nix4
-rw-r--r--pkgs/development/libraries/libtorrent-rasterbar/1.1.nix2
-rw-r--r--pkgs/development/libraries/libtorrent-rasterbar/1.2.nix6
-rw-r--r--pkgs/development/libraries/libtorrent-rasterbar/default.nix6
-rw-r--r--pkgs/development/libraries/libtoxcore/default.nix6
-rw-r--r--pkgs/development/libraries/libtoxcore/new-api.nix8
-rw-r--r--pkgs/development/libraries/libtsm/default.nix4
-rw-r--r--pkgs/development/libraries/libu2f-host/default.nix4
-rw-r--r--pkgs/development/libraries/libu2f-server/default.nix4
-rw-r--r--pkgs/development/libraries/libuchardet/default.nix4
-rw-r--r--pkgs/development/libraries/libucl/default.nix8
-rw-r--r--pkgs/development/libraries/libuecc/default.nix4
-rw-r--r--pkgs/development/libraries/libui/default.nix16
-rw-r--r--pkgs/development/libraries/libuinputplus/default.nix4
-rw-r--r--pkgs/development/libraries/libunarr/default.nix4
-rw-r--r--pkgs/development/libraries/libunibreak/default.nix6
-rw-r--r--pkgs/development/libraries/libuninameslist/default.nix4
-rw-r--r--pkgs/development/libraries/libunique/3.x.nix6
-rw-r--r--pkgs/development/libraries/libunique/default.nix8
-rw-r--r--pkgs/development/libraries/libunistring/default.nix8
-rw-r--r--pkgs/development/libraries/libunity/default.nix4
-rw-r--r--pkgs/development/libraries/libunwind/default.nix2
-rw-r--r--pkgs/development/libraries/liburcu/default.nix4
-rw-r--r--pkgs/development/libraries/liburing/default.nix4
-rw-r--r--pkgs/development/libraries/libusb-compat/0.1.nix4
-rw-r--r--pkgs/development/libraries/libusb1/default.nix14
-rw-r--r--pkgs/development/libraries/libusbmuxd/default.nix4
-rw-r--r--pkgs/development/libraries/libuv/default.nix6
-rw-r--r--pkgs/development/libraries/libuvc/default.nix4
-rw-r--r--pkgs/development/libraries/libva/1.0.0.nix2
-rw-r--r--pkgs/development/libraries/libva/default.nix2
-rw-r--r--pkgs/development/libraries/libva/utils.nix4
-rw-r--r--pkgs/development/libraries/libvdpau-va-gl/default.nix4
-rw-r--r--pkgs/development/libraries/libvdpau/default.nix8
-rw-r--r--pkgs/development/libraries/libversion/default.nix2
-rw-r--r--pkgs/development/libraries/libviper/default.nix4
-rw-r--r--pkgs/development/libraries/libvirt-glib/default.nix4
-rw-r--r--pkgs/development/libraries/libvirt/5.9.0.nix6
-rw-r--r--pkgs/development/libraries/libvirt/default.nix8
-rw-r--r--pkgs/development/libraries/libvisio/default.nix4
-rw-r--r--pkgs/development/libraries/libvisual/default.nix8
-rw-r--r--pkgs/development/libraries/libvmaf/default.nix4
-rw-r--r--pkgs/development/libraries/libvmi/default.nix6
-rw-r--r--pkgs/development/libraries/libvncserver/default.nix10
-rw-r--r--pkgs/development/libraries/libvorbis/default.nix4
-rw-r--r--pkgs/development/libraries/libvpx/1_8.nix6
-rw-r--r--pkgs/development/libraries/libvpx/default.nix6
-rw-r--r--pkgs/development/libraries/libvterm-neovim/default.nix6
-rw-r--r--pkgs/development/libraries/libvterm/default.nix4
-rw-r--r--pkgs/development/libraries/libwacom/default.nix4
-rw-r--r--pkgs/development/libraries/libwebp/default.nix4
-rw-r--r--pkgs/development/libraries/libwebsockets/default.nix6
-rw-r--r--pkgs/development/libraries/libwhereami/default.nix4
-rw-r--r--pkgs/development/libraries/libwmf/default.nix4
-rw-r--r--pkgs/development/libraries/libwnck/3.x.nix8
-rw-r--r--pkgs/development/libraries/libwnck/default.nix8
-rw-r--r--pkgs/development/libraries/libwpd/0.8.nix4
-rw-r--r--pkgs/development/libraries/libwpd/default.nix4
-rw-r--r--pkgs/development/libraries/libwpg/default.nix4
-rw-r--r--pkgs/development/libraries/libwps/default.nix4
-rw-r--r--pkgs/development/libraries/libx86/default.nix6
-rw-r--r--pkgs/development/libraries/libx86emu/default.nix4
-rw-r--r--pkgs/development/libraries/libxc/default.nix4
-rw-r--r--pkgs/development/libraries/libxcomp/default.nix4
-rw-r--r--pkgs/development/libraries/libxdg-basedir/default.nix4
-rw-r--r--pkgs/development/libraries/libxkbcommon/default.nix4
-rw-r--r--pkgs/development/libraries/libxkbcommon/libxkbcommon_7.nix6
-rw-r--r--pkgs/development/libraries/libxklavier/default.nix4
-rw-r--r--pkgs/development/libraries/libxl/default.nix4
-rw-r--r--pkgs/development/libraries/libxls/default.nix4
-rw-r--r--pkgs/development/libraries/libxmi/default.nix6
-rw-r--r--pkgs/development/libraries/libxmlb/default.nix4
-rw-r--r--pkgs/development/libraries/libxmlxx/default.nix6
-rw-r--r--pkgs/development/libraries/libxmlxx/v3.nix6
-rw-r--r--pkgs/development/libraries/libxmp/default.nix4
-rw-r--r--pkgs/development/libraries/libxslt/default.nix18
-rw-r--r--pkgs/development/libraries/libxsmm/default.nix6
-rw-r--r--pkgs/development/libraries/libyaml-cpp/default.nix4
-rw-r--r--pkgs/development/libraries/libyaml/default.nix4
-rw-r--r--pkgs/development/libraries/libykclient/default.nix4
-rw-r--r--pkgs/development/libraries/libykneomgr/default.nix4
-rw-r--r--pkgs/development/libraries/libyubikey/default.nix4
-rw-r--r--pkgs/development/libraries/libzapojit/default.nix6
-rw-r--r--pkgs/development/libraries/libzdb/default.nix6
-rw-r--r--pkgs/development/libraries/libzen/default.nix4
-rw-r--r--pkgs/development/libraries/libzip/default.nix4
-rw-r--r--pkgs/development/libraries/libzmf/default.nix8
-rw-r--r--pkgs/development/libraries/libzra/default.nix4
-rw-r--r--pkgs/development/libraries/lief/default.nix4
-rw-r--r--pkgs/development/libraries/lightning/default.nix6
-rw-r--r--pkgs/development/libraries/lime/default.nix4
-rw-r--r--pkgs/development/libraries/linbox/default.nix8
-rw-r--r--pkgs/development/libraries/linenoise-ng/default.nix8
-rw-r--r--pkgs/development/libraries/linenoise/default.nix8
-rw-r--r--pkgs/development/libraries/liquid-dsp/default.nix6
-rw-r--r--pkgs/development/libraries/liquidfun/default.nix8
-rw-r--r--pkgs/development/libraries/lirc/default.nix4
-rw-r--r--pkgs/development/libraries/live555/default.nix2
-rw-r--r--pkgs/development/libraries/lmdb/default.nix6
-rw-r--r--pkgs/development/libraries/lmdbxx/default.nix6
-rw-r--r--pkgs/development/libraries/log4cplus/default.nix6
-rw-r--r--pkgs/development/libraries/log4cpp/default.nix4
-rw-r--r--pkgs/development/libraries/log4cxx/default.nix8
-rw-r--r--pkgs/development/libraries/log4shib/default.nix4
-rw-r--r--pkgs/development/libraries/loki/default.nix4
-rw-r--r--pkgs/development/libraries/loudmouth/default.nix4
-rw-r--r--pkgs/development/libraries/lrdf/default.nix10
-rw-r--r--pkgs/development/libraries/luabind/default.nix6
-rw-r--r--pkgs/development/libraries/lucene++/default.nix6
-rw-r--r--pkgs/development/libraries/lyra/default.nix4
-rw-r--r--pkgs/development/libraries/lzo/default.nix4
-rw-r--r--pkgs/development/libraries/mac/default.nix4
-rw-r--r--pkgs/development/libraries/malcontent/default.nix4
-rw-r--r--pkgs/development/libraries/malcontent/ui.nix4
-rw-r--r--pkgs/development/libraries/mapnik/default.nix4
-rw-r--r--pkgs/development/libraries/marisa/default.nix4
-rw-r--r--pkgs/development/libraries/marl/default.nix4
-rw-r--r--pkgs/development/libraries/martyr/default.nix4
-rw-r--r--pkgs/development/libraries/matio/default.nix4
-rw-r--r--pkgs/development/libraries/mbedtls/default.nix6
-rw-r--r--pkgs/development/libraries/mdds/default.nix6
-rw-r--r--pkgs/development/libraries/medfile/default.nix4
-rw-r--r--pkgs/development/libraries/mediastreamer/default.nix4
-rw-r--r--pkgs/development/libraries/mediastreamer/msopenh264.nix4
-rw-r--r--pkgs/development/libraries/menu-cache/default.nix4
-rw-r--r--pkgs/development/libraries/mesa-glu/default.nix8
-rw-r--r--pkgs/development/libraries/mesa/default.nix4
-rw-r--r--pkgs/development/libraries/metal/default.nix4
-rw-r--r--pkgs/development/libraries/microsoft_gsl/default.nix4
-rw-r--r--pkgs/development/libraries/mimalloc/default.nix8
-rw-r--r--pkgs/development/libraries/mimetic/default.nix6
-rw-r--r--pkgs/development/libraries/miniball/default.nix8
-rw-r--r--pkgs/development/libraries/minixml/default.nix4
-rw-r--r--pkgs/development/libraries/minizip/default.nix4
-rw-r--r--pkgs/development/libraries/minizip2/default.nix4
-rw-r--r--pkgs/development/libraries/mlt/default.nix4
-rw-r--r--pkgs/development/libraries/mlt/qt-5.nix6
-rw-r--r--pkgs/development/libraries/mm-common/default.nix6
-rw-r--r--pkgs/development/libraries/mongoc/default.nix4
-rw-r--r--pkgs/development/libraries/mono-addins/default.nix4
-rw-r--r--pkgs/development/libraries/motif/default.nix6
-rw-r--r--pkgs/development/libraries/movit/default.nix4
-rw-r--r--pkgs/development/libraries/mp4v2/default.nix2
-rw-r--r--pkgs/development/libraries/mpfi/default.nix8
-rw-r--r--pkgs/development/libraries/mpfr/default.nix10
-rw-r--r--pkgs/development/libraries/mpich/default.nix6
-rw-r--r--pkgs/development/libraries/mpir/default.nix8
-rw-r--r--pkgs/development/libraries/mps/default.nix8
-rw-r--r--pkgs/development/libraries/msgpack/generic.nix6
-rw-r--r--pkgs/development/libraries/msgpuck/default.nix4
-rw-r--r--pkgs/development/libraries/msilbc/default.nix4
-rw-r--r--pkgs/development/libraries/mtdev/default.nix4
-rw-r--r--pkgs/development/libraries/mtxclient/default.nix4
-rw-r--r--pkgs/development/libraries/multipart-parser-c/default.nix4
-rw-r--r--pkgs/development/libraries/muparser/default.nix10
-rw-r--r--pkgs/development/libraries/muparserx/default.nix4
-rw-r--r--pkgs/development/libraries/mutest/default.nix4
-rw-r--r--pkgs/development/libraries/mygui/default.nix4
-rw-r--r--pkgs/development/libraries/mypaint-brushes/1.0.nix4
-rw-r--r--pkgs/development/libraries/mypaint-brushes/default.nix4
-rw-r--r--pkgs/development/libraries/mysocketw/default.nix8
-rw-r--r--pkgs/development/libraries/mythes/default.nix4
-rw-r--r--pkgs/development/libraries/nanoflann/default.nix6
-rw-r--r--pkgs/development/libraries/nanomsg/default.nix4
-rw-r--r--pkgs/development/libraries/nco/default.nix8
-rw-r--r--pkgs/development/libraries/ndi/default.nix4
-rw-r--r--pkgs/development/libraries/ndn-cxx/default.nix4
-rw-r--r--pkgs/development/libraries/ndpi/default.nix4
-rw-r--r--pkgs/development/libraries/neardal/default.nix4
-rw-r--r--pkgs/development/libraries/neatvnc/default.nix4
-rw-r--r--pkgs/development/libraries/neon/0.29.nix16
-rw-r--r--pkgs/development/libraries/neon/default.nix16
-rw-r--r--pkgs/development/libraries/netcdf-cxx4/default.nix6
-rw-r--r--pkgs/development/libraries/netcdf-fortran/default.nix4
-rw-r--r--pkgs/development/libraries/netcdf/default.nix6
-rw-r--r--pkgs/development/libraries/nettle/generic.nix8
-rw-r--r--pkgs/development/libraries/networking-ts-cxx/default.nix4
-rw-r--r--pkgs/development/libraries/newt/default.nix4
-rw-r--r--pkgs/development/libraries/nghttp2/default.nix8
-rw-r--r--pkgs/development/libraries/ngt/default.nix4
-rw-r--r--pkgs/development/libraries/nix-plugins/default.nix6
-rw-r--r--pkgs/development/libraries/nlohmann_json/default.nix4
-rw-r--r--pkgs/development/libraries/nlopt/default.nix8
-rw-r--r--pkgs/development/libraries/notify-sharp/default.nix4
-rw-r--r--pkgs/development/libraries/npapi-sdk/default.nix4
-rw-r--r--pkgs/development/libraries/npth/default.nix4
-rw-r--r--pkgs/development/libraries/nspr/default.nix10
-rw-r--r--pkgs/development/libraries/nss/3.44.nix16
-rw-r--r--pkgs/development/libraries/nss/3.53.nix16
-rw-r--r--pkgs/development/libraries/nss/default.nix16
-rw-r--r--pkgs/development/libraries/nss_wrapper/default.nix4
-rw-r--r--pkgs/development/libraries/ntbtls/default.nix6
-rw-r--r--pkgs/development/libraries/ntdb/default.nix4
-rw-r--r--pkgs/development/libraries/ntirpc/default.nix4
-rw-r--r--pkgs/development/libraries/ntrack/default.nix4
-rw-r--r--pkgs/development/libraries/nuraft/default.nix4
-rw-r--r--pkgs/development/libraries/nuspell/default.nix4
-rw-r--r--pkgs/development/libraries/nv-codec-headers/default.nix8
-rw-r--r--pkgs/development/libraries/nvidia-optical-flow-sdk/default.nix4
-rw-r--r--pkgs/development/libraries/nvidia-texture-tools/default.nix4
-rw-r--r--pkgs/development/libraries/nvidia-video-sdk/default.nix4
-rw-r--r--pkgs/development/libraries/oatpp/default.nix4
-rw-r--r--pkgs/development/libraries/ocl-icd/default.nix4
-rw-r--r--pkgs/development/libraries/ode/default.nix4
-rw-r--r--pkgs/development/libraries/odpic/default.nix14
-rw-r--r--pkgs/development/libraries/ogdf/default.nix4
-rw-r--r--pkgs/development/libraries/ogre/1.10.x.nix6
-rw-r--r--pkgs/development/libraries/ogre/1.9.x.nix6
-rw-r--r--pkgs/development/libraries/ogre/default.nix6
-rw-r--r--pkgs/development/libraries/ogrepaged/default.nix6
-rw-r--r--pkgs/development/libraries/ois/default.nix2
-rw-r--r--pkgs/development/libraries/olm/default.nix6
-rw-r--r--pkgs/development/libraries/oniguruma/default.nix4
-rw-r--r--pkgs/development/libraries/opae/default.nix4
-rw-r--r--pkgs/development/libraries/openal-soft/default.nix4
-rw-r--r--pkgs/development/libraries/openbabel/2.nix2
-rw-r--r--pkgs/development/libraries/openbabel/default.nix2
-rw-r--r--pkgs/development/libraries/openbr/default.nix8
-rw-r--r--pkgs/development/libraries/opencascade-occt/default.nix6
-rw-r--r--pkgs/development/libraries/opencascade/default.nix4
-rw-r--r--pkgs/development/libraries/opencl-clang/default.nix15
-rw-r--r--pkgs/development/libraries/opencl-clhpp/default.nix4
-rw-r--r--pkgs/development/libraries/opencl-headers/default.nix4
-rw-r--r--pkgs/development/libraries/opencollada/default.nix6
-rw-r--r--pkgs/development/libraries/opencolorio/default.nix2
-rw-r--r--pkgs/development/libraries/opencore-amr/default.nix6
-rw-r--r--pkgs/development/libraries/opencsg/default.nix14
-rw-r--r--pkgs/development/libraries/openct/default.nix4
-rw-r--r--pkgs/development/libraries/opencv/3.x.nix2
-rw-r--r--pkgs/development/libraries/opencv/4.x.nix2
-rw-r--r--pkgs/development/libraries/opencv/default.nix2
-rw-r--r--pkgs/development/libraries/opendbx/default.nix6
-rw-r--r--pkgs/development/libraries/opendht/default.nix4
-rw-r--r--pkgs/development/libraries/opendkim/default.nix4
-rw-r--r--pkgs/development/libraries/opendmarc/default.nix4
-rw-r--r--pkgs/development/libraries/openexr/default.nix2
-rw-r--r--pkgs/development/libraries/openexrid-unstable/default.nix4
-rw-r--r--pkgs/development/libraries/openfst/default.nix4
-rw-r--r--pkgs/development/libraries/openfx/default.nix4
-rw-r--r--pkgs/development/libraries/opengrm-ngram/default.nix4
-rw-r--r--pkgs/development/libraries/openh264/default.nix4
-rw-r--r--pkgs/development/libraries/openhmd/default.nix8
-rw-r--r--pkgs/development/libraries/openimagedenoise/default.nix4
-rw-r--r--pkgs/development/libraries/openjpeg/generic.nix6
-rw-r--r--pkgs/development/libraries/openldap/default.nix12
-rw-r--r--pkgs/development/libraries/openmpi/default.nix6
-rw-r--r--pkgs/development/libraries/openpa/default.nix8
-rw-r--r--pkgs/development/libraries/opensaml-cpp/default.nix4
-rw-r--r--pkgs/development/libraries/openscenegraph/default.nix2
-rw-r--r--pkgs/development/libraries/openslp/default.nix4
-rw-r--r--pkgs/development/libraries/openssl/chacha.nix10
-rw-r--r--pkgs/development/libraries/openssl/default.nix24
-rw-r--r--pkgs/development/libraries/opentracing-cpp/default.nix6
-rw-r--r--pkgs/development/libraries/openvdb/default.nix4
-rw-r--r--pkgs/development/libraries/openwsman/default.nix4
-rw-r--r--pkgs/development/libraries/openxr-loader/default.nix4
-rw-r--r--pkgs/development/libraries/openzwave/default.nix4
-rw-r--r--pkgs/development/libraries/oracle-instantclient/default.nix6
-rw-r--r--pkgs/development/libraries/orcania/default.nix4
-rw-r--r--pkgs/development/libraries/ortp/default.nix4
-rw-r--r--pkgs/development/libraries/osip/default.nix8
-rw-r--r--pkgs/development/libraries/osm-gps-map/default.nix4
-rw-r--r--pkgs/development/libraries/p11-kit/default.nix4
-rw-r--r--pkgs/development/libraries/packr/default.nix2
-rw-r--r--pkgs/development/libraries/pagmo2/default.nix4
-rw-r--r--pkgs/development/libraries/pango/default.nix10
-rw-r--r--pkgs/development/libraries/pangolin/default.nix6
-rw-r--r--pkgs/development/libraries/pangomm/default.nix8
-rw-r--r--pkgs/development/libraries/pangoxsl/default.nix4
-rw-r--r--pkgs/development/libraries/partio/default.nix4
-rw-r--r--pkgs/development/libraries/pc-ble-driver/default.nix8
-rw-r--r--pkgs/development/libraries/pcaudiolib/default.nix2
-rw-r--r--pkgs/development/libraries/pcg-c/default.nix6
-rw-r--r--pkgs/development/libraries/pcl/default.nix14
-rw-r--r--pkgs/development/libraries/pcre/default.nix6
-rw-r--r--pkgs/development/libraries/pcre2/default.nix6
-rw-r--r--pkgs/development/libraries/pdal/default.nix4
-rw-r--r--pkgs/development/libraries/pdf2xml/default.nix4
-rw-r--r--pkgs/development/libraries/phash/default.nix4
-rw-r--r--pkgs/development/libraries/phonetisaurus/default.nix4
-rw-r--r--pkgs/development/libraries/phonon/backends/gstreamer.nix2
-rw-r--r--pkgs/development/libraries/phonon/backends/vlc.nix2
-rw-r--r--pkgs/development/libraries/phonon/default.nix6
-rw-r--r--pkgs/development/libraries/physfs/default.nix6
-rw-r--r--pkgs/development/libraries/physics/apfel/default.nix4
-rw-r--r--pkgs/development/libraries/physics/apfelgrid/default.nix4
-rw-r--r--pkgs/development/libraries/physics/applgrid/default.nix4
-rw-r--r--pkgs/development/libraries/physics/cernlib/default.nix6
-rw-r--r--pkgs/development/libraries/physics/fastjet-contrib/default.nix4
-rw-r--r--pkgs/development/libraries/physics/fastjet/default.nix8
-rw-r--r--pkgs/development/libraries/physics/fastnlo/default.nix8
-rw-r--r--pkgs/development/libraries/physics/geant4/datasets.nix2
-rw-r--r--pkgs/development/libraries/physics/geant4/default.nix18
-rw-r--r--pkgs/development/libraries/physics/hepmc2/default.nix4
-rw-r--r--pkgs/development/libraries/physics/hepmc3/default.nix12
-rw-r--r--pkgs/development/libraries/physics/herwig/default.nix4
-rw-r--r--pkgs/development/libraries/physics/hoppet/default.nix4
-rw-r--r--pkgs/development/libraries/physics/lhapdf/default.nix12
-rw-r--r--pkgs/development/libraries/physics/lhapdf/pdf_sets.nix4
-rw-r--r--pkgs/development/libraries/physics/mela/default.nix4
-rw-r--r--pkgs/development/libraries/physics/nlojet/default.nix8
-rw-r--r--pkgs/development/libraries/physics/pythia/default.nix10
-rw-r--r--pkgs/development/libraries/physics/qcdnum/default.nix8
-rw-r--r--pkgs/development/libraries/physics/rivet/default.nix6
-rw-r--r--pkgs/development/libraries/physics/thepeg/default.nix4
-rw-r--r--pkgs/development/libraries/physics/yoda/default.nix10
-rw-r--r--pkgs/development/libraries/pipewire/0.2.nix4
-rw-r--r--pkgs/development/libraries/pipewire/default.nix2
-rw-r--r--pkgs/development/libraries/pixman/default.nix6
-rw-r--r--pkgs/development/libraries/pkcs11helper/default.nix4
-rw-r--r--pkgs/development/libraries/pkger/default.nix2
-rw-r--r--pkgs/development/libraries/plib/default.nix6
-rw-r--r--pkgs/development/libraries/plplot/default.nix4
-rw-r--r--pkgs/development/libraries/pmdk/default.nix4
-rw-r--r--pkgs/development/libraries/pmix/default.nix4
-rw-r--r--pkgs/development/libraries/png++/default.nix10
-rw-r--r--pkgs/development/libraries/pocketsphinx/default.nix6
-rw-r--r--pkgs/development/libraries/poco/default.nix4
-rw-r--r--pkgs/development/libraries/podofo/default.nix4
-rw-r--r--pkgs/development/libraries/polkit-qt-1/qt-4.nix6
-rw-r--r--pkgs/development/libraries/polkit-qt-1/qt-5.nix8
-rw-r--r--pkgs/development/libraries/polkit/default.nix16
-rw-r--r--pkgs/development/libraries/poly2tri-c/default.nix6
-rw-r--r--pkgs/development/libraries/poppler/0.61.nix2
-rw-r--r--pkgs/development/libraries/poppler/default.nix2
-rw-r--r--pkgs/development/libraries/popt/default.nix6
-rw-r--r--pkgs/development/libraries/portaudio/default.nix16
-rw-r--r--pkgs/development/libraries/portmidi/default.nix8
-rw-r--r--pkgs/development/libraries/ppl/default.nix8
-rw-r--r--pkgs/development/libraries/prison/default.nix4
-rw-r--r--pkgs/development/libraries/proj-datumgrid/default.nix4
-rw-r--r--pkgs/development/libraries/proj/5.2.nix4
-rw-r--r--pkgs/development/libraries/proj/default.nix4
-rw-r--r--pkgs/development/libraries/prometheus-client-c/default.nix8
-rw-r--r--pkgs/development/libraries/prometheus-cpp/default.nix4
-rw-r--r--pkgs/development/libraries/properties-cpp/default.nix4
-rw-r--r--pkgs/development/libraries/protobuf/generic-v3.nix8
-rw-r--r--pkgs/development/libraries/protobuf/generic.nix6
-rw-r--r--pkgs/development/libraries/protobufc/generic.nix4
-rw-r--r--pkgs/development/libraries/prototypejs/default.nix4
-rw-r--r--pkgs/development/libraries/protozero/default.nix4
-rw-r--r--pkgs/development/libraries/pslib/default.nix4
-rw-r--r--pkgs/development/libraries/psol/generic.nix6
-rw-r--r--pkgs/development/libraries/psqlodbc/default.nix4
-rw-r--r--pkgs/development/libraries/pstreams/default.nix6
-rw-r--r--pkgs/development/libraries/ptex/default.nix4
-rw-r--r--pkgs/development/libraries/pth/default.nix8
-rw-r--r--pkgs/development/libraries/pupnp/default.nix4
-rw-r--r--pkgs/development/libraries/pxlib/default.nix4
-rw-r--r--pkgs/development/libraries/pyotherside/default.nix4
-rw-r--r--pkgs/development/libraries/python-qt/default.nix4
-rw-r--r--pkgs/development/libraries/qca-qt5/default.nix6
-rw-r--r--pkgs/development/libraries/qca2/default.nix6
-rw-r--r--pkgs/development/libraries/qhull/default.nix4
-rw-r--r--pkgs/development/libraries/qimageblitz/default.nix6
-rw-r--r--pkgs/development/libraries/qjson/default.nix4
-rw-r--r--pkgs/development/libraries/qmlbox2d/default.nix4
-rw-r--r--pkgs/development/libraries/qmltermwidget/default.nix10
-rw-r--r--pkgs/development/libraries/qoauth/default.nix4
-rw-r--r--pkgs/development/libraries/qpdf/default.nix4
-rw-r--r--pkgs/development/libraries/qrcodegen/default.nix4
-rw-r--r--pkgs/development/libraries/qrencode/default.nix6
-rw-r--r--pkgs/development/libraries/qrupdate/default.nix8
-rw-r--r--pkgs/development/libraries/qscintilla/default.nix2
-rw-r--r--pkgs/development/libraries/qt-3/default.nix24
-rw-r--r--pkgs/development/libraries/qt-4.x/4.8/default.nix2
-rw-r--r--pkgs/development/libraries/qt-mobility/default.nix4
-rw-r--r--pkgs/development/libraries/qtkeychain/default.nix12
-rw-r--r--pkgs/development/libraries/qtpbfimageplugin/default.nix6
-rw-r--r--pkgs/development/libraries/qtscriptgenerator/default.nix4
-rw-r--r--pkgs/development/libraries/qtstyleplugin-kvantum-qt4/default.nix4
-rw-r--r--pkgs/development/libraries/qtstyleplugin-kvantum/default.nix4
-rw-r--r--pkgs/development/libraries/qtstyleplugins/default.nix4
-rw-r--r--pkgs/development/libraries/qtutilities/default.nix4
-rw-r--r--pkgs/development/libraries/qtwebkit-plugins/default.nix6
-rw-r--r--pkgs/development/libraries/quazip/default.nix6
-rw-r--r--pkgs/development/libraries/quesoglc/default.nix4
-rw-r--r--pkgs/development/libraries/quickder/default.nix4
-rw-r--r--pkgs/development/libraries/quickfix/default.nix4
-rw-r--r--pkgs/development/libraries/qwt/6.nix6
-rw-r--r--pkgs/development/libraries/qwt/6_qt4.nix10
-rw-r--r--pkgs/development/libraries/qwt/default.nix6
-rw-r--r--pkgs/development/libraries/qxt/default.nix8
-rw-r--r--pkgs/development/libraries/rabbitmq-c/default.nix4
-rw-r--r--pkgs/development/libraries/rabbitmq-java-client/default.nix4
-rw-r--r--pkgs/development/libraries/raft-canonical/default.nix4
-rw-r--r--pkgs/development/libraries/randomx/default.nix4
-rw-r--r--pkgs/development/libraries/rang/default.nix4
-rw-r--r--pkgs/development/libraries/range-v3/default.nix6
-rw-r--r--pkgs/development/libraries/rapidcheck/default.nix4
-rw-r--r--pkgs/development/libraries/rapidxml/default.nix4
-rw-r--r--pkgs/development/libraries/rarian/default.nix6
-rw-r--r--pkgs/development/libraries/rdkafka/default.nix4
-rw-r--r--pkgs/development/libraries/re2/default.nix6
-rw-r--r--pkgs/development/libraries/readline/5.x.nix6
-rw-r--r--pkgs/development/libraries/readline/6.2.nix6
-rw-r--r--pkgs/development/libraries/readline/6.3.nix8
-rw-r--r--pkgs/development/libraries/readline/7.0.nix4
-rw-r--r--pkgs/development/libraries/readline/8.0.nix4
-rw-r--r--pkgs/development/libraries/readosm/default.nix6
-rw-r--r--pkgs/development/libraries/redkite/default.nix4
-rw-r--r--pkgs/development/libraries/rep-gtk/default.nix4
-rw-r--r--pkgs/development/libraries/resolv_wrapper/default.nix4
-rw-r--r--pkgs/development/libraries/rlog/default.nix6
-rw-r--r--pkgs/development/libraries/rlottie/default.nix4
-rw-r--r--pkgs/development/libraries/rnnoise-plugin/default.nix4
-rw-r--r--pkgs/development/libraries/robin-map/default.nix4
-rw-r--r--pkgs/development/libraries/rocclr/default.nix4
-rw-r--r--pkgs/development/libraries/rocksdb/default.nix16
-rw-r--r--pkgs/development/libraries/rocm-comgr/default.nix4
-rw-r--r--pkgs/development/libraries/rocm-device-libs/default.nix4
-rw-r--r--pkgs/development/libraries/rocm-opencl-icd/default.nix4
-rw-r--r--pkgs/development/libraries/rocm-opencl-runtime/default.nix4
-rw-r--r--pkgs/development/libraries/rocm-runtime/default.nix4
-rw-r--r--pkgs/development/libraries/rocm-thunk/default.nix4
-rw-r--r--pkgs/development/libraries/rote/default.nix4
-rw-r--r--pkgs/development/libraries/rttr/default.nix4
-rw-r--r--pkgs/development/libraries/rubberband/default.nix4
-rw-r--r--pkgs/development/libraries/safefile/default.nix8
-rw-r--r--pkgs/development/libraries/sbc/default.nix4
-rw-r--r--pkgs/development/libraries/sblim-sfcc/default.nix4
-rw-r--r--pkgs/development/libraries/schroedinger/default.nix4
-rw-r--r--pkgs/development/libraries/science/benchmark/papi/default.nix4
-rw-r--r--pkgs/development/libraries/science/biology/EBTKS/default.nix4
-rw-r--r--pkgs/development/libraries/science/biology/bicgl/default.nix4
-rw-r--r--pkgs/development/libraries/science/biology/bicpl/default.nix4
-rw-r--r--pkgs/development/libraries/science/biology/bpp-core/default.nix4
-rw-r--r--pkgs/development/libraries/science/biology/elastix/default.nix6
-rw-r--r--pkgs/development/libraries/science/biology/gifticlib/default.nix4
-rw-r--r--pkgs/development/libraries/science/biology/htslib/default.nix4
-rw-r--r--pkgs/development/libraries/science/biology/mirtk/default.nix4
-rw-r--r--pkgs/development/libraries/science/biology/nifticlib/default.nix4
-rw-r--r--pkgs/development/libraries/science/biology/oobicpl/default.nix4
-rw-r--r--pkgs/development/libraries/science/math/QuadProgpp/default.nix4
-rw-r--r--pkgs/development/libraries/science/math/amd-blis/default.nix6
-rw-r--r--pkgs/development/libraries/science/math/amd-libflame/default.nix2
-rw-r--r--pkgs/development/libraries/science/math/arpack/default.nix10
-rw-r--r--pkgs/development/libraries/science/math/blas/default.nix10
-rw-r--r--pkgs/development/libraries/science/math/blis/default.nix6
-rw-r--r--pkgs/development/libraries/science/math/brial/default.nix4
-rw-r--r--pkgs/development/libraries/science/math/caffe2/default.nix6
-rw-r--r--pkgs/development/libraries/science/math/cholmod-extra/default.nix4
-rw-r--r--pkgs/development/libraries/science/math/clblas/default.nix10
-rw-r--r--pkgs/development/libraries/science/math/cliquer/default.nix4
-rw-r--r--pkgs/development/libraries/science/math/clmagma/default.nix6
-rw-r--r--pkgs/development/libraries/science/math/cudnn/generic.nix2
-rw-r--r--pkgs/development/libraries/science/math/ecos/default.nix4
-rw-r--r--pkgs/development/libraries/science/math/fenics/default.nix24
-rw-r--r--pkgs/development/libraries/science/math/flintqs/default.nix4
-rw-r--r--pkgs/development/libraries/science/math/ipopt/default.nix4
-rw-r--r--pkgs/development/libraries/science/math/itpp/default.nix4
-rw-r--r--pkgs/development/libraries/science/math/lcalc/default.nix8
-rw-r--r--pkgs/development/libraries/science/math/libbraiding/default.nix4
-rw-r--r--pkgs/development/libraries/science/math/libhomfly/default.nix4
-rw-r--r--pkgs/development/libraries/science/math/liblapack/default.nix6
-rw-r--r--pkgs/development/libraries/science/math/liblbfgs/default.nix6
-rw-r--r--pkgs/development/libraries/science/math/libtorch/bin.nix12
-rw-r--r--pkgs/development/libraries/science/math/lrs/default.nix8
-rw-r--r--pkgs/development/libraries/science/math/m4ri/default.nix4
-rw-r--r--pkgs/development/libraries/science/math/m4rie/default.nix4
-rw-r--r--pkgs/development/libraries/science/math/magma/default.nix6
-rw-r--r--pkgs/development/libraries/science/math/metis/default.nix6
-rw-r--r--pkgs/development/libraries/science/math/mongoose/default.nix4
-rw-r--r--pkgs/development/libraries/science/math/nccl/default.nix4
-rw-r--r--pkgs/development/libraries/science/math/openblas/default.nix10
-rw-r--r--pkgs/development/libraries/science/math/openlibm/default.nix8
-rw-r--r--pkgs/development/libraries/science/math/openspecfun/default.nix8
-rw-r--r--pkgs/development/libraries/science/math/or-tools/default.nix4
-rw-r--r--pkgs/development/libraries/science/math/osi/default.nix2
-rw-r--r--pkgs/development/libraries/science/math/osqp/default.nix4
-rw-r--r--pkgs/development/libraries/science/math/parmetis/default.nix4
-rw-r--r--pkgs/development/libraries/science/math/petsc/default.nix6
-rw-r--r--pkgs/development/libraries/science/math/planarity/default.nix4
-rw-r--r--pkgs/development/libraries/science/math/primesieve/default.nix4
-rw-r--r--pkgs/development/libraries/science/math/rankwidth/default.nix4
-rw-r--r--pkgs/development/libraries/science/math/rubiks/default.nix4
-rw-r--r--pkgs/development/libraries/science/math/scalapack/default.nix4
-rw-r--r--pkgs/development/libraries/science/math/scs/default.nix6
-rw-r--r--pkgs/development/libraries/science/math/spooles/default.nix6
-rw-r--r--pkgs/development/libraries/science/math/suitesparse-graphblas/default.nix4
-rw-r--r--pkgs/development/libraries/science/math/suitesparse/4.2.nix4
-rw-r--r--pkgs/development/libraries/science/math/suitesparse/4.4.nix12
-rw-r--r--pkgs/development/libraries/science/math/suitesparse/default.nix14
-rw-r--r--pkgs/development/libraries/science/math/superlu/default.nix4
-rw-r--r--pkgs/development/libraries/science/math/sympow/default.nix4
-rw-r--r--pkgs/development/libraries/science/math/tensorflow/bin.nix4
-rw-r--r--pkgs/development/libraries/science/networking/ns-3/default.nix10
-rw-r--r--pkgs/development/libraries/science/robotics/ispike/default.nix8
-rw-r--r--pkgs/development/libraries/scmccid/default.nix8
-rw-r--r--pkgs/development/libraries/scriptaculous/default.nix4
-rw-r--r--pkgs/development/libraries/seasocks/default.nix4
-rw-r--r--pkgs/development/libraries/sentencepiece/default.nix2
-rw-r--r--pkgs/development/libraries/serd/default.nix4
-rw-r--r--pkgs/development/libraries/serf/default.nix8
-rw-r--r--pkgs/development/libraries/serialdv/default.nix4
-rw-r--r--pkgs/development/libraries/sfml/default.nix10
-rw-r--r--pkgs/development/libraries/sfsexp/default.nix4
-rw-r--r--pkgs/development/libraries/shapelib/default.nix4
-rw-r--r--pkgs/development/libraries/shhmsg/default.nix4
-rw-r--r--pkgs/development/libraries/shhopt/default.nix4
-rw-r--r--pkgs/development/libraries/shibboleth-sp/default.nix4
-rw-r--r--pkgs/development/libraries/silgraphite/default.nix4
-rw-r--r--pkgs/development/libraries/silgraphite/graphite2.nix6
-rw-r--r--pkgs/development/libraries/simdjson/default.nix4
-rw-r--r--pkgs/development/libraries/simgear/default.nix4
-rw-r--r--pkgs/development/libraries/simpleitk/default.nix4
-rw-r--r--pkgs/development/libraries/slang/default.nix6
-rw-r--r--pkgs/development/libraries/slib/default.nix6
-rw-r--r--pkgs/development/libraries/smarty3-i18n/default.nix4
-rw-r--r--pkgs/development/libraries/smarty3/default.nix4
-rw-r--r--pkgs/development/libraries/smesh/default.nix6
-rw-r--r--pkgs/development/libraries/smpeg/default.nix6
-rw-r--r--pkgs/development/libraries/smpeg2/default.nix6
-rw-r--r--pkgs/development/libraries/snack/default.nix4
-rw-r--r--pkgs/development/libraries/snappy/default.nix4
-rw-r--r--pkgs/development/libraries/soci/default.nix4
-rw-r--r--pkgs/development/libraries/socket_wrapper/default.nix4
-rw-r--r--pkgs/development/libraries/sofia-sip/default.nix4
-rw-r--r--pkgs/development/libraries/sonic/default.nix6
-rw-r--r--pkgs/development/libraries/soprano/default.nix4
-rw-r--r--pkgs/development/libraries/soqt/default.nix4
-rw-r--r--pkgs/development/libraries/sord/default.nix4
-rw-r--r--pkgs/development/libraries/soxt/default.nix4
-rw-r--r--pkgs/development/libraries/spandsp/3.nix8
-rw-r--r--pkgs/development/libraries/spandsp/default.nix8
-rw-r--r--pkgs/development/libraries/sparsehash/default.nix4
-rw-r--r--pkgs/development/libraries/spatialite-tools/default.nix6
-rw-r--r--pkgs/development/libraries/spdk/default.nix4
-rw-r--r--pkgs/development/libraries/spdlog/default.nix4
-rw-r--r--pkgs/development/libraries/speech-tools/default.nix4
-rw-r--r--pkgs/development/libraries/speechd/default.nix6
-rw-r--r--pkgs/development/libraries/speex/default.nix4
-rw-r--r--pkgs/development/libraries/speexdsp/default.nix6
-rw-r--r--pkgs/development/libraries/sphinxbase/default.nix10
-rw-r--r--pkgs/development/libraries/spice-gtk/default.nix6
-rw-r--r--pkgs/development/libraries/spice-protocol/default.nix4
-rw-r--r--pkgs/development/libraries/spice/default.nix4
-rw-r--r--pkgs/development/libraries/spirv-headers/default.nix4
-rw-r--r--pkgs/development/libraries/sqlcipher/default.nix2
-rw-r--r--pkgs/development/libraries/sqlite/default.nix6
-rw-r--r--pkgs/development/libraries/sqlite/sqlar.nix4
-rw-r--r--pkgs/development/libraries/sqlite/tools.nix8
-rw-r--r--pkgs/development/libraries/srt/default.nix4
-rw-r--r--pkgs/development/libraries/srtp/default.nix4
-rw-r--r--pkgs/development/libraries/startup-notification/default.nix4
-rw-r--r--pkgs/development/libraries/stb/default.nix4
-rw-r--r--pkgs/development/libraries/stellarsolver/default.nix4
-rw-r--r--pkgs/development/libraries/stfl/default.nix10
-rw-r--r--pkgs/development/libraries/stlport/default.nix4
-rw-r--r--pkgs/development/libraries/stxxl/default.nix4
-rw-r--r--pkgs/development/libraries/subunit/default.nix4
-rw-r--r--pkgs/development/libraries/sundials/default.nix12
-rw-r--r--pkgs/development/libraries/svrcore/default.nix4
-rw-r--r--pkgs/development/libraries/swiften/default.nix4
-rw-r--r--pkgs/development/libraries/swiftshader/default.nix4
-rw-r--r--pkgs/development/libraries/sword/default.nix4
-rw-r--r--pkgs/development/libraries/sycl-info/default.nix6
-rw-r--r--pkgs/development/libraries/symengine/default.nix4
-rw-r--r--pkgs/development/libraries/szip/default.nix4
-rw-r--r--pkgs/development/libraries/t1lib/default.nix6
-rw-r--r--pkgs/development/libraries/tachyon/default.nix20
-rw-r--r--pkgs/development/libraries/taglib-extras/default.nix4
-rw-r--r--pkgs/development/libraries/taglib-sharp/default.nix4
-rw-r--r--pkgs/development/libraries/taglib/default.nix4
-rw-r--r--pkgs/development/libraries/talloc/default.nix8
-rw-r--r--pkgs/development/libraries/tbb/default.nix6
-rw-r--r--pkgs/development/libraries/tclap/default.nix4
-rw-r--r--pkgs/development/libraries/tcllib/default.nix6
-rw-r--r--pkgs/development/libraries/tcltls/default.nix6
-rw-r--r--pkgs/development/libraries/tclx/default.nix6
-rw-r--r--pkgs/development/libraries/tdb/default.nix4
-rw-r--r--pkgs/development/libraries/tdlib/default.nix4
-rw-r--r--pkgs/development/libraries/tecla/default.nix6
-rw-r--r--pkgs/development/libraries/telepathy/farstream/default.nix4
-rw-r--r--pkgs/development/libraries/telepathy/glib/default.nix4
-rw-r--r--pkgs/development/libraries/telepathy/qt/default.nix6
-rw-r--r--pkgs/development/libraries/template-glib/default.nix6
-rw-r--r--pkgs/development/libraries/tepl/default.nix6
-rw-r--r--pkgs/development/libraries/termbox/default.nix4
-rw-r--r--pkgs/development/libraries/tevent/default.nix4
-rw-r--r--pkgs/development/libraries/theft/default.nix4
-rw-r--r--pkgs/development/libraries/thrift/0.10.nix4
-rw-r--r--pkgs/development/libraries/thrift/default.nix10
-rw-r--r--pkgs/development/libraries/ti-rpc/default.nix4
-rw-r--r--pkgs/development/libraries/ticpp/default.nix4
-rw-r--r--pkgs/development/libraries/tidyp/default.nix4
-rw-r--r--pkgs/development/libraries/timezonemap/default.nix4
-rw-r--r--pkgs/development/libraries/tinycbor/default.nix4
-rw-r--r--pkgs/development/libraries/tinyobjloader/default.nix4
-rw-r--r--pkgs/development/libraries/tinyxml-2/default.nix6
-rw-r--r--pkgs/development/libraries/tinyxml/2.6.2.nix10
-rw-r--r--pkgs/development/libraries/tix/default.nix6
-rw-r--r--pkgs/development/libraries/tk/8.6.nix4
-rw-r--r--pkgs/development/libraries/tk/generic.nix8
-rw-r--r--pkgs/development/libraries/tl-expected/default.nix4
-rw-r--r--pkgs/development/libraries/tnt/default.nix6
-rw-r--r--pkgs/development/libraries/tntdb/default.nix4
-rw-r--r--pkgs/development/libraries/tntnet/default.nix4
-rw-r--r--pkgs/development/libraries/tokyo-cabinet/default.nix6
-rw-r--r--pkgs/development/libraries/tokyo-tyrant/default.nix6
-rw-r--r--pkgs/development/libraries/totem-pl-parser/default.nix6
-rw-r--r--pkgs/development/libraries/tracker-miners/default.nix6
-rw-r--r--pkgs/development/libraries/tracker/default.nix6
-rw-r--r--pkgs/development/libraries/tre/default.nix6
-rw-r--r--pkgs/development/libraries/tremor/default.nix6
-rw-r--r--pkgs/development/libraries/trompeloeil/default.nix4
-rw-r--r--pkgs/development/libraries/tsocks/default.nix6
-rw-r--r--pkgs/development/libraries/tweeny/default.nix4
-rw-r--r--pkgs/development/libraries/twolame/default.nix4
-rw-r--r--pkgs/development/libraries/ubus/default.nix4
-rw-r--r--pkgs/development/libraries/uci/default.nix4
-rw-r--r--pkgs/development/libraries/ucl/default.nix8
-rw-r--r--pkgs/development/libraries/ucommon/default.nix8
-rw-r--r--pkgs/development/libraries/ucx/default.nix4
-rw-r--r--pkgs/development/libraries/udns/default.nix4
-rw-r--r--pkgs/development/libraries/udunits/default.nix4
-rw-r--r--pkgs/development/libraries/uid_wrapper/default.nix4
-rw-r--r--pkgs/development/libraries/umockdev/default.nix4
-rw-r--r--pkgs/development/libraries/unibilium/default.nix2
-rw-r--r--pkgs/development/libraries/unicap/default.nix4
-rw-r--r--pkgs/development/libraries/unicorn/default.nix4
-rw-r--r--pkgs/development/libraries/unittest-cpp/default.nix6
-rw-r--r--pkgs/development/libraries/unixODBC/default.nix4
-rw-r--r--pkgs/development/libraries/unixODBCDrivers/default.nix10
-rw-r--r--pkgs/development/libraries/unqlite/default.nix4
-rw-r--r--pkgs/development/libraries/uri/default.nix6
-rw-r--r--pkgs/development/libraries/uriparser/default.nix2
-rw-r--r--pkgs/development/libraries/usbredir/default.nix4
-rw-r--r--pkgs/development/libraries/ustr/default.nix4
-rw-r--r--pkgs/development/libraries/utf8cpp/default.nix4
-rw-r--r--pkgs/development/libraries/utf8proc/default.nix4
-rw-r--r--pkgs/development/libraries/uthash/default.nix4
-rw-r--r--pkgs/development/libraries/v8/5_x.nix6
-rw-r--r--pkgs/development/libraries/v8/default.nix8
-rw-r--r--pkgs/development/libraries/vaapi-intel-hybrid/default.nix4
-rw-r--r--pkgs/development/libraries/vaapi-intel/default.nix10
-rw-r--r--pkgs/development/libraries/vaapi-vdpau/default.nix4
-rw-r--r--pkgs/development/libraries/vapoursynth-mvtools/default.nix4
-rw-r--r--pkgs/development/libraries/vapoursynth/default.nix6
-rw-r--r--pkgs/development/libraries/vapoursynth/editor.nix6
-rw-r--r--pkgs/development/libraries/vc/0.7.nix4
-rw-r--r--pkgs/development/libraries/vc/default.nix4
-rw-r--r--pkgs/development/libraries/vcg/default.nix4
-rw-r--r--pkgs/development/libraries/vid-stab/default.nix6
-rw-r--r--pkgs/development/libraries/vigra/default.nix8
-rw-r--r--pkgs/development/libraries/virglrenderer/default.nix4
-rw-r--r--pkgs/development/libraries/vmime/default.nix8
-rw-r--r--pkgs/development/libraries/vmmlib/default.nix6
-rw-r--r--pkgs/development/libraries/vo-amrwbenc/default.nix8
-rw-r--r--pkgs/development/libraries/volume-key/default.nix4
-rw-r--r--pkgs/development/libraries/vrb/default.nix4
-rw-r--r--pkgs/development/libraries/vrpn/default.nix4
-rw-r--r--pkgs/development/libraries/vsqlite/default.nix6
-rw-r--r--pkgs/development/libraries/vte/2.90.nix4
-rw-r--r--pkgs/development/libraries/vte/default.nix4
-rw-r--r--pkgs/development/libraries/vulkan-headers/default.nix4
-rw-r--r--pkgs/development/libraries/vulkan-loader/default.nix4
-rw-r--r--pkgs/development/libraries/vxl/default.nix8
-rw-r--r--pkgs/development/libraries/waffle/default.nix10
-rw-r--r--pkgs/development/libraries/wasilibc/default.nix2
-rw-r--r--pkgs/development/libraries/wavpack/default.nix6
-rw-r--r--pkgs/development/libraries/waylandpp/default.nix8
-rw-r--r--pkgs/development/libraries/wcslib/default.nix6
-rw-r--r--pkgs/development/libraries/webkitgtk/default.nix8
-rw-r--r--pkgs/development/libraries/webrtc-audio-processing/default.nix8
-rw-r--r--pkgs/development/libraries/websocket++/default.nix4
-rw-r--r--pkgs/development/libraries/wildmidi/default.nix4
-rw-r--r--pkgs/development/libraries/wiredtiger/default.nix6
-rw-r--r--pkgs/development/libraries/wlroots/default.nix4
-rw-r--r--pkgs/development/libraries/wolfssl/default.nix6
-rw-r--r--pkgs/development/libraries/wt/default.nix10
-rw-r--r--pkgs/development/libraries/wtk/default.nix4
-rw-r--r--pkgs/development/libraries/wxSVG/default.nix4
-rw-r--r--pkgs/development/libraries/wxsqlite3/default.nix6
-rw-r--r--pkgs/development/libraries/wxsqliteplus/default.nix4
-rw-r--r--pkgs/development/libraries/wxwidgets/2.8/default.nix8
-rw-r--r--pkgs/development/libraries/wxwidgets/2.9/default.nix8
-rw-r--r--pkgs/development/libraries/wxwidgets/3.0/default.nix6
-rw-r--r--pkgs/development/libraries/wxwidgets/3.0/mac.nix4
-rw-r--r--pkgs/development/libraries/wxwidgets/3.1/default.nix6
-rw-r--r--pkgs/development/libraries/x264/default.nix6
-rw-r--r--pkgs/development/libraries/x265/default.nix12
-rw-r--r--pkgs/development/libraries/xalanc/default.nix8
-rw-r--r--pkgs/development/libraries/xapian/default.nix8
-rw-r--r--pkgs/development/libraries/xapian/tools/omega/default.nix4
-rw-r--r--pkgs/development/libraries/xavs/default.nix6
-rw-r--r--pkgs/development/libraries/xbase/default.nix4
-rw-r--r--pkgs/development/libraries/xcb-imdkit/default.nix4
-rw-r--r--pkgs/development/libraries/xcb-util-cursor/HEAD.nix4
-rw-r--r--pkgs/development/libraries/xdg-dbus-proxy/default.nix4
-rw-r--r--pkgs/development/libraries/xdg-desktop-portal-gtk/default.nix4
-rw-r--r--pkgs/development/libraries/xdg-desktop-portal-wlr/default.nix4
-rw-r--r--pkgs/development/libraries/xdg-desktop-portal/default.nix4
-rw-r--r--pkgs/development/libraries/xed/default.nix4
-rw-r--r--pkgs/development/libraries/xercesc/default.nix6
-rw-r--r--pkgs/development/libraries/xgboost/default.nix2
-rw-r--r--pkgs/development/libraries/xine-lib/default.nix4
-rw-r--r--pkgs/development/libraries/xlibs-wrapper/default.nix4
-rw-r--r--pkgs/development/libraries/xlslib/default.nix4
-rw-r--r--pkgs/development/libraries/xml-security-c/default.nix8
-rw-r--r--pkgs/development/libraries/xml-tooling-c/default.nix4
-rw-r--r--pkgs/development/libraries/xmlrpc-c/default.nix4
-rw-r--r--pkgs/development/libraries/xmlsec/default.nix6
-rw-r--r--pkgs/development/libraries/xsd/default.nix8
-rw-r--r--pkgs/development/libraries/xvidcore/default.nix4
-rw-r--r--pkgs/development/libraries/xxHash/default.nix6
-rw-r--r--pkgs/development/libraries/xylib/default.nix4
-rw-r--r--pkgs/development/libraries/yajl/default.nix8
-rw-r--r--pkgs/development/libraries/yojimbo/default.nix4
-rw-r--r--pkgs/development/libraries/yubico-pam/default.nix4
-rw-r--r--pkgs/development/libraries/zchunk/default.nix6
-rw-r--r--pkgs/development/libraries/zeitgeist/default.nix8
-rw-r--r--pkgs/development/libraries/zeroc-ice/3.6.nix2
-rw-r--r--pkgs/development/libraries/zeroc-ice/default.nix2
-rw-r--r--pkgs/development/libraries/zeromq/4.x.nix6
-rw-r--r--pkgs/development/libraries/zimg/default.nix4
-rw-r--r--pkgs/development/libraries/zimlib/default.nix4
-rw-r--r--pkgs/development/libraries/zlib/default.nix32
-rw-r--r--pkgs/development/libraries/zlog/default.nix4
-rw-r--r--pkgs/development/libraries/zmqpp/default.nix4
-rw-r--r--pkgs/development/libraries/zookeeper_mt/default.nix6
-rw-r--r--pkgs/development/libraries/zxcvbn-c/default.nix4
-rw-r--r--pkgs/development/libraries/zziplib/default.nix4
1770 files changed, 4913 insertions, 4912 deletions
diff --git a/pkgs/development/libraries/AntTweakBar/default.nix b/pkgs/development/libraries/AntTweakBar/default.nix
index ab9440c303459..c26672c1dabc8 100644
--- a/pkgs/development/libraries/AntTweakBar/default.nix
+++ b/pkgs/development/libraries/AntTweakBar/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, unzip, xorg, libGLU, libGL }:
+{ lib, stdenv, fetchurl, unzip, xorg, libGLU, libGL }:
 
 stdenv.mkDerivation {
   name = "AntTweakBar-1.16";
@@ -26,8 +26,8 @@ stdenv.mkDerivation {
       to interactively tweak parameters on-screen
     '';
     homepage = "http://anttweakbar.sourceforge.net/";
-    license = stdenv.lib.licenses.zlib;
-    maintainers = [ stdenv.lib.maintainers.razvan ];
-    platforms = stdenv.lib.platforms.linux;
+    license = lib.licenses.zlib;
+    maintainers = [ lib.maintainers.razvan ];
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/development/libraries/CGAL/4.nix b/pkgs/development/libraries/CGAL/4.nix
index ad900744f5459..7028572174ff2 100644
--- a/pkgs/development/libraries/CGAL/4.nix
+++ b/pkgs/development/libraries/CGAL/4.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, boost, gmp, mpfr }:
+{ lib, stdenv, fetchFromGitHub, cmake, boost, gmp, mpfr }:
 
 stdenv.mkDerivation rec {
   version = "4.14.2";
@@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
 
   doCheck = false;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Computational Geometry Algorithms Library";
     homepage = "http://cgal.org";
     license = with licenses; [ gpl3Plus lgpl3Plus];
diff --git a/pkgs/development/libraries/CGAL/default.nix b/pkgs/development/libraries/CGAL/default.nix
index ca3503489868c..7ff9ac43343e1 100644
--- a/pkgs/development/libraries/CGAL/default.nix
+++ b/pkgs/development/libraries/CGAL/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , cmake
 , boost
@@ -26,7 +26,7 @@ stdenv.mkDerivation rec {
 
   doCheck = false;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Computational Geometry Algorithms Library";
     homepage = "http://cgal.org";
     license = with licenses; [ gpl3Plus lgpl3Plus];
diff --git a/pkgs/development/libraries/CoinMP/default.nix b/pkgs/development/libraries/CoinMP/default.nix
index 7adb6e6437e7d..d34b465f135a3 100644
--- a/pkgs/development/libraries/CoinMP/default.nix
+++ b/pkgs/development/libraries/CoinMP/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
   pname = "CoinMP";
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
 
   hardeningDisable = [ "format" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://projects.coin-or.org/CoinMP/";
     description = "COIN-OR lightweight API for COIN-OR libraries CLP, CBC, and CGL";
     platforms = platforms.unix;
diff --git a/pkgs/development/libraries/LAStools/default.nix b/pkgs/development/libraries/LAStools/default.nix
index c231361acb55d..61a39aa8e76da 100644
--- a/pkgs/development/libraries/LAStools/default.nix
+++ b/pkgs/development/libraries/LAStools/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake }:
+{ lib, stdenv, fetchFromGitHub, cmake }:
 
 stdenv.mkDerivation rec {
   pname = "LAStools";
@@ -23,7 +23,7 @@ stdenv.mkDerivation rec {
     cmake
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Software for rapid LiDAR processing";
     homepage = http://lastools.org/;
     license = licenses.unfree;
diff --git a/pkgs/development/libraries/LASzip/LASzip2.nix b/pkgs/development/libraries/LASzip/LASzip2.nix
index 2eb3096312891..b080153826ad1 100644
--- a/pkgs/development/libraries/LASzip/LASzip2.nix
+++ b/pkgs/development/libraries/LASzip/LASzip2.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, cmake }:
+{ lib, stdenv, fetchurl, cmake }:
 
 stdenv.mkDerivation rec {
   version = "2.2.0";
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ cmake ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Turn quickly bulky LAS files into compact LAZ files without information loss";
     homepage = "https://laszip.org";
     license = licenses.lgpl2;
diff --git a/pkgs/development/libraries/LASzip/default.nix b/pkgs/development/libraries/LASzip/default.nix
index 0300aa37f0f97..f170ea44c0eea 100644
--- a/pkgs/development/libraries/LASzip/default.nix
+++ b/pkgs/development/libraries/LASzip/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake }:
+{ lib, stdenv, fetchFromGitHub, cmake }:
 
 stdenv.mkDerivation rec {
   version = "3.4.3";
@@ -18,8 +18,8 @@ stdenv.mkDerivation rec {
   meta = {
     description = "Turn quickly bulky LAS files into compact LAZ files without information loss";
     homepage = "https://laszip.org";
-    license = stdenv.lib.licenses.lgpl2;
-    maintainers = [ stdenv.lib.maintainers.michelk ];
-    platforms = stdenv.lib.platforms.unix;
+    license = lib.licenses.lgpl2;
+    maintainers = [ lib.maintainers.michelk ];
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/NSPlist/default.nix b/pkgs/development/libraries/NSPlist/default.nix
index 9cf5e91954803..1b8ae939ecaa6 100644
--- a/pkgs/development/libraries/NSPlist/default.nix
+++ b/pkgs/development/libraries/NSPlist/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake }:
+{ lib, stdenv, fetchFromGitHub, cmake }:
 
 stdenv.mkDerivation {
   name = "NSPlist-713decf";
@@ -12,7 +12,7 @@ stdenv.mkDerivation {
 
   nativeBuildInputs = [ cmake ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     maintainers = with maintainers; [ matthewbauer ];
     description = "Parses .plist files";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/PlistCpp/default.nix b/pkgs/development/libraries/PlistCpp/default.nix
index 3501fa8b4358d..f7c47805748ed 100644
--- a/pkgs/development/libraries/PlistCpp/default.nix
+++ b/pkgs/development/libraries/PlistCpp/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, boost, NSPlist, pugixml }:
+{ lib, stdenv, fetchFromGitHub, cmake, boost, NSPlist, pugixml }:
 
 stdenv.mkDerivation {
   name = "PlistCpp-11615d";
@@ -13,7 +13,7 @@ stdenv.mkDerivation {
   nativeBuildInputs = [ cmake ];
   buildInputs = [ boost NSPlist pugixml ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     maintainers = with maintainers; [ matthewbauer ];
     description = "CPP bindings for Plist";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/SDL/default.nix b/pkgs/development/libraries/SDL/default.nix
index e13c94bcb6e2e..252d38d1192eb 100644
--- a/pkgs/development/libraries/SDL/default.nix
+++ b/pkgs/development/libraries/SDL/default.nix
@@ -1,5 +1,5 @@
-{ stdenv, config, fetchurl, fetchpatch, pkg-config, audiofile, libcap, libiconv
-, libGLSupported ? stdenv.lib.elem stdenv.hostPlatform.system stdenv.lib.platforms.mesaPlatforms
+{ lib, stdenv, config, fetchurl, fetchpatch, pkg-config, audiofile, libcap, libiconv
+, libGLSupported ? lib.elem stdenv.hostPlatform.system stdenv.lib.platforms.mesaPlatforms
 , openglSupport ? libGLSupported, libGL, libGLU
 , alsaSupport ? stdenv.isLinux && !stdenv.hostPlatform.isAndroid, alsaLib
 , x11Support ? !stdenv.isCygwin && !stdenv.hostPlatform.isAndroid
@@ -11,7 +11,7 @@
 # NOTE: When editing this expression see if the same change applies to
 # SDL2 expression too
 
-with stdenv.lib;
+with lib;
 
 let
   extraPropagatedBuildInputs = [ ]
@@ -124,7 +124,7 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A cross-platform multimedia library";
     homepage    = "http://www.libsdl.org/";
     maintainers = with maintainers; [ lovek323 ];
diff --git a/pkgs/development/libraries/SDL2/default.nix b/pkgs/development/libraries/SDL2/default.nix
index 1fa021feb85f1..ddde76cac643a 100644
--- a/pkgs/development/libraries/SDL2/default.nix
+++ b/pkgs/development/libraries/SDL2/default.nix
@@ -1,5 +1,5 @@
-{ stdenv, config, fetchurl, pkg-config
-, libGLSupported ? stdenv.lib.elem stdenv.hostPlatform.system stdenv.lib.platforms.mesaPlatforms
+{ lib, stdenv, config, fetchurl, pkg-config
+, libGLSupported ? lib.elem stdenv.hostPlatform.system stdenv.lib.platforms.mesaPlatforms
 , openglSupport ? libGLSupported, libGL
 , alsaSupport ? stdenv.isLinux && !stdenv.hostPlatform.isAndroid, alsaLib
 , x11Support ? !stdenv.isCygwin && !stdenv.hostPlatform.isAndroid
@@ -21,7 +21,7 @@
 # NOTE: When editing this expression see if the same change applies to
 # SDL expression too
 
-with stdenv.lib;
+with lib;
 
 stdenv.mkDerivation rec {
   pname = "SDL2";
@@ -126,7 +126,7 @@ stdenv.mkDerivation rec {
 
   passthru = { inherit openglSupport; };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A cross-platform multimedia library";
     homepage = "http://www.libsdl.org/";
     license = licenses.zlib;
diff --git a/pkgs/development/libraries/SDL2_gfx/default.nix b/pkgs/development/libraries/SDL2_gfx/default.nix
index 1ed56c6750ffb..2da2189b1a879 100644
--- a/pkgs/development/libraries/SDL2_gfx/default.nix
+++ b/pkgs/development/libraries/SDL2_gfx/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, darwin, fetchurl, SDL2 }:
+{ lib, stdenv, darwin, fetchurl, SDL2 }:
 
 stdenv.mkDerivation rec {
   pname = "SDL2_gfx";
@@ -10,12 +10,12 @@ stdenv.mkDerivation rec {
   };
 
   buildInputs = [ SDL2 ]
-    ++ stdenv.lib.optional stdenv.isDarwin darwin.libobjc;
+    ++ lib.optional stdenv.isDarwin darwin.libobjc;
 
   configureFlags = [(if stdenv.isi686 || stdenv.isx86_64 then "--enable-mmx" else "--disable-mmx")]
-     ++ stdenv.lib.optional stdenv.isDarwin "--disable-sdltest";
+     ++ lib.optional stdenv.isDarwin "--disable-sdltest";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "SDL graphics drawing primitives and support functions";
 
     longDescription = ''
diff --git a/pkgs/development/libraries/SDL2_image/default.nix b/pkgs/development/libraries/SDL2_image/default.nix
index 00de774ba6e32..96f85ddb0ea51 100644
--- a/pkgs/development/libraries/SDL2_image/default.nix
+++ b/pkgs/development/libraries/SDL2_image/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, SDL2, libpng, libjpeg, libtiff, libungif, libwebp, libXpm, zlib, Foundation }:
+{ lib, stdenv, fetchurl, SDL2, libpng, libjpeg, libtiff, libungif, libwebp, libXpm, zlib, Foundation }:
 
 stdenv.mkDerivation rec {
   pname = "SDL2_image";
@@ -10,14 +10,14 @@ stdenv.mkDerivation rec {
   };
 
   buildInputs = [ SDL2 libpng libjpeg libtiff libungif libwebp libXpm zlib ]
-    ++ stdenv.lib.optional stdenv.isDarwin Foundation;
+    ++ lib.optional stdenv.isDarwin Foundation;
 
 
-  configureFlags = stdenv.lib.optional stdenv.isDarwin "--disable-sdltest";
+  configureFlags = lib.optional stdenv.isDarwin "--disable-sdltest";
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "SDL image library";
     homepage = "http://www.libsdl.org/projects/SDL_image/";
     platforms = platforms.unix;
diff --git a/pkgs/development/libraries/SDL2_mixer/default.nix b/pkgs/development/libraries/SDL2_mixer/default.nix
index af0da7dc62705..7e1d097ba5cb9 100644
--- a/pkgs/development/libraries/SDL2_mixer/default.nix
+++ b/pkgs/development/libraries/SDL2_mixer/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , pkg-config
 , AudioToolbox
@@ -26,7 +26,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ pkg-config ];
 
-  buildInputs = stdenv.lib.optionals stdenv.isDarwin [
+  buildInputs = lib.optionals stdenv.isDarwin [
     AudioToolbox
     AudioUnit
     CoreServices
@@ -51,12 +51,12 @@ stdenv.mkDerivation rec {
     "--disable-music-mp3-mpg123-shared"
     "--disable-music-opus-shared"
     "--disable-music-midi-fluidsynth-shared"
-  ] ++ stdenv.lib.optionals stdenv.isDarwin [
+  ] ++ lib.optionals stdenv.isDarwin [
     "--disable-sdltest"
     "--disable-smpegtest"
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "SDL multi-channel audio mixer library";
     platforms = platforms.unix;
     homepage = "https://www.libsdl.org/projects/SDL_mixer/";
diff --git a/pkgs/development/libraries/SDL2_net/default.nix b/pkgs/development/libraries/SDL2_net/default.nix
index 0bec12cdb24b5..fe6cb9445a396 100644
--- a/pkgs/development/libraries/SDL2_net/default.nix
+++ b/pkgs/development/libraries/SDL2_net/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, darwin, fetchurl, SDL2 }:
+{ lib, stdenv, darwin, fetchurl, SDL2 }:
 
 stdenv.mkDerivation rec {
   pname = "SDL2_net";
@@ -9,13 +9,13 @@ stdenv.mkDerivation rec {
     sha256 = "08cxc1bicmyk89kiks7izw1rlx5ng5n6xpy8fy0zxni3b9z8mkhm";
   };
 
-  buildInputs = stdenv.lib.optional stdenv.isDarwin darwin.libobjc;
+  buildInputs = lib.optional stdenv.isDarwin darwin.libobjc;
 
-  configureFlags = stdenv.lib.optional stdenv.isDarwin "--disable-sdltest";
+  configureFlags = lib.optional stdenv.isDarwin "--disable-sdltest";
 
   propagatedBuildInputs = [ SDL2 ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "SDL multiplatform networking library";
     homepage = "https://www.libsdl.org/projects/SDL_net";
     license = licenses.zlib;
diff --git a/pkgs/development/libraries/SDL2_ttf/default.nix b/pkgs/development/libraries/SDL2_ttf/default.nix
index 571c953a81bc4..e23b3fb921505 100644
--- a/pkgs/development/libraries/SDL2_ttf/default.nix
+++ b/pkgs/development/libraries/SDL2_ttf/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, darwin, fetchurl, SDL2, freetype, libGL }:
+{ lib, stdenv, darwin, fetchurl, SDL2, freetype, libGL }:
 
 stdenv.mkDerivation rec {
   pname = "SDL2_ttf";
@@ -9,12 +9,12 @@ stdenv.mkDerivation rec {
     sha256 = "0cyd48dipc0m399qy8s03lci8b0bpiy8xlkvrm2ia7wcv0dfpv59";
   };
 
-  configureFlags = stdenv.lib.optional stdenv.isDarwin "--disable-sdltest";
+  configureFlags = lib.optional stdenv.isDarwin "--disable-sdltest";
 
   buildInputs = [ SDL2 freetype libGL ]
-    ++ stdenv.lib.optional stdenv.isDarwin darwin.libobjc;
+    ++ lib.optional stdenv.isDarwin darwin.libobjc;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "SDL TrueType library";
     platforms = platforms.unix;
     license = licenses.zlib;
diff --git a/pkgs/development/libraries/SDL_Pango/default.nix b/pkgs/development/libraries/SDL_Pango/default.nix
index f5191a116c97e..83afeaf2d67bd 100644
--- a/pkgs/development/libraries/SDL_Pango/default.nix
+++ b/pkgs/development/libraries/SDL_Pango/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchpatch, fetchurl, SDL, autoreconfHook, pango, pkg-config }:
+{ lib, stdenv, fetchpatch, fetchurl, SDL, autoreconfHook, pango, pkg-config }:
 
 stdenv.mkDerivation rec {
   pname = "SDL_Pango";
@@ -22,7 +22,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ pkg-config autoreconfHook ];
   buildInputs = [ SDL pango ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Connects the Pango rendering engine to SDL";
     license = licenses.lgpl21Plus;
     platforms = platforms.all;
diff --git a/pkgs/development/libraries/SDL_gfx/default.nix b/pkgs/development/libraries/SDL_gfx/default.nix
index 606820120dc0f..f5a3d86355316 100644
--- a/pkgs/development/libraries/SDL_gfx/default.nix
+++ b/pkgs/development/libraries/SDL_gfx/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, SDL }:
+{ lib, stdenv, fetchurl, SDL }:
 
 stdenv.mkDerivation rec {
   pname = "SDL_gfx";
@@ -12,9 +12,9 @@ stdenv.mkDerivation rec {
   buildInputs = [ SDL ] ;
 
   configureFlags = [ "--disable-mmx" ]
-    ++ stdenv.lib.optional stdenv.isDarwin "--disable-sdltest";
+    ++ lib.optional stdenv.isDarwin "--disable-sdltest";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "SDL graphics drawing primitives and support functions";
 
     longDescription = ''
diff --git a/pkgs/development/libraries/SDL_gpu/default.nix b/pkgs/development/libraries/SDL_gpu/default.nix
index f15009c2f5d9e..dc52e6afeea77 100644
--- a/pkgs/development/libraries/SDL_gpu/default.nix
+++ b/pkgs/development/libraries/SDL_gpu/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, SDL2, libGLU }:
+{ lib, stdenv, fetchFromGitHub, cmake, SDL2, libGLU }:
 
 stdenv.mkDerivation {
   pname = "SDL_gpu-unstable";
@@ -26,7 +26,7 @@ stdenv.mkDerivation {
     sed -ie '213s#''${OUTPUT_DIR}/lib#''${CMAKE_INSTALL_LIBDIR}#' src/CMakeLists.txt
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A library for high-performance, modern 2D graphics with SDL written in C";
     homepage = "https://github.com/grimfang4/sdl-gpu";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/SDL_image/default.nix b/pkgs/development/libraries/SDL_image/default.nix
index 968fc3d38af88..2e5841b3f482e 100644
--- a/pkgs/development/libraries/SDL_image/default.nix
+++ b/pkgs/development/libraries/SDL_image/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, fetchpatch, SDL, libpng, libjpeg, libtiff, libungif, libXpm }:
+{ lib, stdenv, fetchurl, fetchpatch, SDL, libpng, libjpeg, libtiff, libungif, libXpm }:
 
 stdenv.mkDerivation rec {
   pname = "SDL_image";
@@ -22,11 +22,11 @@ stdenv.mkDerivation rec {
     "--disable-jpg-shared"
     "--disable-png-shared"
     "--disable-tif-shared"
-  ] ++ stdenv.lib.optional stdenv.isDarwin "--disable-sdltest";
+  ] ++ lib.optional stdenv.isDarwin "--disable-sdltest";
 
   buildInputs = [ SDL libpng libjpeg libtiff libungif libXpm ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "SDL image library";
     homepage    = "http://www.libsdl.org/projects/SDL_image/";
     maintainers = with maintainers; [ lovek323 ];
diff --git a/pkgs/development/libraries/SDL_mixer/default.nix b/pkgs/development/libraries/SDL_mixer/default.nix
index e52273052b530..7f5e38f39b8d0 100644
--- a/pkgs/development/libraries/SDL_mixer/default.nix
+++ b/pkgs/development/libraries/SDL_mixer/default.nix
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
     ++ lib.optional enableNativeMidi " --enable-music-native-midi-gpl"
     ++ lib.optionals stdenv.isDarwin [ "--disable-sdltest" "--disable-smpegtest" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "SDL multi-channel audio mixer library";
     homepage    = "http://www.libsdl.org/projects/SDL_mixer/";
     maintainers = with maintainers; [ lovek323 ];
diff --git a/pkgs/development/libraries/SDL_net/default.nix b/pkgs/development/libraries/SDL_net/default.nix
index a24020da01576..f55332a0ee0e0 100644
--- a/pkgs/development/libraries/SDL_net/default.nix
+++ b/pkgs/development/libraries/SDL_net/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, SDL }:
+{ lib, stdenv, fetchurl, SDL }:
 
 stdenv.mkDerivation rec {
   pname = "SDL_net";
@@ -9,11 +9,11 @@ stdenv.mkDerivation rec {
     sha256 = "1d5c9xqlf4s1c01gzv6cxmg0r621pq9kfgxcg3197xw4p25pljjz";
   };
 
-  configureFlags = stdenv.lib.optional stdenv.isDarwin "--disable-sdltest";
+  configureFlags = lib.optional stdenv.isDarwin "--disable-sdltest";
 
   propagatedBuildInputs = [ SDL ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "SDL networking library";
     platforms = platforms.unix;
     license = licenses.zlib;
diff --git a/pkgs/development/libraries/SDL_sixel/default.nix b/pkgs/development/libraries/SDL_sixel/default.nix
index a1e4dda68786f..1bc4c8ba35c04 100644
--- a/pkgs/development/libraries/SDL_sixel/default.nix
+++ b/pkgs/development/libraries/SDL_sixel/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, pkg-config, libsixel }:
+{ lib, stdenv, fetchFromGitHub, pkg-config, libsixel }:
 
 stdenv.mkDerivation {
   pname = "SDL_sixel";
@@ -16,7 +16,7 @@ stdenv.mkDerivation {
   nativeBuildInputs = [ pkg-config ];
   buildInputs = [ libsixel ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A cross-platform multimedia library, that supports sixel graphics on consoles";
     homepage    = "https://github.com/saitoha/SDL1.2-SIXEL";
     maintainers = with maintainers; [ vrthra ];
diff --git a/pkgs/development/libraries/SDL_stretch/default.nix b/pkgs/development/libraries/SDL_stretch/default.nix
index 1f068c9e9768e..e6318b84859ea 100644
--- a/pkgs/development/libraries/SDL_stretch/default.nix
+++ b/pkgs/development/libraries/SDL_stretch/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, SDL }:
+{ lib, stdenv, fetchurl, SDL }:
 
 stdenv.mkDerivation rec {
   pname = "SDL_stretch";
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ SDL ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
      description = "Stretch Functions For SDL";
      homepage = "http://sdl-stretch.sourceforge.net/";
      license = licenses.lgpl2;
diff --git a/pkgs/development/libraries/SDL_ttf/default.nix b/pkgs/development/libraries/SDL_ttf/default.nix
index cd6355c9ce2bf..5d353e3a6c0dd 100644
--- a/pkgs/development/libraries/SDL_ttf/default.nix
+++ b/pkgs/development/libraries/SDL_ttf/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, fetchpatch, SDL, freetype }:
+{ lib, stdenv, fetchurl, fetchpatch, SDL, freetype }:
 
 stdenv.mkDerivation rec {
   pname = "SDL_ttf";
@@ -21,9 +21,9 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ SDL freetype ];
 
-  configureFlags = stdenv.lib.optional stdenv.isDarwin "--disable-sdltest";
+  configureFlags = lib.optional stdenv.isDarwin "--disable-sdltest";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "SDL TrueType library";
     license = licenses.zlib;
     platforms = platforms.all;
diff --git a/pkgs/development/libraries/Xaw3d/default.nix b/pkgs/development/libraries/Xaw3d/default.nix
index 10d954397ff1a..88501ca1ee60d 100644
--- a/pkgs/development/libraries/Xaw3d/default.nix
+++ b/pkgs/development/libraries/Xaw3d/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl
+{ lib, stdenv, fetchurl
 , imake, gccmakedep, bison, flex, pkg-config
 , xlibsWrapper, libXmu, libXpm, libXp }:
 
@@ -13,9 +13,9 @@ stdenv.mkDerivation {
   buildInputs = [ libXpm libXp ];
   propagatedBuildInputs = [ xlibsWrapper libXmu ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "3D widget set based on the Athena Widget set";
-    platforms = stdenv.lib.platforms.unix;
+    platforms = lib.platforms.unix;
     license = licenses.mit;
   };
 }
diff --git a/pkgs/development/libraries/a52dec/default.nix b/pkgs/development/libraries/a52dec/default.nix
index 7cbb369940138..faa819ec56156 100644
--- a/pkgs/development/libraries/a52dec/default.nix
+++ b/pkgs/development/libraries/a52dec/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl}:
+{lib, stdenv, fetchurl}:
 
 stdenv.mkDerivation rec {
   pname = "a52dec";
@@ -15,11 +15,11 @@ stdenv.mkDerivation rec {
 
   # fails 1 out of 1 tests with "BAD GLOBAL SYMBOLS" on i686
   # which can also be fixed with
-  # hardeningDisable = stdenv.lib.optional stdenv.isi686 "pic";
+  # hardeningDisable = lib.optional stdenv.isi686 "pic";
   # but it's better to disable tests than loose ASLR on i686
   doCheck = !stdenv.isi686;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "ATSC A/52 stream decoder";
     homepage = "https://liba52.sourceforge.net/";
     platforms = platforms.unix;
diff --git a/pkgs/development/libraries/aalib/default.nix b/pkgs/development/libraries/aalib/default.nix
index 94453264419c0..b007e71ce44d7 100644
--- a/pkgs/development/libraries/aalib/default.nix
+++ b/pkgs/development/libraries/aalib/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, ncurses, automake}:
+{lib, stdenv, fetchurl, ncurses, automake}:
 
 stdenv.mkDerivation {
   name = "aalib-1.4rc5";
@@ -11,7 +11,7 @@ stdenv.mkDerivation {
   outputs = [ "bin" "dev" "out" "man" "info" ];
   setOutputFlags = false; # Doesn't support all the flags
 
-  patches = stdenv.lib.optionals stdenv.isDarwin [ ./darwin.patch ];
+  patches = lib.optionals stdenv.isDarwin [ ./darwin.patch ];
 
   # The fuloong2f is not supported by aalib still
   preConfigure = ''
@@ -35,7 +35,7 @@ stdenv.mkDerivation {
 
   meta = {
     description = "ASCII art graphics library";
-    platforms = stdenv.lib.platforms.unix;
-    license = stdenv.lib.licenses.lgpl2;
+    platforms = lib.platforms.unix;
+    license = lib.licenses.lgpl2;
   };
 }
diff --git a/pkgs/development/libraries/abseil-cpp/default.nix b/pkgs/development/libraries/abseil-cpp/default.nix
index 45e73410d28ee..95d1b873edd3d 100644
--- a/pkgs/development/libraries/abseil-cpp/default.nix
+++ b/pkgs/development/libraries/abseil-cpp/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake }:
+{ lib, stdenv, fetchFromGitHub, cmake }:
 
 stdenv.mkDerivation rec {
   pname = "abseil-cpp";
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ cmake ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "An open-source collection of C++ code designed to augment the C++ standard library";
     homepage = "https://abseil.io/";
     license = licenses.asl20;
diff --git a/pkgs/development/libraries/accountsservice/default.nix b/pkgs/development/libraries/accountsservice/default.nix
index 362605d105076..f87a0bbe68baa 100644
--- a/pkgs/development/libraries/accountsservice/default.nix
+++ b/pkgs/development/libraries/accountsservice/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , fetchpatch
 , substituteAll
@@ -84,7 +84,7 @@ stdenv.mkDerivation rec {
     })
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "D-Bus interface for user account query and manipulation";
     homepage = "https://www.freedesktop.org/wiki/Software/AccountsService";
     license = licenses.gpl3;
diff --git a/pkgs/development/libraries/ace/default.nix b/pkgs/development/libraries/ace/default.nix
index 0fe777b7b2b04..85df0b4335394 100644
--- a/pkgs/development/libraries/ace/default.nix
+++ b/pkgs/development/libraries/ace/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, libtool, perl }:
+{ lib, stdenv, fetchurl, pkg-config, libtool, perl }:
 
 stdenv.mkDerivation rec {
   pname = "ace";
@@ -30,7 +30,7 @@ stdenv.mkDerivation rec {
     > include/makeinclude/platform_macros.GNU
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "ADAPTIVE Communication Environment";
     homepage = "http://www.dre.vanderbilt.edu/~schmidt/ACE.html";
     license = licenses.doc;
diff --git a/pkgs/development/libraries/acl/default.nix b/pkgs/development/libraries/acl/default.nix
index 6e863e4eebabe..2161ad9e59c3f 100644
--- a/pkgs/development/libraries/acl/default.nix
+++ b/pkgs/development/libraries/acl/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, gettext, attr }:
+{ lib, stdenv, fetchurl, gettext, attr }:
 
 # Note: this package is used for bootstrapping fetchurl, and thus
 # cannot use fetchpatch! All mutable patches (generated by GitHub or
@@ -27,7 +27,7 @@ stdenv.mkDerivation rec {
     patchShebangs .
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://savannah.nongnu.org/projects/acl";
     description = "Library and tools for manipulating access control lists";
     platforms = platforms.linux;
diff --git a/pkgs/development/libraries/afflib/default.nix b/pkgs/development/libraries/afflib/default.nix
index 030ff73f97f8e..b89683ac0539b 100644
--- a/pkgs/development/libraries/afflib/default.nix
+++ b/pkgs/development/libraries/afflib/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, zlib, curl, expat, fuse, openssl
+{ lib, stdenv, fetchFromGitHub, zlib, curl, expat, fuse, openssl
 , autoreconfHook, python3
 }:
 
@@ -15,14 +15,14 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ autoreconfHook ];
   buildInputs = [ zlib curl expat openssl python3 ]
-    ++ stdenv.lib.optionals stdenv.isLinux [ fuse ];
+    ++ lib.optionals stdenv.isLinux [ fuse ];
 
   meta = {
     homepage = "http://afflib.sourceforge.net/";
     description = "Advanced forensic format library";
-    platforms = stdenv.lib.platforms.unix;
-    license = stdenv.lib.licenses.bsdOriginal;
-    maintainers = [ stdenv.lib.maintainers.raskin ];
+    platforms = lib.platforms.unix;
+    license = lib.licenses.bsdOriginal;
+    maintainers = [ lib.maintainers.raskin ];
     inherit version;
     downloadPage = "https://github.com/sshock/AFFLIBv3/tags";
   };
diff --git a/pkgs/development/libraries/aften/default.nix b/pkgs/development/libraries/aften/default.nix
index d50cbe26e5605..1ae5ffb17ad30 100644
--- a/pkgs/development/libraries/aften/default.nix
+++ b/pkgs/development/libraries/aften/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, cmake }:
+{ lib, stdenv, fetchurl, cmake }:
 
 stdenv.mkDerivation rec {
   pname = "aften";
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
   meta = {
     description = "An audio encoder which generates compressed audio streams based on ATSC A/52 specification";
     homepage = "http://aften.sourceforge.net/";
-    license = stdenv.lib.licenses.lgpl2;
+    license = lib.licenses.lgpl2;
     platforms = [ "i686-linux" "x86_64-linux" "x86_64-darwin" ];
   };
 }
diff --git a/pkgs/development/libraries/agda/agda-prelude/default.nix b/pkgs/development/libraries/agda/agda-prelude/default.nix
index f13cc69823654..79bb783cc9ffb 100644
--- a/pkgs/development/libraries/agda/agda-prelude/default.nix
+++ b/pkgs/development/libraries/agda/agda-prelude/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, mkDerivation, fetchFromGitHub }:
+{ lib, stdenv, mkDerivation, fetchFromGitHub }:
 
 mkDerivation rec {
   version = "compat-2.6.1";
@@ -18,11 +18,11 @@ mkDerivation rec {
     cd ..
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/UlfNorell/agda-prelude";
     description = "Programming library for Agda";
-    license = stdenv.lib.licenses.mit;
-    platforms = stdenv.lib.platforms.unix;
+    license = lib.licenses.mit;
+    platforms = lib.platforms.unix;
     maintainers = with maintainers; [ mudri alexarice turion ];
   };
 }
diff --git a/pkgs/development/libraries/agda/functional-linear-algebra/default.nix b/pkgs/development/libraries/agda/functional-linear-algebra/default.nix
index dbcdaac532ec1..7ec892bfe0232 100644
--- a/pkgs/development/libraries/agda/functional-linear-algebra/default.nix
+++ b/pkgs/development/libraries/agda/functional-linear-algebra/default.nix
@@ -13,7 +13,7 @@ mkDerivation rec {
     sha256 = "09ri3jmgp9jjwi1mzv4c3w6rvcmyx6spa2qxpwlcn0f4bmfva6wm";
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/ryanorendorff/functional-linear-algebra";
     description = ''
       Formalizing linear algebra in Agda by representing matrices as functions
diff --git a/pkgs/development/libraries/agda/iowa-stdlib/default.nix b/pkgs/development/libraries/agda/iowa-stdlib/default.nix
index 55cd6a742e54d..2ebb3f66ed088 100644
--- a/pkgs/development/libraries/agda/iowa-stdlib/default.nix
+++ b/pkgs/development/libraries/agda/iowa-stdlib/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, mkDerivation, fetchFromGitHub }:
+{ lib, stdenv, mkDerivation, fetchFromGitHub }:
 
 mkDerivation (rec {
   version = "1.5.0";
@@ -22,10 +22,10 @@ mkDerivation (rec {
   meta = {
     homepage = "https://github.com/cedille/ial";
     description = "Agda standard library developed at Iowa";
-    license = stdenv.lib.licenses.free;
-    platforms = stdenv.lib.platforms.unix;
+    license = lib.licenses.free;
+    platforms = lib.platforms.unix;
     # broken since Agda 2.6.1
     broken = true;
-    maintainers = with stdenv.lib.maintainers; [ alexarice turion ];
+    maintainers = with lib.maintainers; [ alexarice turion ];
   };
 })
diff --git a/pkgs/development/libraries/agda/standard-library/default.nix b/pkgs/development/libraries/agda/standard-library/default.nix
index e43e1bad3b6c1..1d8dc03bbde95 100644
--- a/pkgs/development/libraries/agda/standard-library/default.nix
+++ b/pkgs/development/libraries/agda/standard-library/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, mkDerivation, fetchFromGitHub, ghcWithPackages }:
+{ lib, stdenv, mkDerivation, fetchFromGitHub, ghcWithPackages }:
 
 mkDerivation rec {
   pname = "standard-library";
@@ -16,11 +16,11 @@ mkDerivation rec {
     runhaskell GenerateEverything.hs
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://wiki.portal.chalmers.se/agda/pmwiki.php?n=Libraries.StandardLibrary";
     description = "A standard library for use with the Agda compiler";
-    license = stdenv.lib.licenses.mit;
-    platforms = stdenv.lib.platforms.unix;
+    license = lib.licenses.mit;
+    platforms = lib.platforms.unix;
     maintainers = with maintainers; [ jwiegley mudri alexarice turion ];
   };
 }
diff --git a/pkgs/development/libraries/agg/default.nix b/pkgs/development/libraries/agg/default.nix
index 2b083a47a20b0..89585d908da4c 100644
--- a/pkgs/development/libraries/agg/default.nix
+++ b/pkgs/development/libraries/agg/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, autoconf, automake, libtool, pkg-config
+{ lib, stdenv, fetchurl, autoconf, automake, libtool, pkg-config
 , freetype, SDL, libX11 }:
 
 stdenv.mkDerivation rec {
@@ -40,8 +40,8 @@ stdenv.mkDerivation rec {
       of course, AGG can do much more than that.
     '';
 
-    license = stdenv.lib.licenses.gpl2Plus;
+    license = lib.licenses.gpl2Plus;
     homepage = "http://www.antigrain.com/";
-    platforms = stdenv.lib.platforms.linux;
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/development/libraries/alembic/default.nix b/pkgs/development/libraries/alembic/default.nix
index db22f463df003..cdcf4b7b8a49f 100644
--- a/pkgs/development/libraries/alembic/default.nix
+++ b/pkgs/development/libraries/alembic/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, unzip, cmake, openexr, hdf5-threadsafe }:
+{ lib, stdenv, fetchFromGitHub, unzip, cmake, openexr, hdf5-threadsafe }:
 
 stdenv.mkDerivation rec
 {
@@ -34,7 +34,7 @@ stdenv.mkDerivation rec
     mv $out/include $dev/
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "An open framework for storing and sharing scene data";
     homepage = "http://alembic.io/";
     license = licenses.bsd3;
diff --git a/pkgs/development/libraries/allegro/5.nix b/pkgs/development/libraries/allegro/5.nix
index 20175486b1602..ca1446dd93520 100644
--- a/pkgs/development/libraries/allegro/5.nix
+++ b/pkgs/development/libraries/allegro/5.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, fetchpatch, texinfo, libXext, xorgproto, libX11
+{ lib, stdenv, fetchFromGitHub, fetchpatch, texinfo, libXext, xorgproto, libX11
 , libXpm, libXt, libXcursor, alsaLib, cmake, zlib, libpng, libvorbis
 , libXxf86dga, libXxf86misc
 , libXxf86vm, openal, libGLU, libGL, libjpeg, flac
@@ -34,7 +34,7 @@ stdenv.mkDerivation rec {
 
   cmakeFlags = [ "-DCMAKE_SKIP_RPATH=ON" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A game programming library";
     homepage = "https://liballeg.org/";
     license = licenses.zlib;
diff --git a/pkgs/development/libraries/allegro/default.nix b/pkgs/development/libraries/allegro/default.nix
index 99d75225036ec..9fefbe01ace0a 100644
--- a/pkgs/development/libraries/allegro/default.nix
+++ b/pkgs/development/libraries/allegro/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, texinfo6_5, libXext, xorgproto, libX11
+{ lib, stdenv, fetchurl, texinfo6_5, libXext, xorgproto, libX11
 , libXpm, libXt, libXcursor, alsaLib, cmake, zlib, libpng, libvorbis
 , libXxf86dga, libXxf86misc
 , libXxf86vm, openal, libGLU, libGL }:
@@ -27,7 +27,7 @@ stdenv.mkDerivation rec {
 
   cmakeFlags = [ "-DCMAKE_SKIP_RPATH=ON" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A game programming library";
     homepage = "https://liballeg.org/";
     license = licenses.free; # giftware
diff --git a/pkgs/development/libraries/alure/default.nix b/pkgs/development/libraries/alure/default.nix
index 1f4dafeb36283..9ff83dcec404d 100644
--- a/pkgs/development/libraries/alure/default.nix
+++ b/pkgs/development/libraries/alure/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, cmake, openal }:
+{ lib, stdenv, fetchurl, cmake, openal }:
 
 stdenv.mkDerivation rec {
   pname = "alure";
@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ cmake ];
   buildInputs = [ openal ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A utility library to help manage common tasks with OpenAL applications";
     homepage = "https://kcat.strangesoft.net/alure.html";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/alure2/default.nix b/pkgs/development/libraries/alure2/default.nix
index 6da95a7726484..fa42c4fd53a3d 100644
--- a/pkgs/development/libraries/alure2/default.nix
+++ b/pkgs/development/libraries/alure2/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, openal, libvorbis, opusfile, libsndfile }:
+{ lib, stdenv, fetchFromGitHub, cmake, openal, libvorbis, opusfile, libsndfile }:
 
 stdenv.mkDerivation rec {
   pname = "alure2";
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ cmake ];
   buildInputs = [ openal libvorbis opusfile libsndfile ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A utility library for OpenAL, providing a C++ API and managing common tasks that include file loading, caching, and streaming";
     homepage = "https://github.com/kcat/alure";
     license = licenses.zlib;
diff --git a/pkgs/development/libraries/amdvlk/default.nix b/pkgs/development/libraries/amdvlk/default.nix
index b4731b608dcd8..fb48ef73905bc 100644
--- a/pkgs/development/libraries/amdvlk/default.nix
+++ b/pkgs/development/libraries/amdvlk/default.nix
@@ -66,7 +66,7 @@ in stdenv.mkDerivation rec {
   cmakeDir = "../drivers/xgl";
 
   # LTO is disabled in gcc for i686 as of #66528
-  cmakeFlags = stdenv.lib.optionals stdenv.is32bit ["-DXGL_ENABLE_LTO=OFF"];
+  cmakeFlags = lib.optionals stdenv.is32bit ["-DXGL_ENABLE_LTO=OFF"];
 
   installPhase = ''
     install -Dm755 -t $out/lib icd/amdvlk${suffix}.so
@@ -83,7 +83,7 @@ in stdenv.mkDerivation rec {
   # Keep the rpath, otherwise vulkaninfo and vkcube segfault
   dontPatchELF = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "AMD Open Source Driver For Vulkan";
     homepage = "https://github.com/GPUOpen-Drivers/AMDVLK";
     changelog = "https://github.com/GPUOpen-Drivers/AMDVLK/releases/tag/v-${version}";
diff --git a/pkgs/development/libraries/aml/default.nix b/pkgs/development/libraries/aml/default.nix
index 8b4eccb9ffff3..899dafde76f2a 100644
--- a/pkgs/development/libraries/aml/default.nix
+++ b/pkgs/development/libraries/aml/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, meson, pkg-config, ninja }:
+{ lib, stdenv, fetchFromGitHub, meson, pkg-config, ninja }:
 
 stdenv.mkDerivation rec {
   pname = "aml";
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ meson pkg-config ninja ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Another main loop";
     inherit (src.meta) homepage;
     license = licenses.isc;
diff --git a/pkgs/development/libraries/amrnb/default.nix b/pkgs/development/libraries/amrnb/default.nix
index 4e8aab263ebf5..b226c9e36d24a 100644
--- a/pkgs/development/libraries/amrnb/default.nix
+++ b/pkgs/development/libraries/amrnb/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, unzip}:
+{lib, stdenv, fetchurl, unzip}:
 
 stdenv.mkDerivation {
   name = "amrnb-11.0.0.0";
@@ -26,6 +26,6 @@ stdenv.mkDerivation {
     # The wrapper code is free, but not the libraries from 3gpp.
     # It's a source code reference implementation with patents and licenses on
     # some countries, not redistributable.
-    license = stdenv.lib.licenses.unfree;
+    license = lib.licenses.unfree;
   };
 }
diff --git a/pkgs/development/libraries/amrwb/default.nix b/pkgs/development/libraries/amrwb/default.nix
index e6581d549115b..776065b28bc74 100644
--- a/pkgs/development/libraries/amrwb/default.nix
+++ b/pkgs/development/libraries/amrwb/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, unzip }:
+{ lib, stdenv, fetchurl, unzip }:
 
 stdenv.mkDerivation rec {
   pname = "amrwb";
@@ -28,6 +28,6 @@ stdenv.mkDerivation rec {
     # The wrapper code is free, but not the libraries from 3gpp.
     # It's a source code reference implementation with patents and licenses on
     # some countries, not redistributable.
-    license = stdenv.lib.licenses.unfree;
+    license = lib.licenses.unfree;
   };
 }
diff --git a/pkgs/development/libraries/amtk/default.nix b/pkgs/development/libraries/amtk/default.nix
index 300069e60ae51..f144f847bcf03 100644
--- a/pkgs/development/libraries/amtk/default.nix
+++ b/pkgs/development/libraries/amtk/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , gtk3
 , pkg-config
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
   version = "5.2.0";
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "0y3hmmflw4i0y0yb9a8rlihbv3cbwnvdcf1n5jycwzpq9jxla1c2";
   };
 
@@ -37,7 +37,7 @@ stdenv.mkDerivation rec {
 
   passthru.updateScript = gnome3.updateScript { packageName = pname; };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://wiki.gnome.org/Projects/Amtk";
     description = "Actions, Menus and Toolbars Kit for GTK applications";
     maintainers = [ maintainers.manveru ];
diff --git a/pkgs/development/libraries/apache-activemq/default.nix b/pkgs/development/libraries/apache-activemq/default.nix
index 8490541546b52..976387d49eb05 100644
--- a/pkgs/development/libraries/apache-activemq/default.nix
+++ b/pkgs/development/libraries/apache-activemq/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
   pname = "apache-activemq";
@@ -23,8 +23,8 @@ stdenv.mkDerivation rec {
   meta = {
     homepage = "http://activemq.apache.org/";
     description = "Messaging and Integration Patterns server written in Java";
-    license = stdenv.lib.licenses.asl20;
-    platforms = stdenv.lib.platforms.unix;
+    license = lib.licenses.asl20;
+    platforms = lib.platforms.unix;
   };
 
 }
diff --git a/pkgs/development/libraries/appstream-glib/default.nix b/pkgs/development/libraries/appstream-glib/default.nix
index a5b4c0cad48a4..1cd9fb2c8b769 100644
--- a/pkgs/development/libraries/appstream-glib/default.nix
+++ b/pkgs/development/libraries/appstream-glib/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , substituteAll
 , docbook_xml_dtd_42
@@ -31,7 +31,7 @@ stdenv.mkDerivation rec {
   src = fetchFromGitHub {
     owner = "hughsie";
     repo = "appstream-glib";
-    rev = stdenv.lib.replaceStrings [ "." "-" ] [ "_" "_" ] name;
+    rev = lib.replaceStrings [ "." "-" ] [ "_" "_" ] name;
     sha256 = "12s7d3nqjs1fldnppbg2mkjg4280f3h8yzj3q1hiz3chh1w0vjbx";
   };
 
@@ -84,7 +84,7 @@ stdenv.mkDerivation rec {
     moveToOutput "share/installed-tests" "$installedTests"
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Objects and helper methods to read and write AppStream metadata";
     homepage = "https://people.freedesktop.org/~hughsient/appstream-glib/";
     license = licenses.lgpl2Plus;
diff --git a/pkgs/development/libraries/appstream/default.nix b/pkgs/development/libraries/appstream/default.nix
index 3764d1e7f8655..1e3c2bcd2eb53 100644
--- a/pkgs/development/libraries/appstream/default.nix
+++ b/pkgs/development/libraries/appstream/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, meson, ninja, pkg-config, gettext
+{ lib, stdenv, fetchFromGitHub, meson, ninja, pkg-config, gettext
 , xmlto, docbook_xsl, docbook_xml_dtd_45, libxslt
 , libstemmer, glib, xapian, libxml2, libyaml, gobject-introspection
 , pcre, itstool, gperf, vala, lmdb, libsoup
@@ -39,7 +39,7 @@ stdenv.mkDerivation rec {
     "-Dvapi=true"
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Software metadata handling library";
     homepage    = "https://www.freedesktop.org/wiki/Distributions/AppStream/";
     longDescription = ''
diff --git a/pkgs/development/libraries/apr-util/default.nix b/pkgs/development/libraries/apr-util/default.nix
index ba12e2d0385ae..51e9271b7d7c9 100644
--- a/pkgs/development/libraries/apr-util/default.nix
+++ b/pkgs/development/libraries/apr-util/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, makeWrapper, apr, expat, gnused
+{ lib, stdenv, fetchurl, makeWrapper, apr, expat, gnused
 , sslSupport ? true, openssl
 , bdbSupport ? true, db
 , ldapSupport ? !stdenv.isCygwin, openldap
@@ -10,7 +10,7 @@ assert sslSupport -> openssl != null;
 assert bdbSupport -> db != null;
 assert ldapSupport -> openldap != null;
 
-with stdenv.lib;
+with lib;
 
 stdenv.mkDerivation rec {
   name = "apr-util-1.6.1";
@@ -61,7 +61,7 @@ stdenv.mkDerivation rec {
     inherit sslSupport bdbSupport ldapSupport;
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://apr.apache.org/";
     description = "A companion library to APR, the Apache Portable Runtime";
     maintainers = [ maintainers.eelco ];
diff --git a/pkgs/development/libraries/apr/default.nix b/pkgs/development/libraries/apr/default.nix
index ce33c0534fa42..c7a1073d137a2 100644
--- a/pkgs/development/libraries/apr/default.nix
+++ b/pkgs/development/libraries/apr/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
   name = "apr-1.7.0";
@@ -8,7 +8,7 @@ stdenv.mkDerivation rec {
     sha256 = "1spp6r2a3xcl5yajm9safhzyilsdzgagc2dadif8x6z9nbq4iqg2";
   };
 
-  patches = stdenv.lib.optionals stdenv.isDarwin [ ./is-this-a-compiler-bug.patch ];
+  patches = lib.optionals stdenv.isDarwin [ ./is-this-a-compiler-bug.patch ];
 
   # This test needs the net
   postPatch = ''
@@ -23,22 +23,22 @@ stdenv.mkDerivation rec {
       configureFlagsArray+=("--with-installbuilddir=$dev/share/build")
     '';
 
-  configureFlags = stdenv.lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) [
+  configureFlags = lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) [
     "ac_cv_file__dev_zero=yes"
     "ac_cv_func_setpgrp_void=0"
     "apr_cv_process_shared_works=1"
     "apr_cv_tcp_nodelay_with_cork=1"
-  ] ++ stdenv.lib.optionals (stdenv.hostPlatform.system == "i686-cygwin") [
+  ] ++ lib.optionals (stdenv.hostPlatform.system == "i686-cygwin") [
     # Including the Windows headers breaks unistd.h.
     # Based on ftp://sourceware.org/pub/cygwin/release/libapr1/libapr1-1.3.8-2-src.tar.bz2
     "ac_cv_header_windows_h=no"
   ];
 
-  CPPFLAGS=stdenv.lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) "-DAPR_IOVEC_DEFINED";
+  CPPFLAGS=lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) "-DAPR_IOVEC_DEFINED";
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://apr.apache.org/";
     description = "The Apache Portable Runtime library";
     platforms = platforms.all;
diff --git a/pkgs/development/libraries/aqbanking/default.nix b/pkgs/development/libraries/aqbanking/default.nix
index ab5ff960e98ef..1e11661b0098f 100644
--- a/pkgs/development/libraries/aqbanking/default.nix
+++ b/pkgs/development/libraries/aqbanking/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, gmp, gwenhywfar, libtool, libxml2, libxslt
+{ lib, stdenv, fetchurl, gmp, gwenhywfar, libtool, libxml2, libxslt
 , pkg-config, gettext, xmlsec, zlib
 }:
 
@@ -27,7 +27,7 @@ in stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ pkg-config gettext ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "An interface to banking tasks, file formats and country information";
     homepage = "https://www.aquamaniac.de/";
     hydraPlatforms = [];
diff --git a/pkgs/development/libraries/aqbanking/gwenhywfar.nix b/pkgs/development/libraries/aqbanking/gwenhywfar.nix
index 660f3bf377edc..d240e7e3a9dc7 100644
--- a/pkgs/development/libraries/aqbanking/gwenhywfar.nix
+++ b/pkgs/development/libraries/aqbanking/gwenhywfar.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, gnutls, openssl, libgcrypt, libgpgerror, pkg-config, gettext
+{ lib, stdenv, fetchurl, gnutls, openssl, libgcrypt, libgpgerror, pkg-config, gettext
 , which
 
 # GUI support
@@ -34,7 +34,7 @@ in stdenv.mkDerivation rec {
     isRelative = path: builtins.substring 0 1 path != "/";
     mkSearchPath = path: ''
       p; g; s,\<PLUGINDIR\>,"${path}",g;
-    '' + stdenv.lib.optionalString (isRelative path) ''
+    '' + lib.optionalString (isRelative path) ''
       s/AddPath(\(.*\));/AddRelPath(\1, GWEN_PathManager_RelModeHome);/g
     '';
 
@@ -42,7 +42,7 @@ in stdenv.mkDerivation rec {
     sed -i -e '/GWEN_PathManager_DefinePath.*GWEN_PM_PLUGINDIR/,/^#endif/ {
       /^#if/,/^#endif/ {
         H; /^#endif/ {
-          ${stdenv.lib.concatMapStrings mkSearchPath pluginSearchPaths}
+          ${lib.concatMapStrings mkSearchPath pluginSearchPaths}
         }
       }
     }' src/gwenhywfar.c
@@ -57,7 +57,7 @@ in stdenv.mkDerivation rec {
 
   buildInputs = [ gtk2 gtk3 qt5.qtbase gnutls openssl libgcrypt libgpgerror ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "OS abstraction functions used by aqbanking and related tools";
     homepage = "http://www2.aquamaniac.de/sites/download/packages.php?package=01&showall=1";
     license = licenses.lgpl21;
diff --git a/pkgs/development/libraries/aqbanking/libchipcard.nix b/pkgs/development/libraries/aqbanking/libchipcard.nix
index c4cf069b04c51..f483f232e37b1 100644
--- a/pkgs/development/libraries/aqbanking/libchipcard.nix
+++ b/pkgs/development/libraries/aqbanking/libchipcard.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, gwenhywfar, pcsclite, zlib }:
+{ lib, stdenv, fetchurl, pkg-config, gwenhywfar, pcsclite, zlib }:
 
 let
   inherit ((import ./sources.nix).libchipcard) sha256 releaseId version;
@@ -19,7 +19,7 @@ in stdenv.mkDerivation rec {
 
   configureFlags = [ "--with-gwen-dir=${gwenhywfar}" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Library for access to chipcards";
     homepage = "https://www.aquamaniac.de/rdm/projects/libchipcard";
     license = licenses.lgpl21;
diff --git a/pkgs/development/libraries/aravis/default.nix b/pkgs/development/libraries/aravis/default.nix
index 89c8d91f26a75..62a5c54e67640 100644
--- a/pkgs/development/libraries/aravis/default.nix
+++ b/pkgs/development/libraries/aravis/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, autoreconfHook, pkg-config, gtk-doc, intltool
+{ lib, stdenv, fetchFromGitHub, autoreconfHook, pkg-config, gtk-doc, intltool
 , audit, glib, libusb1, libxml2
 , wrapGAppsHook
 , gstreamer ? null
@@ -19,11 +19,11 @@
 
 let
   gstreamerAtLeastVersion1 =
-    stdenv.lib.all
-      (pkg: pkg != null && stdenv.lib.versionAtLeast (stdenv.lib.getVersion pkg) "1.0")
+    lib.all
+      (pkg: pkg != null && lib.versionAtLeast (stdenv.lib.getVersion pkg) "1.0")
       [ gstreamer gst-plugins-base gst-plugins-good gst-plugins-bad ];
 in
-  assert enableGstPlugin -> stdenv.lib.all (pkg: pkg != null) [ gstreamer gst-plugins-base gst-plugins-good gst-plugins-bad ];
+  assert enableGstPlugin -> lib.all (pkg: pkg != null) [ gstreamer gst-plugins-base gst-plugins-good gst-plugins-bad ];
   assert enableViewer -> enableGstPlugin;
   assert enableViewer -> libnotify != null;
   assert enableViewer -> gnome3 != null;
@@ -49,26 +49,26 @@ in
       pkg-config
       intltool
       gtk-doc
-    ] ++ stdenv.lib.optional enableViewer wrapGAppsHook;
+    ] ++ lib.optional enableViewer wrapGAppsHook;
 
     buildInputs =
       [ glib libxml2 ]
-      ++ stdenv.lib.optional enableUsb libusb1
-      ++ stdenv.lib.optional enablePacketSocket audit
-      ++ stdenv.lib.optionals (enableViewer || enableGstPlugin) [ gstreamer gst-plugins-base gst-plugins-good gst-plugins-bad ]
-      ++ stdenv.lib.optionals (enableViewer) [ libnotify gtk3 gnome3.adwaita-icon-theme ];
+      ++ lib.optional enableUsb libusb1
+      ++ lib.optional enablePacketSocket audit
+      ++ lib.optionals (enableViewer || enableGstPlugin) [ gstreamer gst-plugins-base gst-plugins-good gst-plugins-bad ]
+      ++ lib.optionals (enableViewer) [ libnotify gtk3 gnome3.adwaita-icon-theme ];
 
     preAutoreconf = ''./autogen.sh'';
 
     configureFlags =
-      stdenv.lib.optional enableUsb "--enable-usb"
-        ++ stdenv.lib.optional enablePacketSocket "--enable-packet-socket"
-        ++ stdenv.lib.optional enableViewer "--enable-viewer"
-        ++ stdenv.lib.optional enableGstPlugin
+      lib.optional enableUsb "--enable-usb"
+        ++ lib.optional enablePacketSocket "--enable-packet-socket"
+        ++ lib.optional enableViewer "--enable-viewer"
+        ++ lib.optional enableGstPlugin
         (if gstreamerAtLeastVersion1 then "--enable-gst-plugin" else "--enable-gst-0.10-plugin")
-        ++ stdenv.lib.optional enableCppTest "--enable-cpp-test"
-        ++ stdenv.lib.optional enableFastHeartbeat "--enable-fast-heartbeat"
-        ++ stdenv.lib.optional enableAsan "--enable-asan";
+        ++ lib.optional enableCppTest "--enable-cpp-test"
+        ++ lib.optional enableFastHeartbeat "--enable-fast-heartbeat"
+        ++ lib.optional enableAsan "--enable-asan";
 
     postPatch = ''
         ln -s ${gtk-doc}/share/gtk-doc/data/gtk-doc.make .
@@ -82,9 +82,9 @@ in
         Implements the gigabit ethernet and USB3 protocols used by industrial cameras.
       '';
       homepage = "https://aravisproject.github.io/docs/aravis-0.5";
-      license = stdenv.lib.licenses.lgpl2;
+      license = lib.licenses.lgpl2;
       maintainers = [];
-      platforms = stdenv.lib.platforms.unix;
+      platforms = lib.platforms.unix;
     };
   }
 
diff --git a/pkgs/development/libraries/arb/default.nix b/pkgs/development/libraries/arb/default.nix
index b17ef73a5cfc2..1c356b59d8a7b 100644
--- a/pkgs/development/libraries/arb/default.nix
+++ b/pkgs/development/libraries/arb/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchFromGitHub, mpir, gmp, mpfr, flint}:
+{lib, stdenv, fetchFromGitHub, mpir, gmp, mpfr, flint}:
 stdenv.mkDerivation rec {
   pname = "arb";
   version = "2.17.0";
@@ -16,11 +16,11 @@ stdenv.mkDerivation rec {
     "--with-flint=${flint}"
   ];
   doCheck = true;
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A library for arbitrary-precision interval arithmetic";
     homepage = "https://arblib.org/";
-    license = stdenv.lib.licenses.lgpl21Plus;
+    license = lib.licenses.lgpl21Plus;
     maintainers = teams.sage.members;
-    platforms = stdenv.lib.platforms.unix;
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/argp-standalone/default.nix b/pkgs/development/libraries/argp-standalone/default.nix
index f961c577aa7d2..33b253718a7fb 100644
--- a/pkgs/development/libraries/argp-standalone/default.nix
+++ b/pkgs/development/libraries/argp-standalone/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, fetchpatch }:
+{ lib, stdenv, fetchurl, fetchpatch }:
 
 let
   patch-argp-fmtstream = fetchpatch {
@@ -28,12 +28,12 @@ stdenv.mkDerivation {
   };
 
   patches =
-       stdenv.lib.optionals stdenv.hostPlatform.isDarwin [ patch-argp-fmtstream ]
-    ++ stdenv.lib.optionals stdenv.hostPlatform.isLinux [ patch-throw-in-funcdef patch-shared ];
+       lib.optionals stdenv.hostPlatform.isDarwin [ patch-argp-fmtstream ]
+    ++ lib.optionals stdenv.hostPlatform.isLinux [ patch-throw-in-funcdef patch-shared ];
 
-  patchFlags = stdenv.lib.optional stdenv.hostPlatform.isDarwin "-p0";
+  patchFlags = lib.optional stdenv.hostPlatform.isDarwin "-p0";
 
-  preConfigure = stdenv.lib.optionalString stdenv.hostPlatform.isLinux "export CFLAGS='-fgnu89-inline'";
+  preConfigure = lib.optionalString stdenv.hostPlatform.isLinux "export CFLAGS='-fgnu89-inline'";
 
   postInstall = ''
     mkdir -p $out/lib $out/include
@@ -47,7 +47,7 @@ stdenv.mkDerivation {
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://www.lysator.liu.se/~nisse/misc/";
     description = "Standalone version of arguments parsing functions from GLIBC";
     platforms = with platforms; darwin ++ linux;
diff --git a/pkgs/development/libraries/argtable/default.nix b/pkgs/development/libraries/argtable/default.nix
index bf953d87fe2ae..a16885ab2549e 100644
--- a/pkgs/development/libraries/argtable/default.nix
+++ b/pkgs/development/libraries/argtable/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , cmake
 }:
@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
     patchShebangs tools/build
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://argtable.org";
     description = "A single-file, ANSI C command-line parsing library";
     longDescription = ''
diff --git a/pkgs/development/libraries/arguments/default.nix b/pkgs/development/libraries/arguments/default.nix
index cb0c65e97e3b6..85dafde83c27f 100644
--- a/pkgs/development/libraries/arguments/default.nix
+++ b/pkgs/development/libraries/arguments/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake }:
+{ lib, stdenv, fetchFromGitHub, cmake }:
 
 stdenv.mkDerivation rec {
   pname = "arguments";
@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
   doCheck = false;
   # internal_volume_io.h: No such file or directory
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/${owner}/${pname}";
     description = "Library for argument handling for MINC programs";
     maintainers = with maintainers; [ bcdarwin ];
diff --git a/pkgs/development/libraries/aribb25/default.nix b/pkgs/development/libraries/aribb25/default.nix
index 949fd401f5dad..3e171d757973e 100644
--- a/pkgs/development/libraries/aribb25/default.nix
+++ b/pkgs/development/libraries/aribb25/default.nix
@@ -47,7 +47,7 @@ stdenv.mkDerivation rec {
   buildFlags =
     lib.optional stdenv.isDarwin "pcsclite_CFLAGS=-I${PCSC}/Library/Frameworks/PCSC.framework/Headers";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://code.videolan.org/videolan/aribb25";
     description = "Sample implementation of the ARIB STD-B25 standard";
     platforms = platforms.all;
diff --git a/pkgs/development/libraries/armadillo/default.nix b/pkgs/development/libraries/armadillo/default.nix
index 12f6316537b2a..6696e5720e326 100644
--- a/pkgs/development/libraries/armadillo/default.nix
+++ b/pkgs/development/libraries/armadillo/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, cmake, blas, lapack, superlu, hdf5 }:
+{ lib, stdenv, fetchurl, cmake, blas, lapack, superlu, hdf5 }:
 
 stdenv.mkDerivation rec {
   pname = "armadillo";
@@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
 
   patches = [ ./use-unix-config-on-OS-X.patch ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "C++ linear algebra library";
     homepage = "http://arma.sourceforge.net";
     license = licenses.asl20;
diff --git a/pkgs/development/libraries/arrayfire/default.nix b/pkgs/development/libraries/arrayfire/default.nix
index c9a09ac115ca3..c636d672332c4 100644
--- a/pkgs/development/libraries/arrayfire/default.nix
+++ b/pkgs/development/libraries/arrayfire/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, fetchFromGitHub, cmake, pkg-config
+{ lib, stdenv, fetchurl, fetchFromGitHub, cmake, pkg-config
 , opencl-clhpp, ocl-icd, fftw, fftwFloat
 , blas, lapack, boost, mesa, libGLU, libGL
 , freeimage, python, clfft, clblas
@@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
     "-DAF_BUILD_OPENCL=OFF"
     "-DAF_BUILD_EXAMPLES=OFF"
     "-DBUILD_TESTING=OFF"
-  ] ++ stdenv.lib.optional cudaSupport "-DCMAKE_LIBRARY_PATH=${cudatoolkit}/lib/stubs";
+  ] ++ lib.optional cudaSupport "-DCMAKE_LIBRARY_PATH=${cudatoolkit}/lib/stubs";
 
   patches = [ ./no-download.patch ];
 
@@ -32,7 +32,7 @@ stdenv.mkDerivation rec {
     cp -R --no-preserve=mode,ownership ${opencl-clhpp}/include/CL/cl2.hpp ./build/include/CL/cl2.hpp
   '';
 
-  preBuild = stdenv.lib.optionalString cudaSupport ''
+  preBuild = lib.optionalString cudaSupport ''
     export CUDA_PATH="${cudatoolkit}"
   '';
 
@@ -48,11 +48,11 @@ stdenv.mkDerivation rec {
     libGLU libGL
     mesa freeimage
     boost.out boost.dev
-  ] ++ (stdenv.lib.optional stdenv.isLinux ocl-icd)
-    ++ (stdenv.lib.optional cudaSupport cudatoolkit)
-    ++ (stdenv.lib.optional buildDocs doxygen);
+  ] ++ (lib.optional stdenv.isLinux ocl-icd)
+    ++ (lib.optional cudaSupport cudatoolkit)
+    ++ (lib.optional buildDocs doxygen);
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A general-purpose library for parallel and massively-parallel computations";
     longDescription = ''
       A general-purpose library that simplifies the process of developing software that targets parallel and massively-parallel architectures including CPUs, GPUs, and other hardware acceleration devices.";
diff --git a/pkgs/development/libraries/asio/generic.nix b/pkgs/development/libraries/asio/generic.nix
index d83a48e61b8a1..8bcc12ae2b3a9 100644
--- a/pkgs/development/libraries/asio/generic.nix
+++ b/pkgs/development/libraries/asio/generic.nix
@@ -1,8 +1,8 @@
-{stdenv, fetchurl, boost, openssl
+{lib, stdenv, fetchurl, boost, openssl
 , version, sha256, ...
 }:
 
-with stdenv.lib;
+with lib;
 
 stdenv.mkDerivation {
   pname = "asio";
@@ -21,7 +21,7 @@ stdenv.mkDerivation {
     homepage = "http://asio.sourceforge.net/";
     description = "Cross-platform C++ library for network and low-level I/O programming";
     license = licenses.boost;
-    broken = stdenv.isDarwin && stdenv.lib.versionOlder version "1.16.1";
+    broken = stdenv.isDarwin && lib.versionOlder version "1.16.1";
     platforms = platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/aspell/default.nix b/pkgs/development/libraries/aspell/default.nix
index 68faef7e78627..01acced98f6f5 100644
--- a/pkgs/development/libraries/aspell/default.nix
+++ b/pkgs/development/libraries/aspell/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, fetchpatch, fetchzip, perl
+{ lib, stdenv, fetchurl, fetchpatch, fetchzip, perl
 , searchNixProfiles ? true
 }:
 
@@ -23,7 +23,7 @@ stdenv.mkDerivation rec {
     sha256 = "1wi60ankalmh8ds7nplz434jd7j94gdvbahdwsr539rlad8pxdzr";
   };
 
-  patches = stdenv.lib.optional searchNixProfiles ./data-dirs-from-nix-profiles.patch;
+  patches = lib.optional searchNixProfiles ./data-dirs-from-nix-profiles.patch;
 
   postPatch = ''
     patch interfaces/cc/aspell.h < ${./clang.patch}
@@ -51,8 +51,8 @@ stdenv.mkDerivation rec {
   meta = {
     description = "Spell checker for many languages";
     homepage = "http://aspell.net/";
-    license = stdenv.lib.licenses.lgpl2Plus;
+    license = lib.licenses.lgpl2Plus;
     maintainers = [ ];
-    platforms = with stdenv.lib.platforms; all;
+    platforms = with lib.platforms; all;
   };
 }
diff --git a/pkgs/development/libraries/aspell/dictionaries.nix b/pkgs/development/libraries/aspell/dictionaries.nix
index d40f4b5aae42f..3923416c4a350 100644
--- a/pkgs/development/libraries/aspell/dictionaries.nix
+++ b/pkgs/development/libraries/aspell/dictionaries.nix
@@ -49,7 +49,7 @@ let
 
       meta = {
         description = "Aspell dictionary for ${fullName}";
-        platforms = stdenv.lib.platforms.all;
+        platforms = lib.platforms.all;
       } // (args.meta or {});
     } // removeAttrs args [ "meta" ]);
 
diff --git a/pkgs/development/libraries/assimp/default.nix b/pkgs/development/libraries/assimp/default.nix
index 9c5b75999f16b..a2cd3a2a45710 100644
--- a/pkgs/development/libraries/assimp/default.nix
+++ b/pkgs/development/libraries/assimp/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, boost, zlib }:
+{ lib, stdenv, fetchFromGitHub, cmake, boost, zlib }:
 
 stdenv.mkDerivation rec {
   pname = "assimp";
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ cmake ];
   buildInputs = [ boost zlib ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A library to import various 3D model formats";
     homepage = "http://assimp.sourceforge.net/";
     license = licenses.bsd3;
diff --git a/pkgs/development/libraries/at-spi2-atk/default.nix b/pkgs/development/libraries/at-spi2-atk/default.nix
index c638c4b2a40da..1e5a1d3fd64c8 100644
--- a/pkgs/development/libraries/at-spi2-atk/default.nix
+++ b/pkgs/development/libraries/at-spi2-atk/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 
 , meson
@@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
   version = "2.38.0";
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "z6AIpa+CKzauYofxgYLEDJHdaZxV+qOGBYge0XXKRk8=";
   };
 
@@ -34,7 +34,7 @@ stdenv.mkDerivation rec {
     };
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "D-Bus bridge for Assistive Technology Service Provider Interface (AT-SPI) and Accessibility Toolkit (ATK)";
     homepage = "https://gitlab.gnome.org/GNOME/at-spi2-atk";
     license = licenses.lgpl21Plus;
diff --git a/pkgs/development/libraries/at-spi2-core/default.nix b/pkgs/development/libraries/at-spi2-core/default.nix
index 2d3e96639c719..7e1181cf3bdf1 100644
--- a/pkgs/development/libraries/at-spi2-core/default.nix
+++ b/pkgs/development/libraries/at-spi2-core/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 
 , meson
@@ -23,7 +23,7 @@ stdenv.mkDerivation rec {
   version = "2.38.0";
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "hONsP+ZoYhM/X+Ipdyt2qiUm4Q3lAUo3ePL6Rs5VDaU=";
   };
 
@@ -51,11 +51,11 @@ stdenv.mkDerivation rec {
   postFixup = ''
     # Cannot use wrapGAppsHook'due to a dependency cycle
     wrapProgram $out/libexec/at-spi-bus-launcher \
-      --prefix GIO_EXTRA_MODULES : "${stdenv.lib.getLib dconf}/lib/gio/modules" \
+      --prefix GIO_EXTRA_MODULES : "${lib.getLib dconf}/lib/gio/modules" \
       --prefix XDG_DATA_DIRS : ${gsettings-desktop-schemas}/share/gsettings-schemas/${gsettings-desktop-schemas.name}
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Assistive Technology Service Provider Interface protocol definitions and daemon for D-Bus";
     homepage = "https://gitlab.gnome.org/GNOME/at-spi2-core";
     license = licenses.lgpl21Plus;
diff --git a/pkgs/development/libraries/atk/default.nix b/pkgs/development/libraries/atk/default.nix
index e962eac00926f..4cb2d6b2aec9e 100644
--- a/pkgs/development/libraries/atk/default.nix
+++ b/pkgs/development/libraries/atk/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, meson, ninja, gettext, pkg-config, glib
+{ lib, stdenv, fetchurl, meson, ninja, gettext, pkg-config, glib
 , fixDarwinDylibNames, gobject-introspection, gnome3
 }:
 
@@ -11,14 +11,14 @@ stdenv.mkDerivation rec {
   name = "${pname}-${version}";
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${name}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${name}.tar.xz";
     sha256 = "1217cmmykjgkkim0zr1lv5j13733m4w5vipmy4ivw0ll6rz28xpv";
   };
 
   outputs = [ "out" "dev" ];
 
   nativeBuildInputs = [ meson ninja pkg-config gettext gobject-introspection glib ]
-    ++ stdenv.lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames;
+    ++ lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames;
 
   propagatedBuildInputs = [
     # Required by atk.pc
@@ -52,10 +52,10 @@ stdenv.mkDerivation rec {
 
     homepage = "http://library.gnome.org/devel/atk/";
 
-    license = stdenv.lib.licenses.lgpl2Plus;
+    license = lib.licenses.lgpl2Plus;
 
-    maintainers = with stdenv.lib.maintainers; [ raskin ];
-    platforms = stdenv.lib.platforms.linux ++ stdenv.lib.platforms.darwin;
+    maintainers = with lib.maintainers; [ raskin ];
+    platforms = lib.platforms.linux ++ stdenv.lib.platforms.darwin;
   };
 
 }
diff --git a/pkgs/development/libraries/atkmm/default.nix b/pkgs/development/libraries/atkmm/default.nix
index 1e6f047b6aa1d..e9c63eb650f73 100644
--- a/pkgs/development/libraries/atkmm/default.nix
+++ b/pkgs/development/libraries/atkmm/default.nix
@@ -1,11 +1,11 @@
-{ stdenv, fetchurl, atk, glibmm, pkg-config, gnome3 }:
+{ lib, stdenv, fetchurl, atk, glibmm, pkg-config, gnome3 }:
 
 stdenv.mkDerivation rec {
   pname = "atkmm";
   version = "2.28.0";
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "0fnxrspxkhhbrjphqrpvl3zjm66n50s4cywrrrwkhbflgy8zqk2c";
   };
 
@@ -25,8 +25,8 @@ stdenv.mkDerivation rec {
 
   meta = {
     description = "C++ wrappers for ATK accessibility toolkit";
-    license = stdenv.lib.licenses.lgpl21Plus;
+    license = lib.licenses.lgpl21Plus;
     homepage = "https://gtkmm.org";
-    platforms = stdenv.lib.platforms.unix;
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/attr/default.nix b/pkgs/development/libraries/attr/default.nix
index d69d475f7370e..b7c9287b68bc8 100644
--- a/pkgs/development/libraries/attr/default.nix
+++ b/pkgs/development/libraries/attr/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, gettext }:
+{ lib, stdenv, fetchurl, gettext }:
 
 # Note: this package is used for bootstrapping fetchurl, and thus
 # cannot use fetchpatch! All mutable patches (generated by GitHub or
@@ -28,7 +28,7 @@ stdenv.mkDerivation rec {
     done
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://savannah.nongnu.org/projects/attr/";
     description = "Library and tools for manipulating extended attributes";
     platforms = platforms.linux;
diff --git a/pkgs/development/libraries/aubio/default.nix b/pkgs/development/libraries/aubio/default.nix
index 0760a1438c0bf..7aa4859ef0ed7 100644
--- a/pkgs/development/libraries/aubio/default.nix
+++ b/pkgs/development/libraries/aubio/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, alsaLib, fftw, libjack2, libsamplerate
+{ lib, stdenv, fetchurl, alsaLib, fftw, libjack2, libsamplerate
 , libsndfile, pkg-config, python, wafHook
 }:
 
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ pkg-config python wafHook ];
   buildInputs = [ alsaLib fftw libjack2 libsamplerate libsndfile ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Library for audio labelling";
     homepage = "https://aubio.org/";
     license = licenses.gpl2;
diff --git a/pkgs/development/libraries/audiality2/default.nix b/pkgs/development/libraries/audiality2/default.nix
index a311c5f5479fa..e0ab0accdfde6 100644
--- a/pkgs/development/libraries/audiality2/default.nix
+++ b/pkgs/development/libraries/audiality2/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , cmake
 , pkg-config
@@ -28,7 +28,7 @@ stdenv.mkDerivation rec {
     jack2
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A realtime scripted modular audio engine for video games and musical applications";
     homepage = "http://audiality.org";
     license = licenses.zlib;
diff --git a/pkgs/development/libraries/audio/libbass/default.nix b/pkgs/development/libraries/audio/libbass/default.nix
index 593854bb280dd..2e10dbd881507 100644
--- a/pkgs/development/libraries/audio/libbass/default.nix
+++ b/pkgs/development/libraries/audio/libbass/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, unzip, fetchurl }:
+{ lib, stdenv, unzip, fetchurl }:
 
 # Upstream changes files in-place, to update:
 # 1. Check latest version at http://www.un4seen.com/
@@ -55,7 +55,7 @@ let
         install -m644 -t $out/include/ ${bass.h}
       '';
 
-    meta = with stdenv.lib; {
+    meta = with lib; {
       description = "Shareware audio library";
       homepage = "https://www.un4seen.com/";
       license = licenses.unfreeRedistributable;
@@ -63,4 +63,4 @@ let
     };
   };
 
-in stdenv.lib.mapAttrs dropBass allBass
+in lib.mapAttrs dropBass allBass
diff --git a/pkgs/development/libraries/audio/libbs2b/default.nix b/pkgs/development/libraries/audio/libbs2b/default.nix
index 24f4c77e350ed..11135b14fd48f 100644
--- a/pkgs/development/libraries/audio/libbs2b/default.nix
+++ b/pkgs/development/libraries/audio/libbs2b/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, libsndfile }:
+{ lib, stdenv, fetchurl, pkg-config, libsndfile }:
 
 stdenv.mkDerivation rec {
   pname = "libbs2b";
@@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
   meta = {
     homepage = "http://bs2b.sourceforge.net/";
     description = "Bauer stereophonic-to-binaural DSP library";
-    license = stdenv.lib.licenses.mit;
-    platforms = stdenv.lib.platforms.unix;
+    license = lib.licenses.mit;
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/audio/libgme/default.nix b/pkgs/development/libraries/audio/libgme/default.nix
index d70b6cfbde8e5..927bd00656e66 100644
--- a/pkgs/development/libraries/audio/libgme/default.nix
+++ b/pkgs/development/libraries/audio/libgme/default.nix
@@ -1,11 +1,11 @@
-{ stdenv, fetchFromBitbucket, cmake, removeReferencesTo }:
+{ lib, stdenv, fetchFromBitbucket, cmake, removeReferencesTo }:
 let
   version = "0.6.3";
 in stdenv.mkDerivation {
   pname = "libgme";
   inherit version;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A collection of video game music chip emulators";
     homepage = "https://bitbucket.org/mpyne/game-music-emu/overview";
     license = licenses.lgpl21;
@@ -26,7 +26,7 @@ in stdenv.mkDerivation {
   # it doesn't.
   disallowedReferences = [ stdenv.cc.cc ];
 
-  postFixup = stdenv.lib.optionalString stdenv.isLinux ''
+  postFixup = lib.optionalString stdenv.isLinux ''
     remove-references-to -t ${stdenv.cc.cc} "$(readlink -f $out/lib/libgme.so)"
   '';
 }
diff --git a/pkgs/development/libraries/audio/libinstpatch/default.nix b/pkgs/development/libraries/audio/libinstpatch/default.nix
index 3968794d2dc77..29781446c8fe6 100644
--- a/pkgs/development/libraries/audio/libinstpatch/default.nix
+++ b/pkgs/development/libraries/audio/libinstpatch/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, pkg-config, glib, libsndfile }:
+{ lib, stdenv, fetchFromGitHub, cmake, pkg-config, glib, libsndfile }:
 
 stdenv.mkDerivation rec {
   pname = "libinstpatch";
@@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
     "-DLIB_SUFFIX=" # Install in $out/lib.
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://www.swamiproject.org/";
     description = "MIDI instrument patch files support library";
     license = licenses.lgpl21;
diff --git a/pkgs/development/libraries/audio/libmysofa/default.nix b/pkgs/development/libraries/audio/libmysofa/default.nix
index c2b2725c19cc7..9c636e0205dff 100644
--- a/pkgs/development/libraries/audio/libmysofa/default.nix
+++ b/pkgs/development/libraries/audio/libmysofa/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, zlib }:
+{ lib, stdenv, fetchFromGitHub, cmake, zlib }:
 
 stdenv.mkDerivation rec {
   pname = "libmysofa";
@@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
 
   cmakeFlags = [ "-DBUILD_TESTS=OFF" "-DCODE_COVERAGE=OFF" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Reader for AES SOFA files to get better HRTFs";
     homepage = "https://github.com/hoene/libmysofa";
     license = licenses.bsd3;
diff --git a/pkgs/development/libraries/audio/libsmf/default.nix b/pkgs/development/libraries/audio/libsmf/default.nix
index a3d76e55e3652..0c173a6a99e0f 100644
--- a/pkgs/development/libraries/audio/libsmf/default.nix
+++ b/pkgs/development/libraries/audio/libsmf/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, autoreconfHook, glib, pkg-config }:
+{ lib, stdenv, fetchurl, autoreconfHook, glib, pkg-config }:
 
 stdenv.mkDerivation rec {
   version = "1.3";
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ autoreconfHook pkg-config ];
   buildInputs = [ glib ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A C library for reading and writing Standard MIDI Files";
     homepage = "https://github.com/stump/libsmf";
     license = licenses.bsd2;
diff --git a/pkgs/development/libraries/audio/lilv/default.nix b/pkgs/development/libraries/audio/lilv/default.nix
index 1e126654bbacc..79f09f48464f0 100644
--- a/pkgs/development/libraries/audio/lilv/default.nix
+++ b/pkgs/development/libraries/audio/lilv/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, lv2, pkg-config, python3, serd, sord, sratom, wafHook }:
+{ lib, stdenv, fetchurl, lv2, pkg-config, python3, serd, sord, sratom, wafHook }:
 
 stdenv.mkDerivation rec {
   pname = "lilv";
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
   buildInputs = [ serd sord sratom ];
   propagatedBuildInputs = [ lv2 ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://drobilla.net/software/lilv";
     description = "A C library to make the use of LV2 plugins";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/audio/lv2/default.nix b/pkgs/development/libraries/audio/lv2/default.nix
index 3005a4398f9e3..45caf0b36c509 100644
--- a/pkgs/development/libraries/audio/lv2/default.nix
+++ b/pkgs/development/libraries/audio/lv2/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, gtk2, libsndfile, pkg-config, python3, wafHook }:
+{ lib, stdenv, fetchurl, gtk2, libsndfile, pkg-config, python3, wafHook }:
 
 stdenv.mkDerivation rec {
   pname = "lv2";
@@ -12,9 +12,9 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ pkg-config wafHook ];
   buildInputs = [ gtk2 libsndfile python3 ];
 
-  wafConfigureFlags = stdenv.lib.optionals stdenv.isDarwin [ "--lv2dir=${placeholder "out"}/lib/lv2" ];
+  wafConfigureFlags = lib.optionals stdenv.isDarwin [ "--lv2dir=${placeholder "out"}/lib/lv2" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://lv2plug.in";
     description = "A plugin standard for audio systems";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/audio/lvtk/default.nix b/pkgs/development/libraries/audio/lvtk/default.nix
index e497816bf1c59..cecae743da05d 100644
--- a/pkgs/development/libraries/audio/lvtk/default.nix
+++ b/pkgs/development/libraries/audio/lvtk/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, boost, gtkmm2, lv2, pkg-config, python, wafHook }:
+{ lib, stdenv, fetchurl, boost, gtkmm2, lv2, pkg-config, python, wafHook }:
 
 stdenv.mkDerivation rec {
   pname = "lvtk";
@@ -24,7 +24,7 @@ stdenv.mkDerivation rec {
     "--boost-libs=${boost.out}/lib"
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A set C++ wrappers around the LV2 C API";
     homepage = "https://lvtk.org/";
     license = licenses.gpl3;
diff --git a/pkgs/development/libraries/audio/mbelib/default.nix b/pkgs/development/libraries/audio/mbelib/default.nix
index 993bbcd09c152..f13f6d7063cb6 100644
--- a/pkgs/development/libraries/audio/mbelib/default.nix
+++ b/pkgs/development/libraries/audio/mbelib/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake }:
+{ lib, stdenv, fetchFromGitHub, cmake }:
 
 stdenv.mkDerivation rec {
   pname = "mbelib";
@@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
     export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH''${DYLD_LIBRARY_PATH:+:}$PWD
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "P25 Phase 1 and ProVoice vocoder";
     homepage = https://github.com/szechyjs/mbelib;
     license = licenses.isc;
diff --git a/pkgs/development/libraries/audio/ntk/default.nix b/pkgs/development/libraries/audio/ntk/default.nix
index e2f20d46a3d2c..ecb0215a2287f 100644
--- a/pkgs/development/libraries/audio/ntk/default.nix
+++ b/pkgs/development/libraries/audio/ntk/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cairo, libjpeg, libXft, pkg-config, python2, wafHook }:
+{ lib, stdenv, fetchFromGitHub, cairo, libjpeg, libXft, pkg-config, python2, wafHook }:
 
 stdenv.mkDerivation rec {
   pname = "ntk";
@@ -19,8 +19,8 @@ stdenv.mkDerivation rec {
     description = "Fork of FLTK 1.3.0 with additional functionality";
     version = version;
     homepage = "http://non.tuxfamily.org/";
-    license = stdenv.lib.licenses.lgpl21;
-    maintainers = with stdenv.lib.maintainers; [ magnetophon nico202 ];
-    platforms = stdenv.lib.platforms.linux;
+    license = lib.licenses.lgpl21;
+    maintainers = with lib.maintainers; [ magnetophon nico202 ];
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/development/libraries/audio/qm-dsp/default.nix b/pkgs/development/libraries/audio/qm-dsp/default.nix
index a93b031a4d150..3d8e15f97cdbf 100644
--- a/pkgs/development/libraries/audio/qm-dsp/default.nix
+++ b/pkgs/development/libraries/audio/qm-dsp/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , fetchpatch
 , kissfft
@@ -43,7 +43,7 @@ stdenv.mkDerivation rec {
 
   NIX_CFLAGS_COMPILE = "-I${kissfft}/include/kissfft";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A C++ library of functions for DSP and Music Informatics purposes";
     homepage = "https://code.soundsoftware.ac.uk/projects/qm-dsp";
     license = licenses.gpl2Plus;
diff --git a/pkgs/development/libraries/audio/raul/default.nix b/pkgs/development/libraries/audio/raul/default.nix
index 1516b6df879f9..a0089e3104418 100644
--- a/pkgs/development/libraries/audio/raul/default.nix
+++ b/pkgs/development/libraries/audio/raul/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchgit, boost, gtk2, pkg-config, python, wafHook }:
+{ lib, stdenv, fetchgit, boost, gtk2, pkg-config, python, wafHook }:
 
 stdenv.mkDerivation rec {
   pname = "raul";
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ pkg-config wafHook ];
   buildInputs = [ boost gtk2 python ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A C++ utility library primarily aimed at audio/musical applications";
     homepage = "http://drobilla.net/software/raul";
     license = licenses.gpl3;
diff --git a/pkgs/development/libraries/audio/rtaudio/default.nix b/pkgs/development/libraries/audio/rtaudio/default.nix
index 53efa598079b1..820ea1e49b9ef 100644
--- a/pkgs/development/libraries/audio/rtaudio/default.nix
+++ b/pkgs/development/libraries/audio/rtaudio/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, autoconf, automake, libtool, libjack2,  alsaLib, pulseaudio, rtmidi }:
+{ lib, stdenv, fetchFromGitHub, autoconf, automake, libtool, libjack2,  alsaLib, pulseaudio, rtmidi }:
 
 stdenv.mkDerivation rec {
   version = "5.1.0";
@@ -22,7 +22,7 @@ stdenv.mkDerivation rec {
     ./configure
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A set of C++ classes that provide a cross platform API for realtime audio input/output";
     homepage =  "http://www.music.mcgill.ca/~gary/rtaudio/";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/audio/rtmidi/default.nix b/pkgs/development/libraries/audio/rtmidi/default.nix
index 33a400c2f3df1..f6208bab6c606 100644
--- a/pkgs/development/libraries/audio/rtmidi/default.nix
+++ b/pkgs/development/libraries/audio/rtmidi/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, autoconf, automake, libtool, libjack2, alsaLib, pkg-config }:
+{ lib, stdenv, fetchFromGitHub, autoconf, automake, libtool, libjack2, alsaLib, pkg-config }:
 
 stdenv.mkDerivation rec {
   version = "4.0.0";
@@ -24,8 +24,8 @@ stdenv.mkDerivation rec {
   meta = {
     description = "A set of C++ classes that provide a cross platform API for realtime MIDI input/output";
     homepage =  "http://www.music.mcgill.ca/~gary/rtmidi/";
-    license = stdenv.lib.licenses.mit;
-    maintainers = [ stdenv.lib.maintainers.magnetophon ];
-    platforms = with stdenv.lib.platforms; linux ++ darwin;
+    license = lib.licenses.mit;
+    maintainers = [ lib.maintainers.magnetophon ];
+    platforms = with lib.platforms; linux ++ darwin;
   };
 }
diff --git a/pkgs/development/libraries/audio/sratom/default.nix b/pkgs/development/libraries/audio/sratom/default.nix
index 392c05c02a749..464e79f6c2dd2 100644
--- a/pkgs/development/libraries/audio/sratom/default.nix
+++ b/pkgs/development/libraries/audio/sratom/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, lv2, pkg-config, python3, serd, sord, wafHook }:
+{ lib, stdenv, fetchurl, lv2, pkg-config, python3, serd, sord, wafHook }:
 
 stdenv.mkDerivation rec {
   pname = "sratom";
@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ pkg-config wafHook python3 ];
   buildInputs = [ lv2 serd sord ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://drobilla.net/software/sratom";
     description = "A library for serialising LV2 atoms to/from RDF";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/audio/suil/default.nix b/pkgs/development/libraries/audio/suil/default.nix
index 43e5bc8f9cc79..0f4dd0f62c470 100644
--- a/pkgs/development/libraries/audio/suil/default.nix
+++ b/pkgs/development/libraries/audio/suil/default.nix
@@ -22,7 +22,7 @@ stdenv.mkDerivation rec {
     ++ (lib.optionals withQt4 [ qt4 ])
     ++ (lib.optionals withQt5 (with qt5; [ qtbase qttools ]));
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://drobilla.net/software/suil";
     description = "A lightweight C library for loading and wrapping LV2 plugin UIs";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/audio/vamp-plugin-sdk/default.nix b/pkgs/development/libraries/audio/vamp-plugin-sdk/default.nix
index 9c0a138b309a0..4d033d99d295b 100644
--- a/pkgs/development/libraries/audio/vamp-plugin-sdk/default.nix
+++ b/pkgs/development/libraries/audio/vamp-plugin-sdk/default.nix
@@ -1,7 +1,7 @@
 # set VAMP_PATH ?
 # plugins availible on sourceforge and http://www.vamp-plugins.org/download.html (various licenses)
 
-{ stdenv, fetchFromGitHub, pkg-config, libsndfile }:
+{ lib, stdenv, fetchFromGitHub, pkg-config, libsndfile }:
 
 stdenv.mkDerivation rec {
   pname = "vamp-plugin-sdk";
@@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Audio processing plugin system for plugins that extract descriptive information from audio data";
     homepage = "https://vamp-plugins.org/";
     license = licenses.bsd3;
diff --git a/pkgs/development/libraries/audio/zita-alsa-pcmi/default.nix b/pkgs/development/libraries/audio/zita-alsa-pcmi/default.nix
index c819f355e0b83..45f5fcfe3a44d 100644
--- a/pkgs/development/libraries/audio/zita-alsa-pcmi/default.nix
+++ b/pkgs/development/libraries/audio/zita-alsa-pcmi/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl , alsaLib, }:
+{ lib, stdenv, fetchurl , alsaLib, }:
 
 stdenv.mkDerivation rec {
   pname = "zita-alsa-pcmi";
@@ -57,8 +57,8 @@ stdenv.mkDerivation rec {
     description = "The successor of clalsadrv, provides easy access to ALSA PCM devices";
     version = version;
     homepage = "http://kokkinizita.linuxaudio.org/linuxaudio/downloads/index.html";
-    license = stdenv.lib.licenses.gpl3;
-    maintainers = [ stdenv.lib.maintainers.magnetophon ];
-    platforms = stdenv.lib.platforms.linux;
+    license = lib.licenses.gpl3;
+    maintainers = [ lib.maintainers.magnetophon ];
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/development/libraries/audio/zita-convolver/default.nix b/pkgs/development/libraries/audio/zita-convolver/default.nix
index 2b7d89b30a173..3b77bf549ca6e 100644
--- a/pkgs/development/libraries/audio/zita-convolver/default.nix
+++ b/pkgs/development/libraries/audio/zita-convolver/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, fftwFloat }:
+{ lib, stdenv, fetchurl, fftwFloat }:
 
 stdenv.mkDerivation rec {
   pname = "zita-convolver";
@@ -22,15 +22,15 @@ stdenv.mkDerivation rec {
 
   postInstall = ''
     # create lib link for building apps
-    ln -s $out/lib/libzita-convolver.so.${version} $out/lib/libzita-convolver.so.${stdenv.lib.versions.major version}
+    ln -s $out/lib/libzita-convolver.so.${version} $out/lib/libzita-convolver.so.${lib.versions.major version}
   '';
 
   meta = {
     description = "Convolution library by Fons Adriaensen";
     version = version;
     homepage = "http://kokkinizita.linuxaudio.org/linuxaudio/downloads/index.html";
-    license = stdenv.lib.licenses.gpl2;
-    maintainers = [ stdenv.lib.maintainers.magnetophon ];
-    platforms = stdenv.lib.platforms.linux;
+    license = lib.licenses.gpl2;
+    maintainers = [ lib.maintainers.magnetophon ];
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/development/libraries/audio/zita-resampler/default.nix b/pkgs/development/libraries/audio/zita-resampler/default.nix
index 2881e56621803..88e81d733b325 100644
--- a/pkgs/development/libraries/audio/zita-resampler/default.nix
+++ b/pkgs/development/libraries/audio/zita-resampler/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
   pname = "zita-resampler";
@@ -26,8 +26,8 @@ stdenv.mkDerivation rec {
     description = "Resample library by Fons Adriaensen";
     version = version;
     homepage = "http://kokkinizita.linuxaudio.org/linuxaudio/downloads/index.html";
-    license = stdenv.lib.licenses.gpl2;
-    maintainers = [ stdenv.lib.maintainers.magnetophon ];
-    platforms = stdenv.lib.platforms.linux;
+    license = lib.licenses.gpl2;
+    maintainers = [ lib.maintainers.magnetophon ];
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/development/libraries/audiofile/default.nix b/pkgs/development/libraries/audiofile/default.nix
index 86531a6ad25d8..88b1840955d32 100644
--- a/pkgs/development/libraries/audiofile/default.nix
+++ b/pkgs/development/libraries/audiofile/default.nix
@@ -14,9 +14,9 @@ stdenv.mkDerivation rec {
   name = "audiofile-0.3.6";
 
   buildInputs =
-    stdenv.lib.optionals stdenv.isLinux [
+    lib.optionals stdenv.isLinux [
       alsaLib
-    ] ++ stdenv.lib.optionals stdenv.isDarwin [
+    ] ++ lib.optionals stdenv.isDarwin [
       CoreServices AudioUnit
     ];
 
@@ -84,7 +84,7 @@ stdenv.mkDerivation rec {
     })
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Library for reading and writing audio files in various formats";
     homepage    = "http://www.68k.org/~michael/audiofile/";
     license     = licenses.lgpl21Plus;
diff --git a/pkgs/development/libraries/avahi/default.nix b/pkgs/development/libraries/avahi/default.nix
index ca832816eabda..dd54ba79db721 100644
--- a/pkgs/development/libraries/avahi/default.nix
+++ b/pkgs/development/libraries/avahi/default.nix
@@ -1,4 +1,4 @@
-{ fetchurl, fetchpatch, stdenv, pkg-config, libdaemon, dbus, perlPackages
+{ fetchurl, fetchpatch, lib, stdenv, pkg-config, libdaemon, dbus, perlPackages
 , expat, gettext, intltool, glib, libiconv, writeShellScriptBin, libevent
 , gtk3Support ? false, gtk3 ? null
 , qt4 ? null
@@ -17,7 +17,7 @@ let
 in
 
 stdenv.mkDerivation rec {
-  name = "avahi${stdenv.lib.optionalString withLibdnssdCompat "-compat"}-${version}";
+  name = "avahi${lib.optionalString withLibdnssdCompat "-compat"}-${version}";
   version = "0.8";
 
   src = fetchurl {
@@ -36,32 +36,32 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ libdaemon dbus glib expat libiconv libevent ]
     ++ (with perlPackages; [ perl XMLParser ])
-    ++ (stdenv.lib.optional gtk3Support gtk3)
-    ++ (stdenv.lib.optional qt4Support qt4)
-    ++ (stdenv.lib.optional qt5Support qt5);
+    ++ (lib.optional gtk3Support gtk3)
+    ++ (lib.optional qt4Support qt4)
+    ++ (lib.optional qt5Support qt5);
 
   propagatedBuildInputs =
-    stdenv.lib.optionals withPython (with python.pkgs; [ python pygobject3 dbus-python ]);
+    lib.optionals withPython (with python.pkgs; [ python pygobject3 dbus-python ]);
 
   nativeBuildInputs = [ pkg-config pkg-config-helper gettext intltool glib ];
 
   configureFlags =
     [ "--disable-qt3" "--disable-gdbm" "--disable-mono"
       "--disable-gtk" "--with-dbus-sys=${placeholder "out"}/share/dbus-1/system.d"
-      (stdenv.lib.enableFeature gtk3Support "gtk3")
+      (lib.enableFeature gtk3Support "gtk3")
       "--${if qt4Support then "enable" else "disable"}-qt4"
       "--${if qt5Support then "enable" else "disable"}-qt5"
-      (stdenv.lib.enableFeature withPython "python")
+      (lib.enableFeature withPython "python")
       "--localstatedir=/var" "--with-distro=none"
       # A systemd unit is provided by the avahi-daemon NixOS module
       "--with-systemdsystemunitdir=no" ]
-    ++ stdenv.lib.optional withLibdnssdCompat "--enable-compat-libdns_sd"
+    ++ lib.optional withLibdnssdCompat "--enable-compat-libdns_sd"
     # autoipd won't build on darwin
-    ++ stdenv.lib.optional stdenv.isDarwin "--disable-autoipd";
+    ++ lib.optional stdenv.isDarwin "--disable-autoipd";
 
   NIX_CFLAGS_COMPILE = "-DAVAHI_SERVICE_DIR=\"/etc/avahi/services\"";
 
-  preBuild = stdenv.lib.optionalString stdenv.isDarwin ''
+  preBuild = lib.optionalString stdenv.isDarwin ''
     sed -i '20 i\
     #define __APPLE_USE_RFC_2292' \
     avahi-core/socket.c
@@ -69,7 +69,7 @@ stdenv.mkDerivation rec {
 
   postInstall =
     # Maintain compat for mdnsresponder and howl
-    stdenv.lib.optionalString withLibdnssdCompat ''
+    lib.optionalString withLibdnssdCompat ''
       ln -s avahi-compat-libdns_sd/dns_sd.h "$out/include/dns_sd.h"
     '';
   /*  # these don't exist (anymore?)
@@ -77,7 +77,7 @@ stdenv.mkDerivation rec {
     ln -s avahi-compat-howl.pc $out/lib/pkgconfig/howl.pc
   */
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "mDNS/DNS-SD implementation";
     homepage    = "http://avahi.org";
     license     = licenses.lgpl2Plus;
diff --git a/pkgs/development/libraries/avro-c++/default.nix b/pkgs/development/libraries/avro-c++/default.nix
index 9ac609f1679cc..15e2516c1b6b2 100644
--- a/pkgs/development/libraries/avro-c++/default.nix
+++ b/pkgs/development/libraries/avro-c++/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, cmake, boost, python2}:
+{ lib, stdenv, fetchurl, cmake, boost, python2}:
 
 let version = "1.8.2"; in
 
@@ -22,8 +22,8 @@ stdenv.mkDerivation {
   meta = {
     description = "A C++ library which implements parts of the Avro Specification";
     homepage = "https://avro.apache.org/";
-    license = stdenv.lib.licenses.asl20;
-    maintainers = with stdenv.lib.maintainers; [ rasendubi ];
-    platforms = stdenv.lib.platforms.all;
+    license = lib.licenses.asl20;
+    maintainers = with lib.maintainers; [ rasendubi ];
+    platforms = lib.platforms.all;
   };
 }
diff --git a/pkgs/development/libraries/avro-c/default.nix b/pkgs/development/libraries/avro-c/default.nix
index b0dfd52ab16c7..a5acd7c7898b1 100644
--- a/pkgs/development/libraries/avro-c/default.nix
+++ b/pkgs/development/libraries/avro-c/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, cmake, fetchurl, pkg-config, jansson, zlib }:
+{ lib, stdenv, cmake, fetchurl, pkg-config, jansson, zlib }:
 
 let
   version = "1.9.1";
@@ -19,7 +19,7 @@ in stdenv.mkDerivation {
 
   buildInputs = [ jansson zlib ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A C library which implements parts of the Avro Specification";
     homepage = "https://avro.apache.org/";
     license = licenses.asl20;
diff --git a/pkgs/development/libraries/ayatana-ido/default.nix b/pkgs/development/libraries/ayatana-ido/default.nix
index 127fe1c975047..60417426f76cb 100644
--- a/pkgs/development/libraries/ayatana-ido/default.nix
+++ b/pkgs/development/libraries/ayatana-ido/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub
+{ lib, stdenv, fetchFromGitHub
 , pkg-config, autoreconfHook
 , gtk3, gobject-introspection, gtk-doc, vala
 }:
@@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ gtk3 ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Ayatana Display Indicator Objects";
     homepage = "https://github.com/AyatanaIndicators/ayatana-ido";
     changelog = "https://github.com/AyatanaIndicators/ayatana-ido/blob/${version}/ChangeLog";
diff --git a/pkgs/development/libraries/babl/default.nix b/pkgs/development/libraries/babl/default.nix
index ef24f0dadb77f..6e3a5abaaa651 100644
--- a/pkgs/development/libraries/babl/default.nix
+++ b/pkgs/development/libraries/babl/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , meson
 , ninja
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
   outputs = [ "out" "dev" ];
 
   src = fetchurl {
-    url = "https://download.gimp.org/pub/babl/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "https://download.gimp.org/pub/babl/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "sha256-5+OLhEH3f+udyCMctDSoYZCiHy82ksKBRX6Z016cNOo=";
   };
 
@@ -31,7 +31,7 @@ stdenv.mkDerivation rec {
     lcms2
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Image pixel format conversion library";
     homepage = "https://gegl.org/babl/";
     license = licenses.lgpl3Plus;
diff --git a/pkgs/development/libraries/bamf/default.nix b/pkgs/development/libraries/bamf/default.nix
index e7d8daf4d28c5..95d54993e0699 100644
--- a/pkgs/development/libraries/bamf/default.nix
+++ b/pkgs/development/libraries/bamf/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , pantheon
 , autoconf
 , automake
@@ -90,7 +90,7 @@ stdenv.mkDerivation rec {
   # glib-2.62 deprecations
   NIX_CFLAGS_COMPILE = "-DGLIB_DISABLE_DEPRECATION_WARNINGS";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Application matching framework";
     longDescription = ''
       Removes the headache of applications matching
diff --git a/pkgs/development/libraries/bcg729/default.nix b/pkgs/development/libraries/bcg729/default.nix
index f178c192de547..125512c3fed6c 100644
--- a/pkgs/development/libraries/bcg729/default.nix
+++ b/pkgs/development/libraries/bcg729/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitLab
 , cmake
 }:
@@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ cmake ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Opensource implementation of both encoder and decoder of the ITU G729 Annex A/B speech codec";
     homepage = "https://linphone.org/technical-corner/bcg729";
     changelog = "https://gitlab.linphone.org/BC/public/bcg729/raw/${version}/NEWS";
diff --git a/pkgs/development/libraries/bctoolbox/default.nix b/pkgs/development/libraries/bctoolbox/default.nix
index 655d3a5808a9b..dd72b7eb41dfe 100644
--- a/pkgs/development/libraries/bctoolbox/default.nix
+++ b/pkgs/development/libraries/bctoolbox/default.nix
@@ -2,7 +2,7 @@
 , cmake
 , fetchFromGitLab
 , mbedtls
-, stdenv
+, lib, stdenv
 }:
 
 stdenv.mkDerivation rec {
@@ -26,7 +26,7 @@ stdenv.mkDerivation rec {
 
   NIX_CFLAGS_COMPILE = [ "-Wno-error=stringop-truncation" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     inherit version;
     description = "Utilities library for Linphone";
     homepage = "https://gitlab.linphone.org/BC/public/bctoolbox";
diff --git a/pkgs/development/libraries/beecrypt/default.nix b/pkgs/development/libraries/beecrypt/default.nix
index 2433edbfe8f3a..6b86fca868f6b 100644
--- a/pkgs/development/libraries/beecrypt/default.nix
+++ b/pkgs/development/libraries/beecrypt/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, m4}:
+{lib, stdenv, fetchurl, m4}:
 
 stdenv.mkDerivation {
   name = "beecrypt-4.2.1";
@@ -10,7 +10,7 @@ stdenv.mkDerivation {
   configureFlags = [ "--disable-optimized" "--enable-static" ];
 
   meta = {
-    platforms = stdenv.lib.platforms.linux;
-    license = stdenv.lib.licenses.lgpl2;
+    platforms = lib.platforms.linux;
+    license = lib.licenses.lgpl2;
   };
 }
diff --git a/pkgs/development/libraries/beignet/default.nix b/pkgs/development/libraries/beignet/default.nix
index 29618623bbf08..8e8e455e59a6f 100644
--- a/pkgs/development/libraries/beignet/default.nix
+++ b/pkgs/development/libraries/beignet/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , cmake
 , pkg-config
@@ -96,7 +96,7 @@ stdenv.mkDerivation rec {
     '';
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://cgit.freedesktop.org/beignet/";
     description = "OpenCL Library for Intel Ivy Bridge and newer GPUs";
     longDescription = ''
diff --git a/pkgs/development/libraries/belcard/default.nix b/pkgs/development/libraries/belcard/default.nix
index df4e5329018d3..03f6e96e187d6 100644
--- a/pkgs/development/libraries/belcard/default.nix
+++ b/pkgs/development/libraries/belcard/default.nix
@@ -2,7 +2,7 @@
 , belr
 , cmake
 , fetchFromGitLab
-, stdenv
+, lib, stdenv
 }:
 
 stdenv.mkDerivation rec {
@@ -24,7 +24,7 @@ stdenv.mkDerivation rec {
   # Do not build static libraries
   cmakeFlags = [ "-DENABLE_STATIC=NO" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "C++ library to manipulate VCard standard format";
     homepage = "https://gitlab.linphone.org/BC/public/belcard";
     license = licenses.gpl3Plus;
diff --git a/pkgs/development/libraries/belle-sip/default.nix b/pkgs/development/libraries/belle-sip/default.nix
index 8a028b5e0a061..e08fc1ae3ee3c 100644
--- a/pkgs/development/libraries/belle-sip/default.nix
+++ b/pkgs/development/libraries/belle-sip/default.nix
@@ -4,7 +4,7 @@
 , fetchFromGitLab
 , libantlr3c
 , mbedtls
-, stdenv
+, lib, stdenv
 , zlib
 }:
 
@@ -36,7 +36,7 @@ stdenv.mkDerivation rec {
 
   propagatedBuildInputs = [ libantlr3c mbedtls bctoolbox ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://linphone.org/technical-corner/belle-sip";
     description = "Modern library implementing SIP (RFC 3261) transport, transaction and dialog layers";
     license = licenses.gpl3Plus;
diff --git a/pkgs/development/libraries/belr/default.nix b/pkgs/development/libraries/belr/default.nix
index ab3df9bae7ee0..b38757525abd1 100644
--- a/pkgs/development/libraries/belr/default.nix
+++ b/pkgs/development/libraries/belr/default.nix
@@ -1,7 +1,7 @@
 { bctoolbox
 , cmake
 , fetchFromGitLab
-, stdenv
+, lib, stdenv
 }:
 
 stdenv.mkDerivation rec {
@@ -23,7 +23,7 @@ stdenv.mkDerivation rec {
   # Do not build static libraries
   cmakeFlags = [ "-DENABLE_STATIC=NO" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Belledonne Communications' language recognition library";
     homepage = "https://gitlab.linphone.org/BC/public/belr";
     license = licenses.gpl3Plus;
diff --git a/pkgs/development/libraries/biblesync/default.nix b/pkgs/development/libraries/biblesync/default.nix
index 5286359b9461a..74a938cf2a5c9 100644
--- a/pkgs/development/libraries/biblesync/default.nix
+++ b/pkgs/development/libraries/biblesync/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, pkg-config, cmake, libuuid }:
+{ lib, stdenv, fetchFromGitHub, pkg-config, cmake, libuuid }:
 
 stdenv.mkDerivation rec {
 
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ pkg-config cmake ];
   buildInputs = [ libuuid ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://wiki.crosswire.org/BibleSync";
     description = "A multicast protocol to Bible software shared conavigation";
     longDescription = ''
@@ -29,6 +29,6 @@ stdenv.mkDerivation rec {
     '';
     license = licenses.publicDomain;
     maintainers = [ maintainers.AndersonTorres ];
-    platforms = stdenv.lib.platforms.linux;
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/development/libraries/bobcat/default.nix b/pkgs/development/libraries/bobcat/default.nix
index 5473801f85d2b..06c7ac81dcd20 100644
--- a/pkgs/development/libraries/bobcat/default.nix
+++ b/pkgs/development/libraries/bobcat/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitLab, icmake
+{ lib, stdenv, fetchFromGitLab, icmake
 , libmilter, libX11, openssl, readline
 , util-linux, yodl }:
 
@@ -35,7 +35,7 @@ stdenv.mkDerivation rec {
     ./build install x
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Brokken's Own Base Classes And Templates";
     homepage = "https://fbb-git.gitlab.io/bobcat/";
     license = licenses.gpl3;
diff --git a/pkgs/development/libraries/boehm-gc/7.6.6.nix b/pkgs/development/libraries/boehm-gc/7.6.6.nix
index cb2b24f580b52..13f490af3e2b9 100644
--- a/pkgs/development/libraries/boehm-gc/7.6.6.nix
+++ b/pkgs/development/libraries/boehm-gc/7.6.6.nix
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
   outputs = [ "out" "dev" "doc" ];
   separateDebugInfo = stdenv.isLinux;
 
-  preConfigure = stdenv.lib.optionalString (stdenv.hostPlatform.libc == "musl") ''
+  preConfigure = lib.optionalString (stdenv.hostPlatform.libc == "musl") ''
     export NIX_CFLAGS_COMPILE+=" -D_GNU_SOURCE -DUSE_MMAP -DHAVE_DL_ITERATE_PHDR"
   '';
 
@@ -69,6 +69,6 @@ stdenv.mkDerivation rec {
     license = "https://hboehm.info/gc/license.txt";
 
     maintainers = [ ];
-    platforms = stdenv.lib.platforms.all;
+    platforms = lib.platforms.all;
   };
 }
diff --git a/pkgs/development/libraries/boehm-gc/default.nix b/pkgs/development/libraries/boehm-gc/default.nix
index 1af63a2e42608..85ae01036ed1d 100644
--- a/pkgs/development/libraries/boehm-gc/default.nix
+++ b/pkgs/development/libraries/boehm-gc/default.nix
@@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
   outputs = [ "out" "dev" "doc" ];
   separateDebugInfo = stdenv.isLinux && stdenv.hostPlatform.libc != "musl";
 
-  preConfigure = stdenv.lib.optionalString (stdenv.hostPlatform.libc == "musl") ''
+  preConfigure = lib.optionalString (stdenv.hostPlatform.libc == "musl") ''
     export NIX_CFLAGS_COMPILE+=" -D_GNU_SOURCE -DUSE_MMAP -DHAVE_DL_ITERATE_PHDR"
   '';
 
@@ -64,6 +64,6 @@ stdenv.mkDerivation rec {
     license = "https://hboehm.info/gc/license.txt";
 
     maintainers = [ ];
-    platforms = stdenv.lib.platforms.all;
+    platforms = lib.platforms.all;
   };
 }
diff --git a/pkgs/development/libraries/boolstuff/default.nix b/pkgs/development/libraries/boolstuff/default.nix
index a056ece56e96c..b3d754fb54256 100644
--- a/pkgs/development/libraries/boolstuff/default.nix
+++ b/pkgs/development/libraries/boolstuff/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config }:
+{ lib, stdenv, fetchurl, pkg-config }:
 
 let baseurl = "https://perso.b2b2c.ca/~sarrazip/dev"; in
 
@@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
     description = "Library for operations on boolean expression binary trees";
     homepage = "${baseurl}/boolstuff.html";
     license = "GPL";
-    maintainers = [ stdenv.lib.maintainers.marcweber ];
-    platforms = stdenv.lib.platforms.linux;
+    maintainers = [ lib.maintainers.marcweber ];
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/development/libraries/boost-process/default.nix b/pkgs/development/libraries/boost-process/default.nix
index 92e02c6ca08f5..97e8798095285 100644
--- a/pkgs/development/libraries/boost-process/default.nix
+++ b/pkgs/development/libraries/boost-process/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, unzip }:
+{ lib, stdenv, fetchurl, unzip }:
 
 stdenv.mkDerivation {
   name = "boost-process-0.5";
@@ -21,7 +21,7 @@ stdenv.mkDerivation {
     cp -r boost $out/include
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://www.highscore.de/boost/process0.5/";
     description = "Library to manage system processes";
     license = licenses.boost;
diff --git a/pkgs/development/libraries/boost/1.67.nix b/pkgs/development/libraries/boost/1.67.nix
index 31f545ab12be3..29993ed02b8c7 100644
--- a/pkgs/development/libraries/boost/1.67.nix
+++ b/pkgs/development/libraries/boost/1.67.nix
@@ -1,4 +1,4 @@
-{ stdenv, callPackage, fetchurl, fetchpatch, ... } @ args:
+{ lib, stdenv, callPackage, fetchurl, fetchpatch, ... } @ args:
 
 callPackage ./generic.nix (args // {
   version = "1.67.0";
@@ -9,7 +9,7 @@ callPackage ./generic.nix (args // {
       sha256 = "0x65nkwzv8fdacj8sw5njl3v63jj19dirrpklbwy6qpsncw7fc7h";
       stripLen = 1;
     })
-  ] ++ stdenv.lib.optionals stdenv.cc.isClang [
+  ] ++ lib.optionals stdenv.cc.isClang [
     # Fixes https://github.com/boostorg/atomic/issues/15
     (fetchpatch {
       url = "https://github.com/boostorg/atomic/commit/6e14ca24dab50ad4c1fa8c27c7dd6f1cb791b534.patch";
diff --git a/pkgs/development/libraries/boost/generic.nix b/pkgs/development/libraries/boost/generic.nix
index ec3a28e2b1a38..5a2b437d41dc3 100644
--- a/pkgs/development/libraries/boost/generic.nix
+++ b/pkgs/development/libraries/boost/generic.nix
@@ -1,4 +1,4 @@
-{ stdenv, icu, expat, zlib, bzip2, python, fixDarwinDylibNames, libiconv
+{ lib, stdenv, icu, expat, zlib, bzip2, python, fixDarwinDylibNames, libiconv
 , fetchpatch
 , which
 , buildPackages
@@ -30,9 +30,9 @@ assert enablePython -> stdenv.hostPlatform == stdenv.buildPlatform;
 assert enableNumpy -> enablePython;
 
 # Boost <1.69 can't be build with clang >8, because pth was removed
-assert with stdenv.lib; ((toolset == "clang" && !(versionOlder stdenv.cc.version "8.0.0")) -> !(versionOlder version "1.69"));
+assert with lib; ((toolset == "clang" && !(versionOlder stdenv.cc.version "8.0.0")) -> !(versionOlder version "1.69"));
 
-with stdenv.lib;
+with lib;
 let
 
   variant = concatStringsSep ","
@@ -150,7 +150,7 @@ stdenv.mkDerivation {
     EOF
   '';
 
-  NIX_CFLAGS_LINK = stdenv.lib.optionalString stdenv.isDarwin
+  NIX_CFLAGS_LINK = lib.optionalString stdenv.isDarwin
                       "-headerpad_max_install_names";
 
   enableParallelBuilding = true;
diff --git a/pkgs/development/libraries/bootil/default.nix b/pkgs/development/libraries/bootil/default.nix
index a1924f59a8db0..f21362962048a 100644
--- a/pkgs/development/libraries/bootil/default.nix
+++ b/pkgs/development/libraries/bootil/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, fetchpatch, premake4 }:
+{ lib, stdenv, fetchFromGitHub, fetchpatch, premake4 }:
 
 stdenv.mkDerivation {
   name = "bootil-unstable-2015-12-17";
@@ -7,9 +7,9 @@ stdenv.mkDerivation {
     description = "Garry Newman's personal utility library";
     homepage = "https://github.com/garrynewman/bootil";
     # License unsure - see https://github.com/garrynewman/bootil/issues/21
-    license = stdenv.lib.licenses.free;
-    maintainers = [ stdenv.lib.maintainers.abigailbuccaneer ];
-    platforms = stdenv.lib.platforms.all;
+    license = lib.licenses.free;
+    maintainers = [ lib.maintainers.abigailbuccaneer ];
+    platforms = lib.platforms.all;
     # Build uses `-msse` and `-mfpmath=sse`
     badPlatforms = [ "aarch64-linux" ];
   };
diff --git a/pkgs/development/libraries/boringssl/default.nix b/pkgs/development/libraries/boringssl/default.nix
index eb13321523dd0..7019d39b16c73 100644
--- a/pkgs/development/libraries/boringssl/default.nix
+++ b/pkgs/development/libraries/boringssl/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchgit, cmake, perl, go }:
+{ lib, stdenv, fetchgit, cmake, perl, go }:
 
 # reference: https://boringssl.googlesource.com/boringssl/+/2661/BUILDING.md
 stdenv.mkDerivation {
@@ -29,7 +29,7 @@ stdenv.mkDerivation {
 
   outputs = [ "out" "bin" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Free TLS/SSL implementation";
     homepage    = "https://boringssl.googlesource.com";
     platforms   = platforms.all;
diff --git a/pkgs/development/libraries/botan/generic.nix b/pkgs/development/libraries/botan/generic.nix
index 173f074ead712..0369f603b8e10 100644
--- a/pkgs/development/libraries/botan/generic.nix
+++ b/pkgs/development/libraries/botan/generic.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, python, bzip2, zlib, gmp, openssl, boost
+{ lib, stdenv, fetchurl, python, bzip2, zlib, gmp, openssl, boost
 # Passed by version specific builders
 , baseVersion, revision, sha256
 , sourceExtension ? "tar.xz"
@@ -24,7 +24,7 @@ stdenv.mkDerivation rec {
   inherit postPatch;
 
   buildInputs = [ python bzip2 zlib gmp openssl boost ]
-    ++ stdenv.lib.optionals stdenv.isDarwin [ CoreServices Security ];
+    ++ lib.optionals stdenv.isDarwin [ CoreServices Security ];
 
   configurePhase = ''
     python configure.py --prefix=$out --with-bzip2 --with-zlib ${if openssl != null then "--with-openssl" else ""} ${extraConfigureFlags}${if stdenv.cc.isClang then " --cc=clang" else "" }
@@ -43,7 +43,7 @@ stdenv.mkDerivation rec {
     ln -s botan-*.pc botan.pc || true
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     inherit version;
     description = "Cryptographic algorithms library";
     maintainers = with maintainers; [ raskin ];
diff --git a/pkgs/development/libraries/box2d/default.nix b/pkgs/development/libraries/box2d/default.nix
index e93d4b549a234..47a1c0917f071 100644
--- a/pkgs/development/libraries/box2d/default.nix
+++ b/pkgs/development/libraries/box2d/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, unzip, cmake, libGLU, libGL, freeglut, libX11, xorgproto
+{ lib, stdenv, fetchurl, unzip, cmake, libGLU, libGL, freeglut, libX11, xorgproto
 , libXi, pkg-config }:
 
 stdenv.mkDerivation rec {
@@ -26,7 +26,7 @@ stdenv.mkDerivation rec {
       --replace 'b2_maxPolygonVertices	8' 'b2_maxPolygonVertices	15'
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "2D physics engine";
     homepage = "https://box2d.org/";
     maintainers = [ maintainers.raskin ];
diff --git a/pkgs/development/libraries/boxfort/default.nix b/pkgs/development/libraries/boxfort/default.nix
index 9a4e2c233561b..740e43216984a 100644
--- a/pkgs/development/libraries/boxfort/default.nix
+++ b/pkgs/development/libraries/boxfort/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, meson, ninja, python37Packages }:
+{ lib, stdenv, fetchFromGitHub, meson, ninja, python37Packages }:
 
 stdenv.mkDerivation rec {
   version = "unstable-2019-10-09";
@@ -23,7 +23,7 @@ stdenv.mkDerivation rec {
 
   outputs = [ "dev" "out" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Convenient & cross-platform sandboxing C library";
     homepage = "https://github.com/Snaipe/BoxFort";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/brigand/default.nix b/pkgs/development/libraries/brigand/default.nix
index cc5564d4bb7a6..eb46ccc8cd7c2 100644
--- a/pkgs/development/libraries/brigand/default.nix
+++ b/pkgs/development/libraries/brigand/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake }:
+{ lib, stdenv, fetchFromGitHub, cmake }:
 
 stdenv.mkDerivation {
   pname = "brigand";
@@ -13,7 +13,7 @@ stdenv.mkDerivation {
 
   nativeBuildInputs = [ cmake ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Instant compile time C++ 11 metaprogramming library";
     longDescription = ''
       Brigand is a light-weight, fully functional, instant-compile time C++ 11 meta-programming library.
diff --git a/pkgs/development/libraries/buddy/default.nix b/pkgs/development/libraries/buddy/default.nix
index d025b8c28ed05..a333a69ffa1b2 100644
--- a/pkgs/development/libraries/buddy/default.nix
+++ b/pkgs/development/libraries/buddy/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, bison }:
+{ lib, stdenv, fetchurl, bison }:
 
 stdenv.mkDerivation rec {
   name = "buddy-2.4";
@@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
     description = "Binary decision diagram package";
     license = "as-is";
 
-    platforms = stdenv.lib.platforms.unix; # Once had cygwin problems
-    maintainers = [ stdenv.lib.maintainers.peti ];
+    platforms = lib.platforms.unix; # Once had cygwin problems
+    maintainers = [ lib.maintainers.peti ];
   };
 }
diff --git a/pkgs/development/libraries/bullet/default.nix b/pkgs/development/libraries/bullet/default.nix
index 07222f469d110..50bf56bfbd221 100644
--- a/pkgs/development/libraries/bullet/default.nix
+++ b/pkgs/development/libraries/bullet/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, libGLU, libGL, freeglut
+{ lib, stdenv, fetchFromGitHub, cmake, libGLU, libGL, freeglut
 , Cocoa,  OpenGL
 }:
 
@@ -14,12 +14,12 @@ stdenv.mkDerivation rec {
   };
 
   nativeBuildInputs = [ cmake ];
-  buildInputs = stdenv.lib.optionals stdenv.isLinux [ libGLU libGL freeglut ]
-    ++ stdenv.lib.optionals stdenv.isDarwin [ Cocoa OpenGL ];
+  buildInputs = lib.optionals stdenv.isLinux [ libGLU libGL freeglut ]
+    ++ lib.optionals stdenv.isDarwin [ Cocoa OpenGL ];
 
   patches = [ ./gwen-narrowing.patch ];
 
-  postPatch = stdenv.lib.optionalString stdenv.isDarwin ''
+  postPatch = lib.optionalString stdenv.isDarwin ''
     sed -i 's/FIND_PACKAGE(OpenGL)//' CMakeLists.txt
     sed -i 's/FIND_LIBRARY(COCOA_LIBRARY Cocoa)//' CMakeLists.txt
   '';
@@ -28,7 +28,7 @@ stdenv.mkDerivation rec {
     "-DBUILD_SHARED_LIBS=ON"
     "-DBUILD_CPU_DEMOS=OFF"
     "-DINSTALL_EXTRA_LIBS=ON"
-  ] ++ stdenv.lib.optionals stdenv.isDarwin [
+  ] ++ lib.optionals stdenv.isDarwin [
     "-DOPENGL_FOUND=true"
     "-DOPENGL_LIBRARIES=${OpenGL}/Library/Frameworks/OpenGL.framework"
     "-DOPENGL_INCLUDE_DIR=${OpenGL}/Library/Frameworks/OpenGL.framework"
@@ -38,10 +38,10 @@ stdenv.mkDerivation rec {
     "-DBUILD_UNIT_TESTS=OFF"
   ];
 
-  NIX_CFLAGS_COMPILE = stdenv.lib.optionalString stdenv.cc.isClang
+  NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isClang
     "-Wno-error=argument-outside-range -Wno-error=c++11-narrowing";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A professional free 3D Game Multiphysics Library";
     longDescription = ''
       Bullet 3D Game Multiphysics Library provides state of the art collision
diff --git a/pkgs/development/libraries/bullet/roboschool-fork.nix b/pkgs/development/libraries/bullet/roboschool-fork.nix
index 1387048070f35..a3966eaa4a395 100644
--- a/pkgs/development/libraries/bullet/roboschool-fork.nix
+++ b/pkgs/development/libraries/bullet/roboschool-fork.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, libGLU, libGL, freeglut
+{ lib, stdenv, fetchFromGitHub, cmake, libGLU, libGL, freeglut
 , Cocoa,  OpenGL
 }:
 
@@ -18,12 +18,12 @@ stdenv.mkDerivation {
   };
 
   nativeBuildInputs = [ cmake ];
-  buildInputs = stdenv.lib.optionals stdenv.isLinux [ libGLU libGL freeglut ]
-    ++ stdenv.lib.optionals stdenv.isDarwin [ Cocoa OpenGL ];
+  buildInputs = lib.optionals stdenv.isLinux [ libGLU libGL freeglut ]
+    ++ lib.optionals stdenv.isDarwin [ Cocoa OpenGL ];
 
   patches = [ ./gwen-narrowing.patch ];
 
-  postPatch = stdenv.lib.optionalString stdenv.isDarwin ''
+  postPatch = lib.optionalString stdenv.isDarwin ''
     sed -i 's/FIND_PACKAGE(OpenGL)//' CMakeLists.txt
     sed -i 's/FIND_LIBRARY(COCOA_LIBRARY Cocoa)//' CMakeLists.txt
   '';
@@ -32,7 +32,7 @@ stdenv.mkDerivation {
     "-DBUILD_SHARED_LIBS=ON"
     "-DBUILD_CPU_DEMOS=OFF"
     "-DINSTALL_EXTRA_LIBS=ON"
-  ] ++ stdenv.lib.optionals stdenv.isDarwin [
+  ] ++ lib.optionals stdenv.isDarwin [
     "-DOPENGL_FOUND=true"
     "-DOPENGL_LIBRARIES=${OpenGL}/Library/Frameworks/OpenGL.framework"
     "-DOPENGL_INCLUDE_DIR=${OpenGL}/Library/Frameworks/OpenGL.framework"
@@ -42,7 +42,7 @@ stdenv.mkDerivation {
     "-DBUILD_UNIT_TESTS=OFF"
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A professional free 3D Game Multiphysics Library";
     longDescription = ''
       Bullet 3D Game Multiphysics Library provides state of the art collision
diff --git a/pkgs/development/libraries/bulletml/default.nix b/pkgs/development/libraries/bulletml/default.nix
index f64090bd53a3d..3da05302ac9ff 100644
--- a/pkgs/development/libraries/bulletml/default.nix
+++ b/pkgs/development/libraries/bulletml/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchpatch, fetchurl, bison, perl }:
+{ lib, stdenv, fetchpatch, fetchurl, bison, perl }:
 
 let
   version = "0.0.6";
@@ -58,7 +58,7 @@ in stdenv.mkDerivation {
     install -m 644 README.en "$out"/share/licenses/libbulletml
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "C++ library to handle BulletML easily";
     longDescription = ''
       BulletML is the Bullet Markup Language. BulletML can describe the barrage
diff --git a/pkgs/development/libraries/bwidget/default.nix b/pkgs/development/libraries/bwidget/default.nix
index ff9e6aa038f51..f3f09497a6608 100644
--- a/pkgs/development/libraries/bwidget/default.nix
+++ b/pkgs/development/libraries/bwidget/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, tcl }:
+{ lib, stdenv, fetchurl, tcl }:
 
 stdenv.mkDerivation rec {
   pname = "bwidget";
@@ -25,7 +25,7 @@ stdenv.mkDerivation rec {
   meta = {
     homepage = "https://sourceforge.net/projects/tcllib";
     description = "High-level widget set for Tcl/Tk";
-    license = stdenv.lib.licenses.tcltk;
-    platforms = stdenv.lib.platforms.linux;
+    license = lib.licenses.tcltk;
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/development/libraries/bzrtp/default.nix b/pkgs/development/libraries/bzrtp/default.nix
index 3eb99549246e9..0adcb327cc4d4 100644
--- a/pkgs/development/libraries/bzrtp/default.nix
+++ b/pkgs/development/libraries/bzrtp/default.nix
@@ -2,7 +2,7 @@
 , cmake
 , fetchFromGitLab
 , sqlite
-, stdenv
+, lib, stdenv
 }:
 
 stdenv.mkDerivation rec {
@@ -26,7 +26,7 @@ stdenv.mkDerivation rec {
 
   NIX_CFLAGS_COMPILE = "-Wno-error=cast-function-type";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "An opensource implementation of ZRTP keys exchange protocol";
     homepage = "https://gitlab.linphone.org/BC/public/bzrtp";
     license = licenses.gpl3Plus;
diff --git a/pkgs/development/libraries/c-ares/default.nix b/pkgs/development/libraries/c-ares/default.nix
index ac0dc43c67a5b..20bcf80d9e592 100644
--- a/pkgs/development/libraries/c-ares/default.nix
+++ b/pkgs/development/libraries/c-ares/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, writeTextDir }:
+{ lib, stdenv, fetchurl, writeTextDir }:
 
 # Note: this package is used for bootstrapping fetchurl, and thus
 # cannot use fetchpatch! All mutable patches (generated by GitHub or
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
     sha256 = "0h7wjfnk2092glqcp9mqaax7xx0s13m501z1gi0gsjl2vvvd0gfp";
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A C library for asynchronous DNS requests";
     homepage = "https://c-ares.haxx.se";
     license = licenses.mit;
@@ -33,7 +33,7 @@ stdenv.mkDerivation rec {
 
       set_target_properties(c-ares::cares PROPERTIES
         INTERFACE_INCLUDE_DIRECTORIES "${self}/include"
-        ${stdenv.lib.optionalString stdenv.isLinux ''INTERFACE_LINK_LIBRARIES "nsl;rt"''}
+        ${lib.optionalString stdenv.isLinux ''INTERFACE_LINK_LIBRARIES "nsl;rt"''}
       )
       set_property(TARGET c-ares::cares APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
       set_target_properties(c-ares::cares PROPERTIES
diff --git a/pkgs/development/libraries/c-blosc/default.nix b/pkgs/development/libraries/c-blosc/default.nix
index 7dfcce8e9d8c4..a7420e300ed46 100644
--- a/pkgs/development/libraries/c-blosc/default.nix
+++ b/pkgs/development/libraries/c-blosc/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake }:
+{ lib, stdenv, fetchFromGitHub, cmake }:
 
 stdenv.mkDerivation rec {
   pname = "c-blosc";
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ cmake ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A blocking, shuffling and loss-less compression library";
     homepage = "https://www.blosc.org";
     license = licenses.bsd3;
diff --git a/pkgs/development/libraries/caf/default.nix b/pkgs/development/libraries/caf/default.nix
index 74ca27f2e3c09..fdc06df948d75 100644
--- a/pkgs/development/libraries/caf/default.nix
+++ b/pkgs/development/libraries/caf/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, openssl }:
+{ lib, stdenv, fetchFromGitHub, cmake, openssl }:
 
 stdenv.mkDerivation rec {
   pname = "actor-framework";
@@ -26,7 +26,7 @@ stdenv.mkDerivation rec {
     export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH''${DYLD_LIBRARY_PATH:+:}$PWD/lib
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "An open source implementation of the actor model in C++";
     homepage = "http://actor-framework.org/";
     license = licenses.bsd3;
diff --git a/pkgs/development/libraries/cairo/default.nix b/pkgs/development/libraries/cairo/default.nix
index 2eedfbb7b0ee2..26e37738d5563 100644
--- a/pkgs/development/libraries/cairo/default.nix
+++ b/pkgs/development/libraries/cairo/default.nix
@@ -1,9 +1,9 @@
-{ config, stdenv, fetchurl, fetchpatch, pkg-config, libiconv
+{ config, lib, stdenv, fetchurl, fetchpatch, pkg-config, libiconv
 , libintl, expat, zlib, libpng, pixman, fontconfig, freetype
 , x11Support? !stdenv.isDarwin, libXext, libXrender
 , gobjectSupport ? true, glib
 , xcbSupport ? x11Support, libxcb, xcbutil # no longer experimental since 1.12
-, libGLSupported ? stdenv.lib.elem stdenv.hostPlatform.system stdenv.lib.platforms.mesaPlatforms
+, libGLSupported ? lib.elem stdenv.hostPlatform.system stdenv.lib.platforms.mesaPlatforms
 , glSupport ? x11Support && config.cairo.gl or (libGLSupported && stdenv.isLinux)
 , libGL ? null # libGLU libGL is no longer a big dependency
 , pdfSupport ? true
@@ -14,13 +14,13 @@ assert glSupport -> x11Support && libGL != null;
 
 let
   version = "1.16.0";
-  inherit (stdenv.lib) optional optionals;
+  inherit (lib) optional optionals;
 in stdenv.mkDerivation rec {
   pname = "cairo";
   inherit version;
 
   src = fetchurl {
-    url = "https://cairographics.org/${if stdenv.lib.mod (builtins.fromJSON (stdenv.lib.versions.minor version)) 2 == 0 then "releases" else "snapshots"}/${pname}-${version}.tar.xz";
+    url = "https://cairographics.org/${if lib.mod (builtins.fromJSON (stdenv.lib.versions.minor version)) 2 == 0 then "releases" else "snapshots"}/${pname}-${version}.tar.xz";
     sha256 = "0c930mk5xr2bshbdljv005j3j8zr47gqmkry3q6qgvqky6rjjysy";
   };
 
@@ -78,7 +78,7 @@ in stdenv.mkDerivation rec {
 
   preConfigure =
   # On FreeBSD, `-ldl' doesn't exist.
-    stdenv.lib.optionalString stdenv.isFreeBSD
+    lib.optionalString stdenv.isFreeBSD
        '' for i in "util/"*"/Makefile.in" boilerplate/Makefile.in
           do
             cat "$i" | sed -es/-ldl//g > t
@@ -98,9 +98,9 @@ in stdenv.mkDerivation rec {
 
   doCheck = false; # fails
 
-  postInstall = stdenv.lib.optionalString stdenv.isDarwin glib.flattenInclude;
+  postInstall = lib.optionalString stdenv.isDarwin glib.flattenInclude;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A 2D graphics library with support for multiple output devices";
 
     longDescription = ''
diff --git a/pkgs/development/libraries/cairomm/default.nix b/pkgs/development/libraries/cairomm/default.nix
index cbf9eedc8d5e2..87b391d2ad0e1 100644
--- a/pkgs/development/libraries/cairomm/default.nix
+++ b/pkgs/development/libraries/cairomm/default.nix
@@ -1,4 +1,4 @@
-{ fetchurl, stdenv, pkg-config, darwin, cairo, fontconfig, freetype, libsigcxx }:
+{ fetchurl, lib, stdenv, pkg-config, darwin, cairo, fontconfig, freetype, libsigcxx }:
 stdenv.mkDerivation rec {
   pname = "cairomm";
   version = "1.12.2";
@@ -6,7 +6,7 @@ stdenv.mkDerivation rec {
   src = fetchurl {
     url = "https://www.cairographics.org/releases/${pname}-${version}.tar.gz";
     # gnome doesn't have the latest version ATM; beware: same name but different hash
-    #url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    #url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "16fmigxsaz85c3lgcls7biwyz8zy8c8h3jndfm54cxxas3a7zi25";
   };
 
@@ -15,13 +15,13 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ pkg-config ];
   propagatedBuildInputs = [ cairo libsigcxx ];
   buildInputs = [ fontconfig freetype ]
-  ++ stdenv.lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [
+  ++ lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [
     ApplicationServices
   ]);
 
   doCheck = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A 2D graphics library with support for multiple output devices";
 
     longDescription = ''
diff --git a/pkgs/development/libraries/capnproto/default.nix b/pkgs/development/libraries/capnproto/default.nix
index ad2517f25890c..da6aae64db522 100644
--- a/pkgs/development/libraries/capnproto/default.nix
+++ b/pkgs/development/libraries/capnproto/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
   pname = "capnproto";
@@ -9,7 +9,7 @@ stdenv.mkDerivation rec {
     sha256 = "03f1862ljdshg7d0rg3j7jzgm3ip55kzd2y91q7p0racax3hxx6i";
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage    = "http://kentonv.github.io/capnproto";
     description = "Cap'n Proto cerealization protocol";
     longDescription = ''
diff --git a/pkgs/development/libraries/capstone/default.nix b/pkgs/development/libraries/capstone/default.nix
index 1e51822703590..623021f1dda38 100644
--- a/pkgs/development/libraries/capstone/default.nix
+++ b/pkgs/development/libraries/capstone/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config }:
+{ lib, stdenv, fetchurl, pkg-config }:
 
 stdenv.mkDerivation rec {
   pname = "capstone";
@@ -10,7 +10,7 @@ stdenv.mkDerivation rec {
   };
 
   # replace faulty macos detection
-  postPatch = stdenv.lib.optionalString stdenv.isDarwin ''
+  postPatch = lib.optionalString stdenv.isDarwin ''
     sed -i 's/^IS_APPLE := .*$/IS_APPLE := 1/' Makefile
   '';
 
@@ -24,7 +24,7 @@ stdenv.mkDerivation rec {
     make check
   '';
 
-  installPhase = (stdenv.lib.optionalString stdenv.isDarwin "HOMEBREW_CAPSTONE=1 ")
+  installPhase = (lib.optionalString stdenv.isDarwin "HOMEBREW_CAPSTONE=1 ")
     + "PREFIX=$out ./make.sh install";
 
   nativeBuildInputs = [
@@ -36,8 +36,8 @@ stdenv.mkDerivation rec {
   meta = {
     description = "Advanced disassembly library";
     homepage    = "http://www.capstone-engine.org";
-    license     = stdenv.lib.licenses.bsd3;
-    platforms   = stdenv.lib.platforms.unix;
-    maintainers = with stdenv.lib.maintainers; [ thoughtpolice ris ];
+    license     = lib.licenses.bsd3;
+    platforms   = lib.platforms.unix;
+    maintainers = with lib.maintainers; [ thoughtpolice ris ];
   };
 }
diff --git a/pkgs/development/libraries/catch/default.nix b/pkgs/development/libraries/catch/default.nix
index 36d4960cdccba..2aa5c788dc362 100644
--- a/pkgs/development/libraries/catch/default.nix
+++ b/pkgs/development/libraries/catch/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake }:
+{ lib, stdenv, fetchFromGitHub, cmake }:
 
 stdenv.mkDerivation rec {
   pname = "catch";
@@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
   doCheck = true;
   checkTarget = "test";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A multi-paradigm automated test framework for C++ and Objective-C (and, maybe, C)";
     homepage = "http://catch-lib.net";
     license = licenses.boost;
diff --git a/pkgs/development/libraries/catch2/default.nix b/pkgs/development/libraries/catch2/default.nix
index 68c1669118336..34d61a519ab35 100644
--- a/pkgs/development/libraries/catch2/default.nix
+++ b/pkgs/development/libraries/catch2/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake }:
+{ lib, stdenv, fetchFromGitHub, cmake }:
 
 stdenv.mkDerivation rec {
   pname = "catch2";
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
 
   cmakeFlags = [ "-H.." ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A multi-paradigm automated test framework for C++ and Objective-C (and, maybe, C)";
     homepage = "http://catch-lib.net";
     license = licenses.boost;
diff --git a/pkgs/development/libraries/ccrtp/default.nix b/pkgs/development/libraries/ccrtp/default.nix
index 7813e53a41ebd..39792d4fd6a13 100644
--- a/pkgs/development/libraries/ccrtp/default.nix
+++ b/pkgs/development/libraries/ccrtp/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, ucommon, openssl, libgcrypt }:
+{ lib, stdenv, fetchurl, pkg-config, ucommon, openssl, libgcrypt }:
 
 stdenv.mkDerivation rec {
   name = "ccrtp-2.1.2";
@@ -20,8 +20,8 @@ stdenv.mkDerivation rec {
   meta = {
     description = "An implementation of the IETF real-time transport protocol (RTP)";
     homepage = "https://www.gnu.org/software/ccrtp/";
-    license = stdenv.lib.licenses.gpl2;
-    maintainers = with stdenv.lib.maintainers; [ marcweber ];
-    platforms = stdenv.lib.platforms.linux;
+    license = lib.licenses.gpl2;
+    maintainers = with lib.maintainers; [ marcweber ];
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/development/libraries/cctz/default.nix b/pkgs/development/libraries/cctz/default.nix
index 848927776f901..aff977edd9123 100644
--- a/pkgs/development/libraries/cctz/default.nix
+++ b/pkgs/development/libraries/cctz/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, darwin }:
+{ lib, stdenv, fetchFromGitHub, darwin }:
 
 stdenv.mkDerivation rec {
   pname = "cctz";
@@ -13,17 +13,17 @@ stdenv.mkDerivation rec {
 
   makeFlags = [ "PREFIX=$(out)" ];
 
-  buildInputs = stdenv.lib.optional stdenv.isDarwin darwin.apple_sdk.frameworks.Foundation;
+  buildInputs = lib.optional stdenv.isDarwin darwin.apple_sdk.frameworks.Foundation;
 
   installTargets = [ "install_hdrs" "install_shared_lib" ];
 
-  postInstall = stdenv.lib.optionalString stdenv.isDarwin ''
+  postInstall = lib.optionalString stdenv.isDarwin ''
     install_name_tool -id $out/lib/libcctz.so $out/lib/libcctz.so
   '';
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/google/cctz";
     description = "C++ library for translating between absolute and civil times";
     license = licenses.asl20;
diff --git a/pkgs/development/libraries/cddlib/default.nix b/pkgs/development/libraries/cddlib/default.nix
index 4b745a2a348c5..9ff54f8ebf9d0 100644
--- a/pkgs/development/libraries/cddlib/default.nix
+++ b/pkgs/development/libraries/cddlib/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , gmp
 , autoreconfHook
@@ -22,7 +22,7 @@ stdenv.mkDerivation rec {
   # No actual checks yet (2018-05-05), but maybe one day.
   # Requested here: https://github.com/cddlib/cddlib/issues/25
   doCheck = true;
-  meta = with stdenv.lib; {
+  meta = with lib; {
     inherit version;
     description = "An implementation of the Double Description Method for generating all vertices of a convex polyhedron";
     license = licenses.gpl2Plus;
diff --git a/pkgs/development/libraries/cdk/default.nix b/pkgs/development/libraries/cdk/default.nix
index a95e22645cb8e..1a4f617cf469b 100644
--- a/pkgs/development/libraries/cdk/default.nix
+++ b/pkgs/development/libraries/cdk/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, ncurses }:
+{ lib, stdenv, fetchurl, ncurses }:
 
 stdenv.mkDerivation rec {
   pname = "cdk";
@@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
     sha256 = "sha256-xBbJh793tPGycD18XkM7qUWMi+Uma/RUy/gBrYfnKTY=";
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Curses development kit";
     license = licenses.bsdOriginal ;
     maintainers = [ maintainers.raskin ];
diff --git a/pkgs/development/libraries/cdo/default.nix b/pkgs/development/libraries/cdo/default.nix
index 10e145b34ea28..a038b5885c2b7 100644
--- a/pkgs/development/libraries/cdo/default.nix
+++ b/pkgs/development/libraries/cdo/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, curl, hdf5, netcdf
+{ lib, stdenv, fetchurl, curl, hdf5, netcdf
 , # build, install and link to a CDI library [default=no]
   enable_cdi_lib ? false
 , # build a completely statically linked CDO binary
@@ -22,11 +22,11 @@ stdenv.mkDerivation rec {
  # Configure phase
  configureFlags = [
    "--with-netcdf=${netcdf}" "--with-hdf5=${hdf5}"]
-   ++ stdenv.lib.optional (enable_cdi_lib) "--enable-cdi-lib"
-   ++ stdenv.lib.optional (enable_all_static) "--enable-all-static"
-   ++ stdenv.lib.optional (enable_cxx) "--enable-cxx";
+   ++ lib.optional (enable_cdi_lib) "--enable-cdi-lib"
+   ++ lib.optional (enable_all_static) "--enable-all-static"
+   ++ lib.optional (enable_cxx) "--enable-cxx";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Collection of command line Operators to manipulate and analyse Climate and NWP model Data";
     longDescription = ''
       Supported data formats are GRIB 1/2, netCDF 3/4, SERVICE, EXTRA and IEG.
diff --git a/pkgs/development/libraries/cegui/default.nix b/pkgs/development/libraries/cegui/default.nix
index 7397bdceb7692..ba3366198c2c8 100644
--- a/pkgs/development/libraries/cegui/default.nix
+++ b/pkgs/development/libraries/cegui/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, cmake, ogre, freetype, boost, expat }:
+{ lib, stdenv, fetchurl, cmake, ogre, freetype, boost, expat }:
 
 stdenv.mkDerivation rec {
   pname = "cegui";
@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ cmake ];
   buildInputs = [ ogre freetype boost expat ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://cegui.org.uk/";
     description = "C++ Library for creating GUIs";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/celt/generic.nix b/pkgs/development/libraries/celt/generic.nix
index 6277c5cd931ca..d4fe5e83658b1 100644
--- a/pkgs/development/libraries/celt/generic.nix
+++ b/pkgs/development/libraries/celt/generic.nix
@@ -1,4 +1,4 @@
-{ stdenv, version, src
+{ lib, stdenv, version, src
 , liboggSupport ? true, libogg ? null # if disabled only the library will be built
 , prePatch ? ""
 , ...
@@ -15,11 +15,11 @@ stdenv.mkDerivation {
   inherit prePatch;
 
   buildInputs = []
-    ++ stdenv.lib.optional liboggSupport libogg;
+    ++ lib.optional liboggSupport libogg;
 
   doCheck = false; # fails
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Ultra-low delay audio codec";
     homepage    = "http://www.celt-codec.org/";
     license     = licenses.bsd2;
diff --git a/pkgs/development/libraries/cereal/default.nix b/pkgs/development/libraries/cereal/default.nix
index e17b42ea5c1d6..d2321175f8bdf 100644
--- a/pkgs/development/libraries/cereal/default.nix
+++ b/pkgs/development/libraries/cereal/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake }:
+{ lib, stdenv, fetchFromGitHub, cmake }:
 stdenv.mkDerivation rec {
   pname = "cereal";
   version = "1.3.0";
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
 
   cmakeFlagsArray = [ "-DJUST_INSTALL_CEREAL=yes" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A header-only C++11 serialization library";
     homepage    = "https://uscilab.github.io/cereal/";
     platforms   = platforms.all;
diff --git a/pkgs/development/libraries/ceres-solver/default.nix b/pkgs/development/libraries/ceres-solver/default.nix
index 18f029c45852e..14d0e38f3d9f8 100644
--- a/pkgs/development/libraries/ceres-solver/default.nix
+++ b/pkgs/development/libraries/ceres-solver/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , eigen
 , fetchurl
 , cmake
@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ cmake ];
   buildInputs = [ eigen glog ]
-    ++ stdenv.lib.optional runTests gflags;
+    ++ lib.optional runTests gflags;
 
   # The Basel BUILD file conflicts with the cmake build directory on
   # case-insensitive filesystems, eg. darwin.
@@ -33,7 +33,7 @@ stdenv.mkDerivation rec {
 
   checkTarget = "test";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "C++ library for modeling and solving large, complicated optimization problems";
     license = licenses.bsd3;
     homepage = "http://ceres-solver.org";
diff --git a/pkgs/development/libraries/cfitsio/default.nix b/pkgs/development/libraries/cfitsio/default.nix
index 1b7dc58c0d661..28bb0761777c2 100644
--- a/pkgs/development/libraries/cfitsio/default.nix
+++ b/pkgs/development/libraries/cfitsio/default.nix
@@ -1,4 +1,4 @@
-{ fetchurl, stdenv
+{ fetchurl, lib, stdenv
 
 # Optional dependencies
 , bzip2 ? null }:
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
 
   patches = [ ./darwin-rpath-universal.patch ];
 
-  configureFlags = stdenv.lib.optional (bzip2 != null) "--with-bzip2=${bzip2.out}";
+  configureFlags = lib.optional (bzip2 != null) "--with-bzip2=${bzip2.out}";
 
   hardeningDisable = [ "format" ];
 
@@ -24,7 +24,7 @@ stdenv.mkDerivation rec {
   postPatch = '' sed -e '/^install:/s/libcfitsio.a //' -e 's@/bin/@@g' -i Makefile.in
    '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://heasarc.gsfc.nasa.gov/fitsio/";
     description = "Library for reading and writing FITS data files";
     longDescription =
diff --git a/pkgs/development/libraries/cgui/default.nix b/pkgs/development/libraries/cgui/default.nix
index d6c550a8da87f..1bc85d1fcd812 100644
--- a/pkgs/development/libraries/cgui/default.nix
+++ b/pkgs/development/libraries/cgui/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, texinfo, allegro, perl, libX11 }:
+{ lib, stdenv, fetchurl, texinfo, allegro, perl, libX11 }:
 
 stdenv.mkDerivation rec {
   pname = "cgui";
@@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
 
   makeFlags = [ "SYSTEM_DIR=$(out)" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A multiplatform basic GUI library";
     maintainers = [ maintainers.raskin ];
     platforms = platforms.linux;
diff --git a/pkgs/development/libraries/check/default.nix b/pkgs/development/libraries/check/default.nix
index be000e457c40e..37bde1caf4375 100644
--- a/pkgs/development/libraries/check/default.nix
+++ b/pkgs/development/libraries/check/default.nix
@@ -1,4 +1,4 @@
-{ fetchurl, stdenv
+{ fetchurl, lib, stdenv
 , CoreServices
 }:
 
@@ -14,9 +14,9 @@ stdenv.mkDerivation rec {
   # Test can randomly fail: https://hydra.nixos.org/build/7243912
   doCheck = false;
 
-  buildInputs = stdenv.lib.optional stdenv.isDarwin CoreServices;
+  buildInputs = lib.optional stdenv.isDarwin CoreServices;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Unit testing framework for C";
 
     longDescription =
diff --git a/pkgs/development/libraries/chipmunk/default.nix b/pkgs/development/libraries/chipmunk/default.nix
index 7618476d62a09..8290e60a48507 100644
--- a/pkgs/development/libraries/chipmunk/default.nix
+++ b/pkgs/development/libraries/chipmunk/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, cmake, freeglut, libGLU, libGL, glfw2, glew, libX11, xorgproto
+{ lib, stdenv, fetchurl, cmake, freeglut, libGLU, libGL, glfw2, glew, libX11, xorgproto
 , libXi, libXmu, fetchpatch, libXrandr
 }:
 
@@ -28,7 +28,7 @@ stdenv.mkDerivation rec {
     cp demo/chipmunk_demos $out/bin
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A fast and lightweight 2D game physics library";
     homepage = "http://chipmunk2d.net/";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/chmlib/default.nix b/pkgs/development/libraries/chmlib/default.nix
index 9b95fd2644463..8971acc7eddf5 100644
--- a/pkgs/development/libraries/chmlib/default.nix
+++ b/pkgs/development/libraries/chmlib/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, autoreconfHook }:
+{ lib, stdenv, fetchFromGitHub, autoreconfHook }:
 
 stdenv.mkDerivation rec {
   name = "chmlib-0.40a";
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
 
   meta = {
     homepage = "http://www.jedrea.com/chmlib";
-    license = stdenv.lib.licenses.lgpl2;
+    license = lib.licenses.lgpl2;
     description = "A library for dealing with Microsoft ITSS/CHM format files";
     platforms = ["x86_64-linux" "i686-linux" "x86_64-darwin" "aarch64-linux"];
   };
diff --git a/pkgs/development/libraries/chromaprint/default.nix b/pkgs/development/libraries/chromaprint/default.nix
index 12f844aa59587..599ef02eec091 100644
--- a/pkgs/development/libraries/chromaprint/default.nix
+++ b/pkgs/development/libraries/chromaprint/default.nix
@@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
 
   cmakeFlags = [ "-DBUILD_EXAMPLES=ON" "-DBUILD_TOOLS=ON" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://acoustid.org/chromaprint";
     description = "AcoustID audio fingerprinting library";
     maintainers = with maintainers; [ ehmry ];
diff --git a/pkgs/development/libraries/cimg/default.nix b/pkgs/development/libraries/cimg/default.nix
index 61d3996a4f5b6..eb55178db0df7 100644
--- a/pkgs/development/libraries/cimg/default.nix
+++ b/pkgs/development/libraries/cimg/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub }:
+{ lib, stdenv, fetchFromGitHub }:
 
 stdenv.mkDerivation rec {
   pname = "cimg";
@@ -22,7 +22,7 @@ stdenv.mkDerivation rec {
 
   outputs = [ "out" "doc" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A small, open source, C++ toolkit for image processing";
     longDescription = ''
       CImg stands for Cool Image. It is easy to use, efficient and is intended
diff --git a/pkgs/development/libraries/civetweb/default.nix b/pkgs/development/libraries/civetweb/default.nix
index 4092a9c9c5b8c..8a3474a491f3d 100644
--- a/pkgs/development/libraries/civetweb/default.nix
+++ b/pkgs/development/libraries/civetweb/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 }:
 
@@ -36,6 +36,6 @@ stdenv.mkDerivation rec {
   meta = {
     description = "Embedded C/C++ web server";
     homepage = "https://github.com/civetweb/civetweb";
-    license = [ stdenv.lib.licenses.mit ];
+    license = [ lib.licenses.mit ];
   };
 }
diff --git a/pkgs/development/libraries/cl/default.nix b/pkgs/development/libraries/cl/default.nix
index aad14bead6602..a4b526ea25d33 100644
--- a/pkgs/development/libraries/cl/default.nix
+++ b/pkgs/development/libraries/cl/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchFromGitHub, rebar, erlang, opencl-headers, ocl-icd }:
+{lib, stdenv, fetchFromGitHub, rebar, erlang, opencl-headers, ocl-icd }:
 
 stdenv.mkDerivation rec {
   version = "1.2.4";
@@ -25,7 +25,7 @@ stdenv.mkDerivation rec {
     cp -ruv c_src doc ebin include priv src $DIR
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/tonyrog/cl";
     description = "OpenCL binding for Erlang";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/classads/default.nix b/pkgs/development/libraries/classads/default.nix
index 68706c7b8d191..ba8961c8f6c0d 100644
--- a/pkgs/development/libraries/classads/default.nix
+++ b/pkgs/development/libraries/classads/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pcre }:
+{ lib, stdenv, fetchurl, pcre }:
 
 let version = "1.0.10"; in
 
@@ -20,7 +20,7 @@ stdenv.mkDerivation {
   meta = {
     homepage = "http://www.cs.wisc.edu/condor/classad/";
     description = "The Classified Advertisements library provides a generic means for matching resources";
-    license = stdenv.lib.licenses.asl20;
-    platforms = stdenv.lib.platforms.unix;
+    license = lib.licenses.asl20;
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/clearsilver/default.nix b/pkgs/development/libraries/clearsilver/default.nix
index 8b79619dff4b8..74d167144a9fc 100644
--- a/pkgs/development/libraries/clearsilver/default.nix
+++ b/pkgs/development/libraries/clearsilver/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, fetchpatch, python }:
+{ lib, stdenv, fetchurl, fetchpatch, python }:
 
 stdenv.mkDerivation rec {
   name = "clearsilver-0.10.5";
@@ -35,7 +35,7 @@ stdenv.mkDerivation rec {
     })
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Fast, powerful, and language-neutral HTML template system";
     homepage = "http://www.clearsilver.net/";
     license = licenses.free;
diff --git a/pkgs/development/libraries/clfft/default.nix b/pkgs/development/libraries/clfft/default.nix
index 5eb5b842ecfa3..91267208d2e60 100644
--- a/pkgs/development/libraries/clfft/default.nix
+++ b/pkgs/development/libraries/clfft/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, fftw, fftwFloat, boost166, opencl-clhpp, ocl-icd }:
+{ lib, stdenv, fetchFromGitHub, cmake, fftw, fftwFloat, boost166, opencl-clhpp, ocl-icd }:
 
 let
   version = "2.12.2";
@@ -19,7 +19,7 @@ in stdenv.mkDerivation {
 
   buildInputs = [ fftw fftwFloat boost166 opencl-clhpp ocl-icd ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Library containing FFT functions written in OpenCL";
     longDescription = ''
       clFFT is a software library containing FFT functions written in OpenCL.
diff --git a/pkgs/development/libraries/clipp/default.nix b/pkgs/development/libraries/clipp/default.nix
index f7c8f90e86866..12b393e597d40 100644
--- a/pkgs/development/libraries/clipp/default.nix
+++ b/pkgs/development/libraries/clipp/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub }:
+{ lib, stdenv, fetchFromGitHub }:
 
 stdenv.mkDerivation rec {
   pname = "clipp";
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
       --subst-var version
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Easy to use, powerful and expressive command line argument handling for C++11/14/17";
     homepage = "https://github.com/muellan/clipp";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/clipper/default.nix b/pkgs/development/libraries/clipper/default.nix
index ebb41fde4238f..9eb34f6b68639 100644
--- a/pkgs/development/libraries/clipper/default.nix
+++ b/pkgs/development/libraries/clipper/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, cmake, ninja, unzip }:
+{ lib, stdenv, fetchurl, cmake, ninja, unzip }:
 
 stdenv.mkDerivation rec {
   version = "6.4.2";
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ cmake ninja unzip ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A polygon and line clipping and offsetting library (C++, C#, Delphi)";
     longDescription = ''
       The Clipper library performs line & polygon clipping - intersection, union, difference & exclusive-or,
diff --git a/pkgs/development/libraries/cln/default.nix b/pkgs/development/libraries/cln/default.nix
index 669ce90287bc0..23bbd84a20963 100644
--- a/pkgs/development/libraries/cln/default.nix
+++ b/pkgs/development/libraries/cln/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, gmp }:
+{ lib, stdenv, fetchurl, gmp }:
 
 stdenv.mkDerivation rec {
   pname = "cln";
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ gmp ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "C/C++ library for numbers, a part of GiNaC";
     homepage = "https://www.ginac.de/CLN/";
     license = licenses.gpl2;
diff --git a/pkgs/development/libraries/cloog-ppl/default.nix b/pkgs/development/libraries/cloog-ppl/default.nix
index f7a0bd058e718..b2bd2adde43a9 100644
--- a/pkgs/development/libraries/cloog-ppl/default.nix
+++ b/pkgs/development/libraries/cloog-ppl/default.nix
@@ -1,4 +1,4 @@
-{ fetchurl, stdenv, ppl, autoreconfHook }:
+{ fetchurl, lib, stdenv, ppl, autoreconfHook }:
 
 stdenv.mkDerivation rec {
   name = "cloog-ppl-0.15.11";
@@ -42,7 +42,7 @@ stdenv.mkDerivation rec {
     # CLooG-PPL is actually a port of GLooG from PolyLib to PPL.
     homepage = "http://www.cloog.org/";
 
-    license = stdenv.lib.licenses.gpl2Plus;
+    license = lib.licenses.gpl2Plus;
 
     maintainers = [ ];
 
@@ -65,6 +65,6 @@ stdenv.mkDerivation rec {
        make[3]: *** [Box.lo] Error 1
 
     */
-    platforms = stdenv.lib.platforms.unix; # Once had cygwin problems
+    platforms = lib.platforms.unix; # Once had cygwin problems
   };
 }
diff --git a/pkgs/development/libraries/cloog/0.18.0.nix b/pkgs/development/libraries/cloog/0.18.0.nix
index b0f69d42e8cd6..c952c1a563b80 100644
--- a/pkgs/development/libraries/cloog/0.18.0.nix
+++ b/pkgs/development/libraries/cloog/0.18.0.nix
@@ -1,4 +1,4 @@
-{ fetchurl, stdenv, gmp, isl }:
+{ fetchurl, lib, stdenv, gmp, isl }:
 
 stdenv.mkDerivation rec {
   name = "cloog-0.18.0";
@@ -37,7 +37,7 @@ stdenv.mkDerivation rec {
 
     homepage = "http://www.cloog.org/";
 
-    license = stdenv.lib.licenses.gpl2Plus;
+    license = lib.licenses.gpl2Plus;
 
     /* Leads to an ICE on Cygwin:
 
@@ -58,6 +58,6 @@ stdenv.mkDerivation rec {
        make[3]: *** [Box.lo] Error 1
 
     */
-    platforms = stdenv.lib.platforms.unix; # Once had cygwin problems
+    platforms = lib.platforms.unix; # Once had cygwin problems
   };
 }
diff --git a/pkgs/development/libraries/cloog/default.nix b/pkgs/development/libraries/cloog/default.nix
index be506cdee173b..54df2df9d4d2f 100644
--- a/pkgs/development/libraries/cloog/default.nix
+++ b/pkgs/development/libraries/cloog/default.nix
@@ -1,4 +1,4 @@
-{ fetchurl, stdenv, gmp, isl }:
+{ fetchurl, lib, stdenv, gmp, isl }:
 
 stdenv.mkDerivation rec {
   name = "cloog-0.18.4";
@@ -38,7 +38,7 @@ stdenv.mkDerivation rec {
 
     homepage = "http://www.cloog.org/";
 
-    license = stdenv.lib.licenses.gpl2Plus;
+    license = lib.licenses.gpl2Plus;
 
     /* Leads to an ICE on Cygwin:
 
@@ -59,6 +59,6 @@ stdenv.mkDerivation rec {
        make[3]: *** [Box.lo] Error 1
 
     */
-    platforms = stdenv.lib.platforms.unix; # Once had cygwin problems
+    platforms = lib.platforms.unix; # Once had cygwin problems
   };
 }
diff --git a/pkgs/development/libraries/clucene-core/2.x.nix b/pkgs/development/libraries/clucene-core/2.x.nix
index 3776f1eac2195..9c1f3c21cd278 100644
--- a/pkgs/development/libraries/clucene-core/2.x.nix
+++ b/pkgs/development/libraries/clucene-core/2.x.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, cmake, boost, zlib}:
+{lib, stdenv, fetchurl, cmake, boost, zlib}:
 
 stdenv.mkDerivation rec {
   name = "clucene-core-2.3.3.4";
@@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
     "-DBUILD_CONTRIBS=ON"
     "-DBUILD_CONTRIBS_LIB=ON"
     "-DCMAKE_BUILD_WITH_INSTALL_NAME_DIR=ON"
-  ] ++ stdenv.lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
+  ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
     "-D_CL_HAVE_GCC_ATOMIC_FUNCTIONS=0"
     "-D_CL_HAVE_NAMESPACES_EXITCODE=0"
     "-D_CL_HAVE_NO_SNPRINTF_BUG_EXITCODE=0"
@@ -30,15 +30,15 @@ stdenv.mkDerivation rec {
     [ ./Fix-pkgconfig-file-by-adding-clucene-shared-library.patch
       ./Fixing_ZLIB_configuration_in_shared_CMakeLists.patch
       ./Install-contribs-lib.patch
-    ] ++ stdenv.lib.optionals stdenv.isDarwin [ ./fix-darwin.patch ];
+    ] ++ lib.optionals stdenv.isDarwin [ ./fix-darwin.patch ];
 
   # fails with "Unable to find executable:
   # /build/clucene-core-2.3.3.4/build/bin/cl_test"
   doCheck = false;
 
-  NIX_CFLAGS_COMPILE = stdenv.lib.optionalString stdenv.cc.isClang "-Wno-error=c++11-narrowing";
+  NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isClang "-Wno-error=c++11-narrowing";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Core library for full-featured text search engine";
     longDescription = ''
       CLucene is a high-performance, scalable, cross platform, full-featured,
diff --git a/pkgs/development/libraries/clucene-core/default.nix b/pkgs/development/libraries/clucene-core/default.nix
index d71d01de9e254..20b0a3b547ca2 100644
--- a/pkgs/development/libraries/clucene-core/default.nix
+++ b/pkgs/development/libraries/clucene-core/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl}:
+{lib, stdenv, fetchurl}:
 
 stdenv.mkDerivation rec {
   name = "clucene-core-0.9.21b";
@@ -10,7 +10,7 @@ stdenv.mkDerivation rec {
 
   patches = [ ./gcc6.patch ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Core library for full-featured text search engine";
     longDescription = ''
       CLucene is a high-performance, scalable, cross platform, full-featured,
diff --git a/pkgs/development/libraries/clutter-gst/default.nix b/pkgs/development/libraries/clutter-gst/default.nix
index 823388189186f..264c382338cea 100644
--- a/pkgs/development/libraries/clutter-gst/default.nix
+++ b/pkgs/development/libraries/clutter-gst/default.nix
@@ -1,4 +1,4 @@
-{ fetchurl, stdenv, pkg-config, clutter, gtk3, glib, cogl, gnome3, gdk-pixbuf }:
+{ fetchurl, lib, stdenv, pkg-config, clutter, gtk3, glib, cogl, gnome3, gdk-pixbuf }:
 
 stdenv.mkDerivation rec {
   pname = "clutter-gst";
@@ -7,7 +7,7 @@ stdenv.mkDerivation rec {
   outputs = [ "out" "dev" ];
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "17czmpl92dzi4h3rn5rishk015yi3jwiw29zv8qan94xcmnbssgy";
   };
 
@@ -27,9 +27,9 @@ stdenv.mkDerivation rec {
 
     homepage = "http://www.clutter-project.org/";
 
-    license = stdenv.lib.licenses.lgpl2Plus;
+    license = lib.licenses.lgpl2Plus;
 
-    maintainers = with stdenv.lib.maintainers; [ lethalman ];
-    platforms = stdenv.lib.platforms.gnu ++ stdenv.lib.platforms.linux;  # arbitrary choice
+    maintainers = with lib.maintainers; [ lethalman ];
+    platforms = lib.platforms.gnu ++ stdenv.lib.platforms.linux;  # arbitrary choice
   };
 }
diff --git a/pkgs/development/libraries/clutter-gtk/default.nix b/pkgs/development/libraries/clutter-gtk/default.nix
index 15bf0d689f5b0..902a2af62bd68 100644
--- a/pkgs/development/libraries/clutter-gtk/default.nix
+++ b/pkgs/development/libraries/clutter-gtk/default.nix
@@ -1,4 +1,4 @@
-{ fetchurl, stdenv, pkg-config, meson, ninja
+{ fetchurl, lib, stdenv, pkg-config, meson, ninja
 , gobject-introspection, clutter, gtk3, gnome3 }:
 
 let
@@ -10,7 +10,7 @@ stdenv.mkDerivation rec {
   name = "${pname}-${version}";
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${name}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${name}.tar.xz";
     sha256 = "01ibniy4ich0fgpam53q252idm7f4fn5xg5qvizcfww90gn9652j";
   };
 
@@ -30,8 +30,8 @@ stdenv.mkDerivation rec {
   meta = {
     description = "Clutter-GTK";
     homepage = "http://www.clutter-project.org/";
-    license = stdenv.lib.licenses.lgpl2Plus;
-    maintainers = with stdenv.lib.maintainers; [ lethalman ];
-    platforms = stdenv.lib.platforms.gnu ++ stdenv.lib.platforms.linux;  # arbitrary choice
+    license = lib.licenses.lgpl2Plus;
+    maintainers = with lib.maintainers; [ lethalman ];
+    platforms = lib.platforms.gnu ++ stdenv.lib.platforms.linux;  # arbitrary choice
   };
 }
diff --git a/pkgs/development/libraries/clutter/default.nix b/pkgs/development/libraries/clutter/default.nix
index 8644f83a689cd..002db004dc190 100644
--- a/pkgs/development/libraries/clutter/default.nix
+++ b/pkgs/development/libraries/clutter/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, libGLU, libGL, libX11, libXext, libXfixes
+{ lib, stdenv, fetchurl, pkg-config, libGLU, libGL, libX11, libXext, libXfixes
 , libXdamage, libXcomposite, libXi, libxcb, cogl, pango, atk, json-glib
 , gobject-introspection, gtk3, gnome3, libinput, libgudev, libxkbcommon
 }:
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
   name = "${pname}-${version}";
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${name}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${name}.tar.xz";
     sha256 = "1rn4cd1an6a9dfda884aqpcwcgq8dgydpqvb19nmagw4b70zlj4b";
   };
 
@@ -52,10 +52,10 @@ stdenv.mkDerivation rec {
          specific needs.
       '';
 
-    license = stdenv.lib.licenses.lgpl2Plus;
+    license = lib.licenses.lgpl2Plus;
     homepage = "http://www.clutter-project.org/";
 
-    maintainers = with stdenv.lib.maintainers; [ lethalman ];
-    platforms = stdenv.lib.platforms.mesaPlatforms;
+    maintainers = with lib.maintainers; [ lethalman ];
+    platforms = lib.platforms.mesaPlatforms;
   };
 }
diff --git a/pkgs/development/libraries/cm256cc/default.nix b/pkgs/development/libraries/cm256cc/default.nix
index eaddcb86f5462..b40aea70b410d 100644
--- a/pkgs/development/libraries/cm256cc/default.nix
+++ b/pkgs/development/libraries/cm256cc/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, boost } :
+{ lib, stdenv, fetchFromGitHub, cmake, boost } :
 
 stdenv.mkDerivation rec {
   pname = "cm256cc";
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ cmake ];
   buildInputs = [ boost ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Fast GF(256) Cauchy MDS Block Erasure Codec in C++";
     homepage = "https://github.com/f4exb/cm256cc";
     platforms = platforms.linux;
diff --git a/pkgs/development/libraries/cmark-gfm/default.nix b/pkgs/development/libraries/cmark-gfm/default.nix
index 52a02772268b1..8a9534365f4eb 100644
--- a/pkgs/development/libraries/cmark-gfm/default.nix
+++ b/pkgs/development/libraries/cmark-gfm/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake }:
+{ lib, stdenv, fetchFromGitHub, cmake }:
 stdenv.mkDerivation rec {
   pname = "cmark-gfm";
   version = "0.29.0.gfm.0";
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
   # tests load the library dynamically which for unknown reason failed
   doCheck = false;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "GitHub's fork of cmark, a CommonMark parsing and rendering library and program in C";
     homepage = "https://github.com/github/cmark-gfm";
     maintainers = with maintainers; [ cyplo ];
diff --git a/pkgs/development/libraries/cmark/default.nix b/pkgs/development/libraries/cmark/default.nix
index b132e958f67a1..6061fd8f91231 100644
--- a/pkgs/development/libraries/cmark/default.nix
+++ b/pkgs/development/libraries/cmark/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake }:
+{ lib, stdenv, fetchFromGitHub, cmake }:
 
 stdenv.mkDerivation rec {
   version = "0.29.0";
@@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
     export LD_LIBRARY_PATH=$(readlink -f ./src)
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "CommonMark parsing and rendering library and program in C";
     homepage = "https://github.com/jgm/cmark";
     maintainers = [ maintainers.michelk ];
diff --git a/pkgs/development/libraries/cminpack/default.nix b/pkgs/development/libraries/cminpack/default.nix
index 34678d9b37d78..39d4849f38019 100644
--- a/pkgs/development/libraries/cminpack/default.nix
+++ b/pkgs/development/libraries/cminpack/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl}:
+{lib, stdenv, fetchurl}:
 
 stdenv.mkDerivation rec {
   name = "cminpack-1.3.6";
@@ -18,9 +18,9 @@ stdenv.mkDerivation rec {
 
   meta = {
     homepage = "http://devernay.free.fr/hacks/cminpack/cminpack.html";
-    license = stdenv.lib.licenses.bsd3;
+    license = lib.licenses.bsd3;
     description = "Software for solving nonlinear equations and nonlinear least squares problems";
-    platforms = stdenv.lib.platforms.linux;
+    platforms = lib.platforms.linux;
   };
 
 }
diff --git a/pkgs/development/libraries/cmocka/default.nix b/pkgs/development/libraries/cmocka/default.nix
index 18c1843623f8e..9bfbc410c0072 100644
--- a/pkgs/development/libraries/cmocka/default.nix
+++ b/pkgs/development/libraries/cmocka/default.nix
@@ -1,4 +1,4 @@
-{ fetchurl, stdenv, cmake }:
+{ fetchurl, lib, stdenv, cmake }:
 
 stdenv.mkDerivation rec {
   pname = "cmocka";
@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ cmake ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Lightweight library to simplify and generalize unit tests for C";
 
     longDescription =
diff --git a/pkgs/development/libraries/cmrt/default.nix b/pkgs/development/libraries/cmrt/default.nix
index a391f604875ef..43d73ba200ced 100644
--- a/pkgs/development/libraries/cmrt/default.nix
+++ b/pkgs/development/libraries/cmrt/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, autoreconfHook, pkg-config, libdrm, libva }:
+{ lib, stdenv, fetchurl, autoreconfHook, pkg-config, libdrm, libva }:
 
 stdenv.mkDerivation rec {
   pname = "cmrt";
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ libdrm libva ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://01.org/linuxmedia";
     description = "Intel C for Media Runtime";
     longDescription = "Media GPU kernel manager for Intel G45 & HD Graphics family";
diff --git a/pkgs/development/libraries/codec2/default.nix b/pkgs/development/libraries/codec2/default.nix
index 4a648b1f32a85..09ec21cc63e86 100644
--- a/pkgs/development/libraries/codec2/default.nix
+++ b/pkgs/development/libraries/codec2/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake }:
+{ lib, stdenv, fetchFromGitHub, cmake }:
 
 stdenv.mkDerivation rec {
   pname = "codec2";
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ cmake ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Speech codec designed for communications quality speech at low data rates";
     homepage = "http://www.rowetel.com/blog/?page_id=452";
     license = licenses.lgpl21;
diff --git a/pkgs/development/libraries/cogl/default.nix b/pkgs/development/libraries/cogl/default.nix
index 10f732dc629ec..8fd1520728794 100644
--- a/pkgs/development/libraries/cogl/default.nix
+++ b/pkgs/development/libraries/cogl/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, fetchpatch, pkg-config, libGL, glib, gdk-pixbuf, xorg, libintl
+{ lib, stdenv, fetchurl, fetchpatch, pkg-config, libGL, glib, gdk-pixbuf, xorg, libintl
 , pangoSupport ? true, pango, cairo, gobject-introspection, wayland, gnome3
 , mesa, automake, autoconf
 , gstreamerSupport ? true, gst_all_1 }:
@@ -10,7 +10,7 @@ in stdenv.mkDerivation rec {
   version = "1.22.8";
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${name}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${name}.tar.xz";
     sha256 = "0nfph4ai60ncdx7hy6hl1i1cmp761jgnyjfhagzi0iqq36qb41d8";
   };
 
@@ -40,20 +40,20 @@ in stdenv.mkDerivation rec {
     "--enable-kms-egl-platform"
     "--enable-wayland-egl-platform"
     "--enable-wayland-egl-server"
-  ] ++ stdenv.lib.optional gstreamerSupport "--enable-cogl-gst"
-  ++ stdenv.lib.optionals (!stdenv.isDarwin) [ "--enable-gles1" "--enable-gles2" ];
+  ] ++ lib.optional gstreamerSupport "--enable-cogl-gst"
+  ++ lib.optionals (!stdenv.isDarwin) [ "--enable-gles1" "--enable-gles2" ];
 
   propagatedBuildInputs = with xorg; [
       glib gdk-pixbuf gobject-introspection wayland mesa
       libGL libXrandr libXfixes libXcomposite libXdamage
     ]
-    ++ stdenv.lib.optionals gstreamerSupport [ gst_all_1.gstreamer
+    ++ lib.optionals gstreamerSupport [ gst_all_1.gstreamer
                                                gst_all_1.gst-plugins-base ];
 
-  buildInputs = stdenv.lib.optionals pangoSupport [ pango cairo ];
+  buildInputs = lib.optionals pangoSupport [ pango cairo ];
 
   COGL_PANGO_DEP_CFLAGS
-    = stdenv.lib.optionalString (stdenv.isDarwin && pangoSupport)
+    = lib.optionalString (stdenv.isDarwin && pangoSupport)
       "-I${pango.dev}/include/pango-1.0 -I${cairo.dev}/include/cairo";
 
   #doCheck = true; # all tests fail (no idea why)
@@ -64,7 +64,7 @@ in stdenv.mkDerivation rec {
     };
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A small open source library for using 3D graphics hardware for rendering";
     maintainers = with maintainers; [ lovek323 ];
 
diff --git a/pkgs/development/libraries/coin3d/default.nix b/pkgs/development/libraries/coin3d/default.nix
index c76aaa4c8e53f..3fe78e6d02e9d 100644
--- a/pkgs/development/libraries/coin3d/default.nix
+++ b/pkgs/development/libraries/coin3d/default.nix
@@ -1,4 +1,4 @@
-{ fetchFromGitHub, stdenv, boost, cmake, libX11, libGL, libGLU }:
+{ fetchFromGitHub, lib, stdenv, boost, cmake, libX11, libGL, libGLU }:
 
 stdenv.mkDerivation rec {
   pname = "coin";
@@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ cmake ];
   buildInputs = [ boost libX11 libGL libGLU ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/coin3d/coin";
     license = licenses.bsd3;
     description = "High-level, retained-mode toolkit for effective 3D graphics development";
diff --git a/pkgs/development/libraries/comedilib/default.nix b/pkgs/development/libraries/comedilib/default.nix
index 98811b97c87ee..e42f02407d4b2 100644
--- a/pkgs/development/libraries/comedilib/default.nix
+++ b/pkgs/development/libraries/comedilib/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , autoreconfHook
 , flex
@@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
   src = fetchFromGitHub {
     owner = "Linux-Comedi";
     repo = "comedilib";
-    rev = "r${stdenv.lib.replaceStrings [ "." ] [ "_" ] version}";
+    rev = "r${lib.replaceStrings [ "." ] [ "_" ] version}";
     sha256 = "0kfs2dw62vjz8j7fgsxq6ky8r8kca726gyklbm6kljvgfh47lyfw";
   };
 
@@ -45,7 +45,7 @@ stdenv.mkDerivation rec {
 
   outputs = [ "out" "dev" "man" "doc" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "The Linux Control and Measurement Device Interface Library";
     homepage = "https://github.com/Linux-Comedi/comedilib";
     license = licenses.lgpl21;
diff --git a/pkgs/development/libraries/concurrencykit/default.nix b/pkgs/development/libraries/concurrencykit/default.nix
index d5d9aa75e8906..968c395d701f2 100644
--- a/pkgs/development/libraries/concurrencykit/default.nix
+++ b/pkgs/development/libraries/concurrencykit/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
   pname = "concurrencykit";
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A library of safe, high-performance concurrent data structures";
     homepage    = "http://concurrencykit.org";
     license     = licenses.bsd2;
diff --git a/pkgs/development/libraries/cpp-hocon/default.nix b/pkgs/development/libraries/cpp-hocon/default.nix
index e084343a94cb4..dfe7f77767038 100644
--- a/pkgs/development/libraries/cpp-hocon/default.nix
+++ b/pkgs/development/libraries/cpp-hocon/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, boost, curl, leatherman }:
+{ lib, stdenv, fetchFromGitHub, cmake, boost, curl, leatherman }:
 
 stdenv.mkDerivation rec {
   pname = "cpp-hocon";
@@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ boost curl leatherman ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     inherit (src.meta) homepage;
     description = "A C++ port of the Typesafe Config library";
     license = licenses.asl20;
diff --git a/pkgs/development/libraries/cpp-ipfs-api/default.nix b/pkgs/development/libraries/cpp-ipfs-api/default.nix
index 623ab59d3ee6e..839ddb9b76fb8 100644
--- a/pkgs/development/libraries/cpp-ipfs-api/default.nix
+++ b/pkgs/development/libraries/cpp-ipfs-api/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, curl, cmake, nlohmann_json }:
+{ lib, stdenv, fetchFromGitHub, curl, cmake, nlohmann_json }:
 
 stdenv.mkDerivation {
   pname = "cpp-ipfs-api";
@@ -15,7 +15,7 @@ stdenv.mkDerivation {
   buildInputs = [ curl ];
   propagatedBuildInputs = [ nlohmann_json ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "IPFS C++ API client library";
     homepage = "https://github.com/vasild/cpp-ipfs-api";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/cpp-netlib/default.nix b/pkgs/development/libraries/cpp-netlib/default.nix
index e7079ac0386fc..6085a3c849cc2 100644
--- a/pkgs/development/libraries/cpp-netlib/default.nix
+++ b/pkgs/development/libraries/cpp-netlib/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, boost, openssl }:
+{ lib, stdenv, fetchFromGitHub, cmake, boost, openssl }:
 
 stdenv.mkDerivation rec {
   pname = "cpp-netlib";
@@ -27,7 +27,7 @@ stdenv.mkDerivation rec {
   # Most tests make network GET requests to various websites
   doCheck = false;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Collection of open-source libraries for high level network programming";
     homepage    = "https://cpp-netlib.org";
     license     = licenses.boost;
diff --git a/pkgs/development/libraries/cpp-utilities/default.nix b/pkgs/development/libraries/cpp-utilities/default.nix
index 9ab3a261da5bd..38879342f7a78 100644
--- a/pkgs/development/libraries/cpp-utilities/default.nix
+++ b/pkgs/development/libraries/cpp-utilities/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , fetchpatch
 , cmake
@@ -22,7 +22,7 @@ stdenv.mkDerivation rec {
   checkFlagsArray = [ "LD_LIBRARY_PATH=$(PWD)" ];
   doCheck = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/Martchus/cpp-utilities";
     description = "Common C++ classes and routines used by @Martchus' applications featuring argument parser, IO and conversion utilities";
     license = licenses.gpl2;
diff --git a/pkgs/development/libraries/cppcms/default.nix b/pkgs/development/libraries/cppcms/default.nix
index 7673d257a3ea0..aceb2d61e388c 100644
--- a/pkgs/development/libraries/cppcms/default.nix
+++ b/pkgs/development/libraries/cppcms/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, cmake, pcre, zlib, python, openssl }:
+{ lib, stdenv, fetchurl, cmake, pcre, zlib, python, openssl }:
 
 stdenv.mkDerivation rec {
   pname = "cppcms";
@@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
     "--no-warn-unused-cli"
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://cppcms.com";
     description = "High Performance C++ Web Framework";
     platforms = platforms.linux ;
diff --git a/pkgs/development/libraries/cppdb/default.nix b/pkgs/development/libraries/cppdb/default.nix
index 6ad27152b384a..98c9c7ecac159 100644
--- a/pkgs/development/libraries/cppdb/default.nix
+++ b/pkgs/development/libraries/cppdb/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, cmake, sqlite, libmysqlclient, postgresql, unixODBC }:
+{ lib, stdenv, fetchurl, cmake, sqlite, libmysqlclient, postgresql, unixODBC }:
 
 stdenv.mkDerivation rec {
   pname = "cppdb";
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
   cmakeFlags = [ "--no-warn-unused-cli" ];
   NIX_CFLAGS_COMPILE = "-I${libmysqlclient}/include/mysql -L${libmysqlclient}/lib/mysql";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://cppcms.com/sql/cppdb/";
     description = "C++ Connectivity library that supports MySQL, PostgreSQL, Sqlite3 databases and generic ODBC drivers";
     platforms = platforms.linux ;
diff --git a/pkgs/development/libraries/cpptest/default.nix b/pkgs/development/libraries/cpptest/default.nix
index 5ed06b99f3351..654ad955ae66c 100644
--- a/pkgs/development/libraries/cpptest/default.nix
+++ b/pkgs/development/libraries/cpptest/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
   name = "cpptest-2.0.0";
@@ -8,11 +8,11 @@ stdenv.mkDerivation rec {
     sha256 = "0lpy3f2fjx1srh02myanlp6zfi497whlldcrnij39ghfhm0arcnm";
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://cpptest.sourceforge.net/";
     description = "Simple C++ unit testing framework";
     maintainers = with maintainers; [ bosu ];
-    license = stdenv.lib.licenses.lgpl3;
+    license = lib.licenses.lgpl3;
     platforms = with platforms; linux;
   };
 }
diff --git a/pkgs/development/libraries/cppunit/default.nix b/pkgs/development/libraries/cppunit/default.nix
index bf65be7157559..3cafa1c75d76a 100644
--- a/pkgs/development/libraries/cppunit/default.nix
+++ b/pkgs/development/libraries/cppunit/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl}:
+{lib, stdenv, fetchurl}:
 
 stdenv.mkDerivation rec {
   pname = "cppunit";
@@ -9,7 +9,7 @@ stdenv.mkDerivation rec {
     sha256 = "19qpqzy66bq76wcyadmi3zahk5v1ll2kig1nvg96zx9padkcdic9";
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://freedesktop.org/wiki/Software/cppunit/";
     description = "C++ unit testing framework";
     license = licenses.lgpl21;
diff --git a/pkgs/development/libraries/cpputest/default.nix b/pkgs/development/libraries/cpputest/default.nix
index d219a8e0bec14..8e3fadc7f0dce 100644
--- a/pkgs/development/libraries/cpputest/default.nix
+++ b/pkgs/development/libraries/cpputest/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl}:
+{lib, stdenv, fetchurl}:
 
 stdenv.mkDerivation rec {
   version = "4.0";
@@ -12,8 +12,8 @@ stdenv.mkDerivation rec {
   meta = {
     homepage = "http://cpputest.github.io/";
     description = "Unit testing and mocking framework for C/C++";
-    platforms = stdenv.lib.platforms.linux ;
-    license = stdenv.lib.licenses.bsd3;
-    maintainers = [ stdenv.lib.maintainers.juliendehos ];
+    platforms = lib.platforms.linux ;
+    license = lib.licenses.bsd3;
+    maintainers = [ lib.maintainers.juliendehos ];
   };
 }
diff --git a/pkgs/development/libraries/cppzmq/default.nix b/pkgs/development/libraries/cppzmq/default.nix
index fdd98cb00bf0d..9237c3bd3071f 100644
--- a/pkgs/development/libraries/cppzmq/default.nix
+++ b/pkgs/development/libraries/cppzmq/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, zeromq }:
+{ lib, stdenv, fetchFromGitHub, cmake, zeromq }:
 
 stdenv.mkDerivation rec {
   pname = "cppzmq";
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
     "-DCPPZMQ_BUILD_TESTS=OFF"
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/zeromq/cppzmq";
     license = licenses.bsd2;
     description = "C++ binding for 0MQ";
diff --git a/pkgs/development/libraries/cracklib/default.nix b/pkgs/development/libraries/cracklib/default.nix
index c10a69d72f942..13029f7739c53 100644
--- a/pkgs/development/libraries/cracklib/default.nix
+++ b/pkgs/development/libraries/cracklib/default.nix
@@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) buildPackages.cracklib;
   buildInputs = [ zlib gettext ];
 
-  postPatch = stdenv.lib.optionalString (stdenv.hostPlatform == stdenv.buildPlatform) ''
+  postPatch = lib.optionalString (stdenv.hostPlatform == stdenv.buildPlatform) ''
     chmod +x util/cracklib-format
     patchShebangs util
 
diff --git a/pkgs/development/libraries/crc32c/default.nix b/pkgs/development/libraries/crc32c/default.nix
index c10d218ea42cc..bc46e80db9b32 100644
--- a/pkgs/development/libraries/crc32c/default.nix
+++ b/pkgs/development/libraries/crc32c/default.nix
@@ -16,10 +16,10 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ cmake ];
   buildInputs = [ gflags ];
-  NIX_CFLAGS_COMPILE = stdenv.lib.optionalString stdenv.isAarch64 "-march=armv8-a+crc";
+  NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isAarch64 "-march=armv8-a+crc";
   cmakeFlags = lib.optionals (!staticOnly) [ "-DBUILD_SHARED_LIBS=1"  ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/google/crc32c";
     description = "CRC32C implementation with support for CPU-specific acceleration instructions";
     license = with licenses; [ bsd3 ];
diff --git a/pkgs/development/libraries/crcpp/default.nix b/pkgs/development/libraries/crcpp/default.nix
index c26578804baf3..9410b07150062 100644
--- a/pkgs/development/libraries/crcpp/default.nix
+++ b/pkgs/development/libraries/crcpp/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 }:
 
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
     cp inc/CRC.h $out/include
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/d-bahr/CRCpp";
     description = "Easy to use and fast C++ CRC library";
     platforms = platforms.all;
diff --git a/pkgs/development/libraries/cre2/default.nix b/pkgs/development/libraries/cre2/default.nix
index df1837de305b8..d85843a54f7c7 100644
--- a/pkgs/development/libraries/cre2/default.nix
+++ b/pkgs/development/libraries/cre2/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, autoreconfHook,
+{ lib, stdenv, fetchFromGitHub, autoreconfHook,
   libtool, pkg-config, re2, texinfo }:
 
 stdenv.mkDerivation rec {
@@ -25,7 +25,7 @@ stdenv.mkDerivation rec {
     "--enable-maintainer-mode"
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://marcomaggi.github.io/docs/cre2.html";
     description = "C Wrapper for RE2";
     license = licenses.bsd3;
diff --git a/pkgs/development/libraries/criterion/default.nix b/pkgs/development/libraries/criterion/default.nix
index bd42a9c866e56..ba436fec0a264 100644
--- a/pkgs/development/libraries/criterion/default.nix
+++ b/pkgs/development/libraries/criterion/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, boxfort, cmake, libcsptr, pkg-config, gettext
+{ lib, stdenv, fetchFromGitHub, boxfort, cmake, libcsptr, pkg-config, gettext
 , dyncall , nanomsg, python37Packages }:
 
 stdenv.mkDerivation rec {
@@ -34,7 +34,7 @@ stdenv.mkDerivation rec {
 
   outputs = [ "dev" "out" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A cross-platform C and C++ unit testing framework for the 21th century";
     homepage = "https://github.com/Snaipe/Criterion";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/crypto++/default.nix b/pkgs/development/libraries/crypto++/default.nix
index 3fe2774815535..041e7d49d500c 100644
--- a/pkgs/development/libraries/crypto++/default.nix
+++ b/pkgs/development/libraries/crypto++/default.nix
@@ -1,6 +1,6 @@
-{ stdenv, fetchFromGitHub, nasm, which }:
+{ lib, stdenv, fetchFromGitHub, nasm, which }:
 
-with stdenv.lib;
+with lib;
 stdenv.mkDerivation rec {
   pname = "crypto++";
   version = "8.2.0";
diff --git a/pkgs/development/libraries/csfml/default.nix b/pkgs/development/libraries/csfml/default.nix
index 61d1d53da63c9..78d8bce40a36f 100644
--- a/pkgs/development/libraries/csfml/default.nix
+++ b/pkgs/development/libraries/csfml/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, sfml }:
+{ lib, stdenv, fetchFromGitHub, cmake, sfml }:
 
 let
   version = "2.5";
@@ -17,7 +17,7 @@ stdenv.mkDerivation {
   buildInputs = [ sfml ];
   cmakeFlags = [ "-DCMAKE_MODULE_PATH=${sfml}/share/SFML/cmake/Modules/" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://www.sfml-dev.org/";
     description = "Simple and fast multimedia library";
     longDescription = ''
diff --git a/pkgs/development/libraries/ctl/default.nix b/pkgs/development/libraries/ctl/default.nix
index 7ca90281abbcc..be643e3a52c6b 100644
--- a/pkgs/development/libraries/ctl/default.nix
+++ b/pkgs/development/libraries/ctl/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, fetchpatch, cmake, pkg-config, ilmbase, libtiff, openexr }:
+{ lib, stdenv, fetchFromGitHub, fetchpatch, cmake, pkg-config, ilmbase, libtiff, openexr }:
 
 stdenv.mkDerivation rec {
   pname = "ctl";
@@ -22,7 +22,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ cmake pkg-config ];
   buildInputs = [ libtiff ilmbase openexr ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Color Transformation Language";
     homepage = "https://github.com/ampas/CTL";
     license = "A.M.P.A.S"; # BSD-derivative, free but GPL incompatible
diff --git a/pkgs/development/libraries/ctpl/default.nix b/pkgs/development/libraries/ctpl/default.nix
index 7c78faaee0b8c..69380c2eeeb4c 100644
--- a/pkgs/development/libraries/ctpl/default.nix
+++ b/pkgs/development/libraries/ctpl/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, glib }:
+{ lib, stdenv, fetchurl, pkg-config, glib }:
 
 stdenv.mkDerivation rec {
   pname = "ctpl";
@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ pkg-config ];
   buildInputs = [ glib ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://ctpl.tuxfamily.org/";
     description = "Template engine library written in C";
     platforms = platforms.linux;
diff --git a/pkgs/development/libraries/ctpp2/default.nix b/pkgs/development/libraries/ctpp2/default.nix
index 2e3f6a86d4990..626606d0526dc 100644
--- a/pkgs/development/libraries/ctpp2/default.nix
+++ b/pkgs/development/libraries/ctpp2/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, cmake }:
+{ lib, stdenv, fetchurl, cmake }:
 
 stdenv.mkDerivation rec {
   pname = "ctpp2";
@@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
 
   doCheck = false; # fails
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A high performance templating engine";
     homepage = "http://ctpp.havoc.ru";
     maintainers = [ maintainers.robbinch ];
diff --git a/pkgs/development/libraries/ctypes_sh/default.nix b/pkgs/development/libraries/ctypes_sh/default.nix
index 6ec2a694970ef..644c68e85d861 100644
--- a/pkgs/development/libraries/ctypes_sh/default.nix
+++ b/pkgs/development/libraries/ctypes_sh/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , autoreconfHook, pkg-config
 , zlib, libffi, elfutils, libdwarf
@@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ autoreconfHook pkg-config ];
   buildInputs = [ zlib libffi elfutils libdwarf ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A foreign function interface for bash";
     homepage = "https://github.com/taviso/ctypes.sh";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/cudd/default.nix b/pkgs/development/libraries/cudd/default.nix
index 6749d2e94c0f4..4e8cf59fbffd3 100644
--- a/pkgs/development/libraries/cudd/default.nix
+++ b/pkgs/development/libraries/cudd/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, autoreconfHook }:
+{ lib, stdenv, fetchurl, autoreconfHook }:
 
 stdenv.mkDerivation rec {
   pname = "cudd";
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ autoreconfHook ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://davidkebo.com/cudd";
     description = "Binary Decision Diagram (BDD) library";
     license = licenses.bsd3;
diff --git a/pkgs/development/libraries/curlcpp/default.nix b/pkgs/development/libraries/curlcpp/default.nix
index 6efc28b4c05a6..9d4ae41f384fd 100644
--- a/pkgs/development/libraries/curlcpp/default.nix
+++ b/pkgs/development/libraries/curlcpp/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, curl }:
+{ lib, stdenv, fetchFromGitHub, cmake, curl }:
 
 stdenv.mkDerivation rec {
   pname = "curlcpp";
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ cmake ];
   buildInputs = [ curl ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://josephp91.github.io/curlcpp/";
     description = "Object oriented C++ wrapper for CURL";
     platforms = platforms.unix;
diff --git a/pkgs/development/libraries/curlpp/default.nix b/pkgs/development/libraries/curlpp/default.nix
index 46f1eb33f75a3..0aee75751d9ec 100644
--- a/pkgs/development/libraries/curlpp/default.nix
+++ b/pkgs/development/libraries/curlpp/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, curl }:
+{ lib, stdenv, fetchFromGitHub, cmake, curl }:
 
 stdenv.mkDerivation rec {
   pname = "curlpp";
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
   buildInputs = [ curl ];
   nativeBuildInputs = [ cmake ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://www.curlpp.org/";
     description = "C++ wrapper around libcURL";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/cutee/default.nix b/pkgs/development/libraries/cutee/default.nix
index 661dc7c816c48..748d495063dec 100644
--- a/pkgs/development/libraries/cutee/default.nix
+++ b/pkgs/development/libraries/cutee/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
   pname = "cutee";
@@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
     cp cutee $out/bin
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "C++ Unit Testing Easy Environment";
     homepage    = "http://www.codesink.org/cutee_unit_testing.html";
     license     = licenses.gpl2Plus;
diff --git a/pkgs/development/libraries/cwiid/default.nix b/pkgs/development/libraries/cwiid/default.nix
index a19b1a2d9d0fc..31a5420e375c8 100644
--- a/pkgs/development/libraries/cwiid/default.nix
+++ b/pkgs/development/libraries/cwiid/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, autoreconfHook, bison, flex, bluez, pkg-config, gtk2 }:
+{ lib, stdenv, fetchFromGitHub, autoreconfHook, bison, flex, bluez, pkg-config, gtk2 }:
 
 stdenv.mkDerivation rec {
   name = "cwiid-${version}-git";
@@ -30,7 +30,7 @@ stdenv.mkDerivation rec {
     sed -i -e "s/0.6.00/0.6.0/" $out/lib/pkgconfig/cwiid.pc
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Linux Nintendo Wiimote interface";
     homepage    = "http://cwiid.org";
     license     = licenses.gpl2Plus;
diff --git a/pkgs/development/libraries/cxx-prettyprint/default.nix b/pkgs/development/libraries/cxx-prettyprint/default.nix
index 34dc30abe614e..f632fca714cf5 100644
--- a/pkgs/development/libraries/cxx-prettyprint/default.nix
+++ b/pkgs/development/libraries/cxx-prettyprint/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub }:
+{ lib, stdenv, fetchFromGitHub }:
 
 stdenv.mkDerivation rec {
   pname = "cxx-prettyprint-unstable";
@@ -17,10 +17,10 @@ stdenv.mkDerivation rec {
     cp prettyprint.hpp "$out/include"
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description    = "Header only C++ library for pretty printing standard containers";
     homepage       = "https://github.com/louisdx/cxx-prettyprint";
-    license        = stdenv.lib.licenses.boost;
+    license        = lib.licenses.boost;
     platforms      = platforms.all;
 
     # This is a header-only library, no point in hydra building it:
diff --git a/pkgs/development/libraries/cxxtest/default.nix b/pkgs/development/libraries/cxxtest/default.nix
index e1898044efaf7..1a828cc451dc5 100644
--- a/pkgs/development/libraries/cxxtest/default.nix
+++ b/pkgs/development/libraries/cxxtest/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, buildPythonApplication, fetchFromGitHub }:
+{ lib, stdenv, buildPythonApplication, fetchFromGitHub }:
 
 buildPythonApplication rec {
   pname = "cxxtest";
@@ -26,7 +26,7 @@ buildPythonApplication rec {
 
   dontWrapPythonPrograms = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://cxxtest.com";
     description = "Unit testing framework for C++";
     platforms = platforms.unix;
diff --git a/pkgs/development/libraries/cxxtools/default.nix b/pkgs/development/libraries/cxxtools/default.nix
index ca3c487173295..0d8d2498ae737 100644
--- a/pkgs/development/libraries/cxxtools/default.nix
+++ b/pkgs/development/libraries/cxxtools/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
   version = "2.2.1";
@@ -14,8 +14,8 @@ stdenv.mkDerivation rec {
   meta = {
     homepage = "http://www.tntnet.org/cxxtools.html";
     description = "Comprehensive C++ class library for Unix and Linux";
-    platforms = stdenv.lib.platforms.linux ;
-    license = stdenv.lib.licenses.lgpl21;
-    maintainers = [ stdenv.lib.maintainers.juliendehos ];
+    platforms = lib.platforms.linux ;
+    license = lib.licenses.lgpl21;
+    maintainers = [ lib.maintainers.juliendehos ];
   };
 }
diff --git a/pkgs/development/libraries/cyrus-sasl/default.nix b/pkgs/development/libraries/cyrus-sasl/default.nix
index 96778e8960be0..b1a6401284ac6 100644
--- a/pkgs/development/libraries/cyrus-sasl/default.nix
+++ b/pkgs/development/libraries/cyrus-sasl/default.nix
@@ -2,7 +2,7 @@
 , pam, fixDarwinDylibNames, autoreconfHook, enableLdap ? false
 , buildPackages, pruneLibtoolFiles, fetchpatch }:
 
-with stdenv.lib;
+with lib;
 stdenv.mkDerivation rec {
   pname = "cyrus-sasl";
   version = "2.1.27";
diff --git a/pkgs/development/libraries/czmq/default.nix b/pkgs/development/libraries/czmq/default.nix
index 228fec2f8188a..bb8ecafbb3470 100644
--- a/pkgs/development/libraries/czmq/default.nix
+++ b/pkgs/development/libraries/czmq/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, zeromq }:
+{ lib, stdenv, fetchurl, zeromq }:
 
 stdenv.mkDerivation rec {
   version = "4.2.1";
@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
   # Needs to be propagated for the .pc file to work
   propagatedBuildInputs = [ zeromq ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://czmq.zeromq.org/";
     description = "High-level C Binding for ZeroMQ";
     license = licenses.mpl20;
diff --git a/pkgs/development/libraries/dav1d/default.nix b/pkgs/development/libraries/dav1d/default.nix
index b78df35190bc1..2b9357e3ef0ff 100644
--- a/pkgs/development/libraries/dav1d/default.nix
+++ b/pkgs/development/libraries/dav1d/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitLab
+{ lib, stdenv, fetchFromGitLab
 , meson, ninja, nasm, pkg-config
 , withTools ? false # "dav1d" binary
 , withExamples ? false, SDL2 # "dav1dplay" binary
@@ -21,15 +21,15 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ meson ninja nasm pkg-config ];
   # TODO: doxygen (currently only HTML and not build by default).
-  buildInputs = stdenv.lib.optional withExamples SDL2
-    ++ stdenv.lib.optionals useVulkan [ libplacebo vulkan-loader vulkan-headers ];
+  buildInputs = lib.optional withExamples SDL2
+    ++ lib.optionals useVulkan [ libplacebo vulkan-loader vulkan-headers ];
 
   mesonFlags= [
-    "-Denable_tools=${stdenv.lib.boolToString withTools}"
-    "-Denable_examples=${stdenv.lib.boolToString withExamples}"
+    "-Denable_tools=${lib.boolToString withTools}"
+    "-Denable_examples=${lib.boolToString withExamples}"
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A cross-platform AV1 decoder focused on speed and correctness";
     longDescription = ''
       The goal of this project is to provide a decoder for most platforms, and
diff --git a/pkgs/development/libraries/db/db-4.8.nix b/pkgs/development/libraries/db/db-4.8.nix
index dc668a233b06b..5cf9200a9ab97 100644
--- a/pkgs/development/libraries/db/db-4.8.nix
+++ b/pkgs/development/libraries/db/db-4.8.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, ... } @ args:
+{ lib, stdenv, fetchurl, ... } @ args:
 
 import ./generic.nix (args // {
   version = "4.8.30";
diff --git a/pkgs/development/libraries/db/db-5.3.nix b/pkgs/development/libraries/db/db-5.3.nix
index 1223cb897e861..0bb5c4cd6a4a1 100644
--- a/pkgs/development/libraries/db/db-5.3.nix
+++ b/pkgs/development/libraries/db/db-5.3.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, ... } @ args:
+{ lib, stdenv, fetchurl, ... } @ args:
 
 import ./generic.nix (args // {
   version = "5.3.28";
diff --git a/pkgs/development/libraries/db/db-6.0.nix b/pkgs/development/libraries/db/db-6.0.nix
index 642054b5a0184..49935dd2399bd 100644
--- a/pkgs/development/libraries/db/db-6.0.nix
+++ b/pkgs/development/libraries/db/db-6.0.nix
@@ -1,8 +1,8 @@
-{ stdenv, fetchurl, ... } @ args:
+{ lib, stdenv, fetchurl, ... } @ args:
 
 import ./generic.nix (args // {
   version = "6.0.20";
   sha256 = "00r2aaglq625y8r9xd5vw2y070plp88f1mb2gbq3kqsl7128lsl0";
-  license = stdenv.lib.licenses.agpl3;
+  license = lib.licenses.agpl3;
   extraPatches = [ ./clang-6.0.patch ./CVE-2017-10140-cwd-db_config.patch ];
 })
diff --git a/pkgs/development/libraries/db/db-6.2.nix b/pkgs/development/libraries/db/db-6.2.nix
index dee07a9637e6f..b2c0fd7ac8fc6 100644
--- a/pkgs/development/libraries/db/db-6.2.nix
+++ b/pkgs/development/libraries/db/db-6.2.nix
@@ -1,8 +1,8 @@
-{ stdenv, fetchurl, ... } @ args:
+{ lib, stdenv, fetchurl, ... } @ args:
 
 import ./generic.nix (args // {
   version = "6.2.23";
   sha256 = "1isxx4jfmnh913jzhp8hhfngbk6dsg46f4kjpvvc56maj64jqqa7";
-  license = stdenv.lib.licenses.agpl3;
+  license = lib.licenses.agpl3;
   extraPatches = [ ./clang-6.0.patch ./CVE-2017-10140-cwd-db_config.patch ];
 })
diff --git a/pkgs/development/libraries/db/generic.nix b/pkgs/development/libraries/db/generic.nix
index f439113efb3a7..a564db369fba2 100644
--- a/pkgs/development/libraries/db/generic.nix
+++ b/pkgs/development/libraries/db/generic.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl
+{ lib, stdenv, fetchurl
 , cxxSupport ? true
 , compat185 ? true
 , dbmSupport ? false
@@ -6,7 +6,7 @@
 # Options from inherited versions
 , version, sha256
 , extraPatches ? [ ]
-, license ? stdenv.lib.licenses.sleepycat
+, license ? lib.licenses.sleepycat
 , drvArgs ? {}
 }:
 
@@ -27,8 +27,8 @@ stdenv.mkDerivation (rec {
       (if cxxSupport then "--enable-cxx" else "--disable-cxx")
       (if compat185 then "--enable-compat185" else "--disable-compat185")
     ]
-    ++ stdenv.lib.optional dbmSupport "--enable-dbm"
-    ++ stdenv.lib.optional stdenv.isFreeBSD "--with-pic";
+    ++ lib.optional dbmSupport "--enable-dbm"
+    ++ lib.optional stdenv.isFreeBSD "--with-pic";
 
   preConfigure = ''
     cd build_unix
@@ -47,7 +47,7 @@ stdenv.mkDerivation (rec {
     make examples_c examples_cxx
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://www.oracle.com/technetwork/database/database-technologies/berkeleydb/index.html";
     description = "Berkeley DB";
     license = license;
diff --git a/pkgs/development/libraries/dbus-cplusplus/default.nix b/pkgs/development/libraries/dbus-cplusplus/default.nix
index 68b4efb377b64..731c038527ce5 100644
--- a/pkgs/development/libraries/dbus-cplusplus/default.nix
+++ b/pkgs/development/libraries/dbus-cplusplus/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, dbus, glib, pkg-config, expat }:
+{ lib, stdenv, fetchurl, dbus, glib, pkg-config, expat }:
 
 stdenv.mkDerivation rec {
   pname = "dbus-cplusplus";
@@ -36,7 +36,7 @@ stdenv.mkDerivation rec {
 
   configureFlags = [ "--disable-ecore" "--disable-tests" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://dbus-cplusplus.sourceforge.net";
     description = "C++ API for D-BUS";
     license = licenses.gpl2Plus;
diff --git a/pkgs/development/libraries/dbus-glib/default.nix b/pkgs/development/libraries/dbus-glib/default.nix
index 8fb06fe9c4427..f56a1eaac2456 100644
--- a/pkgs/development/libraries/dbus-glib/default.nix
+++ b/pkgs/development/libraries/dbus-glib/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, buildPackages
+{ lib, stdenv, fetchurl, buildPackages
 , pkg-config, expat, gettext, libiconv, dbus, glib
 }:
 
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
   propagatedBuildInputs = [ dbus glib ];
 
   configureFlags = [ "--exec-prefix=${placeholder "dev"}" ] ++
-    stdenv.lib.optional (stdenv.buildPlatform != stdenv.hostPlatform)
+    lib.optional (stdenv.buildPlatform != stdenv.hostPlatform)
       "--with-dbus-binding-tool=${buildPackages.dbus-glib.dev}/bin/dbus-binding-tool";
 
   doCheck = false;
@@ -29,9 +29,9 @@ stdenv.mkDerivation rec {
 
   meta = {
     homepage = "https://dbus.freedesktop.org";
-    license = with stdenv.lib.licenses; [ afl21 gpl2 ];
+    license = with lib.licenses; [ afl21 gpl2 ];
     description = "Obsolete glib bindings for D-Bus lightweight IPC mechanism";
     maintainers = [ ];
-    platforms = stdenv.lib.platforms.unix;
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/dbus-sharp-glib/dbus-sharp-glib-1.0.nix b/pkgs/development/libraries/dbus-sharp-glib/dbus-sharp-glib-1.0.nix
index 77cbd6e28ca5c..f47c91ca3eafe 100644
--- a/pkgs/development/libraries/dbus-sharp-glib/dbus-sharp-glib-1.0.nix
+++ b/pkgs/development/libraries/dbus-sharp-glib/dbus-sharp-glib-1.0.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, autoreconfHook, pkg-config, mono, dbus-sharp-1_0 }:
+{ lib, stdenv, fetchFromGitHub, autoreconfHook, pkg-config, mono, dbus-sharp-1_0 }:
 
 stdenv.mkDerivation rec {
   pname = "dbus-sharp-glib";
@@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
 
   dontStrip = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "D-Bus for .NET: GLib integration module";
     platforms = platforms.linux;
     license = licenses.mit;
diff --git a/pkgs/development/libraries/dbus-sharp-glib/default.nix b/pkgs/development/libraries/dbus-sharp-glib/default.nix
index 33f0c6b382e92..65cd890436638 100644
--- a/pkgs/development/libraries/dbus-sharp-glib/default.nix
+++ b/pkgs/development/libraries/dbus-sharp-glib/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, pkg-config, mono, dbus-sharp-2_0, autoreconfHook }:
+{ lib, stdenv, fetchFromGitHub, pkg-config, mono, dbus-sharp-2_0, autoreconfHook }:
 
 stdenv.mkDerivation rec {
   pname = "dbus-sharp-glib";
@@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
 
   dontStrip = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "D-Bus for .NET: GLib integration module";
     platforms = platforms.linux;
     license = licenses.mit;
diff --git a/pkgs/development/libraries/dbus-sharp/dbus-sharp-1.0.nix b/pkgs/development/libraries/dbus-sharp/dbus-sharp-1.0.nix
index 291bb56efdef6..eb1b20e29eb10 100644
--- a/pkgs/development/libraries/dbus-sharp/dbus-sharp-1.0.nix
+++ b/pkgs/development/libraries/dbus-sharp/dbus-sharp-1.0.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchFromGitHub, pkg-config, mono, autoreconfHook }:
+{lib, stdenv, fetchFromGitHub, pkg-config, mono, autoreconfHook }:
 
 stdenv.mkDerivation rec {
   pname = "dbus-sharp";
@@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
 
   dontStrip = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "D-Bus for .NET";
     platforms = platforms.linux;
     license = licenses.mit;
diff --git a/pkgs/development/libraries/dbus-sharp/default.nix b/pkgs/development/libraries/dbus-sharp/default.nix
index 86a4fce00aa06..c64d7bbef9922 100644
--- a/pkgs/development/libraries/dbus-sharp/default.nix
+++ b/pkgs/development/libraries/dbus-sharp/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchFromGitHub, pkg-config, mono4, autoreconfHook }:
+{lib, stdenv, fetchFromGitHub, pkg-config, mono4, autoreconfHook }:
 
 stdenv.mkDerivation rec {
   pname = "dbus-sharp";
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
 
   dontStrip = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "D-Bus for .NET";
     platforms = platforms.linux;
     license = licenses.mit;
diff --git a/pkgs/development/libraries/dbus/default.nix b/pkgs/development/libraries/dbus/default.nix
index 4496e59a407e1..14b6f1fb4cd86 100644
--- a/pkgs/development/libraries/dbus/default.nix
+++ b/pkgs/development/libraries/dbus/default.nix
@@ -118,7 +118,7 @@ stdenv.mkDerivation rec {
     daemon = dbus.out;
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Simple interprocess messaging system";
     homepage = "http://www.freedesktop.org/wiki/Software/dbus/";
     license = licenses.gpl2Plus; # most is also under AFL-2.1
diff --git a/pkgs/development/libraries/dbxml/default.nix b/pkgs/development/libraries/dbxml/default.nix
index a0005f1bf7200..b4e74d0361915 100644
--- a/pkgs/development/libraries/dbxml/default.nix
+++ b/pkgs/development/libraries/dbxml/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, db62, xercesc, xqilla }:
+{ lib, stdenv, fetchurl, db62, xercesc, xqilla }:
 
 stdenv.mkDerivation rec {
   pname = "dbxml";
@@ -34,7 +34,7 @@ stdenv.mkDerivation rec {
     cd dbxml
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://www.oracle.com/database/berkeley-db/xml.html";
     description = "Embeddable XML database based on Berkeley DB";
     license = licenses.agpl3;
diff --git a/pkgs/development/libraries/dclib/default.nix b/pkgs/development/libraries/dclib/default.nix
index a9929ea2addaa..b393b74f2b2fe 100644
--- a/pkgs/development/libraries/dclib/default.nix
+++ b/pkgs/development/libraries/dclib/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, libxml2, openssl, bzip2}:
+{lib, stdenv, fetchurl, libxml2, openssl, bzip2}:
 
 stdenv.mkDerivation {
   name = "dclib-0.3.7";
@@ -10,7 +10,7 @@ stdenv.mkDerivation {
 
   buildInputs = [libxml2 openssl bzip2];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Peer-to-Peer file sharing client";
     homepage = "http://dcgui.berlios.de";
     platforms = platforms.linux;
diff --git a/pkgs/development/libraries/dclxvi/default.nix b/pkgs/development/libraries/dclxvi/default.nix
index 802befff14cc3..8d7dc5a01781a 100644
--- a/pkgs/development/libraries/dclxvi/default.nix
+++ b/pkgs/development/libraries/dclxvi/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub }:
+{ lib, stdenv, fetchFromGitHub }:
 
 stdenv.mkDerivation {
   name = "dclxvi-2013-01-27";
@@ -15,7 +15,7 @@ stdenv.mkDerivation {
   patchPhase = ''
     substituteInPlace Makefile \
       --replace "gcc" "cc"
-  '' + stdenv.lib.optionalString stdenv.isDarwin ''
+  '' + lib.optionalString stdenv.isDarwin ''
     substituteInPlace Makefile \
       --replace "-soname=libdclxvipairing.so" "-install_name,libdclxvipairing.so"
   '';
@@ -26,7 +26,7 @@ stdenv.mkDerivation {
     find . -name \*.so -exec cp {} $out/lib \;
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/agl/dclxvi";
     description = "Naehrig, Niederhagen and Schwabe's pairings code, massaged into a shared library";
     platforms = platforms.x86_64;
diff --git a/pkgs/development/libraries/dconf/default.nix b/pkgs/development/libraries/dconf/default.nix
index 4b574a17f7895..6834a605f1a55 100644
--- a/pkgs/development/libraries/dconf/default.nix
+++ b/pkgs/development/libraries/dconf/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , meson
 , ninja
@@ -22,10 +22,10 @@ stdenv.mkDerivation rec {
   version = "0.38.0";
 
   outputs = [ "out" "lib" "dev" ]
-    ++ stdenv.lib.optional (!isCross) "devdoc";
+    ++ lib.optional (!isCross) "devdoc";
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "0n2gqkp6d61h7gnnp2xnxp6w5wcl7w9ay58krrf729qd6d0hzxj5";
   };
 
@@ -38,19 +38,19 @@ stdenv.mkDerivation rec {
     glib
     docbook-xsl-nons
     docbook_xml_dtd_42
-  ] ++ stdenv.lib.optional (!isCross) gtk-doc;
+  ] ++ lib.optional (!isCross) gtk-doc;
 
   buildInputs = [
     glib
     bash-completion
     dbus
-  ] ++ stdenv.lib.optional (!isCross) vala;
+  ] ++ lib.optional (!isCross) vala;
   # Vala cross compilation is broken. For now, build dconf without vapi when cross-compiling.
 
   mesonFlags = [
     "--sysconfdir=/etc"
-    "-Dgtk_doc=${stdenv.lib.boolToString (!isCross)}" # gtk-doc does do some gobject introspection, which doesn't yet cross-compile.
-  ] ++ stdenv.lib.optional isCross "-Dvapi=false";
+    "-Dgtk_doc=${lib.boolToString (!isCross)}" # gtk-doc does do some gobject introspection, which doesn't yet cross-compile.
+  ] ++ lib.optional isCross "-Dvapi=false";
 
   doCheck = !stdenv.isAarch32 && !stdenv.isAarch64 && !stdenv.isDarwin;
 
@@ -66,7 +66,7 @@ stdenv.mkDerivation rec {
     };
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://wiki.gnome.org/Projects/dconf";
     license = licenses.lgpl21Plus;
     platforms = platforms.unix;
diff --git a/pkgs/development/libraries/dee/default.nix b/pkgs/development/libraries/dee/default.nix
index fdbe8783d02b4..3d46028ec4388 100644
--- a/pkgs/development/libraries/dee/default.nix
+++ b/pkgs/development/libraries/dee/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchgit
 , fetchpatch
 , pkg-config
@@ -57,7 +57,7 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A library that uses DBus to provide objects allowing you to create Model-View-Controller type programs across DBus";
     homepage = "https://launchpad.net/dee";
     license = licenses.lgpl3;
diff --git a/pkgs/development/libraries/discord-rpc/default.nix b/pkgs/development/libraries/discord-rpc/default.nix
index 3a8290a6597ac..213096f5abf12 100644
--- a/pkgs/development/libraries/discord-rpc/default.nix
+++ b/pkgs/development/libraries/discord-rpc/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , cmake
 , rapidjson
@@ -23,14 +23,14 @@ stdenv.mkDerivation rec {
 
   buildInputs = [
     rapidjson
-  ] ++ stdenv.lib.optional stdenv.isDarwin AppKit;
+  ] ++ lib.optional stdenv.isDarwin AppKit;
 
   cmakeFlags = [
     "-DBUILD_SHARED_LIBS=true"
-    "-DBUILD_EXAMPLES=${stdenv.lib.boolToString buildExamples}"
+    "-DBUILD_EXAMPLES=${lib.boolToString buildExamples}"
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Official library to interface with the Discord client";
     homepage = "https://github.com/discordapp/discord-rpc";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/dleyna-connector-dbus/default.nix b/pkgs/development/libraries/dleyna-connector-dbus/default.nix
index 6570b48e1630d..a24e0b8d01443 100644
--- a/pkgs/development/libraries/dleyna-connector-dbus/default.nix
+++ b/pkgs/development/libraries/dleyna-connector-dbus/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, autoreconfHook, pkg-config, fetchFromGitHub, dbus, dleyna-core, glib }:
+{ lib, stdenv, autoreconfHook, pkg-config, fetchFromGitHub, dbus, dleyna-core, glib }:
 
 stdenv.mkDerivation rec {
   pname = "dleyna-connector-dbus";
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ autoreconfHook pkg-config ];
   buildInputs = [ dbus dleyna-core glib ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A D-Bus API for the dLeyna services";
     homepage = "https://01.org/dleyna";
     maintainers = [ maintainers.jtojnar ];
diff --git a/pkgs/development/libraries/dleyna-core/default.nix b/pkgs/development/libraries/dleyna-core/default.nix
index 56d40361334b7..4a4eecfdc0f27 100644
--- a/pkgs/development/libraries/dleyna-core/default.nix
+++ b/pkgs/development/libraries/dleyna-core/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , fetchpatch
 , autoreconfHook
@@ -39,7 +39,7 @@ stdenv.mkDerivation rec {
     gupnp
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Library of utility functions that are used by the higher level dLeyna";
     homepage = "https://01.org/dleyna";
     maintainers = [ maintainers.jtojnar ];
diff --git a/pkgs/development/libraries/dleyna-renderer/default.nix b/pkgs/development/libraries/dleyna-renderer/default.nix
index 8bff782bacc7d..768af6a671a1a 100644
--- a/pkgs/development/libraries/dleyna-renderer/default.nix
+++ b/pkgs/development/libraries/dleyna-renderer/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , autoreconfHook
 , pkg-config
@@ -50,7 +50,7 @@ stdenv.mkDerivation rec {
       --set DLEYNA_CONNECTOR_PATH "$DLEYNA_CONNECTOR_PATH"
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Library to discover and manipulate Digital Media Renderers";
     homepage = "https://01.org/dleyna";
     maintainers = [ maintainers.jtojnar ];
diff --git a/pkgs/development/libraries/dleyna-server/default.nix b/pkgs/development/libraries/dleyna-server/default.nix
index 4e6d263ed18e0..a0a414abf7485 100644
--- a/pkgs/development/libraries/dleyna-server/default.nix
+++ b/pkgs/development/libraries/dleyna-server/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , fetchpatch
 , autoreconfHook
@@ -54,7 +54,7 @@ stdenv.mkDerivation rec {
       --set DLEYNA_CONNECTOR_PATH "$DLEYNA_CONNECTOR_PATH"
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Library to discover, browse and manipulate Digital Media Servers";
     homepage = "https://01.org/dleyna";
     maintainers = [ maintainers.jtojnar ];
diff --git a/pkgs/development/libraries/dlib/default.nix b/pkgs/development/libraries/dlib/default.nix
index 0f0b9720a1abe..fa7d70d521318 100644
--- a/pkgs/development/libraries/dlib/default.nix
+++ b/pkgs/development/libraries/dlib/default.nix
@@ -28,7 +28,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ cmake pkg-config ];
   buildInputs = [ libpng libjpeg ] ++ lib.optional guiSupport libX11;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A general purpose cross-platform C++ machine learning library";
     homepage = "http://www.dlib.net";
     license = licenses.boost;
diff --git a/pkgs/development/libraries/docopt_cpp/default.nix b/pkgs/development/libraries/docopt_cpp/default.nix
index 36b791ccc98c2..f9456b8acac42 100644
--- a/pkgs/development/libraries/docopt_cpp/default.nix
+++ b/pkgs/development/libraries/docopt_cpp/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, python }:
+{ lib, stdenv, fetchFromGitHub, cmake, python }:
 
 stdenv.mkDerivation rec {
   version = "0.6.3";
@@ -25,7 +25,7 @@ stdenv.mkDerivation rec {
 
   checkPhase = "LD_LIBRARY_PATH=$(pwd) python ./run_tests";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "C++11 port of docopt";
     homepage = "https://github.com/docopt/docopt.cpp";
     license = with licenses; [ mit boost ];
diff --git a/pkgs/development/libraries/doctest/default.nix b/pkgs/development/libraries/doctest/default.nix
index 55f97a425eb36..702015e5d38fb 100644
--- a/pkgs/development/libraries/doctest/default.nix
+++ b/pkgs/development/libraries/doctest/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, installShellFiles, cmake }:
+{ lib, stdenv, fetchFromGitHub, installShellFiles, cmake }:
 
 stdenv.mkDerivation rec {
   pname = "doctest";
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ cmake ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/onqtam/doctest";
     description = "The fastest feature-rich C++11/14/17/20 single-header testing framework";
     platforms = platforms.linux;
diff --git a/pkgs/development/libraries/dotconf/default.nix b/pkgs/development/libraries/dotconf/default.nix
index f6320a64374c6..39d71eee432b6 100644
--- a/pkgs/development/libraries/dotconf/default.nix
+++ b/pkgs/development/libraries/dotconf/default.nix
@@ -1,4 +1,4 @@
-{ fetchFromGitHub, stdenv, autoreconfHook }:
+{ fetchFromGitHub, lib, stdenv, autoreconfHook }:
 
 stdenv.mkDerivation rec {
   name = "dotconf-" + version;
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ autoreconfHook ];
   buildInputs = [ ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A configuration parser library";
     maintainers = with maintainers; [ pSub ];
     homepage = "https://github.com/williamh/dotconf";
diff --git a/pkgs/development/libraries/double-conversion/default.nix b/pkgs/development/libraries/double-conversion/default.nix
index fd7a4e3f5f6f0..2bdcc3c8a997a 100644
--- a/pkgs/development/libraries/double-conversion/default.nix
+++ b/pkgs/development/libraries/double-conversion/default.nix
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
     rm BUILD
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Binary-decimal and decimal-binary routines for IEEE doubles";
     homepage = "https://github.com/google/double-conversion";
     license = licenses.bsd3;
diff --git a/pkgs/development/libraries/dqlite/default.nix b/pkgs/development/libraries/dqlite/default.nix
index 5c9454d32280d..8f67259989b8a 100644
--- a/pkgs/development/libraries/dqlite/default.nix
+++ b/pkgs/development/libraries/dqlite/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, autoreconfHook, pkg-config, file, libco-canonical
+{ lib, stdenv, fetchFromGitHub, autoreconfHook, pkg-config, file, libco-canonical
 , libuv, raft-canonical, sqlite-replication }:
 
 stdenv.mkDerivation rec {
@@ -25,7 +25,7 @@ stdenv.mkDerivation rec {
 
   outputs = [ "dev" "out" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = ''
       Expose a SQLite database over the network and replicate it across a
       cluster of peers
diff --git a/pkgs/development/libraries/draco/default.nix b/pkgs/development/libraries/draco/default.nix
index 8479f3c2f8e1d..41ffdd16f5a90 100644
--- a/pkgs/development/libraries/draco/default.nix
+++ b/pkgs/development/libraries/draco/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake
+{ lib, stdenv, fetchFromGitHub, cmake
 }:
 
 stdenv.mkDerivation rec {
@@ -22,7 +22,7 @@ stdenv.mkDerivation rec {
     "-DBUILD_UNITY_PLUGIN=1"
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Library for compressing and decompressing 3D geometric meshes and point clouds";
     homepage = "https://google.github.io/draco/";
     license = licenses.asl20;
diff --git a/pkgs/development/libraries/drumstick/default.nix b/pkgs/development/libraries/drumstick/default.nix
index 25ecbf03dc11a..21572e52e2359 100644
--- a/pkgs/development/libraries/drumstick/default.nix
+++ b/pkgs/development/libraries/drumstick/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl
+{ lib, stdenv, fetchurl
 , cmake, docbook_xml_dtd_45, docbook_xsl, doxygen, pkg-config, wrapQtAppsHook
 , alsaLib, fluidsynth, qtbase, qtsvg, libpulseaudio
 }:
@@ -31,7 +31,7 @@ stdenv.mkDerivation rec {
     alsaLib fluidsynth libpulseaudio qtbase qtsvg
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     maintainers = with maintainers; [ solson ];
     description = "MIDI libraries for Qt5/C++";
     homepage = "http://drumstick.sourceforge.net/";
diff --git a/pkgs/development/libraries/dssi/default.nix b/pkgs/development/libraries/dssi/default.nix
index cfb0f31af041b..9ce487b1b03a3 100644
--- a/pkgs/development/libraries/dssi/default.nix
+++ b/pkgs/development/libraries/dssi/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, ladspaH, libjack2, liblo, alsaLib, qt4, libX11, libsndfile, libSM
+{ lib, stdenv, fetchurl, ladspaH, libjack2, liblo, alsaLib, qt4, libX11, libsndfile, libSM
 , libsamplerate, libtool, autoconf, automake, xorgproto, libICE, pkg-config
 }:
 
@@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
       libsamplerate libtool autoconf automake xorgproto libICE pkg-config
     ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A plugin SDK for virtual instruments";
     maintainers = with maintainers;
     [
diff --git a/pkgs/development/libraries/duckdb/default.nix b/pkgs/development/libraries/duckdb/default.nix
index 1aedee5c3b687..60ccf5aeeb239 100644
--- a/pkgs/development/libraries/duckdb/default.nix
+++ b/pkgs/development/libraries/duckdb/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , cmake
 }:
@@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ cmake ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/cwida/duckdb";
     description = "Embeddable SQL OLAP Database Management System";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/dxflib/default.nix b/pkgs/development/libraries/dxflib/default.nix
index 1eb23c1145b0c..b2cd97398c619 100644
--- a/pkgs/development/libraries/dxflib/default.nix
+++ b/pkgs/development/libraries/dxflib/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , qmake
 }:
@@ -37,8 +37,8 @@ stdenv.mkDerivation rec {
   doCheck = true;
 
   meta = {
-    maintainers = with stdenv.lib.maintainers; [raskin];
-    platforms = stdenv.lib.platforms.linux;
+    maintainers = with lib.maintainers; [raskin];
+    platforms = lib.platforms.linux;
     description = "DXF file format library";
   };
 }
diff --git a/pkgs/development/libraries/dyncall/default.nix b/pkgs/development/libraries/dyncall/default.nix
index e792fe1e0519d..0e3fa3ac7dc03 100644
--- a/pkgs/development/libraries/dyncall/default.nix
+++ b/pkgs/development/libraries/dyncall/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation {
   pname = "dyncall";
@@ -27,7 +27,7 @@ stdenv.mkDerivation {
     install -D -t $out/share/man/man3 ./*/*.3
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Highly dynamic multi-platform foreign function call interface library";
     homepage = "https://www.dyncall.org";
     license = licenses.isc;
diff --git a/pkgs/development/libraries/easyloggingpp/default.nix b/pkgs/development/libraries/easyloggingpp/default.nix
index 0c3205277841f..ad582d9330591 100644
--- a/pkgs/development/libraries/easyloggingpp/default.nix
+++ b/pkgs/development/libraries/easyloggingpp/default.nix
@@ -1,7 +1,7 @@
 # To use this package with a CMake and pkg-config build:
 # pkg_check_modules(EASYLOGGINGPP REQUIRED easyloggingpp)
 # add_executable(main src/main.cpp ${EASYLOGGINGPP_PREFIX}/include/easylogging++.cc)
-{ stdenv, fetchFromGitHub, cmake, gtest }:
+{ lib, stdenv, fetchFromGitHub, cmake, gtest }:
 stdenv.mkDerivation rec {
   pname = "easyloggingpp";
   version = "9.97.0";
@@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
   buildInputs = [gtest];
   cmakeFlags = [ "-Dtest=ON" ];
   NIX_CFLAGS_COMPILE = "-std=c++11" +
-    stdenv.lib.optionalString stdenv.isLinux " -pthread";
+    lib.optionalString stdenv.isLinux " -pthread";
   postInstall = ''
     mkdir -p $out/include
     cp ../src/easylogging++.cc $out/include
@@ -24,8 +24,8 @@ stdenv.mkDerivation rec {
   meta = {
     description = "C++ logging library";
     homepage = "https://muflihun.github.io/easyloggingpp/";
-    license = stdenv.lib.licenses.mit;
-    maintainers = with stdenv.lib.maintainers; [acowley];
-    platforms = stdenv.lib.platforms.all;
+    license = lib.licenses.mit;
+    maintainers = with lib.maintainers; [acowley];
+    platforms = lib.platforms.all;
   };
 }
diff --git a/pkgs/development/libraries/eccodes/default.nix b/pkgs/development/libraries/eccodes/default.nix
index 867f0e59393cd..1050490a220b6 100644
--- a/pkgs/development/libraries/eccodes/default.nix
+++ b/pkgs/development/libraries/eccodes/default.nix
@@ -1,9 +1,9 @@
-{ fetchurl, stdenv
+{ fetchurl, lib, stdenv
 , cmake, netcdf, openjpeg, libpng, gfortran
 , enablePython ? false, pythonPackages
 , enablePosixThreads ? false
 , enableOpenMPThreads ? false}:
-with stdenv.lib;
+with lib;
 stdenv.mkDerivation rec {
   pname = "eccodes";
   version = "2.12.5";
@@ -38,7 +38,7 @@ stdenv.mkDerivation rec {
   doCheck = true;
 
   # Only do tests that don't require downloading 120MB of testdata
-  checkPhase = stdenv.lib.optionalString (stdenv.isDarwin) ''
+  checkPhase = lib.optionalString (stdenv.isDarwin) ''
     substituteInPlace "tests/include.sh" --replace "set -ea" "set -ea; export DYLD_LIBRARY_PATH=$(pwd)/lib"
   '' + ''
     ctest -R "eccodes_t_(definitions|calendar|unit_tests|md5|uerra|grib_2nd_order_numValues|julian)" -VV
diff --git a/pkgs/development/libraries/eclib/default.nix b/pkgs/development/libraries/eclib/default.nix
index 278099b8ca723..4709441a1011e 100644
--- a/pkgs/development/libraries/eclib/default.nix
+++ b/pkgs/development/libraries/eclib/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , autoreconfHook
 , pari
@@ -29,14 +29,14 @@ stdenv.mkDerivation rec {
     pari
     ntl
     gmp
-  ] ++ stdenv.lib.optionals withFlint [
+  ] ++ lib.optionals withFlint [
     flint
   ];
   nativeBuildInputs = [
     autoreconfHook
   ];
   doCheck = true;
-  meta = with stdenv.lib; {
+  meta = with lib; {
     inherit version;
     description = "Elliptic curve tools";
     homepage = "https://github.com/JohnCremona/eclib";
diff --git a/pkgs/development/libraries/editline/default.nix b/pkgs/development/libraries/editline/default.nix
index 549ef7c56bda3..82f65082b946e 100644
--- a/pkgs/development/libraries/editline/default.nix
+++ b/pkgs/development/libraries/editline/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, autoreconfHook, fetchpatch }:
+{ lib, stdenv, fetchFromGitHub, autoreconfHook, fetchpatch }:
 
 stdenv.mkDerivation rec {
   pname = "editline";
@@ -22,7 +22,7 @@ stdenv.mkDerivation rec {
 
   outputs = [ "out" "dev" "man" "doc" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://troglobit.com/editline.html";
     description = "A readline() replacement for UNIX without termcap (ncurses)";
     license = licenses.bsdOriginal;
diff --git a/pkgs/development/libraries/eigen/2.0.nix b/pkgs/development/libraries/eigen/2.0.nix
index d152757194375..a2b1ba47e2d05 100644
--- a/pkgs/development/libraries/eigen/2.0.nix
+++ b/pkgs/development/libraries/eigen/2.0.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitLab, cmake }:
+{ lib, stdenv, fetchFromGitLab, cmake }:
 
 stdenv.mkDerivation rec {
   pname = "eigen";
@@ -13,12 +13,12 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ cmake ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "C++ template library for linear algebra: vectors, matrices, and related algorithms";
     license = licenses.lgpl3Plus;
     homepage = "https://eigen.tuxfamily.org";
-    maintainers = with stdenv.lib.maintainers; [ sander raskin ];
+    maintainers = with lib.maintainers; [ sander raskin ];
     branch = "2";
-    platforms = with stdenv.lib.platforms; unix;
+    platforms = with lib.platforms; unix;
   };
 }
diff --git a/pkgs/development/libraries/eigen/default.nix b/pkgs/development/libraries/eigen/default.nix
index 3c6a5cc1ca656..079269521c76b 100644
--- a/pkgs/development/libraries/eigen/default.nix
+++ b/pkgs/development/libraries/eigen/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitLab, cmake }:
+{ lib, stdenv, fetchFromGitLab, cmake }:
 
 stdenv.mkDerivation rec {
   pname = "eigen";
@@ -17,12 +17,12 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ cmake ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "C++ template library for linear algebra: vectors, matrices, and related algorithms";
     license = licenses.lgpl3Plus;
     homepage = "https://eigen.tuxfamily.org";
     platforms = platforms.unix;
-    maintainers = with stdenv.lib.maintainers; [ sander raskin ];
+    maintainers = with lib.maintainers; [ sander raskin ];
     inherit version;
   };
 }
diff --git a/pkgs/development/libraries/embree/2.x.nix b/pkgs/development/libraries/embree/2.x.nix
index 083dbbc74500b..12d4e2a87ccdc 100644
--- a/pkgs/development/libraries/embree/2.x.nix
+++ b/pkgs/development/libraries/embree/2.x.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, pkg-config, ispc, tbb, glfw,
+{ lib, stdenv, fetchFromGitHub, cmake, pkg-config, ispc, tbb, glfw,
 openimageio, libjpeg, libpng, libpthreadstubs, libX11
 }:
 
@@ -17,7 +17,7 @@ stdenv.mkDerivation {
 
   nativeBuildInputs = [ cmake pkg-config ];
   buildInputs = [ ispc tbb glfw openimageio libjpeg libpng libX11 libpthreadstubs ];
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "High performance ray tracing kernels from Intel";
     homepage = "https://embree.github.io/";
     maintainers = with maintainers; [ hodapp ];
diff --git a/pkgs/development/libraries/embree/default.nix b/pkgs/development/libraries/embree/default.nix
index fad14a898a789..5dee84d100707 100644
--- a/pkgs/development/libraries/embree/default.nix
+++ b/pkgs/development/libraries/embree/default.nix
@@ -31,7 +31,7 @@ stdenv.mkDerivation rec {
   buildInputs = [ tbb glfw openimageio libjpeg libpng libX11 libpthreadstubs ]
                 ++ lib.optionals stdenv.isDarwin [ glib ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "High performance ray tracing kernels from Intel";
     homepage = "https://embree.github.io/";
     maintainers = with maintainers; [ hodapp gebner ];
diff --git a/pkgs/development/libraries/enchant/1.x.nix b/pkgs/development/libraries/enchant/1.x.nix
index 671ebb279fab5..172d6747aa1cd 100644
--- a/pkgs/development/libraries/enchant/1.x.nix
+++ b/pkgs/development/libraries/enchant/1.x.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, aspell, pkg-config, glib, hunspell, hspell }:
+{ lib, stdenv, fetchurl, aspell, pkg-config, glib, hunspell, hspell }:
 
 stdenv.mkDerivation rec {
   version = "1.6.1";
@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ pkg-config ];
   buildInputs = [ aspell glib hunspell hspell ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Generic spell checking library";
     homepage = "https://abiword.github.io/enchant";
     platforms = platforms.unix;
diff --git a/pkgs/development/libraries/enchant/2.x.nix b/pkgs/development/libraries/enchant/2.x.nix
index 02215a30418b5..184d5dcc0517e 100644
--- a/pkgs/development/libraries/enchant/2.x.nix
+++ b/pkgs/development/libraries/enchant/2.x.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , aspell
 , pkg-config
@@ -46,7 +46,7 @@ stdenv.mkDerivation rec {
     "--enable-relocatable" # needed for tests
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Generic spell checking library";
     homepage = "https://abiword.github.io/enchant/";
     license = licenses.lgpl21Plus; # with extra provision for non-free checkers
diff --git a/pkgs/development/libraries/enet/default.nix b/pkgs/development/libraries/enet/default.nix
index 61b8c1be4f2bd..ef252ad19f6d5 100644
--- a/pkgs/development/libraries/enet/default.nix
+++ b/pkgs/development/libraries/enet/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl}:
+{lib, stdenv, fetchurl}:
 
 stdenv.mkDerivation rec {
   name = "enet-1.3.17";
@@ -11,8 +11,8 @@ stdenv.mkDerivation rec {
   meta = {
     homepage = "http://enet.bespin.org/";
     description = "Simple and robust network communication layer on top of UDP";
-    license = stdenv.lib.licenses.mit;
-    maintainers = with stdenv.lib.maintainers; [ ];
-    platforms = stdenv.lib.platforms.unix;
+    license = lib.licenses.mit;
+    maintainers = with lib.maintainers; [ ];
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/entt/default.nix b/pkgs/development/libraries/entt/default.nix
index 35e12eb00c7ba..955dd2eeb369c 100644
--- a/pkgs/development/libraries/entt/default.nix
+++ b/pkgs/development/libraries/entt/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake }:
+{ lib, stdenv, fetchFromGitHub, cmake }:
 stdenv.mkDerivation rec {
   pname = "entt";
   version = "3.5.2";
@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ cmake ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/skypjack/entt";
     description = "A header-only, tiny and easy to use library for game programming and much more written in modern C++";
     maintainers = with maintainers; [ twey ];
diff --git a/pkgs/development/libraries/epoxy/default.nix b/pkgs/development/libraries/epoxy/default.nix
index 7cc7a24f2c84c..7ae0e73953f44 100644
--- a/pkgs/development/libraries/epoxy/default.nix
+++ b/pkgs/development/libraries/epoxy/default.nix
@@ -1,8 +1,8 @@
-{ stdenv, fetchFromGitHub, autoreconfHook, pkg-config, utilmacros, python3
+{ lib, stdenv, fetchFromGitHub, autoreconfHook, pkg-config, utilmacros, python3
 , libGL, libX11
 }:
 
-with stdenv.lib;
+with lib;
 
 stdenv.mkDerivation rec {
   pname = "epoxy";
diff --git a/pkgs/development/libraries/ethash/default.nix b/pkgs/development/libraries/ethash/default.nix
index 43c9f5a9380a4..0a10fa3c48c15 100644
--- a/pkgs/development/libraries/ethash/default.nix
+++ b/pkgs/development/libraries/ethash/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, gbenchmark, gtest }:
+{ lib, stdenv, fetchFromGitHub, cmake, gbenchmark, gtest }:
 
 stdenv.mkDerivation rec {
   pname = "ethash";
@@ -37,7 +37,7 @@ stdenv.mkDerivation rec {
     #"-DCMAKE_PREFIX_PATH=${gtest.dev}/lib/cmake"
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "PoW algorithm for Ethereum 1.0 based on Dagger-Hashimoto";
     homepage = "https://github.com/ethereum/ethash";
     platforms = [ "x86_64-linux" ];
diff --git a/pkgs/development/libraries/eventlog/default.nix b/pkgs/development/libraries/eventlog/default.nix
index d80fdb2213d51..ca460aa71f6b7 100644
--- a/pkgs/development/libraries/eventlog/default.nix
+++ b/pkgs/development/libraries/eventlog/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation {
   name = "eventlog-0.2.12";
@@ -19,7 +19,7 @@ stdenv.mkDerivation {
       combination of description and tag/value pairs.
     '';
     homepage = "https://www.balabit.com/support/community/products/";
-    license = stdenv.lib.licenses.bsd3;
-    platforms = stdenv.lib.platforms.unix;
+    license = lib.licenses.bsd3;
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/exempi/default.nix b/pkgs/development/libraries/exempi/default.nix
index 5638db7124515..356959b429f24 100644
--- a/pkgs/development/libraries/exempi/default.nix
+++ b/pkgs/development/libraries/exempi/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, fetchpatch, expat, zlib, boost, libiconv, darwin }:
+{ lib, stdenv, fetchurl, fetchpatch, expat, zlib, boost, libiconv, darwin }:
 
 stdenv.mkDerivation rec {
   pname = "exempi";
@@ -14,11 +14,11 @@ stdenv.mkDerivation rec {
   ];
 
   buildInputs = [ expat zlib boost ]
-    ++ stdenv.lib.optionals stdenv.isDarwin [ libiconv darwin.apple_sdk.frameworks.CoreServices ];
+    ++ lib.optionals stdenv.isDarwin [ libiconv darwin.apple_sdk.frameworks.CoreServices ];
 
   doCheck = stdenv.isLinux;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "An implementation of XMP (Adobe's Extensible Metadata Platform)";
     homepage = "https://libopenraw.freedesktop.org/wiki/Exempi/";
     platforms = platforms.linux ++ platforms.darwin;
diff --git a/pkgs/development/libraries/exiv2/default.nix b/pkgs/development/libraries/exiv2/default.nix
index a845e8998e788..9d29afd692795 100644
--- a/pkgs/development/libraries/exiv2/default.nix
+++ b/pkgs/development/libraries/exiv2/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , fetchpatch
 , zlib
@@ -85,13 +85,13 @@ stdenv.mkDerivation rec {
     patchShebangs ../test/
     mkdir ../test/tmp
 
-    ${stdenv.lib.optionalString (stdenv.isAarch64 || stdenv.isAarch32) ''
+    ${lib.optionalString (stdenv.isAarch64 || stdenv.isAarch32) ''
       # Fix tests on arm
       # https://github.com/Exiv2/exiv2/issues/933
       rm -f ../tests/bugfixes/github/test_CVE_2018_12265.py
     ''}
 
-    ${stdenv.lib.optionalString stdenv.isDarwin ''
+    ${lib.optionalString stdenv.isDarwin ''
       export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH''${DYLD_LIBRARY_PATH:+:}$PWD/lib
       # Removing tests depending on charset conversion
       substituteInPlace ../test/Makefile --replace "conversions.sh" ""
@@ -111,7 +111,7 @@ stdenv.mkDerivation rec {
     )
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://www.exiv2.org/";
     description = "A library and command-line utility to manage image metadata";
     platforms = platforms.all;
diff --git a/pkgs/development/libraries/exosip/default.nix b/pkgs/development/libraries/exosip/default.nix
index 9f9adb455b959..400d7696e3caf 100644
--- a/pkgs/development/libraries/exosip/default.nix
+++ b/pkgs/development/libraries/exosip/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, libosip, openssl, pkg-config, fetchpatch }:
+{ lib, stdenv, fetchurl, libosip, openssl, pkg-config, fetchpatch }:
 
 stdenv.mkDerivation rec {
  pname = "libexosip2";
@@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
     })
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     license = licenses.gpl2Plus;
     description = "Library that hides the complexity of using the SIP protocol";
     platforms = platforms.linux;
diff --git a/pkgs/development/libraries/expat/default.nix b/pkgs/development/libraries/expat/default.nix
index 29d2c2b3acb9b..ba9fb2b177ded 100644
--- a/pkgs/development/libraries/expat/default.nix
+++ b/pkgs/development/libraries/expat/default.nix
@@ -18,7 +18,7 @@ in stdenv.mkDerivation rec {
   outputs = [ "out" "dev" ]; # TODO: fix referrers
   outputBin = "dev";
 
-  configureFlags = stdenv.lib.optional stdenv.isFreeBSD "--with-pic";
+  configureFlags = lib.optional stdenv.isFreeBSD "--with-pic";
 
   outputMan = "dev"; # tiny page for a dev tool
 
@@ -29,7 +29,7 @@ in stdenv.mkDerivation rec {
     patchShebangs ./test-driver-wrapper.sh
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://www.libexpat.org/";
     description = "A stream-oriented XML parser library written in C";
     platforms = platforms.all;
diff --git a/pkgs/development/libraries/faac/default.nix b/pkgs/development/libraries/faac/default.nix
index b2c4d3741e18f..dbc56572d537a 100644
--- a/pkgs/development/libraries/faac/default.nix
+++ b/pkgs/development/libraries/faac/default.nix
@@ -1,11 +1,11 @@
-{ stdenv, fetchurl, autoreconfHook
+{ lib, stdenv, fetchurl, autoreconfHook
 , mp4v2Support ? true, mp4v2 ? null
 , drmSupport ? false # Digital Radio Mondiale
 }:
 
 assert mp4v2Support -> (mp4v2 != null);
 
-with stdenv.lib;
+with lib;
 stdenv.mkDerivation rec {
   pname = "faac";
   version = "1.30";
diff --git a/pkgs/development/libraries/faad2/default.nix b/pkgs/development/libraries/faad2/default.nix
index 90b1a182e553d..0afef1c9fd822 100644
--- a/pkgs/development/libraries/faad2/default.nix
+++ b/pkgs/development/libraries/faad2/default.nix
@@ -1,8 +1,8 @@
-{stdenv, fetchFromGitHub, autoreconfHook
+{lib, stdenv, fetchFromGitHub, autoreconfHook
 , drmSupport ? false # Digital Radio Mondiale
 }:
 
-with stdenv.lib;
+with lib;
 stdenv.mkDerivation rec {
   pname = "faad2";
   version = "2.10.0";
diff --git a/pkgs/development/libraries/farbfeld/default.nix b/pkgs/development/libraries/farbfeld/default.nix
index a528ad6f7f618..9473d09ffc550 100644
--- a/pkgs/development/libraries/farbfeld/default.nix
+++ b/pkgs/development/libraries/farbfeld/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchgit, makeWrapper, file, libpng, libjpeg }:
+{ lib, stdenv, fetchgit, makeWrapper, file, libpng, libjpeg }:
 
 stdenv.mkDerivation rec {
   pname = "farbfeld";
@@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
     wrapProgram "$out/bin/2ff" --prefix PATH : "${file}/bin"
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Suckless image format with conversion tools";
     license = licenses.isc;
     platforms = platforms.linux;
diff --git a/pkgs/development/libraries/farstream/default.nix b/pkgs/development/libraries/farstream/default.nix
index c49c12c03bd87..b046b7aef7371 100644
--- a/pkgs/development/libraries/farstream/default.nix
+++ b/pkgs/development/libraries/farstream/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , fetchpatch
 , libnice
@@ -56,7 +56,7 @@ stdenv.mkDerivation rec {
     gst-libav
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://www.freedesktop.org/wiki/Software/Farstream";
     description = "Audio/Video Communications Framework formely known as farsight";
     platforms = platforms.linux;
diff --git a/pkgs/development/libraries/fast-cpp-csv-parser/default.nix b/pkgs/development/libraries/fast-cpp-csv-parser/default.nix
index 80306bf506bec..5a81e3f727463 100644
--- a/pkgs/development/libraries/fast-cpp-csv-parser/default.nix
+++ b/pkgs/development/libraries/fast-cpp-csv-parser/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub }:
+{ lib, stdenv, fetchFromGitHub }:
 
 stdenv.mkDerivation rec {
   pname = "fast-cpp-csv-parser";
@@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
     substituteAll ${./fast-cpp-csv-parser.pc.in} $out/lib/pkgconfig/fast-cpp-csv-parser.pc
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A small, easy-to-use and fast header-only library for reading comma separated value (CSV) files";
     homepage = "https://github.com/ben-strasser/fast-cpp-csv-parser";
     license = licenses.bsd3;
diff --git a/pkgs/development/libraries/fastjson/default.nix b/pkgs/development/libraries/fastjson/default.nix
index f1bd647b06d8a..c56e05e075323 100644
--- a/pkgs/development/libraries/fastjson/default.nix
+++ b/pkgs/development/libraries/fastjson/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, libtool, autoconf, automake }:
+{ lib, stdenv, fetchFromGitHub, libtool, autoconf, automake }:
 
 stdenv.mkDerivation rec {
   version = "0.99.8";
@@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
     sh autogen.sh
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A fast json library for C";
     homepage = "https://github.com/rsyslog/libfastjson";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/fastpbkdf2/default.nix b/pkgs/development/libraries/fastpbkdf2/default.nix
index eb5cb25162091..ac90001fc3975 100644
--- a/pkgs/development/libraries/fastpbkdf2/default.nix
+++ b/pkgs/development/libraries/fastpbkdf2/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, openssl }:
+{ lib, stdenv, fetchFromGitHub, openssl }:
 
 stdenv.mkDerivation {
   name = "fastpbkdf2-1.0.0";
@@ -22,7 +22,7 @@ stdenv.mkDerivation {
     cp fastpbkdf2.h $out/include/fastpbkdf2
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A fast PBKDF2-HMAC-{SHA1,SHA256,SHA512} implementation in C";
     homepage = "https://github.com/ctz/fastpbkdf2";
     license = licenses.cc0;
diff --git a/pkgs/development/libraries/faudio/default.nix b/pkgs/development/libraries/faudio/default.nix
index 4a565e3fccc8f..c030f53df26ca 100644
--- a/pkgs/development/libraries/faudio/default.nix
+++ b/pkgs/development/libraries/faudio/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, SDL2}:
+{ lib, stdenv, fetchFromGitHub, cmake, SDL2}:
 
 #TODO: tests
 
@@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ SDL2 ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "XAudio reimplementation focusing to develop a fully accurate DirectX audio library";
     homepage = "https://github.com/FNA-XNA/FAudio";
     license = licenses.zlib;
diff --git a/pkgs/development/libraries/fcgi/default.nix b/pkgs/development/libraries/fcgi/default.nix
index bde1682e3fc02..1ec666a920c38 100644
--- a/pkgs/development/libraries/fcgi/default.nix
+++ b/pkgs/development/libraries/fcgi/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, fetchpatch, autoreconfHook }:
+{ lib, stdenv, fetchFromGitHub, fetchpatch, autoreconfHook }:
 
 stdenv.mkDerivation rec {
   pname = "fcgi";
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
 
   postInstall = "ln -s . $out/include/fastcgi";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A language independent, scalable, open extension to CG";
     homepage = "http://www.fastcgi.com/";
     license = "FastCGI see LICENSE.TERMS";
diff --git a/pkgs/development/libraries/fcppt/default.nix b/pkgs/development/libraries/fcppt/default.nix
index d76772500fb2c..380fdcce29f33 100644
--- a/pkgs/development/libraries/fcppt/default.nix
+++ b/pkgs/development/libraries/fcppt/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, boost, catch2, metal }:
+{ lib, stdenv, fetchFromGitHub, cmake, boost, catch2, metal }:
 stdenv.mkDerivation rec {
   pname = "fcppt";
   version = "3.5.0";
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
 
   cmakeFlags = [ "-DCMAKE_SKIP_BUILD_RPATH=false" "-DENABLE_BOOST=true" "-DENABLE_EXAMPLES=true" "-DENABLE_CATCH=true" "-DENABLE_TEST=true" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Freundlich's C++ toolkit";
     longDescription = ''
       Freundlich's C++ Toolkit (fcppt) is a collection of libraries focusing on
diff --git a/pkgs/development/libraries/fdk-aac/default.nix b/pkgs/development/libraries/fdk-aac/default.nix
index 53967381570da..dc64a6edce04d 100644
--- a/pkgs/development/libraries/fdk-aac/default.nix
+++ b/pkgs/development/libraries/fdk-aac/default.nix
@@ -1,8 +1,8 @@
-{ stdenv, fetchurl
+{ lib, stdenv, fetchurl
 , exampleSupport ? false # Example encoding program
 }:
 
-with stdenv.lib;
+with lib;
 stdenv.mkDerivation rec {
   pname = "fdk-aac";
   version = "2.0.1";
diff --git a/pkgs/development/libraries/fflas-ffpack/default.nix b/pkgs/development/libraries/fflas-ffpack/default.nix
index d62d3dd7cc6fd..fd7d89a883113 100644
--- a/pkgs/development/libraries/fflas-ffpack/default.nix
+++ b/pkgs/development/libraries/fflas-ffpack/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, autoreconfHook, givaro, pkg-config, blas, lapack
+{ lib, stdenv, fetchFromGitHub, autoreconfHook, givaro, pkg-config, blas, lapack
 , gmpxx
 }:
 
@@ -24,14 +24,14 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [
     autoreconfHook
     pkg-config
-  ] ++ stdenv.lib.optionals doCheck checkInputs;
+  ] ++ lib.optionals doCheck checkInputs;
 
   buildInputs = [ givaro blas lapack ];
 
   configureFlags = [
     "--with-blas-libs=-lcblas"
     "--with-lapack-libs=-llapacke"
-  ] ++ stdenv.lib.optionals stdenv.isx86_64 [
+  ] ++ lib.optionals stdenv.isx86_64 [
     # disable SIMD instructions (which are enabled *when available* by default)
     # for now we need to be careful to disable *all* relevant versions of an instruction set explicitly (https://github.com/linbox-team/fflas-ffpack/issues/284)
     "--${if stdenv.hostPlatform.sse3Support   then "enable" else "disable"}-sse3"
@@ -48,7 +48,7 @@ stdenv.mkDerivation rec {
   ];
   doCheck = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     inherit version;
     description = "Finite Field Linear Algebra Subroutines";
     license = licenses.lgpl21Plus;
diff --git a/pkgs/development/libraries/ffmpeg-full/default.nix b/pkgs/development/libraries/ffmpeg-full/default.nix
index 27f2c65e867a9..916ea2772e195 100644
--- a/pkgs/development/libraries/ffmpeg-full/default.nix
+++ b/pkgs/development/libraries/ffmpeg-full/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, ffmpeg, addOpenGLRunpath, fetchurl, fetchpatch, pkg-config, perl, texinfo, yasm
+{ lib, stdenv, ffmpeg, addOpenGLRunpath, fetchurl, fetchpatch, pkg-config, perl, texinfo, yasm
 /*
  *  Licensing options (yes some are listed twice, filters and such are not listed)
  */
@@ -184,7 +184,7 @@
 
 let
   inherit (stdenv) isCygwin isDarwin isFreeBSD isLinux isAarch64;
-  inherit (stdenv.lib) optional optionals optionalString enableFeature;
+  inherit (lib) optional optionals optionalString enableFeature;
 in
 
 /*
@@ -260,9 +260,9 @@ stdenv.mkDerivation rec {
 
   prePatch = ''
     patchShebangs .
-  '' + stdenv.lib.optionalString stdenv.isDarwin ''
+  '' + lib.optionalString stdenv.isDarwin ''
     sed -i 's/#ifndef __MAC_10_11/#if 1/' ./libavcodec/audiotoolboxdec.c
-  '' + stdenv.lib.optionalString (frei0r != null) ''
+  '' + lib.optionalString (frei0r != null) ''
     substituteInPlace libavfilter/vf_frei0r.c \
       --replace /usr/local/lib/frei0r-1 ${frei0r}/lib/frei0r-1
     substituteInPlace doc/filters.texi \
@@ -467,7 +467,7 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A complete, cross-platform solution to record, convert and stream audio and video";
     homepage = "https://www.ffmpeg.org/";
     longDescription = ''
diff --git a/pkgs/development/libraries/ffmpeg-sixel/default.nix b/pkgs/development/libraries/ffmpeg-sixel/default.nix
index d01f22c0b3a17..daa03d0293a03 100644
--- a/pkgs/development/libraries/ffmpeg-sixel/default.nix
+++ b/pkgs/development/libraries/ffmpeg-sixel/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, pkg-config, libsixel, yasm
+{ lib, stdenv, fetchFromGitHub, pkg-config, libsixel, yasm
 }:
 
 stdenv.mkDerivation {
@@ -27,7 +27,7 @@ stdenv.mkDerivation {
     mv $out/bin/ffmpeg $out/bin/ffmpeg-sixel
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A complete, cross-platform solution to record, convert and stream audio and video, extended to support console graphics";
     homepage = "http://www.ffmpeg.org/";
     license = licenses.lgpl3;
diff --git a/pkgs/development/libraries/ffmpeg/generic.nix b/pkgs/development/libraries/ffmpeg/generic.nix
index bc4de6a5b4a7b..0dfa639c338dc 100644
--- a/pkgs/development/libraries/ffmpeg/generic.nix
+++ b/pkgs/development/libraries/ffmpeg/generic.nix
@@ -1,4 +1,4 @@
-{ stdenv, buildPackages, fetchurl, pkg-config, addOpenGLRunpath, perl, texinfo, yasm
+{ lib, stdenv, buildPackages, fetchurl, pkg-config, addOpenGLRunpath, perl, texinfo, yasm
 , alsaLib, bzip2, fontconfig, freetype, gnutls, libiconv, lame, libass, libogg
 , libssh, libtheora, libva, libdrm, libvorbis, libvpx, lzma, libpulseaudio, soxr
 , x264, x265, xvidcore, zlib, libopus, speex, nv-codec-headers, dav1d
@@ -44,7 +44,7 @@
 
 let
   inherit (stdenv) isDarwin isFreeBSD isLinux isAarch32;
-  inherit (stdenv.lib) optional optionals optionalString enableFeature filter;
+  inherit (lib) optional optionals optionalString enableFeature filter;
 
   cmpVer = builtins.compareVersions;
   reqMin = requiredVersion: (cmpVer requiredVersion branch != 1);
@@ -211,7 +211,7 @@ stdenv.mkDerivation rec {
     inherit vaapiSupport vdpauSupport;
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A complete, cross-platform solution to record, convert and stream audio and video";
     homepage = "http://www.ffmpeg.org/";
     longDescription = ''
diff --git a/pkgs/development/libraries/ffmpegthumbnailer/default.nix b/pkgs/development/libraries/ffmpegthumbnailer/default.nix
index 6c8e689840e8b..2e68dbb1d120b 100644
--- a/pkgs/development/libraries/ffmpegthumbnailer/default.nix
+++ b/pkgs/development/libraries/ffmpegthumbnailer/default.nix
@@ -1,4 +1,4 @@
-{ fetchFromGitHub, stdenv, ffmpeg_3, cmake, libpng, pkg-config, libjpeg
+{ fetchFromGitHub, lib, stdenv, ffmpeg_3, cmake, libpng, pkg-config, libjpeg
 }:
 
 stdenv.mkDerivation rec {
@@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
   buildInputs = [ ffmpeg_3 libpng libjpeg ];
   cmakeFlags = [ "-DENABLE_THUMBNAILER=ON" ];
 
-  meta = with stdenv.lib;  {
+  meta = with lib;  {
     homepage = "https://github.com/dirkvdb/ffmpegthumbnailer";
     description = "A lightweight video thumbnailer";
     longDescription = "FFmpegthumbnailer is a lightweight video
diff --git a/pkgs/development/libraries/ffms/default.nix b/pkgs/development/libraries/ffms/default.nix
index 3dfe697981cb0..7fa96cff7f88e 100644
--- a/pkgs/development/libraries/ffms/default.nix
+++ b/pkgs/development/libraries/ffms/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, zlib, ffmpeg_3, pkg-config }:
+{ lib, stdenv, fetchFromGitHub, zlib, ffmpeg_3, pkg-config }:
 
 stdenv.mkDerivation rec {
   pname = "ffms";
@@ -23,7 +23,7 @@ stdenv.mkDerivation rec {
     ln -s $out/lib/libffms2.so $out/lib/vapoursynth/libffms2.so
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/FFMS/ffms2/";
     description = "Libav/ffmpeg based source library for easy frame accurate access";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/fftw/default.nix b/pkgs/development/libraries/fftw/default.nix
index ba7e86747a7f0..f0632e1460a01 100644
--- a/pkgs/development/libraries/fftw/default.nix
+++ b/pkgs/development/libraries/fftw/default.nix
@@ -46,7 +46,7 @@ stdenv.mkDerivation {
 
   checkInputs = [ perl ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Fastest Fourier Transform in the West library";
     homepage = "http://www.fftw.org/";
     license = licenses.gpl2Plus;
diff --git a/pkgs/development/libraries/filter-audio/default.nix b/pkgs/development/libraries/filter-audio/default.nix
index 3438bfee07b45..a412f70704703 100644
--- a/pkgs/development/libraries/filter-audio/default.nix
+++ b/pkgs/development/libraries/filter-audio/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub }:
+{ lib, stdenv, fetchFromGitHub }:
 
 stdenv.mkDerivation rec {
   pname = "filter-audio";
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
 
   makeFlags = [ "PREFIX=$(out)" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Lightweight audio filtering library made from webrtc code";
     license = licenses.bsd3;
     maintainers = with maintainers; [ ];
diff --git a/pkgs/development/libraries/flann/default.nix b/pkgs/development/libraries/flann/default.nix
index a61d11c25780a..9133938042498 100644
--- a/pkgs/development/libraries/flann/default.nix
+++ b/pkgs/development/libraries/flann/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, fetchpatch, unzip, cmake, python }:
+{ lib, stdenv, fetchFromGitHub, fetchpatch, unzip, cmake, python }:
 
 stdenv.mkDerivation {
   name = "flann-1.9.1";
@@ -22,9 +22,9 @@ stdenv.mkDerivation {
 
   meta = {
     homepage = "http://people.cs.ubc.ca/~mariusm/flann/";
-    license = stdenv.lib.licenses.bsd3;
+    license = lib.licenses.bsd3;
     description = "Fast approximate nearest neighbor searches in high dimensional spaces";
-    maintainers = with stdenv.lib.maintainers; [viric];
-    platforms = with stdenv.lib.platforms; linux ++ darwin;
+    maintainers = with lib.maintainers; [viric];
+    platforms = with lib.platforms; linux ++ darwin;
   };
 }
diff --git a/pkgs/development/libraries/flatbuffers/default.nix b/pkgs/development/libraries/flatbuffers/default.nix
index 0b96a91e45fa3..374203556a608 100644
--- a/pkgs/development/libraries/flatbuffers/default.nix
+++ b/pkgs/development/libraries/flatbuffers/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, fetchpatch, cmake }:
+{ lib, stdenv, fetchFromGitHub, fetchpatch, cmake }:
 
 stdenv.mkDerivation rec {
   pname = "flatbuffers";
@@ -26,7 +26,7 @@ stdenv.mkDerivation rec {
     })
   ];
 
-  preConfigure = stdenv.lib.optional stdenv.buildPlatform.isDarwin ''
+  preConfigure = lib.optional stdenv.buildPlatform.isDarwin ''
     rm BUILD
   '';
 
@@ -39,7 +39,7 @@ stdenv.mkDerivation rec {
   # doCheck = stdenv.hostPlatform == stdenv.buildPlatform;
   checkTarget = "test";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Memory Efficient Serialization Library";
     longDescription = ''
       FlatBuffers is an efficient cross platform serialization library for
diff --git a/pkgs/development/libraries/flatcc/default.nix b/pkgs/development/libraries/flatcc/default.nix
index 6239dba2836df..6b40814119c66 100644
--- a/pkgs/development/libraries/flatcc/default.nix
+++ b/pkgs/development/libraries/flatcc/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , cmake
 }:
@@ -24,6 +24,6 @@ stdenv.mkDerivation rec {
   meta = {
     description = "FlatBuffers Compiler and Library in C for C ";
     homepage = "https://github.com/dvidelabs/flatcc";
-    license = [ stdenv.lib.licenses.asl20 ];
+    license = [ lib.licenses.asl20 ];
   };
 }
diff --git a/pkgs/development/libraries/flatpak/default.nix b/pkgs/development/libraries/flatpak/default.nix
index 6f8634c01ef8d..1480f42750dd7 100644
--- a/pkgs/development/libraries/flatpak/default.nix
+++ b/pkgs/development/libraries/flatpak/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , fetchpatch
 , autoconf
@@ -196,7 +196,7 @@ stdenv.mkDerivation rec {
   in ''
     patchShebangs buildutil
     patchShebangs tests
-    PATH=${stdenv.lib.makeBinPath [vsc-py]}:$PATH patchShebangs --build variant-schema-compiler/variant-schema-compiler
+    PATH=${lib.makeBinPath [vsc-py]}:$PATH patchShebangs --build variant-schema-compiler/variant-schema-compiler
   '';
 
   preConfigure = ''
@@ -215,7 +215,7 @@ stdenv.mkDerivation rec {
     };
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Linux application sandboxing and distribution framework";
     homepage = "https://flatpak.org/";
     license = licenses.lgpl21;
diff --git a/pkgs/development/libraries/flint/default.nix b/pkgs/development/libraries/flint/default.nix
index 96c5369840136..7bfa701db7391 100644
--- a/pkgs/development/libraries/flint/default.nix
+++ b/pkgs/development/libraries/flint/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , fetchpatch
 , gmp
@@ -23,7 +23,7 @@ stdenv.mkDerivation rec {
     mpir
     mpfr
     ntl
-  ] ++ stdenv.lib.optionals withBlas [
+  ] ++ lib.optionals withBlas [
     openblas
   ];
   propagatedBuildInputs = [
@@ -34,7 +34,7 @@ stdenv.mkDerivation rec {
     "--with-mpir=${mpir}"
     "--with-mpfr=${mpfr}"
     "--with-ntl=${ntl}"
-  ] ++ stdenv.lib.optionals withBlas [
+  ] ++ lib.optionals withBlas [
     "--with-blas=${openblas}"
   ];
 
@@ -53,9 +53,9 @@ stdenv.mkDerivation rec {
   meta = {
     inherit version;
     description = "Fast Library for Number Theory";
-    license = stdenv.lib.licenses.gpl2Plus;
-    maintainers = [stdenv.lib.maintainers.raskin];
-    platforms = stdenv.lib.platforms.unix;
+    license = lib.licenses.gpl2Plus;
+    maintainers = [lib.maintainers.raskin];
+    platforms = lib.platforms.unix;
     homepage = "http://www.flintlib.org/";
     downloadPage = "http://www.flintlib.org/downloads.html";
     updateWalker = true;
diff --git a/pkgs/development/libraries/flite/default.nix b/pkgs/development/libraries/flite/default.nix
index 1db8a9fbe2f31..24927fe853bae 100644
--- a/pkgs/development/libraries/flite/default.nix
+++ b/pkgs/development/libraries/flite/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, alsaLib }:
+{ lib, stdenv, fetchFromGitHub, alsaLib }:
 
 stdenv.mkDerivation rec {
   pname = "flite";
@@ -11,15 +11,15 @@ stdenv.mkDerivation rec {
     sha256 = "1n0p81jzndzc1rzgm66kw9ls189ricy5v1ps11y0p2fk1p56kbjf";
   };
 
-  buildInputs = stdenv.lib.optionals stdenv.isLinux [ alsaLib ];
+  buildInputs = lib.optionals stdenv.isLinux [ alsaLib ];
 
   configureFlags = [
     "--enable-shared"
-  ] ++ stdenv.lib.optionals stdenv.isLinux [ "--with-audio=alsa" ];
+  ] ++ lib.optionals stdenv.isLinux [ "--with-audio=alsa" ];
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A small, fast run-time speech synthesis engine";
     homepage = "http://www.festvox.org/flite/";
     license = licenses.bsdOriginal;
diff --git a/pkgs/development/libraries/fltk/1.4.nix b/pkgs/development/libraries/fltk/1.4.nix
index 4c482176fcbcb..2db0aea3ecf8c 100644
--- a/pkgs/development/libraries/fltk/1.4.nix
+++ b/pkgs/development/libraries/fltk/1.4.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, xlibsWrapper, xorgproto, libXi
+{ lib, stdenv, fetchurl, pkg-config, xlibsWrapper, xorgproto, libXi
 , freeglut, libGLU, libGL, libjpeg, zlib, libXft, libpng
 , libtiff, freetype, Cocoa, AGL, GLUT
 }:
@@ -16,11 +16,11 @@ stdenv.mkDerivation {
     sha256 = "1v8wxvxcbk99i82x2v5fpqg5vj8n7g8a38g30ry7nzcjn5sf3r63";
   };
 
-  patches = stdenv.lib.optionals stdenv.isDarwin [ ./nsosv.patch ];
+  patches = lib.optionals stdenv.isDarwin [ ./nsosv.patch ];
 
   nativeBuildInputs = [ pkg-config ];
   buildInputs = [ libGLU libGL libjpeg zlib libpng libXft ]
-    ++ stdenv.lib.optional stdenv.isDarwin [ AGL Cocoa GLUT ];
+    ++ lib.optional stdenv.isDarwin [ AGL Cocoa GLUT ];
 
   propagatedBuildInputs = [ xorgproto ]
     ++ (if stdenv.isDarwin
@@ -39,7 +39,7 @@ stdenv.mkDerivation {
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A C++ cross-platform lightweight GUI library";
     homepage = "https://www.fltk.org";
     platforms = platforms.linux ++ platforms.darwin;
diff --git a/pkgs/development/libraries/fltk/default.nix b/pkgs/development/libraries/fltk/default.nix
index ca8198fb271b0..5cbd993fc646d 100644
--- a/pkgs/development/libraries/fltk/default.nix
+++ b/pkgs/development/libraries/fltk/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, xlibsWrapper, xorgproto, libXi
+{ lib, stdenv, fetchurl, pkg-config, xlibsWrapper, xorgproto, libXi
 , freeglut, libGL, libGLU, libjpeg, zlib, libXft, libpng
 , libtiff, freetype, Cocoa, AGL, GLUT
 }:
@@ -16,11 +16,11 @@ stdenv.mkDerivation {
     sha256 = "00jp24z1818k9n6nn6lx7qflqf2k13g4kxr0p8v1d37kanhb4ac7";
   };
 
-  patches = stdenv.lib.optionals stdenv.isDarwin [ ./nsosv.patch ];
+  patches = lib.optionals stdenv.isDarwin [ ./nsosv.patch ];
 
   nativeBuildInputs = [ pkg-config ];
   buildInputs = [ libGLU libGL libjpeg zlib libpng libXft ]
-    ++ stdenv.lib.optional stdenv.isDarwin [ AGL Cocoa GLUT ];
+    ++ lib.optional stdenv.isDarwin [ AGL Cocoa GLUT ];
 
   propagatedBuildInputs = [ xorgproto ]
     ++ (if stdenv.isDarwin
@@ -37,7 +37,7 @@ stdenv.mkDerivation {
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A C++ cross-platform lightweight GUI library";
     homepage = "https://www.fltk.org";
     platforms = platforms.linux ++ platforms.darwin;
diff --git a/pkgs/development/libraries/fmt/default.nix b/pkgs/development/libraries/fmt/default.nix
index 2f490891433b9..0d2983b1f8465 100644
--- a/pkgs/development/libraries/fmt/default.nix
+++ b/pkgs/development/libraries/fmt/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, fetchpatch, cmake
+{ lib, stdenv, fetchFromGitHub, fetchpatch, cmake
 , enableShared ? !stdenv.hostPlatform.isStatic
 }:
 
@@ -28,7 +28,7 @@ let
 
       doCheck = true;
 
-      meta = with stdenv.lib; {
+      meta = with lib; {
         description = "Small, safe and fast formatting library";
         longDescription = ''
           fmt (formerly cppformat) is an open-source formatting library. It can be
diff --git a/pkgs/development/libraries/folks/default.nix b/pkgs/development/libraries/folks/default.nix
index 7b2ca83fe5ba8..955b7e0d16f93 100644
--- a/pkgs/development/libraries/folks/default.nix
+++ b/pkgs/development/libraries/folks/default.nix
@@ -1,5 +1,5 @@
 { fetchurl
-, stdenv
+, lib, stdenv
 , pkg-config
 , meson
 , ninja
@@ -38,13 +38,13 @@ stdenv.mkDerivation rec {
   outputs = [ "out" "dev" "devdoc" ];
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "1f9b52vmwnq7s51vj26w2618dn2ph5g12ibbkbyk6fvxcgd7iryn";
   };
 
   mesonFlags = [
     "-Ddocs=true"
-    "-Dtelepathy_backend=${stdenv.lib.boolToString telepathySupport}"
+    "-Dtelepathy_backend=${lib.boolToString telepathySupport}"
   ];
 
   nativeBuildInputs = [
@@ -71,7 +71,7 @@ stdenv.mkDerivation rec {
     nspr
     nss
     readline
-  ] ++ stdenv.lib.optional telepathySupport telepathy-glib;
+  ] ++ lib.optional telepathySupport telepathy-glib;
 
   propagatedBuildInputs = [
     glib
@@ -105,7 +105,7 @@ stdenv.mkDerivation rec {
     };
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A library that aggregates people from multiple sources to create metacontacts";
     homepage = "https://wiki.gnome.org/Projects/Folks";
     license = licenses.lgpl2Plus;
diff --git a/pkgs/development/libraries/folly/default.nix b/pkgs/development/libraries/folly/default.nix
index 26680b2d23cb9..0ad4f2a50c150 100644
--- a/pkgs/development/libraries/folly/default.nix
+++ b/pkgs/development/libraries/folly/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , cmake
 , boost
@@ -52,7 +52,7 @@ stdenv.mkDerivation (rec {
 
   cmakeFlags = [ "-DBUILD_SHARED_LIBS=ON" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "An open-source C++ library developed and used at Facebook";
     homepage = "https://github.com/facebook/folly";
     license = licenses.asl20;
@@ -60,6 +60,6 @@ stdenv.mkDerivation (rec {
     platforms = [ "x86_64-linux" "x86_64-darwin" ];
     maintainers = with maintainers; [ abbradar pierreis ];
   };
-} // stdenv.lib.optionalAttrs stdenv.isDarwin {
+} // lib.optionalAttrs stdenv.isDarwin {
   LDFLAGS = "-ljemalloc";
 })
diff --git a/pkgs/development/libraries/fontconfig/default.nix b/pkgs/development/libraries/fontconfig/default.nix
index e08149903a2be..daedaefcf9c57 100644
--- a/pkgs/development/libraries/fontconfig/default.nix
+++ b/pkgs/development/libraries/fontconfig/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchpatch
 , substituteAll
 , fetchurl
@@ -85,7 +85,7 @@ stdenv.mkDerivation rec {
     "--with-cache-dir=/var/cache/fontconfig" # otherwise the fallback is in $out/
     # just <1MB; this is what you get when loading config fails for some reason
     "--with-default-fonts=${dejavu_fonts.minimal}"
-  ] ++ stdenv.lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
+  ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
     "--with-arch=${stdenv.hostPlatform.parsed.cpu.name}"
   ];
 
@@ -112,7 +112,7 @@ stdenv.mkDerivation rec {
     rm -r $bin/share/man/man3
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A library for font customization and configuration";
     homepage = "http://fontconfig.org/";
     license = licenses.bsd2; # custom but very bsd-like
diff --git a/pkgs/development/libraries/forge/default.nix b/pkgs/development/libraries/forge/default.nix
index aec790dd84311..ba85cea73d690 100644
--- a/pkgs/development/libraries/forge/default.nix
+++ b/pkgs/development/libraries/forge/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, pkg-config
+{ lib, stdenv, fetchFromGitHub, cmake, pkg-config
 , arrayfire, expat, fontconfig, freeimage, freetype, boost
 , mesa, libGLU, libGL, glfw3, SDL2, cudatoolkit
 }:
@@ -35,7 +35,7 @@ stdenv.mkDerivation rec {
     arrayfire
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "An OpenGL interop library that can be used with ArrayFire or any other application using CUDA or OpenCL compute backend";
     longDescription = ''
       An OpenGL interop library that can be used with ArrayFire or any other application using CUDA or OpenCL compute backend.
diff --git a/pkgs/development/libraries/fox/default.nix b/pkgs/development/libraries/fox/default.nix
index 5dacf53b259f8..408518ba79ce9 100644
--- a/pkgs/development/libraries/fox/default.nix
+++ b/pkgs/development/libraries/fox/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, xlibsWrapper, libpng, libjpeg, libtiff, zlib, bzip2, libXcursor, libXrandr, libXft
+{ lib, stdenv, fetchurl, xlibsWrapper, libpng, libjpeg, libtiff, zlib, bzip2, libXcursor, libXrandr, libXft
 , CoreServices ? null }:
 
 stdenv.mkDerivation rec {
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
   patches = [ ./clang.patch ];
 
   buildInputs = [ libpng xlibsWrapper libjpeg libtiff zlib bzip2 libXcursor libXrandr libXft ]
-    ++ stdenv.lib.optional stdenv.isDarwin CoreServices;
+    ++ lib.optional stdenv.isDarwin CoreServices;
 
   doCheck = true;
 
@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
 
   hardeningDisable = [ "format" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "C++ based class library for building Graphical User Interfaces";
     longDescription = ''
       FOX stands for Free Objects for X.
diff --git a/pkgs/development/libraries/fox/fox-1.6.nix b/pkgs/development/libraries/fox/fox-1.6.nix
index 208780a450ed1..50f9e688cb9fa 100644
--- a/pkgs/development/libraries/fox/fox-1.6.nix
+++ b/pkgs/development/libraries/fox/fox-1.6.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, xlibsWrapper, libpng, libjpeg, libtiff, zlib, bzip2, libXcursor
+{ lib, stdenv, fetchurl, xlibsWrapper, libpng, libjpeg, libtiff, zlib, bzip2, libXcursor
 , libXrandr, libGLU, libGL, libXft, libXfixes, xinput
 , CoreServices }:
 
@@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
   buildInputs = [
     xlibsWrapper libpng libjpeg libtiff zlib bzip2 libXcursor libXrandr
     libXft libGLU libGL libXfixes xinput
-  ] ++ stdenv.lib.optional stdenv.isDarwin CoreServices;
+  ] ++ lib.optional stdenv.isDarwin CoreServices;
 
   doCheck = true;
 
@@ -36,8 +36,8 @@ stdenv.mkDerivation rec {
         Current aims are to make FOX completely platform independent, and thus programs written against the FOX library will be only a compile away from running on a variety of platforms.
       '';
     homepage = "http://fox-toolkit.org";
-    license = stdenv.lib.licenses.lgpl3;
+    license = lib.licenses.lgpl3;
     maintainers = [];
-    platforms = stdenv.lib.platforms.mesaPlatforms;
+    platforms = lib.platforms.mesaPlatforms;
   };
 }
diff --git a/pkgs/development/libraries/fplll/20160331.nix b/pkgs/development/libraries/fplll/20160331.nix
index 05a6a30a6ec66..374aec5904d69 100644
--- a/pkgs/development/libraries/fplll/20160331.nix
+++ b/pkgs/development/libraries/fplll/20160331.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchFromGitHub, autoconf, automake, libtool, gettext, autoreconfHook
+{lib, stdenv, fetchFromGitHub, autoconf, automake, libtool, gettext, autoreconfHook
 , gmp, mpfr
 }:
 stdenv.mkDerivation rec {
@@ -15,8 +15,8 @@ stdenv.mkDerivation rec {
   meta = {
     inherit version;
     description = "Lattice algorithms using floating-point arithmetic";
-    license = stdenv.lib.licenses.lgpl21Plus;
-    maintainers = [stdenv.lib.maintainers.raskin];
-    platforms = stdenv.lib.platforms.linux;
+    license = lib.licenses.lgpl21Plus;
+    maintainers = [lib.maintainers.raskin];
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/development/libraries/fplll/default.nix b/pkgs/development/libraries/fplll/default.nix
index e15479bafcfa8..3a82b566a50f1 100644
--- a/pkgs/development/libraries/fplll/default.nix
+++ b/pkgs/development/libraries/fplll/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , fetchpatch
 , gettext
@@ -28,7 +28,7 @@ stdenv.mkDerivation rec {
     mpfr
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Lattice algorithms using floating-point arithmetic";
     changelog = [
       # Some release notes are added to the github tags, though they are not
diff --git a/pkgs/development/libraries/frame/default.nix b/pkgs/development/libraries/frame/default.nix
index 76549e728ebb6..e96aa9394da91 100644
--- a/pkgs/development/libraries/frame/default.nix
+++ b/pkgs/development/libraries/frame/default.nix
@@ -1,5 +1,5 @@
 { enableX11 ? true
-,  stdenv, fetchurl, pkg-config, xorg }:
+,  lib, stdenv, fetchurl, pkg-config, xorg }:
 
 stdenv.mkDerivation rec {
   pname = "frame";
@@ -11,14 +11,14 @@ stdenv.mkDerivation rec {
 
   buildInputs = [
     stdenv pkg-config
-  ] ++ stdenv.lib.optionals enableX11 [xorg.xorgserver xorg.libX11 xorg.libXext xorg.libXi];
+  ] ++ lib.optionals enableX11 [xorg.xorgserver xorg.libX11 xorg.libXext xorg.libXi];
 
-  configureFlags = stdenv.lib.optional enableX11 "--with-x11";
+  configureFlags = lib.optional enableX11 "--with-x11";
 
   meta = {
     homepage = "https://launchpad.net/frame";
     description = "Handles the buildup and synchronization of a set of simultaneous touches";
-    license = stdenv.lib.licenses.gpl3;
-    platforms = stdenv.lib.platforms.linux;
+    license = lib.licenses.gpl3;
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/development/libraries/freealut/default.nix b/pkgs/development/libraries/freealut/default.nix
index 2c9a893284be8..3bb6eaddfa366 100644
--- a/pkgs/development/libraries/freealut/default.nix
+++ b/pkgs/development/libraries/freealut/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, darwin, fetchurl, openal }:
+{ lib, stdenv, darwin, fetchurl, openal }:
 
 stdenv.mkDerivation rec {
   name = "freealut-1.1.0";
@@ -9,14 +9,14 @@ stdenv.mkDerivation rec {
   };
 
   buildInputs = [ openal
-  ] ++ stdenv.lib.optional stdenv.isDarwin
+  ] ++ lib.optional stdenv.isDarwin
     darwin.apple_sdk.frameworks.OpenAL
   ;
 
   meta = {
     homepage = "http://openal.org/";
     description = "Free implementation of OpenAL's ALUT standard";
-    license = stdenv.lib.licenses.lgpl2;
-    platforms = stdenv.lib.platforms.unix;
+    license = lib.licenses.lgpl2;
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/freeglut/default.nix b/pkgs/development/libraries/freeglut/default.nix
index bb61231d445b8..83e3eebdcc32c 100644
--- a/pkgs/development/libraries/freeglut/default.nix
+++ b/pkgs/development/libraries/freeglut/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, libXi, libXrandr, libXxf86vm, libGL, libGLU, xlibsWrapper, cmake }:
+{ lib, stdenv, fetchurl, libXi, libXrandr, libXxf86vm, libGL, libGLU, xlibsWrapper, cmake }:
 
 let version = "3.2.1";
 in stdenv.mkDerivation {
@@ -15,7 +15,7 @@ in stdenv.mkDerivation {
   nativeBuildInputs = [ cmake ];
   buildInputs = [ libXi libXrandr libXxf86vm libGL libGLU xlibsWrapper ];
 
-  cmakeFlags = stdenv.lib.optionals stdenv.isDarwin [
+  cmakeFlags = lib.optionals stdenv.isDarwin [
                  "-DOPENGL_INCLUDE_DIR=${libGL}/include"
                  "-DOPENGL_gl_LIBRARY:FILEPATH=${libGL}/lib/libGL.dylib"
                  "-DOPENGL_glu_LIBRARY:FILEPATH=${libGLU}/lib/libGLU.dylib"
@@ -23,7 +23,7 @@ in stdenv.mkDerivation {
                  "-DFREEGLUT_BUILD_STATIC:BOOL=OFF"
                ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Create and manage windows containing OpenGL contexts";
     longDescription = ''
       FreeGLUT is an open source alternative to the OpenGL Utility Toolkit
diff --git a/pkgs/development/libraries/freetds/default.nix b/pkgs/development/libraries/freetds/default.nix
index df26ac9978d55..8e6904a94b2f2 100644
--- a/pkgs/development/libraries/freetds/default.nix
+++ b/pkgs/development/libraries/freetds/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, autoreconfHook, pkg-config
+{ lib, stdenv, fetchurl, autoreconfHook, pkg-config
 , openssl
 , odbcSupport ? true, unixODBC ? null }:
 
@@ -17,11 +17,11 @@ stdenv.mkDerivation rec {
 
   buildInputs = [
     openssl
-  ] ++ stdenv.lib.optional odbcSupport unixODBC;
+  ] ++ lib.optional odbcSupport unixODBC;
 
   nativeBuildInputs = [ autoreconfHook pkg-config ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Libraries to natively talk to Microsoft SQL Server and Sybase databases";
     homepage    = "https://www.freetds.org";
     license     = licenses.lgpl2;
diff --git a/pkgs/development/libraries/freetype/default.nix b/pkgs/development/libraries/freetype/default.nix
index 4e4db4b844e53..7b5fff29a2864 100644
--- a/pkgs/development/libraries/freetype/default.nix
+++ b/pkgs/development/libraries/freetype/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl
+{ lib, stdenv, fetchurl
 , buildPackages
 , pkg-config, which, makeWrapper
 , zlib, bzip2, libpng, gnumake, glib
@@ -10,13 +10,13 @@
 }:
 
 let
-  inherit (stdenv.lib) optional optionalString;
+  inherit (lib) optional optionalString;
 
 in stdenv.mkDerivation rec {
   pname = "freetype";
   version = "2.10.4";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A font rendering engine";
     longDescription = ''
       FreeType is a portable and efficient library for rendering fonts. It
diff --git a/pkgs/development/libraries/frei0r/default.nix b/pkgs/development/libraries/frei0r/default.nix
index 8a0590419982c..c4f9934629648 100644
--- a/pkgs/development/libraries/frei0r/default.nix
+++ b/pkgs/development/libraries/frei0r/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, autoconf, cairo, opencv, pkg-config }:
+{ lib, stdenv, fetchurl, autoconf, cairo, opencv, pkg-config }:
 
 stdenv.mkDerivation rec {
   pname = "frei0r-plugins";
@@ -12,13 +12,13 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ autoconf pkg-config ];
   buildInputs = [ cairo opencv ];
 
-  postInstall = stdenv.lib.optionalString stdenv.hostPlatform.isDarwin ''
+  postInstall = lib.optionalString stdenv.hostPlatform.isDarwin ''
     for f in $out/lib/frei0r-1/*.so* ; do
       ln -s $f "''${f%.*}.dylib"
     done
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://frei0r.dyne.org";
     description = "Minimalist, cross-platform, shared video plugins";
     license = licenses.gpl2;
diff --git a/pkgs/development/libraries/fribidi/default.nix b/pkgs/development/libraries/fribidi/default.nix
index 0055811e185cc..27f3b825d10aa 100644
--- a/pkgs/development/libraries/fribidi/default.nix
+++ b/pkgs/development/libraries/fribidi/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , buildPackages
 , fetchurl
 , meson
@@ -25,14 +25,14 @@ stdenv.mkDerivation rec {
   '';
 
   nativeBuildInputs = [ meson ninja pkg-config ]
-    ++ stdenv.lib.optional stdenv.isDarwin fixDarwinDylibNames;
+    ++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
 
   depsBuildBuild = [ buildPackages.stdenv.cc ];
 
   doCheck = true;
   checkInputs = [ python3 ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/fribidi/fribidi";
     description = "GNU implementation of the Unicode Bidirectional Algorithm (bidi)";
     license = licenses.lgpl21;
diff --git a/pkgs/development/libraries/fstrcmp/default.nix b/pkgs/development/libraries/fstrcmp/default.nix
index 46b579d4abd83..c91e8517b0787 100644
--- a/pkgs/development/libraries/fstrcmp/default.nix
+++ b/pkgs/development/libraries/fstrcmp/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchzip, libtool, ghostscript, groff, autoreconfHook }:
+{ lib, stdenv, fetchzip, libtool, ghostscript, groff, autoreconfHook }:
 
 stdenv.mkDerivation rec {
   pname = "fstrcmp";
@@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Make fuzzy comparisons of strings and byte arrays";
     longDescription = ''
       The fstrcmp project provides a library that is used to make fuzzy
diff --git a/pkgs/development/libraries/fstrm/default.nix b/pkgs/development/libraries/fstrm/default.nix
index cd36af184b4a9..46a7118cefe43 100644
--- a/pkgs/development/libraries/fstrm/default.nix
+++ b/pkgs/development/libraries/fstrm/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, autoreconfHook, pkg-config, libevent, openssl }:
+{ lib, stdenv, fetchFromGitHub, autoreconfHook, pkg-config, libevent, openssl }:
 
 stdenv.mkDerivation rec {
   pname = "fstrm";
@@ -22,7 +22,7 @@ stdenv.mkDerivation rec {
 
   doCheck = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Frame Streams implementation in C";
     homepage = "https://github.com/farsightsec/fstrm";
     license = licenses.asl20;
diff --git a/pkgs/development/libraries/ftgl/default.nix b/pkgs/development/libraries/ftgl/default.nix
index a0ce9db815bc9..c3fd6ffb94075 100644
--- a/pkgs/development/libraries/ftgl/default.nix
+++ b/pkgs/development/libraries/ftgl/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, freetype, libGL, libGLU, OpenGL }:
+{ lib, stdenv, fetchurl, freetype, libGL, libGLU, OpenGL }:
 
 let
   name = "ftgl-2.1.3-rc5";
@@ -18,14 +18,14 @@ stdenv.mkDerivation {
       [ libGL libGLU ])
     ;
 
-  configureFlags = [ "--with-ft-prefix=${stdenv.lib.getDev freetype}" ];
+  configureFlags = [ "--with-ft-prefix=${lib.getDev freetype}" ];
 
   enableParallelBuilding = true;
 
   meta = {
     homepage = "https://sourceforge.net/apps/mediawiki/ftgl/";
     description = "Font rendering library for OpenGL applications";
-    license = stdenv.lib.licenses.gpl3Plus;
+    license = lib.licenses.gpl3Plus;
 
     longDescription = ''
       FTGL is a free cross-platform Open Source C++ library that uses
@@ -34,7 +34,7 @@ stdenv.mkDerivation {
       and extruded polygon rendering modes.
     '';
 
-    platforms = stdenv.lib.platforms.unix;
+    platforms = lib.platforms.unix;
     maintainers = [];
   };
 }
diff --git a/pkgs/development/libraries/funambol/default.nix b/pkgs/development/libraries/funambol/default.nix
index 064dbb39a2f97..377aa45cf5ecd 100644
--- a/pkgs/development/libraries/funambol/default.nix
+++ b/pkgs/development/libraries/funambol/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, zlib, curl, autoreconfHook, unzip }:
+{ lib, stdenv, fetchurl, zlib, curl, autoreconfHook, unzip }:
 
 stdenv.mkDerivation {
   name = "funambol-client-cpp-9.0.0";
@@ -14,7 +14,7 @@ stdenv.mkDerivation {
 
   nativeBuildInputs = [ autoreconfHook unzip ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "SyncML client sdk by Funambol project";
     homepage = "http://www.funambol.com";
     license = licenses.agpl3;
diff --git a/pkgs/development/libraries/galario/default.nix b/pkgs/development/libraries/galario/default.nix
index 84594b8dbeb97..888f26f2da7d8 100644
--- a/pkgs/development/libraries/galario/default.nix
+++ b/pkgs/development/libraries/galario/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchzip
 , fetchFromGitHub
 , cmake
@@ -30,17 +30,17 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ cmake ];
 
   buildInputs = [ fftw fftwFloat ]
-  ++ stdenv.lib.optional enablePython pythonPackages.python
-  ++ stdenv.lib.optional stdenv.isDarwin llvmPackages.openmp
+  ++ lib.optional enablePython pythonPackages.python
+  ++ lib.optional stdenv.isDarwin llvmPackages.openmp
   ;
 
-  propagatedBuildInputs = stdenv.lib.optional enablePython [
+  propagatedBuildInputs = lib.optional enablePython [
     pythonPackages.numpy
     pythonPackages.cython
     pythonPackages.pytest
   ];
 
-  checkInputs = stdenv.lib.optional enablePython [ pythonPackages.scipy pythonPackages.pytestcov ];
+  checkInputs = lib.optional enablePython [ pythonPackages.scipy pythonPackages.pytestcov ];
 
   preConfigure = ''
     mkdir -p build/external/src
@@ -55,12 +55,12 @@ stdenv.mkDerivation rec {
 
   doCheck = true;
 
-  postInstall = stdenv.lib.optionalString (stdenv.isDarwin && enablePython) ''
+  postInstall = lib.optionalString (stdenv.isDarwin && enablePython) ''
     install_name_tool -change libgalario.dylib $out/lib/libgalario.dylib $out/lib/python*/site-packages/galario/double/libcommon.so
     install_name_tool -change libgalario_single.dylib $out/lib/libgalario_single.dylib $out/lib/python*/site-packages/galario/single/libcommon.so
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "GPU Accelerated Library for Analysing Radio Interferometer Observations";
     longDescription = ''
       Galario is a library that exploits the computing power of modern
diff --git a/pkgs/development/libraries/gamenetworkingsockets/default.nix b/pkgs/development/libraries/gamenetworkingsockets/default.nix
index 5f2fdb8f749ac..0546bfb8e08ec 100644
--- a/pkgs/development/libraries/gamenetworkingsockets/default.nix
+++ b/pkgs/development/libraries/gamenetworkingsockets/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, ninja, go, protobuf, openssl }:
+{ lib, stdenv, fetchFromGitHub, cmake, ninja, go, protobuf, openssl }:
 
 stdenv.mkDerivation rec {
   pname = "GameNetworkingSockets";
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ protobuf openssl ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     # build failure is resolved on master, remove at next release
     broken = stdenv.isDarwin;
     description = "GameNetworkingSockets is a basic transport layer for games";
diff --git a/pkgs/development/libraries/gamin/default.nix b/pkgs/development/libraries/gamin/default.nix
index eb11bc6d72bb9..56de42d9dc5b5 100644
--- a/pkgs/development/libraries/gamin/default.nix
+++ b/pkgs/development/libraries/gamin/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, fetchpatch, pkg-config, glib, autoreconfHook }:
+{ lib, stdenv, fetchurl, fetchpatch, pkg-config, glib, autoreconfHook }:
 
 let
   cross = stdenv.hostPlatform != stdenv.buildPlatform;
@@ -24,15 +24,15 @@ in stdenv.mkDerivation (rec {
 
   patches = [ ./deadlock.patch ]
     ++ map fetchurl (import ./debian-patches.nix)
-    ++ stdenv.lib.optional stdenv.cc.isClang ./returnval.patch
-    ++ stdenv.lib.optional stdenv.hostPlatform.isMusl (fetchpatch {
+    ++ lib.optional stdenv.cc.isClang ./returnval.patch
+    ++ lib.optional stdenv.hostPlatform.isMusl (fetchpatch {
       name = "fix-pthread-mutex.patch";
       url = "https://git.alpinelinux.org/aports/plain/main/gamin/fix-pthread-mutex.patch?h=3.4-stable&id=a1a836b089573752c1b0da7d144c0948b04e8ea8";
       sha256 = "13igdbqsxb3sz0h417k6ifmq2n4siwqspj6slhc7fdl5wd1fxmdz";
-    }) ++ stdenv.lib.optional (cross) ./abstract-socket-namespace.patch ;
+    }) ++ lib.optional (cross) ./abstract-socket-namespace.patch ;
 
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage    = "https://people.gnome.org/~veillard/gamin/";
     description = "A file and directory monitoring system";
     maintainers = with maintainers; [ lovek323 ];
@@ -41,7 +41,7 @@ in stdenv.mkDerivation (rec {
   };
 }
 
-// stdenv.lib.optionalAttrs stdenv.isDarwin {
+// lib.optionalAttrs stdenv.isDarwin {
   preBuild =  ''
     sed -i 's/,--version-script=.*$/\\/' libgamin/Makefile
   '';
diff --git a/pkgs/development/libraries/ganv/default.nix b/pkgs/development/libraries/ganv/default.nix
index 130568460171b..bf6c030589b92 100644
--- a/pkgs/development/libraries/ganv/default.nix
+++ b/pkgs/development/libraries/ganv/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchgit, graphviz, gtk2, gtkmm2, pkg-config, python, wafHook }:
+{ lib, stdenv, fetchgit, graphviz, gtk2, gtkmm2, pkg-config, python, wafHook }:
 
 stdenv.mkDerivation rec {
   pname = "ganv";
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ pkg-config wafHook ];
   buildInputs = [ graphviz gtk2 gtkmm2 python ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "An interactive Gtk canvas widget for graph-based interfaces";
     homepage = "http://drobilla.net";
     license = licenses.gpl3;
diff --git a/pkgs/development/libraries/garmintools/default.nix b/pkgs/development/libraries/garmintools/default.nix
index 97449d944ec3d..424e3751f407d 100644
--- a/pkgs/development/libraries/garmintools/default.nix
+++ b/pkgs/development/libraries/garmintools/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, libusb-compat-0_1 }:
+{ lib, stdenv, fetchurl, libusb-compat-0_1 }:
 stdenv.mkDerivation {
   name = "garmintools-0.10";
   src = fetchurl {
@@ -9,8 +9,8 @@ stdenv.mkDerivation {
   meta = {
     description = "Provides the ability to communicate with the Garmin Forerunner 305 via the USB interface";
     homepage = "https://code.google.com/archive/p/garmintools/"; # community clone at https://github.com/ianmartin/garmintools
-    license = stdenv.lib.licenses.gpl2;
+    license = lib.licenses.gpl2;
     maintainers = [ ];
-    platforms = stdenv.lib.platforms.unix;
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/gbenchmark/default.nix b/pkgs/development/libraries/gbenchmark/default.nix
index ab6a379116d53..c1f485e18d9b2 100644
--- a/pkgs/development/libraries/gbenchmark/default.nix
+++ b/pkgs/development/libraries/gbenchmark/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, gtest }:
+{ lib, stdenv, fetchFromGitHub, cmake, gtest }:
 
 stdenv.mkDerivation rec {
   pname = "gbenchmark";
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
 
   doCheck = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A microbenchmark support library";
     homepage = "https://github.com/google/benchmark";
     license = licenses.asl20;
diff --git a/pkgs/development/libraries/gcab/default.nix b/pkgs/development/libraries/gcab/default.nix
index 9d9e6cd1c156e..8f62483d3b722 100644
--- a/pkgs/development/libraries/gcab/default.nix
+++ b/pkgs/development/libraries/gcab/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , gettext
 , gobject-introspection
@@ -23,7 +23,7 @@ stdenv.mkDerivation rec {
   outputs = [ "bin" "out" "dev" "devdoc" "installedTests" ];
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "13q43iqld4l50yra45lhvkd376pn6qpk7rkx374zn8y9wsdzm9b7";
   };
 
@@ -73,7 +73,7 @@ stdenv.mkDerivation rec {
     };
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "GObject library to create cabinet files";
     homepage = "https://gitlab.gnome.org/GNOME/gcab";
     license = licenses.lgpl21Plus;
diff --git a/pkgs/development/libraries/gcc/libstdc++/5.nix b/pkgs/development/libraries/gcc/libstdc++/5.nix
index 486a24defd1b5..b123f799ccaa5 100644
--- a/pkgs/development/libraries/gcc/libstdc++/5.nix
+++ b/pkgs/development/libraries/gcc/libstdc++/5.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, fetchpatch, flex, bison, file }:
+{ lib, stdenv, fetchurl, fetchpatch, flex, bison, file }:
 
 stdenv.mkDerivation rec {
   pname = "libstdc++5";
@@ -107,7 +107,7 @@ stdenv.mkDerivation rec {
     rm -rf $out/lib/!(libstdc++*)
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://gcc.gnu.org/";
     license = licenses.lgpl3Plus;
     description = "GNU Compiler Collection, version ${version} -- C++ standard library";
diff --git a/pkgs/development/libraries/gcr/default.nix b/pkgs/development/libraries/gcr/default.nix
index a2eea019400fb..8add81e27969b 100644
--- a/pkgs/development/libraries/gcr/default.nix
+++ b/pkgs/development/libraries/gcr/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , pkg-config
 , meson
@@ -25,7 +25,7 @@ stdenv.mkDerivation rec {
   version = "3.38.0";
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "1q97pba4bzjndm1vlvicyv8mrl0n589qsw71dp8jrz2payvcfk56";
   };
 
@@ -87,7 +87,7 @@ stdenv.mkDerivation rec {
     };
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     platforms = platforms.linux;
     maintainers = teams.gnome.members;
     description = "GNOME crypto services (daemon and tools)";
diff --git a/pkgs/development/libraries/gd/default.nix b/pkgs/development/libraries/gd/default.nix
index 3b4533890a769..36a9309560335 100644
--- a/pkgs/development/libraries/gd/default.nix
+++ b/pkgs/development/libraries/gd/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, fetchpatch
+{ lib, stdenv, fetchurl, fetchpatch
 , autoconf
 , automake
 , pkg-config
@@ -37,7 +37,7 @@ stdenv.mkDerivation rec {
   ];
 
   # -pthread gets passed to clang, causing warnings
-  configureFlags = stdenv.lib.optional stdenv.isDarwin "--enable-werror=no";
+  configureFlags = lib.optional stdenv.isDarwin "--enable-werror=no";
 
   nativeBuildInputs = [ autoconf automake pkg-config ];
 
@@ -52,7 +52,7 @@ stdenv.mkDerivation rec {
 
   doCheck = false; # fails 2 tests
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://libgd.github.io/";
     description = "A dynamic image creation library";
     license = licenses.free; # some custom license
diff --git a/pkgs/development/libraries/gdal/2.4.0.nix b/pkgs/development/libraries/gdal/2.4.0.nix
index d3505679e4d0b..9cb9c448c1d21 100644
--- a/pkgs/development/libraries/gdal/2.4.0.nix
+++ b/pkgs/development/libraries/gdal/2.4.0.nix
@@ -1,11 +1,11 @@
-{ stdenv, fetchurl, fetchpatch, unzip, libjpeg, libtiff, zlib
+{ lib, stdenv, fetchurl, fetchpatch, unzip, libjpeg, libtiff, zlib
 , postgresql, libmysqlclient, libgeotiff, pythonPackages, proj, geos, openssl
 , libpng, sqlite, libspatialite, poppler, hdf4, qhull, giflib, expat
 , libiconv, libxml2
 , netcdfSupport ? true, netcdf, hdf5, curl
 }:
 
-with stdenv.lib;
+with lib;
 
 stdenv.mkDerivation rec {
   pname = "gdal";
@@ -28,8 +28,8 @@ stdenv.mkDerivation rec {
   buildInputs = [ unzip libjpeg libtiff libgeotiff libpng proj openssl sqlite
     libspatialite poppler hdf4 qhull giflib expat libxml2 proj ]
   ++ (with pythonPackages; [ python numpy wrapPython ])
-  ++ stdenv.lib.optional stdenv.isDarwin libiconv
-  ++ stdenv.lib.optionals netcdfSupport [ netcdf hdf5 curl ];
+  ++ lib.optional stdenv.isDarwin libiconv
+  ++ lib.optionals netcdfSupport [ netcdf hdf5 curl ];
 
   configureFlags = [
     "--with-expat=${expat.dev}"
@@ -97,8 +97,8 @@ stdenv.mkDerivation rec {
   meta = {
     description = "Translator library for raster geospatial data formats";
     homepage = "https://www.gdal.org/";
-    license = stdenv.lib.licenses.mit;
-    maintainers = [ stdenv.lib.maintainers.marcweber ];
-    platforms = with stdenv.lib.platforms; linux ++ darwin;
+    license = lib.licenses.mit;
+    maintainers = [ lib.maintainers.marcweber ];
+    platforms = with lib.platforms; linux ++ darwin;
   };
 }
diff --git a/pkgs/development/libraries/gdal/default.nix b/pkgs/development/libraries/gdal/default.nix
index 1295a10023286..8c02919126ba6 100644
--- a/pkgs/development/libraries/gdal/default.nix
+++ b/pkgs/development/libraries/gdal/default.nix
@@ -1,9 +1,9 @@
-{ stdenv, fetchFromGitHub, fetchpatch, unzip, libjpeg, libtiff, zlib, postgresql
+{ lib, stdenv, fetchFromGitHub, fetchpatch, unzip, libjpeg, libtiff, zlib, postgresql
 , libmysqlclient, libgeotiff, pythonPackages, proj, geos, openssl, libpng
 , sqlite, libspatialite, poppler, hdf4, qhull, giflib, expat, libiconv, libxml2
 , autoreconfHook, netcdfSupport ? true, netcdf, hdf5, curl, pkg-config }:
 
-with stdenv.lib;
+with lib;
 
 stdenv.mkDerivation rec {
   pname = "gdal";
@@ -39,8 +39,8 @@ stdenv.mkDerivation rec {
     libxml2
     postgresql
   ] ++ (with pythonPackages; [ python numpy wrapPython ])
-    ++ stdenv.lib.optional stdenv.isDarwin libiconv
-    ++ stdenv.lib.optionals netcdfSupport [ netcdf hdf5 curl ];
+    ++ lib.optional stdenv.isDarwin libiconv
+    ++ lib.optionals netcdfSupport [ netcdf hdf5 curl ];
 
   configureFlags = [
     "--with-expat=${expat.dev}"
@@ -87,8 +87,8 @@ stdenv.mkDerivation rec {
   meta = {
     description = "Translator library for raster geospatial data formats";
     homepage = "https://www.gdal.org/";
-    license = stdenv.lib.licenses.mit;
-    maintainers = [ stdenv.lib.maintainers.marcweber ];
-    platforms = with stdenv.lib.platforms; linux ++ darwin;
+    license = lib.licenses.mit;
+    maintainers = [ lib.maintainers.marcweber ];
+    platforms = with lib.platforms; linux ++ darwin;
   };
 }
diff --git a/pkgs/development/libraries/gdal/gdal-1_11.nix b/pkgs/development/libraries/gdal/gdal-1_11.nix
index 3695407b8f2f2..92d17452c9413 100644
--- a/pkgs/development/libraries/gdal/gdal-1_11.nix
+++ b/pkgs/development/libraries/gdal/gdal-1_11.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, unzip, libjpeg, libtiff, zlib
+{ lib, stdenv, fetchurl, unzip, libjpeg, libtiff, zlib
 , postgresql, mysql57, libgeotiff, python, pythonPackages, proj, geos, openssl
 , libpng }:
 
@@ -59,8 +59,8 @@ stdenv.mkDerivation rec {
   meta = {
     description = "Translator library for raster geospatial data formats";
     homepage = "https://www.gdal.org/";
-    license = stdenv.lib.licenses.mit;
-    maintainers = [ stdenv.lib.maintainers.marcweber ];
-    platforms = with stdenv.lib.platforms; linux ++ darwin;
+    license = lib.licenses.mit;
+    maintainers = [ lib.maintainers.marcweber ];
+    platforms = with lib.platforms; linux ++ darwin;
   };
 }
diff --git a/pkgs/development/libraries/gdata-sharp/default.nix b/pkgs/development/libraries/gdata-sharp/default.nix
index 22034733f5e3b..21cb79ba81584 100644
--- a/pkgs/development/libraries/gdata-sharp/default.nix
+++ b/pkgs/development/libraries/gdata-sharp/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchsvn, pkg-config, mono, dotnetPackages }:
+{ lib, stdenv, fetchsvn, pkg-config, mono, dotnetPackages }:
 
 let
   newtonsoft-json = dotnetPackages.NewtonsoftJson;
@@ -26,7 +26,7 @@ in stdenv.mkDerivation {
 
   makeFlags = [ "PREFIX=$(out)" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://code.google.com/archive/p/google-gdata/";
 
     description = "The Google Data APIs";
diff --git a/pkgs/development/libraries/gdcm/default.nix b/pkgs/development/libraries/gdcm/default.nix
index b04828c92dde6..75ce95e0e46bb 100644
--- a/pkgs/development/libraries/gdcm/default.nix
+++ b/pkgs/development/libraries/gdcm/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, cmake, vtk_7, darwin
+{ lib, stdenv, fetchurl, cmake, vtk_7, darwin
 , enablePython ? false, python ? null,  swig ? null}:
 
 stdenv.mkDerivation rec {
@@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
     "-DGDCM_BUILD_SHARED_LIBS=ON"
     "-DGDCM_USE_VTK=ON"
   ]
-  ++ stdenv.lib.optional enablePython [
+  ++ lib.optional enablePython [
     "-DGDCM_WRAP_PYTHON:BOOL=ON"
     "-DGDCM_INSTALL_PYTHONMODULE_DIR=${placeholder "out"}/${python.sitePackages}"
   ];
@@ -30,13 +30,13 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ cmake ];
   buildInputs = [ vtk_7 ]
-    ++ stdenv.lib.optional stdenv.isDarwin [
+    ++ lib.optional stdenv.isDarwin [
       darwin.apple_sdk.frameworks.ApplicationServices
       darwin.apple_sdk.frameworks.Cocoa
-    ] ++ stdenv.lib.optional enablePython [ swig python ];
+    ] ++ lib.optional enablePython [ swig python ];
   propagatedBuildInputs = [ ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "The grassroots cross-platform DICOM implementation";
     longDescription = ''
       Grassroots DICOM (GDCM) is an implementation of the DICOM standard designed to be open source so that researchers may access clinical data directly.
diff --git a/pkgs/development/libraries/gdk-pixbuf/default.nix b/pkgs/development/libraries/gdk-pixbuf/default.nix
index ad92bf13c4ce9..2d8e60d06a735 100644
--- a/pkgs/development/libraries/gdk-pixbuf/default.nix
+++ b/pkgs/development/libraries/gdk-pixbuf/default.nix
@@ -30,7 +30,7 @@ stdenv.mkDerivation rec {
   outputs = [ "out" "dev" "man" "devdoc" "installedTests" ];
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "05ggmzwvrxq9w4zcvmrnnd6qplsmb4n95lj4q607c7arzlf6mil3";
   };
 
@@ -53,7 +53,7 @@ stdenv.mkDerivation rec {
     gobject-introspection
     makeWrapper
     glib
-  ] ++ stdenv.lib.optional stdenv.isDarwin fixDarwinDylibNames;
+  ] ++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
 
   propagatedBuildInputs = [
     glib
@@ -78,7 +78,7 @@ stdenv.mkDerivation rec {
   postInstall =
     # meson erroneously installs loaders with .dylib extension on Darwin.
     # Their @rpath has to be replaced before gdk-pixbuf-query-loaders looks at them.
-    stdenv.lib.optionalString stdenv.isDarwin ''
+    lib.optionalString stdenv.isDarwin ''
       for f in $out/${passthru.moduleDir}/*.dylib; do
           install_name_tool -change @rpath/libgdk_pixbuf-2.0.0.dylib $out/lib/libgdk_pixbuf-2.0.0.dylib $f
           mv $f ''${f%.dylib}.so
@@ -88,13 +88,13 @@ stdenv.mkDerivation rec {
     + ''
       moveToOutput "bin" "$dev"
       moveToOutput "bin/gdk-pixbuf-thumbnailer" "$out"
-    '' + stdenv.lib.optionalString (stdenv.hostPlatform == stdenv.buildPlatform) ''
+    '' + lib.optionalString (stdenv.hostPlatform == stdenv.buildPlatform) ''
       # We need to install 'loaders.cache' in lib/gdk-pixbuf-2.0/2.10.0/
       $dev/bin/gdk-pixbuf-query-loaders --update-cache
     '';
 
   # The fixDarwinDylibNames hook doesn't patch binaries.
-  preFixup = stdenv.lib.optionalString stdenv.isDarwin ''
+  preFixup = lib.optionalString stdenv.isDarwin ''
     for f in $out/bin/* $dev/bin/*; do
         install_name_tool -change @rpath/libgdk_pixbuf-2.0.0.dylib $out/lib/libgdk_pixbuf-2.0.0.dylib $f
     done
@@ -124,7 +124,7 @@ stdenv.mkDerivation rec {
     moduleDir = "lib/gdk-pixbuf-2.0/2.10.0/loaders";
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A library for image loading and manipulation";
     homepage = "https://gitlab.gnome.org/GNOME/gdk-pixbuf";
     maintainers = [ maintainers.eelco ] ++ teams.gnome.members;
diff --git a/pkgs/development/libraries/gdk-pixbuf/xlib.nix b/pkgs/development/libraries/gdk-pixbuf/xlib.nix
index edc5ce5256352..bc4c14beb4587 100644
--- a/pkgs/development/libraries/gdk-pixbuf/xlib.nix
+++ b/pkgs/development/libraries/gdk-pixbuf/xlib.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitLab
 , meson
 , ninja
@@ -42,7 +42,7 @@ stdenv.mkDerivation rec {
     "-Dgtk_doc=true"
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Deprecated API for integrating GdkPixbuf with Xlib data types";
     homepage = "https://gitlab.gnome.org/Archive/gdk-pixbuf-xlib";
     maintainers = teams.gnome.members;
diff --git a/pkgs/development/libraries/gdl/default.nix b/pkgs/development/libraries/gdl/default.nix
index 7b3d1d4e831ce..f924571deae1c 100644
--- a/pkgs/development/libraries/gdl/default.nix
+++ b/pkgs/development/libraries/gdl/default.nix
@@ -1,11 +1,11 @@
-{ stdenv, fetchurl, pkg-config, libxml2, gtk3, gnome3, intltool }:
+{ lib, stdenv, fetchurl, pkg-config, libxml2, gtk3, gnome3, intltool }:
 
 stdenv.mkDerivation rec {
   pname = "gdl";
   version = "3.34.0";
 
   src = fetchurl {
-    url = "mirror://gnome/sources/gdl/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/gdl/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "00ldva6wg6s4wlxmisiqzyz8ihsprra7sninx2rlqk6frpq312w5";
   };
 
@@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
     };
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Gnome docking library";
     homepage = "https://developer.gnome.org/gdl/";
     maintainers = teams.gnome.members;
diff --git a/pkgs/development/libraries/gdome2/default.nix b/pkgs/development/libraries/gdome2/default.nix
index ec0621c5a3d5e..a7dd1f980138c 100644
--- a/pkgs/development/libraries/gdome2/default.nix
+++ b/pkgs/development/libraries/gdome2/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, pkg-config, glib, libxml2, gtk-doc}:
+{lib, stdenv, fetchurl, pkg-config, glib, libxml2, gtk-doc}:
 
 let
   pname = "gdome2";
@@ -20,7 +20,7 @@ stdenv.mkDerivation {
   propagatedBuildInputs = [glib libxml2];
   patches = [ ./xml-document.patch ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://gdome2.cs.unibo.it/";
     description = "DOM C library developed for the Gnome project";
     license = licenses.lgpl21Plus;
diff --git a/pkgs/development/libraries/gecode/3.nix b/pkgs/development/libraries/gecode/3.nix
index 545bdd12982e5..5c660a99ef843 100644
--- a/pkgs/development/libraries/gecode/3.nix
+++ b/pkgs/development/libraries/gecode/3.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, bash, perl }:
+{ lib, stdenv, fetchurl, bash, perl }:
 
 stdenv.mkDerivation rec {
   pname = "gecode";
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
 
   preConfigure = "patchShebangs configure";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     license = licenses.mit;
     homepage = "https://www.gecode.org";
     description = "Toolkit for developing constraint-based systems";
diff --git a/pkgs/development/libraries/gecode/default.nix b/pkgs/development/libraries/gecode/default.nix
index 9d37199bff47e..46b13e6e37f53 100644
--- a/pkgs/development/libraries/gecode/default.nix
+++ b/pkgs/development/libraries/gecode/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, bison, flex, perl, gmp, mpfr, enableGist ? true, qtbase }:
+{ lib, stdenv, fetchFromGitHub, bison, flex, perl, gmp, mpfr, enableGist ? true, qtbase }:
 
 stdenv.mkDerivation rec {
   pname = "gecode";
@@ -14,9 +14,9 @@ stdenv.mkDerivation rec {
   enableParallelBuilding = true;
   nativeBuildInputs = [ bison flex ];
   buildInputs = [ perl gmp mpfr ]
-    ++ stdenv.lib.optional enableGist qtbase;
+    ++ lib.optional enableGist qtbase;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     license = licenses.mit;
     homepage = "https://www.gecode.org";
     description = "Toolkit for developing constraint-based systems";
diff --git a/pkgs/development/libraries/gegl/4.0.nix b/pkgs/development/libraries/gegl/4.0.nix
index 4852db0dac3f4..af3c9d84ac7c4 100644
--- a/pkgs/development/libraries/gegl/4.0.nix
+++ b/pkgs/development/libraries/gegl/4.0.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , fetchpatch
 , pkg-config
@@ -41,7 +41,7 @@ stdenv.mkDerivation rec {
   outputBin = "dev";
 
   src = fetchurl {
-    url = "https://download.gimp.org/pub/gegl/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "https://download.gimp.org/pub/gegl/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "sha256-DzceLtK5IWL+/T3edD5kjKCKahsrBQBIZ/vdx+IR5CQ=";
   };
 
@@ -84,7 +84,7 @@ stdenv.mkDerivation rec {
     luajit
     openexr
     suitesparse
-  ] ++ stdenv.lib.optional stdenv.isDarwin OpenCL;
+  ] ++ lib.optional stdenv.isDarwin OpenCL;
 
   # for gegl-4.0.pc
   propagatedBuildInputs = [
@@ -118,7 +118,7 @@ stdenv.mkDerivation rec {
   # tests fail to connect to the com.apple.fonts daemon in sandboxed mode
   doCheck = !stdenv.isDarwin;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Graph-based image processing framework";
     homepage = "https://www.gegl.org";
     license = licenses.lgpl3Plus;
diff --git a/pkgs/development/libraries/gegl/default.nix b/pkgs/development/libraries/gegl/default.nix
index 93adb49d8b704..bd67f3e6b7ca1 100644
--- a/pkgs/development/libraries/gegl/default.nix
+++ b/pkgs/development/libraries/gegl/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , pkg-config
 , babl
@@ -33,13 +33,13 @@ stdenv.mkDerivation rec {
   configureFlags = [ "--disable-docs" ];
 
   buildInputs = [ babl libpng cairo libjpeg librsvg pango gtk2 bzip2 intltool libintl ]
-    ++ stdenv.lib.optional stdenv.isDarwin OpenGL;
+    ++ lib.optional stdenv.isDarwin OpenGL;
 
   nativeBuildInputs = [ pkg-config ];
 
   doCheck = false; # fails 3 out of 19 tests
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Graph-based image processing framework";
     homepage = "https://www.gegl.org";
     license = licenses.lgpl3Plus;
diff --git a/pkgs/development/libraries/geis/default.nix b/pkgs/development/libraries/geis/default.nix
index b7623d15dd4e9..1c1d4cfe507b3 100644
--- a/pkgs/development/libraries/geis/default.nix
+++ b/pkgs/development/libraries/geis/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl
+{ lib, stdenv, fetchurl
 , pkg-config
 , python3Packages
 , wrapGAppsHook
@@ -18,7 +18,7 @@
 , xorgserver
 }:
 
-with stdenv.lib;
+with lib;
 
 stdenv.mkDerivation rec {
   pname = "geis";
diff --git a/pkgs/development/libraries/genann/default.nix b/pkgs/development/libraries/genann/default.nix
index 6529d4f363d88..f1d7373183abf 100644
--- a/pkgs/development/libraries/genann/default.nix
+++ b/pkgs/development/libraries/genann/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub }:
+{ lib, stdenv, fetchFromGitHub }:
 
 stdenv.mkDerivation rec {
   pname = "genann";
@@ -24,7 +24,7 @@ stdenv.mkDerivation rec {
     cp ./genann.{h,c} $out/include
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/codeplea/genann";
     description = "Simple neural network library in ANSI C";
     license = licenses.zlib;
diff --git a/pkgs/development/libraries/geoclue/default.nix b/pkgs/development/libraries/geoclue/default.nix
index 8e54c6c43b092..711f1a444b388 100644
--- a/pkgs/development/libraries/geoclue/default.nix
+++ b/pkgs/development/libraries/geoclue/default.nix
@@ -1,9 +1,9 @@
-{ stdenv, fetchFromGitLab, intltool, meson, ninja, pkg-config, gtk-doc, docbook_xsl, docbook_xml_dtd_412, glib, json-glib, libsoup, libnotify, gdk-pixbuf
+{ lib, stdenv, fetchFromGitLab, intltool, meson, ninja, pkg-config, gtk-doc, docbook_xsl, docbook_xml_dtd_412, glib, json-glib, libsoup, libnotify, gdk-pixbuf
 , modemmanager, avahi, glib-networking, python3, wrapGAppsHook, gobject-introspection, vala
 , withDemoAgent ? false
 }:
 
-with stdenv.lib;
+with lib;
 
 stdenv.mkDerivation rec {
   pname = "geoclue";
@@ -56,7 +56,7 @@ stdenv.mkDerivation rec {
     patchShebangs demo/install-file.py
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Geolocation framework and some data providers";
     homepage = "https://gitlab.freedesktop.org/geoclue/geoclue/wikis/home";
     maintainers = with maintainers; [ raskin ];
diff --git a/pkgs/development/libraries/geocode-glib/default.nix b/pkgs/development/libraries/geocode-glib/default.nix
index a13cbdfc15952..f401c25aa3942 100644
--- a/pkgs/development/libraries/geocode-glib/default.nix
+++ b/pkgs/development/libraries/geocode-glib/default.nix
@@ -1,4 +1,4 @@
-{ fetchurl, stdenv, meson, ninja, pkg-config, gettext, gtk-doc, docbook_xsl, gobject-introspection, gnome3, libsoup, json-glib, glib }:
+{ fetchurl, lib, stdenv, meson, ninja, pkg-config, gettext, gtk-doc, docbook_xsl, gobject-introspection, gnome3, libsoup, json-glib, glib }:
 
 stdenv.mkDerivation rec {
   pname = "geocode-glib";
@@ -7,7 +7,7 @@ stdenv.mkDerivation rec {
   outputs = [ "out" "dev" "devdoc" "installedTests" ];
 
   src = fetchurl {
-    url = "mirror://gnome/sources/geocode-glib/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/geocode-glib/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "1l8g0f13xgkrk335afr9w8k46mziwb2jnyhl07jccl5yl37q9zh1";
   };
 
@@ -28,7 +28,7 @@ stdenv.mkDerivation rec {
     };
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A convenience library for the geocoding and reverse geocoding using Nominatim service";
     license = licenses.lgpl2Plus;
     maintainers = teams.gnome.members;
diff --git a/pkgs/development/libraries/geoip/default.nix b/pkgs/development/libraries/geoip/default.nix
index d55983952b8c3..8747433047c66 100644
--- a/pkgs/development/libraries/geoip/default.nix
+++ b/pkgs/development/libraries/geoip/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, autoreconfHook
+{ lib, stdenv, fetchFromGitHub, autoreconfHook
 , drvName ? "geoip"
 
 # in geoipDatabase, you can insert a package defining
@@ -7,7 +7,7 @@
 }:
 
 let
-  dataDir = if stdenv.lib.isDerivation geoipDatabase
+  dataDir = if lib.isDerivation geoipDatabase
     then "${toString geoipDatabase}/share/GeoIP"
     else geoipDatabase;
 in
@@ -25,7 +25,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ autoreconfHook ];
 
   # Cross compilation shenanigans
-  configureFlags = stdenv.lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
+  configureFlags = lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
     "ac_cv_func_malloc_0_nonnull=yes"
     "ac_cv_func_realloc_0_nonnull=yes"
   ];
@@ -35,7 +35,7 @@ stdenv.mkDerivation rec {
     find . -name Makefile.in -exec sed -i -r 's#^pkgdatadir\s*=.+$#pkgdatadir = ${dataDir}#' {} \;
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "An API for GeoIP/Geolocation databases";
     maintainers = with maintainers; [ thoughtpolice raskin ];
     license     = licenses.lgpl21;
diff --git a/pkgs/development/libraries/geos/default.nix b/pkgs/development/libraries/geos/default.nix
index 60fc4067c0c53..63806b31e251d 100644
--- a/pkgs/development/libraries/geos/default.nix
+++ b/pkgs/development/libraries/geos/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, python }:
+{ lib, stdenv, fetchurl, python }:
 
 stdenv.mkDerivation rec {
   name = "geos-3.8.1";
@@ -13,9 +13,9 @@ stdenv.mkDerivation rec {
   buildInputs = [ python ];
 
   # https://trac.osgeo.org/geos/ticket/993
-  configureFlags = stdenv.lib.optional stdenv.isAarch32 "--disable-inline";
+  configureFlags = lib.optional stdenv.isAarch32 "--disable-inline";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "C++ port of the Java Topology Suite (JTS)";
     homepage = "https://trac.osgeo.org/geos";
     license = licenses.lgpl21;
diff --git a/pkgs/development/libraries/getdata/default.nix b/pkgs/development/libraries/getdata/default.nix
index 28bbe61d53d80..de76924844fe6 100644
--- a/pkgs/development/libraries/getdata/default.nix
+++ b/pkgs/development/libraries/getdata/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, libtool }:
+{ lib, stdenv, fetchurl, libtool }:
 stdenv.mkDerivation rec {
   pname = "getdata";
   version = "0.10.0";
@@ -9,7 +9,7 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ libtool ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Reference implementation of the Dirfile Standards";
     license = licenses.lgpl21Plus;
     platforms = platforms.all;
diff --git a/pkgs/development/libraries/getdns/default.nix b/pkgs/development/libraries/getdns/default.nix
index c0268c161aebf..edf0ac27ea97c 100644
--- a/pkgs/development/libraries/getdns/default.nix
+++ b/pkgs/development/libraries/getdns/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, unbound, libidn2, openssl, doxygen, cmake }:
+{ lib, stdenv, fetchurl, unbound, libidn2, openssl, doxygen, cmake }:
 
 stdenv.mkDerivation rec {
   pname = "getdns";
@@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ unbound libidn2 openssl doxygen ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A modern asynchronous DNS API";
     longDescription = ''
       getdns is an implementation of a modern asynchronous DNS API; the
diff --git a/pkgs/development/libraries/gettext/default.nix b/pkgs/development/libraries/gettext/default.nix
index 0dcc42dc526a9..3f8215d19fc28 100644
--- a/pkgs/development/libraries/gettext/default.nix
+++ b/pkgs/development/libraries/gettext/default.nix
@@ -25,7 +25,7 @@ stdenv.mkDerivation rec {
 
   configureFlags = [
      "--disable-csharp" "--with-xz"
-  ] ++ stdenv.lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
+  ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
     # On cross building, gettext supposes that the wchar.h from libc
     # does not fulfill gettext needs, so it tries to work with its
     # own wchar.h file, which does not cope well with the system's
@@ -48,7 +48,7 @@ stdenv.mkDerivation rec {
     xz.bin
   ];
   # HACK, see #10874 (and 14664)
-  buildInputs = stdenv.lib.optional (!stdenv.isLinux && !stdenv.hostPlatform.isCygwin) libiconv;
+  buildInputs = lib.optional (!stdenv.isLinux && !stdenv.hostPlatform.isCygwin) libiconv;
 
   setupHooks = [
     ../../../build-support/setup-hooks/role.bash
@@ -89,6 +89,6 @@ stdenv.mkDerivation rec {
   };
 }
 
-// stdenv.lib.optionalAttrs stdenv.isDarwin {
+// lib.optionalAttrs stdenv.isDarwin {
   makeFlags = [ "CFLAGS=-D_FORTIFY_SOURCE=0" ];
 }
diff --git a/pkgs/development/libraries/gexiv2/default.nix b/pkgs/development/libraries/gexiv2/default.nix
index b9d287ba2eb2e..220b68fa18bc5 100644
--- a/pkgs/development/libraries/gexiv2/default.nix
+++ b/pkgs/development/libraries/gexiv2/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, meson, ninja, pkg-config, exiv2, glib, gnome3, gobject-introspection, vala, gtk-doc, docbook_xsl, docbook_xml_dtd_43 }:
+{ lib, stdenv, fetchurl, meson, ninja, pkg-config, exiv2, glib, gnome3, gobject-introspection, vala, gtk-doc, docbook_xsl, docbook_xml_dtd_43 }:
 
 stdenv.mkDerivation rec {
   pname = "gexiv2";
@@ -7,7 +7,7 @@ stdenv.mkDerivation rec {
   outputs = [ "out" "dev" "devdoc" ];
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "0xxxq8xdkgkn146my307jgws4qgxx477h0ybg1mqza1ycmczvsla";
   };
 
@@ -27,7 +27,7 @@ stdenv.mkDerivation rec {
     };
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://wiki.gnome.org/Projects/gexiv2";
     description = "GObject wrapper around the Exiv2 photo metadata library";
     license = licenses.gpl2;
diff --git a/pkgs/development/libraries/gfbgraph/default.nix b/pkgs/development/libraries/gfbgraph/default.nix
index 93286e85d12c1..e3550b82a965e 100644
--- a/pkgs/development/libraries/gfbgraph/default.nix
+++ b/pkgs/development/libraries/gfbgraph/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, glib, librest, gnome-online-accounts
+{ lib, stdenv, fetchurl, pkg-config, glib, librest, gnome-online-accounts
 , gnome3, libsoup, json-glib, gobject-introspection
 , gtk-doc, pkgs, docbook-xsl-nons, autoconf, automake, libtool }:
 
@@ -9,7 +9,7 @@ stdenv.mkDerivation rec {
   outputs = [ "out" "dev" "devdoc" ];
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "0yck7dwvjk16a52nafjpi0a39rxwmg0w833brj45acz76lgkjrb0";
   };
 
@@ -40,7 +40,7 @@ stdenv.mkDerivation rec {
     };
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://wiki.gnome.org/Projects/GFBGraph";
     description = "GLib/GObject wrapper for the Facebook Graph API";
     maintainers = teams.gnome.members;
diff --git a/pkgs/development/libraries/gflags/default.nix b/pkgs/development/libraries/gflags/default.nix
index 51c13f974336b..a690d8f2e1540 100644
--- a/pkgs/development/libraries/gflags/default.nix
+++ b/pkgs/development/libraries/gflags/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake
+{ lib, stdenv, fetchFromGitHub, cmake
 , enableShared ? !stdenv.hostPlatform.isStatic
 }:
 
@@ -25,7 +25,7 @@ stdenv.mkDerivation rec {
 
   doCheck = false;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A C++ library that implements commandline flags processing";
     longDescription = ''
       The gflags package contains a C++ library that implements commandline flags processing.
diff --git a/pkgs/development/libraries/ggz_base_libs/default.nix b/pkgs/development/libraries/ggz_base_libs/default.nix
index 6003c5ea33ea3..025423ecd8a44 100644
--- a/pkgs/development/libraries/ggz_base_libs/default.nix
+++ b/pkgs/development/libraries/ggz_base_libs/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, intltool, openssl, expat, libgcrypt }:
+{ lib, stdenv, fetchurl, intltool, openssl, expat, libgcrypt }:
 
 stdenv.mkDerivation rec {
   version = "0.99.5";
@@ -22,7 +22,7 @@ stdenv.mkDerivation rec {
     "--with-tls"
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "GGZ Gaming zone libraries";
     maintainers = with maintainers;
     [
diff --git a/pkgs/development/libraries/giblib/default.nix b/pkgs/development/libraries/giblib/default.nix
index 2cb7a9dfe545f..e66f7bfe2a8c2 100644
--- a/pkgs/development/libraries/giblib/default.nix
+++ b/pkgs/development/libraries/giblib/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, xlibsWrapper, imlib2 }:
+{ lib, stdenv, fetchurl, xlibsWrapper, imlib2 }:
 
 stdenv.mkDerivation rec {
   name = "giblib-1.2.4";
@@ -30,7 +30,7 @@ stdenv.mkDerivation rec {
   meta = {
     homepage = "http://linuxbrit.co.uk/giblib/";
     description = "wrapper library for imlib2, and other stuff";
-    platforms = stdenv.lib.platforms.unix;
-    license = stdenv.lib.licenses.mit;
+    platforms = lib.platforms.unix;
+    license = lib.licenses.mit;
   };
 }
diff --git a/pkgs/development/libraries/giflib/4.1.nix b/pkgs/development/libraries/giflib/4.1.nix
index 954e508152c28..c0afe067c499c 100644
--- a/pkgs/development/libraries/giflib/4.1.nix
+++ b/pkgs/development/libraries/giflib/4.1.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl}:
+{lib, stdenv, fetchurl}:
 
 stdenv.mkDerivation {
   name = "giflib-4.1.6";
@@ -10,7 +10,7 @@ stdenv.mkDerivation {
 
   hardeningDisable = [ "format" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A library for reading and writing gif images";
     branch = "4.1";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/giflib/default.nix b/pkgs/development/libraries/giflib/default.nix
index e2ff96d366a20..9eaf7b933d43e 100644
--- a/pkgs/development/libraries/giflib/default.nix
+++ b/pkgs/development/libraries/giflib/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, fetchpatch, xmlto, docbook_xml_dtd_412, docbook_xsl, libxml2, fixDarwinDylibNames }:
+{ lib, stdenv, fetchurl, fetchpatch, xmlto, docbook_xml_dtd_412, docbook_xsl, libxml2, fixDarwinDylibNames }:
 
 stdenv.mkDerivation rec {
   name = "giflib-5.2.1";
@@ -7,7 +7,7 @@ stdenv.mkDerivation rec {
     sha256 = "1gbrg03z1b6rlrvjyc6d41bc8j1bsr7rm8206gb1apscyii5bnii";
   };
 
-  patches = stdenv.lib.optional stdenv.hostPlatform.isDarwin
+  patches = lib.optional stdenv.hostPlatform.isDarwin
     (fetchpatch {
       # https://sourceforge.net/p/giflib/bugs/133/
       name = "darwin-soname.patch";
@@ -21,15 +21,15 @@ stdenv.mkDerivation rec {
       --replace 'PREFIX = /usr/local' 'PREFIX = ${builtins.placeholder "out"}'
   '';
 
-  nativeBuildInputs = stdenv.lib.optionals stdenv.isDarwin [ fixDarwinDylibNames ];
+  nativeBuildInputs = lib.optionals stdenv.isDarwin [ fixDarwinDylibNames ];
 
   buildInputs = [ xmlto docbook_xml_dtd_412 docbook_xsl libxml2 ];
 
   meta = {
     description = "A library for reading and writing gif images";
-    platforms = stdenv.lib.platforms.unix;
-    license = stdenv.lib.licenses.mit;
-    maintainers = with stdenv.lib.maintainers; [ ];
+    platforms = lib.platforms.unix;
+    license = lib.licenses.mit;
+    maintainers = with lib.maintainers; [ ];
     branch = "5.2";
   };
 }
diff --git a/pkgs/development/libraries/giflib/libungif.nix b/pkgs/development/libraries/giflib/libungif.nix
index 30cfa0db86a6e..d8c32d14fca21 100644
--- a/pkgs/development/libraries/giflib/libungif.nix
+++ b/pkgs/development/libraries/giflib/libungif.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl}:
+{lib, stdenv, fetchurl}:
 
 stdenv.mkDerivation {
   name = "libungif-4.1.4";
@@ -9,7 +9,7 @@ stdenv.mkDerivation {
 
   hardeningDisable = [ "format" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Library and utilities for processing GIFs";
     platforms = platforms.unix;
     license = licenses.mit;
diff --git a/pkgs/development/libraries/gio-sharp/default.nix b/pkgs/development/libraries/gio-sharp/default.nix
index f315679c9b7b9..91fbb86bd669a 100644
--- a/pkgs/development/libraries/gio-sharp/default.nix
+++ b/pkgs/development/libraries/gio-sharp/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, autoconf, automake, which, pkg-config, mono, glib, gtk-sharp-2_0 }:
+{ lib, stdenv, fetchFromGitHub, autoconf, automake, which, pkg-config, mono, glib, gtk-sharp-2_0 }:
 
 stdenv.mkDerivation rec {
   pname = "gio-sharp";
@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
     ./autogen-2.22.sh
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "GIO API bindings";
     homepage = "https://github.com/mono/gio-sharp";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/git2/default.nix b/pkgs/development/libraries/git2/default.nix
index edbb3d82241ab..a118a611785e0 100644
--- a/pkgs/development/libraries/git2/default.nix
+++ b/pkgs/development/libraries/git2/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, pkg-config, python3
+{ lib, stdenv, fetchFromGitHub, cmake, pkg-config, python3
 , zlib, libssh2, openssl, pcre, http-parser
 , libiconv, Security
 }:
@@ -23,16 +23,16 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ cmake python3 pkg-config ];
 
   buildInputs = [ zlib libssh2 openssl pcre http-parser ]
-    ++ stdenv.lib.optional stdenv.isDarwin Security;
+    ++ lib.optional stdenv.isDarwin Security;
 
-  propagatedBuildInputs = stdenv.lib.optional (!stdenv.isLinux) libiconv;
+  propagatedBuildInputs = lib.optional (!stdenv.isLinux) libiconv;
 
   doCheck = false; # hangs. or very expensive?
 
   meta = {
     description = "The Git linkable library";
     homepage = "https://libgit2.github.com/";
-    license = stdenv.lib.licenses.gpl2;
-    platforms = with stdenv.lib.platforms; all;
+    license = lib.licenses.gpl2;
+    platforms = with lib.platforms; all;
   };
 }
diff --git a/pkgs/development/libraries/givaro/3.7.nix b/pkgs/development/libraries/givaro/3.7.nix
index 1de84afe62131..dfd6b6b476b65 100644
--- a/pkgs/development/libraries/givaro/3.7.nix
+++ b/pkgs/development/libraries/givaro/3.7.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, automake, autoconf, libtool, autoreconfHook, gmpxx}:
+{lib, stdenv, fetchurl, automake, autoconf, libtool, autoreconfHook, gmpxx}:
 stdenv.mkDerivation rec {
   pname = "givaro";
   version = "3.7.2";
@@ -11,8 +11,8 @@ stdenv.mkDerivation rec {
   meta = {
     inherit version;
     description = "A C++ library for arithmetic and algebraic computations";
-    license = stdenv.lib.licenses.cecill-b;
-    maintainers = [stdenv.lib.maintainers.raskin];
-    platforms = stdenv.lib.platforms.linux;
+    license = lib.licenses.cecill-b;
+    maintainers = [lib.maintainers.raskin];
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/development/libraries/givaro/3.nix b/pkgs/development/libraries/givaro/3.nix
index fc9bb18988f48..9d216b9d8e5cb 100644
--- a/pkgs/development/libraries/givaro/3.nix
+++ b/pkgs/development/libraries/givaro/3.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, automake, autoconf, libtool, autoreconfHook, gmpxx}:
+{lib, stdenv, fetchurl, automake, autoconf, libtool, autoreconfHook, gmpxx}:
 stdenv.mkDerivation rec {
   pname = "givaro";
   version = "3.8.0";
@@ -11,8 +11,8 @@ stdenv.mkDerivation rec {
   meta = {
     inherit version;
     description = "A C++ library for arithmetic and algebraic computations";
-    license = stdenv.lib.licenses.cecill-b;
-    maintainers = [stdenv.lib.maintainers.raskin];
-    platforms = stdenv.lib.platforms.linux;
+    license = lib.licenses.cecill-b;
+    maintainers = [lib.maintainers.raskin];
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/development/libraries/givaro/default.nix b/pkgs/development/libraries/givaro/default.nix
index 4da5a0cb75c14..f6d6ddab4d0b4 100644
--- a/pkgs/development/libraries/givaro/default.nix
+++ b/pkgs/development/libraries/givaro/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, automake, autoconf, libtool, autoreconfHook, gmpxx }:
+{ lib, stdenv, fetchFromGitHub, automake, autoconf, libtool, autoreconfHook, gmpxx }:
 stdenv.mkDerivation rec {
   pname = "givaro";
   version = "4.1.1";
@@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
 
   configureFlags = [
     "--disable-optimization"
-  ] ++ stdenv.lib.optionals stdenv.isx86_64 [
+  ] ++ lib.optionals stdenv.isx86_64 [
     # disable SIMD instructions (which are enabled *when available* by default)
     "--${if stdenv.hostPlatform.sse3Support   then "enable" else "disable"}-sse3"
     "--${if stdenv.hostPlatform.ssse3Support  then "enable" else "disable"}-ssse3"
@@ -38,8 +38,8 @@ stdenv.mkDerivation rec {
   meta = {
     inherit version;
     description = "A C++ library for arithmetic and algebraic computations";
-    license = stdenv.lib.licenses.cecill-b;
-    maintainers = [stdenv.lib.maintainers.raskin];
-    platforms = stdenv.lib.platforms.unix;
+    license = lib.licenses.cecill-b;
+    maintainers = [lib.maintainers.raskin];
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/gjs/default.nix b/pkgs/development/libraries/gjs/default.nix
index 5bcea2798191f..a6b37c5efcc21 100644
--- a/pkgs/development/libraries/gjs/default.nix
+++ b/pkgs/development/libraries/gjs/default.nix
@@ -1,6 +1,6 @@
 { fetchurl
 , fetchpatch
-, stdenv
+, lib, stdenv
 , meson
 , ninja
 , pkg-config
@@ -32,7 +32,7 @@ in stdenv.mkDerivation rec {
   version = "1.66.1";
 
   src = fetchurl {
-    url = "mirror://gnome/sources/gjs/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/gjs/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "0k1ld2bc4c3zbyjpfgx15v5n02iywdvm106rys5jqr7zbr2l0hld";
   };
 
@@ -105,7 +105,7 @@ in stdenv.mkDerivation rec {
   postFixup = ''
     wrapProgram "$installedTests/libexec/installed-tests/gjs/minijasmine" \
       --prefix XDG_DATA_DIRS : "$installedTestsSchemaDatadir" \
-      --prefix GI_TYPELIB_PATH : "${stdenv.lib.makeSearchPath "lib/girepository-1.0" testDeps}"
+      --prefix GI_TYPELIB_PATH : "${lib.makeSearchPath "lib/girepository-1.0" testDeps}"
   '';
 
   checkPhase = ''
@@ -127,7 +127,7 @@ in stdenv.mkDerivation rec {
     };
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "JavaScript bindings for GNOME";
     homepage = "https://gitlab.gnome.org/GNOME/gjs/blob/master/doc/Home.md";
     license = licenses.lgpl2Plus;
diff --git a/pkgs/development/libraries/gl2ps/default.nix b/pkgs/development/libraries/gl2ps/default.nix
index 172531f9dc7ce..0203e2fde93ad 100644
--- a/pkgs/development/libraries/gl2ps/default.nix
+++ b/pkgs/development/libraries/gl2ps/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , cmake
 , zlib
@@ -29,7 +29,7 @@ stdenv.mkDerivation rec {
     freeglut
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://geuz.org/gl2ps";
     description = "An OpenGL to PostScript printing library";
     platforms = platforms.all;
diff --git a/pkgs/development/libraries/glbinding/default.nix b/pkgs/development/libraries/glbinding/default.nix
index 9b67b9695cc08..1b36baa24e42b 100644
--- a/pkgs/development/libraries/glbinding/default.nix
+++ b/pkgs/development/libraries/glbinding/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, libGLU, xlibsWrapper }:
+{ lib, stdenv, fetchFromGitHub, cmake, libGLU, xlibsWrapper }:
 
 stdenv.mkDerivation rec {
   pname = "glbinding";
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ cmake ];
   buildInputs = [ libGLU xlibsWrapper ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/cginternals/glbinding/";
     description = "A C++ binding for the OpenGL API, generated using the gl.xml specification";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/gle/default.nix b/pkgs/development/libraries/gle/default.nix
index d0667b0f270e2..b7a4f7f2fef18 100644
--- a/pkgs/development/libraries/gle/default.nix
+++ b/pkgs/development/libraries/gle/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, freeglut, libX11, libXt, libXmu, libXi, libXext, libGL, libGLU}:
+{lib, stdenv, fetchurl, freeglut, libX11, libXt, libXmu, libXi, libXext, libGL, libGLU}:
 stdenv.mkDerivation {
   name = "gle-3.1.0";
   buildInputs = [libGLU libGL freeglut libX11 libXt libXmu libXi libXext];
@@ -11,8 +11,8 @@ stdenv.mkDerivation {
   };
   meta = {
     description = "Tubing and extrusion library";
-    license = stdenv.lib.licenses.gpl2 ;
-    maintainers = [stdenv.lib.maintainers.raskin];
-    platforms = stdenv.lib.platforms.linux;
+    license = lib.licenses.gpl2 ;
+    maintainers = [lib.maintainers.raskin];
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/development/libraries/glew/1.10.nix b/pkgs/development/libraries/glew/1.10.nix
index 139b93c039ec1..29376cb256721 100644
--- a/pkgs/development/libraries/glew/1.10.nix
+++ b/pkgs/development/libraries/glew/1.10.nix
@@ -1,8 +1,8 @@
-{ stdenv, fetchurl, libGLU, xlibsWrapper, libXmu, libXi
+{ lib, stdenv, fetchurl, libGLU, xlibsWrapper, libXmu, libXi
 , AGL, OpenGL
 }:
 
-with stdenv.lib;
+with lib;
 
 stdenv.mkDerivation rec {
   name = "glew-1.10.0";
@@ -40,7 +40,7 @@ stdenv.mkDerivation rec {
     "SYSTEM=${if stdenv.hostPlatform.isMinGW then "mingw" else stdenv.hostPlatform.parsed.kernel.name}"
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "An OpenGL extension loading library for C(++)";
     homepage = "http://glew.sourceforge.net/";
     license = licenses.free; # different files under different licenses
diff --git a/pkgs/development/libraries/glew/default.nix b/pkgs/development/libraries/glew/default.nix
index 3b067e6d0f309..660276530aa8c 100644
--- a/pkgs/development/libraries/glew/default.nix
+++ b/pkgs/development/libraries/glew/default.nix
@@ -1,8 +1,8 @@
-{ stdenv, fetchurl, libGLU, xlibsWrapper, libXmu, libXi
+{ lib, stdenv, fetchurl, libGLU, xlibsWrapper, libXmu, libXi
 , OpenGL
 }:
 
-with stdenv.lib;
+with lib;
 
 stdenv.mkDerivation rec {
   name = "glew-2.2.0";
@@ -46,7 +46,7 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "An OpenGL extension loading library for C(++)";
     homepage = "http://glew.sourceforge.net/";
     license = licenses.free; # different files under different licenses
diff --git a/pkgs/development/libraries/glfw/2.x.nix b/pkgs/development/libraries/glfw/2.x.nix
index ca65315e1cba2..d05fa6e5f7721 100644
--- a/pkgs/development/libraries/glfw/2.x.nix
+++ b/pkgs/development/libraries/glfw/2.x.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, libGLU, libGL, libX11, libXext }:
+{ lib, stdenv, fetchurl, libGLU, libGL, libX11, libXext }:
 
 stdenv.mkDerivation rec {
   name = "glfw-2.7.9";
@@ -21,11 +21,11 @@ stdenv.mkDerivation rec {
     ln -s libglfw.so.2 $out/lib/libglfw.so
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Multi-platform library for creating OpenGL contexts and managing input, including keyboard, mouse, joystick and time";
     homepage = "http://glfw.sourceforge.net/";
     license = licenses.zlib;
-    maintainers = [ stdenv.lib.maintainers.marcweber ];
+    maintainers = [ lib.maintainers.marcweber ];
     platforms = platforms.linux;
   };
 }
diff --git a/pkgs/development/libraries/glfw/3.x.nix b/pkgs/development/libraries/glfw/3.x.nix
index 62c1c596d2c30..8698b71567e2e 100644
--- a/pkgs/development/libraries/glfw/3.x.nix
+++ b/pkgs/development/libraries/glfw/3.x.nix
@@ -28,7 +28,7 @@ stdenv.mkDerivation rec {
     substituteInPlace src/glx_context.c --replace "libGL.so.1" "${lib.getLib libGL}/lib/libGL.so.1"
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Multi-platform library for creating OpenGL contexts and managing input, including keyboard, mouse, joystick and time";
     homepage = "https://www.glfw.org/";
     license = licenses.zlib;
diff --git a/pkgs/development/libraries/glib-networking/default.nix b/pkgs/development/libraries/glib-networking/default.nix
index 31e066e8a2507..5858973416625 100644
--- a/pkgs/development/libraries/glib-networking/default.nix
+++ b/pkgs/development/libraries/glib-networking/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , substituteAll
 , meson
@@ -23,7 +23,7 @@ stdenv.mkDerivation rec {
   outputs = [ "out" "installedTests" ];
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "16807qwflbghp0c66jdx2gnaffvdp4bla35ppzp9dlgx6wjbxmy5";
   };
 
@@ -83,7 +83,7 @@ stdenv.mkDerivation rec {
     };
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Network-related giomodules for glib";
     homepage = "https://gitlab.gnome.org/GNOME/glib-networking";
     license = licenses.lgpl21Plus;
diff --git a/pkgs/development/libraries/glib-testing/default.nix b/pkgs/development/libraries/glib-testing/default.nix
index b04cbfe36d00c..bdbced24a10e7 100644
--- a/pkgs/development/libraries/glib-testing/default.nix
+++ b/pkgs/development/libraries/glib-testing/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitLab
 , meson
 , ninja
@@ -53,7 +53,7 @@ stdenv.mkDerivation rec {
     };
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Test library providing test harnesses and mock classes complementing the classes provided by GLib";
     homepage = "https://gitlab.gnome.org/pwithnall/libglib-testing";
     license = licenses.lgpl21Plus;
diff --git a/pkgs/development/libraries/glib/default.nix b/pkgs/development/libraries/glib/default.nix
index da1eb0765365a..a67ea5037760b 100644
--- a/pkgs/development/libraries/glib/default.nix
+++ b/pkgs/development/libraries/glib/default.nix
@@ -1,4 +1,4 @@
-{ config, stdenv, fetchurl, gettext, meson, ninja, pkg-config, perl, python3
+{ config, lib, stdenv, fetchurl, gettext, meson, ninja, pkg-config, perl, python3
 , libiconv, zlib, libffi, pcre, libelf, gnome3, libselinux, bash, gnum4, gtk-doc, docbook_xsl, docbook_xml_dtd_45
 # use util-linuxMinimal to avoid circular dependency (util-linux, systemd, glib)
 , util-linuxMinimal ? null
@@ -11,7 +11,7 @@
 , darwin, fetchpatch
 }:
 
-with stdenv.lib;
+with lib;
 
 assert stdenv.isLinux -> util-linuxMinimal != null;
 
@@ -48,7 +48,7 @@ stdenv.mkDerivation rec {
   version = "2.66.4";
 
   src = fetchurl {
-    url = "mirror://gnome/sources/glib/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/glib/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "l9+GcOMvn9T3OSsJgOZh3WJQEgFdWDUNoeWOND9K+YQ=";
   };
 
@@ -182,7 +182,7 @@ stdenv.mkDerivation rec {
     updateScript = gnome3.updateScript { packageName = "glib"; };
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "C library of programming buildings blocks";
     homepage    = "https://www.gtk.org/";
     license     = licenses.lgpl21Plus;
diff --git a/pkgs/development/libraries/glibc/default.nix b/pkgs/development/libraries/glibc/default.nix
index 150681ebda184..9043c8fd0d4f3 100644
--- a/pkgs/development/libraries/glibc/default.nix
+++ b/pkgs/development/libraries/glibc/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, callPackage
+{ lib, stdenv, callPackage
 , withLinuxHeaders ? true
 , profilingLibraries ? false
 , withGd ? false
@@ -14,7 +14,7 @@ let
 in
 
 callPackage ./common.nix { inherit stdenv; } {
-    name = "glibc" + stdenv.lib.optionalString withGd "-gd";
+    name = "glibc" + lib.optionalString withGd "-gd";
 
     inherit withLinuxHeaders profilingLibraries withGd;
 
@@ -46,15 +46,15 @@ callPackage ./common.nix { inherit stdenv; } {
     hardeningDisable = [ "stackprotector" "fortify" ]
     # XXX: Not actually musl-speciic but since only musl enables pie by default,
     #      limit rebuilds by only disabling pie w/musl
-      ++ stdenv.lib.optional stdenv.hostPlatform.isMusl "pie";
+      ++ lib.optional stdenv.hostPlatform.isMusl "pie";
 
-    NIX_CFLAGS_COMPILE = stdenv.lib.concatStringsSep " "
+    NIX_CFLAGS_COMPILE = lib.concatStringsSep " "
       (builtins.concatLists [
-        (stdenv.lib.optionals withGd gdCflags)
+        (lib.optionals withGd gdCflags)
         # Fix -Werror build failure when building glibc with musl with GCC >= 8, see:
         # https://github.com/NixOS/nixpkgs/pull/68244#issuecomment-544307798
-        (stdenv.lib.optional stdenv.hostPlatform.isMusl "-Wno-error=attribute-alias")
-        (stdenv.lib.optionals ((stdenv.hostPlatform != stdenv.buildPlatform) || stdenv.hostPlatform.isMusl) [
+        (lib.optional stdenv.hostPlatform.isMusl "-Wno-error=attribute-alias")
+        (lib.optionals ((stdenv.hostPlatform != stdenv.buildPlatform) || stdenv.hostPlatform.isMusl) [
           # Ignore "error: '__EI___errno_location' specifies less restrictive attributes than its target '__errno_location'"
           # New warning as of GCC 9
           # Same for musl: https://github.com/NixOS/nixpkgs/issues/78805
@@ -81,14 +81,14 @@ callPackage ./common.nix { inherit stdenv; } {
     postInstall = (if stdenv.hostPlatform == stdenv.buildPlatform then ''
       echo SUPPORTED-LOCALES=C.UTF-8/UTF-8 > ../glibc-2*/localedata/SUPPORTED
       make -j''${NIX_BUILD_CORES:-1} -l''${NIX_BUILD_CORES:-1} localedata/install-locales
-    '' else stdenv.lib.optionalString stdenv.buildPlatform.isLinux ''
+    '' else lib.optionalString stdenv.buildPlatform.isLinux ''
       # This is based on http://www.linuxfromscratch.org/lfs/view/development/chapter06/glibc.html
       # Instead of using their patch to build a build-native localedef,
       # we simply use the one from buildPackages
       pushd ../glibc-2*/localedata
       export I18NPATH=$PWD GCONV_PATH=$PWD/../iconvdata
       mkdir -p $NIX_BUILD_TOP/${buildPackages.glibc}/lib/locale
-      ${stdenv.lib.getBin buildPackages.glibc}/bin/localedef \
+      ${lib.getBin buildPackages.glibc}/bin/localedef \
         --alias-file=../intl/locale.alias \
         -i locales/C \
         -f charmaps/UTF-8 \
@@ -122,7 +122,7 @@ callPackage ./common.nix { inherit stdenv; } {
     ''
       # For some reason these aren't stripped otherwise and retain reference
       # to bootstrap-tools; on cross-arm this stripping would break objects.
-    + stdenv.lib.optionalString (stdenv.hostPlatform == stdenv.buildPlatform) ''
+    + lib.optionalString (stdenv.hostPlatform == stdenv.buildPlatform) ''
 
       for i in "$out"/lib/*.a; do
           [ "$i" = "$out/lib/libm.a" ] || $STRIP -S "$i"
diff --git a/pkgs/development/libraries/glibc/locales.nix b/pkgs/development/libraries/glibc/locales.nix
index 0dc191974155c..238cebf6209f8 100644
--- a/pkgs/development/libraries/glibc/locales.nix
+++ b/pkgs/development/libraries/glibc/locales.nix
@@ -6,7 +6,7 @@
    https://sourceware.org/git/?p=glibc.git;a=blob;f=localedata/SUPPORTED
 */
 
-{ stdenv, buildPackages, callPackage, writeText
+{ lib, stdenv, buildPackages, callPackage, writeText
 , allLocales ? true, locales ? [ "en_US.UTF-8/UTF-8" ]
 }:
 
@@ -31,9 +31,9 @@ callPackage ./common.nix { inherit stdenv; } {
       # Hack to allow building of the locales (needed since glibc-2.12)
       sed -i -e 's,^$(rtld-prefix) $(common-objpfx)locale/localedef,localedef --prefix='$TMPDIR',' ../glibc-2*/localedata/Makefile
     ''
-      + stdenv.lib.optionalString (!allLocales) ''
+      + lib.optionalString (!allLocales) ''
       # Check that all locales to be built are supported
-      echo -n '${stdenv.lib.concatMapStrings (s: s + " \\\n") locales}' \
+      echo -n '${lib.concatMapStrings (s: s + " \\\n") locales}' \
         | sort > locales-to-build.txt
       cat ../glibc-2*/localedata/SUPPORTED | grep ' \\' \
         | sort > locales-supported.txt
diff --git a/pkgs/development/libraries/glibmm/default.nix b/pkgs/development/libraries/glibmm/default.nix
index c737ee9ec451e..19567a987212f 100644
--- a/pkgs/development/libraries/glibmm/default.nix
+++ b/pkgs/development/libraries/glibmm/default.nix
@@ -1,11 +1,11 @@
-{ stdenv, fetchurl, pkg-config, gnum4, glib, libsigcxx, gnome3, darwin }:
+{ lib, stdenv, fetchurl, pkg-config, gnum4, glib, libsigcxx, gnome3, darwin }:
 
 stdenv.mkDerivation rec {
   pname = "glibmm";
   version = "2.64.2";
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "1v6lp23fr2qh4zshcnm28sn29j3nzgsvcqj2nhmrnvamipjq4lm7";
   };
 
@@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
     glib # for glib-compile-schemas
   ];
 
-  buildInputs = stdenv.lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [
+  buildInputs = lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [
     Cocoa
   ]);
   propagatedBuildInputs = [ glib libsigcxx ];
@@ -32,7 +32,7 @@ stdenv.mkDerivation rec {
     };
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "C++ interface to the GLib library";
 
     homepage = "https://gtkmm.org/";
diff --git a/pkgs/development/libraries/glm/default.nix b/pkgs/development/libraries/glm/default.nix
index cb0ae47acded0..f5652a61c1de9 100644
--- a/pkgs/development/libraries/glm/default.nix
+++ b/pkgs/development/libraries/glm/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, fetchzip, cmake }:
+{ lib, stdenv, fetchurl, fetchzip, cmake }:
 
 stdenv.mkDerivation rec {
   version = "0.9.8.5";
@@ -27,14 +27,14 @@ stdenv.mkDerivation rec {
     cp ${gcc7PlatformPatch} glm/simd/platform.h
   '';
 
-  NIX_CFLAGS_COMPILE = stdenv.lib.optionalString stdenv.isDarwin "-DGLM_COMPILER=0";
+  NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isDarwin "-DGLM_COMPILER=0";
 
   postInstall = ''
     mkdir -p $doc/share/doc/glm
     cp -rv $NIX_BUILD_TOP/$sourceRoot/doc/* $doc/share/doc/glm
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "OpenGL Mathematics library for C++";
     longDescription = ''
       OpenGL Mathematics (GLM) is a header only C++ mathematics library for
@@ -44,7 +44,7 @@ stdenv.mkDerivation rec {
     homepage = "http://glm.g-truc.net/";
     license = licenses.mit;
     platforms = platforms.unix;
-    maintainers = with stdenv.lib.maintainers; [ ];
+    maintainers = with lib.maintainers; [ ];
   };
 }
 
diff --git a/pkgs/development/libraries/globalarrays/default.nix b/pkgs/development/libraries/globalarrays/default.nix
index 5f700f73515a7..049e262bb17b1 100644
--- a/pkgs/development/libraries/globalarrays/default.nix
+++ b/pkgs/development/libraries/globalarrays/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchpatch, fetchFromGitHub, autoreconfHook
+{ lib, stdenv, fetchpatch, fetchFromGitHub, autoreconfHook
 , blas, gfortran, openssh, openmpi
 } :
 
@@ -30,7 +30,7 @@ in stdenv.mkDerivation {
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Global Arrays Programming Models";
     homepage = "http://hpc.pnl.gov/globalarrays/";
     maintainers = [ maintainers.markuskowa ];
diff --git a/pkgs/development/libraries/globalplatform/default.nix b/pkgs/development/libraries/globalplatform/default.nix
index 6f53cda536acd..a8dfa430f5992 100644
--- a/pkgs/development/libraries/globalplatform/default.nix
+++ b/pkgs/development/libraries/globalplatform/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, zlib, openssl_1_0_2, pcsclite }:
+{ lib, stdenv, fetchurl, pkg-config, zlib, openssl_1_0_2, pcsclite }:
 
 stdenv.mkDerivation rec {
   pname = "globalplatform";
@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ pkg-config ];
   buildInputs = [ zlib openssl_1_0_2 pcsclite ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://sourceforge.net/p/globalplatform/wiki/Home/";
     description = "Library for interacting with smart card devices";
     license = licenses.gpl3;
diff --git a/pkgs/development/libraries/globalplatform/gppcscconnectionplugin.nix b/pkgs/development/libraries/globalplatform/gppcscconnectionplugin.nix
index 33a6954d69550..a3ea4305bea71 100644
--- a/pkgs/development/libraries/globalplatform/gppcscconnectionplugin.nix
+++ b/pkgs/development/libraries/globalplatform/gppcscconnectionplugin.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, globalplatform, openssl_1_0_2, pcsclite }:
+{ lib, stdenv, fetchurl, pkg-config, globalplatform, openssl_1_0_2, pcsclite }:
 
 stdenv.mkDerivation rec {
   pname = "gppcscconnectionplugin";
@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ pkg-config ];
   buildInputs = [ globalplatform openssl_1_0_2 pcsclite ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://sourceforge.net/p/globalplatform/wiki/Home/";
     description = "GlobalPlatform pcsc connection plugin";
     license = [ licenses.lgpl3 licenses.gpl3 ];
diff --git a/pkgs/development/libraries/glog/default.nix b/pkgs/development/libraries/glog/default.nix
index aa846e41d550e..4bb20ebfd93e4 100644
--- a/pkgs/development/libraries/glog/default.nix
+++ b/pkgs/development/libraries/glog/default.nix
@@ -35,7 +35,7 @@ stdenv.mkDerivation rec {
   checkInputs = [ perl ];
   doCheck = false; # fails with "Mangled symbols (28 out of 380) found in demangle.dm"
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/google/glog";
     license = licenses.bsd3;
     description = "Library for application-level logging";
diff --git a/pkgs/development/libraries/gloox/default.nix b/pkgs/development/libraries/gloox/default.nix
index ef731b3c35a60..b01d858cfb92c 100644
--- a/pkgs/development/libraries/gloox/default.nix
+++ b/pkgs/development/libraries/gloox/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl
+{ lib, stdenv, fetchurl
 , zlibSupport ? true, zlib ? null
 , sslSupport ? true, openssl ? null
 , idnSupport ? true, libidn ? null
@@ -8,7 +8,7 @@ assert zlibSupport -> zlib != null;
 assert sslSupport -> openssl != null;
 assert idnSupport -> libidn != null;
 
-with stdenv.lib;
+with lib;
 
 let
   version = "1.0.24";
diff --git a/pkgs/development/libraries/glpk/default.nix b/pkgs/development/libraries/glpk/default.nix
index d771f7df78927..a46c84844e891 100644
--- a/pkgs/development/libraries/glpk/default.nix
+++ b/pkgs/development/libraries/glpk/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , fetchpatch
 , libmysqlclient
@@ -24,11 +24,11 @@ stdenv.mkDerivation rec {
 
   buildInputs =
     [ libmysqlclient
-    ] ++ stdenv.lib.optionals withGmp [
+    ] ++ lib.optionals withGmp [
       gmp
     ];
 
-  configureFlags = stdenv.lib.optionals withGmp [
+  configureFlags = lib.optionals withGmp [
     "--with-gmp"
   ];
 
@@ -59,7 +59,7 @@ stdenv.mkDerivation rec {
 
   doCheck = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "The GNU Linear Programming Kit";
 
     longDescription =
diff --git a/pkgs/development/libraries/glui/default.nix b/pkgs/development/libraries/glui/default.nix
index d84a9227c3b84..5eead23b825ab 100644
--- a/pkgs/development/libraries/glui/default.nix
+++ b/pkgs/development/libraries/glui/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , freeglut
 , libGL
@@ -31,7 +31,7 @@ stdenv.mkDerivation rec {
     cp LICENSE.txt "$out/share/glui/doc"
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = ''A user interface library using OpenGL'';
     license = licenses.zlib ;
     maintainers = [ maintainers.raskin ];
diff --git a/pkgs/development/libraries/gmime/2.nix b/pkgs/development/libraries/gmime/2.nix
index 05bb401822937..0e10d12ed1f19 100644
--- a/pkgs/development/libraries/gmime/2.nix
+++ b/pkgs/development/libraries/gmime/2.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, glib, zlib, gnupg, libgpgerror, gobject-introspection }:
+{ lib, stdenv, fetchurl, pkg-config, glib, zlib, gnupg, libgpgerror, gobject-introspection }:
 
 stdenv.mkDerivation rec {
   version = "2.6.23";
@@ -28,7 +28,7 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/jstedfast/gmime/";
     description = "A C/C++ library for creating, editing and parsing MIME messages and structures";
     license = licenses.lgpl21Plus;
diff --git a/pkgs/development/libraries/gmime/3.nix b/pkgs/development/libraries/gmime/3.nix
index 01ddde2ca89a0..a8e39047256ca 100644
--- a/pkgs/development/libraries/gmime/3.nix
+++ b/pkgs/development/libraries/gmime/3.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, glib, zlib, gnupg, gpgme, libidn2, libunistring, gobject-introspection
+{ lib, stdenv, fetchurl, pkg-config, glib, zlib, gnupg, gpgme, libidn2, libunistring, gobject-introspection
 , vala }:
 
 stdenv.mkDerivation rec {
@@ -31,7 +31,7 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/jstedfast/gmime/";
     description = "A C/C++ library for creating, editing and parsing MIME messages and structures";
     license = licenses.lgpl21Plus;
diff --git a/pkgs/development/libraries/gmm/default.nix b/pkgs/development/libraries/gmm/default.nix
index 278059465ecbd..3c145b3c1e383 100644
--- a/pkgs/development/libraries/gmm/default.nix
+++ b/pkgs/development/libraries/gmm/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
   pname = "gmm";
@@ -9,7 +9,7 @@ stdenv.mkDerivation rec {
     sha256 = "0mhygfpsdyr0d4h3sn6g7nxn149yrlqv7r2h34yqkrpv1q4daqvi";
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Generic C++ template library for sparse, dense and skyline matrices";
     homepage = "http://getfem.org/gmm.html";
     license = licenses.lgpl21Plus;
diff --git a/pkgs/development/libraries/gmp/4.3.2.nix b/pkgs/development/libraries/gmp/4.3.2.nix
index 29310aa9f00ef..ce870581f5e94 100644
--- a/pkgs/development/libraries/gmp/4.3.2.nix
+++ b/pkgs/development/libraries/gmp/4.3.2.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, m4, cxx ? true }:
+{ lib, stdenv, fetchurl, m4, cxx ? true }:
 
 let self = stdenv.mkDerivation rec {
   name = "gmp-4.3.2";
@@ -28,8 +28,8 @@ let self = stdenv.mkDerivation rec {
     else ''echo "Darwin host is `./config.guess`."'';
 
   configureFlags = [
-    (stdenv.lib.enableFeature cxx "cxx")
-  ] ++ stdenv.lib.optionals stdenv.isDarwin [
+    (lib.enableFeature cxx "cxx")
+  ] ++ lib.optionals stdenv.isDarwin [
     "ac_cv_build=x86_64-apple-darwin13.4.0"
     "ac_cv_host=x86_64-apple-darwin13.4.0"
   ];
@@ -65,10 +65,10 @@ let self = stdenv.mkDerivation rec {
       '';
 
     homepage = "https://gmplib.org/";
-    license = stdenv.lib.licenses.lgpl3Plus;
+    license = lib.licenses.lgpl3Plus;
 
     maintainers = [ ];
-    platforms = stdenv.lib.platforms.all;
+    platforms = lib.platforms.all;
     badPlatforms = [ "x86_64-darwin" ];
   };
 };
diff --git a/pkgs/development/libraries/gmp/5.1.x.nix b/pkgs/development/libraries/gmp/5.1.x.nix
index a514934e96458..73061a3d2efdb 100644
--- a/pkgs/development/libraries/gmp/5.1.x.nix
+++ b/pkgs/development/libraries/gmp/5.1.x.nix
@@ -1,9 +1,9 @@
-{ stdenv, fetchurl, m4
+{ lib, stdenv, fetchurl, m4
 , cxx ? true
 , withStatic ? stdenv.hostPlatform.isStatic
 }:
 
-let inherit (stdenv.lib) optional; in
+let inherit (lib) optional; in
 
 let self = stdenv.mkDerivation rec {
   name = "gmp-5.1.3";
@@ -25,13 +25,13 @@ let self = stdenv.mkDerivation rec {
 
   configureFlags = [
     "--with-pic"
-    (stdenv.lib.enableFeature cxx "cxx")
+    (lib.enableFeature cxx "cxx")
     # Build a "fat binary", with routines for several sub-architectures
     # (x86), except on Solaris where some tests crash with "Memory fault".
     # See <https://hydra.nixos.org/build/2760931>, for instance.
     #
     # no darwin because gmp uses ASM that clang doesn't like
-    (stdenv.lib.enableFeature (!stdenv.isSunOS && stdenv.hostPlatform.isx86) "fat")
+    (lib.enableFeature (!stdenv.isSunOS && stdenv.hostPlatform.isx86) "fat")
     # The config.guess in GMP tries to runtime-detect various
     # ARM optimization flags via /proc/cpuinfo (and is also
     # broken on multicore CPUs). Avoid this impurity.
@@ -46,7 +46,7 @@ let self = stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://gmplib.org/";
     description = "GNU multiple precision arithmetic library";
     license = licenses.gpl3Plus;
diff --git a/pkgs/development/libraries/gmp/6.x.nix b/pkgs/development/libraries/gmp/6.x.nix
index 522976d3ab2c6..bf03bf08779bb 100644
--- a/pkgs/development/libraries/gmp/6.x.nix
+++ b/pkgs/development/libraries/gmp/6.x.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, m4
+{ lib, stdenv, fetchurl, m4
 , cxx ? !stdenv.hostPlatform.useAndroidPrebuilt && !stdenv.hostPlatform.isWasm
 , buildPackages
 , withStatic ? stdenv.hostPlatform.isStatic
@@ -9,7 +9,7 @@
 # cgit) that are needed here should be included directly in Nixpkgs as
 # files.
 
-let inherit (stdenv.lib) optional; in
+let inherit (lib) optional; in
 
 let self = stdenv.mkDerivation rec {
   name = "gmp-6.2.1";
@@ -30,13 +30,13 @@ let self = stdenv.mkDerivation rec {
 
   configureFlags = [
     "--with-pic"
-    (stdenv.lib.enableFeature cxx "cxx")
+    (lib.enableFeature cxx "cxx")
     # Build a "fat binary", with routines for several sub-architectures
     # (x86), except on Solaris where some tests crash with "Memory fault".
     # See <https://hydra.nixos.org/build/2760931>, for instance.
     #
     # no darwin because gmp uses ASM that clang doesn't like
-    (stdenv.lib.enableFeature (!stdenv.isSunOS && stdenv.hostPlatform.isx86) "fat")
+    (lib.enableFeature (!stdenv.isSunOS && stdenv.hostPlatform.isx86) "fat")
     # The config.guess in GMP tries to runtime-detect various
     # ARM optimization flags via /proc/cpuinfo (and is also
     # broken on multicore CPUs). Avoid this impurity.
@@ -54,7 +54,7 @@ let self = stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://gmplib.org/";
     description = "GNU multiple precision arithmetic library";
     license = licenses.gpl3Plus;
diff --git a/pkgs/development/libraries/gmtk/default.nix b/pkgs/development/libraries/gmtk/default.nix
index 81e33c39a7d15..6f2906a8234e5 100644
--- a/pkgs/development/libraries/gmtk/default.nix
+++ b/pkgs/development/libraries/gmtk/default.nix
@@ -1,4 +1,4 @@
-{stdenv, substituteAll, fetchFromGitHub, libtool, pkg-config, intltool, glib, gtk3
+{lib, stdenv, substituteAll, fetchFromGitHub, libtool, pkg-config, intltool, glib, gtk3
 , libpulseaudio, mplayer, gnome_mplayer }:
 
 stdenv.mkDerivation rec {
@@ -22,7 +22,7 @@ stdenv.mkDerivation rec {
     })
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Common functions for gnome-mplayer and gecko-mediaplayer";
     homepage = "https://sites.google.com/site/kdekorte2/gnomemplayer";
     license = licenses.gpl2;
diff --git a/pkgs/development/libraries/gnet/default.nix b/pkgs/development/libraries/gnet/default.nix
index 91522e3f1269a..8f35407f9ddd2 100644
--- a/pkgs/development/libraries/gnet/default.nix
+++ b/pkgs/development/libraries/gnet/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchFromGitHub, pkg-config, autoconf, automake, glib, libtool }:
+{lib, stdenv, fetchFromGitHub, pkg-config, autoconf, automake, glib, libtool }:
 
 stdenv.mkDerivation {
   name = "gnet-2.0.8";
@@ -14,7 +14,7 @@ stdenv.mkDerivation {
 
   preConfigure = "./autogen.sh";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A network library, written in C, object-oriented, and built upon GLib";
     homepage = "https://developer.gnome.org/gnet/";
     license = licenses.lgpl2;
diff --git a/pkgs/development/libraries/gnome-menus/default.nix b/pkgs/development/libraries/gnome-menus/default.nix
index 3d4d8be3f1ac2..c8e77148c6d80 100644
--- a/pkgs/development/libraries/gnome-menus/default.nix
+++ b/pkgs/development/libraries/gnome-menus/default.nix
@@ -1,11 +1,11 @@
-{ stdenv, fetchurl, pkg-config, gettext, glib, gobject-introspection, gnome3 }:
+{ lib, stdenv, fetchurl, pkg-config, gettext, glib, gobject-introspection, gnome3 }:
 
 stdenv.mkDerivation rec {
   pname = "gnome-menus";
   version = "3.36.0";
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "07xvaf8s0fiv0035nk8zpzymn5www76w2a1vflrgqmp9plw8yd6r";
   };
 
@@ -24,7 +24,7 @@ stdenv.mkDerivation rec {
     };
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://gitlab.gnome.org/GNOME/gnome-menus";
     description = "Library that implements freedesktops's Desktop Menu Specification in GNOME";
     license = with licenses; [ gpl2 lgpl2 ];
diff --git a/pkgs/development/libraries/gnome-online-accounts/default.nix b/pkgs/development/libraries/gnome-online-accounts/default.nix
index 342cfcbc4da2c..c5846b523cd2a 100644
--- a/pkgs/development/libraries/gnome-online-accounts/default.nix
+++ b/pkgs/development/libraries/gnome-online-accounts/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitLab
 , pkg-config
 , vala
@@ -95,7 +95,7 @@ stdenv.mkDerivation rec {
     };
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://wiki.gnome.org/Projects/GnomeOnlineAccounts";
     description = "Single sign-on framework for GNOME";
     platforms = platforms.linux;
diff --git a/pkgs/development/libraries/gnome-sharp/default.nix b/pkgs/development/libraries/gnome-sharp/default.nix
index efd95d0f973c3..4aa510f360681 100644
--- a/pkgs/development/libraries/gnome-sharp/default.nix
+++ b/pkgs/development/libraries/gnome-sharp/default.nix
@@ -35,7 +35,7 @@ stdenv.mkDerivation rec {
 
   dontStrip = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://www.mono-project.com/docs/gui/gtksharp/";
     description = "A .NET language binding for assorted GNOME libraries";
     license = licenses.lgpl21;
diff --git a/pkgs/development/libraries/gnome-video-effects/default.nix b/pkgs/development/libraries/gnome-video-effects/default.nix
index 41a0cb297c427..a2206c19b1b43 100644
--- a/pkgs/development/libraries/gnome-video-effects/default.nix
+++ b/pkgs/development/libraries/gnome-video-effects/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , pkg-config
 , meson
@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
   version = "0.5.0";
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "1j6h98whgkcxrh30bwvnxvyqxrxchgpdgqhl0j71xz7x72dqxijd";
   };
 
@@ -36,7 +36,7 @@ stdenv.mkDerivation rec {
     };
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A collection of GStreamer effects to be used in different GNOME Modules";
     homepage = "https://wiki.gnome.org/Projects/GnomeVideoEffects";
     platforms = platforms.linux;
diff --git a/pkgs/development/libraries/gnu-config/default.nix b/pkgs/development/libraries/gnu-config/default.nix
index 5acab2a70e08a..74b94e68f5643 100644
--- a/pkgs/development/libraries/gnu-config/default.nix
+++ b/pkgs/development/libraries/gnu-config/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 let
   rev = "e78c96e5288993aaea3ec44e5c6ee755c668da79";
@@ -22,7 +22,7 @@ in stdenv.mkDerivation {
     cp ${configSub} $out/config.sub
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Attempt to guess a canonical system name";
     homepage = "https://savannah.gnu.org/projects/config";
     license = licenses.gpl3;
diff --git a/pkgs/development/libraries/gnu-efi/default.nix b/pkgs/development/libraries/gnu-efi/default.nix
index 402c3585d53fe..ef8ef7648ebdd 100644
--- a/pkgs/development/libraries/gnu-efi/default.nix
+++ b/pkgs/development/libraries/gnu-efi/default.nix
@@ -1,6 +1,6 @@
-{ stdenv, buildPackages, fetchurl, fetchpatch, pciutils }:
+{ lib, stdenv, buildPackages, fetchurl, fetchpatch, pciutils }:
 
-with stdenv.lib;
+with lib;
 
 stdenv.mkDerivation rec {
   pname = "gnu-efi";
@@ -29,7 +29,7 @@ stdenv.mkDerivation rec {
     "CROSS_COMPILE=${stdenv.cc.targetPrefix}"
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "GNU EFI development toolchain";
     homepage = "https://sourceforge.net/projects/gnu-efi/";
     license = licenses.bsd3;
diff --git a/pkgs/development/libraries/gobject-introspection/default.nix b/pkgs/development/libraries/gobject-introspection/default.nix
index 97b3ea9a8f10d..ae65f5aed280c 100644
--- a/pkgs/development/libraries/gobject-introspection/default.nix
+++ b/pkgs/development/libraries/gobject-introspection/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , glib
 , flex
@@ -34,7 +34,7 @@ stdenv.mkDerivation rec {
   outputBin = "dev";
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "078n0q7b6z682mf4irclrksm73cyixq295mqnqifl9plwmgaai6x";
   };
 
@@ -46,12 +46,12 @@ stdenv.mkDerivation rec {
       src = ./absolute_shlib_path.patch;
       inherit nixStoreDir;
     })
-  ] ++ stdenv.lib.optionals x11Support [
+  ] ++ lib.optionals x11Support [
     # Hardcode the cairo shared library path in the Cairo gir shipped with this package.
     # https://github.com/NixOS/nixpkgs/issues/34080
     (substituteAll {
       src = ./absolute_gir_path.patch;
-      cairoLib = "${stdenv.lib.getLib cairo}/lib";
+      cairoLib = "${lib.getLib cairo}/lib";
     })
   ];
 
@@ -72,7 +72,7 @@ stdenv.mkDerivation rec {
     python3
   ];
 
-  checkInputs = stdenv.lib.optionals stdenv.isDarwin [
+  checkInputs = lib.optionals stdenv.isDarwin [
     cctools # for otool
   ];
 
@@ -117,7 +117,7 @@ stdenv.mkDerivation rec {
     };
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A middleware layer between C libraries and language bindings";
     homepage = "https://gi.readthedocs.io/";
     maintainers = teams.gnome.members ++ (with maintainers; [ lovek323 ]);
diff --git a/pkgs/development/libraries/goffice/default.nix b/pkgs/development/libraries/goffice/default.nix
index d9cffbc228ede..d544dd7625dca 100644
--- a/pkgs/development/libraries/goffice/default.nix
+++ b/pkgs/development/libraries/goffice/default.nix
@@ -1,4 +1,4 @@
-{ fetchurl, stdenv, pkg-config, intltool, glib, gtk3, lasem
+{ fetchurl, lib, stdenv, pkg-config, intltool, glib, gtk3, lasem
 , libgsf, libxml2, libxslt, cairo, pango, librsvg, gnome3 }:
 
 stdenv.mkDerivation rec {
@@ -8,7 +8,7 @@ stdenv.mkDerivation rec {
   outputs = [ "out" "dev" "devdoc" ];
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "1z6f3q8fxkd1ysqrwdxdi0844zqa00vjpf07gq8mh3kal8picfd4";
   };
 
@@ -38,8 +38,8 @@ stdenv.mkDerivation rec {
       documents, undo/redo.
     '';
 
-    license = stdenv.lib.licenses.gpl2Plus;
+    license = lib.licenses.gpl2Plus;
 
-    platforms = stdenv.lib.platforms.unix;
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/gom/default.nix b/pkgs/development/libraries/gom/default.nix
index 2be144fc4c63f..4b5effefa57cf 100644
--- a/pkgs/development/libraries/gom/default.nix
+++ b/pkgs/development/libraries/gom/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , meson
 , ninja
@@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
   outputs = [ "out" "py" ];
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "17ca07hpg7dqxjn0jpqim3xqcmplk2a87wbwrrlq3dd3m8381l38";
   };
 
@@ -53,7 +53,7 @@ stdenv.mkDerivation rec {
     };
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A GObject to SQLite object mapper";
     homepage = "https://wiki.gnome.org/Projects/Gom";
     license = licenses.lgpl21Plus;
diff --git a/pkgs/development/libraries/goocanvas/2.x.nix b/pkgs/development/libraries/goocanvas/2.x.nix
index ae583f5ac8b86..c4df9f1f0fd7e 100644
--- a/pkgs/development/libraries/goocanvas/2.x.nix
+++ b/pkgs/development/libraries/goocanvas/2.x.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, gettext, gtk-doc, gobject-introspection, python2, gtk3, cairo, glib }:
+{ lib, stdenv, fetchurl, pkg-config, gettext, gtk-doc, gobject-introspection, python2, gtk3, cairo, glib }:
 
 let
   version = "2.0.4";
@@ -22,7 +22,7 @@ in stdenv.mkDerivation rec {
   PKG_CONFIG_GOBJECT_INTROSPECTION_1_0_GIRDIR = "$(dev)/share/gir-1.0";
   PKG_CONFIG_GOBJECT_INTROSPECTION_1_0_TYPELIBDIR = "$(out)/lib/girepository-1.0";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Canvas widget for GTK based on the the Cairo 2D library";
     homepage = "https://wiki.gnome.org/Projects/GooCanvas";
     license = licenses.lgpl2;
diff --git a/pkgs/development/libraries/goocanvas/default.nix b/pkgs/development/libraries/goocanvas/default.nix
index 825e0cbe1948b..c9fd5b2634298 100644
--- a/pkgs/development/libraries/goocanvas/default.nix
+++ b/pkgs/development/libraries/goocanvas/default.nix
@@ -1,11 +1,11 @@
-{ stdenv, fetchurl, gtk2, cairo, glib, pkg-config, gnome3 }:
+{ lib, stdenv, fetchurl, gtk2, cairo, glib, pkg-config, gnome3 }:
 
 stdenv.mkDerivation rec {
   pname = "goocanvas";
   version = "1.0.0";
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.bz2";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.bz2";
     sha256 = "07kicpcacbqm3inp7zq32ldp95mxx4kfxpaazd0x5jk7hpw2w1qw";
   };
 
@@ -19,10 +19,10 @@ stdenv.mkDerivation rec {
     };
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Canvas widget for GTK based on the the Cairo 2D library";
     homepage = "https://wiki.gnome.org/Projects/GooCanvas";
     license = licenses.lgpl2;
-    platforms = stdenv.lib.platforms.unix;
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/goocanvasmm/default.nix b/pkgs/development/libraries/goocanvasmm/default.nix
index e68094f9d5239..632e434631c9c 100644
--- a/pkgs/development/libraries/goocanvasmm/default.nix
+++ b/pkgs/development/libraries/goocanvasmm/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, goocanvas2, gtkmm3, gnome3 }:
+{ lib, stdenv, fetchurl, pkg-config, goocanvas2, gtkmm3, gnome3 }:
 
 stdenv.mkDerivation rec {
   pname = "goocanvasmm";
@@ -7,7 +7,7 @@ stdenv.mkDerivation rec {
   outputs = [ "out" "dev" ];
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "0vpdfrj59nwzwj8bk4s0h05iyql62pxjzsxh72g3vry07s3i3zw0";
   };
   nativeBuildInputs = [ pkg-config ];
@@ -22,7 +22,7 @@ stdenv.mkDerivation rec {
     };
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "C++ bindings for GooCanvas";
     homepage = "https://wiki.gnome.org/Projects/GooCanvas";
     license = licenses.lgpl2;
diff --git a/pkgs/development/libraries/google-cloud-cpp/default.nix b/pkgs/development/libraries/google-cloud-cpp/default.nix
index a3a549a632406..fdf4254328170 100644
--- a/pkgs/development/libraries/google-cloud-cpp/default.nix
+++ b/pkgs/development/libraries/google-cloud-cpp/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, clang-tools, grpc, curl, cmake, pkg-config, fetchFromGitHub, doxygen, protobuf, crc32c, c-ares, fetchurl, openssl, zlib }:
+{ lib, stdenv, clang-tools, grpc, curl, cmake, pkg-config, fetchFromGitHub, doxygen, protobuf, crc32c, c-ares, fetchurl, openssl, zlib }:
 let
   googleapis = fetchFromGitHub {
     owner = "googleapis";
@@ -53,7 +53,7 @@ in stdenv.mkDerivation rec {
     "-DBUILD_SHARED_LIBS:BOOL=ON"
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     license = with licenses; [ asl20 ];
     homepage = "https://github.com/googleapis/google-cloud-cpp";
     description = "C++ Idiomatic Clients for Google Cloud Platform services";
diff --git a/pkgs/development/libraries/gpgme/default.nix b/pkgs/development/libraries/gpgme/default.nix
index 4b96b493cf5e0..5b24955af437c 100644
--- a/pkgs/development/libraries/gpgme/default.nix
+++ b/pkgs/development/libraries/gpgme/default.nix
@@ -72,7 +72,7 @@ stdenv.mkDerivation rec {
 
   doCheck = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://gnupg.org/software/gpgme/index.html";
     changelog = "https://git.gnupg.org/cgi-bin/gitweb.cgi?p=gpgme.git;a=blob;f=NEWS;hb=refs/tags/gpgme-${version}";
     description = "Library for making GnuPG easier to use";
diff --git a/pkgs/development/libraries/grail/default.nix b/pkgs/development/libraries/grail/default.nix
index bd1c8434949c9..b11ec3a9f5c3d 100644
--- a/pkgs/development/libraries/grail/default.nix
+++ b/pkgs/development/libraries/grail/default.nix
@@ -1,5 +1,5 @@
 { enableX11 ? true,
-  stdenv, fetchurl, pkg-config, xorg, python3, frame }:
+  lib, stdenv, fetchurl, pkg-config, xorg, python3, frame }:
 
 stdenv.mkDerivation rec {
   pname = "grail";
@@ -12,14 +12,14 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ pkg-config ];
   buildInputs = [ python3 frame ]
-  ++ stdenv.lib.optionals enableX11 [xorg.libX11 xorg.libXtst xorg.libXext xorg.libXi xorg.libXfixes];
+  ++ lib.optionals enableX11 [xorg.libX11 xorg.libXtst xorg.libXext xorg.libXi xorg.libXfixes];
 
-  configureFlags = stdenv.lib.optional enableX11 "--with-x11";
+  configureFlags = lib.optional enableX11 "--with-x11";
 
   meta = {
     homepage = "https://launchpad.net/canonical-multitouch/grail";
     description = "Gesture Recognition And Instantiation Library";
-    license = stdenv.lib.licenses.gpl2;
-    platforms = stdenv.lib.platforms.linux;
+    license = lib.licenses.gpl2;
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/development/libraries/grantlee/default.nix b/pkgs/development/libraries/grantlee/default.nix
index 627a345efade5..869430538e898 100644
--- a/pkgs/development/libraries/grantlee/default.nix
+++ b/pkgs/development/libraries/grantlee/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, qt4, cmake }:
+{ lib, stdenv, fetchurl, qt4, cmake }:
 
 stdenv.mkDerivation rec {
   name = "grantlee-0.5.1";
@@ -27,7 +27,7 @@ stdenv.mkDerivation rec {
       and the design of Django is reused in Grantlee.'';
 
     homepage = "http://gitorious.org/grantlee";
-    license = stdenv.lib.licenses.lgpl21;
+    license = lib.licenses.lgpl21;
     inherit (qt4.meta) platforms;
   };
 }
diff --git a/pkgs/development/libraries/graphene-hardened-malloc/default.nix b/pkgs/development/libraries/graphene-hardened-malloc/default.nix
index c60b09144929c..726666ec06f3f 100644
--- a/pkgs/development/libraries/graphene-hardened-malloc/default.nix
+++ b/pkgs/development/libraries/graphene-hardened-malloc/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
   pname = "graphene-hardened-malloc";
@@ -42,7 +42,7 @@ stdenv.mkDerivation rec {
     popd
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/GrapheneOS/hardened_malloc";
     description = "Hardened allocator designed for modern systems";
     longDescription = ''
diff --git a/pkgs/development/libraries/graphene/default.nix b/pkgs/development/libraries/graphene/default.nix
index f72b354f16143..57cad44976536 100644
--- a/pkgs/development/libraries/graphene/default.nix
+++ b/pkgs/development/libraries/graphene/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , nix-update-script
 , pkg-config
@@ -69,7 +69,7 @@ stdenv.mkDerivation rec {
     };
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A thin layer of graphic data types";
     homepage = "https://ebassi.github.com/graphene";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/grib-api/default.nix b/pkgs/development/libraries/grib-api/default.nix
index 0a057ba4aa15a..182f05a8ca895 100644
--- a/pkgs/development/libraries/grib-api/default.nix
+++ b/pkgs/development/libraries/grib-api/default.nix
@@ -1,4 +1,4 @@
-{ fetchurl, fetchpatch, stdenv,
+{ fetchurl, fetchpatch, lib, stdenv,
   cmake, netcdf, gfortran, libpng, openjpeg,
   enablePython ? false, pythonPackages }:
 
@@ -27,11 +27,11 @@ stdenv.mkDerivation rec {
   buildInputs = [ netcdf
                   libpng
                   openjpeg
-                ] ++ stdenv.lib.optionals enablePython [
+                ] ++ lib.optionals enablePython [
                   pythonPackages.python
                 ];
 
-  propagatedBuildInputs = stdenv.lib.optionals enablePython [
+  propagatedBuildInputs = lib.optionals enablePython [
                   pythonPackages.numpy
                 ];
 
@@ -46,14 +46,14 @@ stdenv.mkDerivation rec {
   # Only do tests that don't require downloading 120MB of testdata
   # We fix the darwin checkPhase, which searches for libgrib_api.dylib
   # in /nix/store by setting DYLD_LIBRARY_PATH
-  checkPhase = stdenv.lib.optionalString (stdenv.isDarwin) ''
+  checkPhase = lib.optionalString (stdenv.isDarwin) ''
     substituteInPlace "tests/include.sh" --replace "set -ea" "set -ea; export DYLD_LIBRARY_PATH=$(pwd)/lib"
   '' + ''
     ctest -R "t_definitions|t_calendar|t_unit_tests" -VV
   '';
 
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://software.ecmwf.int/wiki/display/GRIB/Home";
     license = licenses.asl20;
     platforms = with platforms; linux ++ darwin;
diff --git a/pkgs/development/libraries/grilo-plugins/default.nix b/pkgs/development/libraries/grilo-plugins/default.nix
index 07bad7745d6c7..b80e6256e4673 100644
--- a/pkgs/development/libraries/grilo-plugins/default.nix
+++ b/pkgs/development/libraries/grilo-plugins/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , substituteAll
 , meson
@@ -34,7 +34,7 @@ stdenv.mkDerivation rec {
   version = "0.3.12";
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "0xr59gzb8gw2bgj14mjllgn8y7srh373j0fp0v16ak8nd84dzdn6";
   };
 
@@ -45,7 +45,7 @@ stdenv.mkDerivation rec {
     # * chromaprint (gst-plugins-bad)
     (substituteAll {
       src = ./chromaprint-gst-plugins.patch;
-      load_plugins = stdenv.lib.concatMapStrings (plugin: ''gst_registry_scan_path(gst_registry_get(), "${plugin}/lib/gstreamer-1.0");'') (with gst_all_1; [
+      load_plugins = lib.concatMapStrings (plugin: ''gst_registry_scan_path(gst_registry_get(), "${plugin}/lib/gstreamer-1.0");'') (with gst_all_1; [
         gstreamer
         gst-plugins-base
         gst-plugins-bad
@@ -91,7 +91,7 @@ stdenv.mkDerivation rec {
     };
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://wiki.gnome.org/Projects/Grilo";
     description = "A collection of plugins for the Grilo framework";
     maintainers = teams.gnome.members;
diff --git a/pkgs/development/libraries/grilo/default.nix b/pkgs/development/libraries/grilo/default.nix
index 7a3667af880c5..fbab49273e82b 100644
--- a/pkgs/development/libraries/grilo/default.nix
+++ b/pkgs/development/libraries/grilo/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, meson, ninja, pkg-config, gettext, vala, glib, liboauth, gtk3
+{ lib, stdenv, fetchurl, meson, ninja, pkg-config, gettext, vala, glib, liboauth, gtk3
 , gtk-doc, docbook_xsl, docbook_xml_dtd_43
 , libxml2, gnome3, gobject-introspection, libsoup, totem-pl-parser }:
 
@@ -12,7 +12,7 @@ in stdenv.mkDerivation rec {
   outputBin = "dev";
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${name}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${name}.tar.xz";
     sha256 = "0ywjvh7xw4ql1q4fvl0q5n06n08pga1g1nc9l7c3x5214gr3fj6i";
   };
 
@@ -35,7 +35,7 @@ in stdenv.mkDerivation rec {
     };
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://wiki.gnome.org/Projects/Grilo";
     description = "Framework that provides access to various sources of multimedia content, using a pluggable system";
     maintainers = teams.gnome.members;
diff --git a/pkgs/development/libraries/grpc/default.nix b/pkgs/development/libraries/grpc/default.nix
index e24967eb30f1d..92cf619ab5bd6 100644
--- a/pkgs/development/libraries/grpc/default.nix
+++ b/pkgs/development/libraries/grpc/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, fetchpatch, cmake, zlib, c-ares, pkg-config, openssl, protobuf
+{ lib, stdenv, fetchFromGitHub, fetchpatch, cmake, zlib, c-ares, pkg-config, openssl, protobuf
 , gflags, abseil-cpp, libnsl
 }:
 
@@ -22,7 +22,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ cmake pkg-config ];
   buildInputs = [ zlib c-ares c-ares.cmake-config openssl protobuf gflags abseil-cpp ]
-    ++ stdenv.lib.optionals stdenv.isLinux [ libnsl ];
+    ++ lib.optionals stdenv.isLinux [ libnsl ];
 
   cmakeFlags =
     [ "-DgRPC_ZLIB_PROVIDER=package"
@@ -45,11 +45,11 @@ stdenv.mkDerivation rec {
     export LD_LIBRARY_PATH=$(pwd)''${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH
   '';
 
-  NIX_CFLAGS_COMPILE = stdenv.lib.optionalString stdenv.cc.isClang "-Wno-error=unknown-warning-option";
+  NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isClang "-Wno-error=unknown-warning-option";
 
   enableParallelBuilds = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "The C based gRPC (C++, Python, Ruby, Objective-C, PHP, C#)";
     license = licenses.asl20;
     maintainers = [ maintainers.lnl7 maintainers.marsam ];
diff --git a/pkgs/development/libraries/gsasl/default.nix b/pkgs/development/libraries/gsasl/default.nix
index 4e22c38e9c84a..48ee0ddd4a510 100644
--- a/pkgs/development/libraries/gsasl/default.nix
+++ b/pkgs/development/libraries/gsasl/default.nix
@@ -1,4 +1,4 @@
-{ fetchurl, stdenv, libidn, kerberos }:
+{ fetchurl, lib, stdenv, libidn, kerberos }:
 
 stdenv.mkDerivation rec {
   name = "gsasl-1.8.0";
@@ -28,9 +28,9 @@ stdenv.mkDerivation rec {
        '';
 
     homepage = "https://www.gnu.org/software/gsasl/";
-    license = stdenv.lib.licenses.gpl3Plus;
+    license = lib.licenses.gpl3Plus;
 
-    maintainers = with stdenv.lib.maintainers; [ shlevy ];
-    platforms = stdenv.lib.platforms.all;
+    maintainers = with lib.maintainers; [ shlevy ];
+    platforms = lib.platforms.all;
   };
 }
diff --git a/pkgs/development/libraries/gsettings-desktop-schemas/default.nix b/pkgs/development/libraries/gsettings-desktop-schemas/default.nix
index 3c6b2688b773e..318d07dfacc88 100644
--- a/pkgs/development/libraries/gsettings-desktop-schemas/default.nix
+++ b/pkgs/development/libraries/gsettings-desktop-schemas/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , pkg-config
 , glib
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
   version = "3.38.0";
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "0rwcg9sd5rv7gjwapcd1jjk6l16w0p3j7wkicq1rdch4c0kch12p";
   };
 
@@ -57,7 +57,7 @@ stdenv.mkDerivation rec {
     };
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Collection of GSettings schemas for settings shared by various components of a desktop";
     license = licenses.lgpl21Plus;
     maintainers = teams.gnome.members;
diff --git a/pkgs/development/libraries/gsettings-qt/default.nix b/pkgs/development/libraries/gsettings-qt/default.nix
index 9bb6bd17f4099..21b63875db6cd 100644
--- a/pkgs/development/libraries/gsettings-qt/default.nix
+++ b/pkgs/development/libraries/gsettings-qt/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitLab, pkg-config
+{ lib, stdenv, fetchFromGitLab, pkg-config
 , qmake, qtbase, qtdeclarative, wrapQtAppsHook
 , glib, gobject-introspection
 , genericUpdater, common-updater-scripts
@@ -61,7 +61,7 @@ stdenv.mkDerivation rec {
     versionLister = "${common-updater-scripts}/bin/list-git-tags ${src.meta.homepage}";
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Library to access GSettings from Qt";
     homepage = "https://gitlab.com/ubports/core/gsettings-qt";
     license = licenses.lgpl3;
diff --git a/pkgs/development/libraries/gsignond/default.nix b/pkgs/development/libraries/gsignond/default.nix
index dda751acfb1a5..92123dbc3ea55 100644
--- a/pkgs/development/libraries/gsignond/default.nix
+++ b/pkgs/development/libraries/gsignond/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitLab, pkg-config, meson, ninja, glib, glib-networking
+{ lib, stdenv, fetchFromGitLab, pkg-config, meson, ninja, glib, glib-networking
 , sqlite, gobject-introspection, vala, gtk-doc, libsecret, docbook_xsl
 , docbook_xml_dtd_43, docbook_xml_dtd_45, glibcLocales, makeWrapper
 , symlinkJoin, gsignondPlugins, plugins }:
@@ -50,7 +50,7 @@ unwrapped = stdenv.mkDerivation rec {
     ./plugin-load-env.patch
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "D-Bus service which performs user authentication on behalf of its clients";
     homepage = "https://gitlab.com/accounts-sso/gsignond";
     license = licenses.lgpl21Plus;
diff --git a/pkgs/development/libraries/gsignond/plugins/lastfm.nix b/pkgs/development/libraries/gsignond/plugins/lastfm.nix
index 72d1a8e90ff69..a05069f205feb 100644
--- a/pkgs/development/libraries/gsignond/plugins/lastfm.nix
+++ b/pkgs/development/libraries/gsignond/plugins/lastfm.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitLab, pkg-config, meson, ninja, vala, glib, gsignond, json-glib, libsoup, gobject-introspection }:
+{ lib, stdenv, fetchFromGitLab, pkg-config, meson, ninja, vala, glib, gsignond, json-glib, libsoup, gobject-introspection }:
 
 stdenv.mkDerivation {
   pname = "gsignond-plugin-lastfm";
@@ -28,7 +28,7 @@ stdenv.mkDerivation {
 
   PKG_CONFIG_GSIGNOND_GPLUGINSDIR = "${placeholder "out"}/lib/gsignond/gplugins";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Plugin for the Accounts-SSO gSignOn daemon that handles Last.FM credentials";
     homepage = "https://gitlab.com/accounts-sso/gsignond-plugin-lastfm";
     license = licenses.lgpl21Plus;
diff --git a/pkgs/development/libraries/gsignond/plugins/mail.nix b/pkgs/development/libraries/gsignond/plugins/mail.nix
index 240d47f6dd2de..8bce32f976ab6 100644
--- a/pkgs/development/libraries/gsignond/plugins/mail.nix
+++ b/pkgs/development/libraries/gsignond/plugins/mail.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitLab, pkg-config, meson, ninja, vala, glib, gsignond, gobject-introspection }:
+{ lib, stdenv, fetchFromGitLab, pkg-config, meson, ninja, vala, glib, gsignond, gobject-introspection }:
 
 stdenv.mkDerivation rec {
   pname = "gsignond-plugin-mail";
@@ -26,7 +26,7 @@ stdenv.mkDerivation rec {
 
   PKG_CONFIG_GSIGNOND_GPLUGINSDIR = "${placeholder "out"}/lib/gsignond/gplugins";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Plugin for the Accounts-SSO gSignOn daemon that handles E-Mail credentials";
     homepage = "https://gitlab.com/accounts-sso/gsignond-plugin-mail";
     license = licenses.lgpl21Plus;
diff --git a/pkgs/development/libraries/gsignond/plugins/oauth.nix b/pkgs/development/libraries/gsignond/plugins/oauth.nix
index b1d673eea952f..3bf3ab1946433 100644
--- a/pkgs/development/libraries/gsignond/plugins/oauth.nix
+++ b/pkgs/development/libraries/gsignond/plugins/oauth.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitLab, pkg-config, meson, ninja, glib, gsignond, check
+{ lib, stdenv, fetchFromGitLab, pkg-config, meson, ninja, glib, gsignond, check
 , json-glib, libsoup, gnutls, gtk-doc, docbook_xml_dtd_43, docbook_xml_dtd_45
 , docbook_xsl, glibcLocales, gobject-introspection }:
 
@@ -38,7 +38,7 @@ stdenv.mkDerivation {
 
   PKG_CONFIG_GSIGNOND_GPLUGINSDIR = "${placeholder "out"}/lib/gsignond/gplugins";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Plugin for the Accounts-SSO gSignOn daemon that handles the OAuth 1.0 and 2.0 authentication protocols";
     homepage = "https://gitlab.com/accounts-sso/gsignond-plugin-oa";
     license = licenses.lgpl21Plus;
diff --git a/pkgs/development/libraries/gsignond/plugins/sasl.nix b/pkgs/development/libraries/gsignond/plugins/sasl.nix
index 8fc633838311b..b73559f8a532a 100644
--- a/pkgs/development/libraries/gsignond/plugins/sasl.nix
+++ b/pkgs/development/libraries/gsignond/plugins/sasl.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitLab, pkg-config, meson, ninja, glib, gsignond, gsasl, check
+{ lib, stdenv, fetchFromGitLab, pkg-config, meson, ninja, glib, gsignond, gsasl, check
 , gtk-doc, docbook_xml_dtd_43, docbook_xml_dtd_45, docbook_xsl, glibcLocales, gobject-introspection }:
 
 stdenv.mkDerivation {
@@ -35,7 +35,7 @@ stdenv.mkDerivation {
 
   PKG_CONFIG_GSIGNOND_GPLUGINSDIR = "${placeholder "out"}/lib/gsignond/gplugins";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Plugin for the Accounts-SSO gSignOn daemon that handles the SASL authentication protocol";
     homepage = "https://gitlab.com/accounts-sso/gsignond-plugin-sasl";
     license = licenses.lgpl21Plus;
diff --git a/pkgs/development/libraries/gsl/default.nix b/pkgs/development/libraries/gsl/default.nix
index 4a9208cff32a4..04c8bcbbbecc6 100644
--- a/pkgs/development/libraries/gsl/default.nix
+++ b/pkgs/development/libraries/gsl/default.nix
@@ -1,4 +1,4 @@
-{ fetchurl, stdenv }:
+{ fetchurl, lib, stdenv }:
 
 stdenv.mkDerivation rec {
   name = "gsl-2.6";
@@ -9,7 +9,7 @@ stdenv.mkDerivation rec {
   };
 
   # do not let -march=skylake to enable FMA (https://lists.gnu.org/archive/html/bug-gsl/2011-11/msg00019.html)
-  NIX_CFLAGS_COMPILE = stdenv.lib.optionalString stdenv.isx86_64 "-mno-fma";
+  NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isx86_64 "-mno-fma";
 
   # https://lists.gnu.org/archive/html/bug-gsl/2015-11/msg00012.html
   doCheck = stdenv.hostPlatform.system != "i686-linux" && stdenv.hostPlatform.system != "aarch64-linux";
@@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
   meta = {
     description = "The GNU Scientific Library, a large numerical library";
     homepage = "https://www.gnu.org/software/gsl/";
-    license = stdenv.lib.licenses.gpl3Plus;
+    license = lib.licenses.gpl3Plus;
 
     longDescription = ''
       The GNU Scientific Library (GSL) is a numerical library for C
@@ -29,6 +29,6 @@ stdenv.mkDerivation rec {
       fitting.  There are over 1000 functions in total with an
       extensive test suite.
     '';
-    platforms = stdenv.lib.platforms.unix;
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/gsl/gsl-1_16.nix b/pkgs/development/libraries/gsl/gsl-1_16.nix
index 9a31563c6cca4..d266518757561 100644
--- a/pkgs/development/libraries/gsl/gsl-1_16.nix
+++ b/pkgs/development/libraries/gsl/gsl-1_16.nix
@@ -1,4 +1,4 @@
-{ fetchurl, fetchpatch, stdenv }:
+{ fetchurl, fetchpatch, lib, stdenv }:
 
 stdenv.mkDerivation rec {
   name = "gsl-1.16";
@@ -9,7 +9,7 @@ stdenv.mkDerivation rec {
   };
 
   # do not let -march=skylake to enable FMA (https://lists.gnu.org/archive/html/bug-gsl/2011-11/msg00019.html)
-  NIX_CFLAGS_COMPILE = stdenv.lib.optionalString stdenv.isx86_64 "-mno-fma";
+  NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isx86_64 "-mno-fma";
 
   patches = [
     (fetchpatch {
@@ -24,7 +24,7 @@ stdenv.mkDerivation rec {
   meta = {
     description = "The GNU Scientific Library, a large numerical library";
     homepage = "https://www.gnu.org/software/gsl/";
-    license = stdenv.lib.licenses.gpl3Plus;
+    license = lib.licenses.gpl3Plus;
 
     longDescription = ''
       The GNU Scientific Library (GSL) is a numerical library for C
@@ -36,7 +36,7 @@ stdenv.mkDerivation rec {
       fitting.  There are over 1000 functions in total with an
       extensive test suite.
     '';
-    platforms = stdenv.lib.platforms.unix;
+    platforms = lib.platforms.unix;
     # Failing "eigen" tests on aarch64.
     badPlatforms = [ "aarch64-linux" ];
   };
diff --git a/pkgs/development/libraries/gsm/default.nix b/pkgs/development/libraries/gsm/default.nix
index 7214aa6f6b9cf..13088dda0c911 100644
--- a/pkgs/development/libraries/gsm/default.nix
+++ b/pkgs/development/libraries/gsm/default.nix
@@ -1,11 +1,11 @@
-{ stdenv, fetchurl
+{ lib, stdenv, fetchurl
 , # Compile statically (support for packages that look for the static object)
   staticSupport ? stdenv.hostPlatform.isStatic
 }:
 
 let
   inherit (stdenv) isDarwin;
-  inherit (stdenv.lib) optional optionalString;
+  inherit (lib) optional optionalString;
 in
 
 stdenv.mkDerivation rec {
@@ -44,7 +44,7 @@ stdenv.mkDerivation rec {
 
   parallelBuild = false;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Lossy speech compression codec";
     homepage    = "http://www.quut.com/gsm/";
     license     = licenses.bsd2;
diff --git a/pkgs/development/libraries/gsmlib/default.nix b/pkgs/development/libraries/gsmlib/default.nix
index 88bec83e624f4..ec6646d98f572 100644
--- a/pkgs/development/libraries/gsmlib/default.nix
+++ b/pkgs/development/libraries/gsmlib/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, autoreconfHook }:
+{ lib, stdenv, fetchFromGitHub, autoreconfHook }:
 stdenv.mkDerivation rec {
   pname = "gsmlib";
   version = "unstable-2017-10-06";
@@ -9,7 +9,7 @@ stdenv.mkDerivation rec {
     sha256 = "16v8aj914ac1ipf14a867ljib3gy7fhzd9ypxnsg9l0zi8mm3ml5";
   };
   nativeBuildInputs = [ autoreconfHook ];
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Library to access GSM mobile phones through GSM modems";
     homepage = "https://github.com/x-logLT/gsmlib";
     license = licenses.lgpl2;
diff --git a/pkgs/development/libraries/gsoap/default.nix b/pkgs/development/libraries/gsoap/default.nix
index 2614c50cca78f..08b8146ac0a80 100644
--- a/pkgs/development/libraries/gsoap/default.nix
+++ b/pkgs/development/libraries/gsoap/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, autoreconfHook, unzip, m4, bison, flex, openssl, zlib }:
+{ lib, stdenv, fetchurl, autoreconfHook, unzip, m4, bison, flex, openssl, zlib }:
 
 let
   majorVersion = "2.8";
@@ -24,7 +24,7 @@ in stdenv.mkDerivation rec {
       --replace 'AM_INIT_AUTOMAKE([foreign])' 'AM_INIT_AUTOMAKE([foreign subdir-objects])'
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "C/C++ toolkit for SOAP web services and XML-based applications";
     homepage = "http://www.cs.fsu.edu/~engelen/soap.html";
     # gsoap is dual/triple licensed (see homepage for details):
diff --git a/pkgs/development/libraries/gsound/default.nix b/pkgs/development/libraries/gsound/default.nix
index 9fc099fd3dd0b..2a3e846d38d68 100644
--- a/pkgs/development/libraries/gsound/default.nix
+++ b/pkgs/development/libraries/gsound/default.nix
@@ -1,11 +1,11 @@
-{ stdenv, fetchurl, pkg-config, glib, vala, libcanberra, gobject-introspection, libtool, gnome3 }:
+{ lib, stdenv, fetchurl, pkg-config, glib, vala, libcanberra, gobject-introspection, libtool, gnome3 }:
 
 stdenv.mkDerivation rec {
   pname = "gsound";
   version = "1.0.2";
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "bba8ff30eea815037e53bee727bbd5f0b6a2e74d452a7711b819a7c444e78e53";
   };
 
@@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
     };
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://wiki.gnome.org/Projects/GSound";
     description = "Small library for playing system sounds";
     maintainers = teams.gnome.members;
diff --git a/pkgs/development/libraries/gspell/default.nix b/pkgs/development/libraries/gspell/default.nix
index a240db6c04db7..890fcb9811819 100644
--- a/pkgs/development/libraries/gspell/default.nix
+++ b/pkgs/development/libraries/gspell/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , pkg-config
 , libxml2
@@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
   outputBin = "dev";
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "1pdb4gbjrs8mk6r0ipw5vxyvzav1wvkjq46kiq53r3nyznfpdfyw";
   };
 
@@ -48,7 +48,7 @@ stdenv.mkDerivation rec {
     };
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A spell-checking library for GTK applications";
     homepage = "https://wiki.gnome.org/Projects/gspell";
     license = licenses.lgpl21Plus;
diff --git a/pkgs/development/libraries/gss/default.nix b/pkgs/development/libraries/gss/default.nix
index 363e7ba7d10f6..ec4e54c339b08 100644
--- a/pkgs/development/libraries/gss/default.nix
+++ b/pkgs/development/libraries/gss/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl
+{ lib, stdenv, fetchurl
 , withShishi ? !stdenv.isDarwin, shishi ? null
 }:
 
@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
     sha256 = "1syyvh3k659xf1hdv9pilnnhbbhs6vfapayp4xgdcc8mfgf9v4gz";
   };
 
-  buildInputs = stdenv.lib.optional withShishi shishi;
+  buildInputs = lib.optional withShishi shishi;
 
   configureFlags = [
     "--${if withShishi != null then "enable" else "disable"}-kereberos5"
@@ -21,11 +21,11 @@ stdenv.mkDerivation rec {
   doCheck = true;
 
   # Fixup .la files
-  postInstall = stdenv.lib.optionalString withShishi ''
+  postInstall = lib.optionalString withShishi ''
     sed -i 's,\(-lshishi\),-L${shishi}/lib \1,' $out/lib/libgss.la
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://www.gnu.org/software/gss/";
     description = "Generic Security Service";
     license = licenses.gpl3Plus;
diff --git a/pkgs/development/libraries/gssdp/default.nix b/pkgs/development/libraries/gssdp/default.nix
index 0ab377c2e29df..440caba254761 100644
--- a/pkgs/development/libraries/gssdp/default.nix
+++ b/pkgs/development/libraries/gssdp/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , meson
 , ninja
@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
   outputs = [ "out" "bin" "dev" "devdoc" ];
 
   src = fetchurl {
-    url = "mirror://gnome/sources/gssdp/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/gssdp/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "1s57i8a8wnnxnsfl27cq4503dkdlzbrhry5zpg23sfqfffvdqqx2";
   };
 
@@ -57,7 +57,7 @@ stdenv.mkDerivation rec {
     };
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "GObject-based API for handling resource discovery and announcement over SSDP";
     homepage = "http://www.gupnp.org/";
     license = licenses.lgpl2Plus;
diff --git a/pkgs/development/libraries/gstreamer/bad/default.nix b/pkgs/development/libraries/gstreamer/bad/default.nix
index 58b33f6c2f985..313a063cae898 100644
--- a/pkgs/development/libraries/gstreamer/bad/default.nix
+++ b/pkgs/development/libraries/gstreamer/bad/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , fetchpatch
 , meson
@@ -86,7 +86,7 @@
 assert faacSupport -> faac != null;
 
 let
-  inherit (stdenv.lib) optional optionals;
+  inherit (lib) optional optionals;
 in stdenv.mkDerivation rec {
   pname = "gst-plugins-bad";
   version = "1.18.2";
@@ -293,7 +293,7 @@ in stdenv.mkDerivation rec {
 
   doCheck = false; # fails 20 out of 58 tests, expensive
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "GStreamer Bad Plugins";
     homepage = "https://gstreamer.freedesktop.org";
     longDescription = ''
diff --git a/pkgs/development/libraries/gstreamer/devtools/default.nix b/pkgs/development/libraries/gstreamer/devtools/default.nix
index 1665c7f8a1334..dc53a76bbca6a 100644
--- a/pkgs/development/libraries/gstreamer/devtools/default.nix
+++ b/pkgs/development/libraries/gstreamer/devtools/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , meson
 , ninja
@@ -53,7 +53,7 @@ stdenv.mkDerivation rec {
     "-Ddoc=disabled" # `hotdoc` not packaged in nixpkgs as of writing
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Integration testing infrastructure for the GStreamer framework";
     homepage = "https://gstreamer.freedesktop.org";
     license = licenses.lgpl2Plus;
diff --git a/pkgs/development/libraries/gstreamer/ges/default.nix b/pkgs/development/libraries/gstreamer/ges/default.nix
index 4ccb2e2c286ab..ebd5f83dd15fd 100644
--- a/pkgs/development/libraries/gstreamer/ges/default.nix
+++ b/pkgs/development/libraries/gstreamer/ges/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , meson
 , ninja
@@ -66,7 +66,7 @@ stdenv.mkDerivation rec {
       scripts/extract-release-date-from-doap-file.py
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Library for creation of audio/video non-linear editors";
     homepage = "https://gstreamer.freedesktop.org";
     license = licenses.lgpl2Plus;
diff --git a/pkgs/development/libraries/gstreamer/good/default.nix b/pkgs/development/libraries/gstreamer/good/default.nix
index 4bbdfdad69d0d..a032f5f5b5a49 100644
--- a/pkgs/development/libraries/gstreamer/good/default.nix
+++ b/pkgs/development/libraries/gstreamer/good/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , meson
 , nasm
@@ -47,7 +47,7 @@ assert gtkSupport -> gtk3 != null;
 assert raspiCameraSupport -> ((libraspberrypi != null) && stdenv.isLinux && stdenv.isAarch64);
 
 let
-  inherit (stdenv.lib) optionals;
+  inherit (lib) optionals;
 in
 stdenv.mkDerivation rec {
   pname = "gst-plugins-good";
@@ -150,7 +150,7 @@ stdenv.mkDerivation rec {
   # fails 1 tests with "Unexpected critical/warning: g_object_set_is_valid_property: object class 'GstRtpStorage' has no property named ''"
   doCheck = false;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "GStreamer Good Plugins";
     homepage = "https://gstreamer.freedesktop.org";
     longDescription = ''
diff --git a/pkgs/development/libraries/gstreamer/gstreamermm/default.nix b/pkgs/development/libraries/gstreamer/gstreamermm/default.nix
index 51d0fcc8efda3..2c683a84da4d3 100644
--- a/pkgs/development/libraries/gstreamer/gstreamermm/default.nix
+++ b/pkgs/development/libraries/gstreamer/gstreamermm/default.nix
@@ -1,10 +1,10 @@
-{ stdenv, fetchurl, pkg-config, file, glibmm, gst_all_1, gnome3 }:
+{ lib, stdenv, fetchurl, pkg-config, file, glibmm, gst_all_1, gnome3 }:
 stdenv.mkDerivation rec {
   pname = "gstreamermm";
   version = "1.10.0";
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "0q4dx9sncqbwgpzma0zvj6zssc279yl80pn8irb95qypyyggwn5y";
   };
 
@@ -23,7 +23,7 @@ stdenv.mkDerivation rec {
     };
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "C++ interface for GStreamer";
     homepage = "https://gstreamer.freedesktop.org/bindings/cplusplus.html";
     license = licenses.lgpl21Plus;
diff --git a/pkgs/development/libraries/gstreamer/rtsp-server/default.nix b/pkgs/development/libraries/gstreamer/rtsp-server/default.nix
index 16de3a6e65f83..bcecd11ce2d23 100644
--- a/pkgs/development/libraries/gstreamer/rtsp-server/default.nix
+++ b/pkgs/development/libraries/gstreamer/rtsp-server/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , meson
 , ninja
@@ -61,7 +61,7 @@ stdenv.mkDerivation rec {
       scripts/extract-release-date-from-doap-file.py
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "GStreamer RTSP server";
     homepage = "https://gstreamer.freedesktop.org";
     longDescription = ''
diff --git a/pkgs/development/libraries/gstreamer/vaapi/default.nix b/pkgs/development/libraries/gstreamer/vaapi/default.nix
index e758568b2bb49..a90d21c28e8c9 100644
--- a/pkgs/development/libraries/gstreamer/vaapi/default.nix
+++ b/pkgs/development/libraries/gstreamer/vaapi/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , meson
 , ninja
@@ -75,7 +75,7 @@ stdenv.mkDerivation rec {
       scripts/extract-release-date-from-doap-file.py
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Set of VAAPI GStreamer Plug-ins";
     homepage = "https://gstreamer.freedesktop.org";
     license = licenses.lgpl21Plus;
diff --git a/pkgs/development/libraries/gtdialog/default.nix b/pkgs/development/libraries/gtdialog/default.nix
index 7b25d6dd725ce..1dbcd37cf4bd6 100644
--- a/pkgs/development/libraries/gtdialog/default.nix
+++ b/pkgs/development/libraries/gtdialog/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, cdk, unzip, gtk2, glib, ncurses, pkg-config}:
+{lib, stdenv, fetchurl, cdk, unzip, gtk2, glib, ncurses, pkg-config}:
 let
   s = # Generated upstream information
   rec {
@@ -24,9 +24,9 @@ stdenv.mkDerivation {
   meta = {
     inherit (s) version;
     description = ''Cross-platform helper for creating interactive dialogs'';
-    license = stdenv.lib.licenses.mit ;
-    maintainers = [stdenv.lib.maintainers.raskin];
-    platforms = stdenv.lib.platforms.linux;
+    license = lib.licenses.mit ;
+    maintainers = [lib.maintainers.raskin];
+    platforms = lib.platforms.linux;
     homepage = "http://foicica.com/gtdialog";
     downloadPage = "http://foicica.com/gtdialog/download";
   };
diff --git a/pkgs/development/libraries/gtest/default.nix b/pkgs/development/libraries/gtest/default.nix
index 4e8ce95737d91..d15ce77213ca4 100644
--- a/pkgs/development/libraries/gtest/default.nix
+++ b/pkgs/development/libraries/gtest/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, cmake, ninja, fetchFromGitHub, fetchpatch }:
+{ lib, stdenv, cmake, ninja, fetchFromGitHub, fetchpatch }:
 
 stdenv.mkDerivation rec {
   pname = "gtest";
@@ -26,7 +26,7 @@ stdenv.mkDerivation rec {
 
   cmakeFlags = [ "-DBUILD_SHARED_LIBS=ON" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Google's framework for writing C++ tests";
     homepage = "https://github.com/google/googletest";
     license = licenses.bsd3;
diff --git a/pkgs/development/libraries/gthree/default.nix b/pkgs/development/libraries/gthree/default.nix
index 2da9847f3cb45..990e151efe444 100644
--- a/pkgs/development/libraries/gthree/default.nix
+++ b/pkgs/development/libraries/gthree/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , fetchpatch
 , ninja
@@ -63,7 +63,7 @@ stdenv.mkDerivation rec {
     "-Dexamples=false"
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "GObject/GTK port of three.js";
     homepage = "https://github.com/alexlarsson/gthree";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/gtk-engine-bluecurve/default.nix b/pkgs/development/libraries/gtk-engine-bluecurve/default.nix
index e595f6bf02ddc..84920060c5eab 100644
--- a/pkgs/development/libraries/gtk-engine-bluecurve/default.nix
+++ b/pkgs/development/libraries/gtk-engine-bluecurve/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, intltool, gtk2 }:
+{ lib, stdenv, fetchurl, pkg-config, intltool, gtk2 }:
 
 stdenv.mkDerivation {
   name = "gtk-engine-bluecurve-1.0";
@@ -14,8 +14,8 @@ stdenv.mkDerivation {
 
   meta = {
     description = "Original Bluecurve engine from Red Hat's artwork package";
-    license = stdenv.lib.licenses.gpl2;
-    platforms = stdenv.lib.platforms.linux;
-    maintainers = [ stdenv.lib.maintainers.gnidorah ];
+    license = lib.licenses.gpl2;
+    platforms = lib.platforms.linux;
+    maintainers = [ lib.maintainers.gnidorah ];
   };
 }
diff --git a/pkgs/development/libraries/gtk-engine-murrine/default.nix b/pkgs/development/libraries/gtk-engine-murrine/default.nix
index f5ae9c0552d90..8d40499fb626c 100644
--- a/pkgs/development/libraries/gtk-engine-murrine/default.nix
+++ b/pkgs/development/libraries/gtk-engine-murrine/default.nix
@@ -1,11 +1,11 @@
-{ stdenv, fetchurl, pkg-config, intltool, gtk2 }:
+{ lib, stdenv, fetchurl, pkg-config, intltool, gtk2 }:
 
 stdenv.mkDerivation rec {
   pname = "gtk-engine-murrine";
   version = "0.98.2";
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "129cs5bqw23i76h3nmc29c9mqkm9460iwc8vkl7hs4xr07h8mip9";
   };
 
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
   meta = {
     description = "A very flexible theme engine";
     homepage = "https://gitlab.gnome.org/Archive/murrine";
-    license = stdenv.lib.licenses.lgpl3;
-    platforms = stdenv.lib.platforms.linux;
+    license = lib.licenses.lgpl3;
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/development/libraries/gtk-engines/default.nix b/pkgs/development/libraries/gtk-engines/default.nix
index 077bb53443a20..115547a72f73c 100644
--- a/pkgs/development/libraries/gtk-engines/default.nix
+++ b/pkgs/development/libraries/gtk-engines/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, intltool, gtk2 }:
+{ lib, stdenv, fetchurl, pkg-config, intltool, gtk2 }:
 
 stdenv.mkDerivation {
   name = "gtk-engines-2.20.2";
@@ -13,7 +13,7 @@ stdenv.mkDerivation {
 
   meta = {
     description = "Theme engines for GTK 2";
-    license = stdenv.lib.licenses.lgpl21Plus;
-    platforms = stdenv.lib.platforms.linux;
+    license = lib.licenses.lgpl21Plus;
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/development/libraries/gtk-layer-shell/default.nix b/pkgs/development/libraries/gtk-layer-shell/default.nix
index 1aef590bb92af..56693d24c7a8e 100644
--- a/pkgs/development/libraries/gtk-layer-shell/default.nix
+++ b/pkgs/development/libraries/gtk-layer-shell/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , meson
 , ninja
@@ -43,7 +43,7 @@ stdenv.mkDerivation rec {
     "-Ddocs=true"
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A library to create panels and other desktop components for Wayland using the Layer Shell protocol";
     license = licenses.lgpl3Plus;
     maintainers = with maintainers; [ eonpatapon ];
diff --git a/pkgs/development/libraries/gtk-mac-integration/default.nix b/pkgs/development/libraries/gtk-mac-integration/default.nix
index d6df10db176a8..f244a97edf24b 100644
--- a/pkgs/development/libraries/gtk-mac-integration/default.nix
+++ b/pkgs/development/libraries/gtk-mac-integration/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitLab, autoreconfHook, pkg-config, glib, gtk-doc, gtk, gobject-introspection }:
+{ lib, stdenv, fetchFromGitLab, autoreconfHook, pkg-config, glib, gtk-doc, gtk, gobject-introspection }:
 
 stdenv.mkDerivation rec {
   pname = "gtk-mac-integration";
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
     gtkdocize
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Provides integration for GTK applications into the Mac desktop";
     license = licenses.lgpl21;
     homepage = "https://wiki.gnome.org/Projects/GTK/OSX/Integration";
diff --git a/pkgs/development/libraries/gtk-sharp-beans/default.nix b/pkgs/development/libraries/gtk-sharp-beans/default.nix
index 9daf3bb91e501..69ef71f1506fd 100644
--- a/pkgs/development/libraries/gtk-sharp-beans/default.nix
+++ b/pkgs/development/libraries/gtk-sharp-beans/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, autoreconfHook, which, pkg-config, mono, gtk-sharp-2_0, gio-sharp }:
+{ lib, stdenv, fetchFromGitHub, autoreconfHook, which, pkg-config, mono, gtk-sharp-2_0, gio-sharp }:
 
 stdenv.mkDerivation rec {
   pname = "gtk-sharp-beans";
@@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
 
   dontStrip = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Binds some API from GTK that isn't in GTK# 2.12.x";
     platforms = platforms.linux;
     license = licenses.lgpl21;
diff --git a/pkgs/development/libraries/gtk-sharp/2.0.nix b/pkgs/development/libraries/gtk-sharp/2.0.nix
index 5afcb2d285a2e..1e7c865306582 100644
--- a/pkgs/development/libraries/gtk-sharp/2.0.nix
+++ b/pkgs/development/libraries/gtk-sharp/2.0.nix
@@ -62,7 +62,7 @@ stdenv.mkDerivation rec {
     gtk = gtk2;
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Graphical User Interface Toolkit for mono and .Net";
     homepage = "https://www.mono-project.com/docs/gui/gtksharp";
     platforms = platforms.linux;
diff --git a/pkgs/development/libraries/gtk-sharp/3.0.nix b/pkgs/development/libraries/gtk-sharp/3.0.nix
index 576ad670bdba3..491656a0c6823 100644
--- a/pkgs/development/libraries/gtk-sharp/3.0.nix
+++ b/pkgs/development/libraries/gtk-sharp/3.0.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , fetchpatch
 , pkg-config
@@ -24,7 +24,7 @@ stdenv.mkDerivation rec {
 
   builder = ./builder.sh;
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "18n3l9zcldyvn4lwi8izd62307mkhz873039nl6awrv285qzah34";
   };
 
@@ -53,6 +53,6 @@ stdenv.mkDerivation rec {
   };
 
   meta = {
-    platforms = stdenv.lib.platforms.linux;
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/development/libraries/gtk/2.x.nix b/pkgs/development/libraries/gtk/2.x.nix
index bd1b15b59e27b..43b7ff5f127f7 100644
--- a/pkgs/development/libraries/gtk/2.x.nix
+++ b/pkgs/development/libraries/gtk/2.x.nix
@@ -1,4 +1,4 @@
-{ config, stdenv, fetchurl, pkg-config, gettext, glib, atk, pango, cairo, perl, xorg
+{ config, lib, stdenv, fetchurl, pkg-config, gettext, glib, atk, pango, cairo, perl, xorg
 , gdk-pixbuf, xlibsWrapper, gobject-introspection
 , xineramaSupport ? stdenv.isLinux
 , cupsSupport ? config.gtk2.cups or stdenv.isLinux, cups ? null
@@ -10,7 +10,7 @@
 assert xineramaSupport -> xorg.libXinerama != null;
 assert cupsSupport -> cups != null;
 
-with stdenv.lib;
+with lib;
 
 stdenv.mkDerivation rec {
   pname = "gtk+";
diff --git a/pkgs/development/libraries/gtk/3.x.nix b/pkgs/development/libraries/gtk/3.x.nix
index d802ee7e44f69..21a87de4a1605 100644
--- a/pkgs/development/libraries/gtk/3.x.nix
+++ b/pkgs/development/libraries/gtk/3.x.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , fetchpatch
 , pkg-config
@@ -48,7 +48,7 @@
 
 assert cupsSupport -> cups != null;
 
-with stdenv.lib;
+with lib;
 
 stdenv.mkDerivation rec {
   pname = "gtk+3";
@@ -63,7 +63,7 @@ stdenv.mkDerivation rec {
   ];
 
   src = fetchurl {
-    url = "mirror://gnome/sources/gtk+/${stdenv.lib.versions.majorMinor version}/gtk+-${version}.tar.xz";
+    url = "mirror://gnome/sources/gtk+/${lib.versions.majorMinor version}/gtk+-${version}.tar.xz";
     sha256 = "12ipk1d376bai9v820qzhxba93kkh5abi6mhyqr4hwjvqmkl77fc";
   };
 
diff --git a/pkgs/development/libraries/gtkd/default.nix b/pkgs/development/libraries/gtkd/default.nix
index 89c674f09d5e7..ccaceabd4e98a 100644
--- a/pkgs/development/libraries/gtkd/default.nix
+++ b/pkgs/development/libraries/gtkd/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchzip, fetchpatch, atk, cairo, dmd, gdk-pixbuf, gnome3, gst_all_1, librsvg
+{ lib, stdenv, fetchzip, fetchpatch, atk, cairo, dmd, gdk-pixbuf, gnome3, gst_all_1, librsvg
 , glib, gtk3, gtksourceview4, libgda, libpeas, pango, pkg-config, which, vte }:
 
 let
@@ -129,7 +129,7 @@ in stdenv.mkDerivation rec {
     done
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "D binding and OO wrapper for GTK";
     homepage = "https://gtkd.org";
     license = licenses.lgpl3Plus;
diff --git a/pkgs/development/libraries/gtkdatabox/default.nix b/pkgs/development/libraries/gtkdatabox/default.nix
index 8246d80a10f8a..d7cca43841e4f 100644
--- a/pkgs/development/libraries/gtkdatabox/default.nix
+++ b/pkgs/development/libraries/gtkdatabox/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, gtk2 }:
+{ lib, stdenv, fetchurl, pkg-config, gtk2 }:
 
 stdenv.mkDerivation rec {
   name = "gtkdatabox-0.9.3.1";
@@ -15,8 +15,8 @@ stdenv.mkDerivation rec {
   meta = {
     description = "GTK widget for displaying large amounts of numerical data";
 
-    license = stdenv.lib.licenses.lgpl2;
+    license = lib.licenses.lgpl2;
 
-    platforms = stdenv.lib.platforms.linux;
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/development/libraries/gtkimageview/default.nix b/pkgs/development/libraries/gtkimageview/default.nix
index 65b6fd1b43dc3..438f7feab6ce0 100644
--- a/pkgs/development/libraries/gtkimageview/default.nix
+++ b/pkgs/development/libraries/gtkimageview/default.nix
@@ -1,4 +1,4 @@
-{ fetchurl, stdenv, pkg-config, gtk2 }:
+{ fetchurl, lib, stdenv, pkg-config, gtk2 }:
 
 stdenv.mkDerivation rec {
   name = "gtkimageview-1.6.4";
@@ -31,9 +31,9 @@ stdenv.mkDerivation rec {
          interpolation; GIF animation support.
        '';
 
-    license = stdenv.lib.licenses.lgpl2Plus;
+    license = lib.licenses.lgpl2Plus;
 
     maintainers = [ ];
-    platforms = stdenv.lib.platforms.linux;
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/development/libraries/gtkmathview/default.nix b/pkgs/development/libraries/gtkmathview/default.nix
index d5a10171bdfc4..b5399553f9602 100644
--- a/pkgs/development/libraries/gtkmathview/default.nix
+++ b/pkgs/development/libraries/gtkmathview/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, pkg-config, gtk2, t1lib, glib, libxml2, popt, gmetadom ? null }:
+{lib, stdenv, fetchurl, pkg-config, gtk2, t1lib, glib, libxml2, popt, gmetadom ? null }:
 
 let
   pname = "gtkmathview";
@@ -22,8 +22,8 @@ stdenv.mkDerivation {
   meta = {
     homepage = "http://helm.cs.unibo.it/mml-widget/";
     description = "C++ rendering engine for MathML documents";
-    license = stdenv.lib.licenses.lgpl3Plus;
-    maintainers = [ stdenv.lib.maintainers.roconnor ];
+    license = lib.licenses.lgpl3Plus;
+    maintainers = [ lib.maintainers.roconnor ];
     broken = true;
   };
 }
diff --git a/pkgs/development/libraries/gtkmm/2.x.nix b/pkgs/development/libraries/gtkmm/2.x.nix
index 0e04cb710dc54..521f4ca15f301 100644
--- a/pkgs/development/libraries/gtkmm/2.x.nix
+++ b/pkgs/development/libraries/gtkmm/2.x.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, gtk2, glibmm, cairomm, pangomm, atkmm }:
+{ lib, stdenv, fetchurl, pkg-config, gtk2, glibmm, cairomm, pangomm, atkmm }:
 
 stdenv.mkDerivation rec {
   name = "gtkmm-${minVer}.5";
@@ -34,9 +34,9 @@ stdenv.mkDerivation rec {
 
     homepage = "https://gtkmm.org/";
 
-    license = stdenv.lib.licenses.lgpl2Plus;
+    license = lib.licenses.lgpl2Plus;
 
-    maintainers = with stdenv.lib.maintainers; [ raskin vcunat ];
-    platforms = stdenv.lib.platforms.unix;
+    maintainers = with lib.maintainers; [ raskin vcunat ];
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/gtkmm/3.x.nix b/pkgs/development/libraries/gtkmm/3.x.nix
index 523cb5c59d8c1..4a31acd2ff666 100644
--- a/pkgs/development/libraries/gtkmm/3.x.nix
+++ b/pkgs/development/libraries/gtkmm/3.x.nix
@@ -1,11 +1,11 @@
-{ stdenv, fetchurl, pkg-config, gtk3, glibmm, cairomm, pangomm, atkmm, epoxy, gnome3 }:
+{ lib, stdenv, fetchurl, pkg-config, gtk3, glibmm, cairomm, pangomm, atkmm, epoxy, gnome3 }:
 
 stdenv.mkDerivation rec {
   pname = "gtkmm";
   version = "3.24.2";
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "1hxdnhavjyvbcpxhd5z17l9fj4182028s66lc0s16qqqrldhjwbd";
   };
 
@@ -28,7 +28,7 @@ stdenv.mkDerivation rec {
     };
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "C++ interface to the GTK graphical user interface library";
 
     longDescription = ''
diff --git a/pkgs/development/libraries/gtksourceview/3.x.nix b/pkgs/development/libraries/gtksourceview/3.x.nix
index 870637202c4e7..84a20154b13c2 100644
--- a/pkgs/development/libraries/gtksourceview/3.x.nix
+++ b/pkgs/development/libraries/gtksourceview/3.x.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, atk, cairo, glib, gtk3, pango, vala
+{ lib, stdenv, fetchurl, pkg-config, atk, cairo, glib, gtk3, pango, vala
 , libxml2, perl, intltool, gettext, gobject-introspection, dbus, xvfb_run, shared-mime-info }:
 
 stdenv.mkDerivation rec {
@@ -6,7 +6,7 @@ stdenv.mkDerivation rec {
   version = "3.24.11";
 
   src = fetchurl {
-    url = "mirror://gnome/sources/gtksourceview/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/gtksourceview/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "1zbpj283b5ycz767hqz5kdq02wzsga65pp4fykvhg8xj6x50f6v9";
   };
 
@@ -42,7 +42,7 @@ stdenv.mkDerivation rec {
       make check
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://wiki.gnome.org/Projects/GtkSourceView";
     platforms = with platforms; linux ++ darwin;
     license = licenses.lgpl21;
diff --git a/pkgs/development/libraries/gtksourceview/4.x.nix b/pkgs/development/libraries/gtksourceview/4.x.nix
index 0254c096c14fe..2d469c191e03a 100644
--- a/pkgs/development/libraries/gtksourceview/4.x.nix
+++ b/pkgs/development/libraries/gtksourceview/4.x.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, atk, cairo, glib, gtk3, pango, fribidi, vala
+{ lib, stdenv, fetchurl, pkg-config, atk, cairo, glib, gtk3, pango, fribidi, vala
 , libxml2, perl, gettext, gnome3, gobject-introspection, dbus, xvfb_run, shared-mime-info
 , meson, ninja }:
 
@@ -7,7 +7,7 @@ stdenv.mkDerivation rec {
   version = "4.8.0";
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "06jfbfbi73j9i3qsr7sxg3yl3643bn3aydbzx6xg3v8ca0hr3880";
   };
 
@@ -45,7 +45,7 @@ stdenv.mkDerivation rec {
     };
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://wiki.gnome.org/Projects/GtkSourceView";
     platforms = with platforms; linux ++ darwin;
     license = licenses.lgpl21;
diff --git a/pkgs/development/libraries/gtksourceviewmm/4.x.nix b/pkgs/development/libraries/gtksourceviewmm/4.x.nix
index d05e1ebf83e8a..5e80f91abc1b3 100644
--- a/pkgs/development/libraries/gtksourceviewmm/4.x.nix
+++ b/pkgs/development/libraries/gtksourceviewmm/4.x.nix
@@ -1,11 +1,11 @@
-{ stdenv, fetchurl, pkg-config, gtkmm3, glibmm, gtksourceview4, gnome3 }:
+{ lib, stdenv, fetchurl, pkg-config, gtkmm3, glibmm, gtksourceview4, gnome3 }:
 
 stdenv.mkDerivation rec {
   pname = "gtksourceviewmm";
   version = "3.91.1";
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "088p2ch1b4fvzl9416nw3waj0pqgp31cd5zj4lx5hzzrq2afgapy";
   };
 
@@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ pkg-config ];
   propagatedBuildInputs = [ glibmm gtkmm3 gtksourceview4 ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     platforms = platforms.linux;
     homepage = "https://developer.gnome.org/gtksourceviewmm/";
     description = "C++ wrapper for gtksourceview";
diff --git a/pkgs/development/libraries/gtksourceviewmm/default.nix b/pkgs/development/libraries/gtksourceviewmm/default.nix
index 675ced4ee497e..7ee6b656ead13 100644
--- a/pkgs/development/libraries/gtksourceviewmm/default.nix
+++ b/pkgs/development/libraries/gtksourceviewmm/default.nix
@@ -1,11 +1,11 @@
-{ stdenv, fetchurl, pkg-config, gtkmm3, glibmm, gtksourceview3, gnome3 }:
+{ lib, stdenv, fetchurl, pkg-config, gtkmm3, glibmm, gtksourceview3, gnome3 }:
 
 stdenv.mkDerivation rec {
   pname = "gtksourceviewmm";
   version = "3.21.3";
 
   src = fetchurl {
-    url = "mirror://gnome/sources/gtksourceviewmm/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/gtksourceviewmm/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "1danc9mp5mnb65j01qxkwj92z8jf1gns41wbgp17qh7050f0pc6v";
   };
 
@@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ pkg-config ];
   buildInputs = [ glibmm gtkmm3 gtksourceview3 ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     platforms = platforms.linux;
     homepage = "https://developer.gnome.org/gtksourceviewmm/";
     description = "C++ wrapper for gtksourceview";
diff --git a/pkgs/development/libraries/gtkspell/3.nix b/pkgs/development/libraries/gtkspell/3.nix
index 721db5983d7ec..d3a1a178856bc 100644
--- a/pkgs/development/libraries/gtkspell/3.nix
+++ b/pkgs/development/libraries/gtkspell/3.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, gtk3, aspell, pkg-config, enchant, isocodes, intltool, gobject-introspection, vala}:
+{lib, stdenv, fetchurl, gtk3, aspell, pkg-config, enchant, isocodes, intltool, gobject-introspection, vala}:
 
 stdenv.mkDerivation rec {
   pname = "gtkspell";
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
     "--enable-vala"
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://gtkspell.sourceforge.net/";
     description = "Word-processor-style highlighting GtkTextView widget";
     license = licenses.gpl2Plus;
diff --git a/pkgs/development/libraries/gtkspell/default.nix b/pkgs/development/libraries/gtkspell/default.nix
index a1305a435b2ea..78d9956d30a2d 100644
--- a/pkgs/development/libraries/gtkspell/default.nix
+++ b/pkgs/development/libraries/gtkspell/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, gtk2, aspell, pkg-config, enchant, intltool}:
+{lib, stdenv, fetchurl, gtk2, aspell, pkg-config, enchant, intltool}:
 
 stdenv.mkDerivation {
   name = "gtkspell-2.0.16";
@@ -11,7 +11,7 @@ stdenv.mkDerivation {
   nativeBuildInputs = [ pkg-config ];
   buildInputs = [aspell gtk2 enchant intltool];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Word-processor-style highlighting and replacement of misspelled words";
     homepage = "http://gtkspell.sourceforge.net";
     platforms = platforms.unix;
diff --git a/pkgs/development/libraries/gtkspellmm/default.nix b/pkgs/development/libraries/gtkspellmm/default.nix
index 47edb03985d36..31380b5ab7933 100644
--- a/pkgs/development/libraries/gtkspellmm/default.nix
+++ b/pkgs/development/libraries/gtkspellmm/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl
+{ lib, stdenv, fetchurl
 , pkg-config
 , gtk3, glib, glibmm, gtkmm3, gtkspell3
 }:
@@ -22,7 +22,7 @@ stdenv.mkDerivation rec {
     gtk3 glib glibmm gtkmm3
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "C++ binding for the gtkspell library";
     homepage = "http://gtkspell.sourceforge.net/";
     license = licenses.gpl2;
diff --git a/pkgs/development/libraries/gts/default.nix b/pkgs/development/libraries/gts/default.nix
index 3738baa21aeb7..3204811ec6bed 100644
--- a/pkgs/development/libraries/gts/default.nix
+++ b/pkgs/development/libraries/gts/default.nix
@@ -1,4 +1,4 @@
-{ fetchurl, stdenv, pkg-config, autoreconfHook, gettext, glib, buildPackages }:
+{ fetchurl, lib, stdenv, pkg-config, autoreconfHook, gettext, glib, buildPackages }:
 
 
 stdenv.mkDerivation rec {
@@ -22,7 +22,7 @@ stdenv.mkDerivation rec {
 
   doCheck = false; # fails with "permission denied"
 
-  preBuild = stdenv.lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) ''
+  preBuild = lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) ''
     pushd src
     make CC=${buildPackages.stdenv.cc}/bin/cc predicates_init
     mv predicates_init predicates_init_build
@@ -34,7 +34,7 @@ stdenv.mkDerivation rec {
 
   meta = {
     homepage = "http://gts.sourceforge.net/";
-    license = stdenv.lib.licenses.lgpl2Plus;
+    license = lib.licenses.lgpl2Plus;
     description = "GNU Triangulated Surface Library";
 
     longDescription = ''
@@ -42,7 +42,7 @@ stdenv.mkDerivation rec {
       3D surfaces meshed with interconnected triangles.
     '';
 
-    maintainers = [ stdenv.lib.maintainers.viric ];
-    platforms = stdenv.lib.platforms.linux ++ stdenv.lib.platforms.darwin;
+    maintainers = [ lib.maintainers.viric ];
+    platforms = lib.platforms.linux ++ stdenv.lib.platforms.darwin;
   };
 }
diff --git a/pkgs/development/libraries/gumbo/default.nix b/pkgs/development/libraries/gumbo/default.nix
index e8035d8b1cf95..91053828b586f 100644
--- a/pkgs/development/libraries/gumbo/default.nix
+++ b/pkgs/development/libraries/gumbo/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, autoconf, automake, libtool }:
+{ lib, stdenv, fetchFromGitHub, autoconf, automake, libtool }:
 
 stdenv.mkDerivation rec {
   pname = "gumbo";
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
 
   preConfigure = "./autogen.sh";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "C99 HTML parsing algorithm";
     homepage = "https://github.com/google/gumbo-parser";
     maintainers = [ maintainers.nico202 ];
diff --git a/pkgs/development/libraries/gupnp-av/default.nix b/pkgs/development/libraries/gupnp-av/default.nix
index d288f09b36a63..9bf39d94aed3b 100644
--- a/pkgs/development/libraries/gupnp-av/default.nix
+++ b/pkgs/development/libraries/gupnp-av/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , pkg-config
 , gobject-introspection
@@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
   outputs = [ "out" "dev" "devdoc" ];
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "1p3grslwqm9bc8rmpn4l48d7v9s84nina4r9xbd932dbj8acz7b8";
   };
 
@@ -48,7 +48,7 @@ stdenv.mkDerivation rec {
     };
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://gupnp.org/";
     description = "A collection of helpers for building AV (audio/video) applications using GUPnP";
     license = licenses.lgpl2Plus;
diff --git a/pkgs/development/libraries/gupnp-dlna/default.nix b/pkgs/development/libraries/gupnp-dlna/default.nix
index 6b5f80a0e51ed..e11d86f82e193 100644
--- a/pkgs/development/libraries/gupnp-dlna/default.nix
+++ b/pkgs/development/libraries/gupnp-dlna/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , pkg-config
 , gobject-introspection
@@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
   outputs = [ "out" "dev" "devdoc" ];
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "0spzd2saax7w776p5laixdam6d7smyynr9qszhbmq7f14y13cghj";
   };
 
@@ -53,7 +53,7 @@ stdenv.mkDerivation rec {
     };
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://wiki.gnome.org/Projects/GUPnP/";
     description = "Library to ease DLNA-related bits for applications using GUPnP";
     license = licenses.lgpl2Plus;
diff --git a/pkgs/development/libraries/gupnp-igd/default.nix b/pkgs/development/libraries/gupnp-igd/default.nix
index d5aa7a99196e2..2dad33949f3fa 100644
--- a/pkgs/development/libraries/gupnp-igd/default.nix
+++ b/pkgs/development/libraries/gupnp-igd/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , fetchpatch
 , autoreconfHook
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
   outputs = [ "out" "dev" "devdoc" ];
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "081v1vhkbz3wayv49xfiskvrmvnpx93k25am2wnarg5cifiiljlb";
   };
 
@@ -59,7 +59,7 @@ stdenv.mkDerivation rec {
     };
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Library to handle UPnP IGD port mapping";
     homepage = "http://www.gupnp.org/";
     license = licenses.lgpl21;
diff --git a/pkgs/development/libraries/gupnp/default.nix b/pkgs/development/libraries/gupnp/default.nix
index 7f606c10b6bef..fe3463eeff203 100644
--- a/pkgs/development/libraries/gupnp/default.nix
+++ b/pkgs/development/libraries/gupnp/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , fetchpatch
 , meson
@@ -25,7 +25,7 @@ stdenv.mkDerivation rec {
   outputs = [ "out" "dev" "devdoc" ];
 
   src = fetchurl {
-    url = "mirror://gnome/sources/gupnp/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/gupnp/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "0911lv1bivsyv9wwdxm0i1w4r89j0vyyqp200gsfdnzk6v1a4x7x";
   };
 
@@ -85,7 +85,7 @@ stdenv.mkDerivation rec {
     };
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://www.gupnp.org/";
     description = "An implementation of the UPnP specification";
     license = licenses.lgpl2Plus;
diff --git a/pkgs/development/libraries/gusb/default.nix b/pkgs/development/libraries/gusb/default.nix
index 1d0c5e1b02717..c3ae6faecfd70 100644
--- a/pkgs/development/libraries/gusb/default.nix
+++ b/pkgs/development/libraries/gusb/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, meson, ninja, pkg-config, gettext, gobject-introspection
+{ lib, stdenv, fetchurl, meson, ninja, pkg-config, gettext, gobject-introspection
 , gtk-doc, docbook_xsl, docbook_xml_dtd_412, docbook_xml_dtd_44, python3
 , glib, systemd, libusb1, vala, hwdata
 }:
@@ -34,7 +34,7 @@ stdenv.mkDerivation rec {
 
   doCheck = false; # tests try to access USB
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "GLib libusb wrapper";
     homepage = "https://github.com/hughsie/libgusb";
     license = licenses.lgpl21;
diff --git a/pkgs/development/libraries/gvfs/default.nix b/pkgs/development/libraries/gvfs/default.nix
index 1b840eba73a10..c30d678e02d54 100644
--- a/pkgs/development/libraries/gvfs/default.nix
+++ b/pkgs/development/libraries/gvfs/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , meson
 , ninja
@@ -44,7 +44,7 @@ stdenv.mkDerivation rec {
   version = "1.46.1";
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "00r56kp8dhdn1ypyap66klymlwlh646n4f1ri797w2x6p70sc7k2";
   };
 
@@ -90,7 +90,7 @@ stdenv.mkDerivation rec {
     openssh
     gsettings-desktop-schemas
     # TODO: a ligther version of libsoup to have FTP/HTTP support?
-  ] ++ stdenv.lib.optionals gnomeSupport [
+  ] ++ lib.optionals gnomeSupport [
     gnome3.libsoup
     gcr
     glib-networking # TLS support
@@ -102,13 +102,13 @@ stdenv.mkDerivation rec {
   mesonFlags = [
     "-Dsystemduserunitdir=${placeholder "out"}/lib/systemd/user"
     "-Dtmpfilesdir=no"
-  ] ++ stdenv.lib.optionals (!gnomeSupport) [
+  ] ++ lib.optionals (!gnomeSupport) [
     "-Dgcr=false"
     "-Dgoa=false"
     "-Dkeyring=false"
     "-Dhttp=false"
     "-Dgoogle=false"
-  ] ++ stdenv.lib.optionals (samba == null) [
+  ] ++ lib.optionals (samba == null) [
     # Xfce don't want samba
     "-Dsmb=false"
   ];
@@ -122,7 +122,7 @@ stdenv.mkDerivation rec {
     };
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Virtual Filesystem support library" + optionalString gnomeSupport " (full GNOME support)";
     license = licenses.lgpl2Plus;
     platforms = platforms.linux;
diff --git a/pkgs/development/libraries/half/default.nix b/pkgs/development/libraries/half/default.nix
index b0f4c3a0e9e0e..5232dfa51230b 100644
--- a/pkgs/development/libraries/half/default.nix
+++ b/pkgs/development/libraries/half/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchzip }:
+{ lib, stdenv, fetchzip }:
 
 stdenv.mkDerivation rec {
   version = "2.1.0";
@@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
     cp $src/{ChangeLog,LICENSE,README}.txt $out/share/doc/
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "C++ library for half precision floating point arithmetics";
     platforms = platforms.all;
     license = licenses.mit;
diff --git a/pkgs/development/libraries/hamlib/default.nix b/pkgs/development/libraries/hamlib/default.nix
index 2c415b39df31d..98b494610057a 100644
--- a/pkgs/development/libraries/hamlib/default.nix
+++ b/pkgs/development/libraries/hamlib/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, perl, python2, swig, gd, libxml2, tcl, libusb-compat-0_1, pkg-config,
+{lib, stdenv, fetchurl, perl, python2, swig, gd, libxml2, tcl, libusb-compat-0_1, pkg-config,
  boost, libtool, perlPackages }:
 
 stdenv.mkDerivation rec {
@@ -26,9 +26,9 @@ stdenv.mkDerivation rec {
     which lets one control a radio transceiver or receiver, either from
     command line interface or in a text-oriented interactive interface.
     '';
-    license = with stdenv.lib.licenses; [ gpl2Plus lgpl2Plus ];
+    license = with lib.licenses; [ gpl2Plus lgpl2Plus ];
     homepage = "http://hamlib.sourceforge.net";
-    maintainers = with stdenv.lib.maintainers; [ relrod ];
-    platforms = with stdenv.lib.platforms; unix;
+    maintainers = with lib.maintainers; [ relrod ];
+    platforms = with lib.platforms; unix;
   };
 }
diff --git a/pkgs/development/libraries/harfbuzz/default.nix b/pkgs/development/libraries/harfbuzz/default.nix
index c0e1be302535a..b3615893b5329 100644
--- a/pkgs/development/libraries/harfbuzz/default.nix
+++ b/pkgs/development/libraries/harfbuzz/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, pkg-config, glib, freetype, cairo, libintl
+{ lib, stdenv, fetchFromGitHub, pkg-config, glib, freetype, cairo, libintl
 , meson, ninja
 , gobject-introspection
 , icu, graphite2, harfbuzz # The icu variant uses and propagates the non-icu one.
@@ -12,7 +12,7 @@
 
 let
   version = "2.7.2";
-  inherit (stdenv.lib) optional optionals optionalString;
+  inherit (lib) optional optionals optionalString;
   mesonFeatureFlag = opt: b:
     "-D${opt}=${if b then "enabled" else "disabled"}";
 in
@@ -30,7 +30,7 @@ stdenv.mkDerivation {
   postPatch = ''
     patchShebangs src/*.py
     patchShebangs test
-  '' + stdenv.lib.optionalString stdenv.isDarwin ''
+  '' + lib.optionalString stdenv.isDarwin ''
     # ApplicationServices.framework headers have cast-align warnings.
     substituteInPlace src/hb.hh \
       --replace '#pragma GCC diagnostic error   "-Wcast-align"' ""
@@ -58,7 +58,7 @@ stdenv.mkDerivation {
   ];
 
   buildInputs = [ glib freetype cairo ] # recommended by upstream
-    ++ stdenv.lib.optionals withCoreText [ ApplicationServices CoreText ];
+    ++ lib.optionals withCoreText [ ApplicationServices CoreText ];
 
   propagatedBuildInputs = []
     ++ optional withGraphite2 graphite2
@@ -77,7 +77,7 @@ stdenv.mkDerivation {
     ''}
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "An OpenType text shaping engine";
     homepage = "https://harfbuzz.github.io/";
     maintainers = [ maintainers.eelco ];
diff --git a/pkgs/development/libraries/hawknl/default.nix b/pkgs/development/libraries/hawknl/default.nix
index e9d5d5d973107..0525fcd0eba60 100644
--- a/pkgs/development/libraries/hawknl/default.nix
+++ b/pkgs/development/libraries/hawknl/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, unzip}:
+{lib, stdenv, fetchurl, unzip}:
 
 stdenv.mkDerivation {
   name = "hawknl-1.68";
@@ -24,7 +24,7 @@ stdenv.mkDerivation {
   meta = {
     homepage = "http://hawksoft.com/hawknl/";
     description = "Free, open source, game oriented network API";
-    license = stdenv.lib.licenses.lgpl2Plus;
-    platforms = stdenv.lib.platforms.linux;
+    license = lib.licenses.lgpl2Plus;
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/development/libraries/hdf5-blosc/default.nix b/pkgs/development/libraries/hdf5-blosc/default.nix
index ebce203125c6a..0879bb9ee9dd3 100644
--- a/pkgs/development/libraries/hdf5-blosc/default.nix
+++ b/pkgs/development/libraries/hdf5-blosc/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, c-blosc, cmake, hdf5, fetchFromGitHub }:
+{ lib, stdenv, c-blosc, cmake, hdf5, fetchFromGitHub }:
 
 stdenv.mkDerivation rec {
   pname = "hdf5-blosc";
@@ -30,7 +30,7 @@ stdenv.mkDerivation rec {
     substituteAll ${./blosc_filter.pc.in} $out/lib/pkgconfig/blosc_filter.pc
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Filter for HDF5 that uses the Blosc compressor";
     homepage = "https://github.com/Blosc/hdf5-blosc";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/hidapi/default.nix b/pkgs/development/libraries/hidapi/default.nix
index 2251bb7a91a4f..6a3665809b4aa 100644
--- a/pkgs/development/libraries/hidapi/default.nix
+++ b/pkgs/development/libraries/hidapi/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, autoreconfHook, pkg-config, udev, libusb1
+{ lib, stdenv, fetchFromGitHub, autoreconfHook, pkg-config, udev, libusb1
 , darwin }:
 
 stdenv.mkDerivation rec {
@@ -15,13 +15,13 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ autoreconfHook pkg-config ];
 
   buildInputs = [ ]
-    ++ stdenv.lib.optionals stdenv.isLinux [ libusb1 udev ];
+    ++ lib.optionals stdenv.isLinux [ libusb1 udev ];
 
   enableParallelBuilding = true;
 
-  propagatedBuildInputs = stdenv.lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [ IOKit Cocoa ]);
+  propagatedBuildInputs = lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [ IOKit Cocoa ]);
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Library for communicating with USB and Bluetooth HID devices";
     homepage = "https://github.com/libusb/hidapi";
     maintainers = with maintainers; [ prusnak ];
diff --git a/pkgs/development/libraries/highfive/default.nix b/pkgs/development/libraries/highfive/default.nix
index c514a44f851a6..a9db80468ee69 100644
--- a/pkgs/development/libraries/highfive/default.nix
+++ b/pkgs/development/libraries/highfive/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , cmake
 , boost
@@ -36,9 +36,9 @@ stdenv.mkDerivation rec {
     "-DHIGHFIVE_UNIT_TESTS=OFF"
     "-DHIGHFIVE_USE_INSTALL_DEPS=ON"
   ]
-  ++ (stdenv.lib.optionals mpiSupport [ "-DHIGHFIVE_PARALLEL_HDF5=ON" ]);
+  ++ (lib.optionals mpiSupport [ "-DHIGHFIVE_PARALLEL_HDF5=ON" ]);
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     inherit version;
     description = "Header-only C++ HDF5 interface";
     license = licenses.boost;
diff --git a/pkgs/development/libraries/hiredis/default.nix b/pkgs/development/libraries/hiredis/default.nix
index 2f7fe184845d8..d4998b51592f0 100644
--- a/pkgs/development/libraries/hiredis/default.nix
+++ b/pkgs/development/libraries/hiredis/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub }:
+{ lib, stdenv, fetchFromGitHub }:
 
 stdenv.mkDerivation rec {
   pname = "hiredis";
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
 
   PREFIX = "\${out}";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/redis/hiredis";
     description = "Minimalistic C client for Redis >= 1.2";
     license = licenses.bsd3;
diff --git a/pkgs/development/libraries/hivex/default.nix b/pkgs/development/libraries/hivex/default.nix
index 1afbe8a2f75a1..fb77e08ca6b0e 100644
--- a/pkgs/development/libraries/hivex/default.nix
+++ b/pkgs/development/libraries/hivex/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, autoreconfHook, makeWrapper
+{ lib, stdenv, fetchurl, pkg-config, autoreconfHook, makeWrapper
 , perlPackages, libxml2, libiconv }:
 
 stdenv.mkDerivation rec {
@@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
     autoreconfHook makeWrapper libxml2
   ]
   ++ (with perlPackages; [ perl IOStringy ])
-  ++ stdenv.lib.optionals stdenv.isDarwin [ libiconv ];
+  ++ lib.optionals stdenv.isDarwin [ libiconv ];
 
   postInstall = ''
     wrapProgram $out/bin/hivexregedit \
@@ -28,7 +28,7 @@ stdenv.mkDerivation rec {
         --prefix "PATH" : "$out/bin"
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Windows registry hive extraction library";
     license = licenses.lgpl2;
     homepage = "https://github.com/libguestfs/hivex";
diff --git a/pkgs/development/libraries/hotpatch/default.nix b/pkgs/development/libraries/hotpatch/default.nix
index f8211b89d77a9..9857f9f281cca 100644
--- a/pkgs/development/libraries/hotpatch/default.nix
+++ b/pkgs/development/libraries/hotpatch/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake }:
+{ lib, stdenv, fetchFromGitHub, cmake }:
 
 stdenv.mkDerivation rec {
   name = "hotpatch-0.2";
@@ -26,7 +26,7 @@ stdenv.mkDerivation rec {
     LD_LIBRARY_PATH=$(pwd)/src make test
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Hot patching executables on Linux using .so file injection";
     homepage = src.meta.homepage;
     license = licenses.bsd3;
diff --git a/pkgs/development/libraries/howard-hinnant-date/default.nix b/pkgs/development/libraries/howard-hinnant-date/default.nix
index df6e43293887d..2611203a38943 100644
--- a/pkgs/development/libraries/howard-hinnant-date/default.nix
+++ b/pkgs/development/libraries/howard-hinnant-date/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, curl, tzdata, fetchpatch, substituteAll }:
+{ lib, stdenv, fetchFromGitHub, cmake, curl, tzdata, fetchpatch, substituteAll }:
 
 stdenv.mkDerivation rec {
   pname = "howard-hinnant-date-unstable";
@@ -36,7 +36,7 @@ stdenv.mkDerivation rec {
 
   outputs = [ "out" "dev" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     license = licenses.mit;
     description = "A date and time library based on the C++11/14/17 <chrono> header";
     homepage = "https://github.com/HowardHinnant/date";
diff --git a/pkgs/development/libraries/hpx/default.nix b/pkgs/development/libraries/hpx/default.nix
index f83d0aff32ed8..329fa99fa1cd7 100644
--- a/pkgs/development/libraries/hpx/default.nix
+++ b/pkgs/development/libraries/hpx/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, boost, cmake, hwloc, gperftools, pkg-config, python }:
+{ lib, stdenv, fetchFromGitHub, boost, cmake, hwloc, gperftools, pkg-config, python }:
 
 stdenv.mkDerivation rec {
   pname = "hpx";
@@ -17,8 +17,8 @@ stdenv.mkDerivation rec {
   meta = {
     description = "C++ standard library for concurrency and parallelism";
     homepage = "https://github.com/STEllAR-GROUP/hpx";
-    license = stdenv.lib.licenses.boost;
-    platforms = [ "x86_64-linux" ]; # stdenv.lib.platforms.linux;
-    maintainers = with stdenv.lib.maintainers; [ bobakker ];
+    license = lib.licenses.boost;
+    platforms = [ "x86_64-linux" ]; # lib.platforms.linux;
+    maintainers = with lib.maintainers; [ bobakker ];
   };
 }
diff --git a/pkgs/development/libraries/hspell/default.nix b/pkgs/development/libraries/hspell/default.nix
index 8501bf88b6d47..137ccfeaf8414 100644
--- a/pkgs/development/libraries/hspell/default.nix
+++ b/pkgs/development/libraries/hspell/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, perl, zlib }:
+{ lib, stdenv, fetchurl, perl, zlib }:
 
 stdenv.mkDerivation rec {
   name = "${passthru.pname}-${passthru.version}";
@@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
   patchPhase = ''patchShebangs .'';
   buildInputs = [ perl zlib ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Hebrew spell checker";
     homepage = "http://hspell.ivrix.org.il/";
     platforms = platforms.all;
diff --git a/pkgs/development/libraries/htmlcxx/default.nix b/pkgs/development/libraries/htmlcxx/default.nix
index ed3171da90f75..286834112f273 100644
--- a/pkgs/development/libraries/htmlcxx/default.nix
+++ b/pkgs/development/libraries/htmlcxx/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
   pname = "htmlcxx";
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
 
   patches = [ ./ptrdiff.patch ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://htmlcxx.sourceforge.net/";
     description = "A simple non-validating css1 and html parser for C++";
     license = licenses.lgpl2;
diff --git a/pkgs/development/libraries/http-parser/default.nix b/pkgs/development/libraries/http-parser/default.nix
index 203fcaa19ec81..9d1d23ede8b69 100644
--- a/pkgs/development/libraries/http-parser/default.nix
+++ b/pkgs/development/libraries/http-parser/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub }:
+{ lib, stdenv, fetchFromGitHub }:
 
 let
   version = "2.9.4";
@@ -20,7 +20,7 @@ in stdenv.mkDerivation {
   doCheck = true;
   checkTarget = "test";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "An HTTP message parser written in C";
     homepage = "https://github.com/nodejs/http-parser";
     maintainers = with maintainers; [ matthewbauer ];
diff --git a/pkgs/development/libraries/hunspell/default.nix b/pkgs/development/libraries/hunspell/default.nix
index 20acc49bb83e4..fe4fc1e6d338a 100644
--- a/pkgs/development/libraries/hunspell/default.nix
+++ b/pkgs/development/libraries/hunspell/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, fetchpatch, ncurses, readline, autoreconfHook }:
+{ lib, stdenv, fetchurl, fetchpatch, ncurses, readline, autoreconfHook }:
 
 stdenv.mkDerivation rec {
   version = "1.7.0";
@@ -33,7 +33,7 @@ stdenv.mkDerivation rec {
 
   hardeningDisable = [ "format" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://hunspell.sourceforge.net";
     description = "Spell checker";
     longDescription = ''
@@ -58,6 +58,6 @@ stdenv.mkDerivation rec {
     '';
     platforms = platforms.all;
     license = with licenses; [ gpl2 lgpl21 mpl11 ];
-    maintainers = with stdenv.lib.maintainers; [ ];
+    maintainers = with lib.maintainers; [ ];
   };
 }
diff --git a/pkgs/development/libraries/hunspell/dictionaries.nix b/pkgs/development/libraries/hunspell/dictionaries.nix
index 2cdc30109d90b..00d0933bdd709 100644
--- a/pkgs/development/libraries/hunspell/dictionaries.nix
+++ b/pkgs/development/libraries/hunspell/dictionaries.nix
@@ -1,6 +1,6 @@
 /* hunspell dictionaries */
 
-{ stdenv, fetchurl, fetchFromGitHub, unzip, coreutils, bash, which, zip, ispell, perl, hunspell }:
+{ lib, stdenv, fetchurl, fetchFromGitHub, unzip, coreutils, bash, which, zip, ispell, perl, hunspell }:
 
 
 let
@@ -37,7 +37,7 @@ let
         rev = "v${version}";
         sha256 = "0n9ms092k7vg7xpd3ksadxydbrizkb7js7dfxr08nbnnb9fgy0i8";
       };
-      meta = with stdenv.lib; {
+      meta = with lib; {
         description = "Hunspell dictionary for ${shortDescription} from rla";
         homepage = "https://github.com/sbosio/rla-es";
         license = with licenses; [ gpl3 lgpl3 mpl11 ];
@@ -76,7 +76,7 @@ let
         url = "https://extensions.libreoffice.org/extensions/swedish-spelling-dictionary-den-stora-svenska-ordlistan/${version}/@@download/file/${_name}.oxt";
         sha256 = "b982881cc75f5c4af1199535bd4735ee476bdc48edf63e3f05fb4f715654a7bc";
       };
-      meta = with stdenv.lib; {
+      meta = with lib; {
         longDescription = ''
         Svensk ordlista baserad på DSSO (den stora svenska ordlistan) och Göran
         Anderssons (goran@init.se) arbete med denna. Ordlistan hämtas från
@@ -118,7 +118,7 @@ let
          url = "http://www.dicollecte.org/download/fr/hunspell-french-dictionaries-v${version}.zip";
          sha256 = "0ca7084jm7zb1ikwzh1frvpb97jn27i7a5d48288h2qlfp068ik0";
       };
-      meta = with stdenv.lib; {
+      meta = with lib; {
         inherit longDescription;
         description = "Hunspell dictionary for ${shortDescription} from Dicollecte";
         homepage = "https://www.dicollecte.org/home.php?prj=fr";
@@ -132,7 +132,7 @@ let
       unpackCmd = ''
         unzip $src ${dictFileName}.dic ${dictFileName}.aff ${readmeFile}
       '';
-      postInstall = stdenv.lib.optionalString isDefault ''
+      postInstall = lib.optionalString isDefault ''
         for ext in aff dic; do
           ln -sv $out/share/hunspell/${dictFileName}.$ext $out/share/hunspell/fr_FR.$ext
           ln -sv $out/share/myspell/dicts/${dictFileName}.$ext $out/share/myspell/dicts/fr_FR.$ext
@@ -148,7 +148,7 @@ let
       name = "hunspell-dict-${shortName}-wordlist-${version}";
       srcReadmeFile = "README_" + srcFileName + ".txt";
       readmeFile = "README_" + dictFileName + ".txt";
-      meta = with stdenv.lib; {
+      meta = with lib; {
         description = "Hunspell dictionary for ${shortDescription} from Wordlist";
         homepage = "http://wordlist.aspell.net/";
         license = licenses.bsd3;
@@ -175,7 +175,7 @@ let
       version = "2.4";
       name = "hunspell-dict-${shortName}-linguistico-${version}";
       readmeFile = dictFileName + "_README.txt";
-      meta = with stdenv.lib; {
+      meta = with lib; {
         description = "Hunspell dictionary for ${shortDescription}";
         homepage = "https://sourceforge.net/projects/linguistico/";
         license = licenses.gpl3;
@@ -217,7 +217,7 @@ let
         ln -sv "$out/share/hunspell/${dictFileName}.aff" "$out/share/myspell/dicts/"
       '';
 
-      meta = with stdenv.lib; {
+      meta = with lib; {
         homepage = "http://xuxen.eus/";
         description = shortDescription;
         longDescription = longDescription;
@@ -254,7 +254,7 @@ let
         ln -sv "$out/share/hunspell/${dictFileName}.aff" "$out/share/myspell/dicts/"
       '';
 
-      meta = with stdenv.lib; {
+      meta = with lib; {
         homepage = "https://www.j3e.de/ispell/igerman98/index_en.html";
         description = shortDescription;
         license = with licenses; [ gpl2 gpl3 ];
@@ -283,7 +283,7 @@ let
       buildPhase = ''
         cp -a ${sourceRoot}/* .
       '';
-      meta = with stdenv.lib; {
+      meta = with lib; {
         homepage = "https://wiki.documentfoundation.org/Development/Dictionaries";
         description = "Hunspell dictionary for ${shortDescription} from LibreOffice";
         license = license;
@@ -651,7 +651,7 @@ in rec {
     shortName = "hu-hu";
     dictFileName = "hu_HU";
     shortDescription = "Hungarian (Hungary)";
-    license = with stdenv.lib.licenses; [ mpl20 lgpl3 ];
+    license = with lib.licenses; [ mpl20 lgpl3 ];
   };
 
   /* SWEDISH */
@@ -714,7 +714,7 @@ in rec {
       unzip $src ${dictFileName}/{${dictFileName}.dic,${dictFileName}.aff,${readmeFile}}
     '';
 
-    meta = with stdenv.lib; {
+    meta = with lib; {
       description = "Hunspell dictionary for Ukrainian (Ukraine) from LibreOffice";
       homepage = "https://extensions.libreoffice.org/extensions/ukrainian-spelling-dictionary-and-thesaurus/";
       license = licenses.mpl20;
@@ -730,7 +730,7 @@ in rec {
     shortName = "ru-ru";
     dictFileName = "ru_RU";
     shortDescription = "Russian (Russian)";
-    license = with stdenv.lib.licenses; [ mpl20 lgpl3 ];
+    license = with lib.licenses; [ mpl20 lgpl3 ];
   };
 
   /* CZECH */
@@ -741,7 +741,7 @@ in rec {
     dictFileName = "cs_CZ";
     shortDescription = "Czech (Czechia)";
     readmeFile = "README_cs.txt";
-    license = with stdenv.lib.licenses; [ gpl2 ];
+    license = with lib.licenses; [ gpl2 ];
   };
 
   /* SLOVAK */
@@ -752,7 +752,7 @@ in rec {
     dictFileName = "sk_SK";
     shortDescription = "Slovak (Slovakia)";
     readmeFile = "README_sk.txt";
-    license = with stdenv.lib.licenses; [ gpl2 lgpl21 mpl11 ];
+    license = with lib.licenses; [ gpl2 lgpl21 mpl11 ];
   };
 
   /* DANISH */
@@ -776,10 +776,10 @@ in rec {
       unzip $src ${dictFileName}.dic ${dictFileName}.aff ${readmeFile} -d ${dictFileName}
     '';
 
-    meta = with stdenv.lib; {
+    meta = with lib; {
       description = "Hunspell dictionary for Danish (Denmark) from Stavekontrolden";
       homepage = "https://github.com/jeppebundsgaard/stavekontrolden";
-      license = with stdenv.lib.licenses; [ gpl2Only lgpl21Only mpl11 ];
+      license = with lib.licenses; [ gpl2Only lgpl21Only mpl11 ];
       maintainers = with maintainers; [ louisdk1 ];
     };
   };
diff --git a/pkgs/development/libraries/hwloc/default.nix b/pkgs/development/libraries/hwloc/default.nix
index 3c8ffee1bdeb3..6a939835cf569 100644
--- a/pkgs/development/libraries/hwloc/default.nix
+++ b/pkgs/development/libraries/hwloc/default.nix
@@ -1,10 +1,10 @@
-{ stdenv, fetchurl, pkg-config, expat, ncurses, pciutils, numactl
+{ lib, stdenv, fetchurl, pkg-config, expat, ncurses, pciutils, numactl
 , x11Support ? false, libX11 ? null, cairo ? null
 }:
 
 assert x11Support -> libX11 != null && cairo != null;
 
-with stdenv.lib;
+with lib;
 
 let
   version = "2.4.0";
@@ -29,7 +29,7 @@ in stdenv.mkDerivation {
 
   # Filter out `null' inputs.  This allows users to `.override' the
   # derivation and set optional dependencies to `null'.
-  buildInputs = stdenv.lib.filter (x: x != null)
+  buildInputs = lib.filter (x: x != null)
    ([ expat ncurses ]
      ++  (optionals x11Support [ cairo libX11 ])
      ++  (optionals stdenv.isLinux [ numactl ]));
diff --git a/pkgs/development/libraries/hyena/default.nix b/pkgs/development/libraries/hyena/default.nix
index 073e9d1668616..177f6fe7909df 100644
--- a/pkgs/development/libraries/hyena/default.nix
+++ b/pkgs/development/libraries/hyena/default.nix
@@ -1,11 +1,11 @@
-{ stdenv, fetchurl, pkg-config, mono, gtk-sharp-2_0, monoDLLFixer }:
+{ lib, stdenv, fetchurl, pkg-config, mono, gtk-sharp-2_0, monoDLLFixer }:
 
 stdenv.mkDerivation rec {
   pname = "hyena";
   version = "0.5";
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.bz2";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.bz2";
     sha256 = "eb7154a42b6529bb9746c39272719f3168d6363ed4bad305a916ed7d90bc8de9";
   };
 
@@ -25,7 +25,7 @@ stdenv.mkDerivation rec {
 
   inherit monoDLLFixer;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://wiki.gnome.org/Attic/Hyena";
     description = "A C# library which contains a hodge-podge of random stuff";
     longDescription = ''
diff --git a/pkgs/development/libraries/hyperscan/default.nix b/pkgs/development/libraries/hyperscan/default.nix
index 3ab52165b7891..f160afb99b7cd 100644
--- a/pkgs/development/libraries/hyperscan/default.nix
+++ b/pkgs/development/libraries/hyperscan/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, ragel, python3
+{ lib, stdenv, fetchFromGitHub, cmake, ragel, python3
 , coreutils, gnused, util-linux
 , boost
 , withStatic ? false # build only shared libs by default, build static+shared if true
@@ -34,8 +34,8 @@ stdenv.mkDerivation rec {
     "-DFAT_RUNTIME=ON"
     "-DBUILD_AVX512=ON"
   ]
-  ++ stdenv.lib.optional (withStatic) "-DBUILD_STATIC_AND_SHARED=ON"
-  ++ stdenv.lib.optional (!withStatic) "-DBUILD_SHARED_LIBS=ON";
+  ++ lib.optional (withStatic) "-DBUILD_STATIC_AND_SHARED=ON"
+  ++ lib.optional (!withStatic) "-DBUILD_SHARED_LIBS=ON";
 
   postPatch = ''
     sed -i '/examples/d' CMakeLists.txt
@@ -44,7 +44,7 @@ stdenv.mkDerivation rec {
       --replace "includedir=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR@" "includedir=@CMAKE_INSTALL_INCLUDEDIR@"
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "High-performance multiple regex matching library";
     longDescription = ''
       Hyperscan is a high-performance multiple regex matching library.
diff --git a/pkgs/development/libraries/hyphen/default.nix b/pkgs/development/libraries/hyphen/default.nix
index 9251b2853f1c7..ed3980f7a90d5 100644
--- a/pkgs/development/libraries/hyphen/default.nix
+++ b/pkgs/development/libraries/hyphen/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, perl, ... }:
+{ lib, stdenv, fetchurl, perl, ... }:
 
 let
   version = "2.8.8";
@@ -17,7 +17,7 @@ in stdenv.mkDerivation rec {
     sha256 = "01ap9pr6zzzbp4ky0vy7i1983fwyqy27pl0ld55s30fdxka3ciih";
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A text hyphenation library";
     homepage = "https://sourceforge.net/projects/hunspell/files/Hyphen/";
     platforms = platforms.all;
diff --git a/pkgs/development/libraries/icu/base.nix b/pkgs/development/libraries/icu/base.nix
index d8e9bd16ab890..47eea8ba1af13 100644
--- a/pkgs/development/libraries/icu/base.nix
+++ b/pkgs/development/libraries/icu/base.nix
@@ -30,18 +30,18 @@ let
 
       # $(includedir) is different from $(prefix)/include due to multiple outputs
       sed -i -e 's|^\(CPPFLAGS = .*\) -I\$(prefix)/include|\1 -I$(includedir)|' config/Makefile.inc.in
-    '' + stdenv.lib.optionalString stdenv.isAarch32 ''
+    '' + lib.optionalString stdenv.isAarch32 ''
       # From https://archlinuxarm.org/packages/armv7h/icu/files/icudata-stdlibs.patch
       sed -e 's/LDFLAGSICUDT=-nodefaultlibs -nostdlib/LDFLAGSICUDT=/' -i config/mh-linux
     '';
 
     configureFlags = [ "--disable-debug" ]
-      ++ stdenv.lib.optional (stdenv.isFreeBSD || stdenv.isDarwin) "--enable-rpath"
-      ++ stdenv.lib.optional (stdenv.buildPlatform != stdenv.hostPlatform) "--with-cross-build=${nativeBuildRoot}";
+      ++ lib.optional (stdenv.isFreeBSD || stdenv.isDarwin) "--enable-rpath"
+      ++ lib.optional (stdenv.buildPlatform != stdenv.hostPlatform) "--with-cross-build=${nativeBuildRoot}";
 
     enableParallelBuilding = true;
 
-    meta = with stdenv.lib; {
+    meta = with lib; {
       description = "Unicode and globalization support library";
       homepage = "http://site.icu-project.org/";
       maintainers = with maintainers; [ raskin ];
@@ -57,10 +57,10 @@ let
 
     # FIXME: This fixes dylib references in the dylibs themselves, but
     # not in the programs in $out/bin.
-    nativeBuildInputs = stdenv.lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames;
+    nativeBuildInputs = lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames;
 
     # remove dependency on bootstrap-tools in early stdenv build
-    postInstall = stdenv.lib.optionalString stdenv.isDarwin ''
+    postInstall = lib.optionalString stdenv.isDarwin ''
       sed -i 's/INSTALL_CMD=.*install/INSTALL_CMD=install/' $out/lib/icu/${version}/pkgdata.inc
     '' + (let
       replacements = [
diff --git a/pkgs/development/libraries/id3lib/default.nix b/pkgs/development/libraries/id3lib/default.nix
index 6889a9f573ac4..31fc4fd6ba337 100644
--- a/pkgs/development/libraries/id3lib/default.nix
+++ b/pkgs/development/libraries/id3lib/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, zlib}:
+{lib, stdenv, fetchurl, zlib}:
 
 stdenv.mkDerivation {
   name = "id3lib-3.8.3";
@@ -17,7 +17,7 @@ stdenv.mkDerivation {
 
   doCheck = false; # fails to compile
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Library for reading, writing, and manipulating ID3v1 and ID3v2 tags";
     homepage = "http://id3lib.sourceforge.net";
     platforms = platforms.unix;
diff --git a/pkgs/development/libraries/idnkit/default.nix b/pkgs/development/libraries/idnkit/default.nix
index da7b9f1f27111..472a23a2b74e8 100644
--- a/pkgs/development/libraries/idnkit/default.nix
+++ b/pkgs/development/libraries/idnkit/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, libiconv }:
+{ lib, stdenv, fetchurl, libiconv }:
 
 stdenv.mkDerivation rec {
   pname = "idnkit";
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ libiconv ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://www.nic.ad.jp/ja/idn/idnkit";
     description = "Provides functionalities about i18n domain name processing";
     license = "idnkit-2 license";
diff --git a/pkgs/development/libraries/ijs/default.nix b/pkgs/development/libraries/ijs/default.nix
index 46ed422b54094..b300731ce440b 100644
--- a/pkgs/development/libraries/ijs/default.nix
+++ b/pkgs/development/libraries/ijs/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, autoreconfHook, ghostscript }:
+{ lib, stdenv, autoreconfHook, ghostscript }:
 
 stdenv.mkDerivation {
   name = "ijs-${ghostscript.version}";
@@ -13,7 +13,7 @@ stdenv.mkDerivation {
 
   configureFlags = [ "--enable-shared" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://www.openprinting.org/download/ijs/";
     description = "Raster printer driver architecture";
 
diff --git a/pkgs/development/libraries/iksemel/default.nix b/pkgs/development/libraries/iksemel/default.nix
index d9c01ab5fcf3b..6ba64dcaa5888 100644
--- a/pkgs/development/libraries/iksemel/default.nix
+++ b/pkgs/development/libraries/iksemel/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, autoreconfHook, libtool, pkg-config, gnutls, fetchFromGitHub, texinfo }:
+{ lib, stdenv, autoreconfHook, libtool, pkg-config, gnutls, fetchFromGitHub, texinfo }:
 
 stdenv.mkDerivation rec {
   pname = "iksemel";
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ pkg-config autoreconfHook libtool texinfo ];
   buildInputs = [ gnutls ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "XML parser for jabber";
 
     homepage = "https://github.com/timothytylee/iksemel-1.4";
diff --git a/pkgs/development/libraries/ilbc/default.nix b/pkgs/development/libraries/ilbc/default.nix
index 37885c767bd35..39d7b7b61b049 100644
--- a/pkgs/development/libraries/ilbc/default.nix
+++ b/pkgs/development/libraries/ilbc/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, gawk, cmake }:
+{ lib, stdenv, fetchurl, gawk, cmake }:
 
 stdenv.mkDerivation rec {
   name = "ilbc-rfc3951";
@@ -20,6 +20,6 @@ stdenv.mkDerivation rec {
     '';
 
   meta = {
-    platforms = stdenv.lib.platforms.unix;
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/ilixi/default.nix b/pkgs/development/libraries/ilixi/default.nix
index 26e63747523f7..b6f1c0ac78a54 100644
--- a/pkgs/development/libraries/ilixi/default.nix
+++ b/pkgs/development/libraries/ilixi/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, directfb, libsigcxx, libxml2, fontconfig }:
+{ lib, stdenv, fetchurl, pkg-config, directfb, libsigcxx, libxml2, fontconfig }:
 
 # TODO: optional deps: baresip, FusionDale, FusionSound, SaWMan, doxygen,
 # Reflex, Wnn, NLS
@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
     "--with-examples"
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Lightweight C++ GUI toolkit for embedded Linux systems";
     homepage = "https://github.com/ilixi/ilixi";
     license = licenses.lgpl3;
diff --git a/pkgs/development/libraries/ilmbase/default.nix b/pkgs/development/libraries/ilmbase/default.nix
index 68bd677cf777c..219d961f9f96a 100644
--- a/pkgs/development/libraries/ilmbase/default.nix
+++ b/pkgs/development/libraries/ilmbase/default.nix
@@ -7,7 +7,7 @@
 
 stdenv.mkDerivation rec {
   pname = "ilmbase";
-  version = stdenv.lib.getVersion openexr;
+  version = lib.getVersion openexr;
 
   # the project no longer provides separate tarballs. We may even want to merge
   # the ilmbase package into openexr in the future.
@@ -28,7 +28,7 @@ stdenv.mkDerivation rec {
     cd IlmBase
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = " A library for 2D/3D vectors and matrices and other mathematical objects, functions and data types for computer graphics";
     homepage = "https://www.openexr.com/";
     license = licenses.bsd3;
diff --git a/pkgs/development/libraries/iml/default.nix b/pkgs/development/libraries/iml/default.nix
index cf1d9018fd517..c666a15b63b74 100644
--- a/pkgs/development/libraries/iml/default.nix
+++ b/pkgs/development/libraries/iml/default.nix
@@ -1,4 +1,4 @@
-{stdenv, autoreconfHook, fetchurl, gmp, blas}:
+{lib, stdenv, autoreconfHook, fetchurl, gmp, blas}:
 stdenv.mkDerivation rec {
   pname = "iml";
   version = "1.0.5";
@@ -21,9 +21,9 @@ stdenv.mkDerivation rec {
   meta = {
     inherit version;
     description = ''Algorithms for computing exact solutions to dense systems of linear equations over the integers'';
-    license = stdenv.lib.licenses.gpl2Plus;
-    maintainers = [stdenv.lib.maintainers.raskin];
-    platforms = stdenv.lib.platforms.unix;
+    license = lib.licenses.gpl2Plus;
+    maintainers = [lib.maintainers.raskin];
+    platforms = lib.platforms.unix;
     homepage = "https://cs.uwaterloo.ca/~astorjoh/iml.html";
     updateWalker = true;
   };
diff --git a/pkgs/development/libraries/imlib/default.nix b/pkgs/development/libraries/imlib/default.nix
index b94af22c0a76e..53612f8205fee 100644
--- a/pkgs/development/libraries/imlib/default.nix
+++ b/pkgs/development/libraries/imlib/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, fetchpatch, libX11, libXext, xorgproto, libjpeg, libungif, libtiff, libpng}:
+{lib, stdenv, fetchurl, fetchpatch, libX11, libXext, xorgproto, libjpeg, libungif, libtiff, libpng}:
 
 stdenv.mkDerivation {
   name = "imlib-1.9.15";
@@ -23,7 +23,7 @@ stdenv.mkDerivation {
 
   buildInputs = [libjpeg libXext libX11 xorgproto libtiff libungif libpng];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "An image loading and rendering library for X11";
     platforms = platforms.unix;
     license = with licenses; [ gpl2 lgpl2 ];
diff --git a/pkgs/development/libraries/imlib2/default.nix b/pkgs/development/libraries/imlib2/default.nix
index aabfff908c1a3..666fcab989b7a 100644
--- a/pkgs/development/libraries/imlib2/default.nix
+++ b/pkgs/development/libraries/imlib2/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl
+{ lib, stdenv, fetchurl
 # Image file formats
 , libjpeg, libtiff, giflib, libpng, libwebp
 # imlib2 can load images from ID3 tags.
@@ -8,7 +8,7 @@
 }:
 
 let
-  inherit (stdenv.lib) optional;
+  inherit (lib) optional;
 in
 stdenv.mkDerivation rec {
   pname = "imlib2";
@@ -44,7 +44,7 @@ stdenv.mkDerivation rec {
     moveToOutput bin/imlib2-config "$dev"
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Image manipulation library";
 
     longDescription = ''
diff --git a/pkgs/development/libraries/impy/default.nix b/pkgs/development/libraries/impy/default.nix
index c865b25c0009e..1f5d9070dd37a 100644
--- a/pkgs/development/libraries/impy/default.nix
+++ b/pkgs/development/libraries/impy/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , cmake
 , pkg-config
@@ -33,7 +33,7 @@ stdenv.mkDerivation rec {
     SDL2
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A simple library for loading/saving images and animations, written in C";
     homepage = "https://github.com/bcampbell/impy";
     license = licenses.gpl3;
diff --git a/pkgs/development/libraries/inchi/default.nix b/pkgs/development/libraries/inchi/default.nix
index 869011007599d..6acdf340c91a5 100644
--- a/pkgs/development/libraries/inchi/default.nix
+++ b/pkgs/development/libraries/inchi/default.nix
@@ -1,4 +1,4 @@
-{ pkgs, fetchurl, stdenv, unzip }:
+{ pkgs, fetchurl, lib, stdenv, unzip }:
 stdenv.mkDerivation {
   pname = "inchi";
   version = "1.05";
@@ -41,7 +41,7 @@ stdenv.mkDerivation {
       install -m 644 INCHI-1-DOC/*.pdf $doc/share
     '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://www.inchi-trust.org/";
     description = "IUPAC International Chemical Identifier library";
     license = licenses.lgpl2Plus;
diff --git a/pkgs/development/libraries/incrtcl/default.nix b/pkgs/development/libraries/incrtcl/default.nix
index c08d5924b0c59..67ae5623db120 100644
--- a/pkgs/development/libraries/incrtcl/default.nix
+++ b/pkgs/development/libraries/incrtcl/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, writeText, tcl }:
+{ lib, stdenv, fetchurl, writeText, tcl }:
 
 stdenv.mkDerivation rec {
   pname = "incrtcl";
@@ -25,7 +25,7 @@ stdenv.mkDerivation rec {
     rmdir $out/bin
     mv $out/lib/itcl${version}/* $out/lib
     ln -s libitcl${version}${stdenv.hostPlatform.extensions.sharedLibrary} \
-      $out/lib/libitcl${stdenv.lib.versions.major version}${stdenv.hostPlatform.extensions.sharedLibrary}
+      $out/lib/libitcl${lib.versions.major version}${stdenv.hostPlatform.extensions.sharedLibrary}
     rmdir $out/lib/itcl${version}
   '';
 
@@ -35,7 +35,7 @@ stdenv.mkDerivation rec {
 
   outputs = [ "out" "dev" "man" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage    = "http://incrtcl.sourceforge.net/";
     description = "Object Oriented Enhancements for Tcl/Tk";
     license     = licenses.tcltk;
diff --git a/pkgs/development/libraries/indicator-application/gtk3.nix b/pkgs/development/libraries/indicator-application/gtk3.nix
index 5588a157c4695..8947e33e9001a 100644
--- a/pkgs/development/libraries/indicator-application/gtk3.nix
+++ b/pkgs/development/libraries/indicator-application/gtk3.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchbzr
+{ lib, stdenv, fetchbzr
 , pkg-config, systemd, autoreconfHook
 , glib, dbus-glib, json-glib
 , gtk3, libindicator-gtk3, libdbusmenu-gtk3, libappindicator-gtk3 }:
@@ -47,7 +47,7 @@ stdenv.mkDerivation rec {
     rm -rf $out/share/upstart
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Indicator to take menus from applications and place them in the panel";
     homepage = "https://launchpad.net/indicator-application";
     license = licenses.gpl3;
diff --git a/pkgs/development/libraries/indilib/default.nix b/pkgs/development/libraries/indilib/default.nix
index 1663542521c01..035356ac861a8 100644
--- a/pkgs/development/libraries/indilib/default.nix
+++ b/pkgs/development/libraries/indilib/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , cmake
 , cfitsio
@@ -43,7 +43,7 @@ stdenv.mkDerivation rec {
     fftw
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://www.indilib.org/";
     description = "Implementation of the INDI protocol for POSIX operating systems";
     license = licenses.lgpl2Plus;
diff --git a/pkgs/development/libraries/inih/default.nix b/pkgs/development/libraries/inih/default.nix
index 62de607f7d438..11e49f7ddc49e 100644
--- a/pkgs/development/libraries/inih/default.nix
+++ b/pkgs/development/libraries/inih/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, meson, ninja }:
+{ lib, stdenv, fetchFromGitHub, meson, ninja }:
 
 stdenv.mkDerivation rec {
   pname = "inih";
@@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
     "-Dwith_INIReader=true"
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Simple .INI file parser in C, good for embedded systems";
     homepage = "https://github.com/benhoyt/inih";
     changelog = "https://github.com/benhoyt/inih/releases/tag/${version}";
diff --git a/pkgs/development/libraries/iniparser/default.nix b/pkgs/development/libraries/iniparser/default.nix
index 51c6728e8b005..8c7fdfd04d6b4 100644
--- a/pkgs/development/libraries/iniparser/default.nix
+++ b/pkgs/development/libraries/iniparser/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub }:
+{ lib, stdenv, fetchFromGitHub }:
 
 stdenv.mkDerivation rec {
   pname = "iniparser";
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
 
   patches = ./no-usr.patch;
 
-  postPatch = stdenv.lib.optionalString stdenv.isDarwin ''
+  postPatch = lib.optionalString stdenv.isDarwin ''
     substituteInPlace Makefile \
         --replace -Wl,-soname= -Wl,-install_name,
   '';
@@ -38,7 +38,7 @@ stdenv.mkDerivation rec {
     ln -s libiniparser.so.1 $out/lib/libiniparser.so
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     inherit (src.meta) homepage;
     description = "Free standalone ini file parsing library";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/intel-gmmlib/default.nix b/pkgs/development/libraries/intel-gmmlib/default.nix
index 30d572853cfd6..f050a9c7b3baa 100644
--- a/pkgs/development/libraries/intel-gmmlib/default.nix
+++ b/pkgs/development/libraries/intel-gmmlib/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub
+{ lib, stdenv, fetchFromGitHub
 , cmake
 }:
 
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ cmake ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/intel/gmmlib";
     license = licenses.mit;
     description = "Intel Graphics Memory Management Library";
diff --git a/pkgs/development/libraries/intel-media-driver/default.nix b/pkgs/development/libraries/intel-media-driver/default.nix
index 6f2f543af06db..75175bde4b3fe 100644
--- a/pkgs/development/libraries/intel-media-driver/default.nix
+++ b/pkgs/development/libraries/intel-media-driver/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub
+{ lib, stdenv, fetchFromGitHub
 , cmake, pkg-config
 , libva, libpciaccess, intel-gmmlib
 , enableX11 ? true, libX11
@@ -25,9 +25,9 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ cmake pkg-config ];
 
   buildInputs = [ libva libpciaccess intel-gmmlib ]
-    ++ stdenv.lib.optional enableX11 libX11;
+    ++ lib.optional enableX11 libX11;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Intel Media Driver for VAAPI — Broadwell+ iGPUs";
     longDescription = ''
       The Intel Media Driver for VAAPI is a new VA-API (Video Acceleration API)
@@ -41,8 +41,8 @@ stdenv.mkDerivation rec {
     maintainers = with maintainers; [ primeos jfrankenau ];
   };
 
-  postFixup = stdenv.lib.optionalString enableX11 ''
-    patchelf --set-rpath "$(patchelf --print-rpath $out/lib/dri/iHD_drv_video.so):${stdenv.lib.makeLibraryPath [ libX11  ]}" \
+  postFixup = lib.optionalString enableX11 ''
+    patchelf --set-rpath "$(patchelf --print-rpath $out/lib/dri/iHD_drv_video.so):${lib.makeLibraryPath [ libX11  ]}" \
       $out/lib/dri/iHD_drv_video.so
   '';
 }
diff --git a/pkgs/development/libraries/intel-media-sdk/default.nix b/pkgs/development/libraries/intel-media-sdk/default.nix
index 1fe45a492581d..dd605aaae5cd7 100644
--- a/pkgs/development/libraries/intel-media-sdk/default.nix
+++ b/pkgs/development/libraries/intel-media-sdk/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, pkg-config, gtest, libdrm, libpciaccess, libva, libX11
+{ lib, stdenv, fetchFromGitHub, cmake, pkg-config, gtest, libdrm, libpciaccess, libva, libX11
 , libXau, libXdmcp, libpthreadstubs }:
 
 stdenv.mkDerivation rec {
@@ -26,7 +26,7 @@ stdenv.mkDerivation rec {
 
   doCheck = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Intel Media SDK";
     license = licenses.mit;
     maintainers = with maintainers; [ midchildan ];
diff --git a/pkgs/development/libraries/ip2location-c/default.nix b/pkgs/development/libraries/ip2location-c/default.nix
index 8387aa67161b7..23801d3436daf 100644
--- a/pkgs/development/libraries/ip2location-c/default.nix
+++ b/pkgs/development/libraries/ip2location-c/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, autoreconfHook }:
+{ lib, stdenv, fetchurl, autoreconfHook }:
 
 stdenv.mkDerivation rec {
   pname = "ip2location-c";
@@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
   # databases are available, downloading them for just 1 test seems excessive):
   doCheck = false;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Library to look up locations of host names and IP addresses";
     longDescription = ''
       A C library to find the country, region, city,coordinates,
diff --git a/pkgs/development/libraries/irrlicht/default.nix b/pkgs/development/libraries/irrlicht/default.nix
index 84e7fae60450b..5214fa9e1490f 100644
--- a/pkgs/development/libraries/irrlicht/default.nix
+++ b/pkgs/development/libraries/irrlicht/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchzip, libGLU, libGL, unzip, libXrandr, libX11, libXxf86vm }:
+{ lib, stdenv, fetchzip, libGLU, libGL, unzip, libXrandr, libX11, libXxf86vm }:
 
 let
   common = import ./common.nix { inherit fetchzip; };
@@ -31,8 +31,8 @@ stdenv.mkDerivation rec {
 
   meta = {
     homepage = "http://irrlicht.sourceforge.net/";
-    license = stdenv.lib.licenses.zlib;
+    license = lib.licenses.zlib;
     description = "Open source high performance realtime 3D engine written in C++";
-    platforms = stdenv.lib.platforms.linux ++ stdenv.lib.platforms.darwin;
+    platforms = lib.platforms.linux ++ stdenv.lib.platforms.darwin;
   };
 }
diff --git a/pkgs/development/libraries/irrlicht/mac.nix b/pkgs/development/libraries/irrlicht/mac.nix
index 6a33b0feadbeb..b41486ce9dd67 100644
--- a/pkgs/development/libraries/irrlicht/mac.nix
+++ b/pkgs/development/libraries/irrlicht/mac.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchzip, libGLU, libGL, unzip, fetchFromGitHub, cmake, Cocoa, OpenGL, IOKit }:
+{ lib, stdenv, fetchzip, libGLU, libGL, unzip, fetchFromGitHub, cmake, Cocoa, OpenGL, IOKit }:
 
 let
   common = import ./common.nix { inherit fetchzip; };
@@ -36,8 +36,8 @@ stdenv.mkDerivation rec {
 
   meta = {
     homepage = "http://irrlicht.sourceforge.net/";
-    license = stdenv.lib.licenses.zlib;
+    license = lib.licenses.zlib;
     description = "Open source high performance realtime 3D engine written in C++";
-    platforms = stdenv.lib.platforms.darwin;
+    platforms = lib.platforms.darwin;
   };
 }
diff --git a/pkgs/development/libraries/isl/0.11.1.nix b/pkgs/development/libraries/isl/0.11.1.nix
index 1cac0d369fed7..5beffd1f0d2ed 100644
--- a/pkgs/development/libraries/isl/0.11.1.nix
+++ b/pkgs/development/libraries/isl/0.11.1.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, gmp }:
+{ lib, stdenv, fetchurl, gmp }:
 
 stdenv.mkDerivation {
   name = "isl-0.11.1"; # CLooG 0.16.3 fails to build with ISL 0.08.
@@ -15,8 +15,8 @@ stdenv.mkDerivation {
 
   meta = {
     homepage = "https://www.kotnet.org/~skimo/isl/";
-    license = stdenv.lib.licenses.lgpl21;
+    license = lib.licenses.lgpl21;
     description = "A library for manipulating sets and relations of integer points bounded by linear constraints";
-    platforms = stdenv.lib.platforms.all;
+    platforms = lib.platforms.all;
   };
 }
diff --git a/pkgs/development/libraries/isl/0.14.1.nix b/pkgs/development/libraries/isl/0.14.1.nix
index a97e05b0431a1..8936d6c5f3be4 100644
--- a/pkgs/development/libraries/isl/0.14.1.nix
+++ b/pkgs/development/libraries/isl/0.14.1.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, gmp }:
+{ lib, stdenv, fetchurl, gmp }:
 
 stdenv.mkDerivation rec {
   name = "isl-0.14.1";
@@ -14,8 +14,8 @@ stdenv.mkDerivation rec {
 
   meta = {
     homepage = "https://www.kotnet.org/~skimo/isl/";
-    license = stdenv.lib.licenses.lgpl21;
+    license = lib.licenses.lgpl21;
     description = "A library for manipulating sets and relations of integer points bounded by linear constraints";
-    platforms = stdenv.lib.platforms.all;
+    platforms = lib.platforms.all;
   };
 }
diff --git a/pkgs/development/libraries/isl/0.17.1.nix b/pkgs/development/libraries/isl/0.17.1.nix
index 018f708508814..a823b69fa27b1 100644
--- a/pkgs/development/libraries/isl/0.17.1.nix
+++ b/pkgs/development/libraries/isl/0.17.1.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, gmp }:
+{ lib, stdenv, fetchurl, gmp }:
 
 stdenv.mkDerivation rec {
   name = "isl-0.17.1";
@@ -14,8 +14,8 @@ stdenv.mkDerivation rec {
 
   meta = {
     homepage = "https://www.kotnet.org/~skimo/isl/";
-    license = stdenv.lib.licenses.lgpl21;
+    license = lib.licenses.lgpl21;
     description = "A library for manipulating sets and relations of integer points bounded by linear constraints";
-    platforms = stdenv.lib.platforms.all;
+    platforms = lib.platforms.all;
   };
 }
diff --git a/pkgs/development/libraries/isl/0.20.0.nix b/pkgs/development/libraries/isl/0.20.0.nix
index 3775bdc71e023..c35588555a7f7 100644
--- a/pkgs/development/libraries/isl/0.20.0.nix
+++ b/pkgs/development/libraries/isl/0.20.0.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, gmp }:
+{ lib, stdenv, fetchurl, gmp }:
 
 stdenv.mkDerivation rec {
   name = "isl-0.20";
@@ -14,8 +14,8 @@ stdenv.mkDerivation rec {
 
   meta = {
     homepage = "http://isl.gforge.inria.fr/";
-    license = stdenv.lib.licenses.lgpl21;
+    license = lib.licenses.lgpl21;
     description = "A library for manipulating sets and relations of integer points bounded by linear constraints";
-    platforms = stdenv.lib.platforms.all;
+    platforms = lib.platforms.all;
   };
 }
diff --git a/pkgs/development/libraries/iso-codes/default.nix b/pkgs/development/libraries/iso-codes/default.nix
index 8ba9ea31b8019..6d770430ce563 100644
--- a/pkgs/development/libraries/iso-codes/default.nix
+++ b/pkgs/development/libraries/iso-codes/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, gettext, python3}:
+{lib, stdenv, fetchurl, gettext, python3}:
 
 stdenv.mkDerivation rec {
   pname = "iso-codes";
@@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ gettext python3 ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://salsa.debian.org/iso-codes-team/iso-codes";
     description = "Various ISO codes packaged as XML files";
     license = licenses.lgpl21;
diff --git a/pkgs/development/libraries/itk/4.x.nix b/pkgs/development/libraries/itk/4.x.nix
index 7a7176c88c1e0..54a3c33cd0171 100644
--- a/pkgs/development/libraries/itk/4.x.nix
+++ b/pkgs/development/libraries/itk/4.x.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, libX11, libuuid, xz, vtk_7, Cocoa }:
+{ lib, stdenv, fetchFromGitHub, cmake, libX11, libuuid, xz, vtk_7, Cocoa }:
 
 stdenv.mkDerivation rec {
   pname = "itk";
@@ -23,13 +23,13 @@ stdenv.mkDerivation rec {
   ];
 
   nativeBuildInputs = [ cmake xz ];
-  buildInputs = [ libX11 libuuid vtk_7 ] ++ stdenv.lib.optionals stdenv.isDarwin [ Cocoa ];
+  buildInputs = [ libX11 libuuid vtk_7 ] ++ lib.optionals stdenv.isDarwin [ Cocoa ];
 
   meta = {
     description = "Insight Segmentation and Registration Toolkit";
     homepage = "https://www.itk.org/";
-    license = stdenv.lib.licenses.asl20;
-    maintainers = with stdenv.lib.maintainers; [viric];
-    platforms = with stdenv.lib.platforms; linux ++ darwin;
+    license = lib.licenses.asl20;
+    maintainers = with lib.maintainers; [viric];
+    platforms = with lib.platforms; linux ++ darwin;
   };
 }
diff --git a/pkgs/development/libraries/itk/default.nix b/pkgs/development/libraries/itk/default.nix
index 59a883e1f96b7..ac899ce26f109 100644
--- a/pkgs/development/libraries/itk/default.nix
+++ b/pkgs/development/libraries/itk/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, makeWrapper
+{ lib, stdenv, fetchFromGitHub, cmake, makeWrapper
 , pkg-config, libX11, libuuid, xz, vtk_7, Cocoa }:
 
 stdenv.mkDerivation rec {
@@ -29,7 +29,7 @@ stdenv.mkDerivation rec {
   ];
 
   nativeBuildInputs = [ cmake xz makeWrapper ];
-  buildInputs = [ libX11 libuuid vtk_7 ] ++ stdenv.lib.optionals stdenv.isDarwin [ Cocoa ];
+  buildInputs = [ libX11 libuuid vtk_7 ] ++ lib.optionals stdenv.isDarwin [ Cocoa ];
 
   postInstall = ''
     wrapProgram "$out/bin/h5c++" --prefix PATH ":" "${pkg-config}/bin"
@@ -38,7 +38,7 @@ stdenv.mkDerivation rec {
   meta = {
     description = "Insight Segmentation and Registration Toolkit";
     homepage = "https://www.itk.org/";
-    license = stdenv.lib.licenses.asl20;
-    maintainers = with stdenv.lib.maintainers; [viric];
+    license = lib.licenses.asl20;
+    maintainers = with lib.maintainers; [viric];
   };
 }
diff --git a/pkgs/development/libraries/itktcl/default.nix b/pkgs/development/libraries/itktcl/default.nix
index 3c70369eb91ee..570190a43c1e9 100644
--- a/pkgs/development/libraries/itktcl/default.nix
+++ b/pkgs/development/libraries/itktcl/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, tcl, tk, incrtcl }:
+{ lib, stdenv, fetchurl, tcl, tk, incrtcl }:
 
 stdenv.mkDerivation rec {
   pname = "itk-tcl";
@@ -23,13 +23,13 @@ stdenv.mkDerivation rec {
     rmdir $out/bin
     mv $out/lib/itk${version}/* $out/lib
     ln -s libitk${version}${stdenv.hostPlatform.extensions.sharedLibrary} \
-      $out/lib/libitk${stdenv.lib.versions.major version}${stdenv.hostPlatform.extensions.sharedLibrary}
+      $out/lib/libitk${lib.versions.major version}${stdenv.hostPlatform.extensions.sharedLibrary}
     rmdir $out/lib/itk${version}
   '';
 
   outputs = [ "out" "dev" "man" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage    = "http://incrtcl.sourceforge.net/";
     description = "Mega-widget toolkit for incr Tk";
     license     = licenses.tcltk;
diff --git a/pkgs/development/libraries/jama/default.nix b/pkgs/development/libraries/jama/default.nix
index 5c7473be647a2..02dd4a5635b5d 100644
--- a/pkgs/development/libraries/jama/default.nix
+++ b/pkgs/development/libraries/jama/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, unzip, tnt}:
+{lib, stdenv, fetchurl, unzip, tnt}:
 
 stdenv.mkDerivation rec {
   pname = "jama";
@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
       cp *.h $out/include
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://math.nist.gov/tnt/";
     description = "JAMA/C++ Linear Algebra Package: Java-like matrix C++ templates";
     platforms = platforms.unix;
diff --git a/pkgs/development/libraries/jansson/default.nix b/pkgs/development/libraries/jansson/default.nix
index 7ecf7579a307f..85451511d7e4f 100644
--- a/pkgs/development/libraries/jansson/default.nix
+++ b/pkgs/development/libraries/jansson/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl}:
+{lib, stdenv, fetchurl}:
 
 stdenv.mkDerivation rec {
   name = "jansson-2.13.1";
@@ -8,7 +8,7 @@ stdenv.mkDerivation rec {
     sha256 = "0ks7gbs0j8p4dmmi2sq129mxy5gfg0z6220i1jk020mi2zd7gwzl";
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://www.digip.org/jansson/";
     description = "C library for encoding, decoding and manipulating JSON data";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/java/commons/bcel/default.nix b/pkgs/development/libraries/java/commons/bcel/default.nix
index 4a2b030a3dbf2..9d34aaf6c8e9c 100644
--- a/pkgs/development/libraries/java/commons/bcel/default.nix
+++ b/pkgs/development/libraries/java/commons/bcel/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl}:
+{lib, stdenv, fetchurl}:
 
 stdenv.mkDerivation rec {
   version = "5.2";
@@ -18,8 +18,8 @@ stdenv.mkDerivation rec {
   meta = {
     homepage    = "http://commons.apache.org/proper/commons-bcel/";
     description = "Gives users a convenient way to analyze, create, and manipulate (binary) Java class files";
-    maintainers = with stdenv.lib.maintainers; [ copumpkin ];
-    license     = stdenv.lib.licenses.asl20;
-    platforms = with stdenv.lib.platforms; unix;
+    maintainers = with lib.maintainers; [ copumpkin ];
+    license     = lib.licenses.asl20;
+    platforms = with lib.platforms; unix;
   };
 }
diff --git a/pkgs/development/libraries/java/commons/bsf/default.nix b/pkgs/development/libraries/java/commons/bsf/default.nix
index 46bd3c0fd1552..629ab7ec131a4 100644
--- a/pkgs/development/libraries/java/commons/bsf/default.nix
+++ b/pkgs/development/libraries/java/commons/bsf/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl}:
+{lib, stdenv, fetchurl}:
 
 stdenv.mkDerivation {
   name = "commons-bsf-1.2";
@@ -16,8 +16,8 @@ stdenv.mkDerivation {
   meta = {
     description = "Interface to scripting languages, including JSR-223";
     homepage = "http://commons.apache.org/proper/commons-bsf/";
-    license = stdenv.lib.licenses.asl20;
-    platforms = stdenv.lib.platforms.unix;
+    license = lib.licenses.asl20;
+    platforms = lib.platforms.unix;
   };
 }
 
diff --git a/pkgs/development/libraries/java/commons/compress/default.nix b/pkgs/development/libraries/java/commons/compress/default.nix
index 5307c635834cc..79f63026e388d 100644
--- a/pkgs/development/libraries/java/commons/compress/default.nix
+++ b/pkgs/development/libraries/java/commons/compress/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
   version = "1.20";
@@ -18,8 +18,8 @@ stdenv.mkDerivation rec {
   meta = {
     homepage    = "http://commons.apache.org/proper/commons-compress";
     description = "Allows manipulation of ar, cpio, Unix dump, tar, zip, gzip, XZ, Pack200, bzip2, 7z, arj, lzma, snappy, DEFLATE and Z files";
-    maintainers = with stdenv.lib.maintainers; [ copumpkin ];
-    license     = stdenv.lib.licenses.asl20;
-    platforms = with stdenv.lib.platforms; unix;
+    maintainers = with lib.maintainers; [ copumpkin ];
+    license     = lib.licenses.asl20;
+    platforms = with lib.platforms; unix;
   };
 }
diff --git a/pkgs/development/libraries/java/commons/fileupload/default.nix b/pkgs/development/libraries/java/commons/fileupload/default.nix
index cd439b503971c..868f2da4e537e 100644
--- a/pkgs/development/libraries/java/commons/fileupload/default.nix
+++ b/pkgs/development/libraries/java/commons/fileupload/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl}:
+{lib, stdenv, fetchurl}:
 
 stdenv.mkDerivation rec {
   version = "1.3.1";
@@ -17,8 +17,8 @@ stdenv.mkDerivation rec {
   meta = {
     homepage    = "http://commons.apache.org/proper/commons-fileupload";
     description = "Makes it easy to add robust, high-performance, file upload capability to your servlets and web applications";
-    maintainers = with stdenv.lib.maintainers; [ copumpkin ];
-    license     = stdenv.lib.licenses.asl20;
-    platforms = with stdenv.lib.platforms; unix;
+    maintainers = with lib.maintainers; [ copumpkin ];
+    license     = lib.licenses.asl20;
+    platforms = with lib.platforms; unix;
   };
 }
diff --git a/pkgs/development/libraries/java/commons/io/default.nix b/pkgs/development/libraries/java/commons/io/default.nix
index 10587a72ecdab..0c5ac8f4dded5 100644
--- a/pkgs/development/libraries/java/commons/io/default.nix
+++ b/pkgs/development/libraries/java/commons/io/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
   version = "2.8.0";
@@ -18,8 +18,8 @@ stdenv.mkDerivation rec {
   meta = {
     homepage    = "http://commons.apache.org/proper/commons-io";
     description = "A library of utilities to assist with developing IO functionality";
-    maintainers = with stdenv.lib.maintainers; [ copumpkin ];
-    license     = stdenv.lib.licenses.asl20;
-    platforms = with stdenv.lib.platforms; unix;
+    maintainers = with lib.maintainers; [ copumpkin ];
+    license     = lib.licenses.asl20;
+    platforms = with lib.platforms; unix;
   };
 }
diff --git a/pkgs/development/libraries/java/commons/lang/default.nix b/pkgs/development/libraries/java/commons/lang/default.nix
index bd0f7c273e79c..5009fe6cac7fc 100644
--- a/pkgs/development/libraries/java/commons/lang/default.nix
+++ b/pkgs/development/libraries/java/commons/lang/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
   version = "3.11";
@@ -18,8 +18,8 @@ stdenv.mkDerivation rec {
   meta = {
     homepage    = "http://commons.apache.org/proper/commons-lang";
     description = "Provides additional methods to manipulate standard Java library classes";
-    maintainers = with stdenv.lib.maintainers; [ copumpkin ];
-    license     = stdenv.lib.licenses.asl20;
-    platforms = with stdenv.lib.platforms; unix;
+    maintainers = with lib.maintainers; [ copumpkin ];
+    license     = lib.licenses.asl20;
+    platforms = with lib.platforms; unix;
   };
 }
diff --git a/pkgs/development/libraries/java/commons/logging/default.nix b/pkgs/development/libraries/java/commons/logging/default.nix
index 7c2192e4952e0..d63a214e2ad7e 100644
--- a/pkgs/development/libraries/java/commons/logging/default.nix
+++ b/pkgs/development/libraries/java/commons/logging/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl}:
+{lib, stdenv, fetchurl}:
 
 stdenv.mkDerivation {
   name = "commons-logging-1.2";
@@ -16,8 +16,8 @@ stdenv.mkDerivation {
   meta = {
     description = "Wrapper around a variety of logging API implementations";
     homepage = "http://commons.apache.org/proper/commons-logging";
-    license = stdenv.lib.licenses.asl20;
-    platforms = stdenv.lib.platforms.unix;
+    license = lib.licenses.asl20;
+    platforms = lib.platforms.unix;
   };
 }
 
diff --git a/pkgs/development/libraries/java/commons/math/default.nix b/pkgs/development/libraries/java/commons/math/default.nix
index 7c4fc5c632e2f..960f12fb8bfb9 100644
--- a/pkgs/development/libraries/java/commons/math/default.nix
+++ b/pkgs/development/libraries/java/commons/math/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
   version = "3.6.1";
@@ -18,8 +18,8 @@ stdenv.mkDerivation rec {
   meta = {
     homepage    = "http://commons.apache.org/proper/commons-math/";
     description = "A library of lightweight, self-contained mathematics and statistics components";
-    maintainers = with stdenv.lib.maintainers; [ copumpkin ];
-    license     = stdenv.lib.licenses.asl20;
-    platforms = with stdenv.lib.platforms; unix;
+    maintainers = with lib.maintainers; [ copumpkin ];
+    license     = lib.licenses.asl20;
+    platforms = with lib.platforms; unix;
   };
 }
diff --git a/pkgs/development/libraries/java/cup/default.nix b/pkgs/development/libraries/java/cup/default.nix
index acf8cc9b83d94..f7732ff637af1 100644
--- a/pkgs/development/libraries/java/cup/default.nix
+++ b/pkgs/development/libraries/java/cup/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, jdk, ant } :
+{ lib, stdenv, fetchurl, jdk, ant } :
 
 stdenv.mkDerivation rec {
   pname = "java-cup";
@@ -31,8 +31,8 @@ stdenv.mkDerivation rec {
   meta = {
     homepage = "http://www2.cs.tum.edu/projects/cup/";
     description = "LALR parser generator for Java";
-    license = stdenv.lib.licenses.mit;
-    platforms = stdenv.lib.platforms.all;
-    maintainers = [ stdenv.lib.maintainers.romildo ];
+    license = lib.licenses.mit;
+    platforms = lib.platforms.all;
+    maintainers = [ lib.maintainers.romildo ];
   };
 }
diff --git a/pkgs/development/libraries/java/dbus-java/default.nix b/pkgs/development/libraries/java/dbus-java/default.nix
index 0133138b47849..505d60e2c8da4 100644
--- a/pkgs/development/libraries/java/dbus-java/default.nix
+++ b/pkgs/development/libraries/java/dbus-java/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, gettext, jdk8, libmatthew_java}:
+{lib, stdenv, fetchurl, gettext, jdk8, libmatthew_java}:
 
 let jdk = jdk8; in
 stdenv.mkDerivation {
@@ -19,7 +19,7 @@ stdenv.mkDerivation {
            -e "s|install: install-bin install-man install-doc|install: install-bin|" Makefile
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     platforms = platforms.linux;
     maintainers = [ maintainers.sander ];
     license = licenses.afl21;
diff --git a/pkgs/development/libraries/java/geoipjava/default.nix b/pkgs/development/libraries/java/geoipjava/default.nix
index fd4bfb2970681..4d9902cbbe9a4 100644
--- a/pkgs/development/libraries/java/geoipjava/default.nix
+++ b/pkgs/development/libraries/java/geoipjava/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, jdk, unzip}:
+{lib, stdenv, fetchurl, jdk, unzip}:
 
 stdenv.mkDerivation {
   name = "GeoIPJava-1.2.5";
@@ -20,8 +20,8 @@ stdenv.mkDerivation {
     '';
   meta = {
     description = "GeoIP Java API";
-    license = stdenv.lib.licenses.lgpl21Plus;
-    maintainers = [ stdenv.lib.maintainers.sander ];
-    platforms = stdenv.lib.platforms.unix;
+    license = lib.licenses.lgpl21Plus;
+    maintainers = [ lib.maintainers.sander ];
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/java/gwt-dragdrop/default.nix b/pkgs/development/libraries/java/gwt-dragdrop/default.nix
index 37d7cac0da261..34a0e8c530a47 100644
--- a/pkgs/development/libraries/java/gwt-dragdrop/default.nix
+++ b/pkgs/development/libraries/java/gwt-dragdrop/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl}:
+{lib, stdenv, fetchurl}:
 
 stdenv.mkDerivation {
   name = "gwt-dnd-2.6.5";
@@ -9,7 +9,7 @@ stdenv.mkDerivation {
     sha256 = "07zdlr8afs499asnw0dcjmw1cnjc646v91lflx5dv4qj374c97fw";
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     platforms = platforms.unix;
     license = licenses.asl20;
   };
diff --git a/pkgs/development/libraries/java/gwt-widgets/default.nix b/pkgs/development/libraries/java/gwt-widgets/default.nix
index a968ebc5fd8e6..692326a218953 100644
--- a/pkgs/development/libraries/java/gwt-widgets/default.nix
+++ b/pkgs/development/libraries/java/gwt-widgets/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl}:
+{lib, stdenv, fetchurl}:
 
 stdenv.mkDerivation {
   name = "gwt-widgets-0.2.0";
@@ -9,7 +9,7 @@ stdenv.mkDerivation {
     sha256 = "09isj4j6842rj13nv8264irkjjhvmgihmi170ciabc98911bakxb";
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     platforms = platforms.unix;
     license = with licenses; [ afl21 lgpl2 ];
   };
diff --git a/pkgs/development/libraries/java/hsqldb/default.nix b/pkgs/development/libraries/java/hsqldb/default.nix
index 88f32866b0d06..433cf75ad5a48 100644
--- a/pkgs/development/libraries/java/hsqldb/default.nix
+++ b/pkgs/development/libraries/java/hsqldb/default.nix
@@ -1,9 +1,9 @@
-{ stdenv, fetchurl, unzip, makeWrapper, jre }:
+{ lib, stdenv, fetchurl, unzip, makeWrapper, jre }:
 
 stdenv.mkDerivation rec {
   pname = "hsqldb";
   version = "2.5.1";
-  underscoreMajMin = stdenv.lib.strings.replaceChars ["."] ["_"] (stdenv.lib.versions.majorMinor version);
+  underscoreMajMin = lib.strings.replaceChars ["."] ["_"] (stdenv.lib.versions.majorMinor version);
 
   src = fetchurl {
     url = "mirror://sourceforge/project/hsqldb/hsqldb/hsqldb_${underscoreMajMin}/hsqldb-${version}.zip";
@@ -29,7 +29,7 @@ stdenv.mkDerivation rec {
    runHook postInstall
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://hsqldb.org";
     description = "A relational, embedable database management system written in Java and a set of related tools";
     platforms = platforms.unix;
diff --git a/pkgs/development/libraries/java/httpunit/default.nix b/pkgs/development/libraries/java/httpunit/default.nix
index 34af97605d2a8..ad276fcdd6364 100644
--- a/pkgs/development/libraries/java/httpunit/default.nix
+++ b/pkgs/development/libraries/java/httpunit/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, unzip} :
+{lib, stdenv, fetchurl, unzip} :
 
 stdenv.mkDerivation {
   name = "httpunit-1.7";
@@ -11,7 +11,7 @@ stdenv.mkDerivation {
 
   inherit unzip;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://httpunit.sourceforge.net";
     platforms = platforms.unix;
     license = licenses.mit;
diff --git a/pkgs/development/libraries/java/hydra-ant-logger/default.nix b/pkgs/development/libraries/java/hydra-ant-logger/default.nix
index 54e85ec558978..19bc3524c5904 100644
--- a/pkgs/development/libraries/java/hydra-ant-logger/default.nix
+++ b/pkgs/development/libraries/java/hydra-ant-logger/default.nix
@@ -1,4 +1,4 @@
-{ fetchgit, stdenv, ant, jdk }:
+{ fetchgit, lib, stdenv, ant, jdk }:
 
 stdenv.mkDerivation {
   pname = "hydra-ant-logger";
@@ -20,6 +20,6 @@ stdenv.mkDerivation {
   '';
 
   meta = {
-    platforms = stdenv.lib.platforms.unix;
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/java/jdom/default.nix b/pkgs/development/libraries/java/jdom/default.nix
index 60558f72cfc84..4bb90dd98874b 100644
--- a/pkgs/development/libraries/java/jdom/default.nix
+++ b/pkgs/development/libraries/java/jdom/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl} :
+{lib, stdenv, fetchurl} :
 
 stdenv.mkDerivation {
   name = "jdom-1.0";
@@ -9,7 +9,7 @@ stdenv.mkDerivation {
     sha256 = "1igmxzcy0s25zcy9vmcw0kd13lh60r0b4qg8lnp1jic33f427pxf";
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Java-based solution for accessing, manipulating, and outputting XML data from Java code";
     homepage = "http://www.jdom.org";
     platforms = platforms.unix;
diff --git a/pkgs/development/libraries/java/jflex/default.nix b/pkgs/development/libraries/java/jflex/default.nix
index d0258d5896be9..cf5b42a0ac215 100644
--- a/pkgs/development/libraries/java/jflex/default.nix
+++ b/pkgs/development/libraries/java/jflex/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, jre} :
+{lib, stdenv, fetchurl, jre} :
 
 stdenv.mkDerivation rec {
   name = "jflex-1.8.2";
@@ -31,7 +31,7 @@ stdenv.mkDerivation rec {
   meta = {
     homepage = "https://www.jflex.de/";
     description = "Lexical analyzer generator for Java, written in Java";
-    license = stdenv.lib.licenses.bsd3;
-    platforms = stdenv.lib.platforms.unix;
+    license = lib.licenses.bsd3;
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/java/junit/default.nix b/pkgs/development/libraries/java/junit/default.nix
index c114ddeac2749..1695d11cb25f0 100644
--- a/pkgs/development/libraries/java/junit/default.nix
+++ b/pkgs/development/libraries/java/junit/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, antBuild, fetchgit, perl }:
+{ lib, stdenv, antBuild, fetchgit, perl }:
 
 let
   version = "4.11";
@@ -22,7 +22,7 @@ in antBuild {
   meta = {
     homepage = "http://www.junit.org/";
     description = "A framework for repeatable tests in Java";
-    license = stdenv.lib.licenses.epl10;
+    license = lib.licenses.epl10;
     broken = true;
   };
 }
diff --git a/pkgs/development/libraries/java/junixsocket/default.nix b/pkgs/development/libraries/java/junixsocket/default.nix
index cb88df276a57b..b9b00223186a8 100644
--- a/pkgs/development/libraries/java/junixsocket/default.nix
+++ b/pkgs/development/libraries/java/junixsocket/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, ant, jdk, junit }:
+{ lib, stdenv, fetchurl, ant, jdk, junit }:
 
 stdenv.mkDerivation rec {
   name = "junixsocket-1.3";
@@ -24,7 +24,7 @@ stdenv.mkDerivation rec {
     # Note that our OpenJDK on Darwin is currently 32-bit, so we have to build a 32-bit dylib.
     (if stdenv.is64bit then [ "-Dskip32=true" ] else [ "-Dskip64=true" ])
     ++ [ "-Dgcc=cc" "-Dant.build.javac.source=1.6" ]
-    ++ stdenv.lib.optional stdenv.isDarwin "-DisMac=true";
+    ++ lib.optional stdenv.isDarwin "-DisMac=true";
 
   installPhase =
     ''
@@ -36,7 +36,7 @@ stdenv.mkDerivation rec {
   meta = {
     description = "A Java/JNI library for using Unix Domain Sockets from Java";
     homepage = "https://github.com/kohlschutter/junixsocket";
-    license = stdenv.lib.licenses.asl20;
-    platforms = stdenv.lib.platforms.linux ++ stdenv.lib.platforms.darwin;
+    license = lib.licenses.asl20;
+    platforms = lib.platforms.linux ++ stdenv.lib.platforms.darwin;
   };
 }
diff --git a/pkgs/development/libraries/java/libmatthew-java/default.nix b/pkgs/development/libraries/java/libmatthew-java/default.nix
index 8b8123dff2b35..b0173cbdb8494 100644
--- a/pkgs/development/libraries/java/libmatthew-java/default.nix
+++ b/pkgs/development/libraries/java/libmatthew-java/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, jdk}:
+{lib, stdenv, fetchurl, jdk}:
 
 stdenv.mkDerivation {
   name = "libmatthew-java-0.8";
@@ -10,7 +10,7 @@ stdenv.mkDerivation {
   PREFIX=''''${out}'';
   buildInputs = [ jdk ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     platforms = platforms.linux;
     maintainers = [ maintainers.sander ];
     license = licenses.mit;
diff --git a/pkgs/development/libraries/java/lombok/default.nix b/pkgs/development/libraries/java/lombok/default.nix
index 6d09bead53e4e..ddf95ead249ab 100644
--- a/pkgs/development/libraries/java/lombok/default.nix
+++ b/pkgs/development/libraries/java/lombok/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, makeWrapper, jdk }:
+{ lib, stdenv, fetchurl, makeWrapper, jdk }:
 
 stdenv.mkDerivation rec {
   name = "lombok-1.18.16";
@@ -23,9 +23,9 @@ stdenv.mkDerivation rec {
 
   meta = {
     description = "A library that can write a lot of boilerplate for your Java project";
-    platforms = stdenv.lib.platforms.all;
-    license = stdenv.lib.licenses.mit;
+    platforms = lib.platforms.all;
+    license = lib.licenses.mit;
     homepage = "https://projectlombok.org/";
-    maintainers = [ stdenv.lib.maintainers.CrystalGamma ];
+    maintainers = [ lib.maintainers.CrystalGamma ];
   };
 }
diff --git a/pkgs/development/libraries/java/lucene/default.nix b/pkgs/development/libraries/java/lucene/default.nix
index c0eabe51657d9..417c7b9690009 100644
--- a/pkgs/development/libraries/java/lucene/default.nix
+++ b/pkgs/development/libraries/java/lucene/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl} :
+{lib, stdenv, fetchurl} :
 
 stdenv.mkDerivation rec {
   pname = "lucene";
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
     sha256 = "1mxaxg65f7v8n60irjwm24v7hcisbl0srmpvcy1l4scs6rjj1awh";
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Java full-text search engine";
     platforms = platforms.unix;
     license = licenses.asl20;
diff --git a/pkgs/development/libraries/java/mockobjects/default.nix b/pkgs/development/libraries/java/mockobjects/default.nix
index 817c861436f80..e20d7e707e717 100644
--- a/pkgs/development/libraries/java/mockobjects/default.nix
+++ b/pkgs/development/libraries/java/mockobjects/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl} :
+{lib, stdenv, fetchurl} :
 
 stdenv.mkDerivation {
   name = "mockobjects-0.09";
@@ -9,7 +9,7 @@ stdenv.mkDerivation {
     sha256 = "18rnyqfcyh0s3dwkkaszdd50ssyjx5fa1y3ii309ldqg693lfgnz";
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Generic unit testing framework and methodology for testing any kind of code";
     platforms = platforms.unix;
     license = licenses.asl20;
diff --git a/pkgs/development/libraries/java/rhino/default.nix b/pkgs/development/libraries/java/rhino/default.nix
index d3d10f61b70ff..d34787d8b1f03 100644
--- a/pkgs/development/libraries/java/rhino/default.nix
+++ b/pkgs/development/libraries/java/rhino/default.nix
@@ -1,4 +1,4 @@
-{ fetchurl, stdenv, unzip, ant, javac, jvm }:
+{ fetchurl, lib, stdenv, unzip, ant, javac, jvm }:
 
 let
   version = "1.7R2";
@@ -43,7 +43,7 @@ stdenv.mkDerivation {
       cp -v *.jar "$out/share/java"
     '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "An implementation of JavaScript written in Java";
 
     longDescription =
diff --git a/pkgs/development/libraries/java/saxon/default.nix b/pkgs/development/libraries/java/saxon/default.nix
index ef403be60df46..e6f2fcadbe75d 100644
--- a/pkgs/development/libraries/java/saxon/default.nix
+++ b/pkgs/development/libraries/java/saxon/default.nix
@@ -1,8 +1,8 @@
-{ stdenv, fetchurl, unzip, jre }:
+{ lib, stdenv, fetchurl, unzip, jre }:
 
 let
   common = { pname, version, src, description
-           , prog ? null, jar ? null, license ? stdenv.lib.licenses.mpl20 }:
+           , prog ? null, jar ? null, license ? lib.licenses.mpl20 }:
     stdenv.mkDerivation {
       name = "${pname}-${version}";
       inherit pname version src;
@@ -26,7 +26,7 @@ let
         chmod a+x $out/bin/${prog'}
       '';
 
-      meta = with stdenv.lib; {
+      meta = with lib; {
         inherit description license;
         homepage = "http://saxon.sourceforge.net/";
         maintainers = with maintainers; [ rvl ];
@@ -44,7 +44,7 @@ in {
     };
     description = "XSLT 1.0 processor";
     # http://saxon.sourceforge.net/saxon6.5.3/conditions.html
-    license = stdenv.lib.licenses.mpl10;
+    license = lib.licenses.mpl10;
   };
 
   saxonb_8_8 = common {
diff --git a/pkgs/development/libraries/java/smack/default.nix b/pkgs/development/libraries/java/smack/default.nix
index c1d41e7743d55..f831bfc8b9338 100644
--- a/pkgs/development/libraries/java/smack/default.nix
+++ b/pkgs/development/libraries/java/smack/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl}:
+{lib, stdenv, fetchurl}:
 
 stdenv.mkDerivation {
   name = "smack-4.1.9";
@@ -12,7 +12,7 @@ stdenv.mkDerivation {
   meta = {
     description = "A XMPP (Jabber) client library for instant messaging and presence";
     homepage = "http://www.igniterealtime.org/projects/smack/";
-    platforms = stdenv.lib.platforms.unix;
-    license = stdenv.lib.licenses.asl20;
+    platforms = lib.platforms.unix;
+    license = lib.licenses.asl20;
   };
 }
diff --git a/pkgs/development/libraries/java/swt/default.nix b/pkgs/development/libraries/java/swt/default.nix
index 4cbdca9932ff7..bf35490f9a889 100644
--- a/pkgs/development/libraries/java/swt/default.nix
+++ b/pkgs/development/libraries/java/swt/default.nix
@@ -63,7 +63,7 @@ in stdenv.mkDerivation rec {
     cd out && jar -c * > $out/jars/swt.jar
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://www.eclipse.org/swt/";
     description = "An widget toolkit for Java to access the user-interface facilities of the operating systems on which it is implemented";
     license = licenses.epl10;
diff --git a/pkgs/development/libraries/jbig2dec/default.nix b/pkgs/development/libraries/jbig2dec/default.nix
index 4004c9f387efc..6f9d88d63666b 100644
--- a/pkgs/development/libraries/jbig2dec/default.nix
+++ b/pkgs/development/libraries/jbig2dec/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, python3, autoreconfHook }:
+{ lib, stdenv, fetchurl, python3, autoreconfHook }:
 
 stdenv.mkDerivation rec {
   pname = "jbig2dec";
@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
   meta = {
     homepage = "https://www.jbig2dec.com/";
     description = "Decoder implementation of the JBIG2 image compression format";
-    license = stdenv.lib.licenses.gpl2Plus;
-    platforms = stdenv.lib.platforms.unix;
+    license = lib.licenses.gpl2Plus;
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/jbigkit/default.nix b/pkgs/development/libraries/jbigkit/default.nix
index c21d51bc5a7cf..ab55e76f29a3d 100644
--- a/pkgs/development/libraries/jbigkit/default.nix
+++ b/pkgs/development/libraries/jbigkit/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
   name = "jbigkit-2.1";
@@ -10,8 +10,8 @@ stdenv.mkDerivation rec {
 
   makeFlags = [
     "CC=${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc"
-    "AR=${stdenv.lib.getBin stdenv.cc.bintools.bintools}/bin/${stdenv.cc.targetPrefix}ar"
-    "RANLIB=${stdenv.lib.getBin stdenv.cc.bintools.bintools}/bin/${stdenv.cc.targetPrefix}ranlib"
+    "AR=${lib.getBin stdenv.cc.bintools.bintools}/bin/${stdenv.cc.targetPrefix}ar"
+    "RANLIB=${lib.getBin stdenv.cc.bintools.bintools}/bin/${stdenv.cc.targetPrefix}ranlib"
   ];
 
   postPatch = ''
@@ -42,7 +42,7 @@ stdenv.mkDerivation rec {
     runHook postInstall
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://www.cl.cam.ac.uk/~mgk25/jbigkit/";
     description = "A software implementation of the JBIG1 data compression standard";
     license = licenses.gpl2Plus;
diff --git a/pkgs/development/libraries/jcal/default.nix b/pkgs/development/libraries/jcal/default.nix
index a40de74037a2e..2b57bd4064b79 100644
--- a/pkgs/development/libraries/jcal/default.nix
+++ b/pkgs/development/libraries/jcal/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, autoreconfHook
+{ lib, stdenv, fetchFromGitHub, autoreconfHook
 , readline
 }:
 
@@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
 
   preAutoreconf = "cd sources/";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Jalali calendar is a small and portable free software library to manipulate date and time in Jalali calendar system";
     homepage =  "http://nongnu.org/jcal/";
     license = licenses.gpl3;
diff --git a/pkgs/development/libraries/jemalloc/common.nix b/pkgs/development/libraries/jemalloc/common.nix
index fc4f0f2fe6e82..d5fe07b00f2ac 100644
--- a/pkgs/development/libraries/jemalloc/common.nix
+++ b/pkgs/development/libraries/jemalloc/common.nix
@@ -1,5 +1,5 @@
 { version, sha256 }:
-{ stdenv, fetchurl
+{ lib, stdenv, fetchurl
 # By default, jemalloc puts a je_ prefix onto all its symbols on OSX, which
 # then stops downstream builds (mariadb in particular) from detecting it. This
 # option should remove the prefix and give us a working jemalloc.
@@ -9,7 +9,7 @@
 , disableInitExecTls ? false
 }:
 
-with stdenv.lib;
+with lib;
 
 stdenv.mkDerivation rec {
   pname = "jemalloc";
@@ -37,7 +37,7 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://jemalloc.net";
     description = "General purpose malloc(3) implementation";
     longDescription = ''
diff --git a/pkgs/development/libraries/jitterentropy/default.nix b/pkgs/development/libraries/jitterentropy/default.nix
index 4cafa7434b126..11f6141872db0 100644
--- a/pkgs/development/libraries/jitterentropy/default.nix
+++ b/pkgs/development/libraries/jitterentropy/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub }:
+{ lib, stdenv, fetchFromGitHub }:
 stdenv.mkDerivation rec {
   pname = "jitterentropy";
   version = "2.2.0";
@@ -30,8 +30,8 @@ stdenv.mkDerivation rec {
   meta = {
     description = "Provides a noise source using the CPU execution timing jitter";
     homepage = "https://github.com/smuellerDD/jitterentropy-library";
-    license = with stdenv.lib.licenses; [ gpl2 bsd3 ];
-    platforms = stdenv.lib.platforms.linux;
-    maintainers = with stdenv.lib.maintainers; [ johnazoidberg ];
+    license = with lib.licenses; [ gpl2 bsd3 ];
+    platforms = lib.platforms.linux;
+    maintainers = with lib.maintainers; [ johnazoidberg ];
   };
 }
diff --git a/pkgs/development/libraries/json-c/default.nix b/pkgs/development/libraries/json-c/default.nix
index d72d502143486..5a77ea789afeb 100644
--- a/pkgs/development/libraries/json-c/default.nix
+++ b/pkgs/development/libraries/json-c/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, cmake }:
+{ lib, stdenv, fetchurl, cmake }:
 
 stdenv.mkDerivation rec {
   pname = "json-c";
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ cmake ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A JSON implementation in C";
     homepage    = "https://github.com/json-c/json-c/wiki";
     maintainers = with maintainers; [ lovek323 ];
diff --git a/pkgs/development/libraries/json-glib/default.nix b/pkgs/development/libraries/json-glib/default.nix
index 07e6d679aa76f..a820d947b7f89 100644
--- a/pkgs/development/libraries/json-glib/default.nix
+++ b/pkgs/development/libraries/json-glib/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, glib, meson, ninja, pkg-config, gettext
+{ lib, stdenv, fetchurl, glib, meson, ninja, pkg-config, gettext
 , gobject-introspection, fixDarwinDylibNames, gnome3
 }:
 
@@ -9,13 +9,13 @@ in stdenv.mkDerivation rec {
   name = "${pname}-${version}";
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${name}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${name}.tar.xz";
     sha256 = "0ixwyis47v5bkx6h8a1iqlw3638cxcv57ivxv4gw2gaig51my33j";
   };
 
   propagatedBuildInputs = [ glib ];
   nativeBuildInputs = [ meson ninja pkg-config gettext gobject-introspection glib ]
-    ++ stdenv.lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames;
+    ++ lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames;
 
   outputs = [ "out" "dev" ];
 
@@ -27,7 +27,7 @@ in stdenv.mkDerivation rec {
     };
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A library providing (de)serialization support for the JavaScript Object Notation (JSON) format";
     homepage = "https://wiki.gnome.org/Projects/JsonGlib";
     license = licenses.lgpl2;
diff --git a/pkgs/development/libraries/jsoncpp/default.nix b/pkgs/development/libraries/jsoncpp/default.nix
index 73aaaec4e4c44..71b0d7b9a9228 100644
--- a/pkgs/development/libraries/jsoncpp/default.nix
+++ b/pkgs/development/libraries/jsoncpp/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, python, validatePkgConfig, fetchpatch }:
+{ lib, stdenv, fetchFromGitHub, cmake, python, validatePkgConfig, fetchpatch }:
 
 stdenv.mkDerivation rec {
   pname = "jsoncpp";
@@ -39,7 +39,7 @@ stdenv.mkDerivation rec {
     "-DJSONCPP_WITH_CMAKE_PACKAGE=ON"
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     inherit version;
     homepage = "https://github.com/open-source-parsers/jsoncpp";
     description = "A C++ library for interacting with JSON";
diff --git a/pkgs/development/libraries/jsonrpc-glib/default.nix b/pkgs/development/libraries/jsonrpc-glib/default.nix
index da84578d7804d..1ec9c3da41e20 100644
--- a/pkgs/development/libraries/jsonrpc-glib/default.nix
+++ b/pkgs/development/libraries/jsonrpc-glib/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, meson, ninja, glib, json-glib, pkg-config, gobject-introspection, vala, gtk-doc, docbook_xsl, docbook_xml_dtd_43, gnome3 }:
+{ lib, stdenv, fetchurl, meson, ninja, glib, json-glib, pkg-config, gobject-introspection, vala, gtk-doc, docbook_xsl, docbook_xml_dtd_43, gnome3 }:
 stdenv.mkDerivation rec {
   pname = "jsonrpc-glib";
   version = "3.38.0";
@@ -9,7 +9,7 @@ stdenv.mkDerivation rec {
   buildInputs = [ glib json-glib ];
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "3F8ZFKkRUrcPqPyaEe3hMUirSvZE2yejZjI4jJJ6ioI=";
   };
 
@@ -27,7 +27,7 @@ stdenv.mkDerivation rec {
     };
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A library to communicate using the JSON-RPC 2.0 specification";
     homepage = "https://gitlab.gnome.org/GNOME/jsonrpc-glib";
     license = licenses.lgpl21Plus;
diff --git a/pkgs/development/libraries/judy/default.nix b/pkgs/development/libraries/judy/default.nix
index ad422db3d48ee..037225b86e5be 100644
--- a/pkgs/development/libraries/judy/default.nix
+++ b/pkgs/development/libraries/judy/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl}:
+{lib, stdenv, fetchurl}:
 
 stdenv.mkDerivation {
   name = "judy-1.0.5";
@@ -10,14 +10,14 @@ stdenv.mkDerivation {
 
   # gcc 4.8 optimisations break judy.
   # https://sourceforge.net/p/judy/mailman/message/31995144/
-  preConfigure = stdenv.lib.optionalString stdenv.cc.isGNU ''
+  preConfigure = lib.optionalString stdenv.cc.isGNU ''
     configureFlagsArray+=("CFLAGS=-fno-strict-aliasing -fno-aggressive-loop-optimizations")
   '';
 
   meta = {
     homepage = "http://judy.sourceforge.net/";
-    license = stdenv.lib.licenses.lgpl21Plus;
+    license = lib.licenses.lgpl21Plus;
     description = "State-of-the-art C library that implements a sparse dynamic array";
-    platforms = stdenv.lib.platforms.unix;
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/jxrlib/default.nix b/pkgs/development/libraries/jxrlib/default.nix
index f0f5b9d77934a..78cc48d820970 100644
--- a/pkgs/development/libraries/jxrlib/default.nix
+++ b/pkgs/development/libraries/jxrlib/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, python }:
+{ lib, stdenv, fetchFromGitHub, python }:
 
 stdenv.mkDerivation rec {
   pname = "jxrlib";
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
     sha256 = "0rk3hbh00nw0wgbfbqk1szrlfg3yq7w6ar16napww3nrlm9cj65w";
   };
 
-  postPatch = stdenv.lib.optionalString stdenv.isDarwin ''
+  postPatch = lib.optionalString stdenv.isDarwin ''
     substituteInPlace Makefile \
       --replace '-shared' '-dynamiclib -undefined dynamic_lookup' \
       --replace '.so' '.dylib'
@@ -23,7 +23,7 @@ stdenv.mkDerivation rec {
 
   makeFlags = [ "DIR_INSTALL=$(out)" "SHARED=1" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Implementation of the JPEG XR image codec standard";
     homepage = "https://jxrlib.codeplex.com";
     license = licenses.bsd2;
diff --git a/pkgs/development/libraries/kerberos/heimdal.nix b/pkgs/development/libraries/kerberos/heimdal.nix
index e56dfd4583443..804749bbdb53e 100644
--- a/pkgs/development/libraries/kerberos/heimdal.nix
+++ b/pkgs/development/libraries/kerberos/heimdal.nix
@@ -1,10 +1,10 @@
-{ stdenv, fetchFromGitHub, autoreconfHook, pkg-config, python2, perl, yacc, flex
+{ lib, stdenv, fetchFromGitHub, autoreconfHook, pkg-config, python2, perl, yacc, flex
 , texinfo, perlPackages
 , openldap, libcap_ng, sqlite, openssl, db, libedit, pam
 , CoreFoundation, Security, SystemConfiguration
 }:
 
-with stdenv.lib;
+with lib;
 stdenv.mkDerivation rec {
   pname = "heimdal";
   version = "7.7.0";
diff --git a/pkgs/development/libraries/kerberos/krb5.nix b/pkgs/development/libraries/kerberos/krb5.nix
index 022b6db1a2450..5ef9e496b94de 100644
--- a/pkgs/development/libraries/kerberos/krb5.nix
+++ b/pkgs/development/libraries/kerberos/krb5.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, perl, yacc, bootstrap_cmds
+{ lib, stdenv, fetchurl, pkg-config, perl, yacc, bootstrap_cmds
 , openssl, openldap, libedit, keyutils
 
 # Extra Arguments
@@ -16,7 +16,7 @@
 let
   libOnly = type == "lib";
 in
-with stdenv.lib;
+with lib;
 stdenv.mkDerivation rec {
   name = "${type}krb5-${version}";
   majorVersion = "1.18"; # remove patches below with next upgrade
diff --git a/pkgs/development/libraries/keybinder/default.nix b/pkgs/development/libraries/keybinder/default.nix
index 6b42cff790328..663abb1528046 100644
--- a/pkgs/development/libraries/keybinder/default.nix
+++ b/pkgs/development/libraries/keybinder/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, autoconf, automake, libtool, pkg-config, gnome3
+{ lib, stdenv, fetchurl, autoconf, automake, libtool, pkg-config, gnome3
 , gtk-doc, gtk2, python2Packages, lua, gobject-introspection
 }:
 
@@ -24,7 +24,7 @@ in stdenv.mkDerivation rec {
     ./autogen.sh --prefix="$out"
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Library for registering global key bindings";
     longDescription = ''
       keybinder is a library for registering global keyboard shortcuts.
diff --git a/pkgs/development/libraries/keybinder3/default.nix b/pkgs/development/libraries/keybinder3/default.nix
index dde4e80f070b5..e291ec56bb210 100644
--- a/pkgs/development/libraries/keybinder3/default.nix
+++ b/pkgs/development/libraries/keybinder3/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, autoconf, automake, libtool, pkg-config, gnome3
+{ lib, stdenv, fetchFromGitHub, autoconf, automake, libtool, pkg-config, gnome3
 , gtk-doc, gtk3, libX11, libXext, libXrender, gobject-introspection
 }:
 
@@ -23,7 +23,7 @@ stdenv.mkDerivation rec {
     ./autogen.sh --prefix="$out"
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Library for registering global key bindings";
     homepage = "https://github.com/kupferlauncher/keybinder/";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/keystone/default.nix b/pkgs/development/libraries/keystone/default.nix
index 869d7ae1b02d0..70864bcf24a9e 100644
--- a/pkgs/development/libraries/keystone/default.nix
+++ b/pkgs/development/libraries/keystone/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , pkg-config
 , cmake
@@ -27,7 +27,7 @@ stdenv.mkDerivation rec {
     python3
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Lightweight multi-platform, multi-architecture assembler framework";
     homepage = "https://www.keystone-engine.org";
     license = licenses.gpl2Only;
diff --git a/pkgs/development/libraries/khronos-ocl-icd-loader/default.nix b/pkgs/development/libraries/khronos-ocl-icd-loader/default.nix
index a42f1c0a513c4..f4688f34982ce 100644
--- a/pkgs/development/libraries/khronos-ocl-icd-loader/default.nix
+++ b/pkgs/development/libraries/khronos-ocl-icd-loader/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, opencl-headers, cmake, withTracing ? false }:
+{ lib, stdenv, fetchFromGitHub, opencl-headers, cmake, withTracing ? false }:
 
 stdenv.mkDerivation rec {
   name = "khronos-ocl-icd-loader-${version}";
@@ -11,12 +11,12 @@ stdenv.mkDerivation rec {
     sha256 = "0v2yi6d3g5qshzy6pjic09c5irwgds106yvr93q62f32psfblnmy";
   };
 
-  patches = stdenv.lib.lists.optional withTracing ./tracing.patch;
+  patches = lib.lists.optional withTracing ./tracing.patch;
 
   nativeBuildInputs = [ cmake ];
   buildInputs = [ opencl-headers ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Offical Khronos OpenCL ICD Loader";
     homepage = "https://github.com/KhronosGroup/OpenCL-ICD-Loader";
     license = licenses.asl20;
diff --git a/pkgs/development/libraries/kissfft/default.nix b/pkgs/development/libraries/kissfft/default.nix
index 370f628ff7a82..5395ac4ab9c15 100644
--- a/pkgs/development/libraries/kissfft/default.nix
+++ b/pkgs/development/libraries/kissfft/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , fetchpatch
 }:
@@ -35,7 +35,7 @@ stdenv.mkDerivation rec {
     "DATATYPE=double"
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A mixed-radix Fast Fourier Transform based up on the KISS principle";
     homepage = "https://github.com/mborgerding/kissfft";
     license = licenses.bsd3;
diff --git a/pkgs/development/libraries/kmsxx/default.nix b/pkgs/development/libraries/kmsxx/default.nix
index 02d216ca59ca3..65dce915f144d 100644
--- a/pkgs/development/libraries/kmsxx/default.nix
+++ b/pkgs/development/libraries/kmsxx/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, pkg-config, libdrm
+{ lib, stdenv, fetchFromGitHub, cmake, pkg-config, libdrm
 , withPython ? false, python }:
 
 stdenv.mkDerivation {
@@ -13,12 +13,12 @@ stdenv.mkDerivation {
     sha256 = "0xz4m9bk0naawxwpx5cy1j3cm6c8c9m5y551csk88y88x1g0z0xh";
   };
 
-  cmakeFlags = stdenv.lib.optional (!withPython) "-DKMSXX_ENABLE_PYTHON=OFF";
+  cmakeFlags = lib.optional (!withPython) "-DKMSXX_ENABLE_PYTHON=OFF";
 
   nativeBuildInputs = [ cmake pkg-config ];
   buildInputs = [ libdrm python ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "C++11 library, utilities and python bindings for Linux kernel mode setting";
     homepage = "https://github.com/tomba/kmsxx";
     license = licenses.mpl20;
diff --git a/pkgs/development/libraries/kpmcore/default.nix b/pkgs/development/libraries/kpmcore/default.nix
index d2677f69f9fc2..837333407b29b 100644
--- a/pkgs/development/libraries/kpmcore/default.nix
+++ b/pkgs/development/libraries/kpmcore/default.nix
@@ -24,7 +24,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ extra-cmake-modules ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     maintainers = with lib.maintainers; [ peterhoeg ];
     # The build requires at least Qt 5.14:
     broken = lib.versionOlder qtbase.version "5.14";
diff --git a/pkgs/development/libraries/kyotocabinet/default.nix b/pkgs/development/libraries/kyotocabinet/default.nix
index 9c360ce0531db..4e8aa57d95689 100644
--- a/pkgs/development/libraries/kyotocabinet/default.nix
+++ b/pkgs/development/libraries/kyotocabinet/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, zlib }:
+{ lib, stdenv, fetchurl, zlib }:
 
 stdenv.mkDerivation rec {
   name = "kyotocabinet-1.2.76";
@@ -8,7 +8,7 @@ stdenv.mkDerivation rec {
     sha256 = "0g6js20x7vnpq4p8ghbw3mh9wpqksya9vwhzdx6dnlf354zjsal1";
   };
 
-  prePatch = stdenv.lib.optionalString stdenv.isDarwin ''
+  prePatch = lib.optionalString stdenv.isDarwin ''
     substituteInPlace kccommon.h \
       --replace tr1/unordered_map unordered_map \
       --replace tr1/unordered_set unordered_set \
@@ -32,7 +32,7 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ zlib ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://fallabs.com/kyotocabinet";
     description = "A library of routines for managing a database";
     license = licenses.gpl3;
diff --git a/pkgs/development/libraries/l-smash/default.nix b/pkgs/development/libraries/l-smash/default.nix
index 34dab6bb3ff4e..b1b5fd0120628 100644
--- a/pkgs/development/libraries/l-smash/default.nix
+++ b/pkgs/development/libraries/l-smash/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, which }:
+{ lib, stdenv, fetchFromGitHub, which }:
 
 stdenv.mkDerivation rec {
   pname = "l-smash";
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ which ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://l-smash.github.io/l-smash/";
     description = "MP4 container utilities";
     license = licenses.isc;
diff --git a/pkgs/development/libraries/lame/default.nix b/pkgs/development/libraries/lame/default.nix
index da3784100ab6d..8ed0962bece85 100644
--- a/pkgs/development/libraries/lame/default.nix
+++ b/pkgs/development/libraries/lame/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl
+{ lib, stdenv, fetchurl
 , nasmSupport ? true, nasm ? null # Assembly optimizations
 , cpmlSupport ? true # Compaq's fast math library
 #, efenceSupport ? false, libefence ? null # Use ElectricFence for malloc debugging
@@ -20,7 +20,7 @@ let
   mkFlag = optSet: flag: if optSet then "--enable-${flag}" else "--disable-${flag}";
 in
 
-with stdenv.lib;
+with lib;
 stdenv.mkDerivation rec {
   pname = "lame";
   version = "3.100";
diff --git a/pkgs/development/libraries/languagemachines/frog.nix b/pkgs/development/libraries/languagemachines/frog.nix
index 913353a32fe68..a44535fbf90ec 100644
--- a/pkgs/development/libraries/languagemachines/frog.nix
+++ b/pkgs/development/libraries/languagemachines/frog.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl
+{ lib, stdenv, fetchurl
 , automake, autoconf, bzip2, libtar, libtool, pkg-config, autoconf-archive
 , libxml2, icu
 , languageMachines
@@ -37,7 +37,7 @@ stdenv.mkDerivation {
     make check
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A Tagger-Lemmatizer-Morphological-Analyzer-Dependency-Parser for Dutch";
     homepage    = "https://languagemachines.github.io/frog";
     license     = licenses.gpl3;
diff --git a/pkgs/development/libraries/languagemachines/frogdata.nix b/pkgs/development/libraries/languagemachines/frogdata.nix
index 3560ae8e460b8..7e890a8d09c9a 100644
--- a/pkgs/development/libraries/languagemachines/frogdata.nix
+++ b/pkgs/development/libraries/languagemachines/frogdata.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl
+{ lib, stdenv, fetchurl
 , automake, autoconf, libtool, pkg-config, autoconf-archive
 }:
 
@@ -19,7 +19,7 @@ stdenv.mkDerivation {
     sh bootstrap.sh
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Data for Frog, a Tagger-Lemmatizer-Morphological-Analyzer-Dependency-Parser for Dutch";
     homepage    = "https://languagemachines.github.io/frog";
     license     = licenses.gpl3;
diff --git a/pkgs/development/libraries/languagemachines/libfolia.nix b/pkgs/development/libraries/languagemachines/libfolia.nix
index 297967351d9ba..fc5e622bcf4fb 100644
--- a/pkgs/development/libraries/languagemachines/libfolia.nix
+++ b/pkgs/development/libraries/languagemachines/libfolia.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl
+{ lib, stdenv, fetchurl
 , automake, autoconf, libtool, pkg-config, autoconf-archive
 , libxml2, icu, bzip2, libtar
 , languageMachines }:
@@ -19,7 +19,7 @@ stdenv.mkDerivation {
   # compat with icu61+ https://github.com/unicode-org/icu/blob/release-64-2/icu4c/readme.html#L554
   CXXFLAGS = [ "-DU_USING_ICU_NAMESPACE=1" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A C++ API for FoLiA documents; an XML-based linguistic annotation format.";
     homepage    = "https://proycon.github.io/folia/";
     license     = licenses.gpl3;
diff --git a/pkgs/development/libraries/languagemachines/mbt.nix b/pkgs/development/libraries/languagemachines/mbt.nix
index 7fee1ea3a3faf..efa9ada7d56c9 100644
--- a/pkgs/development/libraries/languagemachines/mbt.nix
+++ b/pkgs/development/libraries/languagemachines/mbt.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl
+{ lib, stdenv, fetchurl
 , automake, autoconf, bzip2, libtar, libtool, pkg-config, autoconf-archive
 , libxml2
 , languageMachines
@@ -24,7 +24,7 @@ stdenv.mkDerivation {
     sh bootstrap.sh
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Memory Based Tagger";
     homepage    = "https://languagemachines.github.io/mbt/";
     license     = licenses.gpl3;
diff --git a/pkgs/development/libraries/languagemachines/ticcutils.nix b/pkgs/development/libraries/languagemachines/ticcutils.nix
index c3999d1c558f8..c09f00b1160b6 100644
--- a/pkgs/development/libraries/languagemachines/ticcutils.nix
+++ b/pkgs/development/libraries/languagemachines/ticcutils.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl
+{ lib, stdenv, fetchurl
 , automake, autoconf, libtool, pkg-config, autoconf-archive
 , libxml2, zlib, bzip2, libtar }:
 
@@ -19,7 +19,7 @@ stdenv.mkDerivation {
                 ];
   preConfigure = "sh bootstrap.sh";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "This module contains useful functions for general use in the TiCC software stack and beyond.";
     homepage    = "https://github.com/LanguageMachines/ticcutils";
     license     = licenses.gpl3;
diff --git a/pkgs/development/libraries/languagemachines/timbl.nix b/pkgs/development/libraries/languagemachines/timbl.nix
index 2e758257cbb15..de22c41ec4970 100644
--- a/pkgs/development/libraries/languagemachines/timbl.nix
+++ b/pkgs/development/libraries/languagemachines/timbl.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl
+{ lib, stdenv, fetchurl
 , automake, autoconf, libtool, pkg-config, autoconf-archive
 , libxml2, bzip2, libtar
 , languageMachines
@@ -20,7 +20,7 @@ stdenv.mkDerivation {
                 ];
   preConfigure = "sh bootstrap.sh";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "TiMBL implements several memory-based learning algorithms";
     homepage    = "https://github.com/LanguageMachines/timbl/";
     license     = licenses.gpl3;
diff --git a/pkgs/development/libraries/languagemachines/timblserver.nix b/pkgs/development/libraries/languagemachines/timblserver.nix
index 56245f922d3a1..27812e8b3f051 100644
--- a/pkgs/development/libraries/languagemachines/timblserver.nix
+++ b/pkgs/development/libraries/languagemachines/timblserver.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl
+{ lib, stdenv, fetchurl
 , automake, autoconf, bzip2, libtar, libtool, pkg-config, autoconf-archive
 , libxml2
 , languageMachines
@@ -21,7 +21,7 @@ stdenv.mkDerivation {
                 ];
   preConfigure = "sh bootstrap.sh";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "This server for TiMBL implements several memory-based learning algorithms";
     homepage    = "https://github.com/LanguageMachines/timblserver/";
     license     = licenses.gpl3;
diff --git a/pkgs/development/libraries/languagemachines/ucto.nix b/pkgs/development/libraries/languagemachines/ucto.nix
index e089942cd74df..d8c8d99552c84 100644
--- a/pkgs/development/libraries/languagemachines/ucto.nix
+++ b/pkgs/development/libraries/languagemachines/ucto.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl
+{ lib, stdenv, fetchurl
 , automake, autoconf, libtool, pkg-config, autoconf-archive
 , libxml2, icu, bzip2, libtar
 , languageMachines
@@ -32,7 +32,7 @@ stdenv.mkDerivation {
     done;
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A rule-based tokenizer for natural language";
     homepage    = "https://languagemachines.github.io/ucto/";
     license     = licenses.gpl3;
diff --git a/pkgs/development/libraries/languagemachines/uctodata.nix b/pkgs/development/libraries/languagemachines/uctodata.nix
index 9d36a95b4981f..cad6362272499 100644
--- a/pkgs/development/libraries/languagemachines/uctodata.nix
+++ b/pkgs/development/libraries/languagemachines/uctodata.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl
+{ lib, stdenv, fetchurl
 , automake, autoconf, libtool, pkg-config, autoconf-archive
  }:
 
@@ -15,7 +15,7 @@ stdenv.mkDerivation {
   buildInputs = [ automake autoconf libtool autoconf-archive ];
   preConfigure = "sh bootstrap.sh";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A rule-based tokenizer for natural language";
     homepage    = "https://languagemachines.github.io/ucto/";
     license     = licenses.gpl3;
diff --git a/pkgs/development/libraries/lasem/default.nix b/pkgs/development/libraries/lasem/default.nix
index 25d858cb64a68..22f0436edca96 100644
--- a/pkgs/development/libraries/lasem/default.nix
+++ b/pkgs/development/libraries/lasem/default.nix
@@ -1,4 +1,4 @@
-{ fetchurl, stdenv, pkg-config, intltool, gobject-introspection, glib, gdk-pixbuf
+{ fetchurl, lib, stdenv, pkg-config, intltool, gobject-introspection, glib, gdk-pixbuf
 , libxml2, cairo, pango, gnome3 }:
 
 stdenv.mkDerivation rec {
@@ -8,7 +8,7 @@ stdenv.mkDerivation rec {
   outputs = [ "bin" "out" "dev" "man" "doc" "devdoc" ];
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "0fds3fsx84ylsfvf55zp65y8xqjj5n8gbhcsk02vqglivk7izw4v";
   };
 
@@ -31,8 +31,8 @@ stdenv.mkDerivation rec {
     description = "SVG and MathML rendering library";
 
     homepage = "https://wiki.gnome.org/Projects/Lasem";
-    license = stdenv.lib.licenses.gpl2Plus;
+    license = lib.licenses.gpl2Plus;
 
-    platforms = stdenv.lib.platforms.unix;
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/lasso/default.nix b/pkgs/development/libraries/lasso/default.nix
index f2224a872ddb4..24efa689c5811 100644
--- a/pkgs/development/libraries/lasso/default.nix
+++ b/pkgs/development/libraries/lasso/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, autoconf, automake, autoreconfHook, fetchurl, glib, gobject-introspection, gtk-doc, libtool, libxml2, libxslt, openssl, pkg-config, python27Packages, xmlsec, zlib }:
+{ lib, stdenv, autoconf, automake, autoreconfHook, fetchurl, glib, gobject-introspection, gtk-doc, libtool, libxml2, libxslt, openssl, pkg-config, python27Packages, xmlsec, zlib }:
 
 stdenv.mkDerivation rec {
 
@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
                 --prefix=$out
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://lasso.entrouvert.org/";
     description = "Liberty Alliance Single Sign-On library";
     license = licenses.gpl2Plus;
diff --git a/pkgs/development/libraries/lcms/default.nix b/pkgs/development/libraries/lcms/default.nix
index 8fe2484facaf4..9a957a119243d 100644
--- a/pkgs/development/libraries/lcms/default.nix
+++ b/pkgs/development/libraries/lcms/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl}:
+{lib, stdenv, fetchurl}:
 
 stdenv.mkDerivation rec {
   pname = "lcms";
@@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
   meta = {
     description = "Color management engine";
     homepage = "http://www.littlecms.com/";
-    license = stdenv.lib.licenses.mit;
-    platforms = stdenv.lib.platforms.unix;
+    license = lib.licenses.mit;
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/lcms2/default.nix b/pkgs/development/libraries/lcms2/default.nix
index 6e81dfc0718a1..129b578519896 100644
--- a/pkgs/development/libraries/lcms2/default.nix
+++ b/pkgs/development/libraries/lcms2/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, libtiff, libjpeg, zlib }:
+{ lib, stdenv, fetchurl, libtiff, libjpeg, zlib }:
 
 stdenv.mkDerivation rec {
   name = "lcms2-2.11";
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
   # See https://trac.macports.org/ticket/60656
   LDFLAGS = if stdenv.hostPlatform.isDarwin then "-Wl,-w" else null;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Color management engine";
     homepage = "http://www.littlecms.com/";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/ldacbt/default.nix b/pkgs/development/libraries/ldacbt/default.nix
index 36a0c8e1316b0..36092507b8ae6 100644
--- a/pkgs/development/libraries/ldacbt/default.nix
+++ b/pkgs/development/libraries/ldacbt/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , cmake
 }:
@@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
     cmake
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "AOSP libldac dispatcher";
     homepage    = "https://github.com/EHfive/ldacBT";
     license     = licenses.asl20;
diff --git a/pkgs/development/libraries/ldb/default.nix b/pkgs/development/libraries/ldb/default.nix
index 9810234eefa60..ba035eed05bce 100644
--- a/pkgs/development/libraries/ldb/default.nix
+++ b/pkgs/development/libraries/ldb/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , python3
 , pkg-config
@@ -54,7 +54,7 @@ stdenv.mkDerivation rec {
 
   stripDebugList = [ "bin" "lib" "modules" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A LDAP-like embedded database";
     homepage = "https://ldb.samba.org/";
     license = licenses.lgpl3Plus;
diff --git a/pkgs/development/libraries/ldns/default.nix b/pkgs/development/libraries/ldns/default.nix
index f64d263901bd4..5873e707e7cca 100644
--- a/pkgs/development/libraries/ldns/default.nix
+++ b/pkgs/development/libraries/ldns/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, openssl, perl, which, dns-root-data }:
+{ lib, stdenv, fetchurl, openssl, perl, which, dns-root-data }:
 
 stdenv.mkDerivation rec {
   pname = "ldns";
@@ -24,7 +24,7 @@ stdenv.mkDerivation rec {
     "--with-drill"
     "--disable-gost"
     "--with-examples"
-  ] ++ stdenv.lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
+  ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
     "ac_cv_func_malloc_0_nonnull=yes"
     "ac_cv_func_realloc_0_nonnull=yes"
   ];
@@ -40,7 +40,7 @@ stdenv.mkDerivation rec {
     moveToOutput "bin/ldns-config" "$dev"
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Library with the aim of simplifying DNS programming in C";
     license = licenses.bsd3;
     homepage = "http://www.nlnetlabs.nl/projects/ldns/";
diff --git a/pkgs/development/libraries/leatherman/default.nix b/pkgs/development/libraries/leatherman/default.nix
index 7f1c292c5f13e..8a9c80a61754b 100644
--- a/pkgs/development/libraries/leatherman/default.nix
+++ b/pkgs/development/libraries/leatherman/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, boost, cmake, curl, ruby }:
+{ lib, stdenv, fetchFromGitHub, boost, cmake, curl, ruby }:
 
 stdenv.mkDerivation rec {
   pname = "leatherman";
@@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ cmake ];
   buildInputs = [ boost curl ruby ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/puppetlabs/leatherman/";
     description = "A collection of C++ and CMake utility libraries";
     license = licenses.asl20;
diff --git a/pkgs/development/libraries/lensfun/default.nix b/pkgs/development/libraries/lensfun/default.nix
index e9e8d3447b9c7..23675c9f9f895 100644
--- a/pkgs/development/libraries/lensfun/default.nix
+++ b/pkgs/development/libraries/lensfun/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, pkg-config, glib, zlib, libpng, cmake }:
+{ lib, stdenv, fetchFromGitHub, pkg-config, glib, zlib, libpng, cmake }:
 
 let
   version = "0.3.95";
@@ -35,10 +35,10 @@ stdenv.mkDerivation {
 
   cmakeFlags = [ "-DINSTALL_HELPER_SCRIPTS=OFF" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     platforms = platforms.linux ++ platforms.darwin;
     maintainers = with maintainers; [ flokli ];
-    license = stdenv.lib.licenses.lgpl3;
+    license = lib.licenses.lgpl3;
     description = "An opensource database of photographic lenses and their characteristics";
     homepage = "https://lensfun.github.io";
   };
diff --git a/pkgs/development/libraries/leptonica/default.nix b/pkgs/development/libraries/leptonica/default.nix
index de874cea3f183..11f1c7fd9c679 100644
--- a/pkgs/development/libraries/leptonica/default.nix
+++ b/pkgs/development/libraries/leptonica/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, autoreconfHook, pkg-config, which, gnuplot
+{ lib, stdenv, fetchurl, autoreconfHook, pkg-config, which, gnuplot
 , giflib, libjpeg, libpng, libtiff, libwebp, openjpeg, zlib
 }:
 
@@ -23,7 +23,7 @@ stdenv.mkDerivation rec {
   meta = {
     description = "Image processing and analysis library";
     homepage = "http://www.leptonica.org/";
-    license = stdenv.lib.licenses.bsd2; # http://www.leptonica.org/about-the-license.html
-    platforms = stdenv.lib.platforms.unix;
+    license = lib.licenses.bsd2; # http://www.leptonica.org/about-the-license.html
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/lesstif/default.nix b/pkgs/development/libraries/lesstif/default.nix
index 6e68a9128d0d9..d0ba47186559f 100644
--- a/pkgs/development/libraries/lesstif/default.nix
+++ b/pkgs/development/libraries/lesstif/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, xlibsWrapper, libXp, libXau}:
+{lib, stdenv, fetchurl, xlibsWrapper, libXp, libXau}:
 
 stdenv.mkDerivation rec {
   name = "lesstif-0.95.2";
@@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
     ./c-xpmpipethrough.patch
     ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "An open source clone of the Motif widget set";
     homepage = "http://lesstif.sourceforge.net";
     platforms = platforms.unix;
diff --git a/pkgs/development/libraries/leveldb/default.nix b/pkgs/development/libraries/leveldb/default.nix
index 14d426701ba31..0a1dabef328cf 100644
--- a/pkgs/development/libraries/leveldb/default.nix
+++ b/pkgs/development/libraries/leveldb/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, fixDarwinDylibNames, snappy }:
+{ lib, stdenv, fetchFromGitHub, fixDarwinDylibNames, snappy }:
 
 stdenv.mkDerivation rec {
   pname = "leveldb";
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
   buildInputs = [ snappy ];
 
   nativeBuildInputs = []
-    ++ stdenv.lib.optional stdenv.isDarwin fixDarwinDylibNames;
+    ++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
 
   buildPhase = ''
     make all
@@ -33,7 +33,7 @@ stdenv.mkDerivation rec {
     cp out-static/leveldbutil $out/bin
   ";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/google/leveldb";
     description = "Fast and lightweight key/value database library by Google";
     license = licenses.bsd3;
diff --git a/pkgs/development/libraries/levmar/default.nix b/pkgs/development/libraries/levmar/default.nix
index 7cf6329a77e66..c5d6877a84463 100644
--- a/pkgs/development/libraries/levmar/default.nix
+++ b/pkgs/development/libraries/levmar/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
   name = "levmar-2.6";
@@ -22,7 +22,7 @@ stdenv.mkDerivation rec {
   meta = {
     description = "ANSI C implementations of Levenberg-Marquardt, usable also from C++";
     homepage = "https://www.ics.forth.gr/~lourakis/levmar/";
-    license = stdenv.lib.licenses.gpl2Plus;
-    platforms = stdenv.lib.platforms.linux;
+    license = lib.licenses.gpl2Plus;
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/development/libraries/lib3ds/default.nix b/pkgs/development/libraries/lib3ds/default.nix
index 39e3e2e660fbf..db0bd26f4d291 100644
--- a/pkgs/development/libraries/lib3ds/default.nix
+++ b/pkgs/development/libraries/lib3ds/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, unzip }:
+{ lib, stdenv, fetchurl, unzip }:
 
 stdenv.mkDerivation rec {
   name = "lib3ds-1.3.0";
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
     description = "Library for managing 3D-Studio Release 3 and 4 \".3DS\" files";
     homepage = "http://lib3ds.sourceforge.net/";
     license = "LGPL";
-    platforms = stdenv.lib.platforms.unix;
+    platforms = lib.platforms.unix;
   };
 }
 
diff --git a/pkgs/development/libraries/lib3mf/default.nix b/pkgs/development/libraries/lib3mf/default.nix
index 10732a14e488c..fec910bd5952f 100644
--- a/pkgs/development/libraries/lib3mf/default.nix
+++ b/pkgs/development/libraries/lib3mf/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, ninja, libuuid, libossp_uuid, gtest }:
+{ lib, stdenv, fetchFromGitHub, cmake, ninja, libuuid, libossp_uuid, gtest }:
 
 stdenv.mkDerivation rec {
   pname = "lib3mf";
@@ -23,7 +23,7 @@ stdenv.mkDerivation rec {
     sed -i 's,=''${\(exec_\)\?prefix}/,=,' lib3MF.pc.in
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Reference implementation of the 3D Manufacturing Format file standard";
     homepage = "https://3mf.io/";
     license = licenses.bsd2;
diff --git a/pkgs/development/libraries/libAfterImage/default.nix b/pkgs/development/libraries/libAfterImage/default.nix
index 8936603d18b0a..1c88459ba9b62 100644
--- a/pkgs/development/libraries/libAfterImage/default.nix
+++ b/pkgs/development/libraries/libAfterImage/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, zlib }:
+{ lib, stdenv, fetchurl, zlib }:
 
 stdenv.mkDerivation {
   pname = "libAfterImage";
@@ -15,7 +15,7 @@ stdenv.mkDerivation {
 
   buildInputs = [ zlib ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://www.afterstep.org/afterimage/";
     description = "A generic image manipulation library";
     platforms = platforms.unix;
diff --git a/pkgs/development/libraries/libHX/default.nix b/pkgs/development/libraries/libHX/default.nix
index 59afede9cae7d..c059b9d412aaa 100644
--- a/pkgs/development/libraries/libHX/default.nix
+++ b/pkgs/development/libraries/libHX/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, autoconf, automake, libtool }:
+{ lib, stdenv, fetchurl, autoconf, automake, libtool }:
 
 stdenv.mkDerivation rec {
   name = "libHX-3.22";
@@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
     sh autogen.sh
     '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://libhx.sourceforge.net/";
     longDescription = ''
       libHX is a C library (with some C++ bindings available) that provides data structures
diff --git a/pkgs/development/libraries/libLAS/default.nix b/pkgs/development/libraries/libLAS/default.nix
index 714708a6e0df7..7d762fc80775a 100644
--- a/pkgs/development/libraries/libLAS/default.nix
+++ b/pkgs/development/libraries/libLAS/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, boost, cmake, gdal, libgeotiff, libtiff, LASzip2, fixDarwinDylibNames }:
+{ lib, stdenv, fetchurl, boost, cmake, gdal, libgeotiff, libtiff, LASzip2, fixDarwinDylibNames }:
 
 stdenv.mkDerivation rec {
   name = "libLAS-1.8.1";
@@ -8,7 +8,7 @@ stdenv.mkDerivation rec {
     sha256 = "0xjfxb3ydvr2258ji3spzyf81g9caap19ql2pk91wiivqsc4mnws";
   };
 
-  nativeBuildInputs = [ cmake ] ++ stdenv.lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames;
+  nativeBuildInputs = [ cmake ] ++ lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames;
   buildInputs = [ boost gdal libgeotiff libtiff LASzip2 ];
 
   cmakeFlags = [
@@ -20,15 +20,15 @@ stdenv.mkDerivation rec {
     "-DCMAKE_EXE_LINKER_FLAGS=-pthread"
   ];
 
-  postFixup = stdenv.lib.optionalString stdenv.isDarwin ''
+  postFixup = lib.optionalString stdenv.isDarwin ''
     install_name_tool -change "@rpath/liblas.3.dylib" "$out/lib/liblas.3.dylib" $out/lib/liblas_c.dylib
   '';
 
   meta = {
     description = "LAS 1.0/1.1/1.2 ASPRS LiDAR data translation toolset";
     homepage = "https://liblas.org";
-    license = stdenv.lib.licenses.bsd3;
-    platforms = stdenv.lib.platforms.unix;
-    maintainers = [ stdenv.lib.maintainers.michelk ];
+    license = lib.licenses.bsd3;
+    platforms = lib.platforms.unix;
+    maintainers = [ lib.maintainers.michelk ];
   };
 }
diff --git a/pkgs/development/libraries/libaacs/default.nix b/pkgs/development/libraries/libaacs/default.nix
index d6c90ee172b63..c3934db5b3fb4 100644
--- a/pkgs/development/libraries/libaacs/default.nix
+++ b/pkgs/development/libraries/libaacs/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, libgcrypt, libgpgerror, yacc, flex }:
+{ lib, stdenv, fetchurl, libgcrypt, libgpgerror, yacc, flex }:
 
 # library that allows libbluray to play AACS protected bluray disks
 # libaacs does not infringe DRM's right or copyright. See the legal page of the website for more info.
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ yacc flex ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://www.videolan.org/developers/libaacs.html";
     description = "Library to access AACS protected Blu-Ray disks";
     license = licenses.lgpl21;
diff --git a/pkgs/development/libraries/libaal/default.nix b/pkgs/development/libraries/libaal/default.nix
index fdfd855470d9e..e3c960681c5f4 100644
--- a/pkgs/development/libraries/libaal/default.nix
+++ b/pkgs/development/libraries/libaal/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
   version = "1.0.6";
@@ -20,8 +20,8 @@ stdenv.mkDerivation rec {
   meta = {
     homepage = "http://www.namesys.com/";
     description = "Support library for Reiser4";
-    license = stdenv.lib.licenses.gpl2;
-    maintainers = with stdenv.lib.maintainers; [ ];
-    platforms = with stdenv.lib.platforms; linux;
+    license = lib.licenses.gpl2;
+    maintainers = with lib.maintainers; [ ];
+    platforms = with lib.platforms; linux;
   };
 }
diff --git a/pkgs/development/libraries/libabigail/default.nix b/pkgs/development/libraries/libabigail/default.nix
index c2d81e31f3eaf..7543c6ddff734 100644
--- a/pkgs/development/libraries/libabigail/default.nix
+++ b/pkgs/development/libraries/libabigail/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , autoreconfHook
 , elfutils
@@ -49,7 +49,7 @@ stdenv.mkDerivation rec {
     patchShebangs tests/
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "ABI Generic Analysis and Instrumentation Library";
     homepage = "https://sourceware.org/libabigail/";
     license = licenses.lgpl3Plus;
diff --git a/pkgs/development/libraries/libabw/default.nix b/pkgs/development/libraries/libabw/default.nix
index 4e33f30e8c14a..f1c4f49adc673 100644
--- a/pkgs/development/libraries/libabw/default.nix
+++ b/pkgs/development/libraries/libabw/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, boost, doxygen, gperf, pkg-config, librevenge, libxml2, perl }:
+{ lib, stdenv, fetchurl, boost, doxygen, gperf, pkg-config, librevenge, libxml2, perl }:
 
 stdenv.mkDerivation rec {
   pname = "libabw";
@@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ pkg-config ];
   buildInputs = [ boost doxygen gperf librevenge libxml2 perl ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://wiki.documentfoundation.org/DLP/Libraries/libabw";
     description = "Library parsing abiword documents";
     platforms = platforms.unix;
diff --git a/pkgs/development/libraries/libaccounts-glib/default.nix b/pkgs/development/libraries/libaccounts-glib/default.nix
index 3467b6c84c8ad..8dfc222f36ac8 100644
--- a/pkgs/development/libraries/libaccounts-glib/default.nix
+++ b/pkgs/development/libraries/libaccounts-glib/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitLab, meson, ninja, glib, check, python3, vala, gtk-doc, glibcLocales
+{ lib, stdenv, fetchFromGitLab, meson, ninja, glib, check, python3, vala, gtk-doc, glibcLocales
 , libxml2, libxslt, pkg-config, sqlite, docbook_xsl, docbook_xml_dtd_43, gobject-introspection }:
 
 stdenv.mkDerivation rec {
@@ -44,7 +44,7 @@ stdenv.mkDerivation rec {
     "-Dpy-overrides-dir=${placeholder "py"}/${python3.sitePackages}/gi/overrides"
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Library for managing accounts which can be used from GLib applications";
     platforms = platforms.linux;
     license = licenses.lgpl21;
diff --git a/pkgs/development/libraries/libaec/default.nix b/pkgs/development/libraries/libaec/default.nix
index bf6fd029de166..4c539860be72b 100644
--- a/pkgs/development/libraries/libaec/default.nix
+++ b/pkgs/development/libraries/libaec/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitLab
+{ lib, stdenv, fetchFromGitLab
 , cmake
 }:
 
@@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
     cmake
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://gitlab.dkrz.de/k202009/libaec";
     description = "Adaptive Entropy Coding library";
     license = licenses.bsd2;
diff --git a/pkgs/development/libraries/libagar/default.nix b/pkgs/development/libraries/libagar/default.nix
index 708aaff9bda30..7aeccdf583e0c 100644
--- a/pkgs/development/libraries/libagar/default.nix
+++ b/pkgs/development/libraries/libagar/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, libtool, perl, bsdbuild, gettext, mandoc
+{ lib, stdenv, fetchurl, pkg-config, libtool, perl, bsdbuild, gettext, mandoc
 , libpng, libjpeg, xlibsWrapper, libXinerama, freetype, SDL, libGLU, libGL
 , libsndfile, portaudio, libmysqlclient, fontconfig
 }:
@@ -33,7 +33,7 @@ stdenv.mkDerivation {
     freetype.dev libpng libjpeg.dev fontconfig portaudio libsndfile
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Cross-platform GUI toolkit";
     homepage = "http://libagar.org/index.html";
     license = with licenses; bsd3;
diff --git a/pkgs/development/libraries/libagar/libagar_test.nix b/pkgs/development/libraries/libagar/libagar_test.nix
index 4de113718d4aa..2b31da7aa535a 100644
--- a/pkgs/development/libraries/libagar/libagar_test.nix
+++ b/pkgs/development/libraries/libagar/libagar_test.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, bsdbuild, libagar, perl, libjpeg, libpng, openssl }:
+{ lib, stdenv, fetchurl, bsdbuild, libagar, perl, libjpeg, libpng, openssl }:
 
 let srcs = import ./srcs.nix { inherit fetchurl; }; in
 stdenv.mkDerivation {
@@ -17,7 +17,7 @@ stdenv.mkDerivation {
 
   buildInputs = [ perl bsdbuild libagar libjpeg libpng openssl ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Tests for libagar";
     homepage = "http://libagar.org/index.html";
     license = with licenses; bsd3;
diff --git a/pkgs/development/libraries/libamqpcpp/default.nix b/pkgs/development/libraries/libamqpcpp/default.nix
index eca7170bfff2e..2985d4ad212a6 100644
--- a/pkgs/development/libraries/libamqpcpp/default.nix
+++ b/pkgs/development/libraries/libamqpcpp/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, openssl }:
+{ lib, stdenv, fetchFromGitHub, openssl }:
 
 stdenv.mkDerivation rec {
   pname = "libamqpcpp";
@@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Library for communicating with a RabbitMQ server";
     homepage = "https://github.com/CopernicaMarketingSoftware/AMQP-CPP";
     license = licenses.asl20;
diff --git a/pkgs/development/libraries/libantlr3c/default.nix b/pkgs/development/libraries/libantlr3c/default.nix
index 4c3d1d2a21329..d51eac7bdb6e2 100644
--- a/pkgs/development/libraries/libantlr3c/default.nix
+++ b/pkgs/development/libraries/libantlr3c/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl}:
+{lib, stdenv, fetchurl}:
 
 stdenv.mkDerivation {
   name = "libantlr3c-3.4";
@@ -7,9 +7,9 @@ stdenv.mkDerivation {
     sha256 ="0lpbnb4dq4azmsvlhp6khq1gy42kyqyjv8gww74g5lm2y6blm4fa";
   };
 
-  configureFlags = stdenv.lib.optional stdenv.is64bit "--enable-64bit";
+  configureFlags = lib.optional stdenv.is64bit "--enable-64bit";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "C runtime libraries of ANTLR v3";
     homepage = "https://www.antlr3.org/";
     license = licenses.bsd3;
diff --git a/pkgs/development/libraries/libao/default.nix b/pkgs/development/libraries/libao/default.nix
index e702e292a0ff9..99d38f0cfc43b 100644
--- a/pkgs/development/libraries/libao/default.nix
+++ b/pkgs/development/libraries/libao/default.nix
@@ -28,7 +28,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ autoreconfHook pkg-config ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     longDescription = ''
       Libao is Xiph.org's cross-platform audio library that allows
       programs to output audio using a simple API on a wide variety of
diff --git a/pkgs/development/libraries/libaom/default.nix b/pkgs/development/libraries/libaom/default.nix
index 2ebabe3273f45..9706cda03f8ba 100644
--- a/pkgs/development/libraries/libaom/default.nix
+++ b/pkgs/development/libraries/libaom/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchgit, yasm, perl, cmake, pkg-config, python3 }:
+{ lib, stdenv, fetchgit, yasm, perl, cmake, pkg-config, python3 }:
 
 stdenv.mkDerivation rec {
   pname = "libaom";
@@ -40,7 +40,7 @@ stdenv.mkDerivation rec {
 
   outputs = [ "out" "bin" "dev" "static" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Alliance for Open Media AV1 codec library";
     longDescription = ''
       Libaom is the reference implementation of the AV1 codec from the Alliance
diff --git a/pkgs/development/libraries/libaosd/default.nix b/pkgs/development/libraries/libaosd/default.nix
index 38c501a8287df..a6b9d531abf69 100644
--- a/pkgs/development/libraries/libaosd/default.nix
+++ b/pkgs/development/libraries/libaosd/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, pkg-config, cairo, pango,
+{ lib, stdenv, fetchFromGitHub, pkg-config, cairo, pango,
   libX11, libXcomposite, autoconf, automake }:
 
 stdenv.mkDerivation rec {
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
     ./autogen.sh
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     longDescription = ''
       libaosd is an advanced on screen display library.
 
diff --git a/pkgs/development/libraries/libarchive/default.nix b/pkgs/development/libraries/libarchive/default.nix
index 6bc2ddb7d1366..a8fb7e3826593 100644
--- a/pkgs/development/libraries/libarchive/default.nix
+++ b/pkgs/development/libraries/libarchive/default.nix
@@ -1,5 +1,5 @@
 {
-  fetchFromGitHub, stdenv, pkg-config, autoreconfHook,
+  fetchFromGitHub, lib, stdenv, pkg-config, autoreconfHook,
   acl, attr, bzip2, e2fsprogs, libxml2, lzo, openssl, sharutils, xz, zlib, zstd,
 
   # Optional but increases closure only negligibly. Also, while libxml2
@@ -25,15 +25,15 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ pkg-config autoreconfHook ];
   buildInputs =
-    stdenv.lib.optional stdenv.hostPlatform.isUnix sharutils
+    lib.optional stdenv.hostPlatform.isUnix sharutils
     ++ [ zlib bzip2 openssl xz lzo zstd ]
-    ++ stdenv.lib.optionals stdenv.isLinux [ e2fsprogs attr acl ]
-    ++ stdenv.lib.optional xarSupport libxml2;
+    ++ lib.optionals stdenv.isLinux [ e2fsprogs attr acl ]
+    ++ lib.optional xarSupport libxml2;
 
   # Without this, pkg-config-based dependencies are unhappy
-  propagatedBuildInputs = stdenv.lib.optionals stdenv.isLinux [ attr acl ];
+  propagatedBuildInputs = lib.optionals stdenv.isLinux [ attr acl ];
 
-  configureFlags = stdenv.lib.optional (!xarSupport) "--without-xml2";
+  configureFlags = lib.optional (!xarSupport) "--without-xml2";
 
   preBuild = if stdenv.isCygwin then ''
     echo "#include <windows.h>" >> config.h
@@ -58,8 +58,8 @@ stdenv.mkDerivation rec {
     '';
     homepage = "http://libarchive.org";
     changelog = "https://github.com/libarchive/libarchive/releases/tag/v${version}";
-    license = stdenv.lib.licenses.bsd3;
-    platforms = with stdenv.lib.platforms; all;
-    maintainers = with stdenv.lib.maintainers; [ jcumming ];
+    license = lib.licenses.bsd3;
+    platforms = with lib.platforms; all;
+    maintainers = with lib.maintainers; [ jcumming ];
   };
 }
diff --git a/pkgs/development/libraries/libargon2/default.nix b/pkgs/development/libraries/libargon2/default.nix
index f559c10456bbb..2003c8957ffa4 100644
--- a/pkgs/development/libraries/libargon2/default.nix
+++ b/pkgs/development/libraries/libargon2/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, fetchpatch, fixDarwinDylibNames }:
+{ lib, stdenv, fetchFromGitHub, fetchpatch, fixDarwinDylibNames }:
 
 stdenv.mkDerivation rec {
   pname = "libargon2";
@@ -29,7 +29,7 @@ stdenv.mkDerivation rec {
     "PKGCONFIG_REL=lib"
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A key derivation function that was selected as the winner of the Password Hashing Competition in July 2015";
     longDescription = ''
       A password-hashing function created by by Alex Biryukov, Daniel Dinu, and
diff --git a/pkgs/development/libraries/libasr/default.nix b/pkgs/development/libraries/libasr/default.nix
index 561e7e1017dab..8d5b6d128ddf3 100644
--- a/pkgs/development/libraries/libasr/default.nix
+++ b/pkgs/development/libraries/libasr/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, libevent, openssl }:
+{ lib, stdenv, fetchurl, libevent, openssl }:
 
 stdenv.mkDerivation rec {
   pname = "libasr";
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ libevent openssl ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/OpenSMTPD/libasr";
     description = "Free, simple and portable asynchronous resolver library";
     license = licenses.isc;
diff --git a/pkgs/development/libraries/libass/default.nix b/pkgs/development/libraries/libass/default.nix
index 031d36b58a8b7..6a180cb62c192 100644
--- a/pkgs/development/libraries/libass/default.nix
+++ b/pkgs/development/libraries/libass/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, yasm
+{ lib, stdenv, fetchurl, pkg-config, yasm
 , freetype, fribidi, harfbuzz
 , encaSupport ? true, enca ? null # enca support
 , fontconfigSupport ? true, fontconfig ? null # fontconfig support
@@ -14,7 +14,7 @@ let
   mkFlag = optSet: flag: if optSet then "--enable-${flag}" else "--disable-${flag}";
 in
 
-with stdenv.lib;
+with lib;
 stdenv.mkDerivation rec {
   pname = "libass";
   version = "0.15.0";
diff --git a/pkgs/development/libraries/libassuan/default.nix b/pkgs/development/libraries/libassuan/default.nix
index aa798668f8ead..a531cdff5b969 100644
--- a/pkgs/development/libraries/libassuan/default.nix
+++ b/pkgs/development/libraries/libassuan/default.nix
@@ -1,4 +1,4 @@
-{ fetchurl, stdenv, gettext, npth, libgpgerror, buildPackages }:
+{ fetchurl, lib, stdenv, gettext, npth, libgpgerror, buildPackages }:
 
 stdenv.mkDerivation rec {
   pname = "libassuan";
@@ -26,7 +26,7 @@ stdenv.mkDerivation rec {
     sed -i 's,#include <gpg-error.h>,#include "${libgpgerror.dev}/include/gpg-error.h",g' $dev/include/assuan.h
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "IPC library used by GnuPG and related software";
     longDescription = ''
       Libassuan is a small library implementing the so-called Assuan
diff --git a/pkgs/development/libraries/libast/default.nix b/pkgs/development/libraries/libast/default.nix
index 8dae2f92b4da1..b48971bc43136 100644
--- a/pkgs/development/libraries/libast/default.nix
+++ b/pkgs/development/libraries/libast/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl
+{ lib, stdenv, fetchurl
 , pkg-config }:
 
 stdenv.mkDerivation rec {
@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ pkg-config ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Library of Assorted Spiffy Things";
     homepage = "https://www.eterm.org";
     license = licenses.bsd2;
diff --git a/pkgs/development/libraries/libasyncns/default.nix b/pkgs/development/libraries/libasyncns/default.nix
index 9a91551c3a43a..0dc26b6861170 100644
--- a/pkgs/development/libraries/libasyncns/default.nix
+++ b/pkgs/development/libraries/libasyncns/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
   name = "libasyncns-0.8";
@@ -8,12 +8,12 @@ stdenv.mkDerivation rec {
     sha256 = "0x5b6lcic4cd7q0bx00x93kvpyzl7n2abbgvqbrlzrfb8vknc6jg";
   };
 
-  configureFlags = stdenv.lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
+  configureFlags = lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
     "ac_cv_func_malloc_0_nonnull=yes"
     "ac_cv_func_realloc_0_nonnull=yes"
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://0pointer.de/lennart/projects/libasyncns/";
     description = "A C library for Linux/Unix for executing name service queries asynchronously";
     license = licenses.lgpl21;
diff --git a/pkgs/development/libraries/libatomic_ops/default.nix b/pkgs/development/libraries/libatomic_ops/default.nix
index b576896876e49..995d3809e4e25 100644
--- a/pkgs/development/libraries/libatomic_ops/default.nix
+++ b/pkgs/development/libraries/libatomic_ops/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, autoconf, automake, libtool }:
+{ lib, stdenv, fetchurl, autoconf, automake, libtool }:
 
 stdenv.mkDerivation rec {
   pname = "libatomic_ops";
@@ -14,17 +14,17 @@ stdenv.mkDerivation rec {
 
   outputs = [ "out" "dev" "doc" ];
 
-  nativeBuildInputs = stdenv.lib.optionals stdenv.isCygwin [ autoconf automake libtool ];
+  nativeBuildInputs = lib.optionals stdenv.isCygwin [ autoconf automake libtool ];
 
-  preConfigure = stdenv.lib.optionalString stdenv.isCygwin ''
+  preConfigure = lib.optionalString stdenv.isCygwin ''
     sed -i -e "/libatomic_ops_gpl_la_SOURCES/a libatomic_ops_gpl_la_LIBADD = libatomic_ops.la" src/Makefile.am
     ./autogen.sh
   '';
 
   meta = {
     description = ''A library for semi-portable access to hardware-provided atomic memory update operations'';
-    license = stdenv.lib.licenses.gpl2Plus ;
-    maintainers = [stdenv.lib.maintainers.raskin];
-    platforms = with stdenv.lib.platforms; unix ++ windows;
+    license = lib.licenses.gpl2Plus ;
+    maintainers = [lib.maintainers.raskin];
+    platforms = with lib.platforms; unix ++ windows;
   };
 }
diff --git a/pkgs/development/libraries/libaudclient/default.nix b/pkgs/development/libraries/libaudclient/default.nix
index a1ee01100b4d9..f90815f4ee9f1 100644
--- a/pkgs/development/libraries/libaudclient/default.nix
+++ b/pkgs/development/libraries/libaudclient/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, glib, dbus-glib }:
+{ lib, stdenv, fetchurl, pkg-config, glib, dbus-glib }:
 
 stdenv.mkDerivation rec {
   name = "libaudclient-3.5-rc2";
@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ pkg-config ];
   buildInputs = [ glib dbus-glib ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Legacy D-Bus client library for Audacious";
     homepage = "https://audacious-media-player.org/";
     license = licenses.bsd2;
diff --git a/pkgs/development/libraries/libav/default.nix b/pkgs/development/libraries/libav/default.nix
index a712678b7939f..51aa634e40842 100644
--- a/pkgs/development/libraries/libav/default.nix
+++ b/pkgs/development/libraries/libav/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, yasm, bzip2, zlib, perl, bash
+{ lib, stdenv, fetchurl, pkg-config, yasm, bzip2, zlib, perl, bash
 , mp3Support    ? true,   lame      ? null
 , speexSupport  ? true,   speex     ? null
 , theoraSupport ? true,   libtheora ? null
@@ -17,7 +17,7 @@
 
 assert faacSupport -> enableUnfree;
 
-let inherit (stdenv.lib) optional hasPrefix enableFeature; in
+let inherit (lib) optional hasPrefix enableFeature; in
 
 /* ToDo:
     - more deps, inspiration: https://packages.ubuntu.com/raring/libav-tools
@@ -52,7 +52,7 @@ let
     '';
 
     configurePlatforms = [];
-    configureFlags = assert stdenv.lib.all (x: x!=null) buildInputs; [
+    configureFlags = assert lib.all (x: x!=null) buildInputs; [
       "--arch=${stdenv.hostPlatform.parsed.cpu.name}"
       "--target_os=${stdenv.hostPlatform.parsed.kernel.name}"
       #"--enable-postproc" # it's now a separate package in upstream
@@ -120,7 +120,7 @@ let
 
     passthru = { inherit vdpauSupport; };
 
-    meta = with stdenv.lib; {
+    meta = with lib; {
       homepage = "https://libav.org/";
       description = "A complete, cross-platform solution to record, convert and stream audio and video (fork of ffmpeg)";
       license = with licenses; if enableUnfree then unfree #ToDo: redistributable or not?
diff --git a/pkgs/development/libraries/libavc1394/default.nix b/pkgs/development/libraries/libavc1394/default.nix
index 8f4a678cb379e..d9c10415b67a9 100644
--- a/pkgs/development/libraries/libavc1394/default.nix
+++ b/pkgs/development/libraries/libavc1394/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, libraw1394 }:
+{ lib, stdenv, fetchurl, pkg-config, libraw1394 }:
 
 stdenv.mkDerivation rec {
   name = "libavc1394-0.5.4";
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
   meta = {
     description = "Programming interface for the 1394 Trade Association AV/C (Audio/Video Control) Digital Interface Command Set";
     homepage = "https://sourceforge.net/projects/libavc1394/";
-    license = stdenv.lib.licenses.lgpl21Plus;
-    platforms = stdenv.lib.platforms.linux;
+    license = lib.licenses.lgpl21Plus;
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/development/libraries/libavif/default.nix b/pkgs/development/libraries/libavif/default.nix
index 25422c8b7d902..8c33e6f1b6dd5 100644
--- a/pkgs/development/libraries/libavif/default.nix
+++ b/pkgs/development/libraries/libavif/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , libaom
 , cmake
@@ -43,7 +43,7 @@ stdenv.mkDerivation rec {
     dav1d
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description  = "C implementation of the AV1 Image File Format";
     longDescription = ''
       Libavif aims to be a friendly, portable C implementation of the
diff --git a/pkgs/development/libraries/libayatana-appindicator/default.nix b/pkgs/development/libraries/libayatana-appindicator/default.nix
index 248c33f7e0e54..ef9823130f431 100644
--- a/pkgs/development/libraries/libayatana-appindicator/default.nix
+++ b/pkgs/development/libraries/libayatana-appindicator/default.nix
@@ -39,7 +39,7 @@ stdenv.mkDerivation rec {
 
   configureFlags = [ "--with-gtk=${gtkVersion}" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Ayatana Application Indicators Shared Library";
     homepage = "https://github.com/AyatanaIndicators/libayatana-appindicator";
     changelog = "https://github.com/AyatanaIndicators/libayatana-appindicator/blob/${version}/ChangeLog";
diff --git a/pkgs/development/libraries/libayatana-indicator/default.nix b/pkgs/development/libraries/libayatana-indicator/default.nix
index dd9bc616944d7..c3c271c17194b 100644
--- a/pkgs/development/libraries/libayatana-indicator/default.nix
+++ b/pkgs/development/libraries/libayatana-indicator/default.nix
@@ -25,7 +25,7 @@ stdenv.mkDerivation rec {
 
   configureFlags = [ "--with-gtk=${gtkVersion}" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Ayatana Indicators Shared Library";
     homepage = "https://github.com/AyatanaIndicators/libayatana-indicator";
     changelog = "https://github.com/AyatanaIndicators/libayatana-indicator/blob/${version}/ChangeLog";
diff --git a/pkgs/development/libraries/libb2/default.nix b/pkgs/development/libraries/libb2/default.nix
index dad5d40ea530c..b142a0a415650 100644
--- a/pkgs/development/libraries/libb2/default.nix
+++ b/pkgs/development/libraries/libb2/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, autoconf, automake, libtool, pkg-config }:
+{ lib, stdenv, fetchFromGitHub, autoconf, automake, libtool, pkg-config }:
 
 stdenv.mkDerivation rec {
   pname = "libb2";
@@ -16,13 +16,13 @@ stdenv.mkDerivation rec {
     ./autogen.sh
   '';
 
-  configureFlags = stdenv.lib.optional stdenv.hostPlatform.isx86 "--enable-fat=yes";
+  configureFlags = lib.optional stdenv.hostPlatform.isx86 "--enable-fat=yes";
 
   nativeBuildInputs = [ autoconf automake libtool pkg-config ];
 
   doCheck = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "The BLAKE2 family of cryptographic hash functions";
     homepage = "https://blake2.net/";
     platforms = platforms.all;
diff --git a/pkgs/development/libraries/libb64/default.nix b/pkgs/development/libraries/libb64/default.nix
index 3c9a97684275a..f524e9321f9de 100644
--- a/pkgs/development/libraries/libb64/default.nix
+++ b/pkgs/development/libraries/libb64/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, unzip }:
+{ lib, stdenv, fetchurl, unzip }:
 
 stdenv.mkDerivation rec {
   pname = "libb64";
@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
   meta = {
     inherit version;
     description = "ANSI C routines for fast base64 encoding/decoding";
-    license = stdenv.lib.licenses.publicDomain;
-    platforms = stdenv.lib.platforms.unix;
+    license = lib.licenses.publicDomain;
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/libbacktrace/default.nix b/pkgs/development/libraries/libbacktrace/default.nix
index ea7f4eb9fa8a8..93927807af856 100644
--- a/pkgs/development/libraries/libbacktrace/default.nix
+++ b/pkgs/development/libraries/libbacktrace/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, callPackage, fetchFromGitHub
+{ lib, stdenv, callPackage, fetchFromGitHub
 , enableStatic ? stdenv.hostPlatform.isStatic
 , enableShared ? !stdenv.hostPlatform.isStatic
 }:
@@ -17,7 +17,7 @@ in stdenv.mkDerivation rec {
     "--enable-static=${yesno enableStatic}"
     "--enable-shared=${yesno enableShared}"
   ];
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A C library that may be linked into a C/C++ program to produce symbolic backtraces";
     homepage = https://github.com/ianlancetaylor/libbacktrace;
     maintainers = with maintainers; [ twey ];
diff --git a/pkgs/development/libraries/libbap/default.nix b/pkgs/development/libraries/libbap/default.nix
index 411c3ae740f21..7c458bae19ce1 100644
--- a/pkgs/development/libraries/libbap/default.nix
+++ b/pkgs/development/libraries/libbap/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, bap, ocaml, findlib, ctypes, autoreconfHook,
+{ lib, stdenv, fetchFromGitHub, bap, ocaml, findlib, ctypes, autoreconfHook,
   which }:
 
 stdenv.mkDerivation {
@@ -20,7 +20,7 @@ stdenv.mkDerivation {
     mkdir -p $out/include
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/binaryanalysisplatform/bap-bindings";
     description = "A C library for interacting with BAP";
     maintainers = [ maintainers.maurer ];
diff --git a/pkgs/development/libraries/libbdplus/default.nix b/pkgs/development/libraries/libbdplus/default.nix
index c9b7bfa3c0e6e..ca7b305122e3c 100644
--- a/pkgs/development/libraries/libbdplus/default.nix
+++ b/pkgs/development/libraries/libbdplus/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, libgcrypt, libgpgerror, gettext }:
+{ lib, stdenv, fetchurl, libgcrypt, libgpgerror, gettext }:
 
 # library that allows libbluray to play BDplus protected bluray disks
 # libaacs does not infringe DRM's right or copyright. See the legal page of the website for more info.
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://www.videolan.org/developers/libbdplus.html";
     description = "Library to access BD+ protected Blu-Ray disks";
     license = licenses.lgpl21;
diff --git a/pkgs/development/libraries/libbfd/default.nix b/pkgs/development/libraries/libbfd/default.nix
index 75db780b7bb69..499f04349b5de 100644
--- a/pkgs/development/libraries/libbfd/default.nix
+++ b/pkgs/development/libraries/libbfd/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchpatch, gnu-config, autoreconfHook, bison, binutils-unwrapped
 , libiberty, zlib
 }:
@@ -43,7 +43,7 @@ stdenv.mkDerivation {
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A library for manipulating containers of machine code";
     longDescription = ''
       BFD is a library which provides a single interface to read and write
diff --git a/pkgs/development/libraries/libblockdev/default.nix b/pkgs/development/libraries/libblockdev/default.nix
index 1ea610883b5c2..11a65006422fb 100644
--- a/pkgs/development/libraries/libblockdev/default.nix
+++ b/pkgs/development/libraries/libblockdev/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, substituteAll, autoreconfHook, pkg-config, gtk-doc
+{ lib, stdenv, fetchFromGitHub, substituteAll, autoreconfHook, pkg-config, gtk-doc
 , docbook_xml_dtd_43, python3, gobject-introspection, glib, udev, kmod, parted
 , cryptsetup, lvm2, dmraid, util-linux, libbytesize, libndctl, nss, volume_key
 , libxslt, docbook_xsl, gptfdisk, libyaml, autoconf-archive
@@ -40,10 +40,10 @@ stdenv.mkDerivation rec {
 
   postInstall = ''
     wrapProgram $out/bin/lvm-cache-stats --prefix PATH : \
-      ${stdenv.lib.makeBinPath [ thin-provisioning-tools ]}
+      ${lib.makeBinPath [ thin-provisioning-tools ]}
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A library for manipulating block devices";
     homepage = "http://storaged.org/libblockdev/";
     license = with licenses; [ lgpl2Plus gpl2Plus ]; # lgpl2Plus for the library, gpl2Plus for the utils
diff --git a/pkgs/development/libraries/libblocksruntime/default.nix b/pkgs/development/libraries/libblocksruntime/default.nix
index aff56994f4985..6ba832fb3cdae 100644
--- a/pkgs/development/libraries/libblocksruntime/default.nix
+++ b/pkgs/development/libraries/libblocksruntime/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, clang }:
+{ lib, stdenv, fetchFromGitHub, clang }:
 
 stdenv.mkDerivation {
   name = "blocksruntime-20140624";
@@ -25,7 +25,7 @@ stdenv.mkDerivation {
 
   installPhase = ''prefix="/" DESTDIR=$out ./installlib'';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Installs the BlocksRuntime library from the compiler-rt";
     homepage = "https://github.com/mackyle/blocksruntime";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/libbluedevil/default.nix b/pkgs/development/libraries/libbluedevil/default.nix
index bf72720019ce5..7cb4c9e2b32c5 100644
--- a/pkgs/development/libraries/libbluedevil/default.nix
+++ b/pkgs/development/libraries/libbluedevil/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, cmake, qt4 }:
+{ lib, stdenv, fetchurl, cmake, qt4 }:
 
 stdenv.mkDerivation rec {
   pname = "libbluedevil";
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
   buildInputs = [ qt4 ];
 
   meta = {
-    platforms = stdenv.lib.platforms.unix;
-    license = stdenv.lib.licenses.gpl2Plus;
+    platforms = lib.platforms.unix;
+    license = lib.licenses.gpl2Plus;
   };
 }
diff --git a/pkgs/development/libraries/libbluray/default.nix b/pkgs/development/libraries/libbluray/default.nix
index 948b48b192d1d..3f90bb878adc9 100644
--- a/pkgs/development/libraries/libbluray/default.nix
+++ b/pkgs/development/libraries/libbluray/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, fontconfig, autoreconfHook, DiskArbitration
+{ lib, stdenv, fetchurl, pkg-config, fontconfig, autoreconfHook, DiskArbitration
 , withJava ? false, jdk ? null, ant ? null
 , withAACS ? false, libaacs ? null
 , withBDplus ? false, libbdplus ? null
@@ -6,7 +6,7 @@
 , withFonts ? true, freetype ? null
 }:
 
-with stdenv.lib;
+with lib;
 
 assert withJava -> jdk != null && ant != null;
 assert withAACS -> libaacs != null;
@@ -50,13 +50,13 @@ stdenv.mkDerivation rec {
     ${optionalString withJava ''export JDK_HOME="${jdk.home}"''}
   '';
 
-  configureFlags =  with stdenv.lib;
+  configureFlags =  with lib;
                     optional (! withJava) "--disable-bdjava-jar"
                  ++ optional (! withMetadata) "--without-libxml2"
                  ++ optional (! withFonts) "--without-freetype"
                  ;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://www.videolan.org/developers/libbluray.html";
     description = "Library to access Blu-Ray disks for video playback";
     license = licenses.lgpl21;
diff --git a/pkgs/development/libraries/libbsd/default.nix b/pkgs/development/libraries/libbsd/default.nix
index 7aea38bdb58da..778b61d831586 100644
--- a/pkgs/development/libraries/libbsd/default.nix
+++ b/pkgs/development/libraries/libbsd/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, autoreconfHook }:
+{ lib, stdenv, fetchurl, autoreconfHook }:
 
 stdenv.mkDerivation rec {
   pname = "libbsd";
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
 
   patches = [ ./darwin.patch ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Common functions found on BSD systems";
     homepage = "https://libbsd.freedesktop.org/";
     license = licenses.bsd3;
diff --git a/pkgs/development/libraries/libbson/default.nix b/pkgs/development/libraries/libbson/default.nix
index 1d2043b20cd4c..e03d7c1948475 100644
--- a/pkgs/development/libraries/libbson/default.nix
+++ b/pkgs/development/libraries/libbson/default.nix
@@ -1,4 +1,4 @@
-{ fetchFromGitHub, perl, stdenv, cmake }:
+{ fetchFromGitHub, perl, lib, stdenv, cmake }:
 
 stdenv.mkDerivation rec {
   pname = "libbson";
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ cmake ];
   buildInputs = [ perl ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A C Library for parsing, editing, and creating BSON documents";
     homepage = "https://github.com/mongodb/libbson";
     license = licenses.asl20;
diff --git a/pkgs/development/libraries/libburn/default.nix b/pkgs/development/libraries/libburn/default.nix
index 42c680835f142..02e73b0c04cf4 100644
--- a/pkgs/development/libraries/libburn/default.nix
+++ b/pkgs/development/libraries/libburn/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
   pname = "libburn";
@@ -9,7 +9,7 @@ stdenv.mkDerivation rec {
     sha256 = "1xrp9c2sppbds0agqzmdym7rvdwpjrq6v6q2c3718cwvbjmh66c8";
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://libburnia-project.org/";
     description = "A library by which preformatted data get onto optical media: CD, DVD, BD (Blu-Ray)";
     license = licenses.gpl2Plus;
diff --git a/pkgs/development/libraries/libbytesize/default.nix b/pkgs/development/libraries/libbytesize/default.nix
index f972feacda3d9..a84f010b9e675 100644
--- a/pkgs/development/libraries/libbytesize/default.nix
+++ b/pkgs/development/libraries/libbytesize/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, autoreconfHook, pkg-config, gettext
+{ lib, stdenv, fetchFromGitHub, autoreconfHook, pkg-config, gettext
 , gtk-doc, libxslt, docbook_xml_dtd_43, docbook_xsl
 , python3, pcre2, gmp, mpfr
 }:
@@ -22,7 +22,7 @@ in stdenv.mkDerivation rec {
 
   buildInputs = [ pcre2 gmp mpfr ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A tiny library providing a C “class” for working with arbitrary big sizes in bytes";
     homepage = src.meta.homepage;
     license = licenses.lgpl2Plus;
diff --git a/pkgs/development/libraries/libcaca/default.nix b/pkgs/development/libraries/libcaca/default.nix
index 642b0a27aa6c8..ca879a60c7a0e 100644
--- a/pkgs/development/libraries/libcaca/default.nix
+++ b/pkgs/development/libraries/libcaca/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, ncurses, zlib, pkg-config, imlib2
+{ lib, stdenv, fetchurl, ncurses, zlib, pkg-config, imlib2
 , x11Support ? !stdenv.isDarwin, libX11, libXext
 }:
 
@@ -19,12 +19,12 @@ stdenv.mkDerivation rec {
     (if x11Support then "--enable-x11" else "--disable-x11")
     ];
 
-  NIX_CFLAGS_COMPILE = stdenv.lib.optionalString (!x11Support) "-DX_DISPLAY_MISSING";
+  NIX_CFLAGS_COMPILE = lib.optionalString (!x11Support) "-DX_DISPLAY_MISSING";
 
   enableParallelBuilding = true;
 
   propagatedBuildInputs = [ ncurses zlib pkg-config (imlib2.override { inherit x11Support; }) ]
-    ++ stdenv.lib.optionals x11Support [ libX11 libXext ];
+    ++ lib.optionals x11Support [ libX11 libXext ];
 
   postInstall = ''
     mkdir -p $dev/bin
@@ -34,7 +34,7 @@ stdenv.mkDerivation rec {
   meta = {
     homepage = "http://libcaca.zoy.org/";
     description = "A graphics library that outputs text instead of pixels";
-    license = stdenv.lib.licenses.wtfpl;
-    platforms = stdenv.lib.platforms.unix;
+    license = lib.licenses.wtfpl;
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/libcacard/default.nix b/pkgs/development/libraries/libcacard/default.nix
index 8ba9e34c9d3ce..c484a49b1a2bd 100644
--- a/pkgs/development/libraries/libcacard/default.nix
+++ b/pkgs/development/libraries/libcacard/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, glib, nss }:
+{ lib, stdenv, fetchurl, pkg-config, glib, nss }:
 
 stdenv.mkDerivation rec {
   pname = "libcacard";
@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ pkg-config ];
   buildInputs = [ glib nss ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Smart card emulation library";
     homepage = "https://gitlab.freedesktop.org/spice/libcacard";
     license = licenses.lgpl21;
diff --git a/pkgs/development/libraries/libcanberra/default.nix b/pkgs/development/libraries/libcanberra/default.nix
index fb806aa249669..a2dfe1322f84b 100644
--- a/pkgs/development/libraries/libcanberra/default.nix
+++ b/pkgs/development/libraries/libcanberra/default.nix
@@ -30,7 +30,7 @@ stdenv.mkDerivation rec {
     })
   ];
 
-  postPatch = (stdenv.lib.optional stdenv.isDarwin) ''
+  postPatch = (lib.optional stdenv.isDarwin) ''
     patch -p0 < ${fetchpatch {
       url = "https://raw.githubusercontent.com/macports/macports-ports/master/audio/libcanberra/files/patch-configure.diff";
       sha256 = "1f7h7ifpqvbfhqygn1b7klvwi80zmpv3538vbmq7ql7bkf1q8h31";
@@ -60,9 +60,9 @@ stdenv.mkDerivation rec {
 
     homepage = "http://0pointer.de/lennart/projects/libcanberra/";
 
-    license = stdenv.lib.licenses.lgpl2Plus;
+    license = lib.licenses.lgpl2Plus;
 
     maintainers = [ ];
-    platforms = stdenv.lib.platforms.unix;
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/libcangjie/default.nix b/pkgs/development/libraries/libcangjie/default.nix
index 506c3a3d3d61e..c6bbbcdb61ab0 100644
--- a/pkgs/development/libraries/libcangjie/default.nix
+++ b/pkgs/development/libraries/libcangjie/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, autoconf, automake, libtool, m4, fetchurl, bash, pkg-config, sqlite }:
+{ lib, stdenv, autoconf, automake, libtool, m4, fetchurl, bash, pkg-config, sqlite }:
 
 stdenv.mkDerivation rec {
   pname = "libcangjie";
@@ -27,9 +27,9 @@ stdenv.mkDerivation rec {
       libcangjie is a library implementing the Cangjie input method.
     '';
     homepage = "http://cangjians.github.io/projects/libcangjie/";
-    license = stdenv.lib.licenses.lgpl3Plus;
+    license = lib.licenses.lgpl3Plus;
 
-    maintainers = [ stdenv.lib.maintainers.linquize ];
-    platforms = stdenv.lib.platforms.all;
+    maintainers = [ lib.maintainers.linquize ];
+    platforms = lib.platforms.all;
   };
 }
diff --git a/pkgs/development/libraries/libcbor/default.nix b/pkgs/development/libraries/libcbor/default.nix
index ae5154eac0348..349b715d8520c 100644
--- a/pkgs/development/libraries/libcbor/default.nix
+++ b/pkgs/development/libraries/libcbor/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, cmocka }:
+{ lib, stdenv, fetchFromGitHub, cmake, cmocka }:
 
 stdenv.mkDerivation rec {
   pname = "libcbor";
@@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
 
   cmakeFlags = [ "-DCMAKE_INSTALL_LIBDIR=lib" "-DBUILD_SHARED_LIBS=on" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "CBOR protocol implementation for C and others";
     homepage = "https://github.com/PJK/libcbor";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/libcdaudio/default.nix b/pkgs/development/libraries/libcdaudio/default.nix
index abc5f84a0e32e..e5f6324e261cc 100644
--- a/pkgs/development/libraries/libcdaudio/default.nix
+++ b/pkgs/development/libraries/libcdaudio/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl}:
+{lib, stdenv, fetchurl}:
 
 stdenv.mkDerivation {
   name = "libcdaudio-0.99.12p2";
@@ -10,7 +10,7 @@ stdenv.mkDerivation {
   meta = {
     description = "A portable library for controlling audio CDs";
     homepage = "http://libcdaudio.sourceforge.net";
-    platforms = stdenv.lib.platforms.linux;
-    license = stdenv.lib.licenses.lgpl2;
+    platforms = lib.platforms.linux;
+    license = lib.licenses.lgpl2;
   };
 }
diff --git a/pkgs/development/libraries/libcddb/default.nix b/pkgs/development/libraries/libcddb/default.nix
index 2b837ff1ce1ac..c1b28e22e103a 100644
--- a/pkgs/development/libraries/libcddb/default.nix
+++ b/pkgs/development/libraries/libcddb/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, libiconv }:
+{ lib, stdenv, fetchurl, libiconv }:
 
 stdenv.mkDerivation rec {
   name = "libcddb-1.3.2";
@@ -8,16 +8,16 @@ stdenv.mkDerivation rec {
     sha256 = "0fr21a7vprdyy1bq6s99m0x420c9jm5fipsd63pqv8qyfkhhxkim";
   };
 
-  buildInputs = stdenv.lib.optional stdenv.isDarwin libiconv;
+  buildInputs = lib.optional stdenv.isDarwin libiconv;
 
-  configureFlags = stdenv.lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
+  configureFlags = lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
     "ac_cv_func_malloc_0_nonnull=yes"
     "ac_cv_func_realloc_0_nonnull=yes"
   ];
 
   doCheck = false; # fails 3 of 5 tests with locale errors
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "C library to access data on a CDDB server (freedb.org)";
     homepage = "http://libcddb.sourceforge.net/";
     license = licenses.lgpl2Plus;
diff --git a/pkgs/development/libraries/libcdio-paranoia/default.nix b/pkgs/development/libraries/libcdio-paranoia/default.nix
index 9282077261948..905d39dbd8ea3 100644
--- a/pkgs/development/libraries/libcdio-paranoia/default.nix
+++ b/pkgs/development/libraries/libcdio-paranoia/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, autoreconfHook, libcdio, pkg-config,
+{ lib, stdenv, fetchFromGitHub, autoreconfHook, libcdio, pkg-config,
   libiconv, IOKit, DiskArbitration}:
 
 stdenv.mkDerivation {
@@ -13,15 +13,15 @@ stdenv.mkDerivation {
 
   nativeBuildInputs = [ autoreconfHook pkg-config ];
   buildInputs = [ libcdio ] ++
-    stdenv.lib.optionals stdenv.isDarwin [ libiconv IOKit DiskArbitration ];
+    lib.optionals stdenv.isDarwin [ libiconv IOKit DiskArbitration ];
 
-  propagatedBuildInputs = stdenv.lib.optional stdenv.isDarwin DiskArbitration;
+  propagatedBuildInputs = lib.optional stdenv.isDarwin DiskArbitration;
 
-  configureFlags = stdenv.lib.optionals stdenv.isDarwin [
+  configureFlags = lib.optionals stdenv.isDarwin [
     "--disable-ld-version-script"
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "CD paranoia on top of libcdio";
     longDescription = ''
       This is a port of xiph.org's cdda paranoia to use libcdio for CDROM
diff --git a/pkgs/development/libraries/libcdio/default.nix b/pkgs/development/libraries/libcdio/default.nix
index e7705362894ae..cfe796b14d062 100644
--- a/pkgs/development/libraries/libcdio/default.nix
+++ b/pkgs/development/libraries/libcdio/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, libcddb, pkg-config, ncurses, help2man, libiconv, Carbon, IOKit }:
+{ lib, stdenv, fetchurl, libcddb, pkg-config, ncurses, help2man, libiconv, Carbon, IOKit }:
 
 stdenv.mkDerivation rec {
   name = "libcdio-2.1.0";
@@ -14,11 +14,11 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ pkg-config help2man ];
   buildInputs = [ libcddb ncurses ]
-    ++ stdenv.lib.optionals stdenv.isDarwin [ libiconv Carbon IOKit ];
+    ++ lib.optionals stdenv.isDarwin [ libiconv Carbon IOKit ];
 
   doCheck = !stdenv.isDarwin;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A library for OS-independent CD-ROM and CD image access";
     longDescription = ''
       GNU libcdio is a library for OS-independent CD-ROM and
diff --git a/pkgs/development/libraries/libcdr/default.nix b/pkgs/development/libraries/libcdr/default.nix
index 20f45bc1bced9..087c928b79ce7 100644
--- a/pkgs/development/libraries/libcdr/default.nix
+++ b/pkgs/development/libraries/libcdr/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, libwpg, libwpd, lcms, pkg-config, librevenge, icu, boost, cppunit }:
+{ lib, stdenv, fetchurl, libwpg, libwpd, lcms, pkg-config, librevenge, icu, boost, cppunit }:
 
 stdenv.mkDerivation rec {
   name = "libcdr-0.1.6";
@@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
   meta = {
     description = "A library providing ability to interpret and import Corel Draw drawings into various applications";
     homepage = "http://www.freedesktop.org/wiki/Software/libcdr";
-    platforms = stdenv.lib.platforms.all;
-    license = stdenv.lib.licenses.mpl20;
+    platforms = lib.platforms.all;
+    license = lib.licenses.mpl20;
   };
 }
diff --git a/pkgs/development/libraries/libcec/default.nix b/pkgs/development/libraries/libcec/default.nix
index e8c649c9660e8..341754376aae3 100644
--- a/pkgs/development/libraries/libcec/default.nix
+++ b/pkgs/development/libraries/libcec/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, cmake, pkg-config, udev, libcec_platform, libraspberrypi ? null }:
+{ lib, stdenv, fetchurl, cmake, pkg-config, udev, libcec_platform, libraspberrypi ? null }:
 
 let version = "4.0.7"; in
 
@@ -13,7 +13,7 @@ stdenv.mkDerivation {
 
   nativeBuildInputs = [ pkg-config cmake ];
   buildInputs = [ udev libcec_platform ] ++
-    stdenv.lib.optional (libraspberrypi != null) libraspberrypi;
+    lib.optional (libraspberrypi != null) libraspberrypi;
 
   cmakeFlags = [ "-DBUILD_SHARED_LIBS=1" ];
 
@@ -22,11 +22,11 @@ stdenv.mkDerivation {
     substituteInPlace include/cecloader.h --replace "libcec.so" "$out/lib/libcec.so"
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Allows you (with the right hardware) to control your device with your TV remote control using existing HDMI cabling";
     homepage = "http://libcec.pulse-eight.com";
     repositories.git = "https://github.com/Pulse-Eight/libcec.git";
-    license = stdenv.lib.licenses.gpl2Plus;
+    license = lib.licenses.gpl2Plus;
     platforms = platforms.linux;
     maintainers = [ maintainers.titanous ];
   };
diff --git a/pkgs/development/libraries/libcec/platform.nix b/pkgs/development/libraries/libcec/platform.nix
index 2132cf7a065e6..15972272a1871 100644
--- a/pkgs/development/libraries/libcec/platform.nix
+++ b/pkgs/development/libraries/libcec/platform.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, cmake }:
+{ lib, stdenv, fetchurl, cmake }:
 
 let version = "2.1.0.1"; in
 
@@ -13,11 +13,11 @@ stdenv.mkDerivation {
 
   nativeBuildInputs = [ cmake ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Platform library for libcec and Kodi addons";
     homepage = "https://github.com/Pulse-Eight/platform";
     repositories.git = "https://github.com/Pulse-Eight/platform.git";
-    license = stdenv.lib.licenses.gpl2Plus;
+    license = lib.licenses.gpl2Plus;
     platforms = platforms.linux;
     maintainers = [ maintainers.titanous ];
   };
diff --git a/pkgs/development/libraries/libcef/default.nix b/pkgs/development/libraries/libcef/default.nix
index 93aaebc110e24..ec1a5ee382813 100644
--- a/pkgs/development/libraries/libcef/default.nix
+++ b/pkgs/development/libraries/libcef/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, cmake, alsaLib, atk, cairo, cups, dbus, expat, fontconfig
+{ lib, stdenv, fetchurl, cmake, alsaLib, atk, cairo, cups, dbus, expat, fontconfig
 , GConf, gdk-pixbuf, glib, gtk2, libX11, libxcb, libXcomposite, libXcursor
 , libXdamage, libXext, libXfixes, libXi, libXrandr, libXrender, libXScrnSaver
 , libXtst, nspr, nss, pango, libpulseaudio, systemd, at-spi2-atk, at-spi2-core
@@ -6,7 +6,7 @@
 
 let
   libPath =
-    stdenv.lib.makeLibraryPath [
+    lib.makeLibraryPath [
       alsaLib atk cairo cups dbus expat fontconfig GConf gdk-pixbuf glib gtk2
       libX11 libxcb libXcomposite libXcursor libXdamage libXext libXfixes libXi
       libXrandr libXrender libXScrnSaver libXtst nspr nss pango libpulseaudio
@@ -38,7 +38,7 @@ stdenv.mkDerivation rec {
     cp -r ../include $out/
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Simple framework for embedding Chromium-based browsers in other applications";
     homepage = "http://opensource.spotify.com/cefbuilds/index.html";
     maintainers = with maintainers; [ puffnfresh ];
diff --git a/pkgs/development/libraries/libcello/default.nix b/pkgs/development/libraries/libcello/default.nix
index 908c9cb15dd27..100077bcc7064 100644
--- a/pkgs/development/libraries/libcello/default.nix
+++ b/pkgs/development/libraries/libcello/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
   pname = "libcello";
@@ -14,8 +14,8 @@ stdenv.mkDerivation rec {
   meta = {
     homepage = "http://libcello.org/";
     description = "Higher level programming in C";
-    license = stdenv.lib.licenses.bsd3;
-    maintainers = [ stdenv.lib.maintainers.MostAwesomeDude ];
-    platforms = stdenv.lib.platforms.unix;
+    license = lib.licenses.bsd3;
+    maintainers = [ lib.maintainers.MostAwesomeDude ];
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/libchamplain/default.nix b/pkgs/development/libraries/libchamplain/default.nix
index adf85428eea0d..22a062acd6efd 100644
--- a/pkgs/development/libraries/libchamplain/default.nix
+++ b/pkgs/development/libraries/libchamplain/default.nix
@@ -1,4 +1,4 @@
-{ fetchurl, stdenv, meson, ninja, vala, gtk-doc, docbook_xsl, docbook_xml_dtd_412, pkg-config, glib, gtk3, cairo, sqlite, gnome3
+{ fetchurl, lib, stdenv, meson, ninja, vala, gtk-doc, docbook_xsl, docbook_xml_dtd_412, pkg-config, glib, gtk3, cairo, sqlite, gnome3
 , clutter-gtk, libsoup, gobject-introspection /*, libmemphis */ }:
 
 stdenv.mkDerivation rec {
@@ -6,7 +6,7 @@ stdenv.mkDerivation rec {
   version = "0.12.20";
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "0rihpb0npqpihqcdz4w03rq6xl7jdckfqskvv9diq2hkrnzv8ch2";
   };
 
@@ -29,7 +29,7 @@ stdenv.mkDerivation rec {
     };
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://wiki.gnome.org/Projects/libchamplain";
     license = licenses.lgpl2Plus;
 
diff --git a/pkgs/development/libraries/libchardet/default.nix b/pkgs/development/libraries/libchardet/default.nix
index 168217678c0a8..260c332f7ef47 100644
--- a/pkgs/development/libraries/libchardet/default.nix
+++ b/pkgs/development/libraries/libchardet/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, perl }:
+{ lib, stdenv, fetchFromGitHub, perl }:
 
 stdenv.mkDerivation rec {
   pname = "libchardet";
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Mozilla's Universal Charset Detector C/C++ API";
     homepage = "ftp://ftp.oops.org/pub/oops/libchardet/index.html";
     license = licenses.mpl11;
diff --git a/pkgs/development/libraries/libchewing/default.nix b/pkgs/development/libraries/libchewing/default.nix
index cd2df385f488c..1436d4bd59dc9 100644
--- a/pkgs/development/libraries/libchewing/default.nix
+++ b/pkgs/development/libraries/libchewing/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, sqlite }:
+{ lib, stdenv, fetchurl, sqlite }:
 
 stdenv.mkDerivation rec {
   pname = "libchewing";
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ sqlite ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Intelligent Chinese phonetic input method";
     homepage = "http://chewing.im/";
     license = licenses.lgpl21;
diff --git a/pkgs/development/libraries/libchop/default.nix b/pkgs/development/libraries/libchop/default.nix
index 6e8ed7a04a2f4..f02ac04621fc3 100644
--- a/pkgs/development/libraries/libchop/default.nix
+++ b/pkgs/development/libraries/libchop/default.nix
@@ -1,4 +1,4 @@
-{ fetchurl, stdenv, zlib, bzip2, libgcrypt
+{ fetchurl, lib, stdenv, zlib, bzip2, libgcrypt
 , gdbm, gperf, tdb, gnutls, db, libuuid
 , lzo, pkg-config, guile, rpcsvc-proto, libtirpc
 }:
@@ -32,7 +32,7 @@ stdenv.mkDerivation rec {
     sed -re 's%@GUILE@%&/guile%' -i */Makefile.* Makefile.*
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Tools & library for data backup and distributed storage";
 
     longDescription =
diff --git a/pkgs/development/libraries/libck/default.nix b/pkgs/development/libraries/libck/default.nix
index c4f38e96f3d24..accb6556011d4 100644
--- a/pkgs/development/libraries/libck/default.nix
+++ b/pkgs/development/libraries/libck/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub }:
+{ lib, stdenv, fetchFromGitHub }:
 
 stdenv.mkDerivation rec {
   pname = "ck";
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
 
   dontDisableStatic = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "High-performance concurrency research library";
     longDescription = ''
       Concurrency primitives, safe memory reclamation mechanisms and non-blocking data structures for the research, design and implementation of high performance concurrent systems.
diff --git a/pkgs/development/libraries/libclc/default.nix b/pkgs/development/libraries/libclc/default.nix
index 0672e7942cbb3..a6334bf9998c0 100644
--- a/pkgs/development/libraries/libclc/default.nix
+++ b/pkgs/development/libraries/libclc/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, python, llvmPackages }:
+{ lib, stdenv, fetchFromGitHub, python, llvmPackages }:
 
 let
   llvm = llvmPackages.llvm;
@@ -30,7 +30,7 @@ stdenv.mkDerivation {
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://libclc.llvm.org/";
     description = "Implementation of the library requirements of the OpenCL C programming language";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/libcli/default.nix b/pkgs/development/libraries/libcli/default.nix
index 6cabe1343c486..ceb0338e5cc11 100644
--- a/pkgs/development/libraries/libcli/default.nix
+++ b/pkgs/development/libraries/libcli/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, fetchurl }:
+{ lib, stdenv, fetchFromGitHub, fetchurl }:
 
 stdenv.mkDerivation rec {
   pname = "libcli";
@@ -22,7 +22,7 @@ stdenv.mkDerivation rec {
 
   makeFlags = [ "PREFIX=$(out)" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Emulate a Cisco-style telnet command-line interface";
     homepage = "http://sites.dparrish.com/libcli";
     license = licenses.lgpl21Plus;
diff --git a/pkgs/development/libraries/libcloudproviders/default.nix b/pkgs/development/libraries/libcloudproviders/default.nix
index 37f77bb0d76d8..08601db083420 100644
--- a/pkgs/development/libraries/libcloudproviders/default.nix
+++ b/pkgs/development/libraries/libcloudproviders/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, meson, ninja, pkg-config, gobject-introspection, vala, gtk-doc, docbook_xsl, glib }:
+{ lib, stdenv, fetchurl, meson, ninja, pkg-config, gobject-introspection, vala, gtk-doc, docbook_xsl, glib }:
 
 # TODO: Add installed tests once https://gitlab.gnome.org/World/libcloudproviders/issues/4 is fixed
 
@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ glib ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "DBus API that allows cloud storage sync clients to expose their services";
     homepage = "https://gitlab.gnome.org/World/libcloudproviders";
     license = licenses.lgpl3Plus;
diff --git a/pkgs/development/libraries/libclthreads/default.nix b/pkgs/development/libraries/libclthreads/default.nix
index 53cff9a19d3d4..e4548420a0576 100644
--- a/pkgs/development/libraries/libclthreads/default.nix
+++ b/pkgs/development/libraries/libclthreads/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
   pname = "libclthreads";
@@ -30,7 +30,7 @@ stdenv.mkDerivation rec {
     ln $out/lib/libclthreads.so $out/lib/libclthreads.so.2
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Zita thread library";
     homepage = "http://kokkinizita.linuxaudio.org/linuxaudio/downloads/index.html";
     license = licenses.lgpl21;
diff --git a/pkgs/development/libraries/libclxclient/default.nix b/pkgs/development/libraries/libclxclient/default.nix
index c02a913613d34..0d39a5e55b261 100644
--- a/pkgs/development/libraries/libclxclient/default.nix
+++ b/pkgs/development/libraries/libclxclient/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, libclthreads, libX11, libXft, xorg, pkg-config }:
+{ lib, stdenv, fetchurl, libclthreads, libX11, libXft, xorg, pkg-config }:
 
 stdenv.mkDerivation rec {
   pname = "libclxclient";
@@ -39,7 +39,7 @@ stdenv.mkDerivation rec {
     ln $out/lib/libclxclient.so $out/lib/libclxclient.so.3
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Zita X11 library";
     homepage = "http://kokkinizita.linuxaudio.org/linuxaudio/downloads/index.html";
     license = licenses.lgpl21;
diff --git a/pkgs/development/libraries/libcmis/default.nix b/pkgs/development/libraries/libcmis/default.nix
index 1a97e544bb2b2..2898c9a1c835e 100644
--- a/pkgs/development/libraries/libcmis/default.nix
+++ b/pkgs/development/libraries/libcmis/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, boost, libxml2, pkg-config, docbook2x, curl, autoreconfHook, cppunit }:
+{ lib, stdenv, fetchFromGitHub, boost, libxml2, pkg-config, docbook2x, curl, autoreconfHook, cppunit }:
 
 stdenv.mkDerivation rec {
   pname = "libcmis";
@@ -23,7 +23,7 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "C++ client library for the CMIS interface";
     homepage = "https://sourceforge.net/projects/libcmis/";
     license = licenses.gpl2;
diff --git a/pkgs/development/libraries/libco-canonical/default.nix b/pkgs/development/libraries/libco-canonical/default.nix
index 689fbbb65bfd4..a01bbf7419cc0 100644
--- a/pkgs/development/libraries/libco-canonical/default.nix
+++ b/pkgs/development/libraries/libco-canonical/default.nix
@@ -1,6 +1,6 @@
-{ stdenv, fetchFromGitHub, pkg-config }:
+{ lib, stdenv, fetchFromGitHub, pkg-config }:
 
-with stdenv.lib;
+with lib;
 
 stdenv.mkDerivation rec {
   pname = "libco-canonical";
diff --git a/pkgs/development/libraries/libcollectdclient/default.nix b/pkgs/development/libraries/libcollectdclient/default.nix
index f945434842eeb..df8db3ac9f892 100644
--- a/pkgs/development/libraries/libcollectdclient/default.nix
+++ b/pkgs/development/libraries/libcollectdclient/default.nix
@@ -1,5 +1,5 @@
-{ stdenv, collectd }:
-with stdenv.lib;
+{ lib, stdenv, collectd }:
+with lib;
 
 collectd.overrideAttrs (oldAttrs: {
   name = "libcollectdclient-${collectd.version}";
@@ -12,7 +12,7 @@ collectd.overrideAttrs (oldAttrs: {
 
   postInstall = "rm -rf $out/{bin,etc,sbin,share}";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "C Library for collectd, a daemon which collects system performance statistics periodically";
     homepage = "http://collectd.org";
     license = licenses.gpl2;
diff --git a/pkgs/development/libraries/libcommuni/default.nix b/pkgs/development/libraries/libcommuni/default.nix
index 3f91c8e579f5e..47360e11bc5e7 100644
--- a/pkgs/development/libraries/libcommuni/default.nix
+++ b/pkgs/development/libraries/libcommuni/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub
+{ lib, stdenv, fetchFromGitHub
 , qtbase, qtdeclarative, qmake, which
 }:
 
@@ -34,7 +34,7 @@ stdenv.mkDerivation rec {
   # Hack to avoid TMPDIR in RPATHs.
   preFixup = "rm -rf lib";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A cross-platform IRC framework written with Qt";
     homepage = "https://communi.github.io";
     license = licenses.bsd3;
diff --git a/pkgs/development/libraries/libconfig/default.nix b/pkgs/development/libraries/libconfig/default.nix
index 7d7f95d757cee..ae5f117646334 100644
--- a/pkgs/development/libraries/libconfig/default.nix
+++ b/pkgs/development/libraries/libconfig/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
   pname = "libconfig";
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
 
   doCheck = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://www.hyperrealm.com/libconfig";
     description = "A simple library for processing structured configuration files";
     license = licenses.lgpl3;
diff --git a/pkgs/development/libraries/libconfuse/default.nix b/pkgs/development/libraries/libconfuse/default.nix
index b7afe5ed03afe..7545fe9617ccb 100644
--- a/pkgs/development/libraries/libconfuse/default.nix
+++ b/pkgs/development/libraries/libconfuse/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, autoreconfHook, flex }:
+{ lib, stdenv, fetchFromGitHub, autoreconfHook, flex }:
 
 stdenv.mkDerivation rec {
   pname = "libconfuse";
@@ -25,7 +25,7 @@ stdenv.mkDerivation rec {
   doInstallCheck = true;
   installCheckTarget = "check";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     inherit (src.meta) homepage;
     description = "Small configuration file parser library for C";
     longDescription = ''
diff --git a/pkgs/development/libraries/libcouchbase/default.nix b/pkgs/development/libraries/libcouchbase/default.nix
index aab90f8e37f17..9f75eafdf247c 100644
--- a/pkgs/development/libraries/libcouchbase/default.nix
+++ b/pkgs/development/libraries/libcouchbase/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, pkg-config, libevent, openssl}:
+{ lib, stdenv, fetchFromGitHub, cmake, pkg-config, libevent, openssl}:
 
 stdenv.mkDerivation rec {
   pname = "libcouchbase";
@@ -23,7 +23,7 @@ stdenv.mkDerivation rec {
 
   doCheck = !stdenv.isDarwin;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "C client library for Couchbase";
     homepage = "https://github.com/couchbase/libcouchbase";
     license = licenses.asl20;
diff --git a/pkgs/development/libraries/libcrafter/default.nix b/pkgs/development/libraries/libcrafter/default.nix
index 20bcc9183ec4d..e7a6e6c983720 100644
--- a/pkgs/development/libraries/libcrafter/default.nix
+++ b/pkgs/development/libraries/libcrafter/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchzip, autoconf, automake, libtool, libpcap }:
+{ lib, stdenv, fetchzip, autoconf, automake, libtool, libpcap }:
 
 stdenv.mkDerivation rec {
   pname = "libcrafter";
@@ -22,8 +22,8 @@ stdenv.mkDerivation rec {
   meta = {
     homepage = "https://github.com/pellegre/libcrafter";
     description = "High level C++ network packet sniffing and crafting library";
-    license = stdenv.lib.licenses.bsd3;
-    maintainers = [ stdenv.lib.maintainers.lethalman ];
-    platforms = stdenv.lib.platforms.unix;
+    license = lib.licenses.bsd3;
+    maintainers = [ lib.maintainers.lethalman ];
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/libcredis/default.nix b/pkgs/development/libraries/libcredis/default.nix
index 1368cd30adbb6..902f5a6ee26fd 100644
--- a/pkgs/development/libraries/libcredis/default.nix
+++ b/pkgs/development/libraries/libcredis/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation {
   name = "libcredis-0.2.3";
@@ -19,7 +19,7 @@ stdenv.mkDerivation {
     cp -v *.h "$out/include/"
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "C client library for Redis (key-value database)";
     homepage = "https://code.google.com/archive/p/credis/";
     license = licenses.bsd3; # from homepage
diff --git a/pkgs/development/libraries/libcrossguid/default.nix b/pkgs/development/libraries/libcrossguid/default.nix
index 8e2be72987cfd..c81dbb86f6a05 100644
--- a/pkgs/development/libraries/libcrossguid/default.nix
+++ b/pkgs/development/libraries/libcrossguid/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, libuuid }:
+{ lib, stdenv, fetchFromGitHub, libuuid }:
 
 stdenv.mkDerivation rec {
   name = "lib" + pname + "-" + version;
@@ -24,7 +24,7 @@ stdenv.mkDerivation rec {
     install -D -m644 guid.h "$out/include/guid.h"
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Lightweight cross platform C++ GUID/UUID library";
     license = licenses.mit;
     maintainers = with maintainers; [ edwtjo ];
diff --git a/pkgs/development/libraries/libcryptui/default.nix b/pkgs/development/libraries/libcryptui/default.nix
index 6a9b87d00d9ce..5fdd60abe1153 100644
--- a/pkgs/development/libraries/libcryptui/default.nix
+++ b/pkgs/development/libraries/libcryptui/default.nix
@@ -1,11 +1,11 @@
-{ stdenv, fetchurl, autoreconfHook, pkg-config, intltool, glib, gnome3, gtk3, gnupg22, gpgme, dbus-glib, libgnome-keyring }:
+{ lib, stdenv, fetchurl, autoreconfHook, pkg-config, intltool, glib, gnome3, gtk3, gnupg22, gpgme, dbus-glib, libgnome-keyring }:
 
 stdenv.mkDerivation rec {
   pname = "libcryptui";
   version = "3.12.2";
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "0rh8wa5k2iwbwppyvij2jdxmnlfjbna7kbh2a5n7zw4nnjkx3ski";
   };
 
@@ -25,7 +25,7 @@ stdenv.mkDerivation rec {
     };
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Interface components for OpenPGP";
     homepage = "https://gitlab.gnome.org/GNOME/libcryptui";
     license = licenses.lgpl21Plus;
diff --git a/pkgs/development/libraries/libcsptr/default.nix b/pkgs/development/libraries/libcsptr/default.nix
index fcb5aa2bbfee9..e30165054aa0e 100644
--- a/pkgs/development/libraries/libcsptr/default.nix
+++ b/pkgs/development/libraries/libcsptr/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake }:
+{ lib, stdenv, fetchFromGitHub, cmake }:
 
 stdenv.mkDerivation rec {
   pname = "libcsptr";
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ cmake ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Smart pointer constructs for the (GNU) C programming language";
     homepage = "https://github.com/Snaipe/libcsptr";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/libctb/default.nix b/pkgs/development/libraries/libctb/default.nix
index 161c7c98c63f3..d52adac556d84 100644
--- a/pkgs/development/libraries/libctb/default.nix
+++ b/pkgs/development/libraries/libctb/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 stdenv.mkDerivation rec {
   pname = "libctb";
   version = "0.16";
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
   makeFlags = [
     "prefix=$(out)"
   ];
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Communications toolbox";
     homepage = "https://iftools.com";
     license = licenses.lgpl2;
diff --git a/pkgs/development/libraries/libctemplate/default.nix b/pkgs/development/libraries/libctemplate/default.nix
index b571e816fc40c..2aa36bfe99146 100644
--- a/pkgs/development/libraries/libctemplate/default.nix
+++ b/pkgs/development/libraries/libctemplate/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, python3, autoconf, automake, libtool }:
+{ lib, stdenv, fetchFromGitHub, python3, autoconf, automake, libtool }:
 
 stdenv.mkDerivation rec {
   pname = "ctemplate";
@@ -29,6 +29,6 @@ stdenv.mkDerivation rec {
       embed application logic in this template language.
     '';
     homepage = "https://github.com/OlafvdSpek/ctemplate";
-    license = stdenv.lib.licenses.bsd3;
+    license = lib.licenses.bsd3;
   };
 }
diff --git a/pkgs/development/libraries/libcue/default.nix b/pkgs/development/libraries/libcue/default.nix
index 73a110c07f69b..227dfd77f4636 100644
--- a/pkgs/development/libraries/libcue/default.nix
+++ b/pkgs/development/libraries/libcue/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, bison, flex }:
+{ lib, stdenv, fetchFromGitHub, cmake, bison, flex }:
 
 stdenv.mkDerivation rec {
   pname = "libcue";
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
 
   doCheck = false; # fails all the tests (ctest)
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "CUE Sheet Parser Library";
     longDescription = ''
       libcue is intended to parse a so called cue sheet from a char string or
diff --git a/pkgs/development/libraries/libcutl/default.nix b/pkgs/development/libraries/libcutl/default.nix
index d463e4af28909..7a5c39849291d 100644
--- a/pkgs/development/libraries/libcutl/default.nix
+++ b/pkgs/development/libraries/libcutl/default.nix
@@ -1,10 +1,10 @@
-{ stdenv, fetchurl, xercesc }:
+{ lib, stdenv, fetchurl, xercesc }:
 
 stdenv.mkDerivation rec {
   pname = "libcutl";
   version = "1.10.0";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "C++ utility library from Code Synthesis";
     longDescription = ''
         libcutl is a C++ utility library.
diff --git a/pkgs/development/libraries/libdaemon/default.nix b/pkgs/development/libraries/libdaemon/default.nix
index d906e119dca66..eeb034ed06787 100644
--- a/pkgs/development/libraries/libdaemon/default.nix
+++ b/pkgs/development/libraries/libdaemon/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl}:
+{lib, stdenv, fetchurl}:
 
 stdenv.mkDerivation rec {
   name = "libdaemon-0.14";
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
   patches = [ ./fix-includes.patch ];
 
   configureFlags = [ "--disable-lynx" ]
-    ++ stdenv.lib.optional (stdenv.hostPlatform != stdenv.buildPlatform)
+    ++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform)
     [ # Can't run this test while cross-compiling
       "ac_cv_func_setpgrp_void=yes"
     ];
@@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
   meta = {
     description = "Lightweight C library that eases the writing of UNIX daemons";
     homepage = "http://0pointer.de/lennart/projects/libdaemon/";
-    license = stdenv.lib.licenses.lgpl2Plus;
-    platforms = stdenv.lib.platforms.unix;
+    license = lib.licenses.lgpl2Plus;
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/libdap/default.nix b/pkgs/development/libraries/libdap/default.nix
index a643c25f0bfdb..8eacd9706a880 100644
--- a/pkgs/development/libraries/libdap/default.nix
+++ b/pkgs/development/libraries/libdap/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, bison, libuuid, curl, libxml2, flex }:
+{ lib, stdenv, fetchurl, bison, libuuid, curl, libxml2, flex }:
 
 stdenv.mkDerivation rec {
   version = "3.20.6";
@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
     sha256 = "0jn5bi8k2lq6mmrsw7r1r5aviyf8gb39b2iy20v4kpkj5napzk1m";
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A C++ SDK which contains an implementation of DAP";
     homepage = "https://www.opendap.org/software/libdap";
     license = licenses.lgpl2;
diff --git a/pkgs/development/libraries/libdatrie/default.nix b/pkgs/development/libraries/libdatrie/default.nix
index 168773662f6a5..f4e2df36d9179 100644
--- a/pkgs/development/libraries/libdatrie/default.nix
+++ b/pkgs/development/libraries/libdatrie/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, makeWrapper
+{ lib, stdenv, fetchFromGitHub, makeWrapper
 , autoreconfHook, autoconf-archive
 , installShellFiles, libiconv }:
 
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
     installShellFiles
   ];
 
-  buildInputs = stdenv.lib.optional stdenv.isDarwin libiconv;
+  buildInputs = lib.optional stdenv.isDarwin libiconv;
 
   preAutoreconf = let
     reports = "https://github.com/tlwg/libdatrie/issues";
@@ -34,7 +34,7 @@ stdenv.mkDerivation rec {
     installManPage man/trietool.1
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://linux.thai.net/~thep/datrie/datrie.html";
     description = "This is an implementation of double-array structure for representing trie";
     license = licenses.lgpl21Plus;
diff --git a/pkgs/development/libraries/libdazzle/default.nix b/pkgs/development/libraries/libdazzle/default.nix
index a4cc7d96593c2..d6ecb6e9747e0 100644
--- a/pkgs/development/libraries/libdazzle/default.nix
+++ b/pkgs/development/libraries/libdazzle/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, ninja, meson, pkg-config, vala, gobject-introspection, libxml2
+{ lib, stdenv, fetchurl, ninja, meson, pkg-config, vala, gobject-introspection, libxml2
 , gtk-doc, docbook_xsl, docbook_xml_dtd_43, dbus, xvfb_run, glib, gtk3, gnome3 }:
 
 stdenv.mkDerivation rec {
@@ -9,7 +9,7 @@ stdenv.mkDerivation rec {
   outputBin = "dev";
 
   src = fetchurl {
-    url = "mirror://gnome/sources/libdazzle/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/libdazzle/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "13v7s46cgw135ycx0byn7am4inn33slrhljq0v0wwfwl2y1g52p1";
   };
 
@@ -34,7 +34,7 @@ stdenv.mkDerivation rec {
     };
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A library to delight your users with fancy features";
     longDescription = ''
       The libdazzle library is a companion library to GObject and GTK. It
diff --git a/pkgs/development/libraries/libdbi-drivers/default.nix b/pkgs/development/libraries/libdbi-drivers/default.nix
index 871c9f971675f..6a86d4941bff3 100644
--- a/pkgs/development/libraries/libdbi-drivers/default.nix
+++ b/pkgs/development/libraries/libdbi-drivers/default.nix
@@ -1,10 +1,10 @@
-{ stdenv, fetchurl, libdbi
+{ lib, stdenv, fetchurl, libdbi
 , libmysqlclient ? null
 , sqlite ? null
 , postgresql ? null
 }:
 
-with stdenv.lib;
+with lib;
 stdenv.mkDerivation rec {
   name = "libdbi-drivers-0.9.0";
 
diff --git a/pkgs/development/libraries/libdbi/default.nix b/pkgs/development/libraries/libdbi/default.nix
index 64c511503d090..48812f091bea7 100644
--- a/pkgs/development/libraries/libdbi/default.nix
+++ b/pkgs/development/libraries/libdbi/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
   name = "libdbi-0.9.0";
@@ -8,7 +8,7 @@ stdenv.mkDerivation rec {
     sha256 = "00s5ra7hdlq25iv23nwf4h1v3kmbiyzx0v9bhggjiii4lpf6ryys";
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://libdbi.sourceforge.net/";
     description = "DB independent interface to DB";
     license = licenses.lgpl21;
diff --git a/pkgs/development/libraries/libdbusmenu-qt/default.nix b/pkgs/development/libraries/libdbusmenu-qt/default.nix
index 6b4be0db41443..e44f3e37d2001 100644
--- a/pkgs/development/libraries/libdbusmenu-qt/default.nix
+++ b/pkgs/development/libraries/libdbusmenu-qt/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, qt4, cmake }:
+{ lib, stdenv, fetchurl, qt4, cmake }:
 
 let
   baseName = "libdbusmenu-qt";
@@ -20,7 +20,7 @@ stdenv.mkDerivation {
 
   cmakeFlags = [ "-DWITH_DOC=OFF" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Provides a Qt implementation of the DBusMenu spec";
     inherit homepage;
     inherit (qt4.meta) platforms;
diff --git a/pkgs/development/libraries/libdbusmenu-qt/qt-5.5.nix b/pkgs/development/libraries/libdbusmenu-qt/qt-5.5.nix
index d7eab29680927..5ce811e9fea24 100644
--- a/pkgs/development/libraries/libdbusmenu-qt/qt-5.5.nix
+++ b/pkgs/development/libraries/libdbusmenu-qt/qt-5.5.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchgit, cmake, qtbase }:
+{ lib, stdenv, fetchgit, cmake, qtbase }:
 
 stdenv.mkDerivation rec {
   pname = "libdbusmenu-qt";
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
 
   cmakeFlags = [ "-DWITH_DOC=OFF" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://launchpad.net/libdbusmenu-qt";
     description = "Provides a Qt implementation of the DBusMenu spec";
     maintainers = [ maintainers.ttuegel ];
diff --git a/pkgs/development/libraries/libdc1394/default.nix b/pkgs/development/libraries/libdc1394/default.nix
index 8a688ef37c6d4..a666eb3a650be 100644
--- a/pkgs/development/libraries/libdc1394/default.nix
+++ b/pkgs/development/libraries/libdc1394/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, libraw1394
+{ lib, stdenv, fetchurl, libraw1394
 , libusb1, CoreServices }:
 
 stdenv.mkDerivation rec {
@@ -11,10 +11,10 @@ stdenv.mkDerivation rec {
   };
 
   buildInputs = [ libusb1 ]
-    ++ stdenv.lib.optional stdenv.isLinux libraw1394
-    ++ stdenv.lib.optional stdenv.isDarwin CoreServices;
+    ++ lib.optional stdenv.isLinux libraw1394
+    ++ lib.optional stdenv.isDarwin CoreServices;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://sourceforge.net/projects/libdc1394/";
     description = "Capture and control API for IIDC compliant cameras";
     license = licenses.lgpl21Plus;
diff --git a/pkgs/development/libraries/libde265/default.nix b/pkgs/development/libraries/libde265/default.nix
index a398a6fab7280..bbbcdc3f05440 100644
--- a/pkgs/development/libraries/libde265/default.nix
+++ b/pkgs/development/libraries/libde265/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, autoreconfHook, pkg-config }:
+{ lib, stdenv, fetchFromGitHub, autoreconfHook, pkg-config }:
 
 stdenv.mkDerivation rec {
   version = "1.0.8";
@@ -18,9 +18,9 @@ stdenv.mkDerivation rec {
   meta = {
     homepage = "https://github.com/strukturag/libde265";
     description = "Open h.265 video codec implementation";
-    license = stdenv.lib.licenses.lgpl3;
-    platforms = stdenv.lib.platforms.unix;
-    maintainers = with stdenv.lib.maintainers; [ gebner ];
+    license = lib.licenses.lgpl3;
+    platforms = lib.platforms.unix;
+    maintainers = with lib.maintainers; [ gebner ];
   };
 
 }
diff --git a/pkgs/development/libraries/libdevil/default.nix b/pkgs/development/libraries/libdevil/default.nix
index b674087c75991..fa48c773dfc99 100644
--- a/pkgs/development/libraries/libdevil/default.nix
+++ b/pkgs/development/libraries/libdevil/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, libjpeg, libpng, libmng, lcms1, libtiff, openexr, libGL
+{ lib, stdenv, fetchurl, libjpeg, libpng, libmng, lcms1, libtiff, openexr, libGL
 , libX11, pkg-config, OpenGL
 }:
 
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
   outputs = [ "out" "dev" ];
 
   buildInputs = [ libjpeg libpng libmng lcms1 libtiff openexr libGL libX11 ]
-    ++ stdenv.lib.optionals stdenv.isDarwin [ OpenGL ];
+    ++ lib.optionals stdenv.isDarwin [ OpenGL ];
   nativeBuildInputs = [ pkg-config ];
 
   configureFlags = [ "--enable-ILU" "--enable-ILUT" ];
@@ -23,7 +23,7 @@ stdenv.mkDerivation rec {
   preConfigure = ''
     sed -i 's, -std=gnu99,,g' configure
     sed -i 's,malloc.h,stdlib.h,g' src-ILU/ilur/ilur.c
-  '' + stdenv.lib.optionalString stdenv.cc.isClang ''
+  '' + lib.optionalString stdenv.cc.isClang ''
     sed -i 's/libIL_la_CXXFLAGS = $(AM_CFLAGS)/libIL_la_CXXFLAGS =/g' lib/Makefile.in
   '';
 
@@ -49,7 +49,7 @@ stdenv.mkDerivation rec {
     done
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://openil.sourceforge.net/";
     description = "An image library which can can load, save, convert, manipulate, filter and display a wide variety of image formats";
     license = licenses.lgpl2;
diff --git a/pkgs/development/libraries/libdigidoc/default.nix b/pkgs/development/libraries/libdigidoc/default.nix
index 5936853dcbcb2..7ee268e4e7d97 100644
--- a/pkgs/development/libraries/libdigidoc/default.nix
+++ b/pkgs/development/libraries/libdigidoc/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, cmake, openssl, pcsclite, opensc, libxml2, Security }:
+{ lib, stdenv, fetchurl, cmake, openssl, pcsclite, opensc, libxml2, Security }:
 
 stdenv.mkDerivation rec {
 
@@ -13,11 +13,11 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ cmake ];
 
   buildInputs = [ openssl pcsclite opensc libxml2 ]
-    ++ stdenv.lib.optionals stdenv.isDarwin [ Security ];
+    ++ lib.optionals stdenv.isDarwin [ Security ];
 
-  cmakeFlags = stdenv.lib.optionals stdenv.isDarwin [ "-DFRAMEWORK=OFF" ];
+  cmakeFlags = lib.optionals stdenv.isDarwin [ "-DFRAMEWORK=OFF" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Library for creating DigiDoc signature files";
     homepage = "https://github.com/open-eid/libdigidoc";
     license = licenses.lgpl2;
diff --git a/pkgs/development/libraries/libdigidocpp/default.nix b/pkgs/development/libraries/libdigidocpp/default.nix
index ad0f5f50bf2c9..f7170fa7f103e 100644
--- a/pkgs/development/libraries/libdigidocpp/default.nix
+++ b/pkgs/development/libraries/libdigidocpp/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, cmake, libdigidoc, minizip, pcsclite, opensc, openssl
+{ lib, stdenv, fetchurl, cmake, libdigidoc, minizip, pcsclite, opensc, openssl
 , xercesc, xml-security-c, pkg-config, xsd, zlib, xalanc, xxd }:
 
 stdenv.mkDerivation rec {
@@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
     xml-security-c xsd zlib xalanc
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Library for creating DigiDoc signature files";
     homepage = "http://www.id.ee/";
     license = licenses.lgpl2;
diff --git a/pkgs/development/libraries/libdiscid/default.nix b/pkgs/development/libraries/libdiscid/default.nix
index bdfb5d8b3041b..3021aced93f6d 100644
--- a/pkgs/development/libraries/libdiscid/default.nix
+++ b/pkgs/development/libraries/libdiscid/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, cmake, pkg-config, darwin }:
+{ lib, stdenv, fetchurl, cmake, pkg-config, darwin }:
 
 stdenv.mkDerivation rec {
   pname = "libdiscid";
@@ -6,16 +6,16 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ cmake pkg-config ];
 
-  buildInputs = stdenv.lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.IOKit ];
+  buildInputs = lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.IOKit ];
 
   src = fetchurl {
     url = "http://ftp.musicbrainz.org/pub/musicbrainz/libdiscid/${pname}-${version}.tar.gz";
     sha256 = "1f9irlj3dpb5gyfdnb1m4skbjvx4d4hwiz2152f83m0d9jn47r7r";
   };
 
-  NIX_LDFLAGS = stdenv.lib.optionalString stdenv.isDarwin "-framework CoreFoundation -framework IOKit";
+  NIX_LDFLAGS = lib.optionalString stdenv.isDarwin "-framework CoreFoundation -framework IOKit";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A C library for creating MusicBrainz DiscIDs from audio CDs";
     homepage = "http://musicbrainz.org/doc/libdiscid";
     maintainers = with maintainers; [ ehmry ];
diff --git a/pkgs/development/libraries/libdivecomputer/default.nix b/pkgs/development/libraries/libdivecomputer/default.nix
index 5f9417bd03c8f..0f65a5cee5cec 100644
--- a/pkgs/development/libraries/libdivecomputer/default.nix
+++ b/pkgs/development/libraries/libdivecomputer/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
   pname = "libdivecomputer";
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://www.libdivecomputer.org";
     description = "A cross-platform and open source library for communication with dive computers from various manufacturers";
     maintainers = [ maintainers.mguentner ];
diff --git a/pkgs/development/libraries/libdivsufsort/default.nix b/pkgs/development/libraries/libdivsufsort/default.nix
index 0d82db7cee4e5..0f332f8ac74c6 100644
--- a/pkgs/development/libraries/libdivsufsort/default.nix
+++ b/pkgs/development/libraries/libdivsufsort/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl}:
+{lib, stdenv, fetchurl}:
 
 stdenv.mkDerivation {
   name = "libdivsufsort-2.0.1";
@@ -10,8 +10,8 @@ stdenv.mkDerivation {
 
   meta = {
     homepage = "https://github.com/y-256/libdivsufsort";
-    license = stdenv.lib.licenses.mit;
+    license = lib.licenses.mit;
     description = "Library to construct the suffix array and the BW transformed string";
-    platforms = stdenv.lib.platforms.unix;
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/libdmtx/default.nix b/pkgs/development/libraries/libdmtx/default.nix
index bd23b6831a0ca..994f010252fdc 100644
--- a/pkgs/development/libraries/libdmtx/default.nix
+++ b/pkgs/development/libraries/libdmtx/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config }:
+{ lib, stdenv, fetchurl, pkg-config }:
 
 stdenv.mkDerivation rec {
   name = "libdmtx-0.7.4";
@@ -13,8 +13,8 @@ stdenv.mkDerivation rec {
   meta = {
     description = "An open source software for reading and writing Data Matrix barcodes";
     homepage = "http://libdmtx.org";
-    platforms = stdenv.lib.platforms.all;
+    platforms = lib.platforms.all;
     maintainers = [ ];
-    license = stdenv.lib.licenses.bsd2;
+    license = lib.licenses.bsd2;
   };
 }
diff --git a/pkgs/development/libraries/libdnet/default.nix b/pkgs/development/libraries/libdnet/default.nix
index 176e0a22abafc..43d9d2077fe32 100644
--- a/pkgs/development/libraries/libdnet/default.nix
+++ b/pkgs/development/libraries/libdnet/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, automake, autoconf, libtool}:
+{lib, stdenv, fetchurl, automake, autoconf, libtool}:
 
 stdenv.mkDerivation {
   name = "libdnet-1.12";
@@ -22,8 +22,8 @@ stdenv.mkDerivation {
   meta = {
     description = "Provides a simplified, portable interface to several low-level networking routines";
     homepage = "https://github.com/dugsong/libdnet";
-    license = stdenv.lib.licenses.bsd3;
-    maintainers = [stdenv.lib.maintainers.marcweber];
-    platforms = stdenv.lib.platforms.linux;
+    license = lib.licenses.bsd3;
+    maintainers = [lib.maintainers.marcweber];
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/development/libraries/libdv/default.nix b/pkgs/development/libraries/libdv/default.nix
index ed1e2cd74a3b5..ff3c7f6f86313 100644
--- a/pkgs/development/libraries/libdv/default.nix
+++ b/pkgs/development/libraries/libdv/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, popt }:
+{ lib, stdenv, fetchurl, popt }:
 
 stdenv.mkDerivation rec {
   name = "libdv-1.0.0";
@@ -10,7 +10,7 @@ stdenv.mkDerivation rec {
 
   # This fixes an undefined symbol: _sched_setscheduler error on compile.
   # See the apple docs: http://cl.ly/2HeF bottom of the "Finding Imported Symbols" section
-  LDFLAGS = stdenv.lib.optionalString stdenv.isDarwin "-undefined dynamic_lookup";
+  LDFLAGS = lib.optionalString stdenv.isDarwin "-undefined dynamic_lookup";
 
   configureFlags = [
     "--disable-asm"
@@ -22,7 +22,7 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ popt ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Software decoder for DV format video, as defined by the IEC 61834 and SMPTE 314M standards";
     homepage = "https://sourceforge.net/projects/libdv/";
     license = licenses.lgpl21Plus;
diff --git a/pkgs/development/libraries/libdvbpsi/default.nix b/pkgs/development/libraries/libdvbpsi/default.nix
index 327aacb6f37e0..5d539a7a48829 100644
--- a/pkgs/development/libraries/libdvbpsi/default.nix
+++ b/pkgs/development/libraries/libdvbpsi/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl}:
+{lib, stdenv, fetchurl}:
 
 stdenv.mkDerivation rec {
   pname = "libdvbpsi";
@@ -12,8 +12,8 @@ stdenv.mkDerivation rec {
   meta = {
     description = "A simple library designed for decoding and generation of MPEG TS and DVB PSI tables according to standards ISO/IEC 13818 and ITU-T H.222.0";
     homepage = "http://www.videolan.org/developers/libdvbpsi.html";
-    platforms = stdenv.lib.platforms.unix;
-    license = stdenv.lib.licenses.lgpl21;
+    platforms = lib.platforms.unix;
+    license = lib.licenses.lgpl21;
   };
 
 }
diff --git a/pkgs/development/libraries/libdvdcss/default.nix b/pkgs/development/libraries/libdvdcss/default.nix
index f097aad702aeb..278e3d60d906e 100644
--- a/pkgs/development/libraries/libdvdcss/default.nix
+++ b/pkgs/development/libraries/libdvdcss/default.nix
@@ -1,17 +1,17 @@
-{stdenv, fetchurl, IOKit}:
+{lib, stdenv, fetchurl, IOKit}:
 
 stdenv.mkDerivation rec {
   pname = "libdvdcss";
   version = "1.4.2";
 
-  buildInputs = stdenv.lib.optional stdenv.isDarwin IOKit;
+  buildInputs = lib.optional stdenv.isDarwin IOKit;
 
   src = fetchurl {
     url = "http://get.videolan.org/libdvdcss/${version}/${pname}-${version}.tar.bz2";
     sha256 = "0x957zzpf4w2cp8zlk29prj8i2q6hay3lzdzsyz8y3cwxivyvhkq";
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://www.videolan.org/developers/libdvdcss.html";
     description = "A library for decrypting DVDs";
     license = licenses.gpl2;
diff --git a/pkgs/development/libraries/libdvdnav/4.2.1.nix b/pkgs/development/libraries/libdvdnav/4.2.1.nix
index f5264587a16f2..1f832de5bb3bd 100644
--- a/pkgs/development/libraries/libdvdnav/4.2.1.nix
+++ b/pkgs/development/libraries/libdvdnav/4.2.1.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, pkg-config, libdvdread}:
+{lib, stdenv, fetchurl, pkg-config, libdvdread}:
 
 stdenv.mkDerivation {
   name = "libdvdnav-4.2.1";
@@ -20,9 +20,9 @@ stdenv.mkDerivation {
   meta = {
     homepage = "http://dvdnav.mplayerhq.hu/";
     description = "A library that implements DVD navigation features such as DVD menus";
-    license = stdenv.lib.licenses.gpl2;
-    maintainers = [ stdenv.lib.maintainers.wmertens ];
-    platforms = stdenv.lib.platforms.linux;
+    license = lib.licenses.gpl2;
+    maintainers = [ lib.maintainers.wmertens ];
+    platforms = lib.platforms.linux;
   };
 
   passthru = { inherit libdvdread; };
diff --git a/pkgs/development/libraries/libdvdnav/default.nix b/pkgs/development/libraries/libdvdnav/default.nix
index 5f26b943537e2..3eb1032b2a79c 100644
--- a/pkgs/development/libraries/libdvdnav/default.nix
+++ b/pkgs/development/libraries/libdvdnav/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, pkg-config, libdvdread}:
+{lib, stdenv, fetchurl, pkg-config, libdvdread}:
 
 stdenv.mkDerivation rec {
   pname = "libdvdnav";
@@ -15,9 +15,9 @@ stdenv.mkDerivation rec {
   meta = {
     homepage = "http://dvdnav.mplayerhq.hu/";
     description = "A library that implements DVD navigation features such as DVD menus";
-    license = stdenv.lib.licenses.gpl2;
-    maintainers = [ stdenv.lib.maintainers.wmertens ];
-    platforms = stdenv.lib.platforms.unix;
+    license = lib.licenses.gpl2;
+    maintainers = [ lib.maintainers.wmertens ];
+    platforms = lib.platforms.unix;
   };
 
   passthru = { inherit libdvdread; };
diff --git a/pkgs/development/libraries/libdvdread/4.9.9.nix b/pkgs/development/libraries/libdvdread/4.9.9.nix
index 7f35c651b9293..7049e1dd99358 100644
--- a/pkgs/development/libraries/libdvdread/4.9.9.nix
+++ b/pkgs/development/libraries/libdvdread/4.9.9.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, libdvdcss}:
+{lib, stdenv, fetchurl, libdvdcss}:
 
 stdenv.mkDerivation {
   name = "libdvdread-4.9.9";
@@ -19,8 +19,8 @@ stdenv.mkDerivation {
   meta = {
     homepage = "http://dvdnav.mplayerhq.hu/";
     description = "A library for reading DVDs";
-    license = stdenv.lib.licenses.gpl2;
-    maintainers = [ stdenv.lib.maintainers.wmertens ];
-    platforms = stdenv.lib.platforms.linux;
+    license = lib.licenses.gpl2;
+    maintainers = [ lib.maintainers.wmertens ];
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/development/libraries/libdvdread/default.nix b/pkgs/development/libraries/libdvdread/default.nix
index 997018a29709f..32dfe4ee0fa5c 100644
--- a/pkgs/development/libraries/libdvdread/default.nix
+++ b/pkgs/development/libraries/libdvdread/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, libdvdcss}:
+{lib, stdenv, fetchurl, libdvdcss}:
 
 stdenv.mkDerivation rec {
   pname = "libdvdread";
@@ -20,8 +20,8 @@ stdenv.mkDerivation rec {
   meta = {
     homepage = "http://dvdnav.mplayerhq.hu/";
     description = "A library for reading DVDs";
-    license = stdenv.lib.licenses.gpl2;
-    maintainers = [ stdenv.lib.maintainers.wmertens ];
-    platforms = with stdenv.lib.platforms; linux ++ darwin;
+    license = lib.licenses.gpl2;
+    maintainers = [ lib.maintainers.wmertens ];
+    platforms = with lib.platforms; linux ++ darwin;
   };
 }
diff --git a/pkgs/development/libraries/libdwarf/default.nix b/pkgs/development/libraries/libdwarf/default.nix
index ba4ebaec111a3..0d512b04201aa 100644
--- a/pkgs/development/libraries/libdwarf/default.nix
+++ b/pkgs/development/libraries/libdwarf/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, libelf, zlib }:
+{ lib, stdenv, fetchurl, libelf, zlib }:
 
 let
   version = "20181024";
@@ -11,8 +11,8 @@ let
   };
   meta = {
     homepage = "https://www.prevanders.net/dwarf.html";
-    platforms = stdenv.lib.platforms.linux;
-    license = stdenv.lib.licenses.lgpl21Plus;
+    platforms = lib.platforms.linux;
+    license = lib.licenses.lgpl21Plus;
   };
 
 in rec {
diff --git a/pkgs/development/libraries/libdwg/default.nix b/pkgs/development/libraries/libdwg/default.nix
index 9b1aa3132e93a..5a0347e59542a 100644
--- a/pkgs/development/libraries/libdwg/default.nix
+++ b/pkgs/development/libraries/libdwg/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, indent}:
+{lib, stdenv, fetchurl, indent}:
 
 stdenv.mkDerivation {
   name = "libdwg-0.6";
@@ -18,8 +18,8 @@ stdenv.mkDerivation {
   meta = {
     description = "Library reading dwg files";
     homepage = "http://libdwg.sourceforge.net/en/";
-    license = stdenv.lib.licenses.gpl3;
-    maintainers = [stdenv.lib.maintainers.marcweber];
-    platforms = stdenv.lib.platforms.linux;
+    license = lib.licenses.gpl3;
+    maintainers = [lib.maintainers.marcweber];
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/development/libraries/libdynd/default.nix b/pkgs/development/libraries/libdynd/default.nix
index 2450ac6a9ea08..4f1fd3904d98d 100644
--- a/pkgs/development/libraries/libdynd/default.nix
+++ b/pkgs/development/libraries/libdynd/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake }:
+{ lib, stdenv, fetchFromGitHub, cmake }:
 
 let version = "0.7.2"; in
 stdenv.mkDerivation {
@@ -31,7 +31,7 @@ stdenv.mkDerivation {
   outputs = [ "out" "dev" ];
   outputDoc = "dev";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "C++ dynamic ndarray library, with Python exposure";
     homepage = "http://libdynd.org";
     license = licenses.bsd2;
diff --git a/pkgs/development/libraries/libe-book/default.nix b/pkgs/development/libraries/libe-book/default.nix
index 96b341dceae90..5575d8b2c5ec2 100644
--- a/pkgs/development/libraries/libe-book/default.nix
+++ b/pkgs/development/libraries/libe-book/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, gperf, pkg-config, librevenge, libxml2, boost, icu
+{ lib, stdenv, fetchurl, gperf, pkg-config, librevenge, libxml2, boost, icu
 , cppunit, zlib, liblangtag
 }:
 
@@ -34,8 +34,8 @@ stdenv.mkDerivation {
   meta = {
     inherit (s) version;
     description = ''Library for import of reflowable e-book formats'';
-    license = stdenv.lib.licenses.lgpl21Plus ;
-    maintainers = [stdenv.lib.maintainers.raskin];
-    platforms = stdenv.lib.platforms.unix;
+    license = lib.licenses.lgpl21Plus ;
+    maintainers = [lib.maintainers.raskin];
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/libe57format/default.nix b/pkgs/development/libraries/libe57format/default.nix
index 137c73990f6ab..49b75906bdbc2 100644
--- a/pkgs/development/libraries/libe57format/default.nix
+++ b/pkgs/development/libraries/libe57format/default.nix
@@ -1,5 +1,5 @@
 {
-  stdenv,
+  lib, stdenv,
   cmake,
   fetchFromGitHub,
   boost,
@@ -78,7 +78,7 @@ stdenv.mkDerivation rec {
     fi
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Library for reading & writing the E57 file format (fork of E57RefImpl)";
     homepage = "https://github.com/asmaloney/libE57Format";
     license = licenses.boost;
diff --git a/pkgs/development/libraries/libeatmydata/default.nix b/pkgs/development/libraries/libeatmydata/default.nix
index da7a186bea6fc..70fab2da56884 100644
--- a/pkgs/development/libraries/libeatmydata/default.nix
+++ b/pkgs/development/libraries/libeatmydata/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, autoreconfHook, strace, which }:
+{ lib, stdenv, fetchFromGitHub, autoreconfHook, strace, which }:
 
 stdenv.mkDerivation rec {
   pname = "libeatmydata";
@@ -24,7 +24,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [
     autoreconfHook
-  ] ++ stdenv.lib.optionals doCheck [ strace which ];
+  ] ++ lib.optionals doCheck [ strace which ];
 
   # while we can *build* in parallel, the tests also run in parallel which does
   # not work with v105. Later versions (unreleased) have a fix for that. The
@@ -32,7 +32,7 @@ stdenv.mkDerivation rec {
   enableParallelBuilding = true;
   doCheck = false;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Small LD_PRELOAD library to disable fsync and friends";
     homepage = "https://www.flamingspork.com/projects/libeatmydata/";
     license = licenses.gpl3Plus;
diff --git a/pkgs/development/libraries/libeb/default.nix b/pkgs/development/libraries/libeb/default.nix
index 2fdb1d071b625..fe0011f9c9973 100644
--- a/pkgs/development/libraries/libeb/default.nix
+++ b/pkgs/development/libraries/libeb/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, perl, zlib }:
+{ lib, stdenv, fetchurl, perl, zlib }:
 stdenv.mkDerivation rec {
   pname = "libeb";
   version = "4.4.3";
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ perl ];
   buildInputs = [ zlib ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "C library for accessing Japanese CD-ROM books";
     longDescription = ''
       The EB library is a library for accessing CD-ROM books, which are a
diff --git a/pkgs/development/libraries/libebml/default.nix b/pkgs/development/libraries/libebml/default.nix
index 4d8d2c10b6752..5a8f1f003165b 100644
--- a/pkgs/development/libraries/libebml/default.nix
+++ b/pkgs/development/libraries/libebml/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, pkg-config }:
+{ lib, stdenv, fetchFromGitHub, cmake, pkg-config }:
 
 stdenv.mkDerivation rec {
   pname = "libebml";
@@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
     "-DBUILD_SHARED_LIBS=YES"
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Extensible Binary Meta Language library";
     homepage = "https://dl.matroska.org/downloads/libebml/";
     license = licenses.lgpl21;
diff --git a/pkgs/development/libraries/libebur128/default.nix b/pkgs/development/libraries/libebur128/default.nix
index e349af41bcb59..ba4f84f8c803c 100644
--- a/pkgs/development/libraries/libebur128/default.nix
+++ b/pkgs/development/libraries/libebur128/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, speexdsp, pkg-config }:
+{ lib, stdenv, fetchFromGitHub, cmake, speexdsp, pkg-config }:
 
 stdenv.mkDerivation rec {
   version = "1.2.4";
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ cmake pkg-config ];
   buildInputs = [ speexdsp ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Implementation of the EBU R128 loudness standard";
     homepage = "https://github.com/jiixyj/libebur128";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/libechonest/default.nix b/pkgs/development/libraries/libechonest/default.nix
index 957daf7dc4124..29a0a63a03e7f 100644
--- a/pkgs/development/libraries/libechonest/default.nix
+++ b/pkgs/development/libraries/libechonest/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, fetchpatch, cmake, doxygen, qt4, qjson }:
+{ lib, stdenv, fetchFromGitHub, fetchpatch, cmake, doxygen, qt4, qjson }:
 
 stdenv.mkDerivation rec {
   pname = "libechonest";
@@ -30,7 +30,7 @@ stdenv.mkDerivation rec {
   meta = {
     description = "A C++/Qt wrapper around the Echo Nest API";
     homepage = "https://projects.kde.org/projects/playground/libs/libechonest";
-    license = stdenv.lib.licenses.gpl2Plus;
-    platforms = stdenv.lib.platforms.unix;
+    license = lib.licenses.gpl2Plus;
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/libedit/default.nix b/pkgs/development/libraries/libedit/default.nix
index 09bd41dbed0b6..92f3eeb799571 100644
--- a/pkgs/development/libraries/libedit/default.nix
+++ b/pkgs/development/libraries/libedit/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, ncurses }:
+{ lib, stdenv, fetchurl, ncurses }:
 
 stdenv.mkDerivation rec {
   pname = "libedit";
@@ -23,7 +23,7 @@ stdenv.mkDerivation rec {
       -e 's,-lncurses[a-z]*,-L${ncurses.out}/lib -lncursesw,g'
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://www.thrysoee.dk/editline/";
     description = "A port of the NetBSD Editline library (libedit)";
     license = licenses.bsd3;
diff --git a/pkgs/development/libraries/libee/default.nix b/pkgs/development/libraries/libee/default.nix
index e8ffa37379e2b..7172df01e2232 100644
--- a/pkgs/development/libraries/libee/default.nix
+++ b/pkgs/development/libraries/libee/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, libestr }:
+{ lib, stdenv, fetchurl, pkg-config, libestr }:
 stdenv.mkDerivation {
   name = "libee-0.4.1";
 
@@ -13,7 +13,7 @@ stdenv.mkDerivation {
   meta = {
     homepage = "http://www.libee.org/";
     description = "An Event Expression Library inspired by CEE";
-    platforms = stdenv.lib.platforms.unix;
-    license = stdenv.lib.licenses.lgpl21Plus;
+    platforms = lib.platforms.unix;
+    license = lib.licenses.lgpl21Plus;
   };
 }
diff --git a/pkgs/development/libraries/libelf-freebsd/default.nix b/pkgs/development/libraries/libelf-freebsd/default.nix
index 6350705120736..c3a4986c83214 100644
--- a/pkgs/development/libraries/libelf-freebsd/default.nix
+++ b/pkgs/development/libraries/libelf-freebsd/default.nix
@@ -6,7 +6,7 @@ stdenv.mkDerivation (rec {
 
   src = fetchsvn {
     url = "svn://svn.code.sf.net/p/elftoolchain/code/trunk";
-    rev = (stdenv.lib.strings.toInt version);
+    rev = (lib.strings.toInt version);
     name = "elftoolchain-${version}";
   };
 
@@ -29,9 +29,9 @@ stdenv.mkDerivation (rec {
 
     homepage = "https://sourceforge.net/p/elftoolchain/wiki/Home/";
 
-    license = stdenv.lib.licenses.bsd2;
+    license = lib.licenses.bsd2;
 
-    platforms = stdenv.lib.platforms.freebsd;
+    platforms = lib.platforms.freebsd;
     maintainers = [ ];
   };
 })
diff --git a/pkgs/development/libraries/libelf/default.nix b/pkgs/development/libraries/libelf/default.nix
index 2b56f973b5db6..2b8cd51ba5f6c 100644
--- a/pkgs/development/libraries/libelf/default.nix
+++ b/pkgs/development/libraries/libelf/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl, autoreconfHook, gettext
 }:
 
@@ -27,26 +27,26 @@ stdenv.mkDerivation rec {
   configureFlags = []
        # Configure check for dynamic lib support is broken, see
        # http://lists.uclibc.org/pipermail/uclibc-cvs/2005-August/019383.html
-    ++ stdenv.lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) "mr_cv_target_elf=yes"
+    ++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) "mr_cv_target_elf=yes"
        # Libelf's custom NLS macros fail to determine the catalog file extension
        # on Darwin, so disable NLS for now.
-    ++ stdenv.lib.optional stdenv.hostPlatform.isDarwin "--disable-nls";
+    ++ lib.optional stdenv.hostPlatform.isDarwin "--disable-nls";
 
   nativeBuildInputs = [ gettext ]
        # Need to regenerate configure script with newer version in order to pass
        # "mr_cv_target_elf=yes", but `autoreconfHook` brings in `makeWrapper`
        # which doesn't work with the bootstrapTools bash, so can only do this
        # for cross builds when `stdenv.shell` is a newer bash.
-    ++ stdenv.lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) autoreconfHook;
+    ++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) autoreconfHook;
 
   meta = {
     description = "ELF object file access library";
 
     homepage = "https://github.com/Distrotech/libelf";
 
-    license = stdenv.lib.licenses.lgpl2Plus;
+    license = lib.licenses.lgpl2Plus;
 
-    platforms = stdenv.lib.platforms.all;
+    platforms = lib.platforms.all;
     maintainers = [ ];
   };
 }
diff --git a/pkgs/development/libraries/libelfin/default.nix b/pkgs/development/libraries/libelfin/default.nix
index 8a8de854fc901..950639850db52 100644
--- a/pkgs/development/libraries/libelfin/default.nix
+++ b/pkgs/development/libraries/libelfin/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, python3, substituteAll }:
+{ lib, stdenv, fetchFromGitHub, python3, substituteAll }:
 
 stdenv.mkDerivation rec {
   pname = "libelfin";
@@ -22,7 +22,7 @@ stdenv.mkDerivation rec {
 
   makeFlags = [ "PREFIX=${placeholder "out"}" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/aclements/libelfin/";
     license = licenses.mit;
     description = "C++11 ELF/DWARF parser";
diff --git a/pkgs/development/libraries/libepc/default.nix b/pkgs/development/libraries/libepc/default.nix
index 54520116129ee..ee8dfb6e94f79 100644
--- a/pkgs/development/libraries/libepc/default.nix
+++ b/pkgs/development/libraries/libepc/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, intltool, gtk-doc, glib, avahi, gnutls, libuuid, libsoup, gtk3, gnome3 }:
+{ lib, stdenv, fetchurl, pkg-config, intltool, gtk-doc, glib, avahi, gnutls, libuuid, libsoup, gtk3, gnome3 }:
 
 let
   avahiWithGtk = avahi.override { gtk3Support = true; };
@@ -9,7 +9,7 @@ in stdenv.mkDerivation rec {
   outputs = [ "out" "dev" "devdoc" ];
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "1s3svb2slqjsrqfv50c2ymnqcijcxb5gnx6bfibwh9l5ga290n91";
   };
 
@@ -37,7 +37,7 @@ in stdenv.mkDerivation rec {
     };
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Easy Publish and Consume Library";
     homepage = "https://wiki.gnome.org/Projects/libepc";
     license = licenses.lgpl21Plus;
diff --git a/pkgs/development/libraries/liberfa/default.nix b/pkgs/development/libraries/liberfa/default.nix
index a1ca15536da63..8ffd86cd3169e 100644
--- a/pkgs/development/libraries/liberfa/default.nix
+++ b/pkgs/development/libraries/liberfa/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, autoreconfHook }:
+{ lib, stdenv, fetchFromGitHub, autoreconfHook }:
 
 stdenv.mkDerivation rec {
   pname = "erfa";
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
 
   configureFlags = [ "--enable-shared" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Essential Routines for Fundamental Astronomy";
     homepage = "https://github.com/liberfa/erfa";
     maintainers = with maintainers; [ mir06 ];
diff --git a/pkgs/development/libraries/liberio/default.nix b/pkgs/development/libraries/liberio/default.nix
index b4023d5f36a91..7a40c1a83da55 100644
--- a/pkgs/development/libraries/liberio/default.nix
+++ b/pkgs/development/libraries/liberio/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , autoreconfHook
 , systemd
@@ -27,7 +27,7 @@ stdenv.mkDerivation rec {
 
   doCheck = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Ettus Research DMA I/O Library";
     homepage = "https://github.com/EttusResearch/liberio";
     license = licenses.gpl2;
diff --git a/pkgs/development/libraries/libesmtp/default.nix b/pkgs/development/libraries/libesmtp/default.nix
index e5a7f5609a38c..542cff712c82c 100644
--- a/pkgs/development/libraries/libesmtp/default.nix
+++ b/pkgs/development/libraries/libesmtp/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation {
   pname = "libESMTP";
@@ -9,7 +9,7 @@ stdenv.mkDerivation {
     sha256 = "02zbniyz7qys1jmx3ghx21kxmns1wc3hmv80gp7ag7yra9f1m9nh";
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://brianstafford.info/libesmtp/index.html";
     description = "A Library for Posting Electronic Mail";
     license = licenses.lgpl21;
diff --git a/pkgs/development/libraries/libestr/default.nix b/pkgs/development/libraries/libestr/default.nix
index add7ea00a980d..8699e83d0fd03 100644
--- a/pkgs/development/libraries/libestr/default.nix
+++ b/pkgs/development/libraries/libestr/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
   name = "libestr-0.1.11";
@@ -8,7 +8,7 @@ stdenv.mkDerivation rec {
     sha256 = "0910ifzcs8kpd3srrr4fvbacgh2zrc6yn7i4rwfj6jpzhlkjnqs6";
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://libestr.adiscon.com/";
     description = "Some essentials for string handling";
     license = licenses.lgpl21;
diff --git a/pkgs/development/libraries/libev/default.nix b/pkgs/development/libraries/libev/default.nix
index 9f950ebb09c06..750cb3974cf75 100644
--- a/pkgs/development/libraries/libev/default.nix
+++ b/pkgs/development/libraries/libev/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl
+{ lib, stdenv, fetchurl
 , # Note: -static hasn’t work on darwin
   static ? with stdenv.hostPlatform; isStatic && !isDarwin
 }:
@@ -17,12 +17,12 @@ stdenv.mkDerivation rec {
     sha256 = "1sjs4324is7fp21an4aas2z4dwsvs6z4xwrmp72vwpq1s6wbfzjh";
   };
 
-  configureFlags = stdenv.lib.optional (static) "LDFLAGS=-static";
+  configureFlags = lib.optional (static) "LDFLAGS=-static";
 
   meta = {
     description = "A high-performance event loop/event model with lots of features";
-    maintainers = [ stdenv.lib.maintainers.raskin ];
-    platforms = stdenv.lib.platforms.all;
-    license = stdenv.lib.licenses.bsd2; # or GPL2+
+    maintainers = [ lib.maintainers.raskin ];
+    platforms = lib.platforms.all;
+    license = lib.licenses.bsd2; # or GPL2+
   };
 }
diff --git a/pkgs/development/libraries/libevdev/default.nix b/pkgs/development/libraries/libevdev/default.nix
index ba846ed07db2e..daae6984ab25d 100644
--- a/pkgs/development/libraries/libevdev/default.nix
+++ b/pkgs/development/libraries/libevdev/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, fetchpatch, python3 }:
+{ lib, stdenv, fetchurl, fetchpatch, python3 }:
 
 stdenv.mkDerivation rec {
   pname = "libevdev";
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ python3 ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Wrapper library for evdev devices";
     homepage = "http://www.freedesktop.org/software/libevdev/doc/latest/index.html";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/libevdevplus/default.nix b/pkgs/development/libraries/libevdevplus/default.nix
index d094bc3514225..66c5f1b06964f 100644
--- a/pkgs/development/libraries/libevdevplus/default.nix
+++ b/pkgs/development/libraries/libevdevplus/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, pkg-config }:
+{ lib, stdenv, fetchFromGitHub, cmake, pkg-config }:
 
 stdenv.mkDerivation rec {
   pname = "libevdevplus";
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ cmake pkg-config ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     inherit (src.meta) homepage;
     description = "Easy-to-use event device library in C++";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/libevent/default.nix b/pkgs/development/libraries/libevent/default.nix
index cbde320671721..b33e94114f639 100644
--- a/pkgs/development/libraries/libevent/default.nix
+++ b/pkgs/development/libraries/libevent/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, findutils, fixDarwinDylibNames
+{ lib, stdenv, fetchurl, findutils, fixDarwinDylibNames
 , sslSupport? true, openssl
 }:
 
@@ -16,25 +16,25 @@ stdenv.mkDerivation rec {
   # libevent_openssl is moved into its own output, so that openssl isn't present
   # in the default closure.
   outputs = [ "out" "dev" ]
-    ++ stdenv.lib.optional sslSupport "openssl"
+    ++ lib.optional sslSupport "openssl"
     ;
   outputBin = "dev";
   propagatedBuildOutputs = [ "out" ]
-    ++ stdenv.lib.optional sslSupport "openssl"
+    ++ lib.optional sslSupport "openssl"
     ;
 
   nativeBuildInputs = []
-    ++ stdenv.lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames
+    ++ lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames
     ;
 
   buildInputs = []
-    ++ stdenv.lib.optional sslSupport openssl
-    ++ stdenv.lib.optional stdenv.isCygwin findutils
+    ++ lib.optional sslSupport openssl
+    ++ lib.optional stdenv.isCygwin findutils
     ;
 
   doCheck = false; # needs the net
 
-  postInstall = stdenv.lib.optionalString sslSupport ''
+  postInstall = lib.optionalString sslSupport ''
     moveToOutput "lib/libevent_openssl*" "$openssl"
     substituteInPlace "$dev/lib/pkgconfig/libevent_openssl.pc" \
       --replace "$out" "$openssl"
@@ -43,7 +43,7 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Event notification library";
     longDescription = ''
       The libevent API provides a mechanism to execute a callback function
diff --git a/pkgs/development/libraries/libewf/default.nix b/pkgs/development/libraries/libewf/default.nix
index 759c0e40adca9..b2246905456ec 100644
--- a/pkgs/development/libraries/libewf/default.nix
+++ b/pkgs/development/libraries/libewf/default.nix
@@ -1,4 +1,4 @@
-{ fetchurl, stdenv, zlib, openssl, libuuid, pkg-config }:
+{ fetchurl, lib, stdenv, zlib, openssl, libuuid, pkg-config }:
 
 stdenv.mkDerivation rec {
   version = "20201129";
@@ -15,9 +15,9 @@ stdenv.mkDerivation rec {
   meta = {
     description = "Library for support of the Expert Witness Compression Format";
     homepage = "https://sourceforge.net/projects/libewf/";
-    license = stdenv.lib.licenses.lgpl3;
-    maintainers = [ stdenv.lib.maintainers.raskin ] ;
-    platforms = stdenv.lib.platforms.unix;
+    license = lib.licenses.lgpl3;
+    maintainers = [ lib.maintainers.raskin ] ;
+    platforms = lib.platforms.unix;
     inherit version;
   };
 }
diff --git a/pkgs/development/libraries/libexecinfo/default.nix b/pkgs/development/libraries/libexecinfo/default.nix
index feee754590b67..f3f89209707a6 100644
--- a/pkgs/development/libraries/libexecinfo/default.nix
+++ b/pkgs/development/libraries/libexecinfo/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, fetchpatch
+{ lib, stdenv, fetchurl, fetchpatch
 , enableStatic ? true
 , enableShared ? !stdenv.hostPlatform.isStatic
 }:
@@ -33,21 +33,21 @@ stdenv.mkDerivation rec {
   makeFlags = [ "CC:=$(CC)" "AR:=$(AR)" ];
 
   buildFlags =
-      stdenv.lib.optional enableStatic "static"
-   ++ stdenv.lib.optional enableShared "dynamic";
+      lib.optional enableStatic "static"
+   ++ lib.optional enableShared "dynamic";
 
   patchFlags = [ "-p0" ];
 
   installPhase = ''
     install -Dm644 execinfo.h stacktraverse.h -t $out/include
-  '' + stdenv.lib.optionalString enableShared ''
+  '' + lib.optionalString enableShared ''
     install -Dm755 libexecinfo.so.1 -t $out/lib
     ln -s $out/lib/libexecinfo.so{.1,}
-  '' + stdenv.lib.optionalString enableStatic ''
+  '' + lib.optionalString enableStatic ''
     install -Dm755 libexecinfo.a -t $out/lib
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Quick-n-dirty BSD licensed clone of the GNU libc backtrace facility";
     license = licenses.bsd2;
     homepage = "https://www.freshports.org/devel/libexecinfo";
diff --git a/pkgs/development/libraries/libexif/default.nix b/pkgs/development/libraries/libexif/default.nix
index a0f831e927eff..20e69c4ad6641 100644
--- a/pkgs/development/libraries/libexif/default.nix
+++ b/pkgs/development/libraries/libexif/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, fetchpatch, autoreconfHook, gettext }:
+{ lib, stdenv, fetchFromGitHub, fetchpatch, autoreconfHook, gettext }:
 
 stdenv.mkDerivation rec {
   pname = "libexif";
@@ -27,7 +27,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ autoreconfHook gettext ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://libexif.github.io/";
     description = "A library to read and manipulate EXIF data in digital photographs";
     license = licenses.lgpl21;
diff --git a/pkgs/development/libraries/libextractor/default.nix b/pkgs/development/libraries/libextractor/default.nix
index 68c4fe807b394..59916bfb33f77 100644
--- a/pkgs/development/libraries/libextractor/default.nix
+++ b/pkgs/development/libraries/libextractor/default.nix
@@ -1,4 +1,4 @@
-{ fetchurl, stdenv, substituteAll
+{ fetchurl, lib, stdenv, substituteAll
 , libtool, gettext, zlib, bzip2, flac, libvorbis
 , exiv2, libgsf, rpm, pkg-config, fetchpatch
 , gstreamerSupport ? true, gst_all_1 ? null
@@ -41,12 +41,12 @@ stdenv.mkDerivation rec {
       sha256 = "01xhcjbzv6p53wz7y2ii76kb8m9iwvnm4ip9w4a0bpgaxqz4b9fw";
       excludes = [ "ChangeLog" ];
     })
-  ] ++ stdenv.lib.optionals gstreamerSupport [
+  ] ++ lib.optionals gstreamerSupport [
 
     # Libraries cannot be wrapped so we need to hardcode the plug-in paths.
     (substituteAll {
       src = ./gst-hardcode-plugins.patch;
-      load_gst_plugins = stdenv.lib.concatMapStrings
+      load_gst_plugins = lib.concatMapStrings
         (plugin: ''gst_registry_scan_path(gst_registry_get(), "${plugin}/lib/gstreamer-1.0");'')
         (gstPlugins gst_all_1);
     })
@@ -62,10 +62,10 @@ stdenv.mkDerivation rec {
    [ libtool gettext zlib bzip2 flac libvorbis exiv2
      libgsf rpm
      pkg-config
-   ] ++ stdenv.lib.optionals gstreamerSupport
+   ] ++ lib.optionals gstreamerSupport
           ([ gst_all_1.gstreamer ] ++ gstPlugins gst_all_1)
-     ++ stdenv.lib.optionals gtkSupport [ glib gtk3 ]
-     ++ stdenv.lib.optionals videoSupport [ ffmpeg_3 libmpeg2 ];
+     ++ lib.optionals gtkSupport [ glib gtk3 ]
+     ++ lib.optionals videoSupport [ ffmpeg_3 libmpeg2 ];
 
   configureFlags = [
     "--disable-ltdl-install"
@@ -105,9 +105,9 @@ stdenv.mkDerivation rec {
          additional MIME types are detected.
       '';
 
-    license = stdenv.lib.licenses.gpl2Plus;
+    license = lib.licenses.gpl2Plus;
 
     maintainers = [ ];
-    platforms = stdenv.lib.platforms.linux;
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/development/libraries/libexttextcat/default.nix b/pkgs/development/libraries/libexttextcat/default.nix
index 3adb606dd2d5c..8e5cc8685da93 100644
--- a/pkgs/development/libraries/libexttextcat/default.nix
+++ b/pkgs/development/libraries/libexttextcat/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
   name = "libexttextcat-3.4.5";
@@ -8,7 +8,7 @@ stdenv.mkDerivation rec {
     sha256 = "1j6sjwkyhqvsgyw938bxxfwkzzi1mahk66g5342lv6j89jfvrz8k";
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "An N-Gram-Based Text Categorization library primarily intended for language guessing";
     homepage = "https://wiki.documentfoundation.org/Libexttextcat";
     platforms = platforms.all;
diff --git a/pkgs/development/libraries/libf2c/default.nix b/pkgs/development/libraries/libf2c/default.nix
index 66b193d4ea8da..85ff493ca04e2 100644
--- a/pkgs/development/libraries/libf2c/default.nix
+++ b/pkgs/development/libraries/libf2c/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, unzip}:
+{lib, stdenv, fetchurl, unzip}:
 
 stdenv.mkDerivation rec {
   name = "libf2c-20160102";
@@ -29,7 +29,7 @@ stdenv.mkDerivation rec {
   meta = {
     description = "F2c converts Fortran 77 source code to C";
     homepage = "http://www.netlib.org/f2c/";
-    license = stdenv.lib.licenses.mit;
-    platforms = stdenv.lib.platforms.unix;
+    license = lib.licenses.mit;
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/libfakekey/default.nix b/pkgs/development/libraries/libfakekey/default.nix
index 4e7cc1df06909..3e568759c1bcb 100644
--- a/pkgs/development/libraries/libfakekey/default.nix
+++ b/pkgs/development/libraries/libfakekey/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, libX11, libXi, libXtst, pkg-config, xorgproto }:
+{ lib, stdenv, fetchurl, libX11, libXi, libXtst, pkg-config, xorgproto }:
 
 stdenv.mkDerivation rec {
   pname = "libfakekey";
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
   buildInputs = [ libX11 libXi libXtst xorgproto ];
   NIX_LDFLAGS = "-lX11";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "X virtual keyboard library";
     homepage = "https://www.yoctoproject.org/tools-resources/projects/matchbox";
     license = licenses.gpl2;
diff --git a/pkgs/development/libraries/libfaketime/default.nix b/pkgs/development/libraries/libfaketime/default.nix
index 6c751e07b831c..170bb116a8a88 100644
--- a/pkgs/development/libraries/libfaketime/default.nix
+++ b/pkgs/development/libraries/libfaketime/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, perl }:
+{ lib, stdenv, fetchurl, perl }:
 
 stdenv.mkDerivation rec {
   pname = "libfaketime";
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
 
   patches = [
     ./no-date-in-gzip-man-page.patch
-  ] ++ (stdenv.lib.optionals stdenv.cc.isClang [
+  ] ++ (lib.optionals stdenv.cc.isClang [
     # https://github.com/wolfcw/libfaketime/issues/277
     ./0001-Remove-unsupported-clang-flags.patch
   ]);
@@ -27,11 +27,11 @@ stdenv.mkDerivation rec {
   PREFIX = placeholder "out";
   LIBDIRNAME = "/lib";
 
-  NIX_CFLAGS_COMPILE = stdenv.lib.optionalString stdenv.cc.isClang "-Wno-error=cast-function-type -Wno-error=format-truncation";
+  NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isClang "-Wno-error=cast-function-type -Wno-error=format-truncation";
 
   checkInputs = [ perl ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Report faked system time to programs without having to change the system-wide time";
     homepage = "https://github.com/wolfcw/libfaketime/";
     license = licenses.gpl2;
diff --git a/pkgs/development/libraries/libff/default.nix b/pkgs/development/libraries/libff/default.nix
index 874f45cae709b..72d2406aa82bb 100644
--- a/pkgs/development/libraries/libff/default.nix
+++ b/pkgs/development/libraries/libff/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, boost, gmp, openssl, pkg-config }:
+{ lib, stdenv, fetchFromGitHub, cmake, boost, gmp, openssl, pkg-config }:
 
 stdenv.mkDerivation rec {
   pname = "libff";
@@ -16,14 +16,14 @@ stdenv.mkDerivation rec {
 
   # CMake is hardcoded to always build static library which causes linker
   # failure for Haskell applications depending on haskellPackages.hevm on macOS.
-  postPatch = stdenv.lib.optionalString stdenv.isDarwin ''
+  postPatch = lib.optionalString stdenv.isDarwin ''
     substituteInPlace libff/CMakeLists.txt --replace "STATIC" "SHARED"
   '';
 
   nativeBuildInputs = [ cmake pkg-config ];
   buildInputs = [ boost gmp openssl ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "C++ library for Finite Fields and Elliptic Curves";
     changelog = "https://github.com/scipr-lab/libff/blob/develop/CHANGELOG.md";
     homepage = "https://github.com/scipr-lab/libff";
diff --git a/pkgs/development/libraries/libffcall/default.nix b/pkgs/development/libraries/libffcall/default.nix
index 7fdc04d116ef1..8967ec49a0946 100644
--- a/pkgs/development/libraries/libffcall/default.nix
+++ b/pkgs/development/libraries/libffcall/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
   pname = "libffcall";
@@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
     rm -rf $out/share
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Foreign function call library";
     homepage = "https://www.gnu.org/software/libffcall/";
     license = licenses.gpl2Plus;
diff --git a/pkgs/development/libraries/libffi/default.nix b/pkgs/development/libraries/libffi/default.nix
index d7dad6d956d7d..29b76e34d652a 100644
--- a/pkgs/development/libraries/libffi/default.nix
+++ b/pkgs/development/libraries/libffi/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, fetchpatch
+{ lib, stdenv, fetchurl, fetchpatch
 , autoreconfHook
 
 }:
@@ -32,7 +32,7 @@ stdenv.mkDerivation rec {
 
   dontStrip = stdenv.hostPlatform != stdenv.buildPlatform; # Don't run the native `strip' when cross-compiling.
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A foreign function call interface library";
     longDescription = ''
       The libffi library provides a portable, high level programming
diff --git a/pkgs/development/libraries/libfido2/default.nix b/pkgs/development/libraries/libfido2/default.nix
index 75b483de6ac5d..f44ae4d01f244 100644
--- a/pkgs/development/libraries/libfido2/default.nix
+++ b/pkgs/development/libraries/libfido2/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , fetchpatch
 , cmake
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ cmake pkg-config ];
 
   buildInputs = [ hidapi libcbor openssl ]
-    ++ stdenv.lib.optionals stdenv.isLinux [ udev ];
+    ++ lib.optionals stdenv.isLinux [ udev ];
 
   cmakeFlags = [
     "-DUDEV_RULES_DIR=${placeholder "out"}/etc/udev/rules.d"
@@ -28,7 +28,7 @@ stdenv.mkDerivation rec {
     "-DCMAKE_INSTALL_LIBDIR=lib"
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = ''
     Provides library functionality for FIDO 2.0, including communication with a device over USB.
     '';
diff --git a/pkgs/development/libraries/libfilezilla/default.nix b/pkgs/development/libraries/libfilezilla/default.nix
index c9be4c6ba7f7e..fd7bce1c30ffb 100644
--- a/pkgs/development/libraries/libfilezilla/default.nix
+++ b/pkgs/development/libraries/libfilezilla/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , autoreconfHook
 , gettext
@@ -21,11 +21,11 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ autoreconfHook pkg-config ];
 
   buildInputs = [ gettext gnutls nettle ]
-    ++ stdenv.lib.optionals stdenv.isDarwin [ libiconv ApplicationServices ];
+    ++ lib.optionals stdenv.isDarwin [ libiconv ApplicationServices ];
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://lib.filezilla-project.org/";
     description = "A modern C++ library, offering some basic functionality to build high-performing, platform-independent programs";
     license = licenses.gpl2Plus;
diff --git a/pkgs/development/libraries/libfishsound/default.nix b/pkgs/development/libraries/libfishsound/default.nix
index 6b931105415ac..72dc298671158 100644
--- a/pkgs/development/libraries/libfishsound/default.nix
+++ b/pkgs/development/libraries/libfishsound/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, libvorbis, speex, flac, pkg-config }:
+{ lib, stdenv, fetchurl, libvorbis, speex, flac, pkg-config }:
 
 stdenv.mkDerivation rec {
   name = "libfishsound-1.0.0";
@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ pkg-config ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://xiph.org/fishsound/";
     description = "A simple programming interface for decoding and encoding audio data using Xiph.org codecs (FLAC, Speex and Vorbis)";
     longDescription = ''libfishsound by itself is designed to handle raw codec streams from a lower level layer such as UDP datagrams. When these codecs are used in files, they are commonly encapsulated in Ogg to produce Ogg FLAC, Speex and Ogg Vorbis files.
diff --git a/pkgs/development/libraries/libfixposix/default.nix b/pkgs/development/libraries/libfixposix/default.nix
index 2c0ba2dcc3c72..d8659b9e15f08 100644
--- a/pkgs/development/libraries/libfixposix/default.nix
+++ b/pkgs/development/libraries/libfixposix/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, autoreconfHook, pkg-config }:
+{ lib, stdenv, fetchFromGitHub, autoreconfHook, pkg-config }:
 
 stdenv.mkDerivation rec {
   pname = "libfixposix";
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ autoreconfHook pkg-config ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/sionescu/libfixposix";
     description = "Thin wrapper over POSIX syscalls and some replacement functionality";
     license = licenses.boost;
diff --git a/pkgs/development/libraries/libfm/default.nix b/pkgs/development/libraries/libfm/default.nix
index 163a633df5c2a..dc83592412575 100644
--- a/pkgs/development/libraries/libfm/default.nix
+++ b/pkgs/development/libraries/libfm/default.nix
@@ -1,9 +1,9 @@
-{ stdenv, fetchurl, glib, intltool, menu-cache, pango, pkg-config, vala
+{ lib, stdenv, fetchurl, glib, intltool, menu-cache, pango, pkg-config, vala
 , extraOnly ? false
 , withGtk3 ? false, gtk2, gtk3 }:
 let
     gtk = if withGtk3 then gtk3 else gtk2;
-    inherit (stdenv.lib) optional;
+    inherit (lib) optional;
 in
 stdenv.mkDerivation rec {
   name = if extraOnly
@@ -35,7 +35,7 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://blog.lxde.org/category/pcmanfm/";
     license = licenses.lgpl21Plus;
     description = "A glib-based library for file management";
diff --git a/pkgs/development/libraries/libfprint/default.nix b/pkgs/development/libraries/libfprint/default.nix
index 2464679ac8a50..f3f7313accbbe 100644
--- a/pkgs/development/libraries/libfprint/default.nix
+++ b/pkgs/development/libraries/libfprint/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitLab
 , pkg-config
 , meson
@@ -50,7 +50,7 @@ stdenv.mkDerivation rec {
     "-Dudev_rules_dir=${placeholder "out"}/lib/udev/rules.d"
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://fprint.freedesktop.org/";
     description = "A library designed to make it easy to add support for consumer fingerprint readers";
     license = licenses.lgpl21;
diff --git a/pkgs/development/libraries/libfpx/default.nix b/pkgs/development/libraries/libfpx/default.nix
index 52c64ed8629c6..2576d426af555 100644
--- a/pkgs/development/libraries/libfpx/default.nix
+++ b/pkgs/development/libraries/libfpx/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, fetchpatch }:
+{ lib, stdenv, fetchurl, fetchpatch }:
 
 stdenv.mkDerivation rec {
   name = "libfpx-1.3.1-7";
@@ -9,7 +9,7 @@ stdenv.mkDerivation rec {
   };
 
   # Darwin gets misdetected as Windows without this
-  NIX_CFLAGS_COMPILE = stdenv.lib.optionalString stdenv.isDarwin "-D__unix";
+  NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isDarwin "-D__unix";
 
   patches = [
     (fetchpatch {
@@ -23,7 +23,7 @@ stdenv.mkDerivation rec {
     substituteInPlace jpeg/ejpeg.h --replace "int No_JPEG_Header_Flag" ""
   '' else null;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://www.imagemagick.org";
     description = "A library for manipulating FlashPIX images";
     license = "Flashpix";
diff --git a/pkgs/development/libraries/libfreefare/default.nix b/pkgs/development/libraries/libfreefare/default.nix
index d9c0e10dad660..9fd8c1e6b6131 100644
--- a/pkgs/development/libraries/libfreefare/default.nix
+++ b/pkgs/development/libraries/libfreefare/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, libnfc, openssl
+{ lib, stdenv, fetchurl, pkg-config, libnfc, openssl
 , libobjc ? null }:
 
 stdenv.mkDerivation {
@@ -11,9 +11,9 @@ stdenv.mkDerivation {
   };
 
   nativeBuildInputs = [ pkg-config ];
-  buildInputs = [ libnfc openssl ] ++ stdenv.lib.optional stdenv.isDarwin libobjc;
+  buildInputs = [ libnfc openssl ] ++ lib.optional stdenv.isDarwin libobjc;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "The libfreefare project aims to provide a convenient API for MIFARE card manipulations";
     license = licenses.lgpl3;
     homepage = "https://github.com/nfc-tools/libfreefare";
diff --git a/pkgs/development/libraries/libfsm/default.nix b/pkgs/development/libraries/libfsm/default.nix
index 5edfd622347e1..5e3c40da82c7a 100644
--- a/pkgs/development/libraries/libfsm/default.nix
+++ b/pkgs/development/libraries/libfsm/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub
+{ lib, stdenv, fetchFromGitHub
 , bmake
 }:
 
@@ -47,7 +47,7 @@ stdenv.mkDerivation rec {
 
   outputs = [ "out" "lib" "dev" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "DFA regular expression library & friends";
     homepage    = "https://github.com/katef/libfsm";
     license     = licenses.bsd2;
diff --git a/pkgs/development/libraries/libftdi/1.x.nix b/pkgs/development/libraries/libftdi/1.x.nix
index 6c128e2947f0e..ae599a97529bf 100644
--- a/pkgs/development/libraries/libftdi/1.x.nix
+++ b/pkgs/development/libraries/libftdi/1.x.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, cmake, pkg-config, libusb1, libconfuse
+{ lib, stdenv, fetchurl, cmake, pkg-config, libusb1, libconfuse
 , cppSupport ? true, boost ? null
 , pythonSupport ? true, python3 ? null, swig ? null
 , docSupport ? true, doxygen ? null
@@ -17,12 +17,12 @@ stdenv.mkDerivation rec {
   };
 
   nativeBuildInputs = [ cmake pkg-config ];
-  buildInputs = with stdenv.lib; [ libconfuse ]
+  buildInputs = with lib; [ libconfuse ]
     ++ optionals cppSupport [ boost ]
     ++ optionals pythonSupport [ python3 swig ]
     ++ optionals docSupport [ doxygen ];
 
-  preBuild = stdenv.lib.optionalString docSupport ''
+  preBuild = lib.optionalString docSupport ''
     make doc_i
   '';
 
@@ -32,12 +32,12 @@ stdenv.mkDerivation rec {
     mkdir -p "$out/etc/udev/rules.d/"
     cp ../packages/99-libftdi.rules "$out/etc/udev/rules.d/"
     cp -r doc/man "$out/share/"
-  '' + stdenv.lib.optionalString docSupport ''
+  '' + lib.optionalString docSupport ''
     mkdir -p "$out/share/libftdi/doc/"
     cp -r doc/html "$out/share/libftdi/doc/"
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A library to talk to FTDI chips using libusb";
     homepage = "https://www.intra2net.com/en/developer/libftdi/";
     license = with licenses; [ lgpl2 gpl2 ];
diff --git a/pkgs/development/libraries/libfyaml/default.nix b/pkgs/development/libraries/libfyaml/default.nix
index 5ce8cd6c6a1dd..69b7bdc7d1e19 100644
--- a/pkgs/development/libraries/libfyaml/default.nix
+++ b/pkgs/development/libraries/libfyaml/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, gnum4 }:
+{ lib, stdenv, fetchurl, gnum4 }:
 
 stdenv.mkDerivation rec {
   pname = "libfyaml";
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ gnum4 ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/pantoniou/libfyaml";
     description = "Fully feature complete YAML parser and emitter, supporting the latest YAML spec and passing the full YAML testsuite";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/libgadu/default.nix b/pkgs/development/libraries/libgadu/default.nix
index 4e9ce765b9638..10705a2c164d9 100644
--- a/pkgs/development/libraries/libgadu/default.nix
+++ b/pkgs/development/libraries/libgadu/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, zlib}:
+{lib, stdenv, fetchurl, zlib}:
 
 stdenv.mkDerivation {
 
@@ -14,8 +14,8 @@ stdenv.mkDerivation {
   meta = {
     description = "A library to deal with gadu-gadu protocol (most popular polish IM protocol)";
     homepage = "http://toxygen.net/libgadu/";
-    platforms = stdenv.lib.platforms.linux;
-    license = stdenv.lib.licenses.lgpl21;
+    platforms = lib.platforms.linux;
+    license = lib.licenses.lgpl21;
   };
 
 }
diff --git a/pkgs/development/libraries/libgaminggear/default.nix b/pkgs/development/libraries/libgaminggear/default.nix
index 2d79a1b64dc5b..f059d6c73a2fd 100644
--- a/pkgs/development/libraries/libgaminggear/default.nix
+++ b/pkgs/development/libraries/libgaminggear/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, cmake, pkg-config, gettext
+{ lib, stdenv, fetchurl, cmake, pkg-config, gettext
 , gtk2, libcanberra, libnotify, pcre, sqlite, xorg
 , harfbuzz
 }:
@@ -36,7 +36,7 @@ stdenv.mkDerivation rec {
   meta = {
     description = "Provides functionality for gaming input devices";
     homepage = "https://sourceforge.net/projects/libgaminggear/";
-    platforms = stdenv.lib.platforms.linux;
-    license = stdenv.lib.licenses.gpl2Plus;
+    platforms = lib.platforms.linux;
+    license = lib.licenses.gpl2Plus;
   };
 }
diff --git a/pkgs/development/libraries/libgcrypt/1.5.nix b/pkgs/development/libraries/libgcrypt/1.5.nix
index 9de5cf2d2d1bd..f90ea502c406a 100644
--- a/pkgs/development/libraries/libgcrypt/1.5.nix
+++ b/pkgs/development/libraries/libgcrypt/1.5.nix
@@ -10,7 +10,7 @@ stdenv.mkDerivation rec {
     sha256 = "0ydy7bgra5jbq9mxl5x031nif3m6y3balc6ndw2ngj11wnsjc61h";
   };
 
-  patches = stdenv.lib.optionals stdenv.isDarwin [
+  patches = lib.optionals stdenv.isDarwin [
     (fetchpatch {
       name = "fix-x86_64-apple-darwin.patch";
       sha256 = "138sfwl1avpy19320dbd63mskspc1khlc93j1f1zmylxx3w19csi";
@@ -26,13 +26,13 @@ stdenv.mkDerivation rec {
   # Also make sure includes are fixed for callers who don't use libgpgcrypt-config
   postInstall = ''
     sed -i 's,#include <gpg-error.h>,#include "${libgpgerror.dev}/include/gpg-error.h",g' $out/include/gcrypt.h
-  '' + stdenv.lib.optionalString enableCapabilities ''
+  '' + lib.optionalString enableCapabilities ''
     sed -i 's,\(-lcap\),-L${libcap.lib}/lib \1,' $out/lib/libgcrypt.la
   '';
 
   doCheck = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://www.gnu.org/software/libgcrypt/";
     description = "General-pupose cryptographic library";
     license = licenses.lgpl2Plus;
diff --git a/pkgs/development/libraries/libgcrypt/default.nix b/pkgs/development/libraries/libgcrypt/default.nix
index cd529cb06ee60..6c6d73740f209 100644
--- a/pkgs/development/libraries/libgcrypt/default.nix
+++ b/pkgs/development/libraries/libgcrypt/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, gettext, libgpgerror, enableCapabilities ? false, libcap
+{ lib, stdenv, fetchurl, gettext, libgpgerror, enableCapabilities ? false, libcap
 , buildPackages
 }:
 
@@ -19,16 +19,16 @@ stdenv.mkDerivation rec {
   # The CPU Jitter random number generator must not be compiled with
   # optimizations and the optimize -O0 pragma only works for gcc.
   # The build enables -O2 by default for everything else.
-  hardeningDisable = stdenv.lib.optional stdenv.cc.isClang "fortify";
+  hardeningDisable = lib.optional stdenv.cc.isClang "fortify";
 
   depsBuildBuild = [ buildPackages.stdenv.cc ];
 
   buildInputs = [ libgpgerror ]
-    ++ stdenv.lib.optional stdenv.isDarwin gettext
-    ++ stdenv.lib.optional enableCapabilities libcap;
+    ++ lib.optional stdenv.isDarwin gettext
+    ++ lib.optional enableCapabilities libcap;
 
   configureFlags = [ "--with-libgpg-error-prefix=${libgpgerror.dev}" ]
-   ++ stdenv.lib.optional stdenv.hostPlatform.isMusl "--disable-asm";
+   ++ lib.optional stdenv.hostPlatform.isMusl "--disable-asm";
 
   # Necessary to generate correct assembly when compiling for aarch32 on
   # aarch64
@@ -43,20 +43,20 @@ stdenv.mkDerivation rec {
   # Also make sure includes are fixed for callers who don't use libgpgcrypt-config
   postFixup = ''
     sed -i 's,#include <gpg-error.h>,#include "${libgpgerror.dev}/include/gpg-error.h",g' "$dev/include/gcrypt.h"
-  '' + stdenv.lib.optionalString enableCapabilities ''
+  '' + lib.optionalString enableCapabilities ''
     sed -i 's,\(-lcap\),-L${libcap.lib}/lib \1,' $out/lib/libgcrypt.la
   '';
 
   # TODO: figure out why this is even necessary and why the missing dylib only crashes
   # random instead of every test
-  preCheck = stdenv.lib.optionalString stdenv.isDarwin ''
+  preCheck = lib.optionalString stdenv.isDarwin ''
     mkdir -p $out/lib
     cp src/.libs/libgcrypt.20.dylib $out/lib
   '';
 
   doCheck = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://www.gnu.org/software/libgcrypt/";
     description = "General-purpose cryptographic library";
     license = licenses.lgpl2Plus;
diff --git a/pkgs/development/libraries/libgda/default.nix b/pkgs/development/libraries/libgda/default.nix
index 3f8e6f01b34bf..73e71de4aac63 100644
--- a/pkgs/development/libraries/libgda/default.nix
+++ b/pkgs/development/libraries/libgda/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, intltool, itstool, libxml2, gtk3, openssl, gnome3, gobject-introspection, vala, libgee
+{ lib, stdenv, fetchurl, pkg-config, intltool, itstool, libxml2, gtk3, openssl, gnome3, gobject-introspection, vala, libgee
 , overrideCC, gcc6, fetchpatch, autoreconfHook, gtk-doc, autoconf-archive, yelp-tools
 , mysqlSupport ? false, libmysqlclient ? null
 , postgresSupport ? false, postgresql ? null
@@ -12,7 +12,7 @@ assert postgresSupport -> postgresql != null;
   version = "5.2.10";
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "1j1l4dwjgw6w4d1v4bl5a4kwyj7bcih8mj700ywm7xakh1xxyv3g";
   };
 
@@ -24,7 +24,7 @@ assert postgresSupport -> postgresql != null;
     })
   ];
 
-  configureFlags = with stdenv.lib; [
+  configureFlags = with lib; [
     "--with-mysql=${if mysqlSupport then "yes" else "no"}"
     "--with-postgres=${if postgresSupport then "yes" else "no"}"
 
@@ -41,7 +41,7 @@ assert postgresSupport -> postgresql != null;
   hardeningDisable = [ "format" ];
 
   nativeBuildInputs = [ pkg-config intltool itstool libxml2 gobject-introspection vala autoreconfHook gtk-doc autoconf-archive yelp-tools ];
-  buildInputs = with stdenv.lib; [ gtk3 openssl libgee ]
+  buildInputs = with lib; [ gtk3 openssl libgee ]
     ++ optional (mysqlSupport) libmysqlclient
     ++ optional (postgresSupport) postgresql;
 
@@ -51,7 +51,7 @@ assert postgresSupport -> postgresql != null;
     };
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Database access library";
     homepage = "https://www.gnome-db.org/";
     license = [ licenses.lgpl2 licenses.gpl2 ];
diff --git a/pkgs/development/libraries/libgdamm/default.nix b/pkgs/development/libraries/libgdamm/default.nix
index ea0484f710e8e..44a0e8bc21213 100644
--- a/pkgs/development/libraries/libgdamm/default.nix
+++ b/pkgs/development/libraries/libgdamm/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, glibmm, libgda, libxml2, gnome3
+{ lib, stdenv, fetchurl, pkg-config, glibmm, libgda, libxml2, gnome3
 , mysqlSupport ? false
 , postgresSupport ? false }:
 
@@ -13,7 +13,7 @@ in stdenv.mkDerivation rec {
   outputs = [ "out" "dev" ];
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "1fyh15b3f8hmwbswalxk1g4l04yvvybksn5nm7gznn5jl5q010p9";
   };
 
@@ -29,7 +29,7 @@ in stdenv.mkDerivation rec {
     };
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "C++ bindings for libgda";
     homepage = "https://www.gnome-db.org/";
     license = licenses.lgpl21Plus;
diff --git a/pkgs/development/libraries/libgdata/default.nix b/pkgs/development/libraries/libgdata/default.nix
index 9c8ea6bb1c0f8..86e3f4274fcf8 100644
--- a/pkgs/development/libraries/libgdata/default.nix
+++ b/pkgs/development/libraries/libgdata/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , pkg-config
 , meson
@@ -26,7 +26,7 @@ stdenv.mkDerivation rec {
   outputs = [ "out" "dev" "installedTests" ];
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "0bj7ij6k3lxjn62jgh8vabr8vfjs48aylnnl3779warw5iwyzfga";
   };
 
@@ -76,7 +76,7 @@ stdenv.mkDerivation rec {
     };
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "GData API library";
     homepage = "https://wiki.gnome.org/Projects/libgdata";
     maintainers = with maintainers; [ raskin lethalman ] ++ teams.gnome.members;
diff --git a/pkgs/development/libraries/libgdiplus/default.nix b/pkgs/development/libraries/libgdiplus/default.nix
index 4a518818e8b09..705205df396c9 100644
--- a/pkgs/development/libraries/libgdiplus/default.nix
+++ b/pkgs/development/libraries/libgdiplus/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, pkg-config, glib, cairo, Carbon, fontconfig
+{ lib, stdenv, fetchFromGitHub, pkg-config, glib, cairo, Carbon, fontconfig
 , libtiff, giflib, libjpeg, libpng
 , libXrender, libexif, autoreconfHook, fetchpatch }:
 
@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ autoreconfHook pkg-config ];
 
-  configureFlags = stdenv.lib.optional stdenv.cc.isClang "--host=${stdenv.hostPlatform.system}";
+  configureFlags = lib.optional stdenv.cc.isClang "--host=${stdenv.hostPlatform.system}";
 
   enableParallelBuilding = true;
 
@@ -29,9 +29,9 @@ stdenv.mkDerivation rec {
     [ glib cairo fontconfig libtiff giflib
       libjpeg libpng libXrender libexif
     ]
-    ++ stdenv.lib.optional stdenv.isDarwin Carbon;
+    ++ lib.optional stdenv.isDarwin Carbon;
 
-  postInstall = stdenv.lib.optionalString stdenv.isDarwin ''
+  postInstall = lib.optionalString stdenv.isDarwin ''
     ln -s $out/lib/libgdiplus.0.dylib $out/lib/libgdiplus.so
   '';
 
@@ -39,7 +39,7 @@ stdenv.mkDerivation rec {
     make check -w
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Mono library that provides a GDI+-compatible API on non-Windows operating systems";
     homepage = "https://www.mono-project.com/docs/gui/libgdiplus/";
     platforms = platforms.unix;
diff --git a/pkgs/development/libraries/libgee/default.nix b/pkgs/development/libraries/libgee/default.nix
index a531a433a8808..407b99b5a57bb 100644
--- a/pkgs/development/libraries/libgee/default.nix
+++ b/pkgs/development/libraries/libgee/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, autoconf, vala, pkg-config, glib, gobject-introspection, gnome3 }:
+{ lib, stdenv, fetchurl, autoconf, vala, pkg-config, glib, gobject-introspection, gnome3 }:
 
 stdenv.mkDerivation rec {
   pname = "libgee";
@@ -7,7 +7,7 @@ stdenv.mkDerivation rec {
   outputs = [ "out" "dev" ];
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "1pm525wm11dhwz24m8bpcln9547lmrigl6cxf3qsbg4cr3pyvdfh";
   };
 
@@ -25,7 +25,7 @@ stdenv.mkDerivation rec {
     };
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Utility library providing GObject-based interfaces and classes for commonly used data structures";
     homepage = "https://wiki.gnome.org/Projects/Libgee";
     license = licenses.lgpl21Plus;
diff --git a/pkgs/development/libraries/libgeotiff/default.nix b/pkgs/development/libraries/libgeotiff/default.nix
index 1b973fd5eeeb3..eb35d5316c0e4 100644
--- a/pkgs/development/libraries/libgeotiff/default.nix
+++ b/pkgs/development/libraries/libgeotiff/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, libtiff, libjpeg, proj, zlib, autoreconfHook }:
+{ lib, stdenv, fetchFromGitHub, libtiff, libjpeg, proj, zlib, autoreconfHook }:
 
 stdenv.mkDerivation rec {
   version = "1.5.1";
@@ -29,8 +29,8 @@ stdenv.mkDerivation rec {
   meta = {
     description = "Library implementing attempt to create a tiff based interchange format for georeferenced raster imagery";
     homepage = "https://github.com/OSGeo/libgeotiff";
-    license = stdenv.lib.licenses.mit;
-    maintainers = [stdenv.lib.maintainers.marcweber];
-    platforms = with stdenv.lib.platforms; linux ++ darwin;
+    license = lib.licenses.mit;
+    maintainers = [lib.maintainers.marcweber];
+    platforms = with lib.platforms; linux ++ darwin;
   };
 }
diff --git a/pkgs/development/libraries/libgepub/default.nix b/pkgs/development/libraries/libgepub/default.nix
index abd73ea5b75fb..e058c7ed5af3d 100644
--- a/pkgs/development/libraries/libgepub/default.nix
+++ b/pkgs/development/libraries/libgepub/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, meson, ninja, pkg-config, glib, gobject-introspection, gnome3
+{ lib, stdenv, fetchurl, meson, ninja, pkg-config, glib, gobject-introspection, gnome3
 , webkitgtk, libsoup, libxml2, libarchive }:
 
 stdenv.mkDerivation rec {
@@ -6,7 +6,7 @@ stdenv.mkDerivation rec {
   version = "0.6.0";
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "16dkyywqdnfngmwsgbyga0kl9vcnzczxi3lmhm27pifrq5f3k2n7";
   };
 
@@ -22,7 +22,7 @@ stdenv.mkDerivation rec {
     };
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "GObject based library for handling and rendering epub documents";
     license = licenses.lgpl21Plus;
     platforms = platforms.linux;
diff --git a/pkgs/development/libraries/libgig/default.nix b/pkgs/development/libraries/libgig/default.nix
index baa9917cad2b1..f78a51db5de64 100644
--- a/pkgs/development/libraries/libgig/default.nix
+++ b/pkgs/development/libraries/libgig/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, autoconf, automake, libsndfile, libtool, pkg-config, libuuid }:
+{ lib, stdenv, fetchurl, autoconf, automake, libsndfile, libtool, pkg-config, libuuid }:
 
 stdenv.mkDerivation rec {
   pname = "libgig";
@@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://www.linuxsampler.org";
     description = "Gigasampler file access library";
     license = licenses.gpl2;
diff --git a/pkgs/development/libraries/libgit2-glib/default.nix b/pkgs/development/libraries/libgit2-glib/default.nix
index b07b5b9124905..fe36a9d663f39 100644
--- a/pkgs/development/libraries/libgit2-glib/default.nix
+++ b/pkgs/development/libraries/libgit2-glib/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, gnome3, meson, ninja, pkg-config, vala, libssh2
+{ lib, stdenv, fetchurl, gnome3, meson, ninja, pkg-config, vala, libssh2
 , gtk-doc, gobject-introspection, libgit2, glib, python3 }:
 
 stdenv.mkDerivation rec {
@@ -6,7 +6,7 @@ stdenv.mkDerivation rec {
   version = "0.99.0.1";
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "1pmrcnsa7qdda73c3dxf47733mwprmj5ljpw3acxbj6r8k27anp0";
   };
 
@@ -38,7 +38,7 @@ stdenv.mkDerivation rec {
     python3.pkgs.pygobject3 # this should really be a propagated input of python output
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A glib wrapper library around the libgit2 git access library";
     homepage = "https://wiki.gnome.org/Projects/Libgit2-glib";
     license = licenses.lgpl21;
diff --git a/pkgs/development/libraries/libgksu/default.nix b/pkgs/development/libraries/libgksu/default.nix
index 8c9905a4287c7..cf8f5ab487864 100644
--- a/pkgs/development/libraries/libgksu/default.nix
+++ b/pkgs/development/libraries/libgksu/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, wrapGAppsHook, gtk2, gnome2, gnome3,
+{ lib, stdenv, fetchurl, pkg-config, wrapGAppsHook, gtk2, gnome2, gnome3,
   libstartup_notification, libgtop, perlPackages,
   autoreconfHook, intltool, docbook_xsl, xauth
 }:
@@ -79,8 +79,8 @@ stdenv.mkDerivation rec {
       programs in an X session.
     '';
     homepage = "https://www.nongnu.org/gksu/";
-    license = stdenv.lib.licenses.lgpl2;
-    maintainers = [ stdenv.lib.maintainers.romildo ];
-    platforms = stdenv.lib.platforms.linux;
+    license = lib.licenses.lgpl2;
+    maintainers = [ lib.maintainers.romildo ];
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/development/libraries/libglvnd/default.nix b/pkgs/development/libraries/libglvnd/default.nix
index 92783d3ae0c1d..88ba7dacc22f1 100644
--- a/pkgs/development/libraries/libglvnd/default.nix
+++ b/pkgs/development/libraries/libglvnd/default.nix
@@ -32,7 +32,7 @@ stdenv.mkDerivation rec {
   ] ++ lib.optional stdenv.cc.isClang "-Wno-error");
 
   # Indirectly: https://bugs.freedesktop.org/show_bug.cgi?id=35268
-  configureFlags  = stdenv.lib.optional stdenv.hostPlatform.isMusl "--disable-tls";
+  configureFlags  = lib.optional stdenv.hostPlatform.isMusl "--disable-tls";
 
   outputs = [ "out" "dev" ];
 
@@ -45,7 +45,7 @@ stdenv.mkDerivation rec {
 
   passthru = { inherit (addOpenGLRunpath) driverLink; };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "The GL Vendor-Neutral Dispatch library";
     homepage = "https://github.com/NVIDIA/libglvnd";
     license = licenses.bsd2;
diff --git a/pkgs/development/libraries/libgnome-keyring/default.nix b/pkgs/development/libraries/libgnome-keyring/default.nix
index fbb2499f24a69..3f5a5961ba0fe 100644
--- a/pkgs/development/libraries/libgnome-keyring/default.nix
+++ b/pkgs/development/libraries/libgnome-keyring/default.nix
@@ -1,11 +1,11 @@
-{ stdenv, fetchurl, glib, dbus, libgcrypt, pkg-config, intltool }:
+{ lib, stdenv, fetchurl, glib, dbus, libgcrypt, pkg-config, intltool }:
 
 stdenv.mkDerivation rec {
   pname = "libgnome-keyring";
   version = "2.32.0";
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.bz2";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.bz2";
     sha256 = "030gka96kzqg1r19b4xrmac89hf1xj1kr5p461yvbzfxh46qqf2n";
   };
 
@@ -17,6 +17,6 @@ stdenv.mkDerivation rec {
   meta = {
     inherit (glib.meta) platforms maintainers;
     homepage = "https://wiki.gnome.org/Projects/GnomeKeyring";
-    license = with stdenv.lib.licenses; [ gpl2 lgpl2 ];
+    license = with lib.licenses; [ gpl2 lgpl2 ];
   };
 }
diff --git a/pkgs/development/libraries/libgnomekbd/default.nix b/pkgs/development/libraries/libgnomekbd/default.nix
index 17adb362cdb86..62228b8837a8a 100644
--- a/pkgs/development/libraries/libgnomekbd/default.nix
+++ b/pkgs/development/libraries/libgnomekbd/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, file, intltool, glib, gtk3, libxklavier, wrapGAppsHook, gnome3 }:
+{ lib, stdenv, fetchurl, pkg-config, file, intltool, glib, gtk3, libxklavier, wrapGAppsHook, gnome3 }:
 
 stdenv.mkDerivation rec {
   pname = "libgnomekbd";
@@ -7,7 +7,7 @@ stdenv.mkDerivation rec {
   outputs = [ "out" "dev" ];
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "0y962ykn3rr9gylj0pwpww7bi20lmhvsw6qvxs5bisbn2mih5jpp";
   };
 
@@ -29,7 +29,7 @@ stdenv.mkDerivation rec {
     glib
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Keyboard management library";
     maintainers = teams.gnome.members;
     license = licenses.gpl2;
diff --git a/pkgs/development/libraries/libgnurl/default.nix b/pkgs/development/libraries/libgnurl/default.nix
index e7e16d769e7ac..a7d91d0c81ad4 100644
--- a/pkgs/development/libraries/libgnurl/default.nix
+++ b/pkgs/development/libraries/libgnurl/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, libtool, groff, perl, pkg-config, python2, zlib, gnutls,
+{ lib, stdenv, fetchurl, libtool, groff, perl, pkg-config, python2, zlib, gnutls,
   libidn2, libunistring, nghttp2 }:
 
 stdenv.mkDerivation rec {
@@ -36,7 +36,7 @@ stdenv.mkDerivation rec {
     "--without-librtmp"
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A fork of libcurl used by GNUnet";
     homepage    = "https://gnunet.org/en/gnurl.html";
     maintainers = with maintainers; [ vrthra ];
diff --git a/pkgs/development/libraries/libgpg-error/default.nix b/pkgs/development/libraries/libgpg-error/default.nix
index 972ca4c04a571..39d0b185660f4 100644
--- a/pkgs/development/libraries/libgpg-error/default.nix
+++ b/pkgs/development/libraries/libgpg-error/default.nix
@@ -65,7 +65,7 @@ in stdenv.mkDerivation (rec {
 
   doCheck = true; # not cross
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://www.gnupg.org/related_software/libgpg-error/index.html";
     description = "A small library that defines common error values for all GnuPG components";
 
diff --git a/pkgs/development/libraries/libgphoto2/default.nix b/pkgs/development/libraries/libgphoto2/default.nix
index db9e03a045ad2..4dec3151a7cd8 100644
--- a/pkgs/development/libraries/libgphoto2/default.nix
+++ b/pkgs/development/libraries/libgphoto2/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, autoreconfHook, pkg-config, gettext
+{ lib, stdenv, fetchFromGitHub, autoreconfHook, pkg-config, gettext
 , libusb1
 , libtool
 , libexif
@@ -49,8 +49,8 @@ stdenv.mkDerivation rec {
       from digital cameras.
     '';
     # XXX: the homepage claims LGPL, but several src files are lgpl21Plus
-    license = stdenv.lib.licenses.lgpl21Plus;
-    platforms = with stdenv.lib.platforms; unix;
-    maintainers = with stdenv.lib.maintainers; [ jcumming ];
+    license = lib.licenses.lgpl21Plus;
+    platforms = with lib.platforms; unix;
+    maintainers = with lib.maintainers; [ jcumming ];
   };
 }
diff --git a/pkgs/development/libraries/libgpod/default.nix b/pkgs/development/libraries/libgpod/default.nix
index d23a52382950b..c7c9de67592ba 100644
--- a/pkgs/development/libraries/libgpod/default.nix
+++ b/pkgs/development/libraries/libgpod/default.nix
@@ -39,7 +39,7 @@ stdenv.mkDerivation rec {
     homepage = "https://gtkpod.sourceforge.net/";
     description = "Library used by gtkpod to access the contents of an ipod";
     license = "LGPL";
-    platforms = stdenv.lib.platforms.gnu ++ stdenv.lib.platforms.linux;
+    platforms = lib.platforms.gnu ++ stdenv.lib.platforms.linux;
     maintainers = [ ];
   };
 }
diff --git a/pkgs/development/libraries/libgringotts/default.nix b/pkgs/development/libraries/libgringotts/default.nix
index 102361e5fb21b..16595a12eb500 100644
--- a/pkgs/development/libraries/libgringotts/default.nix
+++ b/pkgs/development/libraries/libgringotts/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, zlib, bzip2, libmcrypt, libmhash }:
+{ lib, stdenv, fetchurl, pkg-config, zlib, bzip2, libmcrypt, libmhash }:
 
 stdenv.mkDerivation rec {
   pname = "libgringotts";
@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ pkg-config ];
   buildInputs = [ zlib bzip2 libmcrypt libmhash ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A small library to encapsulate data in an encrypted structure";
     homepage = "http://libgringotts.sourceforge.net/";
     license = licenses.gpl2Plus;
diff --git a/pkgs/development/libraries/libgroove/default.nix b/pkgs/development/libraries/libgroove/default.nix
index 52cdf5e902709..963bf722b2a33 100644
--- a/pkgs/development/libraries/libgroove/default.nix
+++ b/pkgs/development/libraries/libgroove/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, libav, SDL2, chromaprint, libebur128 }:
+{ lib, stdenv, fetchFromGitHub, cmake, libav, SDL2, chromaprint, libebur128 }:
 
 stdenv.mkDerivation rec {
   version = "4.3.0";
@@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ cmake ];
   buildInputs = [ libav SDL2 chromaprint libebur128 ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Streaming audio processing library";
     homepage = "https://github.com/andrewrk/libgroove";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/libgrss/default.nix b/pkgs/development/libraries/libgrss/default.nix
index 132fc6a87122f..b8c7c7bc49774 100644
--- a/pkgs/development/libraries/libgrss/default.nix
+++ b/pkgs/development/libraries/libgrss/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, vala, gobject-introspection, gtk-doc, docbook_xsl, docbook_xml_dtd_412, glib, libxml2, libsoup, gnome3 }:
+{ lib, stdenv, fetchurl, pkg-config, vala, gobject-introspection, gtk-doc, docbook_xsl, docbook_xml_dtd_412, glib, libxml2, libsoup, gnome3 }:
 
 let
   version = "0.7.0";
@@ -10,7 +10,7 @@ stdenv.mkDerivation {
   outputs = [ "out" "dev" "devdoc" ];
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "1nalslgyglvhpva3px06fj6lv5zgfg0qmj0sbxyyl5d963vc02b7";
   };
 
@@ -30,7 +30,7 @@ stdenv.mkDerivation {
     };
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Glib abstaction to handle feeds in RSS, Atom and other formats";
     homepage = "https://wiki.gnome.org/Projects/Libgrss";
     license = licenses.lgpl3Plus;
diff --git a/pkgs/development/libraries/libgsf/default.nix b/pkgs/development/libraries/libgsf/default.nix
index bdc024094c0c6..77fa161b773a9 100644
--- a/pkgs/development/libraries/libgsf/default.nix
+++ b/pkgs/development/libraries/libgsf/default.nix
@@ -1,4 +1,4 @@
-{ fetchurl, stdenv, pkg-config, intltool, gettext, glib, libxml2, zlib, bzip2
+{ fetchurl, lib, stdenv, pkg-config, intltool, gettext, glib, libxml2, zlib, bzip2
 , perl, gdk-pixbuf, libiconv, libintl, gnome3 }:
 
 stdenv.mkDerivation rec {
@@ -6,7 +6,7 @@ stdenv.mkDerivation rec {
   version = "1.14.47";
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "0kbpp9ksl7977xiga37sk1gdw1r039v6zviqznl7alvvg39yp26i";
   };
 
@@ -28,12 +28,12 @@ stdenv.mkDerivation rec {
     };
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "GNOME's Structured File Library";
     homepage    = "https://www.gnome.org/projects/libgsf";
     license     = licenses.lgpl2Plus;
     maintainers = with maintainers; [ lovek323 ];
-    platforms   = stdenv.lib.platforms.unix;
+    platforms   = lib.platforms.unix;
 
     longDescription = ''
       Libgsf aims to provide an efficient extensible I/O abstraction for
diff --git a/pkgs/development/libraries/libgssglue/default.nix b/pkgs/development/libraries/libgssglue/default.nix
index d13c0940205f9..678af459a30d5 100644
--- a/pkgs/development/libraries/libgssglue/default.nix
+++ b/pkgs/development/libraries/libgssglue/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, kerberos }:
+{ lib, stdenv, fetchurl, kerberos }:
 
 stdenv.mkDerivation rec {
   name = "libgssglue-0.4";
@@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
     EOF
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://www.citi.umich.edu/projects/nfsv4/linux/";
     description = "Exports a gssapi interface which calls other random gssapi libraries";
     license = licenses.bsd3;
diff --git a/pkgs/development/libraries/libgtop/default.nix b/pkgs/development/libraries/libgtop/default.nix
index 165b80184435e..af4fe04a0b420 100644
--- a/pkgs/development/libraries/libgtop/default.nix
+++ b/pkgs/development/libraries/libgtop/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , glib
 , pkg-config
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
   version = "2.40.0";
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "1m6jbqk8maa52gxrf223442fr5bvvxgb7ham6v039i3r1i62gwvq";
   };
 
@@ -36,7 +36,7 @@ stdenv.mkDerivation rec {
     };
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A library that reads information about processes and the running system";
     license = licenses.gpl2Plus;
     maintainers = teams.gnome.members;
diff --git a/pkgs/development/libraries/libgudev/default.nix b/pkgs/development/libraries/libgudev/default.nix
index d1ddf3812c04b..feeae05bf5262 100644
--- a/pkgs/development/libraries/libgudev/default.nix
+++ b/pkgs/development/libraries/libgudev/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , pkg-config
 , udev
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
   outputs = [ "out" "dev" ];
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "0drf39qhsdz35kwb18hnfj2ig4yfxhfks66m783zlhnvy2narbhv";
   };
 
@@ -31,7 +31,7 @@ stdenv.mkDerivation rec {
     };
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A library that provides GObject bindings for libudev";
     homepage = "https://wiki.gnome.org/Projects/libgudev";
     maintainers = [ maintainers.eelco ] ++ teams.gnome.members;
diff --git a/pkgs/development/libraries/libguestfs/default.nix b/pkgs/development/libraries/libguestfs/default.nix
index ccc2778c0c019..0f56f8c97f388 100644
--- a/pkgs/development/libraries/libguestfs/default.nix
+++ b/pkgs/development/libraries/libguestfs/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, autoreconfHook, makeWrapper
+{ lib, stdenv, fetchurl, pkg-config, autoreconfHook, makeWrapper
 , ncurses, cpio, gperf, cdrkit, flex, bison, qemu, pcre, augeas, libxml2
 , acl, libcap, libcap_ng, libconfig, systemd, fuse, yajl, libvirt, hivex, db
 , gmp, readline, file, numactl, libapparmor, jansson
@@ -7,7 +7,7 @@
 , appliance ? null
 , javaSupport ? false, jdk ? null }:
 
-assert appliance == null || stdenv.lib.isDerivation appliance;
+assert appliance == null || lib.isDerivation appliance;
 assert javaSupport -> jdk != null;
 
 stdenv.mkDerivation rec {
@@ -28,7 +28,7 @@ stdenv.mkDerivation rec {
     libtirpc
   ] ++ (with perlPackages; [ perl libintl_perl GetoptLong SysVirt ])
     ++ (with ocamlPackages; [ ocaml findlib ocamlbuild ocaml_libvirt gettext-stub ounit ])
-    ++ stdenv.lib.optional javaSupport jdk;
+    ++ lib.optional javaSupport jdk;
 
   prePatch = ''
     # build-time scripts
@@ -45,7 +45,7 @@ stdenv.mkDerivation rec {
     patchShebangs .
   '';
   configureFlags = [ "--disable-appliance" "--disable-daemon" "--with-distro=NixOS" ]
-    ++ stdenv.lib.optionals (!javaSupport) [ "--disable-java" "--without-java" ];
+    ++ lib.optionals (!javaSupport) [ "--disable-java" "--without-java" ];
   patches = [ ./libguestfs-syms.patch ];
   NIX_CFLAGS_COMPILE="-I${libxml2.dev}/include/libxml2/";
   installFlags = [ "REALLY_INSTALL=yes" ];
@@ -59,7 +59,7 @@ stdenv.mkDerivation rec {
     done
   '';
 
-  postFixup = stdenv.lib.optionalString (appliance != null) ''
+  postFixup = lib.optionalString (appliance != null) ''
     mkdir -p $out/{lib,lib64}
     ln -s ${appliance} $out/lib64/guestfs
     ln -s ${appliance} $out/lib/guestfs
@@ -85,7 +85,7 @@ stdenv.mkDerivation rec {
     runHook postInstallCheck
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Tools for accessing and modifying virtual machine disk images";
     license = with licenses; [ gpl2 lgpl21 ];
     homepage = "https://libguestfs.org/";
diff --git a/pkgs/development/libraries/libgumath/default.nix b/pkgs/development/libraries/libgumath/default.nix
index 55e89d876649f..f82401f524fad 100644
--- a/pkgs/development/libraries/libgumath/default.nix
+++ b/pkgs/development/libraries/libgumath/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , libndtypes
 , libxnd
@@ -25,7 +25,7 @@ stdenv.mkDerivation {
 
   doCheck = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Library supporting function dispatch on general data containers. C base and Python wrapper";
     homepage = "https://xnd.io/";
     license = licenses.bsd3;
diff --git a/pkgs/development/libraries/libgweather/default.nix b/pkgs/development/libraries/libgweather/default.nix
index 80f897a1a5373..9351d3f707fae 100644
--- a/pkgs/development/libraries/libgweather/default.nix
+++ b/pkgs/development/libraries/libgweather/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, meson, ninja, pkg-config, libxml2, glib, gtk3, gettext, libsoup
+{ lib, stdenv, fetchurl, meson, ninja, pkg-config, libxml2, glib, gtk3, gettext, libsoup
 , gtk-doc, docbook_xsl, docbook_xml_dtd_43, gobject-introspection, python3, tzdata, geocode-glib, vala, gnome3 }:
 
 stdenv.mkDerivation rec {
@@ -8,7 +8,7 @@ stdenv.mkDerivation rec {
   outputs = [ "out" "dev" "devdoc" ];
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "0l74hc02rvzm4p530y539a67jwb080fqdaazdl8j0fr3xvq0j9yy";
   };
 
@@ -32,7 +32,7 @@ stdenv.mkDerivation rec {
     };
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A library to access weather information from online services for numerous locations";
     homepage = "https://wiki.gnome.org/Projects/LibGWeather";
     license = licenses.gpl2Plus;
diff --git a/pkgs/development/libraries/libgxps/default.nix b/pkgs/development/libraries/libgxps/default.nix
index c52898298510f..f7392ffb7dd5a 100644
--- a/pkgs/development/libraries/libgxps/default.nix
+++ b/pkgs/development/libraries/libgxps/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, meson, ninja, pkg-config, glib, gobject-introspection, cairo
+{ lib, stdenv, fetchurl, meson, ninja, pkg-config, glib, gobject-introspection, cairo
 , libarchive, freetype, libjpeg, libtiff, gnome3, lcms2
 }:
 
@@ -7,7 +7,7 @@ stdenv.mkDerivation rec {
   version = "0.3.1";
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "157s4c9gjjss6yd7qp7n4q6s72gz1k4ilsx4xjvp357azk49z4qs";
   };
 
@@ -26,7 +26,7 @@ stdenv.mkDerivation rec {
     };
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A GObject based library for handling and rendering XPS documents";
     homepage = "https://wiki.gnome.org/Projects/libgxps";
     license = licenses.lgpl21Plus;
diff --git a/pkgs/development/libraries/libhandy/0.x.nix b/pkgs/development/libraries/libhandy/0.x.nix
index 5a7ab456acc64..ff2093255cf07 100644
--- a/pkgs/development/libraries/libhandy/0.x.nix
+++ b/pkgs/development/libraries/libhandy/0.x.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitLab, meson, ninja, pkg-config, gobject-introspection, vala
+{ lib, stdenv, fetchFromGitLab, meson, ninja, pkg-config, gobject-introspection, vala
 , gtk-doc, docbook_xsl, docbook_xml_dtd_43
 , gtk3, gnome3
 , dbus, xvfb_run, libxml2
@@ -43,7 +43,7 @@ stdenv.mkDerivation rec {
       meson test --print-errorlogs
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A library full of GTK widgets for mobile phones";
     homepage = "https://source.puri.sm/Librem5/libhandy";
     license = licenses.lgpl21Plus;
diff --git a/pkgs/development/libraries/libhandy/default.nix b/pkgs/development/libraries/libhandy/default.nix
index 794502ed9b882..5ab6dde09d785 100644
--- a/pkgs/development/libraries/libhandy/default.nix
+++ b/pkgs/development/libraries/libhandy/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , meson
 , ninja
@@ -29,7 +29,7 @@ stdenv.mkDerivation rec {
   outputBin = "dev";
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "sha256-VZuzrMLDYkiJF+ty7SW9wYH0riaslNF3Y0zF00yGf3o=";
   };
 
@@ -80,7 +80,7 @@ stdenv.mkDerivation rec {
       meson test --print-errorlogs
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     changelog = "https://gitlab.gnome.org/GNOME/libhandy/-/tags/${version}";
     description = "Building blocks for modern adaptive GNOME apps";
     homepage = "https://gitlab.gnome.org/GNOME/libhandy";
diff --git a/pkgs/development/libraries/libhangul/default.nix b/pkgs/development/libraries/libhangul/default.nix
index eb62337c502e2..eea513a137cfa 100644
--- a/pkgs/development/libraries/libhangul/default.nix
+++ b/pkgs/development/libraries/libhangul/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation {
   name = "libhangul-0.1.0";
@@ -8,7 +8,7 @@ stdenv.mkDerivation {
     sha256 = "0ni9b0v70wkm0116na7ghv03pgxsfpfszhgyj3hld3bxamfal1ar";
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Core algorithm library for Korean input routines";
     homepage = "https://github.com/choehwanjin/libhangul";
     license = licenses.lgpl21;
diff --git a/pkgs/development/libraries/libharu/default.nix b/pkgs/development/libraries/libharu/default.nix
index 634a991f49b89..53c14027ff360 100644
--- a/pkgs/development/libraries/libharu/default.nix
+++ b/pkgs/development/libraries/libharu/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchzip, cmake, zlib, libpng }:
+{ lib, stdenv, fetchzip, cmake, zlib, libpng }:
 
 stdenv.mkDerivation {
   name = "libharu-2.3.0";
@@ -14,8 +14,8 @@ stdenv.mkDerivation {
   meta = {
     description = "Cross platform, open source library for generating PDF files";
     homepage = "http://libharu.org/";
-    license = stdenv.lib.licenses.zlib;
-    maintainers = [ stdenv.lib.maintainers.marcweber ];
-    platforms = stdenv.lib.platforms.unix;
+    license = lib.licenses.zlib;
+    maintainers = [ lib.maintainers.marcweber ];
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/libhdhomerun/default.nix b/pkgs/development/libraries/libhdhomerun/default.nix
index 577457afdbf83..ab0ad6fab23eb 100644
--- a/pkgs/development/libraries/libhdhomerun/default.nix
+++ b/pkgs/development/libraries/libhdhomerun/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 # libhdhomerun requires UDP port 65001 to be open in order to detect and communicate with tuners.
 # If your firewall is enabled, make sure to have something like:
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
     sha256 = "1v80jk056ii2iv2w7sq24i3prjrbhxql5vqhafs7vq54qmwvgbnb";
   };
 
-  patchPhase = stdenv.lib.optionalString stdenv.isDarwin ''
+  patchPhase = lib.optionalString stdenv.isDarwin ''
     substituteInPlace Makefile --replace "gcc" "cc"
     substituteInPlace Makefile --replace "-arch i386" ""
   '';
@@ -25,7 +25,7 @@ stdenv.mkDerivation rec {
     cp *.h $out/include/hdhomerun
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Implements the libhdhomerun protocol for use with Silicondust HDHomeRun TV tuners";
     homepage = "https://www.silicondust.com/support/linux";
     license = licenses.lgpl21Only;
diff --git a/pkgs/development/libraries/libheif/default.nix b/pkgs/development/libraries/libheif/default.nix
index ca8c189a9c88e..b0872b9da1e45 100644
--- a/pkgs/development/libraries/libheif/default.nix
+++ b/pkgs/development/libraries/libheif/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, autoreconfHook, pkg-config, libde265, x265, libpng,
+{ lib, stdenv, fetchFromGitHub, autoreconfHook, pkg-config, libde265, x265, libpng,
   libjpeg, libaom }:
 
 stdenv.mkDerivation rec {
@@ -23,9 +23,9 @@ stdenv.mkDerivation rec {
   meta = {
     homepage = "http://www.libheif.org/";
     description = "ISO/IEC 23008-12:2017 HEIF image file format decoder and encoder";
-    license = stdenv.lib.licenses.lgpl3;
-    platforms = stdenv.lib.platforms.unix;
-    maintainers = with stdenv.lib.maintainers; [ gebner ];
+    license = lib.licenses.lgpl3;
+    platforms = lib.platforms.unix;
+    maintainers = with lib.maintainers; [ gebner ];
   };
 
 }
diff --git a/pkgs/development/libraries/libhttpseverywhere/default.nix b/pkgs/development/libraries/libhttpseverywhere/default.nix
index f4edb39af5d42..f54929c5378be 100644
--- a/pkgs/development/libraries/libhttpseverywhere/default.nix
+++ b/pkgs/development/libraries/libhttpseverywhere/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, meson, ninja, makeFontsConf, vala, fetchpatch
+{ lib, stdenv, fetchurl, pkg-config, meson, ninja, makeFontsConf, vala, fetchpatch
 , gnome3, glib, json-glib, libarchive, libsoup, gobject-introspection }:
 
 let
@@ -8,7 +8,7 @@ in stdenv.mkDerivation rec {
   name = "${pname}-${version}";
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${name}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${name}.tar.xz";
     sha256 = "1jmn6i4vsm89q1axlq4ajqkzqmlmjaml9xhw3h9jnal46db6y00w";
   };
 
@@ -39,7 +39,7 @@ in stdenv.mkDerivation rec {
     };
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Library to use HTTPSEverywhere in desktop applications";
     homepage = "https://gitlab.gnome.org/GNOME/libhttpseverywhere";
     license = licenses.lgpl3;
diff --git a/pkgs/development/libraries/libiberty/default.nix b/pkgs/development/libraries/libiberty/default.nix
index c7babb3038d3c..2040ef3bee082 100644
--- a/pkgs/development/libraries/libiberty/default.nix
+++ b/pkgs/development/libraries/libiberty/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, buildPackages
+{ lib, stdenv, buildPackages
 , staticBuild ? stdenv.hostPlatform.isStatic
 }:
 
@@ -15,13 +15,13 @@ stdenv.mkDerivation {
   postUnpack = "sourceRoot=\${sourceRoot}/libiberty";
 
   configureFlags = [ "--enable-install-libiberty" ]
-    ++ stdenv.lib.optional (!staticBuild) "--enable-shared";
+    ++ lib.optional (!staticBuild) "--enable-shared";
 
-  postInstall = stdenv.lib.optionalString (!staticBuild) ''
+  postInstall = lib.optionalString (!staticBuild) ''
     cp pic/libiberty.a $out/lib*/libiberty.a
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://gcc.gnu.org/";
     license = licenses.lgpl2;
     description = "Collection of subroutines used by various GNU programs";
diff --git a/pkgs/development/libraries/libibmad/default.nix b/pkgs/development/libraries/libibmad/default.nix
index 8c46efa9710a1..b6df338f122e9 100644
--- a/pkgs/development/libraries/libibmad/default.nix
+++ b/pkgs/development/libraries/libibmad/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, libibumad }:
+{ lib, stdenv, fetchurl, libibumad }:
 
 stdenv.mkDerivation rec {
   name = "libibmad-1.3.13";
@@ -10,7 +10,7 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ libibumad ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://www.openfabrics.org/";
     license = licenses.gpl2;
     platforms = platforms.linux;
diff --git a/pkgs/development/libraries/libibumad/default.nix b/pkgs/development/libraries/libibumad/default.nix
index 4c37f8564b0a2..6de97ad77cd7b 100644
--- a/pkgs/development/libraries/libibumad/default.nix
+++ b/pkgs/development/libraries/libibumad/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
   name = "libibumad-1.3.10.2";
@@ -8,7 +8,7 @@ stdenv.mkDerivation rec {
     sha256 = "0bkygb3lbpaj6s4vsyixybrrkcnilbijv4ga5p1xdwyr3gip83sh";
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://www.openfabrics.org/";
     license = licenses.gpl2;
     platforms = platforms.linux;
diff --git a/pkgs/development/libraries/libical/default.nix b/pkgs/development/libraries/libical/default.nix
index 7802f9752023d..7f5e739a99cd0 100644
--- a/pkgs/development/libraries/libical/default.nix
+++ b/pkgs/development/libraries/libical/default.nix
@@ -96,7 +96,7 @@ stdenv.mkDerivation rec {
     runHook postInstallCheck
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/libical/libical";
     description = "An Open Source implementation of the iCalendar protocols";
     license = licenses.mpl20;
diff --git a/pkgs/development/libraries/libicns/default.nix b/pkgs/development/libraries/libicns/default.nix
index 10d68ee3a4e9b..1df2a8abb82cc 100644
--- a/pkgs/development/libraries/libicns/default.nix
+++ b/pkgs/development/libraries/libicns/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, fetchpatch, autoreconfHook, libpng, openjpeg }:
+{ lib, stdenv, fetchurl, fetchpatch, autoreconfHook, libpng, openjpeg }:
 
 stdenv.mkDerivation rec {
   pname = "libicns";
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
   buildInputs = [ libpng openjpeg ];
   NIX_CFLAGS_COMPILE = [ "-I${openjpeg.dev}/include/${openjpeg.incDir}" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Library for manipulation of the Mac OS icns resource format";
     homepage = "https://icns.sourceforge.io";
     license = with licenses; [ gpl2 lgpl2 lgpl21 ];
diff --git a/pkgs/development/libraries/libid3tag/default.nix b/pkgs/development/libraries/libid3tag/default.nix
index 9847312a34a94..8cedd1bcb4184 100644
--- a/pkgs/development/libraries/libid3tag/default.nix
+++ b/pkgs/development/libraries/libid3tag/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, zlib, gperf}:
+{lib, stdenv, fetchurl, zlib, gperf}:
 
 stdenv.mkDerivation rec {
   pname = "libid3tag";
@@ -34,7 +34,7 @@ stdenv.mkDerivation rec {
       --subst-var-by version "${version}"
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "ID3 tag manipulation library";
     homepage = "http://mad.sourceforge.net/";
     license = licenses.gpl2;
diff --git a/pkgs/development/libraries/libidn/default.nix b/pkgs/development/libraries/libidn/default.nix
index e936f3fd92a2a..afe5e550b3396 100644
--- a/pkgs/development/libraries/libidn/default.nix
+++ b/pkgs/development/libraries/libidn/default.nix
@@ -1,4 +1,4 @@
-{ fetchurl, stdenv, libiconv }:
+{ fetchurl, lib, stdenv, libiconv }:
 
 stdenv.mkDerivation rec {
   name = "libidn-1.36";
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
 
   hardeningDisable = [ "format" ];
 
-  buildInputs = stdenv.lib.optional stdenv.isDarwin libiconv;
+  buildInputs = lib.optional stdenv.isDarwin libiconv;
 
   doCheck = false; # fails
 
@@ -40,8 +40,8 @@ stdenv.mkDerivation rec {
     '';
 
     repositories.git = "git://git.savannah.gnu.org/libidn.git";
-    license = stdenv.lib.licenses.lgpl2Plus;
-    platforms = stdenv.lib.platforms.all;
+    license = lib.licenses.lgpl2Plus;
+    platforms = lib.platforms.all;
     maintainers = [ ];
   };
 }
diff --git a/pkgs/development/libraries/libidn2/default.nix b/pkgs/development/libraries/libidn2/default.nix
index c5af2d16bb21b..30a3342663953 100644
--- a/pkgs/development/libraries/libidn2/default.nix
+++ b/pkgs/development/libraries/libidn2/default.nix
@@ -1,11 +1,11 @@
-{ fetchurl, stdenv, libiconv, libunistring, help2man, buildPackages }:
+{ fetchurl, lib, stdenv, libiconv, libunistring, help2man, buildPackages }:
 
 # Note: this package is used for bootstrapping fetchurl, and thus
 # cannot use fetchpatch! All mutable patches (generated by GitHub or
 # cgit) that are needed here should be included directly in Nixpkgs as
 # files.
 
-with stdenv.lib;
+with lib;
 
 stdenv.mkDerivation rec {
   pname = "libidn2";
@@ -38,8 +38,8 @@ stdenv.mkDerivation rec {
     '';
 
     repositories.git = "https://gitlab.com/jas/libidn2";
-    license = with stdenv.lib.licenses; [ lgpl3Plus gpl2Plus gpl3Plus ];
-    platforms = stdenv.lib.platforms.all;
-    maintainers = with stdenv.lib.maintainers; [ fpletz ];
+    license = with lib.licenses; [ lgpl3Plus gpl2Plus gpl3Plus ];
+    platforms = lib.platforms.all;
+    maintainers = with lib.maintainers; [ fpletz ];
   };
 }
diff --git a/pkgs/development/libraries/libiec61883/default.nix b/pkgs/development/libraries/libiec61883/default.nix
index 2f2d2d190e8e3..911210202fe06 100644
--- a/pkgs/development/libraries/libiec61883/default.nix
+++ b/pkgs/development/libraries/libiec61883/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, libraw1394 }:
+{ lib, stdenv, fetchurl, pkg-config, libraw1394 }:
 
 stdenv.mkDerivation rec {
   version = "1.2.0";
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
 
   propagatedBuildInputs = [ libraw1394 ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://www.linux1394.org";
     license = licenses.lgpl21Plus;
     platforms = platforms.linux;
diff --git a/pkgs/development/libraries/libieee1284/default.nix b/pkgs/development/libraries/libieee1284/default.nix
index b5708a83a7d39..7c20d1b4947c1 100644
--- a/pkgs/development/libraries/libieee1284/default.nix
+++ b/pkgs/development/libraries/libieee1284/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, autoconf, automake, libtool, xmlto, docbook_xml_dtd_412, docbook_xsl }:
+{ lib, stdenv, fetchFromGitHub, autoconf, automake, libtool, xmlto, docbook_xml_dtd_412, docbook_xsl }:
 
 stdenv.mkDerivation rec {
   pname = "libieee1284";
@@ -28,7 +28,7 @@ stdenv.mkDerivation rec {
     ./bootstrap
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Parallel port communication library";
     homepage = "http://cyberelk.net/tim/software/libieee1284/";
     license = licenses.gpl2Plus;
diff --git a/pkgs/development/libraries/libiio/default.nix b/pkgs/development/libraries/libiio/default.nix
index 3c3ccf27884ff..043e27fb4b2a3 100644
--- a/pkgs/development/libraries/libiio/default.nix
+++ b/pkgs/development/libraries/libiio/default.nix
@@ -53,7 +53,7 @@ stdenv.mkDerivation rec {
     moveToOutput ${python.sitePackages} "$python"
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "API for interfacing with the Linux Industrial I/O Subsystem";
     homepage = "https://github.com/analogdevicesinc/libiio";
     license = licenses.lgpl21Plus;
diff --git a/pkgs/development/libraries/libimagequant/default.nix b/pkgs/development/libraries/libimagequant/default.nix
index 2bca09be45f40..83a5a462ee007 100644
--- a/pkgs/development/libraries/libimagequant/default.nix
+++ b/pkgs/development/libraries/libimagequant/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub }:
+{ lib, stdenv, fetchFromGitHub }:
 
 stdenv.mkDerivation rec {
   pname = "libimagequant";
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
     patchShebangs ./configure
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://pngquant.org/lib/";
     description = "Image quantization library";
     longDescription = "Small, portable C library for high-quality conversion of RGBA images to 8-bit indexed-color (palette) images.";
diff --git a/pkgs/development/libraries/libime/default.nix b/pkgs/development/libraries/libime/default.nix
index 476d2419ef317..b82a8b3fd359b 100644
--- a/pkgs/development/libraries/libime/default.nix
+++ b/pkgs/development/libraries/libime/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , fetchFromGitHub
 , cmake
@@ -53,7 +53,7 @@ stdenv.mkDerivation rec {
     fcitx5
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A library to support generic input method implementation";
     homepage = "https://github.com/fcitx/libime";
     license = licenses.lgpl21Plus;
diff --git a/pkgs/development/libraries/libimobiledevice/default.nix b/pkgs/development/libraries/libimobiledevice/default.nix
index f5038e45d3ae4..b805be1257bd5 100644
--- a/pkgs/development/libraries/libimobiledevice/default.nix
+++ b/pkgs/development/libraries/libimobiledevice/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, automake, autoconf, libtool, pkg-config, gnutls
+{ lib, stdenv, fetchFromGitHub, automake, autoconf, libtool, pkg-config, gnutls
 , libgcrypt, libtasn1, glib, libplist, libusbmuxd }:
 
 stdenv.mkDerivation rec {
@@ -36,7 +36,7 @@ stdenv.mkDerivation rec {
     "--without-cython"
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/libimobiledevice/libimobiledevice";
     description = "A software library that talks the protocols to support iPhone®, iPod Touch® and iPad® devices on Linux";
     longDescription = ''
diff --git a/pkgs/development/libraries/libinfinity/default.nix b/pkgs/development/libraries/libinfinity/default.nix
index b980e0a279f40..e68d27cacff54 100644
--- a/pkgs/development/libraries/libinfinity/default.nix
+++ b/pkgs/development/libraries/libinfinity/default.nix
@@ -1,6 +1,6 @@
 { gtkWidgets ? false # build GTK widgets for libinfinity
 , avahiSupport ? false # build support for Avahi in libinfinity
-, stdenv, fetchurl, pkg-config, glib, libxml2, gnutls, gsasl
+, lib, stdenv, fetchurl, pkg-config, glib, libxml2, gnutls, gsasl
 , gobject-introspection
 , gtk3 ? null, gtk-doc, docbook_xsl, docbook_xml_dtd_412, avahi ? null, libdaemon, libidn, gss
 , libintl }:
@@ -23,8 +23,8 @@ let
 
     nativeBuildInputs = [ pkg-config gtk-doc docbook_xsl docbook_xml_dtd_412 gobject-introspection ];
     buildInputs = [ glib libxml2 gsasl libidn gss libintl libdaemon ]
-      ++ stdenv.lib.optional gtkWidgets gtk3
-      ++ stdenv.lib.optional avahiSupport avahi;
+      ++ lib.optional gtkWidgets gtk3
+      ++ lib.optional avahiSupport avahi;
 
     propagatedBuildInputs = [ gnutls ];
 
@@ -39,15 +39,15 @@ let
     ];
 
     passthru = {
-      infinoted = "${self.bin}/bin/infinoted-${stdenv.lib.versions.majorMinor version}";
+      infinoted = "${self.bin}/bin/infinoted-${lib.versions.majorMinor version}";
     };
 
     meta = {
       homepage = "https://gobby.github.io/";
       description = "An implementation of the Infinote protocol written in GObject-based C";
-      license = stdenv.lib.licenses.lgpl2Plus;
-      maintainers = [ stdenv.lib.maintainers.phreedom ];
-      platforms = with stdenv.lib.platforms; linux ++ darwin;
+      license = lib.licenses.lgpl2Plus;
+      maintainers = [ lib.maintainers.phreedom ];
+      platforms = with lib.platforms; linux ++ darwin;
     };
   };
 in self
diff --git a/pkgs/development/libraries/libinjection/default.nix b/pkgs/development/libraries/libinjection/default.nix
index b3bdbb41588ab..f678136637ae1 100644
--- a/pkgs/development/libraries/libinjection/default.nix
+++ b/pkgs/development/libraries/libinjection/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub
+{ lib, stdenv, fetchFromGitHub
 , python
 }:
 
@@ -27,7 +27,7 @@ stdenv.mkDerivation rec {
   # no binaries, so out = library, dev = headers
   outputs = [ "out" "dev" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "SQL / SQLI tokenizer parser analyzer";
     homepage    = "https://github.com/client9/libinjection";
     license     = licenses.bsd3;
diff --git a/pkgs/development/libraries/libinklevel/default.nix b/pkgs/development/libraries/libinklevel/default.nix
index 90f6936d458aa..c5dc7987ca627 100644
--- a/pkgs/development/libraries/libinklevel/default.nix
+++ b/pkgs/development/libraries/libinklevel/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, libusb1 }:
+{ lib, stdenv, fetchurl, pkg-config, libusb1 }:
 
 stdenv.mkDerivation rec {
   pname = "libinklevel";
@@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
 
   outputs = [ "out" "dev" "doc" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A library for checking the ink level of your printer";
     longDescription = ''
       Libinklevel is a library for checking the ink level of your printer on a
diff --git a/pkgs/development/libraries/libinotify-kqueue/default.nix b/pkgs/development/libraries/libinotify-kqueue/default.nix
index 074d2954ef186..ff74060d3d464 100644
--- a/pkgs/development/libraries/libinotify-kqueue/default.nix
+++ b/pkgs/development/libraries/libinotify-kqueue/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchzip, autoreconfHook }:
+{ lib, stdenv, fetchzip, autoreconfHook }:
 
 stdenv.mkDerivation rec {
   pname = "libinotify-kqueue";
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
   doCheck = true;
   checkFlags = [ "test" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Inotify shim for macOS and BSD";
     homepage = "https://github.com/libinotify-kqueue/libinotify-kqueue";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/libinput/default.nix b/pkgs/development/libraries/libinput/default.nix
index cf0af9127f725..8f1511de33049 100644
--- a/pkgs/development/libraries/libinput/default.nix
+++ b/pkgs/development/libraries/libinput/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitLab, pkg-config, meson, ninja
+{ lib, stdenv, fetchFromGitLab, pkg-config, meson, ninja
 , libevdev, mtdev, udev, libwacom
 , documentationSupport ? false, doxygen ? null, graphviz ? null # Documentation
 , eventGUISupport ? false, cairo ? null, glib ? null, gtk3 ? null # GUI event viewer support
@@ -10,7 +10,7 @@ assert eventGUISupport -> cairo != null && glib != null && gtk3 != null;
 assert testsSupport -> check != null && valgrind != null && python3 != null;
 
 let
-  mkFlag = optSet: flag: "-D${flag}=${stdenv.lib.boolToString optSet}";
+  mkFlag = optSet: flag: "-D${flag}=${lib.boolToString optSet}";
 
   sphinx-build = if documentationSupport then
     python3.pkgs.sphinx.overrideAttrs (super: {
@@ -24,7 +24,7 @@ let
   else null;
 in
 
-with stdenv.lib;
+with lib;
 stdenv.mkDerivation rec {
   pname = "libinput";
   version = "1.16.4";
diff --git a/pkgs/development/libraries/libiodbc/default.nix b/pkgs/development/libraries/libiodbc/default.nix
index f2b7eaa8f54ca..29d4c3432ebdf 100644
--- a/pkgs/development/libraries/libiodbc/default.nix
+++ b/pkgs/development/libraries/libiodbc/default.nix
@@ -1,4 +1,4 @@
-{ config, stdenv, fetchurl, pkg-config, gtk2, Carbon
+{ config, lib, stdenv, fetchurl, pkg-config, gtk2, Carbon
 , useGTK ? config.libiodbc.gtk or false }:
 
 stdenv.mkDerivation rec {
@@ -10,15 +10,15 @@ stdenv.mkDerivation rec {
   };
 
   nativeBuildInputs = [ pkg-config ];
-  buildInputs = stdenv.lib.optionals useGTK [ gtk2 ]
-                ++ stdenv.lib.optional stdenv.isDarwin Carbon;
+  buildInputs = lib.optionals useGTK [ gtk2 ]
+                ++ lib.optional stdenv.isDarwin Carbon;
 
   preBuild =
     ''
       export NIX_LDFLAGS_BEFORE="-rpath $out/lib"
     '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "iODBC driver manager";
     homepage = "http://www.iodbc.org";
     platforms = platforms.unix;
diff --git a/pkgs/development/libraries/libipfix/default.nix b/pkgs/development/libraries/libipfix/default.nix
index 69918b5d36c7b..173bfafc8cc9c 100644
--- a/pkgs/development/libraries/libipfix/default.nix
+++ b/pkgs/development/libraries/libipfix/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation {
   pname = "libipfix";
@@ -7,7 +7,7 @@ stdenv.mkDerivation {
     url = "mirror://sourceforge/libipfix/files/libipfix/libipfix_110209.tgz";
     sha256 = "0h7v0sxjjdc41hl5vq2x0yhyn04bczl11bqm97825mivrvfymhn6";
   };
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://libipfix.sourceforge.net/";
     description = "The libipfix C-library implements the IPFIX protocol defined by the IP Flow Information Export working group of the IETF";
     license = licenses.lgpl3;
diff --git a/pkgs/development/libraries/libipt/default.nix b/pkgs/development/libraries/libipt/default.nix
index e585a2b090fcd..272c61c47a5e8 100644
--- a/pkgs/development/libraries/libipt/default.nix
+++ b/pkgs/development/libraries/libipt/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake }:
+{ lib, stdenv, fetchFromGitHub, cmake }:
 
 stdenv.mkDerivation rec {
   pname = "libipt";
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ cmake ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Intel Processor Trace decoder library";
     homepage = "https://github.com/intel/libipt";
     license = licenses.bsd3;
diff --git a/pkgs/development/libraries/libiptcdata/default.nix b/pkgs/development/libraries/libiptcdata/default.nix
index 01b23d9e2d28d..140faab43b1aa 100644
--- a/pkgs/development/libraries/libiptcdata/default.nix
+++ b/pkgs/development/libraries/libiptcdata/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl}:
+{lib, stdenv, fetchurl}:
 
 stdenv.mkDerivation rec {
   name = "libiptcdata-1.0.4";
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
   meta = {
     description = "Library for reading and writing the IPTC metadata in images and other files";
     homepage = "http://libiptcdata.sourceforge.net/";
-    license = stdenv.lib.licenses.gpl2Plus;
-    platforms = stdenv.lib.platforms.unix;
+    license = lib.licenses.gpl2Plus;
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/libircclient/default.nix b/pkgs/development/libraries/libircclient/default.nix
index 4bef2de28c059..56a9f1b961cf9 100644
--- a/pkgs/development/libraries/libircclient/default.nix
+++ b/pkgs/development/libraries/libircclient/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
   version = "1.10";
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
       --replace "cp "              "install "
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A small but extremely powerful library which implements the client IRC protocol";
     homepage    = "http://www.ulduzsoft.com/libircclient/";
     license     = licenses.lgpl3;
diff --git a/pkgs/development/libraries/libirecovery/default.nix b/pkgs/development/libraries/libirecovery/default.nix
index 26a39516d252f..6a2f926d79ef1 100644
--- a/pkgs/development/libraries/libirecovery/default.nix
+++ b/pkgs/development/libraries/libirecovery/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, automake, autoconf, libtool, pkg-config
+{ lib, stdenv, fetchFromGitHub, automake, autoconf, libtool, pkg-config
 , libusb1
 , readline
 }:
@@ -38,7 +38,7 @@ stdenv.mkDerivation rec {
     ''--with-udevrule="OWNER=\"root\", GROUP=\"myusergroup\", MODE=\"0660\""''
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/libimobiledevice/libirecovery";
     description = "Library and utility to talk to iBoot/iBSS via USB on Mac OS X, Windows, and Linux";
     longDescription = ''
diff --git a/pkgs/development/libraries/libiscsi/default.nix b/pkgs/development/libraries/libiscsi/default.nix
index 246696c94ebe3..adc721bc6d076 100644
--- a/pkgs/development/libraries/libiscsi/default.nix
+++ b/pkgs/development/libraries/libiscsi/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, autoreconfHook }:
+{ lib, stdenv, fetchFromGitHub, autoreconfHook }:
 
 stdenv.mkDerivation rec {
   pname = "libiscsi";
@@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
   # This problem is gone on libiscsi master.
   NIX_CFLAGS_COMPILE = if stdenv.hostPlatform.is32bit then "-Wno-error=sign-compare" else null;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "iscsi client library and utilities";
     homepage = "https://github.com/sahlberg/libiscsi";
     license = licenses.lgpl2;
diff --git a/pkgs/development/libraries/libisds/default.nix b/pkgs/development/libraries/libisds/default.nix
index 28a8d7d874b83..268acb2f948dc 100644
--- a/pkgs/development/libraries/libisds/default.nix
+++ b/pkgs/development/libraries/libisds/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , expat
 , gpgme
@@ -24,7 +24,7 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ expat gpgme libgcrypt libxml2 libxslt curl docbook_xsl ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Client library for accessing SOAP services of Czech government-provided Databox infomation system";
     homepage = "http://xpisar.wz.cz/libisds/";
     license = licenses.lgpl3;
diff --git a/pkgs/development/libraries/libisoburn/default.nix b/pkgs/development/libraries/libisoburn/default.nix
index 0b4984fc82a3e..1e2ae41f3f22e 100644
--- a/pkgs/development/libraries/libisoburn/default.nix
+++ b/pkgs/development/libraries/libisoburn/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, acl, attr, zlib, libburn, libisofs }:
+{ lib, stdenv, fetchurl, acl, attr, zlib, libburn, libisofs }:
 
 stdenv.mkDerivation rec {
   pname = "libisoburn";
@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
   buildInputs = [ attr zlib libburn libisofs ];
   propagatedBuildInputs = [ acl ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://libburnia-project.org/";
     description = "Enables creation and expansion of ISO-9660 filesystems on CD/DVD/BD ";
     license = licenses.gpl2Plus;
diff --git a/pkgs/development/libraries/libisofs/default.nix b/pkgs/development/libraries/libisofs/default.nix
index 0c01389f0b82b..a291410941c6e 100644
--- a/pkgs/development/libraries/libisofs/default.nix
+++ b/pkgs/development/libraries/libisofs/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, acl, attr, zlib }:
+{ lib, stdenv, fetchurl, acl, attr, zlib }:
 
 stdenv.mkDerivation rec {
   pname = "libisofs";
@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
   buildInputs = [ attr zlib ];
   propagatedBuildInputs = [ acl ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://libburnia-project.org/";
     description = "A library to create an ISO-9660 filesystem with extensions like RockRidge or Joliet";
     license = licenses.gpl2Plus;
diff --git a/pkgs/development/libraries/libite/default.nix b/pkgs/development/libraries/libite/default.nix
index 4d9df889851d5..c57876e9c4fd4 100644
--- a/pkgs/development/libraries/libite/default.nix
+++ b/pkgs/development/libraries/libite/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, autoreconfHook, pkg-config, libconfuse }:
+{ lib, stdenv, fetchFromGitHub, autoreconfHook, pkg-config, libconfuse }:
 
 stdenv.mkDerivation rec {
   pname = "libite";
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ autoreconfHook pkg-config ];
   buildInputs = [ libconfuse ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     inherit (src.meta) homepage;
     description = "Lightweight library of frog DNA";
     longDescription = ''
diff --git a/pkgs/development/libraries/libivykis/default.nix b/pkgs/development/libraries/libivykis/default.nix
index 2dc009b9b1ce9..9a1c728bd55d9 100644
--- a/pkgs/development/libraries/libivykis/default.nix
+++ b/pkgs/development/libraries/libivykis/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, autoreconfHook, pkg-config, file, protobufc }:
+{ lib, stdenv, fetchurl, autoreconfHook, pkg-config, file, protobufc }:
 
 stdenv.mkDerivation rec {
   pname = "libivykis";
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ autoreconfHook pkg-config ];
   buildInputs = [ file protobufc ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://libivykis.sourceforge.net/";
     description = ''
       A thin wrapper over various OS'es implementation of I/O readiness
diff --git a/pkgs/development/libraries/libixp-hg/default.nix b/pkgs/development/libraries/libixp-hg/default.nix
index e971136b088b3..489f526248aa9 100644
--- a/pkgs/development/libraries/libixp-hg/default.nix
+++ b/pkgs/development/libraries/libixp-hg/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, unzip, txt2tags }:
+{ lib, stdenv, fetchurl, unzip, txt2tags }:
 
 stdenv.mkDerivation rec {
   rev = "148";
@@ -19,9 +19,9 @@ stdenv.mkDerivation rec {
   meta = {
     homepage = "http://repo.cat-v.org/libixp/"; # see also https://libs.suckless.org/deprecated/libixp
     description = "Portable, simple C-language 9P client and server libary";
-    maintainers = with stdenv.lib.maintainers; [ kovirobi ];
-    license = stdenv.lib.licenses.mit;
+    maintainers = with lib.maintainers; [ kovirobi ];
+    license = lib.licenses.mit;
     inherit version;
-    platforms = with stdenv.lib.platforms; unix;
+    platforms = with lib.platforms; unix;
   };
 }
diff --git a/pkgs/development/libraries/libjcat/default.nix b/pkgs/development/libraries/libjcat/default.nix
index a6ad6d4bb649e..974f1f6674fb7 100644
--- a/pkgs/development/libraries/libjcat/default.nix
+++ b/pkgs/development/libraries/libjcat/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , docbook_xml_dtd_43
 , docbook-xsl-nons
@@ -74,7 +74,7 @@ stdenv.mkDerivation rec {
     };
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Library for reading and writing Jcat files";
     homepage = "https://github.com/hughsie/libjcat";
     license = licenses.lgpl21Plus;
diff --git a/pkgs/development/libraries/libjpeg-turbo/default.nix b/pkgs/development/libraries/libjpeg-turbo/default.nix
index c4e81d034fc9d..5fe1c2ee9ecff 100644
--- a/pkgs/development/libraries/libjpeg-turbo/default.nix
+++ b/pkgs/development/libraries/libjpeg-turbo/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, nasm
+{ lib, stdenv, fetchFromGitHub, cmake, nasm
 , enableStatic ? stdenv.hostPlatform.isStatic
 , enableShared ? !stdenv.hostPlatform.isStatic
 }:
@@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
   };
 
   patches =
-    stdenv.lib.optional (stdenv.hostPlatform.libc or null == "msvcrt")
+    lib.optional (stdenv.hostPlatform.libc or null == "msvcrt")
       ./mingw-boolean.patch;
 
   outputs = [ "bin" "dev" "out" "man" "doc" ];
@@ -31,7 +31,7 @@ stdenv.mkDerivation rec {
   doInstallCheck = true;
   installCheckTarget = "test";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://libjpeg-turbo.org/";
     description = "A faster (using SIMD) libjpeg implementation";
     license = licenses.ijg; # and some parts under other BSD-style licenses
diff --git a/pkgs/development/libraries/libjpeg/default.nix b/pkgs/development/libraries/libjpeg/default.nix
index 05fbb7de701ed..f462d9824a42f 100644
--- a/pkgs/development/libraries/libjpeg/default.nix
+++ b/pkgs/development/libraries/libjpeg/default.nix
@@ -1,6 +1,6 @@
-{ stdenv, fetchurl, static ? false }:
+{ lib, stdenv, fetchurl, static ? false }:
 
-with stdenv.lib;
+with lib;
 
 stdenv.mkDerivation {
   name = "libjpeg-9d";
@@ -17,7 +17,7 @@ stdenv.mkDerivation {
   meta = {
     homepage = "http://www.ijg.org/";
     description = "A library that implements the JPEG image file format";
-    license = stdenv.lib.licenses.free;
-    platforms = stdenv.lib.platforms.unix;
+    license = lib.licenses.free;
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/libjreen/default.nix b/pkgs/development/libraries/libjreen/default.nix
index 2c14d270f2625..5a70e4b01dd84 100644
--- a/pkgs/development/libraries/libjreen/default.nix
+++ b/pkgs/development/libraries/libjreen/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, cmake, qt4, pkg-config, gsasl }:
+{ lib, stdenv, fetchurl, cmake, qt4, pkg-config, gsasl }:
 
 stdenv.mkDerivation rec {
   pname = "libjreen";
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
   meta = {
     description = "C++ Jabber library using Qt framework";
     homepage = "https://qutim.org/jreen/";
-    license = stdenv.lib.licenses.gpl2Plus;
-    platforms = stdenv.lib.platforms.unix;
+    license = lib.licenses.gpl2Plus;
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/libjson-rpc-cpp/default.nix b/pkgs/development/libraries/libjson-rpc-cpp/default.nix
index aa23b3f8eafa1..e2dd30fc616ff 100644
--- a/pkgs/development/libraries/libjson-rpc-cpp/default.nix
+++ b/pkgs/development/libraries/libjson-rpc-cpp/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , fetchpatch
 , pkg-config
@@ -71,7 +71,7 @@ stdenv.mkDerivation rec {
   preInstall = ''
     function fixRunPath {
       p=$(patchelf --print-rpath $1)
-      q="$p:${stdenv.lib.makeLibraryPath [ jsoncpp argtable libmicrohttpd curl ]}:$out/lib"
+      q="$p:${lib.makeLibraryPath [ jsoncpp argtable libmicrohttpd curl ]}:$out/lib"
       patchelf --set-rpath $q $1
     }
 
@@ -92,7 +92,7 @@ stdenv.mkDerivation rec {
     runHook postInstall
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "C++ framework for json-rpc (json remote procedure call)";
     homepage = "https://github.com/cinemast/libjson-rpc-cpp";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/libjson/default.nix b/pkgs/development/libraries/libjson/default.nix
index 1d6fb1e72897e..42d723b3b1b42 100644
--- a/pkgs/development/libraries/libjson/default.nix
+++ b/pkgs/development/libraries/libjson/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, unzip }:
+{ lib, stdenv, fetchurl, unzip }:
 let
   version = "7.6.1";
 in stdenv.mkDerivation {
@@ -13,7 +13,7 @@ in stdenv.mkDerivation {
   makeFlags = [ "prefix=$(out)" ];
   preInstall = "mkdir -p $out/lib";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://libjson.sourceforge.net/";
     description = "A JSON reader and writer";
     longDescription = ''
diff --git a/pkgs/development/libraries/libkate/default.nix b/pkgs/development/libraries/libkate/default.nix
index a999f813fbb4f..2135cc37d91e5 100644
--- a/pkgs/development/libraries/libkate/default.nix
+++ b/pkgs/development/libraries/libkate/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, libogg, libpng }:
+{ lib, stdenv, fetchurl, libogg, libpng }:
 
 stdenv.mkDerivation rec {
   name = "libkate-0.4.1";
@@ -10,7 +10,7 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ libogg libpng ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A library for encoding and decoding Kate streams";
     longDescription = ''
       This is libkate, the reference implementation of a codec for the Kate
diff --git a/pkgs/development/libraries/libkeyfinder/default.nix b/pkgs/development/libraries/libkeyfinder/default.nix
index b6aa19c442a73..d2aecccdedffa 100644
--- a/pkgs/development/libraries/libkeyfinder/default.nix
+++ b/pkgs/development/libraries/libkeyfinder/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, fftw, qtbase, qmake }:
+{ lib, stdenv, fetchFromGitHub, fftw, qtbase, qmake }:
 
 stdenv.mkDerivation rec {
   pname = "libkeyfinder";
@@ -29,7 +29,7 @@ stdenv.mkDerivation rec {
     cp -a lib*.so* $out/lib
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Musical key detection for digital audio (C++ library)";
     homepage = "http://www.ibrahimshaath.co.uk/keyfinder/";
     license = licenses.gpl3Plus;
diff --git a/pkgs/development/libraries/libkml/default.nix b/pkgs/development/libraries/libkml/default.nix
index 690d9b9801cab..0e2ab21ee7927 100644
--- a/pkgs/development/libraries/libkml/default.nix
+++ b/pkgs/development/libraries/libkml/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , cmake
 , boost
@@ -27,7 +27,7 @@ stdenv.mkDerivation rec {
   cmakeFlags = [
     "-DBUILD_TESTING=ON"
   # Darwin tests require rpath for libs in build dir
-  ] ++ stdenv.lib.optional stdenv.isDarwin [
+  ] ++ lib.optional stdenv.isDarwin [
     "-DCMAKE_SKIP_BUILD_RPATH=OFF"
   ];
 
@@ -46,7 +46,7 @@ stdenv.mkDerivation rec {
 
   doCheck = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Reference implementation of OGC KML 2.2";
     homepage = "https://github.com/libkml/libkml";
     license = licenses.bsd3;
diff --git a/pkgs/development/libraries/libksba/default.nix b/pkgs/development/libraries/libksba/default.nix
index 7e14c1b533b56..e623aa0d11197 100644
--- a/pkgs/development/libraries/libksba/default.nix
+++ b/pkgs/development/libraries/libksba/default.nix
@@ -1,4 +1,4 @@
-{ buildPackages, stdenv, fetchurl, gettext, libgpgerror }:
+{ buildPackages, lib, stdenv, fetchurl, gettext, libgpgerror }:
 
 stdenv.mkDerivation rec {
   name = "libksba-1.5.0";
@@ -22,7 +22,7 @@ stdenv.mkDerivation rec {
     rmdir --ignore-fail-on-non-empty $out/bin
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://www.gnupg.org";
     description = "CMS and X.509 access library";
     platforms = platforms.all;
diff --git a/pkgs/development/libraries/libksi/default.nix b/pkgs/development/libraries/libksi/default.nix
index 2701cc5135980..015121811710b 100644
--- a/pkgs/development/libraries/libksi/default.nix
+++ b/pkgs/development/libraries/libksi/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, autoreconfHook, openssl, curl }:
+{ lib, stdenv, fetchFromGitHub, autoreconfHook, openssl, curl }:
 
 stdenv.mkDerivation rec {
   pname = "libksi";
@@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
     "--with-cafile=/etc/ssl/certs/ca-certificates.crt"
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/GuardTime/libksi";
     description = "Keyless Signature Infrastructure API library";
     license = licenses.asl20;
diff --git a/pkgs/development/libraries/libktorrent/default.nix b/pkgs/development/libraries/libktorrent/default.nix
index 9aea99f6a4038..610efa7ed4f4c 100644
--- a/pkgs/development/libraries/libktorrent/default.nix
+++ b/pkgs/development/libraries/libktorrent/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, cmake, extra-cmake-modules
+{ lib, stdenv, fetchurl, cmake, extra-cmake-modules
 , karchive, kcrash, ki18n, kio, solid
 , boost, gmp, qca-qt5, libgcrypt
 }:
@@ -27,7 +27,7 @@ in stdenv.mkDerivation rec {
     inherit mainVersion;
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A BitTorrent library used by KTorrent";
     homepage    = "https://www.kde.org/applications/internet/ktorrent/";
     maintainers = with maintainers; [ eelco ];
diff --git a/pkgs/development/libraries/liblangtag/default.nix b/pkgs/development/libraries/liblangtag/default.nix
index 30342ea24c86a..0198888f2b5c4 100644
--- a/pkgs/development/libraries/liblangtag/default.nix
+++ b/pkgs/development/libraries/liblangtag/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, fetchFromBitbucket, autoreconfHook, gtk-doc, gettext
+{ lib, stdenv, fetchurl, fetchFromBitbucket, autoreconfHook, gtk-doc, gettext
 , pkg-config, glib, libxml2, gobject-introspection, gnome-common, unzip
 }:
 
@@ -42,9 +42,9 @@ stdenv.mkDerivation rec {
   meta = {
     inherit version;
     description = "An interface library to access tags for identifying languages";
-    license = stdenv.lib.licenses.mpl20;
-    maintainers = [stdenv.lib.maintainers.raskin];
-    platforms = stdenv.lib.platforms.linux;
+    license = lib.licenses.mpl20;
+    maintainers = [lib.maintainers.raskin];
+    platforms = lib.platforms.linux;
     # There are links to a homepage that are broken by a BitBucket change
     homepage = "https://bitbucket.org/tagoh/liblangtag/overview";
   };
diff --git a/pkgs/development/libraries/liblastfm/default.nix b/pkgs/development/libraries/liblastfm/default.nix
index 2bf33bab4166a..10cdb3014791c 100644
--- a/pkgs/development/libraries/liblastfm/default.nix
+++ b/pkgs/development/libraries/liblastfm/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, fetchpatch, pkg-config, which, cmake
+{ lib, stdenv, fetchFromGitHub, fetchpatch, pkg-config, which, cmake
 , fftwSinglePrec, libsamplerate, qtbase
 , darwin }:
 
@@ -21,9 +21,9 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ pkg-config which cmake ];
   buildInputs = [ fftwSinglePrec libsamplerate qtbase ]
-    ++ stdenv.lib.optional stdenv.isDarwin darwin.apple_sdk.frameworks.SystemConfiguration;
+    ++ lib.optional stdenv.isDarwin darwin.apple_sdk.frameworks.SystemConfiguration;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/lastfm/liblastfm";
     repositories.git = "git://github.com/lastfm/liblastfm.git";
     description = "Official LastFM library";
diff --git a/pkgs/development/libraries/liblastfmSF/default.nix b/pkgs/development/libraries/liblastfmSF/default.nix
index 4bf8fb7bf65be..fe3038c3249a5 100644
--- a/pkgs/development/libraries/liblastfmSF/default.nix
+++ b/pkgs/development/libraries/liblastfmSF/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, curl, openssl }:
+{ lib, stdenv, fetchurl, pkg-config, curl, openssl }:
 
 stdenv.mkDerivation {
   name = "liblastfm-SF-0.5";
@@ -15,6 +15,6 @@ stdenv.mkDerivation {
   meta = {
     homepage = "http://liblastfm.sourceforge.net";
     description = "Unofficial C lastfm library";
-    license = stdenv.lib.licenses.gpl3;
+    license = lib.licenses.gpl3;
   };
 }
diff --git a/pkgs/development/libraries/liblaxjson/default.nix b/pkgs/development/libraries/liblaxjson/default.nix
index ef50c106eae1c..9464714d5cc90 100644
--- a/pkgs/development/libraries/liblaxjson/default.nix
+++ b/pkgs/development/libraries/liblaxjson/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake }:
+{ lib, stdenv, fetchFromGitHub, cmake }:
 
 stdenv.mkDerivation rec {
   version = "1.0.5";
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ cmake ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Library for parsing JSON config files";
     homepage = "https://github.com/andrewrk/liblaxjson";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/liblcf/default.nix b/pkgs/development/libraries/liblcf/default.nix
index 3783bd408f1be..2c7f098928209 100644
--- a/pkgs/development/libraries/liblcf/default.nix
+++ b/pkgs/development/libraries/liblcf/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, autoreconfHook, pkg-config, expat, icu }:
+{ lib, stdenv, fetchFromGitHub, autoreconfHook, pkg-config, expat, icu }:
 
 stdenv.mkDerivation rec {
   pname = "liblcf";
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ autoreconfHook pkg-config ];
   propagatedBuildInputs = [ expat icu ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Library to handle RPG Maker 2000/2003 and EasyRPG projects";
     homepage = "https://github.com/EasyRPG/liblcf";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/liblinear/default.nix b/pkgs/development/libraries/liblinear/default.nix
index 67eb8748f16c3..3989cc59e4d86 100644
--- a/pkgs/development/libraries/liblinear/default.nix
+++ b/pkgs/development/libraries/liblinear/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, fixDarwinDylibNames }:
+{ lib, stdenv, fetchFromGitHub, fixDarwinDylibNames }:
 
 let
   soVersion = "4";
@@ -15,7 +15,7 @@ in stdenv.mkDerivation rec {
 
   outputs = [ "bin" "dev" "out" ];
 
-  nativeBuildInputs = stdenv.lib.optionals stdenv.isDarwin [ fixDarwinDylibNames ];
+  nativeBuildInputs = lib.optionals stdenv.isDarwin [ fixDarwinDylibNames ];
 
   buildFlags = [ "lib" "predict" "train" ];
 
@@ -32,7 +32,7 @@ in stdenv.mkDerivation rec {
     install -Dm444 -t $dev/include linear.h
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A library for large linear classification";
     homepage = "https://www.csie.ntu.edu.tw/~cjlin/liblinear/";
     license = licenses.bsd3;
diff --git a/pkgs/development/libraries/liblinphone/default.nix b/pkgs/development/libraries/liblinphone/default.nix
index 5c06dea390f41..f56e6a9a5c780 100644
--- a/pkgs/development/libraries/liblinphone/default.nix
+++ b/pkgs/development/libraries/liblinphone/default.nix
@@ -40,7 +40,7 @@
 , soci
 , speex
 , sqlite
-, stdenv
+, lib, stdenv
 , udev
 , xercesc
 , xsd
@@ -123,7 +123,7 @@ stdenv.mkDerivation rec {
     ln -s ${belcard}/share/belr/grammars/* $out/share/belr/grammars/
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://www.linphone.org/technical-corner/liblinphone";
     description = "Library for SIP calls and instant messaging";
     license = licenses.gpl3Plus;
diff --git a/pkgs/development/libraries/liblo/default.nix b/pkgs/development/libraries/liblo/default.nix
index a25666dfcf26d..5f5b23cdc3a1c 100644
--- a/pkgs/development/libraries/liblo/default.nix
+++ b/pkgs/development/libraries/liblo/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
   name = "liblo-0.31";
@@ -13,8 +13,8 @@ stdenv.mkDerivation rec {
   meta = {
     description = "Lightweight library to handle the sending and receiving of messages according to the Open Sound Control (OSC) protocol";
     homepage = "https://sourceforge.net/projects/liblo";
-    license = stdenv.lib.licenses.gpl2;
-    maintainers = [stdenv.lib.maintainers.marcweber];
-    platforms = with stdenv.lib.platforms; linux ++ darwin;
+    license = lib.licenses.gpl2;
+    maintainers = [lib.maintainers.marcweber];
+    platforms = with lib.platforms; linux ++ darwin;
   };
 }
diff --git a/pkgs/development/libraries/liblockfile/default.nix b/pkgs/development/libraries/liblockfile/default.nix
index 6ed995572ef35..a2587702bb3f7 100644
--- a/pkgs/development/libraries/liblockfile/default.nix
+++ b/pkgs/development/libraries/liblockfile/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
   _name   = "liblockfile";
@@ -21,9 +21,9 @@ stdenv.mkDerivation rec {
   meta = {
     description = "Shared library with NFS-safe locking functions";
     homepage = "http://packages.debian.org/unstable/libs/liblockfile1";
-    license = stdenv.lib.licenses.gpl2Plus;
+    license = lib.licenses.gpl2Plus;
 
-    maintainers = [ stdenv.lib.maintainers.bluescreen303 ];
-    platforms = stdenv.lib.platforms.all;
+    maintainers = [ lib.maintainers.bluescreen303 ];
+    platforms = lib.platforms.all;
   };
 }
diff --git a/pkgs/development/libraries/liblogging/default.nix b/pkgs/development/libraries/liblogging/default.nix
index 5602231e34d84..4a28bf6774124 100644
--- a/pkgs/development/libraries/liblogging/default.nix
+++ b/pkgs/development/libraries/liblogging/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config
+{ lib, stdenv, fetchurl, pkg-config
 , systemd ? null
 }:
 
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
     "--enable-man-pages"
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://www.liblogging.org/";
     description = "Lightweight signal-safe logging library";
     license = licenses.bsd2;
diff --git a/pkgs/development/libraries/liblognorm/default.nix b/pkgs/development/libraries/liblognorm/default.nix
index d3a6b59974298..293f72d67b2b2 100644
--- a/pkgs/development/libraries/liblognorm/default.nix
+++ b/pkgs/development/libraries/liblognorm/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, libestr, json_c, pcre, fastJson }:
+{ lib, stdenv, fetchurl, pkg-config, libestr, json_c, pcre, fastJson }:
 
 stdenv.mkDerivation rec {
   name = "liblognorm-2.0.6";
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
 
   configureFlags = [ "--enable-regexp" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://www.liblognorm.com/";
     description = "Help to make sense out of syslog data, or, actually, any event data that is present in text form";
     license = licenses.lgpl21;
diff --git a/pkgs/development/libraries/liblouis/default.nix b/pkgs/development/libraries/liblouis/default.nix
index 3e83e34ee812b..1dec830566f81 100644
--- a/pkgs/development/libraries/liblouis/default.nix
+++ b/pkgs/development/libraries/liblouis/default.nix
@@ -1,5 +1,5 @@
 { fetchFromGitHub
-, stdenv
+, lib, stdenv
 , autoreconfHook
 , pkg-config
 , gettext
@@ -58,7 +58,7 @@ stdenv.mkDerivation rec {
 
   doCheck = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Open-source braille translator and back-translator";
     homepage = "http://liblouis.org/";
     license = licenses.lgpl21;
diff --git a/pkgs/development/libraries/liblqr-1/default.nix b/pkgs/development/libraries/liblqr-1/default.nix
index 936469c01c616..b871dbdb19d22 100644
--- a/pkgs/development/libraries/liblqr-1/default.nix
+++ b/pkgs/development/libraries/liblqr-1/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, glib }:
+{ lib, stdenv, fetchurl, pkg-config, glib }:
 
 stdenv.mkDerivation rec {
   name = "liblqr-1-0.4.2";
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ pkg-config ];
   propagatedBuildInputs = [ glib ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://liblqr.wikidot.com";
     description = "Seam-carving C/C++ library called Liquid Rescaling";
     platforms = platforms.all;
diff --git a/pkgs/development/libraries/liblscp/default.nix b/pkgs/development/libraries/liblscp/default.nix
index 4ee37dc0b9f37..dcb862f2cd4d5 100644
--- a/pkgs/development/libraries/liblscp/default.nix
+++ b/pkgs/development/libraries/liblscp/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, autoconf, automake, libtool, pkg-config }:
+{ lib, stdenv, fetchurl, autoconf, automake, libtool, pkg-config }:
 
 stdenv.mkDerivation rec {
   pname = "liblscp";
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://www.linuxsampler.org";
     description = "LinuxSampler Control Protocol (LSCP) wrapper library";
     license = licenses.gpl2;
diff --git a/pkgs/development/libraries/libltc/default.nix b/pkgs/development/libraries/libltc/default.nix
index 4513396d7eaf7..2391d281d46a6 100644
--- a/pkgs/development/libraries/libltc/default.nix
+++ b/pkgs/development/libraries/libltc/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl}:
+{lib, stdenv, fetchurl}:
 
 stdenv.mkDerivation {
   name = "libltc-1.3.1";
@@ -8,7 +8,7 @@ stdenv.mkDerivation {
     sha256 = "173h9dgmain3nyrwk6q2d7yl4fnh4vacag4s2p01n5b7nyrkxrjh";
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://x42.github.io/libltc/";
     description = "POSIX-C Library for handling Linear/Logitudinal Time Code (LTC)";
     license = licenses.lgpl3Plus;
diff --git a/pkgs/development/libraries/liblxi/default.nix b/pkgs/development/libraries/liblxi/default.nix
index ebb8cbe0376c0..1ca4043a024d9 100644
--- a/pkgs/development/libraries/liblxi/default.nix
+++ b/pkgs/development/libraries/liblxi/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub
+{ lib, stdenv, fetchFromGitHub
 , pkg-config, autoreconfHook
 , libtirpc, rpcsvc-proto, avahi, libxml2
 }:
@@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ libtirpc avahi libxml2 ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Library for communicating with LXI compatible instruments";
     longDescription = ''
       liblxi is an open source software library which offers a simple
diff --git a/pkgs/development/libraries/libmad/default.nix b/pkgs/development/libraries/libmad/default.nix
index 84800f309fb4b..dd79234868657 100644
--- a/pkgs/development/libraries/libmad/default.nix
+++ b/pkgs/development/libraries/libmad/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, fetchpatch, autoconf }:
+{ lib, stdenv, fetchurl, fetchpatch, autoconf }:
 
 stdenv.mkDerivation rec {
   pname = "libmad";
@@ -36,7 +36,7 @@ stdenv.mkDerivation rec {
   # optimize.diff is taken from https://projects.archlinux.org/svntogit/packages.git/tree/trunk/optimize.diff?h=packages/libmad
   # It is included here in order to fix a build failure in Clang
   # But it may be useful to fix other, currently unknown problems as well
-  ++ stdenv.lib.optionals stdenv.cc.isClang [
+  ++ lib.optionals stdenv.cc.isClang [
     (fetchpatch {
       url = "https://github.com/KaOSx/main/raw/1270b8080f37fb6cca562829a521991800b0a497/libmad/optimize.diff";
       sha256 = "0hcxzz9ql1fizyqbsgdchdwi7bvchfr72172j43hpyj53p0yabc6";
@@ -53,7 +53,7 @@ stdenv.mkDerivation rec {
 
   preConfigure = "autoconf";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage    = "https://sourceforge.net/projects/mad/";
     description = "A high-quality, fixed-point MPEG audio decoder supporting MPEG-1 and MPEG-2";
     license     = licenses.gpl2;
diff --git a/pkgs/development/libraries/libmanette/default.nix b/pkgs/development/libraries/libmanette/default.nix
index 96593fb50bf06..76dd4eb20c1a0 100644
--- a/pkgs/development/libraries/libmanette/default.nix
+++ b/pkgs/development/libraries/libmanette/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , ninja
 , meson
@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
   outputs = [ "out" "dev" "devdoc" ];
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "1b3bcdkk5xd5asq797cch9id8692grsjxrc1ss87vv11m1ck4rb3";
   };
 
@@ -54,7 +54,7 @@ stdenv.mkDerivation rec {
     };
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A simple GObject game controller library";
     homepage = "https://gnome.pages.gitlab.gnome.org/libmanette/";
     license = licenses.lgpl21Plus;
diff --git a/pkgs/development/libraries/libmatchbox/default.nix b/pkgs/development/libraries/libmatchbox/default.nix
index 49769359ed328..50b66eccfb3d6 100644
--- a/pkgs/development/libraries/libmatchbox/default.nix
+++ b/pkgs/development/libraries/libmatchbox/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, libX11, libXext, libpng, libXft, libICE, pango, libjpeg}:
+{ lib, stdenv, fetchurl, libX11, libXext, libpng, libXft, libICE, pango, libjpeg}:
 
 stdenv.mkDerivation rec {
   pname = "libmatchbox";
@@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
   meta = {
     description = "Library of the matchbox X window manager";
     homepage = "http://matchbox-project.org/";
-    license = stdenv.lib.licenses.gpl2Plus;
-    platforms = stdenv.lib.platforms.unix;
+    license = lib.licenses.gpl2Plus;
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/libmatheval/default.nix b/pkgs/development/libraries/libmatheval/default.nix
index b794c1f7217cb..b0fe1c35ef3a6 100644
--- a/pkgs/development/libraries/libmatheval/default.nix
+++ b/pkgs/development/libraries/libmatheval/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, guile, autoconf, flex, fetchpatch }:
+{ lib, stdenv, fetchurl, pkg-config, guile, autoconf, flex, fetchpatch }:
 
 stdenv.mkDerivation rec {
   version = "1.1.11";
@@ -38,9 +38,9 @@ stdenv.mkDerivation rec {
       symbolic derivatives and output expressions to strings.
     '';
     homepage = "https://www.gnu.org/software/libmatheval/";
-    license = stdenv.lib.licenses.gpl3;
-    maintainers = [ stdenv.lib.maintainers.bzizou ];
-    platforms = stdenv.lib.platforms.linux;
+    license = lib.licenses.gpl3;
+    maintainers = [ lib.maintainers.bzizou ];
+    platforms = lib.platforms.linux;
   };
 }
 
diff --git a/pkgs/development/libraries/libmatroska/default.nix b/pkgs/development/libraries/libmatroska/default.nix
index ab8107b39c47e..1d3cf4032ddad 100644
--- a/pkgs/development/libraries/libmatroska/default.nix
+++ b/pkgs/development/libraries/libmatroska/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, pkg-config
+{ lib, stdenv, fetchFromGitHub, cmake, pkg-config
 , libebml }:
 
 stdenv.mkDerivation rec {
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
     "-DBUILD_SHARED_LIBS=YES"
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A library to parse Matroska files";
     homepage = "https://matroska.org/";
     license = licenses.lgpl21;
diff --git a/pkgs/development/libraries/libmaxminddb/default.nix b/pkgs/development/libraries/libmaxminddb/default.nix
index 2b4d75bba75f2..078865198a453 100644
--- a/pkgs/development/libraries/libmaxminddb/default.nix
+++ b/pkgs/development/libraries/libmaxminddb/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
   pname = "libmaxminddb";
@@ -9,7 +9,7 @@ stdenv.mkDerivation rec {
     sha256 = "sha256-fFbnkf8qZVIV5+04ZLH/3X00o4g1d57+1WpC8Fa9WKo=";
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "C library for working with MaxMind geolocation DB files";
     homepage = "https://github.com/maxmind/libmaxminddb";
     license = licenses.asl20;
diff --git a/pkgs/development/libraries/libmbim/default.nix b/pkgs/development/libraries/libmbim/default.nix
index fdf724c09fda6..850c7aa1df0c0 100644
--- a/pkgs/development/libraries/libmbim/default.nix
+++ b/pkgs/development/libraries/libmbim/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , pkg-config
 , gobject-introspection
@@ -38,7 +38,7 @@ stdenv.mkDerivation rec {
 
   doCheck = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://www.freedesktop.org/wiki/Software/libmbim/";
     description = "Library for talking to WWAN modems and devices which speak the Mobile Interface Broadband Model (MBIM) protocol";
     platforms = platforms.linux;
diff --git a/pkgs/development/libraries/libmcrypt/default.nix b/pkgs/development/libraries/libmcrypt/default.nix
index 59498170a1d40..44c55cb4682b7 100644
--- a/pkgs/development/libraries/libmcrypt/default.nix
+++ b/pkgs/development/libraries/libmcrypt/default.nix
@@ -1,6 +1,6 @@
-{ stdenv, fetchurl, darwin, disablePosixThreads ? false }:
+{ lib, stdenv, fetchurl, darwin, disablePosixThreads ? false }:
 
-with stdenv.lib;
+with lib;
 
 stdenv.mkDerivation {
   name = "libmcrypt-2.5.8";
diff --git a/pkgs/development/libraries/libmd/default.nix b/pkgs/development/libraries/libmd/default.nix
index e3dd0b206f104..7093376aa7e53 100644
--- a/pkgs/development/libraries/libmd/default.nix
+++ b/pkgs/development/libraries/libmd/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, autoreconfHook }:
+{ lib, stdenv, fetchurl, autoreconfHook }:
 
 stdenv.mkDerivation rec {
   pname = "libmd";
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ autoreconfHook ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://www.hadrons.org/software/${pname}/";
     changelog = "https://archive.hadrons.org/software/libmd/libmd-${version}.announce";
     # Git: https://git.hadrons.org/cgit/libmd.git
diff --git a/pkgs/development/libraries/libmediaart/default.nix b/pkgs/development/libraries/libmediaart/default.nix
index 1007123619f06..28c8ae6db9405 100644
--- a/pkgs/development/libraries/libmediaart/default.nix
+++ b/pkgs/development/libraries/libmediaart/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, meson, ninja, pkg-config, vala, gtk-doc, docbook_xsl, docbook_xml_dtd_412, glib, gdk-pixbuf, gobject-introspection, gnome3, fetchpatch }:
+{ lib, stdenv, fetchurl, meson, ninja, pkg-config, vala, gtk-doc, docbook_xsl, docbook_xml_dtd_412, glib, gdk-pixbuf, gobject-introspection, gnome3, fetchpatch }:
 
 stdenv.mkDerivation rec {
   pname = "libmediaart";
@@ -7,7 +7,7 @@ stdenv.mkDerivation rec {
   outputs = [ "out" "dev" "devdoc" ];
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "a57be017257e4815389afe4f58fdacb6a50e74fd185452b23a652ee56b04813d";
   };
 
@@ -33,7 +33,7 @@ stdenv.mkDerivation rec {
     };
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Library tasked with managing, extracting and handling media art caches";
     maintainers = teams.gnome.members;
     license = licenses.gpl2;
diff --git a/pkgs/development/libraries/libmediainfo/default.nix b/pkgs/development/libraries/libmediainfo/default.nix
index 0974371c41ee4..d78ccbc50aba1 100644
--- a/pkgs/development/libraries/libmediainfo/default.nix
+++ b/pkgs/development/libraries/libmediainfo/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, autoreconfHook, pkg-config, libzen, zlib }:
+{ lib, stdenv, fetchurl, autoreconfHook, pkg-config, libzen, zlib }:
 
 stdenv.mkDerivation rec {
   version = "20.09";
@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
     install -vD -m 644 libmediainfo.pc "$out/lib/pkgconfig/libmediainfo.pc"
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Shared library for mediainfo";
     homepage = "https://mediaarea.net/";
     license = licenses.bsd2;
diff --git a/pkgs/development/libraries/libmemcached/default.nix b/pkgs/development/libraries/libmemcached/default.nix
index 8cbb76377fb0c..0ee0701d92904 100644
--- a/pkgs/development/libraries/libmemcached/default.nix
+++ b/pkgs/development/libraries/libmemcached/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, fetchpatch, cyrus_sasl, libevent }:
+{ lib, stdenv, fetchurl, fetchpatch, cyrus_sasl, libevent }:
 
 stdenv.mkDerivation {
   name = "libmemcached-1.0.18";
@@ -13,19 +13,19 @@ stdenv.mkDerivation {
   # https://bugs.launchpad.net/libmemcached/+bug/1281907
   # Fix building on macOS (patch from Homebrew)
   # https://bugs.launchpad.net/libmemcached/+bug/1245562
-  patches = stdenv.lib.optional stdenv.isLinux ./libmemcached-fix-linking-with-libpthread.patch
-    ++ stdenv.lib.optional stdenv.isDarwin (fetchpatch {
+  patches = lib.optional stdenv.isLinux ./libmemcached-fix-linking-with-libpthread.patch
+    ++ lib.optional stdenv.isDarwin (fetchpatch {
       url = "https://raw.githubusercontent.com/Homebrew/homebrew/bfd4a0a4626b61c2511fdf573bcbbc6bbe86340e/Library/Formula/libmemcached.rb";
       sha256 = "1gjf3vd7hiyzxjvlg2zfc3y2j0lyr6nhbws4xb5dmin3csyp8qb8";
     })
-    ++ stdenv.lib.optional stdenv.hostPlatform.isMusl ./musl-fixes.patch;
+    ++ lib.optional stdenv.hostPlatform.isMusl ./musl-fixes.patch;
 
   buildInputs = [ libevent ];
   propagatedBuildInputs = [ cyrus_sasl ];
 
   NIX_CFLAGS_COMPILE = "-fpermissive";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://libmemcached.org";
     description = "Open source C/C++ client library and tools for the memcached server";
     license = licenses.bsd3;
diff --git a/pkgs/development/libraries/libmesode/default.nix b/pkgs/development/libraries/libmesode/default.nix
index 54ff0dccb90ee..128975246a8ae 100644
--- a/pkgs/development/libraries/libmesode/default.nix
+++ b/pkgs/development/libraries/libmesode/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , autoreconfHook
 , libtool
@@ -26,7 +26,7 @@ stdenv.mkDerivation rec {
 
   doCheck = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Fork of libstrophe (https://github.com/strophe/libstrophe) for use with Profanity XMPP Client";
     longDescription = ''
       Reasons for forking:
diff --git a/pkgs/development/libraries/libmhash/default.nix b/pkgs/development/libraries/libmhash/default.nix
index 2a61c57106693..f569ce7fac753 100644
--- a/pkgs/development/libraries/libmhash/default.nix
+++ b/pkgs/development/libraries/libmhash/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
   pname = "mhash";
@@ -23,6 +23,6 @@ stdenv.mkDerivation rec {
     '';
     homepage = "http://mhash.sourceforge.net";
     license = "LGPL";
-    platforms = stdenv.lib.platforms.unix;
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/libmicrodns/default.nix b/pkgs/development/libraries/libmicrodns/default.nix
index 5bed556a27332..c9dd899a2b00c 100644
--- a/pkgs/development/libraries/libmicrodns/default.nix
+++ b/pkgs/development/libraries/libmicrodns/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , meson
 , ninja
@@ -22,7 +22,7 @@ stdenv.mkDerivation rec {
     pkg-config
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Minimal mDNS resolver library, used by VLC";
     homepage = "https://github.com/videolabs/libmicrodns";
     license = licenses.lgpl21;
diff --git a/pkgs/development/libraries/libmicrohttpd/generic.nix b/pkgs/development/libraries/libmicrohttpd/generic.nix
index 99407d22b7518..336b66ac83230 100644
--- a/pkgs/development/libraries/libmicrohttpd/generic.nix
+++ b/pkgs/development/libraries/libmicrohttpd/generic.nix
@@ -1,4 +1,4 @@
-{ stdenv, libgcrypt, curl, gnutls, pkg-config, libiconv, libintl, version, src }:
+{ lib, stdenv, libgcrypt, curl, gnutls, pkg-config, libiconv, libintl, version, src }:
 
 stdenv.mkDerivation rec {
   pname = "libmicrohttpd";
@@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
   # Disabled because the tests can time-out.
   doCheck = false;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Embeddable HTTP server library";
 
     longDescription = ''
diff --git a/pkgs/development/libraries/libmikmod/default.nix b/pkgs/development/libraries/libmikmod/default.nix
index 59967bcba5a23..a734a4b800928 100644
--- a/pkgs/development/libraries/libmikmod/default.nix
+++ b/pkgs/development/libraries/libmikmod/default.nix
@@ -1,7 +1,7 @@
-{ stdenv, fetchurl, texinfo, alsaLib, libpulseaudio, CoreAudio }:
+{ lib, stdenv, fetchurl, texinfo, alsaLib, libpulseaudio, CoreAudio }:
 
 let
-  inherit (stdenv.lib) optional optionalString;
+  inherit (lib) optional optionalString;
 
 in stdenv.mkDerivation rec {
   name = "libmikmod-3.3.11.1";
@@ -18,7 +18,7 @@ in stdenv.mkDerivation rec {
 
   NIX_LDFLAGS = optionalString stdenv.isLinux "-lasound";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A library for playing tracker music module files";
     homepage    = "https://mikmod.shlomifish.org/";
     license     = licenses.lgpl2Plus;
diff --git a/pkgs/development/libraries/libmilter/default.nix b/pkgs/development/libraries/libmilter/default.nix
index f937d818a559a..9287b0a0dea78 100644
--- a/pkgs/development/libraries/libmilter/default.nix
+++ b/pkgs/development/libraries/libmilter/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, m4 }:
+{ lib, stdenv, fetchurl, m4 }:
 
 stdenv.mkDerivation rec {
   pname = "libmilter";
@@ -36,7 +36,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ m4 ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Sendmail Milter mail filtering API library";
     platforms = platforms.unix;
     maintainers = with maintainers; [ fpletz ];
diff --git a/pkgs/development/libraries/libminc/default.nix b/pkgs/development/libraries/libminc/default.nix
index ce39285e0d239..2440082cce9d7 100644
--- a/pkgs/development/libraries/libminc/default.nix
+++ b/pkgs/development/libraries/libminc/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, zlib, netcdf, nifticlib, hdf5 }:
+{ lib, stdenv, fetchFromGitHub, cmake, zlib, netcdf, nifticlib, hdf5 }:
 
 stdenv.mkDerivation rec {
   pname   = "libminc";
@@ -35,7 +35,7 @@ stdenv.mkDerivation rec {
     # ezminc_rw_test: can't find libminc_io.so.5.2.0
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/BIC-MNI/libminc";
     description = "Medical imaging library based on HDF5";
     maintainers = with maintainers; [ bcdarwin ];
diff --git a/pkgs/development/libraries/libmkv/default.nix b/pkgs/development/libraries/libmkv/default.nix
index 9a754eda592fb..584d76e1cf2b3 100644
--- a/pkgs/development/libraries/libmkv/default.nix
+++ b/pkgs/development/libraries/libmkv/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, libtool, autoconf, automake }:
+{ lib, stdenv, fetchFromGitHub, libtool, autoconf, automake }:
 
 stdenv.mkDerivation rec {
   pname = "libmkv";
@@ -22,8 +22,8 @@ stdenv.mkDerivation rec {
       It is written in plain C, and intended to be very portable.
     '';
     homepage = "https://github.com/saintdev/libmkv";
-    license = stdenv.lib.licenses.gpl2;
-    maintainers = [ stdenv.lib.maintainers.wmertens ];
-    platforms = stdenv.lib.platforms.unix;
+    license = lib.licenses.gpl2;
+    maintainers = [ lib.maintainers.wmertens ];
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/libmms/default.nix b/pkgs/development/libraries/libmms/default.nix
index a56b18fe19908..83add1d42a5d4 100644
--- a/pkgs/development/libraries/libmms/default.nix
+++ b/pkgs/development/libraries/libmms/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, glib, pkg-config }:
+{ lib, stdenv, fetchurl, glib, pkg-config }:
 
 stdenv.mkDerivation rec {
   name = "libmms-0.6.4";
@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ pkg-config ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Library for downloading (streaming) media files using the mmst and mmsh protocols";
     homepage = "http://libmms.sourceforge.net";
     platforms = platforms.all;
diff --git a/pkgs/development/libraries/libmng/default.nix b/pkgs/development/libraries/libmng/default.nix
index e13bda5679324..f1704a527b448 100644
--- a/pkgs/development/libraries/libmng/default.nix
+++ b/pkgs/development/libraries/libmng/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, zlib, libpng, libjpeg, lcms2 }:
+{ lib, stdenv, fetchurl, zlib, libpng, libjpeg, lcms2 }:
 
 stdenv.mkDerivation rec {
   name = "libmng-2.0.3";
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
 
   propagatedBuildInputs = [ zlib libpng libjpeg lcms2 ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Reference library for reading, displaying, writing and examining Multiple-Image Network Graphics";
     homepage = "http://www.libmng.com";
     license = licenses.zlib;
diff --git a/pkgs/development/libraries/libmnl/default.nix b/pkgs/development/libraries/libmnl/default.nix
index 3db6ab0da0811..4e99258a3e805 100644
--- a/pkgs/development/libraries/libmnl/default.nix
+++ b/pkgs/development/libraries/libmnl/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
   name = "libmnl-1.0.4";
@@ -18,8 +18,8 @@ stdenv.mkDerivation rec {
       re-inventing the wheel.
     '';
     homepage = "https://netfilter.org/projects/libmnl/index.html";
-    license = stdenv.lib.licenses.lgpl21Plus;
+    license = lib.licenses.lgpl21Plus;
 
-    platforms = stdenv.lib.platforms.linux;
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/development/libraries/libmodbus/default.nix b/pkgs/development/libraries/libmodbus/default.nix
index 14f80e9b2e5a6..b311c4f041818 100644
--- a/pkgs/development/libraries/libmodbus/default.nix
+++ b/pkgs/development/libraries/libmodbus/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
   name = "libmodbus-3.1.6";
@@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
     "ac_cv_func_realloc_0_nonnull=yes"
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Library to send/receive data according to the Modbus protocol";
     homepage = "https://libmodbus.org/";
     license = licenses.lgpl21Plus;
diff --git a/pkgs/development/libraries/libmodplug/default.nix b/pkgs/development/libraries/libmodplug/default.nix
index 2d38a5021e512..790674f1649ed 100644
--- a/pkgs/development/libraries/libmodplug/default.nix
+++ b/pkgs/development/libraries/libmodplug/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, file }:
+{ lib, stdenv, fetchurl, file }:
 
 let
   version = "0.8.9.0";
@@ -12,7 +12,7 @@ in stdenv.mkDerivation rec {
         --replace /usr/bin/file ${file}/bin/file
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "MOD playing library";
     homepage    = "http://modplug-xmms.sourceforge.net/";
     license     = licenses.publicDomain;
diff --git a/pkgs/development/libraries/libmodule/default.nix b/pkgs/development/libraries/libmodule/default.nix
index 2848298016dd7..d77d2bcbdcd74 100644
--- a/pkgs/development/libraries/libmodule/default.nix
+++ b/pkgs/development/libraries/libmodule/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub
+{ lib, stdenv, fetchFromGitHub
 , cmake, pkg-config }:
 
 stdenv.mkDerivation rec {
@@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
     pkg-config
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "C simple and elegant implementation of an actor library";
     homepage = "https://github.com/FedeDP/libmodule";
     platforms = platforms.linux;
diff --git a/pkgs/development/libraries/libmodulemd/default.nix b/pkgs/development/libraries/libmodulemd/default.nix
index a0d32f5178a9b..8a8d9adf53d8e 100644
--- a/pkgs/development/libraries/libmodulemd/default.nix
+++ b/pkgs/development/libraries/libmodulemd/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , substituteAll
 , fetchFromGitHub
 , fetchpatch
@@ -78,7 +78,7 @@ stdenv.mkDerivation rec {
     echo "$out ${python3.pkgs.pygobject3} ${python3.pkgs.six}" > "$py/nix-support/propagated-build-inputs"
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "C Library for manipulating module metadata files";
     homepage = "https://github.com/fedora-modularity/libmodulemd";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/libmongo-client/default.nix b/pkgs/development/libraries/libmongo-client/default.nix
index f07dbd84a95cb..f81f63133384d 100644
--- a/pkgs/development/libraries/libmongo-client/default.nix
+++ b/pkgs/development/libraries/libmongo-client/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, autoreconfHook, pkg-config, glib }:
+{ lib, stdenv, fetchFromGitHub, autoreconfHook, pkg-config, glib }:
 
 stdenv.mkDerivation rec {
   name = "libmongo-client-0.1.8";
@@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
     sed -i 's/Requires.private/Requires/g' src/libmongo-client.pc.in
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://algernon.github.io/libmongo-client/";
     description = "An alternative C driver for MongoDB";
     license = licenses.asl20;
diff --git a/pkgs/development/libraries/libmowgli/default.nix b/pkgs/development/libraries/libmowgli/default.nix
index ae3a9efef24f5..e227c09b2b612 100644
--- a/pkgs/development/libraries/libmowgli/default.nix
+++ b/pkgs/development/libraries/libmowgli/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
   pname = "libmowgli";
@@ -9,7 +9,7 @@ stdenv.mkDerivation rec {
     sha256 = "0xx4vndmwz40pxa5gikl8z8cskpdl9a30i2i5fjncqzlp4pspymp";
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A development framework for C providing high performance and highly flexible algorithms";
     homepage = "https://github.com/atheme/libmowgli-2";
     license = licenses.isc;
diff --git a/pkgs/development/libraries/libmp3splt/default.nix b/pkgs/development/libraries/libmp3splt/default.nix
index 237e3f94cfc9f..58da7560e137f 100644
--- a/pkgs/development/libraries/libmp3splt/default.nix
+++ b/pkgs/development/libraries/libmp3splt/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, libtool, libmad, libid3tag }:
+{ lib, stdenv, fetchurl, libtool, libmad, libid3tag }:
 
 stdenv.mkDerivation rec {
   name = "libmp3splt-0.9.2";
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
 
   configureFlags = [ "--disable-pcre" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage    = "https://sourceforge.net/projects/mp3splt/";
     description = "Utility to split mp3, ogg vorbis and FLAC files without decoding";
     maintainers = with maintainers; [ bosu ];
diff --git a/pkgs/development/libraries/libmpack/default.nix b/pkgs/development/libraries/libmpack/default.nix
index 736474d29a5ff..b62da40499cdd 100644
--- a/pkgs/development/libraries/libmpack/default.nix
+++ b/pkgs/development/libraries/libmpack/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, libtool }:
+{ lib, stdenv, fetchFromGitHub, libtool }:
 
 stdenv.mkDerivation rec {
   pname = "libmpack";
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
 
   makeFlags = [ "LIBTOOL=libtool" "PREFIX=$(out)" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Simple implementation of msgpack in C";
     homepage = "https://github.com/tarruda/libmpack/";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/libmpc/default.nix b/pkgs/development/libraries/libmpc/default.nix
index 79fa174378191..66e38fbfbc04e 100644
--- a/pkgs/development/libraries/libmpc/default.nix
+++ b/pkgs/development/libraries/libmpc/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl
+{ lib, stdenv, fetchurl
 , gmp, mpfr
 }:
 
@@ -33,9 +33,9 @@ stdenv.mkDerivation {
       '';
 
     homepage = "http://mpc.multiprecision.org/";
-    license = stdenv.lib.licenses.lgpl2Plus;
+    license = lib.licenses.lgpl2Plus;
 
-    platforms = stdenv.lib.platforms.all;
+    platforms = lib.platforms.all;
     maintainers = [ ];
   };
 }
diff --git a/pkgs/development/libraries/libmpcdec/default.nix b/pkgs/development/libraries/libmpcdec/default.nix
index 3ee37e6ae9c6b..b42d9a3d1e437 100644
--- a/pkgs/development/libraries/libmpcdec/default.nix
+++ b/pkgs/development/libraries/libmpcdec/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation {
   name = "libmpcdec-1.2.6";
@@ -10,7 +10,7 @@ stdenv.mkDerivation {
 
   meta = {
     description = "Musepack SV7 decoder library";
-    platforms = stdenv.lib.platforms.unix;
-    license = stdenv.lib.licenses.bsd3;
+    platforms = lib.platforms.unix;
+    license = lib.licenses.bsd3;
   };
 }
diff --git a/pkgs/development/libraries/libmpeg2/default.nix b/pkgs/development/libraries/libmpeg2/default.nix
index d6fb28c0e88c0..bf5f25ca43f8a 100644
--- a/pkgs/development/libraries/libmpeg2/default.nix
+++ b/pkgs/development/libraries/libmpeg2/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
   version = "0.5.1";
@@ -10,13 +10,13 @@ stdenv.mkDerivation rec {
   };
 
   # Otherwise clang fails with 'duplicate symbol ___sputc'
-  buildFlags = stdenv.lib.optional stdenv.isDarwin "CFLAGS=-std=gnu89";
+  buildFlags = lib.optional stdenv.isDarwin "CFLAGS=-std=gnu89";
 
   meta = {
     homepage = "http://libmpeg2.sourceforge.net/";
     description = "A free library for decoding mpeg-2 and mpeg-1 video streams";
-    license = stdenv.lib.licenses.gpl2;
-    maintainers = with stdenv.lib.maintainers; [ ];
-    platforms = with stdenv.lib.platforms; unix;
+    license = lib.licenses.gpl2;
+    maintainers = with lib.maintainers; [ ];
+    platforms = with lib.platforms; unix;
   };
 }
diff --git a/pkgs/development/libraries/libmrss/default.nix b/pkgs/development/libraries/libmrss/default.nix
index fbd7cbe7ad611..df3460970d171 100644
--- a/pkgs/development/libraries/libmrss/default.nix
+++ b/pkgs/development/libraries/libmrss/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, curl, libnxml, pkg-config}:
+{lib, stdenv, fetchurl, curl, libnxml, pkg-config}:
 
 stdenv.mkDerivation {
   name = "libmrss-0.19.2";
@@ -14,9 +14,9 @@ stdenv.mkDerivation {
   meta = {
     homepage = "http://www.autistici.org/bakunin/libmrss/doc";
     description = "C library for parsing, writing and creating RSS/ATOM files or streams";
-    license = stdenv.lib.licenses.lgpl2;
+    license = lib.licenses.lgpl2;
 
-    platforms = stdenv.lib.platforms.all;
-    maintainers = [ stdenv.lib.maintainers.viric ];
+    platforms = lib.platforms.all;
+    maintainers = [ lib.maintainers.viric ];
   };
 }
diff --git a/pkgs/development/libraries/libmspack/default.nix b/pkgs/development/libraries/libmspack/default.nix
index 70fdd7e913ed6..4ad60bcfb1815 100644
--- a/pkgs/development/libraries/libmspack/default.nix
+++ b/pkgs/development/libraries/libmspack/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl}:
+{lib, stdenv, fetchurl}:
 
 stdenv.mkDerivation rec {
   name = "libmspack-0.7.1alpha";
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
   meta = {
     description = "A de/compression library for various Microsoft formats";
     homepage = "https://www.cabextract.org.uk/libmspack";
-    license = stdenv.lib.licenses.lgpl2;
-    platforms = stdenv.lib.platforms.unix;
+    license = lib.licenses.lgpl2;
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/libmtp/default.nix b/pkgs/development/libraries/libmtp/default.nix
index bbc3e94905386..a49026c35dcd4 100644
--- a/pkgs/development/libraries/libmtp/default.nix
+++ b/pkgs/development/libraries/libmtp/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, autoconf, automake, gettext, libtool, pkg-config
+{ lib, stdenv, fetchFromGitHub, autoconf, automake, gettext, libtool, pkg-config
 , libusb1
 , libiconv
 }:
@@ -39,7 +39,7 @@ stdenv.mkDerivation rec {
   # tried to install files to /lib/udev, hopefully OK
   configureFlags = [ "--with-udev=$$bin/lib/udev" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://libmtp.sourceforge.net";
     description = "An implementation of Microsoft's Media Transfer Protocol";
     longDescription = ''
diff --git a/pkgs/development/libraries/libmusicbrainz/5.x.nix b/pkgs/development/libraries/libmusicbrainz/5.x.nix
index 7c8cdd1df1ada..3e7a2f1a0ba01 100644
--- a/pkgs/development/libraries/libmusicbrainz/5.x.nix
+++ b/pkgs/development/libraries/libmusicbrainz/5.x.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, neon, libdiscid, libxml2, pkg-config }:
+{ lib, stdenv, fetchFromGitHub, cmake, neon, libdiscid, libxml2, pkg-config }:
 
 stdenv.mkDerivation rec {
   version = "5.1.0";
@@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
 
   dontUseCmakeBuildDir=true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://musicbrainz.org/doc/libmusicbrainz";
     description = "MusicBrainz Client Library (5.x version)";
     longDescription = ''
diff --git a/pkgs/development/libraries/libmusicbrainz/default.nix b/pkgs/development/libraries/libmusicbrainz/default.nix
index d5568cdb3d688..ab67d544a1df7 100644
--- a/pkgs/development/libraries/libmusicbrainz/default.nix
+++ b/pkgs/development/libraries/libmusicbrainz/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, cmake, neon, libdiscid }:
+{ lib, stdenv, fetchurl, cmake, neon, libdiscid }:
 
 stdenv.mkDerivation rec {
   name = "libmusicbrainz-3.0.3";
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
     sha256 = "1i9qly13bwwmgj68vma766hgvsd1m75236haqsp9zgh5znlmkm3z";
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://musicbrainz.org/doc/libmusicbrainz";
     description = "MusicBrainz Client Library (3.x version)";
     longDescription = ''
diff --git a/pkgs/development/libraries/libmwaw/default.nix b/pkgs/development/libraries/libmwaw/default.nix
index 1889fc1508fcd..0c56964bfedd2 100644
--- a/pkgs/development/libraries/libmwaw/default.nix
+++ b/pkgs/development/libraries/libmwaw/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, boost, pkg-config, cppunit, zlib, libwpg, libwpd, librevenge}:
+{lib, stdenv, fetchurl, boost, pkg-config, cppunit, zlib, libwpg, libwpd, librevenge}:
 let
   s = # Generated upstream information
   rec {
@@ -24,8 +24,8 @@ stdenv.mkDerivation {
   meta = {
     inherit (s) version;
     description = ''Import library for some old mac text documents'';
-    license = stdenv.lib.licenses.mpl20 ;
-    maintainers = [stdenv.lib.maintainers.raskin];
-    platforms = stdenv.lib.platforms.unix;
+    license = lib.licenses.mpl20 ;
+    maintainers = [lib.maintainers.raskin];
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/libmx/default.nix b/pkgs/development/libraries/libmx/default.nix
index ace5503b6571e..f4256de6981b5 100644
--- a/pkgs/development/libraries/libmx/default.nix
+++ b/pkgs/development/libraries/libmx/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl
+{ lib, stdenv, fetchurl
 , libtool, pkg-config, automake, autoconf, intltool
 , glib, gobject-introspection, gtk2, gtk-doc
 , clutter, clutter-gtk
@@ -46,7 +46,7 @@ stdenv.mkDerivation rec {
     sed -i 's/GLfloat/gfloat/g' mx/mx-texture-frame.c
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://www.clutter-project.org/";
     description = "A Clutter-based toolkit";
     longDescription =
diff --git a/pkgs/development/libraries/libmypaint/default.nix b/pkgs/development/libraries/libmypaint/default.nix
index d3e0ff53528fe..655480f75a2ff 100644
--- a/pkgs/development/libraries/libmypaint/default.nix
+++ b/pkgs/development/libraries/libmypaint/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , autoconf
 , automake
 , fetchFromGitHub
@@ -45,7 +45,7 @@ stdenv.mkDerivation rec {
 
   preConfigure = "./autogen.sh";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://mypaint.org/";
     description = "Library for making brushstrokes which is used by MyPaint and other projects";
     license = licenses.isc;
diff --git a/pkgs/development/libraries/libmysqlconnectorcpp/default.nix b/pkgs/development/libraries/libmysqlconnectorcpp/default.nix
index 6c4874112b738..4c00d64258805 100644
--- a/pkgs/development/libraries/libmysqlconnectorcpp/default.nix
+++ b/pkgs/development/libraries/libmysqlconnectorcpp/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , cmake
 , boost
@@ -35,7 +35,7 @@ stdenv.mkDerivation rec {
   meta = {
     homepage = "https://dev.mysql.com/downloads/connector/cpp/";
     description = "C++ library for connecting to mysql servers";
-    license = stdenv.lib.licenses.gpl2;
-    platforms = stdenv.lib.platforms.unix;
+    license = lib.licenses.gpl2;
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/libnabo/default.nix b/pkgs/development/libraries/libnabo/default.nix
index 91843163176b4..af5e78c25d669 100644
--- a/pkgs/development/libraries/libnabo/default.nix
+++ b/pkgs/development/libraries/libnabo/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchFromGitHub, cmake, eigen, boost}:
+{lib, stdenv, fetchFromGitHub, cmake, eigen, boost}:
 
 stdenv.mkDerivation rec {
   version = "1.0.7";
@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
   doCheck = true;
   checkTarget = "test";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     inherit (src.meta) homepage;
     description = "A fast K Nearest Neighbor library for low-dimensional spaces";
     license = licenses.bsd3;
diff --git a/pkgs/development/libraries/libnatpmp/default.nix b/pkgs/development/libraries/libnatpmp/default.nix
index a2aae1263597c..dd902c0021ddc 100644
--- a/pkgs/development/libraries/libnatpmp/default.nix
+++ b/pkgs/development/libraries/libnatpmp/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
   pname = "libnatpmp";
@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
 
   makeFlags = [ "INSTALLPREFIX=$(out)" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://miniupnp.free.fr/libnatpmp.html";
     description = "NAT-PMP client";
     license = licenses.bsd3;
diff --git a/pkgs/development/libraries/libnats-c/default.nix b/pkgs/development/libraries/libnats-c/default.nix
index 12f1038f8e1cd..3d1e2b7ac4a34 100644
--- a/pkgs/development/libraries/libnats-c/default.nix
+++ b/pkgs/development/libraries/libnats-c/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub
+{ lib, stdenv, fetchFromGitHub
 , cmake, protobuf, protobufc
 , libsodium, openssl
 }:
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
   separateDebugInfo = true;
   outputs = [ "out" "dev" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "C API for the NATS messaging system";
     homepage    = "https://github.com/nats-io/nats.c";
     license     = licenses.asl20;
diff --git a/pkgs/development/libraries/libnatspec/default.nix b/pkgs/development/libraries/libnatspec/default.nix
index 8ac2859faeda9..17e43ec29d949 100644
--- a/pkgs/development/libraries/libnatspec/default.nix
+++ b/pkgs/development/libraries/libnatspec/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, autoreconfHook, popt, libiconv }:
+{ lib, stdenv, fetchurl, autoreconfHook, popt, libiconv }:
 
 stdenv.mkDerivation (rec {
   name = "libnatspec-0.3.0";
@@ -12,12 +12,12 @@ stdenv.mkDerivation (rec {
 
   buildInputs = [ popt ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://natspec.sourceforge.net/";
     description = "A library intended to smooth national specificities in using of programs";
     platforms = platforms.unix;
     license = licenses.lgpl21;
   };
-} // stdenv.lib.optionalAttrs (!stdenv.isLinux) {
+} // lib.optionalAttrs (!stdenv.isLinux) {
   propagatedBuildInputs = [ libiconv ];
 })
diff --git a/pkgs/development/libraries/libndctl/default.nix b/pkgs/development/libraries/libndctl/default.nix
index aac9f8e8acfde..b7e082f2b9ba9 100644
--- a/pkgs/development/libraries/libndctl/default.nix
+++ b/pkgs/development/libraries/libndctl/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, autoreconfHook
+{ lib, stdenv, fetchFromGitHub, autoreconfHook
 , asciidoctor, pkg-config, xmlto, docbook_xsl, docbook_xml_dtd_45, libxslt
 , json_c, kmod, which, util-linux, udev, keyutils
 }:
@@ -39,7 +39,7 @@ stdenv.mkDerivation rec {
     echo "m4_define([GIT_VERSION], [${version}])" > version.m4;
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Tools for managing the Linux Non-Volatile Memory Device sub-system";
     homepage    = "https://github.com/pmem/ndctl";
     license     = licenses.lgpl21;
diff --git a/pkgs/development/libraries/libndp/default.nix b/pkgs/development/libraries/libndp/default.nix
index 2592b7184f8ea..fc68149c14c3e 100644
--- a/pkgs/development/libraries/libndp/default.nix
+++ b/pkgs/development/libraries/libndp/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
   name = "libndp-1.7";
@@ -8,7 +8,7 @@ stdenv.mkDerivation rec {
     sha256 = "1dlinhl39va00v55qygjc9ap77yqf7xvn4rwmvdr49xhzzxhlj1c";
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://libndp.org/";
     description = "Library for Neighbor Discovery Protocol";
     platforms = platforms.linux;
diff --git a/pkgs/development/libraries/libndtypes/default.nix b/pkgs/development/libraries/libndtypes/default.nix
index d27c1ba376d18..1f0709af6cfc1 100644
--- a/pkgs/development/libraries/libndtypes/default.nix
+++ b/pkgs/development/libraries/libndtypes/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 }:
 
@@ -19,7 +19,7 @@ stdenv.mkDerivation {
 
   doCheck = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Dynamic types for data description and in-memory computations";
     homepage = "https://xnd.io/";
     license = licenses.bsdOriginal;
diff --git a/pkgs/development/libraries/libnest2d/default.nix b/pkgs/development/libraries/libnest2d/default.nix
index ee61ef8a7232c..567598500d612 100644
--- a/pkgs/development/libraries/libnest2d/default.nix
+++ b/pkgs/development/libraries/libnest2d/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, clipper, nlopt, boost, python3 }:
+{ lib, stdenv, fetchFromGitHub, cmake, clipper, nlopt, boost, python3 }:
 
 stdenv.mkDerivation rec {
   version = "2020-10-09-unstable";
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
   CLIPPER_PATH = "${clipper.out}";
   cmakeFlags = [ "-DLIBNEST2D_HEADER_ONLY=OFF" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description =
       "2D irregular bin packaging and nesting library written in modern C++";
     homepage = "https://github.com/Ultimaker/libnest2d";
diff --git a/pkgs/development/libraries/libnet/default.nix b/pkgs/development/libraries/libnet/default.nix
index 7987fccc06fb0..cb3375708df15 100644
--- a/pkgs/development/libraries/libnet/default.nix
+++ b/pkgs/development/libraries/libnet/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
   pname = "libnet";
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
 
   patches = [ ./fix-includes.patch ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/sam-github/libnet";
     description = "Portable framework for low-level network packet construction";
     license = licenses.bsd3;
diff --git a/pkgs/development/libraries/libnetfilter_acct/default.nix b/pkgs/development/libraries/libnetfilter_acct/default.nix
index 98d89d67ef6c7..72766471d2f16 100644
--- a/pkgs/development/libraries/libnetfilter_acct/default.nix
+++ b/pkgs/development/libraries/libnetfilter_acct/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, libmnl }:
+{ lib, stdenv, fetchurl, pkg-config, libmnl }:
 
 stdenv.mkDerivation rec {
   version = "1.0.3";
@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ pkg-config ];
   buildInputs = [ libmnl ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://www.netfilter.org/projects/libnetfilter_acct/";
     description = "Userspace library providing interface to extended accounting infrastructure";
     license = licenses.gpl2;
diff --git a/pkgs/development/libraries/libnetfilter_conntrack/default.nix b/pkgs/development/libraries/libnetfilter_conntrack/default.nix
index a97e77c5334eb..a2097bb17e25b 100644
--- a/pkgs/development/libraries/libnetfilter_conntrack/default.nix
+++ b/pkgs/development/libraries/libnetfilter_conntrack/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, libnfnetlink, libmnl }:
+{ lib, stdenv, fetchurl, pkg-config, libnfnetlink, libmnl }:
 
 stdenv.mkDerivation rec {
   pname = "libnetfilter_conntrack";
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
   propagatedBuildInputs = [ libnfnetlink ];
   nativeBuildInputs = [ pkg-config ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Userspace library providing an API to the in-kernel connection tracking state table";
     longDescription = ''
       libnetfilter_conntrack is a userspace library providing a programming interface (API) to the
diff --git a/pkgs/development/libraries/libnetfilter_cthelper/default.nix b/pkgs/development/libraries/libnetfilter_cthelper/default.nix
index b700c0e9d9ac3..b8b05e57dad2e 100644
--- a/pkgs/development/libraries/libnetfilter_cthelper/default.nix
+++ b/pkgs/development/libraries/libnetfilter_cthelper/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, libmnl }:
+{ lib, stdenv, fetchurl, pkg-config, libmnl }:
 
 stdenv.mkDerivation rec {
   pname = "libnetfilter_cthelper";
@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
       is used by conntrack-tools.
     '';
     homepage = "http://www.netfilter.org/projects/libnetfilter_cthelper/";
-    license = stdenv.lib.licenses.gpl2Plus;
-    platforms = stdenv.lib.platforms.linux;
+    license = lib.licenses.gpl2Plus;
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/development/libraries/libnetfilter_cttimeout/default.nix b/pkgs/development/libraries/libnetfilter_cttimeout/default.nix
index 23de648159200..a8d0c2680dfee 100644
--- a/pkgs/development/libraries/libnetfilter_cttimeout/default.nix
+++ b/pkgs/development/libraries/libnetfilter_cttimeout/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, libmnl }:
+{ lib, stdenv, fetchurl, pkg-config, libmnl }:
 
 stdenv.mkDerivation rec {
   pname = "libnetfilter_cttimeout";
@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
       be attached to traffic flows. This library is used by conntrack-tools.
     '';
     homepage = "https://netfilter.org/projects/libnetfilter_cttimeout/";
-    license = stdenv.lib.licenses.gpl2Plus;
-    platforms = stdenv.lib.platforms.linux;
+    license = lib.licenses.gpl2Plus;
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/development/libraries/libnetfilter_log/default.nix b/pkgs/development/libraries/libnetfilter_log/default.nix
index 9bec269e6acb2..4ac20cf29cb4a 100644
--- a/pkgs/development/libraries/libnetfilter_log/default.nix
+++ b/pkgs/development/libraries/libnetfilter_log/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, libnfnetlink, libmnl }:
+{ lib, stdenv, fetchurl, pkg-config, libnfnetlink, libmnl }:
 
 stdenv.mkDerivation rec {
   pname = "libnetfilter_log";
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
   propagatedBuildInputs = [ libnfnetlink ];
   nativeBuildInputs = [ pkg-config ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Userspace library providing interface to packets that have been logged by the kernel packet filter";
     longDescription = ''
       libnetfilter_log is a userspace library providing interface to packets
diff --git a/pkgs/development/libraries/libnetfilter_queue/default.nix b/pkgs/development/libraries/libnetfilter_queue/default.nix
index 6889f7702e6a9..7dafcd42223fe 100644
--- a/pkgs/development/libraries/libnetfilter_queue/default.nix
+++ b/pkgs/development/libraries/libnetfilter_queue/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, libmnl, libnfnetlink }:
+{ lib, stdenv, fetchurl, pkg-config, libmnl, libnfnetlink }:
 
 stdenv.mkDerivation rec {
   version = "1.0.5";
@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ pkg-config ];
   buildInputs = [ libmnl libnfnetlink ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://www.netfilter.org/projects/libnetfilter_queue/";
     description = "Userspace API to packets queued by the kernel packet filter";
     license = licenses.gpl2;
diff --git a/pkgs/development/libraries/libnfc/default.nix b/pkgs/development/libraries/libnfc/default.nix
index ed7412d661100..b4daab97388e1 100644
--- a/pkgs/development/libraries/libnfc/default.nix
+++ b/pkgs/development/libraries/libnfc/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, libusb-compat-0_1, readline }:
+{ lib, stdenv, fetchurl, libusb-compat-0_1, readline }:
 
 stdenv.mkDerivation {
   pname = "libnfc";
@@ -11,7 +11,7 @@ stdenv.mkDerivation {
 
   buildInputs = [ libusb-compat-0_1 readline ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Open source library libnfc for Near Field Communication";
     license = licenses.gpl3;
     homepage = "https://github.com/nfc-tools/libnfc";
diff --git a/pkgs/development/libraries/libnfnetlink/default.nix b/pkgs/development/libraries/libnfnetlink/default.nix
index ecce38ac23e38..4c7b4a5cc2ddd 100644
--- a/pkgs/development/libraries/libnfnetlink/default.nix
+++ b/pkgs/development/libraries/libnfnetlink/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
   name = "libnfnetlink-1.0.1";
@@ -24,8 +24,8 @@ stdenv.mkDerivation rec {
       It is only used by other netfilter.org projects, like the aforementioned ones.
     '';
     homepage = "http://www.netfilter.org/projects/libnfnetlink/index.html";
-    license = stdenv.lib.licenses.gpl2;
+    license = lib.licenses.gpl2;
 
-    platforms = stdenv.lib.platforms.linux;
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/development/libraries/libnfs/default.nix b/pkgs/development/libraries/libnfs/default.nix
index 03a4dbe02d5f7..4e12553b00ba3 100644
--- a/pkgs/development/libraries/libnfs/default.nix
+++ b/pkgs/development/libraries/libnfs/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, autoreconfHook }:
+{ lib, stdenv, fetchFromGitHub, autoreconfHook }:
 
 stdenv.mkDerivation rec {
   pname = "libnfs";
@@ -13,11 +13,11 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ autoreconfHook ];
 
-  NIX_CFLAGS_COMPILE = stdenv.lib.optionalString stdenv.cc.isClang "-Wno-error=tautological-compare";
+  NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isClang "-Wno-error=tautological-compare";
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "NFS client library";
     homepage    = "https://github.com/sahlberg/libnfs";
     license     = with licenses; [ lgpl2 bsd2 gpl3 ];
diff --git a/pkgs/development/libraries/libnftnl/default.nix b/pkgs/development/libraries/libnftnl/default.nix
index a546eeebdc576..025ddf8e7b1de 100644
--- a/pkgs/development/libraries/libnftnl/default.nix
+++ b/pkgs/development/libraries/libnftnl/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, libmnl }:
+{ lib, stdenv, fetchurl, pkg-config, libmnl }:
 
 stdenv.mkDerivation rec {
   version = "1.1.8";
@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ pkg-config ];
   buildInputs = [ libmnl ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A userspace library providing a low-level netlink API to the in-kernel nf_tables subsystem";
     homepage = "http://netfilter.org/projects/libnftnl";
     license = licenses.gpl2Plus;
diff --git a/pkgs/development/libraries/libngspice/default.nix b/pkgs/development/libraries/libngspice/default.nix
index 84bd9b33e790e..72fbcd1ab0841 100644
--- a/pkgs/development/libraries/libngspice/default.nix
+++ b/pkgs/development/libraries/libngspice/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, bison, flex, fftw}:
+{lib, stdenv, fetchurl, bison, flex, fftw}:
 
 # Note that this does not provide the ngspice command-line utility. For that see
 # the ngspice derivation.
@@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
 
   configureFlags = [ "--with-ngshared" "--enable-xspice" "--enable-cider" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "The Next Generation Spice (Electronic Circuit Simulator)";
     homepage = "http://ngspice.sourceforge.net";
     license = with licenses; [ bsd3 gpl2Plus lgpl2Plus ]; # See https://sourceforge.net/p/ngspice/ngspice/ci/master/tree/COPYING
diff --git a/pkgs/development/libraries/libnice/default.nix b/pkgs/development/libraries/libnice/default.nix
index b4e1682ab7e1e..7c5043165f9d4 100644
--- a/pkgs/development/libraries/libnice/default.nix
+++ b/pkgs/development/libraries/libnice/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , fetchpatch
 , meson
@@ -69,7 +69,7 @@ stdenv.mkDerivation rec {
   # see https://github.com/NixOS/nixpkgs/pull/53293#issuecomment-453739295
   doCheck = false;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "GLib ICE implementation";
     longDescription = ''
       Libnice is an implementation of the IETF's Interactice Connectivity
diff --git a/pkgs/development/libraries/libnih/default.nix b/pkgs/development/libraries/libnih/default.nix
index 497e3aa6679e6..fbe01bf4062d2 100644
--- a/pkgs/development/libraries/libnih/default.nix
+++ b/pkgs/development/libraries/libnih/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, dbus, expat }:
+{ lib, stdenv, fetchurl, pkg-config, dbus, expat }:
 
 let version = "1.0.3"; in
 
@@ -19,7 +19,7 @@ stdenv.mkDerivation {
   meta = {
     description = "A small library for C application development";
     homepage = "https://launchpad.net/libnih";
-    license = stdenv.lib.licenses.gpl2;
-    platforms = stdenv.lib.platforms.linux;
+    license = lib.licenses.gpl2;
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/development/libraries/libnixxml/default.nix b/pkgs/development/libraries/libnixxml/default.nix
index f1661f222cca2..abbffcf0f942c 100644
--- a/pkgs/development/libraries/libnixxml/default.nix
+++ b/pkgs/development/libraries/libnixxml/default.nix
@@ -1,4 +1,4 @@
-{ fetchFromGitHub, stdenv, autoreconfHook, pkg-config, libxml2, gd, glib, getopt, libxslt, nix }:
+{ fetchFromGitHub, lib, stdenv, autoreconfHook, pkg-config, libxml2, gd, glib, getopt, libxslt, nix }:
 
 stdenv.mkDerivation {
   name = "libnixxml";
@@ -17,7 +17,7 @@ stdenv.mkDerivation {
     ./bootstrap
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "XML-based Nix-friendly data integration library";
     homepage = https://github.com/svanderburg/libnixxml;
     license = licenses.mit;
diff --git a/pkgs/development/libraries/libnotify/default.nix b/pkgs/development/libraries/libnotify/default.nix
index 2675098a826e0..29b371642280b 100644
--- a/pkgs/development/libraries/libnotify/default.nix
+++ b/pkgs/development/libraries/libnotify/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , meson
 , ninja
@@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
   outputs = [ "out" "man" "dev" ];
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "0qa7cx6ra5hwqnxw95b9svgjg5q6ynm8y843iqjszxvds5z53h36";
   };
 
@@ -50,7 +50,7 @@ stdenv.mkDerivation rec {
     };
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://developer.gnome.org/notification-spec/";
     description = "A library that sends desktop notifications to a notification daemon";
     platforms = platforms.unix;
diff --git a/pkgs/development/libraries/libnova/default.nix b/pkgs/development/libraries/libnova/default.nix
index 8cdbdbd747a94..f6a8d01ab8452 100644
--- a/pkgs/development/libraries/libnova/default.nix
+++ b/pkgs/development/libraries/libnova/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchgit, autoreconfHook }:
+{ lib, stdenv, fetchgit, autoreconfHook }:
 
 stdenv.mkDerivation rec {
   pname = "libnova";
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
     autoreconfHook
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Celestial Mechanics, Astrometry and Astrodynamics Library";
     homepage = "http://libnova.sf.net";
     license = licenses.gpl2;
diff --git a/pkgs/development/libraries/libnsl/default.nix b/pkgs/development/libraries/libnsl/default.nix
index ab7527c7c76e6..ac4c6bf9ad3ff 100644
--- a/pkgs/development/libraries/libnsl/default.nix
+++ b/pkgs/development/libraries/libnsl/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, autoreconfHook, libtirpc, pkg-config }:
+{ lib, stdenv, fetchFromGitHub, autoreconfHook, libtirpc, pkg-config }:
 
 stdenv.mkDerivation rec {
   pname = "libnsl";
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ autoreconfHook pkg-config ];
   buildInputs = [ libtirpc ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Client interface library for NIS(YP) and NIS+";
     homepage = "https://github.com/thkukuk/libnsl";
     license = licenses.lgpl21;
diff --git a/pkgs/development/libraries/libnxml/default.nix b/pkgs/development/libraries/libnxml/default.nix
index dc5e8dfc55e9a..846170011437b 100644
--- a/pkgs/development/libraries/libnxml/default.nix
+++ b/pkgs/development/libraries/libnxml/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, curl}:
+{lib, stdenv, fetchurl, curl}:
 
 stdenv.mkDerivation {
   name = "libnxml-0.18.3";
@@ -13,9 +13,9 @@ stdenv.mkDerivation {
   meta = {
     homepage = "https://www.autistici.org/bakunin/libnxml/";
     description = "C library for parsing, writing and creating XML 1.0 and 1.1 files or streams";
-    license = stdenv.lib.licenses.lgpl2;
+    license = lib.licenses.lgpl2;
 
-    platforms = stdenv.lib.platforms.all;
-    maintainers = [ stdenv.lib.maintainers.viric ];
+    platforms = lib.platforms.all;
+    maintainers = [ lib.maintainers.viric ];
   };
 }
diff --git a/pkgs/development/libraries/liboauth/default.nix b/pkgs/development/libraries/liboauth/default.nix
index 8980a145dc9ae..caab0a83fcf6f 100644
--- a/pkgs/development/libraries/liboauth/default.nix
+++ b/pkgs/development/libraries/liboauth/default.nix
@@ -1,4 +1,4 @@
-{ fetchurl, stdenv, nss, nspr, pkg-config }:
+{ fetchurl, lib, stdenv, nss, nspr, pkg-config }:
 
 
 stdenv.mkDerivation rec {
@@ -22,7 +22,7 @@ stdenv.mkDerivation rec {
       --replace "-lnss3" "-L${nss.out}/lib -lnss3"
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     platforms = platforms.linux;
     description = "C library implementing the OAuth secure authentication protocol";
     homepage = "http://liboauth.sourceforge.net/";
diff --git a/pkgs/development/libraries/libodfgen/default.nix b/pkgs/development/libraries/libodfgen/default.nix
index 9af9a3864d298..e93bafe2b563f 100644
--- a/pkgs/development/libraries/libodfgen/default.nix
+++ b/pkgs/development/libraries/libodfgen/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, boost, pkg-config, cppunit, zlib, libwpg, libwpd, librevenge}:
+{lib, stdenv, fetchurl, boost, pkg-config, cppunit, zlib, libwpg, libwpd, librevenge}:
 let
   s = # Generated upstream information
   rec {
@@ -23,8 +23,8 @@ stdenv.mkDerivation {
   meta = {
     inherit (s) version;
     description = ''A base library for generating ODF documents'';
-    license = stdenv.lib.licenses.mpl20 ;
-    maintainers = [stdenv.lib.maintainers.raskin];
-    platforms = stdenv.lib.platforms.unix;
+    license = lib.licenses.mpl20 ;
+    maintainers = [lib.maintainers.raskin];
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/libofa/default.nix b/pkgs/development/libraries/libofa/default.nix
index c24023380340e..c78aa3f617ef6 100644
--- a/pkgs/development/libraries/libofa/default.nix
+++ b/pkgs/development/libraries/libofa/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, expat, curl, fftw }:
+{ lib, stdenv, fetchurl, expat, curl, fftw }:
 
 let
   version = "0.9.3";
@@ -28,7 +28,7 @@ stdenv.mkDerivation rec {
 
   propagatedBuildInputs = [ expat curl fftw ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://code.google.com/archive/p/musicip-libofa/";
     description = "Library Open Fingerprint Architecture";
     longDescription = ''
diff --git a/pkgs/development/libraries/libofx/default.nix b/pkgs/development/libraries/libofx/default.nix
index f11489eaf9f90..10197bd8db093 100644
--- a/pkgs/development/libraries/libofx/default.nix
+++ b/pkgs/development/libraries/libofx/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, opensp, pkg-config, libxml2, curl
+{ lib, stdenv, fetchFromGitHub, opensp, pkg-config, libxml2, curl
 , autoconf, automake, libtool, gengetopt, libiconv }:
 
 stdenv.mkDerivation rec {
@@ -15,13 +15,13 @@ stdenv.mkDerivation rec {
   preConfigure = "./autogen.sh";
   configureFlags = [ "--with-opensp-includes=${opensp}/include/OpenSP" ];
   nativeBuildInputs = [ pkg-config libtool autoconf automake gengetopt ];
-  buildInputs = [ opensp libxml2 curl ] ++ stdenv.lib.optional stdenv.isDarwin libiconv;
+  buildInputs = [ opensp libxml2 curl ] ++ lib.optional stdenv.isDarwin libiconv;
 
   meta = {
     description = "Opensource implementation of the Open Financial eXchange specification";
     homepage = "http://libofx.sourceforge.net/";
     license = "LGPL";
-    platforms = stdenv.lib.platforms.unix;
+    platforms = lib.platforms.unix;
     maintainers = [ ];
   };
 }
diff --git a/pkgs/development/libraries/libogg/default.nix b/pkgs/development/libraries/libogg/default.nix
index 50950a15a8700..83555ccab8ce2 100644
--- a/pkgs/development/libraries/libogg/default.nix
+++ b/pkgs/development/libraries/libogg/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, fetchpatch }:
+{ lib, stdenv, fetchurl, fetchpatch }:
 
 stdenv.mkDerivation rec {
   name = "libogg-1.3.4";
@@ -10,7 +10,7 @@ stdenv.mkDerivation rec {
 
   outputs = [ "out" "dev" "doc" ];
 
-  patches = stdenv.lib.optionals stdenv.isDarwin [
+  patches = lib.optionals stdenv.isDarwin [
     # Fix unsigned typedefs on darwin. Remove with the next release https://github.com/xiph/ogg/pull/64
     (fetchpatch {
       url = "https://github.com/xiph/ogg/commit/c8fca6b4a02d695b1ceea39b330d4406001c03ed.patch";
@@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
     })
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Media container library to manipulate Ogg files";
     longDescription = ''
       Library to work with Ogg multimedia container format.
diff --git a/pkgs/development/libraries/liboggz/default.nix b/pkgs/development/libraries/liboggz/default.nix
index 687e1d9c43d87..15856c0262c72 100644
--- a/pkgs/development/libraries/liboggz/default.nix
+++ b/pkgs/development/libraries/liboggz/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, libogg, pkg-config }:
+{ lib, stdenv, fetchurl, libogg, pkg-config }:
 
 stdenv.mkDerivation rec {
   name = "liboggz-1.1.1";
@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ pkg-config ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://xiph.org/oggz/";
     description = "A C library and tools for manipulating with Ogg files and streams";
     longDescription = ''
diff --git a/pkgs/development/libraries/liboil/default.nix b/pkgs/development/libraries/liboil/default.nix
index c1c41ce559fc9..8d92997581595 100644
--- a/pkgs/development/libraries/liboil/default.nix
+++ b/pkgs/development/libraries/liboil/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, pkg-config }:
+{lib, stdenv, fetchurl, pkg-config }:
 
 stdenv.mkDerivation rec {
   name = "liboil-0.3.17";
@@ -17,12 +17,12 @@ stdenv.mkDerivation rec {
 
   # fix "argb_paint_i386.c:53:Incorrect register `%rax' used with `l' suffix"
   # errors
-  configureFlags = stdenv.lib.optional stdenv.isDarwin "--build=x86_64";
+  configureFlags = lib.optional stdenv.isDarwin "--build=x86_64";
 
   # fixes a cast in inline asm: easier than patching
-  buildFlags = stdenv.lib.optional stdenv.isDarwin "CFLAGS=-fheinous-gnu-extensions";
+  buildFlags = lib.optional stdenv.isDarwin "CFLAGS=-fheinous-gnu-extensions";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A library of simple functions that are optimized for various CPUs";
     homepage    = "https://liboil.freedesktop.org";
     license     = licenses.bsd2;
diff --git a/pkgs/development/libraries/libomxil-bellagio/default.nix b/pkgs/development/libraries/libomxil-bellagio/default.nix
index 854c2732c12c2..5e3b0c6798a64 100644
--- a/pkgs/development/libraries/libomxil-bellagio/default.nix
+++ b/pkgs/development/libraries/libomxil-bellagio/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
   pname = "libomxil-bellagio";
@@ -10,7 +10,7 @@ stdenv.mkDerivation rec {
   };
 
   configureFlags =
-    stdenv.lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ "ac_cv_func_malloc_0_nonnull=yes" ];
+    lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ "ac_cv_func_malloc_0_nonnull=yes" ];
 
   patches = [ ./fedora-fixes.patch ];
 
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
   # developed anymore. Alternatively, gcc7Stdenv could be used.
   NIX_CFLAGS_COMPILE = "-Wno-error=array-bounds -Wno-error=stringop-overflow=8";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://sourceforge.net/projects/omxil/";
     description = "An opensource implementation of the Khronos OpenMAX Integration Layer API to access multimedia components";
     license = licenses.lgpl21;
diff --git a/pkgs/development/libraries/liboop/default.nix b/pkgs/development/libraries/liboop/default.nix
index 75fa4a80a31d8..5d849ebe1caf9 100644
--- a/pkgs/development/libraries/liboop/default.nix
+++ b/pkgs/development/libraries/liboop/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl}:
+{lib, stdenv, fetchurl}:
 
 stdenv.mkDerivation {
   name = "liboop-1.0";
@@ -12,6 +12,6 @@ stdenv.mkDerivation {
     description = "Event loop library";
     homepage = "http://liboop.ofb.net/";
     license = "LGPL";
-    platforms = stdenv.lib.platforms.linux;
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/development/libraries/libopcodes/default.nix b/pkgs/development/libraries/libopcodes/default.nix
index 8db034683dc7e..e448d225b9931 100644
--- a/pkgs/development/libraries/libopcodes/default.nix
+++ b/pkgs/development/libraries/libopcodes/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, buildPackages
+{ lib, stdenv, buildPackages
 , autoreconfHook, bison, binutils-unwrapped
 , libiberty, libbfd
 }:
@@ -34,7 +34,7 @@ stdenv.mkDerivation {
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A library from binutils for manipulating machine code";
     homepage = "https://www.gnu.org/software/binutils/";
     license = licenses.gpl3Plus;
diff --git a/pkgs/development/libraries/libopenaptx/default.nix b/pkgs/development/libraries/libopenaptx/default.nix
index 5b02d70f68365..9cc57d1a465a8 100644
--- a/pkgs/development/libraries/libopenaptx/default.nix
+++ b/pkgs/development/libraries/libopenaptx/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub }:
+{ lib, stdenv, fetchFromGitHub }:
 
 stdenv.mkDerivation rec {
   pname = "libopenaptx";
@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Audio Processing Technology codec (aptX)";
     license = licenses.lgpl21Plus;
     homepage = "https://github.com/pali/libopenaptx";
diff --git a/pkgs/development/libraries/liboping/default.nix b/pkgs/development/libraries/liboping/default.nix
index 956538b762409..c309c70e3d3b0 100644
--- a/pkgs/development/libraries/liboping/default.nix
+++ b/pkgs/development/libraries/liboping/default.nix
@@ -13,9 +13,9 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ ncurses perl ];
 
-  configureFlags = stdenv.lib.optional (perl == null) "--with-perl-bindings=no";
+  configureFlags = lib.optional (perl == null) "--with-perl-bindings=no";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "C library to generate ICMP echo requests (a.k.a. ping packets)";
     longDescription = ''
       liboping is a C library to generate ICMP echo requests, better known as
diff --git a/pkgs/development/libraries/libopus/default.nix b/pkgs/development/libraries/libopus/default.nix
index e8d3682b8b31f..51179ecb9a056 100644
--- a/pkgs/development/libraries/libopus/default.nix
+++ b/pkgs/development/libraries/libopus/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl
+{ lib, stdenv, fetchurl
 , fixedPoint ? false, withCustomModes ? true }:
 
 let
@@ -15,14 +15,14 @@ stdenv.mkDerivation {
 
   outputs = [ "out" "dev" ];
 
-  configureFlags = stdenv.lib.optional fixedPoint "--enable-fixed-point"
-                ++ stdenv.lib.optional withCustomModes "--enable-custom-modes";
+  configureFlags = lib.optional fixedPoint "--enable-fixed-point"
+                ++ lib.optional withCustomModes "--enable-custom-modes";
 
   doCheck = !stdenv.isi686; # test_unit_LPC_inv_pred_gain fails
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Open, royalty-free, highly versatile audio codec";
-    license = stdenv.lib.licenses.bsd3;
+    license = lib.licenses.bsd3;
     homepage = "https://www.opus-codec.org/";
     platforms = platforms.unix;
   };
diff --git a/pkgs/development/libraries/libopusenc/default.nix b/pkgs/development/libraries/libopusenc/default.nix
index 9aaf52abdf1f4..c2d77185e6922 100644
--- a/pkgs/development/libraries/libopusenc/default.nix
+++ b/pkgs/development/libraries/libopusenc/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, libopus }:
+{ lib, stdenv, fetchurl, pkg-config, libopus }:
 
 let
   version = "0.2.1";
@@ -19,7 +19,7 @@ stdenv.mkDerivation {
   nativeBuildInputs = [ pkg-config ];
   buildInputs = [ libopus ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Library for encoding .opus audio files and live streams";
     license = licenses.bsd3;
     homepage = "https://www.opus-codec.org/";
diff --git a/pkgs/development/libraries/libosinfo/default.nix b/pkgs/development/libraries/libosinfo/default.nix
index 4d4ab13e8c5d4..a6b170167198d 100644
--- a/pkgs/development/libraries/libosinfo/default.nix
+++ b/pkgs/development/libraries/libosinfo/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , fetchpatch
 , pkg-config
@@ -74,7 +74,7 @@ stdenv.mkDerivation rec {
 
   doCheck = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "GObject based library API for managing information about operating systems, hypervisors and the (virtual) hardware devices they can support";
     homepage = "https://libosinfo.org/";
     license = licenses.lgpl2Plus;
diff --git a/pkgs/development/libraries/libosmium/default.nix b/pkgs/development/libraries/libosmium/default.nix
index 10e6d61d15650..c5b801f5d47ba 100644
--- a/pkgs/development/libraries/libosmium/default.nix
+++ b/pkgs/development/libraries/libosmium/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, protozero, expat, zlib, bzip2, boost }:
+{ lib, stdenv, fetchFromGitHub, cmake, protozero, expat, zlib, bzip2, boost }:
 
 stdenv.mkDerivation rec {
   pname = "libosmium";
@@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
 
   doCheck = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Fast and flexible C++ library for working with OpenStreetMap data";
     homepage = "https://osmcode.org/libosmium/";
     license = licenses.boost;
diff --git a/pkgs/development/libraries/libosmpbf/default.nix b/pkgs/development/libraries/libosmpbf/default.nix
index d1f6ea5c2ea3b..1cbfe44ef4e50 100644
--- a/pkgs/development/libraries/libosmpbf/default.nix
+++ b/pkgs/development/libraries/libosmpbf/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, protobuf}:
+{lib, stdenv, fetchurl, protobuf}:
 
 stdenv.mkDerivation {
   name = "libosmpbf-1.3.3";
@@ -17,7 +17,7 @@ stdenv.mkDerivation {
   meta = {
     homepage = "https://github.com/scrosby/OSM-binary";
     description = "C library to read and write OpenStreetMap PBF files";
-    license = stdenv.lib.licenses.lgpl3;
-    platforms = stdenv.lib.platforms.unix;
+    license = lib.licenses.lgpl3;
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/libossp-uuid/default.nix b/pkgs/development/libraries/libossp-uuid/default.nix
index 15b6da0ac5bcb..824dac3a2f56f 100644
--- a/pkgs/development/libraries/libossp-uuid/default.nix
+++ b/pkgs/development/libraries/libossp-uuid/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl}:
+{lib, stdenv, fetchurl}:
 
 let version = "1.6.2"; in
 
@@ -13,11 +13,11 @@ stdenv.mkDerivation {
 
   configureFlags = [
     "ac_cv_va_copy=yes"
-  ] ++ stdenv.lib.optional stdenv.isFreeBSD "--with-pic";
+  ] ++ lib.optional stdenv.isFreeBSD "--with-pic";
 
   patches = [ ./shtool.patch ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://www.ossp.org/pkg/lib/uuid/";
     description = "OSSP uuid ISO-C and C++ shared library";
     longDescription =
diff --git a/pkgs/development/libraries/libotr/default.nix b/pkgs/development/libraries/libotr/default.nix
index 10619f9682bf4..7c2a2b9a6b9a0 100644
--- a/pkgs/development/libraries/libotr/default.nix
+++ b/pkgs/development/libraries/libotr/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, libgcrypt, autoreconfHook }:
+{ lib, stdenv, fetchurl, libgcrypt, autoreconfHook }:
 
 stdenv.mkDerivation rec {
   name = "libotr-4.1.1";
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ autoreconfHook ];
   propagatedBuildInputs = [ libgcrypt ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://www.cypherpunks.ca/otr/";
     repositories.git = "git://git.code.sf.net/p/otr/libotr";
     license = licenses.lgpl21;
diff --git a/pkgs/development/libraries/libow/default.nix b/pkgs/development/libraries/libow/default.nix
index 80a84974b7aab..e4a8d95f4b0ea 100644
--- a/pkgs/development/libraries/libow/default.nix
+++ b/pkgs/development/libraries/libow/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, autoconf, automake, pkg-config, libtool }:
+{ lib, stdenv, fetchFromGitHub, autoconf, automake, pkg-config, libtool }:
 
 stdenv.mkDerivation rec {
   version = "3.2p4";
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ autoconf automake pkg-config ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "1-Wire File System full library";
     homepage = "https://owfs.org/";
     license = licenses.gpl2;
diff --git a/pkgs/development/libraries/libowfat/default.nix b/pkgs/development/libraries/libowfat/default.nix
index 0687115860915..14270a36ec5d7 100644
--- a/pkgs/development/libraries/libowfat/default.nix
+++ b/pkgs/development/libraries/libowfat/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
   name = "libowfat-0.32";
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
   makeFlags = [ "prefix=$(out)" ];
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A GPL reimplementation of libdjb";
     homepage = "https://www.fefe.de/libowfat/";
     license = licenses.gpl2;
diff --git a/pkgs/development/libraries/libp11/default.nix b/pkgs/development/libraries/libp11/default.nix
index 26a95090ef63d..eb577a7f5a17a 100644
--- a/pkgs/development/libraries/libp11/default.nix
+++ b/pkgs/development/libraries/libp11/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, autoreconfHook, libtool, pkg-config
+{ lib, stdenv, fetchFromGitHub, autoreconfHook, libtool, pkg-config
 , openssl }:
 
 stdenv.mkDerivation rec {
@@ -22,7 +22,7 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Small layer on top of PKCS#11 API to make PKCS#11 implementations easier";
     homepage = "https://github.com/OpenSC/libp11";
     license = licenses.lgpl21Plus;
diff --git a/pkgs/development/libraries/libpam-wrapper/default.nix b/pkgs/development/libraries/libpam-wrapper/default.nix
index f8359cded93a3..7d026eb5a0915 100644
--- a/pkgs/development/libraries/libpam-wrapper/default.nix
+++ b/pkgs/development/libraries/libpam-wrapper/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchgit
 , cmake
 , linux-pam
@@ -18,12 +18,12 @@ stdenv.mkDerivation rec {
     sha256 = "00mqhsashx7njrvxz085d0b88nizhdy7m3x17ip5yhvwsl63km6p";
   };
 
-  nativeBuildInputs = [ cmake ] ++ stdenv.lib.optional enablePython [ python ];
+  nativeBuildInputs = [ cmake ] ++ lib.optional enablePython [ python ];
 
   # We must use linux-pam, using openpam will result in broken fprintd.
   buildInputs = [ linux-pam ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Wrapper for testing PAM modules";
     homepage = "https://cwrap.org/pam_wrapper.html";
     license = licenses.gpl3Plus;
diff --git a/pkgs/development/libraries/libpaper/default.nix b/pkgs/development/libraries/libpaper/default.nix
index d7863e29d58d5..b9372ba1d4073 100644
--- a/pkgs/development/libraries/libpaper/default.nix
+++ b/pkgs/development/libraries/libpaper/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, autoreconfHook }:
+{ lib, stdenv, fetchurl, autoreconfHook }:
 
 stdenv.mkDerivation rec {
   version = "1.1.28";
@@ -33,7 +33,7 @@ stdenv.mkDerivation rec {
   meta = {
     description = "Library for handling paper characteristics";
     homepage = "http://packages.debian.org/unstable/source/libpaper";
-    license = stdenv.lib.licenses.gpl2;
-    platforms = stdenv.lib.platforms.unix;
+    license = lib.licenses.gpl2;
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/libpar2/default.nix b/pkgs/development/libraries/libpar2/default.nix
index f8e9d6e4a0b78..625e780d1921f 100644
--- a/pkgs/development/libraries/libpar2/default.nix
+++ b/pkgs/development/libraries/libpar2/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, libsigcxx }:
+{ lib, stdenv, fetchurl, pkg-config, libsigcxx }:
 
 let version = "0.4"; in
 
@@ -16,12 +16,12 @@ stdenv.mkDerivation rec {
 
   patches = [ ./libpar2-0.4-external-verification.patch ];
 
-  CXXFLAGS = stdenv.lib.optionalString stdenv.cc.isClang "-std=c++11";
+  CXXFLAGS = lib.optionalString stdenv.cc.isClang "-std=c++11";
 
   meta = {
     homepage = "http://parchive.sourceforge.net/";
-    license = stdenv.lib.licenses.gpl2Plus;
+    license = lib.licenses.gpl2Plus;
     description = "A library for using Parchives (parity archive volume sets)";
-    platforms = stdenv.lib.platforms.unix;
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/libpcap/default.nix b/pkgs/development/libraries/libpcap/default.nix
index 2999b3d317203..0b30bf6c2b0d2 100644
--- a/pkgs/development/libraries/libpcap/default.nix
+++ b/pkgs/development/libraries/libpcap/default.nix
@@ -1,6 +1,6 @@
-{ stdenv, fetchurl, flex, bison, bluez, pkg-config, withBluez ? false }:
+{ lib, stdenv, fetchurl, flex, bison, bluez, pkg-config, withBluez ? false }:
 
-with stdenv.lib;
+with lib;
 
 stdenv.mkDerivation rec {
   pname = "libpcap";
diff --git a/pkgs/development/libraries/libpeas/default.nix b/pkgs/development/libraries/libpeas/default.nix
index 51717e84259e0..a8ef9e2f9bb2d 100644
--- a/pkgs/development/libraries/libpeas/default.nix
+++ b/pkgs/development/libraries/libpeas/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, meson, ninja, pkg-config, gettext, gnome3
+{ lib, stdenv, fetchurl, meson, ninja, pkg-config, gettext, gnome3
 , glib, gtk3, gobject-introspection, python3, ncurses
 }:
 
@@ -9,7 +9,7 @@ stdenv.mkDerivation rec {
   outputs = [ "out" "dev" ];
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "05cb7drn6arc4gi02wgsvzibigi2riz5gnfnmlb0zmbfnj9ikna2";
   };
 
@@ -26,7 +26,7 @@ stdenv.mkDerivation rec {
     };
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A GObject-based plugins engine";
     homepage = "https://wiki.gnome.org/Projects/Libpeas";
     license = licenses.gpl2Plus;
diff --git a/pkgs/development/libraries/libpfm/default.nix b/pkgs/development/libraries/libpfm/default.nix
index 63b826258ae6e..20c4c0a1c6e2a 100644
--- a/pkgs/development/libraries/libpfm/default.nix
+++ b/pkgs/development/libraries/libpfm/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl
+{ lib, stdenv, fetchurl
 , enableShared ? !stdenv.hostPlatform.isStatic
 }:
 
@@ -20,7 +20,7 @@ stdenv.mkDerivation (rec {
 
   NIX_CFLAGS_COMPILE = "-Wno-error";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Helper library to program the performance monitoring events";
     longDescription = ''
       This package provides a library, called libpfm4 which is used to
@@ -32,7 +32,7 @@ stdenv.mkDerivation (rec {
     maintainers = [ maintainers.pierron ];
     platforms = platforms.linux;
   };
-} // stdenv.lib.optionalAttrs ( ! enableShared )
+} // lib.optionalAttrs ( ! enableShared )
 {
   CONFIG_PFMLIB_SHARED = "n";
 }
diff --git a/pkgs/development/libraries/libpgf/default.nix b/pkgs/development/libraries/libpgf/default.nix
index 7710c20819964..280059fbab319 100644
--- a/pkgs/development/libraries/libpgf/default.nix
+++ b/pkgs/development/libraries/libpgf/default.nix
@@ -1,6 +1,6 @@
-{ stdenv, fetchurl, autoconf, automake, libtool, dos2unix }:
+{ lib, stdenv, fetchurl, autoconf, automake, libtool, dos2unix }:
 
-with stdenv.lib;
+with lib;
 
 let
   version = "6.14.12";
@@ -23,7 +23,7 @@ stdenv.mkDerivation {
   meta = {
     homepage = "https://www.libpgf.org/";
     description = "Progressive Graphics Format";
-    license = stdenv.lib.licenses.lgpl21Plus;
-    platforms = stdenv.lib.platforms.unix;
+    license = lib.licenses.lgpl21Plus;
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/libphonenumber/default.nix b/pkgs/development/libraries/libphonenumber/default.nix
index 0ec92b369d06b..2ff59e055f985 100644
--- a/pkgs/development/libraries/libphonenumber/default.nix
+++ b/pkgs/development/libraries/libphonenumber/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, gmock, boost, pkg-config, protobuf, icu }:
+{ lib, stdenv, fetchFromGitHub, cmake, gmock, boost, pkg-config, protobuf, icu }:
 
 stdenv.mkDerivation rec {
   pname = "phonenumber";
@@ -27,7 +27,7 @@ stdenv.mkDerivation rec {
 
   checkPhase = "./libphonenumber_test";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Google's i18n library for parsing and using phone numbers";
     license = licenses.asl20;
     maintainers = with maintainers; [ illegalprime ];
diff --git a/pkgs/development/libraries/libpinyin/default.nix b/pkgs/development/libraries/libpinyin/default.nix
index a3274fc9053d6..2d802cf28d76e 100644
--- a/pkgs/development/libraries/libpinyin/default.nix
+++ b/pkgs/development/libraries/libpinyin/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, fetchFromGitHub
+{ lib, stdenv, fetchurl, fetchFromGitHub
 , autoreconfHook
 , glib
 , db
@@ -28,7 +28,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ autoreconfHook glib db pkg-config ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Library for intelligent sentence-based Chinese pinyin input method";
     homepage    = "https://sourceforge.net/projects/libpinyin";
     license     = licenses.gpl2;
diff --git a/pkgs/development/libraries/libpipeline/default.nix b/pkgs/development/libraries/libpipeline/default.nix
index be3ab953c0a52..b5310c3cb8caa 100644
--- a/pkgs/development/libraries/libpipeline/default.nix
+++ b/pkgs/development/libraries/libpipeline/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
   name = "libpipeline-1.5.3";
@@ -8,9 +8,9 @@ stdenv.mkDerivation rec {
     sha256 = "1c5dl017xil2ssb6a5vg927bnsbc9vymfgi9ahvqbb8gypx0igsx";
   };
 
-  patches = stdenv.lib.optionals stdenv.isDarwin [ ./fix-on-osx.patch ];
+  patches = lib.optionals stdenv.isDarwin [ ./fix-on-osx.patch ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://libpipeline.nongnu.org";
     description = "C library for manipulating pipelines of subprocesses in a flexible and convenient way";
     platforms = platforms.unix;
diff --git a/pkgs/development/libraries/libplacebo/default.nix b/pkgs/development/libraries/libplacebo/default.nix
index 956b34fd93dd7..94301b34fbce9 100644
--- a/pkgs/development/libraries/libplacebo/default.nix
+++ b/pkgs/development/libraries/libplacebo/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitLab
 , fetchpatch
 , meson
@@ -57,7 +57,7 @@ stdenv.mkDerivation rec {
     "-Dvulkan-registry=${vulkan-headers}/share/vulkan/registry/vk.xml"
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Reusable library for GPU-accelerated video/image rendering primitives";
     longDescription = ''
       Reusable library for GPU-accelerated image/view processing primitives and
diff --git a/pkgs/development/libraries/libplist/default.nix b/pkgs/development/libraries/libplist/default.nix
index 447440b9c76cc..c8e9ddb82c5f2 100644
--- a/pkgs/development/libraries/libplist/default.nix
+++ b/pkgs/development/libraries/libplist/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, autoreconfHook, fetchFromGitHub, pkg-config, enablePython ? false, python, glib }:
+{ lib, stdenv, autoreconfHook, fetchFromGitHub, pkg-config, enablePython ? false, python, glib }:
 
 stdenv.mkDerivation rec {
   pname = "libplist";
@@ -11,27 +11,27 @@ stdenv.mkDerivation rec {
     sha256 = "1vxhpjxniybqsg5wcygmdmr5dv7p2zb34dqnd3bi813rnnzsdjm6";
   };
 
-  outputs = ["bin" "dev" "out" ] ++ stdenv.lib.optional enablePython "py";
+  outputs = ["bin" "dev" "out" ] ++ lib.optional enablePython "py";
 
   nativeBuildInputs = [
     pkg-config
     autoreconfHook
-  ] ++ stdenv.lib.optionals enablePython [
+  ] ++ lib.optionals enablePython [
     python
     python.pkgs.cython
   ];
 
-  configureFlags = stdenv.lib.optionals (!enablePython) [
+  configureFlags = lib.optionals (!enablePython) [
     "--without-cython"
   ];
 
   propagatedBuildInputs = [ glib ];
 
-  postFixup = stdenv.lib.optionalString enablePython ''
+  postFixup = lib.optionalString enablePython ''
     moveToOutput "lib/${python.libPrefix}" "$py"
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A library to handle Apple Property List format in binary or XML";
     homepage = "https://github.com/libimobiledevice/libplist";
     license = licenses.lgpl21Plus;
diff --git a/pkgs/development/libraries/libpng/12.nix b/pkgs/development/libraries/libpng/12.nix
index 7199695ae74b5..bf3d5168d6c68 100644
--- a/pkgs/development/libraries/libpng/12.nix
+++ b/pkgs/development/libraries/libpng/12.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, zlib }:
+{ lib, stdenv, fetchurl, zlib }:
 
 assert stdenv.hostPlatform == stdenv.buildPlatform -> zlib != null;
 
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
 
   postInstall = ''mv "$out/bin" "$dev/bin"'';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "The official reference implementation for the PNG file format";
     homepage = "http://www.libpng.org/pub/png/libpng.html";
     license = licenses.libpng;
diff --git a/pkgs/development/libraries/libpng/default.nix b/pkgs/development/libraries/libpng/default.nix
index 489007bc417d9..aeb3fcba06fac 100644
--- a/pkgs/development/libraries/libpng/default.nix
+++ b/pkgs/development/libraries/libpng/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, zlib, apngSupport ? true }:
+{ lib, stdenv, fetchurl, zlib, apngSupport ? true }:
 
 assert zlib != null;
 
@@ -8,7 +8,7 @@ let
     url = "mirror://sourceforge/libpng-apng/libpng-${patchVersion}-apng.patch.gz";
     sha256 = "1dh0250mw9b2hx7cdmnb2blk7ddl49n6vx8zz7jdmiwxy38v4fw2";
   };
-  whenPatched = stdenv.lib.optionalString apngSupport;
+  whenPatched = lib.optionalString apngSupport;
 
 in stdenv.mkDerivation rec {
   name = "libpng" + whenPatched "-apng" + "-${version}";
@@ -29,7 +29,7 @@ in stdenv.mkDerivation rec {
 
   passthru = { inherit zlib; };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "The official reference implementation for the PNG file format" + whenPatched " with animation patch";
     homepage = "http://www.libpng.org/pub/png/libpng.html";
     license = licenses.libpng2;
diff --git a/pkgs/development/libraries/libpointmatcher/default.nix b/pkgs/development/libraries/libpointmatcher/default.nix
index 3a90f28e7578f..31fb5cb05ba79 100644
--- a/pkgs/development/libraries/libpointmatcher/default.nix
+++ b/pkgs/development/libraries/libpointmatcher/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, eigen, boost, libnabo }:
+{ lib, stdenv, fetchFromGitHub, cmake, eigen, boost, libnabo }:
 
 stdenv.mkDerivation rec {
   pname = "libpointmatcher";
@@ -24,7 +24,7 @@ stdenv.mkDerivation rec {
     ./utest/utest --path ../examples/data/
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     inherit (src.meta) homepage;
     description = "An \"Iterative Closest Point\" library for 2-D/3-D mapping in robotic";
     license = licenses.bsd3;
diff --git a/pkgs/development/libraries/libportal/default.nix b/pkgs/development/libraries/libportal/default.nix
index 6f70663439122..5eacdaa8f3c80 100644
--- a/pkgs/development/libraries/libportal/default.nix
+++ b/pkgs/development/libraries/libportal/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , fetchpatch
 , meson
@@ -49,7 +49,7 @@ stdenv.mkDerivation rec {
     glib
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Flatpak portal library";
     homepage = "https://github.com/flatpak/libportal";
     license = licenses.lgpl2Plus;
diff --git a/pkgs/development/libraries/libproxy/default.nix b/pkgs/development/libraries/libproxy/default.nix
index 4876de5551d66..afd1a6365b45e 100644
--- a/pkgs/development/libraries/libproxy/default.nix
+++ b/pkgs/development/libraries/libproxy/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , pkg-config
 , cmake
@@ -82,21 +82,21 @@ stdenv.mkDerivation rec {
       sha256 = "0pdy9sw49lxpaiwq073cisk0npir5bkch70nimdmpszxwp3fv1d8";
     })
 
-  ] ++ stdenv.lib.optionals stdenv.isDarwin [
+  ] ++ lib.optionals stdenv.isDarwin [
     (fetchpatch {
       url = "https://github.com/libproxy/libproxy/commit/44158f03f8522116758d335688ed840dfcb50ac8.patch";
       sha256 = "0axfvb6j7gcys6fkwi9dkn006imhvm3kqr83gpwban8419n0q5v1";
     })
   ];
 
-  postFixup = stdenv.lib.optionalString stdenv.isLinux ''
+  postFixup = lib.optionalString stdenv.isLinux ''
     # config_gnome3 uses the helper to find GNOME proxy settings
     wrapProgram $out/libexec/pxgsettings --prefix XDG_DATA_DIRS : "${gsettings-desktop-schemas}/share/gsettings-schemas/${gsettings-desktop-schemas.name}"
   '';
 
   doCheck = false; # fails 1 out of 10 tests
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     platforms = platforms.linux ++ platforms.darwin;
     license = licenses.lgpl21;
     homepage = "http://libproxy.github.io/libproxy/";
diff --git a/pkgs/development/libraries/libpseudo/default.nix b/pkgs/development/libraries/libpseudo/default.nix
index d5418ec09d82b..f06381505739c 100644
--- a/pkgs/development/libraries/libpseudo/default.nix
+++ b/pkgs/development/libraries/libpseudo/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, pkg-config, glib, ncurses}:
+{lib, stdenv, fetchurl, pkg-config, glib, ncurses}:
 stdenv.mkDerivation rec {
   name = "libpseudo-1.2.0";
 
@@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ pkg-config ];
   buildInputs = [ glib ncurses ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://libpseudo.sourceforge.net/";
     description = "Simple, thread-safe messaging between threads";
     license = licenses.gpl2Plus;
diff --git a/pkgs/development/libraries/libpsl/default.nix b/pkgs/development/libraries/libpsl/default.nix
index ed6d63aa5241f..e68219f63485e 100644
--- a/pkgs/development/libraries/libpsl/default.nix
+++ b/pkgs/development/libraries/libpsl/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , autoreconfHook
 , docbook_xsl
@@ -32,7 +32,7 @@ stdenv.mkDerivation rec {
     pkg-config
     python3
     libxslt
-  ] ++ stdenv.lib.optionals (!stdenv.isDarwin) [
+  ] ++ lib.optionals (!stdenv.isDarwin) [
     valgrind
   ];
 
@@ -60,7 +60,7 @@ stdenv.mkDerivation rec {
     "--with-psl-distfile=${publicsuffix-list}/share/publicsuffix/public_suffix_list.dat"
     "--with-psl-file=${publicsuffix-list}/share/publicsuffix/public_suffix_list.dat"
     "--with-psl-testfile=${publicsuffix-list}/share/publicsuffix/test_psl.txt"
-  ] ++ stdenv.lib.optionals (!stdenv.isDarwin) [
+  ] ++ lib.optionals (!stdenv.isDarwin) [
     "--enable-valgrind-tests"
   ];
 
@@ -68,7 +68,7 @@ stdenv.mkDerivation rec {
 
   doCheck = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "C library for the Publix Suffix List";
     longDescription = ''
       libpsl is a C library for the Publix Suffix List (PSL). A "public suffix"
diff --git a/pkgs/development/libraries/libpst/default.nix b/pkgs/development/libraries/libpst/default.nix
index 829bea9351e16..40f6b3b1aee17 100644
--- a/pkgs/development/libraries/libpst/default.nix
+++ b/pkgs/development/libraries/libpst/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, autoreconfHook, boost, libgsf,
+{ lib, stdenv, fetchurl, autoreconfHook, boost, libgsf,
   pkg-config, bzip2, xmlto, gettext, imagemagick, doxygen }:
 
 stdenv.mkDerivation rec {
@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
 
   doCheck = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://www.five-ten-sg.com/libpst/";
     description = "A library to read PST (MS Outlook Personal Folders) files";
     license = licenses.gpl2;
diff --git a/pkgs/development/libraries/libqalculate/default.nix b/pkgs/development/libraries/libqalculate/default.nix
index ca1bfecfadba8..80e6e6fe66898 100644
--- a/pkgs/development/libraries/libqalculate/default.nix
+++ b/pkgs/development/libraries/libqalculate/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, mpfr, libxml2, intltool, pkg-config, doxygen,
+{ lib, stdenv, fetchFromGitHub, mpfr, libxml2, intltool, pkg-config, doxygen,
   autoreconfHook, readline, libiconv, icu, curl, gnuplot, gettext }:
 
 stdenv.mkDerivation rec {
@@ -28,7 +28,7 @@ stdenv.mkDerivation rec {
     substituteInPlace libqalculate/Calculator-plot.cc \
       --replace 'commandline = "gnuplot"' 'commandline = "${gnuplot}/bin/gnuplot"' \
       --replace '"gnuplot - ' '"${gnuplot}/bin/gnuplot - '
-  '' + stdenv.lib.optionalString stdenv.cc.isClang ''
+  '' + lib.optionalString stdenv.cc.isClang ''
     substituteInPlace src/qalc.cc \
       --replace 'printf(_("aborted"))' 'printf("%s", _("aborted"))'
   '';
@@ -39,7 +39,7 @@ stdenv.mkDerivation rec {
     popd
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "An advanced calculator library";
     homepage = "http://qalculate.github.io";
     maintainers = with maintainers; [ gebner ];
diff --git a/pkgs/development/libraries/libqb/default.nix b/pkgs/development/libraries/libqb/default.nix
index 7f3ca25ec40f0..3f0a9a28d1941 100644
--- a/pkgs/development/libraries/libqb/default.nix
+++ b/pkgs/development/libraries/libqb/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config }:
+{ lib, stdenv, fetchurl, pkg-config }:
 
 stdenv.mkDerivation rec {
   name = "libqb-0.17.2";
@@ -10,7 +10,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ pkg-config ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/clusterlabs/libqb";
     description = "A library providing high performance logging, tracing, ipc, and poll";
     license = licenses.lgpl21;
diff --git a/pkgs/development/libraries/libqglviewer/default.nix b/pkgs/development/libraries/libqglviewer/default.nix
index 0d1da964adb5c..4fc50f2073092 100644
--- a/pkgs/development/libraries/libqglviewer/default.nix
+++ b/pkgs/development/libraries/libqglviewer/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, qmake, qtbase, libGLU, AGL }:
+{ lib, stdenv, fetchurl, qmake, qtbase, libGLU, AGL }:
 
 stdenv.mkDerivation rec {
   pname = "libqglviewer";
@@ -11,13 +11,13 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ qmake ];
   buildInputs = [ qtbase libGLU ]
-    ++ stdenv.lib.optional stdenv.isDarwin AGL;
+    ++ lib.optional stdenv.isDarwin AGL;
 
   postPatch = ''
     cd QGLViewer
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "C++ library based on Qt that eases the creation of OpenGL 3D viewers";
     homepage = "http://libqglviewer.com";
     license = licenses.gpl2;
diff --git a/pkgs/development/libraries/libqmi/default.nix b/pkgs/development/libraries/libqmi/default.nix
index de38e5d3b6e73..e616fae92502b 100644
--- a/pkgs/development/libraries/libqmi/default.nix
+++ b/pkgs/development/libraries/libqmi/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, gobject-introspection, glib, python3, libgudev, libmbim }:
+{ lib, stdenv, fetchurl, pkg-config, gobject-introspection, glib, python3, libgudev, libmbim }:
 
 stdenv.mkDerivation rec {
   pname = "libqmi";
@@ -32,7 +32,7 @@ stdenv.mkDerivation rec {
 
   doCheck = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://www.freedesktop.org/wiki/Software/libqmi/";
     description = "Modem protocol helper library";
     platforms = platforms.linux;
diff --git a/pkgs/development/libraries/libr3/default.nix b/pkgs/development/libraries/libr3/default.nix
index d838c07de8707..34ac547f49209 100644
--- a/pkgs/development/libraries/libr3/default.nix
+++ b/pkgs/development/libraries/libr3/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , pcre
 , pkg-config
@@ -27,7 +27,7 @@ stdenv.mkDerivation rec {
   meta = {
     description = "A high-performance path dispatching library";
     homepage = "https://github.com/c9s/r3";
-    license = [ stdenv.lib.licenses.mit ];
+    license = [ lib.licenses.mit ];
   };
 
 }
diff --git a/pkgs/development/libraries/libraspberrypi/default.nix b/pkgs/development/libraries/libraspberrypi/default.nix
index 664b8d1a7e0db..217a83bcebc3d 100644
--- a/pkgs/development/libraries/libraspberrypi/default.nix
+++ b/pkgs/development/libraries/libraspberrypi/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , fetchpatch
 , cmake
@@ -30,7 +30,7 @@ stdenv.mkDerivation rec {
     "-DVMCS_INSTALL_PREFIX=${placeholder "out"}"
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Userland tools & libraries for interfacing with Raspberry Pi hardware";
     homepage = "https://github.com/raspberrypi/userland";
     license = licenses.bsd3;
diff --git a/pkgs/development/libraries/libraw/default.nix b/pkgs/development/libraries/libraw/default.nix
index 123bd87ae3015..3ff7e725f3d86 100644
--- a/pkgs/development/libraries/libraw/default.nix
+++ b/pkgs/development/libraries/libraw/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, autoreconfHook, lcms2, pkg-config }:
+{ lib, stdenv, fetchFromGitHub, autoreconfHook, lcms2, pkg-config }:
 
 stdenv.mkDerivation rec {
   pname = "libraw";
@@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Library for reading RAW files obtained from digital photo cameras (CRW/CR2, NEF, RAF, DNG, and others)";
     homepage = "https://www.libraw.org/";
     license = licenses.gpl2Plus;
diff --git a/pkgs/development/libraries/libraw1394/default.nix b/pkgs/development/libraries/libraw1394/default.nix
index a99e4d22077e0..7bf99e739f31d 100644
--- a/pkgs/development/libraries/libraw1394/default.nix
+++ b/pkgs/development/libraries/libraw1394/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
   name = "libraw1394-2.1.2";
@@ -8,7 +8,7 @@ stdenv.mkDerivation rec {
     sha256 = "0z5md84941ky5l7afayx2z6j0sk0mildxbjajq6niznd44ky7i6x";
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Library providing direct access to the IEEE 1394 bus through the Linux 1394 subsystem's raw1394 user space interface";
     homepage = "https://ieee1394.wiki.kernel.org/index.php/Libraries#libraw1394";
     license = licenses.lgpl21Plus;
diff --git a/pkgs/development/libraries/librdf/raptor.nix b/pkgs/development/libraries/librdf/raptor.nix
index ef194bb0b1ecb..8d1b1f2a0ea4d 100644
--- a/pkgs/development/libraries/librdf/raptor.nix
+++ b/pkgs/development/libraries/librdf/raptor.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, libxml2, curl }:
+{ lib, stdenv, fetchurl, libxml2, curl }:
 
 stdenv.mkDerivation rec {
   name = "raptor-1.4.21";
@@ -17,8 +17,8 @@ stdenv.mkDerivation rec {
   meta = {
     description = "The RDF Parser Toolkit";
     homepage = "http://librdf.org/raptor";
-    license = with stdenv.lib.licenses; [ lgpl21 asl20 ];
-    maintainers = [ stdenv.lib.maintainers.marcweber ];
-    platforms = stdenv.lib.platforms.linux;
+    license = with lib.licenses; [ lgpl21 asl20 ];
+    maintainers = [ lib.maintainers.marcweber ];
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/development/libraries/librdf/raptor2.nix b/pkgs/development/libraries/librdf/raptor2.nix
index 4645b5ea0d833..bb8aeefa102cb 100644
--- a/pkgs/development/libraries/librdf/raptor2.nix
+++ b/pkgs/development/libraries/librdf/raptor2.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, libxml2, libxslt }:
+{ lib, stdenv, fetchurl, libxml2, libxslt }:
 
 stdenv.mkDerivation rec {
   pname = "raptor2";
@@ -24,8 +24,8 @@ stdenv.mkDerivation rec {
   meta = {
     description = "The RDF Parser Toolkit";
     homepage = "http://librdf.org/raptor";
-    license = with stdenv.lib.licenses; [ lgpl21 asl20 ];
-    maintainers = with stdenv.lib.maintainers; [ marcweber ];
-    platforms = stdenv.lib.platforms.unix;
+    license = with lib.licenses; [ lgpl21 asl20 ];
+    maintainers = with lib.maintainers; [ marcweber ];
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/librdf/rasqal.nix b/pkgs/development/libraries/librdf/rasqal.nix
index ff8679b86abca..88acc372f7f5d 100644
--- a/pkgs/development/libraries/librdf/rasqal.nix
+++ b/pkgs/development/libraries/librdf/rasqal.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, librdf_raptor2, gmp, pkg-config, pcre, libxml2, perl }:
+{ lib, stdenv, fetchurl, librdf_raptor2, gmp, pkg-config, pcre, libxml2, perl }:
 
 stdenv.mkDerivation rec {
   name = "rasqal-0.9.33";
@@ -23,8 +23,8 @@ stdenv.mkDerivation rec {
   meta = {
     description = "Library that handles Resource Description Framework (RDF)";
     homepage = "http://librdf.org/rasqal";
-    license = with stdenv.lib.licenses; [ lgpl21 asl20 ];
-    maintainers = with stdenv.lib.maintainers; [ marcweber ];
-    platforms = stdenv.lib.platforms.unix;
+    license = with lib.licenses; [ lgpl21 asl20 ];
+    maintainers = with lib.maintainers; [ marcweber ];
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/librdf/redland.nix b/pkgs/development/libraries/librdf/redland.nix
index f9863b922c73a..731d1cf18684d 100644
--- a/pkgs/development/libraries/librdf/redland.nix
+++ b/pkgs/development/libraries/librdf/redland.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, openssl, libxslt, perl
+{ lib, stdenv, fetchurl, pkg-config, openssl, libxslt, perl
 , curl, pcre, libxml2, librdf_rasqal, gmp
 , libmysqlclient, withMysql ? false
 , postgresql, withPostgresql ? false
@@ -17,10 +17,10 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ perl pkg-config ];
 
   buildInputs = [ openssl libxslt curl pcre libxml2 gmp ]
-    ++ stdenv.lib.optional withMysql libmysqlclient
-    ++ stdenv.lib.optional withSqlite sqlite
-    ++ stdenv.lib.optional withPostgresql postgresql
-    ++ stdenv.lib.optional withBdb db;
+    ++ lib.optional withMysql libmysqlclient
+    ++ lib.optional withSqlite sqlite
+    ++ lib.optional withPostgresql postgresql
+    ++ lib.optional withBdb db;
 
   propagatedBuildInputs = [ librdf_rasqal ];
 
@@ -28,7 +28,7 @@ stdenv.mkDerivation rec {
 
   configureFlags =
     [ "--with-threads" ]
-    ++ stdenv.lib.optionals withBdb [
+    ++ lib.optionals withBdb [
       "--with-bdb-include=${db.dev}/include"
       "--with-bdb-lib=${db.out}/lib"
     ];
@@ -38,7 +38,7 @@ stdenv.mkDerivation rec {
 
   doCheck = false; # fails 1 out of 17 tests with a segmentation fault
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "C libraries that provide support for the Resource Description Framework (RDF)";
     homepage = "http://librdf.org/";
     platforms = platforms.unix;
diff --git a/pkgs/development/libraries/libre/default.nix b/pkgs/development/libraries/libre/default.nix
index 6e1d0a8ce3c4a..d2f6e31596f06 100644
--- a/pkgs/development/libraries/libre/default.nix
+++ b/pkgs/development/libraries/libre/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, zlib, openssl}:
+{lib, stdenv, fetchurl, zlib, openssl}:
 stdenv.mkDerivation rec {
   version = "0.6.1";
   pname = "libre";
@@ -8,15 +8,15 @@ stdenv.mkDerivation rec {
   };
   buildInputs = [ zlib openssl ];
   makeFlags = [ "USE_ZLIB=1" "USE_OPENSSL=1" "PREFIX=$(out)" ]
-  ++ stdenv.lib.optional (stdenv.cc.cc != null) "SYSROOT_ALT=${stdenv.cc.cc}"
-  ++ stdenv.lib.optional (stdenv.cc.libc != null) "SYSROOT=${stdenv.lib.getDev stdenv.cc.libc}"
+  ++ lib.optional (stdenv.cc.cc != null) "SYSROOT_ALT=${stdenv.cc.cc}"
+  ++ lib.optional (stdenv.cc.libc != null) "SYSROOT=${stdenv.lib.getDev stdenv.cc.libc}"
   ;
   meta = {
     description = "A library for real-time communications with async IO support and a complete SIP stack";
     homepage = "http://www.creytiv.com/re.html";
-    platforms = with stdenv.lib.platforms; linux;
-    maintainers = with stdenv.lib.maintainers; [raskin];
-    license = stdenv.lib.licenses.bsd3;
+    platforms = with lib.platforms; linux;
+    maintainers = with lib.maintainers; [raskin];
+    license = lib.licenses.bsd3;
     inherit version;
     downloadPage = "http://www.creytiv.com/pub/";
     updateWalker = true;
diff --git a/pkgs/development/libraries/librealsense/default.nix b/pkgs/development/libraries/librealsense/default.nix
index 9a2ea6d033e46..82761dc3d0090 100644
--- a/pkgs/development/libraries/librealsense/default.nix
+++ b/pkgs/development/libraries/librealsense/default.nix
@@ -51,7 +51,7 @@ stdenv.mkDerivation rec {
     cp ../wrappers/python/pyrealsense2/__init__.py $out/${pythonPackages.python.sitePackages}/pyrealsense2
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A cross-platform library for Intel® RealSense™ depth cameras (D400 series and the SR300)";
     homepage = "https://github.com/IntelRealSense/librealsense";
     license = licenses.asl20;
diff --git a/pkgs/development/libraries/librelp/default.nix b/pkgs/development/libraries/librelp/default.nix
index 0a56e4199e43b..edf927e866470 100644
--- a/pkgs/development/libraries/librelp/default.nix
+++ b/pkgs/development/libraries/librelp/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub
+{ lib, stdenv, fetchFromGitHub
 , autoreconfHook
 , gnutls
 , openssl
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ pkg-config autoreconfHook ];
   buildInputs = [ gnutls zlib openssl ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A reliable logging library";
     homepage = "https://www.librelp.com/";
     license = licenses.gpl2;
diff --git a/pkgs/development/libraries/librem/default.nix b/pkgs/development/libraries/librem/default.nix
index 012ac2a46a745..4e8d6fca616cb 100644
--- a/pkgs/development/libraries/librem/default.nix
+++ b/pkgs/development/libraries/librem/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, zlib, openssl, libre}:
+{lib, stdenv, fetchurl, zlib, openssl, libre}:
 stdenv.mkDerivation rec {
   version = "0.6.0";
   pname = "librem";
@@ -12,15 +12,15 @@ stdenv.mkDerivation rec {
     "LIBRE_INC=${libre}/include/re"
     ''PREFIX=$(out)''
   ]
-  ++ stdenv.lib.optional (stdenv.cc.cc != null) "SYSROOT_ALT=${stdenv.lib.getDev stdenv.cc.cc}"
-  ++ stdenv.lib.optional (stdenv.cc.libc != null) "SYSROOT=${stdenv.lib.getDev stdenv.cc.libc}"
+  ++ lib.optional (stdenv.cc.cc != null) "SYSROOT_ALT=${stdenv.lib.getDev stdenv.cc.cc}"
+  ++ lib.optional (stdenv.cc.libc != null) "SYSROOT=${stdenv.lib.getDev stdenv.cc.libc}"
   ;
   meta = {
     description = " A library for real-time audio and video processing";
     homepage = "http://www.creytiv.com/rem.html";
-    platforms = with stdenv.lib.platforms; linux;
-    maintainers = with stdenv.lib.maintainers; [raskin];
-    license = stdenv.lib.licenses.bsd3;
+    platforms = with lib.platforms; linux;
+    maintainers = with lib.maintainers; [raskin];
+    license = lib.licenses.bsd3;
     downloadPage = "http://www.creytiv.com/pub/";
     updateWalker = true;
     downloadURLRegexp = "/rem-.*[.]tar[.].*";
diff --git a/pkgs/development/libraries/librep/default.nix b/pkgs/development/libraries/librep/default.nix
index 747f9495015ad..74c45f00adcf8 100644
--- a/pkgs/development/libraries/librep/default.nix
+++ b/pkgs/development/libraries/librep/default.nix
@@ -1,9 +1,9 @@
-{ stdenv, fetchurl
+{ lib, stdenv, fetchurl
 , pkg-config, autoreconfHook
 , readline, texinfo
 , gdbm, gmp, libffi }:
 
-with stdenv.lib;
+with lib;
 
 stdenv.mkDerivation rec {
   pname = "librep";
diff --git a/pkgs/development/libraries/libresample/default.nix b/pkgs/development/libraries/libresample/default.nix
index 80dd4e05b211d..0756874b3e75a 100644
--- a/pkgs/development/libraries/libresample/default.nix
+++ b/pkgs/development/libraries/libresample/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, cmake}:
+{lib, stdenv, fetchurl, cmake}:
 
 let
   patch = fetchurl {
@@ -20,9 +20,9 @@ stdenv.mkDerivation {
 
   meta = {
     description = "A real-time library for sampling rate conversion library";
-    license = stdenv.lib.licenses.lgpl2Plus;
+    license = lib.licenses.lgpl2Plus;
     homepage = "https://ccrma.stanford.edu/~jos/resample/Free_Resampling_Software.html";
-    maintainers = [ stdenv.lib.maintainers.sander ];
-    platforms = stdenv.lib.platforms.unix;
+    maintainers = [ lib.maintainers.sander ];
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/librest/default.nix b/pkgs/development/libraries/librest/default.nix
index bff441589c24d..7b1ff8235aace 100644
--- a/pkgs/development/libraries/librest/default.nix
+++ b/pkgs/development/libraries/librest/default.nix
@@ -1,11 +1,11 @@
-{ stdenv, fetchurl, pkg-config, glib, libsoup, gobject-introspection, gnome3 }:
+{ lib, stdenv, fetchurl, pkg-config, glib, libsoup, gobject-introspection, gnome3 }:
 
 stdenv.mkDerivation rec {
   pname = "rest";
   version = "0.8.1";
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "0513aad38e5d3cedd4ae3c551634e3be1b9baaa79775e53b2dba9456f15b01c9";
   };
 
@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
     };
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Helper library for RESTful services";
     homepage = "https://wiki.gnome.org/Projects/Librest";
     license = licenses.lgpl21;
diff --git a/pkgs/development/libraries/librevenge/default.nix b/pkgs/development/libraries/librevenge/default.nix
index d36157a883c4a..3262869596694 100644
--- a/pkgs/development/libraries/librevenge/default.nix
+++ b/pkgs/development/libraries/librevenge/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, boost, pkg-config, cppunit, zlib}:
+{lib, stdenv, fetchurl, boost, pkg-config, cppunit, zlib}:
 let
   s = # Generated upstream information
   rec {
@@ -35,8 +35,8 @@ stdenv.mkDerivation {
   meta = {
     inherit (s) version;
     description = ''A base library for writing document import filters'';
-    license = stdenv.lib.licenses.mpl20 ;
-    maintainers = [stdenv.lib.maintainers.raskin];
-    platforms = stdenv.lib.platforms.unix;
+    license = lib.licenses.mpl20 ;
+    maintainers = [lib.maintainers.raskin];
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/librevisa/default.nix b/pkgs/development/libraries/librevisa/default.nix
index f1df19dc2e5b7..892bbbbbfc049 100644
--- a/pkgs/development/libraries/librevisa/default.nix
+++ b/pkgs/development/libraries/librevisa/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, libusb1 }:
+{ lib, stdenv, fetchurl, pkg-config, libusb1 }:
 
 # TODO: add VXI development files, for VXI-11 (TCPIP) support
 
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ pkg-config ];
   buildInputs = [ libusb1 ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Implementation of the VISA standard (for instrument control)";
     longDescription = ''
       LibreVISA aims to be a compliant implementation of the VISA standard in a
diff --git a/pkgs/development/libraries/librime/default.nix b/pkgs/development/libraries/librime/default.nix
index 4de2f1f8d3f6a..b6db462f3c345 100644
--- a/pkgs/development/libraries/librime/default.nix
+++ b/pkgs/development/libraries/librime/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, boost, glog, leveldb, marisa, opencc,
+{ lib, stdenv, fetchFromGitHub, cmake, boost, glog, leveldb, marisa, opencc,
   libyamlcpp, gmock }:
 
 stdenv.mkDerivation rec {
@@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ boost glog leveldb marisa opencc libyamlcpp gmock ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage    = "https://rime.im/";
     description = "Rime Input Method Engine, the core library";
     license     = licenses.bsd3;
diff --git a/pkgs/development/libraries/libroxml/default.nix b/pkgs/development/libraries/libroxml/default.nix
index b72ffb5b7ecce..de1877f2ab403 100644
--- a/pkgs/development/libraries/libroxml/default.nix
+++ b/pkgs/development/libraries/libroxml/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation {
   name = "libroxml-2.3.0";
@@ -6,7 +6,7 @@ stdenv.mkDerivation {
     url = "http://download.libroxml.net/pool/v2.x/libroxml-2.3.0.tar.gz";
     sha256  = "0y0vc9n4rfbimjp28nx4kdfzz08j5xymh5xjy84l9fhfac5z5a0x";
   };
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://www.libroxml.net/";
     description = "This library is minimum, easy-to-use, C implementation for xml file parsing";
     license = licenses.lgpl3;
diff --git a/pkgs/development/libraries/librseq/default.nix b/pkgs/development/libraries/librseq/default.nix
index 4fd8bb7e33a41..12b9b4109c70f 100644
--- a/pkgs/development/libraries/librseq/default.nix
+++ b/pkgs/development/libraries/librseq/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub
+{ lib, stdenv, fetchFromGitHub
 , autoreconfHook, linuxHeaders
 }:
 
@@ -34,7 +34,7 @@ stdenv.mkDerivation rec {
     rm -rf $out/share
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Userspace library for the Linux Restartable Sequence API";
     homepage    = "https://github.com/compudj/librseq";
     license     = licenses.lgpl21;
diff --git a/pkgs/development/libraries/librsvg/default.nix b/pkgs/development/libraries/librsvg/default.nix
index 7e2956d31cb14..efdbf5934630b 100644
--- a/pkgs/development/libraries/librsvg/default.nix
+++ b/pkgs/development/libraries/librsvg/default.nix
@@ -10,7 +10,7 @@ stdenv.mkDerivation rec {
   name = "${pname}-${version}";
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${name}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${name}.tar.xz";
     sha256 = "02csvx2nzygh8kyal2qiy3y6xb7d52vszxxr37dzav704a9pkncv";
   };
 
@@ -33,7 +33,7 @@ stdenv.mkDerivation rec {
     "--enable-vala"
     "--enable-installed-tests"
     "--enable-always-build-tests"
-  ] ++ stdenv.lib.optional stdenv.isDarwin "--disable-Bsymbolic";
+  ] ++ lib.optional stdenv.isDarwin "--disable-Bsymbolic";
 
   makeFlags = [
     "installed_test_metadir=$(installedTests)/share/installed-tests/RSVG"
@@ -41,7 +41,7 @@ stdenv.mkDerivation rec {
   ];
 
   NIX_CFLAGS_COMPILE
-    = stdenv.lib.optionalString stdenv.isDarwin "-I${cairo.dev}/include/cairo";
+    = lib.optionalString stdenv.isDarwin "-I${cairo.dev}/include/cairo";
 
   # It wants to add loaders and update the loaders.cache in gdk-pixbuf
   # Patching the Makefiles to it creates rsvg specific loaders and the
@@ -78,7 +78,7 @@ stdenv.mkDerivation rec {
     };
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A small library to render SVG images to Cairo surfaces";
     homepage = "https://wiki.gnome.org/Projects/LibRsvg";
     license = licenses.lgpl2Plus;
diff --git a/pkgs/development/libraries/librsync/0.9.nix b/pkgs/development/libraries/librsync/0.9.nix
index 35ccdcdf07820..74dca4e308545 100644
--- a/pkgs/development/libraries/librsync/0.9.nix
+++ b/pkgs/development/libraries/librsync/0.9.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation {
   name = "librsync-0.9.7";
@@ -11,16 +11,16 @@ stdenv.mkDerivation {
   hardeningDisable = [ "format" ];
 
   configureFlags = [
-    (stdenv.lib.enableFeature stdenv.isCygwin    "static")
-    (stdenv.lib.enableFeature (!stdenv.isCygwin) "shared")
+    (lib.enableFeature stdenv.isCygwin    "static")
+    (lib.enableFeature (!stdenv.isCygwin) "shared")
   ];
 
   dontStrip = stdenv.hostPlatform != stdenv.buildPlatform;
 
   meta = {
     homepage = "http://librsync.sourceforge.net/";
-    license = stdenv.lib.licenses.lgpl2Plus;
+    license = lib.licenses.lgpl2Plus;
     description = "Implementation of the rsync remote-delta algorithm";
-    platforms = stdenv.lib.platforms.unix;
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/librsync/default.nix b/pkgs/development/libraries/librsync/default.nix
index 9499be80f0338..9211d9d233f88 100644
--- a/pkgs/development/libraries/librsync/default.nix
+++ b/pkgs/development/libraries/librsync/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, perl, zlib, bzip2, popt }:
+{ lib, stdenv, fetchFromGitHub, cmake, perl, zlib, bzip2, popt }:
 
 stdenv.mkDerivation rec {
   pname = "librsync";
@@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
 
   dontStrip = stdenv.hostPlatform != stdenv.buildPlatform;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://librsync.sourceforge.net/";
     license = licenses.lgpl2Plus;
     description = "Implementation of the rsync remote-delta algorithm";
diff --git a/pkgs/development/libraries/librtprocess/default.nix b/pkgs/development/libraries/librtprocess/default.nix
index adabbe11cb3e1..3e44bfd3d7dd9 100644
--- a/pkgs/development/libraries/librtprocess/default.nix
+++ b/pkgs/development/libraries/librtprocess/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake }:
+{ lib, stdenv, fetchFromGitHub, cmake }:
 
 stdenv.mkDerivation rec {
   pname = "librtprocess";
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ cmake ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/CarVac/librtprocess";
     description = "Highly optimized library for processing RAW images";
     license = licenses.gpl3;
diff --git a/pkgs/development/libraries/libs3/default.nix b/pkgs/development/libraries/libs3/default.nix
index 3012263cb4149..5a2b8636774f0 100644
--- a/pkgs/development/libraries/libs3/default.nix
+++ b/pkgs/development/libraries/libs3/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, curl, libxml2 }:
+{ lib, stdenv, fetchFromGitHub, curl, libxml2 }:
 
 stdenv.mkDerivation {
   name = "libs3-2018-12-03";
@@ -14,7 +14,7 @@ stdenv.mkDerivation {
 
   makeFlags = [ "DESTDIR=$(out)" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/bji/libs3";
     description = "A library for interfacing with amazon s3";
     license = licenses.lgpl3Plus;
diff --git a/pkgs/development/libraries/libsamplerate/default.nix b/pkgs/development/libraries/libsamplerate/default.nix
index 645c742aca0c2..5cf872c3fc396 100644
--- a/pkgs/development/libraries/libsamplerate/default.nix
+++ b/pkgs/development/libraries/libsamplerate/default.nix
@@ -1,7 +1,7 @@
-{ stdenv, fetchurl, pkg-config, libsndfile, ApplicationServices, Carbon, CoreServices }:
+{ lib, stdenv, fetchurl, pkg-config, libsndfile, ApplicationServices, Carbon, CoreServices }:
 
 let
-  inherit (stdenv.lib) optionals optionalString;
+  inherit (lib) optionals optionalString;
 
 in stdenv.mkDerivation rec {
   name = "libsamplerate-0.1.9";
@@ -27,7 +27,7 @@ in stdenv.mkDerivation rec {
     substituteInPlace examples/Makefile --replace "-fpascal-strings" ""
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Sample Rate Converter for audio";
     homepage    = "http://www.mega-nerd.com/SRC/index.html";
     license     = licenses.bsd2;
diff --git a/pkgs/development/libraries/libsass/default.nix b/pkgs/development/libraries/libsass/default.nix
index cebfdfe383896..f4caa22b3229d 100644
--- a/pkgs/development/libraries/libsass/default.nix
+++ b/pkgs/development/libraries/libsass/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, autoreconfHook }:
+{ lib, stdenv, fetchFromGitHub, autoreconfHook }:
 
 stdenv.mkDerivation rec {
   pname = "libsass";
@@ -22,7 +22,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ autoreconfHook ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A C/C++ implementation of a Sass compiler";
     homepage = "https://github.com/sass/libsass";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/libschrift/default.nix b/pkgs/development/libraries/libschrift/default.nix
index a06f6c50d667b..3781d93461256 100644
--- a/pkgs/development/libraries/libschrift/default.nix
+++ b/pkgs/development/libraries/libschrift/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub }:
+{ lib, stdenv, fetchFromGitHub }:
 
 stdenv.mkDerivation rec {
   pname = "libschrift";
@@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
 
   makeFlags = [ "libschrift.a" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/tomolt/libschrift";
     description = "A lightweight TrueType font rendering library";
     license = licenses.isc;
diff --git a/pkgs/development/libraries/libscrypt/default.nix b/pkgs/development/libraries/libscrypt/default.nix
index 7eaa8f855784c..1bd22b2f7901d 100644
--- a/pkgs/development/libraries/libscrypt/default.nix
+++ b/pkgs/development/libraries/libscrypt/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub }:
+{ lib, stdenv, fetchFromGitHub }:
 
 stdenv.mkDerivation rec {
   pname = "libscrypt";
@@ -11,14 +11,14 @@ stdenv.mkDerivation rec {
     sha256 = "1d76ys6cp7fi4ng1w3mz2l0p9dbr7ljbk33dcywyimzjz8bahdng";
   };
 
-  buildFlags = stdenv.lib.optional stdenv.isDarwin "LDFLAGS= CFLAGS_EXTRA=";
+  buildFlags = lib.optional stdenv.isDarwin "LDFLAGS= CFLAGS_EXTRA=";
 
   installFlags = [ "PREFIX=$(out)" ];
-  installTargets = stdenv.lib.optional stdenv.isDarwin "install-osx";
+  installTargets = lib.optional stdenv.isDarwin "install-osx";
 
   doCheck = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Shared library that implements scrypt() functionality";
     homepage = "https://lolware.net/2014/04/29/libscrypt.html";
     license = licenses.bsd2;
diff --git a/pkgs/development/libraries/libsearpc/default.nix b/pkgs/development/libraries/libsearpc/default.nix
index 472f7fdc51c29..1ac5cef7c5f66 100644
--- a/pkgs/development/libraries/libsearpc/default.nix
+++ b/pkgs/development/libraries/libsearpc/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchFromGitHub, automake, autoconf, pkg-config, libtool, python2Packages, glib, jansson}:
+{lib, stdenv, fetchFromGitHub, automake, autoconf, pkg-config, libtool, python2Packages, glib, jansson}:
 
 stdenv.mkDerivation rec {
   version = "3.2.0";
@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
 
   preConfigure = "./autogen.sh";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/haiwen/libsearpc";
     description = "A simple and easy-to-use C language RPC framework (including both server side & client side) based on GObject System";
     license = licenses.lgpl3;
diff --git a/pkgs/development/libraries/libseccomp/default.nix b/pkgs/development/libraries/libseccomp/default.nix
index a0414f5ba55f2..7ea7add23f3ee 100644
--- a/pkgs/development/libraries/libseccomp/default.nix
+++ b/pkgs/development/libraries/libseccomp/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, getopt, util-linux, gperf }:
+{ lib, stdenv, fetchurl, getopt, util-linux, gperf }:
 
 stdenv.mkDerivation rec {
   pname = "libseccomp";
@@ -31,7 +31,7 @@ stdenv.mkDerivation rec {
     tar -zcf $pythonsrc --mtime="@$SOURCE_DATE_EPOCH" --sort=name --transform s/tmp-pythonsrc/python-foundationdb/ ./tmp-pythonsrc/
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "High level library for the Linux Kernel seccomp filter";
     homepage = "https://github.com/seccomp/libseccomp";
     license = licenses.lgpl21;
diff --git a/pkgs/development/libraries/libsecret/default.nix b/pkgs/development/libraries/libsecret/default.nix
index abc4b5949a8e1..6c28b7d16c162 100644
--- a/pkgs/development/libraries/libsecret/default.nix
+++ b/pkgs/development/libraries/libsecret/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, fetchpatch, glib, pkg-config, gettext, libxslt, python3
+{ lib, stdenv, fetchurl, fetchpatch, glib, pkg-config, gettext, libxslt, python3
 , docbook_xsl, docbook_xml_dtd_42 , libgcrypt, gobject-introspection, vala
 , gtk-doc, gnome3, gjs, libintl, dbus, xvfb_run }:
 
@@ -7,7 +7,7 @@ stdenv.mkDerivation rec {
   version = "0.20.4";
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "0a4xnfmraxchd9cq5ai66j12jv2vrgjmaaxz25kl031jvda4qnij";
   };
 
@@ -55,7 +55,7 @@ stdenv.mkDerivation rec {
   meta = {
     description = "A library for storing and retrieving passwords and other secrets";
     homepage = "https://wiki.gnome.org/Projects/Libsecret";
-    license = stdenv.lib.licenses.lgpl21Plus;
+    license = lib.licenses.lgpl21Plus;
     inherit (glib.meta) platforms maintainers;
   };
 }
diff --git a/pkgs/development/libraries/libserialport/default.nix b/pkgs/development/libraries/libserialport/default.nix
index f016e13fd8999..0a2adc4126f15 100644
--- a/pkgs/development/libraries/libserialport/default.nix
+++ b/pkgs/development/libraries/libserialport/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, udev, darwin }:
+{ lib, stdenv, fetchurl, pkg-config, udev, darwin }:
 
 stdenv.mkDerivation rec {
   name = "libserialport-0.1.1";
@@ -9,10 +9,10 @@ stdenv.mkDerivation rec {
   };
 
   nativeBuildInputs = [ pkg-config ];
-  buildInputs = stdenv.lib.optional stdenv.isLinux udev
-    ++ stdenv.lib.optional stdenv.isDarwin darwin.apple_sdk.frameworks.IOKit;
+  buildInputs = lib.optional stdenv.isLinux udev
+    ++ lib.optional stdenv.isDarwin darwin.apple_sdk.frameworks.IOKit;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Cross-platform shared library for serial port access";
     homepage = "https://sigrok.org/";
     license = licenses.gpl3Plus;
diff --git a/pkgs/development/libraries/libshout/default.nix b/pkgs/development/libraries/libshout/default.nix
index 7bd65bbdfb2f8..c810034f84787 100644
--- a/pkgs/development/libraries/libshout/default.nix
+++ b/pkgs/development/libraries/libshout/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config
+{ lib, stdenv, fetchurl, pkg-config
 , libvorbis, libtheora, speex }:
 
 # need pkg-config so that libshout installs ${out}/lib/pkgconfig/shout.pc
@@ -26,8 +26,8 @@ stdenv.mkDerivation rec {
     '';
 
     homepage = "http://www.icecast.org";
-    license = stdenv.lib.licenses.gpl2;
-    maintainers = with stdenv.lib.maintainers; [ jcumming ];
-    platforms = with stdenv.lib.platforms; unix;
+    license = lib.licenses.gpl2;
+    maintainers = with lib.maintainers; [ jcumming ];
+    platforms = with lib.platforms; unix;
   };
 }
diff --git a/pkgs/development/libraries/libsieve/default.nix b/pkgs/development/libraries/libsieve/default.nix
index e1c6f3efe526b..8253d1df74fe1 100644
--- a/pkgs/development/libraries/libsieve/default.nix
+++ b/pkgs/development/libraries/libsieve/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl}:
+{lib, stdenv, fetchurl}:
 stdenv.mkDerivation rec {
   version = "2.3.1";
   pname = "libsieve";
@@ -8,7 +8,7 @@ stdenv.mkDerivation rec {
     sha256 = "1gllhl9hbmc86dq3k98d4kjs5bwk0p2rlk7ywqj3fjn7jw6mbhcj";
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "An interpreter for RFC 3028 Sieve and various extensions";
     homepage = "http://sodabrew.com/libsieve/";
     license = licenses.lgpl21;
diff --git a/pkgs/development/libraries/libsigcxx/1.2.nix b/pkgs/development/libraries/libsigcxx/1.2.nix
index 09552f86fa759..a417e0bcc1d7c 100644
--- a/pkgs/development/libraries/libsigcxx/1.2.nix
+++ b/pkgs/development/libraries/libsigcxx/1.2.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, pkg-config, m4}:
+{lib, stdenv, fetchurl, pkg-config, m4}:
 
 stdenv.mkDerivation rec {
   name = "libsigc++-1.2.7";
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ pkg-config ];
   buildInputs = [ m4];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://libsigcplusplus.github.io/libsigcplusplus/";
     description = "A typesafe callback system for standard C++";
     branch = "1.2";
diff --git a/pkgs/development/libraries/libsigcxx/default.nix b/pkgs/development/libraries/libsigcxx/default.nix
index 4cc741a71c1d2..eac383fae0d94 100644
--- a/pkgs/development/libraries/libsigcxx/default.nix
+++ b/pkgs/development/libraries/libsigcxx/default.nix
@@ -1,11 +1,11 @@
-{ stdenv, fetchurl, pkg-config, gnum4, gnome3 }:
+{ lib, stdenv, fetchurl, pkg-config, gnum4, gnome3 }:
 
 stdenv.mkDerivation rec {
   pname = "libsigc++";
   version = "2.10.1";
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "00v08km4wwzbh6vjxb21388wb9dm6g2xh14rgwabnv4c2wk5z8n9";
   };
 
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
     };
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://libsigcplusplus.github.io/libsigcplusplus/";
     description = "A typesafe callback system for standard C++";
     license = licenses.lgpl21;
diff --git a/pkgs/development/libraries/libsignal-protocol-c/default.nix b/pkgs/development/libraries/libsignal-protocol-c/default.nix
index 6278f6234f0b1..203d3613af85a 100644
--- a/pkgs/development/libraries/libsignal-protocol-c/default.nix
+++ b/pkgs/development/libraries/libsignal-protocol-c/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, openssl }:
+{ lib, stdenv, fetchFromGitHub, cmake, openssl }:
 
 stdenv.mkDerivation rec {
   pname = "libsignal-protocol-c";
@@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
 
   outputs = [ "out" "dev" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Signal Protocol C Library";
     homepage = "https://github.com/signalapp/libsignal-protocol-c";
     license = licenses.gpl3;
diff --git a/pkgs/development/libraries/libsignon-glib/default.nix b/pkgs/development/libraries/libsignon-glib/default.nix
index 4ac48c4985fd9..ae7a6775de553 100644
--- a/pkgs/development/libraries/libsignon-glib/default.nix
+++ b/pkgs/development/libraries/libsignon-glib/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchgit, nix-update-script, pkg-config, meson, ninja, vala, python3, gtk-doc, docbook_xsl, docbook_xml_dtd_43, docbook_xml_dtd_412, glib, check, gobject-introspection }:
+{ lib, stdenv, fetchgit, nix-update-script, pkg-config, meson, ninja, vala, python3, gtk-doc, docbook_xsl, docbook_xml_dtd_43, docbook_xml_dtd_412, glib, check, gobject-introspection }:
 
 stdenv.mkDerivation rec {
   pname = "libsignon-glib";
@@ -48,7 +48,7 @@ stdenv.mkDerivation rec {
     };
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A library for managing single signon credentials which can be used from GLib applications";
     homepage = "https://gitlab.com/accounts-sso/libsignon-glib";
     license = licenses.lgpl21;
diff --git a/pkgs/development/libraries/libsigsegv/default.nix b/pkgs/development/libraries/libsigsegv/default.nix
index 30921ade4cf59..20cb80b1ff852 100644
--- a/pkgs/development/libraries/libsigsegv/default.nix
+++ b/pkgs/development/libraries/libsigsegv/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl
+{ lib, stdenv, fetchurl
 , enableSigbusFix ? false # required by kernels < 3.18.6
 }:
 
@@ -28,9 +28,9 @@ stdenv.mkDerivation rec {
       more.
     '';
 
-    license = stdenv.lib.licenses.gpl2Plus;
+    license = lib.licenses.gpl2Plus;
 
     maintainers = [ ];
-    platforms = stdenv.lib.platforms.unix;
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/libsixel/default.nix b/pkgs/development/libraries/libsixel/default.nix
index 9e151931e6537..e82ecde5ddd24 100644
--- a/pkgs/development/libraries/libsixel/default.nix
+++ b/pkgs/development/libraries/libsixel/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchFromGitHub}:
+{lib, stdenv, fetchFromGitHub}:
 stdenv.mkDerivation rec {
   version = "1.8.6";
   pname = "libsixel";
@@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
 
   doCheck = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "The SIXEL library for console graphics, and converter programs";
     homepage = "http://saitoha.github.com/libsixel";
     maintainers = with maintainers; [ vrthra ];
diff --git a/pkgs/development/libraries/libskk/default.nix b/pkgs/development/libraries/libskk/default.nix
index a950064cf6a52..c4b36704cb97f 100644
--- a/pkgs/development/libraries/libskk/default.nix
+++ b/pkgs/development/libraries/libskk/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub,
+{ lib, stdenv, fetchFromGitHub,
   libtool, gettext, pkg-config,
   vala, gnome-common, gobject-introspection,
   libgee, json-glib, skk-dicts, libxkbcommon }:
@@ -42,8 +42,8 @@ stdenv.mkDerivation rec {
       user dictionary, skkserv, and CDB format dictionary.
     '';
     homepage = "https://github.com/ueno/libskk";
-    license = stdenv.lib.licenses.gpl3Plus;
-    maintainers = with stdenv.lib.maintainers; [ yuriaisaka ];
-    platforms = stdenv.lib.platforms.linux;
+    license = lib.licenses.gpl3Plus;
+    maintainers = with lib.maintainers; [ yuriaisaka ];
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/development/libraries/libslirp/default.nix b/pkgs/development/libraries/libslirp/default.nix
index af6d26bc22b64..8bd74d2924307 100644
--- a/pkgs/development/libraries/libslirp/default.nix
+++ b/pkgs/development/libraries/libslirp/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitLab
 , meson
 , ninja
@@ -26,7 +26,7 @@ stdenv.mkDerivation rec {
     echo ${version} > .tarball-version
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "General purpose TCP-IP emulator";
     homepage = "https://gitlab.freedesktop.org/slirp/libslirp";
     license = licenses.bsd3;
diff --git a/pkgs/development/libraries/libsmartcols/default.nix b/pkgs/development/libraries/libsmartcols/default.nix
index ceda7b5d93691..f824e54cdbf4c 100644
--- a/pkgs/development/libraries/libsmartcols/default.nix
+++ b/pkgs/development/libraries/libsmartcols/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, autoreconfHook, pkg-config, python3 }:
+{ lib, stdenv, fetchFromGitHub, autoreconfHook, pkg-config, python3 }:
 
 stdenv.mkDerivation rec {
   name = "libsmartcols";
@@ -24,9 +24,9 @@ stdenv.mkDerivation rec {
   meta = {
     description = "smart column output alignment library";
     homepage = https://github.com/karelzak/util-linux/tree/master/libsmartcols;
-    license = stdenv.lib.licenses.gpl2Plus;
-    platforms = stdenv.lib.platforms.linux ++ stdenv.lib.platforms.darwin;
-    maintainers = with stdenv.lib.maintainers; [ rb2k ];
+    license = lib.licenses.gpl2Plus;
+    platforms = lib.platforms.linux ++ stdenv.lib.platforms.darwin;
+    maintainers = with lib.maintainers; [ rb2k ];
   };
 }
 
diff --git a/pkgs/development/libraries/libsmi/default.nix b/pkgs/development/libraries/libsmi/default.nix
index 881af18d5592c..ab9d7d85c86cb 100644
--- a/pkgs/development/libraries/libsmi/default.nix
+++ b/pkgs/development/libraries/libsmi/default.nix
@@ -1,4 +1,4 @@
-{ stdenv , fetchurl }:
+{ lib, stdenv , fetchurl }:
 
 stdenv.mkDerivation rec {
   pname = "libsmi";
@@ -9,10 +9,10 @@ stdenv.mkDerivation rec {
     sha256 = "1lslaxr2qcj6hf4naq5n5mparfhmswsgq4wa7zm2icqvvgdcq6pj";
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A Library to Access SMI MIB Information";
     homepage = "https://www.ibr.cs.tu-bs.de/projects/libsmi/index.html";
     license = licenses.free;
-    platforms = stdenv.lib.platforms.linux ++ stdenv.lib.platforms.darwin;
+    platforms = lib.platforms.linux ++ stdenv.lib.platforms.darwin;
   };
 }
diff --git a/pkgs/development/libraries/libsnark/default.nix b/pkgs/development/libraries/libsnark/default.nix
index 6de498f6d29e5..fc3e15f688d4a 100644
--- a/pkgs/development/libraries/libsnark/default.nix
+++ b/pkgs/development/libraries/libsnark/default.nix
@@ -5,7 +5,7 @@ let
   inherit (stdenv) lib;
 in stdenv.mkDerivation rec {
   name = "libsnark-pre${version}";
-  version = stdenv.lib.substring 0 8 rev;
+  version = lib.substring 0 8 rev;
 
   nativeBuildInputs = [ cmake pkg-config ];
   buildInputs = [ openssl boost gmp ] ++ lib.optional stdenv.hostPlatform.isLinux procps;
@@ -20,10 +20,10 @@ in stdenv.mkDerivation rec {
     fetchSubmodules = true;
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "C++ library for zkSNARKs";
     homepage = "https://github.com/scipr-lab/libsnark";
     license = licenses.mit;
-    platforms = stdenv.lib.platforms.linux ++ stdenv.lib.platforms.darwin;
+    platforms = lib.platforms.linux ++ stdenv.lib.platforms.darwin;
   };
 }
diff --git a/pkgs/development/libraries/libsndfile/default.nix b/pkgs/development/libraries/libsndfile/default.nix
index d154a7194bbf2..61e6d9cd7652c 100644
--- a/pkgs/development/libraries/libsndfile/default.nix
+++ b/pkgs/development/libraries/libsndfile/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, autoreconfHook, autogen, flac, libogg, libopus, libvorbis, pkg-config, python3
+{ lib, stdenv, fetchFromGitHub, autoreconfHook, autogen, flac, libogg, libopus, libvorbis, pkg-config, python3
 , Carbon, AudioToolbox
 }:
 
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ autoreconfHook autogen pkg-config python3 ];
   buildInputs = [ flac libogg libopus libvorbis ]
-    ++ stdenv.lib.optionals stdenv.isDarwin [ Carbon AudioToolbox ];
+    ++ lib.optionals stdenv.isDarwin [ Carbon AudioToolbox ];
 
   enableParallelBuilding = true;
 
@@ -23,7 +23,7 @@ stdenv.mkDerivation rec {
 
   # need headers from the Carbon.framework in /System/Library/Frameworks to
   # compile this on darwin -- not sure how to handle
-  preConfigure = stdenv.lib.optionalString stdenv.isDarwin
+  preConfigure = lib.optionalString stdenv.isDarwin
     ''
       NIX_CFLAGS_COMPILE+=" -I$SDKROOT/System/Library/Frameworks/Carbon.framework/Versions/A/Headers"
     '';
@@ -31,7 +31,7 @@ stdenv.mkDerivation rec {
   # Needed on Darwin.
   NIX_CFLAGS_LINK = "-logg -lvorbis";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A C library for reading and writing files containing sampled sound";
     homepage    = "https://libsndfile.github.io/libsndfile/";
     license     = licenses.lgpl2Plus;
diff --git a/pkgs/development/libraries/libsodium/default.nix b/pkgs/development/libraries/libsodium/default.nix
index c6381e2a14142..db2cd044592b5 100644
--- a/pkgs/development/libraries/libsodium/default.nix
+++ b/pkgs/development/libraries/libsodium/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
   name = "libsodium-1.0.18";
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
 
   doCheck = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A modern and easy-to-use crypto library";
     homepage = "http://doc.libsodium.org/";
     license = licenses.isc;
diff --git a/pkgs/development/libraries/libsolv/default.nix b/pkgs/development/libraries/libsolv/default.nix
index d75d9cc07805f..bfacecde256d6 100644
--- a/pkgs/development/libraries/libsolv/default.nix
+++ b/pkgs/development/libraries/libsolv/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, ninja, zlib, expat, rpm, db }:
+{ lib, stdenv, fetchFromGitHub, cmake, ninja, zlib, expat, rpm, db }:
 
 stdenv.mkDerivation rec {
   version  = "0.7.16";
@@ -22,7 +22,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ cmake ninja ];
   buildInputs = [ zlib expat rpm db ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A free package dependency solver";
     homepage    = "https://github.com/openSUSE/libsolv";
     license     = licenses.bsd3;
diff --git a/pkgs/development/libraries/libsoundio/default.nix b/pkgs/development/libraries/libsoundio/default.nix
index a4a81af532ad9..ac9f3b2565463 100644
--- a/pkgs/development/libraries/libsoundio/default.nix
+++ b/pkgs/development/libraries/libsoundio/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, alsaLib, libjack2, libpulseaudio, AudioUnit }:
+{ lib, stdenv, fetchFromGitHub, cmake, alsaLib, libjack2, libpulseaudio, AudioUnit }:
 
 stdenv.mkDerivation rec {
   version = "2.0.0";
@@ -14,12 +14,12 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ cmake ];
 
   buildInputs = [ libjack2 libpulseaudio ]
-    ++ stdenv.lib.optional stdenv.isLinux alsaLib
-    ++ stdenv.lib.optional stdenv.isDarwin AudioUnit;
+    ++ lib.optional stdenv.isLinux alsaLib
+    ++ lib.optional stdenv.isDarwin AudioUnit;
 
-  NIX_CFLAGS_COMPILE = stdenv.lib.optionalString stdenv.isDarwin "-Wno-strict-prototypes";
+  NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isDarwin "-Wno-strict-prototypes";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Cross platform audio input and output";
     homepage = "http://libsound.io/";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/libsoup/default.nix b/pkgs/development/libraries/libsoup/default.nix
index d052cbdc87727..47fcdd41f8abd 100644
--- a/pkgs/development/libraries/libsoup/default.nix
+++ b/pkgs/development/libraries/libsoup/default.nix
@@ -8,7 +8,7 @@ stdenv.mkDerivation rec {
   version = "2.72.0";
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "11skbyw2pw32178q3h8pi7xqa41b2x4k6q4k9f75zxmh8s23y30p";
   };
 
@@ -54,7 +54,7 @@ stdenv.mkDerivation rec {
   meta = {
     description = "HTTP client/server library for GNOME";
     homepage = "https://wiki.gnome.org/Projects/libsoup";
-    license = stdenv.lib.licenses.lgpl2Plus;
+    license = lib.licenses.lgpl2Plus;
     inherit (glib.meta) maintainers platforms;
   };
 }
diff --git a/pkgs/development/libraries/libspatialindex/default.nix b/pkgs/development/libraries/libspatialindex/default.nix
index 4b5f7f4b3f105..4c778fbd69022 100644
--- a/pkgs/development/libraries/libspatialindex/default.nix
+++ b/pkgs/development/libraries/libspatialindex/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 let version = "1.8.5"; in
 
@@ -16,7 +16,7 @@ stdenv.mkDerivation {
   meta = {
     description = "Extensible spatial index library in C++";
     homepage = "http://libspatialindex.github.io/";
-    license = stdenv.lib.licenses.mit;
-    platforms = stdenv.lib.platforms.unix;
+    license = lib.licenses.mit;
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/libspectre/default.nix b/pkgs/development/libraries/libspectre/default.nix
index ec2a6242d9ec9..465aa941f396f 100644
--- a/pkgs/development/libraries/libspectre/default.nix
+++ b/pkgs/development/libraries/libspectre/default.nix
@@ -1,4 +1,4 @@
-{ fetchurl, stdenv, pkg-config, ghostscript, cairo }:
+{ fetchurl, lib, stdenv, pkg-config, ghostscript, cairo }:
 
 stdenv.mkDerivation rec {
   name = "libspectre-0.2.7";
@@ -27,7 +27,7 @@ stdenv.mkDerivation rec {
       handling and rendering Postscript documents.
     '';
 
-    license = stdenv.lib.licenses.gpl2Plus;
-    platforms = stdenv.lib.platforms.unix;
+    license = lib.licenses.gpl2Plus;
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/libspf2/default.nix b/pkgs/development/libraries/libspf2/default.nix
index 42b39179b2047..6a9cb8b647cc3 100644
--- a/pkgs/development/libraries/libspf2/default.nix
+++ b/pkgs/development/libraries/libspf2/default.nix
@@ -1,6 +1,6 @@
-{ stdenv, fetchurl, autoreconfHook }:
+{ lib, stdenv, fetchurl, autoreconfHook }:
 
-with stdenv.lib;
+with lib;
 
 stdenv.mkDerivation rec {
   pname = "libspf2";
diff --git a/pkgs/development/libraries/libspiro/default.nix b/pkgs/development/libraries/libspiro/default.nix
index d466b4e85a938..03bfe14d3beec 100644
--- a/pkgs/development/libraries/libspiro/default.nix
+++ b/pkgs/development/libraries/libspiro/default.nix
@@ -1,4 +1,4 @@
-{stdenv, pkg-config, autoreconfHook, fetchFromGitHub }:
+{lib, stdenv, pkg-config, autoreconfHook, fetchFromGitHub }:
 
 stdenv.mkDerivation rec {
   pname = "libspiro";
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ pkg-config autoreconfHook ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A library that simplifies the drawing of beautiful curves";
     homepage = "https://github.com/fontforge/libspiro";
     license = licenses.gpl3Plus;
diff --git a/pkgs/development/libraries/libspotify/default.nix b/pkgs/development/libraries/libspotify/default.nix
index feb1f8e1736da..b39944d13dca0 100644
--- a/pkgs/development/libraries/libspotify/default.nix
+++ b/pkgs/development/libraries/libspotify/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, libspotify, alsaLib, readline, pkg-config, apiKey ? null, unzip, gnused }:
+{ lib, stdenv, fetchurl, libspotify, alsaLib, readline, pkg-config, apiKey ? null, unzip, gnused }:
 
 let
   version = "12.1.51";
@@ -47,14 +47,14 @@ else stdenv.mkDerivation {
 
 
   # darwin-specific
-  buildInputs = stdenv.lib.optional (stdenv.hostPlatform.system == "x86_64-darwin") unzip;
+  buildInputs = lib.optional (stdenv.hostPlatform.system == "x86_64-darwin") unzip;
 
   # linux-specific
-  installFlags = stdenv.lib.optional isLinux
+  installFlags = lib.optional isLinux
     "prefix=$(out)";
-  patchPhase = stdenv.lib.optionalString isLinux
+  patchPhase = lib.optionalString isLinux
     "${gnused}/bin/sed -i 's/ldconfig//' Makefile";
-  postInstall = stdenv.lib.optionalString isLinux
+  postInstall = lib.optionalString isLinux
     "mv -v share $out";
 
   passthru = {
@@ -67,7 +67,7 @@ else stdenv.mkDerivation {
         src = libspotify.src;
   nativeBuildInputs = [ pkg-config ];
         buildInputs = [ libspotify readline ]
-          ++ stdenv.lib.optional (!stdenv.isDarwin) alsaLib;
+          ++ lib.optional (!stdenv.isDarwin) alsaLib;
         postUnpack = "sourceRoot=$sourceRoot/share/doc/libspotify/examples";
         patchPhase = "cp ${apiKey} appkey.c";
         installPhase = ''
@@ -82,7 +82,7 @@ else stdenv.mkDerivation {
     inherit apiKey;
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Spotify API library";
     homepage    = "https://developer.spotify.com/technologies/libspotify";
     maintainers = with maintainers; [ lovek323 ];
diff --git a/pkgs/development/libraries/libsrs2/default.nix b/pkgs/development/libraries/libsrs2/default.nix
index 0d186204f92f4..3da48f772545e 100644
--- a/pkgs/development/libraries/libsrs2/default.nix
+++ b/pkgs/development/libraries/libsrs2/default.nix
@@ -13,6 +13,6 @@ stdenv.mkDerivation rec {
     description = "The next generation SRS library from the original designer of SRS";
     license = with lib.licenses; [ gpl2 bsd3 ];
     homepage = "https://www.libsrs2.org/";
-    platforms = stdenv.lib.platforms.linux;
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/development/libraries/libssh/default.nix b/pkgs/development/libraries/libssh/default.nix
index 95d4dc02029ed..c613cfab777b1 100644
--- a/pkgs/development/libraries/libssh/default.nix
+++ b/pkgs/development/libraries/libssh/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, cmake, zlib, openssl, libsodium }:
+{ lib, stdenv, fetchurl, pkg-config, cmake, zlib, openssl, libsodium }:
 
 stdenv.mkDerivation rec {
   pname = "libssh";
@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ cmake pkg-config ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "SSH client library";
     homepage = "https://libssh.org";
     license = licenses.lgpl2Plus;
diff --git a/pkgs/development/libraries/libssh2/default.nix b/pkgs/development/libraries/libssh2/default.nix
index 8ce9c814df051..ed09e8ba5624b 100644
--- a/pkgs/development/libraries/libssh2/default.nix
+++ b/pkgs/development/libraries/libssh2/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, openssl, zlib, windows }:
+{ lib, stdenv, fetchurl, openssl, zlib, windows }:
 
 stdenv.mkDerivation rec {
   pname = "libssh2";
@@ -12,14 +12,14 @@ stdenv.mkDerivation rec {
   outputs = [ "out" "dev" "devdoc" ];
 
   buildInputs = [ openssl zlib ]
-    ++ stdenv.lib.optional stdenv.hostPlatform.isMinGW windows.mingw_w64;
+    ++ lib.optional stdenv.hostPlatform.isMinGW windows.mingw_w64;
 
   patches = [
     # Not able to use fetchpatch here: infinite recursion
     ./CVE-2019-17498.patch
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A client-side C library implementing the SSH2 protocol";
     homepage = "https://www.libssh2.org";
     platforms = platforms.all;
diff --git a/pkgs/development/libraries/libstatgrab/default.nix b/pkgs/development/libraries/libstatgrab/default.nix
index 70a632dd4a79e..6d874fe236782 100644
--- a/pkgs/development/libraries/libstatgrab/default.nix
+++ b/pkgs/development/libraries/libstatgrab/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl
+{ lib, stdenv, fetchurl
 , IOKit ? null }:
 
 stdenv.mkDerivation rec {
@@ -9,9 +9,9 @@ stdenv.mkDerivation rec {
     sha256 = "15m1sl990l85ijf8pnc6hdfha6fqyiq74mijrzm3xz4zzxm91wav";
   };
 
-  buildInputs = [] ++ stdenv.lib.optional stdenv.isDarwin IOKit;
+  buildInputs = [] ++ lib.optional stdenv.isDarwin IOKit;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://www.i-scream.org/libstatgrab/";
     description = "A library that provides cross platforms access to statistics about the running system";
     license = licenses.gpl2;
diff --git a/pkgs/development/libraries/libstroke/default.nix b/pkgs/development/libraries/libstroke/default.nix
index e97b96d71d099..76f5b6b4b8c62 100644
--- a/pkgs/development/libraries/libstroke/default.nix
+++ b/pkgs/development/libraries/libstroke/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, automake, autoconf, xlibsWrapper}:
+{lib, stdenv, fetchurl, automake, autoconf, xlibsWrapper}:
 
 stdenv.mkDerivation {
   name = "libstroke-0.5.1";
@@ -21,7 +21,7 @@ stdenv.mkDerivation {
   meta = {
     description = "A library for simple gesture recognition";
     homepage = "https://web.archive.org/web/20161204100704/http://etla.net/libstroke/";
-    license = stdenv.lib.licenses.gpl2;
+    license = lib.licenses.gpl2;
 
     longDescription =
       '' libstroke, last updated in 2001, still successfully provides a basic
@@ -29,6 +29,6 @@ stdenv.mkDerivation {
         easy to work with, and notably used by FVWM.
       '';
 
-    platforms = stdenv.lib.platforms.linux;
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/development/libraries/libstrophe/default.nix b/pkgs/development/libraries/libstrophe/default.nix
index 72cc24fcfdb7e..ccc6fedd91692 100644
--- a/pkgs/development/libraries/libstrophe/default.nix
+++ b/pkgs/development/libraries/libstrophe/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , autoreconfHook
 , libtool
@@ -26,7 +26,7 @@ stdenv.mkDerivation rec {
 
   doCheck = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A simple, lightweight C library for writing XMPP clients";
     longDescription = ''
       libstrophe is a lightweight XMPP client library written in C. It has
diff --git a/pkgs/development/libraries/libsurvive/default.nix b/pkgs/development/libraries/libsurvive/default.nix
index 11a5cdcf4e93b..08be9c1a35d22 100644
--- a/pkgs/development/libraries/libsurvive/default.nix
+++ b/pkgs/development/libraries/libsurvive/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , cmake
 , pkg-config
@@ -30,7 +30,7 @@ stdenv.mkDerivation rec {
     zlib
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Open Source Lighthouse Tracking System";
     homepage = "https://github.com/cntools/libsurvive";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/libsvm/default.nix b/pkgs/development/libraries/libsvm/default.nix
index 5dc4deb30be98..6f4741ed4d054 100644
--- a/pkgs/development/libraries/libsvm/default.nix
+++ b/pkgs/development/libraries/libsvm/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl}:
+{lib, stdenv, fetchurl}:
 
 stdenv.mkDerivation rec {
   pname = "libsvm";
@@ -25,11 +25,11 @@ stdenv.mkDerivation rec {
     ln -s $out/include/svm.h $out/include/libsvm/svm.h
   '';
 
-  postFixup = stdenv.lib.optionalString stdenv.isDarwin ''
+  postFixup = lib.optionalString stdenv.isDarwin ''
     install_name_tool -id libsvm.2.dylib $out/lib/libsvm.2.dylib;
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A library for support vector machines";
     homepage = "https://www.csie.ntu.edu.tw/~cjlin/libsvm/";
     license = licenses.bsd3;
diff --git a/pkgs/development/libraries/libsystemtap/default.nix b/pkgs/development/libraries/libsystemtap/default.nix
index b46a848a0416f..1ce7ef58c886c 100644
--- a/pkgs/development/libraries/libsystemtap/default.nix
+++ b/pkgs/development/libraries/libsystemtap/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchgit, gettext, python, elfutils}:
+{lib, stdenv, fetchgit, gettext, python, elfutils}:
 
 stdenv.mkDerivation {
   pname = "libsystemtap";
@@ -20,11 +20,11 @@ stdenv.mkDerivation {
     cp -r includes/* $out/include/
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Statically defined probes development files";
     homepage = "https://sourceware.org/systemtap/";
     license = licenses.bsd3;
     platforms = platforms.unix;
-    maintainers = [ stdenv.lib.maintainers.farlion ];
+    maintainers = [ lib.maintainers.farlion ];
   };
 }
diff --git a/pkgs/development/libraries/libtap/default.nix b/pkgs/development/libraries/libtap/default.nix
index d6eb2647fbdd6..ce7cb6bfd1ee1 100644
--- a/pkgs/development/libraries/libtap/default.nix
+++ b/pkgs/development/libraries/libtap/default.nix
@@ -1,6 +1,6 @@
-{ stdenv, fetchurl, pkg-config, cmake, perl }:
+{ lib, stdenv, fetchurl, pkg-config, cmake, perl }:
 
-with stdenv.lib;
+with lib;
 stdenv.mkDerivation rec {
 
   pname = "libtap";
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ pkg-config ];
   propagatedBuildInputs = [ cmake perl ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A library to implement a test protocol";
     longDescription = ''
       libtap is a library to implement the Test Anything Protocol for
diff --git a/pkgs/development/libraries/libtar/default.nix b/pkgs/development/libraries/libtar/default.nix
index a31fde0d31d28..3e5b4cd23e9d9 100644
--- a/pkgs/development/libraries/libtar/default.nix
+++ b/pkgs/development/libraries/libtar/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchgit, fetchpatch, autoreconfHook }:
+{ lib, stdenv, fetchgit, fetchpatch, autoreconfHook }:
 
 stdenv.mkDerivation rec {
   version = "1.2.20";
@@ -27,7 +27,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ autoreconfHook ];
   buildInputs = [ ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "C library for manipulating POSIX tar files";
     homepage = "https://repo.or.cz/libtar";
     license = licenses.bsd3;
diff --git a/pkgs/development/libraries/libtasn1/default.nix b/pkgs/development/libraries/libtasn1/default.nix
index 90dde37a4161a..2239d7311f5ae 100644
--- a/pkgs/development/libraries/libtasn1/default.nix
+++ b/pkgs/development/libraries/libtasn1/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, perl, texinfo }:
+{ lib, stdenv, fetchurl, perl, texinfo }:
 
 stdenv.mkDerivation rec {
   name = "libtasn1-4.16.0";
@@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
   else
     null;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://www.gnu.org/software/libtasn1/";
     description = "An ASN.1 library";
     longDescription = ''
diff --git a/pkgs/development/libraries/libtcod/default.nix b/pkgs/development/libraries/libtcod/default.nix
index 420a4c6ad2068..3e77d0876be89 100644
--- a/pkgs/development/libraries/libtcod/default.nix
+++ b/pkgs/development/libraries/libtcod/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromBitbucket, cmake, SDL, libGLU, libGL, upx, zlib }:
+{ lib, stdenv, fetchFromBitbucket, cmake, SDL, libGLU, libGL, upx, zlib }:
 
 stdenv.mkDerivation {
 
@@ -27,8 +27,8 @@ stdenv.mkDerivation {
   meta = {
     description = "API for roguelike games";
     homepage = "http://roguecentral.org/doryen/libtcod/";
-    license = stdenv.lib.licenses.bsd3;
-    platforms = stdenv.lib.platforms.linux;
-    maintainers = [ stdenv.lib.maintainers.skeidel ];
+    license = lib.licenses.bsd3;
+    platforms = lib.platforms.linux;
+    maintainers = [ lib.maintainers.skeidel ];
   };
 }
diff --git a/pkgs/development/libraries/libtelnet/default.nix b/pkgs/development/libraries/libtelnet/default.nix
index 7ce5b2f3214d5..eebaee394ee0f 100644
--- a/pkgs/development/libraries/libtelnet/default.nix
+++ b/pkgs/development/libraries/libtelnet/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, pkg-config, autoreconfHook, zlib }:
+{ lib, stdenv, fetchFromGitHub, pkg-config, autoreconfHook, zlib }:
 
 stdenv.mkDerivation {
   pname = "libtelnet";
@@ -17,8 +17,8 @@ stdenv.mkDerivation {
   meta = {
     description = "Simple RFC-complient TELNET implementation as a C library";
     homepage = "https://github.com/seanmiddleditch/libtelnet";
-    license = stdenv.lib.licenses.publicDomain;
-    maintainers = [ stdenv.lib.maintainers.tomberek ];
-    platforms = stdenv.lib.platforms.linux;
+    license = lib.licenses.publicDomain;
+    maintainers = [ lib.maintainers.tomberek ];
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/development/libraries/libtermkey/default.nix b/pkgs/development/libraries/libtermkey/default.nix
index 4be42ff745e7b..9779ad6b9e5fe 100644
--- a/pkgs/development/libraries/libtermkey/default.nix
+++ b/pkgs/development/libraries/libtermkey/default.nix
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
   };
 
   makeFlags = [ "PREFIX=$(out)" ]
-    ++ stdenv.lib.optional stdenv.isDarwin "LIBTOOL=${libtool}/bin/libtool";
+    ++ lib.optional stdenv.isDarwin "LIBTOOL=${libtool}/bin/libtool";
 
   nativeBuildInputs = [ libtool pkg-config ];
   buildInputs = [ ncurses unibilium ];
diff --git a/pkgs/development/libraries/libthai/default.nix b/pkgs/development/libraries/libthai/default.nix
index 6179ad0f6bdaa..ad00906bb8cc3 100644
--- a/pkgs/development/libraries/libthai/default.nix
+++ b/pkgs/development/libraries/libthai/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, makeWrapper, installShellFiles, pkg-config, libdatrie }:
+{ lib, stdenv, fetchurl, makeWrapper, installShellFiles, pkg-config, libdatrie }:
 
 stdenv.mkDerivation rec {
   pname = "libthai";
@@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
     installManPage man/man3/*.3
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://linux.thai.net/projects/libthai/";
     description = "Set of Thai language support routines";
     license = licenses.lgpl21Plus;
diff --git a/pkgs/development/libraries/libtheora/default.nix b/pkgs/development/libraries/libtheora/default.nix
index 94af9d76e78ac..1638150c26329 100644
--- a/pkgs/development/libraries/libtheora/default.nix
+++ b/pkgs/development/libraries/libtheora/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, libogg, libvorbis, pkg-config}:
+{lib, stdenv, fetchurl, libogg, libvorbis, pkg-config}:
 
 stdenv.mkDerivation rec {
   name = "libtheora-1.1.1";
@@ -16,11 +16,11 @@ stdenv.mkDerivation rec {
 
   # GCC's -fforce-addr flag is not supported by clang
   # It's just an optimization, so it's safe to simply remove it
-  postPatch = stdenv.lib.optionalString stdenv.isDarwin ''
+  postPatch = lib.optionalString stdenv.isDarwin ''
     substituteInPlace configure --replace "-fforce-addr" ""
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://www.theora.org/";
     description = "Library for Theora, a free and open video compression format";
     license = licenses.bsd3;
diff --git a/pkgs/development/libraries/libthreadar/default.nix b/pkgs/development/libraries/libthreadar/default.nix
index 587ef2e208a3d..c67be246928c6 100644
--- a/pkgs/development/libraries/libthreadar/default.nix
+++ b/pkgs/development/libraries/libthreadar/default.nix
@@ -1,6 +1,6 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
-with stdenv.lib;
+with lib;
 
 stdenv.mkDerivation rec {
   version = "1.3.1";
diff --git a/pkgs/development/libraries/libtiff/default.nix b/pkgs/development/libraries/libtiff/default.nix
index 9bb572a912c69..3d3b3529483a1 100644
--- a/pkgs/development/libraries/libtiff/default.nix
+++ b/pkgs/development/libraries/libtiff/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 
 , pkg-config
@@ -27,7 +27,7 @@ stdenv.mkDerivation rec {
 
   doCheck = true; # not cross;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Library and utilities for working with the TIFF image file format";
     homepage = "http://download.osgeo.org/libtiff";
     license = licenses.libtiff;
diff --git a/pkgs/development/libraries/libtins/default.nix b/pkgs/development/libraries/libtins/default.nix
index d70921e3354dd..7279dc9ddfa2f 100644
--- a/pkgs/development/libraries/libtins/default.nix
+++ b/pkgs/development/libraries/libtins/default.nix
@@ -1,4 +1,4 @@
-{ boost, cmake, fetchFromGitHub, gtest, libpcap, openssl, stdenv }:
+{ boost, cmake, fetchFromGitHub, gtest, libpcap, openssl, lib, stdenv }:
 
 stdenv.mkDerivation rec {
   pname = "libtins";
@@ -36,12 +36,12 @@ stdenv.mkDerivation rec {
   '';
   checkTarget = "tests test";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "High-level, multiplatform C++ network packet sniffing and crafting library";
     homepage = "https://libtins.github.io/";
     changelog = "https://raw.githubusercontent.com/mfontanini/${pname}/v${version}/CHANGES.md";
-    license = stdenv.lib.licenses.bsd2;
+    license = lib.licenses.bsd2;
     maintainers = with maintainers; [ fdns ];
-    platforms = stdenv.lib.platforms.unix;
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/libtomcrypt/default.nix b/pkgs/development/libraries/libtomcrypt/default.nix
index 4587701011dd7..7ed8fca3babd7 100644
--- a/pkgs/development/libraries/libtomcrypt/default.nix
+++ b/pkgs/development/libraries/libtomcrypt/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, fetchpatch, libtool }:
+{ lib, stdenv, fetchurl, fetchpatch, libtool }:
 
 stdenv.mkDerivation rec {
   pname = "libtomcrypt";
@@ -33,7 +33,7 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://www.libtom.net/LibTomCrypt/";
     description = "A fairly comprehensive, modular and portable cryptographic toolkit";
     license = with licenses; [ publicDomain wtfpl ];
diff --git a/pkgs/development/libraries/libtommath/default.nix b/pkgs/development/libraries/libtommath/default.nix
index 9a0a2def4b715..058ae52423153 100644
--- a/pkgs/development/libraries/libtommath/default.nix
+++ b/pkgs/development/libraries/libtommath/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, libtool }:
+{ lib, stdenv, fetchurl, libtool }:
 
 stdenv.mkDerivation rec {
   pname = "libtommath";
@@ -26,7 +26,7 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://www.libtom.net/LibTomMath/";
     description = "A library for integer-based number-theoretic applications";
     license = with licenses; [ publicDomain wtfpl ];
diff --git a/pkgs/development/libraries/libtorrent-rasterbar/1.1.nix b/pkgs/development/libraries/libtorrent-rasterbar/1.1.nix
index 649d73b49b87d..a898dd8e24e66 100644
--- a/pkgs/development/libraries/libtorrent-rasterbar/1.1.nix
+++ b/pkgs/development/libraries/libtorrent-rasterbar/1.1.nix
@@ -40,7 +40,7 @@ in stdenv.mkDerivation {
     "--with-boost-libdir=${boostPython.out}/lib"
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://libtorrent.org/";
     description = "A C++ BitTorrent implementation focusing on efficiency and scalability";
     license = licenses.bsd3;
diff --git a/pkgs/development/libraries/libtorrent-rasterbar/1.2.nix b/pkgs/development/libraries/libtorrent-rasterbar/1.2.nix
index 9a165780b7e25..fc97b629a52fd 100644
--- a/pkgs/development/libraries/libtorrent-rasterbar/1.2.nix
+++ b/pkgs/development/libraries/libtorrent-rasterbar/1.2.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, pkg-config, automake, autoconf
+{ lib, stdenv, fetchFromGitHub, pkg-config, automake, autoconf
 , zlib, boost, openssl, libtool, python, libiconv, ncurses, SystemConfiguration
 }:
 
@@ -25,7 +25,7 @@ in stdenv.mkDerivation {
   nativeBuildInputs = [ automake autoconf libtool pkg-config ];
 
   buildInputs = [ boostPython openssl zlib python libiconv ncurses ]
-    ++ stdenv.lib.optionals stdenv.isDarwin [ SystemConfiguration ];
+    ++ lib.optionals stdenv.isDarwin [ SystemConfiguration ];
 
   preConfigure = "./autotool.sh";
 
@@ -43,7 +43,7 @@ in stdenv.mkDerivation {
     "--with-boost-libdir=${boostPython.out}/lib"
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://libtorrent.org/";
     description = "A C++ BitTorrent implementation focusing on efficiency and scalability";
     license = licenses.bsd3;
diff --git a/pkgs/development/libraries/libtorrent-rasterbar/default.nix b/pkgs/development/libraries/libtorrent-rasterbar/default.nix
index e9c59ed97e828..ad3a47f99ce33 100644
--- a/pkgs/development/libraries/libtorrent-rasterbar/default.nix
+++ b/pkgs/development/libraries/libtorrent-rasterbar/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake
+{ lib, stdenv, fetchFromGitHub, cmake
 , zlib, boost, openssl, python, ncurses, SystemConfiguration
 }:
 
@@ -23,7 +23,7 @@ in stdenv.mkDerivation {
   nativeBuildInputs = [ cmake ];
 
   buildInputs = [ boostPython openssl zlib python ncurses ]
-    ++ stdenv.lib.optionals stdenv.isDarwin [ SystemConfiguration ];
+    ++ lib.optionals stdenv.isDarwin [ SystemConfiguration ];
 
   postInstall = ''
     moveToOutput "include" "$dev"
@@ -36,7 +36,7 @@ in stdenv.mkDerivation {
     "-Dpython-bindings=on"
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://libtorrent.org/";
     description = "A C++ BitTorrent implementation focusing on efficiency and scalability";
     license = licenses.bsd3;
diff --git a/pkgs/development/libraries/libtoxcore/default.nix b/pkgs/development/libraries/libtoxcore/default.nix
index 727516cad9315..4badf32fe8cc9 100644
--- a/pkgs/development/libraries/libtoxcore/default.nix
+++ b/pkgs/development/libraries/libtoxcore/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, libsodium, ncurses, libopus, msgpack
+{ lib, stdenv, fetchFromGitHub, cmake, libsodium, ncurses, libopus, msgpack
 , libvpx, check, libconfig, pkg-config }:
 
 let
@@ -22,7 +22,7 @@ let
 
     buildInputs = [
       libsodium msgpack ncurses libconfig
-    ] ++ stdenv.lib.optionals (!stdenv.isAarch32) [
+    ] ++ lib.optionals (!stdenv.isAarch32) [
       libopus libvpx
     ];
 
@@ -37,7 +37,7 @@ let
         -e "s|^includedir=.*|includedir=$out/include|"
     '';
 
-    meta = with stdenv.lib; {
+    meta = with lib; {
       description = "P2P FOSS instant messaging application aimed to replace Skype";
       homepage = "https://tox.chat";
       license = licenses.gpl3Plus;
diff --git a/pkgs/development/libraries/libtoxcore/new-api.nix b/pkgs/development/libraries/libtoxcore/new-api.nix
index d28fcf4a60d13..77119e2830fed 100644
--- a/pkgs/development/libraries/libtoxcore/new-api.nix
+++ b/pkgs/development/libraries/libtoxcore/new-api.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, autoreconfHook, libsodium, ncurses, libopus
+{ lib, stdenv, fetchFromGitHub, autoreconfHook, libsodium, ncurses, libopus
 , libvpx, check, libconfig, pkg-config }:
 
 stdenv.mkDerivation {
@@ -33,11 +33,11 @@ stdenv.mkDerivation {
   nativeBuildInputs = [ autoreconfHook pkg-config ];
   buildInputs = [
     autoreconfHook libsodium ncurses check libconfig
-  ] ++ stdenv.lib.optionals (!stdenv.isAarch32) [
+  ] ++ lib.optionals (!stdenv.isAarch32) [
     libopus
   ];
 
-  propagatedBuildInputs = stdenv.lib.optionals (!stdenv.isAarch32) [ libvpx ];
+  propagatedBuildInputs = lib.optionals (!stdenv.isAarch32) [ libvpx ];
 
   # Some tests fail randomly due to timeout. This kind of problem is well known
   # by upstream: https://github.com/irungentoo/toxcore/issues/{950,1054}
@@ -47,7 +47,7 @@ stdenv.mkDerivation {
   # NOTE: run the tests locally on your machine before upgrading this package!
   doCheck = false;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "P2P FOSS instant messaging application aimed to replace Skype with crypto";
     license = licenses.gpl3Plus;
     maintainers = with maintainers; [ ];
diff --git a/pkgs/development/libraries/libtsm/default.nix b/pkgs/development/libraries/libtsm/default.nix
index 73114d5bc96e3..d959306c97180 100644
--- a/pkgs/development/libraries/libtsm/default.nix
+++ b/pkgs/development/libraries/libtsm/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, libxkbcommon, pkg-config, cmake }:
+{ lib, stdenv, fetchFromGitHub, libxkbcommon, pkg-config, cmake }:
 
 stdenv.mkDerivation rec {
   pname = "libtsm";
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ cmake pkg-config ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Terminal-emulator State Machine";
     homepage = "http://www.freedesktop.org/wiki/Software/kmscon/libtsm/";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/libu2f-host/default.nix b/pkgs/development/libraries/libu2f-host/default.nix
index fd8eada261cb0..3be758c906f1a 100644
--- a/pkgs/development/libraries/libu2f-host/default.nix
+++ b/pkgs/development/libraries/libu2f-host/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, fetchpatch, pkg-config, json_c, hidapi }:
+{ lib, stdenv, fetchurl, fetchpatch, pkg-config, json_c, hidapi }:
 
 stdenv.mkDerivation rec {
   pname = "libu2f-host";
@@ -23,7 +23,7 @@ stdenv.mkDerivation rec {
 
   doCheck = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://developers.yubico.com/libu2f-host";
     description = "A C library and command-line tool that implements the host-side of the U2F protocol";
     license = with licenses; [ gpl3Plus lgpl21Plus ];
diff --git a/pkgs/development/libraries/libu2f-server/default.nix b/pkgs/development/libraries/libu2f-server/default.nix
index b1187177f30dc..7f596978cf06c 100644
--- a/pkgs/development/libraries/libu2f-server/default.nix
+++ b/pkgs/development/libraries/libu2f-server/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, fetchpatch, pkg-config, json_c, openssl, check, file, help2man, which, gengetopt }:
+{ lib, stdenv, fetchurl, fetchpatch, pkg-config, json_c, openssl, check, file, help2man, which, gengetopt }:
 
 stdenv.mkDerivation rec {
   name = "libu2f-server-1.1.0";
@@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ pkg-config ];
   buildInputs = [ json_c openssl check file help2man which gengetopt ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://developers.yubico.com/libu2f-server/";
     description = "A C library that implements the server-side of the U2F protocol";
     license = licenses.bsd2;
diff --git a/pkgs/development/libraries/libuchardet/default.nix b/pkgs/development/libraries/libuchardet/default.nix
index 43fa300f1076b..443791f245191 100644
--- a/pkgs/development/libraries/libuchardet/default.nix
+++ b/pkgs/development/libraries/libuchardet/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, cmake }:
+{ lib, stdenv, fetchurl, cmake }:
 
 stdenv.mkDerivation rec {
   pname = "uchardet";
@@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
 
   doCheck = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Mozilla's Universal Charset Detector C/C++ API";
     homepage = "https://www.freedesktop.org/wiki/Software/uchardet/";
     license = licenses.mpl11;
diff --git a/pkgs/development/libraries/libucl/default.nix b/pkgs/development/libraries/libucl/default.nix
index b9b33453a4c60..e65d0d475ff90 100644
--- a/pkgs/development/libraries/libucl/default.nix
+++ b/pkgs/development/libraries/libucl/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , pkg-config
 , autoreconfHook
@@ -36,7 +36,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ pkg-config autoreconfHook ];
 
-  buildInputs = with stdenv.lib;
+  buildInputs = with lib;
     concatLists (
       mapAttrsToList (feat: enabled:
         optionals enabled (featureDeps."${feat}" or [])
@@ -45,10 +45,10 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  configureFlags = with stdenv.lib;
+  configureFlags = with lib;
     mapAttrsToList (feat: enabled: strings.enableFeature enabled feat) features;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Universal configuration library parser";
     homepage = "https://github.com/vstakhov/libucl";
     license = licenses.bsd2;
diff --git a/pkgs/development/libraries/libuecc/default.nix b/pkgs/development/libraries/libuecc/default.nix
index e5d21e2d8f7ee..1cc3ac8ebea1a 100644
--- a/pkgs/development/libraries/libuecc/default.nix
+++ b/pkgs/development/libraries/libuecc/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchgit, cmake }:
+{ lib, stdenv, fetchgit, cmake }:
 
 stdenv.mkDerivation rec {
   version = "7";
@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ cmake ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Very small Elliptic Curve Cryptography library";
     homepage = "https://git.universe-factory.net/libuecc";
     license = licenses.bsd2;
diff --git a/pkgs/development/libraries/libui/default.nix b/pkgs/development/libraries/libui/default.nix
index 74bc597c56908..7002f75cc45e3 100644
--- a/pkgs/development/libraries/libui/default.nix
+++ b/pkgs/development/libraries/libui/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, pkg-config, gtk3, Cocoa }:
+{ lib, stdenv, fetchFromGitHub, cmake, pkg-config, gtk3, Cocoa }:
 
 let
   shortName = "libui";
@@ -16,20 +16,20 @@ stdenv.mkDerivation {
   };
 
   nativeBuildInputs = [ cmake pkg-config ];
-  propagatedBuildInputs = stdenv.lib.optional stdenv.isLinux gtk3
-    ++ stdenv.lib.optionals stdenv.isDarwin [ Cocoa ];
+  propagatedBuildInputs = lib.optional stdenv.isLinux gtk3
+    ++ lib.optionals stdenv.isDarwin [ Cocoa ];
 
-  preConfigure = stdenv.lib.optionalString stdenv.isDarwin ''
+  preConfigure = lib.optionalString stdenv.isDarwin ''
     sed -i 's/set(CMAKE_OSX_DEPLOYMENT_TARGET "10.8")//' ./CMakeLists.txt
   '';
 
   installPhase = ''
     mkdir -p $out/{include,lib}
     mkdir -p $out/lib/pkgconfig
-  '' + stdenv.lib.optionalString stdenv.isLinux ''
+  '' + lib.optionalString stdenv.isLinux ''
     mv ./out/${shortName}.so.0 $out/lib/
     ln -s $out/lib/${shortName}.so.0 $out/lib/${shortName}.so
-  '' + stdenv.lib.optionalString stdenv.isDarwin ''
+  '' + lib.optionalString stdenv.isDarwin ''
     mv ./out/${shortName}.A.dylib $out/lib/
     ln -s $out/lib/${shortName}.A.dylib $out/lib/${shortName}.dylib
   '' + ''
@@ -41,11 +41,11 @@ stdenv.mkDerivation {
       --subst-var-by out $out \
       --subst-var-by version "${version}"
   '';
-  postInstall = stdenv.lib.optionalString stdenv.isDarwin ''
+  postInstall = lib.optionalString stdenv.isDarwin ''
     install_name_tool -id $out/lib/${shortName}.A.dylib $out/lib/${shortName}.A.dylib
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage    = "https://github.com/andlabs/libui";
     description = "Simple and portable (but not inflexible) GUI library in C that uses the native GUI technologies of each platform it supports";
     license     = licenses.mit;
diff --git a/pkgs/development/libraries/libuinputplus/default.nix b/pkgs/development/libraries/libuinputplus/default.nix
index 9f6f18555f7f1..9085b8610789b 100644
--- a/pkgs/development/libraries/libuinputplus/default.nix
+++ b/pkgs/development/libraries/libuinputplus/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, pkg-config }:
+{ lib, stdenv, fetchFromGitHub, cmake, pkg-config }:
 
 stdenv.mkDerivation rec {
   pname = "libuinputplus";
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ cmake pkg-config ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     inherit (src.meta) homepage;
     description = "Easy-to-use uinput library in C++";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/libunarr/default.nix b/pkgs/development/libraries/libunarr/default.nix
index 6515a51f137dc..523ce82ce22de 100644
--- a/pkgs/development/libraries/libunarr/default.nix
+++ b/pkgs/development/libraries/libunarr/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, cmake }:
+{ lib, stdenv, fetchurl, cmake }:
 
 stdenv.mkDerivation rec {
   pname = "libunarr";
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ cmake ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/selmf/unarr";
     description = "A lightweight decompression library with support for rar, tar and zip archives";
     license = licenses.lgpl3;
diff --git a/pkgs/development/libraries/libunibreak/default.nix b/pkgs/development/libraries/libunibreak/default.nix
index d30c84b52a2e0..9e6cec471d4dd 100644
--- a/pkgs/development/libraries/libunibreak/default.nix
+++ b/pkgs/development/libraries/libunibreak/default.nix
@@ -1,11 +1,11 @@
-{ stdenv, fetchFromGitHub, autoreconfHook }:
+{ lib, stdenv, fetchFromGitHub, autoreconfHook }:
 
 stdenv.mkDerivation rec {
   pname = "libunibreak";
   version = "4.3";
 
   src = let
-      rev_version = stdenv.lib.replaceStrings ["."] ["_"] version;
+      rev_version = lib.replaceStrings ["."] ["_"] version;
   in fetchFromGitHub {
     owner = "adah1972";
     repo = pname;
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ autoreconfHook ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/adah1972/libunibreak";
     description = "Implementation of line breaking and word breaking algorithms as in the Unicode standard";
     license = licenses.zlib;
diff --git a/pkgs/development/libraries/libuninameslist/default.nix b/pkgs/development/libraries/libuninameslist/default.nix
index afae04cb6b23a..2e75c783681ea 100644
--- a/pkgs/development/libraries/libuninameslist/default.nix
+++ b/pkgs/development/libraries/libuninameslist/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , autoreconfHook
 }:
@@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
     autoreconfHook
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/fontforge/libuninameslist/";
     description = "A Library of Unicode names and annotation data";
     license = licenses.bsd3;
diff --git a/pkgs/development/libraries/libunique/3.x.nix b/pkgs/development/libraries/libunique/3.x.nix
index 14c84199c5074..72027b85ed438 100644
--- a/pkgs/development/libraries/libunique/3.x.nix
+++ b/pkgs/development/libraries/libunique/3.x.nix
@@ -1,9 +1,9 @@
-{ stdenv, fetchurl, pkg-config
+{ lib, stdenv, fetchurl, pkg-config
 , dbus, dbus-glib, gtk3, gobject-introspection
 , gtk-doc, docbook_xml_dtd_45, docbook_xsl
 , libxslt, libxml2 }:
 
-with stdenv.lib;
+with lib;
 stdenv.mkDerivation rec {
 
   majorVer = "3.0";
@@ -25,6 +25,6 @@ stdenv.mkDerivation rec {
     description = "A library for writing single instance applications";
     license = licenses.lgpl21;
     maintainers = [ maintainers.AndersonTorres ];
-    platforms = stdenv.lib.platforms.linux;
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/development/libraries/libunique/default.nix b/pkgs/development/libraries/libunique/default.nix
index 45f5e6f786d68..27db05ee98abc 100644
--- a/pkgs/development/libraries/libunique/default.nix
+++ b/pkgs/development/libraries/libunique/default.nix
@@ -1,11 +1,11 @@
-{ stdenv, fetchurl, pkg-config, glib, gtk2, dbus-glib }:
+{ lib, stdenv, fetchurl, pkg-config, glib, gtk2, dbus-glib }:
 
 stdenv.mkDerivation rec {
   pname = "libunique";
   version = "1.1.6";
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.bz2";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.bz2";
     sha256 = "1fsgvmncd9caw552lyfg8swmsd6bh4ijjsph69bwacwfxwf09j75";
   };
 
@@ -31,7 +31,7 @@ stdenv.mkDerivation rec {
   meta = {
     homepage = "https://wiki.gnome.org/Attic/LibUnique";
     description = "A library for writing single instance applications";
-    license = stdenv.lib.licenses.lgpl21;
-    platforms = with stdenv.lib.platforms; linux ++ darwin;
+    license = lib.licenses.lgpl21;
+    platforms = with lib.platforms; linux ++ darwin;
   };
 }
diff --git a/pkgs/development/libraries/libunistring/default.nix b/pkgs/development/libraries/libunistring/default.nix
index 5f300ef51997d..f7a77832c1831 100644
--- a/pkgs/development/libraries/libunistring/default.nix
+++ b/pkgs/development/libraries/libunistring/default.nix
@@ -1,4 +1,4 @@
-{ fetchurl, stdenv, libiconv }:
+{ fetchurl, lib, stdenv, libiconv }:
 
 # Note: this package is used for bootstrapping fetchurl, and thus
 # cannot use fetchpatch! All mutable patches (generated by GitHub or
@@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
 
   outputs = [ "out" "dev" "info" "doc" ];
 
-  propagatedBuildInputs = stdenv.lib.optional (!stdenv.isLinux) libiconv;
+  propagatedBuildInputs = lib.optional (!stdenv.isLinux) libiconv;
 
   configureFlags = [
     "--with-libiconv-prefix=${libiconv}"
@@ -64,9 +64,9 @@ stdenv.mkDerivation rec {
       strings as internal in-memory representation.
     '';
 
-    license = stdenv.lib.licenses.lgpl3Plus;
+    license = lib.licenses.lgpl3Plus;
 
     maintainers = [ ];
-    platforms = stdenv.lib.platforms.all;
+    platforms = lib.platforms.all;
   };
 }
diff --git a/pkgs/development/libraries/libunity/default.nix b/pkgs/development/libraries/libunity/default.nix
index 287c185385fa8..f6fb9a13e4cd0 100644
--- a/pkgs/development/libraries/libunity/default.nix
+++ b/pkgs/development/libraries/libunity/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchgit
 , pkg-config
 , glib
@@ -56,7 +56,7 @@ stdenv.mkDerivation {
     "--with-pygi-overrides-dir=${placeholder "py"}/${python3.sitePackages}/gi/overrides"
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A library for instrumenting and integrating with all aspects of the Unity shell";
     homepage = "https://launchpad.net/libunity";
     license = licenses.lgpl3;
diff --git a/pkgs/development/libraries/libunwind/default.nix b/pkgs/development/libraries/libunwind/default.nix
index 7e481034f433f..b2b5db2309c18 100644
--- a/pkgs/development/libraries/libunwind/default.nix
+++ b/pkgs/development/libraries/libunwind/default.nix
@@ -33,7 +33,7 @@ stdenv.mkDerivation rec {
 
   doCheck = false; # fails
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://www.nongnu.org/libunwind";
     description = "A portable and efficient API to determine the call-chain of a program";
     maintainers = with maintainers; [ orivej ];
diff --git a/pkgs/development/libraries/liburcu/default.nix b/pkgs/development/libraries/liburcu/default.nix
index 6046bcf8eab32..d108bf4e6df45 100644
--- a/pkgs/development/libraries/liburcu/default.nix
+++ b/pkgs/development/libraries/liburcu/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, perl }:
+{ lib, stdenv, fetchurl, perl }:
 
 stdenv.mkDerivation rec {
   version = "0.12.1";
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
   preCheck = "patchShebangs tests/unit";
   doCheck = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Userspace RCU (read-copy-update) library";
     homepage = "https://lttng.org/urcu";
     license = licenses.lgpl21Plus;
diff --git a/pkgs/development/libraries/liburing/default.nix b/pkgs/development/libraries/liburing/default.nix
index 938846ace54f6..6a94f37181d46 100644
--- a/pkgs/development/libraries/liburing/default.nix
+++ b/pkgs/development/libraries/liburing/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchgit
+{ lib, stdenv, fetchgit
 , fetchpatch
 }:
 
@@ -44,7 +44,7 @@ stdenv.mkDerivation rec {
   ''
   ;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Userspace library for the Linux io_uring API";
     homepage    = "https://git.kernel.dk/cgit/liburing/";
     license     = licenses.lgpl21;
diff --git a/pkgs/development/libraries/libusb-compat/0.1.nix b/pkgs/development/libraries/libusb-compat/0.1.nix
index 41fe7cc6f1ec3..b23123f56eaa3 100644
--- a/pkgs/development/libraries/libusb-compat/0.1.nix
+++ b/pkgs/development/libraries/libusb-compat/0.1.nix
@@ -25,7 +25,7 @@ stdenv.mkDerivation rec {
     sha256 = "1nybccgjs14b3phhaycq2jx1gym4nf6sghvnv9qdfmlqxacx0jz5";
   };
 
-  patches = stdenv.lib.optional stdenv.hostPlatform.isMusl ./fix-headers.patch;
+  patches = lib.optional stdenv.hostPlatform.isMusl ./fix-headers.patch;
 
   # without this, libusb-compat is unable to find libusb1
   postFixup = ''
@@ -33,7 +33,7 @@ stdenv.mkDerivation rec {
       patchelf --set-rpath ${lib.makeLibraryPath buildInputs} {} \;
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://libusb.info/";
     repositories.git = "https://github.com/libusb/libusb-compat-0.1";
     description = "cross-platform user-mode USB device library";
diff --git a/pkgs/development/libraries/libusb1/default.nix b/pkgs/development/libraries/libusb1/default.nix
index fef3d168c96e1..33cd34ea5a0ee 100644
--- a/pkgs/development/libraries/libusb1/default.nix
+++ b/pkgs/development/libraries/libusb1/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , autoreconfHook
 , pkg-config
@@ -26,18 +26,18 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ pkg-config autoreconfHook ];
   propagatedBuildInputs =
-    stdenv.lib.optional enableUdev udev ++
-    stdenv.lib.optionals stdenv.isDarwin [ libobjc IOKit ];
+    lib.optional enableUdev udev ++
+    lib.optionals stdenv.isDarwin [ libobjc IOKit ];
 
   dontDisableStatic = withStatic;
 
-  configureFlags = stdenv.lib.optional (!enableUdev) "--disable-udev";
+  configureFlags = lib.optional (!enableUdev) "--disable-udev";
 
-  preFixup = stdenv.lib.optionalString enableUdev ''
-    sed 's,-ludev,-L${stdenv.lib.getLib udev}/lib -ludev,' -i $out/lib/libusb-1.0.la
+  preFixup = lib.optionalString enableUdev ''
+    sed 's,-ludev,-L${lib.getLib udev}/lib -ludev,' -i $out/lib/libusb-1.0.la
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://libusb.info/";
     repositories.git = "https://github.com/libusb/libusb";
     description = "cross-platform user-mode USB device library";
diff --git a/pkgs/development/libraries/libusbmuxd/default.nix b/pkgs/development/libraries/libusbmuxd/default.nix
index cb8e1761d82f2..66198a6ec33f7 100644
--- a/pkgs/development/libraries/libusbmuxd/default.nix
+++ b/pkgs/development/libraries/libusbmuxd/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, autoreconfHook, pkg-config, libplist }:
+{ lib, stdenv, fetchFromGitHub, autoreconfHook, pkg-config, libplist }:
 
 stdenv.mkDerivation rec {
   pname = "libusbmuxd";
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ autoreconfHook pkg-config ];
   buildInputs = [ libplist ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A client library to multiplex connections from and to iOS devices";
     homepage    = "https://github.com/libimobiledevice/libusbmuxd";
     license     = licenses.lgpl21Plus;
diff --git a/pkgs/development/libraries/libuv/default.nix b/pkgs/development/libraries/libuv/default.nix
index 187b8574eefe1..a4447ed337893 100644
--- a/pkgs/development/libraries/libuv/default.nix
+++ b/pkgs/development/libraries/libuv/default.nix
@@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
       "threadpool_multiple_event_loops" # times out on slow machines
       "get_passwd" # passed on NixOS but failed on other Linuxes
       "tcp_writealot" "udp_multicast_join" "udp_multicast_join6" # times out sometimes
-    ] ++ stdenv.lib.optionals stdenv.isDarwin [
+    ] ++ lib.optionals stdenv.isDarwin [
         # Sometimes: timeout (no output), failed uv_listen. Someone
         # should report these failures to libuv team. There tests should
         # be much more robust.
@@ -40,7 +40,7 @@ stdenv.mkDerivation rec {
         "fs_event_watch_dir_recursive" "fs_event_watch_file"
         "fs_event_watch_file_current_dir" "fs_event_watch_file_exact_path"
         "process_priority" "udp_create_early_bad_bind"
-    ] ++ stdenv.lib.optionals stdenv.isAarch32 [
+    ] ++ lib.optionals stdenv.isAarch32 [
       # I observe this test failing with some regularity on ARMv7:
       # https://github.com/libuv/libuv/issues/1871
       "shutdown_close_pipe"
@@ -51,7 +51,7 @@ stdenv.mkDerivation rec {
     '';
 
   nativeBuildInputs = [ automake autoconf libtool pkg-config ];
-  buildInputs = stdenv.lib.optionals stdenv.isDarwin [ ApplicationServices CoreServices ];
+  buildInputs = lib.optionals stdenv.isDarwin [ ApplicationServices CoreServices ];
 
   preConfigure = ''
     LIBTOOLIZE=libtoolize ./autogen.sh
diff --git a/pkgs/development/libraries/libuvc/default.nix b/pkgs/development/libraries/libuvc/default.nix
index e2956a99432d8..e7ff4bb7f288d 100644
--- a/pkgs/development/libraries/libuvc/default.nix
+++ b/pkgs/development/libraries/libuvc/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , cmake
 , pkg-config
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ libusb1 ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://ken.tossell.net/libuvc/";
     description = "Cross-platform library for USB video devices";
     platforms = platforms.linux;
diff --git a/pkgs/development/libraries/libva/1.0.0.nix b/pkgs/development/libraries/libva/1.0.0.nix
index dbd23c5abc985..ade56ac16ee9e 100644
--- a/pkgs/development/libraries/libva/1.0.0.nix
+++ b/pkgs/development/libraries/libva/1.0.0.nix
@@ -27,7 +27,7 @@ stdenv.mkDerivation rec {
 
   installFlags = [ "dummy_drv_video_ladir=$(out)/lib/dri" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://www.freedesktop.org/wiki/Software/vaapi";
     license = licenses.mit;
     description = "VAAPI library: Video Acceleration API";
diff --git a/pkgs/development/libraries/libva/default.nix b/pkgs/development/libraries/libva/default.nix
index f37780f5d6d68..d78332bf5aae1 100644
--- a/pkgs/development/libraries/libva/default.nix
+++ b/pkgs/development/libraries/libva/default.nix
@@ -29,7 +29,7 @@ stdenv.mkDerivation rec {
     "-Ddriverdir=${mesa.drivers.driverLink}/lib/dri:/usr/lib/dri:/usr/lib32/dri"
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "An implementation for VA-API (Video Acceleration API)";
     longDescription = ''
       VA-API is an open-source library and API specification, which provides
diff --git a/pkgs/development/libraries/libva/utils.nix b/pkgs/development/libraries/libva/utils.nix
index f860c328fe7af..bcd24d5195351 100644
--- a/pkgs/development/libraries/libva/utils.nix
+++ b/pkgs/development/libraries/libva/utils.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, meson, ninja, pkg-config
+{ lib, stdenv, fetchFromGitHub, meson, ninja, pkg-config
 , libdrm, libva, libX11, libXext, libXfixes, wayland
 }:
 
@@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ libdrm libva libX11 libXext libXfixes wayland ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A collection of utilities and examples for VA-API";
     longDescription = ''
       libva-utils is a collection of utilities and examples to exercise VA-API
diff --git a/pkgs/development/libraries/libvdpau-va-gl/default.nix b/pkgs/development/libraries/libvdpau-va-gl/default.nix
index 5224da5d9e773..85ebef12fe1fd 100644
--- a/pkgs/development/libraries/libvdpau-va-gl/default.nix
+++ b/pkgs/development/libraries/libvdpau-va-gl/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, pkg-config, libX11, libpthreadstubs, libXau, libXdmcp
+{ lib, stdenv, fetchFromGitHub, cmake, pkg-config, libX11, libpthreadstubs, libXau, libXdmcp
 , libXext, libvdpau, glib, libva, ffmpeg_3, libGLU }:
 
 stdenv.mkDerivation rec {
@@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
 
   doCheck = false; # fails. needs DRI access
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/i-rinat/libvdpau-va-gl";
     description = "VDPAU driver with OpenGL/VAAPI backend";
     license = licenses.lgpl3;
diff --git a/pkgs/development/libraries/libvdpau/default.nix b/pkgs/development/libraries/libvdpau/default.nix
index 42066bd2bf0ab..75dcd337c38bb 100644
--- a/pkgs/development/libraries/libvdpau/default.nix
+++ b/pkgs/development/libraries/libvdpau/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, xorg, mesa, meson, ninja }:
+{ lib, stdenv, fetchurl, pkg-config, xorg, mesa, meson, ninja }:
 
 stdenv.mkDerivation rec {
   pname = "libvdpau";
@@ -17,12 +17,12 @@ stdenv.mkDerivation rec {
 
   propagatedBuildInputs = [ xorg.libX11 ];
 
-  mesonFlags = stdenv.lib.optional stdenv.isLinux
+  mesonFlags = lib.optional stdenv.isLinux
     [ "-Dmoduledir=${mesa.drivers.driverLink}/lib/vdpau" ];
 
-  NIX_LDFLAGS = stdenv.lib.optionalString stdenv.isDarwin "-lX11";
+  NIX_LDFLAGS = lib.optionalString stdenv.isDarwin "-lX11";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://people.freedesktop.org/~aplattner/vdpau/";
     description = "Library to use the Video Decode and Presentation API for Unix (VDPAU)";
     license = licenses.mit; # expat version
diff --git a/pkgs/development/libraries/libversion/default.nix b/pkgs/development/libraries/libversion/default.nix
index a26aa9b569412..98ad4ef7feec8 100644
--- a/pkgs/development/libraries/libversion/default.nix
+++ b/pkgs/development/libraries/libversion/default.nix
@@ -23,7 +23,7 @@ stdenv.mkDerivation rec {
   doCheck = true;
   checkTarget = "test";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Advanced version string comparison library";
     homepage = "https://github.com/repology/libversion";
     license = with licenses; [ mit ];
diff --git a/pkgs/development/libraries/libviper/default.nix b/pkgs/development/libraries/libviper/default.nix
index 7ebabaf72571c..e3b3674acc9f0 100644
--- a/pkgs/development/libraries/libviper/default.nix
+++ b/pkgs/development/libraries/libviper/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, pkg-config, glib, ncurses, gpm}:
+{lib, stdenv, fetchurl, pkg-config, glib, ncurses, gpm}:
 stdenv.mkDerivation rec {
   name = "libviper-1.4.6";
 
@@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ pkg-config ];
   buildInputs = [ glib ncurses gpm];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://libviper.sourceforge.net/";
     description = "Simple window creation and management facilities for the console";
     license = licenses.gpl2Plus;
diff --git a/pkgs/development/libraries/libvirt-glib/default.nix b/pkgs/development/libraries/libvirt-glib/default.nix
index e7dbd2456cb81..a61094d17fe86 100644
--- a/pkgs/development/libraries/libvirt-glib/default.nix
+++ b/pkgs/development/libraries/libvirt-glib/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, gobject-introspection, intltool, vala
+{ lib, stdenv, fetchurl, pkg-config, gobject-introspection, intltool, vala
 , libcap_ng, libvirt, libxml2
 }:
 
@@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
   enableParallelBuilding = true;
   strictDeps = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Library for working with virtual machines";
     longDescription = ''
       libvirt-glib wraps libvirt to provide a high-level object-oriented API better
diff --git a/pkgs/development/libraries/libvirt/5.9.0.nix b/pkgs/development/libraries/libvirt/5.9.0.nix
index 024a667a4da62..76466a1a9f50c 100644
--- a/pkgs/development/libraries/libvirt/5.9.0.nix
+++ b/pkgs/development/libraries/libvirt/5.9.0.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, fetchgit
+{ lib, stdenv, fetchurl, fetchgit
 , pkg-config, makeWrapper, libtool, autoconf, automake, fetchpatch
 , coreutils, libxml2, gnutls, perl, python2, attr
 , iproute, iptables, readline, lvm2, util-linux, systemd, libpciaccess, gettext
@@ -10,7 +10,7 @@
 , enableCeph ? false, ceph
 }:
 
-with stdenv.lib;
+with lib;
 
 # if you update, also bump <nixpkgs/pkgs/development/python-modules/libvirt/default.nix> and SysVirt in <nixpkgs/pkgs/top-level/perl-packages.nix>
 let
@@ -54,7 +54,7 @@ in stdenv.mkDerivation rec {
 
   preConfigure = ''
     ${ optionalString (!buildFromTarball) "./bootstrap --no-git --gnulib-srcdir=$(pwd)/.gnulib" }
-    PATH=${stdenv.lib.makeBinPath ([ dnsmasq ] ++ optionals stdenv.isLinux [ iproute iptables ebtables lvm2 systemd numad ] ++ optionals enableIscsi [ openiscsi ])}:$PATH
+    PATH=${lib.makeBinPath ([ dnsmasq ] ++ optionals stdenv.isLinux [ iproute iptables ebtables lvm2 systemd numad ] ++ optionals enableIscsi [ openiscsi ])}:$PATH
     # the path to qemu-kvm will be stored in VM's .xml and .save files
     # do not use "''${qemu_kvm}/bin/qemu-kvm" to avoid bound VMs to particular qemu derivations
     substituteInPlace src/lxc/lxc_conf.c \
diff --git a/pkgs/development/libraries/libvirt/default.nix b/pkgs/development/libraries/libvirt/default.nix
index f8a8bec15d521..60113d492a71a 100644
--- a/pkgs/development/libraries/libvirt/default.nix
+++ b/pkgs/development/libraries/libvirt/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, fetchgit
+{ lib, stdenv, fetchurl, fetchgit
 , makeWrapper, autoreconfHook, fetchpatch
 , coreutils, libxml2, gnutls, perl, python2, attr, glib, docutils
 , iproute, readline, lvm2, util-linux, systemd, libpciaccess, gettext
@@ -11,7 +11,7 @@
 , enableCeph ? false, ceph
 }:
 
-with stdenv.lib;
+with lib;
 
 # if you update, also bump <nixpkgs/pkgs/development/python-modules/libvirt/default.nix> and SysVirt in <nixpkgs/pkgs/top-level/perl-packages.nix>
 let
@@ -72,14 +72,14 @@ in stdenv.mkDerivation rec {
       sed -i meson.build -e "s|conf.set_quoted('${var}',.*|conf.set_quoted('${var}','${value}')|"
     '';
   in ''
-    PATH=${stdenv.lib.makeBinPath ([ dnsmasq ] ++ optionals stdenv.isLinux [ iproute iptables-nftables-compat lvm2 systemd numad ] ++ optionals enableIscsi [ openiscsi ])}:$PATH
+    PATH=${lib.makeBinPath ([ dnsmasq ] ++ optionals stdenv.isLinux [ iproute iptables-nftables-compat lvm2 systemd numad ] ++ optionals enableIscsi [ openiscsi ])}:$PATH
     # the path to qemu-kvm will be stored in VM's .xml and .save files
     # do not use "''${qemu_kvm}/bin/qemu-kvm" to avoid bound VMs to particular qemu derivations
     substituteInPlace src/lxc/lxc_conf.c \
       --replace 'lxc_path,' '"/run/libvirt/nix-emulators/libvirt_lxc",'
     patchShebangs . # fixes /usr/bin/python references
   ''
-  + (stdenv.lib.concatStringsSep "\n" (stdenv.lib.mapAttrsToList patchBuilder overrides));
+  + (lib.concatStringsSep "\n" (stdenv.lib.mapAttrsToList patchBuilder overrides));
 
   mesonAutoFeatures = "auto";
 
diff --git a/pkgs/development/libraries/libvisio/default.nix b/pkgs/development/libraries/libvisio/default.nix
index 4d17f3a8c0e32..42051fe66a63b 100644
--- a/pkgs/development/libraries/libvisio/default.nix
+++ b/pkgs/development/libraries/libvisio/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, boost, libwpd, libwpg, pkg-config, zlib, gperf
+{ lib, stdenv, fetchurl, boost, libwpd, libwpg, pkg-config, zlib, gperf
 , librevenge, libxml2, icu, perl, cppunit, doxygen
 }:
 
@@ -22,7 +22,7 @@ stdenv.mkDerivation rec {
 
   doCheck = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A library providing ability to interpret and import visio diagrams into various applications";
     homepage = "https://wiki.documentfoundation.org/DLP/Libraries/libvisio";
     license = licenses.mpl20;
diff --git a/pkgs/development/libraries/libvisual/default.nix b/pkgs/development/libraries/libvisual/default.nix
index 9559a604f0a8b..7a996d3b8079c 100644
--- a/pkgs/development/libraries/libvisual/default.nix
+++ b/pkgs/development/libraries/libvisual/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, glib }:
+{ lib, stdenv, fetchurl, pkg-config, glib }:
 
 stdenv.mkDerivation rec {
   name = "libvisual-0.4.0";
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
 
   hardeningDisable = [ "format" ];
 
-  configureFlags = stdenv.lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
+  configureFlags = lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
     "ac_cv_func_malloc_0_nonnull=yes"
     "ac_cv_func_realloc_0_nonnull=yes"
   ];
@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
   meta = {
     description = "An abstraction library for audio visualisations";
     homepage = "https://sourceforge.net/projects/libvisual/";
-    license = stdenv.lib.licenses.lgpl21Plus;
-    platforms = stdenv.lib.platforms.linux;
+    license = lib.licenses.lgpl21Plus;
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/development/libraries/libvmaf/default.nix b/pkgs/development/libraries/libvmaf/default.nix
index 6a8cc8594744d..c4b945bed446b 100644
--- a/pkgs/development/libraries/libvmaf/default.nix
+++ b/pkgs/development/libraries/libvmaf/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, meson, ninja, nasm }:
+{ lib, stdenv, fetchFromGitHub, meson, ninja, nasm }:
 
 stdenv.mkDerivation rec {
   pname = "libvmaf";
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
   outputs = [ "out" "dev" ];
   doCheck = false;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/Netflix/vmaf";
     description = "Perceptual video quality assessment based on multi-method fusion (VMAF)";
     changelog = "https://github.com/Netflix/vmaf/blob/v${version}/CHANGELOG.md";
diff --git a/pkgs/development/libraries/libvmi/default.nix b/pkgs/development/libraries/libvmi/default.nix
index 0f4bb4950f9a6..9d9e47407b629 100644
--- a/pkgs/development/libraries/libvmi/default.nix
+++ b/pkgs/development/libraries/libvmi/default.nix
@@ -1,4 +1,4 @@
-{ stdenv,
+{ lib, stdenv,
   fetchFromGitHub,
   autoreconfHook,
   bison,
@@ -10,7 +10,7 @@
   libvirt,
   xenSupport ? true }:
 
-with stdenv.lib;
+with lib;
 
 stdenv.mkDerivation rec {
   pname = "libvmi";
@@ -36,7 +36,7 @@ stdenv.mkDerivation rec {
     patchelf --set-rpath "$oldrpath:${makeLibraryPath [ xen ]}" "$libvmi"
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://libvmi.com/";
     description = "A C library for virtual machine introspection";
     longDescription = ''
diff --git a/pkgs/development/libraries/libvncserver/default.nix b/pkgs/development/libraries/libvncserver/default.nix
index c4e82b1c326c9..7c8d4a76fc954 100644
--- a/pkgs/development/libraries/libvncserver/default.nix
+++ b/pkgs/development/libraries/libvncserver/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchzip, fetchpatch, cmake
+{ lib, stdenv, fetchzip, fetchpatch, cmake
 , libjpeg, openssl, zlib, libgcrypt, libpng
 , systemd
 }:
@@ -21,14 +21,14 @@ stdenv.mkDerivation {
   nativeBuildInputs = [ cmake ];
   buildInputs = [
     libjpeg openssl libgcrypt libpng
-  ] ++ stdenv.lib.optional stdenv.isLinux systemd;
+  ] ++ lib.optional stdenv.isLinux systemd;
   propagatedBuildInputs = [ zlib ];
   meta = {
     inherit (s) version;
     description = "VNC server library";
     homepage = "https://libvnc.github.io/";
-    license = stdenv.lib.licenses.gpl2Plus ;
-    maintainers = [stdenv.lib.maintainers.raskin];
-    platforms = stdenv.lib.platforms.unix;
+    license = lib.licenses.gpl2Plus ;
+    maintainers = [lib.maintainers.raskin];
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/libvorbis/default.nix b/pkgs/development/libraries/libvorbis/default.nix
index 7ad8174cd4840..9fd3fc59ab392 100644
--- a/pkgs/development/libraries/libvorbis/default.nix
+++ b/pkgs/development/libraries/libvorbis/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, libogg, pkg-config }:
+{ lib, stdenv, fetchurl, libogg, pkg-config }:
 
 stdenv.mkDerivation rec {
   name = "libvorbis-1.3.7";
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
 
   doCheck = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Vorbis audio compression reference implementation";
     homepage = "https://xiph.org/vorbis/";
     license = licenses.bsd3;
diff --git a/pkgs/development/libraries/libvpx/1_8.nix b/pkgs/development/libraries/libvpx/1_8.nix
index c82b7a674accd..e78a96784d9ed 100644
--- a/pkgs/development/libraries/libvpx/1_8.nix
+++ b/pkgs/development/libraries/libvpx/1_8.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, perl, yasm
+{ lib, stdenv, fetchFromGitHub, perl, yasm
 , vp8DecoderSupport ? true # VP8 decoder
 , vp8EncoderSupport ? true # VP8 encoder
 , vp9DecoderSupport ? true # VP9 decoder
@@ -40,7 +40,7 @@
 
 let
   inherit (stdenv) is64bit isMips isDarwin isCygwin;
-  inherit (stdenv.lib) enableFeature optional optionals;
+  inherit (lib) enableFeature optional optionals;
 in
 
 assert vp8DecoderSupport || vp8EncoderSupport || vp9DecoderSupport || vp9EncoderSupport;
@@ -173,7 +173,7 @@ stdenv.mkDerivation rec {
 
   postInstall = ''moveToOutput bin "$bin" '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "WebM VP8/VP9 codec SDK";
     homepage    = "https://www.webmproject.org/";
     license     = licenses.bsd3;
diff --git a/pkgs/development/libraries/libvpx/default.nix b/pkgs/development/libraries/libvpx/default.nix
index 83e60466c1462..5aa8cf7049101 100644
--- a/pkgs/development/libraries/libvpx/default.nix
+++ b/pkgs/development/libraries/libvpx/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, perl, yasm
+{ lib, stdenv, fetchFromGitHub, perl, yasm
 , vp8DecoderSupport ? true # VP8 decoder
 , vp8EncoderSupport ? true # VP8 encoder
 , vp9DecoderSupport ? true # VP9 decoder
@@ -40,7 +40,7 @@
 
 let
   inherit (stdenv) is64bit isMips isDarwin isCygwin;
-  inherit (stdenv.lib) enableFeature optional optionals;
+  inherit (lib) enableFeature optional optionals;
 in
 
 assert vp8DecoderSupport || vp8EncoderSupport || vp9DecoderSupport || vp9EncoderSupport;
@@ -169,7 +169,7 @@ stdenv.mkDerivation rec {
 
   postInstall = ''moveToOutput bin "$bin" '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "WebM VP8/VP9 codec SDK";
     homepage    = "https://www.webmproject.org/";
     license     = licenses.bsd3;
diff --git a/pkgs/development/libraries/libvterm-neovim/default.nix b/pkgs/development/libraries/libvterm-neovim/default.nix
index ca50345f5b210..e4a0536018334 100644
--- a/pkgs/development/libraries/libvterm-neovim/default.nix
+++ b/pkgs/development/libraries/libvterm-neovim/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , perl
 , libtool
@@ -20,11 +20,11 @@ stdenv.mkDerivation {
   nativeBuildInputs = [ libtool ];
 
   makeFlags = [ "PREFIX=$(out)" ]
-    ++ stdenv.lib.optional stdenv.isDarwin "LIBTOOL=${libtool}/bin/libtool";
+    ++ lib.optional stdenv.isDarwin "LIBTOOL=${libtool}/bin/libtool";
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "VT220/xterm/ECMA-48 terminal emulator library";
     homepage = "http://www.leonerd.org.uk/code/libvterm/";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/libvterm/default.nix b/pkgs/development/libraries/libvterm/default.nix
index 6c37dc23ad786..90914d4186ea6 100644
--- a/pkgs/development/libraries/libvterm/default.nix
+++ b/pkgs/development/libraries/libvterm/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, glib, ncurses }:
+{ lib, stdenv, fetchurl, pkg-config, glib, ncurses }:
 
 stdenv.mkDerivation rec {
   name = "libvterm-0.99.7";
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ pkg-config ];
   buildInputs = [ glib ncurses ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://libvterm.sourceforge.net/";
     description = "Terminal emulator library to mimic both vt100 and rxvt";
     license = licenses.gpl2Plus;
diff --git a/pkgs/development/libraries/libwacom/default.nix b/pkgs/development/libraries/libwacom/default.nix
index fe9aaaed1255b..14b996145affc 100644
--- a/pkgs/development/libraries/libwacom/default.nix
+++ b/pkgs/development/libraries/libwacom/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, meson, ninja, glib, pkg-config, udev, libgudev, doxygen }:
+{ lib, stdenv, fetchFromGitHub, meson, ninja, glib, pkg-config, udev, libgudev, doxygen }:
 
 stdenv.mkDerivation rec {
   pname = "libwacom";
@@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ glib udev libgudev ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     platforms = platforms.linux;
     homepage = "https://linuxwacom.github.io/";
     description = "Libraries, configuration, and diagnostic tools for Wacom tablets running under Linux";
diff --git a/pkgs/development/libraries/libwebp/default.nix b/pkgs/development/libraries/libwebp/default.nix
index 6d24ba7f2ed25..4908dc4a9ce1d 100644
--- a/pkgs/development/libraries/libwebp/default.nix
+++ b/pkgs/development/libraries/libwebp/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, autoreconfHook, libtool
+{ lib, stdenv, fetchFromGitHub, autoreconfHook, libtool
 , threadingSupport ? true # multi-threading
 , openglSupport ? false, freeglut ? null, libGL ? null, libGLU ? null # OpenGL (required for vwebp)
 , pngSupport ? true, libpng ? null # PNG image format
@@ -24,7 +24,7 @@ let
   mkFlag = optSet: flag: if optSet then "--enable-${flag}" else "--disable-${flag}";
 in
 
-with stdenv.lib;
+with lib;
 stdenv.mkDerivation rec {
   pname = "libwebp";
   version = "1.1.0";
diff --git a/pkgs/development/libraries/libwebsockets/default.nix b/pkgs/development/libraries/libwebsockets/default.nix
index c56781931f3ff..8f749d9fe6aa7 100644
--- a/pkgs/development/libraries/libwebsockets/default.nix
+++ b/pkgs/development/libraries/libwebsockets/default.nix
@@ -1,4 +1,4 @@
-{ fetchFromGitHub, stdenv, cmake, openssl, zlib, libuv }:
+{ fetchFromGitHub, lib, stdenv, cmake, openssl, zlib, libuv }:
 
 let
   generic = { version, sha256 }: stdenv.mkDerivation rec {
@@ -22,9 +22,9 @@ let
       "-DLWS_WITH_SOCKS5=ON"
     ];
 
-    NIX_CFLAGS_COMPILE = stdenv.lib.optionalString stdenv.cc.isGNU "-Wno-error=unused-but-set-variable";
+    NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isGNU "-Wno-error=unused-but-set-variable";
 
-    meta = with stdenv.lib; {
+    meta = with lib; {
       description = "Light, portable C library for websockets";
       longDescription = ''
         Libwebsockets is a lightweight pure C library built to
diff --git a/pkgs/development/libraries/libwhereami/default.nix b/pkgs/development/libraries/libwhereami/default.nix
index 7dac33152856c..d0dd593a03dd0 100644
--- a/pkgs/development/libraries/libwhereami/default.nix
+++ b/pkgs/development/libraries/libwhereami/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, boost, curl, leatherman }:
+{ lib, stdenv, fetchFromGitHub, cmake, boost, curl, leatherman }:
 
 stdenv.mkDerivation rec {
   pname = "libwhereami";
@@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ boost curl leatherman ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     inherit (src.meta) homepage;
     description = "Library to report hypervisor information from inside a VM";
     license = licenses.asl20;
diff --git a/pkgs/development/libraries/libwmf/default.nix b/pkgs/development/libraries/libwmf/default.nix
index c7232ef6ba0f8..e955fee57207a 100644
--- a/pkgs/development/libraries/libwmf/default.nix
+++ b/pkgs/development/libraries/libwmf/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, pkg-config
+{ lib, stdenv, fetchFromGitHub, pkg-config
 , freetype, glib, imagemagick, libjpeg, libpng, libxml2, zlib
 }:
 
@@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
   buildInputs = [ zlib imagemagick libpng glib freetype libjpeg libxml2 ];
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "WMF library from wvWare";
     homepage = "http://wvware.sourceforge.net/libwmf.html";
     downloadPage = "https://github.com/caolanm/libwmf/releases";
diff --git a/pkgs/development/libraries/libwnck/3.x.nix b/pkgs/development/libraries/libwnck/3.x.nix
index 8b0e186850130..3792b826f5942 100644
--- a/pkgs/development/libraries/libwnck/3.x.nix
+++ b/pkgs/development/libraries/libwnck/3.x.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , fetchpatch
 , meson
@@ -27,7 +27,7 @@ stdenv.mkDerivation rec {
   outputBin = "dev";
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "0pwjdhca9lz2n1gf9b60xf0m6ipf9snp8rqf9csj4pgdnd882l5w";
   };
 
@@ -62,11 +62,11 @@ stdenv.mkDerivation rec {
   passthru = {
     updateScript = gnome3.updateScript {
       packageName = pname;
-      attrPath = "${pname}${stdenv.lib.versions.major version}";
+      attrPath = "${pname}${lib.versions.major version}";
     };
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Library to manage X windows and workspaces (via pagers, tasklists, etc.)";
     license = licenses.lgpl21Plus;
     platforms = platforms.linux;
diff --git a/pkgs/development/libraries/libwnck/default.nix b/pkgs/development/libraries/libwnck/default.nix
index f4305cde7d7bc..c0019ee268afb 100644
--- a/pkgs/development/libraries/libwnck/default.nix
+++ b/pkgs/development/libraries/libwnck/default.nix
@@ -1,11 +1,11 @@
-{ stdenv, fetchurl, pkg-config, gtk2, intltool, xorg }:
+{ lib, stdenv, fetchurl, pkg-config, gtk2, intltool, xorg }:
 
 stdenv.mkDerivation rec {
   pname = "libwnck";
   version = "2.31.0";
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "17isfjvrzgj5znld2a7zsk9vd39q9wnsysnw5jr8iz410z935xw3";
   };
 
@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
   meta = {
     description = "A library for creating task lists and pagers";
     homepage = "https://gitlab.gnome.org/GNOME/libwnck";
-    license = stdenv.lib.licenses.lgpl21;
-    maintainers = with stdenv.lib.maintainers; [ johnazoidberg ];
+    license = lib.licenses.lgpl21;
+    maintainers = with lib.maintainers; [ johnazoidberg ];
   };
 }
diff --git a/pkgs/development/libraries/libwpd/0.8.nix b/pkgs/development/libraries/libwpd/0.8.nix
index f924afd4e1aaf..df21f2640966f 100644
--- a/pkgs/development/libraries/libwpd/0.8.nix
+++ b/pkgs/development/libraries/libwpd/0.8.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, glib, libgsf, libxml2, bzip2 }:
+{ lib, stdenv, fetchurl, pkg-config, glib, libgsf, libxml2, bzip2 }:
 
 stdenv.mkDerivation rec {
   name = "libwpd-0.8.14";
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ pkg-config bzip2 ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Library for importing WordPerfect documents";
     homepage = "http://libwpd.sourceforge.net";
     license = with licenses; [ lgpl21 mpl20 ];
diff --git a/pkgs/development/libraries/libwpd/default.nix b/pkgs/development/libraries/libwpd/default.nix
index 7ddc7965c0526..8afe549cb68f1 100644
--- a/pkgs/development/libraries/libwpd/default.nix
+++ b/pkgs/development/libraries/libwpd/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, zlib, pkg-config, glib, libgsf, libxml2, librevenge }:
+{ lib, stdenv, fetchurl, zlib, pkg-config, glib, libgsf, libxml2, librevenge }:
 
 stdenv.mkDerivation rec {
   name = "libwpd-0.10.0";
@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ pkg-config ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A library for importing and exporting WordPerfect documents";
     homepage = "http://libwpd.sourceforge.net/";
     license = licenses.lgpl21;
diff --git a/pkgs/development/libraries/libwpg/default.nix b/pkgs/development/libraries/libwpg/default.nix
index bbdb10f3f0f36..cf85d57a7f20f 100644
--- a/pkgs/development/libraries/libwpg/default.nix
+++ b/pkgs/development/libraries/libwpg/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, libwpd, zlib, librevenge }:
+{ lib, stdenv, fetchurl, pkg-config, libwpd, zlib, librevenge }:
 
 stdenv.mkDerivation rec {
   name = "libwpg-0.3.3";
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
   buildInputs = [ libwpd zlib librevenge ];
   nativeBuildInputs = [ pkg-config ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://libwpg.sourceforge.net";
     description = "C++ library to parse WPG";
     license = with licenses; [ lgpl21 mpl20 ];
diff --git a/pkgs/development/libraries/libwps/default.nix b/pkgs/development/libraries/libwps/default.nix
index 252b13dd6da7f..7dd7153bae9f3 100644
--- a/pkgs/development/libraries/libwps/default.nix
+++ b/pkgs/development/libraries/libwps/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, boost, pkg-config, librevenge, zlib }:
+{ lib, stdenv, fetchurl, boost, pkg-config, librevenge, zlib }:
 
 stdenv.mkDerivation rec {
   pname = "libwps";
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
 
   NIX_CFLAGS_COMPILE = "-Wno-error=implicit-fallthrough";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://libwps.sourceforge.net/";
     description = "Microsoft Works document format import filter library";
     platforms = platforms.unix;
diff --git a/pkgs/development/libraries/libx86/default.nix b/pkgs/development/libraries/libx86/default.nix
index 271823ace2883..1abefa8f43749 100644
--- a/pkgs/development/libraries/libx86/default.nix
+++ b/pkgs/development/libraries/libx86/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
   pname = "libx86";
@@ -13,14 +13,14 @@ stdenv.mkDerivation rec {
   #  http://www.mail-archive.com/suspend-devel@lists.sourceforge.net/msg02355.html
   makeFlags = [
     "DESTDIR=$(out)"
-  ] ++ stdenv.lib.optional (!stdenv.isi686) "BACKEND=x86emu";
+  ] ++ lib.optional (!stdenv.isi686) "BACKEND=x86emu";
 
   preBuild = ''
     sed -i lrmi.c -e 's@defined(__i386__)@(defined(__i386__) || defined(__x86_64__))@'
     sed -e s@/usr@@ -i Makefile
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Real-mode x86 code emulator";
     maintainers = with maintainers; [ raskin ];
     platforms = [ "x86_64-linux" "i686-linux" ];
diff --git a/pkgs/development/libraries/libx86emu/default.nix b/pkgs/development/libraries/libx86emu/default.nix
index 1b10ac5fdaab8..8f9669561d62d 100644
--- a/pkgs/development/libraries/libx86emu/default.nix
+++ b/pkgs/development/libraries/libx86emu/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, perl }:
+{ lib, stdenv, fetchFromGitHub, perl }:
 
 stdenv.mkDerivation rec {
   pname = "libx86emu";
@@ -25,7 +25,7 @@ stdenv.mkDerivation rec {
 
   installFlags = [ "DESTDIR=$(out)" "LIBDIR=/lib" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "x86 emulation library";
     license = licenses.bsd2;
     homepage = "https://github.com/wfeldt/libx86emu";
diff --git a/pkgs/development/libraries/libxc/default.nix b/pkgs/development/libraries/libxc/default.nix
index 3f687ad26c8bd..d26518c7de987 100644
--- a/pkgs/development/libraries/libxc/default.nix
+++ b/pkgs/development/libraries/libxc/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, gfortran, perl }:
+{ lib, stdenv, fetchurl, gfortran, perl }:
 
 let
   version = "4.3.4";
@@ -23,7 +23,7 @@ in stdenv.mkDerivation {
   doCheck = true;
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Library of exchange-correlation functionals for density-functional theory";
     homepage = "https://octopus-code.org/wiki/Libxc";
     license = licenses.lgpl3;
diff --git a/pkgs/development/libraries/libxcomp/default.nix b/pkgs/development/libraries/libxcomp/default.nix
index 4ab63e0e9c4d8..b66fe5c5a21a3 100644
--- a/pkgs/development/libraries/libxcomp/default.nix
+++ b/pkgs/development/libraries/libxcomp/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, autoreconfHook, pkg-config, libjpeg, libpng, libX11, zlib }:
+{ lib, stdenv, fetchurl, autoreconfHook, pkg-config, libjpeg, libpng, libX11, zlib }:
 
 stdenv.mkDerivation rec {
   pname = "libxcomp";
@@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "NX compression library";
     homepage = "http://wiki.x2go.org/doku.php/wiki:libs:nx-libs";
     license = licenses.gpl2;
diff --git a/pkgs/development/libraries/libxdg-basedir/default.nix b/pkgs/development/libraries/libxdg-basedir/default.nix
index fdf62e38269ef..58a58f2726bda 100644
--- a/pkgs/development/libraries/libxdg-basedir/default.nix
+++ b/pkgs/development/libraries/libxdg-basedir/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, fetchpatch}:
+{lib, stdenv, fetchurl, fetchpatch}:
 
 stdenv.mkDerivation rec {
   name = "libxdg-basedir-1.2.0";
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
     })
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/devnev/libxdg-basedir";
     description = "Implementation of the XDG Base Directory specification";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/libxkbcommon/default.nix b/pkgs/development/libraries/libxkbcommon/default.nix
index 467d42ce99727..c0785b34e891b 100644
--- a/pkgs/development/libraries/libxkbcommon/default.nix
+++ b/pkgs/development/libraries/libxkbcommon/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, meson, ninja, pkg-config, yacc, doxygen
+{ lib, stdenv, fetchurl, meson, ninja, pkg-config, yacc, doxygen
 , xkeyboard_config, libxcb, libxml2
 , python3
 , libX11
@@ -32,7 +32,7 @@ stdenv.mkDerivation rec {
     patchShebangs ../test/
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A library to handle keyboard descriptions";
     longDescription = ''
       libxkbcommon is a keyboard keymap compiler and support library which
diff --git a/pkgs/development/libraries/libxkbcommon/libxkbcommon_7.nix b/pkgs/development/libraries/libxkbcommon/libxkbcommon_7.nix
index 75043b02e57bc..cf5f6e320c0b1 100644
--- a/pkgs/development/libraries/libxkbcommon/libxkbcommon_7.nix
+++ b/pkgs/development/libraries/libxkbcommon/libxkbcommon_7.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, yacc, flex, xkeyboard_config, libxcb, libX11 }:
+{ lib, stdenv, fetchurl, pkg-config, yacc, flex, xkeyboard_config, libxcb, libX11 }:
 
 stdenv.mkDerivation rec {
   name = "libxkbcommon-0.7.2";
@@ -18,11 +18,11 @@ stdenv.mkDerivation rec {
     "--with-x-locale-root=${libX11.out}/share/X11/locale"
   ];
 
-  preBuild = stdenv.lib.optionalString stdenv.isDarwin ''
+  preBuild = lib.optionalString stdenv.isDarwin ''
     sed -i 's/,--version-script=.*$//' Makefile
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A library to handle keyboard descriptions";
     homepage = "https://xkbcommon.org";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/libxklavier/default.nix b/pkgs/development/libraries/libxklavier/default.nix
index 88c3ae60cf386..60b52152f67ff 100644
--- a/pkgs/development/libraries/libxklavier/default.nix
+++ b/pkgs/development/libraries/libxklavier/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchgit, autoreconfHook, pkg-config, gtk-doc, xkeyboard_config, libxml2, xorg, docbook_xsl
+{ lib, stdenv, fetchgit, autoreconfHook, pkg-config, gtk-doc, xkeyboard_config, libxml2, xorg, docbook_xsl
 , glib, isocodes, gobject-introspection }:
 
 let
@@ -37,7 +37,7 @@ stdenv.mkDerivation rec {
     "--enable-gtk-doc"
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Library providing high-level API for X Keyboard Extension known as XKB";
     homepage = "http://freedesktop.org/wiki/Software/LibXklavier";
     license = licenses.lgpl2Plus;
diff --git a/pkgs/development/libraries/libxl/default.nix b/pkgs/development/libraries/libxl/default.nix
index 6f11d4c461f90..600e94d0a757d 100644
--- a/pkgs/development/libraries/libxl/default.nix
+++ b/pkgs/development/libraries/libxl/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
   pname = "libxl";
@@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
     cp -rva lib64 $out/lib
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A library for parsing Excel files";
     homepage    = "https://www.libxl.com/";
     license     = licenses.unfree;
diff --git a/pkgs/development/libraries/libxls/default.nix b/pkgs/development/libraries/libxls/default.nix
index 00300899589a8..3e8034f8baa81 100644
--- a/pkgs/development/libraries/libxls/default.nix
+++ b/pkgs/development/libraries/libxls/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, unzip }:
+{ lib, stdenv, fetchurl, unzip }:
 
 stdenv.mkDerivation rec {
   pname = "libxls";
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Extract Cell Data From Excel xls files";
     homepage = "https://sourceforge.net/projects/libxls/";
     license = licenses.bsd2;
diff --git a/pkgs/development/libraries/libxmi/default.nix b/pkgs/development/libraries/libxmi/default.nix
index 89b96467155cc..cc1ae013a0e78 100644
--- a/pkgs/development/libraries/libxmi/default.nix
+++ b/pkgs/development/libraries/libxmi/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, libtool }:
+{ lib, stdenv, fetchurl, libtool }:
 
 stdenv.mkDerivation {
   name = "libxmi-1.2";
@@ -14,8 +14,8 @@ stdenv.mkDerivation {
   meta = {
     description = "Library for rasterizing 2-D vector graphics";
     homepage = "https://www.gnu.org/software/libxmi/";
-    license = stdenv.lib.licenses.gpl2Plus;
-    platforms = stdenv.lib.platforms.gnu ++ stdenv.lib.platforms.linux;  # arbitrary choice
+    license = lib.licenses.gpl2Plus;
+    platforms = lib.platforms.gnu ++ stdenv.lib.platforms.linux;  # arbitrary choice
     maintainers = [ ];
   };
 }
diff --git a/pkgs/development/libraries/libxmlb/default.nix b/pkgs/development/libraries/libxmlb/default.nix
index 182f2d7962086..b958f018b604a 100644
--- a/pkgs/development/libraries/libxmlb/default.nix
+++ b/pkgs/development/libraries/libxmlb/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , docbook_xml_dtd_43
 , docbook_xsl
@@ -64,7 +64,7 @@ stdenv.mkDerivation rec {
     };
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A library to help create and query binary XML blobs";
     homepage = "https://github.com/hughsie/libxmlb";
     license = licenses.lgpl21Plus;
diff --git a/pkgs/development/libraries/libxmlxx/default.nix b/pkgs/development/libraries/libxmlxx/default.nix
index 88f3bec6b9537..19282ddc822d6 100644
--- a/pkgs/development/libraries/libxmlxx/default.nix
+++ b/pkgs/development/libraries/libxmlxx/default.nix
@@ -1,11 +1,11 @@
-{ stdenv, fetchurl, pkg-config, libxml2, glibmm, perl, gnome3 }:
+{ lib, stdenv, fetchurl, pkg-config, libxml2, glibmm, perl, gnome3 }:
 
 stdenv.mkDerivation rec {
   pname = "libxml++";
   version = "2.40.1";
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "1sb3akryklvh2v6m6dihdnbpf1lkx441v972q9hlz1sq6bfspm2a";
   };
 
@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
     };
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://libxmlplusplus.sourceforge.net/";
     description = "C++ wrapper for the libxml2 XML parser library";
     license = licenses.lgpl2Plus;
diff --git a/pkgs/development/libraries/libxmlxx/v3.nix b/pkgs/development/libraries/libxmlxx/v3.nix
index c01d62989efbc..41c842220c7de 100644
--- a/pkgs/development/libraries/libxmlxx/v3.nix
+++ b/pkgs/development/libraries/libxmlxx/v3.nix
@@ -1,11 +1,11 @@
-{ stdenv, fetchurl, pkg-config, libxml2, glibmm, perl }:
+{ lib, stdenv, fetchurl, pkg-config, libxml2, glibmm, perl }:
 
 stdenv.mkDerivation rec {
   pname = "libxml++";
   version = "3.0.1";
 
   src = fetchurl {
-    url = "mirror://gnome/sources/libxml++/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/libxml++/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "19kik79fmg61nv0by0a5f9wchrcfjwzvih4v2waw01hqflhqvp0r";
   };
 
@@ -22,7 +22,7 @@ stdenv.mkDerivation rec {
       --replace 'docdir=''${datarootdir}' "docdir=$doc/share"
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://libxmlplusplus.sourceforge.net/";
     description = "C++ wrapper for the libxml2 XML parser library, version 3";
     license = licenses.lgpl2Plus;
diff --git a/pkgs/development/libraries/libxmp/default.nix b/pkgs/development/libraries/libxmp/default.nix
index ca4d7edbf32d2..0b953f95d7ebb 100644
--- a/pkgs/development/libraries/libxmp/default.nix
+++ b/pkgs/development/libraries/libxmp/default.nix
@@ -1,9 +1,9 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
   name = "libxmp-4.4.1";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Extended module player library";
     homepage    = "http://xmp.sourceforge.net/";
     longDescription = ''
diff --git a/pkgs/development/libraries/libxslt/default.nix b/pkgs/development/libraries/libxslt/default.nix
index cf91d7656bf0b..eff9f2b2b792c 100644
--- a/pkgs/development/libraries/libxslt/default.nix
+++ b/pkgs/development/libraries/libxslt/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, fetchpatch, libxml2, findXMLCatalogs, gettext, python, libgcrypt
+{ lib, stdenv, fetchurl, fetchpatch, libxml2, findXMLCatalogs, gettext, python, libgcrypt
 , cryptoSupport ? false
 , pythonSupport ? stdenv.buildPlatform == stdenv.hostPlatform
 }:
@@ -12,12 +12,12 @@ stdenv.mkDerivation rec {
     sha256 = "0zrzz6kjdyavspzik6fbkpvfpbd25r2qg6py5nnjaabrsr3bvccq";
   };
 
-  outputs = [ "bin" "dev" "out" "man" "doc" ] ++ stdenv.lib.optional pythonSupport "py";
+  outputs = [ "bin" "dev" "out" "man" "doc" ] ++ lib.optional pythonSupport "py";
 
   buildInputs = [ libxml2.dev ]
-    ++ stdenv.lib.optional stdenv.isDarwin gettext
-    ++ stdenv.lib.optionals pythonSupport [ libxml2.py python ]
-    ++ stdenv.lib.optionals cryptoSupport [ libgcrypt ];
+    ++ lib.optional stdenv.isDarwin gettext
+    ++ lib.optionals pythonSupport [ libxml2.py python ]
+    ++ lib.optionals cryptoSupport [ libgcrypt ];
 
   propagatedBuildInputs = [ findXMLCatalogs ];
 
@@ -26,14 +26,14 @@ stdenv.mkDerivation rec {
     "--without-debug"
     "--without-mem-debug"
     "--without-debugger"
-  ] ++ stdenv.lib.optional pythonSupport "--with-python=${python}"
-    ++ stdenv.lib.optional (!cryptoSupport) "--without-crypto";
+  ] ++ lib.optional pythonSupport "--with-python=${python}"
+    ++ lib.optional (!cryptoSupport) "--without-crypto";
 
   postFixup = ''
     moveToOutput bin/xslt-config "$dev"
     moveToOutput lib/xsltConf.sh "$dev"
     moveToOutput share/man/man1 "$bin"
-  '' + stdenv.lib.optionalString pythonSupport ''
+  '' + lib.optionalString pythonSupport ''
     mkdir -p $py/nix-support
     echo ${libxml2.py} >> $py/nix-support/propagated-build-inputs
     moveToOutput ${python.libPrefix} "$py"
@@ -43,7 +43,7 @@ stdenv.mkDerivation rec {
     inherit pythonSupport;
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://xmlsoft.org/XSLT/";
     description = "A C library and tools to do XSL transformations";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/libxsmm/default.nix b/pkgs/development/libraries/libxsmm/default.nix
index 5e4a56a6d4de3..a2b4800ec4c46 100644
--- a/pkgs/development/libraries/libxsmm/default.nix
+++ b/pkgs/development/libraries/libxsmm/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, coreutils, gfortran, gnused
+{ lib, stdenv, fetchFromGitHub, coreutils, gfortran, gnused
 , python3, util-linux, which
 
 , enableStatic ? stdenv.hostPlatform.isStatic
@@ -42,11 +42,11 @@ in stdenv.mkDerivation {
     patchShebangs .
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Library targeting Intel Architecture for specialized dense and sparse matrix operations, and deep learning primitives";
     license = licenses.bsd3;
     homepage = "https://github.com/hfp/libxsmm";
     platforms = platforms.linux;
-    maintainers = with stdenv.lib.maintainers; [ chessai ];
+    maintainers = with lib.maintainers; [ chessai ];
   };
 }
diff --git a/pkgs/development/libraries/libyaml-cpp/default.nix b/pkgs/development/libraries/libyaml-cpp/default.nix
index cf880ef1e16c9..13141923202a2 100644
--- a/pkgs/development/libraries/libyaml-cpp/default.nix
+++ b/pkgs/development/libraries/libyaml-cpp/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake }:
+{ lib, stdenv, fetchFromGitHub, cmake }:
 
 stdenv.mkDerivation rec {
   pname = "libyaml-cpp";
@@ -22,7 +22,7 @@ stdenv.mkDerivation rec {
 
   cmakeFlags = [ "-DBUILD_SHARED_LIBS=ON" "-DYAML_CPP_BUILD_TESTS=OFF" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     inherit (src.meta) homepage;
     description = "A YAML parser and emitter for C++";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/libyaml/default.nix b/pkgs/development/libraries/libyaml/default.nix
index 37b8ebcc3efa8..03e7e4715f886 100644
--- a/pkgs/development/libraries/libyaml/default.nix
+++ b/pkgs/development/libraries/libyaml/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , autoreconfHook
 }:
@@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ autoreconfHook ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://pyyaml.org/";
     description = "A YAML 1.1 parser and emitter written in C";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/libykclient/default.nix b/pkgs/development/libraries/libykclient/default.nix
index 33ece6aed42d9..6aacfc5ea2fa1 100644
--- a/pkgs/development/libraries/libykclient/default.nix
+++ b/pkgs/development/libraries/libykclient/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, autoreconfHook, pkg-config, help2man, curl }:
+{ lib, stdenv, fetchFromGitHub, autoreconfHook, pkg-config, help2man, curl }:
 
 stdenv.mkDerivation {
   pname = "libykclient";
@@ -13,7 +13,7 @@ stdenv.mkDerivation {
   nativeBuildInputs = [ autoreconfHook pkg-config help2man ];
   buildInputs = [ curl ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Yubikey C client library";
     homepage = "https://developers.yubico.com/yubico-c-client";
     license = licenses.bsd2;
diff --git a/pkgs/development/libraries/libykneomgr/default.nix b/pkgs/development/libraries/libykneomgr/default.nix
index 614b66fdea389..a7d35950f0347 100644
--- a/pkgs/development/libraries/libykneomgr/default.nix
+++ b/pkgs/development/libraries/libykneomgr/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, pcsclite, libzip, help2man }:
+{ lib, stdenv, fetchurl, pkg-config, pcsclite, libzip, help2man }:
 
 stdenv.mkDerivation rec {
   name = "libykneomgr-0.1.8";
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
     "--with-backend=pcsc"
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://developers.yubico.com/libykneomgr";
     description = "A C library to interact with the CCID-part of the Yubikey NEO";
     license = licenses.bsd3;
diff --git a/pkgs/development/libraries/libyubikey/default.nix b/pkgs/development/libraries/libyubikey/default.nix
index 75170d7ff8aac..b3aa2b57bdf8f 100644
--- a/pkgs/development/libraries/libyubikey/default.nix
+++ b/pkgs/development/libraries/libyubikey/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
   name = "libyubikey-1.13";
@@ -8,7 +8,7 @@ stdenv.mkDerivation rec {
     sha256 = "009l3k2zyn06dbrlja2d4p2vfnzjhlcqxi88v02mlrnb17mx1v84";
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://opensource.yubico.com/yubico-c/";
     description = "C library for manipulating Yubico YubiKey One-Time Passwords (OTPs)";
     license = licenses.bsd2;
diff --git a/pkgs/development/libraries/libzapojit/default.nix b/pkgs/development/libraries/libzapojit/default.nix
index 1177196ed1871..d16f34039f193 100644
--- a/pkgs/development/libraries/libzapojit/default.nix
+++ b/pkgs/development/libraries/libzapojit/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, glib, intltool, json-glib, librest, libsoup, gnome3, gnome-online-accounts, gobject-introspection }:
+{ lib, stdenv, fetchurl, pkg-config, glib, intltool, json-glib, librest, libsoup, gnome3, gnome-online-accounts, gobject-introspection }:
 
 stdenv.mkDerivation rec {
   pname = "libzapojit";
@@ -7,7 +7,7 @@ stdenv.mkDerivation rec {
   outputs = [ "out" "dev" ];
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "0zn3s7ryjc3k1abj4k55dr2na844l451nrg9s6cvnnhh569zj99x";
   };
 
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
     };
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "GObject wrapper for the SkyDrive and Hotmail REST APIs";
     homepage = "https://wiki.gnome.org/Projects/Zapojit";
     license = licenses.lgpl21Plus;
diff --git a/pkgs/development/libraries/libzdb/default.nix b/pkgs/development/libraries/libzdb/default.nix
index 95f8e78cfb26f..986f27e27c89a 100644
--- a/pkgs/development/libraries/libzdb/default.nix
+++ b/pkgs/development/libraries/libzdb/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, sqlite}:
+{lib, stdenv, fetchurl, sqlite}:
 
 stdenv.mkDerivation rec
 {
@@ -17,8 +17,8 @@ stdenv.mkDerivation rec
   {
     homepage = "http://www.tildeslash.com/libzdb/";
     description = "A small, easy to use Open Source Database Connection Pool Library";
-    license = stdenv.lib.licenses.gpl3;
-    platforms = stdenv.lib.platforms.linux;
+    license = lib.licenses.gpl3;
+    platforms = lib.platforms.linux;
     maintainers = [ ];
   };
 }
diff --git a/pkgs/development/libraries/libzen/default.nix b/pkgs/development/libraries/libzen/default.nix
index 80a570dd697f4..2d19ca4b22be2 100644
--- a/pkgs/development/libraries/libzen/default.nix
+++ b/pkgs/development/libraries/libzen/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, autoreconfHook }:
+{ lib, stdenv, fetchurl, autoreconfHook }:
 
 stdenv.mkDerivation rec {
   version = "0.4.38";
@@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Shared library for libmediainfo and mediainfo";
     homepage = "https://mediaarea.net/";
     license = licenses.bsd2;
diff --git a/pkgs/development/libraries/libzip/default.nix b/pkgs/development/libraries/libzip/default.nix
index 27c046814f329..c65a9b6f583a9 100644
--- a/pkgs/development/libraries/libzip/default.nix
+++ b/pkgs/development/libraries/libzip/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, cmake, perl, zlib }:
+{ lib, stdenv, fetchurl, cmake, perl, zlib }:
 
 stdenv.mkDerivation rec {
   pname = "libzip";
@@ -26,7 +26,7 @@ stdenv.mkDerivation rec {
     patchShebangs regress
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://www.nih.at/libzip";
     description = "A C library for reading, creating and modifying zip archives";
     license = licenses.bsd3;
diff --git a/pkgs/development/libraries/libzmf/default.nix b/pkgs/development/libraries/libzmf/default.nix
index a2013604deb71..ee19734a0c084 100644
--- a/pkgs/development/libraries/libzmf/default.nix
+++ b/pkgs/development/libraries/libzmf/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, boost, icu, libpng, librevenge, zlib, doxygen, pkg-config, cppunit}:
+{lib, stdenv, fetchurl, boost, icu, libpng, librevenge, zlib, doxygen, pkg-config, cppunit}:
 
 stdenv.mkDerivation rec {
   pname = "libzmf";
@@ -16,9 +16,9 @@ stdenv.mkDerivation rec {
   meta = {
     inherit version;
     description = ''A library that parses the file format of Zoner Callisto/Draw documents'';
-    license = stdenv.lib.licenses.mpl20;
-    maintainers = [stdenv.lib.maintainers.raskin];
-    platforms = stdenv.lib.platforms.unix;
+    license = lib.licenses.mpl20;
+    maintainers = [lib.maintainers.raskin];
+    platforms = lib.platforms.unix;
     homepage = "https://wiki.documentfoundation.org/DLP/Libraries/libzmf";
     downloadPage = "http://dev-www.libreoffice.org/src/libzmf/";
     updateWalker = true;
diff --git a/pkgs/development/libraries/libzra/default.nix b/pkgs/development/libraries/libzra/default.nix
index 6accf24ac28da..3ebfc21095d16 100644
--- a/pkgs/development/libraries/libzra/default.nix
+++ b/pkgs/development/libraries/libzra/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , cmake
 }:
@@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ cmake ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/zraorg/ZRA";
     description = "Library for ZStandard random access";
     platforms = platforms.all;
diff --git a/pkgs/development/libraries/lief/default.nix b/pkgs/development/libraries/lief/default.nix
index 0854987436e65..3b57d0c2f7aee 100644
--- a/pkgs/development/libraries/lief/default.nix
+++ b/pkgs/development/libraries/lief/default.nix
@@ -1,10 +1,10 @@
-{ stdenv, fetchzip }:
+{ lib, stdenv, fetchzip }:
 
 fetchzip {
   url = "https://github.com/lief-project/LIEF/releases/download/0.9.0/LIEF-0.9.0-Linux.tar.gz";
   sha256 = "1c47hwd00bp4mqd4p5b6xjfl89c3wwk9ccyc3a2gk658250g2la6";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Library to Instrument Executable Formats";
     homepage = "https://lief.quarkslab.com/";
     license = [ licenses.asl20 ];
diff --git a/pkgs/development/libraries/lightning/default.nix b/pkgs/development/libraries/lightning/default.nix
index 65d0a18cedd09..5fdc06bce012a 100644
--- a/pkgs/development/libraries/lightning/default.nix
+++ b/pkgs/development/libraries/lightning/default.nix
@@ -1,6 +1,6 @@
-{ stdenv, fetchurl, libopcodes }:
+{ lib, stdenv, fetchurl, libopcodes }:
 
-with stdenv.lib;
+with lib;
 stdenv.mkDerivation rec {
 
   pname = "lightning";
@@ -27,6 +27,6 @@ stdenv.mkDerivation rec {
     '';
     maintainers = [ maintainers.AndersonTorres ];
     license = licenses.lgpl3Plus;
-    platforms = stdenv.lib.platforms.linux;
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/development/libraries/lime/default.nix b/pkgs/development/libraries/lime/default.nix
index aa34ff2e927c4..3a16b5202c47f 100644
--- a/pkgs/development/libraries/lime/default.nix
+++ b/pkgs/development/libraries/lime/default.nix
@@ -4,7 +4,7 @@
 , fetchFromGitLab
 , soci
 , sqlite
-, stdenv
+, lib, stdenv
 }:
 
 stdenv.mkDerivation rec {
@@ -26,7 +26,7 @@ stdenv.mkDerivation rec {
   # Do not build static libraries
   cmakeFlags = [ "-DENABLE_STATIC=NO" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "End-to-end encryption library for instant messaging";
     homepage = "http://www.linphone.org/technical-corner/lime";
     license = licenses.gpl3;
diff --git a/pkgs/development/libraries/linbox/default.nix b/pkgs/development/libraries/linbox/default.nix
index 4683f374470e6..8a21bd3bcde4f 100644
--- a/pkgs/development/libraries/linbox/default.nix
+++ b/pkgs/development/libraries/linbox/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , autoreconfHook
 , givaro
@@ -52,7 +52,7 @@ stdenv.mkDerivation rec {
   configureFlags = [
     "--with-blas-libs=-lblas"
     "--disable-optimization"
-  ] ++ stdenv.lib.optionals stdenv.isx86_64 [
+  ] ++ lib.optionals stdenv.isx86_64 [
     # disable SIMD instructions (which are enabled *when available* by default)
     "--${if stdenv.hostPlatform.sse3Support   then "enable" else "disable"}-sse3"
     "--${if stdenv.hostPlatform.ssse3Support  then "enable" else "disable"}-ssse3"
@@ -62,7 +62,7 @@ stdenv.mkDerivation rec {
     "--${if stdenv.hostPlatform.avx2Support   then "enable" else "disable"}-avx2"
     "--${if stdenv.hostPlatform.fmaSupport    then "enable" else "disable"}-fma"
     "--${if stdenv.hostPlatform.fma4Support   then "enable" else "disable"}-fma4"
-  ] ++ stdenv.lib.optionals withSage [
+  ] ++ lib.optionals withSage [
     "--enable-sage"
   ];
 
@@ -70,7 +70,7 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     inherit version;
     description = "C++ library for exact, high-performance linear algebra";
     license = licenses.lgpl21Plus;
diff --git a/pkgs/development/libraries/linenoise-ng/default.nix b/pkgs/development/libraries/linenoise-ng/default.nix
index 0a2dacb48db9d..d19d6748147cc 100644
--- a/pkgs/development/libraries/linenoise-ng/default.nix
+++ b/pkgs/development/libraries/linenoise-ng/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake }:
+{ lib, stdenv, fetchFromGitHub, cmake }:
 
 stdenv.mkDerivation rec {
   pname = "linenoise-ng";
@@ -16,8 +16,8 @@ stdenv.mkDerivation rec {
   meta = {
     homepage = "https://github.com/arangodb/linenoise-ng";
     description = "A small, portable GNU readline replacement for Linux, Windows and MacOS which is capable of handling UTF-8 characters";
-    maintainers = with stdenv.lib.maintainers; [ cstrahan ];
-    platforms = stdenv.lib.platforms.all;
-    license = stdenv.lib.licenses.bsd3;
+    maintainers = with lib.maintainers; [ cstrahan ];
+    platforms = lib.platforms.all;
+    license = lib.licenses.bsd3;
   };
 }
diff --git a/pkgs/development/libraries/linenoise/default.nix b/pkgs/development/libraries/linenoise/default.nix
index 3de9f08bf9714..d465b48a8f46a 100644
--- a/pkgs/development/libraries/linenoise/default.nix
+++ b/pkgs/development/libraries/linenoise/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub }:
+{ lib, stdenv, fetchFromGitHub }:
 
 stdenv.mkDerivation {
   pname = "linenoise";
@@ -23,8 +23,8 @@ stdenv.mkDerivation {
   meta = {
     homepage = "https://github.com/antirez/linenoise";
     description = "A minimal, zero-config, BSD licensed, readline replacement";
-    maintainers = with stdenv.lib.maintainers; [ mpsyco ];
-    platforms = stdenv.lib.platforms.unix;
-    license = stdenv.lib.licenses.bsd2;
+    maintainers = with lib.maintainers; [ mpsyco ];
+    platforms = lib.platforms.unix;
+    license = lib.licenses.bsd2;
   };
 }
diff --git a/pkgs/development/libraries/liquid-dsp/default.nix b/pkgs/development/libraries/liquid-dsp/default.nix
index b882e233c0791..746771f44fe43 100644
--- a/pkgs/development/libraries/liquid-dsp/default.nix
+++ b/pkgs/development/libraries/liquid-dsp/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchFromGitHub, autoreconfHook }:
+{lib, stdenv, fetchFromGitHub, autoreconfHook }:
 
 stdenv.mkDerivation {
   pname = "liquid-dsp";
@@ -16,8 +16,8 @@ stdenv.mkDerivation {
   meta = {
     homepage = "https://liquidsdr.org/";
     description = "Digital signal processing library for software-defined radios";
-    license = stdenv.lib.licenses.mit;
-    platforms = stdenv.lib.platforms.unix;
+    license = lib.licenses.mit;
+    platforms = lib.platforms.unix;
   };
 
 }
diff --git a/pkgs/development/libraries/liquidfun/default.nix b/pkgs/development/libraries/liquidfun/default.nix
index 21d3bc4766355..29531a299966d 100644
--- a/pkgs/development/libraries/liquidfun/default.nix
+++ b/pkgs/development/libraries/liquidfun/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, requireFile, cmake, libGLU, libGL, libX11, libXi }:
+{ lib, stdenv, requireFile, cmake, libGLU, libGL, libX11, libXi }:
 
 let
   sourceInfo = rec {
@@ -36,13 +36,13 @@ stdenv.mkDerivation {
 
   meta = {
     description = "2D physics engine based on Box2D";
-    maintainers = with stdenv.lib.maintainers;
+    maintainers = with lib.maintainers;
     [
       qknight
     ];
-    platforms = stdenv.lib.platforms.linux;
+    platforms = lib.platforms.linux;
     hydraPlatforms = [];
-    license = stdenv.lib.licenses.bsd2;
+    license = lib.licenses.bsd2;
     homepage = "https://google.github.io/liquidfun/";
   };
 }
diff --git a/pkgs/development/libraries/lirc/default.nix b/pkgs/development/libraries/lirc/default.nix
index 9184c7330ed46..6b7f0c102ee8f 100644
--- a/pkgs/development/libraries/lirc/default.nix
+++ b/pkgs/development/libraries/lirc/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, fetchpatch, autoreconfHook, pkg-config, help2man, python3,
+{ lib, stdenv, fetchurl, fetchpatch, autoreconfHook, pkg-config, help2man, python3,
   alsaLib, xlibsWrapper, libxslt, systemd, libusb-compat-0_1, libftdi1 }:
 
 stdenv.mkDerivation rec {
@@ -48,7 +48,7 @@ stdenv.mkDerivation rec {
     "localstatedir=$TMPDIR"
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Allows to receive and send infrared signals";
     homepage = "https://www.lirc.org/";
     license = licenses.gpl2;
diff --git a/pkgs/development/libraries/live555/default.nix b/pkgs/development/libraries/live555/default.nix
index 84907a428605b..85302bc7c966d 100644
--- a/pkgs/development/libraries/live555/default.nix
+++ b/pkgs/development/libraries/live555/default.nix
@@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
     sed \
       -e 's/$(INCLUDES) -I. -O2 -DSOCKLEN_T/$(INCLUDES) -I. -O2 -I. -fPIC -DRTSPCLIENT_SYNCHRONOUS_INTERFACE=1 -DSOCKLEN_T/g' \
       -i config.linux
-  '' + stdenv.lib.optionalString (stdenv ? glibc) ''
+  '' + lib.optionalString (stdenv ? glibc) ''
     substituteInPlace liveMedia/include/Locale.hh \
       --replace '<xlocale.h>' '<locale.h>'
   '';
diff --git a/pkgs/development/libraries/lmdb/default.nix b/pkgs/development/libraries/lmdb/default.nix
index 64f6fccefa79b..a59b460734d03 100644
--- a/pkgs/development/libraries/lmdb/default.nix
+++ b/pkgs/development/libraries/lmdb/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchgit }:
+{ lib, stdenv, fetchgit }:
 
 stdenv.mkDerivation rec {
   pname = "lmdb";
@@ -22,7 +22,7 @@ stdenv.mkDerivation rec {
     "CC=${stdenv.cc.targetPrefix}cc"
     "AR=${stdenv.cc.targetPrefix}ar"
   ]
-    ++ stdenv.lib.optional stdenv.isDarwin "LDFLAGS=-Wl,-install_name,$(out)/lib/liblmdb.so";
+    ++ lib.optional stdenv.isDarwin "LDFLAGS=-Wl,-install_name,$(out)/lib/liblmdb.so";
 
   doCheck = true;
   checkPhase = "make test";
@@ -43,7 +43,7 @@ stdenv.mkDerivation rec {
     EOF
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Lightning memory-mapped database";
     longDescription = ''
       LMDB is an ultra-fast, ultra-compact key-value embedded data store
diff --git a/pkgs/development/libraries/lmdbxx/default.nix b/pkgs/development/libraries/lmdbxx/default.nix
index 95d8f45eec469..9b1d320678a00 100644
--- a/pkgs/development/libraries/lmdbxx/default.nix
+++ b/pkgs/development/libraries/lmdbxx/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , lmdb }:
 
@@ -19,8 +19,8 @@ stdenv.mkDerivation rec {
   meta = {
     homepage = "https://github.com/drycpp/lmdbxx#readme";
     description = "C++11 wrapper for the LMDB embedded B+ tree database library";
-    license = stdenv.lib.licenses.unlicense;
-    maintainers = with stdenv.lib.maintainers; [ fgaz ];
+    license = lib.licenses.unlicense;
+    maintainers = with lib.maintainers; [ fgaz ];
   };
 }
 
diff --git a/pkgs/development/libraries/log4cplus/default.nix b/pkgs/development/libraries/log4cplus/default.nix
index 097ff0c48c904..1e16ee96ae7f9 100644
--- a/pkgs/development/libraries/log4cplus/default.nix
+++ b/pkgs/development/libraries/log4cplus/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 let
   name = "log4cplus-2.0.5";
@@ -14,7 +14,7 @@ stdenv.mkDerivation {
   meta = {
     homepage = "http://log4cplus.sourceforge.net/";
     description = "A port the log4j library from Java to C++";
-    license = stdenv.lib.licenses.asl20;
-    platforms = stdenv.lib.platforms.unix;
+    license = lib.licenses.asl20;
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/log4cpp/default.nix b/pkgs/development/libraries/log4cpp/default.nix
index d2918c87f3351..d4b703a2bda74 100644
--- a/pkgs/development/libraries/log4cpp/default.nix
+++ b/pkgs/development/libraries/log4cpp/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
   name = "log4cpp-1.1.3";
@@ -10,7 +10,7 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage    = "http://log4cpp.sourceforge.net/";
     description = "A logging framework for C++ patterned after Apache log4j";
     license     = licenses.lgpl21Plus;
diff --git a/pkgs/development/libraries/log4cxx/default.nix b/pkgs/development/libraries/log4cxx/default.nix
index cec0ec9ab287d..aaf7ea5ee9c98 100644
--- a/pkgs/development/libraries/log4cxx/default.nix
+++ b/pkgs/development/libraries/log4cxx/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, libtool, libxml2, cppunit, boost
+{ lib, stdenv, fetchurl, libtool, libxml2, cppunit, boost
 , apr, aprutil, db, expat
 }:
 
@@ -25,7 +25,7 @@ stdenv.mkDerivation rec {
     }' src/examples/cpp/console.cpp \
        src/main/cpp/inputstreamreader.cpp \
        src/main/cpp/socketoutputstream.cpp
-  '' + stdenv.lib.optionalString stdenv.isDarwin ''
+  '' + lib.optionalString stdenv.isDarwin ''
     sed -i 's/namespace std { class locale; }/#include <locale>/' src/main/include/log4cxx/helpers/simpledateformat.h
     sed -i 's/\(#include <cctype>\)/\1\n#include <cstdlib>/' src/main/cpp/stringhelper.cpp
   '';
@@ -36,7 +36,7 @@ stdenv.mkDerivation rec {
   meta = {
     homepage = "https://logging.apache.org/log4cxx/index.html";
     description = "A logging framework for C++ patterned after Apache log4j";
-    license = stdenv.lib.licenses.asl20;
-    platforms = stdenv.lib.platforms.unix;
+    license = lib.licenses.asl20;
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/log4shib/default.nix b/pkgs/development/libraries/log4shib/default.nix
index 17046d17b78af..0602b4c3b5237 100644
--- a/pkgs/development/libraries/log4shib/default.nix
+++ b/pkgs/development/libraries/log4shib/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchgit, autoreconfHook }:
+{ lib, stdenv, fetchgit, autoreconfHook }:
 
 stdenv.mkDerivation {
   pname = "log4shib";
@@ -12,7 +12,7 @@ stdenv.mkDerivation {
 
   nativeBuildInputs = [ autoreconfHook ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A forked version of log4cpp that has been created for the Shibboleth project";
     maintainers = [ maintainers.jammerful ];
     license = licenses.lgpl21;
diff --git a/pkgs/development/libraries/loki/default.nix b/pkgs/development/libraries/loki/default.nix
index 9c7e36113d868..49b850eae65b3 100644
--- a/pkgs/development/libraries/loki/default.nix
+++ b/pkgs/development/libraries/loki/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
   pname = "loki";
@@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A C++ library of designs, containing flexible implementations of common design patterns and idioms";
     homepage = "http://loki-lib.sourceforge.net";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/loudmouth/default.nix b/pkgs/development/libraries/loudmouth/default.nix
index de2f1b7c5c39c..0245417bbf9b9 100644
--- a/pkgs/development/libraries/loudmouth/default.nix
+++ b/pkgs/development/libraries/loudmouth/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, openssl, libidn, glib, pkg-config, zlib }:
+{ lib, stdenv, fetchurl, openssl, libidn, glib, pkg-config, zlib }:
 
 stdenv.mkDerivation rec {
   version = "1.5.3";
@@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ pkg-config ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A lightweight C library for the Jabber protocol";
     platforms = platforms.linux;
     downloadPage = "http://mcabber.com/files/loudmouth/";
diff --git a/pkgs/development/libraries/lrdf/default.nix b/pkgs/development/libraries/lrdf/default.nix
index b37749385ba90..51b2635b89e02 100644
--- a/pkgs/development/libraries/lrdf/default.nix
+++ b/pkgs/development/libraries/lrdf/default.nix
@@ -1,4 +1,4 @@
-{ config, stdenv, fetchFromGitHub, pkg-config, autoreconfHook
+{ config, lib, stdenv, fetchFromGitHub, pkg-config, autoreconfHook
 , librdf_raptor2, ladspaH, openssl, zlib
 , doCheck ? config.doCheckByDefault or false, ladspaPlugins
 }:
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
     sha256 = "00wzkfb8y0aqd519ypz067cq099dpc89w69zw8ln39vl6f9x2pd4";
   };
 
-  postPatch = stdenv.lib.optionalString doCheck ''
+  postPatch = lib.optionalString doCheck ''
     sed -i -e 's:usr/local:${ladspaPlugins}:' examples/{instances,remove}_test.c
   '';
 
@@ -29,8 +29,8 @@ stdenv.mkDerivation rec {
   meta = {
     description = "Lightweight RDF library with special support for LADSPA plugins";
     homepage = "https://sourceforge.net/projects/lrdf/";
-    license = stdenv.lib.licenses.gpl2;
-    maintainers = [ stdenv.lib.maintainers.marcweber ];
-    platforms = stdenv.lib.platforms.linux;
+    license = lib.licenses.gpl2;
+    maintainers = [ lib.maintainers.marcweber ];
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/development/libraries/luabind/default.nix b/pkgs/development/libraries/luabind/default.nix
index eded6b6527fea..d7aed656fdb9c 100644
--- a/pkgs/development/libraries/luabind/default.nix
+++ b/pkgs/development/libraries/luabind/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, boost-build, lua, boost}:
+{lib, stdenv, fetchurl, boost-build, lua, boost}:
 
 stdenv.mkDerivation {
   name = "luabind-0.9.1";
@@ -25,7 +25,7 @@ stdenv.mkDerivation {
   meta = {
     homepage = "https://github.com/luabind/luabind";
     description = "A library that helps you create bindings between C++ and Lua";
-    license = stdenv.lib.licenses.mit;
-    platforms = stdenv.lib.platforms.linux;
+    license = lib.licenses.mit;
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/development/libraries/lucene++/default.nix b/pkgs/development/libraries/lucene++/default.nix
index 0dcd53a0772bc..2761329ea23ca 100644
--- a/pkgs/development/libraries/lucene++/default.nix
+++ b/pkgs/development/libraries/lucene++/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, cmake, boost, gtest }:
+{ lib, stdenv, fetchurl, cmake, boost, gtest }:
 
 stdenv.mkDerivation rec {
   pname = "lucene++";
@@ -26,7 +26,7 @@ stdenv.mkDerivation rec {
   meta = {
     description = "C++ port of the popular Java Lucene search engine";
     homepage = "https://github.com/luceneplusplus/LucenePlusPlus";
-    license = with stdenv.lib.licenses; [ asl20 lgpl3Plus ];
-    platforms = stdenv.lib.platforms.linux;
+    license = with lib.licenses; [ asl20 lgpl3Plus ];
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/development/libraries/lyra/default.nix b/pkgs/development/libraries/lyra/default.nix
index 8d5d083d82b02..9f5fd1d3a342f 100644
--- a/pkgs/development/libraries/lyra/default.nix
+++ b/pkgs/development/libraries/lyra/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, installShellFiles, meson, ninja }:
+{ lib, stdenv, fetchFromGitHub, installShellFiles, meson, ninja }:
 
 stdenv.mkDerivation rec {
   pname = "lyra";
@@ -22,7 +22,7 @@ stdenv.mkDerivation rec {
     cp -R $src/include/* $out/include
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/bfgroup/Lyra";
     description = "A simple to use, composable, command line parser for C++ 11 and beyond";
     platforms = platforms.linux;
diff --git a/pkgs/development/libraries/lzo/default.nix b/pkgs/development/libraries/lzo/default.nix
index 446f914641459..8ea933f0e3ab9 100644
--- a/pkgs/development/libraries/lzo/default.nix
+++ b/pkgs/development/libraries/lzo/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl}:
+{lib, stdenv, fetchurl}:
 
 stdenv.mkDerivation rec {
   name = "lzo-2.10";
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
 
   doCheck = true; # not cross;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Real-time data (de)compression library";
     longDescription = ''
       LZO is a portable lossless data compression library written in ANSI C.
diff --git a/pkgs/development/libraries/mac/default.nix b/pkgs/development/libraries/mac/default.nix
index a896b9261d524..7445d283c6f43 100644
--- a/pkgs/development/libraries/mac/default.nix
+++ b/pkgs/development/libraries/mac/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, fetchpatch, yasm }:
+{ lib, stdenv, fetchurl, fetchpatch, yasm }:
 
 stdenv.mkDerivation rec {
   pname = "mac";
@@ -26,7 +26,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ yasm ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "APE codec and decompressor";
     homepage = "http://www.deb-multimedia.org/dists/testing/main/binary-amd64/package/monkeys-audio.php";
     license = licenses.unfreeRedistributable;
diff --git a/pkgs/development/libraries/malcontent/default.nix b/pkgs/development/libraries/malcontent/default.nix
index 49ffade854604..641f3b87c3fe2 100644
--- a/pkgs/development/libraries/malcontent/default.nix
+++ b/pkgs/development/libraries/malcontent/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitLab
 , fetchpatch
 , meson
@@ -90,7 +90,7 @@ stdenv.mkDerivation rec {
     };
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     # We need to install Polkit & AccountsService data files in `out`
     # but `buildEnv` only uses `bin` when both `bin` and `out` are present.
     outputsToInstall = [ "bin" "out" "man" ];
diff --git a/pkgs/development/libraries/malcontent/ui.nix b/pkgs/development/libraries/malcontent/ui.nix
index 54382cfc0d57e..e306267154ae2 100644
--- a/pkgs/development/libraries/malcontent/ui.nix
+++ b/pkgs/development/libraries/malcontent/ui.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , meson
 , ninja
 , pkg-config
@@ -64,7 +64,7 @@ stdenv.mkDerivation rec {
     "-Dui=enabled"
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "UI components for parental controls library";
     homepage = "https://gitlab.freedesktop.org/pwithnall/malcontent";
     license = licenses.lgpl21Plus;
diff --git a/pkgs/development/libraries/mapnik/default.nix b/pkgs/development/libraries/mapnik/default.nix
index cf0539fe266fc..40ef1fde563a3 100644
--- a/pkgs/development/libraries/mapnik/default.nix
+++ b/pkgs/development/libraries/mapnik/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchzip
+{ lib, stdenv, fetchzip
 , boost, cairo, freetype, gdal, harfbuzz, icu, libjpeg, libpng, libtiff
 , libwebp, libxml2, proj, python, sqlite, zlib
 
@@ -63,7 +63,7 @@ stdenv.mkDerivation rec {
     "XML2_LIBS=${libxml2.out}/lib"
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "An open source toolkit for developing mapping applications";
     homepage = "https://mapnik.org";
     maintainers = with maintainers; [ hrdinka ];
diff --git a/pkgs/development/libraries/marisa/default.nix b/pkgs/development/libraries/marisa/default.nix
index 99d82970fe06b..4a3f8be041724 100644
--- a/pkgs/development/libraries/marisa/default.nix
+++ b/pkgs/development/libraries/marisa/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, autoreconfHook }:
+{ lib, stdenv, fetchFromGitHub, autoreconfHook }:
 
 stdenv.mkDerivation rec {
   pname = "marisa";
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ autoreconfHook ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage    = "https://github.com/s-yata/marisa-trie";
     description = "Static and space-efficient trie data structure library";
     license     = licenses.bsd3;
diff --git a/pkgs/development/libraries/marl/default.nix b/pkgs/development/libraries/marl/default.nix
index 2bf23962d53ed..4545264aad9e1 100644
--- a/pkgs/development/libraries/marl/default.nix
+++ b/pkgs/development/libraries/marl/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, cmake, fetchFromGitHub }:
+{ lib, stdenv, cmake, fetchFromGitHub }:
 
 stdenv.mkDerivation rec {
   pname = "marl";
@@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
   # Turn on the flag to install after building the library.
   cmakeFlags = ["-DMARL_INSTALL=ON"];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/google/marl";
     description = "A hybrid thread / fiber task scheduler written in C++ 11";
     platforms = platforms.all;
diff --git a/pkgs/development/libraries/martyr/default.nix b/pkgs/development/libraries/martyr/default.nix
index 46f95148d8223..609033e22eadb 100644
--- a/pkgs/development/libraries/martyr/default.nix
+++ b/pkgs/development/libraries/martyr/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, ant, jdk}:
+{lib, stdenv, fetchurl, ant, jdk}:
 
 stdenv.mkDerivation rec {
   pname = "martyr";
@@ -20,6 +20,6 @@ stdenv.mkDerivation rec {
   meta = {
     description = "Java framework around the IRC protocol to allow application writers easy manipulation of the protocol and client state";
     homepage = "http://martyr.sourceforge.net/";
-    license = stdenv.lib.licenses.lgpl21;
+    license = lib.licenses.lgpl21;
   };
 }
diff --git a/pkgs/development/libraries/matio/default.nix b/pkgs/development/libraries/matio/default.nix
index bc629dc250642..b6330f69e302a 100644
--- a/pkgs/development/libraries/matio/default.nix
+++ b/pkgs/development/libraries/matio/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 stdenv.mkDerivation rec {
   name = "matio-1.5.19";
   src = fetchurl {
@@ -6,7 +6,7 @@ stdenv.mkDerivation rec {
     sha256 = "0vr8c1mz1k6mz0sgh6n3scl5c3a71iqmy5fnydrgq504icj4vym4";
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A C library for reading and writing Matlab MAT files";
     license = licenses.bsd2;
     platforms = platforms.all;
diff --git a/pkgs/development/libraries/mbedtls/default.nix b/pkgs/development/libraries/mbedtls/default.nix
index f24232ac7aec4..e3e0d2ecd78d6 100644
--- a/pkgs/development/libraries/mbedtls/default.nix
+++ b/pkgs/development/libraries/mbedtls/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 
 , cmake
@@ -23,14 +23,14 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ cmake ninja perl python ];
 
-  postConfigure = stdenv.lib.optionals enableThreading ''
+  postConfigure = lib.optionals enableThreading ''
     perl scripts/config.pl set MBEDTLS_THREADING_C    # Threading abstraction layer
     perl scripts/config.pl set MBEDTLS_THREADING_PTHREAD    # POSIX thread wrapper layer for the threading layer.
   '';
 
   cmakeFlags = [ "-DUSE_SHARED_MBEDTLS_LIBRARY=on" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://tls.mbed.org/";
     description = "Portable cryptographic and TLS library, formerly known as PolarSSL";
     license = licenses.asl20;
diff --git a/pkgs/development/libraries/mdds/default.nix b/pkgs/development/libraries/mdds/default.nix
index b69e99de414da..0fc7496329949 100644
--- a/pkgs/development/libraries/mdds/default.nix
+++ b/pkgs/development/libraries/mdds/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, boost, llvmPackages }:
+{ lib, stdenv, fetchurl, boost, llvmPackages }:
 
 stdenv.mkDerivation rec {
   pname = "mdds";
@@ -14,11 +14,11 @@ stdenv.mkDerivation rec {
     cp "$out/share/pkgconfig/"* "$out/lib/pkgconfig"
   '';
 
-  buildInputs = stdenv.lib.optionals stdenv.cc.isClang [ llvmPackages.openmp ];
+  buildInputs = lib.optionals stdenv.cc.isClang [ llvmPackages.openmp ];
 
   checkInputs = [ boost ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     inherit version;
     homepage = "https://gitlab.com/mdds/mdds";
     description = "A collection of multi-dimensional data structure and indexing algorithm";
diff --git a/pkgs/development/libraries/medfile/default.nix b/pkgs/development/libraries/medfile/default.nix
index 4821b9865b201..a89cb43d26112 100644
--- a/pkgs/development/libraries/medfile/default.nix
+++ b/pkgs/development/libraries/medfile/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, cmake, hdf5 }:
+{ lib, stdenv, fetchurl, cmake, hdf5 }:
 
 stdenv.mkDerivation rec {
   pname = "medfile";
@@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
 
   postInstall = "rm -r $out/bin/testc";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Library to read and write MED files";
     homepage = "http://salome-platform.org/";
     platforms = platforms.linux;
diff --git a/pkgs/development/libraries/mediastreamer/default.nix b/pkgs/development/libraries/mediastreamer/default.nix
index a4d4f408f90a8..3cda9ff3006dc 100644
--- a/pkgs/development/libraries/mediastreamer/default.nix
+++ b/pkgs/development/libraries/mediastreamer/default.nix
@@ -28,7 +28,7 @@
 , SDL
 , speex
 , srtp
-, stdenv
+, lib, stdenv
 }:
 
 stdenv.mkDerivation rec {
@@ -99,7 +99,7 @@ stdenv.mkDerivation rec {
   ];
   NIX_LDFLAGS = "-lXext";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A powerful and lightweight streaming engine specialized for voice/video telephony applications";
     homepage = "http://www.linphone.org/technical-corner/mediastreamer2";
     license = licenses.gpl3;
diff --git a/pkgs/development/libraries/mediastreamer/msopenh264.nix b/pkgs/development/libraries/mediastreamer/msopenh264.nix
index 527c395963f1c..08842889f8651 100644
--- a/pkgs/development/libraries/mediastreamer/msopenh264.nix
+++ b/pkgs/development/libraries/mediastreamer/msopenh264.nix
@@ -5,7 +5,7 @@
 , mediastreamer
 , openh264
 , pkg-config
-, stdenv
+, lib, stdenv
 }:
 
 stdenv.mkDerivation rec {
@@ -39,7 +39,7 @@ stdenv.mkDerivation rec {
     cp src/libmsopenh264.so $out/lib/mediastreamer/plugins/
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "H.264 encoder/decoder plugin for mediastreamer2";
     homepage = "https://www.linphone.org/technical-corner/mediastreamer2";
     license = licenses.gpl2;
diff --git a/pkgs/development/libraries/menu-cache/default.nix b/pkgs/development/libraries/menu-cache/default.nix
index 36e3c8c67004f..b2f06b9e627b7 100644
--- a/pkgs/development/libraries/menu-cache/default.nix
+++ b/pkgs/development/libraries/menu-cache/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, glib, pkg-config, libfm-extra }:
+{ lib, stdenv, fetchurl, glib, pkg-config, libfm-extra }:
 
 let name = "menu-cache-1.1.0";
 in
@@ -13,7 +13,7 @@ stdenv.mkDerivation {
 
   buildInputs = [ glib libfm-extra ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Library to read freedesktop.org menu files";
     homepage = "https://blog.lxde.org/tag/menu-cache/";
     license = licenses.gpl2Plus;
diff --git a/pkgs/development/libraries/mesa-glu/default.nix b/pkgs/development/libraries/mesa-glu/default.nix
index 1f42828907afd..85950daea68ab 100644
--- a/pkgs/development/libraries/mesa-glu/default.nix
+++ b/pkgs/development/libraries/mesa-glu/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, libGL, ApplicationServices }:
+{ lib, stdenv, fetchurl, pkg-config, libGL, ApplicationServices }:
 
 stdenv.mkDerivation rec {
   pname = "glu";
@@ -11,15 +11,15 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ pkg-config ];
   propagatedBuildInputs = [ libGL ]
-    ++ stdenv.lib.optional stdenv.isDarwin ApplicationServices;
+    ++ lib.optional stdenv.isDarwin ApplicationServices;
 
   outputs = [ "out" "dev" ];
 
   meta = {
     description = "OpenGL utility library";
     homepage = "https://cgit.freedesktop.org/mesa/glu/";
-    license = stdenv.lib.licenses.sgi-b-20;
-    platforms = stdenv.lib.platforms.unix;
+    license = lib.licenses.sgi-b-20;
+    platforms = lib.platforms.unix;
     broken = stdenv.hostPlatform.isAndroid;
   };
 }
diff --git a/pkgs/development/libraries/mesa/default.nix b/pkgs/development/libraries/mesa/default.nix
index 217aff58966a8..44dddac7d32cf 100644
--- a/pkgs/development/libraries/mesa/default.nix
+++ b/pkgs/development/libraries/mesa/default.nix
@@ -26,7 +26,7 @@
   - libOSMesa is in $osmesa (~4 MB)
 */
 
-with stdenv.lib;
+with lib;
 
 let
   # Release calendar: https://www.mesa3d.org/release-calendar.html
@@ -207,7 +207,7 @@ stdenv.mkDerivation {
     done
   '';
 
-  NIX_CFLAGS_COMPILE = stdenv.lib.optionalString stdenv.isDarwin "-fno-common";
+  NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isDarwin "-fno-common";
 
   passthru = {
     inherit libdrm;
diff --git a/pkgs/development/libraries/metal/default.nix b/pkgs/development/libraries/metal/default.nix
index 090fd46640e69..18b1f116b876d 100644
--- a/pkgs/development/libraries/metal/default.nix
+++ b/pkgs/development/libraries/metal/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake }:
+{ lib, stdenv, fetchFromGitHub, cmake }:
 stdenv.mkDerivation rec {
   pname = "metal";
   version = "2.1.1";
@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ cmake ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Single-header C++11 library designed to make you love template metaprogramming";
     homepage = "https://github.com/brunocodutra/metal";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/microsoft_gsl/default.nix b/pkgs/development/libraries/microsoft_gsl/default.nix
index a0356497818ac..af1c1c91a94f9 100644
--- a/pkgs/development/libraries/microsoft_gsl/default.nix
+++ b/pkgs/development/libraries/microsoft_gsl/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, catch, cmake
+{ lib, stdenv, fetchFromGitHub, catch, cmake
 }:
 
 let
@@ -28,7 +28,7 @@ stdenv.mkDerivation rec {
     mv ../include/ $out/
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "C++ Core Guideline support library";
     longDescription = ''
      The Guideline Support Library (GSL) contains functions and types that are suggested for
diff --git a/pkgs/development/libraries/mimalloc/default.nix b/pkgs/development/libraries/mimalloc/default.nix
index fcc44062b5175..2ac2087054fe8 100644
--- a/pkgs/development/libraries/mimalloc/default.nix
+++ b/pkgs/development/libraries/mimalloc/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, ninja
+{ lib, stdenv, fetchFromGitHub, cmake, ninja
 , secureBuild ? false
 }:
 
@@ -17,10 +17,10 @@ stdenv.mkDerivation rec {
   };
 
   nativeBuildInputs = [ cmake ninja ];
-  cmakeFlags = stdenv.lib.optional secureBuild [ "-DMI_SECURE=ON" ];
+  cmakeFlags = lib.optional secureBuild [ "-DMI_SECURE=ON" ];
 
   postInstall = let
-    rel = stdenv.lib.versions.majorMinor version;
+    rel = lib.versions.majorMinor version;
   in ''
     # first, install headers, that's easy
     mkdir -p $dev
@@ -46,7 +46,7 @@ stdenv.mkDerivation rec {
 
   outputs = [ "out" "dev" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Compact, fast, general-purpose memory allocator";
     homepage    = "https://github.com/microsoft/mimalloc";
     license     = licenses.bsd2;
diff --git a/pkgs/development/libraries/mimetic/default.nix b/pkgs/development/libraries/mimetic/default.nix
index 0147a2973053c..1638caa0d1f8b 100644
--- a/pkgs/development/libraries/mimetic/default.nix
+++ b/pkgs/development/libraries/mimetic/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, cutee }:
+{ lib, stdenv, fetchurl, cutee }:
 
 stdenv.mkDerivation rec {
   pname = "mimetic";
@@ -11,9 +11,9 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ cutee ];
 
-  patches = stdenv.lib.optional stdenv.isAarch64 ./narrowing.patch;
+  patches = lib.optional stdenv.isAarch64 ./narrowing.patch;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "MIME handling library";
     homepage    = "http://www.codesink.org/mimetic_mime_library.html";
     license     = licenses.mit;
diff --git a/pkgs/development/libraries/miniball/default.nix b/pkgs/development/libraries/miniball/default.nix
index d1804b9bf95fc..e48857861d68a 100644
--- a/pkgs/development/libraries/miniball/default.nix
+++ b/pkgs/development/libraries/miniball/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation {
   pname = "miniball";
@@ -19,8 +19,8 @@ stdenv.mkDerivation {
   meta = {
     description = "Smallest Enclosing Balls of Points";
     homepage = "https://www.inf.ethz.ch/personal/gaertner/miniball.html";
-    license = stdenv.lib.licenses.gpl3;
-    maintainers = [ stdenv.lib.maintainers.erikryb ];
-    platforms = stdenv.lib.platforms.unix;
+    license = lib.licenses.gpl3;
+    maintainers = [ lib.maintainers.erikryb ];
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/minixml/default.nix b/pkgs/development/libraries/minixml/default.nix
index 8938ab90fbc11..93c03b31a8a7c 100644
--- a/pkgs/development/libraries/minixml/default.nix
+++ b/pkgs/development/libraries/minixml/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub }:
+{ lib, stdenv, fetchFromGitHub }:
 
 stdenv.mkDerivation rec {
   pname = "mxml";
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A small XML library";
     homepage = "https://www.msweet.org/mxml/";
     license = licenses.asl20;
diff --git a/pkgs/development/libraries/minizip/default.nix b/pkgs/development/libraries/minizip/default.nix
index 5ee1f38ca8b5e..bb62a9b3b2ba4 100644
--- a/pkgs/development/libraries/minizip/default.nix
+++ b/pkgs/development/libraries/minizip/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, zlib, autoreconfHook }:
+{ lib, stdenv, zlib, autoreconfHook }:
 
 stdenv.mkDerivation {
   name = "minizip-${zlib.version}";
@@ -12,6 +12,6 @@ stdenv.mkDerivation {
   meta = {
     description = "Compression library implementing the deflate compression method found in gzip and PKZIP";
     inherit (zlib.meta) license homepage;
-    platforms = stdenv.lib.platforms.unix;
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/minizip2/default.nix b/pkgs/development/libraries/minizip2/default.nix
index 6c6d8b3ef86c4..16bb2b8d44e6a 100644
--- a/pkgs/development/libraries/minizip2/default.nix
+++ b/pkgs/development/libraries/minizip2/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, pkg-config, zlib, bzip2, xz, zstd, openssl }:
+{ lib, stdenv, fetchFromGitHub, cmake, pkg-config, zlib, bzip2, xz, zstd, openssl }:
 
 stdenv.mkDerivation rec {
   pname = "minizip";
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ zlib bzip2 xz zstd openssl ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Compression library implementing the deflate compression method found in gzip and PKZIP";
     homepage = "https://github.com/nmoinvaz/minizip";
     license = licenses.zlib;
diff --git a/pkgs/development/libraries/mlt/default.nix b/pkgs/development/libraries/mlt/default.nix
index 7423c0e5c7720..633a7325b098d 100644
--- a/pkgs/development/libraries/mlt/default.nix
+++ b/pkgs/development/libraries/mlt/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, makeWrapper
+{ lib, stdenv, fetchFromGitHub, makeWrapper
 , SDL, ffmpeg, frei0r, libjack2, libdv, libsamplerate, libexif
 , libvorbis, libxml2, movit, pkg-config, sox, fftw, opencv4, SDL2
 , gtk2, genericUpdater, common-updater-scripts, libebur128
@@ -44,7 +44,7 @@ stdenv.mkDerivation rec {
     rev-prefix = "v";
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Open source multimedia framework, designed for television broadcasting";
     homepage = "https://www.mltframework.org";
     license = licenses.gpl3;
diff --git a/pkgs/development/libraries/mlt/qt-5.nix b/pkgs/development/libraries/mlt/qt-5.nix
index 599209fa57d51..7004a5e11c043 100644
--- a/pkgs/development/libraries/mlt/qt-5.nix
+++ b/pkgs/development/libraries/mlt/qt-5.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , SDL
 , ffmpeg
@@ -23,7 +23,7 @@
 , mkDerivation
 , which
 }:
-let inherit (stdenv.lib) getDev; in
+let inherit (lib) getDev; in
 mkDerivation rec {
   pname = "mlt";
   version = "6.22.1";
@@ -102,7 +102,7 @@ mkDerivation rec {
     rev-prefix = "v";
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Open source multimedia framework, designed for television broadcasting";
     homepage = "https://www.mltframework.org/";
     license = licenses.gpl3;
diff --git a/pkgs/development/libraries/mm-common/default.nix b/pkgs/development/libraries/mm-common/default.nix
index 3981e05ef0673..a43d99503a3fe 100644
--- a/pkgs/development/libraries/mm-common/default.nix
+++ b/pkgs/development/libraries/mm-common/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , gnome3
 , meson
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
   version = "1.0.2";
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "07b4s5ckcz9q5gwx8vchim19mhfgl8wysqwi30pndks3m4zrzad2";
   };
 
@@ -28,7 +28,7 @@ stdenv.mkDerivation rec {
     };
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Common build files of GLib/GTK C++ bindings";
     longDescription = ''
       The mm-common module provides the build infrastructure and utilities
diff --git a/pkgs/development/libraries/mongoc/default.nix b/pkgs/development/libraries/mongoc/default.nix
index 523de7cc6bf2c..e9779cf0a054f 100644
--- a/pkgs/development/libraries/mongoc/default.nix
+++ b/pkgs/development/libraries/mongoc/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchzip, perl, pkg-config, libbson
+{ lib, stdenv, fetchzip, perl, pkg-config, libbson
 , openssl, which, zlib, snappy
 }:
 
@@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "The official C client library for MongoDB";
     homepage = "https://github.com/mongodb/mongo-c-driver";
     license = licenses.asl20;
diff --git a/pkgs/development/libraries/mono-addins/default.nix b/pkgs/development/libraries/mono-addins/default.nix
index 672d29e20f44b..158b39a8186a9 100644
--- a/pkgs/development/libraries/mono-addins/default.nix
+++ b/pkgs/development/libraries/mono-addins/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, autoreconfHook, pkg-config, mono4, gtk-sharp-2_0 }:
+{ lib, stdenv, fetchFromGitHub, autoreconfHook, pkg-config, mono4, gtk-sharp-2_0 }:
 
 stdenv.mkDerivation rec {
   pname = "mono-addins";
@@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
 
   dontStrip = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://www.mono-project.com/archived/monoaddins/";
     description = "A generic framework for creating extensible applications";
     longDescription = ''
diff --git a/pkgs/development/libraries/motif/default.nix b/pkgs/development/libraries/motif/default.nix
index 144f11355e1d5..0499aaec532d0 100644
--- a/pkgs/development/libraries/motif/default.nix
+++ b/pkgs/development/libraries/motif/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, libtool
+{ lib, stdenv, fetchurl, pkg-config, libtool
 , xlibsWrapper, xbitmaps, libXrender, libXmu, libXt
 , expat, libjpeg, libpng, libiconv
 , flex
@@ -32,7 +32,7 @@ stdenv.mkDerivation rec {
 
   prePatch = ''
     rm lib/Xm/Xm.h
-  '' + stdenv.lib.optionalString (!demoSupport) ''
+  '' + lib.optionalString (!demoSupport) ''
     sed '/^SUBDIRS =,^$/s/\<demos\>//' -i Makefile.{am,in}
   '';
 
@@ -41,7 +41,7 @@ stdenv.mkDerivation rec {
               ./Add-X.Org-to-bindings-file.patch
             ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://motif.ics.com";
     description = "Unix standard widget-toolkit and window-manager";
     platforms = with platforms; linux ++ darwin;
diff --git a/pkgs/development/libraries/movit/default.nix b/pkgs/development/libraries/movit/default.nix
index 3201de460ff34..9c03a9f6c4913 100644
--- a/pkgs/development/libraries/movit/default.nix
+++ b/pkgs/development/libraries/movit/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, SDL2, eigen, epoxy, fftw, gtest, pkg-config }:
+{ lib, stdenv, fetchurl, SDL2, eigen, epoxy, fftw, gtest, pkg-config }:
 
 stdenv.mkDerivation rec {
   pname = "movit";
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "High-performance, high-quality video filters for the GPU";
     homepage = "https://movit.sesse.net";
     license = licenses.gpl2Plus;
diff --git a/pkgs/development/libraries/mp4v2/default.nix b/pkgs/development/libraries/mp4v2/default.nix
index 3b8efadcfd195..7a6bbb552027d 100644
--- a/pkgs/development/libraries/mp4v2/default.nix
+++ b/pkgs/development/libraries/mp4v2/default.nix
@@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
       url = "https://git.archlinux.org/svntogit/packages.git/plain/trunk/libmp4v2-c++11.patch?id=203f5a72bc97ffe089b424c47b07dd9eaea35713";
       sha256 = "0sbn0il7lmk77yrjyb4f0a3z3h8gsmdkscvz5n9hmrrrhrwf672w";
     })
-  ] ++ stdenv.lib.optionals stdenv.cc.isClang [
+  ] ++ lib.optionals stdenv.cc.isClang [
     # unbreak build with Clang≥6 (C++14 by default). Based on https://reviews.freebsd.org/rP458678
     ./fix-build-clang.patch
   ];
diff --git a/pkgs/development/libraries/mpfi/default.nix b/pkgs/development/libraries/mpfi/default.nix
index 88617e9a74091..5a43fb107ad36 100644
--- a/pkgs/development/libraries/mpfi/default.nix
+++ b/pkgs/development/libraries/mpfi/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, mpfr}:
+{lib, stdenv, fetchurl, mpfr}:
 stdenv.mkDerivation rec {
   pname = "mpfi";
   version = "1.5.3";
@@ -15,8 +15,8 @@ stdenv.mkDerivation rec {
     inherit version;
     description = ''A multiple precision interval arithmetic library based on MPFR'';
     homepage = "https://gforge.inria.fr/projects/mpfi/";
-    license = stdenv.lib.licenses.lgpl21Plus;
-    maintainers = [stdenv.lib.maintainers.raskin];
-    platforms = stdenv.lib.platforms.unix;
+    license = lib.licenses.lgpl21Plus;
+    maintainers = [lib.maintainers.raskin];
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/mpfr/default.nix b/pkgs/development/libraries/mpfr/default.nix
index 4a744b7483ea0..fc7eeeab94206 100644
--- a/pkgs/development/libraries/mpfr/default.nix
+++ b/pkgs/development/libraries/mpfr/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, gmp }:
+{ lib, stdenv, fetchurl, gmp }:
 
 # Note: this package is used for bootstrapping fetchurl, and thus
 # cannot use fetchpatch! All mutable patches (generated by GitHub or
@@ -23,8 +23,8 @@ stdenv.mkDerivation rec {
   propagatedBuildInputs = [ gmp ];
 
   configureFlags =
-    stdenv.lib.optional stdenv.hostPlatform.isSunOS "--disable-thread-safe" ++
-    stdenv.lib.optional stdenv.hostPlatform.is64bit "--with-pic";
+    lib.optional stdenv.hostPlatform.isSunOS "--disable-thread-safe" ++
+    lib.optional stdenv.hostPlatform.is64bit "--with-pic";
 
   doCheck = true; # not cross;
 
@@ -46,9 +46,9 @@ stdenv.mkDerivation rec {
       floating-point arithmetic (53-bit mantissa).
     '';
 
-    license = stdenv.lib.licenses.lgpl2Plus;
+    license = lib.licenses.lgpl2Plus;
 
     maintainers = [ ];
-    platforms = stdenv.lib.platforms.all;
+    platforms = lib.platforms.all;
   };
 }
diff --git a/pkgs/development/libraries/mpich/default.nix b/pkgs/development/libraries/mpich/default.nix
index 0c1ea8be1c83c..f7cdf7f97c028 100644
--- a/pkgs/development/libraries/mpich/default.nix
+++ b/pkgs/development/libraries/mpich/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, perl, gfortran
+{ lib, stdenv, fetchurl, perl, gfortran
 ,  openssh, hwloc
 } :
 
@@ -28,7 +28,7 @@ stdenv.mkDerivation  rec {
     sed -i 's:CXX="g++":CXX=${stdenv.cc}/bin/g++:' $out/bin/mpicxx
     sed -i 's:FC="gfortran":FC=${gfortran}/bin/gfortran:' $out/bin/mpifort
   ''
-  + stdenv.lib.optionalString (!stdenv.isDarwin) ''
+  + lib.optionalString (!stdenv.isDarwin) ''
     # /tmp/nix-build... ends up in the RPATH, fix it manually
     for entry in $out/bin/mpichversion $out/bin/mpivars; do
       echo "fix rpath: $entry"
@@ -36,7 +36,7 @@ stdenv.mkDerivation  rec {
     done
     '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Implementation of the Message Passing Interface (MPI) standard";
 
     longDescription = ''
diff --git a/pkgs/development/libraries/mpir/default.nix b/pkgs/development/libraries/mpir/default.nix
index 8da59530ea5ae..7f1374df28094 100644
--- a/pkgs/development/libraries/mpir/default.nix
+++ b/pkgs/development/libraries/mpir/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, m4, which, yasm }:
+{ lib, stdenv, fetchurl, m4, which, yasm }:
 
 stdenv.mkDerivation rec {
   pname = "mpir";
@@ -16,9 +16,9 @@ stdenv.mkDerivation rec {
   meta = {
     inherit version;
     description = ''A highly optimised library for bignum arithmetic forked from GMP'';
-    license = stdenv.lib.licenses.lgpl3Plus;
-    maintainers = [stdenv.lib.maintainers.raskin];
-    platforms = stdenv.lib.platforms.unix;
+    license = lib.licenses.lgpl3Plus;
+    maintainers = [lib.maintainers.raskin];
+    platforms = lib.platforms.unix;
     downloadPage = "http://mpir.org/downloads.html";
     homepage = "http://mpir.org/";
     updateWalker = true;
diff --git a/pkgs/development/libraries/mps/default.nix b/pkgs/development/libraries/mps/default.nix
index 8c1f3aea46679..81b102d9bc362 100644
--- a/pkgs/development/libraries/mps/default.nix
+++ b/pkgs/development/libraries/mps/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, autoreconfHook, sqlite }:
+{ lib, stdenv, fetchurl, autoreconfHook, sqlite }:
 
 stdenv.mkDerivation rec {
   pname = "mps";
@@ -23,8 +23,8 @@ stdenv.mkDerivation rec {
   meta = {
     description = "A flexible memory management and garbage collection library";
     homepage    = "https://www.ravenbrook.com/project/mps";
-    license     = stdenv.lib.licenses.sleepycat;
-    platforms   = stdenv.lib.platforms.linux;
-    maintainers = [ stdenv.lib.maintainers.thoughtpolice ];
+    license     = lib.licenses.sleepycat;
+    platforms   = lib.platforms.linux;
+    maintainers = [ lib.maintainers.thoughtpolice ];
   };
 }
diff --git a/pkgs/development/libraries/msgpack/generic.nix b/pkgs/development/libraries/msgpack/generic.nix
index d7d79de8b2b62..a784bc0263613 100644
--- a/pkgs/development/libraries/msgpack/generic.nix
+++ b/pkgs/development/libraries/msgpack/generic.nix
@@ -1,4 +1,4 @@
-{ stdenv, cmake
+{ lib, stdenv, cmake
 , version, src, patches ? [ ]
 , ...
 }:
@@ -11,9 +11,9 @@ stdenv.mkDerivation {
 
   nativeBuildInputs = [ cmake ];
 
-  cmakeFlags = stdenv.lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) "-DMSGPACK_BUILD_EXAMPLES=OFF";
+  cmakeFlags = lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) "-DMSGPACK_BUILD_EXAMPLES=OFF";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "MessagePack implementation for C and C++";
     homepage    = "https://msgpack.org";
     license     = licenses.asl20;
diff --git a/pkgs/development/libraries/msgpuck/default.nix b/pkgs/development/libraries/msgpuck/default.nix
index 0411a8bf6237f..e65b7453dc3e6 100644
--- a/pkgs/development/libraries/msgpuck/default.nix
+++ b/pkgs/development/libraries/msgpuck/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, pkg-config }:
+{ lib, stdenv, fetchFromGitHub, cmake, pkg-config }:
 
 stdenv.mkDerivation rec {
   pname = "msgpuck";
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ cmake pkg-config ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
      description = ''A simple and efficient MsgPack binary serialization library in a self-contained header file'';
      homepage = "https://github.com/rtsisyk/msgpuck";
      license = licenses.bsd2;
diff --git a/pkgs/development/libraries/msilbc/default.nix b/pkgs/development/libraries/msilbc/default.nix
index c388a291cc522..cdcc0548abbc4 100644
--- a/pkgs/development/libraries/msilbc/default.nix
+++ b/pkgs/development/libraries/msilbc/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, ilbc, mediastreamer, pkg-config }:
+{ lib, stdenv, fetchurl, ilbc, mediastreamer, pkg-config }:
 
 stdenv.mkDerivation rec {
   name = "msilbc-2.1.2";
@@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
     "MEDIASTREAMER_LIBS=mediastreamer" "MEDIASTREAMER_CFLAGS=-I${mediastreamer}/include"
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Mediastreamer plugin for the iLBC audio codec";
     platforms = platforms.linux;
     license = licenses.gpl2;
diff --git a/pkgs/development/libraries/mtdev/default.nix b/pkgs/development/libraries/mtdev/default.nix
index 5c04c6a694288..7873608e58913 100644
--- a/pkgs/development/libraries/mtdev/default.nix
+++ b/pkgs/development/libraries/mtdev/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
   name = "mtdev-1.1.6";
@@ -8,7 +8,7 @@ stdenv.mkDerivation rec {
     sha256 = "1q700h9dqcm3zl6c3gj0qxxjcx6ibw2c51wjijydhwdcm26v5mqm";
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://bitmath.org/code/mtdev/";
     description = "Multitouch Protocol Translation Library";
     longDescription = ''
diff --git a/pkgs/development/libraries/mtxclient/default.nix b/pkgs/development/libraries/mtxclient/default.nix
index 72f8477c8726c..38c95a5a19f85 100644
--- a/pkgs/development/libraries/mtxclient/default.nix
+++ b/pkgs/development/libraries/mtxclient/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , fetchpatch
 , cmake
@@ -47,7 +47,7 @@ stdenv.mkDerivation rec {
     olm
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Client API library for Matrix, built on top of Boost.Asio";
     homepage = "https://github.com/Nheko-Reborn/mtxclient";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/multipart-parser-c/default.nix b/pkgs/development/libraries/multipart-parser-c/default.nix
index b2bdf5d04476b..45b0abdee71b9 100644
--- a/pkgs/development/libraries/multipart-parser-c/default.nix
+++ b/pkgs/development/libraries/multipart-parser-c/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 }:
 
@@ -28,7 +28,7 @@ stdenv.mkDerivation rec {
   meta = {
     description = "Http multipart parser implemented in C ";
     homepage = "https://github.com/iafonov/multipart-parser-c";
-    license = [ stdenv.lib.licenses.mit ];
+    license = [ lib.licenses.mit ];
   };
 
 }
diff --git a/pkgs/development/libraries/muparser/default.nix b/pkgs/development/libraries/muparser/default.nix
index 8aac20e19d0fd..b1951bdb22671 100644
--- a/pkgs/development/libraries/muparser/default.nix
+++ b/pkgs/development/libraries/muparser/default.nix
@@ -1,9 +1,9 @@
-{stdenv, fetchurl, unzip, setfile}:
+{lib, stdenv, fetchurl, unzip, setfile}:
 
 stdenv.mkDerivation rec {
   pname = "muparser";
   version = "2.2.3";
-  url-version = stdenv.lib.replaceChars ["."] ["_"] version;
+  url-version = lib.replaceChars ["."] ["_"] version;
 
   src = fetchurl {
     url = "mirror://sourceforge/muparser/muparser_v${url-version}.zip";
@@ -12,12 +12,12 @@ stdenv.mkDerivation rec {
 
   buildInputs = [
     unzip
-  ] ++ stdenv.lib.optionals stdenv.isDarwin [setfile];
+  ] ++ lib.optionals stdenv.isDarwin [setfile];
 
   meta = {
     homepage = "http://muparser.sourceforge.net";
     description = "An extensible high performance math expression parser library written in C++";
-    license = stdenv.lib.licenses.mit;
-    platforms = stdenv.lib.platforms.linux ++ stdenv.lib.platforms.darwin;
+    license = lib.licenses.mit;
+    platforms = lib.platforms.linux ++ stdenv.lib.platforms.darwin;
   };
 }
diff --git a/pkgs/development/libraries/muparserx/default.nix b/pkgs/development/libraries/muparserx/default.nix
index d7de5ff00f3f9..ef6b254b8a37f 100644
--- a/pkgs/development/libraries/muparserx/default.nix
+++ b/pkgs/development/libraries/muparserx/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , cmake
 }:
@@ -33,7 +33,7 @@ stdenv.mkDerivation rec {
     fi
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A C++ Library for Parsing Expressions with Strings, Complex Numbers, Vectors, Matrices and more";
     homepage = "https://beltoforion.de/en/muparserx/";
     license = licenses.bsd2;
diff --git a/pkgs/development/libraries/mutest/default.nix b/pkgs/development/libraries/mutest/default.nix
index ae40ab9f89536..9470b812586a3 100644
--- a/pkgs/development/libraries/mutest/default.nix
+++ b/pkgs/development/libraries/mutest/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , meson
 , ninja
@@ -24,7 +24,7 @@ stdenv.mkDerivation {
 
   doCheck = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://ebassi.github.io/mutest/mutest.md.html";
     description = "A BDD testing framework for C, inspired by Mocha";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/mygui/default.nix b/pkgs/development/libraries/mygui/default.nix
index 4b86868d2aa2f..4260e30561b4b 100644
--- a/pkgs/development/libraries/mygui/default.nix
+++ b/pkgs/development/libraries/mygui/default.nix
@@ -1,4 +1,4 @@
-{  stdenv, fetchFromGitHub, libX11, unzip, cmake, ois, freetype, libuuid,
+{  lib, stdenv, fetchFromGitHub, libX11, unzip, cmake, ois, freetype, libuuid,
    boost, pkg-config, withOgre ? false, ogre ? null, libGL, libGLU ? null } :
 
 let
@@ -21,7 +21,7 @@ in stdenv.mkDerivation rec {
   # Tools are disabled due to compilation failures.
   cmakeFlags = [ "-DMYGUI_BUILD_TOOLS=OFF" "-DMYGUI_BUILD_DEMOS=OFF" "-DMYGUI_RENDERSYSTEM=${renderSystem}" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://mygui.info/";
     description = "Library for creating GUIs for games and 3D applications";
     license = licenses.lgpl3Plus;
diff --git a/pkgs/development/libraries/mypaint-brushes/1.0.nix b/pkgs/development/libraries/mypaint-brushes/1.0.nix
index 07a57c664801a..73acfd9287f71 100644
--- a/pkgs/development/libraries/mypaint-brushes/1.0.nix
+++ b/pkgs/development/libraries/mypaint-brushes/1.0.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , autoconf
 , automake
 , fetchFromGitHub
@@ -24,7 +24,7 @@ stdenv.mkDerivation rec {
 
   preConfigure = "./autogen.sh";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://mypaint.org/";
     description = "Brushes used by MyPaint and other software using libmypaint";
     license = licenses.cc0;
diff --git a/pkgs/development/libraries/mypaint-brushes/default.nix b/pkgs/development/libraries/mypaint-brushes/default.nix
index 08ac20e447c06..acdee52b85ef7 100644
--- a/pkgs/development/libraries/mypaint-brushes/default.nix
+++ b/pkgs/development/libraries/mypaint-brushes/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , autoconf
 , automake
 , fetchFromGitHub
@@ -24,7 +24,7 @@ stdenv.mkDerivation rec {
 
   preConfigure = "./autogen.sh";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://mypaint.org/";
     description = "Brushes used by MyPaint and other software using libmypaint";
     license = licenses.cc0;
diff --git a/pkgs/development/libraries/mysocketw/default.nix b/pkgs/development/libraries/mysocketw/default.nix
index 1e2e3982d55d4..3b5da68a59d76 100644
--- a/pkgs/development/libraries/mysocketw/default.nix
+++ b/pkgs/development/libraries/mysocketw/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, openssl }:
+{ lib, stdenv, fetchurl, openssl }:
 
 stdenv.mkDerivation {
   name = "mysocketw-031026";
@@ -11,7 +11,7 @@ stdenv.mkDerivation {
 
   buildInputs = [ openssl ];
 
-  postPatch = stdenv.lib.optionalString stdenv.isDarwin ''
+  postPatch = lib.optionalString stdenv.isDarwin ''
     substituteInPlace src/Makefile \
         --replace -Wl,-soname, -Wl,-install_name,$out/lib/
   '';
@@ -20,7 +20,7 @@ stdenv.mkDerivation {
 
   meta = {
     description = "Cross platform (Linux/FreeBSD/Unix/Win32) streaming socket C++";
-    license = stdenv.lib.licenses.lgpl21Plus;
-    platforms = stdenv.lib.platforms.all;
+    license = lib.licenses.lgpl21Plus;
+    platforms = lib.platforms.all;
   };
 }
diff --git a/pkgs/development/libraries/mythes/default.nix b/pkgs/development/libraries/mythes/default.nix
index b4983455675f6..b678baf988194 100644
--- a/pkgs/development/libraries/mythes/default.nix
+++ b/pkgs/development/libraries/mythes/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, hunspell, ncurses, pkg-config, perl }:
+{ lib, stdenv, fetchurl, hunspell, ncurses, pkg-config, perl }:
 
 stdenv.mkDerivation rec {
   name = "mythes-1.2.4";
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
   meta = {
     homepage = "http://hunspell.sourceforge.net/";
     description = "Thesaurus library from Hunspell project";
-    license = stdenv.lib.licenses.bsd3;
+    license = lib.licenses.bsd3;
     inherit (hunspell.meta) platforms;
   };
 }
diff --git a/pkgs/development/libraries/nanoflann/default.nix b/pkgs/development/libraries/nanoflann/default.nix
index 649ce91cbd816..0dbbd461dc215 100644
--- a/pkgs/development/libraries/nanoflann/default.nix
+++ b/pkgs/development/libraries/nanoflann/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchFromGitHub, cmake}:
+{lib, stdenv, fetchFromGitHub, cmake}:
 
 stdenv.mkDerivation rec {
   version = "1.3.2";
@@ -22,8 +22,8 @@ stdenv.mkDerivation rec {
 
   meta = {
     homepage = "https://github.com/jlblancoc/nanoflann";
-    license = stdenv.lib.licenses.bsd2;
+    license = lib.licenses.bsd2;
     description = "Header only C++ library for approximate nearest neighbor search";
-    platforms = stdenv.lib.platforms.unix;
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/nanomsg/default.nix b/pkgs/development/libraries/nanomsg/default.nix
index 5772581d5ec1a..49a93abd7fb07 100644
--- a/pkgs/development/libraries/nanomsg/default.nix
+++ b/pkgs/development/libraries/nanomsg/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, cmake, fetchFromGitHub }:
+{ lib, stdenv, cmake, fetchFromGitHub }:
 
 stdenv.mkDerivation rec {
   version = "1.1.5";
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ cmake ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description= "Socket library that provides several common communication patterns";
     homepage = "https://nanomsg.org/";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/nco/default.nix b/pkgs/development/libraries/nco/default.nix
index bb8dee2be61ed..e8053ce27023d 100644
--- a/pkgs/development/libraries/nco/default.nix
+++ b/pkgs/development/libraries/nco/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchzip, netcdf, netcdfcxx4, gsl, udunits, antlr, which, curl, flex, coreutils }:
+{ lib, stdenv, fetchzip, netcdf, netcdfcxx4, gsl, udunits, antlr, which, curl, flex, coreutils }:
 
 stdenv.mkDerivation rec {
   version = "4.9.7";
@@ -23,8 +23,8 @@ stdenv.mkDerivation rec {
     description = "NetCDF Operator toolkit";
     longDescription = "The NCO (netCDF Operator) toolkit manipulates and analyzes data stored in netCDF-accessible formats, including DAP, HDF4, and HDF5";
     homepage = "http://nco.sourceforge.net/";
-    license = stdenv.lib.licenses.gpl3;
-    maintainers = [ stdenv.lib.maintainers.bzizou ];
-    platforms = stdenv.lib.platforms.linux;
+    license = lib.licenses.gpl3;
+    maintainers = [ lib.maintainers.bzizou ];
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/development/libraries/ndi/default.nix b/pkgs/development/libraries/ndi/default.nix
index c0e1816c0e12a..75d2a2db02187 100644
--- a/pkgs/development/libraries/ndi/default.nix
+++ b/pkgs/development/libraries/ndi/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, requireFile, avahi }:
+{ lib, stdenv, requireFile, avahi }:
 
 stdenv.mkDerivation rec {
   pname = "ndi";
@@ -51,7 +51,7 @@ stdenv.mkDerivation rec {
   # Stripping breaks ndi-record.
   dontStrip = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://ndi.tv/sdk/";
     description = "NDI Software Developer Kit";
     platforms = ["x86_64-linux"];
diff --git a/pkgs/development/libraries/ndn-cxx/default.nix b/pkgs/development/libraries/ndn-cxx/default.nix
index 893f82a6d5264..f2510d6f6bbe4 100644
--- a/pkgs/development/libraries/ndn-cxx/default.nix
+++ b/pkgs/development/libraries/ndn-cxx/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , doxygen
 , pkg-config
@@ -31,7 +31,7 @@ stdenv.mkDerivation rec {
     "--boost-libs=${boost.out}/lib"
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://named-data.net/";
     description = "A Named Data Neworking (NDN) or Content Centric Networking (CCN) abstraction";
     longDescription = ''
diff --git a/pkgs/development/libraries/ndpi/default.nix b/pkgs/development/libraries/ndpi/default.nix
index 43da97c2edd86..c3df23052e22c 100644
--- a/pkgs/development/libraries/ndpi/default.nix
+++ b/pkgs/development/libraries/ndpi/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, which, autoconf, automake, libtool, libpcap
+{ lib, stdenv, fetchFromGitHub, which, autoconf, automake, libtool, libpcap
 , pkg-config }:
 
 let version = "3.4"; in
@@ -22,7 +22,7 @@ stdenv.mkDerivation {
     pkg-config
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A library for deep-packet inspection";
     longDescription = ''
       nDPI is a library for deep-packet inspection based on OpenDPI.
diff --git a/pkgs/development/libraries/neardal/default.nix b/pkgs/development/libraries/neardal/default.nix
index a6b6e88cec327..5e02a9fd5222b 100644
--- a/pkgs/development/libraries/neardal/default.nix
+++ b/pkgs/development/libraries/neardal/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, autoconf, automake, libtool, pkg-config, glib, readline, makeWrapper }:
+{ lib, stdenv, fetchFromGitHub, autoconf, automake, libtool, pkg-config, glib, readline, makeWrapper }:
 
 stdenv.mkDerivation {
   name = "neardal-0.7-post-git-20150930";
@@ -21,7 +21,7 @@ stdenv.mkDerivation {
 
   configureFlags = [ "--disable-dependency-tracking" "--disable-traces" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "C APIs to exchange datas with the NFC daemon 'Neard'";
     license = licenses.lgpl2;
     homepage = "https://01.org/linux-nfc";
diff --git a/pkgs/development/libraries/neatvnc/default.nix b/pkgs/development/libraries/neatvnc/default.nix
index db7940536f1bb..980424b7fd484 100644
--- a/pkgs/development/libraries/neatvnc/default.nix
+++ b/pkgs/development/libraries/neatvnc/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, meson, pkg-config, ninja
+{ lib, stdenv, fetchFromGitHub, meson, pkg-config, ninja
 , pixman, gnutls, libdrm, libjpeg_turbo, zlib, aml
 }:
 
@@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ meson pkg-config ninja ];
   buildInputs = [ pixman gnutls libdrm libjpeg_turbo zlib aml ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A VNC server library";
     longDescription = ''
       This is a liberally licensed VNC server library that's intended to be
diff --git a/pkgs/development/libraries/neon/0.29.nix b/pkgs/development/libraries/neon/0.29.nix
index 89b48221ca80a..e0437fb7cea1a 100644
--- a/pkgs/development/libraries/neon/0.29.nix
+++ b/pkgs/development/libraries/neon/0.29.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, libxml2, pkg-config, perl
+{ lib, stdenv, fetchurl, libxml2, pkg-config, perl
 , compressionSupport ? true, zlib ? null
 , sslSupport ? true, openssl ? null
 , static ? false
@@ -10,7 +10,7 @@ assert sslSupport -> openssl != null;
 assert static || shared;
 
 let
-   inherit (stdenv.lib) optionals;
+   inherit (lib) optionals;
 in
 
 stdenv.mkDerivation rec {
@@ -26,13 +26,13 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ pkg-config ];
   buildInputs = [libxml2 openssl]
-    ++ stdenv.lib.optional compressionSupport zlib;
+    ++ lib.optional compressionSupport zlib;
 
   configureFlags = [
-    (stdenv.lib.enableFeature shared "shared")
-    (stdenv.lib.enableFeature static "static")
-    (stdenv.lib.withFeature compressionSupport "zlib")
-    (stdenv.lib.withFeature sslSupport "ssl")
+    (lib.enableFeature shared "shared")
+    (lib.enableFeature static "static")
+    (lib.withFeature compressionSupport "zlib")
+    (lib.withFeature sslSupport "ssl")
   ];
 
   passthru = {inherit compressionSupport sslSupport;};
@@ -40,7 +40,7 @@ stdenv.mkDerivation rec {
   checkInputs = [ perl ];
   doCheck = false; # fails, needs the net
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "An HTTP and WebDAV client library";
     homepage = "http://www.webdav.org/neon/";
     platforms = platforms.unix;
diff --git a/pkgs/development/libraries/neon/default.nix b/pkgs/development/libraries/neon/default.nix
index 935a17d3d78f0..c0c62deb0ace1 100644
--- a/pkgs/development/libraries/neon/default.nix
+++ b/pkgs/development/libraries/neon/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, libxml2, pkg-config, perl
+{ lib, stdenv, fetchurl, libxml2, pkg-config, perl
 , compressionSupport ? true, zlib ? null
 , sslSupport ? true, openssl ? null
 , static ? stdenv.hostPlatform.isStatic
@@ -10,7 +10,7 @@ assert sslSupport -> openssl != null;
 assert static || shared;
 
 let
-   inherit (stdenv.lib) optionals;
+   inherit (lib) optionals;
 in
 
 stdenv.mkDerivation rec {
@@ -26,13 +26,13 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ pkg-config ];
   buildInputs = [libxml2 openssl]
-    ++ stdenv.lib.optional compressionSupport zlib;
+    ++ lib.optional compressionSupport zlib;
 
   configureFlags = [
-    (stdenv.lib.enableFeature shared "shared")
-    (stdenv.lib.enableFeature static "static")
-    (stdenv.lib.withFeature compressionSupport "zlib")
-    (stdenv.lib.withFeature sslSupport "ssl")
+    (lib.enableFeature shared "shared")
+    (lib.enableFeature static "static")
+    (lib.withFeature compressionSupport "zlib")
+    (lib.withFeature sslSupport "ssl")
   ];
 
   passthru = {inherit compressionSupport sslSupport;};
@@ -40,7 +40,7 @@ stdenv.mkDerivation rec {
   checkInputs = [ perl ];
   doCheck = false; # fails, needs the net
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "An HTTP and WebDAV client library";
     homepage = "http://www.webdav.org/neon/";
     platforms = platforms.unix;
diff --git a/pkgs/development/libraries/netcdf-cxx4/default.nix b/pkgs/development/libraries/netcdf-cxx4/default.nix
index 526e02e89079d..b594a672140f3 100644
--- a/pkgs/development/libraries/netcdf-cxx4/default.nix
+++ b/pkgs/development/libraries/netcdf-cxx4/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, netcdf, hdf5, curl }:
+{ lib, stdenv, fetchurl, netcdf, hdf5, curl }:
 stdenv.mkDerivation rec {
   pname = "netcdf-cxx4";
   version = "4.3.0";
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
   meta = {
     description = "C++ API to manipulate netcdf files";
     homepage = "https://www.unidata.ucar.edu/software/netcdf/";
-    license = stdenv.lib.licenses.free;
-    platforms = stdenv.lib.platforms.unix;
+    license = lib.licenses.free;
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/netcdf-fortran/default.nix b/pkgs/development/libraries/netcdf-fortran/default.nix
index ab10c6861635d..0cdeda238792b 100644
--- a/pkgs/development/libraries/netcdf-fortran/default.nix
+++ b/pkgs/development/libraries/netcdf-fortran/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, netcdf, hdf5, curl, gfortran }:
+{ lib, stdenv, fetchurl, netcdf, hdf5, curl, gfortran }:
 stdenv.mkDerivation rec {
   pname = "netcdf-fortran";
   version = "4.4.5";
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
   buildInputs = [ netcdf hdf5 curl gfortran ];
   doCheck = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Fortran API to manipulate netcdf files";
     homepage = "https://www.unidata.ucar.edu/software/netcdf/";
     license = licenses.free;
diff --git a/pkgs/development/libraries/netcdf/default.nix b/pkgs/development/libraries/netcdf/default.nix
index fecc4100f5e67..c345f66e872ae 100644
--- a/pkgs/development/libraries/netcdf/default.nix
+++ b/pkgs/development/libraries/netcdf/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , hdf5
 , m4
@@ -41,7 +41,7 @@ in stdenv.mkDerivation rec {
       "--enable-shared"
       "--disable-dap-remote-tests"
   ]
-  ++ (stdenv.lib.optionals mpiSupport [ "--enable-parallel-tests" "CC=${mpi}/bin/mpicc" ]);
+  ++ (lib.optionals mpiSupport [ "--enable-parallel-tests" "CC=${mpi}/bin/mpicc" ]);
 
   disallowedReferences = [ stdenv.cc ];
 
@@ -53,7 +53,7 @@ in stdenv.mkDerivation rec {
 
   meta = {
       description = "Libraries for the Unidata network Common Data Format";
-      platforms = stdenv.lib.platforms.unix;
+      platforms = lib.platforms.unix;
       homepage = "https://www.unidata.ucar.edu/software/netcdf/";
       license = {
         url = "https://www.unidata.ucar.edu/software/netcdf/docs/copyright.html";
diff --git a/pkgs/development/libraries/nettle/generic.nix b/pkgs/development/libraries/nettle/generic.nix
index 4c3c6d04ca888..735fe373533da 100644
--- a/pkgs/development/libraries/nettle/generic.nix
+++ b/pkgs/development/libraries/nettle/generic.nix
@@ -1,4 +1,4 @@
-{ stdenv, buildPackages, gmp, gnum4
+{ lib, stdenv, buildPackages, gmp, gnum4
 
 # Version specific args
 , version, src
@@ -22,10 +22,10 @@ stdenv.mkDerivation ({
 
   enableParallelBuilding = true;
 
-  patches = stdenv.lib.optional (stdenv.hostPlatform.system == "i686-cygwin")
+  patches = lib.optional (stdenv.hostPlatform.system == "i686-cygwin")
               ./cygwin.patch;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Cryptographic library";
 
     longDescription = ''
@@ -61,7 +61,7 @@ stdenv.mkDerivation ({
 
 //
 
-stdenv.lib.optionalAttrs stdenv.isSunOS {
+lib.optionalAttrs stdenv.isSunOS {
   # Make sure the right <gmp.h> is found, and not the incompatible
   # /usr/include/mp.h from OpenSolaris.  See
   # <https://lists.gnu.org/archive/html/hydra-users/2012-08/msg00000.html>
diff --git a/pkgs/development/libraries/networking-ts-cxx/default.nix b/pkgs/development/libraries/networking-ts-cxx/default.nix
index 72981175c0bc3..7dc6d4b11fee2 100644
--- a/pkgs/development/libraries/networking-ts-cxx/default.nix
+++ b/pkgs/development/libraries/networking-ts-cxx/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub }:
+{ lib, stdenv, fetchFromGitHub }:
 
 stdenv.mkDerivation rec {
   pname = "networking-ts-cxx";
@@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
     substituteAll ${./networking_ts.pc.in} $out/lib/pkgconfig/networking_ts.pc
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Experimental implementation of the C++ Networking Technical Specification";
     homepage = "https://github.com/chriskohlhoff/networking-ts-impl";
     license = licenses.boost;
diff --git a/pkgs/development/libraries/newt/default.nix b/pkgs/development/libraries/newt/default.nix
index 41d9671b204e4..dc6b604bd8e23 100644
--- a/pkgs/development/libraries/newt/default.nix
+++ b/pkgs/development/libraries/newt/default.nix
@@ -31,11 +31,11 @@ stdenv.mkDerivation rec {
     unset CPP
   '';
 
-  makeFlags = stdenv.lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [
+  makeFlags = lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [
     "CROSS_COMPILE=${stdenv.cc.targetPrefix}"
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://fedorahosted.org/newt/";
     description = "Library for color text mode, widget based user interfaces";
 
diff --git a/pkgs/development/libraries/nghttp2/default.nix b/pkgs/development/libraries/nghttp2/default.nix
index 0ec941ff1829a..6464679b94894 100644
--- a/pkgs/development/libraries/nghttp2/default.nix
+++ b/pkgs/development/libraries/nghttp2/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config
+{ lib, stdenv, fetchurl, pkg-config
 
 # Optional Dependencies
 , openssl ? null, zlib ? null
@@ -23,7 +23,7 @@ assert enableGetAssets -> libxml2 != null;
 assert enableJemalloc -> jemalloc != null;
 assert enablePython -> python != null && cython != null && ncurses != null && setuptools != null;
 
-let inherit (stdenv.lib) optional optionals optionalString; in
+let inherit (lib) optional optionals optionalString; in
 
 stdenv.mkDerivation rec {
   pname = "nghttp2";
@@ -53,7 +53,7 @@ stdenv.mkDerivation rec {
   configureFlags = [
     "--with-spdylay=no"
     "--disable-examples"
-    (stdenv.lib.enableFeature enableApp "app")
+    (lib.enableFeature enableApp "app")
   ] ++ optional enableAsioLib "--enable-asio-lib --with-boost-libdir=${boost}/lib"
     ++ (if enablePython then [
     "--with-cython=${cython}/bin/cython"
@@ -73,7 +73,7 @@ stdenv.mkDerivation rec {
 
   #doCheck = true;  # requires CUnit ; currently failing at test_util_localtime_date in util_test.cc
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://nghttp2.org/";
     description = "A C implementation of HTTP/2";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/ngt/default.nix b/pkgs/development/libraries/ngt/default.nix
index 7d766eb5d8793..385f2d84f8a6e 100644
--- a/pkgs/development/libraries/ngt/default.nix
+++ b/pkgs/development/libraries/ngt/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , cmake
 , llvmPackages
@@ -22,7 +22,7 @@ stdenv.mkDerivation rec {
   NIX_ENFORCE_NO_NATIVE = ! enableAVX;
   __AVX2__ = if enableAVX then 1 else 0;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/yahoojapan/NGT";
     description = "Nearest Neighbor Search with Neighborhood Graph and Tree for High-dimensional Data";
     platforms = platforms.linux ++ platforms.darwin;
diff --git a/pkgs/development/libraries/nix-plugins/default.nix b/pkgs/development/libraries/nix-plugins/default.nix
index 94c4bd84d9ae5..915e733473e15 100644
--- a/pkgs/development/libraries/nix-plugins/default.nix
+++ b/pkgs/development/libraries/nix-plugins/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, nix, cmake, pkg-config, boost }:
+{ lib, stdenv, fetchFromGitHub, nix, cmake, pkg-config, boost }:
 let version = "6.0.0"; in
 stdenv.mkDerivation {
   pname = "nix-plugins";
@@ -18,7 +18,7 @@ stdenv.mkDerivation {
   meta = {
     description = "Collection of miscellaneous plugins for the nix expression language";
     homepage = "https://github.com/shlevy/nix-plugins";
-    license = stdenv.lib.licenses.mit;
-    platforms = stdenv.lib.platforms.all;
+    license = lib.licenses.mit;
+    platforms = lib.platforms.all;
   };
 }
diff --git a/pkgs/development/libraries/nlohmann_json/default.nix b/pkgs/development/libraries/nlohmann_json/default.nix
index 34c0f6294af50..742135345328d 100644
--- a/pkgs/development/libraries/nlohmann_json/default.nix
+++ b/pkgs/development/libraries/nlohmann_json/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake
+{ lib, stdenv, fetchFromGitHub, cmake
 }:
 
 stdenv.mkDerivation rec {
@@ -25,7 +25,7 @@ stdenv.mkDerivation rec {
 
   postInstall = "rm -rf $out/lib64";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Header only C++ library for the JSON file format";
     homepage = "https://github.com/nlohmann/json";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/nlopt/default.nix b/pkgs/development/libraries/nlopt/default.nix
index 64eb6d79abd10..36fcf90811825 100644
--- a/pkgs/development/libraries/nlopt/default.nix
+++ b/pkgs/development/libraries/nlopt/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, octave ? null }:
+{ lib, stdenv, fetchFromGitHub, cmake, octave ? null }:
 
 stdenv.mkDerivation rec {
   pname = "nlopt";
@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
     "--without-guile"
     "--without-python"
     "--without-matlab"
-  ] ++ stdenv.lib.optionals (octave != null) [
+  ] ++ lib.optionals (octave != null) [
     "--with-octave"
     "M_INSTALL_DIR=$(out)/${octave.sitePath}/m"
     "OCT_INSTALL_DIR=$(out)/${octave.sitePath}/oct"
@@ -30,8 +30,8 @@ stdenv.mkDerivation rec {
   meta = {
     homepage = "https://nlopt.readthedocs.io/en/latest/";
     description = "Free open-source library for nonlinear optimization";
-    license = stdenv.lib.licenses.lgpl21Plus;
-    hydraPlatforms = stdenv.lib.platforms.linux;
+    license = lib.licenses.lgpl21Plus;
+    hydraPlatforms = lib.platforms.linux;
   };
 
 }
diff --git a/pkgs/development/libraries/notify-sharp/default.nix b/pkgs/development/libraries/notify-sharp/default.nix
index a1a7a9ad6cb7a..1cd69074911b0 100644
--- a/pkgs/development/libraries/notify-sharp/default.nix
+++ b/pkgs/development/libraries/notify-sharp/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitLab, pkg-config, autoreconfHook
+{ lib, stdenv, fetchFromGitLab, pkg-config, autoreconfHook
 , mono, gtk-sharp-3_0, dbus-sharp-1_0, dbus-sharp-glib-1_0 }:
 
 stdenv.mkDerivation rec {
@@ -29,7 +29,7 @@ stdenv.mkDerivation rec {
     sed -i 's#^[ \t]*DOCDIR=.*$#DOCDIR=$out/lib/monodoc#' ./configure.ac
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "D-Bus for .NET";
     platforms = platforms.linux;
     license = licenses.mit;
diff --git a/pkgs/development/libraries/npapi-sdk/default.nix b/pkgs/development/libraries/npapi-sdk/default.nix
index c3ef724501e27..6611f99bdfc28 100644
--- a/pkgs/development/libraries/npapi-sdk/default.nix
+++ b/pkgs/development/libraries/npapi-sdk/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
   pname = "npapi-sdk";
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
     sha256 = "0xxfcsjmmgbbyl9zwpzdshbx27grj5fnzjfmldmm9apws2yk9gq1";
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A bundle of NPAPI headers by Mozilla";
 
     homepage = "https://bitbucket.org/mgorny/npapi-sdk"; # see also https://github.com/mozilla/npapi-sdk
diff --git a/pkgs/development/libraries/npth/default.nix b/pkgs/development/libraries/npth/default.nix
index 51512a160570b..a5ac9ce991274 100644
--- a/pkgs/development/libraries/npth/default.nix
+++ b/pkgs/development/libraries/npth/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
   name = "npth-1.6";
@@ -10,7 +10,7 @@ stdenv.mkDerivation rec {
 
   doCheck = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "The New GNU Portable Threads Library";
     longDescription = ''
       This is a library to provide the GNU Pth API and thus a non-preemptive
diff --git a/pkgs/development/libraries/nspr/default.nix b/pkgs/development/libraries/nspr/default.nix
index e8893bc2040d8..17b8b9226d508 100644
--- a/pkgs/development/libraries/nspr/default.nix
+++ b/pkgs/development/libraries/nspr/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl
+{ lib, stdenv, fetchurl
 , CoreServices ? null
 , buildPackages }:
 
@@ -22,7 +22,7 @@ stdenv.mkDerivation {
 
   preConfigure = ''
     cd nspr
-  '' + stdenv.lib.optionalString stdenv.isDarwin ''
+  '' + lib.optionalString stdenv.isDarwin ''
     substituteInPlace configure --replace '@executable_path/' "$out/lib/"
     substituteInPlace configure.in --replace '@executable_path/' "$out/lib/"
   '';
@@ -32,18 +32,18 @@ stdenv.mkDerivation {
   configureFlags = [
     "--enable-optimize"
     "--disable-debug"
-  ] ++ stdenv.lib.optional stdenv.is64bit "--enable-64bit";
+  ] ++ lib.optional stdenv.is64bit "--enable-64bit";
 
   postInstall = ''
     find $out -name "*.a" -delete
     moveToOutput share "$dev" # just aclocal
   '';
 
-  buildInputs = [] ++ stdenv.lib.optionals stdenv.isDarwin [ CoreServices ];
+  buildInputs = [] ++ lib.optionals stdenv.isDarwin [ CoreServices ];
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://www.mozilla.org/projects/nspr/";
     description = "Netscape Portable Runtime, a platform-neutral API for system-level and libc-like functions";
     platforms = platforms.all;
diff --git a/pkgs/development/libraries/nss/3.44.nix b/pkgs/development/libraries/nss/3.44.nix
index 1c89dd7933161..b08b8b3ed2a75 100644
--- a/pkgs/development/libraries/nss/3.44.nix
+++ b/pkgs/development/libraries/nss/3.44.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, nspr, perl, zlib, sqlite, fixDarwinDylibNames, buildPackages }:
+{ lib, stdenv, fetchurl, nspr, perl, zlib, sqlite, fixDarwinDylibNames, buildPackages }:
 
 let
   nssPEM = fetchurl {
@@ -20,7 +20,7 @@ in stdenv.mkDerivation rec {
   depsBuildBuild = [ buildPackages.stdenv.cc ];
 
   nativeBuildInputs = [ perl ]
-    ++ stdenv.lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames;
+    ++ lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames;
 
   buildInputs = [ zlib sqlite ];
 
@@ -39,7 +39,7 @@ in stdenv.mkDerivation rec {
 
   patchFlags = [ "-p0" ];
 
-  postPatch = stdenv.lib.optionalString stdenv.isDarwin ''
+  postPatch = lib.optionalString stdenv.isDarwin ''
     substituteInPlace nss/coreconf/Darwin.mk --replace '@executable_path/$(notdir $@)' "$out/lib/\$(notdir \$@)"
   '';
 
@@ -61,16 +61,16 @@ in stdenv.mkDerivation rec {
     "USE_SYSTEM_ZLIB=1"
     "NSS_USE_SYSTEM_SQLITE=1"
     "NATIVE_CC=${buildPackages.stdenv.cc}/bin/cc"
-  ] ++ stdenv.lib.optionals (!stdenv.isDarwin) [
+  ] ++ lib.optionals (!stdenv.isDarwin) [
     # Pass in CPU even if we're not cross compiling, because otherwise it tries to guess with
     # uname, which can be wrong if e.g. we're compiling for aarch32 on aarch64
     "OS_TEST=${cpu}"
     "CPU_ARCH=${cpu}"
-  ] ++ stdenv.lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) [
+  ] ++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) [
     "CROSS_COMPILE=1"
     "NSS_DISABLE_GTESTS=1" # don't want to build tests when cross-compiling
-  ] ++ stdenv.lib.optional stdenv.is64bit "USE_64=1"
-    ++ stdenv.lib.optional stdenv.isDarwin "CCC=clang++";
+  ] ++ lib.optional stdenv.is64bit "USE_64=1"
+    ++ lib.optional stdenv.isDarwin "CCC=clang++";
 
   NIX_CFLAGS_COMPILE = "-Wno-error";
 
@@ -135,7 +135,7 @@ in stdenv.mkDerivation rec {
     rm -f "$out"/lib/*.a
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://developer.mozilla.org/en-US/docs/NSS";
     description = "A set of libraries for development of security-enabled client and server applications";
     license = licenses.mpl20;
diff --git a/pkgs/development/libraries/nss/3.53.nix b/pkgs/development/libraries/nss/3.53.nix
index dcd9ade629b70..9f281743f6cf7 100644
--- a/pkgs/development/libraries/nss/3.53.nix
+++ b/pkgs/development/libraries/nss/3.53.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, nspr, perl, zlib, sqlite, darwin, fixDarwinDylibNames, buildPackages, ninja
+{ lib, stdenv, fetchurl, nspr, perl, zlib, sqlite, darwin, fixDarwinDylibNames, buildPackages, ninja
 , # allow FIPS mode. Note that this makes the output non-reproducible.
   # https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS/NSS_Tech_Notes/nss_tech_note6
   enableFIPS ? false
@@ -24,7 +24,7 @@ in stdenv.mkDerivation rec {
   depsBuildBuild = [ buildPackages.stdenv.cc ];
 
   nativeBuildInputs = [ perl ninja (buildPackages.python3.withPackages (ps: with ps; [ gyp ])) ]
-    ++ stdenv.lib.optionals stdenv.hostPlatform.isDarwin [ darwin.cctools fixDarwinDylibNames ];
+    ++ lib.optionals stdenv.hostPlatform.isDarwin [ darwin.cctools fixDarwinDylibNames ];
 
   buildInputs = [ zlib sqlite ];
 
@@ -57,7 +57,7 @@ in stdenv.mkDerivation rec {
 
   patchFlags = [ "-p0" ];
 
-  postPatch = stdenv.lib.optionalString stdenv.hostPlatform.isDarwin ''
+  postPatch = lib.optionalString stdenv.hostPlatform.isDarwin ''
      substituteInPlace nss/coreconf/Darwin.mk --replace '@executable_path/$(notdir $@)' "$out/lib/\$(notdir \$@)"
      substituteInPlace nss/coreconf/config.gypi --replace "'DYLIB_INSTALL_NAME_BASE': '@executable_path'" "'DYLIB_INSTALL_NAME_BASE': '$out/lib'"
    '';
@@ -90,9 +90,9 @@ in stdenv.mkDerivation rec {
       -Dhost_arch=${host} \
       -Duse_system_zlib=1 \
       --enable-libpkix \
-      ${stdenv.lib.optionalString enableFIPS "--enable-fips"} \
-      ${stdenv.lib.optionalString stdenv.isDarwin "--clang"} \
-      ${stdenv.lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) "--disable-tests"}
+      ${lib.optionalString enableFIPS "--enable-fips"} \
+      ${lib.optionalString stdenv.isDarwin "--clang"} \
+      ${lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) "--disable-tests"}
 
     runHook postBuild
   '';
@@ -137,7 +137,7 @@ in stdenv.mkDerivation rec {
     isCross = stdenv.hostPlatform != stdenv.buildPlatform;
     nss = if isCross then buildPackages.nss.tools else "$out";
   in
-  (stdenv.lib.optionalString enableFIPS (''
+  (lib.optionalString enableFIPS (''
     for libname in freebl3 nssdbm3 softokn3
     do '' +
     (if stdenv.isDarwin
@@ -160,7 +160,7 @@ in stdenv.mkDerivation rec {
     runHook postInstall
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://developer.mozilla.org/en-US/docs/NSS";
     description = "A set of libraries for development of security-enabled client and server applications";
     license = licenses.mpl20;
diff --git a/pkgs/development/libraries/nss/default.nix b/pkgs/development/libraries/nss/default.nix
index 17dc93c9f1ea9..8c98d7ae9bbdb 100644
--- a/pkgs/development/libraries/nss/default.nix
+++ b/pkgs/development/libraries/nss/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, nspr, perl, zlib, sqlite, darwin, fixDarwinDylibNames, buildPackages, ninja
+{ lib, stdenv, fetchurl, nspr, perl, zlib, sqlite, darwin, fixDarwinDylibNames, buildPackages, ninja
 , # allow FIPS mode. Note that this makes the output non-reproducible.
   # https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS/NSS_Tech_Notes/nss_tech_note6
   enableFIPS ? false
@@ -30,7 +30,7 @@ in stdenv.mkDerivation rec {
   depsBuildBuild = [ buildPackages.stdenv.cc ];
 
   nativeBuildInputs = [ perl ninja (buildPackages.python3.withPackages (ps: with ps; [ gyp ])) ]
-    ++ stdenv.lib.optionals stdenv.hostPlatform.isDarwin [ darwin.cctools fixDarwinDylibNames ];
+    ++ lib.optionals stdenv.hostPlatform.isDarwin [ darwin.cctools fixDarwinDylibNames ];
 
   buildInputs = [ zlib sqlite ];
 
@@ -63,7 +63,7 @@ in stdenv.mkDerivation rec {
 
   patchFlags = [ "-p0" ];
 
-  postPatch = stdenv.lib.optionalString stdenv.hostPlatform.isDarwin ''
+  postPatch = lib.optionalString stdenv.hostPlatform.isDarwin ''
      substituteInPlace nss/coreconf/Darwin.mk --replace '@executable_path/$(notdir $@)' "$out/lib/\$(notdir \$@)"
      substituteInPlace nss/coreconf/config.gypi --replace "'DYLIB_INSTALL_NAME_BASE': '@executable_path'" "'DYLIB_INSTALL_NAME_BASE': '$out/lib'"
    '';
@@ -96,9 +96,9 @@ in stdenv.mkDerivation rec {
       -Dhost_arch=${host} \
       -Duse_system_zlib=1 \
       --enable-libpkix \
-      ${stdenv.lib.optionalString enableFIPS "--enable-fips"} \
-      ${stdenv.lib.optionalString stdenv.isDarwin "--clang"} \
-      ${stdenv.lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) "--disable-tests"}
+      ${lib.optionalString enableFIPS "--enable-fips"} \
+      ${lib.optionalString stdenv.isDarwin "--clang"} \
+      ${lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) "--disable-tests"}
 
     runHook postBuild
   '';
@@ -143,7 +143,7 @@ in stdenv.mkDerivation rec {
     isCross = stdenv.hostPlatform != stdenv.buildPlatform;
     nss = if isCross then buildPackages.nss.tools else "$out";
   in
-  (stdenv.lib.optionalString enableFIPS (''
+  (lib.optionalString enableFIPS (''
     for libname in freebl3 nssdbm3 softokn3
     do '' +
     (if stdenv.isDarwin
@@ -166,7 +166,7 @@ in stdenv.mkDerivation rec {
     runHook postInstall
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://developer.mozilla.org/en-US/docs/NSS";
     description = "A set of libraries for development of security-enabled client and server applications";
     license = licenses.mpl20;
diff --git a/pkgs/development/libraries/nss_wrapper/default.nix b/pkgs/development/libraries/nss_wrapper/default.nix
index 2b9321c7a907a..3cdeb93dc9b11 100644
--- a/pkgs/development/libraries/nss_wrapper/default.nix
+++ b/pkgs/development/libraries/nss_wrapper/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, cmake, pkg-config }:
+{ lib, stdenv, fetchurl, cmake, pkg-config }:
 
 stdenv.mkDerivation rec {
   name = "nss_wrapper-1.1.11";
@@ -10,7 +10,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ cmake pkg-config ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A wrapper for the user, group and hosts NSS API";
     homepage = "https://git.samba.org/?p=nss_wrapper.git;a=summary;";
     license = licenses.bsd3;
diff --git a/pkgs/development/libraries/ntbtls/default.nix b/pkgs/development/libraries/ntbtls/default.nix
index 5ea43097b8cae..98ea6fa943f83 100644
--- a/pkgs/development/libraries/ntbtls/default.nix
+++ b/pkgs/development/libraries/ntbtls/default.nix
@@ -1,6 +1,6 @@
-{ stdenv, fetchurl, gettext, libgpgerror, libgcrypt, libksba, zlib }:
+{ lib, stdenv, fetchurl, gettext, libgpgerror, libgcrypt, libksba, zlib }:
 
-with stdenv.lib;
+with lib;
 
 stdenv.mkDerivation rec {
   pname = "ntbtls";
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
   outputs = [ "dev" "out" ];
 
   buildInputs = [ libgcrypt libgpgerror libksba zlib ]
-    ++ stdenv.lib.optional stdenv.isDarwin gettext;
+    ++ lib.optional stdenv.isDarwin gettext;
 
   postInstall = ''
     moveToOutput "bin/ntbtls-config" $dev
diff --git a/pkgs/development/libraries/ntdb/default.nix b/pkgs/development/libraries/ntdb/default.nix
index d0a9a2e5b49a4..021436516c228 100644
--- a/pkgs/development/libraries/ntdb/default.nix
+++ b/pkgs/development/libraries/ntdb/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , python2
 , python3
@@ -42,7 +42,7 @@ stdenv.mkDerivation rec {
     "--builtin-libraries=replace,ccan"
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "The not-so trivial database";
     homepage = "https://tdb.samba.org/";
     license = licenses.lgpl3Plus;
diff --git a/pkgs/development/libraries/ntirpc/default.nix b/pkgs/development/libraries/ntirpc/default.nix
index 48ef98dab499a..e98cfac78581b 100644
--- a/pkgs/development/libraries/ntirpc/default.nix
+++ b/pkgs/development/libraries/ntirpc/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake
+{ lib, stdenv, fetchFromGitHub, cmake
 , krb5, liburcu , libtirpc, libnsl
 } :
 
@@ -28,7 +28,7 @@ stdenv.mkDerivation rec {
     cp ${libtirpc}/etc/netconfig $out/etc/
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Transport-independent RPC (TI-RPC)";
     homepage = "https://github.com/nfs-ganesha/ntirpc";
     maintainers = [ maintainers.markuskowa ];
diff --git a/pkgs/development/libraries/ntrack/default.nix b/pkgs/development/libraries/ntrack/default.nix
index 47fd43d7e35e0..cb9f9ff575f83 100644
--- a/pkgs/development/libraries/ntrack/default.nix
+++ b/pkgs/development/libraries/ntrack/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, qt4, pkg-config, libnl, python }:
+{ lib, stdenv, fetchurl, qt4, pkg-config, libnl, python }:
 
 let
   version = "016";
@@ -29,7 +29,7 @@ stdenv.mkDerivation rec {
     sed -e "s@/usr\(/lib/ntrack/modules/\)@$out&@" -i common/ntrack.c
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Network Connectivity Tracking library for Desktop Applications";
     homepage = "https://launchpad.net/ntrack";
     platforms = platforms.linux;
diff --git a/pkgs/development/libraries/nuraft/default.nix b/pkgs/development/libraries/nuraft/default.nix
index 1554e16781567..58e5e40135908 100644
--- a/pkgs/development/libraries/nuraft/default.nix
+++ b/pkgs/development/libraries/nuraft/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, boost172, asio, openssl, zlib }:
+{ lib, stdenv, fetchFromGitHub, cmake, boost172, asio, openssl, zlib }:
 
 stdenv.mkDerivation rec {
   pname = "nuraft";
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ cmake ];
   buildInputs = [ boost172 asio openssl zlib ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/eBay/NuRaft";
     description = "C++ implementation of Raft core logic as a replication library";
     license = licenses.asl20;
diff --git a/pkgs/development/libraries/nuspell/default.nix b/pkgs/development/libraries/nuspell/default.nix
index cafcf96e46b11..c16305018d714 100644
--- a/pkgs/development/libraries/nuspell/default.nix
+++ b/pkgs/development/libraries/nuspell/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, pkg-config, icu, catch2, pandoc }:
+{ lib, stdenv, fetchFromGitHub, cmake, pkg-config, icu, catch2, pandoc }:
 
 stdenv.mkDerivation rec {
   pname = "nuspell";
@@ -25,7 +25,7 @@ stdenv.mkDerivation rec {
     rm -rf $out/share/doc
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Free and open source C++ spell checking library";
     homepage = "https://nuspell.github.io/";
     platforms = platforms.all;
diff --git a/pkgs/development/libraries/nv-codec-headers/default.nix b/pkgs/development/libraries/nv-codec-headers/default.nix
index 8d3c2179bff93..9b8323e6c978b 100644
--- a/pkgs/development/libraries/nv-codec-headers/default.nix
+++ b/pkgs/development/libraries/nv-codec-headers/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchgit }:
+{ lib, stdenv, fetchgit }:
 
 stdenv.mkDerivation rec {
   pname = "nv-codec-headers";
@@ -15,8 +15,8 @@ stdenv.mkDerivation rec {
   meta = {
     description = "FFmpeg version of headers for NVENC";
     homepage = "https://ffmpeg.org/";
-    license = stdenv.lib.licenses.mit;
-    maintainers = [ stdenv.lib.maintainers.MP2E ];
-    platforms = stdenv.lib.platforms.all;
+    license = lib.licenses.mit;
+    maintainers = [ lib.maintainers.MP2E ];
+    platforms = lib.platforms.all;
   };
 }
diff --git a/pkgs/development/libraries/nvidia-optical-flow-sdk/default.nix b/pkgs/development/libraries/nvidia-optical-flow-sdk/default.nix
index 667f3d94e05a3..f9c2547d4246d 100644
--- a/pkgs/development/libraries/nvidia-optical-flow-sdk/default.nix
+++ b/pkgs/development/libraries/nvidia-optical-flow-sdk/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub }:
+{ lib, stdenv, fetchFromGitHub }:
 
 stdenv.mkDerivation {
   pname = "nvidia-optical-flow-sdk";
@@ -18,7 +18,7 @@ stdenv.mkDerivation {
     cp -R * $out/include
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Nvidia optical flow headers for computing the relative motion of pixels between images";
     homepage = "https://developer.nvidia.com/opticalflow-sdk";
     license = licenses.bsd3; # applies to the header files only
diff --git a/pkgs/development/libraries/nvidia-texture-tools/default.nix b/pkgs/development/libraries/nvidia-texture-tools/default.nix
index 577f56e8c2752..676245967202e 100644
--- a/pkgs/development/libraries/nvidia-texture-tools/default.nix
+++ b/pkgs/development/libraries/nvidia-texture-tools/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, fetchpatch }:
+{ lib, stdenv, fetchFromGitHub, cmake, fetchpatch }:
 
 stdenv.mkDerivation rec {
   pname = "nvidia-texture-tools";
@@ -37,7 +37,7 @@ stdenv.mkDerivation rec {
     moveToOutput lib "$lib"
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A set of cuda-enabled texture tools and compressors";
     homepage = "https://github.com/castano/nvidia-texture-tools";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/nvidia-video-sdk/default.nix b/pkgs/development/libraries/nvidia-video-sdk/default.nix
index d08f71855882a..3a63bad03dcb4 100644
--- a/pkgs/development/libraries/nvidia-video-sdk/default.nix
+++ b/pkgs/development/libraries/nvidia-video-sdk/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, unzip }:
+{ lib, stdenv, fetchurl, unzip }:
 
 stdenv.mkDerivation {
   name = "nvidia-video-sdk-6.0.1";
@@ -18,7 +18,7 @@ stdenv.mkDerivation {
     cp -R Samples/common/inc/* $out/include
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "The NVIDIA Video Codec SDK";
     homepage = "https://developer.nvidia.com/nvidia-video-codec-sdk";
     license = licenses.unfree;
diff --git a/pkgs/development/libraries/oatpp/default.nix b/pkgs/development/libraries/oatpp/default.nix
index 38c021707615a..084f3c4a935bc 100644
--- a/pkgs/development/libraries/oatpp/default.nix
+++ b/pkgs/development/libraries/oatpp/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , cmake
 }:
@@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
   # Tests fail on darwin. See https://github.com/NixOS/nixpkgs/pull/105419#issuecomment-735826894
   doCheck = !stdenv.isDarwin;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://oatpp.io/";
     description = "Light and powerful C++ web framework for highly scalable and resource-efficient web applications";
     license = licenses.asl20;
diff --git a/pkgs/development/libraries/ocl-icd/default.nix b/pkgs/development/libraries/ocl-icd/default.nix
index 30a8790b99a42..b84aa6a146d7b 100644
--- a/pkgs/development/libraries/ocl-icd/default.nix
+++ b/pkgs/development/libraries/ocl-icd/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, ruby, opencl-headers, addOpenGLRunpath }:
+{lib, stdenv, fetchurl, ruby, opencl-headers, addOpenGLRunpath }:
 
 stdenv.mkDerivation rec {
   pname = "ocl-icd";
@@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
     sed -i 's,"/etc/OpenCL/vendors","${addOpenGLRunpath.driverLink}/etc/OpenCL/vendors",g' ocl_icd_loader.c
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "OpenCL ICD Loader for ${opencl-headers.name}";
     homepage    = "https://forge.imag.fr/projects/ocl-icd/";
     license     = licenses.bsd2;
diff --git a/pkgs/development/libraries/ode/default.nix b/pkgs/development/libraries/ode/default.nix
index d6047d1b1921a..d9c82f79bb35c 100644
--- a/pkgs/development/libraries/ode/default.nix
+++ b/pkgs/development/libraries/ode/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
   pname = "ode";
@@ -9,7 +9,7 @@ stdenv.mkDerivation rec {
     sha256 = "0l63ymlkgfp5cb0ggqwm386lxmc3al21nb7a07dd49f789d33ib5";
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Open Dynamics Engine";
     homepage = "https://sourceforge.net/projects/opende";
     platforms = platforms.linux;
diff --git a/pkgs/development/libraries/odpic/default.nix b/pkgs/development/libraries/odpic/default.nix
index 22d48c8c6092d..b79de9278d465 100644
--- a/pkgs/development/libraries/odpic/default.nix
+++ b/pkgs/development/libraries/odpic/default.nix
@@ -1,8 +1,8 @@
-{ stdenv, fetchFromGitHub, fixDarwinDylibNames, oracle-instantclient, libaio }:
+{ lib, stdenv, fetchFromGitHub, fixDarwinDylibNames, oracle-instantclient, libaio }:
 
 let
   version = "4.1.0";
-  libPath = stdenv.lib.makeLibraryPath [ oracle-instantclient.lib ];
+  libPath = lib.makeLibraryPath [ oracle-instantclient.lib ];
 
 in stdenv.mkDerivation {
   inherit version;
@@ -16,24 +16,24 @@ in stdenv.mkDerivation {
     sha256 = "1zk08z74q7njbj329xfy8aszphj27rqlkhsyglai60wfzl6mcf4x";
   };
 
-  nativeBuildInputs = stdenv.lib.optional stdenv.isDarwin fixDarwinDylibNames;
+  nativeBuildInputs = lib.optional stdenv.isDarwin fixDarwinDylibNames;
 
   buildInputs = [ oracle-instantclient ]
-    ++ stdenv.lib.optionals stdenv.isLinux [ libaio ];
+    ++ lib.optionals stdenv.isLinux [ libaio ];
 
   dontPatchELF = true;
   makeFlags = [ "PREFIX=$(out)" "CC=cc" "LD=cc"];
 
   postFixup = ''
-    ${stdenv.lib.optionalString (stdenv.isLinux) ''
+    ${lib.optionalString (stdenv.isLinux) ''
       patchelf --set-rpath "${libPath}:$(patchelf --print-rpath $out/lib/libodpic${stdenv.hostPlatform.extensions.sharedLibrary})" $out/lib/libodpic${stdenv.hostPlatform.extensions.sharedLibrary}
     ''}
-    ${stdenv.lib.optionalString (stdenv.isDarwin) ''
+    ${lib.optionalString (stdenv.isDarwin) ''
       install_name_tool -add_rpath "${libPath}" $out/lib/libodpic${stdenv.hostPlatform.extensions.sharedLibrary}
     ''}
     '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Oracle ODPI-C library";
     homepage = "https://oracle.github.io/odpi/";
     maintainers = with maintainers; [ mkazulak flokli ];
diff --git a/pkgs/development/libraries/ogdf/default.nix b/pkgs/development/libraries/ogdf/default.nix
index bbef1d8b93d6b..bee64afd2900c 100644
--- a/pkgs/development/libraries/ogdf/default.nix
+++ b/pkgs/development/libraries/ogdf/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, doxygen }:
+{ lib, stdenv, fetchFromGitHub, cmake, doxygen }:
 
 stdenv.mkDerivation rec {
   pname = "ogdf";
@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
   #> 766 |      sprintf(messageOut_,format_+2);
   hardeningDisable = [ "format" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Open Graph Drawing Framework/Open Graph algorithms and Data structure Framework";
     homepage = "http://www.ogdf.net";
     license = licenses.gpl2;
diff --git a/pkgs/development/libraries/ogre/1.10.x.nix b/pkgs/development/libraries/ogre/1.10.x.nix
index 6bf239d061e5f..849db216b9216 100644
--- a/pkgs/development/libraries/ogre/1.10.x.nix
+++ b/pkgs/development/libraries/ogre/1.10.x.nix
@@ -34,8 +34,8 @@ stdenv.mkDerivation {
   meta = {
     description = "A 3D engine";
     homepage = "https://www.ogre3d.org/";
-    maintainers = [ stdenv.lib.maintainers.raskin ];
-    platforms = stdenv.lib.platforms.linux;
-    license = stdenv.lib.licenses.mit;
+    maintainers = [ lib.maintainers.raskin ];
+    platforms = lib.platforms.linux;
+    license = lib.licenses.mit;
   };
 }
diff --git a/pkgs/development/libraries/ogre/1.9.x.nix b/pkgs/development/libraries/ogre/1.9.x.nix
index 8e0156d845287..30d1dd1855478 100644
--- a/pkgs/development/libraries/ogre/1.9.x.nix
+++ b/pkgs/development/libraries/ogre/1.9.x.nix
@@ -38,8 +38,8 @@ stdenv.mkDerivation rec {
   meta = {
     description = "A 3D engine";
     homepage = "https://www.ogre3d.org/";
-    maintainers = [ stdenv.lib.maintainers.raskin ];
-    platforms = stdenv.lib.platforms.linux;
-    license = stdenv.lib.licenses.mit;
+    maintainers = [ lib.maintainers.raskin ];
+    platforms = lib.platforms.linux;
+    license = lib.licenses.mit;
   };
 }
diff --git a/pkgs/development/libraries/ogre/default.nix b/pkgs/development/libraries/ogre/default.nix
index 8eb6db729ed6e..ae65da3f418b5 100644
--- a/pkgs/development/libraries/ogre/default.nix
+++ b/pkgs/development/libraries/ogre/default.nix
@@ -37,8 +37,8 @@ stdenv.mkDerivation rec {
   meta = {
     description = "A 3D engine";
     homepage = "https://www.ogre3d.org/";
-    maintainers = [ stdenv.lib.maintainers.raskin ];
-    platforms = stdenv.lib.platforms.linux;
-    license = stdenv.lib.licenses.mit;
+    maintainers = [ lib.maintainers.raskin ];
+    platforms = lib.platforms.linux;
+    license = lib.licenses.mit;
   };
 }
diff --git a/pkgs/development/libraries/ogrepaged/default.nix b/pkgs/development/libraries/ogrepaged/default.nix
index 7e87ac4340870..0aefedb525753 100644
--- a/pkgs/development/libraries/ogrepaged/default.nix
+++ b/pkgs/development/libraries/ogrepaged/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, fetchpatch, cmake, pkg-config, ois, ogre, libX11, boost }:
+{ lib, stdenv, fetchurl, fetchpatch, cmake, pkg-config, ois, ogre, libX11, boost }:
 
 stdenv.mkDerivation rec {
   pname = "ogre-paged";
@@ -34,7 +34,7 @@ stdenv.mkDerivation rec {
   meta = {
     description = "Paged Geometry for Ogre3D";
     homepage = "https://github.com/RigsOfRods/ogre-paged";
-    license = stdenv.lib.licenses.mit;
-    platforms = stdenv.lib.platforms.linux;
+    license = lib.licenses.mit;
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/development/libraries/ois/default.nix b/pkgs/development/libraries/ois/default.nix
index ee85e64966f62..2edbc35aa899f 100644
--- a/pkgs/development/libraries/ois/default.nix
+++ b/pkgs/development/libraries/ois/default.nix
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ libX11 ] ++ lib.optionals stdenv.isDarwin [ Cocoa IOKit Kernel ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Object-oriented C++ input system";
     maintainers = [ maintainers.raskin ];
     platforms = platforms.unix;
diff --git a/pkgs/development/libraries/olm/default.nix b/pkgs/development/libraries/olm/default.nix
index 9efe524b12d0f..4fbc34bcce63d 100644
--- a/pkgs/development/libraries/olm/default.nix
+++ b/pkgs/development/libraries/olm/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, cmake }:
+{ lib, stdenv, fetchurl, cmake }:
 
 stdenv.mkDerivation rec {
   pname = "olm";
@@ -15,8 +15,8 @@ stdenv.mkDerivation rec {
 
   meta = {
     description = "Implements double cryptographic ratchet and Megolm ratchet";
-    license = stdenv.lib.licenses.asl20;
+    license = lib.licenses.asl20;
     homepage = "https://gitlab.matrix.org/matrix-org/olm";
-    platforms = with stdenv.lib.platforms; darwin ++ linux;
+    platforms = with lib.platforms; darwin ++ linux;
   };
 }
diff --git a/pkgs/development/libraries/oniguruma/default.nix b/pkgs/development/libraries/oniguruma/default.nix
index 44420c85cf550..016207c130607 100644
--- a/pkgs/development/libraries/oniguruma/default.nix
+++ b/pkgs/development/libraries/oniguruma/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, autoreconfHook }:
+{ lib, stdenv, fetchFromGitHub, autoreconfHook }:
 
 stdenv.mkDerivation rec {
   pname = "onig";
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ autoreconfHook ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/kkos/oniguruma";
     description = "Regular expressions library";
     license = licenses.bsd2;
diff --git a/pkgs/development/libraries/opae/default.nix b/pkgs/development/libraries/opae/default.nix
index e9d501f792812..cba7e7b285d99 100644
--- a/pkgs/development/libraries/opae/default.nix
+++ b/pkgs/development/libraries/opae/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake
+{ lib, stdenv, fetchFromGitHub, cmake
 , libuuid, json_c
 , doxygen, perl, python2, python2Packages
 }:
@@ -38,7 +38,7 @@ stdenv.mkDerivation rec {
 
   cmakeFlags = [ "-DBUILD_ASE=1" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Open Programmable Acceleration Engine SDK";
     homepage    = "https://01.org/opae";
     license     = licenses.bsd3;
diff --git a/pkgs/development/libraries/openal-soft/default.nix b/pkgs/development/libraries/openal-soft/default.nix
index efc5a18f2b0f6..43c781cf52cef 100644
--- a/pkgs/development/libraries/openal-soft/default.nix
+++ b/pkgs/development/libraries/openal-soft/default.nix
@@ -1,10 +1,10 @@
-{ stdenv, fetchFromGitHub, cmake
+{ lib, stdenv, fetchFromGitHub, cmake
 , alsaSupport ? !stdenv.isDarwin, alsaLib ? null
 , pulseSupport ? !stdenv.isDarwin, libpulseaudio ? null
 , CoreServices, AudioUnit, AudioToolbox
 }:
 
-with stdenv.lib;
+with lib;
 
 assert alsaSupport -> alsaLib != null;
 assert pulseSupport -> libpulseaudio != null;
diff --git a/pkgs/development/libraries/openbabel/2.nix b/pkgs/development/libraries/openbabel/2.nix
index 41631da124169..11265c643f94f 100644
--- a/pkgs/development/libraries/openbabel/2.nix
+++ b/pkgs/development/libraries/openbabel/2.nix
@@ -5,7 +5,7 @@ stdenv.mkDerivation rec {
   version = "2.4.1";
 
   src = fetchurl {
-    url = "https://github.com/openbabel/openbabel/archive/openbabel-${stdenv.lib.replaceStrings ["."] ["-"] version}.tar.gz";
+    url = "https://github.com/openbabel/openbabel/archive/openbabel-${lib.replaceStrings ["."] ["-"] version}.tar.gz";
     sha256 = "0xm7y859ivq2cp0q08mwshfxm0jq31xkyr4x8s0j6l7khf57yk2r";
   };
 
diff --git a/pkgs/development/libraries/openbabel/default.nix b/pkgs/development/libraries/openbabel/default.nix
index 301025dfd20bb..63784d94d8f05 100644
--- a/pkgs/development/libraries/openbabel/default.nix
+++ b/pkgs/development/libraries/openbabel/default.nix
@@ -5,7 +5,7 @@ stdenv.mkDerivation rec {
   version = "3.1.1";
 
   src = fetchurl {
-    url = "https://github.com/openbabel/openbabel/archive/openbabel-${stdenv.lib.replaceStrings ["."] ["-"] version}.tar.gz";
+    url = "https://github.com/openbabel/openbabel/archive/openbabel-${lib.replaceStrings ["."] ["-"] version}.tar.gz";
     sha256 = "c97023ac6300d26176c97d4ef39957f06e68848d64f1a04b0b284ccff2744f02";
   };
 
diff --git a/pkgs/development/libraries/openbr/default.nix b/pkgs/development/libraries/openbr/default.nix
index 3e2d0f6b6e8bc..8e56e250ac405 100644
--- a/pkgs/development/libraries/openbr/default.nix
+++ b/pkgs/development/libraries/openbr/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, opencv, qtbase, qtsvg }:
+{ lib, stdenv, fetchFromGitHub, cmake, opencv, qtbase, qtsvg }:
 
 stdenv.mkDerivation {
 
@@ -19,9 +19,9 @@ stdenv.mkDerivation {
   meta = {
     description = "Open Source Biometric Recognition";
     homepage = "http://openbiometrics.org/";
-    license = stdenv.lib.licenses.asl20;
-    maintainers = with stdenv.lib.maintainers; [flosse];
-    platforms = with stdenv.lib.platforms; linux;
+    license = lib.licenses.asl20;
+    maintainers = with lib.maintainers; [flosse];
+    platforms = with lib.platforms; linux;
     broken = true;
   };
 }
diff --git a/pkgs/development/libraries/opencascade-occt/default.nix b/pkgs/development/libraries/opencascade-occt/default.nix
index ac2b8ba6d1ed0..59c1f0ef7dbc4 100644
--- a/pkgs/development/libraries/opencascade-occt/default.nix
+++ b/pkgs/development/libraries/opencascade-occt/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, fetchpatch, cmake, ninja, tcl, tk,
+{ lib, stdenv, fetchurl, fetchpatch, cmake, ninja, tcl, tk,
   libGL, libGLU, libXext, libXmu, libXi, darwin }:
 
 stdenv.mkDerivation rec {
@@ -14,9 +14,9 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ cmake ninja ];
   buildInputs = [ tcl tk libGL libGLU libXext libXmu libXi ]
-    ++ stdenv.lib.optional stdenv.isDarwin darwin.apple_sdk.frameworks.Cocoa;
+    ++ lib.optional stdenv.isDarwin darwin.apple_sdk.frameworks.Cocoa;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Open CASCADE Technology, libraries for 3D modeling and numerical simulation";
     homepage = "https://www.opencascade.org/";
     license = licenses.lgpl21;  # essentially...
diff --git a/pkgs/development/libraries/opencascade/default.nix b/pkgs/development/libraries/opencascade/default.nix
index ad17e7dcac7df..5c262a3680c54 100644
--- a/pkgs/development/libraries/opencascade/default.nix
+++ b/pkgs/development/libraries/opencascade/default.nix
@@ -1,9 +1,9 @@
-{ stdenv, fetchFromGitHub, fetchpatch, libGL, libGLU, libXmu, cmake, ninja,
+{ lib, stdenv, fetchFromGitHub, fetchpatch, libGL, libGLU, libXmu, cmake, ninja,
   pkg-config, fontconfig, freetype, expat, freeimage, vtk, gl2ps, tbb,
   OpenCL, Cocoa
 }:
 
-with stdenv.lib;
+with lib;
 stdenv.mkDerivation rec {
   pname = "opencascade-oce";
   version = "0.18.3";
diff --git a/pkgs/development/libraries/opencl-clang/default.nix b/pkgs/development/libraries/opencl-clang/default.nix
index 8b7df317b2ba3..8bbde9796d9a8 100644
--- a/pkgs/development/libraries/opencl-clang/default.nix
+++ b/pkgs/development/libraries/opencl-clang/default.nix
@@ -1,4 +1,5 @@
-{ stdenv
+{ lib
+, stdenv
 , fetchFromGitHub
 , fetchpatch
 , cmake
@@ -15,10 +16,10 @@ let
     inherit spirv-llvm-translator;
   };
 
-  inherit (stdenv.lib) getVersion;
+  inherit (lib) getVersion;
 
   addPatches = component: pkg:
-    with builtins; with stdenv.lib;
+    with builtins; with lib;
     let path = "${passthru.patchesOut}/${component}";
     in pkg.overrideAttrs (super: {
       postPatch = (if super ? postPatch then super.postPatch + "\n" else "") + ''
@@ -39,7 +40,7 @@ let
 
     patchesOut = stdenv.mkDerivation rec {
       pname = "opencl-clang-patches";
-      inherit (lib) version src patches;
+      inherit (library) version src patches;
       installPhase = ''
         [ -d patches ] && cp -r patches/ $out || mkdir $out
         mkdir -p $out/clang $out/spirv
@@ -50,7 +51,7 @@ let
 
   };
 
-  lib = let
+  library = let
     inherit (llvmPkgs) llvm;
     inherit (if buildWithPatches then passthru else llvmPkgs) clang-unwrapped spirv-llvm-translator;
   in
@@ -85,7 +86,7 @@ let
         "-DSPIRV_TRANSLATOR_DIR=${spirv-llvm-translator}"
       ];
 
-      meta = with stdenv.lib; {
+      meta = with lib; {
         homepage    = "https://github.com/intel/opencl-clang/";
         description = "A clang wrapper library with an OpenCL-oriented API and the ability to compile OpenCL C kernels to SPIR-V modules";
         license     = licenses.ncsa;
@@ -94,4 +95,4 @@ let
       };
     };
 in
-  lib
+  library
diff --git a/pkgs/development/libraries/opencl-clhpp/default.nix b/pkgs/development/libraries/opencl-clhpp/default.nix
index 1486ea93175b3..ec40bc393d513 100644
--- a/pkgs/development/libraries/opencl-clhpp/default.nix
+++ b/pkgs/development/libraries/opencl-clhpp/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, python, opencl-headers }:
+{ lib, stdenv, fetchFromGitHub, cmake, python, opencl-headers }:
 
 stdenv.mkDerivation rec {
   pname = "opencl-clhpp";
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
     "-DBUILD_TESTS=OFF"
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "OpenCL Host API C++ bindings";
     homepage = "http://github.khronos.org/OpenCL-CLHPP/";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/opencl-headers/default.nix b/pkgs/development/libraries/opencl-headers/default.nix
index aaf6390d00a53..1ef27bf58316b 100644
--- a/pkgs/development/libraries/opencl-headers/default.nix
+++ b/pkgs/development/libraries/opencl-headers/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub
+{ lib, stdenv, fetchFromGitHub
 }:
 
 stdenv.mkDerivation rec {
@@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
     cp CL/* $out/include/CL
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Khronos OpenCL headers version ${version}";
     homepage = "https://www.khronos.org/registry/cl/";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/opencollada/default.nix b/pkgs/development/libraries/opencollada/default.nix
index a9c26d00e3ac9..d058221743394 100644
--- a/pkgs/development/libraries/opencollada/default.nix
+++ b/pkgs/development/libraries/opencollada/default.nix
@@ -28,8 +28,8 @@ stdenv.mkDerivation rec {
   meta = {
     description = "A library for handling the COLLADA file format";
     homepage = "https://github.com/KhronosGroup/OpenCOLLADA/";
-    maintainers = [ stdenv.lib.maintainers.eelco ];
-    platforms = stdenv.lib.platforms.unix;
-    license = stdenv.lib.licenses.mit;
+    maintainers = [ lib.maintainers.eelco ];
+    platforms = lib.platforms.unix;
+    license = lib.licenses.mit;
   };
 }
diff --git a/pkgs/development/libraries/opencolorio/default.nix b/pkgs/development/libraries/opencolorio/default.nix
index 6745d6bf0ce79..8908f4866156c 100644
--- a/pkgs/development/libraries/opencolorio/default.nix
+++ b/pkgs/development/libraries/opencolorio/default.nix
@@ -37,7 +37,7 @@ stdenv.mkDerivation rec {
     mkdir -p $bin/bin; mv $out/bin $bin/
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://opencolorio.org";
     description = "A color management framework for visual effects and animation";
     license = licenses.bsd3;
diff --git a/pkgs/development/libraries/opencore-amr/default.nix b/pkgs/development/libraries/opencore-amr/default.nix
index f011def0eb90c..d1348d96e3b14 100644
--- a/pkgs/development/libraries/opencore-amr/default.nix
+++ b/pkgs/development/libraries/opencore-amr/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 let
     version = "0.1.5";
@@ -15,7 +15,7 @@ stdenv.mkDerivation {
     homepage = "https://opencore-amr.sourceforge.io/";
     description = "Library of OpenCORE Framework implementation of Adaptive Multi Rate Narrowband and Wideband (AMR-NB and AMR-WB) speech codec.
     Library of VisualOn implementation of Adaptive Multi Rate Wideband (AMR-WB)";
-    license = stdenv.lib.licenses.asl20;
-    maintainers = [ stdenv.lib.maintainers.kiloreux ];
+    license = lib.licenses.asl20;
+    maintainers = [ lib.maintainers.kiloreux ];
   };
 }
diff --git a/pkgs/development/libraries/opencsg/default.nix b/pkgs/development/libraries/opencsg/default.nix
index 00d489508add0..53adbdf414f7c 100644
--- a/pkgs/development/libraries/opencsg/default.nix
+++ b/pkgs/development/libraries/opencsg/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, libGLU, libGL, freeglut, glew, libXmu, libXext, libX11
+{lib, stdenv, fetchurl, libGLU, libGL, freeglut, glew, libXmu, libXext, libX11
 , qmake, GLUT, fixDarwinDylibNames }:
 
 stdenv.mkDerivation rec {
@@ -10,11 +10,11 @@ stdenv.mkDerivation rec {
   };
 
   nativeBuildInputs = [ qmake ]
-    ++ stdenv.lib.optional stdenv.isDarwin fixDarwinDylibNames;
+    ++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
 
   buildInputs = [ glew ]
-    ++ stdenv.lib.optionals stdenv.isLinux [ libGLU libGL freeglut libXmu libXext libX11 ]
-    ++ stdenv.lib.optional stdenv.isDarwin GLUT;
+    ++ lib.optionals stdenv.isLinux [ libGLU libGL freeglut libXmu libXext libX11 ]
+    ++ lib.optional stdenv.isDarwin GLUT;
 
   doCheck = false;
 
@@ -27,13 +27,13 @@ stdenv.mkDerivation rec {
 
   postInstall = ''
     install -D license.txt "$out/share/doc/opencsg/license.txt"
-  '' + stdenv.lib.optionalString stdenv.isDarwin ''
+  '' + lib.optionalString stdenv.isDarwin ''
     mkdir -p $out/Applications
     mv $out/bin/*.app $out/Applications
     rmdir $out/bin || true
   '';
 
-  postFixup = stdenv.lib.optionalString stdenv.isDarwin ''
+  postFixup = lib.optionalString stdenv.isDarwin ''
     app=$out/Applications/opencsgexample.app/Contents/MacOS/opencsgexample
     install_name_tool -change \
       $(otool -L $app | awk '/opencsg.+dylib/ { print $1 }') \
@@ -41,7 +41,7 @@ stdenv.mkDerivation rec {
       $app
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Constructive Solid Geometry library";
     homepage = "http://www.opencsg.org/";
     platforms = platforms.unix;
diff --git a/pkgs/development/libraries/openct/default.nix b/pkgs/development/libraries/openct/default.nix
index c0a021a9d3b43..92dec5ee2334c 100644
--- a/pkgs/development/libraries/openct/default.nix
+++ b/pkgs/development/libraries/openct/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, autoreconfHook, pkg-config, pcsclite, libusb-compat-0_1
+{ lib, stdenv, fetchFromGitHub, autoreconfHook, pkg-config, pcsclite, libusb-compat-0_1
 , doxygen, libxslt
 }:
 
@@ -32,7 +32,7 @@ stdenv.mkDerivation rec {
     mkdir -p $out/etc
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/OpenSC/openct/";
     license = licenses.lgpl21;
     description = "Drivers for several smart card readers";
diff --git a/pkgs/development/libraries/opencv/3.x.nix b/pkgs/development/libraries/opencv/3.x.nix
index 8a8468080801a..11872cd47cc31 100644
--- a/pkgs/development/libraries/opencv/3.x.nix
+++ b/pkgs/development/libraries/opencv/3.x.nix
@@ -269,7 +269,7 @@ stdenv.mkDerivation {
 
   passthru = lib.optionalAttrs enablePython { pythonPath = []; };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Open Computer Vision Library with more than 500 algorithms";
     homepage = "https://opencv.org/";
     license = with licenses; if enableUnfree then unfree else bsd3;
diff --git a/pkgs/development/libraries/opencv/4.x.nix b/pkgs/development/libraries/opencv/4.x.nix
index 3d845b7368b69..c9ac76b655449 100644
--- a/pkgs/development/libraries/opencv/4.x.nix
+++ b/pkgs/development/libraries/opencv/4.x.nix
@@ -278,7 +278,7 @@ stdenv.mkDerivation {
 
   passthru = lib.optionalAttrs enablePython { pythonPath = []; };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Open Computer Vision Library with more than 500 algorithms";
     homepage = "https://opencv.org/";
     license = with licenses; if enableUnfree then unfree else bsd3;
diff --git a/pkgs/development/libraries/opencv/default.nix b/pkgs/development/libraries/opencv/default.nix
index 0d4d2c6e00187..2575f6bb45d5f 100644
--- a/pkgs/development/libraries/opencv/default.nix
+++ b/pkgs/development/libraries/opencv/default.nix
@@ -79,7 +79,7 @@ stdenv.mkDerivation rec {
 
   passthru = lib.optionalAttrs enablePython { pythonPath = []; };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Open Computer Vision Library with more than 500 algorithms";
     homepage = "https://opencv.org/";
     license = licenses.bsd3;
diff --git a/pkgs/development/libraries/opendbx/default.nix b/pkgs/development/libraries/opendbx/default.nix
index 954e6cc6b663f..a9eb209edda8c 100644
--- a/pkgs/development/libraries/opendbx/default.nix
+++ b/pkgs/development/libraries/opendbx/default.nix
@@ -1,6 +1,6 @@
-{ stdenv, fetchurl, readline, libmysqlclient, postgresql, sqlite }:
+{ lib, stdenv, fetchurl, readline, libmysqlclient, postgresql, sqlite }:
 
-let inherit (stdenv.lib) getDev; in
+let inherit (lib) getDev; in
 
 stdenv.mkDerivation rec {
   name = "opendbx-1.4.6";
@@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ readline libmysqlclient postgresql sqlite ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Extremely lightweight but extensible database access library written in C";
     license = licenses.lgpl21;
     platforms = platforms.all;
diff --git a/pkgs/development/libraries/opendht/default.nix b/pkgs/development/libraries/opendht/default.nix
index e160bfb7d367b..7f4f186c923d5 100644
--- a/pkgs/development/libraries/opendht/default.nix
+++ b/pkgs/development/libraries/opendht/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub
+{ lib, stdenv, fetchFromGitHub
 , cmake, pkg-config
 , asio, nettle, gnutls, msgpack, readline, libargon2
 }:
@@ -30,7 +30,7 @@ stdenv.mkDerivation rec {
 
   outputs = [ "out" "lib" "dev" "man" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A C++11 Kademlia distributed hash table implementation";
     homepage    = "https://github.com/savoirfairelinux/opendht";
     license     = licenses.gpl3Plus;
diff --git a/pkgs/development/libraries/opendkim/default.nix b/pkgs/development/libraries/opendkim/default.nix
index b40b3bc4def50..90c7fb85d426a 100644
--- a/pkgs/development/libraries/opendkim/default.nix
+++ b/pkgs/development/libraries/opendkim/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, libbsd, openssl, libmilter
+{ lib, stdenv, fetchurl, pkg-config, libbsd, openssl, libmilter
 , autoreconfHook, perl, makeWrapper }:
 
 stdenv.mkDerivation rec {
@@ -27,7 +27,7 @@ stdenv.mkDerivation rec {
       --prefix PATH : ${openssl.bin}/bin
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "C library for producing DKIM-aware applications and an open source milter for providing DKIM service";
     homepage = "http://www.opendkim.org/";
     maintainers = with maintainers; [ abbradar ];
diff --git a/pkgs/development/libraries/opendmarc/default.nix b/pkgs/development/libraries/opendmarc/default.nix
index 9b45cc244f260..0dedfa3a85ede 100644
--- a/pkgs/development/libraries/opendmarc/default.nix
+++ b/pkgs/development/libraries/opendmarc/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, autoreconfHook, libmilter, perl, perlPackages, makeWrapper }:
+{ lib, stdenv, fetchFromGitHub, autoreconfHook, libmilter, perl, perlPackages, makeWrapper }:
 
 stdenv.mkDerivation rec {
   pname = "opendmarc";
@@ -31,7 +31,7 @@ stdenv.mkDerivation rec {
     done
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A free open source software implementation of the DMARC specification";
     homepage = "http://www.trusteddomain.org/opendmarc/";
     license = with licenses; [ bsd3 sendmail ];
diff --git a/pkgs/development/libraries/openexr/default.nix b/pkgs/development/libraries/openexr/default.nix
index b33b284f45cbf..4e04de30d6549 100644
--- a/pkgs/development/libraries/openexr/default.nix
+++ b/pkgs/development/libraries/openexr/default.nix
@@ -32,7 +32,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ cmake ];
   propagatedBuildInputs = [ ilmbase zlib ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A high dynamic-range (HDR) image file format";
     homepage = "https://www.openexr.com/";
     license = licenses.bsd3;
diff --git a/pkgs/development/libraries/openexrid-unstable/default.nix b/pkgs/development/libraries/openexrid-unstable/default.nix
index 92cd343cf6a1e..ce35aa1c655e6 100644
--- a/pkgs/development/libraries/openexrid-unstable/default.nix
+++ b/pkgs/development/libraries/openexrid-unstable/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, unzip, re2, openfx, zlib, ilmbase, libGLU, libGL, openexr }:
+{ lib, stdenv, fetchFromGitHub, unzip, re2, openfx, zlib, ilmbase, libGLU, libGL, openexr }:
 
 stdenv.mkDerivation {
   pname = "openexrid-unstable";
@@ -44,7 +44,7 @@ stdenv.mkDerivation {
       mv $out/lib $lib/
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "OpenEXR files able to isolate any object of a CG image with a perfect antialiazing";
     homepage = "https://github.com/MercenariesEngineering/openexrid";
     maintainers = [ maintainers.guibou ];
diff --git a/pkgs/development/libraries/openfst/default.nix b/pkgs/development/libraries/openfst/default.nix
index f652c5ee7b7ca..51e661eabb3b0 100644
--- a/pkgs/development/libraries/openfst/default.nix
+++ b/pkgs/development/libraries/openfst/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, autoreconfHook }:
+{ lib, stdenv, fetchurl, autoreconfHook }:
 
 stdenv.mkDerivation rec {
   pname = "openfst";
@@ -25,7 +25,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ autoreconfHook ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Library for working with finite-state transducers";
     longDescription = ''
       Library for constructing, combining, optimizing, and searching weighted finite-state transducers (FSTs).
diff --git a/pkgs/development/libraries/openfx/default.nix b/pkgs/development/libraries/openfx/default.nix
index 4a7927bfcb2e6..0d8afe53df8be 100644
--- a/pkgs/development/libraries/openfx/default.nix
+++ b/pkgs/development/libraries/openfx/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, unzip }:
+{ lib, stdenv, fetchFromGitHub, unzip }:
 
 stdenv.mkDerivation {
   pname = "openfx";
@@ -27,7 +27,7 @@ stdenv.mkDerivation {
      cp -r include/* $dev/include/OpenFX/
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Image processing plug-in standard";
     homepage = "http://openeffects.org/";
     license = licenses.bsd3;
diff --git a/pkgs/development/libraries/opengrm-ngram/default.nix b/pkgs/development/libraries/opengrm-ngram/default.nix
index ab546c6d0d459..9b105808b8bbd 100644
--- a/pkgs/development/libraries/opengrm-ngram/default.nix
+++ b/pkgs/development/libraries/opengrm-ngram/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, autoreconfHook, fetchurl, openfst }:
+{ lib, stdenv, autoreconfHook, fetchurl, openfst }:
 
 stdenv.mkDerivation rec {
   pname = "opengrm-ngram";
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Library to make and modify n-gram language models encoded as weighted finite-state transducers";
     homepage = "http://www.openfst.org/twiki/bin/view/GRM/NGramLibrary";
     license = licenses.asl20;
diff --git a/pkgs/development/libraries/openh264/default.nix b/pkgs/development/libraries/openh264/default.nix
index ee430f800dd3a..6e856b04ac4a8 100644
--- a/pkgs/development/libraries/openh264/default.nix
+++ b/pkgs/development/libraries/openh264/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, nasm }:
+{ lib, stdenv, fetchFromGitHub, nasm }:
 
 stdenv.mkDerivation rec {
   pname = "openh264";
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
 
   makeFlags = [ "PREFIX=${placeholder "out"}" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A codec library which supports H.264 encoding and decoding";
     homepage = "https://www.openh264.org";
     license = licenses.bsd2;
diff --git a/pkgs/development/libraries/openhmd/default.nix b/pkgs/development/libraries/openhmd/default.nix
index ab1b9b7b1ddce..a692dcb5e4e39 100644
--- a/pkgs/development/libraries/openhmd/default.nix
+++ b/pkgs/development/libraries/openhmd/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , cmake
 , pkg-config
@@ -26,7 +26,7 @@ stdenv.mkDerivation rec {
 
   buildInputs = [
     hidapi
-  ] ++ stdenv.lib.optionals withExamples [
+  ] ++ lib.optionals withExamples [
     SDL2
     glew
     libGL
@@ -39,13 +39,13 @@ stdenv.mkDerivation rec {
     "-DOpenGL_GL_PREFERENCE=GLVND"
   ];
 
-  postInstall = stdenv.lib.optionalString withExamples ''
+  postInstall = lib.optionalString withExamples ''
     mkdir -p $out/bin
     install -D examples/simple/simple $out/bin/openhmd-example-simple
     install -D examples/opengl/openglexample $out/bin/openhmd-example-opengl
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://www.openhmd.net"; # https does not work
     description = "Library API and drivers immersive technology";
     longDescription = ''
diff --git a/pkgs/development/libraries/openimagedenoise/default.nix b/pkgs/development/libraries/openimagedenoise/default.nix
index 2ac74c6c240bd..03f9118ef7c03 100644
--- a/pkgs/development/libraries/openimagedenoise/default.nix
+++ b/pkgs/development/libraries/openimagedenoise/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchzip, cmake, tbb, python, ispc }:
+{ lib, stdenv, fetchzip, cmake, tbb, python, ispc }:
 
 stdenv.mkDerivation rec {
   pname = "openimagedenoise";
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ cmake python ispc ];
   buildInputs = [ tbb ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://openimagedenoise.github.io";
     description = "High-Performance Denoising Library for Ray Tracing";
     license = licenses.asl20;
diff --git a/pkgs/development/libraries/openjpeg/generic.nix b/pkgs/development/libraries/openjpeg/generic.nix
index 5ed35844eb0ab..8c1f18b987d5f 100644
--- a/pkgs/development/libraries/openjpeg/generic.nix
+++ b/pkgs/development/libraries/openjpeg/generic.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, pkg-config
+{ lib, stdenv, fetchFromGitHub, cmake, pkg-config
 , libpng, libtiff, lcms2, jpylyzer
 , mj2Support ? true # MJ2 executables
 , jpwlLibSupport ? true # JPWL library & executables
@@ -19,7 +19,7 @@ assert jpipServerSupport -> jpipLibSupport && curl != null && fcgi != null;
 assert (openjpegJarSupport || jpipLibSupport) -> jdk != null;
 
 let
-  inherit (stdenv.lib) optional optionals;
+  inherit (lib) optional optionals;
   mkFlag = optSet: flag: "-D${flag}=${if optSet then "ON" else "OFF"}";
 in
 
@@ -74,7 +74,7 @@ stdenv.mkDerivation {
     incDir = "openjpeg-${branch}";
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Open-source JPEG 2000 codec written in C language";
     homepage = "https://www.openjpeg.org/";
     license = licenses.bsd2;
diff --git a/pkgs/development/libraries/openldap/default.nix b/pkgs/development/libraries/openldap/default.nix
index fdf3298a6fad2..4d4ec1763f0ff 100644
--- a/pkgs/development/libraries/openldap/default.nix
+++ b/pkgs/development/libraries/openldap/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, openssl, cyrus_sasl, db, groff, libtool }:
+{ lib, stdenv, fetchurl, openssl, cyrus_sasl, db, groff, libtool }:
 
 stdenv.mkDerivation rec {
   pname = "openldap";
@@ -34,12 +34,12 @@ stdenv.mkDerivation rec {
     "--sysconfdir=/etc"
     "--localstatedir=/var"
     "--enable-crypt"
-  ] ++ stdenv.lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
+  ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
     "--with-yielding_select=yes"
     "ac_cv_func_memcmp_working=yes"
-  ] ++ stdenv.lib.optional (openssl == null) "--without-tls"
-    ++ stdenv.lib.optional (cyrus_sasl == null) "--without-cyrus-sasl"
-    ++ stdenv.lib.optional stdenv.isFreeBSD "--with-pic";
+  ] ++ lib.optional (openssl == null) "--without-tls"
+    ++ lib.optional (cyrus_sasl == null) "--without-cyrus-sasl"
+    ++ lib.optional stdenv.isFreeBSD "--with-pic";
 
   postBuild = ''
     make $makeFlags CC=$CC -C contrib/slapd-modules/passwd/sha2
@@ -75,7 +75,7 @@ stdenv.mkDerivation rec {
     chmod +x "$out"/lib/*.{so,dylib}
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://www.openldap.org/";
     description = "An open source implementation of the Lightweight Directory Access Protocol";
     license = licenses.openldap;
diff --git a/pkgs/development/libraries/openmpi/default.nix b/pkgs/development/libraries/openmpi/default.nix
index 95c2a9c3fcf4d..802685970ace6 100644
--- a/pkgs/development/libraries/openmpi/default.nix
+++ b/pkgs/development/libraries/openmpi/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, fetchpatch, gfortran, perl, libnl
+{ lib, stdenv, fetchurl, fetchpatch, gfortran, perl, libnl
 , rdma-core, zlib, numactl, libevent, hwloc, targetPackages, symlinkJoin
 , libpsm2, libfabric, pmix, ucx
 
@@ -28,7 +28,7 @@ in stdenv.mkDerivation rec {
   pname = "openmpi";
   inherit version;
 
-  src = with stdenv.lib.versions; fetchurl {
+  src = with lib.versions; fetchurl {
     url = "https://www.open-mpi.org/software/ompi/v${major version}.${minor version}/downloads/${pname}-${version}.tar.bz2";
     sha256 = "02f0r9d3xgs08svkmj8v7lzviyxqnkk4yd3z0wql550xnriki3y5";
   };
@@ -97,7 +97,7 @@ in stdenv.mkDerivation rec {
     inherit cudaSupport cudatoolkit;
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://www.open-mpi.org/";
     description = "Open source MPI-3 implementation";
     longDescription = "The Open MPI Project is an open source MPI-3 implementation that is developed and maintained by a consortium of academic, research, and industry partners. Open MPI is therefore able to combine the expertise, technologies, and resources from all across the High Performance Computing community in order to build the best MPI library available. Open MPI offers advantages for system and software vendors, application developers and computer science researchers.";
diff --git a/pkgs/development/libraries/openpa/default.nix b/pkgs/development/libraries/openpa/default.nix
index 46729f660b14a..3a6416122bfaa 100644
--- a/pkgs/development/libraries/openpa/default.nix
+++ b/pkgs/development/libraries/openpa/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, file }:
+{ lib, stdenv, fetchurl, file }:
 
 stdenv.mkDerivation rec {
   pname = "openpa";
@@ -16,9 +16,9 @@ stdenv.mkDerivation rec {
   meta = {
     description = "Atomic primitives for high performance, concurrent software";
     homepage = "https://trac.mpich.org/projects/openpa";
-    license = stdenv.lib.licenses.mit;
-    maintainers = with stdenv.lib.maintainers; [ leenaars ];
-    platforms = with stdenv.lib.platforms; linux;
+    license = lib.licenses.mit;
+    maintainers = with lib.maintainers; [ leenaars ];
+    platforms = with lib.platforms; linux;
     longDescription = ''
       OPA (or sometimes OpenPA or Open Portable Atomics) is an
       open source library intended to provide a consistent C API for performing
diff --git a/pkgs/development/libraries/opensaml-cpp/default.nix b/pkgs/development/libraries/opensaml-cpp/default.nix
index 779e17e4c811b..4f83f22856e34 100644
--- a/pkgs/development/libraries/opensaml-cpp/default.nix
+++ b/pkgs/development/libraries/opensaml-cpp/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchgit, autoreconfHook, pkg-config
+{ lib, stdenv, fetchgit, autoreconfHook, pkg-config
 , boost, openssl, log4shib, xercesc, xml-security-c, xml-tooling-c, zlib
 }:
 
@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage    = "https://shibboleth.net/products/opensaml-cpp.html";
     description = "A low-level library written in C++ that provides support for producing and consuming SAML messages";
     platforms   = platforms.unix;
diff --git a/pkgs/development/libraries/openscenegraph/default.nix b/pkgs/development/libraries/openscenegraph/default.nix
index 78c37e94b9355..8eeff3de94352 100644
--- a/pkgs/development/libraries/openscenegraph/default.nix
+++ b/pkgs/development/libraries/openscenegraph/default.nix
@@ -66,7 +66,7 @@ stdenv.mkDerivation rec {
 
   cmakeFlags = lib.optional (!withApps) "-DBUILD_OSG_APPLICATIONS=OFF" ++ lib.optional withExamples "-DBUILD_OSG_EXAMPLES=ON";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A 3D graphics toolkit";
     homepage = "http://www.openscenegraph.org/";
     maintainers = with maintainers; [ aanderse raskin ];
diff --git a/pkgs/development/libraries/openslp/default.nix b/pkgs/development/libraries/openslp/default.nix
index 68cb40abf7238..ddc0e893596fd 100644
--- a/pkgs/development/libraries/openslp/default.nix
+++ b/pkgs/development/libraries/openslp/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, fetchpatch }:
+{ lib, stdenv, fetchurl, fetchpatch }:
 
 stdenv.mkDerivation {
   name = "openslp-2.0.0";
@@ -22,7 +22,7 @@ stdenv.mkDerivation {
     ./CVE-2016-4912.patch
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://www.openslp.org/";
     description = "An open-source implementation of the IETF Service Location Protocol";
     maintainers = with maintainers; [ ttuegel ];
diff --git a/pkgs/development/libraries/openssl/chacha.nix b/pkgs/development/libraries/openssl/chacha.nix
index b37142082d816..bae3e53f441f3 100644
--- a/pkgs/development/libraries/openssl/chacha.nix
+++ b/pkgs/development/libraries/openssl/chacha.nix
@@ -1,8 +1,8 @@
-{ stdenv, fetchFromGitHub, perl, zlib
+{ lib, stdenv, fetchFromGitHub, perl, zlib
 , withCryptodev ? false, cryptodev
 }:
 
-with stdenv.lib;
+with lib;
 stdenv.mkDerivation {
   pname = "openssl-chacha";
   version = "2016-08-22";
@@ -18,7 +18,7 @@ stdenv.mkDerivation {
   setOutputFlags = false;
 
   nativeBuildInputs = [ perl zlib ];
-  buildInputs = stdenv.lib.optional withCryptodev cryptodev;
+  buildInputs = lib.optional withCryptodev cryptodev;
 
   configureScript = "./config";
 
@@ -32,7 +32,7 @@ stdenv.mkDerivation {
     "enable-gost"
     "--libdir=lib"
     "--openssldir=etc/ssl"
-  ] ++ stdenv.lib.optionals withCryptodev [
+  ] ++ lib.optionals withCryptodev [
     "-DHAVE_CRYPTODEV"
     "-DUSE_CRYPTODEV_DIGESTS"
   ];
@@ -75,7 +75,7 @@ stdenv.mkDerivation {
     homepage = "https://www.openssl.org/";
     description = "A cryptographic library that implements the SSL and TLS protocols";
     platforms = [ "x86_64-linux" ];
-    maintainers = [ stdenv.lib.maintainers.cstrahan ];
+    maintainers = [ lib.maintainers.cstrahan ];
     license = licenses.openssl;
     priority = 10; # resolves collision with ‘man-pages’
   };
diff --git a/pkgs/development/libraries/openssl/default.nix b/pkgs/development/libraries/openssl/default.nix
index 2570c7cdb25a6..ce4374be33126 100644
--- a/pkgs/development/libraries/openssl/default.nix
+++ b/pkgs/development/libraries/openssl/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, buildPackages, perl, coreutils
+{ lib, stdenv, fetchurl, buildPackages, perl, coreutils
 , withCryptodev ? false, cryptodev
 , enableSSL2 ? false
 , enableSSL3 ? false
@@ -10,7 +10,7 @@
 # cgit) that are needed here should be included directly in Nixpkgs as
 # files.
 
-with stdenv.lib;
+with lib;
 
 let
   common = { version, sha256, patches ? [], withDocs ? false, extraMeta ? {} }:
@@ -46,7 +46,7 @@ let
     separateDebugInfo = !(stdenv.hostPlatform.useLLVM or false) && stdenv.cc.isGNU;
 
     nativeBuildInputs = [ perl ];
-    buildInputs = stdenv.lib.optional withCryptodev cryptodev;
+    buildInputs = lib.optional withCryptodev cryptodev;
 
     # TODO(@Ericson2314): Improve with mass rebuild
     configurePlatforms = [];
@@ -78,16 +78,16 @@ let
       "shared" # "shared" builds both shared and static libraries
       "--libdir=lib"
       "--openssldir=etc/ssl"
-    ] ++ stdenv.lib.optionals withCryptodev [
+    ] ++ lib.optionals withCryptodev [
       "-DHAVE_CRYPTODEV"
       "-DUSE_CRYPTODEV_DIGESTS"
-    ] ++ stdenv.lib.optional enableSSL2 "enable-ssl2"
-      ++ stdenv.lib.optional enableSSL3 "enable-ssl3"
-      ++ stdenv.lib.optional (versionAtLeast version "1.1.0" && stdenv.hostPlatform.isAarch64) "no-afalgeng"
+    ] ++ lib.optional enableSSL2 "enable-ssl2"
+      ++ lib.optional enableSSL3 "enable-ssl3"
+      ++ lib.optional (versionAtLeast version "1.1.0" && stdenv.hostPlatform.isAarch64) "no-afalgeng"
       # OpenSSL needs a specific `no-shared` configure flag.
       # See https://wiki.openssl.org/index.php/Compilation_and_Installation#Configure_Options
       # for a comprehensive list of configuration options.
-      ++ stdenv.lib.optional (versionAtLeast version "1.1.0" && static) "no-shared";
+      ++ lib.optional (versionAtLeast version "1.1.0" && static) "no-shared";
 
     makeFlags = [
       "MANDIR=$(man)/share/man"
@@ -101,7 +101,7 @@ let
     enableParallelBuilding = true;
 
     postInstall =
-    stdenv.lib.optionalString (!static) ''
+    lib.optionalString (!static) ''
       # If we're building dynamic libraries, then don't install static
       # libraries.
       if [ -n "$(echo $out/lib/*.so $out/lib/*.dylib $out/lib/*.dll)" ]; then
@@ -111,7 +111,7 @@ let
     '' +
     ''
       mkdir -p $bin
-    '' + stdenv.lib.optionalString (!stdenv.hostPlatform.isWindows)
+    '' + lib.optionalString (!stdenv.hostPlatform.isWindows)
     ''
       substituteInPlace $out/bin/c_rehash --replace ${buildPackages.perl} ${perl}
     '' +
@@ -127,7 +127,7 @@ let
       rmdir $out/etc/ssl/{certs,private}
     '';
 
-    postFixup = stdenv.lib.optionalString (!stdenv.hostPlatform.isWindows) ''
+    postFixup = lib.optionalString (!stdenv.hostPlatform.isWindows) ''
       # Check to make sure the main output doesn't depend on perl
       if grep -r '${buildPackages.perl}' $out; then
         echo "Found an erroneous dependency on perl ^^^" >&2
@@ -135,7 +135,7 @@ let
       fi
     '';
 
-    meta = with stdenv.lib; {
+    meta = with lib; {
       homepage = "https://www.openssl.org/";
       description = "A cryptographic library that implements the SSL and TLS protocols";
       license = licenses.openssl;
diff --git a/pkgs/development/libraries/opentracing-cpp/default.nix b/pkgs/development/libraries/opentracing-cpp/default.nix
index 76342abaa2d1d..9c99ee6027ddb 100644
--- a/pkgs/development/libraries/opentracing-cpp/default.nix
+++ b/pkgs/development/libraries/opentracing-cpp/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake }:
+{ lib, stdenv, fetchFromGitHub, cmake }:
 stdenv.mkDerivation rec {
   pname = "opentracing-cpp";
   version = "1.5.1";
@@ -14,8 +14,8 @@ stdenv.mkDerivation rec {
   meta = {
     description = "C++ implementation of the OpenTracing API";
     homepage = "https://opentracing.io";
-    license = stdenv.lib.licenses.asl20;
-    maintainers = with stdenv.lib.maintainers; [ rob ];
+    license = lib.licenses.asl20;
+    maintainers = with lib.maintainers; [ rob ];
   };
 
 }
diff --git a/pkgs/development/libraries/openvdb/default.nix b/pkgs/development/libraries/openvdb/default.nix
index 38e50fb367e13..5f3a03a3f5bf3 100644
--- a/pkgs/development/libraries/openvdb/default.nix
+++ b/pkgs/development/libraries/openvdb/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, unzip, openexr, boost, jemalloc, c-blosc, ilmbase, tbb }:
+{ lib, stdenv, fetchFromGitHub, unzip, openexr, boost, jemalloc, c-blosc, ilmbase, tbb }:
 
 stdenv.mkDerivation rec
 {
@@ -40,7 +40,7 @@ stdenv.mkDerivation rec
   NIX_CFLAGS_COMPILE="-I${openexr.dev}/include/OpenEXR -I${ilmbase.dev}/include/OpenEXR/";
   NIX_LDFLAGS="-lboost_iostreams";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "An open framework for voxel";
     homepage = "https://www.openvdb.org";
     maintainers = [ maintainers.guibou ];
diff --git a/pkgs/development/libraries/openwsman/default.nix b/pkgs/development/libraries/openwsman/default.nix
index e139a1f509c00..05f1ef65a304f 100644
--- a/pkgs/development/libraries/openwsman/default.nix
+++ b/pkgs/development/libraries/openwsman/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, pkg-config
+{ lib, stdenv, fetchFromGitHub, cmake, pkg-config
 , curl, libxml2, pam, sblim-sfcc }:
 
 stdenv.mkDerivation rec {
@@ -28,7 +28,7 @@ stdenv.mkDerivation rec {
 
   configureFlags = [ "--disable-more-warnings" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description  = "Openwsman server implementation and client API with bindings";
     downloadPage = "https://github.com/Openwsman/openwsman/releases";
     homepage     = "https://openwsman.github.io";
diff --git a/pkgs/development/libraries/openxr-loader/default.nix b/pkgs/development/libraries/openxr-loader/default.nix
index 415846dd2fab5..2f901f0e4128d 100644
--- a/pkgs/development/libraries/openxr-loader/default.nix
+++ b/pkgs/development/libraries/openxr-loader/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, python3, libX11, libXxf86vm, libXrandr, vulkan-headers, libGL }:
+{ lib, stdenv, fetchFromGitHub, cmake, python3, libX11, libXxf86vm, libXrandr, vulkan-headers, libGL }:
 
 stdenv.mkDerivation rec {
   pname = "openxr-loader";
@@ -29,7 +29,7 @@ stdenv.mkDerivation rec {
     mv "$out/lib/libXrApiLayer"* "$layers/lib"
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Khronos OpenXR loader";
     homepage    = "https://www.khronos.org/openxr";
     platforms   = platforms.linux;
diff --git a/pkgs/development/libraries/openzwave/default.nix b/pkgs/development/libraries/openzwave/default.nix
index 641776cc94462..0a617561a8928 100644
--- a/pkgs/development/libraries/openzwave/default.nix
+++ b/pkgs/development/libraries/openzwave/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub
+{ lib, stdenv, fetchFromGitHub
 , doxygen, fontconfig, graphviz-nox, libxml2, pkg-config, which
 , systemd }:
 
@@ -51,7 +51,7 @@ in stdenv.mkDerivation {
       --replace pcfile=${pkg-config} pcfile=$out
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "C++ library to control Z-Wave Networks via a USB Z-Wave Controller";
     homepage = "http://www.openzwave.net/";
     license = licenses.gpl3;
diff --git a/pkgs/development/libraries/oracle-instantclient/default.nix b/pkgs/development/libraries/oracle-instantclient/default.nix
index aba9c75ad4651..c6efc901e8ae3 100644
--- a/pkgs/development/libraries/oracle-instantclient/default.nix
+++ b/pkgs/development/libraries/oracle-instantclient/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , autoPatchelfHook
 , fixDarwinDylibNames
@@ -12,7 +12,7 @@
 assert odbcSupport -> unixODBC != null;
 
 let
-  inherit (stdenv.lib) optional optionals optionalString;
+  inherit (lib) optional optionals optionalString;
 
   throwSystem = throw "Unsupported system: ${stdenv.hostPlatform.system}";
 
@@ -114,7 +114,7 @@ in stdenv.mkDerivation {
     done
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Oracle instant client libraries and sqlplus CLI";
     longDescription = ''
       Oracle instant client provides access to Oracle databases (OCI,
diff --git a/pkgs/development/libraries/orcania/default.nix b/pkgs/development/libraries/orcania/default.nix
index 4a01de54a6d94..5c9c2c8da7f27 100644
--- a/pkgs/development/libraries/orcania/default.nix
+++ b/pkgs/development/libraries/orcania/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, check, subunit }:
+{ lib, stdenv, fetchFromGitHub, cmake, check, subunit }:
 stdenv.mkDerivation rec {
   pname = "orcania";
   version = "2.1.1";
@@ -23,7 +23,7 @@ stdenv.mkDerivation rec {
     export DYLD_FALLBACK_LIBRARY_PATH="$(pwd):$DYLD_FALLBACK_LIBRARY_PATH"
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Potluck with different functions for different purposes that can be shared among C programs";
     homepage = "https://github.com/babelouest/orcania";
     license = licenses.lgpl21;
diff --git a/pkgs/development/libraries/ortp/default.nix b/pkgs/development/libraries/ortp/default.nix
index ecd15498432c2..196cac4bcafca 100644
--- a/pkgs/development/libraries/ortp/default.nix
+++ b/pkgs/development/libraries/ortp/default.nix
@@ -1,7 +1,7 @@
 { bctoolbox
 , cmake
 , fetchFromGitLab
-, stdenv
+, lib, stdenv
 }:
 
 stdenv.mkDerivation rec {
@@ -25,7 +25,7 @@ stdenv.mkDerivation rec {
   buildInputs = [ bctoolbox ];
   nativeBuildInputs = [ cmake ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A Real-Time Transport Protocol (RFC3550) stack";
     homepage = "https://linphone.org/technical-corner/ortp";
     license = licenses.gpl3Plus;
diff --git a/pkgs/development/libraries/osip/default.nix b/pkgs/development/libraries/osip/default.nix
index 8b2dce1d950ff..322ed30a84761 100644
--- a/pkgs/development/libraries/osip/default.nix
+++ b/pkgs/development/libraries/osip/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl}:
+{lib, stdenv, fetchurl}:
 stdenv.mkDerivation rec {
   version = "5.2.0";
   src = fetchurl {
@@ -8,11 +8,11 @@ stdenv.mkDerivation rec {
   pname = "libosip2";
 
   meta = {
-    license = stdenv.lib.licenses.lgpl21Plus;
+    license = lib.licenses.lgpl21Plus;
     homepage = "https://www.gnu.org/software/osip/";
     description = "The GNU oSIP library, an implementation of the Session Initiation Protocol (SIP)";
-    maintainers = with stdenv.lib.maintainers; [ raskin ];
-    platforms = stdenv.lib.platforms.linux;
+    maintainers = with lib.maintainers; [ raskin ];
+    platforms = lib.platforms.linux;
     inherit version;
   };
 }
diff --git a/pkgs/development/libraries/osm-gps-map/default.nix b/pkgs/development/libraries/osm-gps-map/default.nix
index f1aa1968493f1..17a3af68a8085 100644
--- a/pkgs/development/libraries/osm-gps-map/default.nix
+++ b/pkgs/development/libraries/osm-gps-map/default.nix
@@ -1,4 +1,4 @@
-{ cairo, fetchzip, glib, gnome3, gtk3, gobject-introspection, pkg-config, stdenv }:
+{ cairo, fetchzip, glib, gnome3, gtk3, gobject-introspection, pkg-config, lib, stdenv }:
 
 stdenv.mkDerivation rec {
   pname = "osm-gps-map";
@@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
     gnome3.gnome-common gtk3 gnome3.libsoup
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "GTK widget for displaying OpenStreetMap tiles";
     homepage = "https://nzjrs.github.io/osm-gps-map";
     license = licenses.gpl2Plus;
diff --git a/pkgs/development/libraries/p11-kit/default.nix b/pkgs/development/libraries/p11-kit/default.nix
index a93bc6763c06a..0e09d563ea1fb 100644
--- a/pkgs/development/libraries/p11-kit/default.nix
+++ b/pkgs/development/libraries/p11-kit/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, fetchpatch, autoreconfHook, pkg-config, which
+{ lib, stdenv, fetchFromGitHub, fetchpatch, autoreconfHook, pkg-config, which
 , gettext, libffi, libiconv, libtasn1
 }:
 
@@ -49,7 +49,7 @@ stdenv.mkDerivation rec {
     "exampledir=${placeholder "out"}/etc/pkcs11"
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Library for loading and sharing PKCS#11 modules";
     longDescription = ''
       Provides a way to load and enumerate PKCS#11 modules.
diff --git a/pkgs/development/libraries/packr/default.nix b/pkgs/development/libraries/packr/default.nix
index 017cb25a9d173..7bf0cb2c5fbc5 100644
--- a/pkgs/development/libraries/packr/default.nix
+++ b/pkgs/development/libraries/packr/default.nix
@@ -22,7 +22,7 @@ let p2 = buildGoModule rec {
 
   doCheck = false;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "The simple and easy way to embed static files into Go binaries";
     homepage = "https://github.com/gobuffalo/packr";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/pagmo2/default.nix b/pkgs/development/libraries/pagmo2/default.nix
index 4723292199da6..abef3d6cd1dd8 100644
--- a/pkgs/development/libraries/pagmo2/default.nix
+++ b/pkgs/development/libraries/pagmo2/default.nix
@@ -1,5 +1,5 @@
 { fetchFromGitHub
-, stdenv
+, lib, stdenv
 , cmake
 , eigen
 , nlopt
@@ -33,7 +33,7 @@ stdenv.mkDerivation rec {
   # tests pass but take 30+ minutes
   doCheck = false;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://esa.github.io/pagmo2/";
     description = "Scientific library for massively parallel optimization";
     license = licenses.gpl3Plus;
diff --git a/pkgs/development/libraries/pango/default.nix b/pkgs/development/libraries/pango/default.nix
index ff1fcb945cad9..68511003215ce 100644
--- a/pkgs/development/libraries/pango/default.nix
+++ b/pkgs/development/libraries/pango/default.nix
@@ -1,11 +1,11 @@
-{ stdenv, fetchurl, fetchpatch, pkg-config, cairo, harfbuzz
+{ lib, stdenv, fetchurl, fetchpatch, pkg-config, cairo, harfbuzz
 , libintl, libthai, gobject-introspection, darwin, fribidi, gnome3
 , gtk-doc, docbook_xsl, docbook_xml_dtd_43, makeFontsConf, freefont_ttf
 , meson, ninja, glib
 , x11Support? !stdenv.isDarwin, libXft
 }:
 
-with stdenv.lib;
+with lib;
 
 let
   pname = "pango";
@@ -14,7 +14,7 @@ in stdenv.mkDerivation rec {
   name = "${pname}-${version}";
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${name}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${name}.tar.xz";
     sha256 = "0ry3j9n0lvdfmjwi2w7wa4gkalnip56kghqq6bh8hcf45xjvh3bk";
   };
 
@@ -40,7 +40,7 @@ in stdenv.mkDerivation rec {
 
   mesonFlags = [
     "-Dgtk_doc=${if stdenv.isDarwin then "false" else "true"}"
-  ] ++ stdenv.lib.optionals stdenv.isDarwin [
+  ] ++ lib.optionals stdenv.isDarwin [
     "-Dxft=disabled"  # only works with x11
   ];
 
@@ -59,7 +59,7 @@ in stdenv.mkDerivation rec {
     };
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A library for laying out and rendering of text, with an emphasis on internationalization";
 
     longDescription = ''
diff --git a/pkgs/development/libraries/pangolin/default.nix b/pkgs/development/libraries/pangolin/default.nix
index 4cb90e297cf33..0e5d705a1ce6e 100644
--- a/pkgs/development/libraries/pangolin/default.nix
+++ b/pkgs/development/libraries/pangolin/default.nix
@@ -48,8 +48,8 @@ stdenv.mkDerivation {
       graphical data.
     '';
     homepage = "https://github.com/stevenlovegrove/Pangolin";
-    license = stdenv.lib.licenses.mit;
-    maintainers = [ stdenv.lib.maintainers.expipiplus1 ];
-    platforms = stdenv.lib.platforms.all;
+    license = lib.licenses.mit;
+    maintainers = [ lib.maintainers.expipiplus1 ];
+    platforms = lib.platforms.all;
   };
 }
diff --git a/pkgs/development/libraries/pangomm/default.nix b/pkgs/development/libraries/pangomm/default.nix
index 1443e74d60822..0ff0d9a7d4e95 100644
--- a/pkgs/development/libraries/pangomm/default.nix
+++ b/pkgs/development/libraries/pangomm/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, pango, glibmm, cairomm, gnome3
+{ lib, stdenv, fetchurl, pkg-config, pango, glibmm, cairomm, gnome3
 , ApplicationServices }:
 
 stdenv.mkDerivation rec {
@@ -6,13 +6,13 @@ stdenv.mkDerivation rec {
   version= "2.42.1";
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "03zli5amizhv9bfklwfq7xyf0b5dagchx1lnz9f0v1rhk69h9gql";
   };
 
   outputs = [ "out" "dev" ];
 
-  nativeBuildInputs = [ pkg-config ] ++ stdenv.lib.optional stdenv.isDarwin [
+  nativeBuildInputs = [ pkg-config ] ++ lib.optional stdenv.isDarwin [
     ApplicationServices
   ];
   propagatedBuildInputs = [ pango glibmm cairomm ];
@@ -25,7 +25,7 @@ stdenv.mkDerivation rec {
     };
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "C++ interface to the Pango text rendering library";
     homepage    = "https://www.pango.org/";
     license     = with licenses; [ lgpl2 lgpl21 ];
diff --git a/pkgs/development/libraries/pangoxsl/default.nix b/pkgs/development/libraries/pangoxsl/default.nix
index ff23a7f30f2c1..7d314a930f25c 100644
--- a/pkgs/development/libraries/pangoxsl/default.nix
+++ b/pkgs/development/libraries/pangoxsl/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, pkg-config, glib, pango}:
+{lib, stdenv, fetchurl, pkg-config, glib, pango}:
 
 stdenv.mkDerivation {
   name = "pangoxsl-1.6.0.3";
@@ -13,7 +13,7 @@ stdenv.mkDerivation {
     pango
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Implements several of the inline properties defined by XSL that are not currently implemented by Pango";
     homepage = "https://sourceforge.net/projects/pangopdf";
     platforms = platforms.unix;
diff --git a/pkgs/development/libraries/partio/default.nix b/pkgs/development/libraries/partio/default.nix
index 2f7574d363720..0247d12715f6d 100644
--- a/pkgs/development/libraries/partio/default.nix
+++ b/pkgs/development/libraries/partio/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, unzip, cmake, freeglut, libGLU, libGL, zlib, swig, python, doxygen, xorg }:
+{ lib, stdenv, fetchFromGitHub, unzip, cmake, freeglut, libGLU, libGL, zlib, swig, python, doxygen, xorg }:
 
 stdenv.mkDerivation {
   pname = "partio";
@@ -32,7 +32,7 @@ stdenv.mkDerivation {
     mv $dev/include/*.h $dev/include/partio
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "C++ (with python bindings) library for easily reading/writing/manipulating common animation particle formats such as PDB, BGEO, PTC";
     homepage = "https://www.disneyanimation.com/technology/partio.html";
     license = licenses.bsd3;
diff --git a/pkgs/development/libraries/pc-ble-driver/default.nix b/pkgs/development/libraries/pc-ble-driver/default.nix
index 7d7dbd53383b2..1777b0856f806 100644
--- a/pkgs/development/libraries/pc-ble-driver/default.nix
+++ b/pkgs/development/libraries/pc-ble-driver/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, git, cmake, catch2, asio, udev, IOKit }:
+{ lib, stdenv, fetchFromGitHub, git, cmake, catch2, asio, udev, IOKit }:
 
 stdenv.mkDerivation rec {
   pname = "pc-ble-driver";
@@ -20,13 +20,13 @@ stdenv.mkDerivation rec {
 
   propagatedBuildInputs = [
 
-  ] ++ stdenv.lib.optionals stdenv.isDarwin [
+  ] ++ lib.optionals stdenv.isDarwin [
     IOKit
-  ] ++ stdenv.lib.optionals stdenv.isLinux [
+  ] ++ lib.optionals stdenv.isLinux [
     udev
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Desktop library for Bluetooth low energy development";
     homepage = "https://github.com/NordicSemiconductor/pc-ble-driver";
     license = licenses.unfreeRedistributable;
diff --git a/pkgs/development/libraries/pcaudiolib/default.nix b/pkgs/development/libraries/pcaudiolib/default.nix
index 8301d1a6f1a67..ebdacdfc9bdbc 100644
--- a/pkgs/development/libraries/pcaudiolib/default.nix
+++ b/pkgs/development/libraries/pcaudiolib/default.nix
@@ -22,7 +22,7 @@ stdenv.mkDerivation rec {
 
   preConfigure = "./autogen.sh";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Provides a C API to different audio devices";
     homepage = "https://github.com/espeak-ng/pcaudiolib";
     license = licenses.gpl3;
diff --git a/pkgs/development/libraries/pcg-c/default.nix b/pkgs/development/libraries/pcg-c/default.nix
index 593794c9c4dff..9722210b9d10f 100644
--- a/pkgs/development/libraries/pcg-c/default.nix
+++ b/pkgs/development/libraries/pcg-c/default.nix
@@ -1,6 +1,6 @@
-{ stdenv, fetchzip }:
+{ lib, stdenv, fetchzip }:
 
-with stdenv.lib;
+with lib;
 
 stdenv.mkDerivation rec {
   version = "0.94";
@@ -25,7 +25,7 @@ stdenv.mkDerivation rec {
   meta = {
     description = "A family of better random number generators";
     homepage = "https://www.pcg-random.org/";
-    license = stdenv.lib.licenses.asl20;
+    license = lib.licenses.asl20;
     longDescription = ''
       PCG is a family of simple fast space-efficient statistically good
       algorithms for random number generation. Unlike many general-purpose RNGs,
diff --git a/pkgs/development/libraries/pcl/default.nix b/pkgs/development/libraries/pcl/default.nix
index 0c57e8b4b6833..436e0f85e1620 100644
--- a/pkgs/development/libraries/pcl/default.nix
+++ b/pkgs/development/libraries/pcl/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake
+{ lib, stdenv, fetchFromGitHub, cmake
 , qhull, flann, boost, vtk, eigen, pkg-config, qtbase
 , libusb1, libpcap, libXt, libpng, Cocoa, AGL, OpenGL
 }:
@@ -16,18 +16,18 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ pkg-config cmake ];
   buildInputs = [ qhull flann boost eigen libusb1 libpcap
                   libpng vtk qtbase libXt ]
-    ++ stdenv.lib.optionals stdenv.isDarwin [ Cocoa AGL ];
+    ++ lib.optionals stdenv.isDarwin [ Cocoa AGL ];
 
-  cmakeFlags = stdenv.lib.optionals stdenv.isDarwin [
+  cmakeFlags = lib.optionals stdenv.isDarwin [
     "-DOPENGL_INCLUDE_DIR=${OpenGL}/Library/Frameworks"
   ];
 
   meta = {
     homepage = "https://pointclouds.org/";
-    broken = stdenv.lib.versionAtLeast qtbase.version "5.15";
+    broken = lib.versionAtLeast qtbase.version "5.15";
     description = "Open project for 2D/3D image and point cloud processing";
-    license = stdenv.lib.licenses.bsd3;
-    maintainers = with stdenv.lib.maintainers; [viric];
-    platforms = with stdenv.lib.platforms; linux ++ darwin;
+    license = lib.licenses.bsd3;
+    maintainers = with lib.maintainers; [viric];
+    platforms = with lib.platforms; linux ++ darwin;
   };
 }
diff --git a/pkgs/development/libraries/pcre/default.nix b/pkgs/development/libraries/pcre/default.nix
index 8f19034c924be..8d9b9ec025992 100644
--- a/pkgs/development/libraries/pcre/default.nix
+++ b/pkgs/development/libraries/pcre/default.nix
@@ -1,9 +1,9 @@
-{ stdenv, fetchurl
+{ lib, stdenv, fetchurl
 , pcre, windows ? null
 , variant ? null
 }:
 
-with stdenv.lib;
+with lib;
 
 assert elem variant [ null "cpp" "pcre16" "pcre32" ];
 
@@ -50,7 +50,7 @@ in stdenv.mkDerivation {
   meta = {
     homepage = "http://www.pcre.org/";
     description = "A library for Perl Compatible Regular Expressions";
-    license = stdenv.lib.licenses.bsd3;
+    license = lib.licenses.bsd3;
 
     longDescription = ''
       The PCRE library is a set of functions that implement regular
diff --git a/pkgs/development/libraries/pcre2/default.nix b/pkgs/development/libraries/pcre2/default.nix
index 8f06630882c8e..6bf6cff98bbe5 100644
--- a/pkgs/development/libraries/pcre2/default.nix
+++ b/pkgs/development/libraries/pcre2/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
   pname = "pcre2";
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
   configureFlags = [
     "--enable-pcre2-16"
     "--enable-pcre2-32"
-  ] ++ stdenv.lib.optional (!stdenv.hostPlatform.isRiscV) "--enable-jit";
+  ] ++ lib.optional (!stdenv.hostPlatform.isRiscV) "--enable-jit";
 
   outputs = [ "bin" "dev" "out" "doc" "man" "devdoc" ];
 
@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
     moveToOutput bin/pcre2-config "$dev"
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Perl Compatible Regular Expressions";
     homepage = "http://www.pcre.org/";
     license = licenses.bsd3;
diff --git a/pkgs/development/libraries/pdal/default.nix b/pkgs/development/libraries/pdal/default.nix
index 4405d3812b76d..42e05d5d7ff43 100644
--- a/pkgs/development/libraries/pdal/default.nix
+++ b/pkgs/development/libraries/pdal/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , fetchpatch
 , cmake
@@ -71,7 +71,7 @@ stdenv.mkDerivation rec {
     "-DBUILD_PLUGIN_RIVLIB=OFF"
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "PDAL is Point Data Abstraction Library. GDAL for point cloud data";
     homepage = "https://pdal.io";
     license = licenses.bsd3;
diff --git a/pkgs/development/libraries/pdf2xml/default.nix b/pkgs/development/libraries/pdf2xml/default.nix
index 855df954eb141..2dfd35466858f 100644
--- a/pkgs/development/libraries/pdf2xml/default.nix
+++ b/pkgs/development/libraries/pdf2xml/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, libxpdf, libxml2}:
+{lib, stdenv, fetchurl, libxpdf, libxml2}:
 
 stdenv.mkDerivation {
   name = "pdf2xml";
@@ -32,7 +32,7 @@ stdenv.mkDerivation {
     cp exe/* $out/bin
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "PDF to XML converter";
     platforms = platforms.unix;
     license = licenses.gpl2;
diff --git a/pkgs/development/libraries/phash/default.nix b/pkgs/development/libraries/phash/default.nix
index dbc7e0c3a59bb..250089c30b1c9 100644
--- a/pkgs/development/libraries/phash/default.nix
+++ b/pkgs/development/libraries/phash/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, pkg-config, cimg, imagemagick }:
+{ lib, stdenv, fetchFromGitHub, pkg-config, cimg, imagemagick }:
 
 stdenv.mkDerivation rec {
   pname = "pHash";
@@ -24,7 +24,7 @@ stdenv.mkDerivation rec {
     sha256 = "0y4gknfkns5sssfaj0snyx29752my20xmxajg6xggijx0myabbv0";
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     inherit version;
     description = "Compute the perceptual hash of an image";
     license = licenses.gpl3;
diff --git a/pkgs/development/libraries/phonetisaurus/default.nix b/pkgs/development/libraries/phonetisaurus/default.nix
index 126a91fe29005..abacfdc1cce26 100644
--- a/pkgs/development/libraries/phonetisaurus/default.nix
+++ b/pkgs/development/libraries/phonetisaurus/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , openfst
 , pkg-config
@@ -22,7 +22,7 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ python3 openfst ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Framework for Grapheme-to-phoneme models for speech recognition using the OpenFst framework";
     inherit (src.meta) homepage;
     license = licenses.bsd3;
diff --git a/pkgs/development/libraries/phonon/backends/gstreamer.nix b/pkgs/development/libraries/phonon/backends/gstreamer.nix
index c066e15a8f966..249ce4e3629ad 100644
--- a/pkgs/development/libraries/phonon/backends/gstreamer.nix
+++ b/pkgs/development/libraries/phonon/backends/gstreamer.nix
@@ -9,7 +9,7 @@ stdenv.mkDerivation rec {
   pname = "phonon-backend-gstreamer";
   version = "4.10.0";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://phonon.kde.org/";
     description = "GStreamer backend for Phonon";
     platforms = platforms.linux;
diff --git a/pkgs/development/libraries/phonon/backends/vlc.nix b/pkgs/development/libraries/phonon/backends/vlc.nix
index 3dc5071ba15dd..07e6ccf1f3460 100644
--- a/pkgs/development/libraries/phonon/backends/vlc.nix
+++ b/pkgs/development/libraries/phonon/backends/vlc.nix
@@ -9,7 +9,7 @@ stdenv.mkDerivation rec {
   pname = "phonon-backend-vlc";
   version = "0.11.1";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://phonon.kde.org/";
     description = "GStreamer backend for Phonon";
     platforms = platforms.linux;
diff --git a/pkgs/development/libraries/phonon/default.nix b/pkgs/development/libraries/phonon/default.nix
index 926b8593c5996..88a6af658dd40 100644
--- a/pkgs/development/libraries/phonon/default.nix
+++ b/pkgs/development/libraries/phonon/default.nix
@@ -26,9 +26,9 @@ stdenv.mkDerivation rec {
   meta = {
     homepage = "https://community.kde.org/Phonon";
     description = "Multimedia API for Qt";
-    license = stdenv.lib.licenses.lgpl2;
-    platforms = stdenv.lib.platforms.linux;
-    maintainers = with stdenv.lib.maintainers; [ ttuegel ];
+    license = lib.licenses.lgpl2;
+    platforms = lib.platforms.linux;
+    maintainers = with lib.maintainers; [ ttuegel ];
   };
 
   src = fetchurl {
diff --git a/pkgs/development/libraries/physfs/default.nix b/pkgs/development/libraries/physfs/default.nix
index 93c0702e3eff1..3eb4077d9852c 100644
--- a/pkgs/development/libraries/physfs/default.nix
+++ b/pkgs/development/libraries/physfs/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, cmake, doxygen, darwin
+{ lib, stdenv, fetchurl, cmake, doxygen, darwin
 , zlib }:
 
 let
@@ -15,7 +15,7 @@ let
     nativeBuildInputs = [ cmake doxygen ];
 
     buildInputs = [ zlib ]
-      ++ stdenv.lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.Foundation ];
+      ++ lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.Foundation ];
 
     patchPhase = ''
       sed s,-Werror,, -i CMakeLists.txt
@@ -27,7 +27,7 @@ let
       ./test_physfs --version
     '';
 
-    meta = with stdenv.lib; {
+    meta = with lib; {
       homepage = "http://icculus.org/physfs/";
       description = "Library to provide abstract access to various archives";
       license = licenses.free;
diff --git a/pkgs/development/libraries/physics/apfel/default.nix b/pkgs/development/libraries/physics/apfel/default.nix
index 7b201cf9b1645..e3fd0a26a7fd8 100644
--- a/pkgs/development/libraries/physics/apfel/default.nix
+++ b/pkgs/development/libraries/physics/apfel/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, gfortran, lhapdf, python2, zlib }:
+{ lib, stdenv, fetchFromGitHub, gfortran, lhapdf, python2, zlib }:
 
 stdenv.mkDerivation rec {
   pname = "apfel";
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A PDF Evolution Library";
     license     = licenses.gpl3;
     homepage    = "https://apfel.mi.infn.it/";
diff --git a/pkgs/development/libraries/physics/apfelgrid/default.nix b/pkgs/development/libraries/physics/apfelgrid/default.nix
index 5c63ce7c4b9e6..33ca032672703 100644
--- a/pkgs/development/libraries/physics/apfelgrid/default.nix
+++ b/pkgs/development/libraries/physics/apfelgrid/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, autoreconfHook, apfel, applgrid, lhapdf, root5 }:
+{ lib, stdenv, fetchFromGitHub, autoreconfHook, apfel, applgrid, lhapdf, root5 }:
 
 stdenv.mkDerivation rec {
   pname = "apfelgrid";
@@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Ultra-fast theory predictions for collider observables";
     license     = licenses.mit;
     homepage    = "http://nhartland.github.io/APFELgrid/";
diff --git a/pkgs/development/libraries/physics/applgrid/default.nix b/pkgs/development/libraries/physics/applgrid/default.nix
index 6b1bc71c660c7..65aa7b8b47030 100644
--- a/pkgs/development/libraries/physics/applgrid/default.nix
+++ b/pkgs/development/libraries/physics/applgrid/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, gfortran, hoppet, lhapdf, root5, zlib }:
+{ lib, stdenv, fetchurl, gfortran, hoppet, lhapdf, root5, zlib }:
 
 stdenv.mkDerivation rec {
   pname = "applgrid";
@@ -33,7 +33,7 @@ stdenv.mkDerivation rec {
     done
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "The APPLgrid project provides a fast and flexible way to reproduce the results of full NLO calculations with any input parton distribution set in only a few milliseconds rather than the weeks normally required to gain adequate statistics";
     license     = licenses.gpl3;
     homepage    = "http://applgrid.hepforge.org";
diff --git a/pkgs/development/libraries/physics/cernlib/default.nix b/pkgs/development/libraries/physics/cernlib/default.nix
index 3c2cd4c69145b..84657d7267970 100644
--- a/pkgs/development/libraries/physics/cernlib/default.nix
+++ b/pkgs/development/libraries/physics/cernlib/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, gfortran, gnumake, imake, makedepend, motif, xorg }:
+{ lib, stdenv, fetchurl, gfortran, gnumake, imake, makedepend, motif, xorg }:
 
 stdenv.mkDerivation rec {
   version = "2006";
@@ -63,7 +63,7 @@ stdenv.mkDerivation rec {
     description = "Legacy collection of libraries and modules for data analysis in high energy physics";
     broken = stdenv.isDarwin;
     platforms = [ "i686-linux" "x86_64-linux" "x86_64-darwin" ];
-    maintainers = with stdenv.lib.maintainers; [ veprbl ];
-    license = stdenv.lib.licenses.gpl2;
+    maintainers = with lib.maintainers; [ veprbl ];
+    license = lib.licenses.gpl2;
   };
 }
diff --git a/pkgs/development/libraries/physics/fastjet-contrib/default.nix b/pkgs/development/libraries/physics/fastjet-contrib/default.nix
index 68e07e7b42dd8..a09f031e76518 100644
--- a/pkgs/development/libraries/physics/fastjet-contrib/default.nix
+++ b/pkgs/development/libraries/physics/fastjet-contrib/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, fastjet }:
+{ lib, stdenv, fetchurl, fastjet }:
 
 stdenv.mkDerivation rec {
   pname = "fastjet-contrib";
@@ -30,7 +30,7 @@ stdenv.mkDerivation rec {
     make fragile-shared-install
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Third party extensions for FastJet";
     homepage = "http://fastjet.fr/";
     license = licenses.gpl2;
diff --git a/pkgs/development/libraries/physics/fastjet/default.nix b/pkgs/development/libraries/physics/fastjet/default.nix
index b854fa88cd67e..35ce8dedca745 100644
--- a/pkgs/development/libraries/physics/fastjet/default.nix
+++ b/pkgs/development/libraries/physics/fastjet/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, python2 }:
+{ lib, stdenv, fetchurl, python2 }:
 
 stdenv.mkDerivation rec {
   pname = "fastjet";
@@ -20,9 +20,9 @@ stdenv.mkDerivation rec {
 
   meta = {
     description = "A software package for jet finding in pp and e+e− collisions";
-    license     = stdenv.lib.licenses.gpl2Plus;
+    license     = lib.licenses.gpl2Plus;
     homepage    = "http://fastjet.fr/";
-    platforms   = stdenv.lib.platforms.unix;
-    maintainers = with stdenv.lib.maintainers; [ veprbl ];
+    platforms   = lib.platforms.unix;
+    maintainers = with lib.maintainers; [ veprbl ];
   };
 }
diff --git a/pkgs/development/libraries/physics/fastnlo/default.nix b/pkgs/development/libraries/physics/fastnlo/default.nix
index 22251e10a4f13..916303f00cecf 100644
--- a/pkgs/development/libraries/physics/fastnlo/default.nix
+++ b/pkgs/development/libraries/physics/fastnlo/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, boost, fastjet, gfortran, lhapdf, python2, root, yoda, zlib }:
+{ lib, stdenv, fetchurl, boost, fastjet, gfortran, lhapdf, python2, root, yoda, zlib }:
 
 stdenv.mkDerivation rec {
   pname = "fastnlo_toolkit";
@@ -25,9 +25,9 @@ stdenv.mkDerivation rec {
 
   meta = {
     description = "A computer code to create and evaluate fast interpolation tables of pre-computed coefficients in perturbation theory for observables in hadron-induced processes";
-    license      = stdenv.lib.licenses.gpl3;
+    license      = lib.licenses.gpl3;
     homepage     = "http://fastnlo.hepforge.org";
-    platforms    = stdenv.lib.platforms.unix;
-    maintainers = with stdenv.lib.maintainers; [ veprbl ];
+    platforms    = lib.platforms.unix;
+    maintainers = with lib.maintainers; [ veprbl ];
   };
 }
diff --git a/pkgs/development/libraries/physics/geant4/datasets.nix b/pkgs/development/libraries/physics/geant4/datasets.nix
index 42014949c0b68..e51a5937ddb8b 100644
--- a/pkgs/development/libraries/physics/geant4/datasets.nix
+++ b/pkgs/development/libraries/physics/geant4/datasets.nix
@@ -24,7 +24,7 @@ let
       inherit envvar;
       setupHook = ./datasets-hook.sh;
 
-      meta = with stdenv.lib; {
+      meta = with lib; {
         description = "Data files for the Geant4 toolkit";
         homepage = "https://geant4.web.cern.ch/support/download";
         license = licenses.g4sl;
diff --git a/pkgs/development/libraries/physics/geant4/default.nix b/pkgs/development/libraries/physics/geant4/default.nix
index 0b48b291555fd..27d67d9af0c45 100644
--- a/pkgs/development/libraries/physics/geant4/default.nix
+++ b/pkgs/development/libraries/physics/geant4/default.nix
@@ -9,7 +9,7 @@
 , enableRaytracerX11   ? false
 
 # Standard build environment with cmake.
-, stdenv, fetchurl, fetchpatch, cmake
+, lib, stdenv, fetchurl, fetchpatch, cmake
 
 # Optional system packages, otherwise internal GEANT4 packages are used.
 , clhep ? null # not packaged currently
@@ -80,9 +80,9 @@ stdenv.mkDerivation rec {
     "-DGEANT4_USE_SYSTEM_EXPAT=${if expat != null then "ON" else "OFF"}"
     "-DGEANT4_USE_SYSTEM_ZLIB=${if zlib != null then "ON" else "OFF"}"
     "-DGEANT4_BUILD_MULTITHREADED=${if enableMultiThreading then "ON" else "OFF"}"
-  ] ++ stdenv.lib.optionals (enableMultiThreading && enablePython) [
+  ] ++ lib.optionals (enableMultiThreading && enablePython) [
     "-DGEANT4_BUILD_TLS_MODEL=global-dynamic"
-  ] ++ stdenv.lib.optionals enableInventor [
+  ] ++ lib.optionals enableInventor [
     "-DINVENTOR_INCLUDE_DIR=${coin3d}/include"
     "-DINVENTOR_LIBRARY_RELEASE=${coin3d}/lib/libCoin.so"
   ];
@@ -90,13 +90,13 @@ stdenv.mkDerivation rec {
   nativeBuildInputs =  [ cmake ];
 
   buildInputs = [ libGLU xlibsWrapper libXmu ]
-    ++ stdenv.lib.optionals enableInventor [ libXpm coin3d soxt motif ]
-    ++ stdenv.lib.optionals enablePython [ boost_python python3 ];
+    ++ lib.optionals enableInventor [ libXpm coin3d soxt motif ]
+    ++ lib.optionals enablePython [ boost_python python3 ];
 
   propagatedBuildInputs = [ clhep expat zlib libGL ]
-    ++ stdenv.lib.optionals enableGDML [ xercesc ]
-    ++ stdenv.lib.optionals enableXM [ motif ]
-    ++ stdenv.lib.optionals enableQT [ qtbase ];
+    ++ lib.optionals enableGDML [ xercesc ]
+    ++ lib.optionals enableXM [ motif ]
+    ++ lib.optionals enableQT [ qtbase ];
 
   postFixup = ''
     # Don't try to export invalid environment variables.
@@ -119,7 +119,7 @@ stdenv.mkDerivation rec {
     source $out/nix-support/setup-hook
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A toolkit for the simulation of the passage of particles through matter";
     longDescription = ''
       Geant4 is a toolkit for the simulation of the passage of particles through matter.
diff --git a/pkgs/development/libraries/physics/hepmc2/default.nix b/pkgs/development/libraries/physics/hepmc2/default.nix
index b27d947ea5c47..e2ab42c418a09 100644
--- a/pkgs/development/libraries/physics/hepmc2/default.nix
+++ b/pkgs/development/libraries/physics/hepmc2/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, cmake }:
+{ lib, stdenv, fetchurl, cmake }:
 
 stdenv.mkDerivation rec {
   pname = "hepmc";
@@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
     "-Dlength:STRING=MM"
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "The HepMC package is an object oriented event record written in C++ for High Energy Physics Monte Carlo Generators";
     license     = licenses.lgpl21;
     homepage    = "http://hepmc.web.cern.ch/hepmc/";
diff --git a/pkgs/development/libraries/physics/hepmc3/default.nix b/pkgs/development/libraries/physics/hepmc3/default.nix
index 10b789f514f9a..0b1b1f8fa578a 100644
--- a/pkgs/development/libraries/physics/hepmc3/default.nix
+++ b/pkgs/development/libraries/physics/hepmc3/default.nix
@@ -1,7 +1,7 @@
-{ stdenv, fetchurl, cmake, coreutils, python, root }:
+{ lib, stdenv, fetchurl, cmake, coreutils, python, root }:
 
 let
-  pythonVersion = with stdenv.lib.versions; "${major python.version}${minor python.version}";
+  pythonVersion = with lib.versions; "${major python.version}${minor python.version}";
   withPython = python != null;
   # ensure that root is built with the same python interpreter, as it links against numpy
   root_py = if withPython then root.override { inherit python; } else root;
@@ -18,11 +18,11 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ cmake ];
   buildInputs = [ root_py ]
-    ++ stdenv.lib.optional withPython python;
+    ++ lib.optional withPython python;
 
   cmakeFlags = [
     "-DHEPMC3_ENABLE_PYTHON=${if withPython then "ON" else "OFF"}"
-  ] ++ stdenv.lib.optionals withPython [
+  ] ++ lib.optionals withPython [
     "-DHEPMC3_PYTHON_VERSIONS=${if python.isPy3k then "3.X" else "2.X"}"
     "-DHEPMC3_Python_SITEARCH${pythonVersion}=${placeholder "out"}/${python.sitePackages}"
   ];
@@ -35,11 +35,11 @@ stdenv.mkDerivation rec {
 
   doInstallCheck = withPython;
   # prevent nix from trying to dereference a null python
-  installCheckPhase = stdenv.lib.optionalString withPython ''
+  installCheckPhase = lib.optionalString withPython ''
     PYTHONPATH=${placeholder "out"}/${python.sitePackages} python -c 'import pyHepMC3'
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "The HepMC package is an object oriented, C++ event record for High Energy Physics Monte Carlo generators and simulation";
     license = licenses.gpl3;
     homepage = "http://hepmc.web.cern.ch/hepmc/";
diff --git a/pkgs/development/libraries/physics/herwig/default.nix b/pkgs/development/libraries/physics/herwig/default.nix
index c1a803fd314bc..d3f6bcb747476 100644
--- a/pkgs/development/libraries/physics/herwig/default.nix
+++ b/pkgs/development/libraries/physics/herwig/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, boost, fastjet, gfortran, gsl, lhapdf, thepeg, zlib, autoconf, automake, libtool }:
+{ lib, stdenv, fetchurl, boost, fastjet, gfortran, gsl, lhapdf, thepeg, zlib, autoconf, automake, libtool }:
 
 stdenv.mkDerivation rec {
   pname = "herwig";
@@ -25,7 +25,7 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A multi-purpose particle physics event generator";
     homepage = "https://herwig.hepforge.org/";
     license = licenses.gpl3;
diff --git a/pkgs/development/libraries/physics/hoppet/default.nix b/pkgs/development/libraries/physics/hoppet/default.nix
index 6ac3b950be342..7ad5b9861a1d2 100644
--- a/pkgs/development/libraries/physics/hoppet/default.nix
+++ b/pkgs/development/libraries/physics/hoppet/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, gfortran, perl }:
+{ lib, stdenv, fetchurl, gfortran, perl }:
 
 stdenv.mkDerivation rec {
   pname = "hoppet";
@@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
     patchShebangs .
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Higher Order Perturbative Parton Evolution Toolkit";
     license     = licenses.gpl2;
     homepage    = "https://hoppet.hepforge.org";
diff --git a/pkgs/development/libraries/physics/lhapdf/default.nix b/pkgs/development/libraries/physics/lhapdf/default.nix
index 7d412f86596d4..19e9f9d9ec860 100644
--- a/pkgs/development/libraries/physics/lhapdf/default.nix
+++ b/pkgs/development/libraries/physics/lhapdf/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, python2, makeWrapper }:
+{ lib, stdenv, fetchurl, python2, makeWrapper }:
 
 stdenv.mkDerivation rec {
   pname = "lhapdf";
@@ -15,18 +15,18 @@ stdenv.mkDerivation rec {
   enableParallelBuilding = true;
 
   passthru = {
-    pdf_sets = import ./pdf_sets.nix { inherit stdenv fetchurl; };
+    pdf_sets = import ./pdf_sets.nix { inherit lib stdenv fetchurl; };
   };
 
   postInstall = ''
     wrapProgram $out/bin/lhapdf --prefix PYTHONPATH : "$(toPythonPath "$out")"
   '';
 
-  meta = {
+  meta = with lib; {
     description = "A general purpose interpolator, used for evaluating Parton Distribution Functions from discretised data files";
-    license     = stdenv.lib.licenses.gpl2;
+    license     = licenses.gpl2;
     homepage    = "http://lhapdf.hepforge.org";
-    platforms   = stdenv.lib.platforms.unix;
-    maintainers = with stdenv.lib.maintainers; [ veprbl ];
+    platforms   = platforms.unix;
+    maintainers = with maintainers; [ veprbl ];
   };
 }
diff --git a/pkgs/development/libraries/physics/lhapdf/pdf_sets.nix b/pkgs/development/libraries/physics/lhapdf/pdf_sets.nix
index 2309e6671f856..7fb3e640c7d61 100644
--- a/pkgs/development/libraries/physics/lhapdf/pdf_sets.nix
+++ b/pkgs/development/libraries/physics/lhapdf/pdf_sets.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 let
   mkPdfSet = name: sha256:
@@ -20,7 +20,7 @@ let
       setupHook = ./pdfset-hook.sh;
     };
 in
-  stdenv.lib.mapAttrs mkPdfSet {
+  lib.mapAttrs mkPdfSet {
     "ABMP15_3_nnlo" = "028q5xixxjxhb8sr7l5v5mwh9mkszm5m59fgnpb69yxvv40a70v0";
     "ABMP15_4_nnlo" = "11zjp4dxmgp69kdkmdwqkpsajvwjrbwylmwgs56mgjb0vgb8wk0i";
     "ABMP15_5_nnlo" = "0z47g5fwh53gg5ws5bbip5q2m5mm7vl09q2w58g6ah9dk25r10ll";
diff --git a/pkgs/development/libraries/physics/mela/default.nix b/pkgs/development/libraries/physics/mela/default.nix
index 1e31577026c1e..90cf5ac8b2d17 100644
--- a/pkgs/development/libraries/physics/mela/default.nix
+++ b/pkgs/development/libraries/physics/mela/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, gfortran }:
+{ lib, stdenv, fetchFromGitHub, gfortran }:
 
 stdenv.mkDerivation rec {
   pname = "mela";
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "a Mellin Evolution LibrAry";
     license     = licenses.gpl3;
     homepage    = "https://github.com/vbertone/MELA";
diff --git a/pkgs/development/libraries/physics/nlojet/default.nix b/pkgs/development/libraries/physics/nlojet/default.nix
index 20df49d9ae7f3..f84c1bda32d3b 100644
--- a/pkgs/development/libraries/physics/nlojet/default.nix
+++ b/pkgs/development/libraries/physics/nlojet/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
   pname = "nlojet++";
@@ -15,9 +15,9 @@ stdenv.mkDerivation rec {
 
   meta = {
     homepage    = "http://www.desy.de/~znagy/Site/NLOJet++.html";
-    license     = stdenv.lib.licenses.gpl2;
+    license     = lib.licenses.gpl2;
     description = "Implementation of calculation of the hadron jet cross sections";
-    platforms   = stdenv.lib.platforms.unix;
-    maintainers = with stdenv.lib.maintainers; [ veprbl ];
+    platforms   = lib.platforms.unix;
+    maintainers = with lib.maintainers; [ veprbl ];
   };
 }
diff --git a/pkgs/development/libraries/physics/pythia/default.nix b/pkgs/development/libraries/physics/pythia/default.nix
index 53b2889a25c85..1bec3300f80a0 100644
--- a/pkgs/development/libraries/physics/pythia/default.nix
+++ b/pkgs/development/libraries/physics/pythia/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, boost, fastjet, hepmc, lhapdf, rsync, zlib }:
+{ lib, stdenv, fetchurl, boost, fastjet, hepmc, lhapdf, rsync, zlib }:
 
 stdenv.mkDerivation rec {
   pname = "pythia";
@@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
   configureFlags = [
     "--enable-shared"
     "--with-lhapdf6=${lhapdf}"
-  ] ++ (if stdenv.lib.versions.major hepmc.version == "3" then [
+  ] ++ (if lib.versions.major hepmc.version == "3" then [
     "--with-hepmc3=${hepmc}"
   ] else [
     "--with-hepmc2=${hepmc}"
@@ -28,9 +28,9 @@ stdenv.mkDerivation rec {
 
   meta = {
     description = "A program for the generation of high-energy physics events";
-    license     = stdenv.lib.licenses.gpl2;
+    license     = lib.licenses.gpl2;
     homepage    = "http://home.thep.lu.se/~torbjorn/Pythia.html";
-    platforms   = stdenv.lib.platforms.unix;
-    maintainers = with stdenv.lib.maintainers; [ veprbl ];
+    platforms   = lib.platforms.unix;
+    maintainers = with lib.maintainers; [ veprbl ];
   };
 }
diff --git a/pkgs/development/libraries/physics/qcdnum/default.nix b/pkgs/development/libraries/physics/qcdnum/default.nix
index 1c17b318c9dce..834e3fcbba898 100644
--- a/pkgs/development/libraries/physics/qcdnum/default.nix
+++ b/pkgs/development/libraries/physics/qcdnum/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, gfortran, zlib }:
+{ lib, stdenv, fetchurl, gfortran, zlib }:
 
 stdenv.mkDerivation rec {
   pname = "QCDNUM";
@@ -16,9 +16,9 @@ stdenv.mkDerivation rec {
 
   meta = {
     description = "A very fast QCD evolution program written in FORTRAN77";
-    license     = stdenv.lib.licenses.gpl3;
+    license     = lib.licenses.gpl3;
     homepage    = "https://www.nikhef.nl/~h24/qcdnum/index.html";
-    platforms   = stdenv.lib.platforms.unix;
-    maintainers = with stdenv.lib.maintainers; [ veprbl ];
+    platforms   = lib.platforms.unix;
+    maintainers = with lib.maintainers; [ veprbl ];
   };
 }
diff --git a/pkgs/development/libraries/physics/rivet/default.nix b/pkgs/development/libraries/physics/rivet/default.nix
index f95328964bfbc..ce905bff17c5e 100644
--- a/pkgs/development/libraries/physics/rivet/default.nix
+++ b/pkgs/development/libraries/physics/rivet/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, fastjet, fastjet-contrib, ghostscript, gsl, hepmc, imagemagick, less, python3, rsync, texlive, yoda, which, makeWrapper }:
+{ lib, stdenv, fetchurl, fastjet, fastjet-contrib, ghostscript, gsl, hepmc, imagemagick, less, python3, rsync, texlive, yoda, which, makeWrapper }:
 
 stdenv.mkDerivation rec {
   pname = "rivet";
@@ -60,7 +60,7 @@ stdenv.mkDerivation rec {
   configureFlags = [
     "--with-fastjet=${fastjet}"
     "--with-yoda=${yoda}"
-  ] ++ (if stdenv.lib.versions.major hepmc.version == "3" then [
+  ] ++ (if lib.versions.major hepmc.version == "3" then [
     "--with-hepmc3=${hepmc}"
   ] else [
     "--with-hepmc=${hepmc}"
@@ -74,7 +74,7 @@ stdenv.mkDerivation rec {
     done
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A framework for comparison of experimental measurements from high-energy particle colliders to theory predictions";
     license     = licenses.gpl3;
     homepage    = "https://rivet.hepforge.org";
diff --git a/pkgs/development/libraries/physics/thepeg/default.nix b/pkgs/development/libraries/physics/thepeg/default.nix
index 876aeec0fab77..d5a272955f40f 100644
--- a/pkgs/development/libraries/physics/thepeg/default.nix
+++ b/pkgs/development/libraries/physics/thepeg/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, boost, fastjet, gsl, hepmc2, lhapdf, rivet, zlib }:
+{ lib, stdenv, fetchurl, boost, fastjet, gsl, hepmc2, lhapdf, rivet, zlib }:
 
 stdenv.mkDerivation rec {
   pname = "thepeg";
@@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Toolkit for High Energy Physics Event Generation";
     homepage = "https://herwig.hepforge.org/";
     license = licenses.gpl3;
diff --git a/pkgs/development/libraries/physics/yoda/default.nix b/pkgs/development/libraries/physics/yoda/default.nix
index 39bffb65237e5..bf53cfcb62c91 100644
--- a/pkgs/development/libraries/physics/yoda/default.nix
+++ b/pkgs/development/libraries/physics/yoda/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, python, root, makeWrapper, zlib, withRootSupport ? false }:
+{ lib, stdenv, fetchurl, python, root, makeWrapper, zlib, withRootSupport ? false }:
 
 stdenv.mkDerivation rec {
   pname = "yoda";
@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = with python.pkgs; [ cython makeWrapper ];
   buildInputs = [ python ]
     ++ (with python.pkgs; [ numpy matplotlib ])
-    ++ stdenv.lib.optional withRootSupport root;
+    ++ lib.optional withRootSupport root;
   propagatedBuildInputs = [ zlib ];
 
   enableParallelBuilding = true;
@@ -35,10 +35,10 @@ stdenv.mkDerivation rec {
 
   meta = {
     description = "Provides small set of data analysis (specifically histogramming) classes";
-    license     = stdenv.lib.licenses.gpl3;
+    license     = lib.licenses.gpl3;
     homepage    = "https://yoda.hepforge.org";
-    platforms   = stdenv.lib.platforms.unix;
-    maintainers = with stdenv.lib.maintainers; [ veprbl ];
+    platforms   = lib.platforms.unix;
+    maintainers = with lib.maintainers; [ veprbl ];
     # https://gitlab.com/hepcedar/yoda/-/issues/24
     broken      = withRootSupport;
   };
diff --git a/pkgs/development/libraries/pipewire/0.2.nix b/pkgs/development/libraries/pipewire/0.2.nix
index 70ab98439cc3e..1e686b980043d 100644
--- a/pkgs/development/libraries/pipewire/0.2.nix
+++ b/pkgs/development/libraries/pipewire/0.2.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, meson, ninja, pkg-config, doxygen, graphviz, valgrind
+{ lib, stdenv, fetchFromGitHub, meson, ninja, pkg-config, doxygen, graphviz, valgrind
 , glib, dbus, gst_all_1, alsaLib, ffmpeg_4, libjack2, udev, libva, xorg
 , sbc, SDL2, makeFontsConf
 }:
@@ -39,7 +39,7 @@ in stdenv.mkDerivation rec {
 
   doCheck = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Server and user space API to deal with multimedia pipelines";
     homepage = "https://pipewire.org/";
     license = licenses.lgpl21;
diff --git a/pkgs/development/libraries/pipewire/default.nix b/pkgs/development/libraries/pipewire/default.nix
index b8be63f8e535a..fdd45b4bb0d9b 100644
--- a/pkgs/development/libraries/pipewire/default.nix
+++ b/pkgs/development/libraries/pipewire/default.nix
@@ -136,7 +136,7 @@ stdenv.mkDerivation rec {
     };
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Server and user space API to deal with multimedia pipelines";
     homepage = "https://pipewire.org/";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/pixman/default.nix b/pkgs/development/libraries/pixman/default.nix
index ef9ae533ca1cb..a8cea46380693 100644
--- a/pkgs/development/libraries/pixman/default.nix
+++ b/pkgs/development/libraries/pixman/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, libpng, glib /*just passthru*/ }:
+{ lib, stdenv, fetchurl, pkg-config, libpng, glib /*just passthru*/ }:
 
 stdenv.mkDerivation rec {
   pname = "pixman";
@@ -13,13 +13,13 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ libpng ];
 
-  configureFlags = stdenv.lib.optional stdenv.isAarch32 "--disable-arm-iwmmxt";
+  configureFlags = lib.optional stdenv.isAarch32 "--disable-arm-iwmmxt";
 
   doCheck = true;
 
   postInstall = glib.flattenInclude;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://pixman.org";
     description = "A low-level library for pixel manipulation";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/pkcs11helper/default.nix b/pkgs/development/libraries/pkcs11helper/default.nix
index debb0309e916f..4148ca4fc47db 100644
--- a/pkgs/development/libraries/pkcs11helper/default.nix
+++ b/pkgs/development/libraries/pkcs11helper/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, pkg-config, openssl, autoreconfHook }:
+{ lib, stdenv, fetchFromGitHub, pkg-config, openssl, autoreconfHook }:
 
 stdenv.mkDerivation rec {
   pname = "pkcs11-helper";
@@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/OpenSC/pkcs11-helper";
     license = with licenses; [ bsd3 gpl2 ];
     description = "Library that simplifies the interaction with PKCS#11 providers";
diff --git a/pkgs/development/libraries/pkger/default.nix b/pkgs/development/libraries/pkger/default.nix
index 8c8fd4f8fd6b0..4d7c682f02294 100644
--- a/pkgs/development/libraries/pkger/default.nix
+++ b/pkgs/development/libraries/pkger/default.nix
@@ -19,7 +19,7 @@ buildGoModule rec {
 
   doCheck = false;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Embed static files in Go binaries (replacement for gobuffalo/packr) ";
     homepage = "https://github.com/markbates/pkger";
     changelog = "https://github.com/markbates/pkger/releases/tag/v${version}";
diff --git a/pkgs/development/libraries/plib/default.nix b/pkgs/development/libraries/plib/default.nix
index 2736de0630f66..7a1c397157973 100644
--- a/pkgs/development/libraries/plib/default.nix
+++ b/pkgs/development/libraries/plib/default.nix
@@ -1,4 +1,4 @@
-{ fetchurl, fetchpatch, stdenv, libGLU, libGL, freeglut, SDL
+{ fetchurl, fetchpatch, lib, stdenv, libGLU, libGL, freeglut, SDL
 , libXi, libSM, libXmu, libXext, libX11 }:
 
 stdenv.mkDerivation rec {
@@ -42,9 +42,9 @@ stdenv.mkDerivation rec {
       GLUT, or FLTK instead of PLIB's 'PW' windowing library, you can.
     '';
 
-    license = stdenv.lib.licenses.lgpl2Plus;
+    license = lib.licenses.lgpl2Plus;
 
     homepage = "http://plib.sourceforge.net/";
-    platforms = stdenv.lib.platforms.linux;
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/development/libraries/plplot/default.nix b/pkgs/development/libraries/plplot/default.nix
index e99ddc3dd0855..05f12d0148beb 100644
--- a/pkgs/development/libraries/plplot/default.nix
+++ b/pkgs/development/libraries/plplot/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, cmake }:
+{ lib, stdenv, fetchurl, cmake }:
 
 stdenv.mkDerivation rec {
   pname   = "plplot";
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
 
   doCheck = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Cross-platform scientific graphics plotting library";
     homepage    = "https://plplot.org";
     maintainers = with maintainers; [ bcdarwin ];
diff --git a/pkgs/development/libraries/pmdk/default.nix b/pkgs/development/libraries/pmdk/default.nix
index 3bd5aa46be510..01392f232d9c3 100644
--- a/pkgs/development/libraries/pmdk/default.nix
+++ b/pkgs/development/libraries/pmdk/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub
+{ lib, stdenv, fetchFromGitHub
 , autoconf, libndctl, pkg-config
 }:
 
@@ -30,7 +30,7 @@ stdenv.mkDerivation rec {
     mv $out/lib     $lib/lib
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Persistent Memory Development Kit";
     homepage    = "https://github.com/pmem/pmdk";
     license     = licenses.lgpl21;
diff --git a/pkgs/development/libraries/pmix/default.nix b/pkgs/development/libraries/pmix/default.nix
index f68833bdac4d1..bb8debbce916f 100644
--- a/pkgs/development/libraries/pmix/default.nix
+++ b/pkgs/development/libraries/pmix/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, perl, autoconf, automake
+{ lib, stdenv, fetchFromGitHub, perl, autoconf, automake
 , libtool, flex, libevent, hwloc, munge, zlib, pandoc
 } :
 
@@ -37,7 +37,7 @@ in stdenv.mkDerivation {
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Process Management Interface for HPC environments";
     homepage = "https://openpmix.github.io/";
     license = licenses.bsd3;
diff --git a/pkgs/development/libraries/png++/default.nix b/pkgs/development/libraries/png++/default.nix
index 7ae7406c9896e..dfd74e495e76d 100644
--- a/pkgs/development/libraries/png++/default.nix
+++ b/pkgs/development/libraries/png++/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, libpng
+{ lib, stdenv, fetchurl, libpng
 , docSupport ? true, doxygen ? null
 }:
 assert docSupport -> doxygen != null;
@@ -21,21 +21,21 @@ stdenv.mkDerivation rec {
 
   postCheck = "cat test/test.log";
 
-  buildInputs = stdenv.lib.optional docSupport doxygen;
+  buildInputs = lib.optional docSupport doxygen;
 
   propagatedBuildInputs = [ libpng ];
 
-  preConfigure = stdenv.lib.optionalString stdenv.isDarwin ''
+  preConfigure = lib.optionalString stdenv.isDarwin ''
     substituteInPlace error.hpp --replace "#if (_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && !_GNU_SOURCE" "#if (__clang__ || _POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && !_GNU_SOURCE"
   '' + ''
     sed "s|\(PNGPP := .\)|PREFIX := ''${out}\n\\1|" -i Makefile
   '';
 
-  makeFlags = stdenv.lib.optional docSupport "docs";
+  makeFlags = lib.optional docSupport "docs";
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://www.nongnu.org/pngpp/";
     description = "C++ wrapper for libpng library";
     license = licenses.bsd3;
diff --git a/pkgs/development/libraries/pocketsphinx/default.nix b/pkgs/development/libraries/pocketsphinx/default.nix
index 71b36cedb81de..18d5d0bcfa22b 100644
--- a/pkgs/development/libraries/pocketsphinx/default.nix
+++ b/pkgs/development/libraries/pocketsphinx/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , sphinxbase
 , pkg-config
@@ -22,8 +22,8 @@ stdenv.mkDerivation rec {
   meta = {
     description = "Voice recognition library written in C";
     homepage = "http://cmusphinx.sourceforge.net";
-    license = stdenv.lib.licenses.free;
-    platforms = stdenv.lib.platforms.linux;
+    license = lib.licenses.free;
+    platforms = lib.platforms.linux;
   };
 }
 
diff --git a/pkgs/development/libraries/poco/default.nix b/pkgs/development/libraries/poco/default.nix
index 1f2d43fce3c38..8f963bb366a93 100644
--- a/pkgs/development/libraries/poco/default.nix
+++ b/pkgs/development/libraries/poco/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, cmake, pkg-config, zlib, pcre, expat, sqlite, openssl, unixODBC, libmysqlclient }:
+{ lib, stdenv, fetchurl, cmake, pkg-config, zlib, pcre, expat, sqlite, openssl, unixODBC, libmysqlclient }:
 
 stdenv.mkDerivation rec {
   pname = "poco";
@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
     "-DPOCO_UNBUNDLED=ON"
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://pocoproject.org/";
     description = "Cross-platform C++ libraries with a network/internet focus";
     license = licenses.boost;
diff --git a/pkgs/development/libraries/podofo/default.nix b/pkgs/development/libraries/podofo/default.nix
index ba743bb6053b5..e50a2111b437e 100644
--- a/pkgs/development/libraries/podofo/default.nix
+++ b/pkgs/development/libraries/podofo/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, cmake, zlib, freetype, libjpeg, libtiff, fontconfig
+{ lib, stdenv, fetchurl, cmake, zlib, freetype, libjpeg, libtiff, fontconfig
 , openssl, libpng, lua5, pkg-config, libidn, expat, fetchpatch
 }:
 
@@ -37,7 +37,7 @@ stdenv.mkDerivation rec {
     moveToOutput lib "$lib"
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://podofo.sourceforge.net";
     description = "A library to work with the PDF file format";
     platforms = platforms.all;
diff --git a/pkgs/development/libraries/polkit-qt-1/qt-4.nix b/pkgs/development/libraries/polkit-qt-1/qt-4.nix
index a758146d40682..0da6e15eb274c 100644
--- a/pkgs/development/libraries/polkit-qt-1/qt-4.nix
+++ b/pkgs/development/libraries/polkit-qt-1/qt-4.nix
@@ -1,6 +1,6 @@
-{ stdenv, fetchurl, cmake, pkg-config, polkit, automoc4, glib, qt4 }:
+{ lib, stdenv, fetchurl, cmake, pkg-config, polkit, automoc4, glib, qt4 }:
 
-with stdenv.lib;
+with lib;
 
 stdenv.mkDerivation {
   name = "polkit-qt-1-qt4-0.112.0";
@@ -25,7 +25,7 @@ stdenv.mkDerivation {
       done
     '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A Qt wrapper around PolKit";
     maintainers = [ maintainers.ttuegel ];
     platforms = platforms.linux;
diff --git a/pkgs/development/libraries/polkit-qt-1/qt-5.nix b/pkgs/development/libraries/polkit-qt-1/qt-5.nix
index 76efca9717b4b..be425b394019d 100644
--- a/pkgs/development/libraries/polkit-qt-1/qt-5.nix
+++ b/pkgs/development/libraries/polkit-qt-1/qt-5.nix
@@ -1,6 +1,6 @@
-{ stdenv, fetchurl, cmake, pkg-config, polkit, glib, qtbase }:
+{ lib, stdenv, fetchurl, cmake, pkg-config, polkit, glib, qtbase }:
 
-with stdenv.lib;
+with lib;
 
 stdenv.mkDerivation {
   name = "polkit-qt-1-qt5-0.112.0";
@@ -24,7 +24,7 @@ stdenv.mkDerivation {
 
   meta = {
     description = "A Qt wrapper around PolKit";
-    maintainers = with stdenv.lib.maintainers; [ ttuegel ];
-    platforms = with stdenv.lib.platforms; linux;
+    maintainers = with lib.maintainers; [ ttuegel ];
+    platforms = with lib.platforms; linux;
   };
 }
diff --git a/pkgs/development/libraries/polkit/default.nix b/pkgs/development/libraries/polkit/default.nix
index 6382097d398c3..7e8e95ef1eacc 100644
--- a/pkgs/development/libraries/polkit/default.nix
+++ b/pkgs/development/libraries/polkit/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, glib, expat, pam, perl, fetchpatch
+{ lib, stdenv, fetchurl, pkg-config, glib, expat, pam, perl, fetchpatch
 , intltool, spidermonkey_78, gobject-introspection, libxslt, docbook_xsl, dbus
 , docbook_xml_dtd_412, gtk-doc, coreutils
 , useSystemd ? (stdenv.isLinux && !stdenv.hostPlatform.isMusl), systemd, elogind
@@ -34,7 +34,7 @@ stdenv.mkDerivation rec {
       url = "https://gitlab.freedesktop.org/polkit/polkit/commit/5dd4e22efd05d55833c4634b56e473812b5acbf2.patch";
       sha256 = "17lv7xj5ksa27iv4zpm4zwd4iy8zbwjj4ximslfq3sasiz9kxhlp";
     })
-  ] ++ stdenv.lib.optionals stdenv.hostPlatform.isMusl [
+  ] ++ lib.optionals stdenv.hostPlatform.isMusl [
     # Make netgroup support optional (musl does not have it)
     # Upstream MR: https://gitlab.freedesktop.org/polkit/polkit/merge_requests/10
     # We use the version of the patch that Alpine uses successfully.
@@ -45,7 +45,7 @@ stdenv.mkDerivation rec {
     })
   ];
 
-  postPatch = stdenv.lib.optionalString stdenv.isDarwin ''
+  postPatch = lib.optionalString stdenv.isDarwin ''
     sed -i -e "s/-Wl,--as-needed//" configure.ac
   '';
 
@@ -57,8 +57,8 @@ stdenv.mkDerivation rec {
   buildInputs =
     [ expat pam spidermonkey_78 ]
     # On Linux, fall back to elogind when systemd support is off.
-    ++ stdenv.lib.optional stdenv.isLinux (if useSystemd then systemd else elogind)
-    ++ stdenv.lib.optional withIntrospection gobject-introspection;
+    ++ lib.optional stdenv.isLinux (if useSystemd then systemd else elogind)
+    ++ lib.optional withIntrospection gobject-introspection;
 
   propagatedBuildInputs = [
     glib # in .pc Requires
@@ -77,7 +77,7 @@ stdenv.mkDerivation rec {
       --replace   /bin/true ${coreutils}/bin/true \
       --replace   /bin/false ${coreutils}/bin/false
 
-  '' + stdenv.lib.optionalString useSystemd /* bogus chroot detection */ ''
+  '' + lib.optionalString useSystemd /* bogus chroot detection */ ''
     sed '/libsystemd autoconfigured/s/.*/:/' -i configure
   '';
 
@@ -88,7 +88,7 @@ stdenv.mkDerivation rec {
     "--with-polkitd-user=polkituser" #TODO? <nixos> config.ids.uids.polkituser
     "--with-os-type=NixOS" # not recognized but prevents impurities on non-NixOS
     (if withIntrospection then "--enable-introspection" else "--disable-introspection")
-  ] ++ stdenv.lib.optional (!doCheck) "--disable-test";
+  ] ++ lib.optional (!doCheck) "--disable-test";
 
   makeFlags = [
     "INTROSPECTION_GIRDIR=${placeholder "out"}/share/gir-1.0"
@@ -111,7 +111,7 @@ stdenv.mkDerivation rec {
     dbus-run-session --config-file=${./system_bus.conf} -- sh -c 'DBUS_SYSTEM_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS make check'
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://www.freedesktop.org/wiki/Software/polkit";
     description = "A toolkit for defining and handling the policy that allows unprivileged processes to speak to privileged processes";
     license = licenses.gpl2;
diff --git a/pkgs/development/libraries/poly2tri-c/default.nix b/pkgs/development/libraries/poly2tri-c/default.nix
index 60d75d340e6d0..1f0ee81da951e 100644
--- a/pkgs/development/libraries/poly2tri-c/default.nix
+++ b/pkgs/development/libraries/poly2tri-c/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , autoreconfHook
 , pkg-config
@@ -32,11 +32,11 @@ stdenv.mkDerivation rec {
     "-Wno-error"
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Library for generating, refining and rendering 2-Dimensional Constrained Delaunay Triangulations";
     homepage = "https://code.google.com/archive/p/poly2tri-c/";
     license = licenses.bsd3;
-    maintainers = with stdenv.lib.maintainers; [ jtojnar ];
+    maintainers = with lib.maintainers; [ jtojnar ];
     platforms = platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/poppler/0.61.nix b/pkgs/development/libraries/poppler/0.61.nix
index bc14107597334..a49bfad7ab314 100644
--- a/pkgs/development/libraries/poppler/0.61.nix
+++ b/pkgs/development/libraries/poppler/0.61.nix
@@ -42,7 +42,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ cmake ninja pkg-config ];
 
   # Not sure when and how to pass it.  It seems an upstream bug anyway.
-  CXXFLAGS = stdenv.lib.optionalString stdenv.cc.isClang "-std=c++11";
+  CXXFLAGS = lib.optionalString stdenv.cc.isClang "-std=c++11";
 
   cmakeFlags = [
     (mkFlag true "XPDF_HEADERS")
diff --git a/pkgs/development/libraries/poppler/default.nix b/pkgs/development/libraries/poppler/default.nix
index 80d5ba19d2b7a..3f2b8453d7f01 100644
--- a/pkgs/development/libraries/poppler/default.nix
+++ b/pkgs/development/libraries/poppler/default.nix
@@ -34,7 +34,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ cmake ninja pkg-config ];
 
   # Workaround #54606
-  preConfigure = stdenv.lib.optionalString stdenv.isDarwin ''
+  preConfigure = lib.optionalString stdenv.isDarwin ''
     sed -i -e '1i cmake_policy(SET CMP0025 NEW)' CMakeLists.txt
   '';
 
diff --git a/pkgs/development/libraries/popt/default.nix b/pkgs/development/libraries/popt/default.nix
index b04a2242ab7aa..393ef2c2c33a5 100644
--- a/pkgs/development/libraries/popt/default.nix
+++ b/pkgs/development/libraries/popt/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl}:
+{lib, stdenv, fetchurl}:
 
 stdenv.mkDerivation rec {
   pname = "popt";
@@ -9,14 +9,14 @@ stdenv.mkDerivation rec {
     sha256 = "1j2c61nn2n351nhj4d25mnf3vpiddcykq005w2h6kw79dwlysa77";
   };
 
-  patches = stdenv.lib.optionals stdenv.isCygwin [
+  patches = lib.optionals stdenv.isCygwin [
     ./1.16-cygwin.patch
     ./1.16-vpath.patch
   ];
 
   doCheck = false; # fails
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Command line option parsing library";
     platforms = platforms.unix;
     license = licenses.mit;
diff --git a/pkgs/development/libraries/portaudio/default.nix b/pkgs/development/libraries/portaudio/default.nix
index da4c3933aaac9..c7de116e879b5 100644
--- a/pkgs/development/libraries/portaudio/default.nix
+++ b/pkgs/development/libraries/portaudio/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, alsaLib, pkg-config, libjack2
+{ lib, stdenv, fetchurl, alsaLib, pkg-config, libjack2
 , AudioUnit, AudioToolbox, CoreAudio, CoreServices, Carbon }:
 
 stdenv.mkDerivation {
@@ -11,15 +11,15 @@ stdenv.mkDerivation {
 
   nativeBuildInputs = [ pkg-config ];
   buildInputs = [ libjack2 ]
-    ++ stdenv.lib.optional (!stdenv.isDarwin) alsaLib;
+    ++ lib.optional (!stdenv.isDarwin) alsaLib;
 
   configureFlags = [ "--disable-mac-universal" "--enable-cxx" ];
 
-  NIX_CFLAGS_COMPILE = stdenv.lib.optionalString stdenv.cc.isClang "-Wno-error=nullability-inferred-on-nested-type -Wno-error=nullability-completeness-on-arrays";
+  NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isClang "-Wno-error=nullability-inferred-on-nested-type -Wno-error=nullability-completeness-on-arrays";
 
-  propagatedBuildInputs = stdenv.lib.optionals stdenv.isDarwin [ AudioUnit AudioToolbox CoreAudio CoreServices Carbon ];
+  propagatedBuildInputs = lib.optionals stdenv.isDarwin [ AudioUnit AudioToolbox CoreAudio CoreServices Carbon ];
 
-  patchPhase = stdenv.lib.optionalString stdenv.isDarwin ''
+  patchPhase = lib.optionalString stdenv.isDarwin ''
     sed -i '50 i\
       #include <CoreAudio/AudioHardware.h>\
       #include <CoreAudio/AudioHardwareBase.h>\
@@ -30,14 +30,14 @@ stdenv.mkDerivation {
   # not sure why, but all the headers seem to be installed by the make install
   installPhase = ''
     make install
-  '' + stdenv.lib.optionalString (!stdenv.isDarwin) ''
+  '' + lib.optionalString (!stdenv.isDarwin) ''
     # fixup .pc file to find alsa library
     sed -i "s|-lasound|-L${alsaLib.out}/lib -lasound|" "$out/lib/pkgconfig/"*.pc
-  '' + stdenv.lib.optionalString stdenv.isDarwin ''
+  '' + lib.optionalString stdenv.isDarwin ''
     cp include/pa_mac_core.h $out/include/pa_mac_core.h
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Portable cross-platform Audio API";
     homepage    = "http://www.portaudio.com/";
     # Not exactly a bsd license, but alike
diff --git a/pkgs/development/libraries/portmidi/default.nix b/pkgs/development/libraries/portmidi/default.nix
index d96e15edd81e5..e9a868240bb3e 100644
--- a/pkgs/development/libraries/portmidi/default.nix
+++ b/pkgs/development/libraries/portmidi/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, unzip, cmake, /*jdk,*/ alsaLib }:
+{ lib, stdenv, fetchurl, unzip, cmake, /*jdk,*/ alsaLib }:
 
 stdenv.mkDerivation rec {
   pname = "portmidi";
@@ -23,7 +23,7 @@ stdenv.mkDerivation rec {
   ];
 
   # XXX: This is to deactivate Java support.
-  patches = stdenv.lib.singleton (fetchurl {
+  patches = lib.singleton (fetchurl {
     url = "https://raw.github.com/Rogentos/argent-gentoo/master/media-libs/"
         + "portmidi/files/portmidi-217-cmake-libdir-java-opts.patch";
     sha256 = "1jbjwan61iqq9fqfpq2a4fd30k3clg7a6j0gfgsw87r8c76kqf6h";
@@ -52,7 +52,7 @@ stdenv.mkDerivation rec {
   meta = {
     homepage = "http://portmedia.sourceforge.net/portmidi/";
     description = "Platform independent library for MIDI I/O";
-    license = stdenv.lib.licenses.mit;
-    platforms = stdenv.lib.platforms.linux;
+    license = lib.licenses.mit;
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/development/libraries/ppl/default.nix b/pkgs/development/libraries/ppl/default.nix
index f1c93e0fa7c71..a94cf9e38d0ef 100644
--- a/pkgs/development/libraries/ppl/default.nix
+++ b/pkgs/development/libraries/ppl/default.nix
@@ -1,4 +1,4 @@
-{ fetchurl, fetchpatch, stdenv, gmpxx, perl, gnum4 }:
+{ fetchurl, fetchpatch, lib, stdenv, gmpxx, perl, gnum4 }:
 
 let version = "1.2"; in
 
@@ -21,7 +21,7 @@ stdenv.mkDerivation {
   propagatedBuildInputs = [ gmpxx ];
 
   configureFlags = [ "--disable-watchdog" ] ++
-    stdenv.lib.optionals stdenv.isDarwin [
+    lib.optionals stdenv.isDarwin [
       "CPPFLAGS=-fexceptions"
       "--disable-ppl_lcdd" "--disable-ppl_lpsol" "--disable-ppl_pips"
     ];
@@ -53,9 +53,9 @@ stdenv.mkDerivation {
 
     homepage = "http://bugseng.com/products/ppl/";
 
-    license = stdenv.lib.licenses.gpl3Plus;
+    license = lib.licenses.gpl3Plus;
 
     maintainers = [ ];
-    platforms = stdenv.lib.platforms.unix;
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/prison/default.nix b/pkgs/development/libraries/prison/default.nix
index d40b4442e38ee..4275622c24f45 100644
--- a/pkgs/development/libraries/prison/default.nix
+++ b/pkgs/development/libraries/prison/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, cmake, qrencode, qt4, libdmtx }:
+{ lib, stdenv, fetchurl, cmake, qrencode, qt4, libdmtx }:
 
 let v = "1.0"; in
 
@@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
 
   meta = {
     description = "Qt4 library for QR-codes";
-    license = stdenv.lib.licenses.mit;
+    license = lib.licenses.mit;
     inherit (qt4.meta) platforms;
   };
 }
diff --git a/pkgs/development/libraries/proj-datumgrid/default.nix b/pkgs/development/libraries/proj-datumgrid/default.nix
index c7a25f6217142..93e415f626995 100644
--- a/pkgs/development/libraries/proj-datumgrid/default.nix
+++ b/pkgs/development/libraries/proj-datumgrid/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub }:
+{ lib, stdenv, fetchFromGitHub }:
 
 stdenv.mkDerivation rec {
   name = "proj-datumgrid";
@@ -22,7 +22,7 @@ stdenv.mkDerivation rec {
     cp nad2bin $out/bin/
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Repository for proj datum grids";
     homepage = "https://proj4.org";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/proj/5.2.nix b/pkgs/development/libraries/proj/5.2.nix
index 7a97491d8ea16..ee76c668716c7 100644
--- a/pkgs/development/libraries/proj/5.2.nix
+++ b/pkgs/development/libraries/proj/5.2.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation {
   name = "proj-5.2.0";
@@ -10,7 +10,7 @@ stdenv.mkDerivation {
 
   doCheck = stdenv.is64bit;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Cartographic Projections Library";
     homepage = "https://proj4.org";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/proj/default.nix b/pkgs/development/libraries/proj/default.nix
index 8618d62e834f4..22d6206fd851b 100644
--- a/pkgs/development/libraries/proj/default.nix
+++ b/pkgs/development/libraries/proj/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, pkg-config, sqlite, autoreconfHook }:
+{ lib, stdenv, fetchFromGitHub, pkg-config, sqlite, autoreconfHook }:
 
 stdenv.mkDerivation rec {
   pname = "proj";
@@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
 
   doCheck = stdenv.is64bit;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Cartographic Projections Library";
     homepage = "https://proj4.org";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/prometheus-client-c/default.nix b/pkgs/development/libraries/prometheus-client-c/default.nix
index 57f4ef5956f60..9b18b25c72684 100644
--- a/pkgs/development/libraries/prometheus-client-c/default.nix
+++ b/pkgs/development/libraries/prometheus-client-c/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , fetchpatch
 , cmake
@@ -50,9 +50,9 @@ let
       meta = {
         homepage = "https://github.com/digitalocean/prometheus-client-c/";
         inherit description;
-        platforms = stdenv.lib.platforms.unix;
-        license = stdenv.lib.licenses.asl20;
-        maintainers = [ stdenv.lib.maintainers.cfsmp3 ];
+        platforms = lib.platforms.unix;
+        license = lib.licenses.asl20;
+        maintainers = [ lib.maintainers.cfsmp3 ];
       };
     };
 in
diff --git a/pkgs/development/libraries/prometheus-cpp/default.nix b/pkgs/development/libraries/prometheus-cpp/default.nix
index 3714e2c89e6bc..173ee6d2e09dd 100644
--- a/pkgs/development/libraries/prometheus-cpp/default.nix
+++ b/pkgs/development/libraries/prometheus-cpp/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , cmake
 , gbenchmark
@@ -41,7 +41,7 @@ stdenv.mkDerivation rec {
   meta = {
     description = "Prometheus Client Library for Modern C++";
     homepage = "https://github.com/jupp0r/prometheus-cpp";
-    license = [ stdenv.lib.licenses.mit ];
+    license = [ lib.licenses.mit ];
   };
 
 }
diff --git a/pkgs/development/libraries/properties-cpp/default.nix b/pkgs/development/libraries/properties-cpp/default.nix
index 54fea18fd17e2..431e6348b3fac 100644
--- a/pkgs/development/libraries/properties-cpp/default.nix
+++ b/pkgs/development/libraries/properties-cpp/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , cmake
 , pkg-config
@@ -26,7 +26,7 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ gtest doxygen graphviz lcov ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://launchpad.net/properties-cpp";
     description = "A very simple convenience library for handling properties and signals in C++11";
     license = licenses.lgpl3Only;
diff --git a/pkgs/development/libraries/protobuf/generic-v3.nix b/pkgs/development/libraries/protobuf/generic-v3.nix
index 4166aac7246bf..f31a7868d5eca 100644
--- a/pkgs/development/libraries/protobuf/generic-v3.nix
+++ b/pkgs/development/libraries/protobuf/generic-v3.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , autoreconfHook, zlib, gmock, buildPackages
 , version, sha256
@@ -25,7 +25,7 @@ mkProtobufDerivation = buildProtobuf: stdenv: stdenv.mkDerivation {
     chmod -R a+w gmock
     chmod -R a+w googletest
     ln -s ../googletest gmock/gtest
-  '' + stdenv.lib.optionalString stdenv.isDarwin ''
+  '' + lib.optionalString stdenv.isDarwin ''
     substituteInPlace src/google/protobuf/testing/googletest.cc \
       --replace 'tmpnam(b)' '"'$TMPDIR'/foo"'
   '';
@@ -48,8 +48,8 @@ mkProtobufDerivation = buildProtobuf: stdenv: stdenv.mkDerivation {
         yet extensible format. Google uses Protocol Buffers for almost all of
         its internal RPC protocols and file formats.
       '';
-    license = stdenv.lib.licenses.bsd3;
-    platforms = stdenv.lib.platforms.unix;
+    license = lib.licenses.bsd3;
+    platforms = lib.platforms.unix;
     homepage = "https://developers.google.com/protocol-buffers/";
   };
 
diff --git a/pkgs/development/libraries/protobuf/generic.nix b/pkgs/development/libraries/protobuf/generic.nix
index 32d6f70d1eb69..7d64df4362608 100644
--- a/pkgs/development/libraries/protobuf/generic.nix
+++ b/pkgs/development/libraries/protobuf/generic.nix
@@ -1,4 +1,4 @@
-{ stdenv, version, src
+{ lib, stdenv, version, src
 , autoreconfHook, zlib, gtest
 , ...
 }:
@@ -13,7 +13,7 @@ stdenv.mkDerivation {
     rm -rf gtest
     cp -r ${gtest.src}/googletest gtest
     chmod -R a+w gtest
-  '' + stdenv.lib.optionalString stdenv.isDarwin ''
+  '' + lib.optionalString stdenv.isDarwin ''
     substituteInPlace src/google/protobuf/testing/googletest.cc \
       --replace 'tmpnam(b)' '"'$TMPDIR'/foo"'
   '';
@@ -54,7 +54,7 @@ stdenv.mkDerivation {
       '';
     license = "mBSD";
     homepage = "https://developers.google.com/protocol-buffers/";
-    platforms = stdenv.lib.platforms.unix;
+    platforms = lib.platforms.unix;
   };
 
   passthru.version = version;
diff --git a/pkgs/development/libraries/protobufc/generic.nix b/pkgs/development/libraries/protobufc/generic.nix
index c9c246f1910fe..b64d75076bafb 100644
--- a/pkgs/development/libraries/protobufc/generic.nix
+++ b/pkgs/development/libraries/protobufc/generic.nix
@@ -1,4 +1,4 @@
-{ stdenv, src, version
+{ lib, stdenv, src, version
 , autoreconfHook, pkg-config, protobuf, zlib
 , ...
 }:
@@ -12,7 +12,7 @@ stdenv.mkDerivation {
   nativeBuildInputs = [ autoreconfHook pkg-config ];
   buildInputs = [ protobuf zlib ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/protobuf-c/protobuf-c/";
     description = "C bindings for Google's Protocol Buffers";
     license = licenses.bsd2;
diff --git a/pkgs/development/libraries/prototypejs/default.nix b/pkgs/development/libraries/prototypejs/default.nix
index 3753dfacac3ba..81e72036694b4 100644
--- a/pkgs/development/libraries/prototypejs/default.nix
+++ b/pkgs/development/libraries/prototypejs/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, ... }:
+{ lib, stdenv, fetchurl, ... }:
 let
   version = "1.7.3.0";
 in fetchurl {
@@ -6,7 +6,7 @@ in fetchurl {
   url = "https://ajax.googleapis.com/ajax/libs/prototype/${version}/prototype.js";
   sha256 = "0q43vvrsb22h4jvavs1gk3v4ps61yx9k85b5n6q9mxivhmxprg26";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A foundation for ambitious web user interfaces";
     longDescription = ''
       Prototype takes the complexity out of client-side web
diff --git a/pkgs/development/libraries/protozero/default.nix b/pkgs/development/libraries/protozero/default.nix
index 1c8e7e99313ab..6bff5998b56d6 100644
--- a/pkgs/development/libraries/protozero/default.nix
+++ b/pkgs/development/libraries/protozero/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake }:
+{ lib, stdenv, fetchFromGitHub, cmake }:
 
 stdenv.mkDerivation rec {
   pname = "protozero";
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ cmake ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Minimalistic protocol buffer decoder and encoder in C++";
     homepage = "https://github.com/mapbox/protozero";
     license = with licenses; [ bsd2 asl20 ];
diff --git a/pkgs/development/libraries/pslib/default.nix b/pkgs/development/libraries/pslib/default.nix
index 35c4f7c3b2d5c..ec2362009ff33 100644
--- a/pkgs/development/libraries/pslib/default.nix
+++ b/pkgs/development/libraries/pslib/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, cmake, pkg-config, zlib, libpng, libjpeg, libungif, libtiff
+{ lib, stdenv, fetchurl, cmake, pkg-config, zlib, libpng, libjpeg, libungif, libtiff
 }:
 
 stdenv.mkDerivation rec {
@@ -32,7 +32,7 @@ stdenv.mkDerivation rec {
     cp -r ../doc/. $doc/share/doc/${pname}
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A C-library for generating multi page PostScript documents";
     homepage = "http://pslib.sourceforge.net/";
     changelog =
diff --git a/pkgs/development/libraries/psol/generic.nix b/pkgs/development/libraries/psol/generic.nix
index c61926fe13faa..57784c3a50288 100644
--- a/pkgs/development/libraries/psol/generic.nix
+++ b/pkgs/development/libraries/psol/generic.nix
@@ -1,4 +1,4 @@
-{ fetchzip, stdenv }:
+{ fetchzip, lib, stdenv }:
 { version, sha256 }:
 { inherit version; } // fetchzip {
   inherit sha256;
@@ -8,9 +8,9 @@
   meta = {
     description = "PageSpeed Optimization Libraries";
     homepage    = "https://developers.google.com/speed/pagespeed/psol";
-    license     = stdenv.lib.licenses.asl20;
+    license     = lib.licenses.asl20;
     # WARNING: This only works with Linux because the pre-built PSOL binary is only supplied for Linux.
     # TODO: Build PSOL from source to support more platforms.
-    platforms   = stdenv.lib.platforms.linux;
+    platforms   = lib.platforms.linux;
   };
 }
diff --git a/pkgs/development/libraries/psqlodbc/default.nix b/pkgs/development/libraries/psqlodbc/default.nix
index 43da67d3d9b69..82ee5c3ae44d6 100644
--- a/pkgs/development/libraries/psqlodbc/default.nix
+++ b/pkgs/development/libraries/psqlodbc/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, libiodbc, postgresql, openssl }:
+{ lib, stdenv, fetchurl, libiodbc, postgresql, openssl }:
 
 stdenv.mkDerivation rec {
   name = "psqlodbc-09.01.0200";
@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
 
   configureFlags = [ "--with-iodbc=${libiodbc}" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://odbc.postgresql.org/";
     description = "ODBC driver for PostgreSQL";
     license = licenses.lgpl2;
diff --git a/pkgs/development/libraries/pstreams/default.nix b/pkgs/development/libraries/pstreams/default.nix
index e3cb9dd67a3bc..bb9b6bc9c84bd 100644
--- a/pkgs/development/libraries/pstreams/default.nix
+++ b/pkgs/development/libraries/pstreams/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchgit
 }:
 
@@ -8,7 +8,7 @@ stdenv.mkDerivation rec {
 
   src = fetchgit {
     url = "https://git.code.sf.net/p/pstreams/code";
-    rev = let dot2Underscore = stdenv.lib.strings.stringAsChars (c: if c == "." then "_" else c);
+    rev = let dot2Underscore = lib.strings.stringAsChars (c: if c == "." then "_" else c);
           in "RELEASE_${dot2Underscore version}";
     sha256 = "0r8aj0nh5mkf8cvnzl8bdy4nm7i74vs83axxfimcd74kjfn0irys";
   };
@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
     # `make install` fails on case-insensitive file systems (e.g. APFS by
     # default) because this target exists
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "POSIX Process Control in C++";
     longDescription = ''
       PStreams allows you to run another program from your C++ application and
diff --git a/pkgs/development/libraries/ptex/default.nix b/pkgs/development/libraries/ptex/default.nix
index 09b3ce23e0803..3f62d672ea978 100644
--- a/pkgs/development/libraries/ptex/default.nix
+++ b/pkgs/development/libraries/ptex/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, zlib, python, cmake, pkg-config }:
+{ lib, stdenv, fetchFromGitHub, zlib, python, cmake, pkg-config }:
 
 stdenv.mkDerivation rec
 {
@@ -23,7 +23,7 @@ stdenv.mkDerivation rec
     echo v${version} >version
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Per-Face Texture Mapping for Production Rendering";
     homepage = "http://ptex.us/";
     license = licenses.bsd3;
diff --git a/pkgs/development/libraries/pth/default.nix b/pkgs/development/libraries/pth/default.nix
index c64d0b37686b6..240c903a8a771 100644
--- a/pkgs/development/libraries/pth/default.nix
+++ b/pkgs/development/libraries/pth/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
   name = "pth-2.0.7";
@@ -8,13 +8,13 @@ stdenv.mkDerivation rec {
     sha256 = "0ckjqw5kz5m30srqi87idj7xhpw6bpki43mj07bazjm2qmh3cdbj";
   };
 
-  preConfigure = stdenv.lib.optionalString stdenv.isAarch32 ''
+  preConfigure = lib.optionalString stdenv.isAarch32 ''
     configureFlagsArray=("CFLAGS=-DJB_SP=8 -DJB_PC=9")
-  '' + stdenv.lib.optionalString (stdenv.hostPlatform.libc == "glibc") ''
+  '' + lib.optionalString (stdenv.hostPlatform.libc == "glibc") ''
     configureFlagsArray+=("ac_cv_check_sjlj=ssjlj")
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "The GNU Portable Threads library";
     homepage = "https://www.gnu.org/software/pth";
     license = licenses.lgpl21Plus;
diff --git a/pkgs/development/libraries/pupnp/default.nix b/pkgs/development/libraries/pupnp/default.nix
index 4930b222d03c8..1500056463794 100644
--- a/pkgs/development/libraries/pupnp/default.nix
+++ b/pkgs/development/libraries/pupnp/default.nix
@@ -1,4 +1,4 @@
-{ fetchFromGitHub, stdenv, autoreconfHook, pkg-config }:
+{ fetchFromGitHub, lib, stdenv, autoreconfHook, pkg-config }:
 
 stdenv.mkDerivation rec {
   pname = "libupnp";
@@ -29,6 +29,6 @@ stdenv.mkDerivation rec {
     license = "BSD-style";
 
     homepage = "http://pupnp.sourceforge.net/";
-    platforms = stdenv.lib.platforms.unix;
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/pxlib/default.nix b/pkgs/development/libraries/pxlib/default.nix
index 2624c718d274e..3acaf8bac1573 100644
--- a/pkgs/development/libraries/pxlib/default.nix
+++ b/pkgs/development/libraries/pxlib/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, intltool }:
+{ lib, stdenv, fetchurl, intltool }:
 
 stdenv.mkDerivation rec {
   pname = "pxlib";
@@ -10,7 +10,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ intltool ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Library to read and write Paradox files";
     homepage = "http://pxlib.sourceforge.net/";
     license = licenses.gpl2;
diff --git a/pkgs/development/libraries/pyotherside/default.nix b/pkgs/development/libraries/pyotherside/default.nix
index 047142c8a5dff..58d38651a7607 100644
--- a/pkgs/development/libraries/pyotherside/default.nix
+++ b/pkgs/development/libraries/pyotherside/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub
+{ lib, stdenv, fetchFromGitHub
 , python3, qmake, qtbase, qtquickcontrols, qtsvg, ncurses }:
 
 stdenv.mkDerivation rec {
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
   patches = [ ./qml-path.patch ];
   installTargets = [ "sub-src-install_subtargets" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Asynchronous Python 3 Bindings for Qt 5";
     homepage = "https://thp.io/2011/pyotherside/";
     license = licenses.isc;
diff --git a/pkgs/development/libraries/python-qt/default.nix b/pkgs/development/libraries/python-qt/default.nix
index 6f2550ca9aca7..bd778f1a945d5 100644
--- a/pkgs/development/libraries/python-qt/default.nix
+++ b/pkgs/development/libraries/python-qt/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, python, qmake,
+{ lib, stdenv, fetchurl, python, qmake,
   qtwebengine, qtxmlpatterns,
   qttools, unzip }:
 
@@ -32,7 +32,7 @@ stdenv.mkDerivation rec {
     cp -r ./extensions $out/include/PythonQt
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "PythonQt is a dynamic Python binding for the Qt framework. It offers an easy way to embed the Python scripting language into your C++ Qt applications";
     homepage = "http://pythonqt.sourceforge.net/";
     license = licenses.lgpl21;
diff --git a/pkgs/development/libraries/qca-qt5/default.nix b/pkgs/development/libraries/qca-qt5/default.nix
index c735b15336af4..2b16f0f09b076 100644
--- a/pkgs/development/libraries/qca-qt5/default.nix
+++ b/pkgs/development/libraries/qca-qt5/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, cmake, openssl, pkg-config, qtbase }:
+{ lib, stdenv, fetchurl, cmake, openssl, pkg-config, qtbase }:
 
 stdenv.mkDerivation rec {
   pname = "qca-qt5";
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
 
   # Without this patch cmake fails with a "No known features for CXX compiler"
   # error on darwin
-  patches = stdenv.lib.optional stdenv.isDarwin ./move-project.patch ;
+  patches = lib.optional stdenv.isDarwin ./move-project.patch ;
 
   # tells CMake to use this CA bundle file if it is accessible
   preConfigure = ''export QC_CERTSTORE_PATH=/etc/ssl/certs/ca-certificates.crt'';
@@ -22,7 +22,7 @@ stdenv.mkDerivation rec {
   # tricks CMake into using this CA bundle file if it is not accessible (in a sandbox)
   cmakeFlags = [ "-Dqca_CERTSTORE=/etc/ssl/certs/ca-certificates.crt" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Qt 5 Cryptographic Architecture";
     homepage = "http://delta.affinix.com/qca";
     maintainers = with maintainers; [ ttuegel ];
diff --git a/pkgs/development/libraries/qca2/default.nix b/pkgs/development/libraries/qca2/default.nix
index b637b49138784..42dcf1a87d36a 100644
--- a/pkgs/development/libraries/qca2/default.nix
+++ b/pkgs/development/libraries/qca2/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, openssl, cmake, pkg-config, qt, darwin }:
+{ lib, stdenv, fetchurl, openssl, cmake, pkg-config, qt, darwin }:
 
 stdenv.mkDerivation rec {
   pname = "qca";
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ cmake pkg-config ];
   buildInputs = [ openssl qt ]
-    ++ stdenv.lib.optional stdenv.isDarwin darwin.apple_sdk.frameworks.Security;
+    ++ lib.optional stdenv.isDarwin darwin.apple_sdk.frameworks.Security;
 
   # tells CMake to use this CA bundle file if it is accessible
   preConfigure = ''
@@ -25,7 +25,7 @@ stdenv.mkDerivation rec {
     sed -i -e '1i cmake_policy(SET CMP0025 NEW)' CMakeLists.txt
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Qt Cryptographic Architecture";
     license = "LGPL";
     homepage = "http://delta.affinix.com/qca";
diff --git a/pkgs/development/libraries/qhull/default.nix b/pkgs/development/libraries/qhull/default.nix
index 689a4877541c0..78e1113531153 100644
--- a/pkgs/development/libraries/qhull/default.nix
+++ b/pkgs/development/libraries/qhull/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake }:
+{ lib, stdenv, fetchFromGitHub, cmake }:
 
 stdenv.mkDerivation {
   name = "qhull-2016.1";
@@ -12,7 +12,7 @@ stdenv.mkDerivation {
 
   nativeBuildInputs = [ cmake ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://www.qhull.org/";
     description = "Compute the convex hull, Delaunay triangulation, Voronoi diagram and more";
     license = licenses.qhull;
diff --git a/pkgs/development/libraries/qimageblitz/default.nix b/pkgs/development/libraries/qimageblitz/default.nix
index 899f1d1f00beb..709a3fb1533d4 100644
--- a/pkgs/development/libraries/qimageblitz/default.nix
+++ b/pkgs/development/libraries/qimageblitz/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, cmake, qt4}:
+{lib, stdenv, fetchurl, cmake, qt4}:
 
 let
   pn = "qimageblitz";
@@ -20,8 +20,8 @@ stdenv.mkDerivation {
 
   meta = {
     description = "Graphical effect and filter library for KDE4";
-    license = stdenv.lib.licenses.bsd2;
+    license = lib.licenses.bsd2;
     homepage = "http://${pn}.sourceforge.net";
-    platforms = stdenv.lib.platforms.linux;
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/development/libraries/qjson/default.nix b/pkgs/development/libraries/qjson/default.nix
index ee1c36c3244ac..a6ee272a38b5c 100644
--- a/pkgs/development/libraries/qjson/default.nix
+++ b/pkgs/development/libraries/qjson/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, qt4 }:
+{ lib, stdenv, fetchFromGitHub, cmake, qt4 }:
 
 stdenv.mkDerivation rec {
   version = "0.9.0";
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ cmake ];
   buildInputs = [ qt4 ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Lightweight data-interchange format";
     homepage = "http://qjson.sourceforge.net/";
     license = licenses.lgpl21;
diff --git a/pkgs/development/libraries/qmlbox2d/default.nix b/pkgs/development/libraries/qmlbox2d/default.nix
index 03247f9d695b7..88c945430451f 100644
--- a/pkgs/development/libraries/qmlbox2d/default.nix
+++ b/pkgs/development/libraries/qmlbox2d/default.nix
@@ -1,4 +1,4 @@
-{stdenv, qtdeclarative, fetchFromGitHub, qmake }:
+{lib, stdenv, qtdeclarative, fetchFromGitHub, qmake }:
 stdenv.mkDerivation {
   name = "qml-box2d-2018-04-06";
   src = fetchFromGitHub {
@@ -21,7 +21,7 @@ stdenv.mkDerivation {
 
   installFlags = [ "INSTALL_ROOT=$(out)" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A QML plugin for Box2D engine";
     homepage = "https://github.com/qml-box2d/qml-box2d";
     maintainers = [ maintainers.guibou ];
diff --git a/pkgs/development/libraries/qmltermwidget/default.nix b/pkgs/development/libraries/qmltermwidget/default.nix
index 53e83182c2b0c..75f95a53800a8 100644
--- a/pkgs/development/libraries/qmltermwidget/default.nix
+++ b/pkgs/development/libraries/qmltermwidget/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, qtbase, qtquick1, qmake, qtmultimedia, utmp, fetchpatch }:
+{ lib, stdenv, fetchFromGitHub, qtbase, qtquick1, qmake, qtmultimedia, utmp, fetchpatch }:
 
 stdenv.mkDerivation {
   version = "2018-11-24";
@@ -12,7 +12,7 @@ stdenv.mkDerivation {
   };
 
   buildInputs = [ qtbase qtquick1 qtmultimedia ]
-                ++ stdenv.lib.optional stdenv.isDarwin utmp;
+                ++ lib.optional stdenv.isDarwin utmp;
   nativeBuildInputs = [ qmake ];
 
   patches = [
@@ -35,8 +35,8 @@ stdenv.mkDerivation {
   meta = {
     description = "A QML port of qtermwidget";
     homepage = "https://github.com/Swordfish90/qmltermwidget";
-    license = stdenv.lib.licenses.gpl2;
-    platforms = with stdenv.lib.platforms; linux ++ darwin;
-    maintainers = with stdenv.lib.maintainers; [ skeidel ];
+    license = lib.licenses.gpl2;
+    platforms = with lib.platforms; linux ++ darwin;
+    maintainers = with lib.maintainers; [ skeidel ];
   };
 }
diff --git a/pkgs/development/libraries/qoauth/default.nix b/pkgs/development/libraries/qoauth/default.nix
index 41e4b80d9c3aa..8afa19c229fa2 100644
--- a/pkgs/development/libraries/qoauth/default.nix
+++ b/pkgs/development/libraries/qoauth/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, qtbase, qmake, qca-qt5 }:
+{ lib, stdenv, fetchurl, qtbase, qmake, qca-qt5 }:
 
 stdenv.mkDerivation {
   name = "qoauth-2.0.0";
@@ -21,7 +21,7 @@ stdenv.mkDerivation {
   NIX_CFLAGS_COMPILE = "-I${qca-qt5}/include/Qca-qt5/QtCrypto";
   NIX_LDFLAGS = "-lqca-qt5";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Qt library for OAuth authentication";
     inherit (qtbase.meta) platforms;
     license = licenses.lgpl21;
diff --git a/pkgs/development/libraries/qpdf/default.nix b/pkgs/development/libraries/qpdf/default.nix
index a427bd5d05189..aba9e77691a9d 100644
--- a/pkgs/development/libraries/qpdf/default.nix
+++ b/pkgs/development/libraries/qpdf/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, libjpeg, zlib, perl }:
+{ lib, stdenv, fetchFromGitHub, libjpeg, zlib, perl }:
 
 stdenv.mkDerivation rec {
   pname = "qpdf";
@@ -22,7 +22,7 @@ stdenv.mkDerivation rec {
   doCheck = true;
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://qpdf.sourceforge.net/";
     description = "A C++ library and set of programs that inspect and manipulate the structure of PDF files";
     license = licenses.asl20; # as of 7.0.0, people may stay at artistic2
diff --git a/pkgs/development/libraries/qrcodegen/default.nix b/pkgs/development/libraries/qrcodegen/default.nix
index b5faaf90ef7a6..80ce9e1d0f851 100644
--- a/pkgs/development/libraries/qrcodegen/default.nix
+++ b/pkgs/development/libraries/qrcodegen/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub }:
+{ lib, stdenv, fetchFromGitHub }:
 stdenv.mkDerivation rec {
   pname = "qrcodegen";
   version = "1.6.0";
@@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
     cp qrcodegen.h $out/include/qrcodegen/
   '';
 
-  meta = with stdenv.lib;
+  meta = with lib;
     {
       description = "qrcode generator library in multiple languages";
 
diff --git a/pkgs/development/libraries/qrencode/default.nix b/pkgs/development/libraries/qrencode/default.nix
index 3b4764151e349..c005b835a9322 100644
--- a/pkgs/development/libraries/qrencode/default.nix
+++ b/pkgs/development/libraries/qrencode/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, SDL2, libpng, libiconv }:
+{ lib, stdenv, fetchurl, pkg-config, SDL2, libpng, libiconv }:
 
 stdenv.mkDerivation rec {
   pname = "qrencode";
@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
   };
 
   nativeBuildInputs = [ pkg-config ];
-  buildInputs = [ SDL2 libpng ] ++ stdenv.lib.optionals stdenv.isDarwin [ libiconv ];
+  buildInputs = [ SDL2 libpng ] ++ lib.optionals stdenv.isDarwin [ libiconv ];
 
   configureFlags = [
     "--with-tests"
@@ -30,7 +30,7 @@ stdenv.mkDerivation rec {
     runHook postCheck
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://fukuchi.org/works/qrencode/";
     description = "C library for encoding data in a QR Code symbol";
 
diff --git a/pkgs/development/libraries/qrupdate/default.nix b/pkgs/development/libraries/qrupdate/default.nix
index b941021cb688c..3e4109b1bf0b3 100644
--- a/pkgs/development/libraries/qrupdate/default.nix
+++ b/pkgs/development/libraries/qrupdate/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , gfortran
 , blas
@@ -24,7 +24,7 @@ stdenv.mkDerivation rec {
       "LAPACK=-L${lapack}/lib -llapack"
       "BLAS=-L${blas}/lib -lblas"
       "PREFIX=${placeholder "out"}"
-      ${stdenv.lib.optionalString blas.isILP64
+      ${lib.optionalString blas.isILP64
       # If another application intends to use qrupdate compiled with blas with
       # 64 bit support, it should add this to it's FFLAGS as well. See (e.g):
       # https://savannah.gnu.org/bugs/?50339
@@ -39,13 +39,13 @@ stdenv.mkDerivation rec {
 
   buildFlags = [ "lib" "solib" ];
 
-  installTargets = stdenv.lib.optionals stdenv.isDarwin [ "install-staticlib" "install-shlib" ];
+  installTargets = lib.optionals stdenv.isDarwin [ "install-staticlib" "install-shlib" ];
 
   buildInputs = [ gfortran ];
 
   nativeBuildInputs = [ which ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Library for fast updating of qr and cholesky decompositions";
     homepage = "https://sourceforge.net/projects/qrupdate/";
     license = licenses.gpl3Plus;
diff --git a/pkgs/development/libraries/qscintilla/default.nix b/pkgs/development/libraries/qscintilla/default.nix
index 19aebd715d6ba..26a3c2e36d3b6 100644
--- a/pkgs/development/libraries/qscintilla/default.nix
+++ b/pkgs/development/libraries/qscintilla/default.nix
@@ -46,7 +46,7 @@ in stdenv.mkDerivation rec {
       --replace '$$[QT_INSTALL_DATA]'         $out/share${lib.optionalString (! withQt5) "/qt"}
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A Qt port of the Scintilla text editing library";
     longDescription = ''
       QScintilla is a port to Qt of Neil Hodgson's Scintilla C++ editor
diff --git a/pkgs/development/libraries/qt-3/default.nix b/pkgs/development/libraries/qt-3/default.nix
index f5837717622c5..0bc7d938be69a 100644
--- a/pkgs/development/libraries/qt-3/default.nix
+++ b/pkgs/development/libraries/qt-3/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl
+{ lib, stdenv, fetchurl
 , xftSupport ? true, libXft ? null
 , xrenderSupport ? true, libXrender ? null
 , xrandrSupport ? true, libXrandr ? null
@@ -6,8 +6,8 @@
 , cursorSupport ? true, libXcursor ? null
 , threadSupport ? true
 , mysqlSupport ? false, libmysqlclient ? null
-, libGLSupported ? stdenv.lib.elem stdenv.hostPlatform.system stdenv.lib.platforms.mesaPlatforms
-, openglSupport ? stdenv.lib.elem stdenv.hostPlatform.system stdenv.lib.platforms.mesaPlatforms
+, libGLSupported ? lib.elem stdenv.hostPlatform.system stdenv.lib.platforms.mesaPlatforms
+, openglSupport ? lib.elem stdenv.hostPlatform.system stdenv.lib.platforms.mesaPlatforms
 , libGL ? null, libGLU ? null, libXmu ? null
 , xlibsWrapper, xorgproto, zlib, libjpeg, libpng, which
 }:
@@ -37,7 +37,7 @@ stdenv.mkDerivation {
   hardeningDisable = [ "format" ];
 
   configureFlags = let
-    mk = cond: name: "-${stdenv.lib.optionalString (!cond) "no-"}${name}";
+    mk = cond: name: "-${lib.optionalString (!cond) "no-"}${name}";
   in [
     "-v"
     "-system-zlib" "-system-libpng" "-system-libjpeg"
@@ -49,21 +49,21 @@ stdenv.mkDerivation {
     (mk xineramaSupport "xinerama")
     (mk xrandrSupport "xrandr")
     (mk xftSupport "xft")
-  ] ++ stdenv.lib.optionals openglSupport [
+  ] ++ lib.optionals openglSupport [
     "-dlopen-opengl"
     "-L${libGL}/lib" "-I${libGLU}/include"
     "-L${libXmu.out}/lib" "-I${libXmu.dev}/include"
-  ] ++ stdenv.lib.optionals xrenderSupport [
+  ] ++ lib.optionals xrenderSupport [
     "-L${libXrender.out}/lib" "-I${libXrender.dev}/include"
-  ] ++ stdenv.lib.optionals xrandrSupport [
+  ] ++ lib.optionals xrandrSupport [
     "-L${libXrandr.out}/lib" "-I${libXrandr.dev}/include"
-  ] ++ stdenv.lib.optionals xineramaSupport [
+  ] ++ lib.optionals xineramaSupport [
     "-L${libXinerama.out}/lib" "-I${libXinerama.dev}/include"
-  ] ++ stdenv.lib.optionals cursorSupport [
+  ] ++ lib.optionals cursorSupport [
     "-L${libXcursor.out}/lib -I${libXcursor.dev}/include"
-  ] ++ stdenv.lib.optionals mysqlSupport [
+  ] ++ lib.optionals mysqlSupport [
     "-qt-sql-mysql" "-L${libmysqlclient}/lib/mysql" "-I${libmysqlclient}/include/mysql"
-  ] ++ stdenv.lib.optionals xftSupport [
+  ] ++ lib.optionals xftSupport [
     "-L${libXft.out}/lib" "-I${libXft.dev}/include"
     "-L${libXft.freetype.out}/lib" "-I${libXft.freetype.dev}/include"
     "-L${libXft.fontconfig.lib}/lib" "-I${libXft.fontconfig.dev}/include"
@@ -85,7 +85,7 @@ stdenv.mkDerivation {
 
   passthru = {inherit mysqlSupport;};
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     license = with licenses; [ gpl2 qpl ];
     platforms = platforms.linux;
   };
diff --git a/pkgs/development/libraries/qt-4.x/4.8/default.nix b/pkgs/development/libraries/qt-4.x/4.8/default.nix
index c92218f9fe5e6..9ddb2cc5baca8 100644
--- a/pkgs/development/libraries/qt-4.x/4.8/default.nix
+++ b/pkgs/development/libraries/qt-4.x/4.8/default.nix
@@ -4,7 +4,7 @@
 , libmng, which, libGLU, openssl, dbus, cups, pkg-config
 , libtiff, glib, icu, libmysqlclient, postgresql, sqlite, perl, coreutils, libXi
 , alsaLib
-, libGLSupported ? stdenv.lib.elem stdenv.hostPlatform.system stdenv.lib.platforms.mesaPlatforms
+, libGLSupported ? lib.elem stdenv.hostPlatform.system stdenv.lib.platforms.mesaPlatforms
 , flashplayerFix ? false, gdk-pixbuf
 , gtkStyle ? stdenv.hostPlatform == stdenv.buildPlatform, gtk2
 , gnomeStyle ? false, libgnomeui, GConf, gnome_vfs
diff --git a/pkgs/development/libraries/qt-mobility/default.nix b/pkgs/development/libraries/qt-mobility/default.nix
index ba44a217e3d71..60c1d2754d70d 100644
--- a/pkgs/development/libraries/qt-mobility/default.nix
+++ b/pkgs/development/libraries/qt-mobility/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, qt4, libX11, coreutils, bluez, perl }:
+{ lib, stdenv, fetchFromGitHub, qt4, libX11, coreutils, bluez, perl }:
 # possible additional dependencies: pulseaudio udev networkmanager immerson qmf
 
 stdenv.mkDerivation rec {
@@ -42,7 +42,7 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ qt4 libX11 bluez perl ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Qt Mobility";
     homepage = "http://qt.nokia.com/products/qt-addons/mobility";
     maintainers = [ maintainers.qknight ];
diff --git a/pkgs/development/libraries/qtkeychain/default.nix b/pkgs/development/libraries/qtkeychain/default.nix
index 60eb19ac0c7e8..6da4abb756e69 100644
--- a/pkgs/development/libraries/qtkeychain/default.nix
+++ b/pkgs/development/libraries/qtkeychain/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, pkg-config, qt4 ? null
+{ lib, stdenv, fetchFromGitHub, cmake, pkg-config, qt4 ? null
 , withQt5 ? false, qtbase ? null, qttools ? null
 , darwin ? null
 , libsecret
@@ -24,12 +24,12 @@ stdenv.mkDerivation rec {
   cmakeFlags = [ "-DQT_TRANSLATIONS_DIR=share/qt/translations" ];
 
   nativeBuildInputs = [ cmake ]
-    ++ stdenv.lib.optionals (!stdenv.isDarwin) [ pkg-config ] # for finding libsecret
+    ++ lib.optionals (!stdenv.isDarwin) [ pkg-config ] # for finding libsecret
   ;
 
-  buildInputs = stdenv.lib.optionals (!stdenv.isDarwin) [ libsecret ]
+  buildInputs = lib.optionals (!stdenv.isDarwin) [ libsecret ]
     ++ (if withQt5 then [ qtbase qttools ] else [ qt4 ])
-    ++ stdenv.lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [
+    ++ lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [
       CoreFoundation Security
     ])
   ;
@@ -37,7 +37,7 @@ stdenv.mkDerivation rec {
   meta = {
     description = "Platform-independent Qt API for storing passwords securely";
     homepage = "https://github.com/frankosterfeld/qtkeychain";
-    license = stdenv.lib.licenses.bsd3;
-    platforms = stdenv.lib.platforms.unix;
+    license = lib.licenses.bsd3;
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/qtpbfimageplugin/default.nix b/pkgs/development/libraries/qtpbfimageplugin/default.nix
index ecff7f7f8215b..3558201015c6b 100644
--- a/pkgs/development/libraries/qtpbfimageplugin/default.nix
+++ b/pkgs/development/libraries/qtpbfimageplugin/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, qmake, qtbase, protobuf }:
+{ lib, stdenv, fetchFromGitHub, qmake, qtbase, protobuf }:
 
 stdenv.mkDerivation rec {
   pname = "qtpbfimageplugin";
@@ -18,13 +18,13 @@ stdenv.mkDerivation rec {
     # Fix plugin dir
     substituteInPlace pbfplugin.pro \
       --replace "\$\$[QT_INSTALL_PLUGINS]" "$out/$qtPluginPrefix"
-  '' + stdenv.lib.optionalString stdenv.isDarwin ''
+  '' + lib.optionalString stdenv.isDarwin ''
     # Fix darwin build
     substituteInPlace pbfplugin.pro \
       --replace '$$PROTOBUF/lib/libprotobuf-lite.a' '${protobuf}/lib/libprotobuf-lite.dylib'
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Qt image plugin for displaying Mapbox vector tiles";
     longDescription = ''
       QtPBFImagePlugin is a Qt image plugin that enables applications capable of
diff --git a/pkgs/development/libraries/qtscriptgenerator/default.nix b/pkgs/development/libraries/qtscriptgenerator/default.nix
index a6cffd73c3ff7..0164f8884a27f 100644
--- a/pkgs/development/libraries/qtscriptgenerator/default.nix
+++ b/pkgs/development/libraries/qtscriptgenerator/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, qt4 }:
+{ lib, stdenv, fetchurl, qt4 }:
 
 stdenv.mkDerivation {
   name = "qtscriptgenerator-0.1.0";
@@ -43,6 +43,6 @@ stdenv.mkDerivation {
     description = "QtScript bindings generator";
     homepage = "https://code.qt.io/cgit/qt-labs/qtscriptgenerator.git/";
     inherit (qt4.meta) platforms;
-    license = stdenv.lib.licenses.lgpl21;
+    license = lib.licenses.lgpl21;
   };
 }
diff --git a/pkgs/development/libraries/qtstyleplugin-kvantum-qt4/default.nix b/pkgs/development/libraries/qtstyleplugin-kvantum-qt4/default.nix
index a5c96dc351b9e..7290b3830d070 100644
--- a/pkgs/development/libraries/qtstyleplugin-kvantum-qt4/default.nix
+++ b/pkgs/development/libraries/qtstyleplugin-kvantum-qt4/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, qmake4Hook , qt4, libX11, libXext }:
+{ lib, stdenv, fetchFromGitHub, qmake4Hook , qt4, libX11, libXext }:
 
 stdenv.mkDerivation rec {
   pname = "qtstyleplugin-kvantum-qt4";
@@ -28,7 +28,7 @@ stdenv.mkDerivation rec {
     mv $TMP/kvantum/${qt4}/lib $out
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "SVG-based Qt4 theme engine";
     homepage = "https://github.com/tsujan/Kvantum";
     license = licenses.gpl2;
diff --git a/pkgs/development/libraries/qtstyleplugin-kvantum/default.nix b/pkgs/development/libraries/qtstyleplugin-kvantum/default.nix
index 71ca8e720a417..c2fa32b6d05a7 100644
--- a/pkgs/development/libraries/qtstyleplugin-kvantum/default.nix
+++ b/pkgs/development/libraries/qtstyleplugin-kvantum/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, qmake, qtbase, qtsvg, qtx11extras, kwindowsystem
+{ lib, stdenv, fetchFromGitHub, qmake, qtbase, qtsvg, qtx11extras, kwindowsystem
 , libX11, libXext, qttools, wrapQtAppsHook
 }:
 
@@ -28,7 +28,7 @@ stdenv.mkDerivation rec {
       --replace "\$\$[QT_INSTALL_PLUGINS]" "$out/$qtPluginPrefix"
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "SVG-based Qt5 theme engine plus a config tool and extra themes";
     homepage = "https://github.com/tsujan/Kvantum";
     license = licenses.gpl3;
diff --git a/pkgs/development/libraries/qtstyleplugins/default.nix b/pkgs/development/libraries/qtstyleplugins/default.nix
index 7f340ce1eefac..84d7f46a2b29b 100644
--- a/pkgs/development/libraries/qtstyleplugins/default.nix
+++ b/pkgs/development/libraries/qtstyleplugins/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, mkDerivation, fetchFromGitHub, qmake, pkg-config, gtk2 }:
+{ lib, stdenv, mkDerivation, fetchFromGitHub, qmake, pkg-config, gtk2 }:
 
 mkDerivation {
   name = "qtstyleplugins-2017-03-11";
@@ -15,7 +15,7 @@ mkDerivation {
   nativeBuildInputs = [ pkg-config qmake ];
   buildInputs = [ gtk2 ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Additional style plugins for Qt5, including BB10, GTK, Cleanlooks, Motif, Plastique";
     homepage = "http://blog.qt.io/blog/2012/10/30/cleaning-up-styles-in-qt5-and-adding-fusion/";
     license = licenses.lgpl21;
diff --git a/pkgs/development/libraries/qtutilities/default.nix b/pkgs/development/libraries/qtutilities/default.nix
index 9c9352d3c29c1..c44e8f4fd8737 100644
--- a/pkgs/development/libraries/qtutilities/default.nix
+++ b/pkgs/development/libraries/qtutilities/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cpp-utilities, qttools, qtbase, cmake, pkg-config }:
+{ lib, stdenv, fetchFromGitHub, cpp-utilities, qttools, qtbase, cmake, pkg-config }:
 
 stdenv.mkDerivation rec {
   pname = "qtutilities";
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
   buildInputs = [ qtbase cpp-utilities ];
   nativeBuildInputs = [ cmake qttools ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/Martchus/qtutilities";
     description = "Common C++ classes and routines used by @Martchus' applications featuring argument parser, IO and conversion utilities";
     license = licenses.gpl2;
diff --git a/pkgs/development/libraries/qtwebkit-plugins/default.nix b/pkgs/development/libraries/qtwebkit-plugins/default.nix
index d1b921deac024..652c49aa6ca25 100644
--- a/pkgs/development/libraries/qtwebkit-plugins/default.nix
+++ b/pkgs/development/libraries/qtwebkit-plugins/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, qmake, qtwebkit, hunspell }:
+{ lib, stdenv, fetchFromGitHub, qmake, qtwebkit, hunspell }:
 
 stdenv.mkDerivation {
   name = "qtwebkit-plugins-2017-01-25";
@@ -15,11 +15,11 @@ stdenv.mkDerivation {
   buildInputs = [ qtwebkit hunspell ];
 
   postPatch = ''
-    sed -i "s,-lhunspell,-lhunspell-${stdenv.lib.versions.majorMinor hunspell.version}," src/spellcheck/spellcheck.pri
+    sed -i "s,-lhunspell,-lhunspell-${lib.versions.majorMinor hunspell.version}," src/spellcheck/spellcheck.pri
     sed -i "s,\$\$\[QT_INSTALL_PLUGINS\],$out/$qtPluginPrefix," src/src.pro
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Spell checking plugin using Hunspell and HTML5 Notifications plugin for QtWebKit";
     homepage = "https://github.com/QupZilla/qtwebkit-plugins";
     license = licenses.gpl3;
diff --git a/pkgs/development/libraries/quazip/default.nix b/pkgs/development/libraries/quazip/default.nix
index c399298b8f86f..3f186314d0139 100644
--- a/pkgs/development/libraries/quazip/default.nix
+++ b/pkgs/development/libraries/quazip/default.nix
@@ -1,4 +1,4 @@
-{ fetchFromGitHub, stdenv, zlib, qtbase, cmake, fixDarwinDylibNames }:
+{ fetchFromGitHub, lib, stdenv, zlib, qtbase, cmake, fixDarwinDylibNames }:
 
 stdenv.mkDerivation rec {
   pname = "quazip";
@@ -13,9 +13,9 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ zlib qtbase ];
   nativeBuildInputs = [ cmake ]
-    ++ stdenv.lib.optional stdenv.isDarwin fixDarwinDylibNames;
+    ++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Provides access to ZIP archives from Qt programs";
     license = licenses.lgpl21Plus;
     homepage = "https://stachenov.github.io/quazip/"; # Migrated from http://quazip.sourceforge.net/
diff --git a/pkgs/development/libraries/quesoglc/default.nix b/pkgs/development/libraries/quesoglc/default.nix
index 6aebb7a6511d8..1a4fcca9d9b05 100644
--- a/pkgs/development/libraries/quesoglc/default.nix
+++ b/pkgs/development/libraries/quesoglc/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, libGLU, libGL, glew, freetype, fontconfig, fribidi, libX11 }:
+{ lib, stdenv, fetchurl, libGLU, libGL, glew, freetype, fontconfig, fribidi, libX11 }:
 stdenv.mkDerivation rec {
   pname = "quesoglc";
   version = "0.7.2";
@@ -8,7 +8,7 @@ stdenv.mkDerivation rec {
   };
   buildInputs = [ libGLU libGL glew freetype fontconfig fribidi libX11 ];
   # FIXME: Configure fails to use system glew.
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A free implementation of the OpenGL Character Renderer";
     longDescription = ''
       QuesoGLC is a free (as in free speech) implementation of the OpenGL
diff --git a/pkgs/development/libraries/quickder/default.nix b/pkgs/development/libraries/quickder/default.nix
index e5346b42b9fbd..28933f96fa1c7 100644
--- a/pkgs/development/libraries/quickder/default.nix
+++ b/pkgs/development/libraries/quickder/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, python2Packages, hexio
+{ lib, stdenv, fetchFromGitHub, python2Packages, hexio
 , cmake, bash, arpa2cm, git, asn2quickder }:
 
 stdenv.mkDerivation rec {
@@ -42,7 +42,7 @@ stdenv.mkDerivation rec {
     export PREFIX=$out
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Quick (and Easy) DER, a Library for parsing ASN.1";
     homepage = "https://github.com/vanrein/quick-der";
     license = licenses.bsd2;
diff --git a/pkgs/development/libraries/quickfix/default.nix b/pkgs/development/libraries/quickfix/default.nix
index 5e7300ee19c53..6644b9885c25e 100644
--- a/pkgs/development/libraries/quickfix/default.nix
+++ b/pkgs/development/libraries/quickfix/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, fetchpatch, autoconf, automake, libtool }:
+{ lib, stdenv, fetchFromGitHub, fetchpatch, autoconf, automake, libtool }:
 
 stdenv.mkDerivation rec {
   pname = "quickfix";
@@ -34,7 +34,7 @@ stdenv.mkDerivation rec {
     substituteInPlace Makefile --replace 'UnitTest++' ' '
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "QuickFIX C++ Fix Engine Library";
     homepage = "http://www.quickfixengine.org";
     license = licenses.free; # similar to BSD 4-clause
diff --git a/pkgs/development/libraries/qwt/6.nix b/pkgs/development/libraries/qwt/6.nix
index 1a29bb90fbb4a..edfd3b4e24a3b 100644
--- a/pkgs/development/libraries/qwt/6.nix
+++ b/pkgs/development/libraries/qwt/6.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, qtbase, qtsvg, qttools, qmake }:
+{ lib, stdenv, fetchurl, qtbase, qtsvg, qttools, qmake }:
 
 stdenv.mkDerivation rec {
   name = "qwt-6.1.5";
@@ -17,11 +17,11 @@ stdenv.mkDerivation rec {
 
   qmakeFlags = [ "-after doc.path=$out/share/doc/${name}" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Qt widgets for technical applications";
     homepage = "http://qwt.sourceforge.net/";
     # LGPL 2.1 plus a few exceptions (more liberal)
-    license = stdenv.lib.licenses.qwt;
+    license = lib.licenses.qwt;
     platforms = platforms.unix;
     maintainers = [ maintainers.bjornfor ];
     branch = "6";
diff --git a/pkgs/development/libraries/qwt/6_qt4.nix b/pkgs/development/libraries/qwt/6_qt4.nix
index 4b7aa9cf7f98a..61903af93fac5 100644
--- a/pkgs/development/libraries/qwt/6_qt4.nix
+++ b/pkgs/development/libraries/qwt/6_qt4.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, qt4, qmake4Hook, AGL }:
+{ lib, stdenv, fetchurl, qt4, qmake4Hook, AGL }:
 
 stdenv.mkDerivation rec {
   name = "qwt-6.1.5";
@@ -10,7 +10,7 @@ stdenv.mkDerivation rec {
 
   buildInputs = [
     qt4
-  ] ++ stdenv.lib.optionals stdenv.isDarwin [ AGL ];
+  ] ++ lib.optionals stdenv.isDarwin [ AGL ];
 
   nativeBuildInputs = [ qmake4Hook ];
 
@@ -22,18 +22,18 @@ stdenv.mkDerivation rec {
 
   # qwt.framework output includes a relative reference to itself, which breaks dependents
   preFixup =
-    stdenv.lib.optionalString stdenv.isDarwin ''
+    lib.optionalString stdenv.isDarwin ''
       echo "Attempting to repair qwt"
       install_name_tool -id "$out/lib/qwt.framework/Versions/6/qwt" "$out/lib/qwt.framework/Versions/6/qwt"
     '';
 
   qmakeFlags = [ "-after doc.path=$out/share/doc/${name}" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Qt widgets for technical applications";
     homepage = "http://qwt.sourceforge.net/";
     # LGPL 2.1 plus a few exceptions (more liberal)
-    license = stdenv.lib.licenses.qwt;
+    license = lib.licenses.qwt;
     platforms = platforms.linux ++ platforms.darwin;
     maintainers = [ maintainers.bjornfor ];
     branch = "6";
diff --git a/pkgs/development/libraries/qwt/default.nix b/pkgs/development/libraries/qwt/default.nix
index c206ffdd5db06..e158fe3488566 100644
--- a/pkgs/development/libraries/qwt/default.nix
+++ b/pkgs/development/libraries/qwt/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, qt4, qmake4Hook }:
+{ lib, stdenv, fetchurl, qt4, qmake4Hook }:
 
 stdenv.mkDerivation rec {
   name = "qwt-5.2.3";
@@ -20,11 +20,11 @@ stdenv.mkDerivation rec {
     qmakeFlags="$qmakeFlags INSTALLBASE=$out -after doc.path=$out/share/doc/${name}"
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Qt widgets for technical applications";
     homepage = "http://qwt.sourceforge.net/";
     # LGPL 2.1 plus a few exceptions (more liberal)
-    license = stdenv.lib.licenses.qwt;
+    license = lib.licenses.qwt;
     platforms = platforms.unix;
     maintainers = [ maintainers.bjornfor ];
   };
diff --git a/pkgs/development/libraries/qxt/default.nix b/pkgs/development/libraries/qxt/default.nix
index 503e1b14c1fba..9d035ce9d89a0 100644
--- a/pkgs/development/libraries/qxt/default.nix
+++ b/pkgs/development/libraries/qxt/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, which, coreutils, fetchzip, qt4 }:
+{ lib, stdenv, which, coreutils, fetchzip, qt4 }:
 
 stdenv.mkDerivation rec {
   pname = "qxt";
@@ -26,9 +26,9 @@ stdenv.mkDerivation rec {
       classes to add functionality not readily available in the Qt toolkit by Qt
       Development Frameworks, Nokia.
     '';
-    license = stdenv.lib.licenses.gpl2;
-    platforms = stdenv.lib.platforms.linux;
-    maintainers = with stdenv.lib.maintainers; [ forkk ];
+    license = lib.licenses.gpl2;
+    platforms = lib.platforms.linux;
+    maintainers = with lib.maintainers; [ forkk ];
     broken = true;
   };
 }
diff --git a/pkgs/development/libraries/rabbitmq-c/default.nix b/pkgs/development/libraries/rabbitmq-c/default.nix
index 7cb29357c49f9..94a9adcae877b 100644
--- a/pkgs/development/libraries/rabbitmq-c/default.nix
+++ b/pkgs/development/libraries/rabbitmq-c/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, openssl, popt, xmlto }:
+{ lib, stdenv, fetchFromGitHub, cmake, openssl, popt, xmlto }:
 
 stdenv.mkDerivation rec {
   pname = "rabbitmq-c";
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ cmake ];
   buildInputs = [ openssl popt xmlto ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "RabbitMQ C AMQP client library";
     homepage = "https://github.com/alanxz/rabbitmq-c";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/rabbitmq-java-client/default.nix b/pkgs/development/libraries/rabbitmq-java-client/default.nix
index e84770ec0f5bd..b649b1d9c1136 100644
--- a/pkgs/development/libraries/rabbitmq-java-client/default.nix
+++ b/pkgs/development/libraries/rabbitmq-java-client/default.nix
@@ -1,4 +1,4 @@
-{ fetchurl, stdenv, ant, jdk, jre, python, makeWrapper }:
+{ fetchurl, lib, stdenv, ant, jdk, jre, python, makeWrapper }:
 
 stdenv.mkDerivation {
   name = "rabbitmq-java-client-3.3.4";
@@ -21,7 +21,7 @@ stdenv.mkDerivation {
       --add-flags "-Djava.awt.headless=true -cp $out/share/java/\* com.rabbitmq.examples.PerfTest"
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "RabbitMQ Java client library which allows Java code to interface to AMQP servers";
     homepage = "https://www.rabbitmq.com/java-client.html";
     license = with licenses; [ mpl11 gpl2 ];
diff --git a/pkgs/development/libraries/raft-canonical/default.nix b/pkgs/development/libraries/raft-canonical/default.nix
index 5d7e94ff0aa9c..69fa7f6eadc53 100644
--- a/pkgs/development/libraries/raft-canonical/default.nix
+++ b/pkgs/development/libraries/raft-canonical/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, autoreconfHook, pkg-config, file, libuv }:
+{ lib, stdenv, fetchFromGitHub, autoreconfHook, pkg-config, file, libuv }:
 
 stdenv.mkDerivation rec {
   pname = "raft-canonical";
@@ -22,7 +22,7 @@ stdenv.mkDerivation rec {
 
   outputs = [ "dev" "out" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = ''
       Fully asynchronous C implementation of the Raft consensus protocol
     '';
diff --git a/pkgs/development/libraries/randomx/default.nix b/pkgs/development/libraries/randomx/default.nix
index 6de7ecdfef36d..8e99ca1be354a 100644
--- a/pkgs/development/libraries/randomx/default.nix
+++ b/pkgs/development/libraries/randomx/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake }:
+{ lib, stdenv, fetchFromGitHub, cmake }:
 
 stdenv.mkDerivation rec {
   pname = "randomX";
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
     sha256 = "13h2cw8drq7xn3v8fbpxrlsl8zq3fs8gd2pc1pv28ahr9qqjz1gc";
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Proof of work algorithm based on random code execution";
     homepage = "https://github.com/tevador/RandomX";
     license = licenses.bsd3;
diff --git a/pkgs/development/libraries/rang/default.nix b/pkgs/development/libraries/rang/default.nix
index b3d300baca2ef..79ab52fc83516 100644
--- a/pkgs/development/libraries/rang/default.nix
+++ b/pkgs/development/libraries/rang/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake }:
+{ lib, stdenv, fetchFromGitHub, cmake }:
 stdenv.mkDerivation rec {
   pname = "rang";
   version = "v3.1.0";
@@ -9,7 +9,7 @@ stdenv.mkDerivation rec {
     "sha256" = "0v2pz0l2smagr3j4abjccshg4agaccfz79m5ayvrvqq5d4rlds0s";
   };
   nativeBuildInputs = [ cmake ];
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description =
       "A Minimal, Header only Modern c++ library for terminal goodies";
     homepage = "https://agauniyal.github.io/rang/";
diff --git a/pkgs/development/libraries/range-v3/default.nix b/pkgs/development/libraries/range-v3/default.nix
index 47c56aaa1e8e1..1e9df5be23466 100644
--- a/pkgs/development/libraries/range-v3/default.nix
+++ b/pkgs/development/libraries/range-v3/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake }:
+{ lib, stdenv, fetchFromGitHub, cmake }:
 
 stdenv.mkDerivation rec {
   pname = "range-v3";
@@ -19,12 +19,12 @@ stdenv.mkDerivation rec {
 
   # Building the tests currently fails on AArch64 due to internal compiler
   # errors (with GCC 9.2):
-  cmakeFlags = stdenv.lib.optional stdenv.isAarch64 "-DRANGE_V3_TESTS=OFF";
+  cmakeFlags = lib.optional stdenv.isAarch64 "-DRANGE_V3_TESTS=OFF";
 
   doCheck = !stdenv.isAarch64;
   checkTarget = "test";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Experimental range library for C++11/14/17";
     homepage = "https://github.com/ericniebler/range-v3";
     changelog = "https://github.com/ericniebler/range-v3/releases/tag/${version}";
diff --git a/pkgs/development/libraries/rapidcheck/default.nix b/pkgs/development/libraries/rapidcheck/default.nix
index 571566909c404..4df98c3026e59 100644
--- a/pkgs/development/libraries/rapidcheck/default.nix
+++ b/pkgs/development/libraries/rapidcheck/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, cmake, fetchFromGitHub }:
+{ lib, stdenv, cmake, fetchFromGitHub }:
 
 stdenv.mkDerivation rec {
   pname = "rapidcheck";
@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
     rm $out/extras/**/CMakeLists.txt
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A C++ framework for property based testing inspired by QuickCheck";
     inherit (src.meta) homepage;
     maintainers = with maintainers; [ jb55 ];
diff --git a/pkgs/development/libraries/rapidxml/default.nix b/pkgs/development/libraries/rapidxml/default.nix
index ca072f2ca4b0a..e5ae16087cbd5 100644
--- a/pkgs/development/libraries/rapidxml/default.nix
+++ b/pkgs/development/libraries/rapidxml/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, unzip }:
+{ lib, stdenv, fetchurl, unzip }:
 
 stdenv.mkDerivation rec {
   pname = "rapidxml";
@@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
     cp * $out/include/${pname}
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Fast XML DOM-style parser in C++";
     homepage = "http://rapidxml.sourceforge.net/";
     license = licenses.boost;
diff --git a/pkgs/development/libraries/rarian/default.nix b/pkgs/development/libraries/rarian/default.nix
index 291454f141020..522456cfa40d3 100644
--- a/pkgs/development/libraries/rarian/default.nix
+++ b/pkgs/development/libraries/rarian/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, pkg-config, perlPackages, libxml2, libxslt, docbook_xml_dtd_42, gnome3}:
+{lib, stdenv, fetchurl, pkg-config, perlPackages, libxml2, libxslt, docbook_xml_dtd_42, gnome3}:
 let
   pname = "rarian";
   version = "0.8.1";
@@ -6,7 +6,7 @@ in stdenv.mkDerivation rec {
   name = "${pname}-${version}";
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${name}.tar.gz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${name}.tar.gz";
     sha256 = "aafe886d46e467eb3414e91fa9e42955bd4b618c3e19c42c773026b205a84577";
   };
 
@@ -21,7 +21,7 @@ in stdenv.mkDerivation rec {
     };
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Documentation metadata library based on the proposed Freedesktop.org spec";
     homepage = "https://rarian.freedesktop.org/";
     license = licenses.lgpl21Plus;
diff --git a/pkgs/development/libraries/rdkafka/default.nix b/pkgs/development/libraries/rdkafka/default.nix
index 0da318808f37a..2a4f9973bde6a 100644
--- a/pkgs/development/libraries/rdkafka/default.nix
+++ b/pkgs/development/libraries/rdkafka/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, zlib, perl, pkg-config, python, openssl }:
+{ lib, stdenv, fetchFromGitHub, zlib, perl, pkg-config, python, openssl }:
 
 stdenv.mkDerivation rec {
   pname = "rdkafka";
@@ -23,7 +23,7 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "librdkafka - Apache Kafka C/C++ client library";
     homepage = "https://github.com/edenhill/librdkafka";
     license = licenses.bsd2;
diff --git a/pkgs/development/libraries/re2/default.nix b/pkgs/development/libraries/re2/default.nix
index d36b24d61084e..faa576faa0d09 100644
--- a/pkgs/development/libraries/re2/default.nix
+++ b/pkgs/development/libraries/re2/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub }:
+{ lib, stdenv, fetchFromGitHub }:
 
 stdenv.mkDerivation {
   pname = "re2";
@@ -27,7 +27,7 @@ stdenv.mkDerivation {
   meta = {
     homepage = "https://github.com/google/re2";
     description = "An efficient, principled regular expression library";
-    license = stdenv.lib.licenses.bsd3;
-    platforms = with stdenv.lib.platforms; all;
+    license = lib.licenses.bsd3;
+    platforms = with lib.platforms; all;
   };
 }
diff --git a/pkgs/development/libraries/readline/5.x.nix b/pkgs/development/libraries/readline/5.x.nix
index 5833ca714e41f..b2eab66387f55 100644
--- a/pkgs/development/libraries/readline/5.x.nix
+++ b/pkgs/development/libraries/readline/5.x.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, ncurses }:
+{ lib, stdenv, fetchurl, ncurses }:
 
 stdenv.mkDerivation {
   name = "readline-5.2";
@@ -10,9 +10,9 @@ stdenv.mkDerivation {
 
   propagatedBuildInputs = [ncurses];
 
-  patches = stdenv.lib.optional stdenv.isDarwin ./shobj-darwin.patch;
+  patches = lib.optional stdenv.isDarwin ./shobj-darwin.patch;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     branch = "5";
     platforms = platforms.unix;
     license = licenses.gpl2;
diff --git a/pkgs/development/libraries/readline/6.2.nix b/pkgs/development/libraries/readline/6.2.nix
index 3f3ca01961df1..98db664dd8fc6 100644
--- a/pkgs/development/libraries/readline/6.2.nix
+++ b/pkgs/development/libraries/readline/6.2.nix
@@ -1,4 +1,4 @@
-{ fetchurl, stdenv, ncurses
+{ fetchurl, lib, stdenv, ncurses
 }:
 
 stdenv.mkDerivation (rec {
@@ -47,11 +47,11 @@ stdenv.mkDerivation (rec {
 
     homepage = "https://savannah.gnu.org/projects/readline/";
 
-    license = stdenv.lib.licenses.gpl3Plus;
+    license = lib.licenses.gpl3Plus;
 
     maintainers = [ ];
     branch = "6.2";
-    platforms = stdenv.lib.platforms.unix;
+    platforms = lib.platforms.unix;
   };
 }
 
diff --git a/pkgs/development/libraries/readline/6.3.nix b/pkgs/development/libraries/readline/6.3.nix
index 2b0cf978d43ef..2f63c4a3043cd 100644
--- a/pkgs/development/libraries/readline/6.3.nix
+++ b/pkgs/development/libraries/readline/6.3.nix
@@ -1,4 +1,4 @@
-{ fetchurl, stdenv, ncurses }:
+{ fetchurl, lib, stdenv, ncurses }:
 
 stdenv.mkDerivation {
   name = "readline-6.3p08";
@@ -14,14 +14,14 @@ stdenv.mkDerivation {
 
   patchFlags = [ "-p0" ];
 
-  configureFlags = stdenv.lib.optional (stdenv.hostPlatform != stdenv.buildPlatform)
+  configureFlags = lib.optional (stdenv.hostPlatform != stdenv.buildPlatform)
     # This test requires running host code
     "bash_cv_wcwidth_broken=no";
 
   patches =
     [ ./link-against-ncurses.patch
       ./no-arch_only-6.3.patch
-    ] ++ stdenv.lib.optional stdenv.hostPlatform.useAndroidPrebuilt ./android.patch
+    ] ++ lib.optional stdenv.hostPlatform.useAndroidPrebuilt ./android.patch
     ++
     (let
        patch = nr: sha256:
@@ -32,7 +32,7 @@ stdenv.mkDerivation {
      in
        import ./readline-6.3-patches.nix patch);
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Library for interactive line editing";
 
     longDescription = ''
diff --git a/pkgs/development/libraries/readline/7.0.nix b/pkgs/development/libraries/readline/7.0.nix
index 248ef55cce88c..25ef4b97a8636 100644
--- a/pkgs/development/libraries/readline/7.0.nix
+++ b/pkgs/development/libraries/readline/7.0.nix
@@ -1,4 +1,4 @@
-{ fetchurl, stdenv, ncurses
+{ fetchurl, lib, stdenv, ncurses
 }:
 
 stdenv.mkDerivation rec {
@@ -32,7 +32,7 @@ stdenv.mkDerivation rec {
     ]
     ++ upstreamPatches;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Library for interactive line editing";
 
     longDescription = ''
diff --git a/pkgs/development/libraries/readline/8.0.nix b/pkgs/development/libraries/readline/8.0.nix
index 6e1182647c29e..9ea0277467e59 100644
--- a/pkgs/development/libraries/readline/8.0.nix
+++ b/pkgs/development/libraries/readline/8.0.nix
@@ -1,4 +1,4 @@
-{ fetchurl, stdenv, ncurses
+{ fetchurl, lib, stdenv, ncurses
 }:
 
 stdenv.mkDerivation rec {
@@ -32,7 +32,7 @@ stdenv.mkDerivation rec {
     ]
     ++ upstreamPatches;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Library for interactive line editing";
 
     longDescription = ''
diff --git a/pkgs/development/libraries/readosm/default.nix b/pkgs/development/libraries/readosm/default.nix
index 6aed49d65e35a..760546fc471ca 100644
--- a/pkgs/development/libraries/readosm/default.nix
+++ b/pkgs/development/libraries/readosm/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, expat, zlib, geos, libspatialite }:
+{ lib, stdenv, fetchurl, expat, zlib, geos, libspatialite }:
 
 stdenv.mkDerivation rec {
   name = "readosm-1.1.0a";
@@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
   meta = {
     description = "An open source library to extract valid data from within an Open Street Map input file";
     homepage = "https://www.gaia-gis.it/fossil/readosm";
-    license = with stdenv.lib.licenses; [ mpl11 gpl2Plus lgpl21Plus ];
-    platforms = stdenv.lib.platforms.linux;
+    license = with lib.licenses; [ mpl11 gpl2Plus lgpl21Plus ];
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/development/libraries/redkite/default.nix b/pkgs/development/libraries/redkite/default.nix
index ce3ac37895e03..bc82e95be7138 100644
--- a/pkgs/development/libraries/redkite/default.nix
+++ b/pkgs/development/libraries/redkite/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, cairo }:
+{ lib, stdenv, fetchFromGitHub, cmake, cairo }:
 
 stdenv.mkDerivation rec {
   pname = "redkite";
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ cairo ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://gitlab.com/iurie-sw/redkite";
     description = "A small GUI toolkit";
     license = licenses.gpl3Plus;
diff --git a/pkgs/development/libraries/rep-gtk/default.nix b/pkgs/development/libraries/rep-gtk/default.nix
index ab35139ce712c..618c91421b6ad 100644
--- a/pkgs/development/libraries/rep-gtk/default.nix
+++ b/pkgs/development/libraries/rep-gtk/default.nix
@@ -1,6 +1,6 @@
-{ stdenv, fetchurl, pkg-config, autoreconfHook, librep, gtk2 }:
+{ lib, stdenv, fetchurl, pkg-config, autoreconfHook, librep, gtk2 }:
 
-with stdenv.lib;
+with lib;
 stdenv.mkDerivation rec {
 
   pname = "rep-gtk";
diff --git a/pkgs/development/libraries/resolv_wrapper/default.nix b/pkgs/development/libraries/resolv_wrapper/default.nix
index 74f4d69356927..5b73bc41475de 100644
--- a/pkgs/development/libraries/resolv_wrapper/default.nix
+++ b/pkgs/development/libraries/resolv_wrapper/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, cmake, pkg-config }:
+{ lib, stdenv, fetchurl, cmake, pkg-config }:
 
 stdenv.mkDerivation rec {
   name = "resolv_wrapper-1.1.6";
@@ -10,7 +10,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ cmake pkg-config ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A wrapper for the user, group and hosts NSS API";
     homepage = "https://git.samba.org/?p=uid_wrapper.git;a=summary;";
     license = licenses.bsd3;
diff --git a/pkgs/development/libraries/rlog/default.nix b/pkgs/development/libraries/rlog/default.nix
index cbc564fe23001..88a96209993bb 100644
--- a/pkgs/development/libraries/rlog/default.nix
+++ b/pkgs/development/libraries/rlog/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation {
   name = "rlog-1.4";
@@ -11,7 +11,7 @@ stdenv.mkDerivation {
   meta = {
     homepage = "https://www.arg0.net/rlog";
     description = "A C++ logging library used in encfs";
-    platforms = stdenv.lib.platforms.linux;
-    license = stdenv.lib.licenses.lgpl3;
+    platforms = lib.platforms.linux;
+    license = lib.licenses.lgpl3;
   };
 }
diff --git a/pkgs/development/libraries/rlottie/default.nix b/pkgs/development/libraries/rlottie/default.nix
index 3713bcf1df793..a8cd88cae5072 100644
--- a/pkgs/development/libraries/rlottie/default.nix
+++ b/pkgs/development/libraries/rlottie/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, meson, ninja, pkg-config }:
+{ lib, stdenv, fetchFromGitHub, meson, ninja, pkg-config }:
 
 stdenv.mkDerivation rec {
   pname = "rlottie";
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ meson ninja pkg-config ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/Samsung/rlottie";
     description = "A platform independent standalone c++ library for rendering vector based animations and art in realtime";
     license = licenses.unfree; # Mixed, see https://github.com/Samsung/rlottie/blob/master/COPYING
diff --git a/pkgs/development/libraries/rnnoise-plugin/default.nix b/pkgs/development/libraries/rnnoise-plugin/default.nix
index c359c753388ae..e68f74e289603 100644
--- a/pkgs/development/libraries/rnnoise-plugin/default.nix
+++ b/pkgs/development/libraries/rnnoise-plugin/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, SDL2, fetchFromGitHub, cmake }:
+{ lib, stdenv, SDL2, fetchFromGitHub, cmake }:
 
 stdenv.mkDerivation rec {
   pname = "rnnoise-plugin";
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
 
   cmakeFlags = [ "-DCMAKE_BUILD_TYPE=Release" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A real-time noise suppression plugin for voice based on Xiph's RNNoise";
     homepage = "https://github.com/werman/noise-suppression-for-voice";
     license = licenses.gpl3;
diff --git a/pkgs/development/libraries/robin-map/default.nix b/pkgs/development/libraries/robin-map/default.nix
index 9c0774f925bc7..a0a068dc14223 100644
--- a/pkgs/development/libraries/robin-map/default.nix
+++ b/pkgs/development/libraries/robin-map/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , cmake
 }:
@@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ cmake ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/Tessil/robin-map";
     description = "C++ implementation of a fast hash map and hash set using robin hood hashing";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/rocclr/default.nix b/pkgs/development/libraries/rocclr/default.nix
index 5e6ce5d679785..9337680f55c76 100644
--- a/pkgs/development/libraries/rocclr/default.nix
+++ b/pkgs/development/libraries/rocclr/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , cmake
 , rocm-cmake
@@ -54,7 +54,7 @@ stdenv.mkDerivation rec {
       --replace "/build/source/build" "$out"
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Radeon Open Compute common language runtime";
     homepage = "https://github.com/ROCm-Developer-Tools/ROCclr";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/rocksdb/default.nix b/pkgs/development/libraries/rocksdb/default.nix
index 12a731385ffe7..d6f685ff4deec 100644
--- a/pkgs/development/libraries/rocksdb/default.nix
+++ b/pkgs/development/libraries/rocksdb/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , fetchpatch
 , cmake
@@ -28,9 +28,9 @@ stdenv.mkDerivation rec {
 
   propagatedBuildInputs = [ bzip2 lz4 snappy zlib zstd ];
 
-  buildInputs = stdenv.lib.optional enableJemalloc jemalloc;
+  buildInputs = lib.optional enableJemalloc jemalloc;
 
-  NIX_CFLAGS_COMPILE = stdenv.lib.optionalString stdenv.cc.isGNU "-Wno-error=deprecated-copy -Wno-error=pessimizing-move";
+  NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isGNU "-Wno-error=deprecated-copy -Wno-error=pessimizing-move";
 
   cmakeFlags = [
     "-DPORTABLE=1"
@@ -47,17 +47,17 @@ stdenv.mkDerivation rec {
     "-DWITH_GFLAGS=0"
     "-DUSE_RTTI=1"
     "-DROCKSDB_INSTALL_ON_WINDOWS=YES" # harmless elsewhere
-    (stdenv.lib.optional
+    (lib.optional
         (stdenv.hostPlatform.isx86 && stdenv.hostPlatform.isLinux)
         "-DFORCE_SSE42=1")
-    (stdenv.lib.optional enableLite "-DROCKSDB_LITE=1")
+    (lib.optional enableLite "-DROCKSDB_LITE=1")
     "-DFAIL_ON_WARNINGS=${if stdenv.hostPlatform.isMinGW then "NO" else "YES"}"
-  ] ++ stdenv.lib.optional (!enableShared) "-DROCKSDB_BUILD_SHARED=0";
+  ] ++ lib.optional (!enableShared) "-DROCKSDB_BUILD_SHARED=0";
 
   # otherwise "cc1: error: -Wformat-security ignored without -Wformat [-Werror=format-security]"
-  hardeningDisable = stdenv.lib.optional stdenv.hostPlatform.isWindows "format";
+  hardeningDisable = lib.optional stdenv.hostPlatform.isWindows "format";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://rocksdb.org";
     description = "A library that provides an embeddable, persistent key-value store for fast storage";
     license = licenses.asl20;
diff --git a/pkgs/development/libraries/rocm-comgr/default.nix b/pkgs/development/libraries/rocm-comgr/default.nix
index f8254991013c4..96f7108e3fe01 100644
--- a/pkgs/development/libraries/rocm-comgr/default.nix
+++ b/pkgs/development/libraries/rocm-comgr/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, clang, device-libs, lld, llvm }:
+{ lib, stdenv, fetchFromGitHub, cmake, clang, device-libs, lld, llvm }:
 
 stdenv.mkDerivation rec {
   pname = "rocm-comgr";
@@ -36,7 +36,7 @@ stdenv.mkDerivation rec {
         -i CMakeLists.txt
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "APIs for compiling and inspecting AMDGPU code objects";
     homepage = "https://github.com/RadeonOpenCompute/ROCm-CompilerSupport/tree/amd-stg-open/lib/comgr";
     license = licenses.ncsa;
diff --git a/pkgs/development/libraries/rocm-device-libs/default.nix b/pkgs/development/libraries/rocm-device-libs/default.nix
index 7c50e37522808..965d92179b67c 100644
--- a/pkgs/development/libraries/rocm-device-libs/default.nix
+++ b/pkgs/development/libraries/rocm-device-libs/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , cmake
 , clang
@@ -30,7 +30,7 @@ stdenv.mkDerivation rec {
     "-DCLANG=${clang}/bin/clang"
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Set of AMD-specific device-side language runtime libraries";
     homepage = "https://github.com/RadeonOpenCompute/ROCm-Device-Libs";
     license = licenses.ncsa;
diff --git a/pkgs/development/libraries/rocm-opencl-icd/default.nix b/pkgs/development/libraries/rocm-opencl-icd/default.nix
index 5f2188f6e7e61..903c238f45530 100644
--- a/pkgs/development/libraries/rocm-opencl-icd/default.nix
+++ b/pkgs/development/libraries/rocm-opencl-icd/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, rocm-opencl-runtime }:
+{ lib, stdenv, rocm-opencl-runtime }:
 
 stdenv.mkDerivation rec {
   pname = "rocm-opencl-icd";
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
     echo "${rocm-opencl-runtime}/lib/libamdocl64.so" > $out/etc/OpenCL/vendors/amdocl64.icd
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "OpenCL ICD definition for AMD GPUs using the ROCm stack";
     license = licenses.mit;
     maintainers = with maintainers; [ danieldk ];
diff --git a/pkgs/development/libraries/rocm-opencl-runtime/default.nix b/pkgs/development/libraries/rocm-opencl-runtime/default.nix
index ecd9e0f7e8257..ab0957474adc4 100644
--- a/pkgs/development/libraries/rocm-opencl-runtime/default.nix
+++ b/pkgs/development/libraries/rocm-opencl-runtime/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , addOpenGLRunpath
 , cmake
@@ -73,7 +73,7 @@ stdenv.mkDerivation rec {
     echo 'add_dependencies(amdocl64 OpenCL)' >> amdocl/CMakeLists.txt
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "OpenCL runtime for AMD GPUs, part of the ROCm stack";
     homepage = "https://github.com/RadeonOpenCompute/ROCm-OpenCL-Runtime";
     license = with licenses; [ asl20 mit ];
diff --git a/pkgs/development/libraries/rocm-runtime/default.nix b/pkgs/development/libraries/rocm-runtime/default.nix
index 15435e7914d36..beb0c61e683c6 100644
--- a/pkgs/development/libraries/rocm-runtime/default.nix
+++ b/pkgs/development/libraries/rocm-runtime/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , addOpenGLRunpath
 , clang-unwrapped
@@ -39,7 +39,7 @@ stdenv.mkDerivation rec {
     rm -rf $out/hsa
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Platform runtime for ROCm";
     homepage = "https://github.com/RadeonOpenCompute/ROCR-Runtime";
     license = with licenses; [ ncsa ];
diff --git a/pkgs/development/libraries/rocm-thunk/default.nix b/pkgs/development/libraries/rocm-thunk/default.nix
index 535f686f23d0b..5863e1f0a57cd 100644
--- a/pkgs/development/libraries/rocm-thunk/default.nix
+++ b/pkgs/development/libraries/rocm-thunk/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , cmake
 , pkg-config
@@ -28,7 +28,7 @@ stdenv.mkDerivation rec {
     cp -r $src/include $out
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Radeon open compute thunk interface";
     homepage = "https://github.com/RadeonOpenCompute/ROCT-Thunk-Interface";
     license = with licenses; [ bsd2 mit ];
diff --git a/pkgs/development/libraries/rote/default.nix b/pkgs/development/libraries/rote/default.nix
index 5ae66f676d644..e5fb04626836a 100644
--- a/pkgs/development/libraries/rote/default.nix
+++ b/pkgs/development/libraries/rote/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, ncurses }:
+{ lib, stdenv, fetchurl, ncurses }:
 
 stdenv.mkDerivation rec {
   pname = "rote";
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Our Own Terminal Emulation Library";
     longDescription = ''
       ROTE is a simple C library for VT102 terminal emulation. It allows the
diff --git a/pkgs/development/libraries/rttr/default.nix b/pkgs/development/libraries/rttr/default.nix
index b4d9204c226fe..b0f4f2a567a25 100644
--- a/pkgs/development/libraries/rttr/default.nix
+++ b/pkgs/development/libraries/rttr/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, ninja }:
+{ lib, stdenv, fetchFromGitHub, cmake, ninja }:
 
 stdenv.mkDerivation rec {
   pname = "rttr";
@@ -22,7 +22,7 @@ stdenv.mkDerivation rec {
     "-DBUILD_PACKAGE=OFF"
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "C++ Reflection Library";
     homepage = "https://www.rttr.org";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/rubberband/default.nix b/pkgs/development/libraries/rubberband/default.nix
index ca608c5254362..7fc8fe98db29a 100644
--- a/pkgs/development/libraries/rubberband/default.nix
+++ b/pkgs/development/libraries/rubberband/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, libsamplerate, libsndfile, fftw
+{ lib, stdenv, fetchurl, pkg-config, libsamplerate, libsndfile, fftw
 , vamp-plugin-sdk, ladspaH }:
 
 stdenv.mkDerivation rec {
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ pkg-config ];
   buildInputs = [ libsamplerate libsndfile fftw vamp-plugin-sdk ladspaH ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "High quality software library for audio time-stretching and pitch-shifting";
     homepage = "https://breakfastquay.com/rubberband/";
     # commercial license available as well, see homepage. You'll get some more optimized routines
diff --git a/pkgs/development/libraries/safefile/default.nix b/pkgs/development/libraries/safefile/default.nix
index e4a3e586614d7..db18621d8e437 100644
--- a/pkgs/development/libraries/safefile/default.nix
+++ b/pkgs/development/libraries/safefile/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, path, runtimeShell }:
+{ lib, stdenv, fetchurl, path, runtimeShell }:
 stdenv.mkDerivation rec {
   pname = "safefile";
   version = "1.0.5";
@@ -19,9 +19,9 @@ stdenv.mkDerivation rec {
   meta = {
     inherit version;
     description = "File open routines to safely open a file when in the presence of an attack";
-    license = stdenv.lib.licenses.asl20 ;
-    maintainers = [stdenv.lib.maintainers.raskin];
-    platforms = stdenv.lib.platforms.linux;
+    license = lib.licenses.asl20 ;
+    maintainers = [lib.maintainers.raskin];
+    platforms = lib.platforms.linux;
     homepage = "https://research.cs.wisc.edu/mist/safefile/";
     updateWalker = true;
   };
diff --git a/pkgs/development/libraries/sbc/default.nix b/pkgs/development/libraries/sbc/default.nix
index 381c58e3f7d5a..0ff6db175611e 100644
--- a/pkgs/development/libraries/sbc/default.nix
+++ b/pkgs/development/libraries/sbc/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, libsndfile }:
+{ lib, stdenv, fetchurl, pkg-config, libsndfile }:
 
 stdenv.mkDerivation rec {
   name = "sbc-1.4";
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ pkg-config ];
   buildInputs = [ libsndfile ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "SubBand Codec Library";
     homepage = "http://www.bluez.org/";
     license = licenses.gpl2;
diff --git a/pkgs/development/libraries/sblim-sfcc/default.nix b/pkgs/development/libraries/sblim-sfcc/default.nix
index 91baa8d03b881..c871f18e69b38 100644
--- a/pkgs/development/libraries/sblim-sfcc/default.nix
+++ b/pkgs/development/libraries/sblim-sfcc/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, autoreconfHook, curl }:
+{ lib, stdenv, fetchFromGitHub, autoreconfHook, curl }:
 
 stdenv.mkDerivation rec {
   pname = "sblim-sfcc";
@@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Small Footprint CIM Client Library";
     homepage    = "https://sourceforge.net/projects/sblim/";
     license     = licenses.cpl10;
diff --git a/pkgs/development/libraries/schroedinger/default.nix b/pkgs/development/libraries/schroedinger/default.nix
index 8d16ae10889af..7706366dd6dad 100644
--- a/pkgs/development/libraries/schroedinger/default.nix
+++ b/pkgs/development/libraries/schroedinger/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, orc, pkg-config, fetchpatch, autoreconfHook }:
+{ lib, stdenv, fetchurl, orc, pkg-config, fetchpatch, autoreconfHook }:
 
 stdenv.mkDerivation {
   name = "schroedinger-1.0.11";
@@ -23,7 +23,7 @@ stdenv.mkDerivation {
     })
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "An implementation of the Dirac video codec in ANSI C";
     homepage = "https://sourceforge.net/projects/schrodinger/";
     maintainers = [ maintainers.spwhitt ];
diff --git a/pkgs/development/libraries/science/benchmark/papi/default.nix b/pkgs/development/libraries/science/benchmark/papi/default.nix
index 00a6e50aa7f75..c265f24c182be 100644
--- a/pkgs/development/libraries/science/benchmark/papi/default.nix
+++ b/pkgs/development/libraries/science/benchmark/papi/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 }:
 
@@ -20,7 +20,7 @@ stdenv.mkDerivation {
   doCheck = true;
   checkTarget = "test";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://icl.utk.edu/papi/";
     description = "PAPI provides the tool designer and application engineer with a consistent interface and methodology for use of the performance counter hardware found in most major microprocessors";
     license = licenses.bsdOriginal;
diff --git a/pkgs/development/libraries/science/biology/EBTKS/default.nix b/pkgs/development/libraries/science/biology/EBTKS/default.nix
index c60fe31aaaff4..b75ac06627fb8 100644
--- a/pkgs/development/libraries/science/biology/EBTKS/default.nix
+++ b/pkgs/development/libraries/science/biology/EBTKS/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, libminc }:
+{ lib, stdenv, fetchFromGitHub, cmake, libminc }:
 
 stdenv.mkDerivation rec {
   pname = "EBTKS";
@@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
 
   cmakeFlags = [ "-DLIBMINC_DIR=${libminc}/lib/cmake" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/BIC-MNI/${pname}";
     description = "Library for working with MINC files";
     maintainers = with maintainers; [ bcdarwin ];
diff --git a/pkgs/development/libraries/science/biology/bicgl/default.nix b/pkgs/development/libraries/science/biology/bicgl/default.nix
index 4cc7dcada5220..bc2de6e882f9e 100644
--- a/pkgs/development/libraries/science/biology/bicgl/default.nix
+++ b/pkgs/development/libraries/science/biology/bicgl/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, libminc, bicpl, freeglut, mesa_glu }:
+{ lib, stdenv, fetchFromGitHub, cmake, libminc, bicpl, freeglut, mesa_glu }:
 
 stdenv.mkDerivation rec {
   pname = "bicgl";
@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
     "-DBICPL_DIR=${bicpl}/lib"
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/${owner}/${pname}";
     description = "Brain Imaging Centre graphics library";
     maintainers = with maintainers; [ bcdarwin ];
diff --git a/pkgs/development/libraries/science/biology/bicpl/default.nix b/pkgs/development/libraries/science/biology/bicpl/default.nix
index 96199f0478ea9..0bdcbf5a828a9 100644
--- a/pkgs/development/libraries/science/biology/bicpl/default.nix
+++ b/pkgs/development/libraries/science/biology/bicpl/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, libminc, netpbm }:
+{ lib, stdenv, fetchFromGitHub, cmake, libminc, netpbm }:
 
 stdenv.mkDerivation rec {
   pname = "bicpl";
@@ -22,7 +22,7 @@ stdenv.mkDerivation rec {
   doCheck = false;
   # internal_volume_io.h: No such file or directory
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/${owner}/${pname}";
     description = "Brain Imaging Centre programming library";
     maintainers = with maintainers; [ bcdarwin ];
diff --git a/pkgs/development/libraries/science/biology/bpp-core/default.nix b/pkgs/development/libraries/science/biology/bpp-core/default.nix
index cfbe19d724be5..d1eb096e08e61 100644
--- a/pkgs/development/libraries/science/biology/bpp-core/default.nix
+++ b/pkgs/development/libraries/science/biology/bpp-core/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake }:
+{ lib, stdenv, fetchFromGitHub, cmake }:
 
 stdenv.mkDerivation rec {
   pname = "bpp-core";
@@ -26,7 +26,7 @@ stdenv.mkDerivation rec {
 
   doCheck = !stdenv.isDarwin;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://biopp.univ-montp2.fr/wiki/index.php/Main_Page";
     changelog = "https://github.com/BioPP/bpp-core/blob/master/ChangeLog";
     description = "C++ bioinformatics libraries and tools";
diff --git a/pkgs/development/libraries/science/biology/elastix/default.nix b/pkgs/development/libraries/science/biology/elastix/default.nix
index e55a72fb9f840..55ee5ab4fb667 100644
--- a/pkgs/development/libraries/science/biology/elastix/default.nix
+++ b/pkgs/development/libraries/science/biology/elastix/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, fetchpatch, cmake, itk, python3, Cocoa }:
+{ lib, stdenv, fetchFromGitHub, fetchpatch, cmake, itk, python3, Cocoa }:
 
 stdenv.mkDerivation rec {
   pname    = "elastix";
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
   ];
 
   nativeBuildInputs = [ cmake python3 ];
-  buildInputs = [ itk ] ++ stdenv.lib.optionals stdenv.isDarwin [ Cocoa ];
+  buildInputs = [ itk ] ++ lib.optionals stdenv.isDarwin [ Cocoa ];
 
   doCheck = !stdenv.isDarwin;  # usual dynamic linker issues
 
@@ -28,7 +28,7 @@ stdenv.mkDerivation rec {
     export LD_LIBRARY_PATH=$(pwd)/bin
   ";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://elastix.isi.uu.nl/";
     description = "Image registration toolkit based on ITK";
     maintainers = with maintainers; [ bcdarwin ];
diff --git a/pkgs/development/libraries/science/biology/gifticlib/default.nix b/pkgs/development/libraries/science/biology/gifticlib/default.nix
index dddf29fb0193e..306324129cbdf 100644
--- a/pkgs/development/libraries/science/biology/gifticlib/default.nix
+++ b/pkgs/development/libraries/science/biology/gifticlib/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, expat, nifticlib, zlib }:
+{ lib, stdenv, fetchFromGitHub, cmake, expat, nifticlib, zlib }:
 
 stdenv.mkDerivation rec {
   pname = "gifticlib";
@@ -24,7 +24,7 @@ stdenv.mkDerivation rec {
     runHook postCheck
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://www.nitrc.org/projects/gifti";
     description = "Medical imaging geometry format C API";
     maintainers = with maintainers; [ bcdarwin ];
diff --git a/pkgs/development/libraries/science/biology/htslib/default.nix b/pkgs/development/libraries/science/biology/htslib/default.nix
index 9da6595e7a43a..cb3a543ad2aff 100644
--- a/pkgs/development/libraries/science/biology/htslib/default.nix
+++ b/pkgs/development/libraries/science/biology/htslib/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, zlib, bzip2, lzma, curl, perl }:
+{ lib, stdenv, fetchurl, zlib, bzip2, lzma, curl, perl }:
 
 stdenv.mkDerivation rec {
   pname = "htslib";
@@ -26,7 +26,7 @@ stdenv.mkDerivation rec {
 
   doCheck = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A C library for reading/writing high-throughput sequencing data";
     license = licenses.mit;
     homepage = "http://www.htslib.org/";
diff --git a/pkgs/development/libraries/science/biology/mirtk/default.nix b/pkgs/development/libraries/science/biology/mirtk/default.nix
index d010e84f712b5..0d23489696f1e 100644
--- a/pkgs/development/libraries/science/biology/mirtk/default.nix
+++ b/pkgs/development/libraries/science/biology/mirtk/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, gtest, fetchFromGitHub, cmake, boost, eigen, python, vtk, zlib, tbb }:
+{ lib, stdenv, gtest, fetchFromGitHub, cmake, boost, eigen, python, vtk, zlib, tbb }:
 
 stdenv.mkDerivation rec {
   version = "2.0.0";
@@ -34,7 +34,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ cmake gtest ];
   buildInputs = [ boost eigen python vtk zlib tbb ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/BioMedIA/MIRTK";
     description = "Medical image registration library and tools";
     maintainers = with maintainers; [ bcdarwin ];
diff --git a/pkgs/development/libraries/science/biology/nifticlib/default.nix b/pkgs/development/libraries/science/biology/nifticlib/default.nix
index 572c31dd1e52d..fee2ea8772b41 100644
--- a/pkgs/development/libraries/science/biology/nifticlib/default.nix
+++ b/pkgs/development/libraries/science/biology/nifticlib/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, zlib }:
+{ lib, stdenv, fetchFromGitHub, cmake, zlib }:
 
 stdenv.mkDerivation rec {
   pname = "nifticlib";
@@ -23,7 +23,7 @@ stdenv.mkDerivation rec {
   '';
   doCheck = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://nifti-imaging.github.io";
     description = "Medical imaging format C API";
     maintainers = with maintainers; [ bcdarwin ];
diff --git a/pkgs/development/libraries/science/biology/oobicpl/default.nix b/pkgs/development/libraries/science/biology/oobicpl/default.nix
index e5ecda0390bdd..626e6475ba189 100644
--- a/pkgs/development/libraries/science/biology/oobicpl/default.nix
+++ b/pkgs/development/libraries/science/biology/oobicpl/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, libminc, bicpl, arguments, pcre-cpp }:
+{ lib, stdenv, fetchFromGitHub, cmake, libminc, bicpl, arguments, pcre-cpp }:
 
 stdenv.mkDerivation rec {
   pname = "oobicpl";
@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
                  "-DARGUMENTS_DIR=${arguments}/lib"
                  "-DOOBICPL_BUILD_SHARED_LIBS=TRUE" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/${owner}/${pname}";
     description = "Brain Imaging Centre object-oriented programming library (and tools)";
     maintainers = with maintainers; [ bcdarwin ];
diff --git a/pkgs/development/libraries/science/math/QuadProgpp/default.nix b/pkgs/development/libraries/science/math/QuadProgpp/default.nix
index b5fa5c8825e07..254ce08dc60f6 100644
--- a/pkgs/development/libraries/science/math/QuadProgpp/default.nix
+++ b/pkgs/development/libraries/science/math/QuadProgpp/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake }:
+{ lib, stdenv, fetchFromGitHub, cmake }:
 
 stdenv.mkDerivation rec {
   pname = "QuadProgpp";
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ cmake ];
   buildInputs = [ ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/liuq/QuadProgpp";
     license = licenses.mit;
     description = ''
diff --git a/pkgs/development/libraries/science/math/amd-blis/default.nix b/pkgs/development/libraries/science/math/amd-blis/default.nix
index 9bddba0261fee..42c84b3ed610d 100644
--- a/pkgs/development/libraries/science/math/amd-blis/default.nix
+++ b/pkgs/development/libraries/science/math/amd-blis/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , perl
 , python3
@@ -43,7 +43,7 @@ in stdenv.mkDerivation rec {
   configureFlags = [
     "--enable-cblas"
     "--blas-int-size=${blasIntSize}"
-  ] ++ stdenv.lib.optionals withOpenMP [ "--enable-threading=openmp" ]
+  ] ++ lib.optionals withOpenMP [ "--enable-threading=openmp" ]
     ++ [ withArchitecture ];
 
   postPatch = ''
@@ -57,7 +57,7 @@ in stdenv.mkDerivation rec {
     ln -s $out/lib/libcblas.so.3 $out/lib/libcblas.so
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "BLAS-compatible library optimized for AMD CPUs";
     homepage = "https://developer.amd.com/amd-aocl/blas-library/";
     license = licenses.bsd3;
diff --git a/pkgs/development/libraries/science/math/amd-libflame/default.nix b/pkgs/development/libraries/science/math/amd-libflame/default.nix
index 1e331bca695c6..ac35385f98353 100644
--- a/pkgs/development/libraries/science/math/amd-libflame/default.nix
+++ b/pkgs/development/libraries/science/math/amd-libflame/default.nix
@@ -62,7 +62,7 @@ stdenv.mkDerivation rec {
     ln -s $out/lib/libflame.so.${version} $out/lib/liblapacke.so.3
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "LAPACK-compatible linear algebra library optimized for AMD CPUs";
     homepage = "https://developer.amd.com/amd-aocl/blas-library/";
     license = licenses.bsd3;
diff --git a/pkgs/development/libraries/science/math/arpack/default.nix b/pkgs/development/libraries/science/math/arpack/default.nix
index 0b927bb3eac80..382f868a99acc 100644
--- a/pkgs/development/libraries/science/math/arpack/default.nix
+++ b/pkgs/development/libraries/science/math/arpack/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake
+{ lib, stdenv, fetchFromGitHub, cmake
 , gfortran, blas, lapack, eigen }:
 
 stdenv.mkDerivation rec {
@@ -24,7 +24,7 @@ stdenv.mkDerivation rec {
 
   cmakeFlags = [
     "-DBUILD_SHARED_LIBS=ON"
-    "-DINTERFACE64=${stdenv.lib.optionalString blas.isILP64 "1"}"
+    "-DINTERFACE64=${lib.optionalString blas.isILP64 "1"}"
   ];
 
   preCheck = if stdenv.isDarwin then ''
@@ -48,8 +48,8 @@ stdenv.mkDerivation rec {
       A collection of Fortran77 subroutines to solve large scale eigenvalue
       problems.
     '';
-    license = stdenv.lib.licenses.bsd3;
-    maintainers = [ stdenv.lib.maintainers.ttuegel ];
-    platforms = stdenv.lib.platforms.unix;
+    license = lib.licenses.bsd3;
+    maintainers = [ lib.maintainers.ttuegel ];
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/science/math/blas/default.nix b/pkgs/development/libraries/science/math/blas/default.nix
index 8408763b4fe17..332806c495c90 100644
--- a/pkgs/development/libraries/science/math/blas/default.nix
+++ b/pkgs/development/libraries/science/math/blas/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, gfortran }:
+{ lib, stdenv, fetchurl, gfortran }:
 
 stdenv.mkDerivation rec {
   pname = "blas";
@@ -38,7 +38,7 @@ stdenv.mkDerivation rec {
   installPhase =
     # FreeBSD's stdenv doesn't use Coreutils.
     let dashD = if stdenv.isFreeBSD then "" else "-D"; in
-    (stdenv.lib.optionalString stdenv.isFreeBSD "mkdir -p $out/lib ;")
+    (lib.optionalString stdenv.isFreeBSD "mkdir -p $out/lib ;")
     + ''
     install ${dashD} -m755 libblas.a "$out/lib/libblas.a"
     install ${dashD} -m755 libblas.so.${version} "$out/lib/libblas.so.${version}"
@@ -55,7 +55,7 @@ Libs: -L$out/lib -lblas
 EOF
   '';
 
-  preFixup = stdenv.lib.optionalString stdenv.isDarwin ''
+  preFixup = lib.optionalString stdenv.isDarwin ''
     for fn in $(find $out/lib -name "*.so*"); do
       if [ -L "$fn" ]; then continue; fi
       install_name_tool -id "$fn" "$fn"
@@ -64,8 +64,8 @@ EOF
 
   meta = {
     description = "Basic Linear Algebra Subprograms";
-    license = stdenv.lib.licenses.publicDomain;
+    license = lib.licenses.publicDomain;
     homepage = "http://www.netlib.org/blas/";
-    platforms = stdenv.lib.platforms.unix;
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/science/math/blis/default.nix b/pkgs/development/libraries/science/math/blis/default.nix
index 3943c4dbbcaa8..eb91e0a3d2220 100644
--- a/pkgs/development/libraries/science/math/blis/default.nix
+++ b/pkgs/development/libraries/science/math/blis/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , perl
 , python3
@@ -40,7 +40,7 @@ in stdenv.mkDerivation rec {
   configureFlags = [
     "--enable-cblas"
     "--blas-int-size=${blasIntSize}"
-  ] ++ stdenv.lib.optionals withOpenMP [ "--enable-threading=openmp" ]
+  ] ++ lib.optionals withOpenMP [ "--enable-threading=openmp" ]
     ++ [ withArchitecture ];
 
   postPatch = ''
@@ -54,7 +54,7 @@ in stdenv.mkDerivation rec {
     ln -s $out/lib/libcblas.so.3 $out/lib/libcblas.so
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "BLAS-compatible linear algebra library";
     homepage = "https://github.com/flame/blis";
     license = licenses.bsd3;
diff --git a/pkgs/development/libraries/science/math/brial/default.nix b/pkgs/development/libraries/science/math/brial/default.nix
index 0d8e3415e2076..870568c9ac959 100644
--- a/pkgs/development/libraries/science/math/brial/default.nix
+++ b/pkgs/development/libraries/science/math/brial/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , autoreconfHook
 , pkg-config
@@ -36,7 +36,7 @@ stdenv.mkDerivation rec {
     pkg-config
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/BRiAl/BRiAl";
     description = "Legacy version of PolyBoRi maintained by sagemath developers";
     license = licenses.gpl2Plus;
diff --git a/pkgs/development/libraries/science/math/caffe2/default.nix b/pkgs/development/libraries/science/math/caffe2/default.nix
index 6b37abf9c6968..56c2b70eeacc9 100644
--- a/pkgs/development/libraries/science/math/caffe2/default.nix
+++ b/pkgs/development/libraries/science/math/caffe2/default.nix
@@ -136,8 +136,8 @@ stdenv.mkDerivation rec {
       algorithms. You can bring your creations to scale using the power of GPUs in the
       cloud or to the masses on mobile with Caffe2's cross-platform libraries.
     '';
-    platforms = with stdenv.lib.platforms; linux;
-    license = stdenv.lib.licenses.asl20;
-    maintainers = with stdenv.lib.maintainers; [ yuriaisaka ];
+    platforms = with lib.platforms; linux;
+    license = lib.licenses.asl20;
+    maintainers = with lib.maintainers; [ yuriaisaka ];
   };
 }
diff --git a/pkgs/development/libraries/science/math/cholmod-extra/default.nix b/pkgs/development/libraries/science/math/cholmod-extra/default.nix
index c381f56277e81..38d1b126ea4e6 100644
--- a/pkgs/development/libraries/science/math/cholmod-extra/default.nix
+++ b/pkgs/development/libraries/science/math/cholmod-extra/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, gfortran, suitesparse, blas, lapack }:
+{ lib, stdenv, fetchFromGitHub, gfortran, suitesparse, blas, lapack }:
 stdenv.mkDerivation rec {
   pname = "cholmod-extra";
   version = "1.2.0";
@@ -23,7 +23,7 @@ stdenv.mkDerivation rec {
 
   doCheck = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/jluttine/cholmod-extra";
     description = "A set of additional routines for SuiteSparse CHOLMOD Module";
     license = with licenses; [ gpl2Plus ];
diff --git a/pkgs/development/libraries/science/math/clblas/default.nix b/pkgs/development/libraries/science/math/clblas/default.nix
index a22cf914cf69b..aca395001f96f 100644
--- a/pkgs/development/libraries/science/math/clblas/default.nix
+++ b/pkgs/development/libraries/science/math/clblas/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , cmake
 , gfortran
@@ -41,19 +41,19 @@ stdenv.mkDerivation rec {
     blas
     python
     boost
-  ] ++ stdenv.lib.optionals (!stdenv.isDarwin) [
+  ] ++ lib.optionals (!stdenv.isDarwin) [
     ocl-icd
     opencl-headers
-  ] ++ stdenv.lib.optionals stdenv.isDarwin [
+  ] ++ lib.optionals stdenv.isDarwin [
     Accelerate
     CoreGraphics
     CoreVideo
   ];
-  propagatedBuildInputs = stdenv.lib.optionals stdenv.isDarwin [
+  propagatedBuildInputs = lib.optionals stdenv.isDarwin [
     OpenCL
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/clMathLibraries/clBLAS";
     description = "A software library containing BLAS functions written in OpenCL";
     longDescription = ''
diff --git a/pkgs/development/libraries/science/math/cliquer/default.nix b/pkgs/development/libraries/science/math/cliquer/default.nix
index 7fe80c323f68a..0d8bafffb44f8 100644
--- a/pkgs/development/libraries/science/math/cliquer/default.nix
+++ b/pkgs/development/libraries/science/math/cliquer/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , autoreconfHook
 }:
@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
     autoreconfHook
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://users.aalto.fi/~pat/cliquer.html";
     downloadPage = src.meta.homepage; # autocliquer
     description = "Routines for clique searching";
diff --git a/pkgs/development/libraries/science/math/clmagma/default.nix b/pkgs/development/libraries/science/math/clmagma/default.nix
index 2e798a6b83e7c..60a3afb507746 100644
--- a/pkgs/development/libraries/science/math/clmagma/default.nix
+++ b/pkgs/development/libraries/science/math/clmagma/default.nix
@@ -1,6 +1,6 @@
-{ stdenv, fetchurl, gfortran, opencl-headers, clblas, ocl-icd, mkl, intel-ocl }:
+{ lib, stdenv, fetchurl, gfortran, opencl-headers, clblas, ocl-icd, mkl, intel-ocl }:
 
-with stdenv.lib;
+with lib;
 
 let 
   version = "1.3.0";
@@ -65,7 +65,7 @@ in stdenv.mkDerivation {
     cp ${incfile} make.inc
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Matrix Algebra on GPU and Multicore Architectures, OpenCL port";
     license = licenses.bsd3;
     homepage = "http://icl.cs.utk.edu/magma/index.html";
diff --git a/pkgs/development/libraries/science/math/cudnn/generic.nix b/pkgs/development/libraries/science/math/cudnn/generic.nix
index e727218c05557..59c0b7f44980f 100644
--- a/pkgs/development/libraries/science/math/cudnn/generic.nix
+++ b/pkgs/development/libraries/science/math/cudnn/generic.nix
@@ -57,7 +57,7 @@ stdenv.mkDerivation {
     majorVersion = lib.versions.major version;
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "NVIDIA CUDA Deep Neural Network library (cuDNN)";
     homepage = "https://developer.nvidia.com/cudnn";
     license = licenses.unfree;
diff --git a/pkgs/development/libraries/science/math/ecos/default.nix b/pkgs/development/libraries/science/math/ecos/default.nix
index 2ba69a34a4a75..b60bd1fe76c11 100644
--- a/pkgs/development/libraries/science/math/ecos/default.nix
+++ b/pkgs/development/libraries/science/math/ecos/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub }:
+{ lib, stdenv, fetchFromGitHub }:
 
 stdenv.mkDerivation rec {
   pname = "ecos";
@@ -27,7 +27,7 @@ stdenv.mkDerivation rec {
     cp -r include $out/
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A lightweight conic solver for second-order cone programming";
     homepage = "https://www.embotech.com/ECOS";
     downloadPage = "https://github.com/embotech/ecos/releases";
diff --git a/pkgs/development/libraries/science/math/fenics/default.nix b/pkgs/development/libraries/science/math/fenics/default.nix
index 3f88d4de026ed..e80607ab95565 100644
--- a/pkgs/development/libraries/science/math/fenics/default.nix
+++ b/pkgs/development/libraries/science/math/fenics/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , fetchpatch
 , boost
@@ -50,8 +50,8 @@ let
     meta = {
       description = "Distributed just-in-time shared library building";
       homepage = "https://fenicsproject.org/";
-      platforms = stdenv.lib.platforms.all;
-      license = stdenv.lib.licenses.lgpl3;
+      platforms = lib.platforms.all;
+      license = lib.licenses.lgpl3;
     };
   };
 
@@ -80,8 +80,8 @@ let
     meta = {
       description = "Automatic generation of finite element basis functions";
       homepage = "https://fenicsproject.org/";
-      platforms = stdenv.lib.platforms.all;
-      license = stdenv.lib.licenses.lgpl3;
+      platforms = lib.platforms.all;
+      license = lib.licenses.lgpl3;
     };
   };
 
@@ -102,8 +102,8 @@ let
     meta = {
       description = "A domain-specific language for finite element variational forms";
       homepage = "https://fenicsproject.org/";
-      platforms = stdenv.lib.platforms.all;
-      license = stdenv.lib.licenses.lgpl3;
+      platforms = lib.platforms.all;
+      license = lib.licenses.lgpl3;
     };
   };
 
@@ -139,8 +139,8 @@ let
     meta = {
       description = "A compiler for finite element variational forms";
       homepage = "https://fenicsproject.org/";
-      platforms = stdenv.lib.platforms.all;
-      license = stdenv.lib.licenses.lgpl3;
+      platforms = lib.platforms.all;
+      license = lib.licenses.lgpl3;
     };
   };
   dolfin = stdenv.mkDerivation {
@@ -215,7 +215,7 @@ let
     meta = {
       description = "The FEniCS Problem Solving Environment in Python and C++";
       homepage = "https://fenicsproject.org/";
-      license = stdenv.lib.licenses.lgpl3;
+      license = lib.licenses.lgpl3;
     };
   };
   python-dolfin = pythonPackages.buildPythonPackage rec {
@@ -254,8 +254,8 @@ let
     meta = {
       description = "Python bindings for the DOLFIN FEM compiler";
       homepage = "https://fenicsproject.org/";
-      platforms = stdenv.lib.platforms.all;
-      license = stdenv.lib.licenses.lgpl3;
+      platforms = lib.platforms.all;
+      license = lib.licenses.lgpl3;
     };
   };
 in python-dolfin
diff --git a/pkgs/development/libraries/science/math/flintqs/default.nix b/pkgs/development/libraries/science/math/flintqs/default.nix
index 32fb70978cf99..c956eae4f7100 100644
--- a/pkgs/development/libraries/science/math/flintqs/default.nix
+++ b/pkgs/development/libraries/science/math/flintqs/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , autoreconfHook
 , gmp
@@ -29,7 +29,7 @@ stdenv.mkDerivation rec {
 
   doCheck = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/sagemath/FlintQS";
     description = "Highly optimized multi-polynomial quadratic sieve for integer factorization";
     license = with licenses; [ gpl2 ];
diff --git a/pkgs/development/libraries/science/math/ipopt/default.nix b/pkgs/development/libraries/science/math/ipopt/default.nix
index 97374fb0d477e..d1d7a9b9f342e 100644
--- a/pkgs/development/libraries/science/math/ipopt/default.nix
+++ b/pkgs/development/libraries/science/math/ipopt/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, unzip, blas, lapack, gfortran }:
+{ lib, stdenv, fetchurl, unzip, blas, lapack, gfortran }:
 
 assert (!blas.isILP64) && (!lapack.isILP64);
 
@@ -24,7 +24,7 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A software package for large-scale nonlinear optimization";
     homepage = "https://projects.coin-or.org/Ipopt";
     license = licenses.epl10;
diff --git a/pkgs/development/libraries/science/math/itpp/default.nix b/pkgs/development/libraries/science/math/itpp/default.nix
index 90e0a84e1e266..81303a3653ec1 100644
--- a/pkgs/development/libraries/science/math/itpp/default.nix
+++ b/pkgs/development/libraries/science/math/itpp/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , cmake
 , gtest
@@ -43,7 +43,7 @@ stdenv.mkDerivation rec {
     ./gtests/itpp_gtests
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "IT++ is a C++ library of mathematical, signal processing and communication classes and functions";
     homepage = http://itpp.sourceforge.net/;
     license = licenses.gpl3;
diff --git a/pkgs/development/libraries/science/math/lcalc/default.nix b/pkgs/development/libraries/science/math/lcalc/default.nix
index 6f80e1fd23e05..95034c3637a91 100644
--- a/pkgs/development/libraries/science/math/lcalc/default.nix
+++ b/pkgs/development/libraries/science/math/lcalc/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , fetchpatch
 , pari
@@ -68,13 +68,13 @@ stdenv.mkDerivation rec {
       url = "https://git.archlinux.org/svntogit/community.git/plain/trunk/lcalc-c++11.patch?h=packages/lcalc&id=3607b97df5a8c231191115b0cb5c62426b339e71";
       sha256 = "1ccrl61lv2vvx8ggldq54m5d0n1iy6mym7qz0i8nj6yj0dshnpk3";
     })
-  ] ++ stdenv.lib.optional stdenv.isDarwin
+  ] ++ lib.optional stdenv.isDarwin
   (fetchpatch {
     url = "https://git.sagemath.org/sage.git/plain/build/pkgs/lcalc/patches/clang.patch";
     sha256 = "0bb7656z6cp6i4p2qj745cmq0lhh52v2akl9whi760dynfdxbl18";
   });
 
-  postPatch = stdenv.lib.optionalString stdenv.isDarwin ''
+  postPatch = lib.optionalString stdenv.isDarwin ''
     substituteInPlace src/Makefile --replace g++ c++
   '';
 
@@ -87,7 +87,7 @@ stdenv.mkDerivation rec {
     "PARI_PREFIX=${pari}"
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://oto.math.uwaterloo.ca/~mrubinst/L_function_public/L.html";
     description = "A program for calculating with L-functions";
     license = with licenses; [ gpl2 ];
diff --git a/pkgs/development/libraries/science/math/libbraiding/default.nix b/pkgs/development/libraries/science/math/libbraiding/default.nix
index 36d4ad54c3dfd..cc5d3baf3442f 100644
--- a/pkgs/development/libraries/science/math/libbraiding/default.nix
+++ b/pkgs/development/libraries/science/math/libbraiding/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , autoreconfHook
 }:
@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
   # no tests included for now (2018-08-05), but can't hurt to activate
   doCheck = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/miguelmarco/libbraiding/";
     description = "C++ library for computations on braid groups";
     longDescription = ''
diff --git a/pkgs/development/libraries/science/math/libhomfly/default.nix b/pkgs/development/libraries/science/math/libhomfly/default.nix
index 788f534cc779a..b756109aa8fc8 100644
--- a/pkgs/development/libraries/science/math/libhomfly/default.nix
+++ b/pkgs/development/libraries/science/math/libhomfly/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , autoreconfHook
 , boehmgc
@@ -25,7 +25,7 @@ stdenv.mkDerivation rec {
 
   doCheck = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/miguelmarco/libhomfly/";
     description = "Library to compute the homfly polynomial of knots and links";
     license = licenses.unlicense;
diff --git a/pkgs/development/libraries/science/math/liblapack/default.nix b/pkgs/development/libraries/science/math/liblapack/default.nix
index c44e995bfbbc0..c742cc60b27f1 100644
--- a/pkgs/development/libraries/science/math/liblapack/default.nix
+++ b/pkgs/development/libraries/science/math/liblapack/default.nix
@@ -1,5 +1,5 @@
 {
-  stdenv,
+  lib, stdenv,
   fetchFromGitHub,
   gfortran,
   cmake,
@@ -7,7 +7,7 @@
   shared ? true
 }:
 let
-  inherit (stdenv.lib) optional;
+  inherit (lib) optional;
   version = "3.9.0";
 in
 
@@ -33,7 +33,7 @@ stdenv.mkDerivation {
 
   doCheck = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     inherit version;
     description = "Linear Algebra PACKage";
     homepage = "http://www.netlib.org/lapack/";
diff --git a/pkgs/development/libraries/science/math/liblbfgs/default.nix b/pkgs/development/libraries/science/math/liblbfgs/default.nix
index 49108e5e33052..20c5a2070a05c 100644
--- a/pkgs/development/libraries/science/math/liblbfgs/default.nix
+++ b/pkgs/development/libraries/science/math/liblbfgs/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 stdenv.mkDerivation {
   name = "liblbfgs-1.10";
 
@@ -11,7 +11,7 @@ stdenv.mkDerivation {
   meta = {
     description = "Library of Limited-memory Broyden-Fletcher-Goldfarb-Shanno (L-BFGS)";
     homepage = "http://www.chokkan.org/software/liblbfgs/";
-    license = stdenv.lib.licenses.mit;
-    platforms = stdenv.lib.platforms.unix;
+    license = lib.licenses.mit;
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/science/math/libtorch/bin.nix b/pkgs/development/libraries/science/math/libtorch/bin.nix
index fba8bcb9367b9..9631f3931cab8 100644
--- a/pkgs/development/libraries/science/math/libtorch/bin.nix
+++ b/pkgs/development/libraries/science/math/libtorch/bin.nix
@@ -25,7 +25,7 @@ in stdenv.mkDerivation {
   nativeBuildInputs =
     if stdenv.isDarwin then [ fixDarwinDylibNames ]
     else [ addOpenGLRunpath patchelf ]
-      ++ stdenv.lib.optionals cudaSupport [ addOpenGLRunpath ];
+      ++ lib.optionals cudaSupport [ addOpenGLRunpath ];
 
   buildInputs = [
     stdenv.cc.cc
@@ -57,9 +57,9 @@ in stdenv.mkDerivation {
 
   postFixup = let
     libPaths = [ stdenv.cc.cc.lib ]
-      ++ stdenv.lib.optionals cudaSupport [ nvidia_x11 ];
-    rpath = stdenv.lib.makeLibraryPath libPaths;
-  in stdenv.lib.optionalString stdenv.isLinux ''
+      ++ lib.optionals cudaSupport [ nvidia_x11 ];
+    rpath = lib.makeLibraryPath libPaths;
+  in lib.optionalString stdenv.isLinux ''
     find $out/lib -type f \( -name '*.so' -or -name '*.so.*' \) | while read lib; do
       echo "setting rpath for $lib..."
       patchelf --set-rpath "${rpath}:$out/lib" "$lib"
@@ -67,7 +67,7 @@ in stdenv.mkDerivation {
         addOpenGLRunpath "$lib"
       ''}
     done
-  '' + stdenv.lib.optionalString stdenv.isDarwin ''
+  '' + lib.optionalString stdenv.isDarwin ''
     install_name_tool -change @rpath/libshm.dylib $out/lib/libshm.dylib $out/lib/libtorch_python.dylib
     install_name_tool -change @rpath/libc10.dylib $out/lib/libc10.dylib $out/lib/libtorch_python.dylib
     install_name_tool -change @rpath/libiomp5.dylib $out/lib/libiomp5.dylib $out/lib/libtorch_python.dylib
@@ -110,7 +110,7 @@ in stdenv.mkDerivation {
 
   passthru.tests.cmake = callPackage ./test { };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "C++ API of the PyTorch machine learning framework";
     homepage = "https://pytorch.org/";
     license = licenses.unfree; # Includes CUDA and Intel MKL.
diff --git a/pkgs/development/libraries/science/math/lrs/default.nix b/pkgs/development/libraries/science/math/lrs/default.nix
index b0cfbca5aa331..f7f981e223b2e 100644
--- a/pkgs/development/libraries/science/math/lrs/default.nix
+++ b/pkgs/development/libraries/science/math/lrs/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, gmp}:
+{lib, stdenv, fetchurl, gmp}:
 
 stdenv.mkDerivation rec {
   pname = "lrs";
@@ -18,9 +18,9 @@ stdenv.mkDerivation rec {
   meta = {
     inherit version;
     description = "Implementation of the reverse search algorithm for vertex enumeration/convex hull problems";
-    license = stdenv.lib.licenses.gpl2 ;
-    maintainers = [stdenv.lib.maintainers.raskin];
-    platforms = stdenv.lib.platforms.linux;
+    license = lib.licenses.gpl2 ;
+    maintainers = [lib.maintainers.raskin];
+    platforms = lib.platforms.linux;
     homepage = "http://cgm.cs.mcgill.ca/~avis/C/lrs.html";
   };
 }
diff --git a/pkgs/development/libraries/science/math/m4ri/default.nix b/pkgs/development/libraries/science/math/m4ri/default.nix
index f50c15abbdf14..26e26e4ffdbc8 100644
--- a/pkgs/development/libraries/science/math/m4ri/default.nix
+++ b/pkgs/development/libraries/science/math/m4ri/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromBitbucket
 , autoreconfHook
 }:
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
     autoreconfHook
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://malb.bitbucket.io/m4ri/";
     description = "Library to do fast arithmetic with dense matrices over F_2";
     license = licenses.gpl2Plus;
diff --git a/pkgs/development/libraries/science/math/m4rie/default.nix b/pkgs/development/libraries/science/math/m4rie/default.nix
index 532285991a3c2..38a633e58c712 100644
--- a/pkgs/development/libraries/science/math/m4rie/default.nix
+++ b/pkgs/development/libraries/science/math/m4rie/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromBitbucket
 , autoreconfHook
 , m4ri
@@ -25,7 +25,7 @@ stdenv.mkDerivation rec {
     autoreconfHook
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://malb.bitbucket.io/m4rie/";
     description = "Library for matrix multiplication, reduction and inversion over GF(2^k) for 2 <= k <= 10";
     longDescription = ''
diff --git a/pkgs/development/libraries/science/math/magma/default.nix b/pkgs/development/libraries/science/math/magma/default.nix
index b4ac119ce6cf0..b8e3999ffe83c 100644
--- a/pkgs/development/libraries/science/math/magma/default.nix
+++ b/pkgs/development/libraries/science/math/magma/default.nix
@@ -1,6 +1,6 @@
-{ stdenv, fetchurl, cmake, gfortran, ninja, cudatoolkit, libpthreadstubs, lapack, blas }:
+{ lib, stdenv, fetchurl, cmake, gfortran, ninja, cudatoolkit, libpthreadstubs, lapack, blas }:
 
-with stdenv.lib;
+with lib;
 
 let version = "2.5.4";
 
@@ -43,7 +43,7 @@ in stdenv.mkDerivation {
         > $out/lib/pkgconfig/magma.pc
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Matrix Algebra on GPU and Multicore Architectures";
     license = licenses.bsd3;
     homepage = "http://icl.cs.utk.edu/magma/index.html";
diff --git a/pkgs/development/libraries/science/math/metis/default.nix b/pkgs/development/libraries/science/math/metis/default.nix
index d5861d9db3334..b06b432372a7d 100644
--- a/pkgs/development/libraries/science/math/metis/default.nix
+++ b/pkgs/development/libraries/science/math/metis/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, unzip, cmake }:
+{ lib, stdenv, fetchurl, unzip, cmake }:
 
 stdenv.mkDerivation {
   name = "metis-5.1.0";
@@ -14,7 +14,7 @@ stdenv.mkDerivation {
   meta = {
     description = "Serial graph partitioning and fill-reducing matrix ordering";
     homepage = "http://glaros.dtc.umn.edu/gkhome/metis/metis/overview";
-    license = stdenv.lib.licenses.asl20;
-    platforms = stdenv.lib.platforms.all;
+    license = lib.licenses.asl20;
+    platforms = lib.platforms.all;
   };
 }
diff --git a/pkgs/development/libraries/science/math/mongoose/default.nix b/pkgs/development/libraries/science/math/mongoose/default.nix
index 36c53b2994f55..7dd52f3b663df 100644
--- a/pkgs/development/libraries/science/math/mongoose/default.nix
+++ b/pkgs/development/libraries/science/math/mongoose/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , cmake
 }:
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
     cmake
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Graph Coarsening and Partitioning Library";
     homepage = "https://github.com/ScottKolo/Mongoose";
     license = licenses.gpl3;
diff --git a/pkgs/development/libraries/science/math/nccl/default.nix b/pkgs/development/libraries/science/math/nccl/default.nix
index eb194c0e9e472..5036ad890799e 100644
--- a/pkgs/development/libraries/science/math/nccl/default.nix
+++ b/pkgs/development/libraries/science/math/nccl/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, which, cudatoolkit, addOpenGLRunpath }:
+{ lib, stdenv, fetchFromGitHub, which, cudatoolkit, addOpenGLRunpath }:
 
 stdenv.mkDerivation rec {
   name = "nccl-${version}-cuda-${cudatoolkit.majorVersion}";
@@ -38,7 +38,7 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Multi-GPU and multi-node collective communication primitives for NVIDIA GPUs";
     homepage = "https://developer.nvidia.com/nccl";
     license = licenses.bsd3;
diff --git a/pkgs/development/libraries/science/math/openblas/default.nix b/pkgs/development/libraries/science/math/openblas/default.nix
index 0d83c5c365012..bd7b739bd77f5 100644
--- a/pkgs/development/libraries/science/math/openblas/default.nix
+++ b/pkgs/development/libraries/science/math/openblas/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, perl, which
+{ lib, stdenv, fetchFromGitHub, perl, which
 # Most packages depending on openblas expect integer width to match
 # pointer width, but some expect to use 32-bit integers always
 # (for compatibility with reference BLAS).
@@ -19,7 +19,7 @@
 , enableShared ? !stdenv.hostPlatform.isStatic
 }:
 
-with stdenv.lib;
+with lib;
 
 let blas64_ = blas64; in
 
@@ -160,7 +160,7 @@ stdenv.mkDerivation rec {
     NO_BINARY_MODE = if stdenv.isx86_64
         then toString (stdenv.hostPlatform != stdenv.buildPlatform)
         else stdenv.hostPlatform != stdenv.buildPlatform;
-  } // (stdenv.lib.optionalAttrs singleThreaded {
+  } // (lib.optionalAttrs singleThreaded {
     # As described on https://github.com/xianyi/OpenBLAS/wiki/Faq/4bded95e8dc8aadc70ce65267d1093ca7bdefc4c#multi-threaded
     USE_THREAD = false;
     USE_LOCKING = true; # available with openblas >= 0.3.7
@@ -188,14 +188,14 @@ EOF
     ln -s $out/lib/libopenblas${shlibExt} $out/lib/libcblas${shlibExt}
     ln -s $out/lib/libopenblas${shlibExt} $out/lib/liblapack${shlibExt}
     ln -s $out/lib/libopenblas${shlibExt} $out/lib/liblapacke${shlibExt}
-  '' + stdenv.lib.optionalString stdenv.hostPlatform.isLinux ''
+  '' + lib.optionalString stdenv.hostPlatform.isLinux ''
     ln -s $out/lib/libopenblas${shlibExt} $out/lib/libblas${shlibExt}.3
     ln -s $out/lib/libopenblas${shlibExt} $out/lib/libcblas${shlibExt}.3
     ln -s $out/lib/libopenblas${shlibExt} $out/lib/liblapack${shlibExt}.3
     ln -s $out/lib/libopenblas${shlibExt} $out/lib/liblapacke${shlibExt}.3
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Basic Linear Algebra Subprograms";
     license = licenses.bsd3;
     homepage = "https://github.com/xianyi/OpenBLAS";
diff --git a/pkgs/development/libraries/science/math/openlibm/default.nix b/pkgs/development/libraries/science/math/openlibm/default.nix
index 17197823d6ef3..2c4198d9679a5 100644
--- a/pkgs/development/libraries/science/math/openlibm/default.nix
+++ b/pkgs/development/libraries/science/math/openlibm/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
   pname = "openlibm";
@@ -13,8 +13,8 @@ stdenv.mkDerivation rec {
   meta = {
     description = "High quality system independent, portable, open source libm implementation";
     homepage = "https://openlibm.org/";
-    license = stdenv.lib.licenses.mit;
-    maintainers = [ stdenv.lib.maintainers.ttuegel ];
-    platforms = stdenv.lib.platforms.all;
+    license = lib.licenses.mit;
+    maintainers = [ lib.maintainers.ttuegel ];
+    platforms = lib.platforms.all;
   };
 }
diff --git a/pkgs/development/libraries/science/math/openspecfun/default.nix b/pkgs/development/libraries/science/math/openspecfun/default.nix
index 3689df607074b..a341264d9894e 100644
--- a/pkgs/development/libraries/science/math/openspecfun/default.nix
+++ b/pkgs/development/libraries/science/math/openspecfun/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, gfortran }:
+{ lib, stdenv, fetchurl, gfortran }:
 
 stdenv.mkDerivation {
   name = "openspecfun-0.5.3";
@@ -14,8 +14,8 @@ stdenv.mkDerivation {
   meta = {
     description = "A collection of special mathematical functions";
     homepage = "https://github.com/JuliaLang/openspecfun";
-    license = stdenv.lib.licenses.mit;
-    maintainers = [ stdenv.lib.maintainers.ttuegel ];
-    platforms = stdenv.lib.platforms.all;
+    license = lib.licenses.mit;
+    maintainers = [ lib.maintainers.ttuegel ];
+    platforms = lib.platforms.all;
   };
 }
diff --git a/pkgs/development/libraries/science/math/or-tools/default.nix b/pkgs/development/libraries/science/math/or-tools/default.nix
index 0dc77c10c5e76..53c117233d208 100644
--- a/pkgs/development/libraries/science/math/or-tools/default.nix
+++ b/pkgs/development/libraries/science/math/or-tools/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, abseil-cpp, gflags, which
+{ lib, stdenv, fetchFromGitHub, cmake, abseil-cpp, gflags, which
 , lsb-release, glog, protobuf, cbc, zlib
 , ensureNewerSourcesForZipFilesHook, python, swig }:
 
@@ -55,7 +55,7 @@ stdenv.mkDerivation rec {
 
   outputs = [ "out" "python" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/google/or-tools";
     license = licenses.asl20;
     description = ''
diff --git a/pkgs/development/libraries/science/math/osi/default.nix b/pkgs/development/libraries/science/math/osi/default.nix
index aa340b6dafad6..b61cd84060641 100644
--- a/pkgs/development/libraries/science/math/osi/default.nix
+++ b/pkgs/development/libraries/science/math/osi/default.nix
@@ -32,7 +32,7 @@ stdenv.mkDerivation rec {
 
   passthru = { inherit withGurobi withCplex; };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "An abstract base class to a generic linear programming (LP) solver";
     homepage = "https://github.com/coin-or/Osi";
     license = licenses.epl10;
diff --git a/pkgs/development/libraries/science/math/osqp/default.nix b/pkgs/development/libraries/science/math/osqp/default.nix
index 9cd062d21f2f3..00f2726f60fee 100644
--- a/pkgs/development/libraries/science/math/osqp/default.nix
+++ b/pkgs/development/libraries/science/math/osqp/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , cmake
 }:
@@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ cmake ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A quadratic programming solver using operator splitting";
     homepage = "https://osqp.org";
     license = licenses.asl20;
diff --git a/pkgs/development/libraries/science/math/parmetis/default.nix b/pkgs/development/libraries/science/math/parmetis/default.nix
index 050e8f1b28563..db70bf8dd7a4b 100644
--- a/pkgs/development/libraries/science/math/parmetis/default.nix
+++ b/pkgs/development/libraries/science/math/parmetis/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , cmake
 , mpi
@@ -24,7 +24,7 @@ stdenv.mkDerivation rec {
     make config metis_path=$PWD/metis gklib_path=$PWD/metis/GKlib prefix=$out
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "An MPI-based parallel library that implements a variety of algorithms for partitioning unstructured graphs, meshes, and for computing fill-reducing orderings of sparse matrices";
     homepage = "http://glaros.dtc.umn.edu/gkhome/metis/parmetis/overview";
     platforms = platforms.all;
diff --git a/pkgs/development/libraries/science/math/petsc/default.nix b/pkgs/development/libraries/science/math/petsc/default.nix
index a1e9d1e305158..f06a028fe64f6 100644
--- a/pkgs/development/libraries/science/math/petsc/default.nix
+++ b/pkgs/development/libraries/science/math/petsc/default.nix
@@ -1,4 +1,4 @@
-{ stdenv , darwin , fetchurl , blas , gfortran , lapack , python }:
+{ lib, stdenv , darwin , fetchurl , blas , gfortran , lapack , python }:
 
 stdenv.mkDerivation rec {
   pname = "petsc";
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
   prePatch = ''
     substituteInPlace configure \
       --replace /bin/sh /usr/bin/python
-  '' + stdenv.lib.optionalString stdenv.isDarwin ''
+  '' + lib.optionalString stdenv.isDarwin ''
     substituteInPlace config/install.py \
       --replace /usr/bin/install_name_tool ${darwin.cctools}/bin/install_name_tool
   '';
@@ -39,7 +39,7 @@ stdenv.mkDerivation rec {
     )
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = ''
       Library of linear algebra algorithms for solving partial differential
       equations
diff --git a/pkgs/development/libraries/science/math/planarity/default.nix b/pkgs/development/libraries/science/math/planarity/default.nix
index b1d6a072e1303..a257b84ca54b8 100644
--- a/pkgs/development/libraries/science/math/planarity/default.nix
+++ b/pkgs/development/libraries/science/math/planarity/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , fetchpatch
 , autoreconfHook
@@ -29,7 +29,7 @@ stdenv.mkDerivation rec {
     })
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/graph-algorithms/edge-addition-planarity-suite";
     description = "A library for implementing graph algorithms";
     license = licenses.bsd3;
diff --git a/pkgs/development/libraries/science/math/primesieve/default.nix b/pkgs/development/libraries/science/math/primesieve/default.nix
index 46709ff218a0a..d99026bc5659c 100644
--- a/pkgs/development/libraries/science/math/primesieve/default.nix
+++ b/pkgs/development/libraries/science/math/primesieve/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, cmake }:
+{ lib, stdenv, fetchurl, cmake }:
 
 stdenv.mkDerivation rec {
   pname = "primesieve";
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
     sha256 = "0g60br3p8di92jx3pr2bb51xh15gg57l7qvwzwn7xf7l585hgi7v";
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Fast C/C++ prime number generator";
     homepage = "https://primesieve.org/";
     license = licenses.bsd2;
diff --git a/pkgs/development/libraries/science/math/rankwidth/default.nix b/pkgs/development/libraries/science/math/rankwidth/default.nix
index 53f4313a20697..38c9444d0d31d 100644
--- a/pkgs/development/libraries/science/math/rankwidth/default.nix
+++ b/pkgs/development/libraries/science/math/rankwidth/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 }:
 
@@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
   # check phase is empty for now (as of version 0.7)
   doCheck = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Calculates rank-width and rank-decompositions";
     license = with licenses; [ gpl2Plus ];
     maintainers = teams.sage.members;
diff --git a/pkgs/development/libraries/science/math/rubiks/default.nix b/pkgs/development/libraries/science/math/rubiks/default.nix
index 44f8150386e7f..b4b6708849895 100644
--- a/pkgs/development/libraries/science/math/rubiks/default.nix
+++ b/pkgs/development/libraries/science/math/rubiks/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , fetchpatch
 , coreutils
@@ -45,7 +45,7 @@ stdenv.mkDerivation rec {
     })
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://wiki.sagemath.org/spkg/rubiks";
     description = "Several programs for working with Rubik's cubes";
     # The individual websites are no longer available
diff --git a/pkgs/development/libraries/science/math/scalapack/default.nix b/pkgs/development/libraries/science/math/scalapack/default.nix
index b4d339f62269e..4ef10439cc517 100644
--- a/pkgs/development/libraries/science/math/scalapack/default.nix
+++ b/pkgs/development/libraries/science/math/scalapack/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, openssh
+{ lib, stdenv, fetchFromGitHub, cmake, openssh
 , gfortran, mpi, blas, lapack
 } :
 
@@ -42,7 +42,7 @@ stdenv.mkDerivation rec {
     export LD_LIBRARY_PATH=$LD_LIBRARY_PATH''${LD_LIBRARY_PATH:+:}`pwd`/lib
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://www.netlib.org/scalapack/";
     description = "Library of high-performance linear algebra routines for parallel distributed memory machines";
     license = licenses.bsd3;
diff --git a/pkgs/development/libraries/science/math/scs/default.nix b/pkgs/development/libraries/science/math/scs/default.nix
index 3820f2b95275f..96f543e430f0c 100644
--- a/pkgs/development/libraries/science/math/scs/default.nix
+++ b/pkgs/development/libraries/science/math/scs/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, blas, lapack, gfortran, fixDarwinDylibNames }:
+{ lib, stdenv, fetchFromGitHub, blas, lapack, gfortran, fixDarwinDylibNames }:
 
 assert (!blas.isILP64) && (!lapack.isILP64);
 
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
       --replace "gcc" "cc"
   '';
 
-  nativeBuildInputs = stdenv.lib.optional stdenv.isDarwin fixDarwinDylibNames;
+  nativeBuildInputs = lib.optional stdenv.isDarwin fixDarwinDylibNames;
 
   buildInputs = [ blas lapack gfortran.cc.lib ];
 
@@ -39,7 +39,7 @@ stdenv.mkDerivation rec {
     runHook postInstall
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Splitting Conic Solver";
     longDescription = ''
       Numerical optimization package for solving large-scale convex cone problems
diff --git a/pkgs/development/libraries/science/math/spooles/default.nix b/pkgs/development/libraries/science/math/spooles/default.nix
index c55a1b8002e1e..6f4ddb3f787ee 100644
--- a/pkgs/development/libraries/science/math/spooles/default.nix
+++ b/pkgs/development/libraries/science/math/spooles/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, gfortran, perl }:
+{ lib, stdenv, fetchurl, gfortran, perl }:
 
 stdenv.mkDerivation rec {
   pname = "spooles";
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
     ./spooles.patch
   ];
 
-  postPatch = stdenv.lib.optionalString stdenv.hostPlatform.isDarwin ''
+  postPatch = lib.optionalString stdenv.hostPlatform.isDarwin ''
     substituteInPlace makefile --replace '-Wl,-soname' '-Wl,-install_name'
   '';
 
@@ -42,7 +42,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ perl ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://www.netlib.org/linalg/spooles/";
     description = "Library for solving sparse real and complex linear systems of equations";
     license = licenses.publicDomain;
diff --git a/pkgs/development/libraries/science/math/suitesparse-graphblas/default.nix b/pkgs/development/libraries/science/math/suitesparse-graphblas/default.nix
index 1c910a4f75bb6..7696b18e7ca46 100644
--- a/pkgs/development/libraries/science/math/suitesparse-graphblas/default.nix
+++ b/pkgs/development/libraries/science/math/suitesparse-graphblas/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , cmake
 , gnum4
@@ -22,7 +22,7 @@ stdenv.mkDerivation rec {
     gnum4
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Graph algorithms in the language of linear algebra";
     homepage = "http://faculty.cse.tamu.edu/davis/GraphBLAS.html";
     license = licenses.asl20;
diff --git a/pkgs/development/libraries/science/math/suitesparse/4.2.nix b/pkgs/development/libraries/science/math/suitesparse/4.2.nix
index b1c1202c57804..b8ce3eca888ca 100644
--- a/pkgs/development/libraries/science/math/suitesparse/4.2.nix
+++ b/pkgs/development/libraries/science/math/suitesparse/4.2.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, gfortran, blas, lapack }:
+{ lib, stdenv, fetchurl, gfortran, blas, lapack }:
 
 let
   int_t = if blas.isILP64 then "int64_t" else "int32_t";
@@ -33,7 +33,7 @@ stdenv.mkDerivation rec {
     "LAPACK=-llapack"
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://faculty.cse.tamu.edu/davis/suitesparse.html";
     description = "A suite of sparse matrix algorithms";
     license = with licenses; [ bsd2 gpl2Plus lgpl21Plus ];
diff --git a/pkgs/development/libraries/science/math/suitesparse/4.4.nix b/pkgs/development/libraries/science/math/suitesparse/4.4.nix
index 81a80c920b539..1ebac6ac445d6 100644
--- a/pkgs/development/libraries/science/math/suitesparse/4.4.nix
+++ b/pkgs/development/libraries/science/math/suitesparse/4.4.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, gfortran, blas, lapack
+{ lib, stdenv, fetchurl, gfortran, blas, lapack
 , enableCuda ? false, cudatoolkit
 }:
 
@@ -27,11 +27,11 @@ stdenv.mkDerivation {
         -e '/CHOLMOD_CONFIG/ s/$/-DNPARTITION -DLONGBLAS=${int_t}/' \
         -e '/UMFPACK_CONFIG/ s/$/-DLONGBLAS=${int_t}/'
   ''
-  + stdenv.lib.optionalString stdenv.isDarwin ''
+  + lib.optionalString stdenv.isDarwin ''
     sed -i "SuiteSparse_config/SuiteSparse_config.mk" \
         -e 's/^[[:space:]]*\(LIB = -lm\) -lrt/\1/'
   ''
-  + stdenv.lib.optionalString enableCuda ''
+  + lib.optionalString enableCuda ''
     sed -i "SuiteSparse_config/SuiteSparse_config.mk" \
         -e 's|^[[:space:]]*\(CUDA_ROOT     =\)|CUDA_ROOT = ${cudatoolkit}|' \
         -e 's|^[[:space:]]*\(GPU_BLAS_PATH =\)|GPU_BLAS_PATH = $(CUDA_ROOT)|' \
@@ -55,7 +55,7 @@ stdenv.mkDerivation {
     "LAPACK=-llapack"
   ];
 
-  NIX_CFLAGS_COMPILE = stdenv.lib.optionalString stdenv.isDarwin " -DNTIMER";
+  NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isDarwin " -DNTIMER";
 
   postInstall = ''
     # Build and install shared library
@@ -64,7 +64,7 @@ stdenv.mkDerivation {
         for i in "$out"/lib/lib*.a; do
           ar -x $i
         done
-        ${if enableCuda then cudatoolkit else stdenv.cc.outPath}/bin/${if enableCuda then "nvcc" else "cc"} *.o ${if stdenv.isDarwin then "-dynamiclib" else "--shared"} -o "$out/lib/libsuitesparse${SHLIB_EXT}" -lblas ${stdenv.lib.optionalString enableCuda "-lcublas"}
+        ${if enableCuda then cudatoolkit else stdenv.cc.outPath}/bin/${if enableCuda then "nvcc" else "cc"} *.o ${if stdenv.isDarwin then "-dynamiclib" else "--shared"} -o "$out/lib/libsuitesparse${SHLIB_EXT}" -lblas ${lib.optionalString enableCuda "-lcublas"}
     )
     for i in umfpack cholmod amd camd colamd spqr; do
       ln -s libsuitesparse${SHLIB_EXT} "$out"/lib/lib$i${SHLIB_EXT}
@@ -90,7 +90,7 @@ stdenv.mkDerivation {
   nativeBuildInputs = [ gfortran ];
   buildInputs = [ blas lapack ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://faculty.cse.tamu.edu/davis/suitesparse.html";
     description = "A suite of sparse matrix algorithms";
     license = with licenses; [ bsd2 gpl2Plus lgpl21Plus ];
diff --git a/pkgs/development/libraries/science/math/suitesparse/default.nix b/pkgs/development/libraries/science/math/suitesparse/default.nix
index 2e76050aa9892..f0c82e7190f9b 100644
--- a/pkgs/development/libraries/science/math/suitesparse/default.nix
+++ b/pkgs/development/libraries/science/math/suitesparse/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , gfortran
 , blas, lapack
@@ -24,7 +24,7 @@ stdenv.mkDerivation rec {
   };
 
   nativeBuildInputs = [
-  ] ++ stdenv.lib.optional stdenv.isDarwin fixDarwinDylibNames;
+  ] ++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
 
   # Use compatible indexing for lapack and blas used
   buildInputs = assert (blas.isILP64 == lapack.isILP64); [
@@ -33,7 +33,7 @@ stdenv.mkDerivation rec {
     gfortran.cc.lib
     gmp
     mpfr
-  ] ++ stdenv.lib.optional enableCuda cudatoolkit;
+  ] ++ lib.optional enableCuda cudatoolkit;
 
   preConfigure = ''
     # Mongoose and GraphBLAS are packaged separately
@@ -45,13 +45,13 @@ stdenv.mkDerivation rec {
     "INSTALL_INCLUDE=${placeholder "dev"}/include"
     "JOBS=$(NIX_BUILD_CORES)"
     "MY_METIS_LIB=-lmetis"
-  ] ++ stdenv.lib.optionals blas.isILP64 [
+  ] ++ lib.optionals blas.isILP64 [
     "CFLAGS=-DBLAS64"
-  ] ++ stdenv.lib.optionals enableCuda [
+  ] ++ lib.optionals enableCuda [
     "CUDA_PATH=${cudatoolkit}"
     "CUDART_LIB=${cudatoolkit.lib}/lib/libcudart.so"
     "CUBLAS_LIB=${cudatoolkit}/lib/libcublas.so"
-  ] ++ stdenv.lib.optionals stdenv.isDarwin [
+  ] ++ lib.optionals stdenv.isDarwin [
     # Unless these are set, the build will attempt to use `Accelerate` on darwin, see:
     # https://github.com/DrTimothyAldenDavis/SuiteSparse/blob/v5.8.1/SuiteSparse_config/SuiteSparse_config.mk#L368
     "BLAS=-lblas"
@@ -64,7 +64,7 @@ stdenv.mkDerivation rec {
     "library"
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://faculty.cse.tamu.edu/davis/suitesparse.html";
     description = "A suite of sparse matrix algorithms";
     license = with licenses; [ bsd2 gpl2Plus lgpl21Plus ];
diff --git a/pkgs/development/libraries/science/math/superlu/default.nix b/pkgs/development/libraries/science/math/superlu/default.nix
index 892ccb4da11e8..26dd00d960694 100644
--- a/pkgs/development/libraries/science/math/superlu/default.nix
+++ b/pkgs/development/libraries/science/math/superlu/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, cmake,
+{ lib, stdenv, fetchurl, cmake,
   gfortran, blas, lapack}:
 
 assert (!blas.isILP64) && (!lapack.isILP64);
@@ -32,6 +32,6 @@ stdenv.mkDerivation rec {
     homepage = "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/";
     license = "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/License.txt";
     description = "A library for the solution of large, sparse, nonsymmetric systems of linear equations";
-    platforms = stdenv.lib.platforms.unix;
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/science/math/sympow/default.nix b/pkgs/development/libraries/science/math/sympow/default.nix
index a83e2c835461c..3c31ed8a361bc 100644
--- a/pkgs/development/libraries/science/math/sympow/default.nix
+++ b/pkgs/development/libraries/science/math/sympow/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitLab
 , makeWrapper
 , which
@@ -61,7 +61,7 @@ stdenv.mkDerivation rec {
     "$out/bin/sympow" -sp 2p16 -curve "[1,2,3,4,5]" | grep '8.3705'
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Compute special values of symmetric power elliptic curve L-functions";
     license = {
       shortName = "sympow";
diff --git a/pkgs/development/libraries/science/math/tensorflow/bin.nix b/pkgs/development/libraries/science/math/tensorflow/bin.nix
index 3f3e1871f4399..d42026c13cf9e 100644
--- a/pkgs/development/libraries/science/math/tensorflow/bin.nix
+++ b/pkgs/development/libraries/science/math/tensorflow/bin.nix
@@ -1,10 +1,10 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , addOpenGLRunpath
 , cudaSupport ? false, symlinkJoin, cudatoolkit, cudnn, nvidia_x11
 }:
 
-with stdenv.lib;
+with lib;
 let
   broken = !stdenv.isLinux && !stdenv.isDarwin;
 
diff --git a/pkgs/development/libraries/science/networking/ns-3/default.nix b/pkgs/development/libraries/science/networking/ns-3/default.nix
index 494c7f9f851be..4a90f082dc08f 100644
--- a/pkgs/development/libraries/science/networking/ns-3/default.nix
+++ b/pkgs/development/libraries/science/networking/ns-3/default.nix
@@ -33,8 +33,8 @@
 
 let
   pythonEnv = python.withPackages(ps:
-    stdenv.lib.optional withManual ps.sphinx
-    ++ stdenv.lib.optionals pythonSupport (with ps;[ pybindgen pygccxml ])
+    lib.optional withManual ps.sphinx
+    ++ lib.optionals pythonSupport (with ps;[ pybindgen pygccxml ])
   );
 in
 stdenv.mkDerivation rec {
@@ -63,7 +63,7 @@ stdenv.mkDerivation rec {
     patchShebangs doc/ns3_html_theme/get_version.sh
   '';
 
-  wafConfigureFlags = with stdenv.lib; [
+  wafConfigureFlags = with lib; [
       "--enable-modules=${concatStringsSep "," modules}"
       "--with-python=${pythonEnv.interpreter}"
   ]
@@ -81,7 +81,7 @@ stdenv.mkDerivation rec {
   # to prevent fatal error: 'backward_warning.h' file not found
   CXXFLAGS = "-D_GLIBCXX_PERMIT_BACKWARD_HASH";
 
-  postBuild = with stdenv.lib; let flags = concatStringsSep ";" (
+  postBuild = with lib; let flags = concatStringsSep ";" (
       optional enableDoxygen "./waf doxygen"
       ++ optional withManual "./waf sphinx"
     );
@@ -109,7 +109,7 @@ stdenv.mkDerivation rec {
   # strictoverflow prevents clang from discovering pyembed when bindings
   hardeningDisable = [ "fortify" "strictoverflow"];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://www.nsnam.org";
     license = licenses.gpl3;
     description = "A discrete time event network simulator";
diff --git a/pkgs/development/libraries/science/robotics/ispike/default.nix b/pkgs/development/libraries/science/robotics/ispike/default.nix
index 70488426b011d..b3eed2e326e6f 100644
--- a/pkgs/development/libraries/science/robotics/ispike/default.nix
+++ b/pkgs/development/libraries/science/robotics/ispike/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, cmake, boost }:
+{ lib, stdenv, fetchurl, cmake, boost }:
 
 stdenv.mkDerivation rec {
   pname = "ispike";
@@ -15,8 +15,8 @@ stdenv.mkDerivation rec {
   meta = {
     description = "Spiking neural interface between iCub and a spiking neural simulator";
     homepage = "https://sourceforge.net/projects/ispike/";
-    license = stdenv.lib.licenses.lgpl3;
-    platforms = stdenv.lib.platforms.linux;
-    maintainers = [ stdenv.lib.maintainers.nico202 ];
+    license = lib.licenses.lgpl3;
+    platforms = lib.platforms.linux;
+    maintainers = [ lib.maintainers.nico202 ];
   };
 }
diff --git a/pkgs/development/libraries/scmccid/default.nix b/pkgs/development/libraries/scmccid/default.nix
index 0d980d9d1a2b4..0fcb4884de5cb 100644
--- a/pkgs/development/libraries/scmccid/default.nix
+++ b/pkgs/development/libraries/scmccid/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, patchelf, libusb-compat-0_1}:
+{lib, stdenv, fetchurl, patchelf, libusb-compat-0_1}:
 
 assert stdenv ? cc && stdenv.cc.libc != null;
 
@@ -33,8 +33,8 @@ stdenv.mkDerivation {
   meta = {
     homepage = "http://www.scmmicro.com/support/pc-security-support/downloads.html";
     description = "PCSC drivers for linux, for the SCM SCR3310 v2.0 card and others";
-    license = stdenv.lib.licenses.unfree;
-    maintainers = with stdenv.lib.maintainers; [viric];
-    platforms = with stdenv.lib.platforms; linux;
+    license = lib.licenses.unfree;
+    maintainers = with lib.maintainers; [viric];
+    platforms = with lib.platforms; linux;
   };
 }
diff --git a/pkgs/development/libraries/scriptaculous/default.nix b/pkgs/development/libraries/scriptaculous/default.nix
index f4e5ae378928f..c2beda45ab3ae 100644
--- a/pkgs/development/libraries/scriptaculous/default.nix
+++ b/pkgs/development/libraries/scriptaculous/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, unzip, ... }: stdenv.mkDerivation rec {
+{ lib, stdenv, fetchurl, unzip, ... }: stdenv.mkDerivation rec {
   pname = "scriptaculous";
   version = "1.9.0";
 
@@ -14,7 +14,7 @@
     cp src/*.js $out
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A set of JavaScript libraries to enhance the user interface of web sites";
     longDescription = ''
       script.aculo.us provides you with
diff --git a/pkgs/development/libraries/seasocks/default.nix b/pkgs/development/libraries/seasocks/default.nix
index 241046b09fe8b..8c5b4e87d9bbf 100644
--- a/pkgs/development/libraries/seasocks/default.nix
+++ b/pkgs/development/libraries/seasocks/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, python, zlib }:
+{ lib, stdenv, fetchFromGitHub, cmake, python, zlib }:
 
 stdenv.mkDerivation rec {
   pname = "seasocks";
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ cmake ];
   buildInputs = [ zlib python ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/mattgodbolt/seasocks";
     description = "Tiny embeddable C++ HTTP and WebSocket server";
     license = licenses.bsd2;
diff --git a/pkgs/development/libraries/sentencepiece/default.nix b/pkgs/development/libraries/sentencepiece/default.nix
index da1749e4785d5..8ab0f8ef69a62 100644
--- a/pkgs/development/libraries/sentencepiece/default.nix
+++ b/pkgs/development/libraries/sentencepiece/default.nix
@@ -24,7 +24,7 @@ stdenv.mkDerivation rec {
 
   outputs = [ "bin" "dev" "out" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/google/sentencepiece";
     description = "Unsupervised text tokenizer for Neural Network-based text generation";
     license = licenses.asl20;
diff --git a/pkgs/development/libraries/serd/default.nix b/pkgs/development/libraries/serd/default.nix
index bf8c596a7957e..641a5120e8d96 100644
--- a/pkgs/development/libraries/serd/default.nix
+++ b/pkgs/development/libraries/serd/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, python3, wafHook }:
+{ lib, stdenv, fetchurl, pkg-config, python3, wafHook }:
 
 stdenv.mkDerivation rec {
   pname = "serd";
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ pkg-config python3 wafHook ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://drobilla.net/software/serd";
     description = "A lightweight C library for RDF syntax which supports reading and writing Turtle and NTriples";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/serf/default.nix b/pkgs/development/libraries/serf/default.nix
index c83ecaca7c0ee..dbdc9ce287143 100644
--- a/pkgs/development/libraries/serf/default.nix
+++ b/pkgs/development/libraries/serf/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, apr, sconsPackages, openssl, aprutil, zlib, kerberos
+{ lib, stdenv, fetchurl, apr, sconsPackages, openssl, aprutil, zlib, kerberos
 , pkg-config, libiconv }:
 
 stdenv.mkDerivation rec {
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ pkg-config sconsPackages.scons_3_1_2 ];
   buildInputs = [ apr openssl aprutil zlib libiconv ]
-    ++ stdenv.lib.optional (!stdenv.isCygwin) kerberos;
+    ++ lib.optional (!stdenv.isCygwin) kerberos;
 
   patches = [ ./scons.patch ];
 
@@ -23,13 +23,13 @@ stdenv.mkDerivation rec {
     sconsFlags+=" CC=$CC"
     sconsFlags+=" OPENSSL=${openssl}"
     sconsFlags+=" ZLIB=${zlib}"
-  '' + stdenv.lib.optionalString (!stdenv.isCygwin) ''
+  '' + lib.optionalString (!stdenv.isCygwin) ''
     sconsFlags+=" GSSAPI=${kerberos.dev}"
   '';
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "HTTP client library based on APR";
     license = licenses.asl20;
     maintainers = with maintainers; [ orivej raskin ];
diff --git a/pkgs/development/libraries/serialdv/default.nix b/pkgs/development/libraries/serialdv/default.nix
index 47d4e68f65895..d1d9c6299b357 100644
--- a/pkgs/development/libraries/serialdv/default.nix
+++ b/pkgs/development/libraries/serialdv/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake }:
+{ lib, stdenv, fetchFromGitHub, cmake }:
 
 stdenv.mkDerivation rec {
   pname = "serialdv";
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ cmake ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "C++ Minimal interface to encode and decode audio with AMBE3000 based devices in packet mode over a serial link";
     homepage = "https://github.com/f4exb/serialdv";
     platforms = platforms.linux;
diff --git a/pkgs/development/libraries/sfml/default.nix b/pkgs/development/libraries/sfml/default.nix
index 7b5e1dcdb2b40..c9a326afa7fea 100644
--- a/pkgs/development/libraries/sfml/default.nix
+++ b/pkgs/development/libraries/sfml/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchzip, cmake, libX11, freetype, libjpeg, openal, flac, libvorbis
+{ lib, stdenv, fetchzip, cmake, libX11, freetype, libjpeg, openal, flac, libvorbis
 , glew, libXrandr, libXrender, udev, xcbutilimage
 , IOKit, Foundation, AppKit, OpenAL
 }:
@@ -18,16 +18,16 @@ stdenv.mkDerivation {
 
   nativeBuildInputs = [ cmake ];
   buildInputs = [ freetype libjpeg openal flac libvorbis glew ]
-    ++ stdenv.lib.optional stdenv.isLinux udev
-    ++ stdenv.lib.optionals (!stdenv.isDarwin) [ libX11 libXrandr libXrender xcbutilimage ]
-    ++ stdenv.lib.optionals stdenv.isDarwin [ IOKit Foundation AppKit OpenAL ];
+    ++ lib.optional stdenv.isLinux udev
+    ++ lib.optionals (!stdenv.isDarwin) [ libX11 libXrandr libXrender xcbutilimage ]
+    ++ lib.optionals stdenv.isDarwin [ IOKit Foundation AppKit OpenAL ];
 
   cmakeFlags = [ "-DSFML_INSTALL_PKGCONFIG_FILES=yes"
                  "-DSFML_MISC_INSTALL_PREFIX=share/SFML"
                  "-DSFML_BUILD_FRAMEWORKS=no"
                  "-DSFML_USE_SYSTEM_DEPS=yes" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://www.sfml-dev.org/";
     description = "Simple and fast multimedia library";
     longDescription = ''
diff --git a/pkgs/development/libraries/sfsexp/default.nix b/pkgs/development/libraries/sfsexp/default.nix
index 40009a8b7c36b..7c3fbb9f39e49 100644
--- a/pkgs/development/libraries/sfsexp/default.nix
+++ b/pkgs/development/libraries/sfsexp/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
   pname = "sfsexp";
@@ -9,7 +9,7 @@ stdenv.mkDerivation rec {
     sha256 = "18gdwxjja0ip378hlzs8sp7q2g6hrmy7x10yf2wnxfmmylbpqn8k";
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Small, fast s-expression library";
     homepage = "http://sexpr.sourceforge.net/";
     maintainers = with maintainers; [ jb55 ];
diff --git a/pkgs/development/libraries/shapelib/default.nix b/pkgs/development/libraries/shapelib/default.nix
index 8fd4987ac70cc..abb27a132c232 100644
--- a/pkgs/development/libraries/shapelib/default.nix
+++ b/pkgs/development/libraries/shapelib/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
   name = "shapelib-1.5.0";
@@ -8,7 +8,7 @@ stdenv.mkDerivation rec {
     sha256 = "1qfsgb8b3yiqwvr6h9m81g6k9fjhfys70c22p7kzkbick20a9h0z";
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "C Library for reading, writing and updating ESRI Shapefiles";
     homepage = "http://shapelib.maptools.org/";
     license = licenses.gpl2;
diff --git a/pkgs/development/libraries/shhmsg/default.nix b/pkgs/development/libraries/shhmsg/default.nix
index 04b764afc946a..0c736e4cb9118 100644
--- a/pkgs/development/libraries/shhmsg/default.nix
+++ b/pkgs/development/libraries/shhmsg/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
   name = "shhmsg-1.4.2";
@@ -10,7 +10,7 @@ stdenv.mkDerivation rec {
 
   installFlags = [ "INSTBASEDIR=$(out)" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A library for displaying messages";
     homepage = "https://shh.thathost.com/pub-unix/";
     license = licenses.artistic1;
diff --git a/pkgs/development/libraries/shhopt/default.nix b/pkgs/development/libraries/shhopt/default.nix
index 45ec31ca4dff4..da1b820fcd543 100644
--- a/pkgs/development/libraries/shhopt/default.nix
+++ b/pkgs/development/libraries/shhopt/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
   name = "shhopt-1.1.7";
@@ -10,7 +10,7 @@ stdenv.mkDerivation rec {
 
   installFlags = [ "INSTBASEDIR=$(out)" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A library for parsing command line options";
     homepage = "https://shh.thathost.com/pub-unix/";
     license = licenses.artistic1;
diff --git a/pkgs/development/libraries/shibboleth-sp/default.nix b/pkgs/development/libraries/shibboleth-sp/default.nix
index d6065c925e87e..f3b80c0b548f9 100644
--- a/pkgs/development/libraries/shibboleth-sp/default.nix
+++ b/pkgs/development/libraries/shibboleth-sp/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchgit, autoreconfHook, boost, fcgi, openssl, opensaml-cpp, log4shib, pkg-config, xercesc, xml-security-c, xml-tooling-c }:
+{ lib, stdenv, fetchgit, autoreconfHook, boost, fcgi, openssl, opensaml-cpp, log4shib, pkg-config, xercesc, xml-security-c, xml-tooling-c }:
 
 stdenv.mkDerivation rec {
   pname = "shibboleth-sp";
@@ -22,7 +22,7 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage    = "https://shibboleth.net/products/service-provider.html";
     description = "Enables SSO and Federation web applications written with any programming language or framework";
     platforms   = platforms.unix;
diff --git a/pkgs/development/libraries/silgraphite/default.nix b/pkgs/development/libraries/silgraphite/default.nix
index 77090a19ba365..06cf75876162e 100644
--- a/pkgs/development/libraries/silgraphite/default.nix
+++ b/pkgs/development/libraries/silgraphite/default.nix
@@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
 
   meta = {
     description = "An advanced font engine";
-    maintainers = [ stdenv.lib.maintainers.raskin ];
-    platforms = stdenv.lib.platforms.linux;
+    maintainers = [ lib.maintainers.raskin ];
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/development/libraries/silgraphite/graphite2.nix b/pkgs/development/libraries/silgraphite/graphite2.nix
index 60c454bc14598..166d0f2911d6f 100644
--- a/pkgs/development/libraries/silgraphite/graphite2.nix
+++ b/pkgs/development/libraries/silgraphite/graphite2.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, freetype, cmake, python }:
+{ lib, stdenv, fetchurl, pkg-config, freetype, cmake, python }:
 
 stdenv.mkDerivation rec {
   version = "1.3.14";
@@ -13,12 +13,12 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ pkg-config cmake ];
   buildInputs = [ freetype ];
 
-  patches = stdenv.lib.optionals stdenv.isDarwin [ ./macosx.patch ];
+  patches = lib.optionals stdenv.isDarwin [ ./macosx.patch ];
 
   checkInputs = [ python ];
   doCheck = false; # fails, probably missing something
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "An advanced font engine";
     maintainers = [ maintainers.raskin ];
     platforms = platforms.unix;
diff --git a/pkgs/development/libraries/simdjson/default.nix b/pkgs/development/libraries/simdjson/default.nix
index 63ad97cbe2bfe..3a7734b1d5194 100644
--- a/pkgs/development/libraries/simdjson/default.nix
+++ b/pkgs/development/libraries/simdjson/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake }:
+{ lib, stdenv, fetchFromGitHub, cmake }:
 
 stdenv.mkDerivation rec {
   pname = "simdjson";
@@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
     "-DSIMDJSON_JUST_LIBRARY=ON"
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://simdjson.org/";
     description = "Parsing gigabytes of JSON per second";
     license = licenses.asl20;
diff --git a/pkgs/development/libraries/simgear/default.nix b/pkgs/development/libraries/simgear/default.nix
index da25305fc4210..2f1006404b7a1 100644
--- a/pkgs/development/libraries/simgear/default.nix
+++ b/pkgs/development/libraries/simgear/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, plib, freeglut, xorgproto, libX11, libXext, libXi
+{ lib, stdenv, fetchurl, plib, freeglut, xorgproto, libX11, libXext, libXi
 , libICE, libSM, libXt, libXmu, libGLU, libGL, boost, zlib, libjpeg, freealut
 , openscenegraph, openal, expat, cmake, apr
 , curl
@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
                   libICE libSM libXt libXmu libGLU libGL boost zlib libjpeg freealut
                   openscenegraph openal expat apr curl ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Simulation construction toolkit";
     homepage = "https://gitorious.org/fg/simgear";
     maintainers = with maintainers; [ raskin ];
diff --git a/pkgs/development/libraries/simpleitk/default.nix b/pkgs/development/libraries/simpleitk/default.nix
index e6b013aa13704..2ae8b28b64f23 100644
--- a/pkgs/development/libraries/simpleitk/default.nix
+++ b/pkgs/development/libraries/simpleitk/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, swig, lua, itk }:
+{ lib, stdenv, fetchFromGitHub, cmake, swig, lua, itk }:
 
 stdenv.mkDerivation rec {
   pname = "simpleitk";
@@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
   # 2.0.0: linker error building examples
   cmakeFlags = [ "-DBUILD_EXAMPLES=OFF" "-DBUILD_SHARED_LIBS=ON" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://www.simpleitk.org";
     description = "Simplified interface to ITK";
     maintainers = with maintainers; [ bcdarwin ];
diff --git a/pkgs/development/libraries/slang/default.nix b/pkgs/development/libraries/slang/default.nix
index 010590b0fcd95..a3db5ce0d3bef 100644
--- a/pkgs/development/libraries/slang/default.nix
+++ b/pkgs/development/libraries/slang/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl
+{ lib, stdenv, fetchurl
 , libiconv
 , libpng
 , ncurses
@@ -40,7 +40,7 @@ stdenv.mkDerivation rec {
     pcre
     readline
     zlib
-  ] ++ stdenv.lib.optionals (stdenv.isDarwin) [ libiconv ];
+  ] ++ lib.optionals (stdenv.isDarwin) [ libiconv ];
 
   propagatedBuildInputs = [ ncurses ];
 
@@ -52,7 +52,7 @@ stdenv.mkDerivation rec {
     sed '/^Libs:/s/$/ -lncurses/' -i "$dev"/lib/pkgconfig/slang.pc
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A small, embeddable multi-platform programming library";
     longDescription = ''
       S-Lang is an interpreted language that was designed from the start to be
diff --git a/pkgs/development/libraries/slib/default.nix b/pkgs/development/libraries/slib/default.nix
index 401564342b598..47f633f5096b3 100644
--- a/pkgs/development/libraries/slib/default.nix
+++ b/pkgs/development/libraries/slib/default.nix
@@ -1,4 +1,4 @@
-{ fetchurl, stdenv, unzip, scheme, texinfo }:
+{ fetchurl, lib, stdenv, unzip, scheme, texinfo }:
 
 stdenv.mkDerivation rec {
   name = "slib-3b5";
@@ -42,11 +42,11 @@ stdenv.mkDerivation rec {
     '';
 
     # Public domain + permissive (non-copyleft) licensing of some files.
-    license = stdenv.lib.licenses.publicDomain;
+    license = lib.licenses.publicDomain;
 
     homepage = "http://people.csail.mit.edu/jaffer/SLIB";
 
     maintainers = [ ];
-    platforms = stdenv.lib.platforms.unix;
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/smarty3-i18n/default.nix b/pkgs/development/libraries/smarty3-i18n/default.nix
index d93a59efe6e7a..7fb6b1adb5a87 100644
--- a/pkgs/development/libraries/smarty3-i18n/default.nix
+++ b/pkgs/development/libraries/smarty3-i18n/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, ... }: stdenv.mkDerivation rec {
+{ lib, stdenv, fetchFromGitHub, ... }: stdenv.mkDerivation rec {
   pname = "smarty-i18n";
   version = "1.0";
 
@@ -14,7 +14,7 @@
     cp block.t.php $out
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "gettext for the smarty3 framework";
     license = licenses.lgpl21;
     homepage = "https://github.com/kikimosha/smarty3-i18n";
diff --git a/pkgs/development/libraries/smarty3/default.nix b/pkgs/development/libraries/smarty3/default.nix
index d5708cb6b1e87..2070a3bab7903 100644
--- a/pkgs/development/libraries/smarty3/default.nix
+++ b/pkgs/development/libraries/smarty3/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, ... }: stdenv.mkDerivation rec {
+{ lib, stdenv, fetchFromGitHub, ... }: stdenv.mkDerivation rec {
   pname = "smarty3";
   version = "3.1.36";
 
@@ -14,7 +14,7 @@
     cp -r libs/* $out
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Smarty 3 template engine";
     longDescription = ''
       Smarty is a template engine for PHP, facilitating the
diff --git a/pkgs/development/libraries/smesh/default.nix b/pkgs/development/libraries/smesh/default.nix
index 1b1f590109fd3..8494799333be7 100644
--- a/pkgs/development/libraries/smesh/default.nix
+++ b/pkgs/development/libraries/smesh/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, fetchpatch, cmake, ninja, opencascade
+{ lib, stdenv, fetchFromGitHub, fetchpatch, cmake, ninja, opencascade
 , Cocoa }:
 
 stdenv.mkDerivation rec {
@@ -21,9 +21,9 @@ stdenv.mkDerivation rec {
   ];
 
   nativeBuildInputs = [ cmake ninja ];
-  buildInputs = [ opencascade ] ++ stdenv.lib.optionals stdenv.isDarwin [ Cocoa ];
+  buildInputs = [ opencascade ] ++ lib.optionals stdenv.isDarwin [ Cocoa ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Extension to OCE providing advanced meshing features";
     homepage = "https://github.com/tpaviot/smesh";
     license = licenses.lgpl21;
diff --git a/pkgs/development/libraries/smpeg/default.nix b/pkgs/development/libraries/smpeg/default.nix
index 335712ac35a1e..83b4b2193c030 100644
--- a/pkgs/development/libraries/smpeg/default.nix
+++ b/pkgs/development/libraries/smpeg/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchsvn, SDL, autoconf, automake, libtool, gtk2, m4, pkg-config, libGLU, libGL, makeWrapper }:
+{ lib, stdenv, fetchsvn, SDL, autoconf, automake, libtool, gtk2, m4, pkg-config, libGLU, libGL, makeWrapper }:
 
 stdenv.mkDerivation rec {
   name = "smpeg-svn${version}";
@@ -45,7 +45,7 @@ stdenv.mkDerivation rec {
   meta = {
     homepage = "http://icculus.org/smpeg/";
     description = "MPEG decoding library";
-    license = stdenv.lib.licenses.gpl2Plus;
-    platforms = stdenv.lib.platforms.unix;
+    license = lib.licenses.gpl2Plus;
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/smpeg2/default.nix b/pkgs/development/libraries/smpeg2/default.nix
index 270e418174e4b..d57cc91f26e28 100644
--- a/pkgs/development/libraries/smpeg2/default.nix
+++ b/pkgs/development/libraries/smpeg2/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , autoconf
 , automake
 , darwin
@@ -25,7 +25,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ autoconf automake makeWrapper pkg-config ];
 
   buildInputs = [ SDL2 ]
-    ++ stdenv.lib.optional stdenv.isDarwin darwin.libobjc;
+    ++ lib.optional stdenv.isDarwin darwin.libobjc;
 
   preConfigure = ''
     sh autogen.sh
@@ -39,7 +39,7 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://icculus.org/smpeg/";
     description = "SDL2 MPEG Player Library";
     license = licenses.lgpl2;
diff --git a/pkgs/development/libraries/snack/default.nix b/pkgs/development/libraries/snack/default.nix
index e9af9f6d5374e..4948e481ff581 100644
--- a/pkgs/development/libraries/snack/default.nix
+++ b/pkgs/development/libraries/snack/default.nix
@@ -1,6 +1,6 @@
 # alsaLib vorbis-tools python can be made optional
 
-{ stdenv, fetchurl, python, tcl, tk, vorbis-tools, pkg-config, xlibsWrapper }:
+{ lib, stdenv, fetchurl, python, tcl, tk, vorbis-tools, pkg-config, xlibsWrapper }:
 
 stdenv.mkDerivation {
   name = "snack-2.2.10";
@@ -29,7 +29,7 @@ stdenv.mkDerivation {
   meta = {
     description = "The Snack Sound Toolkit (Tcl)";
     homepage = "http://www.speech.kth.se/snack/";
-    license = stdenv.lib.licenses.gpl2;
+    license = lib.licenses.gpl2;
     broken = true;
   };
 }
diff --git a/pkgs/development/libraries/snappy/default.nix b/pkgs/development/libraries/snappy/default.nix
index 0880df7ef2f04..ece425e85c417 100644
--- a/pkgs/development/libraries/snappy/default.nix
+++ b/pkgs/development/libraries/snappy/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake
+{ lib, stdenv, fetchFromGitHub, cmake
 , static ? stdenv.hostPlatform.isStatic
 }:
 
@@ -33,7 +33,7 @@ stdenv.mkDerivation rec {
 
   doCheck = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://google.github.io/snappy/";
     license = licenses.bsd3;
     description = "Compression/decompression library for very high speeds";
diff --git a/pkgs/development/libraries/soci/default.nix b/pkgs/development/libraries/soci/default.nix
index 1f9b77cc3c920..f561864a7502c 100644
--- a/pkgs/development/libraries/soci/default.nix
+++ b/pkgs/development/libraries/soci/default.nix
@@ -1,7 +1,7 @@
 { cmake
 , fetchFromGitHub
 , sqlite
-, stdenv
+, lib, stdenv
 }:
 
 stdenv.mkDerivation rec {
@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ cmake ];
   buildInputs = [ sqlite ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Database access library for C++";
     homepage = "http://soci.sourceforge.net/";
     license = licenses.boost;
diff --git a/pkgs/development/libraries/socket_wrapper/default.nix b/pkgs/development/libraries/socket_wrapper/default.nix
index d00af92335d7a..e1ba9dbc1e619 100644
--- a/pkgs/development/libraries/socket_wrapper/default.nix
+++ b/pkgs/development/libraries/socket_wrapper/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, cmake, pkg-config }:
+{ lib, stdenv, fetchurl, cmake, pkg-config }:
 
 stdenv.mkDerivation rec {
   name = "socket_wrapper-1.2.5";
@@ -10,7 +10,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ cmake pkg-config ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A library passing all socket communications through unix sockets";
     homepage = "https://git.samba.org/?p=socket_wrapper.git;a=summary;";
     license = licenses.bsd3;
diff --git a/pkgs/development/libraries/sofia-sip/default.nix b/pkgs/development/libraries/sofia-sip/default.nix
index 8e38b96048047..1395f3e60cf80 100644
--- a/pkgs/development/libraries/sofia-sip/default.nix
+++ b/pkgs/development/libraries/sofia-sip/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, glib, openssl, pkg-config, autoreconfHook }:
+{ lib, stdenv, fetchFromGitHub, glib, openssl, pkg-config, autoreconfHook }:
 
 stdenv.mkDerivation rec {
   pname = "sofia-sip";
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
   buildInputs = [ glib openssl ];
   nativeBuildInputs = [ autoreconfHook pkg-config ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Open-source SIP User-Agent library, compliant with the IETF RFC3261 specification";
     homepage = "https://github.com/freeswitch/sofia-sip";
     platforms = platforms.linux;
diff --git a/pkgs/development/libraries/sonic/default.nix b/pkgs/development/libraries/sonic/default.nix
index fc45e220a51c1..38dcee84a928f 100644
--- a/pkgs/development/libraries/sonic/default.nix
+++ b/pkgs/development/libraries/sonic/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, fftw, installShellFiles }:
+{ lib, stdenv, fetchFromGitHub, fftw, installShellFiles }:
 
 stdenv.mkDerivation {
   pname = "sonic-unstable";
@@ -19,11 +19,11 @@ stdenv.mkDerivation {
 
   postInstall = ''
     installManPage sonic.1
-  '' + stdenv.lib.optionalString stdenv.isDarwin ''
+  '' + lib.optionalString stdenv.isDarwin ''
     install_name_tool -id $out/lib/libsonic.so.0.3.0 $out/lib/libsonic.so.0.3.0
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Simple library to speed up or slow down speech";
     homepage = "https://github.com/waywardgeek/sonic";
     license = licenses.asl20;
diff --git a/pkgs/development/libraries/soprano/default.nix b/pkgs/development/libraries/soprano/default.nix
index 861e1d76c1d49..c9debd36110e3 100644
--- a/pkgs/development/libraries/soprano/default.nix
+++ b/pkgs/development/libraries/soprano/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, cmake, qt4, clucene_core, librdf_redland, libiodbc
+{ lib, stdenv, fetchurl, cmake, qt4, clucene_core, librdf_redland, libiodbc
 , pkg-config }:
 
 stdenv.mkDerivation rec {
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
     homepage = "http://soprano.sourceforge.net/";
     description = "An object-oriented C++/Qt4 framework for RDF data";
     license = "LGPL";
-    maintainers = with stdenv.lib.maintainers; [ sander ];
+    maintainers = with lib.maintainers; [ sander ];
     inherit (qt4.meta) platforms;
   };
 }
diff --git a/pkgs/development/libraries/soqt/default.nix b/pkgs/development/libraries/soqt/default.nix
index fba7dd806426f..2be6c66214546 100644
--- a/pkgs/development/libraries/soqt/default.nix
+++ b/pkgs/development/libraries/soqt/default.nix
@@ -1,4 +1,4 @@
-{ fetchFromGitHub, stdenv, coin3d, qtbase, cmake, pkg-config }:
+{ fetchFromGitHub, lib, stdenv, coin3d, qtbase, cmake, pkg-config }:
 
 stdenv.mkDerivation rec {
   pname = "soqt";
@@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ cmake pkg-config ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/coin3d/soqt";
     license = licenses.bsd3;
     description = "Glue between Coin high-level 3D visualization library and Qt";
diff --git a/pkgs/development/libraries/sord/default.nix b/pkgs/development/libraries/sord/default.nix
index 66803a066b568..befe6a34cd1c7 100644
--- a/pkgs/development/libraries/sord/default.nix
+++ b/pkgs/development/libraries/sord/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, python3, serd, pcre, wafHook }:
+{ lib, stdenv, fetchurl, pkg-config, python3, serd, pcre, wafHook }:
 
 stdenv.mkDerivation rec {
   pname = "sord";
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
   buildInputs = [ pcre ];
   propagatedBuildInputs = [ serd ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://drobilla.net/software/sord";
     description = "A lightweight C library for storing RDF data in memory";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/soxt/default.nix b/pkgs/development/libraries/soxt/default.nix
index fe0d93344c0e2..5ea23aae8791f 100644
--- a/pkgs/development/libraries/soxt/default.nix
+++ b/pkgs/development/libraries/soxt/default.nix
@@ -1,4 +1,4 @@
-{ fetchhg, stdenv, cmake, coin3d, motif, xlibsWrapper, libXmu, libGLU, libGL }:
+{ fetchhg, lib, stdenv, cmake, coin3d, motif, xlibsWrapper, libXmu, libGLU, libGL }:
 
 stdenv.mkDerivation {
   pname = "soxt";
@@ -14,7 +14,7 @@ stdenv.mkDerivation {
   nativeBuildInputs = [ cmake ];
   buildInputs = [ coin3d motif xlibsWrapper libGLU libGL libXmu ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://bitbucket.org/Coin3D/coin/wiki/Home";
     license = licenses.bsd3;
     description = "A GUI binding for using Open Inventor with Xt/Motif";
diff --git a/pkgs/development/libraries/spandsp/3.nix b/pkgs/development/libraries/spandsp/3.nix
index ac587f0492b0a..b3522afdf8604 100644
--- a/pkgs/development/libraries/spandsp/3.nix
+++ b/pkgs/development/libraries/spandsp/3.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, audiofile, libtiff, autoreconfHook }:
+{ lib, stdenv, fetchFromGitHub, audiofile, libtiff, autoreconfHook }:
 stdenv.mkDerivation rec {
   version = "3.0.0";
   pname = "spandsp";
@@ -17,8 +17,8 @@ stdenv.mkDerivation rec {
   meta = {
     description = "A portable and modular SIP User-Agent with audio and video support";
     homepage = "https://github.com/freeswitch/spandsp";
-    platforms = with stdenv.lib.platforms; linux;
-    maintainers = with stdenv.lib.maintainers; [ ajs124 ];
-    license = stdenv.lib.licenses.gpl2;
+    platforms = with lib.platforms; linux;
+    maintainers = with lib.maintainers; [ ajs124 ];
+    license = lib.licenses.gpl2;
   };
 }
diff --git a/pkgs/development/libraries/spandsp/default.nix b/pkgs/development/libraries/spandsp/default.nix
index 1f9834c08f473..85a3059f27bcf 100644
--- a/pkgs/development/libraries/spandsp/default.nix
+++ b/pkgs/development/libraries/spandsp/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, audiofile, libtiff}:
+{lib, stdenv, fetchurl, audiofile, libtiff}:
 stdenv.mkDerivation rec {
   version = "0.0.6";
   pname = "spandsp";
@@ -13,9 +13,9 @@ stdenv.mkDerivation rec {
   meta = {
     description = "A portable and modular SIP User-Agent with audio and video support";
     homepage = "http://www.creytiv.com/baresip.html";
-    platforms = with stdenv.lib.platforms; linux;
-    maintainers = with stdenv.lib.maintainers; [raskin];
-    license = stdenv.lib.licenses.gpl2;
+    platforms = with lib.platforms; linux;
+    maintainers = with lib.maintainers; [raskin];
+    license = lib.licenses.gpl2;
     downloadPage = "http://www.soft-switch.org/downloads/spandsp/";
     inherit version;
     updateWalker = true;
diff --git a/pkgs/development/libraries/sparsehash/default.nix b/pkgs/development/libraries/sparsehash/default.nix
index 6007560a11ff7..41b765bcb07df 100644
--- a/pkgs/development/libraries/sparsehash/default.nix
+++ b/pkgs/development/libraries/sparsehash/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub }:
+{ lib, stdenv, fetchFromGitHub }:
 
 stdenv.mkDerivation rec {
   name = "sparsehash-2.0.4";
@@ -10,7 +10,7 @@ stdenv.mkDerivation rec {
     sha256 = "1pf1cjvcjdmb9cd6gcazz64x0cd2ndpwh6ql2hqpypjv725xwxy7";
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/sparsehash/sparsehash";
     description = "An extremely memory-efficient hash_map implementation";
     platforms = platforms.all;
diff --git a/pkgs/development/libraries/spatialite-tools/default.nix b/pkgs/development/libraries/spatialite-tools/default.nix
index 2e6a7ff219989..ffded04510b49 100644
--- a/pkgs/development/libraries/spatialite-tools/default.nix
+++ b/pkgs/development/libraries/spatialite-tools/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, sqlite, expat, zlib, proj, geos, libspatialite, readosm }:
+{ lib, stdenv, fetchurl, pkg-config, sqlite, expat, zlib, proj, geos, libspatialite, readosm }:
 
 stdenv.mkDerivation rec {
   name = "spatialite-tools-4.1.1";
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
   meta = {
     description = "A complete sqlite3-compatible CLI front-end for libspatialite";
     homepage = "https://www.gaia-gis.it/fossil/spatialite-tools";
-    license = with stdenv.lib.licenses; [ mpl11 gpl2Plus lgpl21Plus ];
-    platforms = stdenv.lib.platforms.linux;
+    license = with lib.licenses; [ mpl11 gpl2Plus lgpl21Plus ];
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/development/libraries/spdk/default.nix b/pkgs/development/libraries/spdk/default.nix
index 1b5abe16f370d..a0c875079c442 100644
--- a/pkgs/development/libraries/spdk/default.nix
+++ b/pkgs/development/libraries/spdk/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , fetchFromGitHub
 , fetchpatch
@@ -57,7 +57,7 @@ in stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Set of libraries for fast user-mode storage";
     homepage = "https://spdk.io/";
     license = licenses.bsd3;
diff --git a/pkgs/development/libraries/spdlog/default.nix b/pkgs/development/libraries/spdlog/default.nix
index fbe7af1825ed8..1bd73990443e2 100644
--- a/pkgs/development/libraries/spdlog/default.nix
+++ b/pkgs/development/libraries/spdlog/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, fmt }:
+{ lib, stdenv, fetchFromGitHub, cmake, fmt }:
 
 let
   generic = { version, sha256 }:
@@ -34,7 +34,7 @@ let
       doCheck = true;
       preCheck = "export LD_LIBRARY_PATH=$(pwd):$LD_LIBRARY_PATH";
 
-      meta = with stdenv.lib; {
+      meta = with lib; {
         description    = "Very fast, header only, C++ logging library";
         homepage       = "https://github.com/gabime/spdlog";
         license        = licenses.mit;
diff --git a/pkgs/development/libraries/speech-tools/default.nix b/pkgs/development/libraries/speech-tools/default.nix
index 771ad033ed915..c54b4a3721f62 100644
--- a/pkgs/development/libraries/speech-tools/default.nix
+++ b/pkgs/development/libraries/speech-tools/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, alsaLib, ncurses }:
+{ lib, stdenv, fetchurl, alsaLib, ncurses }:
 
 stdenv.mkDerivation rec {
   name = "speech_tools-${version}.0";
@@ -34,7 +34,7 @@ stdenv.mkDerivation rec {
 
   checkTarget = "test";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Text-to-speech engine";
     maintainers = with maintainers; [ raskin ];
     platforms = platforms.linux;
diff --git a/pkgs/development/libraries/speechd/default.nix b/pkgs/development/libraries/speechd/default.nix
index a3c0f7b2ad8a8..6e8e6948af058 100644
--- a/pkgs/development/libraries/speechd/default.nix
+++ b/pkgs/development/libraries/speechd/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , substituteAll
 , pkg-config
 , fetchurl
@@ -24,7 +24,7 @@
 }:
 
 let
-  inherit (stdenv.lib) optional optionals;
+  inherit (lib) optional optionals;
   inherit (python3Packages) python pyxdg wrapPython;
 
   # speechd hard-codes espeak, even when built without support for it.
@@ -110,7 +110,7 @@ in stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Common interface to speech synthesis";
     homepage = "https://devel.freebsoft.org/speechd";
     license = licenses.gpl2Plus;
diff --git a/pkgs/development/libraries/speex/default.nix b/pkgs/development/libraries/speex/default.nix
index cd48a591307d7..9633f435fb8ec 100644
--- a/pkgs/development/libraries/speex/default.nix
+++ b/pkgs/development/libraries/speex/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, autoreconfHook, pkg-config, fftw, speexdsp }:
+{ lib, stdenv, fetchurl, autoreconfHook, pkg-config, fftw, speexdsp }:
 
 stdenv.mkDerivation rec {
   name = "speex-1.2.0";
@@ -24,7 +24,7 @@ stdenv.mkDerivation rec {
     "--with-fft=gpl-fftw3"
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://www.speex.org/";
     description = "An Open Source/Free Software patent-free audio compression format designed for speech";
     license = licenses.bsd3;
diff --git a/pkgs/development/libraries/speexdsp/default.nix b/pkgs/development/libraries/speexdsp/default.nix
index 75d8b7fbc93e6..f87d79ca6e481 100644
--- a/pkgs/development/libraries/speexdsp/default.nix
+++ b/pkgs/development/libraries/speexdsp/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, autoreconfHook, pkg-config, fftw }:
+{ lib, stdenv, fetchurl, autoreconfHook, pkg-config, fftw }:
 
 stdenv.mkDerivation rec {
   name = "speexdsp-1.2.0";
@@ -18,9 +18,9 @@ stdenv.mkDerivation rec {
 
   configureFlags = [
     "--with-fft=gpl-fftw3"
-  ] ++ stdenv.lib.optional stdenv.isAarch64 "--disable-neon";
+  ] ++ lib.optional stdenv.isAarch64 "--disable-neon";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://www.speex.org/";
     description = "An Open Source/Free Software patent-free audio compression format designed for speech";
     license = licenses.bsd3;
diff --git a/pkgs/development/libraries/sphinxbase/default.nix b/pkgs/development/libraries/sphinxbase/default.nix
index 40ef277268102..a7d59cd8bf6f0 100644
--- a/pkgs/development/libraries/sphinxbase/default.nix
+++ b/pkgs/development/libraries/sphinxbase/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , bison
 , pkg-config
@@ -21,12 +21,12 @@ stdenv.mkDerivation (rec {
   meta = {
     description = "Support Library for Pocketsphinx";
     homepage = "http://cmusphinx.sourceforge.net";
-    license = stdenv.lib.licenses.bsd2;
-    platforms = stdenv.lib.platforms.unix;
-    maintainers = with stdenv.lib.maintainers; [ ];
+    license = lib.licenses.bsd2;
+    platforms = lib.platforms.unix;
+    maintainers = with lib.maintainers; [ ];
   };
 
-} // (stdenv.lib.optionalAttrs multipleOutputs {
+} // (lib.optionalAttrs multipleOutputs {
   outputs = [ "out" "lib" "headers" ];
 
   postInstall = ''
diff --git a/pkgs/development/libraries/spice-gtk/default.nix b/pkgs/development/libraries/spice-gtk/default.nix
index 03066e8990c05..3d76e67f67ad1 100644
--- a/pkgs/development/libraries/spice-gtk/default.nix
+++ b/pkgs/development/libraries/spice-gtk/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , acl
 , cyrus_sasl
@@ -109,7 +109,7 @@ stdenv.mkDerivation rec {
     spice-protocol
     usbredir
     zlib
-  ] ++ stdenv.lib.optionals withPolkit [ polkit acl usbutils ] ;
+  ] ++ lib.optionals withPolkit [ polkit acl usbutils ] ;
 
   PKG_CONFIG_POLKIT_GOBJECT_1_POLICYDIR = "${placeholder "out"}/share/polkit-1/actions";
 
@@ -118,7 +118,7 @@ stdenv.mkDerivation rec {
     "-Dpulse=disabled" # is deprecated upstream
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "GTK 3 SPICE widget";
     longDescription = ''
       spice-gtk is a GTK 3 SPICE widget. It features glib-based
diff --git a/pkgs/development/libraries/spice-protocol/default.nix b/pkgs/development/libraries/spice-protocol/default.nix
index cae975b9a589b..07b670a2718fb 100644
--- a/pkgs/development/libraries/spice-protocol/default.nix
+++ b/pkgs/development/libraries/spice-protocol/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
   pname = "spice-protocol";
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
     ln -sv ../share/pkgconfig $out/lib/pkgconfig
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Protocol headers for the SPICE protocol";
     homepage = "https://www.spice-space.org/";
     license = licenses.bsd3;
diff --git a/pkgs/development/libraries/spice/default.nix b/pkgs/development/libraries/spice/default.nix
index 86aa56f6c30c7..584b1e15a8e33 100644
--- a/pkgs/development/libraries/spice/default.nix
+++ b/pkgs/development/libraries/spice/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , meson
 , ninja
@@ -85,7 +85,7 @@ stdenv.mkDerivation rec {
     ln -s spice-server $out/include/spice
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Complete open source solution for interaction with virtualized desktop devices";
     longDescription = ''
       The Spice project aims to provide a complete open source solution for interaction
diff --git a/pkgs/development/libraries/spirv-headers/default.nix b/pkgs/development/libraries/spirv-headers/default.nix
index 79b8e7c2dda11..9d464f7300ae9 100644
--- a/pkgs/development/libraries/spirv-headers/default.nix
+++ b/pkgs/development/libraries/spirv-headers/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake }:
+{ lib, stdenv, fetchFromGitHub, cmake }:
 
 stdenv.mkDerivation rec {
   pname = "spirv-headers";
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ cmake ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     inherit (src.meta) homepage;
     description = "Machine-readable components of the Khronos SPIR-V Registry";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/sqlcipher/default.nix b/pkgs/development/libraries/sqlcipher/default.nix
index f40c80391a236..cc5656dcc6430 100644
--- a/pkgs/development/libraries/sqlcipher/default.nix
+++ b/pkgs/development/libraries/sqlcipher/default.nix
@@ -28,7 +28,7 @@ stdenv.mkDerivation rec {
     installManPage sqlcipher.1
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://www.zetetic.net/sqlcipher/";
     description = "SQLite extension that provides 256 bit AES encryption of database files";
     platforms = platforms.unix;
diff --git a/pkgs/development/libraries/sqlite/default.nix b/pkgs/development/libraries/sqlite/default.nix
index f0bbc93a6f1d5..fe10e0fc7ae26 100644
--- a/pkgs/development/libraries/sqlite/default.nix
+++ b/pkgs/development/libraries/sqlite/default.nix
@@ -1,11 +1,11 @@
-{ stdenv, fetchurl, zlib, interactive ? false, readline ? null, ncurses ? null }:
+{ lib, stdenv, fetchurl, zlib, interactive ? false, readline ? null, ncurses ? null }:
 
 assert interactive -> readline != null && ncurses != null;
 
-with stdenv.lib;
+with lib;
 
 let
-  archiveVersion = import ./archive-version.nix stdenv.lib;
+  archiveVersion = import ./archive-version.nix lib;
 in
 
 stdenv.mkDerivation rec {
diff --git a/pkgs/development/libraries/sqlite/sqlar.nix b/pkgs/development/libraries/sqlite/sqlar.nix
index abfb688e46148..0828f2f455435 100644
--- a/pkgs/development/libraries/sqlite/sqlar.nix
+++ b/pkgs/development/libraries/sqlite/sqlar.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, fuse, zlib }:
+{ lib, stdenv, fetchurl, fuse, zlib }:
 
 stdenv.mkDerivation {
   pname = "sqlar";
@@ -17,7 +17,7 @@ stdenv.mkDerivation {
     install -D -t $out/bin sqlar sqlarfs
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://sqlite.org/sqlar";
     description = "SQLite Archive utilities";
     license = licenses.bsd2;
diff --git a/pkgs/development/libraries/sqlite/tools.nix b/pkgs/development/libraries/sqlite/tools.nix
index 0eb913adb3b98..3ec528719e9eb 100644
--- a/pkgs/development/libraries/sqlite/tools.nix
+++ b/pkgs/development/libraries/sqlite/tools.nix
@@ -1,7 +1,7 @@
-{ stdenv, fetchurl, unzip, sqlite, tcl, Foundation }:
+{ lib, stdenv, fetchurl, unzip, sqlite, tcl, Foundation }:
 
 let
-  archiveVersion = import ./archive-version.nix stdenv.lib;
+  archiveVersion = import ./archive-version.nix lib;
   mkTool = { pname, makeTarget, description, homepage }: stdenv.mkDerivation rec {
     inherit pname;
     version = "3.34.0";
@@ -12,13 +12,13 @@ let
     };
 
     nativeBuildInputs = [ unzip ];
-    buildInputs = [ tcl ] ++ stdenv.lib.optional stdenv.isDarwin Foundation;
+    buildInputs = [ tcl ] ++ lib.optional stdenv.isDarwin Foundation;
 
     makeFlags = [ makeTarget ];
 
     installPhase = "install -Dt $out/bin ${makeTarget}";
 
-    meta = with stdenv.lib; {
+    meta = with lib; {
       inherit description homepage;
       downloadPage = http://sqlite.org/download.html;
       license = licenses.publicDomain;
diff --git a/pkgs/development/libraries/srt/default.nix b/pkgs/development/libraries/srt/default.nix
index 6947c674a914e..c8d8fafbf3551 100644
--- a/pkgs/development/libraries/srt/default.nix
+++ b/pkgs/development/libraries/srt/default.nix
@@ -1,7 +1,7 @@
-{ stdenv, fetchFromGitHub, cmake, openssl
+{ lib, stdenv, fetchFromGitHub, cmake, openssl
 }:
 
-with stdenv.lib;
+with lib;
 stdenv.mkDerivation rec {
   pname = "srt";
   version = "1.4.2";
diff --git a/pkgs/development/libraries/srtp/default.nix b/pkgs/development/libraries/srtp/default.nix
index 7380838b78eaf..0dbfef2c6394f 100644
--- a/pkgs/development/libraries/srtp/default.nix
+++ b/pkgs/development/libraries/srtp/default.nix
@@ -1,8 +1,8 @@
-{ stdenv, fetchFromGitHub, pkg-config
+{ lib, stdenv, fetchFromGitHub, pkg-config
 , openssl ? null, libpcap ? null
 }:
 
-with stdenv.lib;
+with lib;
 stdenv.mkDerivation rec {
   pname = "libsrtp";
   version = "2.3.0";
diff --git a/pkgs/development/libraries/startup-notification/default.nix b/pkgs/development/libraries/startup-notification/default.nix
index ec9a18ef47690..f334bb2f35a43 100644
--- a/pkgs/development/libraries/startup-notification/default.nix
+++ b/pkgs/development/libraries/startup-notification/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, libX11, libxcb, pkg-config, xcbutil}:
+{lib, stdenv, fetchurl, libX11, libxcb, pkg-config, xcbutil}:
 
 let
   version = "0.12";
@@ -17,6 +17,6 @@ stdenv.mkDerivation {
   meta = {
     homepage = "http://www.freedesktop.org/software/startup-notification";
     description = "Application startup notification and feedback library";
-    license = stdenv.lib.licenses.lgpl2;
+    license = lib.licenses.lgpl2;
   };
 }
diff --git a/pkgs/development/libraries/stb/default.nix b/pkgs/development/libraries/stb/default.nix
index 8e57222ded0bd..a3020e14d3e14 100644
--- a/pkgs/development/libraries/stb/default.nix
+++ b/pkgs/development/libraries/stb/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub }:
+{ lib, stdenv, fetchFromGitHub }:
 
 stdenv.mkDerivation {
   pname = "stb";
@@ -18,7 +18,7 @@ stdenv.mkDerivation {
     cp *.h $out/include/stb/
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Single-file public domain libraries for C/C++";
     homepage = "https://github.com/nothings/stb";
     license = licenses.publicDomain;
diff --git a/pkgs/development/libraries/stellarsolver/default.nix b/pkgs/development/libraries/stellarsolver/default.nix
index 69417299615b3..8badf60d94216 100644
--- a/pkgs/development/libraries/stellarsolver/default.nix
+++ b/pkgs/development/libraries/stellarsolver/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, mkDerivation, fetchFromGitHub, cmake,
+{ lib, stdenv, mkDerivation, fetchFromGitHub, cmake,
   qtbase, cfitsio, gsl, wcslib, withTester ? false }:
 
 mkDerivation rec {
@@ -20,7 +20,7 @@ mkDerivation rec {
     "-DBUILD_TESTER=${if withTester then "on" else "off"}"
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/rlancaste/stellarsolver";
     description = "Astrometric plate solving library";
     license = licenses.gpl3Plus;
diff --git a/pkgs/development/libraries/stfl/default.nix b/pkgs/development/libraries/stfl/default.nix
index b0da3dbfa278b..20676c16b9c67 100644
--- a/pkgs/development/libraries/stfl/default.nix
+++ b/pkgs/development/libraries/stfl/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, ncurses, libiconv }:
+{ lib, stdenv, fetchurl, ncurses, libiconv }:
 
 stdenv.mkDerivation rec {
   name = "stfl-0.24";
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
   buildPhase = ''
     sed -i s/gcc/cc/g Makefile
     sed -i s%ncursesw/ncurses.h%ncurses.h% stfl_internals.h
-  '' + ( stdenv.lib.optionalString stdenv.isDarwin ''
+  '' + ( lib.optionalString stdenv.isDarwin ''
     sed -i s/-soname/-install_name/ Makefile
   '' ) + ''
     make
@@ -29,8 +29,8 @@ stdenv.mkDerivation rec {
   meta = {
     homepage    = "http://www.clifford.at/stfl/";
     description = "A library which implements a curses-based widget set for text terminals";
-    maintainers = with stdenv.lib.maintainers; [ lovek323 ];
-    license     = stdenv.lib.licenses.lgpl3;
-    platforms   = stdenv.lib.platforms.unix;
+    maintainers = with lib.maintainers; [ lovek323 ];
+    license     = lib.licenses.lgpl3;
+    platforms   = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/stlport/default.nix b/pkgs/development/libraries/stlport/default.nix
index 2d344ab293d89..5af77d90053f2 100644
--- a/pkgs/development/libraries/stlport/default.nix
+++ b/pkgs/development/libraries/stlport/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl}:
+{lib, stdenv, fetchurl}:
 
 stdenv.mkDerivation rec {
   name = "STLport-5.2.1";
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
   meta = {
     description = "An implementation of the C++ Standard Library";
     homepage = "https://sourceforge.net/projects/stlport/";
-    license = stdenv.lib.licenses.free; # seems BSD-like
+    license = lib.licenses.free; # seems BSD-like
     broken = true; # probably glibc-2.20 -related issue
   };
 }
diff --git a/pkgs/development/libraries/stxxl/default.nix b/pkgs/development/libraries/stxxl/default.nix
index fead2c8c1a530..eec4f722d4111 100644
--- a/pkgs/development/libraries/stxxl/default.nix
+++ b/pkgs/development/libraries/stxxl/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, cmake
+{ lib, stdenv, fetchurl, cmake
 , parallel ? true
 }:
 
@@ -27,7 +27,7 @@ stdenv.mkDerivation rec {
     inherit parallel;
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "An implementation of the C++ standard template library STL for external memory (out-of-core) computations";
     homepage = "https://github.com/stxxl/stxxl";
     license = licenses.boost;
diff --git a/pkgs/development/libraries/subunit/default.nix b/pkgs/development/libraries/subunit/default.nix
index d7dcdd5006695..cb824decc6ca4 100644
--- a/pkgs/development/libraries/subunit/default.nix
+++ b/pkgs/development/libraries/subunit/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, check, cppunit, perl, pythonPackages }:
+{ lib, stdenv, fetchurl, pkg-config, check, cppunit, perl, pythonPackages }:
 
 # NOTE: for subunit python library see pkgs/top-level/python-packages.nix
 
@@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
 
   postFixup = "wrapPythonPrograms";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A streaming protocol for test results";
     homepage = "https://launchpad.net/subunit";
     license = licenses.asl20;
diff --git a/pkgs/development/libraries/sundials/default.nix b/pkgs/development/libraries/sundials/default.nix
index a17b300d6be51..f8db8f3c379aa 100644
--- a/pkgs/development/libraries/sundials/default.nix
+++ b/pkgs/development/libraries/sundials/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , cmake
 , fetchurl
 , fetchpatch
@@ -36,7 +36,7 @@ stdenv.mkDerivation rec {
   buildInputs = [
     python
   ]
-    ++ stdenv.lib.optionals (lapackSupport)
+    ++ lib.optionals (lapackSupport)
     # Check that the same index size is used for both libraries
     (assert (blas.isILP64 == lapack.isILP64); [
       gfortran
@@ -46,16 +46,16 @@ stdenv.mkDerivation rec {
   # KLU support is based on Suitesparse.
   # It is tested upstream according to the section 1.1.4 of
   # [INSTALL_GUIDE.pdf](https://raw.githubusercontent.com/LLNL/sundials/master/INSTALL_GUIDE.pdf)
-  ++ stdenv.lib.optionals (kluSupport) [
+  ++ lib.optionals (kluSupport) [
     suitesparse
   ];
 
   cmakeFlags = [
     "-DEXAMPLES_INSTALL_PATH=${placeholder "examples"}/share/examples"
-  ] ++ stdenv.lib.optionals (lapackSupport) [
+  ] ++ lib.optionals (lapackSupport) [
     "-DENABLE_LAPACK=ON"
     "-DLAPACK_LIBRARIES=${lapack}/lib/liblapack${stdenv.hostPlatform.extensions.sharedLibrary}"
-  ] ++ stdenv.lib.optionals (kluSupport) [
+  ] ++ lib.optionals (kluSupport) [
     "-DENABLE_KLU=ON"
     "-DKLU_INCLUDE_DIR=${suitesparse.dev}/include"
     "-DKLU_LIBRARY_DIR=${suitesparse}/lib"
@@ -73,7 +73,7 @@ stdenv.mkDerivation rec {
   doCheck = true;
   checkTarget = "test";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Suite of nonlinear differential/algebraic equation solvers";
     homepage    = "https://computation.llnl.gov/projects/sundials";
     platforms   = platforms.all;
diff --git a/pkgs/development/libraries/svrcore/default.nix b/pkgs/development/libraries/svrcore/default.nix
index c7320f7722baa..fbc17a5e7b218 100644
--- a/pkgs/development/libraries/svrcore/default.nix
+++ b/pkgs/development/libraries/svrcore/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, nss, nspr }:
+{ lib, stdenv, fetchurl, pkg-config, nss, nspr }:
 
 stdenv.mkDerivation rec {
   pname = "svrcore";
@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ pkg-config ];
   buildInputs = [ nss nspr ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Secure PIN handling using NSS crypto";
     license = licenses.mpl11;
     platforms = platforms.all;
diff --git a/pkgs/development/libraries/swiften/default.nix b/pkgs/development/libraries/swiften/default.nix
index 2fe20cc9e8828..980d034682f57 100644
--- a/pkgs/development/libraries/swiften/default.nix
+++ b/pkgs/development/libraries/swiften/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, python, fetchurl, openssl, boost, sconsPackages }:
+{ lib, stdenv, python, fetchurl, openssl, boost, sconsPackages }:
 stdenv.mkDerivation rec {
   pname = "swiften";
   version = "4.0.2";
@@ -31,7 +31,7 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "An XMPP library for C++, used by the Swift client";
     homepage    = "http://swift.im/swiften.html";
     license     = licenses.gpl2Plus;
diff --git a/pkgs/development/libraries/swiftshader/default.nix b/pkgs/development/libraries/swiftshader/default.nix
index 3631b8b4fe7c0..2c508a3735f96 100644
--- a/pkgs/development/libraries/swiftshader/default.nix
+++ b/pkgs/development/libraries/swiftshader/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchgit, python3, cmake, jq, libX11, libXext, zlib }:
+{ lib, stdenv, fetchgit, python3, cmake, jq, libX11, libXext, zlib }:
 
 stdenv.mkDerivation rec {
   pname = "swiftshader";
@@ -50,7 +50,7 @@ stdenv.mkDerivation rec {
     runHook postInstall
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description =
       "A high-performance CPU-based implementation of the Vulkan, OpenGL ES, and Direct3D 9 graphics APIs";
     homepage = "https://opensource.google/projects/swiftshader";
diff --git a/pkgs/development/libraries/sword/default.nix b/pkgs/development/libraries/sword/default.nix
index 54c2b6fae0dbb..35c1e6e15e299 100644
--- a/pkgs/development/libraries/sword/default.nix
+++ b/pkgs/development/libraries/sword/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, icu, clucene_core, curl }:
+{ lib, stdenv, fetchurl, pkg-config, icu, clucene_core, curl }:
 
 stdenv.mkDerivation rec {
 
@@ -24,7 +24,7 @@ stdenv.mkDerivation rec {
     "-DU_USING_ICU_NAMESPACE=1"
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A software framework that allows research manipulation of Biblical texts";
     homepage = "http://www.crosswire.org/sword/";
     longDescription = ''
diff --git a/pkgs/development/libraries/sycl-info/default.nix b/pkgs/development/libraries/sycl-info/default.nix
index f294c887b0ce0..9d86017e084ea 100644
--- a/pkgs/development/libraries/sycl-info/default.nix
+++ b/pkgs/development/libraries/sycl-info/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , installShellFiles
 , cmake
@@ -40,13 +40,13 @@ stdenv.mkDerivation rec {
     "-DBUILD_TESTING=ON"
     "-DBUILD_DOCS=ON"
     "-DBUILD_SHARED_LIBS=ON"
-    "-DLYRA_INCLUDE_DIRS=${stdenv.lib.getDev lyra}/include"
+    "-DLYRA_INCLUDE_DIRS=${lib.getDev lyra}/include"
   ];
 
   # Required for ronn to compile the manpage.
   RUBYOPT = "-KU -E utf-8:utf-8";
 
-  meta = with stdenv.lib;
+  meta = with lib;
     {
       homepage = "https://github.com/codeplaysoftware/sycl-info";
       description = "Tool to show information about available SYCL implementations";
diff --git a/pkgs/development/libraries/symengine/default.nix b/pkgs/development/libraries/symengine/default.nix
index cc3abd80d6f6a..3a3f5c79763eb 100644
--- a/pkgs/development/libraries/symengine/default.nix
+++ b/pkgs/development/libraries/symengine/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , cmake
 , gmp
@@ -36,7 +36,7 @@ stdenv.mkDerivation rec {
     ctest
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A fast symbolic manipulation library";
     homepage = "https://github.com/symengine/symengine";
     platforms = platforms.unix ++ platforms.windows;
diff --git a/pkgs/development/libraries/szip/default.nix b/pkgs/development/libraries/szip/default.nix
index 4f11f42de5207..f6d0c619c770d 100644
--- a/pkgs/development/libraries/szip/default.nix
+++ b/pkgs/development/libraries/szip/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
   pname = "szip";
@@ -11,6 +11,6 @@ stdenv.mkDerivation rec {
   meta = {
     description = "Compression library that can be used with the hdf5 library";
     homepage = "https://www.hdfgroup.org/doc_resource/SZIP/";
-    license = stdenv.lib.licenses.unfree;
+    license = lib.licenses.unfree;
   };
 }
diff --git a/pkgs/development/libraries/t1lib/default.nix b/pkgs/development/libraries/t1lib/default.nix
index 7d42abc6ea190..495993a64ab6f 100644
--- a/pkgs/development/libraries/t1lib/default.nix
+++ b/pkgs/development/libraries/t1lib/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, fetchpatch, libX11, libXaw }:
+{ lib, stdenv, fetchurl, fetchpatch, libX11, libXaw }:
 
 let
   getPatch = { name, sha256 }: fetchpatch {
@@ -28,9 +28,9 @@ stdenv.mkDerivation {
   buildInputs = [ libX11 libXaw ];
   buildFlags = [ "without_doc" ];
 
-  postInstall = stdenv.lib.optional (!stdenv.isDarwin) "chmod +x $out/lib/*.so.*"; # ??
+  postInstall = lib.optional (!stdenv.isDarwin) "chmod +x $out/lib/*.so.*"; # ??
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A type 1 font rasterizer library for UNIX/X11";
     homepage = "http://www.t1lib.org/";
     license = with licenses; [ gpl2 lgpl2 ];
diff --git a/pkgs/development/libraries/tachyon/default.nix b/pkgs/development/libraries/tachyon/default.nix
index 90aa62d946f55..f536442295ef1 100644
--- a/pkgs/development/libraries/tachyon/default.nix
+++ b/pkgs/development/libraries/tachyon/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , Carbon ? null
 , libjpeg ? null
@@ -18,19 +18,19 @@ stdenv.mkDerivation rec {
     url = "http://jedi.ks.uiuc.edu/~johns/tachyon/files/${version}/${pname}-${version}.tar.gz";
     sha256 = "04m0bniszyg7ryknj8laj3rl5sspacw5nr45x59j2swcsxmdvn1v";
   };
-  buildInputs = stdenv.lib.optionals stdenv.isDarwin [
+  buildInputs = lib.optionals stdenv.isDarwin [
     Carbon
-  ] ++ stdenv.lib.optionals withJpegSupport [
+  ] ++ lib.optionals withJpegSupport [
     libjpeg
-  ] ++ stdenv.lib.optionals withPngSupport [
+  ] ++ lib.optionals withPngSupport [
     libpng
   ];
   preBuild = ''
     cd unix
-  '' + stdenv.lib.optionalString withJpegSupport ''
+  '' + lib.optionalString withJpegSupport ''
     export USEJPEG=" -DUSEJPEG"
     export JPEGLIB=" -ljpeg"
-  '' + stdenv.lib.optionalString withPngSupport ''
+  '' + lib.optionalString withPngSupport ''
     export USEPNG=" -DUSEPNG"
     export PNGLIB=" -lpng -lz"
   '';
@@ -52,7 +52,7 @@ stdenv.mkDerivation rec {
     ./make-archs.patch
   ] ++
   # Ensure looks for nix-provided Carbon, not system frameworks
-  stdenv.lib.optional stdenv.isDarwin ./darwin.patch;
+  lib.optional stdenv.isDarwin ./darwin.patch;
 
   installPhase = ''
     cd ../compile/${arch}
@@ -67,9 +67,9 @@ stdenv.mkDerivation rec {
   meta = {
     inherit version;
     description = "A Parallel / Multiprocessor Ray Tracing System";
-    license = stdenv.lib.licenses.bsd3;
-    maintainers = [stdenv.lib.maintainers.raskin];
-    platforms = with stdenv.lib.platforms; linux ++ cygwin ++ darwin;
+    license = lib.licenses.bsd3;
+    maintainers = [lib.maintainers.raskin];
+    platforms = with lib.platforms; linux ++ cygwin ++ darwin;
     homepage = "http://jedi.ks.uiuc.edu/~johns/tachyon/";
   };
 }
diff --git a/pkgs/development/libraries/taglib-extras/default.nix b/pkgs/development/libraries/taglib-extras/default.nix
index b667e60474006..44e107693c97d 100644
--- a/pkgs/development/libraries/taglib-extras/default.nix
+++ b/pkgs/development/libraries/taglib-extras/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, cmake, taglib}:
+{lib, stdenv, fetchurl, cmake, taglib}:
 
 stdenv.mkDerivation rec {
   name = "taglib-extras-1.0.1";
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
     sed -i -e 's/STRLESS/VERSION_LESS/g' cmake/modules/FindTaglib.cmake
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Additional taglib plugins";
     platforms = platforms.unix;
     license = licenses.lgpl2;
diff --git a/pkgs/development/libraries/taglib-sharp/default.nix b/pkgs/development/libraries/taglib-sharp/default.nix
index fe1bc5fcd5955..78a4026455e6d 100644
--- a/pkgs/development/libraries/taglib-sharp/default.nix
+++ b/pkgs/development/libraries/taglib-sharp/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, autoreconfHook, which, pkg-config, mono }:
+{ lib, stdenv, fetchFromGitHub, autoreconfHook, which, pkg-config, mono }:
 
 stdenv.mkDerivation rec {
   pname = "taglib-sharp";
@@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
 
   configureFlags = [ "--disable-docs" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Library for reading and writing metadata in media files";
     homepage = "https://github.com/mono/taglib-sharp";
     platforms = platforms.linux;
diff --git a/pkgs/development/libraries/taglib/default.nix b/pkgs/development/libraries/taglib/default.nix
index 28373605a6bd8..3fcfaa12339ae 100644
--- a/pkgs/development/libraries/taglib/default.nix
+++ b/pkgs/development/libraries/taglib/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, cmake, fetchpatch
+{ lib, stdenv, fetchurl, cmake, fetchpatch
 , zlib
 }:
 
@@ -40,7 +40,7 @@ stdenv.mkDerivation rec {
 
   cmakeFlags = [ "-DBUILD_SHARED_LIBS=ON" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://taglib.org/";
     repositories.git = "git://github.com/taglib/taglib.git";
     description = "A library for reading and editing audio file metadata";
diff --git a/pkgs/development/libraries/talloc/default.nix b/pkgs/development/libraries/talloc/default.nix
index fa920d037a927..553c42da7c4fe 100644
--- a/pkgs/development/libraries/talloc/default.nix
+++ b/pkgs/development/libraries/talloc/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , python3
 , pkg-config
@@ -43,7 +43,7 @@ stdenv.mkDerivation (rec {
   ];
 
   # this must not be exported before the ConfigurePhase otherwise waf whines
-  preBuild = stdenv.lib.optionalString stdenv.hostPlatform.isMusl ''
+  preBuild = lib.optionalString stdenv.hostPlatform.isMusl ''
     export NIX_CFLAGS_LINK="-no-pie -shared";
   '';
 
@@ -51,13 +51,13 @@ stdenv.mkDerivation (rec {
     ${stdenv.cc.targetPrefix}ar q $out/lib/libtalloc.a bin/default/talloc.c.[0-9]*.o
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Hierarchical pool based memory allocator with destructors";
     homepage = "https://tdb.samba.org/";
     license = licenses.gpl3;
     platforms = platforms.all;
   };
-} // stdenv.lib.optionalAttrs (stdenv.hostPlatform != stdenv.buildPlatform) {
+} // lib.optionalAttrs (stdenv.hostPlatform != stdenv.buildPlatform) {
   # python-config from build Python gives incorrect values when cross-compiling.
   # If python-config is not found, the build falls back to using the sysconfig
   # module, which works correctly when cross-compiling.
diff --git a/pkgs/development/libraries/tbb/default.nix b/pkgs/development/libraries/tbb/default.nix
index 264b34125a871..2047b0d5bc2ef 100644
--- a/pkgs/development/libraries/tbb/default.nix
+++ b/pkgs/development/libraries/tbb/default.nix
@@ -1,6 +1,6 @@
-{ stdenv, fetchFromGitHub, fixDarwinDylibNames, compiler ? if stdenv.cc.isClang then "clang" else null, stdver ? null }:
+{ lib, stdenv, fetchFromGitHub, fixDarwinDylibNames, compiler ? if stdenv.cc.isClang then "clang" else null, stdver ? null }:
 
-with stdenv.lib; stdenv.mkDerivation rec {
+with lib; stdenv.mkDerivation rec {
   pname = "tbb";
   version = "2019_U9";
 
@@ -16,7 +16,7 @@ with stdenv.lib; stdenv.mkDerivation rec {
   makeFlags = optional (compiler != null) "compiler=${compiler}"
     ++ optional (stdver != null) "stdver=${stdver}";
 
-  patches = stdenv.lib.optional stdenv.hostPlatform.isMusl ./glibc-struct-mallinfo.patch;
+  patches = lib.optional stdenv.hostPlatform.isMusl ./glibc-struct-mallinfo.patch;
 
   installPhase = ''
     runHook preInstall
diff --git a/pkgs/development/libraries/tclap/default.nix b/pkgs/development/libraries/tclap/default.nix
index 22fd7b11681c6..451f17a2cd72a 100644
--- a/pkgs/development/libraries/tclap/default.nix
+++ b/pkgs/development/libraries/tclap/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
   name = "tclap-1.2.2";
@@ -8,7 +8,7 @@ stdenv.mkDerivation rec {
     sha256 = "0dsqvsgzam3mypj2ladn6v1yjq9zd47p3lg21jx6kz5azkkkn0gm";
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://tclap.sourceforge.net/";
     description = "Templatized C++ Command Line Parser Library";
     platforms = platforms.all;
diff --git a/pkgs/development/libraries/tcllib/default.nix b/pkgs/development/libraries/tcllib/default.nix
index 2cb65b9c69817..4cab15ca5c22f 100644
--- a/pkgs/development/libraries/tcllib/default.nix
+++ b/pkgs/development/libraries/tcllib/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, tcl }:
+{ lib, stdenv, fetchurl, tcl }:
 
 stdenv.mkDerivation rec {
   pname = "tcllib";
@@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
   meta = {
     homepage = "https://sourceforge.net/projects/tcllib/";
     description = "Tcl-only library of standard routines for Tcl";
-    license = stdenv.lib.licenses.tcltk;
-    platforms = stdenv.lib.platforms.unix;
+    license = lib.licenses.tcltk;
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/tcltls/default.nix b/pkgs/development/libraries/tcltls/default.nix
index c26394f6cd50d..e88358bbce0a5 100644
--- a/pkgs/development/libraries/tcltls/default.nix
+++ b/pkgs/development/libraries/tcltls/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, tcl, openssl }:
+{ lib, stdenv, fetchurl, tcl, openssl }:
 
 stdenv.mkDerivation rec {
   pname = "tcltls";
@@ -28,7 +28,7 @@ stdenv.mkDerivation rec {
   meta = {
     homepage = "http://tls.sourceforge.net/";
     description = "An OpenSSL / RSA-bsafe Tcl extension";
-    license = stdenv.lib.licenses.tcltk;
-    platforms = stdenv.lib.platforms.unix;
+    license = lib.licenses.tcltk;
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/tclx/default.nix b/pkgs/development/libraries/tclx/default.nix
index 5d4727a1831e9..85eae730575fe 100644
--- a/pkgs/development/libraries/tclx/default.nix
+++ b/pkgs/development/libraries/tclx/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, tcl }:
+{ lib, stdenv, fetchurl, tcl }:
 
 stdenv.mkDerivation rec {
   name = "tclx-${version}.${patch}";
@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
   meta = {
     homepage = "http://tclx.sourceforge.net/";
     description = "Tcl extensions";
-    license = stdenv.lib.licenses.tcltk;
-    maintainers = with stdenv.lib.maintainers; [ kovirobi ];
+    license = lib.licenses.tcltk;
+    maintainers = with lib.maintainers; [ kovirobi ];
   };
 }
diff --git a/pkgs/development/libraries/tdb/default.nix b/pkgs/development/libraries/tdb/default.nix
index b8e6552bc7b50..658bdb2f9d5dd 100644
--- a/pkgs/development/libraries/tdb/default.nix
+++ b/pkgs/development/libraries/tdb/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , pkg-config
 , wafHook
@@ -38,7 +38,7 @@ stdenv.mkDerivation rec {
     "--builtin-libraries=replace"
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "The trivial database";
     longDescription = ''
       TDB is a Trivial Database. In concept, it is very much like GDBM,
diff --git a/pkgs/development/libraries/tdlib/default.nix b/pkgs/development/libraries/tdlib/default.nix
index 1a36a68a33bde..895faa8847ac0 100644
--- a/pkgs/development/libraries/tdlib/default.nix
+++ b/pkgs/development/libraries/tdlib/default.nix
@@ -1,4 +1,4 @@
-{ fetchFromGitHub, gperf, openssl, readline, zlib, cmake, stdenv }:
+{ fetchFromGitHub, gperf, openssl, readline, zlib, cmake, lib, stdenv }:
 
 stdenv.mkDerivation rec {
   version = "1.7.0";
@@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
   buildInputs = [ gperf openssl readline zlib ];
   nativeBuildInputs = [ cmake ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Cross-platform library for building Telegram clients";
     homepage = "https://core.telegram.org/tdlib/";
     license = [ licenses.boost ];
diff --git a/pkgs/development/libraries/tecla/default.nix b/pkgs/development/libraries/tecla/default.nix
index a47f39be10a72..6d8a334ce3fb0 100644
--- a/pkgs/development/libraries/tecla/default.nix
+++ b/pkgs/development/libraries/tecla/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
   name = "tecla-1.6.3";
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
     description = "Command-line editing library";
     license = "as-is";
 
-    platforms = stdenv.lib.platforms.unix;
-    maintainers = [ stdenv.lib.maintainers.peti ];
+    platforms = lib.platforms.unix;
+    maintainers = [ lib.maintainers.peti ];
   };
 }
diff --git a/pkgs/development/libraries/telepathy/farstream/default.nix b/pkgs/development/libraries/telepathy/farstream/default.nix
index a30d8d01c4968..2885f3cbb12d9 100644
--- a/pkgs/development/libraries/telepathy/farstream/default.nix
+++ b/pkgs/development/libraries/telepathy/farstream/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, telepathy-glib, farstream, dbus-glib }:
+{ lib, stdenv, fetchurl, pkg-config, telepathy-glib, farstream, dbus-glib }:
 
 stdenv.mkDerivation rec {
   name = "${pname}-0.6.2";
@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
   propagatedBuildInputs = [ dbus-glib telepathy-glib farstream ];
   nativeBuildInputs = [ pkg-config ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "GObject-based C library that uses Telepathy GLib, Farstream and GStreamer to handle the media streaming part of channels of type Call";
     homepage = "https://telepathy.freedesktop.org/wiki/Components/Telepathy-Farstream/";
     platforms = platforms.linux;
diff --git a/pkgs/development/libraries/telepathy/glib/default.nix b/pkgs/development/libraries/telepathy/glib/default.nix
index ec9dfab120f1f..8bb7522b1976a 100644
--- a/pkgs/development/libraries/telepathy/glib/default.nix
+++ b/pkgs/development/libraries/telepathy/glib/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, dbus-glib, glib, python2, pkg-config, libxslt
+{ lib, stdenv, fetchurl, dbus-glib, glib, python2, pkg-config, libxslt
 , gobject-introspection, vala, glibcLocales }:
 
 stdenv.mkDerivation rec {
@@ -28,7 +28,7 @@ stdenv.mkDerivation rec {
 
   passthru.python = python2;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://telepathy.freedesktop.org";
     platforms = platforms.unix;
     license = with licenses; [ bsd2 bsd3 lgpl21Plus ];
diff --git a/pkgs/development/libraries/telepathy/qt/default.nix b/pkgs/development/libraries/telepathy/qt/default.nix
index 888d98b957ff3..b606c56445ed7 100644
--- a/pkgs/development/libraries/telepathy/qt/default.nix
+++ b/pkgs/development/libraries/telepathy/qt/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, cmake, qtbase, pkg-config, python3Packages, dbus-glib, dbus
+{ lib, stdenv, fetchurl, cmake, qtbase, pkg-config, python3Packages, dbus-glib, dbus
 , telepathy-farstream, telepathy-glib, fetchpatch }:
 
 let
@@ -18,11 +18,11 @@ in stdenv.mkDerivation rec {
 
   # No point in building tests if they are not run
   # On 0.9.7, they do not even build with QT4
-  cmakeFlags = stdenv.lib.optional (!doCheck) "-DENABLE_TESTS=OFF";
+  cmakeFlags = lib.optional (!doCheck) "-DENABLE_TESTS=OFF";
 
   doCheck = false; # giving up for now
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Telepathy Qt bindings";
     homepage = "https://telepathy.freedesktop.org/components/telepathy-qt/";
     license = licenses.lgpl21;
diff --git a/pkgs/development/libraries/template-glib/default.nix b/pkgs/development/libraries/template-glib/default.nix
index 0c4fd9da147cf..2c89e3f433ab4 100644
--- a/pkgs/development/libraries/template-glib/default.nix
+++ b/pkgs/development/libraries/template-glib/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, meson, ninja, pkg-config, glib, gobject-introspection, flex, bison, vala, gettext, gnome3, gtk-doc, docbook_xsl, docbook_xml_dtd_43 }:
+{ lib, stdenv, fetchurl, meson, ninja, pkg-config, glib, gobject-introspection, flex, bison, vala, gettext, gnome3, gtk-doc, docbook_xsl, docbook_xml_dtd_43 }:
 let
   version = "3.34.0";
   pname = "template-glib";
@@ -9,7 +9,7 @@ stdenv.mkDerivation {
   outputs = [ "out" "dev" "devdoc" ];
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "1z9xkin5fyfh071ma9y045jcw83hgx33dfbjraw6cxk0qdmfysr1";
   };
 
@@ -26,7 +26,7 @@ stdenv.mkDerivation {
     };
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A library for template expansion which supports calling into GObject Introspection from templates";
     homepage = "https://gitlab.gnome.org/GNOME/template-glib";
     license = licenses.lgpl21Plus;
diff --git a/pkgs/development/libraries/tepl/default.nix b/pkgs/development/libraries/tepl/default.nix
index 77cf9fd0247d0..d9d7408173552 100644
--- a/pkgs/development/libraries/tepl/default.nix
+++ b/pkgs/development/libraries/tepl/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , meson
 , ninja
@@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
   outputs = [ "out" "dev" ];
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "0x2s0ks575b57jdqnp9r9miz40pm705n2dlj2k8bfj1hyl22kgf6";
   };
 
@@ -48,7 +48,7 @@ stdenv.mkDerivation rec {
 
   passthru.updateScript = gnome3.updateScript { packageName = pname; };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://wiki.gnome.org/Projects/Tepl";
     description = "Text editor product line";
     maintainers = teams.gnome.members ++ [ maintainers.manveru ];
diff --git a/pkgs/development/libraries/termbox/default.nix b/pkgs/development/libraries/termbox/default.nix
index 22082f7198f4b..e809240bcd104 100644
--- a/pkgs/development/libraries/termbox/default.nix
+++ b/pkgs/development/libraries/termbox/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, python3, wafHook, fetchpatch }:
+{ lib, stdenv, fetchFromGitHub, python3, wafHook, fetchpatch }:
 
 stdenv.mkDerivation rec {
   pname = "termbox";
@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ python3 wafHook ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Library for writing text-based user interfaces";
     license = licenses.mit;
     homepage = "https://github.com/nsf/termbox#readme";
diff --git a/pkgs/development/libraries/tevent/default.nix b/pkgs/development/libraries/tevent/default.nix
index 2d5fd0564bad8..568751f48aa33 100644
--- a/pkgs/development/libraries/tevent/default.nix
+++ b/pkgs/development/libraries/tevent/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , python3
 , pkg-config
@@ -43,7 +43,7 @@ stdenv.mkDerivation rec {
     "--builtin-libraries=replace"
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "An event system based on the talloc memory management library";
     homepage = "https://tevent.samba.org/";
     license = licenses.lgpl3Plus;
diff --git a/pkgs/development/libraries/theft/default.nix b/pkgs/development/libraries/theft/default.nix
index 85dc2c75afb90..3d39075dd26ad 100644
--- a/pkgs/development/libraries/theft/default.nix
+++ b/pkgs/development/libraries/theft/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub }:
+{ lib, stdenv, fetchFromGitHub }:
 
 stdenv.mkDerivation rec {
   version = "0.4.5";
@@ -27,7 +27,7 @@ stdenv.mkDerivation rec {
       --replace "/usr/local" "$out"
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A C library for property-based testing";
     homepage    = "https://github.com/silentbicycle/theft/";
     platforms   = platforms.unix;
diff --git a/pkgs/development/libraries/thrift/0.10.nix b/pkgs/development/libraries/thrift/0.10.nix
index 25da474099c5e..a735e146214a4 100644
--- a/pkgs/development/libraries/thrift/0.10.nix
+++ b/pkgs/development/libraries/thrift/0.10.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, boost, zlib, libevent, openssl, python, pkg-config, bison
+{ lib, stdenv, fetchurl, boost, zlib, libevent, openssl, python, pkg-config, bison
 , flex, twisted
 }:
 
@@ -29,7 +29,7 @@ stdenv.mkDerivation rec {
   configureFlags = [ "--enable-tests=no" ];
   doCheck = false;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Library for scalable cross-language services";
     homepage = "http://thrift.apache.org/";
     license = licenses.asl20;
diff --git a/pkgs/development/libraries/thrift/default.nix b/pkgs/development/libraries/thrift/default.nix
index 5a9547a959ffb..669dff21147e4 100644
--- a/pkgs/development/libraries/thrift/default.nix
+++ b/pkgs/development/libraries/thrift/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, fetchpatch, boost, zlib, libevent, openssl, python, cmake, pkg-config
+{ lib, stdenv, fetchurl, fetchpatch, boost, zlib, libevent, openssl, python, cmake, pkg-config
 , bison, flex, twisted
 , static ? stdenv.hostPlatform.isStatic
 }:
@@ -27,7 +27,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ cmake pkg-config bison flex ];
   buildInputs = [ boost zlib libevent openssl ]
-    ++ stdenv.lib.optionals (!static) [ python twisted ];
+    ++ lib.optionals (!static) [ python twisted ];
 
   preConfigure = "export PY_PREFIX=$out";
 
@@ -35,7 +35,7 @@ stdenv.mkDerivation rec {
     # FIXME: Fails to link in static mode with undefined reference to
     # `boost::unit_test::unit_test_main(bool (*)(), int, char**)'
     "-DBUILD_TESTING:BOOL=${if static then "OFF" else "ON"}"
-  ] ++ stdenv.lib.optionals static [
+  ] ++ lib.optionals static [
     "-DWITH_STATIC_LIB:BOOL=ON"
     "-DOPENSSL_USE_STATIC_LIBS=ON"
   ];
@@ -44,13 +44,13 @@ stdenv.mkDerivation rec {
   checkPhase = ''
     runHook preCheck
 
-    ${stdenv.lib.optionalString stdenv.isDarwin "DY"}LD_LIBRARY_PATH=$PWD/lib ctest -E PythonTestSSLSocket
+    ${lib.optionalString stdenv.isDarwin "DY"}LD_LIBRARY_PATH=$PWD/lib ctest -E PythonTestSSLSocket
 
     runHook postCheck
   '';
   enableParallelChecking = false;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Library for scalable cross-language services";
     homepage = "http://thrift.apache.org/";
     license = licenses.asl20;
diff --git a/pkgs/development/libraries/ti-rpc/default.nix b/pkgs/development/libraries/ti-rpc/default.nix
index 3d163ef6ded61..044c09a5bc489 100644
--- a/pkgs/development/libraries/ti-rpc/default.nix
+++ b/pkgs/development/libraries/ti-rpc/default.nix
@@ -1,4 +1,4 @@
-{ fetchurl, stdenv, autoreconfHook, libkrb5 }:
+{ fetchurl, lib, stdenv, autoreconfHook, libkrb5 }:
 
 stdenv.mkDerivation rec {
   pname = "libtirpc";
@@ -28,7 +28,7 @@ stdenv.mkDerivation rec {
 
   doCheck = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://sourceforge.net/projects/libtirpc/";
     description = "The transport-independent Sun RPC implementation (TI-RPC)";
     license = licenses.bsd3;
diff --git a/pkgs/development/libraries/ticpp/default.nix b/pkgs/development/libraries/ticpp/default.nix
index 37b093c8e2ecb..20de3d7f2b892 100644
--- a/pkgs/development/libraries/ticpp/default.nix
+++ b/pkgs/development/libraries/ticpp/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , cmake
 }:
@@ -28,7 +28,7 @@ stdenv.mkDerivation {
 
   meta = {
     description = "Interface to TinyXML";
-    license = stdenv.lib.licenses.mit;
+    license = lib.licenses.mit;
     homepage = "https://github.com/wxFormBuilder/ticpp";
   };
 
diff --git a/pkgs/development/libraries/tidyp/default.nix b/pkgs/development/libraries/tidyp/default.nix
index f75b8cb01510f..5c0ad8463b4ae 100644
--- a/pkgs/development/libraries/tidyp/default.nix
+++ b/pkgs/development/libraries/tidyp/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
   name = "tidyp-1.04";
@@ -10,7 +10,7 @@ stdenv.mkDerivation rec {
 
   hardeningDisable = [ "format" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A program that can validate your HTML, as well as modify it to be more clean and standard";
     homepage = "http://tidyp.com/";
     platforms = platforms.linux;
diff --git a/pkgs/development/libraries/timezonemap/default.nix b/pkgs/development/libraries/timezonemap/default.nix
index 6f561eac04eb8..372b0e74b06f3 100644
--- a/pkgs/development/libraries/timezonemap/default.nix
+++ b/pkgs/development/libraries/timezonemap/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , autoreconfHook
 , fetchbzr
 , pkg-config
@@ -55,7 +55,7 @@ stdenv.mkDerivation rec {
     sed "s|/usr/share/libtimezonemap|$out/share/libtimezonemap|g" -i ./src/tz.h
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://launchpad.net/timezonemap";
     description = "A GTK+3 Timezone Map Widget";
     license = licenses.gpl2;
diff --git a/pkgs/development/libraries/tinycbor/default.nix b/pkgs/development/libraries/tinycbor/default.nix
index 62f2a8071852a..d03e20cb7e21b 100644
--- a/pkgs/development/libraries/tinycbor/default.nix
+++ b/pkgs/development/libraries/tinycbor/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub }:
+{ lib, stdenv, fetchFromGitHub }:
 
 stdenv.mkDerivation rec {
   pname = "tinycbor";
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
 
   makeFlags = [ "prefix=$(out)" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Concise Binary Object Representation (CBOR) Library";
     homepage = "https://github.com/intel/tinycbor";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/tinyobjloader/default.nix b/pkgs/development/libraries/tinyobjloader/default.nix
index 92eb5b3d8f4b8..c7939a6be2553 100644
--- a/pkgs/development/libraries/tinyobjloader/default.nix
+++ b/pkgs/development/libraries/tinyobjloader/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , cmake
 }:
@@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ cmake ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/tinyobjloader/tinyobjloader";
     description = "Tiny but powerful single file wavefront obj loader";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/tinyxml-2/default.nix b/pkgs/development/libraries/tinyxml-2/default.nix
index 310b5a447c7a6..1e2eea7ac899a 100644
--- a/pkgs/development/libraries/tinyxml-2/default.nix
+++ b/pkgs/development/libraries/tinyxml-2/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake }:
+{ lib, stdenv, fetchFromGitHub, cmake }:
 
 stdenv.mkDerivation rec {
   pname = "tinyxml-2";
@@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
   meta = {
     description = "A simple, small, efficient, C++ XML parser";
     homepage = "http://www.grinninglizard.com/tinyxml2/index.html";
-    platforms = stdenv.lib.platforms.unix;
-    license = stdenv.lib.licenses.zlib;
+    platforms = lib.platforms.unix;
+    license = lib.licenses.zlib;
   };
 }
diff --git a/pkgs/development/libraries/tinyxml/2.6.2.nix b/pkgs/development/libraries/tinyxml/2.6.2.nix
index 7b6b0f9390ef8..e8c5dd1dacdf6 100644
--- a/pkgs/development/libraries/tinyxml/2.6.2.nix
+++ b/pkgs/development/libraries/tinyxml/2.6.2.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, unzip }:
+{ lib, stdenv, fetchurl, unzip }:
 
 let
   version = "2.6.2";
@@ -28,7 +28,7 @@ in stdenv.mkDerivation {
   hardeningDisable = [ "format" ];
 
   NIX_CFLAGS_COMPILE =
-    stdenv.lib.optionalString stdenv.isDarwin "-mmacosx-version-min=10.9";
+    lib.optionalString stdenv.isDarwin "-mmacosx-version-min=10.9";
 
   nativeBuildInputs = [ unzip ];
   buildPhase = ''
@@ -67,14 +67,14 @@ in stdenv.mkDerivation {
     cp -v tinyxml.pc $out/lib/pkgconfig/
 
     cp -v docs/* $out/share/doc/tinyxml/
-  '' + stdenv.lib.optionalString stdenv.isDarwin ''
+  '' + lib.optionalString stdenv.isDarwin ''
     install_name_tool -id $out/lib/libtinyxml.dylib $out/lib/libtinyxml.dylib
   '';
 
   meta = {
     description = "Simple, small, C++ XML parser that can be easily integrating into other programs";
     homepage = "http://www.grinninglizard.com/tinyxml/index.html";
-    license = stdenv.lib.licenses.free;
-    platforms = stdenv.lib.platforms.unix;
+    license = lib.licenses.free;
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/tix/default.nix b/pkgs/development/libraries/tix/default.nix
index 52fffb42aa2f3..e0f91330efcaf 100644
--- a/pkgs/development/libraries/tix/default.nix
+++ b/pkgs/development/libraries/tix/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, tcl, tk, fetchpatch } :
+{ lib, stdenv, fetchurl, tcl, tk, fetchpatch } :
 
 stdenv.mkDerivation {
   version = "8.4.3";
@@ -13,7 +13,7 @@ stdenv.mkDerivation {
     url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/dev-tcltk/tix/files/tix-8.4.3-tcl8.5.patch?id=56bd759df1d0c750a065b8c845e93d5dfa6b549d";
     sha256 = "0wzqmcxxq0rqpnjgxz10spw92yhfygnlwv0h8pcx2ycnqiljz6vj";
     })
-  ] ++ stdenv.lib.optional (tcl.release == "8.6")
+  ] ++ lib.optional (tcl.release == "8.6")
   (fetchpatch {
     name = "tix-8.4.3-tcl8.6.patch";
     url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/dev-tcltk/tix/files/tix-8.4.3-tcl8.6.patch?id=56bd759df1d0c750a065b8c845e93d5dfa6b549d";
@@ -42,7 +42,7 @@ stdenv.mkDerivation {
     "--libdir=\${prefix}/lib"
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A widget library for Tcl/Tk";
     homepage    = "http://tix.sourceforge.net/";
     platforms   = platforms.all;
diff --git a/pkgs/development/libraries/tk/8.6.nix b/pkgs/development/libraries/tk/8.6.nix
index c30f9a8194785..fdffbeba2c936 100644
--- a/pkgs/development/libraries/tk/8.6.nix
+++ b/pkgs/development/libraries/tk/8.6.nix
@@ -1,4 +1,4 @@
-{ callPackage, fetchurl, tcl, stdenv, ... } @ args:
+{ callPackage, fetchurl, tcl, lib, stdenv, ... } @ args:
 
 callPackage ./generic.nix (args // {
 
@@ -7,6 +7,6 @@ callPackage ./generic.nix (args // {
     sha256 = "1d7bfkxpacy33w5nahf73lkwxqpff44w1jplg7i2gmwgiaawvjwg";
   };
 
-  patches = [ ./different-prefix-with-tcl.patch ] ++ stdenv.lib.optionals stdenv.isDarwin [ ./Fix-bad-install_name-for-libtk8.6.dylib.patch ];
+  patches = [ ./different-prefix-with-tcl.patch ] ++ lib.optionals stdenv.isDarwin [ ./Fix-bad-install_name-for-libtk8.6.dylib.patch ];
 
 })
diff --git a/pkgs/development/libraries/tk/generic.nix b/pkgs/development/libraries/tk/generic.nix
index 1d04ce5a1b9cf..57dc3dac2d095 100644
--- a/pkgs/development/libraries/tk/generic.nix
+++ b/pkgs/development/libraries/tk/generic.nix
@@ -21,15 +21,15 @@ stdenv.mkDerivation {
     cp ../{unix,generic}/*.h $out/include
     ln -s $out/lib/libtk${tcl.release}${stdenv.hostPlatform.extensions.sharedLibrary} $out/lib/libtk${stdenv.hostPlatform.extensions.sharedLibrary}
   ''
-  + stdenv.lib.optionalString (stdenv.isDarwin) ''
+  + lib.optionalString (stdenv.isDarwin) ''
     cp ../macosx/*.h $out/include
   '';
 
   configureFlags = [
     "--enable-threads"
     "--with-tcl=${tcl}/lib"
-  ] ++ stdenv.lib.optional stdenv.is64bit "--enable-64bit"
-    ++ stdenv.lib.optional enableAqua "--enable-aqua";
+  ] ++ lib.optional stdenv.is64bit "--enable-64bit"
+    ++ lib.optional enableAqua "--enable-aqua";
 
   nativeBuildInputs = [ pkg-config ];
   buildInputs = lib.optional enableAqua (with darwin.apple_sdk.frameworks; [ Cocoa ]);
@@ -46,7 +46,7 @@ stdenv.mkDerivation {
     libdir = "lib/${libPrefix}";
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A widget toolkit that provides a library of basic elements for building a GUI in many different programming languages";
     homepage = "https://www.tcl.tk/";
     license = licenses.tcltk;
diff --git a/pkgs/development/libraries/tl-expected/default.nix b/pkgs/development/libraries/tl-expected/default.nix
index e91c42c884cb3..4915fd7e700d3 100644
--- a/pkgs/development/libraries/tl-expected/default.nix
+++ b/pkgs/development/libraries/tl-expected/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake }:
+{ lib, stdenv, fetchFromGitHub, cmake }:
 
 stdenv.mkDerivation rec {
   pname = "tl-expected-unstable";
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ cmake ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "C++11/14/17 std::expected with functional-style extensions";
     homepage = "https://tl.tartanllama.xyz/en/latest/api/expected.html";
     license = licenses.cc0;
diff --git a/pkgs/development/libraries/tnt/default.nix b/pkgs/development/libraries/tnt/default.nix
index 93b760bc88f63..932239a485fd2 100644
--- a/pkgs/development/libraries/tnt/default.nix
+++ b/pkgs/development/libraries/tnt/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, unzip}:
+{lib, stdenv, fetchurl, unzip}:
 
 stdenv.mkDerivation {
   pname = "tnt";
@@ -19,7 +19,7 @@ stdenv.mkDerivation {
   meta = {
     homepage = "https://math.nist.gov/tnt/";
     description = "Template Numerical Toolkit: C++ headers for array and matrices";
-    license = stdenv.lib.licenses.publicDomain;
-    platforms = stdenv.lib.platforms.unix;
+    license = lib.licenses.publicDomain;
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/tntdb/default.nix b/pkgs/development/libraries/tntdb/default.nix
index ff14c8c3305e8..a21a71b89bfd9 100644
--- a/pkgs/development/libraries/tntdb/default.nix
+++ b/pkgs/development/libraries/tntdb/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, cxxtools, postgresql, libmysqlclient, sqlite, zlib, openssl }:
+{ lib, stdenv, fetchurl, cxxtools, postgresql, libmysqlclient, sqlite, zlib, openssl }:
 
 stdenv.mkDerivation rec {
   pname = "tntdb";
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://www.tntnet.org/tntdb.html";
     description = "C++ library which makes accessing SQL databases easy and robust";
     platforms = platforms.linux ;
diff --git a/pkgs/development/libraries/tntnet/default.nix b/pkgs/development/libraries/tntnet/default.nix
index 332750d7694c1..a80b923e23587 100644
--- a/pkgs/development/libraries/tntnet/default.nix
+++ b/pkgs/development/libraries/tntnet/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, cxxtools, zlib, openssl, zip }:
+{ lib, stdenv, fetchurl, cxxtools, zlib, openssl, zip }:
 
 stdenv.mkDerivation rec {
   pname = "tntnet";
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://www.tntnet.org/tntnet.html";
     description = "Web server which allows users to develop web applications using C++";
     platforms = platforms.linux ;
diff --git a/pkgs/development/libraries/tokyo-cabinet/default.nix b/pkgs/development/libraries/tokyo-cabinet/default.nix
index b8969588b3c55..22d3266b93a6d 100644
--- a/pkgs/development/libraries/tokyo-cabinet/default.nix
+++ b/pkgs/development/libraries/tokyo-cabinet/default.nix
@@ -1,4 +1,4 @@
-{ fetchurl, stdenv, zlib, bzip2 }:
+{ fetchurl, lib, stdenv, zlib, bzip2 }:
 
 stdenv.mkDerivation rec {
   name = "tokyocabinet-1.4.48";
@@ -35,9 +35,9 @@ stdenv.mkDerivation rec {
          robustness, supports 64-bit architecture.
       '';
 
-    license = stdenv.lib.licenses.lgpl2Plus;
+    license = lib.licenses.lgpl2Plus;
 
     maintainers = [ ];
-    platforms = stdenv.lib.platforms.unix;
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/tokyo-tyrant/default.nix b/pkgs/development/libraries/tokyo-tyrant/default.nix
index e970fb6786c2d..e5aeae6aae02d 100644
--- a/pkgs/development/libraries/tokyo-tyrant/default.nix
+++ b/pkgs/development/libraries/tokyo-tyrant/default.nix
@@ -1,4 +1,4 @@
-{ fetchurl, stdenv, tokyocabinet, pkg-config }:
+{ fetchurl, lib, stdenv, tokyocabinet, pkg-config }:
 
 stdenv.mkDerivation rec {
   name = "tokyotyrant-1.1.41";
@@ -33,9 +33,9 @@ stdenv.mkDerivation rec {
 
     homepage = "https://fallabs.com/tokyotyrant/";
 
-    license = stdenv.lib.licenses.lgpl21Plus;
+    license = lib.licenses.lgpl21Plus;
 
-    platforms = stdenv.lib.platforms.gnu ++ stdenv.lib.platforms.linux;         # arbitrary choice
+    platforms = lib.platforms.gnu ++ stdenv.lib.platforms.linux;         # arbitrary choice
     maintainers = [ ];
   };
 }
diff --git a/pkgs/development/libraries/totem-pl-parser/default.nix b/pkgs/development/libraries/totem-pl-parser/default.nix
index 27498fdaaf852..c93ec8dccf9be 100644
--- a/pkgs/development/libraries/totem-pl-parser/default.nix
+++ b/pkgs/development/libraries/totem-pl-parser/default.nix
@@ -1,11 +1,11 @@
-{ stdenv, fetchurl, meson, ninja, pkg-config, gettext, libxml2, gobject-introspection, gnome3 }:
+{ lib, stdenv, fetchurl, meson, ninja, pkg-config, gettext, libxml2, gobject-introspection, gnome3 }:
 
 stdenv.mkDerivation rec {
   pname = "totem-pl-parser";
   version = "3.26.5";
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "132jihnf51zs98yjkc6jxyqib4f3dawpjm17g4bj4j78y93dww2k";
   };
 
@@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ meson ninja pkg-config gettext gobject-introspection ];
   buildInputs = [ libxml2 ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://wiki.gnome.org/Apps/Videos";
     description = "Simple GObject-based library to parse and save a host of playlist formats";
     maintainers = teams.gnome.members;
diff --git a/pkgs/development/libraries/tracker-miners/default.nix b/pkgs/development/libraries/tracker-miners/default.nix
index dc6d30061d643..2ca5dd6bd93a1 100644
--- a/pkgs/development/libraries/tracker-miners/default.nix
+++ b/pkgs/development/libraries/tracker-miners/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , substituteAll
 , asciidoc
@@ -51,7 +51,7 @@ stdenv.mkDerivation rec {
   version = "3.0.1";
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "1kfi5d6pccqx28hbnja6k1mpwjd53k5zs704sg01rlzmbshz1zn6";
   };
 
@@ -128,7 +128,7 @@ stdenv.mkDerivation rec {
     };
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://wiki.gnome.org/Projects/Tracker";
     description = "Desktop-neutral user information store, search tool and indexer";
     maintainers = teams.gnome.members;
diff --git a/pkgs/development/libraries/tracker/default.nix b/pkgs/development/libraries/tracker/default.nix
index f883268cc28ff..38885048fcc56 100644
--- a/pkgs/development/libraries/tracker/default.nix
+++ b/pkgs/development/libraries/tracker/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , fetchpatch
 , gettext
@@ -35,7 +35,7 @@ stdenv.mkDerivation rec {
   outputs = [ "out" "dev" "devdoc" ];
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "1rhcs75axga7p7hl37h6jzb2az89jddlcwc7ykrnb2khyhka78rr";
   };
 
@@ -133,7 +133,7 @@ stdenv.mkDerivation rec {
     };
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://wiki.gnome.org/Projects/Tracker";
     description = "Desktop-neutral user information store, search tool and indexer";
     maintainers = teams.gnome.members;
diff --git a/pkgs/development/libraries/tre/default.nix b/pkgs/development/libraries/tre/default.nix
index 80806848846f8..e515dd1673fa9 100644
--- a/pkgs/development/libraries/tre/default.nix
+++ b/pkgs/development/libraries/tre/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, fetchpatch}:
+{lib, stdenv, fetchurl, fetchpatch}:
 
 stdenv.mkDerivation rec {
   name = "tre-0.8.0";
@@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
   meta = {
     description = "Lightweight and robust POSIX compliant regexp matching library";
     homepage = "https://laurikari.net/tre/";
-    platforms = stdenv.lib.platforms.unix;
-    license = stdenv.lib.licenses.bsd2;
+    platforms = lib.platforms.unix;
+    license = lib.licenses.bsd2;
   };
 }
diff --git a/pkgs/development/libraries/tremor/default.nix b/pkgs/development/libraries/tremor/default.nix
index f7ac1a57f4ac1..16e1a78d396ed 100644
--- a/pkgs/development/libraries/tremor/default.nix
+++ b/pkgs/development/libraries/tremor/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitLab, autoreconfHook, pkg-config, libogg }:
+{ lib, stdenv, fetchFromGitLab, autoreconfHook, pkg-config, libogg }:
 
 stdenv.mkDerivation {
   name = "tremor-unstable-2018-03-16";
@@ -23,7 +23,7 @@ stdenv.mkDerivation {
   meta = {
     homepage = "https://xiph.org/tremor/";
     description = "Fixed-point version of the Ogg Vorbis decoder";
-    license = stdenv.lib.licenses.bsd3;
-    platforms = stdenv.lib.platforms.unix;
+    license = lib.licenses.bsd3;
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/trompeloeil/default.nix b/pkgs/development/libraries/trompeloeil/default.nix
index 929627f3e1bff..800b35640111f 100644
--- a/pkgs/development/libraries/trompeloeil/default.nix
+++ b/pkgs/development/libraries/trompeloeil/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake }:
+{ lib, stdenv, fetchFromGitHub, cmake }:
 
 stdenv.mkDerivation rec {
   pname = "trompeloeil";
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ cmake ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Header only C++14 mocking framework";
     homepage = "https://github.com/rollbear/trompeloeil";
     license = licenses.boost;
diff --git a/pkgs/development/libraries/tsocks/default.nix b/pkgs/development/libraries/tsocks/default.nix
index f2018286a3eae..728c6e71f7fb9 100644
--- a/pkgs/development/libraries/tsocks/default.nix
+++ b/pkgs/development/libraries/tsocks/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
   pname = "tsocks";
@@ -25,10 +25,10 @@ stdenv.mkDerivation rec {
       -e "/SAVE/d" Makefile
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Transparent SOCKS v4 proxying library";
     homepage = "http://tsocks.sourceforge.net/";
-    license = stdenv.lib.licenses.gpl2;
+    license = lib.licenses.gpl2;
     maintainers = with maintainers; [ edwtjo phreedom ];
     platforms = platforms.unix;
     broken = stdenv.hostPlatform.isDarwin;
diff --git a/pkgs/development/libraries/tweeny/default.nix b/pkgs/development/libraries/tweeny/default.nix
index f2de470288ded..c1737f6f017ad 100644
--- a/pkgs/development/libraries/tweeny/default.nix
+++ b/pkgs/development/libraries/tweeny/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , cmake
 }:
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
 
   doCheck = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A modern C++ tweening library";
     license = licenses.mit;
     homepage = "http://mobius3.github.io/tweeny";
diff --git a/pkgs/development/libraries/twolame/default.nix b/pkgs/development/libraries/twolame/default.nix
index 6ccd853de0a6e..3537dd3029b6e 100644
--- a/pkgs/development/libraries/twolame/default.nix
+++ b/pkgs/development/libraries/twolame/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub
+{ lib, stdenv, fetchFromGitHub
 , autoreconfHook, pkg-config
 , libsndfile }:
 
@@ -19,7 +19,7 @@ stdenv.mkDerivation {
 
   doCheck = false; # fails with "../build-scripts/test-driver: line 107: -Mstrict: command not found"
 
-  meta = with stdenv.lib;{
+  meta = with lib;{
     description = "A MP2 encoder";
     longDescription = ''
       TwoLAME is an optimised MPEG Audio Layer 2 (MP2) encoder based on
diff --git a/pkgs/development/libraries/ubus/default.nix b/pkgs/development/libraries/ubus/default.nix
index 1f7124411ac35..db947d373a2dd 100644
--- a/pkgs/development/libraries/ubus/default.nix
+++ b/pkgs/development/libraries/ubus/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, cmake, fetchgit, libubox, libjson }:
+{ lib, stdenv, cmake, fetchgit, libubox, libjson }:
 
 stdenv.mkDerivation {
   pname = "ubus";
@@ -14,7 +14,7 @@ stdenv.mkDerivation {
   buildInputs = [ libubox libjson ];
   nativeBuildInputs = [ cmake ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "OpenWrt system message/RPC bus";
     homepage = "https://git.openwrt.org/?p=project/ubus.git;a=summary";
     license = licenses.lgpl21;
diff --git a/pkgs/development/libraries/uci/default.nix b/pkgs/development/libraries/uci/default.nix
index 951e62cae0dca..0a5af8b907b8b 100644
--- a/pkgs/development/libraries/uci/default.nix
+++ b/pkgs/development/libraries/uci/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, cmake, fetchgit, pkg-config, libubox }:
+{ lib, stdenv, cmake, fetchgit, pkg-config, libubox }:
 
 stdenv.mkDerivation {
   pname = "uci";
@@ -15,7 +15,7 @@ stdenv.mkDerivation {
   buildInputs = [ libubox ];
   nativeBuildInputs = [ cmake pkg-config ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "OpenWrt Unified Configuration Interface";
     homepage = "https://git.openwrt.org/?p=project/uci.git;a=summary";
     license = licenses.lgpl21;
diff --git a/pkgs/development/libraries/ucl/default.nix b/pkgs/development/libraries/ucl/default.nix
index f25a63137526b..43f7ddf63af95 100644
--- a/pkgs/development/libraries/ucl/default.nix
+++ b/pkgs/development/libraries/ucl/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation {
   name = "ucl-1.03";
@@ -8,12 +8,12 @@ stdenv.mkDerivation {
   };
 
   # needed to successfully compile with gcc 6
-  NIX_CFLAGS_COMPILE = stdenv.lib.optionalString stdenv.cc.isGNU "-std=c90";
+  NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isGNU "-std=c90";
 
   meta = {
     homepage = "http://www.oberhumer.com/opensource/ucl/";
     description = "Portable lossless data compression library";
-    license = stdenv.lib.licenses.gpl2;
-    platforms = stdenv.lib.platforms.unix;
+    license = lib.licenses.gpl2;
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/ucommon/default.nix b/pkgs/development/libraries/ucommon/default.nix
index 5b1af300bab10..7cfd9f1edf5c9 100644
--- a/pkgs/development/libraries/ucommon/default.nix
+++ b/pkgs/development/libraries/ucommon/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config
+{ lib, stdenv, fetchurl, pkg-config
 , openssl ? null, zlib ? null, gnutls ? null
 }:
 
@@ -33,9 +33,9 @@ stdenv.mkDerivation rec {
   meta = {
     description = "C++ library to facilitate using C++ design patterns";
     homepage = "https://www.gnu.org/software/commoncpp/";
-    license = stdenv.lib.licenses.lgpl3Plus;
+    license = lib.licenses.lgpl3Plus;
 
-    maintainers = with stdenv.lib.maintainers; [ ];
-    platforms = stdenv.lib.platforms.linux;
+    maintainers = with lib.maintainers; [ ];
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/development/libraries/ucx/default.nix b/pkgs/development/libraries/ucx/default.nix
index a4120b7ba43b2..fae81276878e1 100644
--- a/pkgs/development/libraries/ucx/default.nix
+++ b/pkgs/development/libraries/ucx/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, autoreconfHook, doxygen
+{ lib, stdenv, fetchFromGitHub, autoreconfHook, doxygen
 , numactl, rdma-core, libbfd, libiberty, perl, zlib
 }:
 
@@ -29,7 +29,7 @@ in stdenv.mkDerivation {
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Unified Communication X library";
     homepage = "http://www.openucx.org";
     license = licenses.bsd3;
diff --git a/pkgs/development/libraries/udns/default.nix b/pkgs/development/libraries/udns/default.nix
index 41fb6e7abff62..fc0b4a42b55d0 100644
--- a/pkgs/development/libraries/udns/default.nix
+++ b/pkgs/development/libraries/udns/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 # this expression is mostly based on debian's packaging
 # https://tracker.debian.org/media/packages/u/udns/rules-0.4-1
@@ -35,7 +35,7 @@ stdenv.mkDerivation rec {
   # keep man3
   outputDevdoc = "out";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://www.corpit.ru/mjt/udns.html";
     description = "Async-capable DNS stub resolver library";
     license = licenses.lgpl21Plus;
diff --git a/pkgs/development/libraries/udunits/default.nix b/pkgs/development/libraries/udunits/default.nix
index 6b75b7e683fb7..deed5b64d2c55 100644
--- a/pkgs/development/libraries/udunits/default.nix
+++ b/pkgs/development/libraries/udunits/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, autoreconfHook,
+{ lib, stdenv, fetchFromGitHub, autoreconfHook,
   texinfo, bison, flex, expat, file
 }:
 
@@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ autoreconfHook texinfo bison flex file ];
   buildInputs = [ expat ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://www.unidata.ucar.edu/software/udunits/";
     description = "A C-based package for the programatic handling of units of physical quantities";
     license = licenses.bsdOriginal;
diff --git a/pkgs/development/libraries/uid_wrapper/default.nix b/pkgs/development/libraries/uid_wrapper/default.nix
index 62c105f3b9035..ec7626a7e8bcf 100644
--- a/pkgs/development/libraries/uid_wrapper/default.nix
+++ b/pkgs/development/libraries/uid_wrapper/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, cmake, pkg-config }:
+{ lib, stdenv, fetchurl, cmake, pkg-config }:
 
 stdenv.mkDerivation rec {
   name = "uid_wrapper-1.2.8";
@@ -10,7 +10,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ cmake pkg-config ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A wrapper for the user, group and hosts NSS API";
     homepage = "https://git.samba.org/?p=uid_wrapper.git;a=summary;";
     license = licenses.bsd3;
diff --git a/pkgs/development/libraries/umockdev/default.nix b/pkgs/development/libraries/umockdev/default.nix
index 5050650635f42..d27adb2a061df 100644
--- a/pkgs/development/libraries/umockdev/default.nix
+++ b/pkgs/development/libraries/umockdev/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , docbook_xsl
 , fetchurl
 , glib
@@ -53,7 +53,7 @@ stdenv.mkDerivation rec {
     mv docs/reference $doc/share/doc/umockdev/
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Mock hardware devices for creating unit tests";
     license = licenses.lgpl2;
     maintainers = with maintainers; [ flokli ];
diff --git a/pkgs/development/libraries/unibilium/default.nix b/pkgs/development/libraries/unibilium/default.nix
index da5dc2fed7a81..f5fd4f82bae28 100644
--- a/pkgs/development/libraries/unibilium/default.nix
+++ b/pkgs/development/libraries/unibilium/default.nix
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
   };
 
   makeFlags = [ "PREFIX=$(out)" ]
-    ++ stdenv.lib.optional stdenv.isDarwin "LIBTOOL=${libtool}/bin/libtool";
+    ++ lib.optional stdenv.isDarwin "LIBTOOL=${libtool}/bin/libtool";
 
   nativeBuildInputs = [ pkg-config perl ];
   buildInputs = [ libtool ncurses ];
diff --git a/pkgs/development/libraries/unicap/default.nix b/pkgs/development/libraries/unicap/default.nix
index 87ca28fee9830..17e91f7e23650 100644
--- a/pkgs/development/libraries/unicap/default.nix
+++ b/pkgs/development/libraries/unicap/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, libusb-compat-0_1, libraw1394, dcraw, intltool, perl, v4l-utils }:
+{ lib, stdenv, fetchurl, libusb-compat-0_1, libraw1394, dcraw, intltool, perl, v4l-utils }:
 
 stdenv.mkDerivation rec {
   pname = "libunicap";
@@ -24,7 +24,7 @@ stdenv.mkDerivation rec {
     sed -e 's@/etc/udev@'"$out"'/&@' -i data/Makefile.*
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Universal video capture API";
     homepage = "http://www.unicap-imaging.org/";
     maintainers = [ maintainers.raskin ];
diff --git a/pkgs/development/libraries/unicorn/default.nix b/pkgs/development/libraries/unicorn/default.nix
index ce3dfa24faa47..7f768d9631bb8 100644
--- a/pkgs/development/libraries/unicorn/default.nix
+++ b/pkgs/development/libraries/unicorn/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , pkg-config
 , cmake
@@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ pkg-config cmake ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Lightweight multi-platform CPU emulator library";
     homepage = "http://www.unicorn-engine.org";
     license = licenses.gpl2Only;
diff --git a/pkgs/development/libraries/unittest-cpp/default.nix b/pkgs/development/libraries/unittest-cpp/default.nix
index 17b64d99971b3..d185d32c816fa 100644
--- a/pkgs/development/libraries/unittest-cpp/default.nix
+++ b/pkgs/development/libraries/unittest-cpp/default.nix
@@ -1,6 +1,6 @@
-{stdenv, fetchFromGitHub, cmake}:
+{lib, stdenv, fetchFromGitHub, cmake}:
 
-with stdenv.lib;
+with lib;
 
 stdenv.mkDerivation rec {
   pname = "unittest-cpp";
@@ -22,6 +22,6 @@ stdenv.mkDerivation rec {
     description = "Lightweight unit testing framework for C++";
     license = licenses.mit;
     maintainers = [];
-    platforms = stdenv.lib.platforms.unix;
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/unixODBC/default.nix b/pkgs/development/libraries/unixODBC/default.nix
index a4fcac2a35807..8b2558c08504f 100644
--- a/pkgs/development/libraries/unixODBC/default.nix
+++ b/pkgs/development/libraries/unixODBC/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
   pname = "unixODBC";
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
 
   configureFlags = [ "--disable-gui" "--sysconfdir=/etc" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "ODBC driver manager for Unix";
     homepage = "http://www.unixodbc.org/";
     license = licenses.lgpl2;
diff --git a/pkgs/development/libraries/unixODBCDrivers/default.nix b/pkgs/development/libraries/unixODBCDrivers/default.nix
index 04aa7e6c68546..edbe51998c3ea 100644
--- a/pkgs/development/libraries/unixODBCDrivers/default.nix
+++ b/pkgs/development/libraries/unixODBCDrivers/default.nix
@@ -19,7 +19,7 @@
       driver = "lib/psqlodbcw.so";
     };
 
-    meta = with stdenv.lib; {
+    meta = with lib; {
       description = "Official PostgreSQL ODBC Driver";
       homepage =  "https://odbc.postgresql.org/";
       license = licenses.lgpl2;
@@ -60,7 +60,7 @@
       driver = if stdenv.isDarwin then "lib/libmaodbc.dylib" else "lib/libmaodbc.so";
     };
 
-    meta = with stdenv.lib; {
+    meta = with lib; {
       description = "MariaDB ODBC database driver";
       homepage =  "https://downloads.mariadb.org/connector-odbc/";
       license = licenses.gpl2;
@@ -88,7 +88,7 @@
       driver = "lib/libmyodbc3-3.51.12.so";
     };
 
-    meta = with stdenv.lib; {
+    meta = with lib; {
       description = "MariaDB ODBC database driver";
       homepage = "https://dev.mysql.com/downloads/connector/odbc/";
       license = licenses.gpl2;
@@ -123,7 +123,7 @@
       driver = "lib/libsqlite3odbc.so";
     };
 
-    meta = with stdenv.lib; {
+    meta = with lib; {
       description = "ODBC driver for SQLite";
       homepage = "http://www.ch-werner.de/sqliteodbc";
       license = licenses.bsd2;
@@ -166,7 +166,7 @@
       driver = "lib/libmsodbcsql-${versionMajor}.${versionMinor}.so.${versionAdditional}";
     };
 
-    meta = with stdenv.lib; {
+    meta = with lib; {
       description = "ODBC Driver 17 for SQL Server";
       homepage = "https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server?view=sql-server-2017";
       license = licenses.unfree;
diff --git a/pkgs/development/libraries/unqlite/default.nix b/pkgs/development/libraries/unqlite/default.nix
index 9d0ab3868565e..c0e405c8849c9 100644
--- a/pkgs/development/libraries/unqlite/default.nix
+++ b/pkgs/development/libraries/unqlite/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , cmake }:
 
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ cmake ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://unqlite.org/";
     description = "Self-contained, serverless, zero-conf, transactional NoSQL DB library";
     longDescription = ''
diff --git a/pkgs/development/libraries/uri/default.nix b/pkgs/development/libraries/uri/default.nix
index c96629072f99b..48a80aacdf59f 100644
--- a/pkgs/development/libraries/uri/default.nix
+++ b/pkgs/development/libraries/uri/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, doxygen }:
+{ lib, stdenv, fetchFromGitHub, cmake, doxygen }:
 
 stdenv.mkDerivation rec {
   name = "uri-${version}";
@@ -29,7 +29,7 @@ stdenv.mkDerivation rec {
   meta = {
     description = "C++ URI library";
     homepage = "https://cpp-netlib.org";
-    license = stdenv.lib.licenses.boost;
-    platforms = stdenv.lib.platforms.all;
+    license = lib.licenses.boost;
+    platforms = lib.platforms.all;
   };
 }
diff --git a/pkgs/development/libraries/uriparser/default.nix b/pkgs/development/libraries/uriparser/default.nix
index a12f040bf49c9..ad17199848070 100644
--- a/pkgs/development/libraries/uriparser/default.nix
+++ b/pkgs/development/libraries/uriparser/default.nix
@@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
   checkInputs = [ gtest ];
   doCheck = stdenv.targetPlatform.system == stdenv.hostPlatform.system;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://uriparser.github.io/";
     description = "Strictly RFC 3986 compliant URI parsing library";
     longDescription = ''
diff --git a/pkgs/development/libraries/usbredir/default.nix b/pkgs/development/libraries/usbredir/default.nix
index 159296facc4b7..0313b8c81ef25 100644
--- a/pkgs/development/libraries/usbredir/default.nix
+++ b/pkgs/development/libraries/usbredir/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, libusb1 }:
+{ lib, stdenv, fetchurl, pkg-config, libusb1 }:
 
 stdenv.mkDerivation rec {
   pname = "usbredir";
@@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
 
   outputs = [ "out" "dev" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "USB traffic redirection protocol";
     homepage = "https://www.spice-space.org/usbredir.html";
     license = licenses.lgpl21;
diff --git a/pkgs/development/libraries/ustr/default.nix b/pkgs/development/libraries/ustr/default.nix
index b6bb02d56e440..2b04d8c0c5b78 100644
--- a/pkgs/development/libraries/ustr/default.nix
+++ b/pkgs/development/libraries/ustr/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
   pname = "ustr";
@@ -32,7 +32,7 @@ stdenv.mkDerivation rec {
     find $out/lib -name \*debug\* -delete
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://www.and.org/ustr/";
     description = "Micro String API for C language";
     license = licenses.bsd2;
diff --git a/pkgs/development/libraries/utf8cpp/default.nix b/pkgs/development/libraries/utf8cpp/default.nix
index ef02ca2c31341..e627b97849a0a 100644
--- a/pkgs/development/libraries/utf8cpp/default.nix
+++ b/pkgs/development/libraries/utf8cpp/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake }:
+{ lib, stdenv, fetchFromGitHub, cmake }:
 
 stdenv.mkDerivation rec {
   pname = "utf8cpp";
@@ -22,7 +22,7 @@ stdenv.mkDerivation rec {
 
   doCheck = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/nemtrif/utfcpp";
     description = "UTF-8 with C++ in a Portable Way";
     license = licenses.free;
diff --git a/pkgs/development/libraries/utf8proc/default.nix b/pkgs/development/libraries/utf8proc/default.nix
index ea455e2c92c17..b78999e96a767 100644
--- a/pkgs/development/libraries/utf8proc/default.nix
+++ b/pkgs/development/libraries/utf8proc/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake }:
+{ lib, stdenv, fetchFromGitHub, cmake }:
 
 stdenv.mkDerivation rec {
   pname = "utf8proc";
@@ -27,7 +27,7 @@ stdenv.mkDerivation rec {
 
   doCheck = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A clean C library for processing UTF-8 Unicode data";
     homepage = "https://juliastrings.github.io/utf8proc/";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/uthash/default.nix b/pkgs/development/libraries/uthash/default.nix
index d2c5b6ab11d65..7ddae062f7660 100644
--- a/pkgs/development/libraries/uthash/default.nix
+++ b/pkgs/development/libraries/uthash/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, perl }:
+{ lib, stdenv, fetchurl, perl }:
 
 let
   version = "2.1.0";
@@ -23,7 +23,7 @@ stdenv.mkDerivation {
     cp ./src/* "$out/include/"
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A hash table for C structures";
     homepage    = "http://troydhanson.github.io/uthash";
     license     = licenses.bsd2; # it's one-clause, actually, as it's source-only
diff --git a/pkgs/development/libraries/v8/5_x.nix b/pkgs/development/libraries/v8/5_x.nix
index 050abe9e81bfc..441a5559b527d 100644
--- a/pkgs/development/libraries/v8/5_x.nix
+++ b/pkgs/development/libraries/v8/5_x.nix
@@ -151,11 +151,11 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ which ];
   buildInputs = [ readline python icu ]
-    ++ stdenv.lib.optional stdenv.isDarwin xcbuild
-    ++ stdenv.lib.optional stdenv.isLinux patchelf;
+    ++ lib.optional stdenv.isDarwin xcbuild
+    ++ lib.optional stdenv.isLinux patchelf;
 
   NIX_CFLAGS_COMPILE = "-Wno-error=strict-overflow -Wno-error=unused-function -Wno-error=attributes"
-    + stdenv.lib.optionalString stdenv.cc.isClang " -Wno-error=unused-lambda-capture";
+    + lib.optionalString stdenv.cc.isClang " -Wno-error=unused-lambda-capture";
 
   buildFlags = [
     "LINK=c++"
diff --git a/pkgs/development/libraries/v8/default.nix b/pkgs/development/libraries/v8/default.nix
index 40c551d826a41..c79073f04e4c2 100644
--- a/pkgs/development/libraries/v8/default.nix
+++ b/pkgs/development/libraries/v8/default.nix
@@ -73,7 +73,7 @@ stdenv.mkDerivation rec {
     chmod u+w -R .
   '';
 
-  postPatch = stdenv.lib.optionalString stdenv.isAarch64 ''
+  postPatch = lib.optionalString stdenv.isAarch64 ''
     substituteInPlace build/toolchain/linux/BUILD.gn \
       --replace 'toolprefix = "aarch64-linux-gnu-"' 'toolprefix = ""'
   '';
@@ -95,14 +95,14 @@ stdenv.mkDerivation rec {
     # ''custom_toolchain="//build/toolchain/linux/unbundle:default"''
     ''host_toolchain="//build/toolchain/linux/unbundle:default"''
     ''v8_snapshot_toolchain="//build/toolchain/linux/unbundle:default"''
-  ] ++ stdenv.lib.optional stdenv.cc.isClang ''clang_base_path="${stdenv.cc}"'';
+  ] ++ lib.optional stdenv.cc.isClang ''clang_base_path="${stdenv.cc}"'';
 
   # with gcc8, -Wclass-memaccess became part of -Wall and causes logging limit
   # to be exceeded
-  NIX_CFLAGS_COMPILE = stdenv.lib.optionalString stdenv.cc.isGNU "-Wno-class-memaccess";
+  NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isGNU "-Wno-class-memaccess";
 
   nativeBuildInputs = [ gn ninja pkg-config python ]
-    ++ stdenv.lib.optionals stdenv.isDarwin [ xcbuild darwin.DarwinTools ];
+    ++ lib.optionals stdenv.isDarwin [ xcbuild darwin.DarwinTools ];
   buildInputs = [ glib icu ];
 
   ninjaFlags = [ ":d8" "v8_monolith" ];
diff --git a/pkgs/development/libraries/vaapi-intel-hybrid/default.nix b/pkgs/development/libraries/vaapi-intel-hybrid/default.nix
index c9dba3d00c907..00e9a2042b7a5 100644
--- a/pkgs/development/libraries/vaapi-intel-hybrid/default.nix
+++ b/pkgs/development/libraries/vaapi-intel-hybrid/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, autoreconfHook, pkg-config, cmrt, libdrm, libva, libX11, libGL, wayland }:
+{ lib, stdenv, fetchurl, autoreconfHook, pkg-config, cmrt, libdrm, libva, libX11, libGL, wayland }:
 
 stdenv.mkDerivation rec {
   pname = "intel-hybrid-driver";
@@ -37,7 +37,7 @@ stdenv.mkDerivation rec {
     sed -i -e "s,LIBVA_DRIVERS_PATH=.*,LIBVA_DRIVERS_PATH=$out/lib/dri," configure
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://01.org/linuxmedia";
     description = "Intel driver for the VAAPI library with partial HW acceleration";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/vaapi-intel/default.nix b/pkgs/development/libraries/vaapi-intel/default.nix
index 81edb9caea0dd..f21a947a533f1 100644
--- a/pkgs/development/libraries/vaapi-intel/default.nix
+++ b/pkgs/development/libraries/vaapi-intel/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, autoreconfHook, gnum4, pkg-config, python3
+{ lib, stdenv, fetchFromGitHub, autoreconfHook, gnum4, pkg-config, python3
 , intel-gpu-tools, libdrm, libva, libX11, libGL, wayland, libXext
 , enableHybridCodec ? false, vaapi-intel-hybrid
 }:
@@ -17,23 +17,23 @@ stdenv.mkDerivation rec {
   # Set the correct install path:
   LIBVA_DRIVERS_PATH = "${placeholder "out"}/lib/dri";
 
-  postInstall = stdenv.lib.optionalString enableHybridCodec ''
+  postInstall = lib.optionalString enableHybridCodec ''
     ln -s ${vaapi-intel-hybrid}/lib/dri/* $out/lib/dri/
   '';
 
   configureFlags = [
     "--enable-x11"
     "--enable-wayland"
-  ] ++ stdenv.lib.optional enableHybridCodec "--enable-hybrid-codec";
+  ] ++ lib.optional enableHybridCodec "--enable-hybrid-codec";
 
   nativeBuildInputs = [ autoreconfHook gnum4 pkg-config python3 ];
 
   buildInputs = [ intel-gpu-tools libdrm libva libX11 libXext libGL wayland ]
-    ++ stdenv.lib.optional enableHybridCodec vaapi-intel-hybrid;
+    ++ lib.optional enableHybridCodec vaapi-intel-hybrid;
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://01.org/linuxmedia";
     license = licenses.mit;
     description = "VA-API user mode driver for Intel GEN Graphics family";
diff --git a/pkgs/development/libraries/vaapi-vdpau/default.nix b/pkgs/development/libraries/vaapi-vdpau/default.nix
index 66f6b1c6fa550..fd38eba739747 100644
--- a/pkgs/development/libraries/vaapi-vdpau/default.nix
+++ b/pkgs/development/libraries/vaapi-vdpau/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, fetchpatch, libvdpau, libGLU, libGL, libva, pkg-config }:
+{ lib, stdenv, fetchurl, fetchpatch, libvdpau, libGLU, libGL, libva, pkg-config }:
 
 stdenv.mkDerivation rec {
   pname = "libva-vdpau-driver";
@@ -31,7 +31,7 @@ stdenv.mkDerivation rec {
     sed -i -e "s,LIBVA_DRIVERS_PATH=.*,LIBVA_DRIVERS_PATH=$out/lib/dri," configure
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://cgit.freedesktop.org/vaapi/vdpau-driver";
     license = licenses.gpl2Plus;
     description = "VDPAU driver for the VAAPI library";
diff --git a/pkgs/development/libraries/vapoursynth-mvtools/default.nix b/pkgs/development/libraries/vapoursynth-mvtools/default.nix
index 024976e0b0f29..76ce9a36c7139 100644
--- a/pkgs/development/libraries/vapoursynth-mvtools/default.nix
+++ b/pkgs/development/libraries/vapoursynth-mvtools/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, pkg-config, autoreconfHook,
+{ lib, stdenv, fetchFromGitHub, pkg-config, autoreconfHook,
   vapoursynth, nasm, fftwFloat
 }:
 
@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
 
   configureFlags = [ "--libdir=$(out)/lib/vapoursynth" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A set of filters for motion estimation and compensation";
     homepage = "https://github.com/dubhater/vapoursynth-mvtools";
     license  = licenses.gpl2;
diff --git a/pkgs/development/libraries/vapoursynth/default.nix b/pkgs/development/libraries/vapoursynth/default.nix
index 58ed50f9bd9b6..93f8d3c5ae5fe 100644
--- a/pkgs/development/libraries/vapoursynth/default.nix
+++ b/pkgs/development/libraries/vapoursynth/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, pkg-config, autoreconfHook, makeWrapper
+{ lib, stdenv, fetchFromGitHub, pkg-config, autoreconfHook, makeWrapper
 , zimg, libass, python3, libiconv
 , ApplicationServices
 , ocrSupport ?  false, tesseract ? null
@@ -8,7 +8,7 @@
 assert ocrSupport   -> tesseract != null;
 assert imwriSupport -> imagemagick7 != null;
 
-with stdenv.lib;
+with lib;
 
 stdenv.mkDerivation rec {
   pname = "vapoursynth";
@@ -49,7 +49,7 @@ stdenv.mkDerivation rec {
         --prefix PYTHONPATH : $out/${python3.sitePackages}
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A video processing framework with the future in mind";
     homepage    = "http://www.vapoursynth.com/";
     license     = licenses.lgpl21;
diff --git a/pkgs/development/libraries/vapoursynth/editor.nix b/pkgs/development/libraries/vapoursynth/editor.nix
index 196c700af17a4..76b50a10907e6 100644
--- a/pkgs/development/libraries/vapoursynth/editor.nix
+++ b/pkgs/development/libraries/vapoursynth/editor.nix
@@ -1,4 +1,4 @@
-{ stdenv, mkDerivation, fetchFromBitbucket
+{ lib, stdenv, mkDerivation, fetchFromBitbucket
 , python3, vapoursynth
 , qmake, qtbase, qtwebsockets
 }:
@@ -10,7 +10,7 @@ mkDerivation rec {
   src = fetchFromBitbucket {
     owner = "mystery_keeper";
     repo = pname;
-    rev = stdenv.lib.toLower version;
+    rev = lib.toLower version;
     sha256 = "1zlaynkkvizf128ln50yvzz3b764f5a0yryp6993s9fkwa7djb6n";
   };
 
@@ -33,7 +33,7 @@ mkDerivation rec {
     done
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Cross-platform editor for VapourSynth scripts";
     homepage = "https://bitbucket.org/mystery_keeper/vapoursynth-editor";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/vc/0.7.nix b/pkgs/development/libraries/vc/0.7.nix
index 119254107e9c0..dd5b03f2dc500 100644
--- a/pkgs/development/libraries/vc/0.7.nix
+++ b/pkgs/development/libraries/vc/0.7.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake }:
+{ lib, stdenv, fetchFromGitHub, cmake }:
 
 stdenv.mkDerivation rec {
   pname = "Vc";
@@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
     sed -i '/AutodetectHostArchitecture()/d' print_target_architecture.cmake
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Library for multiprecision complex arithmetic with exact rounding";
     homepage = "https://github.com/VcDevel/Vc";
     license = licenses.bsd3;
diff --git a/pkgs/development/libraries/vc/default.nix b/pkgs/development/libraries/vc/default.nix
index d3673e783cd17..40347940ff047 100644
--- a/pkgs/development/libraries/vc/default.nix
+++ b/pkgs/development/libraries/vc/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake }:
+{ lib, stdenv, fetchFromGitHub, cmake }:
 
 stdenv.mkDerivation rec {
   pname = "Vc";
@@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
     sed -i '/AutodetectHostArchitecture()/d' print_target_architecture.cmake
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Library for multiprecision complex arithmetic with exact rounding";
     homepage = "https://github.com/VcDevel/Vc";
     license = licenses.bsd3;
diff --git a/pkgs/development/libraries/vcg/default.nix b/pkgs/development/libraries/vcg/default.nix
index a8a24750744b9..380f533fe6f75 100644
--- a/pkgs/development/libraries/vcg/default.nix
+++ b/pkgs/development/libraries/vcg/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, eigen }:
+{ lib, stdenv, fetchFromGitHub, eigen }:
 
 stdenv.mkDerivation rec {
   pname = "vcg";
@@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
     find $out -name \*.h -exec sed -i 's,<eigenlib/,<eigen3/,g' {} \;
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://vcg.isti.cnr.it/vcglib/install.html";
     description = "C++ library for manipulation, processing and displaying with OpenGL of triangle and tetrahedral meshes";
     license = licenses.gpl3;
diff --git a/pkgs/development/libraries/vid-stab/default.nix b/pkgs/development/libraries/vid-stab/default.nix
index 2921719e7554e..d224c2f3be58b 100644
--- a/pkgs/development/libraries/vid-stab/default.nix
+++ b/pkgs/development/libraries/vid-stab/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, openmp }:
+{ lib, stdenv, fetchFromGitHub, cmake, openmp }:
 
 stdenv.mkDerivation rec {
   pname = "vid.stab";
@@ -13,9 +13,9 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ cmake ];
 
-  buildInputs = stdenv.lib.optionals stdenv.cc.isClang [ openmp ];
+  buildInputs = lib.optionals stdenv.cc.isClang [ openmp ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Video stabilization library";
     homepage = "http://public.hronopik.de/vid.stab/";
     license = licenses.gpl2Plus;
diff --git a/pkgs/development/libraries/vigra/default.nix b/pkgs/development/libraries/vigra/default.nix
index 7bff0981e7688..56402172d9ff1 100644
--- a/pkgs/development/libraries/vigra/default.nix
+++ b/pkgs/development/libraries/vigra/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, boost, cmake, fftw, fftwSinglePrec, hdf5, ilmbase
+{ lib, stdenv, fetchurl, boost, cmake, fftw, fftwSinglePrec, hdf5, ilmbase
 , libjpeg, libpng, libtiff, openexr, python2Packages }:
 
 let
@@ -9,7 +9,7 @@ in stdenv.mkDerivation rec {
   version = "1.11.1";
 
   src = fetchurl {
-    url = "https://github.com/ukoethe/vigra/archive/Version-${stdenv.lib.replaceChars ["."] ["-"] version}.tar.gz";
+    url = "https://github.com/ukoethe/vigra/archive/Version-${lib.replaceChars ["."] ["-"] version}.tar.gz";
     sha256 = "03i5wfscv83jb8vnwwhfmm8yfiniwkvk13myzhr1kbwbs9884wdj";
   };
 
@@ -28,13 +28,13 @@ in stdenv.mkDerivation rec {
   preConfigure = "cmakeFlags+=\" -DVIGRANUMPY_INSTALL_DIR=$out/lib/${python.libPrefix}/site-packages\"";
 
   cmakeFlags = [ "-DWITH_OPENEXR=1" ]
-            ++ stdenv.lib.optionals (stdenv.hostPlatform.system == "x86_64-linux")
+            ++ lib.optionals (stdenv.hostPlatform.system == "x86_64-linux")
                   [ "-DCMAKE_CXX_FLAGS=-fPIC" "-DCMAKE_C_FLAGS=-fPIC" ];
 
   # fails with "./test_watersheds3d: error while loading shared libraries: libvigraimpex.so.11: cannot open shared object file: No such file or directory"
   doCheck = false;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Novel computer vision C++ library with customizable algorithms and data structures";
     homepage = "https://hci.iwr.uni-heidelberg.de/vigra";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/virglrenderer/default.nix b/pkgs/development/libraries/virglrenderer/default.nix
index fd39d8b30bd89..38688d90246ee 100644
--- a/pkgs/development/libraries/virglrenderer/default.nix
+++ b/pkgs/development/libraries/virglrenderer/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, cmake, meson, ninja, pkg-config, python3
+{ lib, stdenv, fetchurl, cmake, meson, ninja, pkg-config, python3
 , libGLU, epoxy, libX11, libdrm, mesa
 }:
 
@@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
 
   dontUseCmakeConfigure = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A virtual 3D GPU library that allows a qemu guest to use the host GPU for accelerated 3D rendering";
     homepage = "https://virgil3d.github.io/";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/vmime/default.nix b/pkgs/development/libraries/vmime/default.nix
index a28f63cd3c432..3f33df66339e2 100644
--- a/pkgs/development/libraries/vmime/default.nix
+++ b/pkgs/development/libraries/vmime/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchFromGitHub
+{lib, stdenv, fetchFromGitHub
 , gsasl, gnutls, pkg-config, cmake, zlib, libtasn1, libgcrypt, gtk3
 # this will not work on non-nixos systems
 , sendmailPath ? "/run/wrappers/bin/sendmail"
@@ -24,8 +24,8 @@ stdenv.mkDerivation rec {
   meta = {
     homepage = "https://www.vmime.org/";
     description = "Free mail library for C++";
-    license = stdenv.lib.licenses.gpl3;
-    maintainers = with stdenv.lib.maintainers; [viric];
-    platforms = with stdenv.lib.platforms; linux;
+    license = lib.licenses.gpl3;
+    maintainers = with lib.maintainers; [viric];
+    platforms = with lib.platforms; linux;
   };
 }
diff --git a/pkgs/development/libraries/vmmlib/default.nix b/pkgs/development/libraries/vmmlib/default.nix
index a5eb2c83f94d6..4aa525feb193c 100644
--- a/pkgs/development/libraries/vmmlib/default.nix
+++ b/pkgs/development/libraries/vmmlib/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, pkg-config, boost, lapack
+{ lib, stdenv, fetchFromGitHub, cmake, pkg-config, boost, lapack
 , Accelerate, CoreGraphics, CoreVideo
 }:
 
@@ -19,13 +19,13 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ pkg-config cmake ];
   buildInputs = [ boost lapack ]
-    ++ stdenv.lib.optionals stdenv.isDarwin [ Accelerate CoreGraphics CoreVideo ];
+    ++ lib.optionals stdenv.isDarwin [ Accelerate CoreGraphics CoreVideo ];
 
   doCheck = !stdenv.isDarwin;
 
   checkTarget = "test";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A vector and matrix math library implemented using C++ templates";
 
     longDescription = ''vmmlib is a vector and matrix math library implemented
diff --git a/pkgs/development/libraries/vo-amrwbenc/default.nix b/pkgs/development/libraries/vo-amrwbenc/default.nix
index 9f35bf4ad84eb..dccbd1349d2cd 100644
--- a/pkgs/development/libraries/vo-amrwbenc/default.nix
+++ b/pkgs/development/libraries/vo-amrwbenc/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, autoreconfHook }:
+{ lib, stdenv, fetchurl, autoreconfHook }:
 
 let
     version = "0.1.3";
@@ -15,8 +15,8 @@ stdenv.mkDerivation {
   meta = {
     homepage = "https://sourceforge.net/projects/opencore-amr/";
     description = "VisualOn Adaptive Multi Rate Wideband (AMR-WB) encoder";
-    license = stdenv.lib.licenses.asl20;
-    maintainers = [ stdenv.lib.maintainers.Esteth ];
-    platforms = stdenv.lib.platforms.unix;
+    license = lib.licenses.asl20;
+    maintainers = [ lib.maintainers.Esteth ];
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/volume-key/default.nix b/pkgs/development/libraries/volume-key/default.nix
index 85736b79b1f28..567a5e3e251a9 100644
--- a/pkgs/development/libraries/volume-key/default.nix
+++ b/pkgs/development/libraries/volume-key/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchgit, autoreconfHook, pkg-config, gettext, python3
+{ lib, stdenv, fetchgit, autoreconfHook, pkg-config, gettext, python3
 , ncurses, swig, glib, util-linux, cryptsetup, nss, gpgme
 , autoconf, automake, libtool
 , buildPackages
@@ -38,7 +38,7 @@ in stdenv.mkDerivation {
 
   doCheck = false; # fails 1 out of 1 tests, needs `certutil`
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A library for manipulating storage volume encryption keys and storing them separately from volumes to handle forgotten passphrases, and the associated command-line tool";
     homepage = "https://pagure.io/volume_key/";
     license = licenses.gpl2;
diff --git a/pkgs/development/libraries/vrb/default.nix b/pkgs/development/libraries/vrb/default.nix
index a85e27d42b7cf..1ebc37cdf2f33 100644
--- a/pkgs/development/libraries/vrb/default.nix
+++ b/pkgs/development/libraries/vrb/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
   pname = "vrb";
@@ -23,7 +23,7 @@ stdenv.mkDerivation rec {
     cp -p vrb/man/man3/*.3 $out/share/man/man3/
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A virtual ring buffer library written in C";
     license     = licenses.lgpl21;
     homepage    = "http://vrb.sourceforge.net/";
diff --git a/pkgs/development/libraries/vrpn/default.nix b/pkgs/development/libraries/vrpn/default.nix
index 85d6fba459d64..f9eed6b2f747e 100644
--- a/pkgs/development/libraries/vrpn/default.nix
+++ b/pkgs/development/libraries/vrpn/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, unzip, cmake, libGLU, libGL }:
+{ lib, stdenv, fetchFromGitHub, unzip, cmake, libGLU, libGL }:
 
 stdenv.mkDerivation rec {
   name    = "${pname}-${date}";
@@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
   doCheck = false; # FIXME: test failure
   checkTarget = "test";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Virtual Reality Peripheral Network";
     longDescription = ''
       The Virtual-Reality Peripheral Network (VRPN) is a set of classes
diff --git a/pkgs/development/libraries/vsqlite/default.nix b/pkgs/development/libraries/vsqlite/default.nix
index a4c9cb556b9b9..6981de6aa0742 100644
--- a/pkgs/development/libraries/vsqlite/default.nix
+++ b/pkgs/development/libraries/vsqlite/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, boost, sqlite }:
+{ lib, stdenv, fetchurl, boost, sqlite }:
 
 stdenv.mkDerivation rec {
   pname = "vsqlite";
@@ -11,14 +11,14 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ boost sqlite ];
 
-  prePatch = stdenv.lib.optionalString stdenv.isDarwin ''
+  prePatch = lib.optionalString stdenv.isDarwin ''
     substituteInPlace Makefile.in \
         --replace '-Wl,--as-needed' "" \
         --replace '-Wl,-soname -Wl,libvsqlitepp.so.3' \
                   "-Wl,-install_name,$out/lib/libvsqlitepp.3.dylib"
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://vsqlite.virtuosic-bytes.com/";
     description = "C++ wrapper library for sqlite";
     license = licenses.bsd3;
diff --git a/pkgs/development/libraries/vte/2.90.nix b/pkgs/development/libraries/vte/2.90.nix
index 6b65014103e25..4a9e4d8a66c90 100644
--- a/pkgs/development/libraries/vte/2.90.nix
+++ b/pkgs/development/libraries/vte/2.90.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, intltool, pkg-config, glib, gtk3, ncurses, gobject-introspection }:
+{ lib, stdenv, fetchurl, intltool, pkg-config, glib, gtk3, ncurses, gobject-introspection }:
 
 stdenv.mkDerivation rec {
   versionMajor = "0.36";
@@ -23,7 +23,7 @@ stdenv.mkDerivation rec {
     substituteInPlace $out/lib/libvte2_90.la --replace "-lncurses" "-L${ncurses.out}/lib -lncurses"
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://www.gnome.org/";
     description = "A library implementing a terminal emulator widget for GTK";
     longDescription = ''
diff --git a/pkgs/development/libraries/vte/default.nix b/pkgs/development/libraries/vte/default.nix
index 2ccc07c67a2cb..9f2722a9ae8f8 100644
--- a/pkgs/development/libraries/vte/default.nix
+++ b/pkgs/development/libraries/vte/default.nix
@@ -29,7 +29,7 @@ stdenv.mkDerivation rec {
   outputs = [ "out" "dev" ];
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "139had0zcggzrxx9rjy0a67mahzm474amafh168y11421iyfhsf3";
   };
 
@@ -80,7 +80,7 @@ stdenv.mkDerivation rec {
     patchShebangs src/box_drawing_generate.sh
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://www.gnome.org/";
     description = "A library implementing a terminal emulator widget for GTK";
     longDescription = ''
diff --git a/pkgs/development/libraries/vulkan-headers/default.nix b/pkgs/development/libraries/vulkan-headers/default.nix
index 154ed9deb490b..f065b83bcc840 100644
--- a/pkgs/development/libraries/vulkan-headers/default.nix
+++ b/pkgs/development/libraries/vulkan-headers/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake }:
+{ lib, stdenv, fetchFromGitHub, cmake }:
 stdenv.mkDerivation rec {
   pname = "vulkan-headers";
   version = "1.2.162.0";
@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
     sha256 = "057c49w1138l02v9gqsk1z8wdz0iilp96jblnldycwm9jc1a1ipq";
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Vulkan Header files and API registry";
     homepage    = "https://www.lunarg.com";
     platforms   = platforms.linux;
diff --git a/pkgs/development/libraries/vulkan-loader/default.nix b/pkgs/development/libraries/vulkan-loader/default.nix
index d84587b00d249..c833d770aeaf4 100644
--- a/pkgs/development/libraries/vulkan-loader/default.nix
+++ b/pkgs/development/libraries/vulkan-loader/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, python3, vulkan-headers, pkg-config
+{ lib, stdenv, fetchFromGitHub, cmake, python3, vulkan-headers, pkg-config
 , xlibsWrapper, libxcb, libXrandr, libXext, wayland, addOpenGLRunpath }:
 
 stdenv.mkDerivation rec {
@@ -28,7 +28,7 @@ stdenv.mkDerivation rec {
 
   outputs = [ "out" "dev" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "LunarG Vulkan loader";
     homepage    = "https://www.lunarg.com";
     platforms   = platforms.linux;
diff --git a/pkgs/development/libraries/vxl/default.nix b/pkgs/development/libraries/vxl/default.nix
index b6543b2e6cf9f..6858cd93ab36e 100644
--- a/pkgs/development/libraries/vxl/default.nix
+++ b/pkgs/development/libraries/vxl/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, unzip, cmake, libtiff, expat, zlib, libpng, libjpeg }:
+{ lib, stdenv, fetchFromGitHub, unzip, cmake, libtiff, expat, zlib, libpng, libjpeg }:
 stdenv.mkDerivation {
   name = "vxl-1.17.0-nix1";
 
@@ -19,7 +19,7 @@ stdenv.mkDerivation {
     # BUILD_BRL fails to find open()
     "-DBUILD_BRL=OFF"
     "-DBUILD_CONTRIB=OFF"
-  ] ++ stdenv.lib.optionals (stdenv.hostPlatform.system == "x86_64-linux") [
+  ] ++ lib.optionals (stdenv.hostPlatform.system == "x86_64-linux") [
     "-DCMAKE_CXX_FLAGS=-fPIC"
     "-DCMAKE_C_FLAGS=-fPIC"
   ];
@@ -28,7 +28,7 @@ stdenv.mkDerivation {
     description = "C++ Libraries for Computer Vision Research and Implementation";
     homepage = "http://vxl.sourceforge.net/";
     license = "VXL License";
-    maintainers = with stdenv.lib.maintainers; [viric];
-    platforms = with stdenv.lib.platforms; linux;
+    maintainers = with lib.maintainers; [viric];
+    platforms = with lib.platforms; linux;
   };
 }
diff --git a/pkgs/development/libraries/waffle/default.nix b/pkgs/development/libraries/waffle/default.nix
index 0f1e36b35795c..dd783036f2307 100644
--- a/pkgs/development/libraries/waffle/default.nix
+++ b/pkgs/development/libraries/waffle/default.nix
@@ -32,14 +32,14 @@ stdenv.mkDerivation rec {
 
   buildInputs = [
     libGL
-  ] ++ stdenv.lib.optionals (with stdenv.hostPlatform; isUnix && !isDarwin) [
+  ] ++ lib.optionals (with stdenv.hostPlatform; isUnix && !isDarwin) [
     libglvnd
-  ] ++ stdenv.lib.optionals x11Support [
+  ] ++ lib.optionals x11Support [
     libX11
     libxcb
-  ] ++ stdenv.lib.optionals waylandSupport [
+  ] ++ lib.optionals waylandSupport [
     wayland
-  ] ++ stdenv.lib.optionals useGbm [
+  ] ++ lib.optionals useGbm [
     mesa
     libudev
   ];
@@ -54,7 +54,7 @@ stdenv.mkDerivation rec {
 
   postInstall = ''
     wrapProgram $out/bin/wflinfo \
-      --prefix LD_LIBRARY_PATH : ${stdenv.lib.makeLibraryPath [ libGL libglvnd ]}
+      --prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ libGL libglvnd ]}
   '';
 
   meta = with lib; {
diff --git a/pkgs/development/libraries/wasilibc/default.nix b/pkgs/development/libraries/wasilibc/default.nix
index bca025d622af1..f8142f046b746 100644
--- a/pkgs/development/libraries/wasilibc/default.nix
+++ b/pkgs/development/libraries/wasilibc/default.nix
@@ -20,7 +20,7 @@ stdenv.mkDerivation {
     ln -s $out/share/wasm32-wasi/undefined-symbols.txt $out/lib/wasi.imports
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "WASI libc implementation for WebAssembly";
     homepage    = "https://wasi.dev";
     platforms   = platforms.wasi;
diff --git a/pkgs/development/libraries/wavpack/default.nix b/pkgs/development/libraries/wavpack/default.nix
index 78794430860c6..41f3076dbe942 100644
--- a/pkgs/development/libraries/wavpack/default.nix
+++ b/pkgs/development/libraries/wavpack/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, libiconv }:
+{ lib, stdenv, fetchurl, libiconv }:
 
 stdenv.mkDerivation rec {
   pname = "wavpack";
@@ -6,14 +6,14 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  buildInputs = stdenv.lib.optional stdenv.isDarwin libiconv;
+  buildInputs = lib.optional stdenv.isDarwin libiconv;
 
   src = fetchurl {
     url = "http://www.wavpack.com/${pname}-${version}.tar.bz2";
     sha256 = "00baiag7rlkzc6545dqdp4p5sr7xc3n97n7qdkgx58c544x0pw5n";
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Hybrid audio compression format";
     homepage    = "http://www.wavpack.com/";
     license     = licenses.bsd3;
diff --git a/pkgs/development/libraries/waylandpp/default.nix b/pkgs/development/libraries/waylandpp/default.nix
index d528d51ed790e..0aa77b771e48b 100644
--- a/pkgs/development/libraries/waylandpp/default.nix
+++ b/pkgs/development/libraries/waylandpp/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , cmake
 , pkg-config
@@ -13,7 +13,7 @@
 
 assert docSupport -> doxygen != null;
 
-with stdenv.lib;
+with lib;
 stdenv.mkDerivation rec {
   pname = "waylandpp";
   version = "0.2.8";
@@ -27,7 +27,7 @@ stdenv.mkDerivation rec {
 
   cmakeFlags = [
     "-DCMAKE_INSTALL_DATADIR=${placeholder "dev"}"
-  ] ++ stdenv.lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
+  ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
     "-DWAYLAND_SCANNERPP=${buildPackages.waylandpp}/bin/wayland-scanner++"
   ];
 
@@ -36,7 +36,7 @@ stdenv.mkDerivation rec {
 
   outputs = [ "bin" "dev" "lib" "out" ] ++ optionals docSupport [ "doc" "devman" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Wayland C++ binding";
     homepage = "https://github.com/NilsBrause/waylandpp/";
     license = with licenses; [ bsd2 hpnd ];
diff --git a/pkgs/development/libraries/wcslib/default.nix b/pkgs/development/libraries/wcslib/default.nix
index 2b3414df1a4b1..c12118a99de46 100644
--- a/pkgs/development/libraries/wcslib/default.nix
+++ b/pkgs/development/libraries/wcslib/default.nix
@@ -1,4 +1,4 @@
-{ fetchurl,  stdenv, flex }:
+{ fetchurl,  lib, stdenv, flex }:
 
 stdenv.mkDerivation rec {
   version = "7.3.1";
@@ -27,7 +27,7 @@ stdenv.mkDerivation rec {
     systems. This is the standard library for this purpose in
     astronomy.'';
 
-    license = stdenv.lib.licenses.lgpl3Plus;
-    platforms = stdenv.lib.platforms.unix;
+    license = lib.licenses.lgpl3Plus;
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/webkitgtk/default.nix b/pkgs/development/libraries/webkitgtk/default.nix
index 0a58e997c224f..1abfd3a9194c4 100644
--- a/pkgs/development/libraries/webkitgtk/default.nix
+++ b/pkgs/development/libraries/webkitgtk/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , perl
 , python3
@@ -57,7 +57,7 @@
 
 assert enableGeoLocation -> geoclue2 != null;
 
-with stdenv.lib;
+with lib;
 
 stdenv.mkDerivation rec {
   pname = "webkitgtk";
@@ -80,7 +80,7 @@ stdenv.mkDerivation rec {
     ./libglvnd-headers.patch
   ];
 
-  preConfigure = stdenv.lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) ''
+  preConfigure = lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) ''
     # Ignore gettext in cmake_prefix_path so that find_program doesn't
     # pick up the wrong gettext. TODO: Find a better solution for
     # this, maybe make cmake not look up executables in
@@ -100,7 +100,7 @@ stdenv.mkDerivation rec {
     python3
     ruby
     glib # for gdbus-codegen
-  ] ++ stdenv.lib.optionals stdenv.isLinux [
+  ] ++ lib.optionals stdenv.isLinux [
     wayland # for wayland-scanner
   ];
 
diff --git a/pkgs/development/libraries/webrtc-audio-processing/default.nix b/pkgs/development/libraries/webrtc-audio-processing/default.nix
index 91d93352da1b1..efd2ce3b1fccb 100644
--- a/pkgs/development/libraries/webrtc-audio-processing/default.nix
+++ b/pkgs/development/libraries/webrtc-audio-processing/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, darwin }:
+{ lib, stdenv, fetchurl, darwin }:
 
 stdenv.mkDerivation rec {
   name = "webrtc-audio-processing-0.3.1";
@@ -8,13 +8,13 @@ stdenv.mkDerivation rec {
     sha256 = "1gsx7k77blfy171b6g3m0k0s0072v6jcawhmx1kjs9w5zlwdkzd0";
   };
 
-  buildInputs = stdenv.lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [ ApplicationServices ]);
+  buildInputs = lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [ ApplicationServices ]);
 
-  patchPhase = stdenv.lib.optionalString stdenv.hostPlatform.isMusl ''
+  patchPhase = lib.optionalString stdenv.hostPlatform.isMusl ''
     substituteInPlace webrtc/base/checks.cc --replace 'defined(__UCLIBC__)' 1
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://www.freedesktop.org/software/pulseaudio/webrtc-audio-processing";
     description = "A more Linux packaging friendly copy of the AudioProcessing module from the WebRTC project";
     license = licenses.bsd3;
diff --git a/pkgs/development/libraries/websocket++/default.nix b/pkgs/development/libraries/websocket++/default.nix
index d04cadb483b02..5c9271f2a85a0 100644
--- a/pkgs/development/libraries/websocket++/default.nix
+++ b/pkgs/development/libraries/websocket++/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake }:
+{ lib, stdenv, fetchFromGitHub, cmake }:
 
 stdenv.mkDerivation rec {
   pname = "websocket++";
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ cmake ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://www.zaphoyd.com/websocketpp/";
     description = "C++/Boost Asio based websocket client/server library";
     license = licenses.bsd3;
diff --git a/pkgs/development/libraries/wildmidi/default.nix b/pkgs/development/libraries/wildmidi/default.nix
index ea63a73fc9253..880823a84732b 100644
--- a/pkgs/development/libraries/wildmidi/default.nix
+++ b/pkgs/development/libraries/wildmidi/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, cmake, alsaLib, freepats }:
+{ lib, stdenv, fetchurl, cmake, alsaLib, freepats }:
 
 stdenv.mkDerivation rec {
   name = "wildmidi-0.4.3";
@@ -23,7 +23,7 @@ stdenv.mkDerivation rec {
     echo "source ${freepats}/freepats.cfg" >> "$out"/etc/wildmidi.cfg
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Software MIDI player and library";
     longDescription = ''
       WildMIDI is a simple software midi player which has a core softsynth
diff --git a/pkgs/development/libraries/wiredtiger/default.nix b/pkgs/development/libraries/wiredtiger/default.nix
index 9a7cee6623eed..7b636e984deef 100644
--- a/pkgs/development/libraries/wiredtiger/default.nix
+++ b/pkgs/development/libraries/wiredtiger/default.nix
@@ -1,11 +1,11 @@
-{ stdenv, fetchFromGitHub, automake, autoconf, libtool
+{ lib, stdenv, fetchFromGitHub, automake, autoconf, libtool
 
 # Optional Dependencies
 , lz4 ? null, snappy ? null, zlib ? null, bzip2 ? null, db ? null
 , gperftools ? null, leveldb ? null
 }:
 
-with stdenv.lib;
+with lib;
 let
   mkFlag = trueStr: falseStr: cond: name: val: "--"
     + (if cond then trueStr else falseStr)
@@ -14,7 +14,7 @@ let
   mkEnable = mkFlag "enable-" "disable-";
   mkWith = mkFlag "with-" "without-";
 
-  shouldUsePkg = pkg: if pkg != null && stdenv.lib.any (stdenv.lib.meta.platformMatch stdenv.hostPlatform) pkg.meta.platforms then pkg else null;
+  shouldUsePkg = pkg: if pkg != null && lib.any (stdenv.lib.meta.platformMatch stdenv.hostPlatform) pkg.meta.platforms then pkg else null;
 
   optLz4 = shouldUsePkg lz4;
   optSnappy = shouldUsePkg snappy;
diff --git a/pkgs/development/libraries/wlroots/default.nix b/pkgs/development/libraries/wlroots/default.nix
index 13132c8cc1c9f..a21179e20259b 100644
--- a/pkgs/development/libraries/wlroots/default.nix
+++ b/pkgs/development/libraries/wlroots/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, meson, ninja, pkg-config, wayland
+{ lib, stdenv, fetchFromGitHub, meson, ninja, pkg-config, wayland
 , libGL, wayland-protocols, libinput, libxkbcommon, pixman
 , xcbutilwm, libX11, libcap, xcbutilimage, xcbutilerrors, mesa
 , libpng, ffmpeg
@@ -40,7 +40,7 @@ stdenv.mkDerivation rec {
     done
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A modular Wayland compositor library";
     longDescription = ''
       Pluggable, composable, unopinionated modules for building a Wayland
diff --git a/pkgs/development/libraries/wolfssl/default.nix b/pkgs/development/libraries/wolfssl/default.nix
index 30fc90ec8c098..c0c0218a318fe 100644
--- a/pkgs/development/libraries/wolfssl/default.nix
+++ b/pkgs/development/libraries/wolfssl/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, autoreconfHook }:
+{ lib, stdenv, fetchFromGitHub, autoreconfHook }:
 
 stdenv.mkDerivation rec {
   pname = "wolfssl";
@@ -25,11 +25,11 @@ stdenv.mkDerivation rec {
      mkdir -p "$out"
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A small, fast, portable implementation of TLS/SSL for embedded devices";
     homepage    = "https://www.wolfssl.com/";
     platforms   = platforms.all;
-    license = stdenv.lib.licenses.gpl2;
+    license = lib.licenses.gpl2;
     maintainers = with maintainers; [ mcmtroffaes ];
   };
 }
diff --git a/pkgs/development/libraries/wt/default.nix b/pkgs/development/libraries/wt/default.nix
index de98a11d68e56..8887c4410f4c4 100644
--- a/pkgs/development/libraries/wt/default.nix
+++ b/pkgs/development/libraries/wt/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, boost, pkg-config, doxygen, qt48Full, libharu
+{ lib, stdenv, fetchFromGitHub, cmake, boost, pkg-config, doxygen, qt48Full, libharu
 , pango, fcgi, firebird, libmysqlclient, postgresql, graphicsmagick, glew, openssl
 , pcre, harfbuzz
 }:
@@ -28,16 +28,16 @@ let
         "-DWT_CPP_11_MODE=-std=c++11"
         "--no-warn-unused-cli"
       ]
-      ++ stdenv.lib.optionals (graphicsmagick != null) [
+      ++ lib.optionals (graphicsmagick != null) [
         "-DWT_WRASTERIMAGE_IMPLEMENTATION=GraphicsMagick"
         "-DGM_PREFIX=${graphicsmagick}"
       ]
-      ++ stdenv.lib.optional (harfbuzz != null)
+      ++ lib.optional (harfbuzz != null)
         "-DHARFBUZZ_INCLUDE_DIR=${harfbuzz.dev}/include"
-      ++ stdenv.lib.optional (libmysqlclient != null)
+      ++ lib.optional (libmysqlclient != null)
         "-DMYSQL_PREFIX=${libmysqlclient}";
 
-      meta = with stdenv.lib; {
+      meta = with lib; {
         homepage = "https://www.webtoolkit.eu/wt";
         description = "C++ library for developing web applications";
         platforms = platforms.linux;
diff --git a/pkgs/development/libraries/wtk/default.nix b/pkgs/development/libraries/wtk/default.nix
index d66a628dac79c..9ddc95a9ccc7b 100644
--- a/pkgs/development/libraries/wtk/default.nix
+++ b/pkgs/development/libraries/wtk/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, requireFile, unzip, xorg }:
+{ lib, stdenv, requireFile, unzip, xorg }:
 
 assert stdenv.hostPlatform.system == "i686-linux";
 
@@ -20,6 +20,6 @@ stdenv.mkDerivation rec {
   meta = {
     homepage = "http://java.sun.com/products/sjwtoolkit/download.html";
     description = "Sun Java Wireless Toolkit 2.5.2_01 for CLDC";
-    license = stdenv.lib.licenses.unfree;
+    license = lib.licenses.unfree;
   };
 }
diff --git a/pkgs/development/libraries/wxSVG/default.nix b/pkgs/development/libraries/wxSVG/default.nix
index 0ababf305c8ea..5e7f7b71fbe55 100644
--- a/pkgs/development/libraries/wxSVG/default.nix
+++ b/pkgs/development/libraries/wxSVG/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl
+{ lib, stdenv, fetchurl
 , pkg-config, wxGTK
 , ffmpeg_3, libexif
 , cairo, pango }:
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ cairo pango ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A SVG manipulation library built with wxWidgets";
     longDescription = ''
     wxSVG is C++ library to create, manipulate and render
diff --git a/pkgs/development/libraries/wxsqlite3/default.nix b/pkgs/development/libraries/wxsqlite3/default.nix
index db5e91b74d661..8acd4e99636be 100644
--- a/pkgs/development/libraries/wxsqlite3/default.nix
+++ b/pkgs/development/libraries/wxsqlite3/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , autoreconfHook
 , wxGTK
@@ -20,9 +20,9 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ autoreconfHook ];
 
   buildInputs = [ wxGTK sqlite ]
-    ++ stdenv.lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.Cocoa darwin.stubs.setfile darwin.stubs.rez darwin.stubs.derez ];
+    ++ lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.Cocoa darwin.stubs.setfile darwin.stubs.rez darwin.stubs.derez ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://utelle.github.io/wxsqlite3/";
     description = "A C++ wrapper around the public domain SQLite 3.x for wxWidgets";
     platforms = platforms.unix;
diff --git a/pkgs/development/libraries/wxsqliteplus/default.nix b/pkgs/development/libraries/wxsqliteplus/default.nix
index 18ecea4cbe18f..7cf5484bef77d 100644
--- a/pkgs/development/libraries/wxsqliteplus/default.nix
+++ b/pkgs/development/libraries/wxsqliteplus/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, wxGTK, wxsqlite3, sqlite }:
+{ lib, stdenv, fetchFromGitHub, wxGTK, wxsqlite3, sqlite }:
 
 stdenv.mkDerivation rec {
   pname = "wxsqliteplus";
@@ -27,7 +27,7 @@ stdenv.mkDerivation rec {
     install -D wxsqliteplus $out/bin/wxsqliteplus
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/guanlisheng/wxsqliteplus";
     description = "A simple SQLite database browser built with wxWidgets";
     platforms = platforms.unix;
diff --git a/pkgs/development/libraries/wxwidgets/2.8/default.nix b/pkgs/development/libraries/wxwidgets/2.8/default.nix
index 4e0481cc47d26..93529ef430f55 100644
--- a/pkgs/development/libraries/wxwidgets/2.8/default.nix
+++ b/pkgs/development/libraries/wxwidgets/2.8/default.nix
@@ -1,14 +1,14 @@
-{ stdenv, fetchurl, pkg-config, gtk2, libXinerama, libSM, libXxf86vm, xorgproto
+{ lib, stdenv, fetchurl, pkg-config, gtk2, libXinerama, libSM, libXxf86vm, xorgproto
 , libX11, cairo
-, libGLSupported ? stdenv.lib.elem stdenv.hostPlatform.system stdenv.lib.platforms.mesaPlatforms
-, withMesa ? stdenv.lib.elem stdenv.hostPlatform.system stdenv.lib.platforms.mesaPlatforms
+, libGLSupported ? lib.elem stdenv.hostPlatform.system stdenv.lib.platforms.mesaPlatforms
+, withMesa ? lib.elem stdenv.hostPlatform.system stdenv.lib.platforms.mesaPlatforms
 , libGLU ? null, libGL ? null
 , compat24 ? false, compat26 ? true, unicode ? true,
 }:
 
 assert withMesa -> libGLU != null && libGL != null;
 
-with stdenv.lib;
+with lib;
 
 stdenv.mkDerivation rec {
   version = "2.8.12.1";
diff --git a/pkgs/development/libraries/wxwidgets/2.9/default.nix b/pkgs/development/libraries/wxwidgets/2.9/default.nix
index d1b0d56576bf3..358b45fbf0c2f 100644
--- a/pkgs/development/libraries/wxwidgets/2.9/default.nix
+++ b/pkgs/development/libraries/wxwidgets/2.9/default.nix
@@ -1,7 +1,7 @@
-{ stdenv, fetchurl, pkg-config, gtk2, libXinerama, libSM, libXxf86vm, xorgproto
+{ lib, stdenv, fetchurl, pkg-config, gtk2, libXinerama, libSM, libXxf86vm, xorgproto
 , setfile
-, libGLSupported ? stdenv.lib.elem stdenv.hostPlatform.system stdenv.lib.platforms.mesaPlatforms
-, withMesa ? stdenv.lib.elem stdenv.hostPlatform.system stdenv.lib.platforms.mesaPlatforms
+, libGLSupported ? lib.elem stdenv.hostPlatform.system stdenv.lib.platforms.mesaPlatforms
+, withMesa ? lib.elem stdenv.hostPlatform.system stdenv.lib.platforms.mesaPlatforms
 , libGLU ? null, libGL ? null
 , compat24 ? false, compat26 ? true, unicode ? true
 , Carbon ? null, Cocoa ? null, Kernel ? null, QuickTime ? null, AGL ? null
@@ -9,7 +9,7 @@
 
 assert withMesa -> libGLU != null && libGL != null;
 
-with stdenv.lib;
+with lib;
 
 let
   version = "2.9.4";
diff --git a/pkgs/development/libraries/wxwidgets/3.0/default.nix b/pkgs/development/libraries/wxwidgets/3.0/default.nix
index e77b0097d4775..c97a9778d5d24 100644
--- a/pkgs/development/libraries/wxwidgets/3.0/default.nix
+++ b/pkgs/development/libraries/wxwidgets/3.0/default.nix
@@ -1,8 +1,8 @@
-{ stdenv, fetchFromGitHub, fetchurl, pkg-config
+{ lib, stdenv, fetchFromGitHub, fetchurl, pkg-config
 , libXinerama, libSM, libXxf86vm
 , gtk2, gtk3
 , xorgproto, gst_all_1, setfile
-, libGLSupported ? stdenv.lib.elem stdenv.hostPlatform.system stdenv.lib.platforms.mesaPlatforms
+, libGLSupported ? lib.elem stdenv.hostPlatform.system stdenv.lib.platforms.mesaPlatforms
 , withMesa ? libGLSupported
 , libGLU ? null, libGL ? null
 , compat24 ? false, compat26 ? true, unicode ? true
@@ -11,7 +11,7 @@
 , AGL ? null, Carbon ? null, Cocoa ? null, Kernel ? null, QTKit ? null
 }:
 
-with stdenv.lib;
+with lib;
 
 assert withMesa -> libGLU != null && libGL != null;
 assert withWebKit -> webkitgtk != null;
diff --git a/pkgs/development/libraries/wxwidgets/3.0/mac.nix b/pkgs/development/libraries/wxwidgets/3.0/mac.nix
index a6973f53de8fb..22e8184099133 100644
--- a/pkgs/development/libraries/wxwidgets/3.0/mac.nix
+++ b/pkgs/development/libraries/wxwidgets/3.0/mac.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchzip, expat, libiconv, libjpeg, libpng, libtiff, zlib
+{ lib, stdenv, fetchzip, expat, libiconv, libjpeg, libpng, libtiff, zlib
 # darwin only attributes
 , derez, rez, setfile
 , AGL, Cocoa, Kernel, WebKit
@@ -58,7 +58,7 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     platforms = platforms.darwin;
     license = licenses.wxWindows;
     maintainers = [ maintainers.lnl7 ];
diff --git a/pkgs/development/libraries/wxwidgets/3.1/default.nix b/pkgs/development/libraries/wxwidgets/3.1/default.nix
index a75b5c1270b7a..cbacf4ec762fb 100644
--- a/pkgs/development/libraries/wxwidgets/3.1/default.nix
+++ b/pkgs/development/libraries/wxwidgets/3.1/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , fetchurl
 , pkg-config
@@ -12,7 +12,7 @@
 , xorgproto
 , gst_all_1
 , setfile
-, libGLSupported ? stdenv.lib.elem stdenv.hostPlatform.system stdenv.lib.platforms.mesaPlatforms
+, libGLSupported ? lib.elem stdenv.hostPlatform.system stdenv.lib.platforms.mesaPlatforms
 , withMesa ? libGLSupported
 , libGLU ? null
 , libGL ? null
@@ -29,7 +29,7 @@
 , QTKit ? null
 }:
 
-with stdenv.lib;
+with lib;
 
 assert withMesa -> libGLU != null && libGL != null;
 assert withWebKit -> webkitgtk != null;
diff --git a/pkgs/development/libraries/x264/default.nix b/pkgs/development/libraries/x264/default.nix
index 49797b5dd7592..93d0b42a889ff 100644
--- a/pkgs/development/libraries/x264/default.nix
+++ b/pkgs/development/libraries/x264/default.nix
@@ -29,12 +29,12 @@ stdenv.mkDerivation rec {
   '';
 
   configureFlags = [ "--enable-shared" ]
-    ++ stdenv.lib.optional (!stdenv.isi686) "--enable-pic"
-    ++ stdenv.lib.optional (stdenv.buildPlatform != stdenv.hostPlatform) "--cross-prefix=${stdenv.cc.targetPrefix}";
+    ++ lib.optional (!stdenv.isi686) "--enable-pic"
+    ++ lib.optional (stdenv.buildPlatform != stdenv.hostPlatform) "--cross-prefix=${stdenv.cc.targetPrefix}";
 
   nativeBuildInputs = lib.optional (stdenv.hostPlatform.isx86_64 || stdenv.hostPlatform.isi686) nasm;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Library for encoding H264/AVC video streams";
     homepage    = "http://www.videolan.org/developers/x264.html";
     license     = licenses.gpl2;
diff --git a/pkgs/development/libraries/x265/default.nix b/pkgs/development/libraries/x265/default.nix
index 8c5cf32545c38..495bbc4aaabb8 100644
--- a/pkgs/development/libraries/x265/default.nix
+++ b/pkgs/development/libraries/x265/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromBitbucket, cmake, nasm, numactl
+{ lib, stdenv, fetchFromBitbucket, cmake, nasm, numactl
 , numaSupport ? stdenv.hostPlatform.isLinux && (stdenv.hostPlatform.isx86 || stdenv.hostPlatform.isAarch64)  # Enabled by default on NUMA platforms
 , debugSupport ? false # Run-time sanity checks (debugging)
 , werrorSupport ? false # Warnings as errors
@@ -21,7 +21,7 @@ let
     (mkFlag custatsSupport "DETAILED_CU_STATS")
     (mkFlag unittestsSupport "ENABLE_TESTS")
     (mkFlag werrorSupport "WARNINGS_AS_ERRORS")
-  ] ++ stdenv.lib.optionals stdenv.hostPlatform.isPower [
+  ] ++ lib.optionals stdenv.hostPlatform.isPower [
     "-DENABLE_ALTIVEC=OFF"
   ];
 
@@ -56,7 +56,7 @@ let
       cd source
     '';
 
-    nativeBuildInputs = [cmake nasm] ++ stdenv.lib.optional numaSupport numactl;
+    nativeBuildInputs = [cmake nasm] ++ lib.optional numaSupport numactl;
   };
 
   libx265-10 = buildLib false;
@@ -76,7 +76,7 @@ stdenv.mkDerivation rec {
     "-DENABLE_SHARED=ON"
     "-DHIGH_BIT_DEPTH=OFF"
     "-DENABLE_HDR10_PLUS=OFF"
-  ] ++ stdenv.lib.optionals (is64bit && !(stdenv.isAarch64 && stdenv.isLinux)) [
+  ] ++ lib.optionals (is64bit && !(stdenv.isAarch64 && stdenv.isLinux)) [
     "-DEXTRA_LIB=${libx265-10}/lib/libx265.a;${libx265-12}/lib/libx265.a"
     "-DLINKED_10BIT=ON"
     "-DLINKED_12BIT=ON"
@@ -92,9 +92,9 @@ stdenv.mkDerivation rec {
     rm $out/lib/*.a
   '';
 
-  nativeBuildInputs = [ cmake nasm ] ++ stdenv.lib.optional numaSupport numactl;
+  nativeBuildInputs = [ cmake nasm ] ++ lib.optional numaSupport numactl;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Library for encoding h.265/HEVC video streams";
     homepage    = "http://x265.org";
     license     = licenses.gpl2;
diff --git a/pkgs/development/libraries/xalanc/default.nix b/pkgs/development/libraries/xalanc/default.nix
index 30ab7f4496d80..242788723fb11 100644
--- a/pkgs/development/libraries/xalanc/default.nix
+++ b/pkgs/development/libraries/xalanc/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, xercesc, getopt }:
+{ lib, stdenv, fetchurl, xercesc, getopt }:
 
 let
   platform = if stdenv.isLinux then "linux" else
@@ -25,8 +25,8 @@ in stdenv.mkDerivation rec {
   meta = {
     homepage = "http://xalan.apache.org/";
     description = "A XSLT processor for transforming XML documents";
-    license = stdenv.lib.licenses.asl20;
-    platforms = stdenv.lib.platforms.linux ++ stdenv.lib.platforms.darwin;
-    maintainers = [ stdenv.lib.maintainers.jagajaga ];
+    license = lib.licenses.asl20;
+    platforms = lib.platforms.linux ++ stdenv.lib.platforms.darwin;
+    maintainers = [ lib.maintainers.jagajaga ];
   };
 }
diff --git a/pkgs/development/libraries/xapian/default.nix b/pkgs/development/libraries/xapian/default.nix
index 195aea5c2f180..cfca33a62d2e5 100644
--- a/pkgs/development/libraries/xapian/default.nix
+++ b/pkgs/development/libraries/xapian/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, autoreconfHook
+{ lib, stdenv, fetchurl, autoreconfHook
 , libuuid, zlib }:
 
 let
@@ -20,16 +20,16 @@ let
     doCheck = true;
     AUTOMATED_TESTING = true; # https://trac.xapian.org/changeset/8be35f5e1/git
 
-    patches = stdenv.lib.optionals stdenv.isDarwin [ ./skip-flaky-darwin-test.patch ];
+    patches = lib.optionals stdenv.isDarwin [ ./skip-flaky-darwin-test.patch ];
 
     # the configure script thinks that Darwin has ___exp10
     # but it’s not available on my systems (or hydra apparently)
-    postConfigure = stdenv.lib.optionalString stdenv.isDarwin ''
+    postConfigure = lib.optionalString stdenv.isDarwin ''
       substituteInPlace config.h \
         --replace "#define HAVE___EXP10 1" "#undef HAVE___EXP10"
     '';
 
-    meta = with stdenv.lib; {
+    meta = with lib; {
       description = "Search engine library";
       homepage = "https://xapian.org/";
       license = licenses.gpl2Plus;
diff --git a/pkgs/development/libraries/xapian/tools/omega/default.nix b/pkgs/development/libraries/xapian/tools/omega/default.nix
index 6028982d98770..79e5786f0488c 100644
--- a/pkgs/development/libraries/xapian/tools/omega/default.nix
+++ b/pkgs/development/libraries/xapian/tools/omega/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkg-config, xapian, perl, pcre, zlib, libmagic }:
+{ lib, stdenv, fetchurl, pkg-config, xapian, perl, pcre, zlib, libmagic }:
 
 stdenv.mkDerivation rec {
   pname = "xapian-omega";
@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
   buildInputs = [ xapian perl pcre zlib libmagic ];
   nativeBuildInputs = [ pkg-config ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Indexer and CGI search front-end built on Xapian library";
     homepage = "https://xapian.org/";
     license = licenses.gpl2Plus;
diff --git a/pkgs/development/libraries/xavs/default.nix b/pkgs/development/libraries/xavs/default.nix
index 18b10376315f6..11d73a9decb78 100644
--- a/pkgs/development/libraries/xavs/default.nix
+++ b/pkgs/development/libraries/xavs/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchsvn }:
+{ lib, stdenv, fetchsvn }:
 
 stdenv.mkDerivation rec {
   pname = "xavs";
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
     patchShebangs tools/patcheck
     patchShebangs tools/regression-test.pl
     patchShebangs tools/xavs-format
-    '' + stdenv.lib.optionalString stdenv.isDarwin ''
+    '' + lib.optionalString stdenv.isDarwin ''
     substituteInPlace config.guess --replace 'uname -p' 'uname -m'
     substituteInPlace configure \
       --replace '-O4' '-O3' \
@@ -38,7 +38,7 @@ stdenv.mkDerivation rec {
     "--disable-asm"
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "AVS encoder and decoder";
     homepage    = "http://xavs.sourceforge.net/";
     license     = licenses.lgpl2;
diff --git a/pkgs/development/libraries/xbase/default.nix b/pkgs/development/libraries/xbase/default.nix
index ae7ceb18c0ab0..db36c2a34c152 100644
--- a/pkgs/development/libraries/xbase/default.nix
+++ b/pkgs/development/libraries/xbase/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation {
   name = "xbase-3.1.2";
@@ -25,7 +25,7 @@ stdenv.mkDerivation {
     })
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://linux.techass.com/projects/xdb/";
     description = "C++ class library formerly known as XDB";
     platforms = platforms.linux;
diff --git a/pkgs/development/libraries/xcb-imdkit/default.nix b/pkgs/development/libraries/xcb-imdkit/default.nix
index 72ce94d98f12a..8a13738a7e01a 100644
--- a/pkgs/development/libraries/xcb-imdkit/default.nix
+++ b/pkgs/development/libraries/xcb-imdkit/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , cmake
 , extra-cmake-modules
@@ -31,7 +31,7 @@ stdenv.mkDerivation rec {
     xcbutilkeysyms
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "input method development support for xcb";
     homepage = "https://github.com/fcitx/xcb-imdkit";
     license = licenses.lgpl21Plus;
diff --git a/pkgs/development/libraries/xcb-util-cursor/HEAD.nix b/pkgs/development/libraries/xcb-util-cursor/HEAD.nix
index 2cdf8850e2d95..f296f59d408bc 100644
--- a/pkgs/development/libraries/xcb-util-cursor/HEAD.nix
+++ b/pkgs/development/libraries/xcb-util-cursor/HEAD.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchgit, autoconf, automake, libtool, pkg-config
+{ lib, stdenv, fetchgit, autoconf, automake, libtool, pkg-config
 , xorg, gnum4, libxcb, gperf }:
 
 stdenv.mkDerivation {
@@ -11,7 +11,7 @@ stdenv.mkDerivation {
     sha256 = "127zfmihd8nqlj8jjaja06xb84xdgl263w0av1xnprx05mkbkcyc";
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "XCB cursor library (libxcursor port)";
     homepage    = "https://cgit.freedesktop.org/xcb/util-cursor";
     license     = licenses.mit;
diff --git a/pkgs/development/libraries/xdg-dbus-proxy/default.nix b/pkgs/development/libraries/xdg-dbus-proxy/default.nix
index 0ad18ff70d4ca..21d6b6fa73e8b 100644
--- a/pkgs/development/libraries/xdg-dbus-proxy/default.nix
+++ b/pkgs/development/libraries/xdg-dbus-proxy/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , pkg-config
 , libxslt
@@ -39,7 +39,7 @@ stdenv.mkDerivation rec {
   # dbus[2345]: Failed to start message bus: Failed to open "/etc/dbus-1/session.conf": No such file or directory
   doCheck = false;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "DBus proxy for Flatpak and others";
     homepage = "https://github.com/flatpak/xdg-dbus-proxy";
     license = licenses.lgpl21Plus;
diff --git a/pkgs/development/libraries/xdg-desktop-portal-gtk/default.nix b/pkgs/development/libraries/xdg-desktop-portal-gtk/default.nix
index b7e5894855345..be96001c46fb2 100644
--- a/pkgs/development/libraries/xdg-desktop-portal-gtk/default.nix
+++ b/pkgs/development/libraries/xdg-desktop-portal-gtk/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , autoreconfHook
 , pkg-config
@@ -38,7 +38,7 @@ stdenv.mkDerivation rec {
     gnome3.gnome-settings-daemon # schemas needed for settings api (fonts, etc)
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Desktop integration portals for sandboxed apps";
     maintainers = with maintainers; [ jtojnar ];
     platforms = platforms.linux;
diff --git a/pkgs/development/libraries/xdg-desktop-portal-wlr/default.nix b/pkgs/development/libraries/xdg-desktop-portal-wlr/default.nix
index 16f9e7edb690d..151c74f0b70da 100644
--- a/pkgs/development/libraries/xdg-desktop-portal-wlr/default.nix
+++ b/pkgs/development/libraries/xdg-desktop-portal-wlr/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub
+{ lib, stdenv, fetchFromGitHub
 , meson, ninja, pkg-config, wayland-protocols
 , pipewire, wayland, elogind, systemd, libdrm }:
 
@@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ meson ninja pkg-config wayland-protocols ];
   buildInputs = [ pipewire wayland elogind systemd libdrm ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/emersion/xdg-desktop-portal-wlr";
     description = "xdg-desktop-portal backend for wlroots";
     maintainers = with maintainers; [ minijackson ];
diff --git a/pkgs/development/libraries/xdg-desktop-portal/default.nix b/pkgs/development/libraries/xdg-desktop-portal/default.nix
index 52f089126a97a..cab3585283116 100644
--- a/pkgs/development/libraries/xdg-desktop-portal/default.nix
+++ b/pkgs/development/libraries/xdg-desktop-portal/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , nixosTests
 , substituteAll
@@ -76,7 +76,7 @@ stdenv.mkDerivation rec {
     };
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Desktop integration portals for sandboxed apps";
     license = licenses.lgpl21;
     maintainers = with maintainers; [ jtojnar ];
diff --git a/pkgs/development/libraries/xed/default.nix b/pkgs/development/libraries/xed/default.nix
index 1d6dcdc67adef..395b399d8fe26 100644
--- a/pkgs/development/libraries/xed/default.nix
+++ b/pkgs/development/libraries/xed/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, python3Packages }:
+{ lib, stdenv, fetchFromGitHub, python3Packages }:
 
 let
   # mbuild is a custom build system used only to build xed
@@ -36,7 +36,7 @@ in stdenv.mkDerivation rec {
 
   dontInstall = true; # already installed during buildPhase
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Intel X86 Encoder Decoder (Intel XED)";
     homepage    = "https://intelxed.github.io/";
     license     = licenses.apsl20;
diff --git a/pkgs/development/libraries/xercesc/default.nix b/pkgs/development/libraries/xercesc/default.nix
index 8c7b12320148f..dec42c0243ea0 100644
--- a/pkgs/development/libraries/xercesc/default.nix
+++ b/pkgs/development/libraries/xercesc/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
   pname = "xerces-c";
@@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
   meta = {
     homepage = "https://xerces.apache.org/xerces-c/";
     description = "Validating XML parser written in a portable subset of C++";
-    license = stdenv.lib.licenses.asl20;
-    platforms = stdenv.lib.platforms.linux ++ stdenv.lib.platforms.darwin;
+    license = lib.licenses.asl20;
+    platforms = lib.platforms.linux ++ stdenv.lib.platforms.darwin;
   };
 }
diff --git a/pkgs/development/libraries/xgboost/default.nix b/pkgs/development/libraries/xgboost/default.nix
index b9a2820a92858..973e7dc028e06 100644
--- a/pkgs/development/libraries/xgboost/default.nix
+++ b/pkgs/development/libraries/xgboost/default.nix
@@ -34,7 +34,7 @@ stdenv.mkDerivation rec {
     install -Dm755 ../xgboost $out/bin/xgboost
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Scalable, Portable and Distributed Gradient Boosting (GBDT, GBRT or GBM) Library";
     homepage = "https://github.com/dmlc/xgboost";
     license = licenses.asl20;
diff --git a/pkgs/development/libraries/xine-lib/default.nix b/pkgs/development/libraries/xine-lib/default.nix
index f5aa4f397abfe..cbdc1a2dcf0bc 100644
--- a/pkgs/development/libraries/xine-lib/default.nix
+++ b/pkgs/development/libraries/xine-lib/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, fetchpatch, pkg-config, xorg, alsaLib, libGLU, libGL, aalib
+{ lib, stdenv, fetchurl, fetchpatch, pkg-config, xorg, alsaLib, libGLU, libGL, aalib
 , libvorbis, libtheora, speex, zlib, perl, ffmpeg_3
 , flac, libcaca, libpulseaudio, libmng, libcdio, libv4l, vcdimager
 , libmpcdec
@@ -34,7 +34,7 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://www.xine-project.org/";
     description = "A high-performance, portable and reusable multimedia playback engine";
     platforms = platforms.linux;
diff --git a/pkgs/development/libraries/xlibs-wrapper/default.nix b/pkgs/development/libraries/xlibs-wrapper/default.nix
index 049c54d792b4e..735cc278debf3 100644
--- a/pkgs/development/libraries/xlibs-wrapper/default.nix
+++ b/pkgs/development/libraries/xlibs-wrapper/default.nix
@@ -1,4 +1,4 @@
-{stdenv, packages}:
+{lib, stdenv, packages}:
 
 stdenv.mkDerivation {
   name = "xlibs-wrapper";
@@ -16,6 +16,6 @@ stdenv.mkDerivation {
   buildClientLibs = true;
 
   meta = {
-    platforms = stdenv.lib.platforms.unix;
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/xlslib/default.nix b/pkgs/development/libraries/xlslib/default.nix
index ee3942c360b7c..77a11b5311007 100644
--- a/pkgs/development/libraries/xlslib/default.nix
+++ b/pkgs/development/libraries/xlslib/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, autoreconfHook, unzip }:
+{ lib, stdenv, fetchurl, autoreconfHook, unzip }:
 
 stdenv.mkDerivation rec {
   pname = "xlslib";
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "C++/C library to construct Excel .xls files in code";
     homepage = "https://sourceforge.net/projects/xlslib/";
     license = licenses.bsd2;
diff --git a/pkgs/development/libraries/xml-security-c/default.nix b/pkgs/development/libraries/xml-security-c/default.nix
index eb09b0e085930..7548a45e5d416 100644
--- a/pkgs/development/libraries/xml-security-c/default.nix
+++ b/pkgs/development/libraries/xml-security-c/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, xalanc, xercesc, openssl, pkg-config }:
+{ lib, stdenv, fetchurl, xalanc, xercesc, openssl, pkg-config }:
 
 stdenv.mkDerivation rec {
   pname = "xml-security-c";
@@ -21,8 +21,8 @@ stdenv.mkDerivation rec {
   meta = {
     homepage = "http://santuario.apache.org/";
     description = "C++ Implementation of W3C security standards for XML";
-    license = stdenv.lib.licenses.gpl2;
-    platforms = stdenv.lib.platforms.unix;
-    maintainers = [ stdenv.lib.maintainers.jagajaga ];
+    license = lib.licenses.gpl2;
+    platforms = lib.platforms.unix;
+    maintainers = [ lib.maintainers.jagajaga ];
   };
 }
diff --git a/pkgs/development/libraries/xml-tooling-c/default.nix b/pkgs/development/libraries/xml-tooling-c/default.nix
index 8671c124ab26b..9cf3ddb92190b 100644
--- a/pkgs/development/libraries/xml-tooling-c/default.nix
+++ b/pkgs/development/libraries/xml-tooling-c/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchgit, autoreconfHook, pkg-config
+{ lib, stdenv, fetchgit, autoreconfHook, pkg-config
 , boost, curl, openssl, log4shib, xercesc, xml-security-c
 }:
 
@@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A low-level library that provides a high level interface to XML processing for OpenSAML 2";
     platforms   = platforms.unix;
     license     = licenses.asl20;
diff --git a/pkgs/development/libraries/xmlrpc-c/default.nix b/pkgs/development/libraries/xmlrpc-c/default.nix
index 41cdbf0b4f168..7b6907a016271 100644
--- a/pkgs/development/libraries/xmlrpc-c/default.nix
+++ b/pkgs/development/libraries/xmlrpc-c/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, curl, libxml2 }:
+{ lib, stdenv, fetchurl, curl, libxml2 }:
 
 stdenv.mkDerivation rec {
   name = "xmlrpc-c-1.51.06";
@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
 
   hardeningDisable = [ "format" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A lightweight RPC library based on XML and HTTP";
     homepage = "http://xmlrpc-c.sourceforge.net/";
     # <xmlrpc-c>/doc/COPYING also lists "Expat license",
diff --git a/pkgs/development/libraries/xmlsec/default.nix b/pkgs/development/libraries/xmlsec/default.nix
index f45979b847edb..8bf9876095003 100644
--- a/pkgs/development/libraries/xmlsec/default.nix
+++ b/pkgs/development/libraries/xmlsec/default.nix
@@ -18,7 +18,7 @@ stdenv.mkDerivation {
 
   patches = [
     ./lt_dladdsearchdir.patch
-  ] ++ stdenv.lib.optionals stdenv.isDarwin [ ./remove_bsd_base64_decode_flag.patch ];
+  ] ++ lib.optionals stdenv.isDarwin [ ./remove_bsd_base64_decode_flag.patch ];
   postPatch = ''
     substituteAllInPlace src/dl.c
   '';
@@ -76,8 +76,8 @@ stdenv.mkDerivation {
     homepage = "http://www.aleksey.com/xmlsec";
     downloadPage = "https://www.aleksey.com/xmlsec/download.html";
     description = "XML Security Library in C based on libxml2";
-    license = stdenv.lib.licenses.mit;
-    platforms = with stdenv.lib.platforms; linux ++ darwin;
+    license = lib.licenses.mit;
+    platforms = with lib.platforms; linux ++ darwin;
     updateWalker = true;
   };
 }
diff --git a/pkgs/development/libraries/xsd/default.nix b/pkgs/development/libraries/xsd/default.nix
index 3388666f46b38..2d614ee0e7310 100644
--- a/pkgs/development/libraries/xsd/default.nix
+++ b/pkgs/development/libraries/xsd/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, xercesc }:
+{ lib, stdenv, fetchurl, xercesc }:
 
 let
 in
@@ -32,8 +32,8 @@ stdenv.mkDerivation rec {
   meta = {
     homepage = "http://www.codesynthesis.com/products/xsd";
     description = "An open-source, cross-platform W3C XML Schema to C++ data binding compiler";
-    license = stdenv.lib.licenses.gpl2;
-    platforms = stdenv.lib.platforms.linux;
-    maintainers = [ stdenv.lib.maintainers.jagajaga ];
+    license = lib.licenses.gpl2;
+    platforms = lib.platforms.linux;
+    maintainers = [ lib.maintainers.jagajaga ];
   };
 }
diff --git a/pkgs/development/libraries/xvidcore/default.nix b/pkgs/development/libraries/xvidcore/default.nix
index ab68693ea5eff..dbc3d837a45ab 100644
--- a/pkgs/development/libraries/xvidcore/default.nix
+++ b/pkgs/development/libraries/xvidcore/default.nix
@@ -1,6 +1,6 @@
-{ stdenv, fetchurl, yasm, autoconf, automake, libtool }:
+{ lib, stdenv, fetchurl, yasm, autoconf, automake, libtool }:
 
-with stdenv.lib;
+with lib;
 stdenv.mkDerivation rec {
   pname = "xvidcore";
   version = "1.3.5";
diff --git a/pkgs/development/libraries/xxHash/default.nix b/pkgs/development/libraries/xxHash/default.nix
index a5e6bfb11a685..fbeadc2b353a3 100644
--- a/pkgs/development/libraries/xxHash/default.nix
+++ b/pkgs/development/libraries/xxHash/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub }:
+{ lib, stdenv, fetchFromGitHub }:
 
 stdenv.mkDerivation rec {
   pname = "xxHash";
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
 
   # Upstream Makefile does not anticipate that user may not want to
   # build .so library.
-  postPatch = stdenv.lib.optionalString stdenv.hostPlatform.isStatic ''
+  postPatch = lib.optionalString stdenv.hostPlatform.isStatic ''
     sed -i 's/lib: libxxhash.a libxxhash/lib: libxxhash.a/' Makefile
     sed -i '/LIBXXH) $(DESTDIR/ d' Makefile
   '';
@@ -22,7 +22,7 @@ stdenv.mkDerivation rec {
 
   makeFlags = [ "PREFIX=$(dev)" "EXEC_PREFIX=$(out)" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Extremely fast hash algorithm";
     longDescription = ''
       xxHash is an Extremely fast Hash algorithm, running at RAM speed limits.
diff --git a/pkgs/development/libraries/xylib/default.nix b/pkgs/development/libraries/xylib/default.nix
index 2b4cb1d56daeb..f7d7eed7e70e5 100644
--- a/pkgs/development/libraries/xylib/default.nix
+++ b/pkgs/development/libraries/xylib/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, boost, zlib, bzip2, wxGTK30 }:
+{ lib, stdenv, fetchurl, boost, zlib, bzip2, wxGTK30 }:
 
 stdenv.mkDerivation rec {
   pname = "xylib";
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ boost zlib bzip2 wxGTK30 ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Portable library for reading files that contain x-y data from powder diffraction, spectroscopy and other experimental methods";
     license = licenses.lgpl21;
     homepage = "http://xylib.sourceforge.net/";
diff --git a/pkgs/development/libraries/yajl/default.nix b/pkgs/development/libraries/yajl/default.nix
index 62fe652724f8b..df47168c79b7b 100644
--- a/pkgs/development/libraries/yajl/default.nix
+++ b/pkgs/development/libraries/yajl/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, cmake }:
+{ lib, stdenv, fetchurl, cmake }:
 
 stdenv.mkDerivation rec {
   name = "yajl-2.1.0";
@@ -18,8 +18,8 @@ stdenv.mkDerivation rec {
       C, and a small validating JSON generator.
     '';
     homepage = "http://lloyd.github.com/yajl/";
-    license = stdenv.lib.licenses.isc;
-    platforms = with stdenv.lib.platforms; linux ++ darwin;
-    maintainers = with stdenv.lib.maintainers; [ maggesi ];
+    license = lib.licenses.isc;
+    platforms = with lib.platforms; linux ++ darwin;
+    maintainers = with lib.maintainers; [ maggesi ];
   };
 }
diff --git a/pkgs/development/libraries/yojimbo/default.nix b/pkgs/development/libraries/yojimbo/default.nix
index 9e6cc37e661c7..b72820c77a68d 100644
--- a/pkgs/development/libraries/yojimbo/default.nix
+++ b/pkgs/development/libraries/yojimbo/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, premake5, doxygen, libsodium, mbedtls }:
+{ lib, stdenv, fetchFromGitHub, premake5, doxygen, libsodium, mbedtls }:
 
 stdenv.mkDerivation {
   pname = "yojimbo";
@@ -28,7 +28,7 @@ stdenv.mkDerivation {
 
   doCheck = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A network library for client/server games with dedicated servers";
     longDescription = ''
       yojimbo is a network library for client/server games with dedicated servers.
diff --git a/pkgs/development/libraries/yubico-pam/default.nix b/pkgs/development/libraries/yubico-pam/default.nix
index bfe09b0e94c97..1289b03618c6f 100644
--- a/pkgs/development/libraries/yubico-pam/default.nix
+++ b/pkgs/development/libraries/yubico-pam/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, autoreconfHook, pkg-config
+{ lib, stdenv, fetchFromGitHub, autoreconfHook, pkg-config
 , asciidoc, libxslt, docbook_xsl
 , pam, yubikey-personalization, libyubikey, libykclient }:
 
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ autoreconfHook pkg-config asciidoc libxslt docbook_xsl ];
   buildInputs = [ pam yubikey-personalization libyubikey libykclient ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Yubico PAM module";
     homepage = "https://developers.yubico.com/yubico-pam";
     license = licenses.bsd2;
diff --git a/pkgs/development/libraries/zchunk/default.nix b/pkgs/development/libraries/zchunk/default.nix
index 67d4320b8982d..a0d1378aa7086 100644
--- a/pkgs/development/libraries/zchunk/default.nix
+++ b/pkgs/development/libraries/zchunk/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitHub
 , fetchpatch
 , pkg-config
@@ -31,7 +31,7 @@ stdenv.mkDerivation rec {
   buildInputs = [
     zstd
     curl
-  ] ++ stdenv.lib.optional stdenv.isDarwin argp-standalone;
+  ] ++ lib.optional stdenv.isDarwin argp-standalone;
 
   # Darwin needs a patch for argp-standalone usage and differing endian.h location on macOS
   # https://github.com/zchunk/zchunk/pull/35
@@ -43,7 +43,7 @@ stdenv.mkDerivation rec {
   })
 ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "File format designed for highly efficient deltas while maintaining good compression";
     homepage = "https://github.com/zchunk/zchunk";
     license = licenses.bsd2;
diff --git a/pkgs/development/libraries/zeitgeist/default.nix b/pkgs/development/libraries/zeitgeist/default.nix
index 37ab1b1ec4778..039ecc610f414 100644
--- a/pkgs/development/libraries/zeitgeist/default.nix
+++ b/pkgs/development/libraries/zeitgeist/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchFromGitLab
 , fetchpatch
 , pkg-config
@@ -22,7 +22,7 @@ stdenv.mkDerivation rec {
   pname = "zeitgeist";
   version = "1.0.2";
 
-  outputs = [ "out" "lib" "dev" "man" ] ++ stdenv.lib.optional pythonSupport "py";
+  outputs = [ "out" "lib" "dev" "man" ] ++ lib.optional pythonSupport "py";
 
   src = fetchFromGitLab {
     domain = "gitlab.freedesktop.org";
@@ -75,11 +75,11 @@ stdenv.mkDerivation rec {
     NOCONFIGURE=1 ./autogen.sh
   '';
 
-  postFixup = stdenv.lib.optionalString pythonSupport ''
+  postFixup = lib.optionalString pythonSupport ''
     moveToOutput lib/${python3.libPrefix} "$py"
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A service which logs the users’s activities and events";
     homepage = "https://zeitgeist.freedesktop.org/";
     maintainers = with maintainers; [ lethalman worldofpeace ];
diff --git a/pkgs/development/libraries/zeroc-ice/3.6.nix b/pkgs/development/libraries/zeroc-ice/3.6.nix
index 7f6c7323fff3e..896973e32eb8c 100644
--- a/pkgs/development/libraries/zeroc-ice/3.6.nix
+++ b/pkgs/development/libraries/zeroc-ice/3.6.nix
@@ -58,7 +58,7 @@ stdenv.mkDerivation rec {
     rm -rf $out/share/slice
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://www.zeroc.com/ice.html";
     description = "The internet communications engine";
     license = licenses.gpl2;
diff --git a/pkgs/development/libraries/zeroc-ice/default.nix b/pkgs/development/libraries/zeroc-ice/default.nix
index 2fb36c0aea583..ef16e381bcfd7 100644
--- a/pkgs/development/libraries/zeroc-ice/default.nix
+++ b/pkgs/development/libraries/zeroc-ice/default.nix
@@ -63,7 +63,7 @@ in stdenv.mkDerivation rec {
     mv $out/share/ice $dev/share
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://www.zeroc.com/ice.html";
     description = "The internet communications engine";
     license = licenses.gpl2;
diff --git a/pkgs/development/libraries/zeromq/4.x.nix b/pkgs/development/libraries/zeromq/4.x.nix
index 7be5a74c3a48a..a3c35d123b6a1 100644
--- a/pkgs/development/libraries/zeromq/4.x.nix
+++ b/pkgs/development/libraries/zeromq/4.x.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, asciidoc, pkg-config, libsodium
+{ lib, stdenv, fetchFromGitHub, cmake, asciidoc, pkg-config, libsodium
 , enableDrafts ? false }:
 
 stdenv.mkDerivation rec {
@@ -17,9 +17,9 @@ stdenv.mkDerivation rec {
 
   doCheck = false; # fails all the tests (ctest)
 
-  cmakeFlags = stdenv.lib.optional enableDrafts "-DENABLE_DRAFTS=ON";
+  cmakeFlags = lib.optional enableDrafts "-DENABLE_DRAFTS=ON";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     branch = "4";
     homepage = "http://www.zeromq.org";
     description = "The Intelligent Transport Layer";
diff --git a/pkgs/development/libraries/zimg/default.nix b/pkgs/development/libraries/zimg/default.nix
index afb13a03cbbff..56ced97653ea6 100644
--- a/pkgs/development/libraries/zimg/default.nix
+++ b/pkgs/development/libraries/zimg/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, autoreconfHook }:
+{ lib, stdenv, fetchFromGitHub, autoreconfHook }:
 
 stdenv.mkDerivation rec {
   pname = "zimg";
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Scaling, colorspace conversion and dithering library";
     homepage    = "https://github.com/sekrit-twc/zimg";
     license     = licenses.wtfpl;
diff --git a/pkgs/development/libraries/zimlib/default.nix b/pkgs/development/libraries/zimlib/default.nix
index 7f5168080fa35..6dc998cd0e274 100644
--- a/pkgs/development/libraries/zimlib/default.nix
+++ b/pkgs/development/libraries/zimlib/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, lzma }:
+{ lib, stdenv, fetchurl, lzma }:
 
 stdenv.mkDerivation rec {
   pname = "zimlib";
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Library for reading and writing ZIM files";
     homepage =  "https://www.openzim.org/wiki/Zimlib";
     license = licenses.gpl2;
diff --git a/pkgs/development/libraries/zlib/default.nix b/pkgs/development/libraries/zlib/default.nix
index b780fcda3930a..da8aac5229b63 100644
--- a/pkgs/development/libraries/zlib/default.nix
+++ b/pkgs/development/libraries/zlib/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , shared ? !stdenv.hostPlatform.isStatic
 , static ? true
@@ -33,9 +33,9 @@ stdenv.mkDerivation (rec {
     sha256 = "c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1";
   };
 
-  patches = stdenv.lib.optional stdenv.hostPlatform.isCygwin ./disable-cygwin-widechar.patch;
+  patches = lib.optional stdenv.hostPlatform.isCygwin ./disable-cygwin-widechar.patch;
 
-  postPatch = stdenv.lib.optionalString stdenv.hostPlatform.isDarwin ''
+  postPatch = lib.optionalString stdenv.hostPlatform.isDarwin ''
     substituteInPlace configure \
       --replace '/usr/bin/libtool' 'ar' \
       --replace 'AR="libtool"' 'AR="ar"' \
@@ -43,7 +43,7 @@ stdenv.mkDerivation (rec {
   '';
 
   outputs = [ "out" "dev" ]
-    ++ stdenv.lib.optional splitStaticOutput "static";
+    ++ lib.optional splitStaticOutput "static";
   setOutputFlags = false;
   outputDoc = "dev"; # single tiny man3 page
 
@@ -60,8 +60,8 @@ stdenv.mkDerivation (rec {
   # Of these, we choose `--shared`, only because that's
   # what we did in the past and we can avoid mass rebuilds this way.
   # As a result, we pass `--static` only when we want just static.
-  configureFlags = stdenv.lib.optional (static && !shared) "--static"
-                   ++ stdenv.lib.optional shared "--shared";
+  configureFlags = lib.optional (static && !shared) "--static"
+                   ++ lib.optional shared "--shared";
 
   # Note we don't need to set `dontDisableStatic`, because static-disabling
   # works by grepping for `enable-static` in the `./configure` script
@@ -71,33 +71,33 @@ stdenv.mkDerivation (rec {
   # here (in case zlib ever switches to autoconf in the future),
   # but we don't do it simply to avoid mass rebuilds.
 
-  postInstall = stdenv.lib.optionalString splitStaticOutput ''
+  postInstall = lib.optionalString splitStaticOutput ''
     moveToOutput lib/libz.a "$static"
   ''
     # jww (2015-01-06): Sometimes this library install as a .so, even on
     # Darwin; others time it installs as a .dylib.  I haven't yet figured out
     # what causes this difference.
-  + stdenv.lib.optionalString stdenv.hostPlatform.isDarwin ''
+  + lib.optionalString stdenv.hostPlatform.isDarwin ''
     for file in $out/lib/*.so* $out/lib/*.dylib* ; do
       ${stdenv.cc.bintools.targetPrefix}install_name_tool -id "$file" $file
     done
   ''
     # Non-typical naming confuses libtool which then refuses to use zlib's DLL
     # in some cases, e.g. when compiling libpng.
-  + stdenv.lib.optionalString (stdenv.hostPlatform.libc == "msvcrt") ''
+  + lib.optionalString (stdenv.hostPlatform.libc == "msvcrt") ''
     ln -s zlib1.dll $out/bin/libz.dll
   '';
 
   # As zlib takes part in the stdenv building, we don't want references
   # to the bootstrap-tools libgcc (as uses to happen on arm/mips)
-  NIX_CFLAGS_COMPILE = stdenv.lib.optionalString (!stdenv.hostPlatform.isDarwin) "-static-libgcc";
+  NIX_CFLAGS_COMPILE = lib.optionalString (!stdenv.hostPlatform.isDarwin) "-static-libgcc";
 
   # We don't strip on static cross-compilation because of reports that native
   # stripping corrupted the target library; see commit 12e960f5 for the report.
   dontStrip = stdenv.hostPlatform != stdenv.buildPlatform && static;
   configurePlatforms = [];
 
-  installFlags = stdenv.lib.optionals (stdenv.hostPlatform.libc == "msvcrt") [
+  installFlags = lib.optionals (stdenv.hostPlatform.libc == "msvcrt") [
     "BINARY_PATH=$(out)/bin"
     "INCLUDE_PATH=$(dev)/include"
     "LIBRARY_PATH=$(out)/lib"
@@ -108,9 +108,9 @@ stdenv.mkDerivation (rec {
 
   makeFlags = [
     "PREFIX=${stdenv.cc.targetPrefix}"
-  ] ++ stdenv.lib.optionals (stdenv.hostPlatform.libc == "msvcrt") [
+  ] ++ lib.optionals (stdenv.hostPlatform.libc == "msvcrt") [
     "-f" "win32/Makefile.gcc"
-  ] ++ stdenv.lib.optionals shared [
+  ] ++ lib.optionals shared [
     # Note that as of writing (zlib 1.2.11), this flag only has an effect
     # for Windows as it is specific to `win32/Makefile.gcc`.
     "SHARED_MODE=1"
@@ -120,16 +120,16 @@ stdenv.mkDerivation (rec {
     inherit version;
   };
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://zlib.net";
     description = "Lossless data-compression library";
     license = licenses.zlib;
     platforms = platforms.all;
   };
-} // stdenv.lib.optionalAttrs (stdenv.hostPlatform != stdenv.buildPlatform) {
+} // lib.optionalAttrs (stdenv.hostPlatform != stdenv.buildPlatform) {
   preConfigure = ''
     export CHOST=${stdenv.hostPlatform.config}
   '';
-} // stdenv.lib.optionalAttrs (stdenv.hostPlatform.libc == "msvcrt") {
+} // lib.optionalAttrs (stdenv.hostPlatform.libc == "msvcrt") {
   dontConfigure = true;
 })
diff --git a/pkgs/development/libraries/zlog/default.nix b/pkgs/development/libraries/zlog/default.nix
index f0ca99b766799..b115cf7b675b8 100644
--- a/pkgs/development/libraries/zlog/default.nix
+++ b/pkgs/development/libraries/zlog/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub }:
+{ lib, stdenv, fetchFromGitHub }:
 
 stdenv.mkDerivation rec {
   version = "1.2.15";
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
 
   makeFlags = [ "PREFIX=${placeholder "out"}" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description= "Reliable, high-performance, thread safe, flexible, clear-model, pure C logging library";
     homepage = "https://hardysimpson.github.io/zlog/";
     license = licenses.lgpl21;
diff --git a/pkgs/development/libraries/zmqpp/default.nix b/pkgs/development/libraries/zmqpp/default.nix
index 0a7438fbc3239..733573b3e2377 100644
--- a/pkgs/development/libraries/zmqpp/default.nix
+++ b/pkgs/development/libraries/zmqpp/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, pkg-config, zeromq }:
+{ lib, stdenv, fetchFromGitHub, cmake, pkg-config, zeromq }:
 
 stdenv.mkDerivation rec {
   pname = "zmqpp";
@@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
 
   propagatedBuildInputs = [ zeromq ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     inherit (src.meta) homepage;
     description = "C++ wrapper for czmq. Aims to be minimal, simple and consistent";
     license = licenses.lgpl3;
diff --git a/pkgs/development/libraries/zookeeper_mt/default.nix b/pkgs/development/libraries/zookeeper_mt/default.nix
index ea786d770eb6e..978321f96e7eb 100644
--- a/pkgs/development/libraries/zookeeper_mt/default.nix
+++ b/pkgs/development/libraries/zookeeper_mt/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
 , autoreconfHook
 , jre
@@ -10,7 +10,7 @@
 
 stdenv.mkDerivation rec {
   pname = "zookeeper_mt";
-  version = stdenv.lib.getVersion zookeeper;
+  version = lib.getVersion zookeeper;
 
   src = fetchurl {
     url = "mirror://apache/zookeeper/${zookeeper.pname}-${version}/apache-${zookeeper.pname}-${version}.tar.gz";
@@ -46,7 +46,7 @@ stdenv.mkDerivation rec {
     "--without-cppunit"
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://zookeeper.apache.org";
     description = "Apache Zookeeper";
     license = licenses.asl20;
diff --git a/pkgs/development/libraries/zxcvbn-c/default.nix b/pkgs/development/libraries/zxcvbn-c/default.nix
index 7a524e72318fe..e74bb9ddc32e8 100644
--- a/pkgs/development/libraries/zxcvbn-c/default.nix
+++ b/pkgs/development/libraries/zxcvbn-c/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub }:
+{ lib, stdenv, fetchFromGitHub }:
 stdenv.mkDerivation rec {
   pname = "zxcvbn-c";
   version = "2.4";
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
     install -D -t $out/lib libzxcvbn.so*
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://github.com/tsyrogit/zxcvbn-c";
     description = "A C/C++ implementation of the zxcvbn password strength estimation";
     license = licenses.mit;
diff --git a/pkgs/development/libraries/zziplib/default.nix b/pkgs/development/libraries/zziplib/default.nix
index 228dfdcf77a48..8cfec83af5422 100644
--- a/pkgs/development/libraries/zziplib/default.nix
+++ b/pkgs/development/libraries/zziplib/default.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , perl
 , pkg-config
 , fetchFromGitHub
@@ -58,7 +58,7 @@ stdenv.mkDerivation rec {
   doCheck = false;
   checkTarget = "check";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Library to extract data from files archived in a zip file";
 
     longDescription = ''