about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/libraries')
-rw-r--r--nixpkgs/pkgs/development/libraries/AntTweakBar/default.nix33
-rw-r--r--nixpkgs/pkgs/development/libraries/CGAL/default.nix28
-rw-r--r--nixpkgs/pkgs/development/libraries/CoinMP/default.nix20
-rw-r--r--nixpkgs/pkgs/development/libraries/LASzip/default.nix21
-rw-r--r--nixpkgs/pkgs/development/libraries/NSPlist/default.nix21
-rw-r--r--nixpkgs/pkgs/development/libraries/PlistCpp/default.nix22
-rw-r--r--nixpkgs/pkgs/development/libraries/SDL/default.nix133
-rw-r--r--nixpkgs/pkgs/development/libraries/SDL/find-headers.patch16
-rw-r--r--nixpkgs/pkgs/development/libraries/SDL/setup-hook.sh7
-rw-r--r--nixpkgs/pkgs/development/libraries/SDL2/default.nix114
-rw-r--r--nixpkgs/pkgs/development/libraries/SDL2/find-headers.patch26
-rw-r--r--nixpkgs/pkgs/development/libraries/SDL2/setup-hook.sh7
-rw-r--r--nixpkgs/pkgs/development/libraries/SDL2_gfx/default.nix45
-rw-r--r--nixpkgs/pkgs/development/libraries/SDL2_image/default.nix27
-rw-r--r--nixpkgs/pkgs/development/libraries/SDL2_mixer/default.nix36
-rw-r--r--nixpkgs/pkgs/development/libraries/SDL2_net/default.nix25
-rw-r--r--nixpkgs/pkgs/development/libraries/SDL2_ttf/default.nix23
-rw-r--r--nixpkgs/pkgs/development/libraries/SDL_gfx/default.nix44
-rw-r--r--nixpkgs/pkgs/development/libraries/SDL_image/default.nix31
-rw-r--r--nixpkgs/pkgs/development/libraries/SDL_mixer/default.nix26
-rw-r--r--nixpkgs/pkgs/development/libraries/SDL_net/default.nix24
-rw-r--r--nixpkgs/pkgs/development/libraries/SDL_sixel/default.nix26
-rw-r--r--nixpkgs/pkgs/development/libraries/SDL_sound/default.nix22
-rw-r--r--nixpkgs/pkgs/development/libraries/SDL_stretch/default.nix20
-rw-r--r--nixpkgs/pkgs/development/libraries/SDL_ttf/default.nix33
-rw-r--r--nixpkgs/pkgs/development/libraries/Xaw3d/default.nix21
-rw-r--r--nixpkgs/pkgs/development/libraries/a52dec/default.nix27
-rw-r--r--nixpkgs/pkgs/development/libraries/aacskeys/default.nix47
-rw-r--r--nixpkgs/pkgs/development/libraries/aalib/darwin.patch106
-rw-r--r--nixpkgs/pkgs/development/libraries/aalib/default.nix41
-rw-r--r--nixpkgs/pkgs/development/libraries/abseil-cpp/default.nix24
-rw-r--r--nixpkgs/pkgs/development/libraries/accounts-qt/default.nix30
-rw-r--r--nixpkgs/pkgs/development/libraries/accountsservice/Disable-methods-that-change-files-in-etc.patch130
-rw-r--r--nixpkgs/pkgs/development/libraries/accountsservice/default.nix50
-rw-r--r--nixpkgs/pkgs/development/libraries/accountsservice/no-create-dirs.patch15
-rw-r--r--nixpkgs/pkgs/development/libraries/ace/default.nix36
-rw-r--r--nixpkgs/pkgs/development/libraries/acl/default.nix31
-rw-r--r--nixpkgs/pkgs/development/libraries/adns/default.nix36
-rw-r--r--nixpkgs/pkgs/development/libraries/afflib/default.nix28
-rw-r--r--nixpkgs/pkgs/development/libraries/aften/default.nix21
-rw-r--r--nixpkgs/pkgs/development/libraries/agda/Agda-Sheaves/default.nix24
-rw-r--r--nixpkgs/pkgs/development/libraries/agda/TotalParserCombinators/contextfile259
-rw-r--r--nixpkgs/pkgs/development/libraries/agda/TotalParserCombinators/default.nix26
-rw-r--r--nixpkgs/pkgs/development/libraries/agda/agda-base/default.nix23
-rw-r--r--nixpkgs/pkgs/development/libraries/agda/agda-iowa-stdlib/default.nix27
-rw-r--r--nixpkgs/pkgs/development/libraries/agda/agda-prelude/default.nix23
-rw-r--r--nixpkgs/pkgs/development/libraries/agda/agda-stdlib/default.nix29
-rw-r--r--nixpkgs/pkgs/development/libraries/agda/bitvector/default.nix24
-rw-r--r--nixpkgs/pkgs/development/libraries/agda/categories/default.nix24
-rw-r--r--nixpkgs/pkgs/development/libraries/agda/pretty/contextfile43
-rw-r--r--nixpkgs/pkgs/development/libraries/agda/pretty/default.nix26
-rw-r--r--nixpkgs/pkgs/development/libraries/agg/default.nix42
-rw-r--r--nixpkgs/pkgs/development/libraries/alembic/default.nix46
-rw-r--r--nixpkgs/pkgs/development/libraries/alkimia/default.nix32
-rw-r--r--nixpkgs/pkgs/development/libraries/allegro/5.nix52
-rw-r--r--nixpkgs/pkgs/development/libraries/allegro/allegro4-mesa-18.2.5.patch26
-rw-r--r--nixpkgs/pkgs/development/libraries/allegro/default.nix37
-rw-r--r--nixpkgs/pkgs/development/libraries/allegro/nix-unstable-sandbox-fix.patch13
-rw-r--r--nixpkgs/pkgs/development/libraries/alure/default.nix20
-rw-r--r--nixpkgs/pkgs/development/libraries/amrnb/default.nix31
-rw-r--r--nixpkgs/pkgs/development/libraries/amrwb/default.nix33
-rw-r--r--nixpkgs/pkgs/development/libraries/amtk/default.nix40
-rw-r--r--nixpkgs/pkgs/development/libraries/apache-activemq/default.nix30
-rw-r--r--nixpkgs/pkgs/development/libraries/appstream-glib/default.nix55
-rw-r--r--nixpkgs/pkgs/development/libraries/appstream-glib/paths.patch11
-rw-r--r--nixpkgs/pkgs/development/libraries/appstream/default.nix52
-rw-r--r--nixpkgs/pkgs/development/libraries/appstream/qt.nix18
-rw-r--r--nixpkgs/pkgs/development/libraries/apr-util/default.nix71
-rw-r--r--nixpkgs/pkgs/development/libraries/apr-util/include-static-dependencies.patch12
-rw-r--r--nixpkgs/pkgs/development/libraries/apr/default.nix40
-rw-r--r--nixpkgs/pkgs/development/libraries/apr/is-this-a-compiler-bug.patch17
-rw-r--r--nixpkgs/pkgs/development/libraries/aqbanking/default.nix40
-rw-r--r--nixpkgs/pkgs/development/libraries/aqbanking/gwenhywfar.nix71
-rw-r--r--nixpkgs/pkgs/development/libraries/aqbanking/libchipcard.nix33
-rw-r--r--nixpkgs/pkgs/development/libraries/aqbanking/sources.nix12
-rwxr-xr-xnixpkgs/pkgs/development/libraries/aqbanking/update.sh92
-rw-r--r--nixpkgs/pkgs/development/libraries/aravis/default.nix90
-rw-r--r--nixpkgs/pkgs/development/libraries/arb/default.nix27
-rw-r--r--nixpkgs/pkgs/development/libraries/argp-standalone/default.nix55
-rw-r--r--nixpkgs/pkgs/development/libraries/arguments/default.nix31
-rw-r--r--nixpkgs/pkgs/development/libraries/armadillo/default.nix29
-rw-r--r--nixpkgs/pkgs/development/libraries/armadillo/use-unix-config-on-OS-X.patch10
-rw-r--r--nixpkgs/pkgs/development/libraries/arrow-cpp/darwin.patch11
-rw-r--r--nixpkgs/pkgs/development/libraries/arrow-cpp/default.nix80
-rw-r--r--nixpkgs/pkgs/development/libraries/asio/1.10.nix6
-rw-r--r--nixpkgs/pkgs/development/libraries/asio/1.12.nix6
-rw-r--r--nixpkgs/pkgs/development/libraries/asio/generic.nix26
-rw-r--r--nixpkgs/pkgs/development/libraries/aspell/aspell-with-dicts.nix36
-rw-r--r--nixpkgs/pkgs/development/libraries/aspell/clang.patch18
-rw-r--r--nixpkgs/pkgs/development/libraries/aspell/data-dirs-from-nix-profiles.patch38
-rw-r--r--nixpkgs/pkgs/development/libraries/aspell/default.nix62
-rw-r--r--nixpkgs/pkgs/development/libraries/aspell/dictionaries.nix944
-rw-r--r--nixpkgs/pkgs/development/libraries/assimp/default.nix23
-rw-r--r--nixpkgs/pkgs/development/libraries/at-spi2-atk/default.nix48
-rw-r--r--nixpkgs/pkgs/development/libraries/at-spi2-core/default.nix51
-rw-r--r--nixpkgs/pkgs/development/libraries/atk/default.nix56
-rw-r--r--nixpkgs/pkgs/development/libraries/atkmm/default.nix32
-rw-r--r--nixpkgs/pkgs/development/libraries/attica/default.nix20
-rw-r--r--nixpkgs/pkgs/development/libraries/attr/default.nix35
-rw-r--r--nixpkgs/pkgs/development/libraries/aubio/default.nix23
-rw-r--r--nixpkgs/pkgs/development/libraries/audio/jamomacore/default.nix25
-rw-r--r--nixpkgs/pkgs/development/libraries/audio/libbass/default.nix60
-rw-r--r--nixpkgs/pkgs/development/libraries/audio/libbs2b/default.nix23
-rw-r--r--nixpkgs/pkgs/development/libraries/audio/libgme/default.nix23
-rw-r--r--nixpkgs/pkgs/development/libraries/audio/libmysofa/default.nix26
-rw-r--r--nixpkgs/pkgs/development/libraries/audio/libsmf/default.nix21
-rw-r--r--nixpkgs/pkgs/development/libraries/audio/lilv/default.nix22
-rw-r--r--nixpkgs/pkgs/development/libraries/audio/lv2/default.nix22
-rw-r--r--nixpkgs/pkgs/development/libraries/audio/lv2/unstable.nix23
-rw-r--r--nixpkgs/pkgs/development/libraries/audio/lvtk/default.nix34
-rw-r--r--nixpkgs/pkgs/development/libraries/audio/ntk/default.nix26
-rw-r--r--nixpkgs/pkgs/development/libraries/audio/raul/default.nix23
-rw-r--r--nixpkgs/pkgs/development/libraries/audio/rtaudio/default.nix30
-rw-r--r--nixpkgs/pkgs/development/libraries/audio/rtmidi/default.nix31
-rw-r--r--nixpkgs/pkgs/development/libraries/audio/sratom/default.nix22
-rw-r--r--nixpkgs/pkgs/development/libraries/audio/suil/default.nix32
-rw-r--r--nixpkgs/pkgs/development/libraries/audio/vamp/default.nix31
-rw-r--r--nixpkgs/pkgs/development/libraries/audio/zita-alsa-pcmi/default.nix64
-rw-r--r--nixpkgs/pkgs/development/libraries/audio/zita-convolver/default.nix36
-rw-r--r--nixpkgs/pkgs/development/libraries/audio/zita-resampler/default.nix33
-rw-r--r--nixpkgs/pkgs/development/libraries/audiofile/CVE-2015-7747.patch161
-rw-r--r--nixpkgs/pkgs/development/libraries/audiofile/default.nix76
-rw-r--r--nixpkgs/pkgs/development/libraries/audiofile/gcc-6.patch30
-rw-r--r--nixpkgs/pkgs/development/libraries/avahi/default.nix83
-rw-r--r--nixpkgs/pkgs/development/libraries/avahi/no-mkdir-localstatedir.patch12
-rw-r--r--nixpkgs/pkgs/development/libraries/avro-c++/default.nix33
-rw-r--r--nixpkgs/pkgs/development/libraries/avro-c/default.nix30
-rw-r--r--nixpkgs/pkgs/development/libraries/aws-c-common/default.nix28
-rw-r--r--nixpkgs/pkgs/development/libraries/aws-c-event-stream/default.nix29
-rw-r--r--nixpkgs/pkgs/development/libraries/aws-checksums/default.nix23
-rw-r--r--nixpkgs/pkgs/development/libraries/aws-sdk-cpp/default.nix60
-rw-r--r--nixpkgs/pkgs/development/libraries/babl/default.nix21
-rw-r--r--nixpkgs/pkgs/development/libraries/backward-cpp/default.nix30
-rw-r--r--nixpkgs/pkgs/development/libraries/bamf/default.nix83
-rw-r--r--nixpkgs/pkgs/development/libraries/bctoolbox/default.nix21
-rw-r--r--nixpkgs/pkgs/development/libraries/beecrypt/default.nix16
-rw-r--r--nixpkgs/pkgs/development/libraries/beignet/clang_llvm.patch49
-rw-r--r--nixpkgs/pkgs/development/libraries/beignet/default.nix116
-rw-r--r--nixpkgs/pkgs/development/libraries/belcard/default.nix24
-rw-r--r--nixpkgs/pkgs/development/libraries/belle-sip/default.nix37
-rw-r--r--nixpkgs/pkgs/development/libraries/belr/default.nix24
-rw-r--r--nixpkgs/pkgs/development/libraries/biblesync/default.nix34
-rw-r--r--nixpkgs/pkgs/development/libraries/blitz/blitz-gcc47.patch33
-rw-r--r--nixpkgs/pkgs/development/libraries/blitz/blitz-testsuite-stencil-et.patch13
-rw-r--r--nixpkgs/pkgs/development/libraries/blitz/default.nix82
-rw-r--r--nixpkgs/pkgs/development/libraries/bobcat/default.nix43
-rw-r--r--nixpkgs/pkgs/development/libraries/boehm-gc/7.6.6.nix71
-rw-r--r--nixpkgs/pkgs/development/libraries/boehm-gc/default.nix76
-rw-r--r--nixpkgs/pkgs/development/libraries/boehm-gc/riscv.patch53
-rw-r--r--nixpkgs/pkgs/development/libraries/boolstuff/default.nix22
-rw-r--r--nixpkgs/pkgs/development/libraries/boost-process/default.nix31
-rw-r--r--nixpkgs/pkgs/development/libraries/boost/1.55.nix12
-rw-r--r--nixpkgs/pkgs/development/libraries/boost/1.59.nix10
-rw-r--r--nixpkgs/pkgs/development/libraries/boost/1.60.nix11
-rw-r--r--nixpkgs/pkgs/development/libraries/boost/1.62.nix12
-rw-r--r--nixpkgs/pkgs/development/libraries/boost/1.63.nix12
-rw-r--r--nixpkgs/pkgs/development/libraries/boost/1.64.nix12
-rw-r--r--nixpkgs/pkgs/development/libraries/boost/1.65.nix12
-rw-r--r--nixpkgs/pkgs/development/libraries/boost/1.66.nix11
-rw-r--r--nixpkgs/pkgs/development/libraries/boost/1.67.nix39
-rw-r--r--nixpkgs/pkgs/development/libraries/boost/1.68.nix11
-rw-r--r--nixpkgs/pkgs/development/libraries/boost/1.69.nix11
-rw-r--r--nixpkgs/pkgs/development/libraries/boost/1.70.nix11
-rw-r--r--nixpkgs/pkgs/development/libraries/boost/clang-math-2.patch45
-rw-r--r--nixpkgs/pkgs/development/libraries/boost/clang-math.patch65
-rw-r--r--nixpkgs/pkgs/development/libraries/boost/darwin-1.55-no-system-python.patch45
-rw-r--r--nixpkgs/pkgs/development/libraries/boost/darwin-no-system-python.patch45
-rw-r--r--nixpkgs/pkgs/development/libraries/boost/gcc-5.patch64
-rw-r--r--nixpkgs/pkgs/development/libraries/boost/generic.nix188
-rw-r--r--nixpkgs/pkgs/development/libraries/bootil/default.nix45
-rw-r--r--nixpkgs/pkgs/development/libraries/boringssl/default.nix39
-rw-r--r--nixpkgs/pkgs/development/libraries/botan/2.0.nix10
-rw-r--r--nixpkgs/pkgs/development/libraries/botan/2.0.upstream10
-rw-r--r--nixpkgs/pkgs/development/libraries/botan/default.nix11
-rw-r--r--nixpkgs/pkgs/development/libraries/botan/default.upstream9
-rw-r--r--nixpkgs/pkgs/development/libraries/botan/generic.nix52
-rw-r--r--nixpkgs/pkgs/development/libraries/box2d/default.nix38
-rw-r--r--nixpkgs/pkgs/development/libraries/brigand/default.nix26
-rw-r--r--nixpkgs/pkgs/development/libraries/buddy/default.nix27
-rw-r--r--nixpkgs/pkgs/development/libraries/buddy/gcc-4.3.3-fixes.patch22
-rw-r--r--nixpkgs/pkgs/development/libraries/bullet/default.nix56
-rw-r--r--nixpkgs/pkgs/development/libraries/bullet/gwen-narrowing.patch22
-rw-r--r--nixpkgs/pkgs/development/libraries/bullet/roboschool-fork.nix57
-rw-r--r--nixpkgs/pkgs/development/libraries/bulletml/default.nix73
-rw-r--r--nixpkgs/pkgs/development/libraries/bwidget/default.nix31
-rw-r--r--nixpkgs/pkgs/development/libraries/bzrtp/default.nix24
-rw-r--r--nixpkgs/pkgs/development/libraries/c-ares/default.nix42
-rw-r--r--nixpkgs/pkgs/development/libraries/c-blosc/default.nix24
-rw-r--r--nixpkgs/pkgs/development/libraries/caf/default.nix23
-rw-r--r--nixpkgs/pkgs/development/libraries/cairo/0001-test-don-t-always-build-FreeType-dependent-test.patch34
-rw-r--r--nixpkgs/pkgs/development/libraries/cairo/0002-gl-don-t-implicitly-include-X11-headers.patch40
-rw-r--r--nixpkgs/pkgs/development/libraries/cairo/0003-test-only-build-GL-tests-when-Xlib-is-enabled.patch41
-rw-r--r--nixpkgs/pkgs/development/libraries/cairo/0004-util-don-t-build-cairo-sphinx-unless-PNG-enabled.patch32
-rw-r--r--nixpkgs/pkgs/development/libraries/cairo/default.nix141
-rw-r--r--nixpkgs/pkgs/development/libraries/cairomm/default.nix44
-rw-r--r--nixpkgs/pkgs/development/libraries/capnproto/default.nix24
-rw-r--r--nixpkgs/pkgs/development/libraries/capstone/default.nix29
-rw-r--r--nixpkgs/pkgs/development/libraries/catch/default.nix27
-rw-r--r--nixpkgs/pkgs/development/libraries/catch2/default.nix25
-rw-r--r--nixpkgs/pkgs/development/libraries/ccrtp/1.8.nix24
-rw-r--r--nixpkgs/pkgs/development/libraries/ccrtp/default.nix27
-rw-r--r--nixpkgs/pkgs/development/libraries/ccrtp/gcc-4.6-fix.patch20
-rw-r--r--nixpkgs/pkgs/development/libraries/cctz/default.nix27
-rw-r--r--nixpkgs/pkgs/development/libraries/cddlib/default.nix33
-rw-r--r--nixpkgs/pkgs/development/libraries/cdk/default.nix25
-rw-r--r--nixpkgs/pkgs/development/libraries/cdo/default.nix37
-rw-r--r--nixpkgs/pkgs/development/libraries/cegui/default.nix21
-rw-r--r--nixpkgs/pkgs/development/libraries/celt/0.5.1.nix17
-rw-r--r--nixpkgs/pkgs/development/libraries/celt/0.7.nix10
-rw-r--r--nixpkgs/pkgs/development/libraries/celt/default.nix10
-rw-r--r--nixpkgs/pkgs/development/libraries/celt/generic.nix28
-rw-r--r--nixpkgs/pkgs/development/libraries/ceres-solver/default.nix43
-rw-r--r--nixpkgs/pkgs/development/libraries/cfitsio/darwin-curl-config.patch25
-rw-r--r--nixpkgs/pkgs/development/libraries/cfitsio/darwin-rpath-universal.patch21
-rw-r--r--nixpkgs/pkgs/development/libraries/cfitsio/default.nix42
-rw-r--r--nixpkgs/pkgs/development/libraries/cgui/default.nix27
-rw-r--r--nixpkgs/pkgs/development/libraries/check/default.nix36
-rw-r--r--nixpkgs/pkgs/development/libraries/chipmunk/default.nix30
-rw-r--r--nixpkgs/pkgs/development/libraries/chmlib/default.nix17
-rw-r--r--nixpkgs/pkgs/development/libraries/chromaprint/default.nix25
-rw-r--r--nixpkgs/pkgs/development/libraries/cimg/default.nix33
-rw-r--r--nixpkgs/pkgs/development/libraries/civetweb/0001-allow-setting-paths-in-makefile.patch55
-rw-r--r--nixpkgs/pkgs/development/libraries/civetweb/default.nix41
-rw-r--r--nixpkgs/pkgs/development/libraries/cl/default.nix34
-rw-r--r--nixpkgs/pkgs/development/libraries/classads/default.nix25
-rw-r--r--nixpkgs/pkgs/development/libraries/clearsilver/default.nix43
-rw-r--r--nixpkgs/pkgs/development/libraries/clipper/default.nix27
-rw-r--r--nixpkgs/pkgs/development/libraries/cln/default.nix20
-rw-r--r--nixpkgs/pkgs/development/libraries/cloog-ppl/default.nix70
-rw-r--r--nixpkgs/pkgs/development/libraries/cloog-ppl/fix-ppl-version.patch16
-rw-r--r--nixpkgs/pkgs/development/libraries/cloog/0.18.0.nix63
-rw-r--r--nixpkgs/pkgs/development/libraries/cloog/default.nix64
-rw-r--r--nixpkgs/pkgs/development/libraries/clucene-core/2.x.nix57
-rw-r--r--nixpkgs/pkgs/development/libraries/clucene-core/Fix-pkgconfig-file-by-adding-clucene-shared-library.patch19
-rw-r--r--nixpkgs/pkgs/development/libraries/clucene-core/Fixing_ZLIB_configuration_in_shared_CMakeLists.patch20
-rw-r--r--nixpkgs/pkgs/development/libraries/clucene-core/Install-contribs-lib.patch49
-rw-r--r--nixpkgs/pkgs/development/libraries/clucene-core/default.nix29
-rw-r--r--nixpkgs/pkgs/development/libraries/clucene-core/fix-darwin.patch75
-rw-r--r--nixpkgs/pkgs/development/libraries/clucene-core/gcc6.patch146
-rw-r--r--nixpkgs/pkgs/development/libraries/clutter-gst/default.nix35
-rw-r--r--nixpkgs/pkgs/development/libraries/clutter-gtk/default.nix37
-rw-r--r--nixpkgs/pkgs/development/libraries/clutter/default.nix61
-rw-r--r--nixpkgs/pkgs/development/libraries/cmark/default.nix27
-rw-r--r--nixpkgs/pkgs/development/libraries/cminpack/default.nix26
-rw-r--r--nixpkgs/pkgs/development/libraries/cmocka/default.nix49
-rw-r--r--nixpkgs/pkgs/development/libraries/cmrt/default.nix24
-rw-r--r--nixpkgs/pkgs/development/libraries/codec2/default.nix25
-rw-r--r--nixpkgs/pkgs/development/libraries/cogl/default.nix81
-rw-r--r--nixpkgs/pkgs/development/libraries/coin3d/default.nix33
-rw-r--r--nixpkgs/pkgs/development/libraries/coin3d/gcc-4.8.patch38
-rw-r--r--nixpkgs/pkgs/development/libraries/coin3d/sbhashentry.patch25
-rw-r--r--nixpkgs/pkgs/development/libraries/commoncpp2/default.nix38
-rw-r--r--nixpkgs/pkgs/development/libraries/concurrencykit/default.nix24
-rw-r--r--nixpkgs/pkgs/development/libraries/coprthr/default.nix38
-rw-r--r--nixpkgs/pkgs/development/libraries/coredumper/default.nix18
-rw-r--r--nixpkgs/pkgs/development/libraries/cpp-hocon/default.nix28
-rw-r--r--nixpkgs/pkgs/development/libraries/cpp-ipfs-api/default.nix23
-rw-r--r--nixpkgs/pkgs/development/libraries/cpp-netlib/default.nix30
-rw-r--r--nixpkgs/pkgs/development/libraries/cppcms/default.nix28
-rw-r--r--nixpkgs/pkgs/development/libraries/cppdb/default.nix26
-rw-r--r--nixpkgs/pkgs/development/libraries/cpptest/default.nix18
-rw-r--r--nixpkgs/pkgs/development/libraries/cppunit/default.nix18
-rw-r--r--nixpkgs/pkgs/development/libraries/cpputest/default.nix19
-rw-r--r--nixpkgs/pkgs/development/libraries/cppzmq/default.nix30
-rw-r--r--nixpkgs/pkgs/development/libraries/cracklib/default.nix41
-rw-r--r--nixpkgs/pkgs/development/libraries/cre2/default.nix34
-rw-r--r--nixpkgs/pkgs/development/libraries/croaring/default.nix28
-rw-r--r--nixpkgs/pkgs/development/libraries/crypto++/GNUmakefile-darwin.patch15
-rw-r--r--nixpkgs/pkgs/development/libraries/crypto++/default.nix49
-rw-r--r--nixpkgs/pkgs/development/libraries/crypto++/dll.patch28
-rw-r--r--nixpkgs/pkgs/development/libraries/csfml/default.nix30
-rw-r--r--nixpkgs/pkgs/development/libraries/ctl/default.nix31
-rw-r--r--nixpkgs/pkgs/development/libraries/ctpl/default.nix22
-rw-r--r--nixpkgs/pkgs/development/libraries/ctpp2/default.nix28
-rw-r--r--nixpkgs/pkgs/development/libraries/curlcpp/default.nix24
-rw-r--r--nixpkgs/pkgs/development/libraries/curlpp/default.nix23
-rw-r--r--nixpkgs/pkgs/development/libraries/cutee/default.nix27
-rw-r--r--nixpkgs/pkgs/development/libraries/cutelyst/default.nix46
-rw-r--r--nixpkgs/pkgs/development/libraries/cwiid/default.nix42
-rw-r--r--nixpkgs/pkgs/development/libraries/cxx-prettyprint/default.nix29
-rw-r--r--nixpkgs/pkgs/development/libraries/cxxtest/default.nix28
-rw-r--r--nixpkgs/pkgs/development/libraries/cxxtools/default.nix21
-rw-r--r--nixpkgs/pkgs/development/libraries/cyrus-sasl/cyrus-sasl-ac-try-run-fix.patch12
-rw-r--r--nixpkgs/pkgs/development/libraries/cyrus-sasl/default.nix48
-rw-r--r--nixpkgs/pkgs/development/libraries/cyrus-sasl/missing-size_t.patch13
-rw-r--r--nixpkgs/pkgs/development/libraries/czmq/3.x.nix26
-rw-r--r--nixpkgs/pkgs/development/libraries/czmq/4.x.nix21
-rw-r--r--nixpkgs/pkgs/development/libraries/czmq/czmq3-gcc7.patch26
-rw-r--r--nixpkgs/pkgs/development/libraries/czmqpp/default.nix28
-rw-r--r--nixpkgs/pkgs/development/libraries/czmqpp/socket.patch17
-rw-r--r--nixpkgs/pkgs/development/libraries/dav1d/default.nix31
-rw-r--r--nixpkgs/pkgs/development/libraries/db/CVE-2017-10140-4.8-cwd-db_config.patch11
-rw-r--r--nixpkgs/pkgs/development/libraries/db/CVE-2017-10140-cwd-db_config.patch11
-rw-r--r--nixpkgs/pkgs/development/libraries/db/clang-4.8.patch141
-rw-r--r--nixpkgs/pkgs/development/libraries/db/clang-5.3.patch141
-rw-r--r--nixpkgs/pkgs/development/libraries/db/clang-6.0.patch123
-rw-r--r--nixpkgs/pkgs/development/libraries/db/db-4.8.nix10
-rw-r--r--nixpkgs/pkgs/development/libraries/db/db-5.3.nix7
-rw-r--r--nixpkgs/pkgs/development/libraries/db/db-6.0.nix8
-rw-r--r--nixpkgs/pkgs/development/libraries/db/db-6.2.nix8
-rw-r--r--nixpkgs/pkgs/development/libraries/db/generic.nix56
-rw-r--r--nixpkgs/pkgs/development/libraries/dbus-cplusplus/default.nix46
-rw-r--r--nixpkgs/pkgs/development/libraries/dbus-glib/default.nix37
-rw-r--r--nixpkgs/pkgs/development/libraries/dbus-sharp-glib/dbus-sharp-glib-1.0.nix25
-rw-r--r--nixpkgs/pkgs/development/libraries/dbus-sharp-glib/default.nix25
-rw-r--r--nixpkgs/pkgs/development/libraries/dbus-sharp/dbus-sharp-1.0.nix25
-rw-r--r--nixpkgs/pkgs/development/libraries/dbus-sharp/default.nix28
-rw-r--r--nixpkgs/pkgs/development/libraries/dbus/default.nix92
-rw-r--r--nixpkgs/pkgs/development/libraries/dbus/implement-getgrouplist.patch108
-rw-r--r--nixpkgs/pkgs/development/libraries/dbus/make-dbus-conf.nix42
-rw-r--r--nixpkgs/pkgs/development/libraries/dbus/make-session-conf.xsl31
-rw-r--r--nixpkgs/pkgs/development/libraries/dbus/make-system-conf.xsl35
-rw-r--r--nixpkgs/pkgs/development/libraries/dbus/systemd.patch14
-rw-r--r--nixpkgs/pkgs/development/libraries/dbxml/cxx11.patch59
-rw-r--r--nixpkgs/pkgs/development/libraries/dbxml/default.nix42
-rw-r--r--nixpkgs/pkgs/development/libraries/dbxml/incorrect-optimization.patch34
-rw-r--r--nixpkgs/pkgs/development/libraries/dclib/default.nix16
-rw-r--r--nixpkgs/pkgs/development/libraries/dclxvi/default.nix35
-rw-r--r--nixpkgs/pkgs/development/libraries/dee/default.nix57
-rw-r--r--nixpkgs/pkgs/development/libraries/dirac/default.nix31
-rw-r--r--nixpkgs/pkgs/development/libraries/dirac/dirac-1.0.2.patch362
-rw-r--r--nixpkgs/pkgs/development/libraries/directfb/default.nix62
-rw-r--r--nixpkgs/pkgs/development/libraries/directfb/default.upstream3
-rw-r--r--nixpkgs/pkgs/development/libraries/dleyna-connector-dbus/default.nix25
-rw-r--r--nixpkgs/pkgs/development/libraries/dleyna-core/0001-Search-connectors-in-DLEYNA_CONNECTOR_PATH.patch95
-rw-r--r--nixpkgs/pkgs/development/libraries/dleyna-core/default.nix49
-rw-r--r--nixpkgs/pkgs/development/libraries/dleyna-core/setup-hook.sh8
-rw-r--r--nixpkgs/pkgs/development/libraries/dleyna-renderer/default.nix61
-rw-r--r--nixpkgs/pkgs/development/libraries/dleyna-renderer/gupnp-1.2.diff130
-rw-r--r--nixpkgs/pkgs/development/libraries/dleyna-server/default.nix64
-rw-r--r--nixpkgs/pkgs/development/libraries/dlib/default.nix36
-rw-r--r--nixpkgs/pkgs/development/libraries/docopt_cpp/default.nix30
-rw-r--r--nixpkgs/pkgs/development/libraries/dotconf/default.nix24
-rw-r--r--nixpkgs/pkgs/development/libraries/dotnetfx35/default.nix23
-rw-r--r--nixpkgs/pkgs/development/libraries/dotnetfx40/default.nix23
-rw-r--r--nixpkgs/pkgs/development/libraries/double-conversion/default.nix32
-rw-r--r--nixpkgs/pkgs/development/libraries/dqlite/default.nix27
-rw-r--r--nixpkgs/pkgs/development/libraries/drumstick/default.nix35
-rw-r--r--nixpkgs/pkgs/development/libraries/dssi/default.nix29
-rw-r--r--nixpkgs/pkgs/development/libraries/dxflib/default.nix17
-rw-r--r--nixpkgs/pkgs/development/libraries/dyncall/default.nix36
-rw-r--r--nixpkgs/pkgs/development/libraries/easyloggingpp/default.nix31
-rw-r--r--nixpkgs/pkgs/development/libraries/eccodes/default.nix56
-rw-r--r--nixpkgs/pkgs/development/libraries/eclib/default.nix49
-rw-r--r--nixpkgs/pkgs/development/libraries/editline/default.nix24
-rw-r--r--nixpkgs/pkgs/development/libraries/eigen/2.0.nix25
-rw-r--r--nixpkgs/pkgs/development/libraries/eigen/default.nix29
-rw-r--r--nixpkgs/pkgs/development/libraries/eigen/default.upstream4
-rw-r--r--nixpkgs/pkgs/development/libraries/eigen/include-dir.patch49
-rw-r--r--nixpkgs/pkgs/development/libraries/elementary-cmake-modules/default.nix29
-rw-r--r--nixpkgs/pkgs/development/libraries/elementary-cmake-modules/setup-hook.sh4
-rw-r--r--nixpkgs/pkgs/development/libraries/elf-header/default.nix44
-rw-r--r--nixpkgs/pkgs/development/libraries/embree/2.x.nix27
-rw-r--r--nixpkgs/pkgs/development/libraries/enchant/1.x.nix23
-rw-r--r--nixpkgs/pkgs/development/libraries/enchant/2.x.nix29
-rw-r--r--nixpkgs/pkgs/development/libraries/enet/default.nix18
-rw-r--r--nixpkgs/pkgs/development/libraries/epoxy/default.nix41
-rw-r--r--nixpkgs/pkgs/development/libraries/epoxy/libgl-path.patch24
-rw-r--r--nixpkgs/pkgs/development/libraries/ethash/default.nix58
-rw-r--r--nixpkgs/pkgs/development/libraries/eventlog/default.nix25
-rw-r--r--nixpkgs/pkgs/development/libraries/exempi/default.nix36
-rw-r--r--nixpkgs/pkgs/development/libraries/exiv2/default.nix33
-rw-r--r--nixpkgs/pkgs/development/libraries/exosip/default.nix20
-rw-r--r--nixpkgs/pkgs/development/libraries/expat/default.nix31
-rw-r--r--nixpkgs/pkgs/development/libraries/faac/default.nix38
-rw-r--r--nixpkgs/pkgs/development/libraries/faad2/default.nix49
-rw-r--r--nixpkgs/pkgs/development/libraries/farbfeld/default.nix27
-rw-r--r--nixpkgs/pkgs/development/libraries/farstream/default.nix33
-rw-r--r--nixpkgs/pkgs/development/libraries/fastjson/default.nix26
-rw-r--r--nixpkgs/pkgs/development/libraries/fastpbkdf2/default.nix31
-rw-r--r--nixpkgs/pkgs/development/libraries/fcgi/default.nix31
-rw-r--r--nixpkgs/pkgs/development/libraries/fcgi/gcc-4.4.diff12
-rw-r--r--nixpkgs/pkgs/development/libraries/fcppt/default.nix35
-rw-r--r--nixpkgs/pkgs/development/libraries/fdk-aac/default.nix25
-rw-r--r--nixpkgs/pkgs/development/libraries/fflas-ffpack/1.nix25
-rw-r--r--nixpkgs/pkgs/development/libraries/fflas-ffpack/default.nix54
-rw-r--r--nixpkgs/pkgs/development/libraries/ffmpeg-full/default.nix465
-rw-r--r--nixpkgs/pkgs/development/libraries/ffmpeg-sixel/default.nix37
-rw-r--r--nixpkgs/pkgs/development/libraries/ffmpeg/2.8.nix7
-rw-r--r--nixpkgs/pkgs/development/libraries/ffmpeg/3.4.nix12
-rw-r--r--nixpkgs/pkgs/development/libraries/ffmpeg/4.nix12
-rw-r--r--nixpkgs/pkgs/development/libraries/ffmpeg/generic.nix211
-rw-r--r--nixpkgs/pkgs/development/libraries/ffmpegthumbnailer/default.nix34
-rw-r--r--nixpkgs/pkgs/development/libraries/ffms/default.nix26
-rw-r--r--nixpkgs/pkgs/development/libraries/fftw/default.nix50
-rw-r--r--nixpkgs/pkgs/development/libraries/filter-audio/default.nix24
-rw-r--r--nixpkgs/pkgs/development/libraries/flann/default.nix30
-rw-r--r--nixpkgs/pkgs/development/libraries/flatbuffers/default.nix37
-rw-r--r--nixpkgs/pkgs/development/libraries/flatcc/default.nix29
-rw-r--r--nixpkgs/pkgs/development/libraries/flatpak/bubblewrap-paths.patch15
-rw-r--r--nixpkgs/pkgs/development/libraries/flatpak/default.nix85
-rw-r--r--nixpkgs/pkgs/development/libraries/flatpak/fix-paths.patch20
-rw-r--r--nixpkgs/pkgs/development/libraries/flatpak/fix-test-paths.patch141
-rw-r--r--nixpkgs/pkgs/development/libraries/flatpak/respect-xml-catalog-files-var.patch13
-rw-r--r--nixpkgs/pkgs/development/libraries/flatpak/unset-env-vars.patch10
-rw-r--r--nixpkgs/pkgs/development/libraries/flatpak/use-flatpak-from-path.patch48
-rw-r--r--nixpkgs/pkgs/development/libraries/flatpak/validate-icon-pixbuf.patch13
-rw-r--r--nixpkgs/pkgs/development/libraries/flint/default.nix63
-rw-r--r--nixpkgs/pkgs/development/libraries/flite/default.nix28
-rw-r--r--nixpkgs/pkgs/development/libraries/fltk/1.4.nix52
-rw-r--r--nixpkgs/pkgs/development/libraries/fltk/default.nix50
-rw-r--r--nixpkgs/pkgs/development/libraries/fltk/nsosv.patch20
-rw-r--r--nixpkgs/pkgs/development/libraries/fmt/default.nix43
-rw-r--r--nixpkgs/pkgs/development/libraries/folks/default.nix105
-rw-r--r--nixpkgs/pkgs/development/libraries/folly/default.nix38
-rw-r--r--nixpkgs/pkgs/development/libraries/fontconfig-ultimate/default.nix48
-rw-r--r--nixpkgs/pkgs/development/libraries/fontconfig/2.10.nix47
-rw-r--r--nixpkgs/pkgs/development/libraries/fontconfig/config-compat.patch28
-rw-r--r--nixpkgs/pkgs/development/libraries/fontconfig/default.nix79
-rw-r--r--nixpkgs/pkgs/development/libraries/fontconfig/make-fonts-cache.nix33
-rw-r--r--nixpkgs/pkgs/development/libraries/fontconfig/make-fonts-conf.nix17
-rw-r--r--nixpkgs/pkgs/development/libraries/fontconfig/make-fonts-conf.xsl59
-rw-r--r--nixpkgs/pkgs/development/libraries/fox/clang.patch13
-rw-r--r--nixpkgs/pkgs/development/libraries/fox/default.nix38
-rw-r--r--nixpkgs/pkgs/development/libraries/fox/fox-1.6.nix42
-rw-r--r--nixpkgs/pkgs/development/libraries/fplll/20160331.nix23
-rw-r--r--nixpkgs/pkgs/development/libraries/fplll/default.nix23
-rw-r--r--nixpkgs/pkgs/development/libraries/frame/default.nix24
-rw-r--r--nixpkgs/pkgs/development/libraries/freealut/default.nix22
-rw-r--r--nixpkgs/pkgs/development/libraries/freeglut/default.nix41
-rw-r--r--nixpkgs/pkgs/development/libraries/freeimage/default.nix73
-rw-r--r--nixpkgs/pkgs/development/libraries/freenect/default.nix29
-rw-r--r--nixpkgs/pkgs/development/libraries/freetds/default.nix33
-rw-r--r--nixpkgs/pkgs/development/libraries/freetts/default.nix37
-rw-r--r--nixpkgs/pkgs/development/libraries/freetype/default.nix72
-rw-r--r--nixpkgs/pkgs/development/libraries/freetype/enable-subpixel-rendering.patch12
-rw-r--r--nixpkgs/pkgs/development/libraries/freetype/enable-table-validation.patch20
-rw-r--r--nixpkgs/pkgs/development/libraries/frei0r/default.nix29
-rw-r--r--nixpkgs/pkgs/development/libraries/fribidi/default.nix47
-rw-r--r--nixpkgs/pkgs/development/libraries/fstrcmp/default.nix31
-rw-r--r--nixpkgs/pkgs/development/libraries/fstrm/default.nix32
-rw-r--r--nixpkgs/pkgs/development/libraries/ftgl/default.nix38
-rw-r--r--nixpkgs/pkgs/development/libraries/funambol/default.nix23
-rw-r--r--nixpkgs/pkgs/development/libraries/g2o/default.nix24
-rw-r--r--nixpkgs/pkgs/development/libraries/gamin/deadlock.patch68
-rw-r--r--nixpkgs/pkgs/development/libraries/gamin/debian-patches.nix10
-rw-r--r--nixpkgs/pkgs/development/libraries/gamin/debian-patches.txt2
-rw-r--r--nixpkgs/pkgs/development/libraries/gamin/default.nix47
-rw-r--r--nixpkgs/pkgs/development/libraries/gamin/returnval.patch12
-rw-r--r--nixpkgs/pkgs/development/libraries/ganv/default.nix23
-rw-r--r--nixpkgs/pkgs/development/libraries/garmintools/default.nix15
-rw-r--r--nixpkgs/pkgs/development/libraries/gbenchmark/default.nix31
-rw-r--r--nixpkgs/pkgs/development/libraries/gcab/default.nix38
-rw-r--r--nixpkgs/pkgs/development/libraries/gcc/libgcc/default.nix152
-rw-r--r--nixpkgs/pkgs/development/libraries/gcc/libstdc++/5.nix117
-rw-r--r--nixpkgs/pkgs/development/libraries/gcc/libstdc++/no-sys-dirs.patch53
-rw-r--r--nixpkgs/pkgs/development/libraries/gcc/libstdc++/struct-ucontext.patch61
-rw-r--r--nixpkgs/pkgs/development/libraries/gcr/default.nix49
-rw-r--r--nixpkgs/pkgs/development/libraries/gd/default.nix46
-rw-r--r--nixpkgs/pkgs/development/libraries/gdal/default.nix96
-rw-r--r--nixpkgs/pkgs/development/libraries/gdal/gdal-1_11.nix63
-rw-r--r--nixpkgs/pkgs/development/libraries/gdal/python.patch17
-rw-r--r--nixpkgs/pkgs/development/libraries/gdata-sharp/default.nix41
-rw-r--r--nixpkgs/pkgs/development/libraries/gdbm/default.nix70
-rw-r--r--nixpkgs/pkgs/development/libraries/gdcm/default.nix40
-rw-r--r--nixpkgs/pkgs/development/libraries/gdk-pixbuf/default.nix100
-rw-r--r--nixpkgs/pkgs/development/libraries/gdk-pixbuf/installed-tests-path.patch13
-rw-r--r--nixpkgs/pkgs/development/libraries/gdk-pixbuf/setup-hook.sh17
-rw-r--r--nixpkgs/pkgs/development/libraries/gdl/default.nix28
-rw-r--r--nixpkgs/pkgs/development/libraries/gdome2/default.nix30
-rw-r--r--nixpkgs/pkgs/development/libraries/gdome2/xml-document.patch11
-rw-r--r--nixpkgs/pkgs/development/libraries/gecode/3.nix23
-rw-r--r--nixpkgs/pkgs/development/libraries/gecode/default.nix26
-rw-r--r--nixpkgs/pkgs/development/libraries/gegl/3.0.nix38
-rw-r--r--nixpkgs/pkgs/development/libraries/gegl/4.0.nix37
-rw-r--r--nixpkgs/pkgs/development/libraries/gegl/default.nix36
-rw-r--r--nixpkgs/pkgs/development/libraries/geis/default.nix60
-rw-r--r--nixpkgs/pkgs/development/libraries/geoclue/add-option-for-installation-sysconfdir.patch81
-rw-r--r--nixpkgs/pkgs/development/libraries/geoclue/default.nix65
-rw-r--r--nixpkgs/pkgs/development/libraries/geocode-glib/default.nix37
-rw-r--r--nixpkgs/pkgs/development/libraries/geocode-glib/installed-tests-path.patch8
-rw-r--r--nixpkgs/pkgs/development/libraries/geoip/default.nix37
-rw-r--r--nixpkgs/pkgs/development/libraries/geos/default.nix20
-rw-r--r--nixpkgs/pkgs/development/libraries/getdata/default.nix19
-rw-r--r--nixpkgs/pkgs/development/libraries/getdns/default.nix41
-rw-r--r--nixpkgs/pkgs/development/libraries/gettext/CVE-2018-18751-bison.patch323
-rw-r--r--nixpkgs/pkgs/development/libraries/gettext/absolute-paths.diff21
-rw-r--r--nixpkgs/pkgs/development/libraries/gettext/default.nix110
-rw-r--r--nixpkgs/pkgs/development/libraries/gettext/gettext-setup-hook.sh17
-rw-r--r--nixpkgs/pkgs/development/libraries/gexiv2/default.nix37
-rw-r--r--nixpkgs/pkgs/development/libraries/gf2x/default.nix33
-rw-r--r--nixpkgs/pkgs/development/libraries/gfbgraph/default.nix36
-rw-r--r--nixpkgs/pkgs/development/libraries/ggz_base_libs/default.nix35
-rw-r--r--nixpkgs/pkgs/development/libraries/giblib/default.nix36
-rw-r--r--nixpkgs/pkgs/development/libraries/giflib/4.1.nix20
-rw-r--r--nixpkgs/pkgs/development/libraries/giflib/5.1.nix18
-rw-r--r--nixpkgs/pkgs/development/libraries/giflib/libungif.nix17
-rw-r--r--nixpkgs/pkgs/development/libraries/gio-sharp/default.nix30
-rw-r--r--nixpkgs/pkgs/development/libraries/git2/0.27.nix36
-rw-r--r--nixpkgs/pkgs/development/libraries/git2/default.nix38
-rw-r--r--nixpkgs/pkgs/development/libraries/givaro/3.7.nix19
-rw-r--r--nixpkgs/pkgs/development/libraries/givaro/3.nix19
-rw-r--r--nixpkgs/pkgs/development/libraries/givaro/default.nix45
-rw-r--r--nixpkgs/pkgs/development/libraries/glbinding/default.nix22
-rw-r--r--nixpkgs/pkgs/development/libraries/gle/default.nix18
-rw-r--r--nixpkgs/pkgs/development/libraries/glew/1.10.nix51
-rw-r--r--nixpkgs/pkgs/development/libraries/glew/default.nix55
-rw-r--r--nixpkgs/pkgs/development/libraries/glfw/2.x.nix31
-rw-r--r--nixpkgs/pkgs/development/libraries/glfw/3.x.nix43
-rw-r--r--nixpkgs/pkgs/development/libraries/glib-networking/default.nix49
-rw-r--r--nixpkgs/pkgs/development/libraries/glib/darwin-compilation.patch24
-rw-r--r--nixpkgs/pkgs/development/libraries/glib/default.nix195
-rw-r--r--nixpkgs/pkgs/development/libraries/glib/fix-gio-launch-desktop-path.patch11
-rw-r--r--nixpkgs/pkgs/development/libraries/glib/gobject_init_on_demand.patch87
-rw-r--r--nixpkgs/pkgs/development/libraries/glib/quark_init_on_demand.patch33
-rw-r--r--nixpkgs/pkgs/development/libraries/glib/schema-override-variable.patch12
-rw-r--r--nixpkgs/pkgs/development/libraries/glib/setup-hook.sh25
-rw-r--r--nixpkgs/pkgs/development/libraries/glib/skip-timer-test.patch17
-rw-r--r--nixpkgs/pkgs/development/libraries/glibc/allow-kernel-2.6.32.patch39
-rw-r--r--nixpkgs/pkgs/development/libraries/glibc/common.nix221
-rw-r--r--nixpkgs/pkgs/development/libraries/glibc/darwin-cross-build.patch103
-rw-r--r--nixpkgs/pkgs/development/libraries/glibc/default.nix128
-rw-r--r--nixpkgs/pkgs/development/libraries/glibc/dont-use-system-ld-so-cache.patch46
-rw-r--r--nixpkgs/pkgs/development/libraries/glibc/dont-use-system-ld-so-preload.patch12
-rw-r--r--nixpkgs/pkgs/development/libraries/glibc/fix-rpc-types-musl-conflicts.patch38
-rw-r--r--nixpkgs/pkgs/development/libraries/glibc/fix-x64-abi.patch35
-rw-r--r--nixpkgs/pkgs/development/libraries/glibc/fix_path_attribute_in_getconf.patch6
-rw-r--r--nixpkgs/pkgs/development/libraries/glibc/info.nix23
-rw-r--r--nixpkgs/pkgs/development/libraries/glibc/locales-builder.sh17
-rw-r--r--nixpkgs/pkgs/development/libraries/glibc/locales.nix68
-rw-r--r--nixpkgs/pkgs/development/libraries/glibc/multi.nix28
-rw-r--r--nixpkgs/pkgs/development/libraries/glibc/nix-locale-archive.patch118
-rw-r--r--nixpkgs/pkgs/development/libraries/glibc/rpcgen-path.patch54
-rw-r--r--nixpkgs/pkgs/development/libraries/glibmm/default.nix40
-rw-r--r--nixpkgs/pkgs/development/libraries/glm/default.nix52
-rw-r--r--nixpkgs/pkgs/development/libraries/globalarrays/default.nix53
-rw-r--r--nixpkgs/pkgs/development/libraries/globalplatform/default.nix21
-rw-r--r--nixpkgs/pkgs/development/libraries/globalplatform/gppcscconnectionplugin.nix21
-rw-r--r--nixpkgs/pkgs/development/libraries/glog/default.nix25
-rw-r--r--nixpkgs/pkgs/development/libraries/gloox/default.nix36
-rw-r--r--nixpkgs/pkgs/development/libraries/glpk/default.nix68
-rw-r--r--nixpkgs/pkgs/development/libraries/glui/default.nix24
-rw-r--r--nixpkgs/pkgs/development/libraries/gmime/2.nix38
-rw-r--r--nixpkgs/pkgs/development/libraries/gmime/3.nix37
-rw-r--r--nixpkgs/pkgs/development/libraries/gmm/default.nix18
-rw-r--r--nixpkgs/pkgs/development/libraries/gmp/4.3.2.nix75
-rw-r--r--nixpkgs/pkgs/development/libraries/gmp/5.1.x.nix78
-rw-r--r--nixpkgs/pkgs/development/libraries/gmp/6.x.nix80
-rw-r--r--nixpkgs/pkgs/development/libraries/gmp/need-size-t.patch18
-rw-r--r--nixpkgs/pkgs/development/libraries/gmtk/default.nix32
-rw-r--r--nixpkgs/pkgs/development/libraries/gmtk/fix-paths.patch20
-rw-r--r--nixpkgs/pkgs/development/libraries/gnet/default.nix24
-rw-r--r--nixpkgs/pkgs/development/libraries/gnome-menus/default.nix33
-rw-r--r--nixpkgs/pkgs/development/libraries/gnome-sharp/default.nix43
-rw-r--r--nixpkgs/pkgs/development/libraries/gnu-config/default.nix39
-rw-r--r--nixpkgs/pkgs/development/libraries/gnu-efi/default.nix33
-rw-r--r--nixpkgs/pkgs/development/libraries/gnutls-kdh/3.5.nix12
-rw-r--r--nixpkgs/pkgs/development/libraries/gnutls-kdh/generic.nix93
-rw-r--r--nixpkgs/pkgs/development/libraries/gnutls/default.nix114
-rw-r--r--nixpkgs/pkgs/development/libraries/gnutls/nix-ssl-cert-file.patch19
-rw-r--r--nixpkgs/pkgs/development/libraries/gnutls/no-security-framework.patch126
-rw-r--r--nixpkgs/pkgs/development/libraries/gobject-introspection/absolute_gir_path.patch11
-rw-r--r--nixpkgs/pkgs/development/libraries/gobject-introspection/absolute_shlib_path.patch142
-rw-r--r--nixpkgs/pkgs/development/libraries/gobject-introspection/default.nix80
-rw-r--r--nixpkgs/pkgs/development/libraries/gobject-introspection/setup-hook.sh27
-rw-r--r--nixpkgs/pkgs/development/libraries/gobject-introspection/test_shlibs.patch43
-rw-r--r--nixpkgs/pkgs/development/libraries/goffice/default.nix45
-rw-r--r--nixpkgs/pkgs/development/libraries/gom/default.nix73
-rw-r--r--nixpkgs/pkgs/development/libraries/gom/longer-stress-timeout.patch13
-rw-r--r--nixpkgs/pkgs/development/libraries/goocanvas/2.x.nix31
-rw-r--r--nixpkgs/pkgs/development/libraries/goocanvas/default.nix28
-rw-r--r--nixpkgs/pkgs/development/libraries/goocanvasmm/default.nix31
-rw-r--r--nixpkgs/pkgs/development/libraries/google-gflags/default.nix38
-rw-r--r--nixpkgs/pkgs/development/libraries/gperftools/default.nix36
-rw-r--r--nixpkgs/pkgs/development/libraries/gpgme/default.nix74
-rw-r--r--nixpkgs/pkgs/development/libraries/grail/default.nix25
-rw-r--r--nixpkgs/pkgs/development/libraries/grantlee/5/default.nix52
-rw-r--r--nixpkgs/pkgs/development/libraries/grantlee/5/grantlee-nix-profiles.patch19
-rw-r--r--nixpkgs/pkgs/development/libraries/grantlee/5/grantlee-no-canonicalize-filepath.patch27
-rw-r--r--nixpkgs/pkgs/development/libraries/grantlee/5/series2
-rw-r--r--nixpkgs/pkgs/development/libraries/grantlee/5/setup-hook.sh13
-rw-r--r--nixpkgs/pkgs/development/libraries/grantlee/default.nix32
-rw-r--r--nixpkgs/pkgs/development/libraries/graphene-hardened-malloc/default.nix55
-rw-r--r--nixpkgs/pkgs/development/libraries/graphene/0001-meson-add-options-for-tests-installation-dirs.patch79
-rw-r--r--nixpkgs/pkgs/development/libraries/graphene/default.nix62
-rw-r--r--nixpkgs/pkgs/development/libraries/grib-api/default.nix64
-rw-r--r--nixpkgs/pkgs/development/libraries/grpc/default.nix44
-rw-r--r--nixpkgs/pkgs/development/libraries/gsasl/default.nix33
-rw-r--r--nixpkgs/pkgs/development/libraries/gsettings-desktop-schemas/default.nix47
-rw-r--r--nixpkgs/pkgs/development/libraries/gsettings-qt/default.nix58
-rw-r--r--nixpkgs/pkgs/development/libraries/gsignond/conf.patch12
-rw-r--r--nixpkgs/pkgs/development/libraries/gsignond/default.nix67
-rw-r--r--nixpkgs/pkgs/development/libraries/gsignond/plugin-load-env.patch35
-rw-r--r--nixpkgs/pkgs/development/libraries/gsignond/plugins/lastfm.nix38
-rw-r--r--nixpkgs/pkgs/development/libraries/gsignond/plugins/mail.nix36
-rw-r--r--nixpkgs/pkgs/development/libraries/gsignond/plugins/oauth.nix48
-rw-r--r--nixpkgs/pkgs/development/libraries/gsignond/plugins/sasl.nix45
-rw-r--r--nixpkgs/pkgs/development/libraries/gsignond/wrapper.nix25
-rw-r--r--nixpkgs/pkgs/development/libraries/gsl/default.nix34
-rw-r--r--nixpkgs/pkgs/development/libraries/gsl/gsl-1_16.nix43
-rw-r--r--nixpkgs/pkgs/development/libraries/gsm/default.nix53
-rw-r--r--nixpkgs/pkgs/development/libraries/gsoap/default.nix45
-rw-r--r--nixpkgs/pkgs/development/libraries/gsound/default.nix28
-rw-r--r--nixpkgs/pkgs/development/libraries/gspell/default.nix35
-rw-r--r--nixpkgs/pkgs/development/libraries/gss/default.nix35
-rw-r--r--nixpkgs/pkgs/development/libraries/gssdp/default.nix66
-rw-r--r--nixpkgs/pkgs/development/libraries/gstreamer/bad/default.nix92
-rw-r--r--nixpkgs/pkgs/development/libraries/gstreamer/bad/fix_pkgconfig_includedir.patch15
-rw-r--r--nixpkgs/pkgs/development/libraries/gstreamer/base/default.nix70
-rw-r--r--nixpkgs/pkgs/development/libraries/gstreamer/base/fix_pkgconfig_includedir.patch15
-rw-r--r--nixpkgs/pkgs/development/libraries/gstreamer/core/default.nix61
-rw-r--r--nixpkgs/pkgs/development/libraries/gstreamer/core/fix_pkgconfig_includedir.patch15
-rw-r--r--nixpkgs/pkgs/development/libraries/gstreamer/core/setup-hook.sh9
-rw-r--r--nixpkgs/pkgs/development/libraries/gstreamer/default.nix29
-rw-r--r--nixpkgs/pkgs/development/libraries/gstreamer/ges/default.nix39
-rw-r--r--nixpkgs/pkgs/development/libraries/gstreamer/ges/fix_pkgconfig_includedir.patch15
-rw-r--r--nixpkgs/pkgs/development/libraries/gstreamer/good/default.nix69
-rw-r--r--nixpkgs/pkgs/development/libraries/gstreamer/good/fix_pkgconfig_includedir.patch15
-rw-r--r--nixpkgs/pkgs/development/libraries/gstreamer/gstreamermm/default.nix34
-rw-r--r--nixpkgs/pkgs/development/libraries/gstreamer/legacy/gnonlin/default.nix23
-rw-r--r--nixpkgs/pkgs/development/libraries/gstreamer/legacy/gst-plugins-bad/default.nix36
-rw-r--r--nixpkgs/pkgs/development/libraries/gstreamer/legacy/gst-plugins-base/default.nix53
-rw-r--r--nixpkgs/pkgs/development/libraries/gstreamer/legacy/gst-plugins-base/gcc-4.9.patch38
-rw-r--r--nixpkgs/pkgs/development/libraries/gstreamer/legacy/gst-plugins-good/default.nix52
-rw-r--r--nixpkgs/pkgs/development/libraries/gstreamer/legacy/gst-plugins-good/linux-headers-3.9.patch27
-rw-r--r--nixpkgs/pkgs/development/libraries/gstreamer/legacy/gst-plugins-good/v4l.patch11
-rw-r--r--nixpkgs/pkgs/development/libraries/gstreamer/legacy/gst-plugins-ugly/default.nix30
-rw-r--r--nixpkgs/pkgs/development/libraries/gstreamer/legacy/gst-python/default.nix37
-rw-r--r--nixpkgs/pkgs/development/libraries/gstreamer/legacy/gst-python/disable-testFake.patch56
-rw-r--r--nixpkgs/pkgs/development/libraries/gstreamer/legacy/gstreamer/darwin.patch14
-rw-r--r--nixpkgs/pkgs/development/libraries/gstreamer/legacy/gstreamer/default.nix84
-rw-r--r--nixpkgs/pkgs/development/libraries/gstreamer/legacy/gstreamer/setup-hook.sh8
-rw-r--r--nixpkgs/pkgs/development/libraries/gstreamer/legacy/gstreamermm/default.nix31
-rw-r--r--nixpkgs/pkgs/development/libraries/gstreamer/legacy/qt-gstreamer/boost1.48.patch49
-rw-r--r--nixpkgs/pkgs/development/libraries/gstreamer/legacy/qt-gstreamer/default.nix20
-rw-r--r--nixpkgs/pkgs/development/libraries/gstreamer/libav/default.nix37
-rw-r--r--nixpkgs/pkgs/development/libraries/gstreamer/qt-gstreamer/default.nix32
-rw-r--r--nixpkgs/pkgs/development/libraries/gstreamer/rtsp-server/default.nix30
-rw-r--r--nixpkgs/pkgs/development/libraries/gstreamer/ugly/default.nix44
-rw-r--r--nixpkgs/pkgs/development/libraries/gstreamer/vaapi/default.nix36
-rw-r--r--nixpkgs/pkgs/development/libraries/gstreamer/validate/default.nix34
-rw-r--r--nixpkgs/pkgs/development/libraries/gtdialog/default.nix33
-rw-r--r--nixpkgs/pkgs/development/libraries/gtdialog/default.upstream3
-rw-r--r--nixpkgs/pkgs/development/libraries/gtest/default.nix32
-rw-r--r--nixpkgs/pkgs/development/libraries/gtest/fix-cmake-config-includedir.patch30
-rw-r--r--nixpkgs/pkgs/development/libraries/gtk+/2.0-darwin-x11.patch22
-rw-r--r--nixpkgs/pkgs/development/libraries/gtk+/2.0-immodules.cache.patch27
-rw-r--r--nixpkgs/pkgs/development/libraries/gtk+/2.x.nix96
-rw-r--r--nixpkgs/pkgs/development/libraries/gtk+/3.0-darwin-x11.patch28
-rw-r--r--nixpkgs/pkgs/development/libraries/gtk+/3.0-immodules.cache.patch27
-rw-r--r--nixpkgs/pkgs/development/libraries/gtk+/3.x.nix117
-rw-r--r--nixpkgs/pkgs/development/libraries/gtk+/gtk2-theme-paths.patch40
-rw-r--r--nixpkgs/pkgs/development/libraries/gtk+/setup-hook.sh10
-rw-r--r--nixpkgs/pkgs/development/libraries/gtk-mac-integration/default.nix31
-rw-r--r--nixpkgs/pkgs/development/libraries/gtk-sharp-beans/default.nix25
-rw-r--r--nixpkgs/pkgs/development/libraries/gtk-sharp/2.0.nix71
-rw-r--r--nixpkgs/pkgs/development/libraries/gtk-sharp/3.0.nix52
-rw-r--r--nixpkgs/pkgs/development/libraries/gtk-sharp/builder.sh11
-rw-r--r--nixpkgs/pkgs/development/libraries/gtkd/default.nix98
-rw-r--r--nixpkgs/pkgs/development/libraries/gtkd/paths.d142
-rw-r--r--nixpkgs/pkgs/development/libraries/gtkdatabox/default.nix22
-rw-r--r--nixpkgs/pkgs/development/libraries/gtkimageview/default.nix39
-rw-r--r--nixpkgs/pkgs/development/libraries/gtkmathview/default.nix29
-rw-r--r--nixpkgs/pkgs/development/libraries/gtkmathview/gcc-4.3-build-fixes.patch74
-rw-r--r--nixpkgs/pkgs/development/libraries/gtkmathview/gcc-4.4-build-fixes.patch21
-rw-r--r--nixpkgs/pkgs/development/libraries/gtkmm/2.x.nix42
-rw-r--r--nixpkgs/pkgs/development/libraries/gtkmm/3.x.nix51
-rw-r--r--nixpkgs/pkgs/development/libraries/gtksourceview/3.x-nix_share_path.patch11
-rw-r--r--nixpkgs/pkgs/development/libraries/gtksourceview/3.x.nix58
-rw-r--r--nixpkgs/pkgs/development/libraries/gtksourceview/4.x-nix_share_path.patch11
-rw-r--r--nixpkgs/pkgs/development/libraries/gtksourceview/4.x.nix54
-rw-r--r--nixpkgs/pkgs/development/libraries/gtksourceviewmm/4.x.nix30
-rw-r--r--nixpkgs/pkgs/development/libraries/gtksourceviewmm/default.nix31
-rw-r--r--nixpkgs/pkgs/development/libraries/gtkspell/3.nix30
-rw-r--r--nixpkgs/pkgs/development/libraries/gtkspell/default.nix20
-rw-r--r--nixpkgs/pkgs/development/libraries/gtkspellmm/default.nix31
-rw-r--r--nixpkgs/pkgs/development/libraries/gts/default.nix31
-rw-r--r--nixpkgs/pkgs/development/libraries/gumbo/default.nix25
-rw-r--r--nixpkgs/pkgs/development/libraries/gupnp-av/default.nix57
-rw-r--r--nixpkgs/pkgs/development/libraries/gupnp-dlna/default.nix62
-rw-r--r--nixpkgs/pkgs/development/libraries/gupnp-igd/default.nix68
-rw-r--r--nixpkgs/pkgs/development/libraries/gupnp/default.nix94
-rw-r--r--nixpkgs/pkgs/development/libraries/gupnp/fix-requires.patch26
-rw-r--r--nixpkgs/pkgs/development/libraries/gusb/default.nix38
-rw-r--r--nixpkgs/pkgs/development/libraries/gvfs/default.nix72
-rw-r--r--nixpkgs/pkgs/development/libraries/half/default.nix25
-rw-r--r--nixpkgs/pkgs/development/libraries/hamlib/default.nix35
-rw-r--r--nixpkgs/pkgs/development/libraries/harfbuzz/default.nix75
-rw-r--r--nixpkgs/pkgs/development/libraries/hawknl/default.nix30
-rw-r--r--nixpkgs/pkgs/development/libraries/herqq/default.nix25
-rw-r--r--nixpkgs/pkgs/development/libraries/hidapi/default.nix27
-rw-r--r--nixpkgs/pkgs/development/libraries/hiredis-vip/default.nix25
-rw-r--r--nixpkgs/pkgs/development/libraries/hiredis/default.nix22
-rw-r--r--nixpkgs/pkgs/development/libraries/hivex/default.nix38
-rw-r--r--nixpkgs/pkgs/development/libraries/hivex/hivex-syms.patch13
-rw-r--r--nixpkgs/pkgs/development/libraries/hotpatch/default.nix37
-rw-r--r--nixpkgs/pkgs/development/libraries/hpx/default.nix26
-rw-r--r--nixpkgs/pkgs/development/libraries/hspell/default.nix27
-rw-r--r--nixpkgs/pkgs/development/libraries/hspell/dicts.nix44
-rw-r--r--nixpkgs/pkgs/development/libraries/htmlcxx/default.nix20
-rw-r--r--nixpkgs/pkgs/development/libraries/htmlcxx/ptrdiff.patch13
-rw-r--r--nixpkgs/pkgs/development/libraries/http-parser/build-shared.patch30
-rw-r--r--nixpkgs/pkgs/development/libraries/http-parser/default.nix29
-rw-r--r--nixpkgs/pkgs/development/libraries/hunspell/default.nix54
-rw-r--r--nixpkgs/pkgs/development/libraries/hunspell/dictionaries.nix621
-rw-r--r--nixpkgs/pkgs/development/libraries/hunspell/wrapper.nix13
-rw-r--r--nixpkgs/pkgs/development/libraries/hwloc/default.nix87
-rw-r--r--nixpkgs/pkgs/development/libraries/hyena/default.nix41
-rw-r--r--nixpkgs/pkgs/development/libraries/hyperscan/default.nix67
-rw-r--r--nixpkgs/pkgs/development/libraries/icu/58.nix14
-rw-r--r--nixpkgs/pkgs/development/libraries/icu/59.nix4
-rw-r--r--nixpkgs/pkgs/development/libraries/icu/60.nix4
-rw-r--r--nixpkgs/pkgs/development/libraries/icu/63.nix14
-rw-r--r--nixpkgs/pkgs/development/libraries/icu/64.nix4
-rw-r--r--nixpkgs/pkgs/development/libraries/icu/base.nix95
-rw-r--r--nixpkgs/pkgs/development/libraries/id3lib/default.nix26
-rw-r--r--nixpkgs/pkgs/development/libraries/id3lib/id3lib-3.8.3-gcc43-1.patch104
-rw-r--r--nixpkgs/pkgs/development/libraries/id3lib/patch_id3lib_3.8.3_UTF16_writing_bug.diff39
-rw-r--r--nixpkgs/pkgs/development/libraries/idnkit/default.nix20
-rw-r--r--nixpkgs/pkgs/development/libraries/ignition-math/default.nix26
-rw-r--r--nixpkgs/pkgs/development/libraries/ignition-transport/0.9.0.nix9
-rw-r--r--nixpkgs/pkgs/development/libraries/ignition-transport/1.0.1.nix9
-rw-r--r--nixpkgs/pkgs/development/libraries/ignition-transport/generic.nix31
-rw-r--r--nixpkgs/pkgs/development/libraries/igraph/default.nix31
-rw-r--r--nixpkgs/pkgs/development/libraries/ijs/default.nix25
-rw-r--r--nixpkgs/pkgs/development/libraries/iksemel/default.nix25
-rw-r--r--nixpkgs/pkgs/development/libraries/ilbc/CMakeLists.txt11
-rw-r--r--nixpkgs/pkgs/development/libraries/ilbc/default.nix25
-rw-r--r--nixpkgs/pkgs/development/libraries/ilbc/extract-cfile.awk24
-rw-r--r--nixpkgs/pkgs/development/libraries/ilixi/default.nix32
-rw-r--r--nixpkgs/pkgs/development/libraries/ilmbase/bootstrap.patch15
-rw-r--r--nixpkgs/pkgs/development/libraries/ilmbase/cross.patch35
-rw-r--r--nixpkgs/pkgs/development/libraries/ilmbase/default.nix36
-rw-r--r--nixpkgs/pkgs/development/libraries/iml/default.nix30
-rw-r--r--nixpkgs/pkgs/development/libraries/imlib/default.nix23
-rw-r--r--nixpkgs/pkgs/development/libraries/imlib2/default.nix54
-rw-r--r--nixpkgs/pkgs/development/libraries/incrtcl/default.nix31
-rw-r--r--nixpkgs/pkgs/development/libraries/indicator-application/gtk2.nix55
-rw-r--r--nixpkgs/pkgs/development/libraries/indicator-application/gtk3.nix57
-rw-r--r--nixpkgs/pkgs/development/libraries/indilib/default.nix23
-rw-r--r--nixpkgs/pkgs/development/libraries/indilib/udev-dir.patch12
-rw-r--r--nixpkgs/pkgs/development/libraries/iniparser/default.nix48
-rw-r--r--nixpkgs/pkgs/development/libraries/iniparser/no-usr.patch13
-rw-r--r--nixpkgs/pkgs/development/libraries/intel-gmmlib/default.nix25
-rw-r--r--nixpkgs/pkgs/development/libraries/intel-media-driver/default.nix33
-rw-r--r--nixpkgs/pkgs/development/libraries/intel-media-sdk/default.nix28
-rw-r--r--nixpkgs/pkgs/development/libraries/ip2location-c/default.nix32
-rw-r--r--nixpkgs/pkgs/development/libraries/irrlicht/default.nix34
-rw-r--r--nixpkgs/pkgs/development/libraries/isl/0.11.1.nix22
-rw-r--r--nixpkgs/pkgs/development/libraries/isl/0.14.1.nix21
-rw-r--r--nixpkgs/pkgs/development/libraries/isl/0.17.1.nix21
-rw-r--r--nixpkgs/pkgs/development/libraries/isl/0.20.0.nix21
-rw-r--r--nixpkgs/pkgs/development/libraries/isl/fix-gcc-build.diff12
-rw-r--r--nixpkgs/pkgs/development/libraries/iso-codes/default.nix27
-rw-r--r--nixpkgs/pkgs/development/libraries/itk/default.nix33
-rw-r--r--nixpkgs/pkgs/development/libraries/jama/default.nix30
-rw-r--r--nixpkgs/pkgs/development/libraries/jansson/default.nix17
-rw-r--r--nixpkgs/pkgs/development/libraries/jasper/default.nix46
-rw-r--r--nixpkgs/pkgs/development/libraries/java/commons/bcel/default.nix25
-rw-r--r--nixpkgs/pkgs/development/libraries/java/commons/bsf/default.nix23
-rw-r--r--nixpkgs/pkgs/development/libraries/java/commons/compress/default.nix25
-rw-r--r--nixpkgs/pkgs/development/libraries/java/commons/fileupload/default.nix24
-rw-r--r--nixpkgs/pkgs/development/libraries/java/commons/io/default.nix25
-rw-r--r--nixpkgs/pkgs/development/libraries/java/commons/lang/default.nix25
-rw-r--r--nixpkgs/pkgs/development/libraries/java/commons/logging/default.nix23
-rw-r--r--nixpkgs/pkgs/development/libraries/java/commons/math/default.nix25
-rw-r--r--nixpkgs/pkgs/development/libraries/java/cup/default.nix38
-rw-r--r--nixpkgs/pkgs/development/libraries/java/cup/javacup-0.11b_beta20160615-build-xml-git.patch38
-rw-r--r--nixpkgs/pkgs/development/libraries/java/dbus-java/default.nix26
-rw-r--r--nixpkgs/pkgs/development/libraries/java/geoipjava/default.nix27
-rw-r--r--nixpkgs/pkgs/development/libraries/java/gwt-dragdrop/builder.sh4
-rw-r--r--nixpkgs/pkgs/development/libraries/java/gwt-dragdrop/default.nix16
-rw-r--r--nixpkgs/pkgs/development/libraries/java/gwt-widgets/builder.sh6
-rw-r--r--nixpkgs/pkgs/development/libraries/java/gwt-widgets/default.nix16
-rwxr-xr-xnixpkgs/pkgs/development/libraries/java/hsqldb/builder.sh6
-rw-r--r--nixpkgs/pkgs/development/libraries/java/hsqldb/default.nix20
-rwxr-xr-xnixpkgs/pkgs/development/libraries/java/httpunit/builder.sh5
-rw-r--r--nixpkgs/pkgs/development/libraries/java/httpunit/default.nix19
-rw-r--r--nixpkgs/pkgs/development/libraries/java/hydra-ant-logger/default.nix25
-rwxr-xr-xnixpkgs/pkgs/development/libraries/java/jdom/builder.sh6
-rw-r--r--nixpkgs/pkgs/development/libraries/java/jdom/default.nix18
-rw-r--r--nixpkgs/pkgs/development/libraries/java/jflex/default.nix37
-rw-r--r--nixpkgs/pkgs/development/libraries/java/junit/default.nix28
-rw-r--r--nixpkgs/pkgs/development/libraries/java/junixsocket/darwin.patch20
-rw-r--r--nixpkgs/pkgs/development/libraries/java/junixsocket/default.nix42
-rw-r--r--nixpkgs/pkgs/development/libraries/java/jzmq/default.nix30
-rw-r--r--nixpkgs/pkgs/development/libraries/java/libmatthew-java/default.nix18
-rw-r--r--nixpkgs/pkgs/development/libraries/java/lombok/default.nix23
-rwxr-xr-xnixpkgs/pkgs/development/libraries/java/lucene/builder.sh6
-rw-r--r--nixpkgs/pkgs/development/libraries/java/lucene/default.nix19
-rwxr-xr-xnixpkgs/pkgs/development/libraries/java/mockobjects/builder.sh6
-rw-r--r--nixpkgs/pkgs/development/libraries/java/mockobjects/default.nix17
-rw-r--r--nixpkgs/pkgs/development/libraries/java/rhino/default.nix59
-rw-r--r--nixpkgs/pkgs/development/libraries/java/rhino/gcj-type-mismatch.patch103
-rw-r--r--nixpkgs/pkgs/development/libraries/java/saxon/default.nix83
-rw-r--r--nixpkgs/pkgs/development/libraries/java/smack/builder.sh7
-rw-r--r--nixpkgs/pkgs/development/libraries/java/smack/default.nix16
-rw-r--r--nixpkgs/pkgs/development/libraries/java/swt/default.nix73
-rw-r--r--nixpkgs/pkgs/development/libraries/jbig2dec/default.nix24
-rw-r--r--nixpkgs/pkgs/development/libraries/jbigkit/default.nix41
-rw-r--r--nixpkgs/pkgs/development/libraries/jcal/default.nix28
-rw-r--r--nixpkgs/pkgs/development/libraries/jemalloc/common.nix43
-rw-r--r--nixpkgs/pkgs/development/libraries/jemalloc/default.nix4
-rw-r--r--nixpkgs/pkgs/development/libraries/jemalloc/jemalloc450.nix4
-rw-r--r--nixpkgs/pkgs/development/libraries/jitterentropy/default.nix30
-rw-r--r--nixpkgs/pkgs/development/libraries/json-c/default.nix27
-rw-r--r--nixpkgs/pkgs/development/libraries/json-glib/default.nix37
-rw-r--r--nixpkgs/pkgs/development/libraries/jsoncpp/default.nix47
-rw-r--r--nixpkgs/pkgs/development/libraries/jsonrpc-glib/default.nix37
-rw-r--r--nixpkgs/pkgs/development/libraries/judy/default.nix23
-rw-r--r--nixpkgs/pkgs/development/libraries/jxrlib/default.nix28
-rw-r--r--nixpkgs/pkgs/development/libraries/kdb/default.nix29
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/attica.nix12
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/baloo.nix17
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/bluez-qt.nix19
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/breeze-icons.nix13
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/default.nix192
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/extra-cmake-modules/default.nix20
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/extra-cmake-modules/nix-lib-path.patch39
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/extra-cmake-modules/series1
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/extra-cmake-modules/setup-hook.sh54
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/fetch.sh1
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/frameworkintegration.nix17
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kactivities-stats.nix14
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kactivities.nix15
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kapidox.nix10
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/karchive.nix17
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kauth/cmake-install-paths.patch17
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kauth/default.nix17
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kauth/series1
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kbookmarks.nix17
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kcmutils/default.nix18
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kcmutils/kcmutils-debug-module-loader.patch13
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kcmutils/kcmutils-follow-symlinks.patch13
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kcmutils/series2
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kcodecs.nix13
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kcompletion.nix14
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kconfig.nix12
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kconfigwidgets/0001-qdiriterator-follow-symlinks.patch18
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kconfigwidgets/default.nix20
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kcoreaddons.nix16
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kcrash.nix14
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kdbusaddons.nix16
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kdeclarative.nix16
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kded.nix16
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kdelibs4support/default.nix32
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kdelibs4support/nix-kde-include-dir.patch13
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kdelibs4support/series1
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kdelibs4support/setup-hook.sh1
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kdesignerplugin.nix17
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kdesu.nix14
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kdewebkit.nix11
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kdnssd.nix17
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kdoctools/default.nix33
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kdoctools/kdoctools-no-find-docbook-xml.patch12
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kdoctools/setup-hook.sh5
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kemoticons.nix13
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kfilemetadata/cmake-install-paths.patch13
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kfilemetadata/default.nix16
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kfilemetadata/series1
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kglobalaccel.nix16
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kguiaddons.nix17
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kholidays.nix16
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/khtml.nix19
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/ki18n.nix16
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kiconthemes/default-theme-breeze.patch13
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kiconthemes/default.nix17
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kiconthemes/series1
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kidletime.nix16
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kimageformats.nix16
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kinit/default.nix36
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kinit/kdeinit-extra_libs.patch49
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kinit/kinit-libpath.patch33
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kinit/series3
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kinit/start_kdeinit-path.patch13
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kio/default.nix24
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kio/kio-debug-module-loader.patch13
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kio/samba-search-path.patch28
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kio/series2
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kirigami2.nix11
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kitemmodels.nix16
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kitemviews.nix17
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kjobwidgets.nix12
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kjs.nix12
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kjsembed.nix13
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kmediaplayer.nix12
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/knewstuff.nix18
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/knotifications.nix16
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/knotifyconfig.nix14
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kpackage/allow-external-paths.patch13
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kpackage/default.nix13
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kpackage/qdiriterator-follow-symlinks.patch26
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kpackage/series2
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kparts.nix17
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kpeople.nix16
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kplotting.nix14
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kpty.nix9
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kross.nix14
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/krunner.nix17
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kservice/default.nix19
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kservice/no-canonicalize-path.patch13
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kservice/qdiriterator-follow-symlinks.patch13
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kservice/series2
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/ktexteditor.nix17
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/ktextwidgets.nix16
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kunitconversion.nix9
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kwallet.nix18
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kwayland.nix17
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kwidgetsaddons.nix17
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kwindowsystem/default.nix22
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kwindowsystem/platform-plugins-path.patch22
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kwindowsystem/series1
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kxmlgui.nix17
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kxmlrpcclient.nix10
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/modemmanager-qt.nix16
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/networkmanager-qt.nix16
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/oxygen-icons5.nix15
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/plasma-framework.nix21
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/prison.nix17
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/purpose.nix14
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/solid.nix17
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/sonnet.nix15
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/srcs.nix637
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/syndication.nix13
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/syntax-highlighting.nix14
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/threadweaver.nix16
-rw-r--r--nixpkgs/pkgs/development/libraries/kdiagram/default.nix21
-rw-r--r--nixpkgs/pkgs/development/libraries/kerberos/heimdal-make-missing-headers.patch10
-rw-r--r--nixpkgs/pkgs/development/libraries/kerberos/heimdal.nix98
-rw-r--r--nixpkgs/pkgs/development/libraries/kerberos/krb5.nix83
-rw-r--r--nixpkgs/pkgs/development/libraries/keybinder/default.nix46
-rw-r--r--nixpkgs/pkgs/development/libraries/keybinder3/default.nix33
-rw-r--r--nixpkgs/pkgs/development/libraries/kinetic-cpp-client/build-fix.patch224
-rw-r--r--nixpkgs/pkgs/development/libraries/kinetic-cpp-client/default.nix58
-rw-r--r--nixpkgs/pkgs/development/libraries/kmsxx/default.nix31
-rw-r--r--nixpkgs/pkgs/development/libraries/kpmcore/default.nix33
-rw-r--r--nixpkgs/pkgs/development/libraries/kproperty/default.nix30
-rw-r--r--nixpkgs/pkgs/development/libraries/kreport/default.nix27
-rw-r--r--nixpkgs/pkgs/development/libraries/kyotocabinet/default.nix41
-rw-r--r--nixpkgs/pkgs/development/libraries/l-smash/default.nix23
-rw-r--r--nixpkgs/pkgs/development/libraries/lame/default.nix71
-rw-r--r--nixpkgs/pkgs/development/libraries/languagemachines/frog.nix54
-rw-r--r--nixpkgs/pkgs/development/libraries/languagemachines/frogdata.nix30
-rw-r--r--nixpkgs/pkgs/development/libraries/languagemachines/libfolia.nix34
-rw-r--r--nixpkgs/pkgs/development/libraries/languagemachines/mbt-add-libxml2-dep.patch13
-rw-r--r--nixpkgs/pkgs/development/libraries/languagemachines/mbt.nix41
-rw-r--r--nixpkgs/pkgs/development/libraries/languagemachines/packages.nix14
-rw-r--r--nixpkgs/pkgs/development/libraries/languagemachines/release-info/LanguageMachines-frog.json5
-rw-r--r--nixpkgs/pkgs/development/libraries/languagemachines/release-info/LanguageMachines-frogdata.json5
-rw-r--r--nixpkgs/pkgs/development/libraries/languagemachines/release-info/LanguageMachines-libfolia.json5
-rw-r--r--nixpkgs/pkgs/development/libraries/languagemachines/release-info/LanguageMachines-mbt.json5
-rw-r--r--nixpkgs/pkgs/development/libraries/languagemachines/release-info/LanguageMachines-ticcutils.json5
-rw-r--r--nixpkgs/pkgs/development/libraries/languagemachines/release-info/LanguageMachines-timbl.json5
-rw-r--r--nixpkgs/pkgs/development/libraries/languagemachines/release-info/LanguageMachines-timblserver.json5
-rw-r--r--nixpkgs/pkgs/development/libraries/languagemachines/release-info/LanguageMachines-ucto.json5
-rw-r--r--nixpkgs/pkgs/development/libraries/languagemachines/release-info/LanguageMachines-uctodata.json5
-rw-r--r--nixpkgs/pkgs/development/libraries/languagemachines/test.nix25
-rw-r--r--nixpkgs/pkgs/development/libraries/languagemachines/ticcutils.nix30
-rw-r--r--nixpkgs/pkgs/development/libraries/languagemachines/timbl.nix37
-rw-r--r--nixpkgs/pkgs/development/libraries/languagemachines/timblserver.nix38
-rw-r--r--nixpkgs/pkgs/development/libraries/languagemachines/ucto.nix49
-rw-r--r--nixpkgs/pkgs/development/libraries/languagemachines/uctodata.nix32
-rwxr-xr-xnixpkgs/pkgs/development/libraries/languagemachines/update79
-rw-r--r--nixpkgs/pkgs/development/libraries/lasem/default.nix38
-rw-r--r--nixpkgs/pkgs/development/libraries/lasso/default.nix32
-rw-r--r--nixpkgs/pkgs/development/libraries/lcms/cve-2013-4276.patch62
-rw-r--r--nixpkgs/pkgs/development/libraries/lcms/default.nix23
-rw-r--r--nixpkgs/pkgs/development/libraries/lcms2/default.nix21
-rw-r--r--nixpkgs/pkgs/development/libraries/ldacbt/default.nix30
-rw-r--r--nixpkgs/pkgs/development/libraries/ldb/default.nix50
-rw-r--r--nixpkgs/pkgs/development/libraries/ldns/default.nix71
-rw-r--r--nixpkgs/pkgs/development/libraries/leatherman/default.nix26
-rw-r--r--nixpkgs/pkgs/development/libraries/lensfun/default.nix24
-rw-r--r--nixpkgs/pkgs/development/libraries/leptonica/default.nix27
-rw-r--r--nixpkgs/pkgs/development/libraries/lesstif/c-missing_xm_h.patch11
-rw-r--r--nixpkgs/pkgs/development/libraries/lesstif/c-render_table_crash.patch11
-rw-r--r--nixpkgs/pkgs/development/libraries/lesstif/c-xpmpipethrough.patch381
-rw-r--r--nixpkgs/pkgs/development/libraries/lesstif/default.nix28
-rw-r--r--nixpkgs/pkgs/development/libraries/leveldb/default.nix42
-rw-r--r--nixpkgs/pkgs/development/libraries/levmar/default.nix28
-rw-r--r--nixpkgs/pkgs/development/libraries/lib3ds/default.nix20
-rw-r--r--nixpkgs/pkgs/development/libraries/lib3mf/default.nix33
-rw-r--r--nixpkgs/pkgs/development/libraries/libHX/default.nix30
-rw-r--r--nixpkgs/pkgs/development/libraries/libLAS/default.nix33
-rw-r--r--nixpkgs/pkgs/development/libraries/libaacs/default.nix30
-rw-r--r--nixpkgs/pkgs/development/libraries/libaal/default.nix27
-rw-r--r--nixpkgs/pkgs/development/libraries/libaal/libaal-1.0.6-glibc-2.26.patch89
-rw-r--r--nixpkgs/pkgs/development/libraries/libabw/default.nix27
-rw-r--r--nixpkgs/pkgs/development/libraries/libaccounts-glib/default.nix52
-rw-r--r--nixpkgs/pkgs/development/libraries/libaccounts-glib/py-override.patch38
-rw-r--r--nixpkgs/pkgs/development/libraries/libagar/default.nix43
-rw-r--r--nixpkgs/pkgs/development/libraries/libagar/libagar_test.nix27
-rw-r--r--nixpkgs/pkgs/development/libraries/libagar/srcs.nix10
-rw-r--r--nixpkgs/pkgs/development/libraries/libamqpcpp/default.nix29
-rw-r--r--nixpkgs/pkgs/development/libraries/libamqpcpp/libamqpcpp-darwin.patch13
-rw-r--r--nixpkgs/pkgs/development/libraries/libantlr3c/default.nix19
-rw-r--r--nixpkgs/pkgs/development/libraries/libao/default.nix42
-rw-r--r--nixpkgs/pkgs/development/libraries/libaom/default.nix34
-rw-r--r--nixpkgs/pkgs/development/libraries/libaosd/default.nix36
-rw-r--r--nixpkgs/pkgs/development/libraries/libappindicator/default.nix78
-rw-r--r--nixpkgs/pkgs/development/libraries/libarchive/default.nix73
-rw-r--r--nixpkgs/pkgs/development/libraries/libargon2/default.nix41
-rw-r--r--nixpkgs/pkgs/development/libraries/libasr/default.nix21
-rw-r--r--nixpkgs/pkgs/development/libraries/libass/default.nix53
-rw-r--r--nixpkgs/pkgs/development/libraries/libassuan/default.nix42
-rw-r--r--nixpkgs/pkgs/development/libraries/libast/default.nix22
-rw-r--r--nixpkgs/pkgs/development/libraries/libasyncns/default.nix17
-rw-r--r--nixpkgs/pkgs/development/libraries/libatomic_ops/default.nix30
-rw-r--r--nixpkgs/pkgs/development/libraries/libaudclient/default.nix22
-rw-r--r--nixpkgs/pkgs/development/libraries/libav/default.nix131
-rw-r--r--nixpkgs/pkgs/development/libraries/libav/vpxenc-0.8.17-libvpx-1.5.patch22
-rw-r--r--nixpkgs/pkgs/development/libraries/libavc1394/default.nix20
-rw-r--r--nixpkgs/pkgs/development/libraries/libb2/default.nix32
-rw-r--r--nixpkgs/pkgs/development/libraries/libb64/default.nix27
-rw-r--r--nixpkgs/pkgs/development/libraries/libbap/default.nix30
-rw-r--r--nixpkgs/pkgs/development/libraries/libbdplus/default.nix30
-rw-r--r--nixpkgs/pkgs/development/libraries/libbfd/default.nix59
-rw-r--r--nixpkgs/pkgs/development/libraries/libbladeRF/default.nix61
-rw-r--r--nixpkgs/pkgs/development/libraries/libblockdev/default.nix46
-rw-r--r--nixpkgs/pkgs/development/libraries/libblockdev/fix-paths.patch47
-rw-r--r--nixpkgs/pkgs/development/libraries/libblocksruntime/default.nix27
-rw-r--r--nixpkgs/pkgs/development/libraries/libbluedevil/default.nix21
-rw-r--r--nixpkgs/pkgs/development/libraries/libbluray/BDJ-JARFILE-path.patch27
-rw-r--r--nixpkgs/pkgs/development/libraries/libbluray/default.nix65
-rw-r--r--nixpkgs/pkgs/development/libraries/libbsd/darwin.patch361
-rw-r--r--nixpkgs/pkgs/development/libraries/libbsd/default.nix27
-rw-r--r--nixpkgs/pkgs/development/libraries/libbsd/musl.patch14
-rw-r--r--nixpkgs/pkgs/development/libraries/libbson/default.nix23
-rw-r--r--nixpkgs/pkgs/development/libraries/libburn/default.nix19
-rw-r--r--nixpkgs/pkgs/development/libraries/libbytesize/default.nix31
-rw-r--r--nixpkgs/pkgs/development/libraries/libcaca/default.nix40
-rw-r--r--nixpkgs/pkgs/development/libraries/libcacard/default.nix22
-rw-r--r--nixpkgs/pkgs/development/libraries/libcanberra/default.nix68
-rw-r--r--nixpkgs/pkgs/development/libraries/libcangjie/default.nix35
-rw-r--r--nixpkgs/pkgs/development/libraries/libcbor/default.nix27
-rw-r--r--nixpkgs/pkgs/development/libraries/libcdaudio/default.nix14
-rw-r--r--nixpkgs/pkgs/development/libraries/libcddb/default.nix21
-rw-r--r--nixpkgs/pkgs/development/libraries/libcdio-paranoia/default.nix35
-rw-r--r--nixpkgs/pkgs/development/libraries/libcdio/default.nix33
-rw-r--r--nixpkgs/pkgs/development/libraries/libcdr/default.nix23
-rw-r--r--nixpkgs/pkgs/development/libraries/libcec/default.nix31
-rw-r--r--nixpkgs/pkgs/development/libraries/libcec/platform.nix23
-rw-r--r--nixpkgs/pkgs/development/libraries/libcef/default.nix43
-rw-r--r--nixpkgs/pkgs/development/libraries/libcello/default.nix17
-rw-r--r--nixpkgs/pkgs/development/libraries/libcerf/default.nix18
-rw-r--r--nixpkgs/pkgs/development/libraries/libchamplain/default.nix49
-rw-r--r--nixpkgs/pkgs/development/libraries/libchardet/default.nix25
-rw-r--r--nixpkgs/pkgs/development/libraries/libchewing/default.nix21
-rw-r--r--nixpkgs/pkgs/development/libraries/libchop/default.nix55
-rw-r--r--nixpkgs/pkgs/development/libraries/libchop/gets-undeclared.patch71
-rw-r--r--nixpkgs/pkgs/development/libraries/libchop/size_t.patch11
-rw-r--r--nixpkgs/pkgs/development/libraries/libclc/default.nix36
-rw-r--r--nixpkgs/pkgs/development/libraries/libcli/default.nix31
-rw-r--r--nixpkgs/pkgs/development/libraries/libcloudproviders/default.nix31
-rw-r--r--nixpkgs/pkgs/development/libraries/libclthreads/default.nix40
-rw-r--r--nixpkgs/pkgs/development/libraries/libclxclient/default.nix49
-rw-r--r--nixpkgs/pkgs/development/libraries/libcmis/default.nix32
-rw-r--r--nixpkgs/pkgs/development/libraries/libcollectdclient/default.nix22
-rw-r--r--nixpkgs/pkgs/development/libraries/libcommuni/default.nix44
-rw-r--r--nixpkgs/pkgs/development/libraries/libconfig/default.nix21
-rw-r--r--nixpkgs/pkgs/development/libraries/libconfuse/default.nix38
-rw-r--r--nixpkgs/pkgs/development/libraries/libcouchbase/default.nix30
-rw-r--r--nixpkgs/pkgs/development/libraries/libcrafter/default.nix29
-rw-r--r--nixpkgs/pkgs/development/libraries/libcredis/default.nix29
-rw-r--r--nixpkgs/pkgs/development/libraries/libcroco/default.nix32
-rw-r--r--nixpkgs/pkgs/development/libraries/libcrossguid/default.nix35
-rw-r--r--nixpkgs/pkgs/development/libraries/libcryptui/default.nix28
-rw-r--r--nixpkgs/pkgs/development/libraries/libcsptr/default.nix23
-rw-r--r--nixpkgs/pkgs/development/libraries/libctemplate/default.nix29
-rw-r--r--nixpkgs/pkgs/development/libraries/libcue/default.nix30
-rw-r--r--nixpkgs/pkgs/development/libraries/libcutl/default.nix23
-rw-r--r--nixpkgs/pkgs/development/libraries/libdaemon/default.nix25
-rw-r--r--nixpkgs/pkgs/development/libraries/libdaemon/fix-includes.patch13
-rw-r--r--nixpkgs/pkgs/development/libraries/libdap/default.nix22
-rw-r--r--nixpkgs/pkgs/development/libraries/libdazzle/default.nix58
-rw-r--r--nixpkgs/pkgs/development/libraries/libdbi-drivers/default.nix62
-rw-r--r--nixpkgs/pkgs/development/libraries/libdbi/default.nix17
-rw-r--r--nixpkgs/pkgs/development/libraries/libdbusmenu-qt/default.nix29
-rw-r--r--nixpkgs/pkgs/development/libraries/libdbusmenu-qt/qt-5.5.nix25
-rw-r--r--nixpkgs/pkgs/development/libraries/libdbusmenu/default.nix64
-rw-r--r--nixpkgs/pkgs/development/libraries/libdc1394/default.nix24
-rw-r--r--nixpkgs/pkgs/development/libraries/libde265/default.nix24
-rw-r--r--nixpkgs/pkgs/development/libraries/libdeflate/default.nix31
-rw-r--r--nixpkgs/pkgs/development/libraries/libdevil/default.nix59
-rw-r--r--nixpkgs/pkgs/development/libraries/libdevil/ftbfs-libpng15.patch31
-rw-r--r--nixpkgs/pkgs/development/libraries/libdevil/il_endian.h.patch27
-rw-r--r--nixpkgs/pkgs/development/libraries/libdigidoc/default.nix24
-rw-r--r--nixpkgs/pkgs/development/libraries/libdigidocpp/default.nix27
-rw-r--r--nixpkgs/pkgs/development/libraries/libdiscid/default.nix25
-rw-r--r--nixpkgs/pkgs/development/libraries/libdivecomputer/default.nix21
-rw-r--r--nixpkgs/pkgs/development/libraries/libdivsufsort/default.nix17
-rw-r--r--nixpkgs/pkgs/development/libraries/libdmtx/default.nix20
-rw-r--r--nixpkgs/pkgs/development/libraries/libdnet/default.nix29
-rw-r--r--nixpkgs/pkgs/development/libraries/libdrm/default.nix36
-rw-r--r--nixpkgs/pkgs/development/libraries/libdv/default.nix31
-rw-r--r--nixpkgs/pkgs/development/libraries/libdvbpsi/default.nix19
-rw-r--r--nixpkgs/pkgs/development/libraries/libdvdcss/default.nix20
-rw-r--r--nixpkgs/pkgs/development/libraries/libdvdnav/4.2.1.nix29
-rw-r--r--nixpkgs/pkgs/development/libraries/libdvdnav/default.nix24
-rw-r--r--nixpkgs/pkgs/development/libraries/libdvdread/4.9.9.nix26
-rw-r--r--nixpkgs/pkgs/development/libraries/libdvdread/default.nix27
-rw-r--r--nixpkgs/pkgs/development/libraries/libdwarf/default.nix54
-rw-r--r--nixpkgs/pkgs/development/libraries/libdwg/default.nix25
-rw-r--r--nixpkgs/pkgs/development/libraries/libdynd/default.nix35
-rw-r--r--nixpkgs/pkgs/development/libraries/libe-book/default.nix41
-rw-r--r--nixpkgs/pkgs/development/libraries/libe-book/default.upstream4
-rw-r--r--nixpkgs/pkgs/development/libraries/libeatmydata/default.nix24
-rw-r--r--nixpkgs/pkgs/development/libraries/libeb/default.nix25
-rw-r--r--nixpkgs/pkgs/development/libraries/libebml/default.nix27
-rw-r--r--nixpkgs/pkgs/development/libraries/libebur128/default.nix24
-rw-r--r--nixpkgs/pkgs/development/libraries/libechonest/default.nix21
-rw-r--r--nixpkgs/pkgs/development/libraries/libedit/01-cygwin.patch25
-rw-r--r--nixpkgs/pkgs/development/libraries/libedit/default.nix32
-rw-r--r--nixpkgs/pkgs/development/libraries/libee/default.nix19
-rw-r--r--nixpkgs/pkgs/development/libraries/libelf-freebsd/default.nix37
-rw-r--r--nixpkgs/pkgs/development/libraries/libelf/default.nix44
-rw-r--r--nixpkgs/pkgs/development/libraries/libelf/dont-hardcode-ar.patch11
-rw-r--r--nixpkgs/pkgs/development/libraries/libelfin/0001-Don-t-detect-package-version-with-Git.patch72
-rw-r--r--nixpkgs/pkgs/development/libraries/libelfin/default.nix32
-rw-r--r--nixpkgs/pkgs/development/libraries/libepc/default.nix47
-rw-r--r--nixpkgs/pkgs/development/libraries/libesmtp/default.nix18
-rw-r--r--nixpkgs/pkgs/development/libraries/libestr/default.nix17
-rw-r--r--nixpkgs/pkgs/development/libraries/libetpan/default.nix24
-rw-r--r--nixpkgs/pkgs/development/libraries/libev/default.nix18
-rw-r--r--nixpkgs/pkgs/development/libraries/libevdev/default.nix20
-rw-r--r--nixpkgs/pkgs/development/libraries/libevent/default.nix60
-rw-r--r--nixpkgs/pkgs/development/libraries/libewf/default.nix23
-rw-r--r--nixpkgs/pkgs/development/libraries/libexecinfo/default.nix46
-rw-r--r--nixpkgs/pkgs/development/libraries/libexif/default.nix29
-rw-r--r--nixpkgs/pkgs/development/libraries/libextractor/default.nix73
-rw-r--r--nixpkgs/pkgs/development/libraries/libexttextcat/default.nix17
-rw-r--r--nixpkgs/pkgs/development/libraries/libf2c/default.nix35
-rw-r--r--nixpkgs/pkgs/development/libraries/libfakekey/default.nix25
-rw-r--r--nixpkgs/pkgs/development/libraries/libfaketime/default.nix36
-rw-r--r--nixpkgs/pkgs/development/libraries/libfaketime/no-date-in-gzip-man-page.patch12
-rw-r--r--nixpkgs/pkgs/development/libraries/libfann/default.nix25
-rw-r--r--nixpkgs/pkgs/development/libraries/libffcall/default.nix28
-rw-r--r--nixpkgs/pkgs/development/libraries/libffi/3.2.1-cygwin.patch10
-rw-r--r--nixpkgs/pkgs/development/libraries/libffi/default.nix96
-rw-r--r--nixpkgs/pkgs/development/libraries/libfido2/default.nix25
-rw-r--r--nixpkgs/pkgs/development/libraries/libfilezilla/default.nix22
-rw-r--r--nixpkgs/pkgs/development/libraries/libfive/default.nix30
-rw-r--r--nixpkgs/pkgs/development/libraries/libfixposix/default.nix23
-rw-r--r--nixpkgs/pkgs/development/libraries/libfm/default.nix40
-rw-r--r--nixpkgs/pkgs/development/libraries/libfprint/default.nix43
-rw-r--r--nixpkgs/pkgs/development/libraries/libfpx/default.nix32
-rw-r--r--nixpkgs/pkgs/development/libraries/libfreefare/default.nix23
-rw-r--r--nixpkgs/pkgs/development/libraries/libftdi/1.x.nix47
-rw-r--r--nixpkgs/pkgs/development/libraries/libftdi/default.nix32
-rw-r--r--nixpkgs/pkgs/development/libraries/libgadu/default.nix21
-rw-r--r--nixpkgs/pkgs/development/libraries/libgaminggear/default.nix40
-rw-r--r--nixpkgs/pkgs/development/libraries/libgap/default.nix25
-rw-r--r--nixpkgs/pkgs/development/libraries/libgcrypt/1.5.nix42
-rw-r--r--nixpkgs/pkgs/development/libraries/libgcrypt/default.nix57
-rw-r--r--nixpkgs/pkgs/development/libraries/libgda/default.nix44
-rw-r--r--nixpkgs/pkgs/development/libraries/libgdamm/default.nix39
-rw-r--r--nixpkgs/pkgs/development/libraries/libgdata/default.nix33
-rw-r--r--nixpkgs/pkgs/development/libraries/libgdiplus/default.nix56
-rw-r--r--nixpkgs/pkgs/development/libraries/libgee/default.nix35
-rw-r--r--nixpkgs/pkgs/development/libraries/libgeotiff/default.nix27
-rw-r--r--nixpkgs/pkgs/development/libraries/libgepub/default.nix31
-rw-r--r--nixpkgs/pkgs/development/libraries/libgig/default.nix27
-rw-r--r--nixpkgs/pkgs/development/libraries/libgit2-glib/default.nix48
-rw-r--r--nixpkgs/pkgs/development/libraries/libgksu/default.nix87
-rw-r--r--nixpkgs/pkgs/development/libraries/libgksu/libgksu-2.0.0-fbsd.patch60
-rw-r--r--nixpkgs/pkgs/development/libraries/libgksu/libgksu-2.0.12-automake-1.11.2.patch25
-rw-r--r--nixpkgs/pkgs/development/libraries/libgksu/libgksu-2.0.12-fix-make-3.82.patch19
-rw-r--r--nixpkgs/pkgs/development/libraries/libgksu/libgksu-2.0.12-notests.patch26
-rw-r--r--nixpkgs/pkgs/development/libraries/libgksu/libgksu-2.0.12-revert-forkpty.patch359
-rw-r--r--nixpkgs/pkgs/development/libraries/libgksu/libgksu-2.0.7-libs.patch76
-rw-r--r--nixpkgs/pkgs/development/libraries/libgksu/libgksu-2.0.7-polinguas.patch40
-rw-r--r--nixpkgs/pkgs/development/libraries/libglvnd/default.nix60
-rw-r--r--nixpkgs/pkgs/development/libraries/libgnome-keyring/default.nix22
-rw-r--r--nixpkgs/pkgs/development/libraries/libgnomekbd/default.nix30
-rw-r--r--nixpkgs/pkgs/development/libraries/libgnurl/default.nix31
-rw-r--r--nixpkgs/pkgs/development/libraries/libgpg-error/default.nix72
-rw-r--r--nixpkgs/pkgs/development/libraries/libgphoto2/default.nix43
-rw-r--r--nixpkgs/pkgs/development/libraries/libgpiod/default.nix38
-rw-r--r--nixpkgs/pkgs/development/libraries/libgpod/default.nix39
-rw-r--r--nixpkgs/pkgs/development/libraries/libgringotts/default.nix22
-rw-r--r--nixpkgs/pkgs/development/libraries/libgroove/default.nix25
-rw-r--r--nixpkgs/pkgs/development/libraries/libgroove/no-warnings-as-errors.patch15
-rw-r--r--nixpkgs/pkgs/development/libraries/libgrss/default.nix40
-rw-r--r--nixpkgs/pkgs/development/libraries/libgsf/default.nix43
-rw-r--r--nixpkgs/pkgs/development/libraries/libgssglue/default.nix29
-rw-r--r--nixpkgs/pkgs/development/libraries/libgtop/default.nix45
-rw-r--r--nixpkgs/pkgs/development/libraries/libgudev/default.nix35
-rw-r--r--nixpkgs/pkgs/development/libraries/libguestfs/appliance.nix11
-rw-r--r--nixpkgs/pkgs/development/libraries/libguestfs/default.nix89
-rw-r--r--nixpkgs/pkgs/development/libraries/libguestfs/libguestfs-syms.patch13
-rw-r--r--nixpkgs/pkgs/development/libraries/libgumath/default.nix34
-rw-r--r--nixpkgs/pkgs/development/libraries/libgweather/default.nix42
-rw-r--r--nixpkgs/pkgs/development/libraries/libgxps/default.nix36
-rw-r--r--nixpkgs/pkgs/development/libraries/libhandy/default.nix58
-rw-r--r--nixpkgs/pkgs/development/libraries/libhangul/default.nix18
-rw-r--r--nixpkgs/pkgs/development/libraries/libharu/default.nix20
-rw-r--r--nixpkgs/pkgs/development/libraries/libhdhomerun/default.nix32
-rw-r--r--nixpkgs/pkgs/development/libraries/libheif/1.4.0-CVE-2019-11471.patch15
-rw-r--r--nixpkgs/pkgs/development/libraries/libheif/default.nix29
-rw-r--r--nixpkgs/pkgs/development/libraries/libhttpseverywhere/default.nix49
-rw-r--r--nixpkgs/pkgs/development/libraries/libiberty/default.nix28
-rw-r--r--nixpkgs/pkgs/development/libraries/libibmad/default.nix18
-rw-r--r--nixpkgs/pkgs/development/libraries/libibumad/default.nix16
-rw-r--r--nixpkgs/pkgs/development/libraries/libical/default.nix55
-rw-r--r--nixpkgs/pkgs/development/libraries/libical/respect-env-tzdir.patch29
-rw-r--r--nixpkgs/pkgs/development/libraries/libicns/default.nix19
-rw-r--r--nixpkgs/pkgs/development/libraries/libiconv/default.nix57
-rw-r--r--nixpkgs/pkgs/development/libraries/libiconv/setup-hook.sh8
-rw-r--r--nixpkgs/pkgs/development/libraries/libid3tag/CVE-2017-11550-and-CVE-2017-11551.patch13
-rw-r--r--nixpkgs/pkgs/development/libraries/libid3tag/debian-patches.patch89
-rw-r--r--nixpkgs/pkgs/development/libraries/libid3tag/default.nix44
-rw-r--r--nixpkgs/pkgs/development/libraries/libid3tag/id3tag.pc11
-rw-r--r--nixpkgs/pkgs/development/libraries/libidn/default.nix47
-rw-r--r--nixpkgs/pkgs/development/libraries/libidn2/default.nix40
-rw-r--r--nixpkgs/pkgs/development/libraries/libidn2/fix-error-darwin.patch20
-rw-r--r--nixpkgs/pkgs/development/libraries/libiec61883/default.nix22
-rw-r--r--nixpkgs/pkgs/development/libraries/libiio/default.nix38
-rw-r--r--nixpkgs/pkgs/development/libraries/libimagequant/default.nix26
-rw-r--r--nixpkgs/pkgs/development/libraries/libimobiledevice/default.nix61
-rw-r--r--nixpkgs/pkgs/development/libraries/libindicate/default.nix66
-rw-r--r--nixpkgs/pkgs/development/libraries/libindicator/default.nix52
-rw-r--r--nixpkgs/pkgs/development/libraries/libinfinity/default.nix53
-rw-r--r--nixpkgs/pkgs/development/libraries/libinotify-kqueue/default.nix24
-rw-r--r--nixpkgs/pkgs/development/libraries/libinput/default.nix73
-rw-r--r--nixpkgs/pkgs/development/libraries/libinput/udev-absolute-path.patch11
-rw-r--r--nixpkgs/pkgs/development/libraries/libiodbc/default.nix27
-rw-r--r--nixpkgs/pkgs/development/libraries/libipfix/default.nix17
-rw-r--r--nixpkgs/pkgs/development/libraries/libiptcdata/default.nix17
-rw-r--r--nixpkgs/pkgs/development/libraries/libircclient/default.nix31
-rw-r--r--nixpkgs/pkgs/development/libraries/libisoburn/default.nix22
-rw-r--r--nixpkgs/pkgs/development/libraries/libisofs/default.nix22
-rw-r--r--nixpkgs/pkgs/development/libraries/libite/default.nix37
-rw-r--r--nixpkgs/pkgs/development/libraries/libivykis/default.nix26
-rw-r--r--nixpkgs/pkgs/development/libraries/libixp-hg/default.nix27
-rw-r--r--nixpkgs/pkgs/development/libraries/libjpeg-drop/default.nix36
-rw-r--r--nixpkgs/pkgs/development/libraries/libjpeg-turbo/default.nix33
-rw-r--r--nixpkgs/pkgs/development/libraries/libjpeg-turbo/mingw-boolean.patch19
-rwxr-xr-xnixpkgs/pkgs/development/libraries/libjpeg/builder.sh25
-rw-r--r--nixpkgs/pkgs/development/libraries/libjpeg/default.nix23
-rw-r--r--nixpkgs/pkgs/development/libraries/libjreen/default.nix22
-rw-r--r--nixpkgs/pkgs/development/libraries/libjson-rpc-cpp/default.nix67
-rw-r--r--nixpkgs/pkgs/development/libraries/libjson/default.nix27
-rw-r--r--nixpkgs/pkgs/development/libraries/libjson/install-fix.patch12
-rw-r--r--nixpkgs/pkgs/development/libraries/libkate/default.nix24
-rw-r--r--nixpkgs/pkgs/development/libraries/libkeyfinder/default.nix38
-rw-r--r--nixpkgs/pkgs/development/libraries/libksba/default.nix31
-rw-r--r--nixpkgs/pkgs/development/libraries/libksi/default.nix27
-rw-r--r--nixpkgs/pkgs/development/libraries/libktorrent/default.nix37
-rw-r--r--nixpkgs/pkgs/development/libraries/liblangtag/default.nix52
-rw-r--r--nixpkgs/pkgs/development/libraries/liblastfm/default.nix29
-rw-r--r--nixpkgs/pkgs/development/libraries/liblastfmSF/default.nix20
-rw-r--r--nixpkgs/pkgs/development/libraries/liblaxjson/default.nix23
-rw-r--r--nixpkgs/pkgs/development/libraries/liblcf/default.nix24
-rw-r--r--nixpkgs/pkgs/development/libraries/liblinear/default.nix39
-rw-r--r--nixpkgs/pkgs/development/libraries/liblo/default.nix20
-rw-r--r--nixpkgs/pkgs/development/libraries/liblockfile/default.nix29
-rw-r--r--nixpkgs/pkgs/development/libraries/liblogging/default.nix29
-rw-r--r--nixpkgs/pkgs/development/libraries/liblognorm/default.nix22
-rw-r--r--nixpkgs/pkgs/development/libraries/liblouis/default.nix57
-rw-r--r--nixpkgs/pkgs/development/libraries/liblqr-1/default.nix20
-rw-r--r--nixpkgs/pkgs/development/libraries/liblscp/default.nix25
-rw-r--r--nixpkgs/pkgs/development/libraries/libltc/default.nix17
-rw-r--r--nixpkgs/pkgs/development/libraries/libmad/001-mips_removal_h_constraint.patch73
-rw-r--r--nixpkgs/pkgs/development/libraries/libmad/default.nix33
-rw-r--r--nixpkgs/pkgs/development/libraries/libmad/optimize.diff77
-rw-r--r--nixpkgs/pkgs/development/libraries/libmad/pkgconfig.patch117
-rw-r--r--nixpkgs/pkgs/development/libraries/libmanette/default.nix36
-rw-r--r--nixpkgs/pkgs/development/libraries/libmatchbox/default.nix24
-rw-r--r--nixpkgs/pkgs/development/libraries/libmatheval/default.nix46
-rw-r--r--nixpkgs/pkgs/development/libraries/libmatroska/default.nix30
-rw-r--r--nixpkgs/pkgs/development/libraries/libmaxminddb/default.nix19
-rw-r--r--nixpkgs/pkgs/development/libraries/libmbim/default.nix37
-rw-r--r--nixpkgs/pkgs/development/libraries/libmcrypt/default.nix24
-rw-r--r--nixpkgs/pkgs/development/libraries/libmd/default.nix28
-rw-r--r--nixpkgs/pkgs/development/libraries/libmediaart/default.nix34
-rw-r--r--nixpkgs/pkgs/development/libraries/libmediainfo/default.nix31
-rw-r--r--nixpkgs/pkgs/development/libraries/libmemcached/default.nix34
-rw-r--r--nixpkgs/pkgs/development/libraries/libmemcached/libmemcached-fix-linking-with-libpthread.patch19
-rw-r--r--nixpkgs/pkgs/development/libraries/libmemcached/musl-fixes.patch58
-rw-r--r--nixpkgs/pkgs/development/libraries/libmesode/default.nix39
-rw-r--r--nixpkgs/pkgs/development/libraries/libmhash/autotools-define-conflict-debian-fix.patch78
-rw-r--r--nixpkgs/pkgs/development/libraries/libmhash/default.nix29
-rw-r--r--nixpkgs/pkgs/development/libraries/libmicrodns/default.nix30
-rw-r--r--nixpkgs/pkgs/development/libraries/libmicrohttpd/default.nix39
-rw-r--r--nixpkgs/pkgs/development/libraries/libmikmod/default.nix33
-rw-r--r--nixpkgs/pkgs/development/libraries/libmilter/default.nix44
-rw-r--r--nixpkgs/pkgs/development/libraries/libmilter/install.patch42
-rw-r--r--nixpkgs/pkgs/development/libraries/libmilter/sharedlib.patch55
-rw-r--r--nixpkgs/pkgs/development/libraries/libminc/default.nix46
-rw-r--r--nixpkgs/pkgs/development/libraries/libmkv/default.nix28
-rw-r--r--nixpkgs/pkgs/development/libraries/libmms/default.nix21
-rw-r--r--nixpkgs/pkgs/development/libraries/libmng/default.nix23
-rw-r--r--nixpkgs/pkgs/development/libraries/libmnl/default.nix25
-rw-r--r--nixpkgs/pkgs/development/libraries/libmodbus/default.nix28
-rw-r--r--nixpkgs/pkgs/development/libraries/libmodplug/default.nix20
-rw-r--r--nixpkgs/pkgs/development/libraries/libmongo-client/default.nix28
-rw-r--r--nixpkgs/pkgs/development/libraries/libmowgli/default.nix18
-rw-r--r--nixpkgs/pkgs/development/libraries/libmp3splt/default.nix24
-rw-r--r--nixpkgs/pkgs/development/libraries/libmpack/default.nix24
-rw-r--r--nixpkgs/pkgs/development/libraries/libmpc/default.nix35
-rw-r--r--nixpkgs/pkgs/development/libraries/libmpcdec/default.nix16
-rw-r--r--nixpkgs/pkgs/development/libraries/libmpeg2/default.nix22
-rw-r--r--nixpkgs/pkgs/development/libraries/libmrss/default.nix22
-rw-r--r--nixpkgs/pkgs/development/libraries/libmspack/default.nix17
-rw-r--r--nixpkgs/pkgs/development/libraries/libmtp/default.nix31
-rw-r--r--nixpkgs/pkgs/development/libraries/libmusicbrainz/5.x.nix29
-rw-r--r--nixpkgs/pkgs/development/libraries/libmusicbrainz/default.nix23
-rw-r--r--nixpkgs/pkgs/development/libraries/libmwaw/default.nix31
-rw-r--r--nixpkgs/pkgs/development/libraries/libmwaw/default.upstream4
-rw-r--r--nixpkgs/pkgs/development/libraries/libmx/default.nix62
-rw-r--r--nixpkgs/pkgs/development/libraries/libmypaint/default.nix40
-rw-r--r--nixpkgs/pkgs/development/libraries/libmysqlconnectorcpp/default.nix22
-rw-r--r--nixpkgs/pkgs/development/libraries/libnabo/default.nix32
-rw-r--r--nixpkgs/pkgs/development/libraries/libnatpmp/default.nix22
-rw-r--r--nixpkgs/pkgs/development/libraries/libnatspec/default.nix23
-rw-r--r--nixpkgs/pkgs/development/libraries/libndctl/default.nix49
-rw-r--r--nixpkgs/pkgs/development/libraries/libndp/default.nix19
-rw-r--r--nixpkgs/pkgs/development/libraries/libndtypes/default.nix28
-rw-r--r--nixpkgs/pkgs/development/libraries/libnet/default.nix20
-rw-r--r--nixpkgs/pkgs/development/libraries/libnet/fix-includes.patch29
-rw-r--r--nixpkgs/pkgs/development/libraries/libnetfilter_acct/default.nix21
-rw-r--r--nixpkgs/pkgs/development/libraries/libnetfilter_conntrack/default.nix28
-rw-r--r--nixpkgs/pkgs/development/libraries/libnetfilter_cthelper/default.nix27
-rw-r--r--nixpkgs/pkgs/development/libraries/libnetfilter_cttimeout/default.nix27
-rw-r--r--nixpkgs/pkgs/development/libraries/libnetfilter_log/default.nix29
-rw-r--r--nixpkgs/pkgs/development/libraries/libnetfilter_queue/default.nix21
-rw-r--r--nixpkgs/pkgs/development/libraries/libnfc/default.nix21
-rw-r--r--nixpkgs/pkgs/development/libraries/libnfnetlink/Use-stdlib-uint-instead-of-u_int.patch499
-rw-r--r--nixpkgs/pkgs/development/libraries/libnfnetlink/default.nix31
-rw-r--r--nixpkgs/pkgs/development/libraries/libnfs/default.nix27
-rw-r--r--nixpkgs/pkgs/development/libraries/libnftnl/default.nix22
-rw-r--r--nixpkgs/pkgs/development/libraries/libngspice/default.nix26
-rw-r--r--nixpkgs/pkgs/development/libraries/libnice/default.nix53
-rw-r--r--nixpkgs/pkgs/development/libraries/libnih/default.nix24
-rw-r--r--nixpkgs/pkgs/development/libraries/libnotify/default.nix45
-rw-r--r--nixpkgs/pkgs/development/libraries/libnova/default.nix17
-rw-r--r--nixpkgs/pkgs/development/libraries/libnsl/default.nix24
-rw-r--r--nixpkgs/pkgs/development/libraries/libnxml/default.nix21
-rw-r--r--nixpkgs/pkgs/development/libraries/liboauth/default.nix31
-rw-r--r--nixpkgs/pkgs/development/libraries/libodfgen/default.nix30
-rw-r--r--nixpkgs/pkgs/development/libraries/libodfgen/default.upstream4
-rw-r--r--nixpkgs/pkgs/development/libraries/libofa/default.nix39
-rw-r--r--nixpkgs/pkgs/development/libraries/libofx/default.nix23
-rw-r--r--nixpkgs/pkgs/development/libraries/libogg/default.nix25
-rw-r--r--nixpkgs/pkgs/development/libraries/liboggz/default.nix33
-rw-r--r--nixpkgs/pkgs/development/libraries/liboil/default.nix32
-rw-r--r--nixpkgs/pkgs/development/libraries/liboil/x86_64-cpuid.patch38
-rw-r--r--nixpkgs/pkgs/development/libraries/libomxil-bellagio/default.nix25
-rw-r--r--nixpkgs/pkgs/development/libraries/libomxil-bellagio/fedora-fixes.patch199
-rw-r--r--nixpkgs/pkgs/development/libraries/liboop/default.nix17
-rw-r--r--nixpkgs/pkgs/development/libraries/libopcodes/default.nix44
-rw-r--r--nixpkgs/pkgs/development/libraries/libopenaptx/default.nix25
-rw-r--r--nixpkgs/pkgs/development/libraries/liboping/default.nix29
-rw-r--r--nixpkgs/pkgs/development/libraries/libopus/default.nix28
-rw-r--r--nixpkgs/pkgs/development/libraries/libopusenc/default.nix28
-rw-r--r--nixpkgs/pkgs/development/libraries/libosinfo/default.nix46
-rw-r--r--nixpkgs/pkgs/development/libraries/libosinfo/osinfo-db-data-dir.patch11
-rw-r--r--nixpkgs/pkgs/development/libraries/libosmium/default.nix24
-rw-r--r--nixpkgs/pkgs/development/libraries/libosmpbf/default.nix23
-rw-r--r--nixpkgs/pkgs/development/libraries/libossp-uuid/default.nix47
-rw-r--r--nixpkgs/pkgs/development/libraries/libossp-uuid/shtool.patch11
-rw-r--r--nixpkgs/pkgs/development/libraries/libotr/default.nix22
-rw-r--r--nixpkgs/pkgs/development/libraries/libow/default.nix43
-rw-r--r--nixpkgs/pkgs/development/libraries/libowfat/default.nix30
-rw-r--r--nixpkgs/pkgs/development/libraries/libp11/default.nix31
-rw-r--r--nixpkgs/pkgs/development/libraries/libpaper/default.nix37
-rw-r--r--nixpkgs/pkgs/development/libraries/libpar2/default.nix26
-rw-r--r--nixpkgs/pkgs/development/libraries/libpar2/libpar2-0.4-external-verification.patch16
-rw-r--r--nixpkgs/pkgs/development/libraries/libpcap/default.nix46
-rw-r--r--nixpkgs/pkgs/development/libraries/libpeas/default.nix36
-rw-r--r--nixpkgs/pkgs/development/libraries/libpfm/default.nix33
-rw-r--r--nixpkgs/pkgs/development/libraries/libpgf/default.nix28
-rw-r--r--nixpkgs/pkgs/development/libraries/libphonenumber/default.nix38
-rw-r--r--nixpkgs/pkgs/development/libraries/libpinyin/default.nix33
-rw-r--r--nixpkgs/pkgs/development/libraries/libpipeline/default.nix19
-rw-r--r--nixpkgs/pkgs/development/libraries/libpipeline/fix-on-osx.patch13
-rw-r--r--nixpkgs/pkgs/development/libraries/libplist/default.nix41
-rw-r--r--nixpkgs/pkgs/development/libraries/libpng/12.nix31
-rw-r--r--nixpkgs/pkgs/development/libraries/libpng/default.nix39
-rw-r--r--nixpkgs/pkgs/development/libraries/libpointmatcher/default.nix36
-rw-r--r--nixpkgs/pkgs/development/libraries/libpqxx/default.nix30
-rw-r--r--nixpkgs/pkgs/development/libraries/libproxy/default.nix47
-rw-r--r--nixpkgs/pkgs/development/libraries/libpseudo/default.nix28
-rw-r--r--nixpkgs/pkgs/development/libraries/libpsl/default.nix56
-rw-r--r--nixpkgs/pkgs/development/libraries/libpst/default.nix31
-rw-r--r--nixpkgs/pkgs/development/libraries/libpwquality/default.nix23
-rw-r--r--nixpkgs/pkgs/development/libraries/libqalculate/default.nix48
-rw-r--r--nixpkgs/pkgs/development/libraries/libqb/default.nix19
-rw-r--r--nixpkgs/pkgs/development/libraries/libqglviewer/default.nix26
-rw-r--r--nixpkgs/pkgs/development/libraries/libqmatrixclient/default.nix37
-rw-r--r--nixpkgs/pkgs/development/libraries/libqmi/default.nix37
-rw-r--r--nixpkgs/pkgs/development/libraries/libqtav/default.nix51
-rw-r--r--nixpkgs/pkgs/development/libraries/libr3/default.nix33
-rw-r--r--nixpkgs/pkgs/development/libraries/libraw/default.nix27
-rw-r--r--nixpkgs/pkgs/development/libraries/libraw1394/default.nix17
-rw-r--r--nixpkgs/pkgs/development/libraries/librdf/default.nix34
-rw-r--r--nixpkgs/pkgs/development/libraries/librdf/raptor.nix24
-rw-r--r--nixpkgs/pkgs/development/libraries/librdf/raptor2.nix22
-rw-r--r--nixpkgs/pkgs/development/libraries/librdf/rasqal.nix30
-rw-r--r--nixpkgs/pkgs/development/libraries/librdf/redland.nix47
-rw-r--r--nixpkgs/pkgs/development/libraries/libre/default.nix24
-rw-r--r--nixpkgs/pkgs/development/libraries/librealsense/default.nix33
-rw-r--r--nixpkgs/pkgs/development/libraries/librelp/default.nix20
-rw-r--r--nixpkgs/pkgs/development/libraries/librem/default.nix27
-rw-r--r--nixpkgs/pkgs/development/libraries/librep/default.nix41
-rw-r--r--nixpkgs/pkgs/development/libraries/librep/setup-hook.sh5
-rw-r--r--nixpkgs/pkgs/development/libraries/libresample/default.nix28
-rw-r--r--nixpkgs/pkgs/development/libraries/libressl/default.nix59
-rw-r--r--nixpkgs/pkgs/development/libraries/librest/default.nix31
-rw-r--r--nixpkgs/pkgs/development/libraries/librevenge/default.nix42
-rw-r--r--nixpkgs/pkgs/development/libraries/librevenge/default.upstream4
-rw-r--r--nixpkgs/pkgs/development/libraries/librevisa/default.nix30
-rw-r--r--nixpkgs/pkgs/development/libraries/librime/default.nix28
-rw-r--r--nixpkgs/pkgs/development/libraries/libroxml/default.nix16
-rw-r--r--nixpkgs/pkgs/development/libraries/librsvg/default.nix86
-rw-r--r--nixpkgs/pkgs/development/libraries/librsync/0.9.nix26
-rw-r--r--nixpkgs/pkgs/development/libraries/librsync/default.nix25
-rw-r--r--nixpkgs/pkgs/development/libraries/libs3/default.nix23
-rw-r--r--nixpkgs/pkgs/development/libraries/libsamplerate/default.nix37
-rw-r--r--nixpkgs/pkgs/development/libraries/libsass/default.nix32
-rw-r--r--nixpkgs/pkgs/development/libraries/libscrypt/default.nix28
-rw-r--r--nixpkgs/pkgs/development/libraries/libsearpc/default.nix31
-rw-r--r--nixpkgs/pkgs/development/libraries/libsearpc/libsearpc.pc.patch10
-rw-r--r--nixpkgs/pkgs/development/libraries/libseccomp/default.nix38
-rw-r--r--nixpkgs/pkgs/development/libraries/libsecret/default.nix53
-rw-r--r--nixpkgs/pkgs/development/libraries/libserialport/default.nix22
-rw-r--r--nixpkgs/pkgs/development/libraries/libsexy/default.nix24
-rw-r--r--nixpkgs/pkgs/development/libraries/libshout/default.nix33
-rw-r--r--nixpkgs/pkgs/development/libraries/libsidplayfp/default.nix39
-rw-r--r--nixpkgs/pkgs/development/libraries/libsieve/default.nix17
-rw-r--r--nixpkgs/pkgs/development/libraries/libsigcxx/1.2.nix21
-rw-r--r--nixpkgs/pkgs/development/libraries/libsigcxx/default.nix29
-rw-r--r--nixpkgs/pkgs/development/libraries/libsignal-protocol-c/default.nix29
-rw-r--r--nixpkgs/pkgs/development/libraries/libsignon-glib/default.nix53
-rw-r--r--nixpkgs/pkgs/development/libraries/libsigsegv/default.nix36
-rw-r--r--nixpkgs/pkgs/development/libraries/libsigsegv/sigbus_fix.patch8
-rw-r--r--nixpkgs/pkgs/development/libraries/libsixel/default.nix20
-rw-r--r--nixpkgs/pkgs/development/libraries/libskk/default.nix49
-rw-r--r--nixpkgs/pkgs/development/libraries/libsmi/default.nix18
-rw-r--r--nixpkgs/pkgs/development/libraries/libsnark/default.nix30
-rw-r--r--nixpkgs/pkgs/development/libraries/libsndfile/default.nix91
-rw-r--r--nixpkgs/pkgs/development/libraries/libsodium/default.nix25
-rw-r--r--nixpkgs/pkgs/development/libraries/libsolv/default.nix32
-rw-r--r--nixpkgs/pkgs/development/libraries/libsoundio/default.nix29
-rw-r--r--nixpkgs/pkgs/development/libraries/libsoup/default.nix47
-rw-r--r--nixpkgs/pkgs/development/libraries/libspatialindex/default.nix21
-rw-r--r--nixpkgs/pkgs/development/libraries/libspatialite/default.nix31
-rw-r--r--nixpkgs/pkgs/development/libraries/libspectre/default.nix33
-rw-r--r--nixpkgs/pkgs/development/libraries/libspectre/libspectre-0.2.7-gs918.patch42
-rw-r--r--nixpkgs/pkgs/development/libraries/libspiro/default.nix18
-rw-r--r--nixpkgs/pkgs/development/libraries/libspotify/default.nix89
-rw-r--r--nixpkgs/pkgs/development/libraries/libsrs2/default.nix18
-rw-r--r--nixpkgs/pkgs/development/libraries/libssh/default.nix29
-rw-r--r--nixpkgs/pkgs/development/libraries/libssh2/default.nix24
-rw-r--r--nixpkgs/pkgs/development/libraries/libstatgrab/default.nix20
-rw-r--r--nixpkgs/pkgs/development/libraries/libstemmer/default.nix22
-rw-r--r--nixpkgs/pkgs/development/libraries/libstroke/default.nix34
-rw-r--r--nixpkgs/pkgs/development/libraries/libstrophe/default.nix35
-rw-r--r--nixpkgs/pkgs/development/libraries/libsvm/default.nix38
-rw-r--r--nixpkgs/pkgs/development/libraries/libtap/default.nix29
-rw-r--r--nixpkgs/pkgs/development/libraries/libtar/default.nix37
-rw-r--r--nixpkgs/pkgs/development/libraries/libtasn1/default.nix29
-rw-r--r--nixpkgs/pkgs/development/libraries/libtcod/default.nix33
-rw-r--r--nixpkgs/pkgs/development/libraries/libtelnet/default.nix24
-rw-r--r--nixpkgs/pkgs/development/libraries/libtensorflow/default.nix80
-rw-r--r--nixpkgs/pkgs/development/libraries/libtermkey/default.nix24
-rw-r--r--nixpkgs/pkgs/development/libraries/libtheora/default.nix30
-rw-r--r--nixpkgs/pkgs/development/libraries/libtiff/default.nix36
-rw-r--r--nixpkgs/pkgs/development/libraries/libtiger/default.nix22
-rw-r--r--nixpkgs/pkgs/development/libraries/libtins/default.nix48
-rw-r--r--nixpkgs/pkgs/development/libraries/libtomcrypt/default.nix34
-rw-r--r--nixpkgs/pkgs/development/libraries/libtommath/default.nix35
-rw-r--r--nixpkgs/pkgs/development/libraries/libtorrent-rasterbar/default.nix51
-rw-r--r--nixpkgs/pkgs/development/libraries/libtoxcore/default.nix54
-rw-r--r--nixpkgs/pkgs/development/libraries/libtoxcore/new-api.nix56
-rw-r--r--nixpkgs/pkgs/development/libraries/libtsm/darwin.patch37
-rw-r--r--nixpkgs/pkgs/development/libraries/libtsm/default.nix27
-rw-r--r--nixpkgs/pkgs/development/libraries/libtxc_dxtn/default.nix22
-rw-r--r--nixpkgs/pkgs/development/libraries/libtxc_dxtn_s2tc/default.nix24
-rw-r--r--nixpkgs/pkgs/development/libraries/libu2f-host/default.nix27
-rw-r--r--nixpkgs/pkgs/development/libraries/libu2f-server/default.nix20
-rw-r--r--nixpkgs/pkgs/development/libraries/libubox/default.nix24
-rw-r--r--nixpkgs/pkgs/development/libraries/libuchardet/default.nix32
-rw-r--r--nixpkgs/pkgs/development/libraries/libuecc/default.nix24
-rw-r--r--nixpkgs/pkgs/development/libraries/libui/default.nix53
-rw-r--r--nixpkgs/pkgs/development/libraries/libui/libui.pc11
-rw-r--r--nixpkgs/pkgs/development/libraries/libunarr/default.nix21
-rw-r--r--nixpkgs/pkgs/development/libraries/libunibreak/default.nix19
-rw-r--r--nixpkgs/pkgs/development/libraries/libunique/1.1.6-G_CONST_RETURN.patch143
-rw-r--r--nixpkgs/pkgs/development/libraries/libunique/1.1.6-compiler-warnings.patch50
-rw-r--r--nixpkgs/pkgs/development/libraries/libunique/1.1.6-fix-test.patch26
-rw-r--r--nixpkgs/pkgs/development/libraries/libunique/1.1.6-include-terminator.patch37
-rw-r--r--nixpkgs/pkgs/development/libraries/libunique/3.x.nix30
-rw-r--r--nixpkgs/pkgs/development/libraries/libunique/default.nix36
-rw-r--r--nixpkgs/pkgs/development/libraries/libunique/gcc7-bug.patch18
-rw-r--r--nixpkgs/pkgs/development/libraries/libunistring/default.nix67
-rw-r--r--nixpkgs/pkgs/development/libraries/libunity/default.nix62
-rw-r--r--nixpkgs/pkgs/development/libraries/libunwind/backtrace-only-with-glibc.patch45
-rw-r--r--nixpkgs/pkgs/development/libraries/libunwind/default.nix37
-rw-r--r--nixpkgs/pkgs/development/libraries/liburcu/default.nix25
-rw-r--r--nixpkgs/pkgs/development/libraries/liburing/default.nix41
-rw-r--r--nixpkgs/pkgs/development/libraries/libusb/default.nix30
-rw-r--r--nixpkgs/pkgs/development/libraries/libusb/fix-headers.patch10
-rw-r--r--nixpkgs/pkgs/development/libraries/libusb1/default.nix39
-rw-r--r--nixpkgs/pkgs/development/libraries/libusbmuxd/default.nix26
-rw-r--r--nixpkgs/pkgs/development/libraries/libutempter/default.nix39
-rw-r--r--nixpkgs/pkgs/development/libraries/libutempter/exec_path.patch25
-rw-r--r--nixpkgs/pkgs/development/libraries/libuv/default.nix75
-rw-r--r--nixpkgs/pkgs/development/libraries/libva-utils/default.nix35
-rw-r--r--nixpkgs/pkgs/development/libraries/libva/1.0.0.nix37
-rw-r--r--nixpkgs/pkgs/development/libraries/libva/default.nix45
-rw-r--r--nixpkgs/pkgs/development/libraries/libvdpau-va-gl/default.nix27
-rw-r--r--nixpkgs/pkgs/development/libraries/libvdpau/default.nix33
-rw-r--r--nixpkgs/pkgs/development/libraries/libversion/default.nix28
-rw-r--r--nixpkgs/pkgs/development/libraries/libviper/default.nix28
-rw-r--r--nixpkgs/pkgs/development/libraries/libvirt-glib/default.nix42
-rw-r--r--nixpkgs/pkgs/development/libraries/libvirt/default.nix136
-rw-r--r--nixpkgs/pkgs/development/libraries/libvisio/default.nix31
-rw-r--r--nixpkgs/pkgs/development/libraries/libvisual/default.nix22
-rw-r--r--nixpkgs/pkgs/development/libraries/libvmi/default.nix51
-rw-r--r--nixpkgs/pkgs/development/libraries/libvncserver/default.nix43
-rw-r--r--nixpkgs/pkgs/development/libraries/libvorbis/default.nix37
-rw-r--r--nixpkgs/pkgs/development/libraries/libvpx/default.nix175
-rw-r--r--nixpkgs/pkgs/development/libraries/libvterm-neovim/default.nix33
-rw-r--r--nixpkgs/pkgs/development/libraries/libvterm/default.nix29
-rw-r--r--nixpkgs/pkgs/development/libraries/libwacom/default.nix23
-rw-r--r--nixpkgs/pkgs/development/libraries/libwebp/default.nix67
-rw-r--r--nixpkgs/pkgs/development/libraries/libwebsockets/default.nix28
-rw-r--r--nixpkgs/pkgs/development/libraries/libwhereami/default.nix32
-rw-r--r--nixpkgs/pkgs/development/libraries/libwmf/default.nix27
-rw-r--r--nixpkgs/pkgs/development/libraries/libwnck/3.x.nix38
-rw-r--r--nixpkgs/pkgs/development/libraries/libwnck/default.nix27
-rw-r--r--nixpkgs/pkgs/development/libraries/libwpd/0.8.nix23
-rw-r--r--nixpkgs/pkgs/development/libraries/libwpd/default.nix21
-rw-r--r--nixpkgs/pkgs/development/libraries/libwpd/gcc-0.8.patch13
-rw-r--r--nixpkgs/pkgs/development/libraries/libwpg/default.nix20
-rw-r--r--nixpkgs/pkgs/development/libraries/libwps/default.nix23
-rw-r--r--nixpkgs/pkgs/development/libraries/libx86/constants.patch20
-rw-r--r--nixpkgs/pkgs/development/libraries/libx86/default.nix29
-rw-r--r--nixpkgs/pkgs/development/libraries/libx86/non-x86.patch38
-rw-r--r--nixpkgs/pkgs/development/libraries/libx86/src-for-default.nix9
-rw-r--r--nixpkgs/pkgs/development/libraries/libx86/src-info-for-default.nix4
-rw-r--r--nixpkgs/pkgs/development/libraries/libx86emu/default.nix35
-rw-r--r--nixpkgs/pkgs/development/libraries/libxc/default.nix32
-rw-r--r--nixpkgs/pkgs/development/libraries/libxcomp/default.nix28
-rw-r--r--nixpkgs/pkgs/development/libraries/libxdg-basedir/default.nix24
-rw-r--r--nixpkgs/pkgs/development/libraries/libxkbcommon/default.nix39
-rw-r--r--nixpkgs/pkgs/development/libraries/libxkbcommon/libxkbcommon_7.nix32
-rw-r--r--nixpkgs/pkgs/development/libraries/libxklavier/default.nix43
-rw-r--r--nixpkgs/pkgs/development/libraries/libxl/default.nix26
-rw-r--r--nixpkgs/pkgs/development/libraries/libxls/default.nix23
-rw-r--r--nixpkgs/pkgs/development/libraries/libxmi/default.nix21
-rw-r--r--nixpkgs/pkgs/development/libraries/libxml2/default.nix70
-rw-r--r--nixpkgs/pkgs/development/libraries/libxmlb/default.nix38
-rw-r--r--nixpkgs/pkgs/development/libraries/libxmlxx/default.nix31
-rw-r--r--nixpkgs/pkgs/development/libraries/libxmlxx/v3.nix28
-rw-r--r--nixpkgs/pkgs/development/libraries/libxmp/default.nix22
-rw-r--r--nixpkgs/pkgs/development/libraries/libxnd/default.nix39
-rw-r--r--nixpkgs/pkgs/development/libraries/libxslt/default.nix66
-rw-r--r--nixpkgs/pkgs/development/libraries/libyaml-cpp/default.nix27
-rw-r--r--nixpkgs/pkgs/development/libraries/libyaml/default.nix35
-rw-r--r--nixpkgs/pkgs/development/libraries/libykclient/default.nix22
-rw-r--r--nixpkgs/pkgs/development/libraries/libykneomgr/default.nix24
-rw-r--r--nixpkgs/pkgs/development/libraries/libytnef/default.nix25
-rw-r--r--nixpkgs/pkgs/development/libraries/libyubikey/default.nix17
-rw-r--r--nixpkgs/pkgs/development/libraries/libzapojit/default.nix30
-rw-r--r--nixpkgs/pkgs/development/libraries/libzdb/default.nix24
-rw-r--r--nixpkgs/pkgs/development/libraries/libzen/default.nix27
-rw-r--r--nixpkgs/pkgs/development/libraries/libzip/default.nix41
-rw-r--r--nixpkgs/pkgs/development/libraries/libzmf/default.nix27
-rw-r--r--nixpkgs/pkgs/development/libraries/lief/default.nix14
-rw-r--r--nixpkgs/pkgs/development/libraries/lightning/default.nix32
-rw-r--r--nixpkgs/pkgs/development/libraries/lightstep-tracer-cpp/default.nix49
-rw-r--r--nixpkgs/pkgs/development/libraries/linbox/default.nix67
-rw-r--r--nixpkgs/pkgs/development/libraries/linenoise-ng/default.nix23
-rwxr-xr-xnixpkgs/pkgs/development/libraries/linenoise/create-pkg-config-file.sh13
-rw-r--r--nixpkgs/pkgs/development/libraries/linenoise/default.nix30
-rw-r--r--nixpkgs/pkgs/development/libraries/liquid-dsp/default.nix23
-rw-r--r--nixpkgs/pkgs/development/libraries/liquidfun/default.nix48
-rw-r--r--nixpkgs/pkgs/development/libraries/lirc/default.nix58
-rw-r--r--nixpkgs/pkgs/development/libraries/live555/default.nix62
-rw-r--r--nixpkgs/pkgs/development/libraries/lmdb/default.nix61
-rw-r--r--nixpkgs/pkgs/development/libraries/lmdb/hardcoded-compiler.patch26
-rw-r--r--nixpkgs/pkgs/development/libraries/lmdbxx/default.nix26
-rw-r--r--nixpkgs/pkgs/development/libraries/loadcaffe/default.nix19
-rw-r--r--nixpkgs/pkgs/development/libraries/log4cplus/default.nix20
-rw-r--r--nixpkgs/pkgs/development/libraries/log4cpp/default.nix19
-rw-r--r--nixpkgs/pkgs/development/libraries/log4cxx/default.nix42
-rw-r--r--nixpkgs/pkgs/development/libraries/log4cxx/narrowing-fixes.patch117
-rw-r--r--nixpkgs/pkgs/development/libraries/log4shib/default.nix21
-rw-r--r--nixpkgs/pkgs/development/libraries/loki/default.nix26
-rw-r--r--nixpkgs/pkgs/development/libraries/loudmouth/default.nix29
-rw-r--r--nixpkgs/pkgs/development/libraries/loudmouth/glib-2.32.patch13
-rw-r--r--nixpkgs/pkgs/development/libraries/luabind/0.9.1_boost_1.57_fix.patch23
-rw-r--r--nixpkgs/pkgs/development/libraries/luabind/0.9.1_discover_luajit.patch22
-rw-r--r--nixpkgs/pkgs/development/libraries/luabind/0.9.1_modern_boost_fix.patch59
-rw-r--r--nixpkgs/pkgs/development/libraries/luabind/default.nix31
-rw-r--r--nixpkgs/pkgs/development/libraries/luaffi/darwin.patch17
-rw-r--r--nixpkgs/pkgs/development/libraries/luaffi/default.nix31
-rw-r--r--nixpkgs/pkgs/development/libraries/luaffi/makefile-errors.patch13
-rw-r--r--nixpkgs/pkgs/development/libraries/lucene++/default.nix32
-rw-r--r--nixpkgs/pkgs/development/libraries/lzo/default.nix34
-rw-r--r--nixpkgs/pkgs/development/libraries/mac/default.nix36
-rw-r--r--nixpkgs/pkgs/development/libraries/mailcore2/default.nix59
-rw-r--r--nixpkgs/pkgs/development/libraries/mapnik/default.nix73
-rw-r--r--nixpkgs/pkgs/development/libraries/marisa/default.nix25
-rw-r--r--nixpkgs/pkgs/development/libraries/martyr/default.nix25
-rw-r--r--nixpkgs/pkgs/development/libraries/matio/default.nix16
-rw-r--r--nixpkgs/pkgs/development/libraries/mbedtls/1.3.nix34
-rw-r--r--nixpkgs/pkgs/development/libraries/mbedtls/default.nix39
-rw-r--r--nixpkgs/pkgs/development/libraries/mdds/default.nix26
-rw-r--r--nixpkgs/pkgs/development/libraries/mdds/default.upstream10
-rw-r--r--nixpkgs/pkgs/development/libraries/medfile/default.nix27
-rw-r--r--nixpkgs/pkgs/development/libraries/mediastreamer/default.nix46
-rw-r--r--nixpkgs/pkgs/development/libraries/mediastreamer/msopenh264.nix24
-rw-r--r--nixpkgs/pkgs/development/libraries/mediastreamer/plugins_dir.patch24
-rw-r--r--nixpkgs/pkgs/development/libraries/menu-cache/default.nix23
-rw-r--r--nixpkgs/pkgs/development/libraries/mesa-glu/default.nix28
-rw-r--r--nixpkgs/pkgs/development/libraries/mesa/default.nix375
-rw-r--r--nixpkgs/pkgs/development/libraries/mesa/disk_cache-include-dri-driver-path-in-cache-key.patch52
-rw-r--r--nixpkgs/pkgs/development/libraries/mesa/missing-includes.patch45
-rw-r--r--nixpkgs/pkgs/development/libraries/mesa/symlink-drivers.patch112
-rw-r--r--nixpkgs/pkgs/development/libraries/microsoft_gsl/default.nix40
-rw-r--r--nixpkgs/pkgs/development/libraries/mimetic/default.nix22
-rw-r--r--nixpkgs/pkgs/development/libraries/miniball/default.nix26
-rw-r--r--nixpkgs/pkgs/development/libraries/minixml/default.nix23
-rw-r--r--nixpkgs/pkgs/development/libraries/minizip/default.nix16
-rw-r--r--nixpkgs/pkgs/development/libraries/mlt/default.nix49
-rw-r--r--nixpkgs/pkgs/development/libraries/mlt/qt-5.nix67
-rw-r--r--nixpkgs/pkgs/development/libraries/mm-common/default.nix33
-rw-r--r--nixpkgs/pkgs/development/libraries/mongoc/default.nix26
-rw-r--r--nixpkgs/pkgs/development/libraries/mono-addins/default.nix32
-rw-r--r--nixpkgs/pkgs/development/libraries/mono-zeroconf/default.nix25
-rw-r--r--nixpkgs/pkgs/development/libraries/motif/Add-X.Org-to-bindings-file.patch7
-rw-r--r--nixpkgs/pkgs/development/libraries/motif/Remove-unsupported-weak-refs-on-darwin.patch12
-rw-r--r--nixpkgs/pkgs/development/libraries/motif/Use-correct-header-for-malloc.patch19
-rw-r--r--nixpkgs/pkgs/development/libraries/motif/default.nix51
-rw-r--r--nixpkgs/pkgs/development/libraries/movit/default.nix30
-rw-r--r--nixpkgs/pkgs/development/libraries/mp4v2/default.nix39
-rw-r--r--nixpkgs/pkgs/development/libraries/mpfi/default.nix22
-rw-r--r--nixpkgs/pkgs/development/libraries/mpfr/default.nix49
-rw-r--r--nixpkgs/pkgs/development/libraries/mpich/default.nix55
-rw-r--r--nixpkgs/pkgs/development/libraries/mpir/default.nix26
-rw-r--r--nixpkgs/pkgs/development/libraries/mps/default.nix29
-rw-r--r--nixpkgs/pkgs/development/libraries/msgpack/default.nix12
-rw-r--r--nixpkgs/pkgs/development/libraries/msgpack/generic.nix27
-rw-r--r--nixpkgs/pkgs/development/libraries/msgpuck/default.nix25
-rw-r--r--nixpkgs/pkgs/development/libraries/msilbc/default.nix24
-rw-r--r--nixpkgs/pkgs/development/libraries/mtdev/default.nix24
-rw-r--r--nixpkgs/pkgs/development/libraries/mtxclient/default.nix39
-rw-r--r--nixpkgs/pkgs/development/libraries/multipart-parser-c/default.nix34
-rw-r--r--nixpkgs/pkgs/development/libraries/muparser/default.nix21
-rw-r--r--nixpkgs/pkgs/development/libraries/mygui/default.nix31
-rw-r--r--nixpkgs/pkgs/development/libraries/mypaint-brushes/default.nix35
-rw-r--r--nixpkgs/pkgs/development/libraries/mysocketw/default.nix26
-rw-r--r--nixpkgs/pkgs/development/libraries/mysocketw/gcc.patch13
-rw-r--r--nixpkgs/pkgs/development/libraries/mythes/default.nix20
-rw-r--r--nixpkgs/pkgs/development/libraries/nanoflann/default.nix25
-rw-r--r--nixpkgs/pkgs/development/libraries/nanomsg/default.nix22
-rw-r--r--nixpkgs/pkgs/development/libraries/nco/default.nix22
-rw-r--r--nixpkgs/pkgs/development/libraries/ncurses/clang.patch42
-rw-r--r--nixpkgs/pkgs/development/libraries/ncurses/default.nix177
-rw-r--r--nixpkgs/pkgs/development/libraries/ndn-cxx/default.nix41
-rw-r--r--nixpkgs/pkgs/development/libraries/ndpi/default.nix30
-rw-r--r--nixpkgs/pkgs/development/libraries/neardal/default.nix31
-rw-r--r--nixpkgs/pkgs/development/libraries/neon/0.29.6-darwin-fix-configure.patch12
-rw-r--r--nixpkgs/pkgs/development/libraries/neon/0.29.nix49
-rw-r--r--nixpkgs/pkgs/development/libraries/neon/default.nix49
-rw-r--r--nixpkgs/pkgs/development/libraries/netcdf-cxx4/default.nix20
-rw-r--r--nixpkgs/pkgs/development/libraries/netcdf-fortran/default.nix21
-rw-r--r--nixpkgs/pkgs/development/libraries/netcdf/default.nix50
-rw-r--r--nixpkgs/pkgs/development/libraries/nettle/cygwin.patch12
-rw-r--r--nixpkgs/pkgs/development/libraries/nettle/default.nix10
-rw-r--r--nixpkgs/pkgs/development/libraries/nettle/generic.nix68
-rw-r--r--nixpkgs/pkgs/development/libraries/newt/default.nix38
-rw-r--r--nixpkgs/pkgs/development/libraries/nghttp2/default.nix54
-rw-r--r--nixpkgs/pkgs/development/libraries/nix-plugins/default.nix23
-rw-r--r--nixpkgs/pkgs/development/libraries/nlohmann_json/default.nix31
-rw-r--r--nixpkgs/pkgs/development/libraries/nlopt/default.nix37
-rw-r--r--nixpkgs/pkgs/development/libraries/notify-sharp/default.nix36
-rw-r--r--nixpkgs/pkgs/development/libraries/npapi-sdk/default.nix21
-rw-r--r--nixpkgs/pkgs/development/libraries/npth/default.nix28
-rw-r--r--nixpkgs/pkgs/development/libraries/nspr/0001-Makefile-use-SOURCE_DATE_EPOCH-for-reproducibility.patch84
-rw-r--r--nixpkgs/pkgs/development/libraries/nspr/default.nix51
-rw-r--r--nixpkgs/pkgs/development/libraries/nss/85_security_load.patch81
-rw-r--r--nixpkgs/pkgs/development/libraries/nss/ckpem.patch11
-rw-r--r--nixpkgs/pkgs/development/libraries/nss/default.nix139
-rw-r--r--nixpkgs/pkgs/development/libraries/nss_wrapper/default.nix20
-rw-r--r--nixpkgs/pkgs/development/libraries/nsss/default.nix33
-rw-r--r--nixpkgs/pkgs/development/libraries/ntbtls/default.nix30
-rw-r--r--nixpkgs/pkgs/development/libraries/ntdb/default.nix33
-rw-r--r--nixpkgs/pkgs/development/libraries/ntl/default.nix74
-rw-r--r--nixpkgs/pkgs/development/libraries/ntrack/default.nix37
-rw-r--r--nixpkgs/pkgs/development/libraries/ntrack/libnl-fix.patch11
-rw-r--r--nixpkgs/pkgs/development/libraries/nuspell/default.nix29
-rw-r--r--nixpkgs/pkgs/development/libraries/nuspell/wrapper.nix13
-rw-r--r--nixpkgs/pkgs/development/libraries/nv-codec-headers/default.nix22
-rw-r--r--nixpkgs/pkgs/development/libraries/nvidia-texture-tools/default.nix41
-rw-r--r--nixpkgs/pkgs/development/libraries/nvidia-video-sdk/default.nix27
-rw-r--r--nixpkgs/pkgs/development/libraries/ocl-icd/default.nix32
-rw-r--r--nixpkgs/pkgs/development/libraries/ode/default.nix18
-rw-r--r--nixpkgs/pkgs/development/libraries/odpic/default.nix40
-rw-r--r--nixpkgs/pkgs/development/libraries/ogre/1.10.x.nix42
-rw-r--r--nixpkgs/pkgs/development/libraries/ogre/1.9.x.nix46
-rw-r--r--nixpkgs/pkgs/development/libraries/ogre/default.nix46
-rw-r--r--nixpkgs/pkgs/development/libraries/ogrepaged/default.nix42
-rw-r--r--nixpkgs/pkgs/development/libraries/ois/default.nix41
-rw-r--r--nixpkgs/pkgs/development/libraries/olm/default.nix26
-rw-r--r--nixpkgs/pkgs/development/libraries/oniguruma/default.nix23
-rw-r--r--nixpkgs/pkgs/development/libraries/opae/default.nix44
-rw-r--r--nixpkgs/pkgs/development/libraries/opal/default.nix43
-rw-r--r--nixpkgs/pkgs/development/libraries/opal/disable-samples-ftbfs.diff14
-rw-r--r--nixpkgs/pkgs/development/libraries/opal/libav10.patch208
-rw-r--r--nixpkgs/pkgs/development/libraries/opal/libav9.patch543
-rw-r--r--nixpkgs/pkgs/development/libraries/openal-soft/default.nix41
-rw-r--r--nixpkgs/pkgs/development/libraries/openbabel/default.nix32
-rw-r--r--nixpkgs/pkgs/development/libraries/openbr/default.nix29
-rw-r--r--nixpkgs/pkgs/development/libraries/openbsm/bsm-add-audit_token_to_pid.patch24
-rw-r--r--nixpkgs/pkgs/development/libraries/openbsm/default.nix23
-rw-r--r--nixpkgs/pkgs/development/libraries/opencascade-occt/default.nix42
-rw-r--r--nixpkgs/pkgs/development/libraries/opencascade/default.nix51
-rw-r--r--nixpkgs/pkgs/development/libraries/opencl-clhpp/default.nix28
-rw-r--r--nixpkgs/pkgs/development/libraries/opencl-headers/default.nix26
-rw-r--r--nixpkgs/pkgs/development/libraries/opencollada/default.nix38
-rw-r--r--nixpkgs/pkgs/development/libraries/opencollada/pcre.patch14
-rw-r--r--nixpkgs/pkgs/development/libraries/opencolorio/default.nix47
-rw-r--r--nixpkgs/pkgs/development/libraries/opencore-amr/default.nix20
-rw-r--r--nixpkgs/pkgs/development/libraries/opencsg/default.nix52
-rw-r--r--nixpkgs/pkgs/development/libraries/opencsg/fix-pro-files.patch21
-rw-r--r--nixpkgs/pkgs/development/libraries/openct/default.nix41
-rw-r--r--nixpkgs/pkgs/development/libraries/opencv/3.x.nix278
-rw-r--r--nixpkgs/pkgs/development/libraries/opencv/4.x.nix293
-rw-r--r--nixpkgs/pkgs/development/libraries/opencv/default.nix94
-rw-r--r--nixpkgs/pkgs/development/libraries/opencv/no-build-info.patch14
-rw-r--r--nixpkgs/pkgs/development/libraries/opendbx/default.nix24
-rw-r--r--nixpkgs/pkgs/development/libraries/opendht/default.nix39
-rw-r--r--nixpkgs/pkgs/development/libraries/opendkim/default.nix35
-rw-r--r--nixpkgs/pkgs/development/libraries/openexr/bootstrap.patch15
-rw-r--r--nixpkgs/pkgs/development/libraries/openexr/default.nix55
-rw-r--r--nixpkgs/pkgs/development/libraries/openexrid-unstable/default.nix55
-rw-r--r--nixpkgs/pkgs/development/libraries/openexrid-unstable/openexrid.patch35
-rw-r--r--nixpkgs/pkgs/development/libraries/openfst/default.nix25
-rw-r--r--nixpkgs/pkgs/development/libraries/openfx/default.nix38
-rw-r--r--nixpkgs/pkgs/development/libraries/openh264/default.nix26
-rw-r--r--nixpkgs/pkgs/development/libraries/openhmd/default.nix54
-rw-r--r--nixpkgs/pkgs/development/libraries/openjpeg/1.x.nix8
-rw-r--r--nixpkgs/pkgs/development/libraries/openjpeg/2.x.nix17
-rw-r--r--nixpkgs/pkgs/development/libraries/openjpeg/fix-cmake-config-includedir.patch55
-rw-r--r--nixpkgs/pkgs/development/libraries/openjpeg/generic.nix76
-rw-r--r--nixpkgs/pkgs/development/libraries/openldap/default.nix67
-rw-r--r--nixpkgs/pkgs/development/libraries/openmpi/default.nix54
-rw-r--r--nixpkgs/pkgs/development/libraries/openpa/default.nix34
-rw-r--r--nixpkgs/pkgs/development/libraries/openpam/default.nix19
-rw-r--r--nixpkgs/pkgs/development/libraries/opensaml-cpp/default.nix27
-rw-r--r--nixpkgs/pkgs/development/libraries/openscenegraph/3.4.0.nix39
-rw-r--r--nixpkgs/pkgs/development/libraries/openscenegraph/default.nix78
-rw-r--r--nixpkgs/pkgs/development/libraries/openslp/CVE-2016-4912.patch11
-rw-r--r--nixpkgs/pkgs/development/libraries/openslp/default.nix33
-rw-r--r--nixpkgs/pkgs/development/libraries/openssl/1.0.2/nix-ssl-cert-file.patch16
-rw-r--r--nixpkgs/pkgs/development/libraries/openssl/1.0.2/use-etc-ssl-certs-darwin.patch13
-rw-r--r--nixpkgs/pkgs/development/libraries/openssl/1.0.2/use-etc-ssl-certs.patch13
-rw-r--r--nixpkgs/pkgs/development/libraries/openssl/1.1/nix-ssl-cert-file.patch15
-rw-r--r--nixpkgs/pkgs/development/libraries/openssl/1.1/use-etc-ssl-certs-darwin.patch13
-rw-r--r--nixpkgs/pkgs/development/libraries/openssl/1.1/use-etc-ssl-certs.patch13
-rw-r--r--nixpkgs/pkgs/development/libraries/openssl/chacha.nix82
-rw-r--r--nixpkgs/pkgs/development/libraries/openssl/default.nix147
-rw-r--r--nixpkgs/pkgs/development/libraries/opensubdiv/default.nix54
-rw-r--r--nixpkgs/pkgs/development/libraries/opentracing-cpp/default.nix20
-rw-r--r--nixpkgs/pkgs/development/libraries/openvdb/default.nix49
-rw-r--r--nixpkgs/pkgs/development/libraries/openwsman/default.nix40
-rw-r--r--nixpkgs/pkgs/development/libraries/openzwave/default.nix60
-rw-r--r--nixpkgs/pkgs/development/libraries/oracle-instantclient/default.nix83
-rw-r--r--nixpkgs/pkgs/development/libraries/ortp/default.nix24
-rw-r--r--nixpkgs/pkgs/development/libraries/osip/default.nix18
-rw-r--r--nixpkgs/pkgs/development/libraries/osip/default.upstream3
-rw-r--r--nixpkgs/pkgs/development/libraries/osm-gps-map/default.nix28
-rw-r--r--nixpkgs/pkgs/development/libraries/p11-kit/default.nix62
-rw-r--r--nixpkgs/pkgs/development/libraries/pagmo2/default.nix44
-rw-r--r--nixpkgs/pkgs/development/libraries/pango/default.nix83
-rw-r--r--nixpkgs/pkgs/development/libraries/pangolin/default.nix57
-rw-r--r--nixpkgs/pkgs/development/libraries/pangomm/default.nix43
-rw-r--r--nixpkgs/pkgs/development/libraries/pangox-compat/default.nix21
-rw-r--r--nixpkgs/pkgs/development/libraries/pangoxsl/default.nix22
-rw-r--r--nixpkgs/pkgs/development/libraries/parquet-cpp/api.patch12
-rw-r--r--nixpkgs/pkgs/development/libraries/partio/default.nix45
-rw-r--r--nixpkgs/pkgs/development/libraries/pcaudiolib/default.nix30
-rw-r--r--nixpkgs/pkgs/development/libraries/pcg-c/default.nix39
-rw-r--r--nixpkgs/pkgs/development/libraries/pcg-c/prefix-variable.patch15
-rw-r--r--nixpkgs/pkgs/development/libraries/pcl/default.nix34
-rw-r--r--nixpkgs/pkgs/development/libraries/pcre/default.nix67
-rw-r--r--nixpkgs/pkgs/development/libraries/pcre/stacksize-detection.patch16
-rw-r--r--nixpkgs/pkgs/development/libraries/pcre2/default.nix32
-rw-r--r--nixpkgs/pkgs/development/libraries/pdf2xml/default.nix38
-rw-r--r--nixpkgs/pkgs/development/libraries/pdf2xml/pdf2xml.patch48
-rw-r--r--nixpkgs/pkgs/development/libraries/phash/default.nix38
-rw-r--r--nixpkgs/pkgs/development/libraries/phonon/backends/gst-plugin-paths.patch13
-rw-r--r--nixpkgs/pkgs/development/libraries/phonon/backends/gstreamer.nix68
-rw-r--r--nixpkgs/pkgs/development/libraries/phonon/backends/vlc.nix42
-rw-r--r--nixpkgs/pkgs/development/libraries/phonon/default.nix79
-rw-r--r--nixpkgs/pkgs/development/libraries/physfs/default.nix41
-rw-r--r--nixpkgs/pkgs/development/libraries/physics/apfel/default.nix25
-rw-r--r--nixpkgs/pkgs/development/libraries/physics/apfelgrid/default.nix26
-rw-r--r--nixpkgs/pkgs/development/libraries/physics/applgrid/bad_code.patch50
-rw-r--r--nixpkgs/pkgs/development/libraries/physics/applgrid/default.nix42
-rw-r--r--nixpkgs/pkgs/development/libraries/physics/cernlib/default.nix66
-rw-r--r--nixpkgs/pkgs/development/libraries/physics/cernlib/patch186
-rw-r--r--nixpkgs/pkgs/development/libraries/physics/cernlib/setup-hook.sh3
-rw-r--r--nixpkgs/pkgs/development/libraries/physics/fastjet/default.nix28
-rw-r--r--nixpkgs/pkgs/development/libraries/physics/fastnlo/default.nix33
-rw-r--r--nixpkgs/pkgs/development/libraries/physics/geant4/datasets-hook.sh5
-rw-r--r--nixpkgs/pkgs/development/libraries/physics/geant4/datasets.nix103
-rw-r--r--nixpkgs/pkgs/development/libraries/physics/geant4/default.nix101
-rw-r--r--nixpkgs/pkgs/development/libraries/physics/geant4/g4py/default.nix63
-rw-r--r--nixpkgs/pkgs/development/libraries/physics/geant4/g4py/setup-hook.sh1
-rw-r--r--nixpkgs/pkgs/development/libraries/physics/geant4/geant4-hook.sh1
-rw-r--r--nixpkgs/pkgs/development/libraries/physics/hepmc/default.nix29
-rw-r--r--nixpkgs/pkgs/development/libraries/physics/hepmc/in_source.patch25
-rw-r--r--nixpkgs/pkgs/development/libraries/physics/hepmc3/default.nix28
-rw-r--r--nixpkgs/pkgs/development/libraries/physics/herwig/default.nix36
-rw-r--r--nixpkgs/pkgs/development/libraries/physics/hoppet/default.nix28
-rw-r--r--nixpkgs/pkgs/development/libraries/physics/lhapdf/default.nix32
-rwxr-xr-xnixpkgs/pkgs/development/libraries/physics/lhapdf/maintainer.sh11
-rw-r--r--nixpkgs/pkgs/development/libraries/physics/lhapdf/pdf_sets.nix833
-rw-r--r--nixpkgs/pkgs/development/libraries/physics/lhapdf/pdfset-hook.sh5
-rw-r--r--nixpkgs/pkgs/development/libraries/physics/mcgrid/default.nix30
-rw-r--r--nixpkgs/pkgs/development/libraries/physics/mela/default.nix25
-rw-r--r--nixpkgs/pkgs/development/libraries/physics/nlojet/default.nix23
-rw-r--r--nixpkgs/pkgs/development/libraries/physics/nlojet/nlojet_clang_fix.patch30
-rw-r--r--nixpkgs/pkgs/development/libraries/physics/pythia/default.nix33
-rw-r--r--nixpkgs/pkgs/development/libraries/physics/qcdnum/default.nix23
-rw-r--r--nixpkgs/pkgs/development/libraries/physics/rivet/darwin.patch33
-rw-r--r--nixpkgs/pkgs/development/libraries/physics/rivet/default.nix80
-rw-r--r--nixpkgs/pkgs/development/libraries/physics/thepeg/default.nix29
-rw-r--r--nixpkgs/pkgs/development/libraries/physics/yoda/default.nix35
-rw-r--r--nixpkgs/pkgs/development/libraries/pipewire/default.nix49
-rw-r--r--nixpkgs/pkgs/development/libraries/pixman/default.nix28
-rw-r--r--nixpkgs/pkgs/development/libraries/pkcs11helper/default.nix25
-rw-r--r--nixpkgs/pkgs/development/libraries/plib/default.nix50
-rw-r--r--nixpkgs/pkgs/development/libraries/pmdk/default.nix40
-rw-r--r--nixpkgs/pkgs/development/libraries/png++/default.nix45
-rw-r--r--nixpkgs/pkgs/development/libraries/pocketsphinx/default.nix47
-rw-r--r--nixpkgs/pkgs/development/libraries/poco/default.nix33
-rw-r--r--nixpkgs/pkgs/development/libraries/podofo/default.nix47
-rw-r--r--nixpkgs/pkgs/development/libraries/polkit-qt-1/qt-4.nix34
-rw-r--r--nixpkgs/pkgs/development/libraries/polkit-qt-1/qt-5.nix30
-rw-r--r--nixpkgs/pkgs/development/libraries/polkit/default.nix91
-rw-r--r--nixpkgs/pkgs/development/libraries/polkit/system_bus.conf58
-rw-r--r--nixpkgs/pkgs/development/libraries/poppler/0.61.nix67
-rw-r--r--nixpkgs/pkgs/development/libraries/poppler/default.nix64
-rw-r--r--nixpkgs/pkgs/development/libraries/popt/1.16-cygwin.patch11
-rw-r--r--nixpkgs/pkgs/development/libraries/popt/1.16-vpath.patch34
-rw-r--r--nixpkgs/pkgs/development/libraries/popt/default.nix23
-rw-r--r--nixpkgs/pkgs/development/libraries/portaudio/default.nix52
-rw-r--r--nixpkgs/pkgs/development/libraries/portmidi/default.nix57
-rw-r--r--nixpkgs/pkgs/development/libraries/ppl/default.nix60
-rw-r--r--nixpkgs/pkgs/development/libraries/prison/default.nix22
-rw-r--r--nixpkgs/pkgs/development/libraries/proj/default.nix20
-rw-r--r--nixpkgs/pkgs/development/libraries/prometheus-cpp/default.nix41
-rw-r--r--nixpkgs/pkgs/development/libraries/properties-cpp/default.nix27
-rw-r--r--nixpkgs/pkgs/development/libraries/protobuf/2.5.nix10
-rw-r--r--nixpkgs/pkgs/development/libraries/protobuf/3.1.nix6
-rw-r--r--nixpkgs/pkgs/development/libraries/protobuf/3.4.nix6
-rw-r--r--nixpkgs/pkgs/development/libraries/protobuf/3.5.nix6
-rw-r--r--nixpkgs/pkgs/development/libraries/protobuf/3.6.nix6
-rw-r--r--nixpkgs/pkgs/development/libraries/protobuf/3.7.nix6
-rw-r--r--nixpkgs/pkgs/development/libraries/protobuf/generic-v3.nix63
-rw-r--r--nixpkgs/pkgs/development/libraries/protobuf/generic.nix60
-rw-r--r--nixpkgs/pkgs/development/libraries/protobufc/1.3.nix12
-rw-r--r--nixpkgs/pkgs/development/libraries/protobufc/generic.nix20
-rw-r--r--nixpkgs/pkgs/development/libraries/prototypejs/default.nix23
-rw-r--r--nixpkgs/pkgs/development/libraries/protozero/default.nix22
-rw-r--r--nixpkgs/pkgs/development/libraries/psol/default.nix5
-rw-r--r--nixpkgs/pkgs/development/libraries/psol/generic.nix16
-rw-r--r--nixpkgs/pkgs/development/libraries/psqlodbc/default.nix21
-rw-r--r--nixpkgs/pkgs/development/libraries/ptex/default.nix43
-rw-r--r--nixpkgs/pkgs/development/libraries/pth/default.nix22
-rw-r--r--nixpkgs/pkgs/development/libraries/ptlib/default.nix54
-rw-r--r--nixpkgs/pkgs/development/libraries/ptlib/ptlib-2.10.11-glibc-2.26.patch13
-rw-r--r--nixpkgs/pkgs/development/libraries/pugixml/default.nix38
-rw-r--r--nixpkgs/pkgs/development/libraries/pupnp/default.nix34
-rw-r--r--nixpkgs/pkgs/development/libraries/pybind11/default.nix47
-rw-r--r--nixpkgs/pkgs/development/libraries/pybind11/no_test_cmake_build.patch7
-rw-r--r--nixpkgs/pkgs/development/libraries/pyotherside/default.nix29
-rw-r--r--nixpkgs/pkgs/development/libraries/pyotherside/qml-path.patch12
-rw-r--r--nixpkgs/pkgs/development/libraries/python-qt/default.nix42
-rw-r--r--nixpkgs/pkgs/development/libraries/qca-qt5/default.nix32
-rw-r--r--nixpkgs/pkgs/development/libraries/qca-qt5/move-project.patch17
-rw-r--r--nixpkgs/pkgs/development/libraries/qca2/default.nix37
-rw-r--r--nixpkgs/pkgs/development/libraries/qca2/libressl.patch28
-rw-r--r--nixpkgs/pkgs/development/libraries/qgnomeplatform/default.nix37
-rw-r--r--nixpkgs/pkgs/development/libraries/qhull/default.nix22
-rw-r--r--nixpkgs/pkgs/development/libraries/qimageblitz/default.nix26
-rw-r--r--nixpkgs/pkgs/development/libraries/qimageblitz/qimageblitz-9999-exec-stack.patch11
-rw-r--r--nixpkgs/pkgs/development/libraries/qjson/default.nix22
-rw-r--r--nixpkgs/pkgs/development/libraries/qmlbox2d/default.nix31
-rw-r--r--nixpkgs/pkgs/development/libraries/qmltermwidget/default.nix34
-rw-r--r--nixpkgs/pkgs/development/libraries/qoauth/default.nix29
-rw-r--r--nixpkgs/pkgs/development/libraries/qpdf/default.nix35
-rw-r--r--nixpkgs/pkgs/development/libraries/qrencode/default.nix47
-rw-r--r--nixpkgs/pkgs/development/libraries/qrupdate/default.nix43
-rw-r--r--nixpkgs/pkgs/development/libraries/qscintilla/default.nix72
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-3/builder.sh38
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-3/default.nix91
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-3/qt-pwd.patch15
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-3/qt3-gcc4.6.0.patch23
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-3/setup-hook.sh1
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-3/strip.patch18
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-3/xrandr.patch42
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-4.x/4.8/clang-5-darwin.patch13
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-4.x/4.8/default.nix235
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-4.x/4.8/dlopen-absolute-paths.diff74
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-4.x/4.8/dlopen-gtkstyle.diff37
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-4.x/4.8/dlopen-webkit-nsplugin.diff52
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-4.x/4.8/glib-2.32.patch12
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-4.x/4.8/kill-legacy-darwin-apis.patch330
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-4.x/4.8/libressl.patch64
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-4.x/4.8/parallel-configure.patch22
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-4.x/4.8/patch-qthread-stacksize.diff54
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-4.x/4.8/qmake-hook.sh16
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-4.x/4.8/qsettings-recursive-global-mutex.patch17
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-4.x/4.8/qt-4.8.7-unixmake-darwin.patch11
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-4.x/4.8/qt-musl-iconv-no-bom.patch11
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-4.x/4.8/qt-musl.patch14
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.11/default.nix153
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.11/fetch.sh1
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.11/qtbase-fixguicmake.patch30
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.11/qtbase.patch1106
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.11/qtdeclarative.patch46
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.11/qtscript.patch13
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.11/qtserialport.patch22
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.11/qttools.patch71
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.11/qtwebengine-darwin-no-platform-check.patch37
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.11/qtwebengine-no-build-skip.patch12
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.11/qtwebkit.patch12
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.11/srcs.nix325
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.12/default.nix157
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.12/fetch.sh1
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.12/qtbase-fixguicmake.patch30
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.12/qtbase.patch1096
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.12/qtdeclarative.patch33
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.12/qtscript.patch13
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.12/qtserialport.patch22
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.12/qtwebengine-CVE-2019-5786.patch26
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.12/qtwebengine-darwin-no-platform-check.patch21
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.12/qtwebengine-no-build-skip.patch12
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.12/qtwebkit-darwin-no-qos-classes.patch11
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.12/qtwebkit-darwin-no-readline.patch45
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.12/qtwebkit.patch12
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.12/srcs.nix325
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.6/default.nix183
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.6/fetch.sh2
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.6/qtbase-fixguicmake.patch30
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.6/qtbase.patch795
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.6/qtdeclarative.patch20
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.6/qtscript.patch13
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.6/qtserialport.patch22
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.6/qttools.patch64
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.6/qtwebengine-seccomp.patch24
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.6/qtwebkit.patch149
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.6/srcs.nix309
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.9/default.nix152
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.9/fetch.sh1
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.9/qtbase-fixguicmake.patch30
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.9/qtbase.patch1141
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.9/qtdeclarative.patch33
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.9/qtscript.patch13
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.9/qtserialport.patch22
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.9/qttools.patch71
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.9/qtwebengine-clang-fix.patch38
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.9/qtwebengine-darwin-no-platform-check.patch50
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.9/qtwebengine-no-build-skip.patch12
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.9/qtwebkit.patch64
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.9/srcs.nix333
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/README.md81
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/hooks/fix-qt-builtin-paths.sh64
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/hooks/fix-qt-module-paths.sh36
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/hooks/move-qt-dev-tools.sh34
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/hooks/qmake-hook.sh23
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/hooks/qtbase-setup-hook.sh64
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/hooks/qttools-setup-hook.sh1
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/mkDerivation.nix30
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/modules/qtbase.nix384
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/modules/qtcharts.nix7
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/modules/qtconnectivity.nix8
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/modules/qtdeclarative.nix26
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/modules/qtdoc.nix7
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/modules/qtgraphicaleffects.nix7
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/modules/qtimageformats.nix6
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/modules/qtlocation.nix14
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/modules/qtmacextras.nix12
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/modules/qtmultimedia.nix16
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/modules/qtnetworkauth.nix6
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/modules/qtquickcontrols.nix6
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/modules/qtquickcontrols2.nix7
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/modules/qtscript.nix6
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/modules/qtsensors.nix7
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/modules/qtserialport.nix11
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/modules/qtspeech.nix7
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/modules/qtsvg.nix7
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/modules/qttools.nix36
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/modules/qttranslations.nix6
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/modules/qtvirtualkeyboard.nix6
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/modules/qtwayland.nix9
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/modules/qtwebchannel.nix8
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/modules/qtwebengine.nix233
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/modules/qtwebglplugin.nix6
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/modules/qtwebkit.nix72
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/modules/qtwebsockets.nix7
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/modules/qtwebview.nix20
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/modules/qtx11extras.nix6
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/modules/qtxmlpatterns.nix7
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/qt-env.nix21
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/qtModule.nix59
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-mobility/default.nix54
-rw-r--r--nixpkgs/pkgs/development/libraries/qtinstaller/default.nix46
-rw-r--r--nixpkgs/pkgs/development/libraries/qtkeychain/0001-Fixes-build-with-Qt4.patch25
-rw-r--r--nixpkgs/pkgs/development/libraries/qtkeychain/default.nix43
-rw-r--r--nixpkgs/pkgs/development/libraries/qtscriptgenerator/default.nix48
-rw-r--r--nixpkgs/pkgs/development/libraries/qtscriptgenerator/qt-4.8.patch23
-rw-r--r--nixpkgs/pkgs/development/libraries/qtscriptgenerator/qtscriptgenerator.gcc-4.4.patch11
-rw-r--r--nixpkgs/pkgs/development/libraries/qtstyleplugin-kvantum-qt4/default.nix38
-rw-r--r--nixpkgs/pkgs/development/libraries/qtstyleplugin-kvantum/default.nix32
-rw-r--r--nixpkgs/pkgs/development/libraries/qtstyleplugins/default.nix23
-rw-r--r--nixpkgs/pkgs/development/libraries/qtwebkit-plugins/default.nix29
-rw-r--r--nixpkgs/pkgs/development/libraries/quazip/default.nix24
-rw-r--r--nixpkgs/pkgs/development/libraries/quesoglc/default.nix25
-rw-r--r--nixpkgs/pkgs/development/libraries/quickder/default.nix59
-rw-r--r--nixpkgs/pkgs/development/libraries/qwt/6.nix29
-rw-r--r--nixpkgs/pkgs/development/libraries/qwt/6_qt4.nix41
-rw-r--r--nixpkgs/pkgs/development/libraries/qwt/default.nix31
-rw-r--r--nixpkgs/pkgs/development/libraries/qxt/default.nix34
-rw-r--r--nixpkgs/pkgs/development/libraries/rabbitmq-c/default.nix22
-rw-r--r--nixpkgs/pkgs/development/libraries/rabbitmq-java-client/default.nix30
-rw-r--r--nixpkgs/pkgs/development/libraries/range-v3/default.nix28
-rw-r--r--nixpkgs/pkgs/development/libraries/rapidcheck/default.nix27
-rw-r--r--nixpkgs/pkgs/development/libraries/rapidjson/default.nix28
-rw-r--r--nixpkgs/pkgs/development/libraries/rapidxml/default.nix27
-rw-r--r--nixpkgs/pkgs/development/libraries/rarian/default.nix32
-rw-r--r--nixpkgs/pkgs/development/libraries/rdkafka/default.nix30
-rw-r--r--nixpkgs/pkgs/development/libraries/re2/default.nix33
-rw-r--r--nixpkgs/pkgs/development/libraries/readline/5.x.nix20
-rw-r--r--nixpkgs/pkgs/development/libraries/readline/6.2.nix63
-rw-r--r--nixpkgs/pkgs/development/libraries/readline/6.3.nix68
-rw-r--r--nixpkgs/pkgs/development/libraries/readline/7.0.nix66
-rw-r--r--nixpkgs/pkgs/development/libraries/readline/8.0.nix66
-rw-r--r--nixpkgs/pkgs/development/libraries/readline/android.patch16
-rw-r--r--nixpkgs/pkgs/development/libraries/readline/clang.patch13
-rw-r--r--nixpkgs/pkgs/development/libraries/readline/link-against-ncurses.patch18
-rw-r--r--nixpkgs/pkgs/development/libraries/readline/no-arch_only-6.3.patch13
-rw-r--r--nixpkgs/pkgs/development/libraries/readline/no-arch_only.patch14
-rw-r--r--nixpkgs/pkgs/development/libraries/readline/readline-6.2-patches.nix9
-rw-r--r--nixpkgs/pkgs/development/libraries/readline/readline-6.3-patches.nix12
-rw-r--r--nixpkgs/pkgs/development/libraries/readline/readline-7.0-patches.nix9
-rw-r--r--nixpkgs/pkgs/development/libraries/readline/readline-8.0-patches.nix4
-rw-r--r--nixpkgs/pkgs/development/libraries/readline/shobj-darwin.patch11
-rw-r--r--nixpkgs/pkgs/development/libraries/readosm/default.nix23
-rw-r--r--nixpkgs/pkgs/development/libraries/rep-gtk/default.nix30
-rw-r--r--nixpkgs/pkgs/development/libraries/rep-gtk/setup-hook.sh5
-rw-r--r--nixpkgs/pkgs/development/libraries/resolv_wrapper/default.nix19
-rw-r--r--nixpkgs/pkgs/development/libraries/rlog/default.nix17
-rw-r--r--nixpkgs/pkgs/development/libraries/robin-map/default.nix26
-rw-r--r--nixpkgs/pkgs/development/libraries/rocksdb/default.nix86
-rw-r--r--nixpkgs/pkgs/development/libraries/rote/default.nix30
-rw-r--r--nixpkgs/pkgs/development/libraries/rttr/default.nix31
-rw-r--r--nixpkgs/pkgs/development/libraries/rubberband/default.nix23
-rw-r--r--nixpkgs/pkgs/development/libraries/safefile/default.nix31
-rw-r--r--nixpkgs/pkgs/development/libraries/sbc/default.nix20
-rw-r--r--nixpkgs/pkgs/development/libraries/sblim-sfcc/default.nix28
-rw-r--r--nixpkgs/pkgs/development/libraries/schroedinger/default.nix35
-rw-r--r--nixpkgs/pkgs/development/libraries/science/benchmark/papi/default.nix30
-rw-r--r--nixpkgs/pkgs/development/libraries/science/biology/EBTKS/default.nix26
-rw-r--r--nixpkgs/pkgs/development/libraries/science/biology/bicgl/default.nix28
-rw-r--r--nixpkgs/pkgs/development/libraries/science/biology/bicpl/default.nix32
-rw-r--r--nixpkgs/pkgs/development/libraries/science/biology/elastix/default.nix23
-rw-r--r--nixpkgs/pkgs/development/libraries/science/biology/htslib/default.nix37
-rw-r--r--nixpkgs/pkgs/development/libraries/science/biology/mirtk/default.nix42
-rw-r--r--nixpkgs/pkgs/development/libraries/science/biology/nifticlib/default.nix25
-rw-r--r--nixpkgs/pkgs/development/libraries/science/biology/oobicpl/default.nix31
-rw-r--r--nixpkgs/pkgs/development/libraries/science/math/QuadProgpp/default.nix27
-rw-r--r--nixpkgs/pkgs/development/libraries/science/math/arpack/default.nix56
-rw-r--r--nixpkgs/pkgs/development/libraries/science/math/blas/default.nix68
-rw-r--r--nixpkgs/pkgs/development/libraries/science/math/brial/default.nix46
-rw-r--r--nixpkgs/pkgs/development/libraries/science/math/caffe2/default.nix144
-rw-r--r--nixpkgs/pkgs/development/libraries/science/math/caffe2/fix_compilation_on_gcc7.patch46
-rw-r--r--nixpkgs/pkgs/development/libraries/science/math/caffe2/update_clang_cvtsh_bugfix.patch55
-rw-r--r--nixpkgs/pkgs/development/libraries/science/math/cholmod-extra/default.nix41
-rw-r--r--nixpkgs/pkgs/development/libraries/science/math/clblas/default.nix69
-rw-r--r--nixpkgs/pkgs/development/libraries/science/math/clblas/platform.patch34
-rw-r--r--nixpkgs/pkgs/development/libraries/science/math/cliquer/default.nix38
-rw-r--r--nixpkgs/pkgs/development/libraries/science/math/cudnn/default.nix69
-rw-r--r--nixpkgs/pkgs/development/libraries/science/math/cudnn/generic.nix59
-rw-r--r--nixpkgs/pkgs/development/libraries/science/math/ecos/default.nix37
-rw-r--r--nixpkgs/pkgs/development/libraries/science/math/fenics/default.nix169
-rw-r--r--nixpkgs/pkgs/development/libraries/science/math/fenics/unicode.patch67
-rw-r--r--nixpkgs/pkgs/development/libraries/science/math/flintqs/default.nix40
-rw-r--r--nixpkgs/pkgs/development/libraries/science/math/ipopt/default.nix32
-rw-r--r--nixpkgs/pkgs/development/libraries/science/math/lcalc/default.nix98
-rw-r--r--nixpkgs/pkgs/development/libraries/science/math/lcalc/makefile.patch113
-rw-r--r--nixpkgs/pkgs/development/libraries/science/math/libbraiding/default.nix34
-rw-r--r--nixpkgs/pkgs/development/libraries/science/math/libhomfly/default.nix35
-rw-r--r--nixpkgs/pkgs/development/libraries/science/math/liblapack/default.nix42
-rw-r--r--nixpkgs/pkgs/development/libraries/science/math/liblbfgs/default.nix17
-rw-r--r--nixpkgs/pkgs/development/libraries/science/math/lrs/default.nix27
-rw-r--r--nixpkgs/pkgs/development/libraries/science/math/m4ri/default.nix30
-rw-r--r--nixpkgs/pkgs/development/libraries/science/math/m4rie/default.nix39
-rw-r--r--nixpkgs/pkgs/development/libraries/science/math/magma/default.nix46
-rw-r--r--nixpkgs/pkgs/development/libraries/science/math/metis/default.nix20
-rw-r--r--nixpkgs/pkgs/development/libraries/science/math/mkl/default.nix96
-rw-r--r--nixpkgs/pkgs/development/libraries/science/math/nccl/default.nix48
-rw-r--r--nixpkgs/pkgs/development/libraries/science/math/openblas/default.nix170
-rw-r--r--nixpkgs/pkgs/development/libraries/science/math/openlibm/default.nix20
-rw-r--r--nixpkgs/pkgs/development/libraries/science/math/openspecfun/default.nix21
-rw-r--r--nixpkgs/pkgs/development/libraries/science/math/or-tools/default.nix70
-rw-r--r--nixpkgs/pkgs/development/libraries/science/math/parmetis/default.nix33
-rw-r--r--nixpkgs/pkgs/development/libraries/science/math/petsc/default.nix50
-rw-r--r--nixpkgs/pkgs/development/libraries/science/math/planarity/default.nix40
-rw-r--r--nixpkgs/pkgs/development/libraries/science/math/primesieve/default.nix21
-rw-r--r--nixpkgs/pkgs/development/libraries/science/math/rankwidth/default.nix28
-rw-r--r--nixpkgs/pkgs/development/libraries/science/math/rubiks/default.nix82
-rw-r--r--nixpkgs/pkgs/development/libraries/science/math/scalapack/default.nix55
-rw-r--r--nixpkgs/pkgs/development/libraries/science/math/scalapack/openmpi4.patch143
-rw-r--r--nixpkgs/pkgs/development/libraries/science/math/scs/default.nix50
-rw-r--r--nixpkgs/pkgs/development/libraries/science/math/suitesparse/4.2.nix43
-rw-r--r--nixpkgs/pkgs/development/libraries/science/math/suitesparse/4.4.nix100
-rw-r--r--nixpkgs/pkgs/development/libraries/science/math/suitesparse/default.nix138
-rw-r--r--nixpkgs/pkgs/development/libraries/science/math/superlu/add-superlu-lib-as-dependency-for-the-unit-tests.patch7
-rw-r--r--nixpkgs/pkgs/development/libraries/science/math/superlu/default.nix36
-rw-r--r--nixpkgs/pkgs/development/libraries/science/math/superlu/find-openblas-library.patch11
-rw-r--r--nixpkgs/pkgs/development/libraries/science/math/sympow/default.nix89
-rw-r--r--nixpkgs/pkgs/development/libraries/science/math/zn_poly/default.nix75
-rw-r--r--nixpkgs/pkgs/development/libraries/science/networking/ns3/default.nix96
-rw-r--r--nixpkgs/pkgs/development/libraries/science/robotics/ispike/default.nix24
-rw-r--r--nixpkgs/pkgs/development/libraries/scmccid/default.nix40
-rw-r--r--nixpkgs/pkgs/development/libraries/scriptaculous/default.nix30
-rw-r--r--nixpkgs/pkgs/development/libraries/sdformat/3.nix7
-rw-r--r--nixpkgs/pkgs/development/libraries/sdformat/default.nix29
-rw-r--r--nixpkgs/pkgs/development/libraries/seasocks/default.nix24
-rw-r--r--nixpkgs/pkgs/development/libraries/serd/default.nix21
-rw-r--r--nixpkgs/pkgs/development/libraries/serf/default.nix38
-rw-r--r--nixpkgs/pkgs/development/libraries/serf/scons.patch12
-rw-r--r--nixpkgs/pkgs/development/libraries/sfml/default.nix44
-rw-r--r--nixpkgs/pkgs/development/libraries/sfsexp/default.nix19
-rw-r--r--nixpkgs/pkgs/development/libraries/shapelib/default.nix17
-rw-r--r--nixpkgs/pkgs/development/libraries/shhmsg/default.nix20
-rw-r--r--nixpkgs/pkgs/development/libraries/shhopt/default.nix19
-rw-r--r--nixpkgs/pkgs/development/libraries/shibboleth-sp/default.nix32
-rw-r--r--nixpkgs/pkgs/development/libraries/silgraphite/default.nix22
-rw-r--r--nixpkgs/pkgs/development/libraries/silgraphite/graphite2.nix27
-rw-r--r--nixpkgs/pkgs/development/libraries/silgraphite/macosx.patch13
-rw-r--r--nixpkgs/pkgs/development/libraries/simgear/default.nix30
-rw-r--r--nixpkgs/pkgs/development/libraries/simpleitk/default.nix27
-rw-r--r--nixpkgs/pkgs/development/libraries/skalibs/default.nix30
-rw-r--r--nixpkgs/pkgs/development/libraries/slang/default.nix50
-rw-r--r--nixpkgs/pkgs/development/libraries/slang/terminfo-dirs.patch172
-rw-r--r--nixpkgs/pkgs/development/libraries/slib/catalog-in-library-vicinity.patch29
-rw-r--r--nixpkgs/pkgs/development/libraries/slib/default.nix52
-rw-r--r--nixpkgs/pkgs/development/libraries/slib/setup-hook.sh13
-rw-r--r--nixpkgs/pkgs/development/libraries/smarty3-i18n/default.nix24
-rw-r--r--nixpkgs/pkgs/development/libraries/smarty3/default.nix29
-rw-r--r--nixpkgs/pkgs/development/libraries/smesh/default.nix24
-rw-r--r--nixpkgs/pkgs/development/libraries/smpeg/default.nix50
-rw-r--r--nixpkgs/pkgs/development/libraries/smpeg/format.patch11
-rw-r--r--nixpkgs/pkgs/development/libraries/smpeg/gcc6.patch33
-rw-r--r--nixpkgs/pkgs/development/libraries/smpeg2/default.nix44
-rw-r--r--nixpkgs/pkgs/development/libraries/smpeg2/gcc6.patch33
-rw-r--r--nixpkgs/pkgs/development/libraries/smpeg2/sdl2.patch22
-rw-r--r--nixpkgs/pkgs/development/libraries/snack/default.nix35
-rw-r--r--nixpkgs/pkgs/development/libraries/snappy/default.nix37
-rw-r--r--nixpkgs/pkgs/development/libraries/snappy/disable-benchmark.patch5
-rw-r--r--nixpkgs/pkgs/development/libraries/socket_wrapper/default.nix19
-rw-r--r--nixpkgs/pkgs/development/libraries/sofia-sip/default.nix20
-rw-r--r--nixpkgs/pkgs/development/libraries/soil/default.nix28
-rw-r--r--nixpkgs/pkgs/development/libraries/sonic/default.nix25
-rw-r--r--nixpkgs/pkgs/development/libraries/soprano/default.nix26
-rw-r--r--nixpkgs/pkgs/development/libraries/soprano/find-virtuoso.patch86
-rw-r--r--nixpkgs/pkgs/development/libraries/soqt/default.nix24
-rw-r--r--nixpkgs/pkgs/development/libraries/sord/default.nix22
-rw-r--r--nixpkgs/pkgs/development/libraries/soundtouch/default.nix22
-rw-r--r--nixpkgs/pkgs/development/libraries/soxt/default.nix21
-rw-r--r--nixpkgs/pkgs/development/libraries/spandsp/default.nix21
-rw-r--r--nixpkgs/pkgs/development/libraries/sparsehash/default.nix20
-rw-r--r--nixpkgs/pkgs/development/libraries/spatialite-tools/default.nix26
-rw-r--r--nixpkgs/pkgs/development/libraries/spdk/default.nix35
-rw-r--r--nixpkgs/pkgs/development/libraries/spdlog/default.nix46
-rw-r--r--nixpkgs/pkgs/development/libraries/speech-tools/default.nix49
-rw-r--r--nixpkgs/pkgs/development/libraries/speechd/default.nix81
-rw-r--r--nixpkgs/pkgs/development/libraries/speex/default.nix33
-rw-r--r--nixpkgs/pkgs/development/libraries/speexdsp/build-fix.patch24
-rw-r--r--nixpkgs/pkgs/development/libraries/speexdsp/default.nix29
-rw-r--r--nixpkgs/pkgs/development/libraries/sphinxbase/default.nix39
-rw-r--r--nixpkgs/pkgs/development/libraries/spice-gtk/default.nix133
-rw-r--r--nixpkgs/pkgs/development/libraries/spice-protocol/default.nix24
-rw-r--r--nixpkgs/pkgs/development/libraries/spice/correct-meson.patch26
-rw-r--r--nixpkgs/pkgs/development/libraries/spice/default.nix105
-rw-r--r--nixpkgs/pkgs/development/libraries/spirv-headers/default.nix21
-rw-r--r--nixpkgs/pkgs/development/libraries/sqlcipher/default.nix31
-rw-r--r--nixpkgs/pkgs/development/libraries/sqlite/analyzer.nix31
-rw-r--r--nixpkgs/pkgs/development/libraries/sqlite/archive-version.nix11
-rw-r--r--nixpkgs/pkgs/development/libraries/sqlite/default.nix85
-rw-r--r--nixpkgs/pkgs/development/libraries/sqlite/sqlar.nix27
-rw-r--r--nixpkgs/pkgs/development/libraries/srt/default.nix34
-rw-r--r--nixpkgs/pkgs/development/libraries/srtp/default.nix38
-rw-r--r--nixpkgs/pkgs/development/libraries/startup-notification/default.nix21
-rw-r--r--nixpkgs/pkgs/development/libraries/stb/default.nix28
-rw-r--r--nixpkgs/pkgs/development/libraries/stfl/default.nix36
-rw-r--r--nixpkgs/pkgs/development/libraries/stlport/default.nix26
-rw-r--r--nixpkgs/pkgs/development/libraries/strigi/default.nix43
-rw-r--r--nixpkgs/pkgs/development/libraries/strigi/export_bufferedstream.patch12
-rw-r--r--nixpkgs/pkgs/development/libraries/strigi/gcc6.patch45
-rw-r--r--nixpkgs/pkgs/development/libraries/stxxl/default.nix37
-rw-r--r--nixpkgs/pkgs/development/libraries/subunit/default.nix27
-rw-r--r--nixpkgs/pkgs/development/libraries/sundials/default.nix28
-rw-r--r--nixpkgs/pkgs/development/libraries/svrcore/default.nix20
-rw-r--r--nixpkgs/pkgs/development/libraries/swiften/default.nix33
-rw-r--r--nixpkgs/pkgs/development/libraries/sword/default.nix42
-rw-r--r--nixpkgs/pkgs/development/libraries/symengine/default.nix47
-rw-r--r--nixpkgs/pkgs/development/libraries/szip/default.nix16
-rw-r--r--nixpkgs/pkgs/development/libraries/t1lib/default.nix39
-rw-r--r--nixpkgs/pkgs/development/libraries/tachyon/darwin.patch31
-rw-r--r--nixpkgs/pkgs/development/libraries/tachyon/default.nix74
-rw-r--r--nixpkgs/pkgs/development/libraries/tachyon/make-archs.patch37
-rw-r--r--nixpkgs/pkgs/development/libraries/tachyon/no-absolute-paths.patch57
-rw-r--r--nixpkgs/pkgs/development/libraries/taglib-extras/default.nix22
-rw-r--r--nixpkgs/pkgs/development/libraries/taglib-sharp/default.nix27
-rw-r--r--nixpkgs/pkgs/development/libraries/taglib/1.9.nix22
-rw-r--r--nixpkgs/pkgs/development/libraries/taglib/default.nix47
-rw-r--r--nixpkgs/pkgs/development/libraries/talloc/default.nix41
-rw-r--r--nixpkgs/pkgs/development/libraries/tbb/default.nix45
-rw-r--r--nixpkgs/pkgs/development/libraries/tbb/glibc-struct-mallinfo.patch43
-rw-r--r--nixpkgs/pkgs/development/libraries/tclap/default.nix17
-rw-r--r--nixpkgs/pkgs/development/libraries/tcllib/default.nix24
-rw-r--r--nixpkgs/pkgs/development/libraries/tcltls/default.nix34
-rw-r--r--nixpkgs/pkgs/development/libraries/tclx/default.nix27
-rw-r--r--nixpkgs/pkgs/development/libraries/tdb/default.nix37
-rw-r--r--nixpkgs/pkgs/development/libraries/tecla/default.nix19
-rw-r--r--nixpkgs/pkgs/development/libraries/telepathy/farstream/default.nix21
-rw-r--r--nixpkgs/pkgs/development/libraries/telepathy/glib/default.nix36
-rw-r--r--nixpkgs/pkgs/development/libraries/telepathy/qt/default.nix40
-rw-r--r--nixpkgs/pkgs/development/libraries/template-glib/default.nix36
-rw-r--r--nixpkgs/pkgs/development/libraries/tepl/default.nix42
-rw-r--r--nixpkgs/pkgs/development/libraries/termbox/default.nix31
-rw-r--r--nixpkgs/pkgs/development/libraries/tevent/default.nix33
-rw-r--r--nixpkgs/pkgs/development/libraries/theft/default.nix29
-rw-r--r--nixpkgs/pkgs/development/libraries/thrift/default.nix39
-rw-r--r--nixpkgs/pkgs/development/libraries/ti-rpc/default.nix53
-rw-r--r--nixpkgs/pkgs/development/libraries/ticpp/default.nix35
-rw-r--r--nixpkgs/pkgs/development/libraries/tidyp/default.nix20
-rw-r--r--nixpkgs/pkgs/development/libraries/tinyxml-2/default.nix22
-rw-r--r--nixpkgs/pkgs/development/libraries/tinyxml/2.6.2-add-pkgconfig.patch13
-rw-r--r--nixpkgs/pkgs/development/libraries/tinyxml/2.6.2-cxx.patch17
-rw-r--r--nixpkgs/pkgs/development/libraries/tinyxml/2.6.2-entity.patch64
-rw-r--r--nixpkgs/pkgs/development/libraries/tinyxml/2.6.2.nix79
-rw-r--r--nixpkgs/pkgs/development/libraries/tix/default.nix55
-rw-r--r--nixpkgs/pkgs/development/libraries/tk/8.5.nix10
-rw-r--r--nixpkgs/pkgs/development/libraries/tk/8.6.nix12
-rw-r--r--nixpkgs/pkgs/development/libraries/tk/Fix-bad-install_name-for-libtk8.6.dylib.patch29
-rw-r--r--nixpkgs/pkgs/development/libraries/tk/different-prefix-with-tcl.patch25
-rw-r--r--nixpkgs/pkgs/development/libraries/tk/generic.nix58
-rw-r--r--nixpkgs/pkgs/development/libraries/tnt/default.nix25
-rw-r--r--nixpkgs/pkgs/development/libraries/tntdb/default.nix23
-rw-r--r--nixpkgs/pkgs/development/libraries/tntnet/default.nix23
-rw-r--r--nixpkgs/pkgs/development/libraries/tokyo-cabinet/default.nix43
-rw-r--r--nixpkgs/pkgs/development/libraries/tokyo-tyrant/default.nix41
-rw-r--r--nixpkgs/pkgs/development/libraries/torch-hdf5/default.nix19
-rw-r--r--nixpkgs/pkgs/development/libraries/torch/default.nix37
-rw-r--r--nixpkgs/pkgs/development/libraries/totem-pl-parser/default.nix28
-rw-r--r--nixpkgs/pkgs/development/libraries/tpm2-tss/default.nix47
-rw-r--r--nixpkgs/pkgs/development/libraries/tre/default.nix21
-rw-r--r--nixpkgs/pkgs/development/libraries/tremor/default.nix25
-rw-r--r--nixpkgs/pkgs/development/libraries/tsocks/default.nix36
-rw-r--r--nixpkgs/pkgs/development/libraries/tsocks/poll.patch26
-rw-r--r--nixpkgs/pkgs/development/libraries/twolame/default.nix34
-rw-r--r--nixpkgs/pkgs/development/libraries/ucl/default.nix19
-rw-r--r--nixpkgs/pkgs/development/libraries/ucommon/default.nix41
-rw-r--r--nixpkgs/pkgs/development/libraries/udns/default.nix46
-rw-r--r--nixpkgs/pkgs/development/libraries/udunits/default.nix26
-rw-r--r--nixpkgs/pkgs/development/libraries/uhttpmock/default.nix26
-rw-r--r--nixpkgs/pkgs/development/libraries/uid_wrapper/default.nix19
-rw-r--r--nixpkgs/pkgs/development/libraries/umockdev/default.nix34
-rw-r--r--nixpkgs/pkgs/development/libraries/unibilium/default.nix27
-rw-r--r--nixpkgs/pkgs/development/libraries/unicap/default.nix34
-rw-r--r--nixpkgs/pkgs/development/libraries/unicorn-emu/default.nix26
-rw-r--r--nixpkgs/pkgs/development/libraries/unittest-cpp/default.nix27
-rw-r--r--nixpkgs/pkgs/development/libraries/unixODBC/default.nix20
-rw-r--r--nixpkgs/pkgs/development/libraries/unixODBCDrivers/default.nix163
-rw-r--r--nixpkgs/pkgs/development/libraries/uri/default.nix32
-rw-r--r--nixpkgs/pkgs/development/libraries/uriparser/default.nix30
-rw-r--r--nixpkgs/pkgs/development/libraries/usbredir/default.nix28
-rw-r--r--nixpkgs/pkgs/development/libraries/ustr/default.nix42
-rw-r--r--nixpkgs/pkgs/development/libraries/ustr/va_args.patch23
-rw-r--r--nixpkgs/pkgs/development/libraries/utf8proc/default.nix23
-rw-r--r--nixpkgs/pkgs/development/libraries/uthash/default.nix31
-rw-r--r--nixpkgs/pkgs/development/libraries/utmps/default.nix32
-rw-r--r--nixpkgs/pkgs/development/libraries/v8/3.14.nix86
-rw-r--r--nixpkgs/pkgs/development/libraries/v8/3.16.14.nix81
-rw-r--r--nixpkgs/pkgs/development/libraries/v8/5_x.nix199
-rw-r--r--nixpkgs/pkgs/development/libraries/v8/darwin.patch22
-rw-r--r--nixpkgs/pkgs/development/libraries/v8/default.nix115
-rw-r--r--nixpkgs/pkgs/development/libraries/v8/libv8-5.4.232.patch97
-rw-r--r--nixpkgs/pkgs/development/libraries/v8/plv8_6_x.nix187
-rwxr-xr-xnixpkgs/pkgs/development/libraries/v8/update.sh47
-rw-r--r--nixpkgs/pkgs/development/libraries/vaapi-intel-hybrid/default.nix47
-rw-r--r--nixpkgs/pkgs/development/libraries/vaapi-intel/default.nix52
-rw-r--r--nixpkgs/pkgs/development/libraries/vaapi-vdpau/default.nix37
-rw-r--r--nixpkgs/pkgs/development/libraries/vaapi-vdpau/glext85.patch20
-rw-r--r--nixpkgs/pkgs/development/libraries/vapoursynth-mvtools/default.nix30
-rw-r--r--nixpkgs/pkgs/development/libraries/vapoursynth/default.nix48
-rw-r--r--nixpkgs/pkgs/development/libraries/vc/0.7.nix30
-rw-r--r--nixpkgs/pkgs/development/libraries/vc/default.nix30
-rw-r--r--nixpkgs/pkgs/development/libraries/vcdimager/default.nix25
-rw-r--r--nixpkgs/pkgs/development/libraries/vcg/default.nix29
-rw-r--r--nixpkgs/pkgs/development/libraries/vid-stab/default.nix22
-rw-r--r--nixpkgs/pkgs/development/libraries/vigra/default.nix45
-rw-r--r--nixpkgs/pkgs/development/libraries/virglrenderer/default.nix31
-rw-r--r--nixpkgs/pkgs/development/libraries/vmime/default.nix31
-rw-r--r--nixpkgs/pkgs/development/libraries/vmmlib/default.nix46
-rw-r--r--nixpkgs/pkgs/development/libraries/vmmlib/disable-cpack.patch11
-rw-r--r--nixpkgs/pkgs/development/libraries/vo-amrwbenc/default.nix22
-rw-r--r--nixpkgs/pkgs/development/libraries/volume-key/default.nix48
-rw-r--r--nixpkgs/pkgs/development/libraries/vrb/default.nix34
-rw-r--r--nixpkgs/pkgs/development/libraries/vrb/removed_options.patch13
-rw-r--r--nixpkgs/pkgs/development/libraries/vrb/unused-but-set-variable.patch19
-rw-r--r--nixpkgs/pkgs/development/libraries/vrpn/default.nix34
-rw-r--r--nixpkgs/pkgs/development/libraries/vsqlite/default.nix27
-rw-r--r--nixpkgs/pkgs/development/libraries/vte/2.90.nix41
-rw-r--r--nixpkgs/pkgs/development/libraries/vte/default.nix51
-rw-r--r--nixpkgs/pkgs/development/libraries/vte/ng.nix27
-rw-r--r--nixpkgs/pkgs/development/libraries/vtk/default.nix60
-rw-r--r--nixpkgs/pkgs/development/libraries/vulkan-headers/default.nix22
-rw-r--r--nixpkgs/pkgs/development/libraries/vulkan-loader/default.nix44
-rw-r--r--nixpkgs/pkgs/development/libraries/vxl/default.nix32
-rw-r--r--nixpkgs/pkgs/development/libraries/wasilibc/default.nix29
-rw-r--r--nixpkgs/pkgs/development/libraries/wavpack/default.nix23
-rw-r--r--nixpkgs/pkgs/development/libraries/wayland/1.9.nix33
-rw-r--r--nixpkgs/pkgs/development/libraries/wayland/default.nix44
-rw-r--r--nixpkgs/pkgs/development/libraries/wayland/protocols.nix27
-rw-r--r--nixpkgs/pkgs/development/libraries/waylandpp/default.nix23
-rw-r--r--nixpkgs/pkgs/development/libraries/wcslib/default.nix33
-rw-r--r--nixpkgs/pkgs/development/libraries/webkitgtk/2.4.nix111
-rw-r--r--nixpkgs/pkgs/development/libraries/webkitgtk/configure.patch20
-rw-r--r--nixpkgs/pkgs/development/libraries/webkitgtk/default.nix83
-rw-r--r--nixpkgs/pkgs/development/libraries/webkitgtk/fix-execinfo.patch20
-rw-r--r--nixpkgs/pkgs/development/libraries/webkitgtk/libc++.patch20
-rw-r--r--nixpkgs/pkgs/development/libraries/webkitgtk/plugin-none.patch38
-rw-r--r--nixpkgs/pkgs/development/libraries/webkitgtk/quartz-webcore.patch22
-rw-r--r--nixpkgs/pkgs/development/libraries/webkitgtk/webcore-svg-libxml-cflags.patch8
-rw-r--r--nixpkgs/pkgs/development/libraries/webrtc-audio-processing/default.nix23
-rw-r--r--nixpkgs/pkgs/development/libraries/websocket++/default.nix23
-rw-r--r--nixpkgs/pkgs/development/libraries/wildmidi/default.nix38
-rw-r--r--nixpkgs/pkgs/development/libraries/wiredtiger/default.nix74
-rw-r--r--nixpkgs/pkgs/development/libraries/wlc/default.nix39
-rw-r--r--nixpkgs/pkgs/development/libraries/wlroots/0001-Fix-missing-headers-when-building-without-X11.patch133
-rw-r--r--nixpkgs/pkgs/development/libraries/wlroots/default.nix86
-rw-r--r--nixpkgs/pkgs/development/libraries/wolfssl/default.nix35
-rw-r--r--nixpkgs/pkgs/development/libraries/wt/default.nix54
-rw-r--r--nixpkgs/pkgs/development/libraries/wtk/builder.sh27
-rw-r--r--nixpkgs/pkgs/development/libraries/wtk/default.nix25
-rw-r--r--nixpkgs/pkgs/development/libraries/wxSVG/default.nix34
-rw-r--r--nixpkgs/pkgs/development/libraries/wxsqlite3/default.nix29
-rw-r--r--nixpkgs/pkgs/development/libraries/wxsqliteplus/default.nix38
-rw-r--r--nixpkgs/pkgs/development/libraries/wxwidgets/2.8/default.nix75
-rw-r--r--nixpkgs/pkgs/development/libraries/wxwidgets/2.9/default.nix86
-rw-r--r--nixpkgs/pkgs/development/libraries/wxwidgets/3.0/default.nix94
-rw-r--r--nixpkgs/pkgs/development/libraries/wxwidgets/3.0/mac.nix76
-rw-r--r--nixpkgs/pkgs/development/libraries/wxwidgets/3.1/default.nix16
-rw-r--r--nixpkgs/pkgs/development/libraries/x264/default.nix37
-rw-r--r--nixpkgs/pkgs/development/libraries/x265/default.nix74
-rw-r--r--nixpkgs/pkgs/development/libraries/xalanc/default.nix32
-rw-r--r--nixpkgs/pkgs/development/libraries/xapian/default.nix42
-rw-r--r--nixpkgs/pkgs/development/libraries/xapian/skip-flaky-darwin-test.patch33
-rw-r--r--nixpkgs/pkgs/development/libraries/xapian/tools/omega/default.nix21
-rw-r--r--nixpkgs/pkgs/development/libraries/xavs/default.nix48
-rw-r--r--nixpkgs/pkgs/development/libraries/xbase/default.nix34
-rw-r--r--nixpkgs/pkgs/development/libraries/xbase/xbase-fixes.patch34
-rw-r--r--nixpkgs/pkgs/development/libraries/xcb-util-cursor/HEAD.nix42
-rw-r--r--nixpkgs/pkgs/development/libraries/xcb-util-cursor/m4/ax_compare_version.m4174
-rw-r--r--nixpkgs/pkgs/development/libraries/xcb-util-cursor/m4/xcb_util_common.m444
-rw-r--r--nixpkgs/pkgs/development/libraries/xcb-util-cursor/m4/xcb_util_m4_with_include_path.m424
-rw-r--r--nixpkgs/pkgs/development/libraries/xdg-dbus-proxy/default.nix30
-rw-r--r--nixpkgs/pkgs/development/libraries/xdg-desktop-portal-gtk/default.nix23
-rw-r--r--nixpkgs/pkgs/development/libraries/xdg-desktop-portal/default.nix44
-rw-r--r--nixpkgs/pkgs/development/libraries/xdg-desktop-portal/fix-paths.patch13
-rw-r--r--nixpkgs/pkgs/development/libraries/xdg-desktop-portal/respect-path-env-var.patch76
-rw-r--r--nixpkgs/pkgs/development/libraries/xercesc/default.nix22
-rw-r--r--nixpkgs/pkgs/development/libraries/xgboost/default.nix46
-rw-r--r--nixpkgs/pkgs/development/libraries/xine-lib/default.nix35
-rw-r--r--nixpkgs/pkgs/development/libraries/xlibs-wrapper/default.nix21
-rw-r--r--nixpkgs/pkgs/development/libraries/xlslib/default.nix25
-rw-r--r--nixpkgs/pkgs/development/libraries/xml-security-c/cxx11.patch11
-rw-r--r--nixpkgs/pkgs/development/libraries/xml-security-c/default.nix36
-rw-r--r--nixpkgs/pkgs/development/libraries/xml-tooling-c/default.nix24
-rw-r--r--nixpkgs/pkgs/development/libraries/xmlrpc-c/default.nix33
-rw-r--r--nixpkgs/pkgs/development/libraries/xmlsec/default.nix48
-rw-r--r--nixpkgs/pkgs/development/libraries/xsd/default.nix38
-rw-r--r--nixpkgs/pkgs/development/libraries/xsd/xsdcxx.patch126
-rw-r--r--nixpkgs/pkgs/development/libraries/xvidcore/default.nix47
-rw-r--r--nixpkgs/pkgs/development/libraries/xxHash/default.nix32
-rw-r--r--nixpkgs/pkgs/development/libraries/xylib/default.nix21
-rw-r--r--nixpkgs/pkgs/development/libraries/yajl/default.nix25
-rw-r--r--nixpkgs/pkgs/development/libraries/yojimbo/default.nix43
-rw-r--r--nixpkgs/pkgs/development/libraries/yubico-pam/default.nix24
-rw-r--r--nixpkgs/pkgs/development/libraries/zeitgeist/default.nix50
-rw-r--r--nixpkgs/pkgs/development/libraries/zeroc-ice/default.nix41
-rw-r--r--nixpkgs/pkgs/development/libraries/zeroc-ice/makefile.patch9
-rw-r--r--nixpkgs/pkgs/development/libraries/zeromq/3.x.nix22
-rw-r--r--nixpkgs/pkgs/development/libraries/zeromq/4.x.nix28
-rw-r--r--nixpkgs/pkgs/development/libraries/zimg/default.nix23
-rw-r--r--nixpkgs/pkgs/development/libraries/zimlib/default.nix23
-rw-r--r--nixpkgs/pkgs/development/libraries/zlib/default.nix90
-rw-r--r--nixpkgs/pkgs/development/libraries/zlib/disable-cygwin-widechar.patch13
-rw-r--r--nixpkgs/pkgs/development/libraries/zlog/default.nix34
-rw-r--r--nixpkgs/pkgs/development/libraries/zmqpp/default.nix27
-rw-r--r--nixpkgs/pkgs/development/libraries/zookeeper_mt/default.nix20
-rw-r--r--nixpkgs/pkgs/development/libraries/zxcvbn-c/default.nix24
-rw-r--r--nixpkgs/pkgs/development/libraries/zziplib/default.nix42
2405 files changed, 98390 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/AntTweakBar/default.nix b/nixpkgs/pkgs/development/libraries/AntTweakBar/default.nix
new file mode 100644
index 000000000000..fcb708c829be
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/AntTweakBar/default.nix
@@ -0,0 +1,33 @@
+{ stdenv, fetchurl, unzip, xorg, libGLU_combined }:
+
+stdenv.mkDerivation rec {
+  name = "AntTweakBar-1.16";
+
+  buildInputs = [ unzip xorg.libX11 libGLU_combined ];
+
+  src = fetchurl {
+    url = "mirror://sourceforge/project/anttweakbar/AntTweakBar_116.zip";
+    sha256 = "0z3frxpzf54cjs07m6kg09p7nljhr7140f4pznwi7srwq4cvgkpv";
+  };
+
+  postPatch = "cd src";
+  installPhase = ''
+    mkdir -p $out/lib/
+    cp ../lib/{libAntTweakBar.so,libAntTweakBar.so.1,libAntTweakBar.a} $out/lib/
+    cp -r ../include $out/
+  '';
+
+  meta = {
+    description = "Add a light/intuitive GUI to OpenGL applications";
+    longDescription = ''
+      A small and easy-to-use C/C++ library that allows to quickly add a light
+      and intuitive graphical user interface into graphic applications based on OpenGL
+      (compatibility and core profiles), DirectX 9, DirectX 10 or DirectX 11
+      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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/CGAL/default.nix b/nixpkgs/pkgs/development/libraries/CGAL/default.nix
new file mode 100644
index 000000000000..95984c970018
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/CGAL/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchFromGitHub, cmake, boost, gmp, mpfr }:
+
+stdenv.mkDerivation rec {
+  version = "4.14";
+  name = "cgal-" + version;
+
+  src = fetchFromGitHub {
+    owner = "CGAL";
+    repo = "releases";
+    rev = "CGAL-${version}";
+    sha256 = "0p0s1dl5a261zwy0hxa7ylkypk45rwc6n84lx507dwdhfz4ihv12";
+  };
+
+  # note: optional component libCGAL_ImageIO would need zlib and opengl;
+  #   there are also libCGAL_Qt{3,4} omitted ATM
+  buildInputs = [ boost gmp mpfr ];
+  nativeBuildInputs = [ cmake ];
+
+  doCheck = false;
+
+  meta = with stdenv.lib; {
+    description = "Computational Geometry Algorithms Library";
+    homepage = http://cgal.org;
+    license = with licenses; [ gpl3Plus lgpl3Plus];
+    platforms = platforms.all;
+    maintainers = [ maintainers.raskin ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/CoinMP/default.nix b/nixpkgs/pkgs/development/libraries/CoinMP/default.nix
new file mode 100644
index 000000000000..fbf9615f88a2
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/CoinMP/default.nix
@@ -0,0 +1,20 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "CoinMP-${version}";
+  version = "1.8.4";
+
+  src = fetchurl {
+    url = "https://www.coin-or.org/download/source/CoinMP/${name}.tgz";
+    sha256 = "13d3j1sdcjzpijp4qks3n0zibk649ac3hhv88hkk8ffxrc6gnn9l";
+  };
+
+  hardeningDisable = [ "format" ];
+
+  meta = with stdenv.lib; {
+    homepage = https://projects.coin-or.org/CoinMP/;
+    description = "COIN-OR lightweight API for COIN-OR libraries CLP, CBC, and CGL";
+    platforms = platforms.unix;
+    license = licenses.epl10;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/LASzip/default.nix b/nixpkgs/pkgs/development/libraries/LASzip/default.nix
new file mode 100644
index 000000000000..9522038df6af
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/LASzip/default.nix
@@ -0,0 +1,21 @@
+{ stdenv, fetchurl, cmake }:
+
+stdenv.mkDerivation rec {
+  version = "2.2.0";
+  name = "LASzip-${version}";
+
+  src = fetchurl {
+    url = "https://github.com/LASzip/LASzip/archive/v${version}.tar.gz";
+    sha256 = "b8e8cc295f764b9d402bc587f3aac67c83ed8b39f1cb686b07c168579c61fbb2";
+  };
+
+  buildInputs = [cmake];
+
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/NSPlist/default.nix b/nixpkgs/pkgs/development/libraries/NSPlist/default.nix
new file mode 100644
index 000000000000..bfee99619840
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/NSPlist/default.nix
@@ -0,0 +1,21 @@
+{ stdenv, fetchFromGitHub, cmake }:
+
+stdenv.mkDerivation {
+  name = "NSPlist-713decf";
+
+  src = fetchFromGitHub {
+    owner = "matthewbauer";
+    repo = "NSPlist";
+    rev = "713decf06c1ef6c39a707bc99eb45ac9925f2b8a";
+    sha256 = "0v4yfiwfd08hmh2ydgy6pnmlzjbd96k78dsla9pfd56ka89aw74r";
+  };
+
+  buildInputs = [ cmake ];
+
+  meta = with stdenv.lib; {
+    maintainers = with maintainers; [ matthewbauer ];
+    description = "Parses .plist files";
+    license = licenses.mit;
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/PlistCpp/default.nix b/nixpkgs/pkgs/development/libraries/PlistCpp/default.nix
new file mode 100644
index 000000000000..f7703b731b99
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/PlistCpp/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, fetchFromGitHub, cmake, boost, NSPlist, pugixml }:
+
+stdenv.mkDerivation {
+  name = "PlistCpp-11615d";
+
+  src = fetchFromGitHub {
+    owner = "matthewbauer";
+    repo = "PlistCpp";
+    rev = "11615deab3369356a182dabbf5bae30574967264";
+    sha256 = "10jn6bvm9vn6492zix2pd724v5h4lccmkqg3lxfw8r0qg3av0yzv";
+  };
+
+  buildInputs = [ cmake boost NSPlist pugixml ];
+
+
+  meta = with stdenv.lib; {
+    maintainers = with maintainers; [ matthewbauer ];
+    description = "CPP bindings for Plist";
+    license = licenses.mit;
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/SDL/default.nix b/nixpkgs/pkgs/development/libraries/SDL/default.nix
new file mode 100644
index 000000000000..007cd02957ba
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/SDL/default.nix
@@ -0,0 +1,133 @@
+{ stdenv, config, libGLSupported, fetchurl, fetchpatch, pkgconfig, audiofile, libcap, libiconv
+, openglSupport ? libGLSupported, libGL, libGLU
+, alsaSupport ? stdenv.isLinux && !stdenv.hostPlatform.isAndroid, alsaLib
+, x11Support ? !stdenv.isCygwin && !stdenv.hostPlatform.isAndroid
+, libXext, libICE, libXrandr
+, pulseaudioSupport ? config.pulseaudio or stdenv.isLinux && !stdenv.hostPlatform.isAndroid, libpulseaudio
+, OpenGL, CoreAudio, CoreServices, AudioUnit, Kernel, Cocoa
+, cf-private
+}:
+
+# NOTE: When editing this expression see if the same change applies to
+# SDL2 expression too
+
+with stdenv.lib;
+
+stdenv.mkDerivation rec {
+  name    = "SDL-${version}";
+  version = "1.2.15";
+
+  src = fetchurl {
+    url    = "https://www.libsdl.org/release/${name}.tar.gz";
+    sha256 = "005d993xcac8236fpvd1iawkz4wqjybkpn8dbwaliqz5jfkidlyn";
+  };
+
+  # make: *** No rule to make target 'build/*.lo', needed by 'build/libSDL.la'.  Stop.
+  postPatch = "patchShebangs ./configure";
+
+  outputs = [ "out" "dev" ];
+  outputBin = "dev"; # sdl-config
+
+  nativeBuildInputs = [ pkgconfig ]
+    ++ optional stdenv.isLinux libcap;
+
+  propagatedBuildInputs = [ libiconv ]
+    ++ optionals x11Support [ libXext libICE libXrandr ]
+    ++ optionals openglSupport [ libGL libGLU ]
+    ++ optional alsaSupport alsaLib
+    ++ optional pulseaudioSupport libpulseaudio
+    ++ optional stdenv.isDarwin Cocoa;
+
+  buildInputs = [ ]
+    ++ optional (!stdenv.hostPlatform.isMinGW && alsaSupport) audiofile
+    ++ optionals stdenv.isDarwin [
+      AudioUnit CoreAudio CoreServices Kernel OpenGL
+      # Needed for NSDefaultRunLoopMode symbols.
+      cf-private
+    ];
+
+  configureFlags = [
+    "--disable-oss"
+    "--disable-video-x11-xme"
+    "--enable-rpath"
+  # Building without this fails on Darwin with
+  #
+  #   ./src/video/x11/SDL_x11sym.h:168:17: error: conflicting types for '_XData32'
+  #   SDL_X11_SYM(int,_XData32,(Display *dpy,register long *data,unsigned len),(dpy,data,len),return)
+  #
+  # Please try revert the change that introduced this comment when updating SDL.
+  ] ++ optional stdenv.isDarwin "--disable-x11-shared"
+    ++ optional (!x11Support) "--without-x"
+    ++ optional alsaSupport "--with-alsa-prefix=${alsaLib.out}/lib";
+
+  patches = [
+    ./find-headers.patch
+
+    # Fix window resizing issues, e.g. for xmonad
+    # Ticket: http://bugzilla.libsdl.org/show_bug.cgi?id=1430
+    (fetchpatch {
+      name = "fix_window_resizing.diff";
+      url = "https://bugs.debian.org/cgi-bin/bugreport.cgi?msg=10;filename=fix_window_resizing.diff;att=2;bug=665779";
+      sha256 = "1z35azc73vvi19pzi6byck31132a8w1vzrghp1x3hy4a4f9z4gc6";
+    })
+    # Fix drops of keyboard events for SDL_EnableUNICODE
+    (fetchpatch {
+      url = "http://hg.libsdl.org/SDL/raw-rev/0aade9c0203f";
+      sha256 = "1y9izncjlqvk1mkz1pkl9lrk9s452cmg2izjjlqqrhbn8279xy50";
+    })
+    # Ignore insane joystick axis events
+    (fetchpatch {
+      url = "http://hg.libsdl.org/SDL/raw-rev/95abff7adcc2";
+      sha256 = "0i8x0kx0pw12ld5bfxhyzs466y3c0n9dscw1ijhq1b96r72xyhqq";
+    })
+    # https://bugzilla.libsdl.org/show_bug.cgi?id=1769
+    (fetchpatch {
+      url = "http://hg.libsdl.org/SDL/raw-rev/91ad7b43317a";
+      sha256 = "15g537vbl2my4mfrjxfkcx9ri6bk2gjvaqj650rjdxwk2nkdkn4b";
+    })
+    # Workaround X11 bug to allow changing gamma
+    # Ticket: https://bugs.freedesktop.org/show_bug.cgi?id=27222
+    (fetchpatch {
+      name = "SDL_SetGamma.patch";
+      url = "https://src.fedoraproject.org/cgit/rpms/SDL.git/plain/SDL-1.2.15-x11-Bypass-SetGammaRamp-when-changing-gamma.patch?id=04a3a7b1bd88c2d5502292fad27e0e02d084698d";
+      sha256 = "0x52s4328kilyq43i7psqkqg7chsfwh0aawr50j566nzd7j51dlv";
+    })
+    # Fix a build failure on OS X Mavericks
+    # Ticket: https://bugzilla.libsdl.org/show_bug.cgi?id=2085
+    (fetchpatch {
+      url = "http://hg.libsdl.org/SDL/raw-rev/e9466ead70e5";
+      sha256 = "0mpwdi09h89df2wxqw87m1rdz7pr46k0w6alk691k8kwv970z6pl";
+    })
+    (fetchpatch {
+      url = "http://hg.libsdl.org/SDL/raw-rev/bbfb41c13a87";
+      sha256 = "1336g7waaf1c8yhkz11xbs500h8bmvabh4h437ax8l1xdwcppfxv";
+    })
+  ];
+
+  postInstall = ''
+    moveToOutput share/aclocal "$dev"
+  '';
+
+  # See the same place in the expression for SDL2
+  postFixup = ''
+    for lib in $out/lib/*.so* ; do
+      if [[ -L "$lib" ]]; then
+        patchelf --set-rpath "$(patchelf --print-rpath $lib):${makeLibraryPath propagatedBuildInputs}" "$lib"
+      fi
+    done
+  '';
+
+  setupHook = ./setup-hook.sh;
+
+  passthru = { inherit openglSupport; };
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    description = "A cross-platform multimedia library";
+    homepage    = "http://www.libsdl.org/";
+    maintainers = with maintainers; [ lovek323 ];
+    platforms   = platforms.unix;
+    license     = licenses.lgpl21;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/SDL/find-headers.patch b/nixpkgs/pkgs/development/libraries/SDL/find-headers.patch
new file mode 100644
index 000000000000..5f75ae9e8301
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/SDL/find-headers.patch
@@ -0,0 +1,16 @@
+diff -ru3 SDL-1.2.15/sdl-config.in SDL-1.2.15-new/sdl-config.in
+--- SDL-1.2.15/sdl-config.in	2012-01-19 10:30:06.000000000 +0400
++++ SDL-1.2.15-new/sdl-config.in	2016-08-22 05:32:52.716397920 +0300
+@@ -42,7 +42,11 @@
+       echo @SDL_VERSION@
+       ;;
+     --cflags)
+-      echo -I@includedir@/SDL @SDL_CFLAGS@
++      SDL_CFLAGS=""
++      for i in @includedir@/SDL $SDL_PATH; do
++        SDL_CFLAGS="$SDL_CFLAGS -I$i"
++      done
++      echo $SDL_CFLAGS @SDL_CFLAGS@
+       ;;
+ @ENABLE_SHARED_TRUE@    --libs)
+ @ENABLE_SHARED_TRUE@      echo -L@libdir@ @SDL_RLD_FLAGS@ @SDL_LIBS@
diff --git a/nixpkgs/pkgs/development/libraries/SDL/setup-hook.sh b/nixpkgs/pkgs/development/libraries/SDL/setup-hook.sh
new file mode 100644
index 000000000000..20382f18f529
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/SDL/setup-hook.sh
@@ -0,0 +1,7 @@
+addSDLPath () {
+  if [ -e "$1/include/SDL" ]; then
+    export SDL_PATH="$SDL_PATH $1/include/SDL"
+  fi
+}
+
+addEnvHooks "$hostOffset" addSDLPath
diff --git a/nixpkgs/pkgs/development/libraries/SDL2/default.nix b/nixpkgs/pkgs/development/libraries/SDL2/default.nix
new file mode 100644
index 000000000000..2909b16d65d8
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/SDL2/default.nix
@@ -0,0 +1,114 @@
+{ stdenv, config, libGLSupported, fetchurl, pkgconfig
+, openglSupport ? libGLSupported, libGL
+, alsaSupport ? stdenv.isLinux && !stdenv.hostPlatform.isAndroid, alsaLib
+, x11Support ? !stdenv.isCygwin && !stdenv.hostPlatform.isAndroid
+, libX11, xorgproto, libICE, libXi, libXScrnSaver, libXcursor
+, libXinerama, libXext, libXxf86vm, libXrandr
+, waylandSupport ? stdenv.isLinux && !stdenv.hostPlatform.isAndroid
+, wayland, wayland-protocols, libxkbcommon
+, dbusSupport ? stdenv.isLinux && !stdenv.hostPlatform.isAndroid, dbus
+, udevSupport ? false, udev
+, ibusSupport ? false, ibus
+, fcitxSupport ? false, fcitx
+, pulseaudioSupport ? config.pulseaudio or stdenv.isLinux && !stdenv.hostPlatform.isAndroid
+, libpulseaudio
+, AudioUnit, Cocoa, CoreAudio, CoreServices, ForceFeedback, OpenGL
+, audiofile, cf-private, libiconv
+}:
+
+# NOTE: When editing this expression see if the same change applies to
+# SDL expression too
+
+with stdenv.lib;
+
+stdenv.mkDerivation rec {
+  name = "SDL2-${version}";
+  version = "2.0.9";
+
+  src = fetchurl {
+    url = "https://www.libsdl.org/release/${name}.tar.gz";
+    sha256 = "1c94ndagzkdfqaa838yqg589p1nnqln8mv0hpwfhrkbfczf8cl95";
+  };
+
+  outputs = [ "out" "dev" ];
+  outputBin = "dev"; # sdl-config
+
+  patches = [ ./find-headers.patch ];
+
+  nativeBuildInputs = [ pkgconfig ];
+
+  propagatedBuildInputs = dlopenPropagatedBuildInputs;
+
+  dlopenPropagatedBuildInputs = [ ]
+    # Propagated for #include <GLES/gl.h> in SDL_opengles.h.
+    ++ optional openglSupport libGL
+    # Propagated for #include <X11/Xlib.h> and <X11/Xatom.h> in SDL_syswm.h.
+    ++ optionals x11Support [ libX11 xorgproto ];
+
+  dlopenBuildInputs = [ ]
+    ++ optionals  alsaSupport [ alsaLib audiofile ]
+    ++ optional  dbusSupport dbus
+    ++ optional  pulseaudioSupport libpulseaudio
+    ++ optional  udevSupport udev
+    ++ optionals waylandSupport [ wayland wayland-protocols libxkbcommon ]
+    ++ optionals x11Support [ libICE libXi libXScrnSaver libXcursor libXinerama libXext libXrandr libXxf86vm ];
+
+  buildInputs = [ libiconv ]
+    ++ dlopenBuildInputs
+    ++ optional  ibusSupport ibus
+    ++ optional  fcitxSupport fcitx
+    ++ optionals stdenv.isDarwin [
+      AudioUnit Cocoa CoreAudio CoreServices ForceFeedback OpenGL
+      # Needed for NSDefaultRunLoopMode symbols.
+      cf-private
+    ];
+
+  enableParallelBuilding = true;
+
+  configureFlags = [
+    "--disable-oss"
+  ] ++ optional (!x11Support) "--without-x"
+    ++ optional alsaSupport "--with-alsa-prefix=${alsaLib.out}/lib"
+    ++ optional stdenv.isDarwin "--disable-sdltest";
+
+  postInstall = ''
+    moveToOutput lib/libSDL2main.a "$dev"
+    rm $out/lib/*.a
+    moveToOutput bin/sdl2-config "$dev"
+  '';
+
+  # SDL is weird in that instead of just dynamically linking with
+  # libraries when you `--enable-*` (or when `configure` finds) them
+  # it `dlopen`s them at runtime. In principle, this means it can
+  # ignore any missing optional dependencies like alsa, pulseaudio,
+  # some x11 libs, wayland, etc if they are missing on the system
+  # and/or work with wide array of versions of said libraries. In
+  # nixpkgs, however, we don't need any of that. Moreover, since we
+  # don't have a global ld-cache we have to stuff all the propagated
+  # libraries into rpath by hand or else some applications that use
+  # SDL API that requires said libraries will fail to start.
+  #
+  # You can grep SDL sources with `grep -rE 'SDL_(NAME|.*_SYM)'` to
+  # list the symbols used in this way.
+  postFixup = let
+    rpath = makeLibraryPath (dlopenPropagatedBuildInputs ++ dlopenBuildInputs);
+  in optionalString (stdenv.hostPlatform.extensions.sharedLibrary == ".so") ''
+    for lib in $out/lib/*.so* ; do
+      if ! [[ -L "$lib" ]]; then
+        patchelf --set-rpath "$(patchelf --print-rpath $lib):${rpath}" "$lib"
+      fi
+    done
+  '';
+
+  setupHook = ./setup-hook.sh;
+
+  passthru = { inherit openglSupport; };
+
+  meta = with stdenv.lib; {
+    description = "A cross-platform multimedia library";
+    homepage = http://www.libsdl.org/;
+    license = licenses.zlib;
+    platforms = platforms.all;
+    maintainers = with maintainers; [ cpages ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/SDL2/find-headers.patch b/nixpkgs/pkgs/development/libraries/SDL2/find-headers.patch
new file mode 100644
index 000000000000..a6114901055a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/SDL2/find-headers.patch
@@ -0,0 +1,26 @@
+diff -ru3 SDL2-2.0.4/sdl2-config.cmake.in SDL2-2.0.4-new/sdl2-config.cmake.in
+--- SDL2-2.0.4/sdl2-config.cmake.in	2016-01-02 22:56:31.000000000 +0300
++++ SDL2-2.0.4-new/sdl2-config.cmake.in	2016-08-22 05:26:42.420397323 +0300
+@@ -6,5 +6,5 @@
+ set(SDL2_PREFIX "@prefix@")
+ set(SDL2_EXEC_PREFIX "@prefix@")
+ set(SDL2_LIBDIR "@libdir@")
+-set(SDL2_INCLUDE_DIRS "@includedir@/SDL2")
++set(SDL2_INCLUDE_DIRS "@includedir@/SDL2" $ENV{SDL2_PATH})
+ set(SDL2_LIBRARIES "-L${SDL2_LIBDIR} @SDL_RLD_FLAGS@ @SDL_LIBS@")
+diff -ru3 SDL2-2.0.4/sdl2-config.in SDL2-2.0.4-new/sdl2-config.in
+--- SDL2-2.0.4/sdl2-config.in	2016-01-02 22:56:31.000000000 +0300
++++ SDL2-2.0.4-new/sdl2-config.in	2016-08-22 05:32:02.256397839 +0300
+@@ -42,7 +42,11 @@
+       echo @SDL_VERSION@
+       ;;
+     --cflags)
+-      echo -I@includedir@/SDL2 @SDL_CFLAGS@
++      SDL_CFLAGS=""
++      for i in @includedir@/SDL2 $SDL2_PATH; do
++        SDL_CFLAGS="$SDL_CFLAGS -I$i"
++      done
++      echo $SDL_CFLAGS @SDL_CFLAGS@
+       ;;
+ @ENABLE_SHARED_TRUE@    --libs)
+ @ENABLE_SHARED_TRUE@      echo -L@libdir@ @SDL_RLD_FLAGS@ @SDL_LIBS@
diff --git a/nixpkgs/pkgs/development/libraries/SDL2/setup-hook.sh b/nixpkgs/pkgs/development/libraries/SDL2/setup-hook.sh
new file mode 100644
index 000000000000..3acce9d473c5
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/SDL2/setup-hook.sh
@@ -0,0 +1,7 @@
+addSDL2Path () {
+  if [ -e "$1/include/SDL2" ]; then
+    export SDL2_PATH="$SDL2_PATH $1/include/SDL2"
+  fi
+}
+
+addEnvHooks "$hostOffset" addSDL2Path
diff --git a/nixpkgs/pkgs/development/libraries/SDL2_gfx/default.nix b/nixpkgs/pkgs/development/libraries/SDL2_gfx/default.nix
new file mode 100644
index 000000000000..803cc97a8ae8
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/SDL2_gfx/default.nix
@@ -0,0 +1,45 @@
+{ stdenv, darwin, fetchurl, SDL2 }:
+
+stdenv.mkDerivation rec {
+  name = "${pname}-${version}";
+  pname = "SDL2_gfx";
+  version = "1.0.4";
+
+  src = fetchurl {
+    url = "http://www.ferzkopp.net/Software/${pname}/${name}.tar.gz";
+    sha256 = "0qk2ax7f7grlxb13ba0ll3zlm8780s7j8fmrhlpxzjgdvldf1q33";
+  };
+
+  buildInputs = [ SDL2 ]
+    ++ stdenv.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";
+
+  meta = with stdenv.lib; {
+    description = "SDL graphics drawing primitives and support functions";
+
+    longDescription = ''
+      The SDL_gfx library evolved out of the SDL_gfxPrimitives code
+      which provided basic drawing routines such as lines, circles or
+      polygons and SDL_rotozoom which implemented a interpolating
+      rotozoomer for SDL surfaces.
+
+      The current components of the SDL_gfx library are:
+
+          * Graphic Primitives (SDL_gfxPrimitves.h)
+          * Rotozoomer (SDL_rotozoom.h)
+          * Framerate control (SDL_framerate.h)
+          * MMX image filters (SDL_imageFilter.h)
+          * Custom Blit functions (SDL_gfxBlitFunc.h)
+
+      The library is backwards compatible to the above mentioned
+      code. Its is written in plain C and can be used in C++ code.
+    '';
+
+    homepage = http://www.ferzkopp.net/wordpress/2016/01/02/sdl_gfx-sdl2_gfx/;
+    license = licenses.zlib;
+    maintainers = with maintainers; [ cpages ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/SDL2_image/default.nix b/nixpkgs/pkgs/development/libraries/SDL2_image/default.nix
new file mode 100644
index 000000000000..a2ef54cc136b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/SDL2_image/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchurl, SDL2, libpng, libjpeg, libtiff, libungif, libwebp, libXpm, zlib, Foundation }:
+
+stdenv.mkDerivation rec {
+  name = "SDL2_image-${version}";
+  version = "2.0.4";
+
+  src = fetchurl {
+    url = "https://www.libsdl.org/projects/SDL_image/release/${name}.tar.gz";
+    sha256 = "1b6f7002bm007y3zpyxb5r6ag0lml51jyvx1pwpj9sq24jfc8kp7";
+  };
+
+  buildInputs = [ SDL2 libpng libjpeg libtiff libungif libwebp libXpm zlib ]
+    ++ stdenv.lib.optional stdenv.isDarwin Foundation;
+
+
+  configureFlags = stdenv.lib.optional stdenv.isDarwin "--disable-sdltest";
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    description = "SDL image library";
+    homepage = http://www.libsdl.org/projects/SDL_image/;
+    platforms = platforms.unix;
+    license = licenses.zlib;
+    maintainers = with maintainers; [ cpages ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/SDL2_mixer/default.nix b/nixpkgs/pkgs/development/libraries/SDL2_mixer/default.nix
new file mode 100644
index 000000000000..61e15d621bcd
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/SDL2_mixer/default.nix
@@ -0,0 +1,36 @@
+{ stdenv, lib, fetchurl, autoreconfHook, pkgconfig, which
+, SDL2, libogg, libvorbis, smpeg2, flac, libmodplug
+, CoreServices, AudioUnit, AudioToolbox
+, enableNativeMidi ? false, fluidsynth ? null }:
+
+stdenv.mkDerivation rec {
+  name = "SDL2_mixer-${version}";
+  version = "2.0.4";
+
+  src = fetchurl {
+    url = "https://www.libsdl.org/projects/SDL_mixer/release/${name}.tar.gz";
+    sha256 = "0694vsz5bjkcdgfdra6x9fq8vpzrl8m6q96gh58df7065hw5mkxl";
+  };
+
+  preAutoreconf = ''
+    aclocal
+  '';
+
+  nativeBuildInputs = [ autoreconfHook pkgconfig which ];
+
+  buildInputs = stdenv.lib.optionals stdenv.isDarwin [ CoreServices AudioUnit AudioToolbox ];
+
+  propagatedBuildInputs = [ SDL2 libogg libvorbis fluidsynth smpeg2 flac libmodplug ];
+
+  configureFlags = [ "--disable-music-ogg-shared" ]
+    ++ lib.optional enableNativeMidi "--enable-music-native-midi-gpl"
+    ++ lib.optionals stdenv.isDarwin [ "--disable-sdltest" "--disable-smpegtest" ];
+
+  meta = with stdenv.lib; {
+    description = "SDL multi-channel audio mixer library";
+    platforms = platforms.unix;
+    homepage = https://www.libsdl.org/projects/SDL_mixer/;
+    maintainers = with maintainers; [ MP2E ];
+    license = licenses.zlib;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/SDL2_net/default.nix b/nixpkgs/pkgs/development/libraries/SDL2_net/default.nix
new file mode 100644
index 000000000000..1cb74ac1b2d3
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/SDL2_net/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, darwin, fetchurl, SDL2 }:
+
+stdenv.mkDerivation rec {
+  name = "SDL2_net-${version}";
+  version = "2.0.1";
+
+  src = fetchurl {
+    url = "https://www.libsdl.org/projects/SDL_net/release/${name}.tar.gz";
+    sha256 = "08cxc1bicmyk89kiks7izw1rlx5ng5n6xpy8fy0zxni3b9z8mkhm";
+  };
+
+  buildInputs = stdenv.lib.optional stdenv.isDarwin darwin.libobjc;
+
+  configureFlags = stdenv.lib.optional stdenv.isDarwin "--disable-sdltest";
+
+  propagatedBuildInputs = [ SDL2 ];
+
+  meta = with stdenv.lib; {
+    description = "SDL multiplatform networking library";
+    homepage = https://www.libsdl.org/projects/SDL_net;
+    license = licenses.zlib;
+    maintainers = with maintainers; [ MP2E ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/SDL2_ttf/default.nix b/nixpkgs/pkgs/development/libraries/SDL2_ttf/default.nix
new file mode 100644
index 000000000000..b219922223fb
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/SDL2_ttf/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, darwin, fetchurl, SDL2, freetype, libGL }:
+
+stdenv.mkDerivation rec {
+  name = "SDL2_ttf-${version}";
+  version = "2.0.15";
+
+  src = fetchurl {
+    url = "https://www.libsdl.org/projects/SDL_ttf/release/${name}.tar.gz";
+    sha256 = "0cyd48dipc0m399qy8s03lci8b0bpiy8xlkvrm2ia7wcv0dfpv59";
+  };
+
+  configureFlags = stdenv.lib.optional stdenv.isDarwin "--disable-sdltest";
+
+  buildInputs = [ SDL2 freetype libGL ]
+    ++ stdenv.lib.optional stdenv.isDarwin darwin.libobjc;
+
+  meta = with stdenv.lib; {
+    description = "SDL TrueType library";
+    platforms = platforms.unix;
+    license = licenses.zlib;
+    homepage = https://www.libsdl.org/projects/SDL_ttf/;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/SDL_gfx/default.nix b/nixpkgs/pkgs/development/libraries/SDL_gfx/default.nix
new file mode 100644
index 000000000000..68c8c16ed4e8
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/SDL_gfx/default.nix
@@ -0,0 +1,44 @@
+{ stdenv, fetchurl, SDL }:
+
+stdenv.mkDerivation rec {
+  name = "SDL_gfx-${version}";
+  version = "2.0.26";
+
+  src = fetchurl {
+    url = "https://www.ferzkopp.net/Software/SDL_gfx-2.0/${name}.tar.gz";
+    sha256 = "0ijljhs0v99dj6y27hc10z6qchyp8gdp4199y6jzngy6dzxlzsvw";
+  };
+
+  buildInputs = [ SDL ] ;
+
+  configureFlags = [ "--disable-mmx" ]
+    ++ stdenv.lib.optional stdenv.isDarwin "--disable-sdltest";
+
+  meta = with stdenv.lib; {
+    description = "SDL graphics drawing primitives and support functions";
+
+    longDescription =
+      '' The SDL_gfx library evolved out of the SDL_gfxPrimitives code
+	 which provided basic drawing routines such as lines, circles or
+	 polygons and SDL_rotozoom which implemented a interpolating
+	 rotozoomer for SDL surfaces.
+
+	 The current components of the SDL_gfx library are:
+
+	    * Graphic Primitives (SDL_gfxPrimitves.h)
+	    * Rotozoomer (SDL_rotozoom.h)
+	    * Framerate control (SDL_framerate.h)
+	    * MMX image filters (SDL_imageFilter.h)
+	    * Custom Blit functions (SDL_gfxBlitFunc.h)
+
+	 The library is backwards compatible to the above mentioned
+         code. Its is written in plain C and can be used in C++ code.
+       '';
+
+    homepage = https://sourceforge.net/projects/sdlgfx/;
+    license = licenses.zlib;
+
+    maintainers = with maintainers; [ bjg ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/SDL_image/default.nix b/nixpkgs/pkgs/development/libraries/SDL_image/default.nix
new file mode 100644
index 000000000000..961a0a7f5aab
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/SDL_image/default.nix
@@ -0,0 +1,31 @@
+{ stdenv, fetchurl, fetchpatch, SDL, libpng, libjpeg, libtiff, libungif, libXpm }:
+
+stdenv.mkDerivation rec {
+  name = "SDL_image-${version}";
+  version = "1.2.12";
+
+  src = fetchurl {
+    url    = "https://www.libsdl.org/projects/SDL_image/release/${name}.tar.gz";
+    sha256 = "16an9slbb8ci7d89wakkmyfvp7c0cval8xw4hkg0842nhhlp540b";
+  };
+
+  patches = [
+    (fetchpatch {
+      name = "CVE-2017-2887";
+      url = "https://hg.libsdl.org/SDL_image/raw-diff/318484db0705/IMG_xcf.c";
+      sha256 = "140dyszz9hkpgwjdiwp1b7jdd8f8l5d862xdaf3ml4cimga1h5kv";
+    })
+  ];
+
+  configureFlags = stdenv.lib.optional stdenv.isDarwin "--disable-sdltest";
+
+  buildInputs = [ SDL libpng libjpeg libtiff libungif libXpm ];
+
+  meta = with stdenv.lib; {
+    description = "SDL image library";
+    homepage    = "http://www.libsdl.org/projects/SDL_image/";
+    maintainers = with maintainers; [ lovek323 ];
+    platforms   = platforms.unix;
+    license     = licenses.zlib;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/SDL_mixer/default.nix b/nixpkgs/pkgs/development/libraries/SDL_mixer/default.nix
new file mode 100644
index 000000000000..887319062be9
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/SDL_mixer/default.nix
@@ -0,0 +1,26 @@
+{ stdenv, lib, fetchurl, SDL, libogg, libvorbis, smpeg, enableNativeMidi ? false, fluidsynth ? null }:
+
+stdenv.mkDerivation rec {
+  pname   = "SDL_mixer";
+  version = "1.2.12";
+  name    = "${pname}-${version}";
+
+  src = fetchurl {
+    url    = "http://www.libsdl.org/projects/${pname}/release/${name}.tar.gz";
+    sha256 = "0alrhqgm40p4c92s26mimg9cm1y7rzr6m0p49687jxd9g6130i0n";
+  };
+
+  buildInputs = [ SDL libogg libvorbis fluidsynth smpeg ];
+
+  configureFlags = [ "--disable-music-ogg-shared" ]
+    ++ lib.optional enableNativeMidi " --enable-music-native-midi-gpl"
+    ++ lib.optionals stdenv.isDarwin [ "--disable-sdltest" "--disable-smpegtest" ];
+
+  meta = with stdenv.lib; {
+    description = "SDL multi-channel audio mixer library";
+    homepage    = http://www.libsdl.org/projects/SDL_mixer/;
+    maintainers = with maintainers; [ lovek323 ];
+    platforms   = platforms.unix;
+    license     = licenses.zlib;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/SDL_net/default.nix b/nixpkgs/pkgs/development/libraries/SDL_net/default.nix
new file mode 100644
index 000000000000..f1c5a5462d11
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/SDL_net/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchurl, SDL }:
+
+stdenv.mkDerivation rec {
+  pname = "SDL_net";
+  version = "1.2.8";
+
+  name = "${pname}-${version}";
+
+  src = fetchurl {
+    url = "http://www.libsdl.org/projects/SDL_net/release/${name}.tar.gz";
+    sha256 = "1d5c9xqlf4s1c01gzv6cxmg0r621pq9kfgxcg3197xw4p25pljjz";
+  };
+
+  configureFlags = stdenv.lib.optional stdenv.isDarwin "--disable-sdltest";
+
+  propagatedBuildInputs = [ SDL ];
+
+  meta = with stdenv.lib; {
+    description = "SDL networking library";
+    platforms = platforms.unix;
+    license = licenses.zlib;
+    homepage = https://www.libsdl.org/projects/SDL_net/release-1.2.html;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/SDL_sixel/default.nix b/nixpkgs/pkgs/development/libraries/SDL_sixel/default.nix
new file mode 100644
index 000000000000..6279bfcb4286
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/SDL_sixel/default.nix
@@ -0,0 +1,26 @@
+{ stdenv, fetchFromGitHub, pkgconfig, libsixel }:
+
+stdenv.mkDerivation rec {
+  name    = "SDL_sixel-${version}";
+  version = "1.2-nightly";
+
+  src = fetchFromGitHub {
+    owner = "saitoha";
+    repo = "SDL1.2-SIXEL";
+    rev = "ab3fccac6e34260a617be511bd8c2b2beae41952";
+    sha256 = "0gm2vngdac17lzw9azkhzazmfq3byjddms14gqjk18vnynfqp5wp";
+  };
+
+  configureFlags = [ "--enable-video-sixel" ];
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ libsixel ];
+
+  meta = with stdenv.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 ];
+    platforms   = platforms.linux;
+    license     = licenses.lgpl21;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/SDL_sound/default.nix b/nixpkgs/pkgs/development/libraries/SDL_sound/default.nix
new file mode 100644
index 000000000000..0e717c530357
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/SDL_sound/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, lib, fetchurl, SDL, libvorbis, flac, libmikmod }:
+
+stdenv.mkDerivation rec {
+  name = "SDL_sound-${version}";
+  version = "1.0.3";
+
+  src = fetchurl {
+    url = "https://icculus.org/SDL_sound/downloads/${name}.tar.gz";
+    sha256 = "1pz6g56gcy7pmmz3hhych3iq9jvinml2yjz15fjqjlj8pc5zv69r";
+  };
+
+  buildInputs = [ SDL libvorbis flac libmikmod ];
+
+  configureFlags = lib.optional stdenv.isDarwin "--disable-sdltest";
+
+  meta = with lib; {
+    description = "SDL sound library";
+    platforms = platforms.unix;
+    license = licenses.lgpl21;
+    homepage = https://www.icculus.org/SDL_sound/;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/SDL_stretch/default.nix b/nixpkgs/pkgs/development/libraries/SDL_stretch/default.nix
new file mode 100644
index 000000000000..7f276387c834
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/SDL_stretch/default.nix
@@ -0,0 +1,20 @@
+{ stdenv, fetchurl, SDL }:
+
+stdenv.mkDerivation rec {
+  name = "SDL_stretch-${version}";
+  version = "0.3.1";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/sdl-stretch/${version}/${name}.tar.bz2";
+    sha256 = "1mzw68sn4yxbp8429jg2h23h8xw2qjid51z1f5pdsghcn3x0pgvw";
+  };
+
+  buildInputs = [ SDL ];
+
+  meta = with stdenv.lib; {
+     description = "Stretch Functions For SDL";
+     homepage = http://sdl-stretch.sourceforge.net/;
+     license = licenses.lgpl2;
+     platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/SDL_ttf/default.nix b/nixpkgs/pkgs/development/libraries/SDL_ttf/default.nix
new file mode 100644
index 000000000000..cf6b53021f79
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/SDL_ttf/default.nix
@@ -0,0 +1,33 @@
+{ stdenv, fetchurl, fetchpatch, SDL, freetype }:
+
+stdenv.mkDerivation rec {
+  name = "SDL_ttf-${version}";
+  version = "2.0.11";
+
+  src = fetchurl {
+    url = "https://www.libsdl.org/projects/SDL_ttf/release/${name}.tar.gz";
+    sha256 = "1dydxd4f5kb1288i5n5568kdk2q7f8mqjr7i7sd33nplxjaxhk3j";
+  };
+
+  patches = [
+    # Bug #830: TTF_RenderGlyph_Shaded is broken
+    (fetchpatch {
+      url = "https://bugzilla-attachments.libsdl.org/attachment.cgi?id=830";
+      sha256 = "0cfznfzg1hs10wl349z9n8chw80i5adl3iwhq4y102g0xrjyb72d";
+    })
+  ];
+
+  patchFlags = [ "-p0" ];
+
+  buildInputs = [ SDL freetype ];
+
+  configureFlags = stdenv.lib.optional stdenv.isDarwin "--disable-sdltest";
+
+  meta = with stdenv.lib; {
+    description = "SDL TrueType library";
+    license = licenses.zlib;
+    platforms = platforms.all;
+    homepage = https://www.libsdl.org/projects/SDL_ttf/release-1.2.html;
+    maintainers = with maintainers; [ abbradar ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/Xaw3d/default.nix b/nixpkgs/pkgs/development/libraries/Xaw3d/default.nix
new file mode 100644
index 000000000000..3e496b7e981f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/Xaw3d/default.nix
@@ -0,0 +1,21 @@
+{ stdenv, fetchurl
+, imake, gccmakedep, bison, flex, pkgconfig
+, xlibsWrapper, libXmu, libXpm, libXp }:
+
+stdenv.mkDerivation {
+  name = "Xaw3d-1.6.3";
+  src = fetchurl {
+    url = https://www.x.org/releases/individual/lib/libXaw3d-1.6.3.tar.bz2;
+    sha256 = "0i653s8g25cc0mimkwid9366bqkbyhdyjhckx7bw77j20hzrkfid";
+  };
+  dontUseImakeConfigure = true;
+  nativeBuildInputs = [ pkgconfig bison flex imake gccmakedep ];
+  buildInputs = [ libXpm libXp ];
+  propagatedBuildInputs = [ xlibsWrapper libXmu ];
+
+  meta = with stdenv.lib; {
+    description = "3D widget set based on the Athena Widget set";
+    platforms = stdenv.lib.platforms.unix;
+    license = licenses.mit;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/a52dec/default.nix b/nixpkgs/pkgs/development/libraries/a52dec/default.nix
new file mode 100644
index 000000000000..5ff5e609723e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/a52dec/default.nix
@@ -0,0 +1,27 @@
+{stdenv, fetchurl}:
+
+stdenv.mkDerivation rec {
+  name = "a52dec-0.7.4p4";
+
+  src = fetchurl {
+    url = "${meta.homepage}/files/a52dec-0.7.4.tar.gz";
+    sha256 = "0czccp4fcpf2ykp16xcrzdfmnircz1ynhls334q374xknd5747d2";
+  };
+
+  configureFlags = [
+    "--enable-shared"
+  ];
+
+  # 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";
+  # but it's better to disable tests than loose ASLR on i686
+  doCheck = !stdenv.isi686;
+
+  meta = {
+    description = "ATSC A/52 stream decoder";
+    homepage = http://liba52.sourceforge.net/;
+    platforms = stdenv.lib.platforms.unix;
+    license = stdenv.lib.licenses.gpl2;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/aacskeys/default.nix b/nixpkgs/pkgs/development/libraries/aacskeys/default.nix
new file mode 100644
index 000000000000..9e28bfd4fe2c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/aacskeys/default.nix
@@ -0,0 +1,47 @@
+{stdenv, fetchurl, openssl, jdk, premake3}:
+
+# Info on how to use / obtain aacs keys:
+# http://vlc-bluray.whoknowsmy.name/
+# https://wiki.archlinux.org/index.php/BluRay
+
+
+let baseName = "aacskeys";
+    version  = "0.4.0e";
+in
+
+stdenv.mkDerivation {
+  name = "${baseName}-${version}";
+
+  patchPhase = ''
+    substituteInPlace "premake.lua" \
+      --replace "/usr/lib/jvm/java-6-sun/include" "${jdk}/include"
+  '';
+
+  src = fetchurl {
+    url = "http://deb-multimedia.org/pool/main/a/${baseName}/${baseName}_${version}.orig.tar.gz";
+    sha256 = "0d3zvwixpkixfkkc16wj37h2xbcq5hsqqhqngzqr6pslmqr67vnr";
+  };
+
+  buildInputs = [openssl jdk premake3];
+
+  installPhase = ''
+    mkdir -p $out/{bin,lib,share/${baseName}}
+
+    # Install lib
+    install -Dm444 lib/linux/libaacskeys.so $out/lib
+
+    # Install program
+    install -Dm555 bin/linux/aacskeys $out/bin
+
+    # Install resources
+    install -Dm444 HostKeyCertificate.txt $out/share/${baseName}
+    install -Dm444 ProcessingDeviceKeysSimple.txt $out/share/${baseName}
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = http://forum.doom9.org/showthread.php?t=123311;
+    description = "A library and program to retrieve decryption keys for HD discs";
+    platforms = platforms.linux;
+    license = licenses.publicDomain;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/aalib/darwin.patch b/nixpkgs/pkgs/development/libraries/aalib/darwin.patch
new file mode 100644
index 000000000000..44559d06210c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/aalib/darwin.patch
@@ -0,0 +1,106 @@
+diff --git a/src/aaedit.c b/src/aaedit.c
+index 09534d2..2ea52f9 100644
+--- a/src/aaedit.c
++++ b/src/aaedit.c
+@@ -1,6 +1,6 @@
+ #include <string.h>
+ #include <ctype.h>
+-#include <malloc.h>
++#include <stdlib.h>
+ #include "aalib.h"
+ #include "aaint.h"
+ static void aa_editdisplay(struct aa_edit *e)
+ 
+diff --git a/src/aakbdreg.c b/src/aakbdreg.c
+index def65fe..f4f8efb 100644
+--- a/src/aakbdreg.c
++++ b/src/aakbdreg.c
+@@ -1,4 +1,4 @@
+-#include <malloc.h>
++#include <stdlib.h>
+ #include "config.h"
+ #include "aalib.h"
+ #include "aaint.h"
+diff --git a/src/aalib.c b/src/aalib.c
+index 11fecc8..e3063b4 100644
+--- a/src/aalib.c
++++ b/src/aalib.c
+@@ -1,6 +1,6 @@
+ #include <stdio.h>
+ #include <string.h>
+-#include <malloc.h>
++#include <stdlib.h>
+ #include "aalib.h"
+ #include "aaint.h"
+ 
+diff --git a/src/aamoureg.c b/src/aamoureg.c
+index 0380828..bb55fe3 100644
+--- a/src/aamoureg.c
++++ b/src/aamoureg.c
+@@ -1,4 +1,4 @@
+-#include <malloc.h>
++#include <stdlib.h>
+ #include "config.h"
+ #include "aalib.h"
+ #include "aaint.h"
+diff --git a/src/aarec.c b/src/aarec.c
+index 70f4ebc..ee43e8a 100644
+--- a/src/aarec.c
++++ b/src/aarec.c
+@@ -1,5 +1,5 @@
+ #include <string.h>
+-#include <malloc.h>
++#include <stdlib.h>
+ #include "aalib.h"
+ #include "aaint.h"
+ aa_linkedlist *aa_kbdrecommended = NULL, *aa_mouserecommended = NULL,
+diff --git a/src/aaregist.c b/src/aaregist.c
+index 54abec0..765155e 100644
+--- a/src/aaregist.c
++++ b/src/aaregist.c
+@@ -1,4 +1,4 @@
+-#include <malloc.h>
++#include <stdlib.h>
+ #include "config.h"
+ #include "aalib.h"
+ #include "aaint.h"
+diff --git a/src/aax.c b/src/aax.c
+index adcbd82..36e3294 100644
+--- a/src/aax.c
++++ b/src/aax.c
+@@ -1,4 +1,3 @@
+-#include <malloc.h>
+ #include <stdlib.h>
+ #include <string.h>
+ #include <stdio.h>
+diff --git a/src/aaxkbd.c b/src/aaxkbd.c
+index 30d5903..da2248d 100644
+--- a/src/aaxkbd.c
++++ b/src/aaxkbd.c
+@@ -1,4 +1,3 @@
+-#include <malloc.h>
+ #include <stdlib.h>
+ #include <string.h>
+ #include <stdio.h>
+diff --git a/src/aaxmouse.c b/src/aaxmouse.c
+index 9935b03..7e725ad 100644
+--- a/src/aaxmouse.c
++++ b/src/aaxmouse.c
+@@ -1,4 +1,3 @@
+-#include <malloc.h>
+ #include <stdlib.h>
+ #include <string.h>
+ #include <stdio.h>
+diff --git a/aalib.m4 b/aalib.m4
+index c40b8db..991fbda 100644
+--- a/aalib.m4
++++ b/aalib.m4
+@@ -9,7 +9,7 @@
+ dnl AM_PATH_AALIB([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
+ dnl Test for AALIB, and define AALIB_CFLAGS and AALIB_LIBS
+ dnl
+-AC_DEFUN(AM_PATH_AALIB,
++AC_DEFUN([AM_PATH_AALIB],
+ [dnl 
+ dnl Get the cflags and libraries from the aalib-config script
+ dnl
diff --git a/nixpkgs/pkgs/development/libraries/aalib/default.nix b/nixpkgs/pkgs/development/libraries/aalib/default.nix
new file mode 100644
index 000000000000..8b1878b0cc30
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/aalib/default.nix
@@ -0,0 +1,41 @@
+{stdenv, fetchurl, ncurses, automake}:
+
+stdenv.mkDerivation {
+  name = "aalib-1.4rc5";
+
+  src = fetchurl {
+    url = mirror://sourceforge/aa-project/aalib-1.4rc5.tar.gz;
+    sha256 = "1vkh19gb76agvh4h87ysbrgy82hrw88lnsvhynjf4vng629dmpgv";
+  };
+
+  outputs = [ "bin" "dev" "out" "man" "info" ];
+  setOutputFlags = false; # Doesn't support all the flags
+
+  patches = stdenv.lib.optionals stdenv.isDarwin [ ./darwin.patch ];
+
+  # The fuloong2f is not supported by aalib still
+  preConfigure = ''
+    cp ${automake}/share/automake*/config.{sub,guess} .
+    configureFlagsArray+=(
+      "--bindir=$bin/bin"
+      "--includedir=$dev/include"
+      "--libdir=$out/lib"
+    )
+  '';
+
+  buildInputs = [ ncurses ];
+
+  configureFlags = [ "--without-x" "--with-ncurses=${ncurses.dev}" ];
+
+  postInstall = ''
+    mkdir -p $dev/bin
+    mv $bin/bin/aalib-config $dev/bin/aalib-config
+    substituteInPlace $out/lib/libaa.la --replace "${ncurses.dev}/lib" "${ncurses.out}/lib"
+  '';
+
+  meta = {
+    description = "ASCII art graphics library";
+    platforms = stdenv.lib.platforms.unix;
+    license = stdenv.lib.licenses.lgpl2;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/abseil-cpp/default.nix b/nixpkgs/pkgs/development/libraries/abseil-cpp/default.nix
new file mode 100644
index 000000000000..4e1da8666227
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/abseil-cpp/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchFromGitHub, cmake }:
+
+stdenv.mkDerivation rec {
+  name = "abseil-cpp-${version}";
+  date = "20190322";
+  rev = "eab2078b53c9e3d9d240135c09d27e3393acb50a";
+  version = "${date}-${rev}";
+
+  src = fetchFromGitHub {
+    owner = "abseil";
+    repo = "abseil-cpp";
+    rev = "${rev}";
+    sha256 = "1bpz44hxq5fpkv6jlgphzk7mxjiiah526jgb63ih5pd1hd2cfw1r";
+  };
+
+  nativeBuildInputs = [ cmake ];
+
+  meta = with stdenv.lib; {
+    description = "An open-source collection of C++ code designed to augment the C++ standard library";
+    homepage = https://abseil.io/;
+    license = licenses.asl20;
+    maintainers = [ maintainers.andersk ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/accounts-qt/default.nix b/nixpkgs/pkgs/development/libraries/accounts-qt/default.nix
new file mode 100644
index 000000000000..a50c92924e9a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/accounts-qt/default.nix
@@ -0,0 +1,30 @@
+{ stdenv, fetchFromGitLab, doxygen, glib, libaccounts-glib, pkgconfig, qtbase, qmake }:
+
+stdenv.mkDerivation rec {
+  name = "accounts-qt-${version}";
+  version = "1.15";
+
+  src = fetchFromGitLab {
+    sha256 = "0cnra7g2mcgzh8ykrj1dpb4khkx676pzdr4ia1bvsp0cli48691w";
+    rev = "VERSION_${version}";
+    repo = "libaccounts-qt";
+    owner = "accounts-sso";
+  };
+
+  buildInputs = [ glib libaccounts-glib qtbase ];
+  nativeBuildInputs = [ doxygen pkgconfig qmake ];
+
+  preConfigure = ''
+    qmakeFlags="$qmakeFlags LIBDIR=$out/lib CMAKE_CONFIG_PATH=$out/lib/cmake"
+  '';
+
+  # Hack to avoid TMPDIR in RPATHs.
+  preFixup = ''rm -rf "$(pwd)" '';
+
+  meta = with stdenv.lib; {
+    description = "Qt library for accessing the online accounts database";
+    homepage = https://gitlab.com/accounts-sso;
+    license = licenses.lgpl21;
+    platforms = with platforms; linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/accountsservice/Disable-methods-that-change-files-in-etc.patch b/nixpkgs/pkgs/development/libraries/accountsservice/Disable-methods-that-change-files-in-etc.patch
new file mode 100644
index 000000000000..acaccb8c8485
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/accountsservice/Disable-methods-that-change-files-in-etc.patch
@@ -0,0 +1,130 @@
+From 6f172007452b39bfda5062fc29ea5382671ac16e Mon Sep 17 00:00:00 2001
+From: Alexander Ried <ried@mytum.de>
+Date: Thu, 26 May 2016 19:54:21 +0200
+Subject: [PATCH] Disable methods that change files in /etc
+
+Only if environment variable NIXOS_USERS_PURE is set.
+---
+ src/daemon.c | 10 ++++++++++
+ src/user.c   | 35 +++++++++++++++++++++++++++++++++++
+ 2 files changed, 45 insertions(+)
+
+diff --git a/src/daemon.c b/src/daemon.c
+index e62e124..87459b2 100644
+--- a/src/daemon.c
++++ b/src/daemon.c
+@@ -931,6 +931,11 @@ daemon_create_user (AccountsAccounts      *accounts,
+                     const gchar           *real_name,
+                     gint                   account_type)
+ {
++        if (getenv("NIXOS_USERS_PURE")) {
++                throw_error (context, ERROR_NOT_SUPPORTED, "Modifying users not supported without users.mutableUsers");
++                return;
++        }
++
+         Daemon *daemon = (Daemon*)accounts;
+         CreateUserData *data;
+ 
+@@ -1138,6 +1143,11 @@ daemon_delete_user (AccountsAccounts      *accounts,
+                     gint64                 uid,
+                     gboolean               remove_files)
+ {
++        if (getenv("NIXOS_USERS_PURE")) {
++                throw_error (context, ERROR_NOT_SUPPORTED, "Modifying users not supported without users.mutableUsers");
++                return;
++        }
++
+         Daemon *daemon = (Daemon*)accounts;
+         DeleteUserData *data;
+ 
+diff --git a/src/user.c b/src/user.c
+index 0fb1a17..dbdebaf 100644
+--- a/src/user.c
++++ b/src/user.c
+@@ -904,6 +904,11 @@ user_set_real_name (AccountsUser          *auser,
+                     GDBusMethodInvocation *context,
+                     const gchar           *real_name)
+ {
++        if (getenv("NIXOS_USERS_PURE")) {
++                throw_error (context, ERROR_NOT_SUPPORTED, "Modifying users not supported without users.mutableUsers");
++                return;
++        }
++
+         User *user = (User*)auser;
+         int uid;
+         const gchar *action_id;
+@@ -981,6 +986,11 @@ user_set_user_name (AccountsUser          *auser,
+                     GDBusMethodInvocation *context,
+                     const gchar           *user_name)
+ {
++        if (getenv("NIXOS_USERS_PURE")) {
++                throw_error (context, ERROR_NOT_SUPPORTED, "Modifying users not supported without users.mutableUsers");
++                return;
++        }
++
+         User *user = (User*)auser;
+         daemon_local_check_auth (user->daemon,
+                                  user,
+@@ -1263,6 +1273,11 @@ user_set_home_directory (AccountsUser          *auser,
+                          GDBusMethodInvocation *context,
+                          const gchar           *home_dir)
+ {
++        if (getenv("NIXOS_USERS_PURE")) {
++                throw_error (context, ERROR_NOT_SUPPORTED, "Modifying users not supported without users.mutableUsers");
++                return;
++        }
++
+         User *user = (User*)auser;
+         daemon_local_check_auth (user->daemon,
+                                  user,
+@@ -1322,6 +1337,11 @@ user_set_shell (AccountsUser          *auser,
+                 GDBusMethodInvocation *context,
+                 const gchar           *shell)
+ {
++        if (getenv("NIXOS_USERS_PURE")) {
++                throw_error (context, ERROR_NOT_SUPPORTED, "Modifying users not supported without users.mutableUsers");
++                return;
++        }
++
+         User *user = (User*)auser;
+         daemon_local_check_auth (user->daemon,
+                                  user,
+@@ -1602,6 +1622,11 @@ user_set_locked (AccountsUser          *auser,
+                  GDBusMethodInvocation *context,
+                  gboolean               locked)
+ {
++        if (getenv("NIXOS_USERS_PURE")) {
++                throw_error (context, ERROR_NOT_SUPPORTED, "Modifying users not supported without users.mutableUsers");
++                return;
++        }
++
+         User *user = (User*)auser;
+         daemon_local_check_auth (user->daemon,
+                                  user,
+@@ -1814,6 +1839,11 @@ user_set_password_mode (AccountsUser          *auser,
+                         GDBusMethodInvocation *context,
+                         gint                   mode)
+ {
++        if (getenv("NIXOS_USERS_PURE")) {
++                throw_error (context, ERROR_NOT_SUPPORTED, "Modifying users not supported without users.mutableUsers");
++                return;
++        }
++
+         User *user = (User*)auser;
+         const gchar *action_id;
+ 
+@@ -1905,6 +1935,11 @@ user_set_password (AccountsUser          *auser,
+                    const gchar           *password,
+                    const gchar           *hint)
+ {
++        if (getenv("NIXOS_USERS_PURE")) {
++                throw_error (context, ERROR_NOT_SUPPORTED, "Modifying users not supported without users.mutableUsers");
++                return;
++        }
++
+         User *user = (User*)auser;
+         gchar **data;
+ 
+-- 
+2.9.3
+
diff --git a/nixpkgs/pkgs/development/libraries/accountsservice/default.nix b/nixpkgs/pkgs/development/libraries/accountsservice/default.nix
new file mode 100644
index 000000000000..c20167138b72
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/accountsservice/default.nix
@@ -0,0 +1,50 @@
+{ stdenv, fetchurl, pkgconfig, glib, intltool, makeWrapper, shadow
+, gobject-introspection, polkit, systemd, coreutils, meson, dbus
+, ninja, python3 }:
+
+stdenv.mkDerivation rec {
+  name = "accountsservice-${version}";
+  version = "0.6.55";
+
+  src = fetchurl {
+    url = "https://www.freedesktop.org/software/accountsservice/accountsservice-${version}.tar.xz";
+    sha256 = "16wwd633jak9ajyr1f1h047rmd09fhf3kzjz6g5xjsz0lwcj8azz";
+  };
+
+  nativeBuildInputs = [ pkgconfig makeWrapper meson ninja python3 ];
+
+  buildInputs = [ glib intltool gobject-introspection polkit systemd dbus ];
+
+  mesonFlags = [ "-Dsystemdsystemunitdir=etc/systemd/system"
+                 "-Dlocalstatedir=/var" ];
+  prePatch = ''
+    chmod +x meson_post_install.py
+    patchShebangs meson_post_install.py
+
+    substituteInPlace src/daemon.c --replace '"/usr/sbin/useradd"' '"${shadow}/bin/useradd"' \
+                                   --replace '"/usr/sbin/userdel"' '"${shadow}/bin/userdel"'
+    substituteInPlace src/user.c   --replace '"/usr/sbin/usermod"' '"${shadow}/bin/usermod"' \
+                                   --replace '"/usr/bin/chage"' '"${shadow}/bin/chage"' \
+                                   --replace '"/usr/bin/passwd"' '"${shadow}/bin/passwd"' \
+                                   --replace '"/bin/cat"' '"${coreutils}/bin/cat"'
+  '';
+
+  patches = [
+    ./no-create-dirs.patch
+    ./Disable-methods-that-change-files-in-etc.patch
+  ];
+
+  preFixup = ''
+    wrapProgram "$out/libexec/accounts-daemon" \
+      --run "${coreutils}/bin/mkdir -p /var/lib/AccountsService/users" \
+      --run "${coreutils}/bin/mkdir -p /var/lib/AccountsService/icons"
+  '';
+
+  meta = with stdenv.lib; {
+    description = "D-Bus interface for user account query and manipulation";
+    homepage = https://www.freedesktop.org/wiki/Software/AccountsService;
+    license = licenses.gpl3;
+    maintainers = with maintainers; [ pSub ];
+    platforms = with platforms; linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/accountsservice/no-create-dirs.patch b/nixpkgs/pkgs/development/libraries/accountsservice/no-create-dirs.patch
new file mode 100644
index 000000000000..0333f925d267
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/accountsservice/no-create-dirs.patch
@@ -0,0 +1,15 @@
+diff --git a/meson_post_install.py b/meson_post_install.py
+index 5cc2dc4..dd27ad5 100644
+--- a/meson_post_install.py
++++ b/meson_post_install.py
+@@ -9,8 +9,8 @@ localstatedir = os.path.normpath(destdir + os.sep + sys.argv[1])
+ # FIXME: meson will not track the creation of these directories
+ #        https://github.com/mesonbuild/meson/blob/master/mesonbuild/scripts/uninstall.py#L39
+ dst_dirs = [
+-  (os.path.join(localstatedir, 'lib', 'AccountsService', 'icons'), 0o775),
+-  (os.path.join(localstatedir, 'lib', 'AccountsService', 'users'), 0o700),
++#  (os.path.join(localstatedir, 'lib', 'AccountsService', 'icons'), 0o775),
++#  (os.path.join(localstatedir, 'lib', 'AccountsService', 'users'), 0o700),
+ ]
+ 
+ for (dst_dir, dst_dir_mode) in dst_dirs:
diff --git a/nixpkgs/pkgs/development/libraries/ace/default.nix b/nixpkgs/pkgs/development/libraries/ace/default.nix
new file mode 100644
index 000000000000..e0c46acb6303
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/ace/default.nix
@@ -0,0 +1,36 @@
+{ stdenv, fetchurl, pkgconfig, libtool, perl }:
+
+stdenv.mkDerivation rec {
+  name = "ace-${version}";
+  version = "6.5.5";
+
+  src = fetchurl {
+    url = "http://download.dre.vanderbilt.edu/previous_versions/ACE-${version}.tar.bz2";
+    sha256 = "1r1bvy65n50l6lbxm1k1bscqcv29mpkgp0pgr5cvvv7ldisrjl39";
+  };
+
+  enableParallelBuilding = true;
+
+  nativeBuildInputs = [ pkgconfig libtool ];
+  buildInputs = [ perl ];
+
+  patchPhase = ''substituteInPlace ./MPC/prj_install.pl \
+    --replace /usr/bin/perl "${perl}/bin/perl"'';
+  
+  preConfigure = ''
+    export INSTALL_PREFIX=$out
+    export ACE_ROOT=$(pwd)
+    export LD_LIBRARY_PATH="$ACE_ROOT/ace:$ACE_ROOT/lib"
+    echo '#include "ace/config-linux.h"' > ace/config.h
+    echo 'include $(ACE_ROOT)/include/makeinclude/platform_linux.GNU'\
+    > include/makeinclude/platform_macros.GNU
+  '';
+
+  meta = with stdenv.lib; {
+    description = "ADAPTIVE Communication Environment";
+    homepage = http://www.dre.vanderbilt.edu/~schmidt/ACE.html;
+    license = licenses.doc;
+    platforms = platforms.linux;
+    maintainers = [ maintainers.nico202 ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/acl/default.nix b/nixpkgs/pkgs/development/libraries/acl/default.nix
new file mode 100644
index 000000000000..4b280cc18621
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/acl/default.nix
@@ -0,0 +1,31 @@
+{ stdenv, fetchurl, gettext, attr }:
+
+stdenv.mkDerivation rec {
+  name = "acl-2.2.53";
+
+  src = fetchurl {
+    url = "mirror://savannah/acl/${name}.tar.gz";
+    sha256 = "1ir6my3w74s6nfbgbqgzj6w570sn0qjf3524zx8xh67lqrjrigh6";
+  };
+
+  outputs = [ "bin" "dev" "out" "man" "doc" ];
+
+  nativeBuildInputs = [ gettext ];
+  buildInputs = [ attr ];
+
+  # Upstream use C++-style comments in C code. Remove them.
+  # This comment breaks compilation if too strict gcc flags are used.
+  patchPhase = ''
+    echo "Removing C++-style comments from include/acl.h"
+    sed -e '/^\/\//d' -i include/acl.h
+
+    patchShebangs .
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = "https://savannah.nongnu.org/projects/acl";
+    description = "Library and tools for manipulating access control lists";
+    platforms = platforms.linux;
+    license = licenses.gpl2Plus;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/adns/default.nix b/nixpkgs/pkgs/development/libraries/adns/default.nix
new file mode 100644
index 000000000000..76e49768d53d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/adns/default.nix
@@ -0,0 +1,36 @@
+{ stdenv, fetchurl }:
+
+let
+  version = "1.5.1";
+in
+stdenv.mkDerivation {
+  name = "adns-${version}";
+
+  src = fetchurl {
+    urls = [
+      "https://www.chiark.greenend.org.uk/~ian/adns/ftp/adns-${version}.tar.gz"
+      "ftp://ftp.chiark.greenend.org.uk/users/ian/adns/adns-${version}.tar.gz"
+      "mirror://gnu/adns/adns-${version}.tar.gz"
+    ];
+    sha256 = "1ssfh94ck6kn98nf2yy6743srpgqgd167va5ja3bwx42igqjc42v";
+  };
+
+  preConfigure =
+    stdenv.lib.optionalString stdenv.isDarwin "sed -i -e 's|-Wl,-soname=$(SHLIBSONAME)||' configure";
+
+  # https://www.mail-archive.com/nix-dev@cs.uu.nl/msg01347.html for details.
+  doCheck = false;
+
+  postInstall = stdenv.lib.optionalString stdenv.isDarwin ''
+    install_name_tool -id $out/lib/libadns.so.1.5 $out/lib/libadns.so.1.5
+  '';
+
+  meta = {
+    homepage = http://www.chiark.greenend.org.uk/~ian/adns/;
+    description = "Asynchronous DNS Resolver Library";
+    license = stdenv.lib.licenses.lgpl2;
+
+    platforms = stdenv.lib.platforms.unix;
+    maintainers = [ stdenv.lib.maintainers.peti ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/afflib/default.nix b/nixpkgs/pkgs/development/libraries/afflib/default.nix
new file mode 100644
index 000000000000..5170e384f77b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/afflib/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchFromGitHub, zlib, curl, expat, fuse, openssl
+, autoreconfHook, python3
+}:
+
+stdenv.mkDerivation rec {
+  version = "3.7.18";
+  name = "afflib-${version}";
+
+  src = fetchFromGitHub {
+    owner = "sshock";
+    repo = "AFFLIBv3";
+    rev = "v${version}";
+    sha256 = "0963gw316p4nyxa9zxmgif29p8i99k898av2g78g28dxafqj3w8c";
+  };
+
+  nativeBuildInputs = [ autoreconfHook ];
+  buildInputs = [ zlib curl expat fuse openssl python3 ];
+
+  meta = {
+    homepage = http://afflib.sourceforge.net/;
+    description = "Advanced forensic format library";
+    platforms = stdenv.lib.platforms.linux;
+    license = stdenv.lib.licenses.bsdOriginal;
+    maintainers = [ stdenv.lib.maintainers.raskin ];
+    inherit version;
+    downloadPage = "https://github.com/sshock/AFFLIBv3/tags";
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/aften/default.nix b/nixpkgs/pkgs/development/libraries/aften/default.nix
new file mode 100644
index 000000000000..22e91ee61d7a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/aften/default.nix
@@ -0,0 +1,21 @@
+{ stdenv, fetchurl, cmake }:
+
+stdenv.mkDerivation rec {
+	name = "aften-${version}";
+	version = "0.0.8";
+	src = fetchurl {
+		url = "mirror://sourceforge/aften/${name}.tar.bz2";
+		sha256 = "02hc5x9vkgng1v9bzvza9985ifrjd7fjr7nlpvazp4mv6dr89k47";
+	};
+
+	nativeBuildInputs = [ cmake ];
+
+	cmakeFlags = [ "-DSHARED=ON" ];
+
+	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;
+		platforms = [ "i686-linux" "x86_64-linux" "x86_64-darwin" ];
+	};
+}
diff --git a/nixpkgs/pkgs/development/libraries/agda/Agda-Sheaves/default.nix b/nixpkgs/pkgs/development/libraries/agda/Agda-Sheaves/default.nix
new file mode 100644
index 000000000000..6ab7455915cc
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/agda/Agda-Sheaves/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, agda, fetchgit }:
+
+agda.mkDerivation (self: rec {
+  version = "8a06162a8f0f7df308458db91d720cf8f7345d69";
+  name = "Agda-Sheaves-${version}";
+  src = fetchgit {
+    url = "https://github.com/jonsterling/Agda-Sheaves.git";
+    rev = version;
+    sha256 = "1gjffyyi4gk9z380yw2wm0jg0a01zy8dnw7jrcc7222swisk5s2d";
+  };
+
+  everythingFile = "sheaves.agda";
+  topSourceDirectories = [ "../$sourceRoot" ];
+  sourceDirectories = [];
+
+  meta = {
+    homepage = https://github.com/jonsterling/Agda-Sheaves;
+    description = "Sheaves in Agda";
+    license = stdenv.lib.licenses.cc-by-40;
+    platforms = stdenv.lib.platforms.unix;
+    maintainers = with stdenv.lib.maintainers; [ fuuzetsu ];
+    broken = true;  # replaced by constructive-sheaf-semantics
+  };
+})
diff --git a/nixpkgs/pkgs/development/libraries/agda/TotalParserCombinators/contextfile b/nixpkgs/pkgs/development/libraries/agda/TotalParserCombinators/contextfile
new file mode 100644
index 000000000000..46743cba3b67
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/agda/TotalParserCombinators/contextfile
@@ -0,0 +1,259 @@
+
+Context:
+
+[Updated the code in response to changes to Agda.
+Nils Anders Danielsson <nils.anders.danielsson@gmail.com>**20150319181310
+ Ignore-this: 52b9ff613d7f10b0c8f45591a0759d07
+] 
+
+[Rolled back most of "Updated the code in response to changes to Agda".
+Nils Anders Danielsson <nils.anders.danielsson@gmail.com>**20150319101420
+ Ignore-this: c2ea7bdf79848235fa3ea64ebda116eb
+ * One of the Agda changes has been reverted.
+] 
+
+[Removed an outdated comment.
+Nils Anders Danielsson <nils.anders.danielsson@gmail.com>**20150217162945
+ Ignore-this: 3ff7732335750305fe220e65693f0cbf
+] 
+
+[Added the simplification "nonempty (return x) → fail".
+Nils Anders Danielsson <nils.anders.danielsson@gmail.com>**20150217161718
+ Ignore-this: 56ad6a68c314446d8986a8c1b49655d0
+] 
+
+[Added Nonempty.nonempty-return.
+Nils Anders Danielsson <nils.anders.danielsson@gmail.com>**20150217161629
+ Ignore-this: 68829d3f9a248272c46848daa05ccfe3
+] 
+
+[Updated the copyright year range.
+Nils Anders Danielsson <nils.anders.danielsson@gmail.com>**20150212154744
+ Ignore-this: 3410a12ca1f9de825b00e692b136d500
+] 
+
+[Updated the code in response to changes to Agda.
+Nils Anders Danielsson <nils.anders.danielsson@gmail.com>**20150212152207
+ Ignore-this: 683b5eeca5fa9c8490bceaf68c23a204
+] 
+
+[Updated the copyright year range.
+Nils Anders Danielsson <nils.anders.danielsson@gmail.com>**20141128223227
+ Ignore-this: 31d3f5e4fdd6fbfad9758d9bfd0d3a3e
+] 
+
+[Updated the code in response to changes to Agda and the library.
+Nils Anders Danielsson <nils.anders.danielsson@gmail.com>**20141128223205
+ Ignore-this: 6392ec67aab2c534a7195abed55be47
+] 
+
+[Updated code to reflect changes to Agda.
+Nils Anders Danielsson <nils.anders.danielsson@gmail.com>**20140425121055
+ Ignore-this: 54d80fd647cb897eef85f57e9172f7db
+] 
+
+[Workaround for (possible) Agda bug.
+Nils Anders Danielsson <nils.anders.danielsson@gmail.com>**20140228200347
+ Ignore-this: b17884ad17a3bdb7faff678622365a8
+] 
+
+[Updated code to reflect changes to library API.
+Nils Anders Danielsson <nils.anders.danielsson@gmail.com>**20130307134644
+ Ignore-this: 50d070a22a6796b9acdf19d44ba5de16
+] 
+
+[Updated code to reflect changes to Agda and the library API.
+Nils Anders Danielsson <nils.anders.danielsson@gmail.com>**20130228122951
+ Ignore-this: 761dc4d85683a59cc3667a8706c88093
+] 
+
+[Turned _◇_ into a constructor.
+Nils Anders Danielsson <nils.anders.danielsson@gmail.com>**20120316125431
+ Ignore-this: 41b492c3106a575f28f146253f78a5ae
+] 
+
+[Updated code to reflect changes to Agda.
+Nils Anders Danielsson <nils.anders.danielsson@gmail.com>**20120316125416
+ Ignore-this: e77d817d8b391c3b4806119d10848eb3
+] 
+
+[Updated code to reflect changes to Agda.
+Nils Anders Danielsson <nils.anders.danielsson@gmail.com>**20120215103344
+ Ignore-this: 467716429d5553cd122722108ea82a08
+] 
+
+[Modified a comment.
+Nils Anders Danielsson <nils.anders.danielsson@gmail.com>**20120215103319
+ Ignore-this: e57d4911f692f8a96a80017d910efc5f
+] 
+
+[Updated code to reflect change to library API.
+Nils Anders Danielsson <nils.anders.danielsson@gmail.com>**20111006160229
+ Ignore-this: 5359da54e7e6e0f92983fa3ecaccebf3
+] 
+
+[Updated code to reflect changes to Agda and the library API.
+Nils Anders Danielsson <nils.anders.danielsson@gmail.com>**20111003170117
+ Ignore-this: cbdd35172e372779e12642985cf17268
+] 
+
+[Rolled back addition of inversion lemmas.
+Nils Anders Danielsson <nils.anders.danielsson@gmail.com>**20110930150912
+ Ignore-this: 9c9b083f0afcf95aaaa55a01d871274e
+] 
+
+[Added inversion lemmas, implemented other lemmas using these lemmas.
+Nils Anders Danielsson <nils.anders.danielsson@gmail.com>**20110930150842
+ Ignore-this: 19b832c3f9e14d1e713b5911c094a130
+ + This change was a response to a change to Agda's pattern matching
+   machinery. Subsequently the machinery was made more liberal again,
+   making this change unnecessary.
+] 
+
+[Updated code to reflect changes to library API.
+Nils Anders Danielsson <nils.anders.danielsson@gmail.com>**20110517220158
+ Ignore-this: ea9771a5014a25cb20afc2118638f8b5
+] 
+
+[Updated code to reflect changes to Agda.
+Nils Anders Danielsson <nils.anders.danielsson@gmail.com>**20110512124425
+ Ignore-this: 97b154661679f574f6ab914583b14580
+] 
+
+[Proved that many constructions preserve various preorders.
+Nils Anders Danielsson <nils.anders.danielsson@gmail.com>**20110313012617
+ Ignore-this: 8008efaff967c228448baa33b82edb81
+] 
+
+[Updated code to reflect changes to library API.
+Nils Anders Danielsson <nils.anders.danielsson@gmail.com>**20110313002106
+ Ignore-this: 94799ba1ae411e59fd8c6c7eac3b8dfb
+] 
+
+[Simplified TotalRecognisers.LeftRecursion.MatchingParentheses.
+Nils Anders Danielsson <nils.anders.danielsson@gmail.com>**20110118102159
+ Ignore-this: 1e01a8092b0c0124979ffc5fe17a245c
+] 
+
+[Added TotalRecognisers.LeftRecursion.MatchingParentheses.
+Nils Anders Danielsson <nils.anders.danielsson@gmail.com>**20110118102146
+ Ignore-this: 13a3bc91425364e26c3047561655bb25
+] 
+
+[Added a simplifying backend.
+Nils Anders Danielsson <nils.anders.danielsson@gmail.com>**20101229012716
+ Ignore-this: 9ac7ae21cd44c099633678a994fb9a3
+] 
+
+[Fixed another "bug" in the deep simplifier.
+Nils Anders Danielsson <nils.anders.danielsson@gmail.com>**20101229010854
+ Ignore-this: e258adf963436ef715242db23c6808e
+ + Sometimes the first layer of bind's right-hand argument was not
+   simplified.
+] 
+
+[Made simplify₁ public and changed its type.
+Nils Anders Danielsson <nils.anders.danielsson@gmail.com>**20101228235603
+ Ignore-this: d39b8453a15089126261e098080223c6
+] 
+
+[Deep simplification no longer adds casts.
+Nils Anders Danielsson <nils.anders.danielsson@gmail.com>**20101228192850
+ Ignore-this: 2ba016825adfa3a1e36922869eabfd39
+] 
+
+[The first constructor in a simplified parser can no longer be a cast.
+Nils Anders Danielsson <nils.anders.danielsson@gmail.com>**20101228175822
+ Ignore-this: ce3e38cc0b9a096aa436655c9013ae97
+] 
+
+[Modified the outline.
+Nils Anders Danielsson <nils.anders.danielsson@gmail.com>**20101228173414
+ Ignore-this: f8866e69f6d1a344e79fb6f708dfa4c
+] 
+
+[Added an example: a right recursive expression grammar.
+Nils Anders Danielsson <nils.anders.danielsson@gmail.com>**20101228173159
+ Ignore-this: 9a4d732b451cca08ba19aac5d115c678
+] 
+
+[Rearranged the code.
+Nils Anders Danielsson <nils.anders.danielsson@gmail.com>**20101228172209
+ Ignore-this: 50fa29406d0f150669ff3feec4dbe513
+] 
+
+[Renamed same-bag/set to (initial-bag-)cong.
+Nils Anders Danielsson <nils.anders.danielsson@gmail.com>**20101228170706
+ Ignore-this: dd3ce43d77dde74cc2428d2568dd2d30
+] 
+
+[Added TotalParserCombinators.Force.
+Nils Anders Danielsson <nils.anders.danielsson@gmail.com>**20101228153638
+ Ignore-this: 3b6ff6ea20df0c1293494f06845d17eb
+] 
+
+[Proved that uses of subst can be erased.
+Nils Anders Danielsson <nils.anders.danielsson@gmail.com>**20101228153621
+ Ignore-this: f503ba495b923ae521718b6957167128
+] 
+
+[The deep simplifier no longer skips layers.
+Nils Anders Danielsson <nils.anders.danielsson@gmail.com>**20101228141138
+ Ignore-this: 733a4a4a9aa0f890ad1740ecfc6a599f
+] 
+
+[Documented that the deep simplifier misses every second layer.
+Nils Anders Danielsson <nils.anders.danielsson@gmail.com>**20101228121910
+ Ignore-this: 8a0baf25b12f63f8748dbc1d16affacf
+] 
+
+[The simplifier now applies the token-bind rule more often.
+Nils Anders Danielsson <nils.anders.danielsson@gmail.com>**20101227165413
+ Ignore-this: 40132fa6f19602886bbe29aadd8a683c
+] 
+
+[Switched back to deep simplification, now with a proper proof.
+Nils Anders Danielsson <nils.anders.danielsson@gmail.com>**20101227125434
+ Ignore-this: ccc46e82f6f9c6c2a27ddb43d315f7dd
+] 
+
+[Simplified the soundness proof.
+Nils Anders Danielsson <nils.anders.danielsson@gmail.com>**20101227123839
+ Ignore-this: fb6826dd9836e34fc3bfdce2928ba13d
+] 
+
+[Made some _≈[_]P_ constructors conditionally coinductive.
+Nils Anders Danielsson <nils.anders.danielsson@gmail.com>**20101227123827
+ Ignore-this: f521f70475403697229051b62343a080
+ + The structure of the soundness proof was also changed.
+] 
+
+[Unified And, AsymmetricChoice and Not.
+Nils Anders Danielsson <nils.anders.danielsson@gmail.com>**20101225103109
+ Ignore-this: 5ae8b80e1505fe6e707bb2307d22688c
+] 
+
+[Modified some comments.
+Nils Anders Danielsson <nils.anders.danielsson@gmail.com>**20101225101051
+ Ignore-this: e812d8c3e9720895c368f7a286f8315c
+] 
+
+[Modified a comment.
+Nils Anders Danielsson <nils.anders.danielsson@gmail.com>**20101223202647
+ Ignore-this: 16ea5dc01a4cbe0fe38714b2e4b7ff6
+] 
+
+[Updated code to reflect changes to library API.
+Nils Anders Danielsson <nils.anders.danielsson@gmail.com>**20101107162658
+ Ignore-this: 9e38a10a9997c9825ece6ad9f871b673
+] 
+
+[Added an alternative backend for TotalRecognisers.Simple.
+Nils Anders Danielsson <nils.anders.danielsson@gmail.com>**20101020183743
+ Ignore-this: a111a89e0c237e132b649561000f53d6
+] 
+
+[TAG Code corresponding to the paper "Total Parser Combinators" (4).
+Nils Anders Danielsson <nils.anders.danielsson@gmail.com>**20100928013815
+ Ignore-this: 45ccc28373ed3974047315613eb14833
+] 
diff --git a/nixpkgs/pkgs/development/libraries/agda/TotalParserCombinators/default.nix b/nixpkgs/pkgs/development/libraries/agda/TotalParserCombinators/default.nix
new file mode 100644
index 000000000000..ac9ce9dd84f4
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/agda/TotalParserCombinators/default.nix
@@ -0,0 +1,26 @@
+{ stdenv, agda, fetchdarcs, AgdaStdlib }:
+
+agda.mkDerivation (self: rec {
+  version = "2015-03-19";
+  name = "TotalParserCombinators-${version}";
+
+  src = fetchdarcs {
+    url = "http://www.cse.chalmers.se/~nad/repos/parser-combinators.code/";
+    context = ./contextfile;
+    sha256 = "0jlbz8yni6i7vb2qsd41bdkpchqirvc5pavckaf97z7p4gqi2mlj";
+  };
+
+  buildDepends = [ AgdaStdlib ];
+  everythingFile = "TotalParserCombinators.agda";
+  sourceDirectories = [];
+  topSourceDirectories = [ "../$sourceRoot" ];
+
+  meta = with stdenv.lib; {
+    homepage = http://www.cse.chalmers.se/~nad/publications/danielsson-parser-combinators.html;
+    description = "A monadic parser combinator library which guarantees termination of parsing";
+    license = stdenv.lib.licenses.mit;
+    platforms = stdenv.lib.platforms.unix;
+    maintainers = with maintainers; [ fuuzetsu ];
+    broken = true;
+  };
+})
diff --git a/nixpkgs/pkgs/development/libraries/agda/agda-base/default.nix b/nixpkgs/pkgs/development/libraries/agda/agda-base/default.nix
new file mode 100644
index 000000000000..146e44182ed2
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/agda/agda-base/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, agda, fetchurl }:
+
+agda.mkDerivation (self: rec {
+  version = "0.1";
+  name = "agda-base-${version}";
+
+  src = fetchurl {
+    url = "https://github.com/pcapriotti/agda-base/archive/v${version}.tar.gz";
+    sha256 = "124h06p7jdiqr2x6r46sfab9r0cgb0fznr2qs5i1psl5yf3z74h8";
+  };
+
+  sourceDirectories = [ "./." ];
+  everythingFile = "README.agda";
+
+  meta = {
+    homepage = https://github.com/pcapriotti/agda-base;
+    description = "Base library for HoTT in Agda";
+    license = stdenv.lib.licenses.bsd3;
+    platforms = stdenv.lib.platforms.unix;
+    maintainers = with stdenv.lib.maintainers; [ fuuzetsu ];
+    broken = true;  # largely replaced by HoTT-Agda
+  };
+})
diff --git a/nixpkgs/pkgs/development/libraries/agda/agda-iowa-stdlib/default.nix b/nixpkgs/pkgs/development/libraries/agda/agda-iowa-stdlib/default.nix
new file mode 100644
index 000000000000..3ab4ed3e9623
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/agda/agda-iowa-stdlib/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, agda, fetchFromGitHub }:
+
+agda.mkDerivation (self: rec {
+  version = "1.4.0";
+  name = "agda-iowa-stdlib-${version}";
+
+  src = fetchFromGitHub {
+    owner = "cedille";
+    repo  = "ial";
+    rev = "v${version}";
+    sha256 = "1gwxpybxwdj5ipbb3gapm7r5hfl3g6sj9kp13954pdmx8d5b0gma";
+  };
+
+  sourceDirectories = [ "./." ];
+  buildPhase = ''
+    patchShebangs find-deps.sh
+    make
+  '';
+
+  meta = {
+    homepage = https://svn.divms.uiowa.edu/repos/clc/projects/agda/lib/;
+    description = "Agda standard library developed at Iowa";
+    license = stdenv.lib.licenses.free;
+    platforms = stdenv.lib.platforms.unix;
+    maintainers = with stdenv.lib.maintainers; [ fuuzetsu ];
+  };
+})
diff --git a/nixpkgs/pkgs/development/libraries/agda/agda-prelude/default.nix b/nixpkgs/pkgs/development/libraries/agda/agda-prelude/default.nix
new file mode 100644
index 000000000000..e3dcf765dfd4
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/agda/agda-prelude/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, agda, fetchgit }:
+
+agda.mkDerivation (self: rec {
+  version = "0dca24a81d417db2ae8fc871eccb7776f7eae952";
+  name = "agda-prelude-${version}";
+
+  src = fetchgit {
+    url = "https://github.com/UlfNorell/agda-prelude.git";
+    rev = version;
+    sha256 = "0gwfgvj96i1mx5v01bi46h567d1q1fbgvzv6z8zv91l2jhybwff5";
+  };
+
+  topSourceDirectories = [ "src" ];
+  everythingFile = "src/Prelude.agda";
+
+  meta = with stdenv.lib; {
+    homepage = https://github.com/UlfNorell/agda-prelude;
+    description = "Programming library for Agda";
+    license = stdenv.lib.licenses.mit;
+    platforms = stdenv.lib.platforms.unix;
+    maintainers = with maintainers; [ fuuzetsu mudri ];
+  };
+})
diff --git a/nixpkgs/pkgs/development/libraries/agda/agda-stdlib/default.nix b/nixpkgs/pkgs/development/libraries/agda/agda-stdlib/default.nix
new file mode 100644
index 000000000000..d9350d135eb6
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/agda/agda-stdlib/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, agda, fetchFromGitHub, ghcWithPackages }:
+
+agda.mkDerivation (self: rec {
+  version = "1.0";
+  name = "agda-stdlib-${version}";
+
+  src = fetchFromGitHub {
+    repo = "agda-stdlib";
+    owner = "agda";
+    rev = "v${version}";
+    sha256 = "19qrdfi0vig3msqg76k1zf5j3vav0jz44cvj6i4dyfbscdwf2l9c";
+  };
+
+  nativeBuildInputs = [ (ghcWithPackages (self : [ self.filemanip ])) ];
+  preConfigure = ''
+    runhaskell GenerateEverything.hs
+  '';
+
+  topSourceDirectories = [ "src" ];
+
+  meta = with stdenv.lib; {
+    homepage = http://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;
+    broken = stdenv.isDarwin;
+    maintainers = with maintainers; [ jwiegley fuuzetsu mudri ];
+  };
+})
diff --git a/nixpkgs/pkgs/development/libraries/agda/bitvector/default.nix b/nixpkgs/pkgs/development/libraries/agda/bitvector/default.nix
new file mode 100644
index 000000000000..6306bb89b5c7
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/agda/bitvector/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, agda, fetchgit, AgdaStdlib }:
+
+agda.mkDerivation (self: rec {
+  version = "f1c173313f2a41d95a8dc6053f9365a24690e18d";
+  name = "bitvector-${version}";
+
+  src = fetchgit {
+    url = "https://github.com/copumpkin/bitvector.git";
+    rev = version;
+    sha256 = "0jb421lxvyxz26sxa81qjmn1gfcxfh0fmbq128f0kslqhiiaqfrh";
+  };
+
+  buildDepends = [ AgdaStdlib ];
+  sourceDirectories = [ "Data" ];
+
+  meta = {
+    homepage = https://github.com/copumpkin/bitvector;
+    description = "Sequences of bits and common operations on them";
+    license = stdenv.lib.licenses.bsd3;
+    platforms = stdenv.lib.platforms.unix;
+    maintainers = with stdenv.lib.maintainers; [ fuuzetsu ];
+    broken = true;
+  };
+})
diff --git a/nixpkgs/pkgs/development/libraries/agda/categories/default.nix b/nixpkgs/pkgs/development/libraries/agda/categories/default.nix
new file mode 100644
index 000000000000..ea232f2853d6
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/agda/categories/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, agda, fetchgit, AgdaStdlib }:
+
+agda.mkDerivation (self: rec {
+  version = "33409120d071656f5198c658145889ae2e86249c";
+  name = "categories-${version}";
+
+  src = fetchgit {
+    url = "https://github.com/copumpkin/categories.git";
+    rev = version;
+    sha256 = "15x834f7jn2s816b9vz8nm8p424ppzv6v9nayaawyl43qmaaaa5p";
+  };
+
+  buildDepends = [ AgdaStdlib ];
+  sourceDirectories = [ "Categories" "Graphs" ];
+
+  meta = {
+    homepage = https://github.com/copumpkin/categories;
+    description = "Categories parametrized by morphism equality, in Agda";
+    license = stdenv.lib.licenses.bsd3;
+    platforms = stdenv.lib.platforms.unix;
+    maintainers = with stdenv.lib.maintainers; [ fuuzetsu ];
+    broken = true; # doesn't work due to new agdastdlib, see #9471
+  };
+})
diff --git a/nixpkgs/pkgs/development/libraries/agda/pretty/contextfile b/nixpkgs/pkgs/development/libraries/agda/pretty/contextfile
new file mode 100644
index 000000000000..2ea20153bbcc
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/agda/pretty/contextfile
@@ -0,0 +1,43 @@
+
+Context:
+
+[Updated the code in response to a change to Agda.
+Nils Anders Danielsson <nils.anders.danielsson@gmail.com>**20150319181428
+ Ignore-this: f83c3dccfe25a2a5b9d0437d1dce0ec0
+] 
+
+[Rolled back most of "Updated the code in response to changes to Agda".
+Nils Anders Danielsson <nils.anders.danielsson@gmail.com>**20150319101413
+ Ignore-this: 5a26cf9cf83d0d146cca0c15c857d20c
+ * One of the Agda changes has been reverted.
+] 
+
+[Updated the code in response to changes to Agda.
+Nils Anders Danielsson <nils.anders.danielsson@gmail.com>**20150217101656
+ Ignore-this: a12921aebbe0fb575ef391ba5789a391
+] 
+
+[Modified the copyright year range.
+Nils Anders Danielsson <nils.anders.danielsson@gmail.com>**20150213144338
+ Ignore-this: 1d1b22457dd6dadcb47f5d7f3eea062
+] 
+
+[Restored Grammar.Abstract and Grammar.Non-terminal.
+Nils Anders Danielsson <nils.anders.danielsson@gmail.com>**20130727225031
+ Ignore-this: ddccb15caa7a3c26e973997ffdb4eec1
+] 
+
+[Modified the copyright year range.
+Nils Anders Danielsson <nils.anders.danielsson@gmail.com>**20141128164015
+ Ignore-this: b9c6dddc965738aa2a7670c4c18da67f
+] 
+
+[Updated the code to reflect changes to the library API.
+Nils Anders Danielsson <nils.anders.danielsson@gmail.com>**20141128163950
+ Ignore-this: 8094c47f23cef0fcc596ad0c18a92b56
+] 
+
+[TAG Correct-by-Construction Pretty-Printing (2013-07-28)
+Nils Anders Danielsson <nils.anders.danielsson@gmail.com>**20130727224432
+ Ignore-this: 6aab9b2e6b638457767c8821f3c27cb4
+] 
diff --git a/nixpkgs/pkgs/development/libraries/agda/pretty/default.nix b/nixpkgs/pkgs/development/libraries/agda/pretty/default.nix
new file mode 100644
index 000000000000..0e4f1da6e140
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/agda/pretty/default.nix
@@ -0,0 +1,26 @@
+{ stdenv, agda, fetchdarcs, AgdaStdlib }:
+
+agda.mkDerivation (self: rec {
+  version = "2015-03-19";
+  name = "pretty-${version}";
+
+  src = fetchdarcs {
+    url = "http://www.cse.chalmers.se/~nad/repos/pretty/";
+    context = ./contextfile;
+    sha256 = "0zmwh9kln7ykpmkx1qhqz64qm2arq62b17vs5fswnxk7mqxsmrf0";
+  };
+
+  buildDepends = [ AgdaStdlib ];
+  everythingFile = "Pretty.agda";
+  sourceDirectories = [];
+  topSourceDirectories = [ "../$sourceRoot" ];
+
+  meta = with stdenv.lib; {
+    homepage = http://www.cse.chalmers.se/~nad/publications/danielsson-correct-pretty.html;
+    description = "Correct-by-Construction Pretty-Printing";
+    license = stdenv.lib.licenses.mit;
+    platforms = stdenv.lib.platforms.unix;
+    maintainers = with maintainers; [ fuuzetsu ];
+    broken = true; # 2018-04-11
+  };
+})
diff --git a/nixpkgs/pkgs/development/libraries/agg/default.nix b/nixpkgs/pkgs/development/libraries/agg/default.nix
new file mode 100644
index 000000000000..c0539aeed476
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/agg/default.nix
@@ -0,0 +1,42 @@
+{ stdenv, fetchurl, autoconf, automake, libtool, pkgconfig
+, freetype, SDL, libX11 }:
+
+stdenv.mkDerivation rec {
+  name = "agg-2.5";
+  src = fetchurl {
+    url = "http://www.antigrain.com/${name}.tar.gz";
+    sha256 = "07wii4i824vy9qsvjsgqxppgqmfdxq0xa87i5yk53fijriadq7mb";
+  };
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ autoconf automake libtool freetype SDL libX11 ];
+
+  # fix build with new automake, from Gentoo ebuild
+  preConfigure = ''
+    sed -i '/^AM_C_PROTOTYPES/d' configure.in
+    sh autogen.sh
+  '';
+
+  configureFlags = [ "--x-includes=${libX11.dev}/include" "--x-libraries=${libX11.out}/lib" "--enable-examples=no" ];
+
+  # libtool --tag=CXX --mode=link g++ -g -O2 libexamples.la ../src/platform/X11/libaggplatformX11.la ../src/libagg.la -o alpha_mask2 alpha_mask2.o
+  # libtool: error: cannot find the library 'libexamples.la'
+  enableParallelBuilding = false;
+
+  meta = {
+    description = "High quality rendering engine for C++";
+
+    longDescription = ''
+      Anti-Grain Geometry (AGG) is an Open Source, free of charge
+      graphic library, written in industrially standard C++.  The
+      terms and conditions of use AGG are described on The License
+      page.  AGG doesn't depend on any graphic API or technology.
+      Basically, you can think of AGG as of a rendering engine that
+      produces pixel images in memory from some vectorial data.  But
+      of course, AGG can do much more than that.
+    '';
+
+    license = stdenv.lib.licenses.gpl2Plus;
+    homepage = http://www.antigrain.com/;
+    platforms = stdenv.lib.platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/alembic/default.nix b/nixpkgs/pkgs/development/libraries/alembic/default.nix
new file mode 100644
index 000000000000..5c25da920556
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/alembic/default.nix
@@ -0,0 +1,46 @@
+{ stdenv, fetchFromGitHub, unzip, cmake, openexr, hdf5-threadsafe }:
+
+stdenv.mkDerivation rec
+{
+  name = "alembic-${version}";
+  version = "1.7.11";
+
+  src = fetchFromGitHub {
+    owner = "alembic";
+    repo = "alembic";
+    rev = "${version}";
+    sha256 = "1lalbqn4cwf0vp4hiq72gwpd7kq501j21rnjb380mv26pk7r2ivz";
+  };
+
+  outputs = [ "bin" "dev" "out" "lib" ];
+
+  nativeBuildInputs = [ unzip cmake ];
+  buildInputs = [ openexr hdf5-threadsafe ];
+
+  enableParallelBuilding = true;
+
+  buildPhase = ''
+    cmake -DUSE_HDF5=ON -DCMAKE_INSTALL_PREFIX=$out/ -DUSE_TESTS=OFF .
+
+    mkdir $out
+    mkdir -p $bin/bin
+    mkdir -p $dev/include
+    mkdir -p $lib/lib
+  '';
+
+  installPhase = ''
+    make install
+
+    mv $out/bin $bin/
+    mv $out/lib $lib/
+    mv $out/include $dev/
+  '';
+
+  meta = with stdenv.lib; {
+    description = "An open framework for storing and sharing scene data";
+    homepage = "http://alembic.io/";
+    license = licenses.bsd3;
+    platforms = platforms.all;
+    maintainers = [ maintainers.guibou ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/alkimia/default.nix b/nixpkgs/pkgs/development/libraries/alkimia/default.nix
new file mode 100644
index 000000000000..f98c8fa480e1
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/alkimia/default.nix
@@ -0,0 +1,32 @@
+{ mkDerivation, fetchurl, lib
+, extra-cmake-modules, doxygen, graphviz, qtbase, qtwebkit, mpir
+, kdelibs4support, plasma-framework, knewstuff, kpackage
+}:
+
+mkDerivation rec {
+  name = "alkimia-${version}";
+  version = "8.0.1";
+
+  src = fetchurl {
+    url = "mirror://kde/stable/alkimia/${version}/${name}.tar.xz";
+    sha256 = "059i6vn36sdq5zn2vqzh4asvvgdgs7n478nk9phvb5gdys01fq7m";
+  };
+
+  nativeBuildInputs = [ extra-cmake-modules doxygen graphviz ];
+
+  buildInputs = [ qtbase qtwebkit kdelibs4support plasma-framework knewstuff kpackage ];
+  propagatedBuildInputs = [ mpir ];
+
+  meta = {
+    description = "Library used by KDE finance applications";
+    longDescription = ''
+      Alkimia is the infrastructure for common storage and business
+      logic that will be used by all financial applications in KDE.
+
+      The target is to share financial related information over
+      application bounderies.
+    '';
+    license = lib.licenses.lgpl21Plus;
+    platforms = qtbase.meta.platforms;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/allegro/5.nix b/nixpkgs/pkgs/development/libraries/allegro/5.nix
new file mode 100644
index 000000000000..9f8ca69a70f1
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/allegro/5.nix
@@ -0,0 +1,52 @@
+{ stdenv, fetchFromGitHub, fetchpatch, texinfo, libXext, xorgproto, libX11
+, libXpm, libXt, libXcursor, alsaLib, cmake, zlib, libpng, libvorbis
+, libXxf86dga, libXxf86misc
+, libXxf86vm, openal, libGLU_combined, libjpeg, flac
+, libXi, libXfixes, freetype, libopus, libtheora
+, physfs, enet, pkgconfig, gtk2, pcre, libpulseaudio, libpthreadstubs
+, libXdmcp
+}:
+
+stdenv.mkDerivation rec {
+  name = "allegro-${version}";
+  version = "5.2.4.0";
+
+  src = fetchFromGitHub {
+    owner = "liballeg";
+    repo = "allegro5";
+    rev = version;
+    sha256 = "01y3hirn5b08f188nnhb2cbqj4vzysr7l2qpz2208srv8arzmj2d";
+  };
+
+  buildInputs = [
+    texinfo libXext xorgproto libX11 libXpm libXt libXcursor
+    alsaLib cmake zlib libpng libvorbis libXxf86dga libXxf86misc
+    libXxf86vm openal libGLU_combined
+    libjpeg flac
+    libXi libXfixes
+    enet libtheora freetype physfs libopus pkgconfig gtk2 pcre libXdmcp
+    libpulseaudio libpthreadstubs
+  ];
+
+  patches = [
+   # fix compilation with mesa 18.2.5
+   (fetchpatch {
+     url = "https://github.com/liballeg/allegro5/commit/a40d30e21802ecf5c9382cf34af9b01bd3781e47.patch";
+     sha256 = "1f1xlj5y2vr6wzmcz04s8kxn8cfdwrg9kjlnvpz9dix1z3qjnd4m";
+   })
+  ];
+
+  postPatch = ''
+    sed -e 's@/XInput2.h@/XI2.h@g' -i CMakeLists.txt "src/"*.c
+  '';
+
+  cmakeFlags = [ "-DCMAKE_SKIP_RPATH=ON" ];
+
+  meta = with stdenv.lib; {
+    description = "A game programming library";
+    homepage = https://liballeg.org/;
+    license = licenses.zlib;
+    maintainers = [ maintainers.raskin ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/allegro/allegro4-mesa-18.2.5.patch b/nixpkgs/pkgs/development/libraries/allegro/allegro4-mesa-18.2.5.patch
new file mode 100644
index 000000000000..c49ebb550f3f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/allegro/allegro4-mesa-18.2.5.patch
@@ -0,0 +1,26 @@
+--- a/addons/allegrogl/include/alleggl.h
++++ b/addons/allegrogl/include/alleggl.h
+@@ -63,9 +63,11 @@ typedef __int64 INT64;
+ /* HACK: Prevent both Mesa and SGI's broken headers from screwing us */
+ #define __glext_h_
+ #define __glxext_h_
++#define __glx_glxext_h_
+ #include <GL/gl.h>
+ #undef  __glext_h_
+ #undef  __glxext_h_
++#undef  __glx_glxext_h_
+ 
+ #endif /* ALLEGRO_MACOSX */
+ 
+--- a/addons/allegrogl/include/allegrogl/GLext/glx_ext_defs.h
++++ b/addons/allegrogl/include/allegrogl/GLext/glx_ext_defs.h
+@@ -1,7 +1,9 @@
+ /* HACK: Prevent both Mesa and SGI's broken headers from screwing us */
+ #define __glxext_h_
++#define __glx_glxext_h_
+ #include <GL/glx.h>
+ #undef __glxext_h_
++#undef __glx_glxext_h_
+ 
+ #ifndef GLX_VERSION_1_3
+ #define AGLX_VERSION_1_3
diff --git a/nixpkgs/pkgs/development/libraries/allegro/default.nix b/nixpkgs/pkgs/development/libraries/allegro/default.nix
new file mode 100644
index 000000000000..eca32b740e35
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/allegro/default.nix
@@ -0,0 +1,37 @@
+{ stdenv, fetchurl, texinfo, libXext, xorgproto, libX11
+, libXpm, libXt, libXcursor, alsaLib, cmake, zlib, libpng, libvorbis
+, libXxf86dga, libXxf86misc
+, libXxf86vm, openal, libGLU_combined }:
+
+stdenv.mkDerivation rec {
+  name = "allegro-${version}";
+  version="4.4.2";
+
+  src = fetchurl {
+    url = "https://github.com/liballeg/allegro5/releases/download/${version}/${name}.tar.gz";
+    sha256 = "1p0ghkmpc4kwij1z9rzxfv7adnpy4ayi0ifahlns1bdzgmbyf88v";
+  };
+
+  patches = [
+    ./allegro4-mesa-18.2.5.patch
+    ./nix-unstable-sandbox-fix.patch
+  ];
+
+  buildInputs = [
+    texinfo libXext xorgproto libX11 libXpm libXt libXcursor
+    alsaLib cmake zlib libpng libvorbis libXxf86dga libXxf86misc
+    libXxf86vm openal libGLU_combined
+  ];
+
+  hardeningDisable = [ "format" ];
+
+  cmakeFlags = [ "-DCMAKE_SKIP_RPATH=ON" ];
+
+  meta = with stdenv.lib; {
+    description = "A game programming library";
+    homepage = https://liballeg.org/;
+    license = licenses.free; # giftware
+    maintainers = [ maintainers.raskin ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/allegro/nix-unstable-sandbox-fix.patch b/nixpkgs/pkgs/development/libraries/allegro/nix-unstable-sandbox-fix.patch
new file mode 100644
index 000000000000..a227cea1ce7b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/allegro/nix-unstable-sandbox-fix.patch
@@ -0,0 +1,13 @@
+diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt
+index 32ed053..73ba87f 100644
+--- a/docs/CMakeLists.txt
++++ b/docs/CMakeLists.txt
+@@ -72,7 +72,7 @@ foreach(page ${DOC_SRCS})
+     string(REPLACE "._tx" "" basename ${basename})
+ 
+     set(page ${CMAKE_CURRENT_SOURCE_DIR}/${page})
+-    if(${page} MATCHES "/build/")
++    if(${page} MATCHES ".+/build/")
+         set(txt_out ${CMAKE_CURRENT_BINARY_DIR}/build/${basename}.txt)
+         set(html_out ${CMAKE_CURRENT_BINARY_DIR}/build/${basename}.html)
+     else()
diff --git a/nixpkgs/pkgs/development/libraries/alure/default.nix b/nixpkgs/pkgs/development/libraries/alure/default.nix
new file mode 100644
index 000000000000..95828c44f851
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/alure/default.nix
@@ -0,0 +1,20 @@
+{ stdenv, fetchurl, cmake, openal }:
+
+stdenv.mkDerivation rec {
+  name = "alure-${version}";
+  version = "1.2";
+
+  src = fetchurl {
+    url = "http://kcat.strangesoft.net/alure-releases/alure-${version}.tar.bz2";
+    sha256 = "0w8gsyqki21s1qb2s5ac1kj08i6nc937c0rr08xbw9w9wvd6lpj6";
+  };
+
+  buildInputs = [ cmake openal ];
+
+  meta = with stdenv.lib; {
+    description = "A utility library to help manage common tasks with OpenAL applications";
+    homepage = https://kcat.strangesoft.net/alure.html;
+    license = licenses.mit;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/amrnb/default.nix b/nixpkgs/pkgs/development/libraries/amrnb/default.nix
new file mode 100644
index 000000000000..bfb72be24fe8
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/amrnb/default.nix
@@ -0,0 +1,31 @@
+{stdenv, fetchurl, unzip}:
+
+stdenv.mkDerivation {
+  name = "amrnb-11.0.0.0";
+  srcAmr = fetchurl {
+    url = http://www.3gpp.org/ftp/Specs/latest/Rel-11/26_series/26104-b00.zip;
+    sha256 = "1wf8ih0hk7w20vdlnw7jb7w73v15hbxgbvmq4wq7h2ghn0j8ppr3";
+  };
+
+  src = fetchurl {
+    url = http://www.penguin.cz/~utx/ftp/amr/amrnb-11.0.0.0.tar.bz2;
+    sha256 = "1qgiw02n2a6r32pimnd97v2jkvnw449xrqmaxiivjy2jcr5h141q";
+  };
+
+  buildInputs = [ unzip ];
+
+  configureFlags = [ "--cache-file=config.cache" "--with-downloader=true" ];
+
+  postConfigure = ''
+    cp $srcAmr 26104-b00.zip 
+  '';
+
+  meta = {
+    homepage = http://www.penguin.cz/~utx/amr;
+    description = "AMR Narrow-Band Codec";
+    # 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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/amrwb/default.nix b/nixpkgs/pkgs/development/libraries/amrwb/default.nix
new file mode 100644
index 000000000000..15331c22599b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/amrwb/default.nix
@@ -0,0 +1,33 @@
+{ stdenv, fetchurl, unzip }:
+
+stdenv.mkDerivation rec {
+  name = "amrwb-${version}";
+  version = "11.0.0.0";
+
+  srcAmr = fetchurl {
+    url = http://www.3gpp.org/ftp/Specs/archive/26_series/26.204/26204-b00.zip;
+    sha256 = "1v4zhs6f1mf1xkrzhljh05890in0rpr5d5pcak9h4igxhd2c91f8";
+  };
+
+  src = fetchurl {
+    url = "http://www.penguin.cz/~utx/ftp/amr/amrwb-${version}.tar.bz2";
+    sha256 = "1p6m9nd08mv525w14py9qzs9zwsa5i3vxf5bgcmcvc408jqmkbsw";
+  };
+
+  buildInputs = [ unzip ];
+
+  configureFlags = [ "--cache-file=config.cache" "--with-downloader=true" ];
+
+  postConfigure = ''
+    cp $srcAmr 26204-b00.zip
+  '';
+
+  meta = {
+    homepage = http://www.penguin.cz/~utx/amr;
+    description = "AMR Wide-Band Codec";
+    # 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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/amtk/default.nix b/nixpkgs/pkgs/development/libraries/amtk/default.nix
new file mode 100644
index 000000000000..cb22c9ee790b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/amtk/default.nix
@@ -0,0 +1,40 @@
+{ stdenv, fetchurl, gtk3
+, pkgconfig, gnome3, dbus, xvfb_run }:
+let
+  version = "5.0.0";
+  pname = "amtk";
+in stdenv.mkDerivation {
+  name = "${pname}-${version}";
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    sha256 = "1zriix7bdwcg0868mfc7jy6zbwjwdmjwbh0ah6dbddrhiabrda8j";
+  };
+
+  nativeBuildInputs = [
+    pkgconfig
+    dbus
+  ];
+
+  buildInputs = [
+    gtk3
+  ];
+
+  doCheck = stdenv.isLinux;
+  checkPhase = ''
+    export NO_AT_BRIDGE=1
+    ${xvfb_run}/bin/xvfb-run -s '-screen 0 800x600x24' dbus-run-session \
+      --config-file=${dbus.daemon}/share/dbus-1/session.conf \
+      make check
+  '';
+
+  passthru.updateScript = gnome3.updateScript { packageName = pname; };
+
+  meta = with stdenv.lib; {
+    homepage = https://wiki.gnome.org/Projects/Amtk;
+    description = "Actions, Menus and Toolbars Kit for GTK+ applications";
+    maintainers = [ maintainers.manveru ];
+    license = licenses.lgpl21Plus;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/apache-activemq/default.nix b/nixpkgs/pkgs/development/libraries/apache-activemq/default.nix
new file mode 100644
index 000000000000..fc79cae36f83
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/apache-activemq/default.nix
@@ -0,0 +1,30 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "apache-activemq-${version}";
+  version = "5.14.5";
+
+  src = fetchurl {
+    sha256 = "0vm8z7rxb9n10xg5xjahy357704fw3q477hmpb83kd1zrc633g54";
+    url = "mirror://apache/activemq/${version}/${name}-bin.tar.gz";
+  };
+
+  phases = [ "unpackPhase" "installPhase" ];
+
+  installPhase = ''
+    mkdir -p $out
+    mv * $out/
+    for j in `find $out/lib -name "*.jar"`; do
+      cp="''${cp:+"$cp:"}$j";
+    done
+    echo "CLASSPATH=$cp" > $out/lib/classpath.env
+  '';
+
+  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;
+  };
+
+}
diff --git a/nixpkgs/pkgs/development/libraries/appstream-glib/default.nix b/nixpkgs/pkgs/development/libraries/appstream-glib/default.nix
new file mode 100644
index 000000000000..45ad58819c32
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/appstream-glib/default.nix
@@ -0,0 +1,55 @@
+{ stdenv, fetchFromGitHub, substituteAll, pkgconfig, gettext, gtk3, glib
+, gtk-doc, libarchive, gobject-introspection, libxslt, pngquant
+, sqlite, libsoup, attr, acl, docbook_xsl, docbook_xml_dtd_42
+, libuuid, json-glib, meson, gperf, ninja, gdk_pixbuf
+}:
+stdenv.mkDerivation rec {
+  name = "appstream-glib-0.7.15";
+
+  outputs = [ "out" "dev" "man" "installedTests" ];
+  outputBin = "dev";
+
+  src = fetchFromGitHub {
+    owner = "hughsie";
+    repo = "appstream-glib";
+    rev = stdenv.lib.replaceStrings ["." "-"] ["_" "_"] name;
+    sha256 = "16cqs1s7nqc551sipgaxbbzwap1km0n12s4lcgfbxzzl9bcjbp9m";
+  };
+
+  nativeBuildInputs = [
+    meson pkgconfig ninja gtk-doc libxslt docbook_xsl docbook_xml_dtd_42 gobject-introspection
+  ];
+  buildInputs = [
+    glib gettext sqlite libsoup
+    attr acl libuuid json-glib
+    libarchive gperf gdk_pixbuf
+  ];
+  propagatedBuildInputs = [ gtk3 ];
+
+  patches = [
+    (substituteAll {
+      src = ./paths.patch;
+      pngquant = "${pngquant}/bin/pngquant";
+    })
+  ];
+
+  mesonFlags = [
+    "-Drpm=false"
+    "-Dstemmer=false"
+    "-Ddep11=false"
+  ];
+
+  doCheck = false; # fails at least 1 test
+
+  postInstall = ''
+    moveToOutput "share/installed-tests" "$installedTests"
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Objects and helper methods to read and write AppStream metadata";
+    homepage = https://people.freedesktop.org/~hughsient/appstream-glib/;
+    license = licenses.lgpl2Plus;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ lethalman matthewbauer ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/appstream-glib/paths.patch b/nixpkgs/pkgs/development/libraries/appstream-glib/paths.patch
new file mode 100644
index 000000000000..5c6396988a17
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/appstream-glib/paths.patch
@@ -0,0 +1,11 @@
+--- a/libappstream-builder/asb-utils.c
++++ b/libappstream-builder/asb-utils.c
+@@ -294,7 +294,7 @@
+ {
+ 	g_autofree gchar *standard_error = NULL;
+ 	gint exit_status = 0;
+-	const gchar *argv[] = { "/usr/bin/pngquant", "--skip-if-larger",
++	const gchar *argv[] = { "@pngquant@", "--skip-if-larger",
+ 				"--strip", "--ext", ".png",
+ 				"--force", "--speed", "1", filename, NULL };
+ 	if (!g_file_test (argv[0], G_FILE_TEST_IS_EXECUTABLE))
diff --git a/nixpkgs/pkgs/development/libraries/appstream/default.nix b/nixpkgs/pkgs/development/libraries/appstream/default.nix
new file mode 100644
index 000000000000..f59a3fd713f9
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/appstream/default.nix
@@ -0,0 +1,52 @@
+{ stdenv, fetchpatch, fetchFromGitHub, meson, ninja, pkgconfig, gettext
+, xmlto, docbook_xsl, docbook_xml_dtd_45, libxslt
+, libstemmer, glib, xapian, libxml2, libyaml, gobject-introspection
+, pcre, itstool, gperf, vala
+}:
+
+stdenv.mkDerivation rec {
+  name = "appstream-${version}";
+  version = "0.12.6";
+
+  src = fetchFromGitHub {
+    owner  = "ximion";
+    repo   = "appstream";
+    rev    = "APPSTREAM_${stdenv.lib.replaceStrings ["."] ["_"] version}";
+    sha256 = "0hbl26aw3g2hag7z4di9z59qz057qcywrxpnnmp86z7rngvjbqpx";
+  };
+
+  nativeBuildInputs = [
+    meson ninja pkgconfig gettext
+    libxslt xmlto docbook_xsl docbook_xml_dtd_45
+    gobject-introspection itstool vala
+  ];
+
+  buildInputs = [ libstemmer pcre glib xapian libxml2 libyaml gperf ];
+
+  prePatch = ''
+    substituteInPlace meson.build \
+      --replace /usr/include ${libstemmer}/include
+
+    substituteInPlace data/meson.build \
+      --replace /etc $out/etc
+  '';
+
+  mesonFlags = [
+    "-Dapidocs=false"
+    "-Ddocs=false"
+    "-Dvapi=true"
+  ];
+
+  meta = with stdenv.lib; {
+    description = "Software metadata handling library";
+    homepage    = https://www.freedesktop.org/wiki/Distributions/AppStream/;
+    longDescription = ''
+      AppStream is a cross-distro effort for building Software-Center applications
+      and enhancing metadata provided by software components.  It provides
+      specifications for meta-information which is shipped by upstream projects and
+      can be consumed by other software.
+    '';
+    license     = licenses.lgpl21Plus;
+    platforms   = platforms.linux;
+ };
+}
diff --git a/nixpkgs/pkgs/development/libraries/appstream/qt.nix b/nixpkgs/pkgs/development/libraries/appstream/qt.nix
new file mode 100644
index 000000000000..0013764d7791
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/appstream/qt.nix
@@ -0,0 +1,18 @@
+{ stdenv, appstream, qtbase, qttools }:
+
+# TODO: look into using the libraries from the regular appstream derivation as we keep duplicates here
+
+stdenv.mkDerivation rec {
+  name = "appstream-qt-${version}";
+  inherit (appstream) version src prePatch;
+
+  buildInputs = appstream.buildInputs ++ [ appstream qtbase ];
+
+  nativeBuildInputs = appstream.nativeBuildInputs ++ [ qttools ];
+
+  mesonFlags = appstream.mesonFlags ++ [ "-Dqt=true" ];
+
+  meta = appstream.meta // {
+    description = "Software metadata handling library - Qt";
+ };
+}
diff --git a/nixpkgs/pkgs/development/libraries/apr-util/default.nix b/nixpkgs/pkgs/development/libraries/apr-util/default.nix
new file mode 100644
index 000000000000..87563d6a9cbf
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/apr-util/default.nix
@@ -0,0 +1,71 @@
+{ stdenv, fetchurl, makeWrapper, apr, expat, gnused
+, sslSupport ? true, openssl
+, bdbSupport ? true, db
+, ldapSupport ? !stdenv.isCygwin, openldap
+, libiconv
+, cyrus_sasl, autoreconfHook
+}:
+
+assert sslSupport -> openssl != null;
+assert bdbSupport -> db != null;
+assert ldapSupport -> openldap != null;
+
+with stdenv.lib;
+
+stdenv.mkDerivation rec {
+  name = "apr-util-1.6.1";
+
+  src = fetchurl {
+    url = "mirror://apache/apr/${name}.tar.bz2";
+    sha256 = "0nq3s1yn13vplgl6qfm09f7n0wm08malff9s59bqf9nid9xjzqfk";
+  };
+
+  patches = optional stdenv.isFreeBSD ./include-static-dependencies.patch;
+
+  outputs = [ "out" "dev" ];
+  outputBin = "dev";
+
+  buildInputs = optional stdenv.isFreeBSD autoreconfHook;
+
+  configureFlags = [ "--with-apr=${apr.dev}" "--with-expat=${expat.dev}" ]
+    ++ optional (!stdenv.isCygwin) "--with-crypto"
+    ++ optional sslSupport "--with-openssl=${openssl.dev}"
+    ++ optional bdbSupport "--with-berkeley-db=${db.dev}"
+    ++ optional ldapSupport "--with-ldap=ldap"
+    ++ optionals stdenv.isCygwin
+      [ "--without-pgsql" "--without-sqlite2" "--without-sqlite3"
+        "--without-freetds" "--without-berkeley-db" "--without-crypto" ]
+    ;
+
+  propagatedBuildInputs = [ makeWrapper apr expat libiconv ]
+    ++ optional sslSupport openssl
+    ++ optional bdbSupport db
+    ++ optional ldapSupport openldap
+    ++ optional stdenv.isFreeBSD cyrus_sasl;
+
+  postInstall = ''
+    for f in $out/lib/*.la $out/lib/apr-util-1/*.la $dev/bin/apu-1-config; do
+      substituteInPlace $f \
+        --replace "${expat.dev}/lib" "${expat.out}/lib" \
+        --replace "${db.dev}/lib" "${db.out}/lib" \
+        --replace "${openssl.dev}/lib" "${openssl.out}/lib"
+    done
+
+    # Give apr1 access to sed for runtime invocations.
+    wrapProgram $dev/bin/apu-1-config --prefix PATH : "${gnused}/bin"
+  '';
+
+  enableParallelBuilding = true;
+
+  passthru = {
+    inherit sslSupport bdbSupport ldapSupport;
+  };
+
+  meta = with stdenv.lib; {
+    homepage = http://apr.apache.org/;
+    description = "A companion library to APR, the Apache Portable Runtime";
+    maintainers = [ maintainers.eelco ];
+    platforms = platforms.unix;
+    license = licenses.asl20;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/apr-util/include-static-dependencies.patch b/nixpkgs/pkgs/development/libraries/apr-util/include-static-dependencies.patch
new file mode 100644
index 000000000000..1813c7217810
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/apr-util/include-static-dependencies.patch
@@ -0,0 +1,12 @@
+diff --git a/build/apu-conf.m4 b/build/apu-conf.m4
+index 8943f10..aa44305 100644
+--- a/build/apu-conf.m4
++++ b/build/apu-conf.m4
+@@ -279,6 +279,7 @@ AC_ARG_WITH(ldap,[  --with-ldap=library     ldap library to use],
+         APU_FIND_LDAPLIB("ldap", "-llber -lresolv -lsocket -lnsl")
+         APU_FIND_LDAPLIB("ldap", "-ldl -lpthread")
+       else
++        APU_FIND_LDAPLIB($LIBLDAP, "-llber -lcrypto -lssl -lsasl2")
+         APU_FIND_LDAPLIB($LIBLDAP)
+         APU_FIND_LDAPLIB($LIBLDAP, "-lresolv")
+         APU_FIND_LDAPLIB($LIBLDAP, "-lresolv -lsocket -lnsl")
diff --git a/nixpkgs/pkgs/development/libraries/apr/default.nix b/nixpkgs/pkgs/development/libraries/apr/default.nix
new file mode 100644
index 000000000000..ea84609868cf
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/apr/default.nix
@@ -0,0 +1,40 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "apr-1.6.5";
+
+  src = fetchurl {
+    url = "mirror://apache/apr/${name}.tar.bz2";
+    sha256 = "01d1n1ql66bxsjx0wyzazmkqdqdmr0is6a7lwyy5kzy4z7yajz56";
+  };
+
+  patches = stdenv.lib.optionals stdenv.isDarwin [ ./is-this-a-compiler-bug.patch ];
+
+  # This test needs the net
+  postPatch = ''
+    rm test/testsock.*
+  '';
+
+  outputs = [ "out" "dev" ];
+  outputBin = "dev";
+
+  preConfigure =
+    ''
+      configureFlagsArray+=("--with-installbuilddir=$dev/share/build")
+    '';
+
+  configureFlags =
+    # Including the Windows headers breaks unistd.h.
+    # Based on ftp://sourceware.org/pub/cygwin/release/libapr1/libapr1-1.3.8-2-src.tar.bz2
+    stdenv.lib.optional (stdenv.hostPlatform.system == "i686-cygwin") "ac_cv_header_windows_h=no";
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    homepage = http://apr.apache.org/;
+    description = "The Apache Portable Runtime library";
+    platforms = platforms.all;
+    license = licenses.asl20;
+    maintainers = [ maintainers.eelco ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/apr/is-this-a-compiler-bug.patch b/nixpkgs/pkgs/development/libraries/apr/is-this-a-compiler-bug.patch
new file mode 100644
index 000000000000..bbc10fabb268
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/apr/is-this-a-compiler-bug.patch
@@ -0,0 +1,17 @@
+--- apr-1.5.1/file_io/unix/filestat.c	2014-11-01 06:42:50.000000000 -0400
++++ apr-1.5.1/file_io/unix/filestat.c.new	2014-11-01 07:07:32.000000000 -0400
+@@ -297,9 +297,11 @@
+         finfo->pool = pool;
+         finfo->fname = fname;
+         fill_out_finfo(finfo, &info, wanted);
+-        if (wanted & APR_FINFO_LINK)
+-            wanted &= ~APR_FINFO_LINK;
+-        return (wanted & ~finfo->valid) ? APR_INCOMPLETE : APR_SUCCESS;
++        if (wanted & APR_FINFO_LINK) {
++            return ((wanted & ~APR_FINFO_LINK) & ~finfo->valid) ? APR_INCOMPLETE : APR_SUCCESS;
++        } else {
++            return (wanted & ~finfo->valid) ? APR_INCOMPLETE : APR_SUCCESS;
++        }
+     }
+     else {
+ #if !defined(ENOENT) || !defined(ENOTDIR)
diff --git a/nixpkgs/pkgs/development/libraries/aqbanking/default.nix b/nixpkgs/pkgs/development/libraries/aqbanking/default.nix
new file mode 100644
index 000000000000..b26291469e75
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/aqbanking/default.nix
@@ -0,0 +1,40 @@
+{ stdenv, fetchurl, gmp, gwenhywfar, libtool, libxml2, libxslt
+, pkgconfig, gettext, xmlsec, zlib
+}:
+
+let
+  inherit ((import ./sources.nix).aqbanking) sha256 releaseId version;
+in stdenv.mkDerivation rec {
+  name = "aqbanking-${version}";
+  inherit version;
+
+  src = let
+    qstring = "package=03&release=${releaseId}&file=02";
+    mkURLs = map (base: "${base}/sites/download/download.php?${qstring}");
+  in fetchurl {
+    name = "${name}.tar.gz";
+    urls = mkURLs [ "http://www.aquamaniac.de" "http://www2.aquamaniac.de" ];
+    inherit sha256;
+  };
+
+  postPatch = ''
+    sed -i -e '/^aqbanking_plugindir=/ {
+      c aqbanking_plugindir="\''${libdir}/gwenhywfar/plugins"
+    }' configure
+  '';
+
+  buildInputs = [ gmp gwenhywfar libtool libxml2 libxslt xmlsec zlib ];
+
+  nativeBuildInputs = [ pkgconfig gettext ];
+
+  configureFlags = [ "--with-gwen-dir=${gwenhywfar}" ];
+
+  meta = with stdenv.lib; {
+    description = "An interface to banking tasks, file formats and country information";
+    homepage = http://www2.aquamaniac.de/sites/download/packages.php?package=03&showall=1;
+    hydraPlatforms = [];
+    license = licenses.gpl2Plus;
+    maintainers = with maintainers; [ goibhniu ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/aqbanking/gwenhywfar.nix b/nixpkgs/pkgs/development/libraries/aqbanking/gwenhywfar.nix
new file mode 100644
index 000000000000..bb337e471cfc
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/aqbanking/gwenhywfar.nix
@@ -0,0 +1,71 @@
+{ stdenv, fetchurl, gnutls, openssl, libgcrypt, libgpgerror, pkgconfig, gettext
+, which
+
+# GUI support
+, gtk2, gtk3, qt5
+
+, pluginSearchPaths ? [
+    "/run/current-system/sw/lib/gwenhywfar/plugins"
+    ".nix-profile/lib/gwenhywfar/plugins"
+  ]
+}:
+
+let
+  inherit ((import ./sources.nix).gwenhywfar) sha256 releaseId version;
+in stdenv.mkDerivation rec {
+  name = "gwenhywfar-${version}";
+  inherit version;
+
+  src = let
+    qstring = "package=01&release=${releaseId}&file=02";
+    mkURLs = map (base: "${base}/sites/download/download.php?${qstring}");
+  in fetchurl {
+    name = "${name}.tar.gz";
+    urls = mkURLs [ "http://www.aquamaniac.de" "http://www2.aquamaniac.de" ];
+    inherit sha256;
+  };
+
+  configureFlags = [
+    "--with-openssl-includes=${openssl.dev}/include"
+    "--with-openssl-libs=${openssl.out}/lib"
+  ];
+
+  preConfigure = ''
+    configureFlagsArray+=("--with-guis=gtk2 gtk3 qt5")
+  '';
+
+  postPatch = let
+    isRelative = path: builtins.substring 0 1 path != "/";
+    mkSearchPath = path: ''
+      p; g; s,\<PLUGINDIR\>,"${path}",g;
+    '' + stdenv.lib.optionalString (isRelative path) ''
+      s/AddPath(\(.*\));/AddRelPath(\1, GWEN_PathManager_RelModeHome);/g
+    '';
+
+  in ''
+    sed -i -e '/GWEN_PathManager_DefinePath.*GWEN_PM_PLUGINDIR/,/^#endif/ {
+      /^#if/,/^#endif/ {
+        H; /^#endif/ {
+          ${stdenv.lib.concatMapStrings mkSearchPath pluginSearchPaths}
+        }
+      }
+    }' src/gwenhywfar.c
+
+    # Strip off the effective SO version from the path so that for example
+    # "lib/gwenhywfar/plugins/60" becomes just "lib/gwenhywfar/plugins".
+    sed -i -e '/^gwenhywfar_plugindir=/s,/\''${GWENHYWFAR_SO_EFFECTIVE},,' \
+      configure
+  '';
+
+  nativeBuildInputs = [ pkgconfig gettext which ];
+
+  buildInputs = [ gtk2 gtk3 qt5.qtbase gnutls openssl libgcrypt libgpgerror ];
+
+  meta = with stdenv.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;
+    maintainers = with maintainers; [ goibhniu ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/aqbanking/libchipcard.nix b/nixpkgs/pkgs/development/libraries/aqbanking/libchipcard.nix
new file mode 100644
index 000000000000..9a0b70e0d97f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/aqbanking/libchipcard.nix
@@ -0,0 +1,33 @@
+{ stdenv, fetchurl, pkgconfig, gwenhywfar, pcsclite, zlib }:
+
+let
+  inherit ((import ./sources.nix).libchipcard) sha256 releaseId version;
+in stdenv.mkDerivation rec {
+  name = "libchipcard-${version}";
+  inherit version;
+
+  src = let
+    qstring = "package=02&release=${releaseId}&file=01";
+    mkURLs = map (base: "${base}/sites/download/download.php?${qstring}");
+  in fetchurl {
+    name = "${name}.tar.gz";
+    urls = mkURLs [ "http://www.aquamaniac.de" "http://www2.aquamaniac.de" ];
+    inherit sha256;
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+
+  buildInputs = [ gwenhywfar pcsclite zlib ];
+
+  makeFlags = [ "crypttokenplugindir=$(out)/lib/gwenhywfar/plugins/ct" ];
+
+  configureFlags = [ "--with-gwen-dir=${gwenhywfar}" ];
+
+  meta = with stdenv.lib; {
+    description = "Library for access to chipcards";
+    homepage = http://www2.aquamaniac.de/sites/download/packages.php?package=02&showall=1;
+    license = licenses.lgpl21;
+    maintainers = with maintainers; [ aszlig ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/aqbanking/sources.nix b/nixpkgs/pkgs/development/libraries/aqbanking/sources.nix
new file mode 100644
index 000000000000..884543d282a7
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/aqbanking/sources.nix
@@ -0,0 +1,12 @@
+# This file is autogenerated from update.sh in the same directory.
+{
+  gwenhywfar.version = "4.20.0";
+  gwenhywfar.sha256 = "1c0g3f8jk6j693774ifslx2ds4ksabgbbalhhm9gk20kpamxm22s";
+  gwenhywfar.releaseId = "208";
+  libchipcard.version = "5.0.4";
+  libchipcard.sha256 = "0fj2h39ll4kiv28ch8qgzdbdbnzs8gl812qnm660bw89rynpjnnj";
+  libchipcard.releaseId = "200";
+  aqbanking.version = "5.7.8";
+  aqbanking.sha256 = "0s67mysskbiw1h1p0np4ph4351r7wq3nc873vylam7lsqi66xy0n";
+  aqbanking.releaseId = "217";
+}
diff --git a/nixpkgs/pkgs/development/libraries/aqbanking/update.sh b/nixpkgs/pkgs/development/libraries/aqbanking/update.sh
new file mode 100755
index 000000000000..8929e8bc6eb4
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/aqbanking/update.sh
@@ -0,0 +1,92 @@
+#!/bin/sh -e
+basedir="$(cd "$(dirname "$0")" && pwd)"
+
+getCurrentVersions() {
+    [ -e "$basedir/sources.nix" ] || return 0
+    (cd "$basedir" && nix-instantiate --eval --strict -E '
+    toString ((import ../../../../lib).mapAttrsToList
+        (name: info: "${name}:${info.version}!${info.sha256}!${info.releaseId}")
+        (import ./sources.nix))
+    ' | tr -d '"')
+}
+
+currentVersions="$(getCurrentVersions)"
+
+getLastestVersion() {
+    local baseurl="https://www.aquamaniac.de"
+    local pkglist="sites/download/packages.php?package=$1&showall=1"
+    local url="$baseurl/$pkglist"
+    local reVersion='[0-9]+(\.[0-9]+)+' # Only release versions, no betas!
+    local reHref='href=".*release=([0-9]+).*dummy=[^0-9]*('"$reVersion"')\.tar'
+    local reFull='s/^.*<a\>.*\<'"$reHref"'.*/\2!\1/p'
+    curl -s "$url" | sed -nre "$reFull" | sort -V -k 1,1 | tail -n1
+}
+
+getEntry() {
+    local name="$1"
+    for entry in $currentVersions; do
+        if [ "${entry%%:*}" = "$name" ]; then
+            echo "${entry#*:}"
+            return 0
+        fi
+    done
+    return 1
+}
+
+prefetchNew() {
+    local name="$1"
+    local version="$2"
+    local package="$3"
+    local releaseId="$4"
+
+    local url="http://www.aquamaniac.de/sites/download/download.php"
+    local qstring="package=$package&release=$releaseId&file=01";
+
+    nix-prefetch-url --name "$name-$version.tar.gz" "$url?$qstring"
+}
+
+processPackage() {
+    local name="$1"
+    local package="$2"
+
+    local latest="$(getLastestVersion "$package")"
+    local current="$(getEntry "$name")"
+    local currentTail="${current#*!}"
+
+    local currentVersion="${current%%!*}"
+    local currentSha256="${currentTail%%!*}"
+    local currentReleaseId="${current##*!}"
+
+    local latestVersion="${latest%%!*}"
+    local latestReleaseId="${latest##*!}"
+
+    if [ "$latestVersion" = "$currentVersion" -a \
+         "$latestReleaseId" = "$currentReleaseId" ]; then
+        echo "  $name.version = \"$currentVersion\";"
+        echo "  $name.sha256 = \"$currentSha256\";"
+        echo "  $name.releaseId = \"$currentReleaseId\";"
+        return 0
+    fi
+
+    local latestSha256="$(
+        prefetchNew "$name" "$latestVersion" "$package" "$latestReleaseId"
+    )"
+
+    echo "  $name.version = \"$latestVersion\";"
+    echo "  $name.sha256 = \"$latestSha256\";"
+    echo "  $name.releaseId = \"$latestReleaseId\";"
+    return 0
+}
+
+generateNewSources() {
+    echo "# This file is autogenerated from update.sh in the same directory."
+    echo "{"
+    for package in gwenhywfar:01 libchipcard:02 aqbanking:03; do
+        processPackage "${package%%:*}" "${package##*:}"
+    done
+    echo "}"
+}
+
+if newSources="$(generateNewSources)"; then
+    echo "$newSources" > "$basedir/sources.nix"
+fi
diff --git a/nixpkgs/pkgs/development/libraries/aravis/default.nix b/nixpkgs/pkgs/development/libraries/aravis/default.nix
new file mode 100644
index 000000000000..ba68f046b0a0
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/aravis/default.nix
@@ -0,0 +1,90 @@
+{ stdenv, fetchFromGitHub, autoreconfHook, pkgconfig, gtk-doc, intltool
+, audit, glib, libusb, libxml2
+, wrapGAppsHook
+, gstreamer ? null
+, gst-plugins-base ? null
+, gst-plugins-good ? null
+, gst-plugins-bad ? null
+, libnotify ? null
+, gnome3 ? null
+, gtk3 ? null
+, enableUsb ? true
+, enablePacketSocket ? true
+, enableViewer ? true
+, enableGstPlugin ? true
+, enableCppTest ? false
+, enableFastHeartbeat ? false
+, enableAsan ? false
+}:
+
+let
+  gstreamerAtLeastVersion1 =
+    stdenv.lib.all
+      (pkg: pkg != null && stdenv.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 enableViewer -> enableGstPlugin;
+  assert enableViewer -> libnotify != null;
+  assert enableViewer -> gnome3 != null;
+  assert enableViewer -> gtk3 != null;
+  assert enableViewer -> gstreamerAtLeastVersion1;
+
+  stdenv.mkDerivation rec {
+
+    pname = "aravis";
+    version = "0.6.2";
+
+    src = fetchFromGitHub {
+      owner = "AravisProject";
+      repo = pname;
+      rev= "ARAVIS_${builtins.replaceStrings ["."] ["_"] version}";
+      sha256 = "0zlmw040iv0xx9qw7ygzbl96bli6ivll2fbziv19f4bdc0yhqjpw";
+    };
+
+    outputs = [ "bin" "dev" "out" "lib" ];
+
+    nativeBuildInputs = [
+      autoreconfHook
+      pkgconfig
+      intltool
+      gtk-doc
+    ] ++ stdenv.lib.optional enableViewer wrapGAppsHook;
+
+    buildInputs =
+      [ glib libxml2 ]
+      ++ stdenv.lib.optional enableUsb libusb
+      ++ 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 ];
+
+    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
+        (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";
+
+    postPatch = ''
+        ln -s ${gtk-doc}/share/gtk-doc/data/gtk-doc.make .
+      '';
+
+    doCheck = true;
+
+    meta = {
+      description = "Library for video acquisition using GenICam cameras";
+      longDescription = ''
+        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;
+      maintainers = [];
+      platforms = stdenv.lib.platforms.unix;
+    };
+  }
+
diff --git a/nixpkgs/pkgs/development/libraries/arb/default.nix b/nixpkgs/pkgs/development/libraries/arb/default.nix
new file mode 100644
index 000000000000..4c34e40586f3
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/arb/default.nix
@@ -0,0 +1,27 @@
+{stdenv, fetchFromGitHub, fetchpatch, mpir, gmp, mpfr, flint}:
+stdenv.mkDerivation rec {
+  name = "${pname}-${version}";
+  pname = "arb";
+  version = "2.16.0";
+  src = fetchFromGitHub {
+    owner = "fredrik-johansson";
+    repo = "${pname}";
+    rev = "${version}";
+    sha256 = "0478671wfwy3gl26sbxh1jq1ih36z4k72waa8y2y2lvn649gb7cd";
+  };
+  buildInputs = [mpir gmp mpfr flint];
+  configureFlags = [
+    "--with-gmp=${gmp}"
+    "--with-mpir=${mpir}"
+    "--with-mpfr=${mpfr}"
+    "--with-flint=${flint}"
+  ];
+  doCheck = true;
+  meta = with stdenv.lib; {
+    inherit version;
+    description = ''A library for arbitrary-precision interval arithmetic'';
+    license = stdenv.lib.licenses.lgpl21Plus;
+    maintainers = with maintainers; [ raskin timokau ];
+    platforms = stdenv.lib.platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/argp-standalone/default.nix b/nixpkgs/pkgs/development/libraries/argp-standalone/default.nix
new file mode 100644
index 000000000000..4b8093f74031
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/argp-standalone/default.nix
@@ -0,0 +1,55 @@
+{ stdenv, fetchurl, fetchpatch }:
+
+let
+  patch-argp-fmtstream = fetchpatch {
+    name = "patch-argp-fmtstream.h";
+    url = "https://raw.githubusercontent.com/Homebrew/formula-patches/b5f0ad3/argp-standalone/patch-argp-fmtstream.h";
+    sha256 = "5656273f622fdb7ca7cf1f98c0c9529bed461d23718bc2a6a85986e4f8ed1cb8";
+  };
+
+  patch-throw-in-funcdef = fetchpatch {
+    name = "argp-standalone-1.3-throw-in-funcdef.patch";
+    url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/sys-libs/argp-standalone/files/argp-standalone-1.3-throw-in-funcdef.patch?id=409d0e2a9c9c899fb1fb04cc808fe0aff3f745ca";
+    sha256 = "0b2b4l1jkvmnffl22jcn4ydzxy2i7fnmmnfim12f0yg5pb8fs43c";
+  };
+
+  patch-shared = fetchpatch {
+    name = "argp-standalone-1.3-shared.patch";
+    url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/sys-libs/argp-standalone/files/argp-standalone-1.3-shared.patch?id=409d0e2a9c9c899fb1fb04cc808fe0aff3f745ca";
+    sha256 = "1xx2zdc187a1m2x6c1qs62vcrycbycw7n0q3ks2zkxpaqzx2dgkw";
+  };
+in
+stdenv.mkDerivation rec {
+  name = "argp-standalone-1.3";
+
+  src = fetchurl {
+    url = "https://www.lysator.liu.se/~nisse/misc/argp-standalone-1.3.tar.gz";
+    sha256 = "dec79694da1319acd2238ce95df57f3680fea2482096e483323fddf3d818d8be";
+  };
+
+  patches =
+       stdenv.lib.optionals stdenv.hostPlatform.isDarwin [ patch-argp-fmtstream ]
+    ++ stdenv.lib.optionals stdenv.hostPlatform.isLinux [ patch-throw-in-funcdef patch-shared ];
+
+  patchFlags = stdenv.lib.optionalString stdenv.hostPlatform.isDarwin "-p0";
+
+  preConfigure = stdenv.lib.optionalString stdenv.hostPlatform.isLinux "export CFLAGS='-fgnu89-inline'";
+
+  postInstall = ''
+    mkdir -p $out/lib $out/include
+    cp libargp.a $out/lib
+    cp argp.h $out/include
+  '';
+
+  doCheck = true;
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    homepage = "https://www.lysator.liu.se/~nisse/misc/";
+    description = "Standalone version of arguments parsing functions from GLIBC";
+    platforms = with platforms; darwin ++ [ "x86_64-linux" ];
+    maintainers = with maintainers; [ amar1729 ];
+    license = licenses.gpl2;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/arguments/default.nix b/nixpkgs/pkgs/development/libraries/arguments/default.nix
new file mode 100644
index 000000000000..cb0c65e97e3b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/arguments/default.nix
@@ -0,0 +1,31 @@
+{ stdenv, fetchFromGitHub, cmake }:
+
+stdenv.mkDerivation rec {
+  pname = "arguments";
+  name  = "${pname}-2015-11-30";
+
+  owner = "BIC-MNI";
+
+  src = fetchFromGitHub {
+    inherit owner;
+    repo   = pname;
+    rev    = "b3aad97f6b6892cb8733455d0d448649a48fa108";
+    sha256 = "1ar8lm1w1jflz3vdmjr5c4x6y7rscvrj78b8gmrv79y95qrgzv6s";
+  };
+
+  nativeBuildInputs = [ cmake ];
+  buildInputs = [ ];
+
+  #cmakeFlags = [ "-DLIBMINC_DIR=${libminc}/lib" "-DBICPL_DIR=${bicpl}/lib" ];
+
+  doCheck = false;
+  # internal_volume_io.h: No such file or directory
+
+  meta = with stdenv.lib; {
+    homepage = "https://github.com/${owner}/${pname}";
+    description = "Library for argument handling for MINC programs";
+    maintainers = with maintainers; [ bcdarwin ];
+    platforms = platforms.unix;
+    license   = licenses.free;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/armadillo/default.nix b/nixpkgs/pkgs/development/libraries/armadillo/default.nix
new file mode 100644
index 000000000000..c65689136646
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/armadillo/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchurl, cmake, openblasCompat, superlu, hdf5 }:
+
+stdenv.mkDerivation rec {
+  version = "9.400.4";
+  name = "armadillo-${version}";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/arma/armadillo-${version}.tar.xz";
+    sha256 = "1wv08i8mq16hswxkll3kmbfih4hz4d8v7apszm76lwxpya2bm65l";
+  };
+
+  nativeBuildInputs = [ cmake ];
+  buildInputs = [ openblasCompat superlu hdf5 ];
+
+  cmakeFlags = [
+    "-DLAPACK_LIBRARY=${openblasCompat}/lib/libopenblas${stdenv.hostPlatform.extensions.sharedLibrary}"
+    "-DDETECT_HDF5=ON"
+  ];
+
+  patches = [ ./use-unix-config-on-OS-X.patch ];
+
+  meta = with stdenv.lib; {
+    description = "C++ linear algebra library";
+    homepage = http://arma.sourceforge.net;
+    license = licenses.asl20;
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ juliendehos knedlsepp ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/armadillo/use-unix-config-on-OS-X.patch b/nixpkgs/pkgs/development/libraries/armadillo/use-unix-config-on-OS-X.patch
new file mode 100644
index 000000000000..a1442d141193
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/armadillo/use-unix-config-on-OS-X.patch
@@ -0,0 +1,10 @@
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -152,6 +152,7 @@ message(STATUS "DETECT_HDF5                = ${DETECT_HDF5}"               )
+
+ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake_aux/Modules/")
+
++set(APPLE false)
+ if(APPLE)
+   
+   set(ARMA_OS macos)
diff --git a/nixpkgs/pkgs/development/libraries/arrow-cpp/darwin.patch b/nixpkgs/pkgs/development/libraries/arrow-cpp/darwin.patch
new file mode 100644
index 000000000000..de9b1986ffed
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/arrow-cpp/darwin.patch
@@ -0,0 +1,11 @@
+diff --git a/cmake_modules/FindPythonLibsNew.cmake b/cmake_modules/FindPythonLibsNew.cmake
+--- a/cmake_modules/FindPythonLibsNew.cmake
++++ b/cmake_modules/FindPythonLibsNew.cmake
+@@ -117,6 +117,7 @@ list(GET _PYTHON_VALUES 6 PYTHON_SIZEOF_VOID_P)
+ list(GET _PYTHON_VALUES 7 PYTHON_LIBRARY_SUFFIX)
+ list(GET _PYTHON_VALUES 8 PYTHON_LIBRARY_PATH)
+ list(GET _PYTHON_VALUES 9 PYTHON_OTHER_LIBS)
++string(REPLACE "-lncurses" "" PYTHON_OTHER_LIBS "${PYTHON_OTHER_LIBS}")
+ 
+ # Make sure the Python has the same pointer-size as the chosen compiler
+ # Skip the check on OS X, it doesn't consistently have CMAKE_SIZEOF_VOID_P defined
diff --git a/nixpkgs/pkgs/development/libraries/arrow-cpp/default.nix b/nixpkgs/pkgs/development/libraries/arrow-cpp/default.nix
new file mode 100644
index 000000000000..7f7ef3336a4c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/arrow-cpp/default.nix
@@ -0,0 +1,80 @@
+{ stdenv, fetchurl, fetchFromGitHub, autoconf, boost, brotli, cmake, double-conversion, flatbuffers, gflags, glog, gtest, lz4, perl, python, rapidjson, snappy, thrift, uriparser, which, zlib, zstd }:
+
+let
+  parquet-testing = fetchFromGitHub {
+    owner = "apache";
+    repo = "parquet-testing";
+    rev = "8991d0b58d5a59925c87dd2a0bdb59a5a4a16bd4";
+    sha256 = "00js5d1s98y3ianrvh1ggrd157yfmia4g55jx9xmfcz4a8mcbawx";
+  };
+
+  # Enable non-bundled uriparser
+  # Introduced in https://github.com/apache/arrow/pull/4092
+  Finduriparser_cmake = fetchurl {
+    url = https://raw.githubusercontent.com/apache/arrow/af4f52961209a5f1b43a19483536285c957e3bed/cpp/cmake_modules/Finduriparser.cmake;
+    sha256 = "1cylrw00n2nkc2c49xk9j3rrza351rpravxgpw047vimcw0sk93s";
+  };
+in
+
+stdenv.mkDerivation rec {
+  name = "arrow-cpp-${version}";
+  version = "0.13.0";
+
+  src = fetchurl {
+    url = "mirror://apache/arrow/arrow-${version}/apache-arrow-${version}.tar.gz";
+    sha256 = "06irh5zx6lc7jjf6hpz1vzk0pvbdx08lcirc8cp8ksb8j7fpfamc";
+  };
+
+  sourceRoot = "apache-arrow-${version}/cpp";
+
+  patches = [
+    # patch to fix python-test
+    ./darwin.patch
+    ];
+
+  nativeBuildInputs = [ cmake autoconf /* for vendored jemalloc */ ];
+  buildInputs = [
+    boost brotli double-conversion flatbuffers gflags glog gtest lz4 rapidjson
+    snappy thrift uriparser zlib zstd python.pkgs.python python.pkgs.numpy
+  ];
+
+  preConfigure = ''
+    substituteInPlace cmake_modules/FindLz4.cmake --replace CMAKE_STATIC_LIBRARY CMAKE_SHARED_LIBRARY
+
+    cp ${Finduriparser_cmake} cmake_modules/Finduriparser.cmake
+
+    patchShebangs build-support/
+
+    # Fix build for ARROW_USE_SIMD=OFF
+    # https://jira.apache.org/jira/browse/ARROW-5007
+    sed -i src/arrow/util/sse-util.h -e '1i#include "arrow/util/logging.h"'
+    sed -i src/arrow/util/neon-util.h -e '1i#include "arrow/util/logging.h"'
+  '';
+
+  cmakeFlags = [
+    "-DARROW_BUILD_TESTS=ON"
+    "-DARROW_DEPENDENCY_SOURCE=SYSTEM"
+    "-DARROW_PARQUET=ON"
+    "-DARROW_PYTHON=ON"
+    "-Duriparser_SOURCE=SYSTEM"
+  ] ++ stdenv.lib.optional (!stdenv.isx86_64) "-DARROW_USE_SIMD=OFF";
+
+  doInstallCheck = true;
+  PARQUET_TEST_DATA = if doInstallCheck then "${parquet-testing}/data" else null;
+  installCheckInputs = [ perl which ];
+  installCheckPhase = (stdenv.lib.optionalString stdenv.isDarwin ''
+    for f in release/*-test; do
+      install_name_tool -add_rpath "$out"/lib  "$f"
+    done
+  '') + ''
+    ctest -L unittest -V
+  '';
+
+  meta = {
+    description = "A  cross-language development platform for in-memory data";
+    homepage = https://arrow.apache.org/;
+    license = stdenv.lib.licenses.asl20;
+    platforms = stdenv.lib.platforms.unix;
+    maintainers = with stdenv.lib.maintainers; [ veprbl ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/asio/1.10.nix b/nixpkgs/pkgs/development/libraries/asio/1.10.nix
new file mode 100644
index 000000000000..f63fbbd495cb
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/asio/1.10.nix
@@ -0,0 +1,6 @@
+{callPackage, ... } @ args:
+
+callPackage ./generic.nix (args // {
+  version = "1.10.8";
+  sha256 = "0jgdl4fxw0hwy768rl3lhdc0czz7ak7czf3dg10j21pdpfpfvpi6";
+})
diff --git a/nixpkgs/pkgs/development/libraries/asio/1.12.nix b/nixpkgs/pkgs/development/libraries/asio/1.12.nix
new file mode 100644
index 000000000000..94fe4c703670
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/asio/1.12.nix
@@ -0,0 +1,6 @@
+{callPackage, ... } @ args:
+
+callPackage ./generic.nix (args // {
+  version = "1.12.1";
+  sha256 = "0nln45662kg799ykvqx5m9z9qcsmadmgg6r5najryls7x16in2d9";
+})
diff --git a/nixpkgs/pkgs/development/libraries/asio/generic.nix b/nixpkgs/pkgs/development/libraries/asio/generic.nix
new file mode 100644
index 000000000000..72305cb633fb
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/asio/generic.nix
@@ -0,0 +1,26 @@
+{stdenv, fetchurl, boost, openssl
+, version, sha256, ...
+}:
+
+with stdenv.lib;
+
+stdenv.mkDerivation {
+  name = "asio-${version}";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/asio/asio-${version}.tar.bz2";
+    inherit sha256;
+  };
+
+  propagatedBuildInputs = [ boost ];
+
+  buildInputs = [ openssl ];
+
+  meta = {
+    homepage = http://asio.sourceforge.net/;
+    description = "Cross-platform C++ library for network and low-level I/O programming";
+    license = licenses.boost;
+    broken = stdenv.isDarwin;  # test when updating to >=1.12.1
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/aspell/aspell-with-dicts.nix b/nixpkgs/pkgs/development/libraries/aspell/aspell-with-dicts.nix
new file mode 100644
index 000000000000..fd5ccf9696cc
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/aspell/aspell-with-dicts.nix
@@ -0,0 +1,36 @@
+# Create a derivation that contains aspell and selected dictionaries.
+# Composition is done using `pkgs.buildEnv`.
+# Beware of that `ASPELL_CONF` used by this derivation is not always
+# respected by libaspell (#28815) and in some cases, when used as
+# dependency by another derivation, the passed dictionaries will be
+# missing. However, invoking aspell directly should be fine.
+
+{ aspell
+, aspellDicts
+, makeWrapper
+, buildEnv
+}:
+
+f:
+
+let
+  # Dictionaries we want
+  dicts = f aspellDicts;
+
+in buildEnv {
+  name = "aspell-env";
+  buildInputs = [ makeWrapper ];
+  paths = [ aspell ] ++ dicts;
+  postBuild = ''
+    # Construct wrappers in /bin
+    unlink "$out/bin"
+    mkdir -p "$out/bin"
+    pushd "${aspell}/bin"
+    for prg in *; do
+      if [ -f "$prg" ]; then
+        makeWrapper "${aspell}/bin/$prg" "$out/bin/$prg" --set ASPELL_CONF "dict-dir $out/lib/aspell"
+      fi
+    done
+    popd
+  '';
+}
\ No newline at end of file
diff --git a/nixpkgs/pkgs/development/libraries/aspell/clang.patch b/nixpkgs/pkgs/development/libraries/aspell/clang.patch
new file mode 100644
index 000000000000..c4cfa426588c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/aspell/clang.patch
@@ -0,0 +1,18 @@
+--- interfaces/cc/aspell.h	2013-10-13 20:29:33.000000000 +0200
++++ interfaces/cc/aspell.h	2013-10-13 20:30:01.000000000 +0200
+@@ -237,6 +237,7 @@
+ /******************************** errors ********************************/
+ 
+ 
++#ifndef __cplusplus
+ extern const struct AspellErrorInfo * const aerror_other;
+ extern const struct AspellErrorInfo * const aerror_operation_not_supported;
+ extern const struct AspellErrorInfo * const   aerror_cant_copy;
+@@ -322,6 +323,7 @@
+ extern const struct AspellErrorInfo * const   aerror_bad_magic;
+ extern const struct AspellErrorInfo * const aerror_expression;
+ extern const struct AspellErrorInfo * const   aerror_invalid_expression;
++#endif
+ 
+ 
+ /******************************* speller *******************************/
diff --git a/nixpkgs/pkgs/development/libraries/aspell/data-dirs-from-nix-profiles.patch b/nixpkgs/pkgs/development/libraries/aspell/data-dirs-from-nix-profiles.patch
new file mode 100644
index 000000000000..c19827ba93e4
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/aspell/data-dirs-from-nix-profiles.patch
@@ -0,0 +1,38 @@
+diff --git a/common/info.cpp b/common/info.cpp
+index 8291cc7..6216326 100644
+--- a/common/info.cpp
++++ b/common/info.cpp
+@@ -36,6 +36,7 @@
+ #include "strtonum.hpp"
+ #include "lock.hpp"
+ #include "string_map.hpp"
++#include "file_util.hpp"
+ 
+ #include "gettext.h"
+ 
+@@ -495,6 +496,25 @@ namespace acommon {
+     lst.clear();
+     lst.add(config->retrieve("data-dir"));
+     lst.add(config->retrieve("dict-dir"));
++    if (config->lookup("data-dir") == NULL && config->lookup("dict-dir") == NULL) {
++        const char* cprofiles = getenv("NIX_PROFILES");
++        if (cprofiles != NULL) {
++            char* profiles = strdup(cprofiles);
++            char* profile = profiles;
++            char* end = profile;
++            while (*end != '\0') {
++                if (*end == ' ') {
++                    *end = '\0';
++                    lst.add(add_possible_dir(profile, "lib/aspell"));
++                    profile = ++end;
++                } else {
++                    ++end;
++                }
++            }
++            lst.add(add_possible_dir(profile, "lib/aspell"));
++            free(profiles);
++        }
++    }
+   }
+ 
+   DictExt::DictExt(ModuleInfo * m, const char * e)
diff --git a/nixpkgs/pkgs/development/libraries/aspell/default.nix b/nixpkgs/pkgs/development/libraries/aspell/default.nix
new file mode 100644
index 000000000000..5c3c6272f83d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/aspell/default.nix
@@ -0,0 +1,62 @@
+{ stdenv, fetchurl, fetchpatch, fetchzip, perl
+, searchNixProfiles ? true
+}:
+
+let
+
+  # Source for u-deva.cmap and u-deva.cset: use the Marathi
+  # dictionary like Debian does.
+  devaMapsSource = fetchzip {
+    name = "aspell-u-deva";
+    url = "ftp://ftp.gnu.org/gnu/aspell/dict/mr/aspell6-mr-0.10-0.tar.bz2";
+    sha256 = "1v8cdl8x2j1d4vbvsq1xrqys69bbccd6mi03fywrhkrrljviyri1";
+  };
+
+in
+
+stdenv.mkDerivation rec {
+  name = "aspell-0.60.6.1";
+
+  src = fetchurl {
+    url = "mirror://gnu/aspell/${name}.tar.gz";
+    sha256 = "1qgn5psfyhbrnap275xjfrzppf5a83fb67gpql0kfqv37al869gm";
+  };
+
+  patches = [
+    (fetchpatch { # remove in >= 0.60.7
+      name = "gcc-7.patch";
+      url = "https://github.com/GNUAspell/aspell/commit/8089fa02122fed0a.diff";
+      sha256 = "1b3p1zy2lqr2fknddckm58hyk95hw4scf6hzjny1v9iaic2p37ix";
+    })
+  ] ++ stdenv.lib.optional searchNixProfiles ./data-dirs-from-nix-profiles.patch;
+
+  postPatch = ''
+    patch interfaces/cc/aspell.h < ${./clang.patch}
+  '';
+
+  nativeBuildInputs = [ perl ];
+
+  doCheck = true;
+
+  preConfigure = ''
+    configureFlagsArray=(
+      --enable-pkglibdir=$out/lib/aspell
+      --enable-pkgdatadir=$out/lib/aspell
+    );
+  '';
+
+  # Include u-deva.cmap and u-deva.cset in the aspell package
+  # to avoid conflict between 'mr' and 'hi' dictionaries as they
+  # both include those files.
+  postInstall = ''
+    cp ${devaMapsSource}/u-deva.{cmap,cset} $out/lib/aspell/
+  '';
+
+  meta = {
+    description = "Spell checker for many languages";
+    homepage = http://aspell.net/;
+    license = stdenv.lib.licenses.lgpl2Plus;
+    maintainers = [ ];
+    platforms = with stdenv.lib.platforms; all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/aspell/dictionaries.nix b/nixpkgs/pkgs/development/libraries/aspell/dictionaries.nix
new file mode 100644
index 000000000000..992119faf65e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/aspell/dictionaries.nix
@@ -0,0 +1,944 @@
+{lib, stdenv, fetchurl, aspell, which, writeScript}:
+
+with lib;
+
+/* HOWTO:
+
+   * Add some of these to your profile or systemPackages.
+
+     ~~~~
+     environment.systemPackages = [
+       aspell
+       aspellDicts.en
+       aspellDicts.en-computers
+       aspellDicts.en-science
+     ];
+     ~~~~
+
+   * Rebuild and switch to the new profile.
+   * Add something like
+
+     ~~~~
+     master en_US
+     extra-dicts en-computers.rws
+     add-extra-dicts en_US-science.rws
+     ~~~~
+
+     to `/etc/aspell.conf` or `~/.aspell.conf`.
+   * Check that `aspell -a` starts without errors.
+   * (optional) Check your config with `aspell dump config | grep -vE '^(#|$)'`.
+   * Enjoy.
+
+*/
+
+let
+
+  /* Function to compile an Aspell dictionary.  Fortunately, they all
+     build in the exact same way. */
+  buildDict =
+    {shortName, fullName, ...}@args:
+
+    stdenv.mkDerivation ({
+      name = "aspell-dict-${shortName}";
+
+      buildInputs = [aspell which];
+
+      dontAddPrefix = true;
+
+      preBuild = "makeFlagsArray=(dictdir=$out/lib/aspell datadir=$out/lib/aspell)";
+
+      meta = {
+        description = "Aspell dictionary for ${fullName}";
+        platforms = stdenv.lib.platforms.all;
+      } // (args.meta or {});
+    } // removeAttrs args [ "meta" ]);
+
+
+  buildOfficialDict =
+    {language, version, filename, fullName, sha256, ...}@args:
+    let buildArgs = {
+      shortName = "${language}-${version}";
+
+      src = fetchurl {
+        url = "mirror://gnu/aspell/dict/${language}/${filename}-${language}-${version}.tar.bz2";
+        inherit sha256;
+      };
+
+      /* Remove any instances of u-deva.cmap and u-deva.cset since
+         they are included in the main aspell package and can
+         cause conflicts otherwise. */
+      postInstall = ''
+        rm -f $out/lib/aspell/u-deva.{cmap,cset}
+      '';
+
+      passthru.updateScript = writeScript "update-aspellDict-${language}" ''
+        #!/usr/bin/env nix-shell
+        #!nix-shell -i bash -p nix curl gnused common-updater-scripts
+        set -eu -o pipefail
+
+        # List tarballs in the dictionary's subdirectory via HTTPS and
+        # the simple list method of Apache's mod_autoindex.
+        #
+        # Catalan dictionary has an exception where an earlier version
+        # compares as newer because the versioning scheme has changed.
+        versions=$(
+            echo '[';
+            curl -s 'https://ftp.gnu.org/gnu/aspell/dict/${language}/?F=0' | \
+                sed -r 's/.* href="${filename}-${language}-([A-Za-z0-9_+.-]+)\.tar\.bz2".*/"\1"/;t;d' | \
+                if [ '${language}' = "ca" ]; then grep -v 20040130-1; else cat; fi; \
+            echo ']')
+
+        # Sort versions in descending order using Nix's and take the first as the latest.
+        sortVersions="(with builtins; head (sort (a: b: compareVersions a b > 0) $versions))"
+        # nix-instantiate outputs Nix strings (with quotes), so remove them to get
+        # a result similar to `nix eval --raw`.
+        latestVersion=$(nix-instantiate --eval --expr "$sortVersions" | tr -d '"')
+
+        update-source-version aspellDicts.${language} "$latestVersion"
+      '';
+
+      meta = {
+        homepage = "http://ftp.gnu.org/gnu/aspell/dict/0index.html";
+      } // (args.meta or {});
+
+    } // removeAttrs args [ "language" "filename" "sha256" "meta" ];
+    in buildDict buildArgs;
+
+  /* Function to compile txt dict files into Aspell dictionaries. */
+  buildTxtDict =
+    {langInputs ? [], ...}@args:
+    buildDict ({
+      propagatedUserEnvPackages = langInputs;
+
+      preBuild = ''
+        # Aspell can't handle multiple data-dirs
+        # Copy everything we might possibly need
+        ${concatMapStringsSep "\n" (p: ''
+          cp -a ${p}/lib/aspell/* .
+        '') ([ aspell ] ++ langInputs)}
+        export ASPELL_CONF="data-dir $(pwd)"
+
+        aspell-create() {
+          target=$1
+          shift
+          echo building $target
+          aspell create "$@" master ./$target.rws
+        }
+
+        words-only() {
+          awk -F'\t' '{print $1}' | sort | uniq
+        }
+
+        # drop comments
+        aspell-affix() {
+          words-only \
+            | grep -v '#' \
+            | aspell-create "$@"
+        }
+
+        # Hack: drop comments and words with affixes
+        aspell-plain() {
+          words-only \
+            | grep -v '#' \
+            | grep -v '/' \
+            | aspell-create "$@"
+        }
+
+        aspell-install() {
+          install -d $out/lib/aspell
+          for a in "$@"; do
+            echo installing $a
+            install -t $out/lib/aspell $a.rws
+          done
+        }
+      '';
+
+      phases = [ "preBuild" "buildPhase" "installPhase" ];
+    } // args);
+
+in rec {
+
+  ### Languages
+
+  af = buildOfficialDict rec {
+    language = "af";
+    version = "0.50-0";
+    fullName = "Afrikaans";
+    filename = "aspell";
+    sha256 = "00p6k2ndi0gzfr5fkbvx4hkcpj223pidjvmxg0r384arrap00q4x";
+  };
+
+  am = buildOfficialDict rec {
+    language = "am";
+    version = "0.03-1";
+    fullName = "Amharic";
+    filename = "aspell6";
+    sha256 = "11ylp7gjq94wfacyawvp391lsq26rl1b84f268rjn7l7z0hxs9xz";
+  };
+
+  ar = buildOfficialDict rec {
+    language = "ar";
+    version = "1.2-0";
+    fullName = "Arabic";
+    filename = "aspell6";
+    sha256 = "1avw40bp8yi5bnkq64ihm2rldgw34lk89yz281q9bmndh95a47h4";
+  };
+
+  ast = buildOfficialDict rec {
+    language = "ast";
+    version = "0.01";
+    fullName = "Asturian";
+    filename = "aspell6";
+    sha256 = "14hg85mxcyvdigf96yvslk7f3v9ngdsxn85qpgwkg31k3k83xwj3";
+  };
+
+  az = buildOfficialDict rec {
+    language = "az";
+    version = "0.02-0";
+    fullName = "Azerbaijani";
+    filename = "aspell6";
+    sha256 = "1hs4h1jscpxf9f9iyk6mvjqsnhkf0yslkbjhjkasqqcx8pn7cc86";
+  };
+
+  be = buildOfficialDict rec {
+    language = "be";
+    version = "0.01";
+    fullName = "Belarusian";
+    filename = "aspell5";
+    sha256 = "1svls9p7rsfi3hs0afh0cssj006qb4v1ik2yzqgj8hm10c6as2sm";
+  };
+
+  bg = buildOfficialDict rec {
+    language = "bg";
+    version = "4.1-0";
+    fullName = "Bulgarian";
+    filename = "aspell6";
+    sha256 = "1alacmgpfk0yrgq83y23d16fhav1bxmb98kg8d2a5r9bvh2h0mvl";
+  };
+
+  bn = buildOfficialDict rec {
+    language = "bn";
+    version = "0.01.1-1";
+    fullName = "Bengali";
+    filename = "aspell6";
+    sha256 = "1nc02jd67iggirwxnhdvlvaqm0xfyks35c4psszzj3dhzv29qgxh";
+  };
+
+  br = buildOfficialDict rec {
+    language = "br";
+    version = "0.50-2";
+    fullName = "Breton";
+    filename = "aspell";
+    sha256 = "0fradnm8424bkq9a9zhpl2132dk7y95xmw45sy1c0lx6rinjl4n2";
+  };
+
+  ca = buildOfficialDict rec {
+    language = "ca";
+    version = "2.1.5-1";
+    fullName = "Catalan";
+    filename = "aspell6";
+    sha256 = "1fb5y5kgvk25nlsfvc8cai978hg66x3pbp9py56pldc7vxzf9npb";
+  };
+
+  cs = buildOfficialDict rec {
+    language = "cs";
+    version = "20040614-1";
+    fullName = "Czech";
+    filename = "aspell6";
+    sha256 = "0rihj4hsw96pd9casvmpvw3r8040pfa28p1h73x4vyn20zwr3h01";
+  };
+
+  csb = buildOfficialDict rec {
+    language = "csb";
+    version = "0.02-0";
+    fullName = "Kashubian";
+    filename = "aspell6";
+    sha256 = "1612ypkm684wjvc7n081i87mlrrzif9simc7kyn177hfsl3ssrn1";
+  };
+
+  cy = buildOfficialDict rec {
+    language = "cy";
+    version = "0.50-3";
+    fullName = "Welsh";
+    filename = "aspell";
+    sha256 = "15vq601lzz1gi311xym4bv9lv1k21xcfn50jmzamw7h6f36rsffm";
+  };
+
+  da = buildOfficialDict rec {
+    language = "da";
+    version = "1.4.42-1";
+    fullName = "Danish";
+    filename = "aspell5";
+    sha256 = "1hfkmiyhgrx5lgrb2mffjbdn1hivrm73wcg7x0iid74p2yb0fjpp";
+  };
+
+  de = buildOfficialDict rec {
+    language = "de";
+    version = "20030222-1";
+    fullName = "German";
+    filename = "aspell6";
+    sha256 = "01p92qj66cqb346gk7hjfynaap5sbcn85xz07kjfdq623ghr8v5s";
+  };
+
+  de-alt = buildOfficialDict rec {
+    language = "de-alt";
+    version = "2.1-1";
+    fullName = "German - Old Spelling";
+    filename = "aspell6";
+    sha256 = "0wwc2l29svv3fv041fh6vfa5m3hi9q9pkbxibzq1ysrsfin3rl9n";
+  };
+
+  el = buildOfficialDict rec {
+    language = "el";
+    version = "0.08-0";
+    fullName = "Greek";
+    filename = "aspell6";
+    sha256 = "1ljcc30zg2v2h3w5h5jr5im41mw8jbsgvvhdd2cii2yzi8d0zxja";
+  };
+
+  en = buildOfficialDict rec {
+    language = "en";
+    version = "2018.04.16-0";
+    fullName = "English";
+    filename = "aspell6";
+    sha256 = "0bxxdzkk9g27plg22y9qzsx9cfjw3aa29w5bmzs561qc9gkp247i";
+  };
+
+  eo = buildOfficialDict rec {
+    language = "eo";
+    version = "2.1.20000225a-2";
+    fullName = "Esperanto";
+    filename = "aspell6";
+    sha256 = "09vf0mbiicbmyb4bwb7v7lgpabnylg0wy7m3hlhl5rjdda6x3lj1";
+  };
+
+  es = buildOfficialDict rec {
+    language = "es";
+    version = "1.11-2";
+    fullName = "Spanish";
+    filename = "aspell6";
+    sha256 = "1k5g328ac1hdpp6fsg57d8md6i0aqcwlszp3gbmp5706wyhpydmd";
+  };
+
+  et = buildOfficialDict rec {
+    language = "et";
+    version = "0.1.21-1";
+    fullName = "Estonian";
+    filename = "aspell6";
+    sha256 = "0jdjfa2fskirhnb70fy86xryp9r6gkl729ib8qcjmsma7nm5gs5i";
+  };
+
+  fa = buildOfficialDict rec {
+    language = "fa";
+    version = "0.11-0";
+    fullName = "Persian";
+    filename = "aspell6";
+    sha256 = "0nz1ybwv56q7nl9ip12hfmdch1vyyq2j55bkjcns13lshzm2cba8";
+  };
+
+  fi = buildOfficialDict rec {
+    language = "fi";
+    version = "0.7-0";
+    fullName = "Finnish";
+    filename = "aspell6";
+    sha256 = "07d5s08ba4dd89cmwy9icc01i6fjdykxlb9ravmhdrhi8mxz1mzq";
+  };
+
+  fo = buildOfficialDict rec {
+    language = "fo";
+    version = "0.2.16-1";
+    fullName = "Faroese";
+    filename = "aspell5";
+    sha256 = "022yz5lll20xrzizcyb7wksm3fgwklnvgnir5la5qkxv770dvq7p";
+  };
+
+  fr = buildOfficialDict rec {
+    language = "fr";
+    version = "0.50-3";
+    fullName = "French";
+    filename = "aspell";
+    sha256 = "14ffy9mn5jqqpp437kannc3559bfdrpk7r36ljkzjalxa53i0hpr";
+  };
+
+  fy = buildOfficialDict rec {
+    language = "fy";
+    version = "0.12-0";
+    fullName = "Frisian";
+    filename = "aspell6";
+    sha256 = "1almi6n4ni91d0rzrk8ig0473m9ypbwqmg56hchz76j51slwyirl";
+  };
+
+  ga = buildOfficialDict rec {
+    language = "ga";
+    version = "4.5-0";
+    fullName = "Irish";
+    filename = "aspell5";
+    sha256 = "0y869mmvfb3bzadfgajwa2rfb0xfhi6m9ydwgxkb9v2claydnps5";
+  };
+
+  gd = buildOfficialDict rec {
+    language = "gd";
+    version = "0.1.1-1";
+    fullName = "Scottish Gaelic";
+    filename = "aspell5";
+    sha256 = "0a89irv5d65j5m9sb0k36851x5rs0wij12gb2m6hv2nsfn5a05p3";
+  };
+
+  gl = buildOfficialDict rec {
+    language = "gl";
+    version = "0.5a-2";
+    fullName = "Galician";
+    filename = "aspell6";
+    sha256 = "12pwghmy18fcdvf9hvhb4q6shi339hb1kwxpkz0bhw0yjxjwzkdk";
+  };
+
+  grc = buildOfficialDict rec {
+    language = "grc";
+    version = "0.02-0";
+    fullName = "Ancient Greek";
+    filename = "aspell6";
+    sha256 = "1zxr8958v37v260fkqd4pg37ns5h5kyqm54hn1hg70wq5cz8h512";
+  };
+
+  gu = buildOfficialDict rec {
+    language = "gu";
+    version = "0.03-0";
+    fullName = "Gujarati";
+    filename = "aspell6";
+    sha256 = "04c38jnl74lpj2jhjz4zpqbs2623vwc71m6wc5h4b1karid14b23";
+  };
+
+  gv = buildOfficialDict rec {
+    language = "gv";
+    version = "0.50-0";
+    fullName = "Manx Gaelic";
+    filename = "aspell";
+    sha256 = "1rknf4yaw9s29c77sdzg98nhnmjwpicdb69igmz1n768npz2drmv";
+  };
+
+  he = buildOfficialDict rec {
+    language = "he";
+    version = "1.0-0";
+    fullName = "Hebrew";
+    filename = "aspell6";
+    sha256 = "13bhbghx5b8g0119g3wxd4n8mlf707y41vlf59irxjj0kynankfn";
+  };
+
+  hi = buildOfficialDict rec {
+    language = "hi";
+    version = "0.02-0";
+    fullName = "Hindi";
+    filename = "aspell6";
+    sha256 = "0drs374qz4419zx1lf2k281ydxf2750jk5ailafj1x0ncz27h1ys";
+  };
+
+  hil = buildOfficialDict rec {
+    language = "hil";
+    version = "0.11-0";
+    fullName = "Hiligaynon";
+    filename = "aspell5";
+    sha256 = "1s482fsfhzic9qa80al4418q3ni3gfn2bkwkd2y46ydrs17kf2jp";
+  };
+
+  hr = buildOfficialDict rec {
+    language = "hr";
+    version = "0.51-0";
+    fullName = "Croatian";
+    filename = "aspell";
+    sha256 = "09aafyf1vqhaxvcf3jfzf365k394b5pf0iivsr2ix5npah1h7i1a";
+  };
+
+  hsb = buildOfficialDict rec {
+    language = "hsb";
+    version = "0.02-0";
+    fullName = "Upper Sorbian";
+    filename = "aspell6";
+    sha256 = "0bi2vhz7n1vmg43wbbh935pmzihv80iyz9z65j94lxf753j2m7wd";
+  };
+
+  hu = buildOfficialDict rec {
+    language = "hu";
+    version = "0.99.4.2-0";
+    fullName = "Hungarian";
+    filename = "aspell6";
+    sha256 = "1d9nybip2k1dz69zly3iv0npbi3yxgfznh1py364nxzrbjsafd9k";
+  };
+
+  hus = buildOfficialDict rec {
+    language = "hus";
+    version = "0.03-1";
+    fullName = "Huastec";
+    filename = "aspell6";
+    sha256 = "09glipfpkz9xch17z11zw1yn2z7jx1f2svfmjn9l6wm1s5qz6a3d";
+  };
+
+  hy = buildOfficialDict rec {
+    language = "hy";
+    version = "0.10.0-0";
+    fullName = "Armenian";
+    filename = "aspell6";
+    sha256 = "1w5wq8lfl2xp1nid30b1j5qmya4vjyidq0vpr4y3gf53jc08vsid";
+  };
+
+  ia = buildOfficialDict rec {
+    language = "ia";
+    version = "0.50-1";
+    fullName = "Interlingua";
+    filename = "aspell";
+    sha256 = "0bqcpgsa72pga24fv4fkw38b4qqdvqsw97jvzvw7q03dc1cwp5sp";
+  };
+
+  id = buildOfficialDict rec {
+    language = "id";
+    version = "1.2-0";
+    fullName = "Indonesian";
+    filename = "aspell5";
+    sha256 = "023knfg0q03f7y5w6xnwa1kspnrcvcnky8xvdms93n2850414faj";
+  };
+
+  is = buildOfficialDict rec {
+    language = "is";
+    version = "0.51.1-0";
+    fullName = "Icelandic";
+    filename = "aspell";
+    sha256 = "1mp3248lhbr13cj7iq9zs7h5ix0dcwlprp5cwrkcwafrv8lvsd9h";
+  };
+
+  it = buildOfficialDict rec {
+    language = "it";
+    version = "2.2_20050523-0";
+    fullName = "Italian";
+    filename = "aspell6";
+    sha256 = "1gdf7bc1a0kmxsmphdqq8pl01h667mjsj6hihy6kqy14k5qdq69v";
+  };
+
+  kn = buildOfficialDict rec {
+    language = "kn";
+    version = "0.01-1";
+    fullName = "Kannada";
+    filename = "aspell6";
+    sha256 = "10sk0wx4x4ds1403kf9dqxv9yjvh06w8qqf4agx57y0jlws0n0fb";
+  };
+
+  ku = buildOfficialDict rec {
+    language = "ku";
+    version = "0.20-1";
+    fullName = "Kurdi";
+    filename = "aspell5";
+    sha256 = "09va98krfbgdaxl101nmd85j3ysqgg88qgfcl42c07crii0pd3wn";
+  };
+
+  ky = buildOfficialDict rec {
+    language = "ky";
+    version = "0.01-0";
+    fullName = "Kirghiz";
+    filename = "aspell6";
+    sha256 = "0kzv2syjnnn6pnwx0d578n46hg2l0j62977al47y6wabnhjjy3z1";
+  };
+
+  la = buildOfficialDict rec {
+    language = "la";
+    version = "20020503-0";
+    fullName = "Latin";
+    filename = "aspell6";
+    sha256 = "1199inwi16dznzl087v4skn66fl7h555hi2palx6s1f3s54b11nl";
+  };
+
+  lt = buildOfficialDict rec {
+    language = "lt";
+    version = "1.2.1-0";
+    fullName = "Lithuanian";
+    filename = "aspell6";
+    sha256 = "1asjck911l96q26zj36lmz0jp4b6pivvrf3h38zgc8lc85p3pxgn";
+  };
+
+  lv = buildOfficialDict rec {
+    language = "lv";
+    version = "0.5.5-1";
+    fullName = "Latvian";
+    filename = "aspell6";
+    sha256 = "12pvs584a6437ijndggdqpp5s7d0w607cimpkxsjwasnx83f4c1w";
+  };
+
+  mg = buildOfficialDict rec {
+    language = "mg";
+    version = "0.03-0";
+    fullName = "Malagasy";
+    filename = "aspell5";
+    sha256 = "0hdhbk9b5immjp8l5h4cy82gwgsqzcqbb0qsf7syw333w4rgi0ji";
+  };
+
+  mi = buildOfficialDict rec {
+    language = "mi";
+    version = "0.50-0";
+    fullName = "Maori";
+    filename = "aspell";
+    sha256 = "12bxplpd348yx8d2q8qvahi9dlp7qf28qmanzhziwc7np8rixvmy";
+  };
+
+  mk = buildOfficialDict rec {
+    language = "mk";
+    version = "0.50-0";
+    fullName = "Macedonian";
+    filename = "aspell";
+    sha256 = "0wcr9n882xi5b7a7ln1hnhq4vfqd5gpqqp87v01j0gb7zf027z0m";
+  };
+
+  ml = buildOfficialDict rec {
+    language = "ml";
+    version = "0.03-1";
+    fullName = "Malayalam";
+    filename = "aspell6";
+    sha256 = "1zcn4114gwia085fkz77qk13z29xrbp53q2qvgj2cvcbalg5bkg4";
+  };
+
+  mn = buildOfficialDict rec {
+    language = "mn";
+    version = "0.06-2";
+    fullName = "Mongolian";
+    filename = "aspell6";
+    sha256 = "150j9y5c9pw80fwp5rzl5q31q9vjbxixaqljkfwxjb5q93fnw6rg";
+  };
+
+  mr = buildOfficialDict rec {
+    language = "mr";
+    version = "0.10-0";
+    fullName = "Marathi";
+    filename = "aspell6";
+    sha256 = "0cvgb2l40sppqbi842ivpznsh2xzp1d4hxc371dll8z0pr05m8yk";
+  };
+
+  ms = buildOfficialDict rec {
+    language = "ms";
+    version = "0.50-0";
+    fullName = "Malay";
+    filename = "aspell";
+    sha256 = "0vr4vhipcfhsxqfs8dim2ph7iiixn22gmlmlb375bx5hgd9y7i1w";
+  };
+
+  mt = buildOfficialDict rec {
+    language = "mt";
+    version = "0.50-0";
+    fullName = "Maltese";
+    filename = "aspell";
+    sha256 = "1d2rl1nlfjq6rfywblvx8m88cyy2x0mzc0mshzbgw359c2nwl3z0";
+  };
+
+  nb = buildOfficialDict rec {
+    language = "nb";
+    version = "0.50.1-0";
+    fullName = "Norwegian Bokmal";
+    filename = "aspell";
+    sha256 = "12i2bmgdnlkzfinb20j2a0j4a20q91a9j8qpq5vgabbvc65nwx77";
+  };
+
+  nds = buildOfficialDict rec {
+    language = "nds";
+    version = "0.01-0";
+    fullName = "Low Saxon";
+    filename = "aspell6";
+    sha256 = "1nkjhwzn45dizi89d19q4bqyd87cim8xyrgr655fampgkn31wf6f";
+  };
+
+  nl = buildOfficialDict rec {
+    language = "nl";
+    version = "0.50-2";
+    fullName = "Dutch";
+    filename = "aspell";
+    sha256 = "0ffb87yjsh211hllpc4b9khqqrblial4pzi1h9r3v465z1yhn3j4";
+    # Emacs expects a language called "nederlands".
+    postInstall = ''
+      echo "add nl.rws" > $out/lib/aspell/nederlands.multi
+    '';
+  };
+
+  nn = buildOfficialDict rec {
+    language = "nn";
+    version = "0.50.1-1";
+    fullName = "Norwegian Nynorsk";
+    filename = "aspell";
+    sha256 = "0w2k5l5rbqpliripgqwiqixz5ghnjf7i9ggbrc4ly4vy1ia10rmc";
+  };
+
+  ny = buildOfficialDict rec {
+    language = "ny";
+    version = "0.01-0";
+    fullName = "Chichewa";
+    filename = "aspell5";
+    sha256 = "0gjb92vcg60sfgvrm2f6i89sfkgb179ahvwlgs649fx3dc7rfvqp";
+  };
+
+  or = buildOfficialDict rec {
+    language = "or";
+    version = "0.03-1";
+    fullName = "Oriya";
+    filename = "aspell6";
+    sha256 = "0kzj9q225z0ccrlbkijsrafy005pbjy14qcnxb6p93ciz1ls7zyn";
+  };
+
+  pa = buildOfficialDict rec {
+    language = "pa";
+    version = "0.01-1";
+    fullName = "Punjabi";
+    filename = "aspell6";
+    sha256 = "0if93zk10pyrs38wwj3vpcdm01h51m5z9gm85h3jxrpgqnqspwy7";
+  };
+
+  pl = buildOfficialDict rec {
+    language = "pl";
+    version = "6.0_20061121-0";
+    fullName = "Polish";
+    filename = "aspell6";
+    sha256 = "0kap4kh6bqbb22ypja1m5z3krc06vv4n0hakiiqmv20anzy42xq1";
+  };
+
+  pt_BR = buildOfficialDict rec {
+    language = "pt_BR";
+    version = "20090702-0";
+    fullName = "Brazilian Portuguese";
+    filename = "aspell6";
+    sha256 = "1y09lx9zf2rnp55r16b2vgj953l3538z1vaqgflg9mdvm555bz3p";
+  };
+
+  pt_PT = buildOfficialDict rec {
+    language = "pt_PT";
+    version = "20070510-0";
+    fullName = "Portuguese";
+    filename = "aspell6";
+    sha256 = "1mnr994cwlag6shy8865ky99lymysiln07mbldcncahg90dagdxq";
+  };
+
+  qu = buildOfficialDict rec {
+    language = "qu";
+    version = "0.02-0";
+    fullName = "Quechua";
+    filename = "aspell6";
+    sha256 = "009z0zsvzq7r3z3m30clyibs94v77b92h5lmzmzxlns2p0lpd5w0";
+  };
+
+  ro = buildOfficialDict rec {
+    language = "ro";
+    version = "3.3-2";
+    fullName = "Romanian";
+    filename = "aspell5";
+    sha256 = "0gb8j9iy1acdl11jq76idgc2lbc1rq3w04favn8cyh55d1v8phsk";
+  };
+
+  ru = buildOfficialDict rec {
+    language = "ru";
+    version = "0.99f7-1";
+    fullName = "Russian";
+    filename = "aspell6";
+    sha256 = "0ip6nq43hcr7vvzbv4lwwmlwgfa60hrhsldh9xy3zg2prv6bcaaw";
+  };
+
+  rw = buildOfficialDict rec {
+    language = "rw";
+    version = "0.50-0";
+    fullName = "Kinyarwanda";
+    filename = "aspell";
+    sha256 = "10gh8g747jbrvfk2fn3pjxy1nhcfdpwgmnvkmrp4nd1k1qp101il";
+  };
+
+  sc = buildOfficialDict rec {
+    language = "sc";
+    version = "1.0";
+    fullName = "Sardinian";
+    filename = "aspell5";
+    sha256 = "0hl7prh5rccsyljwrv3m1hjcsphyrrywk2qvnj122irbf4py46jr";
+  };
+
+  sk = buildOfficialDict rec {
+    language = "sk";
+    version = "2.01-2";
+    fullName = "Slovak";
+    filename = "aspell6";
+    sha256 = "19k0m1v5pcf7xr4lxgjkzqkdlks8nyb13bvi1n7521f3i4lhma66";
+  };
+
+  sl = buildOfficialDict rec {
+    language = "sl";
+    version = "0.50-0";
+    fullName = "Slovenian";
+    filename = "aspell";
+    sha256 = "1l9kc5g35flq8kw9jhn2n0bjb4sipjs4qkqzgggs438kywkx2rp5";
+  };
+
+  sr = buildOfficialDict rec {
+    language = "sr";
+    version = "0.02";
+    fullName = "Serbian";
+    filename = "aspell6";
+    sha256 = "12cj01p4nj80cpf7m3s4jsaf0rsfng7s295j9jfchcq677xmhpkh";
+  };
+
+  sv = buildOfficialDict rec {
+    language = "sv";
+    version = "0.51-0";
+    fullName = "Swedish";
+    filename = "aspell";
+    sha256 = "02jwkjhr32kvyibnyzgx3smbnm576jwdzg3avdf6zxwckhy5fw4v";
+  };
+
+  sw = buildOfficialDict rec {
+    language = "sw";
+    version = "0.50-0";
+    fullName = "Swahili";
+    filename = "aspell";
+    sha256 = "15zjh7hdj2b4dgm5bc12w1ims9q357p1q3gjalspnyn5gl81zmby";
+  };
+
+  ta = buildOfficialDict rec {
+    language = "ta";
+    version = "20040424-1";
+    fullName = "Tamil";
+    filename = "aspell6";
+    sha256 = "0sj8ygjsyvnr93cs6324y7az7k2vyw7rjxdc9vnm7z60lbqm5xaj";
+  };
+
+  te = buildOfficialDict rec {
+    language = "te";
+    version = "0.01-2";
+    fullName = "Telugu";
+    filename = "aspell6";
+    sha256 = "0pgcgxz7dz34zxp9sb85jjzbg3ky6il5wmhffz6ayrbsfn5670in";
+  };
+
+  tet = buildOfficialDict rec {
+    language = "tet";
+    version = "0.1.1";
+    fullName = "Tetum";
+    filename = "aspell5";
+    sha256 = "17n0y4fhjak47j9qnqf4m4z6zra6dn72rwhp7ig0hhlgqk4ldmcx";
+  };
+
+  tk = buildOfficialDict rec {
+    language = "tk";
+    version = "0.01-0";
+    fullName = "Turkmen";
+    filename = "aspell5";
+    sha256 = "02vad4jqhr0xpzqi5q5z7z0xxqccbn8j0c5dhpnm86mnr84l5wl6";
+  };
+
+  tl = buildOfficialDict rec {
+    language = "tl";
+    version = "0.02-1";
+    fullName = "Tagalog";
+    filename = "aspell5";
+    sha256 = "1kca6k7qnpfvvwjnq5r1n242payqsjy96skmw78m7ww6d0n5vdj8";
+  };
+
+  tn = buildOfficialDict rec {
+    language = "tn";
+    version = "1.0.1-0";
+    fullName = "Setswana";
+    filename = "aspell5";
+    sha256 = "0q5x7c6z88cn0kkpk7q1craq34g4g03v8x3xcj5a5jia3l7c5821";
+  };
+
+  tr = buildOfficialDict rec {
+    language = "tr";
+    version = "0.50-0";
+    fullName = "Turkish";
+    filename = "aspell";
+    sha256 = "0jpvpm96ga7s7rmsm6rbyrrr22b2dicxv2hy7ysv5y7bbq757ihb";
+  };
+
+  uk = buildOfficialDict rec {
+    language = "uk";
+    version = "1.4.0-0";
+    fullName = "Ukrainian";
+    filename = "aspell6";
+    sha256 = "137i4njvnslab6l4s291s11xijr5jsy75lbdph32f9y183lagy9m";
+  };
+
+  uz = buildOfficialDict rec {
+    language = "uz";
+    version = "0.6-0";
+    fullName = "Uzbek";
+    filename = "aspell6";
+    sha256 = "0sg3wlyply1idpq5ypyj7kgnaadaiskci1sqs811yhg2gzyc3092";
+  };
+
+  vi = buildOfficialDict rec {
+    language = "vi";
+    version = "0.01.1-1";
+    fullName = "Vietnamese";
+    filename = "aspell6";
+    sha256 = "05vwgvf1cj45azhflywx69javqdvqd1f20swrc2d3c32pd9mvn1w";
+  };
+
+  wa = buildOfficialDict rec {
+    language = "wa";
+    version = "0.50-0";
+    fullName = "Walloon";
+    filename = "aspell";
+    sha256 = "1r1zwz7xkx40dga9vf5wc9ja3jwk1dkpcr1kaa7wryvslf5al5ss";
+  };
+
+  yi = buildOfficialDict rec {
+    language = "yi";
+    version = "0.01.1-1";
+    fullName = "Yiddish";
+    filename = "aspell6";
+    sha256 = "0mi842l4038bx3ll2wx9nz44nqrg1x46h5b02zigi1hbbddd6ycq";
+  };
+
+  zu = buildOfficialDict rec {
+    language = "zu";
+    version = "0.50-0";
+    fullName = "Zulu";
+    filename = "aspell";
+    sha256 = "15k7gaxrnqnssdyk9l6g27dq317dqp9jz5yzafd25ri01g6mb8iz";
+  };
+
+  ### Jargons
+
+  en-computers = buildTxtDict rec {
+    shortName = "en-computers";
+    fullName = "English Computer Jargon";
+
+    src = fetchurl {
+      url = https://mrsatterly.com/computer.dic;
+      sha256 = "1vzk7cdvcm9r1c6mgxpabrdcpvghdv9mjmnf6iq5wllcif5nsw2b";
+    };
+
+    langInputs = [ en ];
+
+    buildPhase = "cat $src | aspell-affix en-computers --dont-validate-words --lang=en";
+    installPhase = "aspell-install en-computers";
+
+    meta = {
+      homepage = https://mrsatterly.com/spelling.html;
+    };
+  };
+
+  en-science = buildTxtDict rec {
+    shortName = "en-science";
+    fullName = "English Scientific Jargon";
+
+    src1 = fetchurl {
+      url = http://jpetrie.net/wp-content/uploads/custom_scientific_US.txt;
+      sha256 = "1psqm094zl4prk2f8h18jv0d471hxykzd1zdnrlx7gzrzy6pz5r3";
+    };
+
+    src2 = fetchurl {
+      url = http://jpetrie.net/wp-content/uploads/custom_scientific_UK.txt;
+      sha256 = "17ss1sdr3k70zbyx2z9xf74345slrp41gbkpih8axrmg4x92fgm1";
+    };
+
+    langInputs = [ en ];
+
+    buildPhase = ''
+      cat $src1 | aspell-plain en_US-science --dont-validate-words --lang=en
+      cat $src2 | aspell-plain en_GB-science --dont-validate-words --lang=en
+    '';
+    installPhase = "aspell-install en_US-science en_GB-science";
+
+    meta = {
+      homepage = http://www.jpetrie.net/scientific-word-list-for-spell-checkersspelling-dictionaries/;
+    };
+
+  };
+
+}
diff --git a/nixpkgs/pkgs/development/libraries/assimp/default.nix b/nixpkgs/pkgs/development/libraries/assimp/default.nix
new file mode 100644
index 000000000000..24e06b0d65a9
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/assimp/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchFromGitHub, cmake, boost, zlib }:
+
+stdenv.mkDerivation rec {
+  name = "assimp-${version}";
+  version = "4.1.0";
+
+  src = fetchFromGitHub{
+    owner = "assimp";
+    repo = "assimp";
+    rev = "v${version}";
+    sha256 = "00g61g3ixmfszzjncpvm8x7gp2livaj4lmhbycjmrw4x3gfqlc4r";
+  };
+
+  buildInputs = [ cmake boost zlib ];
+
+  meta = with stdenv.lib; {
+    description = "A library to import various 3D model formats";
+    homepage = http://assimp.sourceforge.net/;
+    license = licenses.bsd3;
+    maintainers = with maintainers; [ ehmry ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/at-spi2-atk/default.nix b/nixpkgs/pkgs/development/libraries/at-spi2-atk/default.nix
new file mode 100644
index 000000000000..6c3f3aa9fa29
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/at-spi2-atk/default.nix
@@ -0,0 +1,48 @@
+{ stdenv
+, fetchurl
+
+, meson
+, ninja
+, pkgconfig
+
+, at-spi2-core
+, atk
+, dbus
+, glib
+, libxml2
+, fixDarwinDylibNames
+
+, gnome3 # To pass updateScript
+}:
+
+stdenv.mkDerivation rec {
+  name = "${pname}-${version}";
+  pname = "at-spi2-atk";
+  version = "2.32.0";
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${name}.tar.xz";
+    sha256 = "0p54wx6f6q7s8w0b1j0sgw87pikllp79q5g3lfiwqazs779ycl8b";
+  };
+
+  nativeBuildInputs = [ meson ninja pkgconfig ]
+    # Fixup rpaths because of meson, remove with meson-0.47
+    ++ stdenv.lib.optional stdenv.isDarwin fixDarwinDylibNames;
+  buildInputs = [ at-spi2-core atk dbus glib libxml2 ];
+
+  doCheck = false; # fails with "No test data file provided"
+
+  passthru = {
+    updateScript = gnome3.updateScript {
+      packageName = pname;
+    };
+  };
+
+  meta = with stdenv.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.lgpl2Plus; # NOTE: 2018-06-06: Please check the license when upstream sorts-out licensing: https://gitlab.gnome.org/GNOME/at-spi2-atk/issues/2
+    maintainers = with maintainers; [ jtojnar gnome3.maintainers ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/at-spi2-core/default.nix b/nixpkgs/pkgs/development/libraries/at-spi2-core/default.nix
new file mode 100644
index 000000000000..e5d5313eeb10
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/at-spi2-core/default.nix
@@ -0,0 +1,51 @@
+{ stdenv
+, fetchurl
+
+, meson
+, ninja
+, pkgconfig
+, gobject-introspection
+
+, dbus
+, glib
+, libX11
+, libXtst # at-spi2-core can be build without X support, but due it is a client-side library, GUI-less usage is a very rare case
+, libXi
+, fixDarwinDylibNames
+
+, gnome3 # To pass updateScript
+}:
+
+stdenv.mkDerivation rec {
+  name = "${pname}-${version}";
+  pname = "at-spi2-core";
+  version = "2.32.1";
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${name}.tar.xz";
+    sha256 = "0lqd7gsl471v6538iighkvb21gjglcb9pklvas32rjpsxcvsjaiw";
+  };
+
+  outputs = [ "out" "dev" ];
+
+  nativeBuildInputs = [ meson ninja pkgconfig gobject-introspection ]
+    # Fixup rpaths because of meson, remove with meson-0.47
+    ++ stdenv.lib.optional stdenv.isDarwin fixDarwinDylibNames;
+  buildInputs = [ dbus glib libX11 libXtst libXi ];
+
+  doCheck = false; # fails with "AT-SPI: Couldn't connect to accessibility bus. Is at-spi-bus-launcher running?"
+
+  passthru = {
+    updateScript = gnome3.updateScript {
+      packageName = pname;
+    };
+  };
+
+  meta = with stdenv.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.lgpl2Plus; # NOTE: 2018-06-06: Please check the license when upstream sorts-out licensing: https://gitlab.gnome.org/GNOME/at-spi2-core/issues/2
+    maintainers = with maintainers; [ jtojnar gnome3.maintainers ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/atk/default.nix b/nixpkgs/pkgs/development/libraries/atk/default.nix
new file mode 100644
index 000000000000..0a076442b42c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/atk/default.nix
@@ -0,0 +1,56 @@
+{ stdenv, fetchurl, meson, ninja, gettext, pkgconfig, glib
+, fixDarwinDylibNames, gobject-introspection, gnome3
+}:
+
+let
+  pname = "atk";
+  version = "2.32.0";
+in
+
+stdenv.mkDerivation rec {
+  name = "${pname}-${version}";
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${name}.tar.xz";
+    sha256 = "1k4i817bd2w5b9z394f2yyx95591l2746wa40am0vvz4gzdgwhfb";
+  };
+
+  outputs = [ "out" "dev" ];
+
+  buildInputs = stdenv.lib.optional stdenv.isDarwin fixDarwinDylibNames;
+
+  nativeBuildInputs = [ meson ninja pkgconfig gettext gobject-introspection ];
+
+  propagatedBuildInputs = [
+    # Required by atk.pc
+    glib
+  ];
+
+  doCheck = true;
+
+  passthru = {
+    updateScript = gnome3.updateScript {
+      packageName = pname;
+    };
+  };
+
+  meta = {
+    description = "Accessibility toolkit";
+
+    longDescription = ''
+      ATK is the Accessibility Toolkit.  It provides a set of generic
+      interfaces allowing accessibility technologies such as screen
+      readers to interact with a graphical user interface.  Using the
+      ATK interfaces, accessibility tools have full access to view and
+      control running applications.
+    '';
+
+    homepage = http://library.gnome.org/devel/atk/;
+
+    license = stdenv.lib.licenses.lgpl2Plus;
+
+    maintainers = with stdenv.lib.maintainers; [ raskin ];
+    platforms = stdenv.lib.platforms.linux ++ stdenv.lib.platforms.darwin;
+  };
+
+}
diff --git a/nixpkgs/pkgs/development/libraries/atkmm/default.nix b/nixpkgs/pkgs/development/libraries/atkmm/default.nix
new file mode 100644
index 000000000000..5338aa683a7c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/atkmm/default.nix
@@ -0,0 +1,32 @@
+{ stdenv, fetchurl, atk, glibmm, pkgconfig, 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";
+    sha256 = "0fnxrspxkhhbrjphqrpvl3zjm66n50s4cywrrrwkhbflgy8zqk2c";
+  };
+
+  outputs = [ "out" "dev" ];
+
+  propagatedBuildInputs = [ atk glibmm ];
+
+  nativeBuildInputs = [ pkgconfig ];
+
+  doCheck = true;
+
+  passthru = {
+    updateScript = gnome3.updateScript {
+      packageName = pname;
+    };
+  };
+
+  meta = {
+    description = "C++ wrappers for ATK accessibility toolkit";
+    license = stdenv.lib.licenses.lgpl21Plus;
+    homepage = https://gtkmm.org;
+    platforms = stdenv.lib.platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/attica/default.nix b/nixpkgs/pkgs/development/libraries/attica/default.nix
new file mode 100644
index 000000000000..d883100fd3ce
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/attica/default.nix
@@ -0,0 +1,20 @@
+{ stdenv, fetchurl, cmake, qt4 }:
+
+stdenv.mkDerivation rec {
+  name = "attica-0.4.2";
+  
+  src = fetchurl {
+    url = "mirror://kde/stable/attica/${name}.tar.bz2";
+    sha256 = "1y74gsyzi70dfr9d1f1b08k130rm3jaibsppg8dv5h3211vm771v";
+  };
+  
+  buildInputs = [ qt4 ];
+  nativeBuildInputs = [ cmake ];
+  
+  meta = with stdenv.lib; {
+    description = "Library to access Open Collaboration Service providers";
+    license = "LGPL";
+    maintainers = [ maintainers.sander maintainers.phreedom ];
+    inherit (qt4.meta) platforms;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/attr/default.nix b/nixpkgs/pkgs/development/libraries/attr/default.nix
new file mode 100644
index 000000000000..497262c04d71
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/attr/default.nix
@@ -0,0 +1,35 @@
+{ stdenv, fetchurl, gettext }:
+
+stdenv.mkDerivation rec {
+  name = "attr-2.4.48";
+
+  src = fetchurl {
+    url = "mirror://savannah/attr/${name}.tar.gz";
+    sha256 = "1rr4adzwax4bzr2c00f06zcsljv5y6p9wymz1g89ww7cb2rp5bay";
+  };
+
+  outputs = [ "bin" "dev" "out" "man" "doc" ];
+
+  nativeBuildInputs = [ gettext ];
+
+  patches = [
+    # fix fakechroot: https://github.com/dex4er/fakechroot/issues/57
+    (fetchurl {
+      url = "https://git.savannah.nongnu.org/cgit/attr.git/patch/?id=14adc898a36948267bfe5c63b399996879e94c98";
+      sha256 = "0gja54fz79a9ma6b4mprnjxq77l5yg2z9xknlwhmkcrfnam02qxp";
+    })
+  ];
+
+  postPatch = ''
+    for script in install-sh include/install-sh; do
+      patchShebangs $script
+    done
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = "https://savannah.nongnu.org/projects/attr/";
+    description = "Library and tools for manipulating extended attributes";
+    platforms = platforms.linux;
+    license = licenses.gpl2Plus;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/aubio/default.nix b/nixpkgs/pkgs/development/libraries/aubio/default.nix
new file mode 100644
index 000000000000..db5ecf3b0169
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/aubio/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchurl, alsaLib, fftw, libjack2, libsamplerate
+, libsndfile, pkgconfig, python, wafHook
+}:
+
+stdenv.mkDerivation rec {
+  name = "aubio-0.4.9";
+
+  src = fetchurl {
+    url = "https://aubio.org/pub/${name}.tar.bz2";
+    sha256 = "1npks71ljc48w6858l9bq30kaf5nph8z0v61jkfb70xb9np850nl";
+  };
+
+  nativeBuildInputs = [ pkgconfig python wafHook ];
+  buildInputs = [ alsaLib fftw libjack2 libsamplerate libsndfile ];
+
+  meta = with stdenv.lib; {
+    description = "Library for audio labelling";
+    homepage = https://aubio.org/;
+    license = licenses.gpl2;
+    maintainers = with maintainers; [ goibhniu marcweber fpletz ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/audio/jamomacore/default.nix b/nixpkgs/pkgs/development/libraries/audio/jamomacore/default.nix
new file mode 100644
index 000000000000..b79d85bcd7c9
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/audio/jamomacore/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchFromGitHub, pkgconfig, alsaLib, portaudio, portmidi, libsndfile, cmake, libxml2 }:
+
+stdenv.mkDerivation rec {
+  version = "1.0-beta.1";
+  name = "JamomaCore-${version}";
+
+  src = fetchFromGitHub {
+    owner = "jamoma";
+    repo = "JamomaCore";
+    rev = "v${version}";
+    sha256 = "1hb9b6qc18rsvzvixgllknn756m6zwcn22c79rdibbyz1bhrcnln";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ alsaLib portaudio portmidi libsndfile cmake libxml2 ];
+
+  meta = {
+    description = "A C++ platform for building dynamic and reflexive systems with an emphasis on audio and media";
+    homepage = http://www.jamoma.org;
+    license = stdenv.lib.licenses.bsd3;
+    maintainers = [ stdenv.lib.maintainers.magnetophon ];
+    platforms = stdenv.lib.platforms.linux;
+    broken = true; # 2018-04-10
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/audio/libbass/default.nix b/nixpkgs/pkgs/development/libraries/audio/libbass/default.nix
new file mode 100644
index 000000000000..0e1445ca9ee1
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/audio/libbass/default.nix
@@ -0,0 +1,60 @@
+{ stdenv, unzip, fetchurl }:
+
+let
+  version = "24";
+
+  allBass = {
+    bass = {
+      h = "bass.h";
+      so = {
+        i686_linux = "libbass.so";
+        x86_64-linux = "x64/libbass.so";
+      };
+      urlpath = "bass${version}-linux.zip";
+      sha256 = "1hjxp1akj8367qlglv5rqpwq2dimfz3bkllwq39abavz4sp8smjz";
+    };
+
+    bass_fx = {
+      h = "C/bass_fx.h";
+      so = {
+        i686_linux = "libbass_fx.so";
+        x86_64-linux = "x64/libbass_fx.so";
+      };
+      urlpath = "z/0/bass_fx${version}-linux.zip";
+      sha256 = "1q0g74z7iyhxqps5b3gnnbic8v2jji1r0mkvais57lsx8y21sbin";
+    };
+  };
+
+  dropBass = name: bass: stdenv.mkDerivation {
+    name = "lib${name}-${version}";
+
+    src = fetchurl {
+      url = "https://www.un4seen.com/files/${bass.urlpath}";
+      inherit (bass) sha256;
+    };
+    unpackCmd = ''
+      mkdir out
+      ${unzip}/bin/unzip $curSrc -d out
+    '';
+
+    lpropagatedBuildInputs = [ unzip ];
+    dontBuild = true;
+    installPhase =
+      let so =
+            if bass.so ? ${stdenv.hostPlatform.system} then bass.so.${stdenv.hostPlatform.system}
+            else throw "${name} not packaged for ${stdenv.hostPlatform.system} (yet).";
+      in ''
+        mkdir -p $out/{lib,include}
+        install -m644 -t $out/lib/ ${so}
+        install -m644 -t $out/include/ ${bass.h}
+      '';
+
+    meta = with stdenv.lib; {
+      description = "Shareware audio library";
+      homepage = https://www.un4seen.com/;
+      license = licenses.unfreeRedistributable;
+      platforms = builtins.attrNames bass.so;
+    };
+  };
+
+in stdenv.lib.mapAttrs dropBass allBass
diff --git a/nixpkgs/pkgs/development/libraries/audio/libbs2b/default.nix b/nixpkgs/pkgs/development/libraries/audio/libbs2b/default.nix
new file mode 100644
index 000000000000..3a4c363e23c8
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/audio/libbs2b/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchurl, pkgconfig, libsndfile }:
+
+stdenv.mkDerivation rec {
+  name = "libbs2b-${version}";
+  version = "3.1.0";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/bs2b/${name}.tar.bz2";
+    sha256 = "0vz442kkjn2h0dlxppzi4m5zx8qfyrivq581n06xzvnyxi5rg6a7";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ libsndfile ];
+
+  hardeningDisable = [ "format" ];
+
+  meta = {
+    homepage = http://bs2b.sourceforge.net/;
+    description = "Bauer stereophonic-to-binaural DSP library";
+    license = stdenv.lib.licenses.mit;
+    platforms = stdenv.lib.platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/audio/libgme/default.nix b/nixpkgs/pkgs/development/libraries/audio/libgme/default.nix
new file mode 100644
index 000000000000..ac6f0470a0a8
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/audio/libgme/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchFromBitbucket, cmake }:
+let
+  version = "0.6.2";
+in stdenv.mkDerivation {
+  name = "libgme-${version}";
+
+  meta = with stdenv.lib; {
+    description = "A collection of video game music chip emulators";
+    homepage = https://bitbucket.org/mpyne/game-music-emu/overview;
+    license = licenses.lgpl21;
+    platforms = platforms.all;
+    maintainers = with maintainers; [ lheckemann ];
+  };
+
+  src = fetchFromBitbucket {
+    owner = "mpyne";
+    repo = "game-music-emu";
+    rev = version;
+    sha256 = "00vlbfk5h99dq5rbwxk20dv72dig6wdwpgf83q451avsscky0jvk";
+  };
+
+  buildInputs = [ cmake ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/audio/libmysofa/default.nix b/nixpkgs/pkgs/development/libraries/audio/libmysofa/default.nix
new file mode 100644
index 000000000000..0f9f5f5aac68
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/audio/libmysofa/default.nix
@@ -0,0 +1,26 @@
+{ stdenv, fetchFromGitHub, cmake, zlib }:
+
+stdenv.mkDerivation rec {
+  name = "libmysofa-${version}";
+  version = "0.7";
+
+  src = fetchFromGitHub {
+    owner = "hoene";
+    repo = "libmysofa";
+    rev = "v${version}";
+    sha256 = "0si0z7cfw6xcs3dkrb4zini55xpxwfp27yl8lbx39gx2pf8v2jls";
+  };
+
+  nativeBuildInputs = [ cmake ];
+  buildInputs = [ zlib ];
+
+  cmakeFlags = [ "-DBUILD_TESTS=OFF" ];
+
+  meta = with stdenv.lib; {
+    description = "Reader for AES SOFA files to get better HRTFs";
+    homepage = https://github.com/hoene/libmysofa;
+    license = licenses.bsd3;
+    platforms = platforms.all;
+    maintainers = with maintainers; [ jfrankenau ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/audio/libsmf/default.nix b/nixpkgs/pkgs/development/libraries/audio/libsmf/default.nix
new file mode 100644
index 000000000000..fe0e0854a327
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/audio/libsmf/default.nix
@@ -0,0 +1,21 @@
+{ stdenv, fetchurl, autoreconfHook, glib, pkgconfig }:
+
+stdenv.mkDerivation rec {
+  version = "1.3";
+  name = "libsmf-${version}";
+  src = fetchurl {
+    url = "https://github.com/stump/libsmf/archive/${name}.tar.gz";
+    sha256 = "1527pcc1vd0l5iks2yw8m0bymcrnih2md5465lwpzw0wgy4rky7n";
+  };
+
+  nativeBuildInputs = [ autoreconfHook pkgconfig ];
+  buildInputs = [ glib ];
+
+  meta = with stdenv.lib; {
+    description = "A C library for reading and writing Standard MIDI Files";
+    homepage = https://github.com/stump/libsmf;
+    license = licenses.bsd2;
+    maintainers = [ maintainers.goibhniu ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/audio/lilv/default.nix b/nixpkgs/pkgs/development/libraries/audio/lilv/default.nix
new file mode 100644
index 000000000000..373d50a0a434
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/audio/lilv/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, fetchurl, lv2, pkgconfig, python, serd, sord, sratom, wafHook }:
+
+stdenv.mkDerivation rec {
+  name = "lilv-${version}";
+  version = "0.24.4";
+
+  src = fetchurl {
+    url = "https://download.drobilla.net/${name}.tar.bz2";
+    sha256 = "0f24cd7wkk5l969857g2ydz2kjjrkvvddg1g87xzzs78lsvq8fy3";
+  };
+
+  nativeBuildInputs = [ pkgconfig wafHook ];
+  buildInputs = [ lv2 python serd sord sratom ];
+
+  meta = with stdenv.lib; {
+    homepage = http://drobilla.net/software/lilv;
+    description = "A C library to make the use of LV2 plugins";
+    license = licenses.mit;
+    maintainers = [ maintainers.goibhniu ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/audio/lv2/default.nix b/nixpkgs/pkgs/development/libraries/audio/lv2/default.nix
new file mode 100644
index 000000000000..d026dd258bc7
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/audio/lv2/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, fetchurl, gtk2, libsndfile, pkgconfig, python, wafHook }:
+
+stdenv.mkDerivation rec {
+  name = "lv2-${version}";
+  version = "1.16.0";
+
+  src = fetchurl {
+    url = "http://lv2plug.in/spec/${name}.tar.bz2";
+    sha256 = "1ppippbpdpv13ibs06b0bixnazwfhiw0d0ja6hx42jnkgdyp5hyy";
+  };
+
+  nativeBuildInputs = [ pkgconfig wafHook ];
+  buildInputs = [ gtk2 libsndfile python ];
+
+  meta = with stdenv.lib; {
+    homepage = http://lv2plug.in;
+    description = "A plugin standard for audio systems";
+    license = licenses.mit;
+    maintainers = [ maintainers.goibhniu ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/audio/lv2/unstable.nix b/nixpkgs/pkgs/development/libraries/audio/lv2/unstable.nix
new file mode 100644
index 000000000000..81cc868f52ca
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/audio/lv2/unstable.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchgit, gtk2, libsndfile, pkgconfig, python, wafHook }:
+
+stdenv.mkDerivation rec {
+  name = "lv2-unstable-${version}";
+  version = "2017-07-08";
+
+  src = fetchgit {
+    url = "http://lv2plug.in/git/cgit.cgi/lv2.git";
+    rev = "39c7c726cd52b2863fcea356cafe1bcab2ba7f37";
+    sha256 = "1gp2rd99dfmpibvpixrqn115mrhybzf3if3h8bssf6siyi13f29r";
+  };
+
+  nativeBuildInputs = [ pkgconfig wafHook ];
+  buildInputs = [ gtk2 libsndfile python ];
+
+  meta = with stdenv.lib; {
+    homepage = http://lv2plug.in;
+    description = "A plugin standard for audio systems";
+    license = licenses.mit;
+    maintainers = [ maintainers.goibhniu ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/audio/lvtk/default.nix b/nixpkgs/pkgs/development/libraries/audio/lvtk/default.nix
new file mode 100644
index 000000000000..78763ca29e2a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/audio/lvtk/default.nix
@@ -0,0 +1,34 @@
+{ stdenv, fetchurl, boost, gtkmm2, lv2, pkgconfig, python, wafHook }:
+
+stdenv.mkDerivation rec {
+  name = "lvtk-${version}";
+  version = "1.2.0";
+
+  src = fetchurl {
+    url = "https://github.com/lvtk/lvtk/archive/${version}.tar.gz";
+    sha256 = "03nbj2cqcklqwh50zj2gwm07crh5iwqbpxbpzwbg5hvgl4k4rnjd";
+  };
+
+  nativeBuildInputs = [ pkgconfig python wafHook ];
+  buildInputs = [ boost gtkmm2 lv2 ];
+
+  enableParallelBuilding = true;
+
+  # Fix including the boost libraries during linking
+  postPatch = ''
+    sed -i '/target[ ]*= "ttl2c"/ ilib=["boost_system"],' tools/wscript_build
+  '';
+
+  wafConfigureFlags = [
+    "--boost-includes=${boost.dev}/include"
+    "--boost-libs=${boost.out}/lib"
+  ];
+
+  meta = with stdenv.lib; {
+    description = "A set C++ wrappers around the LV2 C API";
+    homepage = http://lvtoolkit.org;
+    license = licenses.gpl3;
+    maintainers = [ maintainers.goibhniu ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/audio/ntk/default.nix b/nixpkgs/pkgs/development/libraries/audio/ntk/default.nix
new file mode 100644
index 000000000000..ddd3940098a4
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/audio/ntk/default.nix
@@ -0,0 +1,26 @@
+{ stdenv, fetchFromGitHub, cairo, libjpeg, libXft, pkgconfig, python2, wafHook }:
+
+stdenv.mkDerivation rec {
+  name = "ntk-${version}";
+  version = "1.3.1000";
+  src = fetchFromGitHub {
+    owner = "original-male";
+    repo = "ntk";
+    rev = "v${version}";
+    sha256 = "0j38mhnfqy6swcrnc5zxcwlqi8b1pgklyghxk6qs1lf4japv2zc0";
+  };
+
+  nativeBuildInputs = [ pkgconfig wafHook ];
+  buildInputs = [
+    cairo libjpeg libXft python2
+  ];
+
+  meta = {
+    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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/audio/raul/default.nix b/nixpkgs/pkgs/development/libraries/audio/raul/default.nix
new file mode 100644
index 000000000000..51234a415fd7
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/audio/raul/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchgit, boost, gtk2, pkgconfig, python, wafHook }:
+
+stdenv.mkDerivation rec {
+  name = "raul-unstable-${rev}";
+  rev = "2017-07-23";
+
+  src = fetchgit {
+    url = "http://git.drobilla.net/cgit.cgi/raul.git";
+    rev = "4db870b2b20b0a608ec0283139056b836c5b1624";
+    sha256 = "04fajrass3ymr72flx5js5vxc601ccrmx8ny8scp0rw7j0igyjdr";
+  };
+
+  nativeBuildInputs = [ pkgconfig wafHook ];
+  buildInputs = [ boost gtk2 python ];
+
+  meta = with stdenv.lib; {
+    description = "A C++ utility library primarily aimed at audio/musical applications";
+    homepage = http://drobilla.net/software/raul;
+    license = licenses.gpl3;
+    maintainers = [ maintainers.goibhniu ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/audio/rtaudio/default.nix b/nixpkgs/pkgs/development/libraries/audio/rtaudio/default.nix
new file mode 100644
index 000000000000..2adec665e1c0
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/audio/rtaudio/default.nix
@@ -0,0 +1,30 @@
+{ stdenv, fetchFromGitHub, autoconf, automake, libtool, libjack2,  alsaLib, rtmidi }:
+
+stdenv.mkDerivation rec {
+  version = "5.1.0";
+  name = "rtaudio-${version}";
+
+  src = fetchFromGitHub {
+    owner = "thestk";
+    repo = "rtaudio";
+    rev = "${version}";
+    sha256 = "1pglnjz907ajlhnlnig3p0sx7hdkpggr8ss7b3wzf1lykzgv9l52";
+  };
+
+  enableParallelBuilding = true;
+
+  buildInputs = [ autoconf automake libtool libjack2 alsaLib rtmidi ];
+
+  preConfigure = ''
+    ./autogen.sh --no-configure
+    ./configure
+  '';
+
+  meta = {
+    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 = stdenv.lib.licenses.mit;
+    maintainers = [ stdenv.lib.maintainers.magnetophon ];
+    platforms = with stdenv.lib.platforms; linux ++ darwin;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/audio/rtmidi/default.nix b/nixpkgs/pkgs/development/libraries/audio/rtmidi/default.nix
new file mode 100644
index 000000000000..41bb9ca9f11b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/audio/rtmidi/default.nix
@@ -0,0 +1,31 @@
+{ stdenv, fetchFromGitHub, autoconf, automake, libtool, libjack2, alsaLib, pkgconfig }:
+
+stdenv.mkDerivation rec {
+  version = "4.0.0";
+  name = "rtmidi-${version}";
+
+  src = fetchFromGitHub {
+    owner = "thestk";
+    repo = "rtmidi";
+    rev = "${version}";
+    sha256 = "1g31p6a96djlbk9jh5r4pjly3x76lhccva9hrw6xzdma8dsjzgyq";
+  };
+
+  enableParallelBuilding = true;
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ autoconf automake libtool libjack2 alsaLib ];
+
+  preConfigure = ''
+    ./autogen.sh --no-configure
+    ./configure
+  '';
+
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/audio/sratom/default.nix b/nixpkgs/pkgs/development/libraries/audio/sratom/default.nix
new file mode 100644
index 000000000000..09a6230184af
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/audio/sratom/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, fetchurl, lv2, pkgconfig, python, serd, sord, wafHook }:
+
+stdenv.mkDerivation rec {
+  name = "sratom-${version}";
+  version = "0.6.2";
+
+  src = fetchurl {
+    url = "https://download.drobilla.net/${name}.tar.bz2";
+    sha256 = "0lz883ravxjf7r9wwbx2gx9m8vhyiavxrl9jdxfppjxnsralll8a";
+  };
+
+  nativeBuildInputs = [ pkgconfig wafHook ];
+  buildInputs = [ lv2 python serd sord ];
+
+  meta = with stdenv.lib; {
+    homepage = http://drobilla.net/software/sratom;
+    description = "A library for serialising LV2 atoms to/from RDF";
+    license = licenses.mit;
+    maintainers = [ maintainers.goibhniu ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/audio/suil/default.nix b/nixpkgs/pkgs/development/libraries/audio/suil/default.nix
new file mode 100644
index 000000000000..10d650d66425
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/audio/suil/default.nix
@@ -0,0 +1,32 @@
+{ stdenv, lib, fetchurl, gtk2, lv2, pkgconfig, python, serd, sord, sratom
+, wafHook
+, withQt4 ? true, qt4 ? null
+, withQt5 ? false, qt5 ? null }:
+
+# I haven't found an XOR operator in nix...
+assert withQt4 || withQt5;
+assert !(withQt4 && withQt5);
+
+stdenv.mkDerivation rec {
+  pname = "suil";
+  version = "0.10.0";
+  name = "${pname}-qt${if withQt4 then "4" else "5"}-${version}";
+
+  src = fetchurl {
+    url = "https://download.drobilla.net/${pname}-${version}.tar.bz2";
+    sha256 = "0j489gm3fhnmwmbgw30bvd4byw1vsy4yazdlnji8jzhcz0qwb5cq";
+  };
+
+  nativeBuildInputs = [ pkgconfig wafHook ];
+  buildInputs = [ gtk2 lv2 python serd sord sratom ]
+    ++ (lib.optionals withQt4 [ qt4 ])
+    ++ (lib.optionals withQt5 (with qt5; [ qtbase qttools ]));
+
+  meta = with stdenv.lib; {
+    homepage = http://drobilla.net/software/suil;
+    description = "A lightweight C library for loading and wrapping LV2 plugin UIs";
+    license = licenses.mit;
+    maintainers = with maintainers; [ goibhniu ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/audio/vamp/default.nix b/nixpkgs/pkgs/development/libraries/audio/vamp/default.nix
new file mode 100644
index 000000000000..f8b1006d2eb7
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/audio/vamp/default.nix
@@ -0,0 +1,31 @@
+# set VAMP_PATH ?
+# plugins availible on sourceforge and http://www.vamp-plugins.org/download.html (various licenses)
+
+{ stdenv, fetchFromGitHub, pkgconfig, libsndfile }:
+
+rec {
+
+  vampSDK = stdenv.mkDerivation {
+    name = "vamp-sdk-2.7.1";
+    # version = "2.7.1";
+
+    src = fetchFromGitHub {
+      owner = "c4dm";
+      repo = "vamp-plugin-sdk";
+      rev = "vamp-plugin-sdk-v2.7.1";
+      sha256 = "1ifd6l6b89pg83ss4gld5i72fr0cczjnl2by44z5jnndsg3sklw4";
+    };
+
+  nativeBuildInputs = [ pkgconfig ];
+    buildInputs = [ libsndfile ];
+
+    meta = with stdenv.lib; {
+      description = "Audio processing plugin system for plugins that extract descriptive information from audio data";
+      homepage = https://sourceforge.net/projects/vamp;
+      license = licenses.bsd3;
+      maintainers = [ maintainers.goibhniu maintainers.marcweber ];
+      platforms = platforms.linux;
+    };
+  };
+
+}
diff --git a/nixpkgs/pkgs/development/libraries/audio/zita-alsa-pcmi/default.nix b/nixpkgs/pkgs/development/libraries/audio/zita-alsa-pcmi/default.nix
new file mode 100644
index 000000000000..320fc41f76c5
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/audio/zita-alsa-pcmi/default.nix
@@ -0,0 +1,64 @@
+{ stdenv, fetchurl , alsaLib, }:
+
+stdenv.mkDerivation rec {
+  name = "zita-alsa-pcmi-${version}";
+  version = "0.3.2";
+  src = fetchurl {
+    url = "http://kokkinizita.linuxaudio.org/linuxaudio/downloads/${name}.tar.bz2";
+    sha256 = "12d7vdg74yh21w69qi0wg57iz4876j94qbiq09bvscih6xz9y78s";
+  };
+
+  buildInputs = [ alsaLib ];
+
+  buildPhase = ''
+    cd source
+    make PREFIX="$out"
+
+    # create lib link for building apps
+    ln -s libzita-alsa-pcmi.so.$version libzita-alsa-pcmi.so
+
+    # apps
+    cd ../apps
+    CXXFLAGS+=" -I../source" \
+    LDFLAGS+=" -L../source" \
+    make PREFIX="$out"
+  '';
+
+  installPhase = ''
+    mkdir "$out"
+    mkdir "$out/lib"
+    mkdir "$out/include"
+    mkdir "$out/bin"
+
+    cd ../source
+
+    # source
+    install -Dm755 libzita-alsa-pcmi.so.$version \
+      "$out/lib/libzita-alsa-pcmi.so.$version"
+
+    # link
+    ln -s libzita-alsa-pcmi.so.$version \
+      "$out/lib/libzita-alsa-pcmi.so"
+    ln -s libzita-alsa-pcmi.so.$version \
+      "$out/lib/libzita-alsa-pcmi.so.0"
+
+    # header
+    install -Dm644 zita-alsa-pcmi.h \
+      "$out/include/zita-alsa-pcmi.h"
+
+    # apps
+    install -Dm755 ../apps/alsa_delay \
+      "$out/bin/alsa_delay"
+    install -Dm755 ../apps/alsa_loopback \
+      "$out/bin/alsa_loopback"
+  '';
+
+  meta = {
+    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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/audio/zita-convolver/default.nix b/nixpkgs/pkgs/development/libraries/audio/zita-convolver/default.nix
new file mode 100644
index 000000000000..4fc5c12ccc4c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/audio/zita-convolver/default.nix
@@ -0,0 +1,36 @@
+{ stdenv, fetchurl, fftwFloat }:
+
+stdenv.mkDerivation rec {
+  name = "zita-convolver-${version}";
+  version = "4.0.3";
+  src = fetchurl {
+    url = "http://kokkinizita.linuxaudio.org/linuxaudio/downloads/${name}.tar.bz2";
+    sha256 = "0prji66p86z2bzminywkwchr5bfgxcg2i8y803pydd1hzf2198cs";
+  };
+
+  buildInputs = [ fftwFloat ];
+
+  patchPhase = ''
+    cd source
+    sed -e "s@ldconfig@@" -i Makefile
+  '';
+
+  makeFlags = [
+    "PREFIX=$(out)"
+    "SUFFIX="
+  ];
+
+  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}
+  '';
+
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/audio/zita-resampler/default.nix b/nixpkgs/pkgs/development/libraries/audio/zita-resampler/default.nix
new file mode 100644
index 000000000000..e9cccab39f02
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/audio/zita-resampler/default.nix
@@ -0,0 +1,33 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "zita-resampler-${version}";
+  version = "1.6.2";
+  src = fetchurl {
+    url = "http://kokkinizita.linuxaudio.org/linuxaudio/downloads/${name}.tar.bz2";
+    sha256 = "1my5k2dh2dkvjp6xjnf9qy6i7s28z13kw1n9pwa4a2cpwbzawfr3";
+  };
+
+  makeFlags = [
+    "PREFIX=$(out)"
+    "SUFFIX="
+  ];
+
+  patchPhase = ''
+    cd source
+    sed -e "s@ldconfig@@" -i Makefile
+  '';
+
+  fixupPhase = ''
+    ln -s $out/lib/libzita-resampler.so.$version $out/lib/libzita-resampler.so.1
+  '';
+
+  meta = {
+    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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/audiofile/CVE-2015-7747.patch b/nixpkgs/pkgs/development/libraries/audiofile/CVE-2015-7747.patch
new file mode 100644
index 000000000000..a01aaa14dcee
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/audiofile/CVE-2015-7747.patch
@@ -0,0 +1,161 @@
+Description: fix buffer overflow when changing both sample format and
+ number of channels
+Origin: backport, https://github.com/mpruett/audiofile/pull/25
+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/audiofile/+bug/1502721
+Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=801102
+
+Index: audiofile-0.3.6/libaudiofile/modules/ModuleState.cpp
+===================================================================
+--- audiofile-0.3.6.orig/libaudiofile/modules/ModuleState.cpp	2015-10-20 08:00:58.036128202 -0400
++++ audiofile-0.3.6/libaudiofile/modules/ModuleState.cpp	2015-10-20 08:00:58.036128202 -0400
+@@ -402,7 +402,7 @@
+		addModule(new Transform(outfc, in.pcm, out.pcm));
+
+	if (in.channelCount != out.channelCount)
+-		addModule(new ApplyChannelMatrix(infc, isReading,
++		addModule(new ApplyChannelMatrix(outfc, isReading,
+			in.channelCount, out.channelCount,
+			in.pcm.minClip, in.pcm.maxClip,
+			track->channelMatrix));
+Index: audiofile-0.3.6/test/Makefile.am
+===================================================================
+--- audiofile-0.3.6.orig/test/Makefile.am	2015-10-20 08:00:58.036128202 -0400
++++ audiofile-0.3.6/test/Makefile.am	2015-10-20 08:00:58.036128202 -0400
+@@ -26,6 +26,7 @@
+	VirtualFile \
+	floatto24 \
+	query2 \
++	sixteen-stereo-to-eight-mono \
+	sixteen-to-eight \
+	testchannelmatrix \
+	testdouble \
+@@ -139,6 +140,7 @@
+ printmarkers_LDADD = $(LIBAUDIOFILE) -lm
+
+ sixteen_to_eight_SOURCES = sixteen-to-eight.c TestUtilities.cpp TestUtilities.h
++sixteen_stereo_to_eight_mono_SOURCES = sixteen-stereo-to-eight-mono.c TestUtilities.cpp TestUtilities.h
+
+ testchannelmatrix_SOURCES = testchannelmatrix.c TestUtilities.cpp TestUtilities.h
+
+Index: audiofile-0.3.6/test/sixteen-stereo-to-eight-mono.c
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ audiofile-0.3.6/test/sixteen-stereo-to-eight-mono.c	2015-10-20 08:33:57.512286416 -0400
+@@ -0,0 +1,117 @@
++/*
++	Audio File Library
++
++	Copyright 2000, Silicon Graphics, Inc.
++
++	This program is free software; you can redistribute it and/or modify
++	it under the terms of the GNU General Public License as published by
++	the Free Software Foundation; either version 2 of the License, or
++	(at your option) any later version.
++
++	This program is distributed in the hope that it will be useful,
++	but WITHOUT ANY WARRANTY; without even the implied warranty of
++	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++	GNU General Public License for more details.
++
++	You should have received a copy of the GNU General Public License along
++	with this program; if not, write to the Free Software Foundation, Inc.,
++	51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
++*/
++
++/*
++	sixteen-stereo-to-eight-mono.c
++
++	This program tests the conversion from 2-channel 16-bit integers to
++	1-channel 8-bit	integers.
++*/
++
++#ifdef HAVE_CONFIG_H
++#include <config.h>
++#endif
++
++#include <stdint.h>
++#include <stdio.h>
++#include <stdlib.h>
++#include <string.h>
++#include <unistd.h>
++#include <limits.h>
++
++#include <audiofile.h>
++
++#include "TestUtilities.h"
++
++int main (int argc, char **argv)
++{
++	AFfilehandle file;
++	AFfilesetup setup;
++	int16_t frames16[] = {14298, 392, 3923, -683, 958, -1921};
++	int8_t frames8[] = {28, 6, -2};
++	int i, frameCount = 3;
++	int8_t byte;
++	AFframecount result;
++
++	setup = afNewFileSetup();
++
++	afInitFileFormat(setup, AF_FILE_WAVE);
++
++	afInitSampleFormat(setup, AF_DEFAULT_TRACK, AF_SAMPFMT_TWOSCOMP, 16);
++	afInitChannels(setup, AF_DEFAULT_TRACK, 2);
++
++	char testFileName[PATH_MAX];
++	if (!createTemporaryFile("sixteen-to-eight", testFileName))
++	{
++		fprintf(stderr, "Could not create temporary file.\n");
++		exit(EXIT_FAILURE);
++	}
++
++	file = afOpenFile(testFileName, "w", setup);
++	if (file == AF_NULL_FILEHANDLE)
++	{
++		fprintf(stderr, "could not open file for writing\n");
++		exit(EXIT_FAILURE);
++	}
++
++	afFreeFileSetup(setup);
++
++	afWriteFrames(file, AF_DEFAULT_TRACK, frames16, frameCount);
++
++	afCloseFile(file);
++
++	file = afOpenFile(testFileName, "r", AF_NULL_FILESETUP);
++	if (file == AF_NULL_FILEHANDLE)
++	{
++		fprintf(stderr, "could not open file for reading\n");
++		exit(EXIT_FAILURE);
++	}
++
++	afSetVirtualSampleFormat(file, AF_DEFAULT_TRACK, AF_SAMPFMT_TWOSCOMP, 8);
++	afSetVirtualChannels(file, AF_DEFAULT_TRACK, 1);
++
++	for (i=0; i<frameCount; i++)
++	{
++		/* Read one frame. */
++		result = afReadFrames(file, AF_DEFAULT_TRACK, &byte, 1);
++
++		if (result != 1)
++			break;
++
++		/* Compare the byte read with its precalculated value. */
++		if (memcmp(&byte, &frames8[i], 1) != 0)
++		{
++			printf("error\n");
++			printf("expected %d, got %d\n", frames8[i], byte);
++			exit(EXIT_FAILURE);
++		}
++		else
++		{
++#ifdef DEBUG
++			printf("got what was expected: %d\n", byte);
++#endif
++		}
++	}
++
++	afCloseFile(file);
++	unlink(testFileName);
++
++	exit(EXIT_SUCCESS);
++}
diff --git a/nixpkgs/pkgs/development/libraries/audiofile/default.nix b/nixpkgs/pkgs/development/libraries/audiofile/default.nix
new file mode 100644
index 000000000000..1ed457aa5fe1
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/audiofile/default.nix
@@ -0,0 +1,76 @@
+{ stdenv, fetchurl, fetchpatch, alsaLib, AudioUnit, CoreServices }:
+
+let
+
+  fetchDebianPatch = { name, debname, sha256 }:
+    fetchpatch {
+      inherit sha256 name;
+      url = "https://salsa.debian.org/multimedia-team/audiofile/raw/debian/0.3.6-4/debian/patches/${debname}";
+    };
+
+in
+
+stdenv.mkDerivation rec {
+  name = "audiofile-0.3.6";
+
+  buildInputs =
+    stdenv.lib.optionals stdenv.isLinux [
+      alsaLib
+    ] ++ stdenv.lib.optionals stdenv.isDarwin [
+      CoreServices AudioUnit
+    ];
+
+  src = fetchurl {
+    url = "https://audiofile.68k.org/${name}.tar.gz";
+    sha256 = "0rb927zknk9kmhprd8rdr4azql4gn2dp75a36iazx2xhkbqhvind";
+  };
+
+  patches = [
+    ./gcc-6.patch
+    ./CVE-2015-7747.patch
+
+    (fetchDebianPatch {
+      name = "CVE-2017-6829.patch";
+      debname = "04_clamp-index-values-to-fix-index-overflow-in-IMA.cpp.patch";
+      sha256 = "04qxl51i64c53v69q2kx61qdq474f4vapk8rq97cipj7yrar392m";
+    })
+    (fetchDebianPatch {
+      name = "CVE-2017-6827+CVE-2017-6828+CVE-2017-6832+CVE-2017-6835+CVE-2017-6837.patch";
+      debname = "05_Always-check-the-number-of-coefficients.patch";
+      sha256 = "1ih03kfkabffi6ymp6832q470i28rsds78941vzqlshnqjb2nnxw";
+    })
+    (fetchDebianPatch {
+      name = "CVE-2017-6839.patch";
+      debname = "06_Check-for-multiplication-overflow-in-MSADPCM-decodeSam.patch";
+      sha256 = "0a8s2z8rljlj03p7l1is9s4fml8vyzvyvfrh1m6xj5a8vbi635d0";
+    })
+    (fetchDebianPatch {
+      name = "CVE-2017-6830+CVE-2017-6834+CVE-2017-6836+CVE-2017-6838.patch";
+      debname = "07_Check-for-multiplication-overflow-in-sfconvert.patch";
+      sha256 = "0rfba8rkasl5ycvc0kqlzinkl3rvyrrjvjhpc45h423wmjk2za2l";
+    })
+    (fetchDebianPatch {
+      name = "audiofile-fix-multiplyCheckOverflow-signature.patch";
+      debname = "08_Fix-signature-of-multiplyCheckOverflow.-It-returns-a-b.patch";
+      sha256 = "032p5jqp7q7jgc5axdnazz00zm7hd26z6m5j55ifs0sykr5lwldb";
+    })
+    (fetchDebianPatch {
+      name = "CVE-2017-6831.patch";
+      debname = "09_Actually-fail-when-error-occurs-in-parseFormat.patch";
+      sha256 = "0csikmj8cbiy6cigg0rmh67jrr0sgm56dfrnrxnac3m9635nxlac";
+    })
+    (fetchDebianPatch {
+      name = "CVE-2017-6833.patch";
+      debname = "10_Check-for-division-by-zero-in-BlockCodec-runPull.patch";
+      sha256 = "1rlislkjawq98bbcf1dgl741zd508wwsg85r37ca7pfdf6wgl6z7";
+    })
+  ];
+
+  meta = with stdenv.lib; {
+    description = "Library for reading and writing audio files in various formats";
+    homepage    = http://www.68k.org/~michael/audiofile/;
+    license     = licenses.lgpl21Plus;
+    maintainers = with maintainers; [ lovek323 ];
+    platforms   = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/audiofile/gcc-6.patch b/nixpkgs/pkgs/development/libraries/audiofile/gcc-6.patch
new file mode 100644
index 000000000000..1a7edd5af9a1
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/audiofile/gcc-6.patch
@@ -0,0 +1,30 @@
+http://patchwork.ozlabs.org/patch/630200/
+
+From 28cfdbbcb96a69087c3d21faf69b5eae7bcf6d69 Mon Sep 17 00:00:00 2001
+From: Hodorgasm <nsane457@gmail.com>
+Date: Wed, 11 May 2016 21:42:07 -0400
+Subject: [PATCH] Cast to unsigned while left bit-shifting
+
+GCC-6 now treats the left bitwise-shift of a negative integer as nonconformant so explicitly cast to an unsigned int while bit-shifting.
+
+Downloaded from upstream PR:
+https://github.com/mpruett/audiofile/pull/28
+
+Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
+---
+ libaudiofile/modules/SimpleModule.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/libaudiofile/modules/SimpleModule.h b/libaudiofile/modules/SimpleModule.h
+index 03c6c69..4014fb2 100644
+--- a/libaudiofile/modules/SimpleModule.h
++++ b/libaudiofile/modules/SimpleModule.h
+@@ -123,7 +123,7 @@ struct signConverter
+ 	typedef typename IntTypes<Format>::UnsignedType UnsignedType;
+ 
+ 	static const int kScaleBits = (Format + 1) * CHAR_BIT - 1;
+-	static const int kMinSignedValue = -1 << kScaleBits;
++	static const int kMinSignedValue = static_cast<signed>(static_cast<unsigned>(-1) << kScaleBits);;
+ 
+ 	struct signedToUnsigned : public std::unary_function<SignedType, UnsignedType>
+ 	{
diff --git a/nixpkgs/pkgs/development/libraries/avahi/default.nix b/nixpkgs/pkgs/development/libraries/avahi/default.nix
new file mode 100644
index 000000000000..28302fbbe32f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/avahi/default.nix
@@ -0,0 +1,83 @@
+{ fetchurl, fetchpatch, stdenv, pkgconfig, libdaemon, dbus, perlPackages
+, expat, gettext, intltool, glib, libiconv
+, gtk3Support ? false, gtk3 ? null
+, qt4 ? null
+, qt4Support ? false
+, withLibdnssdCompat ? false
+, python ? null
+, withPython ? false }:
+
+assert qt4Support -> qt4 != null;
+
+stdenv.mkDerivation rec {
+  name = "avahi${stdenv.lib.optionalString withLibdnssdCompat "-compat"}-${version}";
+  version = "0.7";
+
+  src = fetchurl {
+    url = "https://github.com/lathiat/avahi/releases/download/v${version}/avahi-${version}.tar.gz";
+    sha256 = "0128n7jlshw4bpx0vg8lwj8qwdisjxi7mvniwfafgnkzzrfrpaap";
+  };
+
+  patches = [
+    ./no-mkdir-localstatedir.patch
+    (fetchpatch {
+      name ="CVE-2017-6519-CVE-2018-100084.patch";
+      url = https://github.com/lathiat/avahi/commit/e111def44a7df4624a4aa3f85fe98054bffb6b4f.patch;
+      sha256 = "06n7b7kz6xcc35c7xjfc1kj3k2llyjgi09nhy0ci32l1bhacjw0q";
+    })
+  ];
+
+  buildInputs = [ libdaemon dbus glib expat libiconv ]
+    ++ (with perlPackages; [ perl XMLParser ])
+    ++ (stdenv.lib.optional gtk3Support gtk3)
+    ++ (stdenv.lib.optional qt4Support qt4);
+
+  propagatedBuildInputs =
+    stdenv.lib.optionals withPython (with python.pkgs; [ python pygobject3 dbus-python ]);
+
+  nativeBuildInputs = [ pkgconfig gettext intltool glib ];
+
+  configureFlags =
+    [ "--disable-qt3" "--disable-gdbm" "--disable-mono"
+      "--disable-gtk"
+      (stdenv.lib.enableFeature gtk3Support "gtk3")
+      "--${if qt4Support then "enable" else "disable"}-qt4"
+      (stdenv.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"
+    # autoipd won't build on darwin
+    ++ stdenv.lib.optional stdenv.isDarwin "--disable-autoipd";
+
+  preBuild = stdenv.lib.optionalString stdenv.isDarwin ''
+    sed -i '20 i\
+    #define __APPLE_USE_RFC_2292' \
+    avahi-core/socket.c
+  '';
+
+  postInstall =
+    # Maintain compat for mdnsresponder and howl
+    stdenv.lib.optionalString withLibdnssdCompat ''
+      ln -s avahi-compat-libdns_sd/dns_sd.h "$out/include/dns_sd.h"
+    '';
+  /*  # these don't exist (anymore?)
+    ln -s avahi-compat-howl $out/include/howl
+    ln -s avahi-compat-howl.pc $out/lib/pkgconfig/howl.pc
+  */
+
+  meta = with stdenv.lib; {
+    description = "mDNS/DNS-SD implementation";
+    homepage    = http://avahi.org;
+    license     = licenses.lgpl2Plus;
+    platforms   = platforms.unix;
+    maintainers = with maintainers; [ lovek323 ];
+
+    longDescription = ''
+      Avahi is a system which facilitates service discovery on a local
+      network.  It is an implementation of the mDNS (for "Multicast
+      DNS") and DNS-SD (for "DNS-Based Service Discovery")
+      protocols.
+    '';
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/avahi/no-mkdir-localstatedir.patch b/nixpkgs/pkgs/development/libraries/avahi/no-mkdir-localstatedir.patch
new file mode 100644
index 000000000000..72965c9f0282
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/avahi/no-mkdir-localstatedir.patch
@@ -0,0 +1,12 @@
+Don't "mkdir $(localstatedir)" since we can't do it (/var).
+
+--- a/avahi-daemon/Makefile.in
++++ b/avahi-daemon/Makefile.in
+@@ -1625,7 +1625,6 @@ xmllint:
+ 	done
+ 
+ install-data-local:
+-	test -z "$(avahi_runtime_dir)" || $(MKDIR_P) "$(DESTDIR)$(avahi_runtime_dir)"
+ 
+ update-systemd:
+ 	curl http://cgit.freedesktop.org/systemd/plain/src/sd-daemon.c > sd-daemon.c
diff --git a/nixpkgs/pkgs/development/libraries/avro-c++/default.nix b/nixpkgs/pkgs/development/libraries/avro-c++/default.nix
new file mode 100644
index 000000000000..11c66db70752
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/avro-c++/default.nix
@@ -0,0 +1,33 @@
+{ stdenv, fetchurl, cmake, boost, python2}:
+
+let version = "1.8.2"; in
+
+stdenv.mkDerivation {
+  name = "avro-c++-${version}";
+
+  src = fetchurl {
+    url = "mirror://apache/avro/avro-${version}/cpp/avro-cpp-${version}.tar.gz";
+    sha256 = "1ars58bfw83s8f1iqbhnqp4n9wc9cxsph0gs2a8k7r9fi09vja2k";
+  };
+
+  buildInputs = [
+    cmake
+    python2
+    boost
+  ];
+
+  preConfigure = ''
+    substituteInPlace test/SchemaTests.cc --replace "BOOST_CHECKPOINT" "BOOST_TEST_CHECKPOINT"
+    substituteInPlace test/buffertest.cc --replace "BOOST_MESSAGE" "BOOST_TEST_MESSAGE"
+  '';
+
+  enableParallelBuilding = true;
+
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/avro-c/default.nix b/nixpkgs/pkgs/development/libraries/avro-c/default.nix
new file mode 100644
index 000000000000..cbd29a095d45
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/avro-c/default.nix
@@ -0,0 +1,30 @@
+{ stdenv, cmake, fetchurl, pkgconfig, jansson, zlib }:
+
+let
+  version = "1.9.0";
+in stdenv.mkDerivation rec {
+  name = "avro-c-${version}";
+
+  src = fetchurl {
+    url = "mirror://apache/avro/avro-${version}/c/avro-c-${version}.tar.gz";
+    sha256 = "1ch8z9jpkjxjx2zh28z0946gz3vwj1jnkrzg4vwvfa287128cml0";
+  };
+
+  postPatch = ''
+    patchShebangs .
+  '';
+
+  nativeBuildInputs = [ pkgconfig cmake ];
+
+  buildInputs = [ jansson zlib ];
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    description = "A C library which implements parts of the Avro Specification";
+    homepage = https://avro.apache.org/;
+    license = licenses.asl20;
+    maintainers = with maintainers; [ lblasc ];
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/aws-c-common/default.nix b/nixpkgs/pkgs/development/libraries/aws-c-common/default.nix
new file mode 100644
index 000000000000..c8f284acc135
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/aws-c-common/default.nix
@@ -0,0 +1,28 @@
+{ lib, stdenv, fetchFromGitHub, cmake, libexecinfo }:
+
+stdenv.mkDerivation rec {
+  pname = "aws-c-common";
+  version = "0.3.9";
+
+  src = fetchFromGitHub {
+    owner = "awslabs";
+    repo = pname;
+    rev = "v${version}";
+    sha256 = "04wrmrw83vypqzsq88b2q8kp5sfbv0qsci3bcxw0c2mfxqk8358n";
+  };
+
+  nativeBuildInputs = [ cmake ];
+
+  NIX_CFLAGS_COMPILE = lib.optionals stdenv.isDarwin [
+    "-Wno-nullability-extension"
+    "-Wno-typedef-redefinition"
+  ];
+
+  meta = with lib; {
+    description = "AWS SDK for C common core";
+    homepage = https://github.com/awslabs/aws-c-common;
+    license = licenses.asl20;
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ orivej eelco ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/aws-c-event-stream/default.nix b/nixpkgs/pkgs/development/libraries/aws-c-event-stream/default.nix
new file mode 100644
index 000000000000..ccc4abb85fdb
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/aws-c-event-stream/default.nix
@@ -0,0 +1,29 @@
+{ lib, stdenv, fetchFromGitHub, cmake, aws-c-common, aws-checksums, libexecinfo }:
+
+stdenv.mkDerivation rec {
+  pname = "aws-c-event-stream";
+  version = "0.1.1";
+
+  src = fetchFromGitHub {
+    owner = "awslabs";
+    repo = pname;
+    rev = "v${version}";
+    sha256 = "0anjynfghk3inysy21wqvhxha33xsswh3lm8pr7nx7cpj6cmr37m";
+  };
+
+  nativeBuildInputs = [ cmake ];
+
+  buildInputs = [ aws-c-common aws-checksums ] ++ lib.optional stdenv.hostPlatform.isMusl libexecinfo;
+
+  cmakeFlags = [
+    "-DCMAKE_MODULE_PATH=${aws-c-common}/lib/cmake"
+  ];
+
+  meta = with lib; {
+    description = "C99 implementation of the vnd.amazon.eventstream content-type";
+    homepage = https://github.com/awslabs/aws-c-event-stream;
+    license = licenses.asl20;
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ orivej eelco ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/aws-checksums/default.nix b/nixpkgs/pkgs/development/libraries/aws-checksums/default.nix
new file mode 100644
index 000000000000..0e47398b346d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/aws-checksums/default.nix
@@ -0,0 +1,23 @@
+{ lib, stdenv, fetchFromGitHub, cmake }:
+
+stdenv.mkDerivation rec {
+  pname = "aws-checksums";
+  version = "0.1.2";
+
+  src = fetchFromGitHub {
+    owner = "awslabs";
+    repo = pname;
+    rev = "v${version}";
+    sha256 = "1r21sfs1ik6cb8bz17w6gp6y2xa9rbjxjka0p6airb3qds094iv5";
+  };
+
+  nativeBuildInputs = [ cmake ];
+
+  meta = with lib; {
+    description = "HW accelerated CRC32c and CRC32";
+    homepage = https://github.com/awslabs/aws-checksums;
+    license = licenses.asl20;
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ orivej eelco ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/aws-sdk-cpp/default.nix b/nixpkgs/pkgs/development/libraries/aws-sdk-cpp/default.nix
new file mode 100644
index 000000000000..7233a187053e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/aws-sdk-cpp/default.nix
@@ -0,0 +1,60 @@
+{ lib, stdenv, fetchFromGitHub, cmake, curl, openssl, zlib
+, aws-c-common, aws-c-event-stream, aws-checksums
+, CoreAudio, AudioToolbox
+, # Allow building a limited set of APIs, e.g. ["s3" "ec2"].
+  apis ? ["*"]
+, # Whether to enable AWS' custom memory management.
+  customMemoryManagement ? true
+}:
+
+stdenv.mkDerivation rec {
+  name = "aws-sdk-cpp-${version}";
+  version = "1.7.90";
+
+  src = fetchFromGitHub {
+    owner = "awslabs";
+    repo = "aws-sdk-cpp";
+    rev = version;
+    sha256 = "0zpqi612qmm0n53crxiisv0vdif43ymg13kafy6vv43j2wmh66ga";
+  };
+
+  # FIXME: might be nice to put different APIs in different outputs
+  # (e.g. libaws-cpp-sdk-s3.so in output "s3").
+  outputs = [ "out" "dev" ];
+  separateDebugInfo = stdenv.isLinux;
+
+  nativeBuildInputs = [ cmake curl ];
+
+  buildInputs = [
+    curl openssl zlib
+    aws-c-common aws-c-event-stream aws-checksums
+  ] ++ lib.optionals (stdenv.isDarwin &&
+                        ((builtins.elem "text-to-speech" apis) ||
+                         (builtins.elem "*" apis)))
+         [ CoreAudio AudioToolbox ];
+
+  cmakeFlags = [
+    "-DBUILD_DEPS=OFF"
+    "-DCMAKE_SKIP_BUILD_RPATH=OFF"
+  ] ++ lib.optional (!customMemoryManagement) "-DCUSTOM_MEMORY_MANAGEMENT=0"
+  ++ lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [
+    "-DENABLE_TESTING=OFF"
+    "-DCURL_HAS_H2=0"
+  ] ++ lib.optional (apis != ["*"])
+    "-DBUILD_ONLY=${lib.concatStringsSep ";" apis}";
+
+  preConfigure =
+    ''
+      rm aws-cpp-sdk-core-tests/aws/auth/AWSCredentialsProviderTest.cpp
+    '';
+
+  __darwinAllowLocalNetworking = true;
+
+  meta = with lib; {
+    description = "A C++ interface for Amazon Web Services";
+    homepage = https://github.com/awslabs/aws-sdk-cpp;
+    license = licenses.asl20;
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ eelco orivej ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/babl/default.nix b/nixpkgs/pkgs/development/libraries/babl/default.nix
new file mode 100644
index 000000000000..eff6ff626325
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/babl/default.nix
@@ -0,0 +1,21 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  pname = "babl";
+  version = "0.1.66";
+
+  src = fetchurl {
+    url = "https://ftp.gtk.org/pub/babl/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.bz2";
+    sha256 = "0qx1dwbinxihwl2lmxi60qiqi402jlrdcnixx14kk6j88n9xi79n";
+  };
+
+  doCheck = true;
+
+  meta = with stdenv.lib; {
+    description = "Image pixel format conversion library";
+    homepage = http://gegl.org/babl/;
+    license = licenses.gpl3;
+    maintainers = with stdenv.lib.maintainers; [ jtojnar ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/backward-cpp/default.nix b/nixpkgs/pkgs/development/libraries/backward-cpp/default.nix
new file mode 100644
index 000000000000..42621a1792cc
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/backward-cpp/default.nix
@@ -0,0 +1,30 @@
+{ stdenv, lib, fetchFromGitHub }:
+
+stdenv.mkDerivation rec {
+  name = "backward-${version}";
+  version = "1.3";
+
+  src = fetchFromGitHub {
+    owner = "bombela";
+    repo = "backward-cpp";
+    rev = "v${version}";
+    sha256 = "1nx77qamal53rq8qxsjzax6ljawb345a1v3cqmfwa0hx26srxcln";
+  };
+
+  installPhase = ''
+    runHook preInstall
+
+    mkdir -p $out/include
+    cp backward.hpp $out/include
+
+    runHook postInstall
+  '';
+
+  meta = with lib; {
+    description = "Beautiful stack trace pretty printer for C++";
+    homepage = "https://github.com/bombela/backward-cpp";
+    license = licenses.mit;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ cstrahan ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/bamf/default.nix b/nixpkgs/pkgs/development/libraries/bamf/default.nix
new file mode 100644
index 000000000000..9d5063d8f07d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/bamf/default.nix
@@ -0,0 +1,83 @@
+{ stdenv, autoconf, automake, libtool, gnome3, which, fetchgit, libgtop, libwnck3, glib, vala, pkgconfig
+, libstartup_notification, gobject-introspection, gtk-doc, docbook_xsl
+, xorgserver, dbus, python2, wrapGAppsHook }:
+
+stdenv.mkDerivation rec {
+  name = "bamf-${version}";
+  version = "0.5.4";
+
+  outputs = [ "out" "dev" "devdoc" ];
+
+  src = fetchgit {
+    url = https://git.launchpad.net/~unity-team/bamf;
+    rev = version;
+    sha256 = "1klvij1wyhdj5d8sr3b16pfixc1yk8ihglpjykg7zrr1f50jfgsz";
+  };
+
+  nativeBuildInputs = [
+    autoconf
+    automake
+    docbook_xsl
+    gnome3.gnome-common
+    gobject-introspection
+    gtk-doc
+    libtool
+    pkgconfig
+    vala
+    which
+    # Tests
+    python2
+    python2.pkgs.libxslt
+    python2.pkgs.libxml2
+    dbus
+    xorgserver
+    wrapGAppsHook
+  ];
+
+  buildInputs = [
+    glib
+    libgtop
+    libstartup_notification
+    libwnck3
+  ];
+
+  # Fix hard-coded path
+  # https://bugs.launchpad.net/bamf/+bug/1780557
+  postPatch = ''
+    substituteInPlace data/Makefile.am \
+      --replace '/usr/lib/systemd/user' '@prefix@/lib/systemd/user'
+  '';
+
+  configureFlags = [
+    "--enable-headless-tests"
+    "--enable-gtk-doc"
+  ];
+
+  # fix paths
+  makeFlags = [
+    "INTROSPECTION_GIRDIR=${placeholder ''dev''}/share/gir-1.0/"
+    "INTROSPECTION_TYPELIBDIR=${placeholder ''out''}/lib/girepository-1.0"
+  ];
+
+  preConfigure = ''
+    ./autogen.sh
+  '';
+
+  # TODO: Requires /etc/machine-id
+  doCheck = false;
+
+  # ignore deprecation errors
+  NIX_CFLAGS_COMPILE = "-Wno-deprecated-declarations";
+
+  meta = with stdenv.lib; {
+    description = "Application matching framework";
+    longDescription = ''
+      Removes the headache of applications matching
+      into a simple DBus daemon and c wrapper library.
+    '';
+    homepage = https://launchpad.net/bamf;
+    license = licenses.lgpl3;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ davidak ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/bctoolbox/default.nix b/nixpkgs/pkgs/development/libraries/bctoolbox/default.nix
new file mode 100644
index 000000000000..5439c7657e08
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/bctoolbox/default.nix
@@ -0,0 +1,21 @@
+{stdenv, fetchFromGitHub, cmake, mbedtls, bcunit, srtp}:
+stdenv.mkDerivation rec {
+  name = "${baseName}-${version}";
+  baseName = "bctoolbox";
+  version = "0.6.0";
+  buildInputs = [cmake mbedtls bcunit srtp];
+  src = fetchFromGitHub {
+    owner = "BelledonneCommunications";
+    repo = "${baseName}";
+    rev = "${version}";
+    sha256 = "1cxx243wyzkd4xnvpyqf97n0rjhfckpvw1vhwnbwshq3q6fra909";
+  };
+
+  meta = {
+    inherit version;
+    description = ''Utilities library for Linphone'';
+    license = stdenv.lib.licenses.gpl2Plus ;
+    maintainers = [stdenv.lib.maintainers.raskin];
+    platforms = stdenv.lib.platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/beecrypt/default.nix b/nixpkgs/pkgs/development/libraries/beecrypt/default.nix
new file mode 100644
index 000000000000..d7d6ef545163
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/beecrypt/default.nix
@@ -0,0 +1,16 @@
+{stdenv, fetchurl, m4}:
+
+stdenv.mkDerivation {
+  name = "beecrypt-4.2.1";
+  src = fetchurl {
+    url = mirror://sourceforge/beecrypt/beecrypt-4.2.1.tar.gz;
+    sha256 = "0pf5k1c4nsj77jfq5ip0ra1gzx2q47xaa0s008fnn6hd11b1yvr8";
+  };
+  buildInputs = [ m4 ];
+  configureFlags = [ "--disable-optimized" "--enable-static" ];
+
+  meta = {
+    platforms = stdenv.lib.platforms.linux;
+    license = stdenv.lib.licenses.lgpl2;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/beignet/clang_llvm.patch b/nixpkgs/pkgs/development/libraries/beignet/clang_llvm.patch
new file mode 100644
index 000000000000..bcdad510e10d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/beignet/clang_llvm.patch
@@ -0,0 +1,49 @@
+diff --git a/./CMake/FindLLVM.cmake b/../Beignet-1.1.2-Source_new/CMake/FindLLVM.cmake
+index a148321..96cafb8 100644
+--- a/./CMake/FindLLVM.cmake
++++ b/../Beignet-1.1.2-Source_new/CMake/FindLLVM.cmake
+@@ -22,6 +22,7 @@ if (LLVM_CONFIG_EXECUTABLE)
+ else (LLVM_CONFIG_EXECUTABLE)
+   message(FATAL_ERROR "Could NOT find LLVM executable, please add -DLLVM_INSTALL_DIR=/path/to/llvm-config/ in cmake command")
+ endif (LLVM_CONFIG_EXECUTABLE)
++
+ execute_process(
+   COMMAND ${LLVM_CONFIG_EXECUTABLE} --version
+   OUTPUT_VARIABLE LLVM_VERSION
+@@ -44,10 +45,16 @@ if (LLVM_FIND_VERSION_MAJOR AND LLVM_FIND_VERSION_MINOR)
+   endif (LLVM_VERSION_NODOT VERSION_LESS LLVM_FIND_VERSION_NODOT)
+ endif (LLVM_FIND_VERSION_MAJOR AND LLVM_FIND_VERSION_MINOR)
+ 
+-if (LLVM_INSTALL_DIR)
++if (CLANG_INSTALL_DIR)
+   find_program(CLANG_EXECUTABLE
+                NAMES clang-${LLVM_VERSION_NODOT} clang-${LLVM_VERSION_NOPATCH} clang
+-               PATHS ${LLVM_INSTALL_DIR} NO_DEFAULT_PATH)
++               PATHS ${CLANG_INSTALL_DIR} NO_DEFAULT_PATH)
++else (CLANG_INSTALL_DIR)
++  find_program(CLANG_EXECUTABLE
++               NAMES clang-${LLVM_VERSION_NODOT} clang-${LLVM_VERSION_NOPATCH} clang)
++endif (CLANG_INSTALL_DIR)
++
++if (LLVM_INSTALL_DIR)
+   find_program(LLVM_AS_EXECUTABLE
+                NAMES llvm-as-${LLVM_VERSION_NODOT} llvm-as-${LLVM_VERSION_NOPATCH} llvm-as
+                PATHS ${LLVM_INSTALL_DIR} NO_DEFAULT_PATH)
+@@ -55,8 +62,6 @@ if (LLVM_INSTALL_DIR)
+                NAMES llvm-link-${LLVM_VERSION_NODOT} llvm-link-${LLVM_VERSION_NOPATCH} llvm-link
+                PATHS ${LLVM_INSTALL_DIR} NO_DEFAULT_PATH)
+ else (LLVM_INSTALL_DIR)
+-  find_program(CLANG_EXECUTABLE
+-               NAMES clang-${LLVM_VERSION_NODOT} clang-${LLVM_VERSION_NOPATCH} clang)
+   find_program(LLVM_AS_EXECUTABLE
+                NAMES llvm-as-${LLVM_VERSION_NODOT} llvm-as-${LLVM_VERSION_NOPATCH} llvm-as)
+   find_program(LLVM_LINK_EXECUTABLE
+@@ -105,7 +110,7 @@ endif (LLVM_VERSION_NODOT VERSION_GREATER 34)
+ macro(add_one_lib name)
+   FIND_LIBRARY(CLANG_LIB
+     NAMES ${name}
+-    PATHS ${LLVM_LIBRARY_DIR} NO_DEFAULT_PATH)
++    PATHS ${CLANG_LIBRARY_DIR} NO_DEFAULT_PATH)
+   set(CLANG_LIBRARIES ${CLANG_LIBRARIES} ${CLANG_LIB})
+ 	unset(CLANG_LIB CACHE)
+ endmacro()
diff --git a/nixpkgs/pkgs/development/libraries/beignet/default.nix b/nixpkgs/pkgs/development/libraries/beignet/default.nix
new file mode 100644
index 000000000000..05ff5593205a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/beignet/default.nix
@@ -0,0 +1,116 @@
+{ stdenv
+, fetchFromGitHub
+, cmake
+, pkgconfig
+, clang-unwrapped
+, llvm
+, libdrm
+, libX11
+, libpthreadstubs
+, libXdmcp
+, libXdamage
+, libXext
+, python3
+, ocl-icd
+, libGL
+, makeWrapper
+, beignet
+}:
+
+stdenv.mkDerivation rec {
+  name = "beignet-${version}";
+  version = "unstable-2018.08.20";
+
+  src = fetchFromGitHub {
+    owner  = "intel";
+    repo   = "beignet";
+    rev    = "fc5f430cb7b7a8f694d86acbb038bd5b38ec389c";
+    sha256 = "1z64v69w7f52jrskh1jfyh1x46mzfhjrqxj9hhgzh3xxv9yla32h";
+  };
+
+  patches = [ ./clang_llvm.patch ];
+
+  enableParallelBuilding = true;
+
+  postPatch = ''
+    substituteInPlace CMakeLists.txt --replace /etc/OpenCL/vendors "\''${CMAKE_INSTALL_PREFIX}/etc/OpenCL/vendors"
+    patchShebangs src/git_sha1.sh
+  '';
+
+  cmakeFlags = [ "-DCLANG_LIBRARY_DIR=${clang-unwrapped}/lib" ];
+
+  buildInputs = [
+    llvm
+    clang-unwrapped
+    libX11
+    libXext
+    libpthreadstubs
+    libdrm
+    libXdmcp
+    libXdamage
+    ocl-icd
+    libGL
+  ];
+
+  nativeBuildInputs = [
+    cmake
+    pkgconfig
+    python3
+  ];
+
+  passthru.utests = stdenv.mkDerivation rec {
+    name = "beignet-utests-${version}";
+    inherit version src;
+
+    preConfigure = ''
+      cd utests
+    '';
+
+    enableParallelBuilding = true;
+
+    nativeBuildInputs = [
+      cmake
+      python3
+      pkgconfig
+      makeWrapper
+    ];
+
+    buildInputs = [
+      ocl-icd
+    ];
+
+    installPhase = ''
+      wrapBin() {
+        install -Dm755 "$1" "$out/bin/$(basename "$1")"
+        wrapProgram "$out/bin/$(basename "$1")" \
+          --set OCL_BITCODE_LIB_PATH ${beignet}/lib/beignet/beignet.bc \
+          --set OCL_HEADER_FILE_DIR "${beignet}/lib/beignet/include" \
+          --set OCL_PCH_PATH "${beignet}/lib/beignet/beignet.pch" \
+          --set OCL_GBE_PATH "${beignet}/lib/beignet/libgbe.so" \
+          --set OCL_INTERP_PATH "${beignet}/lib/beignet/libgbeinterp.so" \
+          --set OCL_KERNEL_PATH "$out/lib/beignet/kernels" \
+          --set OCL_IGNORE_SELF_TEST 1
+      }
+
+      install -Dm755 libutests.so $out/lib/libutests.so
+      wrapBin utest_run
+      wrapBin flat_address_space
+      mkdir $out/lib/beignet
+      cp -r ../../kernels $out/lib/beignet
+    '';
+  };
+
+  meta = with stdenv.lib; {
+    homepage = https://cgit.freedesktop.org/beignet/;
+    description = "OpenCL Library for Intel Ivy Bridge and newer GPUs";
+    longDescription = ''
+      The package provides an open source implementation of the OpenCL specification for Intel GPUs.
+      It supports the Intel OpenCL runtime library and compiler.
+    '';
+    license = licenses.lgpl21Plus;
+    maintainers = with maintainers; [ artuuge zimbatm ];
+    platforms = platforms.linux;
+    # Requires libdrm_intel
+    badPlatforms = [ "aarch64-linux" ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/belcard/default.nix b/nixpkgs/pkgs/development/libraries/belcard/default.nix
new file mode 100644
index 000000000000..093bb811489f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/belcard/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, cmake, fetchFromGitHub, bctoolbox, belr }:
+
+stdenv.mkDerivation rec {
+  baseName = "belcard";
+  version = "1.0.2";
+  name = "${baseName}-${version}";
+
+  src = fetchFromGitHub {
+    owner = "BelledonneCommunications";
+    repo = "${baseName}";
+    rev = "${version}";
+    sha256 = "1pwji83vpsdrfma24rnj3rz1x0a0g6zk3v4xjnip7zf2ys3zcnlk";
+  };
+
+  buildInputs = [ bctoolbox belr ];
+  nativeBuildInputs = [ cmake ];
+
+  meta = with stdenv.lib;{
+    description = "Belcard is a C++ library to manipulate VCard standard format";
+    homepage = https://github.com/BelledonneCommunications/belcard;
+    license = licenses.lgpl21;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/belle-sip/default.nix b/nixpkgs/pkgs/development/libraries/belle-sip/default.nix
new file mode 100644
index 000000000000..09ca4908d789
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/belle-sip/default.nix
@@ -0,0 +1,37 @@
+{ stdenv, antlr3_4, libantlr3c, jre, polarssl, fetchFromGitHub
+  , cmake, zlib, bctoolbox
+}:
+
+stdenv.mkDerivation rec {
+  baseName = "belle-sip";
+  version = "1.6.3";
+  name = "${baseName}-${version}";
+
+  src = fetchFromGitHub {
+    owner = "BelledonneCommunications";
+    repo = "${baseName}";
+    rev = "${version}";
+    sha256 = "0q70db1klvhca1af29bm9paka3gyii5hfbzrj4178gclsg7cj8fk";
+  };
+
+  nativeBuildInputs = [ jre cmake ];
+
+  buildInputs = [ zlib ];
+
+  NIX_CFLAGS_COMPILE = "-Wno-error=deprecated-declarations";
+
+  propagatedBuildInputs = [ antlr3_4 libantlr3c polarssl bctoolbox ];
+
+  configureFlags = [
+    "--with-polarssl=${polarssl}"
+  ];
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    homepage = http://www.linphone.org/index.php/eng;
+    description = "A Voice-over-IP phone";
+    license = licenses.gpl2;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/belr/default.nix b/nixpkgs/pkgs/development/libraries/belr/default.nix
new file mode 100644
index 000000000000..736c9a2f9e0c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/belr/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, cmake, fetchFromGitHub, bctoolbox }:
+
+stdenv.mkDerivation rec {
+  baseName = "belr";
+  version = "0.1.3";
+  name = "${baseName}-${version}";
+
+  src = fetchFromGitHub {
+    owner = "BelledonneCommunications";
+    repo = "${baseName}";
+    rev = "${version}";
+    sha256 = "0mf8lsyq1z3b5p47c00lnwc8n7v9nzs1fd2g9c9hnz6fjd2ka44w";
+  };
+
+  buildInputs = [ bctoolbox ];
+  nativeBuildInputs = [ cmake ];
+
+  meta = with stdenv.lib;{
+    description = "Belr is Belledonne Communications' language recognition library";
+    homepage = https://github.com/BelledonneCommunications/belr;
+    license = licenses.lgpl21;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/biblesync/default.nix b/nixpkgs/pkgs/development/libraries/biblesync/default.nix
new file mode 100644
index 000000000000..e6702d0db640
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/biblesync/default.nix
@@ -0,0 +1,34 @@
+{ stdenv, fetchurl, pkgconfig, cmake, libuuid }:
+
+with stdenv.lib;
+stdenv.mkDerivation rec{
+
+  name = "biblesync-${version}";
+  version = "1.1.2";
+
+  src = fetchurl{
+    url = "mirror://sourceforge/project/gnomesword/BibleSync/1.1.2/${name}.tar.gz";
+    sha256 = "0190q2da0ppif2242lahl8xfz01n9sijy60aq1a0545qcp0ilvl8";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ cmake libuuid ];
+
+  meta = {
+    homepage = http://www.crosswire.org/wiki/BibleSync;
+    description = "A multicast protocol to Bible software shared conavigation";
+    longDescription = ''
+      BibleSync is a multicast protocol to support Bible software
+      shared co-navigation. It uses LAN multicast in either a
+      personal/small team mutual navigation motif or in a classroom
+      environment where there are Speakers plus the Audience. The
+      library implementing the protocol is a single C++ class
+      providing a complete yet minimal public interface to support
+      mode setting, setup for packet reception, transmit on local
+      navigation, and handling of incoming packets.
+    '';
+    license = licenses.publicDomain;
+    maintainers = [ maintainers.AndersonTorres ]; 
+    platforms = stdenv.lib.platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/blitz/blitz-gcc47.patch b/nixpkgs/pkgs/development/libraries/blitz/blitz-gcc47.patch
new file mode 100644
index 000000000000..d0b35665567b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/blitz/blitz-gcc47.patch
@@ -0,0 +1,33 @@
+diff -ur blitz-0.10/blitz/bzdebug.h blitz-0.10.new/blitz/bzdebug.h
+--- blitz-0.10/blitz/bzdebug.h	2012-05-11 22:11:13.000000000 +0200
++++ blitz-0.10.new/blitz/bzdebug.h	2012-06-28 15:42:38.060656045 +0200
+@@ -117,15 +117,15 @@
+     }
+   }
+ 
+-    #define BZASSERT(X)        checkAssert(X, __FILE__, __LINE__)
+-    #define BZPRECONDITION(X)  checkAssert(X, __FILE__, __LINE__)
+-    #define BZPOSTCONDITION(X) checkAssert(X, __FILE__, __LINE__)
+-    #define BZSTATECHECK(X,Y)  checkAssert(X == Y, __FILE__, __LINE__)
++    #define BZASSERT(X)        blitz::checkAssert(X, __FILE__, __LINE__)
++    #define BZPRECONDITION(X)  blitz::checkAssert(X, __FILE__, __LINE__)
++    #define BZPOSTCONDITION(X) blitz::checkAssert(X, __FILE__, __LINE__)
++    #define BZSTATECHECK(X,Y)  blitz::checkAssert(X == Y, __FILE__, __LINE__)
+     #define BZPRECHECK(X,Y)                                    \
+         {                                                      \
+             if ((assertFailMode == false) && (!(X)))           \
+                 BZ_STD_SCOPE(cerr) << Y << BZ_STD_SCOPE(endl); \
+-            checkAssert(X, __FILE__, __LINE__);                \
++            blitz::checkAssert(X, __FILE__, __LINE__);                \
+         }
+ 
+     #define BZ_DEBUG_MESSAGE(X)                                          \
+@@ -138,7 +138,7 @@
+         }
+ 
+     #define BZ_DEBUG_PARAM(X) X
+-    #define BZ_PRE_FAIL        checkAssert(0)
++    #define BZ_PRE_FAIL        blitz::checkAssert(0)
+     #define BZ_ASM_DEBUG_MARKER
+ 
+ #elif defined(BZ_DEBUG)
diff --git a/nixpkgs/pkgs/development/libraries/blitz/blitz-testsuite-stencil-et.patch b/nixpkgs/pkgs/development/libraries/blitz/blitz-testsuite-stencil-et.patch
new file mode 100644
index 000000000000..fcff8685a08d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/blitz/blitz-testsuite-stencil-et.patch
@@ -0,0 +1,13 @@
+diff --git a/testsuite/stencil-et.cpp b/testsuite/stencil-et.cpp
+index b23e979..fe6b5ed 100644
+--- a/testsuite/stencil-et.cpp
++++ b/testsuite/stencil-et.cpp
+@@ -44,7 +44,7 @@ void test_expr(const T1& d1, const T2& d2)
+   BZTEST(all(d1==d2));
+ }
+ */
+-#define test_expr(d1,d2) BZTEST(all((d1)==(d2)));
++#define test_expr(d1,d2) BZTEST(all((d1)-(d2)<=1e-7));
+ 
+ // Test two vector expressions for equality
+ template<typename T1, typename T2>
diff --git a/nixpkgs/pkgs/development/libraries/blitz/default.nix b/nixpkgs/pkgs/development/libraries/blitz/default.nix
new file mode 100644
index 000000000000..503e4b0fa43b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/blitz/default.nix
@@ -0,0 +1,82 @@
+{ stdenv, fetchurl, pkgconfig, gfortran, texinfo
+
+# Select SIMD alignment width (in bytes) for vectorization.
+, simdWidth ? 1
+
+# Pad arrays to simdWidth by default?
+# Note: Only useful if simdWidth > 1
+, enablePadding ? false
+
+# Activate serialization through Boost.Serialize?
+, enableSerialization ? true, boost ? null
+
+# Activate test-suite?
+# WARNING: Some of the tests require up to 1700MB of memory to compile.
+, doCheck ? true
+
+}:
+
+assert enableSerialization -> boost != null;
+
+let
+  inherit (stdenv.lib) optional optionals;
+in
+
+stdenv.mkDerivation rec {
+  name = "blitz++-0.10";
+  src = fetchurl {
+    url = mirror://sourceforge/blitz/blitz-0.10.tar.gz;
+    sha256 = "153g9sncir6ip9l7ssl6bhc4qzh0qr3lx2d15qm68hqxj7kg0kl0";
+  };
+
+  patches = [ ./blitz-gcc47.patch ./blitz-testsuite-stencil-et.patch ];
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ gfortran texinfo ]
+    ++ optional (boost != null) boost;
+
+  configureFlags =
+    [ "--enable-shared"
+      "--disable-static"
+      "--enable-fortran"
+      "--enable-optimize"
+      "--with-pic=yes"
+      "--enable-html-docs"
+      "--disable-doxygen"
+      "--disable-dot"
+      "--disable-latex-docs"
+      "--enable-simd-width=${toString simdWidth}"
+    ]
+    ++ optional enablePadding "--enable-array-length-padding"
+    ++ optional enableSerialization "--enable-serialization"
+    ++ optionals (boost != null) [ "--with-boost=${boost.dev}"
+                                   "--with-boost-libdir=${boost.out}/lib" ]
+    ++ optional stdenv.is64bit "--enable-64bit"
+    ;
+
+  enableParallelBuilding = true;
+
+  buildFlags = "lib info pdf html";
+  installTargets = [ "install" "install-info" "install-pdf" "install-html" ];
+
+  inherit doCheck;
+  checkTarget = "check-testsuite check-examples";
+
+  meta = {
+    description = "Fast multi-dimensional array library for C++";
+    homepage = https://sourceforge.net/projects/blitz/;
+    license = stdenv.lib.licenses.lgpl3;
+    platforms = stdenv.lib.platforms.linux ++ stdenv.lib.platforms.darwin;
+    maintainers = [ stdenv.lib.maintainers.aherrmann ];
+
+    longDescription = ''
+      Blitz++ is a C++ class library for scientific computing which provides
+      performance on par with Fortran 77/90. It uses template techniques to
+      achieve high performance. Blitz++ provides dense arrays and vectors,
+      random number generators, and small vectors (useful for representing
+      multicomponent or vector fields).
+    '';
+
+    broken = true; # failing test, ancient version, no library user in nixpkgs => if you care to fix it, go ahead
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/bobcat/default.nix b/nixpkgs/pkgs/development/libraries/bobcat/default.nix
new file mode 100644
index 000000000000..812ad546f866
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/bobcat/default.nix
@@ -0,0 +1,43 @@
+{ stdenv, fetchFromGitHub, icmake
+, libmilter, libX11, openssl, readline
+, utillinux, yodl }:
+
+stdenv.mkDerivation rec {
+  name = "bobcat-${version}";
+  version = "4.08.03";
+
+  src = fetchFromGitHub {
+    sha256 = "163mdl8hxids7123bjxmqhcaqyc1dv7hv8k33s713ac6lzawarq2";
+    rev = version;
+    repo = "bobcat";
+    owner = "fbb-git";
+  };
+
+  buildInputs = [ libmilter libX11 openssl readline utillinux ];
+  nativeBuildInputs = [ icmake yodl ];
+
+  setSourceRoot = ''
+    sourceRoot=$(echo */bobcat)
+  '';
+
+  postPatch = ''
+    substituteInPlace INSTALL.im --replace /usr $out
+    patchShebangs .
+  '';
+
+  buildPhase = ''
+    ./build libraries all
+    ./build man
+  '';
+
+  installPhase = ''
+    ./build install x
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Brokken's Own Base Classes And Templates";
+    homepage = https://fbb-git.github.io/bobcat/;
+    license = licenses.gpl3;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/boehm-gc/7.6.6.nix b/nixpkgs/pkgs/development/libraries/boehm-gc/7.6.6.nix
new file mode 100644
index 000000000000..c84e0863517a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/boehm-gc/7.6.6.nix
@@ -0,0 +1,71 @@
+{ lib, stdenv, fetchurl, fetchpatch, pkgconfig, libatomic_ops
+, enableLargeConfig ? false # doc: https://github.com/ivmai/bdwgc/blob/v7.6.6/doc/README.macros#L179
+}:
+
+stdenv.mkDerivation rec {
+  name = "boehm-gc-${version}";
+  version = "7.6.6";
+
+  src = fetchurl {
+    urls = [
+      "http://www.hboehm.info/gc/gc_source/gc-${version}.tar.gz"
+      "https://github.com/ivmai/bdwgc/releases/download/v${version}/gc-${version}.tar.gz"
+    ];
+    sha256 = "1p1r015a7jbpvkkbgzv1y8nxrbbp6dg0mq3ksi6ji0qdz3wfss79";
+  };
+
+  buildInputs = [ libatomic_ops ];
+  nativeBuildInputs = [ pkgconfig ];
+
+  outputs = [ "out" "dev" "doc" ];
+  separateDebugInfo = stdenv.isLinux;
+
+  preConfigure = stdenv.lib.optionalString (stdenv.hostPlatform.libc == "musl") ''
+    export NIX_CFLAGS_COMPILE+=" -D_GNU_SOURCE -DUSE_MMAP -DHAVE_DL_ITERATE_PHDR"
+  '';
+
+  patches =
+    # https://github.com/ivmai/bdwgc/pull/208
+    lib.optional stdenv.hostPlatform.isRiscV ./riscv.patch;
+
+  configureFlags =
+    [ "--enable-cplusplus" ]
+    ++ lib.optional enableLargeConfig "--enable-large-config"
+    ++ lib.optional (stdenv.hostPlatform.libc == "musl") "--disable-static";
+
+  doCheck = true; # not cross;
+
+  # Don't run the native `strip' when cross-compiling.
+  dontStrip = stdenv.hostPlatform != stdenv.buildPlatform;
+
+  enableParallelBuilding = true;
+
+  meta = {
+    description = "The Boehm-Demers-Weiser conservative garbage collector for C and C++";
+
+    longDescription = ''
+      The Boehm-Demers-Weiser conservative garbage collector can be used as a
+      garbage collecting replacement for C malloc or C++ new.  It allows you
+      to allocate memory basically as you normally would, without explicitly
+      deallocating memory that is no longer useful.  The collector
+      automatically recycles memory when it determines that it can no longer
+      be otherwise accessed.
+
+      The collector is also used by a number of programming language
+      implementations that either use C as intermediate code, want to
+      facilitate easier interoperation with C libraries, or just prefer the
+      simple collector interface.
+
+      Alternatively, the garbage collector may be used as a leak detector for
+      C or C++ programs, though that is not its primary goal.
+    '';
+
+    homepage = http://hboehm.info/gc/;
+
+    # non-copyleft, X11-style license
+    license = http://hboehm.info/gc/license.txt;
+
+    maintainers = [ ];
+    platforms = stdenv.lib.platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/boehm-gc/default.nix b/nixpkgs/pkgs/development/libraries/boehm-gc/default.nix
new file mode 100644
index 000000000000..2618d35ff794
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/boehm-gc/default.nix
@@ -0,0 +1,76 @@
+{ lib, stdenv, fetchurl, fetchpatch, pkgconfig, libatomic_ops
+, enableLargeConfig ? false # doc: https://github.com/ivmai/bdwgc/blob/v7.6.6/doc/README.macros#L179
+}:
+
+stdenv.mkDerivation rec {
+  name = "boehm-gc-${version}";
+  version = "8.0.4";
+
+  src = fetchurl {
+    urls = [
+      "https://github.com/ivmai/bdwgc/releases/download/v${version}/gc-${version}.tar.gz"
+      "http://www.hboehm.info/gc/gc_source/gc-${version}.tar.gz"
+    ];
+    sha256 = "1798rp3mcfkgs38ynkbg2p47bq59pisrc6mn0l20pb5iczf0ssj3";
+  };
+
+  buildInputs = [ libatomic_ops ];
+  nativeBuildInputs = [ pkgconfig ];
+
+  outputs = [ "out" "dev" "doc" ];
+  separateDebugInfo = stdenv.isLinux;
+
+  preConfigure = stdenv.lib.optionalString (stdenv.hostPlatform.libc == "musl") ''
+    export NIX_CFLAGS_COMPILE+=" -D_GNU_SOURCE -DUSE_MMAP -DHAVE_DL_ITERATE_PHDR"
+  '';
+
+  patches =
+    # https://github.com/ivmai/bdwgc/pull/208
+    lib.optional stdenv.hostPlatform.isRiscV ./riscv.patch;
+
+  configureFlags =
+    [ "--enable-cplusplus" ]
+    ++ lib.optional enableLargeConfig "--enable-large-config"
+    ++ lib.optional (stdenv.hostPlatform.libc == "musl") "--disable-static"
+    # Configure script can't detect whether C11 atomic intrinsics are available
+    # when cross-compiling, so it links to libatomic_ops, which has to be
+    # propagated to all dependencies. To avoid this, assume that the intrinsics
+    # are available.
+    ++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) "--with-libatomic-ops=none";
+
+  doCheck = true; # not cross;
+
+  # Don't run the native `strip' when cross-compiling.
+  dontStrip = stdenv.hostPlatform != stdenv.buildPlatform;
+
+  enableParallelBuilding = true;
+
+  meta = {
+    description = "The Boehm-Demers-Weiser conservative garbage collector for C and C++";
+
+    longDescription = ''
+      The Boehm-Demers-Weiser conservative garbage collector can be used as a
+      garbage collecting replacement for C malloc or C++ new.  It allows you
+      to allocate memory basically as you normally would, without explicitly
+      deallocating memory that is no longer useful.  The collector
+      automatically recycles memory when it determines that it can no longer
+      be otherwise accessed.
+
+      The collector is also used by a number of programming language
+      implementations that either use C as intermediate code, want to
+      facilitate easier interoperation with C libraries, or just prefer the
+      simple collector interface.
+
+      Alternatively, the garbage collector may be used as a leak detector for
+      C or C++ programs, though that is not its primary goal.
+    '';
+
+    homepage = http://hboehm.info/gc/;
+
+    # non-copyleft, X11-style license
+    license = http://hboehm.info/gc/license.txt;
+
+    maintainers = [ ];
+    platforms = stdenv.lib.platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/boehm-gc/riscv.patch b/nixpkgs/pkgs/development/libraries/boehm-gc/riscv.patch
new file mode 100644
index 000000000000..249137d0a0dc
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/boehm-gc/riscv.patch
@@ -0,0 +1,53 @@
+diff --git a/include/private/gcconfig.h b/include/private/gcconfig.h
+index a8e55dd2..439cc88d 100644
+--- a/include/private/gcconfig.h
++++ b/include/private/gcconfig.h
+@@ -650,6 +650,15 @@
+ #   endif
+ #   define mach_type_known
+ # endif
++# if defined(__riscv) && defined(LINUX)
++#   if __riscv_xlen == 32
++#     define RISCV32
++#     define mach_type_known
++#   elif __riscv_xlen == 64
++#     define RISCV64
++#     define mach_type_known
++#   endif
++# endif
+ 
+ # if defined(SN_TARGET_PSP2)
+ #   define mach_type_known
+@@ -2970,6 +2979,32 @@
+ #   endif
+ # endif
+ 
++# ifdef RISCV32
++#   define CPP_WORDSZ 32
++#   define MACH_TYPE "RISC-V 32"
++#   define ALIGNMENT 4
++#   ifdef LINUX
++#     define OS_TYPE "LINUX"
++      extern int __data_start[];
++#     define DATASTART ((ptr_t)__data_start)
++#     define LINUX_STACKBOTTOM
++#     define DYNAMIC_LOADING
++#   endif
++# endif
++
++# ifdef RISCV64
++#   define CPP_WORDSZ 64
++#   define MACH_TYPE "RISC-V 64"
++#   define ALIGNMENT 8
++#   ifdef LINUX
++#     define OS_TYPE "LINUX"
++      extern int __data_start[];
++#     define DATASTART ((ptr_t)__data_start)
++#     define LINUX_STACKBOTTOM
++#     define DYNAMIC_LOADING
++#   endif
++# endif
++
+ #if defined(__GLIBC__) && !defined(DONT_USE_LIBC_PRIVATES)
+   /* Use glibc's stack-end marker. */
+ # define USE_LIBC_PRIVATES
diff --git a/nixpkgs/pkgs/development/libraries/boolstuff/default.nix b/nixpkgs/pkgs/development/libraries/boolstuff/default.nix
new file mode 100644
index 000000000000..9ec27d3e9ebc
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/boolstuff/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, fetchurl, pkgconfig }:
+
+let baseurl = "https://perso.b2b2c.ca/~sarrazip/dev"; in
+
+stdenv.mkDerivation rec {
+  name = "boolstuff-0.1.16";
+
+  src = fetchurl {
+    url = "${baseurl}/${name}.tar.gz";
+    sha256 = "10qynbyw723gz2vrvn4xk2var172kvhlz3l3l80qbdsfb3d12wn0";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+
+  meta = {
+    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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/boost-process/default.nix b/nixpkgs/pkgs/development/libraries/boost-process/default.nix
new file mode 100644
index 000000000000..b90006a5e979
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/boost-process/default.nix
@@ -0,0 +1,31 @@
+{ stdenv, fetchurl, unzip }:
+
+stdenv.mkDerivation {
+  name = "boost-process-0.5";
+
+  src = fetchurl {
+    url = "http://www.highscore.de/boost/process0.5/process.zip";
+    sha256 = "1v9y9pffb2b7p642kp9ic4z6kg42ziizmyvbgrqd1ci0i4gn0831";
+  };
+
+  buildInputs = [ unzip ];
+
+  unpackPhase = ''
+    mkdir $name
+    cd $name
+    unzip $src
+  '';
+
+  installPhase = ''
+    mkdir -p $out/include
+    cp -r boost $out/include
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = http://www.highscore.de/boost/process0.5/;
+    description = "Library to manage system processes";
+    license = licenses.boost;
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ abbradar ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/boost/1.55.nix b/nixpkgs/pkgs/development/libraries/boost/1.55.nix
new file mode 100644
index 000000000000..0a38f35af753
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/boost/1.55.nix
@@ -0,0 +1,12 @@
+{ callPackage, fetchurl, ... } @ args:
+
+callPackage ./generic.nix (args // rec {
+  version = "1.55.0";
+
+  patches = [ ./clang-math.patch ./clang-math-2.patch ./gcc-5.patch ];
+
+  src = fetchurl {
+    url = "mirror://sourceforge/boost/boost_1_55_0.tar.bz2";
+    sha256 = "0lkv5dzssbl5fmh2nkaszi8x9qbj80pr4acf9i26sj3rvlih1w7z";
+  };
+})
diff --git a/nixpkgs/pkgs/development/libraries/boost/1.59.nix b/nixpkgs/pkgs/development/libraries/boost/1.59.nix
new file mode 100644
index 000000000000..f4931dfe5474
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/boost/1.59.nix
@@ -0,0 +1,10 @@
+{ stdenv, callPackage, fetchurl, ... } @ args:
+
+callPackage ./generic.nix (args // rec {
+  version = "1.59.0";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/boost/boost_1_59_0.tar.bz2";
+    sha256 = "1jj1aai5rdmd72g90a3pd8sw9vi32zad46xv5av8fhnr48ir6ykj";
+  };
+})
diff --git a/nixpkgs/pkgs/development/libraries/boost/1.60.nix b/nixpkgs/pkgs/development/libraries/boost/1.60.nix
new file mode 100644
index 000000000000..b6d74234f799
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/boost/1.60.nix
@@ -0,0 +1,11 @@
+{ stdenv, callPackage, fetchurl, ... } @ args:
+
+callPackage ./generic.nix (args // rec {
+  version = "1.60.0";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/boost/boost_1_60_0.tar.bz2";
+    sha256 = "0fzx6dwqbrkd4bcd8pjv0fpapwmrxxwr8yx9g67lihlsk3zzysk8";
+  };
+
+})
diff --git a/nixpkgs/pkgs/development/libraries/boost/1.62.nix b/nixpkgs/pkgs/development/libraries/boost/1.62.nix
new file mode 100644
index 000000000000..871ef392c1ae
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/boost/1.62.nix
@@ -0,0 +1,12 @@
+{ stdenv, callPackage, fetchurl, ... } @ args:
+
+callPackage ./generic.nix (args // rec {
+  version = "1.62.0";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/boost/boost_1_62_0.tar.bz2";
+    # long-form SHA256 from www.boost.org
+    sha256 = "36c96b0f6155c98404091d8ceb48319a28279ca0333fba1ad8611eb90afb2ca0";
+  };
+
+})
diff --git a/nixpkgs/pkgs/development/libraries/boost/1.63.nix b/nixpkgs/pkgs/development/libraries/boost/1.63.nix
new file mode 100644
index 000000000000..c4749bc3ee41
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/boost/1.63.nix
@@ -0,0 +1,12 @@
+{ stdenv, callPackage, fetchurl, ... } @ args:
+
+callPackage ./generic.nix (args // rec {
+  version = "1.63.0";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/boost/boost_1_63_0.tar.bz2";
+    # SHA256 from http://www.boost.org/users/history/version_1_63_0.html
+    sha256 = "beae2529f759f6b3bf3f4969a19c2e9d6f0c503edcb2de4a61d1428519fcb3b0";
+  };
+
+})
diff --git a/nixpkgs/pkgs/development/libraries/boost/1.64.nix b/nixpkgs/pkgs/development/libraries/boost/1.64.nix
new file mode 100644
index 000000000000..1cf9bfa51f4b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/boost/1.64.nix
@@ -0,0 +1,12 @@
+{ stdenv, callPackage, fetchurl, ... } @ args:
+
+callPackage ./generic.nix (args // rec {
+  version = "1.64.0";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/boost/boost_1_64_0.tar.bz2";
+    # SHA256 from http://www.boost.org/users/history/version_1_64_0.html
+    sha256 = "7bcc5caace97baa948931d712ea5f37038dbb1c5d89b43ad4def4ed7cb683332";
+  };
+
+})
diff --git a/nixpkgs/pkgs/development/libraries/boost/1.65.nix b/nixpkgs/pkgs/development/libraries/boost/1.65.nix
new file mode 100644
index 000000000000..9837e1c69193
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/boost/1.65.nix
@@ -0,0 +1,12 @@
+{ stdenv, callPackage, fetchurl, ... } @ args:
+
+callPackage ./generic.nix (args // rec {
+  version = "1.65.1";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/boost/boost_1_65_1.tar.bz2";
+    # SHA256 from http://www.boost.org/users/history/version_1_65_1.html
+    sha256 = "9807a5d16566c57fd74fb522764e0b134a8bbe6b6e8967b83afefd30dcd3be81";
+  };
+
+})
diff --git a/nixpkgs/pkgs/development/libraries/boost/1.66.nix b/nixpkgs/pkgs/development/libraries/boost/1.66.nix
new file mode 100644
index 000000000000..b44c1a3823a9
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/boost/1.66.nix
@@ -0,0 +1,11 @@
+{ stdenv, callPackage, fetchurl, ... } @ args:
+
+callPackage ./generic.nix (args // rec {
+  version = "1.66.0";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/boost/boost_1_66_0.tar.bz2";
+    # SHA256 from http://www.boost.org/users/history/version_1_66_0.html
+    sha256 = "5721818253e6a0989583192f96782c4a98eb6204965316df9f5ad75819225ca9";
+  };
+})
diff --git a/nixpkgs/pkgs/development/libraries/boost/1.67.nix b/nixpkgs/pkgs/development/libraries/boost/1.67.nix
new file mode 100644
index 000000000000..406e63b9622b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/boost/1.67.nix
@@ -0,0 +1,39 @@
+{ stdenv, callPackage, fetchurl, fetchpatch, ... } @ args:
+
+callPackage ./generic.nix (args // rec {
+  version = "1.67.0";
+
+  patches = [
+    (fetchpatch {
+      url = "https://github.com/boostorg/lockfree/commit/12726cda009a855073b9bedbdce57b6ce7763da2.patch";
+      sha256 = "0x65nkwzv8fdacj8sw5njl3v63jj19dirrpklbwy6qpsncw7fc7h";
+      stripLen = 1;
+    })
+  ] ++ stdenv.lib.optionals stdenv.cc.isClang [
+    # Fixes https://github.com/boostorg/atomic/issues/15
+    (fetchpatch {
+      url = https://github.com/boostorg/atomic/commit/6e14ca24dab50ad4c1fa8c27c7dd6f1cb791b534.patch;
+      sha256 = "102g35ygvv8cxagp9651284xk4vybk93q2fm577y4mdxf5k46b7a";
+      stripLen = 1;
+    })
+
+    # Needed for the next patch
+    (fetchpatch {
+      url = https://github.com/boostorg/asio/commit/38cb19719748ad56b14d73ca1fff5828f36e5894.patch;
+      sha256 = "0cj9cxz9rfbsx8p8f5alxx00dq3r7g0vh23j68bbxbs9gq1arq2n";
+      stripLen = 1;
+    })
+    # Fixes https://github.com/boostorg/asio/pull/91
+    (fetchpatch {
+      url = https://github.com/boostorg/asio/commit/43874d5497414c67655d901e48c939ef01337edb.patch;
+      sha256 = "1c2ds164s2ygvpb4785p4ncv8ywbpm08cphirb99xp4mqvb693is";
+      stripLen = 1;
+    })
+  ];
+
+  src = fetchurl {
+    url = "mirror://sourceforge/boost/boost_1_67_0.tar.bz2";
+    # SHA256 from http://www.boost.org/users/history/version_1_66_0.html
+    sha256 = "2684c972994ee57fc5632e03bf044746f6eb45d4920c343937a465fd67a5adba";
+  };
+})
diff --git a/nixpkgs/pkgs/development/libraries/boost/1.68.nix b/nixpkgs/pkgs/development/libraries/boost/1.68.nix
new file mode 100644
index 000000000000..cd980439b710
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/boost/1.68.nix
@@ -0,0 +1,11 @@
+{ stdenv, callPackage, fetchurl, fetchpatch, ... } @ args:
+
+callPackage ./generic.nix (args // rec {
+  version = "1.68.0";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/boost/boost_1_68_0.tar.bz2";
+    # SHA256 from http://www.boost.org/users/history/version_1_68_0.html
+    sha256 = "7f6130bc3cf65f56a618888ce9d5ea704fa10b462be126ad053e80e553d6d8b7";
+  };
+})
diff --git a/nixpkgs/pkgs/development/libraries/boost/1.69.nix b/nixpkgs/pkgs/development/libraries/boost/1.69.nix
new file mode 100644
index 000000000000..959fa851fe22
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/boost/1.69.nix
@@ -0,0 +1,11 @@
+{ stdenv, callPackage, fetchurl, fetchpatch, ... } @ args:
+
+callPackage ./generic.nix (args // rec {
+  version = "1.69.0";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/boost/boost_1_69_0.tar.bz2";
+    # SHA256 from http://www.boost.org/users/history/version_1_69_0.html
+    sha256 = "8f32d4617390d1c2d16f26a27ab60d97807b35440d45891fa340fc2648b04406";
+  };
+})
diff --git a/nixpkgs/pkgs/development/libraries/boost/1.70.nix b/nixpkgs/pkgs/development/libraries/boost/1.70.nix
new file mode 100644
index 000000000000..5f7b39c1189e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/boost/1.70.nix
@@ -0,0 +1,11 @@
+{ stdenv, callPackage, fetchurl, fetchpatch, ... } @ args:
+
+callPackage ./generic.nix (args // rec {
+  version = "1.70.0";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/boost/boost_1_70_0.tar.bz2";
+    # SHA256 from http://www.boost.org/users/history/version_1_70_0.html
+    sha256 = "430ae8354789de4fd19ee52f3b1f739e1fba576f0aded0897c3c2bc00fb38778";
+  };
+})
diff --git a/nixpkgs/pkgs/development/libraries/boost/clang-math-2.patch b/nixpkgs/pkgs/development/libraries/boost/clang-math-2.patch
new file mode 100644
index 000000000000..f819e9bec623
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/boost/clang-math-2.patch
@@ -0,0 +1,45 @@
+From 6bb71fdd8f7cc346d90fb14beb38b7297fc1ffd9 Mon Sep 17 00:00:00 2001
+From: Andrey Semashev <andrey.semashev@gmail.com>
+Date: Sun, 26 Jan 2014 13:58:48 +0400
+Subject: [PATCH] Fixed incorrect initialization of 128-bit values, when no
+ native support for 128-bit integers is available.
+
+---
+ boost/atomic/detail/cas128strong.hpp | 10 +++++++---
+ 1 file changed, 7 insertions(+), 3 deletions(-)
+
+diff --git a/boost/atomic/detail/cas128strong.hpp b/boost/atomic/detail/cas128strong.hpp
+index 906c13e..dcb4d7d 100644
+--- a/boost/atomic/detail/cas128strong.hpp
++++ b/boost/atomic/detail/cas128strong.hpp
+@@ -196,15 +196,17 @@ class base_atomic<T, void, 16, Sign>
+ 
+ public:
+     BOOST_DEFAULTED_FUNCTION(base_atomic(void), {})
+-    explicit base_atomic(value_type const& v) BOOST_NOEXCEPT : v_(0)
++    explicit base_atomic(value_type const& v) BOOST_NOEXCEPT
+     {
++        memset(&v_, 0, sizeof(v_));
+         memcpy(&v_, &v, sizeof(value_type));
+     }
+ 
+     void
+     store(value_type const& value, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
+     {
+-        storage_type value_s = 0;
++        storage_type value_s;
++        memset(&value_s, 0, sizeof(value_s));
+         memcpy(&value_s, &value, sizeof(value_type));
+         platform_fence_before_store(order);
+         platform_store128(value_s, &v_);
+@@ -247,7 +249,9 @@ class base_atomic<T, void, 16, Sign>
+         memory_order success_order,
+         memory_order failure_order) volatile BOOST_NOEXCEPT
+     {
+-        storage_type expected_s = 0, desired_s = 0;
++        storage_type expected_s, desired_s;
++        memset(&expected_s, 0, sizeof(expected_s));
++        memset(&desired_s, 0, sizeof(desired_s));
+         memcpy(&expected_s, &expected, sizeof(value_type));
+         memcpy(&desired_s, &desired, sizeof(value_type));
+ 
diff --git a/nixpkgs/pkgs/development/libraries/boost/clang-math.patch b/nixpkgs/pkgs/development/libraries/boost/clang-math.patch
new file mode 100644
index 000000000000..aa3d76af28b2
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/boost/clang-math.patch
@@ -0,0 +1,65 @@
+From e4bde20f2eec0a51be14533871d2123bd2ab9cf3 Mon Sep 17 00:00:00 2001
+From: Andrey Semashev <andrey.semashev@gmail.com>
+Date: Fri, 28 Feb 2014 12:43:11 +0400
+Subject: [PATCH] More compilation fixes for the case when 128-bit integers are
+ not supported.
+
+---
+ boost/atomic/detail/gcc-atomic.hpp | 17 ++++++++++++-----
+ 1 file changed, 12 insertions(+), 5 deletions(-)
+
+diff --git a/boost/atomic/detail/gcc-atomic.hpp b/boost/atomic/detail/gcc-atomic.hpp
+index a130590..4af99a1 100644
+--- a/boost/atomic/detail/gcc-atomic.hpp
++++ b/boost/atomic/detail/gcc-atomic.hpp
+@@ -958,14 +958,16 @@ class base_atomic<T, void, 16, Sign>
+ 
+ public:
+     BOOST_DEFAULTED_FUNCTION(base_atomic(void), {})
+-    explicit base_atomic(value_type const& v) BOOST_NOEXCEPT : v_(0)
++    explicit base_atomic(value_type const& v) BOOST_NOEXCEPT
+     {
++        memset(&v_, 0, sizeof(v_));
+         memcpy(&v_, &v, sizeof(value_type));
+     }
+ 
+     void store(value_type const& v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
+     {
+-        storage_type tmp = 0;
++        storage_type tmp;
++        memset(&tmp, 0, sizeof(tmp));
+         memcpy(&tmp, &v, sizeof(value_type));
+         __atomic_store_n(&v_, tmp, atomics::detail::convert_memory_order_to_gcc(order));
+     }
+@@ -980,7 +982,8 @@ class base_atomic<T, void, 16, Sign>
+ 
+     value_type exchange(value_type const& v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
+     {
+-        storage_type tmp = 0;
++        storage_type tmp;
++        memset(&tmp, 0, sizeof(tmp));
+         memcpy(&tmp, &v, sizeof(value_type));
+         tmp = __atomic_exchange_n(&v_, tmp, atomics::detail::convert_memory_order_to_gcc(order));
+         value_type res;
+@@ -994,7 +997,9 @@ class base_atomic<T, void, 16, Sign>
+         memory_order success_order,
+         memory_order failure_order) volatile BOOST_NOEXCEPT
+     {
+-        storage_type expected_s = 0, desired_s = 0;
++        storage_type expected_s, desired_s;
++        memset(&expected_s, 0, sizeof(expected_s));
++        memset(&desired_s, 0, sizeof(desired_s));
+         memcpy(&expected_s, &expected, sizeof(value_type));
+         memcpy(&desired_s, &desired, sizeof(value_type));
+         const bool success = __atomic_compare_exchange_n(&v_, &expected_s, desired_s, false,
+@@ -1010,7 +1015,9 @@ class base_atomic<T, void, 16, Sign>
+         memory_order success_order,
+         memory_order failure_order) volatile BOOST_NOEXCEPT
+     {
+-        storage_type expected_s = 0, desired_s = 0;
++        storage_type expected_s, desired_s;
++        memset(&expected_s, 0, sizeof(expected_s));
++        memset(&desired_s, 0, sizeof(desired_s));
+         memcpy(&expected_s, &expected, sizeof(value_type));
+         memcpy(&desired_s, &desired, sizeof(value_type));
+         const bool success = __atomic_compare_exchange_n(&v_, &expected_s, desired_s, true,
diff --git a/nixpkgs/pkgs/development/libraries/boost/darwin-1.55-no-system-python.patch b/nixpkgs/pkgs/development/libraries/boost/darwin-1.55-no-system-python.patch
new file mode 100644
index 000000000000..f8163f6d2718
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/boost/darwin-1.55-no-system-python.patch
@@ -0,0 +1,45 @@
+diff --git a/tools/build/src/tools/python.jam b/tools/build/src/tools/python.jam
+index 273b28a..2d2031e 100644
+--- a/tools/build/v2/tools/python.jam
++++ b/tools/build/v2/tools/python.jam
+@@ -428,13 +428,7 @@ local rule windows-installed-pythons ( version ? )
+ 
+ local rule darwin-installed-pythons ( version ? )
+ {
+-    version ?= $(.version-countdown) ;
+-
+-    local prefix
+-      = [ GLOB /System/Library/Frameworks /Library/Frameworks
+-          : Python.framework ] ;
+-
+-    return $(prefix)/Versions/$(version)/bin/python ;
++    return ;
+ }
+ 
+ 
+@@ -890,25 +884,6 @@ local rule configure ( version ? : cmd-or-prefix ? : includes * : libraries ? :
+ 
+     # See if we can find a framework directory on darwin.
+     local framework-directory ;
+-    if $(target-os) = darwin
+-    {
+-        # Search upward for the framework directory.
+-        local framework-directory = $(libraries[-1]) ;
+-        while $(framework-directory:D=) && $(framework-directory:D=) != Python.framework
+-        {
+-            framework-directory = $(framework-directory:D) ;
+-        }
+-
+-        if $(framework-directory:D=) = Python.framework
+-        {
+-            debug-message framework directory is \"$(framework-directory)\" ;
+-        }
+-        else
+-        {
+-            debug-message "no framework directory found; using library path" ;
+-            framework-directory = ;
+-        }
+-    }
+ 
+     local dll-path = $(libraries) ;
+ 
diff --git a/nixpkgs/pkgs/development/libraries/boost/darwin-no-system-python.patch b/nixpkgs/pkgs/development/libraries/boost/darwin-no-system-python.patch
new file mode 100644
index 000000000000..73e0910336a1
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/boost/darwin-no-system-python.patch
@@ -0,0 +1,45 @@
+diff --git a/tools/build/src/tools/python.jam b/tools/build/src/tools/python.jam
+index 273b28a..2d2031e 100644
+--- a/tools/build/src/tools/python.jam
++++ b/tools/build/src/tools/python.jam
+@@ -428,13 +428,7 @@ local rule windows-installed-pythons ( version ? )
+ 
+ local rule darwin-installed-pythons ( version ? )
+ {
+-    version ?= $(.version-countdown) ;
+-
+-    local prefix
+-      = [ GLOB /System/Library/Frameworks /Library/Frameworks
+-          : Python.framework ] ;
+-
+-    return $(prefix)/Versions/$(version)/bin/python ;
++    return ;
+ }
+ 
+ 
+@@ -890,25 +884,6 @@ local rule configure ( version ? : cmd-or-prefix ? : includes * : libraries ? :
+ 
+     # See if we can find a framework directory on darwin.
+     local framework-directory ;
+-    if $(target-os) = darwin
+-    {
+-        # Search upward for the framework directory.
+-        local framework-directory = $(libraries[-1]) ;
+-        while $(framework-directory:D=) && $(framework-directory:D=) != Python.framework
+-        {
+-            framework-directory = $(framework-directory:D) ;
+-        }
+-
+-        if $(framework-directory:D=) = Python.framework
+-        {
+-            debug-message framework directory is \"$(framework-directory)\" ;
+-        }
+-        else
+-        {
+-            debug-message "no framework directory found; using library path" ;
+-            framework-directory = ;
+-        }
+-    }
+ 
+     local dll-path = $(libraries) ;
+ 
diff --git a/nixpkgs/pkgs/development/libraries/boost/gcc-5.patch b/nixpkgs/pkgs/development/libraries/boost/gcc-5.patch
new file mode 100644
index 000000000000..2b2713590ca7
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/boost/gcc-5.patch
@@ -0,0 +1,64 @@
+https://svn.boost.org/trac/boost/ticket/10125
+
+ boost/thread/pthread/once.hpp        | 6 +++---
+ boost/thread/pthread/once_atomic.hpp | 2 +-
+ boost/thread/win32/once.hpp          | 2 +-
+ 3 files changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/boost/thread/pthread/once.hpp b/boost/thread/pthread/once.hpp
+index ccfb051..0bef038 100644
+--- a/boost/thread/pthread/once.hpp
++++ b/boost/thread/pthread/once.hpp
+@@ -42,7 +42,7 @@ namespace boost
+   }
+ 
+ #ifdef BOOST_THREAD_PROVIDES_ONCE_CXX11
+-#ifndef BOOST_NO_CXX11_VARIADIC_TEMPLATES
++#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
+     template<typename Function, class ...ArgTypes>
+     inline void call_once(once_flag& flag, BOOST_THREAD_RV_REF(Function) f, BOOST_THREAD_RV_REF(ArgTypes)... args);
+ #else
+@@ -65,7 +65,7 @@ namespace boost
+   private:
+       volatile thread_detail::uintmax_atomic_t epoch;
+ 
+-#ifndef BOOST_NO_CXX11_VARIADIC_TEMPLATES
++#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
+       template<typename Function, class ...ArgTypes>
+       friend void call_once(once_flag& flag, BOOST_THREAD_RV_REF(Function) f, BOOST_THREAD_RV_REF(ArgTypes)... args);
+ #else
+@@ -118,7 +118,7 @@ namespace boost
+     // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2444.html
+ 
+ 
+-#ifndef BOOST_NO_CXX11_VARIADIC_TEMPLATES
++#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
+ 
+ 
+   template<typename Function, class ...ArgTypes>
+diff --git a/boost/thread/pthread/once_atomic.hpp b/boost/thread/pthread/once_atomic.hpp
+index 9e2f876..923f07b 100644
+--- a/boost/thread/pthread/once_atomic.hpp
++++ b/boost/thread/pthread/once_atomic.hpp
+@@ -115,7 +115,7 @@ namespace boost
+ #endif
+ 
+ 
+-#ifndef BOOST_NO_CXX11_VARIADIC_TEMPLATES
++#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
+ 
+   template<typename Function, class ...ArgTypes>
+   inline void call_once(once_flag& flag, BOOST_THREAD_RV_REF(Function) f, BOOST_THREAD_RV_REF(ArgTypes)... args)
+diff --git a/boost/thread/win32/once.hpp b/boost/thread/win32/once.hpp
+index cafcfd4..9b37b31 100644
+--- a/boost/thread/win32/once.hpp
++++ b/boost/thread/win32/once.hpp
+@@ -227,7 +227,7 @@ namespace boost
+         }
+     }
+ 
+-#ifndef BOOST_NO_CXX11_VARIADIC_TEMPLATES
++#if !defined BOOST_NO_CXX11_VARIADIC_TEMPLATES && !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
+ //#if defined(BOOST_THREAD_RVALUE_REFERENCES_DONT_MATCH_FUNTION_PTR)
+     inline void call_once(once_flag& flag, void (*f)())
+     {
diff --git a/nixpkgs/pkgs/development/libraries/boost/generic.nix b/nixpkgs/pkgs/development/libraries/boost/generic.nix
new file mode 100644
index 000000000000..90dd8ff1744f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/boost/generic.nix
@@ -0,0 +1,188 @@
+{ stdenv, fetchurl, icu, expat, zlib, bzip2, python, fixDarwinDylibNames, libiconv
+, which
+, buildPackages
+, toolset ? /**/ if stdenv.cc.isClang  then "clang"
+            else null
+, enableRelease ? true
+, enableDebug ? false
+, enableSingleThreaded ? false
+, enableMultiThreaded ? true
+, enableShared ? !(stdenv.hostPlatform.libc == "msvcrt") # problems for now
+, enableStatic ? !enableShared
+, enablePython ? false
+, enableNumpy ? false
+, taggedLayout ? ((enableRelease && enableDebug) || (enableSingleThreaded && enableMultiThreaded) || (enableShared && enableStatic))
+, patches ? []
+, mpi ? null
+
+# Attributes inherit from specific versions
+, version, src
+, ...
+}:
+
+# We must build at least one type of libraries
+assert enableShared || enableStatic;
+
+# Python isn't supported when cross-compiling
+assert enablePython -> stdenv.hostPlatform == stdenv.buildPlatform;
+assert enableNumpy -> enablePython;
+
+with stdenv.lib;
+let
+
+  variant = concatStringsSep ","
+    (optional enableRelease "release" ++
+     optional enableDebug "debug");
+
+  threading = concatStringsSep ","
+    (optional enableSingleThreaded "single" ++
+     optional enableMultiThreaded "multi");
+
+  link = concatStringsSep ","
+    (optional enableShared "shared" ++
+     optional enableStatic "static");
+
+  runtime-link = if enableShared then "shared" else "static";
+
+  # To avoid library name collisions
+  layout = if taggedLayout then "tagged" else "system";
+
+  # Versions of b2 before 1.65 have job limits; specifically:
+  #   - Versions before 1.58 support up to 64 jobs[0]
+  #   - Versions before 1.65 support up to 256 jobs[1]
+  #
+  # [0]: https://github.com/boostorg/build/commit/0ef40cb86728f1cd804830fef89a6d39153ff632
+  # [1]: https://github.com/boostorg/build/commit/316e26ca718afc65d6170029284521392524e4f8
+  jobs =
+    if versionOlder version "1.58" then
+      "$(($NIX_BUILD_CORES<=64 ? $NIX_BUILD_CORES : 64))"
+    else if versionOlder version "1.65" then
+      "$(($NIX_BUILD_CORES<=256 ? $NIX_BUILD_CORES : 256))"
+    else
+      "$NIX_BUILD_CORES";
+
+  b2Args = concatStringsSep " " ([
+    "--includedir=$dev/include"
+    "--libdir=$out/lib"
+    "-j${jobs}"
+    "--layout=${layout}"
+    "variant=${variant}"
+    "threading=${threading}"
+    "link=${link}"
+    "-sEXPAT_INCLUDE=${expat.dev}/include"
+    "-sEXPAT_LIBPATH=${expat.out}/lib"
+
+    # TODO: make this unconditional
+  ] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
+    "address-model=${toString stdenv.hostPlatform.parsed.cpu.bits}"
+    "architecture=${toString stdenv.hostPlatform.parsed.cpu.family}"
+    "binary-format=${toString stdenv.hostPlatform.parsed.kernel.execFormat.name}"
+    "target-os=${toString stdenv.hostPlatform.parsed.kernel.name}"
+
+    # adapted from table in boost manual
+    # https://www.boost.org/doc/libs/1_66_0/libs/context/doc/html/context/architectures.html
+    "abi=${if stdenv.hostPlatform.parsed.cpu.family == "arm" then "aapcs"
+           else if stdenv.hostPlatform.isWindows then "ms"
+           else if stdenv.hostPlatform.isMips then "o32"
+           else "sysv"}"
+  ] ++ optional (link != "static") "runtime-link=${runtime-link}"
+    ++ optional (variant == "release") "debug-symbols=off"
+    ++ optional (toolset != null) "toolset=${toolset}"
+    ++ optional (!enablePython) "--without-python"
+    ++ optional (mpi != null || stdenv.hostPlatform != stdenv.buildPlatform) "--user-config=user-config.jam"
+    ++ optionals (stdenv.hostPlatform.libc == "msvcrt") [
+    "threadapi=win32"
+  ]);
+
+in
+
+stdenv.mkDerivation {
+  pname = "boost";
+
+  inherit src version;
+
+  patchFlags = "";
+
+  patches = patches
+  ++ optional stdenv.isDarwin (
+    if version == "1.55.0"
+    then ./darwin-1.55-no-system-python.patch
+    else ./darwin-no-system-python.patch);
+
+  meta = {
+    homepage = http://boost.org/;
+    description = "Collection of C++ libraries";
+    license = licenses.boost;
+    platforms = platforms.unix ++ platforms.windows;
+    badPlatforms = optional (versionOlder version "1.59") "aarch64-linux"
+                 ++ optional ((versionOlder version "1.57") || version == "1.58") "x86_64-darwin";
+    maintainers = with maintainers; [ peti ];
+  };
+
+  preConfigure = ''
+    if test -f tools/build/src/tools/clang-darwin.jam ; then
+        substituteInPlace tools/build/src/tools/clang-darwin.jam \
+          --replace '@rpath/$(<[1]:D=)' "$out/lib/\$(<[1]:D=)";
+    fi;
+  '' + optionalString (mpi != null) ''
+    cat << EOF >> user-config.jam
+    using mpi : ${mpi}/bin/mpiCC ;
+    EOF
+  '' + optionalString (stdenv.hostPlatform != stdenv.buildPlatform) ''
+    cat << EOF >> user-config.jam
+    using gcc : cross : ${stdenv.cc.targetPrefix}c++ ;
+    EOF
+  '';
+
+  NIX_CFLAGS_LINK = stdenv.lib.optionalString stdenv.isDarwin
+                      "-headerpad_max_install_names";
+
+  enableParallelBuilding = true;
+
+  nativeBuildInputs = [ which ];
+  depsBuildBuild = [ buildPackages.stdenv.cc ];
+  buildInputs = [ expat zlib bzip2 libiconv ]
+    ++ optional (stdenv.hostPlatform == stdenv.buildPlatform) icu
+    ++ optional stdenv.isDarwin fixDarwinDylibNames
+    ++ optional enablePython python
+    ++ optional enableNumpy python.pkgs.numpy;
+
+  configureScript = "./bootstrap.sh";
+  configurePlatforms = [];
+  configureFlags = [
+    "--includedir=$(dev)/include"
+    "--libdir=$(out)/lib"
+  ] ++ optional enablePython "--with-python=${python.interpreter}"
+    ++ [ (if stdenv.hostPlatform == stdenv.buildPlatform then "--with-icu=${icu.dev}" else "--without-icu") ]
+    ++ optional (toolset != null) "--with-toolset=${toolset}";
+
+  buildPhase = ''
+    runHook preBuild
+    ./b2 ${b2Args}
+    runHook postBuild
+  '';
+
+  installPhase = ''
+    runHook preInstall
+
+    # boostbook is needed by some applications
+    mkdir -p $dev/share/boostbook
+    cp -a tools/boostbook/{xsl,dtd} $dev/share/boostbook/
+
+    # Let boost install everything else
+    ./b2 ${b2Args} install
+
+    runHook postInstall
+  '';
+
+  postFixup = ''
+    # Make boost header paths relative so that they are not runtime dependencies
+    cd "$dev" && find include \( -name '*.hpp' -or -name '*.h' -or -name '*.ipp' \) \
+      -exec sed '1s/^\xef\xbb\xbf//;1i#line 1 "{}"' -i '{}' \;
+  '' + optionalString (stdenv.hostPlatform.libc == "msvcrt") ''
+    $RANLIB "$out/lib/"*.a
+  '';
+
+  outputs = [ "out" "dev" ];
+  setOutputFlags = false;
+}
diff --git a/nixpkgs/pkgs/development/libraries/bootil/default.nix b/nixpkgs/pkgs/development/libraries/bootil/default.nix
new file mode 100644
index 000000000000..3c27281571af
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/bootil/default.nix
@@ -0,0 +1,45 @@
+{ stdenv, fetchFromGitHub, fetchpatch, premake4 }:
+
+stdenv.mkDerivation rec {
+  name = "bootil-unstable-2015-12-17";
+
+  meta = {
+    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;
+    # Build uses `-msse` and `-mfpmath=sse`
+    badPlatforms = [ "aarch64-linux" ];
+  };
+
+  src = fetchFromGitHub {
+    owner = "garrynewman";
+    repo = "bootil";
+    rev = "1d3e321fc2be359e2350205b8c7f1cad2164ee0b";
+    sha256 = "03wq526r80l2px797hd0n5m224a6jibwipcbsvps6l9h740xabzg";
+  };
+
+  patches = [ (fetchpatch {
+    url = https://github.com/garrynewman/bootil/pull/22.patch;
+    name = "github-pull-request-22.patch";
+    sha256 = "1qf8wkv00pb9w1aa0dl89c8gm4rmzkxfl7hidj4gz0wpy7a24qa2";
+  }) ];
+
+  # Avoid guessing where files end up. Just use current directory.
+  postPatch = ''
+    substituteInPlace projects/premake4.lua \
+      --replace 'location ( os.get() .. "/" .. _ACTION )' 'location ( ".." )'
+    substituteInPlace projects/bootil.lua \
+      --replace 'targetdir ( "../lib/" .. os.get() .. "/" .. _ACTION )' 'targetdir ( ".." )'
+  '';
+
+  nativeBuildInputs = [ premake4 ];
+  premakefile = "projects/premake4.lua";
+
+  installPhase = ''
+    install -D libbootil_static.a $out/lib/libbootil_static.a
+    cp -r include $out
+  '';
+}
diff --git a/nixpkgs/pkgs/development/libraries/boringssl/default.nix b/nixpkgs/pkgs/development/libraries/boringssl/default.nix
new file mode 100644
index 000000000000..ee62d5423a15
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/boringssl/default.nix
@@ -0,0 +1,39 @@
+{ stdenv, fetchgit, cmake, perl, go }:
+
+# reference: https://boringssl.googlesource.com/boringssl/+/2661/BUILDING.md
+stdenv.mkDerivation rec {
+  name = "boringssl-${version}";
+  version = "2017-02-23";
+
+  src = fetchgit {
+    url    = "https://boringssl.googlesource.com/boringssl";
+    rev    = "be2ee342d3781ddb954f91f8a7e660c6f59e87e5";
+    sha256 = "022zq7wlkhrg6al7drr3555lam3zw5bb10ylf9mznp83s854f975";
+  };
+
+  buildInputs = [ cmake perl go ];
+  enableParallelBuilding = true;
+  NIX_CFLAGS_COMPILE = "-Wno-error";
+
+  makeFlags = [ "GOCACHE=$(TMPDIR)/go-cache" ];
+
+  installPhase = ''
+    mkdir -p $out/bin $out/include $out/lib
+
+    mv tool/bssl $out/bin
+
+    mv ssl/libssl.a           $out/lib
+    mv crypto/libcrypto.a     $out/lib
+    mv decrepit/libdecrepit.a $out/lib
+
+    mv ../include/openssl $out/include
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Free TLS/SSL implementation";
+    homepage    = "https://boringssl.googlesource.com";
+    platforms   = platforms.all;
+    maintainers = [ maintainers.thoughtpolice ];
+    license = with licenses; [ openssl isc mit bsd3 ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/botan/2.0.nix b/nixpkgs/pkgs/development/libraries/botan/2.0.nix
new file mode 100644
index 000000000000..91f7f6647304
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/botan/2.0.nix
@@ -0,0 +1,10 @@
+{ callPackage, ... } @ args:
+
+callPackage ./generic.nix (args // {
+  baseVersion = "2.7";
+  revision = "0";
+  sha256 = "142aqabwc266jxn8wrp0f1ffrmcvdxwvyh8frb38hx9iaqazjbg4";
+  postPatch = ''
+    sed -e 's@lang_flags "@&--std=c++11 @' -i src/build-data/cc/{gcc,clang}.txt
+  '';
+})
diff --git a/nixpkgs/pkgs/development/libraries/botan/2.0.upstream b/nixpkgs/pkgs/development/libraries/botan/2.0.upstream
new file mode 100644
index 000000000000..74eb1a2ca83f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/botan/2.0.upstream
@@ -0,0 +1,10 @@
+url https://botan.randombit.net/
+version_link 'Botan-[0-9]+([.][0-9]+)*[.](tgz|tbz|tbz2|tar[.]bz2)$'
+ensure_version
+attribute_name botan2
+do_overwrite(){
+  ensure_hash
+  set_var_value sha256 $CURRENT_HASH
+  set_var_value baseVersion ${CURRENT_VERSION%.*}
+  set_var_value revision ${CURRENT_VERSION##*.}
+}
diff --git a/nixpkgs/pkgs/development/libraries/botan/default.nix b/nixpkgs/pkgs/development/libraries/botan/default.nix
new file mode 100644
index 000000000000..04652aa013aa
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/botan/default.nix
@@ -0,0 +1,11 @@
+{ callPackage, ... } @ args:
+
+callPackage ./generic.nix (args // {
+  baseVersion = "1.10";
+  revision = "17";
+  sha256 = "04rnha712dd3sdb2q7k2yw45sf405jyigk7yrjfr6bwd9fvgyiv8";
+  extraConfigureFlags = "--with-gnump";
+  postPatch = ''
+    sed -e 's@lang_flags "@&--std=c++11 @' -i src/build-data/cc/{gcc,clang}.txt
+  '';
+})
diff --git a/nixpkgs/pkgs/development/libraries/botan/default.upstream b/nixpkgs/pkgs/development/libraries/botan/default.upstream
new file mode 100644
index 000000000000..43f6a3b268ee
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/botan/default.upstream
@@ -0,0 +1,9 @@
+url http://botan.randombit.net/download.html
+version_link 'Botan-[0-9]+[.][0-9]*[02468]([.][0-9]+)?[.](tgz|tbz|tbz2|tar[.]bz2)$'
+ensure_version
+do_overwrite(){
+  ensure_hash
+  set_var_value sha256 $CURRENT_HASH
+  set_var_value baseVersion ${CURRENT_VERSION%.*}
+  set_var_value revision ${CURRENT_VERSION##*.}
+}
diff --git a/nixpkgs/pkgs/development/libraries/botan/generic.nix b/nixpkgs/pkgs/development/libraries/botan/generic.nix
new file mode 100644
index 000000000000..2580b959bf2a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/botan/generic.nix
@@ -0,0 +1,52 @@
+{ stdenv, fetchurl, python, bzip2, zlib, gmp, openssl, boost
+# Passed by version specific builders
+, baseVersion, revision, sha256
+, extraConfigureFlags ? ""
+, postPatch ? null
+, darwin
+, ...
+}:
+
+stdenv.mkDerivation rec {
+  name = "botan-${version}";
+  version = "${baseVersion}.${revision}";
+
+  src = fetchurl {
+    name = "Botan-${version}.tgz";
+    urls = [
+       "http://files.randombit.net/botan/v${baseVersion}/Botan-${version}.tgz"
+       "http://botan.randombit.net/releases/Botan-${version}.tgz"
+    ];
+    inherit sha256;
+  };
+  inherit postPatch;
+
+  buildInputs = [ python bzip2 zlib gmp openssl boost ]
+             ++ stdenv.lib.optional stdenv.isDarwin darwin.apple_sdk.frameworks.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 "" }
+  '';
+
+  enableParallelBuilding = true;
+
+  preInstall = ''
+    if [ -d src/scripts ]; then
+      patchShebangs src/scripts
+    fi
+  '';
+
+  postInstall = ''
+    cd "$out"/lib/pkgconfig
+    ln -s botan-*.pc botan.pc || true
+  '';
+
+  meta = with stdenv.lib; {
+    inherit version;
+    description = "Cryptographic algorithms library";
+    maintainers = with maintainers; [ raskin ];
+    platforms = ["x86_64-linux" "i686-linux" "x86_64-darwin"];
+    license = licenses.bsd2;
+  };
+  passthru.updateInfo.downloadPage = "http://files.randombit.net/botan/";
+}
diff --git a/nixpkgs/pkgs/development/libraries/box2d/default.nix b/nixpkgs/pkgs/development/libraries/box2d/default.nix
new file mode 100644
index 000000000000..102e7bfcc12b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/box2d/default.nix
@@ -0,0 +1,38 @@
+{ stdenv, fetchurl, unzip, cmake, libGLU_combined, freeglut, libX11, xorgproto
+, libXi, pkgconfig }:
+
+stdenv.mkDerivation rec {
+  name = "box2d-${version}";
+  version = "2.3.1";
+
+  src = fetchurl {
+    url = "https://github.com/erincatto/Box2D/archive/v${version}.tar.gz";
+    sha256 = "0llpcifl8zbjbpxdwz87drd01m3lwnv82xb4av6kca1xn4w2gmkm";
+  };
+
+  sourceRoot = "Box2D-${version}/Box2D";
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [
+    unzip cmake libGLU_combined freeglut libX11 xorgproto libXi
+  ];
+
+  cmakeFlags = [
+    "-DBOX2D_INSTALL=ON"
+    "-DBOX2D_BUILD_SHARED=ON"
+    "-DBOX2D_BUILD_EXAMPLES=OFF"
+  ];
+
+  prePatch = ''
+    substituteInPlace Box2D/Common/b2Settings.h \
+      --replace 'b2_maxPolygonVertices	8' 'b2_maxPolygonVertices	15'
+  '';
+
+  meta = with stdenv.lib; {
+    description = "2D physics engine";
+    homepage = http://box2d.org/;
+    maintainers = [ maintainers.raskin ];
+    platforms = platforms.linux;
+    license = licenses.zlib;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/brigand/default.nix b/nixpkgs/pkgs/development/libraries/brigand/default.nix
new file mode 100644
index 000000000000..b4a57396cc8b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/brigand/default.nix
@@ -0,0 +1,26 @@
+{ stdenv, fetchFromGitHub, cmake }:
+
+stdenv.mkDerivation rec {
+  name = "brigand-${version}";
+  version = "1.3.0";
+
+  src = fetchFromGitHub {
+    owner = "edouarda";
+    repo = "brigand";
+    rev = "4db9f665b4ece31b51aaf35b499b2c8e5811efa3";
+    sha256 = "14b8r3s24zq0l3addy3irzxs5cyqn3763y5s310lmzzswgj1v7r4";
+  };
+
+  nativeBuildInputs = [ cmake ];
+
+  meta = with stdenv.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.
+      Everything you were doing with Boost.MPL can be done with Brigand. And if that's not the case, open an issue!'';
+    homepage = https://github.com/edouarda/brigand;
+    license = licenses.boost;
+    maintainers = with maintainers; [ pmiddend ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/buddy/default.nix b/nixpkgs/pkgs/development/libraries/buddy/default.nix
new file mode 100644
index 000000000000..fb25b0a58108
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/buddy/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchurl, bison }:
+
+stdenv.mkDerivation rec {
+  name = "buddy-2.4";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/buddy/${name}.tar.gz";
+    sha256 = "0dl86l9xkl33wnkz684xa9axhcxx2zzi4q5lii0axnb9lsk81pyk";
+  };
+
+  buildInputs = [ bison ];
+  patches = [ ./gcc-4.3.3-fixes.patch ];
+  configureFlags = [ "CFLAGS=-O3" "CXXFLAGS=-O3" ];
+  NIX_LDFLAGS = [
+    "-lm"
+  ];
+  doCheck = true;
+
+  meta = {
+    homepage = https://sourceforge.net/projects/buddy/;
+    description = "Binary decision diagram package";
+    license = "as-is";
+
+    platforms = stdenv.lib.platforms.unix; # Once had cygwin problems
+    maintainers = [ stdenv.lib.maintainers.peti ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/buddy/gcc-4.3.3-fixes.patch b/nixpkgs/pkgs/development/libraries/buddy/gcc-4.3.3-fixes.patch
new file mode 100644
index 000000000000..2e7efd1c4666
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/buddy/gcc-4.3.3-fixes.patch
@@ -0,0 +1,22 @@
+diff -uwr buddy-2.4.orig/examples/bddcalc/parser.yxx buddy-2.4/examples/bddcalc/parser.yxx
+--- buddy-2.4.orig/examples/bddcalc/parser.yxx	2009-07-02 17:12:48.000000000 +0200
++++ buddy-2.4/examples/bddcalc/parser.yxx	2009-07-02 17:18:36.000000000 +0200
+@@ -7,6 +7,7 @@
+
+ %{
+ #include <string>
++#include <cstdlib>
+ #include <stdarg.h>
+ #include <fstream>
+ #include <getopt.h>
+diff -uwr buddy-2.4.orig/src/bddtest.cxx buddy-2.4/src/bddtest.cxx
+--- buddy-2.4.orig/src/bddtest.cxx	2009-07-02 17:12:48.000000000 +0200
++++ buddy-2.4/src/bddtest.cxx	2009-07-02 17:14:05.000000000 +0200
+@@ -28,6 +28,7 @@
+ ========================================================================*/
+
+ #include <string>
++#include <cstdlib>
+ #include "bdd.h"
+ #include "bvec.h"
+
diff --git a/nixpkgs/pkgs/development/libraries/bullet/default.nix b/nixpkgs/pkgs/development/libraries/bullet/default.nix
new file mode 100644
index 000000000000..b4a2133f7d8f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/bullet/default.nix
@@ -0,0 +1,56 @@
+{ stdenv, fetchFromGitHub, cmake, libGLU_combined, freeglut
+, Cocoa,  OpenGL
+}:
+
+stdenv.mkDerivation rec {
+  name = "bullet-${version}";
+  version = "2.87";
+
+  src = fetchFromGitHub {
+    owner = "bulletphysics";
+    repo = "bullet3";
+    rev = version;
+    sha256 = "1msp7w3563vb43w70myjmqsdb97kna54dcfa7yvi9l3bvamb92w3";
+  };
+
+  nativeBuildInputs = [ cmake ];
+  buildInputs = stdenv.lib.optionals stdenv.isLinux [ libGLU_combined freeglut ]
+    ++ stdenv.lib.optionals stdenv.isDarwin [ Cocoa OpenGL ];
+
+  patches = [ ./gwen-narrowing.patch ];
+
+  postPatch = stdenv.lib.optionalString stdenv.isDarwin ''
+    sed -i 's/FIND_PACKAGE(OpenGL)//' CMakeLists.txt
+    sed -i 's/FIND_LIBRARY(COCOA_LIBRARY Cocoa)//' CMakeLists.txt
+  '';
+
+  cmakeFlags = [
+    "-DBUILD_SHARED_LIBS=ON"
+    "-DBUILD_CPU_DEMOS=OFF"
+    "-DINSTALL_EXTRA_LIBS=ON"
+  ] ++ stdenv.lib.optionals stdenv.isDarwin [
+    "-DOPENGL_FOUND=true"
+    "-DOPENGL_LIBRARIES=${OpenGL}/Library/Frameworks/OpenGL.framework"
+    "-DOPENGL_INCLUDE_DIR=${OpenGL}/Library/Frameworks/OpenGL.framework"
+    "-DOPENGL_gl_LIBRARY=${OpenGL}/Library/Frameworks/OpenGL.framework"
+    "-DCOCOA_LIBRARY=${Cocoa}/Library/Frameworks/Cocoa.framework"
+    "-DBUILD_BULLET2_DEMOS=OFF"
+    "-DBUILD_UNIT_TESTS=OFF"
+  ];
+
+  enableParallelBuilding = true;
+
+  NIX_CFLAGS_COMPILE = stdenv.lib.optionalString stdenv.cc.isClang "-Wno-error=argument-outside-range";
+
+  meta = with stdenv.lib; {
+    description = "A professional free 3D Game Multiphysics Library";
+    longDescription = ''
+      Bullet 3D Game Multiphysics Library provides state of the art collision
+      detection, soft body and rigid body dynamics.
+    '';
+    homepage = http://bulletphysics.org;
+    license = licenses.zlib;
+    maintainers = with maintainers; [ aforemny ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/bullet/gwen-narrowing.patch b/nixpkgs/pkgs/development/libraries/bullet/gwen-narrowing.patch
new file mode 100644
index 000000000000..c6c06325dae0
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/bullet/gwen-narrowing.patch
@@ -0,0 +1,22 @@
+commit a5d3497577c78b03c05c69d17df972fa9fb54f53
+Author: Linus Heckemann <git@sphalerite.org>
+Date:   Fri Jan 5 23:57:09 2018 +0100
+
+    Add -Wno-narrowing to GWEN's CMakeLists
+    
+    This avoids the compilation issue that occurs on aarch64 with gcc6.
+    (nixpkgs-specific patch)
+
+diff --git a/examples/ThirdPartyLibs/Gwen/CMakeLists.txt b/examples/ThirdPartyLibs/Gwen/CMakeLists.txt
+index 82fa0ffba..26c4bbd37 100644
+--- a/examples/ThirdPartyLibs/Gwen/CMakeLists.txt
++++ b/examples/ThirdPartyLibs/Gwen/CMakeLists.txt
+@@ -15,7 +15,7 @@ IF(NOT WIN32 AND NOT APPLE)
+         ADD_DEFINITIONS("-DDYNAMIC_LOAD_X11_FUNCTIONS=1")
+ ENDIF()
+ 
+-ADD_DEFINITIONS( -DGLEW_STATIC -DGWEN_COMPILE_STATIC -D_HAS_EXCEPTIONS=0 -D_STATIC_CPPLIB )
++ADD_DEFINITIONS( -DGLEW_STATIC -DGWEN_COMPILE_STATIC -D_HAS_EXCEPTIONS=0 -D_STATIC_CPPLIB -Wno-narrowing )
+ 
+ FILE(GLOB gwen_SRCS "*.cpp" "Controls/*.cpp" "Controls/Dialog/*.cpp" "Controls/Dialogs/*.cpp" "Controls/Layout/*.cpp" "Controls/Property/*.cpp" "Input/*.cpp" "Platforms/*.cpp" "Renderers/*.cpp" "Skins/*.cpp")
+ FILE(GLOB gwen_HDRS "*.h" "Controls/*.h" "Controls/Dialog/*.h" "Controls/Dialogs/*.h" "Controls/Layout/*.h" "Controls/Property/*.h" "Input/*.h" "Platforms/*.h" "Renderers/*.h" "Skins/*.h")
diff --git a/nixpkgs/pkgs/development/libraries/bullet/roboschool-fork.nix b/nixpkgs/pkgs/development/libraries/bullet/roboschool-fork.nix
new file mode 100644
index 000000000000..12fc1834e905
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/bullet/roboschool-fork.nix
@@ -0,0 +1,57 @@
+{ stdenv, fetchFromGitHub, cmake, libGLU_combined, freeglut
+, Cocoa,  OpenGL
+}:
+
+stdenv.mkDerivation rec {
+  name = "bullet-${version}";
+  version = "2019-03-27";
+
+  src = fetchFromGitHub {
+    owner = "olegklimov";
+    repo = "bullet3";
+    # roboschool needs the HEAD of a specific branch of this fork, see
+    # https://github.com/openai/roboschool/issues/126#issuecomment-421643980
+    # https://github.com/openai/roboschool/pull/62
+    # https://github.com/openai/roboschool/issues/124
+    rev = "3687507ddc04a15de2c5db1e349ada3f2b34b3d6";
+    sha256 = "1wd7vj9136dl7lfb8ll0rc2fdl723y3ls9ipp7657yfl2xrqhvkb";
+  };
+
+  nativeBuildInputs = [ cmake ];
+  buildInputs = stdenv.lib.optionals stdenv.isLinux [ libGLU_combined freeglut ]
+    ++ stdenv.lib.optionals stdenv.isDarwin [ Cocoa OpenGL ];
+
+  patches = [ ./gwen-narrowing.patch ];
+
+  postPatch = stdenv.lib.optionalString stdenv.isDarwin ''
+    sed -i 's/FIND_PACKAGE(OpenGL)//' CMakeLists.txt
+    sed -i 's/FIND_LIBRARY(COCOA_LIBRARY Cocoa)//' CMakeLists.txt
+  '';
+
+  cmakeFlags = [
+    "-DBUILD_SHARED_LIBS=ON"
+    "-DBUILD_CPU_DEMOS=OFF"
+    "-DINSTALL_EXTRA_LIBS=ON"
+  ] ++ stdenv.lib.optionals stdenv.isDarwin [
+    "-DOPENGL_FOUND=true"
+    "-DOPENGL_LIBRARIES=${OpenGL}/Library/Frameworks/OpenGL.framework"
+    "-DOPENGL_INCLUDE_DIR=${OpenGL}/Library/Frameworks/OpenGL.framework"
+    "-DOPENGL_gl_LIBRARY=${OpenGL}/Library/Frameworks/OpenGL.framework"
+    "-DCOCOA_LIBRARY=${Cocoa}/Library/Frameworks/Cocoa.framework"
+    "-DBUILD_BULLET2_DEMOS=OFF"
+    "-DBUILD_UNIT_TESTS=OFF"
+  ];
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    description = "A professional free 3D Game Multiphysics Library";
+    longDescription = ''
+      Bullet 3D Game Multiphysics Library provides state of the art collision
+      detection, soft body and rigid body dynamics.
+    '';
+    homepage = http://bulletphysics.org;
+    license = licenses.zlib;
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/bulletml/default.nix b/nixpkgs/pkgs/development/libraries/bulletml/default.nix
new file mode 100644
index 000000000000..b61ac1dcb09f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/bulletml/default.nix
@@ -0,0 +1,73 @@
+{ stdenv, fetchpatch, fetchurl, bison, perl }:
+
+let
+  version = "0.0.6";
+  debianRevision = "7";
+  debianPatch = patchname: hash: fetchpatch {
+    name = "${patchname}.patch";
+    url = "https://sources.debian.org/data/main/b/bulletml/${version}-${debianRevision}/debian/patches/${patchname}.patch";
+    sha256 = hash;
+  };
+
+in stdenv.mkDerivation {
+  name = "bulletml-${version}";
+
+  srcs = [
+    (fetchurl {
+      url = "http://shinh.skr.jp/libbulletml/libbulletml-${version}.tar.bz2";
+      sha256 = "0yda0zgj2ydgkmby5676f5iiawabxadzh5p7bmy42998sp9g6dvw";
+    })
+    (fetchurl {
+      url = "http://shinh.skr.jp/d/d_cpp.tar.bz2";
+      sha256 = "1ly9qmbb8q9nyadmdap1gmxs3vkniqgchlv2hw7riansz4gg1agh";
+    })
+  ];
+  sourceRoot = "bulletml";
+  postUnpack = "mv d_cpp bulletml/";
+
+  patches = [
+    (debianPatch "fixes" "0cnr968n0h50fjmjijx7idsa2pg2pv5cwy6nvfbkx9z8w2zf0mkl")
+    (debianPatch "bulletml_d" "03d1dgln3gkiw019pxn3gwgjkmvzisq8kp3n6fpn38yfwh4fp4hv")
+    (debianPatch "d_cpp" "04g9c7c89w7cgrxw75mcbdhzxqmz1716li49mhl98znakchrlb9h")
+    (debianPatch "warnings" "18px79x4drvm6dy6w6js53nzlyvha7qaxhz5a99b97pyk3qc7i9g")
+    (debianPatch "makefile" "0z6yxanxmarx0s08gh12pk2wfqjk8g797wmfcqczdv1i6xc7nqzp")
+    (debianPatch "includes" "1n11j5695hs9pspslf748w2cq5d78s6bwhyl476wp6gcq6jw20bw")
+  ];
+
+  makeFlags = [
+    "-C src"
+  ];
+  nativeBuildInputs = [ bison perl ];
+  hardeningDisable = [ "format" ];
+
+  installPhase = ''
+    install -D -m 644 src/bulletml.d "$out"/include/d/bulletml.d
+    install -d "$out"/include/bulletml/tinyxml
+    install -m 644 src/*.h "$out"/include/bulletml
+    install -m 644 src/tinyxml/tinyxml.h "$out"/include/bulletml/tinyxml
+    cp -r src/boost $out/include/boost
+
+    install -d "$out"/lib
+    install -m 644 src/libbulletml.{a,so}* "$out"/lib
+
+    install -D -m 644 README "$out"/share/doc/libbulletml/README.jp
+    install -m 644 README.en "$out"/share/doc/libbulletml
+    install -m 644 README.bulletml "$out"/share/doc/libbulletml
+    install -D -m 644 README "$out"/share/licenses/libbulletml/README.jp
+    install -m 644 README.en "$out"/share/licenses/libbulletml
+  '';
+
+  meta = with stdenv.lib; {
+    description = "C++ library to handle BulletML easily";
+    longDescription = ''
+      BulletML is the Bullet Markup Language. BulletML can describe the barrage
+      of bullets in shooting games.
+    '';
+    homepage = "http://www.asahi-net.or.jp/~cs8k-cyu/bulletml/index_e.html";
+    license = licenses.bsd3;
+    maintainers = with maintainers; [ fgaz ];
+    # See https://github.com/NixOS/nixpkgs/pull/35482
+    # for some attempts in getting it to build on darwin
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/bwidget/default.nix b/nixpkgs/pkgs/development/libraries/bwidget/default.nix
new file mode 100644
index 000000000000..1e2bda285a70
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/bwidget/default.nix
@@ -0,0 +1,31 @@
+{ stdenv, fetchurl, tcl }:
+
+stdenv.mkDerivation rec {
+  name = "bwidget-${version}";
+  version = "1.9.13";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/tcllib/bwidget-${version}.tar.gz";
+    sha256 = "109s81hzd86vwzs18v4s03asn3l395wl64kd311045p7h0ig9n3n";
+  };
+
+  dontBuild = true;
+
+  installPhase = ''
+    mkdir -p "$out/lib/${passthru.libPrefix}"
+    cp -R *.tcl lang images "$out/lib/${passthru.libPrefix}"
+  '';
+
+  passthru = {
+    libPrefix = "bwidget${version}";
+  };
+
+  buildInputs = [ tcl ];
+
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/bzrtp/default.nix b/nixpkgs/pkgs/development/libraries/bzrtp/default.nix
new file mode 100644
index 000000000000..11b94a0181a1
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/bzrtp/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, cmake, fetchFromGitHub, bctoolbox, sqlite }:
+
+stdenv.mkDerivation rec {
+  baseName = "bzrtp";
+  version = "1.0.6";
+  name = "${baseName}-${version}";
+
+  src = fetchFromGitHub {
+    owner = "BelledonneCommunications";
+    repo = "${baseName}";
+    rev = "${version}";
+    sha256 = "0438zzxp82bj5fmvqnwlljkgrz9ab5qm5lgpwwgmg1cp78bp2l45";
+  };
+
+  buildInputs = [ bctoolbox sqlite ];
+  nativeBuildInputs = [ cmake ];
+
+  meta = with stdenv.lib; {
+    description = "BZRTP is an opensource implementation of ZRTP keys exchange protocol";
+    homepage = https://github.com/BelledonneCommunications/bzrtp;
+    license = licenses.lgpl21;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/c-ares/default.nix b/nixpkgs/pkgs/development/libraries/c-ares/default.nix
new file mode 100644
index 000000000000..9e38398dfad1
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/c-ares/default.nix
@@ -0,0 +1,42 @@
+{ stdenv, fetchurl, writeTextDir }:
+
+let self =
+stdenv.mkDerivation rec {
+  name = "c-ares-1.15.0";
+
+  src = fetchurl {
+    url = "https://c-ares.haxx.se/download/${name}.tar.gz";
+    sha256 = "0lk8knip4xk6qzksdkn7085mmgm4ixfczdyyjw656c193y3rgnvc";
+  };
+
+  meta = with stdenv.lib; {
+    description = "A C library for asynchronous DNS requests";
+    homepage = https://c-ares.haxx.se;
+    license = licenses.mit;
+    platforms = platforms.all;
+  };
+
+  # Adapted from running a cmake build
+  passthru.cmake-config = writeTextDir "c-ares-config.cmake"
+    ''
+      set(c-ares_INCLUDE_DIR "${self}/include")
+
+      set(c-ares_LIBRARY c-ares::cares)
+
+      add_library(c-ares::cares SHARED IMPORTED)
+
+      set_target_properties(c-ares::cares PROPERTIES
+        INTERFACE_INCLUDE_DIRECTORIES "${self}/include"
+        ${stdenv.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
+        IMPORTED_LOCATION_RELEASE "${self}/lib/libcares${stdenv.targetPlatform.extensions.sharedLibrary}"
+        IMPORTED_SONAME_RELEASE "libcares${stdenv.targetPlatform.extensions.sharedLibrary}"
+        )
+      add_library(c-ares::cares_shared INTERFACE IMPORTED)
+      set_target_properties(c-ares::cares_shared PROPERTIES INTERFACE_LINK_LIBRARIES "c-ares::cares")
+      set(c-ares_SHARED_LIBRARY c-ares::cares_shared)
+    '';
+
+}; in self
diff --git a/nixpkgs/pkgs/development/libraries/c-blosc/default.nix b/nixpkgs/pkgs/development/libraries/c-blosc/default.nix
new file mode 100644
index 000000000000..3603667fbf21
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/c-blosc/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchFromGitHub, cmake }:
+
+stdenv.mkDerivation rec {
+  name = "c-blosc-${version}";
+  version = "1.16.3";
+
+  src = fetchFromGitHub {
+    owner = "Blosc";
+    repo = "c-blosc";
+    rev = "v${version}";
+    sha256 = "1c58wkf34rp5wh9qp09zdk7zcfn037sk56p4xq1g0vapbnglv603";
+  };
+
+  buildInputs = [ cmake ];
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    description = "A blocking, shuffling and loss-less compression library";
+    homepage = http://www.blosc.org;
+    license = licenses.bsd3;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/caf/default.nix b/nixpkgs/pkgs/development/libraries/caf/default.nix
new file mode 100644
index 000000000000..15744744067c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/caf/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchFromGitHub, cmake }:
+
+stdenv.mkDerivation rec {
+  name = "actor-framework-${version}";
+  version = "0.16.3";
+
+  src = fetchFromGitHub {
+    owner = "actor-framework";
+    repo = "actor-framework";
+    rev = "${version}";
+    sha256 = "0nqw1cv7wxbcn2qwm08qffb6k4n3kgvdiaphks5gjgm305jk4vnx";
+  };
+
+  nativeBuildInputs = [ cmake ];
+
+  meta = with stdenv.lib; {
+    description = "An open source implementation of the actor model in C++";
+    homepage = http://actor-framework.org/;
+    license = licenses.bsd3;
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ bobakker ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/cairo/0001-test-don-t-always-build-FreeType-dependent-test.patch b/nixpkgs/pkgs/development/libraries/cairo/0001-test-don-t-always-build-FreeType-dependent-test.patch
new file mode 100644
index 000000000000..9688aca55ab9
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/cairo/0001-test-don-t-always-build-FreeType-dependent-test.patch
@@ -0,0 +1,34 @@
+From 3910b1155f2d5a98142ade67e09f097cb94a2d2e Mon Sep 17 00:00:00 2001
+From: Alyssa Ross <hi@alyssa.is>
+Date: Mon, 22 Apr 2019 09:53:54 +0000
+Subject: [PATCH 1/5] test: don't always build FreeType-dependent test
+
+This caused a build failure when attempting to build cairo without
+FreeType available on the system.
+---
+ test/Makefile.sources | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/test/Makefile.sources b/test/Makefile.sources
+index c47131faf..cc3d81f7e 100644
+--- a/test/Makefile.sources
++++ b/test/Makefile.sources
+@@ -144,7 +144,6 @@ test_sources = \
+ 	font-face-get-type.c				\
+ 	font-matrix-translation.c			\
+ 	font-options.c					\
+-	font-variations.c				\
+ 	glyph-cache-pressure.c				\
+ 	get-and-set.c					\
+ 	get-clip.c					\
+@@ -399,6 +398,7 @@ pthread_test_sources =					\
+ 
+ ft_font_test_sources = \
+ 	bitmap-font.c \
++	font-variations.c \
+ 	ft-font-create-for-ft-face.c \
+ 	ft-show-glyphs-positioning.c \
+ 	ft-show-glyphs-table.c \
+-- 
+2.19.2
+
diff --git a/nixpkgs/pkgs/development/libraries/cairo/0002-gl-don-t-implicitly-include-X11-headers.patch b/nixpkgs/pkgs/development/libraries/cairo/0002-gl-don-t-implicitly-include-X11-headers.patch
new file mode 100644
index 000000000000..c34e93ae676a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/cairo/0002-gl-don-t-implicitly-include-X11-headers.patch
@@ -0,0 +1,40 @@
+From ec6ee0e09e2d59455241081af66fb3ba02def7e4 Mon Sep 17 00:00:00 2001
+From: Alyssa Ross <hi@alyssa.is>
+Date: Mon, 22 Apr 2019 10:41:27 +0000
+Subject: [PATCH 2/5] gl: don't implicitly include X11 headers
+
+EGL/egl.h on my system includes X11 headers by default, which breaks
+compilation when they aren't available, even though Cairo doesn't need
+them.
+
+Fortunately, this only happens if MESA_EGL_NO_X11_HEADERS is not
+defined, so defining that allows Cairo to be built with GL enabled even
+when X11 isn't available.
+
+Only when the Xlib surface is enabled are the headers guaranteed to be
+available. In that case, MESA_EGL_NO_X11_HEADERS should not be defined,
+to preserve compatibility with users expecting Cairo to include these
+headers. (There are tests that make this assumption.)
+---
+ src/cairo-gl.h | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/src/cairo-gl.h b/src/cairo-gl.h
+index 7cd869c76..a95b07bc3 100644
+--- a/src/cairo-gl.h
++++ b/src/cairo-gl.h
+@@ -127,6 +127,11 @@ cairo_gl_surface_create_for_dc (cairo_device_t		*device,
+ #endif
+ 
+ #if CAIRO_HAS_EGL_FUNCTIONS
++
++#if !CAIRO_HAS_XLIB_SURFACE && !defined(MESA_EGL_NO_X11_HEADERS)
++#define MESA_EGL_NO_X11_HEADERS
++#endif
++
+ #include <EGL/egl.h>
+ 
+ cairo_public cairo_device_t *
+-- 
+2.19.2
+
diff --git a/nixpkgs/pkgs/development/libraries/cairo/0003-test-only-build-GL-tests-when-Xlib-is-enabled.patch b/nixpkgs/pkgs/development/libraries/cairo/0003-test-only-build-GL-tests-when-Xlib-is-enabled.patch
new file mode 100644
index 000000000000..09d7fd88627d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/cairo/0003-test-only-build-GL-tests-when-Xlib-is-enabled.patch
@@ -0,0 +1,41 @@
+From 84593a7e01b9afa74ec0bddd9515b666d476efba Mon Sep 17 00:00:00 2001
+From: Alyssa Ross <hi@alyssa.is>
+Date: Mon, 22 Apr 2019 11:29:48 +0000
+Subject: [PATCH 3/5] test: only build GL tests when Xlib is enabled
+
+The GL tests all depend on Xlib functions, so they should only be
+enabled when Xlib is enabled, because otherwise the required functions
+might not be present.
+---
+ test/Makefile.am | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/test/Makefile.am b/test/Makefile.am
+index e3c42ea88..9f77622bc 100644
+--- a/test/Makefile.am
++++ b/test/Makefile.am
+@@ -16,10 +16,6 @@ test_sources += $(ft_font_test_sources)
+ endif
+ endif
+ 
+-if CAIRO_HAS_GL_SURFACE
+-test_sources += $(gl_surface_test_sources)
+-endif
+-
+ if CAIRO_HAS_EGL_FUNCTIONS
+ test_sources += $(egl_surface_test_sources)
+ endif
+@@ -51,6 +47,10 @@ endif
+ 
+ if CAIRO_HAS_XLIB_SURFACE
+ test_sources += $(xlib_surface_test_sources)
++
++if CAIRO_HAS_GL_SURFACE
++test_sources += $(gl_surface_test_sources)
++endif
+ endif
+ 
+ if CAIRO_HAS_XLIB_XRENDER_SURFACE
+-- 
+2.19.2
+
diff --git a/nixpkgs/pkgs/development/libraries/cairo/0004-util-don-t-build-cairo-sphinx-unless-PNG-enabled.patch b/nixpkgs/pkgs/development/libraries/cairo/0004-util-don-t-build-cairo-sphinx-unless-PNG-enabled.patch
new file mode 100644
index 000000000000..702c4d49e484
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/cairo/0004-util-don-t-build-cairo-sphinx-unless-PNG-enabled.patch
@@ -0,0 +1,32 @@
+From 8b7816ea38a1869e7de94341e3ea9e1eebb8eb4f Mon Sep 17 00:00:00 2001
+From: Alyssa Ross <hi@alyssa.is>
+Date: Mon, 22 Apr 2019 13:08:30 +0000
+Subject: [PATCH 4/5] util: don't build cairo-sphinx unless PNG enabled
+
+cairo-sphinx won't build without libpng, because
+cairo_surface_write_to_png won't be defined.
+---
+ util/Makefile.am | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/util/Makefile.am b/util/Makefile.am
+index 82d0a804c..119b59f48 100644
+--- a/util/Makefile.am
++++ b/util/Makefile.am
+@@ -25,11 +25,13 @@ if BUILD_SPHINX
+ if CAIRO_HAS_DLSYM
+ if CAIRO_HAS_SCRIPT_SURFACE
+ if CAIRO_HAS_TEE_SURFACE
++if CAIRO_HAS_PNG_FUNCTIONS
+ SUBDIRS += cairo-sphinx
+ endif
+ endif
+ endif
+ endif
++endif
+ 
+ AM_CPPFLAGS = -I$(top_srcdir)/src \
+ 	      -I$(top_builddir)/src \
+-- 
+2.19.2
+
diff --git a/nixpkgs/pkgs/development/libraries/cairo/default.nix b/nixpkgs/pkgs/development/libraries/cairo/default.nix
new file mode 100644
index 000000000000..c81b5ba57ad9
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/cairo/default.nix
@@ -0,0 +1,141 @@
+{ config, stdenv, lib, fetchurl, fetchpatch, pkgconfig, autoreconfHook
+, pixman
+, zlibSupport ? true, zlib
+, pngSupport ? true, libpng
+, freetypeSupport ? true, freetype
+, fontconfigSupport ? freetypeSupport, fontconfig
+, gobjectSupport ? true, glib
+, x11Support ? !stdenv.isDarwin, libX11, libXext
+, x11XrenderSupport ? x11Support, libXrender
+, xcbSupport ? !stdenv.isDarwin, libxcb # no longer experimental since 1.12
+, libGLSupported
+, glSupport ? config.cairo.gl or (libGLSupported && stdenv.isLinux && !stdenv.isAarch32 && !stdenv.isMips)
+, libGL ? null # libGLU_combined is no longer a big dependency
+, darwin
+}:
+
+assert fontconfigSupport -> freetypeSupport;
+assert x11XrenderSupport -> x11Support;
+assert glSupport -> libGL != null;
+
+let
+  version = "1.16.0";
+  inherit (lib) enableFeature optional optionals;
+in stdenv.mkDerivation rec {
+  name = "cairo-${version}";
+
+  src = fetchurl {
+    url = "https://cairographics.org/${if lib.mod (builtins.fromJSON (lib.versions.minor version)) 2 == 0 then "releases" else "snapshots"}/${name}.tar.xz";
+    sha256 = "0c930mk5xr2bshbdljv005j3j8zr47gqmkry3q6qgvqky6rjjysy";
+  };
+
+  patches = [
+    # Fixes CVE-2018-19876; see Nixpkgs issue #55384
+    # CVE information: https://nvd.nist.gov/vuln/detail/CVE-2018-19876
+    # Upstream PR: https://gitlab.freedesktop.org/cairo/cairo/merge_requests/5
+    #
+    # This patch is the merged commit from the above PR.
+    (fetchpatch {
+      name   = "CVE-2018-19876.patch";
+      url    = "https://gitlab.freedesktop.org/cairo/cairo/commit/6edf572ebb27b00d3c371ba5ae267e39d27d5b6d.patch";
+      sha256 = "112hgrrsmcwxh1r52brhi5lksq4pvrz4xhkzcf2iqp55jl2pb7n1";
+    })
+
+    ./0001-test-don-t-always-build-FreeType-dependent-test.patch
+    ./0002-gl-don-t-implicitly-include-X11-headers.patch
+    ./0003-test-only-build-GL-tests-when-Xlib-is-enabled.patch
+    ./0004-util-don-t-build-cairo-sphinx-unless-PNG-enabled.patch
+  ];
+
+  outputs = [ "out" "dev" "devdoc" ];
+  outputBin = "dev"; # very small
+
+  nativeBuildInputs = [
+    autoreconfHook
+    pkgconfig
+    autoreconfHook
+  ];
+
+  buildInputs = optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [
+    CoreGraphics
+    CoreText
+    ApplicationServices
+    Carbon
+  ]);
+
+  propagatedBuildInputs =
+    [ pixman ]
+    ++ optional zlibSupport zlib
+    ++ optional pngSupport libpng
+    ++ optionals x11Support [ libX11 libXext ]
+    ++ optional x11XrenderSupport libXrender
+    ++ optional xcbSupport libxcb
+    ++ optional freetypeSupport freetype
+    ++ optional fontconfigSupport fontconfig
+    ++ optional gobjectSupport glib
+    ++ optional glSupport libGL
+    ; # TODO: maybe liblzo but what would it be for here?
+
+  configureFlags = if stdenv.isDarwin then [
+    "--disable-dependency-tracking"
+    "--enable-quartz"
+    "--enable-quartz-font"
+    "--enable-quartz-image"
+    "--enable-ft"
+  ] else [
+    (enableFeature zlibSupport "script")
+    (enableFeature zlibSupport "ps")
+    (enableFeature zlibSupport "pdf")
+    (enableFeature zlibSupport "interpreter")
+    (enableFeature pngSupport "png")
+    (enableFeature pngSupport "svg")
+    "--enable-tee"
+    (enableFeature glSupport "gl")
+  ];
+
+  preConfigure =
+  # On FreeBSD, `-ldl' doesn't exist.
+    stdenv.lib.optionalString stdenv.isFreeBSD
+       '' for i in "util/"*"/Makefile.in" boilerplate/Makefile.in
+          do
+            cat "$i" | sed -es/-ldl//g > t
+            mv t "$i"
+          done
+       ''
+    +
+    ''
+    # Work around broken `Requires.private' that prevents Freetype
+    # `-I' flags to be propagated.
+    sed -i "src/cairo.pc.in" \
+        -es'|^Cflags:\(.*\)$|Cflags: \1 -I${freetype.dev}/include/freetype2 -I${freetype.dev}/include|g'
+    substituteInPlace configure --replace strings $STRINGS
+    '';
+
+  enableParallelBuilding = true;
+
+  doCheck = false; # fails
+
+  postInstall = lib.optionalString stdenv.isDarwin glib.flattenInclude;
+
+  meta = with lib; {
+    description = "A 2D graphics library with support for multiple output devices";
+
+    longDescription = ''
+      Cairo is a 2D graphics library with support for multiple output
+      devices.  Currently supported output targets include the X
+      Window System, Quartz, Win32, image buffers, PostScript, PDF,
+      and SVG file output.  Experimental backends include OpenGL
+      (through glitz), XCB, BeOS, OS/2, and DirectFB.
+
+      Cairo is designed to produce consistent output on all output
+      media while taking advantage of display hardware acceleration
+      when available (e.g., through the X Render Extension).
+    '';
+
+    homepage = http://cairographics.org/;
+
+    license = with licenses; [ lgpl2Plus mpl10 ];
+
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/cairomm/default.nix b/nixpkgs/pkgs/development/libraries/cairomm/default.nix
new file mode 100644
index 000000000000..13550bf3faba
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/cairomm/default.nix
@@ -0,0 +1,44 @@
+{ fetchurl, stdenv, pkgconfig, darwin, cairo, fontconfig, freetype, libsigcxx }:
+stdenv.mkDerivation rec {
+  pname = "cairomm";
+  version = "1.12.2";
+
+  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";
+    sha256 = "16fmigxsaz85c3lgcls7biwyz8zy8c8h3jndfm54cxxas3a7zi25";
+  };
+
+  outputs = [ "out" "dev" ];
+
+  nativeBuildInputs = [ pkgconfig ];
+  propagatedBuildInputs = [ cairo libsigcxx ];
+  buildInputs = [ fontconfig freetype ]
+  ++ stdenv.lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [
+    ApplicationServices
+  ]);
+
+  doCheck = true;
+
+  meta = with stdenv.lib; {
+    description = "A 2D graphics library with support for multiple output devices";
+
+    longDescription = ''
+      Cairo is a 2D graphics library with support for multiple output
+      devices.  Currently supported output targets include the X
+      Window System, Quartz, Win32, image buffers, PostScript, PDF,
+      and SVG file output.  Experimental backends include OpenGL
+      (through glitz), XCB, BeOS, OS/2, and DirectFB.
+
+      Cairo is designed to produce consistent output on all output
+      media while taking advantage of display hardware acceleration
+      when available (e.g., through the X Render Extension).
+    '';
+
+    homepage = "https://www.cairographics.org/";
+
+    license = with licenses; [ lgpl2Plus mpl10 ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/capnproto/default.nix b/nixpkgs/pkgs/development/libraries/capnproto/default.nix
new file mode 100644
index 000000000000..b175250872f3
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/capnproto/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "capnproto-${version}";
+  version = "0.7.0";
+
+  src = fetchurl {
+    url = "https://capnproto.org/capnproto-c++-${version}.tar.gz";
+    sha256 = "0hfdnhlbskagzgvby8wy6lrxj53zfzpfqimbhga68c0ji2yw1969";
+  };
+
+  meta = with stdenv.lib; {
+    homepage    = "http://kentonv.github.io/capnproto";
+    description = "Cap'n Proto cerealization protocol";
+    longDescription = ''
+      Cap’n Proto is an insanely fast data interchange format and
+      capability-based RPC system. Think JSON, except binary. Or think Protocol
+      Buffers, except faster.
+    '';
+    license     = licenses.bsd2;
+    platforms   = platforms.all;
+    maintainers = with maintainers; [ cstrahan ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/capstone/default.nix b/nixpkgs/pkgs/development/libraries/capstone/default.nix
new file mode 100644
index 000000000000..c02633d880c4
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/capstone/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchurl, pkgconfig }:
+
+stdenv.mkDerivation rec {
+  name    = "capstone-${version}";
+  version = "4.0.1";
+
+  src = fetchurl {
+    url    = "https://github.com/aquynh/capstone/archive/${version}.tar.gz";
+    sha256 = "1isxw2qwy1fi3m3w7igsr5klzczxc5cxndz0a78dfss6ps6ymfvr";
+  };
+
+  configurePhase = '' patchShebangs make.sh '';
+  buildPhase = '' ./make.sh '';
+  installPhase = '' env PREFIX=$out ./make.sh install '';
+  
+  nativeBuildInputs = [
+    pkgconfig
+  ];
+
+  enableParallelBuilding = true;
+
+  meta = {
+    description = "Advanced disassembly library";
+    homepage    = "http://www.capstone-engine.org";
+    license     = stdenv.lib.licenses.bsd3;
+    platforms   = stdenv.lib.platforms.linux;
+    maintainers = [ stdenv.lib.maintainers.thoughtpolice ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/catch/default.nix b/nixpkgs/pkgs/development/libraries/catch/default.nix
new file mode 100644
index 000000000000..d83060fc24d8
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/catch/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchFromGitHub, cmake }:
+
+stdenv.mkDerivation rec {
+  name = "catch-${version}";
+  version = "1.12.2";
+
+  src = fetchFromGitHub {
+    owner = "catchorg";
+    repo = "Catch";
+    rev = "v${version}";
+    sha256 = "1gdp5wm8khn02g2miz381llw3191k7309qj8s3jd6sasj01rhf23";
+  };
+
+  nativeBuildInputs = [ cmake ];
+  cmakeFlags = [ "-DUSE_CPP14=ON" ];
+
+  doCheck = true;
+  checkTarget = "test";
+
+  meta = with stdenv.lib; {
+    description = "A multi-paradigm automated test framework for C++ and Objective-C (and, maybe, C)";
+    homepage = http://catch-lib.net;
+    license = licenses.boost;
+    maintainers = with maintainers; [ edwtjo knedlsepp ];
+    platforms = with platforms; unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/catch2/default.nix b/nixpkgs/pkgs/development/libraries/catch2/default.nix
new file mode 100644
index 000000000000..67f5350d8fe6
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/catch2/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchFromGitHub, cmake, python }:
+
+stdenv.mkDerivation rec {
+  name = "catch2-${version}";
+  version = "2.8.0";
+
+  src = fetchFromGitHub {
+    owner = "catchorg";
+    repo = "Catch2";
+    rev = "v${version}";
+    sha256="1i7nz29gcsy9cnljb0sb1fw8fg9p1gdh2pdhrgj3kcrsnxgbyhrq";
+  };
+
+  nativeBuildInputs = [ cmake ];
+
+  cmakeFlags = [ "-H.." ];
+
+  meta = with stdenv.lib; {
+    description = "A multi-paradigm automated test framework for C++ and Objective-C (and, maybe, C)";
+    homepage = http://catch-lib.net;
+    license = licenses.boost;
+    maintainers = with maintainers; [ edwtjo knedlsepp ];
+    platforms = with platforms; unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/ccrtp/1.8.nix b/nixpkgs/pkgs/development/libraries/ccrtp/1.8.nix
new file mode 100644
index 000000000000..db2d177b710c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/ccrtp/1.8.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchurl, openssl, pkgconfig, libgcrypt, commoncpp2 }:
+
+stdenv.mkDerivation {
+  name = "ccrtp-1.8.0";
+
+  src = fetchurl {
+    url = mirror://gnu/ccrtp/ccrtp-1.8.0.tar.gz;
+    sha256 = "0wr4dandlfajhmg90nqyvwv61ikn9vdycji001310y3c4zfysprn";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ openssl libgcrypt commoncpp2 ];
+
+  patches = [ ./gcc-4.6-fix.patch ];
+
+  meta = {
+    description = "GNU ccRTP is an implementation of RTP, the real-time transport protocol from the IETF";
+    homepage = https://www.gnu.org/software/ccrtp/;
+    license = stdenv.lib.licenses.gpl2;
+    maintainers = [ stdenv.lib.maintainers.marcweber ];
+    platforms = stdenv.lib.platforms.linux;
+    broken = true; # fails to compile with libgcrypt >= 1.6
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/ccrtp/default.nix b/nixpkgs/pkgs/development/libraries/ccrtp/default.nix
new file mode 100644
index 000000000000..cd9d031788a8
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/ccrtp/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchurl, pkgconfig, ucommon, openssl, libgcrypt }:
+
+stdenv.mkDerivation rec {
+  name = "ccrtp-2.1.2";
+
+  src = fetchurl {
+    url = "mirror://gnu/ccrtp/${name}.tar.gz";
+    sha256 = "17ili8l7zqbbkzr1rcy4hlnazkf50mds41wg6n7bfdsx3c7cldgh";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  propagatedBuildInputs = [ ucommon openssl libgcrypt ];
+
+  configureFlags = [
+    "--disable-demos"
+  ];
+
+  doCheck = true;
+
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/ccrtp/gcc-4.6-fix.patch b/nixpkgs/pkgs/development/libraries/ccrtp/gcc-4.6-fix.patch
new file mode 100644
index 000000000000..49d07a89e52a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/ccrtp/gcc-4.6-fix.patch
@@ -0,0 +1,20 @@
+diff -ubr ccrtp-1.8.0-orig/src/ccrtp/sources.h ccrtp-1.8.0/src/ccrtp/sources.h
+--- ccrtp-1.8.0-orig/src/ccrtp/sources.h	2010-04-18 20:51:49.000000000 +0200
++++ ccrtp-1.8.0/src/ccrtp/sources.h	2012-07-07 11:42:50.961179016 +0200
+@@ -45,6 +45,7 @@
+ #define CCXX_RTP_SOURCES_H_
+ 
+ #include <string>
++#include <cstddef>
+ #include <ccrtp/rtcppkt.h>
+ 
+ #ifdef	CCXX_NAMESPACES
+@@ -406,7 +407,7 @@
+ 	public:
+ 		typedef std::forward_iterator_tag iterator_category;
+ 		typedef Participant value_type;
+-		typedef ptrdiff_t difference_type;
++		typedef std::ptrdiff_t difference_type;
+ 		typedef const Participant* pointer;
+ 		typedef const Participant& reference;
+ 
diff --git a/nixpkgs/pkgs/development/libraries/cctz/default.nix b/nixpkgs/pkgs/development/libraries/cctz/default.nix
new file mode 100644
index 000000000000..2930ffa61e3c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/cctz/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchFromGitHub }:
+
+stdenv.mkDerivation rec {
+  name = "cctz-${version}";
+  version = "2.3";
+
+  src = fetchFromGitHub {
+    owner = "google";
+    repo = "cctz";
+    rev = "v${version}";
+    sha256 = "0254xfwscfkjc3fbvx6qgifr3pwkc2rb03z8pbvvqy098di9alhr";
+  };
+
+  makeFlags = [ "PREFIX=$(out)" ];
+
+  installTargets = [ "install_hdrs" "install_shared_lib" ];
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    homepage = https://github.com/google/cctz;
+    description = "C++ library for translating between absolute and civil times";
+    license = licenses.asl20;
+    maintainers = with maintainers; [ orivej ];
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/cddlib/default.nix b/nixpkgs/pkgs/development/libraries/cddlib/default.nix
new file mode 100644
index 000000000000..68d34c75c010
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/cddlib/default.nix
@@ -0,0 +1,33 @@
+{ stdenv
+, fetchFromGitHub
+, gmp
+, autoreconfHook
+, texlive
+}:
+
+stdenv.mkDerivation rec {
+  name = "cddlib-${version}";
+  version = "0.94j";
+  src = fetchFromGitHub {
+    owner = "cddlib";
+    repo = "cddlib";
+    rev = "${version}";
+    sha256 = "1z03ljy3rrr0qq5gq54vynnif6fn0xhn05g90nnv0dpyc3ps8lzp";
+  };
+  buildInputs = [gmp];
+  nativeBuildInputs = [
+    autoreconfHook
+    texlive.combined.scheme-small # for building the documentation
+  ];
+  # 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; {
+    inherit version;
+    description = ''An implementation of the Double Description Method for generating all vertices of a convex polyhedron'';
+    license = licenses.gpl2Plus;
+    maintainers = with maintainers; [raskin timokau];
+    platforms = platforms.unix;
+    homepage = https://www.inf.ethz.ch/personal/fukudak/cdd_home/index.html;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/cdk/default.nix b/nixpkgs/pkgs/development/libraries/cdk/default.nix
new file mode 100644
index 000000000000..4c311f07e017
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/cdk/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchurl, ncurses }:
+
+stdenv.mkDerivation rec {
+  name = "cdk-${version}";
+  version ="5.0-20190224";
+
+  buildInputs = [
+    ncurses
+  ];
+
+  src = fetchurl {
+    urls = [
+      "ftp://ftp.invisible-island.net/cdk/cdk-${version}.tgz"
+      "https://invisible-mirror.net/archives/cdk/cdk-${version}.tgz"
+    ];
+    sha256 = "0767xqwm377ak909c589vqm0v83slsnkm2ycq7bg545xx5nycncs";
+  };
+
+  meta = with stdenv.lib; {
+    description = "Curses development kit";
+    license = licenses.bsdOriginal ;
+    maintainers = [ maintainers.raskin ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/cdo/default.nix b/nixpkgs/pkgs/development/libraries/cdo/default.nix
new file mode 100644
index 000000000000..af69e23ca1f4
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/cdo/default.nix
@@ -0,0 +1,37 @@
+{ stdenv, fetchurl, curl, hdf5, netcdf
+, enable_cdi_lib ? false    # build, install and link to a CDI library [default=no]
+, enable_all_static ? false # build a completely statically linked CDO binary  [default=no]
+, enable_cxx ? false        # Use CXX as default compiler [default=no]
+}:
+
+stdenv.mkDerivation rec {
+  version = "1.9.0";
+  name = "cdo-${version}";
+
+  # Dependencies
+  buildInputs = [ curl netcdf hdf5 ];
+
+  src = fetchurl {
+    url = "https://code.mpimet.mpg.de/attachments/download/15187/${name}.tar.gz";
+    sha256 = "024hsr6qfg2dicwvm0vvkg3fr998bchf0qgwpj2v0jmz7a67ydnz";
+  };
+
+ # 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";
+
+  meta = {
+    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.
+      There are more than 600 operators available.
+    '';
+    homepage = https://code.mpimet.mpg.de/projects/cdo/;
+    license = stdenv.lib.licenses.gpl2;
+    maintainers = [ stdenv.lib.maintainers.ltavard ];
+    platforms = with stdenv.lib.platforms; linux ++ darwin;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/cegui/default.nix b/nixpkgs/pkgs/development/libraries/cegui/default.nix
new file mode 100644
index 000000000000..7e5c768036fc
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/cegui/default.nix
@@ -0,0 +1,21 @@
+{ stdenv, fetchurl, cmake, ogre, freetype, boost, expat }:
+
+stdenv.mkDerivation rec {
+  name = "cegui-${version}";
+  version = "0.8.7";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/crayzedsgui/${name}.tar.bz2";
+    sha256 = "067562s71kfsnbp2zb2bmq8zj3jk96g5a4rcc5qc3n8nfyayhldk";
+  };
+
+
+  buildInputs = [ cmake ogre freetype boost expat ];
+
+  meta = with stdenv.lib; {
+    homepage = http://cegui.org.uk/;
+    description = "C++ Library for creating GUIs";
+    license = licenses.mit;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/celt/0.5.1.nix b/nixpkgs/pkgs/development/libraries/celt/0.5.1.nix
new file mode 100644
index 000000000000..e45d74345d44
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/celt/0.5.1.nix
@@ -0,0 +1,17 @@
+{ callPackage, fetchurl, ... } @ args:
+
+callPackage ./generic.nix (args // rec{
+  version = "0.5.1.3";
+
+  src = fetchurl {
+    url = "http://downloads.xiph.org/releases/celt/celt-${version}.tar.gz";
+    sha256 = "0bkam9z5vnrxpbxkkh9kw6yzjka9di56h11iijikdd1f71l5nbpw";
+  };
+
+  # Don't build tests due to badness with ec_ilog
+  prePatch = ''
+    substituteInPlace Makefile.in \
+      --replace 'SUBDIRS = libcelt tests' \
+                'SUBDIRS = libcelt'
+  '';
+})
diff --git a/nixpkgs/pkgs/development/libraries/celt/0.7.nix b/nixpkgs/pkgs/development/libraries/celt/0.7.nix
new file mode 100644
index 000000000000..a5dd401ec49d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/celt/0.7.nix
@@ -0,0 +1,10 @@
+{ callPackage, fetchurl, ... } @ args:
+
+callPackage ./generic.nix (args // rec{
+  version = "0.7.1";
+
+  src = fetchurl {
+    url = "http://downloads.xiph.org/releases/celt/celt-${version}.tar.gz";
+    sha256 = "0rihjgzrqcprsv8a1pmiglwik7xqbs2yw3fwd6gb28chnpgy5w4k";
+  };
+})
diff --git a/nixpkgs/pkgs/development/libraries/celt/default.nix b/nixpkgs/pkgs/development/libraries/celt/default.nix
new file mode 100644
index 000000000000..61352d5caf93
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/celt/default.nix
@@ -0,0 +1,10 @@
+{ callPackage, fetchurl, ... } @ args:
+
+callPackage ./generic.nix (args // rec{
+  version = "0.11.3";
+
+  src = fetchurl {
+    url = "http://downloads.xiph.org/releases/celt/celt-${version}.tar.gz";
+    sha256 = "0dh893wqbh0q4a0x1xyqryykmnhpv7mkblpch019s04a99fq2r3y";
+  };
+})
diff --git a/nixpkgs/pkgs/development/libraries/celt/generic.nix b/nixpkgs/pkgs/development/libraries/celt/generic.nix
new file mode 100644
index 000000000000..6bf7975034b5
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/celt/generic.nix
@@ -0,0 +1,28 @@
+{ stdenv, version, src
+, liboggSupport ? true, libogg ? null # if disabled only the library will be built
+, prePatch ? ""
+, ...
+}:
+
+# The celt codec has been deprecated and is now a part of the opus codec
+
+stdenv.mkDerivation rec {
+  name = "celt-${version}";
+
+  inherit src;
+
+  inherit prePatch;
+
+  buildInputs = []
+    ++ stdenv.lib.optional liboggSupport libogg;
+
+  doCheck = false; # fails
+
+  meta = with stdenv.lib; {
+    description = "Ultra-low delay audio codec";
+    homepage    = http://www.celt-codec.org/;
+    license     = licenses.bsd2;
+    maintainers = with maintainers; [ codyopel raskin ];
+    platforms   = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/ceres-solver/default.nix b/nixpkgs/pkgs/development/libraries/ceres-solver/default.nix
new file mode 100644
index 000000000000..043b9e263d8a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/ceres-solver/default.nix
@@ -0,0 +1,43 @@
+{ stdenv
+, eigen
+, fetchurl
+, cmake
+, google-gflags
+, glog
+, runTests ? false
+}:
+
+# google-gflags is required to run tests
+assert runTests -> google-gflags != null;
+
+stdenv.mkDerivation rec {
+  name = "ceres-solver-${version}";
+  version = "1.14.0";
+
+  src = fetchurl {
+    url = "http://ceres-solver.org/ceres-solver-${version}.tar.gz";
+    sha256 = "13lfxy8x58w8vprr0nkbzziaijlh0vvqshgahvcgw0mrqdgh0i27";
+  };
+
+  nativeBuildInputs = [ cmake ];
+  buildInputs = [ eigen glog ]
+    ++ stdenv.lib.optional runTests google-gflags;
+
+  # The Basel BUILD file conflicts with the cmake build directory on
+  # case-insensitive filesystems, eg. darwin.
+  preConfigure = ''
+    rm BUILD
+  '';
+
+  doCheck = runTests;
+
+  checkTarget = "test";
+
+  meta = with stdenv.lib; {
+    description = "C++ library for modeling and solving large, complicated optimization problems";
+    license = licenses.bsd3;
+    homepage = http://ceres-solver.org;
+    maintainers = with maintainers; [ giogadi ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/cfitsio/darwin-curl-config.patch b/nixpkgs/pkgs/development/libraries/cfitsio/darwin-curl-config.patch
new file mode 100644
index 000000000000..77d8f719d778
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/cfitsio/darwin-curl-config.patch
@@ -0,0 +1,25 @@
+diff -ruN cfitsio/configure cfitsio-curl-config/configure
+--- cfitsio/configure	2018-05-09 21:16:00.000000000 +0200
++++ cfitsio-curl-config/configure	2018-05-30 13:28:58.000000000 +0200
+@@ -4783,13 +4783,6 @@
+ CURL_LIB=""
+ CURL_INC=""
+ # Use curl-config to get compiler & linker flags, if available.
+-# On Macs, prefer XCode curl-config, and reject MacPorts version
+-# until further notice to prevent build errors:
+-if test "x$EXT" = xdarwin -a -x /usr/bin/curl-config; then
+-  CURLCONFIG="/usr/bin/curl-config"
+-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: checking for curl-config... choosing /usr/bin/curl-config on Mac" >&5
+-$as_echo "checking for curl-config... choosing /usr/bin/curl-config on Mac" >&6; }
+-else
+   # Extract the first word of "curl-config", so it can be a program name with args.
+ set dummy curl-config; ac_word=$2
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+@@ -4833,7 +4826,6 @@
+   fi
+ fi
+ fi
+-fi
+ CURLCONFIG=$ac_cv_prog_CURLCONFIG
+ if test -n "$CURLCONFIG"; then
+   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CURLCONFIG" >&5
diff --git a/nixpkgs/pkgs/development/libraries/cfitsio/darwin-rpath-universal.patch b/nixpkgs/pkgs/development/libraries/cfitsio/darwin-rpath-universal.patch
new file mode 100644
index 000000000000..af38abf329ea
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/cfitsio/darwin-rpath-universal.patch
@@ -0,0 +1,21 @@
+diff -ruN cfitsio/configure cfitsio-rpath-universal/configure
+--- cfitsio/configure	2018-05-09 21:16:00.000000000 +0200
++++ cfitsio-rpath-universal/configure	2018-05-31 12:02:25.000000000 +0200
+@@ -4727,16 +4727,7 @@
+     SHLIB_SUFFIX=".dylib"
+     CFITSIO_SHLIB="lib\${PACKAGE}.\${CFITSIO_SONAME}.\${CFITSIO_MAJOR}.\${CFITSIO_MINOR}\${SHLIB_SUFFIX}"
+     CFITSIO_SHLIB_SONAME="lib\${PACKAGE}.\${CFITSIO_SONAME}\${SHLIB_SUFFIX}"
+-    case $host in
+-        *darwin[56789]*)
+-            SHLIB_LD="$CC -dynamiclib -install_name lib\${PACKAGE}.\${CFITSIO_SONAME}\${SHLIB_SUFFIX} -compatibility_version \${CFITSIO_SONAME} -current_version \${CFITSIO_SONAME}.\${CFITSIO_MAJOR}.\${CFITSIO_MINOR}"
+-            ;;
+-        *)
+-            # Build 'Universal' binaries (i386 & x86_64 architectures) and
+-            # use rpath token on Darwin 10.x or newer:
+-            SHLIB_LD="$CC -dynamiclib $C_UNIV_SWITCH -headerpad_max_install_names -install_name @rpath/lib\${PACKAGE}.\${CFITSIO_SONAME}\${SHLIB_SUFFIX} -compatibility_version \${CFITSIO_SONAME} -current_version \${CFITSIO_SONAME}.\${CFITSIO_MAJOR}.\${CFITSIO_MINOR}"
+-            ;;
+-    esac
++    SHLIB_LD="$CC -dynamiclib -install_name ${out}/lib/lib\${PACKAGE}.\${CFITSIO_SONAME}\${SHLIB_SUFFIX} -compatibility_version \${CFITSIO_SONAME} -current_version \${CFITSIO_SONAME}.\${CFITSIO_MAJOR}.\${CFITSIO_MINOR}"
+ 
+     lhea_shlib_cflags="-fPIC -fno-common"
+     ;;
diff --git a/nixpkgs/pkgs/development/libraries/cfitsio/default.nix b/nixpkgs/pkgs/development/libraries/cfitsio/default.nix
new file mode 100644
index 000000000000..32308c34ead1
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/cfitsio/default.nix
@@ -0,0 +1,42 @@
+{ fetchurl, stdenv
+
+# Optional dependencies
+, bzip2 ? null }:
+
+stdenv.mkDerivation rec {
+  name = "cfitsio-${version}";
+  version = "3.450";
+
+  src = fetchurl {
+    url = "https://heasarc.gsfc.nasa.gov/FTP/software/fitsio/c/cfitsio${builtins.replaceStrings ["."] [""] version}.tar.gz";
+    sha256 = "0bmrkw6w65zb0k3mszaaqy1f4zjm2hl7njww74nb5v38wvdi4q5z";
+  };
+
+  buildInputs = [ bzip2 ];
+
+  patches = [ ./darwin-curl-config.patch ./darwin-rpath-universal.patch ];
+
+  configureFlags = stdenv.lib.optional (bzip2 != null) "--with-bzip2=${bzip2.out}";
+
+  # Shared-only build
+  buildFlags = "shared";
+  postPatch = '' sed -e '/^install:/s/libcfitsio.a //' -e 's@/bin/@@g' -i Makefile.in
+   '';
+
+  meta = with stdenv.lib; {
+    homepage = https://heasarc.gsfc.nasa.gov/fitsio/;
+    description = "Library for reading and writing FITS data files";
+    longDescription =
+      '' CFITSIO is a library of C and Fortran subroutines for reading and
+         writing data files in FITS (Flexible Image Transport System) data
+         format.  CFITSIO provides simple high-level routines for reading and
+         writing FITS files that insulate the programmer from the internal
+         complexities of the FITS format.  CFITSIO also provides many
+         advanced features for manipulating and filtering the information in
+         FITS files.
+      '';
+    license = licenses.mit;
+    maintainers = [ maintainers.xbreak ];
+    platforms = with platforms; linux ++ darwin;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/cgui/default.nix b/nixpkgs/pkgs/development/libraries/cgui/default.nix
new file mode 100644
index 000000000000..df75d3a1f1da
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/cgui/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchurl, texinfo, allegro, perl, libX11 }:
+
+stdenv.mkDerivation rec {
+  name = "cgui-${version}";
+  version="2.1.0";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/project/cgui/${version}/${name}.tar.gz";
+    sha256 = "1pp1hvidpilq37skkmbgba4lvzi01rasy04y0cnas9ck0canv00s";
+  };
+
+  buildInputs = [ texinfo allegro perl libX11 ];
+
+  configurePhase = ''
+    sh fix.sh unix
+  '';
+
+  hardeningDisable = [ "format" ];
+
+  makeFlags = [ "SYSTEM_DIR=$(out)" ];
+
+  meta = with stdenv.lib; {
+    description = "A multiplatform basic GUI library";
+    maintainers = [ maintainers.raskin ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/check/default.nix b/nixpkgs/pkgs/development/libraries/check/default.nix
new file mode 100644
index 000000000000..ae8b6ca18df3
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/check/default.nix
@@ -0,0 +1,36 @@
+{ fetchurl, stdenv
+, CoreServices
+}:
+
+stdenv.mkDerivation rec {
+  name = "check-${version}";
+  version = "0.12.0";
+
+  src = fetchurl {
+    url = "https://github.com/libcheck/check/releases/download/${version}/check-${version}.tar.gz";
+    sha256 = "0d22h8xshmbpl9hba9ch3xj8vb9ybm5akpsbbh7yj07fic4h2hj6";
+  };
+
+  # Test can randomly fail: http://hydra.nixos.org/build/7243912
+  doCheck = false;
+
+  buildInputs = stdenv.lib.optional stdenv.isDarwin CoreServices;
+
+  meta = with stdenv.lib; {
+    description = "Unit testing framework for C";
+
+    longDescription =
+      '' Check is a unit testing framework for C.  It features a simple
+         interface for defining unit tests, putting little in the way of the
+         developer.  Tests are run in a separate address space, so Check can
+         catch both assertion failures and code errors that cause
+         segmentation faults or other signals.  The output from unit tests
+         can be used within source code editors and IDEs.
+      '';
+
+    homepage = https://libcheck.github.io/check/;
+
+    license = licenses.lgpl2Plus;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/chipmunk/default.nix b/nixpkgs/pkgs/development/libraries/chipmunk/default.nix
new file mode 100644
index 000000000000..f460b69a4f84
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/chipmunk/default.nix
@@ -0,0 +1,30 @@
+{ stdenv, fetchurl, cmake, freeglut, libGLU_combined, glfw2, glew, libX11, xorgproto
+, libXi, libXmu
+}:
+
+stdenv.mkDerivation rec {
+  name = "chipmunk-${version}";
+  majorVersion = "7";
+  version = "${majorVersion}.0.1";
+
+  src = fetchurl {
+    url = "https://chipmunk-physics.net/release/Chipmunk-${majorVersion}.x/Chipmunk-${version}.tgz";
+    sha256 = "0q4jwv1icz8spcjkp0v3bnygi6hq2zmnsgcxkwm8i2bxfxjb8m7y";
+  };
+
+  nativeBuildInputs = [ cmake ];
+  buildInputs =
+    [ freeglut libGLU_combined glfw2 glew libX11 xorgproto libXi libXmu ];
+
+  postInstall = ''
+    mkdir -p $out/bin
+    cp demo/chipmunk_demos $out/bin
+  '';
+
+  meta = with stdenv.lib; {
+    description = "A fast and lightweight 2D game physics library";
+    homepage = http://chipmunk2d.net/;
+    license = licenses.mit;
+    platforms = platforms.unix; # supports Windows and MacOS as well, but those require more work
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/chmlib/default.nix b/nixpkgs/pkgs/development/libraries/chmlib/default.nix
new file mode 100644
index 000000000000..fbefee48d5b2
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/chmlib/default.nix
@@ -0,0 +1,17 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "chmlib-0.40";
+
+  src = fetchurl {
+    url = "${meta.homepage}/${name}.tar.bz2";
+    sha256 = "18zzb4x3z0d7fjh1x5439bs62dmgsi4c1pg3qyr7h5gp1i5xcj9l";
+  };
+
+  meta = {
+    homepage = http://www.jedrea.com/chmlib;
+    license = stdenv.lib.licenses.lgpl2;
+    description = "A library for dealing with Microsoft ITSS/CHM format files";
+    platforms = ["x86_64-linux" "i686-linux" "x86_64-darwin"];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/chromaprint/default.nix b/nixpkgs/pkgs/development/libraries/chromaprint/default.nix
new file mode 100644
index 000000000000..02420735ff76
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/chromaprint/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchurl, cmake, boost, ffmpeg }:
+
+stdenv.mkDerivation rec {
+  name = "chromaprint-${version}";
+  version = "1.3.2";
+
+  src = fetchurl {
+    url = "https://bitbucket.org/acoustid/chromaprint/downloads/${name}.tar.gz";
+    sha256 = "0lln8dh33gslb9cbmd1hcv33pr6jxdwipd8m8gbsyhksiq6r1by3";
+  };
+
+  nativeBuildInputs = [ cmake ];
+
+  buildInputs = [ boost ffmpeg ];
+
+  cmakeFlags = [ "-DBUILD_EXAMPLES=ON" ];
+
+  meta = with stdenv.lib; {
+    homepage = https://acoustid.org/chromaprint;
+    description = "AcoustID audio fingerprinting library";
+    maintainers = with maintainers; [ ehmry ];
+    license = licenses.lgpl21Plus;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/cimg/default.nix b/nixpkgs/pkgs/development/libraries/cimg/default.nix
new file mode 100644
index 000000000000..4025d386d77b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/cimg/default.nix
@@ -0,0 +1,33 @@
+{ stdenv, fetchurl, unzip }:
+
+stdenv.mkDerivation rec {
+
+  name = "cimg-${version}";
+  version = "2.6.4";
+
+  src = fetchurl {
+    url = "http://cimg.eu/files/CImg_${version}.zip";
+    sha256 = "0hvr030588jnm5s8zgxvhkg13al83dy6273rbdi801cmgfcwxq29";
+  };
+
+  nativeBuildInputs = [ unzip ];
+
+  installPhase = ''
+    install -dm 755 $out/include/CImg/plugins $doc/share/doc/cimg/examples
+
+    install -m 644 CImg.h $out/include/
+    cp -dr --no-preserve=ownership examples/* $doc/share/doc/cimg/examples/
+    cp -dr --no-preserve=ownership plugins/* $out/include/CImg/plugins/
+    cp README.txt $doc/share/doc/cimg/
+  '';
+
+  outputs = [ "out" "doc" ];
+
+  meta = with stdenv.lib; {
+    description = "A small, open source, C++ toolkit for image processing";
+    homepage = http://cimg.eu/;
+    license = licenses.cecill-c;
+    maintainers = [ maintainers.AndersonTorres ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/civetweb/0001-allow-setting-paths-in-makefile.patch b/nixpkgs/pkgs/development/libraries/civetweb/0001-allow-setting-paths-in-makefile.patch
new file mode 100644
index 000000000000..47f419727459
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/civetweb/0001-allow-setting-paths-in-makefile.patch
@@ -0,0 +1,55 @@
+From 06b2c6dd6439c01bfb5a4c7b0ec6909c349a66b1 Mon Sep 17 00:00:00 2001
+From: Frederik Rietdijk <freddyrietdijk@fridh.nl>
+Date: Thu, 28 Feb 2019 16:25:49 +0100
+Subject: [PATCH] allow setting paths in makefile
+
+and install headers and libs
+---
+ Makefile | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index b507e2b0..d21e5c56 100644
+--- a/Makefile
++++ b/Makefile
+@@ -19,13 +19,13 @@ BUILD_DIR = out
+ # http://www.gnu.org/prep/standards/html_node/Directory-Variables.html
+ PREFIX ?= /usr/local
+ EXEC_PREFIX = $(PREFIX)
+-BINDIR = $(EXEC_PREFIX)/bin
++BINDIR ?= $(EXEC_PREFIX)/bin
+ DATAROOTDIR = $(PREFIX)/share
+ DOCDIR = $(DATAROOTDIR)/doc/$(CPROG)
+ SYSCONFDIR = $(PREFIX)/etc
+ HTMLDIR = $(DOCDIR)
+-INCLUDEDIR = $(DESTDIR)$(PREFIX)/include
+-LIBDIR = $(DESTDIR)$(EXEC_PREFIX)/lib
++INCLUDEDIR ?= $(DESTDIR)$(PREFIX)/include
++LIBDIR ?= $(DESTDIR)$(EXEC_PREFIX)/lib
+ 
+ # build tools
+ MKDIR = mkdir -p
+@@ -270,17 +270,17 @@ build: $(CPROG) $(CXXPROG)
+ unit_test: $(UNIT_TEST_PROG)
+ 
+ ifeq ($(CAN_INSTALL),1)
+-install: $(HTMLDIR)/index.html $(SYSCONFDIR)/civetweb.conf
++install: install-headers install-slib $(HTMLDIR)/index.html $(SYSCONFDIR)/civetweb.conf
+ 	install -d -m 755  "$(DOCDIR)"
+ 	install -m 644 *.md "$(DOCDIR)"
+ 	install -d -m 755 "$(BINDIR)"
+ 	install -m 755 $(CPROG) "$(BINDIR)/"
+ 
+ install-headers:
+-	install -m 644 $(HEADERS) "$(INCLUDEDIR)"
++	install -m 644 $(HEADERS) "$(INCLUDEDIR)/"
+ 
+ install-lib: lib$(CPROG).a
+-	install -m 644 $< "$(LIBDIR)"
++	install -m 644 $< "$(LIBDIR)/"
+ 
+ install-slib: lib$(CPROG).so
+ 	$(eval version=$(shell grep -w "define CIVETWEB_VERSION" include/civetweb.h | sed 's|.*VERSION "\(.*\)"|\1|g'))
+-- 
+2.19.2
+
diff --git a/nixpkgs/pkgs/development/libraries/civetweb/default.nix b/nixpkgs/pkgs/development/libraries/civetweb/default.nix
new file mode 100644
index 000000000000..3f8de005ff81
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/civetweb/default.nix
@@ -0,0 +1,41 @@
+{ stdenv
+, fetchFromGitHub
+}:
+
+stdenv.mkDerivation rec {
+  pname = "civetweb";
+  version = "1.11";
+
+  src = fetchFromGitHub {
+    owner = pname;
+    repo = pname;
+    rev = "v${version}";
+    sha256 = "sha256:1drnid6gs97cp9zpvsxz42yfj8djmgx98fg9p2993x9mpi547vzv";
+  };
+
+  makeFlags = [
+    "WITH_CPP=1"
+    "PREFIX=${placeholder "out"}"
+    "LIBDIR=${placeholder "out"}/lib"
+    "INCLUDEDIR=${placeholder "dev"}/include"
+  ];
+
+  patches = [
+    ./0001-allow-setting-paths-in-makefile.patch
+  ];
+
+  strictDeps = true;
+
+  outputs = [ "out" "dev" ];
+
+  preInstall = ''
+    mkdir -p $dev/include
+    mkdir -p $out/lib
+  '';
+
+  meta = {
+    description = "Embedded C/C++ web server";
+    homepage = https://github.com/civetweb/civetweb;
+    license = [ stdenv.lib.licenses.mit ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/cl/default.nix b/nixpkgs/pkgs/development/libraries/cl/default.nix
new file mode 100644
index 000000000000..1890d2b25a0d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/cl/default.nix
@@ -0,0 +1,34 @@
+{stdenv, fetchFromGitHub, rebar, erlang, opencl-headers, ocl-icd }:
+
+stdenv.mkDerivation rec {
+  version = "1.2.4";
+  name = "cl-${version}";
+
+  src = fetchFromGitHub {
+    owner = "tonyrog";
+    repo = "cl";
+    rev = "cl-${version}";
+    sha256 = "1gwkjl305a0231hz3k0w448dsgbgdriaq764sizs5qfn59nzvinz";
+  };
+
+  buildInputs = [ erlang rebar opencl-headers ocl-icd ];
+  
+  buildPhase = ''
+    rebar compile
+  '';
+
+  # 'cp' line taken from Arch recipe
+  # https://projects.archlinux.org/svntogit/community.git/tree/trunk/PKGBUILD?h=packages/erlang-sdl
+  installPhase = ''
+    DIR=$out/lib/erlang/lib/${name}
+    mkdir -p $DIR
+    cp -ruv c_src doc ebin include priv src $DIR
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = https://github.com/tonyrog/cl;
+    description = "OpenCL binding for Erlang";
+    license = licenses.mit;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/classads/default.nix b/nixpkgs/pkgs/development/libraries/classads/default.nix
new file mode 100644
index 000000000000..d329b1945fc7
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/classads/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchurl, pcre }:
+
+let version = "1.0.10"; in
+
+stdenv.mkDerivation {
+  name = "classads-${version}";
+
+  src = fetchurl {
+    url = "ftp://ftp.cs.wisc.edu/condor/classad/c++/classads-${version}.tar.gz";
+    sha256 = "1czgj53gnfkq3ncwlsrwnr4y91wgz35sbicgkp4npfrajqizxqnd";
+  };
+
+  buildInputs = [ pcre ];
+
+  configureFlags = [
+    "--enable-namespace" "--enable-flexible-member"
+  ];
+  
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/clearsilver/default.nix b/nixpkgs/pkgs/development/libraries/clearsilver/default.nix
new file mode 100644
index 000000000000..fd4d8d5ca31b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/clearsilver/default.nix
@@ -0,0 +1,43 @@
+{ stdenv, fetchurl, fetchpatch, python }:
+
+stdenv.mkDerivation rec {
+  name = "clearsilver-0.10.5";
+
+  src = fetchurl {
+    url = "http://www.clearsilver.net/downloads/${name}.tar.gz";
+    sha256 = "1046m1dpq3nkgxbis2dr2x7hynmy51n64465q78d7pdgvqwa178y";
+  };
+
+  PYTHON_SITE = "$(out)/site-packages";
+
+  configureFlags = [
+    "--with-python=${python}/bin/python"
+    "--disable-apache"
+    "--disable-perl"
+    "--disable-ruby"
+    "--disable-java"
+    "--disable-csharp"
+  ];
+
+  preInstall = ''
+    mkdir -p $out
+    mkdir -p $out/site-packages
+  '';
+
+  patches = [
+    (fetchpatch {
+      url = "https://sources.debian.net/data/main/c/clearsilver/0.10.5-1.6/debian/patches/clang-gcc5.patch";
+      sha256 = "0d44v9jx0b6k8nvrhknd958i9rs59kdh73z0lb4f1mzi8if16c38";
+    })
+    (fetchpatch {
+      url = "https://sources.debian.net/data/main/c/clearsilver/0.10.5-1.6/debian/patches/CVE-2011-4357.diff";
+      sha256 = "1lfncavxdqckrz03gv97lcliygbpi9lnih944vmdbn9zw6fwcipi";
+    })
+  ];
+
+  meta = with stdenv.lib; {
+    description = "Fast, powerful, and language-neutral HTML template system";
+    homepage = http://www.clearsilver.net/;
+    license = licenses.free;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/clipper/default.nix b/nixpkgs/pkgs/development/libraries/clipper/default.nix
new file mode 100644
index 000000000000..086816655d3b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/clipper/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchurl, cmake, ninja, unzip }:
+
+stdenv.mkDerivation rec {
+  version = "6.4.2";
+  name = "Clipper-${version}";
+  src = fetchurl {
+    url = "mirror://sourceforge/polyclipping/clipper_ver${version}.zip";
+    sha256 = "09q6jc5k7p9y5d75qr2na5d1gm0wly5cjnffh127r04l47c20hx1";
+  };
+
+  sourceRoot = "cpp";
+
+  buildInputs = [ ];
+
+  nativeBuildInputs = [ cmake ninja unzip ];
+
+  meta = with stdenv.lib; {
+    longDescription = ''
+      The Clipper library performs line & polygon clipping - intersection, union, difference & exclusive-or,
+      and line & polygon offsetting. The library is based on Vatti's clipping algorithm.
+    '';
+    homepage = https://sourceforge.net/projects/polyclipping;
+    license = licenses.boost;
+    maintainers = with maintainers; [ mpickering ];
+    platforms = with platforms; unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/cln/default.nix b/nixpkgs/pkgs/development/libraries/cln/default.nix
new file mode 100644
index 000000000000..7764e9c67ed2
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/cln/default.nix
@@ -0,0 +1,20 @@
+{ stdenv, fetchurl, gmp }:
+
+stdenv.mkDerivation rec {
+  name = "cln-${version}";
+  version = "1.3.4";
+
+  src = fetchurl {
+    url = "${meta.homepage}${name}.tar.bz2";
+    sha256 = "0j5p18hwbbrchsdbnc8d2bf9ncslhflri4i950gdnq7v6g2dg69d";
+  };
+
+  buildInputs = [ gmp ];
+
+  meta = with stdenv.lib; {
+    description = "C/C++ library for numbers, a part of GiNaC";
+    homepage = http://www.ginac.de/CLN/;
+    license = licenses.gpl2;
+    platforms = platforms.unix; # Once had cygwin problems
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/cloog-ppl/default.nix b/nixpkgs/pkgs/development/libraries/cloog-ppl/default.nix
new file mode 100644
index 000000000000..47037339d417
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/cloog-ppl/default.nix
@@ -0,0 +1,70 @@
+{ fetchurl, stdenv, ppl, autoreconfHook }:
+
+stdenv.mkDerivation rec {
+  name = "cloog-ppl-0.15.11";
+
+  src = fetchurl {
+    url = "mirror://gcc/infrastructure/${name}.tar.gz";
+    sha256 = "0psdm0bn5gx60glfh955x5b3b23zqrd92idmjr0b00dlnb839mkw";
+  };
+
+  propagatedBuildInputs = [ ppl ];
+
+  nativeBuildInputs = [ autoreconfHook ];
+
+  patches = [ ./fix-ppl-version.patch ];
+
+  configureFlags = [ "--with-ppl=${ppl}" ];
+
+  preAutoreconf = ''
+    touch NEWS ChangeLog AUTHORS
+  '';
+
+  doCheck = true;
+
+  meta = {
+    description = "CLooG-PPL, the Chunky Loop Generator";
+
+    longDescription = ''
+      CLooG is a free software library to generate code for scanning
+      Z-polyhedra.  That is, it finds a code (e.g., in C, FORTRAN...) that
+      reaches each integral point of one or more parameterized polyhedra.
+      CLooG has been originally written to solve the code generation problem
+      for optimizing compilers based on the polytope model.  Nevertheless it
+      is used now in various area e.g., to build control automata for
+      high-level synthesis or to find the best polynomial approximation of a
+      function.  CLooG may help in any situation where scanning polyhedra
+      matters.  While the user has full control on generated code quality,
+      CLooG is designed to avoid control overhead and to produce a very
+      effective code.
+    '';
+
+    # CLooG-PPL is actually a port of GLooG from PolyLib to PPL.
+    homepage = http://www.cloog.org/;
+
+    license = stdenv.lib.licenses.gpl2Plus;
+
+    maintainers = [ ];
+
+    /* Leads to an ICE on Cygwin:
+
+       make[3]: Entering directory `/tmp/nix-build-9q5gw5m37q5l4f0kjfv9ar8fsc9plk27-ppl-0.10.2.drv-1/ppl-0.10.2/src'
+       /bin/sh ../libtool --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I. -I..  -I.. -I../src    -g -O2 -frounding-math  -W -Wall -c -o Box.lo Box.cc
+       libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I.. -I.. -I../src -g -O2 -frounding-math -W -Wall -c Box.cc  -DDLL_EXPORT -DPIC -o .libs/Box.o
+       In file included from checked.defs.hh:595,
+                        from Checked_Number.defs.hh:27,
+                        from Coefficient.types.hh:15,
+                        from Coefficient.defs.hh:26,
+                        from Box.defs.hh:28,
+                        from Box.cc:24:
+       checked.inlines.hh: In function `Parma_Polyhedra_Library::Result Parma_Polyhedra_Library::Checked::input_generic(Type&, std::istream&, Parma_Polyhedra_Library::Rounding_Dir)':
+       checked.inlines.hh:607: internal compiler error: in invert_truthvalue, at fold-const.c:2719
+       Please submit a full bug report,
+       with preprocessed source if appropriate.
+       See <URL:http://cygwin.com/problems.html> for instructions.
+       make[3]: *** [Box.lo] Error 1
+
+    */
+    platforms = stdenv.lib.platforms.unix; # Once had cygwin problems
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/cloog-ppl/fix-ppl-version.patch b/nixpkgs/pkgs/development/libraries/cloog-ppl/fix-ppl-version.patch
new file mode 100644
index 000000000000..8440d839411b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/cloog-ppl/fix-ppl-version.patch
@@ -0,0 +1,16 @@
+diff -rupN src/configure.in cloog-ppl-0.15.11/configure.in
+--- src/configure.in	2014-04-13 13:33:43.349392305 +0200
++++ cloog-ppl-0.15.11/configure.in	2014-04-13 13:34:12.695379888 +0200
+@@ -337,11 +337,7 @@ if test "x$with_ppl" != "x" -a "x$with_p
+ 		        [AC_MSG_ERROR(Can't find PPL headers.)])
+ 
+ 	AC_MSG_CHECKING([for version 0.10 (or later revision) of PPL])
+-	AC_TRY_COMPILE([#include "ppl_c.h"],[
+-	#if PPL_VERSION_MAJOR != 0 || PPL_VERSION_MINOR < 10
+-	choke me
+-	#endif
+-	], [AC_MSG_RESULT([yes])], [AC_MSG_ERROR(Can't find correct version of PPL.) ])
++	AC_MSG_RESULT([yes])
+ 
+ 	LIBS="$LIBS -lppl_c -lppl -lgmpxx"
+ 	AC_DEFINE([CLOOG_PPL_BACKEND], 1, [Use the PPL backend])
diff --git a/nixpkgs/pkgs/development/libraries/cloog/0.18.0.nix b/nixpkgs/pkgs/development/libraries/cloog/0.18.0.nix
new file mode 100644
index 000000000000..fa4e19f716ae
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/cloog/0.18.0.nix
@@ -0,0 +1,63 @@
+{ fetchurl, stdenv, gmp, isl }:
+
+stdenv.mkDerivation rec {
+  name = "cloog-0.18.0";
+
+  src = fetchurl {
+    url = "http://www.bastoul.net/cloog/pages/download/count.php3?url=./${name}.tar.gz";
+    sha256 = "1c4aa8dde7886be9cbe0f9069c334843b21028f61d344a2d685f88cb1dcf2228";
+  };
+
+  buildInputs = [ gmp ];
+
+  propagatedBuildInputs = [ isl ];
+
+  configureFlags = [ "--with-isl=system" ];
+
+  enableParallelBuilding = true;
+
+  doCheck = true;
+
+  meta = {
+    description = "Library that generates loops for scanning polyhedra";
+
+    longDescription = ''
+      CLooG is a free software library to generate code for scanning
+      Z-polyhedra.  That is, it finds a code (e.g., in C, FORTRAN...) that
+      reaches each integral point of one or more parameterized polyhedra.
+      CLooG has been originally written to solve the code generation problem
+      for optimizing compilers based on the polytope model.  Nevertheless it
+      is used now in various area e.g., to build control automata for
+      high-level synthesis or to find the best polynomial approximation of a
+      function.  CLooG may help in any situation where scanning polyhedra
+      matters.  While the user has full control on generated code quality,
+      CLooG is designed to avoid control overhead and to produce a very
+      effective code.
+    '';
+
+    homepage = http://www.cloog.org/;
+
+    license = stdenv.lib.licenses.gpl2Plus;
+
+    /* Leads to an ICE on Cygwin:
+
+       make[3]: Entering directory `/tmp/nix-build-9q5gw5m37q5l4f0kjfv9ar8fsc9plk27-ppl-0.10.2.drv-1/ppl-0.10.2/src'
+       /bin/sh ../libtool --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I. -I..  -I.. -I../src    -g -O2 -frounding-math  -W -Wall -c -o Box.lo Box.cc
+       libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I.. -I.. -I../src -g -O2 -frounding-math -W -Wall -c Box.cc  -DDLL_EXPORT -DPIC -o .libs/Box.o
+       In file included from checked.defs.hh:595,
+                        from Checked_Number.defs.hh:27,
+                        from Coefficient.types.hh:15,
+                        from Coefficient.defs.hh:26,
+                        from Box.defs.hh:28,
+                        from Box.cc:24:
+       checked.inlines.hh: In function `Parma_Polyhedra_Library::Result Parma_Polyhedra_Library::Checked::input_generic(Type&, std::istream&, Parma_Polyhedra_Library::Rounding_Dir)':
+       checked.inlines.hh:607: internal compiler error: in invert_truthvalue, at fold-const.c:2719
+       Please submit a full bug report,
+       with preprocessed source if appropriate.
+       See <URL:http://cygwin.com/problems.html> for instructions.
+       make[3]: *** [Box.lo] Error 1
+
+    */
+    platforms = stdenv.lib.platforms.unix; # Once had cygwin problems
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/cloog/default.nix b/nixpkgs/pkgs/development/libraries/cloog/default.nix
new file mode 100644
index 000000000000..902e0b26687b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/cloog/default.nix
@@ -0,0 +1,64 @@
+{ fetchurl, stdenv, gmp, isl }:
+
+stdenv.mkDerivation rec {
+  name = "cloog-0.18.4";
+
+  src = fetchurl {
+    url = "http://www.bastoul.net/cloog/pages/download/count.php3?url=./${name}.tar.gz";
+    sha256 = "03km1aqaiy3sbqc2f046ms9x0mlmacxlvs5rxsvjj8nf20vxynij";
+  };
+
+  buildInputs = [ gmp ];
+
+  propagatedBuildInputs = [ isl ];
+
+  configureFlags = [ "--with-isl=system" ];
+
+  # Breaks the test cases
+  #enableParallelBuilding = true;
+
+  doCheck = true;
+
+  meta = {
+    description = "Library that generates loops for scanning polyhedra";
+
+    longDescription = ''
+      CLooG is a free software library to generate code for scanning
+      Z-polyhedra.  That is, it finds a code (e.g., in C, FORTRAN...) that
+      reaches each integral point of one or more parameterized polyhedra.
+      CLooG has been originally written to solve the code generation problem
+      for optimizing compilers based on the polytope model.  Nevertheless it
+      is used now in various area e.g., to build control automata for
+      high-level synthesis or to find the best polynomial approximation of a
+      function.  CLooG may help in any situation where scanning polyhedra
+      matters.  While the user has full control on generated code quality,
+      CLooG is designed to avoid control overhead and to produce a very
+      effective code.
+    '';
+
+    homepage = http://www.cloog.org/;
+
+    license = stdenv.lib.licenses.gpl2Plus;
+
+    /* Leads to an ICE on Cygwin:
+
+       make[3]: Entering directory `/tmp/nix-build-9q5gw5m37q5l4f0kjfv9ar8fsc9plk27-ppl-0.10.2.drv-1/ppl-0.10.2/src'
+       /bin/sh ../libtool --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I. -I..  -I.. -I../src    -g -O2 -frounding-math  -W -Wall -c -o Box.lo Box.cc
+       libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I.. -I.. -I../src -g -O2 -frounding-math -W -Wall -c Box.cc  -DDLL_EXPORT -DPIC -o .libs/Box.o
+       In file included from checked.defs.hh:595,
+                        from Checked_Number.defs.hh:27,
+                        from Coefficient.types.hh:15,
+                        from Coefficient.defs.hh:26,
+                        from Box.defs.hh:28,
+                        from Box.cc:24:
+       checked.inlines.hh: In function `Parma_Polyhedra_Library::Result Parma_Polyhedra_Library::Checked::input_generic(Type&, std::istream&, Parma_Polyhedra_Library::Rounding_Dir)':
+       checked.inlines.hh:607: internal compiler error: in invert_truthvalue, at fold-const.c:2719
+       Please submit a full bug report,
+       with preprocessed source if appropriate.
+       See <URL:http://cygwin.com/problems.html> for instructions.
+       make[3]: *** [Box.lo] Error 1
+
+    */
+    platforms = stdenv.lib.platforms.unix; # Once had cygwin problems
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/clucene-core/2.x.nix b/nixpkgs/pkgs/development/libraries/clucene-core/2.x.nix
new file mode 100644
index 000000000000..91347813a24f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/clucene-core/2.x.nix
@@ -0,0 +1,57 @@
+{stdenv, fetchurl, cmake, boost, zlib}:
+
+stdenv.mkDerivation rec {
+  name = "clucene-core-2.3.3.4";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/clucene/${name}.tar.gz";
+    sha256 = "1arffdwivig88kkx685pldr784njm0249k0rb1f1plwavlrw9zfx";
+  };
+
+  nativeBuildInputs = [ cmake ];
+
+  buildInputs = [ boost zlib ];
+
+  cmakeFlags = [
+    "-DBUILD_CONTRIBS=ON"
+    "-DBUILD_CONTRIBS_LIB=ON"
+    "-DCMAKE_BUILD_WITH_INSTALL_NAME_DIR=ON"
+  ] ++ stdenv.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"
+    "-D_CL_HAVE_NO_SNWPRINTF_BUG_EXITCODE=0"
+    "-D_CL_HAVE_TRY_BLOCKS_EXITCODE=0"
+    "-D_CL_HAVE_PTHREAD_MUTEX_RECURSIVE=0"
+    "-DLUCENE_STATIC_CONSTANT_SYNTAX_EXITCODE=0"
+  ];
+
+  patches = # From debian
+    [ ./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 ];
+
+  # 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";
+
+  meta = with stdenv.lib; {
+    description = "Core library for full-featured text search engine";
+    longDescription = ''
+      CLucene is a high-performance, scalable, cross platform, full-featured,
+      open-source indexing and searching API. Specifically, CLucene is the guts
+      of a search engine, the hard stuff. You write the easy stuff: the UI and
+      the process of selecting and parsing your data files to pump them into
+      the search engine yourself, and any specialized queries to pull it back
+      for display or further processing.
+
+      CLucene is a port of the very popular Java Lucene text search engine API.
+    '';
+    homepage = http://clucene.sourceforge.net;
+    platforms = platforms.unix;
+    license = with licenses; [ asl20 lgpl2 ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/clucene-core/Fix-pkgconfig-file-by-adding-clucene-shared-library.patch b/nixpkgs/pkgs/development/libraries/clucene-core/Fix-pkgconfig-file-by-adding-clucene-shared-library.patch
new file mode 100644
index 000000000000..80e49a8e712e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/clucene-core/Fix-pkgconfig-file-by-adding-clucene-shared-library.patch
@@ -0,0 +1,19 @@
+From 7be4a19b76d98260cf95040a47935f854a4ba7a4 Mon Sep 17 00:00:00 2001
+From: Valentin Rusu <kde@rusu.info>
+Date: Sat, 17 Dec 2011 13:47:58 +0100
+Subject: [PATCH] Fix .pc file by adding clucene-shared library
+
+---
+ src/core/libclucene-core.pc.cmake |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/src/core/libclucene-core.pc.cmake
++++ b/src/core/libclucene-core.pc.cmake
+@@ -6,6 +6,6 @@ includedir=${prefix}/include:${prefix}/i
+ Name: libclucene
+ Description: CLucene - a C++ search engine, ported from the popular Apache Lucene
+ Version: @CLUCENE_VERSION_MAJOR@.@CLUCENE_VERSION_MINOR@.@CLUCENE_VERSION_REVISION@.@CLUCENE_VERSION_PATCH@
+-Libs: -L${prefix}/@LIB_DESTINATION@/ -lclucene-core
++Libs: -L${prefix}/@LIB_DESTINATION@/ -lclucene-core -lclucene-shared
+ Cflags: -I${prefix}/include -I${prefix}/include/CLucene/ext
+ ~
diff --git a/nixpkgs/pkgs/development/libraries/clucene-core/Fixing_ZLIB_configuration_in_shared_CMakeLists.patch b/nixpkgs/pkgs/development/libraries/clucene-core/Fixing_ZLIB_configuration_in_shared_CMakeLists.patch
new file mode 100644
index 000000000000..f5f44a7fa2c4
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/clucene-core/Fixing_ZLIB_configuration_in_shared_CMakeLists.patch
@@ -0,0 +1,20 @@
+From 772481ca94071ddfe65102a451926e4f9aeb4d2c Mon Sep 17 00:00:00 2001
+From: Veit Jahns <idolum@users.sourceforge.net>
+Date: Thu, 26 May 2011 13:35:28 +0200
+Subject: [PATCH] Fixing ZLIB configuration in shared's CMakeLists
+
+---
+ src/shared/CMakeLists.txt |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/src/shared/CMakeLists.txt
++++ b/src/shared/CMakeLists.txt
+@@ -42,7 +42,7 @@ INCLUDE (CheckAtomicFunctions)
+ find_package(ZLIB)
+ IF ( ZLIB_FOUND )
+   SET ( EXTRA_LIBS ${EXTRA_LIBS} ${ZLIB_LIBRARY} )
+-ELSEIF ( ZLIB_FOUND )
++ELSE ( ZLIB_FOUND )
+   MESSAGE( "ZLIB not found, using local: ${clucene-ext_SOURCE_DIR}/zlib" )
+   SET(ZLIB_INCLUDE_DIR ${clucene-ext_SOURCE_DIR}/zlib )
+   SET(ZLIB_LIBRARY ${clucene-ext_BINARY_DIR})
diff --git a/nixpkgs/pkgs/development/libraries/clucene-core/Install-contribs-lib.patch b/nixpkgs/pkgs/development/libraries/clucene-core/Install-contribs-lib.patch
new file mode 100644
index 000000000000..899411fe02b4
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/clucene-core/Install-contribs-lib.patch
@@ -0,0 +1,49 @@
+Description: contribs-lib is not built and installed even with config
+Author: Vitaliy Filippov
+Bug: https://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
+ 
+---
+ CMakeLists.txt                  |    2 +-
+ src/contribs-lib/CMakeLists.txt |   17 +++++++++++++++++
+ 2 files changed, 18 insertions(+), 1 deletion(-)
+
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -163,7 +163,7 @@ IF ( BUILD_CONTRIBS )
+   SET(BUILD_CONTRIBS_LIB 1)
+ ENDIF ( BUILD_CONTRIBS )
+ IF ( BUILD_CONTRIBS_LIB )
+-  ADD_SUBDIRECTORY (src/contribs-lib EXCLUDE_FROM_ALL)
++  ADD_SUBDIRECTORY (src/contribs-lib)
+ ENDIF ( BUILD_CONTRIBS_LIB )
+ 
+ 
+--- a/src/contribs-lib/CMakeLists.txt
++++ b/src/contribs-lib/CMakeLists.txt
+@@ -106,9 +106,26 @@ add_library(clucene-contribs-lib SHARED
+ )
+ TARGET_LINK_LIBRARIES(clucene-contribs-lib ${clucene_contrib_extra_libs})
+ 
++#install public headers.
++FOREACH(file ${HEADERS})
++	get_filename_component(apath ${file} PATH)
++	get_filename_component(aname ${file} NAME)
++	file(RELATIVE_PATH relpath ${CMAKE_SOURCE_DIR}/src/contribs-lib ${apath})
++	IF ( NOT aname MATCHES "^_.*" )
++		install(FILES ${file} 
++		        DESTINATION include/${relpath}
++		        COMPONENT development)
++	ENDIF ( NOT aname MATCHES "^_.*" )
++ENDFOREACH(file)
++
+ #set properties on the libraries
+ SET_TARGET_PROPERTIES(clucene-contribs-lib PROPERTIES
+     VERSION ${CLUCENE_VERSION}
+     SOVERSION ${CLUCENE_SOVERSION}
+     COMPILE_DEFINITIONS_DEBUG _DEBUG
+ )
++
++#and install library
++install(TARGETS clucene-contribs-lib 
++        DESTINATION ${LIB_DESTINATION}  
++        COMPONENT runtime )
diff --git a/nixpkgs/pkgs/development/libraries/clucene-core/default.nix b/nixpkgs/pkgs/development/libraries/clucene-core/default.nix
new file mode 100644
index 000000000000..8451b0853729
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/clucene-core/default.nix
@@ -0,0 +1,29 @@
+{stdenv, fetchurl}:
+
+stdenv.mkDerivation rec {
+  name = "clucene-core-0.9.21b";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/clucene/${name}.tar.bz2";
+    sha256 = "202ee45af747f18642ae0a088d7c4553521714a511a1a9ec99b8144cf9928317";
+  };
+
+  patches = [ ./gcc6.patch ];
+
+  meta = with stdenv.lib; {
+    description = "Core library for full-featured text search engine";
+    longDescription = ''
+      CLucene is a high-performance, scalable, cross platform, full-featured,
+      open-source indexing and searching API. Specifically, CLucene is the guts
+      of a search engine, the hard stuff. You write the easy stuff: the UI and
+      the process of selecting and parsing your data files to pump them into
+      the search engine yourself, and any specialized queries to pull it back
+      for display or further processing.
+
+      CLucene is a port of the very popular Java Lucene text search engine API.
+    '';
+    homepage = http://clucene.sourceforge.net;
+    platforms = platforms.linux;
+    license = with licenses; [ asl20 lgpl2 ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/clucene-core/fix-darwin.patch b/nixpkgs/pkgs/development/libraries/clucene-core/fix-darwin.patch
new file mode 100644
index 000000000000..c06413f3c2e1
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/clucene-core/fix-darwin.patch
@@ -0,0 +1,75 @@
+--- a/src/shared/CLucene/LuceneThreads.h
++++ b/src/shared/CLucene/LuceneThreads.h
+@@ -7,6 +7,9 @@
+ #ifndef _LuceneThreads_h
+ #define  _LuceneThreads_h
+
++#if defined(_CL_HAVE_PTHREAD)
++	#include <pthread.h>
++#endif
+
+ CL_NS_DEF(util)
+ class CLuceneThreadIdCompare;
+
+--- a/src/shared/CLucene/config/repl_tchar.h
++++ b/src/shared/CLucene/config/repl_tchar.h
+@@ -28,26 +28,26 @@
+         #define _istdigit iswdigit //* digit char check
+         #define _totlower towlower //* convert char to lower case
+         #define _totupper towupper //* convert char to lower case
+-        #define _tcslwr wcslwr //* convert string to lower case
++        #define _tcslwr std::wcslwr //* convert string to lower case
+ 
+         //these are the string handling functions
+         //we may need to create wide-character/multi-byte replacements for these
+-        #define _tcscpy wcscpy //copy a string to another string
+-        #define _tcsncpy wcsncpy //copy a specified amount of one string to another string.
+-        #define _tcscat wcscat //copy a string onto the end of the other string
+-    		#define _tcsncat wcsncat
+-        #define _tcschr wcschr //find location of one character
+-        #define _tcsstr wcsstr //find location of a string
+-        #define _tcslen wcslen //get length of a string
+-        #define _tcscmp wcscmp //case sensitive compare two strings
+-        #define _tcsncmp wcsncmp //case sensitive compare two strings
+-        #define _tcscspn wcscspn //location of any of a set of character in a string
++        #define _tcscpy std::wcscpy //copy a string to another string
++        #define _tcsncpy std::wcsncpy //copy a specified amount of one string to another string.
++        #define _tcscat std::wcscat //copy a string onto the end of the other string
++    		#define _tcsncat std::wcsncat
++        #define _tcschr std::wcschr //find location of one character
++        #define _tcsstr std::wcsstr //find location of a string
++        #define _tcslen std::wcslen //get length of a string
++        #define _tcscmp std::wcscmp //case sensitive compare two strings
++        #define _tcsncmp std::wcsncmp //case sensitive compare two strings
++        #define _tcscspn std::wcscspn //location of any of a set of character in a string
+ 
+ 				//string compare
+         #ifdef _CL_HAVE_FUNCTION_WCSICMP
+-            #define _tcsicmp wcsicmp //* case insensitive compare two string
++            #define _tcsicmp std::wcsicmp //* case insensitive compare two string
+         #else
+-            #define _tcsicmp wcscasecmp //* case insensitive compare two string
++            #define _tcsicmp std::wcscasecmp //* case insensitive compare two string
+         #endif
+ 				#if defined(_CL_HAVE_FUNCTION_WCSDUP)
+ 			  	#define _tcsdup	wcsdup
+@@ -56,8 +56,8 @@
+ 			  #endif
+ 
+         //conversion functions
+-        #define _tcstod wcstod //convert a string to a double
+-        #define _tcstoi64 wcstoll //* convers a string to an 64bit bit integer
++        #define _tcstod std::wcstod //convert a string to a double
++        #define _tcstoi64 std::wcstoll //* convers a string to an 64bit bit integer
+         #define _itot _i64tot
+         #define _i64tot lltow //* converts a 64 bit integer to a string (with base)
+     #else //if defined(_ASCII)
+@@ -105,7 +105,7 @@
+     //some tchar headers miss these...
+     #ifndef _tcstoi64
+         #if defined(_UCS2)
+-        	#define _tcstoi64 wcstoll //* convers a string to an 64bit bit integer
++        	#define _tcstoi64 std::wcstoll //* convers a string to an 64bit bit integer
+         #else
+         	#define _tcstoi64 strtoll
+         #endif
diff --git a/nixpkgs/pkgs/development/libraries/clucene-core/gcc6.patch b/nixpkgs/pkgs/development/libraries/clucene-core/gcc6.patch
new file mode 100644
index 000000000000..f78b26d24f6a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/clucene-core/gcc6.patch
@@ -0,0 +1,146 @@
+https://bugzilla.redhat.com/show_bug.cgi?id=998477
+
+diff -up clucene-core-0.9.21b/src/CLucene/debug/lucenebase.h.gcc48 clucene-core-0.9.21b/src/CLucene/debug/lucenebase.h
+--- clucene-core-0.9.21b/src/CLucene/debug/lucenebase.h.gcc48	2008-10-23 12:44:35.000000000 -0500
++++ clucene-core-0.9.21b/src/CLucene/debug/lucenebase.h	2013-08-27 13:17:35.754234297 -0500
+@@ -58,7 +58,7 @@ public:
+ 		__cl_refcount--;
+ 		return __cl_refcount;
+ 	}
+-    virtual ~LuceneBase(){};
++    virtual ~LuceneBase() throw(CLuceneError&) {};
+ };
+ 
+ class LuceneVoidBase{
+diff -up clucene-core-0.9.21b/src/CLucene/index/CompoundFile.cpp.gcc48 clucene-core-0.9.21b/src/CLucene/index/CompoundFile.cpp
+--- clucene-core-0.9.21b/src/CLucene/index/CompoundFile.cpp.gcc48	2013-08-27 13:17:35.754234297 -0500
++++ clucene-core-0.9.21b/src/CLucene/index/CompoundFile.cpp	2013-08-27 13:18:02.844949386 -0500
+@@ -94,7 +94,7 @@ CompoundFileReader::CompoundFileReader(D
+    )
+ }
+ 
+-CompoundFileReader::~CompoundFileReader(){
++CompoundFileReader::~CompoundFileReader() throw(CLuceneError&) {
+ 	close();
+ }
+ 
+diff -up clucene-core-0.9.21b/src/CLucene/index/CompoundFile.h.gcc48 clucene-core-0.9.21b/src/CLucene/index/CompoundFile.h
+--- clucene-core-0.9.21b/src/CLucene/index/CompoundFile.h.gcc48	2008-10-23 12:44:37.000000000 -0500
++++ clucene-core-0.9.21b/src/CLucene/index/CompoundFile.h	2013-08-27 13:17:35.755234286 -0500
+@@ -95,7 +95,7 @@ protected:
+ 
+ public:
+ 	CompoundFileReader(CL_NS(store)::Directory* dir, char* name);
+-	~CompoundFileReader();
++	~CompoundFileReader() throw(CLuceneError&);
+ 	CL_NS(store)::Directory* getDirectory();
+ 	const char* getName() const;
+ 
+diff -up clucene-core-0.9.21b/src/CLucene/index/Term.cpp.gcc48 clucene-core-0.9.21b/src/CLucene/index/Term.cpp
+--- clucene-core-0.9.21b/src/CLucene/index/Term.cpp.gcc48	2008-10-23 12:44:37.000000000 -0500
++++ clucene-core-0.9.21b/src/CLucene/index/Term.cpp	2013-08-27 13:17:35.755234286 -0500
+@@ -81,7 +81,7 @@ Term::Term(const TCHAR* fld, const TCHAR
+     set(fld,txt);
+ }
+ 
+-Term::~Term(){
++Term::~Term() throw (CLuceneError&) {
+ //Func - Destructor.
+ //Pre  - true
+ //Post - The instance has been destroyed. field and text have been deleted if pre(intrn) is false
+diff -up clucene-core-0.9.21b/src/CLucene/index/Term.h.gcc48 clucene-core-0.9.21b/src/CLucene/index/Term.h
+--- clucene-core-0.9.21b/src/CLucene/index/Term.h.gcc48	2008-10-23 12:44:37.000000000 -0500
++++ clucene-core-0.9.21b/src/CLucene/index/Term.h	2013-08-27 13:17:35.755234286 -0500
+@@ -68,7 +68,7 @@ class Term:LUCENE_REFBASE {
+ 	Term(const TCHAR* fld, const TCHAR* txt);
+ 	
+ 	///Destructor.
+-	~Term();
++	~Term() throw(CLuceneError&);
+ 
+ 	///Returns the field of this term, an interned string. The field indicates
+ 	///the part of a document which this term came from. 
+diff -up clucene-core-0.9.21b/src/CLucene/store/Directory.h.gcc48 clucene-core-0.9.21b/src/CLucene/store/Directory.h
+--- clucene-core-0.9.21b/src/CLucene/store/Directory.h.gcc48	2008-10-23 12:44:36.000000000 -0500
++++ clucene-core-0.9.21b/src/CLucene/store/Directory.h	2013-08-27 13:17:35.756234276 -0500
+@@ -41,7 +41,7 @@ CL_NS_DEF(store)
+ 	public:
+ 		DEFINE_MUTEX(THIS_LOCK)
+ 	   
+-		virtual ~Directory(){ };
++		virtual ~Directory() throw(CLuceneError&) { };
+ 
+ 		// Returns an null terminated array of strings, one for each file in the directory. 
+ 		char** list() const{
+diff -up clucene-core-0.9.21b/src/CLucene/store/FSDirectory.cpp.gcc48 clucene-core-0.9.21b/src/CLucene/store/FSDirectory.cpp
+--- clucene-core-0.9.21b/src/CLucene/store/FSDirectory.cpp.gcc48	2008-10-23 13:01:52.000000000 -0500
++++ clucene-core-0.9.21b/src/CLucene/store/FSDirectory.cpp	2013-08-27 13:17:35.756234276 -0500
+@@ -368,7 +368,7 @@ void FSDirectory::FSIndexInput::readInte
+       strcat(buffer,name);
+   }
+ 
+-  FSDirectory::~FSDirectory(){
++  FSDirectory::~FSDirectory() throw(CLuceneError&) {
+   }
+ 
+   void FSDirectory::list(vector<string>* names) const{ //todo: fix this, ugly!!!
+diff -up clucene-core-0.9.21b/src/CLucene/store/FSDirectory.h.gcc48 clucene-core-0.9.21b/src/CLucene/store/FSDirectory.h
+--- clucene-core-0.9.21b/src/CLucene/store/FSDirectory.h.gcc48	2008-10-23 13:00:43.000000000 -0500
++++ clucene-core-0.9.21b/src/CLucene/store/FSDirectory.h	2013-08-27 13:17:35.756234276 -0500
+@@ -155,7 +155,7 @@
+ 	  ///Destructor - only call this if you are sure the directory
+ 	  ///is not being used anymore. Otherwise use the ref-counting
+ 	  ///facilities of _CLDECDELETE
+-		~FSDirectory();
++		~FSDirectory() throw(CLuceneError&);
+ 
+ 		/// Get a list of strings, one for each file in the directory. 
+ 		void list(vector<string>* names) const;
+diff -up clucene-core-0.9.21b/src/CLucene/store/RAMDirectory.cpp.gcc48 clucene-core-0.9.21b/src/CLucene/store/RAMDirectory.cpp
+--- clucene-core-0.9.21b/src/CLucene/store/RAMDirectory.cpp.gcc48	2008-10-23 12:44:36.000000000 -0500
++++ clucene-core-0.9.21b/src/CLucene/store/RAMDirectory.cpp	2013-08-27 13:17:35.757234265 -0500
+@@ -219,7 +219,7 @@ CL_NS_DEF(store)
+   {
+   }
+   
+-  RAMDirectory::~RAMDirectory(){
++  RAMDirectory::~RAMDirectory() throw(CLuceneError&) {
+    //todo: should call close directory?
+   }
+ 
+diff -up clucene-core-0.9.21b/src/CLucene/store/RAMDirectory.h.gcc48 clucene-core-0.9.21b/src/CLucene/store/RAMDirectory.h
+--- clucene-core-0.9.21b/src/CLucene/store/RAMDirectory.h.gcc48	2008-10-23 12:44:36.000000000 -0500
++++ clucene-core-0.9.21b/src/CLucene/store/RAMDirectory.h	2013-08-27 13:17:35.757234265 -0500
+@@ -131,7 +131,7 @@ CL_NS_DEF(store)
+ 	  ///Destructor - only call this if you are sure the directory
+ 	  ///is not being used anymore. Otherwise use the ref-counting
+ 	  ///facilities of dir->close
+-		virtual ~RAMDirectory();
++		virtual ~RAMDirectory() throw(CLuceneError&);
+ 		RAMDirectory(Directory* dir);
+ 		
+ 	  /**
+diff -up clucene-core-0.9.21b/src/CLucene/store/TransactionalRAMDirectory.cpp.gcc48 clucene-core-0.9.21b/src/CLucene/store/TransactionalRAMDirectory.cpp
+--- clucene-core-0.9.21b/src/CLucene/store/TransactionalRAMDirectory.cpp.gcc48	2008-10-23 12:44:36.000000000 -0500
++++ clucene-core-0.9.21b/src/CLucene/store/TransactionalRAMDirectory.cpp	2013-08-27 13:17:35.757234265 -0500
+@@ -16,7 +16,7 @@ CL_NS_USE(util)
+   {
+     transOpen = false;
+   }
+-  TransactionalRAMDirectory::~TransactionalRAMDirectory(){
++  TransactionalRAMDirectory::~TransactionalRAMDirectory() throw(CLuceneError&) {
+   }
+ 
+   bool TransactionalRAMDirectory::archiveOrigFileIfNecessary(const char* name) {
+diff -up clucene-core-0.9.21b/src/CLucene/store/TransactionalRAMDirectory.h.gcc48 clucene-core-0.9.21b/src/CLucene/store/TransactionalRAMDirectory.h
+--- clucene-core-0.9.21b/src/CLucene/store/TransactionalRAMDirectory.h.gcc48	2008-10-23 12:44:36.000000000 -0500
++++ clucene-core-0.9.21b/src/CLucene/store/TransactionalRAMDirectory.h	2013-08-27 13:17:35.757234265 -0500
+@@ -44,7 +44,7 @@ CL_NS_DEF(store)
+ 
+   public:
+     TransactionalRAMDirectory();
+-    virtual ~TransactionalRAMDirectory();
++    virtual ~TransactionalRAMDirectory() throw(CLuceneError&);
+ 
+     bool transIsOpen() const;
+     void transStart();
diff --git a/nixpkgs/pkgs/development/libraries/clutter-gst/default.nix b/nixpkgs/pkgs/development/libraries/clutter-gst/default.nix
new file mode 100644
index 000000000000..9577bfe9e8a2
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/clutter-gst/default.nix
@@ -0,0 +1,35 @@
+{ fetchurl, stdenv, pkgconfig, clutter, gtk3, glib, cogl, gnome3, gdk_pixbuf }:
+
+let
+  pname = "clutter-gst";
+  version = "3.0.27";
+in stdenv.mkDerivation rec {
+  name = "${pname}-${version}";
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${name}.tar.xz";
+    sha256 = "17czmpl92dzi4h3rn5rishk015yi3jwiw29zv8qan94xcmnbssgy";
+  };
+
+  propagatedBuildInputs = [ clutter gtk3 glib cogl gdk_pixbuf ];
+  nativeBuildInputs = [ pkgconfig ];
+
+  postBuild = "rm -rf $out/share/gtk-doc";
+
+  passthru = {
+    updateScript = gnome3.updateScript {
+      packageName = pname;
+    };
+  };
+
+  meta = {
+    description = "GStreamer bindings for clutter";
+
+    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
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/clutter-gtk/default.nix b/nixpkgs/pkgs/development/libraries/clutter-gtk/default.nix
new file mode 100644
index 000000000000..d59bc5161af5
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/clutter-gtk/default.nix
@@ -0,0 +1,37 @@
+{ fetchurl, stdenv, pkgconfig, meson, ninja
+, gobject-introspection, clutter, gtk3, gnome3 }:
+
+let
+  pname = "clutter-gtk";
+  version = "1.8.4";
+in
+
+stdenv.mkDerivation rec {
+  name = "${pname}-${version}";
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${name}.tar.xz";
+    sha256 = "01ibniy4ich0fgpam53q252idm7f4fn5xg5qvizcfww90gn9652j";
+  };
+
+  outputs = [ "out" "dev" ];
+
+  propagatedBuildInputs = [ clutter gtk3 ];
+  nativeBuildInputs = [ meson ninja pkgconfig gobject-introspection ];
+
+  postBuild = "rm -rf $out/share/gtk-doc";
+
+  passthru = {
+    updateScript = gnome3.updateScript {
+      packageName = pname;
+    };
+  };
+
+  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
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/clutter/default.nix b/nixpkgs/pkgs/development/libraries/clutter/default.nix
new file mode 100644
index 000000000000..7095a808540f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/clutter/default.nix
@@ -0,0 +1,61 @@
+{ stdenv, fetchurl, pkgconfig, libGLU_combined, libX11, libXext, libXfixes
+, libXdamage, libXcomposite, libXi, libxcb, cogl, pango, atk, json-glib
+, gobject-introspection, gtk3, gnome3, libinput, libgudev, libxkbcommon
+}:
+
+let
+  pname = "clutter";
+  version = "1.26.2";
+in
+stdenv.mkDerivation rec {
+  name = "${pname}-${version}";
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${name}.tar.xz";
+    sha256 = "0mif1qnrpkgxi43h7pimim6w6zwywa16ixcliw0yjm9hk0a368z7";
+  };
+
+  outputs = [ "out" "dev" ];
+
+  buildInputs = [ gtk3 ];
+  nativeBuildInputs = [ pkgconfig ];
+  propagatedBuildInputs =
+    [ libX11 libGLU_combined libXext libXfixes libXdamage libXcomposite libXi cogl pango
+      atk json-glib gobject-introspection libxcb libinput libgudev libxkbcommon
+    ];
+
+  configureFlags = [ "--enable-introspection" ]; # needed by muffin AFAIK
+
+  #doCheck = true; # no tests possible without a display
+
+  passthru = {
+    updateScript = gnome3.updateScript {
+      packageName = pname;
+    };
+  };
+
+  meta = {
+    description = "Library for creating fast, dynamic graphical user interfaces";
+
+    longDescription =
+      '' Clutter is free software library for creating fast, compelling,
+         portable, and dynamic graphical user interfaces.  It is a core part
+         of MeeGo, and is supported by the open source community.  Its
+         development is sponsored by Intel.
+
+         Clutter uses OpenGL for rendering (and optionally OpenGL|ES for use
+         on mobile and embedded platforms), but wraps an easy to use,
+         efficient, flexible API around GL's complexity.
+
+         Clutter enforces no particular user interface style, but provides a
+         rich, generic foundation for higher-level toolkits tailored to
+         specific needs.
+      '';
+
+    license = stdenv.lib.licenses.lgpl2Plus;
+    homepage = http://www.clutter-project.org/;
+
+    maintainers = with stdenv.lib.maintainers; [ lethalman ];
+    platforms = stdenv.lib.platforms.mesaPlatforms;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/cmark/default.nix b/nixpkgs/pkgs/development/libraries/cmark/default.nix
new file mode 100644
index 000000000000..ede2049b6ee9
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/cmark/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchFromGitHub, cmake }:
+
+stdenv.mkDerivation rec {
+  version = "0.29.0";
+  name = "cmark-${version}";
+
+  src = fetchFromGitHub {
+    owner = "jgm";
+    repo = "cmark";
+    rev = version;
+    sha256 = "0r7jpqhgnssq444i8pwji2g36058vfzwkl70wbiwj13h4w5rfc8f";
+  };
+
+  nativeBuildInputs = [ cmake ];
+  doCheck = !stdenv.isDarwin;
+  preCheck = ''
+    export LD_LIBRARY_PATH=$(readlink -f ./src)
+  '';
+
+  meta = with stdenv.lib; {
+    description = "CommonMark parsing and rendering library and program in C";
+    homepage = https://github.com/jgm/cmark;
+    maintainers = [ maintainers.michelk ];
+    platforms = platforms.unix;
+    license = licenses.bsd2;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/cminpack/default.nix b/nixpkgs/pkgs/development/libraries/cminpack/default.nix
new file mode 100644
index 000000000000..cb4f3e39aefa
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/cminpack/default.nix
@@ -0,0 +1,26 @@
+{stdenv, fetchurl}:
+
+stdenv.mkDerivation rec {
+  name = "cminpack-1.3.6";
+  
+  src = fetchurl {
+    url = "http://devernay.free.fr/hacks/cminpack/${name}.tar.gz";
+    sha256 = "17yh695aim508x1kn9zf6g13jxwk3pi3404h5ix4g5lc60hzs1rw";
+  };
+
+  patchPhase = ''
+    sed -i s,/usr/local,$out, Makefile
+  '';
+
+  preInstall = ''
+    mkdir -p $out/lib $out/include
+  '';
+
+  meta = {
+    homepage = http://devernay.free.fr/hacks/cminpack/cminpack.html;
+    license = stdenv.lib.licenses.bsd3;
+    description = "Software for solving nonlinear equations and nonlinear least squares problems";
+    platforms = stdenv.lib.platforms.linux;
+  };
+
+}
diff --git a/nixpkgs/pkgs/development/libraries/cmocka/default.nix b/nixpkgs/pkgs/development/libraries/cmocka/default.nix
new file mode 100644
index 000000000000..ae110846ff06
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/cmocka/default.nix
@@ -0,0 +1,49 @@
+{ fetchurl, stdenv, cmake }:
+
+stdenv.mkDerivation rec {
+  pname = "cmocka";
+  majorVersion = "1.1";
+  version = "${majorVersion}.5";
+
+  src = fetchurl {
+    url = "https://cmocka.org/files/${majorVersion}/cmocka-${version}.tar.xz";
+    sha256 = "1dm8pdvkyfa8dsbz9bpq7wwgixjij4sii9bbn5sgvqjm5ljdik7h";
+  };
+
+  nativeBuildInputs = [ cmake ];
+
+  meta = with stdenv.lib; {
+    description = "Lightweight library to simplify and generalize unit tests for C";
+
+    longDescription =
+      ''There are a variety of C unit testing frameworks available however
+        many of them are fairly complex and require the latest compiler
+        technology.  Some development requires the use of old compilers which
+        makes it difficult to use some unit testing frameworks. In addition
+        many unit testing frameworks assume the code being tested is an
+        application or module that is targeted to the same platform that will
+        ultimately execute the test.  Because of this assumption many
+        frameworks require the inclusion of standard C library headers in the
+        code module being tested which may collide with the custom or
+        incomplete implementation of the C library utilized by the code under
+        test.
+
+        Cmocka only requires a test application is linked with the standard C
+        library which minimizes conflicts with standard C library headers.
+        Also, CMocka tries to avoid the use of some of the newer features of
+        C compilers.
+
+        This results in CMocka being a relatively small library that can be
+        used to test a variety of exotic code. If a developer wishes to
+        simply test an application with the latest compiler then other unit
+        testing frameworks may be preferable.
+
+        This is the successor of Google's Cmockery.'';
+
+    homepage = https://cmocka.org/;
+
+    license = licenses.asl20;
+    platforms = platforms.all;
+    maintainers = with maintainers; [ kragniz rasendubi ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/cmrt/default.nix b/nixpkgs/pkgs/development/libraries/cmrt/default.nix
new file mode 100644
index 000000000000..8044d7165f75
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/cmrt/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchurl, autoreconfHook, pkgconfig, libdrm, libva }:
+
+stdenv.mkDerivation rec {
+  name = "cmrt-${version}";
+  version = "1.0.6";
+
+  src = fetchurl {
+    url = "https://github.com/intel/cmrt/archive/${version}.tar.gz";
+    sha256 = "1q7651nvvcqhph5rgfhklm71zqd0c405mrh3wx0cfzvil82yj8na";
+  };
+
+  nativeBuildInputs = [ autoreconfHook pkgconfig ];
+
+  buildInputs = [ libdrm libva ];
+
+  meta = with stdenv.lib; {
+    homepage = https://01.org/linuxmedia;
+    description = "Intel C for Media Runtime";
+    longDescription = "Media GPU kernel manager for Intel G45 & HD Graphics family";
+    license = licenses.mit;
+    maintainers = with maintainers; [ tadfisher ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/codec2/default.nix b/nixpkgs/pkgs/development/libraries/codec2/default.nix
new file mode 100644
index 000000000000..9f4c4c3b6b36
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/codec2/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchsvn, cmake } :
+
+let
+  version = "0.8";
+
+in stdenv.mkDerivation {
+  name = "codec2-${version}";
+
+  src = fetchsvn {
+    url = "https://svn.code.sf.net/p/freetel/code/codec2/branches/${version}";
+    sha256 = "0qbyaqdn37253s30n6m2ric8nfdsxhkslb9h572kdx18j2yjccki";
+  };
+
+  enableParallelBuilding = true;
+
+  nativeBuildInputs = [ cmake ];
+
+  meta = with stdenv.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;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ markuskowa ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/cogl/default.nix b/nixpkgs/pkgs/development/libraries/cogl/default.nix
new file mode 100644
index 000000000000..cff32ca2d70f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/cogl/default.nix
@@ -0,0 +1,81 @@
+{ stdenv, fetchurl, fetchpatch, pkgconfig, libGL, glib, gdk_pixbuf, xorg, libintl
+, pangoSupport ? true, pango, cairo, gobject-introspection, wayland, gnome3
+, mesa_noglu
+, gstreamerSupport ? true, gst_all_1 }:
+
+let
+  pname = "cogl";
+in stdenv.mkDerivation rec {
+  name = "${pname}-${version}";
+  version = "1.22.4";
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${name}.tar.xz";
+    sha256 = "1q0drs82a8f6glg1v29bb6g2nf15fw0rvdx3d0rgcgfarfaby5sj";
+  };
+
+  patches = [
+    # Some deepin packages need the following patches. They have been
+    # submitted by Fedora on the GNOME Bugzilla
+    # (https://bugzilla.gnome.org/787443). Upstream thinks the patch
+    # could be merged, but dev can not make a new release.
+
+    (fetchpatch {
+      url = https://bug787443.bugzilla-attachments.gnome.org/attachment.cgi?id=359589;
+      sha256 = "0f0d9iddg8zwy853phh7swikg4yzhxxv71fcag36f8gis0j5p998";
+    })
+
+    (fetchpatch {
+      url = https://bug787443.bugzilla-attachments.gnome.org/attachment.cgi?id=361056;
+      sha256 = "09fyrdci4727fg6qm5aaapsbv71sf4wgfaqz8jqlyy61dibgg490";
+    })
+  ];
+
+  outputs = [ "out" "dev" ];
+
+  nativeBuildInputs = [ pkgconfig libintl ];
+
+  configureFlags = [
+    "--enable-introspection"
+    "--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" ];
+
+  propagatedBuildInputs = with xorg; [
+      glib gdk_pixbuf gobject-introspection wayland mesa_noglu
+      libGL libXrandr libXfixes libXcomposite libXdamage
+    ]
+    ++ stdenv.lib.optionals gstreamerSupport [ gst_all_1.gstreamer
+                                               gst_all_1.gst-plugins-base ];
+
+  buildInputs = stdenv.lib.optionals pangoSupport [ pango cairo ];
+
+  COGL_PANGO_DEP_CFLAGS
+    = stdenv.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)
+
+  passthru = {
+    updateScript = gnome3.updateScript {
+      packageName = pname;
+    };
+  };
+
+  meta = with stdenv.lib; {
+    description = "A small open source library for using 3D graphics hardware for rendering";
+    maintainers = with maintainers; [ lovek323 ];
+
+    longDescription = ''
+      Cogl is a small open source library for using 3D graphics hardware for
+      rendering. The API departs from the flat state machine style of OpenGL
+      and is designed to make it easy to write orthogonal components that can
+      render without stepping on each other's toes.
+    '';
+
+    platforms = platforms.mesaPlatforms;
+    license = with licenses; [ mit bsd3 publicDomain sgi-b-20 ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/coin3d/default.nix b/nixpkgs/pkgs/development/libraries/coin3d/default.nix
new file mode 100644
index 000000000000..442ed2a4b9a5
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/coin3d/default.nix
@@ -0,0 +1,33 @@
+{ fetchurl, stdenv, libGLU_combined }:
+
+stdenv.mkDerivation rec {
+  name = "coin3d-${version}";
+  version = "3.1.3";
+
+  src = fetchurl {
+    url = "https://bitbucket.org/Coin3D/coin/downloads/Coin-${version}.tar.gz";
+    sha256 = "05ylhrcglm81dajbk132l1w892634z2i97x10fm64y1ih72phd2q";
+  };
+
+  patches = [
+    (fetchurl {
+      url = http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/media-libs/coin/files/coin-3.1.3-gcc-4.7.patch;
+      name = "gcc-4.7.patch";
+      sha256 = "076dyc52swk8qc7ylps53fg6iqmd52x8s7m18i80x49dd109yw20";
+    })
+    ./gcc-4.8.patch # taken from FC-17 source rpm
+    # see https://bitbucket.org/Coin3D/coin/issues/128/crash-in-cc_memalloc_deallocate
+    # patch adapted from https://bitbucket.org/Coin3D/coin/pull-requests/75/added-fix-for-issue-128-provided-by-fedora/diff
+    ./sbhashentry.patch
+  ];
+
+  buildInputs = [ libGLU_combined ];
+
+  meta = {
+    homepage = http://www.coin3d.org/;
+    license = stdenv.lib.licenses.gpl2Plus;
+    description = "High-level, retained-mode toolkit for effective 3D graphics development";
+    maintainers = [ stdenv.lib.maintainers.viric ];
+    platforms = stdenv.lib.platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/coin3d/gcc-4.8.patch b/nixpkgs/pkgs/development/libraries/coin3d/gcc-4.8.patch
new file mode 100644
index 000000000000..be5b8b03b638
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/coin3d/gcc-4.8.patch
@@ -0,0 +1,38 @@
+From 9f5d96a2b9a71ab539237d2dab4c54fc46fc5c5b Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Ralf=20Cors=C3=A9pius?= <corsepiu@corsepiu.home>
+Date: Thu, 18 Apr 2013 19:17:06 +0200
+Subject: [PATCH 10/10] GCC-4.8.0 fixes
+
+---
+ src/fonts/freetype.cpp | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/src/fonts/freetype.cpp b/src/fonts/freetype.cpp
+index 760b88b..e705d3a 100644
+--- a/src/fonts/freetype.cpp
++++ b/src/fonts/freetype.cpp
+@@ -32,18 +32,18 @@
+ 
+    20050613 mortene. */
+ 
+-#include "fonts/freetype.h"
+-
+ #ifdef HAVE_CONFIG_H
+ #include "config.h"
+ #endif /* HAVE_CONFIG_H */
+ 
+-#include <stdlib.h>
++#include <cstdlib>
+ #include <assert.h>
+ 
+ #include "glue/freetype.h"
+ #include "glue/GLUWrapper.h"
+ 
++#include "fonts/freetype.h"
++
+ /* ************************************************************************* */
+ 
+ #ifdef __cplusplus
+-- 
+1.8.1.4
+
diff --git a/nixpkgs/pkgs/development/libraries/coin3d/sbhashentry.patch b/nixpkgs/pkgs/development/libraries/coin3d/sbhashentry.patch
new file mode 100644
index 000000000000..88c9a5f02a25
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/coin3d/sbhashentry.patch
@@ -0,0 +1,25 @@
+diff -u --label /tmp/Coin-3.1.3/src/misc/SbHash.h --label \#\<buffer\ SbHash.h\> /tmp/Coin-3.1.3/src/misc/SbHash.h /tmp/buffer-content-21756V0
+--- a/src/misc/SbHash.h
++++ b/src/misc/SbHash.h
+@@ -88,8 +88,8 @@
+     SbHashEntry<Type, Key> * entry = static_cast<SbHashEntry<Type, Key> *>( ptr);
+     cc_memalloc_deallocate(entry->memhandler, ptr);
+   }
+-  SbHashEntry(const Key & key, const Type & obj) : key(key), obj(obj) {}
+-
++  SbHashEntry(const Key & key, const Type & obj, cc_memalloc *memhandler)
++		: key(key), obj(obj), memhandler(memhandler) {}
+   Key key;
+   Type obj;
+   SbHashEntry<Type, Key> * next;
+@@ -218,7 +218,7 @@
+     /* Key not already in the hash table; insert a new
+      * entry as the first element in the bucket
+      */
+-    entry = new (this->memhandler) SbHashEntry<Type, Key>(key, obj);
++    entry = new (this->memhandler) SbHashEntry<Type, Key>(key, obj, this->memhandler);
+     entry->next = this->buckets[i];
+     this->buckets[i] = entry;
+
+
+Diff finished.  Sat Sep  9 19:50:32 2017
diff --git a/nixpkgs/pkgs/development/libraries/commoncpp2/default.nix b/nixpkgs/pkgs/development/libraries/commoncpp2/default.nix
new file mode 100644
index 000000000000..0c5ab7585833
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/commoncpp2/default.nix
@@ -0,0 +1,38 @@
+{ fetchurl, stdenv }:
+
+stdenv.mkDerivation rec {
+  name = "commoncpp2-1.8.1";
+
+  src = fetchurl {
+    url = "mirror://gnu/commoncpp/${name}.tar.gz";
+    sha256 = "0kmgr5w3b1qwzxnsnw94q6rqs0hr8nbv9clf07ca2a2fyypx9kjk";
+  };
+
+  doCheck = true;
+
+  preBuild = ''
+    echo '#include <sys/stat.h>' >> inc/cc++/config.h
+  '';
+
+  meta = {
+    description = "GNU Common C++, a portable, highly optimized C++ class framework";
+
+    longDescription =
+      '' GNU Common C++ and GNU uCommon are very portable and highly
+         optimized class framework for writing C++ applications that need to
+         use threads and support concurrent sychronization, and that use
+         sockets, XML parsing, object serialization, thread-optimized String
+         and data structure classes, etc.  This framework offers a class
+         foundation that hides platform differences from your C++ application
+         so that you need not write platform specific code.  GNU Common C++
+         has been ported to compile nativily on most platforms which support
+         either posix threads, or on maybe be used with Debian hosted mingw32
+         to build native threading applications for Microsoft Windows.
+      '';
+
+    homepage = https://www.gnu.org/software/commoncpp/;
+    license = stdenv.lib.licenses.gpl2Plus;
+    maintainers = [ stdenv.lib.maintainers.marcweber ];
+    platforms = with stdenv.lib.platforms; linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/concurrencykit/default.nix b/nixpkgs/pkgs/development/libraries/concurrencykit/default.nix
new file mode 100644
index 000000000000..29ce216cadf1
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/concurrencykit/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name    = "concurrencykit-${version}";
+  version = "0.6.0";
+
+  src = fetchurl {
+    url    = "http://concurrencykit.org/releases/ck-${version}.tar.gz";
+    sha256 = "1pv21p7sjwwmbs2xblpy1lqk53r2i212yrqyjlr5dr3rlv87vqnp";
+  };
+  
+  #Deleting this line causes "Unknown option --disable-static"
+  configurePhase = "./configure --prefix=$out";
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    description = "A library of safe, high-performance concurrent data structures";
+    homepage    = http://concurrencykit.org;
+    license     = licenses.bsd2;
+    platforms   = platforms.unix;
+    maintainers = [ maintainers.thoughtpolice ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/coprthr/default.nix b/nixpkgs/pkgs/development/libraries/coprthr/default.nix
new file mode 100644
index 000000000000..5630daa0d933
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/coprthr/default.nix
@@ -0,0 +1,38 @@
+{ stdenv, fetchurl, libelf, libconfig, libevent, which, unzip, perl, python
+, bison, flex }:
+
+stdenv.mkDerivation rec {
+  name = "coprthr-${version}";
+  version = "1.6";
+
+  src = fetchurl {
+    url    = "https://github.com/browndeer/coprthr/archive/stable-${version}.zip";
+    sha256 = "0ilx4v1ydppjnq1i0z5j0x4lmi29z39sappar7c0wqady0b5dpz9";
+  };
+
+  buildInputs =
+    [ libelf libconfig libevent which unzip perl python bison flex ];
+
+  patchPhase = ''
+    for x in src/libocl/gen_oclcall_hook.pl tools/cltrace/gen_interceptor.pl src/libocl/gen_oclcall.pl src/scripts/gen_ocl_call_vector.pl src/libstdcl/gen_clarg_setn.pl; do
+      substituteInPlace $x --replace "/usr/bin/perl" ${perl}/bin/perl
+    done
+  '';
+
+  configureFlags =
+    [ "--with-libelf=${libelf}"
+      "--with-libevent=${libevent.dev}"
+      "--with-libconfig=${libconfig}"
+      "--with-opencl-icd-path=$out/etc/OpenCL/vendors"
+      "--enable-user-install"
+    ];
+
+  meta = {
+    description = "The CO-PRocessing THReads SDK for OpenCL/STDCL";
+    homepage    = "http://www.browndeertechnology.com/coprthr.htm";
+    license     = stdenv.lib.licenses.lgpl3;
+    platforms   = stdenv.lib.platforms.linux;
+    maintainers = [ stdenv.lib.maintainers.thoughtpolice ];
+    broken = true;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/coredumper/default.nix b/nixpkgs/pkgs/development/libraries/coredumper/default.nix
new file mode 100644
index 000000000000..ddd0d87a5511
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/coredumper/default.nix
@@ -0,0 +1,18 @@
+{stdenv, fetchurl}:
+
+stdenv.mkDerivation {
+  name = "coredumper-1.1";
+  src = fetchurl {
+    url = http://google-coredumper.googlecode.com/files/coredumper-1.1.tar.gz;
+    sha256 = "1phl1zg2n17rp595dyzz9iw01gfdpsdh0l6wy2hfb5shi71h63rx";
+  };
+
+  # Doesn't build:
+  #
+  # src/elfcore.c: In function 'CreatePipeline':
+  # src/elfcore.c:1424:26: error: 'CLONE_VM' undeclared (first use in this function)
+  #                           CLONE_VM|CLONE_UNTRACED|SIGCHLD, &args, 0, 0, 0);
+  #                           ^
+  # src/elfcore.c:1424:26: note: each undeclared identifier is reported only once for each function it appears in
+  meta.broken = true;
+}
diff --git a/nixpkgs/pkgs/development/libraries/cpp-hocon/default.nix b/nixpkgs/pkgs/development/libraries/cpp-hocon/default.nix
new file mode 100644
index 000000000000..c2f3ce9b9b4a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/cpp-hocon/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchFromGitHub, cmake, boost, curl, leatherman }:
+
+stdenv.mkDerivation rec {
+  name = "cpp-hocon-${version}";
+  version = "0.2.1";
+
+  src = fetchFromGitHub {
+    sha256 = "0ar7q3rp46m01wvfa289bxnk9xma3ydc67by7i4nrpz8vamvhwc3";
+    rev = version;
+    repo = "cpp-hocon";
+    owner = "puppetlabs";
+  };
+
+  nativeBuildInputs = [ cmake ];
+
+  buildInputs = [ boost curl leatherman ];
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    inherit (src.meta) homepage;
+    description = " A C++ port of the Typesafe Config library";
+    license = licenses.asl20;
+    maintainers = [ maintainers.womfoo ];
+    platforms = platforms.linux;
+  };
+
+}
diff --git a/nixpkgs/pkgs/development/libraries/cpp-ipfs-api/default.nix b/nixpkgs/pkgs/development/libraries/cpp-ipfs-api/default.nix
new file mode 100644
index 000000000000..c13b32a67b06
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/cpp-ipfs-api/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchFromGitHub, curl, cmake, nlohmann_json }:
+
+stdenv.mkDerivation rec {
+  name = "cpp-ipfs-api-${version}";
+  version = "2017-01-04";
+
+  src = fetchFromGitHub {
+    owner = "vasild";
+    repo = "cpp-ipfs-api";
+    rev = "96a890f4518665a56581a2a52311eaa65928eac8";
+    sha256 = "1z6gbd7npg4pd9wmdyzcp9h12sg84d7a43c69pp4lzqkyqg8pz1g";
+  };
+
+  buildInputs = [ cmake curl ];
+  propagatedBuildInputs = [ nlohmann_json ];
+
+  meta = with stdenv.lib; {
+    description = "IPFS C++ API client library";
+    homepage = https://github.com/vasild/cpp-ipfs-api;
+    license = licenses.mit;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/cpp-netlib/default.nix b/nixpkgs/pkgs/development/libraries/cpp-netlib/default.nix
new file mode 100644
index 000000000000..badfc630a47e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/cpp-netlib/default.nix
@@ -0,0 +1,30 @@
+{ stdenv, fetchurl, cmake, boost, openssl, asio }:
+
+stdenv.mkDerivation rec {
+  name = "cpp-netlib-${version}";
+  version = "0.12.0";
+
+  src = fetchurl {
+    url = "http://downloads.cpp-netlib.org/${version}/${name}-final.tar.bz2";
+    sha256 = "0h7gyrbr3madycnj8rl8k1jzk2hd8np2k5ad9mijlh0fizzzk3h8";
+  };
+
+  buildInputs = [ cmake boost openssl ];
+
+  # This can be removed when updating to 0.13, see https://github.com/cpp-netlib/cpp-netlib/issues/629
+  propagatedBuildInputs = [ asio ];
+
+  cmakeFlags = [
+    "-DCPP-NETLIB_BUILD_SHARED_LIBS=ON"
+  ];
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    description =
+      "Collection of open-source libraries for high level network programming";
+    homepage    = https://cpp-netlib.org;
+    license     = licenses.boost;
+    platforms   = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/cppcms/default.nix b/nixpkgs/pkgs/development/libraries/cppcms/default.nix
new file mode 100644
index 000000000000..a2493e55fb0b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/cppcms/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchurl, cmake, pcre, zlib, python, openssl }:
+
+stdenv.mkDerivation rec {
+  name = "cppcms-${version}";
+  version = "1.2.1";
+
+  src = fetchurl {
+      url = "mirror://sourceforge/cppcms/${name}.tar.bz2";
+      sha256 = "0lmcdjzicmzhnr8pa0q3f5lgapz2cnh9w0dr56i4kj890iqwgzhh";
+  };
+
+  enableParallelBuilding = true;
+
+  buildInputs = [ cmake pcre zlib python openssl ];
+
+  cmakeFlags = [
+    "--no-warn-unused-cli"
+  ];
+
+  meta = with stdenv.lib; {
+    homepage = http://cppcms.com;
+    description = "High Performance C++ Web Framework";
+    platforms = platforms.linux ;
+    license = licenses.lgpl3;
+    maintainers = [ maintainers.juliendehos ];
+  };
+}
+
diff --git a/nixpkgs/pkgs/development/libraries/cppdb/default.nix b/nixpkgs/pkgs/development/libraries/cppdb/default.nix
new file mode 100644
index 000000000000..3423b29d76c8
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/cppdb/default.nix
@@ -0,0 +1,26 @@
+{ stdenv, fetchurl, cmake, sqlite, mysql, postgresql, unixODBC }:
+
+stdenv.mkDerivation rec {
+  name = "cppdb-${version}";
+  version = "0.3.1";
+
+  src = fetchurl {
+      url = "mirror://sourceforge/cppcms/${name}.tar.bz2";
+      sha256 = "0blr1casmxickic84dxzfmn3lm7wrsl4aa2abvpq93rdfddfy3nn";
+  };
+
+  enableParallelBuilding = true;
+
+  buildInputs = [ cmake sqlite mysql.connector-c postgresql unixODBC ];
+
+  cmakeFlags = [ "--no-warn-unused-cli" ];
+  NIX_CFLAGS_COMPILE = [ "-I${mysql.connector-c}/include/mysql" "-L${mysql.connector-c}/lib/mysql" ];
+
+  meta = with stdenv.lib; {
+    homepage = http://cppcms.com/sql/cppdb/;
+    description = "C++ Connectivity library that supports MySQL, PostgreSQL, Sqlite3 databases and generic ODBC drivers";
+    platforms = platforms.linux ;
+    license = licenses.boost;
+    maintainers = [ maintainers.juliendehos ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/cpptest/default.nix b/nixpkgs/pkgs/development/libraries/cpptest/default.nix
new file mode 100644
index 000000000000..e663c87f799e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/cpptest/default.nix
@@ -0,0 +1,18 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "cpptest-2.0.0";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/project/cpptest/cpptest/${name}/${name}.tar.gz";
+    sha256 = "0lpy3f2fjx1srh02myanlp6zfi497whlldcrnij39ghfhm0arcnm";
+  };
+
+  meta = with stdenv.lib; {
+    homepage = http://cpptest.sourceforge.net/;
+    description = "Simple C++ unit testing framework";
+    maintainers = with maintainers; [ bosu ];
+    license = stdenv.lib.licenses.lgpl3;
+    platforms = with platforms; linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/cppunit/default.nix b/nixpkgs/pkgs/development/libraries/cppunit/default.nix
new file mode 100644
index 000000000000..3f8b2d896ac6
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/cppunit/default.nix
@@ -0,0 +1,18 @@
+{stdenv, fetchurl}:
+
+stdenv.mkDerivation rec {
+  name = "cppunit-${version}";
+  version = "1.14.0";
+
+  src = fetchurl {
+    url = "https://dev-www.libreoffice.org/src/${name}.tar.gz";
+    sha256 = "1027cyfx5gsjkdkaf6c2wnjh68882grw8n672018cj3vs9lrhmix";
+  };
+
+  meta = with stdenv.lib; {
+    homepage = https://freedesktop.org/wiki/Software/cppunit/;
+    description = "C++ unit testing framework";
+    license = licenses.lgpl21;
+    platforms = platforms.linux ++ platforms.darwin;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/cpputest/default.nix b/nixpkgs/pkgs/development/libraries/cpputest/default.nix
new file mode 100644
index 000000000000..2dce60d4b2c4
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/cpputest/default.nix
@@ -0,0 +1,19 @@
+{stdenv, fetchurl}:
+
+stdenv.mkDerivation rec {
+  version = "3.8";
+  name = "cpputest-${version}";
+
+  src = fetchurl {
+    url = "https://github.com/cpputest/cpputest/releases/download/v${version}/${name}.tar.gz";
+    sha256 = "0mk48xd3klyqi7wf3f4wn4zqxxzmvrhhl32r25jzrixzl72wq7f8";
+  };
+
+  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 ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/cppzmq/default.nix b/nixpkgs/pkgs/development/libraries/cppzmq/default.nix
new file mode 100644
index 000000000000..4c63e93e5c41
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/cppzmq/default.nix
@@ -0,0 +1,30 @@
+{ stdenv, fetchFromGitHub, cmake, zeromq }:
+
+stdenv.mkDerivation rec {
+  name = "cppzmq-${version}";
+  version = "4.3.0";
+
+  src = fetchFromGitHub {
+    owner = "zeromq";
+    repo = "cppzmq";
+    rev = "v${version}";
+    sha256 = "1g45cdny1m08zw4l261bqcqfdb825mnwjwqcf35bkyc03fr4213l";
+  };
+
+  nativeBuildInputs = [ cmake ];
+  buildInputs = [ zeromq ];
+
+  cmakeFlags = [
+    # Tests try to download googletest at compile time; there is no option
+    # to use a system one and no simple way to download it beforehand.
+    "-DCPPZMQ_BUILD_TESTS=OFF"
+  ];
+
+  meta = with stdenv.lib; {
+    homepage = https://github.com/zeromq/cppzmq;
+    license = licenses.bsd2;
+    description = "C++ binding for 0MQ";
+    maintainers = with maintainers; [ abbradar ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/cracklib/default.nix b/nixpkgs/pkgs/development/libraries/cracklib/default.nix
new file mode 100644
index 000000000000..ea3f5e6476bc
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/cracklib/default.nix
@@ -0,0 +1,41 @@
+let version = "2.9.7"; in
+{ stdenv, lib, buildPackages, fetchurl, zlib, gettext
+, wordlists ? [ (fetchurl {
+  url = "https://github.com/cracklib/cracklib/releases/download/v${version}/cracklib-words-${version}.gz";
+  sha256 = "12fk8w06q628v754l357cf8kfjna98wj09qybpqr892az3x4a33z";
+}) ]
+}:
+
+stdenv.mkDerivation rec {
+  pname = "cracklib";
+  inherit version;
+
+  src = fetchurl {
+    url = "https://github.com/${pname}/${pname}/releases/download/v${version}/${pname}-${version}.tar.bz2";
+    sha256 = "1rimpjsdnmw8f5b7k558cic41p2qy2n2yrlqp5vh7mp4162hk0py";
+  };
+
+  nativeBuildInputs = lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) buildPackages.cracklib;
+  buildInputs = [ zlib gettext ];
+
+  postPatch = ''
+    chmod +x util/cracklib-format
+    patchShebangs util
+
+    ln -vs ${toString wordlists} dicts/
+  '';
+
+  postInstall = ''
+    make dict-local
+  '';
+  doInstallCheck = true;
+  installCheckTarget = "test";
+
+  meta = with lib; {
+    homepage    = https://github.com/cracklib/cracklib;
+    description = "A library for checking the strength of passwords";
+    license = licenses.lgpl21; # Different license for the wordlist: http://www.openwall.com/wordlists
+    maintainers = with maintainers; [ lovek323 ];
+    platforms   = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/cre2/default.nix b/nixpkgs/pkgs/development/libraries/cre2/default.nix
new file mode 100644
index 000000000000..74619cbaaaed
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/cre2/default.nix
@@ -0,0 +1,34 @@
+{ stdenv, fetchFromGitHub, autoreconfHook,
+  libtool, pkgconfig, re2, texinfo }:
+
+stdenv.mkDerivation rec {
+  name = "cre2-${version}";
+  version = "0.3.0";
+    
+  src = fetchFromGitHub {
+    owner = "marcomaggi";
+    repo = "cre2";
+    rev = version;
+    sha256 = "12yrdad87jjqrhbqm02hzsayan2402vf61a9x1b2iabv6d1c1bnj";
+  };
+
+  nativeBuildInputs = [
+    autoreconfHook
+    libtool
+    pkgconfig
+  ];
+  buildInputs = [ re2 texinfo ];
+
+  NIX_LDFLAGS="-lre2 -lpthread";
+
+  configureFlags = [
+    "--enable-maintainer-mode"
+  ];
+
+  meta = with stdenv.lib; {
+    homepage = http://marcomaggi.github.io/docs/cre2.html;
+    description = "C Wrapper for RE2";
+    license = licenses.bsd3;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/croaring/default.nix b/nixpkgs/pkgs/development/libraries/croaring/default.nix
new file mode 100644
index 000000000000..6e6ee2479d44
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/croaring/default.nix
@@ -0,0 +1,28 @@
+{ lib, stdenv, fetchFromGitHub, fetchpatch, cmake }:
+
+stdenv.mkDerivation rec {
+  pname = "croaring";
+  version = "0.2.61";
+
+  src = fetchFromGitHub {
+    owner = "RoaringBitmap";
+    repo = "CRoaring";
+    rev = "v${version}";
+    sha256 = "14y8iwv6b6gg7hgs00yqg8rwx4vwbb1zs2s99lxa51zx9vp1alcn";
+  };
+
+  patches = fetchpatch {
+    url = "https://github.com/RoaringBitmap/CRoaring/commit/8d8c60736f506b2b8f1c365148a8a541b26a55f2.patch";
+    sha256 = "1y2mbn4i8lj3lkn5s8zziyr9pl1fq9hndzz9c01dkv3s8sn7f55s";
+  };
+
+  nativeBuildInputs = [ cmake ];
+
+  meta = with lib; {
+    description = "Compressed bitset library for C and C++";
+    homepage = http://roaringbitmap.org/;
+    license = licenses.asl20;
+    maintainers = with maintainers; [ orivej ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/crypto++/GNUmakefile-darwin.patch b/nixpkgs/pkgs/development/libraries/crypto++/GNUmakefile-darwin.patch
new file mode 100644
index 000000000000..5a6cb3bcafb4
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/crypto++/GNUmakefile-darwin.patch
@@ -0,0 +1,15 @@
+diff --git a/GNUmakefile b/GNUmakefile
+index 4de9d10..ff4789a 100755
+--- a/GNUmakefile
++++ b/GNUmakefile
+@@ -271,8 +271,8 @@ endif # OpenMP
+ endif # IS_LINUX
+ 
+ ifneq ($(IS_DARWIN),0)
+-AR = libtool
+-ARFLAGS = -static -o
++AR = ar
++ARFLAGS = cru
+ CXX ?= c++
+ ifeq ($(IS_GCC_29),1)
+ CXXFLAGS += -fno-coalesce-templates -fno-coalesce-static-vtables
diff --git a/nixpkgs/pkgs/development/libraries/crypto++/default.nix b/nixpkgs/pkgs/development/libraries/crypto++/default.nix
new file mode 100644
index 000000000000..61a825cd3745
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/crypto++/default.nix
@@ -0,0 +1,49 @@
+{ fetchFromGitHub, stdenv }:
+
+stdenv.mkDerivation rec {
+  name = "crypto++-${version}";
+  majorVersion = "5.6";
+  version = "${majorVersion}.5";
+
+  src = fetchFromGitHub {
+    owner = "weidai11";
+    repo = "cryptopp";
+    rev = "CRYPTOPP_5_6_5";
+    sha256 = "1yk7jyf4va9425cg05llskpls2jm7n3jwy2hj5jm74zkr4mwpvl7";
+  };
+
+  patches = stdenv.lib.concatLists [
+    (stdenv.lib.optional (stdenv.hostPlatform.system != "i686-cygwin") ./dll.patch)
+    (stdenv.lib.optional stdenv.hostPlatform.isDarwin ./GNUmakefile-darwin.patch)
+  ];
+
+
+  configurePhase = ''
+      sed -i GNUmakefile \
+        -e 's|-march=native|-fPIC|g' \
+        -e '/^CXXFLAGS =/s|-g ||'
+  '';
+
+  enableParallelBuilding = true;
+
+  makeFlags = [ "PREFIX=$(out)" ];
+  buildFlags = [ "libcryptopp.so" ];
+  installFlags = [ "LDCONF=true" ];
+
+  doCheck = true;
+  checkPhase = "LD_LIBRARY_PATH=`pwd` make test";
+
+  # prefer -fPIC and .so to .a; cryptotest.exe seems superfluous
+  postInstall = ''
+    rm "$out"/lib/*.a -r "$out/bin"
+    ln -sf "$out"/lib/libcryptopp.so.${version} "$out"/lib/libcryptopp.so.${majorVersion}
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Crypto++, a free C++ class library of cryptographic schemes";
+    homepage = http://cryptopp.com/;
+    license = licenses.boost;
+    platforms = platforms.all;
+    maintainers = [ ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/crypto++/dll.patch b/nixpkgs/pkgs/development/libraries/crypto++/dll.patch
new file mode 100644
index 000000000000..12df1fb9e9e9
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/crypto++/dll.patch
@@ -0,0 +1,28 @@
+Get rid of Windows-specific stuff.
+
+diff --git a/GNUmakefile b/GNUmakefile
+index 4de9d10..ff4789a 100755
+--- a/GNUmakefile
++++ b/GNUmakefile
+@@ -656,7 +656,7 @@ nolib: $(OBJS)
+ dll: cryptest.import.exe dlltest.exe
+ 
+ cryptopp.dll: $(DLLOBJS)
+-	$(CXX) -shared -o $@ $(CXXFLAGS) $(DLLOBJS) $(LDFLAGS) $(LDLIBS) -Wl,--out-implib=libcryptopp.dll.a
++	$(CXX) -shared -o $@ $(CXXFLAGS) $(DLLOBJS) $(LDFLAGS) $(LDLIBS)
+ 
+ libcryptopp.import.a: $(LIBIMPORTOBJS)
+ 	$(AR) $(ARFLAGS) $@ $(LIBIMPORTOBJS)
+diff --git a/dll.cpp b/dll.cpp
+index 72dade9..b5097ab 100644
+--- a/dll.cpp
++++ b/dll.cpp
+@@ -48,7 +48,7 @@ NAMESPACE_END
+ 

+ #endif

+ 

+-#ifdef CRYPTOPP_EXPORTS

++#if defined CRYPTOPP_EXPORTS && defined _MSC_VER

+ 

+ USING_NAMESPACE(CryptoPP)

+ 

diff --git a/nixpkgs/pkgs/development/libraries/csfml/default.nix b/nixpkgs/pkgs/development/libraries/csfml/default.nix
new file mode 100644
index 000000000000..9b74ecdb0f7e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/csfml/default.nix
@@ -0,0 +1,30 @@
+{ stdenv, fetchFromGitHub, cmake, sfml }:
+
+let
+  version = "2.4";
+in
+
+stdenv.mkDerivation {
+  name = "csfml-${version}";
+  src = fetchFromGitHub {
+    owner = "SFML";
+    repo  = "CSFML";
+    rev   = "b5facb85d13bff451a5fd2d088a97472a685576c";
+    sha256 = "1q716gd7c7jlxzwpq5z4rjj5lsrn71ql2djphccdf9jannllqizn";
+  };
+  buildInputs = [ cmake sfml ];
+  cmakeFlags = [ "-DCMAKE_MODULE_PATH=${sfml}/share/SFML/cmake/Modules/" ];
+
+  meta = with stdenv.lib; {
+    homepage = https://www.sfml-dev.org/;
+    description = "Simple and fast multimedia library";
+    longDescription = ''
+      SFML is a simple, fast, cross-platform and object-oriented multimedia API.
+      It provides access to windowing, graphics, audio and network.
+      It is written in C++, and has bindings for various languages such as C, .Net, Ruby, Python.
+    '';
+    license = licenses.zlib;
+    maintainers = [ maintainers.jpdoyle ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/ctl/default.nix b/nixpkgs/pkgs/development/libraries/ctl/default.nix
new file mode 100644
index 000000000000..71e301044766
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/ctl/default.nix
@@ -0,0 +1,31 @@
+{ stdenv, fetchFromGitHub, fetchpatch, cmake, pkgconfig, ilmbase, libtiff, openexr }:
+
+stdenv.mkDerivation rec {
+  pname = "ctl";
+  version = "1.5.2";
+
+  src = fetchFromGitHub {
+    owner = "ampas";
+    repo = pname;
+    rev = "${pname}-${version}";
+    sha256 = "0a698rd1cmixh3mk4r1xa6rjli8b8b7dbx89pb43xkgqxy67glwx";
+  };
+
+  patches = [
+    (fetchpatch {
+      name = "ctl-1.5.2-ilm_230.patch";
+      url = "https://src.fedoraproject.org/rpms/CTL/raw/9d7c15a91bccdc0a9485d463bf2789be72e6b17d/f/ctl-1.5.2-ilm_230.patch";
+      sha256 = "0mdx7llwrm0q8ai53zhyxi40i9h5s339dbkqpqv30yzi2xpnfj3d";
+    })
+  ];
+
+  nativeBuildInputs = [ cmake pkgconfig ];
+  buildInputs = [ libtiff ilmbase openexr ];
+
+  meta = with stdenv.lib; {
+    description = "Color Transformation Language";
+    homepage = "https://github.com/ampas/CTL";
+    license = "A.M.P.A.S"; # BSD-derivative, free but GPL incompatible
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/ctpl/default.nix b/nixpkgs/pkgs/development/libraries/ctpl/default.nix
new file mode 100644
index 000000000000..fd81de5139d6
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/ctpl/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, fetchurl, pkgconfig, glib }:
+
+stdenv.mkDerivation rec {
+  name = "ctpl-${version}";
+  version = "0.3.4";
+
+  src = fetchurl {
+    url = "https://download.tuxfamily.org/ctpl/releases/ctpl-${version}.tar.gz";
+    sha256 = "1yr92xv9n6kgyixwg9ps4zb404ic5pgb171k4bi3mv9p6k8gv59s";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ glib ];
+
+  meta = with stdenv.lib; {
+    homepage = http://ctpl.tuxfamily.org/;
+    description = "Template engine library written in C";
+    platforms = platforms.linux;
+    maintainers = [ maintainers.lethalman ];
+    license = licenses.gpl3Plus;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/ctpp2/default.nix b/nixpkgs/pkgs/development/libraries/ctpp2/default.nix
new file mode 100644
index 000000000000..5a2a53ef24d5
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/ctpp2/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchurl, cmake }:
+
+stdenv.mkDerivation rec {
+  name = "ctpp2-${version}";
+  version = "2.8.3";
+
+  src = fetchurl {
+    url = "http://ctpp.havoc.ru/download/${name}.tar.gz";
+    sha256 = "1z22zfw9lb86z4hcan9hlvji49c9b7vznh7gjm95gnvsh43zsgx8";
+  };
+
+  buildInputs = [ cmake ];
+
+  patchPhase = ''
+    # include <unistd.h> to fix undefined getcwd
+    sed -ie 's/<stdlib.h>/<stdlib.h>\n#include <unistd.h>/' src/CTPP2FileSourceLoader.cpp
+  '';
+
+  doCheck = false; # fails
+
+  meta = with stdenv.lib; {
+    description = "A high performance templating engine";
+    homepage = http://ctpp.havoc.ru;
+    maintainers = [ maintainers.robbinch ];
+    platforms = platforms.linux;
+    license = licenses.bsd2;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/curlcpp/default.nix b/nixpkgs/pkgs/development/libraries/curlcpp/default.nix
new file mode 100644
index 000000000000..a2188f687d13
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/curlcpp/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchFromGitHub, cmake, curl }: 
+
+stdenv.mkDerivation rec {
+  name = "curlcpp-${version}";
+  version = "1.1";
+
+  src = fetchFromGitHub {
+    owner = "JosephP91";
+    repo = "curlcpp";
+    rev = "${version}";
+    sha256 = "025qg5hym73xrvyhalv3jgbf9jqnnzkdjs3zwsgbpqx58zyd5bg5";
+  };
+
+  buildInputs = [ cmake curl ];
+
+  meta = with stdenv.lib; {
+    homepage = https://josephp91.github.io/curlcpp/;
+    description = "Object oriented C++ wrapper for CURL";
+    platforms = platforms.unix;
+    license = licenses.mit;
+    maintainers = with maintainers; [ juliendehos rszibele ];
+  };
+}
+
diff --git a/nixpkgs/pkgs/development/libraries/curlpp/default.nix b/nixpkgs/pkgs/development/libraries/curlpp/default.nix
new file mode 100644
index 000000000000..58f88e6d8ebf
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/curlpp/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchFromGitHub, cmake, curl }:
+
+stdenv.mkDerivation rec {
+  name = "curlpp-${version}";
+  version = "0.8.1";
+  src = fetchFromGitHub {
+    owner = "jpbarrette";
+    repo = "curlpp";
+    rev = "v${version}";
+    sha256 = "1b0ylnnrhdax4kwjq64r1fk0i24n5ss6zfzf4hxwgslny01xiwrk";
+  };
+
+  buildInputs = [ curl ];
+  nativeBuildInputs = [ cmake ];
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    homepage = https://www.curlpp.org/;
+    description = "C++ wrapper around libcURL";
+    license = licenses.mit;
+    maintainers = with maintainers; [ CrazedProgrammer ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/cutee/default.nix b/nixpkgs/pkgs/development/libraries/cutee/default.nix
new file mode 100644
index 000000000000..ba1d02380e29
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/cutee/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  pname = "cutee";
+  version = "0.4.2";
+  name = "${pname}-${version}";
+
+  src = fetchurl {
+    url    = "http://www.codesink.org/download/${pname}-${version}.tar.gz";
+    sha256 = "18bzvhzx8k24mpcim5669n3wg9hd0sfsxj8zjpbr24hywrlppgc2";
+  };
+
+  buildFlags = "cutee";
+
+  installPhase = ''
+    mkdir -p $out/bin
+    cp cutee $out/bin
+  '';
+
+  meta = with stdenv.lib; {
+    description = "C++ Unit Testing Easy Environment";
+    homepage    = http://www.codesink.org/cutee_unit_testing.html;
+    license     = licenses.gpl2Plus;
+    maintainers = with maintainers; [ leenaars];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/cutelyst/default.nix b/nixpkgs/pkgs/development/libraries/cutelyst/default.nix
new file mode 100644
index 000000000000..784a282f6b24
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/cutelyst/default.nix
@@ -0,0 +1,46 @@
+{ stdenv, lib, fetchFromGitHub, cmake, pkgconfig, makeWrapper
+, qtbase, libuuid, libcap, uwsgi, grantlee, pcre
+}:
+
+stdenv.mkDerivation rec {
+  name = "cutelyst-${version}";
+  version = "2.7.0";
+
+  src = fetchFromGitHub {
+    owner = "cutelyst";
+    repo = "cutelyst";
+    rev = "v${version}";
+    sha256 = "09cgfpr2k1jp98h1ahxqm5lmv3qbk0bcxpqpill6n5wmq2c8kl8b";
+  };
+
+  nativeBuildInputs = [ cmake pkgconfig makeWrapper ];
+  buildInputs = [ qtbase libuuid libcap uwsgi grantlee pcre ];
+
+  cmakeFlags = [
+    "-DPLUGIN_UWSGI=ON"
+    "-DPLUGIN_STATICCOMPRESSED=ON"
+    "-DPLUGIN_CSRFPROTECTION=ON"
+    "-DPLUGIN_VIEW_GRANTLEE=ON"
+  ];
+
+  preBuild = ''
+    export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:`pwd`/Cutelyst:`pwd`/EventLoopEPoll"
+  '';
+
+  postBuild = ''
+    unset LD_LIBRARY_PATH
+  '';
+
+  postInstall = ''
+    for prog in $out/bin/*; do
+      wrapProgram "$prog" --set QT_PLUGIN_PATH '${qtbase}/${qtbase.qtPluginPrefix}'
+    done
+  '';
+
+  meta = with lib; {
+    description = "C++ Web Framework built on top of Qt";
+    homepage = https://cutelyst.org/;
+    license = licenses.lgpl21Plus;
+    maintainers = with maintainers; [ fpletz ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/cwiid/default.nix b/nixpkgs/pkgs/development/libraries/cwiid/default.nix
new file mode 100644
index 000000000000..246dd009820c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/cwiid/default.nix
@@ -0,0 +1,42 @@
+{ stdenv, fetchFromGitHub, autoreconfHook, bison, flex, bluez, pkgconfig, gtk2 }:
+
+stdenv.mkDerivation rec {
+  name = "cwiid-${version}-git";
+  version = "2010-02-21";
+
+  src = fetchFromGitHub {
+    owner  = "abstrakraft";
+    repo   = "cwiid";
+    rev    = "fadf11e89b579bcc0336a0692ac15c93785f3f82";
+    sha256 = "0qdb0x757k76nfj32xc2nrrdqd9jlwgg63vfn02l2iznnzahxp0h";
+  };
+
+  hardeningDisable = [ "format" ];
+
+  configureFlags = [ "--without-python" ];
+
+  prePatch = ''
+    sed -i -e '/$(LDCONFIG)/d' common/include/lib.mak.in
+  '';
+
+  buildInputs = [ bison flex bluez gtk2 ];
+
+  nativeBuildInputs = [ autoreconfHook pkgconfig ];
+
+  NIX_LDFLAGS = [
+    "-lbluetooth"
+  ];
+
+  postInstall = ''
+    # Some programs (for example, cabal-install) have problems with the double 0
+    sed -i -e "s/0.6.00/0.6.0/" $out/lib/pkgconfig/cwiid.pc
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Linux Nintendo Wiimote interface";
+    homepage    = http://cwiid.org;
+    license     = licenses.gpl2Plus;
+    maintainers = with maintainers; [ bennofs ];
+    platforms   = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/cxx-prettyprint/default.nix b/nixpkgs/pkgs/development/libraries/cxx-prettyprint/default.nix
new file mode 100644
index 000000000000..8be68a314e3d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/cxx-prettyprint/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchFromGitHub }:
+
+stdenv.mkDerivation rec {
+  name = "cxx-prettyprint-unstable-${version}";
+  version = "2016-04-30";
+  rev = "9ab26d228f2960f50b38ad37fe0159b7381f7533";
+
+  src = fetchFromGitHub {
+    owner = "louisdx";
+    repo = "cxx-prettyprint";
+    inherit rev;
+    sha256 = "1bp25yw8fb0mi432f72ihfxfj887gi36b36fpv677gawm786l7p1";
+  };
+
+  installPhase = ''
+    mkdir -p "$out/include"
+    cp prettyprint.hpp "$out/include"
+  '';
+
+  meta = with stdenv.lib; {
+    description    = "Header only C++ library for pretty printing standard containers";
+    homepage       = https://github.com/louisdx/cxx-prettyprint;
+    license        = stdenv.lib.licenses.boost;
+    platforms      = platforms.all;
+
+    # This is a header-only library, no point in hydra building it:
+    hydraPlatforms = [];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/cxxtest/default.nix b/nixpkgs/pkgs/development/libraries/cxxtest/default.nix
new file mode 100644
index 000000000000..aa0708daaa7f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/cxxtest/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchFromGitHub, python2Packages}:
+
+let
+  pname = "cxxtest";
+  version = "4.4";
+in python2Packages.buildPythonApplication rec {
+  name = "${pname}-${version}";
+
+  src = fetchFromGitHub {
+    owner = "CxxTest";
+    repo = pname;
+    rev = version;
+    sha256 = "19w92kipfhp5wvs47l0qpibn3x49sbmvkk91yxw6nwk6fafcdl17";
+  };
+
+  setSourceRoot = ''
+    sourceRoot=$(echo */python)
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = http://cxxtest.com;
+    description = "Unit testing framework for C++";
+    platforms = platforms.unix ;
+    license = licenses.lgpl3;
+    maintainers = [ maintainers.juliendehos ];
+  };
+}
+
diff --git a/nixpkgs/pkgs/development/libraries/cxxtools/default.nix b/nixpkgs/pkgs/development/libraries/cxxtools/default.nix
new file mode 100644
index 000000000000..77b27640fd77
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/cxxtools/default.nix
@@ -0,0 +1,21 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  version = "2.2.1";
+  name = "cxxtools-${version}";
+
+  src = fetchurl {
+    url = "http://www.tntnet.org/download/${name}.tar.gz";
+    sha256 = "0hp3qkyhidxkdf8qgkwrnqq5bpahink55mf0yz23rjd7rpbbdswc";
+  };
+
+  enableParallelBuilding = true;
+
+  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 ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/cyrus-sasl/cyrus-sasl-ac-try-run-fix.patch b/nixpkgs/pkgs/development/libraries/cyrus-sasl/cyrus-sasl-ac-try-run-fix.patch
new file mode 100644
index 000000000000..8662e812e995
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/cyrus-sasl/cyrus-sasl-ac-try-run-fix.patch
@@ -0,0 +1,12 @@
+--- a/m4/sasl2.m4	2018-11-18 22:33:29.902625600 +0300
++++ b/m4/sasl2.m4	2018-11-18 22:33:59.828746176 +0300
+@@ -339,7 +339,8 @@
+ ],	
+ 	[ AC_DEFINE(HAVE_GSS_SPNEGO,,[Define if your GSSAPI implementation supports SPNEGO])
+ 	AC_MSG_RESULT(yes) ],
+-	AC_MSG_RESULT(no))
++	AC_MSG_RESULT(no),
++    AC_MSG_RESULT(no))
+   LIBS="$cmu_save_LIBS"
+ 
+ else
diff --git a/nixpkgs/pkgs/development/libraries/cyrus-sasl/default.nix b/nixpkgs/pkgs/development/libraries/cyrus-sasl/default.nix
new file mode 100644
index 000000000000..06eac4423e78
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/cyrus-sasl/default.nix
@@ -0,0 +1,48 @@
+{ lib, stdenv, fetchurl, openssl, openldap, kerberos, db, gettext
+, pam, fixDarwinDylibNames, autoreconfHook, fetchpatch, enableLdap ? false
+, buildPackages, pruneLibtoolFiles }:
+
+with stdenv.lib;
+stdenv.mkDerivation rec {
+  name = "cyrus-sasl-${version}";
+  version = "2.1.27";
+
+  src = fetchurl {
+    urls =
+      [ "http://www.cyrusimap.org/releases/${name}.tar.gz"
+        "http://www.cyrusimap.org/releases/old/${name}.tar.gz"
+      ];
+    sha256 = "1m85zcpgfdhm43cavpdkhb1s2zq1b31472hq1w1gs3xh94anp1i6";
+  };
+
+  outputs = [ "bin" "dev" "out" "man" "devdoc" ];
+
+  depsBuildBuild = [ buildPackages.stdenv.cc ];
+  nativeBuildInputs = [ autoreconfHook fixDarwinDylibNames pruneLibtoolFiles ];
+  buildInputs =
+    [ openssl db gettext kerberos ]
+    ++ lib.optional enableLdap openldap
+    ++ lib.optional stdenv.isLinux pam;
+
+  patches = [
+    ./missing-size_t.patch # https://bugzilla.redhat.com/show_bug.cgi?id=906519
+    ./cyrus-sasl-ac-try-run-fix.patch
+  ];
+
+  configureFlags = [
+    "--with-openssl=${openssl.dev}"
+    "--with-plugindir=${placeholder "out"}/lib/sasl2"
+    "--with-saslauthd=/run/saslauthd"
+    "--enable-login"
+    "--enable-shared"
+  ] ++ lib.optional enableLdap "--with-ldap=${openldap.dev}";
+
+  installFlags = lib.optional stdenv.isDarwin [ "framedir=$(out)/Library/Frameworks/SASL2.framework" ];
+
+  meta = {
+    homepage = https://www.cyrusimap.org/sasl;
+    description = "Library for adding authentication support to connection-based protocols";
+    platforms = platforms.unix;
+    license = licenses.bsdOriginal;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/cyrus-sasl/missing-size_t.patch b/nixpkgs/pkgs/development/libraries/cyrus-sasl/missing-size_t.patch
new file mode 100644
index 000000000000..da96818ca267
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/cyrus-sasl/missing-size_t.patch
@@ -0,0 +1,13 @@
+Gentoo bug #458790
+--- a/include/sasl.h	2012-10-12 17:05:48.000000000 +0300
++++ b/include/sasl.h	2013-02-23 16:56:44.648786268 +0200
+@@ -121,6 +121,9 @@
+ #ifndef SASL_H
+ #define SASL_H 1
+ 
++/* stddef.h to get size_t defined */
++#include <stddef.h>
++
+ /* Keep in sync with win32/common.mak */
+ #define SASL_VERSION_MAJOR 2
+ #define SASL_VERSION_MINOR 1
diff --git a/nixpkgs/pkgs/development/libraries/czmq/3.x.nix b/nixpkgs/pkgs/development/libraries/czmq/3.x.nix
new file mode 100644
index 000000000000..d418b879d1dd
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/czmq/3.x.nix
@@ -0,0 +1,26 @@
+{ stdenv, fetchurl, zeromq }:
+
+stdenv.mkDerivation rec {
+  version = "3.0.2";
+  name = "czmq-${version}";
+
+  src = fetchurl {
+    url = "http://download.zeromq.org/${name}.tar.gz";
+    sha256 = "16k9awrhdsymx7dnmvqcnkaq8lz8x8zppy6sh7ls8prpd6mkkjlb";
+  };
+
+  patches = [ ./czmq3-gcc7.patch ];
+
+  # Fix build on Glibc 2.24.
+  NIX_CFLAGS_COMPILE = "-Wno-error=deprecated-declarations";
+
+  # Needs to be propagated for the .pc file to work
+  propagatedBuildInputs = [ zeromq ];
+
+  meta = with stdenv.lib; {
+    homepage = http://czmq.zeromq.org/;
+    description = "High-level C Binding for ZeroMQ";
+    license = licenses.mpl20;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/czmq/4.x.nix b/nixpkgs/pkgs/development/libraries/czmq/4.x.nix
new file mode 100644
index 000000000000..06801dfb7d24
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/czmq/4.x.nix
@@ -0,0 +1,21 @@
+{ stdenv, fetchurl, fetchpatch, zeromq }:
+
+stdenv.mkDerivation rec {
+  version = "4.2.0";
+  name = "czmq-${version}";
+
+  src = fetchurl {
+    url = "https://github.com/zeromq/czmq/releases/download/v${version}/${name}.tar.gz";
+    sha256 = "1szciz62sk3fm4ga9qjpxz0n0lazvphm32km95bq92ncng12kayg";
+  };
+
+  # Needs to be propagated for the .pc file to work
+  propagatedBuildInputs = [ zeromq ];
+
+  meta = with stdenv.lib; {
+    homepage = http://czmq.zeromq.org/;
+    description = "High-level C Binding for ZeroMQ";
+    license = licenses.mpl20;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/czmq/czmq3-gcc7.patch b/nixpkgs/pkgs/development/libraries/czmq/czmq3-gcc7.patch
new file mode 100644
index 000000000000..4ab14685a6c1
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/czmq/czmq3-gcc7.patch
@@ -0,0 +1,26 @@
+diff --git a/src/zgossip_engine.inc b/src/zgossip_engine.inc
+index 37dbb4eb..727aaa9b 100644
+--- a/src/zgossip_engine.inc
++++ b/src/zgossip_engine.inc
+@@ -258,7 +258,7 @@ engine_set_log_prefix (client_t *client, const char *string)
+ {
+     if (client) {
+         s_client_t *self = (s_client_t *) client;
+-        snprintf (self->log_prefix, sizeof (self->log_prefix) - 1,
++        snprintf (self->log_prefix, sizeof (self->log_prefix),
+             "%6d:%-33s", self->unique_id, string);
+     }
+ }
+diff --git a/src/zsys.c b/src/zsys.c
+index 4d0bb8a1..f07db9c8 100644
+--- a/src/zsys.c
++++ b/src/zsys.c
+@@ -1071,7 +1071,7 @@ zsys_run_as (const char *lockfile, const char *group, const char *user)
+             }
+         }
+         //   We record the current process id in the lock file
+-        char pid_buffer [10];
++        char pid_buffer [32];
+         snprintf (pid_buffer, sizeof (pid_buffer), "%6d\n", getpid ());
+         if (write (handle, pid_buffer, strlen (pid_buffer)) != strlen (pid_buffer)) {
+             zsys_error ("cannot write to lockfile: %s", strerror (errno));
diff --git a/nixpkgs/pkgs/development/libraries/czmqpp/default.nix b/nixpkgs/pkgs/development/libraries/czmqpp/default.nix
new file mode 100644
index 000000000000..0c026b9f47a5
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/czmqpp/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchFromGitHub, autoreconfHook, pkgconfig, czmq }:
+
+stdenv.mkDerivation rec {
+  name = "czmqpp-${version}";
+  version = "1.2.0";
+
+  src = fetchFromGitHub {
+    owner = "zeromq";
+    repo = "czmqpp";
+    rev = "v${version}";
+    sha256 = "0z8lwq53yk4h7pgibicx3q9idz15qb95r0pjpz0j5vql6qh46rja";
+  };
+
+  nativeBuildInputs = [ autoreconfHook pkgconfig ];
+
+  propagatedBuildInputs = [ czmq ];
+
+  # https://github.com/zeromq/czmqpp/issues/42
+  patches = [ ./socket.patch ];
+
+  meta = with stdenv.lib; {
+    inherit (src.meta) homepage;
+    description = "C++ wrapper for czmq. Aims to be minimal, simple and consistent";
+    license = licenses.lgpl3;
+    platforms = platforms.linux ++ platforms.darwin;
+    maintainers = with maintainers; [ chris-martin ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/czmqpp/socket.patch b/nixpkgs/pkgs/development/libraries/czmqpp/socket.patch
new file mode 100644
index 000000000000..0464bcf77971
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/czmqpp/socket.patch
@@ -0,0 +1,17 @@
+--- /src/socket.cpp
++++ /src/socket.cpp
+@@ -60,12 +60,12 @@
+ int socket::bind(const std::string& address)
+ {
+     // format-security: format not a string literal and no format arguments.
+-    return zsocket_bind(self_, address.c_str());
++    return zsocket_bind(self_, "%s", address.c_str());
+ }
+ int socket::connect(const std::string& address)
+ {
+     // format-security: format not a string literal and no format arguments.
+-    return zsocket_connect(self_, address.c_str());
++    return zsocket_connect(self_, "%s", address.c_str());
+ }
+
+ bool operator==(const socket& sock_a, const socket& sock_b)
diff --git a/nixpkgs/pkgs/development/libraries/dav1d/default.nix b/nixpkgs/pkgs/development/libraries/dav1d/default.nix
new file mode 100644
index 000000000000..157a6a21f3de
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/dav1d/default.nix
@@ -0,0 +1,31 @@
+{ stdenv, fetchFromGitLab, meson, ninja, nasm }:
+
+stdenv.mkDerivation rec {
+  pname = "dav1d";
+  version = "0.3.1";
+
+  src = fetchFromGitLab {
+    domain = "code.videolan.org";
+    owner = "videolan";
+    repo = pname;
+    rev = version;
+    sha256 = "1m5vdg64iqxpi37l84mcfiq313g9z55zf66s85j2rqik6asmxbqg";
+  };
+
+  nativeBuildInputs = [ meson ninja nasm ];
+  # TODO: doxygen (currently only HTML and not build by default).
+
+  meta = with stdenv.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
+      achieve the highest speed possible to overcome the temporary lack of AV1
+      hardware decoder. It supports all features from AV1, including all
+      subsampling and bit-depth parameters.
+    '';
+    inherit (src.meta) homepage;
+    license = licenses.bsd2;
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ primeos ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/db/CVE-2017-10140-4.8-cwd-db_config.patch b/nixpkgs/pkgs/development/libraries/db/CVE-2017-10140-4.8-cwd-db_config.patch
new file mode 100644
index 000000000000..ed916fcf4d1f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/db/CVE-2017-10140-4.8-cwd-db_config.patch
@@ -0,0 +1,11 @@
+--- a/env/env_open.c.old	2017-06-26 10:32:11.011419981 +0200
++++ b/env/env_open.c	2017-06-26 10:32:46.893721233 +0200
+@@ -473,7 +473,7 @@
+ 	env->db_mode = mode == 0 ? DB_MODE_660 : mode;
+ 
+ 	/* Read the DB_CONFIG file. */
+-	if ((ret = __env_read_db_config(env)) != 0)
++	if (env->db_home != NULL && (ret = __env_read_db_config(env)) != 0)
+ 		return (ret);
+ 
+ 	/*
diff --git a/nixpkgs/pkgs/development/libraries/db/CVE-2017-10140-cwd-db_config.patch b/nixpkgs/pkgs/development/libraries/db/CVE-2017-10140-cwd-db_config.patch
new file mode 100644
index 000000000000..652e962bbe18
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/db/CVE-2017-10140-cwd-db_config.patch
@@ -0,0 +1,11 @@
+--- db-5.3.28/src/env/env_open.c.old	2017-06-26 10:32:11.011419981 +0200
++++ db-5.3.28/src/env/env_open.c	2017-06-26 10:32:46.893721233 +0200
+@@ -473,7 +473,7 @@
+ 	env->db_mode = mode == 0 ? DB_MODE_660 : mode;
+ 
+ 	/* Read the DB_CONFIG file. */
+-	if ((ret = __env_read_db_config(env)) != 0)
++	if (env->db_home != NULL && (ret = __env_read_db_config(env)) != 0)
+ 		return (ret);
+ 
+ 	/*
diff --git a/nixpkgs/pkgs/development/libraries/db/clang-4.8.patch b/nixpkgs/pkgs/development/libraries/db/clang-4.8.patch
new file mode 100644
index 000000000000..aa46b8500b5a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/db/clang-4.8.patch
@@ -0,0 +1,141 @@
+diff --git a/dbinc/atomic.h b/dbinc/atomic.h
+index 0034dcc..160c8ea 100644
+--- a/dbinc/atomic.h
++++ b/dbinc/atomic.h
+@@ -70,7 +70,7 @@ typedef struct {
+  * These have no memory barriers; the caller must include them when necessary.
+  */
+ #define	atomic_read(p)		((p)->value)
+-#define	atomic_init(p, val)	((p)->value = (val))
++#define	atomic_init_db(p, val)	((p)->value = (val))
+ 
+ #ifdef HAVE_ATOMIC_SUPPORT
+ 
+@@ -144,7 +144,7 @@ typedef LONG volatile *interlocked_val;
+ #define	atomic_inc(env, p)	__atomic_inc(p)
+ #define	atomic_dec(env, p)	__atomic_dec(p)
+ #define	atomic_compare_exchange(env, p, o, n)	\
+-	__atomic_compare_exchange((p), (o), (n))
++	__atomic_compare_exchange_int((p), (o), (n))
+ static inline int __atomic_inc(db_atomic_t *p)
+ {
+ 	int	temp;
+@@ -176,7 +176,7 @@ static inline int __atomic_dec(db_atomic_t *p)
+  * http://gcc.gnu.org/onlinedocs/gcc-4.1.0/gcc/Atomic-Builtins.html
+  * which configure could be changed to use.
+  */
+-static inline int __atomic_compare_exchange(
++static inline int __atomic_compare_exchange_int(
+ 	db_atomic_t *p, atomic_value_t oldval, atomic_value_t newval)
+ {
+ 	atomic_value_t was;
+@@ -206,7 +206,7 @@ static inline int __atomic_compare_exchange(
+ #define	atomic_dec(env, p)	(--(p)->value)
+ #define	atomic_compare_exchange(env, p, oldval, newval)		\
+ 	(DB_ASSERT(env, atomic_read(p) == (oldval)),		\
+-	atomic_init(p, (newval)), 1)
++	atomic_init_db(p, (newval)), 1)
+ #else
+ #define atomic_inc(env, p)	__atomic_inc(env, p)
+ #define atomic_dec(env, p)	__atomic_dec(env, p)
+diff --git a/mp/mp_fget.c b/mp/mp_fget.c
+index 5fdee5a..0b75f57 100644
+--- a/mp/mp_fget.c
++++ b/mp/mp_fget.c
+@@ -617,7 +617,7 @@ alloc:		/* Allocate a new buffer header and data space. */
+ 
+ 		/* Initialize enough so we can call __memp_bhfree. */
+ 		alloc_bhp->flags = 0;
+-		atomic_init(&alloc_bhp->ref, 1);
++		atomic_init_db(&alloc_bhp->ref, 1);
+ #ifdef DIAGNOSTIC
+ 		if ((uintptr_t)alloc_bhp->buf & (sizeof(size_t) - 1)) {
+ 			__db_errx(env,
+@@ -911,7 +911,7 @@ alloc:		/* Allocate a new buffer header and data space. */
+ 			MVCC_MPROTECT(bhp->buf, mfp->stat.st_pagesize,
+ 			    PROT_READ);
+ 
+-		atomic_init(&alloc_bhp->ref, 1);
++		atomic_init_db(&alloc_bhp->ref, 1);
+ 		MUTEX_LOCK(env, alloc_bhp->mtx_buf);
+ 		alloc_bhp->priority = bhp->priority;
+ 		alloc_bhp->pgno = bhp->pgno;
+diff --git a/mp/mp_mvcc.c b/mp/mp_mvcc.c
+index 34467d2..f05aa0c 100644
+--- a/mp/mp_mvcc.c
++++ b/mp/mp_mvcc.c
+@@ -276,7 +276,7 @@ __memp_bh_freeze(dbmp, infop, hp, bhp, need_frozenp)
+ #else
+ 	memcpy(frozen_bhp, bhp, SSZA(BH, buf));
+ #endif
+-	atomic_init(&frozen_bhp->ref, 0);
++	atomic_init_db(&frozen_bhp->ref, 0);
+ 	if (mutex != MUTEX_INVALID)
+ 		frozen_bhp->mtx_buf = mutex;
+ 	else if ((ret = __mutex_alloc(env, MTX_MPOOL_BH,
+@@ -428,7 +428,7 @@ __memp_bh_thaw(dbmp, infop, hp, frozen_bhp, alloc_bhp)
+ #endif
+ 		alloc_bhp->mtx_buf = mutex;
+ 		MUTEX_LOCK(env, alloc_bhp->mtx_buf);
+-		atomic_init(&alloc_bhp->ref, 1);
++		atomic_init_db(&alloc_bhp->ref, 1);
+ 		F_CLR(alloc_bhp, BH_FROZEN);
+ 	}
+ 
+diff --git a/mp/mp_region.c b/mp/mp_region.c
+index e6cece9..ddbe906 100644
+--- a/mp/mp_region.c
++++ b/mp/mp_region.c
+@@ -224,7 +224,7 @@ __memp_init(env, dbmp, reginfo_off, htab_buckets, max_nreg)
+ 			     MTX_MPOOL_FILE_BUCKET, 0, &htab[i].mtx_hash)) != 0)
+ 				return (ret);
+ 			SH_TAILQ_INIT(&htab[i].hash_bucket);
+-			atomic_init(&htab[i].hash_page_dirty, 0);
++			atomic_init_db(&htab[i].hash_page_dirty, 0);
+ 		}
+ 
+ 		/*
+@@ -269,7 +269,7 @@ __memp_init(env, dbmp, reginfo_off, htab_buckets, max_nreg)
+ 		hp->mtx_hash = (mtx_base == MUTEX_INVALID) ? MUTEX_INVALID :
+ 		    mtx_base + i;
+ 		SH_TAILQ_INIT(&hp->hash_bucket);
+-		atomic_init(&hp->hash_page_dirty, 0);
++		atomic_init_db(&hp->hash_page_dirty, 0);
+ #ifdef HAVE_STATISTICS
+ 		hp->hash_io_wait = 0;
+ 		hp->hash_frozen = hp->hash_thawed = hp->hash_frozen_freed = 0;
+diff --git a/mutex/mut_method.c b/mutex/mut_method.c
+index 2588763..5c6d516 100644
+--- a/mutex/mut_method.c
++++ b/mutex/mut_method.c
+@@ -426,7 +426,7 @@ atomic_compare_exchange(env, v, oldval, newval)
+ 	MUTEX_LOCK(env, mtx);
+ 	ret = atomic_read(v) == oldval;
+ 	if (ret)
+-		atomic_init(v, newval);
++		atomic_init_db(v, newval);
+ 	MUTEX_UNLOCK(env, mtx);
+ 
+ 	return (ret);
+diff --git a/mutex/mut_tas.c b/mutex/mut_tas.c
+index f3922e0..e40fcdf 100644
+--- a/mutex/mut_tas.c
++++ b/mutex/mut_tas.c
+@@ -46,7 +46,7 @@ __db_tas_mutex_init(env, mutex, flags)
+ 
+ #ifdef HAVE_SHARED_LATCHES
+ 	if (F_ISSET(mutexp, DB_MUTEX_SHARED))
+-		atomic_init(&mutexp->sharecount, 0);
++		atomic_init_db(&mutexp->sharecount, 0);
+ 	else
+ #endif
+ 	if (MUTEX_INIT(&mutexp->tas)) {
+@@ -486,7 +486,7 @@ __db_tas_mutex_unlock(env, mutex)
+ 			F_CLR(mutexp, DB_MUTEX_LOCKED);
+ 			/* Flush flag update before zeroing count */
+ 			MEMBAR_EXIT();
+-			atomic_init(&mutexp->sharecount, 0);
++			atomic_init_db(&mutexp->sharecount, 0);
+ 		} else {
+ 			DB_ASSERT(env, sharecount > 0);
+ 			MEMBAR_EXIT();
diff --git a/nixpkgs/pkgs/development/libraries/db/clang-5.3.patch b/nixpkgs/pkgs/development/libraries/db/clang-5.3.patch
new file mode 100644
index 000000000000..caf19ffeb92b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/db/clang-5.3.patch
@@ -0,0 +1,141 @@
+diff --git a/src/dbinc/atomic.h b/src/dbinc/atomic.h
+index 6a858f7..9f338dc 100644
+--- a/src/dbinc/atomic.h
++++ b/src/dbinc/atomic.h
+@@ -70,7 +70,7 @@ typedef struct {
+  * These have no memory barriers; the caller must include them when necessary.
+  */
+ #define	atomic_read(p)		((p)->value)
+-#define	atomic_init(p, val)	((p)->value = (val))
++#define	atomic_init_db(p, val)	((p)->value = (val))
+ 
+ #ifdef HAVE_ATOMIC_SUPPORT
+ 
+@@ -144,7 +144,7 @@ typedef LONG volatile *interlocked_val;
+ #define	atomic_inc(env, p)	__atomic_inc(p)
+ #define	atomic_dec(env, p)	__atomic_dec(p)
+ #define	atomic_compare_exchange(env, p, o, n)	\
+-	__atomic_compare_exchange((p), (o), (n))
++	__atomic_compare_exchange_int((p), (o), (n))
+ static inline int __atomic_inc(db_atomic_t *p)
+ {
+ 	int	temp;
+@@ -176,7 +176,7 @@ static inline int __atomic_dec(db_atomic_t *p)
+  * http://gcc.gnu.org/onlinedocs/gcc-4.1.0/gcc/Atomic-Builtins.html
+  * which configure could be changed to use.
+  */
+-static inline int __atomic_compare_exchange(
++static inline int __atomic_compare_exchange_int(
+ 	db_atomic_t *p, atomic_value_t oldval, atomic_value_t newval)
+ {
+ 	atomic_value_t was;
+@@ -206,7 +206,7 @@ static inline int __atomic_compare_exchange(
+ #define	atomic_dec(env, p)	(--(p)->value)
+ #define	atomic_compare_exchange(env, p, oldval, newval)		\
+ 	(DB_ASSERT(env, atomic_read(p) == (oldval)),		\
+-	atomic_init(p, (newval)), 1)
++	atomic_init_db(p, (newval)), 1)
+ #else
+ #define atomic_inc(env, p)	__atomic_inc(env, p)
+ #define atomic_dec(env, p)	__atomic_dec(env, p)
+diff --git a/src/mp/mp_fget.c b/src/mp/mp_fget.c
+index 16de695..d0dcc29 100644
+--- a/src/mp/mp_fget.c
++++ b/src/mp/mp_fget.c
+@@ -649,7 +649,7 @@ alloc:		/* Allocate a new buffer header and data space. */
+ 
+ 		/* Initialize enough so we can call __memp_bhfree. */
+ 		alloc_bhp->flags = 0;
+-		atomic_init(&alloc_bhp->ref, 1);
++		atomic_init_db(&alloc_bhp->ref, 1);
+ #ifdef DIAGNOSTIC
+ 		if ((uintptr_t)alloc_bhp->buf & (sizeof(size_t) - 1)) {
+ 			__db_errx(env, DB_STR("3025",
+@@ -955,7 +955,7 @@ alloc:		/* Allocate a new buffer header and data space. */
+ 			MVCC_MPROTECT(bhp->buf, mfp->pagesize,
+ 			    PROT_READ);
+ 
+-		atomic_init(&alloc_bhp->ref, 1);
++		atomic_init_db(&alloc_bhp->ref, 1);
+ 		MUTEX_LOCK(env, alloc_bhp->mtx_buf);
+ 		alloc_bhp->priority = bhp->priority;
+ 		alloc_bhp->pgno = bhp->pgno;
+diff --git a/src/mp/mp_mvcc.c b/src/mp/mp_mvcc.c
+index 770bad8..e28cce0 100644
+--- a/src/mp/mp_mvcc.c
++++ b/src/mp/mp_mvcc.c
+@@ -276,7 +276,7 @@ __memp_bh_freeze(dbmp, infop, hp, bhp, need_frozenp)
+ #else
+ 	memcpy(frozen_bhp, bhp, SSZA(BH, buf));
+ #endif
+-	atomic_init(&frozen_bhp->ref, 0);
++	atomic_init_db(&frozen_bhp->ref, 0);
+ 	if (mutex != MUTEX_INVALID)
+ 		frozen_bhp->mtx_buf = mutex;
+ 	else if ((ret = __mutex_alloc(env, MTX_MPOOL_BH,
+@@ -428,7 +428,7 @@ __memp_bh_thaw(dbmp, infop, hp, frozen_bhp, alloc_bhp)
+ #endif
+ 		alloc_bhp->mtx_buf = mutex;
+ 		MUTEX_LOCK(env, alloc_bhp->mtx_buf);
+-		atomic_init(&alloc_bhp->ref, 1);
++		atomic_init_db(&alloc_bhp->ref, 1);
+ 		F_CLR(alloc_bhp, BH_FROZEN);
+ 	}
+ 
+diff --git a/src/mp/mp_region.c b/src/mp/mp_region.c
+index 4952030..47645f8 100644
+--- a/src/mp/mp_region.c
++++ b/src/mp/mp_region.c
+@@ -245,7 +245,7 @@ __memp_init(env, dbmp, reginfo_off, htab_buckets, max_nreg)
+ 			     MTX_MPOOL_FILE_BUCKET, 0, &htab[i].mtx_hash)) != 0)
+ 				return (ret);
+ 			SH_TAILQ_INIT(&htab[i].hash_bucket);
+-			atomic_init(&htab[i].hash_page_dirty, 0);
++			atomic_init_db(&htab[i].hash_page_dirty, 0);
+ 		}
+ 
+ 		/*
+@@ -302,7 +302,7 @@ no_prealloc:
+ 		} else
+ 			hp->mtx_hash = mtx_base + (i % dbenv->mp_mtxcount);
+ 		SH_TAILQ_INIT(&hp->hash_bucket);
+-		atomic_init(&hp->hash_page_dirty, 0);
++		atomic_init_db(&hp->hash_page_dirty, 0);
+ #ifdef HAVE_STATISTICS
+ 		hp->hash_io_wait = 0;
+ 		hp->hash_frozen = hp->hash_thawed = hp->hash_frozen_freed = 0;
+diff --git a/src/mutex/mut_method.c b/src/mutex/mut_method.c
+index 09353b0..177353c 100644
+--- a/src/mutex/mut_method.c
++++ b/src/mutex/mut_method.c
+@@ -474,7 +474,7 @@ atomic_compare_exchange(env, v, oldval, newval)
+ 	MUTEX_LOCK(env, mtx);
+ 	ret = atomic_read(v) == oldval;
+ 	if (ret)
+-		atomic_init(v, newval);
++		atomic_init_db(v, newval);
+ 	MUTEX_UNLOCK(env, mtx);
+ 
+ 	return (ret);
+diff --git a/src/mutex/mut_tas.c b/src/mutex/mut_tas.c
+index 106b161..fc4de9d 100644
+--- a/src/mutex/mut_tas.c
++++ b/src/mutex/mut_tas.c
+@@ -47,7 +47,7 @@ __db_tas_mutex_init(env, mutex, flags)
+ 
+ #ifdef HAVE_SHARED_LATCHES
+ 	if (F_ISSET(mutexp, DB_MUTEX_SHARED))
+-		atomic_init(&mutexp->sharecount, 0);
++		atomic_init_db(&mutexp->sharecount, 0);
+ 	else
+ #endif
+ 	if (MUTEX_INIT(&mutexp->tas)) {
+@@ -536,7 +536,7 @@ __db_tas_mutex_unlock(env, mutex)
+ 			F_CLR(mutexp, DB_MUTEX_LOCKED);
+ 			/* Flush flag update before zeroing count */
+ 			MEMBAR_EXIT();
+-			atomic_init(&mutexp->sharecount, 0);
++			atomic_init_db(&mutexp->sharecount, 0);
+ 		} else {
+ 			DB_ASSERT(env, sharecount > 0);
+ 			MEMBAR_EXIT();
diff --git a/nixpkgs/pkgs/development/libraries/db/clang-6.0.patch b/nixpkgs/pkgs/development/libraries/db/clang-6.0.patch
new file mode 100644
index 000000000000..a411e60dc39b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/db/clang-6.0.patch
@@ -0,0 +1,123 @@
+diff --git a/src/dbinc/atomic.h b/src/dbinc/atomic.h
+index e4420aa..4799b5f 100644
+--- a/src/dbinc/atomic.h
++++ b/src/dbinc/atomic.h
+@@ -70,7 +70,7 @@ typedef struct {
+  * These have no memory barriers; the caller must include them when necessary.
+  */
+ #define	atomic_read(p)		((p)->value)
+-#define	atomic_init(p, val)	((p)->value = (val))
++#define	atomic_init_db(p, val)	((p)->value = (val))
+ 
+ #ifdef HAVE_ATOMIC_SUPPORT
+ 
+@@ -225,7 +225,7 @@ static inline int __atomic_compare_exchange_int(
+ #define	atomic_dec(env, p)	(--(p)->value)
+ #define	atomic_compare_exchange(env, p, oldval, newval)		\
+ 	(DB_ASSERT(env, atomic_read(p) == (oldval)),		\
+-	atomic_init(p, (newval)), 1)
++	atomic_init_db(p, (newval)), 1)
+ #else
+ #define	atomic_inc(env, p)	__atomic_inc_int(env, p)
+ #define	atomic_dec(env, p)	__atomic_dec_int(env, p)
+diff --git a/src/mp/mp_fget.c b/src/mp/mp_fget.c
+index 59fe9fe..fa4ced7 100644
+--- a/src/mp/mp_fget.c
++++ b/src/mp/mp_fget.c
+@@ -654,7 +654,7 @@ alloc:		/* Allocate a new buffer header and data space. */
+ 
+ 		/* Initialize enough so we can call __memp_bhfree. */
+ 		alloc_bhp->flags = 0;
+-		atomic_init(&alloc_bhp->ref, 1);
++		atomic_init_db(&alloc_bhp->ref, 1);
+ #ifdef DIAGNOSTIC
+ 		if ((uintptr_t)alloc_bhp->buf & (sizeof(size_t) - 1)) {
+ 			__db_errx(env, DB_STR("3025",
+@@ -969,7 +969,7 @@ alloc:		/* Allocate a new buffer header and data space. */
+ 			MVCC_MPROTECT(bhp->buf, mfp->pagesize,
+ 			    PROT_READ);
+ 
+-		atomic_init(&alloc_bhp->ref, 1);
++		atomic_init_db(&alloc_bhp->ref, 1);
+ 		MUTEX_LOCK(env, alloc_bhp->mtx_buf);
+ 		alloc_bhp->priority = bhp->priority;
+ 		alloc_bhp->pgno = bhp->pgno;
+diff --git a/src/mp/mp_mvcc.c b/src/mp/mp_mvcc.c
+index 83c4d72..0a47202 100644
+--- a/src/mp/mp_mvcc.c
++++ b/src/mp/mp_mvcc.c
+@@ -281,7 +281,7 @@ __memp_bh_freeze(dbmp, infop, hp, bhp, need_frozenp)
+ #else
+ 	memcpy(frozen_bhp, bhp, SSZA(BH, buf));
+ #endif
+-	atomic_init(&frozen_bhp->ref, 0);
++	atomic_init_db(&frozen_bhp->ref, 0);
+ 	if (mutex != MUTEX_INVALID)
+ 		frozen_bhp->mtx_buf = mutex;
+ 	else if ((ret = __mutex_alloc(env, MTX_MPOOL_BH,
+@@ -440,7 +440,7 @@ __memp_bh_thaw(dbmp, infop, hp, frozen_bhp, alloc_bhp)
+ #endif
+ 		alloc_bhp->mtx_buf = mutex;
+ 		MUTEX_LOCK(env, alloc_bhp->mtx_buf);
+-		atomic_init(&alloc_bhp->ref, 1);
++		atomic_init_db(&alloc_bhp->ref, 1);
+ 		F_CLR(alloc_bhp, BH_FROZEN);
+ 	}
+ 
+diff --git a/src/mp/mp_region.c b/src/mp/mp_region.c
+index 4d95e4f..e97459c 100644
+--- a/src/mp/mp_region.c
++++ b/src/mp/mp_region.c
+@@ -278,7 +278,7 @@ __memp_init(env, dbmp, reginfo_off, htab_buckets, max_nreg)
+ 			     MTX_MPOOL_FILE_BUCKET, 0, &htab[i].mtx_hash)) != 0)
+ 				return (ret);
+ 			SH_TAILQ_INIT(&htab[i].hash_bucket);
+-			atomic_init(&htab[i].hash_page_dirty, 0);
++			atomic_init_db(&htab[i].hash_page_dirty, 0);
+ 		}
+ 
+ 		mtx_base = mtx_prev = MUTEX_INVALID;
+@@ -332,7 +332,7 @@ no_prealloc:
+ 		    DB_MUTEX_SHARED, &hp->mtx_hash)) != 0)
+ 			return (ret);
+ 		SH_TAILQ_INIT(&hp->hash_bucket);
+-		atomic_init(&hp->hash_page_dirty, 0);
++		atomic_init_db(&hp->hash_page_dirty, 0);
+ #ifdef HAVE_STATISTICS
+ 		hp->hash_io_wait = 0;
+ 		hp->hash_frozen = hp->hash_thawed = hp->hash_frozen_freed = 0;
+diff --git a/src/mutex/mut_method.c b/src/mutex/mut_method.c
+index 72b34de..a9f9868 100644
+--- a/src/mutex/mut_method.c
++++ b/src/mutex/mut_method.c
+@@ -501,7 +501,7 @@ __atomic_compare_exchange_int(env, v, oldval, newval)
+ 	MUTEX_LOCK(env, mtx);
+ 	ret = atomic_read(v) == oldval;
+ 	if (ret)
+-		atomic_init(v, newval);
++		atomic_init_db(v, newval);
+ 	MUTEX_UNLOCK(env, mtx);
+ 
+ 	return (ret);
+diff --git a/src/mutex/mut_tas.c b/src/mutex/mut_tas.c
+index 7899c4b..d9420fa 100644
+--- a/src/mutex/mut_tas.c
++++ b/src/mutex/mut_tas.c
+@@ -47,7 +47,7 @@ __db_tas_mutex_init(env, mutex, flags)
+ 
+ #ifdef HAVE_SHARED_LATCHES
+ 	if (F_ISSET(mutexp, DB_MUTEX_SHARED))
+-		atomic_init(&mutexp->sharecount, 0);
++		atomic_init_db(&mutexp->sharecount, 0);
+ 	else
+ #endif
+ 	if (MUTEX_INIT(&mutexp->tas)) {
+@@ -643,7 +643,7 @@ was_not_locked:
+ 			F_CLR(mutexp, DB_MUTEX_LOCKED);
+ 			/* Flush flag update before zeroing count */
+ 			MEMBAR_EXIT();
+-			atomic_init(&mutexp->sharecount, 0);
++			atomic_init_db(&mutexp->sharecount, 0);
+ 		} else {
+ 			DB_ASSERT(env, sharecount > 0);
+ 			MEMBAR_EXIT();
diff --git a/nixpkgs/pkgs/development/libraries/db/db-4.8.nix b/nixpkgs/pkgs/development/libraries/db/db-4.8.nix
new file mode 100644
index 000000000000..76e30e921ba1
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/db/db-4.8.nix
@@ -0,0 +1,10 @@
+{ stdenv, fetchurl, ... } @ args:
+
+import ./generic.nix (args // rec {
+  version = "4.8.30";
+  sha256 = "0ampbl2f0hb1nix195kz1syrqqxpmvnvnfvphambj7xjrl3iljg0";
+  extraPatches = [ ./clang-4.8.patch ./CVE-2017-10140-4.8-cwd-db_config.patch ];
+
+  drvArgs.hardeningDisable = [ "format" ];
+  drvArgs.doCheck = false;
+})
diff --git a/nixpkgs/pkgs/development/libraries/db/db-5.3.nix b/nixpkgs/pkgs/development/libraries/db/db-5.3.nix
new file mode 100644
index 000000000000..7894e4c73262
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/db/db-5.3.nix
@@ -0,0 +1,7 @@
+{ stdenv, fetchurl, ... } @ args:
+
+import ./generic.nix (args // rec {
+  version = "5.3.28";
+  sha256 = "0a1n5hbl7027fbz5lm0vp0zzfp1hmxnz14wx3zl9563h83br5ag0";
+  extraPatches = [ ./clang-5.3.patch ./CVE-2017-10140-cwd-db_config.patch ];
+})
diff --git a/nixpkgs/pkgs/development/libraries/db/db-6.0.nix b/nixpkgs/pkgs/development/libraries/db/db-6.0.nix
new file mode 100644
index 000000000000..bafca3bd52d2
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/db/db-6.0.nix
@@ -0,0 +1,8 @@
+{ stdenv, fetchurl, ... } @ args:
+
+import ./generic.nix (args // rec {
+  version = "6.0.20";
+  sha256 = "00r2aaglq625y8r9xd5vw2y070plp88f1mb2gbq3kqsl7128lsl0";
+  license = stdenv.lib.licenses.agpl3;
+  extraPatches = [ ./clang-6.0.patch ./CVE-2017-10140-cwd-db_config.patch ];
+})
diff --git a/nixpkgs/pkgs/development/libraries/db/db-6.2.nix b/nixpkgs/pkgs/development/libraries/db/db-6.2.nix
new file mode 100644
index 000000000000..96f7668aa903
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/db/db-6.2.nix
@@ -0,0 +1,8 @@
+{ stdenv, fetchurl, ... } @ args:
+
+import ./generic.nix (args // rec {
+  version = "6.2.23";
+  sha256 = "1isxx4jfmnh913jzhp8hhfngbk6dsg46f4kjpvvc56maj64jqqa7";
+  license = stdenv.lib.licenses.agpl3;
+  extraPatches = [ ./clang-6.0.patch ./CVE-2017-10140-cwd-db_config.patch ];
+})
diff --git a/nixpkgs/pkgs/development/libraries/db/generic.nix b/nixpkgs/pkgs/development/libraries/db/generic.nix
new file mode 100644
index 000000000000..bb501fb9c68d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/db/generic.nix
@@ -0,0 +1,56 @@
+{ stdenv, fetchurl
+, cxxSupport ? true
+, compat185 ? true
+, dbmSupport ? false
+
+# Options from inherited versions
+, version, sha256
+, extraPatches ? [ ]
+, license ? stdenv.lib.licenses.sleepycat
+, drvArgs ? {}
+}:
+
+stdenv.mkDerivation (rec {
+  name = "db-${version}";
+
+  src = fetchurl {
+    url = "https://download.oracle.com/berkeley-db/${name}.tar.gz";
+    sha256 = sha256;
+  };
+
+  patches = extraPatches;
+
+  outputs = [ "bin" "out" "dev" ];
+
+  configureFlags =
+    [
+      (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";
+
+  preConfigure = ''
+    cd build_unix
+    configureScript=../dist/configure
+  '';
+
+  postInstall = ''
+    rm -rf $out/docs
+  '';
+
+  enableParallelBuilding = true;
+
+  doCheck = true;
+
+  checkPhase = ''
+    make examples_c examples_cxx
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = http://www.oracle.com/technetwork/database/database-technologies/berkeleydb/index.html;
+    description = "Berkeley DB";
+    license = license;
+    platforms = platforms.unix;
+  };
+} // drvArgs)
diff --git a/nixpkgs/pkgs/development/libraries/dbus-cplusplus/default.nix b/nixpkgs/pkgs/development/libraries/dbus-cplusplus/default.nix
new file mode 100644
index 000000000000..163b0f4be883
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/dbus-cplusplus/default.nix
@@ -0,0 +1,46 @@
+{ stdenv, fetchurl, dbus, glib, pkgconfig, expat }:
+
+stdenv.mkDerivation rec {
+  name = "dbus-cplusplus-${version}";
+  version = "0.9.0";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/dbus-cplusplus/dbus-c%2B%2B/0.9.0/libdbus-c%2B%2B-0.9.0.tar.gz";
+    name = "${name}.tar.gz";
+    sha256 = "0qafmy2i6dzx4n1dqp6pygyy6gjljnb7hwjcj2z11c1wgclsq4dw";
+  };
+
+  patches = [
+    (fetchurl {
+      name = "gcc-4.7.patch";
+      url = "http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/dev-libs/"
+          + "dbus-c%2B%2B/files/dbus-c%2B%2B-0.9.0-gcc-4.7.patch";
+      sha256 = "0rwcz9pvc13b3yfr0lkifnfz0vb5q6dg240bzgf37ni4s8rpc72g";
+    })
+    (fetchurl {
+      name = "writechar.patch"; # since gcc7
+      url = "https://src.fedoraproject.org/cgit/rpms/dbus-c++.git/plain/"
+          + "dbus-c++-writechar.patch?id=7f371172f5c";
+      sha256 = "1kkg4gbpm4hp87l25zw2a3r9c58g7vvgzcqgiman734i66zsbb9l";
+    })
+    (fetchurl {
+      name = "threading.patch"; # since gcc7
+      url = "https://src.fedoraproject.org/cgit/rpms/dbus-c++.git/plain/"
+          + "dbus-c++-threading.patch?id=7f371172f5c";
+      sha256 = "1h362anx3wyxm5lq0v8girmip1jmkdbijrmbrq7k5pp47zkhwwrq";
+    })
+  ];
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ dbus glib expat ];
+
+  configureFlags = [ "--disable-ecore" "--disable-tests" ];
+
+  meta = with stdenv.lib; {
+    homepage = http://dbus-cplusplus.sourceforge.net;
+    description = "C++ API for D-BUS";
+    license = licenses.gpl2Plus;
+    platforms = platforms.linux;
+    maintainers = [ maintainers.goibhniu ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/dbus-glib/default.nix b/nixpkgs/pkgs/development/libraries/dbus-glib/default.nix
new file mode 100644
index 000000000000..c62377959608
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/dbus-glib/default.nix
@@ -0,0 +1,37 @@
+{ stdenv, fetchurl, buildPackages
+, pkgconfig, expat, gettext, libiconv, dbus, glib
+}:
+
+stdenv.mkDerivation rec {
+  name = "dbus-glib-0.110";
+
+  src = fetchurl {
+    url = "${meta.homepage}/releases/dbus-glib/${name}.tar.gz";
+    sha256 = "09g8swvc95bk1z6j8sw463p2v0dqmgm2zjfndf7i8sbcyq67dr3w";
+  };
+
+  outputs = [ "out" "dev" "devdoc" ];
+  outputBin = "dev";
+
+  nativeBuildInputs = [ pkgconfig gettext glib ];
+
+  buildInputs = [ expat libiconv ];
+
+  propagatedBuildInputs = [ dbus glib ];
+
+  configureFlags = [ "--exec-prefix=${placeholder "dev"}" ] ++
+    stdenv.lib.optional (stdenv.buildPlatform != stdenv.hostPlatform)
+      "--with-dbus-binding-tool=${buildPackages.dbus-glib.dev}/bin/dbus-binding-tool";
+
+  doCheck = false;
+
+  passthru = { inherit dbus glib; };
+
+  meta = {
+    homepage = https://dbus.freedesktop.org;
+    license = with stdenv.lib.licenses; [ afl21 gpl2 ];
+    description = "Obsolete glib bindings for D-Bus lightweight IPC mechanism";
+    maintainers = [ ];
+    platforms = stdenv.lib.platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/dbus-sharp-glib/dbus-sharp-glib-1.0.nix b/nixpkgs/pkgs/development/libraries/dbus-sharp-glib/dbus-sharp-glib-1.0.nix
new file mode 100644
index 000000000000..0f897d97467f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/dbus-sharp-glib/dbus-sharp-glib-1.0.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchFromGitHub, autoreconfHook, pkgconfig, mono, dbus-sharp-1_0 }:
+
+stdenv.mkDerivation rec {
+  name = "dbus-sharp-glib-${version}";
+  version = "0.5";
+
+  src = fetchFromGitHub {
+    owner = "mono";
+    repo = "dbus-sharp-glib";
+
+    rev = "v${version}";
+    sha256 = "0z8ylzby8n5sar7aywc8rngd9ap5qqznadsscp5v34cacdfz1gxm";
+  };
+
+  nativeBuildInputs = [ pkgconfig autoreconfHook ];
+  buildInputs = [ mono dbus-sharp-1_0 ];
+
+  dontStrip = true;
+
+  meta = with stdenv.lib; {
+    description = "D-Bus for .NET: GLib integration module";
+    platforms = platforms.linux;
+    license = licenses.mit;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/dbus-sharp-glib/default.nix b/nixpkgs/pkgs/development/libraries/dbus-sharp-glib/default.nix
new file mode 100644
index 000000000000..cd020317f4c2
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/dbus-sharp-glib/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchFromGitHub, pkgconfig, mono, dbus-sharp-2_0, autoreconfHook }:
+
+stdenv.mkDerivation rec {
+  name = "dbus-sharp-glib-${version}";
+  version = "0.6";
+
+  src = fetchFromGitHub {
+    owner = "mono";
+    repo = "dbus-sharp-glib";
+
+    rev = "v${version}";
+    sha256 = "0i39kfg731as6j0hlmasgj8dyw5xsak7rl2dlimi1naphhffwzm8";
+  };
+
+  nativeBuildInputs = [ pkgconfig autoreconfHook ];
+  buildInputs = [ mono dbus-sharp-2_0 ];
+
+  dontStrip = true;
+
+  meta = with stdenv.lib; {
+    description = "D-Bus for .NET: GLib integration module";
+    platforms = platforms.linux;
+    license = licenses.mit;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/dbus-sharp/dbus-sharp-1.0.nix b/nixpkgs/pkgs/development/libraries/dbus-sharp/dbus-sharp-1.0.nix
new file mode 100644
index 000000000000..18ea3ad3ecb7
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/dbus-sharp/dbus-sharp-1.0.nix
@@ -0,0 +1,25 @@
+{stdenv, fetchFromGitHub, pkgconfig, mono, autoreconfHook }:
+
+stdenv.mkDerivation rec {
+  name = "dbus-sharp-${version}";
+  version = "0.7";
+
+  src = fetchFromGitHub {
+    owner = "mono";
+    repo = "dbus-sharp";
+
+    rev = "v${version}";
+    sha256 = "13qlqx9wqahfpzzl59157cjxprqcx2bd40w5gb2bs3vdx058p562";
+  };
+
+  nativeBuildInputs = [ pkgconfig autoreconfHook ];
+  buildInputs = [ mono ];
+
+  dontStrip = true;
+
+  meta = with stdenv.lib; {
+    description = "D-Bus for .NET";
+    platforms = platforms.linux;
+    license = licenses.mit;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/dbus-sharp/default.nix b/nixpkgs/pkgs/development/libraries/dbus-sharp/default.nix
new file mode 100644
index 000000000000..14db5baea3fb
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/dbus-sharp/default.nix
@@ -0,0 +1,28 @@
+{stdenv, fetchFromGitHub, pkgconfig, mono4, autoreconfHook }:
+
+stdenv.mkDerivation rec {
+  name = "dbus-sharp-${version}";
+  version = "0.8.1";
+
+  src = fetchFromGitHub {
+    owner = "mono";
+    repo = "dbus-sharp";
+
+    rev = "v${version}";
+    sha256 = "1g5lblrvkd0wnhfzp326by6n3a9mj2bj7a7646g0ziwgsxp5w6y7";
+  };
+
+  nativeBuildInputs = [ pkgconfig autoreconfHook ];
+
+  # Use msbuild when https://github.com/NixOS/nixpkgs/pull/43680 is merged
+  # See: https://github.com/NixOS/nixpkgs/pull/46060
+  buildInputs = [ mono4 ];
+
+  dontStrip = true;
+
+  meta = with stdenv.lib; {
+    description = "D-Bus for .NET";
+    platforms = platforms.linux;
+    license = licenses.mit;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/dbus/default.nix b/nixpkgs/pkgs/development/libraries/dbus/default.nix
new file mode 100644
index 000000000000..60d0cc81d2bc
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/dbus/default.nix
@@ -0,0 +1,92 @@
+{ stdenv, lib, fetchurl, pkgconfig, expat, systemd
+, libX11 ? null, libICE ? null, libSM ? null, x11Support ? (stdenv.isLinux || stdenv.isDarwin) }:
+
+assert x11Support -> libX11 != null
+                  && libICE != null
+                  && libSM != null;
+
+let
+  version = "1.12.14";
+  sha256 = "13aca7gzgl7z1dfdipfs23773w8n6z01d4rj5kmssv4gms8c5ya4";
+
+self = stdenv.mkDerivation {
+    name = "dbus-${version}";
+    inherit version;
+
+    src = fetchurl {
+      url = "https://dbus.freedesktop.org/releases/dbus/dbus-${version}.tar.gz";
+      inherit sha256;
+    };
+
+    patches = lib.optional stdenv.isSunOS ./implement-getgrouplist.patch;
+    postPatch = ''
+      substituteInPlace tools/Makefile.in \
+        --replace 'install-localstatelibDATA:' 'disabled:' \
+        --replace 'install-data-local:' 'disabled:' \
+        --replace 'installcheck-local:' 'disabled:'
+      substituteInPlace bus/Makefile.in \
+        --replace '$(mkinstalldirs) $(DESTDIR)$(localstatedir)/run/dbus' ':'
+    '' + /* cleanup of runtime references */ ''
+      substituteInPlace ./dbus/dbus-sysdeps-unix.c \
+        --replace 'DBUS_BINDIR "/dbus-launch"' "\"$lib/bin/dbus-launch\""
+      substituteInPlace ./tools/dbus-launch.c \
+        --replace 'DBUS_DAEMONDIR"/dbus-daemon"' '"/run/current-system/sw/bin/dbus-daemon"'
+    '';
+
+    outputs = [ "out" "dev" "lib" "doc" ];
+
+    nativeBuildInputs = [ pkgconfig ];
+    propagatedBuildInputs = [ expat ];
+    buildInputs = lib.optional stdenv.isLinux systemd
+      ++ lib.optionals x11Support [ libX11 libICE libSM ];
+    # ToDo: optional selinux?
+
+    configureFlags = [
+      "--localstatedir=/var"
+      "--sysconfdir=/etc"
+      "--with-session-socket-dir=/tmp"
+      "--with-system-pid-file=/run/dbus/pid"
+      "--with-system-socket=/run/dbus/system_bus_socket"
+      "--with-systemdsystemunitdir=$(out)/etc/systemd/system"
+      "--with-systemduserunitdir=$(out)/etc/systemd/user"
+      "--enable-user-session"
+      "--datadir=/etc"
+      "--libexecdir=$(out)/libexec"
+    ] ++ lib.optional (!x11Support) "--without-x";
+
+    # Enable X11 autolaunch support in libdbus. This doesn't actually depend on X11
+    # (it just execs dbus-launch in dbus.tools), contrary to what the configure script demands.
+    # problems building without x11Support so disabled in that case for now
+    NIX_CFLAGS_COMPILE = lib.optionalString x11Support "-DDBUS_ENABLE_X11_AUTOLAUNCH=1";
+    NIX_CFLAGS_LINK = lib.optionalString (!stdenv.isDarwin) "-Wl,--as-needed";
+
+    enableParallelBuilding = true;
+
+    doCheck = true;
+
+    installFlags = [ "sysconfdir=$(out)/etc" "datadir=$(out)/share" ];
+
+    postInstall = ''
+      mkdir -p "$out/share/xml/dbus"
+      cp doc/*.dtd "$out/share/xml/dbus"
+    '';
+
+    # it's executed from $lib by absolute path
+    postFixup = ''
+      moveToOutput bin/dbus-launch "$lib"
+      ln -s "$lib/bin/dbus-launch" "$out/bin/"
+    '';
+
+    passthru = {
+      dbus-launch = "${self.lib}/bin/dbus-launch";
+      daemon = self.out;
+    };
+
+    meta = with stdenv.lib; {
+      description = "Simple interprocess messaging system";
+      homepage = http://www.freedesktop.org/wiki/Software/dbus/;
+      license = licenses.gpl2Plus; # most is also under AFL-2.1
+      platforms = platforms.unix;
+    };
+  };
+in self
diff --git a/nixpkgs/pkgs/development/libraries/dbus/implement-getgrouplist.patch b/nixpkgs/pkgs/development/libraries/dbus/implement-getgrouplist.patch
new file mode 100644
index 000000000000..e3a4a25cb720
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/dbus/implement-getgrouplist.patch
@@ -0,0 +1,108 @@
+Compatibility patch for Illumos/Solaris and possibly other platforms.
+Implements getgrouplist when not provided by OS.
+Without it, only the user's primary group is used in authentication!
+--- 	1970-01-01 00:00:00.000000000 +0000
++++ dbus-1.6.8/dbus/getgrouplist.c	2013-02-28 13:10:51.081792722 +0000
+@@ -0,0 +1,89 @@
++/*	$OpenBSD: getgrouplist.c,v 1.12 2005/08/08 08:05:34 espie Exp $ */
++/*
++ * Copyright (c) 1991, 1993
++ *	The Regents of the University of California.  All rights reserved.
++ *
++ * Redistribution and use in source and binary forms, with or without
++ * modification, are permitted provided that the following conditions
++ * are met:
++ * 1. Redistributions of source code must retain the above copyright
++ *    notice, this list of conditions and the following disclaimer.
++ * 2. Redistributions in binary form must reproduce the above copyright
++ *    notice, this list of conditions and the following disclaimer in the
++ *    documentation and/or other materials provided with the distribution.
++ * 3. Neither the name of the University nor the names of its contributors
++ *    may be used to endorse or promote products derived from this software
++ *    without specific prior written permission.
++ *
++ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
++ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
++ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
++ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
++ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
++ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
++ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
++ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
++ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
++ * SUCH DAMAGE.
++ */
++
++/* OPENBSD ORIGINAL: lib/libc/gen/getgrouplist.c */
++
++/*
++ * get credential
++ */
++#include <sys/types.h>
++#include <string.h>
++#include <unistd.h>
++#include <grp.h>
++
++int
++getgrouplist(const char *uname, gid_t agroup, gid_t *groups, int *grpcnt)
++{
++	struct group *grp;
++	int i, ngroups;
++	int ret, maxgroups;
++	int bail;
++
++	ret = 0;
++	ngroups = 0;
++	maxgroups = *grpcnt;
++
++	/*
++	 * install primary group
++	 */
++	if (ngroups >= maxgroups) {
++		*grpcnt = ngroups;
++		return (-1);
++	}
++	groups[ngroups++] = agroup;
++
++	/*
++	 * Scan the group file to find additional groups.
++	 */
++	setgrent();
++	while ((grp = getgrent())) {
++		if (grp->gr_gid == agroup)
++			continue;
++		for (bail = 0, i = 0; bail == 0 && i < ngroups; i++)
++			if (groups[i] == grp->gr_gid)
++				bail = 1;
++		if (bail)
++			continue;
++		for (i = 0; grp->gr_mem[i]; i++) {
++			if (!strcmp(grp->gr_mem[i], uname)) {
++				if (ngroups >= maxgroups) {
++					ret = -1;
++					goto out;
++				}
++				groups[ngroups++] = grp->gr_gid;
++				break;
++			}
++		}
++	}
++out:
++	endgrent();
++	*grpcnt = ngroups;
++	return (ret);
++}
+--- dbus-1.6.8/dbus/dbus-sysdeps-unix.c.orig	2013-02-28 13:08:52.171215237 +0000
++++ dbus-1.6.8/dbus/dbus-sysdeps-unix.c	2013-02-28 13:13:52.224615146 +0000
+@@ -21,6 +21,10 @@
+  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+  *
+  */
++#ifndef HAVE_GETGROUPLIST
++#include "getgrouplist.c"
++#define HAVE_GETGROUPLIST
++#endif
+ 
+ #include <config.h>
+ 
diff --git a/nixpkgs/pkgs/development/libraries/dbus/make-dbus-conf.nix b/nixpkgs/pkgs/development/libraries/dbus/make-dbus-conf.nix
new file mode 100644
index 000000000000..5d441c5d1331
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/dbus/make-dbus-conf.nix
@@ -0,0 +1,42 @@
+{ runCommand, writeText, libxslt, dbus
+, serviceDirectories ? []
+, suidHelper ? "/var/setuid-wrappers/dbus-daemon-launch-helper"
+}:
+
+/* DBus has two configuration parsers -- normal and "trivial", which is used
+ * for suid helper. Unfortunately the latter doesn't support <include>
+ * directive. That means that we can't just place our configuration to
+ * *-local.conf -- it needs to be in the main configuration file.
+ */
+runCommand "dbus-1"
+  {
+    inherit serviceDirectories suidHelper;
+    preferLocalBuild = true;
+    allowSubstitutes = false;
+    XML_CATALOG_FILES = writeText "dbus-catalog.xml" ''
+      <?xml version="1.0"?>
+      <!DOCTYPE catalog PUBLIC
+        "-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN"
+        "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">
+
+      <catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
+        <rewriteSystem
+          systemIdStartString="http://www.freedesktop.org/standards/dbus/1.0/"
+          rewritePrefix="file://${dbus}/share/xml/dbus/"/>
+      </catalog>
+    '';
+    nativeBuildInputs = [ libxslt.bin ];
+  }
+  ''
+    mkdir -p $out
+
+    xsltproc --nonet \
+      --stringparam serviceDirectories "$serviceDirectories" \
+      --stringparam suidHelper "$suidHelper" \
+      ${./make-system-conf.xsl} ${dbus}/share/dbus-1/system.conf \
+      > $out/system.conf
+    xsltproc --nonet \
+      --stringparam serviceDirectories "$serviceDirectories" \
+      ${./make-session-conf.xsl} ${dbus}/share/dbus-1/session.conf \
+      > $out/session.conf
+  ''
diff --git a/nixpkgs/pkgs/development/libraries/dbus/make-session-conf.xsl b/nixpkgs/pkgs/development/libraries/dbus/make-session-conf.xsl
new file mode 100644
index 000000000000..9544aa13db56
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/dbus/make-session-conf.xsl
@@ -0,0 +1,31 @@
+<?xml version="1.0"?>
+
+<!--
+  This script copies the original system.conf from the dbus
+  distribution, but sets paths from $serviceDirectories parameter
+  and suid helper from $suidHelper parameter.
+-->
+
+<xsl:stylesheet version="1.0"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:str="http://exslt.org/strings"
+                extension-element-prefixes="str"
+                >
+
+  <xsl:output method='xml' encoding="UTF-8" doctype-system="busconfig.dtd" />
+
+  <xsl:param name="serviceDirectories" />
+
+  <xsl:template match="/busconfig">
+    <busconfig>
+      <!-- We leave <standard_session_servicedirs/> because it includes XDG dirs and therefore user Nix profile. -->
+      <xsl:copy-of select="child::node()[name() != 'include' and name() != 'servicedir' and name() != 'includedir']" />
+
+      <xsl:for-each select="str:tokenize($serviceDirectories)">
+        <servicedir><xsl:value-of select="." />/share/dbus-1/services</servicedir>
+        <includedir><xsl:value-of select="." />/etc/dbus-1/session.d</includedir>
+      </xsl:for-each>
+    </busconfig>
+  </xsl:template>
+
+</xsl:stylesheet>
diff --git a/nixpkgs/pkgs/development/libraries/dbus/make-system-conf.xsl b/nixpkgs/pkgs/development/libraries/dbus/make-system-conf.xsl
new file mode 100644
index 000000000000..dd644b4bce7c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/dbus/make-system-conf.xsl
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+
+<!--
+  This script copies the original system.conf from the dbus
+  distribution, but sets paths from $serviceDirectories parameter
+  and suid helper from $suidHelper parameter.
+-->
+
+<xsl:stylesheet version="1.0"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:str="http://exslt.org/strings"
+                extension-element-prefixes="str"
+                >
+
+  <xsl:output method='xml' encoding="UTF-8" doctype-system="busconfig.dtd" />
+
+  <xsl:param name="serviceDirectories" />
+  <xsl:param name="suidHelper" />
+
+  <xsl:template match="/busconfig">
+    <busconfig>
+      <xsl:copy-of select="child::node()[name() != 'include' and name() != 'standard_system_servicedirs' and name() != 'servicehelper' and name() != 'servicedir' and name() != 'includedir']" />
+
+      <!-- set suid helper -->
+      <servicehelper><xsl:value-of select="$suidHelper" /></servicehelper>
+
+      <xsl:for-each select="str:tokenize($serviceDirectories)">
+        <servicedir><xsl:value-of select="." />/share/dbus-1/system-services</servicedir>
+        <includedir><xsl:value-of select="." />/etc/dbus-1/system.d</includedir>
+        <includedir><xsl:value-of select="." />/share/dbus-1/system.d</includedir>
+      </xsl:for-each>
+    </busconfig>
+  </xsl:template>
+
+</xsl:stylesheet>
diff --git a/nixpkgs/pkgs/development/libraries/dbus/systemd.patch b/nixpkgs/pkgs/development/libraries/dbus/systemd.patch
new file mode 100644
index 000000000000..7e6cb1f87d07
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/dbus/systemd.patch
@@ -0,0 +1,14 @@
+diff --git a/configure.ac b/configure.ac
+index 24fcc9e..98e0459 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -1167,7 +1167,8 @@ else
+     PKG_CHECK_MODULES(SYSTEMD,
+         [libsystemd-login >= 32, libsystemd-daemon >= 32],
+         have_systemd=yes,
+-        have_systemd=no)
++        have_systemd=yes)
++    AC_MSG_NOTICE([NixOS: do not care whether we found systemd or not])
+ fi
+ 
+ if test x$have_systemd = xyes; then
diff --git a/nixpkgs/pkgs/development/libraries/dbxml/cxx11.patch b/nixpkgs/pkgs/development/libraries/dbxml/cxx11.patch
new file mode 100644
index 000000000000..f264515c7d67
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/dbxml/cxx11.patch
@@ -0,0 +1,59 @@
+diff -urN dbxml-6.1.4.orig/dbxml/src/dbxml/nodeStore/NsUpdate.cpp dbxml-6.1.4/dbxml/src/dbxml/nodeStore/NsUpdate.cpp
+--- dbxml-6.1.4.orig/dbxml/src/dbxml/nodeStore/NsUpdate.cpp	2017-05-01 16:05:29.000000000 +0100
++++ dbxml-6.1.4/dbxml/src/dbxml/nodeStore/NsUpdate.cpp	2017-09-04 11:50:20.000000000 +0100
+@@ -1359,21 +1359,13 @@
+ void NsUpdate::attributeRemoved(const DbXmlNodeImpl &node)
+ {
+ 	string key = makeKey(node);
+-#if defined(_MSC_VER) && (_MSC_VER>1600)
+ 	attrMap_.insert(make_pair(key,node.getIndex()));
+-#else
+-	attrMap_.insert(make_pair<const std::string, int>(key,node.getIndex()));
+-#endif
+ }
+ 
+ void NsUpdate::textRemoved(const DbXmlNodeImpl &node)
+ {
+ 	string key = makeKey(node);
+-#if defined(_MSC_VER) && (_MSC_VER>1600)
+ 	textDeleteMap_.insert(make_pair(key,node.getIndex()));
+-#else
+-	textDeleteMap_.insert(make_pair<const std::string, int>(key,node.getIndex()));
+-#endif
+ }
+ 
+ void NsUpdate::textRemoved(int index, const NsNid &nid,
+@@ -1381,21 +1373,13 @@
+ 			   const std::string &cname)
+ {
+ 	string key = makeKey(nid, did, cname);
+-#if defined(_MSC_VER) && (_MSC_VER>1600)
+ 	textDeleteMap_.insert(make_pair(key,index));
+-#else
+-	textDeleteMap_.insert(make_pair<const std::string, int>(key,index));
+-#endif
+ }
+ 
+ void NsUpdate::textInserted(int index, const DbXmlNodeImpl &node)
+ {
+ 	string key = makeKey(node);
+-#if defined(_MSC_VER) && (_MSC_VER>1600)
+ 	textInsertMap_.insert(make_pair(key,index));
+-#else
+-	textInsertMap_.insert(make_pair<const std::string, int>(key,index));
+-#endif
+ }
+ 
+ void NsUpdate::textInserted(int index, const NsNid &nid,
+@@ -1403,11 +1387,7 @@
+ 			    const std::string &cname)
+ {
+ 	string key = makeKey(nid, did, cname);
+-#if defined(_MSC_VER) && (_MSC_VER>1600)
+ 	textInsertMap_.insert(make_pair(key,index));
+-#else
+-	textInsertMap_.insert(make_pair<const std::string, int>(key,index));
+-#endif
+ }
+ 
+ //
diff --git a/nixpkgs/pkgs/development/libraries/dbxml/default.nix b/nixpkgs/pkgs/development/libraries/dbxml/default.nix
new file mode 100644
index 000000000000..da7549aeea36
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/dbxml/default.nix
@@ -0,0 +1,42 @@
+{ stdenv, fetchurl, db62, xercesc, xqilla }:
+
+stdenv.mkDerivation rec {
+  name = "dbxml-${version}";
+  version = "6.1.4";
+
+  src = fetchurl {
+    url = "http://download.oracle.com/berkeley-db/${name}.tar.gz";
+    sha256 = "a8fc8f5e0c3b6e42741fa4dfc3b878c982ff8f5e5f14843f6a7e20d22e64251a";
+  };
+
+  patches = [
+    ./cxx11.patch
+    ./incorrect-optimization.patch
+  ];
+
+  buildInputs = [
+    xercesc xqilla
+  ];
+
+  propagatedBuildInputs = [
+    db62
+  ];
+
+  configureFlags = [
+    "--with-berkeleydb=${db62.out}"
+    "--with-xerces=${xercesc}"
+    "--with-xqilla=${xqilla}"
+  ];
+
+  preConfigure = ''
+    cd dbxml
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = https://www.oracle.com/database/berkeley-db/xml.html;
+    description = "Embeddable XML database based on Berkeley DB";
+    license = licenses.agpl3;
+    maintainers = with maintainers; [ danieldk ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/dbxml/incorrect-optimization.patch b/nixpkgs/pkgs/development/libraries/dbxml/incorrect-optimization.patch
new file mode 100644
index 000000000000..630dc972e188
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/dbxml/incorrect-optimization.patch
@@ -0,0 +1,34 @@
+Patch provided by Lauren Foutz. See:
+https://community.oracle.com/thread/4093422
+
+--- dbxml-6.1.4-orig/dbxml/src/dbxml/query/ParentOfChildJoinQP.cpp
++++ dbxml-6.1.4/dbxml/src/dbxml/query/ParentOfChildJoinQP.cpp
+@@ -139,28 +139,16 @@ bool ParentOfChildIterator::doJoin(Dynam
+ 
+ 	// Invarient 4: When ancestorStack_ is empty we can output the
+ 	// buffered results_, since any more results will come after them in
+ 	// document order.
+ 
+ 	while(true) {
+ 		context->testInterrupt();
+ 
+-		/* 
+-		 * If current parent's node level already be larger than
+-		 * childen's, abandon current parent and move to next one.
+-		 */
+-		if (parents_ != NULL && 
+-		    parents_->getNodeLevel() > children_->getNodeLevel()) {
+-			if(!parents_->next(context)) {
+-				delete parents_;
+-				parents_ = 0;
+-			}
+-		}
+-
+ 		int cmp = parents_ == 0 ? -1 : isDescendantOf(children_, parents_, /*orSelf*/false);
+ 		if(cmp < 0) {
+ 			if(!ancestorStack_.empty()) {
+ 				// We've found the closest ancestor - is it a parent?
+ 				if(ancestorStack_.back()->getNodeLevel() == (children_->getNodeLevel() - 1)) {
+ 					// Maintain invarient 3
+ 					if(results_.empty() || NodeInfo::compare(results_.back(), ancestorStack_.back()) < 0)
+ 						results_.push_back(ancestorStack_.back());
diff --git a/nixpkgs/pkgs/development/libraries/dclib/default.nix b/nixpkgs/pkgs/development/libraries/dclib/default.nix
new file mode 100644
index 000000000000..5a879e04c7d3
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/dclib/default.nix
@@ -0,0 +1,16 @@
+{stdenv, fetchurl, libxml2, openssl, bzip2}:
+
+stdenv.mkDerivation {
+  name = "dclib-0.3.7";
+
+  src = fetchurl {
+    url = ftp://ftp.debian.nl/pub/freebsd/ports/distfiles/dclib-0.3.7.tar.bz2;
+    sha256 = "02jdzm5hqzs1dv2rd596vgpcjaapm55pqqapz5m94l30v4q72rfc";
+  };
+
+  buildInputs = [libxml2 openssl bzip2];
+
+  meta = {
+    platforms = stdenv.lib.platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/dclxvi/default.nix b/nixpkgs/pkgs/development/libraries/dclxvi/default.nix
new file mode 100644
index 000000000000..cd78d6d8a6ab
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/dclxvi/default.nix
@@ -0,0 +1,35 @@
+{ stdenv, fetchFromGitHub }:
+
+stdenv.mkDerivation {
+  name = "dclxvi-2013-01-27";
+
+  src = fetchFromGitHub {
+    owner = "agl";
+    repo = "dclxvi";
+    rev = "74009d58f2305be3b95d88717619bde8ecbdd9a2";
+    sha256 = "1kx4h8iv7yb30c6zjmj8zs9x12vxhi0jwkiwxsxj9swf6bww6p1g";
+  };
+
+  buildFlags = [ "libdclxvipairing.so" ];
+
+  patchPhase = ''
+    substituteInPlace Makefile \
+      --replace "gcc" "cc"
+  '' + stdenv.lib.optionalString stdenv.isDarwin ''
+    substituteInPlace Makefile \
+      --replace "-soname=libdclxvipairing.so" "-install_name,libdclxvipairing.so"
+  '';
+
+  installPhase = ''
+    mkdir -p $out/{include,lib}
+    find . -name \*.h -exec cp {} $out/include \;
+    find . -name \*.so -exec cp {} $out/lib \;
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = https://github.com/agl/dclxvi;
+    description = "Naehrig, Niederhagen and Schwabe's pairings code, massaged into a shared library";
+    platforms = platforms.x86_64;
+    license = licenses.publicDomain;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/dee/default.nix b/nixpkgs/pkgs/development/libraries/dee/default.nix
new file mode 100644
index 000000000000..f0f31ae1ffc4
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/dee/default.nix
@@ -0,0 +1,57 @@
+{ stdenv
+, fetchgit
+, pkgconfig
+, glib
+, icu
+, gobject-introspection
+, dbus-glib
+, vala
+, python3
+, autoreconfHook
+}:
+
+stdenv.mkDerivation rec {
+  pname = "dee";
+  version = "unstable-2017-06-16";
+
+  outputs = [ "out" "dev" "py" ];
+
+  src = fetchgit {
+    url = "https://git.launchpad.net/ubuntu/+source/dee";
+    rev = "import/1.2.7+17.10.20170616-4ubuntu1";
+    sha256 = "0q3d9d6ahcyibp6x23g1wvjfcppjh9v614s328yjmx47216z7394";
+  };
+
+  patches = [
+    "${src}/debian/patches/gtkdocize.patch"
+    "${src}/debian/patches/strict-prototype.patch"
+    "${src}/debian/patches/icu-pkg-config.patch"
+  ];
+
+  nativeBuildInputs = [
+    pkgconfig
+    vala
+    autoreconfHook
+    gobject-introspection
+    python3
+  ];
+
+  buildInputs = [
+    glib
+    icu
+    dbus-glib
+  ];
+
+  configureFlags = [
+    "--disable-gtk-doc"
+    "--with-pygi-overrides-dir=${placeholder ''py''}/${python3.sitePackages}/gi/overrides"
+  ];
+
+  meta = with stdenv.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;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ abbradar worldofpeace ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/dirac/default.nix b/nixpkgs/pkgs/development/libraries/dirac/default.nix
new file mode 100644
index 000000000000..5b05d64f0727
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/dirac/default.nix
@@ -0,0 +1,31 @@
+{ stdenv, fetchurl, doxygen }:
+
+stdenv.mkDerivation rec {
+  version = "1.0.2";
+  name = "dirac-${version}";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/dirac/${name}.tar.gz";
+    sha256 = "1z803yzp17cj69wn11iyb13swqdd9xdzr58dsk6ghpr3ipqicsw1";
+  };
+
+  buildInputs = [ doxygen ];
+  enableParallelBuilding = true;
+
+  patches = [ ./dirac-1.0.2.patch ];
+
+  NIX_CFLAGS_COMPILE = "-Wno-error=deprecated-declarations";
+
+  postInstall = ''
+    # keep only necessary binaries
+    find $out/bin \( -name '*RGB*' -or -name '*YUV*' -or -name create_dirac_testfile.pl \) -delete
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = https://sourceforge.net/projects/dirac;
+    description = "A general-purpose video codec based on wavelets";
+    platforms = platforms.linux;
+    license = with licenses; [ mpl11 gpl2 lgpl21 ];
+    maintainers = [ maintainers.igsha ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/dirac/dirac-1.0.2.patch b/nixpkgs/pkgs/development/libraries/dirac/dirac-1.0.2.patch
new file mode 100644
index 000000000000..3d253b8f6d67
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/dirac/dirac-1.0.2.patch
@@ -0,0 +1,362 @@
+diff -aur dirac-1.0.2/libdirac_byteio/parseunit_byteio.cpp dirac-1.0.2-modif/libdirac_byteio/parseunit_byteio.cpp
+--- dirac-1.0.2/libdirac_byteio/parseunit_byteio.cpp	2008-05-02 09:57:19.000000000 +0400
++++ dirac-1.0.2-modif/libdirac_byteio/parseunit_byteio.cpp	2016-02-10 19:39:09.838443767 +0300
+@@ -124,12 +124,9 @@
+ 
+     if(prefix==PU_PREFIX)
+     {
+-        unsigned char next_parse_code;
+-
+-        next_parse_code = InputUnByte();
++        (void)InputUnByte();
+         // input next unit parse-offsets
+-        int next_unit_next_parse_offset;
+-        next_unit_next_parse_offset = ReadUintLit(PU_NEXT_PARSE_OFFSET_SIZE);
++        (void)ReadUintLit(PU_NEXT_PARSE_OFFSET_SIZE);
+ 
+         int next_unit_previous_parse_offset;
+         next_unit_previous_parse_offset = ReadUintLit(PU_PREVIOUS_PARSE_OFFSET_SIZE);
+diff -aur dirac-1.0.2/libdirac_common/mot_comp.cpp dirac-1.0.2-modif/libdirac_common/mot_comp.cpp
+--- dirac-1.0.2/libdirac_common/mot_comp.cpp	2008-10-01 05:26:47.000000000 +0400
++++ dirac-1.0.2-modif/libdirac_common/mot_comp.cpp	2016-02-10 19:50:18.453051800 +0300
+@@ -1064,10 +1064,10 @@
+         // We're doing bounds checking because we'll fall off the edge of the reference otherwise.
+ 
+         //weights for doing linear interpolation, calculated from the remainder values
+-        const ValueType linear_wts[4] = {  (2 - rmdr.x) * (2 - rmdr.y),    //tl
+-                                           rmdr.x * (2 - rmdr.y),          //tr
+-                                           (2 - rmdr.x) * rmdr.y,          //bl
+-                                           rmdr.x * rmdr.y };              //br
++        const ValueType linear_wts[4] = {  ValueType((2 - rmdr.x) * (2 - rmdr.y)),    //tl
++                                           ValueType(rmdr.x * (2 - rmdr.y)),          //tr
++                                           ValueType((2 - rmdr.x) * rmdr.y),          //bl
++                                           ValueType(rmdr.x * rmdr.y) };              //br
+ 
+ 
+        for(int c = 0, uY = ref_start.y,BuY=BChk(uY,trueRefYlen),BuY1=BChk(uY+1,trueRefYlen);
+@@ -1116,10 +1116,10 @@
+     const ImageCoords ref_start( ( start_pos.x<<1 ) + roundvec.x ,( start_pos.y<<1 ) + roundvec.y );
+ 
+     //weights for doing linear interpolation, calculated from the remainder values
+-    const ValueType linear_wts[4] = {  (4 - rmdr.x) * (4 - rmdr.y),    //tl
+-                                    rmdr.x * (4 - rmdr.y),          //tr
+-                                    (4 - rmdr.x) * rmdr.y,          //bl
+-                                    rmdr.x * rmdr.y };              //br
++    const ValueType linear_wts[4] = {  ValueType((4 - rmdr.x) * (4 - rmdr.y)),    //tl
++                                    ValueType(rmdr.x * (4 - rmdr.y)),          //tr
++                                    ValueType((4 - rmdr.x) * rmdr.y),          //bl
++                                    ValueType(rmdr.x * rmdr.y) };              //br
+ 
+     //An additional stage to make sure the block to be copied does not fall outside
+     //the reference image.
+diff -aur dirac-1.0.2/libdirac_common/mot_comp_mmx.cpp dirac-1.0.2-modif/libdirac_common/mot_comp_mmx.cpp
+--- dirac-1.0.2/libdirac_common/mot_comp_mmx.cpp	2008-01-09 13:50:23.000000000 +0300
++++ dirac-1.0.2-modif/libdirac_common/mot_comp_mmx.cpp	2016-02-10 19:59:51.792793538 +0300
+@@ -244,10 +244,10 @@
+         // We're 2doing bounds checking because we'll fall off the edge of the reference otherwise.
+ 
+         //weights for doing linear interpolation, calculated from the remainder values
+-        const ValueType linear_wts[4] = {  (2 - rmdr.x) * (2 - rmdr.y),    //tl
+-                                           rmdr.x * (2 - rmdr.y),          //tr
+-                                           (2 - rmdr.x) * rmdr.y,          //bl
+-                                           rmdr.x * rmdr.y };              //br
++        const ValueType linear_wts[4] = {  ValueType((2 - rmdr.x) * (2 - rmdr.y)),    //tl
++                                           ValueType(rmdr.x * (2 - rmdr.y)),          //tr
++                                           ValueType((2 - rmdr.x) * rmdr.y),          //bl
++                                           ValueType(rmdr.x * rmdr.y) };              //br
+ 
+         ValueType act_cols1[4], act_cols2[4];
+         int uX, uY, c, l;
+diff -aur dirac-1.0.2/libdirac_common/mv_codec.cpp dirac-1.0.2-modif/libdirac_common/mv_codec.cpp
+--- dirac-1.0.2/libdirac_common/mv_codec.cpp	2008-10-01 05:26:47.000000000 +0400
++++ dirac-1.0.2-modif/libdirac_common/mv_codec.cpp	2016-02-10 19:51:57.634838245 +0300
+@@ -159,7 +159,7 @@
+ // Main code function
+ void PredModeCodec::DoWorkCode( MvData& in_data )
+ {
+-    int step,max; 
++    int step; 
+     int split_depth;  
+ 
+     for (m_sb_yp = 0, m_sb_tlb_y = 0;  m_sb_yp < in_data.SBSplit().LengthY();  ++m_sb_yp, m_sb_tlb_y += 4)
+@@ -169,7 +169,7 @@
+             split_depth = in_data.SBSplit()[m_sb_yp][m_sb_xp]; 
+ 
+             step = 4  >>  (split_depth); 
+-            max = (1 << split_depth); 
++            //max = (1 << split_depth); 
+                         
+             //now do all the block modes and mvs in the mb            
+             for (m_b_yp = m_sb_tlb_y; m_b_yp < m_sb_tlb_y+4; m_b_yp += step)
+@@ -334,7 +334,7 @@
+ // Main code function
+ void VectorElementCodec::DoWorkCode( MvData& in_data )
+ {
+-    int step,max;
++    int step;
+     int split_depth;
+ 
+     for (m_sb_yp = 0, m_sb_tlb_y = 0;  m_sb_yp < in_data.SBSplit().LengthY();  ++m_sb_yp, m_sb_tlb_y += 4)
+@@ -344,7 +344,7 @@
+             split_depth = in_data.SBSplit()[m_sb_yp][m_sb_xp];
+ 
+             step = 4  >>  (split_depth);
+-            max = (1 << split_depth);
++            //max = (1 << split_depth);
+                         
+             //now do all the block modes and mvs in the mb            
+             for (m_b_yp = m_sb_tlb_y; m_b_yp < m_sb_tlb_y+4; m_b_yp += step)
+@@ -500,7 +500,7 @@
+ // Main code function
+ void DCCodec::DoWorkCode( MvData& in_data )
+ {
+-    int step,max; 
++    int step; 
+     int split_depth;  
+     
+     for (m_sb_yp = 0, m_sb_tlb_y = 0;  m_sb_yp < in_data.SBSplit().LengthY();  ++m_sb_yp, m_sb_tlb_y += 4)
+@@ -510,7 +510,7 @@
+             split_depth = in_data.SBSplit()[m_sb_yp][m_sb_xp]; 
+ 
+             step = 4  >>  (split_depth); 
+-            max = (1 << split_depth); 
++            //max = (1 << split_depth); 
+                         
+             //now do all the block modes and mvs in the mb            
+             for (m_b_yp = m_sb_tlb_y; m_b_yp < m_sb_tlb_y+4; m_b_yp += step)
+diff -aur dirac-1.0.2/libdirac_common/wavelet_utils.cpp dirac-1.0.2-modif/libdirac_common/wavelet_utils.cpp
+--- dirac-1.0.2/libdirac_common/wavelet_utils.cpp	2008-10-20 08:21:02.000000000 +0400
++++ dirac-1.0.2-modif/libdirac_common/wavelet_utils.cpp	2016-02-10 19:58:16.205006445 +0300
+@@ -198,7 +198,6 @@
+     const bool field_coding = encparams.FieldCoding();
+     const ChromaFormat cformat = pparams.CFormat();
+     const float cpd = encparams.CPD()*cpd_scale_factor;
+-    const PictureSort psort = pparams.PicSort();
+ 
+     int xlen, ylen, xl, yl, xp, yp;
+     float xfreq, yfreq;
+diff -aur dirac-1.0.2/libdirac_encoder/picture_compress.cpp dirac-1.0.2-modif/libdirac_encoder/picture_compress.cpp
+--- dirac-1.0.2/libdirac_encoder/picture_compress.cpp	2009-01-21 08:20:57.000000000 +0300
++++ dirac-1.0.2-modif/libdirac_encoder/picture_compress.cpp	2016-02-10 20:08:17.935731263 +0300
+@@ -413,14 +413,12 @@
+ 
+         const int depth=m_encparams.TransformDepth();
+ 
+-        PicArray* comp_data[3];
+         CoeffArray* coeff_data[3];
+         OneDArray<unsigned int>* est_bits[3];
+         float lambda[3];
+ 
+         // Construction and definition of objects
+         for (int c=0;c<3;++c){
+-            comp_data[c] = &my_picture.Data((CompSort) c );
+ 	    coeff_data[c] = &my_picture.WltData((CompSort) c );
+             est_bits[c] =  new OneDArray<unsigned int>( Range( 1, 3*depth+1 ) );
+         }// c
+diff -aur dirac-1.0.2/libdirac_encoder/quant_chooser.cpp dirac-1.0.2-modif/libdirac_encoder/quant_chooser.cpp
+--- dirac-1.0.2/libdirac_encoder/quant_chooser.cpp	2009-01-21 08:22:05.000000000 +0300
++++ dirac-1.0.2-modif/libdirac_encoder/quant_chooser.cpp	2016-02-10 20:15:43.792954708 +0300
+@@ -340,7 +340,7 @@
+     {
+         for (int i=cblock.Xstart(); i<cblock.Xend(); ++i )
+         {
+-            if ( (std::abs(m_coeff_data[j][i])<<2) >= u_threshold )
++            if ( (int(std::abs(m_coeff_data[j][i]))<<2) >= u_threshold )
+                 can_skip = false;
+         }   
+     }
+@@ -349,13 +349,13 @@
+ 
+ CoeffType QuantChooser::BlockAbsMax( const Subband& node )
+ {
+-    int val( 0 );
++    CoeffType val( 0 );
+ 
+     for (int j=node.Yp() ; j<node.Yp()+node.Yl(); ++j)
+     {
+         for (int i=node.Xp() ; i<node.Xp()+node.Xl(); ++i)
+         {    
+-            val = std::max( val , std::abs(m_coeff_data[j][i]) );
++            val = std::max( val , CoeffType(std::abs(m_coeff_data[j][i])) );
+         }// i
+     }// j
+ 
+diff -aur dirac-1.0.2/libdirac_encoder/seq_compress.cpp dirac-1.0.2-modif/libdirac_encoder/seq_compress.cpp
+--- dirac-1.0.2/libdirac_encoder/seq_compress.cpp	2008-10-29 05:42:06.000000000 +0300
++++ dirac-1.0.2-modif/libdirac_encoder/seq_compress.cpp	2016-02-10 20:16:24.108885403 +0300
+@@ -663,7 +663,6 @@
+ 
+ int FrameSequenceCompressor::CodedToDisplay( const int cnum )
+ {
+-    int div;
+ 
+     if (m_L1_sep>0)
+     {
+@@ -672,7 +671,6 @@
+             return 0;
+         else if ((cnum-1)% m_L1_sep==0)
+         {//we have L1 or subsequent I pictures
+-            div=(cnum-1)/m_L1_sep;
+             return cnum+m_L1_sep-1;
+         }
+         else//we have L2 pictures
+diff -aur dirac-1.0.2/libdirac_motionest/me_utils.cpp dirac-1.0.2-modif/libdirac_motionest/me_utils.cpp
+--- dirac-1.0.2/libdirac_motionest/me_utils.cpp	2008-10-21 08:55:46.000000000 +0400
++++ dirac-1.0.2-modif/libdirac_motionest/me_utils.cpp	2016-02-10 20:04:40.068175649 +0300
+@@ -684,10 +684,10 @@
+         // We're doing bounds checking because we'll fall off the edge of the reference otherwise.
+ 
+        // weights for doing linear interpolation, calculated from the remainder values
+-        const ValueType linear_wts[4] = {  (2 - rmdr.x) * (2 - rmdr.y),    //tl
+-                                           rmdr.x * (2 - rmdr.y),          //tr
+-                                           (2 - rmdr.x) * rmdr.y,          //bl
+-                                           rmdr.x * rmdr.y };              //br
++        const ValueType linear_wts[4] = {  ValueType((2 - rmdr.x) * (2 - rmdr.y)),    //tl
++                                           ValueType(rmdr.x * (2 - rmdr.y)),          //tr
++                                           ValueType((2 - rmdr.x) * rmdr.y),          //bl
++                                           ValueType(rmdr.x * rmdr.y) };              //br
+ 
+         const int refXlen( m_ref_data.LengthX() );
+         const int refYlen( m_ref_data.LengthY() );
+@@ -848,10 +848,10 @@
+         // We're doing bounds checking because we'll fall off the edge of the reference otherwise.
+ 
+        // weights for doing linear interpolation, calculated from the remainder values
+-        const ValueType linear_wts[4] = {  (2 - rmdr.x) * (2 - rmdr.y),    //tl
+-                                           rmdr.x * (2 - rmdr.y),          //tr
+-                                           (2 - rmdr.x) * rmdr.y,          //bl
+-                                           rmdr.x * rmdr.y };              //br
++        const ValueType linear_wts[4] = {  ValueType((2 - rmdr.x) * (2 - rmdr.y)),    //tl
++                                           ValueType(rmdr.x * (2 - rmdr.y)),          //tr
++                                           ValueType((2 - rmdr.x) * rmdr.y),          //bl
++                                           ValueType(rmdr.x * rmdr.y) };              //br
+ 
+         const int refXlen( m_ref_data.LengthX() );
+         const int refYlen( m_ref_data.LengthY() );
+@@ -908,10 +908,10 @@
+     const int pic_next( m_pic_data.LengthX() - dparams.Xl() );// go down a row and back up
+ 
+     //weights for doing linear interpolation, calculated from the remainder values
+-    const ValueType linear_wts[4] = {  (4 - rmdr.x) * (4 - rmdr.y),    //tl
+-                                       rmdr.x * (4 - rmdr.y),          //tr
+-                                       (4 - rmdr.x) * rmdr.y,          //bl
+-                                       rmdr.x * rmdr.y };              //br
++    const ValueType linear_wts[4] = {  ValueType((4 - rmdr.x) * (4 - rmdr.y)),    //tl
++                                       ValueType(rmdr.x * (4 - rmdr.y)),          //tr
++                                       ValueType((4 - rmdr.x) * rmdr.y),          //bl
++                                       ValueType(rmdr.x * rmdr.y) };              //br
+ 
+     bool bounds_check( false );
+ 
+@@ -1039,10 +1039,10 @@
+     const int pic_next( m_pic_data.LengthX() - dparams.Xl() );// go down a row and back up
+ 
+     //weights for doing linear interpolation, calculated from the remainder values
+-    const ValueType linear_wts[4] = {  (4 - rmdr.x) * (4 - rmdr.y),    //tl
+-                                       rmdr.x * (4 - rmdr.y),          //tr
+-                                       (4 - rmdr.x) * rmdr.y,          //bl
+-                                       rmdr.x * rmdr.y };              //br
++    const ValueType linear_wts[4] = {  ValueType((4 - rmdr.x) * (4 - rmdr.y)),    //tl
++                                       ValueType(rmdr.x * (4 - rmdr.y)),          //tr
++                                       ValueType((4 - rmdr.x) * rmdr.y),          //bl
++                                       ValueType(rmdr.x * rmdr.y) };              //br
+ 
+     bool bounds_check( false );
+ 
+@@ -1403,10 +1403,10 @@
+     }
+     else
+     {
+-        const ValueType linear_wts[4] = {  (2 - rmdr1.x) * (2 - rmdr1.y),    //tl
+-                                           rmdr1.x * (2 - rmdr1.y),          //tr
+-                                           (2 - rmdr1.x) * rmdr1.y,          //bl
+-                                           rmdr1.x * rmdr1.y };              //br
++        const ValueType linear_wts[4] = {  ValueType((2 - rmdr1.x) * (2 - rmdr1.y)),    //tl
++                                           ValueType(rmdr1.x * (2 - rmdr1.y)),          //tr
++                                           ValueType((2 - rmdr1.x) * rmdr1.y),          //bl
++                                           ValueType(rmdr1.x * rmdr1.y) };              //br
+ 
+         // We're doing bounds checking because we'll fall off the edge of the reference otherwise.
+         for( int y=dparams.Yl(), ry=ref_start1.y, by=BChk(ry,m_ref_data1.LengthY()), by1=BChk(ry+1,m_ref_data1.LengthY()); 
+@@ -1513,10 +1513,10 @@
+     }
+     else
+     {
+-        const ValueType linear_wts[4] = {  (2 - rmdr2.x) * (2 - rmdr2.y),    //tl
+-                                           rmdr2.x * (2 - rmdr2.y),          //tr
+-                                           (2 - rmdr2.x) * rmdr2.y,          //bl
+-                                           rmdr2.x * rmdr2.y };              //br
++        const ValueType linear_wts[4] = {  ValueType((2 - rmdr2.x) * (2 - rmdr2.y)),    //tl
++                                           ValueType(rmdr2.x * (2 - rmdr2.y)),          //tr
++                                           ValueType((2 - rmdr2.x) * rmdr2.y),          //bl
++                                           ValueType(rmdr2.x * rmdr2.y) };              //br
+ 
+         // We're doing bounds checking because we'll fall off the edge of the reference otherwise.
+         for( int y=dparams.Yl(), ry=ref_start2.y, by=BChk(ry,m_ref_data2.LengthY()),by1=BChk(ry+1,m_ref_data2.LengthY()); 
+@@ -1564,14 +1564,14 @@
+     const MVector rmdr2( mv2.x & 3 , mv2.y & 3 );
+ 
+     //weights for doing linear interpolation, calculated from the remainder values
+-    const ValueType linear_wts1[4] = {  (4 - rmdr1.x) * (4 - rmdr1.y),    //tl
+-                                       rmdr1.x * (4 - rmdr1.y),          //tr
+-                                       (4 - rmdr1.x) * rmdr1.y,          //bl
+-                                       rmdr1.x * rmdr1.y };              //br
+-    const ValueType linear_wts2[4] = {  (4 - rmdr2.x) * (4 - rmdr2.y),    //tl
+-                                       rmdr2.x * (4 - rmdr2.y),          //tr
+-                                       (4 - rmdr2.x) * rmdr2.y,          //bl
+-                                       rmdr2.x * rmdr2.y };              //br
++    const ValueType linear_wts1[4] = {  ValueType((4 - rmdr1.x) * (4 - rmdr1.y)),    //tl
++                                        ValueType(rmdr1.x * (4 - rmdr1.y)),          //tr
++                                        ValueType((4 - rmdr1.x) * rmdr1.y),          //bl
++                                        ValueType(rmdr1.x * rmdr1.y) };              //br
++    const ValueType linear_wts2[4] = {  ValueType((4 - rmdr2.x) * (4 - rmdr2.y)),    //tl
++                                        ValueType(rmdr2.x * (4 - rmdr2.y)),          //tr
++                                        ValueType((4 - rmdr2.x) * rmdr2.y),          //bl
++                                        ValueType(rmdr2.x * rmdr2.y) };              //br
+ 
+     //Where to start in the upconverted images
+     const ImageCoords ref_start1( ( dparams.Xp()<<1 ) + roundvec1.x ,( dparams.Yp()<<1 ) + roundvec1.y );
+diff -aur dirac-1.0.2/util/conversion/common/bitmap.cpp dirac-1.0.2-modif/util/conversion/common/bitmap.cpp
+--- dirac-1.0.2/util/conversion/common/bitmap.cpp	2004-06-30 20:44:52.000000000 +0400
++++ dirac-1.0.2-modif/util/conversion/common/bitmap.cpp	2016-02-10 20:19:58.355494888 +0300
+@@ -142,14 +142,9 @@
+         char signature[2];
+         int fileSize;
+         int dataOffset;
+-        int size;
+         int planes;
+         int bitCount;
+         int compression;
+-        int imageSize;
+-        int xPixelsPerM, yPixelsPerM;
+-        int coloursUsed;
+-        int coloursImportant;
+         //Define buffer to read bytes into.
+         const int bufferSize = 54;
+         char buffer[bufferSize];
+@@ -175,7 +170,7 @@
+         //Reposition input buffer to skip over extra header data if necessary
+         //Should check success of operation (see The C++ Stand Lib, Josuttis, p665)
+         if (dataOffset>54) inbuf.pubseekoff(dataOffset-54, std::ios_base::cur, std::ios_base::in);
+-        size = read4bytes(buffer+14);
++        (void)read4bytes(buffer+14); // size
+         w = read4bytes(buffer+18);
+         h = read4bytes(buffer+22);
+         if ( fileSize != (dataOffset + height()*lineBufferSize()) ) input.setstate(std::ios::failbit);
+@@ -185,11 +180,11 @@
+         if ( bitCount != 24 ) input.setstate(std::ios::failbit);
+         compression = read4bytes(buffer+30);
+         if ( compression != 0 ) input.setstate(std::ios::failbit);
+-        imageSize = read4bytes(buffer+34);
+-        xPixelsPerM = read4bytes(buffer+38);
+-        yPixelsPerM = read4bytes(buffer+42);
+-        coloursUsed = read4bytes(buffer+46);
+-        coloursImportant = read4bytes(buffer+50);
++        (void)read4bytes(buffer+34); // imageSize
++        (void)read4bytes(buffer+38); // xPixelsPerM
++        (void)read4bytes(buffer+42); // yPixelsPerM
++        (void)read4bytes(buffer+46); // coloursUsed
++        (void)read4bytes(buffer+50); // coloursImportant
+         return input; }
+ 
+ }  // end namespace dirac_vu
diff --git a/nixpkgs/pkgs/development/libraries/directfb/default.nix b/nixpkgs/pkgs/development/libraries/directfb/default.nix
new file mode 100644
index 000000000000..3d831efbcb7d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/directfb/default.nix
@@ -0,0 +1,62 @@
+{ stdenv, fetchurl, pkgconfig, perl, zlib, libjpeg, freetype, libpng, giflib
+, enableX11 ? true, xorg
+, enableSDL ? true, SDL }:
+
+let s = 
+rec {
+   version = "1.7.7";
+   name="directfb-${version}";
+   sha256 = "18r7h0pwbyyk8z3pgdv77nmma8lvr1si9gl1ghxgxf1ivhwcd1dp";
+   url="http://directfb.org/downloads/Core/DirectFB-1.7/DirectFB-${version}.tar.gz";
+}
+; in
+stdenv.mkDerivation {
+  inherit (s) name;
+  src = fetchurl {
+    inherit (s) url sha256;
+  };
+
+  nativeBuildInputs = [ perl pkgconfig ];
+
+  buildInputs = [ zlib libjpeg freetype giflib libpng ]
+    ++ stdenv.lib.optional enableSDL SDL
+    ++ stdenv.lib.optionals enableX11 (with xorg; [
+      xorgproto libX11 libXext
+      libXrender
+    ]);
+
+  NIX_LDFLAGS="-lgcc_s";
+
+  configureFlags = [
+    "--enable-sdl"
+    "--enable-zlib"
+    "--with-gfxdrivers=all"
+    "--enable-devmem"
+    "--enable-fbdev"
+    "--enable-mmx"
+    "--enable-sse"
+    #"--enable-sysfs" # not recognized
+    "--with-software"
+    "--with-smooth-scaling"
+    ] ++ stdenv.lib.optionals enableX11 [
+      "--enable-x11"
+    ];
+
+  meta = with stdenv.lib; {
+    description = "Graphics and input library designed with embedded systems in mind";
+    longDescription = ''
+      DirectFB is a thin library that provides hardware graphics acceleration,
+      input device handling and abstraction, integrated windowing system with
+      support for translucent windows and multiple display layers, not only on
+      top of the Linux Framebuffer Device. It is a complete hardware
+      abstraction layer with software fallbacks for every graphics operation
+      that is not supported by the underlying hardware. DirectFB adds graphical
+      power to embedded systems and sets a new standard for graphics under
+      Linux.
+    '';
+    homepage = http://directfb.org/;
+    license = licenses.lgpl21;
+    platforms = platforms.linux;
+    maintainers = [ maintainers.bjornfor ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/directfb/default.upstream b/nixpkgs/pkgs/development/libraries/directfb/default.upstream
new file mode 100644
index 000000000000..ef4ed8e490d1
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/directfb/default.upstream
@@ -0,0 +1,3 @@
+url 'http://directfb.org/index.php?path=Main%2FDownloads'
+version_link 'DirectFB-[0-9]'
+minimize_overwrite
diff --git a/nixpkgs/pkgs/development/libraries/dleyna-connector-dbus/default.nix b/nixpkgs/pkgs/development/libraries/dleyna-connector-dbus/default.nix
new file mode 100644
index 000000000000..d52f1b6a2cff
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/dleyna-connector-dbus/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, autoreconfHook, pkgconfig, fetchFromGitHub, dbus, dleyna-core, glib }:
+
+stdenv.mkDerivation rec {
+  pname = "dleyna-connector-dbus";
+  name = "${pname}-${version}";
+  version = "0.3.0";
+
+  src = fetchFromGitHub {
+    owner = "01org";
+    repo = pname;
+    rev = version;
+    sha256 = "0vziq5gwjm79yl2swch2mz6ias20nvfddf5cqgk9zbg25cb9m117";
+  };
+
+  nativeBuildInputs = [ autoreconfHook pkgconfig ];
+  buildInputs = [ dbus dleyna-core glib ];
+
+  meta = with stdenv.lib; {
+    description = "A D-Bus API for the dLeyna services";
+    homepage = https://01.org/dleyna;
+    maintainers = [ maintainers.jtojnar ];
+    platforms = platforms.linux;
+    license = licenses.lgpl21;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/dleyna-core/0001-Search-connectors-in-DLEYNA_CONNECTOR_PATH.patch b/nixpkgs/pkgs/development/libraries/dleyna-core/0001-Search-connectors-in-DLEYNA_CONNECTOR_PATH.patch
new file mode 100644
index 000000000000..cc50c1598005
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/dleyna-core/0001-Search-connectors-in-DLEYNA_CONNECTOR_PATH.patch
@@ -0,0 +1,95 @@
+From bf549a028a5da122b7a4206529711b969c2ecd48 Mon Sep 17 00:00:00 2001
+From: Jan Tojnar <jtojnar@gmail.com>
+Date: Fri, 1 Sep 2017 13:49:06 +0200
+Subject: [PATCH] Search connectors in DLEYNA_CONNECTOR_PATH
+
+Previously, the connectors would only be looked for in a single
+directory, specified during compilation. This patch allows to
+traverse a list of directories provided by an environment variable.
+---
+ libdleyna/core/connector-mgr.c | 63 ++++++++++++++++++++++++++++--------------
+ 1 file changed, 42 insertions(+), 21 deletions(-)
+
+diff --git a/libdleyna/core/connector-mgr.c b/libdleyna/core/connector-mgr.c
+index eafb16c..8041c67 100644
+--- a/libdleyna/core/connector-mgr.c
++++ b/libdleyna/core/connector-mgr.c
+@@ -34,33 +34,54 @@ const dleyna_connector_t *dleyna_connector_mgr_load(const gchar *name)
+ 	const dleyna_connector_t *connector;
+ 	dleyna_connector_get_interface_t get_interface;
+ 	gchar *path;
++	const gchar *connector_path;
++	gchar **connector_path_list;
++	gsize i;
+ 
+ 	DLEYNA_LOG_DEBUG("Enter");
+ 
+-	path = g_strdup_printf("%s/%s%s.so", CONNECTOR_DIR,
+-			       DLEYNA_CONNECTOR_LIB_PATTERN, name);
+-	module = g_module_open(path, G_MODULE_BIND_LAZY);
+-	g_free(path);
++	connector_path = g_getenv ("DLEYNA_CONNECTOR_PATH");
++	if (!connector_path) {
++		DLEYNA_LOG_DEBUG ("DLEYNA_CONNECTOR_PATH not set");
++		connector_path = CONNECTOR_DIR;
++	} else {
++		DLEYNA_LOG_DEBUG ("DLEYNA_CONNECTOR_PATH set to %s", connector_path);
++	}
++
++	connector_path_list = g_strsplit (connector_path, G_SEARCHPATH_SEPARATOR_S, 0);
++
++	for (i = 0; connector_path_list[i]; i++) {
++		path = g_strdup_printf("%s/%s%s.so", connector_path_list[i],
++				       DLEYNA_CONNECTOR_LIB_PATTERN, name);
++		module = g_module_open(path, G_MODULE_BIND_LAZY);
++		g_free(path);
++
++		if (module) {
++			if (!g_connectors)
++				g_connectors = g_hash_table_new(g_direct_hash,
++								g_direct_equal);
++
++			if (g_module_symbol(module, "dleyna_connector_get_interface",
++					    (gpointer *)&get_interface)) {
++				connector = get_interface();
++				g_hash_table_insert(g_connectors, (gpointer)connector,
++						    module);
++
++				break;
++			} else {
++				connector = NULL;
++				g_module_close(module);
++				DLEYNA_LOG_CRITICAL(
++						"Connector '%s' entry point not found",
++						name);
++			}
+ 
+-	if (module) {
+-		if (!g_connectors)
+-			g_connectors = g_hash_table_new(g_direct_hash,
+-							g_direct_equal);
+-
+-		if (g_module_symbol(module, "dleyna_connector_get_interface",
+-				    (gpointer *)&get_interface)) {
+-			connector = get_interface();
+-			g_hash_table_insert(g_connectors, (gpointer)connector,
+-					    module);
+-		} else {
+-			connector = NULL;
+-			g_module_close(module);
+-			DLEYNA_LOG_CRITICAL(
+-					"Connector '%s' entry point not found",
+-					name);
+ 		}
++	}
+ 
+-	} else {
++	g_strfreev (connector_path_list);
++
++	if (!module) {
+ 		connector = NULL;
+ 		DLEYNA_LOG_CRITICAL("Connector '%s' not found", name);
+ 	}
+-- 
+2.14.1
+
diff --git a/nixpkgs/pkgs/development/libraries/dleyna-core/default.nix b/nixpkgs/pkgs/development/libraries/dleyna-core/default.nix
new file mode 100644
index 000000000000..9d83812fefb7
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/dleyna-core/default.nix
@@ -0,0 +1,49 @@
+{ stdenv
+, fetchFromGitHub
+, fetchpatch
+, autoreconfHook
+, pkgconfig
+, gupnp
+}:
+
+stdenv.mkDerivation rec {
+  pname = "dleyna-core";
+  version = "0.6.0";
+
+  setupHook = ./setup-hook.sh;
+
+  src = fetchFromGitHub {
+    owner = "01org";
+    repo = pname;
+    rev = "v${version}";
+    sha256 = "1x5vj5zfk95avyg6g3nf6gar250cfrgla2ixj2ifn8pcick2d9vq";
+  };
+
+  patches = [
+    ./0001-Search-connectors-in-DLEYNA_CONNECTOR_PATH.patch
+
+    # fix build with gupnp 1.2
+    # https://github.com/intel/dleyna-core/pull/52
+    (fetchpatch {
+      url = https://github.com/intel/dleyna-core/commit/41b2e56f67b6fc9c8c256b86957d281644b9b846.patch;
+      sha256 = "1h758cp65v7qyfpvyqdri7q0gwx85mhdpkb2y8waq735q5q9ib39";
+    })
+  ];
+
+  nativeBuildInputs = [
+    autoreconfHook
+    pkgconfig
+  ];
+
+  propagatedBuildInputs = [
+    gupnp
+  ];
+
+  meta = with stdenv.lib; {
+    description = "Library of utility functions that are used by the higher level dLeyna";
+    homepage = https://01.org/dleyna;
+    maintainers = [ maintainers.jtojnar ];
+    platforms = platforms.linux;
+    license = licenses.lgpl21;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/dleyna-core/setup-hook.sh b/nixpkgs/pkgs/development/libraries/dleyna-core/setup-hook.sh
new file mode 100644
index 000000000000..87b5c67dff58
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/dleyna-core/setup-hook.sh
@@ -0,0 +1,8 @@
+addDleynaConnectorPath () {
+    if test -d "$1/lib/dleyna-1.0/connectors"
+    then
+        export DLEYNA_CONNECTOR_PATH="${DLEYNA_CONNECTOR_PATH}${DLEYNA_CONNECTOR_PATH:+:}$1/lib/dleyna-1.0/connectors"
+    fi
+}
+
+addEnvHooks "$targetOffset" addDleynaConnectorPath
diff --git a/nixpkgs/pkgs/development/libraries/dleyna-renderer/default.nix b/nixpkgs/pkgs/development/libraries/dleyna-renderer/default.nix
new file mode 100644
index 000000000000..aae7861fef4f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/dleyna-renderer/default.nix
@@ -0,0 +1,61 @@
+{ stdenv
+, fetchurl
+, fetchFromGitHub
+, autoreconfHook
+, pkgconfig
+, dleyna-connector-dbus
+, dleyna-core
+, gssdp
+, gupnp
+, gupnp-av
+, gupnp-dlna
+, libsoup
+, makeWrapper
+}:
+
+stdenv.mkDerivation rec {
+  pname = "dleyna-renderer";
+  version = "0.6.0";
+
+  src = fetchFromGitHub {
+    owner = "01org";
+    repo = pname;
+    rev = version;
+    sha256 = "0jy54aq8hgrvzchrvfzqaj4pcn0cfhafl9bv8a9p6j82yjk4pvpp";
+  };
+
+  patches = [
+    # fix build with gupnp 1.2
+    # comes from arch linux packaging https://git.archlinux.org/svntogit/packages.git/tree/trunk/gupnp-1.2.diff?h=packages/dleyna-renderer
+    ./gupnp-1.2.diff
+  ];
+
+  nativeBuildInputs = [
+    autoreconfHook
+    pkgconfig
+    makeWrapper
+  ];
+
+  buildInputs = [
+    dleyna-core
+    dleyna-connector-dbus
+    gssdp
+    gupnp
+    gupnp-av
+    gupnp-dlna
+    libsoup
+  ];
+
+  preFixup = ''
+    wrapProgram "$out/libexec/dleyna-renderer-service" \
+      --set DLEYNA_CONNECTOR_PATH "$DLEYNA_CONNECTOR_PATH"
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Library to discover and manipulate Digital Media Renderers";
+    homepage = https://01.org/dleyna;
+    maintainers = [ maintainers.jtojnar ];
+    platforms = platforms.linux;
+    license = licenses.lgpl21;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/dleyna-renderer/gupnp-1.2.diff b/nixpkgs/pkgs/development/libraries/dleyna-renderer/gupnp-1.2.diff
new file mode 100644
index 000000000000..3255695ab23e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/dleyna-renderer/gupnp-1.2.diff
@@ -0,0 +1,130 @@
+ configure.ac                |  4 ++--
+ libdleyna/renderer/device.c | 51 +++++++++++++++++++++++++++++++++++++++++++--
+ libdleyna/renderer/upnp.c   |  4 ++--
+ 3 files changed, 53 insertions(+), 6 deletions(-)
+
+diff --git c/configure.ac i/configure.ac
+index 271ee92..364659d 100644
+--- c/configure.ac
++++ i/configure.ac
+@@ -38,8 +38,8 @@ LT_LANG([C])
+ PKG_PROG_PKG_CONFIG(0.16)
+ PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.28])
+ PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.28])
+-PKG_CHECK_MODULES([GSSDP], [gssdp-1.0 >= 0.13.2])
+-PKG_CHECK_MODULES([GUPNP], [gupnp-1.0 >= 0.20.5])
++PKG_CHECK_MODULES([GSSDP], [gssdp-1.2 >= 1.2.0])
++PKG_CHECK_MODULES([GUPNP], [gupnp-1.2 >= 1.2.0])
+ PKG_CHECK_MODULES([GUPNPAV], [gupnp-av-1.0 >= 0.11.5])
+ PKG_CHECK_MODULES([GUPNPDLNA], [gupnp-dlna-2.0 >= 0.9.4])
+ PKG_CHECK_MODULES([SOUP], [libsoup-2.4 >= 2.28.2])
+diff --git c/libdleyna/renderer/device.c i/libdleyna/renderer/device.c
+index 7acef89..f6d571e 100644
+--- c/libdleyna/renderer/device.c
++++ i/libdleyna/renderer/device.c
+@@ -2121,33 +2121,80 @@ exit:
+ 	return;
+ }
+ 
++typedef struct
++{
++  GMainLoop *loop;
++  GUPnPServiceIntrospection *introspection;
++  GError **error;
++} GetIntrospectionAsyncData;
++
++static void
++get_introspection_async_cb (GUPnPServiceInfo           *info,
++                            GUPnPServiceIntrospection  *introspection,
++                            const GError               *error,
++                            gpointer                    user_data)
++{
++  GetIntrospectionAsyncData *data = user_data;
++  data->introspection = introspection;
++  if (data->error)
++    *data->error = g_error_copy (error);
++  g_main_loop_quit (data->loop);
++}
++
++static GUPnPServiceIntrospection *
++_gupnp_service_info_get_introspection (GUPnPServiceInfo *info,
++                                       GError          **error)
++{
++  GetIntrospectionAsyncData data;
++  GMainContext *context;
++
++  context = g_main_context_new ();
++  data.loop = g_main_loop_new (context, FALSE);
++  data.error = error;
++
++  g_main_context_push_thread_default (context);
++
++  gupnp_service_info_get_introspection_async (info,
++                                              get_introspection_async_cb,
++                                              &data);
++
++  g_main_loop_run (data.loop);
++
++  g_main_context_pop_thread_default (context);
++
++  g_main_loop_unref (data.loop);
++  g_main_context_unref (context);
++
++  return data.introspection;
++}
++
+ static gboolean prv_get_av_service_states_values(GUPnPServiceProxy *av_proxy,
+ 						 GVariant **mpris_tp_speeds,
+ 						 GPtrArray **upnp_tp_speeds,
+ 						 double *min_rate,
+ 						 double *max_rate,
+ 						 gboolean *can_get_byte_pos)
+ {
+ 	const GUPnPServiceStateVariableInfo *svi;
+ 	const GUPnPServiceActionInfo *sai;
+ 	GUPnPServiceIntrospection *introspection;
+ 	GError *error = NULL;
+ 	GVariant *speeds = NULL;
+ 	GList *allowed_values;
+ 	gpointer weak_ref = NULL;
+ 	gboolean  device_alive = TRUE;
+ 
+ 	/* TODO: this weak_ref hack is needed as
+ 	   gupnp_service_info_get_introspection iterates the main loop.
+ 	   This can result in our device getting deleted before this
+ 	   function returns.  Ultimately, this code needs to be re-written
+ 	   to use gupnp_service_info_get_introspection_async but this cannot
+ 	   really be done until GUPnP provides a way to cancel this function. */
+ 
+ 	weak_ref = av_proxy;
+ 	g_object_add_weak_pointer(G_OBJECT(av_proxy), &weak_ref);
+ 
+-	introspection = gupnp_service_info_get_introspection(
++	introspection = _gupnp_service_info_get_introspection(
+ 		GUPNP_SERVICE_INFO(av_proxy),
+ 		&error);
+ 
+@@ -2215,7 +2262,7 @@ static gboolean prv_get_rc_service_states_values(GUPnPServiceProxy *rc_proxy,
+ 	weak_ref = rc_proxy;
+ 	g_object_add_weak_pointer(G_OBJECT(rc_proxy), &weak_ref);
+ 
+-	introspection = gupnp_service_info_get_introspection(
++	introspection = _gupnp_service_info_get_introspection(
+ 		GUPNP_SERVICE_INFO(rc_proxy),
+ 		&error);
+ 
+diff --git c/libdleyna/renderer/upnp.c i/libdleyna/renderer/upnp.c
+index 17cbda7..068912b 100644
+--- c/libdleyna/renderer/upnp.c
++++ i/libdleyna/renderer/upnp.c
+@@ -243,8 +243,8 @@ static void prv_server_unavailable_cb(GUPnPControlPoint *cp,
+ 
+ 	udn = gupnp_device_info_get_udn((GUPnPDeviceInfo *)proxy);
+ 
+-	ip_address = gupnp_context_get_host_ip(
+-		gupnp_control_point_get_context(cp));
++	ip_address = gssdp_client_get_host_ip(
++		GSSDP_CLIENT(gupnp_control_point_get_context(cp)));
+ 
+ 	if (!udn || !ip_address)
+ 		goto on_error;
diff --git a/nixpkgs/pkgs/development/libraries/dleyna-server/default.nix b/nixpkgs/pkgs/development/libraries/dleyna-server/default.nix
new file mode 100644
index 000000000000..4730d4559503
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/dleyna-server/default.nix
@@ -0,0 +1,64 @@
+{ stdenv
+, fetchFromGitHub
+, fetchpatch
+, autoreconfHook
+, makeWrapper
+, pkgconfig
+, dleyna-core
+, dleyna-connector-dbus
+, gssdp
+, gupnp
+, gupnp-av
+, gupnp-dlna
+, libsoup
+}:
+
+stdenv.mkDerivation rec {
+  pname = "dleyna-server";
+  version = "0.6.0";
+
+  src = fetchFromGitHub {
+    owner = "01org";
+    repo = pname;
+    rev = version;
+    sha256 = "13a2i6ms27s46yxdvlh2zm7pim7jmr5cylnygzbliz53g3gxxl3j";
+  };
+
+  patches = [
+    # fix build with gupnp 1.2
+    # https://github.com/intel/dleyna-server/pull/161
+    (fetchpatch {
+      url = https://github.com/intel/dleyna-server/commit/96c01c88363d6e5e9b7519bc4e8b5d86cf783e1f.patch;
+      sha256 = "0p8fn331x2whvn6skxqvfzilx0m0yx2q5mm2wh2625l396m3fzmm";
+    })
+  ];
+
+  nativeBuildInputs = [
+    autoreconfHook
+    pkgconfig
+    makeWrapper
+  ];
+
+  buildInputs = [
+    dleyna-core
+    dleyna-connector-dbus
+    gssdp
+    gupnp
+    gupnp-av
+    gupnp-dlna
+    libsoup
+  ];
+
+  preFixup = ''
+    wrapProgram "$out/libexec/dleyna-server-service" \
+      --set DLEYNA_CONNECTOR_PATH "$DLEYNA_CONNECTOR_PATH"
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Library to discover, browse and manipulate Digital Media Servers";
+    homepage = https://01.org/dleyna;
+    maintainers = [ maintainers.jtojnar ];
+    platforms = platforms.linux;
+    license = licenses.lgpl21;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/dlib/default.nix b/nixpkgs/pkgs/development/libraries/dlib/default.nix
new file mode 100644
index 000000000000..67a56855bb79
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/dlib/default.nix
@@ -0,0 +1,36 @@
+{ stdenv, lib, fetchFromGitHub, cmake, pkgconfig, libpng, libjpeg
+, guiSupport ? false, libX11
+
+  # see http://dlib.net/compile.html
+, avxSupport ? true
+}:
+
+stdenv.mkDerivation rec {
+  version = "19.16";
+  name = "dlib-${version}";
+
+  src = fetchFromGitHub {
+    owner = "davisking";
+    repo = "dlib";
+    rev ="v${version}";
+    sha256 = "0ix52npsxfm6324jli7y0zkyijl5yirv2yzfncyd4sq0r9fcwb4p";
+  };
+
+  postPatch = ''
+    rm -rf dlib/external
+  '';
+
+  cmakeFlags = [ "-DUSE_AVX_INSTRUCTIONS=${if avxSupport then "yes" else "no"}" ];
+
+  enableParallelBuilding = true;
+  nativeBuildInputs = [ cmake pkgconfig ];
+  buildInputs = [ libpng libjpeg ] ++ lib.optional guiSupport libX11;
+
+  meta = with stdenv.lib; {
+    description = "A general purpose cross-platform C++ machine learning library";
+    homepage = http://www.dlib.net;
+    license = licenses.boost;
+    maintainers = with maintainers; [ christopherpoole ma27 ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/docopt_cpp/default.nix b/nixpkgs/pkgs/development/libraries/docopt_cpp/default.nix
new file mode 100644
index 000000000000..83466b693f59
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/docopt_cpp/default.nix
@@ -0,0 +1,30 @@
+{ stdenv, fetchFromGitHub, cmake, python }:
+
+stdenv.mkDerivation rec {
+  version = "0.6.2";
+  name = "docopt.cpp-${version}";
+
+  src = fetchFromGitHub {
+    owner = "docopt";
+    repo = "docopt.cpp";
+    rev = "v${version}";
+    sha256 = "1rgkc8nsc2zz2lkyai0y68vrd6i6kbq63hm3vdza7ab6ghq0n1dd";
+  };
+
+  nativeBuildInputs = [ cmake python ];
+
+  cmakeFlags = ["-DWITH_TESTS=ON"];
+
+  doCheck = true;
+
+  checkPhase = "LD_LIBRARY_PATH=$(pwd) python ./run_tests";
+
+  meta = with stdenv.lib; {
+    description = "C++11 port of docopt";
+    homepage = https://github.com/docopt/docopt.cpp;
+    license = with licenses; [ mit boost ];
+    platforms = platforms.all;
+    maintainers = with maintainers; [ knedlsepp ];
+  };
+}
+
diff --git a/nixpkgs/pkgs/development/libraries/dotconf/default.nix b/nixpkgs/pkgs/development/libraries/dotconf/default.nix
new file mode 100644
index 000000000000..a2b2e08fd622
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/dotconf/default.nix
@@ -0,0 +1,24 @@
+{ fetchFromGitHub, stdenv, autoreconfHook }:
+
+stdenv.mkDerivation rec {
+  name = "dotconf-" + version;
+  version = "1.3";
+
+  src = fetchFromGitHub {
+    owner = "williamh";
+    repo = "dotconf";
+    rev = "v${version}";
+    sha256 = "1sc95hw5k2xagpafny0v35filmcn05k1ds5ghkldfpf6xw4hakp7";
+  };
+
+  nativeBuildInputs = [ autoreconfHook ];
+  buildInputs = [ ];
+
+  meta = with stdenv.lib; {
+    description = "A configuration parser library";
+    maintainers = with maintainers; [ pSub ];
+    homepage = https://github.com/williamh/dotconf;
+    license = licenses.lgpl21Plus;
+    platforms = with platforms; unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/dotnetfx35/default.nix b/nixpkgs/pkgs/development/libraries/dotnetfx35/default.nix
new file mode 100644
index 000000000000..e1c59846aec5
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/dotnetfx35/default.nix
@@ -0,0 +1,23 @@
+{stdenv}:
+
+let
+  windir = "/cygdrive/c/WINDOWS";
+in
+{
+  pkg = stdenv.mkDerivation {
+    name = "dotnetfx-3.5";
+    src = "${windir}/Microsoft.NET/Framework/v3.5";
+    buildCommand = ''
+      mkdir -p $out/bin
+      ln -s $src/MSBuild.exe $out/bin
+    '';
+  };
+  
+  assembly20Path = "/cygdrive/c/WINDOWS/Microsoft.NET/Framework/v2.0.50727";
+  
+  wcfPath = "/cygdrive/c/WINDOWS/Microsoft.NET/Framework/v3.0/WINDOW~1";
+  
+  referenceAssembly30Path = "/cygdrive/c/PROGRA~1/REFERE~1/Microsoft/Framework/v3.0";
+  
+  referenceAssembly35Path = "/cygdrive/c/PROGRA~1/REFERE~1/Microsoft/Framework/v3.5";
+}
diff --git a/nixpkgs/pkgs/development/libraries/dotnetfx40/default.nix b/nixpkgs/pkgs/development/libraries/dotnetfx40/default.nix
new file mode 100644
index 000000000000..701464071d03
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/dotnetfx40/default.nix
@@ -0,0 +1,23 @@
+{stdenv}:
+
+let
+  windir = "/cygdrive/c/WINDOWS";
+in
+{
+  pkg = stdenv.mkDerivation {
+    name = "dotnetfx-4.0";
+    src = "${windir}/Microsoft.NET/Framework/v4.0.30319";
+    buildCommand = ''
+      mkdir -p $out/bin
+      ln -s $src/MSBuild.exe $out/bin
+    '';
+  };
+  
+  assembly20Path = "/cygdrive/c/WINDOWS/Microsoft.NET/Framework/v2.0.50727";
+  
+  wcfPath = "/cygdrive/c/WINDOWS/Microsoft.NET/Framework/v3.0/WINDOW~1";
+  
+  referenceAssembly30Path = "/cygdrive/c/PROGRA~1/REFERE~1/Microsoft/Framework/v3.0";
+  
+  referenceAssembly35Path = "/cygdrive/c/PROGRA~1/REFERE~1/Microsoft/Framework/v3.5";
+}
diff --git a/nixpkgs/pkgs/development/libraries/double-conversion/default.nix b/nixpkgs/pkgs/development/libraries/double-conversion/default.nix
new file mode 100644
index 000000000000..095697762ddd
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/double-conversion/default.nix
@@ -0,0 +1,32 @@
+{ stdenv, lib, fetchFromGitHub, cmake }:
+
+stdenv.mkDerivation rec {
+  name = "double-conversion-${version}";
+  version = "3.1.5";
+
+  src = fetchFromGitHub {
+    owner = "google";
+    repo = "double-conversion";
+    rev = "v${version}";
+    sha256 = "0csy4pjw1p8rp6g5qxi2h0ychhhp1fldv7gb761627fs2mclw9gv";
+  };
+
+  nativeBuildInputs = [ cmake ];
+
+  cmakeFlags = [ "-DBUILD_SHARED_LIBS=ON" ];
+
+  # Case sensitivity issue
+  preConfigure = lib.optionalString stdenv.isDarwin ''
+    rm BUILD
+  '';
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    description = "Binary-decimal and decimal-binary routines for IEEE doubles";
+    homepage = https://github.com/google/double-conversion;
+    license = licenses.bsd3;
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ abbradar ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/dqlite/default.nix b/nixpkgs/pkgs/development/libraries/dqlite/default.nix
new file mode 100644
index 000000000000..093abe085f0a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/dqlite/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchFromGitHub, autoreconfHook, pkgconfig, libuv, sqlite-replication }:
+
+with stdenv.lib;
+
+stdenv.mkDerivation rec {
+  pname = "dqlite";
+  version = "0.2.6";
+
+  src = fetchFromGitHub {
+    owner = "CanonicalLtd";
+    repo = pname;
+    rev = "v${version}";
+    sha256 = "13l7na5858v2ah1vim6lafmzajgkymfi5rd6bk14cm4vcnxc40wb";
+  };
+
+  nativeBuildInputs = [ autoreconfHook pkgconfig ];
+
+  buildInputs = [ libuv sqlite-replication ];
+
+  meta = {
+    description = "Expose a SQLite database over the network and replicate it across a cluster of peers";
+    homepage = https://github.com/CanonicalLtd/dqlite/;
+    license = licenses.asl20;
+    maintainers = with maintainers; [ joko ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/drumstick/default.nix b/nixpkgs/pkgs/development/libraries/drumstick/default.nix
new file mode 100644
index 000000000000..c85f6de0405c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/drumstick/default.nix
@@ -0,0 +1,35 @@
+{ stdenv, fetchurl, alsaLib, cmake, docbook_xsl, docbook_xml_dtd_45, doxygen
+, fluidsynth, pkgconfig, qt5
+}:
+
+stdenv.mkDerivation rec {
+  name = "drumstick-${version}";
+  version = "1.1.2";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/drumstick/${version}/${name}.tar.bz2";
+    sha256 = "0kljqyqj7s1i2z52i24x7ail1bywn6dcxxfbad5c59drm8wv94bp";
+  };
+
+  outputs = [ "out" "dev" "man" ];
+
+  enableParallelBuilding = true;
+
+  #Temporarily remove drumstick-piano; Gives segment fault. Submitted ticket
+  postInstall = ''
+    rm $out/bin/drumstick-vpiano
+    '';
+
+  nativeBuildInputs = [ cmake pkgconfig docbook_xsl docbook_xml_dtd_45 docbook_xml_dtd_45 ];
+  buildInputs = [
+    alsaLib doxygen fluidsynth qt5.qtbase qt5.qtsvg
+  ];
+
+  meta = with stdenv.lib; {
+    maintainers = with maintainers; [ solson ];
+    description = "MIDI libraries for Qt5/C++";
+    homepage = http://drumstick.sourceforge.net/;
+    license = licenses.gpl2Plus;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/dssi/default.nix b/nixpkgs/pkgs/development/libraries/dssi/default.nix
new file mode 100644
index 000000000000..9be19f51e7e8
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/dssi/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchurl, ladspaH, libjack2, liblo, alsaLib, qt4, libX11, libsndfile, libSM
+, libsamplerate, libtool, autoconf, automake, xorgproto, libICE, pkgconfig
+}:
+
+stdenv.mkDerivation rec {
+  name = "dssi-${version}";
+  version = "1.1.1";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/project/dssi/dssi/${version}/${name}.tar.gz";
+    sha256 = "0kl1hzhb7cykzkrqcqgq1dk4xcgrcxv0jja251aq4z4l783jpj7j";
+  };
+
+  buildInputs =
+    [ ladspaH libjack2 liblo alsaLib qt4 libX11 libsndfile libSM
+      libsamplerate libtool autoconf automake xorgproto libICE pkgconfig
+    ];
+
+  meta = with stdenv.lib; {
+    description = "A plugin SDK for virtual instruments";
+    maintainers = with maintainers;
+    [
+      raskin
+    ];
+    platforms = platforms.linux;
+    license = licenses.lgpl21;
+    downloadPage = "https://sourceforge.net/projects/dssi/files/dssi/";
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/dxflib/default.nix b/nixpkgs/pkgs/development/libraries/dxflib/default.nix
new file mode 100644
index 000000000000..832b013123dd
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/dxflib/default.nix
@@ -0,0 +1,17 @@
+{stdenv, fetchurl}:
+
+stdenv.mkDerivation rec {
+  version = "3.12.2";
+  name = "dxflib-${version}";
+  src = fetchurl {
+    url = "http://www.qcad.org/archives/dxflib/${name}.src.tar.gz";
+    sha256 = "20ad9991eec6b0f7a3cc7c500c044481a32110cdc01b65efa7b20d5ff9caefa9";
+  };
+
+  meta = {
+    maintainers = with stdenv.lib.maintainers; [raskin];
+    platforms = stdenv.lib.platforms.linux;
+    description = ''DXF file format library'';
+  };
+}
+
diff --git a/nixpkgs/pkgs/development/libraries/dyncall/default.nix b/nixpkgs/pkgs/development/libraries/dyncall/default.nix
new file mode 100644
index 000000000000..704f5c51c9c9
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/dyncall/default.nix
@@ -0,0 +1,36 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "dyncall-${version}";
+  version = "1.0";
+
+  src = fetchurl {
+    url = http://www.dyncall.org/r1.0/dyncall-1.0.tar.gz;
+    # http://www.dyncall.org/r1.0/SHA256
+    sha256 = "d1b6d9753d67dcd4d9ea0708ed4a3018fb5bfc1eca5f37537fba2bc4f90748f2";
+  };
+
+  # XXX: broken tests, failures masked, lets avoid crashing a bunch for now :)
+  doCheck = false;
+
+  # install bits not automatically installed
+  postInstall = ''
+    # install cmake modules to make using dyncall easier
+    # This is essentially what -DINSTALL_CMAKE_MODULES=ON if using cmake build
+    # We don't use the cmake-based build since it installs different set of headers
+    # (mostly fewer headers, but installs dyncall_alloc_wx.h "instead" dyncall_alloc.h)
+    # and we'd have to patch the cmake module installation to not use CMAKE_ROOT anyway :).
+    install -D -t $out/lib/cmake ./buildsys/cmake/Modules/Find*.cmake
+
+    # manpages are nice, install them
+    # doing this is in the project's "ToDo", so check this when updating!
+    install -D -t $out/share/man/man3 ./*/*.3
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Highly dynamic multi-platform foreign function call interface library";
+    homepage = http://www.dyncall.org;
+    license = licenses.isc;
+    maintainers = with maintainers; [ dtzWill ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/easyloggingpp/default.nix b/nixpkgs/pkgs/development/libraries/easyloggingpp/default.nix
new file mode 100644
index 000000000000..4ca9eab51bbe
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/easyloggingpp/default.nix
@@ -0,0 +1,31 @@
+# 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 }:
+stdenv.mkDerivation rec {
+  name = "easyloggingpp-${version}";
+  version = "9.96.7";
+  src = fetchFromGitHub {
+    owner = "muflihun";
+    repo = "easyloggingpp";
+    rev = "v${version}";
+    sha256 = "0nhszn0yyjwpnv7swm4vqs3i7admgbnifi5dvq5h01fk5nc8yjqz";
+  };
+
+  nativeBuildInputs = [cmake];
+  buildInputs = [gtest];
+  cmakeFlags = [ "-Dtest=ON" ];
+  NIX_CFLAGS_COMPILE = "-std=c++11" +
+    stdenv.lib.optionalString stdenv.isLinux " -pthread";
+  postInstall = ''
+    mkdir -p $out/include
+    cp ../src/easylogging++.cc $out/include
+  '';
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/eccodes/default.nix b/nixpkgs/pkgs/development/libraries/eccodes/default.nix
new file mode 100644
index 000000000000..78f80d2baf42
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/eccodes/default.nix
@@ -0,0 +1,56 @@
+{ fetchurl, stdenv
+, cmake, netcdf, openjpeg, libpng, gfortran
+, enablePython ? false, pythonPackages
+, enablePosixThreads ? false
+, enableOpenMPThreads ? false}:
+with stdenv.lib;
+stdenv.mkDerivation rec {
+  name = "eccodes-${version}";
+  version = "2.12.5";
+
+  src = fetchurl {
+    url = "https://confluence.ecmwf.int/download/attachments/45757960/eccodes-${version}-Source.tar.gz";
+    sha256 = "0576fccng4nvmq5gma1nb1v00if5cwl81w4nv5zkb80q5wicn50c";
+  };
+
+  postPatch = ''
+    substituteInPlace cmake/FindOpenJPEG.cmake --replace openjpeg-2.1 ${openjpeg.incDir}
+  '';
+
+  nativeBuildInputs = [ cmake ];
+
+  buildInputs = [ netcdf
+                  openjpeg
+                  libpng
+                  gfortran
+                ];
+  propagatedBuildInputs = optionals enablePython [
+                  pythonPackages.python
+                  pythonPackages.numpy
+                ];
+
+  cmakeFlags = [ "-DENABLE_PYTHON=${if enablePython then "ON" else "OFF"}"
+                 "-DENABLE_PNG=ON"
+                 "-DENABLE_ECCODES_THREADS=${if enablePosixThreads then "ON" else "OFF"}"
+                 "-DENABLE_ECCODES_OMP_THREADS=${if enableOpenMPThreads then "ON" else "OFF"}"
+               ];
+
+  enableParallelBuilding = true;
+
+  doCheck = true;
+
+  # Only do tests that don't require downloading 120MB of testdata
+  checkPhase = stdenv.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
+  '';
+
+  meta = {
+    homepage = https://confluence.ecmwf.int/display/ECC/;
+    license = licenses.asl20;
+    maintainers = with maintainers; [ knedlsepp ];
+    platforms = platforms.unix;
+    description = "ECMWF library for reading and writing GRIB, BUFR and GTS abbreviated header";
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/eclib/default.nix b/nixpkgs/pkgs/development/libraries/eclib/default.nix
new file mode 100644
index 000000000000..681062cd6713
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/eclib/default.nix
@@ -0,0 +1,49 @@
+{ stdenv
+, fetchFromGitHub
+, fetchpatch
+, autoreconfHook
+, pari
+, ntl
+, gmp
+# "FLINT is optional and only used for one part of sparse matrix reduction,
+# which is used in the modular symbol code but not mwrank or other elliptic
+# curve programs." -- https://github.com/JohnCremona/eclib/blob/master/README
+, withFlint ? false, flint ? null
+}:
+
+assert withFlint -> flint != null;
+
+stdenv.mkDerivation rec {
+  name = "${pname}-${version}";
+  pname = "eclib";
+  version = "20190226"; # upgrade might break the sage interface
+  # sage tests to run:
+  # src/sage/interfaces/mwrank.py
+  # src/sage/libs/eclib
+  # ping @timokau for more info
+  src = fetchFromGitHub {
+    owner = "JohnCremona";
+    repo = "${pname}";
+    rev = "v${version}";
+    sha256 = "1910np1xzyjzszay24xn4b81qhpsvhp5aix9vdpknplni2mq8kwb";
+  };
+  buildInputs = [
+    pari
+    ntl
+    gmp
+  ] ++ stdenv.lib.optionals withFlint [
+    flint
+  ];
+  nativeBuildInputs = [
+    autoreconfHook
+  ];
+  doCheck = true;
+  meta = with stdenv.lib; {
+    inherit version;
+    description = ''Elliptic curve tools'';
+    homepage = https://github.com/JohnCremona/eclib;
+    license = licenses.gpl2Plus;
+    maintainers = with maintainers; [ raskin timokau ];
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/editline/default.nix b/nixpkgs/pkgs/development/libraries/editline/default.nix
new file mode 100644
index 000000000000..e2a989f4ef23
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/editline/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchFromGitHub, fetchpatch, autoreconfHook }:
+
+stdenv.mkDerivation rec {
+  name = "editline-${version}";
+  version = "1.16.1";
+  src = fetchFromGitHub {
+    owner = "troglobit";
+    repo = "editline";
+    rev = version;
+    sha256 = "192valxbvkxh47dszrnahv7xiccarjw9y84g4zaw5y0lxfc54dir";
+  };
+
+  nativeBuildInputs = [ autoreconfHook ];
+
+  outputs = [ "out" "dev" "man" "doc" ];
+
+  meta = with stdenv.lib; {
+    homepage = http://troglobit.com/editline.html;
+    description = "A readline() replacement for UNIX without termcap (ncurses)";
+    license = licenses.bsdOriginal;
+    maintainers = with maintainers; [ dtzWill ];
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/eigen/2.0.nix b/nixpkgs/pkgs/development/libraries/eigen/2.0.nix
new file mode 100644
index 000000000000..015aeaed55ba
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/eigen/2.0.nix
@@ -0,0 +1,25 @@
+{stdenv, fetchurl, cmake}:
+
+let
+  v = "2.0.17";
+in
+stdenv.mkDerivation {
+  name = "eigen-${v}";
+
+  src = fetchurl {
+    url = "https://bitbucket.org/eigen/eigen/get/${v}.tar.bz2";
+    name = "eigen-${v}.tar.bz2";
+    sha256 = "0q4ry2pmdb9lvm0g92wi6s6qng3m9q73n5flwbkfcz1nxmbfhmbj";
+  };
+
+  nativeBuildInputs = [ cmake ];
+
+  meta = with stdenv.lib; {
+    description = "C++ template library for linear algebra: vectors, matrices, and related algorithms";
+    license = licenses.lgpl3Plus;
+    homepage = http://eigen.tuxfamily.org ;
+    maintainers = with stdenv.lib.maintainers; [ sander raskin ];
+    branch = "2";
+    platforms = with stdenv.lib.platforms; unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/eigen/default.nix b/nixpkgs/pkgs/development/libraries/eigen/default.nix
new file mode 100644
index 000000000000..25d0760a32d1
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/eigen/default.nix
@@ -0,0 +1,29 @@
+{stdenv, fetchurl, fetchpatch, cmake}:
+
+let
+  version = "3.3.7";
+in
+stdenv.mkDerivation {
+  name = "eigen-${version}";
+
+  src = fetchurl {
+    url = "https://bitbucket.org/eigen/eigen/get/${version}.tar.gz";
+    name = "eigen-${version}.tar.gz";
+    sha256 = "1nnh0v82a5xibcjaph51mx06mxbllk77fvihnd5ba0kpl23yz13y";
+  };
+
+  patches = [
+    ./include-dir.patch
+  ];
+
+  nativeBuildInputs = [ cmake ];
+
+  meta = with stdenv.lib; {
+    description = "C++ template library for linear algebra: vectors, matrices, and related algorithms";
+    license = licenses.lgpl3Plus;
+    homepage = http://eigen.tuxfamily.org ;
+    platforms = platforms.unix;
+    maintainers = with stdenv.lib.maintainers; [ sander raskin ];
+    inherit version;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/eigen/default.upstream b/nixpkgs/pkgs/development/libraries/eigen/default.upstream
new file mode 100644
index 000000000000..c0c05efc466c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/eigen/default.upstream
@@ -0,0 +1,4 @@
+url http://eigen.tuxfamily.org/
+ensure_choice
+version '.*/([-0-9.]+)[.]tar[.].*' '\1'
+do_overwrite() { do_overwrite_just_version; }
diff --git a/nixpkgs/pkgs/development/libraries/eigen/include-dir.patch b/nixpkgs/pkgs/development/libraries/eigen/include-dir.patch
new file mode 100644
index 000000000000..7f3bd88557ec
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/eigen/include-dir.patch
@@ -0,0 +1,49 @@
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -1,6 +1,6 @@
+ project(Eigen3)
+ 
+-cmake_minimum_required(VERSION 2.8.5)
++cmake_minimum_required(VERSION 3.7)
+ 
+ # guard against in-source builds
+ 
+@@ -408,13 +408,6 @@ install(FILES
+   DESTINATION ${INCLUDE_INSTALL_DIR} COMPONENT Devel
+   )
+ 
+-if(EIGEN_BUILD_PKGCONFIG)
+-    configure_file(eigen3.pc.in eigen3.pc @ONLY)
+-    install(FILES ${CMAKE_CURRENT_BINARY_DIR}/eigen3.pc
+-        DESTINATION ${PKGCONFIG_INSTALL_DIR}
+-        )
+-endif()
+-
+ add_subdirectory(Eigen)
+ 
+ add_subdirectory(doc EXCLUDE_FROM_ALL)
+@@ -510,8 +503,15 @@ set ( EIGEN_VERSION_MAJOR  ${EIGEN_WORLD_VERSION} )
+ set ( EIGEN_VERSION_MINOR  ${EIGEN_MAJOR_VERSION} )
+ set ( EIGEN_VERSION_PATCH  ${EIGEN_MINOR_VERSION} )
+ set ( EIGEN_DEFINITIONS "")
+-set ( EIGEN_INCLUDE_DIR "${CMAKE_INSTALL_PREFIX}/${INCLUDE_INSTALL_DIR}" )
+ set ( EIGEN_ROOT_DIR ${CMAKE_INSTALL_PREFIX} )
++GNUInstallDirs_get_absolute_install_dir(EIGEN_INCLUDE_DIR INCLUDE_INSTALL_DIR)
++
++if(EIGEN_BUILD_PKGCONFIG)
++    configure_file(eigen3.pc.in eigen3.pc @ONLY)
++    install(FILES ${CMAKE_CURRENT_BINARY_DIR}/eigen3.pc
++        DESTINATION ${PKGCONFIG_INSTALL_DIR}
++        )
++endif()
+ 
+ # Interface libraries require at least CMake 3.0
+ if (NOT CMAKE_VERSION VERSION_LESS 3.0)
+--- a/eigen3.pc.in
++++ b/eigen3.pc.in
+@@ -6,4 +6,4 @@ Description: A C++ template library for linear algebra: vectors, matrices, and r
+ Requires:
+ Version: @EIGEN_VERSION_NUMBER@
+ Libs:
+-Cflags: -I${prefix}/@INCLUDE_INSTALL_DIR@
++Cflags: -I@EIGEN_INCLUDE_DIR@
diff --git a/nixpkgs/pkgs/development/libraries/elementary-cmake-modules/default.nix b/nixpkgs/pkgs/development/libraries/elementary-cmake-modules/default.nix
new file mode 100644
index 000000000000..710338842f8d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/elementary-cmake-modules/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, lib, fetchFromGitHub, cmake, pkgconfig }:
+
+stdenv.mkDerivation rec {
+  name = "elementary-cmake-modules-${version}";
+  version = "0.1.0";
+
+  src = fetchFromGitHub {
+    owner = "elementary";
+    repo = "cmake-modules";
+    rev = "319ec5336e9f05f3f22b886cc2053ef3d4b6599e";
+    sha256 = "191hhvdxyqvh9axzndaqld7vrmv7xkn0czks908zhb2zpjhv9rby";
+  };
+
+  prePatch = ''
+    substituteInPlace CMakeLists.txt  \
+      --replace ' ''${CMAKE_ROOT}/Modules' " $out/lib/cmake"
+  '';
+
+  propagatedBuildInputs = [ cmake pkgconfig ];
+
+  setupHook = ./setup-hook.sh;
+
+  meta = with lib; {
+    platforms = platforms.linux ++ platforms.darwin;
+    homepage = https://github.com/elementary/cmake-modules;
+    license = licenses.gpl3Plus;
+    maintainers = [ maintainers.samdroid-apps ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/elementary-cmake-modules/setup-hook.sh b/nixpkgs/pkgs/development/libraries/elementary-cmake-modules/setup-hook.sh
new file mode 100644
index 000000000000..6408ac471577
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/elementary-cmake-modules/setup-hook.sh
@@ -0,0 +1,4 @@
+_elementaryCMakeEnvHook() {
+  cmakeFlagsArray+=(-DCMAKE_MODULE_PATH=@out@/lib/cmake)
+}
+addEnvHooks "$targetOffset" _elementaryCMakeEnvHook
diff --git a/nixpkgs/pkgs/development/libraries/elf-header/default.nix b/nixpkgs/pkgs/development/libraries/elf-header/default.nix
new file mode 100644
index 000000000000..47b39eeb7e97
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/elf-header/default.nix
@@ -0,0 +1,44 @@
+{ stdenvNoCC, lib, glibc, musl }:
+
+let
+   libc =
+     if stdenvNoCC.targetPlatform.isMusl
+     then musl
+     else glibc;
+   headerPath =
+     if stdenvNoCC.targetPlatform.isMusl
+     then "musl-${libc.version}/include/elf.h"
+     else "glibc-${libc.version}/elf/elf.h";
+in
+
+stdenvNoCC.mkDerivation {
+  pname = "elf-header";
+  inherit (libc) version;
+
+  src = null;
+
+  unpackPhase = "true";
+
+  dontBuild = true;
+
+  installPhase = ''
+    mkdir -p "$out/include";
+    tar -xf \
+        ${lib.escapeShellArg libc.src} \
+        ${lib.escapeShellArg headerPath} \
+        --to-stdout \
+      | sed -e '/features\.h/d' \
+      > "$out/include/elf.h"
+  '';
+
+  meta = libc.meta // {
+    outputsToInstall = [ "out" ];
+    description = "The datastructures of ELF according to the target platform's libc";
+    longDescription = ''
+	  The Executable and Linkable Format (ELF, formerly named Extensible Linking
+	  Format), is usually defined in a header like this.
+	'';
+    platforms = lib.platforms.all;
+    maintainers = [ lib.maintainers.ericson2314 ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/embree/2.x.nix b/nixpkgs/pkgs/development/libraries/embree/2.x.nix
new file mode 100644
index 000000000000..c973c2bd9449
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/embree/2.x.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchFromGitHub, cmake, pkgconfig, ispc, tbb, glfw,
+openimageio, libjpeg, libpng, libpthreadstubs, libX11
+}:
+
+stdenv.mkDerivation rec {
+  name = "embree-${version}";
+  version = "2.17.4";
+
+  src = fetchFromGitHub {
+    owner = "embree";
+    repo = "embree";
+    rev = "v2.17.4";
+    sha256 = "0q3r724r58j4b6cbyy657fsb78z7a2c7d5mwdp7552skynsn2mn9";
+  };
+
+  cmakeFlags = [ "-DEMBREE_TUTORIALS=OFF" ];
+  enableParallelBuilding = true;
+  
+  buildInputs = [ pkgconfig cmake ispc tbb glfw openimageio libjpeg libpng libX11 libpthreadstubs ];
+  meta = with stdenv.lib; {
+    description = "High performance ray tracing kernels from Intel"; 
+    homepage = https://embree.github.io/;
+    maintainers = with maintainers; [ hodapp ];
+    license = licenses.asl20;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/enchant/1.x.nix b/nixpkgs/pkgs/development/libraries/enchant/1.x.nix
new file mode 100644
index 000000000000..b7303468cbaf
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/enchant/1.x.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchurl, aspell, pkgconfig, glib, hunspell, hspell }:
+
+stdenv.mkDerivation rec {
+  name = "${pname}-${version}";
+  version = "1.6.1";
+  pname = "enchant";
+
+  src = fetchurl {
+    url = "https://github.com/AbiWord/${pname}/releases/download/${pname}-1-6-1/${name}.tar.gz";
+    sha256 = "1xg3m7mniyqyff8qv46jbfwgchb6di6qxdjnd5sfir7jzv0dkw5y";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ aspell glib hunspell hspell ];
+
+  meta = with stdenv.lib; {
+    description = "Generic spell checking library";
+    homepage = https://abiword.github.io/enchant;
+    platforms = platforms.unix;
+    badPlatforms = [ "x86_64-darwin" ];
+    license = licenses.lgpl21;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/enchant/2.x.nix b/nixpkgs/pkgs/development/libraries/enchant/2.x.nix
new file mode 100644
index 000000000000..8b559bd03c82
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/enchant/2.x.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchurl, aspell, pkgconfig, glib, hunspell, hspell }:
+
+let
+  version = "2.2.3";
+  pname = "enchant";
+in stdenv.mkDerivation rec {
+  name = "${pname}-${version}";
+
+  outputs = [ "out" "dev" ];
+
+  src = fetchurl {
+    url = "https://github.com/AbiWord/${pname}/releases/download/v${version}/${name}.tar.gz";
+    sha256 = "0v87p1ls0gym95qirijpclk650sjbkcjjl6ssk059zswcwaykn5b";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ glib hunspell ];
+  propagatedBuildInputs = [ hspell aspell ]; # libtool puts it to la file
+
+  doCheck = false; # fails to compile with with "UnitTest++.h: No such file or directory"
+
+  meta = with stdenv.lib; {
+    description = "Generic spell checking library";
+    homepage = https://abiword.github.io/enchant/;
+    license = licenses.lgpl21Plus; # with extra provision for non-free checkers
+    maintainers = with maintainers; [ jtojnar ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/enet/default.nix b/nixpkgs/pkgs/development/libraries/enet/default.nix
new file mode 100644
index 000000000000..c0df404e60eb
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/enet/default.nix
@@ -0,0 +1,18 @@
+{stdenv, fetchurl}:
+
+stdenv.mkDerivation rec {
+  name = "enet-1.3.14";
+
+  src = fetchurl {
+    url = "http://enet.bespin.org/download/${name}.tar.gz";
+    sha256 = "0w780zc6cy8yq4cskpphx0f91lzh51vh9lwyc5ll8hhamdxgbxlq";
+  };
+
+  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; [ fuuzetsu ];
+    platforms = stdenv.lib.platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/epoxy/default.nix b/nixpkgs/pkgs/development/libraries/epoxy/default.nix
new file mode 100644
index 000000000000..c4285eadabc0
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/epoxy/default.nix
@@ -0,0 +1,41 @@
+{ stdenv, fetchFromGitHub, autoreconfHook, pkgconfig, utilmacros, python
+, libGL, libX11
+}:
+
+with stdenv.lib;
+
+stdenv.mkDerivation rec {
+  name = "epoxy-${version}";
+  version = "1.5.3";
+
+  src = fetchFromGitHub {
+    owner = "anholt";
+    repo = "libepoxy";
+    rev = "${version}";
+    sha256 = "03nrmf161xyj3q9zsigr5qj5vx5dsfxxyjva73cm1mgqqc5d60px";
+  };
+
+  outputs = [ "out" "dev" ];
+
+  nativeBuildInputs = [ autoreconfHook pkgconfig utilmacros python ];
+  buildInputs = [ libGL libX11 ];
+
+  preConfigure = optionalString stdenv.isDarwin ''
+    substituteInPlace configure --replace build_glx=no build_glx=yes
+    substituteInPlace src/dispatch_common.h --replace "PLATFORM_HAS_GLX 0" "PLATFORM_HAS_GLX 1"
+  '';
+
+  patches = [ ./libgl-path.patch ];
+
+  NIX_CFLAGS_COMPILE = ''-DLIBGL_PATH="${getLib libGL}/lib"'';
+
+  doCheck = false; # needs X11
+
+  meta = {
+    description = "A library for handling OpenGL function pointer management";
+    homepage = https://github.com/anholt/libepoxy;
+    license = licenses.mit;
+    maintainers = [ maintainers.goibhniu ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/epoxy/libgl-path.patch b/nixpkgs/pkgs/development/libraries/epoxy/libgl-path.patch
new file mode 100644
index 000000000000..8f38ee27174b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/epoxy/libgl-path.patch
@@ -0,0 +1,24 @@
+diff --git a/src/dispatch_common.c b/src/dispatch_common.c
+index b3e4f5f..303e8f5 100644
+--- a/src/dispatch_common.c
++++ b/src/dispatch_common.c
+@@ -310,6 +310,19 @@ get_dlopen_handle(void **handle, const char *lib_name, bool exit_on_fail, bool l
+             flags |= RTLD_NOLOAD;
+ 
+         *handle = dlopen(lib_name, flags);
++#ifdef LIBGL_PATH
++        if (!*handle) {
++          char pathbuf[sizeof(LIBGL_PATH) + 1 + 1024 + 1];
++          int l = snprintf(pathbuf, sizeof(pathbuf), "%s/%s", LIBGL_PATH, lib_name);
++          if (l < 0 || l >= sizeof(pathbuf)) {
++            // This really shouldn't happen
++            fprintf(stderr, "Error prefixing library pathname\n");
++            exit(1);
++          }
++          *handle = dlopen(pathbuf, flags);
++        }
++#endif
++
+         if (!*handle) {
+             if (exit_on_fail) {
+                 fprintf(stderr, "Couldn't open %s: %s\n", lib_name, dlerror());
diff --git a/nixpkgs/pkgs/development/libraries/ethash/default.nix b/nixpkgs/pkgs/development/libraries/ethash/default.nix
new file mode 100644
index 000000000000..da2fd13465f2
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/ethash/default.nix
@@ -0,0 +1,58 @@
+{ stdenv, fetchFromGitHub, cmake, boost, cryptopp, opencl-headers, opencl-info,
+  openmpi, ocl-icd, mesa, gbenchmark, gtest }:
+
+stdenv.mkDerivation rec {
+  pname = "ethash";
+  version = "0.4.2";
+
+  src =
+    fetchFromGitHub {
+      owner = "chfast";
+      repo = "ethash";
+      rev = "v${version}";
+      sha256 = "0qiixvxbpl2gz7jh1qs8lmyk7wzv6ffnl7kckqgrpgm547nnn8zy";
+    };
+
+  nativeBuildInputs = [
+    cmake
+  ];
+
+  buildInputs = [
+    boost
+    cryptopp
+    opencl-headers
+    opencl-info
+    openmpi
+    ocl-icd
+    mesa
+  ];
+
+  checkInputs = [
+    gbenchmark
+    gtest
+  ];
+
+  #preConfigure = ''
+  #  sed -i 's/GTest::main//' test/unittests/CMakeLists.txt
+  #  cat test/unittests/CMakeLists.txt
+  #  ln -sfv ${gtest.src}/googletest gtest
+  #'';
+
+  # NOTE: disabling tests due to gtest issue
+  cmakeFlags = [
+    "-DHUNTER_ENABLED=OFF"
+    "-DETHASH_BUILD_TESTS=OFF"
+    #"-Dbenchmark_DIR=${gbenchmark}/lib/cmake/benchmark"
+    #"-DGTest_DIR=${gtest.dev}/lib/cmake/GTest"
+    #"-DGTest_DIR=${gtest.src}/googletest"
+    #"-DCMAKE_PREFIX_PATH=${gtest.dev}/lib/cmake"
+  ];
+
+  meta = with stdenv.lib; {
+    description = "PoW algorithm for Ethereum 1.0 based on Dagger-Hashimoto";
+    homepage = https://github.com/ethereum/ethash;
+    platforms = [ "x86_64-linux" ];
+    maintainers = with maintainers; [ nand0p ];
+    license = licenses.asl20;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/eventlog/default.nix b/nixpkgs/pkgs/development/libraries/eventlog/default.nix
new file mode 100644
index 000000000000..838693ba12d0
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/eventlog/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation {
+  name = "eventlog-0.2.12";
+
+  src = fetchurl {
+    url = "http://www.balabit.com/downloads/files/eventlog/0.2/eventlog_0.2.12.tar.gz";
+    sha256 = "494dac8e01dc5ce323df2ad554d94874938dab51aa025987677b2bc6906a9c66";
+  };
+
+  meta = {
+    description = "Syslog event logger library";
+    longDescription = ''
+      The EventLog library aims to be a replacement of the simple syslog() API
+      provided on UNIX systems. The major difference between EventLog and
+      syslog is that EventLog tries to add structure to messages.
+
+      Where you had a simple non-structrured string in syslog() you have a
+      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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/exempi/default.nix b/nixpkgs/pkgs/development/libraries/exempi/default.nix
new file mode 100644
index 000000000000..3bc5270f0537
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/exempi/default.nix
@@ -0,0 +1,36 @@
+{ stdenv, fetchurl, fetchpatch, expat, zlib, boost, libiconv, darwin }:
+
+stdenv.mkDerivation rec {
+  name = "exempi-2.4.5";
+
+  src = fetchurl {
+    url = "https://libopenraw.freedesktop.org/download/${name}.tar.bz2";
+    sha256 = "07i29xmg8bqriviaf4vi1mwha4lrw85kfla29cfym14fp3z8aqa0";
+  };
+
+  patches = [
+    # CVE-2018-12648
+    # https://gitlab.freedesktop.org/libopenraw/exempi/issues/9
+    # remove with exempi > 2.4.5
+    (fetchpatch {
+      name = "CVE-2018-12648.patch";
+      url = https://gitlab.freedesktop.org/libopenraw/exempi/commit/8ed2f034705fd2d032c81383eee8208fd4eee0ac.patch;
+      sha256 = "1nh8irk5p26868875wq5n8g92xp4crfb8fdd8gyna76ldyzqqx9q";
+    })
+  ];
+
+  configureFlags = [
+    "--with-boost=${boost.dev}"
+  ];
+
+  buildInputs = [ expat zlib boost ]
+    ++ stdenv.lib.optionals stdenv.isDarwin [ libiconv darwin.apple_sdk.frameworks.CoreServices ];
+
+  doCheck = stdenv.isLinux;
+
+  meta = with stdenv.lib; {
+    homepage = https://libopenraw.freedesktop.org/wiki/Exempi/;
+    platforms = platforms.linux ++ platforms.darwin;
+    license = licenses.bsd3;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/exiv2/default.nix b/nixpkgs/pkgs/development/libraries/exiv2/default.nix
new file mode 100644
index 000000000000..3f731bdf799e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/exiv2/default.nix
@@ -0,0 +1,33 @@
+{ stdenv, fetchurl, fetchFromGitHub, fetchpatch, zlib, expat, gettext
+, autoconf }:
+
+stdenv.mkDerivation rec {
+  name = "exiv2-0.26.2018.12.30";
+
+    #url = "https://www.exiv2.org/builds/${name}-trunk.tar.gz";
+  src = fetchFromGitHub rec {
+    owner = "exiv2";
+    repo  = "exiv2";
+    rev = "f5d0b25"; # https://github.com/Exiv2/exiv2/commits/0.26
+    sha256 = "1blaz3g8dlij881g14nv2nsgr984wy6ypbwgi2pixk978p0gm70i";
+  };
+
+  postPatch = "patchShebangs ./src/svn_version.sh";
+
+  preConfigure = "make config"; # needed because not using tarball
+
+  outputs = [ "out" "dev" ];
+
+  nativeBuildInputs = [
+    gettext
+    autoconf # needed because not using tarball
+  ];
+  propagatedBuildInputs = [ zlib expat ];
+
+  meta = with stdenv.lib; {
+    homepage = https://www.exiv2.org/;
+    description = "A library and command-line utility to manage image metadata";
+    platforms = platforms.all;
+    license = licenses.gpl2Plus;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/exosip/default.nix b/nixpkgs/pkgs/development/libraries/exosip/default.nix
new file mode 100644
index 000000000000..240f3c136ef5
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/exosip/default.nix
@@ -0,0 +1,20 @@
+{stdenv, fetchurl, libosip, openssl, pkgconfig }:
+
+stdenv.mkDerivation rec {
+ name = "libexosip2-${version}";
+ version = "4.1.0";
+ 
+ src = fetchurl {
+    url = "mirror://savannah/exosip/libeXosip2-${version}.tar.gz";
+    sha256 = "17cna8kpc8nk1si419vgr6r42k2lda0rdk50vlxrw8rzg0xp2xrw";
+  };
+ 
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ libosip openssl ];
+      
+  meta = with stdenv.lib; {
+    license = licenses.gpl2Plus;
+    description = "Library that hides the complexity of using the SIP protocol";
+    platforms =platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/expat/default.nix b/nixpkgs/pkgs/development/libraries/expat/default.nix
new file mode 100644
index 000000000000..7e4d46c012dd
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/expat/default.nix
@@ -0,0 +1,31 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "expat-2.2.6";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/expat/${name}.tar.bz2";
+    sha256 = "1wl1x93b5w457ddsdgj0lh7yjq4q6l7wfbgwhagkc8fm2qkkrd0p";
+  };
+
+  outputs = [ "out" "dev" ]; # TODO: fix referrers
+  outputBin = "dev";
+
+  configureFlags = stdenv.lib.optional stdenv.isFreeBSD "--with-pic";
+
+  outputMan = "dev"; # tiny page for a dev tool
+
+  doCheck = true; # not cross;
+
+  preCheck = ''
+    patchShebangs ./run.sh
+    patchShebangs ./test-driver-wrapper.sh
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = http://www.libexpat.org/;
+    description = "A stream-oriented XML parser library written in C";
+    platforms = platforms.all;
+    license = licenses.mit; # expat version
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/faac/default.nix b/nixpkgs/pkgs/development/libraries/faac/default.nix
new file mode 100644
index 000000000000..c568a670f553
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/faac/default.nix
@@ -0,0 +1,38 @@
+{ stdenv, fetchurl, autoreconfHook
+, mp4v2Support ? true, mp4v2 ? null
+, drmSupport ? false # Digital Radio Mondiale
+}:
+
+assert mp4v2Support -> (mp4v2 != null);
+
+with stdenv.lib;
+stdenv.mkDerivation rec {
+  name = "faac-${version}";
+  version = "1.29.9.2";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/faac/${name}.tar.gz";
+    sha256 = "0wf781vp7rzmxkx5h0w8j2i4xc63iixxikgbvvkdljbwhffj0pyl";
+  };
+
+  configureFlags = [ ]
+    ++ optional mp4v2Support "--with-external-mp4v2"
+    ++ optional drmSupport "--enable-drm";
+
+  hardeningDisable = [ "format" ];
+
+  nativeBuildInputs = [ autoreconfHook ];
+
+  buildInputs = [ ]
+    ++ optional mp4v2Support mp4v2;
+
+  enableParallelBuilding = true;
+
+  meta = {
+    description = "Open source MPEG-4 and MPEG-2 AAC encoder";
+    homepage    = https://www.audiocoding.com/faac.html;
+    license     = licenses.unfreeRedistributable;
+    maintainers = with maintainers; [ codyopel ];
+    platforms   = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/faad2/default.nix b/nixpkgs/pkgs/development/libraries/faad2/default.nix
new file mode 100644
index 000000000000..e7e4835d2ed3
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/faad2/default.nix
@@ -0,0 +1,49 @@
+{stdenv, fetchurl
+, drmSupport ? false # Digital Radio Mondiale
+}:
+
+with stdenv.lib;
+stdenv.mkDerivation rec {
+  name = "faad2-${version}";
+  version = "2.8.8";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/faac/${name}.tar.gz";
+    sha256 = "1db37ydb6mxhshbayvirm5vz6j361bjim4nkpwjyhmy4ddfinmhl";
+  };
+
+  patches = let
+    fp = { ver ? "2.8.8-3", pname, name ? (pname + ".patch"), sha256 }: fetchurl {
+      url = "https://salsa.debian.org/multimedia-team/faad2/raw/debian/${ver}"
+          + "/debian/patches/${pname}.patch?inline=false";
+      inherit name sha256;
+    };
+  in [
+    (fp {
+      # critical bug addressed in vlc 3.0.7 (but we use system-provided faad)
+      pname = "0004-Fix-a-couple-buffer-overflows";
+      sha256 = "1mwycdfagz6wpda9j3cp7lf93crgacpa8rwr58p3x0i5cirnnmwq";
+    })
+    (fp {
+      name = "CVE-2018-20362.patch";
+      pname = "0009-syntax.c-check-for-syntax-element-inconsistencies";
+      sha256 = "1z849l5qyvhyn5pvm6r07fa50nrn8nsqnrka2nnzgkhxlhvzpa81";
+    })
+    (fp {
+      name = "CVE-2018-20194.patch";
+      pname = "0010-sbr_hfadj-sanitize-frequency-band-borders";
+      sha256 = "1b1kbz4mv0zhpq8h3djnvqafh1gn12nikk9v3jrxyryywacirah4";
+    })
+  ];
+
+  configureFlags = []
+    ++ optional drmSupport "--with-drm";
+
+  meta = {
+    description = "An open source MPEG-4 and MPEG-2 AAC decoder";
+    homepage    = https://www.audiocoding.com/faad2.html;
+    license     = licenses.gpl2;
+    maintainers = with maintainers; [ codyopel ];
+    platforms   = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/farbfeld/default.nix b/nixpkgs/pkgs/development/libraries/farbfeld/default.nix
new file mode 100644
index 000000000000..c23fc0bc59f6
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/farbfeld/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchgit, makeWrapper, file, libpng, libjpeg }:
+
+stdenv.mkDerivation rec {
+  name = "farbfeld-${version}";
+  version = "4";
+
+  src = fetchgit {
+    url = "https://git.suckless.org/farbfeld";
+    rev = "refs/tags/${version}";
+    sha256 = "0pkmkvv5ggpzqwqdchd19442x8gh152xy5z1z13ipfznhspsf870";
+  };
+
+  buildInputs = [ libpng libjpeg ];
+  nativeBuildInputs = [ makeWrapper ];
+
+  installFlags = "PREFIX=/ DESTDIR=$(out)";
+  postInstall = ''
+    wrapProgram "$out/bin/2ff" --prefix PATH : "${file}/bin"
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Suckless image format with conversion tools";
+    license = licenses.isc;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ pSub ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/farstream/default.nix b/nixpkgs/pkgs/development/libraries/farstream/default.nix
new file mode 100644
index 000000000000..e884bb41e20e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/farstream/default.nix
@@ -0,0 +1,33 @@
+{ stdenv, fetchurl, libnice, pkgconfig, pythonPackages, gstreamer, gst-plugins-base
+, gst-python, gupnp-igd, gobject-introspection
+, gst-plugins-good, gst-plugins-bad, gst-libav
+}:
+
+let
+  inherit (pythonPackages) python pygobject2;
+in stdenv.mkDerivation rec {
+  name = "farstream-0.2.8";
+
+  outputs = [ "out" "dev" ];
+
+  src = fetchurl {
+    url = "https://www.freedesktop.org/software/farstream/releases/farstream/${name}.tar.gz";
+    sha256 = "0249ncd20x5mf884fd8bw75c3118b9fdml837v4fib349xmrqfrb";
+  };
+
+  buildInputs = [ libnice python pygobject2 gupnp-igd libnice ];
+
+  nativeBuildInputs = [ pkgconfig gobject-introspection ];
+
+  propagatedBuildInputs = [
+    gstreamer gst-plugins-base gst-python
+    gst-plugins-good gst-plugins-bad gst-libav
+  ];
+
+  meta = with stdenv.lib; {
+    homepage = https://www.freedesktop.org/wiki/Software/Farstream;
+    description = "Audio/Video Communications Framework formely known as farsight";
+    platforms = platforms.linux;
+    license = licenses.lgpl21;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/fastjson/default.nix b/nixpkgs/pkgs/development/libraries/fastjson/default.nix
new file mode 100644
index 000000000000..bac867978f43
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/fastjson/default.nix
@@ -0,0 +1,26 @@
+{ stdenv, fetchFromGitHub, libtool, autoconf, automake }:
+
+stdenv.mkDerivation rec {
+  version = "0.99.8";
+  name = "fastjson-${version}";
+  src = fetchFromGitHub {
+    repo = "libfastjson";
+    owner = "rsyslog";
+    rev = "v${version}";
+    sha256 = "0qhs0g9slj3p0v2z4s3cnsx44msrlb4k78ljg7714qiziqbrbwyl";
+  };
+
+  buildInputs = [ autoconf automake libtool ];
+
+  preConfigure = ''
+    sh autogen.sh
+  '';
+
+  meta = with stdenv.lib; {
+    description = "A fast json library for C";
+    homepage = https://github.com/rsyslog/libfastjson;
+    license = licenses.mit;
+    maintainers = with maintainers; [ nequissimus ];
+    platforms = with platforms; unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/fastpbkdf2/default.nix b/nixpkgs/pkgs/development/libraries/fastpbkdf2/default.nix
new file mode 100644
index 000000000000..e781e2aab838
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/fastpbkdf2/default.nix
@@ -0,0 +1,31 @@
+{ stdenv, fetchFromGitHub, openssl }:
+
+stdenv.mkDerivation {
+  name = "fastpbkdf2-1.0.0";
+  
+  src = fetchFromGitHub {
+    owner = "ctz";
+    repo = "fastpbkdf2";
+    rev = "v1.0.0";
+    sha256 = "09ax0h4ik3vhvp3s98lic93l3g9f4v1jkr5k6z4g1lvm7s3lrha2";
+  };
+  
+  buildInputs = [ openssl ];
+
+  preBuild = ''
+    makeFlagsArray=(CFLAGS="-std=c99 -O3 -g")
+  '';
+
+  installPhase = ''
+    mkdir -p $out/{lib,include/fastpbkdf2}
+    cp *.a $out/lib
+    cp fastpbkdf2.h $out/include/fastpbkdf2
+  '';
+
+  meta = with stdenv.lib; {
+    description = "A fast PBKDF2-HMAC-{SHA1,SHA256,SHA512} implementation in C";
+    homepage = https://github.com/ctz/fastpbkdf2;
+    license = licenses.cc0;
+    maintainers = with maintainers; [ ledif ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/fcgi/default.nix b/nixpkgs/pkgs/development/libraries/fcgi/default.nix
new file mode 100644
index 000000000000..de78647dc483
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/fcgi/default.nix
@@ -0,0 +1,31 @@
+{ stdenv, fetchurl, fetchpatch }:
+
+stdenv.mkDerivation rec {
+  name = "fcgi-${version}";
+  version = "2.4.0";
+
+  src = fetchurl {
+    url = "https://launchpad.net/debian/+archive/primary/+files/libfcgi_${version}.orig.tar.gz";
+    #    url = "http://www.fastcgi.com/dist/${name}.tar.gz";
+    sha256 = "1f857wnl1d6jfrgfgfpz3zdaj8fch3vr13mnpcpvy8bang34bz36";
+  };
+
+  patches = [
+    ./gcc-4.4.diff
+    (fetchpatch {
+      # Fix a stack-smashing bug:
+      # xhttps://bugs.debian.org/cgi-bin/bugreport.cgi?bug=681591
+      url = "https://bugs.launchpad.net/ubuntu/+source/libfcgi/+bug/933417/+attachment/2745025/+files/poll.patch";
+      sha256 = "0v3gw0smjvrxh1bv3zx9xp633gbv5dd5bcn3ipj6ckqjyv4i6i7m";
+    })
+  ];
+
+  postInstall = "ln -s . $out/include/fastcgi";
+
+  meta = with stdenv.lib; {
+    description = "A language independent, scalable, open extension to CG";
+    homepage = http://www.fastcgi.com/;
+    license = "FastCGI see LICENSE.TERMS";
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/fcgi/gcc-4.4.diff b/nixpkgs/pkgs/development/libraries/fcgi/gcc-4.4.diff
new file mode 100644
index 000000000000..c6806c12c067
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/fcgi/gcc-4.4.diff
@@ -0,0 +1,12 @@
+diff --git a/libfcgi/fcgio.cpp b/libfcgi/fcgio.cpp
+index 95e28ca..a7eda0e 100644
+--- a/libfcgi/fcgio.cpp
++++ b/libfcgi/fcgio.cpp
+@@ -23,6 +23,7 @@
+ #endif
+ 
+ #include <limits.h>
++#include <cstdio>
+ #include "fcgio.h"
+ 
+ using std::streambuf;
diff --git a/nixpkgs/pkgs/development/libraries/fcppt/default.nix b/nixpkgs/pkgs/development/libraries/fcppt/default.nix
new file mode 100644
index 000000000000..a37ebe7c5e06
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/fcppt/default.nix
@@ -0,0 +1,35 @@
+{ stdenv, fetchFromGitHub, cmake, boost, brigand, catch2 }:
+
+stdenv.mkDerivation rec {
+  name = "fcppt-${version}";
+  version = "3.0.0";
+
+  src = fetchFromGitHub {
+    owner = "freundlich";
+    repo = "fcppt";
+    rev = version;
+    sha256 = "0l78fjhy9nl3afrf0da9da4wzp1sx3kcyc2j6b71i60kvk44v4in";
+  };
+
+  nativeBuildInputs = [ cmake ];
+  buildInputs = [ boost catch2 ];
+
+  cmakeFlags = [ "-DENABLE_EXAMPLES=false" "-DENABLE_CATCH=true" "-DENABLE_TEST=true" "-DBrigand_INCLUDE_DIR=${brigand}/include" ];
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    description = "Freundlich's C++ toolkit";
+    longDescription = ''
+      Freundlich's C++ Toolkit (fcppt) is a collection of libraries focusing on
+      improving general C++ code by providing better types, a strong focus on
+      C++11 (non-conforming compilers are mostly not supported) and functional
+      programming (which is both efficient and syntactically affordable in
+      C++11).
+    '';
+    homepage = https://fcppt.org;
+    license = licenses.boost;
+    maintainers = with maintainers; [ pmiddend ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/fdk-aac/default.nix b/nixpkgs/pkgs/development/libraries/fdk-aac/default.nix
new file mode 100644
index 000000000000..9b7cea3ebbcb
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/fdk-aac/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchurl
+, exampleSupport ? false # Example encoding program
+}:
+
+with stdenv.lib;
+stdenv.mkDerivation rec {
+  name = "fdk-aac-${version}";
+  version = "2.0.0";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/opencore-amr/fdk-aac/${name}.tar.gz";
+    sha256 = "0v6rbyw9f9lpfvcg3v1qyapga5hqfnb3wp3x5yaxpwcgjw7ydmpp";
+  };
+
+  configureFlags = [ ]
+    ++ optional exampleSupport "--enable-example";
+
+  meta = {
+    description = "A high-quality implementation of the AAC codec from Android";
+    homepage    = https://sourceforge.net/projects/opencore-amr/;
+    license     = licenses.asl20;
+    maintainers = with maintainers; [ codyopel ];
+    platforms   = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/fflas-ffpack/1.nix b/nixpkgs/pkgs/development/libraries/fflas-ffpack/1.nix
new file mode 100644
index 000000000000..eae0326c832f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/fflas-ffpack/1.nix
@@ -0,0 +1,25 @@
+{stdenv, fetchurl, autoreconfHook, givaro_3_7, pkgconfig, openblas, gmpxx}:
+stdenv.mkDerivation rec {
+  name = "${pname}-${version}";
+  pname = "fflas-ffpack";
+  version = "1.6.0";
+  src = fetchurl {
+    url = "http://linalg.org/fflas-ffpack-${version}.tar.gz";
+    sha256 = "02fr675278c65hfiy1chb903j4ix9i8yni1xc2g5nmsjcaf9vra9";
+  };
+  nativeBuildInputs = [ autoreconfHook pkgconfig ];
+  buildInputs = [ givaro_3_7 openblas gmpxx];
+  configureFlags = [
+    "--with-blas=-lopenblas"
+    "--with-gmp=${gmpxx.dev}"
+    "--with-givaro=${givaro_3_7}"
+  ];
+  meta = {
+    inherit version;
+    description = ''Finite Field Linear Algebra Subroutines'';
+    license = stdenv.lib.licenses.lgpl21Plus;
+    maintainers = [stdenv.lib.maintainers.raskin];
+    platforms = stdenv.lib.platforms.linux;
+    homepage = https://linbox-team.github.io/fflas-ffpack/;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/fflas-ffpack/default.nix b/nixpkgs/pkgs/development/libraries/fflas-ffpack/default.nix
new file mode 100644
index 000000000000..a67210e860cd
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/fflas-ffpack/default.nix
@@ -0,0 +1,54 @@
+{ stdenv, fetchFromGitHub, autoreconfHook, givaro, pkgconfig, blas
+, gmpxx
+}:
+stdenv.mkDerivation rec {
+  name = "${pname}-${version}";
+  pname = "fflas-ffpack";
+  version = "2.4.0";
+
+  src = fetchFromGitHub {
+    owner = "linbox-team";
+    repo = "${pname}";
+    rev = "v${version}";
+    sha256 = "1q1ala88ysz14pb5cn2kskv829nc1qif7zfzjwzhd5nnzwyivmc4";
+  };
+
+  checkInputs = [
+    gmpxx
+  ];
+
+  enableParallelBuilding = true;
+
+  nativeBuildInputs = [
+    autoreconfHook
+    pkgconfig
+  ] ++ stdenv.lib.optionals doCheck checkInputs;
+
+  buildInputs = [ givaro blas ];
+
+  configureFlags = [
+    "--with-blas-libs=-l${blas.linkName}"
+    "--with-lapack-libs=-l${blas.linkName}"
+  ] ++ stdenv.lib.optionals stdenv.isx86_64 {
+    # disable SIMD instructions (which are enabled *when available* by default)
+    "default"        = [ "--disable-sse3" "--disable-ssse3" "--disable-sse41" "--disable-sse42" "--disable-avx" "--disable-avx2" "--disable-fma" "--disable-fma4" ];
+    "westmere"       = [                                                                        "--disable-avx" "--disable-avx2" "--disable-fma" "--disable-fma4" ];
+    "sandybridge"    = [                                                                                        "--disable-avx2" "--disable-fma" "--disable-fma4" ];
+    "ivybridge"      = [                                                                                        "--disable-avx2" "--disable-fma" "--disable-fma4" ];
+    "haswell"        = [                                                                                                                         "--disable-fma4" ];
+    "broadwell"      = [                                                                                                                         "--disable-fma4" ];
+    "skylake"        = [                                                                                                                         "--disable-fma4" ];
+    "skylake-avx512" = [                                                                                                                         "--disable-fma4" ];
+  }.${stdenv.hostPlatform.platform.gcc.arch or "default"};
+
+  doCheck = true;
+
+  meta = {
+    inherit version;
+    description = ''Finite Field Linear Algebra Subroutines'';
+    license = stdenv.lib.licenses.lgpl21Plus;
+    maintainers = [stdenv.lib.maintainers.raskin];
+    platforms = stdenv.lib.platforms.unix;
+    homepage = https://linbox-team.github.io/fflas-ffpack/;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/ffmpeg-full/default.nix b/nixpkgs/pkgs/development/libraries/ffmpeg-full/default.nix
new file mode 100644
index 000000000000..db606cc02d63
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/ffmpeg-full/default.nix
@@ -0,0 +1,465 @@
+{ stdenv, fetchurl, pkgconfig, perl, texinfo, yasm
+/*
+ *  Licensing options (yes some are listed twice, filters and such are not listed)
+ */
+, gplLicensing ? true # GPL: fdkaac,openssl,frei0r,cdio,samba,utvideo,vidstab,x265,x265,xavs,avid,zvbi,x11grab
+, version3Licensing ? true # (L)GPL3: opencore-amrnb,opencore-amrwb,samba,vo-aacenc,vo-amrwbenc
+, nonfreeLicensing ? false # NONFREE: openssl,fdkaac,blackmagic-design-desktop-video
+/*
+ *  Build options
+ */
+, smallBuild ? false # Optimize for size instead of speed
+, runtimeCpuDetectBuild ? true # Detect CPU capabilities at runtime (disable to compile natively)
+, grayBuild ? true # Full grayscale support
+, swscaleAlphaBuild ? true # Alpha channel support in swscale
+, hardcodedTablesBuild ? true # Hardcode decode tables instead of runtime generation
+, safeBitstreamReaderBuild ? true # Buffer boundary checking in bitreaders
+, multithreadBuild ? true # Multithreading via pthreads/win32 threads
+, networkBuild ? true # Network support
+, pixelutilsBuild ? true # Pixel utils in libavutil
+, enableLto ? false # build with link-time optimization
+/*
+ *  Program options
+ */
+, ffmpegProgram ? true # Build ffmpeg executable
+, ffplayProgram ? true # Build ffplay executable
+, ffprobeProgram ? true # Build ffprobe executable
+, qtFaststartProgram ? true # Build qt-faststart executable
+/*
+ *  Library options
+ */
+, avcodecLibrary ? true # Build avcodec library
+, avdeviceLibrary ? true # Build avdevice library
+, avfilterLibrary ? true # Build avfilter library
+, avformatLibrary ? true # Build avformat library
+, avresampleLibrary ? true # Build avresample library
+, avutilLibrary ? true # Build avutil library
+, postprocLibrary ? true # Build postproc library
+, swresampleLibrary ? true # Build swresample library
+, swscaleLibrary ? true # Build swscale library
+/*
+ *  Documentation options
+ */
+, htmlpagesDocumentation ? false # HTML documentation pages
+, manpagesDocumentation ? true # Man documentation pages
+, podpagesDocumentation ? false # POD documentation pages
+, txtpagesDocumentation ? false # Text documentation pages
+/*
+ *  External libraries options
+ */
+, alsaLib ? null # Alsa in/output support
+#, avisynth ? null # Support for reading AviSynth scripts
+, bzip2 ? null
+, celt ? null # CELT decoder
+#, crystalhd ? null # Broadcom CrystalHD hardware acceleration
+#, decklinkExtlib ? false, blackmagic-design-desktop-video ? null # Blackmagic Design DeckLink I/O support
+, fdkaacExtlib ? false, fdk_aac ? null # Fraunhofer FDK AAC de/encoder
+#, flite ? null # Flite (voice synthesis) support
+, fontconfig ? null # Needed for drawtext filter
+, freetype ? null # Needed for drawtext filter
+, frei0r ? null # frei0r video filtering
+, fribidi ? null # Needed for drawtext filter
+, game-music-emu ? null # Game Music Emulator
+, gnutls ? null
+, gsm ? null # GSM de/encoder
+#, ilbc ? null # iLBC de/encoder
+, libjack2 ? null # Jack audio (only version 2 is supported in this build)
+, ladspaH ? null # LADSPA audio filtering
+, lame ? null # LAME MP3 encoder
+, libass ? null # (Advanced) SubStation Alpha subtitle rendering
+, libaom ? null # AV1 encoder
+, libbluray ? null # BluRay reading
+, libbs2b ? null # bs2b DSP library
+, libcaca ? null # Textual display (ASCII art)
+#, libcdio-paranoia ? null # Audio CD grabbing
+, libdc1394 ? null, libraw1394 ? null # IIDC-1394 grabbing (ieee 1394)
+, libiconv ? null
+#, libiec61883 ? null, libavc1394 ? null # iec61883 (also uses libraw1394)
+, libmfx ? null # Hardware acceleration vis libmfx
+, libmodplug ? null # ModPlug support
+, libmysofa ? null # HRTF support via SOFAlizer
+#, libnut ? null # NUT (de)muxer, native (de)muser exists
+, libogg ? null # Ogg container used by vorbis & theora
+, libopus ? null # Opus de/encoder
+, libssh ? null # SFTP protocol
+, libtheora ? null # Theora encoder
+, libv4l ? null # Video 4 Linux support
+, libva ? null # Vaapi hardware acceleration
+, libvdpau ? null # Vdpau hardware acceleration
+, libvorbis ? null # Vorbis de/encoding, native encoder exists
+, libvpx ? null # VP8 & VP9 de/encoding
+, libwebp ? null # WebP encoder
+, libX11 ? null # Xlib support
+, libxcb ? null # X11 grabbing using XCB
+, libxcbshmExtlib ? true # X11 grabbing shm communication
+, libxcbxfixesExtlib ? true # X11 grabbing mouse rendering
+, libxcbshapeExtlib ? true # X11 grabbing shape rendering
+, libXv ? null # Xlib support
+, libXext ? null # Xlib support
+, lzma ? null # xz-utils
+, nvenc ? true, nv-codec-headers ? null # NVIDIA NVENC support
+, openal ? null # OpenAL 1.1 capture support
+#, opencl ? null # OpenCL code
+, opencore-amr ? null # AMR-NB de/encoder & AMR-WB decoder
+#, opencv ? null # Video filtering
+, openglExtlib ? false, libGLU_combined ? null # OpenGL rendering
+#, openh264 ? null # H.264/AVC encoder
+, openjpeg ? null # JPEG 2000 de/encoder
+, opensslExtlib ? false, openssl ? null
+, libpulseaudio ? null # Pulseaudio input support
+, rtmpdump ? null # RTMP[E] support
+#, libquvi ? null # Quvi input support
+, samba ? null # Samba protocol
+#, schroedinger ? null # Dirac de/encoder
+, SDL2 ? null
+#, shine ? null # Fixed-point MP3 encoder
+, soxr ? null # Resampling via soxr
+, speex ? null # Speex de/encoder
+#, twolame ? null # MP2 encoder
+#, utvideo ? null # Ut Video de/encoder
+, vid-stab ? null # Video stabilization
+#, vo-aacenc ? null # AAC encoder
+, vo-amrwbenc ? null # AMR-WB encoder
+, wavpack ? null # Wavpack encoder
+, x264 ? null # H.264/AVC encoder
+, x265 ? null # H.265/HEVC encoder
+, xavs ? null # AVS encoder
+, xvidcore ? null # Xvid encoder, native encoder exists
+, zeromq4 ? null # Message passing
+, zlib ? null
+#, zvbi ? null # Teletext support
+/*
+ *  Developer options
+ */
+, debugDeveloper ? false
+, optimizationsDeveloper ? true
+, extraWarningsDeveloper ? false
+, strippingDeveloper ? false
+/*
+ *  Darwin frameworks
+ */
+, Cocoa, CoreAudio, CoreServices, AVFoundation, MediaToolbox
+, VideoDecodeAcceleration, cf-private
+}:
+
+/* Maintainer notes:
+ *
+ * Version bumps:
+ * It should always be safe to bump patch releases (e.g. 2.1.x, x being a patch release)
+ * If adding a new branch, note any configure flags that were added, changed, or deprecated/removed
+ *   and make the necessary changes.
+ *
+ * Packages with errors:
+ *   flite ilbc schroedinger
+ *   opencv - circular dependency issue
+ *
+ * Not packaged:
+ *   aacplus avisynth cdio-paranoia crystalhd libavc1394 libiec61883
+ *   libnut libquvi nvenc opencl openh264 oss shine twolame
+ *   utvideo vo-aacenc vo-amrwbenc xvmc zvbi blackmagic-design-desktop-video
+ *
+ * Need fixes to support Darwin:
+ *   frei0r game-music-emu gsm libjack2 libmfx(intel-media-sdk) libssh
+ *   libvpx(stable 1.3.0) openal openjpeg pulseaudio rtmpdump samba vid-stab
+ *   wavpack x265 xavs
+ *
+ * Not supported:
+ *   stagefright-h264(android only)
+ *
+ * Known issues:
+ * flite: configure fails to find library
+ *   Tried modifying ffmpeg's configure script and flite to use pkg-config
+ * Cross-compiling will disable features not present on host OS
+ *   (e.g. dxva2 support [DirectX] will not be enabled unless natively compiled on Cygwin)
+ *
+ */
+
+let
+  inherit (stdenv) isCygwin isFreeBSD isLinux;
+  inherit (stdenv.lib) optional optionals optionalString enableFeature;
+in
+
+/*
+ *  Licensing dependencies
+ */
+assert version3Licensing -> gplLicensing;
+assert nonfreeLicensing -> gplLicensing && version3Licensing;
+/*
+ *  Build dependencies
+ */
+assert networkBuild -> gnutls != null || opensslExtlib;
+assert pixelutilsBuild -> avutilLibrary;
+/*
+ *  Program dependencies
+ */
+assert ffmpegProgram -> avcodecLibrary
+                     && avfilterLibrary
+                     && avformatLibrary
+                     && swresampleLibrary;
+assert ffplayProgram -> avcodecLibrary
+                     && avformatLibrary
+                     && swscaleLibrary
+                     && swresampleLibrary
+                     && SDL2 != null;
+assert ffprobeProgram -> avcodecLibrary && avformatLibrary;
+/*
+ *  Library dependencies
+ */
+assert avcodecLibrary -> avutilLibrary; # configure flag since 0.6
+assert avdeviceLibrary -> avformatLibrary
+                       && avcodecLibrary
+                       && avutilLibrary; # configure flag since 0.6
+assert avformatLibrary -> avcodecLibrary && avutilLibrary; # configure flag since 0.6
+assert avresampleLibrary -> avutilLibrary;
+assert postprocLibrary -> avutilLibrary;
+assert swresampleLibrary -> soxr != null;
+assert swscaleLibrary -> avutilLibrary;
+/*
+ *  External libraries
+ */
+#assert decklinkExtlib -> blackmagic-design-desktop-video != null
+#                                       && !isCygwin && multithreadBuild # POSIX threads required
+#                                       && nonfreeLicensing;
+assert fdkaacExtlib -> fdk_aac != null && nonfreeLicensing;
+assert gnutls != null -> !opensslExtlib;
+assert libxcbshmExtlib -> libxcb != null;
+assert libxcbxfixesExtlib -> libxcb != null;
+assert libxcbshapeExtlib -> libxcb != null;
+assert openglExtlib -> libGLU_combined != null;
+assert opensslExtlib -> gnutls == null && openssl != null && nonfreeLicensing;
+
+stdenv.mkDerivation rec {
+  name = "ffmpeg-full-${version}";
+  version = "4.1.3";
+
+  src = fetchurl {
+    url = "https://www.ffmpeg.org/releases/ffmpeg-${version}.tar.xz";
+    sha256 = "0gdnprc7gk4b7ckq8wbxbrj7i00r76r9a5g9mj7iln40512j0c0c";
+  };
+
+  prePatch = ''
+    patchShebangs .
+  '' + stdenv.lib.optionalString stdenv.isDarwin ''
+    sed -i 's/#ifndef __MAC_10_11/#if 1/' ./libavcodec/audiotoolboxdec.c
+  '' + stdenv.lib.optionalString (frei0r != null) ''
+    substituteInPlace libavfilter/vf_frei0r.c \
+      --replace /usr/local/lib/frei0r-1 ${frei0r}/lib/frei0r-1
+    substituteInPlace doc/filters.texi \
+      --replace /usr/local/lib/frei0r-1 ${frei0r}/lib/frei0r-1
+  '';
+
+  configurePlatforms = [];
+  configureFlags = [
+    "--target_os=${stdenv.hostPlatform.parsed.kernel.name}"
+    "--arch=${stdenv.hostPlatform.parsed.cpu.name}"
+    /*
+     *  Licensing flags
+     */
+    (enableFeature gplLicensing "gpl")
+    (enableFeature version3Licensing "version3")
+    (enableFeature nonfreeLicensing "nonfree")
+    /*
+     *  Build flags
+     */
+    # On some ARM platforms --enable-thumb
+    "--enable-shared --disable-static"
+    (enableFeature true "pic")
+    (if stdenv.cc.isClang then "--cc=clang" else null)
+    (enableFeature smallBuild "small")
+    (enableFeature runtimeCpuDetectBuild "runtime-cpudetect")
+    (enableFeature enableLto "lto")
+    (enableFeature grayBuild "gray")
+    (enableFeature swscaleAlphaBuild "swscale-alpha")
+    (enableFeature hardcodedTablesBuild "hardcoded-tables")
+    (enableFeature safeBitstreamReaderBuild "safe-bitstream-reader")
+    (if multithreadBuild then (
+       if isCygwin then
+         "--disable-pthreads --enable-w32threads"
+       else # Use POSIX threads by default
+         "--enable-pthreads --disable-w32threads")
+     else
+       "--disable-pthreads --disable-w32threads")
+    "--disable-os2threads" # We don't support OS/2
+    (enableFeature networkBuild "network")
+    (enableFeature pixelutilsBuild "pixelutils")
+    /*
+     *  Program flags
+     */
+    (enableFeature ffmpegProgram "ffmpeg")
+    (enableFeature ffplayProgram "ffplay")
+    (enableFeature ffprobeProgram "ffprobe")
+    /*
+     *  Library flags
+     */
+    (enableFeature avcodecLibrary "avcodec")
+    (enableFeature avdeviceLibrary "avdevice")
+    (enableFeature avfilterLibrary "avfilter")
+    (enableFeature avformatLibrary "avformat")
+    (enableFeature avresampleLibrary "avresample")
+    (enableFeature avutilLibrary "avutil")
+    (enableFeature (postprocLibrary && gplLicensing) "postproc")
+    (enableFeature swresampleLibrary "swresample")
+    (enableFeature swscaleLibrary "swscale")
+    /*
+     *  Documentation flags
+     */
+    (enableFeature (htmlpagesDocumentation
+          || manpagesDocumentation
+          || podpagesDocumentation
+          || txtpagesDocumentation) "doc")
+    (enableFeature htmlpagesDocumentation "htmlpages")
+    (enableFeature manpagesDocumentation "manpages")
+    (enableFeature podpagesDocumentation "podpages")
+    (enableFeature txtpagesDocumentation "txtpages")
+    /*
+     *  External libraries
+     */
+    #(enableFeature avisynth "avisynth")
+    (enableFeature (bzip2 != null) "bzlib")
+    (enableFeature (celt != null) "libcelt")
+    #(enableFeature crystalhd "crystalhd")
+    #(enableFeature decklinkExtlib "decklink")
+    (enableFeature (fdkaacExtlib && gplLicensing) "libfdk-aac")
+    #(enableFeature (flite != null) "libflite")
+    "--disable-libflite" # Force disable until a solution is found
+    (enableFeature (fontconfig != null) "fontconfig")
+    (enableFeature (freetype != null) "libfreetype")
+    (enableFeature (frei0r != null && gplLicensing) "frei0r")
+    (enableFeature (fribidi != null) "libfribidi")
+    (enableFeature (game-music-emu != null) "libgme")
+    (enableFeature (gnutls != null) "gnutls")
+    (enableFeature (gsm != null) "libgsm")
+    #(enableFeature (ilbc != null) "libilbc")
+    (enableFeature (ladspaH !=null) "ladspa")
+    (enableFeature (lame != null) "libmp3lame")
+    (enableFeature (libaom != null) "libaom")
+    (enableFeature (libass != null) "libass")
+    #(enableFeature (libavc1394 != null) null null)
+    (enableFeature (libbluray != null) "libbluray")
+    (enableFeature (libbs2b != null) "libbs2b")
+    #(enableFeature (libcaca != null) "libcaca")
+    #(enableFeature (cdio-paranoia != null && gplLicensing) "libcdio")
+    (enableFeature (if isLinux then libdc1394 != null && libraw1394 != null else false) "libdc1394")
+    (enableFeature (libiconv != null) "iconv")
+    #(enableFeature (if isLinux then libiec61883 != null && libavc1394 != null && libraw1394 != null else false) "libiec61883")
+    (enableFeature (if isLinux then libmfx != null else false) "libmfx")
+    (enableFeature (libmodplug != null) "libmodplug")
+    (enableFeature (libmysofa != null) "libmysofa")
+    #(enableFeature (libnut != null) "libnut")
+    (enableFeature (libopus != null) "libopus")
+    (enableFeature (libssh != null) "libssh")
+    (enableFeature (libtheora != null) "libtheora")
+    (enableFeature (if isLinux then libv4l != null else false) "libv4l2")
+    (enableFeature ((isLinux || isFreeBSD) && libva != null) "vaapi")
+    (enableFeature (libvdpau != null) "vdpau")
+    (enableFeature (libvorbis != null) "libvorbis")
+    (enableFeature (libvpx != null) "libvpx")
+    (enableFeature (libwebp != null) "libwebp")
+    (enableFeature (libX11 != null && libXv != null && libXext != null) "xlib")
+    (enableFeature (libxcb != null) "libxcb")
+    (enableFeature libxcbshmExtlib "libxcb-shm")
+    (enableFeature libxcbxfixesExtlib "libxcb-xfixes")
+    (enableFeature libxcbshapeExtlib "libxcb-shape")
+    (enableFeature (lzma != null) "lzma")
+    (enableFeature nvenc "nvenc")
+    (enableFeature (openal != null) "openal")
+    #(enableFeature opencl "opencl")
+    (enableFeature (opencore-amr != null && version3Licensing) "libopencore-amrnb")
+    #(enableFeature (opencv != null) "libopencv")
+    (enableFeature openglExtlib "opengl")
+    #(enableFeature (openh264 != null) "openh264")
+    (enableFeature (openjpeg != null) "libopenjpeg")
+    (enableFeature (opensslExtlib && gplLicensing) "openssl")
+    (enableFeature (libpulseaudio != null) "libpulse")
+    #(enableFeature quvi "libquvi")
+    (enableFeature (rtmpdump != null) "librtmp")
+    #(enableFeature (schroedinger != null) "libschroedinger")
+    (enableFeature (SDL2 != null) "sdl2")
+    (enableFeature (soxr != null) "libsoxr")
+    (enableFeature (speex != null) "libspeex")
+    #(enableFeature (twolame != null) "libtwolame")
+    #(enableFeature (utvideo != null && gplLicensing) "libutvideo")
+    (enableFeature (vid-stab != null && gplLicensing) "libvidstab") # Actual min. version 2.0
+    #(enableFeature (vo-aacenc != null && version3Licensing) "libvo-aacenc")
+    (enableFeature (vo-amrwbenc != null && version3Licensing) "libvo-amrwbenc")
+    (enableFeature (wavpack != null) "libwavpack")
+    (enableFeature (x264 != null && gplLicensing) "libx264")
+    (enableFeature (x265 != null && gplLicensing) "libx265")
+    (enableFeature (xavs != null && gplLicensing) "libxavs")
+    (enableFeature (xvidcore != null && gplLicensing) "libxvid")
+    (enableFeature (zeromq4 != null) "libzmq")
+    (enableFeature (zlib != null) "zlib")
+    #(enableFeature (zvbi != null && gplLicensing) "libzvbi")
+    /*
+     * Developer flags
+     */
+    (enableFeature debugDeveloper "debug")
+    (enableFeature optimizationsDeveloper "optimizations")
+    (enableFeature extraWarningsDeveloper "extra-warnings")
+    (enableFeature strippingDeveloper "stripping")
+  ] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
+    "--cross-prefix=${stdenv.cc.targetPrefix}"
+    "--enable-cross-compile"
+  ];
+
+  nativeBuildInputs = [ perl pkgconfig texinfo yasm ];
+
+  buildInputs = [
+    bzip2 celt fontconfig freetype frei0r fribidi game-music-emu gnutls gsm
+    libjack2 ladspaH lame libaom libass libbluray libbs2b libcaca libdc1394 libmodplug libmysofa
+    libogg libopus libssh libtheora libvdpau libvorbis libvpx libwebp libX11
+    libxcb libXv libXext lzma openal openjpeg libpulseaudio rtmpdump opencore-amr
+    samba SDL2 soxr speex vid-stab vo-amrwbenc wavpack x264 x265 xavs xvidcore
+    zeromq4 zlib
+  ] ++ optional openglExtlib libGLU_combined
+    ++ optionals nonfreeLicensing [ fdk_aac openssl ]
+    ++ optional ((isLinux || isFreeBSD) && libva != null) libva
+    ++ optionals isLinux [ alsaLib libraw1394 libv4l ]
+    ++ optional (isLinux && libmfx != null) libmfx
+    ++ optional nvenc nv-codec-headers
+    ++ optionals stdenv.isDarwin [ Cocoa CoreServices CoreAudio AVFoundation
+                                   MediaToolbox VideoDecodeAcceleration
+                                   libiconv cf-private /* For _OBJC_EHTYPE_$_NSException */ ];
+
+  buildFlags = [ "all" ]
+    ++ optional qtFaststartProgram "tools/qt-faststart"; # Build qt-faststart executable
+
+  # Hacky framework patching technique borrowed from the phantomjs2 package
+  postInstall = optionalString qtFaststartProgram ''
+    cp -a tools/qt-faststart $out/bin/
+  '' + optionalString stdenv.isDarwin ''
+    FILES=($(ls $out/bin/*))
+    FILES+=($(ls $out/lib/*.dylib))
+    for f in ''${FILES[@]}; do
+      if [ ! -h "$f" ]; then
+        install_name_tool -change ${cf-private}/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation "$f"
+      fi
+    done
+  '';
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    description = "A complete, cross-platform solution to record, convert and stream audio and video";
+    homepage = https://www.ffmpeg.org/;
+    longDescription = ''
+      FFmpeg is the leading multimedia framework, able to decode, encode, transcode,
+      mux, demux, stream, filter and play pretty much anything that humans and machines
+      have created. It supports the most obscure ancient formats up to the cutting edge.
+      No matter if they were designed by some standards committee, the community or
+      a corporation.
+    '';
+    license = (
+      if nonfreeLicensing then
+        licenses.unfreeRedistributable
+      else if version3Licensing then
+        licenses.gpl3
+      else if gplLicensing then
+        licenses.gpl2Plus
+      else
+        licenses.lgpl21Plus
+    );
+    platforms = platforms.all;
+    maintainers = with maintainers; [ codyopel fuuzetsu ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/ffmpeg-sixel/default.nix b/nixpkgs/pkgs/development/libraries/ffmpeg-sixel/default.nix
new file mode 100644
index 000000000000..4607d3e2f197
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/ffmpeg-sixel/default.nix
@@ -0,0 +1,37 @@
+{ stdenv, fetchFromGitHub, pkgconfig, libsixel, yasm
+}:
+
+stdenv.mkDerivation rec {
+
+  name = "ffmpeg-sixel-${version}";
+  version = "nightly-2.3.x";
+
+  src = fetchFromGitHub {
+    owner = "saitoha";
+    repo = "FFmpeg-SIXEL";
+    rev = "8566fdb8b7516b54aed58f329dc216e06fc10052";
+    sha256 = "00s2lggfdj2ibpngpyqqg7360p7yb69ys1ppg59yvv0m0mxk5x3k";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [
+    libsixel
+    yasm
+  ];
+
+  configurePhase = ''
+    ./configure --enable-libsixel --prefix=$out
+  '';
+
+  postInstall = ''
+    mv $out/bin/ffmpeg $out/bin/ffmpeg-sixel
+  '';
+
+  meta = with stdenv.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;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ vrthra ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/ffmpeg/2.8.nix b/nixpkgs/pkgs/development/libraries/ffmpeg/2.8.nix
new file mode 100644
index 000000000000..5ffbc215d8b3
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/ffmpeg/2.8.nix
@@ -0,0 +1,7 @@
+{ callPackage, ... } @ args:
+
+callPackage ./generic.nix (args // rec {
+  version = "${branch}.14";
+  branch = "2.8";
+  sha256 = "1g6x3lyjl1zlfksizj1ys61kj97yg0xf4dlr6sr5acpbja3a26yn";
+})
diff --git a/nixpkgs/pkgs/development/libraries/ffmpeg/3.4.nix b/nixpkgs/pkgs/development/libraries/ffmpeg/3.4.nix
new file mode 100644
index 000000000000..5db1e0a47cfc
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/ffmpeg/3.4.nix
@@ -0,0 +1,12 @@
+{ stdenv, callPackage, fetchpatch
+# Darwin frameworks
+, Cocoa, CoreMedia
+, ...
+}@args:
+
+callPackage ./generic.nix (args // rec {
+  version = "${branch}";
+  branch = "3.4.6";
+  sha256 = "1s20wzgxxrm56gckyb8cf1lh36hdnkdxvmmnnvdxvia4zb3grf1b";
+  darwinFrameworks = [ Cocoa CoreMedia ];
+})
diff --git a/nixpkgs/pkgs/development/libraries/ffmpeg/4.nix b/nixpkgs/pkgs/development/libraries/ffmpeg/4.nix
new file mode 100644
index 000000000000..3066e0b12e58
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/ffmpeg/4.nix
@@ -0,0 +1,12 @@
+{ stdenv, callPackage, fetchpatch
+# Darwin frameworks
+, Cocoa, CoreMedia, VideoToolbox
+, ...
+}@args:
+
+callPackage ./generic.nix (args // rec {
+  version = "${branch}";
+  branch = "4.1.3";
+  sha256 = "0aka5pibjhpks1wrsvqpy98v8cbvyvnngwqhh4ajkg6pbdl7k9i9";
+  darwinFrameworks = [ Cocoa CoreMedia VideoToolbox ];
+})
diff --git a/nixpkgs/pkgs/development/libraries/ffmpeg/generic.nix b/nixpkgs/pkgs/development/libraries/ffmpeg/generic.nix
new file mode 100644
index 000000000000..72929e127bcc
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/ffmpeg/generic.nix
@@ -0,0 +1,211 @@
+{ stdenv, fetchurl, pkgconfig, 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
+, openglSupport ? false, libGLU_combined ? null
+# Build options
+, runtimeCpuDetectBuild ? true # Detect CPU capabilities at runtime
+, multithreadBuild ? true # Multithreading via pthreads/win32 threads
+, sdlSupport ? !stdenv.isAarch32, SDL ? null, SDL2 ? null
+, vdpauSupport ? !stdenv.isAarch32, libvdpau ? null
+# Developer options
+, debugDeveloper ? false
+, optimizationsDeveloper ? true
+, extraWarningsDeveloper ? false
+# Darwin frameworks
+, Cocoa, darwinFrameworks ? [ Cocoa ]
+# Inherit generics
+, branch, sha256, version, patches ? [], ...
+}:
+
+/* Maintainer notes:
+ *
+ * THIS IS A MINIMAL BUILD OF FFMPEG, do not include dependencies unless
+ * a build that depends on ffmpeg requires them to be compiled into ffmpeg,
+ * see `ffmpeg-full' for an ffmpeg build with all features included.
+ *
+ * Need fixes to support Darwin:
+ *   pulseaudio
+ *
+ * Known issues:
+ * 0.6     - fails to compile (unresolved) (so far, only disabling a number of
+ *           features works, but that is not a feasible solution)
+ * 0.6.90  - mmx: compile errors (fix: disable for 0.6.90-rc0)
+ * 1.1     - libsoxr: compile error (fix: disable for 1.1)
+ *           Support was initially added in 1.1 before soxr api change, fix
+ *           would probably be to add soxr-1.0
+ * ALL     - Cross-compiling will disable features not present on host OS
+ *           (e.g. dxva2 support [DirectX] will not be enabled unless natively
+ *           compiled on Cygwin)
+ *
+ */
+
+let
+  inherit (stdenv) isDarwin isFreeBSD isLinux isAarch32;
+  inherit (stdenv.lib) optional optionals enableFeature;
+
+  cmpVer = builtins.compareVersions;
+  reqMin = requiredVersion: (cmpVer requiredVersion branch != 1);
+  reqMatch = requiredVersion: (cmpVer requiredVersion branch == 0);
+
+  ifMinVer = minVer: flag: if reqMin minVer then flag else null;
+
+  # Version specific fix
+  verFix = withoutFix: fixVer: withFix: if reqMatch fixVer then withFix else withoutFix;
+
+  # Disable dependency that needs fixes before it will work on Darwin or Arm
+  disDarwinOrArmFix = origArg: minVer: fixArg: if ((isDarwin || isAarch32) && reqMin minVer) then fixArg else origArg;
+
+  vaapiSupport = reqMin "0.6" && ((isLinux || isFreeBSD) && !isAarch32);
+
+  vpxSupport = reqMin "0.6" && !isAarch32;
+in
+
+assert openglSupport -> libGLU_combined != null;
+
+stdenv.mkDerivation rec {
+
+  name = "ffmpeg-${version}";
+  inherit version;
+
+  src = fetchurl {
+    url = "https://www.ffmpeg.org/releases/${name}.tar.bz2";
+    inherit sha256;
+  };
+
+  postPatch = ''patchShebangs .'';
+  inherit patches;
+
+  outputs = [ "bin" "dev" "out" "man" ]
+    ++ optional (reqMin "1.0") "doc" ; # just dev-doc
+  setOutputFlags = false; # doesn't accept all and stores configureFlags in libs!
+
+  configurePlatforms = [];
+  configureFlags = [
+      "--arch=${stdenv.hostPlatform.parsed.cpu.name}"
+      "--target_os=${stdenv.hostPlatform.parsed.kernel.name}"
+    # License
+      "--enable-gpl"
+      "--enable-version3"
+    # Build flags
+      "--enable-shared"
+      "--disable-static"
+      (ifMinVer "0.6" "--enable-pic")
+      (enableFeature runtimeCpuDetectBuild "runtime-cpudetect")
+      "--enable-hardcoded-tables"
+      (if multithreadBuild then (
+         if stdenv.isCygwin then
+           "--disable-pthreads --enable-w32threads"
+         else # Use POSIX threads by default
+           "--enable-pthreads --disable-w32threads")
+       else
+         "--disable-pthreads --disable-w32threads")
+      (ifMinVer "0.9" "--disable-os2threads") # We don't support OS/2
+      "--enable-network"
+      (ifMinVer "2.4" "--enable-pixelutils")
+    # Executables
+      "--enable-ffmpeg"
+      "--disable-ffplay"
+      (ifMinVer "0.6" "--enable-ffprobe")
+      (if reqMin "4" then null else "--disable-ffserver")
+    # Libraries
+      (ifMinVer "0.6" "--enable-avcodec")
+      (ifMinVer "0.6" "--enable-avdevice")
+      "--enable-avfilter"
+      (ifMinVer "0.6" "--enable-avformat")
+      (ifMinVer "1.0" "--enable-avresample")
+      (ifMinVer "1.1" "--enable-avutil")
+      "--enable-postproc"
+      (ifMinVer "0.9" "--enable-swresample")
+      "--enable-swscale"
+    # Docs
+      (ifMinVer "0.6" "--disable-doc")
+    # External Libraries
+      "--enable-bzlib"
+      "--enable-gnutls"
+      (ifMinVer "1.0" "--enable-fontconfig")
+      (ifMinVer "0.7" "--enable-libfreetype")
+      "--enable-libmp3lame"
+      (ifMinVer "1.2" "--enable-iconv")
+      "--enable-libtheora"
+      (ifMinVer "2.1" "--enable-libssh")
+      (ifMinVer "0.6" (enableFeature vaapiSupport "vaapi"))
+      (ifMinVer "3.4" (enableFeature vaapiSupport "libdrm"))
+      "--enable-vdpau"
+      "--enable-libvorbis"
+      (ifMinVer "0.6" (enableFeature vpxSupport "libvpx"))
+      (ifMinVer "2.4" "--enable-lzma")
+      (ifMinVer "2.2" (enableFeature openglSupport "opengl"))
+      (disDarwinOrArmFix (ifMinVer "0.9" "--enable-libpulse") "0.9" "--disable-libpulse")
+      (ifMinVer "2.5" (if sdlSupport && reqMin "3.2" then "--enable-sdl2" else if sdlSupport then "--enable-sdl" else null)) # autodetected before 2.5, SDL1 support removed in 3.2 for SDL2
+      (ifMinVer "1.2" "--enable-libsoxr")
+      "--enable-libx264"
+      "--enable-libxvid"
+      "--enable-zlib"
+      (ifMinVer "2.8" "--enable-libopus")
+      "--enable-libspeex"
+      (ifMinVer "2.8" "--enable-libx265")
+    # Developer flags
+      (enableFeature debugDeveloper "debug")
+      (enableFeature optimizationsDeveloper "optimizations")
+      (enableFeature extraWarningsDeveloper "extra-warnings")
+      "--disable-stripping"
+    # Disable mmx support for 0.6.90
+      (verFix null "0.6.90" "--disable-mmx")
+  ] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
+      "--cross-prefix=${stdenv.cc.targetPrefix}"
+      "--enable-cross-compile"
+  ] ++ optional stdenv.cc.isClang "--cc=clang";
+
+  nativeBuildInputs = [ perl pkgconfig texinfo yasm ];
+
+  buildInputs = [
+    bzip2 fontconfig freetype gnutls libiconv lame libass libogg libssh libtheora
+    libvdpau libvorbis lzma soxr x264 x265 xvidcore zlib libopus speex nv-codec-headers
+  ] ++ optional openglSupport libGLU_combined
+    ++ optional vpxSupport libvpx
+    ++ optionals (!isDarwin && !isAarch32) [ libpulseaudio ] # Need to be fixed on Darwin and ARM
+    ++ optional ((isLinux || isFreeBSD) && !isAarch32) libva
+    ++ optional ((isLinux || isFreeBSD) && !isAarch32) libdrm
+    ++ optional isLinux alsaLib
+    ++ optionals isDarwin darwinFrameworks
+    ++ optional vdpauSupport libvdpau
+    ++ optional sdlSupport (if reqMin "3.2" then SDL2 else SDL);
+
+  enableParallelBuilding = true;
+
+  doCheck = false; # fails
+
+  # ffmpeg 3+ generates pkg-config (.pc) files that don't have the
+  # form automatically handled by the multiple-outputs hooks.
+  postFixup = ''
+    moveToOutput bin "$bin"
+    moveToOutput share/ffmpeg/examples "$doc"
+    for pc in ''${!outputDev}/lib/pkgconfig/*.pc; do
+      substituteInPlace $pc \
+        --replace "includedir=$out" "includedir=''${!outputInclude}"
+    done
+  '';
+
+  installFlags = [ "install-man" ];
+
+  passthru = {
+    inherit vaapiSupport vdpauSupport;
+  };
+
+  meta = with stdenv.lib; {
+    description = "A complete, cross-platform solution to record, convert and stream audio and video";
+    homepage = http://www.ffmpeg.org/;
+    longDescription = ''
+      FFmpeg is the leading multimedia framework, able to decode, encode, transcode,
+      mux, demux, stream, filter and play pretty much anything that humans and machines
+      have created. It supports the most obscure ancient formats up to the cutting edge.
+      No matter if they were designed by some standards committee, the community or
+      a corporation.
+    '';
+    license = licenses.gpl3;
+    platforms = platforms.all;
+    maintainers = with maintainers; [ codyopel fuuzetsu ];
+    inherit branch;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/ffmpegthumbnailer/default.nix b/nixpkgs/pkgs/development/libraries/ffmpegthumbnailer/default.nix
new file mode 100644
index 000000000000..a1cc11fb8c1e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/ffmpegthumbnailer/default.nix
@@ -0,0 +1,34 @@
+{ fetchFromGitHub, stdenv, ffmpeg, cmake, libpng, pkgconfig, libjpeg
+}:
+
+stdenv.mkDerivation rec {
+  name = "ffmpegthumbnailer-${version}";
+  version = "2.2.0";
+
+  src = fetchFromGitHub {
+    owner = "dirkvdb";
+    repo = "ffmpegthumbnailer";
+    rev = version;
+    sha256 = "0kl8aa547icy9b05njps02a8sw4yn4f8fzs228kig247sn09s4cp";
+  };
+
+  nativeBuildInputs = [ cmake pkgconfig ];
+  buildInputs = [ ffmpeg libpng libjpeg ];
+
+  meta = with stdenv.lib;  {
+    homepage = https://github.com/dirkvdb/ffmpegthumbnailer;
+    description = "A lightweight video thumbnailer";
+    longDescription = "FFmpegthumbnailer is a lightweight video 
+        thumbnailer that can be used by file managers to create thumbnails
+        for your video files. The thumbnailer uses ffmpeg o decode frames
+        from the video files, so supported videoformats depend on the
+        configuration flags of ffmpeg.
+        This thumbnailer was designed to be as fast and lightweight as possible.
+        The only dependencies are ffmpeg and libpng.
+    ";
+    platforms = platforms.linux;
+    license = licenses.gpl2;
+    maintainers = [ maintainers.jagajaga ];
+  };
+
+}
diff --git a/nixpkgs/pkgs/development/libraries/ffms/default.nix b/nixpkgs/pkgs/development/libraries/ffms/default.nix
new file mode 100644
index 000000000000..8a5a9705cb22
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/ffms/default.nix
@@ -0,0 +1,26 @@
+{ stdenv, fetchFromGitHub, zlib, ffmpeg, pkgconfig }:
+
+stdenv.mkDerivation rec {
+  name = "ffms-${version}";
+  version = "2.23";
+
+  src = fetchFromGitHub {
+    owner = "FFMS";
+    repo = "ffms2";
+    rev = version;
+    sha256 = "0dkz5b3gxq5p4xz0qqg6l2sigszrlsinz3skyf0ln4wf3zrvf8m5";
+  };
+
+  NIX_CFLAGS_COMPILE = "-fPIC";
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ zlib ffmpeg ];
+
+  meta = with stdenv.lib; {
+    homepage = https://github.com/FFMS/ffms2/;
+    description = "Libav/ffmpeg based source library for easy frame accurate access";
+    license = licenses.mit;
+    maintainers = with maintainers; [ fuuzetsu ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/fftw/default.nix b/nixpkgs/pkgs/development/libraries/fftw/default.nix
new file mode 100644
index 000000000000..bc5de5f9730f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/fftw/default.nix
@@ -0,0 +1,50 @@
+{ fetchurl, stdenv, lib, precision ? "double", perl }:
+
+with lib;
+
+assert elem precision [ "single" "double" "long-double" "quad-precision" ];
+
+let
+  version = "3.3.8";
+  withDoc = stdenv.cc.isGNU;
+in
+
+stdenv.mkDerivation rec {
+  name = "fftw-${precision}-${version}";
+
+  src = fetchurl {
+    urls = [
+      "http://fftw.org/fftw-${version}.tar.gz"
+      "ftp://ftp.fftw.org/pub/fftw/fftw-${version}.tar.gz"
+    ];
+    sha256 = "00z3k8fq561wq2khssqg0kallk0504dzlx989x3vvicjdqpjc4v1";
+  };
+
+  outputs = [ "out" "dev" "man" ]
+    ++ optional withDoc "info"; # it's dev-doc only
+  outputBin = "dev"; # fftw-wisdom
+
+  configureFlags =
+    [ "--enable-shared" "--disable-static"
+      "--enable-threads"
+    ]
+    ++ optional (precision != "double") "--enable-${precision}"
+    # all x86_64 have sse2
+    # however, not all float sizes fit
+    ++ optional (stdenv.isx86_64 && (precision == "single" || precision == "double") )  "--enable-sse2"
+    ++ optional (stdenv.cc.isGNU && !stdenv.hostPlatform.isMusl) "--enable-openmp"
+    # doc generation causes Fortran wrapper generation which hard-codes gcc
+    ++ optional (!withDoc) "--disable-doc";
+
+  enableParallelBuilding = true;
+
+  checkInputs = [ perl ];
+
+  meta = with stdenv.lib; {
+    description = "Fastest Fourier Transform in the West library";
+    homepage = http://www.fftw.org/;
+    license = licenses.gpl2Plus;
+    maintainers = [ maintainers.spwhitt ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/filter-audio/default.nix b/nixpkgs/pkgs/development/libraries/filter-audio/default.nix
new file mode 100644
index 000000000000..4a2bed6b4979
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/filter-audio/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchFromGitHub }:
+
+stdenv.mkDerivation rec {
+  name = "filter-audio-${version}";
+  version = "0.0.1";
+
+  src = fetchFromGitHub {
+    owner = "irungentoo";
+    repo ="filter_audio";
+    rev = "v${version}";
+    sha256 = "1dv4pram317c1w97cjsv9f6r8cdxhgri7ib0v364z08pk7r2avfn";
+  };
+
+  doCheck = false;
+
+  makeFlags = "PREFIX=$(out)";
+
+  meta = with stdenv.lib; {
+    description = "Lightweight audio filtering library made from webrtc code";
+    license = licenses.bsd3;
+    maintainers = with maintainers; [ ];
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/flann/default.nix b/nixpkgs/pkgs/development/libraries/flann/default.nix
new file mode 100644
index 000000000000..a25f3ea04e27
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/flann/default.nix
@@ -0,0 +1,30 @@
+{ stdenv, fetchFromGitHub, fetchpatch, unzip, cmake, python }:
+
+stdenv.mkDerivation {
+  name = "flann-1.9.1";
+
+  src = fetchFromGitHub {
+    owner = "mariusmuja";
+    repo = "flann";
+    rev = "1.9.1";
+    sha256 = "13lg9nazj5s9a41j61vbijy04v6839i67lqd925xmxsbybf36gjc";
+  };
+
+  patches = [
+    # Upstream issue: https://github.com/mariusmuja/flann/issues/369
+    (fetchpatch {
+      url = "https://raw.githubusercontent.com/buildroot/buildroot/45a39b3e2ba42b72d19bfcef30db1b8da9ead51a/package/flann/0001-src-cpp-fix-cmake-3.11-build.patch";
+      sha256 = "1gmj06cmnqvwxx649mxaivd35727wj6w7710zbcmmgmsnyfh2js4";
+    })
+  ];
+
+  buildInputs = [ unzip cmake python ];
+
+  meta = {
+    homepage = http://people.cs.ubc.ca/~mariusm/flann/;
+    license = stdenv.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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/flatbuffers/default.nix b/nixpkgs/pkgs/development/libraries/flatbuffers/default.nix
new file mode 100644
index 000000000000..504b58b6aa4d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/flatbuffers/default.nix
@@ -0,0 +1,37 @@
+{ stdenv, fetchFromGitHub, cmake }:
+
+stdenv.mkDerivation rec {
+  name = "flatbuffers-${version}";
+  version = "1.10.0";
+
+  src = fetchFromGitHub {
+    owner = "google";
+    repo = "flatbuffers";
+    rev = "v${version}";
+    sha256 = "1b32kc5jp83l43w2gs1dkw2vqm2j0wi7xfxqa86m18n3l41ca734";
+  };
+
+  preConfigure = stdenv.lib.optional stdenv.buildPlatform.isDarwin ''
+    rm BUILD
+  '';
+
+  nativeBuildInputs = [ cmake ];
+  enableParallelBuilding = true;
+
+  doCheck = true;
+  checkTarget = "test";
+
+  meta = {
+    description = "Memory Efficient Serialization Library.";
+    longDescription = ''
+      FlatBuffers is an efficient cross platform serialization library for
+      games and other memory constrained apps. It allows you to directly
+      access serialized data without unpacking/parsing it first, while still
+      having great forwards/backwards compatibility.
+    '';
+    maintainers = [ stdenv.lib.maintainers.teh ];
+    license = stdenv.lib.licenses.asl20;
+    platforms = stdenv.lib.platforms.unix;
+    homepage = https://google.github.io/flatbuffers/;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/flatcc/default.nix b/nixpkgs/pkgs/development/libraries/flatcc/default.nix
new file mode 100644
index 000000000000..8518545665c9
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/flatcc/default.nix
@@ -0,0 +1,29 @@
+{ stdenv
+, fetchFromGitHub
+, cmake
+}:
+
+stdenv.mkDerivation rec {
+  pname = "flatcc";
+  version = "0.5.3";
+
+  src = fetchFromGitHub {
+    owner = "dvidelabs";
+    repo = "flatcc";
+    rev = "v${version}";
+    sha256 = "06wnwvnkhw1rk0y3nncjmcyjy3bgpw8i9xqd5gpbhbrm38718cjk";
+  };
+
+  nativeBuildInputs = [ cmake ];
+
+  cmakeFlags = [
+    "-DFLATCC_INSTALL=on"
+    "-DCMAKE_BUILD_TYPE=Release"
+  ];
+
+  meta = {
+    description = "FlatBuffers Compiler and Library in C for C ";
+    homepage = https://github.com/dvidelabs/flatcc;
+    license = [ stdenv.lib.licenses.asl20 ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/flatpak/bubblewrap-paths.patch b/nixpkgs/pkgs/development/libraries/flatpak/bubblewrap-paths.patch
new file mode 100644
index 000000000000..79257fd6be50
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/flatpak/bubblewrap-paths.patch
@@ -0,0 +1,15 @@
+diff --git a/icon-validator/validate-icon.c b/icon-validator/validate-icon.c
+index 6e23d9f2..8c621ec4 100644
+--- a/icon-validator/validate-icon.c
++++ b/icon-validator/validate-icon.c
+@@ -149,8 +149,8 @@ rerun_in_sandbox (const char *arg_width,
+             "--unshare-ipc",
+             "--unshare-net",
+             "--unshare-pid",
+-            "--ro-bind", "/usr", "/usr",
+-            "--ro-bind", "/etc/ld.so.cache", "/etc/ld.so.cache",
++            "--ro-bind", "@storeDir@", "@storeDir@",
++            "--ro-bind", "/run/current-system", "/run/current-system",
+             "--ro-bind", validate_icon, validate_icon,
+             NULL);
+ 
diff --git a/nixpkgs/pkgs/development/libraries/flatpak/default.nix b/nixpkgs/pkgs/development/libraries/flatpak/default.nix
new file mode 100644
index 000000000000..4ea17e588a9b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/flatpak/default.nix
@@ -0,0 +1,85 @@
+{ stdenv, fetchurl, autoreconfHook, docbook_xml_dtd_412, docbook_xml_dtd_42, docbook_xml_dtd_43, docbook_xsl, which, libxml2
+, gobject-introspection, gtk-doc, intltool, libxslt, pkgconfig, xmlto, appstream-glib, substituteAll, glibcLocales, yacc, xdg-dbus-proxy, p11-kit
+, bubblewrap, bzip2, dbus, glib, gpgme, json-glib, libarchive, libcap, libseccomp, coreutils, gettext, python2, hicolor-icon-theme
+, libsoup, lzma, ostree, polkit, python3, systemd, xorg, valgrind, glib-networking, wrapGAppsHook, gnome3, gsettings-desktop-schemas, librsvg }:
+
+stdenv.mkDerivation rec {
+  pname = "flatpak";
+  version = "1.2.4";
+
+  # TODO: split out lib once we figure out what to do with triggerdir
+  outputs = [ "out" "man" "doc" "installedTests" ];
+
+  src = fetchurl {
+    url = "https://github.com/flatpak/flatpak/releases/download/${version}/${pname}-${version}.tar.xz";
+    sha256 = "1qf3ys84fzv11z6f6li59rxjdjbyrv7cyi9539k73r9i9pckjr8v";
+  };
+
+  patches = [
+    (substituteAll {
+      src = ./fix-test-paths.patch;
+      inherit coreutils gettext glibcLocales;
+      hicolorIconTheme = hicolor-icon-theme;
+    })
+    (substituteAll {
+      src = ./fix-paths.patch;
+      p11 = p11-kit;
+    })
+    (substituteAll {
+      src = ./bubblewrap-paths.patch;
+      inherit (builtins) storeDir;
+    })
+    # patch taken from gtk_doc
+    ./respect-xml-catalog-files-var.patch
+    ./use-flatpak-from-path.patch
+    ./unset-env-vars.patch
+    ./validate-icon-pixbuf.patch
+  ];
+
+  nativeBuildInputs = [
+    autoreconfHook libxml2 docbook_xml_dtd_412 docbook_xml_dtd_42 docbook_xml_dtd_43 docbook_xsl which gobject-introspection
+    gtk-doc intltool libxslt pkgconfig xmlto appstream-glib yacc wrapGAppsHook
+  ];
+
+  buildInputs = [
+    bubblewrap bzip2 dbus gnome3.dconf glib gpgme json-glib libarchive libcap libseccomp
+    libsoup lzma ostree polkit python3 systemd xorg.libXau
+    gsettings-desktop-schemas glib-networking
+    librsvg # for flatpak-validate-icon
+  ];
+
+  checkInputs = [ valgrind ];
+
+  doCheck = false; # TODO: some issues with temporary files
+
+  NIX_LDFLAGS = [
+    "-lpthread"
+  ];
+
+  enableParallelBuilding = true;
+
+  configureFlags = [
+    "--with-system-bubblewrap=${bubblewrap}/bin/bwrap"
+    "--with-system-dbus-proxy=${xdg-dbus-proxy}/bin/xdg-dbus-proxy"
+    "--localstatedir=/var"
+    "--enable-installed-tests"
+  ];
+
+  makeFlags = [
+    "installed_testdir=$(installedTests)/libexec/installed-tests/flatpak"
+    "installed_test_metadir=$(installedTests)/share/installed-tests/flatpak"
+  ];
+
+  postPatch = ''
+    patchShebangs buildutil
+    patchShebangs tests
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Linux application sandboxing and distribution framework";
+    homepage = https://flatpak.org/;
+    license = licenses.lgpl21;
+    maintainers = with maintainers; [ jtojnar ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/flatpak/fix-paths.patch b/nixpkgs/pkgs/development/libraries/flatpak/fix-paths.patch
new file mode 100644
index 000000000000..49fcaa2b3f9b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/flatpak/fix-paths.patch
@@ -0,0 +1,20 @@
+--- a/session-helper/flatpak-session-helper.c
++++ b/session-helper/flatpak-session-helper.c
+@@ -624,7 +624,7 @@
+   g_auto(GStrv) stdout_lines = NULL;
+   int i;
+   char *p11_argv[] = {
+-    "p11-kit", "server",
++    "@p11@/bin/p11-kit", "server",
+     /* We explicitly request --sh here, because we then fail on earlier versions that doesn't support
+      * this flag. This is good, because those earlier versions did not properly daemonize and caused
+      * the spawn_sync to hang forever, waiting for the pipe to close.
+@@ -770,7 +770,7 @@
+       exit (1);
+     }
+ 
+-  if (g_find_program_in_path ("p11-kit"))
++  if (TRUE)
+     start_p11_kit_server (flatpak_dir);
+   else
+     g_debug ("p11-kit not found");
diff --git a/nixpkgs/pkgs/development/libraries/flatpak/fix-test-paths.patch b/nixpkgs/pkgs/development/libraries/flatpak/fix-test-paths.patch
new file mode 100644
index 000000000000..f987899e3bcb
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/flatpak/fix-test-paths.patch
@@ -0,0 +1,141 @@
+--- a/tests/libtest.sh
++++ b/tests/libtest.sh
+@@ -328,7 +328,7 @@
+     # running installed-tests: assume we know what we're doing
+     _flatpak_bwrap_works=true
+ elif ! "$FLATPAK_BWRAP" --unshare-ipc --unshare-net --unshare-pid \
+-        --ro-bind / / /bin/true > bwrap-result 2>&1; then
++        --ro-bind / / @coreutils@/bin/true > bwrap-result 2>&1; then
+     _flatpak_bwrap_works=false
+ else
+     _flatpak_bwrap_works=true
+@@ -309,12 +309,12 @@
+ export DBUS_SESSION_BUS_ADDRESS="$(cat dbus-session-bus-address)"
+ DBUS_SESSION_BUS_PID="$(cat dbus-session-bus-pid)"
+ 
+-if ! /bin/kill -0 "$DBUS_SESSION_BUS_PID"; then
++if ! @coreutils@/bin/kill -0 "$DBUS_SESSION_BUS_PID"; then
+     assert_not_reached "Failed to start dbus-daemon"
+ fi
+ 
+ cleanup () {
+-    /bin/kill -9 $DBUS_SESSION_BUS_PID ${FLATPAK_HTTP_PID:-}
++    @coreutils@/bin/kill -9 $DBUS_SESSION_BUS_PID ${FLATPAK_HTTP_PID:-}
+     gpg-connect-agent --homedir "${FL_GPG_HOMEDIR}" killagent /bye || true
+     fusermount -u $XDG_RUNTIME_DIR/doc || :
+     if test -n "${TEST_SKIP_CLEANUP:-}"; then
+--- a/tests/make-test-app.sh
++++ b/tests/make-test-app.sh
+@@ -114,13 +114,13 @@ msgid "Hello world"
+ msgstr "Hallo Welt"
+ EOF
+ mkdir -p ${DIR}/files/de/share/de/LC_MESSAGES
+-msgfmt --output-file ${DIR}/files/de/share/de/LC_MESSAGES/helloworld.mo de.po
++@gettext@/bin/msgfmt --output-file ${DIR}/files/de/share/de/LC_MESSAGES/helloworld.mo de.po
+ cat > fr.po <<EOF
+ msgid "Hello world"
+ msgstr "Bonjour le monde"
+ EOF
+ mkdir -p ${DIR}/files/fr/share/fr/LC_MESSAGES
+-msgfmt --output-file ${DIR}/files/fr/share/fr/LC_MESSAGES/helloworld.mo fr.po
++@gettext@/bin/msgfmt --output-file ${DIR}/files/fr/share/fr/LC_MESSAGES/helloworld.mo fr.po
+ 
+ flatpak build-finish ${DIR}
+ mkdir -p repos
+--- a/tests/make-test-runtime.sh
++++ b/tests/make-test-runtime.sh
+@@ -26,6 +26,7 @@
+ PATH="$PATH:/usr/sbin:/sbin"
+ 
+ # Add bash and dependencies
++mkdir -p ${DIR}/nix/store
+ mkdir -p ${DIR}/usr/bin
+ mkdir -p ${DIR}/usr/lib
+ ln -s ../lib ${DIR}/usr/lib64
+@@ -35,48 +36,27 @@
+ else
+     cp `which ldconfig` ${DIR}/usr/bin
+ fi
+-LIBS=`mktemp`
+-BINS=`mktemp`
+-
+-add_bin() {
+-    local f=$1
+-    shift
+-
+-    if grep -qFe "${f}" $BINS; then
+-        # Already handled
+-        return 0
+-    fi
+-
+-    echo $f >> $BINS
+-
+-    # Add library dependencies
+-    (ldd "${f}" | sed "s/.* => //"  | awk '{ print $1}' | grep ^/ | sort -u -o $LIBS $LIBS -)  || true
+-
+-    local shebang=$(sed -n '1s/^#!\([^ ]*\).*/\1/p' "${f}")
+-    if [ x$shebang != x ]; then
+-        add_bin "$shebang"
+-    fi
+-}
+-
+ for i in $@ bash ls cat echo readlink; do
+-    I=`which $i`
+-    add_bin $I
+-done
+-for i in `cat $BINS`; do
+-    echo Adding binary $i 1>&2
+-    cp "$i" ${DIR}/usr/bin/
+-done
+-for i in `cat $LIBS`; do
+-    echo Adding library $i 1>&2
+-    cp "$i" ${DIR}/usr/lib/
++    I=$(readlink -f $(which $i))
++    requisites=$(nix-store --query --requisites "$I")
++    for r in $requisites; do
++        # a single store item can be needed by multiple paths, no need to copy it again
++        if [ ! -e ${DIR}/$r ]; then
++            cp -r $r ${DIR}/$r
++        fi
++    done
++    ln -s $I ${DIR}/usr/bin/$i
+ done
+ ln -s bash ${DIR}/usr/bin/sh
+ 
+-# We copy the C.UTF8 locale and call it en_US. Its a bit of a lie, but
+-# the real en_US locale is often not available, because its in the
+-# local archive.
++mv ${DIR}/nix/store ${DIR}/usr/store # files outside /usr are not permitted, we will have to replace /nix/store with /usr/store
++chmod -R u+w ${DIR} # nix store has read-only directories which would cause problems during clean-up, files need to be writable for sed
++find ${DIR} -type f -print0 | xargs -0 sed -i 's~/nix/store/~/usr/store/~g' # replace hardcoded paths
++find ${DIR} -type l | xargs -I '{}' sh -c 'tg="$(readlink "$1")"; newtg="${tg#/nix/store/}"; if [ "$tg" != "$newtg" ]; then ln -fs "/usr/store/$newtg" "$1"; fi' -- '{}' # replace symlink targets
++
++# We copy the whole locale archive because we do not have C.UTF8 locale
+ mkdir -p ${DIR}/usr/lib/locale/
+-cp -r /usr/lib/locale/C.* ${DIR}/usr/lib/locale/en_US
++cp @glibcLocales@/lib/locale/locale-archive ${DIR}/usr/lib/locale/locale-archive
+ 
+ if [ x$COLLECTION_ID != x ]; then
+     collection_args=--collection-id=${COLLECTION_ID}
+--- a/tests/testlibrary.c
++++ b/tests/testlibrary.c
+@@ -584,7 +584,7 @@
+     {
+       gint exit_code = 0;
+       char *argv[] = { (char *) bwrap, "--unshare-ipc", "--unshare-net",
+-                       "--unshare-pid", "--ro-bind", "/", "/", "/bin/true", NULL };
++                       "--unshare-pid", "--ro-bind", "/", "/", "@coreutils@/bin/true", NULL };
+       g_autofree char *argv_str = g_strjoinv (" ", argv);
+       g_test_message ("Spawning %s", argv_str);
+       g_spawn_sync (NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, NULL, &exit_code, &error);
+--- a/triggers/gtk-icon-cache.trigger
++++ b/triggers/gtk-icon-cache.trigger
+@@ -1,7 +1,7 @@
+ #!/bin/sh
+ 
+ if test \( -x "$(which gtk-update-icon-cache 2>/dev/null)" \) -a \( -d $1/exports/share/icons/hicolor \); then
+-    cp /usr/share/icons/hicolor/index.theme $1/exports/share/icons/hicolor/
++    cp @hicolorIconTheme@/share/icons/hicolor/index.theme $1/exports/share/icons/hicolor/
+     for dir in $1/exports/share/icons/*; do
+         if test -f $dir/index.theme; then
+             if ! gtk-update-icon-cache --quiet $dir; then
diff --git a/nixpkgs/pkgs/development/libraries/flatpak/respect-xml-catalog-files-var.patch b/nixpkgs/pkgs/development/libraries/flatpak/respect-xml-catalog-files-var.patch
new file mode 100644
index 000000000000..0e259aebd8a5
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/flatpak/respect-xml-catalog-files-var.patch
@@ -0,0 +1,13 @@
+--- a/acinclude.m4
++++ b/acinclude.m4
+@@ -40,8 +40,8 @@
+ [
+   AC_REQUIRE([JH_PATH_XML_CATALOG],[JH_PATH_XML_CATALOG(,[:])])dnl
+   AC_MSG_CHECKING([for ifelse([$2],,[$1],[$2]) in XML catalog])
+-  if $jh_found_xmlcatalog && \
+-     AC_RUN_LOG([$XMLCATALOG --noout "$XML_CATALOG_FILE" "$1" >&2]); then
++  # empty argument forces libxml to use XML_CATALOG_FILES variable
++  if AC_RUN_LOG([$XMLCATALOG --noout "" "$1" >&2]); then
+     AC_MSG_RESULT([found])
+     ifelse([$3],,,[$3
+ ])dnl
diff --git a/nixpkgs/pkgs/development/libraries/flatpak/unset-env-vars.patch b/nixpkgs/pkgs/development/libraries/flatpak/unset-env-vars.patch
new file mode 100644
index 000000000000..798e388b23c2
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/flatpak/unset-env-vars.patch
@@ -0,0 +1,10 @@
+--- a/common/flatpak-run.c
++++ b/common/flatpak-run.c
+@@ -1192,6 +1192,7 @@ static const ExportData default_exports[] = {
+   {"PERLLIB", NULL},
+   {"PERL5LIB", NULL},
+   {"XCURSOR_PATH", NULL},
++  {"GDK_PIXBUF_MODULE_FILE", NULL},
+ };
+ 
+ static const ExportData no_ld_so_cache_exports[] = {
diff --git a/nixpkgs/pkgs/development/libraries/flatpak/use-flatpak-from-path.patch b/nixpkgs/pkgs/development/libraries/flatpak/use-flatpak-from-path.patch
new file mode 100644
index 000000000000..408198bda5cb
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/flatpak/use-flatpak-from-path.patch
@@ -0,0 +1,48 @@
+--- a/common/flatpak-dir.c
++++ b/common/flatpak-dir.c
+@@ -5758,7 +5758,7 @@ export_desktop_file (const char   *app,
+ 
+       new_exec = g_string_new ("");
+       g_string_append_printf (new_exec,
+-                              FLATPAK_BINDIR "/flatpak run --branch=%s --arch=%s",
++                              "flatpak run --branch=%s --arch=%s",
+                               escaped_branch,
+                               escaped_arch);
+ 
+@@ -6935,8 +6935,8 @@ flatpak_dir_deploy (FlatpakDir          *self,
+                                        error))
+         return FALSE;
+ 
+-      bin_data = g_strdup_printf ("#!/bin/sh\nexec %s/flatpak run --branch=%s --arch=%s %s \"$@\"\n",
+-                                  FLATPAK_BINDIR, escaped_branch, escaped_arch, escaped_app);
++      bin_data = g_strdup_printf ("#!/bin/sh\nexec flatpak run --branch=%s --arch=%s %s \"$@\"\n",
++                                  escaped_branch, escaped_arch, escaped_app);
+       if (!g_file_replace_contents (wrapper, bin_data, strlen (bin_data), NULL, FALSE,
+                                     G_FILE_CREATE_REPLACE_DESTINATION, NULL, cancellable, error))
+         return FALSE;
+diff --git a/tests/test-bundle.sh b/tests/test-bundle.sh
+index 6937b041..01f8add7 100755
+--- a/tests/test-bundle.sh
++++ b/tests/test-bundle.sh
+@@ -59,7 +59,7 @@ assert_has_dir $FL_DIR/app/org.test.Hello/$ARCH/master/active/files
+ assert_has_dir $FL_DIR/app/org.test.Hello/$ARCH/master/active/export
+ assert_has_file $FL_DIR/exports/share/applications/org.test.Hello.desktop
+ # Ensure Exec key is rewritten
+-assert_file_has_content $FL_DIR/exports/share/applications/org.test.Hello.desktop "^Exec=.*/flatpak run --branch=master --arch=$ARCH --command=hello.sh org.test.Hello$"
++assert_file_has_content $FL_DIR/exports/share/applications/org.test.Hello.desktop "^Exec=flatpak run --branch=master --arch=$ARCH --command=hello.sh org.test.Hello$"
+ assert_has_file $FL_DIR/exports/share/icons/hicolor/64x64/apps/org.test.Hello.png
+ assert_has_file $FL_DIR/exports/share/icons/HighContrast/64x64/apps/org.test.Hello.png
+ 
+diff --git a/tests/test-run.sh b/tests/test-run.sh
+index 9d83d82e..234e4ec6 100755
+--- a/tests/test-run.sh
++++ b/tests/test-run.sh
+@@ -42,7 +42,7 @@ assert_has_dir $FL_DIR/app/org.test.Hello/$ARCH/master/active/files
+ assert_has_dir $FL_DIR/app/org.test.Hello/$ARCH/master/active/export
+ assert_has_file $FL_DIR/exports/share/applications/org.test.Hello.desktop
+ # Ensure Exec key is rewritten
+-assert_file_has_content $FL_DIR/exports/share/applications/org.test.Hello.desktop "^Exec=.*/flatpak run --branch=master --arch=$ARCH --command=hello.sh org.test.Hello$"
++assert_file_has_content $FL_DIR/exports/share/applications/org.test.Hello.desktop "^Exec=flatpak run --branch=master --arch=$ARCH --command=hello.sh org.test.Hello$"
+ assert_has_file $FL_DIR/exports/share/icons/hicolor/64x64/apps/org.test.Hello.png
+ assert_not_has_file $FL_DIR/exports/share/icons/hicolor/64x64/apps/dont-export.png
+ assert_has_file $FL_DIR/exports/share/icons/HighContrast/64x64/apps/org.test.Hello.png
diff --git a/nixpkgs/pkgs/development/libraries/flatpak/validate-icon-pixbuf.patch b/nixpkgs/pkgs/development/libraries/flatpak/validate-icon-pixbuf.patch
new file mode 100644
index 000000000000..5b8cc2d0383f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/flatpak/validate-icon-pixbuf.patch
@@ -0,0 +1,13 @@
+diff --git a/icon-validator/validate-icon.c b/icon-validator/validate-icon.c
+index 6e23d9f2..f0659a78 100644
+--- a/icon-validator/validate-icon.c
++++ b/icon-validator/validate-icon.c
+@@ -193,6 +193,8 @@ rerun_in_sandbox (const char *arg_width,
+     add_args (args, "--setenv", "G_MESSAGES_DEBUG", g_getenv ("G_MESSAGES_DEBUG"), NULL);
+   if (g_getenv ("G_MESSAGES_PREFIXED"))
+     add_args (args, "--setenv", "G_MESSAGES_PREFIXED", g_getenv ("G_MESSAGES_PREFIXED"), NULL);
++  if (g_getenv ("GDK_PIXBUF_MODULE_FILE"))
++    add_args (args, "--setenv", "GDK_PIXBUF_MODULE_FILE", g_getenv ("GDK_PIXBUF_MODULE_FILE"), NULL);
+ 
+   add_args (args, validate_icon, arg_width, arg_height, filename, NULL);
+   g_ptr_array_add (args, NULL);
diff --git a/nixpkgs/pkgs/development/libraries/flint/default.nix b/nixpkgs/pkgs/development/libraries/flint/default.nix
new file mode 100644
index 000000000000..d92a0c61aab8
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/flint/default.nix
@@ -0,0 +1,63 @@
+{ stdenv
+, fetchurl
+, fetchpatch
+, gmp
+, mpir
+, mpfr
+, ntl
+, openblas ? null
+, withBlas ? true
+}:
+
+assert withBlas -> openblas != null;
+
+stdenv.mkDerivation rec {
+  name = "flint-${version}";
+  version = "2.5.2"; # remove libflint.so.MAJOR patch when updating
+  src = fetchurl {
+    url = "http://www.flintlib.org/flint-${version}.tar.gz";
+    sha256 = "11syazv1a8rrnac3wj3hnyhhflpqcmq02q8pqk2m6g2k6h0gxwfb";
+  };
+  buildInputs = [
+    gmp
+    mpir
+    mpfr
+    ntl
+  ] ++ stdenv.lib.optionals withBlas [
+    openblas
+  ];
+  propagatedBuildInputs = [
+    mpfr # flint.h includes mpfr.h
+  ];
+  configureFlags = [
+    "--with-gmp=${gmp}"
+    "--with-mpir=${mpir}"
+    "--with-mpfr=${mpfr}"
+    "--with-ntl=${ntl}"
+  ] ++ stdenv.lib.optionals withBlas [
+    "--with-blas=${openblas}"
+  ];
+
+  # issues with ntl -- https://github.com/wbhart/flint2/issues/487
+  NIX_CXXSTDLIB_COMPILE = [ "-std=c++11" ];
+
+  patches = [
+    (fetchpatch {
+      # Always produce libflint.so.MAJOR; will be included in the next flint version
+      # See https://github.com/wbhart/flint2/pull/347
+      url = "https://github.com/wbhart/flint2/commit/49fbcd8f736f847d3f9667f9f7d5567ef4550ecb.patch";
+      sha256 = "09w09bpq85kjf752bd3y3i5lvy59b8xjiy7qmrcxzibx2a21pj73";
+    })
+  ];
+  doCheck = true;
+  meta = {
+    inherit version;
+    description = ''Fast Library for Number Theory'';
+    license = stdenv.lib.licenses.gpl2Plus;
+    maintainers = [stdenv.lib.maintainers.raskin];
+    platforms = stdenv.lib.platforms.unix;
+    homepage = http://www.flintlib.org/;
+    downloadPage = "http://www.flintlib.org/downloads.html";
+    updateWalker = true;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/flite/default.nix b/nixpkgs/pkgs/development/libraries/flite/default.nix
new file mode 100644
index 000000000000..0b4172cdc764
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/flite/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchFromGitHub, alsaLib }:
+
+stdenv.mkDerivation rec {
+  name = "flite-2.1.0";
+
+  src = fetchFromGitHub {
+    owner  = "festvox";
+    repo   = "flite";
+    rev    = "d673f65b2c4a8cd3da7447079309a6dc4bcf1a5e";
+    sha256 = "1kx43jvdln370590gfjhxxz3chxfi6kq18504wmdpljib2l0grjq";
+  };
+
+  buildInputs = [ alsaLib ];
+
+  configureFlags = [
+    "--enable-shared"
+    "--with-audio=alsa"
+  ];
+
+  enableParallelBuilding = true;
+
+  meta = {
+    description = "A small, fast run-time speech synthesis engine";
+    homepage = http://www.festvox.org/flite/;
+    license = stdenv.lib.licenses.free;
+    platforms = stdenv.lib.platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/fltk/1.4.nix b/nixpkgs/pkgs/development/libraries/fltk/1.4.nix
new file mode 100644
index 000000000000..3cdebe184d7e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/fltk/1.4.nix
@@ -0,0 +1,52 @@
+{ stdenv, fetchurl, pkgconfig, xlibsWrapper, xorgproto, libXi
+, freeglut, libGLU_combined, libjpeg, zlib, libXft, libpng
+, libtiff, freetype, cf-private, Cocoa, AGL, GLUT
+}:
+
+let
+  version = "1.4.x-r13121";
+in stdenv.mkDerivation {
+  name = "fltk-${version}";
+
+  src = fetchurl {
+    url = "http://fltk.org/pub/fltk/snapshots/fltk-${version}.tar.gz";
+    sha256 = "1v8wxvxcbk99i82x2v5fpqg5vj8n7g8a38g30ry7nzcjn5sf3r63";
+  };
+
+  preConfigure = "make clean";
+
+  patches = stdenv.lib.optionals stdenv.isDarwin [ ./nsosv.patch ];
+
+  nativeBuildInputs = [ pkgconfig ];
+
+  buildInputs = [
+    libGLU_combined
+    libjpeg
+    zlib
+    libpng
+    libXft
+  ];
+
+  configureFlags = [
+    "--enable-gl"
+    "--enable-largefile"
+    "--enable-shared"
+    "--enable-threads"
+    "--enable-xft"
+  ];
+
+  propagatedBuildInputs = [ xorgproto ]
+    ++ (if stdenv.isDarwin
+        then [ Cocoa AGL GLUT freetype libtiff cf-private  /* Needed for NSDefaultRunLoopMode */ ]
+        else [ xlibsWrapper libXi freeglut ]);
+
+  enableParallelBuilding = true;
+
+  meta = {
+    description = "A C++ cross-platform lightweight GUI library";
+    homepage = http://www.fltk.org;
+    platforms = stdenv.lib.platforms.linux ++ stdenv.lib.platforms.darwin;
+    license = stdenv.lib.licenses.gpl2;
+  };
+
+}
diff --git a/nixpkgs/pkgs/development/libraries/fltk/default.nix b/nixpkgs/pkgs/development/libraries/fltk/default.nix
new file mode 100644
index 000000000000..60773d29d3d6
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/fltk/default.nix
@@ -0,0 +1,50 @@
+{ stdenv, fetchurl, pkgconfig, xlibsWrapper, xorgproto, libXi
+, freeglut, libGLU_combined, libjpeg, zlib, libXft, libpng
+, libtiff, freetype, cf-private, Cocoa, AGL, GLUT
+}:
+
+let
+  version = "1.3.5";
+in stdenv.mkDerivation {
+  name = "fltk-${version}";
+
+  src = fetchurl {
+    url = "http://fltk.org/pub/fltk/${version}/fltk-${version}-source.tar.gz";
+    sha256 = "00jp24z1818k9n6nn6lx7qflqf2k13g4kxr0p8v1d37kanhb4ac7";
+  };
+
+  patches = stdenv.lib.optionals stdenv.isDarwin [ ./nsosv.patch ];
+
+  nativeBuildInputs = [ pkgconfig ];
+
+  buildInputs = [
+    libGLU_combined
+    libjpeg
+    zlib
+    libpng
+    libXft
+  ];
+
+  configureFlags = [
+    "--enable-gl"
+    "--enable-largefile"
+    "--enable-shared"
+    "--enable-threads"
+    "--enable-xft"
+  ];
+
+  propagatedBuildInputs = [ xorgproto ]
+    ++ (if stdenv.isDarwin
+        then [ Cocoa AGL GLUT freetype libtiff cf-private  /* Needed for NSDefaultRunLoopMode */ ]
+        else [ xlibsWrapper libXi freeglut ]);
+
+  enableParallelBuilding = true;
+
+  meta = {
+    description = "A C++ cross-platform lightweight GUI library";
+    homepage = http://www.fltk.org;
+    platforms = stdenv.lib.platforms.linux ++ stdenv.lib.platforms.darwin;
+    license = stdenv.lib.licenses.gpl2;
+  };
+
+}
diff --git a/nixpkgs/pkgs/development/libraries/fltk/nsosv.patch b/nixpkgs/pkgs/development/libraries/fltk/nsosv.patch
new file mode 100644
index 000000000000..9e55b011b571
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/fltk/nsosv.patch
@@ -0,0 +1,20 @@
+diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm
+index 6f5b8b1..2c7763d 100644
+--- a/src/Fl_cocoa.mm
++++ b/src/Fl_cocoa.mm
+@@ -4074,15 +4074,6 @@ Window fl_xid(const Fl_Window* w)
+ static int calc_mac_os_version() {
+   int M, m, b = 0;
+   NSAutoreleasePool *localPool = [[NSAutoreleasePool alloc] init];
+-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_10
+-  if ([NSProcessInfo instancesRespondToSelector:@selector(operatingSystemVersion)]) {
+-    NSOperatingSystemVersion version = [[NSProcessInfo processInfo] operatingSystemVersion];
+-    M = version.majorVersion;
+-    m = version.minorVersion;
+-    b = version.patchVersion;
+-  }
+-  else
+-#endif
+   {
+     NSDictionary * sv = [NSDictionary dictionaryWithContentsOfFile:@"/System/Library/CoreServices/SystemVersion.plist"];
+     const char *s = [[sv objectForKey:@"ProductVersion"] UTF8String];
diff --git a/nixpkgs/pkgs/development/libraries/fmt/default.nix b/nixpkgs/pkgs/development/libraries/fmt/default.nix
new file mode 100644
index 000000000000..6974adf74cec
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/fmt/default.nix
@@ -0,0 +1,43 @@
+{ stdenv, fetchFromGitHub, fetchpatch, cmake, enableShared ? true }:
+
+stdenv.mkDerivation rec {
+  version = "5.3.0";
+  name = "fmt-${version}";
+
+  src = fetchFromGitHub {
+    owner = "fmtlib";
+    repo = "fmt";
+    rev = "${version}";
+    sha256 = "1hl9s69a5ql5nckc0ifh2fzlgsgv1wsn6yhqkpnrhasqkhj0hgv4";
+  };
+
+  outputs = [ "out" "dev" ];
+
+  nativeBuildInputs = [ cmake ];
+
+  cmakeFlags = [
+    "-DFMT_TEST=TRUE"
+    "-DBUILD_SHARED_LIBS=${if enableShared then "TRUE" else "FALSE"}"
+  ];
+
+  enableParallelBuilding = true;
+
+  doCheck = true;
+  # preCheckHook ensures the test binaries can find libfmt.so.5
+  preCheck = if enableShared
+             then "export LD_LIBRARY_PATH=\"$PWD\""
+             else "";
+
+  meta = with stdenv.lib; {
+    description = "Small, safe and fast formatting library";
+    longDescription = ''
+      fmt (formerly cppformat) is an open-source formatting library. It can be
+      used as a fast and safe alternative to printf and IOStreams.
+    '';
+    homepage = http://fmtlib.net/;
+    downloadPage = https://github.com/fmtlib/fmt/;
+    maintainers = [ maintainers.jdehaas ];
+    license = licenses.bsd2;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/folks/default.nix b/nixpkgs/pkgs/development/libraries/folks/default.nix
new file mode 100644
index 000000000000..84ab5fedebcd
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/folks/default.nix
@@ -0,0 +1,105 @@
+{ fetchurl
+, stdenv
+, pkgconfig
+, meson
+, ninja
+, glib
+, gnome3
+, nspr
+, gettext
+, gobject-introspection
+, vala
+, sqlite
+, libxml2
+, dbus-glib
+, libsoup
+, nss
+, dbus
+, libgee
+, telepathy-glib
+, evolution-data-server
+, libsecret
+, db
+, python3
+, python
+, readline
+, gtk3
+}:
+
+# TODO: enable more folks backends
+
+stdenv.mkDerivation rec {
+  pname = "folks";
+  version = "0.12.1";
+
+  outputs = [ "out" "dev" ];
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    sha256 = "0xfl6rnzhdbmw1q26xiq34cdiy7a9karpi2r7wyplnnz1zaz5a9w";
+  };
+
+  mesonFlags = [
+    # TODO: https://gitlab.gnome.org/GNOME/folks/issues/108
+    "-Ddocs=false"
+  ];
+
+  nativeBuildInputs = [
+    gettext
+    gobject-introspection
+    gtk3
+    meson
+    ninja
+    pkgconfig
+    python
+    python3
+    vala
+  ];
+
+  buildInputs = [
+    db
+    dbus-glib
+    evolution-data-server
+    libsecret
+    libsoup
+    libxml2
+    nspr
+    nss
+    readline
+    telepathy-glib
+  ];
+
+  propagatedBuildInputs = [
+    glib
+    libgee
+    sqlite
+  ];
+
+  checkInputs = [
+    dbus
+  ];
+
+  # TODO: enable tests
+  # doCheck = true;
+
+  postPatch = ''
+    chmod +x meson_post_install.py
+    patchShebangs meson_post_install.py
+    patchShebangs tests/tools/manager-file.py
+  '';
+
+  passthru = {
+    updateScript = gnome3.updateScript {
+      packageName = pname;
+      versionPolicy = "none";
+    };
+  };
+
+  meta = with stdenv.lib; {
+    description = "A library that aggregates people from multiple sources to create metacontacts";
+    homepage = https://wiki.gnome.org/Projects/Folks;
+    license = licenses.lgpl2Plus;
+    maintainers = gnome3.maintainers;
+    platforms = platforms.gnu ++ platforms.linux;  # arbitrary choice
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/folly/default.nix b/nixpkgs/pkgs/development/libraries/folly/default.nix
new file mode 100644
index 000000000000..00ac6abbc8eb
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/folly/default.nix
@@ -0,0 +1,38 @@
+{ stdenv, fetchFromGitHub, cmake, boost, libevent, double-conversion, glog
+, google-gflags, libiberty, openssl }:
+
+stdenv.mkDerivation rec {
+  name = "folly-${version}";
+  version = "2019.05.27.00";
+
+  src = fetchFromGitHub {
+    owner = "facebook";
+    repo = "folly";
+    rev = "v${version}";
+    sha256 = "00xacaziqllps069xzg7iz68rj5hr8mj3rbi4shkrr9jq51y9ikj";
+  };
+
+  nativeBuildInputs = [ cmake ];
+
+  # See CMake/folly-deps.cmake in the Folly source tree.
+  buildInputs = [
+    boost
+    double-conversion
+    glog
+    google-gflags
+    libevent
+    libiberty
+    openssl
+  ];
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    description = "An open-source C++ library developed and used at Facebook";
+    homepage = https://github.com/facebook/folly;
+    license = licenses.asl20;
+    # 32bit is not supported: https://github.com/facebook/folly/issues/103
+    platforms = [ "x86_64-linux" "x86_64-darwin" ];
+    maintainers = with maintainers; [ abbradar pierreis ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/fontconfig-ultimate/default.nix b/nixpkgs/pkgs/development/libraries/fontconfig-ultimate/default.nix
new file mode 100644
index 000000000000..9aeb12344ece
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/fontconfig-ultimate/default.nix
@@ -0,0 +1,48 @@
+{ stdenv, fetchFromGitHub }:
+
+let version = "2016-04-23"; in
+stdenv.mkDerivation {
+  name = "fontconfig-ultimate-${version}";
+
+  src = fetchFromGitHub {
+    sha256 = "1rd2n60l8bamx84q3l91pd9a0wz9h7p6ajvx1dw22qn8rah4h498";
+    rev = version;
+    repo = "fontconfig-ultimate";
+    owner = "bohoomil";
+  };
+
+  installPhase = ''
+    mkdir -p $out/etc/fonts/conf.d
+    cp conf.d.infinality/*.conf $out/etc/fonts/conf.d
+
+    # Base rendering settings will be determined by NixOS module
+    rm $out/etc/fonts/conf.d/10-base-rendering.conf
+
+    # Options controlled by NixOS module
+    rm $out/etc/fonts/conf.d/35-repl-custom.conf
+    rm $out/etc/fonts/conf.d/38-repl-*.conf
+    rm $out/etc/fonts/conf.d/82-*.conf
+    rm $out/etc/fonts/conf.d/83-*.conf
+
+    # Inclusion of local and user configs handled by global configuration
+    rm $out/etc/fonts/conf.d/29-local.conf
+    rm $out/etc/fonts/conf.d/28-user.conf
+
+    cp fontconfig_patches/fonts-settings/*.conf $out/etc/fonts/conf.d
+
+    # fix font priority issue https://github.com/bohoomil/fontconfig-ultimate/issues/173
+    mv $out/etc/fonts/conf.d/{43,60}-wqy-zenhei-sharp.conf
+
+    mkdir -p $out/etc/fonts/presets/{combi,free,ms}
+    cp fontconfig_patches/combi/*.conf $out/etc/fonts/presets/combi
+    cp fontconfig_patches/free/*.conf $out/etc/fonts/presets/free
+    cp fontconfig_patches/ms/*.conf $out/etc/fonts/presets/ms
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Font configuration files, patches, scripts and source packages (Infinality & friends)";
+    homepage = https://github.com/bohoomil/fontconfig-ultimate;
+    license = licenses.mit;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/fontconfig/2.10.nix b/nixpkgs/pkgs/development/libraries/fontconfig/2.10.nix
new file mode 100644
index 000000000000..1d66735569d5
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/fontconfig/2.10.nix
@@ -0,0 +1,47 @@
+{ stdenv, fetchurl, pkgconfig, freetype, expat
+}:
+
+stdenv.mkDerivation rec {
+  name = "fontconfig-2.10.2";
+
+  src = fetchurl {
+    url = "http://fontconfig.org/release/${name}.tar.bz2";
+    sha256 = "0llraqw86jmw4vzv7inskp3xxm2gc64my08iwq5mzncgfdbfza4f";
+  };
+
+  outputs = [ "bin" "dev" "lib" "out" ]; # $out contains all the config
+
+  propagatedBuildInputs = [ freetype ];
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ expat ];
+
+  configureFlags = [
+    "--with-arch=${stdenv.hostPlatform.parsed.cpu.name}"
+    "--sysconfdir=/etc"
+    "--with-cache-dir=/var/cache/fontconfig"
+    "--disable-docs"
+    "--with-default-fonts="
+  ] ++ stdenv.lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
+    "--with-arch=${stdenv.hostPlatform.parsed.cpu.name}"
+  ];
+
+  enableParallelBuilding = true;
+
+  doCheck = true;
+
+  # Don't try to write to /var/cache/fontconfig at install time.
+  installFlags = "sysconfdir=$(out)/etc fc_cachedir=$(TMPDIR)/dummy RUN_FC_CACHE_TEST=false";
+
+  passthru = {
+    # Empty for backward compatibility, there was no versioning before 2.11
+    configVersion = "";
+  };
+
+  meta = with stdenv.lib; {
+    description = "A library for font customization and configuration";
+    homepage = http://fontconfig.org/;
+    license = licenses.bsd2; # custom but very bsd-like
+    platforms = platforms.all;
+    maintainers = [ maintainers.vcunat ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/fontconfig/config-compat.patch b/nixpkgs/pkgs/development/libraries/fontconfig/config-compat.patch
new file mode 100644
index 000000000000..e86f08fb553c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/fontconfig/config-compat.patch
@@ -0,0 +1,28 @@
+commit 05c6adf8104b4321d3a3716a7b9feb6bf223ed0c (HEAD, nixpkgs)
+Author: Vladimír Čunát <vcunat@gmail.com>
+Date:   Tue Nov 4 12:24:25 2014 +0100
+
+    add check for /etc/fonts/@configVersion@/fonts.conf
+    
+    It's checked between FONTCONFIG_FILE and the usual /etc/fonts/fonts.conf.
+    Also, hardcode /etc/fonts/fonts.conf to prevent accidental override.
+
+diff --git a/src/fccfg.c b/src/fccfg.c
+index 6377fd7..e9eb10a 100644
+--- a/src/fccfg.c
++++ b/src/fccfg.c
+@@ -2070,8 +2070,13 @@ FcConfigFilename (const FcChar8 *url)
+     if (!url || !*url)
+     {
+ 	url = (FcChar8 *) getenv ("FONTCONFIG_FILE");
++	if (!url) {
++	    static const FcChar8 *cfPath = "/etc/fonts/@configVersion@/fonts.conf";
++	    if (access (cfPath, R_OK) == 0)
++		url = cfPath;
++	}
+ 	if (!url)
+-	    url = (FcChar8 *) FONTCONFIG_FILE;
++	    url = (FcChar8 *) "/etc/fonts/fonts.conf";
+     }
+     file = 0;
+ 
diff --git a/nixpkgs/pkgs/development/libraries/fontconfig/default.nix b/nixpkgs/pkgs/development/libraries/fontconfig/default.nix
new file mode 100644
index 000000000000..f730e3e3408f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/fontconfig/default.nix
@@ -0,0 +1,79 @@
+{ stdenv, substituteAll, fetchurl
+, pkgconfig, freetype, expat, libxslt, gperf, dejavu_fonts
+}:
+
+/** Font configuration scheme
+ - ./config-compat.patch makes fontconfig try the following root configs, in order:
+    $FONTCONFIG_FILE, /etc/fonts/${configVersion}/fonts.conf, /etc/fonts/fonts.conf
+    This is done not to override config of pre-2.11 versions (which just blow up)
+    and still use *global* font configuration at both NixOS or non-NixOS.
+ - NixOS creates /etc/fonts/${configVersion}/fonts.conf link to $out/etc/fonts/fonts.conf,
+    and other modifications should go to /etc/fonts/${configVersion}/conf.d
+ - See ./make-fonts-conf.xsl for config details.
+
+*/
+
+let
+  configVersion = "2.11"; # bump whenever fontconfig breaks compatibility with older configurations
+in
+stdenv.mkDerivation rec {
+  name = "fontconfig-${version}";
+  version = "2.12.6";
+
+  src = fetchurl {
+    url = "http://fontconfig.org/release/${name}.tar.bz2";
+    sha256 = "05zh65zni11kgnhg726gjbrd55swspdvhqbcnj5a5xh8gn03036g";
+  };
+
+  patches = [
+    (substituteAll {
+      src = ./config-compat.patch;
+      inherit configVersion;
+    })
+  ];
+
+  outputs = [ "bin" "dev" "lib" "out" ]; # $out contains all the config
+
+  propagatedBuildInputs = [ freetype ];
+  nativeBuildInputs = [ pkgconfig gperf libxslt ];
+  buildInputs = [ expat ];
+
+  configureFlags = [
+    "--with-arch=${stdenv.hostPlatform.parsed.cpu.name}"
+    "--with-cache-dir=/var/cache/fontconfig" # otherwise the fallback is in $out/
+    "--disable-docs"
+    # 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) [
+    "--with-arch=${stdenv.hostPlatform.parsed.cpu.name}"
+  ];
+
+  enableParallelBuilding = true;
+
+  doCheck = true;
+
+  # Don't try to write to /var/cache/fontconfig at install time.
+  installFlags = "fc_cachedir=$(TMPDIR)/dummy RUN_FC_CACHE_TEST=false";
+
+  postInstall = ''
+    cd "$out/etc/fonts"
+    xsltproc --stringparam fontDirectories "${dejavu_fonts.minimal}" \
+      --stringparam fontconfigConfigVersion "${configVersion}" \
+      --path $out/share/xml/fontconfig \
+      ${./make-fonts-conf.xsl} $out/etc/fonts/fonts.conf \
+      > fonts.conf.tmp
+    mv fonts.conf.tmp $out/etc/fonts/fonts.conf
+  '';
+
+  passthru = {
+    inherit configVersion;
+  };
+
+  meta = with stdenv.lib; {
+    description = "A library for font customization and configuration";
+    homepage = http://fontconfig.org/;
+    license = licenses.bsd2; # custom but very bsd-like
+    platforms = platforms.all;
+    maintainers = [ maintainers.vcunat ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/fontconfig/make-fonts-cache.nix b/nixpkgs/pkgs/development/libraries/fontconfig/make-fonts-cache.nix
new file mode 100644
index 000000000000..2ee0af8cfc13
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/fontconfig/make-fonts-cache.nix
@@ -0,0 +1,33 @@
+{ runCommand, lib, fontconfig, fontDirectories }:
+
+runCommand "fc-cache"
+  rec {
+    buildInputs = [ fontconfig.bin ];
+    preferLocalBuild = true;
+    allowSubstitutes = false;
+    passAsFile = [ "fontDirs" ];
+    fontDirs = ''
+      <!-- Font directories -->
+      ${lib.concatStringsSep "\n" (map (font: "<dir>${font}</dir>") fontDirectories)}
+    '';
+  }
+  ''
+    export FONTCONFIG_FILE=$(pwd)/fonts.conf
+
+    cat > fonts.conf << EOF
+    <?xml version='1.0'?>
+    <!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
+    <fontconfig>
+      <include>${fontconfig.out}/etc/fonts/fonts.conf</include>
+      <cachedir>$out</cachedir>
+    EOF
+    cat "$fontDirsPath" >> fonts.conf
+    echo "</fontconfig>" >> fonts.conf
+
+    mkdir -p $out
+    fc-cache -sv
+
+    # This is not a cache dir in the normal sense -- it won't be automatically
+    # recreated.
+    rm -f "$out/CACHEDIR.TAG"
+  ''
diff --git a/nixpkgs/pkgs/development/libraries/fontconfig/make-fonts-conf.nix b/nixpkgs/pkgs/development/libraries/fontconfig/make-fonts-conf.nix
new file mode 100644
index 000000000000..b18d72e0a228
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/fontconfig/make-fonts-conf.nix
@@ -0,0 +1,17 @@
+{ runCommand, libxslt, fontconfig, dejavu_fonts, fontDirectories }:
+
+runCommand "fonts.conf"
+  {
+    nativeBuildInputs = [ libxslt ];
+    buildInputs = [ fontconfig ];
+    # Add a default font for non-nixos systems, <1MB and in nixos defaults.
+    fontDirectories = fontDirectories ++ [ dejavu_fonts.minimal ];
+  }
+  ''
+    xsltproc --stringparam fontDirectories "$fontDirectories" \
+      --stringparam fontconfig "${fontconfig.out}" \
+      --stringparam fontconfigConfigVersion "${fontconfig.configVersion}" \
+      --path ${fontconfig.out}/share/xml/fontconfig \
+      ${./make-fonts-conf.xsl} ${fontconfig.out}/etc/fonts/fonts.conf \
+      > $out
+  ''
diff --git a/nixpkgs/pkgs/development/libraries/fontconfig/make-fonts-conf.xsl b/nixpkgs/pkgs/development/libraries/fontconfig/make-fonts-conf.xsl
new file mode 100644
index 000000000000..dddbbe9e516b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/fontconfig/make-fonts-conf.xsl
@@ -0,0 +1,59 @@
+<?xml version="1.0"?>
+
+<!--
+  This script copies the original fonts.conf from the fontconfig
+  distribution, but replaces all <dir> entries with the directories
+  specified in the $fontDirectories parameter.
+-->
+
+<xsl:stylesheet version="1.0"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:str="http://exslt.org/strings"
+                extension-element-prefixes="str"
+                >
+
+  <xsl:output method='xml' encoding="UTF-8" doctype-system="fonts.dtd" />
+
+  <xsl:param name="fontDirectories" />
+  <xsl:param name="fontconfig" />
+  <xsl:param name="fontconfigConfigVersion" />
+
+  <xsl:template match="/fontconfig">
+
+    <fontconfig>
+      <xsl:apply-templates select="child::node()[name() != 'dir' and name() != 'cachedir' and name() != 'include']" />
+
+      <!-- the first cachedir will be used to store the cache -->
+      <cachedir prefix="xdg">fontconfig</cachedir>
+      <!-- /var/cache/fontconfig is useful for non-nixos systems -->
+      <cachedir>/var/cache/fontconfig</cachedir>
+
+      <!-- versioned system-wide config -->
+      <include ignore_missing="yes">/etc/fonts/<xsl:value-of select="$fontconfigConfigVersion" />/conf.d</include>
+
+      <dir prefix="xdg">fonts</dir>
+      <xsl:for-each select="str:tokenize($fontDirectories)">
+        <dir><xsl:value-of select="." /></dir>
+        <xsl:text>&#0010;</xsl:text>
+      </xsl:for-each>
+
+      <!-- nix user profile -->
+      <dir>~/.nix-profile/lib/X11/fonts</dir>
+      <dir>~/.nix-profile/share/fonts</dir>
+      <!-- nix default profile -->
+      <dir>/nix/var/nix/profiles/default/lib/X11/fonts</dir>
+      <dir>/nix/var/nix/profiles/default/share/fonts</dir>
+
+    </fontconfig>
+
+  </xsl:template>
+
+
+  <!-- New fontconfig >=2.11 doesn't like xml:space added by xsl:copy-of -->
+  <xsl:template match="node()|@*">
+    <xsl:copy>
+      <xsl:apply-templates select="node()|@*[name() != 'xml:space']"/>
+    </xsl:copy>
+  </xsl:template>
+
+</xsl:stylesheet>
diff --git a/nixpkgs/pkgs/development/libraries/fox/clang.patch b/nixpkgs/pkgs/development/libraries/fox/clang.patch
new file mode 100644
index 000000000000..0ca2ebf0d8da
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/fox/clang.patch
@@ -0,0 +1,13 @@
+diff --git a/src/FXReactor.cpp b/src/FXReactor.cpp
+index 1ecdb45..9058a30 100644
+--- a/src/FXReactor.cpp
++++ b/src/FXReactor.cpp
+@@ -452,7 +452,7 @@ FXint FXReactor::processActiveHandles(FXTime block,FXuint flags){
+     }
+ 
+   // Normal case
+-  if(0<=hand){
++  if(0==hand){
+ 
+     // Any handles active?
+     if(0<nhand){
diff --git a/nixpkgs/pkgs/development/libraries/fox/default.nix b/nixpkgs/pkgs/development/libraries/fox/default.nix
new file mode 100644
index 000000000000..40430f34334c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/fox/default.nix
@@ -0,0 +1,38 @@
+{ stdenv, fetchurl, xlibsWrapper, libpng, libjpeg, libtiff, zlib, bzip2, libXcursor, libXrandr, libXft
+, CoreServices ? null }:
+
+stdenv.mkDerivation rec {
+  name = "fox-${version}";
+  version = "1.7.9";
+
+  src = fetchurl {
+    url = "ftp://ftp.fox-toolkit.org/pub/${name}.tar.gz";
+    sha256 = "1jb9368xsin3ppdf6979n5s7in3s9klbxqbwcp0z8misjixl7nzg";
+  };
+
+  patches = [ ./clang.patch ];
+
+  buildInputs = [ libpng xlibsWrapper libjpeg libtiff zlib bzip2 libXcursor libXrandr libXft ]
+    ++ stdenv.lib.optional stdenv.isDarwin CoreServices;
+
+  doCheck = true;
+
+  enableParallelBuilding = true;
+
+  hardeningDisable = [ "format" ];
+
+  meta = with stdenv.lib; {
+    description = "C++ based class library for building Graphical User Interfaces";
+    longDescription = ''
+      FOX stands for Free Objects for X.
+      It is a C++ based class library for building Graphical User Interfaces.
+      Initially, it was developed for LINUX, but the scope of this project has in the course of time become somewhat more ambitious.
+      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 = licenses.lgpl3;
+    maintainers = [];
+    broken = stdenv.isDarwin;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/fox/fox-1.6.nix b/nixpkgs/pkgs/development/libraries/fox/fox-1.6.nix
new file mode 100644
index 000000000000..4f1e0eaee7fb
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/fox/fox-1.6.nix
@@ -0,0 +1,42 @@
+{ stdenv, fetchurl, xlibsWrapper, libpng, libjpeg, libtiff, zlib, bzip2, libXcursor
+, libXrandr, libGLU_combined, libXft, libXfixes, xinput
+, CoreServices }:
+
+let
+  version = "1.6.57";
+in
+
+stdenv.mkDerivation rec {
+  name = "fox-${version}";
+
+  src = fetchurl {
+    url = "ftp://ftp.fox-toolkit.org/pub/${name}.tar.gz";
+    sha256 = "08w98m6wjadraw1pi13igzagly4b2nfa57kdqdnkjfhgkvg1bvv5";
+  };
+
+  buildInputs = [
+    xlibsWrapper libpng libjpeg libtiff zlib bzip2 libXcursor libXrandr
+    libXft libGLU_combined libXfixes xinput
+  ] ++ stdenv.lib.optional stdenv.isDarwin CoreServices;
+
+  doCheck = true;
+
+  enableParallelBuilding = true;
+
+  hardeningDisable = [ "format" ];
+
+  meta = {
+    branch = "1.6";
+    description = "A C++ based class library for building Graphical User Interfaces";
+    longDescription = ''
+        FOX stands for Free Objects for X.
+        It is a C++ based class library for building Graphical User Interfaces.
+        Initially, it was developed for LINUX, but the scope of this project has in the course of time become somewhat more ambitious.
+        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;
+    maintainers = [];
+    platforms = stdenv.lib.platforms.mesaPlatforms;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/fplll/20160331.nix b/nixpkgs/pkgs/development/libraries/fplll/20160331.nix
new file mode 100644
index 000000000000..952ecb0eadeb
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/fplll/20160331.nix
@@ -0,0 +1,23 @@
+{stdenv, fetchFromGitHub, autoconf, automake, libtool, gettext, autoreconfHook
+, gmp, mpfr
+}:
+stdenv.mkDerivation rec {
+  name = "${pname}-${version}";
+  pname = "fplll";
+  version = "20160331";
+  src = fetchFromGitHub {
+    owner = "${pname}";
+    repo = "${pname}";
+    rev = "11dea26c2f9396ffb7a7191aa371343f1f74c5c3";
+    sha256 = "1clxch9hbr30w6s84m2mprxv58adhg5qw6sa2p3jr1cy4r7r59ib";
+  };
+  nativeBuildInputs = [autoconf automake libtool gettext autoreconfHook];
+  buildInputs = [gmp mpfr];
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/fplll/default.nix b/nixpkgs/pkgs/development/libraries/fplll/default.nix
new file mode 100644
index 000000000000..063217a45047
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/fplll/default.nix
@@ -0,0 +1,23 @@
+{stdenv, fetchFromGitHub, autoconf, automake, libtool, gettext, autoreconfHook
+, gmp, mpfr
+}:
+stdenv.mkDerivation rec {
+  name = "${pname}-${version}";
+  pname = "fplll";
+  version = "5.2.1";
+  src = fetchFromGitHub {
+    owner = "${pname}";
+    repo = "${pname}";
+    rev = "${version}";
+    sha256 = "015qmrd7nfaysbv1hbwiprz9g6hnww1y1z1xw8f43ysb7k1b5nbg";
+  };
+  nativeBuildInputs = [autoconf automake libtool gettext autoreconfHook];
+  buildInputs = [gmp mpfr];
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/frame/default.nix b/nixpkgs/pkgs/development/libraries/frame/default.nix
new file mode 100644
index 000000000000..e15626a160e2
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/frame/default.nix
@@ -0,0 +1,24 @@
+{ enableX11 ? true
+,  stdenv, fetchurl, pkgconfig, xorg }:
+
+stdenv.mkDerivation rec {
+  name = "frame-${version}";
+  version = "2.5.0";
+  src = fetchurl {
+    url = "https://launchpad.net/frame/trunk/v${version}/+download/${name}.tar.xz";
+    sha256 = "bc2a20cd3ac1e61fe0461bd3ee8cb250dbcc1fa511fad0686d267744e9c78f3a";
+  };
+
+  buildInputs = [ 
+    stdenv pkgconfig
+  ] ++ stdenv.lib.optionals enableX11 [xorg.xorgserver xorg.libX11 xorg.libXext xorg.libXi];
+
+  configureFlags = stdenv.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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/freealut/default.nix b/nixpkgs/pkgs/development/libraries/freealut/default.nix
new file mode 100644
index 000000000000..c6ea5bbd23ba
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/freealut/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, darwin, fetchurl, openal }:
+
+stdenv.mkDerivation rec {
+  name = "freealut-1.1.0";
+
+  src = fetchurl {
+    url = "http://www.openal.org/openal_webstf/downloads/${name}.tar.gz";
+    sha256 = "0kzlil6112x2429nw6mycmif8y6bxr2cwjcvp18vh6s7g63ymlb0";
+  };
+
+  buildInputs = [ openal
+  ] ++ stdenv.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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/freeglut/default.nix b/nixpkgs/pkgs/development/libraries/freeglut/default.nix
new file mode 100644
index 000000000000..c34d9591d386
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/freeglut/default.nix
@@ -0,0 +1,41 @@
+{ stdenv, fetchurl, libXi, libXrandr, libXxf86vm, libGL, libGLU, xlibsWrapper, cmake }:
+
+let version = "3.0.0";
+in stdenv.mkDerivation {
+  name = "freeglut-${version}";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/freeglut/freeglut-${version}.tar.gz";
+    sha256 = "18knkyczzwbmyg8hr4zh8a1i5ga01np2jzd1rwmsh7mh2n2vwhra";
+  };
+
+  outputs = [ "out" "dev" ];
+
+  buildInputs = [ libXi libXrandr libXxf86vm libGL libGLU xlibsWrapper cmake ];
+
+  cmakeFlags = stdenv.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"
+                 "-DFREEGLUT_BUILD_DEMOS:BOOL=OFF"
+                 "-DFREEGLUT_BUILD_STATIC:BOOL=OFF"
+               ];
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    description = "Create and manage windows containing OpenGL contexts";
+    longDescription = ''
+      FreeGLUT is an open source alternative to the OpenGL Utility Toolkit
+      (GLUT) library. GLUT (and hence FreeGLUT) allows the user to create and
+      manage windows containing OpenGL contexts on a wide range of platforms
+      and also read the mouse, keyboard and joystick functions. FreeGLUT is
+      intended to be a full replacement for GLUT, and has only a few
+      differences.
+    '';
+    homepage = http://freeglut.sourceforge.net/;
+    license = licenses.mit;
+    platforms = platforms.all;
+    maintainers = [ maintainers.bjornfor ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/freeimage/default.nix b/nixpkgs/pkgs/development/libraries/freeimage/default.nix
new file mode 100644
index 000000000000..b2c66ad346d0
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/freeimage/default.nix
@@ -0,0 +1,73 @@
+{ stdenv, fetchurl, unzip, darwin }:
+
+stdenv.mkDerivation {
+  name = "freeimage-3.17.0";
+
+  src = fetchurl {
+    url = mirror://sourceforge/freeimage/FreeImage3170.zip;
+    sha256 = "12bz57asdcfsz3zr9i9nska0fb6h3z2aizy412qjqkixkginbz7v";
+  };
+
+  patches = let
+    patchURL = https://anonscm.debian.org/cgit/debian-science/packages/freeimage.git/plain/debian/patches;
+  in [
+    (fetchurl {
+      url = patchURL + "/Fix-CVE-2015-0852.patch";
+      sha256 = "1vxdck4i5qi5j6i3cjja0gfy79mmbf0lq2qdrnqdsl4kclbvw2c8";
+    })
+    (fetchurl {
+      url = patchURL + "/Fix-CVE-2016-5684.patch";
+      sha256 = "14ffgqbnwg28r6sjvm3z89zbnnm9ghbc81hdhrzxlyk3vwvd6cw3";
+    })
+    (fetchurl {
+      url = https://raw.githubusercontent.com/buildroot/buildroot/2018.05/package/libfreeimage/0005-Manage-powf64-with-glibc.patch;
+      sha256 = "1lis479ad5cfkhqm044nk4x97wfwm3hry3bvij1w5xkndnlfppc2";
+    })
+  ];
+
+  buildInputs = [ unzip ] ++ stdenv.lib.optional stdenv.isDarwin darwin.cctools;
+
+  prePatch = if stdenv.isDarwin
+             then ''
+    sed -e 's/gcc-4.0/clang/g' \
+        -e 's/g++-4.0/clang++/g' \
+        -e 's/COMPILERFLAGS = -Os -fexceptions -fvisibility=hidden -DNO_LCMS/COMPILERFLAGS = -Os -fexceptions -fvisibility=hidden -DNO_LCMS -D__ANSI__/' \
+        -e "s|PREFIX = /usr/local|PREFIX = $out|" \
+        -e 's|-Wl,-syslibroot /Developer/SDKs/MacOSX10.5.sdk||g' \
+        -e 's|-Wl,-syslibroot /Developer/SDKs/MacOSX10.6.sdk||g' \
+        -e 's|-isysroot /Developer/SDKs/MacOSX10.6.sdk||g' \
+        -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||g' \
+        -e 's| $(STATICLIB)-ppc $(STATICLIB)-i386||g' \
+        -e 's| $(SHAREDLIB)-ppc $(SHAREDLIB)-i386||g' \
+        -e 's|	install -d -m 755 -o root -g wheel $(INCDIR) $(INSTALLDIR)||' \
+        -e 's| -m 644 -o root -g wheel||g' \
+        -i ./Makefile.osx
+    # Fix LibJXR performance timers
+    sed 's|^SRCS = \(.*\)$|SRCS = \1 Source/LibJXR/image/sys/perfTimerANSI.c|' -i ./Makefile.srcs
+  ''
+             else ''
+    sed -e s@/usr/@$out/@ \
+        -e 's@-o root -g root@@' \
+        -e 's@ldconfig@echo not running ldconfig@' \
+        -i Makefile.gnu Makefile.fip
+    # Fix gcc 5.1 macro problems
+    # https://chromium.googlesource.com/webm/libwebp/+/eebaf97f5a1cb713d81d311308d8a48c124e5aef%5E!/
+    sed -i -e 's/"\(#[^"]*\)"/" \1 "/g' Source/LibWebP/src/dsp/*
+  '';
+
+  postBuild = stdenv.lib.optionalString (!stdenv.isDarwin) "make -f Makefile.fip";
+  preInstall = "mkdir -p $out/include $out/lib";
+  postInstall = stdenv.lib.optionalString (!stdenv.isDarwin) "make -f Makefile.fip install";
+
+  NIX_CFLAGS_COMPILE = "-Wno-narrowing";
+
+  enableParallelBuilding = true;
+
+  meta = {
+    description = "Open Source library for accessing popular graphics image file formats";
+    homepage = http://freeimage.sourceforge.net/;
+    license = "GPL";
+    maintainers = with stdenv.lib.maintainers; [viric];
+    platforms = with stdenv.lib.platforms; unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/freenect/default.nix b/nixpkgs/pkgs/development/libraries/freenect/default.nix
new file mode 100644
index 000000000000..3771880d3608
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/freenect/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, lib, fetchFromGitHub, cmake, libusb, pkgconfig, freeglut, libGLU_combined, libXi, libXmu
+, GLUT, Cocoa
+ }:
+
+stdenv.mkDerivation rec {
+  name = "freenect-${version}";
+  version = "0.5.7";
+
+  src = fetchFromGitHub {
+    owner = "OpenKinect";
+    repo = "libfreenect";
+    rev = "v${version}";
+    sha256 = "0vnc7z2avckh4mccqq6alsd2z7xvsh3kaslc5b0gnfxw0j269gl6";
+  };
+
+  buildInputs = [ libusb freeglut libGLU_combined libXi libXmu ]
+    ++ lib.optionals stdenv.isDarwin [ GLUT Cocoa ];
+
+  nativeBuildInputs = [ cmake pkgconfig ];
+
+  meta = {
+    description = "Drivers and libraries for the Xbox Kinect device on Windows, Linux, and macOS";
+    inherit version;
+    homepage = http://openkinect.org;
+    license = with lib.licenses; [ gpl2 asl20 ];
+    maintainers = with lib.maintainers; [ bennofs ];
+    platforms = with lib.platforms; linux ++ darwin ;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/freetds/default.nix b/nixpkgs/pkgs/development/libraries/freetds/default.nix
new file mode 100644
index 000000000000..d8bb9e8e85b0
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/freetds/default.nix
@@ -0,0 +1,33 @@
+{ stdenv, fetchurl, autoreconfHook, pkgconfig
+, openssl
+, odbcSupport ? true, unixODBC ? null }:
+
+assert odbcSupport -> unixODBC != null;
+
+# Work is in progress to move to cmake so revisit that later
+
+stdenv.mkDerivation rec {
+  name = "freetds-${version}";
+  version = "1.1.6";
+
+  src = fetchurl {
+    url    = "http://www.freetds.org/files/stable/${name}.tar.bz2";
+    sha256 = "18rry59npbhxpzjb0l3ib7zlnlzj43srb5adcm65wyklklsh0gn2";
+  };
+
+  buildInputs = [
+    openssl
+  ] ++ stdenv.lib.optional odbcSupport unixODBC;
+
+  nativeBuildInputs = [ autoreconfHook pkgconfig ];
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    description = "Libraries to natively talk to Microsoft SQL Server and Sybase databases";
+    homepage    = http://www.freetds.org;
+    license     = licenses.lgpl2;
+    maintainers = with maintainers; [ peterhoeg ];
+    platforms   = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/freetts/default.nix b/nixpkgs/pkgs/development/libraries/freetts/default.nix
new file mode 100644
index 000000000000..8c6f60b98010
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/freetts/default.nix
@@ -0,0 +1,37 @@
+{stdenv, fetchurl, apacheAnt, unzip, sharutils, lib, jdk}:
+
+stdenv.mkDerivation {
+  name = "freetts-1.2.2";
+  src = fetchurl {
+    url = mirror://sourceforge/freetts/freetts-1.2.2-src.zip;
+    sha256 = "0mnikqhpf4f4jdr0irmibr8yy0dnffx1i257y22iamxi7a6by2r7";
+  };
+  buildInputs = [ apacheAnt unzip sharutils jdk ];
+  unpackPhase = ''
+    unzip $src -x META-INF/*
+  '';
+
+  buildPhase = ''
+    cd */lib
+    sed -i -e "s/more/cat/" jsapi.sh
+    echo y | sh jsapi.sh
+    cd ..
+    ln -s . src
+    ant
+  '';
+  installPhase = ''
+    install -v -m755 -d $out/{lib,docs/{audio,images}}
+    install -v -m644 lib/*.jar $out/lib
+  '';
+
+  meta = {
+    description = "Text to speech system based on Festival written in Java";
+    longDescription = ''
+      Text to speech system based on Festival written in Java.
+      Can be used in combination with KDE accessibility.
+    '';
+    license = "GPL";
+    homepage = http://freetts.sourceforge.net;
+    maintainers = [ lib.maintainers.sander ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/freetype/default.nix b/nixpkgs/pkgs/development/libraries/freetype/default.nix
new file mode 100644
index 000000000000..4658ac049df9
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/freetype/default.nix
@@ -0,0 +1,72 @@
+{ stdenv, fetchurl
+, buildPackages
+, pkgconfig, which, makeWrapper
+, zlib, bzip2, libpng, gnumake, glib
+
+, # FreeType supports LCD filtering (colloquially referred to as sub-pixel rendering).
+  # LCD filtering is also known as ClearType and covered by several Microsoft patents.
+  # This option allows it to be disabled. See http://www.freetype.org/patents.html.
+  useEncumberedCode ? true
+}:
+
+let
+  inherit (stdenv.lib) optional optionalString;
+
+in stdenv.mkDerivation rec {
+  pname = "freetype";
+  version = "2.10.0";
+
+  meta = with stdenv.lib; {
+    description = "A font rendering engine";
+    longDescription = ''
+      FreeType is a portable and efficient library for rendering fonts. It
+      supports TrueType, Type 1, CFF fonts, and WOFF, PCF, FNT, BDF and PFR
+      fonts. It has a bytecode interpreter and has an automatic hinter called
+      autofit which can be used instead of hinting instructions included in
+      fonts.
+    '';
+    homepage = https://www.freetype.org/;
+    license = licenses.gpl2Plus; # or the FreeType License (BSD + advertising clause)
+    platforms = platforms.all;
+    maintainers = with maintainers; [ ttuegel ];
+  };
+
+  src = fetchurl {
+    url = "mirror://savannah/${pname}/${pname}-${version}.tar.bz2";
+    sha256 = "01mybx78n3n9dhzylbrdy42wxdwfn8rp514qdkzjy6b5ij965k7w";
+  };
+
+  propagatedBuildInputs = [ zlib bzip2 libpng ]; # needed when linking against freetype
+  # dependence on harfbuzz is looser than the reverse dependence
+  nativeBuildInputs = [ pkgconfig which makeWrapper ]
+    # FreeType requires GNU Make, which is not part of stdenv on FreeBSD.
+    ++ optional (!stdenv.isLinux) gnumake;
+
+  patches =
+    [ ./enable-table-validation.patch
+    ] ++
+    optional useEncumberedCode ./enable-subpixel-rendering.patch;
+
+  outputs = [ "out" "dev" ];
+
+  configureFlags = [ "--disable-static" "--bindir=$(dev)/bin" "--enable-freetype-config" ];
+
+  # native compiler to generate building tool
+  CC_BUILD = "${buildPackages.stdenv.cc}/bin/cc";
+
+  # The asm for armel is written with the 'asm' keyword.
+  CFLAGS = optionalString stdenv.isAarch32 "-std=gnu99";
+
+  enableParallelBuilding = true;
+
+  doCheck = true;
+
+  postInstall = glib.flattenInclude + ''
+    substituteInPlace $dev/bin/freetype-config \
+      --replace ${buildPackages.pkgconfig} ${pkgconfig}
+
+    wrapProgram "$dev/bin/freetype-config" \
+      --set PKG_CONFIG_PATH "$PKG_CONFIG_PATH:$dev/lib/pkgconfig"
+  '';
+
+}
diff --git a/nixpkgs/pkgs/development/libraries/freetype/enable-subpixel-rendering.patch b/nixpkgs/pkgs/development/libraries/freetype/enable-subpixel-rendering.patch
new file mode 100644
index 000000000000..6b3577eb4f02
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/freetype/enable-subpixel-rendering.patch
@@ -0,0 +1,12 @@
+Index: freetype-2.10.0/include/freetype/config/ftoption.h
+--- a/include/freetype/config/ftoption.h
++++ b/include/freetype/config/ftoption.h
+@@ -126,7 +126,7 @@ FT_BEGIN_HEADER
+    * macro is not defined, FreeType offers alternative LCD rendering
+    * technology that produces excellent output without LCD filtering.
+    */
+-/* #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
++#define FT_CONFIG_OPTION_SUBPIXEL_RENDERING
+ 
+ 
+   /**************************************************************************
diff --git a/nixpkgs/pkgs/development/libraries/freetype/enable-table-validation.patch b/nixpkgs/pkgs/development/libraries/freetype/enable-table-validation.patch
new file mode 100644
index 000000000000..bd964c3342d8
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/freetype/enable-table-validation.patch
@@ -0,0 +1,20 @@
+Index: freetype-2.10.0/modules.cfg
+===================================================================
+--- freetype-2.10.0.orig/modules.cfg
++++ freetype-2.10.0/modules.cfg
+@@ -120,6 +120,6 @@ AUX_MODULES += cache
+ # TrueType GX/AAT table validation.  Needs ftgxval.c below.
+ #
+-# AUX_MODULES += gxvalid
++AUX_MODULES += gxvalid
+ 
+ # Support for streams compressed with gzip (files with suffix .gz).
+ #
+@@ -143,6 +143,6 @@ AUX_MODULES += bzip2
+ # OpenType table validation.  Needs ftotval.c below.
+ #
+-# AUX_MODULES += otvalid
++AUX_MODULES += otvalid
+ 
+ # Auxiliary PostScript driver component to share common code.
+ #
diff --git a/nixpkgs/pkgs/development/libraries/frei0r/default.nix b/nixpkgs/pkgs/development/libraries/frei0r/default.nix
new file mode 100644
index 000000000000..cdeddd82b71d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/frei0r/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchurl, autoconf, cairo, opencv, pkgconfig }:
+
+stdenv.mkDerivation rec {
+  name = "frei0r-plugins-${version}";
+  version = "1.6.1";
+
+  src = fetchurl {
+    url = "https://files.dyne.org/frei0r/releases/${name}.tar.gz";
+    sha256 = "0pji26fpd0dqrx1akyhqi6729s394irl73dacnyxk58ijqq4dhp0";
+  };
+
+  nativeBuildInputs = [ autoconf pkgconfig ];
+  buildInputs = [ cairo opencv ];
+
+  postInstall = stdenv.lib.optionalString stdenv.hostPlatform.isDarwin ''
+    for f in $out/lib/frei0r-1/*.so* ; do
+      ln -s $f "''${f%.*}.dylib"
+    done
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = https://frei0r.dyne.org;
+    description = "Minimalist, cross-platform, shared video plugins";
+    license = licenses.gpl2;
+    maintainers = [ maintainers.goibhniu ];
+    platforms = platforms.linux ++ platforms.darwin;
+
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/fribidi/default.nix b/nixpkgs/pkgs/development/libraries/fribidi/default.nix
new file mode 100644
index 000000000000..b60f4be245e2
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/fribidi/default.nix
@@ -0,0 +1,47 @@
+{ stdenv
+, fetchurl
+, fetchpatch
+
+, meson
+, ninja
+, pkgconfig
+, fixDarwinDylibNames
+, python3
+}:
+
+stdenv.mkDerivation rec {
+  name = "${pname}-${version}";
+  pname = "fribidi";
+  version = "1.0.5";
+
+  outputs = [ "out" "devdoc" ];
+
+  # NOTE: 2018-06-06 v1.0.5: Only URL tarball has "Have pre-generated man pages: true", which works-around upstream usage of some rare ancient `c2man` fossil application.
+  src = fetchurl {
+    url = "https://github.com/${pname}/${pname}/releases/download/v${version}/${name}.tar.bz2";
+    sha256 = "1kp4b1hpx2ky20ixgy2xhj5iygfl7ps5k9kglh1z5i7mhykg4r3a";
+  };
+
+  patches = [
+    (fetchpatch {
+      url = "https://github.com/fribidi/fribidi/pull/88.patch";
+      sha256 = "1n4l6333vhbxfckwg101flmvq6bbygg66fjp69ddcjqaqb6gh9k9";
+    })
+  ];
+
+  postPatch = ''
+    patchShebangs test
+  '';
+
+  nativeBuildInputs = [ meson ninja pkgconfig ];
+  buildInputs = stdenv.lib.optional stdenv.isDarwin fixDarwinDylibNames;
+
+  checkInptus = [ python3 ];
+
+  meta = with stdenv.lib; {
+    homepage = https://github.com/fribidi/fribidi;
+    description = "GNU implementation of the Unicode Bidirectional Algorithm (bidi)";
+    license = licenses.lgpl21;
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/fstrcmp/default.nix b/nixpkgs/pkgs/development/libraries/fstrcmp/default.nix
new file mode 100644
index 000000000000..68f3c9d0ee59
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/fstrcmp/default.nix
@@ -0,0 +1,31 @@
+{ stdenv, fetchzip, libtool, ghostscript, groff }:
+
+stdenv.mkDerivation rec {
+  name = "fstrcmp-${version}";
+  version = "0.7";
+
+  src = fetchzip {
+    url = "https://sourceforge.net/projects/fstrcmp/files/fstrcmp/${version}/fstrcmp-${version}.D001.tar.gz";
+    sha256 = "0yg3y3k0wz50gmhgigfi2dx725w1gc8snb95ih7vpcnj6kabgz9a";
+  };
+
+  outputs = [ "out" "dev" "doc" "man" "devman" ];
+
+  nativeBuildInputs = [ libtool ghostscript groff ];
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    description = "Make fuzzy comparisons of strings and byte arrays";
+    longDescription = ''
+      The fstrcmp project provides a library that is used to make fuzzy
+      comparisons of strings and byte arrays, including multi-byte character
+      strings.
+    '';
+    homepage = http://fstrcmp.sourceforge.net/;
+    downloadPage = https://sourceforge.net/projects/fstrcmp/;
+    license = licenses.gpl3;
+    maintainers = [ maintainers.sephalon ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/fstrm/default.nix b/nixpkgs/pkgs/development/libraries/fstrm/default.nix
new file mode 100644
index 000000000000..3fcf218d6b56
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/fstrm/default.nix
@@ -0,0 +1,32 @@
+{ stdenv, fetchFromGitHub, autoreconfHook, pkgconfig, libevent, openssl }:
+
+stdenv.mkDerivation rec {
+  name = "fstrm-${version}";
+  version = "0.5.0";
+
+  src = fetchFromGitHub {
+    owner = "farsightsec";
+    repo = "fstrm";
+    rev = "v${version}";
+    sha256 = "1vm880h6vpnxqh7v0x17yfim6f2fbxwkm03ms58s2h9akmph9xm5";
+  };
+
+  outputs = [ "bin" "out" "dev" ];
+
+  nativeBuildInputs = [ autoreconfHook pkgconfig ];
+  buildInputs = [ libevent openssl ];
+
+  preBuild = ''
+    NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -L${openssl}/lib"
+  '';
+
+  doCheck = true;
+
+  meta = with stdenv.lib; {
+    description = "Frame Streams implementation in C";
+    homepage = https://github.com/farsightsec/fstrm;
+    license = licenses.asl20;
+    platforms = platforms.unix;
+  };
+}
+
diff --git a/nixpkgs/pkgs/development/libraries/ftgl/default.nix b/nixpkgs/pkgs/development/libraries/ftgl/default.nix
new file mode 100644
index 000000000000..289a57399854
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/ftgl/default.nix
@@ -0,0 +1,38 @@
+{ stdenv, fetchurl, freetype, libGLU_combined, OpenGL }:
+
+let
+  name = "ftgl-2.1.3-rc5";
+in
+stdenv.mkDerivation {
+  inherit name;
+
+  src = fetchurl {
+    url = "mirror://sourceforge/ftgl/${name}.tar.gz";
+    sha256 = "0nsn4s6vnv5xcgxcw6q031amvh2zfj2smy1r5mbnjj2548hxcn2l";
+  };
+
+  buildInputs = [ freetype ]
+    ++ (if stdenv.isDarwin then
+      [ OpenGL ]
+    else
+      [ libGLU_combined ])
+    ;
+
+  enableParallelBuilding = true;
+
+  meta = {
+    homepage = https://sourceforge.net/apps/mediawiki/ftgl/;
+    description = "Font rendering library for OpenGL applications";
+    license = stdenv.lib.licenses.gpl3Plus;
+
+    longDescription = ''
+      FTGL is a free cross-platform Open Source C++ library that uses
+      Freetype2 to simplify rendering fonts in OpenGL applications. FTGL
+      supports bitmaps, pixmaps, texture maps, outlines, polygon mesh,
+      and extruded polygon rendering modes.
+    '';
+
+    platforms = stdenv.lib.platforms.unix;
+    maintainers = [];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/funambol/default.nix b/nixpkgs/pkgs/development/libraries/funambol/default.nix
new file mode 100644
index 000000000000..100c00eea497
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/funambol/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchurl, zlib, curl, autoreconfHook, unzip }:
+
+stdenv.mkDerivation rec {
+  name = "funambol-client-cpp-9.0.0";
+
+  src = fetchurl {
+    url = mirror://sourceforge/funambol/funambol-client-sdk-9.0.0.zip;
+    sha256 = "1667gahz30i5r8kbv7w415z0hbgm6f6pln1137l5skapi1if6r73";
+  };
+
+  postUnpack = ''sourceRoot+="/sdk/cpp/build/autotools"'';
+
+  propagatedBuildInputs = [ zlib curl ];
+
+  nativeBuildInputs = [ autoreconfHook unzip ];
+
+  meta = with stdenv.lib; {
+    description = "SyncML client sdk by Funambol project";
+    homepage = http://www.funambol.com;
+    license = licenses.agpl3;
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/g2o/default.nix b/nixpkgs/pkgs/development/libraries/g2o/default.nix
new file mode 100644
index 000000000000..1486b5bfc55a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/g2o/default.nix
@@ -0,0 +1,24 @@
+{ lib, stdenv, fetchFromGitHub, cmake, eigen, suitesparse }:
+
+stdenv.mkDerivation rec {
+  pname = "g2o";
+  version = "unstable-2019-04-07";
+
+  src = fetchFromGitHub {
+    owner = "RainerKuemmerle";
+    repo = pname;
+    rev = "9b41a4ea5ade8e1250b9c1b279f3a9c098811b5a";
+    sha256 = "1rgrz6zxiinrik3lgwgvsmlww1m2fnpjmvcx1mf62xi1s2ma5w2i";
+  };
+
+  nativeBuildInputs = [ cmake ];
+  buildInputs = [ eigen suitesparse ];
+
+  meta = {
+    description = "A General Framework for Graph Optimization";
+    homepage = "https://github.com/RainerKuemmerle/g2o";
+    license = with lib.licenses; [ bsd3 lgpl3 gpl3 ];
+    maintainers = with lib.maintainers; [ lopsided98 ];
+    platforms = lib.platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gamin/deadlock.patch b/nixpkgs/pkgs/development/libraries/gamin/deadlock.patch
new file mode 100644
index 000000000000..e2abc8ce2d97
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gamin/deadlock.patch
@@ -0,0 +1,68 @@
+Fix for a deadlock:
+https://bugzilla.gnome.org/show_bug.cgi?id=667230
+
+From cc14440eface093548cb3bc7814da11d9a99d283 Mon Sep 17 00:00:00 2001
+From: Anssi Hannula <anssi@mageia.org>
+Date: Wed, 4 Jan 2012 00:23:55 +0200
+Subject: [PATCH] fix possible server deadlock in ih_sub_cancel
+
+ih_sub_foreach() calls ih_sub_cancel() while inotify_lock is locked.
+However, ih_sub_cancel() locks it again, and locking GMutex recursively
+causes undefined behaviour.
+
+Fix that by removing locking from ih_sub_cancel() as ih_sub_foreach()
+is its only user. Also make the function static so that it won't
+accidentally get used by other files without locking (inotify-helper.h
+is an internal server header).
+
+This should fix the intermittent deadlocks I've been experiencing
+causing KDE applications to no longer start, and probably also
+http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=542361
+---
+ server/inotify-helper.c |    7 ++-----
+ server/inotify-helper.h |    1 -
+ 2 files changed, 2 insertions(+), 6 deletions(-)
+
+diff --git a/server/inotify-helper.c b/server/inotify-helper.c
+index d77203e..0789fa4 100644
+--- a/server/inotify-helper.c
++++ b/server/inotify-helper.c
+@@ -123,13 +123,11 @@ ih_sub_add (ih_sub_t * sub)
+ 
+ /**
+  * Cancels a subscription which was being monitored.
++ * inotify_lock must be held when calling.
+  */
+-gboolean
++static gboolean
+ ih_sub_cancel (ih_sub_t * sub)
+ {
+-	G_LOCK(inotify_lock);
+-
+-
+ 	if (!sub->cancelled)
+ 	{
+ 		IH_W("cancelling %s\n", sub->pathname);
+@@ -140,7 +138,6 @@ ih_sub_cancel (ih_sub_t * sub)
+ 		sub_list = g_list_remove (sub_list, sub);
+ 	}
+ 
+-	G_UNLOCK(inotify_lock);
+ 	return TRUE;
+ }
+ 
+diff --git a/server/inotify-helper.h b/server/inotify-helper.h
+index 5d3b6d0..d36b5fd 100644
+--- a/server/inotify-helper.h
++++ b/server/inotify-helper.h
+@@ -34,7 +34,6 @@ gboolean	 ih_startup		(event_callback_t ecb,
+ 					 found_callback_t fcb);
+ gboolean	 ih_running		(void);
+ gboolean	 ih_sub_add		(ih_sub_t *sub);
+-gboolean	 ih_sub_cancel		(ih_sub_t *sub);
+ 
+ /* Return FALSE from 'f' if the subscription should be cancelled */
+ void		 ih_sub_foreach		(void *callerdata, gboolean (*f)(ih_sub_t *sub, void *callerdata));
+-- 
+1.7.7.2
+
diff --git a/nixpkgs/pkgs/development/libraries/gamin/debian-patches.nix b/nixpkgs/pkgs/development/libraries/gamin/debian-patches.nix
new file mode 100644
index 000000000000..a8f334fb3c39
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gamin/debian-patches.nix
@@ -0,0 +1,10 @@
+# Generated by debian-patches.sh from debian-patches.txt
+let
+  prefix = "https://sources.debian.org/data/main/g/gamin/0.1.10-4.1/debian/patches";
+in
+[
+  {
+    url = "${prefix}/17_deprecated_const_return.patch";
+    sha256 = "0bssrqcmyivlpk2g0q71d1yavd4wv1lw34l8qipm0ndljjd6rbrk";
+  }
+]
diff --git a/nixpkgs/pkgs/development/libraries/gamin/debian-patches.txt b/nixpkgs/pkgs/development/libraries/gamin/debian-patches.txt
new file mode 100644
index 000000000000..46d2420b21ed
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gamin/debian-patches.txt
@@ -0,0 +1,2 @@
+gamin/0.1.10-4.1
+17_deprecated_const_return.patch
diff --git a/nixpkgs/pkgs/development/libraries/gamin/default.nix b/nixpkgs/pkgs/development/libraries/gamin/default.nix
new file mode 100644
index 000000000000..4cff22457403
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gamin/default.nix
@@ -0,0 +1,47 @@
+{ stdenv, fetchurl, fetchpatch, python, pkgconfig, glib }:
+
+stdenv.mkDerivation (rec {
+  name = "gamin-0.1.10";
+
+  src = fetchurl {
+    url = "https://www.gnome.org/~veillard/gamin/sources/${name}.tar.gz";
+    sha256 = "18cr51y5qacvs2fc2p1bqv32rs8bzgs6l67zhasyl45yx055y218";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+
+  buildInputs = [ python glib ];
+
+  # `_GNU_SOURCE' is needed, e.g., to get `struct ucred' from
+  # <sys/socket.h> with Glibc 2.9.
+  configureFlags = [
+    "--disable-debug"
+    "--with-python=${python}"
+    "CPPFLAGS=-D_GNU_SOURCE"
+  ];
+
+  patches = [ ./deadlock.patch ]
+    ++ map fetchurl (import ./debian-patches.nix)
+    ++ stdenv.lib.optional stdenv.cc.isClang ./returnval.patch
+    ++ stdenv.lib.optional stdenv.hostPlatform.isMusl (fetchpatch {
+      name = "fix-pthread-mutex.patch";
+      url = "https://git.alpinelinux.org/cgit/aports/plain/main/gamin/fix-pthread-mutex.patch?h=3.4-stable&id=a1a836b089573752c1b0da7d144c0948b04e8ea8";
+      sha256 = "13igdbqsxb3sz0h417k6ifmq2n4siwqspj6slhc7fdl5wd1fxmdz";
+    });
+
+
+  meta = with stdenv.lib; {
+    homepage    = https://people.gnome.org/~veillard/gamin/;
+    description = "A file and directory monitoring system";
+    maintainers = with maintainers; [ lovek323 ];
+    license = licenses.gpl2;
+    platforms   = platforms.unix;
+  };
+}
+
+// stdenv.lib.optionalAttrs stdenv.isDarwin {
+  preBuild =  ''
+    sed -i 's/,--version-script=.*$/\\/' libgamin/Makefile
+  '';
+})
+
diff --git a/nixpkgs/pkgs/development/libraries/gamin/returnval.patch b/nixpkgs/pkgs/development/libraries/gamin/returnval.patch
new file mode 100644
index 000000000000..3944b14be64c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gamin/returnval.patch
@@ -0,0 +1,12 @@
+diff -rupN gamin-0.1.10-orig/server/gam_eq.c gamin-0.1.10/server/gam_eq.c
+--- gamin-0.1.10-orig/server/gam_eq.c	2015-04-05 19:25:54.000000000 -0400
++++ gamin-0.1.10/server/gam_eq.c	2015-04-05 19:26:00.000000000 -0400
+@@ -124,7 +124,7 @@ gam_eq_flush (gam_eq_t *eq, GamConnDataP
+ {
+ 	gboolean done_work = FALSE;
+ 	if (!eq)
+-		return;
++		return done_work;
+ 
+ #ifdef GAM_EQ_VERBOSE
+ 	GAM_DEBUG(DEBUG_INFO, "gam_eq: Flushing event queue for %s\n", gam_connection_get_pidname (conn));
diff --git a/nixpkgs/pkgs/development/libraries/ganv/default.nix b/nixpkgs/pkgs/development/libraries/ganv/default.nix
new file mode 100644
index 000000000000..58356f0bc676
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/ganv/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchgit, graphviz, gtk2, gtkmm2, pkgconfig, python, wafHook }:
+
+stdenv.mkDerivation rec {
+  name = "ganv-unstable-${rev}";
+  rev = "2016-10-15";
+
+  src = fetchgit {
+    url = "http://git.drobilla.net/cgit.cgi/ganv.git";
+    rev = "31685d283e9b811b61014f820c42807f4effa071";
+    sha256 = "0xmbykdl42jn9cgzrqrys5lng67d26nk5xq10wkkvjqldiwdck56";
+  };
+
+  nativeBuildInputs = [ pkgconfig wafHook ];
+  buildInputs = [ graphviz gtk2 gtkmm2 python ];
+
+  meta = with stdenv.lib; {
+    description = "An interactive Gtk canvas widget for graph-based interfaces";
+    homepage = http://drobilla.net;
+    license = licenses.gpl3;
+    maintainers = [ maintainers.goibhniu ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/garmintools/default.nix b/nixpkgs/pkgs/development/libraries/garmintools/default.nix
new file mode 100644
index 000000000000..c1f9c6ad0137
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/garmintools/default.nix
@@ -0,0 +1,15 @@
+{ stdenv, fetchurl, libusb }:
+stdenv.mkDerivation {
+  name = "garmintools-0.10";
+  src = fetchurl {
+    url = "https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/garmintools/garmintools-0.10.tar.gz";
+    sha256 = "1vjc8h0z4kx2h52yc3chxn3wh1krn234fg12sggbia9zjrzhpmgz";
+  };
+  buildInputs = [ libusb ];
+  meta = {
+    homepage = https://code.google.com/archive/p/garmintools/; # community clone at https://github.com/ianmartin/garmintools
+    license = stdenv.lib.licenses.gpl2;
+    maintainers = [ stdenv.lib.maintainers.ocharles ];
+    platforms = stdenv.lib.platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gbenchmark/default.nix b/nixpkgs/pkgs/development/libraries/gbenchmark/default.nix
new file mode 100644
index 000000000000..7e35ed2e5309
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gbenchmark/default.nix
@@ -0,0 +1,31 @@
+{ stdenv, fetchFromGitHub, cmake, gtest }:
+
+stdenv.mkDerivation rec {
+  name = "gbenchmark-${version}";
+  version = "1.5.0";
+
+  src = fetchFromGitHub {
+    owner = "google";
+    repo = "benchmark";
+    rev = "v${version}";
+    sha256 = "0r9dbg4cbk47gwmayys31a83m3y67k0kh1f6pl8i869rbd609ndh";
+  };
+
+  nativeBuildInputs = [ cmake ];
+
+  postPatch = ''
+    cp -r ${gtest.src} googletest
+    chmod -R u+w googletest
+  '';
+
+  enableParallelBuilding = true;
+  doCheck = true;
+
+  meta = with stdenv.lib; {
+    description = "A microbenchmark support library";
+    homepage = https://github.com/google/benchmark;
+    license = licenses.asl20;
+    platforms = platforms.linux ++ platforms.darwin;
+    maintainers = with maintainers; [ abbradar ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gcab/default.nix b/nixpkgs/pkgs/development/libraries/gcab/default.nix
new file mode 100644
index 000000000000..ee5988b30f57
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gcab/default.nix
@@ -0,0 +1,38 @@
+{ stdenv, fetchurl, gettext, gobject-introspection, pkgconfig
+, meson, ninja, glibcLocales, git, vala, glib, zlib, gnome3
+}:
+
+stdenv.mkDerivation rec {
+  pname = "gcab";
+  version = "1.2";
+
+  LC_ALL = "en_US.UTF-8";
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    sha256 = "038h5kk41si2hc9d9169rrlvp8xgsxq27kri7hv2vr39gvz9cbas";
+  };
+
+  nativeBuildInputs = [ meson ninja glibcLocales git pkgconfig vala gettext gobject-introspection ];
+
+  buildInputs = [ glib zlib ];
+
+  mesonFlags = [
+    "-Ddocs=false"
+    "-Dtests=false"
+  ];
+
+  passthru = {
+    updateScript = gnome3.updateScript {
+      packageName = pname;
+      versionPolicy = "none";
+    };
+  };
+
+  meta = with stdenv.lib; {
+    platforms = platforms.linux;
+    license = licenses.lgpl21;
+    homepage = "https://wiki.gnome.org/msitools";
+    maintainers = [ maintainers.lethalman ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gcc/libgcc/default.nix b/nixpkgs/pkgs/development/libraries/gcc/libgcc/default.nix
new file mode 100644
index 000000000000..d638c2bb2788
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gcc/libgcc/default.nix
@@ -0,0 +1,152 @@
+{ stdenvNoLibs, buildPackages
+, gcc, glibc
+, libiberty
+}:
+
+stdenvNoLibs.mkDerivation rec {
+  name = "libgcc-${version}";
+  inherit (gcc.cc) src version;
+
+  outputs = [ "out" "dev" ];
+
+  strictDeps = true;
+  depsBuildBuild = [ buildPackages.stdenv.cc ];
+  nativeBuildInputs = [ libiberty ];
+
+  postUnpack = ''
+    mkdir -p ./build
+    buildRoot=$(readlink -e "./build")
+  '';
+
+  postPatch = ''
+    sourceRoot=$(readlink -e "./libgcc")
+  '';
+
+  preConfigure = ''
+    cd "$buildRoot"
+  ''
+
+  # Drop in libiberty, as external builds are not expected
+  + ''
+    (
+      mkdir -p build-${stdenvNoLibs.buildPlatform.config}/libiberty/
+      cd build-${stdenvNoLibs.buildPlatform.config}/libiberty/
+      ln -s ${buildPackages.libiberty}/lib/libiberty.a ./
+    )
+  ''
+  # A few misc bits of gcc need to be built.
+  #
+  #  - We "shift" the tools over to fake platforms perspective from the previous
+  #    stage.
+  #
+  #  - We define GENERATOR_FILE so nothing bothers looking for GNU GMP.
+  #
+  #  - We remove the `libgcc.mvar` deps so that the bootstrap xgcc isn't built.
+  + ''
+    mkdir -p "$buildRoot/gcc"
+    cd "$buildRoot/gcc"
+    (
+      export AS_FOR_BUILD=${buildPackages.stdenv.cc}/bin/$AS_FOR_BUILD
+      export CC_FOR_BUILD=${buildPackages.stdenv.cc}/bin/$CC_FOR_BUILD
+      export CPP_FOR_BUILD=${buildPackages.stdenv.cc}/bin/$CPP_FOR_BUILD
+      export CXX_FOR_BUILD=${buildPackages.stdenv.cc}/bin/$CXX_FOR_BUILD
+      export LD_FOR_BUILD=${buildPackages.stdenv.cc.bintools}/bin/$LD_FOR_BUILD
+
+      export AS=$AS_FOR_BUILD
+      export CC=$CC_FOR_BUILD
+      export CPP=$CPP_FOR_BUILD
+      export CXX=$CXX_FOR_BUILD
+      export LD=$LD_FOR_BUILD
+
+      export AS_FOR_TARGET=${stdenvNoLibs.cc}/bin/$AS
+      export CC_FOR_TARGET=${stdenvNoLibs.cc}/bin/$CC
+      export CPP_FOR_TARGET=${stdenvNoLibs.cc}/bin/$CPP
+      export LD_FOR_TARGET=${stdenvNoLibs.cc.bintools}/bin/$LD
+
+      export NIX_BUILD_CFLAGS_COMPILE+=' -DGENERATOR_FILE=1'
+
+      "$sourceRoot/../gcc/configure" $gccConfigureFlags
+
+      sed -e 's,libgcc.mvars:.*$,libgcc.mvars:,' -i Makefile
+
+      make \
+        config.h \
+        libgcc.mvars \
+        tconfig.h \
+        tm.h \
+        options.h \
+        insn-constants.h \
+        insn-modes.h \
+        gcov-iov.h
+    )
+    mkdir -p "$buildRoot/gcc/include"
+  ''
+  # Preparing to configure + build libgcc itself
+  + ''
+    mkdir -p "$buildRoot/gcc/${stdenvNoLibs.hostPlatform.config}/libgcc"
+    cd "$buildRoot/gcc/${stdenvNoLibs.hostPlatform.config}/libgcc"
+    configureScript=$sourceRoot/configure
+    chmod +x "$configureScript"
+
+    export AS_FOR_BUILD=${buildPackages.stdenv.cc}/bin/$AS_FOR_BUILD
+    export CC_FOR_BUILD=${buildPackages.stdenv.cc}/bin/$CC_FOR_BUILD
+    export CPP_FOR_BUILD=${buildPackages.stdenv.cc}/bin/$CPP_FOR_BUILD
+    export CXX_FOR_BUILD=${buildPackages.stdenv.cc}/bin/$CXX_FOR_BUILD
+    export LD_FOR_BUILD=${buildPackages.stdenv.cc.bintools}/bin/$LD_FOR_BUILD
+
+    export AS=${stdenvNoLibs.cc}/bin/$AS
+    export CC=${stdenvNoLibs.cc}/bin/$CC
+    export CPP=${stdenvNoLibs.cc}/bin/$CPP
+    export CXX=${stdenvNoLibs.cc}/bin/$CXX
+    export LD=${stdenvNoLibs.cc.bintools}/bin/$LD
+
+    export AS_FOR_TARGET=${stdenvNoLibs.cc}/bin/$AS_FOR_TARGET
+    export CC_FOR_TARGET=${stdenvNoLibs.cc}/bin/$CC_FOR_TARGET
+    export CPP_FOR_TARGET=${stdenvNoLibs.cc}/bin/$CPP_FOR_TARGET
+    export LD_FOR_TARGET=${stdenvNoLibs.cc.bintools}/bin/$LD_FOR_TARGET
+  '';
+
+  gccConfigureFlags = [
+    "--build=${stdenvNoLibs.buildPlatform.config}"
+    "--host=${stdenvNoLibs.buildPlatform.config}"
+    "--target=${stdenvNoLibs.hostPlatform.config}"
+
+    "--disable-bootstrap"
+    "--disable-multilib" "--with-multilib-list="
+    "--enable-languages=c"
+
+    "--disable-fixincludes"
+    "--disable-intl"
+    "--disable-lto"
+    "--disable-libatomic"
+    "--disable-libbacktrace"
+    "--disable-libcpp"
+    "--disable-libssp"
+    "--disable-libquadmath"
+    "--disable-libgomp"
+    "--disable-libvtv"
+    "--disable-vtable-verify"
+
+    "--with-system-zlib"
+  ] ++ stdenvNoLibs.lib.optional (stdenvNoLibs.hostPlatform.libc == "glibc")
+       "--with-glibc-version=${glibc.version}";
+
+  configurePlatforms = [ "build" "host" ];
+  configureFlags = [
+    "--disable-dependency-tracking"
+    # $CC cannot link binaries, let alone run then
+    "cross_compiling=true"
+    # Do not have dynamic linker without libc
+    "--enable-static"
+    "--disable-shared"
+  ];
+
+  makeFlags = [ "MULTIBUILDTOP:=../" ];
+
+  postInstall = ''
+    moveToOutput "lib/gcc/${stdenvNoLibs.hostPlatform.config}/${version}/include" "$dev"
+    mkdir -p "$out/lib" "$dev/include"
+    ln -s "$out/lib/gcc/${stdenvNoLibs.hostPlatform.config}/${version}"/* "$out/lib"
+    ln -s "$dev/lib/gcc/${stdenvNoLibs.hostPlatform.config}/${version}/include"/* "$dev/include/"
+  '';
+}
diff --git a/nixpkgs/pkgs/development/libraries/gcc/libstdc++/5.nix b/nixpkgs/pkgs/development/libraries/gcc/libstdc++/5.nix
new file mode 100644
index 000000000000..4762d1fb119f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gcc/libstdc++/5.nix
@@ -0,0 +1,117 @@
+{ stdenv, fetchurl, fetchpatch, flex, bison, file }:
+
+stdenv.mkDerivation rec {
+  name = "libstdc++5-${version}";
+  version = "3.3.6";
+
+  src = [
+    (fetchurl {
+      url = "mirror://gcc/releases/gcc-${version}/gcc-core-${version}.tar.bz2";
+      sha256 = "1dpyrpsgakilz2rnh5f8gvrzq5pwzvndacc0df6m04bpqn5fx6sg";
+    })
+    (fetchurl {
+      url = "mirror://gcc/releases/gcc-${version}/gcc-g++-${version}.tar.bz2";
+      sha256 = "14lxl81f7adpc9jxfiwzdxsdzs5zv4piv8xh7f9w910hfzrgvsby";
+    })
+  ];
+
+  patches = [
+    ./no-sys-dirs.patch
+    (fetchpatch {
+      name = "siginfo.patch";
+      url = "https://git.archlinux.org/svntogit/packages.git/plain/trunk/siginfo.patch?h=packages/libstdc%2B%2B5&id=e36ee8ed9bb5942db14cf6249a2ead14974a2bfa";
+      sha256 = "15zldbm33yba293dgrgsbv3j332hkc3iqpyc8fa7zl42mh9qk22j";
+      extraPrefix = "";
+    })
+    (fetchpatch {
+      name = "gcc-3.4.3-no_multilib_amd64.patch";
+      url = "https://git.archlinux.org/svntogit/packages.git/plain/trunk/gcc-3.4.3-no_multilib_amd64.patch?h=packages/libstdc%2B%2B5&id=e36ee8ed9bb5942db14cf6249a2ead14974a2bfa";
+      sha256 = "11m5lc51b0addhc4yq4rz0dwpv6k73rrj73wya3lqdk8rly6cjpm";
+      extraPrefix = "";
+    })
+    # Required because of glibc 2.26
+    ./struct-ucontext.patch
+  ];
+
+  postPatch = ''
+    # fix build issue with recent gcc
+    sed -i "s#O_CREAT#O_CREAT, 0666#" gcc/collect2.c
+
+    # No fixincludes
+    sed -i -e 's@\./fixinc\.sh@-c true@' gcc/Makefile.in
+  '';
+
+  preConfigure = ''
+    mkdir ../build
+    cd ../build
+    configureScript=../$sourceRoot/configure
+  '';
+
+  preBuild = ''
+    # libstdc++ needs this; otherwise it will use /lib/cpp, which is a Bad
+    # Thing.
+    export CPP="gcc -E"
+
+    # Use *real* header files, otherwise a limits.h is generated
+    # that does not include Glibc's limits.h (notably missing
+    # SSIZE_MAX, which breaks the build).
+    export NIX_FIXINC_DUMMY="$(cat $NIX_CC/nix-support/orig-libc-dev)/include"
+
+    # The path to the Glibc binaries such as `crti.o'.
+    glibc_libdir="$(cat $NIX_CC/nix-support/orig-libc)/lib"
+
+    # Figure out what extra flags to pass to the gcc compilers
+    # being generated to make sure that they use our glibc.
+    EXTRA_FLAGS="-I$NIX_FIXINC_DUMMY $(cat $NIX_CC/nix-support/libc-cflags) -O2"
+
+    extraLDFlags="-L$glibc_libdir -rpath $glibc_libdir $(cat $NIX_BINTOOLS/nix-support/libc-ldflags) $(cat $NIX_BINTOOLS/nix-support/libc-ldflags-before)"
+    for i in $extraLDFlags; do
+      EXTRA_FLAGS="$EXTRA_FLAGS -Wl,$i"
+    done
+
+    # CFLAGS_FOR_TARGET are needed for the libstdc++ configure script to find
+    # the startfiles.
+    # FLAGS_FOR_TARGET are needed for the target libraries to receive the -Bxxx
+    # for the startfiles.
+    makeFlagsArray=( \
+      "''${makeFlagsArray[@]}" \
+      NATIVE_SYSTEM_HEADER_DIR="$NIX_FIXINC_DUMMY" \
+      SYSTEM_HEADER_DIR="$NIX_FIXINC_DUMMY" \
+      CFLAGS_FOR_BUILD="$EXTRA_FLAGS" \
+      CFLAGS_FOR_TARGET="$EXTRA_FLAGS" \
+      CXXFLAGS_FOR_BUILD="$EXTRA_FLAGS" \
+      CXXFLAGS_FOR_TARGET="$EXTRA_FLAGS" \
+      FLAGS_FOR_TARGET="$EXTRA_FLAGS" \
+      LDFLAGS_FOR_BUILD="$EXTRA_FLAGS" \
+      LDFLAGS_FOR_TARGET="$EXTRA_FLAGS" \
+      BOOT_CFLAGS="$EXTRA_FLAGS" \
+      BOOT_LDFLAGS="$EXTRA_FLAGS"
+      )
+  '';
+
+  hardeningDisable = [ "format" ];
+
+  nativeBuildInputs = [ flex bison file ];
+
+  configureFlags = [ "--disable-multilib" "--enable-__cxa-atexit" "--enable-threads=posix" "--enable-languages=c++" "--enable-clocale=gnu" ];
+
+  buildFLags = [ "all-target-libstdc++-v3" ];
+
+  installFlags = [ "install-target-libstdc++-v3" ];
+
+  postInstall = ''
+    # Remove includefiles and libs provided by gcc
+    shopt -s extglob
+    rm -rf $out/{bin,include,share,man,info}
+    rm -f $out/lib/*.a
+    rm -rf $out/lib/!(libstdc++*)
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = https://gcc.gnu.org/;
+    license = licenses.lgpl3Plus;
+    description = "GNU Compiler Collection, version ${version} -- C++ standard library";
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ abbradar ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gcc/libstdc++/no-sys-dirs.patch b/nixpkgs/pkgs/development/libraries/gcc/libstdc++/no-sys-dirs.patch
new file mode 100644
index 000000000000..8c91d75f2a53
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gcc/libstdc++/no-sys-dirs.patch
@@ -0,0 +1,53 @@
+diff -ru3 gcc-3.3.6-old/gcc/cppdefault.c gcc-3.3.6/gcc/cppdefault.c
+--- gcc-3.3.6-old/gcc/cppdefault.c	2003-11-07 02:13:31.000000000 +0300
++++ gcc-3.3.6/gcc/cppdefault.c	2016-09-02 16:00:03.492484016 +0300
+@@ -26,6 +26,10 @@
+ #include "system.h"
+ #include "cppdefault.h"
+ 
++#undef LOCAL_INCLUDE_DIR
++#undef SYSTEM_INCLUDE_DIR
++#undef STANDARD_INCLUDE_DIR
++
+ const struct default_include cpp_include_defaults[]
+ #ifdef INCLUDE_DEFAULTS
+ = INCLUDE_DEFAULTS;
+diff -ru3 gcc-3.3.6-old/gcc/gcc.c gcc-3.3.6/gcc/gcc.c
+--- gcc-3.3.6-old/gcc/gcc.c	2004-04-01 20:55:17.000000000 +0400
++++ gcc-3.3.6/gcc/gcc.c	2016-09-02 16:01:24.843520114 +0300
+@@ -6130,10 +6130,6 @@
+ 		      NULL, PREFIX_PRIORITY_LAST, 0, NULL, 1);
+ 	}
+ 
+-      add_sysrooted_prefix (&startfile_prefixes, standard_startfile_prefix_1,
+-			    "BINUTILS", PREFIX_PRIORITY_LAST, 0, NULL, 1);
+-      add_sysrooted_prefix (&startfile_prefixes, standard_startfile_prefix_2,
+-			    "BINUTILS", PREFIX_PRIORITY_LAST, 0, NULL, 1);
+ #if 0 /* Can cause surprises, and one can use -B./ instead.  */
+       add_prefix (&startfile_prefixes, "./", NULL,
+ 		  PREFIX_PRIORITY_LAST, 1, NULL, 0);
+diff -ru3 gcc-3.3.6-old/gcc/Makefile.in gcc-3.3.6/gcc/Makefile.in
+--- gcc-3.3.6-old/gcc/Makefile.in	2004-04-01 20:55:23.000000000 +0400
++++ gcc-3.3.6/gcc/Makefile.in	2016-09-02 16:00:03.493484017 +0300
+@@ -260,7 +260,11 @@
+ PARTITION_H = $(srcdir)/../include/partition.h
+ 
+ # Default native SYSTEM_HEADER_DIR, to be overridden by targets.
+-NATIVE_SYSTEM_HEADER_DIR = /usr/include
++# Nix: we override NATIVE_SYSTEM_HEADER_DIR in order to prevent
++# `fixinc' from fixing header files in /usr/include.  However,
++# NATIVE_SYSTEM_HEADER_DIR must point to an existing directory, so set
++# it to some dummy directory.
++NATIVE_SYSTEM_HEADER_DIR = $(NIX_FIXINC_DUMMY)
+ # Default cross SYSTEM_HEADER_DIR, to be overridden by targets.
+ CROSS_SYSTEM_HEADER_DIR = @CROSS_SYSTEM_HEADER_DIR@
+ 
+@@ -2201,7 +2205,7 @@
+   -DGPLUSPLUS_INCLUDE_DIR=\"$(gcc_gxx_include_dir)\" \
+   -DGPLUSPLUS_TOOL_INCLUDE_DIR=\"$(gcc_gxx_include_dir)/$(target_alias)\" \
+   -DGPLUSPLUS_BACKWARD_INCLUDE_DIR=\"$(gcc_gxx_include_dir)/backward\" \
+-  -DLOCAL_INCLUDE_DIR=\"$(local_includedir)\" \
++  -DLOCAL_INCLUDE_DIR=\"/no-such-dir\" \
+   -DCROSS_INCLUDE_DIR=\"$(CROSS_SYSTEM_HEADER_DIR)\" \
+   -DTOOL_INCLUDE_DIR=\"$(gcc_tooldir)/include\" \
+   @TARGET_SYSTEM_ROOT_DEFINE@
diff --git a/nixpkgs/pkgs/development/libraries/gcc/libstdc++/struct-ucontext.patch b/nixpkgs/pkgs/development/libraries/gcc/libstdc++/struct-ucontext.patch
new file mode 100644
index 000000000000..5462e0e33ecd
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gcc/libstdc++/struct-ucontext.patch
@@ -0,0 +1,61 @@
+diff --git a/gcc/config/alpha/linux.h b/gcc/config/alpha/linux.h
+index 3a2940c..67f9899 100644
+--- a/gcc/config/alpha/linux.h
++++ b/gcc/config/alpha/linux.h
+@@ -89,7 +89,7 @@ Boston, MA 02111-1307, USA.  */
+       {									\
+ 	struct rt_sigframe {						\
+ 	  struct siginfo info;						\
+-	  struct ucontext uc;						\
++	  ucontext_t uc;						\
+ 	} *rt_ = (CONTEXT)->cfa;					\
+ 	sc_ = &rt_->uc.uc_mcontext;					\
+       }									\
+diff --git a/gcc/config/i386/linux.h b/gcc/config/i386/linux.h
+index e86ab3d..30797a7 100644
+--- a/gcc/config/i386/linux.h
++++ b/gcc/config/i386/linux.h
+@@ -260,7 +260,7 @@ Boston, MA 02111-1307, USA.  */
+ 	  siginfo_t *pinfo;					\
+ 	  void *puc;							\
+ 	  siginfo_t info;						\
+-	  struct ucontext uc;						\
++	  ucontext_t uc;						\
+ 	} *rt_ = (CONTEXT)->cfa;					\
+ 	sc_ = (struct sigcontext *) &rt_->uc.uc_mcontext;		\
+       }									\
+diff --git a/gcc/config/i386/linux64.h b/gcc/config/i386/linux64.h
+index fbfaa58..200c8dc 100644
+--- a/gcc/config/i386/linux64.h
++++ b/gcc/config/i386/linux64.h
+@@ -112,7 +112,7 @@ Boston, MA 02111-1307, USA.  */
+     if (*(unsigned char *)(pc_+0) == 0x48				\
+ 	&& *(unsigned long *)(pc_+1) == 0x050f0000000fc0c7)		\
+       {									\
+-	struct ucontext *uc_ = (CONTEXT)->cfa;				\
++	ucontext_t *uc_ = (CONTEXT)->cfa;				\
+ 	sc_ = (struct sigcontext *) &uc_->uc_mcontext;			\
+       }									\
+     else								\
+@@ -182,7 +182,7 @@ Boston, MA 02111-1307, USA.  */
+ 	  struct siginfo *pinfo;					\
+ 	  void *puc;							\
+ 	  struct siginfo info;						\
+-	  struct ucontext uc;						\
++	  ucontext_t uc;						\
+ 	} *rt_ = (CONTEXT)->cfa;					\
+ 	sc_ = (struct sigcontext *) &rt_->uc.uc_mcontext;		\
+       }									\
+diff --git a/gcc/config/rs6000/linux.h b/gcc/config/rs6000/linux.h
+index ba70ec1..0fff8b1 100644
+--- a/gcc/config/rs6000/linux.h
++++ b/gcc/config/rs6000/linux.h
+@@ -101,7 +101,7 @@ Boston, MA 02111-1307, USA.  */
+ 
+ struct kernel_old_ucontext {
+   unsigned long     uc_flags;
+-  struct ucontext  *uc_link;
++  ucontext_t       *uc_link;
+   stack_t           uc_stack;
+   struct sigcontext_struct uc_mcontext;
+   sigset_t          uc_sigmask;
diff --git a/nixpkgs/pkgs/development/libraries/gcr/default.nix b/nixpkgs/pkgs/development/libraries/gcr/default.nix
new file mode 100644
index 000000000000..693fda99759c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gcr/default.nix
@@ -0,0 +1,49 @@
+{ stdenv, fetchurl, pkgconfig, intltool, gnupg, p11-kit, glib
+, libgcrypt, libtasn1, dbus-glib, gtk3, pango, gdk_pixbuf, atk
+, gobject-introspection, makeWrapper, libxslt, vala, gnome3
+, python2 }:
+
+stdenv.mkDerivation rec {
+  pname = "gcr";
+  version = "3.28.1";
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    sha256 = "12qn7mcmxb45lz1gq3s3b34rimiyrrshkrpvxdw1fc0w26i4l84m";
+  };
+
+  passthru = {
+    updateScript = gnome3.updateScript { packageName = pname; };
+  };
+
+  postPatch = ''
+    patchShebangs .
+  '';
+
+  outputs = [ "out" "dev" ];
+
+  nativeBuildInputs = [ pkgconfig intltool gobject-introspection libxslt makeWrapper vala ];
+
+  buildInputs = let
+    gpg = gnupg.override { guiSupport = false; }; # prevent build cycle with pinentry_gnome
+  in [
+    gpg libgcrypt libtasn1 dbus-glib pango gdk_pixbuf atk
+  ];
+
+  propagatedBuildInputs = [ glib gtk3 p11-kit ];
+
+  checkInputs = [ python2 ];
+  doCheck = false; # fails 21 out of 603 tests, needs dbus daemon
+
+  #enableParallelBuilding = true; issues on hydra
+
+  preFixup = ''
+    wrapProgram "$out/bin/gcr-viewer" \
+      --prefix XDG_DATA_DIRS : "$GSETTINGS_SCHEMAS_PATH"
+  '';
+
+  meta = with stdenv.lib; {
+    platforms = platforms.linux;
+    maintainers = gnome3.maintainers;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gd/default.nix b/nixpkgs/pkgs/development/libraries/gd/default.nix
new file mode 100644
index 000000000000..5ceded0546c5
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gd/default.nix
@@ -0,0 +1,46 @@
+{ stdenv, fetchurl
+, pkgconfig
+, zlib
+, libpng
+, libjpeg ? null
+, libwebp ? null
+, libtiff ? null
+, libXpm ? null
+, fontconfig
+, freetype
+}:
+
+stdenv.mkDerivation rec {
+  name = "gd-${version}";
+  version = "2.2.5";
+
+  src = fetchurl {
+    url = "https://github.com/libgd/libgd/releases/download/${name}/libgd-${version}.tar.xz";
+    sha256 = "0lfy5f241sbv8s3splm2zqiaxv7lxrcshh875xryryk7yk5jqc4c";
+  };
+
+  hardeningDisable = [ "format" ];
+
+  # -pthread gets passed to clang, causing warnings
+  configureFlags = stdenv.lib.optional stdenv.isDarwin "--enable-werror=no";
+
+  nativeBuildInputs = [ pkgconfig ];
+
+  buildInputs = [ zlib fontconfig freetype ];
+  propagatedBuildInputs = [ libpng libjpeg libwebp libtiff libXpm ];
+
+  outputs = [ "bin" "dev" "out" ];
+
+  postFixup = ''moveToOutput "bin/gdlib-config" $dev'';
+
+  enableParallelBuilding = true;
+
+  doCheck = false; # fails 2 tests
+
+  meta = with stdenv.lib; {
+    homepage = https://libgd.github.io/;
+    description = "A dynamic image creation library";
+    license = licenses.free; # some custom license
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gdal/default.nix b/nixpkgs/pkgs/development/libraries/gdal/default.nix
new file mode 100644
index 000000000000..e7ffdde6cb1c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gdal/default.nix
@@ -0,0 +1,96 @@
+{ stdenv, fetchurl, fetchpatch, unzip, libjpeg, libtiff, zlib
+, postgresql, mysql, libgeotiff, pythonPackages, proj, geos, openssl
+, libpng, sqlite, libspatialite, poppler, hdf4, qhull, giflib, expat
+, libiconv, libxml2
+, netcdfSupport ? true, netcdf, hdf5, curl
+}:
+
+with stdenv.lib;
+
+stdenv.mkDerivation rec {
+  name = "gdal-${version}";
+  version = "2.4.0";
+
+  src = fetchurl {
+    url = "https://download.osgeo.org/gdal/${version}/${name}.tar.xz";
+    sha256 = "09qgy36z0jc9w05373m4n0vm4j54almdzql6z9p9zr9pdp61syf3";
+  };
+
+  buildInputs = [ unzip libjpeg libtiff libpng proj openssl sqlite
+    libspatialite poppler hdf4 qhull giflib expat libxml2 ]
+  ++ (with pythonPackages; [ python numpy wrapPython ])
+  ++ stdenv.lib.optional stdenv.isDarwin libiconv
+  ++ stdenv.lib.optionals netcdfSupport [ netcdf hdf5 curl ];
+
+  configureFlags = [
+    "--with-expat=${expat.dev}"
+    "--with-jpeg=${libjpeg.dev}"
+    "--with-libtiff=${libtiff.dev}" # optional (without largetiff support)
+    "--with-png=${libpng.dev}"      # optional
+    "--with-poppler=${poppler.dev}" # optional
+    "--with-libz=${zlib.dev}"       # optional
+    "--with-pg=${postgresql}/bin/pg_config"
+    "--with-mysql=${mysql.connector-c or mysql}/bin/mysql_config"
+    "--with-geotiff=${libgeotiff}"
+    "--with-sqlite3=${sqlite.dev}"
+    "--with-spatialite=${libspatialite}"
+    "--with-python"               # optional
+    "--with-proj=${proj}" # optional
+    "--with-geos=${geos}/bin/geos-config"# optional
+    "--with-hdf4=${hdf4.dev}" # optional
+    "--with-xml2=${libxml2.dev}/bin/xml2-config" # optional
+    (if netcdfSupport then "--with-netcdf=${netcdf}" else "")
+  ];
+
+  hardeningDisable = [ "format" ];
+
+  CXXFLAGS = "-fpermissive";
+
+  postPatch = ''
+    sed -i '/ifdef bool/i\
+      #ifdef swap\
+      #undef swap\
+      #endif' ogr/ogrsf_frmts/mysql/ogr_mysql.h
+
+    # poppler 0.73.0 support
+    patch -lp2 <${
+      fetchpatch {
+        url = "https://github.com/OSGeo/gdal/commit/29f4dfbcac2de718043f862166cd639ab578b552.diff";
+        sha256 = "1h2rsjjrgwqfgqzppmzv5jgjs1dbbg8pvfmay0j9y0618qp3r734";
+      }
+    } || true
+    patch -p2 <${
+      fetchpatch {
+        url = "https://github.com/OSGeo/gdal/commit/19967e682738977e11e1d0336e0178882c39cad2.diff";
+        sha256 = "12yqd77226i6xvzgqmxiac5ghdinixh8k2crg1r2gnhc0xlc3arj";
+      }
+    }
+  '';
+
+  # - Unset CC and CXX as they confuse libtool.
+  # - teach gdal that libdf is the legacy name for libhdf
+  preConfigure = ''
+      unset CC CXX
+      substituteInPlace configure \
+      --replace "-lmfhdf -ldf" "-lmfhdf -lhdf"
+    '';
+
+  preBuild = ''
+    substituteInPlace swig/python/GNUmakefile \
+      --replace "ifeq (\$(STD_UNIX_LAYOUT),\"TRUE\")" "ifeq (1,1)"
+  '';
+
+  postInstall = ''
+    wrapPythonPrograms
+  '';
+
+  enableParallelBuilding = true;
+
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gdal/gdal-1_11.nix b/nixpkgs/pkgs/development/libraries/gdal/gdal-1_11.nix
new file mode 100644
index 000000000000..32101221e64c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gdal/gdal-1_11.nix
@@ -0,0 +1,63 @@
+{ stdenv, fetchurl, unzip, libjpeg, libtiff, zlib
+, postgresql, mysql57, libgeotiff, python, pythonPackages, proj, geos, openssl
+, libpng }:
+
+stdenv.mkDerivation rec {
+  name = "gdal-${version}";
+  version = "1.11.5";
+
+  src = fetchurl {
+    url = "https://download.osgeo.org/gdal/${version}/${name}.tar.xz";
+    sha256 = "0hphxzvy23v3vqxx1y22hhhg4cypihrb8555y12nb4mrhzlw7zfl";
+  };
+
+  buildInputs = [ unzip libjpeg libtiff libpng python pythonPackages.numpy proj openssl ];
+
+  patches = [
+    # This ensures that the python package is installed into gdal's prefix,
+    # rather than trying to install into python's prefix.
+    ./python.patch
+  ];
+
+  hardeningDisable = [ "format" "fortify" ];
+
+  # Don't use optimization for gcc >= 4.3. That's said to be causing segfaults.
+  # Unset CC and CXX as they confuse libtool.
+  preConfigure = "export CFLAGS=-O0 CXXFLAGS=-O0; unset CC CXX";
+
+  configureFlags = [
+    "--with-jpeg=${libjpeg.dev}"
+    "--with-libtiff=${libtiff.dev}" # optional (without largetiff support)
+    "--with-libpng=${libpng.dev}"   # optional
+    "--with-libz=${zlib.dev}"       # optional
+
+    "--with-pg=${postgresql}/bin/pg_config"
+    "--with-mysql=${mysql57.connector-c}/bin/mysql_config"
+    "--with-geotiff=${libgeotiff}"
+    "--with-python"               # optional
+    "--with-static-proj4=${proj}" # optional
+    "--with-geos=${geos}/bin/geos-config"# optional
+  ];
+
+  # Prevent this:
+  #
+  #   Checking .pth file support in /nix/store/xkrmb8xnvqxzjwsdmasqmsdh1a5y2y99-gdal-1.11.2/lib/python2.7/site-packages/
+  #   /nix/store/pbi1lgank10fy0xpjckbdpgacqw34dsz-python-2.7.9/bin/python -E -c pass
+  #   TEST FAILED: /nix/store/xkrmb8xnvqxzjwsdmasqmsdh1a5y2y99-gdal-1.11.2/lib/python2.7/site-packages/ does NOT support .pth files
+  #   error: bad install directory or PYTHONPATH
+  preBuild = ''
+    pythonInstallDir=$out/lib/${python.libPrefix}/site-packages
+    mkdir -p $pythonInstallDir
+    export PYTHONPATH=''${PYTHONPATH:+''${PYTHONPATH}:}$pythonInstallDir
+  '';
+
+  enableParallelBuilding = true;
+
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gdal/python.patch b/nixpkgs/pkgs/development/libraries/gdal/python.patch
new file mode 100644
index 000000000000..50504c62eddb
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gdal/python.patch
@@ -0,0 +1,17 @@
+diff --git a/swig/python/GNUmakefile.old b/swig/python/GNUmakefile
+index b4d5e90..2160b83 100644
+--- a/swig/python/GNUmakefile
++++ b/swig/python/GNUmakefile
+@@ -67,11 +67,7 @@ egg:
+ 	
+ install:
+ 
+-ifeq ($(PY_HAVE_SETUPTOOLS),1)
+-	$(PYTHON) setup.py install 
+-else
+ 	$(PYTHON) setup.py install --prefix=$(DESTDIR)$(prefix)
+-endif
+ 
+ 	for f in $(SCRIPTS) ; do $(INSTALL) ./scripts/$$f $(DESTDIR)$(INST_BIN) ; done
+ 
+
diff --git a/nixpkgs/pkgs/development/libraries/gdata-sharp/default.nix b/nixpkgs/pkgs/development/libraries/gdata-sharp/default.nix
new file mode 100644
index 000000000000..a9b79dac7b88
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gdata-sharp/default.nix
@@ -0,0 +1,41 @@
+{ stdenv, fetchsvn, pkgconfig, mono, dotnetPackages }:
+
+let
+  newtonsoft-json = dotnetPackages.NewtonsoftJson;
+in stdenv.mkDerivation rec {
+  name = "gdata-sharp-${version}";
+  version = "2.2.0.0";
+
+  src = fetchsvn {
+    url = "http://google-gdata.googlecode.com/svn/trunk/";
+    rev = "1217";
+    sha256 = "0b0rvgg3xsbbg2fdrpz0ywsy9rcahlyfskndaagd3yzm83gi6bhk";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ mono newtonsoft-json ];
+
+  sourceRoot = "svn-r1217/clients/cs";
+
+  dontStrip = true;
+
+  postPatch = ''
+    sed -i -e 's#^\(DEFINES=.*\)\(.\)#\1 /r:third_party/Newtonsoft.Json.dll\2#' Makefile
+    #             carriage return ^
+  '';
+
+  makeFlags = [ "PREFIX=$(out)" ];
+
+  meta = with stdenv.lib; {
+    homepage = https://code.google.com/archive/p/google-gdata/;
+
+    description = "The Google Data APIs";
+    longDescription = ''
+      The Google Data APIs provide a simple protocol for reading and writing
+      data on the web.
+    '';
+
+    license = licenses.asl20;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gdbm/default.nix b/nixpkgs/pkgs/development/libraries/gdbm/default.nix
new file mode 100644
index 000000000000..972e9022235a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gdbm/default.nix
@@ -0,0 +1,70 @@
+{ stdenv, lib, fetchurl }:
+
+stdenv.mkDerivation rec {
+  pname = "gdbm";
+  version = "1.18.1";
+
+  # FIXME: remove on update to > 1.18.1
+  NIX_CFLAGS_COMPILE = if stdenv.cc.isClang then "-Wno-error=return-type" else null;
+
+  src = fetchurl {
+    url = "mirror://gnu/gdbm/${pname}-${version}.tar.gz";
+    sha256 = "1p4ibds6z3ccy65lkmd6lm7js0kwifvl53r0fd759fjxgr917rl6";
+  };
+
+  doCheck = true; # not cross;
+
+  # Linking static stubs on cygwin requires correct ordering.
+  # Consider upstreaming this.
+
+  # Disable dbmfetch03.at test because it depends on unlink()
+  # failing on a link in a chmod -w directory, which cygwin
+  # apparently allows.
+  postPatch = lib.optionalString stdenv.buildPlatform.isCygwin ''
+      substituteInPlace tests/Makefile.in --replace \
+        '_LDADD = ../src/libgdbm.la ../compat/libgdbm_compat.la' \
+        '_LDADD = ../compat/libgdbm_compat.la ../src/libgdbm.la'
+      substituteInPlace tests/testsuite.at --replace \
+        'm4_include([dbmfetch03.at])' ""
+  '';
+
+  enableParallelBuilding = true;
+  configureFlags = [ "--enable-libgdbm-compat" ];
+
+  # create symlinks for compatibility
+  postInstall = ''
+    install -dm755 $out/include/gdbm
+    (
+      cd $out/include/gdbm
+      ln -s ../gdbm.h gdbm.h
+      ln -s ../ndbm.h ndbm.h
+      ln -s ../dbm.h  dbm.h
+    )
+  '';
+
+  meta = with lib; {
+    description = "GNU dbm key/value database library";
+    longDescription = ''
+       GNU dbm (or GDBM, for short) is a library of database functions that
+       use extensible hashing and work similar to the standard UNIX dbm.
+       These routines are provided to a programmer needing to create and
+       manipulate a hashed database.
+
+       The basic use of GDBM is to store key/data pairs in a data file.
+       Each key must be unique and each key is paired with only one data
+       item.
+
+       The library provides primitives for storing key/data pairs,
+       searching and retrieving the data by its key and deleting a key
+       along with its data.  It also support sequential iteration over all
+       key/data pairs in a database.
+
+       For compatibility with programs using old UNIX dbm function, the
+       package also provides traditional dbm and ndbm interfaces.
+      '';
+    homepage = https://www.gnu.org/software/gdbm/;
+    license = licenses.gpl3Plus;
+    platforms = platforms.all;
+    maintainers = [ maintainers.vrthra ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gdcm/default.nix b/nixpkgs/pkgs/development/libraries/gdcm/default.nix
new file mode 100644
index 000000000000..fca567d683dd
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gdcm/default.nix
@@ -0,0 +1,40 @@
+{ stdenv, fetchurl, cmake, vtk }:
+
+stdenv.mkDerivation rec {
+  version = "3.0.0";
+  name = "gdcm-${version}";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/gdcm/${name}.tar.bz2";
+    sha256 = "1rhblnl0q4bl3hmanz4ckv5kzdrzdiqp9xlcqh8df3rfrgk4d81x";
+  };
+
+  dontUseCmakeBuildDir = true;
+  preConfigure = ''
+    cmakeDir=$PWD
+    mkdir ../build
+    cd ../build
+  '';
+
+  cmakeFlags = ''
+    -DGDCM_BUILD_APPLICATIONS=ON
+    -DGDCM_BUILD_SHARED_LIBS=ON
+    -DGDCM_USE_VTK=ON
+  '';
+
+  enableParallelBuilding = true;
+  buildInputs = [ cmake vtk ];
+  propagatedBuildInputs = [ ];
+
+  meta = with stdenv.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.
+      GDCM includes a file format definition and a network communications protocol, both of which should be extended to provide a full set of tools for a researcher or small medical imaging vendor to interface with an existing medical database.
+    '';
+    homepage = http://gdcm.sourceforge.net/;
+    license = with licenses; [ bsd3 asl20 ];
+    platforms = platforms.all;
+  };
+}
+
diff --git a/nixpkgs/pkgs/development/libraries/gdk-pixbuf/default.nix b/nixpkgs/pkgs/development/libraries/gdk-pixbuf/default.nix
new file mode 100644
index 000000000000..d98d9e8107e9
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gdk-pixbuf/default.nix
@@ -0,0 +1,100 @@
+{ stdenv, fetchurl, fetchpatch, fixDarwinDylibNames, meson, ninja, pkgconfig, gettext, python3, libxml2, libxslt, docbook_xsl
+, docbook_xml_dtd_43, gtk-doc, glib, libtiff, libjpeg, libpng, libX11, gnome3
+, jasper, gobject-introspection, doCheck ? false, makeWrapper }:
+
+let
+  pname = "gdk-pixbuf";
+  version = "2.38.1";
+in stdenv.mkDerivation rec {
+  name = "${pname}-${version}";
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${name}.tar.xz";
+    sha256 = "0fmbjgjcyym3qg46f64qgl7icdm4ii77flyc1mhk244rp8vgi7zi";
+  };
+
+  patches = [
+    # Move installed tests to a separate output
+    ./installed-tests-path.patch
+  ];
+
+  outputs = [ "out" "dev" "man" "devdoc" "installedTests" ];
+
+  setupHook = ./setup-hook.sh;
+
+  # !!! We might want to factor out the gdk-pixbuf-xlib subpackage.
+  buildInputs = [ libX11 ];
+
+  nativeBuildInputs = [
+    meson ninja pkgconfig gettext python3 libxml2 libxslt docbook_xsl docbook_xml_dtd_43
+    gtk-doc gobject-introspection makeWrapper
+  ]
+    ++ stdenv.lib.optional stdenv.isDarwin fixDarwinDylibNames;
+
+  propagatedBuildInputs = [ glib libtiff libjpeg libpng jasper ];
+
+  mesonFlags = [
+    "-Ddocs=true"
+    "-Djasper=true"
+    "-Dx11=true"
+    "-Dgir=${if gobject-introspection != null then "true" else "false"}"
+    "-Dgio_sniffing=false"
+  ];
+
+  postPatch = ''
+    chmod +x build-aux/* # patchShebangs only applies to executables
+    patchShebangs build-aux
+
+    substituteInPlace tests/meson.build --subst-var-by installedtestsprefix "$installedTests"
+  '';
+
+  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 ''
+      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
+      done
+    ''
+    # All except one utility seem to be only useful during building.
+    + ''
+      moveToOutput "bin" "$dev"
+      moveToOutput "bin/gdk-pixbuf-thumbnailer" "$out"
+
+      # 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 ''
+    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
+  '';
+
+  preInstall = ''
+    PATH=$PATH:$out/bin # for install script
+  '';
+
+  # The tests take an excessive amount of time (> 1.5 hours) and memory (> 6 GB).
+  inherit doCheck;
+
+  passthru = {
+    updateScript = gnome3.updateScript {
+      packageName = pname;
+      attrPath = "gdk_pixbuf";
+    };
+
+    # gdk_pixbuf_moduledir variable from gdk-pixbuf-2.0.pc
+    moduleDir = "lib/gdk-pixbuf-2.0/2.10.0/loaders";
+  };
+
+  meta = with stdenv.lib; {
+    description = "A library for image loading and manipulation";
+    homepage = http://library.gnome.org/devel/gdk-pixbuf/;
+    maintainers = [ maintainers.eelco ];
+    license = licenses.lgpl21;
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gdk-pixbuf/installed-tests-path.patch b/nixpkgs/pkgs/development/libraries/gdk-pixbuf/installed-tests-path.patch
new file mode 100644
index 000000000000..1da2b0a10dcd
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gdk-pixbuf/installed-tests-path.patch
@@ -0,0 +1,13 @@
+--- a/tests/meson.build
++++ b/tests/meson.build
+@@ -85,8 +85,8 @@
+   'aero.gif',
+ ]
+ 
+-installed_test_bindir = join_paths(gdk_pixbuf_libexecdir, 'installed-tests', meson.project_name())
+-installed_test_datadir = join_paths(gdk_pixbuf_datadir, 'installed-tests', meson.project_name())
++installed_test_bindir = join_paths('@installedtestsprefix@', 'libexec', 'installed-tests', meson.project_name())
++installed_test_datadir = join_paths('@installedtestsprefix@', 'share', 'installed-tests', meson.project_name())
+ 
+ install_data(test_data, install_dir: installed_test_bindir)
+ install_subdir('test-images', install_dir: installed_test_bindir)
diff --git a/nixpkgs/pkgs/development/libraries/gdk-pixbuf/setup-hook.sh b/nixpkgs/pkgs/development/libraries/gdk-pixbuf/setup-hook.sh
new file mode 100644
index 000000000000..5a7dcd792996
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gdk-pixbuf/setup-hook.sh
@@ -0,0 +1,17 @@
+findGdkPixbufLoaders() {
+
+	# choose the longest loaders.cache
+	local loadersCache="$1/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache"
+	if [ -f "$loadersCache" ]; then
+		if [ -f "$GDK_PIXBUF_MODULE_FILE" ]; then
+			if [ $(cat "$loadersCache"|wc -l) -gt $(cat "$GDK_PIXBUF_MODULE_FILE"|wc -l) ]; then
+				export GDK_PIXBUF_MODULE_FILE="$loadersCache"
+			fi
+		else
+			export GDK_PIXBUF_MODULE_FILE="$loadersCache"
+		fi
+	fi
+
+}
+
+addEnvHooks "$hostOffset" findGdkPixbufLoaders
diff --git a/nixpkgs/pkgs/development/libraries/gdl/default.nix b/nixpkgs/pkgs/development/libraries/gdl/default.nix
new file mode 100644
index 000000000000..45a29e15ede8
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gdl/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchurl, pkgconfig, libxml2, gtk3, gnome3, intltool }:
+
+stdenv.mkDerivation rec {
+  pname = "gdl";
+  version = "3.28.0";
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/gdl/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    sha256 = "1dipnzqpxl0yfwzl2lqdf6vb3174gb9f1d5jndkq8505q7n9ik2j";
+  };
+
+  nativeBuildInputs = [ pkgconfig intltool ];
+  buildInputs = [ libxml2 gtk3 ];
+
+  passthru = {
+    updateScript = gnome3.updateScript {
+      packageName = "gdl";
+    };
+  };
+
+  meta = with stdenv.lib; {
+    description = "Gnome docking library";
+    homepage = https://developer.gnome.org/gdl/;
+    maintainers = gnome3.maintainers;
+    license = licenses.gpl2;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gdome2/default.nix b/nixpkgs/pkgs/development/libraries/gdome2/default.nix
new file mode 100644
index 000000000000..e8982c4b70a4
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gdome2/default.nix
@@ -0,0 +1,30 @@
+{stdenv, fetchurl, pkgconfig, glib, libxml2, gtk-doc}:
+
+let
+  pname = "gdome2";
+  version = "0.8.1";
+in
+
+stdenv.mkDerivation {
+  name = "${pname}-${version}";
+
+  src = fetchurl {
+    url = "http://gdome2.cs.unibo.it/tarball/${pname}-${version}.tar.gz";
+    sha256 = "0hyms5s3hziajp3qbwdwqjc2xcyhb783damqg8wxjpwfxyi81fzl";
+  };
+
+  hardeningDisable = [ "format" ];
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ glib libxml2 gtk-doc ];
+  propagatedBuildInputs = [glib libxml2];
+  patches = [ ./xml-document.patch ];
+
+  meta = with stdenv.lib; {
+    homepage = http://gdome2.cs.unibo.it/;
+    description = "DOM C library developed for the Gnome project";
+    license = licenses.lgpl21Plus;
+    maintainers = with maintainers; [ prikhi roconnor ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gdome2/xml-document.patch b/nixpkgs/pkgs/development/libraries/gdome2/xml-document.patch
new file mode 100644
index 000000000000..7567d1049fc0
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gdome2/xml-document.patch
@@ -0,0 +1,11 @@
+--- a/libgdome/gdomecore/gdome-xml-documentt.c	2003-07-13 14:47:54.000000000 +0400
++++ b/libgdome/gdomecore/gdome-xml-documentt.c	2013-07-02 14:09:18.304613703 +0400
+@@ -342,7 +342,7 @@
+ 	}
+ 	xmlNodeDumpOutput (out_buff, NULL, (xmlNode *)is, 0, 0, NULL);
+ 	xmlOutputBufferFlush(out_buff);
+-	ret = g_strndup (out_buff->buffer->content, out_buff->buffer->use);
++	ret = g_strndup (xmlBufContent(out_buff), xmlBufUse(out_buff));
+ 	(void)xmlOutputBufferClose(out_buff);
+
+ 	return gdome_xml_str_mkref_own (ret);
diff --git a/nixpkgs/pkgs/development/libraries/gecode/3.nix b/nixpkgs/pkgs/development/libraries/gecode/3.nix
new file mode 100644
index 000000000000..32e1163e0f07
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gecode/3.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchurl, bash, perl }:
+
+stdenv.mkDerivation rec {
+  name = "gecode-${version}";
+  version = "3.7.3";
+
+  src = fetchurl {
+    url = "http://www.gecode.org/download/${name}.tar.gz";
+    sha256 = "0k45jas6p3cyldgyir1314ja3174sayn2h2ly3z9b4dl3368pk77";
+  };
+
+  nativeBuildInputs = [ bash perl ];
+
+  preConfigure = "patchShebangs configure";
+
+  meta = with stdenv.lib; {
+    license = licenses.mit;
+    homepage = https://www.gecode.org;
+    description = "Toolkit for developing constraint-based systems";
+    platforms = platforms.all;
+    maintainers = [ maintainers.manveru ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gecode/default.nix b/nixpkgs/pkgs/development/libraries/gecode/default.nix
new file mode 100644
index 000000000000..9a6b5d9cf273
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gecode/default.nix
@@ -0,0 +1,26 @@
+{ stdenv, fetchFromGitHub, bison, flex, perl, gmp, mpfr, enableGist ? true, qtbase }:
+
+stdenv.mkDerivation rec {
+  name = "gecode-${version}";
+  version = "6.2.0";
+
+  src = fetchFromGitHub {
+    owner = "Gecode";
+    repo = "gecode";
+    rev = "release-${version}";
+    sha256 = "0b1cq0c810j1xr2x9y9996p894571sdxng5h74py17c6nr8c6dmk";
+  };
+
+  enableParallelBuilding = true;
+  nativeBuildInputs = [ bison flex ];
+  buildInputs = [ perl gmp mpfr ]
+    ++ stdenv.lib.optional enableGist qtbase;
+
+  meta = with stdenv.lib; {
+    license = licenses.mit;
+    homepage = https://www.gecode.org;
+    description = "Toolkit for developing constraint-based systems";
+    platforms = platforms.all;
+    maintainers = [ ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gegl/3.0.nix b/nixpkgs/pkgs/development/libraries/gegl/3.0.nix
new file mode 100644
index 000000000000..54ee7662d06e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gegl/3.0.nix
@@ -0,0 +1,38 @@
+{ stdenv, fetchurl, pkgconfig, glib, babl, libpng, cairo, libjpeg, which
+, librsvg, pango, gtk, bzip2, json-glib, intltool, autoreconfHook, libraw
+, libwebp, gnome3, libintl }:
+
+stdenv.mkDerivation rec {
+  name = "gegl-0.3.34";
+
+  src = fetchurl {
+    url = "https://download.gimp.org/pub/gegl/0.3/${name}.tar.bz2";
+    sha256 = "010k86wn8cmr07rqwa4lccrmiiqrwbnkxvic4lpapwgbamv258jw";
+  };
+
+  hardeningDisable = [ "format" ];
+
+  # needs fonts otherwise  don't know how to pass them
+  configureFlags = [ "--disable-docs" ];
+
+  enableParallelBuilding = true;
+
+  doCheck = true;
+
+  buildInputs = [
+    libpng cairo libjpeg librsvg pango gtk bzip2
+    libraw libwebp gnome3.gexiv2
+  ];
+
+  propagatedBuildInputs = [ glib json-glib babl ]; # for gegl-3.0.pc
+
+  nativeBuildInputs = [ pkgconfig intltool which autoreconfHook libintl ];
+
+  meta = with stdenv.lib; {
+    description = "Graph-based image processing framework";
+    homepage = http://www.gegl.org;
+    license = licenses.gpl3;
+    maintainers = with maintainers; [ jtojnar ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gegl/4.0.nix b/nixpkgs/pkgs/development/libraries/gegl/4.0.nix
new file mode 100644
index 000000000000..4215f0ebc30d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gegl/4.0.nix
@@ -0,0 +1,37 @@
+{ stdenv, fetchurl, pkgconfig, glib, babl, libpng, cairo, libjpeg, which
+, librsvg, pango, gtk, bzip2, json-glib, gettext, autoreconfHook, libraw
+, gexiv2, libwebp, gnome3, libintl }:
+
+stdenv.mkDerivation rec {
+  pname = "gegl";
+  version = "0.4.16";
+
+  outputs = [ "out" "dev" "devdoc" ];
+  outputBin = "dev";
+
+  src = fetchurl {
+    url = "https://download.gimp.org/pub/gegl/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.bz2";
+    sha256 = "0njydcr6qdmfzh4fxx544681qxdpf7y6b2f47jcypn810dlxy4h1";
+  };
+
+  enableParallelBuilding = true;
+
+  doCheck = true;
+
+  buildInputs = [
+    libpng cairo libjpeg librsvg pango gtk bzip2
+    libraw libwebp gexiv2
+  ];
+
+  propagatedBuildInputs = [ glib json-glib babl ]; # for gegl-4.0.pc
+
+  nativeBuildInputs = [ pkgconfig gettext which autoreconfHook libintl ];
+
+  meta = with stdenv.lib; {
+    description = "Graph-based image processing framework";
+    homepage = http://www.gegl.org;
+    license = licenses.gpl3;
+    maintainers = with maintainers; [ jtojnar ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gegl/default.nix b/nixpkgs/pkgs/development/libraries/gegl/default.nix
new file mode 100644
index 000000000000..e90cc257e7e8
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gegl/default.nix
@@ -0,0 +1,36 @@
+{ stdenv, fetchurl, pkgconfig, babl, libpng, cairo, libjpeg
+, librsvg, pango, gtk2, bzip2, intltool, libintl
+, OpenGL ? null }:
+
+stdenv.mkDerivation rec {
+  name = "gegl-0.2.0";
+
+  src = fetchurl {
+    url = "ftp://ftp.gtk.org/pub/gegl/0.2/${name}.tar.bz2";
+    sha256 = "df2e6a0d9499afcbc4f9029c18d9d1e0dd5e8710a75e17c9b1d9a6480dd8d426";
+  };
+
+  patches = [( fetchurl {
+    url = "https://projects.archlinux.org/svntogit/packages.git/plain/trunk/"
+      + "gegl-0.2.0-CVE-2012-4433.patch?h=packages/gegl&id=57a60fbda5d7bbbd1cc4767cb0724baa80c5e3e9";
+    sha256 = "0p8mxj3w09nn1cc6cbxrd9hx742c5y27903i608wx6ja3kdjis59";
+    name = "CVE-2012-4433.patch";
+  })];
+
+  # needs fonts otherwise  don't know how to pass them
+  configureFlags = [ "--disable-docs" ];
+
+  buildInputs = [ babl libpng cairo libjpeg librsvg pango gtk2 bzip2 intltool libintl ]
+    ++ stdenv.lib.optional stdenv.isDarwin OpenGL;
+
+  nativeBuildInputs = [ pkgconfig ];
+
+  doCheck = false; # fails 3 out of 19 tests
+
+  meta = {
+    description = "Graph-based image processing framework";
+    homepage = http://www.gegl.org;
+    license = stdenv.lib.licenses.gpl3;
+    platforms = stdenv.lib.platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/geis/default.nix b/nixpkgs/pkgs/development/libraries/geis/default.nix
new file mode 100644
index 000000000000..e1f243f8fd3b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/geis/default.nix
@@ -0,0 +1,60 @@
+{ stdenv, fetchurl
+, pkgconfig
+, python3Packages
+, wrapGAppsHook
+, atk
+, dbus
+, evemu
+, frame
+, gdk_pixbuf
+, gobject-introspection
+, grail
+, gtk3
+, libX11
+, libXext
+, libXi
+, libXtst
+, pango
+, xorgserver
+}:
+
+with stdenv.lib;
+
+stdenv.mkDerivation rec {
+  name = "geis-${version}";
+  version = "2.2.17";
+
+  src = fetchurl {
+    url = "https://launchpad.net/geis/trunk/${version}/+download/${name}.tar.xz";
+    sha256 = "1svhbjibm448ybq6gnjjzj0ak42srhihssafj0w402aj71lgaq4a";
+  };
+
+  NIX_CFLAGS_COMPILE = [ "-Wno-error=misleading-indentation" "-Wno-error=pointer-compare" ];
+
+  hardeningDisable = [ "format" ];
+
+  pythonPath = with python3Packages;
+    [ pygobject3  ];
+
+  nativeBuildInputs = [ pkgconfig wrapGAppsHook python3Packages.wrapPython];
+  buildInputs = [ atk dbus evemu frame gdk_pixbuf gobject-introspection grail
+    gtk3 libX11 libXext libXi libXtst pango python3Packages.python xorgserver
+  ];
+
+  patchPhase = ''
+    substituteInPlace python/geis/geis_v2.py --replace \
+      "ctypes.util.find_library(\"geis\")" "'$out/lib/libgeis.so'"
+  '';
+
+  preFixup = ''
+    buildPythonPath "$out $pythonPath"
+    gappsWrapperArgs+=(--set PYTHONPATH "$program_PYTHONPATH")
+  '';
+
+  meta = {
+    description = "A library for input gesture recognition";
+    homepage = https://launchpad.net/geis;
+    license = licenses.gpl2;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/geoclue/add-option-for-installation-sysconfdir.patch b/nixpkgs/pkgs/development/libraries/geoclue/add-option-for-installation-sysconfdir.patch
new file mode 100644
index 000000000000..9eb53acebb0a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/geoclue/add-option-for-installation-sysconfdir.patch
@@ -0,0 +1,81 @@
+diff --git a/data/meson.build b/data/meson.build
+index c189753..12c10cb 100644
+--- a/data/meson.build
++++ b/data/meson.build
+@@ -7,7 +7,7 @@ if get_option('enable-backend')
+         conf.set('demo_agent', '')
+     endif
+ 
+-    conf_dir = join_paths(sysconfdir, 'geoclue')
++    conf_dir = join_paths(sysconfdir_install, 'geoclue')
+     configure_file(output: 'geoclue.conf',
+                    input: 'geoclue.conf.in',
+                    configuration: conf,
+@@ -16,7 +16,7 @@ if get_option('enable-backend')
+     conf = configuration_data()
+     conf.set('libexecdir', libexecdir)
+     conf.set('dbus_srv_user', get_option('dbus-srv-user'))
+-    conf.set('sysconfdir', sysconfdir)
++    conf.set('sysconfdir', sysconfdir_install)
+ 
+     service_dir = join_paths(datadir, 'dbus-1', 'system-services')
+     configure_file(output: 'org.freedesktop.GeoClue2.service',
+@@ -33,7 +33,7 @@ if get_option('enable-backend')
+     # DBus Service policy file
+     dbus_service_dir = get_option('dbus-sys-dir')
+     if dbus_service_dir == ''
+-        dbus_service_dir = join_paths(sysconfdir, 'dbus-1', 'system.d')
++        dbus_service_dir = join_paths(sysconfdir_install, 'dbus-1', 'system.d')
+     endif
+     configure_file(output: 'org.freedesktop.GeoClue2.conf',
+                    input: 'org.freedesktop.GeoClue2.conf.in',
+diff --git a/demo/meson.build b/demo/meson.build
+index 1427fbe..2623f16 100644
+--- a/demo/meson.build
++++ b/demo/meson.build
+@@ -54,7 +54,7 @@ if get_option('demo-agent')
+                                    install_dir: desktop_dir)
+ 
+     # Also install in the autostart directory.
+-    autostart_dir = join_paths(sysconfdir, 'xdg', 'autostart')
++    autostart_dir = join_paths(sysconfdir_install, 'xdg', 'autostart')
+     meson.add_install_script('install-file.py',
+                              desktop_file.full_path(),
+                              autostart_dir)
+diff --git a/meson.build b/meson.build
+index fde6fa3..39b7b0a 100644
+--- a/meson.build
++++ b/meson.build
+@@ -12,7 +12,11 @@ gclue_api_version='2.0'
+ datadir = join_paths(get_option('prefix'), get_option('datadir'))
+ includedir = join_paths(get_option('prefix'), get_option('includedir'))
+ libexecdir = join_paths(get_option('prefix'), get_option('libexecdir'))
+-sysconfdir = join_paths(get_option('prefix'), get_option('sysconfdir'))
++if get_option('sysconfdir_install') != ''
++  sysconfdir_install = join_paths(get_option('prefix'), get_option('sysconfdir_install'))
++else
++  sysconfdir_install = get_option('sysconfdir')
++endif
+ localedir = join_paths(datadir, 'locale')
+ 
+ header_dir = 'libgeoclue-' + gclue_api_version
+@@ -29,7 +33,7 @@ conf.set_quoted('PACKAGE_URL', 'https://gitlab.freedesktop.org/geoclue/geoclue/w
+ conf.set_quoted('PACKAGE_BUGREPORT', 'https://gitlab.freedesktop.org/geoclue/geoclue/issues/new')
+ conf.set_quoted('TEST_SRCDIR', meson.source_root() + '/data/')
+ conf.set_quoted('LOCALEDIR', localedir)
+-conf.set_quoted('SYSCONFDIR', sysconfdir)
++conf.set_quoted('SYSCONFDIR', get_option('sysconfdir'))
+ conf.set10('GCLUE_USE_3G_SOURCE', get_option('3g-source'))
+ conf.set10('GCLUE_USE_CDMA_SOURCE', get_option('cdma-source'))
+ conf.set10('GCLUE_USE_MODEM_GPS_SOURCE', get_option('modem-gps-source'))
+diff --git a/meson_options.txt b/meson_options.txt
+index 83bc60e..b726329 100644
+--- a/meson_options.txt
++++ b/meson_options.txt
+@@ -34,3 +34,6 @@ option('systemd-system-unit-dir',
+ option('dbus-srv-user',
+        type: 'string', value: 'root',
+        description: 'The user (existing) as which the service will run')
++option('sysconfdir_install',
++       type: 'string', value: '',
++       description: 'sysconfdir to use during installation')
diff --git a/nixpkgs/pkgs/development/libraries/geoclue/default.nix b/nixpkgs/pkgs/development/libraries/geoclue/default.nix
new file mode 100644
index 000000000000..6a44f01d0110
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/geoclue/default.nix
@@ -0,0 +1,65 @@
+{ stdenv, fetchFromGitLab, intltool, meson, ninja, pkgconfig, 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;
+
+stdenv.mkDerivation rec {
+  pname = "geoclue";
+  version = "2.5.3";
+
+  src = fetchFromGitLab {
+    domain = "gitlab.freedesktop.org";
+    owner = pname;
+    repo = pname;
+    rev = version;
+    sha256 = "1wbpi74dw3p7izxwd57irz2i1g55r7wzl5h2yf0ns0hgq2njdfsg";
+  };
+
+  patches = [
+    ./add-option-for-installation-sysconfdir.patch
+  ];
+
+  outputs = [ "out" "dev" "devdoc" ];
+
+  nativeBuildInputs = [
+    pkgconfig intltool meson ninja wrapGAppsHook python3 vala gobject-introspection
+    # devdoc
+    gtk-doc docbook_xsl docbook_xml_dtd_412
+  ];
+
+  buildInputs = [
+    glib json-glib libsoup avahi
+  ] ++ optionals withDemoAgent [
+    libnotify gdk_pixbuf
+  ] ++ optionals (!stdenv.isDarwin) [ modemmanager ];
+
+  propagatedBuildInputs = [ glib glib-networking ];
+
+  mesonFlags = [
+    "-Dsystemd-system-unit-dir=${placeholder "out"}/etc/systemd/system"
+    "-Ddemo-agent=${if withDemoAgent then "true" else "false"}"
+    "--sysconfdir=/etc"
+    "-Dsysconfdir_install=${placeholder "out"}/etc"
+    "-Ddbus-srv-user=geoclue"
+  ] ++ optionals stdenv.isDarwin [
+    "-D3g-source=false"
+    "-Dcdma-source=false"
+    "-Dmodem-gps-source=false"
+    "-Dnmea-source=false"
+  ];
+
+  postPatch = ''
+    chmod +x demo/install-file.py
+    patchShebangs demo/install-file.py
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Geolocation framework and some data providers";
+    homepage = https://gitlab.freedesktop.org/geoclue/geoclue/wikis/home;
+    maintainers = with maintainers; [ raskin garbas ];
+    platforms = with platforms; linux ++ darwin;
+    license = licenses.lgpl2;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/geocode-glib/default.nix b/nixpkgs/pkgs/development/libraries/geocode-glib/default.nix
new file mode 100644
index 000000000000..c1d0d7e8a4f1
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/geocode-glib/default.nix
@@ -0,0 +1,37 @@
+{ fetchurl, stdenv, meson, ninja, pkgconfig, gettext, gtk-doc, docbook_xsl, gobject-introspection, gnome3, libsoup, json-glib, glib }:
+
+stdenv.mkDerivation rec {
+  pname = "geocode-glib";
+  version = "3.26.1";
+
+  outputs = [ "out" "dev" "devdoc" "installedTests" ];
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/geocode-glib/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    sha256 = "076ydfpyc4n5c9dbqmf26i4pilfi5jpw6cjcgrbgrjbndavnmajv";
+  };
+
+  nativeBuildInputs = [ meson ninja pkgconfig gettext gtk-doc docbook_xsl gobject-introspection ];
+  buildInputs = [ glib libsoup json-glib ];
+
+  patches = [
+    ./installed-tests-path.patch
+  ];
+
+  postPatch = ''
+    substituteInPlace geocode-glib/tests/meson.build --subst-var-by "installedTests" "$installedTests"
+  '';
+
+  passthru = {
+    updateScript = gnome3.updateScript {
+      packageName = pname;
+    };
+  };
+
+  meta = with stdenv.lib; {
+    description = "A convenience library for the geocoding and reverse geocoding using Nominatim service";
+    license = licenses.lgpl2Plus;
+    maintainers = gnome3.maintainers;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/geocode-glib/installed-tests-path.patch b/nixpkgs/pkgs/development/libraries/geocode-glib/installed-tests-path.patch
new file mode 100644
index 000000000000..499c68008088
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/geocode-glib/installed-tests-path.patch
@@ -0,0 +1,8 @@
+--- a/geocode-glib/tests/meson.build
++++ b/geocode-glib/tests/meson.build
+@@ -1,4 +1,4 @@
+-install_dir = get_option('libexecdir') + '/installed-tests/geocode-glib'
++install_dir = '@installedTests@/libexec/installed-tests/geocode-glib'
+ 
+ e = executable('geo-uri',
+                'geo-uri.c',
diff --git a/nixpkgs/pkgs/development/libraries/geoip/default.nix b/nixpkgs/pkgs/development/libraries/geoip/default.nix
new file mode 100644
index 000000000000..1b1f7373709f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/geoip/default.nix
@@ -0,0 +1,37 @@
+# in geoipDatabase, you can insert a package defining ${geoipDatabase}/share/GeoIP
+# e.g. geolite-legacy
+{ stdenv, fetchFromGitHub, autoreconfHook
+, drvName ? "geoip", geoipDatabase ? "/var/lib/geoip-databases" }:
+
+let version = "1.6.12";
+    dataDir = if (stdenv.lib.isDerivation geoipDatabase) then "${toString geoipDatabase}/share/GeoIP" else geoipDatabase;
+in stdenv.mkDerivation {
+  name = "${drvName}-${version}";
+
+  src = fetchFromGitHub {
+    owner = "maxmind";
+    repo = "geoip-api-c";
+    rev = "v${version}";
+    sha256 = "0ixyp3h51alnncr17hqp1p0rlqz9w69nlhm60rbzjjz3vjx52ajv";
+  };
+
+  nativeBuildInputs = [ autoreconfHook ];
+
+  configureFlags = stdenv.lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
+    "ac_cv_func_malloc_0_nonnull=yes"
+    "ac_cv_func_realloc_0_nonnull=yes"
+  ];
+
+  postConfigure = ''
+    find . -name Makefile.in -exec sed -i -r 's#^pkgdatadir\s*=.+$#pkgdatadir = ${dataDir}#' {} \;
+  '';
+
+  meta = {
+    description = "Geolocation API";
+    maintainers = [ stdenv.lib.maintainers.raskin ];
+    license = stdenv.lib.licenses.lgpl21;
+    platforms = stdenv.lib.platforms.unix;
+    homepage = http://geolite.maxmind.com/;
+    downloadPage = "http://geolite.maxmind.com/download/";
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/geos/default.nix b/nixpkgs/pkgs/development/libraries/geos/default.nix
new file mode 100644
index 000000000000..3bed670cc307
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/geos/default.nix
@@ -0,0 +1,20 @@
+{ stdenv, fetchurl, python }:
+
+stdenv.mkDerivation rec {
+  name = "geos-3.7.2";
+
+  src = fetchurl {
+    url = "https://download.osgeo.org/geos/${name}.tar.bz2";
+    sha256 = "01vpkncvq1i1191agq03yg1h7d0igj10gv5z2mqk24nnwrdycri1";
+  };
+
+  enableParallelBuilding = true;
+
+  buildInputs = [ python ];
+
+  meta = with stdenv.lib; {
+    description = "C++ port of the Java Topology Suite (JTS)";
+    homepage = http://geos.refractions.net/;
+    license = licenses.lgpl21;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/getdata/default.nix b/nixpkgs/pkgs/development/libraries/getdata/default.nix
new file mode 100644
index 000000000000..22e7d216e6cd
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/getdata/default.nix
@@ -0,0 +1,19 @@
+{ stdenv, fetchurl, libtool }:
+stdenv.mkDerivation rec {
+  name = "getdata-${version}";
+  version = "0.10.0";
+  src = fetchurl {
+    url = "mirror://sourceforge/getdata/${name}.tar.xz";
+    sha256 = "18xbb32vygav9x6yz0gdklif4chjskmkgp06rwnjdf9myhia0iym";
+  };
+
+  buildInputs = [ libtool ];
+
+  meta = with stdenv.lib; {
+    description = "Reference implementation of the Dirfile Standards";
+    license = licenses.lgpl21Plus;
+    platforms = platforms.all;
+    maintainers = [ maintainers.vbgl ];
+    homepage = http://getdata.sourceforge.net/;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/getdns/default.nix b/nixpkgs/pkgs/development/libraries/getdns/default.nix
new file mode 100644
index 000000000000..0493071ee228
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/getdns/default.nix
@@ -0,0 +1,41 @@
+{ stdenv, fetchurl, libtool, unbound, libidn, m4, file
+, openssl, doxygen, autoreconfHook, automake }:
+
+stdenv.mkDerivation rec {
+  pname = "getdns";
+  name = "${pname}-${version}";
+  version = "1.5.1";
+
+  src = fetchurl {
+    url = "https://getdnsapi.net/releases/${pname}-1-5-1/${pname}-${version}.tar.gz";
+    sha256 = "5686e61100599c309ce03535f9899a5a3d94a82cc08d10718e2cd73ad3dc28af";
+  };
+
+  nativeBuildInputs = [ libtool m4 autoreconfHook automake file ];
+
+  buildInputs = [ unbound libidn openssl doxygen ];
+
+  patchPhase = ''
+    substituteInPlace m4/acx_openssl.m4 \
+      --replace /usr/local/ssl ${openssl.dev}
+    '';
+
+  meta = with stdenv.lib; {
+    description = "A modern asynchronous DNS API";
+    longDescription = ''
+      getdns is an implementation of a modern asynchronous DNS API; the
+      specification was originally edited by Paul Hoffman. It is intended to make all
+      types of DNS information easily available to application developers and non-DNS
+      experts. DNSSEC offers a unique global infrastructure for establishing and
+      enhancing cryptographic trust relations. With the development of this API the
+      developers intend to offer application developers a modern and flexible
+      interface that enables end-to-end trust in the DNS architecture, and which will
+      inspire application developers to implement innovative security solutions in
+      their applications.
+'';
+    homepage = https://getdnsapi.net;
+    maintainers = with maintainers; [ leenaars ];
+    license = licenses.bsd3;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gettext/CVE-2018-18751-bison.patch b/nixpkgs/pkgs/development/libraries/gettext/CVE-2018-18751-bison.patch
new file mode 100644
index 000000000000..b734c1c8b027
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gettext/CVE-2018-18751-bison.patch
@@ -0,0 +1,323 @@
+This patch was generated by re-running Bison 3.0.4 on pro-gram-gen.y after
+applying CVE-2018-18751.patch. This patch removes the need to add bison to
+nativeBuildInputs.
+
+--- a/gettext-tools/src/po-gram-gen.c
++++ b/gettext-tools/src/po-gram-gen.c
+@@ -568,9 +568,9 @@ static const yytype_uint8 yytranslate[] =
+ static const yytype_uint16 yyrline[] =
+ {
+        0,   169,   169,   171,   172,   173,   174,   179,   187,   195,
+-     216,   240,   249,   258,   269,   278,   292,   301,   315,   321,
+-     332,   338,   350,   361,   372,   376,   391,   414,   422,   434,
+-     442
++     216,   237,   246,   255,   266,   275,   289,   298,   312,   318,
++     329,   335,   347,   358,   369,   373,   388,   411,   419,   431,
++     439
+ };
+ #endif
+
+@@ -1419,14 +1419,11 @@ yyreduce:
+                   check_obsolete ((yyvsp[-3].message_intro), (yyvsp[-1].string));
+                   check_obsolete ((yyvsp[-3].message_intro), (yyvsp[0].rhs));
+                   if (!(yyvsp[-3].message_intro).obsolete || pass_obsolete_entries)
+-                    {
+-                      do_callback_message ((yyvsp[-3].message_intro).ctxt, string2, &(yyvsp[-3].message_intro).pos, (yyvsp[-1].string).string,
+-                                           (yyvsp[0].rhs).rhs.msgstr, (yyvsp[0].rhs).rhs.msgstr_len, &(yyvsp[0].rhs).pos,
+-                                           (yyvsp[-3].message_intro).prev_ctxt,
+-                                           (yyvsp[-3].message_intro).prev_id, (yyvsp[-3].message_intro).prev_id_plural,
+-                                           (yyvsp[-3].message_intro).obsolete);
+-                      free ((yyvsp[-1].string).string);
+-                    }
++                    do_callback_message ((yyvsp[-3].message_intro).ctxt, string2, &(yyvsp[-3].message_intro).pos, (yyvsp[-1].string).string,
++                                         (yyvsp[0].rhs).rhs.msgstr, (yyvsp[0].rhs).rhs.msgstr_len, &(yyvsp[0].rhs).pos,
++                                         (yyvsp[-3].message_intro).prev_ctxt,
++                                         (yyvsp[-3].message_intro).prev_id, (yyvsp[-3].message_intro).prev_id_plural,
++                                         (yyvsp[-3].message_intro).obsolete);
+                   else
+                     {
+                       free_message_intro ((yyvsp[-3].message_intro));
+@@ -1435,11 +1432,11 @@ yyreduce:
+                       free ((yyvsp[0].rhs).rhs.msgstr);
+                     }
+                 }
+-#line 1439 "po-gram-gen.c" /* yacc.c:1646  */
++#line 1436 "po-gram-gen.c" /* yacc.c:1646  */
+     break;
+
+   case 11:
+-#line 241 "po-gram-gen.y" /* yacc.c:1646  */
++#line 238 "po-gram-gen.y" /* yacc.c:1646  */
+     {
+                   check_obsolete ((yyvsp[-2].message_intro), (yyvsp[-1].stringlist));
+                   check_obsolete ((yyvsp[-2].message_intro), (yyvsp[0].string));
+@@ -1448,11 +1445,11 @@ yyreduce:
+                   string_list_destroy (&(yyvsp[-1].stringlist).stringlist);
+                   free ((yyvsp[0].string).string);
+                 }
+-#line 1452 "po-gram-gen.c" /* yacc.c:1646  */
++#line 1449 "po-gram-gen.c" /* yacc.c:1646  */
+     break;
+
+   case 12:
+-#line 250 "po-gram-gen.y" /* yacc.c:1646  */
++#line 247 "po-gram-gen.y" /* yacc.c:1646  */
+     {
+                   check_obsolete ((yyvsp[-2].message_intro), (yyvsp[-1].stringlist));
+                   check_obsolete ((yyvsp[-2].message_intro), (yyvsp[0].rhs));
+@@ -1461,22 +1458,22 @@ yyreduce:
+                   string_list_destroy (&(yyvsp[-1].stringlist).stringlist);
+                   free ((yyvsp[0].rhs).rhs.msgstr);
+                 }
+-#line 1465 "po-gram-gen.c" /* yacc.c:1646  */
++#line 1462 "po-gram-gen.c" /* yacc.c:1646  */
+     break;
+
+   case 13:
+-#line 259 "po-gram-gen.y" /* yacc.c:1646  */
++#line 256 "po-gram-gen.y" /* yacc.c:1646  */
+     {
+                   check_obsolete ((yyvsp[-1].message_intro), (yyvsp[0].stringlist));
+                   po_gram_error_at_line (&(yyvsp[-1].message_intro).pos, _("missing 'msgstr' section"));
+                   free_message_intro ((yyvsp[-1].message_intro));
+                   string_list_destroy (&(yyvsp[0].stringlist).stringlist);
+                 }
+-#line 1476 "po-gram-gen.c" /* yacc.c:1646  */
++#line 1473 "po-gram-gen.c" /* yacc.c:1646  */
+     break;
+
+   case 14:
+-#line 270 "po-gram-gen.y" /* yacc.c:1646  */
++#line 267 "po-gram-gen.y" /* yacc.c:1646  */
+     {
+                   (yyval.message_intro).prev_ctxt = NULL;
+                   (yyval.message_intro).prev_id = NULL;
+@@ -1485,11 +1482,11 @@ yyreduce:
+                   (yyval.message_intro).pos = (yyvsp[0].string).pos;
+                   (yyval.message_intro).obsolete = (yyvsp[0].string).obsolete;
+                 }
+-#line 1489 "po-gram-gen.c" /* yacc.c:1646  */
++#line 1486 "po-gram-gen.c" /* yacc.c:1646  */
+     break;
+
+   case 15:
+-#line 279 "po-gram-gen.y" /* yacc.c:1646  */
++#line 276 "po-gram-gen.y" /* yacc.c:1646  */
+     {
+                   check_obsolete ((yyvsp[-1].prev), (yyvsp[0].string));
+                   (yyval.message_intro).prev_ctxt = (yyvsp[-1].prev).ctxt;
+@@ -1499,11 +1496,11 @@ yyreduce:
+                   (yyval.message_intro).pos = (yyvsp[0].string).pos;
+                   (yyval.message_intro).obsolete = (yyvsp[0].string).obsolete;
+                 }
+-#line 1503 "po-gram-gen.c" /* yacc.c:1646  */
++#line 1500 "po-gram-gen.c" /* yacc.c:1646  */
+     break;
+
+   case 16:
+-#line 293 "po-gram-gen.y" /* yacc.c:1646  */
++#line 290 "po-gram-gen.y" /* yacc.c:1646  */
+     {
+                   check_obsolete ((yyvsp[-1].string), (yyvsp[0].stringlist));
+                   (yyval.prev).ctxt = (yyvsp[-1].string).string;
+@@ -1512,11 +1509,11 @@ yyreduce:
+                   (yyval.prev).pos = (yyvsp[-1].string).pos;
+                   (yyval.prev).obsolete = (yyvsp[-1].string).obsolete;
+                 }
+-#line 1516 "po-gram-gen.c" /* yacc.c:1646  */
++#line 1513 "po-gram-gen.c" /* yacc.c:1646  */
+     break;
+
+   case 17:
+-#line 302 "po-gram-gen.y" /* yacc.c:1646  */
++#line 299 "po-gram-gen.y" /* yacc.c:1646  */
+     {
+                   check_obsolete ((yyvsp[-2].string), (yyvsp[-1].stringlist));
+                   check_obsolete ((yyvsp[-2].string), (yyvsp[0].string));
+@@ -1526,21 +1523,21 @@ yyreduce:
+                   (yyval.prev).pos = (yyvsp[-2].string).pos;
+                   (yyval.prev).obsolete = (yyvsp[-2].string).obsolete;
+                 }
+-#line 1530 "po-gram-gen.c" /* yacc.c:1646  */
++#line 1527 "po-gram-gen.c" /* yacc.c:1646  */
+     break;
+
+   case 18:
+-#line 316 "po-gram-gen.y" /* yacc.c:1646  */
++#line 313 "po-gram-gen.y" /* yacc.c:1646  */
+     {
+                   (yyval.string).string = NULL;
+                   (yyval.string).pos = (yyvsp[0].pos).pos;
+                   (yyval.string).obsolete = (yyvsp[0].pos).obsolete;
+                 }
+-#line 1540 "po-gram-gen.c" /* yacc.c:1646  */
++#line 1537 "po-gram-gen.c" /* yacc.c:1646  */
+     break;
+
+   case 19:
+-#line 322 "po-gram-gen.y" /* yacc.c:1646  */
++#line 319 "po-gram-gen.y" /* yacc.c:1646  */
+     {
+                   check_obsolete ((yyvsp[-2].pos), (yyvsp[-1].stringlist));
+                   check_obsolete ((yyvsp[-2].pos), (yyvsp[0].pos));
+@@ -1548,21 +1545,21 @@ yyreduce:
+                   (yyval.string).pos = (yyvsp[0].pos).pos;
+                   (yyval.string).obsolete = (yyvsp[0].pos).obsolete;
+                 }
+-#line 1552 "po-gram-gen.c" /* yacc.c:1646  */
++#line 1549 "po-gram-gen.c" /* yacc.c:1646  */
+     break;
+
+   case 20:
+-#line 333 "po-gram-gen.y" /* yacc.c:1646  */
++#line 330 "po-gram-gen.y" /* yacc.c:1646  */
+     {
+                   (yyval.string).string = NULL;
+                   (yyval.string).pos = (yyvsp[0].pos).pos;
+                   (yyval.string).obsolete = (yyvsp[0].pos).obsolete;
+                 }
+-#line 1562 "po-gram-gen.c" /* yacc.c:1646  */
++#line 1559 "po-gram-gen.c" /* yacc.c:1646  */
+     break;
+
+   case 21:
+-#line 339 "po-gram-gen.y" /* yacc.c:1646  */
++#line 336 "po-gram-gen.y" /* yacc.c:1646  */
+     {
+                   check_obsolete ((yyvsp[-2].pos), (yyvsp[-1].stringlist));
+                   check_obsolete ((yyvsp[-2].pos), (yyvsp[0].pos));
+@@ -1570,11 +1567,11 @@ yyreduce:
+                   (yyval.string).pos = (yyvsp[0].pos).pos;
+                   (yyval.string).obsolete = (yyvsp[0].pos).obsolete;
+                 }
+-#line 1574 "po-gram-gen.c" /* yacc.c:1646  */
++#line 1571 "po-gram-gen.c" /* yacc.c:1646  */
+     break;
+
+   case 22:
+-#line 351 "po-gram-gen.y" /* yacc.c:1646  */
++#line 348 "po-gram-gen.y" /* yacc.c:1646  */
+     {
+                   check_obsolete ((yyvsp[-1].pos), (yyvsp[0].stringlist));
+                   plural_counter = 0;
+@@ -1582,30 +1579,30 @@ yyreduce:
+                   (yyval.string).pos = (yyvsp[-1].pos).pos;
+                   (yyval.string).obsolete = (yyvsp[-1].pos).obsolete;
+                 }
+-#line 1586 "po-gram-gen.c" /* yacc.c:1646  */
++#line 1583 "po-gram-gen.c" /* yacc.c:1646  */
+     break;
+
+   case 23:
+-#line 362 "po-gram-gen.y" /* yacc.c:1646  */
++#line 359 "po-gram-gen.y" /* yacc.c:1646  */
+     {
+                   check_obsolete ((yyvsp[-1].pos), (yyvsp[0].stringlist));
+                   (yyval.string).string = string_list_concat_destroy (&(yyvsp[0].stringlist).stringlist);
+                   (yyval.string).pos = (yyvsp[-1].pos).pos;
+                   (yyval.string).obsolete = (yyvsp[-1].pos).obsolete;
+                 }
+-#line 1597 "po-gram-gen.c" /* yacc.c:1646  */
++#line 1594 "po-gram-gen.c" /* yacc.c:1646  */
+     break;
+
+   case 24:
+-#line 373 "po-gram-gen.y" /* yacc.c:1646  */
++#line 370 "po-gram-gen.y" /* yacc.c:1646  */
+     {
+                   (yyval.rhs) = (yyvsp[0].rhs);
+                 }
+-#line 1605 "po-gram-gen.c" /* yacc.c:1646  */
++#line 1602 "po-gram-gen.c" /* yacc.c:1646  */
+     break;
+
+   case 25:
+-#line 377 "po-gram-gen.y" /* yacc.c:1646  */
++#line 374 "po-gram-gen.y" /* yacc.c:1646  */
+     {
+                   check_obsolete ((yyvsp[-1].rhs), (yyvsp[0].rhs));
+                   (yyval.rhs).rhs.msgstr = XNMALLOC ((yyvsp[-1].rhs).rhs.msgstr_len + (yyvsp[0].rhs).rhs.msgstr_len, char);
+@@ -1617,11 +1614,11 @@ yyreduce:
+                   (yyval.rhs).pos = (yyvsp[-1].rhs).pos;
+                   (yyval.rhs).obsolete = (yyvsp[-1].rhs).obsolete;
+                 }
+-#line 1621 "po-gram-gen.c" /* yacc.c:1646  */
++#line 1618 "po-gram-gen.c" /* yacc.c:1646  */
+     break;
+
+   case 26:
+-#line 392 "po-gram-gen.y" /* yacc.c:1646  */
++#line 389 "po-gram-gen.y" /* yacc.c:1646  */
+     {
+                   check_obsolete ((yyvsp[-4].pos), (yyvsp[-3].pos));
+                   check_obsolete ((yyvsp[-4].pos), (yyvsp[-2].number));
+@@ -1640,11 +1637,11 @@ yyreduce:
+                   (yyval.rhs).pos = (yyvsp[-4].pos).pos;
+                   (yyval.rhs).obsolete = (yyvsp[-4].pos).obsolete;
+                 }
+-#line 1644 "po-gram-gen.c" /* yacc.c:1646  */
++#line 1641 "po-gram-gen.c" /* yacc.c:1646  */
+     break;
+
+   case 27:
+-#line 415 "po-gram-gen.y" /* yacc.c:1646  */
++#line 412 "po-gram-gen.y" /* yacc.c:1646  */
+     {
+                   string_list_init (&(yyval.stringlist).stringlist);
+                   string_list_append (&(yyval.stringlist).stringlist, (yyvsp[0].string).string);
+@@ -1652,11 +1649,11 @@ yyreduce:
+                   (yyval.stringlist).pos = (yyvsp[0].string).pos;
+                   (yyval.stringlist).obsolete = (yyvsp[0].string).obsolete;
+                 }
+-#line 1656 "po-gram-gen.c" /* yacc.c:1646  */
++#line 1653 "po-gram-gen.c" /* yacc.c:1646  */
+     break;
+
+   case 28:
+-#line 423 "po-gram-gen.y" /* yacc.c:1646  */
++#line 420 "po-gram-gen.y" /* yacc.c:1646  */
+     {
+                   check_obsolete ((yyvsp[-1].stringlist), (yyvsp[0].string));
+                   (yyval.stringlist).stringlist = (yyvsp[-1].stringlist).stringlist;
+@@ -1665,11 +1662,11 @@ yyreduce:
+                   (yyval.stringlist).pos = (yyvsp[-1].stringlist).pos;
+                   (yyval.stringlist).obsolete = (yyvsp[-1].stringlist).obsolete;
+                 }
+-#line 1669 "po-gram-gen.c" /* yacc.c:1646  */
++#line 1666 "po-gram-gen.c" /* yacc.c:1646  */
+     break;
+
+   case 29:
+-#line 435 "po-gram-gen.y" /* yacc.c:1646  */
++#line 432 "po-gram-gen.y" /* yacc.c:1646  */
+     {
+                   string_list_init (&(yyval.stringlist).stringlist);
+                   string_list_append (&(yyval.stringlist).stringlist, (yyvsp[0].string).string);
+@@ -1677,11 +1674,11 @@ yyreduce:
+                   (yyval.stringlist).pos = (yyvsp[0].string).pos;
+                   (yyval.stringlist).obsolete = (yyvsp[0].string).obsolete;
+                 }
+-#line 1681 "po-gram-gen.c" /* yacc.c:1646  */
++#line 1678 "po-gram-gen.c" /* yacc.c:1646  */
+     break;
+
+   case 30:
+-#line 443 "po-gram-gen.y" /* yacc.c:1646  */
++#line 440 "po-gram-gen.y" /* yacc.c:1646  */
+     {
+                   check_obsolete ((yyvsp[-1].stringlist), (yyvsp[0].string));
+                   (yyval.stringlist).stringlist = (yyvsp[-1].stringlist).stringlist;
+@@ -1690,11 +1687,11 @@ yyreduce:
+                   (yyval.stringlist).pos = (yyvsp[-1].stringlist).pos;
+                   (yyval.stringlist).obsolete = (yyvsp[-1].stringlist).obsolete;
+                 }
+-#line 1694 "po-gram-gen.c" /* yacc.c:1646  */
++#line 1691 "po-gram-gen.c" /* yacc.c:1646  */
+     break;
+
+
+-#line 1698 "po-gram-gen.c" /* yacc.c:1646  */
++#line 1695 "po-gram-gen.c" /* yacc.c:1646  */
+       default: break;
+     }
+   /* User semantic actions sometimes alter yychar, and that requires
diff --git a/nixpkgs/pkgs/development/libraries/gettext/absolute-paths.diff b/nixpkgs/pkgs/development/libraries/gettext/absolute-paths.diff
new file mode 100644
index 000000000000..af37f61a9a41
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gettext/absolute-paths.diff
@@ -0,0 +1,21 @@
+diff --git a/gettext-runtime/src/gettext.sh.in b/gettext-runtime/src/gettext.sh.in
+index 1dfa3bb..d6ef8a8 100644
+--- a/gettext-runtime/src/gettext.sh.in
++++ b/gettext-runtime/src/gettext.sh.in
+@@ -86,14 +86,14 @@ fi
+ # looks up the translation of MSGID and substitutes shell variables in the
+ # result.
+ eval_gettext () {
+-  gettext "$1" | (export PATH `envsubst --variables "$1"`; envsubst "$1")
++  @out@/bin/gettext "$1" | (export PATH `@out@/bin/envsubst --variables "$1"`; @out@/bin/envsubst "$1")
+ }
+ 
+ # eval_ngettext MSGID MSGID-PLURAL COUNT
+ # looks up the translation of MSGID / MSGID-PLURAL for COUNT and substitutes
+ # shell variables in the result.
+ eval_ngettext () {
+-  ngettext "$1" "$2" "$3" | (export PATH `envsubst --variables "$1 $2"`; envsubst "$1 $2")
++  @out@/bin/ngettext "$1" "$2" "$3" | (export PATH `@out@/bin/envsubst --variables "$1 $2"`; @out@/bin/envsubst "$1 $2")
+ }
+ 
+ # Note: This use of envsubst is much safer than using the shell built-in 'eval'
diff --git a/nixpkgs/pkgs/development/libraries/gettext/default.nix b/nixpkgs/pkgs/development/libraries/gettext/default.nix
new file mode 100644
index 000000000000..6eb8bae435be
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gettext/default.nix
@@ -0,0 +1,110 @@
+{ stdenv, lib, fetchurl, libiconv, xz, bison, automake115x, autoconf }:
+
+let allowBisonDependency = !stdenv.isDarwin; in
+stdenv.mkDerivation rec {
+  name = "gettext-${version}";
+  version = "0.19.8.1";
+
+  src = fetchurl {
+    url = "mirror://gnu/gettext/${name}.tar.gz";
+    sha256 = "0hsw28f9q9xaggjlsdp2qmbp2rbd1mp0njzan2ld9kiqwkq2m57z";
+  };
+  patches = [
+    ./absolute-paths.diff
+    (fetchurl {
+      name = "CVE-2018-18751.patch";
+      url = "https://git.savannah.gnu.org/gitweb/?p=gettext.git;a=patch;h=dce3a16e5e9368245735e29bf498dcd5e3e474a4";
+      sha256 = "1lpjwwcjr1sb879faj0xyzw02kma0ivab6xwn3qciy13qy6fq5xn";
+    })
+  ] ++ lib.optionals (!allowBisonDependency) [
+    # Only necessary for CVE-2018-18751.patch:
+    ./CVE-2018-18751-bison.patch
+  ];
+
+  outputs = [ "out" "man" "doc" "info" ];
+
+  hardeningDisable = [ "format" ];
+
+  LDFLAGS = if stdenv.isSunOS then "-lm -lmd -lmp -luutil -lnvpair -lnsl -lidmap -lavl -lsec" else "";
+
+  configureFlags = [
+     "--disable-csharp" "--with-xz"
+     # avoid retaining reference to CF during stdenv bootstrap
+  ] ++ lib.optionals stdenv.isDarwin [
+    "gt_cv_func_CFPreferencesCopyAppValue=no"
+    "gt_cv_func_CFLocaleCopyCurrent=no"
+  ] ++ stdenv.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
+    # wchar.h and stddef.h (gcc-4.3 - glibc-2.9)
+    "gl_cv_func_wcwidth_works=yes"
+  ];
+
+  postPatch = ''
+   substituteAllInPlace gettext-runtime/src/gettext.sh.in
+   substituteInPlace gettext-tools/projects/KDE/trigger --replace "/bin/pwd" pwd
+   substituteInPlace gettext-tools/projects/GNOME/trigger --replace "/bin/pwd" pwd
+   substituteInPlace gettext-tools/src/project-id --replace "/bin/pwd" pwd
+  '' + lib.optionalString stdenv.hostPlatform.isCygwin ''
+    sed -i -e "s/\(cldr_plurals_LDADD = \)/\\1..\/gnulib-lib\/libxml_rpl.la /" gettext-tools/src/Makefile.in
+    sed -i -e "s/\(libgettextsrc_la_LDFLAGS = \)/\\1..\/gnulib-lib\/libxml_rpl.la /" gettext-tools/src/Makefile.in
+  '';
+
+  nativeBuildInputs = [
+    xz
+    xz.bin
+  ]
+  # Only necessary for CVE-2018-18751.patch (unless CVE-2018-18751-bison.patch
+  # is also applied):
+  ++ lib.optional allowBisonDependency bison
+  ++ [
+    # Only necessary for CVE-2018-18751.patch:
+    automake115x
+    autoconf
+  ];
+  # HACK, see #10874 (and 14664)
+  buildInputs = stdenv.lib.optional (!stdenv.isLinux && !stdenv.hostPlatform.isCygwin) libiconv;
+
+  setupHooks = [
+    ../../../build-support/setup-hooks/role.bash
+    ./gettext-setup-hook.sh
+  ];
+  gettextNeedsLdflags = stdenv.hostPlatform.libc != "glibc" && !stdenv.hostPlatform.isMusl;
+
+  enableParallelBuilding = true;
+  enableParallelChecking = false; # fails sometimes
+
+  meta = with lib; {
+    description = "Well integrated set of translation tools and documentation";
+
+    longDescription = ''
+      Usually, programs are written and documented in English, and use
+      English at execution time for interacting with users.  Using a common
+      language is quite handy for communication between developers,
+      maintainers and users from all countries.  On the other hand, most
+      people are less comfortable with English than with their own native
+      language, and would rather be using their mother tongue for day to
+      day's work, as far as possible.  Many would simply love seeing their
+      computer screen showing a lot less of English, and far more of their
+      own language.
+
+      GNU `gettext' is an important step for the GNU Translation Project, as
+      it is an asset on which we may build many other steps. This package
+      offers to programmers, translators, and even users, a well integrated
+      set of tools and documentation. Specifically, the GNU `gettext'
+      utilities are a set of tools that provides a framework to help other
+      GNU packages produce multi-lingual messages.
+    '';
+
+    homepage = https://www.gnu.org/software/gettext/;
+
+    maintainers = with maintainers; [ zimbatm vrthra ];
+    license = licenses.gpl2Plus;
+    platforms = platforms.all;
+  };
+}
+
+// stdenv.lib.optionalAttrs stdenv.isDarwin {
+  makeFlags = "CFLAGS=-D_FORTIFY_SOURCE=0";
+}
diff --git a/nixpkgs/pkgs/development/libraries/gettext/gettext-setup-hook.sh b/nixpkgs/pkgs/development/libraries/gettext/gettext-setup-hook.sh
new file mode 100644
index 000000000000..ad3763c29b64
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gettext/gettext-setup-hook.sh
@@ -0,0 +1,17 @@
+gettextDataDirsHook() {
+    # See pkgs/build-support/setup-hooks/role.bash
+    getHostRoleEnvHook
+    if [ -d "$1/share/gettext" ]; then
+        addToSearchPath "GETTEXTDATADIRS${role_post}" "$1/share/gettext"
+    fi
+}
+
+addEnvHooks "$hostOffset" gettextDataDirsHook
+
+# libintl must be listed in load flags on non-Glibc
+# it doesn't hurt to have it in Glibc either though
+if [ -n "@gettextNeedsLdflags@" -a -z "$dontAddExtraLibs" ]; then
+    # See pkgs/build-support/setup-hooks/role.bash
+    getHostRole
+    export NIX_${role_pre}LDFLAGS+=" -lintl"
+fi
diff --git a/nixpkgs/pkgs/development/libraries/gexiv2/default.nix b/nixpkgs/pkgs/development/libraries/gexiv2/default.nix
new file mode 100644
index 000000000000..7203f8531c27
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gexiv2/default.nix
@@ -0,0 +1,37 @@
+{ stdenv, fetchurl, meson, ninja, pkgconfig, exiv2, glib, gnome3, gobject-introspection, vala, gtk-doc, docbook_xsl, docbook_xml_dtd_43 }:
+
+stdenv.mkDerivation rec {
+  pname = "gexiv2";
+  version = "0.12.0";
+
+  outputs = [ "out" "dev" "devdoc" ];
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    sha256 = "0slj5yj8c90l9pp5i3z74x5r3r4da0xfmbzkfq5k0dkg72q3kxaq";
+  };
+
+  nativeBuildInputs = [ meson ninja pkgconfig gobject-introspection vala gtk-doc docbook_xsl docbook_xml_dtd_43 ];
+  buildInputs = [ glib ];
+  propagatedBuildInputs = [ exiv2 ];
+
+  mesonFlags = [
+    "-Dgtk_doc=true"
+  ];
+
+  doCheck = true;
+
+  passthru = {
+    updateScript = gnome3.updateScript {
+      packageName = pname;
+    };
+  };
+
+  meta = with stdenv.lib; {
+    homepage = https://wiki.gnome.org/Projects/gexiv2;
+    description = "GObject wrapper around the Exiv2 photo metadata library";
+    license = licenses.gpl2;
+    platforms = platforms.unix;
+    maintainers = gnome3.maintainers;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gf2x/default.nix b/nixpkgs/pkgs/development/libraries/gf2x/default.nix
new file mode 100644
index 000000000000..a00e07376c7b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gf2x/default.nix
@@ -0,0 +1,33 @@
+{ stdenv
+, lib
+, fetchurl
+, optimize ? false # impure hardware optimizations
+}:
+stdenv.mkDerivation rec {
+  name = "gf2x-${version}";
+  version = "1.2"; # remember to also update the url
+
+  src = fetchurl {
+    # find link to latest version (with file id) here: https://gforge.inria.fr/projects/gf2x/
+    # Requested a predictable link:
+    # https://gforge.inria.fr/tracker/index.php?func=detail&aid=21704&group_id=1874&atid=6982
+    url = "https://gforge.inria.fr/frs/download.php/file/36934/gf2x-${version}.tar.gz";
+    sha256 = "0d6vh1mxskvv3bxl6byp7gxxw3zzpkldrxnyajhnl05m0gx7yhk1";
+  };
+
+  # no actual checks present yet (as of 1.2), but can't hurt trying
+  # for an indirect test, run ntl's test suite
+  doCheck = true;
+
+  configureFlags = lib.optionals (!optimize) [
+    "--disable-hardware-specific-code"
+  ];
+
+  meta = with lib; {
+    description = ''Routines for fast arithmetic in GF(2)[x]'';
+    homepage = http://gf2x.gforge.inria.fr;
+    license = licenses.gpl2Plus;
+    maintainers = with maintainers; [ raskin timokau ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gfbgraph/default.nix b/nixpkgs/pkgs/development/libraries/gfbgraph/default.nix
new file mode 100644
index 000000000000..1bdcb7d8b28d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gfbgraph/default.nix
@@ -0,0 +1,36 @@
+{ stdenv, fetchurl, pkgconfig, glib, librest
+, gnome3, libsoup, json-glib, gobject-introspection }:
+
+stdenv.mkDerivation rec {
+  pname = "gfbgraph";
+  version = "0.2.3";
+
+  outputs = [ "out" "dev" "devdoc" ];
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    sha256 = "1dp0v8ia35fxs9yhnqpxj3ir5lh018jlbiwifjfn8ayy7h47j4fs";
+  };
+
+  nativeBuildInputs = [ pkgconfig gobject-introspection ];
+  buildInputs = [ glib gnome3.gnome-online-accounts ];
+  propagatedBuildInputs = [ libsoup json-glib librest ];
+
+  configureFlags = [ "--enable-introspection" ];
+
+  enableParallelBuilding = true;
+
+  passthru = {
+    updateScript = gnome3.updateScript {
+      packageName = pname;
+    };
+  };
+
+  meta = with stdenv.lib; {
+    homepage = https://wiki.gnome.org/Projects/GFBGraph;
+    description = "GLib/GObject wrapper for the Facebook Graph API";
+    maintainers = gnome3.maintainers;
+    license = licenses.lgpl2;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/ggz_base_libs/default.nix b/nixpkgs/pkgs/development/libraries/ggz_base_libs/default.nix
new file mode 100644
index 000000000000..6003c5ea33ea
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/ggz_base_libs/default.nix
@@ -0,0 +1,35 @@
+{ stdenv, fetchurl, intltool, openssl, expat, libgcrypt }:
+
+stdenv.mkDerivation rec {
+  version = "0.99.5";
+  baseName = "ggz-base-libs";
+  name = "${baseName}-snapshot-${version}";
+
+  src = fetchurl {
+    url = "http://mirrors.ibiblio.org/pub/mirrors/ggzgamingzone/ggz/snapshots/${name}.tar.gz";
+    sha256 = "1cw1vg0fbj36zyggnzidx9cbjwfc1yr4zqmsipxnvns7xa2awbdk";
+  };
+
+  buildInputs = [ intltool openssl expat libgcrypt ];
+
+  patchPhase = ''
+    substituteInPlace configure \
+      --replace "/usr/local/ssl/include" "${openssl.dev}/include" \
+      --replace "/usr/local/ssl/lib" "${openssl.out}/lib"
+  '';
+
+  configureFlags = [
+    "--with-tls"
+  ];
+
+  meta = with stdenv.lib; {
+    description = "GGZ Gaming zone libraries";
+    maintainers = with maintainers;
+    [
+      raskin
+    ];
+    platforms = platforms.linux;
+    license = licenses.gpl2;
+    downloadPage = "http://www.ggzgamingzone.org/releases/";
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/giblib/default.nix b/nixpkgs/pkgs/development/libraries/giblib/default.nix
new file mode 100644
index 000000000000..b166a69043e8
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/giblib/default.nix
@@ -0,0 +1,36 @@
+{ stdenv, fetchurl, xlibsWrapper, imlib2 }:
+
+stdenv.mkDerivation rec {
+  name = "giblib-1.2.4";
+
+  src = fetchurl {
+    url = "http://linuxbrit.co.uk/downloads/${name}.tar.gz";
+    sha256 = "1b4bmbmj52glq0s898lppkpzxlprq9aav49r06j2wx4dv3212rhp";
+  };
+
+  outputs = [ "out" "dev" ];
+  setOutputFlags = false;
+
+  preConfigure = ''
+    configureFlagsArray+=(
+      --includedir=$dev/include
+    )
+  '';
+
+  buildInputs = [ xlibsWrapper ];
+  propagatedBuildInputs = [ imlib2 ];
+
+  postFixup = ''
+    moveToOutput bin/giblib-config "$dev"
+
+    # Doesn't contain useful stuff
+    rm -rf $out/share/doc
+  '';
+
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/giflib/4.1.nix b/nixpkgs/pkgs/development/libraries/giflib/4.1.nix
new file mode 100644
index 000000000000..941a7c27feaf
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/giflib/4.1.nix
@@ -0,0 +1,20 @@
+{stdenv, fetchurl}:
+
+stdenv.mkDerivation {
+  name = "giflib-4.1.6";
+
+  src = fetchurl {
+    url = mirror://sourceforge/giflib/giflib-4.1.6.tar.bz2;
+    sha256 = "1v9b7ywz7qg8hli0s9vv1b8q9xxb2xvqq2mg1zpr73xwqpcwxhg1";
+  };
+
+  hardeningDisable = [ "format" ];
+
+  meta = with stdenv.lib; {
+    description = "A library for reading and writing gif images";
+    branch = "4.1";
+    license = licenses.mit;
+    platforms = platforms.unix;
+  };
+}
+
diff --git a/nixpkgs/pkgs/development/libraries/giflib/5.1.nix b/nixpkgs/pkgs/development/libraries/giflib/5.1.nix
new file mode 100644
index 000000000000..fee760b3ea26
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/giflib/5.1.nix
@@ -0,0 +1,18 @@
+{stdenv, fetchurl, xmlto, docbook_xml_dtd_412, docbook_xsl, libxml2 }:
+
+stdenv.mkDerivation {
+  name = "giflib-5.1.4";
+  src = fetchurl {
+    url = mirror://sourceforge/giflib/giflib-5.1.4.tar.bz2;
+    sha256 = "1md83dip8rf29y40cm5r7nn19705f54iraz6545zhwa6y8zyq9yz";
+  };
+
+  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; [ fuuzetsu ];
+    branch = "5.1";
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/giflib/libungif.nix b/nixpkgs/pkgs/development/libraries/giflib/libungif.nix
new file mode 100644
index 000000000000..6336d30aebad
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/giflib/libungif.nix
@@ -0,0 +1,17 @@
+{stdenv, fetchurl}:
+
+stdenv.mkDerivation {
+  name = "libungif-4.1.4";
+  src = fetchurl {
+    url = mirror://sourceforge/giflib/libungif-4.1.4.tar.gz;
+    sha256 = "5e65e1e5deacd0cde489900dbf54c6c2ee2ebc818199e720dbad685d87abda3d";
+  };
+
+  hardeningDisable = [ "format" ];
+
+  meta = with stdenv.lib; {
+    description = "Library and utilities for processing GIFs";
+    platforms = platforms.unix;
+    license = licenses.mit;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gio-sharp/default.nix b/nixpkgs/pkgs/development/libraries/gio-sharp/default.nix
new file mode 100644
index 000000000000..b0a115eb4a51
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gio-sharp/default.nix
@@ -0,0 +1,30 @@
+{ stdenv, fetchFromGitHub, autoconf, automake, which, pkgconfig, mono, gtk-sharp-2_0 }:
+
+stdenv.mkDerivation rec {
+  name = "gio-sharp-${version}";
+  version = "0.3";
+
+  src = fetchFromGitHub {
+    owner = "mono";
+    repo = "gio-sharp";
+
+    rev = "${version}";
+    sha256 = "13pc529pjabj7lq23dbndc26ssmg5wkhc7lfvwapm87j711m0zig";
+  };
+
+  nativeBuildInputs = [ pkgconfig autoconf automake which ];
+  buildInputs = [ mono gtk-sharp-2_0 ];
+
+  dontStrip = true;
+
+  prePatch = ''
+    ./autogen-2.22.sh
+  '';
+
+  meta = with stdenv.lib; {
+    description = "GIO API bindings";
+    homepage = https://github.com/mono/gio-sharp;
+    license = licenses.mit;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/git2/0.27.nix b/nixpkgs/pkgs/development/libraries/git2/0.27.nix
new file mode 100644
index 000000000000..510f53f24b17
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/git2/0.27.nix
@@ -0,0 +1,36 @@
+{ stdenv, fetchFromGitHub, cmake, pkgconfig, python
+, zlib, libssh2, openssl, http-parser, curl
+, libiconv, Security
+}:
+
+stdenv.mkDerivation rec {
+  version = "0.27.8";
+  name = "libgit2-${version}";
+
+  src = fetchFromGitHub {
+    owner = "libgit2";
+    repo = "libgit2";
+    rev = "v${version}";
+    sha256 = "0wzx8nkyy9m7mx6cks58chjd4289vjsw97mxm9w6f1ggqsfnmbr9";
+  };
+
+  cmakeFlags = [ "-DTHREADSAFE=ON" ];
+
+  nativeBuildInputs = [ cmake python pkgconfig ];
+
+  buildInputs = [ zlib libssh2 openssl http-parser curl ]
+    ++ stdenv.lib.optional stdenv.isDarwin Security;
+
+  propagatedBuildInputs = stdenv.lib.optional (!stdenv.isLinux) libiconv;
+
+  enableParallelBuilding = true;
+
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/git2/default.nix b/nixpkgs/pkgs/development/libraries/git2/default.nix
new file mode 100644
index 000000000000..358fc31fc80f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/git2/default.nix
@@ -0,0 +1,38 @@
+{ stdenv, fetchFromGitHub, pkgconfig, cmake
+, zlib, python, libssh2, openssl, curl, http-parser
+, libiconv, Security
+}:
+
+stdenv.mkDerivation (rec {
+  name = "libgit2-${version}";
+  version = "0.26.6";
+  # keep the version in sync with pythonPackages.pygit2 and libgit2-glib
+
+  src = fetchFromGitHub {
+    owner = "libgit2";
+    repo = "libgit2";
+    rev = "v${version}";
+    sha256 = "17pjvprmdrx4h6bb1hhc98w9qi6ki7yl57f090n9kbhswxqfs7s3";
+  };
+
+  cmakeFlags = [ "-DTHREADSAFE=ON" ];
+
+  nativeBuildInputs = [ cmake python pkgconfig ];
+
+  buildInputs = [ zlib libssh2 openssl http-parser curl ]
+    ++ stdenv.lib.optional stdenv.isDarwin Security;
+
+  propagatedBuildInputs = stdenv.lib.optional (!stdenv.isLinux) [ libiconv ];
+
+  enableParallelBuilding = true;
+
+  doCheck = false; # hangs. or very expensive?
+
+  meta = with stdenv.lib; {
+    description = "The Git linkable library";
+    homepage = https://libgit2.github.com/;
+    license = licenses.gpl2;
+    platforms = with platforms; all;
+  };
+} // stdenv.lib.optionalAttrs (!stdenv.isLinux) {
+})
diff --git a/nixpkgs/pkgs/development/libraries/givaro/3.7.nix b/nixpkgs/pkgs/development/libraries/givaro/3.7.nix
new file mode 100644
index 000000000000..3101bc64333e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/givaro/3.7.nix
@@ -0,0 +1,19 @@
+{stdenv, fetchurl, automake, autoconf, libtool, autoreconfHook, gmpxx}:
+stdenv.mkDerivation rec {
+  name = "${pname}-${version}";
+  pname = "givaro";
+  version = "3.7.2";
+  src = fetchurl {
+    url = "https://forge.imag.fr/frs/download.php/370/givaro-${version}.tar.gz";
+    sha256 = "0lf5cnbyr27fw7klc3zabkb1979dn67jmrjz6pa3jzw2ng74x9b3";
+  };
+  nativeBuildInputs = [ autoreconfHook ];
+  buildInputs = [autoconf automake libtool gmpxx];
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/givaro/3.nix b/nixpkgs/pkgs/development/libraries/givaro/3.nix
new file mode 100644
index 000000000000..d73a448f1662
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/givaro/3.nix
@@ -0,0 +1,19 @@
+{stdenv, fetchurl, automake, autoconf, libtool, autoreconfHook, gmpxx}:
+stdenv.mkDerivation rec {
+  name = "${pname}-${version}";
+  pname = "givaro";
+  version = "3.8.0";
+  src = fetchurl {
+    url = "https://forge.imag.fr/frs/download.php/592/givaro-${version}.tar.gz";
+    sha256 = "1822ksv8653a84hvcz0vxl3nk8dqz7d41ys8rplq0zjjmvb2i5yq";
+  };
+  nativeBuildInputs = [ autoreconfHook ];
+  buildInputs = [autoconf automake libtool gmpxx];
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/givaro/default.nix b/nixpkgs/pkgs/development/libraries/givaro/default.nix
new file mode 100644
index 000000000000..0221b9c70133
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/givaro/default.nix
@@ -0,0 +1,45 @@
+{ stdenv, fetchFromGitHub, automake, autoconf, libtool, autoreconfHook, gmpxx }:
+stdenv.mkDerivation rec {
+  name = "${pname}-${version}";
+  pname = "givaro";
+  version = "4.1.0";
+  src = fetchFromGitHub {
+    owner = "linbox-team";
+    repo = "${pname}";
+    rev = "v${version}";
+    sha256 = "1l1172c964hni66mjdmhr7766l5k7y63zs3hgcpr10a8f1nx3iwp";
+  };
+
+  enableParallelBuilding = true;
+
+  nativeBuildInputs = [ autoreconfHook ];
+  buildInputs = [autoconf automake libtool gmpxx];
+
+  configureFlags = [
+    "--disable-optimization"
+  ] ++ stdenv.lib.optionals stdenv.isx86_64 {
+    # disable SIMD instructions (which are enabled *when available* by default)
+    "default"        = [ "--disable-sse3" "--disable-ssse3" "--disable-sse41" "--disable-sse42" "--disable-avx" "--disable-avx2" "--disable-fma" "--disable-fma4" ];
+    "westmere"       = [                                                                        "--disable-avx" "--disable-avx2" "--disable-fma" "--disable-fma4" ];
+    "sandybridge"    = [                                                                                        "--disable-avx2" "--disable-fma" "--disable-fma4" ];
+    "ivybridge"      = [                                                                                        "--disable-avx2" "--disable-fma" "--disable-fma4" ];
+    "haswell"        = [                                                                                                                         "--disable-fma4" ];
+    "broadwell"      = [                                                                                                                         "--disable-fma4" ];
+    "skylake"        = [                                                                                                                         "--disable-fma4" ];
+    "skylake-avx512" = [                                                                                                                         "--disable-fma4" ];
+  }.${stdenv.hostPlatform.platform.gcc.arch or "default"};
+
+  # On darwin, tests are linked to dylib in the nix store, so we need to make
+  # sure tests run after installPhase.
+  doInstallCheck = true;
+  installCheckTarget = "check";
+  doCheck = false;
+
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/glbinding/default.nix b/nixpkgs/pkgs/development/libraries/glbinding/default.nix
new file mode 100644
index 000000000000..60778df663a0
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/glbinding/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, fetchFromGitHub, cmake, libGLU, xlibsWrapper }:
+stdenv.mkDerivation rec {
+  name = "${pname}-${version}";
+  pname = "glbinding";
+  version = "3.0.2";
+
+  src = fetchFromGitHub {
+    owner = "cginternals";
+    repo = pname;
+    rev = "v${version}";
+    sha256 = "1lvcps0n0p8gg0p2bkm5aq4b4kv8bvxlaaf4fcham2pgbgzil9d4";
+  };
+
+  buildInputs = [ cmake libGLU xlibsWrapper ];
+
+  meta = with stdenv.lib; {
+    homepage = https://github.com/cginternals/glbinding/;
+    description = "A C++ binding for the OpenGL API, generated using the gl.xml specification";
+    license = licenses.mit;
+    maintainers = [ maintainers.mt-caret ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gle/default.nix b/nixpkgs/pkgs/development/libraries/gle/default.nix
new file mode 100644
index 000000000000..dd72637f2eb0
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gle/default.nix
@@ -0,0 +1,18 @@
+{stdenv, fetchurl, libGLU_combined, freeglut, libX11, libXt, libXmu, libXi, libXext}:
+stdenv.mkDerivation {
+  name = "gle-3.1.0";
+  buildInputs = [libGLU_combined freeglut libX11 libXt libXmu libXi libXext];
+  src = fetchurl {
+    urls = [
+      "mirror://sourceforge/project/gle/gle/gle-3.1.0/gle-3.1.0.tar.gz"
+      "https://www.linas.org/gle/pub/gle-3.1.0.tar.gz"
+      ];
+    sha256 = "09zs1di4dsssl9k322nzildvf41jwipbzhik9p43yb1bcfsp92nw";
+  };
+  meta = {
+    description = ''Tubing and extrusion library'';
+    license = stdenv.lib.licenses.gpl2 ;
+    maintainers = [stdenv.lib.maintainers.raskin];
+    platforms = stdenv.lib.platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/glew/1.10.nix b/nixpkgs/pkgs/development/libraries/glew/1.10.nix
new file mode 100644
index 000000000000..b265cfcc0168
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/glew/1.10.nix
@@ -0,0 +1,51 @@
+{ stdenv, fetchurl, libGLU, xlibsWrapper, libXmu, libXi
+, AGL ? null
+}:
+
+with stdenv.lib;
+
+stdenv.mkDerivation rec {
+  name = "glew-1.10.0";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/glew/${name}.tgz";
+    sha256 = "01zki46dr5khzlyywr3cg615bcal32dazfazkf360s1znqh17i4r";
+  };
+
+  buildInputs = [ xlibsWrapper libXmu libXi ]
+              ++ optionals stdenv.isDarwin [ AGL ];
+  propagatedBuildInputs = [ libGLU ]; # GL/glew.h includes GL/glu.h
+
+  patchPhase = ''
+    sed -i 's|lib64|lib|' config/Makefile.linux
+    ${optionalString (stdenv.hostPlatform != stdenv.buildPlatform) ''
+    sed -i -e 's/\(INSTALL.*\)-s/\1/' Makefile
+    ''}
+  '';
+
+  buildFlags = [ "all" ];
+  installFlags = [ "install.all" ];
+
+  preInstall = ''
+    export GLEW_DEST="$out"
+  '';
+
+  postInstall = ''
+    mkdir -pv $out/share/doc/glew
+    mkdir -p $out/lib/pkgconfig
+    cp glew*.pc $out/lib/pkgconfig
+    cp -r README.txt LICENSE.txt doc $out/share/doc/glew
+  '';
+
+  makeFlags = [
+    "SYSTEM=${if stdenv.hostPlatform.isMinGW then "mingw" else stdenv.hostPlatform.parsed.kernel.name}"
+  ];
+
+  meta = with stdenv.lib; {
+    description = "An OpenGL extension loading library for C(++)";
+    homepage = http://glew.sourceforge.net/;
+    license = licenses.free; # different files under different licenses
+      #["BSD" "GLX" "SGI-B" "GPL2"]
+    platforms = platforms.mesaPlatforms;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/glew/default.nix b/nixpkgs/pkgs/development/libraries/glew/default.nix
new file mode 100644
index 000000000000..ec56c544cac3
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/glew/default.nix
@@ -0,0 +1,55 @@
+{ stdenv, fetchurl, libGLU, xlibsWrapper, libXmu, libXi
+}:
+
+with stdenv.lib;
+
+stdenv.mkDerivation rec {
+  name = "glew-2.1.0";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/glew/${name}.tgz";
+    sha256 = "159wk5dc0ykjbxvag5i1m2mhp23zkk6ra04l26y3jc3nwvkr3ph4";
+  };
+
+  outputs = [ "bin" "out" "dev" "doc" ];
+
+  buildInputs = [ xlibsWrapper libXmu libXi ];
+  propagatedBuildInputs = [ libGLU ]; # GL/glew.h includes GL/glu.h
+
+  patchPhase = ''
+    sed -i 's|lib64|lib|' config/Makefile.linux
+    substituteInPlace config/Makefile.darwin --replace /usr/local "$out"
+    ${optionalString (stdenv.hostPlatform != stdenv.buildPlatform) ''
+      sed -i -e 's/\(INSTALL.*\)-s/\1/' Makefile
+    ''}
+  '';
+
+  buildFlags = [ "all" ];
+  installFlags = [ "install.all" ];
+
+  preInstall = ''
+    makeFlagsArray+=(GLEW_DEST=$out BINDIR=$bin/bin INCDIR=$dev/include/GL)
+  '';
+
+  postInstall = ''
+    mkdir -pv $out/share/doc/glew
+    mkdir -p $out/lib/pkgconfig
+    cp glew*.pc $out/lib/pkgconfig
+    cp -r README.md LICENSE.txt doc $out/share/doc/glew
+    rm $out/lib/*.a
+  '';
+
+  makeFlags = [
+    "SYSTEM=${if stdenv.hostPlatform.isMinGW then "mingw" else stdenv.hostPlatform.parsed.kernel.name}"
+  ];
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    description = "An OpenGL extension loading library for C(++)";
+    homepage = http://glew.sourceforge.net/;
+    license = licenses.free; # different files under different licenses
+      #["BSD" "GLX" "SGI-B" "GPL2"]
+    platforms = platforms.mesaPlatforms;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/glfw/2.x.nix b/nixpkgs/pkgs/development/libraries/glfw/2.x.nix
new file mode 100644
index 000000000000..b1118b473b6f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/glfw/2.x.nix
@@ -0,0 +1,31 @@
+{ stdenv, fetchurl, libGLU, libGL, libX11, libXext }:
+
+stdenv.mkDerivation rec {
+  name = "glfw-2.7.9";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/glfw/${name}.tar.bz2";
+    sha256 = "17c2msdcb7pn3p8f83805h1c216bmdqnbn9hgzr1j8wnwjcpxx6i";
+  };
+
+  buildInputs = [ libGLU libGL libX11 libXext ];
+
+  buildPhase = ''
+    make x11
+  '';
+
+  installPhase = ''
+    mkdir -p $out
+    make x11-dist-install PREFIX=$out
+    mv $out/lib/libglfw.so $out/lib/libglfw.so.2
+    ln -s libglfw.so.2 $out/lib/libglfw.so
+  ''; 
+  
+  meta = with stdenv.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 ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/glfw/3.x.nix b/nixpkgs/pkgs/development/libraries/glfw/3.x.nix
new file mode 100644
index 000000000000..668fe436e915
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/glfw/3.x.nix
@@ -0,0 +1,43 @@
+{ stdenv, lib, fetchFromGitHub, cmake, libGL, libXrandr, libXinerama, libXcursor, libX11
+, cf-private, Cocoa, Kernel, fixDarwinDylibNames
+}:
+
+stdenv.mkDerivation rec {
+  version = "3.2.1";
+  name = "glfw-${version}";
+
+  src = fetchFromGitHub {
+    owner = "glfw";
+    repo = "GLFW";
+    rev = "${version}";
+    sha256 = "0gq6ad38b3azk0w2yy298yz2vmg2jmf9g0ydidqbmiswpk25ills";
+  };
+
+  enableParallelBuilding = true;
+
+  propagatedBuildInputs = [ libGL ];
+
+  nativeBuildInputs = [ cmake ];
+
+  buildInputs = [
+    libX11 libXrandr libXinerama libXcursor
+  ] ++ lib.optionals stdenv.isDarwin [
+    Cocoa Kernel fixDarwinDylibNames
+    # Needed for NSDefaultRunLoopMode symbols.
+    cf-private
+  ];
+
+  cmakeFlags = [ "-DBUILD_SHARED_LIBS=ON" ];
+
+  preConfigure  = lib.optional (!stdenv.isDarwin) ''
+    substituteInPlace src/glx_context.c --replace "libGL.so.1" "${lib.getLib libGL}/lib/libGL.so.1"
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Multi-platform library for creating OpenGL contexts and managing input, including keyboard, mouse, joystick and time";
+    homepage = http://www.glfw.org/;
+    license = licenses.zlib;
+    maintainers = with maintainers; [ marcweber ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/glib-networking/default.nix b/nixpkgs/pkgs/development/libraries/glib-networking/default.nix
new file mode 100644
index 000000000000..a51183e4e11a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/glib-networking/default.nix
@@ -0,0 +1,49 @@
+{ stdenv, fetchurl, meson, ninja, pkgconfig, glib, gettext, python3, gnutls, p11-kit, libproxy, gnome3
+, gsettings-desktop-schemas }:
+
+let
+  pname = "glib-networking";
+  version = "2.60.2";
+in
+stdenv.mkDerivation rec {
+  name = "${pname}-${version}";
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${name}.tar.xz";
+    sha256 = "0cl74q7hvq4xqqc88vlzmfw1sh5n9hdh1yvn2v1vg9am1z8z68n0";
+  };
+
+  outputs = [ "out" "dev" ]; # to deal with propagatedBuildInputs
+
+  PKG_CONFIG_GIO_2_0_GIOMODULEDIR = "${placeholder "out"}/lib/gio/modules";
+
+  postPatch = ''
+    chmod +x meson_post_install.py # patchShebangs requires executable file
+    patchShebangs meson_post_install.py
+  '';
+
+  nativeBuildInputs = [
+    meson ninja pkgconfig gettext
+    python3 # install_script
+  ];
+  propagatedBuildInputs = [ glib gnutls p11-kit libproxy gsettings-desktop-schemas ];
+
+  mesonFlags = [
+    # Default auto detection doesn't work
+    "-Dgnutls=enabled"
+  ];
+
+  doCheck = false; # tests need to access the certificates (among other things)
+
+  passthru = {
+    updateScript = gnome3.updateScript {
+      packageName = pname;
+    };
+  };
+
+  meta = with stdenv.lib; {
+    description = "Network-related giomodules for glib";
+    license = licenses.lgpl2Plus;
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/glib/darwin-compilation.patch b/nixpkgs/pkgs/development/libraries/glib/darwin-compilation.patch
new file mode 100644
index 000000000000..f215eef798af
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/glib/darwin-compilation.patch
@@ -0,0 +1,24 @@
+Fix compilation on Mac OS X with gcc 4.8.
+
+diff -ru glib-2.40.0-orig/gio/gdummyfile.c glib-2.40.0/gio/gdummyfile.c
+--- glib-2.40.0-orig/gio/gdummyfile.c   2014-02-03 18:40:41.000000000 +0100
++++ glib-2.40.0/gio/gdummyfile.c        2014-07-15 10:58:31.000000000 +0200
+@@ -454,7 +454,8 @@
+   result = g_malloc (escaped_string_end - escaped_string + 1);
+        
+   out = result;
+-  for (in = escaped_string; in < escaped_string_end; in++) 
++  in = escaped_string;
++  for (; in < escaped_string_end; in++) 
+     {
+       character = *in;
+       if (*in == '%') 
+@@ -551,6 +552,7 @@
+   
+   decoded->scheme = g_malloc (p - uri);
+   out = decoded->scheme;
+-  for (in = uri; in < p - 1; in++)
++  in = uri;
++  for (; in < p - 1; in++)
+     *out++ = g_ascii_tolower (*in);
+   *out = 0;
diff --git a/nixpkgs/pkgs/development/libraries/glib/default.nix b/nixpkgs/pkgs/development/libraries/glib/default.nix
new file mode 100644
index 000000000000..a2c7bdc5bde6
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/glib/default.nix
@@ -0,0 +1,195 @@
+{ config, stdenv, fetchurl, fetchpatch, gettext, meson, ninja, pkgconfig, perl, python3, glibcLocales
+, libiconv, zlib, libffi, pcre, libelf, gnome3, libselinux, bash, gnum4, gtk-doc, docbook_xsl, docbook_xml_dtd_45
+# use utillinuxMinimal to avoid circular dependency (utillinux, systemd, glib)
+, utillinuxMinimal ? null
+, buildPackages
+
+# this is just for tests (not in the closure of any regular package)
+, doCheck ? config.doCheckByDefault or false
+, coreutils, dbus, libxml2, tzdata
+, desktop-file-utils, shared-mime-info
+, darwin
+}:
+
+with stdenv.lib;
+
+assert stdenv.isLinux -> utillinuxMinimal != null;
+
+# TODO:
+# * Add gio-module-fam
+#     Problem: cyclic dependency on gamin
+#     Possible solution: build as a standalone module, set env. vars
+# * Make it build without python
+#     Problem: an example (test?) program needs it.
+#     Possible solution: disable compilation of this example somehow
+#     Reminder: add 'sed -e 's@python2\.[0-9]@python@' -i
+#       $out/bin/gtester-report' to postInstall if this is solved
+/*
+  * Use --enable-installed-tests for GNOME-related packages,
+      and use them as a separately installed tests runned by Hydra
+      (they should test an already installed package)
+      https://wiki.gnome.org/GnomeGoals/InstalledTests
+  * Support org.freedesktop.Application, including D-Bus activation from desktop files
+*/
+let
+  # Some packages don't get "Cflags" from pkgconfig correctly
+  # and then fail to build when directly including like <glib/...>.
+  # This is intended to be run in postInstall of any package
+  # which has $out/include/ containing just some disjunct directories.
+  flattenInclude = ''
+    for dir in "''${!outputInclude}"/include/*; do
+      cp -r "$dir"/* "''${!outputInclude}/include/"
+      rm -r "$dir"
+      ln -s . "$dir"
+    done
+    ln -sr -t "''${!outputInclude}/include/" "''${!outputInclude}"/lib/*/include/* 2>/dev/null || true
+  '';
+
+  binPrograms = optional (!stdenv.isDarwin) "gapplication" ++ [ "gdbus" "gio" "gsettings" ];
+  version = "2.60.3";
+in
+
+stdenv.mkDerivation rec {
+  name = "glib-${version}";
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/glib/${stdenv.lib.versions.majorMinor version}/${name}.tar.xz";
+    sha256 = "1fb0nx9fcmic8rsh0fbp79lqpasfjxljvnshbw2hsya51mb0vaq4";
+  };
+
+  patches = optional stdenv.isDarwin ./darwin-compilation.patch
+    ++ optional doCheck ./skip-timer-test.patch
+    ++ optionals stdenv.hostPlatform.isMusl [
+      ./quark_init_on_demand.patch
+      ./gobject_init_on_demand.patch
+    ] ++ [
+      ./schema-override-variable.patch
+      # Require substituteInPlace in postPatch
+      ./fix-gio-launch-desktop-path.patch
+    ];
+
+  outputs = [ "bin" "out" "dev" "devdoc" ];
+  outputBin = "dev";
+
+  setupHook = ./setup-hook.sh;
+
+  buildInputs = [
+    libelf setupHook pcre
+    bash gnum4 # install glib-gettextize and m4 macros for other apps to use
+  ] ++ optionals stdenv.isLinux [
+    libselinux
+    utillinuxMinimal # for libmount
+  ] ++ optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [
+    AppKit Carbon Cocoa CoreFoundation CoreServices Foundation
+    # Needed for CFURLCreateFromFSRef, etc. which have deen deprecated
+    # since 10.9 and are not part of swift-corelibs CoreFoundation.
+    darwin.cf-private
+  ]);
+
+  nativeBuildInputs = [
+    meson ninja pkgconfig perl python3 gettext gtk-doc docbook_xsl docbook_xml_dtd_45 glibcLocales
+  ];
+
+  propagatedBuildInputs = [ zlib libffi gettext libiconv ];
+
+  mesonFlags = [
+    # Avoid the need for gobject introspection binaries in PATH in cross-compiling case.
+    # Instead we just copy them over from the native output.
+    "-Dgtk_doc=${if stdenv.hostPlatform == stdenv.buildPlatform then "true" else "false"}"
+    "-Dnls=enabled"
+  ];
+
+  LC_ALL = "en_US.UTF-8";
+
+  NIX_CFLAGS_COMPILE = (optional stdenv.isSunOS "-DBSD_COMP")
+    ++ [ "-Wno-error=nonnull" ];
+
+  postPatch = ''
+    # substitute fix-gio-launch-desktop-path.patch
+    substituteInPlace gio/gdesktopappinfo.c --replace "@bindir@" "$out/bin"
+
+    chmod +x gio/tests/gengiotypefuncs.py
+    patchShebangs gio/tests/gengiotypefuncs.py
+    patchShebangs glib/gen-unicode-tables.pl
+    patchShebangs tests/gen-casefold-txt.py
+    patchShebangs tests/gen-casemap-txt.py
+  '';
+
+  LIBELF_CFLAGS = optional stdenv.isFreeBSD "-I${libelf}";
+  LIBELF_LIBS = optional stdenv.isFreeBSD "-L${libelf} -lelf";
+
+  DETERMINISTIC_BUILD = 1;
+
+  postInstall = ''
+    mkdir -p $bin/bin
+    for app in ${concatStringsSep " " binPrograms}; do
+      mv "$dev/bin/$app" "$bin/bin"
+    done
+
+  '' + optionalString (!stdenv.isDarwin) ''
+    # Add gio-launch-desktop to $out so we can refer to it from $dev
+    mkdir $out/bin
+    mv "$dev/bin/gio-launch-desktop" "$out/bin/"
+    ln -s "$out/bin/gio-launch-desktop" "$bin/bin/"
+
+  '' + ''
+    moveToOutput "share/glib-2.0" "$dev"
+    substituteInPlace "$dev/bin/gdbus-codegen" --replace "$out" "$dev"
+    sed -i "$dev/bin/glib-gettextize" -e "s|^gettext_dir=.*|gettext_dir=$dev/share/glib-2.0/gettext|"
+
+    # This file is *included* in gtk3 and would introduce runtime reference via __FILE__.
+    sed '1i#line 1 "${name}/include/glib-2.0/gobject/gobjectnotifyqueue.c"' \
+      -i "$dev"/include/glib-2.0/gobject/gobjectnotifyqueue.c
+  '' + optionalString (stdenv.hostPlatform != stdenv.buildPlatform) ''
+    cp -r ${buildPackages.glib.devdoc} $devdoc
+  '';
+
+  checkInputs = [ tzdata libxml2 desktop-file-utils shared-mime-info ];
+
+  preCheck = optionalString doCheck ''
+    export LD_LIBRARY_PATH="$NIX_BUILD_TOP/${name}/glib/.libs:$LD_LIBRARY_PATH"
+    export TZDIR="${tzdata}/share/zoneinfo"
+    export XDG_CACHE_HOME="$TMP"
+    export XDG_RUNTIME_HOME="$TMP"
+    export HOME="$TMP"
+    export XDG_DATA_DIRS="${desktop-file-utils}/share:${shared-mime-info}/share"
+    export G_TEST_DBUS_DAEMON="${dbus.daemon}/bin/dbus-daemon"
+    export PATH="$PATH:$(pwd)/gobject"
+    echo "PATH=$PATH"
+
+    substituteInPlace gio/tests/desktop-files/home/applications/epiphany-weather-for-toronto-island-9c6a4e022b17686306243dada811d550d25eb1fb.desktop \
+      --replace "Exec=/bin/true" "Exec=${coreutils}/bin/true"
+    # Needs machine-id, comment the test
+    sed -e '/\/gdbus\/codegen-peer-to-peer/ s/^\/*/\/\//' -i gio/tests/gdbus-peer.c
+    sed -e '/g_test_add_func/ s/^\/*/\/\//' -i gio/tests/gdbus-unix-addresses.c
+    # All gschemas fail to pass the test, upstream bug?
+    sed -e '/g_test_add_data_func/ s/^\/*/\/\//' -i gio/tests/gschema-compile.c
+    # Cannot reproduce the failing test_associations on hydra
+    sed -e '/\/appinfo\/associations/d' -i gio/tests/appinfo.c
+    # Needed because of libtool wrappers
+    sed -e '/g_subprocess_launcher_set_environ (launcher, envp);/a g_subprocess_launcher_setenv (launcher, "PATH", g_getenv("PATH"), TRUE);' -i gio/tests/gsubprocess.c
+  '';
+
+  inherit doCheck;
+
+  passthru = {
+    gioModuleDir = "lib/gio/modules";
+    inherit flattenInclude;
+    updateScript = gnome3.updateScript { packageName = "glib"; };
+  };
+
+  meta = with stdenv.lib; {
+    description = "C library of programming buildings blocks";
+    homepage    = https://www.gtk.org/;
+    license     = licenses.lgpl21Plus;
+    maintainers = with maintainers; [ lovek323 raskin ];
+    platforms   = platforms.unix;
+
+    longDescription = ''
+      GLib provides the core application building blocks for libraries
+      and applications written in C.  It provides the core object
+      system used in GNOME, the main loop implementation, and a large
+      set of utility functions for strings and common data structures.
+    '';
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/glib/fix-gio-launch-desktop-path.patch b/nixpkgs/pkgs/development/libraries/glib/fix-gio-launch-desktop-path.patch
new file mode 100644
index 000000000000..4fdec2dd7e7d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/glib/fix-gio-launch-desktop-path.patch
@@ -0,0 +1,11 @@
+--- a/gio/gdesktopappinfo.c
++++ b/gio/gdesktopappinfo.c
+@@ -2725,7 +2725,7 @@ g_desktop_app_info_launch_uris_with_spawn (GDesktopAppInfo            *info,
+ 
+           /* Fall back on usual searching in $PATH */
+           if (tmp == NULL)
+-            tmp = "gio-launch-desktop";
++            tmp = "@bindir@/gio-launch-desktop";
+           g_once_init_leave (&gio_launch_desktop_path, tmp);
+         }
+ 
diff --git a/nixpkgs/pkgs/development/libraries/glib/gobject_init_on_demand.patch b/nixpkgs/pkgs/development/libraries/glib/gobject_init_on_demand.patch
new file mode 100644
index 000000000000..d72d0b61dca2
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/glib/gobject_init_on_demand.patch
@@ -0,0 +1,87 @@
+--- glib-source/gobject/gtype.c	2016-08-17 17:20:47.000000000 +0200
++++ glib-source/gobject/gtype.c	2016-09-01 21:56:31.777406646 +0200
+@@ -209,6 +209,9 @@
+ static gboolean				type_node_is_a_L		(TypeNode		*node,
+ 									 TypeNode		*iface_node);
+ 
++#if !defined(__GLIBC__)
++static void gobject_init (void);
++#endif
+ 
+ /* --- enumeration --- */
+ 
+@@ -2631,7 +2634,10 @@
+ 			     GTypeFlags			 flags)
+ {
+   TypeNode *node;
+-  
++ 
++#if !defined(__GLIBC__)
++  gobject_init();
++#endif 
+   g_assert_type_system_initialized ();
+   g_return_val_if_fail (type_id > 0, 0);
+   g_return_val_if_fail (type_name != NULL, 0);
+@@ -2749,6 +2755,9 @@
+   TypeNode *pnode, *node;
+   GType type = 0;
+   
++#if !defined(__GLIBC__)
++  gobject_init();
++#endif 
+   g_assert_type_system_initialized ();
+   g_return_val_if_fail (parent_type > 0, 0);
+   g_return_val_if_fail (type_name != NULL, 0);
+@@ -2804,6 +2813,9 @@
+   TypeNode *pnode, *node;
+   GType type;
+   
++#if !defined(__GLIBC__)
++  gobject_init();
++#endif 
+   g_assert_type_system_initialized ();
+   g_return_val_if_fail (parent_type > 0, 0);
+   g_return_val_if_fail (type_name != NULL, 0);
+@@ -3319,6 +3331,9 @@
+ {
+   TypeNode *node;
+   
++#if !defined(__GLIBC__)
++  gobject_init();
++#endif 
+   g_assert_type_system_initialized ();
+   
+   node = lookup_type_node_I (type);
+@@ -4343,6 +4358,9 @@
+ void
+ g_type_init_with_debug_flags (GTypeDebugFlags debug_flags)
+ {
++#if !defined(__GLIBC__)
++  gobject_init();
++#endif 
+   g_assert_type_system_initialized ();
+ 
+   if (debug_flags)
+@@ -4361,6 +4379,9 @@
+ void
+ g_type_init (void)
+ {
++#if !defined(__GLIBC__)
++  gobject_init();
++#endif 
+   g_assert_type_system_initialized ();
+ }
+ 
+@@ -4372,6 +4393,12 @@
+   TypeNode *node;
+   GType type;
+ 
++#if !defined(__GLIBC__)
++  static int gobject_initialized = 0;
++  if (gobject_initialized)
++    return;
++  gobject_initialized = 1;
++#endif
+   /* Ensure GLib is initialized first, see
+    * https://bugzilla.gnome.org/show_bug.cgi?id=756139
+    */
diff --git a/nixpkgs/pkgs/development/libraries/glib/quark_init_on_demand.patch b/nixpkgs/pkgs/development/libraries/glib/quark_init_on_demand.patch
new file mode 100644
index 000000000000..168086484314
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/glib/quark_init_on_demand.patch
@@ -0,0 +1,33 @@
+--- glib-source/glib/gquark.c	2016-08-17 17:20:47.000000000 +0200
++++ glib-source/glib/gquark.c	2016-08-30 07:49:13.298234757 +0200
+@@ -57,6 +57,9 @@
+ void
+ g_quark_init (void)
+ {
++  if (quark_ht)
++    return;
++
+   g_assert (quark_seq_id == 0);
+   quark_ht = g_hash_table_new (g_str_hash, g_str_equal);
+   quarks = g_new (gchar*, QUARK_BLOCK_SIZE);
+@@ -138,9 +141,12 @@
+     return 0;
+ 
+   G_LOCK (quark_global);
++#if !defined(__GLIBC__)
++  g_quark_init ();
++#endif
+   quark = GPOINTER_TO_UINT (g_hash_table_lookup (quark_ht, string));
+   G_UNLOCK (quark_global);
+
+   return quark;
+ }
+ 
+@@ -280,6 +286,7 @@
+   GQuark quark;
+   gchar **quarks_new;
+ 
++  g_quark_init ();
+   if (quark_seq_id % QUARK_BLOCK_SIZE == 0)
+     {
+       quarks_new = g_new (gchar*, quark_seq_id + QUARK_BLOCK_SIZE);
diff --git a/nixpkgs/pkgs/development/libraries/glib/schema-override-variable.patch b/nixpkgs/pkgs/development/libraries/glib/schema-override-variable.patch
new file mode 100644
index 000000000000..1cb5a730351b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/glib/schema-override-variable.patch
@@ -0,0 +1,12 @@
+--- a/gio/gsettingsschema.c
++++ b/gio/gsettingsschema.c
+@@ -352,6 +352,9 @@
+ 
+       try_prepend_data_dir (g_get_user_data_dir ());
+ 
++      if ((path = g_getenv ("NIX_GSETTINGS_OVERRIDES_DIR")) != NULL)
++        try_prepend_dir (path);
++
+       if ((path = g_getenv ("GSETTINGS_SCHEMA_DIR")) != NULL)
+         try_prepend_dir (path);
+ 
diff --git a/nixpkgs/pkgs/development/libraries/glib/setup-hook.sh b/nixpkgs/pkgs/development/libraries/glib/setup-hook.sh
new file mode 100644
index 000000000000..a1cb1f40c58a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/glib/setup-hook.sh
@@ -0,0 +1,25 @@
+
+make_glib_find_gsettings_schemas() {
+    # For packages that need gschemas of other packages (e.g. empathy)
+    if [ -d "$1"/share/gsettings-schemas/*/glib-2.0/schemas ]; then
+        addToSearchPath GSETTINGS_SCHEMAS_PATH "$1/share/gsettings-schemas/"*
+    fi
+}
+addEnvHooks "$hostOffset" make_glib_find_gsettings_schemas
+
+# Install gschemas, if any, in a package-specific directory
+glibPreInstallPhase() {
+  makeFlagsArray+=("gsettingsschemadir=${!outputLib}/share/gsettings-schemas/$name/glib-2.0/schemas/")
+}
+preInstallPhases+=" glibPreInstallPhase"
+
+glibPreFixupPhase() {
+    # Move gschemas in case the install flag didn't help
+    if [ -d "$prefix/share/glib-2.0/schemas" ]; then
+        mkdir -p "${!outputLib}/share/gsettings-schemas/$name/glib-2.0"
+        mv "$prefix/share/glib-2.0/schemas" "${!outputLib}/share/gsettings-schemas/$name/glib-2.0/"
+    fi
+
+    addToSearchPath GSETTINGS_SCHEMAS_PATH "${!outputLib}/share/gsettings-schemas/$name"
+}
+preFixupPhases+=" glibPreFixupPhase"
diff --git a/nixpkgs/pkgs/development/libraries/glib/skip-timer-test.patch b/nixpkgs/pkgs/development/libraries/glib/skip-timer-test.patch
new file mode 100644
index 000000000000..942f3e7864c4
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/glib/skip-timer-test.patch
@@ -0,0 +1,17 @@
+Description: Skip test which performs some unreliable floating point comparisons
+Forwarded: https://bugzilla.gnome.org/show_bug.cgi?id=722604
+
+Index: b/glib/tests/timer.c
+===================================================================
+--- a/glib/tests/timer.c
++++ b/glib/tests/timer.c
+@@ -203,7 +203,7 @@
+ {
+   g_test_init (&argc, &argv, NULL);
+ 
+-  g_test_add_func ("/timer/basic", test_timer_basic);
++/*  g_test_add_func ("/timer/basic", test_timer_basic);*/
+-  g_test_add_func ("/timer/stop", test_timer_stop);
++/*  g_test_add_func ("/timer/stop", test_timer_stop);*/
+   g_test_add_func ("/timer/continue", test_timer_continue);
+   g_test_add_func ("/timer/reset", test_timer_reset);
diff --git a/nixpkgs/pkgs/development/libraries/glibc/allow-kernel-2.6.32.patch b/nixpkgs/pkgs/development/libraries/glibc/allow-kernel-2.6.32.patch
new file mode 100644
index 000000000000..ce18b874c427
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/glibc/allow-kernel-2.6.32.patch
@@ -0,0 +1,39 @@
+diff --git a/sysdeps/unix/sysv/linux/configure b/sysdeps/unix/sysv/linux/configure
+index cace758c01..38fe7fe0b0 100644
+--- a/sysdeps/unix/sysv/linux/configure
++++ b/sysdeps/unix/sysv/linux/configure
+@@ -69,7 +69,7 @@ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for kernel header at least $minimum_kernel" >&5
+ $as_echo_n "checking for kernel header at least $minimum_kernel... " >&6; }
+ decnum=`echo "$minimum_kernel.0.0.0" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/(\1 * 65536 + \2 * 256 + \3)/'`;
+-abinum=`echo "$minimum_kernel.0.0.0" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1,\2,\3/'`;
++abinum=`echo "2.6.32.0.0.0" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1,\2,\3/'`;
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ #include <linux/version.h>
+diff --git a/sysdeps/unix/sysv/linux/configure.ac b/sysdeps/unix/sysv/linux/configure.ac
+index 13abda0a51..6abc12eaed 100644
+--- a/sysdeps/unix/sysv/linux/configure.ac
++++ b/sysdeps/unix/sysv/linux/configure.ac
+@@ -50,7 +50,7 @@ fi
+ AC_MSG_CHECKING(for kernel header at least $minimum_kernel)
+ changequote(,)dnl
+ decnum=`echo "$minimum_kernel.0.0.0" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/(\1 * 65536 + \2 * 256 + \3)/'`;
+-abinum=`echo "$minimum_kernel.0.0.0" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1,\2,\3/'`;
++abinum=`echo "2.6.32.0.0.0" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1,\2,\3/'`;
+ changequote([,])dnl
+ AC_TRY_COMPILE([#include <linux/version.h>
+ #if LINUX_VERSION_CODE < $decnum
+diff --git a/sysdeps/unix/sysv/linux/dl-osinfo.h b/sysdeps/unix/sysv/linux/dl-osinfo.h
+index 823cd8224d..482caaeeec 100644
+--- a/sysdeps/unix/sysv/linux/dl-osinfo.h
++++ b/sysdeps/unix/sysv/linux/dl-osinfo.h
+@@ -39,7 +39,7 @@
+ 	  GLRO(dl_osversion) = version;					      \
+ 									      \
+ 	/* Now we can test with the required version.  */		      \
+-	if (__LINUX_KERNEL_VERSION > 0 && version < __LINUX_KERNEL_VERSION)   \
++	if (__LINUX_KERNEL_VERSION > 0 && version < __LINUX_KERNEL_VERSION && version != 0x020620)   \
+ 	  /* Not sufficent.  */						      \
+ 	  FATAL ("FATAL: kernel too old\n");				      \
+       }									      \
diff --git a/nixpkgs/pkgs/development/libraries/glibc/common.nix b/nixpkgs/pkgs/development/libraries/glibc/common.nix
new file mode 100644
index 000000000000..33c8e5076daa
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/glibc/common.nix
@@ -0,0 +1,221 @@
+/* Build configuration used to build glibc, Info files, and locale
+   information.
+
+   Note that this derivation has multiple outputs and does not respect the
+   standard convention of putting the executables into the first output. The
+   first output is `lib` so that the libraries provided by this derivation
+   can be accessed directly, e.g.
+
+     "${pkgs.glibc}/lib/ld-linux-x86_64.so.2"
+
+   The executables are put into `bin` output and need to be referenced via
+   the `bin` attribute of the main package, e.g.
+
+     "${pkgs.glibc.bin}/bin/ldd".
+
+  The executables provided by glibc typically include `ldd`, `locale`, `iconv`
+  but the exact set depends on the library version and the configuration.
+*/
+
+{ stdenv, lib
+, buildPackages
+, fetchurl ? null
+, linuxHeaders ? null
+, gd ? null, libpng ? null
+, bison
+}:
+
+{ name
+, withLinuxHeaders ? false
+, profilingLibraries ? false
+, withGd ? false
+, meta
+, ...
+} @ args:
+
+let
+  version = "2.27";
+  patchSuffix = "";
+  sha256 = "0wpwq7gsm7sd6ysidv0z575ckqdg13cr2njyfgrbgh4f65adwwji";
+in
+
+assert withLinuxHeaders -> linuxHeaders != null;
+assert withGd -> gd != null && libpng != null;
+
+stdenv.mkDerivation ({
+  inherit version;
+  linuxHeaders = if withLinuxHeaders then linuxHeaders else null;
+
+  inherit (stdenv) is64bit;
+
+  enableParallelBuilding = true;
+
+  patches =
+    [
+      /* Have rpcgen(1) look for cpp(1) in $PATH.  */
+      ./rpcgen-path.patch
+
+      /* Allow NixOS and Nix to handle the locale-archive. */
+      ./nix-locale-archive.patch
+
+      /* Don't use /etc/ld.so.cache, for non-NixOS systems.  */
+      ./dont-use-system-ld-so-cache.patch
+
+      /* Don't use /etc/ld.so.preload, but /etc/ld-nix.so.preload.  */
+      ./dont-use-system-ld-so-preload.patch
+
+      /* The command "getconf CS_PATH" returns the default search path
+         "/bin:/usr/bin", which is inappropriate on NixOS machines. This
+         patch extends the search path by "/run/current-system/sw/bin". */
+      ./fix_path_attribute_in_getconf.patch
+
+      /* Allow running with RHEL 6 -like kernels.  The patch adds an exception
+        for glibc to accept 2.6.32 and to tag the ELFs as 2.6.32-compatible
+        (otherwise the loader would refuse libc).
+        Note that glibc will fully work only on their heavily patched kernels
+        and we lose early mismatch detection on 2.6.32.
+
+        On major glibc updates we should check that the patched kernel supports
+        all the required features.  ATM it's verified up to glibc-2.26-131.
+        # HOWTO: check glibc sources for changes in kernel requirements
+        git log -p glibc-2.25.. sysdeps/unix/sysv/linux/x86_64/kernel-features.h sysdeps/unix/sysv/linux/kernel-features.h
+        # get kernel sources (update the URL)
+        mkdir tmp && cd tmp
+        curl http://vault.centos.org/6.9/os/Source/SPackages/kernel-2.6.32-696.el6.src.rpm | rpm2cpio - | cpio -idmv
+        tar xf linux-*.bz2
+        # check syscall presence, for example
+        less linux-*?/arch/x86/kernel/syscall_table_32.S
+       */
+      ./allow-kernel-2.6.32.patch
+      /* Provide utf-8 locales by default, so we can use it in stdenv without depending on our large locale-archive. */
+      (fetchurl {
+        url = "https://salsa.debian.org/glibc-team/glibc/raw/49767c9f7de4828220b691b29de0baf60d8a54ec/debian/patches/localedata/locale-C.diff";
+        sha256 = "0irj60hs2i91ilwg5w7sqrxb695c93xg0ik7yhhq9irprd7fidn4";
+      })
+    ]
+    ++ lib.optional stdenv.isx86_64 ./fix-x64-abi.patch
+    ++ lib.optional stdenv.hostPlatform.isMusl ./fix-rpc-types-musl-conflicts.patch
+    ++ lib.optional stdenv.buildPlatform.isDarwin ./darwin-cross-build.patch;
+
+  postPatch =
+    ''
+      # Needed for glibc to build with the gnumake 3.82
+      # http://comments.gmane.org/gmane.linux.lfs.support/31227
+      sed -i 's/ot \$/ot:\n\ttouch $@\n$/' manual/Makefile
+
+      # nscd needs libgcc, and we don't want it dynamically linked
+      # because we don't want it to depend on bootstrap-tools libs.
+      echo "LDFLAGS-nscd += -static-libgcc" >> nscd/Makefile
+    '';
+
+  configureFlags =
+    [ "-C"
+      "--enable-add-ons"
+      "--enable-obsolete-nsl"
+      "--enable-obsolete-rpc"
+      "--sysconfdir=/etc"
+      "--enable-stackguard-randomization"
+      (lib.withFeatureAs withLinuxHeaders "headers" "${linuxHeaders}/include")
+      (lib.enableFeature profilingLibraries "profile")
+    ] ++ lib.optionals withLinuxHeaders [
+      "--enable-kernel=3.2.0" # can't get below with glibc >= 2.26
+    ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
+      (lib.flip lib.withFeature "fp"
+         (stdenv.hostPlatform.platform.gcc.float or (stdenv.hostPlatform.parsed.abi.float or "hard") == "soft"))
+      "--with-__thread"
+    ] ++ lib.optionals (stdenv.hostPlatform == stdenv.buildPlatform && stdenv.hostPlatform.isAarch32) [
+      "--host=arm-linux-gnueabi"
+      "--build=arm-linux-gnueabi"
+
+      # To avoid linking with -lgcc_s (dynamic link)
+      # so the glibc does not depend on its compiler store path
+      "libc_cv_as_needed=no"
+    ] ++ lib.optional withGd "--with-gd";
+
+  installFlags = [ "sysconfdir=$(out)/etc" ];
+
+  outputs = [ "out" "bin" "dev" "static" ];
+
+  depsBuildBuild = [ buildPackages.stdenv.cc ];
+  nativeBuildInputs = [ bison ];
+  buildInputs = [ linuxHeaders ] ++ lib.optionals withGd [ gd libpng ];
+
+  # Needed to install share/zoneinfo/zone.tab.  Set to impure /bin/sh to
+  # prevent a retained dependency on the bootstrap tools in the stdenv-linux
+  # bootstrap.
+  BASH_SHELL = "/bin/sh";
+
+  passthru = { inherit version; };
+}
+
+// (removeAttrs args [ "withLinuxHeaders" "withGd" ]) //
+
+{
+  name = name + "-${version}${patchSuffix}";
+
+  src = fetchurl {
+    url = "mirror://gnu/glibc/glibc-${version}.tar.xz";
+    inherit sha256;
+  };
+
+  # Remove absolute paths from `configure' & co.; build out-of-tree.
+  preConfigure = ''
+    export PWD_P=$(type -tP pwd)
+    for i in configure io/ftwtest-sh; do
+        # Can't use substituteInPlace here because replace hasn't been
+        # built yet in the bootstrap.
+        sed -i "$i" -e "s^/bin/pwd^$PWD_P^g"
+    done
+
+    mkdir ../build
+    cd ../build
+
+    configureScript="`pwd`/../$sourceRoot/configure"
+
+    ${lib.optionalString (stdenv.cc.libc != null)
+      ''makeFlags="$makeFlags BUILD_LDFLAGS=-Wl,-rpath,${stdenv.cc.libc}/lib"''
+    }
+
+
+  '' + lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) ''
+    sed -i s/-lgcc_eh//g "../$sourceRoot/Makeconfig"
+
+    cat > config.cache << "EOF"
+    libc_cv_forced_unwind=yes
+    libc_cv_c_cleanup=yes
+    libc_cv_gnu89_inline=yes
+    EOF
+  '';
+
+  preBuild = lib.optionalString withGd "unset NIX_DONT_SET_RPATH";
+
+  doCheck = false; # fails
+
+  meta = {
+    homepage = https://www.gnu.org/software/libc/;
+    description = "The GNU C Library";
+
+    longDescription =
+      '' Any Unix-like operating system needs a C library: the library which
+         defines the "system calls" and other basic facilities such as
+         open, malloc, printf, exit...
+
+         The GNU C library is used as the C library in the GNU system and
+         most systems with the Linux kernel.
+      '';
+
+    license = lib.licenses.lgpl2Plus;
+
+    maintainers = [ lib.maintainers.eelco ];
+    platforms = lib.platforms.linux;
+  } // meta;
+}
+
+// lib.optionalAttrs (stdenv.hostPlatform != stdenv.buildPlatform) {
+  preInstall = null; # clobber the native hook
+
+  # To avoid a dependency on the build system 'bash'.
+  preFixup = ''
+    rm -f $bin/bin/{ldd,tzselect,catchsegv,xtrace}
+  '';
+})
diff --git a/nixpkgs/pkgs/development/libraries/glibc/darwin-cross-build.patch b/nixpkgs/pkgs/development/libraries/glibc/darwin-cross-build.patch
new file mode 100644
index 000000000000..7b224924104b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/glibc/darwin-cross-build.patch
@@ -0,0 +1,103 @@
+enable cross-compilation of glibc on Darwin (build=Darwin, host=Linux)
+* increase ulimit for open files: macOS default of 256 is too low for glibc build system
+* use host version of ar, which is given by environment variable
+* build system uses stamp.os and stamp.oS files, which only differ in case;
+  this fails on macOS, so replace .oS with .o_S
+* libintl.h does not exist (and is not needed) on macOS
+
+--- glibc-2.27/Makefile.in	2018-02-01 17:17:18.000000000 +0100
++++ glibc-2.27/Makefile.in	2019-02-15 17:38:27.022965553 +0100
+@@ -6,9 +6,11 @@
+ .PHONY: all install bench
+ 
+ all .DEFAULT:
+-	$(MAKE) -r PARALLELMFLAGS="$(PARALLELMFLAGS)" -C $(srcdir) objdir=`pwd` $@
++	ulimit -n 1024; \
++	$(MAKE) -r AR=$$AR PARALLELMFLAGS="$(PARALLELMFLAGS)" -C $(srcdir) objdir=`pwd` $@
+ 
+ install:
++	ulimit -n 1024; \
+ 	LC_ALL=C; export LC_ALL; \
+ 	$(MAKE) -r PARALLELMFLAGS="$(PARALLELMFLAGS)" -C $(srcdir) objdir=`pwd` $@
+ 
+--- glibc-2.27/Makerules	2018-02-01 17:17:18.000000000 +0100
++++ glibc-2.27/Makerules	2019-02-15 17:43:11.196039000 +0100
+@@ -915,8 +915,8 @@
+ ifndef objects
+ 
+ # Create the stamp$o files to keep the parent makefile happy.
+-subdir_lib: $(foreach o,$(object-suffixes-for-libc),$(objpfx)stamp$o)
+-$(foreach o,$(object-suffixes-for-libc),$(objpfx)stamp$o):
++subdir_lib: $(foreach o,$(object-suffixes-for-libc),$(objpfx)stamp$(subst .oS,.o_S,$o))
++$(foreach o,$(object-suffixes-for-libc),$(objpfx)stamp$(subst .oS,.o_S,$o)):
+ 	$(make-target-directory)
+ 	rm -f $@; > $@
+ else
+@@ -927,7 +927,7 @@
+ # The parent will then actually add them all to the archive in the
+ # archive rule, below.
+ define o-iterator-doit
+-$(objpfx)stamp$o: $(o-objects); $$(do-stamp)
++$(objpfx)stamp$(subst .oS,.o_S,$o): $(o-objects); $$(do-stamp)
+ endef
+ define do-stamp
+ $(make-target-directory)
+@@ -943,14 +943,14 @@
+ # on the stamp files built above.
+ define o-iterator-doit
+ $(common-objpfx)$(patsubst %,$(libtype$o),c): \
+-		$(subdirs-stamp-o) $(common-objpfx)stamp$o; $$(do-makelib)
++		$(subdirs-stamp-o) $(common-objpfx)stamp$(subst .oS,.o_S,$o); $$(do-makelib)
+ endef
+ define do-makelib
+ cd $(common-objdir) && \
+ $(AR) $(CREATE_ARFLAGS) $(@F) `cat $(patsubst $(common-objpfx)%,%,$^)`
+ endef
+ subdirs-stamps := $(foreach d,$(subdirs),$(common-objpfx)$d/stamp%)
+-subdirs-stamp-o = $(subst %,$o,$(subdirs-stamps))
++subdirs-stamp-o = $(subst %,$(subst .oS,.o_S,$o),$(subdirs-stamps))
+ ifndef subdir
+ $(subdirs-stamps): subdir_lib;
+ endif
+@@ -961,7 +961,7 @@
+ # This makes all the object files.
+ .PHONY: objects objs libobjs extra-objs
+ objects objs: libobjs extra-objs
+-libobjs: $(foreach o,$(object-suffixes-for-libc),$(objpfx)stamp$o)
++libobjs: $(foreach o,$(object-suffixes-for-libc),$(objpfx)stamp$(subst .oS,.o_S,$o))
+ extra-objs: $(addprefix $(objpfx),$(extra-objs))
+ 
+ # Canned sequence for building an extra library archive.
+@@ -1615,7 +1615,7 @@
+ 	$(rmobjs)
+ define rmobjs
+ $(foreach o,$(object-suffixes-for-libc),
+--rm -f $(objpfx)stamp$o $(o-objects))
++-rm -f $(objpfx)stamp$(subst .oS,.o_S,$o) $(o-objects))
+ endef
+ 
+ # Also remove the dependencies and generated source files.
+--- glibc-2.27/sunrpc/rpc_main.c	2019-02-15 17:32:43.710244513 +0100
++++ glibc-2.27/sunrpc/rpc_main.c	2019-02-15 17:23:57.139617796 +0100
+@@ -38,7 +38,9 @@
+ #include <stdio.h>
+ #include <string.h>
+ #include <unistd.h>
++#ifndef __APPLE__
+ #include <libintl.h>
++#endif
+ #include <locale.h>
+ #include <ctype.h>
+ #include <sys/types.h>
+--- glibc-2.27/sunrpc/rpc_scan.c	2019-02-15 17:32:54.845490606 +0100
++++ glibc-2.27/sunrpc/rpc_scan.c	2019-02-15 17:24:54.288066644 +0100
+@@ -37,7 +37,9 @@
+ #include <stdio.h>
+ #include <ctype.h>
+ #include <string.h>
++#ifndef __APPLE__
+ #include <libintl.h>
++#endif
+ #include "rpc_scan.h"
+ #include "rpc_parse.h"
+ #include "rpc_util.h"
diff --git a/nixpkgs/pkgs/development/libraries/glibc/default.nix b/nixpkgs/pkgs/development/libraries/glibc/default.nix
new file mode 100644
index 000000000000..444d6c458fb6
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/glibc/default.nix
@@ -0,0 +1,128 @@
+{ stdenv, callPackage
+, withLinuxHeaders ? true
+, profilingLibraries ? false
+, withGd ? false
+, buildPackages
+}:
+
+callPackage ./common.nix { inherit stdenv; } {
+    name = "glibc" + stdenv.lib.optionalString withGd "-gd";
+
+    inherit withLinuxHeaders profilingLibraries withGd;
+
+    # Note:
+    # Things you write here override, and do not add to,
+    # the values in `common.nix`.
+    # (For example, if you define `patches = [...]` here, it will
+    # override the patches in `common.nix`.)
+
+    NIX_NO_SELF_RPATH = true;
+
+    postConfigure = ''
+      # Hack: get rid of the `-static' flag set by the bootstrap stdenv.
+      # This has to be done *after* `configure' because it builds some
+      # test binaries.
+      export NIX_CFLAGS_LINK=
+      export NIX_LDFLAGS_BEFORE=
+
+      export NIX_DONT_SET_RPATH=1
+      unset CFLAGS
+
+      # Apparently --bindir is not respected.
+      makeFlagsArray+=("bindir=$bin/bin" "sbindir=$bin/sbin" "rootsbindir=$bin/sbin")
+    '';
+
+    # The stackprotector and fortify hardening flags are autodetected by glibc
+    # and enabled by default if supported. Setting it for every gcc invocation
+    # does not work.
+    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";
+
+    # When building glibc from bootstrap-tools, we need libgcc_s at RPATH for
+    # any program we run, because the gcc will have been placed at a new
+    # store path than that determined when built (as a source for the
+    # bootstrap-tools tarball)
+    # Building from a proper gcc staying in the path where it was installed,
+    # libgcc_s will not be at {gcc}/lib, and gcc's libgcc will be found without
+    # any special hack.
+    preInstall = ''
+      if [ -f ${stdenv.cc.cc}/lib/libgcc_s.so.1 ]; then
+          mkdir -p $out/lib
+          cp ${stdenv.cc.cc}/lib/libgcc_s.so.1 $out/lib/libgcc_s.so.1
+          # the .so It used to be a symlink, but now it is a script
+          cp -a ${stdenv.cc.cc}/lib/libgcc_s.so $out/lib/libgcc_s.so
+      fi
+    '';
+
+    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 ''
+      # 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 \
+        --alias-file=../intl/locale.alias \
+        -i locales/C \
+        -f charmaps/UTF-8 \
+        --prefix $NIX_BUILD_TOP \
+        ${if stdenv.hostPlatform.parsed.cpu.significantByte.name == "littleEndian" then
+            "--little-endian"
+          else
+            "--big-endian"} \
+        C.UTF-8
+      cp -r $NIX_BUILD_TOP/${buildPackages.glibc}/lib/locale $out/lib
+      popd
+    '') + ''
+
+      test -f $out/etc/ld.so.cache && rm $out/etc/ld.so.cache
+
+      if test -n "$linuxHeaders"; then
+          # Include the Linux kernel headers in Glibc, except the `scsi'
+          # subdirectory, which Glibc provides itself.
+          (cd $dev/include && \
+           ln -sv $(ls -d $linuxHeaders/include/* | grep -v scsi\$) .)
+      fi
+
+      # Fix for NIXOS-54 (ldd not working on x86_64).  Make a symlink
+      # "lib64" to "lib".
+      if test -n "$is64bit"; then
+          ln -s lib $out/lib64
+      fi
+
+      # Get rid of more unnecessary stuff.
+      rm -rf $out/var $bin/bin/sln
+    ''
+      # 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) ''
+
+      for i in "$out"/lib/*.a; do
+          [ "$i" = "$out/lib/libm.a" ] || $STRIP -S "$i"
+      done
+    '' + ''
+
+      # Put libraries for static linking in a separate output.  Note
+      # that libc_nonshared.a and libpthread_nonshared.a are required
+      # for dynamically-linked applications.
+      mkdir -p $static/lib
+      mv $out/lib/*.a $static/lib
+      mv $static/lib/lib*_nonshared.a $out/lib
+      # Some of *.a files are linker scripts where moving broke the paths.
+      sed "/^GROUP/s|$out/lib/lib|$static/lib/lib|g" \
+        -i "$static"/lib/*.a
+
+      # Work around a Nix bug: hard links across outputs cause a build failure.
+      cp $bin/bin/getconf $bin/bin/getconf_
+      mv $bin/bin/getconf_ $bin/bin/getconf
+    '';
+
+    separateDebugInfo = true;
+
+    meta.description = "The GNU C Library";
+  }
diff --git a/nixpkgs/pkgs/development/libraries/glibc/dont-use-system-ld-so-cache.patch b/nixpkgs/pkgs/development/libraries/glibc/dont-use-system-ld-so-cache.patch
new file mode 100644
index 000000000000..f84b1049adf8
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/glibc/dont-use-system-ld-so-cache.patch
@@ -0,0 +1,46 @@
+diff -Naur glibc-2.27-orig/elf/ldconfig.c glibc-2.27/elf/ldconfig.c
+--- glibc-2.27-orig/elf/ldconfig.c	2018-02-01 11:17:18.000000000 -0500
++++ glibc-2.27/elf/ldconfig.c	2018-02-17 22:43:17.232175182 -0500
+@@ -51,7 +51,7 @@
+ #endif
+ 
+ #ifndef LD_SO_CONF
+-# define LD_SO_CONF SYSCONFDIR "/ld.so.conf"
++# define LD_SO_CONF PREFIX "/etc/ld.so.conf"
+ #endif
+ 
+ /* Get libc version number.  */
+diff -Naur glibc-2.27-orig/elf/Makefile glibc-2.27/elf/Makefile
+--- glibc-2.27-orig/elf/Makefile	2018-02-01 11:17:18.000000000 -0500
++++ glibc-2.27/elf/Makefile	2018-02-17 22:44:50.334006750 -0500
+@@ -559,13 +559,13 @@
+ 
+ $(objpfx)ldconfig: $(ldconfig-modules:%=$(objpfx)%.o)
+ 
+-SYSCONF-FLAGS := -D'SYSCONFDIR="$(sysconfdir)"'
+-CFLAGS-ldconfig.c += $(SYSCONF-FLAGS) -D'LIBDIR="$(libdir)"' \
++PREFIX-FLAGS := -D'PREFIX="$(prefix)"'
++CFLAGS-ldconfig.c += $(PREFIX-FLAGS) -D'LIBDIR="$(libdir)"' \
+ 		    -D'SLIBDIR="$(slibdir)"'
+ libof-ldconfig = ldconfig
+-CFLAGS-dl-cache.c += $(SYSCONF-FLAGS)
+-CFLAGS-cache.c += $(SYSCONF-FLAGS)
+-CFLAGS-rtld.c += $(SYSCONF-FLAGS)
++CFLAGS-dl-cache.c += $(PREFIX-FLAGS)
++CFLAGS-cache.c += $(PREFIX-FLAGS)
++CFLAGS-rtld.c += $(PREFIX-FLAGS)
+ 
+ cpp-srcs-left := $(all-rtld-routines:=.os)
+ lib := rtld
+diff -Naur glibc-2.27-orig/sysdeps/generic/dl-cache.h glibc-2.27/sysdeps/generic/dl-cache.h
+--- glibc-2.27-orig/sysdeps/generic/dl-cache.h	2018-02-01 11:17:18.000000000 -0500
++++ glibc-2.27/sysdeps/generic/dl-cache.h	2018-02-17 22:45:20.471598816 -0500
+@@ -28,7 +28,7 @@
+ #endif
+ 
+ #ifndef LD_SO_CACHE
+-# define LD_SO_CACHE SYSCONFDIR "/ld.so.cache"
++# define LD_SO_CACHE PREFIX "/etc/ld.so.cache"
+ #endif
+ 
+ #ifndef add_system_dir
diff --git a/nixpkgs/pkgs/development/libraries/glibc/dont-use-system-ld-so-preload.patch b/nixpkgs/pkgs/development/libraries/glibc/dont-use-system-ld-so-preload.patch
new file mode 100644
index 000000000000..894e2a11cf87
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/glibc/dont-use-system-ld-so-preload.patch
@@ -0,0 +1,12 @@
+diff -ru glibc-2.20-orig/elf/rtld.c glibc-2.20/elf/rtld.c
+--- glibc-2.20-orig/elf/rtld.c	2014-09-07 10:09:09.000000000 +0200
++++ glibc-2.20/elf/rtld.c	2014-10-27 11:32:25.203043157 +0100
+@@ -1513,7 +1513,7 @@
+      open().  So we do this first.  If it succeeds we do almost twice
+      the work but this does not matter, since it is not for production
+      use.  */
+-  static const char preload_file[] = "/etc/ld.so.preload";
++  static const char preload_file[] = "/etc/ld-nix.so.preload";
+   if (__glibc_unlikely (__access (preload_file, R_OK) == 0))
+     {
+       /* Read the contents of the file.  */
diff --git a/nixpkgs/pkgs/development/libraries/glibc/fix-rpc-types-musl-conflicts.patch b/nixpkgs/pkgs/development/libraries/glibc/fix-rpc-types-musl-conflicts.patch
new file mode 100644
index 000000000000..19f8bfc7cce8
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/glibc/fix-rpc-types-musl-conflicts.patch
@@ -0,0 +1,38 @@
+@@ -, +, @@ 
+---
+ sunrpc/rpc/types.h | 22 ++++++----------------
+ 1 file changed, 6 insertions(+), 16 deletions(-)
+--- a/sunrpc/rpc/types.h	
++++ a/sunrpc/rpc/types.h	
+@@ -69,24 +69,14 @@ typedef unsigned long rpcport_t;
+ #include <sys/types.h>
+ #endif
+ 
+-#if defined __APPLE_CC__ || defined __FreeBSD__
+-# define __u_char_defined
+-# define __daddr_t_defined
+-#endif
+-
+-#ifndef __u_char_defined
+-typedef __u_char u_char;
+-typedef __u_short u_short;
+-typedef __u_int u_int;
+-typedef __u_long u_long;
+-typedef __quad_t quad_t;
+-typedef __u_quad_t u_quad_t;
+-typedef __fsid_t fsid_t;
++/* IMPORTANT NOTE: This has been modified to build against the musl C
++ * library and it probably now ONLY builds with the musl C library.
++ *
++ * See: https://sourceware.org/bugzilla/show_bug.cgi?id=21604
++ */
+ # define __u_char_defined
+-#endif
+ #ifndef __daddr_t_defined
+-typedef __daddr_t daddr_t;
+-typedef __caddr_t caddr_t;
++typedef int daddr_t;
+ # define __daddr_t_defined
+ #endif
+ 
+-- 
diff --git a/nixpkgs/pkgs/development/libraries/glibc/fix-x64-abi.patch b/nixpkgs/pkgs/development/libraries/glibc/fix-x64-abi.patch
new file mode 100644
index 000000000000..1d60dcd7988b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/glibc/fix-x64-abi.patch
@@ -0,0 +1,35 @@
+From 3288c6da64add3b4561b8c10fff522027caea01c Mon Sep 17 00:00:00 2001
+From: Nicholas Miell <nmiell@gmail.com>
+Date: Sat, 17 Jun 2017 18:21:07 -0700
+Subject: [PATCH] Align the stack on entry to __tls_get_addr()
+
+Old versions of gcc (4 & 5) didn't align the stack according to the
+AMD64 psABI when calling __tls_get_addr(). Apparently new versions of
+gcc (7) got much more aggressive about vectorizing and generating MOVAPS
+instructions, which means old binaries built with the buggy versions of
+gcc are much more likely to crash when using versions of glibc built
+using gcc 7.
+
+For example, a large number of Linux games built using the Unity game
+engine and available for purchase on Steam.
+---
+ elf/dl-tls.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/elf/dl-tls.c b/elf/dl-tls.c
+index 5aba33b3fa..3f3cb917de 100644
+--- a/elf/dl-tls.c
++++ b/elf/dl-tls.c
+@@ -827,6 +827,10 @@ rtld_hidden_proto (__tls_get_addr)
+ rtld_hidden_def (__tls_get_addr)
+ #endif
+
++#ifdef __x86_64__
++/* Old versions of gcc didn't align the stack. */
++__attribute__((force_align_arg_pointer))
++#endif
+ /* The generic dynamic and local dynamic model cannot be used in
+    statically linked applications.  */
+ void *
+--
+2.13.0
diff --git a/nixpkgs/pkgs/development/libraries/glibc/fix_path_attribute_in_getconf.patch b/nixpkgs/pkgs/development/libraries/glibc/fix_path_attribute_in_getconf.patch
new file mode 100644
index 000000000000..714e49db5607
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/glibc/fix_path_attribute_in_getconf.patch
@@ -0,0 +1,6 @@
+diff -ubr glibc-2.17-orig/sysdeps/unix/confstr.h glibc-2.17/sysdeps/unix/confstr.h
+--- glibc-2.17-orig/sysdeps/unix/confstr.h	2013-06-03 22:01:44.829726968 +0200
++++ glibc-2.17/sysdeps/unix/confstr.h	2013-06-03 22:04:39.469376740 +0200
+@@ -1 +1 @@
+-#define	CS_PATH	"/bin:/usr/bin"
++#define	CS_PATH	"/run/current-system/sw/bin:/bin:/usr/bin"
diff --git a/nixpkgs/pkgs/development/libraries/glibc/info.nix b/nixpkgs/pkgs/development/libraries/glibc/info.nix
new file mode 100644
index 000000000000..5cb004cc870d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/glibc/info.nix
@@ -0,0 +1,23 @@
+{ callPackage, texinfo, perl }:
+
+callPackage ./common.nix {} {
+  name = "glibc-info";
+
+  outputs = [ "out" ];
+
+  configureFlags = [ "--enable-add-ons" ];
+
+  buildInputs = [ texinfo perl ];
+
+  buildPhase = "make info";
+
+  # I don't know why the info is not generated in 'build'
+  # Somehow building the info still does not work, because the final
+  # libc.info hasn't a Top node.
+  installPhase = ''
+    mkdir -p "$out/share/info"
+    cp -v "manual/"*.info* "$out/share/info"
+  '';
+
+  meta.description = "GNU Info manual of the GNU C Library";
+}
diff --git a/nixpkgs/pkgs/development/libraries/glibc/locales-builder.sh b/nixpkgs/pkgs/development/libraries/glibc/locales-builder.sh
new file mode 100644
index 000000000000..d732e208fa22
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/glibc/locales-builder.sh
@@ -0,0 +1,17 @@
+# Glibc cannot have itself in its RPATH.
+export NIX_NO_SELF_RPATH=1
+
+source $stdenv/setup
+
+postConfigure() {
+    # Hack: get rid of the `-static' flag set by the bootstrap stdenv.
+    # This has to be done *after* `configure' because it builds some
+    # test binaries.
+    export NIX_CFLAGS_LINK=
+    export NIX_LDFLAGS_BEFORE=
+
+    export NIX_DONT_SET_RPATH=1
+    unset CFLAGS
+}
+
+genericBuild
diff --git a/nixpkgs/pkgs/development/libraries/glibc/locales.nix b/nixpkgs/pkgs/development/libraries/glibc/locales.nix
new file mode 100644
index 000000000000..0dc191974155
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/glibc/locales.nix
@@ -0,0 +1,68 @@
+/* This function builds just the `lib/locale/locale-archive' file from
+   Glibc and nothing else.  If `allLocales' is true, all supported
+   locales are included; otherwise, just the locales listed in
+   `locales'.  See localedata/SUPPORTED in the Glibc source tree for
+   the list of all supported locales:
+   https://sourceware.org/git/?p=glibc.git;a=blob;f=localedata/SUPPORTED
+*/
+
+{ stdenv, buildPackages, callPackage, writeText
+, allLocales ? true, locales ? [ "en_US.UTF-8/UTF-8" ]
+}:
+
+callPackage ./common.nix { inherit stdenv; } {
+  name = "glibc-locales";
+
+  builder = ./locales-builder.sh;
+
+  outputs = [ "out" ];
+
+  # Awful hack: `localedef' doesn't allow the path to `locale-archive'
+  # to be overriden, but you *can* specify a prefix, i.e. it will use
+  # <prefix>/<path-to-glibc>/lib/locale/locale-archive.  So we use
+  # $TMPDIR as a prefix, meaning that the locale-archive is placed in
+  # $TMPDIR/nix/store/...-glibc-.../lib/locale/locale-archive.
+  buildPhase =
+    ''
+      mkdir -p $TMPDIR/"${buildPackages.stdenv.cc.libc.out}/lib/locale"
+
+      echo 'C.UTF-8/UTF-8 \' >> ../glibc-2*/localedata/SUPPORTED
+
+      # 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) ''
+      # Check that all locales to be built are supported
+      echo -n '${stdenv.lib.concatMapStrings (s: s + " \\\n") locales}' \
+        | sort > locales-to-build.txt
+      cat ../glibc-2*/localedata/SUPPORTED | grep ' \\' \
+        | sort > locales-supported.txt
+      comm -13 locales-supported.txt locales-to-build.txt \
+        > locales-unsupported.txt
+      if [[ $(wc -c locales-unsupported.txt) != "0 locales-unsupported.txt" ]]; then
+        cat locales-supported.txt
+        echo "Error: unsupported locales detected:"
+        cat locales-unsupported.txt
+        echo "You should choose from the list above the error."
+        false
+      fi
+
+      echo SUPPORTED-LOCALES='${toString locales}' > ../glibc-2*/localedata/SUPPORTED
+    '' + ''
+      make localedata/install-locales \
+          localedir=$out/lib/locale \
+    '';
+
+  installPhase =
+    ''
+      mkdir -p "$out/lib/locale"
+      cp -v "$TMPDIR/$NIX_STORE/"*"/lib/locale/locale-archive" "$out/lib/locale"
+    '';
+
+  setupHook = writeText "locales-setup-hook.sh"
+    ''
+      export LOCALE_ARCHIVE=@out@/lib/locale/locale-archive
+    '';
+
+  meta.description = "Locale information for the GNU C Library";
+}
diff --git a/nixpkgs/pkgs/development/libraries/glibc/multi.nix b/nixpkgs/pkgs/development/libraries/glibc/multi.nix
new file mode 100644
index 000000000000..5d3626b95cc0
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/glibc/multi.nix
@@ -0,0 +1,28 @@
+{ runCommand, glibc, glibc32
+}:
+
+let
+  nameVersion = builtins.parseDrvName glibc.name;
+  glibc64 = glibc;
+in
+runCommand "${nameVersion.name}-multi-${nameVersion.version}"
+  { outputs = [ "bin" "dev" "out"]; } # TODO: no static version here (yet)
+  ''
+    mkdir -p "$out/lib"
+    ln -s '${glibc64.out}'/lib/* "$out/lib"
+    ln -s '${glibc32.out}/lib' "$out/lib/32"
+    ln -s lib "$out/lib64"
+
+    # fixing ldd RLTDLIST
+    mkdir -p "$bin/bin"
+    cp -s '${glibc64.bin}'/bin/* "$bin/bin/"
+    rm "$bin/bin/ldd"
+    sed -e "s|^RTLDLIST=.*$|RTLDLIST=\"$out/lib/ld-linux-x86-64.so.2 $out/lib/32/ld-linux.so.2\"|g" \
+        '${glibc64.bin}/bin/ldd' > "$bin/bin/ldd"
+    chmod +x "$bin/bin/ldd"
+
+    mkdir "$dev"
+    cp -rs '${glibc32.dev}'/include "$dev/"
+    chmod +w -R "$dev"
+    cp -rsf '${glibc64.dev}'/include "$dev/"
+  ''
diff --git a/nixpkgs/pkgs/development/libraries/glibc/nix-locale-archive.patch b/nixpkgs/pkgs/development/libraries/glibc/nix-locale-archive.patch
new file mode 100644
index 000000000000..39312951fcf9
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/glibc/nix-locale-archive.patch
@@ -0,0 +1,118 @@
+diff -Naur glibc-2.27-orig/locale/loadarchive.c glibc-2.27/locale/loadarchive.c
+--- glibc-2.27-orig/locale/loadarchive.c	2018-02-01 11:17:18.000000000 -0500
++++ glibc-2.27/locale/loadarchive.c	2018-02-17 22:32:25.680169462 -0500
+@@ -123,6 +123,23 @@
+   return MAX (namehash_end, MAX (string_end, locrectab_end));
+ }
+ 
++static int
++open_locale_archive (void)
++{
++  int fd = -1;
++  char *versioned_path = getenv ("LOCALE_ARCHIVE_2_27");
++  char *path = getenv ("LOCALE_ARCHIVE");
++  if (versioned_path)
++    fd = __open_nocancel (versioned_path, O_RDONLY|O_LARGEFILE|O_CLOEXEC);
++  if (path && fd < 0)
++    fd = __open_nocancel (path, O_RDONLY|O_LARGEFILE|O_CLOEXEC);
++  if (fd < 0)
++    fd = __open_nocancel (archfname, O_RDONLY|O_LARGEFILE|O_CLOEXEC);
++  if (fd < 0)
++    fd = __open_nocancel ("/usr/lib/locale/locale-archive", O_RDONLY|O_LARGEFILE|O_CLOEXEC);
++  return fd;
++}
++
+ 
+ /* Find the locale *NAMEP in the locale archive, and return the
+    internalized data structure for its CATEGORY data.  If this locale has
+@@ -202,7 +219,7 @@
+       archmapped = &headmap;
+ 
+       /* The archive has never been opened.  */
+-      fd = __open_nocancel (archfname, O_RDONLY|O_LARGEFILE|O_CLOEXEC);
++      fd = open_locale_archive ();
+       if (fd < 0)
+ 	/* Cannot open the archive, for whatever reason.  */
+ 	return NULL;
+@@ -397,8 +414,7 @@
+ 	  if (fd == -1)
+ 	    {
+ 	      struct stat64 st;
+-	      fd = __open_nocancel (archfname,
+-				    O_RDONLY|O_LARGEFILE|O_CLOEXEC);
++	      fd = open_locale_archive ();
+ 	      if (fd == -1)
+ 		/* Cannot open the archive, for whatever reason.  */
+ 		return NULL;
+diff -Naur glibc-2.27-orig/locale/programs/locale.c glibc-2.27/locale/programs/locale.c
+--- glibc-2.27-orig/locale/programs/locale.c	2018-02-01 11:17:18.000000000 -0500
++++ glibc-2.27/locale/programs/locale.c	2018-02-17 22:36:39.726293213 -0500
+@@ -633,6 +633,24 @@
+ 
+ 
+ static int
++open_locale_archive (void)
++{
++  int fd = -1;
++  char *versioned_path = getenv ("LOCALE_ARCHIVE_2_27");
++  char *path = getenv ("LOCALE_ARCHIVE");
++  if (versioned_path)
++    fd = open64 (versioned_path, O_RDONLY);
++  if (path && fd < 0)
++    fd = open64 (path, O_RDONLY);
++  if (fd < 0)
++    fd = open64 (ARCHIVE_NAME, O_RDONLY);
++  if (fd < 0)
++    fd = open64 ("/usr/lib/locale/locale-archive", O_RDONLY);
++  return fd;
++}
++
++
++static int
+ write_archive_locales (void **all_datap, char *linebuf)
+ {
+   struct stat64 st;
+@@ -644,7 +662,7 @@
+   int fd, ret = 0;
+   uint32_t cnt;
+ 
+-  fd = open64 (ARCHIVE_NAME, O_RDONLY);
++  fd = open_locale_archive ();
+   if (fd < 0)
+     return 0;
+ 
+diff -Naur glibc-2.27-orig/locale/programs/locarchive.c glibc-2.27/locale/programs/locarchive.c
+--- glibc-2.27-orig/locale/programs/locarchive.c	2018-02-01 11:17:18.000000000 -0500
++++ glibc-2.27/locale/programs/locarchive.c	2018-02-17 22:40:51.245293975 -0500
+@@ -117,6 +117,22 @@
+ }
+ 
+ 
++static int
++open_locale_archive (const char * archivefname, int flags)
++{
++  int fd = -1;
++  char *versioned_path = getenv ("LOCALE_ARCHIVE_2_27");
++  char *path = getenv ("LOCALE_ARCHIVE");
++  if (versioned_path)
++    fd = open64 (versioned_path, flags);
++  if (path && fd < 0)
++    fd = open64 (path, flags);
++  if (fd < 0)
++    fd = open64 (archivefname, flags);
++  return fd;
++}
++
++
+ static void
+ create_archive (const char *archivefname, struct locarhandle *ah)
+ {
+@@ -578,7 +594,7 @@
+   while (1)
+     {
+       /* Open the archive.  We must have exclusive write access.  */
+-      fd = open64 (archivefname, readonly ? O_RDONLY : O_RDWR);
++      fd = open_locale_archive (archivefname, readonly ? O_RDONLY : O_RDWR);
+       if (fd == -1)
+ 	{
+ 	  /* Maybe the file does not yet exist? If we are opening
diff --git a/nixpkgs/pkgs/development/libraries/glibc/rpcgen-path.patch b/nixpkgs/pkgs/development/libraries/glibc/rpcgen-path.patch
new file mode 100644
index 000000000000..3349449d9163
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/glibc/rpcgen-path.patch
@@ -0,0 +1,54 @@
+diff -ru glibc-2.18-orig/sunrpc/rpc_main.c glibc-2.18/sunrpc/rpc_main.c
+--- glibc-2.18-orig/sunrpc/rpc_main.c	2013-08-11 00:52:55.000000000 +0200
++++ glibc-2.18/sunrpc/rpc_main.c	2013-11-15 12:04:48.041006977 +0100
+@@ -78,7 +78,7 @@
+ 
+ static const char *svcclosetime = "120";
+ static int cppDefined;	/* explicit path for C preprocessor */
+-static const char *CPP = "/lib/cpp";
++static const char *CPP = "cpp";
+ static const char CPPFLAGS[] = "-C";
+ static char *pathbuf;
+ static int cpp_pid;
+@@ -107,7 +107,6 @@
+ static void open_output (const char *infile, const char *outfile);
+ static void add_warning (void);
+ static void clear_args (void);
+-static void find_cpp (void);
+ static void open_input (const char *infile, const char *define);
+ static int check_nettype (const char *name, const char *list_to_check[]);
+ static void c_output (const char *infile, const char *define,
+@@ -322,25 +321,6 @@
+   argcount = FIXEDARGS;
+ }
+ 
+-/* make sure that a CPP exists */
+-static void
+-find_cpp (void)
+-{
+-  struct stat64 buf;
+-
+-  if (stat64 (CPP, &buf) == 0)
+-    return;
+-
+-  if (cppDefined) /* user specified cpp but it does not exist */
+-    {
+-      fprintf (stderr, _ ("cannot find C preprocessor: %s\n"), CPP);
+-      crash ();
+-    }
+-
+-  /* fall back to system CPP */
+-  CPP = "cpp";
+-}
+-
+ /*
+  * Open input file with given define for C-preprocessor
+  */
+@@ -359,7 +339,6 @@
+   switch (cpp_pid)
+     {
+     case 0:
+-      find_cpp ();
+       putarg (0, CPP);
+       putarg (1, CPPFLAGS);
+       addarg (define);
diff --git a/nixpkgs/pkgs/development/libraries/glibmm/default.nix b/nixpkgs/pkgs/development/libraries/glibmm/default.nix
new file mode 100644
index 000000000000..829dca04c18c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/glibmm/default.nix
@@ -0,0 +1,40 @@
+{ stdenv, fetchurl, pkgconfig, gnum4, glib, libsigcxx, gnome3, darwin }:
+
+stdenv.mkDerivation rec {
+  pname = "glibmm";
+  version = "2.60.0";
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    sha256 = "1g7jxqd270dv2d83r7pf5893mwpz7d5xib0q01na2yalh34v38d3";
+  };
+
+  outputs = [ "out" "dev" ];
+
+  nativeBuildInputs = [ pkgconfig gnum4 ];
+  buildInputs = stdenv.lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [
+    Cocoa
+  ]);
+  propagatedBuildInputs = [ glib libsigcxx ];
+
+  enableParallelBuilding = true;
+
+  doCheck = false; # fails. one test needs the net, another /etc/fstab
+
+  passthru = {
+    updateScript = gnome3.updateScript {
+      packageName = pname;
+    };
+  };
+
+  meta = with stdenv.lib; {
+    description = "C++ interface to the GLib library";
+
+    homepage = https://gtkmm.org/;
+
+    license = licenses.lgpl2Plus;
+
+    maintainers = with maintainers; [raskin];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/glm/default.nix b/nixpkgs/pkgs/development/libraries/glm/default.nix
new file mode 100644
index 000000000000..319a0359c581
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/glm/default.nix
@@ -0,0 +1,52 @@
+{ stdenv, fetchurl, fetchzip, cmake }:
+
+stdenv.mkDerivation rec {
+  version = "0.9.8.5";
+  name = "glm-${version}";
+
+  src = fetchzip {
+    url = "https://github.com/g-truc/glm/releases/download/${version}/${name}.zip";
+    sha256 = "0dkfj4hin3am9fxgcvwr5gj0h9y52x7wa03lfwb3q0bvaj1rsly2";
+  };
+
+  nativeBuildInputs = [ cmake ];
+
+  outputs = [ "out" "doc" ];
+
+  cmakeConfigureFlags = [ "-DGLM_INSTALL_ENABLE=off" ];
+
+  # fetch newer version of platform.h which correctly supports gcc 7.3
+  gcc7PlatformPatch = fetchurl {
+    url = "https://raw.githubusercontent.com/g-truc/glm/384dab02e45a8ad3c1a3fa0906e0d5682c5b27b9/glm/simd/platform.h";
+    sha256 = "0ym0sgwznxhfyi014xs55x3ql7r65fjs34sqb5jiaffkdhkqgzia";
+  };
+
+  postPatch = ''
+    substituteInPlace CMakeLists.txt \
+      --replace '"''${CMAKE_CURRENT_BINARY_DIR}/''${GLM_INSTALL_CONFIGDIR}' '"''${GLM_INSTALL_CONFIGDIR}'
+    cp ${gcc7PlatformPatch} glm/simd/platform.h
+  '';
+
+  NIX_CFLAGS_COMPILE = stdenv.lib.optionals 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; {
+    description = "OpenGL Mathematics library for C++";
+    longDescription = ''
+      OpenGL Mathematics (GLM) is a header only C++ mathematics library for
+      graphics software based on the OpenGL Shading Language (GLSL)
+      specification and released under the MIT license.
+    '';
+    homepage = http://glm.g-truc.net/;
+    license = licenses.mit;
+    platforms = platforms.unix;
+    maintainers = with stdenv.lib.maintainers; [ fuuzetsu ];
+  };
+}
+
diff --git a/nixpkgs/pkgs/development/libraries/globalarrays/default.nix b/nixpkgs/pkgs/development/libraries/globalarrays/default.nix
new file mode 100644
index 000000000000..269071434d57
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/globalarrays/default.nix
@@ -0,0 +1,53 @@
+{ stdenv, fetchpatch, fetchFromGitHub, autoreconfHook
+, openblas, gfortran, openssh, openmpi
+} :
+
+let
+  version = "5.7";
+
+in stdenv.mkDerivation {
+  name = "globalarrays-${version}";
+
+  src = fetchFromGitHub {
+    owner = "GlobalArrays";
+    repo = "ga";
+    rev = "v${version}";
+    sha256 = "07i2idaas7pq3in5mdqq5ndvxln5q87nyfgk3vzw85r72c4fq5jh";
+  };
+
+  # upstream patches for openmpi-4 compatibility
+  patches = [ (fetchpatch {
+    name = "MPI_Type_struct-was-deprecated-in-MPI-2";
+    url = "https://github.com/GlobalArrays/ga/commit/36e6458993b1df745f43b7db86dc17087758e0d2.patch";
+    sha256 = "058qi8x0ananqx980p03yxpyn41cnmm0ifwsl50qp6sc0bnbnclh";
+  })
+  (fetchpatch {
+    name = "MPI_Errhandler_set-was-deprecated-in-MPI-2";
+    url = "https://github.com/GlobalArrays/ga/commit/f1ea5203d2672c1a1d0275a012fb7c2fb3d033d8.patch";
+    sha256 = "06n7ds9alk5xa6hd7waw3wrg88yx2azhdkn3cjs2k189iw8a7fqk";
+  })];
+
+  nativeBuildInputs = [ autoreconfHook ];
+  buildInputs = [ openmpi openblas gfortran openssh ];
+
+  preConfigure = ''
+    configureFlagsArray+=( "--enable-i8" \
+                           "--with-mpi" \
+                           "--with-mpi3" \
+                           "--enable-eispack" \
+                           "--enable-underscoring" \
+                           "--with-blas8=${openblas}/lib -lopenblas" )
+  '';
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    description = "Global Arrays Programming Models";
+    homepage = http://hpc.pnl.gov/globalarrays/;
+    maintainers = [ maintainers.markuskowa ];
+    license = licenses.bsd3;
+    platforms = platforms.linux;
+  };
+}
+
+
diff --git a/nixpkgs/pkgs/development/libraries/globalplatform/default.nix b/nixpkgs/pkgs/development/libraries/globalplatform/default.nix
new file mode 100644
index 000000000000..3ef279616f75
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/globalplatform/default.nix
@@ -0,0 +1,21 @@
+{ stdenv, fetchurl, pkgconfig, zlib, openssl, pcsclite }:
+
+stdenv.mkDerivation rec {
+  name = "globalplatform-${version}";
+  version  = "6.0.0";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/globalplatform/${name}.tar.gz";
+    sha256 = "191s9005xbc7i90bzjk4rlw15licd6m0rls9fxli8jyymz2021zy";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ zlib openssl pcsclite ];
+
+  meta = with stdenv.lib; {
+    homepage = https://sourceforge.net/p/globalplatform/wiki/Home/;
+    description = "Library for interacting with smart card devices";
+    license = licenses.gpl3;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/globalplatform/gppcscconnectionplugin.nix b/nixpkgs/pkgs/development/libraries/globalplatform/gppcscconnectionplugin.nix
new file mode 100644
index 000000000000..10df82196c2e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/globalplatform/gppcscconnectionplugin.nix
@@ -0,0 +1,21 @@
+{ stdenv, fetchurl, pkgconfig, globalplatform, openssl, pcsclite }:
+
+stdenv.mkDerivation rec {
+  name = "gppcscconnectionplugin-${version}";
+  version  = "1.1.0";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/globalplatform/${name}.tar.gz";
+    sha256 = "0d3vcrh9z55rbal0dchmj661pqqrav9c400bx1c46grcl1q022ad";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ globalplatform openssl pcsclite ];
+
+  meta = with stdenv.lib; {
+    homepage = https://sourceforge.net/p/globalplatform/wiki/Home/;
+    description = "GlobalPlatform pcsc connection plugin";
+    license = [ licenses.lgpl3 licenses.gpl3 ];
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/glog/default.nix b/nixpkgs/pkgs/development/libraries/glog/default.nix
new file mode 100644
index 000000000000..9ae181e94530
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/glog/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchFromGitHub, autoreconfHook, perl }:
+
+stdenv.mkDerivation rec {
+  name = "glog-${version}";
+  version = "0.4.0";
+
+  src = fetchFromGitHub {
+    owner = "google";
+    repo = "glog";
+    rev = "v${version}";
+    sha256 = "1xd3maiipfbxmhc9rrblc5x52nxvkwxp14npg31y5njqvkvzax9b";
+  };
+
+  nativeBuildInputs = [ autoreconfHook ];
+
+  checkInputs = [ perl ];
+  doCheck = false; # fails with "Mangled symbols (28 out of 380) found in demangle.dm"
+
+  meta = with stdenv.lib; {
+    homepage = https://github.com/google/glog;
+    license = licenses.bsd3;
+    description = "Library for application-level logging";
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gloox/default.nix b/nixpkgs/pkgs/development/libraries/gloox/default.nix
new file mode 100644
index 000000000000..d532e906a510
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gloox/default.nix
@@ -0,0 +1,36 @@
+{ stdenv, fetchurl
+, zlibSupport ? true, zlib ? null
+, sslSupport ? true, openssl ? null
+, idnSupport ? true, libidn ? null
+}:
+
+assert zlibSupport -> zlib != null;
+assert sslSupport -> openssl != null;
+assert idnSupport -> libidn != null;
+
+with stdenv.lib;
+
+let
+  version = "1.0.22";
+in
+stdenv.mkDerivation rec {
+  name = "gloox-${version}";
+
+  src = fetchurl {
+    url = "https://camaya.net/download/gloox-${version}.tar.bz2";
+    sha256 = "0r69gq8if9yy1amjzl7qrq9lzhhna7qgz905ln4wvkwchha1ppja";
+  };
+
+  buildInputs = [ ]
+    ++ optional zlibSupport zlib
+    ++ optional sslSupport openssl
+    ++ optional idnSupport libidn;
+
+  meta = {
+    description = "A portable high-level Jabber/XMPP library for C++";
+    homepage = http://camaya.net/gloox;
+    license = licenses.gpl3;
+    maintainers = with maintainers; [ fuuzetsu ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/glpk/default.nix b/nixpkgs/pkgs/development/libraries/glpk/default.nix
new file mode 100644
index 000000000000..1d35c0696d27
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/glpk/default.nix
@@ -0,0 +1,68 @@
+{ stdenv
+, fetchurl
+, fetchpatch
+# Excerpt from glpk's INSTALL file:
+# This feature allows the exact simplex solver to use the GNU MP
+# bignum library. If it is disabled, the exact simplex solver uses the
+# GLPK bignum module, which provides the same functionality as GNU MP,
+# however, it is much less efficient.
+, withGmp ? true
+, gmp
+}:
+
+assert withGmp -> gmp != null;
+
+stdenv.mkDerivation rec {
+  version = "4.65";
+  name = "glpk-${version}";
+
+  src = fetchurl {
+    url = "mirror://gnu/glpk/${name}.tar.gz";
+    sha256 = "040sfaa9jclg2nqdh83w71sv9rc1sznpnfiripjdyr48cady50a2";
+  };
+
+  buildInputs = stdenv.lib.optionals withGmp [
+    gmp
+  ];
+
+  configureFlags = stdenv.lib.optionals withGmp [
+    "--with-gmp"
+  ];
+
+  patches = [
+    # GLPK makes it possible to customize its message printing behaviour. Sage
+    # does that and needs to differentiate between printing regular messages and
+    # printing errors. Unfortunately there is no way to tell and glpk upstream
+    # rejected this patch. All it does is set the variable pointing to the error
+    # file back to NULL before glpk calls abort(). In sage's case, abort won't
+    # actually be called because the error handler jumps out of the function.
+    # This shouldn't affect everybody else, since glpk just calls abort()
+    # immediately afterwards anyways.
+    # See the sage trac ticket for more details:
+    # https://trac.sagemath.org/ticket/20710#comment:18
+    (fetchpatch {
+      name = "error_recovery.patch";
+      url = "https://git.sagemath.org/sage.git/plain/build/pkgs/glpk/patches/error_recovery.patch?id=07d6c37d18811e2b377a9689790a7c5e24da16ba";
+      sha256 = "0z99z9gd31apb6x5n5n26411qzx0ma3s6dnznc4x61x86bhq31qf";
+    })
+  ];
+
+  doCheck = true;
+
+  meta = {
+    description = "The GNU Linear Programming Kit";
+
+    longDescription =
+      '' The GNU Linear Programming Kit is intended for solving large
+         scale linear programming problems by means of the revised
+         simplex method.  It is a set of routines written in the ANSI C
+         programming language and organized in the form of a library.
+      '';
+
+    homepage = https://www.gnu.org/software/glpk/;
+    license = stdenv.lib.licenses.gpl3Plus;
+
+    maintainers = with stdenv.lib.maintainers; [ bjg timokau ];
+    platforms = stdenv.lib.platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/glui/default.nix b/nixpkgs/pkgs/development/libraries/glui/default.nix
new file mode 100644
index 000000000000..59357bf6fb1b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/glui/default.nix
@@ -0,0 +1,24 @@
+{stdenv, fetchurl, freeglut, libGLU_combined, libXmu, libXext, libX11, libXi}:
+stdenv.mkDerivation {
+  name = "glui-2.35";
+  buildInputs = [freeglut libGLU_combined libXmu libXext libX11 libXi];
+  preConfigure = ''cd src'';
+  installPhase = ''
+    mkdir -p "$out"/{bin,lib,share/glui/doc,include}
+    cp -rT bin "$out/bin"
+    cp -rT lib "$out/lib"
+    cp -rT include "$out/include"
+    cp -rT doc "$out/share/glui/doc"
+    cp LICENSE.txt "$out/share/glui/doc"
+  '';
+  src = fetchurl {
+    url = "mirror://sourceforge/project/glui/Source/2.36/glui-2.36.tgz";
+    sha256 = "11r7f0k5jlbl825ibhm5c6bck0fn1hbliya9x1f253ikry1mxvy1";
+  };
+  meta = {
+    description = ''A user interface library using OpenGL'';
+    license = stdenv.lib.licenses.zlib ;
+    maintainers = [stdenv.lib.maintainers.raskin];
+    platforms = stdenv.lib.platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gmime/2.nix b/nixpkgs/pkgs/development/libraries/gmime/2.nix
new file mode 100644
index 000000000000..b373095a8148
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gmime/2.nix
@@ -0,0 +1,38 @@
+{ stdenv, fetchurl, pkgconfig, glib, zlib, gnupg, libgpgerror, gobject-introspection }:
+
+stdenv.mkDerivation rec {
+  version = "2.6.23";
+  name = "gmime-${version}";
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/gmime/2.6/${name}.tar.xz";
+    sha256 = "0slzlzcr3h8jikpz5a5amqd0csqh2m40gdk910ws2hnaf5m6hjbi";
+  };
+
+  outputs = [ "out" "dev" ];
+
+  nativeBuildInputs = [ pkgconfig gobject-introspection ];
+  propagatedBuildInputs = [ glib zlib libgpgerror ];
+  configureFlags = [ "--enable-introspection=yes" ];
+
+  postPatch = ''
+    substituteInPlace tests/testsuite.c \
+      --replace /bin/rm rm \
+      --replace /bin/mkdir mkdir
+
+    substituteInPlace tests/test-pkcs7.c \
+      --replace /bin/mkdir mkdir
+  '';
+
+  checkInputs = [ gnupg ];
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    homepage = https://github.com/jstedfast/gmime/;
+    description = "A C/C++ library for creating, editing and parsing MIME messages and structures";
+    license = licenses.lgpl21Plus;
+    maintainers = with maintainers; [ ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gmime/3.nix b/nixpkgs/pkgs/development/libraries/gmime/3.nix
new file mode 100644
index 000000000000..699d2854f3db
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gmime/3.nix
@@ -0,0 +1,37 @@
+{ stdenv, fetchurl, pkgconfig, glib, zlib, gnupg, gpgme, libidn2, libunistring, gobject-introspection }:
+
+stdenv.mkDerivation rec {
+  version = "3.2.3";
+  name = "gmime-${version}";
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/gmime/3.2/${name}.tar.xz";
+    sha256 = "04bk7rqs5slpvlvqf11i6s37s8b2xn6acls8smyl9asjnpp7a23a";
+  };
+
+  outputs = [ "out" "dev" ];
+
+  buildInputs = [ gobject-introspection zlib gpgme libidn2 libunistring ];
+  nativeBuildInputs = [ pkgconfig ];
+  propagatedBuildInputs = [ glib ];
+  configureFlags = [ "--enable-introspection=yes" ];
+
+  postPatch = ''
+    substituteInPlace tests/testsuite.c \
+      --replace /bin/rm rm
+  '';
+
+  checkInputs = [ gnupg ];
+
+  doCheck = true;
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    homepage = https://github.com/jstedfast/gmime/;
+    description = "A C/C++ library for creating, editing and parsing MIME messages and structures";
+    license = licenses.lgpl21Plus;
+    maintainers = with maintainers; [ ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gmm/default.nix b/nixpkgs/pkgs/development/libraries/gmm/default.nix
new file mode 100644
index 000000000000..6423e1fce981
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gmm/default.nix
@@ -0,0 +1,18 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "gmm-${version}";
+  version = "5.3";
+
+  src = fetchurl {
+    url = "mirror://savannah/getfem/stable/${name}.tar.gz";
+    sha256 = "0lkjd3n0298w1dli446z320sn7mqdap8h9q31nydkbw2k7b4db46";
+  };
+
+  meta = with stdenv.lib; {
+    description = "Generic C++ template library for sparse, dense and skyline matrices";
+    homepage = http://getfem.org/gmm.html;
+    license = licenses.lgpl21Plus;
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gmp/4.3.2.nix b/nixpkgs/pkgs/development/libraries/gmp/4.3.2.nix
new file mode 100644
index 000000000000..a6035a2b7afd
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gmp/4.3.2.nix
@@ -0,0 +1,75 @@
+{ stdenv, fetchurl, m4, cxx ? true }:
+
+let self = stdenv.mkDerivation rec {
+  name = "gmp-4.3.2";
+
+  src = fetchurl {
+    url = "mirror://gnu/gmp/${name}.tar.bz2";
+    sha256 = "0x8prpqi9amfcmi7r4zrza609ai9529pjaq0h4aw51i867064qck";
+  };
+
+  #outputs TODO: split $cxx due to libstdc++ dependency
+  # maybe let ghc use a version with *.so shared with rest of nixpkgs and *.a added
+  # - see #5855 for related discussion
+  outputs = [ "out" "dev" "info" ];
+  passthru.static = self.out;
+
+  nativeBuildInputs = [ m4 ];
+
+  # Prevent the build system from using sub-architecture-specific
+  # instructions (e.g., SSE2 on i686).
+  #
+  # This is not a problem for Apple machines, which are all alike.  In
+  # addition, `configfsf.guess' would return `i386-apple-darwin10.2.0' on
+  # `x86_64-darwin', leading to a 32-bit ABI build, which is undesirable.
+  preConfigure =
+    if !stdenv.isDarwin
+    then "ln -sf configfsf.guess config.guess"
+    else ''echo "Darwin host is `./config.guess`."'';
+
+  configureFlags = [
+    (stdenv.lib.enableFeature cxx "cxx")
+  ] ++ stdenv.lib.optionals stdenv.isDarwin [
+    "ac_cv_build=x86_64-apple-darwin13.4.0"
+    "ac_cv_host=x86_64-apple-darwin13.4.0"
+  ];
+
+  # The test t-lucnum_ui fails (on Linux/x86_64) when built with GCC 4.8.
+  # Newer versions of GMP don't have that issue anymore.
+  doCheck = false;
+
+  meta = {
+    branch = "4";
+    description = "GNU multiple precision arithmetic library";
+
+    longDescription =
+      '' GMP is a free library for arbitrary precision arithmetic, operating
+         on signed integers, rational numbers, and floating point numbers.
+         There is no practical limit to the precision except the ones implied
+         by the available memory in the machine GMP runs on.  GMP has a rich
+         set of functions, and the functions have a regular interface.
+
+         The main target applications for GMP are cryptography applications
+         and research, Internet security applications, algebra systems,
+         computational algebra research, etc.
+
+         GMP is carefully designed to be as fast as possible, both for small
+         operands and for huge operands.  The speed is achieved by using
+         fullwords as the basic arithmetic type, by using fast algorithms,
+         with highly optimised assembly code for the most common inner loops
+         for a lot of CPUs, and by a general emphasis on speed.
+
+         GMP is faster than any other bignum library.  The advantage for GMP
+         increases with the operand sizes for many operations, since GMP uses
+         asymptotically faster algorithms.
+      '';
+
+    homepage = https://gmplib.org/;
+    license = stdenv.lib.licenses.lgpl3Plus;
+
+    maintainers = [ ];
+    platforms = stdenv.lib.platforms.all;
+    badPlatforms = [ "x86_64-darwin" ];
+  };
+};
+  in self
diff --git a/nixpkgs/pkgs/development/libraries/gmp/5.1.x.nix b/nixpkgs/pkgs/development/libraries/gmp/5.1.x.nix
new file mode 100644
index 000000000000..43b8434b4961
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gmp/5.1.x.nix
@@ -0,0 +1,78 @@
+{ stdenv, fetchurl, m4, cxx ? true, withStatic ? true }:
+
+let inherit (stdenv.lib) optional optionalString; in
+
+let self = stdenv.mkDerivation rec {
+  name = "gmp-5.1.3";
+
+  src = fetchurl { # we need to use bz2, others aren't in bootstrapping stdenv
+    urls = [ "mirror://gnu/gmp/${name}.tar.bz2" "ftp://ftp.gmplib.org/pub/${name}/${name}.tar.bz2" ];
+    sha256 = "0q5i39pxrasgn9qdxzpfbwhh11ph80p57x6hf48m74261d97j83m";
+  };
+
+  #outputs TODO: split $cxx due to libstdc++ dependency
+  # maybe let ghc use a version with *.so shared with rest of nixpkgs and *.a added
+  # - see #5855 for related discussion
+  outputs = [ "out" "dev" "info" ];
+  passthru.static = self.out;
+
+  nativeBuildInputs = [ m4 ];
+
+  patches = if stdenv.isDarwin then [ ./need-size-t.patch ] else null;
+
+  configureFlags = [
+    "--with-pic"
+    (stdenv.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 <http://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")
+    # 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.
+    "--build=${stdenv.buildPlatform.config}"
+  ] ++ optional (cxx && stdenv.isDarwin) "CPPFLAGS=-fexceptions"
+    ++ optional (stdenv.isDarwin && stdenv.is64bit) "ABI=64"
+    ;
+
+  doCheck = true;
+
+  dontDisableStatic = withStatic;
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    homepage = https://gmplib.org/;
+    description = "GNU multiple precision arithmetic library";
+    license = licenses.gpl3Plus;
+
+    longDescription =
+      '' GMP is a free library for arbitrary precision arithmetic, operating
+         on signed integers, rational numbers, and floating point numbers.
+         There is no practical limit to the precision except the ones implied
+         by the available memory in the machine GMP runs on.  GMP has a rich
+         set of functions, and the functions have a regular interface.
+
+         The main target applications for GMP are cryptography applications
+         and research, Internet security applications, algebra systems,
+         computational algebra research, etc.
+
+         GMP is carefully designed to be as fast as possible, both for small
+         operands and for huge operands.  The speed is achieved by using
+         fullwords as the basic arithmetic type, by using fast algorithms,
+         with highly optimised assembly code for the most common inner loops
+         for a lot of CPUs, and by a general emphasis on speed.
+
+         GMP is faster than any other bignum library.  The advantage for GMP
+         increases with the operand sizes for many operations, since GMP uses
+         asymptotically faster algorithms.
+      '';
+
+    platforms = platforms.all;
+    badPlatforms = [ "x86_64-darwin" ];
+    maintainers = [ maintainers.peti ];
+  };
+};
+  in self
diff --git a/nixpkgs/pkgs/development/libraries/gmp/6.x.nix b/nixpkgs/pkgs/development/libraries/gmp/6.x.nix
new file mode 100644
index 000000000000..f320c303123e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gmp/6.x.nix
@@ -0,0 +1,80 @@
+{ stdenv, fetchurl, m4
+, cxx ? !stdenv.hostPlatform.useAndroidPrebuilt && !stdenv.hostPlatform.isWasm
+, buildPackages
+, withStatic ? false }:
+
+let inherit (stdenv.lib) optional optionalString; in
+
+let self = stdenv.mkDerivation rec {
+  name = "gmp-6.1.2";
+
+  src = fetchurl { # we need to use bz2, others aren't in bootstrapping stdenv
+    urls = [ "mirror://gnu/gmp/${name}.tar.bz2" "ftp://ftp.gmplib.org/pub/${name}/${name}.tar.bz2" ];
+    sha256 = "1clg7pbpk6qwxj5b2mw0pghzawp2qlm3jf9gdd8i6fl6yh2bnxaj";
+  };
+
+  #outputs TODO: split $cxx due to libstdc++ dependency
+  # maybe let ghc use a version with *.so shared with rest of nixpkgs and *.a added
+  # - see #5855 for related discussion
+  outputs = [ "out" "dev" "info" ];
+  passthru.static = self.out;
+
+  depsBuildBuild = [ buildPackages.stdenv.cc ];
+  nativeBuildInputs = [ m4 ];
+
+  configureFlags = [
+    "--with-pic"
+    (stdenv.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 <http://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")
+    # 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.
+    "--build=${stdenv.buildPlatform.config}"
+  ] ++ optional (cxx && stdenv.isDarwin) "CPPFLAGS=-fexceptions"
+    ++ optional (stdenv.isDarwin && stdenv.is64bit) "ABI=64"
+    ++ optional (with stdenv.hostPlatform; useAndroidPrebuilt || useiOSPrebuilt) "--disable-assembly"
+    ;
+
+  doCheck = true; # not cross;
+
+  dontDisableStatic = withStatic;
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    homepage = https://gmplib.org/;
+    description = "GNU multiple precision arithmetic library";
+    license = licenses.gpl3Plus;
+
+    longDescription =
+      '' GMP is a free library for arbitrary precision arithmetic, operating
+         on signed integers, rational numbers, and floating point numbers.
+         There is no practical limit to the precision except the ones implied
+         by the available memory in the machine GMP runs on.  GMP has a rich
+         set of functions, and the functions have a regular interface.
+
+         The main target applications for GMP are cryptography applications
+         and research, Internet security applications, algebra systems,
+         computational algebra research, etc.
+
+         GMP is carefully designed to be as fast as possible, both for small
+         operands and for huge operands.  The speed is achieved by using
+         fullwords as the basic arithmetic type, by using fast algorithms,
+         with highly optimised assembly code for the most common inner loops
+         for a lot of CPUs, and by a general emphasis on speed.
+
+         GMP is faster than any other bignum library.  The advantage for GMP
+         increases with the operand sizes for many operations, since GMP uses
+         asymptotically faster algorithms.
+      '';
+
+    platforms = platforms.all;
+    maintainers = [ maintainers.peti maintainers.vrthra ];
+  };
+};
+  in self
diff --git a/nixpkgs/pkgs/development/libraries/gmp/need-size-t.patch b/nixpkgs/pkgs/development/libraries/gmp/need-size-t.patch
new file mode 100644
index 000000000000..c4ba086182a9
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gmp/need-size-t.patch
@@ -0,0 +1,18 @@
+diff --git a/gmp-h.in b/gmp-h.in
+index 7deb67a..240d663 100644
+--- a/gmp-h.in
++++ b/gmp-h.in
+@@ -46,13 +46,11 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+ #ifndef __GNU_MP__
+ #define __GNU_MP__ 5
+ 
+-#define __need_size_t  /* tell gcc stddef.h we only want size_t */
+ #if defined (__cplusplus)
+ #include <cstddef>     /* for size_t */
+ #else
+ #include <stddef.h>    /* for size_t */
+ #endif
+-#undef __need_size_t
+ 
+ /* Instantiated by configure. */
+ #if ! defined (__GMP_WITHIN_CONFIGURE)
diff --git a/nixpkgs/pkgs/development/libraries/gmtk/default.nix b/nixpkgs/pkgs/development/libraries/gmtk/default.nix
new file mode 100644
index 000000000000..0fac97aaa439
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gmtk/default.nix
@@ -0,0 +1,32 @@
+{stdenv, substituteAll, fetchFromGitHub, libtool, pkgconfig, intltool, glib, gtk3
+, libpulseaudio, mplayer, gnome_mplayer }:
+
+stdenv.mkDerivation rec {
+  name = "gmtk-${version}";
+  version = "1.0.9";
+
+  src = fetchFromGitHub {
+    owner = "kdekorte";
+    repo = "gmtk";
+    rev = "v${version}";
+    sha256 = "1zb5m1y1gckal3140gvx31572a6xpccwfmdwa1w5lx2wdq1pwk1i";
+  };
+
+  nativeBuildInputs = [ libtool pkgconfig intltool ];
+  buildInputs = [ glib gtk3 libpulseaudio ];
+
+  patches = [
+    (substituteAll {
+      src = ./fix-paths.patch;
+      mplayer = "${mplayer}/bin/mplayer";
+    })
+  ];
+
+  meta = with stdenv.lib; {
+    description = "Common functions for gnome-mplayer and gecko-mediaplayer";
+    homepage = https://sites.google.com/site/kdekorte2/gnomemplayer;
+    license = licenses.gpl2;
+    maintainers = gnome_mplayer.meta.maintainers;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gmtk/fix-paths.patch b/nixpkgs/pkgs/development/libraries/gmtk/fix-paths.patch
new file mode 100644
index 000000000000..64738300aba4
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gmtk/fix-paths.patch
@@ -0,0 +1,20 @@
+--- a/src/gmtk_media_player.c
++++ b/src/gmtk_media_player.c
+@@ -2449,7 +2449,7 @@
+         player->minimum_mplayer = detect_mplayer_features(player);
+ 
+         if (player->mplayer_binary == NULL || !g_file_test(player->mplayer_binary, G_FILE_TEST_EXISTS)) {
+-            argv[argn++] = g_strdup_printf("mplayer");
++            argv[argn++] = g_strdup_printf("@mplayer@");
+         } else {
+             argv[argn++] = g_strdup_printf("%s", player->mplayer_binary);
+         }
+@@ -4135,7 +4135,7 @@
+         return ret;
+ 
+     if (player->mplayer_binary == NULL || !g_file_test(player->mplayer_binary, G_FILE_TEST_EXISTS)) {
+-        av[ac++] = g_strdup_printf("mplayer");
++        av[ac++] = g_strdup_printf("@mplayer@");
+     } else {
+         av[ac++] = g_strdup_printf("%s", player->mplayer_binary);
+     }
diff --git a/nixpkgs/pkgs/development/libraries/gnet/default.nix b/nixpkgs/pkgs/development/libraries/gnet/default.nix
new file mode 100644
index 000000000000..0b2fb9fef6c3
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gnet/default.nix
@@ -0,0 +1,24 @@
+{stdenv, fetchFromGitHub, pkgconfig, autoconf, automake, glib, libtool }:
+
+stdenv.mkDerivation {
+  name = "gnet-2.0.8";
+  src = fetchFromGitHub {
+    owner = "GNOME";
+    repo = "gnet";
+    rev = "GNET_2_0_8";
+    sha256 = "1cy78kglzi235md964ikvm0rg801bx0yk9ya8zavndjnaarzqq87";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ autoconf automake glib libtool ];
+
+  preConfigure = "./autogen.sh";
+
+  meta = with stdenv.lib; {
+    description = "A network library, written in C, object-oriented, and built upon GLib";
+    homepage = https://developer.gnome.org/gnet/;
+    license = licenses.lgpl2;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ pSub ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gnome-menus/default.nix b/nixpkgs/pkgs/development/libraries/gnome-menus/default.nix
new file mode 100644
index 000000000000..501fe4d0849f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gnome-menus/default.nix
@@ -0,0 +1,33 @@
+{ stdenv, fetchurl, pkgconfig, gettext, glib, gobject-introspection, gnome3 }:
+
+stdenv.mkDerivation rec {
+  pname = "gnome-menus";
+  version = "3.32.0";
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    sha256 = "0x2blzqrapmbsbfzxjcdcpa3vkw9hq5k96h9kvjmy9kl415wcl68";
+  };
+
+  makeFlags = [
+    "INTROSPECTION_GIRDIR=${placeholder ''out''}/share/gir-1.0/"
+    "INTROSPECTION_TYPELIBDIR=${placeholder ''out''}/lib/girepository-1.0"
+  ];
+
+  nativeBuildInputs = [ pkgconfig gettext ];
+  buildInputs = [ glib gobject-introspection ];
+
+  passthru = {
+    updateScript = gnome3.updateScript {
+      packageName = pname;
+      versionPolicy = "none";
+    };
+  };
+
+  meta = with stdenv.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 ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gnome-sharp/default.nix b/nixpkgs/pkgs/development/libraries/gnome-sharp/default.nix
new file mode 100644
index 000000000000..f2393a23dfef
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gnome-sharp/default.nix
@@ -0,0 +1,43 @@
+{ stdenv
+, lib
+, fetchFromGitHub
+, pkgconfig
+, gtk2
+, mono
+, gtk-sharp-2_0
+, gnome2
+, autoconf
+, automake
+, libtool
+, which
+}:
+
+stdenv.mkDerivation rec {
+  name = "gnome-sharp-${version}";
+  version = "2.24.4";
+
+  src = fetchFromGitHub {
+    owner = "mono";
+    repo = "gnome-sharp";
+    rev = "${version}";
+    sha256 = "15jsm6n0sih0nf3w8vmvik97q7l3imz4vkdzmp9k7bssiz4glj1z";
+  };
+
+  nativeBuildInputs = [ pkgconfig autoconf automake libtool which ];
+  buildInputs = [ gtk2 mono gtk-sharp-2_0 ]
+  ++ (with gnome2; [ libart_lgpl gnome_vfs libgnome libgnomecanvas libgnomeui ]);
+
+  preConfigure = ''
+    ./bootstrap-${lib.versions.majorMinor version}
+  '';
+
+  dontStrip = true;
+
+  meta = with stdenv.lib; {
+    homepage = https://www.mono-project.com/docs/gui/gtksharp/;
+    description = "A .NET language binding for assorted GNOME libraries";
+    license = licenses.lgpl21;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ vbgl ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gnu-config/default.nix b/nixpkgs/pkgs/development/libraries/gnu-config/default.nix
new file mode 100644
index 000000000000..7918fb7b9c4b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gnu-config/default.nix
@@ -0,0 +1,39 @@
+{ stdenv, fetchurl }:
+
+let
+  rev = "a8d79c3130da83c7cacd6fee31b9acc53799c406";
+
+  # Don't use fetchgit as this is needed during Aarch64 bootstrapping
+  configGuess = fetchurl {
+    url = "https://git.savannah.gnu.org/cgit/config.git/plain/config.guess?id=${rev}";
+    sha256 = "0qbq49gr2cmf4gzrjvrmpwxxgzl3vap1xm902xa8pkcqdvriq0qw";
+  };
+  configSub = fetchurl {
+    url = "https://git.savannah.gnu.org/cgit/config.git/plain/config.sub?id=${rev}";
+    sha256 = "0i699axqfkxk9mgv1hlms5r44pf0s642yz75ajjjpwzhw4d5pnv4";
+  };
+in
+stdenv.mkDerivation rec {
+  name = "gnu-config-${version}";
+  version = "2019-04-15";
+
+  buildCommand = ''
+    mkdir -p $out
+    cp ${configGuess} $out/config.guess
+    cp ${configSub} $out/config.sub
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Attempt to guess a canonical system name";
+    homepage = https://savannah.gnu.org/projects/config;
+    license = licenses.gpl3;
+    # In addition to GPLv3:
+    #   As a special exception to the GNU General Public License, if you
+    #   distribute this file as part of a program that contains a
+    #   configuration script generated by Autoconf, you may include it under
+    #   the same distribution terms that you use for the rest of that
+    #   program.
+    maintainers = [ maintainers.dezgeg ];
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gnu-efi/default.nix b/nixpkgs/pkgs/development/libraries/gnu-efi/default.nix
new file mode 100644
index 000000000000..036863c9c0bf
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gnu-efi/default.nix
@@ -0,0 +1,33 @@
+{ stdenv, fetchurl, pciutils }: with stdenv.lib;
+
+stdenv.mkDerivation rec {
+  name = "gnu-efi-${version}";
+  version = "3.0.9";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/gnu-efi/${name}.tar.bz2";
+    sha256 = "1w3p4aqlc5j93q44la7dc8cr3hky20zvsd0h0k2lyzhwmrzfl5b7";
+  };
+
+  buildInputs = [ pciutils ];
+
+  hardeningDisable = [ "stackprotector" ];
+
+  makeFlags = [
+    "PREFIX=\${out}"
+    "CC=${stdenv.cc.targetPrefix}gcc"
+    "AS=${stdenv.cc.targetPrefix}as"
+    "LD=${stdenv.cc.targetPrefix}ld"
+    "AR=${stdenv.cc.targetPrefix}ar"
+    "RANLIB=${stdenv.cc.targetPrefix}ranlib"
+    "OBJCOPY=${stdenv.cc.targetPrefix}objcopy"
+  ] ++ stdenv.lib.optional stdenv.isAarch32 "ARCH=arm"
+    ++ stdenv.lib.optional stdenv.isAarch64 "ARCH=aarch64";
+
+  meta = with stdenv.lib; {
+    description = "GNU EFI development toolchain";
+    homepage = https://sourceforge.net/projects/gnu-efi/;
+    license = licenses.bsd3;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gnutls-kdh/3.5.nix b/nixpkgs/pkgs/development/libraries/gnutls-kdh/3.5.nix
new file mode 100644
index 000000000000..e245496c63ac
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gnutls-kdh/3.5.nix
@@ -0,0 +1,12 @@
+{ callPackage, fetchFromGitHub, autoreconfHook, ... } @ args:
+
+callPackage ./generic.nix (args // rec {
+  version = "1.0";
+
+  src = fetchFromGitHub {
+    owner = "arpa2";
+    repo = "gnutls-kdh";
+    rev = "ff3bb36f70a746f28554641d466e124098dfcb25";
+    sha256 = "1rr3p4r145lnprxn8hqyyzh3qkj3idsbqp08g07ndrhqnxq0k0sw";
+  };
+})
diff --git a/nixpkgs/pkgs/development/libraries/gnutls-kdh/generic.nix b/nixpkgs/pkgs/development/libraries/gnutls-kdh/generic.nix
new file mode 100644
index 000000000000..75c71632aebc
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gnutls-kdh/generic.nix
@@ -0,0 +1,93 @@
+{ config, lib, stdenv, zlib, lzo, libtasn1, nettle, pkgconfig, lzip
+, perl, gmp, autogen, libidn, p11-kit, unbound, libiconv
+, guileBindings ? config.gnutls.guile or false, guile
+, tpmSupport ? true, trousers, nettools, gperftools, gperf, gettext, automake
+, yacc, texinfo
+
+# Version dependent args
+, version, src, patches ? [], postPatch ? "", nativeBuildInputs ? []
+, ...}:
+
+assert guileBindings -> guile != null;
+let
+  # XXX: Gnulib's `test-select' fails on FreeBSD:
+  # http://hydra.nixos.org/build/2962084/nixlog/1/raw .
+  doCheck = !stdenv.isFreeBSD && !stdenv.isDarwin && lib.versionAtLeast version "3.4";
+in
+stdenv.mkDerivation {
+  name = "gnutls-kdh-${version}";
+
+  inherit src patches;
+
+  outputs = [ "bin" "dev" "out" ];
+
+  patchPhase = ''
+      # rm -fR ./po
+      # substituteInPlace configure "po/Makefile.in" " "
+      substituteInPlace doc/manpages/Makefile.in  --replace "gnutls_cipher_list.3" " "
+      substituteInPlace doc/manpages/Makefile.in  --replace "gnutls_cipher_self_test.3" " "
+      substituteInPlace doc/manpages/Makefile.in  --replace "gnutls_digest_self_test.3" " "
+      substituteInPlace doc/manpages/Makefile.in  --replace "gnutls_mac_self_test.3" " "
+      substituteInPlace doc/manpages/Makefile.in  --replace "gnutls_pk_self_test.3" " "
+      printf "all: ;\n\ninstall: ;" > "po/Makefile.in"
+      printf "all: ;\n\ninstall: ;" > "po/Makefile.in.in"
+      '';
+
+  postPatch = lib.optionalString (lib.versionAtLeast version "3.4") ''
+    sed '2iecho "name constraints tests skipped due to datefudge problems"\nexit 0' \
+      -i tests/cert-tests/name-constraints
+  '' + postPatch;
+
+  preConfigure = "patchShebangs .";
+  configureFlags =
+    lib.optional stdenv.isLinux "--with-default-trust-store-file=/etc/ssl/certs/ca-certificates.crt"
+  ++ [
+    "--disable-dependency-tracking"
+    "--enable-fast-install"
+  ] ++ lib.optional guileBindings
+    [ "--enable-guile" "--with-guile-site-dir=\${out}/share/guile/site" ];
+
+  # Build of the Guile bindings is not parallel-safe.  See
+  # <https://github.com/arpa2/gnutls-kdh/commit/330995a920037b6030ec0282b51dde3f8b493cad>
+  # for the actual fix.  Also an apparent race in the generation of
+  # systemkey-args.h.
+  enableParallelBuilding = false;
+
+  buildInputs = [ lzo lzip nettle libtasn1 libidn p11-kit zlib gmp
+  autogen gperftools gperf gettext automake yacc texinfo ]
+    ++ lib.optional doCheck nettools
+    ++ lib.optional (stdenv.isFreeBSD || stdenv.isDarwin) libiconv
+    ++ lib.optional (tpmSupport && stdenv.isLinux) trousers
+    ++ [ unbound ]
+    ++ lib.optional guileBindings guile;
+
+  nativeBuildInputs = [ perl pkgconfig ] ++ nativeBuildInputs;
+
+  #inherit doCheck;
+  doCheck = false;
+
+  # Fixup broken libtool and pkgconfig files
+  preFixup = lib.optionalString (!stdenv.isDarwin) ''
+    sed ${lib.optionalString tpmSupport "-e 's,-ltspi,-L${trousers}/lib -ltspi,'"} \
+        -e 's,-lz,-L${zlib.out}/lib -lz,' \
+        -e 's,-L${gmp.dev}/lib,-L${gmp.out}/lib,' \
+        -e 's,-lgmp,-L${gmp.out}/lib -lgmp,' \
+        -i $out/lib/*.la "$dev/lib/pkgconfig/gnutls.pc"
+  '';
+
+  meta = with lib; {
+    description = "GnuTLS with additional TLS-KDH ciphers: Kerberos + Diffie-Hellman";
+
+    longDescription = ''
+       The ARPA2 project aims to add security. This is an enhanced
+       version of GnuTLS,  a project that aims to develop a library which
+       provides a secure layer, over a reliable transport
+       layer. It adds TLS-KDH ciphers: Kerberos + Diffie-Hellman.
+    '';
+
+    homepage = https://github.com/arpa2/gnutls-kdh;
+    license = licenses.lgpl21Plus;
+    maintainers = with maintainers; [ leenaars ];
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gnutls/default.nix b/nixpkgs/pkgs/development/libraries/gnutls/default.nix
new file mode 100644
index 000000000000..e0a54052c23e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gnutls/default.nix
@@ -0,0 +1,114 @@
+{ config, lib, stdenv, fetchurl, zlib, lzo, libtasn1, nettle, pkgconfig, lzip
+, perl, gmp, autoconf, autogen, automake, libidn, p11-kit, libiconv
+, unbound, dns-root-data, gettext, cacert
+, guileBindings ? config.gnutls.guile or false, guile
+, tpmSupport ? false, trousers, which, nettools, libunistring
+, withSecurity ? false, Security  # darwin Security.framework
+}:
+
+assert guileBindings -> guile != null;
+let
+  version = "3.6.8";
+
+  # XXX: Gnulib's `test-select' fails on FreeBSD:
+  # http://hydra.nixos.org/build/2962084/nixlog/1/raw .
+  doCheck = !stdenv.isFreeBSD && !stdenv.isDarwin && lib.versionAtLeast version "3.4"
+      && stdenv.buildPlatform == stdenv.hostPlatform;
+
+  inherit (stdenv.hostPlatform) isDarwin;
+in
+
+stdenv.mkDerivation {
+  name = "gnutls-${version}";
+  inherit version;
+
+  src = fetchurl {
+    url = "mirror://gnupg/gnutls/v3.6/gnutls-${version}.tar.xz";
+    sha256 = "10ry71sy8zbksa905bjryphafcg25gkmfa3pf48ripimar7990da";
+  };
+
+  outputs = [ "bin" "dev" "out" "man" "devdoc" ];
+  outputInfo = "devdoc";
+
+  patches = [ ./nix-ssl-cert-file.patch ]
+    # Disable native add_system_trust.
+    ++ lib.optional (isDarwin && !withSecurity) ./no-security-framework.patch;
+
+  # Skip some tests:
+  #  - pkgconfig: building against the result won't work before installing (3.5.11)
+  #  - fastopen: no idea; it broke between 3.6.2 and 3.6.3 (3437fdde6 in particular)
+  #  - trust-store: default trust store path (/etc/ssl/...) is missing in sandbox (3.5.11)
+  #  - psk-file: no idea; it broke between 3.6.3 and 3.6.4
+  # Change p11-kit test to use pkg-config to find p11-kit
+  postPatch = lib.optionalString (lib.versionAtLeast version "3.4") ''
+    sed '2iecho "name constraints tests skipped due to datefudge problems"\nexit 0' -i tests/cert-tests/name-constraints
+  '' + lib.optionalString (lib.versionAtLeast version "3.6") ''
+    sed '2iexit 77' -i tests/{pkgconfig,fastopen}.sh
+    sed '/^void doit(void)/,/^{/ s/{/{ exit(77);/' -i tests/{trust-store,psk-file}.c
+    sed 's:/usr/lib64/pkcs11/ /usr/lib/pkcs11/ /usr/lib/x86_64-linux-gnu/pkcs11/:`pkg-config --variable=p11_module_path p11-kit-1`:' -i tests/p11-kit-trust.sh
+  '';
+
+  preConfigure = "patchShebangs .";
+  configureFlags =
+    lib.optional stdenv.isLinux "--with-default-trust-store-file=/etc/ssl/certs/ca-certificates.crt"
+  ++ [
+    "--disable-dependency-tracking"
+    "--enable-fast-install"
+    "--with-unbound-root-key-file=${dns-root-data}/root.key"
+  ] ++ lib.optional guileBindings
+    [ "--enable-guile" "--with-guile-site-dir=\${out}/share/guile/site" ];
+
+  enableParallelBuilding = true;
+
+  buildInputs = [ lzo lzip libtasn1 libidn p11-kit zlib gmp autogen libunistring unbound gettext libiconv ]
+    ++ lib.optional (isDarwin && withSecurity) Security
+    ++ lib.optional (tpmSupport && stdenv.isLinux) trousers
+    ++ lib.optional guileBindings guile;
+
+  nativeBuildInputs = [ perl pkgconfig ]
+    ++ lib.optionals (isDarwin && !withSecurity) [ autoconf automake ]
+    ++ lib.optionals doCheck [ which nettools ];
+
+  propagatedBuildInputs = [ nettle ];
+
+  inherit doCheck;
+  # stdenv's `NIX_SSL_CERT_FILE=/no-cert-file.crt` broke tests with:
+  #   Error setting the x509 trust file: Error while reading file.
+  checkInputs = [ cacert ];
+
+  # Fixup broken libtool and pkgconfig files
+  preFixup = lib.optionalString (!isDarwin) ''
+    sed ${lib.optionalString tpmSupport "-e 's,-ltspi,-L${trousers}/lib -ltspi,'"} \
+        -e 's,-lz,-L${zlib.out}/lib -lz,' \
+        -e 's,-L${gmp.dev}/lib,-L${gmp.out}/lib,' \
+        -e 's,-lgmp,-L${gmp.out}/lib -lgmp,' \
+        -i $out/lib/*.la "$dev/lib/pkgconfig/gnutls.pc"
+  '' + ''
+    # It seems only useful for static linking but basically noone does that.
+    substituteInPlace "$out/lib/libgnutls.la" \
+      --replace "-lunistring" ""
+  '';
+
+  meta = with lib; {
+    description = "The GNU Transport Layer Security Library";
+
+    longDescription = ''
+       GnuTLS is a project that aims to develop a library which
+       provides a secure layer, over a reliable transport
+       layer. Currently the GnuTLS library implements the proposed standards by
+       the IETF's TLS working group.
+
+       Quoting from the TLS protocol specification:
+
+       "The TLS protocol provides communications privacy over the
+       Internet. The protocol allows client/server applications to
+       communicate in a way that is designed to prevent eavesdropping,
+       tampering, or message forgery."
+    '';
+
+    homepage = https://www.gnu.org/software/gnutls/;
+    license = licenses.lgpl21Plus;
+    maintainers = with maintainers; [ eelco fpletz ];
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gnutls/nix-ssl-cert-file.patch b/nixpkgs/pkgs/development/libraries/gnutls/nix-ssl-cert-file.patch
new file mode 100644
index 000000000000..90d1e85ee8c0
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gnutls/nix-ssl-cert-file.patch
@@ -0,0 +1,19 @@
+allow overriding system trust store location via $NIX_SSL_CERT_FILE
+
+diff --git a/lib/system/certs.c b/lib/system/certs.c
+index 611c645..6ef6edb 100644
+--- a/lib/system/certs.c
++++ b/lib/system/certs.c
+@@ -369,6 +369,11 @@ gnutls_x509_trust_list_add_system_trust(gnutls_x509_trust_list_t list,
+ 					unsigned int tl_flags,
+ 					unsigned int tl_vflags)
+ {
+-	return add_system_trust(list, tl_flags|GNUTLS_TL_NO_DUPLICATES, tl_vflags);
++	tl_flags = tl_flags|GNUTLS_TL_NO_DUPLICATES;
++	const char *file = secure_getenv("NIX_SSL_CERT_FILE");
++	return file
++		? gnutls_x509_trust_list_add_trust_file(
++			list, file, NULL/*CRL*/, GNUTLS_X509_FMT_PEM, tl_flags, tl_vflags)
++		: add_system_trust(list, tl_flags, tl_vflags);
+ }
+ 
diff --git a/nixpkgs/pkgs/development/libraries/gnutls/no-security-framework.patch b/nixpkgs/pkgs/development/libraries/gnutls/no-security-framework.patch
new file mode 100644
index 000000000000..7f5808e50535
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gnutls/no-security-framework.patch
@@ -0,0 +1,126 @@
+commit 9bcdde1ab9cdff6a4471f9a926dd488ab70c7247
+Author: Daiderd Jordan <daiderd@gmail.com>
+Date:   Mon Apr 22 16:38:27 2019 +0200
+
+    Revert "gnutls_x509_trust_list_add_system_trust: Add macOS keychain support"
+    
+    This reverts commit c0eb46d3463cd21b3f822ac377ff37f067f66b8d.
+
+diff --git a/configure.ac b/configure.ac
+index 8ad597bfd..8d14f26cd 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -781,7 +781,7 @@ dnl auto detect https://lists.gnu.org/archive/html/help-gnutls/2012-05/msg00004.
+ AC_ARG_WITH([default-trust-store-file],
+   [AS_HELP_STRING([--with-default-trust-store-file=FILE],
+     [use the given file default trust store])], with_default_trust_store_file="$withval",
+-  [if test "$build" = "$host" && test x$with_default_trust_store_pkcs11 = x && test x$with_default_trust_store_dir = x && test x$have_macosx = x;then
++  [if test "$build" = "$host" && test x$with_default_trust_store_pkcs11 = x && test x$with_default_trust_store_dir = x;then
+   for i in \
+     /etc/ssl/ca-bundle.pem \
+     /etc/ssl/certs/ca-certificates.crt \
+diff --git a/lib/Makefile.am b/lib/Makefile.am
+index fe9cf63a2..745695f7e 100644
+--- a/lib/Makefile.am
++++ b/lib/Makefile.am
+@@ -203,10 +203,6 @@ if WINDOWS
+ thirdparty_libadd += -lcrypt32
+ endif
+ 
+-if MACOSX
+-libgnutls_la_LDFLAGS += -framework Security -framework CoreFoundation
+-endif
+-
+ libgnutls_la_LIBADD += $(thirdparty_libadd)
+ 
+ # C++ library
+diff --git a/lib/system/certs.c b/lib/system/certs.c
+index 611c645e0..912b0aa5e 100644
+--- a/lib/system/certs.c
++++ b/lib/system/certs.c
+@@ -44,12 +44,6 @@
+ # endif
+ #endif
+ 
+-#ifdef __APPLE__
+-# include <CoreFoundation/CoreFoundation.h>
+-# include <Security/Security.h>
+-# include <Availability.h>
+-#endif
+-
+ /* System specific function wrappers for certificate stores.
+  */
+ 
+@@ -276,72 +270,6 @@ int add_system_trust(gnutls_x509_trust_list_t list, unsigned int tl_flags,
+ 
+ 	return r;
+ }
+-#elif defined(__APPLE__) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
+-static
+-int osstatus_error(status)
+-{
+-	CFStringRef err_str = SecCopyErrorMessageString(status, NULL);
+-	_gnutls_debug_log("Error loading system root certificates: %s\n",
+-			  CFStringGetCStringPtr(err_str, kCFStringEncodingUTF8));
+-	CFRelease(err_str);
+-	return GNUTLS_E_FILE_ERROR;
+-}
+-
+-static
+-int add_system_trust(gnutls_x509_trust_list_t list, unsigned int tl_flags,
+-		     unsigned int tl_vflags)
+-{
+-	int r=0;
+-
+-	SecTrustSettingsDomain domain[] = { kSecTrustSettingsDomainUser,
+-					    kSecTrustSettingsDomainAdmin,
+-					    kSecTrustSettingsDomainSystem };
+-	for (size_t d=0; d<sizeof(domain)/sizeof(*domain); d++) {
+-		CFArrayRef certs = NULL;
+-		OSStatus status = SecTrustSettingsCopyCertificates(domain[d],
+-								   &certs);
+-		if (status == errSecNoTrustSettings)
+-			continue;
+-		if (status != errSecSuccess)
+-			return osstatus_error(status);
+-
+-		int cert_count = CFArrayGetCount(certs);
+-		for (int i=0; i<cert_count; i++) {
+-			SecCertificateRef cert =
+-				(void*)CFArrayGetValueAtIndex(certs, i);
+-			CFDataRef der;
+-			status = SecItemExport(cert, kSecFormatX509Cert, 0,
+-					       NULL, &der);
+-			if (status != errSecSuccess) {
+-				CFRelease(der);
+-				CFRelease(certs);
+-				return osstatus_error(status);
+-			}
+-
+-			if (gnutls_x509_trust_list_add_trust_mem(list,
+-								 &(gnutls_datum_t) {
+-									.data = (void*)CFDataGetBytePtr(der),
+-									.size = CFDataGetLength(der),
+-								 },
+-								 NULL,
+-			                                         GNUTLS_X509_FMT_DER,
+-								 tl_flags,
+-								 tl_vflags) > 0)
+-				r++;
+-			CFRelease(der);
+-		}
+-		CFRelease(certs);
+-	}
+-
+-#ifdef DEFAULT_BLACKLIST_FILE
+-	ret = gnutls_x509_trust_list_remove_trust_file(list, DEFAULT_BLACKLIST_FILE, GNUTLS_X509_FMT_PEM);
+-	if (ret < 0) {
+-		_gnutls_debug_log("Could not load blacklist file '%s'\n", DEFAULT_BLACKLIST_FILE);
+-	}
+-#endif
+-
+-	return r;
+-}
+ #else
+ 
+ #define add_system_trust(x,y,z) GNUTLS_E_UNIMPLEMENTED_FEATURE
diff --git a/nixpkgs/pkgs/development/libraries/gobject-introspection/absolute_gir_path.patch b/nixpkgs/pkgs/development/libraries/gobject-introspection/absolute_gir_path.patch
new file mode 100644
index 000000000000..d4160b51d68c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gobject-introspection/absolute_gir_path.patch
@@ -0,0 +1,11 @@
+--- a/gir/cairo-1.0.gir.in
++++ b/gir/cairo-1.0.gir.in
+@@ -5,7 +5,7 @@
+             xmlns:glib="http://www.gtk.org/introspection/glib/1.0">
+   <package name="@CAIRO_GIR_PACKAGE@"/>
+   <namespace name="cairo" version="1.0"
+-	     shared-library="@CAIRO_SHARED_LIBRARY@"
++	     shared-library="@cairoLib@/@CAIRO_SHARED_LIBRARY@"
+ 	     c:identifier-prefixes="cairo"
+ 	     c:symbol-prefixes="cairo">
+     <record name="Context" c:type="cairo_t" foreign="1"
diff --git a/nixpkgs/pkgs/development/libraries/gobject-introspection/absolute_shlib_path.patch b/nixpkgs/pkgs/development/libraries/gobject-introspection/absolute_shlib_path.patch
new file mode 100644
index 000000000000..6e56d3fab411
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gobject-introspection/absolute_shlib_path.patch
@@ -0,0 +1,142 @@
+--- a/giscanner/scannermain.py
++++ b/giscanner/scannermain.py
+@@ -95,6 +95,39 @@ def get_windows_option_group(parser):
+     return group
+ 
+ 
++def _get_default_fallback_libpath():
++    # Newer multiple-output-optimized stdenv has an environment variable
++    # $outputLib which in turn specifies another variable which then is used as
++    # the destination for the library contents (${!outputLib}/lib).
++    store_path = os.environ.get(os.environ.get("outputLib")) if "outputLib" in os.environ else None
++    if store_path is None:
++        outputs = os.environ.get("outputs", "out").split()
++        if "lib" in outputs:
++            # For multiple output derivations let's try whether there is a $lib
++            # environment variable and use that as the base store path.
++            store_path = os.environ.get("lib")
++        elif "out" in outputs:
++            # Otherwise we have a single output derivation, so the libraries
++            # most certainly will end up in "$out/lib".
++            store_path = os.environ.get("out")
++
++    if store_path is not None:
++        # Even if we have a $lib as output, there still should be a $lib/lib
++        # directory.
++        return os.path.join(store_path, 'lib')
++    else:
++        # If we haven't found a possible scenario, let's return an empty string
++        # so that the shared library won't be prepended with a path.
++        #
++        # Note that this doesn't mean that all hope is lost, because after all
++        # we can still use --fallback-library-path to set one.
++        #
++        # Also, we're not returning None, because that would make it very
++        # difficult to disable adding fallback paths altogether using something
++        # like: --fallback-library-path=""
++        return ""
++
++
+ def _get_option_parser():
+     parser = optparse.OptionParser('%prog [options] sources',
+                                    version='%prog ' + giscanner.__version__)
+@@ -205,6 +238,10 @@ match the namespace prefix.""")
+     parser.add_option("", "--filelist",
+                       action="store", dest="filelist", default=[],
+                       help="file containing headers and sources to be scanned")
++    parser.add_option("", "--fallback-library-path",
++                      action="store", dest="fallback_libpath",
++                      default=_get_default_fallback_libpath(),
++                      help="Path to prepend to unknown shared libraries")
+ 
+     group = get_preprocessor_option_group(parser)
+     parser.add_option_group(group)
+--- a/giscanner/shlibs.py
++++ b/giscanner/shlibs.py
+@@ -57,6 +57,12 @@ def _ldd_library_pattern(library_name):
+     $""" % re.escape(library_name), re.VERBOSE)
+ 
+ 
++def _ldd_library_nix_pattern(library_name):
++    nix_store_dir = re.escape('@nixStoreDir@'.rstrip('/'))
++    pattern = r'(%s(?:/[^/]*)+lib%s[^A-Za-z0-9_-][^\s\(\)]*)'
++    return re.compile(pattern % (nix_store_dir, re.escape(library_name)))
++
++
+ # This is a what we do for non-la files. We assume that we are on an
+ # ELF-like system where ldd exists and the soname extracted with ldd is
+ # a filename that can be opened with dlopen().
+@@ -106,7 +112,8 @@ def _resolve_non_libtool(options, binary, libraries):
+             output = output.decode("utf-8", "replace")
+ 
+         shlibs = resolve_from_ldd_output(libraries, output)
+-        return list(map(sanitize_shlib_path, shlibs))
++        fallback_libpath = options.fallback_libpath or "";
++        return list(map(lambda p: os.path.join(fallback_libpath, p), map(sanitize_shlib_path, shlibs)))
+ 
+ 
+ def sanitize_shlib_path(lib):
+@@ -115,19 +122,18 @@ def sanitize_shlib_path(lib):
+     # In case we get relative paths on macOS (like @rpath) then we fall
+     # back to the basename as well:
+     # https://gitlab.gnome.org/GNOME/gobject-introspection/issues/222
+-    if sys.platform == "darwin":
+-        if not os.path.isabs(lib):
+-            return os.path.basename(lib)
+-        return lib
+-    else:
++
++    # Always use absolute paths if available
++    if not os.path.isabs(lib):
+         return os.path.basename(lib)
++    return lib
+ 
+ 
+ def resolve_from_ldd_output(libraries, output):
+     patterns = {}
+     for library in libraries:
+         if not os.path.isfile(library):
+-            patterns[library] = _ldd_library_pattern(library)
++            patterns[library] = (_ldd_library_pattern(library), _ldd_library_nix_pattern(library))
+     if len(patterns) == 0:
+         return []
+ 
+@@ -139,8 +145,11 @@ def resolve_from_ldd_output(libraries, output):
+         if line.endswith(':'):
+             continue
+         for word in line.split():
+-            for library, pattern in patterns.items():
+-                m = pattern.match(word)
++            for library, (pattern, nix_pattern) in patterns.items():
++                if line.find('@nixStoreDir@') != -1:
++                    m = nix_pattern.match(word)
++                else:
++                    m = pattern.match(word)
+                 if m:
+                     del patterns[library]
+                     shlibs.append(m.group())
+--- a/giscanner/utils.py
++++ b/giscanner/utils.py
+@@ -111,17 +111,11 @@ def extract_libtool_shlib(la_file):
+     if dlname is None:
+         return None
+ 
+-    # Darwin uses absolute paths where possible; since the libtool files never
+-    # contain absolute paths, use the libdir field
+-    if platform.system() == 'Darwin':
+-        dlbasename = os.path.basename(dlname)
+-        libdir = _extract_libdir_field(la_file)
+-        if libdir is None:
+-            return dlbasename
+-        return libdir + '/' + dlbasename
+-    # From the comments in extract_libtool(), older libtools had
+-    # a path rather than the raw dlname
+-    return os.path.basename(dlname)
++    dlbasename = os.path.basename(dlname)
++    libdir = _extract_libdir_field(la_file)
++    if libdir is None:
++        return dlbasename
++    return libdir + '/' + dlbasename
+ 
+ 
+ def extract_libtool(la_file):
diff --git a/nixpkgs/pkgs/development/libraries/gobject-introspection/default.nix b/nixpkgs/pkgs/development/libraries/gobject-introspection/default.nix
new file mode 100644
index 000000000000..26c472930ed5
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gobject-introspection/default.nix
@@ -0,0 +1,80 @@
+{ stdenv, fetchurl, glib, flex, bison, meson, ninja, pkgconfig, libffi, python3
+, libintl, cctools, cairo, gnome3, glibcLocales, fetchpatch
+, substituteAll, nixStoreDir ? builtins.storeDir
+, x11Support ? true
+}:
+# now that gobject-introspection creates large .gir files (eg gtk3 case)
+# it may be worth thinking about using multiple derivation outputs
+# In that case its about 6MB which could be separated
+
+let
+  pname = "gobject-introspection";
+  version = "1.60.1";
+in
+with stdenv.lib;
+stdenv.mkDerivation rec {
+  name = "${pname}-${version}";
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${name}.tar.xz";
+    sha256 = "1cr4r3lh5alrks9q2ycs1kn2crnkhrhn2wrmibng6dndkr4x2i6q";
+  };
+
+  outputs = [ "out" "dev" "man" ];
+  outputBin = "dev";
+
+  LC_ALL = "en_US.UTF-8"; # for tests
+
+  nativeBuildInputs = [ meson ninja pkgconfig libintl glibcLocales ];
+  buildInputs = [ flex bison python3 setupHook/*move .gir*/ ]
+    ++ stdenv.lib.optional stdenv.isDarwin cctools;
+  propagatedBuildInputs = [ libffi glib ];
+
+  mesonFlags = [
+    "--datadir=${placeholder "dev"}/share"
+  ];
+
+  # outputs TODO: share/gobject-introspection-1.0/tests is needed during build
+  # by pygobject3 (and maybe others), but it's only searched in $out
+
+  setupHook = ./setup-hook.sh;
+
+  patches = [
+    (substituteAll {
+      src = ./test_shlibs.patch;
+      inherit nixStoreDir;
+    })
+    (substituteAll {
+      src = ./absolute_shlib_path.patch;
+      inherit nixStoreDir;
+    })
+  ] ++ stdenv.lib.optional x11Support # https://github.com/NixOS/nixpkgs/issues/34080
+    (substituteAll {
+      src = ./absolute_gir_path.patch;
+      cairoLib = "${getLib cairo}/lib";
+    });
+
+  doCheck = !stdenv.isAarch64;
+
+  passthru = {
+    updateScript = gnome3.updateScript {
+      packageName = pname;
+    };
+  };
+
+  meta = with stdenv.lib; {
+    description = "A middleware layer between C libraries and language bindings";
+    homepage    = http://live.gnome.org/GObjectIntrospection;
+    maintainers = with maintainers; [ lovek323 lethalman ];
+    platforms   = platforms.unix;
+    license = with licenses; [ gpl2 lgpl2 ];
+
+    longDescription = ''
+      GObject introspection is a middleware layer between C libraries (using
+      GObject) and language bindings. The C library can be scanned at compile
+      time and generate a metadata file, in addition to the actual native C
+      library. Then at runtime, language bindings can read this metadata and
+      automatically provide bindings to call into the C library.
+    '';
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gobject-introspection/setup-hook.sh b/nixpkgs/pkgs/development/libraries/gobject-introspection/setup-hook.sh
new file mode 100644
index 000000000000..a68d544cfbe5
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gobject-introspection/setup-hook.sh
@@ -0,0 +1,27 @@
+make_gobject_introspection_find_gir_files() {
+    # required for .typelib files, eg mypaint git version
+    if [ -d "$1/lib/girepository-1.0" ]; then
+      addToSearchPath GI_TYPELIB_PATH $1/lib/girepository-1.0
+    fi
+
+    # XDG_DATA_DIRS: required for finding .gir files
+    if [ -d "$1/share/gir-1.0" ]; then
+      addToSearchPath XDG_DATA_DIRS $1/share
+    fi
+}
+
+addEnvHooks "$hostOffset" make_gobject_introspection_find_gir_files
+
+giDiscoverSelf() {
+    if [ -d "$prefix/lib/girepository-1.0" ]; then
+      addToSearchPath GI_TYPELIB_PATH $prefix/lib/girepository-1.0
+    fi
+}
+
+preFixupHooks+=(giDiscoverSelf)
+
+_multioutMoveGlibGir() {
+  moveToOutput share/gir-1.0 "${!outputDev}"
+}
+
+preFixupHooks+=(_multioutMoveGlibGir)
diff --git a/nixpkgs/pkgs/development/libraries/gobject-introspection/test_shlibs.patch b/nixpkgs/pkgs/development/libraries/gobject-introspection/test_shlibs.patch
new file mode 100644
index 000000000000..65b5a1a13b91
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gobject-introspection/test_shlibs.patch
@@ -0,0 +1,43 @@
+--- a/tests/scanner/test_shlibs.py
++++ b/tests/scanner/test_shlibs.py
+@@ -7,6 +7,30 @@ from giscanner.shlibs import resolve_from_ldd_output, sanitize_shlib_path
+ 
+ class TestLddParser(unittest.TestCase):
+ 
++    def test_resolve_from_ldd_output_nix(self):
++        output = '''\
++            libglib-2.0.so.0 => @nixStoreDir@/gmrf09y7sfxrr0mcx90dba7w41jj2kzk-glib-2.58.1/lib/libglib-2.0.so.0 (0x00007f0ee1b28000)
++            libgobject-2.0.so.0 => @nixStoreDir@/gmrf09y7sfxrr0mcx90dba7w41jj2kzk-glib-2.58.1/lib/libgobject-2.0.so.0 (0x00007f0ee18cf000)
++            libgio-2.0.so.0 => @nixStoreDir@/gmrf09y7sfxrr0mcx90dba7w41jj2kzk-glib-2.58.1/lib/libgio-2.0.so.0 (0x00007f0ee1502000)
++            libxml2.so.2 => @nixStoreDir@/72mxkk74cv266snkjpz1kwl1i2rg8rpc-libxml2-2.9.8/lib/libxml2.so.2 (0x00007f0ee119c000)
++            libsqlite3.so.0 => @nixStoreDir@/ck5ay23hsmlc67pg3m34kzd1k2hhvww0-sqlite-3.24.0/lib/libsqlite3.so.0 (0x00007f0ee0e98000)
++            libpsl.so.5 => @nixStoreDir@/qn3l2gn7m76f318676wflrs2z6d4rrkj-libpsl-0.20.2-list-2017-02-03/lib/libpsl.so.5 (0x00007f0ee0c88000)
++            libc.so.6 => @nixStoreDir@/g2yk54hifqlsjiha3szr4q3ccmdzyrdv-glibc-2.27/lib/libc.so.6 (0x00007f0ee08d4000)
++            libpcre.so.1 => @nixStoreDir@/hxbq8lpc53qsf1bc0dfcsm47wmcxzjvh-pcre-8.42/lib/libpcre.so.1 (0x00007f0ee0662000)
++            @nixStoreDir@/g2yk54hifqlsjiha3szr4q3ccmdzyrdv-glibc-2.27/lib64/ld-linux-x86-64.so.2 (0x00007f0ee20ff000)
++            libblkid.so.1 => @nixStoreDir@/q0kgnq21j0l2yd77gdlld371246cwghh-util-linux-2.32.1/lib/libblkid.so.1 (0x00007f0edd0cd000)
++            libuuid.so.1 => @nixStoreDir@/q0kgnq21j0l2yd77gdlld371246cwghh-util-linux-2.32.1/lib/libuuid.so.1 (0x00007f0edcec5000)
++            librt.so.1 => @nixStoreDir@/g2yk54hifqlsjiha3szr4q3ccmdzyrdv-glibc-2.27/lib/librt.so.1 (0x00007f0edccbd000)
++            libstdc++.so.6 => @nixStoreDir@/3v5r7fkrbkw2qajadvjbf6p6qriz9p1i-gcc-7.3.0-lib/lib/libstdc++.so.6 (0x00007f0edc936000)
++            libgcc_s.so.1 => @nixStoreDir@/g2yk54hifqlsjiha3szr4q3ccmdzyrdv-glibc-2.27/lib/libgcc_s.so.1 (0x00007f0edc720000)
++        '''
++        libraries = ['glib-2.0', 'gio-2.0']
++
++        self.assertEqual(
++            ['@nixStoreDir@/gmrf09y7sfxrr0mcx90dba7w41jj2kzk-glib-2.58.1/lib/libglib-2.0.so.0',
++             '@nixStoreDir@/gmrf09y7sfxrr0mcx90dba7w41jj2kzk-glib-2.58.1/lib/libgio-2.0.so.0'],
++            resolve_from_ldd_output(libraries, output))
++
+     def test_resolve_from_ldd_output(self):
+         output = '''\
+             libglib-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007fbe12d68000)
+@@ -40,7 +64,8 @@ class TestLddParser(unittest.TestCase):
+ 
+         self.assertEqual(
+             sanitize_shlib_path('/foo/bar'),
+-            '/foo/bar' if sys.platform == 'darwin' else 'bar')
++            # NixOS always want the absolute path
++            '/foo/bar')
+ 
+     def test_unresolved_library(self):
+         output = ''
diff --git a/nixpkgs/pkgs/development/libraries/goffice/default.nix b/nixpkgs/pkgs/development/libraries/goffice/default.nix
new file mode 100644
index 000000000000..a14c40e6d87e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/goffice/default.nix
@@ -0,0 +1,45 @@
+{ fetchurl, stdenv, pkgconfig, intltool, glib, gtk3, lasem
+, libgsf, libxml2, libxslt, cairo, pango, librsvg, gnome3 }:
+
+stdenv.mkDerivation rec {
+  pname = "goffice";
+  version = "0.10.45";
+
+  outputs = [ "out" "dev" "devdoc" ];
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    sha256 = "702ba567e9ec0bbdd9b1a8161cd24648b4868d57a6cb89128f13c125f6f31947";
+  };
+
+  nativeBuildInputs = [ pkgconfig intltool ];
+
+  propagatedBuildInputs = [
+    glib gtk3 libxml2 cairo pango libgsf lasem
+  ];
+
+  buildInputs = [ libxslt librsvg ];
+
+  enableParallelBuilding = true;
+  doCheck = true;
+
+  passthru = {
+    updateScript = gnome3.updateScript {
+      packageName = pname;
+    };
+  };
+
+  meta = {
+    description = "A Glib/GTK+ set of document centric objects and utilities";
+
+    longDescription = ''
+      There are common operations for document centric applications that are
+      conceptually simple, but complex to implement fully: plugins, load/save
+      documents, undo/redo.
+    '';
+
+    license = stdenv.lib.licenses.gpl2Plus;
+
+    platforms = stdenv.lib.platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gom/default.nix b/nixpkgs/pkgs/development/libraries/gom/default.nix
new file mode 100644
index 000000000000..5694c50e90a3
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gom/default.nix
@@ -0,0 +1,73 @@
+{ stdenv
+, fetchurl
+, fetchpatch
+, meson
+, ninja
+, pkgconfig
+, glib
+, python3
+, sqlite
+, gdk_pixbuf
+, gnome3
+, gobject-introspection
+}:
+
+stdenv.mkDerivation rec {
+  pname = "gom";
+  version = "0.3.3";
+
+  outputs = [ "out" "py" ];
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    sha256 = "1n1n226dyb3q98216aah87in9hhjcwsbpspsdqqfswz2bx5y6mxc";
+  };
+
+  patches = [
+    # Needed to apply the next patch
+    (fetchpatch {
+      url = "https://gitlab.gnome.org/GNOME/gom/commit/e8b7c314ce61d459132cf03c9e455d2a01fdc6ea.patch";
+      sha256 = "0d7g3nm5lrfhfx9ly8qgf5bfp12kvr7m1xmlgin2q8vqpn0r2ggp";
+    })
+    # https://gitlab.gnome.org/GNOME/gom/merge_requests/3
+    (fetchpatch {
+      url = "https://gitlab.gnome.org/worldofpeace/gom/commit/b621c15600b1c32826c9878565eb2398a50907f2.patch";
+      sha256 = "1hqck9bb7sxn4akisnn26sbddlphjsavgksick5k4h3rsc0xwx1v";
+    })
+    ./longer-stress-timeout.patch
+  ];
+
+  nativeBuildInputs = [
+    gobject-introspection
+    meson
+    ninja
+    pkgconfig
+  ];
+
+  buildInputs = [
+    gdk_pixbuf
+    glib
+    sqlite
+    python3.pkgs.pygobject3
+  ];
+
+  mesonFlags = [
+    "-Dpygobject-override-dir=${placeholder "py"}/${python3.sitePackages}/gi/overrides"
+  ];
+
+  doCheck = true;
+
+  passthru = {
+    updateScript = gnome3.updateScript {
+      packageName = pname;
+    };
+  };
+
+  meta = with stdenv.lib; {
+    description = "A GObject to SQLite object mapper";
+    homepage = https://wiki.gnome.org/Projects/Gom;
+    license = licenses.lgpl21Plus;
+    platforms = platforms.linux;
+    maintainers = gnome3.maintainers;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gom/longer-stress-timeout.patch b/nixpkgs/pkgs/development/libraries/gom/longer-stress-timeout.patch
new file mode 100644
index 000000000000..3dcd1d0a107f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gom/longer-stress-timeout.patch
@@ -0,0 +1,13 @@
+diff --git a/tests/meson.build b/tests/meson.build
+index 1df4884..d7a6f5d 100644
+--- a/tests/meson.build
++++ b/tests/meson.build
+@@ -25,7 +25,7 @@ test('test-gom-find', test_find)
+ 
+ test_stress = executable('test-gom-stress', 'test-gom-stress.c',
+   dependencies: [libgom_dep])
+-test('test-gom-stress', test_stress, timeout: 300)
++test('test-gom-stress', test_stress, timeout: 500)
+ 
+ test_transform = executable('test-gom-transform', 'test-gom-transform.c',
+   c_args: '-DIMAGE="@0@/gnome.png"'.format(meson.current_source_dir()),
diff --git a/nixpkgs/pkgs/development/libraries/goocanvas/2.x.nix b/nixpkgs/pkgs/development/libraries/goocanvas/2.x.nix
new file mode 100644
index 000000000000..99b1307179a5
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/goocanvas/2.x.nix
@@ -0,0 +1,31 @@
+{ stdenv, fetchurl, pkgconfig, gettext, gtk-doc, gobject-introspection, python2, gtk3, cairo, glib }:
+
+let
+  version = "2.0.4";
+in stdenv.mkDerivation rec {
+  name = "goocanvas-${version}";
+
+  outputs = [ "out" "dev" "devdoc" ];
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/goocanvas/2.0/${name}.tar.xz";
+    sha256 = "141fm7mbqib0011zmkv3g8vxcjwa7hypmq71ahdyhnj2sjvy4a67";
+  };
+
+  nativeBuildInputs = [ pkgconfig gettext gtk-doc python2 ];
+  buildInputs = [ gtk3 cairo glib gobject-introspection ];
+
+  configureFlags = [
+    "--disable-python"
+  ];
+  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; {
+    description = "Canvas widget for GTK+ based on the the Cairo 2D library";
+    homepage = https://wiki.gnome.org/Projects/GooCanvas;
+    license = licenses.lgpl2;
+    maintainers = with maintainers; [ ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/goocanvas/default.nix b/nixpkgs/pkgs/development/libraries/goocanvas/default.nix
new file mode 100644
index 000000000000..435c1f30bace
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/goocanvas/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchurl, gtk2, cairo, glib, pkgconfig, 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";
+    sha256 = "07kicpcacbqm3inp7zq32ldp95mxx4kfxpaazd0x5jk7hpw2w1qw";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ gtk2 cairo glib ];
+
+  passthru = {
+    updateScript = gnome3.updateScript {
+      packageName = pname;
+      versionPolicy = "none";
+    };
+  };
+
+  meta = with stdenv.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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/goocanvasmm/default.nix b/nixpkgs/pkgs/development/libraries/goocanvasmm/default.nix
new file mode 100644
index 000000000000..b7f56837686d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/goocanvasmm/default.nix
@@ -0,0 +1,31 @@
+{ stdenv, fetchurl, pkgconfig, goocanvas2, gtkmm3, gnome3 }:
+
+stdenv.mkDerivation rec {
+  pname = "goocanvasmm";
+  version = "1.90.11";
+
+  outputs = [ "out" "dev" ];
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    sha256 = "0vpdfrj59nwzwj8bk4s0h05iyql62pxjzsxh72g3vry07s3i3zw0";
+  };
+  nativeBuildInputs = [ pkgconfig ];
+  propagatedBuildInputs = [ gtkmm3 goocanvas2 ];
+
+  enableParallelBuilding = true;
+
+  passthru = {
+    updateScript = gnome3.updateScript {
+      packageName = pname;
+    };
+  };
+
+  meta = with stdenv.lib; {
+    description = "C++ bindings for GooCanvas";
+    homepage = https://wiki.gnome.org/Projects/GooCanvas;
+    license = licenses.lgpl2;
+    maintainers = with maintainers; [ ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/google-gflags/default.nix b/nixpkgs/pkgs/development/libraries/google-gflags/default.nix
new file mode 100644
index 000000000000..fefc3a8b4b81
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/google-gflags/default.nix
@@ -0,0 +1,38 @@
+{ stdenv, fetchFromGitHub, cmake }:
+
+stdenv.mkDerivation rec {
+  name = "google-gflags-${version}";
+  version = "2.2.2";
+
+  src = fetchFromGitHub {
+    owner = "gflags";
+    repo = "gflags";
+    rev = "v${version}";
+    sha256 = "147i3md3nxkjlrccqg4mq1kyzc7yrhvqv5902iibc7znkvzdvlp0";
+  };
+
+  nativeBuildInputs = [ cmake ];
+
+  # This isn't used by the build and breaks the CMake build on case-insensitive filesystems (e.g., on Darwin)
+  preConfigure = "rm BUILD";
+
+  cmakeFlags = [
+    "-DBUILD_SHARED_LIBS=ON"
+    "-DBUILD_STATIC_LIBS=ON"
+  ];
+
+  doCheck = false;
+
+  meta = with stdenv.lib; {
+    description = "A C++ library that implements commandline flags processing";
+    longDescription = ''
+      The gflags package contains a C++ library that implements commandline flags processing.
+      As such it's a replacement for getopt().
+      It was owned by Google. google-gflags project has been renamed to gflags and maintained by new community.
+    '';
+    homepage = https://gflags.github.io/gflags/;
+    license = licenses.bsd3;
+    maintainers = [ maintainers.linquize ];
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gperftools/default.nix b/nixpkgs/pkgs/development/libraries/gperftools/default.nix
new file mode 100644
index 000000000000..44339c3dfedd
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gperftools/default.nix
@@ -0,0 +1,36 @@
+{ stdenv, fetchurl, libunwind }:
+
+stdenv.mkDerivation rec {
+  name = "gperftools-2.6.3";
+
+  src = fetchurl {
+    url = "https://github.com/gperftools/gperftools/releases/download/${name}/${name}.tar.gz";
+    sha256 = "17zfivp6n00rlqbrx6q6h71y2f815nvlzysff1ihgk4mxpv2yjri";
+  };
+
+  buildInputs = stdenv.lib.optional stdenv.isLinux libunwind;
+
+  prePatch = stdenv.lib.optionalString stdenv.isDarwin ''
+    substituteInPlace Makefile.am --replace stdc++ c++
+    substituteInPlace Makefile.in --replace stdc++ c++
+    substituteInPlace libtool --replace stdc++ c++
+  '';
+
+  NIX_CFLAGS_COMPILE = stdenv.lib.optionals stdenv.isDarwin [
+    "-D_XOPEN_SOURCE" "-Wno-aligned-allocation-unavailable"
+  ];
+
+  # some packages want to link to the static tcmalloc_minimal
+  # to drop the runtime dependency on gperftools
+  dontDisableStatic = true;
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    homepage = https://github.com/gperftools/gperftools;
+    description = "Fast, multi-threaded malloc() and nifty performance analysis tools";
+    platforms = with platforms; linux ++ darwin;
+    license = licenses.bsd3;
+    maintainers = with maintainers; [ vcunat ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gpgme/default.nix b/nixpkgs/pkgs/development/libraries/gpgme/default.nix
new file mode 100644
index 000000000000..fc7634128dc0
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gpgme/default.nix
@@ -0,0 +1,74 @@
+{ stdenv, fetchurl, libgpgerror, gnupg, pkgconfig, glib, pth, libassuan
+, file, which, ncurses
+, texinfo
+, buildPackages
+, qtbase ? null
+, pythonSupport ? false, swig2 ? null, python ? null
+}:
+
+let
+  inherit (stdenv) lib;
+  inherit (stdenv.hostPlatform) system;
+in
+
+stdenv.mkDerivation rec {
+  name = "gpgme-${version}";
+  version = "1.13.0";
+
+  src = fetchurl {
+    url = "mirror://gnupg/gpgme/${name}.tar.bz2";
+    sha256 = "0c6676g0yhfsmy32i1dgwh5cx0ja8vhcqf4k08zad177m53kxcnl";
+  };
+
+  outputs = [ "out" "dev" "info" ];
+  outputBin = "dev"; # gpgme-config; not so sure about gpgme-tool
+
+  propagatedBuildInputs =
+    [ libgpgerror glib libassuan pth ]
+    ++ lib.optional (qtbase != null) qtbase;
+
+  nativeBuildInputs = [ file pkgconfig gnupg texinfo ]
+  ++ lib.optionals pythonSupport [ python swig2 which ncurses ];
+
+  depsBuildBuild = [ buildPackages.stdenv.cc ];
+
+  postPatch =''
+    substituteInPlace ./configure --replace /usr/bin/file ${file}/bin/file
+  '';
+
+  configureFlags = [
+    "--enable-fixed-path=${gnupg}/bin"
+    "--with-libgpg-error-prefix=${libgpgerror.dev}"
+    "--with-libassuan-prefix=${libassuan.dev}"
+  ] ++ lib.optional pythonSupport "--enable-languages=python"
+  # Tests will try to communicate with gpg-agent instance via a UNIX socket
+  # which has a path length limit. Nix on darwin is using a build directory
+  # that already has quite a long path and the resulting socket path doesn't
+  # fit in the limit. https://github.com/NixOS/nix/pull/1085
+    ++ lib.optionals stdenv.isDarwin [ "--disable-gpg-test" ];
+
+  NIX_CFLAGS_COMPILE =
+    # qgpgme uses Q_ASSERT which retains build inputs at runtime unless
+    # debugging is disabled
+    lib.optional (qtbase != null) "-DQT_NO_DEBUG"
+    # https://www.gnupg.org/documentation/manuals/gpgme/Largefile-Support-_0028LFS_0029.html
+    ++ lib.optional (system == "i686-linux") "-D_FILE_OFFSET_BITS=64";
+
+  checkInputs = [ which ];
+
+  doCheck = true;
+
+  meta = with stdenv.lib; {
+    homepage = https://gnupg.org/software/gpgme/index.html;
+    description = "Library for making GnuPG easier to use";
+    longDescription = ''
+      GnuPG Made Easy (GPGME) is a library designed to make access to GnuPG
+      easier for applications. It provides a High-Level Crypto API for
+      encryption, decryption, signing, signature verification and key
+      management.
+    '';
+    license = with licenses; [ lgpl21Plus gpl3Plus ];
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ fuuzetsu primeos ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/grail/default.nix b/nixpkgs/pkgs/development/libraries/grail/default.nix
new file mode 100644
index 000000000000..a48490ffae57
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/grail/default.nix
@@ -0,0 +1,25 @@
+{ enableX11 ? true,
+  stdenv, fetchurl, pkgconfig, xorg, python3, frame }:
+
+stdenv.mkDerivation rec {
+  name = "grail-${version}";
+  version = "3.1.1";
+
+  src = fetchurl {
+    url = "https://launchpad.net/grail/trunk/${version}/+download/${name}.tar.bz2";
+    sha256 = "1wwx5ibjdz5pyd0f5cd1n91y67r68dymxpm2lgd829041xjizvay";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ python3 frame ]
+  ++ stdenv.lib.optionals enableX11 [xorg.libX11 xorg.libXtst xorg.libXext xorg.libXi xorg.libXfixes];
+
+  configureFlags = stdenv.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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/grantlee/5/default.nix b/nixpkgs/pkgs/development/libraries/grantlee/5/default.nix
new file mode 100644
index 000000000000..52c087b19147
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/grantlee/5/default.nix
@@ -0,0 +1,52 @@
+{ mkDerivation, lib, copyPathsToStore, fetchurl, qtbase, qtscript, cmake }:
+
+mkDerivation rec {
+  name = "grantlee-${version}";
+  version = "5.1.0";
+  grantleeCompatVersion = "5.1";
+  grantleePluginPrefix = "lib/grantlee/${grantleeCompatVersion}";
+
+  src = fetchurl {
+    url = "https://github.com/steveire/grantlee/archive/v${version}.tar.gz";
+    sha256 = "1lf9rkv0i0kd7fvpgg5l8jb87zw8dzcwd1liv6hji7g4wlpmfdiq";
+    name = "${name}.tar.gz";
+  };
+
+  buildInputs = [ qtbase qtscript ];
+  nativeBuildInputs = [ cmake ];
+
+  patches = copyPathsToStore (lib.readPathsFromFile ./. ./series);
+
+  outputs = [ "out" "dev" ];
+  postFixup =
+    # Disabuse CMake of the notion that libraries are in $dev
+    ''
+      for way in release debug; do
+          cmake="$dev/lib/cmake/Grantlee5/GrantleeTargets-$way.cmake"
+          if [ -f "$cmake" ]; then
+              sed -i "$cmake" -e "s|\''${_IMPORT_PREFIX}|$out|"
+          fi
+      done
+    '';
+
+  setupHook = ./setup-hook.sh;
+
+  doCheck = false; # fails all the tests (ctest)
+
+  meta = with lib; {
+    description = "Qt5 port of Django template system";
+    longDescription = ''
+      Grantlee is a plugin based String Template system written using the Qt
+      framework. The goals of the project are to make it easier for application
+      developers to separate the structure of documents from the data they
+      contain, opening the door for theming.
+
+      The syntax is intended to follow the syntax of the Django template system,
+      and the design of Django is reused in Grantlee.'';
+
+    homepage = http://gitorious.org/grantlee;
+    maintainers = [ maintainers.ttuegel ];
+    license = licenses.lgpl21;
+    inherit (qtbase.meta) platforms;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/grantlee/5/grantlee-nix-profiles.patch b/nixpkgs/pkgs/development/libraries/grantlee/5/grantlee-nix-profiles.patch
new file mode 100644
index 000000000000..f6c13dbd6d55
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/grantlee/5/grantlee-nix-profiles.patch
@@ -0,0 +1,19 @@
+Index: grantlee-5.1.0/templates/lib/engine.cpp
+===================================================================
+--- grantlee-5.1.0.orig/templates/lib/engine.cpp
++++ grantlee-5.1.0/templates/lib/engine.cpp
+@@ -48,6 +48,14 @@ Engine::Engine(QObject *parent)
+ 
+   d_ptr->m_pluginDirs = QCoreApplication::instance()->libraryPaths();
+   d_ptr->m_pluginDirs << QString::fromLocal8Bit(GRANTLEE_PLUGIN_PATH);
++
++  // Add library paths derived from NIX_PROFILES.
++  const QByteArrayList profiles = qgetenv("NIX_PROFILES").split(' ');
++  for (const QByteArray &profile: profiles) {
++    if (!profile.isEmpty()) {
++      d_ptr->m_pluginDirs << (QFile::decodeName(profile) + QStringLiteral("/lib"));
++    }
++  }
+ }
+ 
+ Engine::~Engine()
diff --git a/nixpkgs/pkgs/development/libraries/grantlee/5/grantlee-no-canonicalize-filepath.patch b/nixpkgs/pkgs/development/libraries/grantlee/5/grantlee-no-canonicalize-filepath.patch
new file mode 100644
index 000000000000..d78ef74ce352
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/grantlee/5/grantlee-no-canonicalize-filepath.patch
@@ -0,0 +1,27 @@
+Index: grantlee-5.1.0/templates/lib/templateloader.cpp
+===================================================================
+--- grantlee-5.1.0.orig/templates/lib/templateloader.cpp
++++ grantlee-5.1.0/templates/lib/templateloader.cpp
+@@ -141,10 +141,6 @@ Template FileSystemTemplateLoader::loadB
+                      + QLatin1Char('/') + fileName);
+     const QFileInfo fi(file);
+ 
+-    if (file.exists()
+-        && !fi.canonicalFilePath().contains(
+-               QDir(d->m_templateDirs.at(i)).canonicalPath()))
+-      return Template();
+     ++i;
+   }
+ 
+@@ -173,11 +169,6 @@ FileSystemTemplateLoader::getMediaUri(co
+                      + QLatin1Char('/') + fileName);
+ 
+     const QFileInfo fi(file);
+-    if (!fi.canonicalFilePath().contains(
+-            QDir(d->m_templateDirs.at(i)).canonicalPath())) {
+-      ++i;
+-      continue;
+-    }
+ 
+     if (file.exists()) {
+       auto path = fi.absoluteFilePath();
diff --git a/nixpkgs/pkgs/development/libraries/grantlee/5/series b/nixpkgs/pkgs/development/libraries/grantlee/5/series
new file mode 100644
index 000000000000..9c4015a1c197
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/grantlee/5/series
@@ -0,0 +1,2 @@
+grantlee-nix-profiles.patch
+grantlee-no-canonicalize-filepath.patch
diff --git a/nixpkgs/pkgs/development/libraries/grantlee/5/setup-hook.sh b/nixpkgs/pkgs/development/libraries/grantlee/5/setup-hook.sh
new file mode 100644
index 000000000000..b51cb4a31909
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/grantlee/5/setup-hook.sh
@@ -0,0 +1,13 @@
+grantleePluginPrefix=@grantleePluginPrefix@
+
+providesGrantleeRuntime() {
+    [ -d "$1/$grantleePluginPrefix" ]
+}
+
+_grantleeEnvHook() {
+    if providesGrantleeRuntime "$1"; then
+        propagatedBuildInputs+=" $1"
+        propagatedUserEnvPkgs+=" $1"
+    fi
+}
+addEnvHooks "$hostOffset" _grantleeEnvHook
diff --git a/nixpkgs/pkgs/development/libraries/grantlee/default.nix b/nixpkgs/pkgs/development/libraries/grantlee/default.nix
new file mode 100644
index 000000000000..1446e339745e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/grantlee/default.nix
@@ -0,0 +1,32 @@
+{ stdenv, fetchurl, qt4, cmake }:
+
+stdenv.mkDerivation rec {
+  name = "grantlee-0.5.1";
+
+# Upstream download server has country code firewall, so I made a mirror.
+  src = fetchurl {
+    urls = [
+      "http://downloads.grantlee.org/${name}.tar.gz"
+      "http://www.loegria.net/grantlee/${name}.tar.gz"
+    ];
+    sha256 = "1b501xbimizmbmysl1j5zgnp48qw0r2r7lhgmxvzhzlv9jzhj60r";
+  };
+
+  buildInputs = [ cmake qt4 ];
+
+  meta = {
+    description = "Qt4 port of Django template system";
+    longDescription = ''
+      Grantlee is a plugin based String Template system written using the Qt
+      framework. The goals of the project are to make it easier for application
+      developers to separate the structure of documents from the data they
+      contain, opening the door for theming.
+
+      The syntax is intended to follow the syntax of the Django template system,
+      and the design of Django is reused in Grantlee.'';
+
+    homepage = http://gitorious.org/grantlee;
+    license = stdenv.lib.licenses.lgpl21;
+    inherit (qt4.meta) platforms;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/graphene-hardened-malloc/default.nix b/nixpkgs/pkgs/development/libraries/graphene-hardened-malloc/default.nix
new file mode 100644
index 000000000000..0aae8ca49453
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/graphene-hardened-malloc/default.nix
@@ -0,0 +1,55 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "graphene-hardened-malloc-${version}";
+  version = "190405.003.2019.04.01.19";
+
+  src = fetchurl {
+    url = "https://github.com/GrapheneOS/hardened_malloc/archive/PQ2A.${version}.tar.gz";
+    sha256 = "1qczmajy3q07jd236dmal4iq5xxcsrkyw26gc9r4vs4wj4m42d11";
+  };
+
+  installPhase = ''
+    install -Dm444 -t $out/lib libhardened_malloc.so
+
+    mkdir -p $out/bin
+    substitute preload.sh $out/bin/preload-hardened-malloc --replace "\$dir" $out/lib
+    chmod 0555 $out/bin/preload-hardened-malloc
+  '';
+
+  doInstallCheck = true;
+  installCheckPhase = ''
+    pushd test
+    make
+    $out/bin/preload-hardened-malloc ./offset
+
+    pushd simple-memory-corruption
+    make
+
+    # these tests don't actually appear to generate overflows currently
+    rm read_after_free_small string_overflow
+
+    for t in `find . -regex ".*/[a-z_]+"` ; do
+      echo "Running $t..."
+      # the program being aborted (as it should be) would result in an exit code > 128
+      (($out/bin/preload-hardened-malloc $t) && false) \
+        || (test $? -gt 128 || (echo "$t was not aborted" && false))
+    done
+    popd
+
+    popd
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = https://github.com/GrapheneOS/hardened_malloc;
+    description = "Hardened allocator designed for modern systems";
+    longDescription = ''
+      This is a security-focused general purpose memory allocator providing the malloc API
+      along with various extensions. It provides substantial hardening against heap
+      corruption vulnerabilities yet aims to provide decent overall performance.
+    '';
+    license = licenses.mit;
+    maintainers = with maintainers; [ ris ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/graphene/0001-meson-add-options-for-tests-installation-dirs.patch b/nixpkgs/pkgs/development/libraries/graphene/0001-meson-add-options-for-tests-installation-dirs.patch
new file mode 100644
index 000000000000..d6a441e1577c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/graphene/0001-meson-add-options-for-tests-installation-dirs.patch
@@ -0,0 +1,79 @@
+From c550bf4a41e9f86351b0a65ea3d6c9ab616e27c0 Mon Sep 17 00:00:00 2001
+From: worldofpeace <worldofpeace@protonmail.ch>
+Date: Thu, 16 May 2019 21:15:15 -0400
+Subject: [PATCH] meson: add options for tests installation dirs
+
+---
+ meson_options.txt     |  6 ++++++
+ src/tests/meson.build | 19 ++++++++++++++-----
+ 2 files changed, 20 insertions(+), 5 deletions(-)
+
+diff --git a/meson_options.txt b/meson_options.txt
+index c938805..c1e9e95 100644
+--- a/meson_options.txt
++++ b/meson_options.txt
+@@ -19,6 +19,12 @@ option('arm_neon', type: 'boolean',
+ option('tests', type: 'boolean',
+        value: true,
+        description: 'Build the test suite (requires GObject)')
++option('installed_test_datadir', type: 'string',
++       value: '',
++       description: 'Installation directory for data files in tests')
++option('installed_test_bindir', type: 'string',
++       value: '',
++       description: 'Installation directory for binary files in tests')
+ option('benchmarks', type: 'boolean',
+        value: true,
+        description: 'Build the benchmarks suite (requires GObject)')
+diff --git a/src/tests/meson.build b/src/tests/meson.build
+index 62129c6..0186400 100644
+--- a/src/tests/meson.build
++++ b/src/tests/meson.build
+@@ -22,8 +22,17 @@ unit_tests = [
+ python = python3.find_python()
+ gen_installed_test = join_paths(meson.current_source_dir(), 'gen-installed-test.py')
+ 
+-installed_test_datadir = join_paths(get_option('prefix'), get_option('datadir'), 'installed-tests', graphene_api_path)
+-installed_test_bindir = join_paths(get_option('prefix'), get_option('libexecdir'), 'installed-tests', graphene_api_path)
++test_suffix = join_paths('installed-tests', graphene_api_path)
++
++test_datadir = join_paths(get_option('installed_test_datadir'), test_suffix)
++if test_datadir == ''
++    test_datadir = join_paths(get_option('prefix'), get_option('datadir'), test_suffix)
++endif
++
++test_bindir = join_paths(get_option('installed_test_bindir'), test_suffix)
++if test_bindir == ''
++    test_bindir = join_paths(get_option('prefix'), get_option('libexecdir'), test_suffix)
++endif
+ 
+ foreach unit: unit_tests
+   wrapper = '@0@.test'.format(unit)
+@@ -32,13 +41,13 @@ foreach unit: unit_tests
+                        command: [
+                          python,
+                          gen_installed_test,
+-                         '--testdir=@0@'.format(installed_test_bindir),
++                         '--testdir=@0@'.format(test_bindir),
+                          '--testname=@0@'.format(unit),
+                          '--outdir=@OUTDIR@',
+                          '--outfile=@0@'.format(wrapper),
+                        ],
+                        install: true,
+-                       install_dir: installed_test_datadir)
++                       install_dir: test_datadir)
+ 
+   exe = executable(unit, unit + '.c',
+                    dependencies: graphene_dep,
+@@ -50,7 +59,7 @@ foreach unit: unit_tests
+                      '-DGLIB_DISABLE_DEPRECATION_WARNINGS',
+                    ],
+                    install: true,
+-                   install_dir: installed_test_bindir)
++                   install_dir: test_bindir)
+ 
+   test(unit, exe, args: [ '--tap', '-k' ])
+ endforeach
+-- 
+2.21.0
+
diff --git a/nixpkgs/pkgs/development/libraries/graphene/default.nix b/nixpkgs/pkgs/development/libraries/graphene/default.nix
new file mode 100644
index 000000000000..253fce4ea0da
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/graphene/default.nix
@@ -0,0 +1,62 @@
+{ stdenv
+, fetchFromGitHub
+, pkgconfig
+, meson
+, ninja
+, python3
+, glib
+, gtk-doc
+, docbook_xsl
+, docbook_xml_dtd_43
+, gobject-introspection
+}:
+
+stdenv.mkDerivation rec {
+  pname = "graphene";
+  version = "1.8.6";
+
+  outputs = [ "out" "devdoc" "installedTests" ];
+
+  src = fetchFromGitHub {
+    owner = "ebassi";
+    repo = pname;
+    rev = version;
+    sha256 = "1hdbdzcz86jrvsq5h954ph9q62m8jr2a5s5acklxhdkfqn5bkbv8";
+  };
+
+  patches = [
+    ./0001-meson-add-options-for-tests-installation-dirs.patch
+  ];
+
+  mesonFlags = [
+    "-Dgtk_doc=true"
+    "-Dinstalled_test_datadir=${placeholder ''installedTests''}/share"
+    "-Dinstalled_test_bindir=${placeholder ''installedTests''}/libexec"
+  ];
+
+  nativeBuildInputs = [
+    docbook_xml_dtd_43
+    docbook_xsl
+    gtk-doc
+    meson
+    ninja
+    pkgconfig
+    python3
+  ];
+
+  buildInputs = [
+    gobject-introspection
+  ];
+
+  checkInputs = [
+    glib
+  ];
+
+  meta = with stdenv.lib; {
+    description = "A thin layer of graphic data types";
+    homepage = "https://ebassi.github.com/graphene";
+    license = licenses.mit;
+    maintainers = with maintainers; [ worldofpeace ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/grib-api/default.nix b/nixpkgs/pkgs/development/libraries/grib-api/default.nix
new file mode 100644
index 000000000000..224cd125dce6
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/grib-api/default.nix
@@ -0,0 +1,64 @@
+{ fetchurl, stdenv,
+  cmake, netcdf, gfortran, jasper, libpng,
+  enablePython ? false, pythonPackages }:
+
+stdenv.mkDerivation rec{
+  name = "grib-api-${version}";
+  version = "1.28.0";
+
+  src = fetchurl {
+    url = "https://software.ecmwf.int/wiki/download/attachments/3473437/grib_api-${version}-Source.tar.gz";
+    sha256 = "0qbj12ap7yy2rl1pq629chnss2jl73wxdj1lwzv0xp87r6z5qdfl";
+  };
+
+  preConfigure = ''
+    # Fix "no member named 'inmem_' in 'jas_image_t'"
+    substituteInPlace "src/grib_jasper_encoding.c" --replace "image.inmem_    = 1;" ""
+  '';
+
+  buildInputs = [ cmake
+                  netcdf
+                  gfortran
+                  jasper
+                  libpng
+                ] ++ stdenv.lib.optionals enablePython [
+                  pythonPackages.python
+                ];
+
+  propagatedBuildInputs = stdenv.lib.optionals enablePython [
+                  pythonPackages.numpy
+                ];
+
+  cmakeFlags = [ "-DENABLE_PYTHON=${if enablePython then "ON" else "OFF"}"
+                 "-DENABLE_PNG=ON"
+                 "-DENABLE_FORTRAN=ON"
+               ];
+
+  enableParallelBuilding = true;
+
+  doCheck = true;
+
+  # 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) ''
+    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; {
+    homepage = https://software.ecmwf.int/wiki/display/GRIB/Home;
+    license = licenses.asl20;
+    platforms = with platforms; linux ++ darwin;
+    description = "ECMWF Library for the GRIB file format";
+    longDescription = ''
+      The ECMWF GRIB API is an application program interface accessible from C,
+      FORTRAN and Python programs developed for encoding and decoding WMO FM-92
+      GRIB edition 1 and edition 2 messages.
+    '';
+    maintainers = with maintainers; [ knedlsepp ];
+  };
+}
+
diff --git a/nixpkgs/pkgs/development/libraries/grpc/default.nix b/nixpkgs/pkgs/development/libraries/grpc/default.nix
new file mode 100644
index 000000000000..77773e91e174
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/grpc/default.nix
@@ -0,0 +1,44 @@
+{ stdenv, fetchFromGitHub, cmake, zlib, c-ares, pkgconfig, openssl, protobuf, gflags }:
+
+stdenv.mkDerivation rec {
+  version = "1.19.1";
+  name = "grpc-${version}";
+  src = fetchFromGitHub {
+    owner = "grpc";
+    repo = "grpc";
+    rev = "v${version}";
+    sha256 = "0c0jra4qnd86gyr4rlblic3igb5dpgrldac35myk5i5ia547fdhj";
+  };
+  nativeBuildInputs = [ cmake pkgconfig ];
+  buildInputs = [ zlib c-ares c-ares.cmake-config openssl protobuf gflags ];
+
+  cmakeFlags =
+    [ "-DgRPC_ZLIB_PROVIDER=package"
+      "-DgRPC_CARES_PROVIDER=package"
+      "-DgRPC_SSL_PROVIDER=package"
+      "-DgRPC_PROTOBUF_PROVIDER=package"
+      "-DgRPC_GFLAGS_PROVIDER=package"
+      "-DBUILD_SHARED_LIBS=ON"
+    ];
+
+  # CMake creates a build directory by default, this conflicts with the
+  # basel BUILD file on case-insensitive filesystems.
+  preConfigure = ''
+    rm -vf BUILD
+  '';
+
+  preBuild = ''
+    export LD_LIBRARY_PATH=$(pwd):$LD_LIBRARY_PATH
+  '';
+
+  NIX_CFLAGS_COMPILE = stdenv.lib.optionalString stdenv.cc.isClang "-Wno-error=unknown-warning-option";
+
+  enableParallelBuilds = true;
+
+  meta = with stdenv.lib; {
+    description = "The C based gRPC (C++, Python, Ruby, Objective-C, PHP, C#)";
+    license = licenses.asl20;
+    maintainers = [ maintainers.lnl7 ];
+    homepage = https://grpc.io/;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gsasl/default.nix b/nixpkgs/pkgs/development/libraries/gsasl/default.nix
new file mode 100644
index 000000000000..899aa116b2ca
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gsasl/default.nix
@@ -0,0 +1,33 @@
+{ fetchurl, stdenv, libidn, kerberos }:
+
+stdenv.mkDerivation rec {
+  name = "gsasl-1.8.0";
+
+  src = fetchurl {
+    url = "mirror://gnu/gsasl/${name}.tar.gz";
+    sha256 = "1rci64cxvcfr8xcjpqc4inpfq7aw4snnsbf5xz7d30nhvv8n40ii";
+  };
+
+  buildInputs = [ libidn kerberos ];
+
+  configureFlags = [ "--with-gssapi-impl=mit" ];
+
+  doCheck = !stdenv.hostPlatform.isDarwin;
+
+  meta = {
+    description = "GNU SASL, Simple Authentication and Security Layer library";
+
+    longDescription =
+      '' GNU SASL is a library that implements the IETF Simple 
+         Authentication and Security Layer (SASL) framework and 
+         some SASL mechanisms. SASL is used in network servers 
+         (e.g. IMAP, SMTP, etc.) to authenticate peers. 
+       '';
+
+    homepage = https://www.gnu.org/software/gsasl/;
+    license = stdenv.lib.licenses.gpl3Plus;
+
+    maintainers = with stdenv.lib.maintainers; [ shlevy ];
+    platforms = stdenv.lib.platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gsettings-desktop-schemas/default.nix b/nixpkgs/pkgs/development/libraries/gsettings-desktop-schemas/default.nix
new file mode 100644
index 000000000000..c1bdcd6956e7
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gsettings-desktop-schemas/default.nix
@@ -0,0 +1,47 @@
+{ stdenv, fetchurl, pkgconfig, intltool, glib, gobject-introspection
+, meson
+, ninja
+, python3
+  # just for passthru
+, gnome3 }:
+
+stdenv.mkDerivation rec {
+  name = "gsettings-desktop-schemas-${version}";
+  version = "3.32.0";
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/gsettings-desktop-schemas/${stdenv.lib.versions.majorMinor version}/${name}.tar.xz";
+    sha256 = "0d8a6479vappgplq5crdr3ah0ykqcr3fw533wkx9v1a8lnrv8n9d";
+  };
+
+  passthru = {
+    updateScript = gnome3.updateScript { packageName = "gsettings-desktop-schemas"; };
+  };
+
+  # meson installs the schemas to share/glib-2.0/schemas
+  # We add the override file there too so it will be compiled and later moved by
+  # glib's setup hook.
+  preInstall = ''
+    mkdir -p $out/share/glib-2.0/schemas
+    cat - > $out/share/glib-2.0/schemas/remove-backgrounds.gschema.override <<- EOF
+      [org.gnome.desktop.background]
+      picture-uri='''
+
+      [org.gnome.desktop.screensaver]
+      picture-uri='''
+    EOF
+  '';
+
+  postPatch = ''
+    chmod +x build-aux/meson/post-install.py
+    patchShebangs build-aux/meson/post-install.py
+  '';
+
+  buildInputs = [ glib gobject-introspection ];
+
+  nativeBuildInputs = [ pkgconfig python3 meson ninja ];
+
+  meta = with stdenv.lib; {
+    maintainers = gnome3.maintainers;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gsettings-qt/default.nix b/nixpkgs/pkgs/development/libraries/gsettings-qt/default.nix
new file mode 100644
index 000000000000..3f9cd8120d89
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gsettings-qt/default.nix
@@ -0,0 +1,58 @@
+{ stdenv, fetchbzr, pkgconfig, qmake, qtbase, qtdeclarative, glib, gobject-introspection }:
+
+stdenv.mkDerivation rec {
+  name = "gsettings-qt-${version}";
+  version = "0.1.20170824";
+
+  src = fetchbzr {
+    url = http://bazaar.launchpad.net/~system-settings-touch/gsettings-qt/trunk;
+    rev = "85";
+    sha256 = "1kcw0fgdyndx9c0dyha11wkj0gi05spdc1adf1609mrinbb4rnyi";
+  };
+
+  nativeBuildInputs = [
+    pkgconfig
+    qmake
+    gobject-introspection
+  ];
+
+  buildInputs = [
+    glib
+    qtdeclarative
+  ];
+
+  patchPhase = ''
+    # force ordered build of subdirs
+    sed -i -e "\$aCONFIG += ordered" gsettings-qt.pro
+
+    # It seems that there is a bug in qtdeclarative: qmlplugindump fails
+    # because it can not find or load the Qt platform plugin "minimal".
+    # A workaround is to set QT_PLUGIN_PATH and QML2_IMPORT_PATH explicitly.
+    export QT_PLUGIN_PATH=${qtbase.bin}/${qtbase.qtPluginPrefix}
+    export QML2_IMPORT_PATH=${qtdeclarative.bin}/${qtbase.qtQmlPrefix}
+
+    substituteInPlace GSettings/gsettings-qt.pro \
+      --replace '$$[QT_INSTALL_QML]' "$out/$qtQmlPrefix" \
+      --replace '$$[QT_INSTALL_BINS]/qmlplugindump' "qmlplugindump"
+
+    substituteInPlace src/gsettings-qt.pro \
+      --replace '$$[QT_INSTALL_LIBS]' "$out/lib" \
+      --replace '$$[QT_INSTALL_HEADERS]' "$out/include"
+  '';
+
+  preInstall = ''
+    # do not install tests
+    for f in tests/Makefile{,.cpptest}; do
+      substituteInPlace $f \
+        --replace "install: install_target" "install: "
+    done
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Qt/QML bindings for GSettings";
+    homepage = https://launchpad.net/gsettings-qt;
+    license = licenses.lgpl3;
+    platforms = platforms.linux;
+    maintainers = [ maintainers.romildo ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gsignond/conf.patch b/nixpkgs/pkgs/development/libraries/gsignond/conf.patch
new file mode 100644
index 000000000000..0aa2034e3996
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gsignond/conf.patch
@@ -0,0 +1,12 @@
+diff --git a/meson.build b/meson.build
+index cb1e0df..d90c85c 100644
+--- a/meson.build
++++ b/meson.build
+@@ -95,6 +95,6 @@ endif
+ configure_file(
+     input: 'gsignond.conf.in',
+     configuration: conf_data,
+-    install_dir: sysconf_dir,
++    install_dir: 'etc/',
+     output: 'gsignond.conf'
+ )
diff --git a/nixpkgs/pkgs/development/libraries/gsignond/default.nix b/nixpkgs/pkgs/development/libraries/gsignond/default.nix
new file mode 100644
index 000000000000..a81e72bf66fb
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gsignond/default.nix
@@ -0,0 +1,67 @@
+{ stdenv, fetchFromGitLab, pkgconfig, 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 }:
+
+let
+unwrapped = stdenv.mkDerivation rec {
+  pname = "gsignond";
+  version = "1.2.0";
+
+  outputs = [ "out" "dev" "devdoc" ];
+
+  src = fetchFromGitLab {
+    owner = "accounts-sso";
+    repo = pname;
+    rev = version;
+    sha256 = "17cpil3lpijgyj2z5c41vhb7fpk17038k5ggyw9p6049jrlf423m";
+  };
+
+  nativeBuildInputs = [
+    docbook_xml_dtd_43
+    docbook_xml_dtd_45
+    docbook_xsl
+    glibcLocales
+    gobject-introspection
+    gtk-doc
+    meson
+    ninja
+    pkgconfig
+    vala
+  ];
+
+  buildInputs = [
+    glib
+    glib-networking
+    libsecret
+  ];
+
+  propagatedBuildInputs = [ sqlite ];
+
+  mesonFlags = [
+    "-Dbus_type=session"
+    "-Dextension=desktop"
+  ];
+
+  LC_ALL = "en_US.UTF-8";
+
+  patches = [
+    ./conf.patch
+    ./plugin-load-env.patch
+  ];
+
+  meta = with stdenv.lib; {
+    description = "D-Bus service which performs user authentication on behalf of its clients";
+    homepage = https://gitlab.com/accounts-sso/gsignond;
+    license = licenses.lgpl21Plus;
+    maintainers = with maintainers; [ worldofpeace ];
+    platforms = platforms.linux;
+  };
+};
+
+in if plugins == [] then unwrapped
+    else import ./wrapper.nix {
+      inherit stdenv makeWrapper symlinkJoin gsignondPlugins plugins;
+      gsignond = unwrapped;
+    }
+
diff --git a/nixpkgs/pkgs/development/libraries/gsignond/plugin-load-env.patch b/nixpkgs/pkgs/development/libraries/gsignond/plugin-load-env.patch
new file mode 100644
index 000000000000..5da2b4c157e8
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gsignond/plugin-load-env.patch
@@ -0,0 +1,35 @@
+diff --git a/src/gplugind/gsignond-plugin-loader.c b/src/gplugind/gsignond-plugin-loader.c
+index 5497b32..979e1b4 100644
+--- a/src/gplugind/gsignond-plugin-loader.c
++++ b/src/gplugind/gsignond-plugin-loader.c
+@@ -38,11 +38,10 @@ gsignond_load_plugin (
+     gchar *plugin_filename;
+     GSignondPlugin *plugin;
+ 
+-#   ifdef ENABLE_DEBUG
+     const gchar *env_val = g_getenv("SSO_GPLUGINS_DIR");
+     if (env_val)
+         plugin_path = env_val;
+-#   endif
++
+     plugin_filename = g_module_build_path (plugin_path, plugin_type);
+     plugin = gsignond_load_plugin_with_filename (plugin_type,
+                                                  plugin_filename);
+diff --git a/src/gplugind/main.c b/src/gplugind/main.c
+index 1c6cdb6..c85c623 100644
+--- a/src/gplugind/main.c
++++ b/src/gplugind/main.c
+@@ -93,11 +93,11 @@ _install_sighandlers (GMainLoop *main_loop)
+ static const gchar* _plugin_path(void)
+ {
+     const gchar *plugin_path = GSIGNOND_GPLUGINS_DIR;
+-#   ifdef ENABLE_DEBUG
++
+     const gchar *env_val = g_getenv("SSO_GPLUGINS_DIR");
+     if (env_val)
+         plugin_path = env_val;
+-#   endif
++
+     return plugin_path;
+ }
+ 
diff --git a/nixpkgs/pkgs/development/libraries/gsignond/plugins/lastfm.nix b/nixpkgs/pkgs/development/libraries/gsignond/plugins/lastfm.nix
new file mode 100644
index 000000000000..7c15e10620a5
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gsignond/plugins/lastfm.nix
@@ -0,0 +1,38 @@
+{ stdenv, fetchFromGitLab, pkgconfig, meson, ninja, vala, glib, gsignond, json-glib, libsoup, gobject-introspection }:
+
+stdenv.mkDerivation rec {
+  name = "gsignond-plugin-lastfm-${version}";
+  version = "2018-05-07";
+
+  src = fetchFromGitLab {
+    owner = "accounts-sso";
+    repo = "gsignond-plugin-lastfm";
+    rev = "0a7a5f8511282e45cfe35987b81f27f158f0648c";
+    sha256 = "0ay6ir9zg9l0264x5xwd7c6j8qmwlhrifkkkjd1yrjh9sqxyfj7f";
+  };
+
+  nativeBuildInputs = [
+    gobject-introspection
+    meson
+    ninja
+    pkgconfig
+    vala
+  ];
+
+  buildInputs = [
+    glib
+    gsignond
+    json-glib
+    libsoup
+  ];
+
+  PKG_CONFIG_GSIGNOND_GPLUGINSDIR = "${placeholder "out"}/lib/gsignond/gplugins";
+
+  meta = with stdenv.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;
+    maintainers = with maintainers; [ worldofpeace ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gsignond/plugins/mail.nix b/nixpkgs/pkgs/development/libraries/gsignond/plugins/mail.nix
new file mode 100644
index 000000000000..c4d23bd834c9
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gsignond/plugins/mail.nix
@@ -0,0 +1,36 @@
+{ stdenv, fetchFromGitLab, pkgconfig, meson, ninja, vala, glib, gsignond, gobject-introspection }:
+
+stdenv.mkDerivation rec {
+  pname = "gsignond-plugin-mail";
+  version = "0.3.0";
+
+  src = fetchFromGitLab {
+    owner = "accounts-sso";
+    repo = "gsignond-plugin-mail";
+    rev = version;
+    sha256 = "0x8jcl0ra9kacm80f1im5wpxp9r9wxayjwnk6dkv7fhjbl2p4nh0";
+  };
+
+  nativeBuildInputs = [
+    gobject-introspection
+    meson
+    ninja
+    pkgconfig
+    vala
+  ];
+
+  buildInputs = [
+    glib
+    gsignond
+  ];
+
+  PKG_CONFIG_GSIGNOND_GPLUGINSDIR = "${placeholder "out"}/lib/gsignond/gplugins";
+
+  meta = with stdenv.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;
+    maintainers = with maintainers; [ worldofpeace ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gsignond/plugins/oauth.nix b/nixpkgs/pkgs/development/libraries/gsignond/plugins/oauth.nix
new file mode 100644
index 000000000000..6182ea283cba
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gsignond/plugins/oauth.nix
@@ -0,0 +1,48 @@
+{ stdenv, fetchFromGitLab, fetchpatch, pkgconfig, meson, ninja, glib, gsignond, check
+, json-glib, libsoup, gnutls, gtk-doc, docbook_xml_dtd_43, docbook_xml_dtd_45
+, docbook_xsl, glibcLocales, gobject-introspection }:
+
+stdenv.mkDerivation rec {
+  name = "gsignond-plugin-oauth-${version}";
+  version = "2018-10-15";
+
+  src = fetchFromGitLab {
+    owner = "accounts-sso";
+    repo = "gsignond-plugin-oa";
+    rev = "d471cebfd7c50567b1244277a9559f18f8d58691";
+    sha256 = "00axl8wwp2arc6h4bpr4m3ik2hy8an0lbm48q2a9r94krmq56hnx";
+  };
+
+  nativeBuildInputs = [
+    check
+    docbook_xml_dtd_43
+    docbook_xml_dtd_45
+    docbook_xsl
+    glibcLocales
+    gobject-introspection
+    gtk-doc
+    meson
+    ninja
+    pkgconfig
+  ];
+
+  buildInputs = [
+    glib
+    gnutls
+    gsignond
+    json-glib
+    libsoup
+  ];
+
+  LC_ALL = "en_US.UTF-8";
+
+  PKG_CONFIG_GSIGNOND_GPLUGINSDIR = "${placeholder "out"}/lib/gsignond/gplugins";
+
+  meta = with stdenv.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;
+    maintainers = with maintainers; [ worldofpeace ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gsignond/plugins/sasl.nix b/nixpkgs/pkgs/development/libraries/gsignond/plugins/sasl.nix
new file mode 100644
index 000000000000..d1fa37939a78
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gsignond/plugins/sasl.nix
@@ -0,0 +1,45 @@
+{ stdenv, fetchFromGitLab, fetchpatch, pkgconfig, meson, ninja, glib, gsignond, gsasl, check
+, gtk-doc, docbook_xml_dtd_43, docbook_xml_dtd_45, docbook_xsl, glibcLocales, gobject-introspection }:
+
+stdenv.mkDerivation rec {
+  name = "gsignond-plugin-sasl-${version}";
+  version = "2018-10-15";
+
+  src = fetchFromGitLab {
+    owner = "accounts-sso";
+    repo = "gsignond-plugin-sasl";
+    rev = "b304c70b7dad9368b23b1205122d10de684c896a";
+    sha256 = "0knzw7c2fm2kzs1gxbrm4kk67522w9cpwqj7xvn86473068k90va";
+  };
+
+  nativeBuildInputs = [
+    check
+    docbook_xml_dtd_43
+    docbook_xml_dtd_45
+    docbook_xsl
+    glibcLocales
+    gobject-introspection
+    gtk-doc
+    meson
+    ninja
+    pkgconfig
+  ];
+
+  buildInputs = [
+    glib
+    gsasl
+    gsignond
+  ];
+
+  LC_ALL = "en_US.UTF-8";
+
+  PKG_CONFIG_GSIGNOND_GPLUGINSDIR = "${placeholder "out"}/lib/gsignond/gplugins";
+
+  meta = with stdenv.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;
+    maintainers = with maintainers; [ worldofpeace ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gsignond/wrapper.nix b/nixpkgs/pkgs/development/libraries/gsignond/wrapper.nix
new file mode 100644
index 000000000000..04463aac3796
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gsignond/wrapper.nix
@@ -0,0 +1,25 @@
+{ stdenv, makeWrapper, symlinkJoin, gsignond, gsignondPlugins, plugins }:
+
+symlinkJoin {
+  name = "gsignond-with-plugins-${gsignond.version}";
+
+  paths = [ gsignond ] ++ plugins;
+
+  buildInputs = [ makeWrapper ];
+
+  postBuild = ''
+    wrapProgram $out/bin/gsignond \
+      --set SSO_GPLUGINS_DIR "$out/lib/gsignond/gplugins"
+
+    rm $out/share/dbus-1/services/com.google.code.AccountsSSO.gSingleSignOn.service
+    rm $out/share/dbus-1/services/com.google.code.AccountsSSO.SingleSignOn.service
+
+    substitute ${gsignond}/share/dbus-1/services/com.google.code.AccountsSSO.gSingleSignOn.service $out/share/dbus-1/services/com.google.code.AccountsSSO.gSingleSignOn.service \
+      --replace ${gsignond} $out
+
+    substitute ${gsignond}/share/dbus-1/services/com.google.code.AccountsSSO.SingleSignOn.service $out/share/dbus-1/services/com.google.code.AccountsSSO.SingleSignOn.service \
+      --replace ${gsignond} $out
+  '';
+
+  inherit (gsignond) meta;
+}
diff --git a/nixpkgs/pkgs/development/libraries/gsl/default.nix b/nixpkgs/pkgs/development/libraries/gsl/default.nix
new file mode 100644
index 000000000000..c8846509d004
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gsl/default.nix
@@ -0,0 +1,34 @@
+{ fetchurl, stdenv }:
+
+stdenv.mkDerivation rec {
+  name = "gsl-2.5";
+
+  src = fetchurl {
+    url = "mirror://gnu/gsl/${name}.tar.gz";
+    sha256 = "1395y9hlhqadn5g9j8q22224fds5sd92jxi9czfavjj24myasq04";
+  };
+
+  # 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.optional 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";
+
+  meta = {
+    description = "The GNU Scientific Library, a large numerical library";
+    homepage = https://www.gnu.org/software/gsl/;
+    license = stdenv.lib.licenses.gpl3Plus;
+
+    longDescription = ''
+      The GNU Scientific Library (GSL) is a numerical library for C
+      and C++ programmers.  It is free software under the GNU General
+      Public License.
+
+      The library provides a wide range of mathematical routines such
+      as random number generators, special functions and least-squares
+      fitting.  There are over 1000 functions in total with an
+      extensive test suite.
+    '';
+    platforms = stdenv.lib.platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gsl/gsl-1_16.nix b/nixpkgs/pkgs/development/libraries/gsl/gsl-1_16.nix
new file mode 100644
index 000000000000..e5772c8772ec
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gsl/gsl-1_16.nix
@@ -0,0 +1,43 @@
+{ fetchurl, fetchpatch, stdenv }:
+
+stdenv.mkDerivation rec {
+  name = "gsl-1.16";
+
+  src = fetchurl {
+    url = "mirror://gnu/gsl/${name}.tar.gz";
+    sha256 = "0lrgipi0z6559jqh82yx8n4xgnxkhzj46v96dl77hahdp58jzg3k";
+  };
+
+  # 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.optional stdenv.isx86_64 "-mno-fma";
+
+  patches = [
+    (fetchpatch {
+      name = "bug-39055.patch";
+      url = "https://git.savannah.gnu.org/cgit/gsl.git/patch/?id=9cc12d";
+      sha256 = "1bmrmihi28cly9g9pq54kkix2jy59y7cd7h5fw4v1c7h5rc2qvs8";
+    })
+  ];
+
+  doCheck = true;
+
+  meta = {
+    description = "The GNU Scientific Library, a large numerical library";
+    homepage = https://www.gnu.org/software/gsl/;
+    license = stdenv.lib.licenses.gpl3Plus;
+
+    longDescription = ''
+      The GNU Scientific Library (GSL) is a numerical library for C
+      and C++ programmers.  It is free software under the GNU General
+      Public License.
+
+      The library provides a wide range of mathematical routines such
+      as random number generators, special functions and least-squares
+      fitting.  There are over 1000 functions in total with an
+      extensive test suite.
+    '';
+    platforms = stdenv.lib.platforms.unix;
+    # Failing "eigen" tests on aarch64.
+    badPlatforms = [ "aarch64-linux" ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gsm/default.nix b/nixpkgs/pkgs/development/libraries/gsm/default.nix
new file mode 100644
index 000000000000..33583a4c6bb3
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gsm/default.nix
@@ -0,0 +1,53 @@
+{ stdenv, fetchurl
+, staticSupport ? false # Compile statically (support for packages that look for the static object)
+}:
+
+let
+  inherit (stdenv) isDarwin;
+  inherit (stdenv.lib) optional optionalString;
+in
+
+stdenv.mkDerivation rec {
+  name = "gsm-${version}";
+  version = "1.0.18";
+
+  src = fetchurl {
+    url = "http://www.quut.com/gsm/${name}.tar.gz";
+    sha256 = "041amvpz8cvxykl3pwqldrzxligmmzcg8ncdnxbg32rlqf3q1xh4";
+  };
+
+  patchPhase = ''
+    # Fix include directory
+    sed -e 's,$(GSM_INSTALL_ROOT)/inc,$(GSM_INSTALL_ROOT)/include/gsm,' -i Makefile
+  '' + optionalString (!staticSupport) (
+    (if isDarwin then  ''
+      # Build dylib on Darwin
+      sed -e 's,libgsm.a,libgsm.dylib,' -i Makefile
+      sed -e 's,$(AR) $(ARFLAGS) $(LIBGSM) $(GSM_OBJECTS),$(LD) -o $(LIBGSM) -dynamiclib -install_name $(GSM_INSTALL_ROOT)/$(LIBGSM) $(GSM_OBJECTS) -lc,' -i Makefile
+    '' else ''
+      # Build ELF shared object by default
+      sed -e 's,libgsm.a,libgsm.so,' -i Makefile
+      sed -e 's/$(AR) $(ARFLAGS) $(LIBGSM) $(GSM_OBJECTS)/$(LD) -shared -Wl,-soname,libgsm.so -o $(LIBGSM) $(GSM_OBJECTS) -lc/' -i Makefile
+    '') + ''
+      # Remove line that is unused when building shared libraries
+      sed -e 's,$(RANLIB) $(LIBGSM),,' -i Makefile
+    ''
+  );
+
+  makeFlags = [
+    "SHELL=${stdenv.shell}"
+    "INSTALL_ROOT=$(out)"
+  ] ++ optional stdenv.cc.isClang "CC=clang";
+
+  preInstall = "mkdir -p $out/{bin,lib,man/man1,man/man3,include/gsm}";
+
+  parallelBuild = false;
+
+  meta = with stdenv.lib; {
+    description = "Lossy speech compression codec";
+    homepage    = http://www.quut.com/gsm/;
+    license     = licenses.bsd2;
+    maintainers = with maintainers; [ codyopel raskin ];
+    platforms   = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gsoap/default.nix b/nixpkgs/pkgs/development/libraries/gsoap/default.nix
new file mode 100644
index 000000000000..f099d3fabc04
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gsoap/default.nix
@@ -0,0 +1,45 @@
+{ stdenv, fetchurl, autoreconfHook, unzip, m4, bison, flex, openssl, zlib }:
+
+let
+  majorVersion = "2.8";
+
+in stdenv.mkDerivation rec {
+  name = "gsoap-${version}";
+  version = "${majorVersion}.53";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/project/gsoap2/gsoap-${majorVersion}/gsoap_${version}.zip";
+    sha256 = "0n35dh32gidi65c36cwjd91304pwiabfblvd64kg21djpjl06qcr";
+  };
+
+  buildInputs = [ openssl zlib ];
+  nativeBuildInputs = [ autoreconfHook bison flex m4 unzip ];
+  # Parallel building doesn't work as of 2.8.49
+  enableParallelBuilding = false;
+
+  # Future versions of automake require subdir-objects if the source is structured this way
+  # As of 2.8.49 (maybe earlier) this is needed to silence warnings
+  prePatch = ''
+    substituteInPlace configure.ac \
+      --replace 'AM_INIT_AUTOMAKE([foreign])' 'AM_INIT_AUTOMAKE([foreign subdir-objects])'
+  '';
+
+  meta = with stdenv.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):
+    # 1. gSOAP Public License 1.3 (based on Mozilla Public License 1.1).
+    #    Components NOT covered by the gSOAP Public License are:
+    #     - wsdl2h tool and its source code output,
+    #     - soapcpp2 tool and its source code output,
+    #     - UDDI code,
+    #     - the webserver example code in gsoap/samples/webserver,
+    #     - and several example applications in the gsoap/samples directory.
+    # 2. GPLv2 covers all of the software
+    # 3. Proprietary commercial software development license (removes GPL
+    #    restrictions)
+    license = licenses.gpl2;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ bjornfor ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gsound/default.nix b/nixpkgs/pkgs/development/libraries/gsound/default.nix
new file mode 100644
index 000000000000..337a2472babd
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gsound/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchurl, pkgconfig, glib, 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";
+    sha256 = "bba8ff30eea815037e53bee727bbd5f0b6a2e74d452a7711b819a7c444e78e53";
+  };
+
+  nativeBuildInputs = [ pkgconfig gobject-introspection libtool gnome3.vala ];
+  buildInputs = [ glib libcanberra ];
+
+  passthru = {
+    updateScript = gnome3.updateScript {
+      packageName = pname;
+    };
+  };
+
+  meta = with stdenv.lib; {
+    homepage = https://wiki.gnome.org/Projects/GSound;
+    description = "Small library for playing system sounds";
+    maintainers = gnome3.maintainers;
+    license = licenses.gpl2;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gspell/default.nix b/nixpkgs/pkgs/development/libraries/gspell/default.nix
new file mode 100644
index 000000000000..776125a7537d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gspell/default.nix
@@ -0,0 +1,35 @@
+{ stdenv, fetchurl, pkgconfig, libxml2, glib, gtk3, enchant2, isocodes, vala, gobject-introspection, gnome3 }:
+
+let
+  pname = "gspell";
+  version = "1.8.1";
+in stdenv.mkDerivation rec {
+  name = "${pname}-${version}";
+
+  outputs = [ "out" "dev" ];
+  outputBin = "dev";
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${name}.tar.xz";
+    sha256 = "1rdv873ixhwr15jwgc2z6k6y0hj353fqnwsy7zkh0c30qwiiv6l1";
+  };
+
+  propagatedBuildInputs = [ enchant2 ]; # required for pkgconfig
+
+  nativeBuildInputs = [ pkgconfig vala gobject-introspection libxml2 ];
+  buildInputs = [ glib gtk3 isocodes ];
+
+  passthru = {
+    updateScript = gnome3.updateScript {
+      packageName = pname;
+    };
+  };
+
+  meta = with stdenv.lib; {
+    description = "A spell-checking library for GTK+ applications";
+    homepage = https://wiki.gnome.org/Projects/gspell;
+    license = licenses.lgpl21Plus;
+    maintainers = gnome3.maintainers;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gss/default.nix b/nixpkgs/pkgs/development/libraries/gss/default.nix
new file mode 100644
index 000000000000..a9ee776d441c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gss/default.nix
@@ -0,0 +1,35 @@
+{ stdenv, fetchurl
+, withShishi ? !stdenv.isDarwin, shishi ? null
+}:
+
+assert withShishi -> shishi != null;
+
+stdenv.mkDerivation rec {
+  name = "gss-1.0.3";
+
+  src = fetchurl {
+    url = "mirror://gnu/gss/${name}.tar.gz";
+    sha256 = "1syyvh3k659xf1hdv9pilnnhbbhs6vfapayp4xgdcc8mfgf9v4gz";
+  };
+
+  buildInputs = stdenv.lib.optional withShishi shishi;
+
+  configureFlags = [
+    "--${if withShishi != null then "enable" else "disable"}-kereberos5"
+  ];
+
+  doCheck = true;
+
+  # Fixup .la files
+  postInstall = stdenv.lib.optionalString withShishi ''
+    sed -i 's,\(-lshishi\),-L${shishi}/lib \1,' $out/lib/libgss.la
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = https://www.gnu.org/software/gss/;
+    description = "Generic Security Service";
+    license = licenses.gpl3Plus;
+    maintainers = with maintainers; [ bjg ];
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gssdp/default.nix b/nixpkgs/pkgs/development/libraries/gssdp/default.nix
new file mode 100644
index 000000000000..3c49b579b9ca
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gssdp/default.nix
@@ -0,0 +1,66 @@
+{ stdenv
+, fetchurl
+, meson
+, ninja
+, pkgconfig
+, gobject-introspection
+, vala
+, gtk-doc
+, docbook_xsl
+, docbook_xml_dtd_412
+, libsoup
+, gtk3
+, glib
+, gnome3
+}:
+
+stdenv.mkDerivation rec {
+  pname = "gssdp";
+  version = "1.2.1";
+
+  outputs = [ "out" "bin" "dev" "devdoc" ];
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/gssdp/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    sha256 = "1lsn6mdkk8yb933n0c9dka89bixvwis09w5nh5wkcag2jsdbfmvb";
+  };
+
+  nativeBuildInputs = [
+    meson
+    ninja
+    pkgconfig
+    gobject-introspection
+    vala
+    gtk-doc
+    docbook_xsl
+    docbook_xml_dtd_412
+  ];
+
+  buildInputs = [
+    libsoup
+    gtk3
+  ];
+
+  propagatedBuildInputs = [
+    glib
+  ];
+
+  mesonFlags = [
+    "-Dgtk_doc=true"
+  ];
+
+  doCheck = true;
+
+  passthru = {
+    updateScript = gnome3.updateScript {
+      packageName = pname;
+    };
+  };
+
+  meta = with stdenv.lib; {
+    description = "GObject-based API for handling resource discovery and announcement over SSDP";
+    homepage = http://www.gupnp.org/;
+    license = licenses.lgpl2Plus;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gstreamer/bad/default.nix b/nixpkgs/pkgs/development/libraries/gstreamer/bad/default.nix
new file mode 100644
index 000000000000..8179806859c9
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gstreamer/bad/default.nix
@@ -0,0 +1,92 @@
+{ stdenv, fetchurl, fetchpatch, meson, ninja, gettext
+, pkgconfig, python3, gst-plugins-base, orc
+, faacSupport ? false, faac ? null
+, faad2, libass, libkate, libmms, librdf, ladspaH
+, libnice, webrtc-audio-processing, lilv, lv2, serd, sord, sratom
+, libbs2b, libmodplug, mpeg2dec
+, openjpeg, libopus, librsvg
+, wildmidi, fluidsynth, libvdpau, wayland
+, libwebp, xvidcore, gnutls, mjpegtools
+, libGLU_combined, libintl, libgme
+, openssl, x265, libxml2
+, srt
+}:
+
+assert faacSupport -> faac != null;
+
+let
+  inherit (stdenv.lib) optional;
+in
+stdenv.mkDerivation rec {
+  name = "gst-plugins-bad-${version}";
+  version = "1.14.4";
+
+  meta = with stdenv.lib; {
+    description = "Gstreamer Bad Plugins";
+    homepage    = "https://gstreamer.freedesktop.org";
+    longDescription = ''
+      a set of plug-ins that aren't up to par compared to the
+      rest.  They might be close to being good quality, but they're missing
+      something - be it a good code review, some documentation, a set of tests,
+      a real live maintainer, or some actual wide use.
+    '';
+    license     = licenses.lgpl2Plus;
+    platforms   = platforms.linux ++ platforms.darwin;
+    maintainers = with maintainers; [ matthewbauer ];
+  };
+
+  preConfigure = ''
+    patchShebangs .
+  '';
+
+  patches = [
+    (fetchpatch {
+        url = "https://bug794856.bugzilla-attachments.gnome.org/attachment.cgi?id=370409";
+        sha256 = "0hy0rcn35alq65yqwri4fqjz2hf3nyyg5c7rnndk51msmqjxpprk";
+    })
+    ./fix_pkgconfig_includedir.patch
+    # Enable bs2b compilation
+    # https://bugzilla.gnome.org/show_bug.cgi?id=794346
+    (fetchurl {
+      url = https://bugzilla.gnome.org/attachment.cgi?id=369724;
+      sha256 = "1716mp0h2866ab33w607isvfhv1zwyj71qb4jrkx5v0h276v1pwr";
+    })
+  ];
+
+  src = fetchurl {
+    url = "${meta.homepage}/src/gst-plugins-bad/${name}.tar.xz";
+    sha256 = "1r8dma3x127rbx42yab7kwq7q1bhkmvz2ykn0rnqnzl95q74w2wi";
+  };
+
+  outputs = [ "out" "dev" ];
+
+  nativeBuildInputs = [ meson ninja pkgconfig python3 gettext ];
+
+  buildInputs = [
+    gst-plugins-base orc
+    faad2 libass libkate libmms
+    libnice webrtc-audio-processing # webrtc
+    libbs2b
+    ladspaH librdf # ladspa plug-in
+    lilv lv2 serd sord sratom # lv2 plug-in
+    libmodplug mpeg2dec
+    openjpeg libopus librsvg
+    fluidsynth libvdpau
+    libwebp xvidcore gnutls libGLU_combined
+    libgme openssl x265 libxml2
+    libintl
+    srt
+  ]
+    ++ optional faacSupport faac
+    ++ optional stdenv.isLinux wayland
+    # wildmidi requires apple's OpenAL
+    # TODO: package apple's OpenAL, fix wildmidi, include on Darwin
+    ++ optional (!stdenv.isDarwin) wildmidi
+    # TODO: mjpegtools uint64_t is not compatible with guint64 on Darwin
+    ++ optional (!stdenv.isDarwin) mjpegtools;
+
+  enableParallelBuilding = true;
+
+  doCheck = false; # fails 20 out of 58 tests, expensive
+
+}
diff --git a/nixpkgs/pkgs/development/libraries/gstreamer/bad/fix_pkgconfig_includedir.patch b/nixpkgs/pkgs/development/libraries/gstreamer/bad/fix_pkgconfig_includedir.patch
new file mode 100644
index 000000000000..c687fffc9c08
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gstreamer/bad/fix_pkgconfig_includedir.patch
@@ -0,0 +1,15 @@
+diff --git a/pkgconfig/meson.build b/pkgconfig/meson.build
+index 271f327f3..7e2afa754 100644
+--- a/pkgconfig/meson.build
++++ b/pkgconfig/meson.build
+@@ -2,8 +2,8 @@ pkgconf = configuration_data()
+ 
+ pkgconf.set('prefix', join_paths(get_option('prefix')))
+ pkgconf.set('exec_prefix', '${prefix}')
+-pkgconf.set('libdir', '${prefix}/@0@'.format(get_option('libdir')))
+-pkgconf.set('includedir', '${prefix}/@0@'.format(get_option('includedir')))
++pkgconf.set('libdir', join_paths(get_option('prefix'), get_option('libdir')))
++pkgconf.set('includedir', join_paths(get_option('prefix'), get_option('includedir')))
+ pkgconf.set('GST_API_VERSION', api_version)
+ pkgconf.set('VERSION', gst_version)
+ 
diff --git a/nixpkgs/pkgs/development/libraries/gstreamer/base/default.nix b/nixpkgs/pkgs/development/libraries/gstreamer/base/default.nix
new file mode 100644
index 000000000000..0acdf71fb72f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gstreamer/base/default.nix
@@ -0,0 +1,70 @@
+{ stdenv, fetchurl, fetchpatch, lib
+, pkgconfig, meson, ninja, gettext, gobject-introspection
+, python3, gstreamer, orc, pango, libtheora
+, libintl, libopus
+, enableX11 ? stdenv.isLinux, libXv
+, enableWayland ? stdenv.isLinux, wayland
+, enableAlsa ? stdenv.isLinux, alsaLib
+, enableCocoa ? false, darwin
+, enableCdparanoia ? (!stdenv.isDarwin), cdparanoia }:
+
+stdenv.mkDerivation rec {
+  name = "gst-plugins-base-${version}";
+  version = "1.14.4";
+
+  meta = with lib; {
+    description = "Base plugins and helper libraries";
+    homepage = https://gstreamer.freedesktop.org;
+    license = licenses.lgpl2Plus;
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ matthewbauer ];
+  };
+
+  src = fetchurl {
+    url = "${meta.homepage}/src/gst-plugins-base/${name}.tar.xz";
+    sha256 = "0qbllw4kphchwhy4p7ivdysigx69i97gyw6q0rvkx1j81r4kjqfa";
+  };
+
+  outputs = [ "out" "dev" ];
+
+  nativeBuildInputs = [ pkgconfig python3 gettext gobject-introspection ]
+
+  # Broken meson with Darwin. Should hopefully be fixed soon. Tracking
+  # in https://bugzilla.gnome.org/show_bug.cgi?id=781148.
+  ++ lib.optionals (!stdenv.isDarwin) [ meson ninja ];
+
+  # TODO How to pass these to Meson?
+  configureFlags = [
+    "--enable-x11=${if enableX11 then "yes" else "no"}"
+    "--enable-wayland=${if enableWayland then "yes" else "no"}"
+    "--enable-cocoa=${if enableCocoa then "yes" else "no"}"
+  ]
+
+  # Introspection fails on my MacBook currently
+  ++ lib.optional stdenv.isDarwin "--disable-introspection";
+
+  buildInputs = [ orc libtheora libintl libopus ]
+    ++ lib.optional enableAlsa alsaLib
+    ++ lib.optionals enableX11 [ libXv pango ]
+    ++ lib.optional enableWayland wayland
+    ++ lib.optional enableCocoa darwin.apple_sdk.frameworks.Cocoa
+    ++ lib.optional enableCdparanoia cdparanoia;
+
+  propagatedBuildInputs = [ gstreamer ];
+
+  postPatch = ''
+    patchShebangs .
+  '';
+
+  enableParallelBuilding = true;
+
+  doCheck = false; # fails, wants DRI access for OpenGL
+
+  patches = [
+    (fetchpatch {
+        url = "https://bug794856.bugzilla-attachments.gnome.org/attachment.cgi?id=370414";
+        sha256 = "07x43xis0sr0hfchf36ap0cibx0lkfpqyszb3r3w9dzz301fk04z";
+    })
+    ./fix_pkgconfig_includedir.patch
+  ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/gstreamer/base/fix_pkgconfig_includedir.patch b/nixpkgs/pkgs/development/libraries/gstreamer/base/fix_pkgconfig_includedir.patch
new file mode 100644
index 000000000000..04486a4647f9
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gstreamer/base/fix_pkgconfig_includedir.patch
@@ -0,0 +1,15 @@
+diff --git a/pkgconfig/meson.build b/pkgconfig/meson.build
+index 04abfbee5..88c86b431 100644
+--- a/pkgconfig/meson.build
++++ b/pkgconfig/meson.build
+@@ -2,8 +2,8 @@ pkgconf = configuration_data()
+ 
+ pkgconf.set('prefix', get_option('prefix'))
+ pkgconf.set('exec_prefix', '${prefix}')
+-pkgconf.set('libdir', '${prefix}/@0@'.format(get_option('libdir')))
+-pkgconf.set('includedir', '${prefix}/@0@'.format(get_option('includedir')))
++pkgconf.set('libdir', join_paths(get_option('prefix'), get_option('libdir')))
++pkgconf.set('includedir', join_paths(get_option('prefix'), get_option('includedir')))
+ pkgconf.set('GST_API_VERSION', api_version)
+ pkgconf.set('VERSION', gst_version)
+ pkgconf.set('LIBM', libm.found() ? '-lm' : '')
diff --git a/nixpkgs/pkgs/development/libraries/gstreamer/core/default.nix b/nixpkgs/pkgs/development/libraries/gstreamer/core/default.nix
new file mode 100644
index 000000000000..b69ab89df24d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gstreamer/core/default.nix
@@ -0,0 +1,61 @@
+{ stdenv, fetchurl, fetchpatch, meson, ninja
+, pkgconfig, gettext, gobject-introspection
+, bison, flex, python3, glib, makeWrapper
+, libcap,libunwind, darwin
+, lib
+}:
+
+stdenv.mkDerivation rec {
+  name = "gstreamer-${version}";
+  version = "1.14.4";
+
+  meta = with lib ;{
+    description = "Open source multimedia framework";
+    homepage = https://gstreamer.freedesktop.org;
+    license = licenses.lgpl2Plus;
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ ttuegel matthewbauer ];
+  };
+
+  src = fetchurl {
+    url = "${meta.homepage}/src/gstreamer/${name}.tar.xz";
+    sha256 = "1izzhnlsy83rgr4zl3jcl1sryxqbbigrrqw3j4x3nnphqnb6ckzr";
+  };
+
+  patches = [
+    (fetchpatch {
+        url = "https://bug794856.bugzilla-attachments.gnome.org/attachment.cgi?id=370411";
+        sha256 = "16plzzmkk906k4892zq68j3c9z8vdma5nxzlviq20jfv04ykhmk2";
+    })
+    ./fix_pkgconfig_includedir.patch
+  ];
+
+  outputs = [ "out" "dev" ];
+  outputBin = "dev";
+
+  nativeBuildInputs = [
+    meson ninja pkgconfig gettext bison flex python3 makeWrapper gobject-introspection
+  ];
+  buildInputs =
+       lib.optionals stdenv.isLinux [ libcap libunwind ]
+    ++ lib.optional stdenv.isDarwin darwin.apple_sdk.frameworks.CoreServices;
+
+  propagatedBuildInputs = [ glib ];
+
+  postInstall = ''
+    for prog in "$dev/bin/"*; do
+        # We can't use --suffix here due to quoting so we craft the export command by hand
+        wrapProgram "$prog" --run "export GST_PLUGIN_SYSTEM_PATH=\$GST_PLUGIN_SYSTEM_PATH"$\{GST_PLUGIN_SYSTEM_PATH:+:\}"\$(unset _tmp; for profile in \$NIX_PROFILES; do _tmp="\$profile/lib/gstreamer-1.0''$\{_tmp:+:\}\$_tmp"; done; printf "\$_tmp")"
+    done
+  '';
+
+  preConfigure= ''
+    patchShebangs .
+  '';
+
+  preFixup = ''
+    moveToOutput "share/bash-completion" "$dev"
+  '';
+
+  setupHook = ./setup-hook.sh;
+}
diff --git a/nixpkgs/pkgs/development/libraries/gstreamer/core/fix_pkgconfig_includedir.patch b/nixpkgs/pkgs/development/libraries/gstreamer/core/fix_pkgconfig_includedir.patch
new file mode 100644
index 000000000000..c388a82fa2a8
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gstreamer/core/fix_pkgconfig_includedir.patch
@@ -0,0 +1,15 @@
+diff --git a/pkgconfig/meson.build b/pkgconfig/meson.build
+index edb0586c2..7ed46dfce 100644
+--- a/pkgconfig/meson.build
++++ b/pkgconfig/meson.build
+@@ -2,8 +2,8 @@ pkgconf = configuration_data()
+ 
+ pkgconf.set('prefix', join_paths(get_option('prefix')))
+ pkgconf.set('exec_prefix', '${prefix}')
+-pkgconf.set('libdir', '${prefix}/@0@'.format(get_option('libdir')))
+-pkgconf.set('includedir', '${prefix}/@0@'.format(get_option('includedir')))
++pkgconf.set('libdir', join_paths(get_option('prefix'), get_option('libdir')))
++pkgconf.set('includedir', join_paths(get_option('prefix'), get_option('includedir')))
+ pkgconf.set('GST_API_VERSION', apiversion)
+ pkgconf.set('VERSION', gst_version)
+ pkgconf.set('LIBM', mathlib.found() ? '-lm' : '')
diff --git a/nixpkgs/pkgs/development/libraries/gstreamer/core/setup-hook.sh b/nixpkgs/pkgs/development/libraries/gstreamer/core/setup-hook.sh
new file mode 100644
index 000000000000..b8c741af578f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gstreamer/core/setup-hook.sh
@@ -0,0 +1,9 @@
+addGstreamer1LibPath () {
+    if test -d "$1/lib/gstreamer-1.0"
+    then
+        export GST_PLUGIN_SYSTEM_PATH_1_0="${GST_PLUGIN_SYSTEM_PATH_1_0}${GST_PLUGIN_SYSTEM_PATH_1_0:+:}$1/lib/gstreamer-1.0"
+    fi
+}
+
+addEnvHooks "$hostOffset" addGstreamer1LibPath
+
diff --git a/nixpkgs/pkgs/development/libraries/gstreamer/default.nix b/nixpkgs/pkgs/development/libraries/gstreamer/default.nix
new file mode 100644
index 000000000000..9aec87634040
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gstreamer/default.nix
@@ -0,0 +1,29 @@
+{ callPackage }:
+
+rec {
+  gstreamer = callPackage ./core { };
+
+  gstreamermm = callPackage ./gstreamermm { };
+
+  gst-plugins-base = callPackage ./base { inherit gstreamer; };
+
+  gst-plugins-good = callPackage ./good { inherit gst-plugins-base; };
+
+  gst-plugins-bad = callPackage ./bad { inherit gst-plugins-base; };
+
+  gst-plugins-ugly = callPackage ./ugly { inherit gst-plugins-base; };
+
+  gst-rtsp-server = callPackage ./rtsp-server { inherit gst-plugins-base; };
+
+  gst-libav = callPackage ./libav { inherit gst-plugins-base; };
+
+  gst-editing-services = callPackage ./ges { inherit gst-plugins-base; };
+
+  gst-vaapi = callPackage ./vaapi {
+    inherit gst-plugins-base gstreamer gst-plugins-bad;
+  };
+
+  gst-validate = callPackage ./validate { inherit gst-plugins-base; };
+
+  # note: gst-python is in ./python/default.nix - called under pythonPackages
+}
diff --git a/nixpkgs/pkgs/development/libraries/gstreamer/ges/default.nix b/nixpkgs/pkgs/development/libraries/gstreamer/ges/default.nix
new file mode 100644
index 000000000000..fb7a37a4f448
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gstreamer/ges/default.nix
@@ -0,0 +1,39 @@
+{ stdenv, fetchurl, fetchpatch, meson, ninja
+, pkgconfig, python, gst-plugins-base, libxml2
+, flex, perl, gettext, gobject-introspection
+}:
+
+stdenv.mkDerivation rec {
+  name = "gstreamer-editing-services-${version}";
+  version = "1.14.4";
+
+  meta = with stdenv.lib; {
+    description = "Library for creation of audio/video non-linear editors";
+    homepage    = "https://gstreamer.freedesktop.org";
+    license     = licenses.lgpl2Plus;
+    platforms   = platforms.unix;
+  };
+
+  src = fetchurl {
+    url = "${meta.homepage}/src/gstreamer-editing-services/${name}.tar.xz";
+    sha256 = "0pxk65jib3mqszjkyvlzklwia4kbdj6j2b6jw1d502b06mdx5lak";
+  };
+
+  outputs = [ "out" "dev" ];
+
+  nativeBuildInputs = [ meson ninja pkgconfig gettext gobject-introspection python flex perl ];
+
+  propagatedBuildInputs = [ gst-plugins-base libxml2 ];
+
+  patches = [
+    (fetchpatch {
+        url = "https://bug794856.bugzilla-attachments.gnome.org/attachment.cgi?id=370413";
+        sha256 = "1xcgbs18g6n5p7z7kqj7ffakwmkxq7ijajyvhyl7p3zvqll9dc7x";
+    })
+    ./fix_pkgconfig_includedir.patch
+  ];
+
+  postPatch = ''
+    sed -i -r -e 's/p(bad|good) = .*/p\1 = pbase/' tests/check/meson.build
+  '';
+}
diff --git a/nixpkgs/pkgs/development/libraries/gstreamer/ges/fix_pkgconfig_includedir.patch b/nixpkgs/pkgs/development/libraries/gstreamer/ges/fix_pkgconfig_includedir.patch
new file mode 100644
index 000000000000..1e12f3bbfbea
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gstreamer/ges/fix_pkgconfig_includedir.patch
@@ -0,0 +1,15 @@
+diff --git a/pkgconfig/meson.build b/pkgconfig/meson.build
+index a612b21b..c017eaff 100644
+--- a/pkgconfig/meson.build
++++ b/pkgconfig/meson.build
+@@ -2,8 +2,8 @@ pkgconf = configuration_data()
+ 
+ pkgconf.set('prefix', get_option('prefix'))
+ pkgconf.set('exec_prefix', '${prefix}')
+-pkgconf.set('libdir', '${prefix}/@0@'.format(get_option('libdir')))
+-pkgconf.set('includedir', '${prefix}/@0@'.format(get_option('includedir')))
++pkgconf.set('libdir', join_paths(get_option('prefix'), get_option('libdir')))
++pkgconf.set('includedir', join_paths(get_option('prefix'), get_option('includedir')))
+ pkgconf.set('GST_API_VERSION', apiversion)
+ pkgconf.set('VERSION', gst_version)
+ 
diff --git a/nixpkgs/pkgs/development/libraries/gstreamer/good/default.nix b/nixpkgs/pkgs/development/libraries/gstreamer/good/default.nix
new file mode 100644
index 000000000000..247a74e3a325
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gstreamer/good/default.nix
@@ -0,0 +1,69 @@
+{ stdenv, fetchurl, meson, ninja, pkgconfig, python
+, gst-plugins-base, orc, bzip2, gettext
+, libv4l, libdv, libavc1394, libiec61883
+, libvpx, speex, flac, taglib, libshout
+, cairo, gdk_pixbuf, aalib, libcaca
+, libsoup, libpulseaudio, libintl
+, darwin, lame, mpg123, twolame
+, gtkSupport ? false, gtk3 ? null
+, libXdamage
+, libXext
+, libXfixes
+, ncurses
+}:
+
+assert gtkSupport -> gtk3 != null;
+
+let
+  inherit (stdenv.lib) optional optionals;
+in
+stdenv.mkDerivation rec {
+  name = "gst-plugins-good-${version}";
+  version = "1.14.4";
+
+  meta = with stdenv.lib; {
+    description = "Gstreamer Good Plugins";
+    homepage    = "https://gstreamer.freedesktop.org";
+    longDescription = ''
+      a set of plug-ins that we consider to have good quality code,
+      correct functionality, our preferred license (LGPL for the plug-in
+      code, LGPL or LGPL-compatible for the supporting library).
+    '';
+    license     = licenses.lgpl2Plus;
+    platforms   = platforms.linux ++ platforms.darwin;
+    maintainers = with maintainers; [ matthewbauer ];
+  };
+
+  src = fetchurl {
+    url = "${meta.homepage}/src/gst-plugins-good/${name}.tar.xz";
+    sha256 = "0y89qynb4b6fry3h43z1r99qslmi3m8xhlq0i5baq2nbc0r5b2sz";
+  };
+
+  outputs = [ "out" "dev" ];
+
+  patches = [ ./fix_pkgconfig_includedir.patch ];
+
+  nativeBuildInputs = [ pkgconfig python meson ninja gettext ];
+
+  NIX_LDFLAGS = "-lncurses";
+
+  buildInputs = [
+    gst-plugins-base orc bzip2
+    libdv libvpx speex flac taglib
+    cairo gdk_pixbuf aalib libcaca
+    libsoup libshout lame mpg123 twolame libintl
+    # TODO: Remove the comments once https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/commit/e234932dc703e51a0e1aa3b9c408f12758b12335
+    # is merged and available in nixpkgs.
+    libXdamage # present feature but undeclared in meson_options.txt, see https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/issues/553
+    libXext # present feature but undeclared in meson_options.txt, see https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/issues/553
+    libXfixes # present feature but undeclared in meson_options.txt, see https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/issues/553
+    ncurses
+  ]
+  ++ optional gtkSupport gtk3 # for gtksink
+  ++ optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.Cocoa ]
+  ++ optionals stdenv.isLinux [ libv4l libpulseaudio libavc1394 libiec61883 ];
+
+  # fails 1 tests with "Unexpected critical/warning: g_object_set_is_valid_property: object class 'GstRtpStorage' has no property named ''"
+  doCheck = false;
+
+}
diff --git a/nixpkgs/pkgs/development/libraries/gstreamer/good/fix_pkgconfig_includedir.patch b/nixpkgs/pkgs/development/libraries/gstreamer/good/fix_pkgconfig_includedir.patch
new file mode 100644
index 000000000000..f68ad603a37c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gstreamer/good/fix_pkgconfig_includedir.patch
@@ -0,0 +1,15 @@
+diff --git a/pkgconfig/meson.build b/pkgconfig/meson.build
+index b3bf0d4d4..3e6e576c0 100644
+--- a/pkgconfig/meson.build
++++ b/pkgconfig/meson.build
+@@ -2,8 +2,8 @@ pkgconf = configuration_data()
+ 
+ pkgconf.set('prefix', get_option('prefix'))
+ pkgconf.set('exec_prefix', '${prefix}')
+-pkgconf.set('libdir', '${prefix}/@0@'.format(get_option('libdir')))
+-pkgconf.set('includedir', '${prefix}/@0@'.format(get_option('includedir')))
++pkgconf.set('libdir', join_paths(get_option('prefix'), get_option('libdir')))
++pkgconf.set('includedir', join_paths(get_option('prefix'), get_option('includedir')))
+ pkgconf.set('GST_API_VERSION', api_version)
+ pkgconf.set('VERSION', gst_version)
+ 
diff --git a/nixpkgs/pkgs/development/libraries/gstreamer/gstreamermm/default.nix b/nixpkgs/pkgs/development/libraries/gstreamer/gstreamermm/default.nix
new file mode 100644
index 000000000000..35c278da03b1
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gstreamer/gstreamermm/default.nix
@@ -0,0 +1,34 @@
+{ stdenv, fetchurl, pkgconfig, 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";
+    sha256 = "0q4dx9sncqbwgpzma0zvj6zssc279yl80pn8irb95qypyyggwn5y";
+  };
+
+  outputs = [ "out" "dev" ];
+
+  nativeBuildInputs = [ pkgconfig file ];
+
+  propagatedBuildInputs = [ glibmm gst_all_1.gst-plugins-base ];
+
+  enableParallelBuilding = true;
+
+  passthru = {
+    updateScript = gnome3.updateScript {
+      packageName = pname;
+      versionPolicy = "none"; # Unpredictable version stability
+    };
+  };
+
+  meta = with stdenv.lib; {
+    description = "C++ interface for GStreamer";
+    homepage = "https://gstreamer.freedesktop.org/bindings/cplusplus.html";
+    license = licenses.lgpl21Plus;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ romildo ];
+  };
+
+}
diff --git a/nixpkgs/pkgs/development/libraries/gstreamer/legacy/gnonlin/default.nix b/nixpkgs/pkgs/development/libraries/gstreamer/legacy/gnonlin/default.nix
new file mode 100644
index 000000000000..402074a4e5f4
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gstreamer/legacy/gnonlin/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchurl, pkgconfig, gst-plugins-base, gstreamer }:
+
+stdenv.mkDerivation rec {
+  name = "gnonlin-0.10.17";
+
+  src = fetchurl {
+    urls = [
+      "https://gstreamer.freedesktop.org/src/gnonlin/${name}.tar.bz2"
+      "mirror://gentoo/distfiles/${name}.tar.bz2"
+      ];
+    sha256 = "0dc9kvr6i7sh91cyhzlbx2bchwg84rfa4679ccppzjf0y65dv8p4";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ gst-plugins-base gstreamer ];
+
+  meta = {
+    homepage = https://gstreamer.freedesktop.org/modules/gnonlin.html;
+    description = "Gstreamer Non-Linear Multimedia Editing Plugins";
+    license = stdenv.lib.licenses.gpl2Plus;
+    platforms = stdenv.lib.platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gstreamer/legacy/gst-plugins-bad/default.nix b/nixpkgs/pkgs/development/libraries/gstreamer/legacy/gst-plugins-bad/default.nix
new file mode 100644
index 000000000000..77465645d237
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gstreamer/legacy/gst-plugins-bad/default.nix
@@ -0,0 +1,36 @@
+{ fetchurl, stdenv, pkgconfig, glib, gstreamer, gst-plugins-base
+, libdvdnav, libdvdread, orc }:
+
+stdenv.mkDerivation rec {
+  name = "gst-plugins-bad-0.10.23";
+
+  src = fetchurl {
+    urls = [
+      "${meta.homepage}/src/gst-plugins-bad/${name}.tar.bz2"
+      "mirror://gentoo/distfiles/${name}.tar.bz2"
+      ];
+    sha256 = "148lw51dm6pgw8vc6v0fpvm7p233wr11nspdzmvq7bjp2cd7vbhf";
+  };
+
+  postInstall = ''
+    # Fixes CVE-2016-9447
+    # Does not actually impact NSF playback
+    rm -v $out/lib/gstreamer-0.10/libgstnsf.so
+  '';
+
+  buildInputs =
+    [ pkgconfig glib gstreamer gst-plugins-base libdvdnav libdvdread orc ];
+
+  enableParallelBuilding = true;
+
+  meta = {
+    homepage = https://gstreamer.freedesktop.org;
+
+    description = "‘Bad’ (potentially low quality) plug-ins for GStreamer";
+
+    maintainers = [stdenv.lib.maintainers.raskin];
+    platforms = stdenv.lib.platforms.linux;
+
+    license = stdenv.lib.licenses.lgpl2Plus;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gstreamer/legacy/gst-plugins-base/default.nix b/nixpkgs/pkgs/development/libraries/gstreamer/legacy/gst-plugins-base/default.nix
new file mode 100644
index 000000000000..db75705c825a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gstreamer/legacy/gst-plugins-base/default.nix
@@ -0,0 +1,53 @@
+{ fetchurl, stdenv, pkgconfig, gstreamer, xorg, alsaLib, cdparanoia
+, libogg, libtheora, libvorbis, freetype, pango, liboil, glib, cairo, orc
+, libintl
+, ApplicationServices
+, # Whether to build no plugins that have external dependencies
+  # (except the ALSA plugin).
+  minimalDeps ? false
+}:
+
+stdenv.mkDerivation rec {
+  name = "gst-plugins-base-0.10.36";
+
+  src = fetchurl {
+    urls = [
+      "${meta.homepage}/src/gst-plugins-base/${name}.tar.xz"
+      "mirror://gentoo/distfiles/${name}.tar.xz"
+      ];
+    sha256 = "0jp6hjlra98cnkal4n6bdmr577q8mcyp3c08s3a02c4hjhw5rr0z";
+  };
+
+  patchPhase = ''
+    sed -i 's@/bin/echo@echo@g' configure
+    sed -i -e 's/^   /\t/' docs/{libs,plugins}/Makefile.in
+
+    patch -p1 < ${./gcc-4.9.patch}
+  '';
+
+  outputs = [ "out" "dev" ];
+
+  # TODO : v4l, libvisual
+  buildInputs =
+    [ pkgconfig glib cairo orc libintl ]
+    # can't build alsaLib on darwin
+    ++ stdenv.lib.optional (!stdenv.isDarwin) alsaLib
+    ++ stdenv.lib.optionals (!minimalDeps)
+      [ xorg.xlibsWrapper xorg.libXv libogg libtheora libvorbis freetype pango
+        liboil ]
+    # can't build cdparanoia on darwin
+    ++ stdenv.lib.optional (!minimalDeps && !stdenv.isDarwin) cdparanoia
+    ++ stdenv.lib.optional stdenv.isDarwin ApplicationServices;
+
+  propagatedBuildInputs = [ gstreamer ];
+
+  postInstall = "rm -rf $out/share/gtk-doc";
+
+  meta = with stdenv.lib; {
+    homepage    = https://gstreamer.freedesktop.org;
+    description = "Base plug-ins for GStreamer";
+    license     = licenses.lgpl2Plus;
+    maintainers = with maintainers; [ lovek323 ];
+    platforms   = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gstreamer/legacy/gst-plugins-base/gcc-4.9.patch b/nixpkgs/pkgs/development/libraries/gstreamer/legacy/gst-plugins-base/gcc-4.9.patch
new file mode 100644
index 000000000000..fd9f6ea240d2
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gstreamer/legacy/gst-plugins-base/gcc-4.9.patch
@@ -0,0 +1,38 @@
+https://bugzilla.gnome.org/show_bug.cgi?id=670690
+
+From 9bd5a7ae5435469c3557a3d70e762791cb3dc5c7 Mon Sep 17 00:00:00 2001
+From: Antoine Jacoutot <ajacoutot@gnome.org>
+Date: Mon, 20 Jan 2014 15:44:09 +0100
+Subject: [PATCH] audioresample: fix build on BSD
+
+On i386, EMMINTRIN is defined but not usable without sse so check for
+__SSE__ and __SSE2__ as well.
+
+https://bugzilla.gnome.org/show_bug.cgi?id=670690
+---
+ gst/audioresample/resample.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/gst/audioresample/resample.c b/gst/audioresample/resample.c
+index 98d006c..481fa01 100644
+--- a/gst/audioresample/resample.c
++++ b/gst/audioresample/resample.c
+@@ -77,13 +77,13 @@
+ #define EXPORT G_GNUC_INTERNAL
+ 
+ #ifdef _USE_SSE
+-#ifndef HAVE_XMMINTRIN_H
++#if !defined(__SSE__) || !defined(HAVE_XMMINTRIN_H)
+ #undef _USE_SSE
+ #endif
+ #endif
+ 
+ #ifdef _USE_SSE2
+-#ifndef HAVE_EMMINTRIN_H
++#if !defined(__SSE2__) || !defined(HAVE_XMMINTRIN_H)
+ #undef _USE_SSE2
+ #endif
+ #endif
+-- 
+1.8.5.3
+
diff --git a/nixpkgs/pkgs/development/libraries/gstreamer/legacy/gst-plugins-good/default.nix b/nixpkgs/pkgs/development/libraries/gstreamer/legacy/gst-plugins-good/default.nix
new file mode 100644
index 000000000000..7ecb6c34b432
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gstreamer/legacy/gst-plugins-good/default.nix
@@ -0,0 +1,52 @@
+{ fetchurl, stdenv, lib, pkgconfig, gst-plugins-base, aalib, cairo
+, flac, libjpeg, speex, libpng, libdv, libcaca, libvpx
+, taglib, libpulseaudio, gdk_pixbuf, orc
+, glib, gstreamer, bzip2, libsoup, libshout, ncurses, libintl
+, # Whether to build no plugins that have external dependencies
+  # (except the PulseAudio plugin).
+  minimalDeps ? false
+}:
+
+stdenv.mkDerivation rec {
+  name = "gst-plugins-good-0.10.31";
+
+  src = fetchurl {
+    urls = [
+      "${meta.homepage}/src/gst-plugins-good/${name}.tar.bz2"
+      "mirror://gentoo/distfiles/${name}.tar.bz2"
+      ];
+    sha256 = "1ijswgcrdp243mfsyza31fpzq6plz40p4b83vkr2x4x7807889vy";
+  };
+
+  patches = [ ./v4l.patch ./linux-headers-3.9.patch ];
+
+  configureFlags = [ "--enable-experimental" "--disable-oss" ];
+
+  buildInputs =
+    [ pkgconfig glib gstreamer gst-plugins-base libintl ]
+    ++ lib.optional stdenv.isLinux libpulseaudio
+    ++ lib.optionals (!minimalDeps)
+      [ aalib libcaca cairo libdv flac libjpeg libpng speex
+        taglib bzip2 libvpx gdk_pixbuf orc libsoup libshout ];
+
+  enableParallelBuilding = true;
+
+  postInstall = lib.optionalString (!minimalDeps) ''
+    substituteInPlace $out/lib/gstreamer-0.10/libgstaasink.la \
+      --replace "${ncurses.dev}/lib" "${ncurses.out}/lib"
+  '';
+
+  # fails 1 out of 65 tests with "Could not read TLS certificate from '../../tests/files/test-cert.pem': TLS support is not available"
+  doCheck = false;
+
+  meta = {
+    homepage = https://gstreamer.freedesktop.org;
+
+    description = "`Good' plug-ins for GStreamer";
+
+    maintainers = [stdenv.lib.maintainers.raskin];
+    platforms = stdenv.lib.platforms.unix;
+
+    license = stdenv.lib.licenses.lgpl2Plus;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gstreamer/legacy/gst-plugins-good/linux-headers-3.9.patch b/nixpkgs/pkgs/development/libraries/gstreamer/legacy/gst-plugins-good/linux-headers-3.9.patch
new file mode 100644
index 000000000000..f13d3a166714
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gstreamer/legacy/gst-plugins-good/linux-headers-3.9.patch
@@ -0,0 +1,27 @@
+http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/media-plugins/gst-plugins-v4l2/files/gst-plugins-v4l2-0.10.31-linux-headers-3.9.patch
+
+From 8e633d2059cb835448021cf79becb487aff10975 Mon Sep 17 00:00:00 2001
+From: Bastien Nocera <hadess@hadess.net>
+Date: Mon, 18 Mar 2013 14:59:35 +0000
+Subject: v4l2: fix compilation against newer kernel headers as on FC19
+
+---
+diff --git a/sys/v4l2/v4l2_calls.c b/sys/v4l2/v4l2_calls.c
+index 07d390a..4c10f4f 100644
+--- a/sys/v4l2/v4l2_calls.c
++++ b/sys/v4l2/v4l2_calls.c
+@@ -291,8 +291,12 @@ gst_v4l2_fill_lists (GstV4l2Object * v4l2object)
+         break;
+       case V4L2_CID_HFLIP:
+       case V4L2_CID_VFLIP:
++#ifndef V4L2_CID_PAN_RESET
+       case V4L2_CID_HCENTER:
++#endif
++#ifndef V4L2_CID_TILT_RESET
+       case V4L2_CID_VCENTER:
++#endif
+ #ifdef V4L2_CID_PAN_RESET
+       case V4L2_CID_PAN_RESET:
+ #endif
+--
+cgit v0.9.0.2-2-gbebe
diff --git a/nixpkgs/pkgs/development/libraries/gstreamer/legacy/gst-plugins-good/v4l.patch b/nixpkgs/pkgs/development/libraries/gstreamer/legacy/gst-plugins-good/v4l.patch
new file mode 100644
index 000000000000..22cff574134f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gstreamer/legacy/gst-plugins-good/v4l.patch
@@ -0,0 +1,11 @@
+diff -ru -x '*~' gst-plugins-good-0.10.31-orig/sys/v4l2/gstv4l2bufferpool.c gst-plugins-good-0.10.31/sys/v4l2/gstv4l2bufferpool.c
+--- gst-plugins-good-0.10.31-orig/sys/v4l2/gstv4l2bufferpool.c	2011-12-30 14:59:13.000000000 +0100
++++ gst-plugins-good-0.10.31/sys/v4l2/gstv4l2bufferpool.c	2013-01-28 17:41:25.549523708 +0100
+@@ -181,7 +181,6 @@
+     GST_LOG_OBJECT (pool->v4l2elem, "  MMAP offset:  %u",
+         ret->vbuffer.m.offset);
+   GST_LOG_OBJECT (pool->v4l2elem, "  length:    %u", ret->vbuffer.length);
+-  GST_LOG_OBJECT (pool->v4l2elem, "  input:     %u", ret->vbuffer.input);
+ 
+   data = (guint8 *) v4l2_mmap (0, ret->vbuffer.length,
+       PROT_READ | PROT_WRITE, MAP_SHARED, pool->video_fd,
diff --git a/nixpkgs/pkgs/development/libraries/gstreamer/legacy/gst-plugins-ugly/default.nix b/nixpkgs/pkgs/development/libraries/gstreamer/legacy/gst-plugins-ugly/default.nix
new file mode 100644
index 000000000000..2f46016adac8
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gstreamer/legacy/gst-plugins-ugly/default.nix
@@ -0,0 +1,30 @@
+{ fetchurl, stdenv, pkgconfig, glib, gstreamer, gst-plugins-base
+, libmad, libdvdread, a52dec, x264, orc, lame, libintl }:
+
+stdenv.mkDerivation rec {
+  name = "gst-plugins-ugly-0.10.19";
+
+  src = fetchurl {
+    urls = [
+      "${meta.homepage}/src/gst-plugins-ugly/${name}.tar.bz2"
+      "mirror://gentoo/distfiles/${name}.tar.bz2"
+      ];
+    sha256 = "1w4d5iz9ffvh43l261zdp997i6s2iwd61lflf755s3sw4xch1a8w";
+  };
+
+  buildInputs =
+    [ pkgconfig glib gstreamer gst-plugins-base libmad libdvdread a52dec x264 orc lame libintl ];
+
+  enableParallelBuilding = true;
+
+  meta = {
+    homepage = https://gstreamer.freedesktop.org;
+
+    description = "‘Ugly’ (potentially patent-encumbered) plug-ins for GStreamer";
+
+    maintainers = [stdenv.lib.maintainers.raskin];
+    platforms = stdenv.lib.platforms.unix;
+
+    license = stdenv.lib.licenses.lgpl2Plus;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gstreamer/legacy/gst-python/default.nix b/nixpkgs/pkgs/development/libraries/gstreamer/legacy/gst-python/default.nix
new file mode 100644
index 000000000000..c8414a7b681b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gstreamer/legacy/gst-python/default.nix
@@ -0,0 +1,37 @@
+{ fetchurl, stdenv, pkgconfig, python2Packages, gstreamer, gst-plugins-base
+}:
+
+let
+  inherit (python2Packages) python pygobject2;
+in stdenv.mkDerivation rec {
+  name = "gst-python-0.10.22";
+
+  src = fetchurl {
+    urls = [
+      "${meta.homepage}/src/gst-python/${name}.tar.bz2"
+      "mirror://gentoo/distfiles/${name}.tar.bz2"
+      ];
+    sha256 = "0y1i4n5m1diljqr9dsq12anwazrhbs70jziich47gkdwllcza9lg";
+  };
+
+  hardeningDisable = [ "bindnow" ];
+
+  # Need to disable the testFake test case due to bug in pygobject.
+  # See https://bugzilla.gnome.org/show_bug.cgi?id=692479
+  patches = [ ./disable-testFake.patch ];
+
+  buildInputs =
+    [ pkgconfig gst-plugins-base pygobject2 ]
+    ;
+
+  propagatedBuildInputs = [ gstreamer python ];
+
+  meta = {
+    homepage = https://gstreamer.freedesktop.org;
+
+    description = "Python bindings for GStreamer";
+
+    license = stdenv.lib.licenses.lgpl2Plus;
+    platforms = stdenv.lib.platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gstreamer/legacy/gst-python/disable-testFake.patch b/nixpkgs/pkgs/development/libraries/gstreamer/legacy/gst-python/disable-testFake.patch
new file mode 100644
index 000000000000..d0c9960e5d22
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gstreamer/legacy/gst-python/disable-testFake.patch
@@ -0,0 +1,56 @@
+diff -Nurp gst-python-0.10.22.orig/testsuite/test_bin.py gst-python-0.10.22/testsuite/test_bin.py
+--- gst-python-0.10.22.orig/testsuite/test_bin.py	2014-10-29 18:58:00.921827721 +0100
++++ gst-python-0.10.22/testsuite/test_bin.py	2014-10-29 19:00:32.019353092 +0100
+@@ -131,52 +131,6 @@ class BinAddRemove(TestCase):
+         self.assertRaises(gst.AddError, self.bin.add, src, sink)
+         self.bin.remove(src, sink)
+         self.assertRaises(gst.RemoveError, self.bin.remove, src, sink)
+-
+-class Preroll(TestCase):
+-    def setUp(self):
+-        TestCase.setUp(self)
+-        self.bin = gst.Bin('bin')
+-
+-    def tearDown(self):
+-        # FIXME: wait for state change thread to settle down
+-        while self.bin.__gstrefcount__ > 1:
+-            time.sleep(0.1)
+-        self.assertEquals(self.bin.__gstrefcount__, 1)
+-        del self.bin
+-        TestCase.tearDown(self)
+-
+-    def testFake(self):
+-        src = gst.element_factory_make('fakesrc')
+-        sink = gst.element_factory_make('fakesink')
+-        self.bin.add(src)
+-
+-        # bin will go to paused, src pad task will start and error out
+-        self.bin.set_state(gst.STATE_PAUSED)
+-        ret = self.bin.get_state()
+-        self.assertEquals(ret[0], gst.STATE_CHANGE_SUCCESS)
+-        self.assertEquals(ret[1], gst.STATE_PAUSED)
+-        self.assertEquals(ret[2], gst.STATE_VOID_PENDING)
+-
+-        # adding the sink will cause the bin to go in preroll mode
+-        gst.debug('adding sink and setting to PAUSED, should cause preroll')
+-        self.bin.add(sink)
+-        sink.set_state(gst.STATE_PAUSED)
+-        ret = self.bin.get_state(timeout=0)
+-        self.assertEquals(ret[0], gst.STATE_CHANGE_ASYNC)
+-        self.assertEquals(ret[1], gst.STATE_PAUSED)
+-        self.assertEquals(ret[2], gst.STATE_PAUSED)
+-
+-        # to actually complete preroll, we need to link and re-enable fakesrc
+-        src.set_state(gst.STATE_READY)
+-        src.link(sink)
+-        src.set_state(gst.STATE_PAUSED)
+-        ret = self.bin.get_state()
+-        self.assertEquals(ret[0], gst.STATE_CHANGE_SUCCESS)
+-        self.assertEquals(ret[1], gst.STATE_PAUSED)
+-        self.assertEquals(ret[2], gst.STATE_VOID_PENDING)
+-
+-        self.bin.set_state(gst.STATE_NULL)
+-        self.bin.get_state()
+  
+ class ConstructorTest(TestCase):
+     def testGood(self):
diff --git a/nixpkgs/pkgs/development/libraries/gstreamer/legacy/gstreamer/darwin.patch b/nixpkgs/pkgs/development/libraries/gstreamer/legacy/gstreamer/darwin.patch
new file mode 100644
index 000000000000..67dfc34434db
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gstreamer/legacy/gstreamer/darwin.patch
@@ -0,0 +1,14 @@
+diff --git a/gst/gstdatetime.c b/gst/gstdatetime.c
+index 60f709f..cdc7e75 100644
+--- a/gst/gstdatetime.c
++++ b/gst/gstdatetime.c
+@@ -21,8 +21,8 @@
+ #include "config.h"
+ #endif
+ 
+-#include "glib-compat-private.h"
+ #include "gst_private.h"
++#include "glib-compat-private.h"
+ #include "gstdatetime.h"
+ #include <glib.h>
+ #include <math.h>
diff --git a/nixpkgs/pkgs/development/libraries/gstreamer/legacy/gstreamer/default.nix b/nixpkgs/pkgs/development/libraries/gstreamer/legacy/gstreamer/default.nix
new file mode 100644
index 000000000000..d03151e43444
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gstreamer/legacy/gstreamer/default.nix
@@ -0,0 +1,84 @@
+{ fetchurl, fetchpatch, stdenv, autoreconfHook
+, perl, bison2, flex, pkgconfig, glib, libxml2, libintl
+}:
+
+stdenv.mkDerivation rec {
+  name = "gstreamer-0.10.36";
+
+  src = fetchurl {
+    urls =
+      [ "${meta.homepage}/src/gstreamer/${name}.tar.xz"
+        "mirror://gentoo/distfiles/${name}.tar.xz"
+      ];
+    sha256 = "1nkid1n2l3rrlmq5qrf5yy06grrkwjh3yxl5g0w58w0pih8allci";
+  };
+
+  outputs = [ "out" "dev" ];
+
+  nativeBuildInputs = [ autoreconfHook flex perl pkgconfig libintl bison2 glib ];
+  propagatedBuildInputs = [ glib libxml2 ];
+
+  patches = [
+    (fetchpatch {
+      url = "https://github.com/GStreamer/common/commit/03a0e5736761a72d4ed880e8c485bbf9e4a8ea47.patch";
+      sha256 = "0rin3x01yy78ky3smmhbwlph18hhym18q4x9w6ddiqajg5lk4xhm";
+      extraPrefix = "common/";
+      stripLen = 1;
+    })
+    (fetchpatch {
+      url = "https://github.com/GStreamer/common/commit/8aadeaaa8a948d7ce62008789ab03e9aa514c2b9.patch";
+      sha256 = "0n2mqvq2al7jr2hflhz4l781i3jya5a9i725jvy508ambpgycz3x";
+      extraPrefix = "common/";
+      stripLen = 1;
+    })
+    (fetchpatch {
+      url = "https://github.com/GStreamer/common/commit/7bb2bcecda471a0d514a964365a78150f3ee5747.patch";
+      sha256 = "0famdj70m7wjvr1dpy7iywhrkqxmrshxz0rizz1bixgp42dvkhbq";
+      extraPrefix = "common/";
+      stripLen = 1;
+    })
+  ] ++
+    # See https://trac.macports.org/ticket/40783 for explanation of patch
+    stdenv.lib.optional stdenv.isDarwin ./darwin.patch;
+
+  postPatch = ''
+    sed -i -e 's/^   /\t/' docs/gst/Makefile.in docs/libs/Makefile.in docs/plugins/Makefile.in
+  '';
+
+  configureFlags = [
+    "--disable-examples"
+    "--localstatedir=/var"
+    "--disable-gtk-doc"
+    "--disable-docbook"
+  ];
+
+  doCheck = false; # fails. 2 tests crash
+
+  postInstall = ''
+    # Hm, apparently --disable-gtk-doc is ignored...
+    rm -rf $out/share/gtk-doc
+  '';
+
+  setupHook = ./setup-hook.sh;
+
+  meta = {
+    homepage = https://gstreamer.freedesktop.org;
+
+    description = "Library for constructing graphs of media-handling components";
+
+    longDescription = ''
+      GStreamer is a library for constructing graphs of media-handling
+      components.  The applications it supports range from simple
+      Ogg/Vorbis playback, audio/video streaming to complex audio
+      (mixing) and video (non-linear editing) processing.
+
+      Applications can take advantage of advances in codec and filter
+      technology transparently.  Developers can add new codecs and
+      filters by writing a simple plugin with a clean, generic
+      interface.
+    '';
+
+    license = stdenv.lib.licenses.lgpl2Plus;
+    platforms = stdenv.lib.platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gstreamer/legacy/gstreamer/setup-hook.sh b/nixpkgs/pkgs/development/libraries/gstreamer/legacy/gstreamer/setup-hook.sh
new file mode 100644
index 000000000000..65ce26112519
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gstreamer/legacy/gstreamer/setup-hook.sh
@@ -0,0 +1,8 @@
+addGstreamerLibPath () {
+    if test -d "$1/lib/gstreamer-0.10"
+    then
+        export GST_PLUGIN_SYSTEM_PATH="${GST_PLUGIN_SYSTEM_PATH}${GST_PLUGIN_SYSTEM_PATH:+:}$1/lib/gstreamer-0.10"
+    fi
+}
+
+addEnvHooks "$hostOffset" addGstreamerLibPath
diff --git a/nixpkgs/pkgs/development/libraries/gstreamer/legacy/gstreamermm/default.nix b/nixpkgs/pkgs/development/libraries/gstreamer/legacy/gstreamermm/default.nix
new file mode 100644
index 000000000000..8acaefcedf46
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gstreamer/legacy/gstreamermm/default.nix
@@ -0,0 +1,31 @@
+{ stdenv, fetchurl, glibmm, gstreamer, gst-plugins-base, libsigcxx, libxmlxx, pkgconfig }:
+
+let
+  ver_maj = "0.10";
+  ver_min = "11";
+in
+stdenv.mkDerivation rec {
+  name = "gstreamermm-${ver_maj}.${ver_min}";
+
+  src = fetchurl {
+    url    = "mirror://gnome/sources/gstreamermm/${ver_maj}/gstreamermm-${ver_maj}.${ver_min}.tar.xz";
+    sha256 = "12b5f377363594a69cb79f2f5cd0a8b1813ca6553680c3216e6354cfd682ebc6";
+  };
+ 
+  doCheck = false; # Tests require pulseaudio in /homeless-shelter
+
+  propagatedBuildInputs = [
+    glibmm gstreamer gst-plugins-base libsigcxx libxmlxx
+  ];
+
+  nativeBuildInputs = [ pkgconfig ];
+
+  meta = with stdenv.lib; {
+    description = "C++ bindings for the GStreamer streaming multimedia library";
+    homepage = https://www.gtkmm.org/;
+    license = licenses.lgpl2Plus;
+    maintainers = with maintainers; [ plcplc ];
+    platforms = platforms.unix;
+  };
+
+}
diff --git a/nixpkgs/pkgs/development/libraries/gstreamer/legacy/qt-gstreamer/boost1.48.patch b/nixpkgs/pkgs/development/libraries/gstreamer/legacy/qt-gstreamer/boost1.48.patch
new file mode 100644
index 000000000000..c48eec68a640
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gstreamer/legacy/qt-gstreamer/boost1.48.patch
@@ -0,0 +1,49 @@
+Description: Work around moc limitations
+ Some parts of Boost, introduced in Boost 1.48 are not
+ understood by the limited C++ parser of moc.  This
+ patch defines header guards that prevent the troublesome boost
+ headers from being processed.
+Bug-Debian: #653796
+Author: Tobias Frost <tobi@coldtobi.de>
+Reviewed-By: Steve Robbins <smr@debian.org>
+
+--- a/src/QGlib/connect.h
++++ b/src/QGlib/connect.h
+@@ -19,6 +19,11 @@
+ #ifndef QGLIB_CONNECT_H
+ #define QGLIB_CONNECT_H
+ 
++#ifdef Q_MOC_RUN
++#define BOOST_TT_HAS_OPERATOR_HPP_INCLUDED
++#endif
++
++
+ #include "global.h"
+ #include "quark.h"
+ #include <QtCore/QObject>
+--- a/src/QGst/bin.h
++++ b/src/QGst/bin.h
+@@ -19,6 +19,10 @@
+ #ifndef QGST_BIN_H
+ #define QGST_BIN_H
+ 
++#ifdef Q_MOC_RUN
++#define BOOST_TT_HAS_OPERATOR_HPP_INCLUDED
++#endif
++
+ #include "element.h"
+ #include "childproxy.h"
+ 
+--- a/src/QGst/Ui/videowidget.h
++++ b/src/QGst/Ui/videowidget.h
+@@ -19,6 +19,10 @@
+ #ifndef QGST_UI_VIDEOWIDGET_H
+ #define QGST_UI_VIDEOWIDGET_H
+ 
++#ifdef Q_MOC_RUN
++#define BOOST_TT_HAS_OPERATOR_HPP_INCLUDED
++#endif
++
+ #include "global.h"
+ #include "../element.h"
+ #include <QtGui/QWidget>
diff --git a/nixpkgs/pkgs/development/libraries/gstreamer/legacy/qt-gstreamer/default.nix b/nixpkgs/pkgs/development/libraries/gstreamer/legacy/qt-gstreamer/default.nix
new file mode 100644
index 000000000000..9797f21c1685
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gstreamer/legacy/qt-gstreamer/default.nix
@@ -0,0 +1,20 @@
+{ stdenv, fetchurl, gstreamer, gst-plugins-base, boost155, glib, qt4, cmake
+, automoc4, flex, bison, pkgconfig }:
+
+stdenv.mkDerivation rec {
+  name = "${pname}-0.10.3";
+  pname = "qt-gstreamer";
+
+  src = fetchurl {
+    url = "https://gstreamer.freedesktop.org/src/${pname}/${name}.tar.bz2";
+    sha256 = "1pqg9sxzk8sdrf7pazb5v21hasqai9i4l203gbdqz29w2ll1ybsl";
+  };
+
+  buildInputs = [ gstreamer gst-plugins-base glib qt4 ];
+  propagatedBuildInputs = [ boost155 ];
+  nativeBuildInputs = [ cmake automoc4 flex bison pkgconfig ];
+
+  cmakeFlags = "-DUSE_QT_PLUGIN_DIR=OFF -DUSE_GST_PLUGIN_DIR=OFF";
+
+  patches = [ ./boost1.48.patch ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/gstreamer/libav/default.nix b/nixpkgs/pkgs/development/libraries/gstreamer/libav/default.nix
new file mode 100644
index 000000000000..7f7393bba28e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gstreamer/libav/default.nix
@@ -0,0 +1,37 @@
+{ stdenv, fetchurl, meson, ninja, pkgconfig
+, python, yasm, gst-plugins-base, orc, bzip2
+, gettext, withSystemLibav ? true, libav ? null
+}:
+
+# Note that since gst-libav-1.6, libav is actually ffmpeg. See
+# https://gstreamer.freedesktop.org/releases/1.6/ for more info.
+
+assert withSystemLibav -> libav != null;
+
+stdenv.mkDerivation rec {
+  name = "gst-libav-${version}";
+  version = "1.14.4";
+
+  meta = {
+    homepage = https://gstreamer.freedesktop.org;
+    license = stdenv.lib.licenses.lgpl2Plus;
+    platforms = stdenv.lib.platforms.unix;
+  };
+
+  src = fetchurl {
+    url = "${meta.homepage}/src/gst-libav/${name}.tar.xz";
+    sha256 = "1nk5g24z2xx5kaw5cg8dv8skdc516inahmkymcz8bxqxj28qbmyz";
+  };
+
+  outputs = [ "out" "dev" ];
+
+  nativeBuildInputs = with stdenv.lib;
+    [ meson ninja gettext pkgconfig python ]
+    ++ optional (!withSystemLibav) yasm
+    ;
+
+  buildInputs = with stdenv.lib;
+    [ gst-plugins-base orc bzip2 ]
+    ++ optional withSystemLibav libav
+    ;
+}
diff --git a/nixpkgs/pkgs/development/libraries/gstreamer/qt-gstreamer/default.nix b/nixpkgs/pkgs/development/libraries/gstreamer/qt-gstreamer/default.nix
new file mode 100644
index 000000000000..a099643061a1
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gstreamer/qt-gstreamer/default.nix
@@ -0,0 +1,32 @@
+{ stdenv, fetchurl, fetchpatch, gst_all_1, boost, glib, qt4, cmake
+, automoc4, flex, bison, pkgconfig }:
+
+stdenv.mkDerivation rec {
+  name = "${pname}-1.2.0";
+  pname = "qt-gstreamer";
+
+  src = fetchurl {
+    url = "https://gstreamer.freedesktop.org/src/${pname}/${name}.tar.xz";
+    sha256 = "9f3b492b74cad9be918e4c4db96df48dab9c012f2ae5667f438b64a4d92e8fd4";
+  };
+
+  patches = [
+    (fetchpatch {
+      url = "https://cgit.freedesktop.org/gstreamer/qt-gstreamer/patch/?id=e2ca8094aa8d0eac1c3a98df66fe94ce0c754088";
+      sha256 = "1qps0nlc26d74wk8h96xl5s3d9qrdx6c0ph0zpl1dnc691lgyf6s";
+    })
+  ];
+
+  outputs = [ "out" "dev" ];
+
+  buildInputs = [ gst_all_1.gstreamer gst_all_1.gst-plugins-base glib qt4 ];
+  propagatedBuildInputs = [ boost ];
+  nativeBuildInputs = [ cmake automoc4 flex bison pkgconfig ];
+
+  cmakeFlags = "-DUSE_QT_PLUGIN_DIR=OFF -DUSE_GST_PLUGIN_DIR=OFF";
+
+  meta = with stdenv.lib; {
+    platforms = platforms.linux;
+    license = licenses.lgpl21;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gstreamer/rtsp-server/default.nix b/nixpkgs/pkgs/development/libraries/gstreamer/rtsp-server/default.nix
new file mode 100644
index 000000000000..6236edec6a40
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gstreamer/rtsp-server/default.nix
@@ -0,0 +1,30 @@
+{ stdenv, fetchurl, meson, ninja, pkgconfig
+, gst-plugins-base, gettext, gobject-introspection
+}:
+
+stdenv.mkDerivation rec {
+  name = "gst-rtsp-server-${version}";
+  version = "1.14.4";
+
+  meta = with stdenv.lib; {
+    description = "Gstreamer RTSP server";
+    homepage    = "https://gstreamer.freedesktop.org";
+    longDescription = ''
+      a library on top of GStreamer for building an RTSP server.
+    '';
+    license     = licenses.lgpl2Plus;
+    platforms   = platforms.linux ++ platforms.darwin;
+    maintainers = with maintainers; [ bkchr ];
+  };
+
+  src = fetchurl {
+    url = "${meta.homepage}/src/gst-rtsp-server/${name}.tar.xz";
+    sha256 = "1wc4d0y57hpfvv9sykjg8mxj86dw60mf696fbqbiqq6dzlmcw3ix";
+  };
+
+  outputs = [ "out" "dev" ];
+
+  nativeBuildInputs = [ meson ninja gettext gobject-introspection pkgconfig ];
+
+  buildInputs = [ gst-plugins-base ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/gstreamer/ugly/default.nix b/nixpkgs/pkgs/development/libraries/gstreamer/ugly/default.nix
new file mode 100644
index 000000000000..0cdfd1f4a7b6
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gstreamer/ugly/default.nix
@@ -0,0 +1,44 @@
+{ stdenv, fetchurl, meson, ninja, pkgconfig, python
+, gst-plugins-base, orc, gettext
+, a52dec, libcdio, libdvdread
+, libmad, libmpeg2, x264, libintl, lib
+, darwin
+}:
+
+stdenv.mkDerivation rec {
+  name = "gst-plugins-ugly-${version}";
+  version = "1.14.4";
+
+  meta = with lib; {
+    description = "Gstreamer Ugly Plugins";
+    homepage    = "https://gstreamer.freedesktop.org";
+    longDescription = ''
+      a set of plug-ins that have good quality and correct functionality,
+      but distributing them might pose problems.  The license on either
+      the plug-ins or the supporting libraries might not be how we'd
+      like. The code might be widely known to present patent problems.
+    '';
+    license     = licenses.lgpl2Plus;
+    platforms   = platforms.unix;
+    maintainers = with maintainers; [ matthewbauer ];
+  };
+
+  src = fetchurl {
+    url = "${meta.homepage}/src/gst-plugins-ugly/${name}.tar.xz";
+    sha256 = "08vd1xgwmapnviah47zv5h2r02qdd20y4f07rvv5zhv6y4vxh0mc";
+  };
+
+  outputs = [ "out" "dev" ];
+
+  nativeBuildInputs = [ meson ninja gettext pkgconfig python ];
+
+  buildInputs = [
+    gst-plugins-base orc
+    a52dec libcdio libdvdread
+    libmad libmpeg2 x264
+    libintl
+  ] ++ lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks;
+    [ IOKit CoreFoundation DiskArbitration ]);
+
+  NIX_LDFLAGS = [ "-lm" ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/gstreamer/vaapi/default.nix b/nixpkgs/pkgs/development/libraries/gstreamer/vaapi/default.nix
new file mode 100644
index 000000000000..e84f8dce9125
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gstreamer/vaapi/default.nix
@@ -0,0 +1,36 @@
+{ stdenv, fetchurl, meson, ninja, pkgconfig, gst-plugins-base, bzip2, libva, wayland
+, libdrm, udev, xorg, libGLU_combined, gstreamer, gst-plugins-bad, nasm
+, libvpx, python
+}:
+
+stdenv.mkDerivation rec {
+  name = "gst-vaapi-${version}";
+  version = "1.14.4";
+
+  src = fetchurl {
+    url = "${meta.homepage}/src/gstreamer-vaapi/gstreamer-vaapi-${version}.tar.xz";
+    sha256 = "18yha6119v7mwz47idv2vykzfssqfmh6hc824wqqsshwjvzdn66f";
+  };
+
+  outputs = [ "out" "dev" ];
+
+  nativeBuildInputs = [ meson ninja pkgconfig bzip2 ];
+
+  buildInputs = [
+    gstreamer gst-plugins-base gst-plugins-bad libva wayland libdrm udev
+    xorg.libX11 xorg.libXext xorg.libXv xorg.libXrandr xorg.libSM
+    xorg.libICE libGLU_combined nasm libvpx python
+  ];
+
+  preConfigure = ''
+    export GST_PLUGIN_PATH_1_0=$out/lib/gstreamer-1.0
+    mkdir -p $GST_PLUGIN_PATH_1_0
+  '';
+
+  meta = {
+    homepage = https://gstreamer.freedesktop.org;
+    license = stdenv.lib.licenses.lgpl21Plus;
+    platforms = stdenv.lib.platforms.linux;
+    maintainers = with stdenv.lib.maintainers; [ tstrobel ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gstreamer/validate/default.nix b/nixpkgs/pkgs/development/libraries/gstreamer/validate/default.nix
new file mode 100644
index 000000000000..916185bf7ecf
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gstreamer/validate/default.nix
@@ -0,0 +1,34 @@
+{ stdenv, fetchurl, pkgconfig, gstreamer, gst-plugins-base
+, python, gobject-introspection, json-glib
+}:
+
+stdenv.mkDerivation rec {
+  name = "gst-validate-${version}";
+  version = "1.14.4";
+
+  meta = {
+    description = "Integration testing infrastructure for the GStreamer framework";
+    homepage = https://gstreamer.freedesktop.org;
+    license = stdenv.lib.licenses.lgpl2Plus;
+    platforms = stdenv.lib.platforms.unix;
+  };
+
+  src = fetchurl {
+    url = "${meta.homepage}/src/gst-validate/${name}.tar.xz";
+    sha256 = "1ismv4i7ldi04swq76pcpd5apxqd52yify5hvlyan2yw9flwrp0q";
+  };
+
+  outputs = [ "out" "dev" ];
+
+  nativeBuildInputs = [
+    pkgconfig gobject-introspection
+  ];
+
+  buildInputs = [
+    python json-glib
+  ];
+
+  propagatedBuildInputs = [ gstreamer gst-plugins-base ];
+
+  enableParallelBuilding = true;
+}
diff --git a/nixpkgs/pkgs/development/libraries/gtdialog/default.nix b/nixpkgs/pkgs/development/libraries/gtdialog/default.nix
new file mode 100644
index 000000000000..d0a2d3691b49
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gtdialog/default.nix
@@ -0,0 +1,33 @@
+{stdenv, fetchurl, cdk, unzip, gtk2, glib, ncurses, pkgconfig}:
+let
+  s = # Generated upstream information
+  rec {
+    baseName="gtdialog";
+    version="1.4";
+    name="${baseName}-${version}";
+    hash="1lhsaz56s8m838fi6vnfcd2r6djymvy3n2pbqhii88hraapq3rfk";
+    url="https://foicica.com/gtdialog/download/gtdialog_1.4.zip";
+    sha256="1lhsaz56s8m838fi6vnfcd2r6djymvy3n2pbqhii88hraapq3rfk";
+  };
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [
+    cdk unzip gtk2 glib ncurses
+  ];
+in
+stdenv.mkDerivation {
+  inherit (s) name version;
+  inherit nativeBuildInputs buildInputs;
+  src = fetchurl {
+    inherit (s) url sha256;
+  };
+  makeFlags = ["PREFIX=$(out)"];
+  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;
+    homepage = http://foicica.com/gtdialog;
+    downloadPage = "http://foicica.com/gtdialog/download";
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gtdialog/default.upstream b/nixpkgs/pkgs/development/libraries/gtdialog/default.upstream
new file mode 100644
index 000000000000..b9cbcf4c5c75
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gtdialog/default.upstream
@@ -0,0 +1,3 @@
+url http://foicica.com/gtdialog/download
+version_link '[.]zip$'
+version '.*_([0-9.]*)[.]zip' '\1'
diff --git a/nixpkgs/pkgs/development/libraries/gtest/default.nix b/nixpkgs/pkgs/development/libraries/gtest/default.nix
new file mode 100644
index 000000000000..9ceb571983e2
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gtest/default.nix
@@ -0,0 +1,32 @@
+{ stdenv, cmake, ninja, fetchFromGitHub
+, static ? false }:
+
+stdenv.mkDerivation rec {
+  name = "gtest-${version}";
+  version = "1.8.1";
+
+  outputs = [ "out" "dev" ];
+
+  src = fetchFromGitHub {
+    owner = "google";
+    repo = "googletest";
+    rev = "release-${version}";
+    sha256 = "0270msj6n7mggh4xqqjp54kswbl7mkcc8px1p5dqdpmw5ngh9fzk";
+  };
+
+  patches = [
+    ./fix-cmake-config-includedir.patch
+  ];
+
+  nativeBuildInputs = [ cmake ninja ];
+
+  cmakeFlags = stdenv.lib.optional (!static) "-DBUILD_SHARED_LIBS=ON";
+
+  meta = with stdenv.lib; {
+    description = "Google's framework for writing C++ tests";
+    homepage = https://github.com/google/googletest;
+    license = licenses.bsd3;
+    platforms = platforms.all;
+    maintainers = with maintainers; [ zoomulator ivan-tkatchev ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gtest/fix-cmake-config-includedir.patch b/nixpkgs/pkgs/development/libraries/gtest/fix-cmake-config-includedir.patch
new file mode 100644
index 000000000000..c05e3a9326ae
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gtest/fix-cmake-config-includedir.patch
@@ -0,0 +1,30 @@
+--- a/googlemock/CMakeLists.txt
++++ b/googlemock/CMakeLists.txt
+@@ -106,10 +106,10 @@
+ if (DEFINED CMAKE_VERSION AND NOT "${CMAKE_VERSION}" VERSION_LESS "2.8.11")
+   target_include_directories(gmock SYSTEM INTERFACE
+     "$<BUILD_INTERFACE:${gmock_build_include_dirs}>"
+-    "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/${CMAKE_INSTALL_INCLUDEDIR}>")
++    "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>")
+   target_include_directories(gmock_main SYSTEM INTERFACE
+     "$<BUILD_INTERFACE:${gmock_build_include_dirs}>"
+-    "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/${CMAKE_INSTALL_INCLUDEDIR}>")
++    "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>")
+ endif()
+ 
+ ########################################################################
+--- a/googletest/CMakeLists.txt
++++ b/googletest/CMakeLists.txt
+@@ -126,10 +126,10 @@
+ if (DEFINED CMAKE_VERSION AND NOT "${CMAKE_VERSION}" VERSION_LESS "2.8.11")
+   target_include_directories(gtest SYSTEM INTERFACE
+     "$<BUILD_INTERFACE:${gtest_build_include_dirs}>"
+-    "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/${CMAKE_INSTALL_INCLUDEDIR}>")
++    "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>")
+   target_include_directories(gtest_main SYSTEM INTERFACE
+     "$<BUILD_INTERFACE:${gtest_build_include_dirs}>"
+-    "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/${CMAKE_INSTALL_INCLUDEDIR}>")
++    "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>")
+ endif()
+ target_link_libraries(gtest_main PUBLIC gtest)
+ 
diff --git a/nixpkgs/pkgs/development/libraries/gtk+/2.0-darwin-x11.patch b/nixpkgs/pkgs/development/libraries/gtk+/2.0-darwin-x11.patch
new file mode 100644
index 000000000000..9725cfb84260
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gtk+/2.0-darwin-x11.patch
@@ -0,0 +1,22 @@
+--- a/gdk/x11/gdkapplaunchcontext-x11.c
++++ b/gdk/x11/gdkapplaunchcontext-x11.c
+@@ -26,7 +26,6 @@
+ #include <unistd.h>
+ 
+ #include <glib.h>
+-#include <gio/gdesktopappinfo.h>
+ 
+ #include "gdkx.h"
+ #include "gdkapplaunchcontext.h"
+@@ -363,10 +362,7 @@
+   else
+     workspace_str = NULL;
+ 
+-  if (G_IS_DESKTOP_APP_INFO (info))
+-    application_id = g_desktop_app_info_get_filename (G_DESKTOP_APP_INFO (info));
+-  else
+-    application_id = NULL;
++  application_id = NULL;
+ 
+   startup_id = g_strdup_printf ("%s-%lu-%s-%s-%d_TIME%lu",
+                                 g_get_prgname (),
diff --git a/nixpkgs/pkgs/development/libraries/gtk+/2.0-immodules.cache.patch b/nixpkgs/pkgs/development/libraries/gtk+/2.0-immodules.cache.patch
new file mode 100644
index 000000000000..1b8231756e71
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gtk+/2.0-immodules.cache.patch
@@ -0,0 +1,27 @@
+--- a/gtk/gtkrc.c	2014-09-30 05:02:17.000000000 +0900
++++ b/gtk/gtkrc.c	2016-04-09 17:39:51.363288355 +0900
+@@ -445,5 +445,23 @@
+   if (var)
+     result = g_strdup (var);
+ 
++  // check NIX_PROFILES paths.
++  const gchar *nixProfilesEnv = g_getenv ("NIX_PROFILES");
++  gchar *cachePath;
++  guint i;
++
++  if(nixProfilesEnv && !result){
++    gchar **paths = g_strsplit(nixProfilesEnv, " ", -1);
++    for (i = 0; paths[i] != NULL; i++){
++      cachePath = g_build_filename(paths[i], "etc", "gtk-2.0", "immodules.cache", NULL);
++      if( g_file_test( cachePath, G_FILE_TEST_EXISTS) ){
++        if(result) g_free(result);
++        result = g_strdup(cachePath);
++      }
++      g_free(cachePath);
++    }
++    g_strfreev(paths);
++  }
++
+   if (!result)
+     {
+
diff --git a/nixpkgs/pkgs/development/libraries/gtk+/2.x.nix b/nixpkgs/pkgs/development/libraries/gtk+/2.x.nix
new file mode 100644
index 000000000000..8dad69eb998a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gtk+/2.x.nix
@@ -0,0 +1,96 @@
+{ config, stdenv, fetchurl, pkgconfig, gettext, glib, atk, pango, cairo, perl, xorg
+, gdk_pixbuf, xlibsWrapper, gobject-introspection
+, xineramaSupport ? stdenv.isLinux
+, cupsSupport ? config.gtk2.cups or stdenv.isLinux, cups ? null
+, gdktarget ? if stdenv.isDarwin then "quartz" else "x11"
+, AppKit, Cocoa
+, fetchpatch
+}:
+
+assert xineramaSupport -> xorg.libXinerama != null;
+assert cupsSupport -> cups != null;
+
+with stdenv.lib;
+
+stdenv.mkDerivation rec {
+  name = "gtk+-2.24.32";
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/gtk+/2.24/${name}.tar.xz";
+    sha256 = "b6c8a93ddda5eabe3bfee1eb39636c9a03d2a56c7b62828b359bf197943c582e";
+  };
+
+  outputs = [ "out" "dev" "devdoc" ];
+  outputBin = "dev";
+
+  enableParallelBuilding = true;
+
+  setupHook = ./setup-hook.sh;
+
+  nativeBuildInputs = [ setupHook perl pkgconfig gettext gobject-introspection ];
+
+  patches = [
+    ./2.0-immodules.cache.patch
+    ./gtk2-theme-paths.patch
+  ] ++ optionals stdenv.isDarwin [
+    (fetchpatch {
+      url = https://bug557780.bugzilla-attachments.gnome.org/attachment.cgi?id=306776;
+      sha256 = "0sp8f1r5c4j2nlnbqgv7s7nxa4cfwigvm033hvhb1ld652pjag4r";
+    })
+    ./2.0-darwin-x11.patch
+  ];
+
+  propagatedBuildInputs = with xorg;
+    [ glib cairo pango gdk_pixbuf atk ]
+    ++ optionals (stdenv.isLinux || stdenv.isDarwin) [
+         libXrandr libXrender libXcomposite libXi libXcursor
+       ]
+    ++ optionals stdenv.isDarwin [ xlibsWrapper libXdamage ]
+    ++ optional xineramaSupport libXinerama
+    ++ optionals cupsSupport [ cups ]
+    ++ optionals stdenv.isDarwin [ AppKit Cocoa ];
+
+  configureFlags = [
+    "--with-gdktarget=${gdktarget}"
+    "--with-xinput=yes"
+  ] ++ optionals stdenv.isDarwin [
+    "--disable-glibtest"
+    "--disable-introspection"
+    "--disable-visibility"
+  ];
+
+  doCheck = false; # needs X11
+
+  postInstall = ''
+    moveToOutput share/gtk-2.0/demo "$devdoc"
+    # The updater is needed for nixos env and it's tiny.
+    moveToOutput bin/gtk-update-icon-cache "$out"
+  '';
+
+  passthru = {
+    gtkExeEnvPostBuild = ''
+      rm $out/lib/gtk-2.0/2.10.0/immodules.cache
+      $out/bin/gtk-query-immodules-2.0 $out/lib/gtk-2.0/2.10.0/immodules/*.so > $out/lib/gtk-2.0/2.10.0/immodules.cache
+    ''; # workaround for bug of nix-mode for Emacs */ '';
+    inherit gdktarget;
+  };
+
+  meta = {
+    description = "A multi-platform toolkit for creating graphical user interfaces";
+    homepage    = https://www.gtk.org/;
+    license     = licenses.lgpl2Plus;
+    maintainers = with maintainers; [ lovek323 raskin ];
+    platforms   = platforms.all;
+
+    longDescription = ''
+      GTK+ is a highly usable, feature rich toolkit for creating
+      graphical user interfaces which boasts cross platform
+      compatibility and an easy to use API.  GTK+ it is written in C,
+      but has bindings to many other popular programming languages
+      such as C++, Python and C# among others.  GTK+ is licensed
+      under the GNU LGPL 2.1 allowing development of both free and
+      proprietary software with GTK+ without any license fees or
+      royalties.
+    '';
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gtk+/3.0-darwin-x11.patch b/nixpkgs/pkgs/development/libraries/gtk+/3.0-darwin-x11.patch
new file mode 100644
index 000000000000..86631634b5bd
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gtk+/3.0-darwin-x11.patch
@@ -0,0 +1,28 @@
+--- a/gdk/x11/gdkapplaunchcontext-x11.c
++++ b/gdk/x11/gdkapplaunchcontext-x11.c
+@@ -27,7 +27,9 @@
+ #include "gdkprivate-x11.h"
+ 
+ #include <glib.h>
++#if defined(HAVE_GIO_UNIX) && !defined(__APPLE__)
+ #include <gio/gdesktopappinfo.h>
++#endif
+ 
+ #include <string.h>
+ #include <unistd.h>
+@@ -352,10 +354,15 @@
+   else
+     workspace_str = NULL;
+ 
++#if defined(HAVE_GIO_UNIX) && !defined(__APPLE__)
+   if (G_IS_DESKTOP_APP_INFO (info))
+     application_id = g_desktop_app_info_get_filename (G_DESKTOP_APP_INFO (info));
+   else
+     application_id = NULL;
++#else
++  application_id = NULL;
++#warning Please add support for creating AppInfo from id for your OS
++#endif
+ 
+   startup_id = g_strdup_printf ("%s-%lu-%s-%s-%d_TIME%lu",
+                                 g_get_prgname (),
diff --git a/nixpkgs/pkgs/development/libraries/gtk+/3.0-immodules.cache.patch b/nixpkgs/pkgs/development/libraries/gtk+/3.0-immodules.cache.patch
new file mode 100644
index 000000000000..bbe5f28dbd3e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gtk+/3.0-immodules.cache.patch
@@ -0,0 +1,27 @@
+--- a/gtk/deprecated/gtkrc.c	2016-04-02 18:43:08.401663112 +0900
++++ b/gtk/deprecated/gtkrc.c	2016-04-02 18:29:19.927608592 +0900
+@@ -774,5 +774,23 @@
+   if (var)
+     result = g_strdup (var);
+ 
++  // check NIX_PROFILES paths.
++  const gchar *nixProfilesEnv = g_getenv ("NIX_PROFILES");
++  gchar *cachePath;
++  guint i;
++
++  if(nixProfilesEnv && !result){
++    gchar **paths = g_strsplit(nixProfilesEnv, " ", -1);
++    for (i = 0; paths[i] != NULL; i++){
++      cachePath = g_build_filename(paths[i], "etc", "gtk-3.0", "immodules.cache", NULL);
++      if( g_file_test( cachePath, G_FILE_TEST_EXISTS) ){
++        if(result) g_free(result);
++        result = g_strdup(cachePath);
++      }
++      g_free(cachePath);
++    }
++    g_strfreev(paths);
++  }
++
+   if (!result)
+     {
+ 
diff --git a/nixpkgs/pkgs/development/libraries/gtk+/3.x.nix b/nixpkgs/pkgs/development/libraries/gtk+/3.x.nix
new file mode 100644
index 000000000000..30b33c7aea97
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gtk+/3.x.nix
@@ -0,0 +1,117 @@
+{ stdenv, fetchurl, fetchpatch, pkgconfig, gettext, perl, makeWrapper, shared-mime-info, isocodes
+, expat, glib, cairo, pango, gdk_pixbuf, atk, at-spi2-atk, gobject-introspection, fribidi
+, xorg, epoxy, json-glib, libxkbcommon, gmp, gnome3, autoreconfHook, gsettings-desktop-schemas
+, x11Support ? stdenv.isLinux
+, waylandSupport ? stdenv.isLinux, mesa_noglu, wayland, wayland-protocols
+, xineramaSupport ? stdenv.isLinux
+, cupsSupport ? stdenv.isLinux, cups ? null
+, AppKit, Cocoa
+}:
+
+assert cupsSupport -> cups != null;
+
+with stdenv.lib;
+
+let
+  version = "3.24.8";
+in
+stdenv.mkDerivation rec {
+  name = "gtk+3-${version}";
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/gtk+/${stdenv.lib.versions.majorMinor version}/gtk+-${version}.tar.xz";
+    sha256 = "16f71bbkhwhndcsrpyhjia3b77cb5ksf5c45lyfgws4pkgg64sb6";
+  };
+
+  outputs = [ "out" "dev" ];
+  outputBin = "dev";
+
+  nativeBuildInputs = [ pkgconfig gettext gobject-introspection perl makeWrapper autoreconfHook ];
+
+  patches = [
+    ./3.0-immodules.cache.patch
+    (fetchpatch {
+      name = "Xft-setting-fallback-compute-DPI-properly.patch";
+      url = "https://bug757142.bugzilla-attachments.gnome.org/attachment.cgi?id=344123";
+      sha256 = "0g6fhqcv8spfy3mfmxpyji93k8d4p4q4fz1v9a1c1cgcwkz41d7p";
+    })
+  ] ++ optionals stdenv.isDarwin [
+    # X11 module requires <gio/gdesktopappinfo.h> which is not installed on Darwin
+    # let’s drop that dependency in similar way to how other parts of the library do it
+    # e.g. https://gitlab.gnome.org/GNOME/gtk/blob/3.24.4/gtk/gtk-launch.c#L31-33
+    ./3.0-darwin-x11.patch
+  ];
+
+  buildInputs = [ libxkbcommon epoxy json-glib isocodes ]
+    ++ optional stdenv.isDarwin AppKit;
+  propagatedBuildInputs = with xorg; with stdenv.lib;
+    [ expat glib cairo pango gdk_pixbuf atk at-spi2-atk gsettings-desktop-schemas fribidi
+      libXrandr libXrender libXcomposite libXi libXcursor libSM libICE ]
+    ++ optional stdenv.isDarwin Cocoa  # explicitly propagated, always needed
+    ++ optionals waylandSupport [ mesa_noglu wayland wayland-protocols ]
+    ++ optional xineramaSupport libXinerama
+    ++ optional cupsSupport cups;
+  #TODO: colord?
+
+  # demos fail to install, no idea where's the problem
+  preConfigure = "sed '/^SRC_SUBDIRS /s/demos//' -i Makefile.in";
+
+  enableParallelBuilding = true;
+
+  configureFlags = optional stdenv.isDarwin [
+    "--disable-debug"
+    "--disable-dependency-tracking"
+    "--disable-glibtest"
+  ] ++ optional (stdenv.isDarwin && !x11Support)
+    "--enable-quartz-backend"
+    ++ optional x11Support [
+    "--enable-x11-backend"
+  ] ++ optional waylandSupport [
+    "--enable-wayland-backend"
+  ];
+
+  doCheck = false; # needs X11
+
+  postInstall = optionalString (!stdenv.isDarwin) ''
+    substituteInPlace "$out/lib/gtk-3.0/3.0.0/printbackends/libprintbackend-cups.la" \
+      --replace '-L${gmp.dev}/lib' '-L${gmp.out}/lib'
+    # The updater is needed for nixos env and it's tiny.
+    moveToOutput bin/gtk-update-icon-cache "$out"
+    # Launcher
+    moveToOutput bin/gtk-launch "$out"
+
+    # TODO: patch glib directly
+    for f in $dev/bin/gtk-encode-symbolic-svg; do
+      wrapProgram $f --prefix XDG_DATA_DIRS : "${shared-mime-info}/share"
+    done
+  '';
+
+  passthru = {
+    updateScript = gnome3.updateScript {
+      packageName = "gtk+";
+      attrPath = "gtk3";
+    };
+  };
+
+  meta = with stdenv.lib; {
+    description = "A multi-platform toolkit for creating graphical user interfaces";
+
+    longDescription = ''
+      GTK+ is a highly usable, feature rich toolkit for creating
+      graphical user interfaces which boasts cross platform
+      compatibility and an easy to use API.  GTK+ it is written in C,
+      but has bindings to many other popular programming languages
+      such as C++, Python and C# among others.  GTK+ is licensed
+      under the GNU LGPL 2.1 allowing development of both free and
+      proprietary software with GTK+ without any license fees or
+      royalties.
+    '';
+
+    homepage = https://www.gtk.org/;
+
+    license = licenses.lgpl2Plus;
+
+    maintainers = with maintainers; [ raskin vcunat lethalman ];
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gtk+/gtk2-theme-paths.patch b/nixpkgs/pkgs/development/libraries/gtk+/gtk2-theme-paths.patch
new file mode 100644
index 000000000000..edd69b078076
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gtk+/gtk2-theme-paths.patch
@@ -0,0 +1,40 @@
+Subject: [PATCHv2] gtk: Patch GTK+ to look for themes in profiles.
+To: guix-devel@gnu.org
+Date: Sun, 13 Mar 2016 15:17:37 +1100
+Url: https://lists.gnu.org/archive/html/guix-devel/2016-03/msg00492.html
+
+diff -Naur gtk+-2.24.28.new/gtk/gtkrc.c gtk+-2.24.28/gtk/gtkrc.c
+--- gtk+-2.24.28.new/gtk/gtkrc.c	2016-03-13 10:31:14.413644362 +1100
++++ gtk+-2.24.28/gtk/gtkrc.c	2016-03-13 12:51:34.723398423 +1100
+@@ -808,6 +808,8 @@
+   gchar *path = NULL;
+   const gchar *home_dir;
+   gchar *subpath;
++  const gchar * const *xdg_data_dirs;
++  gint i;
+ 
+   if (type)
+     subpath = g_strconcat ("gtk-2.0-", type,
+@@ -830,6 +832,22 @@
+     }
+ 
+   if (!path)
++    {
++      xdg_data_dirs = g_get_system_data_dirs ();
++      for (i = 0; xdg_data_dirs[i]; i++)
++        {
++          path = g_build_filename (xdg_data_dirs[i], "themes", name, subpath, NULL);
++          if (g_file_test (path, G_FILE_TEST_EXISTS))
++            break;
++          else
++            {
++              g_free (path);
++              path = NULL;
++            }
++        }
++    }
++
++  if (!path)
+     {
+       gchar *theme_dir = gtk_rc_get_theme_dir ();
+       path = g_build_filename (theme_dir, name, subpath, NULL);
diff --git a/nixpkgs/pkgs/development/libraries/gtk+/setup-hook.sh b/nixpkgs/pkgs/development/libraries/gtk+/setup-hook.sh
new file mode 100644
index 000000000000..c2b0ab502db7
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gtk+/setup-hook.sh
@@ -0,0 +1,10 @@
+fixupOutputHooks+=(_gtk2CleanComments)
+
+# Clean comments that link to generator of the file
+_gtk2CleanComments() {
+    local f="$prefix/lib/gtk-2.0/2.10.0/immodules.cache"
+    if [ -f "$f" ]; then
+        sed 's|Created by .*bin/gtk-query-|Created by bin/gtk-query-|' -i "$f"
+    fi
+}
+
diff --git a/nixpkgs/pkgs/development/libraries/gtk-mac-integration/default.nix b/nixpkgs/pkgs/development/libraries/gtk-mac-integration/default.nix
new file mode 100644
index 000000000000..26d0b5c35958
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gtk-mac-integration/default.nix
@@ -0,0 +1,31 @@
+{ stdenv, lib, fetchFromGitHub, autoreconfHook, pkgconfig, glib, gtk-doc, gtk, gobject-introspection }:
+
+stdenv.mkDerivation rec {
+  name = "gtk-mac-integration-2.0.8";
+
+  src = fetchFromGitHub {
+    owner = "GNOME";
+    repo = "gtk-mac-integration";
+    rev = "79e708870cdeea24ecdb036c77b4630104ae1776";
+    sha256 = "1fbhnvj0rqc3089ypvgnpkp6ad2rr37v5qk38008dgamb9h7f3qs";
+  };
+
+  nativeBuildInputs = [ autoreconfHook pkgconfig gtk-doc gobject-introspection ];
+  buildInputs = [ glib ];
+  propagatedBuildInputs = [ gtk ];
+
+  preAutoreconf = ''
+    gtkdocize
+  '';
+
+  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;
+
+    maintainers = [ maintainers.matthewbauer ];
+    platforms = platforms.darwin;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gtk-sharp-beans/default.nix b/nixpkgs/pkgs/development/libraries/gtk-sharp-beans/default.nix
new file mode 100644
index 000000000000..7f35f088da2b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gtk-sharp-beans/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchFromGitHub, autoreconfHook, which, pkgconfig, mono, gtk-sharp-2_0, gio-sharp }:
+
+stdenv.mkDerivation rec {
+  name = "gtk-sharp-beans-${version}";
+  version = "2.14.0";
+
+  src = fetchFromGitHub {
+    owner = "mono";
+    repo = "gtk-sharp-beans";
+
+    rev = "${version}";
+    sha256 = "04sylwdllb6gazzs2m4jjfn14mil9l3cny2q0xf0zkhczzih6ah1";
+  };
+
+  nativeBuildInputs = [ pkgconfig autoreconfHook which ];
+  buildInputs = [ mono gtk-sharp-2_0 gio-sharp ];
+
+  dontStrip = true;
+
+  meta = with stdenv.lib; {
+    description = "Binds some API from Gtk+ that isn't in Gtk# 2.12.x";
+    platforms = platforms.linux;
+    license = licenses.lgpl21;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gtk-sharp/2.0.nix b/nixpkgs/pkgs/development/libraries/gtk-sharp/2.0.nix
new file mode 100644
index 000000000000..659dc14800e1
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gtk-sharp/2.0.nix
@@ -0,0 +1,71 @@
+{ stdenv
+, lib
+, fetchFromGitHub
+, pkgconfig
+, mono
+, glib
+, pango
+, gtk2
+, GConf ? null
+, libglade ? null
+, libgtkhtml ? null
+, gtkhtml ? null
+, libgnomecanvas ? null
+, libgnomeui ? null
+, libgnomeprint ? null
+, libgnomeprintui ? null
+, libxml2
+, monoDLLFixer
+, autoconf
+, automake
+, libtool
+, which
+}:
+
+stdenv.mkDerivation rec {
+  name = "gtk-sharp-${version}";
+  version = "2.12.45";
+
+  builder = ./builder.sh;
+  src = fetchFromGitHub {
+    owner = "mono";
+    repo = "gtk-sharp";
+    rev = version;
+    sha256 = "1vy6yfwkfv6bb45bzf4g6dayiqkvqqvlr02rsnhd10793hlpqlgg";
+  };
+
+  postInstall = ''
+    pushd $out/bin
+    for f in gapi2-*
+    do
+      substituteInPlace $f --replace mono ${mono}/bin/mono
+    done
+    popd
+  '';
+
+  nativeBuildInputs = [ pkgconfig autoconf automake libtool which ];
+
+  buildInputs = [
+    mono glib pango gtk2 GConf libglade libgnomecanvas
+    libgtkhtml libgnomeui libgnomeprint libgnomeprintui gtkhtml libxml2
+  ];
+
+  preConfigure = ''
+    ./bootstrap-${lib.versions.majorMinor version}
+  '';
+
+  dontStrip = true;
+
+  inherit monoDLLFixer;
+
+  passthru = {
+    gtk = gtk2;
+  };
+
+  meta = with stdenv.lib; {
+    description = "Graphical User Interface Toolkit for mono and .Net";
+    homepage = https://www.mono-project.com/docs/gui/gtksharp;
+    platforms = platforms.linux;
+    license = licenses.gpl2;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gtk-sharp/3.0.nix b/nixpkgs/pkgs/development/libraries/gtk-sharp/3.0.nix
new file mode 100644
index 000000000000..f8f1f20cc2fd
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gtk-sharp/3.0.nix
@@ -0,0 +1,52 @@
+{ stdenv, fetchurl, pkgconfig, mono
+, glib
+, pango
+, gtk3
+, GConf ? null
+, libglade ? null
+, libgtkhtml ? null
+, gtkhtml ? null
+, libgnomecanvas ? null
+, libgnomeui ? null
+, libgnomeprint ? null
+, libgnomeprintui ? null
+, libxml2
+, monoDLLFixer
+}:
+
+stdenv.mkDerivation {
+  name = "gtk-sharp-2.99.3";
+
+  builder = ./builder.sh;
+  src = fetchurl {
+    #"mirror://gnome/sources/gtk-sharp/2.99/gtk-sharp-2.99.3.tar.xz";
+    url = "http://ftp.gnome.org/pub/GNOME/sources/gtk-sharp/2.99/gtk-sharp-2.99.3.tar.xz";
+    sha256 = "18n3l9zcldyvn4lwi8izd62307mkhz873039nl6awrv285qzah34";
+  };
+
+  # patch bad usage of glib, which wasn't tolerated anymore
+  # prePatch = ''
+  #   for f in glib/glue/{thread,list,slist}.c; do
+  #     sed -i 's,#include <glib/.*\.h>,#include <glib.h>,g' "$f"
+  #   done
+  # '';
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [
+    mono glib pango gtk3 GConf libglade libgnomecanvas
+    libgtkhtml libgnomeui libgnomeprint libgnomeprintui gtkhtml libxml2
+  ];
+
+  dontStrip = true;
+
+  inherit monoDLLFixer;
+
+  passthru = {
+    inherit gtk3;
+  };
+
+  meta = {
+    platforms = stdenv.lib.platforms.linux;
+    broken = true; # 2018-09-21, build has failed since 2018-04-28
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gtk-sharp/builder.sh b/nixpkgs/pkgs/development/libraries/gtk-sharp/builder.sh
new file mode 100644
index 000000000000..4b8f757540b5
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gtk-sharp/builder.sh
@@ -0,0 +1,11 @@
+source $stdenv/setup
+
+genericBuild
+
+# !!! hack
+export ALL_INPUTS="$out $pkgs"
+
+find $out -name "*.dll.config" | while read configFile; do
+    echo "modifying config file $configFile"
+    $monoDLLFixer "$configFile"
+done
diff --git a/nixpkgs/pkgs/development/libraries/gtkd/default.nix b/nixpkgs/pkgs/development/libraries/gtkd/default.nix
new file mode 100644
index 000000000000..b69e99e0fb8a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gtkd/default.nix
@@ -0,0 +1,98 @@
+{ stdenv, fetchzip, atk, cairo, dmd, gdk_pixbuf, gnome3, gst_all_1, librsvg
+, pango, pkgconfig, which, vte }:
+
+stdenv.mkDerivation rec {
+  name = "gtkd-${version}";
+  version = "3.8.5";
+
+  src = fetchzip {
+    url = "https://gtkd.org/Downloads/sources/GtkD-${version}.zip";
+    sha256 = "12n2njsaplra7x15nqwrj2hrf8a27pfjj2mck4mkzxv03qk6mqky";
+    stripRoot = false;
+  };
+
+  nativeBuildInputs = [ dmd pkgconfig which ];
+  propagatedBuildInputs = [
+    atk cairo gdk_pixbuf glib gstreamer gst_plugins_base gtk3 gtksourceview
+    libgda libpeas librsvg pango vte
+  ];
+
+  prePatch = ''
+    substituteAll ${./paths.d} generated/gtkd/gtkd/paths.d
+    substituteInPlace src/cairo/c/functions-compiletime.d \
+      --replace libcairo.so.2 ${cairo}/lib/libcairo.so.2 \
+      --replace libcairo.dylib ${cairo}/lib/libcairo.dylib
+    substituteInPlace src/cairo/c/functions-runtime.d \
+      --replace libcairo.so.2 ${cairo}/lib/libcairo.so.2 \
+      --replace libcairo.dylib ${cairo}/lib/libcairo.dylib
+    substituteInPlace generated/gtkd/gdkpixbuf/c/functions.d \
+      --replace libgdk_pixbuf-2.0.so.0 ${gdk_pixbuf}/lib/libgdk_pixbuf-2.0.so.0 \
+      --replace libgdk_pixbuf-2.0.0.dylib ${gdk_pixbuf}/lib/libgdk_pixbuf-2.0.0.dylib
+    substituteInPlace generated/gtkd/atk/c/functions.d \
+      --replace libatk-1.0.so.0 ${atk}/lib/libatk-1.0.so.0 \
+      --replace libatk-1.0.0.dylib ${atk}/lib/libatk-1.0.0.dylib
+    substituteInPlace generated/gtkd/pango/c/functions.d \
+      --replace libpango-1.0.so.0 ${pango.out}/lib/libpango-1.0.so.0 \
+      --replace libpangocairo-1.0.so.0 ${pango.out}/lib/libpangocairo-1.0.so.0 \
+      --replace libpango-1.0.0.dylib ${pango.out}/lib/libpango-1.0.0.dylib \
+      --replace libpangocairo-1.0.0.dylib ${pango.out}/lib/libpangocairo-1.0.0.dylib
+    substituteInPlace generated/gtkd/gobject/c/functions.d \
+      --replace libgobject-2.0.so.0 ${glib.out}/lib/libgobject-2.0.so.0 \
+      --replace libgobject-2.0.0.dylib ${glib.out}/lib/libgobject-2.0.0.dylib
+    substituteInPlace generated/gtkd/rsvg/c/functions.d \
+      --replace librsvg-2.so.2 ${librsvg}/lib/librsvg-2.so.2 \
+      --replace librsvg-2.2.dylib ${librsvg}/lib/librsvg-2.2.dylib
+    substituteInPlace generated/gtkd/cairo/c/functions.d \
+      --replace libcairo.so.2 ${cairo}/lib/libcairo.so.2 \
+      --replace libcairo.dylib ${cairo}/lib/libcairo.dylib
+    substituteInPlace generated/gtkd/gdk/c/functions.d \
+      --replace libgdk-3.so.0 ${gtk3}/lib/libgdk-3.so.0 \
+      --replace libgdk-3.0.dylib ${gtk3}/lib/libgdk-3.0.dylib
+    substituteInPlace generated/peas/peas/c/functions.d \
+      --replace libpeas-1.0.so.0 ${libpeas}/lib/libpeas-1.0.so.0 \
+      --replace libpeas-gtk-1.0.so.0 ${libpeas}/lib/libpeas-gtk-1.0.so.0 \
+      --replace libpeas-1.0.0.dylib ${libpeas}/lib/libpeas-1.0.0.dylib \
+      --replace gtk-1.0.0.dylib ${libpeas}/lib/gtk-1.0.0.dylib
+    substituteInPlace generated/vte/vte/c/functions.d \
+      --replace libvte-2.91.so.0 ${vte}/lib/libvte-2.91.so.0 \
+      --replace libvte-2.91.0.dylib ${vte}/lib/libvte-2.91.0.dylib
+    substituteInPlace generated/gstreamer/gstinterfaces/c/functions.d \
+      --replace libgstvideo-1.0.so.0 ${gst_plugins_base}/lib/libgstvideo-1.0.so.0 \
+      --replace libgstvideo-1.0.0.dylib ${gst_plugins_base}/lib/libgstvideo-1.0.0.dylib
+    substituteInPlace generated/sourceview/gsv/c/functions.d \
+      --replace libgtksourceview-3.0.so.1 ${gtksourceview}/lib/libgtksourceview-3.0.so.1 \
+      --replace libgtksourceview-3.0.1.dylib ${gtksourceview}/lib/libgtksourceview-3.0.1.dylib
+    substituteInPlace generated/gtkd/glib/c/functions.d \
+      --replace libglib-2.0.so.0 ${glib.out}/lib/libglib-2.0.so.0 \
+      --replace libgmodule-2.0.so.0 ${glib.out}/lib/libgmodule-2.0.so.0 \
+      --replace libgobject-2.0.so.0 ${glib.out}/lib/libgobject-2.0.so.0 \
+      --replace libglib-2.0.0.dylib ${glib.out}/lib/libglib-2.0.0.dylib \
+      --replace libgmodule-2.0.0.dylib ${glib.out}/lib/libgmodule-2.0.0.dylib \
+      --replace libgobject-2.0.0.dylib ${glib.out}/lib/libgobject-2.0.0.dylib
+    substituteInPlace generated/gtkd/gio/c/functions.d \
+      --replace libgio-2.0.so.0 ${glib.out}/lib/libgio-2.0.so.0 \
+      --replace libgio-2.0.0.dylib ${glib.out}/lib/libgio-2.0.0.dylib
+    substituteInPlace generated/gstreamer/gstreamer/c/functions.d \
+      --replace libgstreamer-1.0.so.0 ${gstreamer}/lib/libgstreamer-1.0.so.0 \
+      --replace libgstreamer-1.0.0.dylib ${gstreamer}/lib/libgstreamer-1.0.0.dylib
+    substituteInPlace generated/gtkd/gtk/c/functions.d \
+      --replace libgdk-3.so.0 ${gtk3}/lib/libgdk-3.so.0 \
+      --replace libgtk-3.so.0 ${gtk3}/lib/libgtk-3.so.0 \
+      --replace libgdk-3.0.dylib ${gtk3}/lib/libgdk-3.0.dylib \
+      --replace libgtk-3.0.dylib ${gtk3}/lib/libgtk-3.0.dylib
+  '';
+
+  installFlags = "prefix=$(out)";
+
+  inherit atk cairo gdk_pixbuf librsvg pango;
+  inherit (gnome3) glib gtk3 gtksourceview libgda libpeas;
+  inherit (gst_all_1) gstreamer;
+  gst_plugins_base = gst_all_1.gst-plugins-base;
+
+  meta = with stdenv.lib; {
+    description = "D binding and OO wrapper for GTK+";
+    homepage = https://gtkd.org;
+    license = licenses.lgpl3Plus;
+    platforms = platforms.linux ++ platforms.darwin;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gtkd/paths.d b/nixpkgs/pkgs/development/libraries/gtkd/paths.d
new file mode 100644
index 000000000000..0f857136499f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gtkd/paths.d
@@ -0,0 +1,142 @@
+/*
+ * gtkD is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version, with
+ * some exceptions, please read the COPYING file.
+ *
+ * gtkD is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with gtkD; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
+ *
+ * paths.d  -- list of libraries that will be dynamically linked with gtkD
+ *
+ * Added:	John Reimer	-- 2004-12-20
+ * Updated: 2005-02-21 changed names; added version(linux)
+ * Updated: 2005-05-05 updated Linux support
+ * Updated: 2008-02-16 Tango support
+ */
+
+module gtkd.paths;
+
+/*
+ * Define the Libraries that gtkD will be using.
+ *   This is a growable list, as long as the programmer
+ *   also adds to the importLibs list.
+ */
+
+enum LIBRARY
+{
+	ATK,
+	CAIRO,
+	GDK,
+	GDKPIXBUF,
+	GLIB,
+	GMODULE,
+	GOBJECT,
+	GIO,
+	GTHREAD,
+	GTK,
+	PANGO,
+	PANGOCAIRO,
+	GLGDK,
+	GLGTK,
+	GDA,
+	GSV,
+	GSV1,
+	GSTREAMER,
+	GSTINTERFACES,
+	VTE,
+	PEAS,
+	RSVG,
+}
+
+version (Windows)
+{
+	const string[LIBRARY.max+1] importLibs =
+	[
+		LIBRARY.ATK:           "libatk-1.0-0.dll",
+		LIBRARY.CAIRO:         "libcairo-2.dll",
+		LIBRARY.GDK:           "libgdk-3-0.dll",
+		LIBRARY.GDKPIXBUF:     "libgdk_pixbuf-2.0-0.dll",
+		LIBRARY.GLIB:          "libglib-2.0-0.dll",
+		LIBRARY.GMODULE:       "libgmodule-2.0-0.dll",
+		LIBRARY.GOBJECT:       "libgobject-2.0-0.dll",
+		LIBRARY.GIO:           "libgio-2.0-0.dll",
+		LIBRARY.GTHREAD:       "libgthread-2.0-0.dll",
+		LIBRARY.GTK:           "libgtk-3-0.dll",
+		LIBRARY.PANGO:         "libpango-1.0-0.dll",
+		LIBRARY.PANGOCAIRO:    "libpangocairo-1.0-0.dll",
+		LIBRARY.GLGDK:         "libgdkglext-3.0-0.dll",
+		LIBRARY.GLGTK:         "libgtkglext-3.0-0.dll",
+		LIBRARY.GDA:           "libgda-4.0-4.dll",
+		LIBRARY.GSV:           "libgtksourceview-3.0-0.dll",
+		LIBRARY.GSV1:          "libgtksourceview-3.0-1.dll",
+		LIBRARY.GSTREAMER:     "libgstreamer-1.0.dll",
+		LIBRARY.GSTINTERFACES: "libgstvideo-1.0.dll",
+		LIBRARY.VTE:           "libvte-2.91.dll",
+		LIBRARY.PEAS:          "libpeas-1.0.dll",
+		LIBRARY.RSVG:          "librsvg-2-2.dll",
+	];
+}
+else version(darwin)
+{
+	const string[LIBRARY.max+1] importLibs =
+	[
+		LIBRARY.ATK:           "@atk@/lib/libatk-1.0.dylib",
+		LIBRARY.CAIRO:         "@cairo@/lib/libcairo.dylib",
+		LIBRARY.GDK:           "@gtk3@/lib/libgdk-3.0.dylib",
+		LIBRARY.GDKPIXBUF:     "@gdk_pixbuf@/lib/libgdk_pixbuf-2.0.dylib",
+		LIBRARY.GLIB:          "@glib@/lib/libglib-2.0.dylib",
+		LIBRARY.GMODULE:       "@glib@/lib/libgmodule-2.0.dylib",
+		LIBRARY.GOBJECT:       "@glib@/lib/libgobject-2.0.dylib",
+		LIBRARY.GIO:           "@glib@/lib/libgio-2.0.dylib",
+		LIBRARY.GTHREAD:       "@glib@/lib/libgthread-2.0.dylib",
+		LIBRARY.GTK:           "@gtk3@/lib/libgtk-3.0.dylib",
+		LIBRARY.PANGO:         "@pango@/lib/libpango-1.0.dylib",
+		LIBRARY.PANGOCAIRO:    "@pango@/lib/libpangocairo-1.0.dylib",
+		LIBRARY.GLGDK:         "libgdkglext-3.0.dylib",
+		LIBRARY.GLGTK:         "libgtkglext-3.0.dylib",
+		LIBRARY.GDA:           "@libgda@/lib/libgda-2.dylib",
+		LIBRARY.GSV:           "@gtksourceview@/lib/libgtksourceview-3.0.dylib",
+		LIBRARY.GSV1:          "@gtksourceview@/lib/libgtksourceview-3.0.dylib",
+		LIBRARY.GSTREAMER:     "@gstreamer@/lib/libgstreamer-1.0.dylib",
+		LIBRARY.GSTINTERFACES: "@gst_plugins_base@/lib/libgstvideo-1.0.dylib",
+		LIBRARY.VTE:           "@vte@/lib/libvte-2.91.dylib",
+		LIBRARY.PEAS:          "@libpeas@/lib/libpeas-1.0.dylib",
+		LIBRARY.RSVG:          "@librsvg@/lib/librsvg-2.dylib",
+	];
+}
+else
+{
+	const string[LIBRARY.max+1] importLibs =
+	[
+		LIBRARY.ATK:           "@atk@/lib/libatk-1.0.so.0",
+		LIBRARY.CAIRO:         "@cairo@/lib/libcairo.so.2",
+		LIBRARY.GDK:           "@gtk3@/lib/libgdk-3.so.0",
+		LIBRARY.GDKPIXBUF:     "@gdk_pixbuf@/lib/libgdk_pixbuf-2.0.so.0",
+		LIBRARY.GLIB:          "@glib@/lib/libglib-2.0.so.0",
+		LIBRARY.GMODULE:       "@glib@/lib/libgmodule-2.0.so.0",
+		LIBRARY.GOBJECT:       "@glib@/lib/libgobject-2.0.so.0",
+		LIBRARY.GIO:           "@glib@/lib/libgio-2.0.so.0",
+		LIBRARY.GTHREAD:       "@glib@/lib/libgthread-2.0.so.0",
+		LIBRARY.GTK:           "@gtk3@/lib/libgtk-3.so.0",
+		LIBRARY.PANGO:         "@pango@/lib/libpango-1.0.so.0",
+		LIBRARY.PANGOCAIRO:    "@pango@/lib/libpangocairo-1.0.so.0",
+		LIBRARY.GLGDK:         "libgdkglext-3.0.so.0",
+		LIBRARY.GLGTK:         "libgtkglext-3.0.so.0",
+		LIBRARY.GDA:           "@libgda@/lib/libgda-4.0.so.4",
+		LIBRARY.GSV:           "@gtksourceview@/lib/libgtksourceview-3.0.so.0",
+		LIBRARY.GSV1:          "@gtksourceview@/lib/libgtksourceview-3.0.so.1",
+		LIBRARY.GSTREAMER:     "@gstreamer@/lib/libgstreamer-1.0.so.0",
+		LIBRARY.GSTINTERFACES: "@gst_plugins_base@/lib/libgstvideo-1.0.so.0",
+		LIBRARY.VTE:           "@vte@/lib/libvte-2.91.so.0",
+		LIBRARY.PEAS:          "@libpeas@/lib/libpeas-1.0.so.0",
+		LIBRARY.RSVG:          "@librsvg@/lib/librsvg-2.so.2",
+	];
+}
diff --git a/nixpkgs/pkgs/development/libraries/gtkdatabox/default.nix b/nixpkgs/pkgs/development/libraries/gtkdatabox/default.nix
new file mode 100644
index 000000000000..1caac3914a58
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gtkdatabox/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, fetchurl, pkgconfig, gtk2 }:
+
+stdenv.mkDerivation rec {
+  name = "gtkdatabox-0.9.3.1";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/gtkdatabox/${name}.tar.gz";
+    sha256 = "1rdxnjgh6v3yjqgsfmamyzpfxckzchps4kqvvz88nifmd7ckhjfh";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+
+  propagatedBuildInputs = [ gtk2 ];
+
+  meta = {
+    description = "Gtk+ widget for displaying large amounts of numerical data";
+
+    license = stdenv.lib.licenses.lgpl2;
+
+    platforms = stdenv.lib.platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gtkimageview/default.nix b/nixpkgs/pkgs/development/libraries/gtkimageview/default.nix
new file mode 100644
index 000000000000..d6d32c26a509
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gtkimageview/default.nix
@@ -0,0 +1,39 @@
+{ fetchurl, stdenv, pkgconfig, gtk2 }:
+
+stdenv.mkDerivation rec {
+  name = "gtkimageview-1.6.4";
+
+  src = fetchurl {
+    url = "http://trac.bjourne.webfactional.com/chrome/common/releases/${name}.tar.gz";
+    sha256 = "1if3yh5z6nkv5wnkk0qyy9pkk03vn5rqbfk23q87kj39pqscgr37";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ gtk2 ];
+
+  preConfigure = ''
+    sed '/DEPRECATED_FLAGS/d' -i configure
+    sed 's/-Wall -Werror//' -i configure
+  '';
+
+  doCheck = true;
+
+  meta = {
+    homepage = "https://wiki.gnome.org/Projects/GTK%2B/GtkImageView";
+
+    description = "Image viewer widget for GTK+";
+
+    longDescription =
+      '' GtkImageView is a simple image viewer widget for GTK+.  Similar to
+         the image viewer panes in gThumb or Eye of Gnome.  It makes writing
+         image viewing and editing applications easy.  Among its features
+         are: mouse and keyboard zooming; scrolling and dragging; adjustable
+         interpolation; GIF animation support.
+       '';
+
+    license = stdenv.lib.licenses.lgpl2Plus;
+
+    maintainers = [ ];
+    platforms = stdenv.lib.platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gtkmathview/default.nix b/nixpkgs/pkgs/development/libraries/gtkmathview/default.nix
new file mode 100644
index 000000000000..12b9181a952e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gtkmathview/default.nix
@@ -0,0 +1,29 @@
+{stdenv, fetchurl, pkgconfig, gtk2, t1lib, glib, libxml2, popt, gmetadom ? null }:
+
+let
+  pname = "gtkmathview";
+  version = "0.8.0";
+in
+
+stdenv.mkDerivation {
+  name = "${pname}-${version}";
+
+  src = fetchurl {
+    url = "http://helm.cs.unibo.it/mml-widget/sources/${pname}-${version}.tar.gz";
+    sha256 = "0hwcamf5fi35frg7q6kgisc9v0prqbhsplb2gl55cg3av9sh3hqx";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ t1lib glib gmetadom libxml2 popt];
+  propagatedBuildInputs = [gtk2 t1lib];
+
+  patches = [ ./gcc-4.3-build-fixes.patch ./gcc-4.4-build-fixes.patch ];
+
+  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 ];
+    broken = true;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gtkmathview/gcc-4.3-build-fixes.patch b/nixpkgs/pkgs/development/libraries/gtkmathview/gcc-4.3-build-fixes.patch
new file mode 100644
index 000000000000..14ad594b38b8
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gtkmathview/gcc-4.3-build-fixes.patch
@@ -0,0 +1,74 @@
+From: Stefano Zacchiroli <zack@upsilon.cc>
+Date: Fri, 11 Dec 2009 12:58:56 +0100
+Subject: [PATCH] gcc 4.3 build fixes
+
+---
+ mathmlps/main.cc                    |    1 +
+ mathmlsvg/SMS.cc                    |    1 +
+ mathmlsvg/main.cc                   |    1 +
+ src/backend/ps/T1_FontDataBase.cc   |    2 +-
+ src/engine/mathml/mathVariantAux.cc |    1 +
+ 5 files changed, 5 insertions(+), 1 deletions(-)
+
+diff --git a/mathmlps/main.cc b/mathmlps/main.cc
+index cc6cd1c..48339af 100644
+--- a/mathmlps/main.cc
++++ b/mathmlps/main.cc
+@@ -19,6 +19,7 @@
+ #include <config.h>
+ 
+ #include <cassert>
++#include <cstring>
+ #include <fstream>
+ 
+ #include <popt.h>
+diff --git a/mathmlsvg/SMS.cc b/mathmlsvg/SMS.cc
+index a76266e..be7add8 100644
+--- a/mathmlsvg/SMS.cc
++++ b/mathmlsvg/SMS.cc
+@@ -18,6 +18,7 @@
+ 
+ #include <config.h>
+ 
++#include <cstring>
+ #include <sstream>
+ #include "defs.h"
+ #include "AbstractLogger.hh"
+diff --git a/mathmlsvg/main.cc b/mathmlsvg/main.cc
+index 259d67e..c49e8ac 100644
+--- a/mathmlsvg/main.cc
++++ b/mathmlsvg/main.cc
+@@ -19,6 +19,7 @@
+ #include <config.h>
+ 
+ #include <cassert>
++#include <cstring>
+ #include <fstream>
+ 
+ #include <popt.h>
+diff --git a/src/backend/ps/T1_FontDataBase.cc b/src/backend/ps/T1_FontDataBase.cc
+index b6490eb..3dd436c 100644
+--- a/src/backend/ps/T1_FontDataBase.cc
++++ b/src/backend/ps/T1_FontDataBase.cc
+@@ -19,7 +19,7 @@
+ #include <t1lib.h>
+ #include <config.h>
+ #include <map>
+-#include <string>
++#include <cstring>
+ #include <stdlib.h>
+ #include <iostream>
+ #include <list>
+diff --git a/src/engine/mathml/mathVariantAux.cc b/src/engine/mathml/mathVariantAux.cc
+index 736acc1..dcf1826 100644
+--- a/src/engine/mathml/mathVariantAux.cc
++++ b/src/engine/mathml/mathVariantAux.cc
+@@ -19,6 +19,7 @@
+ #include <config.h>
+ 
+ #include <cassert>
++#include <cstring>
+ 
+ #include "mathVariantAux.hh"
+ 
+-- 
diff --git a/nixpkgs/pkgs/development/libraries/gtkmathview/gcc-4.4-build-fixes.patch b/nixpkgs/pkgs/development/libraries/gtkmathview/gcc-4.4-build-fixes.patch
new file mode 100644
index 000000000000..0ebd31ef2a78
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gtkmathview/gcc-4.4-build-fixes.patch
@@ -0,0 +1,21 @@
+From: Stefano Zacchiroli <zack@upsilon.cc>
+Date: Fri, 11 Dec 2009 13:26:26 +0100
+Subject: [PATCH] gcc 4.4 build fixes
+
+---
+ src/common/AbstractLogger.cc |    1 +
+ 1 files changed, 1 insertions(+), 0 deletions(-)
+
+diff --git a/src/common/AbstractLogger.cc b/src/common/AbstractLogger.cc
+index 6f638fb..c5b7e3d 100644
+--- a/src/common/AbstractLogger.cc
++++ b/src/common/AbstractLogger.cc
+@@ -19,6 +19,7 @@
+ #include <config.h>
+ 
+ #include <stdarg.h>
++#include <stdio.h>
+ 
+ #include "AbstractLogger.hh"
+ 
+-- 
diff --git a/nixpkgs/pkgs/development/libraries/gtkmm/2.x.nix b/nixpkgs/pkgs/development/libraries/gtkmm/2.x.nix
new file mode 100644
index 000000000000..69fd3f30e92d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gtkmm/2.x.nix
@@ -0,0 +1,42 @@
+{ stdenv, fetchurl, pkgconfig, gtk2, glibmm, cairomm, pangomm, atkmm }:
+
+stdenv.mkDerivation rec {
+  name = "gtkmm-${minVer}.5";
+  minVer = "2.24";
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/gtkmm/${minVer}/${name}.tar.xz";
+    sha256 = "0680a53b7bf90b4e4bf444d1d89e6df41c777e0bacc96e9c09fc4dd2f5fe6b72";
+  };
+
+  outputs = [ "out" "dev" ];
+
+  nativeBuildInputs = [ pkgconfig ];
+
+  propagatedBuildInputs = [ glibmm gtk2 atkmm cairomm pangomm ];
+
+  doCheck = true;
+
+  enableParallelBuilding = true;
+
+  meta = {
+    description = "C++ interface to the GTK+ graphical user interface library";
+
+    longDescription = ''
+      gtkmm is the official C++ interface for the popular GUI library
+      GTK+.  Highlights include typesafe callbacks, and a
+      comprehensive set of widgets that are easily extensible via
+      inheritance.  You can create user interfaces either in code or
+      with the Glade User Interface designer, using libglademm.
+      There's extensive documentation, including API reference and a
+      tutorial.
+    '';
+
+    homepage = https://gtkmm.org/;
+
+    license = stdenv.lib.licenses.lgpl2Plus;
+
+    maintainers = with stdenv.lib.maintainers; [ raskin vcunat ];
+    platforms = stdenv.lib.platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gtkmm/3.x.nix b/nixpkgs/pkgs/development/libraries/gtkmm/3.x.nix
new file mode 100644
index 000000000000..1a5b0fe62875
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gtkmm/3.x.nix
@@ -0,0 +1,51 @@
+{ stdenv, fetchurl, pkgconfig, gtk3, glibmm, cairomm, pangomm, atkmm, epoxy, gnome3 }:
+
+stdenv.mkDerivation rec {
+  pname = "gtkmm";
+  version = "3.24.1";
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    sha256 = "1zfj89spr8ianib5y10wcw63ybdmyjy58a15vqs0m8jq4knl5znx";
+  };
+
+  outputs = [ "out" "dev" ];
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ epoxy ];
+
+  propagatedBuildInputs = [ glibmm gtk3 atkmm cairomm pangomm ];
+
+  enableParallelBuilding = true;
+
+  # https://bugzilla.gnome.org/show_bug.cgi?id=764521
+  doCheck = false;
+
+  passthru = {
+    updateScript = gnome3.updateScript {
+      packageName = pname;
+      attrPath = "${pname}3";
+    };
+  };
+
+  meta = with stdenv.lib; {
+    description = "C++ interface to the GTK+ graphical user interface library";
+
+    longDescription = ''
+      gtkmm is the official C++ interface for the popular GUI library
+      GTK+.  Highlights include typesafe callbacks, and a
+      comprehensive set of widgets that are easily extensible via
+      inheritance.  You can create user interfaces either in code or
+      with the Glade User Interface designer, using libglademm.
+      There's extensive documentation, including API reference and a
+      tutorial.
+    '';
+
+    homepage = https://gtkmm.org/;
+
+    license = licenses.lgpl2Plus;
+
+    maintainers = with maintainers; [ raskin vcunat ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gtksourceview/3.x-nix_share_path.patch b/nixpkgs/pkgs/development/libraries/gtksourceview/3.x-nix_share_path.patch
new file mode 100644
index 000000000000..c87350167c25
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gtksourceview/3.x-nix_share_path.patch
@@ -0,0 +1,11 @@
+--- a/gtksourceview/gtksourceview-utils.c	2014-07-13 16:13:57.418687726 +0200
++++ b/gtksourceview/gtksourceview-utils.c	2014-07-13 16:14:20.550847767 +0200
+@@ -68,6 +68,8 @@
+ 							 basename,
+ 							 NULL));
+ 
++        g_ptr_array_add (dirs, g_build_filename ("@NIX_SHARE_PATH@", SOURCEVIEW_DIR, basename, NULL));
++
+ 	g_ptr_array_add (dirs, NULL);
+ 
+ 	return (gchar**) g_ptr_array_free (dirs, FALSE);
diff --git a/nixpkgs/pkgs/development/libraries/gtksourceview/3.x.nix b/nixpkgs/pkgs/development/libraries/gtksourceview/3.x.nix
new file mode 100644
index 000000000000..9d1751afaf91
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gtksourceview/3.x.nix
@@ -0,0 +1,58 @@
+{ stdenv, fetchurl, pkgconfig, atk, cairo, glib, gtk3, pango, vala
+, libxml2, perl, intltool, gettext, gnome3, gobject-introspection, dbus, xvfb_run, shared-mime-info }:
+
+stdenv.mkDerivation rec {
+  name = "gtksourceview-${version}";
+  version = "3.24.11";
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/gtksourceview/${stdenv.lib.versions.majorMinor version}/${name}.tar.xz";
+    sha256 = "1zbpj283b5ycz767hqz5kdq02wzsga65pp4fykvhg8xj6x50f6v9";
+  };
+
+  propagatedBuildInputs = [
+    # Required by gtksourceview-3.0.pc
+    gtk3
+    # Used by gtk_source_language_manager_guess_language
+    shared-mime-info
+  ];
+
+  outputs = [ "out" "dev" ];
+
+  nativeBuildInputs = [ pkgconfig intltool perl gobject-introspection vala ];
+
+  checkInputs = [ xvfb_run dbus ];
+
+  buildInputs = [ atk cairo glib pango libxml2 gettext ];
+
+  preBuild = ''
+    substituteInPlace gtksourceview/gtksourceview-utils.c --replace "@NIX_SHARE_PATH@" "$out/share"
+  '';
+
+  patches = [ ./3.x-nix_share_path.patch ];
+
+  enableParallelBuilding = true;
+
+  doCheck = stdenv.isLinux;
+  checkPhase = ''
+    NO_AT_BRIDGE=1 \
+    XDG_DATA_DIRS="$XDG_DATA_DIRS:${shared-mime-info}/share" \
+    xvfb-run -s '-screen 0 800x600x24' dbus-run-session \
+      --config-file=${dbus.daemon}/share/dbus-1/session.conf \
+      make check
+  '';
+
+  passthru = {
+    updateScript = gnome3.updateScript {
+      packageName = "gtksourceview";
+      attrPath = "gnome3.gtksourceview";
+    };
+  };
+
+  meta = with stdenv.lib; {
+    homepage = https://wiki.gnome.org/Projects/GtkSourceView;
+    platforms = with platforms; linux ++ darwin;
+    license = licenses.lgpl21;
+    maintainers = gnome3.maintainers;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gtksourceview/4.x-nix_share_path.patch b/nixpkgs/pkgs/development/libraries/gtksourceview/4.x-nix_share_path.patch
new file mode 100644
index 000000000000..a35d9a88d0df
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gtksourceview/4.x-nix_share_path.patch
@@ -0,0 +1,11 @@
+--- a/gtksourceview/gtksourceutils.c
++++ b/gtksourceview/gtksourceutils.c
+@@ -232,6 +232,8 @@
+ 							 NULL));
+ 	}
+ 
++	g_ptr_array_add (dirs, g_build_filename (DATADIR, GSV_DATA_SUBDIR, basename, NULL));
++
+ 	g_ptr_array_add (dirs, NULL);
+ 
+ 	return (gchar **) g_ptr_array_free (dirs, FALSE);
diff --git a/nixpkgs/pkgs/development/libraries/gtksourceview/4.x.nix b/nixpkgs/pkgs/development/libraries/gtksourceview/4.x.nix
new file mode 100644
index 000000000000..553e9fd9cbb6
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gtksourceview/4.x.nix
@@ -0,0 +1,54 @@
+{ stdenv, fetchurl, pkgconfig, atk, cairo, glib, gtk3, pango, vala
+, libxml2, perl, gettext, gnome3, gobject-introspection, dbus, xvfb_run, shared-mime-info }:
+
+stdenv.mkDerivation rec {
+  name = "gtksourceview-${version}";
+  version = "4.2.0";
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/gtksourceview/${stdenv.lib.versions.majorMinor version}/${name}.tar.xz";
+    sha256 = "0xgnjj7jd56wbl99s76sa1vjq9bkz4mdsxwgwlcphg689liyncf4";
+  };
+
+  propagatedBuildInputs = [
+    # Required by gtksourceview-4.0.pc
+    gtk3
+    # Used by gtk_source_language_manager_guess_language
+    shared-mime-info
+  ];
+
+  outputs = [ "out" "dev" ];
+
+  nativeBuildInputs = [ pkgconfig gettext perl gobject-introspection vala ];
+
+  checkInputs = [ xvfb_run dbus ];
+
+  buildInputs = [ atk cairo glib pango libxml2 ];
+
+  patches = [ ./4.x-nix_share_path.patch ];
+
+  enableParallelBuilding = true;
+
+  doCheck = stdenv.isLinux;
+  checkPhase = ''
+    NO_AT_BRIDGE=1 \
+    XDG_DATA_DIRS="$XDG_DATA_DIRS:${shared-mime-info}/share" \
+    xvfb-run -s '-screen 0 800x600x24' dbus-run-session \
+      --config-file=${dbus.daemon}/share/dbus-1/session.conf \
+      make check
+  '';
+
+  passthru = {
+    updateScript = gnome3.updateScript {
+      packageName = "gtksourceview";
+      attrPath = "gtksourceview4";
+    };
+  };
+
+  meta = with stdenv.lib; {
+    homepage = https://wiki.gnome.org/Projects/GtkSourceView;
+    platforms = with platforms; linux ++ darwin;
+    license = licenses.lgpl21;
+    maintainers = gnome3.maintainers;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gtksourceviewmm/4.x.nix b/nixpkgs/pkgs/development/libraries/gtksourceviewmm/4.x.nix
new file mode 100644
index 000000000000..d60bb29c47ae
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gtksourceviewmm/4.x.nix
@@ -0,0 +1,30 @@
+{ stdenv, fetchurl, pkgconfig, 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";
+    sha256 = "088p2ch1b4fvzl9416nw3waj0pqgp31cd5zj4lx5hzzrq2afgapy";
+  };
+
+  passthru = {
+    updateScript = gnome3.updateScript {
+      packageName = pname;
+      versionPolicy = "none";
+    };
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  propagatedBuildInputs = [ glibmm gtkmm3 gtksourceview4 ];
+
+  meta = with stdenv.lib; {
+    platforms = platforms.linux;
+    homepage = https://developer.gnome.org/gtksourceviewmm/;
+    description = "C++ wrapper for gtksourceview";
+    license = licenses.lgpl2;
+    maintainers = gnome3.maintainers;
+  };
+}
+
diff --git a/nixpkgs/pkgs/development/libraries/gtksourceviewmm/default.nix b/nixpkgs/pkgs/development/libraries/gtksourceviewmm/default.nix
new file mode 100644
index 000000000000..455cc4d4b81e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gtksourceviewmm/default.nix
@@ -0,0 +1,31 @@
+{ stdenv, fetchurl, pkgconfig, gtkmm3, glibmm, gtksourceview3, gnome3 }:
+
+stdenv.mkDerivation rec {
+  name = "gtksourceviewmm-${version}";
+  version = "3.21.3";
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/gtksourceviewmm/${stdenv.lib.versions.majorMinor version}/${name}.tar.xz";
+    sha256 = "1danc9mp5mnb65j01qxkwj92z8jf1gns41wbgp17qh7050f0pc6v";
+  };
+
+  passthru = {
+    updateScript = gnome3.updateScript {
+      packageName = "gtksourceviewmm";
+      attrPath = "gnome3.gtksourceviewmm";
+      versionPolicy = "none";
+    };
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ glibmm gtkmm3 gtksourceview3 ];
+
+  meta = with stdenv.lib; {
+    platforms = platforms.linux;
+    homepage = https://developer.gnome.org/gtksourceviewmm/;
+    description = "C++ wrapper for gtksourceview";
+    license = licenses.lgpl2;
+    maintainers = [ maintainers.juliendehos ];
+  };
+}
+
diff --git a/nixpkgs/pkgs/development/libraries/gtkspell/3.nix b/nixpkgs/pkgs/development/libraries/gtkspell/3.nix
new file mode 100644
index 000000000000..f0baecb19904
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gtkspell/3.nix
@@ -0,0 +1,30 @@
+{stdenv, fetchurl, gtk3, aspell, pkgconfig, enchant, isocodes, intltool, gobject-introspection, vala}:
+
+stdenv.mkDerivation rec {
+  name = "gtkspell-${version}";
+  version = "3.0.10";
+
+  outputs = [ "out" "dev" ];
+
+  src = fetchurl {
+    url = "mirror://sourceforge/gtkspell/gtkspell3-${version}.tar.xz";
+    sha256 = "0cjp6xdcnzh6kka42w9g0w2ihqjlq8yl8hjm9wsfnixk6qwgch5h";
+  };
+
+  nativeBuildInputs = [ pkgconfig intltool gobject-introspection vala ];
+  buildInputs = [ aspell gtk3 enchant isocodes ];
+  propagatedBuildInputs = [ enchant ];
+
+  configureFlags = [
+    "--enable-introspection"
+    "--enable-vala"
+  ];
+
+  meta = with stdenv.lib; {
+    homepage = http://gtkspell.sourceforge.net/;
+    description = "Word-processor-style highlighting GtkTextView widget";
+    license = licenses.gpl2Plus;
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ fuuzetsu ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gtkspell/default.nix b/nixpkgs/pkgs/development/libraries/gtkspell/default.nix
new file mode 100644
index 000000000000..14676be0dcb9
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gtkspell/default.nix
@@ -0,0 +1,20 @@
+{stdenv, fetchurl, gtk2, aspell, pkgconfig, enchant, intltool}:
+
+stdenv.mkDerivation {
+  name = "gtkspell-2.0.16";
+
+  src = fetchurl {
+    url = mirror://sourceforge/gtkspell/gtkspell-2.0.16.tar.gz;
+    sha256 = "00hdv28bp72kg1mq2jdz1sdw2b8mb9iclsp7jdqwpck705bdriwg";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [aspell gtk2 enchant intltool];
+
+  meta = with stdenv.lib; {
+    description = "Word-processor-style highlighting and replacement of misspelled words";
+    homepage = http://gtkspell.sourceforge.net;
+    platforms = platforms.unix;
+    license = licenses.gpl2;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gtkspellmm/default.nix b/nixpkgs/pkgs/development/libraries/gtkspellmm/default.nix
new file mode 100644
index 000000000000..cb141f8c5569
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gtkspellmm/default.nix
@@ -0,0 +1,31 @@
+{ stdenv, fetchurl
+, pkgconfig
+, gtk3, glib, glibmm, gtkmm3, gtkspell3
+}:
+
+stdenv.mkDerivation rec {
+  name = "gtkspellmm-${version}";
+  version = "3.0.5";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/project/gtkspell/gtkspellmm/" +
+          "${name}.tar.xz";
+    sha256 = "0i8mxwyfv5mskachafa4qlh315q0cfph7s66s1s34nffadbmm1sv";
+  };
+
+  propagatedBuildInputs = [
+    gtkspell3
+  ];
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [
+    gtk3 glib glibmm gtkmm3
+  ];
+
+  meta = with stdenv.lib; {
+    description = "C++ binding for the gtkspell library";
+    homepage = http://gtkspell.sourceforge.net/;
+    license = licenses.gpl2;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gts/default.nix b/nixpkgs/pkgs/development/libraries/gts/default.nix
new file mode 100644
index 000000000000..d0da7f8cef61
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gts/default.nix
@@ -0,0 +1,31 @@
+{ fetchurl, stdenv, glib, pkgconfig, gettext }:
+
+
+stdenv.mkDerivation rec {
+  name = "gts-${version}";
+  version = "0.7.6";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/gts/${name}.tar.gz";
+    sha256 = "07mqx09jxh8cv9753y2d2jsv7wp8vjmrd7zcfpbrddz3wc9kx705";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ glib gettext ];
+
+  doCheck = false; # fails with "permission denied"
+
+  meta = {
+    homepage = http://gts.sourceforge.net/;
+    license = stdenv.lib.licenses.lgpl2Plus;
+    description = "GNU Triangulated Surface Library";
+
+    longDescription = ''
+      Library intended to provide a set of useful functions to deal with
+      3D surfaces meshed with interconnected triangles.
+    '';
+
+    maintainers = [ stdenv.lib.maintainers.viric ];
+    platforms = stdenv.lib.platforms.linux ++ stdenv.lib.platforms.darwin;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gumbo/default.nix b/nixpkgs/pkgs/development/libraries/gumbo/default.nix
new file mode 100644
index 000000000000..17ca323a5fef
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gumbo/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchFromGitHub, autoconf, automake, libtool }:
+
+stdenv.mkDerivation rec {
+  name = "gumbo-${version}";
+  version = "0.10.1";
+
+  src = fetchFromGitHub {
+    owner = "google";
+    repo = "gumbo-parser";
+    rev = "v${version}";
+    sha256 = "0xslckwdh2i0g2qjsb6rnm8mjmbagvziz0hjlf7d1lbljfms1iw1";
+  };
+
+  buildInputs = [ autoconf automake libtool ];
+
+  preConfigure = "./autogen.sh";
+
+  meta = with stdenv.lib; {
+    description = "C99 HTML parsing algorithm";
+    homepage = https://github.com/google/gumbo-parser;
+    maintainers = [ maintainers.nico202 ];
+    platforms = platforms.linux;
+    license = licenses.asl20;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gupnp-av/default.nix b/nixpkgs/pkgs/development/libraries/gupnp-av/default.nix
new file mode 100644
index 000000000000..b764ce2c2e21
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gupnp-av/default.nix
@@ -0,0 +1,57 @@
+{ stdenv
+, fetchurl
+, pkgconfig
+, gobject-introspection
+, vala
+, gtk-doc
+, docbook_xsl
+, docbook_xml_dtd_412
+, glib
+, libxml2
+, gnome3
+}:
+
+stdenv.mkDerivation rec {
+  pname = "gupnp-av";
+  version = "0.12.11";
+
+  outputs = [ "out" "dev" "devdoc" ];
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    sha256 = "1p3grslwqm9bc8rmpn4l48d7v9s84nina4r9xbd932dbj8acz7b8";
+  };
+
+  nativeBuildInputs = [
+    pkgconfig
+    gobject-introspection
+    vala
+    gtk-doc
+    docbook_xsl
+    docbook_xml_dtd_412
+  ];
+
+  buildInputs = [
+    glib
+    libxml2
+  ];
+
+  configureFlags = [
+    "--enable-gtk-doc"
+  ];
+
+  doCheck = true;
+
+  passthru = {
+    updateScript = gnome3.updateScript {
+      packageName = pname;
+    };
+  };
+
+  meta = with stdenv.lib; {
+    homepage = http://gupnp.org/;
+    description = "A collection of helpers for building AV (audio/video) applications using GUPnP";
+    license = licenses.lgpl2Plus;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gupnp-dlna/default.nix b/nixpkgs/pkgs/development/libraries/gupnp-dlna/default.nix
new file mode 100644
index 000000000000..4dfbaafdc327
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gupnp-dlna/default.nix
@@ -0,0 +1,62 @@
+{ stdenv
+, fetchurl
+, pkgconfig
+, gobject-introspection
+, vala
+, gtk-doc
+, docbook_xsl
+, docbook_xml_dtd_412
+, libxml2
+, gst_all_1
+, gnome3
+}:
+
+stdenv.mkDerivation rec {
+  pname = "gupnp-dlna";
+  version = "0.10.5";
+
+  outputs = [ "out" "dev" "devdoc" ];
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    sha256 = "0spzd2saax7w776p5laixdam6d7smyynr9qszhbmq7f14y13cghj";
+  };
+
+  nativeBuildInputs = [
+    pkgconfig
+    gobject-introspection
+    vala
+    gtk-doc
+    docbook_xsl
+    docbook_xml_dtd_412
+  ];
+
+  buildInputs = [
+    libxml2
+    gst_all_1.gst-plugins-base
+  ];
+
+  configureFlags = [
+    "--enable-gtk-doc"
+  ];
+
+  doCheck = true;
+
+  postPatch = ''
+    chmod +x tests/test-discoverer.sh.in
+    patchShebangs tests/test-discoverer.sh.in
+  '';
+
+  passthru = {
+    updateScript = gnome3.updateScript {
+      packageName = pname;
+    };
+  };
+
+  meta = with stdenv.lib; {
+    homepage = https://wiki.gnome.org/Projects/GUPnP/;
+    description = "Library to ease DLNA-related bits for applications using GUPnP";
+    license = licenses.lgpl2Plus;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gupnp-igd/default.nix b/nixpkgs/pkgs/development/libraries/gupnp-igd/default.nix
new file mode 100644
index 000000000000..56a274316e89
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gupnp-igd/default.nix
@@ -0,0 +1,68 @@
+{ stdenv
+, fetchurl
+, fetchpatch
+, autoreconfHook
+, pkgconfig
+, gettext
+, gobject-introspection
+, gtk-doc
+, docbook_xsl
+, docbook_xml_dtd_412
+, glib
+, gupnp
+, gnome3
+}:
+
+stdenv.mkDerivation rec {
+  pname = "gupnp-igd";
+  version = "0.2.5";
+
+  outputs = [ "out" "dev" "devdoc" ];
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    sha256 = "081v1vhkbz3wayv49xfiskvrmvnpx93k25am2wnarg5cifiiljlb";
+  };
+
+  patches = [
+    # Add gupnp-1.2 compatibility
+    (fetchpatch {
+      url = https://gitlab.gnome.org/GNOME/gupnp-igd/commit/63531558a16ac2334a59f627b2fca5576dcfbb2e.patch;
+      sha256 = "0s8lkyy9fnnnnkkqwbk6gxb7795bb1kl1swk5ldjnlrzhfcy1ab2";
+    })
+  ];
+
+  nativeBuildInputs = [
+    pkgconfig
+    autoreconfHook
+    gettext
+    gobject-introspection
+    gtk-doc
+    docbook_xsl
+    docbook_xml_dtd_412
+  ];
+
+  propagatedBuildInputs = [
+    glib
+    gupnp
+  ];
+
+  configureFlags = [
+    "--enable-gtk-doc"
+  ];
+
+  doCheck = true;
+
+  passthru = {
+    updateScript = gnome3.updateScript {
+      packageName = pname;
+    };
+  };
+
+  meta = with stdenv.lib; {
+    description = "Library to handle UPnP IGD port mapping";
+    homepage = http://www.gupnp.org/;
+    license = licenses.lgpl21;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gupnp/default.nix b/nixpkgs/pkgs/development/libraries/gupnp/default.nix
new file mode 100644
index 000000000000..a69df33dd650
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gupnp/default.nix
@@ -0,0 +1,94 @@
+{ stdenv
+, fetchurl
+, fetchpatch
+, meson
+, ninja
+, pkgconfig
+, gobject-introspection
+, vala
+, gtk-doc
+, docbook_xsl
+, docbook_xml_dtd_412
+, docbook_xml_dtd_44
+, glib
+, gssdp
+, libsoup
+, libxml2
+, libuuid
+, gnome3
+}:
+
+stdenv.mkDerivation rec {
+  pname = "gupnp";
+  version = "1.2.0";
+
+  outputs = [ "out" "dev" "devdoc" ];
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/gupnp/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    sha256 = "0911lv1bivsyv9wwdxm0i1w4r89j0vyyqp200gsfdnzk6v1a4x7x";
+  };
+
+  patches = [
+    # Nix’s pkg-config ignores Requires.private
+    # https://github.com/NixOS/nixpkgs/commit/1e6622f4d5d500d6e701bd81dd4a22977d10637d
+    # We are essentialy reverting the following patch for now
+    # https://bugzilla.gnome.org/show_bug.cgi?id=685477
+    # at least until Requires.internal or something is implemented
+    # https://gitlab.freedesktop.org/pkg-config/pkg-config/issues/7
+    ./fix-requires.patch
+
+    # fix deadlock in gupnp-igd tests
+    (fetchpatch {
+      url = https://gitlab.gnome.org/GNOME/gupnp/commit/d208562657f62b34759896ca9e974bd582d1f963.patch;
+      sha256 = "02kzsb4glxhgb1npf6qqgafiki0ws75sly5h470431mihc6sgp4f";
+    })
+    # fix breakage in gupnp-igd tests
+    (fetchpatch {
+      url = https://gitlab.gnome.org/GNOME/gupnp/commit/0648399acb989473119fe59d0b9f65c923e69483.patch;
+      sha256 = "0ba0rngk3a4n3z4dmq06wzgh0n3q9la1nr25qdxqbwlszmxfxpjf";
+    })
+  ];
+
+  nativeBuildInputs = [
+    meson
+    ninja
+    pkgconfig
+    gobject-introspection
+    vala
+    gtk-doc
+    docbook_xsl
+    docbook_xml_dtd_412
+    docbook_xml_dtd_44
+  ];
+
+  buildInputs = [
+    libuuid
+  ];
+
+  propagatedBuildInputs = [
+    glib
+    gssdp
+    libsoup
+    libxml2
+  ];
+
+  mesonFlags = [
+    "-Dgtk_doc=true"
+  ];
+
+  doCheck = true;
+
+  passthru = {
+    updateScript = gnome3.updateScript {
+      packageName = pname;
+    };
+  };
+
+  meta = with stdenv.lib; {
+    homepage = http://www.gupnp.org/;
+    description = "An implementation of the UPnP specification";
+    license = licenses.lgpl2Plus;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gupnp/fix-requires.patch b/nixpkgs/pkgs/development/libraries/gupnp/fix-requires.patch
new file mode 100644
index 000000000000..ffe9b68fd043
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gupnp/fix-requires.patch
@@ -0,0 +1,26 @@
+--- a/libgupnp/meson.build
++++ b/libgupnp/meson.build
+@@ -110,6 +110,7 @@ pkg.generate(
+     libraries : libgupnp,
+     subdirs: 'gupnp-1.2',
+     name : 'gupnp-1.2',
++    requires: requires,
+     description : 'GObject-based UPnP library',
+     version : meson.project_version(),
+     filebase : 'gupnp-1.2'
+--- a/meson.build
++++ a/meson.build
+@@ -18,6 +18,13 @@ add_global_arguments('-DHAVE_CONFIG_H=1', language : 'c')
+ 
+ guul = subproject('guul', default_options : ['default_library=static'])
+ 
++requires = [
++  dependency('glib-2.0', version : '>= 2.44'),
++  dependency('gssdp-1.2', version : '>= 1.1'),
++  dependency('libsoup-2.4', version : '>= 2.48.0'),
++  dependency('libxml-2.0')
++]
++
+ dependencies = [
+     dependency('glib-2.0', version : '>= 2.44'),
+     dependency('gio-2.0', version : '>= 2.44'),
diff --git a/nixpkgs/pkgs/development/libraries/gusb/default.nix b/nixpkgs/pkgs/development/libraries/gusb/default.nix
new file mode 100644
index 000000000000..78a2d365033e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gusb/default.nix
@@ -0,0 +1,38 @@
+{ stdenv, fetchurl, meson, ninja, pkgconfig, gettext, gobject-introspection
+, gtk-doc, docbook_xsl, docbook_xml_dtd_412, docbook_xml_dtd_44
+, glib, systemd, libusb1, vala, hwdata
+}:
+stdenv.mkDerivation rec {
+  name = "gusb-${version}";
+  version = "0.3.0";
+
+  outputs = [ "bin" "out" "dev" "devdoc" ];
+
+  src = fetchurl {
+    url = "https://people.freedesktop.org/~hughsient/releases/libgusb-${version}.tar.xz";
+    sha256 = "1p4f6jdjw6zl986f93gzdjg2hdcn5dlz6rcckcz4rbmnk47rbryq";
+  };
+
+  nativeBuildInputs = [
+    meson ninja pkgconfig gettext
+    gtk-doc docbook_xsl docbook_xml_dtd_412 docbook_xml_dtd_44
+    gobject-introspection vala
+  ];
+  buildInputs = [ systemd glib ];
+
+  propagatedBuildInputs = [ libusb1 ];
+
+  mesonFlags = [
+    "-Dusb_ids=${hwdata}/share/hwdata/usb.ids"
+  ];
+
+  doCheck = false; # tests try to access USB
+
+  meta = with stdenv.lib; {
+    description = "GLib libusb wrapper";
+    homepage = https://github.com/hughsie/libgusb;
+    license = licenses.lgpl21;
+    maintainers = [ maintainers.marcweber ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gvfs/default.nix b/nixpkgs/pkgs/development/libraries/gvfs/default.nix
new file mode 100644
index 000000000000..d9163c97cb79
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gvfs/default.nix
@@ -0,0 +1,72 @@
+{ stdenv, fetchurl, meson, ninja, pkgconfig, gettext, gnome3, dbus
+, glib, libgudev, udisks2, libgcrypt, libcap, polkit
+, libgphoto2, avahi, libarchive, fuse, libcdio
+, libxml2, libxslt, docbook_xsl, docbook_xml_dtd_42, samba, libmtp
+, gnomeSupport ? false, gnome, gcr, wrapGAppsHook
+, libimobiledevice, libbluray, libcdio-paranoia, libnfs, openssh
+, libsecret, libgdata, python3
+}:
+
+let
+  pname = "gvfs";
+  version = "1.40.1";
+in stdenv.mkDerivation rec {
+  name = "${pname}-${version}";
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${name}.tar.xz";
+    sha256 = "1cfnzamr4mvgpf6yhm28lh9cafy9z6842s8jpbqnfizfxybg8ylj";
+  };
+
+  postPatch = ''
+    # patchShebangs requires executable file
+    chmod +x meson_post_install.py
+    patchShebangs meson_post_install.py
+    patchShebangs test test-driver
+  '';
+
+  nativeBuildInputs = [
+    meson ninja python3
+    pkgconfig gettext wrapGAppsHook
+    libxml2 libxslt docbook_xsl docbook_xml_dtd_42
+  ];
+
+  buildInputs = [
+    glib libgudev udisks2 libgcrypt dbus
+    libgphoto2 avahi libarchive fuse libcdio
+    samba libmtp libcap polkit libimobiledevice libbluray
+    libcdio-paranoia libnfs openssh
+    # ToDo: a ligther version of libsoup to have FTP/HTTP support?
+  ] ++ stdenv.lib.optionals gnomeSupport (with gnome; [
+    libsoup gcr
+    glib-networking # TLS support
+    gnome-online-accounts libsecret libgdata
+  ]);
+
+  mesonFlags = [
+    "-Dsystemduserunitdir=${placeholder "out"}/lib/systemd/user"
+    "-Dtmpfilesdir=no"
+  ] ++ stdenv.lib.optionals (!gnomeSupport) [
+    "-Dgcr=false" "-Dgoa=false" "-Dkeyring=false" "-Dhttp=false"
+    "-Dgoogle=false"
+  ] ++ stdenv.lib.optionals (samba == null) [
+    # Xfce don't want samba
+    "-Dsmb=false"
+  ];
+
+  doCheck = false; # fails with "ModuleNotFoundError: No module named 'gi'"
+  doInstallCheck = doCheck;
+
+  passthru = {
+    updateScript = gnome3.updateScript {
+      packageName = pname;
+    };
+  };
+
+  meta = with stdenv.lib; {
+    description = "Virtual Filesystem support library" + optionalString gnomeSupport " (full GNOME support)";
+    license = licenses.lgpl2Plus;
+    platforms = platforms.linux;
+    maintainers = [ maintainers.lethalman ] ++ gnome3.maintainers;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/half/default.nix b/nixpkgs/pkgs/development/libraries/half/default.nix
new file mode 100644
index 000000000000..d235c6cb0869
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/half/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchzip }:
+
+stdenv.mkDerivation rec {
+  version = "1.12.0";
+  name = "half-${version}";
+
+  src = fetchzip {
+    url = "mirror://sourceforge/half/${version}/half-${version}.zip";
+    sha256 = "0096xiw8nj86vxnn3lfcl94vk9qbi5i8lnydri9ws358ly6002vc";
+    stripRoot = false;
+  };
+
+  buildCommand = ''
+    mkdir -p $out/include $out/share/doc
+    cp $src/include/half.hpp               $out/include/
+    cp $src/{ChangeLog,LICENSE,README}.txt $out/share/doc/
+  '';
+
+  meta = with stdenv.lib; {
+    description = "C++ library for half precision floating point arithmetics";
+    platforms = platforms.all;
+    license = licenses.mit;
+    maintainers = [ maintainers.volth ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/hamlib/default.nix b/nixpkgs/pkgs/development/libraries/hamlib/default.nix
new file mode 100644
index 000000000000..b9cd31432fc3
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/hamlib/default.nix
@@ -0,0 +1,35 @@
+{stdenv, fetchurl, perl, python2, swig, gd, libxml2, tcl, libusb, pkgconfig,
+ boost, libtool, perlPackages }:
+
+stdenv.mkDerivation rec {
+  pname = "hamlib";
+  version = "3.3";
+  name = "${pname}-${version}";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/${pname}/${name}.tar.gz";
+    sha256 = "10788mgrhbc57zpzakcxv5aqnr2819pcshml6fbh8zvnkja562y9";
+  };
+
+  buildInputs = [ perl perlPackages.ExtUtilsMakeMaker python2 swig gd libxml2
+                  tcl libusb pkgconfig boost libtool ];
+
+  configureFlags = [ "--with-perl-binding" "--with-python-binding"
+                     "--with-tcl-binding" "--with-rigmatrix" ];
+
+  meta = {
+    description = "Runtime library to control radio transceivers and receivers";
+    longDescription = ''
+    Hamlib provides a standardized programming interface that applications
+    can use to send the appropriate commands to a radio.
+
+    Also included in the package is a simple radio control program 'rigctl',
+    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 ];
+    homepage = http://hamlib.sourceforge.net;
+    maintainers = with stdenv.lib.maintainers; [ relrod ];
+    platforms = with stdenv.lib.platforms; unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/harfbuzz/default.nix b/nixpkgs/pkgs/development/libraries/harfbuzz/default.nix
new file mode 100644
index 000000000000..a405633c1b8d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/harfbuzz/default.nix
@@ -0,0 +1,75 @@
+{ stdenv, fetchurl, pkgconfig, glib, freetype, cairo, libintl
+, icu, graphite2, harfbuzz # The icu variant uses and propagates the non-icu one.
+, ApplicationServices, CoreText
+, withCoreText ? false
+, withIcu ? false # recommended by upstream as default, but most don't needed and it's big
+, withGraphite2 ? true # it is small and major distros do include it
+, python
+}:
+
+let
+  version = "2.5.1";
+  inherit (stdenv.lib) optional optionals optionalString;
+in
+
+stdenv.mkDerivation {
+  name = "harfbuzz${optionalString withIcu "-icu"}-${version}";
+
+  src = fetchurl {
+    url = "https://www.freedesktop.org/software/harfbuzz/release/harfbuzz-${version}.tar.xz";
+    sha256 = "17kiyq23g7bnjvyn2yg4gyr7i7qjam65n20whsrplpxxk9bk8j3d";
+  };
+
+  postPatch = ''
+    patchShebangs src/gen-def.py
+    patchShebangs test
+  '' + stdenv.lib.optionalString stdenv.isDarwin ''
+    # ApplicationServices.framework headers have cast-align warnings.
+    substituteInPlace src/hb.hh \
+      --replace '#pragma GCC diagnostic error   "-Wcast-align"' ""
+  '';
+
+  outputs = [ "out" "dev" ];
+  outputBin = "dev";
+
+  configureFlags = [
+    # not auto-detected by default
+    "--with-graphite2=${if withGraphite2 then "yes" else "no"}"
+    "--with-icu=${if withIcu then "yes" else "no"}"
+  ]
+    ++ stdenv.lib.optional withCoreText "--with-coretext=yes";
+
+  nativeBuildInputs = [ pkgconfig libintl ];
+
+  buildInputs = [ glib freetype cairo ] # recommended by upstream
+    ++ stdenv.lib.optionals withCoreText [ ApplicationServices CoreText ];
+
+  propagatedBuildInputs = []
+    ++ optional withGraphite2 graphite2
+    ++ optionals withIcu [ icu harfbuzz ];
+
+  checkInputs = [ python ];
+  doInstallCheck = false; # fails, probably a bug
+
+  # Slightly hacky; some pkgs expect them in a single directory.
+  postInstall = optionalString withIcu ''
+    rm "$out"/lib/libharfbuzz.* "$dev/lib/pkgconfig/harfbuzz.pc"
+    ln -s {'${harfbuzz.out}',"$out"}/lib/libharfbuzz.la
+    ln -s {'${harfbuzz.dev}',"$dev"}/lib/pkgconfig/harfbuzz.pc
+    ${optionalString stdenv.isDarwin ''
+      ln -s {'${harfbuzz.out}',"$out"}/lib/libharfbuzz.dylib
+      ln -s {'${harfbuzz.out}',"$out"}/lib/libharfbuzz.0.dylib
+    ''}
+  '';
+
+  meta = with stdenv.lib; {
+    description = "An OpenType text shaping engine";
+    homepage = http://www.freedesktop.org/wiki/Software/HarfBuzz;
+    downloadPage = "https://www.freedesktop.org/software/harfbuzz/release/";
+    maintainers = [ maintainers.eelco ];
+    license = licenses.mit;
+    platforms = with platforms; linux ++ darwin;
+    inherit version;
+    updateWalker = true;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/hawknl/default.nix b/nixpkgs/pkgs/development/libraries/hawknl/default.nix
new file mode 100644
index 000000000000..77c1ca07dc9c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/hawknl/default.nix
@@ -0,0 +1,30 @@
+{stdenv, fetchurl, unzip}:
+
+stdenv.mkDerivation {
+  name = "hawknl-1.68";
+
+  src = fetchurl {
+    url = http://urchlay.naptime.net/~urchlay/src/HawkNL168src.zip;
+    sha256 = "11shn2fbxj3w0j77w0234pqyj1368x686kkgv09q5yqhi1cdp028";
+  };
+
+  buildInputs = [ unzip ];
+
+  makefile = "makefile.linux";
+
+  patchPhase = ''
+    sed -i s/soname,NL/soname,libNL/ src/makefile.linux
+  '';
+
+  preInstall = ''
+    sed -i s,/usr/local,$out, src/makefile.linux
+    mkdir -p $out/lib $out/include
+  '';
+
+  meta = {
+    homepage = http://hawksoft.com/hawknl/;
+    description = "Free, open source, game oriented network API";
+    license = stdenv.lib.licenses.lgpl2Plus;
+    platforms = stdenv.lib.platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/herqq/default.nix b/nixpkgs/pkgs/development/libraries/herqq/default.nix
new file mode 100644
index 000000000000..a5f8f00a6bfd
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/herqq/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, qt5, unzip, fetchFromGitHub, qtmultimedia }:
+
+stdenv.mkDerivation rec {
+  version = "2.1.0";
+  name = "herqq-${version}";
+
+  nativeBuildInputs = [ qt5.qmake ];
+  buildInputs = [ qt5.qtbase unzip qtmultimedia ];
+  preConfigure = "cd herqq";
+
+  src = fetchFromGitHub {
+    owner = "ThomArmax";
+    repo = "HUPnP";
+    rev = version;
+    sha256 = "1w674rbwbhpirq70gp9rk6p068j36rwn112fx3nz613wgw63x84m";
+  };
+
+  meta = with stdenv.lib; {
+    homepage = http://herqq.org;
+    description = "A software library for building UPnP devices and control points";
+    platforms = platforms.linux;
+    maintainers = [ ];
+    broken = true; # 2018-09-21, built with qt510 (which was removed) but neither qt59 nor qt511
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/hidapi/default.nix b/nixpkgs/pkgs/development/libraries/hidapi/default.nix
new file mode 100644
index 000000000000..05e180161c0b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/hidapi/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchFromGitHub, autoreconfHook, pkgconfig, udev, libusb
+, darwin }:
+
+stdenv.mkDerivation rec {
+  name = "hidapi-0.8.0-rc1";
+
+  src = fetchFromGitHub {
+    owner = "signal11";
+    repo = "hidapi";
+    rev = name;
+    sha256 = "13d5jkmh9nh4c2kjch8k8amslnxapa9vkqzrk1z6rqmw8qgvzbkj";
+  };
+
+  nativeBuildInputs = [ autoreconfHook pkgconfig ];
+  buildInputs = [ ]
+    ++ stdenv.lib.optionals stdenv.isLinux [ udev libusb ];
+
+  propagatedBuildInputs = stdenv.lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [ IOKit Cocoa ]);
+
+  meta = with stdenv.lib; {
+    homepage = https://github.com/signal11/hidapi;
+    description = "Library for communicating with USB and Bluetooth HID devices";
+    # Actually, you can chose between GPLv3, BSD or HIDAPI license (more liberal)
+    license = licenses.bsd3;
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/hiredis-vip/default.nix b/nixpkgs/pkgs/development/libraries/hiredis-vip/default.nix
new file mode 100644
index 000000000000..59e168115a86
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/hiredis-vip/default.nix
@@ -0,0 +1,25 @@
+{ stdenv
+, lib
+, fetchFromGitHub
+}:
+
+stdenv.mkDerivation rec {
+  pname = "hiredis-vip";
+  version = "0.3.0";
+
+  src = fetchFromGitHub {
+    owner = "vipshop";
+    repo = "hiredis-vip";
+    rev = version;
+    sha256 = "1z9zry635pxqv6d2cgk3dghb5qfpg9m7dz34ld4djw9b53hjr2z2";
+  };
+
+  makeFlags = [ "PREFIX=$(out)" ];
+
+  meta = {
+    description = "A C client library for the Redis database";
+    homepage = https://github.com/vipshop/hiredis-vip;
+    license = lib.licenses.bsd3;
+  };
+
+}
diff --git a/nixpkgs/pkgs/development/libraries/hiredis/default.nix b/nixpkgs/pkgs/development/libraries/hiredis/default.nix
new file mode 100644
index 000000000000..13f7c4219069
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/hiredis/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, fetchFromGitHub }:
+
+stdenv.mkDerivation rec {
+  name = "hiredis-${version}";
+  version = "0.14.0";
+
+  src = fetchFromGitHub {
+    owner = "redis";
+    repo = "hiredis";
+    rev = "v${version}";
+    sha256 = "0ik38lwpmm780jqrry95ckf6flmvd172444p3q8d1k9n99jwij9c";
+  };
+
+  PREFIX = "\${out}";
+
+  meta = with stdenv.lib; {
+    homepage = https://github.com/redis/hiredis;
+    description = "Minimalistic C client for Redis >= 1.2";
+    license = licenses.bsd3;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/hivex/default.nix b/nixpkgs/pkgs/development/libraries/hivex/default.nix
new file mode 100644
index 000000000000..37f01372005c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/hivex/default.nix
@@ -0,0 +1,38 @@
+{ stdenv, fetchurl, pkgconfig, autoreconfHook, makeWrapper
+, perlPackages, libxml2, libiconv }:
+
+stdenv.mkDerivation rec {
+  name = "hivex-${version}";
+  version = "1.3.18";
+
+  src = fetchurl {
+    url = "http://libguestfs.org/download/hivex/${name}.tar.gz";
+    sha256 = "0ibl186l6rd9qj4rqccfwbg1nnx6z07vspkhk656x6zav67ph7la";
+  };
+
+  patches = [ ./hivex-syms.patch ];
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [
+    autoreconfHook makeWrapper libxml2
+  ]
+  ++ (with perlPackages; [ perl IOStringy ])
+  ++ stdenv.lib.optionals stdenv.isDarwin [ libiconv ];
+
+  postInstall = ''
+    wrapProgram $out/bin/hivexregedit \
+        --set PERL5LIB "$out/${perlPackages.perl.libPrefix}" \
+        --prefix "PATH" : "$out/bin"
+
+    wrapProgram $out/bin/hivexml \
+        --prefix "PATH" : "$out/bin"
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Windows registry hive extraction library";
+    license = licenses.lgpl2;
+    homepage = https://github.com/libguestfs/hivex;
+    maintainers = with maintainers; [offline];
+    platforms = platforms.linux ++ platforms.darwin;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/hivex/hivex-syms.patch b/nixpkgs/pkgs/development/libraries/hivex/hivex-syms.patch
new file mode 100644
index 000000000000..bacd34e8515d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/hivex/hivex-syms.patch
@@ -0,0 +1,13 @@
+diff -rupN hivex-1.3.14/lib/Makefile.am hivex-1.3.14-new/lib/Makefile.am
+--- hivex-1.3.14/lib/Makefile.am	2013-09-10 13:04:12.000000000 +0200
++++ hivex-1.3.14-new/lib/Makefile.am	2014-11-06 01:31:05.956106861 +0100
+@@ -40,8 +40,7 @@ libhivex_la_SOURCES = \
+ 
+ libhivex_la_LIBADD =  ../gnulib/lib/libgnu.la $(LTLIBOBJS)
+ libhivex_la_LDFLAGS = \
+-	-version-info 0:0:0 \
+-	$(VERSION_SCRIPT_FLAGS)$(srcdir)/hivex.syms \
++	-version-info 0:0:0
+ 	$(LTLIBICONV) \
+ 	$(LTLIBINTL) \
+ 	$(LTLIBTHREAD)
diff --git a/nixpkgs/pkgs/development/libraries/hotpatch/default.nix b/nixpkgs/pkgs/development/libraries/hotpatch/default.nix
new file mode 100644
index 000000000000..df3581cc8095
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/hotpatch/default.nix
@@ -0,0 +1,37 @@
+{ stdenv, fetchFromGitHub, cmake }:
+
+stdenv.mkDerivation rec {
+  name = "hotpatch-0.2";
+
+  src = fetchFromGitHub {
+    owner = "vikasnkumar";
+    repo = "hotpatch";
+    rev = "4b65e3f275739ea5aa798d4ad083c4cb10e29149";
+    sha256 = "169vdh55wsbn6fl58lpzqx64v6ifzh7krykav33x1d9hsk98qjqh";
+  };
+
+  enableParallelBuilding = true;
+  doCheck = true;
+
+  nativeBuildInputs = [ cmake ];
+
+  preConfigure = ''
+    substituteInPlace test/loader.c \
+      --replace \"/lib64/ld-linux-x86-64.so.2 \""$(cat $NIX_CC/nix-support/dynamic-linker)" \
+      --replace \"/lib/ld-linux-x86-64.so.2 \""$(cat $NIX_CC/nix-support/dynamic-linker)" \
+      --replace \"/lib/ld-linux.so.2 \""$(cat $NIX_CC/nix-support/dynamic-linker)" \
+      --replace \"/lib32/ld-linux.so.2 \""$(cat $NIX_CC/nix-support/dynamic-linker)"
+  '';
+
+  checkPhase = ''
+    LD_LIBRARY_PATH=$(pwd)/src make test
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Hot patching executables on Linux using .so file injection";
+    homepage = src.meta.homepage;
+    license = licenses.bsd3;
+    maintainers = [ maintainers.gnidorah ];
+    platforms = ["i686-linux" "x86_64-linux"];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/hpx/default.nix b/nixpkgs/pkgs/development/libraries/hpx/default.nix
new file mode 100644
index 000000000000..c00286664822
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/hpx/default.nix
@@ -0,0 +1,26 @@
+{ stdenv, fetchFromGitHub, boost, cmake, hwloc, gperftools, pkgconfig, python }:
+
+stdenv.mkDerivation rec {
+  name = "hpx-${version}";
+  version = "1.2.1";
+
+  src = fetchFromGitHub {
+    owner = "STEllAR-GROUP";
+    repo = "hpx";
+    rev = "${version}";
+    sha256 = "18dk9413qcgljdlw2jfkk21lwi4iwc57s41yqnc3jp8vdj96w32s";
+  };
+
+  buildInputs = [ boost hwloc gperftools ];
+  nativeBuildInputs = [ cmake pkgconfig python ];
+
+  enableParallelBuilding = true;
+
+  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 ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/hspell/default.nix b/nixpkgs/pkgs/development/libraries/hspell/default.nix
new file mode 100644
index 000000000000..32743e617970
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/hspell/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchurl, perl, zlib }:
+
+stdenv.mkDerivation rec {
+  name = "${passthru.pname}-${passthru.version}";
+
+  passthru = {
+    pname = "hspell";
+    version = "1.1";
+  };
+
+  PERL_USE_UNSAFE_INC = "1";
+
+  src = fetchurl {
+    url = "${meta.homepage}${name}.tar.gz";
+    sha256 = "08x7rigq5pa1pfpl30qp353hbdkpadr1zc49slpczhsn0sg36pd6";
+  };
+
+  patchPhase = ''patchShebangs .'';
+  buildInputs = [ perl zlib ];
+
+  meta = with stdenv.lib; {
+    description = "Hebrew spell checker";
+    homepage = http://hspell.ivrix.org.il/;
+    platforms = platforms.all;
+    license = licenses.gpl2;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/hspell/dicts.nix b/nixpkgs/pkgs/development/libraries/hspell/dicts.nix
new file mode 100644
index 000000000000..ec6b304dc3ce
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/hspell/dicts.nix
@@ -0,0 +1,44 @@
+{ stdenv, hspell }:
+
+let
+  dict = a: stdenv.mkDerivation ({
+    inherit (hspell) src patchPhase nativeBuildInputs;
+    meta = hspell.meta // {
+      broken = true;
+      description = "${a.buildFlags} Hebrew dictionary";
+    } // (if a ? meta then a.meta else {});
+  } // (removeAttrs a ["meta"]));
+in
+{
+  recurseForDerivations = true;
+
+  aspell = dict {
+    name = "aspell-dict-he-${hspell.version}";
+
+    buildFlags = "aspell";
+
+    installPhase = ''
+      mkdir -p $out/lib/aspell
+      cp -v he_affix.dat he.wl $out/lib/aspell'';
+  };
+
+  myspell = dict {
+    name = "myspell-dict-he-${hspell.version}";
+
+    buildFlags = "myspell";
+
+    installPhase = ''
+      mkdir -p $out/lib/myspell
+      cp -v he.dic he.aff $out/lib/myspell'';
+  };
+
+  hunspell = dict {
+    name = "hunspell-dict-he-${hspell.version}";
+
+    buildFlags = "hunspell";
+
+    installPhase = ''
+      mkdir -p $out/lib
+      cp -rv hunspell $out/lib'';
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/htmlcxx/default.nix b/nixpkgs/pkgs/development/libraries/htmlcxx/default.nix
new file mode 100644
index 000000000000..1537f9cc480b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/htmlcxx/default.nix
@@ -0,0 +1,20 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "htmlcxx-${version}";
+  version = "0.86";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/htmlcxx/htmlcxx/${version}/${name}.tar.gz";
+    sha256 = "1hgmyiad3qgbpf2dvv2jygzj6jpz4dl3n8ds4nql68a4l9g2nm07";
+  };
+
+  patches = [ ./ptrdiff.patch ];
+
+  meta = with stdenv.lib; {
+    homepage = http://htmlcxx.sourceforge.net/;
+    description = "A simple non-validating css1 and html parser for C++";
+    license = licenses.lgpl2;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/htmlcxx/ptrdiff.patch b/nixpkgs/pkgs/development/libraries/htmlcxx/ptrdiff.patch
new file mode 100644
index 000000000000..6348ba24f8da
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/htmlcxx/ptrdiff.patch
@@ -0,0 +1,13 @@
+diff -rc htmlcxx-orig-0.85/html/tree.h htmlcxx-0.85/html/tree.h
+*** htmlcxx-orig-0.85/html/tree.h	2015-09-02 13:57:17.988688798 +0200
+--- htmlcxx-0.85/html/tree.h	2015-09-02 13:57:52.737768811 +0200
+***************
+*** 45,50 ****
+--- 45,51 ----
+  #ifndef tree_hh_
+  #define tree_hh_
+  
++ #include <cstddef>
+  #include <cassert>
+  #include <memory>
+  #include <stdexcept>
diff --git a/nixpkgs/pkgs/development/libraries/http-parser/build-shared.patch b/nixpkgs/pkgs/development/libraries/http-parser/build-shared.patch
new file mode 100644
index 000000000000..5922cdfb5848
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/http-parser/build-shared.patch
@@ -0,0 +1,30 @@
+diff -Naur http-parser-2.1-orig/http_parser.gyp http-parser-2.1/http_parser.gyp
+--- http-parser-2.1-orig/http_parser.gyp	2013-03-26 18:35:20.000000000 -0400
++++ http-parser-2.1/http_parser.gyp	2013-05-23 16:47:49.280488341 -0400
+@@ -21,7 +21,7 @@
+       },
+       'Release': {
+         'defines': [ 'NDEBUG' ],
+-        'cflags': [ '-Wall', '-Wextra', '-O3' ],
++        'cflags': [ '-Wall', '-Wextra', '-O3', '-fPIC' ],
+         'msvs_settings': {
+           'VCCLCompilerTool': {
+             'RuntimeLibrary': 0, # static release
+@@ -50,7 +50,7 @@
+   'targets': [
+     {
+       'target_name': 'http_parser',
+-      'type': 'static_library',
++      'type': 'shared_library',
+       'include_dirs': [ '.' ],
+       'direct_dependent_settings': {
+         'defines': [ 'HTTP_PARSER_STRICT=0' ],
+@@ -73,7 +73,7 @@
+ 
+     {
+       'target_name': 'http_parser_strict',
+-      'type': 'static_library',
++      'type': 'shared_library',
+       'include_dirs': [ '.' ],
+       'direct_dependent_settings': {
+         'defines': [ 'HTTP_PARSER_STRICT=1' ],
diff --git a/nixpkgs/pkgs/development/libraries/http-parser/default.nix b/nixpkgs/pkgs/development/libraries/http-parser/default.nix
new file mode 100644
index 000000000000..68bf4ebec347
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/http-parser/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchFromGitHub }:
+
+let
+  version = "2.9.2";
+in stdenv.mkDerivation {
+  name = "http-parser-${version}";
+
+  src = fetchFromGitHub {
+    owner = "nodejs";
+    repo = "http-parser";
+    rev = "v${version}";
+    sha256 = "1qs6x3n2nrcj1wiik5pg5i16inykf7rcfdfdy7rwyzf40pvdl3c2";
+  };
+
+  NIX_CFLAGS_COMPILE = "-Wno-error";
+  patches = [ ./build-shared.patch ];
+  makeFlags = [ "DESTDIR=" "PREFIX=$(out)" ];
+  buildFlags = "library";
+  doCheck = true;
+  checkTarget = "test";
+
+  meta = with stdenv.lib; {
+    description = "An HTTP message parser written in C";
+    homepage = https://github.com/nodejs/http-parser;
+    maintainers = with maintainers; [ matthewbauer ];
+    license = licenses.mit;
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/hunspell/default.nix b/nixpkgs/pkgs/development/libraries/hunspell/default.nix
new file mode 100644
index 000000000000..3728c05e516c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/hunspell/default.nix
@@ -0,0 +1,54 @@
+{ stdenv, fetchurl, ncurses, readline, autoreconfHook }:
+
+stdenv.mkDerivation rec {
+  version = "1.7.0";
+  name = "hunspell-${version}";
+
+  src = fetchurl {
+    url = "https://github.com/hunspell/hunspell/archive/v${version}.tar.gz";
+    sha256 = "12mwwqz6qkx7q1lg9vpjiiwh4fk4c8xs6g6g0xa2ia0hp5pbh9xv";
+  };
+
+  outputs = [ "bin" "dev" "out" "man" ];
+
+  buildInputs = [ ncurses readline ];
+  nativeBuildInputs = [ autoreconfHook ];
+
+  postPatch = ''
+    patchShebangs tests
+  '';
+
+  autoreconfFlags = "-vfi";
+
+  configureFlags = [ "--with-ui" "--with-readline" ];
+
+  hardeningDisable = [ "format" ];
+
+  meta = with stdenv.lib; {
+    homepage = http://hunspell.sourceforge.net;
+    description = "Spell checker";
+    longDescription = ''
+      Hunspell is the spell checker of LibreOffice, OpenOffice.org, Mozilla
+      Firefox 3 & Thunderbird, Google Chrome, and it is also used by
+      proprietary software packages, like macOS, InDesign, memoQ, Opera and
+      SDL Trados.
+
+      Main features:
+
+      * Extended support for language peculiarities; Unicode character encoding, compounding and complex morphology.
+      * Improved suggestion using n-gram similarity, rule and dictionary based pronunciation data.
+      * Morphological analysis, stemming and generation.
+      * Hunspell is based on MySpell and works also with MySpell dictionaries.
+      * C++ library under GPL/LGPL/MPL tri-license.
+      * Interfaces and ports:
+        * Enchant (Generic spelling library from the Abiword project),
+        * XSpell (macOS port, but Hunspell is part of the macOS from version 10.6 (Snow Leopard), and
+            now it is enough to place Hunspell dictionary files into
+            ~/Library/Spelling or /Library/Spelling for spell checking),
+        * Delphi, Java (JNA, JNI), Perl, .NET, Python, Ruby ([1], [2]), UNO.
+    '';
+    platforms = platforms.all;
+    license = with licenses; [ gpl2 lgpl21 mpl11 ];
+    maintainers = with stdenv.lib.maintainers; [ fuuzetsu ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/hunspell/dictionaries.nix b/nixpkgs/pkgs/development/libraries/hunspell/dictionaries.nix
new file mode 100644
index 000000000000..b8de133f5025
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/hunspell/dictionaries.nix
@@ -0,0 +1,621 @@
+/* hunspell dictionaries */
+
+{ stdenv, fetchurl, fetchFromGitHub, unzip, coreutils, bash, which, zip, ispell, perl, hunspell }:
+
+
+let
+  mkDict =
+  { name, readmeFile, dictFileName, ... }@args:
+  stdenv.mkDerivation (rec {
+    inherit name;
+    installPhase = ''
+      # hunspell dicts
+      install -dm755 "$out/share/hunspell"
+      install -m644 ${dictFileName}.dic "$out/share/hunspell/"
+      install -m644 ${dictFileName}.aff "$out/share/hunspell/"
+      # myspell dicts symlinks
+      install -dm755 "$out/share/myspell/dicts"
+      ln -sv "$out/share/hunspell/${dictFileName}.dic" "$out/share/myspell/dicts/"
+      ln -sv "$out/share/hunspell/${dictFileName}.aff" "$out/share/myspell/dicts/"
+      # docs
+      install -dm755 "$out/share/doc"
+      install -m644 ${readmeFile} $out/share/doc/${name}.txt
+      runHook postInstall
+    '';
+  } // args);
+
+  mkDictFromRla =
+    { shortName, shortDescription, dictFileName }:
+    mkDict rec {
+      inherit dictFileName;
+      version = "2.2";
+      name = "hunspell-dict-${shortName}-rla-${version}";
+      readmeFile = "README.txt";
+      src = fetchFromGitHub {
+        owner = "sbosio";
+        repo = "rla-es";
+        rev = "v${version}";
+        sha256 = "0n9ms092k7vg7xpd3ksadxydbrizkb7js7dfxr08nbnnb9fgy0i8";
+      };
+      meta = with stdenv.lib; {
+        description = "Hunspell dictionary for ${shortDescription} from rla";
+        homepage = https://github.com/sbosio/rla-es;
+        license = with licenses; [ gpl3 lgpl3 mpl11 ];
+        maintainers = with maintainers; [ renzo ];
+        platforms = platforms.all;
+      };
+      phases = "unpackPhase patchPhase buildPhase installPhase";
+      buildInputs = [ bash coreutils unzip which zip ];
+      patchPhase = ''
+        substituteInPlace ortograf/herramientas/make_dict.sh \
+           --replace /bin/bash bash \
+           --replace /dev/stderr stderr.log
+
+        substituteInPlace ortograf/herramientas/remover_comentarios.sh \
+           --replace /bin/bash bash \
+      '';
+      buildPhase = ''
+        cd ortograf/herramientas
+        bash -x ./make_dict.sh -l ${dictFileName} -2
+        unzip ${dictFileName}.zip \
+          ${dictFileName}.dic ${dictFileName}.aff ${readmeFile}
+      '';
+    };
+
+  mkDictFromDSSO =
+    { shortName, shortDescription, dictFileName }:
+    mkDict rec {
+      inherit dictFileName;
+      version = "2.40";
+      # Should really use a string function or something
+      _version = "2-40";
+      name = "hunspell-dict-${shortName}-dsso-${version}";
+      _name = "ooo_swedish_dict_${_version}";
+      readmeFile = "LICENSE_en_US.txt";
+      src = fetchurl {
+        url = "https://extensions.libreoffice.org/extensions/swedish-spelling-dictionary-den-stora-svenska-ordlistan/${version}/@@download/file/${_name}.oxt";
+        sha256 = "b982881cc75f5c4af1199535bd4735ee476bdc48edf63e3f05fb4f715654a7bc";
+      };
+      meta = with stdenv.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
+        LibreOffice då dsso.se inte längre verkar vara med oss.
+        '';
+        description = "Hunspell dictionary for ${shortDescription} from LibreOffice";
+        license = licenses.lgpl3;
+        platforms = platforms.all;
+      };
+      buildInputs = [ unzip ];
+      phases = "unpackPhase installPhase";
+      sourceRoot = ".";
+      unpackCmd = ''
+      unzip $src dictionaries/${dictFileName}.dic dictionaries/${dictFileName}.aff $readmeFile
+      '';
+      installPhase = ''
+        # hunspell dicts
+        install -dm755 "$out/share/hunspell"
+        install -m644 dictionaries/${dictFileName}.dic "$out/share/hunspell/"
+        install -m644 dictionaries/${dictFileName}.aff "$out/share/hunspell/"
+        # myspell dicts symlinks
+        install -dm755 "$out/share/myspell/dicts"
+        ln -sv "$out/share/hunspell/${dictFileName}.dic" "$out/share/myspell/dicts/"
+        ln -sv "$out/share/hunspell/${dictFileName}.aff" "$out/share/myspell/dicts/"
+        # docs
+        install -dm755 "$out/share/doc"
+        install -m644 ${readmeFile} $out/share/doc/${name}.txt
+      '';
+    };
+
+  mkDictFromDicollecte =
+    { shortName, shortDescription, longDescription, dictFileName, isDefault ? false }:
+    mkDict rec {
+      inherit dictFileName;
+      version = "5.3";
+      name = "hunspell-dict-${shortName}-dicollecte-${version}";
+      readmeFile = "README_dict_fr.txt";
+      src = fetchurl {
+         url = "http://www.dicollecte.org/download/fr/hunspell-french-dictionaries-v${version}.zip";
+         sha256 = "0ca7084jm7zb1ikwzh1frvpb97jn27i7a5d48288h2qlfp068ik0";
+      };
+      meta = with stdenv.lib; {
+        inherit longDescription;
+        description = "Hunspell dictionary for ${shortDescription} from Dicollecte";
+        homepage = https://www.dicollecte.org/home.php?prj=fr;
+        license = licenses.mpl20;
+        maintainers = with maintainers; [ renzo ];
+        platforms = platforms.all;
+      };
+      buildInputs = [ unzip ];
+      phases = "unpackPhase installPhase";
+      sourceRoot = ".";
+      unpackCmd = ''
+        unzip $src ${dictFileName}.dic ${dictFileName}.aff ${readmeFile}
+      '';
+      postInstall = stdenv.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
+        done
+      '';
+    };
+
+  mkDictFromWordlist =
+    { shortName, shortDescription, dictFileName, src }:
+    mkDict rec {
+      inherit src dictFileName;
+      version = "2018.04.16";
+      name = "hunspell-dict-${shortName}-wordlist-${version}";
+      readmeFile = "README_" + dictFileName + ".txt";
+      meta = with stdenv.lib; {
+        description = "Hunspell dictionary for ${shortDescription} from Wordlist";
+        homepage = http://wordlist.aspell.net/;
+        license = licenses.bsd3;
+        maintainers = with maintainers; [ renzo ];
+        platforms = platforms.all;
+      };
+      buildInputs = [ unzip ];
+      phases = "unpackPhase installPhase";
+      sourceRoot = ".";
+      unpackCmd = ''
+        unzip $src ${dictFileName}.dic ${dictFileName}.aff ${readmeFile}
+      '';
+    };
+
+  mkDictFromLinguistico =
+    { shortName, shortDescription, dictFileName, src }:
+    mkDict rec {
+      inherit src dictFileName;
+      version = "2.4";
+      name = "hunspell-dict-${shortName}-linguistico-${version}";
+      readmeFile = dictFileName + "_README.txt";
+      meta = with stdenv.lib; {
+        description = "Hunspell dictionary for ${shortDescription}";
+        homepage = https://sourceforge.net/projects/linguistico/;
+        license = licenses.gpl3;
+        maintainers = with maintainers; [ renzo ];
+        platforms = platforms.all;
+      };
+      buildInputs = [ unzip ];
+      phases = "unpackPhase patchPhase installPhase";
+      sourceRoot = ".";
+      prePatch = ''
+        # Fix dic file empty lines (FS#22275)
+        sed '/^\/$/d' -i ${dictFileName}.dic
+      '';
+      unpackCmd = ''
+        unzip $src ${dictFileName}.dic ${dictFileName}.aff ${readmeFile}
+      '';
+    };
+
+  mkDictFromXuxen =
+    { shortName, srcs, shortDescription, longDescription, dictFileName }:
+    stdenv.mkDerivation rec {
+      name = "hunspell-dict-${shortName}-xuxen-${version}";
+      version = "5-2015.11.10";
+
+      inherit srcs;
+
+      phases = ["unpackPhase" "installPhase"];
+      sourceRoot = ".";
+      # Copy files stripping until first dash (path and hash)
+      unpackCmd = "cp $curSrc \${curSrc##*-}";
+      installPhase = ''
+        # hunspell dicts
+        install -dm755 "$out/share/hunspell"
+        install -m644 ${dictFileName}.dic "$out/share/hunspell/"
+        install -m644 ${dictFileName}.aff "$out/share/hunspell/"
+        # myspell dicts symlinks
+        install -dm755 "$out/share/myspell/dicts"
+        ln -sv "$out/share/hunspell/${dictFileName}.dic" "$out/share/myspell/dicts/"
+        ln -sv "$out/share/hunspell/${dictFileName}.aff" "$out/share/myspell/dicts/"
+      '';
+
+      meta = with stdenv.lib; {
+        homepage = http://xuxen.eus/;
+        description = shortDescription;
+        longDescription = longDescription;
+        license = licenses.gpl2;
+        maintainers = with maintainers; [ zalakain ];
+        platforms = platforms.all;
+      };
+    };
+
+  mkDictFromJ3e =
+    { shortName, shortDescription, dictFileName }:
+    stdenv.mkDerivation rec {
+      name = "hunspell-dict-${shortName}-j3e-${version}";
+      version = "20161207";
+
+      src = fetchurl {
+        url = "https://j3e.de/ispell/igerman98/dict/igerman98-${version}.tar.bz2";
+        sha256 = "1a3055hp2bc4q4nlg3gmg0147p3a1zlfnc65xiv2v9pyql1nya8p";
+      };
+
+      buildInputs = [ ispell perl hunspell ];
+
+      phases = ["unpackPhase" "installPhase"];
+      installPhase = ''
+        patchShebangs bin
+        make hunspell/${dictFileName}.aff hunspell/${dictFileName}.dic
+        # hunspell dicts
+        install -dm755 "$out/share/hunspell"
+        install -m644 hunspell/${dictFileName}.dic "$out/share/hunspell/"
+        install -m644 hunspell/${dictFileName}.aff "$out/share/hunspell/"
+        # myspell dicts symlinks
+        install -dm755 "$out/share/myspell/dicts"
+        ln -sv "$out/share/hunspell/${dictFileName}.dic" "$out/share/myspell/dicts/"
+        ln -sv "$out/share/hunspell/${dictFileName}.aff" "$out/share/myspell/dicts/"
+      '';
+
+      meta = with stdenv.lib; {
+        homepage = https://www.j3e.de/ispell/igerman98/index_en.html;
+        description = shortDescription;
+        license = with licenses; [ gpl2 gpl3 ];
+        maintainers = with maintainers; [ timor ];
+        platforms = platforms.all;
+      };
+    };
+
+  mkDictFromLibreOffice =
+    { shortName
+    , shortDescription
+    , dictFileName
+    , license
+    , readmeFile ? "README_${dictFileName}.txt"
+    , sourceRoot ? dictFileName }:
+    mkDict rec {
+      name = "hunspell-dict-${shortName}-libreoffice-${version}";
+      version = "6.2.0.3";
+      inherit dictFileName readmeFile;
+      src = fetchFromGitHub {
+        owner = "LibreOffice";
+        repo = "dictionaries";
+        rev = "libreoffice-${version}";
+        sha256 = "0rw9ahhynia5wsgyd67lrhinqqn1s1rizgiykb3palbyk0lv72xj";
+      };
+      buildPhase = ''
+        cp -a ${sourceRoot}/* .
+      '';
+      meta = with stdenv.lib; {
+        homepage = https://wiki.documentfoundation.org/Development/Dictionaries;
+        description = "Hunspell dictionary for ${shortDescription} from LibreOffice";
+        license = license;
+        maintainers = with maintainers; [ vlaci ];
+        platforms = platforms.all;
+      };
+    };
+
+in {
+
+  /* ENGLISH */
+
+  en-us = mkDictFromWordlist {
+    shortName = "en-us";
+    shortDescription = "English (United States)";
+    dictFileName = "en_US";
+    src = fetchurl {
+      url = mirror://sourceforge/wordlist/speller/2018.04.16/hunspell-en_US-2018.04.16.zip;
+      sha256 = "18hbncvqnckzqarrmnzk58plymjqyi93k4qj98fac5mr71jbmzaf";
+    };
+  };
+
+  en-ca = mkDictFromWordlist {
+    shortName = "en-ca";
+    shortDescription = "English (Canada)";
+    dictFileName = "en_CA";
+    src = fetchurl {
+      url = mirror://sourceforge/wordlist/speller/2018.04.16/hunspell-en_CA-2018.04.16.zip;
+      sha256 = "06yf3s7y1215jmikbs18cn4j8a13csp4763w3jfgah8zlim6vc47";
+    };
+  };
+
+  en-gb-ise = mkDictFromWordlist {
+    shortName = "en-gb-ise";
+    shortDescription = "English (United Kingdom, 'ise' ending)";
+    dictFileName = "en_GB-ise";
+    src = fetchurl {
+      url = mirror://sourceforge/wordlist/speller//hunspell-en_GB-ise-2018.04.16.zip;
+      sha256 = "0ylg1zvfvsawamymcc9ivrqcb9qhlpgpnizm076xc56jz554xc2l";
+    };
+  };
+
+  en-gb-ize = mkDictFromWordlist {
+    shortName = "en-gb-ize";
+    shortDescription = "English (United Kingdom, 'ize' ending)";
+    dictFileName = "en_GB-ize";
+    src = fetchurl {
+      url = mirror://sourceforge/wordlist/speller//hunspell-en_GB-ize-2018.04.16.zip;
+      sha256 = "1rmwy6sxmd400cwjf58az6g14sq28p18f5mlq8ybg8y33q9m42ps";
+    };
+  };
+
+  /* SPANISH */
+
+  es-any = mkDictFromRla {
+    shortName = "es-any";
+    shortDescription = "Spanish (any variant)";
+    dictFileName = "es_ANY";
+  };
+
+  es-ar = mkDictFromRla {
+    shortName = "es-ar";
+    shortDescription = "Spanish (Argentina)";
+    dictFileName = "es_AR";
+  };
+
+  es-bo = mkDictFromRla {
+    shortName = "es-bo";
+    shortDescription = "Spanish (Bolivia)";
+    dictFileName = "es_BO";
+  };
+
+  es-cl = mkDictFromRla {
+    shortName = "es-cl";
+    shortDescription = "Spanish (Chile)";
+    dictFileName = "es_CL";
+  };
+
+  es-co = mkDictFromRla {
+    shortName = "es-co";
+    shortDescription = "Spanish (Colombia)";
+    dictFileName = "es_CO";
+  };
+
+  es-cr = mkDictFromRla {
+    shortName = "es-cr";
+    shortDescription = "Spanish (Costra Rica)";
+    dictFileName = "es_CR";
+  };
+
+  es-cu = mkDictFromRla {
+    shortName = "es-cu";
+    shortDescription = "Spanish (Cuba)";
+    dictFileName = "es_CU";
+  };
+
+  es-do = mkDictFromRla {
+    shortName = "es-do";
+    shortDescription = "Spanish (Dominican Republic)";
+    dictFileName = "es_DO";
+  };
+
+  es-ec = mkDictFromRla {
+    shortName = "es-ec";
+    shortDescription = "Spanish (Ecuador)";
+    dictFileName = "es_EC";
+  };
+
+  es-es = mkDictFromRla {
+    shortName = "es-es";
+    shortDescription = "Spanish (Spain)";
+    dictFileName = "es_ES";
+  };
+
+  es-gt = mkDictFromRla {
+    shortName = "es-gt";
+    shortDescription = "Spanish (Guatemala)";
+    dictFileName = "es_GT";
+  };
+
+  es-hn = mkDictFromRla {
+    shortName = "es-hn";
+    shortDescription = "Spanish (Honduras)";
+    dictFileName = "es_HN";
+  };
+
+  es-mx = mkDictFromRla {
+    shortName = "es-mx";
+    shortDescription = "Spanish (Mexico)";
+    dictFileName = "es_MX";
+  };
+
+  es-ni = mkDictFromRla {
+    shortName = "es-ni";
+    shortDescription = "Spanish (Nicaragua)";
+    dictFileName = "es_NI";
+  };
+
+  es-pa = mkDictFromRla {
+    shortName = "es-pa";
+    shortDescription = "Spanish (Panama)";
+    dictFileName = "es_PA";
+  };
+
+  es-pe = mkDictFromRla {
+    shortName = "es-pe";
+    shortDescription = "Spanish (Peru)";
+    dictFileName = "es_PE";
+  };
+
+  es-pr = mkDictFromRla {
+    shortName = "es-pr";
+    shortDescription = "Spanish (Puerto Rico)";
+    dictFileName = "es_PR";
+  };
+
+  es-py = mkDictFromRla {
+    shortName = "es-py";
+    shortDescription = "Spanish (Paraguay)";
+    dictFileName = "es_PY";
+  };
+
+  es-sv = mkDictFromRla {
+    shortName = "es-sv";
+    shortDescription = "Spanish (El Salvador)";
+    dictFileName = "es_SV";
+  };
+
+  es-uy = mkDictFromRla {
+    shortName = "es-uy";
+    shortDescription = "Spanish (Uruguay)";
+    dictFileName = "es_UY";
+  };
+
+  es-ve = mkDictFromRla {
+    shortName = "es-ve";
+    shortDescription = "Spanish (Venezuela)";
+    dictFileName = "es_VE";
+  };
+
+  /* FRENCH */
+
+  fr-any = mkDictFromDicollecte {
+    shortName = "fr-any";
+    dictFileName = "fr-toutesvariantes";
+    shortDescription = "French (any variant)";
+    longDescription = ''
+      Ce dictionnaire contient les nouvelles et les anciennes graphies des
+      mots concernés par la réforme de 1990.
+    '';
+  };
+
+  fr-classique = mkDictFromDicollecte {
+    shortName = "fr-classique";
+    dictFileName = "fr-classique";
+    shortDescription = "French (classic)";
+    longDescription = ''
+      Ce dictionnaire est une extension du dictionnaire «Moderne» et propose
+      en sus des graphies alternatives, parfois encore très usitées, parfois
+      tombées en désuétude.
+    '';
+  };
+
+  fr-moderne = mkDictFromDicollecte {
+    shortName = "fr-moderne";
+    dictFileName = "fr-moderne";
+    shortDescription = "French (modern)";
+    longDescription = ''
+      Ce dictionnaire propose une sélection des graphies classiques et
+      réformées, suivant la lente évolution de l’orthographe actuelle. Ce
+      dictionnaire contient les graphies les moins polémiques de la réforme.
+    '';
+    isDefault = true;
+  };
+
+  fr-reforme1990 = mkDictFromDicollecte {
+    shortName = "fr-reforme1990";
+    dictFileName = "fr-reforme1990";
+    shortDescription = "French (1990 reform)";
+    longDescription = ''
+      Ce dictionnaire ne connaît que les graphies nouvelles des mots concernés
+      par la réforme de 1990.
+    '';
+  };
+
+  /* ITALIAN */
+
+  it-it =  mkDictFromLinguistico rec {
+    shortName = "it-it";
+    dictFileName = "it_IT";
+    shortDescription = "Hunspell dictionary for 'Italian (Italy)' from Linguistico";
+    src = fetchurl {
+      url = mirror://sourceforge/linguistico/italiano_2_4_2007_09_01.zip;
+      sha256 = "0m9frz75fx456bczknay5i446gdcp1smm48lc0qfwzhz0j3zcdrd";
+    };
+  };
+
+  /* BASQUE */
+
+  eu-es = mkDictFromXuxen {
+    shortName = "eu-es";
+    dictFileName = "eu_ES";
+    shortDescription = "Basque (Xuxen 5)";
+    longDescription = ''
+      Itxura berritzeaz gain, testuak zuzentzen laguntzeko zenbait hobekuntza
+      egin dira Xuxen.eus-en. Lexikoari dagokionez, 18645 sarrera berri erantsi
+      ditugu, eta proposamenak egiteko sistema ere aldatu dugu. Esate baterako,
+      gaizki idatzitako hitz baten inguruko proposamenak eskuratzeko, euskaraz
+      idaztean egiten ditugun akats arruntenak hartu dira kontuan. Sistemak
+      ematen dituen proposamenak ordenatzeko, berriz, aipatutako irizpidea
+      erabiltzeaz gain, Internetetik automatikoki eskuratutako euskarazko corpus
+      bateko datuen arabera ordenatu daitezke emaitzak. Erabiltzaileak horrela
+      ordenatu nahi baditu proposamenak, hautatu egin behar du aukera hori
+      testu-kutxaren azpian dituen aukeren artean. Interesgarria da proposamenak
+      ordenatzeko irizpide hori, hala sistemak formarik erabilienak proposatuko
+      baitizkigu gutxiago erabiltzen direnen aurretik.
+    '';
+    srcs = [
+      (fetchurl {
+        url = "http://xuxen.eus/static/hunspell/eu_ES.aff";
+        sha256 = "12w2j6phzas2rdzc7f20jnk93sm59m2zzfdgxv6p8nvcvbrkmc02";
+      })
+      (fetchurl {
+        url = "http://xuxen.eus/static/hunspell/eu_ES.dic";
+        sha256 = "0lw193jr7ldvln5x5z9p21rz1by46h0say9whfcw2kxs9vprd5b3";
+      })
+    ];
+  };
+
+  /* HUNGARIAN */
+
+  hu-hu = mkDictFromLibreOffice {
+    shortName = "hu-hu";
+    dictFileName = "hu_HU";
+    shortDescription = "Hungarian (Hungary)";
+    license = with stdenv.lib.licenses; [ mpl20 lgpl3 ];
+  };
+
+  /* SWEDISH */
+  
+  sv-se = mkDictFromDSSO rec {
+    shortName = "sv-se";
+    dictFileName = "sv_SE";
+    shortDescription = "Swedish (Sweden)";
+  };
+
+  # Finlandian Swedish (hello Linus Torvalds)
+  sv-fi = mkDictFromDSSO rec {
+    shortName = "sv-fi";
+    dictFileName = "sv_FI";
+    shortDescription = "Swedish (Finland)";
+  };
+  
+  /* GERMAN */
+
+  de-de = mkDictFromJ3e {
+    shortName = "de-de";
+    shortDescription = "German (Germany)";
+    dictFileName = "de_DE";
+  };
+
+  de-at = mkDictFromJ3e {
+    shortName = "de-at";
+    shortDescription = "German (Austria)";
+    dictFileName = "de_AT";
+  };
+
+  de-ch = mkDictFromJ3e {
+    shortName = "de-ch";
+    shortDescription = "German (Switzerland)";
+    dictFileName = "de_CH";
+  };
+
+  /* UKRAINIAN */
+
+  uk-ua = mkDict rec {
+    name = "hunspell-dict-uk-ua-${version}";
+    version = "4.2.5";
+    _version = "4-2.5";
+
+    src = fetchurl {
+      url = "https://extensions.libreoffice.org/extensions/ukrainian-spelling-dictionary-and-thesaurus/${_version}/@@download/file/dict-uk_UA-${version}.oxt";
+      sha256 = "1s2i9cd569g97kafrswczvwmvg7m9aks8qsbxd1mi73zy2y1r7n4";
+    };
+
+    dictFileName = "uk_UA";
+    readmeFile = "README_uk_UA.txt";
+    nativeBuildInputs = [ unzip ];
+    unpackCmd = ''
+      unzip $src ${dictFileName}/{${dictFileName}.dic,${dictFileName}.aff,${readmeFile}}
+    '';
+
+    meta = with stdenv.lib; {
+      description = "Hunspell dictionary for Ukrainian (Ukraine) from LibreOffice";
+      homepage = https://extensions.libreoffice.org/extensions/ukrainian-spelling-dictionary-and-thesaurus/;
+      license = licenses.mpl20;
+      maintainers = with maintainers; [ dywedir ];
+      platforms = platforms.all;
+    };
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/hunspell/wrapper.nix b/nixpkgs/pkgs/development/libraries/hunspell/wrapper.nix
new file mode 100644
index 000000000000..34c3d26c55ec
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/hunspell/wrapper.nix
@@ -0,0 +1,13 @@
+{ stdenv, lib, hunspell, makeWrapper, dicts ? [] }:
+with lib;
+let
+  searchPath = makeSearchPath "share/hunspell" dicts;
+in
+stdenv.mkDerivation {
+  name = (appendToName "with-dicts" hunspell).name;
+  buildInputs = [ makeWrapper ];
+  buildCommand = ''
+    makeWrapper ${hunspell.bin}/bin/hunspell $out/bin/hunspell --prefix DICPATH : ${searchPath}
+  '';
+  meta = removeAttrs hunspell.meta ["outputsToInstall"];
+}
diff --git a/nixpkgs/pkgs/development/libraries/hwloc/default.nix b/nixpkgs/pkgs/development/libraries/hwloc/default.nix
new file mode 100644
index 000000000000..5866d6b8fedb
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/hwloc/default.nix
@@ -0,0 +1,87 @@
+{ stdenv, fetchurl, pkgconfig, expat, ncurses, pciutils, numactl
+, x11Support ? false, libX11 ? null, cairo ? null
+}:
+
+assert x11Support -> libX11 != null && cairo != null;
+
+with stdenv.lib;
+
+let
+  version = "2.0.4";
+  versmm = versions.major version + "." + versions.minor version;
+  name = "hwloc-${version}";
+
+in stdenv.mkDerivation {
+  inherit name;
+
+  src = fetchurl {
+    url = "http://www.open-mpi.org/software/hwloc/v${versmm}/downloads/${name}.tar.bz2";
+    sha256 = "1aa7s208gdijk19vvzzahyl8pglk1va3yd6kdbpfa5pz5ms0ag35";
+  };
+
+  configureFlags = [
+    "--localstatedir=/var"
+    "--enable-netloc"
+  ];
+
+  # XXX: libX11 is not directly needed, but needed as a propagated dep of Cairo.
+  nativeBuildInputs = [ pkgconfig ];
+
+  # Filter out `null' inputs.  This allows users to `.override' the
+  # derivation and set optional dependencies to `null'.
+  buildInputs = stdenv.lib.filter (x: x != null)
+   ([ expat ncurses ]
+     ++  (optionals x11Support [ cairo libX11 ])
+     ++  (optionals stdenv.isLinux [ numactl ]));
+
+  propagatedBuildInputs =
+    # Since `libpci' appears in `hwloc.pc', it must be propagated.
+    optional stdenv.isLinux pciutils;
+
+  enableParallelBuilding = true;
+
+  postInstall =
+    optionalString (stdenv.isLinux && numactl != null)
+      '' if [ -d "${numactl}/lib64" ]
+         then
+             numalibdir="${numactl}/lib64"
+         else
+             numalibdir="${numactl}/lib"
+             test -d "$numalibdir"
+         fi
+
+         sed -i "$lib/lib/libhwloc.la" \
+             -e "s|-lnuma|-L$numalibdir -lnuma|g"
+      '';
+
+  # Checks disabled because they're impure (hardware dependent) and
+  # fail on some build machines.
+  doCheck = false;
+
+  outputs = [ "out" "lib" "dev" "doc" "man" ];
+
+  meta = {
+    description = "Portable abstraction of hierarchical architectures for high-performance computing";
+    longDescription = ''
+       hwloc provides a portable abstraction (across OS,
+       versions, architectures, ...) of the hierarchical topology of
+       modern architectures, including NUMA memory nodes, sockets,
+       shared caches, cores and simultaneous multithreading.  It also
+       gathers various attributes such as cache and memory
+       information.  It primarily aims at helping high-performance
+       computing applications with gathering information about the
+       hardware so as to exploit it accordingly and efficiently.
+
+       hwloc may display the topology in multiple convenient
+       formats.  It also offers a powerful programming interface to
+       gather information about the hardware, bind processes, and much
+       more.
+    '';
+
+    # http://www.open-mpi.org/projects/hwloc/license.php
+    license = licenses.bsd3;
+    homepage = https://www.open-mpi.org/projects/hwloc/;
+    maintainers = with maintainers; [ fpletz markuskowa ];
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/hyena/default.nix b/nixpkgs/pkgs/development/libraries/hyena/default.nix
new file mode 100644
index 000000000000..09b7751c8284
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/hyena/default.nix
@@ -0,0 +1,41 @@
+{ stdenv, fetchurl, pkgconfig, 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";
+    sha256 = "eb7154a42b6529bb9746c39272719f3168d6363ed4bad305a916ed7d90bc8de9";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [
+    mono gtk-sharp-2_0
+  ];
+
+  postPatch = ''
+    patchShebangs build/dll-map-makefile-verifier
+    patchShebangs build/private-icon-theme-installer
+    substituteInPlace configure --replace lib/mono/2.0/ lib/mono/2.0-api/
+    find -name Makefile.in | xargs -n 1 -d '\n' sed -e 's/^dnl/#/' -i
+  '';
+
+  dontStrip = true;
+
+  inherit monoDLLFixer;
+
+  meta = with stdenv.lib; {
+    homepage = "https://wiki.gnome.org/Attic/Hyena";
+    description = "A C# library which contains a hodge-podge of random stuff";
+    longDescription = ''
+      Hyena is a C# library used to make awesome applications. It contains a lot of random things,
+      including useful data structures, a Sqlite-based db layer, cool widgets, a JSON library,
+      a smart job/task scheduler, a user-query/search parser, and much more. It's particularly
+      useful for Gtk# applications, though only the Hyena.Gui assembly requires Gtk#.
+    '';
+    platforms = platforms.all;
+    maintainers = with maintainers; [ obadz ];
+    license = licenses.mit;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/hyperscan/default.nix b/nixpkgs/pkgs/development/libraries/hyperscan/default.nix
new file mode 100644
index 000000000000..bc0ce15a083d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/hyperscan/default.nix
@@ -0,0 +1,67 @@
+{ stdenv, fetchFromGitHub, cmake, ragel, python3
+, coreutils, gnused, utillinux
+, boost
+, withStatic ? false # build only shared libs by default, build static+shared if true
+}:
+
+# NOTICE: pkgconfig, pcap and pcre intentionally omitted from build inputs
+#         pcap used only in examples, pkgconfig used only to check for pcre
+#         which is fixed 8.41 version requirement (nixpkgs have 8.42+, and
+#         I not see any reason (for now) to backport 8.41.
+
+stdenv.mkDerivation rec {
+  pname = "hyperscan";
+  version = "5.1.1";
+
+  src = fetchFromGitHub {
+    owner = "intel";
+    repo = pname;
+    sha256 = "11adkz5ln2d2jywwlmixfnwqp5wxskq1104hmmcpws590lhkjv6j";
+    rev = "v${version}";
+  };
+
+  outputs = [ "out" "dev" ];
+
+  buildInputs = [ boost ];
+  nativeBuildInputs = [
+    cmake ragel python3
+    # Consider simply using busybox for these
+    # Need at least: rev, sed, cut, nm
+    coreutils gnused utillinux
+  ];
+
+  cmakeFlags = [
+    "-DFAT_RUNTIME=ON"
+    "-DBUILD_AVX512=ON"
+  ]
+  ++ stdenv.lib.optional (withStatic) "-DBUILD_STATIC_AND_SHARED=ON"
+  ++ stdenv.lib.optional (!withStatic) "-DBUILD_SHARED_LIBS=ON";
+
+  postPatch = ''
+    sed -i '/examples/d' CMakeLists.txt
+    substituteInPlace libhs.pc.in \
+      --replace "libdir=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@" "libdir=@CMAKE_INSTALL_LIBDIR@" \
+      --replace "includedir=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR@" "includedir=@CMAKE_INSTALL_INCLUDEDIR@"
+  '';
+
+  meta = with stdenv.lib; {
+    description = "High-performance multiple regex matching library";
+    longDescription = ''
+      Hyperscan is a high-performance multiple regex matching library.
+      It follows the regular expression syntax of the commonly-used
+      libpcre library, but is a standalone library with its own C API.
+
+      Hyperscan uses hybrid automata techniques to allow simultaneous
+      matching of large numbers (up to tens of thousands) of regular
+      expressions and for the matching of regular expressions across 
+      streams of data.
+
+      Hyperscan is typically used in a DPI library stack.
+    '';
+
+    homepage = "https://www.hyperscan.io/";
+    maintainers = with maintainers; [ avnik ];
+    platforms = [ "x86_64-linux" ]; # can't find nm on darwin ; might build on aarch64 but untested
+    license = licenses.bsd3;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/icu/58.nix b/nixpkgs/pkgs/development/libraries/icu/58.nix
new file mode 100644
index 000000000000..f7763ba49da1
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/icu/58.nix
@@ -0,0 +1,14 @@
+fetchurl:
+let
+  keywordFix = fetchurl {
+    url = "http://bugs.icu-project.org/trac/changeset/39484?format=diff";
+    name = "icu-changeset-39484.diff";
+    sha256 = "0hxhpgydalyxacaaxlmaddc1sjwh65rsnpmg0j414mnblq74vmm8";
+  };
+in
+import ./base.nix {
+  version = "58.2";
+  sha256 = "036shcb3f8bm1lynhlsb4kpjm9s9c2vdiir01vg216rs2l8482ib";
+  patches = [ keywordFix ];
+  patchFlags = "-p4";
+}
diff --git a/nixpkgs/pkgs/development/libraries/icu/59.nix b/nixpkgs/pkgs/development/libraries/icu/59.nix
new file mode 100644
index 000000000000..9ca66ca525fd
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/icu/59.nix
@@ -0,0 +1,4 @@
+import ./base.nix {
+  version = "59.1";
+  sha256 = "1zkmbg2932ggvpgjp8pys0cj6z8bw087y8858009shkrjfpzscki";
+}
diff --git a/nixpkgs/pkgs/development/libraries/icu/60.nix b/nixpkgs/pkgs/development/libraries/icu/60.nix
new file mode 100644
index 000000000000..e56135b15c62
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/icu/60.nix
@@ -0,0 +1,4 @@
+import ./base.nix {
+  version = "60.2";
+  sha256 = "065l3n0q9wqaw8dz20x82srshhm6i987fr9ync5xf9mr6n7ylwzh";
+}
diff --git a/nixpkgs/pkgs/development/libraries/icu/63.nix b/nixpkgs/pkgs/development/libraries/icu/63.nix
new file mode 100644
index 000000000000..719318990c62
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/icu/63.nix
@@ -0,0 +1,14 @@
+{ stdenv, lib, fetchurl, fetchpatch, fixDarwinDylibNames, nativeBuildRoot }:
+
+import ./base.nix {
+  version = "63.1";
+  sha256 = "17fbk0lm2clsxbmjzvyp245ayx0n4chji3ky1f3fbz2ljjv91i05";
+  patches = [
+    # https://bugzilla.mozilla.org/show_bug.cgi?id=1499398
+    (fetchpatch {
+      url = https://github.com/unicode-org/icu/commit/8baff8f03e07d8e02304d0c888d0bb21ad2eeb01.patch;
+      sha256 = "1awfa98ljcf95a85cssahw6bvdnpbq5brf1kgspy14w4mlmhd0jb";
+    })
+  ];
+  patchFlags = [ "-p3" ];
+} { inherit stdenv lib fetchurl fixDarwinDylibNames nativeBuildRoot; }
diff --git a/nixpkgs/pkgs/development/libraries/icu/64.nix b/nixpkgs/pkgs/development/libraries/icu/64.nix
new file mode 100644
index 000000000000..c7bdd22c1793
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/icu/64.nix
@@ -0,0 +1,4 @@
+import ./base.nix {
+  version = "64.2";
+  sha256 = "0v0xsf14xwlj125y9fd8lrhsaych4d8liv8gr746zng6g225szb2";
+}
diff --git a/nixpkgs/pkgs/development/libraries/icu/base.nix b/nixpkgs/pkgs/development/libraries/icu/base.nix
new file mode 100644
index 000000000000..0a8cb7d46843
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/icu/base.nix
@@ -0,0 +1,95 @@
+{ version, sha256, patches ? [], patchFlags ? "" }:
+{ stdenv, lib, fetchurl, fixDarwinDylibNames
+  # Cross-compiled icu4c requires a build-root of a native compile
+, buildRootOnly ? false, nativeBuildRoot
+}:
+
+let
+  pname = "icu4c";
+
+  baseAttrs = {
+    src = fetchurl {
+      url = "http://download.icu-project.org/files/${pname}/${version}/${pname}-"
+        + (stdenv.lib.replaceChars ["."] ["_"] version) + "-src.tgz";
+      inherit sha256;
+    };
+
+    postUnpack = ''
+      sourceRoot=''${sourceRoot}/source
+      echo Source root reset to ''${sourceRoot}
+    '';
+
+    # https://sourceware.org/glibc/wiki/Release/2.26#Removal_of_.27xlocale.h.27
+    postPatch = if (stdenv.hostPlatform.libc == "glibc" || stdenv.hostPlatform.libc == "musl") && lib.versionOlder version "62.1"
+      then "substituteInPlace i18n/digitlst.cpp --replace '<xlocale.h>' '<locale.h>'"
+      else null; # won't find locale_t on darwin
+
+    inherit patchFlags patches;
+
+    preConfigure = ''
+      sed -i -e "s|/bin/sh|${stdenv.shell}|" configure
+
+      # $(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 ''
+      # 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}";
+
+    enableParallelBuilding = true;
+
+    meta = with stdenv.lib; {
+      description = "Unicode and globalization support library";
+      homepage = http://site.icu-project.org/;
+      maintainers = with maintainers; [ raskin ];
+      platforms = platforms.all;
+    };
+  };
+
+  realAttrs = baseAttrs // {
+    name = pname + "-" + version;
+
+    outputs = [ "out" "dev" ];
+    outputBin = "dev";
+
+    # FIXME: This fixes dylib references in the dylibs themselves, but
+    # not in the programs in $out/bin.
+    buildInputs = stdenv.lib.optional stdenv.isDarwin fixDarwinDylibNames;
+
+    # remove dependency on bootstrap-tools in early stdenv build
+    postInstall = stdenv.lib.optionalString stdenv.isDarwin ''
+      sed -i 's/INSTALL_CMD=.*install/INSTALL_CMD=install/' $out/lib/icu/${version}/pkgdata.inc
+    '' + ''
+      substituteInPlace "$dev/bin/icu-config" \
+        --replace \''${pkglibdir}/Makefile.inc "$dev/lib/icu/Makefile.inc"
+    '';
+
+    postFixup = ''moveToOutput lib/icu "$dev" '';
+  };
+
+  buildRootOnlyAttrs = baseAttrs // {
+    name = pname + "-build-root-" + version;
+
+    preConfigure = baseAttrs.preConfigure + ''
+      mkdir build
+      cd build
+      configureScript=../configure
+    '';
+
+    postBuild = ''
+      cd ..
+      mv build $out
+      echo "Doing build-root only, exiting now" >&2
+      exit 0
+    '';
+  };
+
+  attrs = if buildRootOnly
+            then buildRootOnlyAttrs
+          else realAttrs;
+in
+stdenv.mkDerivation attrs
diff --git a/nixpkgs/pkgs/development/libraries/id3lib/default.nix b/nixpkgs/pkgs/development/libraries/id3lib/default.nix
new file mode 100644
index 000000000000..ddce76b10f72
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/id3lib/default.nix
@@ -0,0 +1,26 @@
+{stdenv, fetchurl, zlib}:
+
+stdenv.mkDerivation {
+  name = "id3lib-3.8.3";
+
+  patches = [
+    ./id3lib-3.8.3-gcc43-1.patch
+    ./patch_id3lib_3.8.3_UTF16_writing_bug.diff
+  ];
+
+  buildInputs = [ zlib ];
+
+  src = fetchurl {
+    url = mirror://sourceforge/id3lib/id3lib-3.8.3.tar.gz;
+    sha256 = "0yfhqwk0w8q2hyv1jib1008jvzmwlpsxvc8qjllhna6p1hycqj97";
+  };
+
+  doCheck = false; # fails to compile
+
+  meta = with stdenv.lib; {
+    description = "Library for reading, writing, and manipulating ID3v1 and ID3v2 tags";
+    homepage = http://id3lib.sourceforge.net;
+    platforms = platforms.unix;
+    license = licenses.lgpl2;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/id3lib/id3lib-3.8.3-gcc43-1.patch b/nixpkgs/pkgs/development/libraries/id3lib/id3lib-3.8.3-gcc43-1.patch
new file mode 100644
index 000000000000..2b7457d54c79
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/id3lib/id3lib-3.8.3-gcc43-1.patch
@@ -0,0 +1,104 @@
+http://www.linuxfromscratch.org/patches/downloads/id3lib/id3lib-3.8.3-gcc43-1.patch 
+
+Submitted By: Ken Moffat <ken at linuxfromscratch dot org>
+Date: 2008-11-21
+Initial Package Version: 3.8.3
+Upstream Status: unknown
+Origin: fedora
+Description: Allows it to compile with gcc-4.3.
+
+diff -up id3lib-3.8.3/include/id3/id3lib_strings.h~ id3lib-3.8.3/include/id3/id3lib_strings.h
+--- id3lib-3.8.3/include/id3/id3lib_strings.h~	2003-03-02 02:23:00.000000000 +0200
++++ id3lib-3.8.3/include/id3/id3lib_strings.h	2008-01-04 01:30:52.000000000 +0200
+@@ -29,6 +29,7 @@
+ #ifndef _ID3LIB_STRINGS_H_
+ #define _ID3LIB_STRINGS_H_
+ 
++#include <cstring>
+ #include <string>
+ 
+ #if (defined(__GNUC__) && (__GNUC__ >= 3) || (defined(_MSC_VER) && _MSC_VER > 1000))
+diff -up id3lib-3.8.3/configure.in~ id3lib-3.8.3/configure.in
+--- id3lib-3.8.3/configure.in~	2008-01-04 11:39:01.000000000 +0100
++++ id3lib-3.8.3/configure.in	2008-01-04 11:39:01.000000000 +0100
+@@ -227,7 +227,6 @@ AC_CHECK_HEADERS(fstream iostream iomani
+ )
+ AC_CHECK_HEADERS(               \
+   string                        \
+-  iomanip.h                     \
+   ,,AC_MSG_ERROR([Missing a vital header file for id3lib])
+ )
+ 
+diff -up id3lib-3.8.3/configure~ id3lib-3.8.3/configure
+--- id3lib-3.8.3/configure~	2008-01-04 11:39:10.000000000 +0100
++++ id3lib-3.8.3/configure	2008-01-04 11:39:10.000000000 +0100
+@@ -22976,7 +22976,6 @@ done
+ 
+ for ac_header in \
+   string                        \
+-  iomanip.h                     \
+ 
+ do
+ as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+diff -up id3lib-3.8.3/include/id3/writers.h~ id3lib-3.8.3/include/id3/writers.h
+--- id3lib-3.8.3/include/id3/writers.h~	2008-01-04 11:59:39.000000000 +0100
++++ id3lib-3.8.3/include/id3/writers.h	2008-01-04 11:59:39.000000000 +0100
+@@ -28,9 +28,9 @@
+ #ifndef _ID3LIB_WRITERS_H_
+ #define _ID3LIB_WRITERS_H_
+ 
++#include <cstring>
+ #include "id3/writer.h"
+ #include "id3/id3lib_streams.h"
+-//#include <string.h>
+ 
+ class ID3_CPP_EXPORT ID3_OStreamWriter : public ID3_Writer
+ {
+diff -up id3lib-3.8.3/examples/demo_info.cpp~ id3lib-3.8.3/examples/demo_info.cpp
+--- id3lib-3.8.3/examples/demo_info.cpp~	2008-01-04 12:00:56.000000000 +0100
++++ id3lib-3.8.3/examples/demo_info.cpp	2008-01-04 12:00:56.000000000 +0100
+@@ -309,7 +309,7 @@ void PrintInformation(const ID3_Tag &myT
+ 
+ #define DEBUG
+ 
+-int main( unsigned int argc, char * const argv[])
++int main(int argc, char * const argv[])
+ {
+   ID3D_INIT_DOUT();
+ 
+diff -up id3lib-3.8.3/examples/demo_copy.cpp~ id3lib-3.8.3/examples/demo_copy.cpp
+--- id3lib-3.8.3/examples/demo_copy.cpp~	2008-01-04 12:01:26.000000000 +0100
++++ id3lib-3.8.3/examples/demo_copy.cpp	2008-01-04 12:01:26.000000000 +0100
+@@ -81,7 +81,7 @@ void DisplayTags(ostream &os, luint nTag
+   }
+ }
+ 
+-int main( unsigned int argc, char * const argv[])
++int main(int argc, char * const argv[])
+ {
+   int ulFlag = ID3TT_ID3;
+   ID3D_INIT_DOUT();
+diff -up id3lib-3.8.3/examples/demo_convert.cpp~ id3lib-3.8.3/examples/demo_convert.cpp
+--- id3lib-3.8.3/examples/demo_convert.cpp~	2008-01-04 12:01:20.000000000 +0100
++++ id3lib-3.8.3/examples/demo_convert.cpp	2008-01-04 12:01:20.000000000 +0100
+@@ -84,7 +84,7 @@ void DisplayTags(ostream &os, luint nTag
+   }
+ }
+ 
+-int main( unsigned int argc, char * const argv[])
++int main(int argc, char * const argv[])
+ {
+   flags_t ulFlag = ID3TT_ALL;
+   gengetopt_args_info args;
+diff -up id3lib-3.8.3/examples/demo_tag.cpp~ id3lib-3.8.3/examples/demo_tag.cpp
+--- id3lib-3.8.3/examples/demo_tag.cpp~	2008-01-04 12:01:41.000000000 +0100
++++ id3lib-3.8.3/examples/demo_tag.cpp	2008-01-04 12:01:41.000000000 +0100
+@@ -46,7 +46,7 @@ void DisplayTags(ostream &os, luint nTag
+     os << "v2";
+ }
+ 
+-int main( unsigned int argc, char * const argv[])
++int main(int argc, char * const argv[])
+ {
+   int ulFlag = ID3TT_ID3;
+   ID3D_INIT_DOUT();
diff --git a/nixpkgs/pkgs/development/libraries/id3lib/patch_id3lib_3.8.3_UTF16_writing_bug.diff b/nixpkgs/pkgs/development/libraries/id3lib/patch_id3lib_3.8.3_UTF16_writing_bug.diff
new file mode 100644
index 000000000000..b05d2cf298d3
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/id3lib/patch_id3lib_3.8.3_UTF16_writing_bug.diff
@@ -0,0 +1,39 @@
+diff -ruN id3lib-3.8.3.orig/ChangeLog id3lib-3.8.3/ChangeLog
+--- id3lib-3.8.3.orig/ChangeLog	2003-03-02 01:23:00.000000000 +0100
++++ id3lib-3.8.3/ChangeLog	2006-02-22 00:33:59.946214472 +0100
+@@ -1,3 +1,8 @@
++2006-02-17  Jerome Couderc
++
++    * Patch from Spoon to fix UTF-16 writing bug
++      http://sourceforge.net/tracker/index.php?func=detail&aid=1016290&group_id=979&atid=300979
++
+ 2003-03-02 Sunday 17:38   Thijmen Klok <thijmen@id3lib.org>
+ 
+ 	* THANKS (1.20): added more people 
+diff -ruN id3lib-3.8.3.orig/src/io_helpers.cpp id3lib-3.8.3/src/io_helpers.cpp
+--- id3lib-3.8.3.orig/src/io_helpers.cpp	2003-03-02 01:23:00.000000000 +0100
++++ id3lib-3.8.3/src/io_helpers.cpp	2006-02-22 00:35:02.926639992 +0100
+@@ -363,11 +363,22 @@
+     // Write the BOM: 0xFEFF
+     unicode_t BOM = 0xFEFF;
+     writer.writeChars((const unsigned char*) &BOM, 2);
++    // Patch from Spoon : 2004-08-25 14:17
++    //   http://sourceforge.net/tracker/index.php?func=detail&aid=1016290&group_id=979&atid=300979
++    // Wrong code
++    //for (size_t i = 0; i < size; i += 2)
++    //{
++    //  unicode_t ch = (data[i] << 8) | data[i+1];
++    //  writer.writeChars((const unsigned char*) &ch, 2);
++    //}
++    // Right code
++    unsigned char *pdata = (unsigned char *) data.c_str();
+     for (size_t i = 0; i < size; i += 2)
+     {
+-      unicode_t ch = (data[i] << 8) | data[i+1];
++      unicode_t ch = (pdata[i] << 8) | pdata[i+1];
+       writer.writeChars((const unsigned char*) &ch, 2);
+     }
++    // End patch
+   }
+   return writer.getCur() - beg;
+ }
diff --git a/nixpkgs/pkgs/development/libraries/idnkit/default.nix b/nixpkgs/pkgs/development/libraries/idnkit/default.nix
new file mode 100644
index 000000000000..d4ebb5534d9c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/idnkit/default.nix
@@ -0,0 +1,20 @@
+{ stdenv, fetchurl, libiconv }:
+
+stdenv.mkDerivation rec {
+  name = "idnkit-${version}";
+  version = "2.3";
+
+  src = fetchurl {
+    url = "https://jprs.co.jp/idn/${name}.tar.bz2";
+    sha256 = "0zp9yc84ff5s0g2i6v9yfyza2n2x4xh0kq7hjd3anhh0clbp3l16";
+  };
+
+  buildInputs = [ libiconv ];
+
+  meta = with stdenv.lib; {
+    homepage = https://www.nic.ad.jp/ja/idn/idnkit;
+    description = "Provides functionalities about i18n domain name processing";
+    license = "idnkit-2 license";
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/ignition-math/default.nix b/nixpkgs/pkgs/development/libraries/ignition-math/default.nix
new file mode 100644
index 000000000000..867ce024d2fe
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/ignition-math/default.nix
@@ -0,0 +1,26 @@
+{ stdenv, fetchurl, cmake }:
+
+let
+  version = "2.6.0";
+in
+stdenv.mkDerivation rec {
+  name = "ign-math2-${version}";
+
+  src = fetchurl {
+    url = "http://gazebosim.org/distributions/ign-math/releases/ignition-math2-${version}.tar.bz2";
+    sha256 = "1d4naq0zp704c7ckj2wwmhplxmwkvcs1jib8bklnnd09lhg9j92j";
+  };
+
+  buildInputs = [ cmake ];
+  preConfigure = ''
+    cmakeFlags="$cmakeFlags -DCMAKE_INSTALL_INCLUDEDIR=include -DCMAKE_INSTALL_LIBDIR=lib"
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = https://ignitionrobotics.org/libraries/math;
+    description = "Math library by Ingition Robotics, created for the Gazebo project";
+    license = licenses.asl20;
+    maintainers = with maintainers; [ pxc ];
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/ignition-transport/0.9.0.nix b/nixpkgs/pkgs/development/libraries/ignition-transport/0.9.0.nix
new file mode 100644
index 000000000000..3452c72839fd
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/ignition-transport/0.9.0.nix
@@ -0,0 +1,9 @@
+{ stdenv, fetchurl, callPackage, ... } @ args :
+
+callPackage ./generic.nix (args // rec {
+  version = "0.9.0";
+  src = fetchurl {
+    url = "http://gazebosim.org/distributions/ign-transport/releases/ignition-transport-${version}.tar.bz2";
+    sha256 = "15a8lkxri8q2gc7h0pj1dg2kivhy46v8d3mlxpjy90l77788bw1z";
+  };
+})
diff --git a/nixpkgs/pkgs/development/libraries/ignition-transport/1.0.1.nix b/nixpkgs/pkgs/development/libraries/ignition-transport/1.0.1.nix
new file mode 100644
index 000000000000..2f9605a3a72f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/ignition-transport/1.0.1.nix
@@ -0,0 +1,9 @@
+{ stdenv, fetchurl, callPackage, ... } @ args :
+
+callPackage ./generic.nix (args // rec {
+  version = "1.0.1";
+  src = fetchurl {
+    url = "http://gazebosim.org/distributions/ign-transport/releases/ignition-transport-${version}.tar.bz2";
+    sha256 = "08qyd70vlymms1g4smblags9f057zsn62xxrx29rhd4wy8prnjsq";
+  };
+})
diff --git a/nixpkgs/pkgs/development/libraries/ignition-transport/generic.nix b/nixpkgs/pkgs/development/libraries/ignition-transport/generic.nix
new file mode 100644
index 000000000000..8abff4c5f059
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/ignition-transport/generic.nix
@@ -0,0 +1,31 @@
+{ stdenv, cmake, pkgconfig, utillinux,
+  protobuf, zeromq, cppzmq,
+  version, src    # parametrize version and src so we can easily have pkgs
+                  # for different versions
+  , ...
+}:
+
+stdenv.mkDerivation rec {
+  name = "ign-transport-${version}";
+  inherit src;
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ cmake protobuf zeromq
+    utillinux # we need utillinux/e2fsprogs uuid/uuid.h
+  ];
+
+  propagatedBuildInputs = [ cppzmq ];
+
+  postPatch = ''
+    substituteInPlace cmake/ignition-config.cmake.in --replace "@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_" "@CMAKE_INSTALL_"
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = https://ignitionrobotics.org/libraries/math;
+    description = "Math library by Ingition Robotics, created for the Gazebo project";
+    license = licenses.asl20;
+    maintainers = with maintainers; [ pxc ];
+    platforms = platforms.all;
+    broken = true; # 2018-04-10
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/igraph/default.nix b/nixpkgs/pkgs/development/libraries/igraph/default.nix
new file mode 100644
index 000000000000..f3206700cb89
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/igraph/default.nix
@@ -0,0 +1,31 @@
+{ stdenv, lib, fetchFromGitHub,
+  pkgconfig, autoreconfHook,
+  flex, yacc, zlib, libxml2 }:
+
+stdenv.mkDerivation rec {
+  pname = "igraph";
+  version = "0.7.1";
+
+  src = fetchFromGitHub {
+    owner = "igraph";
+    repo = pname;
+    rev = version;
+    sha256 = "1wsy0r511gk069il6iqjs27q8cjvqz20gf0a7inybx1bw84845z8";
+  };
+
+  nativeBuildInputs = [ pkgconfig autoreconfHook ];
+  buildInputs = [ flex yacc zlib libxml2 ];
+
+  # This file is normally generated by igraph's bootstrap.sh, but we can do it
+  # ourselves. ~ C.
+  postPatch = ''
+    echo "${version}" > VERSION
+  '';
+
+  meta = {
+    description = "The network analysis package";
+    homepage = https://igraph.org/;
+    license = lib.licenses.gpl2;
+    maintainers = [ lib.maintainers.MostAwesomeDude ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/ijs/default.nix b/nixpkgs/pkgs/development/libraries/ijs/default.nix
new file mode 100644
index 000000000000..a5b226ee9c74
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/ijs/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, autoreconfHook, ghostscript }:
+
+stdenv.mkDerivation {
+  name = "ijs-${ghostscript.version}";
+
+  inherit (ghostscript) src;
+
+  postPatch = "cd ijs";
+
+  enableParallelBuilding = true;
+
+  nativeBuildInputs = [ autoreconfHook ];
+
+  configureFlags = [ "--disable-static" "--enable-shared" ];
+
+  meta = with stdenv.lib; {
+    homepage = https://www.openprinting.org/download/ijs/;
+    description = "Raster printer driver architecture";
+
+    license = licenses.gpl3Plus;
+
+    platforms = platforms.all;
+    maintainers = [ maintainers.abbradar ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/iksemel/default.nix b/nixpkgs/pkgs/development/libraries/iksemel/default.nix
new file mode 100644
index 000000000000..b97f62dcf25c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/iksemel/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, autoreconfHook, libtool, pkgconfig, gnutls, fetchFromGitHub, texinfo }:
+
+stdenv.mkDerivation rec {
+  name = "iksemel-${version}";
+  version = "1.4.2";
+
+  src = fetchFromGitHub {
+    owner = "timothytylee";
+    repo = "iksemel-1.4";
+    rev = "v${version}";
+    sha256 = "1xv302p344hnpxqcgs3z6wwxhrik39ckgfw5cjyrw0dkf316z9yh";
+  };
+
+  nativeBuildInputs = [ pkgconfig autoreconfHook libtool texinfo ];
+  buildInputs = [ gnutls ];
+
+  meta = with stdenv.lib; {
+    description = "XML parser for jabber";
+
+    homepage = https://github.com/timothytylee/iksemel-1.4;
+    license = licenses.gpl2;
+    maintainers = with maintainers; [ disassembler ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/ilbc/CMakeLists.txt b/nixpkgs/pkgs/development/libraries/ilbc/CMakeLists.txt
new file mode 100644
index 000000000000..edd8e7a32797
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/ilbc/CMakeLists.txt
@@ -0,0 +1,11 @@
+cmake_minimum_required(VERSION 2.6)
+
+project(ilbc)
+
+file(GLOB ilbc_SRCS *.c)
+file(GLOB ilbc_HDRS *.h)
+
+add_library(ilbc SHARED ${ilbc_SRCS})
+
+install(TARGETS ilbc DESTINATION lib)
+install(FILES ${ilbc_HDRS} DESTINATION include/ilbc)
diff --git a/nixpkgs/pkgs/development/libraries/ilbc/default.nix b/nixpkgs/pkgs/development/libraries/ilbc/default.nix
new file mode 100644
index 000000000000..cb83322ebb65
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/ilbc/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchurl, gawk, cmake }:
+
+stdenv.mkDerivation rec {
+  name = "ilbc-rfc3951";
+
+  script = ./extract-cfile.awk;
+
+  rfc3951 = fetchurl {
+    url = http://www.ietf.org/rfc/rfc3951.txt;
+    sha256 = "0zf4mvi3jzx6zjrfl2rbhl2m68pzbzpf1vbdmn7dqbfpcb67jpdy";
+  };
+
+  nativeBuildInputs = [ cmake ];
+
+  unpackPhase = ''
+    mkdir -v ${name}
+    cd ${name}
+    ${gawk}/bin/gawk -f ${script} ${rfc3951}
+    cp -v ${./CMakeLists.txt} CMakeLists.txt
+    '';
+
+  meta = {
+    platforms = stdenv.lib.platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/ilbc/extract-cfile.awk b/nixpkgs/pkgs/development/libraries/ilbc/extract-cfile.awk
new file mode 100644
index 000000000000..e4b07bc08963
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/ilbc/extract-cfile.awk
@@ -0,0 +1,24 @@
+BEGIN { srcname = "nothing"; }
+{ if (/^A\.[0-9][0-9]*\.* *[a-zA-Z][a-zA-Z_0-9]*\.[ch]/) {
+    if (srcname != "nothing")
+      close(srcname);
+    srcname = $2;
+    printf("creating source file %s\n", srcname);
+  }else if (srcname != "nothing") {
+    if (/Andersen,* *et* *al\./) 
+      printf("skipping %s\n", $0);
+    else if (//)
+      printf("skipping2 %s\n", $0);
+    else if (/Internet Low Bit Rate Codec *December 2004/)
+      printf("skipping3 %s\n", $0);
+    else if (/Authors' *Addresses/){
+      close(srcname);
+      exit;}
+    else
+      print $0 >> srcname;
+  }
+}
+END {
+  printf("ending file %s\n", srcname);
+  close(srcname);
+}
diff --git a/nixpkgs/pkgs/development/libraries/ilixi/default.nix b/nixpkgs/pkgs/development/libraries/ilixi/default.nix
new file mode 100644
index 000000000000..bb6e23937c05
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/ilixi/default.nix
@@ -0,0 +1,32 @@
+{ stdenv, fetchurl, pkgconfig, directfb, libsigcxx, libxml2, fontconfig }:
+
+# TODO: optional deps: baresip, FusionDale, FusionSound, SaWMan, doxygen,
+# Reflex, Wnn, NLS
+
+stdenv.mkDerivation rec {
+  name = "ilixi-1.0.0";
+
+  src = fetchurl {
+    url = "http://www.directfb.org/downloads/Libs/${name}.tar.gz";
+    sha256 = "1kmdmqf68jiv7y6as41bhbgdy70yy2i811a3l6kccbazlzpif34v";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ directfb libsigcxx libxml2 fontconfig ];
+
+  configureFlags = [
+    "--enable-log-debug"
+    "--enable-debug"
+    "--enable-trace"
+    "--with-examples"
+  ];
+
+  meta = with stdenv.lib; {
+    description = "Lightweight C++ GUI toolkit for embedded Linux systems";
+    homepage = https://github.com/ilixi/ilixi;
+    license = licenses.lgpl3;
+    platforms = platforms.linux;
+    maintainers = [ maintainers.bjornfor ];
+    broken = true; # broken by the directfb 1.6.3 -> 1.7.6 update
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/ilmbase/bootstrap.patch b/nixpkgs/pkgs/development/libraries/ilmbase/bootstrap.patch
new file mode 100644
index 000000000000..db6af6daebd0
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/ilmbase/bootstrap.patch
@@ -0,0 +1,15 @@
+diff -ur openexr-v2.2.0-src-orig/IlmBase/bootstrap openexr-v2.2.0-src/IlmBase/bootstrap
+--- IlmBase/bootstrap	2015-03-31 01:02:41.000000000 -0400
++++ IlmBase/bootstrap	2015-03-31 01:03:35.000000000 -0400
+@@ -47,11 +47,6 @@
+     fi
+ }
+ 
+-# Check if /usr/local/share/aclocal exists
+-if [ -d /usr/local/share/aclocal ]; then
+-	ACLOCAL_INCLUDE="$ACLOCAL_INCLUDE -I /usr/local/share/aclocal"
+-fi	
+-
+ run_cmd aclocal -I m4 $ACLOCAL_INCLUDE
+ run_cmd $LIBTOOLIZE --automake --copy
+ run_cmd automake --add-missing --copy
diff --git a/nixpkgs/pkgs/development/libraries/ilmbase/cross.patch b/nixpkgs/pkgs/development/libraries/ilmbase/cross.patch
new file mode 100644
index 000000000000..207a440a0d85
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/ilmbase/cross.patch
@@ -0,0 +1,35 @@
+From: Helmut Grohne <>
+Subject: compile build tools with the build architecture compiler
+
+Patch-Source: https://github.com/openexr/openexr/issues/221
+
+Index: ilmbase-2.2.0/configure.ac
+===================================================================
+--- ilmbase-2.2.0.orig/configure.ac
++++ ilmbase-2.2.0/configure.ac
+@@ -28,6 +28,7 @@
+ AC_PROG_LN_S
+ AC_PROG_LIBTOOL
+ AC_PROG_MAKE_SET
++AX_PROG_CXX_FOR_BUILD
+ 
+ dnl
+ dnl PKGCONFIG preparations
+Index: ilmbase-2.2.0/Half/Makefile.am
+===================================================================
+--- ilmbase-2.2.0.orig/Half/Makefile.am
++++ ilmbase-2.2.0/Half/Makefile.am
+@@ -17,9 +17,11 @@
+ 
+ CLEANFILES = eLut eLut.h toFloat toFloat.h
+ 
+-eLut_SOURCES = eLut.cpp
++eLut$(EXEEXT): eLut.cpp
++	$(CXX_FOR_BUILD) $(CXXFLAGS_FOR_BUILD) $< -o $@
+ 
+-toFloat_SOURCES = toFloat.cpp
++toFloat$(EXEEXT): toFloat.cpp
++	$(CXX_FOR_BUILD) $(CXXFLAGS_FOR_BUILD) $< -o $@
+ 
+ eLut.h:	eLut
+ 	./eLut > eLut.h
diff --git a/nixpkgs/pkgs/development/libraries/ilmbase/default.nix b/nixpkgs/pkgs/development/libraries/ilmbase/default.nix
new file mode 100644
index 000000000000..42cf77802625
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/ilmbase/default.nix
@@ -0,0 +1,36 @@
+{ stdenv, fetchurl, buildPackages, automake, autoconf, libtool, which }:
+
+stdenv.mkDerivation rec {
+  name = "ilmbase-${version}";
+  version = "2.3.0";
+
+  src = fetchurl {
+    url = "https://github.com/openexr/openexr/releases/download/v${version}/${name}.tar.gz";
+    sha256 = "0qiq5bqq9rxhqjiym2k36sx4vq8adgrz6xf6qwizi9bqm78phsa5";
+  };
+
+  outputs = [ "out" "dev" ];
+
+  preConfigure = ''
+    patchShebangs ./bootstrap
+    ./bootstrap
+  '';
+
+  depsBuildBuild = [ buildPackages.stdenv.cc ];
+  nativeBuildInputs = [ automake autoconf libtool which ];
+
+  NIX_CFLAGS_LINK = [ "-pthread" ];
+
+  patches = [ ./bootstrap.patch ./cross.patch ];
+
+  # fails 1 out of 1 tests with
+  # "lt-ImathTest: testBoxAlgo.cpp:892: void {anonymous}::boxMatrixTransform(): Assertion `b21 == b2' failed"
+  # at least on i686. spooky!
+  doCheck = stdenv.isx86_64;
+
+  meta = with stdenv.lib; {
+    homepage = http://www.openexr.com/;
+    license = licenses.bsd3;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/iml/default.nix b/nixpkgs/pkgs/development/libraries/iml/default.nix
new file mode 100644
index 000000000000..b55d13ecc3f4
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/iml/default.nix
@@ -0,0 +1,30 @@
+{stdenv, autoreconfHook, fetchurl, gmp, openblas}:
+stdenv.mkDerivation rec {
+  name = "iml-${version}";
+  version = "1.0.5";
+  src = fetchurl {
+    url = "http://www.cs.uwaterloo.ca/~astorjoh/iml-${version}.tar.bz2";
+    sha256 = "0akwhhz9b40bz6lrfxpamp7r7wkk48p455qbn04mfnl9a1l6db8x";
+  };
+  buildInputs = [
+    gmp
+    openblas
+  ];
+  nativeBuildInputs = [
+    autoreconfHook
+  ];
+  configureFlags = [
+    "--with-gmp-include=${gmp.dev}/include"
+    "--with-gmp-lib=${gmp}/lib"
+    "--with-cblas=-lopenblas"
+  ];
+  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.linux;
+    homepage = https://cs.uwaterloo.ca/~astorjoh/iml.html;
+    updateWalker = true;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/imlib/default.nix b/nixpkgs/pkgs/development/libraries/imlib/default.nix
new file mode 100644
index 000000000000..a6281156afa1
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/imlib/default.nix
@@ -0,0 +1,23 @@
+{stdenv, fetchurl, libX11, libXext, xorgproto, libjpeg, libungif, libtiff, libpng}:
+
+stdenv.mkDerivation {
+  name = "imlib-1.9.15";
+  src = fetchurl {
+    url = http://tarballs.nixos.org/imlib-1.9.15.tar.gz;
+    sha256 = "0ggjxyvgp4pxc0b88v40xj9daz90518ydnycw7qax011gxpr12d3";
+  };
+
+  configureFlags = [
+    "--disable-shm"
+    "--x-includes=${libX11.dev}/include"
+    "--x-libraries=${libX11.out}/lib"
+  ];
+
+  buildInputs = [libjpeg libXext libX11 xorgproto libtiff libungif libpng];
+
+  meta = with stdenv.lib; {
+    description = "An image loading and rendering library for X11";
+    platforms = platforms.unix;
+    license = with licenses; [ gpl2 lgpl2 ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/imlib2/default.nix b/nixpkgs/pkgs/development/libraries/imlib2/default.nix
new file mode 100644
index 000000000000..2576580908a3
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/imlib2/default.nix
@@ -0,0 +1,54 @@
+{ stdenv, fetchurl, libjpeg, libtiff, giflib, libpng, bzip2, pkgconfig
+, freetype, libid3tag
+, x11Support ? true, xlibsWrapper ? null }:
+
+with stdenv.lib;
+
+stdenv.mkDerivation rec {
+  name = "imlib2-1.5.1";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/enlightenment/${name}.tar.bz2";
+    sha256 = "1bms2iwmvnvpz5jqq3r52glarqkafif47zbh1ykz8hw85d2mfkps";
+  };
+
+  buildInputs = [ libjpeg libtiff giflib libpng bzip2 freetype libid3tag ]
+    ++ optional x11Support xlibsWrapper;
+
+  nativeBuildInputs = [ pkgconfig ];
+
+  enableParallelBuilding = true;
+
+  preConfigure = ''
+    substituteInPlace imlib2-config.in \
+      --replace "@my_libs@" ""
+  '';
+
+  # Do not build amd64 assembly code on Darwin, because it fails to compile
+  # with unknow directive errors
+  configureFlags = optional stdenv.isDarwin "--enable-amd64=no"
+    ++ optional (!x11Support) "--without-x";
+
+  outputs = [ "bin" "out" "dev" ];
+
+  postInstall = ''
+    moveToOutput bin/imlib2-config "$dev"
+  '';
+
+  meta = {
+    description = "Image manipulation library";
+
+    longDescription = ''
+      This is the Imlib 2 library - a library that does image file loading and
+      saving as well as rendering, manipulation, arbitrary polygon support, etc.
+      It does ALL of these operations FAST. Imlib2 also tries to be highly
+      intelligent about doing them, so writing naive programs can be done
+      easily, without sacrificing speed.
+    '';
+
+    homepage = http://docs.enlightenment.org/api/imlib2/html;
+    license = licenses.free;
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ spwhitt ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/incrtcl/default.nix b/nixpkgs/pkgs/development/libraries/incrtcl/default.nix
new file mode 100644
index 000000000000..a4a009c66580
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/incrtcl/default.nix
@@ -0,0 +1,31 @@
+{stdenv, fetchurl, tcl}:
+
+stdenv.mkDerivation rec {
+  name = "incrtcl-${version}";
+  version = "4.0.4";
+
+  src = fetchurl {
+    url = mirror://sourceforge/incrtcl/%5BIncr%20Tcl_Tk%5D-source/3.4/itcl4.0.4.tar.gz;
+    sha256 = "1ppc9b13cvmc6rp77k7dl2zb26xk0z30vxygmr4h1xr2r8w091k3";
+  };
+
+  buildInputs = [ tcl ];
+  configureFlags = [ "--with-tcl=${tcl}/lib" ];
+  patchPhase = ''
+      substituteInPlace configure --replace "\''${TCL_SRC_DIR}/generic" "${tcl}/include"
+  '';
+  preConfigure = ''
+      configureFlags="--exec_prefix=$prefix $configureFlags"
+  '';
+
+  passthru = {
+    libPrefix = "itcl3.4";
+  };
+
+  meta = with stdenv.lib; {
+    homepage = http://incrtcl.sourceforge.net/;
+    description = "Object Oriented Enhancements for Tcl/Tk";
+    platforms = platforms.unix;
+    license = licenses.tcltk;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/indicator-application/gtk2.nix b/nixpkgs/pkgs/development/libraries/indicator-application/gtk2.nix
new file mode 100644
index 000000000000..36b637c62bb2
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/indicator-application/gtk2.nix
@@ -0,0 +1,55 @@
+{ stdenv, fetchurl, lib, file
+, pkgconfig, autoconf
+, glib, dbus-glib, json-glib
+, gtk2, libindicator-gtk2, libdbusmenu-gtk2, libappindicator-gtk2 }:
+
+with lib;
+
+stdenv.mkDerivation rec {
+  name = "indicator-application-gtk2-${version}";
+  version = "12.10.0.1";
+
+  src = fetchurl {
+    url = "${meta.homepage}/indicator-application-gtk2/i-a-${version}/+download/indicator-application-${version}.tar.gz";
+    sha256 = "1xqsb6c1pwawabw854f7aybjrgyhc2r1316i9lyjspci51zk5m7v";
+  };
+
+  nativeBuildInputs = [ pkgconfig autoconf ];
+
+  buildInputs = [
+    glib dbus-glib json-glib
+    gtk2 libindicator-gtk2 libdbusmenu-gtk2 libappindicator-gtk2
+  ];
+
+  postPatch = ''
+    substituteInPlace configure.ac \
+      --replace 'DBUSSERVICEDIR=`$PKG_CONFIG --variable=session_bus_services_dir dbus-1`' \
+                "DBUSSERVICEDIR=$out/share/dbus-1/services"
+    autoconf
+    for f in {configure,ltmain.sh,m4/libtool.m4}; do
+      substituteInPlace $f \
+        --replace /usr/bin/file ${file}/bin/file
+    done
+    substituteInPlace src/Makefile.in \
+      --replace 'applicationlibdir = $(INDICATORDIR)' "applicationlibdir = $out/lib"
+  '';
+
+  configureFlags = [
+    "CFLAGS=-Wno-error"
+    "--sysconfdir=/etc"
+    "--localstatedir=/var"
+  ];
+
+  installFlags = [
+    "sysconfdir=\${out}/etc"
+    "localstatedir=\${TMPDIR}"
+  ];
+
+  meta = {
+    description = "Indicator to take menus from applications and place them in the panel (GTK+ 2 library for Xfce/LXDE)";
+    homepage = https://launchpad.net/indicators-gtk2;
+    license = licenses.gpl3;
+    platforms = platforms.linux;
+    maintainers = [ maintainers.msteen ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/indicator-application/gtk3.nix b/nixpkgs/pkgs/development/libraries/indicator-application/gtk3.nix
new file mode 100644
index 000000000000..023572976351
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/indicator-application/gtk3.nix
@@ -0,0 +1,57 @@
+{ stdenv, fetchbzr
+, pkgconfig, systemd, autoreconfHook
+, glib, dbus-glib, json-glib
+, gtk3, libindicator-gtk3, libdbusmenu-gtk3, libappindicator-gtk3 }:
+
+stdenv.mkDerivation rec {
+  pname = "indicator-application";
+  version = "12.10.1";
+
+  name = "${pname}-gtk3-${version}";
+
+  src = fetchbzr {
+    url = "https://code.launchpad.net/~indicator-applet-developers/${pname}/trunk.17.04";
+    rev = "260";
+    sha256 = "1f0jdyqqb5g86zdpbcyn16x94yjigsfiv2kf73dvni5rp1vafbq1";
+  };
+
+  nativeBuildInputs = [ pkgconfig autoreconfHook ];
+
+  buildInputs = [
+    glib dbus-glib json-glib systemd
+    gtk3 libindicator-gtk3 libdbusmenu-gtk3 libappindicator-gtk3
+  ];
+
+  postPatch = ''
+    substituteInPlace data/Makefile.am \
+      --replace "/etc/xdg/autostart" "$out/etc/xdg/autostart"
+  '';
+
+  configureFlags = [
+    "CFLAGS=-Wno-error"
+    "--sysconfdir=/etc"
+    "--localstatedir=/var"
+  ];
+
+  installFlags = [
+    "sysconfdir=\${out}/etc"
+    "localstatedir=\${TMPDIR}"
+  ];
+
+  PKG_CONFIG_SYSTEMD_SYSTEMDUSERUNITDIR = "$(out)/lib/systemd/user";
+  PKG_CONFIG_INDICATOR3_0_4_INDICATORDIR = "$(out)/lib/indicators3/7/";
+
+  # Upstart is not used in NixOS
+  postFixup = ''
+    rm -rf $out/share/indicator-application/upstart
+    rm -rf $out/share/upstart
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Indicator to take menus from applications and place them in the panel";
+    homepage = https://launchpad.net/indicator-application;
+    license = licenses.gpl3;
+    platforms = platforms.linux;
+    maintainers = [ maintainers.msteen ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/indilib/default.nix b/nixpkgs/pkgs/development/libraries/indilib/default.nix
new file mode 100644
index 000000000000..5816f044f574
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/indilib/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchurl, cmake, cfitsio, libusb, zlib, boost, libnova
+, curl, libjpeg, gsl }:
+
+stdenv.mkDerivation {
+  name = "indilib-1.1.0";
+
+  src = fetchurl {
+    url = mirror://sourceforge/indi/libindi_1.1.0.tar.gz;
+    sha256 = "1bs6lkwqd4aashg93mqqkc7nrg7fbx9mdw85qs5263jqa6sr780w";
+  };
+
+  patches = [ ./udev-dir.patch ] ;
+
+  buildInputs = [ curl cmake cfitsio libusb zlib boost
+                            libnova libjpeg gsl ];
+
+  meta = {
+    homepage = https://www.indilib.org/;
+    license = stdenv.lib.licenses.lgpl2Plus;
+    description = "Implementaion of the INDI protocol for POSIX operating systems";
+    platforms = stdenv.lib.platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/indilib/udev-dir.patch b/nixpkgs/pkgs/development/libraries/indilib/udev-dir.patch
new file mode 100644
index 000000000000..0f497419e706
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/indilib/udev-dir.patch
@@ -0,0 +1,12 @@
+diff -Naur libindi-1.0.0-upstream/CMakeLists.txt libindi-1.0.0/CMakeLists.txt
+--- libindi-1.0.0-upstream/CMakeLists.txt	2015-03-28 21:06:49.576863460 -0430
++++ libindi-1.0.0/CMakeLists.txt	2015-03-28 21:07:48.420677548 -0430
+@@ -28,7 +28,7 @@
+ ## the following are directories where stuff will be installed to

+ set(INCLUDE_INSTALL_DIR      "${CMAKE_INSTALL_PREFIX}/include/")

+ set(PKGCONFIG_INSTALL_PREFIX "${LIB_DESTINATION}/pkgconfig/")

+-set(UDEVRULES_INSTALL_DIR "/lib/udev/rules.d" CACHE STRING "Base directory for udev rules")

++set(UDEVRULES_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/lib/udev/rules.d" CACHE STRING "Base directory for udev rules")

+ 

+ ##################  Includes  ################################

+ Include (CheckCXXSourceCompiles)

diff --git a/nixpkgs/pkgs/development/libraries/iniparser/default.nix b/nixpkgs/pkgs/development/libraries/iniparser/default.nix
new file mode 100644
index 000000000000..8beda8663c5c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/iniparser/default.nix
@@ -0,0 +1,48 @@
+{ stdenv, fetchFromGitHub }:
+
+stdenv.mkDerivation rec {
+  name = "iniparser-${version}";
+  version = "4.1";
+
+  src = fetchFromGitHub {
+    owner = "ndevilla";
+    repo = "iniparser";
+    rev = "v${version}";
+    sha256 = "0dhab6pad6wh816lr7r3jb6z273njlgw2vpw8kcfnmi7ijaqhnr5";
+  };
+
+  patches = ./no-usr.patch;
+
+  postPatch = stdenv.lib.optionalString stdenv.isDarwin ''
+    substituteInPlace Makefile \
+        --replace -Wl,-soname= -Wl,-install_name,
+  '';
+
+  doCheck = true;
+  preCheck = "patchShebangs test/make-tests.sh";
+
+  installPhase = ''
+    mkdir -p $out/lib
+
+    mkdir -p $out/include
+    cp src/*.h $out/include
+
+    mkdir -p $out/share/doc/${name}
+    for i in AUTHORS INSTALL LICENSE README.md; do
+      bzip2 -c -9 $i > $out/share/doc/${name}/$i.bz2;
+    done;
+    cp -r html $out/share/doc/${name}
+
+    cp libiniparser.a $out/lib
+    cp libiniparser.so.1 $out/lib
+    ln -s libiniparser.so.1 $out/lib/libiniparser.so
+  '';
+
+  meta = with stdenv.lib; {
+    inherit (src.meta) homepage;
+    description = "Free standalone ini file parsing library";
+    license = licenses.mit;
+    platforms = platforms.unix;
+    maintainers = [ maintainers.primeos ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/iniparser/no-usr.patch b/nixpkgs/pkgs/development/libraries/iniparser/no-usr.patch
new file mode 100644
index 000000000000..a3c568cdde43
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/iniparser/no-usr.patch
@@ -0,0 +1,13 @@
+--- a/Makefile	2017-10-20 20:30:41.494608284 +0200
++++ b/Makefile	2017-10-20 20:33:22.279212026 +0200
+@@ -20,8 +20,8 @@
+ ARFLAGS = rcv
+ 
+ SHLD = ${CC} ${CFLAGS}
+-LDSHFLAGS = -shared -Wl,-Bsymbolic
+-LDFLAGS += -Wl,-rpath -Wl,/usr/lib -Wl,-rpath,/usr/lib
++LDSHFLAGS = -shared
++LDFLAGS =
+ 
+ # .so.0 is for version 3.x, .so.1 is 4.x
+ SO_TARGET ?= libiniparser.so.1
diff --git a/nixpkgs/pkgs/development/libraries/intel-gmmlib/default.nix b/nixpkgs/pkgs/development/libraries/intel-gmmlib/default.nix
new file mode 100644
index 000000000000..50e97bfbfdb3
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/intel-gmmlib/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchFromGitHub
+, cmake
+}:
+
+stdenv.mkDerivation rec {
+  name = "intel-gmmlib-${version}";
+  version = "19.1.2";
+
+  src = fetchFromGitHub {
+    owner  = "intel";
+    repo   = "gmmlib";
+    rev    = name;
+    sha256 = "1nw5qg10dqkchx39vqk9nkqggk0in2kr794dqjp73njpirixgr2b";
+  };
+
+  nativeBuildInputs = [ cmake ];
+
+  meta = with stdenv.lib; {
+    homepage = https://github.com/intel/gmmlib;
+    license = licenses.mit;
+    description = "Intel Graphics Memory Management Library";
+    platforms = [ "x86_64-linux" ];
+    maintainers = with maintainers; [ jfrankenau ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/intel-media-driver/default.nix b/nixpkgs/pkgs/development/libraries/intel-media-driver/default.nix
new file mode 100644
index 000000000000..a362b1ac6343
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/intel-media-driver/default.nix
@@ -0,0 +1,33 @@
+{ stdenv, fetchFromGitHub
+, cmake, pkgconfig
+, libva, libpciaccess, intel-gmmlib, libX11
+}:
+
+stdenv.mkDerivation rec {
+  name = "intel-media-driver-${version}";
+  version = "19.1.0";
+
+  src = fetchFromGitHub {
+    owner  = "intel";
+    repo   = "media-driver";
+    rev    = "intel-media-${version}";
+    sha256 = "072ry87h1lds14fqb2sfz3n2sssvacamaxv2gj4nd8agnzbwizn7";
+  };
+
+  cmakeFlags = [
+    "-DINSTALL_DRIVER_SYSCONF=OFF"
+    "-DLIBVA_DRIVERS_PATH=${placeholder "out"}/lib/dri"
+  ];
+
+  nativeBuildInputs = [ cmake pkgconfig ];
+
+  buildInputs = [ libva libpciaccess intel-gmmlib libX11 ];
+
+  meta = with stdenv.lib; {
+    homepage = https://github.com/intel/media-driver;
+    license = with licenses; [ bsd3 mit ];
+    description = "Intel Media Driver for VAAPI — Broadwell+ iGPUs";
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ jfrankenau ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/intel-media-sdk/default.nix b/nixpkgs/pkgs/development/libraries/intel-media-sdk/default.nix
new file mode 100644
index 000000000000..274058b7ec99
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/intel-media-sdk/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchurl, autoPatchelfHook, cmake, pkgconfig, libdrm, libpciaccess
+, libva , libX11, libXau, libXdmcp, libpthreadstubs
+}:
+
+stdenv.mkDerivation rec {
+  name = "intel-media-sdk-${version}";
+  version = "19.1.0";
+
+  src = fetchurl {
+    url = "https://github.com/Intel-Media-SDK/MediaSDK/archive/intel-mediasdk-${version}.tar.gz";
+    sha256 = "1gligrg6khzmwcy6miikljj75hhxqy0a95qzc8m61ipx5c8igdpv";
+  };
+
+  # patchelf is needed for binaries in $out/share/samples
+  nativeBuildInputs = [ autoPatchelfHook cmake pkgconfig ];
+  buildInputs = [
+    libdrm libva libpciaccess libX11 libXau libXdmcp libpthreadstubs
+  ];
+
+  enableParallelBuild = true;
+
+  meta = with stdenv.lib; {
+    description = "Intel Media SDK.";
+    license = licenses.mit;
+    maintainers = with maintainers; [ midchildan ];
+    platforms = with platforms; linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/ip2location-c/default.nix b/nixpkgs/pkgs/development/libraries/ip2location-c/default.nix
new file mode 100644
index 000000000000..a48908f41dd4
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/ip2location-c/default.nix
@@ -0,0 +1,32 @@
+{ stdenv, fetchurl, autoreconfHook }:
+
+stdenv.mkDerivation rec {
+  name = "ip2location-c-${version}";
+  version = "7.0.2"; # meta.homepage might change after a major update
+
+  src = fetchurl {
+    sha256 = "1gs43qgcyfn83abrkhvvw1s67d1sbkbj3hab9m17ysn6swafiycx";
+    url = "https://www.ip2location.com/downloads/ip2location-c-${version}.tar.gz";
+  };
+
+  nativeBuildInputs = [ autoreconfHook ];
+
+  enableParallelBuilding = true;
+
+  # Checks require a database, which require registration (although sample
+  # databases are available, downloading them for just 1 test seems excessive):
+  doCheck = false;
+
+  meta = with stdenv.lib; {
+    description = "Library to look up locations of host names and IP addresses";
+    longDescription = ''
+      A C library to find the country, region, city,coordinates,
+      zip code, time zone, ISP, domain name, connection type, area code,
+      weather, MCC, MNC, mobile brand name, elevation and usage type of
+      any IP address or host name in the IP2Location databases.
+    '';
+    homepage = http://www.ip2location.com/developers/c-7;
+    license = with licenses; [ gpl3Plus lgpl3Plus ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/irrlicht/default.nix b/nixpkgs/pkgs/development/libraries/irrlicht/default.nix
new file mode 100644
index 000000000000..d28ae012e574
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/irrlicht/default.nix
@@ -0,0 +1,34 @@
+{ stdenv, fetchzip, libGLU_combined, unzip, libXrandr, libX11, libXxf86vm }:
+
+
+stdenv.mkDerivation rec {
+  name = "irrlicht-${version}";
+  version = "1.8.4";
+
+  src = fetchzip {
+    url = "mirror://sourceforge/irrlicht/${name}.zip";
+    sha256 = "02sq067fn4xpf0lcyb4vqxmm43qg2nxx770bgrl799yymqbvih5f";
+  };
+
+  preConfigure = ''
+    cd source/Irrlicht
+  '';
+
+  buildPhase = ''
+    make sharedlib NDEBUG=1 "LDFLAGS=-lX11 -lGL -lXxf86vm"
+  '';
+
+  preInstall = ''
+    sed -i s,/usr/local/lib,$out/lib, Makefile
+    mkdir -p $out/lib
+  '';
+
+  buildInputs = [ unzip libGLU_combined libXrandr libX11 libXxf86vm ];
+
+  meta = {
+    homepage = http://irrlicht.sourceforge.net/;
+    license = stdenv.lib.licenses.zlib;
+    description = "Open source high performance realtime 3D engine written in C++";
+    platforms = stdenv.lib.platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/isl/0.11.1.nix b/nixpkgs/pkgs/development/libraries/isl/0.11.1.nix
new file mode 100644
index 000000000000..20a60f1a102d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/isl/0.11.1.nix
@@ -0,0 +1,22 @@
+{ stdenv, fetchurl, gmp }:
+
+stdenv.mkDerivation rec {
+  name = "isl-0.11.1"; # CLooG 0.16.3 fails to build with ISL 0.08.
+
+  src = fetchurl {
+    url = "https://src.fedoraproject.org/repo/pkgs/gcc/isl-0.11.1.tar.bz2/bce1586384d8635a76d2f017fb067cd2/isl-0.11.1.tar.bz2";
+    sha256 = "13d9cqa5rzhbjq0xf0b2dyxag7pqa72xj9dhsa03m8ccr1a4npq9";
+  };
+
+  buildInputs = [ gmp ];
+  patches = [ ./fix-gcc-build.diff ];
+
+  enableParallelBuilding = true;
+
+  meta = {
+    homepage = https://www.kotnet.org/~skimo/isl/;
+    license = stdenv.lib.licenses.lgpl21;
+    description = "A library for manipulating sets and relations of integer points bounded by linear constraints";
+    platforms = stdenv.lib.platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/isl/0.14.1.nix b/nixpkgs/pkgs/development/libraries/isl/0.14.1.nix
new file mode 100644
index 000000000000..1ff4b7ec18a0
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/isl/0.14.1.nix
@@ -0,0 +1,21 @@
+{ stdenv, fetchurl, gmp }:
+
+stdenv.mkDerivation rec {
+  name = "isl-0.14.1";
+
+  src = fetchurl {
+    url = "http://isl.gforge.inria.fr/${name}.tar.xz";
+    sha256 = "0xa6xagah5rywkywn19rzvbvhfvkmylhcxr6z9z7bz29cpiwk0l8";
+  };
+
+  buildInputs = [ gmp ];
+
+  enableParallelBuilding = true;
+
+  meta = {
+    homepage = https://www.kotnet.org/~skimo/isl/;
+    license = stdenv.lib.licenses.lgpl21;
+    description = "A library for manipulating sets and relations of integer points bounded by linear constraints";
+    platforms = stdenv.lib.platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/isl/0.17.1.nix b/nixpkgs/pkgs/development/libraries/isl/0.17.1.nix
new file mode 100644
index 000000000000..59d4d38ce574
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/isl/0.17.1.nix
@@ -0,0 +1,21 @@
+{ stdenv, fetchurl, gmp }:
+
+stdenv.mkDerivation rec {
+  name = "isl-0.17.1";
+
+  src = fetchurl {
+    url = "http://isl.gforge.inria.fr/${name}.tar.xz";
+    sha256 = "be152e5c816b477594f4c6194b5666d8129f3a27702756ae9ff60346a8731647";
+  };
+
+  buildInputs = [ gmp ];
+
+  enableParallelBuilding = true;
+
+  meta = {
+    homepage = https://www.kotnet.org/~skimo/isl/;
+    license = stdenv.lib.licenses.lgpl21;
+    description = "A library for manipulating sets and relations of integer points bounded by linear constraints";
+    platforms = stdenv.lib.platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/isl/0.20.0.nix b/nixpkgs/pkgs/development/libraries/isl/0.20.0.nix
new file mode 100644
index 000000000000..72ef581725b9
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/isl/0.20.0.nix
@@ -0,0 +1,21 @@
+{ stdenv, fetchurl, gmp }:
+
+stdenv.mkDerivation rec {
+  name = "isl-0.20";
+
+  src = fetchurl {
+    url = "http://isl.gforge.inria.fr/${name}.tar.xz";
+    sha256 = "1akpgq0rbqbah5517blg2zlnfvjxfcl9cjrfc75nbcx5p2gnlnd5";
+  };
+
+  buildInputs = [ gmp ];
+
+  enableParallelBuilding = true;
+
+  meta = {
+    homepage = http://isl.gforge.inria.fr/;
+    license = stdenv.lib.licenses.lgpl21;
+    description = "A library for manipulating sets and relations of integer points bounded by linear constraints";
+    platforms = stdenv.lib.platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/isl/fix-gcc-build.diff b/nixpkgs/pkgs/development/libraries/isl/fix-gcc-build.diff
new file mode 100644
index 000000000000..6fbd1f9d478b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/isl/fix-gcc-build.diff
@@ -0,0 +1,12 @@
+diff -ru isl-0.11.1/include/isl/int.h isl-0.11.1.new/include/isl/int.h
+--- isl-0.11.1/include/isl/int.h        2012-11-29 09:47:32.000000000 +0100
++++ isl-0.11.1.new/include/isl/int.h    2013-10-27 15:35:31.348553812 +0100
+@@ -14,7 +14,7 @@
+ #include <string.h>
+ #include <gmp.h>
+ #if defined(__cplusplus)
+-#include <iostream>
++#include <ostream>
+ #endif
+ 
+ #if defined(__cplusplus)
diff --git a/nixpkgs/pkgs/development/libraries/iso-codes/default.nix b/nixpkgs/pkgs/development/libraries/iso-codes/default.nix
new file mode 100644
index 000000000000..43ab20da8ae0
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/iso-codes/default.nix
@@ -0,0 +1,27 @@
+{stdenv, fetchurl, gettext, python3}:
+
+stdenv.mkDerivation rec {
+  name = "iso-codes-${version}";
+  version = "3.79";
+
+  src = fetchurl {
+    url = "https://salsa.debian.org/iso-codes-team/iso-codes/uploads/ef8de8bc12e0512d26ed73436a477871/${name}.tar.xz";
+    sha256 = "08i8hjy0qjlw9kd9i87jx967ihwh45l2xi55q1aa5265sind7byb";
+  };
+
+  patchPhase = ''
+    for i in `find . -name \*.py`
+    do
+        sed -i -e "s|#!/usr/bin/env python|#!${python3}/bin/python|" $i
+    done
+  '';
+
+  nativeBuildInputs = [ gettext python3 ];
+
+  meta = with stdenv.lib; {
+    homepage = https://salsa.debian.org/iso-codes-team/iso-codes;
+    description = "Various ISO codes packaged as XML files";
+    license = licenses.lgpl21;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/itk/default.nix b/nixpkgs/pkgs/development/libraries/itk/default.nix
new file mode 100644
index 000000000000..6e393ba02ce6
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/itk/default.nix
@@ -0,0 +1,33 @@
+{ stdenv, fetchurl, cmake, libX11, libuuid, xz, vtk }:
+
+stdenv.mkDerivation rec {
+  name = "itk-4.13.2";
+
+  src = fetchurl {
+    url = mirror://sourceforge/itk/InsightToolkit-4.13.2.tar.xz;
+    sha256 = "19cgfpd63gqrvc3m27m394gy2d7w79g5y6lvznb5qqr49lihbgns";
+  };
+
+  cmakeFlags = [
+    "-DBUILD_EXAMPLES=OFF"
+    "-DBUILD_SHARED_LIBS=ON"
+    "-DModule_ITKMINC=ON"
+    "-DModule_ITKIOMINC=ON"
+    "-DModule_ITKIOTransformMINC=ON"
+    "-DModule_ITKVtkGlue=ON"
+    "-DModule_ITKReview=ON"
+  ];
+
+  enableParallelBuilding = true;
+
+  nativeBuildInputs = [ cmake xz ];
+  buildInputs = [ libX11 libuuid vtk ];
+
+  meta = {
+    description = "Insight Segmentation and Registration Toolkit";
+    homepage = http://www.itk.org/;
+    license = stdenv.lib.licenses.asl20;
+    maintainers = with stdenv.lib.maintainers; [viric];
+    platforms = with stdenv.lib.platforms; linux ++ darwin;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/jama/default.nix b/nixpkgs/pkgs/development/libraries/jama/default.nix
new file mode 100644
index 000000000000..29fabdbb3b63
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/jama/default.nix
@@ -0,0 +1,30 @@
+{stdenv, fetchurl, unzip, tnt}:
+
+stdenv.mkDerivation rec {
+  name = "jama-${version}";
+  version = "1.2.5";
+
+  src = fetchurl {
+    url = https://math.nist.gov/tnt/jama125.zip;
+    sha256 = "031ns526fvi2nv7jzzv02i7i5sjcyr0gj884i3an67qhsx8vyckl";
+  };
+
+  buildInputs = [ unzip ];
+  propagatedBuildInputs = [ tnt ];
+
+  unpackPhase = ''
+      mkdir "${name}"
+      unzip "$src"
+  '';
+  installPhase = ''
+      mkdir -p $out/include
+      cp *.h $out/include
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = https://math.nist.gov/tnt/;
+    description = "JAMA/C++ Linear Algebra Package: Java-like matrix C++ templates";
+    platforms = platforms.unix;
+    license = licenses.publicDomain;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/jansson/default.nix b/nixpkgs/pkgs/development/libraries/jansson/default.nix
new file mode 100644
index 000000000000..25b55f00311b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/jansson/default.nix
@@ -0,0 +1,17 @@
+{stdenv, fetchurl}:
+
+stdenv.mkDerivation rec {
+  name = "jansson-2.12";
+
+  src = fetchurl {
+    url = "http://www.digip.org/jansson/releases/${name}.tar.gz";
+    sha256 = "1jfj4xq3rdgnkxval1x2gqwhaam34qdxbplsj5fsrvs8a1vfr3az";
+  };
+
+  meta = with stdenv.lib; {
+    homepage = http://www.digip.org/jansson/;
+    description = "C library for encoding, decoding and manipulating JSON data";
+    license = licenses.mit;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/jasper/default.nix b/nixpkgs/pkgs/development/libraries/jasper/default.nix
new file mode 100644
index 000000000000..946bc17e7643
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/jasper/default.nix
@@ -0,0 +1,46 @@
+{ stdenv, fetchFromGitHub, fetchpatch, libjpeg, cmake }:
+
+stdenv.mkDerivation rec {
+  name = "jasper-${version}";
+  version = "2.0.16";
+
+  src = fetchFromGitHub {
+    repo = "jasper";
+    owner = "mdadams";
+    rev = "version-${version}";
+    sha256 = "05l75yd1zsxwv25ykwwwjs8961szv7iywf16nc6vc6qpby27ckv6";
+  };
+
+  patches = [
+    (fetchpatch {
+      name = "CVE-2018-9055.patch";
+      url = "http://paste.opensuse.org/view/raw/330751ce";
+      sha256 = "0m798m6c4v9yyhql7x684j5kppcm6884n1rrb9ljz8p9aqq2jqnm";
+    })
+  ];
+
+
+  # newer reconf to recognize a multiout flag
+  nativeBuildInputs = [ cmake ];
+  propagatedBuildInputs = [ libjpeg ];
+
+  configureFlags = [ "--enable-shared" ];
+
+  outputs = [ "bin" "dev" "out" "man" ];
+
+  enableParallelBuilding = true;
+
+  doCheck = false; # fails
+
+  postInstall = ''
+    moveToOutput bin "$bin"
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = https://www.ece.uvic.ca/~frodo/jasper/;
+    description = "JPEG2000 Library";
+    platforms = platforms.unix;
+    license = licenses.jasper;
+    maintainers = with maintainers; [ pSub ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/java/commons/bcel/default.nix b/nixpkgs/pkgs/development/libraries/java/commons/bcel/default.nix
new file mode 100644
index 000000000000..8d9b4e54fe8d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/java/commons/bcel/default.nix
@@ -0,0 +1,25 @@
+{stdenv, fetchurl}:
+
+stdenv.mkDerivation rec {
+  version = "5.2";
+  name    = "commons-bcel-${version}";
+
+  src = fetchurl {
+    url    = "mirror://apache/commons/bcel/binaries/bcel-${version}.tar.gz";
+    sha256 = "13ppnd6afljdjq21jpn4ik2h1yxq8k2kg21ghi0lyb1yap1rd7k6";
+  };
+
+  installPhase = ''
+    tar xf ${src}
+    mkdir -p $out/share/java
+    cp bcel-5.2.jar $out/share/java/
+  '';
+
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/java/commons/bsf/default.nix b/nixpkgs/pkgs/development/libraries/java/commons/bsf/default.nix
new file mode 100644
index 000000000000..e3c464482c7e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/java/commons/bsf/default.nix
@@ -0,0 +1,23 @@
+{stdenv, fetchurl}:
+
+stdenv.mkDerivation {
+  name = "commons-bsf-1.2";
+
+  src = fetchurl {
+    url = mirror://apache/commons/bsf/binaries/bsf-bin-2.4.0.tar.gz;
+    sha256 = "1my3hv4y8cvrd1kr315wvbjqsamzlzswnbqcmsa2m4hqcafddfr8";
+  };
+
+  installPhase = ''
+    mkdir -p $out/share/java
+    cp lib/bsf.jar $out/share/java/
+  '';
+
+  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;
+  };
+}
+
diff --git a/nixpkgs/pkgs/development/libraries/java/commons/compress/default.nix b/nixpkgs/pkgs/development/libraries/java/commons/compress/default.nix
new file mode 100644
index 000000000000..3c729f42320a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/java/commons/compress/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  version = "1.18";
+  name    = "commons-compress-${version}";
+
+  src = fetchurl {
+    url    = "mirror://apache/commons/compress/binaries/${name}-bin.tar.gz";
+    sha256 = "0ciwzq134rqh1fp7qba091rajf2pdagfb665rarni7glb2x4lha1";
+  };
+
+  installPhase = ''
+    tar xf ${src}
+    mkdir -p $out/share/java
+    cp *.jar $out/share/java/
+  '';
+
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/java/commons/fileupload/default.nix b/nixpkgs/pkgs/development/libraries/java/commons/fileupload/default.nix
new file mode 100644
index 000000000000..6fddc3cfe0c3
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/java/commons/fileupload/default.nix
@@ -0,0 +1,24 @@
+{stdenv, fetchurl}:
+
+stdenv.mkDerivation rec {
+  version = "1.3.1";
+  name    = "commons-fileupload-${version}";
+
+  src = fetchurl {
+    url    = "mirror://apache/commons/fileupload/binaries/${name}-bin.tar.gz";
+    sha256 = "1jy7w2j2ay56mpq4ij3331cf9zgpkm832ydr63svb35j0ymnky72";
+  };
+  installPhase = ''
+    tar xf ${src}
+    mkdir -p $out/share/java
+    cp lib/*.jar $out/share/java/
+  '';
+
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/java/commons/io/default.nix b/nixpkgs/pkgs/development/libraries/java/commons/io/default.nix
new file mode 100644
index 000000000000..03b083328da4
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/java/commons/io/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  version = "2.6";
+  name    = "commons-io-${version}";
+
+  src = fetchurl {
+    url    = "mirror://apache/commons/io/binaries/${name}-bin.tar.gz";
+    sha256 = "1nzkv8gi56l1m4h7s8bcvqm0naq3bhh7fazcmgdhcr2zkjs5zfmn";
+  };
+
+  installPhase = ''
+    tar xf ${src}
+    mkdir -p $out/share/java
+    cp *.jar $out/share/java/
+  '';
+
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/java/commons/lang/default.nix b/nixpkgs/pkgs/development/libraries/java/commons/lang/default.nix
new file mode 100644
index 000000000000..e46f22fadfb9
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/java/commons/lang/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  version = "3.6";
+  name    = "commons-lang-${version}";
+
+  src = fetchurl {
+    url    = "mirror://apache/commons/lang/binaries/commons-lang3-${version}-bin.tar.gz";
+    sha256 = "0r1wdjw48k2mk2wzyq5c3cx2zmark4q9psw52ma6v2i0sh6a9il0";
+  };
+
+  installPhase = ''
+    tar xf ${src}
+    mkdir -p $out/share/java
+    cp *.jar $out/share/java/
+  '';
+
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/java/commons/logging/default.nix b/nixpkgs/pkgs/development/libraries/java/commons/logging/default.nix
new file mode 100644
index 000000000000..4e3fa2655020
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/java/commons/logging/default.nix
@@ -0,0 +1,23 @@
+{stdenv, fetchurl}:
+
+stdenv.mkDerivation {
+  name = "commons-logging-1.2";
+
+  src = fetchurl {
+    url    = mirror://apache/commons/logging/binaries/commons-logging-1.2-bin.tar.gz;
+    sha256 = "1gc70pmcv0x6ibl89jglmr22f8zpr63iaifi49nrq399qw2qhx9z";
+  };
+
+  installPhase = ''
+    mkdir -p $out/share/java
+    cp commons-logging-*.jar $out/share/java/
+  '';
+
+  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;
+  };
+}
+
diff --git a/nixpkgs/pkgs/development/libraries/java/commons/math/default.nix b/nixpkgs/pkgs/development/libraries/java/commons/math/default.nix
new file mode 100644
index 000000000000..10c39f037890
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/java/commons/math/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  version = "3.6.1";
+  name    = "commons-math-${version}";
+
+  src = fetchurl {
+    url    = "mirror://apache/commons/math/binaries/commons-math3-${version}-bin.tar.gz";
+    sha256 = "0x4nx5pngv2n4ga11c1s4w2mf6cwydwkgs7da6wwvcjraw57bhkz";
+  };
+
+  installPhase = ''
+    tar xf ${src}
+    mkdir -p $out/share/java
+    cp *.jar $out/share/java/
+  '';
+
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/java/cup/default.nix b/nixpkgs/pkgs/development/libraries/java/cup/default.nix
new file mode 100644
index 000000000000..de031a08fe8c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/java/cup/default.nix
@@ -0,0 +1,38 @@
+{ stdenv, fetchurl, jdk, ant } :
+
+stdenv.mkDerivation rec {
+  name = "java-cup-${version}";
+  version = "11b-20160615";
+
+  src = fetchurl {
+    url = "http://www2.cs.tum.edu/projects/cup/releases/java-cup-src-${version}.tar.gz";
+    sha256 = "1ymz3plngxclh7x3xr31537rvvak7lwyd0qkmnl1mkj5drh77rz0";
+  };
+
+  sourceRoot = ".";
+
+  nativeBuildInputs = [ jdk ant ];
+
+  patches = [ ./javacup-0.11b_beta20160615-build-xml-git.patch ];
+
+  buildPhase = "ant";
+
+  installPhase = ''
+    mkdir -p $out/{bin,share/{java,java-cup}}
+    cp dist/java-cup-11b.jar $out/share/java-cup/
+    cp dist/java-cup-11b-runtime.jar $out/share/java/
+    cat > $out/bin/javacup <<EOF
+    #! $shell
+    exec ${jdk.jre}/bin/java -jar $out/share/java-cup/java-cup-11b.jar "\$@"
+    EOF
+    chmod a+x $out/bin/javacup
+  '';
+
+  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 ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/java/cup/javacup-0.11b_beta20160615-build-xml-git.patch b/nixpkgs/pkgs/development/libraries/java/cup/javacup-0.11b_beta20160615-build-xml-git.patch
new file mode 100644
index 000000000000..f2054ee9d4d3
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/java/cup/javacup-0.11b_beta20160615-build-xml-git.patch
@@ -0,0 +1,38 @@
+--- javacup/build.xml.orig	2016-06-15 07:10:15.000000000 -0300
++++ javacup/build.xml	2016-07-17 08:46:46.632722844 -0300
+@@ -21,26 +21,6 @@
+     <mkdir dir="${dist}" />
+     <loadfile property="cupversion" srcFile="version.txt" failonerror="false" />
+     <property name="cupversion" value="custombuild" unless:set="cupversion"/>
+-    <exec executable="git" outputproperty="gitversion">
+-      <arg value="log"/>
+-      <arg value="-1"/>
+-      <arg value="--format=%h"/>
+-    </exec>
+-    <exec executable="git" outputproperty="changed">
+-      <arg value="status"/>
+-      <arg value="--porcelain"/>
+-      <redirector>
+-	<outputfilterchain>
+-	<linecontainsregexp>
+-	  <regexp pattern='^M.*'/>
+-	</linecontainsregexp>
+-	<tokenfilter>
+-	  <replaceregex pattern=".*" replace="modifications based on "/>
+-	</tokenfilter>
+-	</outputfilterchain>
+-	</redirector>
+-    </exec>
+-    <property name="svnversion">${changed}${gitversion}</property>
+   </target>
+ 
+   <property environment="env" />
+@@ -79,7 +59,7 @@
+     <copy todir="${java}"><fileset dir="${src}"></fileset></copy>
+     <replace file="${java}/java_cup/version.java"
+        token="+ version_str"
+-       value='+ "v0.11b ${cupversion} (GIT ${svnversion})"'>
++       value='+ "v0.11b ${cupversion}"'>
+     </replace>
+     <javac srcdir="${java}" destdir="${classes}" verbose="off" listfiles="off" debug="on" source="1.8" target="1.8">
+       <classpath refid="libraries"/>
diff --git a/nixpkgs/pkgs/development/libraries/java/dbus-java/default.nix b/nixpkgs/pkgs/development/libraries/java/dbus-java/default.nix
new file mode 100644
index 000000000000..5ec10cc7e0df
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/java/dbus-java/default.nix
@@ -0,0 +1,26 @@
+{stdenv, fetchurl, gettext, jdk, libmatthew_java}:
+
+stdenv.mkDerivation {
+  name = "dbus-java-2.7";
+  src = fetchurl {
+    url = https://dbus.freedesktop.org/releases/dbus-java/dbus-java-2.7.tar.gz;
+    sha256 = "0cyaxd8x6sxmi6pklkkx45j311a6w51fxl4jc5j3inc4cailwh5y";
+  };
+  JAVA_HOME=jdk;
+  JAVA="${jdk}/bin/java";
+  PREFIX=''''${out}'';
+  JAVAUNIXLIBDIR="${libmatthew_java}/lib/jni";
+  JAVAUNIXJARDIR="${libmatthew_java}/share/java";
+  buildInputs = [ gettext jdk ];
+  # I'm too lazy to build the documentation
+  preBuild = ''
+    sed -i -e "s|all: bin doc man|all: bin|" \
+           -e "s|install: install-bin install-man install-doc|install: install-bin|" Makefile
+  '';
+
+  meta = with stdenv.lib; {
+    platforms = platforms.linux;
+    maintainers = [ maintainers.sander ];
+    license = licenses.afl21;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/java/geoipjava/default.nix b/nixpkgs/pkgs/development/libraries/java/geoipjava/default.nix
new file mode 100644
index 000000000000..6af8885464a3
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/java/geoipjava/default.nix
@@ -0,0 +1,27 @@
+{stdenv, fetchurl, jdk, unzip}:
+
+stdenv.mkDerivation {
+  name = "GeoIPJava-1.2.5";
+  src = fetchurl {
+    url = https://geolite.maxmind.com/download/geoip/api/java/GeoIPJava-1.2.5.zip;
+    sha256 = "1gb2d0qvvq7xankz7l7ymbr3qprwk9bifpy4hlgw0sq4i6a55ypd";
+  };
+  buildInputs = [ jdk unzip ];
+  buildPhase = 
+    ''
+      cd source
+      javac $(find . -name \*.java)
+      jar cfv maxmindgeoip.jar $(find . -name \*.class)
+    '';
+  installPhase =
+    ''
+      mkdir -p $out/share/java
+      cp maxmindgeoip.jar $out/share/java
+    '';
+  meta = {
+    description = "GeoIP Java API";
+    license = stdenv.lib.licenses.lgpl21Plus;
+    maintainers = [ stdenv.lib.maintainers.sander ];
+    platforms = stdenv.lib.platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/java/gwt-dragdrop/builder.sh b/nixpkgs/pkgs/development/libraries/java/gwt-dragdrop/builder.sh
new file mode 100644
index 000000000000..d37e110011e8
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/java/gwt-dragdrop/builder.sh
@@ -0,0 +1,4 @@
+source $stdenv/setup
+
+mkdir -p $out/share/java
+cp $src $out/share/java/$name.jar
diff --git a/nixpkgs/pkgs/development/libraries/java/gwt-dragdrop/default.nix b/nixpkgs/pkgs/development/libraries/java/gwt-dragdrop/default.nix
new file mode 100644
index 000000000000..e34699d7740e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/java/gwt-dragdrop/default.nix
@@ -0,0 +1,16 @@
+{stdenv, fetchurl}:
+
+stdenv.mkDerivation {
+  name = "gwt-dnd-2.6.5";
+  builder = ./builder.sh;
+
+  src = fetchurl {
+    url = http://gwt-dnd.googlecode.com/files/gwt-dnd-2.6.5.jar;
+    sha256 = "07zdlr8afs499asnw0dcjmw1cnjc646v91lflx5dv4qj374c97fw";
+  };
+
+  meta = with stdenv.lib; {
+    platforms = platforms.unix;
+    license = licenses.asl20;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/java/gwt-widgets/builder.sh b/nixpkgs/pkgs/development/libraries/java/gwt-widgets/builder.sh
new file mode 100644
index 000000000000..8c2502385f2b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/java/gwt-widgets/builder.sh
@@ -0,0 +1,6 @@
+source $stdenv/setup
+
+tar xfvz $src
+cd gwt-widgets-*
+mkdir -p $out/share/java
+cp gwt-widgets-*.jar $out/share/java
diff --git a/nixpkgs/pkgs/development/libraries/java/gwt-widgets/default.nix b/nixpkgs/pkgs/development/libraries/java/gwt-widgets/default.nix
new file mode 100644
index 000000000000..ec407076906d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/java/gwt-widgets/default.nix
@@ -0,0 +1,16 @@
+{stdenv, fetchurl}:
+
+stdenv.mkDerivation {
+  name = "gwt-widgets-0.2.0";
+  builder = ./builder.sh;
+
+  src = fetchurl {
+    url = mirror://sourceforge/gwt-widget/gwt-widgets-0.2.0-bin.tar.gz;
+    sha256 = "09isj4j6842rj13nv8264irkjjhvmgihmi170ciabc98911bakxb";
+  };
+
+  meta = with stdenv.lib; {
+    platforms = platforms.unix;
+    license = with licenses; [ afl21 lgpl2 ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/java/hsqldb/builder.sh b/nixpkgs/pkgs/development/libraries/java/hsqldb/builder.sh
new file mode 100755
index 000000000000..d7de23ab95eb
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/java/hsqldb/builder.sh
@@ -0,0 +1,6 @@
+source $stdenv/setup
+
+unzip $src
+cd hsqldb*
+mkdir -p $out
+cp -R * $out/
diff --git a/nixpkgs/pkgs/development/libraries/java/hsqldb/default.nix b/nixpkgs/pkgs/development/libraries/java/hsqldb/default.nix
new file mode 100644
index 000000000000..a478ab0fc502
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/java/hsqldb/default.nix
@@ -0,0 +1,20 @@
+{ stdenv, fetchurl, unzip
+}:
+
+stdenv.mkDerivation {
+  name = "hsqldb-2.4.0";
+  builder = ./builder.sh;
+
+  src = fetchurl {
+    url = mirror://sourceforge/hsqldb/hsqldb_1_8_0_9.zip;
+    sha256 = "1v5dslwsqb7csjmi5g78pghsay2pszidvlzhyi79y18mra5iv3g9";
+  };
+
+  buildInputs = [ unzip
+  ];
+
+  meta = with stdenv.lib; {
+    platforms = platforms.unix;
+    license = licenses.bsd3;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/java/httpunit/builder.sh b/nixpkgs/pkgs/development/libraries/java/httpunit/builder.sh
new file mode 100755
index 000000000000..273850082958
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/java/httpunit/builder.sh
@@ -0,0 +1,5 @@
+source $stdenv/setup
+
+$unzip/bin/unzip $src
+mkdir $out
+mv $name/* $out/
diff --git a/nixpkgs/pkgs/development/libraries/java/httpunit/default.nix b/nixpkgs/pkgs/development/libraries/java/httpunit/default.nix
new file mode 100644
index 000000000000..500c575f73aa
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/java/httpunit/default.nix
@@ -0,0 +1,19 @@
+{stdenv, fetchurl, unzip} :
+
+stdenv.mkDerivation {
+  name = "httpunit-1.7";
+  builder = ./builder.sh;
+
+  src = fetchurl {
+    url = mirror://sourceforge/httpunit/httpunit-1.7.zip;
+    sha256 = "09gnayqgizd8cjqayvdpkxrc69ipyxawc96aznfrgdhdiwv8l5zf";
+  };
+
+  inherit unzip;
+
+  meta = with stdenv.lib; {
+    homepage = http://httpunit.sourceforge.net;
+    platforms = platforms.unix;
+    license = licenses.mit;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/java/hydra-ant-logger/default.nix b/nixpkgs/pkgs/development/libraries/java/hydra-ant-logger/default.nix
new file mode 100644
index 000000000000..7d1fac39b1cb
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/java/hydra-ant-logger/default.nix
@@ -0,0 +1,25 @@
+{ fetchgit, stdenv, ant, jdk }:
+
+stdenv.mkDerivation rec {
+  name = "hydra-ant-logger-${version}";
+  version = "2010.2";
+
+  src = fetchgit {
+    url = https://github.com/NixOS/hydra-ant-logger.git;
+    rev = "dae3224f4ed42418d3492bdf5bee4f825819006f";
+    sha256 = "01s7m6007rn9107rw5wcgna7i20x6p6kfzl4f79jrvpkjy6kz176";
+  };
+
+  buildInputs = [ ant jdk ];
+
+  buildPhase = "mkdir lib; ant";
+
+  installPhase = ''
+    mkdir -p $out/share/java
+    cp -v *.jar $out/share/java
+  '';
+
+  meta = {
+    platforms = stdenv.lib.platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/java/jdom/builder.sh b/nixpkgs/pkgs/development/libraries/java/jdom/builder.sh
new file mode 100755
index 000000000000..dbec4b6f3e0e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/java/jdom/builder.sh
@@ -0,0 +1,6 @@
+set -e
+source $stdenv/setup
+
+tar zxvf $src
+mkdir -p $out
+mv * $out
diff --git a/nixpkgs/pkgs/development/libraries/java/jdom/default.nix b/nixpkgs/pkgs/development/libraries/java/jdom/default.nix
new file mode 100644
index 000000000000..16755471acd7
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/java/jdom/default.nix
@@ -0,0 +1,18 @@
+{stdenv, fetchurl} :
+
+stdenv.mkDerivation {
+  name = "jdom-1.0";
+  builder = ./builder.sh;
+
+  src = fetchurl {
+    url = http://www.jdom.org/dist/binary/jdom-1.0.tar.gz;
+    sha256 = "1igmxzcy0s25zcy9vmcw0kd13lh60r0b4qg8lnp1jic33f427pxf";
+  };
+
+  meta = with stdenv.lib; {
+    description = "Java-based solution for accessing, manipulating, and outputting XML data from Java code";
+    homepage = http://www.jdom.org;
+    platforms = platforms.unix;
+    license = licenses.bsdOriginal;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/java/jflex/default.nix b/nixpkgs/pkgs/development/libraries/java/jflex/default.nix
new file mode 100644
index 000000000000..744419dcd533
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/java/jflex/default.nix
@@ -0,0 +1,37 @@
+{stdenv, fetchurl, jre} :
+
+stdenv.mkDerivation rec {
+  name = "jflex-1.7.0";
+
+  src = fetchurl {
+    url = "http://jflex.de/release/${name}.tar.gz";
+    sha256 = "1k7bqw1mn569g9dxc0ia3yz1bzgzs5w52lh1xn3hgj7k5ymh54kk";
+  };
+
+  sourceRoot = name;
+
+  installPhase = ''
+    runHook preInstall
+    mkdir -p $out
+    cp -a * $out
+    rm -f $out/bin/jflex.bat
+
+    patchShebangs $out
+    sed -i -e '/^JAVA=java/ s#java#${jre}/bin/java#' $out/bin/jflex
+    runHook postInstall
+  '';
+
+  doInstallCheck = true;
+  installCheckPhase = ''
+    runHook preInstallCheck
+    $out/bin/jflex --version
+    runHook postInstallCheck
+  '';
+
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/java/junit/default.nix b/nixpkgs/pkgs/development/libraries/java/junit/default.nix
new file mode 100644
index 000000000000..0879f0a69260
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/java/junit/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, antBuild, fetchgit, perl }:
+
+let
+  version = "4.11";
+in antBuild {
+  name = "junit-${version}";
+
+  # I think this is only used to generate the docs, and will likely disappear
+  # with the next release of junit since its build system completely changes.
+  buildInputs = [perl];
+
+  src = fetchgit {
+    url = "https://github.com/junit-team/junit.git";
+    sha256 = "1cn5dhs6vpbfbcmnm2vb1212n0kblv8cxrvnwmksjxd6bzlkac1k";
+    rev = "c2e4d911fadfbd64444fb285342a8f1b72336169";
+  };
+
+  antProperties = [
+    { name = "version"; value = version; }
+  ];
+
+  meta = {
+    homepage = http://www.junit.org/;
+    description = "A framework for repeatable tests in Java";
+    license = stdenv.lib.licenses.epl10;
+    broken = true;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/java/junixsocket/darwin.patch b/nixpkgs/pkgs/development/libraries/java/junixsocket/darwin.patch
new file mode 100644
index 000000000000..97fd42d0b81b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/java/junixsocket/darwin.patch
@@ -0,0 +1,20 @@
+diff -rc junixsocket-1.3/src/main/org/newsclub/net/unix/NativeUnixSocket.java junixsocket-1.3-new/src/main/org/newsclub/net/unix/NativeUnixSocket.java
+*** junixsocket-1.3/src/main/org/newsclub/net/unix/NativeUnixSocket.java        Tue Jul 20 14:59:41 2010
+--- junixsocket-1.3-new/src/main/org/newsclub/net/unix/NativeUnixSocket.java    Sun May 27 22:26:15 2012
+***************
+*** 43,49 ****
+              String prefix = "lib";
+              String suffix = ".so";
+              String os = osName.replaceAll("[^A-Za-z0-9]", "").toLowerCase();
+!             if ("macosx".equals(os)) {
+                  suffix = ".dylib";
+              } else if ("linux".equals(os) || "freebsd".equals(os)
+                      || "sunos".equals(os)) {
+--- 43,49 ----
+              String prefix = "lib";
+              String suffix = ".so";
+              String os = osName.replaceAll("[^A-Za-z0-9]", "").toLowerCase();
+!             if ("macosx".equals(os) || "darwin".equals(os)) {
+                  suffix = ".dylib";
+              } else if ("linux".equals(os) || "freebsd".equals(os)
+                      || "sunos".equals(os)) {
diff --git a/nixpkgs/pkgs/development/libraries/java/junixsocket/default.nix b/nixpkgs/pkgs/development/libraries/java/junixsocket/default.nix
new file mode 100644
index 000000000000..bc34957b9c3e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/java/junixsocket/default.nix
@@ -0,0 +1,42 @@
+{ stdenv, fetchurl, ant, jdk, junit }:
+
+stdenv.mkDerivation rec {
+  name = "junixsocket-1.3";
+
+  src = fetchurl {
+    url = "https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/junixsocket/${name}-src.tar.bz2";
+    sha256 = "0c6p8vmiv5nk8i6g1hgivnl3mpb2k3lhjjz0ss9dlirisfrxf1ym";
+  };
+
+  patches = [ ./darwin.patch ];
+
+  buildInputs = [ ant jdk junit ];
+
+  preConfigure =
+    ''
+      substituteInPlace src/main/org/newsclub/net/unix/NativeUnixSocketConfig.java \
+        --replace /opt/newsclub/lib-native $out/lib
+    '';
+
+  buildPhase = "ant";
+
+  ANT_ARGS =
+    # 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";
+
+  installPhase =
+    ''
+      mkdir -p $out/share/java $out/lib
+      cp -v dist/*.jar $out/share/java
+      cp -v lib-native/*.so lib-native/*.dylib $out/lib/
+    '';
+
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/java/jzmq/default.nix b/nixpkgs/pkgs/development/libraries/java/jzmq/default.nix
new file mode 100644
index 000000000000..402f893034b6
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/java/jzmq/default.nix
@@ -0,0 +1,30 @@
+{ stdenv, fetchFromGitHub, autoreconfHook, pkgconfig, zeromq3, jdk }:
+
+stdenv.mkDerivation rec {
+  name = "jzmq-${version}";
+  version = "3.1.0";
+
+  src = fetchFromGitHub {
+    owner = "zeromq";
+    repo = "jzmq";
+    rev = "v${version}";
+    sha256 = "1wlzs604mgmqmrgpk4pljx2nrlxzdfi3r8k59qlm90fx8qkqkc63";
+  };
+
+  nativeBuildInputs = [ autoreconfHook pkgconfig ];
+  buildInputs = [ zeromq3 jdk ];
+
+  preConfigure = ''
+    ${if stdenv.hostPlatform.system == "x86_64-darwin" then
+      '' sed -i -e 's~/Headers~/include~' -e 's~_JNI_INC_SUBDIRS=\".*\"~_JNI_INC_SUBDIRS=\"darwin\"~' configure
+      '' else ""}
+  '';
+
+  meta = {
+    homepage = http://www.zeromq.org;
+    description = "Java bindings for ZeroMQ";
+    platforms = stdenv.lib.platforms.unix;
+    license = stdenv.lib.licenses.lgpl3;
+    maintainers = [ stdenv.lib.maintainers.vizanto ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/java/libmatthew-java/default.nix b/nixpkgs/pkgs/development/libraries/java/libmatthew-java/default.nix
new file mode 100644
index 000000000000..98291a7763ca
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/java/libmatthew-java/default.nix
@@ -0,0 +1,18 @@
+{stdenv, fetchurl, jdk}:
+
+stdenv.mkDerivation {
+  name = "libmatthew-java-0.8";
+  src = fetchurl {
+    url = https://src.fedoraproject.org/repo/pkgs/libmatthew-java/libmatthew-java-0.8.tar.gz/8455b8751083ce25c99c2840609271f5/libmatthew-java-0.8.tar.gz;
+    sha256 = "1yldkhsdzm0a41a0i881bin2jklhp85y3ah245jd6fz3npcx7l85";
+  };
+  JAVA_HOME=jdk;
+  PREFIX=''''${out}'';
+  buildInputs = [ jdk ];
+
+  meta = with stdenv.lib; {
+    platforms = platforms.linux;
+    maintainers = [ maintainers.sander ];
+    license = licenses.mit;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/java/lombok/default.nix b/nixpkgs/pkgs/development/libraries/java/lombok/default.nix
new file mode 100644
index 000000000000..be3ddfff4c84
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/java/lombok/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "lombok-1.18.8";
+
+  src = fetchurl {
+    url = "https://projectlombok.org/downloads/${name}.jar";
+    sha256 = "1z14rc3fh03qvn2xkjrb7ha0hddv3f3vsp781xm336sp4cl9b5h3";
+  };
+
+  buildCommand = ''
+    mkdir -p $out/share/java
+    cp $src $out/share/java/lombok.jar
+  '';
+
+  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;
+    homepage = https://projectlombok.org/;
+    maintainers = [ stdenv.lib.maintainers.CrystalGamma ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/java/lucene/builder.sh b/nixpkgs/pkgs/development/libraries/java/lucene/builder.sh
new file mode 100755
index 000000000000..d95feb5eeb44
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/java/lucene/builder.sh
@@ -0,0 +1,6 @@
+set -e
+source $stdenv/setup
+
+tar zxvf $src
+mkdir -p $out
+mv $name/* $out
diff --git a/nixpkgs/pkgs/development/libraries/java/lucene/default.nix b/nixpkgs/pkgs/development/libraries/java/lucene/default.nix
new file mode 100644
index 000000000000..691b9905b04f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/java/lucene/default.nix
@@ -0,0 +1,19 @@
+{stdenv, fetchurl} :
+
+stdenv.mkDerivation rec {
+  name = "lucene-${version}";
+  version = "1.4.3";
+
+  builder = ./builder.sh;
+
+  src = fetchurl {
+    url = "https://archive.apache.org/dist/jakarta/lucene/${name}.tar.gz";
+    sha256 = "1mxaxg65f7v8n60irjwm24v7hcisbl0srmpvcy1l4scs6rjj1awh";
+  };
+
+  meta = with stdenv.lib; {
+    description = "Java full-text search engine";
+    platforms = platforms.unix;
+    license = licenses.asl20;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/java/mockobjects/builder.sh b/nixpkgs/pkgs/development/libraries/java/mockobjects/builder.sh
new file mode 100755
index 000000000000..fd5d1a20869c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/java/mockobjects/builder.sh
@@ -0,0 +1,6 @@
+set -e
+source $stdenv/setup
+
+tar xvf $src
+mkdir -p $out
+mv * $out
diff --git a/nixpkgs/pkgs/development/libraries/java/mockobjects/default.nix b/nixpkgs/pkgs/development/libraries/java/mockobjects/default.nix
new file mode 100644
index 000000000000..ae93765ff981
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/java/mockobjects/default.nix
@@ -0,0 +1,17 @@
+{stdenv, fetchurl} :
+
+stdenv.mkDerivation {
+  name = "mockobjects-0.09";
+  builder = ./builder.sh;
+
+  src = fetchurl {
+    url = mirror://sourceforge/mockobjects/mockobjects-bin-0.09.tar;
+    sha256 = "18rnyqfcyh0s3dwkkaszdd50ssyjx5fa1y3ii309ldqg693lfgnz";
+  };
+
+  meta = with stdenv.lib; {
+    description = "Generic unit testing framework and methodology for testing any kind of code";
+    platforms = platforms.unix;
+    license = licenses.asl20;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/java/rhino/default.nix b/nixpkgs/pkgs/development/libraries/java/rhino/default.nix
new file mode 100644
index 000000000000..544f0f4c4e91
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/java/rhino/default.nix
@@ -0,0 +1,59 @@
+{ fetchurl, stdenv, unzip, ant, javac, jvm }:
+
+let
+  version = "1.7R2";
+
+  xbeans  = fetchurl {
+    url = "http://archive.apache.org/dist/xmlbeans/binaries/xmlbeans-2.2.0.zip";
+    sha256 = "1pb08d9j81d0wz5wj31idz198iwhqb7mch872n08jh1354rjlqwk";
+  };
+in
+
+stdenv.mkDerivation {
+  name = "rhino-${version}";
+
+  src = fetchurl {
+    url = "mirror://mozilla/js/rhino1_7R2.zip";
+    sha256 = "1p32hkghi6bkc3cf2dcqyaw5cjj7403mykcp0fy8f5bsnv0pszv7";
+  };
+
+  patches = [ ./gcj-type-mismatch.patch ];
+
+  hardeningDisable = [ "fortify" "format" ];
+
+  preConfigure =
+    ''
+      find -name \*.jar -or -name \*.class -exec rm -v {} \;
+
+      # The build process tries to download it by itself.
+      mkdir -p "build/tmp-xbean"
+      ln -sv "${xbeans}" "build/tmp-xbean/xbean.zip"
+    '';
+
+  buildInputs = [ unzip ant javac jvm ];
+
+  buildPhase = "ant jar";
+  doCheck    = false;
+
+  # FIXME: Install javadoc as well.
+  installPhase =
+    ''
+      mkdir -p "$out/share/java"
+      cp -v *.jar "$out/share/java"
+    '';
+
+  meta = with stdenv.lib; {
+    description = "An implementation of JavaScript written in Java";
+
+    longDescription =
+      '' Rhino is an open-source implementation of JavaScript written
+         entirely in Java.  It is typically embedded into Java applications
+         to provide scripting to end users.
+      '';
+
+    homepage = http://www.mozilla.org/rhino/;
+
+    license = with licenses; [ mpl11 /* or */ gpl2Plus ];
+    platforms = platforms.linux ++ platforms.darwin;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/java/rhino/gcj-type-mismatch.patch b/nixpkgs/pkgs/development/libraries/java/rhino/gcj-type-mismatch.patch
new file mode 100644
index 000000000000..dac7b209069a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/java/rhino/gcj-type-mismatch.patch
@@ -0,0 +1,103 @@
+Work around GCJ bug #35410:
+http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35410 .
+
+diff --git a/src/org/mozilla/javascript/Arguments.java b/src/org/mozilla/javascript/Arguments.java
+index d914294..d658f12 100644
+--- a/src/org/mozilla/javascript/Arguments.java
++++ b/src/org/mozilla/javascript/Arguments.java
+@@ -144,7 +144,7 @@ final class Arguments extends IdScriptableObject
+                 synchronized (this) {
+                     if (args[index] != NOT_FOUND) {
+                         if (args == activation.originalArgs) {
+-                            args = args.clone();
++                            args = (Object[]) args.clone();
+                         }
+                         args[index] = value;
+                         return;
+@@ -162,7 +162,7 @@ final class Arguments extends IdScriptableObject
+             synchronized (this) {
+                 if (args[index] != NOT_FOUND) {
+                     if (args == activation.originalArgs) {
+-                        args = args.clone();
++                        args = (Object[]) args.clone();
+                     }
+                     args[index] = NOT_FOUND;
+                     return;
+diff --git a/src/org/mozilla/javascript/FunctionObject.java b/src/org/mozilla/javascript/FunctionObject.java
+index 1d6c752..3adc100 100644
+--- a/src/org/mozilla/javascript/FunctionObject.java
++++ b/src/org/mozilla/javascript/FunctionObject.java
+@@ -455,7 +455,7 @@ public class FunctionObject extends BaseFunction
+                     Object converted = convertArg(cx, scope, arg, typeTags[i]);
+                     if (arg != converted) {
+                         if (invokeArgs == args) {
+-                            invokeArgs = args.clone();
++                            invokeArgs = (Object[]) args.clone();
+                         }
+                         invokeArgs[i] = converted;
+                     }
+diff --git a/src/org/mozilla/javascript/Interpreter.java b/src/org/mozilla/javascript/Interpreter.java
+index f7f544d..e125e2f 100644
+--- a/src/org/mozilla/javascript/Interpreter.java
++++ b/src/org/mozilla/javascript/Interpreter.java
+@@ -285,9 +285,9 @@ public class Interpreter implements Evaluator
+             // clone stack but keep varSource to point to values
+             // from this frame to share variables.
+ 
+-            copy.stack = stack.clone();
+-            copy.stackAttributes = stackAttributes.clone();
+-            copy.sDbl = sDbl.clone();
++            copy.stack = (Object[]) stack.clone();
++            copy.stackAttributes = (int[]) stackAttributes.clone();
++            copy.sDbl = (double[]) sDbl.clone();
+ 
+             copy.frozen = false;
+             return copy;
+diff --git a/src/org/mozilla/javascript/NativeJavaClass.java b/src/org/mozilla/javascript/NativeJavaClass.java
+index f72f9e7..25c6757 100644
+--- a/src/org/mozilla/javascript/NativeJavaClass.java
++++ b/src/org/mozilla/javascript/NativeJavaClass.java
+@@ -271,7 +271,7 @@ public class NativeJavaClass extends NativeJavaObject implements Function
+                 Object x = Context.jsToJava(arg, argTypes[i]);
+                 if (x != arg) {
+                     if (args == origArgs) {
+-                        args = origArgs.clone();
++                        args = (Object[]) origArgs.clone();
+                     }
+                     args[i] = x;
+                 }
+diff --git a/src/org/mozilla/javascript/NativeJavaMethod.java b/src/org/mozilla/javascript/NativeJavaMethod.java
+index b6eaf8b..dc699a0 100644
+--- a/src/org/mozilla/javascript/NativeJavaMethod.java
++++ b/src/org/mozilla/javascript/NativeJavaMethod.java
+@@ -213,7 +213,7 @@ public class NativeJavaMethod extends BaseFunction
+                 Object coerced = Context.jsToJava(arg, argTypes[i]);
+                 if (coerced != arg) {
+                     if (origArgs == args) {
+-                        args = args.clone();
++                        args = (Object[]) args.clone();
+                     }
+                     args[i] = coerced;
+                 }
+diff --git a/src/org/mozilla/javascript/regexp/NativeRegExp.java b/src/org/mozilla/javascript/regexp/NativeRegExp.java
+index 0bae489..f7124bf 100644
+--- a/src/org/mozilla/javascript/regexp/NativeRegExp.java
++++ b/src/org/mozilla/javascript/regexp/NativeRegExp.java
+@@ -2168,7 +2168,7 @@ System.out.println("Testing at " + gData.cp + ", op = " + op);
+                     // XXX: If backTrackData will no longer be used, then
+                     // there is no need to clone backTrackData.parens
+                     if (backTrackData.parens != null) {
+-                        gData.parens = backTrackData.parens.clone();
++                        gData.parens = (long[]) backTrackData.parens.clone();
+                     }
+ 
+                     gData.cp = backTrackData.cp;
+@@ -2708,7 +2708,7 @@ class REBackTrackData {
+         continuation_pc = pc;
+         lastParen = gData.lastParen;
+         if (gData.parens != null) {
+-            parens = gData.parens.clone();
++            parens = (long[]) gData.parens.clone();
+         }
+         cp = gData.cp;
+         stateStackTop = gData.stateStackTop;
diff --git a/nixpkgs/pkgs/development/libraries/java/saxon/default.nix b/nixpkgs/pkgs/development/libraries/java/saxon/default.nix
new file mode 100644
index 000000000000..687e1e8a1deb
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/java/saxon/default.nix
@@ -0,0 +1,83 @@
+{ stdenv, fetchurl, unzip, jre }:
+
+let
+  common = { pname, version, src, description
+           , prog ? null, jar ? null, license ? stdenv.lib.licenses.mpl20 }:
+    stdenv.mkDerivation {
+      name = "${pname}-${version}";
+      inherit pname version src;
+
+      nativeBuildInputs = [ unzip ];
+
+      buildCommand = let
+        prog' = if prog == null then pname else prog;
+        jar' = if jar == null then pname else jar;
+      in ''
+        unzip $src -d $out
+        mkdir -p $out/bin $out/share $out/share/java
+        cp -s "$out"/*.jar "$out/share/java/"  # */
+        rm -rf $out/notices
+        mv $out/doc $out/share
+        cat > $out/bin/${prog'} <<EOF
+        #! $shell
+        export JAVA_HOME=${jre}
+        exec ${jre}/bin/java -jar $out/${jar'}.jar "\$@"
+        EOF
+        chmod a+x $out/bin/${prog'}
+      '';
+
+      meta = with stdenv.lib; {
+        inherit description license;
+        homepage = http://saxon.sourceforge.net/;
+        maintainers = with maintainers; [ rvl ];
+        platforms = platforms.all;
+      };
+    };
+
+in {
+  saxon = common {
+    pname = "saxon";
+    version = "6.5.3";
+    src = fetchurl {
+      url = mirror://sourceforge/saxon/saxon6_5_3.zip;
+      sha256 = "0l5y3y2z4wqgh80f26dwwxwncs8v3nkz3nidv14z024lmk730vs3";
+    };
+    description = "XSLT 1.0 processor";
+    # http://saxon.sourceforge.net/saxon6.5.3/conditions.html
+    license = stdenv.lib.licenses.mpl10;
+  };
+
+  saxonb_8_8 = common {
+    pname = "saxonb";
+    version = "8.8";
+    jar = "saxon8";
+    src = fetchurl {
+      url = mirror://sourceforge/saxon/saxonb8-8j.zip;
+      sha256 = "15bzrfyd2f1045rsp9dp4znyhmizh1pm97q8ji2bc0b43q23xsb8";
+    };
+    description = "Complete and conformant processor of XSLT 2.0, XQuery 1.0, and XPath 2.0";
+  };
+
+  saxonb_9_1 = common {
+    pname = "saxonb";
+    version = "9.1.0.8";
+    jar = "saxon9";
+    src = fetchurl {
+      url = mirror://sourceforge/saxon/Saxon-B/9.1.0.8/saxonb9-1-0-8j.zip;
+      sha256 = "1d39jdnwr3v3pzswm81zry6yikqlqy9dp2l2wmpqdiw00r5drg4j";
+    };
+    description = "Complete and conformant processor of XSLT 2.0, XQuery 1.0, and XPath 2.0";
+  };
+
+  saxon-he = common {
+    pname = "saxon-he";
+    version = "9.9.0.1";
+    prog = "saxon-he";
+    jar = "saxon9he";
+    src = fetchurl {
+      url = mirror://sourceforge/saxon/Saxon-HE/9.9/SaxonHE9-9-0-1J.zip;
+      sha256 = "1inxd7ia7rl9fxfrw8dy9sb7rqv76ipblaki5262688wf2dscs60";
+    };
+    description = "Processor for XSLT 3.0, XPath 2.0 and 3.1, and XQuery 3.1";
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/java/smack/builder.sh b/nixpkgs/pkgs/development/libraries/java/smack/builder.sh
new file mode 100644
index 000000000000..c97259e6a17e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/java/smack/builder.sh
@@ -0,0 +1,7 @@
+source $stdenv/setup
+
+mkdir smack
+cd smack
+tar xfvz $src
+mkdir -p $out/share/java
+cp libs/smack-*.jar $out/share/java
diff --git a/nixpkgs/pkgs/development/libraries/java/smack/default.nix b/nixpkgs/pkgs/development/libraries/java/smack/default.nix
new file mode 100644
index 000000000000..e28925c65bb2
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/java/smack/default.nix
@@ -0,0 +1,16 @@
+{stdenv, fetchurl}:
+
+stdenv.mkDerivation {
+  name = "smack-4.1.9";
+  builder = ./builder.sh;
+
+  src = fetchurl {
+    url = http://www.igniterealtime.org/downloadServlet?filename=smack/smack_4_1_9.tar.gz;
+    sha256 = "009x0qcxd4dkvwcjz2nla470pwbabwvg37wc21pslpw42ldi0bzp";
+  };
+
+  meta = {
+    platforms = stdenv.lib.platforms.unix;
+    license = stdenv.lib.licenses.asl20;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/java/swt/default.nix b/nixpkgs/pkgs/development/libraries/java/swt/default.nix
new file mode 100644
index 000000000000..0dc9e8bd892c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/java/swt/default.nix
@@ -0,0 +1,73 @@
+{ stdenv, lib, fetchurl, unzip, jdk, pkgconfig, gtk2
+, libXt, libXtst, libXi, libGLU_combined, webkitgtk, libsoup, xorg
+, pango, gdk_pixbuf, glib
+}:
+
+let
+  platformMap = {
+    "x86_64-linux" =
+      { platform = "gtk-linux-x86_64";
+        sha256 = "1qq0pjll6030v4ml0hifcaaik7sx3fl7ghybfdw95vsvxafwp2ff"; };
+    "i686-linux" =
+      { platform = "gtk-linux-x86";
+        sha256 = "03mhzraikcs4fsz7d3h5af9pw1bbcfd6dglsvbk2ciwimy9zj30q"; };
+    "x86_64-darwin" =
+      { platform = "cocoa-macosx-x86_64";
+        sha256 = "00k1mfbncvyh8klgmk0891w8jwnd5niqb16j1j8yacrm2smmlb05"; };
+  };
+
+  metadata = assert platformMap ? ${stdenv.hostPlatform.system}; platformMap.${stdenv.hostPlatform.system};
+
+in stdenv.mkDerivation rec {
+  version = "4.5";
+  fullVersion = "${version}-201506032000";
+  name = "swt-${version}";
+
+  hardeningDisable = [ "format" ];
+
+  # Alas, the Eclipse Project apparently doesn't produce source-only
+  # releases of SWT.  So we just grab a binary release and extract
+  # "src.zip" from that.
+  src = fetchurl {
+    url = "http://archive.eclipse.org/eclipse/downloads/drops4/R-${fullVersion}/${name}-${metadata.platform}.zip";
+    sha256 = metadata.sha256;
+  };
+
+  sourceRoot = ".";
+
+  nativeBuildInputs = [ unzip pkgconfig ];
+  buildInputs = [ jdk gtk2 libXt libXtst libXi libGLU_combined webkitgtk libsoup ];
+
+  NIX_LFLAGS = (map (x: "-L${lib.getLib x}/lib") [ xorg.libX11 pango gdk_pixbuf glib ]) ++
+    [ "-lX11" "-lpango-1.0" "-lgdk_pixbuf-2.0" "-lglib-2.0" ];
+
+  buildPhase = ''
+    unzip src.zip -d src
+
+    cd src
+    sed -i "s#^LFLAGS =#LFLAGS = $NIX_LFLAGS #g"  *.mak
+    export JAVA_HOME=${jdk}
+
+    sh ./build.sh
+
+    mkdir out
+    javac -d out/ $(find org/ -name "*.java")
+  '';
+
+  installPhase = ''
+    mkdir -p $out/lib
+    cp *.so $out/lib
+
+    mkdir -p $out/jars
+    cp version.txt out/
+    cd out && jar -c * > $out/jars/swt.jar
+  '';
+
+  meta = with stdenv.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;
+    maintainers = with maintainers; [ pSub ];
+    platforms = with platforms; linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/jbig2dec/default.nix b/nixpkgs/pkgs/development/libraries/jbig2dec/default.nix
new file mode 100644
index 000000000000..04a165866faf
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/jbig2dec/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchurl, python }:
+
+stdenv.mkDerivation rec {
+  name = "jbig2dec-0.14";
+
+  src = fetchurl {
+    url = "https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs922/${name}.tar.gz";
+    sha256 = "0k01hp0q4275fj4rbr1gy64svfraw5w7wvwl08yjhvsnpb1rid11";
+  };
+
+  postPatch = ''
+    patchShebangs test_jbig2dec.py
+  '';
+
+  checkInputs = [ python ];
+  doCheck = false; # fails 1 of 4 tests
+
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/jbigkit/default.nix b/nixpkgs/pkgs/development/libraries/jbigkit/default.nix
new file mode 100644
index 000000000000..2b2f75abfd17
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/jbigkit/default.nix
@@ -0,0 +1,41 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "jbigkit-2.1";
+
+  src = fetchurl {
+    url = "https://www.cl.cam.ac.uk/~mgk25/jbigkit/download/${name}.tar.gz";
+    sha256 = "0cnrcdr1dwp7h7m0a56qw09bv08krb37mpf7cml5sjdgpyv0cwfy";
+  };
+
+  postPatch = ''
+    sed -i 's/^\(CFLAGS.*\)$/\1 -fPIC/' Makefile
+  '' + stdenv.lib.optionalString stdenv.cc.isClang ''
+    for f in Makefile libjbig/Makefile pbmtools/Makefile; do
+        substituteInPlace $f --replace "CC = gcc" "CC = clang"
+    done
+  '';
+
+  installPhase = ''
+    install -D -m644 libjbig/libjbig.a $out/lib/libjbig.a
+    install -D -m644 libjbig/libjbig85.a $out/lib/libjbig85.a
+    install -D -m644 libjbig/jbig.h $out/include/jbig.h
+    install -D -m644 libjbig/jbig_ar.h $out/include/jbig_ar.h
+    install -D -m644 libjbig/jbig85.h $out/include/jbig85.h
+
+    install -d -m755 $out/share/man/man1
+    install -m644 pbmtools/*.1* $out/share/man/man1
+
+    install -D -m755 pbmtools/jbgtopbm $out/bin/jbgtopbm
+    install -D -m755 pbmtools/pbmtojbg $out/bin/pbmtojbg
+    install -D -m755 pbmtools/jbgtopbm85 $out/bin/jbgtopbm85
+    install -D -m755 pbmtools/pbmtojbg85 $out/bin/pbmtojbg85
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = http://www.cl.cam.ac.uk/~mgk25/jbigkit/;
+    description = "A software implementation of the JBIG1 data compression standard";
+    license = licenses.gpl2;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/jcal/default.nix b/nixpkgs/pkgs/development/libraries/jcal/default.nix
new file mode 100644
index 000000000000..dfb0003cc98a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/jcal/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchFromGitHub, autoreconfHook
+, readline
+}:
+
+stdenv.mkDerivation rec {
+  name = "jcal";
+  version = "0.4.1";
+
+  src = fetchFromGitHub {
+    owner = "fzerorubigd";
+    repo = "jcal";
+    rev = "v${version}";
+    sha256 = "0m3g3rf0ycv2dsfn9y2472fa3r0yla8pfqk6gq00nrscsc3pp4zf";
+  };
+
+  nativeBuildInputs = [ autoreconfHook ];
+  buildInputs = [ readline ];
+
+  preAutoreconf = "cd sources/";
+
+  meta = with stdenv.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;
+    maintainers = [ maintainers.linarcx ];
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/jemalloc/common.nix b/nixpkgs/pkgs/development/libraries/jemalloc/common.nix
new file mode 100644
index 000000000000..c14ac7c65abd
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/jemalloc/common.nix
@@ -0,0 +1,43 @@
+{ version, sha256 }:
+{ 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.
+# Causes segfaults with some software (ex. rustc), but defaults to true for backward
+# compatibility.
+, stripPrefix ? stdenv.hostPlatform.isDarwin
+, disableInitExecTls ? false
+}:
+
+with stdenv.lib;
+
+stdenv.mkDerivation rec {
+  name = "jemalloc-${version}";
+  inherit version;
+
+  src = fetchurl {
+    url = "https://github.com/jemalloc/jemalloc/releases/download/${version}/${name}.tar.bz2";
+    inherit sha256;
+  };
+
+  # see the comment on stripPrefix
+  configureFlags = []
+    ++ optional stripPrefix "--with-jemalloc-prefix="
+    ++ optional disableInitExecTls "--disable-initial-exec-tls"
+  ;
+
+  doCheck = true;
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    homepage = http://jemalloc.net;
+    description = "General purpose malloc(3) implementation";
+    longDescription = ''
+      malloc(3)-compatible memory allocator that emphasizes fragmentation
+      avoidance and scalable concurrency support.
+    '';
+    license = licenses.bsd2;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/jemalloc/default.nix b/nixpkgs/pkgs/development/libraries/jemalloc/default.nix
new file mode 100644
index 000000000000..7ea7bccd6b87
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/jemalloc/default.nix
@@ -0,0 +1,4 @@
+import ./common.nix {
+  version = "5.1.0";
+  sha256 = "0s3jpcyhzia8d4k0xyc67is78kg416p9yc3c2f9w6fhhqqffd5jk";
+}
diff --git a/nixpkgs/pkgs/development/libraries/jemalloc/jemalloc450.nix b/nixpkgs/pkgs/development/libraries/jemalloc/jemalloc450.nix
new file mode 100644
index 000000000000..d328ab8016a1
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/jemalloc/jemalloc450.nix
@@ -0,0 +1,4 @@
+import ./common.nix {
+  version = "4.5.0";
+  sha256 = "10373xhpc10pgmai9fkc1z0rs029qlcb3c0qfnvkbwdlcibdh2cl";
+} 
diff --git a/nixpkgs/pkgs/development/libraries/jitterentropy/default.nix b/nixpkgs/pkgs/development/libraries/jitterentropy/default.nix
new file mode 100644
index 000000000000..175097ef7855
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/jitterentropy/default.nix
@@ -0,0 +1,30 @@
+{ stdenv, fetchFromGitHub }:
+stdenv.mkDerivation rec {
+  name = "jitterentropy-${version}";
+  version = "2.1.2";
+
+  src = fetchFromGitHub {
+    owner = "smuellerDD";
+    repo = "jitterentropy-library";
+    rev = "v${version}";
+    sha256 = "10yl1hi0hysr53wzy2i8brs0qqnxh46mz3dcjh5mk0ad03wvbfsl";
+  };
+
+  enableParallelBuilding = true;
+
+  preInstall = ''
+    mkdir -p $out/include
+  '';
+
+  installFlags = [
+    "PREFIX=$(out)"
+  ];
+
+  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 ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/json-c/default.nix b/nixpkgs/pkgs/development/libraries/json-c/default.nix
new file mode 100644
index 000000000000..27d1b701f054
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/json-c/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchurl, autoconf }:
+
+stdenv.mkDerivation rec {
+  name = "json-c-0.13.1";
+  src = fetchurl {
+    url    = "https://s3.amazonaws.com/json-c_releases/releases/${name}-nodoc.tar.gz";
+    sha256 = "0ch1v18wk703bpbyzj7h1mkwvsw4rw4qdwvgykscypvqq10678ll";
+  };
+
+  outputs = [ "out" "dev" ];
+
+  nativeBuildInputs = [ autoconf ];  # for autoheader
+
+  meta = with stdenv.lib; {
+    description = "A JSON implementation in C";
+    homepage    = https://github.com/json-c/json-c/wiki;
+    maintainers = with maintainers; [ lovek323 ];
+    platforms   = platforms.unix;
+
+    longDescription = ''
+      JSON-C implements a reference counting object model that allows you to
+      easily construct JSON objects in C, output them as JSON formatted strings
+      and parse JSON formatted strings back into the C representation of JSON
+      objects.
+    '';
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/json-glib/default.nix b/nixpkgs/pkgs/development/libraries/json-glib/default.nix
new file mode 100644
index 000000000000..9a18b025fabe
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/json-glib/default.nix
@@ -0,0 +1,37 @@
+{ stdenv, fetchurl, glib, meson, ninja, pkgconfig, gettext
+, gobject-introspection, fixDarwinDylibNames, gnome3
+}:
+
+let
+  pname = "json-glib";
+  version = "1.4.4";
+in stdenv.mkDerivation rec {
+  name = "${pname}-${version}";
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${name}.tar.xz";
+    sha256 = "0ixwyis47v5bkx6h8a1iqlw3638cxcv57ivxv4gw2gaig51my33j";
+  };
+
+  propagatedBuildInputs = [ glib ];
+  nativeBuildInputs = [ meson ninja pkgconfig gettext gobject-introspection ];
+  buildInputs = stdenv.lib.optional stdenv.isDarwin fixDarwinDylibNames;
+
+  outputs = [ "out" "dev" ];
+
+  doCheck = true;
+
+  passthru = {
+    updateScript = gnome3.updateScript {
+      packageName = pname;
+    };
+  };
+
+  meta = with stdenv.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;
+    maintainers = with maintainers; [ lethalman ];
+    platforms = with platforms; unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/jsoncpp/default.nix b/nixpkgs/pkgs/development/libraries/jsoncpp/default.nix
new file mode 100644
index 000000000000..b543d47a050d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/jsoncpp/default.nix
@@ -0,0 +1,47 @@
+{ stdenv , fetchFromGitHub , cmake , python }:
+
+stdenv.mkDerivation rec {
+  pname = "jsoncpp";
+  version = "1.8.4";
+
+  src = fetchFromGitHub {
+    owner = "open-source-parsers";
+    repo = "jsoncpp";
+    rev = version;
+    sha256 = "1z0gj7a6jypkijmpknis04qybs1hkd04d1arr3gy89lnxmp6qzlm";
+  };
+
+  /* During darwin bootstrap, we have a cp that doesn't understand the
+   * --reflink=auto flag, which is used in the default unpackPhase for dirs
+   */
+  unpackPhase = ''
+    cp -a ${src} ${src.name}
+    chmod -R +w ${src.name}
+    export sourceRoot=${src.name}
+  '';
+
+  # Hack to be able to run the test, broken because we use
+  # CMAKE_SKIP_BUILD_RPATH to avoid cmake resetting rpath on install
+  preBuild = if stdenv.isDarwin then ''
+    export DYLD_LIBRARY_PATH="`pwd`/src/lib_json:$DYLD_LIBRARY_PATH"
+  '' else ''
+    export LD_LIBRARY_PATH="`pwd`/src/lib_json:$LD_LIBRARY_PATH"
+  '';
+
+  nativeBuildInputs = [ cmake python ];
+
+  cmakeFlags = [
+    "-DBUILD_SHARED_LIBS=ON"
+    "-DBUILD_STATIC_LIBS=OFF"
+    "-DJSONCPP_WITH_CMAKE_PACKAGE=ON"
+  ];
+
+  meta = with stdenv.lib; {
+    inherit version;
+    homepage = https://github.com/open-source-parsers/jsoncpp;
+    description = "A C++ library for interacting with JSON.";
+    maintainers = with maintainers; [ ttuegel cpages nand0p ];
+    license = licenses.mit;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/jsonrpc-glib/default.nix b/nixpkgs/pkgs/development/libraries/jsonrpc-glib/default.nix
new file mode 100644
index 000000000000..8012c6b3b149
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/jsonrpc-glib/default.nix
@@ -0,0 +1,37 @@
+{ stdenv, fetchurl, meson, ninja, glib, json-glib, pkgconfig, gobject-introspection, vala, gtk-doc, docbook_xsl, docbook_xml_dtd_43, gnome3 }:
+stdenv.mkDerivation rec {
+  pname = "jsonrpc-glib";
+  version = "3.32.0";
+
+  outputs = [ "out" "dev" "devdoc" ];
+
+  nativeBuildInputs = [ meson ninja pkgconfig gobject-introspection vala gtk-doc docbook_xsl docbook_xml_dtd_43 ];
+  buildInputs = [ glib json-glib ];
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    sha256 = "1sx6xvzzdm9k0vfmpgg07abz7a9kar20h1a9ml0wgjdxr0valq5w";
+  };
+
+  mesonFlags = [
+    "-Denable_gtk_doc=true"
+  ];
+
+  # Tests fail non-deterministically
+  # https://gitlab.gnome.org/GNOME/jsonrpc-glib/issues/2
+  doCheck = false;
+
+  passthru = {
+    updateScript = gnome3.updateScript {
+      packageName = pname;
+    };
+  };
+
+  meta = with stdenv.lib; {
+    description = "A library to communicate using the JSON-RPC 2.0 specification";
+    homepage = https://gitlab.gnome.org/GNOME/jsonrpc-glib;
+    license = licenses.lgpl21Plus;
+    maintainers = gnome3.maintainers;
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/judy/default.nix b/nixpkgs/pkgs/development/libraries/judy/default.nix
new file mode 100644
index 000000000000..01ba605b506c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/judy/default.nix
@@ -0,0 +1,23 @@
+{stdenv, fetchurl}:
+
+stdenv.mkDerivation {
+  name = "judy-1.0.5";
+
+  src = fetchurl {
+    url = mirror://sourceforge/judy/Judy-1.0.5.tar.gz;
+    sha256 = "1sv3990vsx8hrza1mvq3bhvv9m6ff08y4yz7swn6znszz24l0w6j";
+  };
+
+  # gcc 4.8 optimisations break judy.
+  # https://sourceforge.net/p/judy/mailman/message/31995144/
+  preConfigure = stdenv.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;
+    description = "State-of-the-art C library that implements a sparse dynamic array";
+    platforms = stdenv.lib.platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/jxrlib/default.nix b/nixpkgs/pkgs/development/libraries/jxrlib/default.nix
new file mode 100644
index 000000000000..47c87da065ba
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/jxrlib/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchFromGitHub, python }:
+
+stdenv.mkDerivation rec {
+  name = "${pname}-${version}";
+  pname = "jxrlib";
+  version = "1.1";
+
+  # Use the source from a fork on github because CodePlex does not
+  # deliver an easily downloadable tarball.
+  src = fetchFromGitHub {
+    owner = "4creators";
+    repo = pname;
+    rev = "f7521879862b9085318e814c6157490dd9dbbdb4";
+    sha256 = "0rk3hbh00nw0wgbfbqk1szrlfg3yq7w6ar16napww3nrlm9cj65w";
+  };
+
+  nativeBuildInputs = [ python ];
+
+  makeFlags = [ "DIR_INSTALL=$(out)" "SHARED=1" ];
+
+  meta = with stdenv.lib; {
+    description = "Implementation of the JPEG XR image codec standard";
+    homepage = https://jxrlib.codeplex.com;
+    license = licenses.bsd2;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ romildo ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/kdb/default.nix b/nixpkgs/pkgs/development/libraries/kdb/default.nix
new file mode 100644
index 000000000000..0cd8ab503566
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kdb/default.nix
@@ -0,0 +1,29 @@
+{
+  mkDerivation, lib, fetchurl,
+  extra-cmake-modules,
+  qtbase, qttranslations, kcoreaddons, python2, sqlite, postgresql, mysql
+}:
+
+mkDerivation rec {
+  pname = "kdb";
+  version = "3.2.0";
+  name = "${pname}-${version}";
+
+  src = fetchurl {
+    url = "mirror://kde/stable/${pname}/src/${name}.tar.xz";
+    sha256 = "0s909x34a56n3xwhqz27irl2gbzidax0685w2kf34f0liny872cg";
+  };
+
+  nativeBuildInputs = [ extra-cmake-modules ];
+
+  buildInputs = [ qttranslations kcoreaddons python2 sqlite postgresql mysql.connector-c ];
+
+  propagatedBuildInputs = [ qtbase ];
+
+  meta = with lib; {
+    description = "A database connectivity and creation framework for various database vendors";
+    license = licenses.lgpl2;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ zraexy ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/attica.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/attica.nix
new file mode 100644
index 000000000000..0766a589a2e0
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/attica.nix
@@ -0,0 +1,12 @@
+{ mkDerivation, lib, extra-cmake-modules, qtbase }:
+
+mkDerivation {
+  name = "attica";
+  meta = {
+    maintainers = [ lib.maintainers.ttuegel ];
+    broken = builtins.compareVersions qtbase.version "5.7.0" < 0;
+  };
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [ qtbase ];
+  outputs = [ "out" "dev" ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/baloo.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/baloo.nix
new file mode 100644
index 000000000000..d5da9f5af176
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/baloo.nix
@@ -0,0 +1,17 @@
+{
+  mkDerivation, lib,
+  extra-cmake-modules,
+  kauth, kconfig, kcoreaddons, kcrash, kdbusaddons, kfilemetadata, ki18n,
+  kidletime, kio, lmdb, qtbase, qtdeclarative, solid,
+}:
+
+mkDerivation {
+  name = "baloo";
+  meta = { maintainers = [ lib.maintainers.ttuegel ]; };
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [
+    kauth kconfig kcrash kdbusaddons ki18n kio kidletime lmdb qtdeclarative
+    solid
+  ];
+  propagatedBuildInputs = [ kcoreaddons kfilemetadata qtbase ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/bluez-qt.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/bluez-qt.nix
new file mode 100644
index 000000000000..9717e770ed51
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/bluez-qt.nix
@@ -0,0 +1,19 @@
+{ mkDerivation, lib
+, extra-cmake-modules
+, qtbase, qtdeclarative
+}:
+
+mkDerivation {
+  name = "bluez-qt";
+  meta = {
+    maintainers = [ lib.maintainers.ttuegel ];
+    broken = builtins.compareVersions qtbase.version "5.7.0" < 0;
+  };
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [ qtdeclarative ];
+  propagatedBuildInputs = [ qtbase ];
+  preConfigure = ''
+    substituteInPlace CMakeLists.txt \
+      --replace /lib/udev/rules.d "$bin/lib/udev/rules.d"
+  '';
+}
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/breeze-icons.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/breeze-icons.nix
new file mode 100644
index 000000000000..c8382ed3408b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/breeze-icons.nix
@@ -0,0 +1,13 @@
+{ mkDerivation, lib, extra-cmake-modules, gtk3, qtsvg }:
+
+mkDerivation {
+  name = "breeze-icons";
+  meta = { maintainers = [ lib.maintainers.ttuegel ]; };
+  nativeBuildInputs = [ extra-cmake-modules gtk3 ];
+  buildInputs = [ qtsvg ];
+  outputs = [ "out" ]; # only runtime outputs
+  postInstall = ''
+    gtk-update-icon-cache "''${out:?}/share/icons/breeze"
+    gtk-update-icon-cache "''${out:?}/share/icons/breeze-dark"
+  '';
+}
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/default.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/default.nix
new file mode 100644
index 000000000000..62ae433ff710
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/default.nix
@@ -0,0 +1,192 @@
+/*
+
+# New packages
+
+READ THIS FIRST
+
+This module is for official packages in KDE Frameworks 5. All available packages
+are listed in `./srcs.nix`, although a few are not yet packaged in Nixpkgs (see
+below).
+
+IF YOUR PACKAGE IS NOT LISTED IN `./srcs.nix`, IT DOES NOT GO HERE.
+
+Many of the packages released upstream are not yet built in Nixpkgs due to lack
+of demand. To add a Nixpkgs build for an upstream package, copy one of the
+existing packages here and modify it as necessary.
+
+# Updates
+
+1. Update the URL in `./fetch.sh`.
+2. Run `./maintainers/scripts/fetch-kde-qt.sh pkgs/development/libraries/kde-frameworks`
+   from the top of the Nixpkgs tree.
+3. Use `nox-review wip` to check that everything builds.
+4. Commit the changes and open a pull request.
+
+*/
+
+{ libsForQt5, lib, fetchurl }:
+
+let
+
+  srcs = import ./srcs.nix {
+    inherit fetchurl;
+    mirror = "mirror://kde";
+  };
+
+  mkDerivation = libsForQt5.callPackage ({ mkDerivation }: mkDerivation) {};
+
+  packages = self: with self;
+    # SUPPORT
+    let
+
+      propagate = out:
+        let setupHook = { writeScript }:
+              writeScript "setup-hook" ''
+                if [ "$hookName" != postHook ]; then
+                    postHooks+=("source @dev@/nix-support/setup-hook")
+                else
+                    # Propagate $${out} output
+                    propagatedUserEnvPkgs="$propagatedUserEnvPkgs @${out}@"
+
+                    if [ -z "$outputDev" ]; then
+                        echo "error: \$outputDev is unset!" >&2
+                        exit 1
+                    fi
+
+                    # Propagate $dev so that this setup hook is propagated
+                    # But only if there is a separate $dev output
+                    if [ "$outputDev" != out ]; then
+                        propagatedBuildInputs="$propagatedBuildInputs @dev@"
+                    fi
+                fi
+              '';
+        in callPackage setupHook {};
+
+      propagateBin = propagate "bin";
+
+      callPackage = self.newScope {
+
+        inherit propagate propagateBin;
+
+        mkDerivation = args:
+          let
+
+            inherit (args) name;
+            inherit (srcs."${name}") src version;
+
+            outputs = args.outputs or [ "bin" "dev" "out" ];
+            hasBin = lib.elem "bin" outputs;
+            hasDev = lib.elem "dev" outputs;
+
+            defaultSetupHook = if hasBin && hasDev then propagateBin else null;
+            setupHook = args.setupHook or defaultSetupHook;
+
+            meta = {
+              homepage = http://www.kde.org;
+              license = with lib.licenses; [
+                lgpl21Plus lgpl3Plus bsd2 mit gpl2Plus gpl3Plus fdl12
+              ];
+              maintainers = [ lib.maintainers.ttuegel ];
+              platforms = lib.platforms.linux;
+            } // (args.meta or {});
+
+          in mkDerivation (args // {
+            name = "${name}-${version}";
+            inherit meta outputs setupHook src;
+          });
+
+      };
+
+    in {
+      extra-cmake-modules = callPackage ./extra-cmake-modules {};
+
+    # TIER 1
+      attica = callPackage ./attica.nix {};
+      bluez-qt = callPackage ./bluez-qt.nix {};
+      breeze-icons = callPackage ./breeze-icons.nix {};
+      kapidox = callPackage ./kapidox.nix {};
+      karchive = callPackage ./karchive.nix {};
+      kcodecs = callPackage ./kcodecs.nix {};
+      kconfig = callPackage ./kconfig.nix {};
+      kcoreaddons = callPackage ./kcoreaddons.nix {};
+      kdbusaddons = callPackage ./kdbusaddons.nix {};
+      kdnssd = callPackage ./kdnssd.nix {};
+      kguiaddons = callPackage ./kguiaddons.nix {};
+      ki18n = callPackage ./ki18n.nix {};
+      kidletime = callPackage ./kidletime.nix {};
+      kitemmodels = callPackage ./kitemmodels.nix {};
+      kitemviews = callPackage ./kitemviews.nix {};
+      kplotting = callPackage ./kplotting.nix {};
+      kwayland = callPackage ./kwayland.nix {};
+      kwidgetsaddons = callPackage ./kwidgetsaddons.nix {};
+      kwindowsystem = callPackage ./kwindowsystem {};
+      modemmanager-qt = callPackage ./modemmanager-qt.nix {};
+      networkmanager-qt = callPackage ./networkmanager-qt.nix {};
+      oxygen-icons5 = callPackage ./oxygen-icons5.nix {};
+      prison = callPackage ./prison.nix {};
+      solid = callPackage ./solid.nix {};
+      sonnet = callPackage ./sonnet.nix {};
+      syntax-highlighting = callPackage ./syntax-highlighting.nix {};
+      threadweaver = callPackage ./threadweaver.nix {};
+      kirigami2 = callPackage ./kirigami2.nix {};
+      kholidays = callPackage ./kholidays.nix {};
+
+    # TIER 2
+      kactivities = callPackage ./kactivities.nix {};
+      kactivities-stats = callPackage ./kactivities-stats.nix {};
+      kauth = callPackage ./kauth {};
+      kcompletion = callPackage ./kcompletion.nix {};
+      kcrash = callPackage ./kcrash.nix {};
+      kdoctools = callPackage ./kdoctools {};
+      kfilemetadata = callPackage ./kfilemetadata {};
+      kimageformats = callPackage ./kimageformats.nix {};
+      kjobwidgets = callPackage ./kjobwidgets.nix {};
+      knotifications = callPackage ./knotifications.nix {};
+      kpackage = callPackage ./kpackage {};
+      kpty = callPackage ./kpty.nix {};
+      kunitconversion = callPackage ./kunitconversion.nix {};
+      syndication = callPackage ./syndication.nix {};
+
+    # TIER 3
+      baloo = callPackage ./baloo.nix {};
+      kbookmarks = callPackage ./kbookmarks.nix {};
+      kcmutils = callPackage ./kcmutils {};
+      kconfigwidgets = callPackage ./kconfigwidgets {};
+      kdeclarative = callPackage ./kdeclarative.nix {};
+      kded = callPackage ./kded.nix {};
+      kdesignerplugin = callPackage ./kdesignerplugin.nix {};
+      kdesu = callPackage ./kdesu.nix {};
+      kdewebkit = callPackage ./kdewebkit.nix {};
+      kemoticons = callPackage ./kemoticons.nix {};
+      kglobalaccel = callPackage ./kglobalaccel.nix {};
+      kiconthemes = callPackage ./kiconthemes {};
+      kinit = callPackage ./kinit {};
+      kio = callPackage ./kio {};
+      knewstuff = callPackage ./knewstuff.nix {};
+      knotifyconfig = callPackage ./knotifyconfig.nix {};
+      kparts = callPackage ./kparts.nix {};
+      kpeople = callPackage ./kpeople.nix {};
+      krunner = callPackage ./krunner.nix {};
+      kservice = callPackage ./kservice {};
+      ktexteditor = callPackage ./ktexteditor.nix {};
+      ktextwidgets = callPackage ./ktextwidgets.nix {};
+      kwallet = callPackage ./kwallet.nix {};
+      kxmlgui = callPackage ./kxmlgui.nix {};
+      kxmlrpcclient = callPackage ./kxmlrpcclient.nix {};
+      plasma-framework = callPackage ./plasma-framework.nix {};
+      kpurpose = callPackage ./purpose.nix {};
+
+    # TIER 4
+      frameworkintegration = callPackage ./frameworkintegration.nix {};
+
+    # PORTING AIDS
+      kdelibs4support = callPackage ./kdelibs4support {};
+      khtml = callPackage ./khtml.nix {};
+      kjs = callPackage ./kjs.nix {};
+      kjsembed = callPackage ./kjsembed.nix {};
+      kmediaplayer = callPackage ./kmediaplayer.nix {};
+      kross = callPackage ./kross.nix {};
+
+    };
+
+in lib.makeScope libsForQt5.newScope packages
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/extra-cmake-modules/default.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/extra-cmake-modules/default.nix
new file mode 100644
index 000000000000..654eb94b51ac
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/extra-cmake-modules/default.nix
@@ -0,0 +1,20 @@
+{ mkDerivation, lib, copyPathsToStore, cmake, pkgconfig }:
+
+mkDerivation {
+  name = "extra-cmake-modules";
+
+  patches = copyPathsToStore (lib.readPathsFromFile ./. ./series);
+
+  outputs = [ "out" ];  # this package has no runtime components
+
+  propagatedBuildInputs = [ cmake pkgconfig ];
+
+  setupHook = ./setup-hook.sh;
+
+  meta = with lib; {
+    platforms = platforms.linux ++ platforms.darwin;
+    homepage = http://www.kde.org;
+    license = licenses.bsd2;
+    maintainers = [ maintainers.ttuegel ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/extra-cmake-modules/nix-lib-path.patch b/nixpkgs/pkgs/development/libraries/kde-frameworks/extra-cmake-modules/nix-lib-path.patch
new file mode 100644
index 000000000000..bd105d2b4a9c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/extra-cmake-modules/nix-lib-path.patch
@@ -0,0 +1,39 @@
+diff --git a/kde-modules/KDEInstallDirs.cmake b/kde-modules/KDEInstallDirs.cmake
+index 275fd65..a04596c 100644
+--- a/kde-modules/KDEInstallDirs.cmake
++++ b/kde-modules/KDEInstallDirs.cmake
+@@ -232,34 +232,6 @@
+ # GNUInstallDirs code deals with re-configuring, but that is dealt with
+ # by the _define_* macros in this module).
+ set(_LIBDIR_DEFAULT "lib")
+-# Override this default 'lib' with 'lib64' iff:
+-#  - we are on a Linux, kFreeBSD or Hurd system but NOT cross-compiling
+-#  - we are NOT on debian
+-#  - we are NOT on flatpak
+-#  - we are on a 64 bits system
+-# reason is: amd64 ABI: http://www.x86-64.org/documentation/abi.pdf
+-# For Debian with multiarch, use 'lib/${CMAKE_LIBRARY_ARCHITECTURE}' if
+-# CMAKE_LIBRARY_ARCHITECTURE is set (which contains e.g. "i386-linux-gnu"
+-# See https://wiki.debian.org/Multiarch
+-if((CMAKE_SYSTEM_NAME MATCHES "Linux|kFreeBSD" OR CMAKE_SYSTEM_NAME STREQUAL "GNU")
+-   AND NOT CMAKE_CROSSCOMPILING
+-   AND NOT DEFINED ENV{FLATPAK_ID})
+-  if (EXISTS "/etc/debian_version") # is this a debian system ?
+-    if(CMAKE_LIBRARY_ARCHITECTURE)
+-      set(_LIBDIR_DEFAULT "lib/${CMAKE_LIBRARY_ARCHITECTURE}")
+-    endif()
+-  else() # not debian, rely on CMAKE_SIZEOF_VOID_P:
+-    if(NOT DEFINED CMAKE_SIZEOF_VOID_P)
+-      message(AUTHOR_WARNING
+-        "Unable to determine default LIB_INSTALL_LIBDIR directory because no target architecture is known. "
+-        "Please enable at least one language before including KDEInstallDirs.")
+-    else()
+-      if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
+-        set(_LIBDIR_DEFAULT "lib64")
+-      endif()
+-    endif()
+-  endif()
+-endif()
+ 
+ set(_gnu_install_dirs_vars
+     BINDIR
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/extra-cmake-modules/series b/nixpkgs/pkgs/development/libraries/kde-frameworks/extra-cmake-modules/series
new file mode 100644
index 000000000000..b4569e50a5f7
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/extra-cmake-modules/series
@@ -0,0 +1 @@
+nix-lib-path.patch
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/extra-cmake-modules/setup-hook.sh b/nixpkgs/pkgs/development/libraries/kde-frameworks/extra-cmake-modules/setup-hook.sh
new file mode 100644
index 000000000000..88091e78a0cd
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/extra-cmake-modules/setup-hook.sh
@@ -0,0 +1,54 @@
+_ecmEnvHook() {
+    addToSearchPath XDG_DATA_DIRS "$1/share"
+    addToSearchPath XDG_CONFIG_DIRS "$1/etc/xdg"
+}
+addEnvHooks "$targetOffset" _ecmEnvHook
+
+_ecmPreConfigureHook() {
+    # Because we need to use absolute paths here, we must set *all* the paths.
+    cmakeFlags+=" -DKDE_INSTALL_EXECROOTDIR=${!outputBin}"
+    cmakeFlags+=" -DKDE_INSTALL_BINDIR=${!outputBin}/bin"
+    cmakeFlags+=" -DKDE_INSTALL_SBINDIR=${!outputBin}/sbin"
+    cmakeFlags+=" -DKDE_INSTALL_LIBDIR=${!outputLib}/lib"
+    cmakeFlags+=" -DKDE_INSTALL_LIBEXECDIR=${!outputLib}/lib/libexec"
+    cmakeFlags+=" -DKDE_INSTALL_CMAKEPACKAGEDIR=${!outputDev}/lib/cmake"
+    cmakeFlags+=" -DKDE_INSTALL_INCLUDEDIR=${!outputInclude}/include"
+    cmakeFlags+=" -DKDE_INSTALL_LOCALSTATEDIR=/var"
+    cmakeFlags+=" -DKDE_INSTALL_DATAROOTDIR=${!outputBin}/share"
+    cmakeFlags+=" -DKDE_INSTALL_DATADIR=${!outputBin}/share"
+    cmakeFlags+=" -DKDE_INSTALL_DOCBUNDLEDIR=${!outputBin}/share/doc/HTML"
+    cmakeFlags+=" -DKDE_INSTALL_KCFGDIR=${!outputBin}/share/config.kcfg"
+    cmakeFlags+=" -DKDE_INSTALL_KCONFUPDATEDIR=${!outputBin}/share/kconf_update"
+    cmakeFlags+=" -DKDE_INSTALL_KSERVICES5DIR=${!outputBin}/share/kservices5"
+    cmakeFlags+=" -DKDE_INSTALL_KSERVICETYPES5DIR=${!outputBin}/share/kservicetypes5"
+    cmakeFlags+=" -DKDE_INSTALL_KXMLGUI5DIR=${!outputBin}/share/kxmlgui5"
+    cmakeFlags+=" -DKDE_INSTALL_KNOTIFY5RCDIR=${!outputBin}/share/knotifications5"
+    cmakeFlags+=" -DKDE_INSTALL_ICONDIR=${!outputBin}/share/icons"
+    cmakeFlags+=" -DKDE_INSTALL_LOCALEDIR=${!outputLib}/share/locale"
+    cmakeFlags+=" -DKDE_INSTALL_SOUNDDIR=${!outputBin}/share/sounds"
+    cmakeFlags+=" -DKDE_INSTALL_TEMPLATEDIR=${!outputBin}/share/templates"
+    cmakeFlags+=" -DKDE_INSTALL_WALLPAPERDIR=${!outputBin}/share/wallpapers"
+    cmakeFlags+=" -DKDE_INSTALL_APPDIR=${!outputBin}/share/applications"
+    cmakeFlags+=" -DKDE_INSTALL_DESKTOPDIR=${!outputBin}/share/desktop-directories"
+    cmakeFlags+=" -DKDE_INSTALL_MIMEDIR=${!outputBin}/share/mime/packages"
+    cmakeFlags+=" -DKDE_INSTALL_METAINFODIR=${!outputBin}/share/appdata"
+    cmakeFlags+=" -DKDE_INSTALL_MANDIR=${!outputBin}/share/man"
+    cmakeFlags+=" -DKDE_INSTALL_INFODIR=${!outputBin}/share/info"
+    cmakeFlags+=" -DKDE_INSTALL_DBUSDIR=${!outputBin}/share/dbus-1"
+    cmakeFlags+=" -DKDE_INSTALL_DBUSINTERFACEDIR=${!outputBin}/share/dbus-1/interfaces"
+    cmakeFlags+=" -DKDE_INSTALL_DBUSSERVICEDIR=${!outputBin}/share/dbus-1/services"
+    cmakeFlags+=" -DKDE_INSTALL_DBUSSYSTEMSERVICEDIR=${!outputBin}/share/dbus-1/system-services"
+    cmakeFlags+=" -DKDE_INSTALL_SYSCONFDIR=${!outputBin}/etc"
+    cmakeFlags+=" -DKDE_INSTALL_CONFDIR=${!outputBin}/etc/xdg"
+    cmakeFlags+=" -DKDE_INSTALL_AUTOSTARTDIR=${!outputBin}/etc/xdg/autostart"
+
+    if [ -n "$qtPluginPrefix" ]; then
+        cmakeFlags+=" -DKDE_INSTALL_QTPLUGINDIR=${!outputBin}/$qtPluginPrefix"
+        cmakeFlags+=" -DKDE_INSTALL_PLUGINDIR=${!outputBin}/$qtPluginPrefix"
+    fi
+
+    if [ -n "$qtQmlPrefix" ]; then
+        cmakeFlags+=" -DKDE_INSTALL_QMLDIR=${!outputBin}/$qtQmlPrefix"
+    fi
+}
+preConfigureHooks+=(_ecmPreConfigureHook)
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/fetch.sh b/nixpkgs/pkgs/development/libraries/kde-frameworks/fetch.sh
new file mode 100644
index 000000000000..afab8a4e9a43
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/fetch.sh
@@ -0,0 +1 @@
+WGET_ARGS=( https://download.kde.org/stable/frameworks/5.58/ )
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/frameworkintegration.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/frameworkintegration.nix
new file mode 100644
index 000000000000..58b064806e52
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/frameworkintegration.nix
@@ -0,0 +1,17 @@
+{
+  mkDerivation, lib,
+  extra-cmake-modules,
+  kbookmarks, kcompletion, kconfig, kconfigwidgets, ki18n, kiconthemes, kio,
+  knewstuff, knotifications, kpackage, kwidgetsaddons, libXcursor, qtx11extras
+}:
+
+mkDerivation {
+  name = "frameworkintegration";
+  meta = { maintainers = [ lib.maintainers.ttuegel ]; };
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [
+    kbookmarks kcompletion kconfig ki18n kio knewstuff knotifications kpackage
+    kwidgetsaddons libXcursor qtx11extras
+  ];
+  propagatedBuildInputs = [ kconfigwidgets kiconthemes ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kactivities-stats.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/kactivities-stats.nix
new file mode 100644
index 000000000000..b558306248ae
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kactivities-stats.nix
@@ -0,0 +1,14 @@
+{
+  mkDerivation, lib,
+  extra-cmake-modules,
+  boost, kactivities, kconfig, qtbase,
+}:
+
+mkDerivation {
+  name = "kactivities-stats";
+  meta = { maintainers = [ lib.maintainers.ttuegel ]; };
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [ boost kactivities kconfig ];
+  propagatedBuildInputs = [ qtbase ];
+  outputs = [ "out" "dev" ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kactivities.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/kactivities.nix
new file mode 100644
index 000000000000..eabac6aadd7e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kactivities.nix
@@ -0,0 +1,15 @@
+{
+  mkDerivation, lib,
+  extra-cmake-modules,
+  boost, kconfig, kcoreaddons, kio, kwindowsystem, qtbase, qtdeclarative,
+}:
+
+mkDerivation {
+  name = "kactivities";
+  meta = { maintainers = [ lib.maintainers.ttuegel ]; };
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [
+    boost kconfig kcoreaddons kio kwindowsystem qtdeclarative
+  ];
+  propagatedBuildInputs = [ qtbase ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kapidox.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/kapidox.nix
new file mode 100644
index 000000000000..ca5e773a45b9
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kapidox.nix
@@ -0,0 +1,10 @@
+{ mkDerivation, lib, extra-cmake-modules, python }:
+
+mkDerivation {
+  name = "kapidox";
+  meta = { maintainers = [ lib.maintainers.ttuegel ]; };
+  nativeBuildInputs = [ extra-cmake-modules python ];
+  postFixup = ''
+    moveToOutput bin $bin
+  '';
+}
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/karchive.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/karchive.nix
new file mode 100644
index 000000000000..8c55f8da6a0c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/karchive.nix
@@ -0,0 +1,17 @@
+{
+  mkDerivation, lib,
+  extra-cmake-modules,
+  bzip2, lzma, qtbase, zlib,
+}:
+
+mkDerivation {
+  name = "karchive";
+  meta = {
+    maintainers = [ lib.maintainers.ttuegel ];
+    broken = builtins.compareVersions qtbase.version "5.7.0" < 0;
+  };
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [ bzip2 lzma zlib ];
+  propagatedBuildInputs = [ qtbase ];
+  outputs = [ "out" "dev" ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kauth/cmake-install-paths.patch b/nixpkgs/pkgs/development/libraries/kde-frameworks/kauth/cmake-install-paths.patch
new file mode 100644
index 000000000000..c66f5ecd008f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kauth/cmake-install-paths.patch
@@ -0,0 +1,17 @@
+Index: kauth-5.18.0/KF5AuthConfig.cmake.in
+===================================================================
+--- kauth-5.18.0.orig/KF5AuthConfig.cmake.in
++++ kauth-5.18.0/KF5AuthConfig.cmake.in
+@@ -4,9 +4,9 @@ set(KAUTH_STUB_FILES_DIR "@PACKAGE_KDE_I
+ 
+ set(KAUTH_BACKEND_NAME "@KAUTH_BACKEND_NAME@")
+ set(KAUTH_HELPER_BACKEND_NAME "@KAUTH_HELPER_BACKEND_NAME@")
+-set(KAUTH_POLICY_FILES_INSTALL_DIR "@KAUTH_POLICY_FILES_INSTALL_DIR@")
+-set(KAUTH_HELPER_INSTALL_DIR "@KAUTH_HELPER_INSTALL_DIR@")
+-set(KAUTH_HELPER_INSTALL_ABSOLUTE_DIR "@KAUTH_HELPER_INSTALL_ABSOLUTE_DIR@")
++set(KAUTH_POLICY_FILES_INSTALL_DIR "${KDE_INSTALL_DATADIR}/polkit-1/actions")
++set(KAUTH_HELPER_INSTALL_DIR "${KDE_INSTALL_LIBEXECDIR}")
++set(KAUTH_HELPER_INSTALL_ABSOLUTE_DIR "${KDE_INSTALL_LIBEXECDIR}")
+ 
+ find_dependency(KF5CoreAddons "@KF5_DEP_VERSION@")
+ 
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kauth/default.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/kauth/default.nix
new file mode 100644
index 000000000000..c94c8b91ecd2
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kauth/default.nix
@@ -0,0 +1,17 @@
+{
+  mkDerivation, lib, copyPathsToStore, propagate,
+  extra-cmake-modules, kcoreaddons, polkit-qt, qttools
+}:
+
+mkDerivation {
+  name = "kauth";
+  meta = { maintainers = [ lib.maintainers.ttuegel ]; };
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [ polkit-qt qttools ];
+  propagatedBuildInputs = [ kcoreaddons ];
+  patches = copyPathsToStore (lib.readPathsFromFile ./. ./series);
+  # library stores reference to plugin path,
+  # separating $out from $bin would create a reference cycle
+  outputs = [ "out" "dev" ];
+  setupHook = propagate "out";
+}
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kauth/series b/nixpkgs/pkgs/development/libraries/kde-frameworks/kauth/series
new file mode 100644
index 000000000000..d2689425c387
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kauth/series
@@ -0,0 +1 @@
+cmake-install-paths.patch
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kbookmarks.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/kbookmarks.nix
new file mode 100644
index 000000000000..dc2339632e45
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kbookmarks.nix
@@ -0,0 +1,17 @@
+{
+  mkDerivation, lib,
+  extra-cmake-modules, qttools,
+  kcodecs, kconfig, kconfigwidgets, kcoreaddons, kiconthemes, kwidgetsaddons,
+  kxmlgui, qtbase,
+}:
+
+mkDerivation {
+  name = "kbookmarks";
+  meta = { maintainers = [ lib.maintainers.ttuegel ]; };
+  nativeBuildInputs = [ extra-cmake-modules qttools ];
+  buildInputs = [
+    kcodecs kconfig kconfigwidgets kcoreaddons kiconthemes kxmlgui
+  ];
+  propagatedBuildInputs = [ kwidgetsaddons qtbase ];
+  outputs = [ "out" "dev" ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kcmutils/default.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/kcmutils/default.nix
new file mode 100644
index 000000000000..0c661dcdd48e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kcmutils/default.nix
@@ -0,0 +1,18 @@
+{
+  mkDerivation, lib, copyPathsToStore,
+  extra-cmake-modules,
+  kconfigwidgets, kcoreaddons, kdeclarative, ki18n, kiconthemes, kitemviews,
+  kpackage, kservice, kxmlgui, qtdeclarative,
+}:
+
+mkDerivation {
+  name = "kcmutils";
+  meta = { maintainers = [ lib.maintainers.ttuegel ]; };
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [
+    kcoreaddons kdeclarative ki18n kiconthemes kitemviews kpackage kxmlgui
+    qtdeclarative
+  ];
+  propagatedBuildInputs = [ kconfigwidgets kservice ];
+  patches = (copyPathsToStore (lib.readPathsFromFile ./. ./series));
+}
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kcmutils/kcmutils-debug-module-loader.patch b/nixpkgs/pkgs/development/libraries/kde-frameworks/kcmutils/kcmutils-debug-module-loader.patch
new file mode 100644
index 000000000000..0411755f45a6
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kcmutils/kcmutils-debug-module-loader.patch
@@ -0,0 +1,13 @@
+Index: kcmutils-5.33.0/src/kcmoduleloader.cpp
+===================================================================
+--- kcmutils-5.33.0.orig/src/kcmoduleloader.cpp
++++ kcmutils-5.33.0/src/kcmoduleloader.cpp
+@@ -96,7 +96,7 @@ KCModule *KCModuleLoader::loadModule(con
+             KPluginLoader loader(KPluginLoader::findPlugin(QLatin1String("kcms/") + mod.service()->library()));
+             KPluginFactory* factory = loader.factory();
+             if (!factory) {
+-                qWarning() << "Error loading plugin:" << loader.errorString();
++                qWarning() << "Error loading KCM plugin" << mod.service()->library() << loader.errorString();
+             } else {
+                 KQuickAddons::ConfigModule *cm = factory->create<KQuickAddons::ConfigModule >();
+                 if (!cm) {
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kcmutils/kcmutils-follow-symlinks.patch b/nixpkgs/pkgs/development/libraries/kde-frameworks/kcmutils/kcmutils-follow-symlinks.patch
new file mode 100644
index 000000000000..cc041b9aa3b8
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kcmutils/kcmutils-follow-symlinks.patch
@@ -0,0 +1,13 @@
+diff --git a/src/kpluginselector.cpp b/src/kpluginselector.cpp
+index 137c865..097ab75 100644
+--- a/src/kpluginselector.cpp
++++ b/src/kpluginselector.cpp
+@@ -303,7 +303,7 @@ void KPluginSelector::addPlugins(const QString &componentName,
+     QStringList desktopFileNames;
+     const QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, componentName + QStringLiteral("/kpartplugins"), QStandardPaths::LocateDirectory);
+     for (const QString &dir : dirs) {
+-        QDirIterator it(dir, QStringList() << QStringLiteral("*.desktop"), QDir::NoFilter, QDirIterator::Subdirectories);
++        QDirIterator it(dir, QStringList() << QStringLiteral("*.desktop"), QDir::NoFilter, QDirIterator::Subdirectories | QDirIterator::FollowSymlinks);
+         while (it.hasNext()) {
+             desktopFileNames.append(it.next());
+         }
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kcmutils/series b/nixpkgs/pkgs/development/libraries/kde-frameworks/kcmutils/series
new file mode 100644
index 000000000000..f2c22554a455
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kcmutils/series
@@ -0,0 +1,2 @@
+kcmutils-follow-symlinks.patch
+kcmutils-debug-module-loader.patch
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kcodecs.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/kcodecs.nix
new file mode 100644
index 000000000000..978db644a56f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kcodecs.nix
@@ -0,0 +1,13 @@
+{ mkDerivation, lib, extra-cmake-modules, qtbase, qttools, gperf }:
+
+mkDerivation {
+  name = "kcodecs";
+  meta = {
+    maintainers = [ lib.maintainers.ttuegel ];
+    broken = builtins.compareVersions qtbase.version "5.7.0" < 0;
+  };
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [ qttools gperf ];
+  propagatedBuildInputs = [ qtbase ];
+  outputs = [ "out" "dev" ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kcompletion.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/kcompletion.nix
new file mode 100644
index 000000000000..fdfe28db6c04
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kcompletion.nix
@@ -0,0 +1,14 @@
+{
+  mkDerivation, lib,
+  extra-cmake-modules,
+  kconfig, kwidgetsaddons, qtbase, qttools
+}:
+
+mkDerivation {
+  name = "kcompletion";
+  meta = { maintainers = [ lib.maintainers.ttuegel ]; };
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [ kconfig kwidgetsaddons qttools ];
+  propagatedBuildInputs = [ qtbase ];
+  outputs = [ "out" "dev" ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kconfig.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/kconfig.nix
new file mode 100644
index 000000000000..2650843aa55d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kconfig.nix
@@ -0,0 +1,12 @@
+{ mkDerivation, lib, extra-cmake-modules, qtbase, qttools }:
+
+mkDerivation {
+  name = "kconfig";
+  meta = {
+    maintainers = [ lib.maintainers.ttuegel ];
+    broken = builtins.compareVersions qtbase.version "5.7.0" < 0;
+  };
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [ qttools ];
+  propagatedBuildInputs = [ qtbase ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kconfigwidgets/0001-qdiriterator-follow-symlinks.patch b/nixpkgs/pkgs/development/libraries/kde-frameworks/kconfigwidgets/0001-qdiriterator-follow-symlinks.patch
new file mode 100644
index 000000000000..3b6ea27d41e5
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kconfigwidgets/0001-qdiriterator-follow-symlinks.patch
@@ -0,0 +1,18 @@
+diff --git a/src/khelpclient.cpp b/src/khelpclient.cpp
+index fbbc0fa..cb78741 100644
+--- a/src/khelpclient.cpp
++++ b/src/khelpclient.cpp
+@@ -48,7 +48,7 @@ void KHelpClient::invokeHelp(const QString &anchor, const QString &_appname)
+     QString docPath;
+     const QStringList desktopDirs = QStandardPaths::standardLocations(QStandardPaths::ApplicationsLocation);
+     for (const QString &dir : desktopDirs) {
+-        QDirIterator it(dir, QStringList() << appname + QLatin1String(".desktop"), QDir::NoFilter, QDirIterator::Subdirectories);
++        QDirIterator it(dir, QStringList() << appname + QLatin1String(".desktop"), QDir::NoFilter, QDirIterator::Subdirectories | QDirIterator::FollowSymlinks);
+         while (it.hasNext()) {
+             const QString desktopPath(it.next());
+             KDesktopFile desktopFile(desktopPath);
+@@ -75,4 +75,3 @@ void KHelpClient::invokeHelp(const QString &anchor, const QString &_appname)
+     // launch khelpcenter, or a browser for URIs not handled by khelpcenter
+     QDesktopServices::openUrl(url);
+ }
+-
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kconfigwidgets/default.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/kconfigwidgets/default.nix
new file mode 100644
index 000000000000..3943e5d6d494
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kconfigwidgets/default.nix
@@ -0,0 +1,20 @@
+{
+  mkDerivation, lib, extra-cmake-modules,
+  kauth, kcodecs, kconfig, kdoctools, kguiaddons, ki18n, kwidgetsaddons, qtbase,
+}:
+
+mkDerivation {
+  name = "kconfigwidgets";
+  meta = { maintainers = [ lib.maintainers.ttuegel ]; };
+  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
+  buildInputs = [ kguiaddons ki18n qtbase ];
+  propagatedBuildInputs = [ kauth kcodecs kconfig kwidgetsaddons ];
+  patches = [ ./0001-qdiriterator-follow-symlinks.patch ];
+  outputs = [ "out" "dev" ];
+  preConfigure = ''
+    outputBin=dev
+  '';
+  postInstall = ''
+    moveToOutput share/man $dev
+  '';
+}
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kcoreaddons.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/kcoreaddons.nix
new file mode 100644
index 000000000000..d5a407ee16f2
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kcoreaddons.nix
@@ -0,0 +1,16 @@
+{
+  mkDerivation, lib,
+  extra-cmake-modules,
+  qtbase, qttools, shared-mime-info
+}:
+
+mkDerivation {
+  name = "kcoreaddons";
+  meta = {
+    maintainers = [ lib.maintainers.ttuegel ];
+    broken = builtins.compareVersions qtbase.version "5.7.0" < 0;
+  };
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [ qttools shared-mime-info ];
+  propagatedBuildInputs = [ qtbase ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kcrash.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/kcrash.nix
new file mode 100644
index 000000000000..d45d73d33e41
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kcrash.nix
@@ -0,0 +1,14 @@
+{
+  mkDerivation, lib,
+  extra-cmake-modules,
+  kcoreaddons, kwindowsystem, qtbase, qtx11extras,
+}:
+
+mkDerivation {
+  name = "kcrash";
+  meta = { maintainers = [ lib.maintainers.ttuegel ]; };
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [ kcoreaddons kwindowsystem qtx11extras ];
+  propagatedBuildInputs = [ qtbase ];
+  outputs = [ "out" "dev" ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kdbusaddons.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/kdbusaddons.nix
new file mode 100644
index 000000000000..c94167d5d76d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kdbusaddons.nix
@@ -0,0 +1,16 @@
+{
+  mkDerivation, lib,
+  extra-cmake-modules,
+  qtbase, qttools, qtx11extras
+}:
+
+mkDerivation {
+  name = "kdbusaddons";
+  meta = {
+    maintainers = [ lib.maintainers.ttuegel ];
+    broken = builtins.compareVersions qtbase.version "5.7.0" < 0;
+  };
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [ qttools qtx11extras ];
+  propagatedBuildInputs = [ qtbase ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kdeclarative.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/kdeclarative.nix
new file mode 100644
index 000000000000..34e01b4c1b62
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kdeclarative.nix
@@ -0,0 +1,16 @@
+{
+  mkDerivation, lib, extra-cmake-modules,
+  epoxy, kconfig, kglobalaccel, kguiaddons, ki18n, kiconthemes, kio, kpackage,
+  kwidgetsaddons, kwindowsystem, qtdeclarative
+}:
+
+mkDerivation {
+  name = "kdeclarative";
+  meta = { maintainers = [ lib.maintainers.ttuegel ]; };
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [
+    epoxy kglobalaccel kguiaddons ki18n kiconthemes kio kwidgetsaddons
+    kwindowsystem
+  ];
+  propagatedBuildInputs = [ kconfig kpackage qtdeclarative ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kded.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/kded.nix
new file mode 100644
index 000000000000..65377789582e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kded.nix
@@ -0,0 +1,16 @@
+{
+  mkDerivation, lib, propagate,
+  extra-cmake-modules, kdoctools,
+  kconfig, kcoreaddons, kcrash, kdbusaddons, kinit, kservice, qtbase,
+}:
+
+mkDerivation {
+  name = "kded";
+  meta = { maintainers = [ lib.maintainers.ttuegel ]; };
+  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
+  buildInputs = [
+    kconfig kcoreaddons kcrash kdbusaddons kinit kservice qtbase
+  ];
+  outputs = [ "out" "dev" ];
+  setupHook = propagate "out";
+}
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kdelibs4support/default.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/kdelibs4support/default.nix
new file mode 100644
index 000000000000..7e3de9d4d141
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kdelibs4support/default.nix
@@ -0,0 +1,32 @@
+{
+  mkDerivation, lib, copyPathsToStore,
+  docbook_xml_dtd_45, extra-cmake-modules, kdoctools,
+  kauth, karchive, kcompletion, kconfig, kconfigwidgets, kcoreaddons, kcrash,
+  kdbusaddons, kded, kdesignerplugin, kemoticons, kglobalaccel, kguiaddons,
+  ki18n, kiconthemes, kio, kitemmodels, kinit, knotifications, kparts, kservice,
+  ktextwidgets, kunitconversion, kwidgetsaddons, kwindowsystem, kxmlgui,
+  networkmanager, qtbase, qtsvg, qttools, qtx11extras, xorg
+}:
+
+mkDerivation {
+  name = "kdelibs4support";
+  meta = { maintainers = [ lib.maintainers.ttuegel ]; };
+  patches = copyPathsToStore (lib.readPathsFromFile ./. ./series);
+  setupHook = ./setup-hook.sh;
+  nativeBuildInputs = [ extra-cmake-modules qttools ];
+  propagatedNativeBuildInputs = [ kdoctools ];
+  buildInputs = [
+    kcompletion kconfig kded kglobalaccel ki18n kio kservice kwidgetsaddons
+    kxmlgui networkmanager qtsvg qtx11extras xorg.libSM
+  ];
+  propagatedBuildInputs = [
+    kauth karchive kconfigwidgets kcoreaddons kcrash kdbusaddons kdesignerplugin
+    kemoticons kguiaddons kiconthemes kitemmodels kinit knotifications kparts
+    ktextwidgets kunitconversion kwindowsystem qtbase
+  ];
+  cmakeFlags = [
+    "-DDocBookXML4_DTD_DIR=${docbook_xml_dtd_45}/xml/dtd/docbook"
+    "-DDocBookXML4_DTD_VERSION=4.5"
+  ];
+  outputs = [ "out" "dev" ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kdelibs4support/nix-kde-include-dir.patch b/nixpkgs/pkgs/development/libraries/kde-frameworks/kdelibs4support/nix-kde-include-dir.patch
new file mode 100644
index 000000000000..eabb70254483
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kdelibs4support/nix-kde-include-dir.patch
@@ -0,0 +1,13 @@
+Index: kdelibs4support-5.18.0/src/kdecore/kstandarddirs.cpp
+===================================================================
+--- kdelibs4support-5.18.0.orig/src/kdecore/kstandarddirs.cpp
++++ kdelibs4support-5.18.0/src/kdecore/kstandarddirs.cpp
+@@ -292,7 +292,7 @@ static QString relativeInstallPath(const
+             return QFile::decodeName(ICON_INSTALL_DIR "/");
+         }
+         if (strcmp("include", type) == 0) {
+-            return QFile::decodeName(INCLUDE_INSTALL_DIR "/");
++            return QFile::decodeName(qgetenv("NIX_KDE_INCLUDE_DIR"));
+         }
+         break;
+     case 'l':
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kdelibs4support/series b/nixpkgs/pkgs/development/libraries/kde-frameworks/kdelibs4support/series
new file mode 100644
index 000000000000..9b08ab208774
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kdelibs4support/series
@@ -0,0 +1 @@
+nix-kde-include-dir.patch
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kdelibs4support/setup-hook.sh b/nixpkgs/pkgs/development/libraries/kde-frameworks/kdelibs4support/setup-hook.sh
new file mode 100644
index 000000000000..21ac2e83b5da
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kdelibs4support/setup-hook.sh
@@ -0,0 +1 @@
+export NIX_KDE_INCLUDE_DIR="@dev@/include/"  # trailing slash is required!
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kdesignerplugin.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/kdesignerplugin.nix
new file mode 100644
index 000000000000..8418863eabb5
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kdesignerplugin.nix
@@ -0,0 +1,17 @@
+{
+  mkDerivation, lib,
+  extra-cmake-modules, kdoctools,
+  kcompletion, kconfig, kconfigwidgets, kcoreaddons, kiconthemes, kio,
+  kitemviews, kplotting, ktextwidgets, kwidgetsaddons, kxmlgui, qttools, sonnet,
+}:
+
+mkDerivation {
+  name = "kdesignerplugin";
+  meta = { maintainers = [ lib.maintainers.ttuegel ]; };
+  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
+  buildInputs = [
+    kcompletion kconfig kconfigwidgets kcoreaddons kiconthemes kio kitemviews
+    kplotting ktextwidgets kwidgetsaddons kxmlgui sonnet
+  ];
+  propagatedBuildInputs = [ qttools ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kdesu.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/kdesu.nix
new file mode 100644
index 000000000000..df60511b5115
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kdesu.nix
@@ -0,0 +1,14 @@
+{
+  mkDerivation, lib,
+  extra-cmake-modules,
+  kcoreaddons, ki18n, kpty, kservice, qtbase,
+}:
+
+mkDerivation {
+  name = "kdesu";
+  meta = { maintainers = [ lib.maintainers.ttuegel ]; };
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [ kcoreaddons ki18n kpty kservice qtbase ];
+  propagatedBuildInputs = [ kpty ];
+  outputs = [ "out" "dev" ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kdewebkit.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/kdewebkit.nix
new file mode 100644
index 000000000000..b7dcfb7fe64c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kdewebkit.nix
@@ -0,0 +1,11 @@
+{ mkDerivation, extra-cmake-modules
+, kconfig, kcoreaddons, kio, kparts, qtwebkit
+}:
+
+mkDerivation {
+  name = "kdewebkit";
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [ kconfig kcoreaddons kio kparts ];
+  propagatedBuildInputs = [ qtwebkit ];
+  outputs = [ "out" "dev" ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kdnssd.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/kdnssd.nix
new file mode 100644
index 000000000000..9e2f827eff59
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kdnssd.nix
@@ -0,0 +1,17 @@
+{
+  mkDerivation, lib,
+  extra-cmake-modules,
+  avahi, qtbase, qttools,
+}:
+
+mkDerivation {
+  name = "kdnssd";
+  meta = {
+    maintainers = [ lib.maintainers.ttuegel ];
+    broken = builtins.compareVersions qtbase.version "5.7.0" < 0;
+  };
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [ avahi qttools ];
+  propagatedBuildInputs = [ qtbase ];
+  outputs = [ "out" "dev" ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kdoctools/default.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/kdoctools/default.nix
new file mode 100644
index 000000000000..68b5c08aa090
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kdoctools/default.nix
@@ -0,0 +1,33 @@
+{
+  mkDerivation, lib,
+  extra-cmake-modules, docbook_xml_dtd_45, docbook_xsl_ns,
+  karchive, ki18n, qtbase,
+  perl, perlPackages
+}:
+
+mkDerivation {
+  name = "kdoctools";
+  meta = { maintainers = [ lib.maintainers.ttuegel ]; };
+  nativeBuildInputs = [
+    extra-cmake-modules
+    # The build system insists on having native Perl.
+    perl perlPackages.URI
+  ];
+  propagatedBuildInputs = [
+    # kdoctools at runtime actually needs Perl for the platform kdoctools is
+    # running on, not necessarily native perl.
+    perl perlPackages.URI
+    qtbase
+  ];
+  buildInputs = [ karchive ki18n ];
+  outputs = [ "out" "dev" ];
+  patches = [ ./kdoctools-no-find-docbook-xml.patch ];
+  cmakeFlags = [
+    "-DDocBookXML4_DTD_DIR=${docbook_xml_dtd_45}/xml/dtd/docbook"
+    "-DDocBookXSL_DIR=${docbook_xsl_ns}/xml/xsl/docbook"
+  ];
+  postFixup = ''
+    moveToOutput "share/doc" "$dev"
+    moveToOutput "share/man" "$dev"
+  '';
+}
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kdoctools/kdoctools-no-find-docbook-xml.patch b/nixpkgs/pkgs/development/libraries/kde-frameworks/kdoctools/kdoctools-no-find-docbook-xml.patch
new file mode 100644
index 000000000000..4e3a33efab32
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kdoctools/kdoctools-no-find-docbook-xml.patch
@@ -0,0 +1,12 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 5c4863c..f731775 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -46,7 +46,6 @@ set_package_properties(LibXml2 PROPERTIES
+                       )
+ 
+ 
+-find_package(DocBookXML4 "4.5")
+ 
+ set_package_properties(DocBookXML4 PROPERTIES
+                        TYPE REQUIRED
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kdoctools/setup-hook.sh b/nixpkgs/pkgs/development/libraries/kde-frameworks/kdoctools/setup-hook.sh
new file mode 100644
index 000000000000..2928d9b34dbe
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kdoctools/setup-hook.sh
@@ -0,0 +1,5 @@
+addXdgData() {
+    addToSearchPath XDG_DATA_DIRS "$1/share"
+}
+
+addEnvHooks "$targetOffset" addXdgData
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kemoticons.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/kemoticons.nix
new file mode 100644
index 000000000000..b7f4f036db5e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kemoticons.nix
@@ -0,0 +1,13 @@
+{
+  mkDerivation, lib,
+  extra-cmake-modules,
+  karchive, kcoreaddons, kservice, qtbase,
+}:
+
+mkDerivation {
+  name = "kemoticons";
+  meta = { maintainers = [ lib.maintainers.ttuegel ]; };
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [ karchive kcoreaddons ];
+  propagatedBuildInputs = [ kservice qtbase ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kfilemetadata/cmake-install-paths.patch b/nixpkgs/pkgs/development/libraries/kde-frameworks/kfilemetadata/cmake-install-paths.patch
new file mode 100644
index 000000000000..732f7b69c828
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kfilemetadata/cmake-install-paths.patch
@@ -0,0 +1,13 @@
+Index: kfilemetadata-5.18.0/src/CMakeLists.txt
+===================================================================
+--- kfilemetadata-5.18.0.orig/src/CMakeLists.txt
++++ kfilemetadata-5.18.0/src/CMakeLists.txt
+@@ -49,7 +49,7 @@ install(TARGETS KF5FileMetaData EXPORT K
+ 
+ install(EXPORT KF5FileMetaDataTargets
+         NAMESPACE KF5::
+-        DESTINATION ${LIB_INSTALL_DIR}/cmake/KF5FileMetaData
++        DESTINATION ${KDE_INSTALL_FULL_CMAKEPACKAGEDIR}/KF5FileMetaData
+         FILE KF5FileMetaDataTargets.cmake)
+ 
+ install(FILES
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kfilemetadata/default.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/kfilemetadata/default.nix
new file mode 100644
index 000000000000..c72cb5b71a43
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kfilemetadata/default.nix
@@ -0,0 +1,16 @@
+{
+  mkDerivation, lib, copyPathsToStore,
+  extra-cmake-modules,
+  attr, ebook_tools, exiv2, ffmpeg, karchive, kcoreaddons, ki18n, poppler, qtbase, qtmultimedia, taglib
+}:
+
+mkDerivation {
+  name = "kfilemetadata";
+  meta = { maintainers = [ lib.maintainers.ttuegel ]; };
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [
+    attr ebook_tools exiv2 ffmpeg karchive kcoreaddons ki18n poppler qtbase qtmultimedia
+    taglib
+  ];
+  patches = copyPathsToStore (lib.readPathsFromFile ./. ./series);
+}
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kfilemetadata/series b/nixpkgs/pkgs/development/libraries/kde-frameworks/kfilemetadata/series
new file mode 100644
index 000000000000..d2689425c387
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kfilemetadata/series
@@ -0,0 +1 @@
+cmake-install-paths.patch
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kglobalaccel.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/kglobalaccel.nix
new file mode 100644
index 000000000000..ca015151e0f1
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kglobalaccel.nix
@@ -0,0 +1,16 @@
+{
+  mkDerivation,
+  extra-cmake-modules,
+  kconfig, kcoreaddons, kcrash, kdbusaddons, kservice, kwindowsystem,
+  qtbase, qttools, qtx11extras,
+}:
+
+mkDerivation {
+  name = "kglobalaccel";
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [
+    kconfig kcoreaddons kcrash kdbusaddons kservice kwindowsystem qttools
+    qtx11extras
+  ];
+  propagatedBuildInputs = [ qtbase ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kguiaddons.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/kguiaddons.nix
new file mode 100644
index 000000000000..66cd8ddf64f6
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kguiaddons.nix
@@ -0,0 +1,17 @@
+{
+  mkDerivation, lib,
+  extra-cmake-modules,
+  qtbase, qtx11extras,
+}:
+
+mkDerivation {
+  name = "kguiaddons";
+  meta = {
+    maintainers = [ lib.maintainers.ttuegel ];
+    broken = builtins.compareVersions qtbase.version "5.7.0" < 0;
+  };
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [ qtx11extras ];
+  propagatedBuildInputs = [ qtbase ];
+  outputs = [ "out" "dev" ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kholidays.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/kholidays.nix
new file mode 100644
index 000000000000..2ede69e74953
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kholidays.nix
@@ -0,0 +1,16 @@
+{
+  mkDerivation, lib,
+  extra-cmake-modules, kdoctools,
+  qtbase, qtdeclarative, qttools,
+}:
+
+mkDerivation {
+  name = "kholidays";
+  meta = {
+    license = with lib.licenses; [ gpl2 lgpl21 fdl12 ];
+    maintainers = with lib.maintainers; [ bkchr ];
+  };
+  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
+  buildInputs = [ qtbase qtdeclarative qttools ];
+  outputs = [ "out" "dev" ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/khtml.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/khtml.nix
new file mode 100644
index 000000000000..5bb3078ea867
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/khtml.nix
@@ -0,0 +1,19 @@
+{
+  mkDerivation, lib,
+  extra-cmake-modules, perl,
+  giflib, karchive, kcodecs, kglobalaccel, ki18n, kiconthemes, kio, kjs,
+  knotifications, kparts, ktextwidgets, kwallet, kwidgetsaddons, kwindowsystem,
+  kxmlgui, phonon, qtx11extras, sonnet, gperf
+}:
+
+mkDerivation {
+  name = "khtml";
+  meta = { maintainers = [ lib.maintainers.ttuegel ]; };
+  nativeBuildInputs = [ extra-cmake-modules perl ];
+  buildInputs = [
+    giflib karchive kcodecs kglobalaccel ki18n kiconthemes kio knotifications
+    kparts ktextwidgets kwallet kwidgetsaddons kwindowsystem kxmlgui phonon
+    qtx11extras sonnet gperf
+  ];
+  propagatedBuildInputs = [ kjs ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/ki18n.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/ki18n.nix
new file mode 100644
index 000000000000..3b9ca74bbd07
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/ki18n.nix
@@ -0,0 +1,16 @@
+{
+  mkDerivation, lib,
+  extra-cmake-modules, gettext, python,
+  qtbase, qtdeclarative, qtscript,
+}:
+
+mkDerivation {
+  name = "ki18n";
+  meta = {
+    maintainers = [ lib.maintainers.ttuegel ];
+    broken = builtins.compareVersions qtbase.version "5.7.0" < 0;
+  };
+  nativeBuildInputs = [ extra-cmake-modules ];
+  propagatedNativeBuildInputs = [ gettext python ];
+  buildInputs = [ qtdeclarative qtscript ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kiconthemes/default-theme-breeze.patch b/nixpkgs/pkgs/development/libraries/kde-frameworks/kiconthemes/default-theme-breeze.patch
new file mode 100644
index 000000000000..f7cb0ea3aacc
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kiconthemes/default-theme-breeze.patch
@@ -0,0 +1,13 @@
+Index: kiconthemes-5.17.0/src/kicontheme.cpp
+===================================================================
+--- kiconthemes-5.17.0.orig/src/kicontheme.cpp
++++ kiconthemes-5.17.0/src/kicontheme.cpp
+@@ -557,7 +557,7 @@ void KIconTheme::reconfigure()
+ // static
+ QString KIconTheme::defaultThemeName()
+ {
+-    return QStringLiteral("hicolor");
++    return QStringLiteral("breeze");
+ }
+ 
+ void KIconTheme::assignIconsToContextMenu(ContextMenus type,
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kiconthemes/default.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/kiconthemes/default.nix
new file mode 100644
index 000000000000..4b8e0059377d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kiconthemes/default.nix
@@ -0,0 +1,17 @@
+{
+  mkDerivation, lib, copyPathsToStore,
+  extra-cmake-modules,
+  breeze-icons, karchive, kcoreaddons, kconfigwidgets, ki18n, kitemviews,
+  qtbase, qtsvg,
+}:
+
+mkDerivation {
+  name = "kiconthemes";
+  meta = { maintainers = [ lib.maintainers.ttuegel ]; };
+  patches = copyPathsToStore (lib.readPathsFromFile ./. ./series);
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [
+    breeze-icons karchive kcoreaddons kconfigwidgets ki18n kitemviews
+  ];
+  propagatedBuildInputs = [ qtbase qtsvg ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kiconthemes/series b/nixpkgs/pkgs/development/libraries/kde-frameworks/kiconthemes/series
new file mode 100644
index 000000000000..ab5cc8a3edb2
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kiconthemes/series
@@ -0,0 +1 @@
+default-theme-breeze.patch
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kidletime.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/kidletime.nix
new file mode 100644
index 000000000000..a1e53bb408bd
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kidletime.nix
@@ -0,0 +1,16 @@
+{
+  mkDerivation, lib,
+  extra-cmake-modules,
+  qtbase, qtx11extras
+}:
+
+mkDerivation {
+  name = "kidletime";
+  meta = {
+    maintainers = [ lib.maintainers.ttuegel ];
+    broken = builtins.compareVersions qtbase.version "5.7.0" < 0;
+  };
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [ qtx11extras ];
+  propagatedBuildInputs = [ qtbase ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kimageformats.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/kimageformats.nix
new file mode 100644
index 000000000000..29748a5f7f42
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kimageformats.nix
@@ -0,0 +1,16 @@
+{
+  mkDerivation, lib,
+  extra-cmake-modules,
+  ilmbase, karchive, openexr, qtbase
+}:
+
+let inherit (lib) getDev; in
+
+mkDerivation {
+  name = "kimageformats";
+  meta = { maintainers = [ lib.maintainers.ttuegel ]; };
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [ karchive openexr qtbase ];
+  outputs = [ "out" ]; # plugins only
+  CXXFLAGS = "-I${getDev ilmbase}/include/OpenEXR";
+}
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kinit/default.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/kinit/default.nix
new file mode 100644
index 000000000000..538078fd7457
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kinit/default.nix
@@ -0,0 +1,36 @@
+{
+  mkDerivation, lib, copyPathsToStore, writeScript,
+  extra-cmake-modules, kdoctools,
+  kconfig, kcrash, ki18n, kio, kparts, kservice, kwindowsystem, plasma-framework
+}:
+
+let inherit (lib) getLib; in
+
+mkDerivation {
+  name = "kinit";
+  meta = { maintainers = [ lib.maintainers.ttuegel ]; };
+  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
+  buildInputs = [
+    kconfig kcrash ki18n kio kservice kwindowsystem
+  ];
+  patches = copyPathsToStore (lib.readPathsFromFile ./. ./series);
+  CXXFLAGS = [
+    ''-DNIXPKGS_KF5_KIOCORE=\"${getLib kio}/lib/libKF5KIOCore.so.5\"''
+    ''-DNIXPKGS_KF5_PARTS=\"${getLib kparts}/lib/libKF5Parts.so.5\"''
+    ''-DNIXPKGS_KF5_PLASMA=\"${getLib plasma-framework}/lib/libKF5Plasma.so.5\"''
+  ];
+  postFixup = ''
+    moveToOutput "lib/libexec/kf5/start_kdeinit" "$bin"
+  '';
+  setupHook = writeScript "setup-hook.sh" ''
+    kinitFixupOutputHook() {
+        if [ $prefix != ''${!outputBin} ] && [ -d $prefix/lib ]; then
+            mkdir -p ''${!outputBin}/lib
+            find $prefix/lib -maxdepth 1 -name 'libkdeinit5_*.so' -exec ln -s \{\} ''${!outputBin}/lib \;
+            rmdir --ignore-fail-on-non-empty ''${!outputBin}/lib
+        fi
+    }
+
+    fixupOutputHooks+=(kinitFixupOutputHook)
+  '';
+}
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kinit/kdeinit-extra_libs.patch b/nixpkgs/pkgs/development/libraries/kde-frameworks/kinit/kdeinit-extra_libs.patch
new file mode 100644
index 000000000000..75e632d41292
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kinit/kdeinit-extra_libs.patch
@@ -0,0 +1,49 @@
+Index: kinit-5.32.0/src/kdeinit/kinit.cpp
+===================================================================
+--- kinit-5.32.0.orig/src/kdeinit/kinit.cpp
++++ kinit-5.32.0/src/kdeinit/kinit.cpp
+@@ -96,11 +96,9 @@ static const char *extra_libs[] = {
+     "libKF5Parts.5.dylib",
+     "libKF5Plasma.5.dylib"
+ #else
+-    "libKF5KIOCore.so.5",
+-    "libKF5Parts.so.5",
+-//#ifdef __KDE_HAVE_GCC_VISIBILITY // Removed for KF5, we'll see.
+-    "libKF5Plasma.so.5"
+-//#endif
++    NIXPKGS_KF5_KIOCORE,
++    NIXPKGS_KF5_PARTS,
++    NIXPKGS_KF5_PLASMA
+ #endif
+ };
+ #endif
+@@ -1533,20 +1531,6 @@ static int initXconnection()
+ }
+ #endif
+ 
+-#ifndef Q_OS_OSX
+-// Find a shared lib in the lib dir, e.g. libkio.so.
+-// Completely unrelated to plugins.
+-static QString findSharedLib(const QString &lib)
+-{
+-    QString path = QFile::decodeName(CMAKE_INSTALL_PREFIX "/" LIB_INSTALL_DIR "/") + lib;
+-    if (QFile::exists(path)) {
+-        return path;
+-    }
+-    // We could also look in LD_LIBRARY_PATH, but really, who installs the main libs in different prefixes?
+-    return QString();
+-}
+-#endif
+-
+ extern "C" {
+ 
+     static void secondary_child_handler(int)
+@@ -1692,7 +1676,7 @@ int main(int argc, char **argv)
+     if (!d.suicide && qEnvironmentVariableIsEmpty("KDE_IS_PRELINKED")) {
+         const int extrasCount = sizeof(extra_libs) / sizeof(extra_libs[0]);
+         for (int i = 0; i < extrasCount; i++) {
+-            const QString extra = findSharedLib(QString::fromLatin1(extra_libs[i]));
++            const QString extra = QString::fromLatin1(extra_libs[i]);
+             if (!extra.isEmpty()) {
+                 QLibrary l(extra);
+                 l.setLoadHints(QLibrary::ExportExternalSymbolsHint);
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kinit/kinit-libpath.patch b/nixpkgs/pkgs/development/libraries/kde-frameworks/kinit/kinit-libpath.patch
new file mode 100644
index 000000000000..b949723fb543
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kinit/kinit-libpath.patch
@@ -0,0 +1,33 @@
+Index: kinit-5.32.0/src/kdeinit/kinit.cpp
+===================================================================
+--- kinit-5.32.0.orig/src/kdeinit/kinit.cpp
++++ kinit-5.32.0/src/kdeinit/kinit.cpp
+@@ -623,19 +623,15 @@ static pid_t launch(int argc, const char
+ 
+         if (!libpath.isEmpty()) {
+             if (libpath_relative) {
+-                // NB: Because Qt makes the actual dlopen() call, the
+-                //     RUNPATH of kdeinit is *not* respected - see
+-                //     https://sourceware.org/bugzilla/show_bug.cgi?id=13945
+-                //     - so we try hacking it in ourselves
+-                QString install_lib_dir = QFile::decodeName(
+-                        CMAKE_INSTALL_PREFIX "/" LIB_INSTALL_DIR "/");
+-                QString orig_libpath = libpath;
+-                libpath = install_lib_dir + libpath;
+-                l.setFileName(libpath);
+-                if (!l.load()) {
+-                    libpath = orig_libpath;
+-                    l.setFileName(libpath);
+-                    l.load();
++                // Try to load the library relative to the active profiles.
++                QByteArrayList profiles = qgetenv("NIX_PROFILES").split(' ');
++                // Reverse the profile list.
++                std::reverse(profiles.begin(), profiles.end());
++                for (const QByteArray &profile: profiles) {
++                    if (!profile.isEmpty()) {
++                        l.setFileName(QFile::decodeName(profile) + QStringLiteral("/lib/") + libpath);
++                        if (l.load()) break;
++                    }
+                 }
+             } else {
+                 l.load();
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kinit/series b/nixpkgs/pkgs/development/libraries/kde-frameworks/kinit/series
new file mode 100644
index 000000000000..9195a4e8e6b0
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kinit/series
@@ -0,0 +1,3 @@
+kinit-libpath.patch
+start_kdeinit-path.patch
+kdeinit-extra_libs.patch
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kinit/start_kdeinit-path.patch b/nixpkgs/pkgs/development/libraries/kde-frameworks/kinit/start_kdeinit-path.patch
new file mode 100644
index 000000000000..e3bfc2ebe6b4
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kinit/start_kdeinit-path.patch
@@ -0,0 +1,13 @@
+Index: kinit-5.24.0/src/start_kdeinit/start_kdeinit_wrapper.c
+===================================================================
+--- kinit-5.24.0.orig/src/start_kdeinit/start_kdeinit_wrapper.c
++++ kinit-5.24.0/src/start_kdeinit/start_kdeinit_wrapper.c
+@@ -23,7 +23,7 @@
+ #include <string.h>
+ #include <unistd.h>
+ 
+-#define EXECUTE CMAKE_INSTALL_FULL_LIBEXECDIR_KF5 "/start_kdeinit"
++#define EXECUTE "/run/wrappers/bin/start_kdeinit"
+ 
+ #if KDEINIT_OOM_PROTECT
+ 
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kio/default.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/kio/default.nix
new file mode 100644
index 000000000000..281778d9d07f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kio/default.nix
@@ -0,0 +1,24 @@
+{
+  mkDerivation, lib, copyPathsToStore,
+  extra-cmake-modules, kdoctools,
+  karchive, kbookmarks, kcompletion, kconfig, kconfigwidgets, kcoreaddons,
+  kdbusaddons, ki18n, kiconthemes, kitemviews, kjobwidgets, knotifications,
+  kservice, ktextwidgets, kwallet, kwidgetsaddons, kwindowsystem, kxmlgui,
+  qtbase, qtscript, qtx11extras, solid, kcrash
+}:
+
+mkDerivation {
+  name = "kio";
+  meta = { maintainers = [ lib.maintainers.ttuegel ]; };
+  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
+  buildInputs = [
+    karchive kconfigwidgets kdbusaddons ki18n kiconthemes knotifications
+    ktextwidgets kwallet kwidgetsaddons kwindowsystem qtscript qtx11extras
+    kcrash
+  ];
+  propagatedBuildInputs = [
+    kbookmarks kcompletion kconfig kcoreaddons kitemviews kjobwidgets kservice
+    kxmlgui qtbase solid
+  ];
+  patches = (copyPathsToStore (lib.readPathsFromFile ./. ./series));
+}
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kio/kio-debug-module-loader.patch b/nixpkgs/pkgs/development/libraries/kde-frameworks/kio/kio-debug-module-loader.patch
new file mode 100644
index 000000000000..d26af49e5eb2
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kio/kio-debug-module-loader.patch
@@ -0,0 +1,13 @@
+Index: kio-5.33.0/src/kiod/kiod_main.cpp
+===================================================================
+--- kio-5.33.0.orig/src/kiod/kiod_main.cpp
++++ kio-5.33.0/src/kiod/kiod_main.cpp
+@@ -60,7 +60,7 @@ void KIOD::loadModule(const QString &nam
+         module = factory->create<KDEDModule>();
+     }
+     if (!module) {
+-        qCWarning(KIOD_CATEGORY) << "Error loading plugin:" << loader.errorString();
++        qCWarning(KIOD_CATEGORY) << "Error loading plugin" << name << loader.errorString();
+         return;
+     }
+     module->setModuleName(name); // makes it register to DBus
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kio/samba-search-path.patch b/nixpkgs/pkgs/development/libraries/kde-frameworks/kio/samba-search-path.patch
new file mode 100644
index 000000000000..3e18d304c307
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kio/samba-search-path.patch
@@ -0,0 +1,28 @@
+Index: kio-5.17.0/src/core/ksambashare.cpp
+===================================================================
+--- kio-5.17.0.orig/src/core/ksambashare.cpp
++++ kio-5.17.0/src/core/ksambashare.cpp
+@@ -67,13 +67,18 @@ KSambaSharePrivate::~KSambaSharePrivate(
+ 
+ bool KSambaSharePrivate::isSambaInstalled()
+ {
+-    if (QFile::exists(QStringLiteral("/usr/sbin/smbd"))
+-            || QFile::exists(QStringLiteral("/usr/local/sbin/smbd"))) {
+-        return true;
++    const QByteArray pathEnv = qgetenv("PATH");
++    if (!pathEnv.isEmpty()) {
++        QLatin1Char pathSep(':');
++        QStringList paths = QFile::decodeName(pathEnv).split(pathSep, QString::SkipEmptyParts);
++        for (QStringList::iterator it = paths.begin(); it != paths.end(); ++it) {
++            it->append(QStringLiteral("/smbd"));
++            if (QFile::exists(*it)) {
++                return true;
++            }
++        }
+     }
+ 
+-    //qDebug() << "Samba is not installed!";
+-
+     return false;
+ }
+ 
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kio/series b/nixpkgs/pkgs/development/libraries/kde-frameworks/kio/series
new file mode 100644
index 000000000000..5330c40a3306
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kio/series
@@ -0,0 +1,2 @@
+samba-search-path.patch
+kio-debug-module-loader.patch
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kirigami2.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/kirigami2.nix
new file mode 100644
index 000000000000..f4fc40f6d31d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kirigami2.nix
@@ -0,0 +1,11 @@
+{ mkDerivation, extra-cmake-modules, qtbase, qtquickcontrols2, qttranslations }:
+
+mkDerivation {
+  name = "kirigami2";
+  meta = {
+    broken = builtins.compareVersions qtbase.version "5.7.0" < 0;
+  };
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [ qtbase qtquickcontrols2 qttranslations ];
+  outputs = [ "out" "dev" ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kitemmodels.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/kitemmodels.nix
new file mode 100644
index 000000000000..91bc3e2b98d4
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kitemmodels.nix
@@ -0,0 +1,16 @@
+{
+  mkDerivation, lib,
+  extra-cmake-modules,
+  qtbase
+}:
+
+mkDerivation {
+  name = "kitemmodels";
+  meta = {
+    maintainers = [ lib.maintainers.ttuegel ];
+    broken = builtins.compareVersions qtbase.version "5.7.0" < 0;
+  };
+  nativeBuildInputs = [ extra-cmake-modules ];
+  propagatedBuildInputs = [ qtbase ];
+  outputs = [ "out" "dev" ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kitemviews.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/kitemviews.nix
new file mode 100644
index 000000000000..004d1ac77a6d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kitemviews.nix
@@ -0,0 +1,17 @@
+{
+  mkDerivation, lib,
+  extra-cmake-modules,
+  qtbase, qttools
+}:
+
+mkDerivation {
+  name = "kitemviews";
+  meta = {
+    maintainers = [ lib.maintainers.ttuegel ];
+    broken = builtins.compareVersions qtbase.version "5.7.0" < 0;
+  };
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [ qttools ];
+  propagatedBuildInputs = [ qtbase ];
+  outputs = [ "out" "dev" ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kjobwidgets.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/kjobwidgets.nix
new file mode 100644
index 000000000000..810e2bf8c84e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kjobwidgets.nix
@@ -0,0 +1,12 @@
+{
+  mkDerivation, lib,
+  extra-cmake-modules, qttools,
+  kcoreaddons, kwidgetsaddons, qtx11extras
+}:
+
+mkDerivation {
+  name = "kjobwidgets";
+  meta = { maintainers = [ lib.maintainers.ttuegel ]; };
+  nativeBuildInputs = [ extra-cmake-modules qttools ];
+  buildInputs = [ kcoreaddons kwidgetsaddons qtx11extras ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kjs.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/kjs.nix
new file mode 100644
index 000000000000..311f07241d65
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kjs.nix
@@ -0,0 +1,12 @@
+{
+  mkDerivation, lib,
+  extra-cmake-modules, kdoctools,
+  pcre, qtbase,
+}:
+
+mkDerivation {
+  name = "kjs";
+  meta = { maintainers = [ lib.maintainers.ttuegel ]; };
+  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
+  buildInputs = [ pcre qtbase ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kjsembed.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/kjsembed.nix
new file mode 100644
index 000000000000..e8cd5070ae53
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kjsembed.nix
@@ -0,0 +1,13 @@
+{
+  mkDerivation, lib,
+  extra-cmake-modules, kdoctools, qttools,
+  ki18n, kjs, qtsvg,
+}:
+
+mkDerivation {
+  name = "kjsembed";
+  meta = { maintainers = [ lib.maintainers.ttuegel ]; };
+  nativeBuildInputs = [ extra-cmake-modules kdoctools qttools ];
+  buildInputs = [ ki18n qtsvg ];
+  propagatedBuildInputs = [ kjs ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kmediaplayer.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/kmediaplayer.nix
new file mode 100644
index 000000000000..a4714c9e4ad7
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kmediaplayer.nix
@@ -0,0 +1,12 @@
+{ mkDerivation, lib
+, extra-cmake-modules
+, kparts
+, kxmlgui
+}:
+
+mkDerivation {
+  name = "kmediaplayer";
+  meta = { maintainers = [ lib.maintainers.ttuegel ]; };
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [ kparts kxmlgui ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/knewstuff.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/knewstuff.nix
new file mode 100644
index 000000000000..70f3cbb3c37e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/knewstuff.nix
@@ -0,0 +1,18 @@
+{
+  mkDerivation, lib,
+  extra-cmake-modules,
+  attica, karchive, kcompletion, kconfig, kcoreaddons, ki18n, kiconthemes,
+  kio, kitemviews, kservice, ktextwidgets, kwidgetsaddons, kxmlgui, qtbase,
+  qtdeclarative,
+}:
+
+mkDerivation {
+  name = "knewstuff";
+  meta = { maintainers = [ lib.maintainers.ttuegel ]; };
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [
+    karchive kcompletion kconfig kcoreaddons ki18n kiconthemes kio kitemviews
+    ktextwidgets kwidgetsaddons qtbase qtdeclarative
+  ];
+  propagatedBuildInputs = [ attica kservice kxmlgui ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/knotifications.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/knotifications.nix
new file mode 100644
index 000000000000..964e1b441154
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/knotifications.nix
@@ -0,0 +1,16 @@
+{ mkDerivation, lib
+, extra-cmake-modules
+, kcodecs, kconfig, kcoreaddons, kwindowsystem
+, libdbusmenu
+, phonon
+, qttools, qtx11extras
+}:
+
+mkDerivation {
+  name = "knotifications";
+  meta = { maintainers = [ lib.maintainers.ttuegel ]; };
+  nativeBuildInputs = [ extra-cmake-modules qttools ];
+  buildInputs = [
+    kcodecs kconfig kcoreaddons kwindowsystem libdbusmenu phonon qtx11extras
+  ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/knotifyconfig.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/knotifyconfig.nix
new file mode 100644
index 000000000000..6739f96183c1
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/knotifyconfig.nix
@@ -0,0 +1,14 @@
+{
+  mkDerivation, lib,
+  extra-cmake-modules,
+  kcompletion, kconfig, ki18n, kio, phonon, qtbase,
+}:
+
+mkDerivation {
+  name = "knotifyconfig";
+  meta = { maintainers = [ lib.maintainers.ttuegel ]; };
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [ kcompletion kconfig ki18n kio phonon ];
+  propagatedBuildInputs = [ qtbase ];
+  outputs = [ "out" "dev" ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kpackage/allow-external-paths.patch b/nixpkgs/pkgs/development/libraries/kde-frameworks/kpackage/allow-external-paths.patch
new file mode 100644
index 000000000000..c1c9efde7f74
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kpackage/allow-external-paths.patch
@@ -0,0 +1,13 @@
+diff --git a/src/kpackage/package.cpp b/src/kpackage/package.cpp
+index 5aec9fd..b15c933 100644
+--- a/src/kpackage/package.cpp
++++ b/src/kpackage/package.cpp
+@@ -820,7 +820,7 @@ PackagePrivate::PackagePrivate()
+     : QSharedData(),
+       fallbackPackage(nullptr),
+       metadata(nullptr),
+-      externalPaths(false),
++      externalPaths(true),
+       valid(false),
+       checkedValid(false)
+ {
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kpackage/default.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/kpackage/default.nix
new file mode 100644
index 000000000000..6779faa50cdc
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kpackage/default.nix
@@ -0,0 +1,13 @@
+{
+  mkDerivation, lib, copyPathsToStore,
+  extra-cmake-modules, kdoctools,
+  karchive, kconfig, kcoreaddons, ki18n, qtbase,
+}:
+
+mkDerivation {
+  name = "kpackage";
+  meta = { maintainers = [ lib.maintainers.ttuegel ]; };
+  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
+  buildInputs = [ karchive kconfig kcoreaddons ki18n qtbase ];
+  patches = copyPathsToStore (lib.readPathsFromFile ./. ./series);
+}
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kpackage/qdiriterator-follow-symlinks.patch b/nixpkgs/pkgs/development/libraries/kde-frameworks/kpackage/qdiriterator-follow-symlinks.patch
new file mode 100644
index 000000000000..cab334838ee7
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kpackage/qdiriterator-follow-symlinks.patch
@@ -0,0 +1,26 @@
+Index: kpackage-5.30.0/src/kpackage/packageloader.cpp
+===================================================================
+--- kpackage-5.30.0.orig/src/kpackage/packageloader.cpp
++++ kpackage-5.30.0/src/kpackage/packageloader.cpp
+@@ -238,7 +238,7 @@ QList<KPluginMetaData> PackageLoader::li
+         } else {
+             //qDebug() << "Not cached";
+             // If there's no cache file, fall back to listing the directory
+-            const QDirIterator::IteratorFlags flags = QDirIterator::Subdirectories;
++            const QDirIterator::IteratorFlags flags = QDirIterator::Subdirectories | QDirIterator::FollowSymlinks;
+             const QStringList nameFilters = { QStringLiteral("metadata.json"), QStringLiteral("metadata.desktop") };
+ 
+             QDirIterator it(plugindir, nameFilters, QDir::Files, flags);
+Index: kpackage-5.30.0/src/kpackage/private/packagejobthread.cpp
+===================================================================
+--- kpackage-5.30.0.orig/src/kpackage/private/packagejobthread.cpp
++++ kpackage-5.30.0/src/kpackage/private/packagejobthread.cpp
+@@ -121,7 +121,7 @@ bool indexDirectory(const QString& dir,
+ 
+     QJsonArray plugins;
+ 
+-    QDirIterator it(dir, *metaDataFiles, QDir::Files, QDirIterator::Subdirectories);
++    QDirIterator it(dir, *metaDataFiles, QDir::Files, QDirIterator::Subdirectories | QDirIterator::FollowSymlinks);
+     while (it.hasNext()) {
+         it.next();
+         const QString path = it.fileInfo().absoluteFilePath();
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kpackage/series b/nixpkgs/pkgs/development/libraries/kde-frameworks/kpackage/series
new file mode 100644
index 000000000000..9b7f076efc70
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kpackage/series
@@ -0,0 +1,2 @@
+allow-external-paths.patch
+qdiriterator-follow-symlinks.patch
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kparts.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/kparts.nix
new file mode 100644
index 000000000000..f657569277a1
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kparts.nix
@@ -0,0 +1,17 @@
+{
+  mkDerivation, lib,
+  extra-cmake-modules,
+  kconfig, kcoreaddons, ki18n, kiconthemes, kio, kjobwidgets, knotifications,
+  kservice, ktextwidgets, kwidgetsaddons, kxmlgui
+}:
+
+mkDerivation {
+  name = "kparts";
+  meta = { maintainers = [ lib.maintainers.ttuegel ]; };
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [
+    kconfig kcoreaddons ki18n kiconthemes kjobwidgets knotifications kservice
+    kwidgetsaddons
+  ];
+  propagatedBuildInputs = [ kio ktextwidgets kxmlgui ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kpeople.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/kpeople.nix
new file mode 100644
index 000000000000..04181fd3e13a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kpeople.nix
@@ -0,0 +1,16 @@
+{
+  mkDerivation, lib,
+  extra-cmake-modules,
+  kcoreaddons, ki18n, kitemviews, kservice, kwidgetsaddons, qtbase,
+  qtdeclarative,
+}:
+
+mkDerivation {
+  name = "kpeople";
+  meta = { maintainers = [ lib.maintainers.ttuegel ]; };
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [
+    kcoreaddons ki18n kitemviews kservice kwidgetsaddons qtdeclarative
+  ];
+  propagatedBuildInputs = [ qtbase ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kplotting.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/kplotting.nix
new file mode 100644
index 000000000000..380fd8fc5e34
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kplotting.nix
@@ -0,0 +1,14 @@
+{ mkDerivation, lib
+, extra-cmake-modules, qtbase
+}:
+
+mkDerivation {
+  name = "kplotting";
+  meta = {
+    maintainers = [ lib.maintainers.ttuegel ];
+    broken = builtins.compareVersions qtbase.version "5.7.0" < 0;
+  };
+  nativeBuildInputs = [ extra-cmake-modules ];
+  propagatedBuildInputs = [ qtbase ];
+  outputs = [ "out" "dev" ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kpty.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/kpty.nix
new file mode 100644
index 000000000000..150c5b3d2b26
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kpty.nix
@@ -0,0 +1,9 @@
+{ mkDerivation, lib, extra-cmake-modules, kcoreaddons, ki18n, qtbase, }:
+
+mkDerivation {
+  name = "kpty";
+  meta = { maintainers = [ lib.maintainers.ttuegel ]; };
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [ kcoreaddons ki18n qtbase ];
+  outputs = [ "out" "dev" ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kross.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/kross.nix
new file mode 100644
index 000000000000..f45fb5ecd1d0
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kross.nix
@@ -0,0 +1,14 @@
+{ mkDerivation, lib, extra-cmake-modules, kcompletion, kcoreaddons
+, kdoctools, ki18n, kiconthemes, kio, kparts, kwidgetsaddons
+, kxmlgui, qtbase, qtscript, qtxmlpatterns,
+}:
+
+mkDerivation {
+  name = "kross";
+  meta = { maintainers = [ lib.maintainers.ttuegel ]; };
+  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
+  buildInputs = [ kcompletion kcoreaddons kxmlgui ];
+  propagatedBuildInputs = [
+    ki18n kiconthemes kio kparts kwidgetsaddons qtbase qtscript qtxmlpatterns
+  ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/krunner.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/krunner.nix
new file mode 100644
index 000000000000..826999f2f9be
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/krunner.nix
@@ -0,0 +1,17 @@
+{
+  mkDerivation, lib,
+  extra-cmake-modules,
+  kconfig, kcoreaddons, ki18n, kio, kservice, plasma-framework, qtbase,
+  qtdeclarative, solid, threadweaver, kwindowsystem
+}:
+
+mkDerivation {
+  name = "krunner";
+  meta = { maintainers = [ lib.maintainers.ttuegel ]; };
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [
+    kconfig kcoreaddons ki18n kio kservice qtdeclarative solid
+    threadweaver
+  ];
+  propagatedBuildInputs = [ plasma-framework qtbase kwindowsystem ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kservice/default.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/kservice/default.nix
new file mode 100644
index 000000000000..356e6537a4fd
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kservice/default.nix
@@ -0,0 +1,19 @@
+{
+  mkDerivation, lib, copyPathsToStore,
+  bison, extra-cmake-modules, flex,
+  kconfig, kcoreaddons, kcrash, kdbusaddons, kdoctools, ki18n, kwindowsystem,
+  qtbase, shared-mime-info,
+}:
+
+mkDerivation {
+  name = "kservice";
+  meta = { maintainers = [ lib.maintainers.ttuegel ]; };
+  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
+  propagatedNativeBuildInputs = [ bison flex ];
+  buildInputs = [
+    kcrash kdbusaddons ki18n kwindowsystem qtbase
+  ];
+  propagatedBuildInputs = [ kconfig kcoreaddons ];
+  propagatedUserEnvPkgs = [ shared-mime-info ]; # for kbuildsycoca5
+  patches = copyPathsToStore (lib.readPathsFromFile ./. ./series);
+}
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kservice/no-canonicalize-path.patch b/nixpkgs/pkgs/development/libraries/kde-frameworks/kservice/no-canonicalize-path.patch
new file mode 100644
index 000000000000..cf98ffb9067f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kservice/no-canonicalize-path.patch
@@ -0,0 +1,13 @@
+Index: kservice-5.21.0/src/sycoca/vfolder_menu.cpp
+===================================================================
+--- kservice-5.21.0.orig/src/sycoca/vfolder_menu.cpp
++++ kservice-5.21.0/src/sycoca/vfolder_menu.cpp
+@@ -415,7 +415,7 @@ VFolderMenu::absoluteDir(const QString &
+     }
+ 
+     if (!relative) {
+-        QString resolved = QDir(dir).canonicalPath();
++      QString resolved = QDir::cleanPath(dir);
+         if (!resolved.isEmpty()) {
+             dir = resolved;
+         }
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kservice/qdiriterator-follow-symlinks.patch b/nixpkgs/pkgs/development/libraries/kde-frameworks/kservice/qdiriterator-follow-symlinks.patch
new file mode 100644
index 000000000000..fdd8b4d81a18
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kservice/qdiriterator-follow-symlinks.patch
@@ -0,0 +1,13 @@
+diff --git a/src/sycoca/kbuildsycoca.cpp b/src/sycoca/kbuildsycoca.cpp
+index b125299..0682b90 100644
+--- a/src/sycoca/kbuildsycoca.cpp
++++ b/src/sycoca/kbuildsycoca.cpp
+@@ -207,7 +207,7 @@ bool KBuildSycoca::build()
+         const QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, m_resourceSubdir, QStandardPaths::LocateDirectory);
+         qCDebug(SYCOCA) << "Looking for subdir" << m_resourceSubdir << "=>" << dirs;
+         for (const QString &dir : dirs) {
+-            QDirIterator it(dir, QDirIterator::Subdirectories);
++            QDirIterator it(dir, QDirIterator::Subdirectories | QDirIterator::FollowSymlinks);
+             while (it.hasNext()) {
+                 const QString filePath = it.next();
+                 Q_ASSERT(filePath.startsWith(dir)); // due to the line below...
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kservice/series b/nixpkgs/pkgs/development/libraries/kde-frameworks/kservice/series
new file mode 100644
index 000000000000..3ce22dbd35a0
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kservice/series
@@ -0,0 +1,2 @@
+qdiriterator-follow-symlinks.patch
+no-canonicalize-path.patch
\ No newline at end of file
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/ktexteditor.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/ktexteditor.nix
new file mode 100644
index 000000000000..c633aee30a1b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/ktexteditor.nix
@@ -0,0 +1,17 @@
+{
+  mkDerivation, lib,
+  extra-cmake-modules, perl,
+  karchive, kconfig, kguiaddons, ki18n, kiconthemes, kio, kparts, libgit2,
+  qtscript, qtxmlpatterns, sonnet, syntax-highlighting, qtquickcontrols
+}:
+
+mkDerivation {
+  name = "ktexteditor";
+  meta = { maintainers = [ lib.maintainers.ttuegel ]; };
+  nativeBuildInputs = [ extra-cmake-modules perl ];
+  buildInputs = [
+    karchive kconfig kguiaddons ki18n kiconthemes kio libgit2 qtscript
+    qtxmlpatterns sonnet syntax-highlighting qtquickcontrols
+  ];
+  propagatedBuildInputs = [ kparts ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/ktextwidgets.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/ktextwidgets.nix
new file mode 100644
index 000000000000..8b082f7f3655
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/ktextwidgets.nix
@@ -0,0 +1,16 @@
+{
+  mkDerivation, lib,
+  extra-cmake-modules,
+  kcompletion, kconfig, kconfigwidgets, ki18n, kiconthemes, kservice,
+  kwindowsystem, qtbase, sonnet,
+}:
+
+mkDerivation {
+  name = "ktextwidgets";
+  meta = { maintainers = [ lib.maintainers.ttuegel ]; };
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [
+    kcompletion kconfig kconfigwidgets kiconthemes kservice kwindowsystem
+  ];
+  propagatedBuildInputs = [ ki18n qtbase sonnet ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kunitconversion.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/kunitconversion.nix
new file mode 100644
index 000000000000..d6c079fd83b8
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kunitconversion.nix
@@ -0,0 +1,9 @@
+{ mkDerivation, lib, extra-cmake-modules, ki18n, qtbase, }:
+
+mkDerivation {
+  name = "kunitconversion";
+  meta = { maintainers = [ lib.maintainers.ttuegel ]; };
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [ ki18n qtbase ];
+  outputs = [ "out" "dev" ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kwallet.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/kwallet.nix
new file mode 100644
index 000000000000..fca0dedd083e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kwallet.nix
@@ -0,0 +1,18 @@
+{
+  mkDerivation, lib,
+  extra-cmake-modules, kdoctools,
+  kconfig, kconfigwidgets, kcoreaddons , kdbusaddons, ki18n,
+  kiconthemes, knotifications, kservice, kwidgetsaddons, kwindowsystem,
+  libgcrypt, qgpgme, qtbase,
+}:
+
+mkDerivation {
+  name = "kwallet";
+  meta = { maintainers = [ lib.maintainers.ttuegel ]; };
+  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
+  buildInputs = [
+    kconfig kconfigwidgets kcoreaddons kdbusaddons ki18n kiconthemes
+    knotifications kservice kwidgetsaddons kwindowsystem libgcrypt qgpgme
+  ];
+  propagatedBuildInputs = [ qtbase ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kwayland.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/kwayland.nix
new file mode 100644
index 000000000000..ee19b39bd159
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kwayland.nix
@@ -0,0 +1,17 @@
+{
+  mkDerivation, lib, propagateBin,
+  extra-cmake-modules,
+  qtbase, wayland
+}:
+
+mkDerivation {
+  name = "kwayland";
+  meta = {
+    maintainers = [ lib.maintainers.ttuegel ];
+    broken = builtins.compareVersions qtbase.version "5.7.0" < 0;
+  };
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [ wayland ];
+  propagatedBuildInputs = [ qtbase ];
+  setupHook = propagateBin; # XDG_CONFIG_DIRS
+}
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kwidgetsaddons.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/kwidgetsaddons.nix
new file mode 100644
index 000000000000..63a95bc217c8
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kwidgetsaddons.nix
@@ -0,0 +1,17 @@
+{
+  mkDerivation, lib,
+  extra-cmake-modules,
+  qtbase, qttools
+}:
+
+mkDerivation {
+  name = "kwidgetsaddons";
+  meta = {
+    maintainers = [ lib.maintainers.ttuegel ];
+    broken = builtins.compareVersions qtbase.version "5.7.0" < 0;
+  };
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [ qttools ];
+  propagatedBuildInputs = [ qtbase ];
+  outputs = [ "out" "dev" ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kwindowsystem/default.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/kwindowsystem/default.nix
new file mode 100644
index 000000000000..c075adf02941
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kwindowsystem/default.nix
@@ -0,0 +1,22 @@
+{
+  mkDerivation, lib, copyPathsToStore,
+  extra-cmake-modules,
+  libpthreadstubs, libXdmcp,
+  qtbase, qttools, qtx11extras
+}:
+
+mkDerivation {
+  name = "kwindowsystem";
+  meta = {
+    maintainers = [ lib.maintainers.ttuegel ];
+    broken = builtins.compareVersions qtbase.version "5.7.0" < 0;
+  };
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [ libpthreadstubs libXdmcp qttools qtx11extras ];
+  propagatedBuildInputs = [ qtbase ];
+  patches = copyPathsToStore (lib.readPathsFromFile ./. ./series);
+  preConfigure = ''
+    NIX_CFLAGS_COMPILE+=" -DNIXPKGS_QT_PLUGIN_PATH=\"''${!outputBin}/$qtPluginPrefix\""
+  '';
+  outputs = [ "out" "dev" ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kwindowsystem/platform-plugins-path.patch b/nixpkgs/pkgs/development/libraries/kde-frameworks/kwindowsystem/platform-plugins-path.patch
new file mode 100644
index 000000000000..ae0da37922e9
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kwindowsystem/platform-plugins-path.patch
@@ -0,0 +1,22 @@
+Index: kwindowsystem-5.32.0/src/pluginwrapper.cpp
+===================================================================
+--- kwindowsystem-5.32.0.orig/src/pluginwrapper.cpp
++++ kwindowsystem-5.32.0/src/pluginwrapper.cpp
+@@ -37,14 +37,9 @@ Q_GLOBAL_STATIC(KWindowSystemPluginWrapp
+ static QStringList pluginCandidates()
+ {
+     QStringList ret;
+-    foreach (const QString &path, QCoreApplication::libraryPaths()) {
+-        QDir pluginDir(path + QLatin1Literal("/kf5/org.kde.kwindowsystem.platforms"));
+-        if (!pluginDir.exists()) {
+-            continue;
+-        }
+-        foreach (const QString &entry, pluginDir.entryList(QDir::Files | QDir::NoDotAndDotDot)) {
+-            ret << pluginDir.absoluteFilePath(entry);
+-        }
++    QDir pluginDir(QLatin1String(NIXPKGS_QT_PLUGIN_PATH) + QLatin1Literal("/kf5/org.kde.kwindowsystem.platforms"));
++    foreach (const QString &entry, pluginDir.entryList(QDir::Files | QDir::NoDotAndDotDot)) {
++        ret << pluginDir.absoluteFilePath(entry);
+     }
+     return ret;
+ }
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kwindowsystem/series b/nixpkgs/pkgs/development/libraries/kde-frameworks/kwindowsystem/series
new file mode 100644
index 000000000000..2cd02056ff81
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kwindowsystem/series
@@ -0,0 +1 @@
+platform-plugins-path.patch
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kxmlgui.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/kxmlgui.nix
new file mode 100644
index 000000000000..b9aede81f9a9
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kxmlgui.nix
@@ -0,0 +1,17 @@
+{
+  mkDerivation, lib,
+  extra-cmake-modules,
+  attica, kconfig, kconfigwidgets, kglobalaccel, ki18n, kiconthemes, kitemviews,
+  ktextwidgets, kwindowsystem, qtbase, sonnet,
+}:
+
+mkDerivation {
+  name = "kxmlgui";
+  meta = { maintainers = [ lib.maintainers.ttuegel ]; };
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [
+    attica kglobalaccel ki18n kiconthemes kitemviews ktextwidgets kwindowsystem
+    sonnet
+  ];
+  propagatedBuildInputs = [ kconfig kconfigwidgets qtbase ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kxmlrpcclient.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/kxmlrpcclient.nix
new file mode 100644
index 000000000000..acffde6a7cf1
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kxmlrpcclient.nix
@@ -0,0 +1,10 @@
+{ mkDerivation, lib, extra-cmake-modules, ki18n, kio }:
+
+mkDerivation {
+  name = "kxmlrpcclient";
+  meta = { maintainers = [ lib.maintainers.ttuegel ]; };
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [ ki18n ];
+  propagatedBuildInputs = [ kio ];
+  outputs = [ "out" "dev" ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/modemmanager-qt.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/modemmanager-qt.nix
new file mode 100644
index 000000000000..195e90feef6f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/modemmanager-qt.nix
@@ -0,0 +1,16 @@
+{
+  mkDerivation, lib,
+  extra-cmake-modules,
+  modemmanager, qtbase
+}:
+
+mkDerivation {
+  name = "modemmanager-qt";
+  meta = {
+    maintainers = [ lib.maintainers.ttuegel ];
+    broken = builtins.compareVersions qtbase.version "5.7.0" < 0;
+  };
+  nativeBuildInputs = [ extra-cmake-modules ];
+  propagatedBuildInputs = [ modemmanager qtbase ];
+  outputs = [ "out" "dev" ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/networkmanager-qt.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/networkmanager-qt.nix
new file mode 100644
index 000000000000..4ded321674f7
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/networkmanager-qt.nix
@@ -0,0 +1,16 @@
+{
+  mkDerivation, lib,
+  extra-cmake-modules,
+  networkmanager, qtbase,
+}:
+
+mkDerivation {
+  name = "networkmanager-qt";
+  meta = {
+    maintainers = [ lib.maintainers.ttuegel ];
+    broken = builtins.compareVersions qtbase.version "5.7.0" < 0;
+  };
+  nativeBuildInputs = [ extra-cmake-modules ];
+  propagatedBuildInputs = [ networkmanager qtbase ];
+  outputs = [ "out" "dev" ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/oxygen-icons5.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/oxygen-icons5.nix
new file mode 100644
index 000000000000..2d795bfc50cc
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/oxygen-icons5.nix
@@ -0,0 +1,15 @@
+{ mkDerivation
+, lib
+, extra-cmake-modules, qtbase
+}:
+
+mkDerivation {
+  name = "oxygen-icons5";
+  meta = {
+    license = lib.licenses.lgpl3Plus;
+    maintainers = [ lib.maintainers.ttuegel ];
+  };
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [ qtbase ];
+  outputs = [ "out" ]; # only runtime outputs
+}
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/plasma-framework.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/plasma-framework.nix
new file mode 100644
index 000000000000..44005ec7d282
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/plasma-framework.nix
@@ -0,0 +1,21 @@
+{
+  mkDerivation, lib,
+  extra-cmake-modules, kdoctools,
+  kactivities, karchive, kconfig, kconfigwidgets, kcoreaddons, kdbusaddons,
+  kdeclarative, kglobalaccel, kguiaddons, ki18n, kiconthemes, kio,
+  knotifications, kpackage, kservice, kwayland, kwindowsystem, kxmlgui,
+  qtbase, qtdeclarative, qtscript, qtx11extras, kirigami2, qtquickcontrols2
+}:
+
+mkDerivation {
+  name = "plasma-framework";
+  meta = { maintainers = [ lib.maintainers.ttuegel ]; };
+  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
+  buildInputs = [
+    kactivities karchive kconfig kconfigwidgets kcoreaddons kdbusaddons
+    kdeclarative kglobalaccel kguiaddons ki18n kiconthemes kio knotifications
+    kwayland kwindowsystem kxmlgui qtdeclarative qtscript qtx11extras kirigami2
+    qtquickcontrols2
+  ];
+  propagatedBuildInputs = [ kpackage kservice qtbase ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/prison.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/prison.nix
new file mode 100644
index 000000000000..cf74ee20c2d7
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/prison.nix
@@ -0,0 +1,17 @@
+{
+  mkDerivation, lib,
+  extra-cmake-modules,
+  libdmtx, qrencode, qtbase,
+}:
+
+mkDerivation {
+  name = "prison";
+  meta = {
+    maintainers = [ lib.maintainers.ttuegel ];
+    broken = builtins.compareVersions qtbase.version "5.7.0" < 0;
+  };
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [ libdmtx qrencode ];
+  propagatedBuildInputs = [ qtbase ];
+  outputs = [ "out" "dev" ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/purpose.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/purpose.nix
new file mode 100644
index 000000000000..147c4123a105
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/purpose.nix
@@ -0,0 +1,14 @@
+{
+  mkDerivation, lib, extra-cmake-modules, qtbase
+, qtdeclarative, kconfig, kcoreaddons, ki18n, kio
+}:
+
+mkDerivation {
+  name = "purpose";
+  meta = { maintainers = [ lib.maintainers.bkchr ]; };
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [
+    qtbase qtdeclarative kconfig kcoreaddons 
+    ki18n kio
+  ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/solid.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/solid.nix
new file mode 100644
index 000000000000..d1beb03fa620
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/solid.nix
@@ -0,0 +1,17 @@
+{
+  mkDerivation, lib,
+  bison, extra-cmake-modules, flex,
+  media-player-info, qtbase, qtdeclarative, qttools
+}:
+
+mkDerivation {
+  name = "solid";
+  meta = {
+    maintainers = [ lib.maintainers.ttuegel ];
+    broken = builtins.compareVersions qtbase.version "5.7.0" < 0;
+  };
+  nativeBuildInputs = [ bison extra-cmake-modules flex media-player-info ];
+  buildInputs = [ qtdeclarative qttools ];
+  propagatedBuildInputs = [ qtbase ];
+  propagatedUserEnvPkgs = [ media-player-info ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/sonnet.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/sonnet.nix
new file mode 100644
index 000000000000..cccd92513583
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/sonnet.nix
@@ -0,0 +1,15 @@
+{ mkDerivation, lib
+, extra-cmake-modules
+, hunspell, qtbase, qttools
+}:
+
+mkDerivation {
+  name = "sonnet";
+  meta = {
+    maintainers = [ lib.maintainers.ttuegel ];
+    broken = builtins.compareVersions qtbase.version "5.7.0" < 0;
+  };
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [ hunspell qttools ];
+  propagatedBuildInputs = [ qtbase ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/srcs.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/srcs.nix
new file mode 100644
index 000000000000..17473db9eebd
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/srcs.nix
@@ -0,0 +1,637 @@
+# DO NOT EDIT! This file is generated automatically by fetch-kde-qt.sh
+{ fetchurl, mirror }:
+
+{
+  attica = {
+    version = "5.58.0";
+    src = fetchurl {
+      url = "${mirror}/stable/frameworks/5.58/attica-5.58.0.tar.xz";
+      sha256 = "edba3f94705f904edb0bddd5bab491575bb15ee8f278b92b41272d6f566cad2a";
+      name = "attica-5.58.0.tar.xz";
+    };
+  };
+  baloo = {
+    version = "5.58.0";
+    src = fetchurl {
+      url = "${mirror}/stable/frameworks/5.58/baloo-5.58.0.tar.xz";
+      sha256 = "a1e9340f1046f2df1568da6cd07b26bac9361725cd32b46fd69c370aab0c7227";
+      name = "baloo-5.58.0.tar.xz";
+    };
+  };
+  bluez-qt = {
+    version = "5.58.0";
+    src = fetchurl {
+      url = "${mirror}/stable/frameworks/5.58/bluez-qt-5.58.0.tar.xz";
+      sha256 = "530dc2f89ca26cda23a6383ccfdb00584083d2fbee3b437e5337a77f51513da0";
+      name = "bluez-qt-5.58.0.tar.xz";
+    };
+  };
+  breeze-icons = {
+    version = "5.58.0";
+    src = fetchurl {
+      url = "${mirror}/stable/frameworks/5.58/breeze-icons-5.58.0.tar.xz";
+      sha256 = "536d2790a143bf0d8cc9ee4de74dea0924eb7d3ac4888fece7bf7c7038066491";
+      name = "breeze-icons-5.58.0.tar.xz";
+    };
+  };
+  extra-cmake-modules = {
+    version = "5.58.0";
+    src = fetchurl {
+      url = "${mirror}/stable/frameworks/5.58/extra-cmake-modules-5.58.0.tar.xz";
+      sha256 = "514011c12eeb2ac99d3118975832a279af2c2eea5e8b36b49c81962930b2ecc7";
+      name = "extra-cmake-modules-5.58.0.tar.xz";
+    };
+  };
+  frameworkintegration = {
+    version = "5.58.1";
+    src = fetchurl {
+      url = "${mirror}/stable/frameworks/5.58/frameworkintegration-5.58.1.tar.xz";
+      sha256 = "30a9e6c4bde295a031f94ea622ce2324b8a98536f51f0a008b148ea11c44a274";
+      name = "frameworkintegration-5.58.1.tar.xz";
+    };
+  };
+  kactivities = {
+    version = "5.58.0";
+    src = fetchurl {
+      url = "${mirror}/stable/frameworks/5.58/kactivities-5.58.0.tar.xz";
+      sha256 = "5295cfdc392a8146ca9c3822f1250ceaf5b54990d69c2e3dec4b072519a5ce5b";
+      name = "kactivities-5.58.0.tar.xz";
+    };
+  };
+  kactivities-stats = {
+    version = "5.58.0";
+    src = fetchurl {
+      url = "${mirror}/stable/frameworks/5.58/kactivities-stats-5.58.0.tar.xz";
+      sha256 = "5f3bde50ffe0c23ad5f28c7327d375f223535f139ff014c5d53aef2f41e80611";
+      name = "kactivities-stats-5.58.0.tar.xz";
+    };
+  };
+  kapidox = {
+    version = "5.58.0";
+    src = fetchurl {
+      url = "${mirror}/stable/frameworks/5.58/kapidox-5.58.0.tar.xz";
+      sha256 = "8635b09f7d0daa8554f228d471bbb1147cf412b779e3a8ab7c2bf7c24ec85165";
+      name = "kapidox-5.58.0.tar.xz";
+    };
+  };
+  karchive = {
+    version = "5.58.0";
+    src = fetchurl {
+      url = "${mirror}/stable/frameworks/5.58/karchive-5.58.0.tar.xz";
+      sha256 = "cd5a42101e5cc50f026f48002dc8125e0c898b148fea5fba4451023ec1e181ad";
+      name = "karchive-5.58.0.tar.xz";
+    };
+  };
+  kauth = {
+    version = "5.58.0";
+    src = fetchurl {
+      url = "${mirror}/stable/frameworks/5.58/kauth-5.58.0.tar.xz";
+      sha256 = "8c004199f1e7aa14f9244299bb8b288f6d077e5c2557f089a530d0c1cd072f4f";
+      name = "kauth-5.58.0.tar.xz";
+    };
+  };
+  kbookmarks = {
+    version = "5.58.0";
+    src = fetchurl {
+      url = "${mirror}/stable/frameworks/5.58/kbookmarks-5.58.0.tar.xz";
+      sha256 = "9b34f49703101e4d9f6338b66edded7b2c1b7826938a81025ede85a7edc71b02";
+      name = "kbookmarks-5.58.0.tar.xz";
+    };
+  };
+  kcmutils = {
+    version = "5.58.0";
+    src = fetchurl {
+      url = "${mirror}/stable/frameworks/5.58/kcmutils-5.58.0.tar.xz";
+      sha256 = "2eec73ffca93eb5fc9975a96e072c565a4907b05c161f49877684f4ab252fd9d";
+      name = "kcmutils-5.58.0.tar.xz";
+    };
+  };
+  kcodecs = {
+    version = "5.58.0";
+    src = fetchurl {
+      url = "${mirror}/stable/frameworks/5.58/kcodecs-5.58.0.tar.xz";
+      sha256 = "6e5b3c2083c840947e255d58b338128a5e498a4176969f6ac724d56ca3cae8ef";
+      name = "kcodecs-5.58.0.tar.xz";
+    };
+  };
+  kcompletion = {
+    version = "5.58.0";
+    src = fetchurl {
+      url = "${mirror}/stable/frameworks/5.58/kcompletion-5.58.0.tar.xz";
+      sha256 = "4f5be9d3a70183e0580126c6395d34e3e4141d6e6f852f5f0bb578b20205f5dd";
+      name = "kcompletion-5.58.0.tar.xz";
+    };
+  };
+  kconfig = {
+    version = "5.58.0";
+    src = fetchurl {
+      url = "${mirror}/stable/frameworks/5.58/kconfig-5.58.0.tar.xz";
+      sha256 = "6f464a63079f43f11deb7f1661dadaa12539b8a8c75e3fa7476dae8ab6886a5e";
+      name = "kconfig-5.58.0.tar.xz";
+    };
+  };
+  kconfigwidgets = {
+    version = "5.58.0";
+    src = fetchurl {
+      url = "${mirror}/stable/frameworks/5.58/kconfigwidgets-5.58.0.tar.xz";
+      sha256 = "8d68cf5618b7123a39e62a8ee52a01af7f95325b1d7b7bcac097c0d723c054c0";
+      name = "kconfigwidgets-5.58.0.tar.xz";
+    };
+  };
+  kcoreaddons = {
+    version = "5.58.0";
+    src = fetchurl {
+      url = "${mirror}/stable/frameworks/5.58/kcoreaddons-5.58.0.tar.xz";
+      sha256 = "f01f3d8b8086085e034a530821a929e56943e33002091d29ab45e0772b6f8e5e";
+      name = "kcoreaddons-5.58.0.tar.xz";
+    };
+  };
+  kcrash = {
+    version = "5.58.0";
+    src = fetchurl {
+      url = "${mirror}/stable/frameworks/5.58/kcrash-5.58.0.tar.xz";
+      sha256 = "cf921f0ced115107a57a4f15e95ea2d0478b56baf23102abc2470ecd6b8e3c44";
+      name = "kcrash-5.58.0.tar.xz";
+    };
+  };
+  kdbusaddons = {
+    version = "5.58.0";
+    src = fetchurl {
+      url = "${mirror}/stable/frameworks/5.58/kdbusaddons-5.58.0.tar.xz";
+      sha256 = "42f176b737f81e120d2fa78c20891b3b7e3f182c6e144ec9c99935a32d63f9b1";
+      name = "kdbusaddons-5.58.0.tar.xz";
+    };
+  };
+  kdeclarative = {
+    version = "5.58.0";
+    src = fetchurl {
+      url = "${mirror}/stable/frameworks/5.58/kdeclarative-5.58.0.tar.xz";
+      sha256 = "267d1dbe55ca65c74289e56200b51de95bcbc231b2d4a2867cb6735d04783bec";
+      name = "kdeclarative-5.58.0.tar.xz";
+    };
+  };
+  kded = {
+    version = "5.58.0";
+    src = fetchurl {
+      url = "${mirror}/stable/frameworks/5.58/kded-5.58.0.tar.xz";
+      sha256 = "c8ca04174ff9997ccedb382fce7bc4573670ac5dabc69c0d6594589098ab6dc1";
+      name = "kded-5.58.0.tar.xz";
+    };
+  };
+  kdelibs4support = {
+    version = "5.58.0";
+    src = fetchurl {
+      url = "${mirror}/stable/frameworks/5.58/portingAids/kdelibs4support-5.58.0.tar.xz";
+      sha256 = "c86db5d334c022d804cd9473f893b462904e336aad1ce2c350a1c87039d9473a";
+      name = "kdelibs4support-5.58.0.tar.xz";
+    };
+  };
+  kdesignerplugin = {
+    version = "5.58.0";
+    src = fetchurl {
+      url = "${mirror}/stable/frameworks/5.58/kdesignerplugin-5.58.0.tar.xz";
+      sha256 = "c80a88a525c25fb699412e5c4a4a142ae388ab056aa826a9f5433e78da9c6e6b";
+      name = "kdesignerplugin-5.58.0.tar.xz";
+    };
+  };
+  kdesu = {
+    version = "5.58.0";
+    src = fetchurl {
+      url = "${mirror}/stable/frameworks/5.58/kdesu-5.58.0.tar.xz";
+      sha256 = "9121dd13a37e0fe5d5d42bbc164d4e20228f85a9ed745829393d3292f7c8183b";
+      name = "kdesu-5.58.0.tar.xz";
+    };
+  };
+  kdewebkit = {
+    version = "5.58.0";
+    src = fetchurl {
+      url = "${mirror}/stable/frameworks/5.58/kdewebkit-5.58.0.tar.xz";
+      sha256 = "9f0629902e60717ee455f0a3e1201c735794f9c60e2fb6ec55b5983f532a2cbc";
+      name = "kdewebkit-5.58.0.tar.xz";
+    };
+  };
+  kdnssd = {
+    version = "5.58.0";
+    src = fetchurl {
+      url = "${mirror}/stable/frameworks/5.58/kdnssd-5.58.0.tar.xz";
+      sha256 = "d3b6ee64f4ed491120351732abf99712e64d43deb1b796d4b701e28df9efad05";
+      name = "kdnssd-5.58.0.tar.xz";
+    };
+  };
+  kdoctools = {
+    version = "5.58.0";
+    src = fetchurl {
+      url = "${mirror}/stable/frameworks/5.58/kdoctools-5.58.0.tar.xz";
+      sha256 = "5c0b915d0f054098b47c5c1ef6ee0d174a9a607405f23c3921276189cefd48f4";
+      name = "kdoctools-5.58.0.tar.xz";
+    };
+  };
+  kemoticons = {
+    version = "5.58.0";
+    src = fetchurl {
+      url = "${mirror}/stable/frameworks/5.58/kemoticons-5.58.0.tar.xz";
+      sha256 = "a34159566511f4c012186c52ae203c033d0cb81eef349fd89dbdc225f89b98bd";
+      name = "kemoticons-5.58.0.tar.xz";
+    };
+  };
+  kfilemetadata = {
+    version = "5.58.0";
+    src = fetchurl {
+      url = "${mirror}/stable/frameworks/5.58/kfilemetadata-5.58.0.tar.xz";
+      sha256 = "76665ba8ba6ab90cc0e8d682a5c5421fde7c436f5521c614d0b63c5277fabf9c";
+      name = "kfilemetadata-5.58.0.tar.xz";
+    };
+  };
+  kglobalaccel = {
+    version = "5.58.0";
+    src = fetchurl {
+      url = "${mirror}/stable/frameworks/5.58/kglobalaccel-5.58.0.tar.xz";
+      sha256 = "4fd49052697d4659f793b8f7d678a9333a850ed6cf17472eaba9c023430b5bbf";
+      name = "kglobalaccel-5.58.0.tar.xz";
+    };
+  };
+  kguiaddons = {
+    version = "5.58.0";
+    src = fetchurl {
+      url = "${mirror}/stable/frameworks/5.58/kguiaddons-5.58.0.tar.xz";
+      sha256 = "d6d5884f31072fe93804ecad72c8f612fa03d6841318211ad8f6ebf1f5f020f3";
+      name = "kguiaddons-5.58.0.tar.xz";
+    };
+  };
+  kholidays = {
+    version = "5.58.0";
+    src = fetchurl {
+      url = "${mirror}/stable/frameworks/5.58/kholidays-5.58.0.tar.xz";
+      sha256 = "ec05faf5290a83d2450be6e1a68c086e4d2da934b3aaf61d578e3cda72295eef";
+      name = "kholidays-5.58.0.tar.xz";
+    };
+  };
+  khtml = {
+    version = "5.58.0";
+    src = fetchurl {
+      url = "${mirror}/stable/frameworks/5.58/portingAids/khtml-5.58.0.tar.xz";
+      sha256 = "f75635e4d0ad9816953bbd0f8c18aea7cd470dc130a6294fa1d32c37bd66dcff";
+      name = "khtml-5.58.0.tar.xz";
+    };
+  };
+  ki18n = {
+    version = "5.58.0";
+    src = fetchurl {
+      url = "${mirror}/stable/frameworks/5.58/ki18n-5.58.0.tar.xz";
+      sha256 = "ea0181b15ff47b34ae7dd7a3a419c461cf05554f9014886d8b8b2ab2ec243977";
+      name = "ki18n-5.58.0.tar.xz";
+    };
+  };
+  kiconthemes = {
+    version = "5.58.0";
+    src = fetchurl {
+      url = "${mirror}/stable/frameworks/5.58/kiconthemes-5.58.0.tar.xz";
+      sha256 = "ec12602159b7115c91b30373321ab631f75b12f814769166b4ee2e3abd83c480";
+      name = "kiconthemes-5.58.0.tar.xz";
+    };
+  };
+  kidletime = {
+    version = "5.58.0";
+    src = fetchurl {
+      url = "${mirror}/stable/frameworks/5.58/kidletime-5.58.0.tar.xz";
+      sha256 = "86d8c4ff13b864c07f98d0475683838708c43e4ba6275e05f21766e2a79cfd90";
+      name = "kidletime-5.58.0.tar.xz";
+    };
+  };
+  kimageformats = {
+    version = "5.58.0";
+    src = fetchurl {
+      url = "${mirror}/stable/frameworks/5.58/kimageformats-5.58.0.tar.xz";
+      sha256 = "deb5b18c8289e2ce1988769f6b87dd7ad57dde6c15e51a474e51eef76568a9d9";
+      name = "kimageformats-5.58.0.tar.xz";
+    };
+  };
+  kinit = {
+    version = "5.58.0";
+    src = fetchurl {
+      url = "${mirror}/stable/frameworks/5.58/kinit-5.58.0.tar.xz";
+      sha256 = "22c2adb9b1b52d0f90db9c36bd0313250d986a207f781c0582e85c4805297e53";
+      name = "kinit-5.58.0.tar.xz";
+    };
+  };
+  kio = {
+    version = "5.58.0";
+    src = fetchurl {
+      url = "${mirror}/stable/frameworks/5.58/kio-5.58.0.tar.xz";
+      sha256 = "14c74959824a288d7fae17acbd2786eee1f0a2545cb9bf39c43bbd862ec55069";
+      name = "kio-5.58.0.tar.xz";
+    };
+  };
+  kirigami2 = {
+    version = "5.58.0";
+    src = fetchurl {
+      url = "${mirror}/stable/frameworks/5.58/kirigami2-5.58.0.tar.xz";
+      sha256 = "ad54e15c03807181313e29013057cf89cb70113f74a26ab7aec6420cdc18d9b3";
+      name = "kirigami2-5.58.0.tar.xz";
+    };
+  };
+  kitemmodels = {
+    version = "5.58.0";
+    src = fetchurl {
+      url = "${mirror}/stable/frameworks/5.58/kitemmodels-5.58.0.tar.xz";
+      sha256 = "f861844a6d24ecdddd7b2b29d47dc03bccbd5dc2c8053f5c3a839a5ff59cd491";
+      name = "kitemmodels-5.58.0.tar.xz";
+    };
+  };
+  kitemviews = {
+    version = "5.58.0";
+    src = fetchurl {
+      url = "${mirror}/stable/frameworks/5.58/kitemviews-5.58.0.tar.xz";
+      sha256 = "bb073f96236102a953a2298039d0c380458c0a2393d7dc7bb657ee4e2ea9b6e6";
+      name = "kitemviews-5.58.0.tar.xz";
+    };
+  };
+  kjobwidgets = {
+    version = "5.58.0";
+    src = fetchurl {
+      url = "${mirror}/stable/frameworks/5.58/kjobwidgets-5.58.0.tar.xz";
+      sha256 = "d43ea4eede2d88edd1753f4d1b6808bf04bf1e67ab58f00ef70b6a20b9607133";
+      name = "kjobwidgets-5.58.0.tar.xz";
+    };
+  };
+  kjs = {
+    version = "5.58.0";
+    src = fetchurl {
+      url = "${mirror}/stable/frameworks/5.58/portingAids/kjs-5.58.0.tar.xz";
+      sha256 = "9e95cb54f4323f31f88e3fb5946b4f990d8a5f1ba8fecf166844af672037a60c";
+      name = "kjs-5.58.0.tar.xz";
+    };
+  };
+  kjsembed = {
+    version = "5.58.0";
+    src = fetchurl {
+      url = "${mirror}/stable/frameworks/5.58/portingAids/kjsembed-5.58.0.tar.xz";
+      sha256 = "ffbcd9de767d62497db146acd7bcaeaa59b3f6b418616d4562d1a2269048131d";
+      name = "kjsembed-5.58.0.tar.xz";
+    };
+  };
+  kmediaplayer = {
+    version = "5.58.0";
+    src = fetchurl {
+      url = "${mirror}/stable/frameworks/5.58/portingAids/kmediaplayer-5.58.0.tar.xz";
+      sha256 = "1cc831eae5f0e71375118c01b72e7961d42888fca0726800ce8c42bf4e1f21ea";
+      name = "kmediaplayer-5.58.0.tar.xz";
+    };
+  };
+  knewstuff = {
+    version = "5.58.0";
+    src = fetchurl {
+      url = "${mirror}/stable/frameworks/5.58/knewstuff-5.58.0.tar.xz";
+      sha256 = "06d3ee09652f166ad66e003523bafe43741a99d2cd5dca3268ac7a13498cefbd";
+      name = "knewstuff-5.58.0.tar.xz";
+    };
+  };
+  knotifications = {
+    version = "5.58.0";
+    src = fetchurl {
+      url = "${mirror}/stable/frameworks/5.58/knotifications-5.58.0.tar.xz";
+      sha256 = "5a388e05ae3416a5120c268e48fa505e6666403772e8f03fe4670ab1d0bb0469";
+      name = "knotifications-5.58.0.tar.xz";
+    };
+  };
+  knotifyconfig = {
+    version = "5.58.0";
+    src = fetchurl {
+      url = "${mirror}/stable/frameworks/5.58/knotifyconfig-5.58.0.tar.xz";
+      sha256 = "a40555d9645c4ed283e61a9e5718d5476359124e23d52a838e30fca7e089dc01";
+      name = "knotifyconfig-5.58.0.tar.xz";
+    };
+  };
+  kpackage = {
+    version = "5.58.0";
+    src = fetchurl {
+      url = "${mirror}/stable/frameworks/5.58/kpackage-5.58.0.tar.xz";
+      sha256 = "41deff40eb17b3f667fd03f4a30dcf734ca060ebd7e2320eb38ff36ed6a9ce90";
+      name = "kpackage-5.58.0.tar.xz";
+    };
+  };
+  kparts = {
+    version = "5.58.0";
+    src = fetchurl {
+      url = "${mirror}/stable/frameworks/5.58/kparts-5.58.0.tar.xz";
+      sha256 = "6fe1ca552f14dd262cf33e60d0c85536ca04617757e39f91dbfe061abf624bb4";
+      name = "kparts-5.58.0.tar.xz";
+    };
+  };
+  kpeople = {
+    version = "5.58.0";
+    src = fetchurl {
+      url = "${mirror}/stable/frameworks/5.58/kpeople-5.58.0.tar.xz";
+      sha256 = "2588f7a4df4c03fe756d9e766120e35b0f991df5c8e5f75c3a507cc5739ded32";
+      name = "kpeople-5.58.0.tar.xz";
+    };
+  };
+  kplotting = {
+    version = "5.58.0";
+    src = fetchurl {
+      url = "${mirror}/stable/frameworks/5.58/kplotting-5.58.0.tar.xz";
+      sha256 = "4d46b4c78abcaf171132f4a17f35d28f7bd89b346fbe7b2e494f5212ee2cc81b";
+      name = "kplotting-5.58.0.tar.xz";
+    };
+  };
+  kpty = {
+    version = "5.58.0";
+    src = fetchurl {
+      url = "${mirror}/stable/frameworks/5.58/kpty-5.58.0.tar.xz";
+      sha256 = "808a9f159e3d34630ae16d13c3ed6310c07fc9a38737110190892dcc903d5017";
+      name = "kpty-5.58.0.tar.xz";
+    };
+  };
+  kross = {
+    version = "5.58.0";
+    src = fetchurl {
+      url = "${mirror}/stable/frameworks/5.58/portingAids/kross-5.58.0.tar.xz";
+      sha256 = "b71c521718acd9829124264e97990222c458eca4a2e0be471a853db55b07d872";
+      name = "kross-5.58.0.tar.xz";
+    };
+  };
+  krunner = {
+    version = "5.58.0";
+    src = fetchurl {
+      url = "${mirror}/stable/frameworks/5.58/krunner-5.58.0.tar.xz";
+      sha256 = "d83220210980117459e49a44b2173063faa70ea5524c744cde4ca3dc031a6c8c";
+      name = "krunner-5.58.0.tar.xz";
+    };
+  };
+  kservice = {
+    version = "5.58.0";
+    src = fetchurl {
+      url = "${mirror}/stable/frameworks/5.58/kservice-5.58.0.tar.xz";
+      sha256 = "03e1d69b1558c4d38946e1ffdec4249e58d8a0f15575ce984c751d93b3ff1395";
+      name = "kservice-5.58.0.tar.xz";
+    };
+  };
+  ktexteditor = {
+    version = "5.58.0";
+    src = fetchurl {
+      url = "${mirror}/stable/frameworks/5.58/ktexteditor-5.58.0.tar.xz";
+      sha256 = "dc28916db7eb8a24f89b6570358d576b73e1ca60f7364871a0ef67f9fd62db8e";
+      name = "ktexteditor-5.58.0.tar.xz";
+    };
+  };
+  ktextwidgets = {
+    version = "5.58.0";
+    src = fetchurl {
+      url = "${mirror}/stable/frameworks/5.58/ktextwidgets-5.58.0.tar.xz";
+      sha256 = "056601d7c1aa412a9628fae8eb6ca6cf51d0f0fab03345bb4be8e7072827fed7";
+      name = "ktextwidgets-5.58.0.tar.xz";
+    };
+  };
+  kunitconversion = {
+    version = "5.58.0";
+    src = fetchurl {
+      url = "${mirror}/stable/frameworks/5.58/kunitconversion-5.58.0.tar.xz";
+      sha256 = "5716474c4d031d9b5fdb3fe460957d4ceecd1d9c4e441df81a42bfbb993232fa";
+      name = "kunitconversion-5.58.0.tar.xz";
+    };
+  };
+  kwallet = {
+    version = "5.58.0";
+    src = fetchurl {
+      url = "${mirror}/stable/frameworks/5.58/kwallet-5.58.0.tar.xz";
+      sha256 = "5203765ba2061727d0280bf7e9cbbade462ba2c5e7389f4f8d78afc522ba2030";
+      name = "kwallet-5.58.0.tar.xz";
+    };
+  };
+  kwayland = {
+    version = "5.58.0";
+    src = fetchurl {
+      url = "${mirror}/stable/frameworks/5.58/kwayland-5.58.0.tar.xz";
+      sha256 = "a273a64ac06698e7c7d297da05c3b4889893c8b4179b01aa7ae1c2fb8681a4f1";
+      name = "kwayland-5.58.0.tar.xz";
+    };
+  };
+  kwidgetsaddons = {
+    version = "5.58.0";
+    src = fetchurl {
+      url = "${mirror}/stable/frameworks/5.58/kwidgetsaddons-5.58.0.tar.xz";
+      sha256 = "f4bcb1e22d8dfec214f4f55dbf4492229c4cb6ab63031f826ef68896c27ca6c0";
+      name = "kwidgetsaddons-5.58.0.tar.xz";
+    };
+  };
+  kwindowsystem = {
+    version = "5.58.0";
+    src = fetchurl {
+      url = "${mirror}/stable/frameworks/5.58/kwindowsystem-5.58.0.tar.xz";
+      sha256 = "0b25d55bc9be6329c5cf91328c4414b547f26496a1af83f9454c0e5d85a10129";
+      name = "kwindowsystem-5.58.0.tar.xz";
+    };
+  };
+  kxmlgui = {
+    version = "5.58.0";
+    src = fetchurl {
+      url = "${mirror}/stable/frameworks/5.58/kxmlgui-5.58.0.tar.xz";
+      sha256 = "ab08ed118f6806154fe10414d81dace413ecf80df3a561811f41879b48b7179f";
+      name = "kxmlgui-5.58.0.tar.xz";
+    };
+  };
+  kxmlrpcclient = {
+    version = "5.58.0";
+    src = fetchurl {
+      url = "${mirror}/stable/frameworks/5.58/kxmlrpcclient-5.58.0.tar.xz";
+      sha256 = "53f647bb8d9165ddf6326703486470c7e9fc4ef392991501319e5c69f25f0ea3";
+      name = "kxmlrpcclient-5.58.0.tar.xz";
+    };
+  };
+  modemmanager-qt = {
+    version = "5.58.0";
+    src = fetchurl {
+      url = "${mirror}/stable/frameworks/5.58/modemmanager-qt-5.58.0.tar.xz";
+      sha256 = "cec892b58603fd95656b2cac356e8076a65122d110e3f5175bbabfaa296b16cb";
+      name = "modemmanager-qt-5.58.0.tar.xz";
+    };
+  };
+  networkmanager-qt = {
+    version = "5.58.0";
+    src = fetchurl {
+      url = "${mirror}/stable/frameworks/5.58/networkmanager-qt-5.58.0.tar.xz";
+      sha256 = "113f48b1ed07b7541bc205220197e245f547e0a08382c3aeb29b0c02e6ec4abe";
+      name = "networkmanager-qt-5.58.0.tar.xz";
+    };
+  };
+  oxygen-icons5 = {
+    version = "5.58.0";
+    src = fetchurl {
+      url = "${mirror}/stable/frameworks/5.58/oxygen-icons5-5.58.0.tar.xz";
+      sha256 = "0e6a6fd611893c870901b78f601caf8ae9afd2a666088a5a167f3cbf815bd3e7";
+      name = "oxygen-icons5-5.58.0.tar.xz";
+    };
+  };
+  plasma-framework = {
+    version = "5.58.0";
+    src = fetchurl {
+      url = "${mirror}/stable/frameworks/5.58/plasma-framework-5.58.0.tar.xz";
+      sha256 = "0b0826a2292612112e78198938d660e913756f8712d1f2c71eafbead42605cad";
+      name = "plasma-framework-5.58.0.tar.xz";
+    };
+  };
+  prison = {
+    version = "5.58.0";
+    src = fetchurl {
+      url = "${mirror}/stable/frameworks/5.58/prison-5.58.0.tar.xz";
+      sha256 = "2bd97bf19e70b67cac49eaefb89a0fe8bd506e710e10df41f9b7c65d9dc30b1d";
+      name = "prison-5.58.0.tar.xz";
+    };
+  };
+  purpose = {
+    version = "5.58.0";
+    src = fetchurl {
+      url = "${mirror}/stable/frameworks/5.58/purpose-5.58.0.tar.xz";
+      sha256 = "8acbf11af0d9f149ca52c15d07a62107d83b02306102af9e37ee32aeaef831df";
+      name = "purpose-5.58.0.tar.xz";
+    };
+  };
+  qqc2-desktop-style = {
+    version = "5.58.0";
+    src = fetchurl {
+      url = "${mirror}/stable/frameworks/5.58/qqc2-desktop-style-5.58.0.tar.xz";
+      sha256 = "71b2c94aece8c0f4cda33170a84240d1f7ed9ec774dcf5bd292bda861bda46a3";
+      name = "qqc2-desktop-style-5.58.0.tar.xz";
+    };
+  };
+  solid = {
+    version = "5.58.0";
+    src = fetchurl {
+      url = "${mirror}/stable/frameworks/5.58/solid-5.58.0.tar.xz";
+      sha256 = "7d7f2daaffe8536ee9373375b866c94b949e58f0365990dfe16f9cc05f98bd00";
+      name = "solid-5.58.0.tar.xz";
+    };
+  };
+  sonnet = {
+    version = "5.58.0";
+    src = fetchurl {
+      url = "${mirror}/stable/frameworks/5.58/sonnet-5.58.0.tar.xz";
+      sha256 = "e67ffab7674175588883a9b444973e9edef2257e025f99657bb13d09e72bf823";
+      name = "sonnet-5.58.0.tar.xz";
+    };
+  };
+  syndication = {
+    version = "5.58.0";
+    src = fetchurl {
+      url = "${mirror}/stable/frameworks/5.58/syndication-5.58.0.tar.xz";
+      sha256 = "48d321fdefd57ef9380492652c765ded047d4a54ba6aed5abb1434e30e327643";
+      name = "syndication-5.58.0.tar.xz";
+    };
+  };
+  syntax-highlighting = {
+    version = "5.58.0";
+    src = fetchurl {
+      url = "${mirror}/stable/frameworks/5.58/syntax-highlighting-5.58.0.tar.xz";
+      sha256 = "b97e58e9fe64bc21368d18c57b69dd5696328a0722c01ae2e113826e2e35ba76";
+      name = "syntax-highlighting-5.58.0.tar.xz";
+    };
+  };
+  threadweaver = {
+    version = "5.58.0";
+    src = fetchurl {
+      url = "${mirror}/stable/frameworks/5.58/threadweaver-5.58.0.tar.xz";
+      sha256 = "d9f95ed3a5ccedaa10ae086c82d8794a9ae9e82e094c352869bc6459ead8409d";
+      name = "threadweaver-5.58.0.tar.xz";
+    };
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/syndication.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/syndication.nix
new file mode 100644
index 000000000000..71ee520995c4
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/syndication.nix
@@ -0,0 +1,13 @@
+{ mkDerivation, lib
+, extra-cmake-modules
+, kcodecs
+}:
+
+mkDerivation {
+  name = "syndication";
+  meta = {
+    maintainers = [ lib.maintainers.bkchr ];
+  };
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [ kcodecs ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/syntax-highlighting.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/syntax-highlighting.nix
new file mode 100644
index 000000000000..ceb8200d4c63
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/syntax-highlighting.nix
@@ -0,0 +1,14 @@
+{ mkDerivation, lib
+, extra-cmake-modules, perl, qtbase, qttools
+}:
+
+mkDerivation {
+  name = "syntax-highlighting";
+  meta = {
+    maintainers = [ lib.maintainers.ttuegel ];
+    broken = builtins.compareVersions qtbase.version "5.7.0" < 0;
+  };
+  nativeBuildInputs = [ extra-cmake-modules perl ];
+  buildInputs = [ qttools ];
+  propagatedBuildInputs = [ qtbase ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/threadweaver.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/threadweaver.nix
new file mode 100644
index 000000000000..b95f70dd6743
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/threadweaver.nix
@@ -0,0 +1,16 @@
+{
+  mkDerivation, lib,
+  extra-cmake-modules,
+  qtbase
+}:
+
+mkDerivation {
+  name = "threadweaver";
+  meta = {
+    maintainers = [ lib.maintainers.ttuegel ];
+    broken = builtins.compareVersions qtbase.version "5.7.0" < 0;
+  };
+  nativeBuildInputs = [ extra-cmake-modules ];
+  propagatedBuildInputs = [ qtbase ];
+  outputs = [ "out" "dev" ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/kdiagram/default.nix b/nixpkgs/pkgs/development/libraries/kdiagram/default.nix
new file mode 100644
index 000000000000..50f3e6a6c025
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kdiagram/default.nix
@@ -0,0 +1,21 @@
+{
+  mkDerivation, fetchurl, lib,
+  extra-cmake-modules, qttools,
+  qtbase, qtsvg,
+}:
+
+mkDerivation {
+  name = "kdiagram-2.6.0";
+  src = fetchurl {
+    url = "https://download.kde.org/stable/kdiagram/2.6.0/src/kdiagram-2.6.0.tar.xz";
+    sha256 = "10hqk12wwgbiq4q5145s8v7v96j621ckq1yil9s4pihmgsnqsy02";
+  };
+  nativeBuildInputs = [ extra-cmake-modules qttools ];
+  propagatedBuildInputs = [ qtbase qtsvg ];
+  meta = {
+    description = "Libraries for creating business diagrams";
+    license = lib.licenses.gpl2;
+    platforms = qtbase.meta.platforms;
+    maintainers = [ lib.maintainers.ttuegel ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/kerberos/heimdal-make-missing-headers.patch b/nixpkgs/pkgs/development/libraries/kerberos/heimdal-make-missing-headers.patch
new file mode 100644
index 000000000000..a0fa625538b7
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kerberos/heimdal-make-missing-headers.patch
@@ -0,0 +1,10 @@
+--- a/lib/hx509/Makefile.am 2018-03-21 15:41:38.622968809 +0100
++++ b/lib/hx509/Makefile.am 2018-03-21 15:41:32.655162197 +0100
+@@ -9,6 +9,8 @@
+	sel-gram.h			\
+	$(gen_files_ocsp:.x=.c)		\
+	$(gen_files_pkcs10:.x=.c)	\
++	ocsp_asn1.h			\
++	pkcs10_asn1.h			\
+	hx509_err.c			\
+	hx509_err.h
diff --git a/nixpkgs/pkgs/development/libraries/kerberos/heimdal.nix b/nixpkgs/pkgs/development/libraries/kerberos/heimdal.nix
new file mode 100644
index 000000000000..197911be0d41
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kerberos/heimdal.nix
@@ -0,0 +1,98 @@
+{ stdenv, fetchFromGitHub, autoreconfHook, pkgconfig, python2, perl, yacc, flex
+, texinfo, perlPackages
+, openldap, libcap_ng, sqlite, openssl, db, libedit, pam
+, CoreFoundation, Security, SystemConfiguration
+}:
+
+with stdenv.lib;
+stdenv.mkDerivation rec {
+  name = "heimdal-${version}";
+  version = "7.6.0";
+
+  src = fetchFromGitHub {
+    owner = "heimdal";
+    repo = "heimdal";
+    rev = "heimdal-${version}";
+    sha256 = "1i70xas6wddkw2840lk0ah9w6ddx0dzrslby1ggxlwfmcax8rcgp";
+  };
+
+  outputs = [ "out" "dev" "man" "info" ];
+
+  patches = [ ./heimdal-make-missing-headers.patch ];
+
+  nativeBuildInputs = [ autoreconfHook pkgconfig python2 perl yacc flex texinfo ]
+    ++ (with perlPackages; [ JSON ]);
+  buildInputs = optionals (stdenv.isLinux) [ libcap_ng ]
+    ++ [ db sqlite openssl libedit openldap pam]
+    ++ optionals (stdenv.isDarwin) [ CoreFoundation Security SystemConfiguration ];
+
+  ## ugly, X should be made an option
+  configureFlags = [
+    "--sysconfdir=/etc"
+    "--localstatedir=/var"
+    "--infodir=$info/share/info"
+    "--enable-hdb-openldap-module"
+    "--with-sqlite3=${sqlite.dev}"
+
+  # ugly, --with-libedit is not enought, it fall back to bundled libedit
+    "--with-libedit-include=${libedit.dev}/include"
+    "--with-libedit-lib=${libedit}/lib"
+    "--with-openssl=${openssl.dev}"
+    "--without-x"
+    "--with-berkeley-db"
+    "--with-berkeley-db-include=${db.dev}/include"
+    "--with-openldap=${openldap.dev}"
+  ] ++ optionals (stdenv.isLinux) [
+    "--with-capng"
+  ];
+
+  postUnpack = ''
+    sed -i '/^DEFAULT_INCLUDES/ s,$, -I..,' source/cf/Makefile.am.common
+    sed -i -e 's/date/date --date="@$SOURCE_DATE_EPOCH"/' source/configure.ac
+  '';
+
+  preConfigure = ''
+    configureFlagsArray+=(
+      "--bindir=$out/bin"
+      "--sbindir=$out/sbin"
+      "--libexecdir=$out/libexec/heimdal"
+      "--mandir=$man/share/man"
+      "--infodir=$man/share/info"
+      "--includedir=$dev/include")
+  '';
+
+  # We need to build hcrypt for applications like samba
+  postBuild = ''
+    (cd include/hcrypto; make -j $NIX_BUILD_CORES)
+    (cd lib/hcrypto; make -j $NIX_BUILD_CORES)
+  '';
+
+  postInstall = ''
+    # Install hcrypto
+    (cd include/hcrypto; make -j $NIX_BUILD_CORES install)
+    (cd lib/hcrypto; make -j $NIX_BUILD_CORES install)
+
+    # Do we need it?
+    rm $out/bin/su
+
+    mkdir -p $dev/bin
+    mv $out/bin/krb5-config $dev/bin/
+
+    # asn1 compilers, move them to $dev
+    mv $out/libexec/heimdal/heimdal/* $dev/bin
+    rmdir $out/libexec/heimdal/heimdal
+  '';
+
+  # Issues with hydra
+  #  In file included from hxtool.c:34:0:
+  #  hx_locl.h:67:25: fatal error: pkcs10_asn1.h: No such file or directory
+  #enableParallelBuilding = true;
+
+  meta = {
+    description = "An implementation of Kerberos 5 (and some more stuff)";
+    license = licenses.bsd3;
+    platforms = platforms.unix;
+  };
+
+  passthru.implementation = "heimdal";
+}
diff --git a/nixpkgs/pkgs/development/libraries/kerberos/krb5.nix b/nixpkgs/pkgs/development/libraries/kerberos/krb5.nix
new file mode 100644
index 000000000000..208f294aef7e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kerberos/krb5.nix
@@ -0,0 +1,83 @@
+{ stdenv, fetchurl, pkgconfig, perl, yacc, bootstrap_cmds
+, openssl, openldap, libedit, keyutils
+
+# Extra Arguments
+, type ? ""
+# This is called "staticOnly" because krb5 does not support
+# builting both static and shared, see below.
+, staticOnly ? false
+}:
+
+let
+  libOnly = type == "lib";
+in
+with stdenv.lib;
+stdenv.mkDerivation rec {
+  name = "${type}krb5-${version}";
+  majorVersion = "1.17";
+  version = "${majorVersion}";
+
+  src = fetchurl {
+    url = "https://kerberos.org/dist/krb5/${majorVersion}/krb5-${version}.tar.gz";
+    sha256 = "1xc1ly09697b7g2vngvx76szjqy9769kpgn27lnp1r9xln224vjs";
+  };
+
+  outputs = [ "out" "dev" ];
+
+  configureFlags = [ "--with-tcl=no" "--localstatedir=/var/lib"]
+    # krb5's ./configure does not allow passing --enable-shared and --enable-static at the same time.
+    # See https://bbs.archlinux.org/viewtopic.php?pid=1576737#p1576737
+    ++ optional staticOnly [ "--enable-static" "--disable-shared" ]
+    ++ optional stdenv.isFreeBSD ''WARN_CFLAGS=""''
+    ++ optionals (stdenv.buildPlatform != stdenv.hostPlatform)
+       [ "krb5_cv_attr_constructor_destructor=yes,yes"
+         "ac_cv_func_regcomp=yes"
+         "ac_cv_printf_positional=yes"
+       ];
+
+  nativeBuildInputs = [ pkgconfig perl ]
+    ++ optional (!libOnly) yacc
+    # Provides the mig command used by the build scripts
+    ++ optional stdenv.isDarwin bootstrap_cmds;
+
+  buildInputs = [ openssl ]
+    ++ optionals (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.libc != "bionic" && !(stdenv.hostPlatform.useLLVM or false)) [ keyutils ]
+    ++ optionals (!libOnly) [ openldap libedit ];
+
+  preConfigure = "cd ./src";
+
+  buildPhase = optionalString libOnly ''
+    MAKE="make -j $NIX_BUILD_CORES -l $NIX_BUILD_CORES"
+    (cd util; $MAKE)
+    (cd include; $MAKE)
+    (cd lib; $MAKE)
+    (cd build-tools; $MAKE)
+  '';
+
+  installPhase = optionalString libOnly ''
+    mkdir -p "$out"/{bin,sbin,lib/pkgconfig,share/{et,man/man1}} \
+      "$dev"/include/{gssapi,gssrpc,kadm5,krb5}
+    (cd util; $MAKE install)
+    (cd include; $MAKE install)
+    (cd lib; $MAKE install)
+    (cd build-tools; $MAKE install)
+    ${postInstall}
+  '';
+
+  # not via outputBin, due to reference from libkrb5.so
+  postInstall = ''
+    moveToOutput bin/krb5-config "$dev"
+  '';
+
+  enableParallelBuilding = true;
+  doCheck = false; # fails with "No suitable file for testing purposes"
+
+  meta = {
+    description = "MIT Kerberos 5";
+    homepage = http://web.mit.edu/kerberos/;
+    license = licenses.mit;
+    platforms = platforms.unix ++ platforms.windows;
+  };
+
+  passthru.implementation = "krb5";
+}
diff --git a/nixpkgs/pkgs/development/libraries/keybinder/default.nix b/nixpkgs/pkgs/development/libraries/keybinder/default.nix
new file mode 100644
index 000000000000..abbb2457f6ae
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/keybinder/default.nix
@@ -0,0 +1,46 @@
+{ stdenv, fetchurl, autoconf, automake, libtool, pkgconfig, gnome3
+, gtk-doc, gtk2, python2Packages, lua, gobject-introspection
+}:
+
+let
+  inherit (python2Packages) python pygtk;
+in stdenv.mkDerivation rec {
+  name = "keybinder-${version}";
+  version = "0.3.0";
+
+  src = fetchurl {
+    name = "${name}.tar.gz";
+    url = "https://github.com/engla/keybinder/archive/v${version}.tar.gz";
+    sha256 = "0kkplz5snycik5xknwq1s8rnmls3qsp32z09mdpmaacydcw7g3cf";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [
+    autoconf automake libtool gnome3.gnome-common gtk-doc gtk2
+    python pygtk lua gobject-introspection
+  ];
+
+  preConfigure = ''
+    ./autogen.sh --prefix="$out"
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Library for registering global key bindings";
+    longDescription = ''
+      keybinder is a library for registering global keyboard shortcuts.
+      Keybinder works with GTK-based applications using the X Window System.
+
+      The library contains:
+
+      * A C library, ``libkeybinder``
+      * Gobject-Introspection (gir)  generated bindings
+      * Lua bindings, ``lua-keybinder``
+      * Python bindings, ``python-keybinder``
+      * An ``examples`` directory with programs in C, Lua, Python and Vala.
+    '';
+    homepage = https://github.com/engla/keybinder/;
+    license = licenses.gpl2Plus;
+    platforms = platforms.linux;
+    maintainers = [ maintainers.bjornfor ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/keybinder3/default.nix b/nixpkgs/pkgs/development/libraries/keybinder3/default.nix
new file mode 100644
index 000000000000..91ad59ad27a0
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/keybinder3/default.nix
@@ -0,0 +1,33 @@
+{ stdenv, fetchFromGitHub, autoconf, automake, libtool, pkgconfig, gnome3
+, gtk-doc, gtk3, libX11, libXext, libXrender, gobject-introspection
+}:
+
+stdenv.mkDerivation rec {
+  name = "keybinder3-${version}";
+  version = "0.3.2";
+
+  src = fetchFromGitHub {
+    owner = "kupferlauncher";
+    repo = "keybinder";
+    rev = "keybinder-3.0-v${version}";
+    sha256 = "196ibn86j54fywfwwgyh89i9wygm4vh7ls19fn20vrnm6ijlzh9r";
+  };
+
+  nativeBuildInputs = [ autoconf automake libtool pkgconfig ];
+  buildInputs = [
+    gnome3.gnome-common gtk-doc gtk3
+    libX11 libXext libXrender gobject-introspection
+  ];
+
+  preConfigure = ''
+    ./autogen.sh --prefix="$out"
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Library for registering global key bindings";
+    homepage = https://github.com/kupferlauncher/keybinder/;
+    license = licenses.mit;
+    platforms = platforms.linux;
+    maintainers = [ maintainers.cstrahan ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/kinetic-cpp-client/build-fix.patch b/nixpkgs/pkgs/development/libraries/kinetic-cpp-client/build-fix.patch
new file mode 100644
index 000000000000..49edbf63a546
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kinetic-cpp-client/build-fix.patch
@@ -0,0 +1,224 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 8217cba..a6c1d70 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -32,7 +32,7 @@ else(APPLE)
+   endif(${BUILD_FOR_ARM})
+ endif(APPLE)
+ 
+-set(CMAKE_CXX_FLAGS "--std=c++0x -Wall -Wextra -Werror -Wno-unknown-warning-option -Wno-unused-parameter -Wno-null-dereference -Wno-unused-local-typedefs -DGTEST_USE_OWN_TR1_TUPLE=1 ${BUILD_PIC_COMPILER_FLAGS}")
++set(CMAKE_CXX_FLAGS "--std=c++11 -DGTEST_USE_OWN_TR1_TUPLE=1 ${BUILD_PIC_COMPILER_FLAGS}")
+ 
+ set(TEST_BINARY "kinetic_client_test")
+ set(TEST_BINARY_PATH ${kinetic_cpp_client_BINARY_DIR}/${TEST_BINARY})
+@@ -50,103 +50,16 @@ set(GENERATED_SOURCES_PATH ${kinetic_cpp_client_SOURCE_DIR}/src/main/generated)
+ set(PREFIX "${CMAKE_BINARY_DIR}/vendor")
+ set(EXTERNAL_PREFIX "${kinetic_cpp_client_BINARY_DIR}/vendor")
+ 
+-include(ExternalProject)
+-
+-set(KINETIC_PROTO_VERSION "3.0.0")
+-set(KINETIC_PROTO_MD5 "85ca027b870811a297c1f6d792498934")
+-
+-ExternalProject_add(
+-    kinetic-proto
+-    PREFIX ${PREFIX}
+-    DOWNLOAD_COMMAND curl -L https://github.com/Seagate/kinetic-protocol/archive/${KINETIC_PROTO_VERSION}.tar.gz -o kinetic-proto.tar.gz && openssl md5 kinetic-proto.tar.gz | grep -q ${KINETIC_PROTO_MD5} && rm -rf kinetic-proto && mkdir -p kinetic-proto && tar -xz --strip-components 1 -C kinetic-proto -f kinetic-proto.tar.gz
+-    BUILD_IN_SOURCE 1
+-    CONFIGURE_COMMAND ""
+-    BUILD_COMMAND ""
+-    INSTALL_COMMAND ""
+-)
+-
+-ExternalProject_add(
+-    gflags
+-    PREFIX ${EXTERNAL_PREFIX}
+-    URL "${kinetic_cpp_client_SOURCE_DIR}/tarballs/gflags-2.0-no-svn-files.tar.gz"
+-    URL_MD5 "9084829124e02a7e6be0f0f824523423"
+-    CONFIGURE_COMMAND ../gflags/configure --prefix=${EXTERNAL_PREFIX} --enable-static ${CONFIG_HOST_FLAG} ${CHILD_MAKE_FLAGS} ${PIC_MAKE_FLAGS}
+-)
+-
+-ExternalProject_add(
+-    glog
+-    PREFIX ${EXTERNAL_PREFIX}
+-    URL "${kinetic_cpp_client_SOURCE_DIR}/tarballs/glog-0.3.3.tar.gz"
+-    URL_MD5 "a6fd2c22f8996846e34c763422717c18"
+-    PATCH_COMMAND sh ${kinetic_cpp_client_SOURCE_DIR}/patches/apply-glog-patches.sh ${kinetic_cpp_client_SOURCE_DIR}
+-    CONFIGURE_COMMAND ../glog/configure --prefix=${EXTERNAL_PREFIX} --with-gflags=${EXTERNAL_PREFIX} --enable-static ${CONFIG_HOST_FLAG} ${CHILD_MAKE_FLAGS} ${PIC_MAKE_FLAGS}
+-    DEPENDS gflags
+-)
+-
+-ExternalProject_add(
+-    gtest
+-    PREFIX ${EXTERNAL_PREFIX}
+-    URL "${kinetic_cpp_client_SOURCE_DIR}/tarballs/gtest-1.6.0.zip"
+-    URL_MD5 "4577b49f2973c90bf9ba69aa8166b786"
+-    BUILD_IN_SOURCE 1
+-    CONFIGURE_COMMAND ""
+-    BUILD_COMMAND ${CMAKE_CXX_COMPILER} -DGTEST_USE_OWN_TR1_TUPLE=1 -I../gtest -I../gtest/include -c ../gtest/src/gtest-all.cc && ar -rv libgtest.a gtest-all.o && ranlib libgtest.a
+-    INSTALL_COMMAND ""
+-)
+-
+-ExternalProject_add(
+-    gmock
+-    PREFIX ${EXTERNAL_PREFIX}
+-    URL "${kinetic_cpp_client_SOURCE_DIR}/tarballs/gmock-1.6.0.zip"
+-    URL_MD5 "f547f47321ca88d3965ca2efdcc2a3c1"
+-    BUILD_IN_SOURCE 1
+-    CONFIGURE_COMMAND ""
+-    BUILD_COMMAND ${CMAKE_CXX_COMPILER} -DGTEST_USE_OWN_TR1_TUPLE=1 -I../gmock -I../gmock/include -I../gtest -I../gtest/include -c ../gmock/src/gmock-all.cc && ar -rv libgmock.a gmock-all.o && ranlib libgmock.a
+-    INSTALL_COMMAND ""
+-    DEPENDS gtest
+-)
+-
+-ExternalProject_add(
+-    openssl
+-    PREFIX ${EXTERNAL_PREFIX}
+-    URL "${kinetic_cpp_client_SOURCE_DIR}/tarballs/openssl-1.0.1g.tar.gz"
+-    URL_MD5 "de62b43dfcd858e66a74bee1c834e959"
+-    BUILD_IN_SOURCE 1
+-    CONFIGURE_COMMAND ${OPENSSL_CONFIGURE_COMMAND} --prefix=${EXTERNAL_PREFIX} ${BUILD_PIC_COMPILER_FLAG}
+-    BUILD_COMMAND touch apps/openssl && touch openssl.pc && make ${CHILD_MAKE_FLAGS} build_libs libssl.pc libcrypto.pc
+-    INSTALL_COMMAND make install_sw
+-)
+-
+-# The protobuf build requires the existence of a protoc binary that can be
+-# executed on the host machine. To handle cross compilation, we always build
+-# protobuf once for the host so that we have a suitable copy of protoc.
+-ExternalProject_add(
+-    protoc
+-    PREFIX ${EXTERNAL_PREFIX}/host
+-    URL "${kinetic_cpp_client_SOURCE_DIR}/tarballs/protobuf-2.5.0.tar.bz2"
+-    URL_MD5 "a72001a9067a4c2c4e0e836d0f92ece4"
+-    CONFIGURE_COMMAND ../protoc/configure --prefix=${EXTERNAL_PREFIX}/host --enable-static
+-)
+-
+ # Protobuf code generation rules
+-set(PROTOC_PATH "${PREFIX}/host/bin/protoc")
+-set(PROTO_DIR "${CMAKE_BINARY_DIR}/vendor/src/kinetic-proto")
++set(PROTOC_PATH "protoc")
++set(PROTO_DIR "${CMAKE_BINARY_DIR}/kinetic-proto")
+ set(PROTO_ORIG_PATH "${PROTO_DIR}/kinetic.proto")
+ set(PROTO_MODIFIED_PATH "${PROTO_DIR}/kinetic_client.proto")
+-ExternalProject_add(
+-    protobuf
+-    PREFIX ${EXTERNAL_PREFIX}
+-    URL "${kinetic_cpp_client_SOURCE_DIR}/tarballs/protobuf-2.5.0.tar.bz2"
+-    URL_MD5 "a72001a9067a4c2c4e0e836d0f92ece4"
+-    CONFIGURE_COMMAND ../protobuf/configure --prefix=${EXTERNAL_PREFIX} --enable-static --with-protoc=${PROTOC_PATH} ${CONFIG_HOST_FLAG} ${CHILD_MAKE_FLAGS} ${PIC_MAKE_FLAGS}
+-    DEPENDS protoc
+-)
+ 
+ add_custom_command(
+     COMMENT "Compiling protobuf"
+     OUTPUT ${GENERATED_SOURCES_PATH}/kinetic_client.pb.h ${GENERATED_SOURCES_PATH}/kinetic_client.pb.cc
+     COMMAND mkdir -p ${GENERATED_SOURCES_PATH} && sed 's/com\\.seagate\\.kinetic\\.proto/com.seagate.kinetic.client.proto/' ${PROTO_ORIG_PATH} > ${PROTO_MODIFIED_PATH} && ${PROTOC_PATH} -I=${PROTO_DIR} --cpp_out=${GENERATED_SOURCES_PATH} ${PROTO_MODIFIED_PATH}
+-    DEPENDS kinetic-proto protoc protobuf
+ )
+ set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES ${GENERATED_SOURCES_PATH})
+ 
+@@ -157,21 +70,10 @@ include_directories(
+ 
+     src/test/mock
+     src/test
+-
+-    ${EXTERNAL_PREFIX}/include
+-    ${EXTERNAL_PREFIX}/src/gmock/include
+-    ${EXTERNAL_PREFIX}/src/gtest/include
+ )
+ 
+ set(LIBRARY_DEPENDENCIES
+     kinetic_client
+-    ${CMAKE_BINARY_DIR}/vendor/lib/libglog.a
+-    ${CMAKE_BINARY_DIR}/vendor/lib/libgflags.a
+-    ${CMAKE_BINARY_DIR}/vendor/lib/libssl.a
+-    ${CMAKE_BINARY_DIR}/vendor/lib/libcrypto.a
+-    ${CMAKE_BINARY_DIR}/vendor/lib/libprotobuf.a
+-    ${CMAKE_BINARY_DIR}/vendor/src/gtest/libgtest.a
+-    ${CMAKE_BINARY_DIR}/vendor/src/gmock/libgmock.a
+     ${CMAKE_THREAD_LIBS_INIT}
+     dl
+ )
+@@ -180,12 +82,68 @@ set(LIBRARY_DEPENDENCIES
+ # Otherwise glog uses the standard glibc unwinder and there is no dependency.
+ find_library(LIBUNWIND "unwind")
+ if(LIBUNWIND)
+-    set(LIBRARY_DEPENDENCIES 
+-        ${LIBRARY_DEPENDENCIES} 
++    set(LIBRARY_DEPENDENCIES
++        ${LIBRARY_DEPENDENCIES}
+         ${LIBUNWIND}
+     )
+ endif()
+ 
++find_library(LIBSSL "ssl")
++if(LIBSSL)
++    set(LIBRARY_DEPENDENCIES
++        ${LIBRARY_DEPENDENCIES}
++		${LIBSSL}
++    )
++endif()
++
++find_library(LIBCRYPTO "crypto")
++if(LIBCRYPTO)
++    set(LIBRARY_DEPENDENCIES
++        ${LIBRARY_DEPENDENCIES}
++		${LIBCRYPTO}
++    )
++endif()
++
++find_library(LIBPROTOBUF "protobuf")
++if(LIBPROTOBUF)
++    set(LIBRARY_DEPENDENCIES
++        ${LIBRARY_DEPENDENCIES}
++		${LIBPROTOBUF}
++    )
++endif()
++
++find_library(LIBGLOG "glog")
++if(LIBGLOG)
++    set(LIBRARY_DEPENDENCIES
++        ${LIBRARY_DEPENDENCIES}
++		${LIBGLOG}
++    )
++endif()
++
++find_library(LIBGFLAGS "gflags")
++if(LIBGFLAGS)
++    set(LIBRARY_DEPENDENCIES
++        ${LIBRARY_DEPENDENCIES}
++		${LIBGFLAGS}
++    )
++endif()
++
++find_library(LIBGMOCK "gmock")
++if(LIBGMOCK)
++    set(LIBRARY_DEPENDENCIES
++        ${LIBRARY_DEPENDENCIES}
++		${LIBGMOCK}
++    )
++endif()
++
++find_library(LIBGTEST "gtest")
++if(LIBGTEST)
++    set(LIBRARY_DEPENDENCIES
++        ${LIBRARY_DEPENDENCIES}
++		${LIBGTEST}
++    )
++endif()
++
+ add_library(kinetic_client
+     src/main/generated/kinetic_client.pb.cc
+     src/main/hmac_provider.cc
+diff --git a/src/test/kinetic_cpp_client_test.cc b/src/test/kinetic_cpp_client_test.cc
+index 2079fab..c5004a2 100644
+--- a/src/test/kinetic_cpp_client_test.cc
++++ b/src/test/kinetic_cpp_client_test.cc
+@@ -22,6 +22,7 @@
+ 
+ #include <iostream>
+ 
++#include "gflags/gflags.h"
+ #include "gtest/gtest.h"
+ #include "glog/logging.h"
+ 
diff --git a/nixpkgs/pkgs/development/libraries/kinetic-cpp-client/default.nix b/nixpkgs/pkgs/development/libraries/kinetic-cpp-client/default.nix
new file mode 100644
index 000000000000..0fa46dde23e2
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kinetic-cpp-client/default.nix
@@ -0,0 +1,58 @@
+{ stdenv, fetchgit, fetchurl, cmake, protobuf, libunwind, openssl, glog
+, google-gflags, gmock, gtest
+}:
+
+let
+  protoTar = fetchurl {
+    url = "https://github.com/Seagate/kinetic-protocol/archive/3.0.0.tar.gz";
+    sha256 = "0406pp0sdf0rg6s5g18r2d8si2rin7p6qbzp7c6pma5hyzsygz48";
+  };
+in
+stdenv.mkDerivation rec {
+  name = "kinetic-cpp-client-2015-04-14";
+
+  src = fetchgit {
+    url = "git://github.com/Seagate/kinetic-cpp-client.git";
+    rev = "015085a5c89db0398f80923053f36b9e0611e107";
+    sha256 = "0gm34sl6lyidnxgg1lrhkxkxqj8z1y2cqn7zhzz2f1k50pigi5da";
+  };
+
+  patches = [ ./build-fix.patch ];
+
+  postPatch = ''
+    mkdir -p build/kinetic-proto
+    tar -x --strip-components 1 -C build/kinetic-proto -f ${protoTar}
+  '';
+
+  nativeBuildInputs = [ cmake protobuf ];
+  buildInputs = [ libunwind glog google-gflags gmock gtest ];
+
+  # The headers and library include from these and there is no provided pc file
+  propagatedBuildInputs = [ protobuf openssl ];
+
+  cmakeFlags = [
+    "-DBUILD_SHARED_LIBS=true"
+  ];
+
+  preCheck = ''
+    # The checks cannot find libkinetic_client.so otherwise
+    export LD_LIBRARY_PATH="$(pwd)"
+  '';
+
+  installPhase = ''
+    # There is no included install script so do our best
+    mkdir -p $out/lib
+    cp libkinetic_client.so $out/lib
+    cp -r ../include $out
+    cp ../src/main/generated/kinetic_client.pb.h $out/include
+  '';
+
+  doCheck = true;
+
+  meta = with stdenv.lib; {
+    homepage = https://github.com/Seagate/kinetic-cpp-client;
+    description = "Code for producing C and C++ kinetic clients";
+    license = licenses.lgpl21;
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/kmsxx/default.nix b/nixpkgs/pkgs/development/libraries/kmsxx/default.nix
new file mode 100644
index 000000000000..d3733ea5f720
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kmsxx/default.nix
@@ -0,0 +1,31 @@
+{ stdenv, fetchFromGitHub, cmake, pkgconfig, libdrm, python }:
+
+stdenv.mkDerivation rec {
+  pname = "kmsxx";
+  version = "2018-10-23";
+  name = pname + "-" + version;
+
+  src = fetchFromGitHub {
+    owner = "tomba";
+    repo = "kmsxx";
+    fetchSubmodules = true;
+    rev = "c0093c91f0fa2fd6a5b9d1b206a6f44dcd55bfb5";
+    sha256 = "03rv92r938nxb4k4gwcvxy76jnhxdx6x60b58jws83285hd9rgkf";
+  };
+
+  enableParallelBuilding = true;
+
+  nativeBuildInputs = [ cmake pkgconfig ];
+  buildInputs = [ libdrm python ];
+
+  pythonPath = [ ];
+  passthru.python = python;
+
+  meta = with stdenv.lib; {
+    description = "C++11 library, utilities and python bindings for Linux kernel mode setting";
+    homepage = https://github.com/tomba/kmsxx;
+    license = licenses.mpl20;
+    maintainers = with maintainers; [ gnidorah ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/kpmcore/default.nix b/nixpkgs/pkgs/development/libraries/kpmcore/default.nix
new file mode 100644
index 000000000000..5c53f5e6ad5d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kpmcore/default.nix
@@ -0,0 +1,33 @@
+{ stdenv, lib, fetchurl, extra-cmake-modules
+, qtbase, kdeFrameworks
+, libatasmart, parted
+, utillinux }:
+
+let
+  pname = "kpmcore";
+
+in stdenv.mkDerivation rec {
+  name = "${pname}-${version}";
+  version = "3.3.0";
+
+  src = fetchurl {
+    url = "mirror://kde/stable/${pname}/${version}/src/${name}.tar.xz";
+    sha256 = "0s6v0jfrhjg31ri5p6h9n4w29jvasf5dj954j3vfpzl91lygmmmq";
+  };
+
+  buildInputs = [
+    qtbase
+    libatasmart
+    parted # we only need the library
+
+    kdeFrameworks.kio
+
+    utillinux # needs blkid (note that this is not provided by utillinux-compat)
+  ];
+  nativeBuildInputs = [ extra-cmake-modules ];
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+   maintainers = with lib.maintainers; [ peterhoeg ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/kproperty/default.nix b/nixpkgs/pkgs/development/libraries/kproperty/default.nix
new file mode 100644
index 000000000000..c49402b74e86
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kproperty/default.nix
@@ -0,0 +1,30 @@
+{
+  mkDerivation, lib, fetchurl,
+  extra-cmake-modules,
+  qtbase, kconfig, kcoreaddons, kwidgetsaddons, kguiaddons,
+  qttools
+}:
+
+mkDerivation rec {
+  pname = "kproperty";
+  version = "3.2.0";
+  name = "${pname}-${version}";
+
+  src = fetchurl {
+    url = "mirror://kde/stable/${pname}/src/${name}.tar.xz";
+    sha256 = "1yldfsdamk4dag8dyryjn5n9j2pzi42s79kkafymfnbifhnhrbv7";
+  };
+
+  nativeBuildInputs = [ extra-cmake-modules ];
+
+  buildInputs = [ kconfig kcoreaddons kwidgetsaddons kguiaddons qttools ];
+
+  propagatedBuildInputs = [ qtbase ];
+
+  meta = with lib; {
+    description = "A property editing framework with editor widget similar to what is known from Qt Designer";
+    license = licenses.lgpl2;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ zraexy ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/kreport/default.nix b/nixpkgs/pkgs/development/libraries/kreport/default.nix
new file mode 100644
index 000000000000..fc9c77e8fd61
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kreport/default.nix
@@ -0,0 +1,27 @@
+{
+  mkDerivation, lib, fetchurl,
+  extra-cmake-modules,
+  qtdeclarative, qtwebkit, kconfig, kcoreaddons, kwidgetsaddons, kguiaddons, kproperty, marble, python2
+}:
+
+mkDerivation rec {
+  pname = "kreport";
+  version = "3.2.0";
+  name = "${pname}-${version}";
+
+  src = fetchurl {
+    url = "mirror://kde/stable/${pname}/src/${name}.tar.xz";
+    sha256 = "1mycsvkz5rphi9df2i4ch4ykvprd4m76acsdzs3zis2ljrqnsw92";
+  };
+
+  nativeBuildInputs = [ extra-cmake-modules ];
+
+  buildInputs = [ qtdeclarative qtwebkit kconfig kcoreaddons kwidgetsaddons kguiaddons kproperty marble python2 ];
+
+  meta = with lib; {
+    description = "A framework for creation and generation of reports in multiple formats";
+    license = licenses.lgpl2;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ zraexy ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/kyotocabinet/default.nix b/nixpkgs/pkgs/development/libraries/kyotocabinet/default.nix
new file mode 100644
index 000000000000..897f33953afb
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kyotocabinet/default.nix
@@ -0,0 +1,41 @@
+{ stdenv, fetchurl, zlib }:
+
+stdenv.mkDerivation rec {
+  name = "kyotocabinet-1.2.76";
+
+  src = fetchurl {
+    url = "http://fallabs.com/kyotocabinet/pkg/${name}.tar.gz";
+    sha256 = "0g6js20x7vnpq4p8ghbw3mh9wpqksya9vwhzdx6dnlf354zjsal1";
+  };
+
+  prePatch = stdenv.lib.optionalString stdenv.isDarwin ''
+    substituteInPlace kccommon.h \
+      --replace tr1/unordered_map unordered_map \
+      --replace tr1/unordered_set unordered_set \
+      --replace tr1::hash std::hash \
+      --replace tr1::unordered_map std::unordered_map \
+      --replace tr1::unordered_set std::unordered_set
+
+    substituteInPlace lab/kcdict/Makefile --replace stdc++ c++
+    substituteInPlace configure \
+        --replace /usr/local/bin:/usr/local/sbin: "" \
+        --replace /usr/bin:/usr/sbin: "" \
+        --replace /bin:/sbin: "" \
+        --replace stdc++ c++
+  '';
+
+  patches = [(fetchurl {
+    name = "gcc6.patch";
+    url = "https://src.fedoraproject.org/rpms/kyotocabinet/raw/master/f/kyotocabinet-1.2.76-gcc6.patch";
+    sha256 = "1h5k38mkiq7lz8nd2gbn7yvimcz49g3z7phn1cr560bzjih8rz23";
+  })];
+
+  buildInputs = [ zlib ];
+
+  meta = with stdenv.lib; {
+    homepage = http://fallabs.com/kyotocabinet;
+    description = "A library of routines for managing a database";
+    license = licenses.gpl3;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/l-smash/default.nix b/nixpkgs/pkgs/development/libraries/l-smash/default.nix
new file mode 100644
index 000000000000..374d9c398eff
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/l-smash/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchFromGitHub, which }:
+
+stdenv.mkDerivation rec {
+  pname = "l-smash";
+  version = "2.14.5";
+
+  src = fetchFromGitHub {
+    owner = "l-smash";
+    repo = pname;
+    rev = "v${version}";
+    sha256 = "0rcq9727im6kd8da8b7kzzbzxdldvmh5nsljj9pvr4m3lj484b02";
+  };
+
+  nativeBuildInputs = [ which ];
+
+  meta = with stdenv.lib; {
+    homepage = http://l-smash.github.io/l-smash/;
+    description = "MP4 container utilities";
+    license = licenses.isc;
+    maintainers = with maintainers; [ tadeokondrak ];
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/lame/default.nix b/nixpkgs/pkgs/development/libraries/lame/default.nix
new file mode 100644
index 000000000000..2f713cb59775
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/lame/default.nix
@@ -0,0 +1,71 @@
+{ stdenv, fetchurl
+, nasmSupport ? true, nasm ? null # Assembly optimizations
+, cpmlSupport ? true # Compaq's fast math library
+#, efenceSupport ? false, libefence ? null # Use ElectricFence for malloc debugging
+, sndfileFileIOSupport ? false, libsndfile ? null # Use libsndfile, instead of lame's internal routines
+, analyzerHooksSupport ? true # Use analyzer hooks
+, decoderSupport ? true # mpg123 decoder
+, frontendSupport ? true # Build the lame executable
+#, mp3xSupport ? false, gtk1 ? null # Build GTK frame analyzer
+, mp3rtpSupport ? false # Build mp3rtp
+, debugSupport ? false # Debugging (disables optimizations)
+}:
+
+assert nasmSupport -> (nasm != null);
+#assert efenceSupport -> (libefence != null);
+assert sndfileFileIOSupport -> (libsndfile != null);
+#assert mp3xSupport -> (analyzerHooksSupport && (gtk1 != null));
+
+let
+  mkFlag = optSet: flag: if optSet then "--enable-${flag}" else "--disable-${flag}";
+in
+
+with stdenv.lib;
+stdenv.mkDerivation rec {
+  name = "lame-${version}";
+  version = "3.100";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/lame/${name}.tar.gz";
+    sha256 = "07nsn5sy3a8xbmw1bidxnsj5fj6kg9ai04icmqw40ybkp353dznx";
+  };
+
+  outputs = [ "out" "lib" "doc" ]; # a small single header
+  outputMan = "out";
+
+  nativeBuildInputs = [ ]
+    ++ optional nasmSupport nasm;
+
+  buildInputs = [ ]
+    #++ optional efenceSupport libefence
+    #++ optional mp3xSupport gtk1
+    ++ optional sndfileFileIOSupport libsndfile;
+
+  configureFlags = [
+    (mkFlag nasmSupport "nasm")
+    (mkFlag cpmlSupport "cpml")
+    #(mkFlag efenceSupport "efence")
+    (if sndfileFileIOSupport then "--with-fileio=sndfile" else "--with-fileio=lame")
+    (mkFlag analyzerHooksSupport "analyzer-hooks")
+    (mkFlag decoderSupport "decoder")
+    (mkFlag frontendSupport "frontend")
+    (mkFlag frontendSupport "dynamic-frontends")
+    #(mkFlag mp3xSupport "mp3x")
+    (mkFlag mp3rtpSupport "mp3rtp")
+    (if debugSupport then "--enable-debug=alot" else "")
+  ];
+
+  preConfigure = ''
+    # Prevent a build failure for 3.100 due to using outdated symbol list
+    # https://hydrogenaud.io/index.php/topic,114777.msg946373.html#msg946373
+    sed -i '/lame_init_old/d' include/libmp3lame.sym
+  '';
+
+  meta = {
+    description = "A high quality MPEG Audio Layer III (MP3) encoder";
+    homepage    = http://lame.sourceforge.net;
+    license     = licenses.lgpl2;
+    maintainers = with maintainers; [ codyopel fpletz ];
+    platforms   = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/languagemachines/frog.nix b/nixpkgs/pkgs/development/libraries/languagemachines/frog.nix
new file mode 100644
index 000000000000..dcff8c2757e1
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/languagemachines/frog.nix
@@ -0,0 +1,54 @@
+{ stdenv, fetchurl
+, automake, autoconf, bzip2, libtar, libtool, pkgconfig, autoconf-archive
+, libxml2, icu
+, languageMachines
+}:
+
+let
+  release = builtins.fromJSON (builtins.readFile ./release-info/LanguageMachines-frog.json);
+in
+
+stdenv.mkDerivation {
+  name = "frog-${release.version}";
+  version = release.version;
+  src = fetchurl { inherit (release) url sha256;
+                   name = "frog-v${release.version}.tar.gz"; };
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ automake autoconf bzip2 libtar libtool autoconf-archive
+                  libxml2 icu
+                  languageMachines.ticcutils
+                  languageMachines.timbl
+                  languageMachines.mbt
+                  languageMachines.libfolia
+                  languageMachines.ucto
+                  languageMachines.frogdata
+                ];
+
+  preConfigure = ''
+    sh bootstrap.sh
+  '';
+  postInstall = ''
+    # frog expects the data files installed in the same prefix
+    mkdir -p $out/share/frog/;
+    for f in ${languageMachines.frogdata}/share/frog/*; do
+      ln -s $f $out/share/frog/;
+    done;
+
+    make check
+  '';
+
+  meta = with stdenv.lib; {
+    description = "A Tagger-Lemmatizer-Morphological-Analyzer-Dependency-Parser for Dutch";
+    homepage    = https://languagemachines.github.io/frog;
+    license     = licenses.gpl3;
+    platforms   = platforms.all;
+    maintainers = with maintainers; [ roberth ];
+
+    longDescription = ''
+      Frog is an integration of memory-based natural language processing (NLP) modules developed for Dutch. All NLP modules are based on Timbl, the Tilburg memory-based learning software package. Most modules were created in the 1990s at the ILK Research Group (Tilburg University, the Netherlands) and the CLiPS Research Centre (University of Antwerp, Belgium). Over the years they have been integrated into a single text processing tool, which is currently maintained and developed by the Language Machines Research Group and the Centre for Language and Speech Technology at Radboud University Nijmegen. A dependency parser, a base phrase chunker, and a named-entity recognizer module were added more recently. Where possible, Frog makes use of multi-processor support to run subtasks in parallel.
+
+      Various (re)programming rounds have been made possible through funding by NWO, the Netherlands Organisation for Scientific Research, particularly under the CGN project, the IMIX programme, the Implicit Linguistics project, the CLARIN-NL programme and the CLARIAH programme.
+    '';
+  };
+
+}
diff --git a/nixpkgs/pkgs/development/libraries/languagemachines/frogdata.nix b/nixpkgs/pkgs/development/libraries/languagemachines/frogdata.nix
new file mode 100644
index 000000000000..2c418c1bc5f5
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/languagemachines/frogdata.nix
@@ -0,0 +1,30 @@
+{ stdenv, fetchurl
+, automake, autoconf, libtool, pkgconfig, autoconf-archive
+}:
+
+let
+  release = builtins.fromJSON (builtins.readFile ./release-info/LanguageMachines-frogdata.json);
+in
+
+stdenv.mkDerivation {
+  name = "frogdata-${release.version}";
+  version = release.version;
+  src = fetchurl { inherit (release) url sha256;
+                   name = "frogdata-${release.version}.tar.gz"; };
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ automake autoconf libtool autoconf-archive
+                ];
+
+  preConfigure = ''
+    sh bootstrap.sh
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Data for Frog, a Tagger-Lemmatizer-Morphological-Analyzer-Dependency-Parser for Dutch";
+    homepage    = https://languagemachines.github.io/frog;
+    license     = licenses.gpl3;
+    platforms   = platforms.all;
+    maintainers = with maintainers; [ roberth ];
+  };
+
+}
diff --git a/nixpkgs/pkgs/development/libraries/languagemachines/libfolia.nix b/nixpkgs/pkgs/development/libraries/languagemachines/libfolia.nix
new file mode 100644
index 000000000000..a00c3be4193e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/languagemachines/libfolia.nix
@@ -0,0 +1,34 @@
+{ stdenv, fetchurl
+, automake, autoconf, libtool, pkgconfig, autoconf-archive
+, libxml2, icu, bzip2, libtar
+, languageMachines }:
+
+let
+  release = builtins.fromJSON (builtins.readFile ./release-info/LanguageMachines-libfolia.json);
+in
+
+stdenv.mkDerivation {
+  name = "libfolia-${release.version}";
+  version = release.version;
+  src = fetchurl { inherit (release) url sha256;
+                   name = "libfolia-${release.version}.tar.gz"; };
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ automake autoconf bzip2 libtool autoconf-archive libtar libxml2 icu languageMachines.ticcutils ];
+  preConfigure = "sh bootstrap.sh";
+
+  # 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; {
+    description = "A C++ API for FoLiA documents; an XML-based linguistic annotation format.";
+    homepage    = https://proycon.github.io/folia/;
+    license     = licenses.gpl3;
+    platforms   = platforms.all;
+    maintainers = with maintainers; [ roberth ];
+
+    longDescription = ''
+      A high-level C++ API to read, manipulate, and create FoLiA documents. FoLiA is an XML-based annotation format, suitable for the representation of linguistically annotated language resources. FoLiA’s intended use is as a format for storing and/or exchanging language resources, including corpora.
+    '';
+  };
+
+}
diff --git a/nixpkgs/pkgs/development/libraries/languagemachines/mbt-add-libxml2-dep.patch b/nixpkgs/pkgs/development/libraries/languagemachines/mbt-add-libxml2-dep.patch
new file mode 100644
index 000000000000..9037f1093bb9
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/languagemachines/mbt-add-libxml2-dep.patch
@@ -0,0 +1,13 @@
+--- a/configure.ac	2017-06-12 06:48:15.000000000 +0200
++++ b/configure.ac	2017-06-12 06:50:06.000000000 +0200
+@@ -76,6 +76,10 @@
+ CXXFLAGS="$CXXFLAGS $ticcutils_CFLAGS"
+ LIBS="$LIBS $ticcutils_LIBS"
+ 
++PKG_CHECK_MODULES([libxml2], [libxml-2.0 >= 2.6.16] )
++CXXFLAGS="$CXXFLAGS $libxml2_CFLAGS"
++LIBS="$LIBS $libxml2_LIBS"
++
+ AC_CONFIG_FILES([
+   Makefile
+   mbt.pc
diff --git a/nixpkgs/pkgs/development/libraries/languagemachines/mbt.nix b/nixpkgs/pkgs/development/libraries/languagemachines/mbt.nix
new file mode 100644
index 000000000000..b99cb4f595a4
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/languagemachines/mbt.nix
@@ -0,0 +1,41 @@
+{ stdenv, fetchurl
+, automake, autoconf, bzip2, libtar, libtool, pkgconfig, autoconf-archive
+, libxml2
+, languageMachines
+}:
+
+let
+  release = builtins.fromJSON (builtins.readFile ./release-info/LanguageMachines-mbt.json);
+in
+
+stdenv.mkDerivation {
+  name = "mbt-${release.version}";
+  version = release.version;
+  src = fetchurl { inherit (release) url sha256;
+                   name = "mbt-${release.version}.tar.gz"; };
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ automake autoconf bzip2 libtar libtool autoconf-archive
+                  libxml2
+                  languageMachines.ticcutils
+                  languageMachines.timbl
+                ];
+  patches = [ ./mbt-add-libxml2-dep.patch ];
+  preConfigure = ''
+    sh bootstrap.sh
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Memory Based Tagger";
+    homepage    = https://languagemachines.github.io/mbt/;
+    license     = licenses.gpl3;
+    platforms   = platforms.all;
+    maintainers = with maintainers; [ roberth ];
+
+    longDescription = ''
+      MBT is a memory-based tagger-generator and tagger in one. The tagger-generator part can generate a sequence tagger on the basis of a training set of tagged sequences; the tagger part can tag new sequences. MBT can, for instance, be used to generate part-of-speech taggers or chunkers for natural language processing. It has also been used for named-entity recognition, information extraction in domain-specific texts, and disfluency chunking in transcribed speech.
+
+      Mbt is used by Frog for Dutch tagging.
+    '';
+  };
+
+}
diff --git a/nixpkgs/pkgs/development/libraries/languagemachines/packages.nix b/nixpkgs/pkgs/development/libraries/languagemachines/packages.nix
new file mode 100644
index 000000000000..c2d449ed13c6
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/languagemachines/packages.nix
@@ -0,0 +1,14 @@
+{ callPackage }:
+{
+  ticcutils = callPackage ./ticcutils.nix { };
+  libfolia = callPackage ./libfolia.nix { };
+  ucto = callPackage ./ucto.nix { };
+  uctodata = callPackage ./uctodata.nix { };
+  timbl = callPackage ./timbl.nix { };
+  timblserver = callPackage ./timblserver.nix { };
+  mbt = callPackage ./mbt.nix { };
+  frog = callPackage ./frog.nix { };
+  frogdata = callPackage ./frogdata.nix { };
+
+  test = callPackage ./test.nix { };
+}
diff --git a/nixpkgs/pkgs/development/libraries/languagemachines/release-info/LanguageMachines-frog.json b/nixpkgs/pkgs/development/libraries/languagemachines/release-info/LanguageMachines-frog.json
new file mode 100644
index 000000000000..55c2ec20a312
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/languagemachines/release-info/LanguageMachines-frog.json
@@ -0,0 +1,5 @@
+{
+  "version": "v0.13.7",
+  "url": "https://api.github.com/repos/LanguageMachines/frog/tarball/v0.13.7",
+  "sha256": "0swyfi3g862n888qj8v8kd18745hasy0vnc70i9qlv0ji0321bnf"
+}
diff --git a/nixpkgs/pkgs/development/libraries/languagemachines/release-info/LanguageMachines-frogdata.json b/nixpkgs/pkgs/development/libraries/languagemachines/release-info/LanguageMachines-frogdata.json
new file mode 100644
index 000000000000..6ea449387172
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/languagemachines/release-info/LanguageMachines-frogdata.json
@@ -0,0 +1,5 @@
+{
+  "version": "0.13",
+  "url": "https://api.github.com/repos/LanguageMachines/frogdata/tarball/v0.13",
+  "sha256": "13mhv8qacl0n20ddl1ay49xi6h2m0a149ya3rrsmaah3x4adb4sg"
+}
diff --git a/nixpkgs/pkgs/development/libraries/languagemachines/release-info/LanguageMachines-libfolia.json b/nixpkgs/pkgs/development/libraries/languagemachines/release-info/LanguageMachines-libfolia.json
new file mode 100644
index 000000000000..792d958213fb
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/languagemachines/release-info/LanguageMachines-libfolia.json
@@ -0,0 +1,5 @@
+{
+  "version": "v1.7",
+  "url": "https://api.github.com/repos/LanguageMachines/libfolia/tarball/v1.7",
+  "sha256": "0hpxdry7n2887klryc587xv46p6z6jp6hz9x7k2pk5v7jb0z4s65"
+}
diff --git a/nixpkgs/pkgs/development/libraries/languagemachines/release-info/LanguageMachines-mbt.json b/nixpkgs/pkgs/development/libraries/languagemachines/release-info/LanguageMachines-mbt.json
new file mode 100644
index 000000000000..f1bbff47a28e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/languagemachines/release-info/LanguageMachines-mbt.json
@@ -0,0 +1,5 @@
+{
+  "version": "v3.2.16",
+  "url": "https://api.github.com/repos/LanguageMachines/mbt/tarball/v3.2.16",
+  "sha256": "0f9f5l84m0lmmv4km9myn3yhy67jbmk3qn2fi40dy025gx4l0x3x"
+}
diff --git a/nixpkgs/pkgs/development/libraries/languagemachines/release-info/LanguageMachines-ticcutils.json b/nixpkgs/pkgs/development/libraries/languagemachines/release-info/LanguageMachines-ticcutils.json
new file mode 100644
index 000000000000..11069c6b02c7
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/languagemachines/release-info/LanguageMachines-ticcutils.json
@@ -0,0 +1,5 @@
+{
+  "version": "v0.15",
+  "url": "https://api.github.com/repos/LanguageMachines/ticcutils/tarball/v0.15",
+  "sha256": "0lssb1klx2flmr6fy78j37i5lbq3gfhzjx24j6n72ndm2rvprvcn"
+}
diff --git a/nixpkgs/pkgs/development/libraries/languagemachines/release-info/LanguageMachines-timbl.json b/nixpkgs/pkgs/development/libraries/languagemachines/release-info/LanguageMachines-timbl.json
new file mode 100644
index 000000000000..d35f2c8333aa
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/languagemachines/release-info/LanguageMachines-timbl.json
@@ -0,0 +1,5 @@
+{
+  "version": "v6.4.9",
+  "url": "https://api.github.com/repos/LanguageMachines/timbl/tarball/v6.4.9",
+  "sha256": "1279npc3xlq05hnkylpbkgg941gjhvl6sd5fw4vgwcx2rwmmlaay"
+}
diff --git a/nixpkgs/pkgs/development/libraries/languagemachines/release-info/LanguageMachines-timblserver.json b/nixpkgs/pkgs/development/libraries/languagemachines/release-info/LanguageMachines-timblserver.json
new file mode 100644
index 000000000000..d588da3f8b6e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/languagemachines/release-info/LanguageMachines-timblserver.json
@@ -0,0 +1,5 @@
+{
+  "version": "v1.11",
+  "url": "https://api.github.com/repos/LanguageMachines/timblserver/tarball/v1.11",
+  "sha256": "02k8c704wr5miy82w6zj0imm7sdfnxf3db34qiaa8l3myhn17qlw"
+}
diff --git a/nixpkgs/pkgs/development/libraries/languagemachines/release-info/LanguageMachines-ucto.json b/nixpkgs/pkgs/development/libraries/languagemachines/release-info/LanguageMachines-ucto.json
new file mode 100644
index 000000000000..9b05cf3e1393
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/languagemachines/release-info/LanguageMachines-ucto.json
@@ -0,0 +1,5 @@
+{
+  "version": "v0.9.6",
+  "url": "https://api.github.com/repos/LanguageMachines/ucto/tarball/v0.9.6",
+  "sha256": "0fxq4j32g7kp6789xz23651c4v2j7zlz87cshfv9g1xjs7jxns3f"
+}
diff --git a/nixpkgs/pkgs/development/libraries/languagemachines/release-info/LanguageMachines-uctodata.json b/nixpkgs/pkgs/development/libraries/languagemachines/release-info/LanguageMachines-uctodata.json
new file mode 100644
index 000000000000..08069bb333bc
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/languagemachines/release-info/LanguageMachines-uctodata.json
@@ -0,0 +1,5 @@
+{
+  "version": "v0.4",
+  "url": "https://api.github.com/repos/LanguageMachines/uctodata/tarball/v0.4",
+  "sha256": "02c78qmwi9ijpk5wila3p62fmfdy1rpmlvvzbxs3wg0rdb0nwvd2"
+}
diff --git a/nixpkgs/pkgs/development/libraries/languagemachines/test.nix b/nixpkgs/pkgs/development/libraries/languagemachines/test.nix
new file mode 100644
index 000000000000..48c41ac52f22
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/languagemachines/test.nix
@@ -0,0 +1,25 @@
+{ runCommand
+, languageMachines
+}:
+
+runCommand "frog-test" {} ''
+  ${languageMachines.frog}/bin/frog >$out <<EOF
+  Dit is een test
+  
+  EOF
+  echo "Frog output:"
+  cat $out
+
+  expected () {
+    echo "Test expectation failed: $@"
+    exit 1
+  }
+
+  lines="$(wc -l $out | awk '{print $1}')"
+  test 5 = $lines || expected "Five lines of output"
+  grep "is" $out | grep "zijn" >/dev/null || expected "Stemming works"
+  grep "een" $out | grep "onbep" >/dev/null || expected "Tagging works"
+
+  deps="$(echo $(awk 'BEGIN { FS = "\t*" } ; {print $1 " -> " $9 "; "}' <$out))"
+  test "1 -> 2; 2 -> 0; 3 -> 4; 4 -> 2; -> ;" = "$deps" || expected "Dependency parsing works"
+''
diff --git a/nixpkgs/pkgs/development/libraries/languagemachines/ticcutils.nix b/nixpkgs/pkgs/development/libraries/languagemachines/ticcutils.nix
new file mode 100644
index 000000000000..779ec664996a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/languagemachines/ticcutils.nix
@@ -0,0 +1,30 @@
+{ stdenv, fetchurl
+, automake, autoconf, libtool, pkgconfig, autoconf-archive
+, libxml2, zlib, bzip2, libtar }:
+
+let
+  release = builtins.fromJSON (builtins.readFile ./release-info/LanguageMachines-ticcutils.json);
+in
+
+stdenv.mkDerivation {
+  name = "ticcutils-${release.version}";
+  version = release.version;
+  src = fetchurl { inherit (release) url sha256;
+                   name = "ticcutils-${release.version}.tar.gz"; };
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ automake autoconf libtool autoconf-archive libxml2
+                  # optional:
+                  zlib bzip2 libtar
+                  # broken but optional: boost
+                ];
+  preConfigure = "sh bootstrap.sh";
+
+  meta = with stdenv.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;
+    platforms   = platforms.all;
+    maintainers = with maintainers; [ roberth ];
+  };
+
+}
diff --git a/nixpkgs/pkgs/development/libraries/languagemachines/timbl.nix b/nixpkgs/pkgs/development/libraries/languagemachines/timbl.nix
new file mode 100644
index 000000000000..c6c216f5abf3
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/languagemachines/timbl.nix
@@ -0,0 +1,37 @@
+{ stdenv, fetchurl
+, automake, autoconf, libtool, pkgconfig, autoconf-archive
+, libxml2, bzip2, libtar
+, languageMachines
+}:
+
+let
+  release = builtins.fromJSON (builtins.readFile ./release-info/LanguageMachines-timbl.json);
+in
+
+stdenv.mkDerivation {
+  name = "timbl-${release.version}";
+  version = release.version;
+  src = fetchurl { inherit (release) url sha256;
+                   name = "timbl-${release.version}.tar.gz"; };
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ automake autoconf bzip2 libtar libtool autoconf-archive
+                  libxml2
+                  languageMachines.ticcutils
+                ];
+  preConfigure = "sh bootstrap.sh";
+
+  meta = with stdenv.lib; {
+    description = "TiMBL implements several memory-based learning algorithms";
+    homepage    = https://github.com/LanguageMachines/timbl/;
+    license     = licenses.gpl3;
+    platforms   = platforms.all;
+    maintainers = with maintainers; [ roberth ];
+
+    longDescription = ''
+      TiMBL is an open source software package implementing several memory-based learning algorithms, among which IB1-IG, an implementation of k-nearest neighbor classification with feature weighting suitable for symbolic feature spaces, and IGTree, a decision-tree approximation of IB1-IG. All implemented algorithms have in common that they store some representation of the training set explicitly in memory. During testing, new cases are classified by extrapolation from the most similar stored cases.
+
+      For over fifteen years TiMBL has been mostly used in natural language processing as a machine learning classifier component, but its use extends to virtually any supervised machine learning domain. Due to its particular decision-tree-based implementation, TiMBL is in many cases far more efficient in classification than a standard k-nearest neighbor algorithm would be.
+    '';
+  };
+
+}
diff --git a/nixpkgs/pkgs/development/libraries/languagemachines/timblserver.nix b/nixpkgs/pkgs/development/libraries/languagemachines/timblserver.nix
new file mode 100644
index 000000000000..aeadb0759530
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/languagemachines/timblserver.nix
@@ -0,0 +1,38 @@
+{ stdenv, fetchurl
+, automake, autoconf, bzip2, libtar, libtool, pkgconfig, autoconf-archive
+, libxml2
+, languageMachines
+}:
+
+let
+  release = builtins.fromJSON (builtins.readFile ./release-info/LanguageMachines-timblserver.json);
+in
+
+stdenv.mkDerivation {
+  name = "timblserver-${release.version}";
+  version = release.version;
+  src = fetchurl { inherit (release) url sha256;
+                   name = "timblserver-${release.version}.tar.gz"; };
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ automake autoconf bzip2 libtar libtool autoconf-archive
+                  libxml2
+                  languageMachines.ticcutils
+                  languageMachines.timbl
+                ];
+  preConfigure = "sh bootstrap.sh";
+
+  meta = with stdenv.lib; {
+    description = "This server for TiMBL implements several memory-based learning algorithms";
+    homepage    = https://github.com/LanguageMachines/timblserver/;
+    license     = licenses.gpl3;
+    platforms   = platforms.all;
+    maintainers = with maintainers; [ roberth ];
+
+    longDescription = ''
+      This implements a server for TiMBL. TiMBL is an open source software package implementing several memory-based learning algorithms, among which IB1-IG, an implementation of k-nearest neighbor classification with feature weighting suitable for symbolic feature spaces, and IGTree, a decision-tree approximation of IB1-IG. All implemented algorithms have in common that they store some representation of the training set explicitly in memory. During testing, new cases are classified by extrapolation from the most similar stored cases.
+
+      For over fifteen years TiMBL has been mostly used in natural language processing as a machine learning classifier component, but its use extends to virtually any supervised machine learning domain. Due to its particular decision-tree-based implementation, TiMBL is in many cases far more efficient in classification than a standard k-nearest neighbor algorithm would be.
+    '';
+  };
+
+}
diff --git a/nixpkgs/pkgs/development/libraries/languagemachines/ucto.nix b/nixpkgs/pkgs/development/libraries/languagemachines/ucto.nix
new file mode 100644
index 000000000000..ab047d0516eb
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/languagemachines/ucto.nix
@@ -0,0 +1,49 @@
+{ stdenv, fetchurl
+, automake, autoconf, libtool, pkgconfig, autoconf-archive
+, libxml2, icu, bzip2, libtar
+, languageMachines
+}:
+
+let
+  release = builtins.fromJSON (builtins.readFile ./release-info/LanguageMachines-ucto.json);
+in
+
+stdenv.mkDerivation {
+  name = "ucto-${release.version}";
+  version = release.version;
+  src = fetchurl { inherit (release) url sha256;
+                   name = "ucto-${release.version}.tar.gz"; };
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ automake autoconf bzip2 libtool autoconf-archive
+                  icu libtar libxml2
+                  languageMachines.ticcutils
+                  languageMachines.libfolia
+                  languageMachines.uctodata
+                  # TODO textcat from libreoffice? Pulls in X11 dependencies?
+                ];
+  preConfigure = "sh bootstrap.sh;";
+
+  postInstall = ''
+    # ucto expects the data files installed in the same prefix
+    mkdir -p $out/share/ucto/;
+    for f in ${languageMachines.uctodata}/share/ucto/*; do
+      echo "Linking $f"
+      ln -s $f $out/share/ucto/;
+    done;
+  '';
+
+  meta = with stdenv.lib; {
+    description = "A rule-based tokenizer for natural language";
+    homepage    = https://languagemachines.github.io/ucto/;
+    license     = licenses.gpl3;
+    platforms   = platforms.all;
+    maintainers = with maintainers; [ roberth ];
+
+    longDescription = ''
+      Ucto tokenizes text files: it separates words from punctuation, and splits sentences. It offers several other basic preprocessing steps such as changing case that you can all use to make your text suited for further processing such as indexing, part-of-speech tagging, or machine translation.
+
+      Ucto comes with tokenisation rules for several languages and can be easily extended to suit other languages. It has been incorporated for tokenizing Dutch text in Frog, a Dutch morpho-syntactic processor.
+    '';
+  };
+
+}
diff --git a/nixpkgs/pkgs/development/libraries/languagemachines/uctodata.nix b/nixpkgs/pkgs/development/libraries/languagemachines/uctodata.nix
new file mode 100644
index 000000000000..01a78b5b4be6
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/languagemachines/uctodata.nix
@@ -0,0 +1,32 @@
+{ stdenv, fetchurl
+, automake, autoconf, libtool, pkgconfig, autoconf-archive
+ }:
+
+let
+  release = builtins.fromJSON (builtins.readFile ./release-info/LanguageMachines-uctodata.json);
+in
+
+stdenv.mkDerivation {
+  name = "uctodata-${release.version}";
+  version = release.version;
+  src = fetchurl { inherit (release) url sha256;
+                   name = "uctodata-${release.version}.tar.gz"; };
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ automake autoconf libtool autoconf-archive ];
+  preConfigure = "sh bootstrap.sh";
+
+  meta = with stdenv.lib; {
+    description = "A rule-based tokenizer for natural language";
+    homepage    = https://languagemachines.github.io/ucto/;
+    license     = licenses.gpl3;
+    platforms   = platforms.all;
+    maintainers = with maintainers; [ roberth ];
+
+    longDescription = ''
+      Ucto tokenizes text files: it separates words from punctuation, and splits sentences. It offers several other basic preprocessing steps such as changing case that you can all use to make your text suited for further processing such as indexing, part-of-speech tagging, or machine translation.
+
+      Ucto comes with tokenisation rules for several languages and can be easily extended to suit other languages. It has been incorporated for tokenizing Dutch text in Frog, a Dutch morpho-syntactic processor.
+    '';
+  };
+
+}
diff --git a/nixpkgs/pkgs/development/libraries/languagemachines/update b/nixpkgs/pkgs/development/libraries/languagemachines/update
new file mode 100755
index 000000000000..3189637df746
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/languagemachines/update
@@ -0,0 +1,79 @@
+#!/usr/bin/env nix-shell
+#!nix-shell --packages curl
+#!nix-shell --packages jq
+#!nix-shell --packages parallel
+#!nix-shell -i bash
+
+# Exit immediately if a command exits with a non-zero status.
+# Exit when a producer fails in a pipe
+# Treat undefined variable references as errors
+set -e -o pipefail -u
+
+# Check if working directory is (probably) right
+test "./update" = $0 || {
+    echo "The working directory ought to be the same is the update script location. Please invoke as ./update" 1>&2
+    exit 1
+}
+
+# Create temporary directory with automatic cleanup
+readonly MY_TMP="$(mktemp -d)"
+cleanup () {
+    rm -rf "$MY_TMP"
+}
+trap cleanup EXIT
+
+# stdout: file containing release info and a convenient placeholder
+# for the sha256 attribute
+getRelease () {
+    local owner="$1"
+    local repo="$2"
+    local out="$MY_TMP/$owner--$repo-release"
+    curl -fSs https://api.github.com/repos/"$owner"/"$repo"/releases/latest \
+        | jq '{ version: .name, url: .tarball_url, sha256: "__SHA256__" }' \
+             > "$out"
+    echo "$out"
+}
+
+# 'getters' for the release info file
+
+# stdout: unquoted tarball url
+releaseUrl () {
+    local file="$1"
+    jq -r '.url' <"$file"
+}
+
+# stdout: unquoted version
+releaseVersion () {
+    local file="$1"
+    jq -r '.version' <"$file"
+}
+
+# Fetch release tarball and compute hash
+# stdout: base32 sha256 to be used in fetchurl
+getReleaseHash () {
+    local file="$1"
+    local name="$2"
+    nix-prefetch-url "$(releaseUrl "$file")" --name "$name-$(releaseVersion "$file").tar.gz"
+}
+
+# Write a release info file to release-info/$owner-$repo.json
+updateRelease () {
+    local owner="$1"
+    local repo="$2"
+    local r="$(getRelease "$owner" "$repo")"
+    local hash="$(getReleaseHash "$r" "$repo")"
+    sed \
+      -e s/__SHA256__/"$hash"/\
+      <"$r" \
+      >"release-info/$owner-$repo.json"
+}
+
+updateRelease LanguageMachines frogdata
+updateRelease LanguageMachines frog
+updateRelease LanguageMachines libfolia
+updateRelease LanguageMachines mbt
+updateRelease LanguageMachines ticcutils
+updateRelease LanguageMachines timbl
+updateRelease LanguageMachines timblserver
+updateRelease LanguageMachines ucto
+updateRelease LanguageMachines uctodata
diff --git a/nixpkgs/pkgs/development/libraries/lasem/default.nix b/nixpkgs/pkgs/development/libraries/lasem/default.nix
new file mode 100644
index 000000000000..aa1172029d2e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/lasem/default.nix
@@ -0,0 +1,38 @@
+{ fetchurl, stdenv, pkgconfig, intltool, gobject-introspection, glib, gdk_pixbuf
+, libxml2, cairo, pango, gnome3 }:
+
+stdenv.mkDerivation rec {
+  pname = "lasem";
+  version = "0.4.3";
+
+  outputs = [ "bin" "out" "dev" "man" "doc" "devdoc" ];
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    sha256 = "13ym5pm2y3wk5hh9zb2535i3lnhnzyzs0na1knxwgvwxazwm1ng7";
+  };
+
+  nativeBuildInputs = [ pkgconfig intltool gobject-introspection ];
+
+  propagatedBuildInputs = [
+    glib gdk_pixbuf libxml2 cairo pango
+  ];
+
+  enableParallelBuilding = true;
+  doCheck = true;
+
+  passthru = {
+    updateScript = gnome3.updateScript {
+      packageName = pname;
+    };
+  };
+
+  meta = {
+    description = "SVG and MathML rendering library";
+
+    homepage = https://wiki.gnome.org/Projects/Lasem;
+    license = stdenv.lib.licenses.gpl2Plus;
+
+    platforms = stdenv.lib.platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/lasso/default.nix b/nixpkgs/pkgs/development/libraries/lasso/default.nix
new file mode 100644
index 000000000000..e93467fba0a2
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/lasso/default.nix
@@ -0,0 +1,32 @@
+{ stdenv, autoconf, automake, autoreconfHook, fetchurl, glib, gobject-introspection, gtk-doc, libtool, libxml2, libxslt, openssl, pkgconfig, python27Packages, xmlsec, zlib }:
+
+stdenv.mkDerivation rec {
+
+  name = "lasso-${version}";
+  version = "2.6.0";
+
+  src = fetchurl {
+    url = "https://dev.entrouvert.org/lasso/lasso-${version}.tar.gz";
+    sha256 = "1kqagm63a4mv5sw5qc3y0qlky7r9qg5lccq0c3cnfr0n4mxgysql";
+
+  };
+
+  nativeBuildInputs = [ autoreconfHook pkgconfig ];
+  buildInputs = [ autoconf automake glib gobject-introspection gtk-doc libtool libxml2 libxslt openssl python27Packages.six xmlsec zlib ];
+
+  configurePhase = ''
+    ./configure --with-pkg-config=$PKG_CONFIG_PATH \
+                --disable-python \
+                --disable-perl \
+                --prefix=$out
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = https://lasso.entrouvert.org/;
+    description = "Liberty Alliance Single Sign-On library";
+    license = licenses.gpl2Plus;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ womfoo ];
+  };
+
+}
diff --git a/nixpkgs/pkgs/development/libraries/lcms/cve-2013-4276.patch b/nixpkgs/pkgs/development/libraries/lcms/cve-2013-4276.patch
new file mode 100644
index 000000000000..8f2f32297828
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/lcms/cve-2013-4276.patch
@@ -0,0 +1,62 @@
+diff -ur lcms-1.19.dfsg/samples/icctrans.c lcms-1.19.dfsg-patched/samples/icctrans.c
+--- lcms-1.19.dfsg/samples/icctrans.c	2009-10-30 15:57:45.000000000 +0000
++++ lcms-1.19.dfsg-patched/samples/icctrans.c	2013-08-06 11:53:14.385266647 +0100
+@@ -86,6 +86,8 @@
+ static LPcmsNAMEDCOLORLIST InputColorant = NULL;
+ static LPcmsNAMEDCOLORLIST OutputColorant = NULL;
+ 
++unsigned int Buffer_size = 4096;
++
+ 
+ // isatty replacement
+ 
+@@ -500,7 +502,7 @@
+ 
+     Prefix[0] = 0;
+     if (!lTerse)
+-        sprintf(Prefix, "%s=", C);
++        snprintf(Prefix, 20, "%s=", C);
+ 
+     if (InHexa)
+     {
+@@ -648,7 +650,9 @@
+ static
+ void GetLine(char* Buffer)
+ {    
+-    scanf("%s", Buffer);
++    char User_buffer[Buffer_size];
++    fgets(User_buffer, (Buffer_size - 1), stdin);
++    sscanf(User_buffer,"%s", Buffer);
+     
+     if (toupper(Buffer[0]) == 'Q') { // Quit?
+ 
+@@ -668,7 +672,7 @@
+ static
+ double GetAnswer(const char* Prompt, double Range)
+ {
+-    char Buffer[4096];
++    char Buffer[Buffer_size];
+     double val = 0.0;
+ 	       
+     if (Range == 0.0) {              // Range 0 means double value
+@@ -738,7 +742,7 @@
+ static
+ WORD GetIndex(void)
+ {
+-    char Buffer[4096], Name[40], Prefix[40], Suffix[40];
++    char Buffer[Buffer_size], Name[40], Prefix[40], Suffix[40];
+     int index, max;
+ 
+     max = cmsNamedColorCount(hTrans)-1;
+diff -ur lcms-1.19.dfsg/tifficc/tiffdiff.c lcms-1.19.dfsg-patched/tifficc/tiffdiff.c
+--- lcms-1.19.dfsg/tifficc/tiffdiff.c	2009-10-30 15:57:46.000000000 +0000
++++ lcms-1.19.dfsg-patched/tifficc/tiffdiff.c	2013-08-06 11:49:06.698951157 +0100
+@@ -633,7 +633,7 @@
+     cmsIT8SetSheetType(hIT8, "TIFFDIFF");
+     
+    
+-    sprintf(Buffer, "Differences between %s and %s", TiffName1, TiffName2);
++    snprintf(Buffer, 256, "Differences between %s and %s", TiffName1, TiffName2);
+   
+     cmsIT8SetComment(hIT8, Buffer);
+ 
diff --git a/nixpkgs/pkgs/development/libraries/lcms/default.nix b/nixpkgs/pkgs/development/libraries/lcms/default.nix
new file mode 100644
index 000000000000..63c81822ddf8
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/lcms/default.nix
@@ -0,0 +1,23 @@
+{stdenv, fetchurl}:
+
+stdenv.mkDerivation {
+  name = "lcms-1.19";
+
+  src = fetchurl {
+    url = http://www.littlecms.com/lcms-1.19.tar.gz;
+    sha256 = "1abkf8iphwyfs3z305z3qczm3z1i9idc1lz4gvfg92jnkz5k5bl0";
+  };
+
+  patches = [ ./cve-2013-4276.patch ];
+
+  outputs = [ "bin" "dev" "out" "man" ];
+
+  doCheck = false; # fails with "Error in Linear interpolation (2p): Must be i=8000, But is n=8001"
+
+  meta = {
+    description = "Color management engine";
+    homepage = http://www.littlecms.com/;
+    license = stdenv.lib.licenses.mit;
+    platforms = stdenv.lib.platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/lcms2/default.nix b/nixpkgs/pkgs/development/libraries/lcms2/default.nix
new file mode 100644
index 000000000000..5d307dcfa7ad
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/lcms2/default.nix
@@ -0,0 +1,21 @@
+{ stdenv, fetchurl, libtiff, libjpeg, zlib }:
+
+stdenv.mkDerivation rec {
+  name = "lcms2-2.9";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/lcms/${name}.tar.gz";
+    sha256 = "083xisy6z01zhm7p7rgk4bx9d6zlr8l20qkfv1g29ylnhgwzvij8";
+  };
+
+  outputs = [ "bin" "dev" "out" ];
+
+  propagatedBuildInputs = [ libtiff libjpeg zlib ];
+
+  meta = with stdenv.lib; {
+    description = "Color management engine";
+    homepage = http://www.littlecms.com/;
+    license = licenses.mit;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/ldacbt/default.nix b/nixpkgs/pkgs/development/libraries/ldacbt/default.nix
new file mode 100644
index 000000000000..4ff58843d155
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/ldacbt/default.nix
@@ -0,0 +1,30 @@
+{ stdenv
+, fetchFromGitHub
+, pkgconfig
+, cmake
+}:
+
+stdenv.mkDerivation rec {
+  name = "ldacBT-${version}";
+  version = "2.0.2.3";
+
+  src = fetchFromGitHub {
+    repo = "ldacBT";
+    owner = "ehfive";
+    rev = "v${version}";
+    sha256 = "09dalysx4fgrgpfdm9a51x6slnf4iik1sqba4xjgabpvq91bnb63";
+    fetchSubmodules = true;
+  };
+
+  nativeBuildInputs = [
+    cmake
+  ];
+
+  meta = with stdenv.lib; {
+    description = "AOSP libldac dispatcher";
+    homepage    = https://github.com/EHfive/ldacBT;
+    license     = licenses.asl20;
+    platforms   = platforms.all;
+    maintainers = with maintainers; [ adisbladis ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/ldb/default.nix b/nixpkgs/pkgs/development/libraries/ldb/default.nix
new file mode 100644
index 000000000000..12f7b176bb7b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/ldb/default.nix
@@ -0,0 +1,50 @@
+{ stdenv, fetchurl, python, pkgconfig, readline, tdb, talloc, tevent
+, popt, libxslt, docbook_xsl, docbook_xml_dtd_42, cmocka
+}:
+
+stdenv.mkDerivation rec {
+  name = "ldb-1.3.3";
+
+  src = fetchurl {
+    url = "mirror://samba/ldb/${name}.tar.gz";
+    sha256 = "14gsrm7dvyjpbpnc60z75j6fz2p187abm2h353lq95kx2bv70c1b"                                                                                                                                                             ;
+  };
+
+  outputs = [ "out" "dev" ];
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [
+    python readline tdb talloc tevent popt
+    libxslt docbook_xsl docbook_xml_dtd_42
+    cmocka
+  ];
+
+  patches = [
+    # CVE-2019-3824
+    # downloading the patch from debian as they have ported the patch from samba to ldb but otherwise is identical to
+    # https://bugzilla.samba.org/attachment.cgi?id=14857
+    (fetchurl {
+      name = "CVE-2019-3824.patch";
+      url = "https://sources.debian.org/data/main/l/ldb/2:1.1.27-1+deb9u1/debian/patches/CVE-2019-3824-master-v4-5-02.patch";
+      sha256 = "1idnqckvjh18rh9sbq90rr4sxfviha9nd1ca9pd6lai0y6r6q4yd";
+    })
+  ];
+
+  preConfigure = ''
+    sed -i 's,#!/usr/bin/env python,#!${python}/bin/python,g' buildtools/bin/waf
+  '';
+
+  configureFlags = [
+    "--bundled-libraries=NONE"
+    "--builtin-libraries=replace"
+  ];
+
+  stripDebugList = "bin lib modules";
+
+  meta = with stdenv.lib; {
+    description = "A LDAP-like embedded database";
+    homepage = https://ldb.samba.org/;
+    license = licenses.lgpl3Plus;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/ldns/default.nix b/nixpkgs/pkgs/development/libraries/ldns/default.nix
new file mode 100644
index 000000000000..82496a54aea7
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/ldns/default.nix
@@ -0,0 +1,71 @@
+{ stdenv, fetchurl, fetchpatch, openssl, perl, which, dns-root-data }:
+
+stdenv.mkDerivation rec {
+  pname = "ldns";
+  version = "1.7.0";
+
+  name = "${pname}-${version}";
+
+  src = fetchurl {
+    url = "https://www.nlnetlabs.nl/downloads/ldns/${name}.tar.gz";
+    sha256 = "1k56jw4hz8njspfxcfw0czf1smg0n48ylia89ziwyx5k9wdmp7y1";
+  };
+
+  patches = [
+    (fetchpatch {
+      name = "CVE-2017-1000231.patch";
+      url = "https://git.nlnetlabs.nl/ldns/patch/?id=c8391790";
+      sha256 = "1rprfh0y1c28dqiy3vgwvwdhn7b5rsylfzzblx5xdhwfqgdw8vn0";
+      excludes = [ "Changelog" ];
+    })
+    (fetchpatch {
+      name = "CVE-2017-1000232.patch";
+      url = "https://git.nlnetlabs.nl/ldns/patch/?id=3bdeed02";
+      sha256 = "0bv0s5jjp0sswfg8da47d346iwp9yjhj9w7fa3bxh174br0zj07r";
+      excludes = [ "Changelog" ];
+    })
+  ];
+
+  postPatch = ''
+    patchShebangs doc/doxyparse.pl
+  '';
+
+  outputs = [ "out" "dev" "man" "examples" ];
+
+  nativeBuildInputs = [ perl ];
+  buildInputs = [ openssl ];
+
+  configureFlags = [
+    "--with-ssl=${openssl.dev}"
+    "--with-trust-anchor=${dns-root-data}/root.key"
+    "--with-drill"
+    "--disable-gost"
+  ] ++ stdenv.lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
+    "ac_cv_func_malloc_0_nonnull=yes"
+    "ac_cv_func_realloc_0_nonnull=yes"
+  ];
+
+  checkInputs = [ which ];
+  doCheck = false; # fails. missing some files
+
+  postInstall = ''
+    moveToOutput "bin/ldns-config" "$dev"
+
+    pushd examples
+    configureFlagsArray+=( "--bindir=$examples/bin" )
+    configurePhase
+    make
+    make install
+    popd
+
+    sed -i "$out/lib/libldns.la" -e "s,-L${openssl.dev},-L${openssl.out},g"
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Library with the aim of simplifying DNS programming in C";
+    license = licenses.bsd3;
+    homepage = http://www.nlnetlabs.nl/projects/ldns/;
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/leatherman/default.nix b/nixpkgs/pkgs/development/libraries/leatherman/default.nix
new file mode 100644
index 000000000000..9ab68e578fbf
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/leatherman/default.nix
@@ -0,0 +1,26 @@
+{ stdenv, fetchFromGitHub, boost, cmake, curl, ruby }:
+
+stdenv.mkDerivation rec {
+  name = "leatherman-${version}";
+  version = "1.6.0";
+
+  src = fetchFromGitHub {
+    sha256 = "1dy1iisc0h1l28ff72pq7vxa4mj5zpq2jflpdghhx8yqksxhii4k";
+    rev = version;
+    repo = "leatherman";
+    owner = "puppetlabs";
+  };
+
+  buildInputs = [ boost cmake curl ruby ];
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    homepage = https://github.com/puppetlabs/leatherman/;  
+    description = "A collection of C++ and CMake utility libraries";
+    license = licenses.asl20;
+    maintainers = [ maintainers.womfoo ];
+    platforms = platforms.linux;
+  };
+
+}
diff --git a/nixpkgs/pkgs/development/libraries/lensfun/default.nix b/nixpkgs/pkgs/development/libraries/lensfun/default.nix
new file mode 100644
index 000000000000..f4018cbf9614
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/lensfun/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchurl, pkgconfig, glib, zlib, libpng, cmake }:
+
+stdenv.mkDerivation rec {
+  version = "0.3.95";
+  name = "lensfun-${version}";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/lensfun/${version}/${name}.tar.gz";
+    sha256 = "0218f3xrlln0jmh4gcf1zbpvi2bidgl3b2mblf6c810n7j1rrhl2";
+  };
+
+  nativeBuildInputs = [ cmake pkgconfig ];
+  buildInputs = [ glib zlib libpng ];
+
+  configureFlags = [ "-v" ];
+
+  meta = with stdenv.lib; {
+    platforms = platforms.linux ++ platforms.darwin;
+    maintainers = with maintainers; [ enzime ];
+    license = stdenv.lib.licenses.lgpl3;
+    description = "An opensource database of photographic lenses and their characteristics";
+    homepage = http://lensfun.sourceforge.net/;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/leptonica/default.nix b/nixpkgs/pkgs/development/libraries/leptonica/default.nix
new file mode 100644
index 000000000000..52d835d7a206
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/leptonica/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchurl, fetchpatch, autoreconfHook, pkgconfig, which, gnuplot
+, giflib, libjpeg, libpng, libtiff, libwebp, openjpeg, zlib
+}:
+
+stdenv.mkDerivation rec {
+  name = "leptonica-${version}";
+  version = "1.78.0";
+
+  src = fetchurl {
+    url = "http://www.leptonica.org/source/${name}.tar.gz";
+    sha256 = "122s9b8hi93va4lgwnwrbma50x5fp740npy0s92xybd2wy0jxvg2";
+  };
+
+  nativeBuildInputs = [ autoreconfHook pkgconfig ];
+  buildInputs = [ giflib libjpeg libpng libtiff libwebp openjpeg zlib ];
+  enableParallelBuilding = true;
+
+  checkInputs = [ which gnuplot ];
+  doCheck = !stdenv.isDarwin;
+
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/lesstif/c-missing_xm_h.patch b/nixpkgs/pkgs/development/libraries/lesstif/c-missing_xm_h.patch
new file mode 100644
index 000000000000..2d298d5f4c4e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/lesstif/c-missing_xm_h.patch
@@ -0,0 +1,11 @@
+--- lesstif2-0.94.4.orig/include/Motif-2.1/Xm/XmStrDefs.h
++++ lesstif2-0.94.4/include/Motif-2.1/Xm/XmStrDefs.h
+@@ -28,6 +28,8 @@
+ 
+ #include <X11/StringDefs.h>
+ 
++#include <Xm/Xm.h>
++
+ #ifdef __cplusplus
+ extern "C" {
+ #endif
diff --git a/nixpkgs/pkgs/development/libraries/lesstif/c-render_table_crash.patch b/nixpkgs/pkgs/development/libraries/lesstif/c-render_table_crash.patch
new file mode 100644
index 000000000000..1699dbe19084
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/lesstif/c-render_table_crash.patch
@@ -0,0 +1,11 @@
+--- lesstif2-0.95.0.orig/lib/Xm-2.1/RenderTable.c
++++ lesstif2-0.95.0/lib/Xm-2.1/RenderTable.c
+@@ -465,7 +465,7 @@
+ 	DEBUGOUT(_LtDebug(__FILE__, w, "_XmRenderTableFinaliseTag(%s)\n", tag));
+ #if 1
+ 	/* Experimental start */
+-	if (r->dpy == 0)
++	if (r->dpy == 0  &&  w)
+ 		r->dpy = XtDisplay(w);
+ 	/* Experimental end */
+ #endif
diff --git a/nixpkgs/pkgs/development/libraries/lesstif/c-xpmpipethrough.patch b/nixpkgs/pkgs/development/libraries/lesstif/c-xpmpipethrough.patch
new file mode 100644
index 000000000000..69f9a2464c6d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/lesstif/c-xpmpipethrough.patch
@@ -0,0 +1,381 @@
+Index: lesstif2-0.95.0/lib/Xm-2.1/XpmRdFToI.c
+===================================================================
+--- lesstif2-0.95.0.orig/lib/Xm-2.1/XpmRdFToI.c	2004-11-18 22:00:58.000000000 +0100
++++ lesstif2-0.95.0/lib/Xm-2.1/XpmRdFToI.c	2006-07-11 11:13:29.000000000 +0200
+@@ -44,11 +44,15 @@
+    DebugUtil.h! */
+ #include <stdio.h>
+ #include <string.h>
++#include <errno.h>
+ 
+ #include <ctype.h>
+ #ifdef HAVE_SYS_TYPES_H
+ #include <sys/types.h>
+ #endif
++#ifdef HAVE_SYS_WAIT_H
++#include <sys/wait.h>
++#endif
+ #ifdef HAVE_SYS_STAT_H
+ #include <sys/stat.h>
+ #endif
+@@ -87,16 +91,6 @@
+  	    strcpy(dst, src); \
+ 	else return (XpmFileInvalid); }
+ #endif
+-#include <sys/stat.h>
+-#if !defined(NO_ZPIPE) && defined(WIN32)
+-# define popen _popen
+-# define pclose _pclose
+-# if defined(STAT_ZFILE)
+-#  include <io.h>
+-#  define stat _stat
+-#  define fstat _fstat
+-# endif
+-#endif
+ 
+ LFUNC(OpenReadFile, int, (char *filename, xpmData *mdata));
+ LFUNC(xpmDataClose, void, (xpmData *mdata));
+@@ -173,90 +167,131 @@
+ }
+ #endif /* CXPMPROG */
+ 
+-/*
+- * open the given file to be read as an xpmData which is returned.
+- */
+ #ifndef NO_ZPIPE
+-	FILE *s_popen(char *cmd, const char *type);
+-#else
+-#	define s_popen popen
++/* Do not depend on errno after read_through */
++FILE*
++xpmPipeThrough(fd, cmd, arg1, mode)
++    int fd;
++    const char* cmd;
++    const char* arg1;
++    const char* mode;
++{
++    FILE* fp;
++    int status, fds[2], in = 0, out = 1;
++    pid_t pid;
++    if ( 'w' == *mode )
++	out = 0, in = 1;
++    if ( pipe(fds) < 0 )
++	return NULL;
++    pid = fork();
++    if ( pid < 0 )
++	goto fail1;
++    if ( 0 == pid )
++    {
++	close(fds[in]);
++	if ( dup2(fds[out], out) < 0 )
++	    goto err;
++	close(fds[out]);
++	if ( dup2(fd, in) < 0 )
++	    goto err;
++	close(fd);
++	pid = fork();
++	if ( pid < 0 )
++	    goto err;
++	if ( 0 == pid )
++	{
++	    execlp(cmd, cmd, arg1, NULL);
++	    perror(cmd);
++	    goto err;
++	}
++	_exit(0);
++    err:
++	_exit(1);
++    }
++    close(fds[out]);
++    /* calling process: wait for first child */
++    while ( waitpid(pid, &status, 0) < 0 && EINTR == errno )
++	;
++    if ( WIFSIGNALED(status) ||
++	 (WIFEXITED(status) && WEXITSTATUS(status) != 0) )
++	goto fail2;
++    fp = fdopen(fds[in], mode);
++    if ( !fp )
++	goto fail2;
++    close(fd); /* still open in 2nd child */
++    return fp;
++fail1:
++    close(fds[out]);
++fail2:
++    close(fds[in]);
++    return NULL;
++}
+ #endif
+ 
++/*
++ * open the given file to be read as an xpmData which is returned.
++ */
+ static int
+ OpenReadFile(filename, mdata)
+     char *filename;
+     xpmData *mdata;
+ {
+-#ifndef NO_ZPIPE
+-    char buf[BUFSIZ];
+-# ifdef STAT_ZFILE
+-    char *compressfile;
+-    struct stat status;
+-# endif
+-#endif
+-
+     if (!filename) {
+ 	mdata->stream.file = (stdin);
+ 	mdata->type = XPMFILE;
+     } else {
+-#ifndef NO_ZPIPE
+-	size_t len = strlen(filename);
+-
+-	if(len == 0                        ||
+-	   filename[len-1] == '/')
+-		return(XpmOpenFailed);
+-	if ((len > 2) && !strcmp(".Z", filename + (len - 2))) {
+-	    mdata->type = XPMPIPE;
+-	    snprintf(buf, sizeof(buf), "uncompress -c \"%s\"", filename);
+-	    if (!(mdata->stream.file = s_popen(buf, "r")))
+-		return (XpmOpenFailed);
+-
+-	} else if ((len > 3) && !strcmp(".gz", filename + (len - 3))) {
+-	    mdata->type = XPMPIPE;
+-	    snprintf(buf, sizeof(buf), "gunzip -qc \"%s\"", filename);
+-	    if (!(mdata->stream.file = s_popen(buf, "r")))
+-		return (XpmOpenFailed);
+-
+-	} else {
+-# ifdef STAT_ZFILE
+-	    if (!(compressfile = (char *) XpmMalloc(len + 4)))
++	int fd = open(filename, O_RDONLY);
++#if defined(NO_ZPIPE)
++	if ( fd < 0 )
++	    return XpmOpenFailed;
++#else
++	const char* ext = NULL;
++	if ( fd >= 0 )
++	    ext = strrchr(filename, '.');
++#ifdef STAT_ZFILE /* searching for z-files if the given name not found */
++	else
++	{
++	    size_t len = strlen(filename);
++	    char *compressfile = (char *) XpmMalloc(len + 4);
++	    if ( !compressfile )
+ 		return (XpmNoMemory);
+-
+-	    snprintf(compressfile, len+4, "%s.Z", filename);
+-	    if (!stat(compressfile, &status)) {
+-		snprintf(buf, sizeof(buf), "uncompress -c \"%s\"", compressfile);
+-		if (!(mdata->stream.file = s_popen(buf, "r"))) {
++	    strcpy(compressfile, filename);
++	    strcpy(compressfile + len, ext = ".Z");
++	    fd = open(compressfile, O_RDONLY);
++	    if ( fd < 0 )
++	    {
++		strcpy(compressfile + len, ext = ".gz");
++		fd = open(compressfile, O_RDONLY);
++		if ( fd < 0 )
++		{
+ 		    XpmFree(compressfile);
+-		    return (XpmOpenFailed);
+-		}
+-		mdata->type = XPMPIPE;
+-	    } else {
+-		snprintf(compressfile, len+4, "%s.gz", filename);
+-		if (!stat(compressfile, &status)) {
+-		    snprintf(buf, sizeof(buf), "gunzip -c \"%s\"", compressfile);
+-		    if (!(mdata->stream.file = s_popen(buf, "r"))) {
+-			XpmFree(compressfile);
+-			return (XpmOpenFailed);
+-		    }
+-		    mdata->type = XPMPIPE;
+-		} else {
+-# endif
+-#endif
+-		    if (!(mdata->stream.file = fopen(filename, "r"))) {
+-#if !defined(NO_ZPIPE) && defined(STAT_ZFILE)
+-			XpmFree(compressfile);
+-#endif
+-			return (XpmOpenFailed);
+-		    }
+-		    mdata->type = XPMFILE;
+-#ifndef NO_ZPIPE
+-# ifdef STAT_ZFILE
++		    return XpmOpenFailed;
+ 		}
+ 	    }
+ 	    XpmFree(compressfile);
+-# endif
+ 	}
+ #endif
++	if ( ext && !strcmp(ext, ".Z") )
++	{
++	    mdata->type = XPMPIPE;
++	    mdata->stream.file = xpmPipeThrough(fd, "uncompress", "-c", "r");
++	}
++	else if ( ext && !strcmp(ext, ".gz") )
++	{
++	    mdata->type = XPMPIPE;
++	    mdata->stream.file = xpmPipeThrough(fd, "gunzip", "-qc", "r");
++	}
++	else
++#endif /* z-files */
++	{
++	    mdata->type = XPMFILE;
++	    mdata->stream.file = fdopen(fd, "r");
++	}
++	if (!mdata->stream.file)
++	{
++	    close(fd);
++	    return (XpmOpenFailed);
++	}
+     }
+     mdata->CommentLength = 0;
+ #ifdef CXPMPROG
+@@ -273,15 +308,6 @@
+ xpmDataClose(mdata)
+     xpmData *mdata;
+ {
+-    switch (mdata->type) {
+-    case XPMFILE:
+-	if (mdata->stream.file != (stdin))
+-	    fclose(mdata->stream.file);
+-	break;
+-#ifndef NO_ZPIPE
+-    case XPMPIPE:
++    if (mdata->stream.file != (stdin))
+ 	fclose(mdata->stream.file);
+-	break;
+-#endif
+-    }
+ }
+Index: lesstif2-0.95.0/lib/Xm-2.1/XpmWrFFrI.c
+===================================================================
+--- lesstif2-0.95.0.orig/lib/Xm-2.1/XpmWrFFrI.c	2005-04-13 20:03:27.000000000 +0200
++++ lesstif2-0.95.0/lib/Xm-2.1/XpmWrFFrI.c	2006-07-11 11:13:29.000000000 +0200
+@@ -50,11 +50,15 @@
+    DebugUtil.h! */
+ #include <stdio.h>
+ #include <string.h>
++#include <errno.h>
+ 
+ #include <ctype.h>
+ #ifdef HAVE_SYS_TYPES_H
+ #include <sys/types.h>
+ #endif
++#ifdef HAVE_SYS_WAIT_H
++#include <sys/wait.h>
++#endif
+ #ifdef HAVE_SYS_STAT_H
+ #include <sys/stat.h>
+ #endif
+@@ -94,11 +98,6 @@
+ 	else return (XpmFileInvalid); }
+ #endif
+ 
+-#if !defined(NO_ZPIPE) && defined(WIN32)
+-# define popen _popen
+-# define pclose _pclose
+-#endif
+-
+ /* MS Windows define a function called WriteFile @#%#&!!! */
+ LFUNC(xpmWriteFile, int, (FILE *file, XpmImage *image, char *name,
+ 			  XpmInfo *info));
+@@ -354,58 +353,48 @@
+     fprintf(file, ",\n\"XPMENDEXT\"");
+ }
+ 
++
++#ifndef NO_ZPIPE
++FUNC(xpmPipeThrough, FILE*, (int fd,
++			     const char* cmd,
++			     const char* arg1,
++			     const char* mode));
++#endif
++
+ /*
+  * open the given file to be written as an xpmData which is returned
+  */
+-#ifndef NO_ZPIPE
+-	FILE *s_popen(char *cmd, const char *type);
+-#else
+-#	define s_popen popen
+-#endif
+ static int
+ OpenWriteFile(filename, mdata)
+     char *filename;
+     xpmData *mdata;
+ {
+-#ifndef NO_ZPIPE
+-    char buf[BUFSIZ];
+-
+-#endif
+-
+     if (!filename) {
+ 	mdata->stream.file = (stdout);
+ 	mdata->type = XPMFILE;
+     } else {
+ #ifndef NO_ZPIPE
+-	size_t len = strlen(filename);
+-
+-	if(len == 0                        ||
+-	   filename[0] == '/'              ||
+-	   strstr(filename, "../") != NULL ||
+-	   filename[len-1] == '/')
+-		return(XpmOpenFailed);
+-
++	size_t len;
++#endif
++	int fd = open(filename, O_WRONLY|O_CREAT|O_TRUNC, 0644);
++	if ( fd < 0 )
++	    return(XpmOpenFailed);
++#ifndef NO_ZPIPE
++	len = strlen(filename);
+ 	if (len > 2 && !strcmp(".Z", filename + (len - 2))) {
+-	    snprintf(buf, sizeof(buf), "compress > \"%s\"", filename);
+-	    if (!(mdata->stream.file = s_popen(buf, "w")))
+-		return (XpmOpenFailed);
+-
++	    mdata->stream.file = xpmPipeThrough(fd, "compress", NULL, "w");
+ 	    mdata->type = XPMPIPE;
+ 	} else if (len > 3 && !strcmp(".gz", filename + (len - 3))) {
+-	    snprintf(buf, sizeof(buf), "gzip -q > \"%s\"", filename);
+-	    if (!(mdata->stream.file = s_popen(buf, "w")))
+-		return (XpmOpenFailed);
+-
++	    mdata->stream.file = xpmPipeThrough(fd, "gzip", "-q", "w");
+ 	    mdata->type = XPMPIPE;
+-	} else {
++	} else
+ #endif
+-	    if (!(mdata->stream.file = fopen(filename, "w")))
+-		return (XpmOpenFailed);
+-
++	{
++	    mdata->stream.file = fdopen(fd, "w");
+ 	    mdata->type = XPMFILE;
+-#ifndef NO_ZPIPE
+ 	}
+-#endif
++	if (!mdata->stream.file)
++	    return (XpmOpenFailed);
+     }
+     return (XpmSuccess);
+ }
+@@ -417,15 +406,6 @@
+ xpmDataClose(mdata)
+     xpmData *mdata;
+ {
+-    switch (mdata->type) {
+-    case XPMFILE:
+-	if (mdata->stream.file != (stdout))
+-	    fclose(mdata->stream.file);
+-	break;
+-#ifndef NO_ZPIPE
+-    case XPMPIPE:
++    if (mdata->stream.file != (stdout))
+ 	fclose(mdata->stream.file);
+-	break;
+-#endif
+-    }
+ }
diff --git a/nixpkgs/pkgs/development/libraries/lesstif/default.nix b/nixpkgs/pkgs/development/libraries/lesstif/default.nix
new file mode 100644
index 000000000000..b678a0893867
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/lesstif/default.nix
@@ -0,0 +1,28 @@
+{stdenv, fetchurl, xlibsWrapper, libXp, libXau}:
+
+stdenv.mkDerivation rec {
+  name = "lesstif-0.95.2";
+  src = fetchurl {
+    url = "mirror://sourceforge/lesstif/${name}.tar.bz2";
+    sha256 = "1qzpxjjf7ri1jzv71mvq5m9g8hfaj5yzwp30rwxlm6n2b24a6jpb";
+  };
+  buildInputs = [xlibsWrapper];
+  propagatedBuildInputs = [libXp libXau];
+
+  # These patches fix a number of later issues - in particular the
+  # render_table_crash shows up in 'arb'. The same patches appear
+  # in Debian, so we assume they have been sent upstream.
+  #
+  patches = [
+    ./c-missing_xm_h.patch
+    ./c-render_table_crash.patch
+    ./c-xpmpipethrough.patch
+    ];
+
+  meta = with stdenv.lib; {
+    description = "An open source clone of the Motif widget set";
+    homepage = http://lesstif.sourceforge.net;
+    platforms = platforms.unix;
+    license = with licenses; [ gpl2 lgpl2 ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/leveldb/default.nix b/nixpkgs/pkgs/development/libraries/leveldb/default.nix
new file mode 100644
index 000000000000..b18af4cf8344
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/leveldb/default.nix
@@ -0,0 +1,42 @@
+{ stdenv, fetchFromGitHub }:
+
+stdenv.mkDerivation rec {
+  name = "leveldb-${version}";
+  version = "1.20";
+
+  src = fetchFromGitHub {
+    owner = "google";
+    repo = "leveldb";
+    rev = "v${version}";
+    sha256 = "01kxga1hv4wp94agx5vl3ybxfw5klqrdsrb6p6ywvnjmjxm8322y";
+  };
+
+  buildPhase = ''
+    make all
+  '';
+
+  installPhase = (stdenv.lib.optionalString stdenv.isDarwin ''
+    for file in out-shared/*.dylib*; do
+      install_name_tool -id $out/lib/$file $file
+    done
+  '') + # XXX consider removing above after transition to cmake in the next release
+  "
+    mkdir -p $out/{bin,lib,include}
+
+    cp -r include $out
+    mkdir -p $out/include/leveldb/helpers
+    cp helpers/memenv/memenv.h $out/include/leveldb/helpers
+
+    cp out-shared/lib* $out/lib
+    cp out-static/lib* $out/lib
+
+    cp out-static/leveldbutil $out/bin
+  ";
+
+  meta = with stdenv.lib; {
+    homepage = https://github.com/google/leveldb;
+    description = "Fast and lightweight key/value database library by Google";
+    license = licenses.bsd3;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/levmar/default.nix b/nixpkgs/pkgs/development/libraries/levmar/default.nix
new file mode 100644
index 000000000000..b814f077f308
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/levmar/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchurl }:
+        
+stdenv.mkDerivation rec {
+  name = "levmar-2.6";
+
+  src = fetchurl {
+    url = "http://www.ics.forth.gr/~lourakis/levmar/${name}.tgz";
+    sha256 = "1mxsjip9x782z6qa6k5781wjwpvj5aczrn782m9yspa7lhgfzx1v";
+  };
+
+  patchPhase = ''
+    sed -i 's/define HAVE_LAPACK/undef HAVE_LAPACK/' levmar.h
+    sed -i 's/LAPACKLIBS=.*/LAPACKLIBS=/' Makefile
+  '';
+
+  installPhase = ''
+    mkdir -p $out/include $out/lib
+    cp lm.h $out/include
+    cp liblevmar.a $out/lib
+  '';
+
+  meta = { 
+    description = "ANSI C implementations of Levenberg-Marquardt, usable also from C++";
+    homepage = http://www.ics.forth.gr/~lourakis/levmar/;
+    license = stdenv.lib.licenses.gpl2Plus;
+    platforms = stdenv.lib.platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/lib3ds/default.nix b/nixpkgs/pkgs/development/libraries/lib3ds/default.nix
new file mode 100644
index 000000000000..32fecd3d99c1
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/lib3ds/default.nix
@@ -0,0 +1,20 @@
+{ stdenv, fetchurl, unzip }:
+        
+stdenv.mkDerivation rec {
+  name = "lib3ds-1.3.0";
+
+  src = fetchurl {
+    url = "http://lib3ds.googlecode.com/files/${name}.zip";
+    sha256 = "1qr9arfdkjf7q11xhvxwzmhxqz3nhcjkyb8zzfjpz9jm54q0rc7m";
+  };
+
+  buildInputs = [ unzip ];
+
+  meta = { 
+    description = "Library for managing 3D-Studio Release 3 and 4 \".3DS\" files";
+    homepage = http://lib3ds.sourceforge.net/;
+    license = "LGPL";
+    platforms = stdenv.lib.platforms.unix;
+  };
+}
+
diff --git a/nixpkgs/pkgs/development/libraries/lib3mf/default.nix b/nixpkgs/pkgs/development/libraries/lib3mf/default.nix
new file mode 100644
index 000000000000..7e41743e1e0d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/lib3mf/default.nix
@@ -0,0 +1,33 @@
+{ stdenv, fetchFromGitHub, cmake, ninja, libuuid, gtest }:
+
+stdenv.mkDerivation rec {
+  pname = "lib3mf";
+  version = "1.8.1";
+
+  src = fetchFromGitHub {
+    owner = "3MFConsortium";
+    repo = pname;
+    rev = "v${version}";
+    sha256 = "11wpk6n9ga2p57h1dcrp37w77mii0r7r6mlrgmykf7rvii1rzgqd";
+  };
+
+  nativeBuildInputs = [ cmake ninja ];
+
+  buildInputs = [ libuuid ];
+
+  postPatch = ''
+    rmdir UnitTests/googletest
+    ln -s ${gtest.src} UnitTests/googletest
+
+    # fix libdir=''${exec_prefix}/@CMAKE_INSTALL_LIBDIR@
+    sed -i 's,=''${\(exec_\)\?prefix}/,=,' lib3MF.pc.in
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Reference implementation of the 3D Manufacturing Format file standard";
+    homepage = "https://3mf.io/";
+    license = licenses.bsd2;
+    maintainers = with maintainers; [ gebner ];
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libHX/default.nix b/nixpkgs/pkgs/development/libraries/libHX/default.nix
new file mode 100644
index 000000000000..39f493d821c3
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libHX/default.nix
@@ -0,0 +1,30 @@
+{ stdenv, fetchurl, autoconf, automake, libtool }:
+
+stdenv.mkDerivation rec {
+  name = "libHX-3.22";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/libhx/libHX/3.22/${name}.tar.xz";
+    sha256 = "18w39j528lyg2026dr11f2xxxphy91cg870nx182wbd8cjlqf86c";
+  };
+
+  patches = [];
+
+  buildInputs = [ autoconf automake libtool ];
+
+  preConfigure = ''
+    sh autogen.sh
+    '';
+
+  meta = with stdenv.lib; {
+    homepage = http://libhx.sourceforge.net/;
+    longDescription = ''
+      libHX is a C library (with some C++ bindings available) that provides data structures
+      and functions commonly needed, such as maps, deques, linked lists, string formatting
+      and autoresizing, option and config file parsing, type checking casts and more.
+      '';
+    maintainers = [ maintainers.tstrobel ];
+    platforms = platforms.linux;
+    license = with licenses; [ gpl3 lgpl21Plus wtfpl ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libLAS/default.nix b/nixpkgs/pkgs/development/libraries/libLAS/default.nix
new file mode 100644
index 000000000000..15ef9ee890a6
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libLAS/default.nix
@@ -0,0 +1,33 @@
+{ stdenv, fetchurl, boost, cmake, gdal, libgeotiff, libtiff, LASzip, fixDarwinDylibNames }:
+
+stdenv.mkDerivation rec {
+  name = "libLAS-1.8.1";
+
+  src = fetchurl {
+
+    url = "https://download.osgeo.org/liblas/${name}.tar.bz2";
+    sha256 = "0xjfxb3ydvr2258ji3spzyf81g9caap19ql2pk91wiivqsc4mnws";
+  };
+
+  buildInputs = [ boost cmake gdal libgeotiff libtiff LASzip ]
+                ++ stdenv.lib.optional stdenv.isDarwin fixDarwinDylibNames;
+
+  cmakeFlags = [
+    "-DGDAL_CONFIG=${gdal}/bin/gdal-config"
+    "-DWITH_LASZIP=ON"
+    "-DLASZIP_INCLUDE_DIR=${LASzip}/include"
+    "-DCMAKE_EXE_LINKER_FLAGS=-pthread"
+  ];
+
+  postFixup = stdenv.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 ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libaacs/default.nix b/nixpkgs/pkgs/development/libraries/libaacs/default.nix
new file mode 100644
index 000000000000..0d67c6b4dcb2
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libaacs/default.nix
@@ -0,0 +1,30 @@
+{ 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.
+
+# Info on how to use / obtain aacs keys:
+# http://vlc-bluray.whoknowsmy.name/
+# https://wiki.archlinux.org/index.php/BluRay
+
+stdenv.mkDerivation rec {
+  name = "libaacs-${version}";
+  version  = "0.9.0";
+
+  src = fetchurl {
+    url = "http://get.videolan.org/libaacs/${version}/${name}.tar.bz2";
+    sha256 = "1kms92i0c7i1yl659kqjf19lm8172pnpik5lsxp19xphr74vvq27";
+  };
+
+  buildInputs = [ libgcrypt libgpgerror ];
+
+  nativeBuildInputs = [ yacc flex ];
+
+  meta = with stdenv.lib; {
+    homepage = https://www.videolan.org/developers/libaacs.html;
+    description = "Library to access AACS protected Blu-Ray disks";
+    license = licenses.lgpl21;
+    maintainers = with maintainers; [ abbradar ];
+    platforms = with platforms; linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libaal/default.nix b/nixpkgs/pkgs/development/libraries/libaal/default.nix
new file mode 100644
index 000000000000..6df7bc22772f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libaal/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  version = "1.0.6";
+  name = "libaal-${version}";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/reiser4/${name}.tar.gz";
+    sha256 = "176f2sns6iyxv3h9zyirdinjwi05gdak48zqarhib2s38rvm98di";
+  };
+
+  patches = [ ./libaal-1.0.6-glibc-2.26.patch ];
+
+  preInstall = ''
+    substituteInPlace Makefile --replace ./run-ldconfig true
+  '';
+
+  enableParallelBuilding = true;
+
+  meta = {
+    homepage = http://www.namesys.com/;
+    description = "Support library for Reiser4";
+    license = stdenv.lib.licenses.gpl2;
+    maintainers = with stdenv.lib.maintainers; [ fuuzetsu ];
+    platforms = with stdenv.lib.platforms; linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libaal/libaal-1.0.6-glibc-2.26.patch b/nixpkgs/pkgs/development/libraries/libaal/libaal-1.0.6-glibc-2.26.patch
new file mode 100644
index 000000000000..6d49682f03ae
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libaal/libaal-1.0.6-glibc-2.26.patch
@@ -0,0 +1,89 @@
+Date: 2017-09-02 13:03:15.353403096 +0200
+From: Jan Engelhardt <jengelh@inai.de>
+
+Stop redefining libc definitions that cause build failures under glibc-2.26.
+
+[   46s] In file included from /usr/include/sys/types.h:156:0,
+[   46s]                  from /usr/include/stdlib.h:279,
+[   46s]                  from malloc.c:15:
+[   46s] /usr/include/bits/stdint-intn.h:27:19: error: conflicting types for 'int64_t'
+[   46s]  typedef __int64_t int64_t;
+[   46s]                    ^~~~~~~
+[   46s] In file included from ../include/aal/libaal.h:17:0,
+[   46s]                  from malloc.c:6:
+[   46s] ../include/aal/types.h:35:33: note: previous declaration of 'int64_t' was here
+[   46s]  typedef long long int           int64_t;
+
+
+---
+ include/aal/types.h |   48 ++----------------------------------------------
+ 1 file changed, 2 insertions(+), 46 deletions(-)
+
+Index: libaal-1.0.6/include/aal/types.h
+===================================================================
+--- libaal-1.0.6.orig/include/aal/types.h
++++ libaal-1.0.6/include/aal/types.h
+@@ -26,24 +26,7 @@
+ #undef ESTRUCT
+ #define ESTRUCT                 50
+ 
+-#ifndef __int8_t_defined
+-#define __int8_t_defined
+-typedef signed char             int8_t;
+-typedef short int               int16_t;
+-typedef int                     int32_t;
+-__extension__
+-typedef long long int           int64_t;
+-#endif
+- 
+-typedef unsigned char           uint8_t;
+-typedef unsigned short int      uint16_t;
+-#ifndef __uint32_t_defined
+-#define __uint32_t_defined
+-typedef unsigned int            uint32_t;
+-__extension__
+-typedef unsigned long long int  uint64_t;
+-#endif
+-
++#include <stdint.h>
+ #define MAX_UINT8  ((uint8_t)~0)
+ #define MAX_UINT16 ((uint16_t)~0)
+ #define MAX_UINT32 ((uint32_t)~0)
+@@ -53,36 +36,9 @@ typedef unsigned long long int  uint64_t
+    because we don't want use gcc builtins in minimal mode for achive as small
+    binary size as possible. */
+ 
+-#ifndef ENABLE_MINIMAL
+ #  include <stdarg.h>
+-#else
+-#ifndef _VA_LIST_
+-#define _VA_LIST_
+-typedef char *va_list;
+-#endif
+-#undef va_arg
+-#undef va_end
+-#undef va_start
+-
+-#define va_end(ap)       \
+-        do {} while(0);
+-
+-#define va_start(ap, p)  \
+-        (ap = (char *)(&(p)+1))
+-
+-#define va_arg(ap, type) \
+-        ((type *)(ap += sizeof(type)))[-1]
+-#endif
+-
+-/* As libaal may be used without any standard headers, we need to declare NULL
+-   macro here in order to avoid compilation errors. */
+-#undef NULL
+ 
+-#if defined(__cplusplus)
+-#  define NULL 0
+-#else
+-#  define NULL ((void *)0)
+-#endif
++#include <stdio.h>
+ 
+ /* Simple type for direction denoting */
+ enum aal_dir {
diff --git a/nixpkgs/pkgs/development/libraries/libabw/default.nix b/nixpkgs/pkgs/development/libraries/libabw/default.nix
new file mode 100644
index 000000000000..aa4a40cf32dd
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libabw/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchurl, boost, doxygen, gperf, pkgconfig, librevenge, libxml2, perl }:
+
+stdenv.mkDerivation rec {
+  name = "libabw-${version}";
+  version = "0.1.2";
+
+  src = fetchurl {
+    url = "https://dev-www.libreoffice.org/src/libabw/${name}.tar.xz";
+    sha256 = "11949iscdb99f2jplxjd39282jxcrf2fw0sqbh5dl7gqb96r8whb";
+  };
+
+  # Boost 1.59 compatability fix
+  # Attempt removing when updating
+  postPatch = ''
+    sed -i 's,^CPPFLAGS.*,\0 -DBOOST_ERROR_CODE_HEADER_ONLY -DBOOST_SYSTEM_NO_DEPRECATED,' src/lib/Makefile.in
+  '';
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ boost doxygen gperf librevenge libxml2 perl ];
+
+  meta = with stdenv.lib; {
+    homepage = https://wiki.documentfoundation.org/DLP/Libraries/libabw;
+    description = "Library parsing abiword documents";
+    platforms = platforms.unix;
+    license = licenses.mpl20;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libaccounts-glib/default.nix b/nixpkgs/pkgs/development/libraries/libaccounts-glib/default.nix
new file mode 100644
index 000000000000..525ec6e35f60
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libaccounts-glib/default.nix
@@ -0,0 +1,52 @@
+{ stdenv, fetchFromGitLab, meson, ninja, glib, check, python3, vala, gtk-doc, glibcLocales
+, libxml2, libxslt, pkgconfig, sqlite, docbook_xsl, docbook_xml_dtd_43, gobject-introspection }:
+
+stdenv.mkDerivation rec {
+  name = "libaccounts-glib-${version}";
+  version = "1.24";
+
+  outputs = [ "out" "dev" "devdoc" "py" ];
+
+  src = fetchFromGitLab {
+    owner = "accounts-sso";
+    repo = "libaccounts-glib";
+    rev = version;
+    sha256 = "0y8smg1rd279lrr9ad8b499i8pbkajmwd4xn41rdh9h93hs9apn7";
+  };
+
+  # See: https://gitlab.com/accounts-sso/libaccounts-glib/merge_requests/22
+  patches = [ ./py-override.patch ];
+
+  nativeBuildInputs = [ 
+    check
+    docbook_xml_dtd_43
+    docbook_xsl
+    glibcLocales
+    gobject-introspection
+    gtk-doc
+    meson
+    ninja
+    pkgconfig
+    vala
+  ];
+
+  buildInputs = [
+    glib
+    libxml2
+    libxslt
+    python3.pkgs.pygobject3
+    sqlite
+  ];
+
+  LC_ALL = "en_US.UTF-8";
+
+  mesonFlags = [
+    "-Dpy-overrides-dir=${placeholder ''py''}/${python3.sitePackages}/gi/overrides"
+  ];
+
+  meta = with stdenv.lib; {
+    description = "Library for managing accounts which can be used from GLib applications";
+    platforms = platforms.linux;
+    license = licenses.lgpl21;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libaccounts-glib/py-override.patch b/nixpkgs/pkgs/development/libraries/libaccounts-glib/py-override.patch
new file mode 100644
index 000000000000..4179f4fa0af0
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libaccounts-glib/py-override.patch
@@ -0,0 +1,38 @@
+diff --git a/libaccounts-glib/pygobject/meson.build b/libaccounts-glib/pygobject/meson.build
+index fa1f4a0..588c4ce 100644
+--- a/libaccounts-glib/pygobject/meson.build
++++ b/libaccounts-glib/pygobject/meson.build
+@@ -1,11 +1,19 @@
+-python3 = import('python3')
+-python_exec = python3.find_python()
+-python_exec_result = run_command(python_exec, ['-c', 'import gi; from os.path import abspath; print(abspath(gi._overridesdir))'])
++py_override = get_option('py-overrides-dir')
+ 
+-if python_exec_result.returncode() != 0
+-    error('Failed to retreive the python GObject override directory')
++if py_override == ''
++    python3 = import('python3')
++    python_exec = python3.find_python()
++    
++    python_exec_result = run_command(python_exec, ['-c', 'import gi; from os.path import abspath; print(abspath(gi._overridesdir))'])
++
++    if python_exec_result.returncode() != 0
++        error('Failed to retreive the python GObject override directory')
++    endif
++
++    py_override = python_exec_result.stdout().strip()
+ endif
+ 
+-install_data('Accounts.py',
+-    install_dir: join_paths(python_exec_result.stdout().strip())
++install_data(
++    'Accounts.py',
++    install_dir: py_override
+ )
+diff --git a/meson_options.txt  b/meson_options.txt 
+new file mode 100644
+index 0000000..2c33804
+--- /dev/null
++++ b/meson_options.txt 	
+@@ -0,0 +1 @@
++option('py-overrides-dir', type : 'string', value : '', description: 'Path to pygobject overrides directory')
diff --git a/nixpkgs/pkgs/development/libraries/libagar/default.nix b/nixpkgs/pkgs/development/libraries/libagar/default.nix
new file mode 100644
index 000000000000..49e5bcdd9058
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libagar/default.nix
@@ -0,0 +1,43 @@
+{ stdenv, fetchurl, pkgconfig, libtool, perl, bsdbuild, gettext, mandoc
+, libpng, libjpeg, xlibsWrapper, libXinerama, freetype, SDL, libGLU_combined
+, libsndfile, portaudio, mysql, fontconfig
+}:
+
+let srcs = import ./srcs.nix { inherit fetchurl; }; in
+stdenv.mkDerivation rec {
+  name = "libagar-${version}";
+  inherit (srcs) version src;
+
+  preConfigure = ''
+    substituteInPlace configure.in \
+      --replace '_BSD_SOURCE' '_DEFAULT_SOURCE'
+    cat configure.in | ${bsdbuild}/bin/mkconfigure > configure
+  '';
+
+  configureFlags = [
+    "--with-libtool=${libtool}/bin/libtool"
+    "--enable-nls=yes"
+    "--with-gettext=${gettext}"
+    "--with-jpeg=${libjpeg.dev}"
+    "--with-gl=${libGLU_combined}"
+    "--with-mysql=${mysql.connector-c}"
+    "--with-manpages=yes"
+  ];
+
+  outputs = [ "out" "devdoc" ];
+
+  nativeBuildInputs = [ pkgconfig libtool gettext ];
+
+  buildInputs = [
+    bsdbuild perl xlibsWrapper libXinerama SDL libGLU_combined mysql.connector-c mandoc
+    freetype.dev libpng libjpeg.dev fontconfig portaudio libsndfile
+  ];
+
+  meta = with stdenv.lib; {
+    description = "Cross-platform GUI toolkit";
+    homepage = http://libagar.org/index.html;
+    license = with licenses; bsd3;
+    maintainers = with maintainers; [ ramkromberg ];
+    platforms = with platforms; linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libagar/libagar_test.nix b/nixpkgs/pkgs/development/libraries/libagar/libagar_test.nix
new file mode 100644
index 000000000000..c1e9ba7d1c73
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libagar/libagar_test.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchurl, bsdbuild, libagar, perl, libjpeg, libpng, openssl }:
+
+let srcs = import ./srcs.nix { inherit fetchurl; }; in
+stdenv.mkDerivation rec {
+  name = "libagar-test-${version}";
+  inherit (srcs) version src;
+
+  sourceRoot = "agar-1.5.0/tests";
+
+  preConfigure = ''
+    substituteInPlace configure.in \
+      --replace '_BSD_SOURCE' '_DEFAULT_SOURCE'
+    cat configure.in | ${bsdbuild}/bin/mkconfigure > configure
+  '';
+
+  configureFlags = [ "--with-agar=${libagar}" ];
+
+  buildInputs = [ perl bsdbuild libagar libjpeg libpng openssl ];
+
+  meta = with stdenv.lib; {
+    description = "Tests for libagar";
+    homepage = http://libagar.org/index.html;
+    license = with licenses; bsd3;
+    maintainers = with maintainers; [ ramkromberg ];
+    platforms = with platforms; linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libagar/srcs.nix b/nixpkgs/pkgs/development/libraries/libagar/srcs.nix
new file mode 100644
index 000000000000..53c6a5b89dad
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libagar/srcs.nix
@@ -0,0 +1,10 @@
+{ fetchurl }:
+rec {
+  version = "1.5.0";
+
+  src = fetchurl {
+    url = "http://stable.hypertriton.com/agar/agar-${version}.tar.gz";
+    sha256 = "001wcqk5z67qg0raw9zlwmv62drxiwqykvsbk10q2mrc6knjsd42";
+  };
+
+}
diff --git a/nixpkgs/pkgs/development/libraries/libamqpcpp/default.nix b/nixpkgs/pkgs/development/libraries/libamqpcpp/default.nix
new file mode 100644
index 000000000000..cc6c9464de36
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libamqpcpp/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchFromGitHub, openssl }:
+
+stdenv.mkDerivation rec {
+  name = "libamqpcpp-${version}";
+  version = "4.1.3";
+
+  src = fetchFromGitHub {
+    owner = "CopernicaMarketingSoftware";
+    repo = "AMQP-CPP";
+    rev = "v${version}";
+    sha256 = "0qk431ra7vcklc67fdaddrj5a7j50znjr79zrwvhkcfy82fd56zw";
+  };
+
+  buildInputs = [ openssl ];
+
+  patches = [ ./libamqpcpp-darwin.patch ];
+
+  makeFlags = [ "PREFIX=$(out)" ];
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    description = "Library for communicating with a RabbitMQ server";
+    homepage = https://github.com/CopernicaMarketingSoftware/AMQP-CPP;
+    license = licenses.asl20;
+    maintainers = [ maintainers.mjp ];
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libamqpcpp/libamqpcpp-darwin.patch b/nixpkgs/pkgs/development/libraries/libamqpcpp/libamqpcpp-darwin.patch
new file mode 100644
index 000000000000..9f8d700929b4
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libamqpcpp/libamqpcpp-darwin.patch
@@ -0,0 +1,13 @@
+--- a/src/Makefile
++++ b/src/Makefile
+@@ -0,0 +1 @@
++CXX ?= g++
+@@ -43 +44 @@ ${SHARED_LIB}: ${SHARED_OBJECTS}
+-	${LD} ${LD_FLAGS} -Wl,${SONAMEPARAMETER},lib$(LIBRARY_NAME).so.$(SONAME) -o $@ ${SHARED_OBJECTS}
++	${CXX} ${LD_FLAGS} -Wl,${SONAMEPARAMETER},lib$(LIBRARY_NAME).so.$(SONAME) -o $@ ${SHARED_OBJECTS}
+@@ -52 +53 @@ ${SHARED_OBJECTS}:
+-	${CPP} ${CPPFLAGS} -fpic -o $@ ${@:%.o=%.cpp}
++	${CXX} ${CPPFLAGS} -fpic -o $@ ${@:%.o=%.cpp}
+@@ -55 +56 @@ ${STATIC_OBJECTS}:
+-	${CPP} ${CPPFLAGS} -o $@ ${@:%.s.o=%.cpp}
++	${CXX} ${CPPFLAGS} -o $@ ${@:%.s.o=%.cpp}
diff --git a/nixpkgs/pkgs/development/libraries/libantlr3c/default.nix b/nixpkgs/pkgs/development/libraries/libantlr3c/default.nix
new file mode 100644
index 000000000000..28f0ca2905c2
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libantlr3c/default.nix
@@ -0,0 +1,19 @@
+{stdenv, fetchurl}:
+
+stdenv.mkDerivation {
+  name = "libantlr3c-3.4";
+  src = fetchurl {
+    url = https://www.antlr3.org/download/C/libantlr3c-3.4.tar.gz;
+    sha256 ="0lpbnb4dq4azmsvlhp6khq1gy42kyqyjv8gww74g5lm2y6blm4fa";
+  };
+
+  configureFlags = stdenv.lib.optional stdenv.is64bit "--enable-64bit";
+
+  meta = with stdenv.lib; {
+    description = "C runtime libraries of ANTLR v3";
+    homepage = https://www.antlr3.org/;
+    license = licenses.bsd3;
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ vbgl ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libao/default.nix b/nixpkgs/pkgs/development/libraries/libao/default.nix
new file mode 100644
index 000000000000..c1cf3215c16c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libao/default.nix
@@ -0,0 +1,42 @@
+{ stdenv, lib, fetchFromGitHub, autoreconfHook, pkgconfig, libpulseaudio, alsaLib, libcap
+, CoreAudio, CoreServices, AudioUnit, AudioToolbox
+, usePulseAudio }:
+
+stdenv.mkDerivation rec {
+  version = "1.2.2";
+  name = "libao-${version}";
+
+  # the github mirror is more up to date than downloads.xiph.org
+  src = fetchFromGitHub {
+    owner  = "xiph";
+    repo   = "libao";
+    rev    = "${version}";
+    sha256 = "0svgk4sc9kdhcsfyvbvgm5vpbg3sfr6z5rliflrw49v3x2i4vxq5";
+  };
+
+  configureFlags = [
+    "--disable-broken-oss"
+    "--enable-alsa-mmap"
+  ];
+
+  outputs = [ "out" "dev" "man" "doc" ];
+
+  buildInputs = [ ] ++
+    lib.optional  usePulseAudio   libpulseaudio ++
+    lib.optionals stdenv.isLinux  [ alsaLib libcap ] ++
+    lib.optionals stdenv.isDarwin [ CoreAudio CoreServices AudioUnit ];
+
+  nativeBuildInputs = [ autoreconfHook pkgconfig ];
+
+  meta = with stdenv.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
+      platforms.
+    '';
+    homepage = https://xiph.org/ao/;
+    license = licenses.gpl2;
+    maintainers = with maintainers; [ fuuzetsu ];
+    platforms = with platforms; unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libaom/default.nix b/nixpkgs/pkgs/development/libraries/libaom/default.nix
new file mode 100644
index 000000000000..c7d7bfb1e824
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libaom/default.nix
@@ -0,0 +1,34 @@
+{ stdenv, fetchgit, yasm, perl, cmake, pkgconfig, python3, writeText }:
+
+stdenv.mkDerivation rec {
+  name = "libaom-${version}";
+  version = "1.0.0-errata1";
+
+  src = fetchgit {
+    url = "https://aomedia.googlesource.com/aom";
+    rev	= "v${version}";
+    sha256 = "090phh4jl9z6m2pwpfpwcjh6iyw0byngb2n112qxkg6a3gsaa62f";
+  };
+
+  nativeBuildInputs = [
+    yasm perl cmake pkgconfig python3
+  ];
+
+  preConfigure = ''
+    # build uses `git describe` to set the build version
+    cat > $NIX_BUILD_TOP/git << "EOF"
+    #!${stdenv.shell}
+    echo v${version}
+    EOF
+    chmod +x $NIX_BUILD_TOP/git
+    export PATH=$NIX_BUILD_TOP:$PATH
+  '';
+
+  meta = with stdenv.lib; {
+    description = "AV1 Bitstream and Decoding Library";
+    homepage    = https://aomedia.org/av1-features/get-started/;
+    maintainers = with maintainers; [ kiloreux ];
+    platforms   = platforms.all;
+    license = licenses.bsd2;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libaosd/default.nix b/nixpkgs/pkgs/development/libraries/libaosd/default.nix
new file mode 100644
index 000000000000..e63bfd20c797
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libaosd/default.nix
@@ -0,0 +1,36 @@
+{ stdenv, lib, fetchFromGitHub, pkgconfig, cairo, pango,
+  libX11, libXcomposite, autoconf, automake }:
+
+stdenv.mkDerivation rec {
+  version = "0.2.7-9-g177589f";
+  name = "libaosd-${version}";
+
+  src = fetchFromGitHub {
+    owner  = "atheme-legacy";
+    repo   = "libaosd";
+    rev    = "${version}";
+    sha256 = "1cn7k0n74p6jp25kxwcyblhmbdvgw3mikvj0m2jh4c6xccfrgb9a";
+  };
+
+  nativeBuildInputs = [ autoconf automake pkgconfig ];
+  buildInputs = [ cairo pango libX11 libXcomposite ];
+  enableParallelBuilding = true;
+
+  preConfigure = ''
+    ./autogen.sh
+  '';
+
+  meta = with stdenv.lib; {
+    longDescription = ''
+      libaosd is an advanced on screen display library.
+
+      It supports many modern features like anti-aliased text and
+      composited rendering via XComposite, as well as support for
+      rendering Cairo and Pango layouts.
+    '';
+    homepage = https://github.com/atheme-legacy/libaosd;
+    license = licenses.mit;
+    maintainers = with maintainers; [ unode ];
+    platforms = with platforms; unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libappindicator/default.nix b/nixpkgs/pkgs/development/libraries/libappindicator/default.nix
new file mode 100644
index 000000000000..46cc30a8944f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libappindicator/default.nix
@@ -0,0 +1,78 @@
+# TODO: Resolve the issues with the Mono bindings.
+
+{ stdenv, fetchurl, lib, file
+, pkgconfig, autoconf
+, glib, dbus-glib, gtkVersion ? "3"
+, gtk2 ? null, libindicator-gtk2 ? null, libdbusmenu-gtk2 ? null
+, gtk3 ? null, libindicator-gtk3 ? null, libdbusmenu-gtk3 ? null
+, python2Packages, gobject-introspection, vala
+, monoSupport ? false, mono ? null, gtk-sharp-2_0 ? null
+ }:
+
+with lib;
+
+let
+  inherit (python2Packages) python pygobject2 pygtk;
+in stdenv.mkDerivation rec {
+  name = let postfix = if gtkVersion == "2" && monoSupport then "sharp" else "gtk${gtkVersion}";
+          in "libappindicator-${postfix}-${version}";
+  version = "${versionMajor}.${versionMinor}";
+  versionMajor = "12.10";
+  versionMinor = "0";
+
+  src = fetchurl {
+    url = "${meta.homepage}/${versionMajor}/${version}/+download/libappindicator-${version}.tar.gz";
+    sha256 = "17xlqd60v0zllrxp8bgq3k5a1jkj0svkqn8rzllcyjh8k0gpr46m";
+  };
+
+  nativeBuildInputs = [ pkgconfig autoconf ];
+
+  propagatedBuildInputs =
+    if gtkVersion == "2"
+    then [ gtk2 libdbusmenu-gtk2 ]
+    else [ gtk3 libdbusmenu-gtk3 ];
+
+  buildInputs = [
+    glib dbus-glib
+    python pygobject2 pygtk gobject-introspection vala
+  ] ++ (if gtkVersion == "2"
+    then [ libindicator-gtk2 ] ++ optionals monoSupport [ mono gtk-sharp-2_0 ]
+    else [ libindicator-gtk3 ]);
+
+  postPatch = ''
+    substituteInPlace configure.ac \
+      --replace '=codegendir pygtk-2.0' '=codegendir pygobject-2.0'
+    autoconf
+    for f in {configure,ltmain.sh,m4/libtool.m4}; do
+      substituteInPlace $f \
+        --replace /usr/bin/file ${file}/bin/file
+    done
+  '';
+
+  configureFlags = [
+    "CFLAGS=-Wno-error"
+    "--sysconfdir=/etc"
+    "--localstatedir=/var"
+    "--with-gtk=${gtkVersion}"
+  ];
+
+  postConfigure = ''
+    substituteInPlace configure \
+      --replace /usr/bin/file ${file}/bin/file
+  '';
+
+  doCheck = false; # generates shebangs in check phase, too lazy to fix
+
+  installFlags = [
+    "sysconfdir=\${out}/etc"
+    "localstatedir=\${TMPDIR}"
+  ];
+
+  meta = {
+    description = "A library to allow applications to export a menu into the Unity Menu bar";
+    homepage = https://launchpad.net/libappindicator;
+    license = with licenses; [ lgpl21 lgpl3 ];
+    platforms = platforms.linux;
+    maintainers = [ maintainers.msteen ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libarchive/default.nix b/nixpkgs/pkgs/development/libraries/libarchive/default.nix
new file mode 100644
index 000000000000..f2a1c500a8be
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libarchive/default.nix
@@ -0,0 +1,73 @@
+{
+  fetchurl, fetchpatch, stdenv, pkgconfig,
+  acl, attr, bzip2, e2fsprogs, libxml2, lzo, openssl, sharutils, xz, zlib,
+
+  # Optional but increases closure only negligibly.
+  xarSupport ? true,
+}:
+
+assert xarSupport -> libxml2 != null;
+
+stdenv.mkDerivation rec {
+  name = "libarchive-${version}";
+  version = "3.3.3";
+
+  src = fetchurl {
+    url = "${meta.homepage}/downloads/${name}.tar.gz";
+    sha256 = "0bhfncid058p7n1n8v29l6wxm3mhdqfassscihbsxfwz3iwb2zms";
+  };
+
+  patches = [
+    (fetchpatch {
+      # details: https://github.com/libarchive/libarchive/pull/1105
+      name = "cve-2018-1000877.diff"; # CVE-2018-1000877..80
+      url = "https://github.com/libarchive/libarchive/pull/1105.diff";
+      sha256 = "0mxcawfdy9m40mykzwhkl39a6vnh4ypgy0ipcz74qm4bi72x0gyf";
+    })
+    (fetchpatch {
+      # details: https://github.com/libarchive/libarchive/pull/1120
+      name = "cve-2019-1000019_cve-2019-1000020.diff";
+      url = "https://github.com/libarchive/libarchive/pull/1120.diff";
+      sha256 = "1mgx92v8hm7hw9j34nbfriqfkxshh3cy25rhavr7kl7lz4x5a6g4";
+    })
+  ];
+
+  outputs = [ "out" "lib" "dev" ];
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ sharutils zlib bzip2 openssl xz lzo ]
+    ++ stdenv.lib.optionals stdenv.isLinux [ e2fsprogs attr acl ]
+    ++ stdenv.lib.optional xarSupport libxml2;
+
+  # Without this, pkgconfig-based dependencies are unhappy
+  propagatedBuildInputs = stdenv.lib.optionals stdenv.isLinux [ attr acl ];
+
+  configureFlags = stdenv.lib.optional (!xarSupport) "--without-xml2";
+
+  preBuild = if stdenv.isCygwin then ''
+    echo "#include <windows.h>" >> config.h
+  '' else null;
+
+  doCheck = false; # fails
+
+  preFixup = ''
+    sed -i $lib/lib/libarchive.la \
+      -e 's|-lcrypto|-L${openssl.out}/lib -lcrypto|' \
+      -e 's|-llzo2|-L${lzo}/lib -llzo2|'
+  '';
+
+  enableParallelBuilding = true;
+
+  meta = {
+    description = "Multi-format archive and compression library";
+    longDescription = ''
+      This library has code for detecting and reading many archive formats and
+      compressions formats including (but not limited to) tar, shar, cpio, zip, and
+      compressed with gzip, bzip2, lzma, xz, ...
+    '';
+    homepage = http://libarchive.org;
+    license = stdenv.lib.licenses.bsd3;
+    platforms = with stdenv.lib.platforms; all;
+    maintainers = with stdenv.lib.maintainers; [ jcumming ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libargon2/default.nix b/nixpkgs/pkgs/development/libraries/libargon2/default.nix
new file mode 100644
index 000000000000..a1a04a1dd7b2
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libargon2/default.nix
@@ -0,0 +1,41 @@
+{ stdenv, fetchFromGitHub }:
+
+stdenv.mkDerivation rec {
+  name = "libargon2-${version}";
+  version = "20171227";
+
+  src = fetchFromGitHub {
+    owner = "P-H-C";
+    repo = "phc-winner-argon2";
+    rev = "${version}";
+    sha256 = "0sc9zca1anqk41017vjpas4kxi4cbn0zvicv8vj8p2sb2gy94bh8";
+  };
+
+  installPhase = ''
+    runHook preInstall
+    mkdir -p $out/lib/pkgconfig
+    substitute libargon2.pc $out/lib/pkgconfig/libargon2.pc \
+      --replace @UPSTREAM_VER@ "${version}"                 \
+      --replace @HOST_MULTIARCH@ ""                         \
+      --replace 'prefix=/usr' "prefix=$out"
+
+    make install PREFIX=$out
+    ln -s $out/lib/libargon2.so $out/lib/libargon2.so.0
+    runHook postInstall
+  '';
+
+  meta = with stdenv.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
+      Dmitry Khovratovich. Argon2 was declared the winner of the Password
+      Hashing Competition (PHC). There were 24 submissions and 9 finalists.
+      Catena, Lyra2, Makwa and yescrypt were given special recognition. The PHC
+      recommends using Argon2 rather than legacy algorithms.
+    '';
+    homepage = https://www.argon2.com/;
+    license = with licenses; [ asl20 cc0 ];
+    maintainers = with maintainers; [ taeer olynch ];
+    platforms = platforms.linux ++ platforms.darwin;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libasr/default.nix b/nixpkgs/pkgs/development/libraries/libasr/default.nix
new file mode 100644
index 000000000000..a06ae978d515
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libasr/default.nix
@@ -0,0 +1,21 @@
+{ stdenv, fetchurl, libevent, openssl }:
+
+stdenv.mkDerivation rec {
+  name = "libasr-${version}";
+  version=  "1.0.2";
+
+  src = fetchurl {
+    url = "https://www.opensmtpd.org/archives/${name}.tar.gz";
+    sha256 = "0d4blm0kzdhb75fq8sbcpvkc25lv5dbjaxa2ldniaf39633d3xd6";
+  };
+
+  buildInputs = [ libevent openssl ];
+
+  meta = with stdenv.lib; {
+    homepage = https://github.com/OpenSMTPD/libasr;
+    description = "Free, simple and portable asynchronous resolver library";
+    license = licenses.isc;
+    maintainers = [ maintainers.koral ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libass/default.nix b/nixpkgs/pkgs/development/libraries/libass/default.nix
new file mode 100644
index 000000000000..d7ebf781a049
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libass/default.nix
@@ -0,0 +1,53 @@
+{ stdenv, fetchurl, pkgconfig, yasm
+, freetype, fribidi
+, encaSupport ? true, enca ? null # enca support
+, fontconfigSupport ? true, fontconfig ? null # fontconfig support
+, harfbuzzSupport ? true, harfbuzz ? null # harfbuzz support
+, rasterizerSupport ? false # Internal rasterizer
+, largeTilesSupport ? false # Use larger tiles in the rasterizer
+, libiconv
+}:
+
+assert encaSupport -> enca != null;
+assert fontconfigSupport -> fontconfig != null;
+assert harfbuzzSupport -> harfbuzz != null;
+
+let
+  mkFlag = optSet: flag: if optSet then "--enable-${flag}" else "--disable-${flag}";
+in
+
+with stdenv.lib;
+stdenv.mkDerivation rec {
+  name = "libass-${version}";
+  version = "0.14.0";
+
+  src = fetchurl {
+    url = "https://github.com/libass/libass/releases/download/${version}/${name}.tar.xz";
+    sha256 = "18iqznl4mabhj9ywfsz4kwvbsplcv1jjxq50nxssvbj8my1267w8";
+  };
+
+  configureFlags = [
+    (mkFlag encaSupport "enca")
+    (mkFlag fontconfigSupport "fontconfig")
+    (mkFlag harfbuzzSupport "harfbuzz")
+    (mkFlag rasterizerSupport "rasterizer")
+    (mkFlag largeTilesSupport "large-tiles")
+  ];
+
+  nativeBuildInputs = [ pkgconfig yasm ];
+
+  buildInputs = [ freetype fribidi ]
+    ++ optional encaSupport enca
+    ++ optional fontconfigSupport fontconfig
+    ++ optional harfbuzzSupport harfbuzz
+    ++ optional stdenv.isDarwin libiconv;
+
+  meta = {
+    description = "Portable ASS/SSA subtitle renderer";
+    homepage    = https://github.com/libass/libass;
+    license     = licenses.isc;
+    platforms   = platforms.unix;
+    maintainers = with maintainers; [ codyopel ];
+    repositories.git = git://github.com/libass/libass.git;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libassuan/default.nix b/nixpkgs/pkgs/development/libraries/libassuan/default.nix
new file mode 100644
index 000000000000..d55c38168686
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libassuan/default.nix
@@ -0,0 +1,42 @@
+{ fetchurl, stdenv, gettext, npth, libgpgerror, buildPackages }:
+
+stdenv.mkDerivation rec {
+  pname = "libassuan";
+  version = "2.5.3";
+
+  src = fetchurl {
+    url = "mirror://gnupg/${pname}/${pname}-${version}.tar.bz2";
+    sha256 = "00p7cpvzf0q3qwcgg51r9d0vbab4qga2xi8wpk2fgd36710b1g4i";
+  };
+
+  outputs = [ "out" "dev" "info" ];
+  outputBin = "dev"; # libassuan-config
+
+  depsBuildBuild = [ buildPackages.stdenv.cc ];
+  buildInputs = [ npth gettext ];
+
+  configureFlags = [
+    "--with-libgpg-error-prefix=${libgpgerror.dev}"
+  ];
+
+  doCheck = true;
+
+  # Make sure includes are fixed for callers who don't use libassuan-config
+  postInstall = ''
+    sed -i 's,#include <gpg-error.h>,#include "${libgpgerror.dev}/include/gpg-error.h",g' $dev/include/assuan.h
+  '';
+
+  meta = with stdenv.lib; {
+    description = "IPC library used by GnuPG and related software";
+    longDescription = ''
+      Libassuan is a small library implementing the so-called Assuan
+      protocol.  This protocol is used for IPC between most newer
+      GnuPG components.  Both, server and client side functions are
+      provided.
+    '';
+    homepage = http://gnupg.org;
+    license = licenses.lgpl2Plus;
+    platforms = platforms.all;
+    maintainers = [ maintainers.erictapen ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libast/default.nix b/nixpkgs/pkgs/development/libraries/libast/default.nix
new file mode 100644
index 000000000000..313cb7f8d5dc
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libast/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, fetchurl
+, pkgconfig }:
+
+stdenv.mkDerivation rec {
+  name = "libast-${version}";
+  version = "0.7.1";
+
+  src = fetchurl {
+    url = "http://www.eterm.org/download/${name}.tar.gz";
+    sha256 = "1w7bs46r4lykfd83kc3bg9i1rxzzlb4ydk23ikf8mx8avz05q1aj";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+
+  meta = with stdenv.lib; {
+    description = "Library of Assorted Spiffy Things";
+    homepage = https://www.eterm.org;
+    license = licenses.bsd2;
+    maintainers = [ maintainers.AndersonTorres ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libasyncns/default.nix b/nixpkgs/pkgs/development/libraries/libasyncns/default.nix
new file mode 100644
index 000000000000..f7805c9f375f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libasyncns/default.nix
@@ -0,0 +1,17 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "libasyncns-0.8";
+
+  src = fetchurl {
+    url = "http://0pointer.de/lennart/projects/libasyncns/${name}.tar.gz";
+    sha256 = "0x5b6lcic4cd7q0bx00x93kvpyzl7n2abbgvqbrlzrfb8vknc6jg";
+  };
+
+  meta = with stdenv.lib; {
+    homepage = http://0pointer.de/lennart/projects/libasyncns/;
+    description = "A C library for Linux/Unix for executing name service queries asynchronously";
+    license = licenses.lgpl21;
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libatomic_ops/default.nix b/nixpkgs/pkgs/development/libraries/libatomic_ops/default.nix
new file mode 100644
index 000000000000..0df8ed0f9699
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libatomic_ops/default.nix
@@ -0,0 +1,30 @@
+{ stdenv, fetchurl, autoconf, automake, libtool }:
+
+stdenv.mkDerivation rec {
+  name = "libatomic_ops-${version}";
+  version = "7.6.10";
+
+  src = fetchurl {
+    urls = [
+      "http://www.ivmaisoft.com/_bin/atomic_ops/libatomic_ops-${version}.tar.gz"
+      "https://github.com/ivmai/libatomic_ops/releases/download/v${version}/libatomic_ops-${version}.tar.gz"
+    ];
+    sha256 = "1bwry043f62pc4mgdd37zx3fif19qyrs8f5bw7qxlmkzh5hdyzjq";
+  };
+
+  outputs = [ "out" "dev" "doc" ];
+
+  nativeBuildInputs = stdenv.lib.optionals stdenv.isCygwin [ autoconf automake libtool ];
+
+  preConfigure = stdenv.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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libaudclient/default.nix b/nixpkgs/pkgs/development/libraries/libaudclient/default.nix
new file mode 100644
index 000000000000..eebe667badb9
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libaudclient/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, fetchurl, pkgconfig, glib, dbus-glib }:
+
+stdenv.mkDerivation rec {
+  name = "libaudclient-3.5-rc2";
+  version = "3.5-rc2";
+
+  src = fetchurl {
+    url = "https://distfiles.audacious-media-player.org/${name}.tar.bz2";
+    sha256 = "0nhpgz0kg8r00z54q5i96pjk7s57krq3fvdypq496c7fmlv9kdap";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ glib dbus-glib ];
+
+  meta = with stdenv.lib; {
+    description = "Legacy D-Bus client library for Audacious";
+    homepage = https://audacious-media-player.org/;
+    license = licenses.bsd2;
+    maintainers = with maintainers; [ pSub ];
+    platforms = with platforms; unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libav/default.nix b/nixpkgs/pkgs/development/libraries/libav/default.nix
new file mode 100644
index 000000000000..1ef453f24cdb
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libav/default.nix
@@ -0,0 +1,131 @@
+{ stdenv, fetchurl, pkgconfig, yasm, bzip2, zlib, perl, bash
+, mp3Support    ? true,   lame      ? null
+, speexSupport  ? true,   speex     ? null
+, theoraSupport ? true,   libtheora ? null
+, vorbisSupport ? true,   libvorbis ? null
+, vpxSupport    ? true,   libvpx    ? null
+, x264Support   ? false,  x264      ? null
+, xvidSupport   ? true,   xvidcore  ? null
+, faacSupport   ? false,  faac      ? null
+, vaapiSupport  ? true,   libva     ? null
+, vdpauSupport  ? true,   libvdpau  ? null
+, freetypeSupport ? true, freetype  ? null # it's small and almost everywhere
+, SDL # only for avplay in $bin, adds nontrivial closure to it
+, enableGPL ? true # ToDo: some additional default stuff may need GPL
+, enableUnfree ? faacSupport
+}:
+
+assert faacSupport -> enableUnfree;
+
+let inherit (stdenv.lib) optional hasPrefix enableFeature; in
+
+/* ToDo:
+    - more deps, inspiration: https://packages.ubuntu.com/raring/libav-tools
+    - maybe do some more splitting into outputs
+*/
+
+let
+  result = {
+    # e.g. https://libav.org/releases/libav-11.11.tar.xz.sha1
+    libav_0_8 = libavFun "0.8.21" "d858f65128dad0bac1a8c3a51e5cbb27a7c79b3f";
+    libav_11  = libavFun "11.12"  "61d5dcab5fde349834af193a572b12a5fd6a4d42";
+    libav_12  = libavFun "12.3"   "386c18c8b857f23dfcf456ce40370716130211d9";
+  };
+
+  libavFun = version : sha1 : stdenv.mkDerivation rec {
+    name = "libav-${version}";
+
+    src = fetchurl {
+      url = "${meta.homepage}/releases/${name}.tar.xz";
+      inherit sha1; # upstream directly provides sha1 of releases over https
+    };
+
+    patches = []
+      ++ optional (vpxSupport && hasPrefix "0.8." version) ./vpxenc-0.8.17-libvpx-1.5.patch
+      ;
+
+    postPatch = ''
+      patchShebangs .
+      # another shebang was hidden in a here document text
+      substituteInPlace ./configure --replace "#! /bin/sh" "#!${bash}/bin/sh"
+    '';
+
+    configurePlatforms = [];
+    configureFlags = assert stdenv.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
+      "--disable-avserver" # upstream says it's in a bad state
+      "--enable-avplay"
+      "--enable-shared"
+      "--enable-runtime-cpudetect"
+      "--cc=cc"
+      (enableFeature enableGPL "gpl")
+      (enableFeature enableGPL "swscale")
+      (enableFeature mp3Support "libmp3lame")
+      (enableFeature mp3Support "libmp3lame")
+      (enableFeature speexSupport "libspeex")
+      (enableFeature theoraSupport "libtheora")
+      (enableFeature vorbisSupport "libvorbis")
+      (enableFeature vpxSupport "libvpx")
+      (enableFeature x264Support "libx264")
+      (enableFeature xvidSupport "libxvid")
+      (enableFeature faacSupport "libfaac")
+      (enableFeature faacSupport "nonfree")
+      (enableFeature vaapiSupport "vaapi")
+      (enableFeature vdpauSupport "vdpau")
+      (enableFeature freetypeSupport "libfreetype")
+    ] ++ optional (stdenv.hostPlatform != stdenv.buildPlatform) [
+      "--cross-prefix=${stdenv.cc.targetPrefix}"
+      "--enable-cross-compile"
+    ];
+
+  nativeBuildInputs = [ pkgconfig perl ];
+    buildInputs = [ lame yasm zlib bzip2 SDL bash ]
+      ++ [ perl ] # for install-man target
+      ++ optional mp3Support lame
+      ++ optional speexSupport speex
+      ++ optional theoraSupport libtheora
+      ++ optional vorbisSupport libvorbis
+      ++ optional vpxSupport libvpx
+      ++ optional x264Support x264
+      ++ optional xvidSupport xvidcore
+      ++ optional faacSupport faac
+      ++ optional vaapiSupport libva
+      ++ optional vdpauSupport libvdpau
+      ++ optional freetypeSupport freetype
+      ;
+
+    enableParallelBuilding = true;
+
+    outputs = [ "bin" "dev" "out" ];
+    setOutputFlags = false;
+
+    # alltools to build smaller tools, incl. aviocat, ismindex, qt-faststart, etc.
+    buildFlags = "all alltools install-man";
+
+
+    postInstall = ''
+      moveToOutput bin "$bin"
+      # alltools target compiles an executable in tools/ for every C
+      # source file in tools/, so move those to $out
+      for tool in $(find tools -type f -executable); do
+        mv "$tool" "$bin/bin/"
+      done
+    '';
+
+    doInstallCheck = false; # fails randomly
+    installCheckTarget = "check"; # tests need to be run *after* installation
+
+    passthru = { inherit vdpauSupport; };
+
+    meta = with stdenv.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?
+        else if enableGPL then gpl2Plus else lgpl21Plus;
+      platforms = with platforms; linux ++ darwin;
+    };
+  }; # libavFun
+
+in result
diff --git a/nixpkgs/pkgs/development/libraries/libav/vpxenc-0.8.17-libvpx-1.5.patch b/nixpkgs/pkgs/development/libraries/libav/vpxenc-0.8.17-libvpx-1.5.patch
new file mode 100644
index 000000000000..456828c025ef
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libav/vpxenc-0.8.17-libvpx-1.5.patch
@@ -0,0 +1,22 @@
+--- a/libavcodec/libvpxenc.c	2016-05-01 17:57:16.753852614 +0200
++++ b/libavcodec/libvpxenc.c	2016-05-01 18:01:08.252147138 +0200
+@@ -67,19 +67,11 @@
+ 
+ /** String mappings for enum vp8e_enc_control_id */
+ static const char *ctlidstr[] = {
+-    [VP8E_UPD_ENTROPY]           = "VP8E_UPD_ENTROPY",
+-    [VP8E_UPD_REFERENCE]         = "VP8E_UPD_REFERENCE",
+-    [VP8E_USE_REFERENCE]         = "VP8E_USE_REFERENCE",
+-    [VP8E_SET_ROI_MAP]           = "VP8E_SET_ROI_MAP",
+-    [VP8E_SET_ACTIVEMAP]         = "VP8E_SET_ACTIVEMAP",
+-    [VP8E_SET_SCALEMODE]         = "VP8E_SET_SCALEMODE",
+     [VP8E_SET_CPUUSED]           = "VP8E_SET_CPUUSED",
+     [VP8E_SET_ENABLEAUTOALTREF]  = "VP8E_SET_ENABLEAUTOALTREF",
+     [VP8E_SET_NOISE_SENSITIVITY] = "VP8E_SET_NOISE_SENSITIVITY",
+-    [VP8E_SET_SHARPNESS]         = "VP8E_SET_SHARPNESS",
+     [VP8E_SET_STATIC_THRESHOLD]  = "VP8E_SET_STATIC_THRESHOLD",
+     [VP8E_SET_TOKEN_PARTITIONS]  = "VP8E_SET_TOKEN_PARTITIONS",
+-    [VP8E_GET_LAST_QUANTIZER]    = "VP8E_GET_LAST_QUANTIZER",
+     [VP8E_SET_ARNR_MAXFRAMES]    = "VP8E_SET_ARNR_MAXFRAMES",
+     [VP8E_SET_ARNR_STRENGTH]     = "VP8E_SET_ARNR_STRENGTH",
+     [VP8E_SET_ARNR_TYPE]         = "VP8E_SET_ARNR_TYPE",
diff --git a/nixpkgs/pkgs/development/libraries/libavc1394/default.nix b/nixpkgs/pkgs/development/libraries/libavc1394/default.nix
new file mode 100644
index 000000000000..726e9573d374
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libavc1394/default.nix
@@ -0,0 +1,20 @@
+{ stdenv, fetchurl, pkgconfig, libraw1394 }:
+
+stdenv.mkDerivation rec {
+  name = "libavc1394-0.5.4";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/libavc1394/${name}.tar.gz";
+    sha256 = "0lsv46jdqvdx5hx92v0z2cz3yh6212pz9gk0k3513sbaa04zzcbw";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  propagatedBuildInputs = [ libraw1394 ];
+
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libb2/default.nix b/nixpkgs/pkgs/development/libraries/libb2/default.nix
new file mode 100644
index 000000000000..6a7720b99bcc
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libb2/default.nix
@@ -0,0 +1,32 @@
+{ stdenv, fetchFromGitHub, autoconf, automake, libtool, pkg-config }:
+
+stdenv.mkDerivation rec {
+  name = "libb2-${version}";
+  version = "0.98.1";
+
+  src = fetchFromGitHub {
+    owner = "BLAKE2";
+    repo = "libb2";
+    rev = "v${version}";
+    sha256 = "0qj8aaqvfcavj1vj5asm4pqm03ap7q8x4c2fy83cqggvky0frgya";
+  };
+
+  preConfigure = ''
+    patchShebangs autogen.sh
+    ./autogen.sh
+  '';
+
+  configureFlags = stdenv.lib.optional stdenv.hostPlatform.isx86 "--enable-fat=yes";
+
+  nativeBuildInputs = [ autoconf automake libtool pkg-config ];
+
+  doCheck = true;
+
+  meta = with stdenv.lib; {
+    description = "The BLAKE2 family of cryptographic hash functions";
+    homepage = https://blake2.net/;
+    platforms = platforms.all;
+    maintainers = with maintainers; [ dfoxfranke dotlambda ];
+    license = licenses.cc0;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libb64/default.nix b/nixpkgs/pkgs/development/libraries/libb64/default.nix
new file mode 100644
index 000000000000..09c5444a6446
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libb64/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchurl, unzip }:
+
+stdenv.mkDerivation rec {
+  name = "libb64-${version}";
+  version = "1.2";
+
+  src = fetchurl {
+    url = "http://download.draios.com/dependencies/libb64-1.2.src.zip";
+    sha256 = "1lxzi6v10qsl2r6633dx0zwqyvy0j19nmwclfd0d7qybqmhqsg9l";
+  };
+
+  buildInputs = [ unzip ];
+
+  installPhase = ''
+    mkdir -p $out $out/lib $out/bin $out/include
+    cp -r include/* $out/include/
+    cp base64/base64 $out/bin/
+    cp src/libb64.a src/cencode.o src/cdecode.o $out/lib/
+  '';
+
+  meta = {
+    inherit version;
+    description = "ANSI C routines for fast base64 encoding/decoding";
+    license = stdenv.lib.licenses.publicDomain;
+    platforms = stdenv.lib.platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libbap/default.nix b/nixpkgs/pkgs/development/libraries/libbap/default.nix
new file mode 100644
index 000000000000..2a129bc648f0
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libbap/default.nix
@@ -0,0 +1,30 @@
+{ stdenv, fetchFromGitHub, bap, ocaml, findlib, ctypes, autoreconfHook,
+  which }:
+
+stdenv.mkDerivation rec {
+  name = "libbap-${version}";
+  version = "master-2019-04-05";
+
+  src = fetchFromGitHub {
+    owner = "BinaryAnalysisPlatform";
+    repo = "bap-bindings";
+    rev = "1a89db62f1239a15d310b400f74e151c0a64f37f";
+    sha256 = "0mln9adjgxzhjmjayq06ahgiay4vj5kmnzdxqz3nsik9h3npycd6";
+  };
+
+  nativeBuildInputs = [ autoreconfHook which ];
+  buildInputs = [ ocaml bap findlib ctypes ];
+
+  preInstall = ''
+    mkdir -p $out/lib
+    mkdir -p $out/include
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = https://github.com/binaryanalysisplatform/bap-bindings;
+    description = "A C library for interacting with BAP";
+    maintainers = [ maintainers.maurer ];
+    platforms = platforms.unix;
+    license = licenses.mit;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libbdplus/default.nix b/nixpkgs/pkgs/development/libraries/libbdplus/default.nix
new file mode 100644
index 000000000000..3a1b77525143
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libbdplus/default.nix
@@ -0,0 +1,30 @@
+{ 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.
+
+# Info on how to use / obtain aacs keys:
+# http://vlc-bluray.whoknowsmy.name/
+# https://wiki.archlinux.org/index.php/BluRay
+
+stdenv.mkDerivation rec {
+  name = "libbdplus-${version}";
+  version  = "0.1.2";
+
+  src = fetchurl {
+    url = "http://get.videolan.org/libbdplus/${version}/${name}.tar.bz2";
+    sha256 = "02n87lysqn4kg2qk7d1ffrp96c44zkdlxdj0n16hbgrlrpiwlcd6";
+  };
+
+  buildInputs = [ libgcrypt libgpgerror gettext ];
+
+  nativeBuildInputs = [ ];
+
+  meta = with stdenv.lib; {
+    homepage = http://www.videolan.org/developers/libbdplus.html;
+    description = "Library to access BD+ protected Blu-Ray disks";
+    license = licenses.lgpl21;
+    maintainers = with maintainers; [ abbradar ];
+    platforms = with platforms; unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libbfd/default.nix b/nixpkgs/pkgs/development/libraries/libbfd/default.nix
new file mode 100644
index 000000000000..64b3832d3353
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libbfd/default.nix
@@ -0,0 +1,59 @@
+{ stdenv
+, fetchpatch, gnu-config, autoreconfHook, bison, binutils-unwrapped
+, libiberty, zlib
+}:
+
+stdenv.mkDerivation rec {
+  name = "libbfd-${version}";
+  inherit (binutils-unwrapped) version src;
+
+  outputs = [ "out" "dev" ];
+
+  patches = binutils-unwrapped.patches ++ [
+    ../../tools/misc/binutils/build-components-separately.patch
+    (fetchpatch {
+      url = "https://raw.githubusercontent.com/mxe/mxe/e1d4c144ee1994f70f86cf7fd8168fe69bd629c6/src/bfd-1-disable-subdir-doc.patch";
+      sha256 = "0pzb3i74d1r7lhjan376h59a7kirw15j7swwm8pz3zy9lkdqkj6q";
+    })
+  ];
+
+  # We just want to build libbfd
+  postPatch = ''
+    cd bfd
+  '';
+
+  postAutoreconf = ''
+    echo "Updating config.guess and config.sub from ${gnu-config}"
+    cp -f ${gnu-config}/config.{guess,sub} ../
+  '';
+
+  # We update these ourselves
+  dontUpdateAutotoolsGnuConfigScripts = true;
+
+  nativeBuildInputs = [ autoreconfHook bison ];
+  buildInputs = [ libiberty zlib ];
+
+  configurePlatforms = [ "build" "host" ];
+  configureFlags = [
+    "--enable-targets=all" "--enable-64-bit-bfd"
+    "--enable-install-libbfd"
+    "--enable-shared"
+    "--with-system-zlib"
+  ];
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    description = "A library for manipulating containers of machine code";
+    longDescription = ''
+      BFD is a library which provides a single interface to read and write
+      object files, executables, archive files, and core files in any format.
+      It is associated with GNU Binutils, and elsewhere often distributed with
+      it.
+    '';
+    homepage = https://www.gnu.org/software/binutils/;
+    license = licenses.gpl3Plus;
+    maintainers = with maintainers; [ ericson2314 ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libbladeRF/default.nix b/nixpkgs/pkgs/development/libraries/libbladeRF/default.nix
new file mode 100644
index 000000000000..d908a8af85da
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libbladeRF/default.nix
@@ -0,0 +1,61 @@
+{ stdenv, lib, fetchFromGitHub, fetchpatch, pkgconfig, cmake, git, doxygen, help2man, ncurses, tecla
+, libusb1, udev }:
+
+let
+  # fetch submodule
+  noos = fetchFromGitHub {
+    owner = "analogdevicesinc";
+    repo = "no-OS";
+    rev = "0bba46e6f6f75785a65d425ece37d0a04daf6157";
+    sha256 = "0is79dhsyp9xmlnfdr1i5s1c22ipjafk9d35jpn5dynpvj86m99c";
+  };
+
+  version = "2.2.0";
+
+in stdenv.mkDerivation {
+  name = "libbladeRF-${version}";
+
+  src = fetchFromGitHub {
+    owner = "Nuand";
+    repo = "bladeRF";
+    rev = "libbladeRF_v${version}";
+    sha256 = "0mdj5dkqg69gp0xw6gkhp86nxnm9g7az5rplnncxkp4p1kr35rnl";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  # ncurses used due to https://github.com/Nuand/bladeRF/blob/ab4fc672c8bab4f8be34e8917d3f241b1d52d0b8/host/utilities/bladeRF-cli/CMakeLists.txt#L208
+  buildInputs = [ cmake git doxygen help2man tecla libusb1 ]
+    ++ lib.optionals stdenv.isLinux [ udev ]
+    ++ lib.optionals stdenv.isDarwin [ ncurses ];
+
+
+  postUnpack = ''
+    cp -r ${noos}/* source/thirdparty/analogdevicesinc/no-OS/
+  '';
+
+  # Fixup shebang
+  prePatch = "patchShebangs host/utilities/bladeRF-cli/src/cmd/doc/generate.bash";
+
+  # Let us avoid nettools as a dependency.
+  postPatch = ''
+    sed -i 's/$(hostname)/hostname/' host/utilities/bladeRF-cli/src/cmd/doc/generate.bash
+  '';
+
+  cmakeFlags = [
+    "-DBUILD_DOCUMENTATION=ON"
+  ] ++ lib.optionals stdenv.isLinux [
+    "-DUDEV_RULES_PATH=etc/udev/rules.d"
+    "-DINSTALL_UDEV_RULES=ON"
+    "-DBLADERF_GROUP=bladerf"
+  ];
+
+  hardeningDisable = [ "fortify" ];
+
+  meta = with lib; {
+    homepage = https://nuand.com/libbladeRF-doc;
+    description = "Supporting library of the BladeRF SDR opensource hardware";
+    license = licenses.lgpl21;
+    maintainers = with maintainers; [ funfunctor ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libblockdev/default.nix b/nixpkgs/pkgs/development/libraries/libblockdev/default.nix
new file mode 100644
index 000000000000..a807e3998273
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libblockdev/default.nix
@@ -0,0 +1,46 @@
+{ stdenv, fetchFromGitHub, substituteAll, autoreconfHook, pkgconfig, gtk-doc, libxslt, docbook_xsl
+, docbook_xml_dtd_43, python3, gobject-introspection, glib, udev, kmod, parted, gptfdisk, libyaml
+, cryptsetup, lvm2, dmraid, utillinux, libbytesize, libndctl, nss, volume_key
+}:
+
+let
+  version = "2.20";
+in stdenv.mkDerivation rec {
+  name = "libblockdev-${version}";
+
+  src = fetchFromGitHub {
+    owner = "storaged-project";
+    repo = "libblockdev";
+    rev = "${version}-1";
+    sha256 = "13xy8vx2dnnxczpnwapchc5ncigcxb2fhpmrmglbpkjqmhn2zbdj";
+  };
+
+  outputs = [ "out" "dev" "devdoc" ];
+
+  patches = [
+    (substituteAll {
+      src = ./fix-paths.patch;
+      sgdisk = "${gptfdisk}/bin/sgdisk";
+    })
+  ];
+
+  postPatch = ''
+    patchShebangs scripts
+  '';
+
+  nativeBuildInputs = [
+    autoreconfHook pkgconfig gtk-doc libxslt docbook_xsl docbook_xml_dtd_43 python3 gobject-introspection
+  ];
+
+  buildInputs = [
+    glib udev kmod parted gptfdisk cryptsetup lvm2 dmraid utillinux libbytesize libndctl nss volume_key libyaml
+  ];
+
+  meta = with stdenv.lib; {
+    description = "A library for manipulating block devices";
+    homepage = http://storaged.org/libblockdev/;
+    license = licenses.lgpl2Plus; # lgpl2Plus for the library, gpl2Plus for the utils
+    maintainers = with maintainers; [];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libblockdev/fix-paths.patch b/nixpkgs/pkgs/development/libraries/libblockdev/fix-paths.patch
new file mode 100644
index 000000000000..85822165d8c5
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libblockdev/fix-paths.patch
@@ -0,0 +1,47 @@
+--- a/src/plugins/part.c
++++ b/src/plugins/part.c
+@@ -146,7 +146,7 @@ static GMutex deps_check_lock;
+ #define DEPS_LAST 2
+ 
+ static const UtilDep deps[DEPS_LAST] = {
+-    {"sgdisk", "0.8.6", NULL, "GPT fdisk \\(sgdisk\\) version ([\\d\\.]+)"},
++    {"@sgdisk@", "0.8.6", NULL, "GPT fdisk \\(sgdisk\\) version ([\\d\\.]+)"},
+     {"sfdisk", NULL, NULL, NULL},
+ };
+ 
+@@ -355,7 +355,7 @@ gboolean bd_part_create_table (const gchar *disk, BDPartTableType type, gboolean
+ }
+ 
+ static gchar* get_part_type_guid_and_gpt_flags (const gchar *device, int part_num, guint64 *flags, GError **error) {
+-    const gchar *args[4] = {"sgdisk", NULL, device, NULL};
++    const gchar *args[4] = {"@sgdisk@", NULL, device, NULL};
+     gchar *output = NULL;
+     gchar **lines = NULL;
+     gchar **line_p = NULL;
+@@ -1325,7 +1325,7 @@ gboolean bd_part_resize_part (const gchar *disk, const gchar *part, guint64 size
+ 
+ 
+ static gboolean set_gpt_flag (const gchar *device, int part_num, BDPartFlag flag, gboolean state, GError **error) {
+-    const gchar *args[5] = {"sgdisk", "--attributes", NULL, device, NULL};
++    const gchar *args[5] = {"@sgdisk@", "--attributes", NULL, device, NULL};
+     int bit_num = 0;
+     gboolean success = FALSE;
+ 
+@@ -1351,7 +1351,7 @@ static gboolean set_gpt_flag (const gchar *device, int part_num, BDPartFlag flag
+ }
+ 
+ static gboolean set_gpt_flags (const gchar *device, int part_num, guint64 flags, GError **error) {
+-    const gchar *args[5] = {"sgdisk", "--attributes", NULL, device, NULL};
++    const gchar *args[5] = {"@sgdisk@", "--attributes", NULL, device, NULL};
+     guint64 real_flags = 0;
+     gchar *mask_str = NULL;
+     gboolean success = FALSE;
+@@ -1791,7 +1791,7 @@ gboolean bd_part_set_part_name (const gchar *disk, const gchar *part, const gcha
+  * Tech category: %BD_PART_TECH_GPT-%BD_PART_TECH_MODE_MODIFY_PART
+  */
+ gboolean bd_part_set_part_type (const gchar *disk, const gchar *part, const gchar *type_guid, GError **error) {
+-    const gchar *args[5] = {"sgdisk", "--typecode", NULL, disk, NULL};
++    const gchar *args[5] = {"@sgdisk@", "--typecode", NULL, disk, NULL};
+     const gchar *part_num_str = NULL;
+     gboolean success = FALSE;
+     guint64 progress_id = 0;
diff --git a/nixpkgs/pkgs/development/libraries/libblocksruntime/default.nix b/nixpkgs/pkgs/development/libraries/libblocksruntime/default.nix
new file mode 100644
index 000000000000..7863e596e1b8
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libblocksruntime/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchFromGitHub, clang }:
+
+stdenv.mkDerivation {
+  name = "blocksruntime-20140624";
+
+  src = fetchFromGitHub {
+    owner = "mackyle";
+    repo = "blocksruntime";
+    rev = "b5c5274daf1e0e46ecc9ad8f6f69889bce0a0a5d";
+    sha256 = "0ic4lagagkylcvwgf10mg0s1i57h4i25ds2fzvms22xj4zwzk1sd";
+  };
+
+  buildInputs = [ clang ];
+
+  configurePhase = ''
+    export CC=clang
+    export CXX=clang++
+  '';
+
+  buildPhase = "./buildlib";
+
+  checkPhase = "./checktests";
+
+  doCheck = false; # hasdescriptor.c test fails, hrm.
+
+  installPhase = ''prefix="/" DESTDIR=$out ./installlib'';
+}
diff --git a/nixpkgs/pkgs/development/libraries/libbluedevil/default.nix b/nixpkgs/pkgs/development/libraries/libbluedevil/default.nix
new file mode 100644
index 000000000000..d8f2426e477b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libbluedevil/default.nix
@@ -0,0 +1,21 @@
+{ stdenv, fetchurl, cmake, qt4 }:
+
+stdenv.mkDerivation rec {
+  name = "${pname}-${version}";
+  pname = "libbluedevil";
+  # bluedevil must have the same major version (x.y) as libbluedevil!
+  # do not update this package without checking bluedevil
+  version = "2.1";
+
+  src = fetchurl {
+    url = "mirror://kde/stable/${pname}/${version}/src/${name}.tar.xz";
+    sha256 = "0p4f0brhcz9gfxfd6114fa5x6swfdmgzv350xwncdr0s1qnamk8c";
+  };
+
+  buildInputs = [ cmake qt4 ];
+
+  meta = {
+    platforms = stdenv.lib.platforms.unix;
+    license = stdenv.lib.licenses.gpl2Plus;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libbluray/BDJ-JARFILE-path.patch b/nixpkgs/pkgs/development/libraries/libbluray/BDJ-JARFILE-path.patch
new file mode 100644
index 000000000000..8d9c5d0fbba7
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libbluray/BDJ-JARFILE-path.patch
@@ -0,0 +1,27 @@
+diff --git a/configure.ac b/configure.ac
+index 5fd3c8de..7ae343e0 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -228,6 +228,10 @@ if test "x$use_bdjava_jar" = "xyes" && test "x$HAVE_ANT" = "xno"; then
+     AC_MSG_ERROR([BD-J requires ANT, but ant was not found. Please install it.])
+ fi
+ 
++if test "x$use_bdjava_jar" = "xyes"; then
++  CPPFLAGS="${CPPFLAGS} -DJARDIR='\"\$(datadir)/java\"'"
++fi
++
+ AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$java_arch"], ["Defines the architecture of the java vm."])
+ AC_DEFINE_UNQUOTED([JDK_HOME], ["$JDK_HOME"], [""])
+ AM_CONDITIONAL([USING_BDJAVA_BUILD_JAR], [ test $use_bdjava_jar = "yes" ])
+diff --git a/src/libbluray/bdj/bdj.c b/src/libbluray/bdj/bdj.c
+index 511ad533..e273b9e0 100644
+--- a/src/libbluray/bdj/bdj.c
++++ b/src/libbluray/bdj/bdj.c
+@@ -478,6 +478,7 @@ static const char *_find_libbluray_jar(BDJ_STORAGE *storage)
+     // pre-defined search paths for libbluray.jar
+     static const char * const jar_paths[] = {
+ #ifndef _WIN32
++        JARDIR "/" BDJ_JARFILE,
+         "/usr/share/java/" BDJ_JARFILE,
+         "/usr/share/libbluray/lib/" BDJ_JARFILE,
+ #endif
diff --git a/nixpkgs/pkgs/development/libraries/libbluray/default.nix b/nixpkgs/pkgs/development/libraries/libbluray/default.nix
new file mode 100644
index 000000000000..a98748d3b52b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libbluray/default.nix
@@ -0,0 +1,65 @@
+{ stdenv, fetchurl, pkgconfig, fontconfig, autoreconfHook
+, withJava ? false, jdk ? null, ant ? null
+, withAACS ? false, libaacs ? null
+, withBDplus ? false, libbdplus ? null
+, withMetadata ? true, libxml2 ? null
+, withFonts ? true, freetype ? null
+}:
+
+with stdenv.lib;
+
+assert withJava -> jdk != null && ant != null;
+assert withAACS -> libaacs != null;
+assert withBDplus -> libbdplus != null;
+assert withMetadata -> libxml2 != null;
+assert withFonts -> freetype != null;
+
+# Info on how to use:
+# https://wiki.archlinux.org/index.php/BluRay
+
+stdenv.mkDerivation rec {
+  name = "libbluray-${version}";
+  version  = "1.1.1";
+
+  src = fetchurl {
+    url = "http://get.videolan.org/libbluray/${version}/${name}.tar.bz2";
+    sha256 = "0f138xlldzci8wic89i9vpka3mdsn8r78khpnk3wijlbgjhphr0h";
+  };
+
+  patches = optional withJava ./BDJ-JARFILE-path.patch;
+
+  nativeBuildInputs = [ pkgconfig autoreconfHook ]
+                      ++ optionals withJava [ ant ]
+                      ;
+
+  buildInputs = [ fontconfig ]
+                ++ optional withJava jdk
+                ++ optional withMetadata libxml2
+                ++ optional withFonts freetype
+                ;
+
+  propagatedBuildInputs = optional withAACS libaacs;
+
+  NIX_LDFLAGS = [
+    (optionalString withAACS   "-L${libaacs}/lib -laacs")
+    (optionalString withBDplus "-L${libbdplus}/lib -lbdplus")
+  ];
+
+  preConfigure = ''
+    ${optionalString withJava ''export JDK_HOME="${jdk.home}"''}
+  '';
+
+  configureFlags =  with stdenv.lib;
+                    optional (! withJava) "--disable-bdjava-jar"
+                 ++ optional (! withMetadata) "--without-libxml2"
+                 ++ optional (! withFonts) "--without-freetype"
+                 ;
+
+  meta = with stdenv.lib; {
+    homepage = http://www.videolan.org/developers/libbluray.html;
+    description = "Library to access Blu-Ray disks for video playback";
+    license = licenses.lgpl21;
+    maintainers = with maintainers; [ abbradar ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libbsd/darwin.patch b/nixpkgs/pkgs/development/libraries/libbsd/darwin.patch
new file mode 100644
index 000000000000..0f9cc9aaf964
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libbsd/darwin.patch
@@ -0,0 +1,361 @@
+diff --git a/configure.ac b/configure.ac
+index 55fcfe6..1e26c93 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -51,15 +51,19 @@ AS_CASE([$host_os],
+     AC_SEARCH_LIBS([clock_gettime], [rt], [CLOCK_GETTIME_LIBS="-lrt"])
+     AC_SUBST([CLOCK_GETTIME_LIBS])
+     LIBS="$saved_LIBS"
++    AM_CONDITIONAL([BUILD_LINK_VERSION_SCRIPT], [1])
+   ],
+   [*-musl*], [
+     # Upstream refuses to define this, we will do it ourselves then.
+     AC_DEFINE([__MUSL__], [1], [Define to 1 if we are building for musl])
++    AM_CONDITIONAL([BUILD_LINK_VERSION_SCRIPT], [1])
+   ],
+-)
++  [
++  AM_CONDITIONAL([BUILD_LINK_VERSION_SCRIPT], [1])
++  ])
+ 
+ # Checks for header files.
+-AC_CHECK_HEADERS([sys/ndir.h sys/dir.h ndir.h dirent.h])
++AC_CHECK_HEADERS([sys/ndir.h sys/dir.h ndir.h dirent.h nlist.h])
+ 
+ # Checks for typedefs, structures, and compiler characteristics.
+ AC_C_INLINE
+@@ -143,7 +147,8 @@ AC_LINK_IFELSE(
+ 
+ AC_CHECK_FUNCS([clearenv dirfd fopencookie __fpurge \
+                 getauxval getentropy getexecname getline \
+-                pstat_getproc sysconf])
++                pstat_getproc sysconf \
++		strlcpy strlcat strnstr strmode fpurge])
+ AM_CONDITIONAL([HAVE_GETENTROPY], [test "x$ac_cv_func_getentropy" = "xtrue"])
+ 
+ AC_CONFIG_FILES([
+diff --git a/include/bsd/string.h b/include/bsd/string.h
+index f987fee..a1e17ed 100644
+--- a/include/bsd/string.h
++++ b/include/bsd/string.h
+@@ -41,10 +41,21 @@
+ #include <sys/types.h>
+ 
+ __BEGIN_DECLS
++#if !HAVE_STRLCPY
+ size_t strlcpy(char *dst, const char *src, size_t siz);
++#endif
++
++#if !HAVE_STRLCAT
+ size_t strlcat(char *dst, const char *src, size_t siz);
++#endif
++
++#if !HAVE_STRNSTR
+ char *strnstr(const char *str, const char *find, size_t str_len);
++#endif
++
++#if !HAVE_STRMODE
+ void strmode(mode_t mode, char *str);
++#endif
+ 
+ #if !defined(__GLIBC__) || \
+     (defined(__GLIBC__) && (!__GLIBC_PREREQ(2, 25) || !defined(_GNU_SOURCE)))
+diff --git a/src/Makefile.am b/src/Makefile.am
+index f3cc0fa..3aaecd4 100644
+--- a/src/Makefile.am
++++ b/src/Makefile.am
+@@ -56,8 +56,10 @@ libbsd_la_DEPENDENCIES = \
+ libbsd_la_LIBADD = \
+ 	$(CLOCK_GETTIME_LIBS)
+ libbsd_la_LDFLAGS = \
+-	-Wl,--version-script=$(srcdir)/libbsd.map \
+ 	-version-number $(LIBBSD_ABI)
++if BUILD_LINK_VERSION_SCRIPT
++libbsd_la_LDFLAGS += -Wl,--version-script=$(srcdir)/libbsd.map
++endif
+ libbsd_la_SOURCES = \
+ 	arc4random.c \
+ 	arc4random.h \
+diff --git a/src/fpurge.c b/src/fpurge.c
+index 462535a..a8941db 100644
+--- a/src/fpurge.c
++++ b/src/fpurge.c
+@@ -26,9 +26,10 @@
+ 
+ #include <errno.h>
+ #include <stdio.h>
+-#include <stdio_ext.h>
+ 
+ #ifdef HAVE___FPURGE
++#include <stdio_ext.h>
++
+ int
+ fpurge(FILE *fp)
+ {
+@@ -41,6 +42,36 @@ fpurge(FILE *fp)
+ 
+ 	return 0;
+ }
++/* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin 1.7 */
++#elif HAVE_FPURGE
++int
++fpurge(FILE *fp)
++{
++	if (fp == NULL || fileno(fp) < 0) {
++		errno = EBADF;
++		return EOF;
++	}
++
++  /* Call the system's fpurge function.  */
++#undef fpurge
++#if !HAVE_DECL_FPURGE
++  extern int fpurge (FILE *);
++#endif
++  int result = fpurge (fp);
++/* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin */
++#if defined(__sferror) || defined(__DragonFly__)
++  if (result == 0)
++    /* Correct the invariants that fpurge broke.
++       <stdio.h> on BSD systems says:
++         "The following always hold: if _flags & __SRD, _w is 0."
++       If this invariant is not fulfilled and the stream is read-write but
++       currently reading, subsequent putc or fputc calls will write directly
++       into the buffer, although they shouldn't be allowed to.  */
++    if ((fp->_flags & __SRD) != 0)
++      fp->_w = 0;
++#endif
++  return result;
++}
+ #else
+ #error "Function fpurge() needs to be ported."
+ #endif
+diff --git a/src/funopen.c b/src/funopen.c
+index 1e05c7e..65ba5a8 100644
+--- a/src/funopen.c
++++ b/src/funopen.c
+@@ -143,6 +143,7 @@ funopen(const void *cookie,
+  * they will not add the needed support to implement it. Just ignore this
+  * interface there, as it has never been provided anyway.
+  */
++#elif defined(__MACH__)
+ #else
+ #error "Function funopen() needs to be ported or disabled."
+ #endif
+diff --git a/src/hash/sha512.h b/src/hash/sha512.h
+index 4f368a1..7632e25 100644
+--- a/src/hash/sha512.h
++++ b/src/hash/sha512.h
+@@ -29,7 +29,11 @@
+ #ifndef _SHA512_H_
+ #define _SHA512_H_
+ 
++#ifdef __MACH__
++#include <stdint.h>
++#else
+ #include <sys/types.h>
++#endif
+ 
+ #define SHA512_DIGEST_LENGTH		64
+ 
+diff --git a/src/hash/sha512c.c b/src/hash/sha512c.c
+index b3c8d5e..602f54e 100644
+--- a/src/hash/sha512c.c
++++ b/src/hash/sha512c.c
+@@ -25,7 +25,12 @@
+  */
+ 
+ #include <sys/cdefs.h>
++
++#ifdef __MACH__
++#include <machine/endian.h>
++#else
+ #include <sys/endian.h>
++#endif
+ #include <sys/types.h>
+ 
+ #include <string.h>
+diff --git a/src/local-link.h b/src/local-link.h
+index d518dcf..84694a2 100644
+--- a/src/local-link.h
++++ b/src/local-link.h
+@@ -27,7 +27,11 @@
+ #ifndef LIBBSD_LOCAL_LINK_H
+ #define LIBBSD_LOCAL_LINK_H
+ 
++#ifdef __MACH__
++#define libbsd_link_warning(symbol, msg)
++#else
+ #define libbsd_link_warning(symbol, msg) \
+ 	static const char libbsd_emit_link_warning_##symbol[] \
+ 		__attribute__((used,section(".gnu.warning." #symbol))) = msg;
+ #endif
++#endif
+diff --git a/src/nlist.c b/src/nlist.c
+index 0932f59..4502048 100644
+--- a/src/nlist.c
++++ b/src/nlist.c
+@@ -41,6 +41,7 @@
+ #include <unistd.h>
+ #include <nlist.h>
+ 
++#if !HAVE_NLIST_H
+ #include "local-elf.h"
+ 
+ #define SIZE_T_MAX 0xffffffffU
+@@ -265,3 +266,4 @@ nlist(const char *name, struct nlist *list)
+ 	(void)close(fd);
+ 	return (n);
+ }
++#endif
+diff --git a/src/readpassphrase.c b/src/readpassphrase.c
+index f9f6195..2bc5fb4 100644
+--- a/src/readpassphrase.c
++++ b/src/readpassphrase.c
+@@ -36,6 +36,14 @@
+ #define TCSASOFT 0
+ #endif
+ 
++#ifndef _SIGMAX
++#define	_SIGMAX	64
++#endif
++
++#ifndef _NSIG
++#define _NSIG (_SIGMAX + 1)
++#endif
++
+ static volatile sig_atomic_t signo[_NSIG];
+ 
+ static void handler(int);
+diff --git a/src/setproctitle.c b/src/setproctitle.c
+index 038ac7d..e9ee09c 100644
+--- a/src/setproctitle.c
++++ b/src/setproctitle.c
+@@ -32,6 +32,10 @@
+ #include <unistd.h>
+ #include <string.h>
+ 
++#ifdef __MACH__
++extern char **environ;
++#endif
++
+ static struct {
+ 	/* Original value. */
+ 	const char *arg0;
+@@ -280,16 +284,22 @@ setproctitle_impl(const char *fmt, ...)
+ 		*++nul = '\0';
+ 	}
+ }
++#ifndef __MACH__
+ __asm__(".symver setproctitle_impl,setproctitle@@LIBBSD_0.5");
++#endif
+ 
+ /* The original function introduced in 0.2 was a stub, it only got implemented
+  * in 0.5, make the implementation available in the old version as an alias
+  * for code linking against that version, and change the default to use the
+  * new version, so that new code depends on the implemented version. */
+-#ifdef HAVE_TYPEOF
++#ifdef __MACH__
++void setproctitle_stub(const char *fmt, ...);
++#elif HAVE_TYPEOF
+ extern typeof(setproctitle_impl) setproctitle_stub __attribute__((alias("setproctitle_impl")));
+ #else
+ void setproctitle_stub(const char *fmt, ...)
+ 	__attribute__((alias("setproctitle_impl")));
+ #endif
++#ifndef __MACH__
+ __asm__(".symver setproctitle_stub,setproctitle@LIBBSD_0.2");
++#endif
+diff --git a/src/strlcat.c b/src/strlcat.c
+index 14c53a1..5961c17 100644
+--- a/src/strlcat.c
++++ b/src/strlcat.c
+@@ -26,6 +26,7 @@
+  * Returns strlen(src) + MIN(dsize, strlen(initial dst)).
+  * If retval >= dsize, truncation occurred.
+  */
++#if !HAVE_STRLCAT
+ size_t
+ strlcat(char *dst, const char *src, size_t dsize)
+ {
+@@ -53,3 +54,4 @@ strlcat(char *dst, const char *src, size_t dsize)
+ 
+ 	return(dlen + (src - osrc));	/* count does not include NUL */
+ }
++#endif
+diff --git a/src/strlcpy.c b/src/strlcpy.c
+index e9a7fe4..5137acb 100644
+--- a/src/strlcpy.c
++++ b/src/strlcpy.c
+@@ -24,6 +24,7 @@
+  * chars will be copied.  Always NUL terminates (unless dsize == 0).
+  * Returns strlen(src); if retval >= dsize, truncation occurred.
+  */
++#if !HAVE_STRLCPY
+ size_t
+ strlcpy(char *dst, const char *src, size_t dsize)
+ {
+@@ -48,3 +49,4 @@ strlcpy(char *dst, const char *src, size_t dsize)
+ 
+ 	return(src - osrc - 1);	/* count does not include NUL */
+ }
++#endif
+diff --git a/src/strmode.c b/src/strmode.c
+index e6afde5..da680c9 100644
+--- a/src/strmode.c
++++ b/src/strmode.c
+@@ -32,6 +32,7 @@
+ #include <sys/stat.h>
+ #include <string.h>
+ 
++#if !HAVE_STRMODE
+ void
+ strmode(mode_t mode, char *p)
+ {
+@@ -141,3 +142,4 @@ strmode(mode_t mode, char *p)
+ 	*p++ = ' ';		/* will be a '+' if ACL's implemented */
+ 	*p = '\0';
+ }
++#endif
+diff --git a/src/unvis.c b/src/unvis.c
+index 94e3e7a..fba4c66 100644
+--- a/src/unvis.c
++++ b/src/unvis.c
+@@ -565,11 +565,15 @@ strnunvis_openbsd(char *dst, const char *src, size_t dlen)
+ {
+ 	return strnunvisx(dst, dlen, src, 0);
+ }
++#ifndef __MACH__
+ __asm__(".symver strnunvis_openbsd,strnunvis@@LIBBSD_0.2");
++#endif
+ 
+ int
+ strnunvis_netbsd(char *dst, size_t dlen, const char *src)
+ {
+ 	return strnunvisx(dst, dlen, src, 0);
+ }
++#ifndef __MACH__
+ __asm__(".symver strnunvis_netbsd,strnunvis@LIBBSD_0.9.1");
++#endif
+diff --git a/src/vis.c b/src/vis.c
+index c2cd2d8..2d84330 100644
+--- a/src/vis.c
++++ b/src/vis.c
+@@ -723,14 +723,18 @@ strnvis_openbsd(char *mbdst, const char *mbsrc, size_t dlen, int flags)
+ {
+ 	return istrsenvisxl(&mbdst, &dlen, mbsrc, flags, "", NULL);
+ }
++#ifndef __MACH__
+ __asm__(".symver strnvis_openbsd,strnvis@@LIBBSD_0.2");
++#endif
+ 
+ int
+ strnvis_netbsd(char *mbdst, size_t dlen, const char *mbsrc, int flags)
+ {
+ 	return istrsenvisxl(&mbdst, &dlen, mbsrc, flags, "", NULL);
+ }
++#ifndef __MACH__
+ __asm__(".symver strnvis_netbsd,strnvis@LIBBSD_0.9.1");
++#endif
+ 
+ int
+ stravis(char **mbdstp, const char *mbsrc, int flags)
diff --git a/nixpkgs/pkgs/development/libraries/libbsd/default.nix b/nixpkgs/pkgs/development/libraries/libbsd/default.nix
new file mode 100644
index 000000000000..a8d1925e5c0d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libbsd/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchurl, autoreconfHook }:
+
+stdenv.mkDerivation rec {
+  name = "libbsd-${version}";
+  version = "0.9.1";
+
+  src = fetchurl {
+    url = "https://libbsd.freedesktop.org/releases/${name}.tar.xz";
+    sha256 = "1957w2wi7iqar978qlfsm220dwywnrh5m58nrnn9zmi74ds3bn2n";
+  };
+
+  # darwin changes configure.ac which means we need to regenerate
+  # the configure scripts
+  nativeBuildInputs = [ autoreconfHook ];
+
+  patches = stdenv.lib.optional stdenv.isDarwin ./darwin.patch
+    # Suitable for all but limited to musl to avoid rebuild
+    ++ stdenv.lib.optional stdenv.hostPlatform.isMusl ./musl.patch;
+
+  meta = with stdenv.lib; {
+    description = "Common functions found on BSD systems";
+    homepage = https://libbsd.freedesktop.org/;
+    license = licenses.bsd3;
+    platforms = platforms.linux ++ platforms.darwin;
+    maintainers = with maintainers; [ matthewbauer ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libbsd/musl.patch b/nixpkgs/pkgs/development/libraries/libbsd/musl.patch
new file mode 100644
index 000000000000..fc07cfb6e855
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libbsd/musl.patch
@@ -0,0 +1,14 @@
+Source: maxice8
+Upstream: no
+Reason: fixes compilation
+
+--- a/src/flopen.c
++++ b/src/flopen.c
+@@ -34,6 +34,7 @@
+ #include <errno.h>
+ #include <stdarg.h>
+ #include <unistd.h>
++#include <fcntl.h>
+ 
+ #include <libutil.h>
+ 
diff --git a/nixpkgs/pkgs/development/libraries/libbson/default.nix b/nixpkgs/pkgs/development/libraries/libbson/default.nix
new file mode 100644
index 000000000000..6244c3a351e7
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libbson/default.nix
@@ -0,0 +1,23 @@
+{ fetchFromGitHub, perl, stdenv, cmake }:
+
+stdenv.mkDerivation rec {
+  name = "libbson-${version}";
+  version = "1.9.5";
+
+  src = fetchFromGitHub {
+    owner = "mongodb";
+    repo = "libbson";
+    rev = version;
+    sha256 = "16rmzxhhmbvhp4q6qac5j9c74z2pcg5raag5w16mynzikdd2l05b";
+  };
+
+  nativeBuildInputs = [ cmake ];
+  buildInputs = [ perl ];
+
+  meta = with stdenv.lib; {
+    description = "A C Library for parsing, editing, and creating BSON documents";
+    homepage = https://github.com/mongodb/libbson;
+    license = licenses.asl20;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libburn/default.nix b/nixpkgs/pkgs/development/libraries/libburn/default.nix
new file mode 100644
index 000000000000..f68141ef3b47
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libburn/default.nix
@@ -0,0 +1,19 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "libburn-${version}";
+  version = "1.5.0";
+
+  src = fetchurl {
+    url = "http://files.libburnia-project.org/releases/${name}.tar.gz";
+    sha256 = "1gg2kgnqvaa2fwghai62prxz6slpak1f6bvgjh8m4dn16v114asq";
+  };
+
+  meta = with stdenv.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;
+    maintainers = with maintainers; [ abbradar vrthra ];
+    platforms = with platforms; unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libbytesize/default.nix b/nixpkgs/pkgs/development/libraries/libbytesize/default.nix
new file mode 100644
index 000000000000..97f8e17a5f62
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libbytesize/default.nix
@@ -0,0 +1,31 @@
+{ stdenv, fetchFromGitHub, autoreconfHook, pkgconfig, gettext
+, gtk-doc, libxslt, docbook_xml_dtd_43, docbook_xsl
+, python3, pcre2, gmp, mpfr
+}:
+
+let
+  version = "2.0";
+in stdenv.mkDerivation rec {
+  name = "libbytesize-${version}";
+
+  src = fetchFromGitHub {
+    owner = "storaged-project";
+    repo = "libbytesize";
+    rev = version;
+    sha256 = "0m950idlyv6mbkhr8ngnda5l5wwb5lzs4wn4kxl73cvdlcvklmwj";
+  };
+
+  outputs = [ "out" "dev" "devdoc" ];
+
+  nativeBuildInputs = [ autoreconfHook pkgconfig gettext gtk-doc libxslt docbook_xml_dtd_43 docbook_xsl python3 ];
+
+  buildInputs = [ pcre2 gmp mpfr ];
+
+  meta = with stdenv.lib; {
+    description = "A tiny library providing a C “class” for working with arbitrary big sizes in bytes";
+    homepage = src.meta.homepage;
+    license = licenses.lgpl2Plus;
+    maintainers = with maintainers; [];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libcaca/default.nix b/nixpkgs/pkgs/development/libraries/libcaca/default.nix
new file mode 100644
index 000000000000..8949ea8e390e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libcaca/default.nix
@@ -0,0 +1,40 @@
+{ stdenv, fetchurl, ncurses, zlib, pkgconfig, imlib2
+, x11Support ? !stdenv.isDarwin, libX11, libXext
+}:
+
+stdenv.mkDerivation rec {
+  name = "libcaca-0.99.beta19";
+
+  src = fetchurl {
+    urls = [
+      "http://fossies.org/linux/privat/${name}.tar.gz"
+      "http://caca.zoy.org/files/libcaca/${name}.tar.gz"
+    ];
+    sha256 = "1x3j6yfyxl52adgnabycr0n38j9hx2j74la0hz0n8cnh9ry4d2qj";
+  };
+
+  outputs = [ "bin" "dev" "out" "man" ];
+
+  configureFlags = [
+    (if x11Support then "--enable-x11" else "--disable-x11")
+    ];
+
+  NIX_CFLAGS_COMPILE = stdenv.lib.optional (!x11Support) "-DX_DISPLAY_MISSING";
+
+  enableParallelBuilding = true;
+
+  propagatedBuildInputs = [ ncurses zlib pkgconfig (imlib2.override { inherit x11Support; }) ]
+    ++ stdenv.lib.optionals x11Support [ libX11 libXext];
+
+  postInstall = ''
+    mkdir -p $dev/bin
+    mv $bin/bin/caca-config $dev/bin/caca-config
+  '';
+
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libcacard/default.nix b/nixpkgs/pkgs/development/libraries/libcacard/default.nix
new file mode 100644
index 000000000000..f116360474e4
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libcacard/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, fetchurl, pkgconfig, glib, nss }:
+
+stdenv.mkDerivation rec {
+  name = "libcacard-${version}";
+  version = "2.6.1";
+
+  src = fetchurl {
+    url = "https://www.spice-space.org/download/libcacard/${name}.tar.xz";
+    sha256 = "1w6y0kiakhg7dgyf8yqpm4jj6jiv17zhy9lp3d7z32q1pniccxk2";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ glib nss ];
+
+  meta = with stdenv.lib; {
+    description = "Smart card emulation library";
+    homepage = https://gitlab.freedesktop.org/spice/libcacard;
+    license = licenses.lgpl21;
+    maintainers = with maintainers; [ yegortimoshenko ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libcanberra/default.nix b/nixpkgs/pkgs/development/libraries/libcanberra/default.nix
new file mode 100644
index 000000000000..6d76c9411147
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libcanberra/default.nix
@@ -0,0 +1,68 @@
+{ stdenv, lib, fetchurl, fetchpatch, pkgconfig, libtool
+, gtk ? null
+, libpulseaudio, gst_all_1, libvorbis, libcap
+, CoreServices
+, withAlsa ? stdenv.isLinux, alsaLib }:
+
+stdenv.mkDerivation rec {
+  name = "libcanberra-0.30";
+
+  src = fetchurl {
+    url = "http://0pointer.de/lennart/projects/libcanberra/${name}.tar.xz";
+    sha256 = "0wps39h8rx2b00vyvkia5j40fkak3dpipp1kzilqla0cgvk73dn2";
+  };
+
+  nativeBuildInputs = [ pkgconfig libtool ];
+  buildInputs = [
+    libpulseaudio libvorbis gtk
+  ] ++ (with gst_all_1; [ gstreamer gst-plugins-base ])
+    ++ lib.optional stdenv.isDarwin CoreServices
+    ++ lib.optional stdenv.isLinux libcap
+    ++ lib.optional withAlsa alsaLib;
+
+  configureFlags = [ "--disable-oss" ];
+
+  patches = [
+    (fetchpatch {
+      name = "0001-gtk-Don-t-assume-all-GdkDisplays-are-GdkX11Displays-.patch";
+      url = http://git.0pointer.net/libcanberra.git/patch/?id=c0620e432650e81062c1967cc669829dbd29b310;
+      sha256 = "0rc7zwn39yxzxp37qh329g7375r5ywcqcaak8ryd0dgvg8m5hcx9";
+    })
+  ];
+
+  postPatch = (stdenv.lib.optional stdenv.isDarwin) ''
+    patch -p0 < ${fetchpatch {
+      url = "https://raw.githubusercontent.com/macports/macports-ports/master/audio/libcanberra/files/patch-configure.diff";
+      sha256 = "1f7h7ifpqvbfhqygn1b7klvwi80zmpv3538vbmq7ql7bkf1q8h31";
+    }}
+  '';
+
+  postInstall = ''
+    for f in $out/lib/*.la; do
+      sed 's|-lltdl|-L${libtool.lib}/lib -lltdl|' -i $f
+    done
+  '';
+
+  passthru = {
+    gtkModule = "/lib/gtk-2.0/";
+  };
+
+  meta = {
+    description = "An implementation of the XDG Sound Theme and Name Specifications";
+
+    longDescription = ''
+      libcanberra is an implementation of the XDG Sound Theme and Name
+      Specifications, for generating event sounds on free desktops
+      such as GNOME.  It comes with several backends (ALSA,
+      PulseAudio, OSS, GStreamer, null) and is designed to be
+      portable.
+    '';
+
+    homepage = http://0pointer.de/lennart/projects/libcanberra/;
+
+    license = stdenv.lib.licenses.lgpl2Plus;
+
+    maintainers = [ ];
+    platforms = stdenv.lib.platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libcangjie/default.nix b/nixpkgs/pkgs/development/libraries/libcangjie/default.nix
new file mode 100644
index 000000000000..6838362c7942
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libcangjie/default.nix
@@ -0,0 +1,35 @@
+{ stdenv, autoconf, automake, libtool, m4, fetchurl, bash, pkgconfig, sqlite }:
+
+stdenv.mkDerivation rec {
+  name = "libcangjie-${version}";
+  version = "1.4_rev_${rev}";
+  rev = "a73c1d8783f7b6526fd9b2cc44a669ffa5518d3d";
+
+  src = fetchurl {
+    url = "https://github.com/Cangjians/libcangjie/archive/${rev}.tar.gz";
+    sha256 = "0i5svvcx099fc9hh5dvr3gpb1041v6vn5fnylxy82zjy239114lg";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ automake autoconf libtool m4 sqlite ];
+
+  configureScript = "./autogen.sh";
+  
+  preConfigure = ''
+    find . -name '*.sh' -exec sed -e 's@#!/bin/bash@${bash}/bin/bash@' -i '{}' ';'
+  '';
+
+  doCheck = true;
+
+  meta = {
+    description = "A C library implementing the Cangjie input method";
+    longDescription = ''
+      libcangjie is a library implementing the Cangjie input method.
+    '';
+    homepage = http://cangjians.github.io/projects/libcangjie/;
+    license = stdenv.lib.licenses.lgpl3Plus;
+
+    maintainers = [ stdenv.lib.maintainers.linquize ];
+    platforms = stdenv.lib.platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libcbor/default.nix b/nixpkgs/pkgs/development/libraries/libcbor/default.nix
new file mode 100644
index 000000000000..fe2f0eadeeb3
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libcbor/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchFromGitHub, cmake, cmocka }:
+
+stdenv.mkDerivation rec {
+  pname = "libcbor";
+  version = "2019-02-23";
+
+  src = fetchFromGitHub {
+    owner = "PJK";
+    repo = pname;
+    rev = "87f977e732ca216682a8583a0e43803eb6b9c028";
+    sha256 = "17p1ahdcpf5d4r472lhciscaqjq4pyxy9xjhqqx8mv646xmyripm";
+  };
+
+  nativeBuildInputs = [ cmake ];
+  checkInputs = [ cmocka ];
+
+  doCheck = false; # needs "-DWITH_TESTS=ON", but fails w/compilation error
+
+  NIX_CFLAGS_COMPILE = [ "-fno-lto" ];
+
+  meta = with stdenv.lib; {
+    description = "CBOR protocol implementation for C and others";
+    homepage = https://github.com/PJK/libcbor;
+    license = licenses.mit;
+    maintainers = with maintainers; [ dtzWill ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libcdaudio/default.nix b/nixpkgs/pkgs/development/libraries/libcdaudio/default.nix
new file mode 100644
index 000000000000..218eaeea571a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libcdaudio/default.nix
@@ -0,0 +1,14 @@
+{stdenv, fetchurl}:
+
+stdenv.mkDerivation {
+  name = "libcdaudio-0.99.12";
+  src = fetchurl {
+    url = mirror://sourceforge/libcdaudio/libcdaudio-0.99.12.tar.gz ;
+    sha256 = "1g3ba1n12g8h7pps0vlxx8di6cmf108mbcvbl6hj8x71ndkglygb" ;
+  };
+
+  meta = {
+    platforms = stdenv.lib.platforms.linux;
+    license = stdenv.lib.licenses.lgpl2;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libcddb/default.nix b/nixpkgs/pkgs/development/libraries/libcddb/default.nix
new file mode 100644
index 000000000000..591369df83f1
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libcddb/default.nix
@@ -0,0 +1,21 @@
+{ stdenv, fetchurl, libiconv }:
+
+stdenv.mkDerivation rec {
+  name = "libcddb-1.3.2";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/libcddb/${name}.tar.bz2";
+    sha256 = "0fr21a7vprdyy1bq6s99m0x420c9jm5fipsd63pqv8qyfkhhxkim";
+  };
+
+  buildInputs = stdenv.lib.optional stdenv.isDarwin libiconv;
+
+  doCheck = false; # fails 3 of 5 tests with locale errors
+
+  meta = with stdenv.lib; {
+    description = "C library to access data on a CDDB server (freedb.org)";
+    homepage = http://libcddb.sourceforge.net/;
+    license = licenses.lgpl2Plus;
+    platforms = platforms.linux ++ platforms.darwin;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libcdio-paranoia/default.nix b/nixpkgs/pkgs/development/libraries/libcdio-paranoia/default.nix
new file mode 100644
index 000000000000..48e632ba52d8
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libcdio-paranoia/default.nix
@@ -0,0 +1,35 @@
+{ stdenv, fetchFromGitHub, autoreconfHook, libcdio, pkgconfig,
+  libiconv, IOKit, DiskArbitration}:
+
+stdenv.mkDerivation {
+  name = "libcdio-paranoia-0.94+2";
+
+  src = fetchFromGitHub {
+    owner = "rocky";
+    repo = "libcdio-paranoia";
+    rev = "release-10.2+0.94+2";
+    sha256 = "1wjgmmaca4baw7k5c3vdap9hnjc49ciagi5kvpvync3aqfmdvkha";
+  };
+
+  nativeBuildInputs = [ autoreconfHook pkgconfig ];
+  buildInputs = [ libcdio ] ++
+    stdenv.lib.optionals stdenv.isDarwin [ libiconv IOKit DiskArbitration ];
+
+  propagatedBuildInputs = stdenv.lib.optional stdenv.isDarwin DiskArbitration;
+
+  configureFlags = stdenv.lib.optionals stdenv.isDarwin [
+    "--disable-ld-version-script"
+  ];
+
+  meta = with stdenv.lib; {
+    description = "CD paranoia on top of libcdio";
+    longDescription = ''
+      This is a port of xiph.org's cdda paranoia to use libcdio for CDROM
+      access. By doing this, cdparanoia runs on platforms other than GNU/Linux.
+    '';
+    license = licenses.gpl3;
+    homepage = https://github.com/rocky/libcdio-paranoia;
+    platforms = platforms.linux ++ platforms.darwin;
+    maintainers = [ maintainers.pbogdan ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libcdio/default.nix b/nixpkgs/pkgs/development/libraries/libcdio/default.nix
new file mode 100644
index 000000000000..9c3132a3e637
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libcdio/default.nix
@@ -0,0 +1,33 @@
+{ stdenv, fetchurl, libcddb, pkgconfig, ncurses, help2man, libiconv, Carbon, IOKit }:
+
+stdenv.mkDerivation rec {
+  name = "libcdio-2.1.0";
+
+  src = fetchurl {
+    url = "mirror://gnu/libcdio/${name}.tar.bz2";
+    sha256 = "0avi6apv5ydjy6b9c3z9a46rvp5i57qyr09vr7x4nndxkmcfjl45";
+  };
+
+  postPatch = ''
+    patchShebangs .
+  '';
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ libcddb ncurses help2man ]
+    ++ stdenv.lib.optionals stdenv.isDarwin [ libiconv Carbon IOKit ];
+
+  doCheck = !stdenv.isDarwin;
+
+  meta = with stdenv.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
+      CD image access.  It includes a library for working with
+      ISO-9660 filesystems (libiso9660), as well as utility
+      programs such as an audio CD player and an extractor.
+    '';
+    homepage = https://www.gnu.org/software/libcdio/;
+    license = licenses.gpl2Plus;
+    platforms = platforms.linux ++ platforms.darwin;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libcdr/default.nix b/nixpkgs/pkgs/development/libraries/libcdr/default.nix
new file mode 100644
index 000000000000..f7276d39b14a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libcdr/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchurl, libwpg, libwpd, lcms, pkgconfig, librevenge, icu, boost, cppunit }:
+
+stdenv.mkDerivation rec {
+  name = "libcdr-0.1.5";
+
+  src = fetchurl {
+    url = "https://dev-www.libreoffice.org/src/${name}.tar.xz";
+    sha256 = "0j1skr11jwvafn0l6p37v3i4lqc8wcn489g8f7c4mqwbk94mrkka";
+  };
+
+  buildInputs = [ libwpg libwpd lcms librevenge icu boost cppunit ];
+
+  nativeBuildInputs = [ pkgconfig ];
+
+  CXXFLAGS="--std=gnu++0x"; # For c++11 constants in lcms2.h
+
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libcec/default.nix b/nixpkgs/pkgs/development/libraries/libcec/default.nix
new file mode 100644
index 000000000000..e016484e6779
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libcec/default.nix
@@ -0,0 +1,31 @@
+{ stdenv, fetchurl, cmake, pkgconfig, udev, libcec_platform }:
+
+let version = "4.0.4"; in
+
+stdenv.mkDerivation {
+  name = "libcec-${version}";
+
+  src = fetchurl {
+    url = "https://github.com/Pulse-Eight/libcec/archive/libcec-${version}.tar.gz";
+    sha256 = "02j09y06csaic4m0fyb4dr9l3hl15nxbbniwq0i1qlccpxjak0j3";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ cmake udev libcec_platform ];
+
+  cmakeFlags = [ "-DBUILD_SHARED_LIBS=1" ];
+
+  # Fix dlopen path
+  patchPhase = ''
+    substituteInPlace include/cecloader.h --replace "libcec.so" "$out/lib/libcec.so"
+  '';
+
+  meta = with stdenv.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;
+    platforms = platforms.linux;
+    maintainers = [ maintainers.titanous ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libcec/platform.nix b/nixpkgs/pkgs/development/libraries/libcec/platform.nix
new file mode 100644
index 000000000000..0005525a7cd2
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libcec/platform.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchurl, cmake }:
+
+let version = "2.1.0.1"; in
+
+stdenv.mkDerivation {
+  name = "p8-platform-${version}";
+
+  src = fetchurl {
+    url = "https://github.com/Pulse-Eight/platform/archive/p8-platform-${version}.tar.gz";
+    sha256 = "18381y54f7d18ckpzf9cfxbz1ws6imprbbm9pvhcg5c86ln8skq6";
+  };
+
+  nativeBuildInputs = [ cmake ];
+
+  meta = with stdenv.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;
+    platforms = platforms.linux;
+    maintainers = [ maintainers.titanous ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libcef/default.nix b/nixpkgs/pkgs/development/libraries/libcef/default.nix
new file mode 100644
index 000000000000..9e7d608b5124
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libcef/default.nix
@@ -0,0 +1,43 @@
+{ 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 }:
+
+let
+  libPath =
+    stdenv.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
+      systemd
+    ];
+in
+stdenv.mkDerivation rec {
+  name = "cef-binary-${version}";
+  version = "3.3497.1833.g13f506f";
+  src = fetchurl {
+    url = "http://opensource.spotify.com/cefbuilds/cef_binary_${version}_linux64.tar.bz2";
+    sha256 = "02v22yx1ga2yxagjblzkfw0ax7zkrdpc959l1a15m8nah3y7xf9p";
+  };
+  nativeBuildInputs = [ cmake ];
+  makeFlags = "libcef_dll_wrapper";
+  dontStrip = true;
+  dontPatchELF = true;
+  installPhase = ''
+    mkdir -p $out/lib/ $out/share/cef/
+    cp libcef_dll_wrapper/libcef_dll_wrapper.a $out/lib/
+    cp ../Release/libcef.so $out/lib/
+    patchelf --set-rpath "${libPath}" $out/lib/libcef.so
+    cp ../Release/*.bin $out/share/cef/
+    cp -r ../Resources/* $out/share/cef/
+    cp -r ../include $out/
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Simple framework for embedding Chromium-based browsers in other applications";
+    homepage = http://opensource.spotify.com/cefbuilds/index.html;
+    maintainers = with maintainers; [ puffnfresh ];
+    license = licenses.bsd3;
+    platforms = with platforms; linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libcello/default.nix b/nixpkgs/pkgs/development/libraries/libcello/default.nix
new file mode 100644
index 000000000000..96c3db6ae43b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libcello/default.nix
@@ -0,0 +1,17 @@
+{stdenv, fetchurl}:
+
+stdenv.mkDerivation rec {
+  name = "libcello-0.9.2";
+
+  src = fetchurl {
+    url = "http://libcello.org/static/${name}.tar.gz";
+    sha256 = "cd82639cb9b133119fd89a77a5a505a55ea5fcc8decfc53bee0725358ec8bad0";
+  };
+
+  meta = {
+    homepage = http://libcello.org/;
+    description = "Higher level programming in C";
+    license = stdenv.lib.licenses.bsd3;
+    platforms = stdenv.lib.platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libcerf/default.nix b/nixpkgs/pkgs/development/libraries/libcerf/default.nix
new file mode 100644
index 000000000000..fd5ee8dcaaf9
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libcerf/default.nix
@@ -0,0 +1,18 @@
+{ stdenv, lib, fetchurl }:
+
+stdenv.mkDerivation {
+  name = "libcerf-1.5";
+
+  src = fetchurl {
+    url = "http://apps.jcns.fz-juelich.de/src/libcerf/libcerf-1.5.tgz";
+    sha256 = "11jwr8ql4a9kmv04ycgwk4dsqnlv4l65a8aa0x1i3y7zwx3w2vg3";
+  };
+
+  meta = with lib; {
+    description = "Complex error (erf), Dawson, Faddeeva, and Voigt function library";
+    homepage = http://apps.jcns.fz-juelich.de/doku/sc/libcerf;
+    license = licenses.mit;
+    maintainers = with maintainers; [ orivej ];
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libchamplain/default.nix b/nixpkgs/pkgs/development/libraries/libchamplain/default.nix
new file mode 100644
index 000000000000..1a0be52dbbe5
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libchamplain/default.nix
@@ -0,0 +1,49 @@
+{ fetchurl, stdenv, meson, ninja, vala, gtk-doc, docbook_xsl, docbook_xml_dtd_412, pkgconfig, glib, gtk3, cairo, sqlite, gnome3
+, clutter-gtk, libsoup, gobject-introspection /*, libmemphis */ }:
+
+stdenv.mkDerivation rec {
+  pname = "libchamplain";
+  version = "0.12.19";
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    sha256 = "191aid1qsfkab5whbzj2r3g63dpdgrwp5141mfywvqyvdhr2x11n";
+  };
+
+  outputs = [ "out" "dev" "devdoc" ];
+
+  nativeBuildInputs = [ meson ninja pkgconfig gobject-introspection vala gtk-doc docbook_xsl docbook_xml_dtd_412 ];
+
+  buildInputs = [ sqlite libsoup ];
+
+  propagatedBuildInputs = [ glib gtk3 cairo clutter-gtk ];
+
+  mesonFlags = [
+    "-Dgtk_doc=true"
+    "-Dvapi=true"
+  ];
+
+  passthru = {
+    updateScript = gnome3.updateScript {
+      packageName = pname;
+    };
+  };
+
+  meta = with stdenv.lib; {
+    homepage = https://wiki.gnome.org/Projects/libchamplain;
+    license = licenses.lgpl2Plus;
+
+    description = "C library providing a ClutterActor to display maps";
+
+    longDescription = ''
+      libchamplain is a C library providing a ClutterActor to display
+       maps.  It also provides a Gtk+ widget to display maps in Gtk+
+       applications.  Python and Perl bindings are also available.  It
+       supports numerous free map sources such as OpenStreetMap,
+       OpenCycleMap, OpenAerialMap, and Maps for free.
+    '';
+
+     maintainers = gnome3.maintainers;
+     platforms = platforms.gnu ++ platforms.linux;  # arbitrary choice
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libchardet/default.nix b/nixpkgs/pkgs/development/libraries/libchardet/default.nix
new file mode 100644
index 000000000000..410c83953aa9
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libchardet/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchFromGitHub, perl }:
+
+stdenv.mkDerivation rec {
+  name = "libchardet-${version}";
+  version = "1.0.5";
+
+  src = fetchFromGitHub {
+    owner = "Joungkyun";
+    repo = "libchardet";
+    rev = version;
+    sha256 = "0c1k5hf3ssh3cm72w2zpy5k73vhy1gyq5s9rqdawqqa4al8syyvn";
+  };
+
+  nativeBuildInputs = [ perl ];
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    description = "Mozilla's Universal Charset Detector C/C++ API";
+    homepage = ftp://ftp.oops.org/pub/oops/libchardet/index.html;
+    license = licenses.mpl11;
+    maintainers = [ maintainers.abbradar ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libchewing/default.nix b/nixpkgs/pkgs/development/libraries/libchewing/default.nix
new file mode 100644
index 000000000000..d3ef799ef605
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libchewing/default.nix
@@ -0,0 +1,21 @@
+{ stdenv, fetchurl, sqlite }:
+
+stdenv.mkDerivation rec{
+  name = "libchewing-${version}";
+  version = "0.5.1";
+
+  src = fetchurl {
+    url = "https://github.com/chewing/libchewing/releases/download/v${version}/libchewing-${version}.tar.bz2";
+    sha256 = "0aqp2vqgxczydpn7pxi7r6xf3l1hgl710f0gbi1k8q7s2lscc24p";
+  };
+
+  buildInputs = [ sqlite ];
+
+  meta = with stdenv.lib; {
+    description = "Intelligent Chinese phonetic input method";
+    homepage = http://chewing.im/;
+    license = licenses.lgpl21;
+    maintainers = [ maintainers.ericsagnes ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libchop/default.nix b/nixpkgs/pkgs/development/libraries/libchop/default.nix
new file mode 100644
index 000000000000..c802bd68ab08
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libchop/default.nix
@@ -0,0 +1,55 @@
+{ fetchurl, stdenv, zlib, bzip2, libgcrypt
+, gdbm, gperf, tdb, gnutls, db, libuuid
+, lzo, pkgconfig, guile
+}:
+
+stdenv.mkDerivation rec {
+  name = "libchop-0.5.2";
+
+  src = fetchurl {
+    url = "mirror://savannah/libchop/${name}.tar.gz";
+    sha256 = "0fpdyxww41ba52d98blvnf543xvirq1v9xz1i3x1gm9lzlzpmc2g";
+  };
+
+  patches = [ ./gets-undeclared.patch ./size_t.patch ];
+
+  nativeBuildInputs = [ pkgconfig gperf ];
+
+  buildInputs =
+    [ zlib bzip2 lzo
+      libgcrypt
+      gdbm db tdb
+      gnutls libuuid
+      guile
+    ];
+
+  doCheck = false;
+
+  preConfigure = ''
+    sed -re 's%@GUILE@%&/guile%' -i */Makefile.* Makefile.*
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Tools & library for data backup and distributed storage";
+
+    longDescription =
+      '' Libchop is a set of utilities and library for data backup and
+         distributed storage.  Its main application is chop-backup, an
+         encrypted backup program that supports data integrity checks,
+         versioning at little cost, distribution among several sites,
+         selective sharing of stored data, adaptive compression, and more.
+         The library itself, which chop-backup builds upon, implements
+         storage techniques such as content-based addressing, content hash
+         keys, Merkle trees, similarity detection, and lossless compression.
+         It makes it easy to combine them in different ways.  The
+         ‘chop-archiver’ and ‘chop-block-server’ tools, illustrated in the
+         manual, provide direct access to these facilities from the command
+         line.  It is written in C and has Guile (Scheme) bindings.
+      '';
+
+    homepage = https://www.nongnu.org/libchop/;
+    license = licenses.gpl3Plus;
+    maintainers = with maintainers; [ ];
+    platforms = platforms.gnu ++ platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libchop/gets-undeclared.patch b/nixpkgs/pkgs/development/libraries/libchop/gets-undeclared.patch
new file mode 100644
index 000000000000..b6cdc77caa84
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libchop/gets-undeclared.patch
@@ -0,0 +1,71 @@
+This patch is needed to allow builds with newer versions of
+the GNU libc (2.16+).
+
+
+commit 66712c23388e93e5c518ebc8515140fa0c807348
+Author: Eric Blake <eblake@redhat.com>
+Date:   Thu Mar 29 13:30:41 2012 -0600
+
+    stdio: don't assume gets any more
+    
+    Gnulib intentionally does not have a gets module, and now that C11
+    and glibc have dropped it, we should be more proactive about warning
+    any user on a platform that still has a declaration of this dangerous
+    interface.
+    
+    * m4/stdio_h.m4 (gl_STDIO_H, gl_STDIO_H_DEFAULTS): Drop gets
+    support.
+    * modules/stdio (Makefile.am): Likewise.
+    * lib/stdio-read.c (gets): Likewise.
+    * tests/test-stdio-c++.cc: Likewise.
+    * m4/warn-on-use.m4 (gl_WARN_ON_USE_PREPARE): Fix comment.
+    * lib/stdio.in.h (gets): Make warning occur in more places.
+    * doc/posix-functions/gets.texi (gets): Update documentation.
+    Reported by Christer Solskogen.
+    
+    Signed-off-by: Eric Blake <eblake@redhat.com>
+
+diff --git a/lib/stdio.in.h b/lib/stdio.in.h
+index aa7b599..c377b6e 100644
+--- a/lib/stdio.in.h
++++ b/lib/stdio.in.h
+@@ -698,22 +698,11 @@ _GL_WARN_ON_USE (getline, "getline is unportable - "
+ # endif
+ #endif
+ 
+-#if @GNULIB_GETS@
+-# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
+-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+-#   undef gets
+-#   define gets rpl_gets
+-#  endif
+-_GL_FUNCDECL_RPL (gets, char *, (char *s) _GL_ARG_NONNULL ((1)));
+-_GL_CXXALIAS_RPL (gets, char *, (char *s));
+-# else
+-_GL_CXXALIAS_SYS (gets, char *, (char *s));
+-#  undef gets
+-# endif
+-_GL_CXXALIASWARN (gets);
+ /* It is very rare that the developer ever has full control of stdin,
+-   so any use of gets warrants an unconditional warning.  Assume it is
+-   always declared, since it is required by C89.  */
++   so any use of gets warrants an unconditional warning; besides, C11
++   removed it.  */
++#undef gets
++#if HAVE_RAW_DECL_GETS
+ _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
+ #endif
+ 
+@@ -1053,9 +1042,9 @@ _GL_WARN_ON_USE (snprintf, "snprintf is unportable - "
+ # endif
+ #endif
+ 
+-/* Some people would argue that sprintf should be handled like gets
+-   (for example, OpenBSD issues a link warning for both functions),
+-   since both can cause security holes due to buffer overruns.
++/* Some people would argue that all sprintf uses should be warned about
++   (for example, OpenBSD issues a link warning for it),
++   since it can cause security holes due to buffer overruns.
+    However, we believe that sprintf can be used safely, and is more
+    efficient than snprintf in those safe cases; and as proof of our
+    belief, we use sprintf in several gnulib modules.  So this header
diff --git a/nixpkgs/pkgs/development/libraries/libchop/size_t.patch b/nixpkgs/pkgs/development/libraries/libchop/size_t.patch
new file mode 100644
index 000000000000..82b6cb995ef3
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libchop/size_t.patch
@@ -0,0 +1,11 @@
+--- a/src/chop.c
++++ b/src/chop.c
+@@ -539,7 +539,7 @@ extern const chop_class_t chop_gdbm_bloc
+   chop_qdbm_block_iterator_class;
+ 
+ const struct chop_class_entry *
+-chop_lookup_class_entry (const char *str, unsigned int len);
++chop_lookup_class_entry (const char *str, size_t len);
+ 
+ /* Include the gperf-generated perfect hash table.  */
+ #include "class-lookup.c"
diff --git a/nixpkgs/pkgs/development/libraries/libclc/default.nix b/nixpkgs/pkgs/development/libraries/libclc/default.nix
new file mode 100644
index 000000000000..78f5e9d233ca
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libclc/default.nix
@@ -0,0 +1,36 @@
+{ stdenv, fetchFromGitHub, python, llvmPackages }:
+
+let
+  llvm = llvmPackages.llvm;
+  clang = llvmPackages.clang;
+in
+
+stdenv.mkDerivation {
+  name = "libclc-2017-11-29";
+
+  src = fetchFromGitHub {
+    owner = "llvm-mirror";
+    repo = "libclc";
+    rev = "d6384415ab854c68777dd77451aa2bc0d959da99";
+    sha256 = "10fqrlnqlknh58x7pfsbg9r07fblfg2mgq2m4fr1jbb836ncn3wh";
+  };
+
+  nativeBuildInputs = [ python ];
+  buildInputs = [ llvm clang ];
+
+  postPatch = ''
+    sed -i 's,llvm_clang =.*,llvm_clang = "${clang}/bin/clang",' configure.py
+    sed -i 's,cxx_compiler =.*,cxx_compiler = "${clang}/bin/clang++",' configure.py
+  '';
+
+  configurePhase = ''
+    ${python.interpreter} ./configure.py --prefix=$out
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = http://libclc.llvm.org/;
+    description = "Implementation of the library requirements of the OpenCL C programming language";
+    license = licenses.mit;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libcli/default.nix b/nixpkgs/pkgs/development/libraries/libcli/default.nix
new file mode 100644
index 000000000000..f101eb223106
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libcli/default.nix
@@ -0,0 +1,31 @@
+{ stdenv, fetchFromGitHub, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "libcli-${version}";
+  version = "1.9.7";
+
+  src = fetchFromGitHub {
+    sha256 = "08pmjhqkwldhmcwjhi2l27slf1fk6nxxfaihnk2637pqkycy8z0c";
+    rev = "v${version}";
+    repo = "libcli";
+    owner = "dparrish";
+  };
+
+  patches =
+    [ (fetchurl {
+        url = "https://github.com/dparrish/libcli/commit/ebc5a09db457ee1be9996711463cbbafe5ea72d5.patch";
+        sha256 = "0szjiw3gd7by1sv924shnngfxvc98xvaqvx228b575xq93xxjcwl";
+      })
+    ];
+
+  enableParallelBuilding = true;
+
+  makeFlags = [ "PREFIX=$(out)" ];
+
+  meta = with stdenv.lib; {
+    description = "Emulate a Cisco-style telnet command-line interface";
+    homepage = http://sites.dparrish.com/libcli;
+    license = licenses.lgpl21Plus;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libcloudproviders/default.nix b/nixpkgs/pkgs/development/libraries/libcloudproviders/default.nix
new file mode 100644
index 000000000000..2814d6c5c1ea
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libcloudproviders/default.nix
@@ -0,0 +1,31 @@
+{ stdenv, fetchurl, meson, ninja, pkgconfig, gobject-introspection, vala, gtk-doc, docbook_xsl, glib }:
+
+# TODO: Add installed tests once https://gitlab.gnome.org/World/libcloudproviders/issues/4 is fixed
+
+stdenv.mkDerivation rec {
+  pname = "libcloudproviders";
+  version = "0.3.0";
+
+  src = fetchurl {
+    url = "https://gitlab.gnome.org/World/${pname}/repository/archive.tar.gz?ref=${version}";
+    sha256 = "1hby7vhxn6fw4ih3xbx6ab9vqp3a3dmlhr0z7mrwr73b7ankly0l";
+  };
+
+  outputs = [ "out" "dev" "devdoc" ];
+
+  mesonFlags = [
+    "-Denable-gtk-doc=true"
+  ];
+
+  nativeBuildInputs = [ meson ninja pkgconfig gobject-introspection vala gtk-doc docbook_xsl ];
+
+  buildInputs = [ glib ];
+
+  meta = with stdenv.lib; {
+    description = "DBus API that allows cloud storage sync clients to expose their services";
+    homepage = https://gitlab.gnome.org/World/libcloudproviders;
+    license = licenses.lgpl3Plus;
+    maintainers = with maintainers; [ jtojnar ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libclthreads/default.nix b/nixpkgs/pkgs/development/libraries/libclthreads/default.nix
new file mode 100644
index 000000000000..a2f6858a05c9
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libclthreads/default.nix
@@ -0,0 +1,40 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "libclthreads-${version}";
+  version = "2.4.2";
+
+  src = fetchurl {
+    url = "https://kokkinizita.linuxaudio.org/linuxaudio/downloads/clthreads-${version}.tar.bz2";
+    sha256 = "0cbs1w89q8wfjrrhvxf6xk0y02nkjl5hd0yb692c8ma01i6b2nf6";
+  };
+
+  patchPhase = ''
+    cd source
+    # don't run ldconfig:
+    sed -e "/ldconfig/d" -i ./Makefile
+  '';
+
+  makeFlags = [
+    "PREFIX=$(out)"
+    "SUFFIX=''"
+  ];
+
+  preInstall = ''
+    # The Makefile does not create the include and lib directories
+    mkdir -p $out/include
+    mkdir -p $out/lib
+  '';
+
+  postInstall = ''
+    ln $out/lib/libclthreads.so $out/lib/libclthreads.so.2
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Zita thread library";
+    homepage = http://kokkinizita.linuxaudio.org/linuxaudio/downloads/index.html;
+    license = licenses.lgpl21;
+    maintainers = with maintainers; [ magnetophon ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libclxclient/default.nix b/nixpkgs/pkgs/development/libraries/libclxclient/default.nix
new file mode 100644
index 000000000000..49bc2347ba77
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libclxclient/default.nix
@@ -0,0 +1,49 @@
+{ stdenv, fetchurl, libclthreads, libX11, libXft, xorg, pkgconfig }:
+
+stdenv.mkDerivation rec {
+  name = "libclxclient-${version}";
+  version = "3.9.2";
+
+  src = fetchurl {
+    url = "https://kokkinizita.linuxaudio.org/linuxaudio/downloads/clxclient-${version}.tar.bz2";
+    sha256 = "10bq6fy8d3pr1x2x3xx9qhf2hdxrwdgvg843a2y6lx70y1jfj0c5";
+  };
+
+  buildInputs = [ libclthreads libX11 libXft xorg.xorgproto ];
+
+  nativeBuildInputs = [ pkgconfig ];
+
+  NIX_CFLAGS_COMPILE = "-I${xorg.xorgproto}/include -I${libXft.dev}/include";
+
+  patchPhase = ''
+    cd source
+    # use pkg-config instead of pkgcon:
+    sed -e 's/pkgconf/pkg-config/g' -i ./Makefile
+    # don't run ldconfig:
+    sed -e "/ldconfig/d" -i ./Makefile
+    # make sure it can find clxclient.h:
+    sed -e 's/<clxclient.h>/"clxclient.h"/' -i ./enumip.cc
+  '';
+
+  makeFlags = [
+    "PREFIX=$(out)"
+    "SUFFIX=''"
+  ];
+
+  preInstall = ''
+    # The Makefile does not create the include directory
+    mkdir -p $out/include
+  '';
+
+  postInstall = ''
+    ln $out/lib/libclxclient.so $out/lib/libclxclient.so.3
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Zita X11 library";
+    homepage = http://kokkinizita.linuxaudio.org/linuxaudio/downloads/index.html;
+    license = licenses.lgpl21;
+    maintainers = with maintainers; [ magnetophon ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libcmis/default.nix b/nixpkgs/pkgs/development/libraries/libcmis/default.nix
new file mode 100644
index 000000000000..53474190ce96
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libcmis/default.nix
@@ -0,0 +1,32 @@
+{ stdenv, fetchFromGitHub, boost, libxml2, pkgconfig, docbook2x, curl, autoreconfHook, cppunit }:
+
+stdenv.mkDerivation rec {
+  pname = "libcmis";
+  version = "0.5.2";
+
+  src = fetchFromGitHub {
+    owner = "tdf";
+    repo = pname;
+    rev = "v${version}";
+    sha256 = "0s6prfh55hn11vrs72ph1gs01v0vngly81pvyjm5v1sgwymdxx57";
+  };
+
+  nativeBuildInputs = [ autoreconfHook pkgconfig docbook2x ];
+  buildInputs = [ boost libxml2 curl cppunit ];
+
+  configureFlags = [
+    "--disable-werror"
+    "DOCBOOK2MAN=${docbook2x}/bin/docbook2man"
+  ];
+
+  doCheck = true;
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    description = "C++ client library for the CMIS interface";
+    homepage = https://sourceforge.net/projects/libcmis/;
+    license = licenses.gpl2;
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libcollectdclient/default.nix b/nixpkgs/pkgs/development/libraries/libcollectdclient/default.nix
new file mode 100644
index 000000000000..0f1cbeb2f96f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libcollectdclient/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, collectd }:
+with stdenv.lib;
+
+collectd.overrideAttrs (oldAttrs: {
+  name = "libcollectdclient-${collectd.version}";
+  buildInputs = [ ];
+
+  configureFlags = (oldAttrs.configureFlags or []) ++ [
+    "--disable-daemon"
+    "--disable-all-plugins"
+  ];
+
+  postInstall = "rm -rf $out/{bin,etc,sbin,share}";
+
+  meta = with stdenv.lib; {
+    description = "C Library for collectd, a daemon which collects system performance statistics periodically";
+    homepage = http://collectd.org;
+    license = licenses.gpl2;
+    platforms = platforms.linux; # TODO: collectd may be linux but the C client may be more portable?
+    maintainers = [ maintainers.sheenobu maintainers.bjornfor ];
+  };
+})
diff --git a/nixpkgs/pkgs/development/libraries/libcommuni/default.nix b/nixpkgs/pkgs/development/libraries/libcommuni/default.nix
new file mode 100644
index 000000000000..f247c48821f7
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libcommuni/default.nix
@@ -0,0 +1,44 @@
+{ stdenv, fetchFromGitHub
+, qtbase, qtdeclarative, qmake, which
+}:
+
+stdenv.mkDerivation rec {
+  name = "libcommuni-${version}";
+  version = "3.5.0";
+
+  src = fetchFromGitHub {
+    owner = "communi";
+    repo = "libcommuni";
+    rev = "v${version}";
+    sha256 = "15crqc7a4kwrfbxs121rpdysw0694hh7dr290gg7pm61akvnrqcm";
+  };
+
+  buildInputs = [ qtbase qtdeclarative ];
+  nativeBuildInputs = [ qmake which ];
+
+  enableParallelBuilding = true;
+
+  dontUseQmakeConfigure = true;
+  configureFlags = [ "-config" "release" ];
+
+  preConfigure = ''
+    sed -i -e 's|/bin/pwd|pwd|g' configure
+  '';
+
+  # The tests fail on darwin because of install_name if they run
+  # before the frameworks are installed.
+  doCheck = false;
+  doInstallCheck = true;
+  installCheckTarget = "check";
+
+  # Hack to avoid TMPDIR in RPATHs.
+  preFixup = "rm -rf lib";
+
+  meta = with stdenv.lib; {
+    description = "A cross-platform IRC framework written with Qt";
+    homepage = https://communi.github.io;
+    license = licenses.bsd3;
+    platforms = platforms.all;
+    maintainers = with maintainers; [ hrdinka ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libconfig/default.nix b/nixpkgs/pkgs/development/libraries/libconfig/default.nix
new file mode 100644
index 000000000000..cdc225c8bf73
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libconfig/default.nix
@@ -0,0 +1,21 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  pname = "libconfig";
+  version = "1.7.2";
+
+  src = fetchurl {
+    url = "https://hyperrealm.github.io/${pname}/dist/${pname}-${version}.tar.gz";
+    sha256 = "1ngs2qx3cx5cbwinc5mvadly0b5n7s86zsc68c404czzfff7lg3w";
+  };
+
+  doCheck = true;
+
+  meta = with stdenv.lib; {
+    homepage = http://www.hyperrealm.com/libconfig;
+    description = "A simple library for processing structured configuration files";
+    license = licenses.lgpl3;
+    maintainers = [ maintainers.goibhniu ];
+    platforms = platforms.linux ++ platforms.darwin;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libconfuse/default.nix b/nixpkgs/pkgs/development/libraries/libconfuse/default.nix
new file mode 100644
index 000000000000..ee3f511d4359
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libconfuse/default.nix
@@ -0,0 +1,38 @@
+{ stdenv, fetchFromGitHub, autoreconfHook, flex }:
+
+stdenv.mkDerivation rec {
+  name = "libconfuse-${version}";
+  version = "3.2.2";
+
+  src = fetchFromGitHub {
+    sha256 = "0djjq7j9iiyqxqqrlzm476xkibjasqvgzjwkalgj1l3f2smi53aw";
+    rev = "v${version}";
+    repo = "libconfuse";
+    owner = "martinh";
+  };
+
+  nativeBuildInputs = [ autoreconfHook flex ];
+
+  enableParallelBuilding = true;
+
+  # On darwin the tests depend on the installed libraries because of install_name.
+  doInstallCheck = true;
+  installCheckTarget = "check";
+
+  meta = with stdenv.lib; {
+    inherit (src.meta) homepage;
+    description = "Small configuration file parser library for C";
+    longDescription = ''
+      libConfuse (previously libcfg) is a configuration file parser library
+      written in C. It supports sections and (lists of) values, as well as
+      some other features. It makes it very easy to add configuration file
+      capability to a program using a simple API.
+
+      The goal of libConfuse is not to be the configuration file parser library
+      with a gazillion of features. Instead, it aims to be easy to use and
+      quick to integrate with your code.
+    '';
+    license = licenses.isc;
+    platforms = platforms.linux ++ platforms.darwin;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libcouchbase/default.nix b/nixpkgs/pkgs/development/libraries/libcouchbase/default.nix
new file mode 100644
index 000000000000..77f495e32b84
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libcouchbase/default.nix
@@ -0,0 +1,30 @@
+{ stdenv, fetchFromGitHub, cmake, pkgconfig, libevent, openssl}:
+
+stdenv.mkDerivation rec {
+  name = "libcouchbase-${version}";
+  version = "2.10.3";
+
+  src = fetchFromGitHub {
+    owner = "couchbase";
+    repo = "libcouchbase";
+    rev = version;
+    sha256 = "0a3fin5rcwa3xwd980mrzrkr7dpjdwbri81mqwxw1fkppjqw23z4";
+  };
+
+  cmakeFlags = "-DLCB_NO_MOCK=ON";
+
+  nativeBuildInputs = [ cmake pkgconfig ];
+  buildInputs = [ libevent openssl ];
+
+  # Running tests in parallel does not work
+  enableParallelChecking = false;
+
+  doCheck = !stdenv.isDarwin;
+
+  meta = with stdenv.lib; {
+    description = "C client library for Couchbase";
+    homepage = https://github.com/couchbase/libcouchbase;
+    license = licenses.asl20;
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libcrafter/default.nix b/nixpkgs/pkgs/development/libraries/libcrafter/default.nix
new file mode 100644
index 000000000000..fff31a96ce77
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libcrafter/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchzip, autoconf, automake, libtool, libpcap }:
+
+stdenv.mkDerivation rec {
+  name = "libcrafter-${version}";
+  version = "0.3";
+
+  src = fetchzip {
+    url = "https://github.com/pellegre/libcrafter/archive/version-${version}.zip";
+    sha256 = "04lpmshh4wb1dav03p6rnskpd1zmmvhv80xwn8v7l8faps5gvjp4";
+  };
+
+  preConfigure = "cd libcrafter";
+
+  configureScript = "./autogen.sh";
+
+  configureFlags = [ "--with-libpcap=yes" ];
+
+  buildInputs = [ autoconf automake libtool ];
+
+  propagatedBuildInputs = [ libpcap ];
+
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libcredis/default.nix b/nixpkgs/pkgs/development/libraries/libcredis/default.nix
new file mode 100644
index 000000000000..10a4c276ebd5
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libcredis/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "libcredis-0.2.3";
+
+  src = fetchurl {
+    url = "https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/credis/credis-0.2.3.tar.gz";
+    sha256 = "1l3hlw9rrc11qggbg9a2303p3bhxxx2vqkmlk8avsrbqw15r1ayr";
+  };
+
+  # credis build system has no install actions, provide our own.
+  installPhase = ''
+    mkdir -p "$out/bin"
+    mkdir -p "$out/lib"
+    mkdir -p "$out/include"
+
+    cp -v credis-test "$out/bin/"
+    cp -v *.a *.so "$out/lib/"
+    cp -v *.h "$out/include/"
+  '';
+
+  meta = with stdenv.lib; {
+    description = "C client library for Redis (key-value database)";
+    homepage = https://code.google.com/archive/p/credis/;
+    license = licenses.bsd3; # from homepage
+    platforms = platforms.linux;
+    maintainers = [ maintainers.bjornfor ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libcroco/default.nix b/nixpkgs/pkgs/development/libraries/libcroco/default.nix
new file mode 100644
index 000000000000..90ed8c6d985d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libcroco/default.nix
@@ -0,0 +1,32 @@
+{ stdenv, fetchurl, pkgconfig, libxml2, glib, gnome3 }:
+
+stdenv.mkDerivation rec {
+  pname = "libcroco";
+  version = "0.6.13";
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    sha256 = "1m110rbj5d2raxcdp4iz0qp172284945awrsbdlq99ksmqsc4zkn";
+  };
+
+  outputs = [ "out" "dev" ];
+  outputBin = "dev";
+
+  configureFlags = stdenv.lib.optional stdenv.isDarwin "--disable-Bsymbolic";
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ libxml2 glib ];
+
+  passthru = {
+    updateScript = gnome3.updateScript {
+      packageName = pname;
+    };
+  };
+
+  meta = with stdenv.lib; {
+    description = "GNOME CSS2 parsing and manipulation toolkit";
+    homepage = https://gitlab.gnome.org/GNOME/libcroco;
+    license = licenses.lgpl2;
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libcrossguid/default.nix b/nixpkgs/pkgs/development/libraries/libcrossguid/default.nix
new file mode 100644
index 000000000000..e5c09675c4b0
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libcrossguid/default.nix
@@ -0,0 +1,35 @@
+{ stdenv, fetchFromGitHub, libuuid }:
+
+stdenv.mkDerivation rec {
+  name = "lib" + pname + "-" + version;
+  pname = "crossguid";
+  version = "2016-02-21";
+
+  src = fetchFromGitHub {
+    owner = "graeme-hill";
+    repo = pname;
+    rev = "8f399e8bd4252be9952f3dfa8199924cc8487ca4";
+    sha256 = "1i29y207qqddvaxbn39pk2fbh3gx8zvdprfp35wasj9rw2wjk3s9";
+  };
+
+  buildInputs = [ libuuid ];
+
+  buildPhase = ''
+    g++ -c guid.cpp -o guid.o $CXXFLAGS -std=c++11 -DGUID_LIBUUID
+    ar rvs libcrossguid.a guid.o
+  '';
+  installPhase = ''
+    mkdir -p $out/{lib,include}
+    install -D -m644 libcrossguid.a "$out/lib/libcrossguid.a"
+    install -D -m644 guid.h "$out/include/guid.h"
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Lightweight cross platform C++ GUID/UUID library";
+    license = licenses.mit;
+    maintainers = with maintainers; [ edwtjo ];
+    homepage = https://github.com/graeme-hill/crossguid;
+    platforms = with platforms; linux;
+  };
+
+}
diff --git a/nixpkgs/pkgs/development/libraries/libcryptui/default.nix b/nixpkgs/pkgs/development/libraries/libcryptui/default.nix
new file mode 100644
index 000000000000..fef8e7f510df
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libcryptui/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchurl, pkgconfig, intltool, glib, gnome3, gtk3, gnupg20, 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";
+    sha256 = "0rh8wa5k2iwbwppyvij2jdxmnlfjbna7kbh2a5n7zw4nnjkx3ski";
+  };
+
+  nativeBuildInputs = [ pkgconfig intltool ];
+  buildInputs = [ glib gtk3 gnupg20 gpgme dbus-glib libgnome-keyring ];
+  propagatedBuildInputs = [ dbus-glib ];
+
+  passthru = {
+    updateScript = gnome3.updateScript {
+      packageName = pname;
+    };
+  };
+
+  meta = with stdenv.lib; {
+    description = "Interface components for OpenPGP";
+    homepage = https://gitlab.gnome.org/GNOME/libcryptui;
+    license = licenses.lgpl21Plus;
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libcsptr/default.nix b/nixpkgs/pkgs/development/libraries/libcsptr/default.nix
new file mode 100644
index 000000000000..d7638dd20597
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libcsptr/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchFromGitHub, cmake, git }:
+
+stdenv.mkDerivation rec {
+  name = "libcsptr-${version}";
+  version = "2.0.4";
+
+  src = fetchFromGitHub {
+    owner = "Snaipe";
+    repo = "libcsptr";
+    rev = "v${version}";
+    sha256 = "0i1498h2i6zq3fn3zf3iw7glv6brn597165hnibgwccqa8sh3ich";
+  };
+
+  nativeBuildInputs = [ cmake ];
+
+  meta = with stdenv.lib; {
+    description = "Smart pointer constructs for the (GNU) C programming language";
+    homepage = https://github.com/Snaipe/libcsptr;
+    license = licenses.mit;
+    platforms = [ "i686-linux" "x86_64-linux" ];
+    maintainers = [ maintainers.fragamus ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libctemplate/default.nix b/nixpkgs/pkgs/development/libraries/libctemplate/default.nix
new file mode 100644
index 000000000000..94dc733a69b0
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libctemplate/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchurl, python2 }:
+
+stdenv.mkDerivation rec {
+  name = "ctemplate-${version}";
+
+  version = "2.3";
+
+  src = fetchurl {
+    url = "https://github.com/OlafvdSpek/ctemplate/archive/ctemplate-${version}.tar.gz";
+    sha256 = "0mi5g2xlws10z1g4x0cj6kd1r673kkav35pgzyqxa1w47xnwprcr";
+  };
+
+  buildInputs = [ python2 ];
+
+  postPatch = ''
+    patchShebangs .
+  '';
+
+  meta = {
+    description = "A simple but powerful template language for C++";
+    longDescription = ''
+      CTemplate is a simple but powerful template language for C++. It
+      emphasizes separating logic from presentation: it is impossible to
+      embed application logic in this template language.
+    '';
+    homepage = https://github.com/OlafvdSpek/ctemplate;
+    license = stdenv.lib.licenses.bsd3;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libcue/default.nix b/nixpkgs/pkgs/development/libraries/libcue/default.nix
new file mode 100644
index 000000000000..e50b8a13b950
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libcue/default.nix
@@ -0,0 +1,30 @@
+{ stdenv, fetchFromGitHub, cmake, bison, flex }:
+
+stdenv.mkDerivation rec {
+  name = "libcue-${version}";
+  version = "2.2.1";
+
+  src = fetchFromGitHub {
+    owner = "lipnitsk";
+    repo = "libcue";
+    rev = "v${version}";
+    sha256 = "1iqw4n01rv2jyk9lksagyxj8ml0kcfwk67n79zy1r6zv1xfp5ywm";
+  };
+
+  nativeBuildInputs = [ cmake bison flex ];
+
+  doCheck = false; # fails all the tests (ctest)
+
+  meta = with stdenv.lib; {
+    description = "CUE Sheet Parser Library";
+    longDescription = ''
+      libcue is intended to parse a so called cue sheet from a char string or
+      a file pointer. For handling of the parsed data a convenient API is
+      available.
+    '';
+    homepage = https://sourceforge.net/projects/libcue/;
+    license = licenses.gpl2;
+    maintainers = with maintainers; [ astsmtl ];
+    platforms = platforms.linux ++ platforms.darwin;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libcutl/default.nix b/nixpkgs/pkgs/development/libraries/libcutl/default.nix
new file mode 100644
index 000000000000..81122a6eb520
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libcutl/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchurl, xercesc }:
+let
+    major = "1.9";
+    minor = "0";
+in
+with stdenv; with lib;
+mkDerivation rec {
+  name = "libcutl-${major}.${minor}";
+
+  meta = {
+    description = "A collection of generic and independent components such as meta-programming tests, smart pointers, containers, compiler building blocks" ;
+    platforms = platforms.all;
+    maintainers = with maintainers; [ ];
+    license = licenses.mit;
+  };
+
+  src = fetchurl {
+    url = "https://codesynthesis.com/download/libcutl/1.9/${name}.tar.bz2";
+    sha1 = "0e8d255145afbc339a3284ef85a43f4baf3fec43";
+  };
+
+  buildInputs = [ xercesc ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/libdaemon/default.nix b/nixpkgs/pkgs/development/libraries/libdaemon/default.nix
new file mode 100644
index 000000000000..5dc153dd5ccc
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libdaemon/default.nix
@@ -0,0 +1,25 @@
+{stdenv, fetchurl}:
+
+stdenv.mkDerivation rec {
+  name = "libdaemon-0.14";
+
+  src = fetchurl {
+    url = "${meta.homepage}/${name}.tar.gz";
+    sha256 = "0d5qlq5ab95wh1xc87rqrh1vx6i8lddka1w3f1zcqvcqdxgyn8zx";
+  };
+
+  patches = [ ./fix-includes.patch ];
+
+  configureFlags = [ "--disable-lynx" ]
+    ++ stdenv.lib.optional (stdenv.hostPlatform != stdenv.buildPlatform)
+    [ # Can't run this test while cross-compiling
+      "ac_cv_func_setpgrp_void=yes"
+    ];
+
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libdaemon/fix-includes.patch b/nixpkgs/pkgs/development/libraries/libdaemon/fix-includes.patch
new file mode 100644
index 000000000000..51c5133afede
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libdaemon/fix-includes.patch
@@ -0,0 +1,13 @@
+--- libdaemon-0.14.orig/examples/testd.c
++++ libdaemon-0.14/examples/testd.c
+@@ -21,9 +21,9 @@
+ #include <signal.h>
+ #include <errno.h>
+ #include <string.h>
++#include <unistd.h>
+ #include <sys/types.h>
+ #include <sys/time.h>
+-#include <sys/unistd.h>
+ #include <sys/select.h>
+ 
+ #include <libdaemon/dfork.h>
diff --git a/nixpkgs/pkgs/development/libraries/libdap/default.nix b/nixpkgs/pkgs/development/libraries/libdap/default.nix
new file mode 100644
index 000000000000..067144ddfa0c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libdap/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, fetchurl, bison, libuuid, curl, libxml2, flex }:
+
+stdenv.mkDerivation rec {
+  version = "3.20.3";
+  name = "libdap-${version}";
+
+  nativeBuildInputs = [ bison flex ];
+  buildInputs = [ libuuid curl libxml2 ];
+
+  src = fetchurl {
+    url = "https://www.opendap.org/pub/source/${name}.tar.gz";
+    sha256 = "0n6ciicaa7sn88gvg5sgcq0438i3vh6xbl9lxgafjqiznli1k5i9";
+  };
+
+  meta = with stdenv.lib; {
+    description = "A C++ SDK which contains an implementation of DAP";
+    homepage = https://www.opendap.org/software/libdap;
+    license = licenses.lgpl2;
+    maintainers = [ maintainers.bzizou ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libdazzle/default.nix b/nixpkgs/pkgs/development/libraries/libdazzle/default.nix
new file mode 100644
index 000000000000..28d9152dcee7
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libdazzle/default.nix
@@ -0,0 +1,58 @@
+{ stdenv, fetchurl, ninja, meson, pkgconfig, vala, gobject-introspection, libxml2
+, gtk-doc, docbook_xsl, docbook_xml_dtd_43, glibcLocales, dbus, xvfb_run, glib, gtk3, gnome3 }:
+
+let
+  version = "3.32.2";
+  pname = "libdazzle";
+in
+stdenv.mkDerivation {
+  name = "${pname}-${version}";
+
+  outputs = [ "out" "dev" "devdoc" ];
+  outputBin = "dev";
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/libdazzle/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    sha256 = "0hgi7gnkna9n42nh7p81crrw0jjj22yr8acych60wxh6hzxqsgs1";
+  };
+
+  nativeBuildInputs = [ ninja meson pkgconfig vala gobject-introspection libxml2 gtk-doc docbook_xsl docbook_xml_dtd_43 glibcLocales dbus xvfb_run ];
+  buildInputs = [ glib gtk3 ];
+
+  mesonFlags = [
+    "-Denable_gtk_doc=true"
+  ];
+
+  LC_ALL = "en_US.UTF-8";
+
+  # https://gitlab.gnome.org/GNOME/libdazzle/issues/25
+  doCheck = false;
+
+  checkPhase = ''
+    export NO_AT_BRIDGE=1
+    xvfb-run -s '-screen 0 800x600x24' dbus-run-session \
+      --config-file=${dbus.daemon}/share/dbus-1/session.conf \
+      meson test --print-errorlogs
+  '';
+
+  passthru = {
+    updateScript = gnome3.updateScript {
+      packageName = pname;
+    };
+  };
+
+  meta = with stdenv.lib; {
+    description = "A library to delight your users with fancy features";
+    longDescription = ''
+      The libdazzle library is a companion library to GObject and Gtk+. It
+      provides various features that we wish were in the underlying library but
+      cannot for various reasons. In most cases, they are wildly out of scope
+      for those libraries. In other cases, our design isn't quite generic
+      enough to work for everyone.
+    '';
+    homepage = https://wiki.gnome.org/Apps/Builder;
+    license = licenses.gpl3Plus;
+    maintainers = gnome3.maintainers;
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libdbi-drivers/default.nix b/nixpkgs/pkgs/development/libraries/libdbi-drivers/default.nix
new file mode 100644
index 000000000000..99cd636b03b8
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libdbi-drivers/default.nix
@@ -0,0 +1,62 @@
+{ stdenv, fetchurl, libdbi
+, mysql ? null
+, sqlite ? null
+, postgresql ? null
+}:
+
+with stdenv.lib;
+stdenv.mkDerivation rec {
+  name = "libdbi-drivers-0.9.0";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/libdbi-drivers/${name}.tar.gz";
+    sha256 = "0m680h8cc4428xin4p733azysamzgzcmv4psjvraykrsaz6ymlj3";
+  };
+
+  buildInputs = [ libdbi sqlite postgresql ] ++ optional (mysql != null) mysql.connector-c;
+
+  postPatch = ''
+    sed -i '/SQLITE3_LIBS/ s/-lsqlite/-lsqlite3/' configure;
+  '';
+
+  configureFlags = [
+    "--sysconfdir=/etc"
+    "--localstatedir=/var"
+    "--disable-docs"
+    "--enable-libdbi"
+    "--with-dbi-incdir=${libdbi}/include"
+    "--with-dbi-libdir=${libdbi}/lib"
+  ] ++ optionals (mysql != null) [
+    "--with-mysql"
+    "--with-mysql-incdir=${mysql.connector-c}/include/mysql"
+    "--with-mysql-libdir=${mysql.connector-c}/lib/mysql"
+  ] ++ optionals (sqlite != null) [
+    "--with-sqlite3"
+    "--with-sqlite3-incdir=${sqlite.dev}/include/sqlite"
+    "--with-sqlite3-libdir=${sqlite.out}/lib/sqlite"
+  ] ++ optionals (postgresql != null) [
+    "--with-pgsql"
+    "--with-pgsql_incdir=${postgresql}/include"
+    "--with-pgsql_libdir=${postgresql.lib}/lib"
+  ];
+
+  installFlags = [ "DESTDIR=\${out}" ];
+
+  postInstall = ''
+    mv $out/$out/* $out
+    DIR=$out/$out
+    while rmdir $DIR 2>/dev/null; do
+      DIR="$(dirname "$DIR")"
+    done
+
+    # Remove the unneeded var/lib directories
+    rm -rf $out/var
+  '';
+
+  meta = {
+    homepage = http://libdbi-drivers.sourceforge.net/;
+    description = "Database drivers for libdbi";
+    platforms = platforms.all;
+    license = licenses.lgpl21;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libdbi/default.nix b/nixpkgs/pkgs/development/libraries/libdbi/default.nix
new file mode 100644
index 000000000000..b242bd8613ef
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libdbi/default.nix
@@ -0,0 +1,17 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "libdbi-0.9.0";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/libdbi/${name}.tar.gz";
+    sha256 = "00s5ra7hdlq25iv23nwf4h1v3kmbiyzx0v9bhggjiii4lpf6ryys";
+  };
+
+  meta = with stdenv.lib; {
+    homepage = http://libdbi.sourceforge.net/;
+    description = "DB independent interface to DB";
+    license = licenses.lgpl21;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libdbusmenu-qt/default.nix b/nixpkgs/pkgs/development/libraries/libdbusmenu-qt/default.nix
new file mode 100644
index 000000000000..72c3ca0e2b05
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libdbusmenu-qt/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchurl, qt4, cmake }:
+
+let
+  baseName = "libdbusmenu-qt";
+  v = "0.9.2";
+  homepage = "https://launchpad.net/${baseName}";
+  name = "${baseName}-${v}";
+in
+
+stdenv.mkDerivation {
+  inherit name;
+
+  src = fetchurl {
+    url = "${homepage}/trunk/${v}/+download/${name}.tar.bz2";
+    sha256 = "1v0ri5g9xw2z64ik0kx0ra01v8rpjn2kxprrxppkls1wvav1qv5f";
+  };
+
+  buildInputs = [ qt4 ];
+  nativeBuildInputs = [ cmake ];
+
+  cmakeFlags = "-DWITH_DOC=OFF";
+
+  meta = with stdenv.lib; {
+    description = "Provides a Qt implementation of the DBusMenu spec";
+    inherit homepage;
+    inherit (qt4.meta) platforms;
+    license = licenses.lgpl2;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libdbusmenu-qt/qt-5.5.nix b/nixpkgs/pkgs/development/libraries/libdbusmenu-qt/qt-5.5.nix
new file mode 100644
index 000000000000..32b0c9758f73
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libdbusmenu-qt/qt-5.5.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchgit, cmake, qtbase }:
+
+stdenv.mkDerivation rec {
+  name = "libdbusmenu-qt-${version}";
+  version = "0.9.3+16";
+
+  src = fetchgit {
+    url = https://git.launchpad.net/ubuntu/+source/libdbusmenu-qt;
+    rev = "import/${version}.04.20160218-1";
+    sha256 = "039yvklhbmfbcynrbqq9n5ywmj8bjfslnkzcnwpzyhnxdzb6yxlx";
+  };
+
+  buildInputs = [ qtbase ];
+  nativeBuildInputs = [ cmake ];
+
+  cmakeFlags = "-DWITH_DOC=OFF";
+
+  meta = with stdenv.lib; {
+    homepage = https://launchpad.net/libdbusmenu-qt;
+    description = "Provides a Qt implementation of the DBusMenu spec";
+    maintainers = [ maintainers.ttuegel ];
+    inherit (qtbase.meta) platforms;
+    license = licenses.lgpl2;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libdbusmenu/default.nix b/nixpkgs/pkgs/development/libraries/libdbusmenu/default.nix
new file mode 100644
index 000000000000..e064084f695e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libdbusmenu/default.nix
@@ -0,0 +1,64 @@
+{ stdenv, fetchurl, lib, file
+, pkgconfig, intltool
+, glib, dbus-glib, json-glib
+, gobject-introspection, vala, gnome-doc-utils
+, gtkVersion ? null, gtk2 ? null, gtk3 ? null }:
+
+with lib;
+
+stdenv.mkDerivation rec {
+  name = let postfix = if gtkVersion == null then "glib" else "gtk${gtkVersion}";
+          in "libdbusmenu-${postfix}-${version}";
+  version = "${versionMajor}.${versionMinor}";
+  versionMajor = "16.04";
+  versionMinor = "0";
+
+  src = fetchurl {
+    url = "${meta.homepage}/${versionMajor}/${version}/+download/libdbusmenu-${version}.tar.gz";
+    sha256 = "12l7z8dhl917iy9h02sxmpclnhkdjryn08r8i4sr8l3lrlm4mk5r";
+  };
+
+  nativeBuildInputs = [ vala pkgconfig intltool ];
+
+  buildInputs = [
+    glib dbus-glib json-glib
+    gobject-introspection gnome-doc-utils
+  ] ++ optional (gtkVersion != null) (if gtkVersion == "2" then gtk2 else gtk3);
+
+  postPatch = ''
+    for f in {configure,ltmain.sh,m4/libtool.m4}; do
+      substituteInPlace $f \
+        --replace /usr/bin/file ${file}/bin/file
+    done
+  '';
+
+  # https://projects.archlinux.org/svntogit/community.git/tree/trunk/PKGBUILD?h=packages/libdbusmenu
+  preConfigure = ''
+    export HAVE_VALGRIND_TRUE="#"
+    export HAVE_VALGRIND_FALSE=""
+  '';
+
+  configureFlags = [
+    "CFLAGS=-Wno-error"
+    "--sysconfdir=/etc"
+    "--localstatedir=/var"
+    (if gtkVersion == null then "--disable-gtk" else "--with-gtk=${gtkVersion}")
+    "--disable-scrollkeeper"
+  ] ++ optional (gtkVersion != "2") "--disable-dumper";
+
+  doCheck = false; # generates shebangs in check phase, too lazy to fix
+
+  installFlags = [
+    "sysconfdir=${placeholder ''out''}/etc"
+    "localstatedir=\${TMPDIR}"
+    "typelibdir=${placeholder ''out''}/lib/girepository-1.0"
+  ];
+
+  meta = {
+    description = "Library for passing menu structures across DBus";
+    homepage = https://launchpad.net/dbusmenu;
+    license = with licenses; [ gpl3 lgpl21 lgpl3 ];
+    platforms = platforms.linux;
+    maintainers = [ maintainers.msteen ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libdc1394/default.nix b/nixpkgs/pkgs/development/libraries/libdc1394/default.nix
new file mode 100644
index 000000000000..86b9fcd0bef3
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libdc1394/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchurl, libraw1394
+, libusb1, CoreServices }:
+
+stdenv.mkDerivation rec {
+  name = "libdc1394-${version}";
+  version = "2.2.6";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/libdc1394/${name}.tar.gz";
+    sha256 = "1v8gq54n1pg8izn7s15yylwjf8r1l1dmzbm2yvf6pv2fmb4mz41b";
+  };
+
+  buildInputs = [ libusb1 ]
+    ++ stdenv.lib.optional stdenv.isLinux libraw1394
+    ++ stdenv.lib.optional stdenv.isDarwin CoreServices;
+
+  meta = with stdenv.lib; {
+    homepage = https://sourceforge.net/projects/libdc1394/;
+    description = "Capture and control API for IIDC compliant cameras";
+    license = licenses.lgpl21Plus;
+    maintainers = [ maintainers.viric ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libde265/default.nix b/nixpkgs/pkgs/development/libraries/libde265/default.nix
new file mode 100644
index 000000000000..07823072bad4
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libde265/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchFromGitHub, autoreconfHook, pkgconfig }:
+
+stdenv.mkDerivation rec {
+  version = "1.0.3";
+  name = "libde265-${version}";
+
+  src = fetchFromGitHub {
+    owner = "strukturag";
+    repo = "libde265";
+    rev = "v${version}";
+    sha256 = "049g77f6c5sbk1h534zi9akj3y5h8zwnca5c9kqqjkn7f17irk10";
+  };
+
+  nativeBuildInputs = [ autoreconfHook pkgconfig ];
+
+  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 ];
+  };
+
+}
diff --git a/nixpkgs/pkgs/development/libraries/libdeflate/default.nix b/nixpkgs/pkgs/development/libraries/libdeflate/default.nix
new file mode 100644
index 000000000000..db5448caa102
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libdeflate/default.nix
@@ -0,0 +1,31 @@
+{ stdenv, lib, fetchFromGitHub }:
+
+stdenv.mkDerivation rec {
+  name = "libdeflate-${version}";
+  version = "1.2";
+
+  src = fetchFromGitHub {
+    owner = "ebiggers";
+    repo = "libdeflate";
+    rev = "v${version}";
+    sha256 = "0kmp38s7vahvbgzzhs5v0bfyjgas1in7jn69gpyh70kl08279ly0";
+  };
+
+  postPatch = ''
+    substituteInPlace Makefile --replace /usr $out
+  '';
+
+  configurePhase = ''
+    make programs/config.h
+  '';
+
+  enableParallelBuilding = true;
+
+  meta = with lib; {
+    description = "Fast DEFLATE/zlib/gzip compressor and decompressor";
+    license = licenses.mit;
+    homepage = https://github.com/ebiggers/libdeflate;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ orivej ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libdevil/default.nix b/nixpkgs/pkgs/development/libraries/libdevil/default.nix
new file mode 100644
index 000000000000..78e7490cd992
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libdevil/default.nix
@@ -0,0 +1,59 @@
+{ stdenv, fetchurl, libjpeg, libpng, libmng, lcms1, libtiff, openexr, libGL
+, libX11, pkgconfig, OpenGL
+}:
+
+stdenv.mkDerivation rec {
+
+  name = "libdevil-${version}";
+  version = "1.7.8";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/openil/DevIL-${version}.tar.gz";
+    sha256 = "1zd850nn7nvkkhasrv7kn17kzgslr5ry933v6db62s4lr0zzlbv8";
+  };
+
+  outputs = [ "out" "dev" ];
+
+  buildInputs = [ libjpeg libpng libmng lcms1 libtiff openexr libGL libX11 ]
+    ++ stdenv.lib.optionals stdenv.isDarwin [ OpenGL ];
+  nativeBuildInputs = [ pkgconfig ];
+
+  configureFlags = [ "--enable-ILU" "--enable-ILUT" ];
+
+  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 ''
+    sed -i 's/libIL_la_CXXFLAGS = $(AM_CFLAGS)/libIL_la_CXXFLAGS =/g' lib/Makefile.in
+  '';
+
+  postConfigure = ''
+    sed -i '/RESTRICT_KEYWORD/d' include/IL/config.h
+  '';
+
+  patches =
+    [ ( fetchurl {
+        url = http://patch-tracker.debian.org/patch/series/dl/devil/1.7.8-6.1/03_CVE-2009-3994.diff;
+        sha256 = "0qkx2qfv02igbrmsn6z5a3lbrbwjfh3rb0c2sj54wy0j1f775hbc";
+      } )
+      ./ftbfs-libpng15.patch
+      ./il_endian.h.patch
+    ];
+
+  enableParallelBuilding = true;
+
+  postPatch = ''
+    for a in test/Makefile.in test/format_test/format_checks.sh.in ; do
+      substituteInPlace $a \
+        --replace /bin/bash ${stdenv.shell}
+    done
+  '';
+
+  meta = with stdenv.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;
+    platforms = platforms.mesaPlatforms;
+    maintainers = [ maintainers.phreedom ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libdevil/ftbfs-libpng15.patch b/nixpkgs/pkgs/development/libraries/libdevil/ftbfs-libpng15.patch
new file mode 100644
index 000000000000..5fc53c2dc6a7
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libdevil/ftbfs-libpng15.patch
@@ -0,0 +1,31 @@
+Source: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=649554
+--- devil-1.7.8.orig/src-IL/src/il_icon.c
++++ devil-1.7.8/src-IL/src/il_icon.c
+@@ -525,7 +525,11 @@
+ 
+ 	// Expand low-bit-depth grayscale images to 8 bits
+ 	if (ico_color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8) {
++#if PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4
++		png_set_expand_gray_1_2_4_to_8(ico_png_ptr);
++#else
+ 		png_set_gray_1_2_4_to_8(ico_png_ptr);
++#endif
+ 	}
+ 
+ 	// Expand RGB images with transparency to full alpha channels
+only in patch2:
+unchanged:
+--- devil-1.7.8.orig/src-IL/src/il_png.c
++++ devil-1.7.8/src-IL/src/il_png.c
+@@ -278,7 +278,11 @@
+ 
+ 	// Expand low-bit-depth grayscale images to 8 bits
+ 	if (png_color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8) {
++#if PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4
++		png_set_expand_gray_1_2_4_to_8(png_ptr);
++#else
+ 		png_set_gray_1_2_4_to_8(png_ptr);
++#endif
+ 	}
+ 
+ 	// Expand RGB images with transparency to full alpha channels
diff --git a/nixpkgs/pkgs/development/libraries/libdevil/il_endian.h.patch b/nixpkgs/pkgs/development/libraries/libdevil/il_endian.h.patch
new file mode 100644
index 000000000000..c220e6802fd9
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libdevil/il_endian.h.patch
@@ -0,0 +1,27 @@
+Source: http://sourceforge.net/p/resil/tickets/8/
+--- devil-1.7.8.orig/src-IL/include/il_endian.h.orig	2009-03-08 01:10:08.000000000 -0600
++++ devil-1.7.8/src-IL/include/il_endian.h	2013-11-03 01:52:37.000000000 -0600
+@@ -19,9 +19,13 @@
+ 	#ifndef __BIG_ENDIAN__
+ 	#define __BIG_ENDIAN__ 1
+ 	#endif
++#else
++	#ifndef __LITTLE_ENDIAN__
++	#define __LITTLE_ENDIAN__ 1
++	#endif
+ #endif
+ 
+-#if (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __BIG_ENDIAN__) \
++#if (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) \
+   || (defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__))
+  	#undef __LITTLE_ENDIAN__
+ 	#define Short(s) iSwapShort(s)
+@@ -39,8 +43,6 @@
+ 	#define BigDouble(d)  
+ #else
+ 	#undef __BIG_ENDIAN__
+-	#undef __LITTLE_ENDIAN__  // Not sure if it's defined by any compiler...
+-	#define __LITTLE_ENDIAN__
+ 	#define Short(s)  
+ 	#define UShort(s)  
+ 	#define Int(i)  
diff --git a/nixpkgs/pkgs/development/libraries/libdigidoc/default.nix b/nixpkgs/pkgs/development/libraries/libdigidoc/default.nix
new file mode 100644
index 000000000000..7fe7319ff15e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libdigidoc/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchurl, cmake, openssl, pcsclite, opensc, libxml2 }:
+
+stdenv.mkDerivation rec {
+
+  version = "3.10.4";
+  name = "libdigidoc-${version}";
+
+  src = fetchurl {
+    url = "https://github.com/open-eid/libdigidoc/releases/download/v${version}/libdigidoc-${version}.tar.gz";
+    sha256 = "0w5wsaj2a5wss1r9j39bfsrkp3xz0w3v1gnr190v6k7l74l453w1";
+  };
+
+  nativeBuildInputs = [ cmake ];
+
+  buildInputs = [ openssl pcsclite opensc libxml2 ];
+
+  meta = with stdenv.lib; {
+    description = "Library for creating DigiDoc signature files";
+    homepage = http://www.id.ee/;
+    license = licenses.lgpl2;
+    platforms = platforms.linux;
+    maintainers = [ maintainers.jagajaga ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libdigidocpp/default.nix b/nixpkgs/pkgs/development/libraries/libdigidocpp/default.nix
new file mode 100644
index 000000000000..e3172c2fc1f8
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libdigidocpp/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchurl, cmake, libdigidoc, minizip, pcsclite, opensc, openssl
+, xercesc, xml-security-c, pkgconfig, xsd, zlib, xalanc, xxd }:
+
+stdenv.mkDerivation rec {
+  version = "3.13.7";
+  name = "libdigidocpp-${version}";
+
+  src = fetchurl {
+     url = "https://github.com/open-eid/libdigidocpp/releases/download/v${version}/libdigidocpp-${version}.tar.gz";
+     sha256 = "1d8yx8avijp55p53fz4pd4ihjz6nyap0g8dq23bwg33411mdiqff";
+  };
+
+  nativeBuildInputs = [ cmake pkgconfig xxd ];
+
+  buildInputs = [
+    libdigidoc minizip pcsclite opensc openssl xercesc
+    xml-security-c xsd zlib xalanc
+  ];
+
+  meta = with stdenv.lib; {
+    description = "Library for creating DigiDoc signature files";
+    homepage = http://www.id.ee/;
+    license = licenses.lgpl2;
+    platforms = platforms.linux;
+    maintainers = [ maintainers.jagajaga ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libdiscid/default.nix b/nixpkgs/pkgs/development/libraries/libdiscid/default.nix
new file mode 100644
index 000000000000..287494b6b1fd
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libdiscid/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchurl, cmake, pkgconfig, darwin }:
+
+stdenv.mkDerivation rec {
+  name = "libdiscid-${version}";
+  version = "0.6.2";
+
+  nativeBuildInputs = [ cmake pkgconfig ];
+
+  buildInputs = stdenv.lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.IOKit ];
+  
+  src = fetchurl {
+    url = "http://ftp.musicbrainz.org/pub/musicbrainz/libdiscid/${name}.tar.gz";
+    sha256 = "1f9irlj3dpb5gyfdnb1m4skbjvx4d4hwiz2152f83m0d9jn47r7r";
+  };
+
+  NIX_LDFLAGS = stdenv.lib.optionalString stdenv.isDarwin "-framework CoreFoundation -framework IOKit";
+
+  meta = with stdenv.lib; {
+    description = "A C library for creating MusicBrainz DiscIDs from audio CDs";
+    homepage = http://musicbrainz.org/doc/libdiscid;
+    maintainers = with maintainers; [ ehmry ];
+    license = licenses.lgpl21;
+    platforms = platforms.linux ++ platforms.darwin;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libdivecomputer/default.nix b/nixpkgs/pkgs/development/libraries/libdivecomputer/default.nix
new file mode 100644
index 000000000000..c94806b50c10
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libdivecomputer/default.nix
@@ -0,0 +1,21 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "libdivecomputer-${version}";
+  version = "0.6.0";
+
+  src = fetchurl {
+    url = "https://www.libdivecomputer.org/releases/${name}.tar.gz";
+    sha256 = "0nm1mcscpxb9dv4p0lidd6rf5xg4vmcbigj6zqxvgn7pwnvpbzm0";
+  };
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.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 ];
+    license = licenses.lgpl21;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libdivsufsort/default.nix b/nixpkgs/pkgs/development/libraries/libdivsufsort/default.nix
new file mode 100644
index 000000000000..01ac56e885d0
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libdivsufsort/default.nix
@@ -0,0 +1,17 @@
+{stdenv, fetchurl}:
+
+stdenv.mkDerivation {
+  name = "libdivsufsort-2.0.1";
+
+  src = fetchurl {
+    url = "https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/libdivsufsort/libdivsufsort-2.0.1.tar.bz2";
+    sha256 = "1g0q40vb2k689bpasa914yi8sjsmih04017mw20zaqqpxa32rh2m";
+  };
+
+  meta = {
+    homepage = https://github.com/y-256/libdivsufsort;
+    license = stdenv.lib.licenses.mit;
+    description = "Library to construct the suffix array and the BW transformed string";
+    platforms = stdenv.lib.platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libdmtx/default.nix b/nixpkgs/pkgs/development/libraries/libdmtx/default.nix
new file mode 100644
index 000000000000..f5248dfc79e6
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libdmtx/default.nix
@@ -0,0 +1,20 @@
+{ stdenv, fetchurl, pkgconfig }:
+
+stdenv.mkDerivation rec {
+  name = "libdmtx-0.7.4";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/libdmtx/${name}.tar.bz2";
+    sha256 = "0xnxx075ycy58n92yfda2z9zgd41h3d4ik5d9l197lzsqim5hb5n";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+
+  meta = {
+    description = "An open source software for reading and writing Data Matrix barcodes";
+    homepage = http://libdmtx.org;
+    platforms = stdenv.lib.platforms.all;
+    maintainers = [ ];
+    license = stdenv.lib.licenses.bsd2;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libdnet/default.nix b/nixpkgs/pkgs/development/libraries/libdnet/default.nix
new file mode 100644
index 000000000000..46e264b59caf
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libdnet/default.nix
@@ -0,0 +1,29 @@
+{stdenv, fetchurl, automake, autoconf, libtool}:
+
+stdenv.mkDerivation {
+  name = "libdnet-1.12";
+
+  enableParallelBuilding = true;
+
+  src = fetchurl {
+    url = "https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/libdnet/libdnet-1.12.tgz";
+    sha256 = "09mhbr8x66ykhf5581a5zjpplpjxibqzgkkpx689kybwg0wk1cw3";
+  };
+
+  buildInputs = [ automake autoconf libtool ];
+
+  # .so endings are missing (quick and dirty fix)
+  postInstall = ''
+    for i in $out/lib/*; do
+      ln -s $i $i.so
+    done
+  '';
+
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libdrm/default.nix b/nixpkgs/pkgs/development/libraries/libdrm/default.nix
new file mode 100644
index 000000000000..7415aa754e7d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libdrm/default.nix
@@ -0,0 +1,36 @@
+{ stdenv, fetchurl, pkgconfig, libpthreadstubs, libpciaccess, valgrind-light }:
+
+stdenv.mkDerivation rec {
+  name = "libdrm-2.4.98";
+
+  src = fetchurl {
+    url = "https://dri.freedesktop.org/libdrm/${name}.tar.bz2";
+    sha256 = "150qdzsm2nx6dfacc75rx53anzsc6m31nhxidf5xxax3mk6fvq4b";
+  };
+
+  outputs = [ "out" "dev" "bin" ];
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ libpthreadstubs libpciaccess valgrind-light ];
+    # libdrm as of 2.4.70 does not actually do anything with udev.
+
+  postPatch = ''
+    for a in */*-symbol-check ; do
+      patchShebangs $a
+    done
+  '';
+
+  configureFlags = [ "--enable-install-test-programs" ]
+    ++ stdenv.lib.optionals (stdenv.isAarch32 || stdenv.isAarch64)
+      [ "--enable-tegra-experimental-api" "--enable-etnaviv-experimental-api" ]
+    ++ stdenv.lib.optional stdenv.isDarwin "-C"
+    ++ stdenv.lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) "--disable-intel"
+    ;
+
+  meta = {
+    homepage = https://dri.freedesktop.org/libdrm/;
+    description = "Library for accessing the kernel's Direct Rendering Manager";
+    license = "bsd";
+    platforms = stdenv.lib.platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libdv/default.nix b/nixpkgs/pkgs/development/libraries/libdv/default.nix
new file mode 100644
index 000000000000..a5058de597ef
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libdv/default.nix
@@ -0,0 +1,31 @@
+{ stdenv, fetchurl, popt }:
+
+stdenv.mkDerivation rec {
+  name = "libdv-1.0.0";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/libdv/${name}.tar.gz";
+    sha256 = "1fl96f2xh2slkv1i1ix7kqk576a0ak1d33cylm0mbhm96d0761d3";
+  };
+
+  # 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";
+
+  configureFlags = [
+    "--disable-asm"
+    "--disable-sdl"
+    "--disable-gtk"
+    "--disable-xv"
+    "--disable-gprof"
+  ];
+
+  buildInputs = [ popt ];
+
+  meta = with stdenv.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;
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libdvbpsi/default.nix b/nixpkgs/pkgs/development/libraries/libdvbpsi/default.nix
new file mode 100644
index 000000000000..0984eb6e00bf
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libdvbpsi/default.nix
@@ -0,0 +1,19 @@
+{stdenv, fetchurl}:
+
+stdenv.mkDerivation rec {
+  name = "libdvbpsi-${version}";
+  version = "1.3.2";
+
+  src = fetchurl {
+    url = "http://get.videolan.org/libdvbpsi/${version}/${name}.tar.bz2";
+    sha256 = "1zn5hfv4qbahmydbwh59a3b480s3m5ss27r6ml35gqdip7r3jkmc";
+  };
+
+  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;
+  };
+
+}
diff --git a/nixpkgs/pkgs/development/libraries/libdvdcss/default.nix b/nixpkgs/pkgs/development/libraries/libdvdcss/default.nix
new file mode 100644
index 000000000000..f18e0622d0cc
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libdvdcss/default.nix
@@ -0,0 +1,20 @@
+{stdenv, fetchurl, IOKit}:
+
+stdenv.mkDerivation rec {
+  name = "libdvdcss-${version}";
+  version = "1.4.2";
+
+  buildInputs = stdenv.lib.optional stdenv.isDarwin IOKit;
+
+  src = fetchurl {
+    url = "http://get.videolan.org/libdvdcss/${version}/${name}.tar.bz2";
+    sha256 = "0x957zzpf4w2cp8zlk29prj8i2q6hay3lzdzsyz8y3cwxivyvhkq";
+  };
+
+  meta = with stdenv.lib; {
+    homepage = http://www.videolan.org/developers/libdvdcss.html;
+    description = "A library for decrypting DVDs";
+    license = licenses.gpl2;
+    platforms = with platforms; linux ++ darwin;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libdvdnav/4.2.1.nix b/nixpkgs/pkgs/development/libraries/libdvdnav/4.2.1.nix
new file mode 100644
index 000000000000..18e2689002e8
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libdvdnav/4.2.1.nix
@@ -0,0 +1,29 @@
+{stdenv, fetchurl, pkgconfig, libdvdread}:
+
+stdenv.mkDerivation {
+  name = "libdvdnav-4.2.1";
+
+  src = fetchurl {
+    url = http://dvdnav.mplayerhq.hu/releases/libdvdnav-4.2.1.tar.xz;
+    sha256 = "7fca272ecc3241b6de41bbbf7ac9a303ba25cb9e0c82aa23901d3104887f2372";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [libdvdread];
+
+  configureScript = "./configure2"; # wtf?
+
+  preConfigure = ''
+    mkdir -p $out
+  '';
+
+  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;
+  };
+
+  passthru = { inherit libdvdread; };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libdvdnav/default.nix b/nixpkgs/pkgs/development/libraries/libdvdnav/default.nix
new file mode 100644
index 000000000000..b0dfd1e8fc12
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libdvdnav/default.nix
@@ -0,0 +1,24 @@
+{stdenv, fetchurl, pkgconfig, libdvdread}:
+
+stdenv.mkDerivation rec {
+  name = "libdvdnav-${version}";
+  version = "6.0.0";
+
+  src = fetchurl {
+    url = "http://get.videolan.org/libdvdnav/${version}/${name}.tar.bz2";
+    sha256 = "062njcksmpgw9yv3737qkf93r2pzhaxi9szqjabpa8d010dp38ph";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [libdvdread];
+
+  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;
+  };
+
+  passthru = { inherit libdvdread; };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libdvdread/4.9.9.nix b/nixpkgs/pkgs/development/libraries/libdvdread/4.9.9.nix
new file mode 100644
index 000000000000..fbe56023a91c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libdvdread/4.9.9.nix
@@ -0,0 +1,26 @@
+{stdenv, fetchurl, libdvdcss}:
+
+stdenv.mkDerivation {
+  name = "libdvdread-4.9.9";
+  
+  src = fetchurl {
+    url = http://dvdnav.mplayerhq.hu/releases/libdvdread-4.9.9.tar.xz;
+    sha256 = "d91275471ef69d488b05cf15c60e1cd65e17648bfc692b405787419f47ca424a";
+  };
+
+  buildInputs = [libdvdcss];
+
+  NIX_LDFLAGS = "-ldvdcss";
+
+  postInstall = ''
+    ln -s dvdread $out/include/libdvdread
+  '';
+
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libdvdread/default.nix b/nixpkgs/pkgs/development/libraries/libdvdread/default.nix
new file mode 100644
index 000000000000..5f0f08275035
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libdvdread/default.nix
@@ -0,0 +1,27 @@
+{stdenv, fetchurl, libdvdcss}:
+
+stdenv.mkDerivation rec {
+  name = "libdvdread-${version}";
+  version = "6.0.1";
+
+  src = fetchurl {
+    url = "http://get.videolan.org/libdvdread/${version}/${name}.tar.bz2";
+    sha256 = "1gfmh8ii3s2fw1c8vn57piwxc0smd3va4h7xgp9s8g48cc04zki8";
+  };
+
+  buildInputs = [libdvdcss];
+
+  NIX_LDFLAGS = "-ldvdcss";
+
+  postInstall = ''
+    ln -s dvdread $out/include/libdvdread
+  '';
+
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libdwarf/default.nix b/nixpkgs/pkgs/development/libraries/libdwarf/default.nix
new file mode 100644
index 000000000000..1a4da7713af4
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libdwarf/default.nix
@@ -0,0 +1,54 @@
+{ stdenv, fetchurl, libelf, zlib }:
+
+let
+  version = "20181024";
+  src = fetchurl {
+    url = "https://www.prevanders.net/libdwarf-${version}.tar.gz";
+    # Upstream displays this hash broken into three parts:
+    sha512 = "02f8024bb9959c91a1fe322459f7587a589d096595"
+           + "6d643921a173e6f9e0a184db7aef66f0fd2548d669"
+           + "5be7f9ee368f1cc8940cea4ddda01ff99d28bbf1fe58";
+  };
+  meta = {
+    homepage = https://www.prevanders.net/dwarf.html;
+    platforms = stdenv.lib.platforms.linux;
+    license = stdenv.lib.licenses.lgpl21Plus;
+  };
+
+in rec {
+  libdwarf = stdenv.mkDerivation rec {
+    name = "libdwarf-${version}";
+
+    configureFlags = [ "--enable-shared" "--disable-nonshared" ];
+
+    preConfigure = ''
+      cd libdwarf
+    '';
+    buildInputs = [ libelf zlib ];
+
+    installPhase = ''
+      mkdir -p $out/lib $out/include
+      cp libdwarf.so.1 $out/lib
+      ln -s libdwarf.so.1 $out/lib/libdwarf.so
+      cp libdwarf.h dwarf.h $out/include
+    '';
+
+    inherit meta src;
+  };
+
+  dwarfdump = stdenv.mkDerivation rec {
+    name = "dwarfdump-${version}";
+
+    preConfigure = ''
+      cd dwarfdump
+    '';
+
+    buildInputs = [ libelf libdwarf ];
+
+    installPhase = ''
+      install -m755 -D dwarfdump $out/bin/dwarfdump
+    '';
+
+    inherit meta src;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libdwg/default.nix b/nixpkgs/pkgs/development/libraries/libdwg/default.nix
new file mode 100644
index 000000000000..5ee92b463857
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libdwg/default.nix
@@ -0,0 +1,25 @@
+{stdenv, fetchurl, indent}:
+
+stdenv.mkDerivation {
+  name = "libdwg-0.6";
+
+  src = fetchurl {
+    url = mirror://sourceforge/libdwg/libdwg-0.6.tar.bz2;
+    sha256 = "0l8ks1x70mkna1q7mzy1fxplinz141bd24qhrm1zkdil74mcsryc";
+  };
+
+  nativeBuildInputs = [ indent ];
+
+  hardeningDisable = [ "format" ];
+
+  # Hack to avoid TMPDIR in RPATHs.
+  preFixup = ''rm -rf "$(pwd)" '';
+
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libdynd/default.nix b/nixpkgs/pkgs/development/libraries/libdynd/default.nix
new file mode 100644
index 000000000000..93ece69cf056
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libdynd/default.nix
@@ -0,0 +1,35 @@
+{ stdenv, fetchFromGitHub, cmake }:
+
+let version = "0.7.2"; in
+stdenv.mkDerivation {
+  name = "libdynd-${version}";
+
+  src = fetchFromGitHub {
+    owner = "libdynd";
+    repo = "libdynd";
+    rev = "v${version}";
+    sha256 = "0fkd5rawqni1cq51fmr76iw7ll4fmbahfwv4rglnsabbkylf73pr";
+  };
+
+  cmakeFlags = [
+    "-DDYND_BUILD_BENCHMARKS=OFF"
+  ];
+
+  # added to fix build with gcc7
+  NIX_CFLAGS_COMPILE = [
+    "-Wno-error=implicit-fallthrough"
+    "-Wno-error=nonnull"
+  ];
+
+  buildInputs = [ cmake ];
+
+  outputs = [ "out" "dev" ];
+  outputDoc = "dev";
+
+  meta = with stdenv.lib; {
+    description = "C++ dynamic ndarray library, with Python exposure.";
+    homepage = http://libdynd.org;
+    license = licenses.bsd2;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libe-book/default.nix b/nixpkgs/pkgs/development/libraries/libe-book/default.nix
new file mode 100644
index 000000000000..805b1869ac38
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libe-book/default.nix
@@ -0,0 +1,41 @@
+{ stdenv, fetchurl, gperf, pkgconfig, librevenge, libxml2, boost, icu
+, cppunit, zlib, liblangtag
+}:
+
+let
+  s = # Generated upstream information
+  rec {
+    baseName="libe-book";
+    version="0.1.3";
+    name="${baseName}-${version}";
+    hash="1yg1vws1wggzhjw672bpgh2x541g5i9wryf67g51m0r79zrqz3by";
+    url="https://kent.dl.sourceforge.net/project/libebook/libe-book-0.1.3/libe-book-0.1.3.tar.xz";
+    sha256="1yg1vws1wggzhjw672bpgh2x541g5i9wryf67g51m0r79zrqz3by";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [
+    gperf librevenge libxml2 boost icu cppunit zlib liblangtag
+  ];
+
+  # Boost 1.59 compatability fix
+  # Attempt removing when updating
+  postPatch = ''
+    sed -i 's,^CPPFLAGS.*,\0 -DBOOST_ERROR_CODE_HEADER_ONLY -DBOOST_SYSTEM_NO_DEPRECATED,' src/lib/Makefile.in
+  '';
+in
+stdenv.mkDerivation {
+  inherit (s) name version;
+  inherit nativeBuildInputs buildInputs postPatch;
+  src = fetchurl {
+    inherit (s) url sha256;
+  };
+  NIX_CFLAGS_COMPILE = "-Wno-error=unused-function";
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libe-book/default.upstream b/nixpkgs/pkgs/development/libraries/libe-book/default.upstream
new file mode 100644
index 000000000000..a06a9af99bb4
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libe-book/default.upstream
@@ -0,0 +1,4 @@
+url https://sourceforge.net/projects/libebook/files/
+SF_version_dir libe-book-
+version_link '[.]tar.xz/download$'
+SF_redirect
diff --git a/nixpkgs/pkgs/development/libraries/libeatmydata/default.nix b/nixpkgs/pkgs/development/libraries/libeatmydata/default.nix
new file mode 100644
index 000000000000..5127231dab60
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libeatmydata/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchurl, makeWrapper }:
+
+stdenv.mkDerivation rec {
+  name = "libeatmydata-105";
+  
+  src = fetchurl {
+    url = "https://www.flamingspork.com/projects/libeatmydata/${name}.tar.gz";
+    sha256 = "1pd8sc73cgc41ldsvq6g8ics1m5k8gdcb91as9yg8z5jnrld1lmx";
+  };
+
+  buildInputs = [ makeWrapper ];
+
+  postInstall = ''
+    wrapProgram $out/bin/eatmydata \
+      --prefix PATH : $out/bin
+  '';
+
+  meta = {
+    homepage = https://www.flamingspork.com/projects/libeatmydata/;
+    license = stdenv.lib.licenses.gpl3Plus;
+    description = "Small LD_PRELOAD library to disable fsync and friends";
+    platforms = stdenv.lib.platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libeb/default.nix b/nixpkgs/pkgs/development/libraries/libeb/default.nix
new file mode 100644
index 000000000000..293b1c28e932
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libeb/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchurl, perl, zlib }:
+stdenv.mkDerivation rec {
+  name = "libeb-${version}";
+  version = "4.4.3";
+
+  src = fetchurl {
+    url = "ftp://ftp.sra.co.jp/pub/misc/eb/eb-${version}.tar.bz2";
+    sha256 = "0psbdzirazfnn02hp3gsx7xxss9f1brv4ywp6a15ihvggjki1rxb";
+  };
+
+  nativeBuildInputs = [ perl ];
+  buildInputs = [ zlib ];
+
+  meta = with stdenv.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
+      common way to distribute electronic dictionaries in Japan.  It supports
+      the EB, EBG, EBXA, EBXA-C, S-EBXA and EPWING formats.
+    '';
+    license = licenses.bsd3;
+    maintainers = with maintainers; [ gebner ];
+    platforms = with platforms; unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libebml/default.nix b/nixpkgs/pkgs/development/libraries/libebml/default.nix
new file mode 100644
index 000000000000..2d15e419a764
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libebml/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchFromGitHub, cmake, pkgconfig }:
+
+stdenv.mkDerivation rec {
+  pname = "libebml";
+  version = "1.3.9";
+
+  src = fetchFromGitHub {
+    owner  = "Matroska-Org";
+    repo   = "libebml";
+    rev    = "release-${version}";
+    sha256 = "0q2xfabaymrf0xkhwc9akx6m04lgra2b53wcn9mnh5dqiiazizi7";
+  };
+
+  nativeBuildInputs = [ cmake pkgconfig ];
+
+  cmakeFlags = [
+    "-DBUILD_SHARED_LIBS=YES"
+  ];
+
+  meta = with stdenv.lib; {
+    description = "Extensible Binary Meta Language library";
+    homepage = https://dl.matroska.org/downloads/libebml/;
+    license = licenses.lgpl21;
+    maintainers = with maintainers; [ spwhitt ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libebur128/default.nix b/nixpkgs/pkgs/development/libraries/libebur128/default.nix
new file mode 100644
index 000000000000..6a4078f92cf3
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libebur128/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchFromGitHub, cmake, speexdsp, pkgconfig }:
+
+stdenv.mkDerivation rec {
+  version = "1.2.4";
+  name = "libebur128-${version}";
+
+  src = fetchFromGitHub {
+    owner = "jiixyj";
+    repo = "libebur128";
+    rev = "v${version}";
+    sha256 = "0n81rnm8dm1zmibkr2v3q79rsd609y0dbbsrbay18njcjva88p0g";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ cmake speexdsp ];
+
+  meta = with stdenv.lib; {
+    description = "Implementation of the EBU R128 loudness standard";
+    homepage = https://github.com/jiixyj/libebur128;
+    license = licenses.mit;
+    maintainers = [ maintainers.andrewrk ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libechonest/default.nix b/nixpkgs/pkgs/development/libraries/libechonest/default.nix
new file mode 100644
index 000000000000..be9f5e772d91
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libechonest/default.nix
@@ -0,0 +1,21 @@
+{ stdenv, fetchurl, cmake, qt4, qjson, doxygen, boost }:
+
+stdenv.mkDerivation rec {
+  name = "libechonest-${version}";
+  version = "2.3.0";
+
+  src = fetchurl {
+    url = "http://files.lfranchi.com/${name}.tar.bz2";
+    sha1 = "cf1b279c96f15c87c36fdeb23b569a60cdfb01db";
+  };
+
+  buildInputs = [ cmake qt4 qjson doxygen boost ];
+  enableParallelBuilding = true;
+
+  meta = {
+    description = "A C++/Qt wrapper around the Echo Nest API";
+    homepage = http://projects.kde.org/projects/playground/libs/libechonest;
+    license = stdenv.lib.licenses.gpl2Plus;
+    platforms = stdenv.lib.platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libedit/01-cygwin.patch b/nixpkgs/pkgs/development/libraries/libedit/01-cygwin.patch
new file mode 100644
index 000000000000..33bd39ed61e5
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libedit/01-cygwin.patch
@@ -0,0 +1,25 @@
+--- libedit-20120311-3.0/src/chartype.h	2012-03-11 10:54:58.000000000 +0100
++++ libedit-20120311-3.0/src/chartype.h	2012-05-03 19:00:20.651847423 +0200
+@@ -56,9 +56,11 @@
+ /* Oh for a <uchar.h> with char32_t and __STDC_UTF_32__ in it...
+  * ref: ISO/IEC DTR 19769
+  */
++#ifndef __CYGWIN__
+ #if WCHAR_MAX < INT32_MAX
+ #warning Build environment does not support non-BMP characters
+ #endif
++#endif
+ 
+ #ifndef HAVE_WCSDUP
+ wchar_t *wcsdup(const wchar_t *s);
+--- libedit-20120311-3.0/src/editline/readline.h	2011-02-26 23:42:59.000000000 +0100
++++ libedit-20120311-3.0/src/editline/readline.h	2012-05-03 19:00:49.211244803 +0200
+@@ -75,7 +75,7 @@ typedef KEYMAP_ENTRY *Keymap;
+ 
+ #ifndef CTRL
+ #include <sys/ioctl.h>
+-#if !defined(__sun) && !defined(__hpux) && !defined(_AIX)
++#if !defined(__sun) && !defined(__hpux) && !defined(_AIX) && !defined(__CYGWIN__)
+ #include <sys/ttydefaults.h>
+ #endif
+ #ifndef CTRL
diff --git a/nixpkgs/pkgs/development/libraries/libedit/default.nix b/nixpkgs/pkgs/development/libraries/libedit/default.nix
new file mode 100644
index 000000000000..e46a7ec33c4d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libedit/default.nix
@@ -0,0 +1,32 @@
+{ stdenv, fetchurl, ncurses }:
+
+stdenv.mkDerivation rec {
+  pname = "libedit";
+  version = "20190324-3.1";
+
+  src = fetchurl {
+    url = "https://thrysoee.dk/editline/${pname}-${version}.tar.gz";
+    sha256 = "1bhvp8xkkgrg89k4ci1k8vjl3nhb6szd4ghy9lp4jrfgq58hz3xc";
+  };
+
+  outputs = [ "out" "dev" ];
+
+  # Have `configure' avoid `/usr/bin/nroff' in non-chroot builds.
+  # NROFF = "${groff}/bin/nroff";
+
+  patches = [ ./01-cygwin.patch ];
+
+  propagatedBuildInputs = [ ncurses ];
+
+  postInstall = ''
+    find $out/lib -type f | grep '\.\(la\|pc\)''$' | xargs sed -i \
+      -e 's,-lncurses[a-z]*,-L${ncurses.out}/lib -lncursesw,g'
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = http://www.thrysoee.dk/editline/;
+    description = "A port of the NetBSD Editline library (libedit)";
+    license = licenses.bsd3;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libee/default.nix b/nixpkgs/pkgs/development/libraries/libee/default.nix
new file mode 100644
index 000000000000..7255b3fece42
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libee/default.nix
@@ -0,0 +1,19 @@
+{ stdenv, fetchurl, pkgconfig, libestr }:
+stdenv.mkDerivation {
+  name = "libee-0.4.1";
+
+  src = fetchurl {
+    url = http://www.libee.org/download/files/download/libee-0.4.1.tar.gz;
+    sha256 = "09xhgzmsq0g3jsyj24vy67bhzk2fv971w5ixdkhfwgar70cw1nn0";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ libestr];
+
+  meta = {
+    homepage = http://www.libee.org/;
+    description = "An Event Expression Library inspired by CEE";
+    platforms = stdenv.lib.platforms.unix;
+    license = stdenv.lib.licenses.lgpl21Plus;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libelf-freebsd/default.nix b/nixpkgs/pkgs/development/libraries/libelf-freebsd/default.nix
new file mode 100644
index 000000000000..26fe2d90963a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libelf-freebsd/default.nix
@@ -0,0 +1,37 @@
+{ fetchsvn, stdenv, gnum4, tet }:
+
+stdenv.mkDerivation (rec {
+  version = "3258";
+  name = "libelf-freebsd-${version}";
+
+  src = fetchsvn {
+    url = svn://svn.code.sf.net/p/elftoolchain/code/trunk;
+    rev = (stdenv.lib.strings.toInt version);
+    name = "elftoolchain-${version}";
+  };
+
+  buildInputs = [ gnum4 tet ];
+
+  buildPhase = ''
+    PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:$PATH # use BSD install(1) instead of coreutils and make(1) instead of GNU Make
+    cp -vr ${tet} test/tet/tet3.8
+    chmod -R a+w test/tet/tet3.8
+    make libelf
+  '';
+
+  installPhase = ''
+    cp -vr libelf $out
+    cp -vr common/. $out/
+  '';
+
+  meta = {
+    description = "Essential compilation tools and libraries for building and analyzing ELF based program images";
+
+    homepage = https://sourceforge.net/p/elftoolchain/wiki/Home/;
+
+    license = stdenv.lib.licenses.bsd2;
+
+    platforms = stdenv.lib.platforms.freebsd;
+    maintainers = [ ];
+  };
+})
diff --git a/nixpkgs/pkgs/development/libraries/libelf/default.nix b/nixpkgs/pkgs/development/libraries/libelf/default.nix
new file mode 100644
index 000000000000..55a01c75dcf2
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libelf/default.nix
@@ -0,0 +1,44 @@
+{ stdenv
+, fetchurl, autoreconfHook, gettext
+}:
+
+stdenv.mkDerivation rec {
+  name = "libelf-0.8.13";
+
+  src = fetchurl {
+    url = "http://www.mr511.de/software/${name}.tar.gz";
+    sha256 = "0vf7s9dwk2xkmhb79aigqm0x0yfbw1j0b9ksm51207qwr179n6jr";
+  };
+
+  patches = [
+    ./dont-hardcode-ar.patch
+  ];
+
+  doCheck = true;
+
+  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"
+       # 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";
+
+  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;
+
+  meta = {
+    description = "ELF object file access library";
+
+    homepage = https://github.com/Distrotech/libelf;
+
+    license = stdenv.lib.licenses.lgpl2Plus;
+
+    platforms = stdenv.lib.platforms.all;
+    maintainers = [ ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libelf/dont-hardcode-ar.patch b/nixpkgs/pkgs/development/libraries/libelf/dont-hardcode-ar.patch
new file mode 100644
index 000000000000..e282d9005dbb
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libelf/dont-hardcode-ar.patch
@@ -0,0 +1,11 @@
+--- a/lib/Makefile.in
++++ b/lib/Makefile.in
+@@ -27,7 +27,7 @@ installdirs = $(libdir) $(includedir) $(includedir)/libelf
+ 
+ CC = @CC@
+ LD = @LD@
+-AR = ar
++AR ?= ar
+ MV = mv -f
+ RM = rm -f
+ LN_S = @LN_S@
diff --git a/nixpkgs/pkgs/development/libraries/libelfin/0001-Don-t-detect-package-version-with-Git.patch b/nixpkgs/pkgs/development/libraries/libelfin/0001-Don-t-detect-package-version-with-Git.patch
new file mode 100644
index 000000000000..e4b4e592b7a5
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libelfin/0001-Don-t-detect-package-version-with-Git.patch
@@ -0,0 +1,72 @@
+From 77a34d31695e02bc3d06b68c7ca3ff9c3cb67844 Mon Sep 17 00:00:00 2001
+From: Maximilian Bosch <maximilian@mbosch.me>
+Date: Sun, 26 May 2019 19:46:27 +0200
+Subject: [PATCH] Don't detect package version with Git
+
+This will build in a Nix-based build environment. Instead we ismply
+replace `@version@` using `substituteAll`.
+---
+ dwarf/Makefile | 19 +++++++++----------
+ elf/Makefile   | 15 +++++++--------
+ 2 files changed, 16 insertions(+), 18 deletions(-)
+
+diff --git a/dwarf/Makefile b/dwarf/Makefile
+index 71456bd..f871227 100644
+--- a/dwarf/Makefile
++++ b/dwarf/Makefile
+@@ -43,16 +43,15 @@ CLEAN += libdwarf++.so
+ # Create pkg-config for local library and headers. This will be
+ # transformed in to the correct global pkg-config by install.
+ libdwarf++.pc: always
+-	@(VER=$$(git describe --match 'v*' | sed -e s/^v//); \
+-	  echo "libdir=$$PWD"; \
+-	  echo "includedir=$$PWD"; \
+-	  echo ""; \
+-	  echo "Name: libdwarf++"; \
+-	  echo "Description: C++11 DWARF library"; \
+-	  echo "Version: $$VER"; \
+-	  echo "Requires: libelf++ = $$VER"; \
+-	  echo "Libs: -L\$${libdir} -ldwarf++"; \
+-	  echo "Cflags: -I\$${includedir}") > $@
++	@(echo "libdir=$$PWD"; \
++		echo "includedir=$$PWD"; \
++		echo ""; \
++		echo "Name: libdwarf++"; \
++		echo "Description: C++11 DWARF library"; \
++		echo "Version: @version@"; \
++		echo "Requires: libelf++ = @version@"; \
++		echo "Libs: -L\$${libdir} -ldwarf++"; \
++		echo "Cflags: -I\$${includedir}") > $@
+ CLEAN += libdwarf++.pc
+ 
+ .PHONY: always
+diff --git a/elf/Makefile b/elf/Makefile
+index 9c7c224..50630a7 100644
+--- a/elf/Makefile
++++ b/elf/Makefile
+@@ -42,15 +42,14 @@ CLEAN += libelf++.so
+ # Create pkg-config for local library and headers. This will be
+ # transformed in to the correct global pkg-config by install.
+ libelf++.pc: always
+-	@(VER=$$(git describe --match 'v*' | sed -e s/^v//); \
+-	  echo "libdir=$$PWD"; \
++	@(echo "libdir=$$PWD"; \
+ 	  echo "includedir=$$PWD"; \
+-	  echo ""; \
+-	  echo "Name: libelf++"; \
+-	  echo "Description: C++11 ELF library"; \
+-	  echo "Version: $$VER"; \
+-	  echo "Libs: -L\$${libdir} -lelf++"; \
+-	  echo "Cflags: -I\$${includedir}") > $@
++		echo ""; \
++		echo "Name: libelf++"; \
++		echo "Description: C++11 ELF library"; \
++		echo "Version: @version@"; \
++		echo "Libs: -L\$${libdir} -lelf++"; \
++		echo "Cflags: -I\$${includedir}") > $@
+ CLEAN += libelf++.pc
+ 
+ .PHONY: always
+-- 
+2.19.2
+
diff --git a/nixpkgs/pkgs/development/libraries/libelfin/default.nix b/nixpkgs/pkgs/development/libraries/libelfin/default.nix
new file mode 100644
index 000000000000..2eb1bd0e4fc4
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libelfin/default.nix
@@ -0,0 +1,32 @@
+{ stdenv, fetchFromGitHub, python3, substituteAll }:
+
+stdenv.mkDerivation rec {
+  pname = "libelfin";
+  version = "unstable-2018-08-25";
+
+  src = fetchFromGitHub {
+    owner = "aclements";
+    repo = pname;
+    rev = "ac45a094fadba77ad840063fb7aab82571546be0";
+    sha256 = "143x680c6hsy51kngs04ypg4ql3lp498llcwj4lh1v0qp5qvjhyz";
+  };
+
+  patches = [
+    (substituteAll {
+      src = ./0001-Don-t-detect-package-version-with-Git.patch;
+      inherit version;
+    })
+  ];
+
+  nativeBuildInputs = [ python3 ];
+
+  makeFlags = [ "PREFIX=${placeholder "out"}" ];
+
+  meta = with stdenv.lib; {
+    homepage = https://github.com/aclements/libelfin/;
+    license = licenses.mit;
+    description = "C++11 ELF/DWARF parser";
+    maintainers = with maintainers; [ ma27 ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libepc/default.nix b/nixpkgs/pkgs/development/libraries/libepc/default.nix
new file mode 100644
index 000000000000..59780699fd13
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libepc/default.nix
@@ -0,0 +1,47 @@
+{ stdenv, fetchurl, pkgconfig, intltool, gtk-doc, glib, avahi, gnutls, libuuid, libsoup, gtk3, gnome3 }:
+
+let
+  avahiWithGtk = avahi.override { gtk3Support = true; };
+in stdenv.mkDerivation rec {
+  pname = "libepc";
+  version = "0.4.6";
+
+  outputs = [ "out" "dev" "devdoc" ];
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    sha256 = "1s3svb2slqjsrqfv50c2ymnqcijcxb5gnx6bfibwh9l5ga290n91";
+  };
+
+  nativeBuildInputs = [
+    pkgconfig
+    intltool
+    gtk-doc
+  ];
+  buildInputs = [
+    glib
+    libuuid
+    gtk3
+  ];
+  propagatedBuildInputs = [
+    avahiWithGtk
+    gnutls
+    libsoup
+  ];
+
+  enableParallelBuilding = true;
+
+  passthru = {
+    updateScript = gnome3.updateScript {
+      packageName = pname;
+    };
+  };
+
+  meta = with stdenv.lib; {
+    description = "Easy Publish and Consume Library";
+    homepage = https://wiki.gnome.org/Projects/libepc;
+    license = licenses.lgpl21Plus;
+    maintainers = gnome3.maintainers;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libesmtp/default.nix b/nixpkgs/pkgs/development/libraries/libesmtp/default.nix
new file mode 100644
index 000000000000..980cee2e6879
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libesmtp/default.nix
@@ -0,0 +1,18 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "libESMTP-${version}";
+  version = "1.0.6";
+
+  src = fetchurl {
+    url = "http://brianstafford.info/libesmtp/libesmtp-1.0.6.tar.bz2";
+    sha256 = "02zbniyz7qys1jmx3ghx21kxmns1wc3hmv80gp7ag7yra9f1m9nh";
+  };
+
+  meta = with stdenv.lib; {
+    homepage = http://brianstafford.info/libesmtp/index.html;
+    description = "A Library for Posting Electronic Mail";
+    license = licenses.lgpl21;
+  };
+}
+
diff --git a/nixpkgs/pkgs/development/libraries/libestr/default.nix b/nixpkgs/pkgs/development/libraries/libestr/default.nix
new file mode 100644
index 000000000000..b8f62901eed4
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libestr/default.nix
@@ -0,0 +1,17 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "libestr-0.1.11";
+
+  src = fetchurl {
+    url = "http://libestr.adiscon.com/files/download/${name}.tar.gz";
+    sha256 = "0910ifzcs8kpd3srrr4fvbacgh2zrc6yn7i4rwfj6jpzhlkjnqs6";
+  };
+
+  meta = with stdenv.lib; {
+    homepage = https://libestr.adiscon.com/;
+    description = "Some essentials for string handling";
+    license = licenses.lgpl21;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libetpan/default.nix b/nixpkgs/pkgs/development/libraries/libetpan/default.nix
new file mode 100644
index 000000000000..b09c2dd0f47e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libetpan/default.nix
@@ -0,0 +1,24 @@
+{ autoconf, automake, fetchgit, libtool, stdenv, openssl }:
+
+let version = "1.8"; in
+
+stdenv.mkDerivation {
+  name = "libetpan-${version}";
+
+  src = fetchgit {
+    url = "git://github.com/dinhviethoa/libetpan";
+    rev = "refs/tags/" + version;
+    sha256 = "09xqy1n18qn63x7idfrpwm59lfkvb1p5vxkyksywvy4f6mn4pyxk";
+  };
+
+  buildInputs = [ autoconf automake libtool openssl ];
+
+  configureScript = "./autogen.sh";
+
+  meta = with stdenv.lib; {
+    description = "An efficient, portable library for different kinds of mail access: IMAP, SMTP, POP, and NNTP";
+    homepage = http://www.etpan.org/libetpan.html;
+    license = licenses.bsd3;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libev/default.nix b/nixpkgs/pkgs/development/libraries/libev/default.nix
new file mode 100644
index 000000000000..922207f1ccea
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libev/default.nix
@@ -0,0 +1,18 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "libev-${version}";
+  version="4.25";
+
+  src = fetchurl {
+    url = "http://dist.schmorp.de/libev/Attic/${name}.tar.gz";
+    sha256 = "1295q0lkkbrlpd5dl5i48bh1rm8mjzh9y795jlvjz3bp4wf7wxbq";
+  };
+
+  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+
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libevdev/default.nix b/nixpkgs/pkgs/development/libraries/libevdev/default.nix
new file mode 100644
index 000000000000..7998655e46b6
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libevdev/default.nix
@@ -0,0 +1,20 @@
+{ stdenv, fetchurl, python }:
+
+stdenv.mkDerivation rec {
+  name = "libevdev-1.6.0";
+
+  src = fetchurl {
+    url = "https://www.freedesktop.org/software/libevdev/${name}.tar.xz";
+    sha256 = "057qdrwbhql2lvr4kxljk3yqjsmh65hyrfbr2b681nc7b635q07m";
+  };
+
+  buildInputs = [ python ];
+
+  meta = with stdenv.lib; {
+    description = "Wrapper library for evdev devices";
+    homepage = http://www.freedesktop.org/software/libevdev/doc/latest/index.html;
+    license = licenses.mit;
+    platforms = platforms.linux;
+    maintainers = [ maintainers.amorsillo ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libevent/default.nix b/nixpkgs/pkgs/development/libraries/libevent/default.nix
new file mode 100644
index 000000000000..2bc2bcb5b856
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libevent/default.nix
@@ -0,0 +1,60 @@
+{ stdenv, fetchurl, fetchpatch, findutils, fixDarwinDylibNames
+, sslSupport? true, openssl
+}:
+
+assert sslSupport -> openssl != null;
+
+stdenv.mkDerivation rec {
+  name = "libevent-${version}";
+  version = "2.1.10";
+
+  src = fetchurl {
+    url = "https://github.com/libevent/libevent/releases/download/release-${version}-stable/libevent-${version}-stable.tar.gz";
+    sha256 = "1c25928gdv495clxk2v1d4gkr5py7ack4gx2n7d13frnld0syr78";
+  };
+
+  # 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"
+    ;
+  outputBin = "dev";
+  propagatedBuildOutputs = [ "out" ]
+    ++ stdenv.lib.optional sslSupport "openssl"
+    ;
+
+  buildInputs = []
+    ++ stdenv.lib.optional sslSupport openssl
+    ++ stdenv.lib.optional stdenv.isCygwin findutils
+    ++ stdenv.lib.optional stdenv.isDarwin fixDarwinDylibNames
+    ;
+
+  doCheck = false; # needs the net
+
+  postInstall = stdenv.lib.optionalString sslSupport ''
+    moveToOutput "lib/libevent_openssl*" "$openssl"
+    substituteInPlace "$dev/lib/pkgconfig/libevent_openssl.pc" \
+      --replace "$out" "$openssl"
+    sed "/^libdir=/s|$out|$openssl|" -i "$openssl"/lib/libevent_openssl.la
+  '';
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    description = "Event notification library";
+    longDescription = ''
+      The libevent API provides a mechanism to execute a callback function
+      when a specific event occurs on a file descriptor or after a timeout
+      has been reached.  Furthermore, libevent also support callbacks due
+      to signals or regular timeouts.
+
+      libevent is meant to replace the event loop found in event driven
+      network servers.  An application just needs to call event_dispatch()
+      and then add or remove events dynamically without having to change
+      the event loop.
+    '';
+    homepage = http://libevent.org/;
+    license = licenses.bsd3;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libewf/default.nix b/nixpkgs/pkgs/development/libraries/libewf/default.nix
new file mode 100644
index 000000000000..d150d4a00330
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libewf/default.nix
@@ -0,0 +1,23 @@
+{ fetchurl, stdenv, zlib, openssl, libuuid, pkgconfig }:
+
+stdenv.mkDerivation rec {
+  version = "20171104";
+  name = "libewf-${version}";
+
+  src = fetchurl {
+    url = "https://github.com/libyal/libewf/releases/download/${version}/libewf-experimental-${version}.tar.gz";
+    sha256 = "0h7036gpj5cryvh17aq6i2cpnbpwg5yswmfydxbbwvd9yfxd6dng";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ zlib openssl libuuid ];
+
+  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;
+    inherit version;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libexecinfo/default.nix b/nixpkgs/pkgs/development/libraries/libexecinfo/default.nix
new file mode 100644
index 000000000000..a61d51aa6b72
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libexecinfo/default.nix
@@ -0,0 +1,46 @@
+{ stdenv, fetchurl, fetchpatch }:
+
+stdenv.mkDerivation rec {
+  name = "libexecinfo-${version}";
+  version = "1.1";
+
+  src = fetchurl {
+    url = "http://distcache.freebsd.org/local-distfiles/itetcu/${name}.tar.bz2";
+    sha256 = "07wvlpc1jk1sj4k5w53ml6wagh0zm9kv2l1jngv8xb7xww9ik8n9";
+  };
+
+  patches = [
+    (fetchpatch {
+      name = "10-execinfo.patch";
+      url = https://git.alpinelinux.org/cgit/aports/plain/main/libexecinfo/10-execinfo.patch?id=730cdcef6901750f4029d4c3b8639ce02ee3ead1;
+      sha256 = "0lnphrad4vspyljnvmm62dyxj98vgp3wabj4w3vfzfph7j8piw7g";
+    })
+    (fetchpatch {
+      name = "20-define-gnu-source.patch";
+      url = https://git.alpinelinux.org/cgit/aports/plain/main/libexecinfo/20-define-gnu-source.patch?id=730cdcef6901750f4029d4c3b8639ce02ee3ead1;
+      sha256 = "1mp8mc639b0h2s69m5z6s2h3q3n1zl298j9j0plzj7f979j76302";
+    })
+    (fetchpatch {
+      name = "30-linux-makefile.patch";
+      url = https://git.alpinelinux.org/cgit/aports/plain/main/libexecinfo/30-linux-makefile.patch?id=730cdcef6901750f4029d4c3b8639ce02ee3ead1;
+      sha256 = "1jwjz22z5cjy5h2bfghn62yl9ar8jiqhdvbwrcfavv17ihbhwcaf";
+    })
+  ];
+
+  makeFlags = [ "CC:=$(CC)" "AR:=$(AR)" ];
+
+  patchFlags = "-p0";
+
+  installPhase = ''
+    install -Dm644 execinfo.h stacktraverse.h -t $out/include
+    install -Dm755 libexecinfo.{a,so.1} -t $out/lib
+    ln -s $out/lib/libexecinfo.so{.1,}
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Quick-n-dirty BSD licensed clone of the GNU libc backtrace facility";
+    license = licenses.bsd2;
+    homepage = https://www.freshports.org/devel/libexecinfo;
+    maintainers = with maintainers; [ dtzWill ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libexif/default.nix b/nixpkgs/pkgs/development/libraries/libexif/default.nix
new file mode 100644
index 000000000000..5a8f5126680e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libexif/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchurl, fetchpatch, gettext }:
+
+stdenv.mkDerivation rec {
+  name = "libexif-0.6.21";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/libexif/${name}.tar.bz2";
+    sha256 = "06nlsibr3ylfwp28w8f5466l6drgrnydgxrm4jmxzrmk5svaxk8n";
+  };
+
+  patches = [
+   (fetchpatch {
+     name = "CVE-2017-7544.patch";
+     url = https://sourceforge.net/p/libexif/bugs/_discuss/thread/fc394c4b/489a/attachment/xx.pat;
+     sha256 = "1qgk8hgnxr8d63jsc4vljxz9yg33mbml280dq4a6050rmk9wq4la";
+   })
+  ];
+  patchFlags = "-p0";
+
+  buildInputs = [ gettext ];
+
+  meta = {
+    homepage = http://libexif.sourceforge.net/;
+    description = "A library to read and manipulate EXIF data in digital photographs";
+    license = stdenv.lib.licenses.lgpl21;
+    platforms = stdenv.lib.platforms.unix;
+  };
+
+}
diff --git a/nixpkgs/pkgs/development/libraries/libextractor/default.nix b/nixpkgs/pkgs/development/libraries/libextractor/default.nix
new file mode 100644
index 000000000000..bc371423e439
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libextractor/default.nix
@@ -0,0 +1,73 @@
+{ fetchurl, stdenv, libtool, gettext, zlib, bzip2, flac, libvorbis
+, exiv2, libgsf, rpm, pkgconfig
+, gtkSupport ? true, glib ? null, gtk3 ? null
+, videoSupport ? true, ffmpeg ? null, libmpeg2 ? null}:
+
+assert gtkSupport -> glib != null && gtk3 != null;
+assert videoSupport -> ffmpeg != null && libmpeg2 != null;
+
+stdenv.mkDerivation rec {
+  name = "libextractor-1.9";
+
+  src = fetchurl {
+    url = "mirror://gnu/libextractor/${name}.tar.gz";
+    sha256 = "1zz2zvikvfibxnk1va3kgzs7djsmiqy7bmk8y01vbsf54ryjb3zh";
+  };
+
+  preConfigure =
+    '' echo "patching installation directory in \`extractor.c'..."
+       sed -i "src/main/extractor.c" \
+           -e "s|pexe[[:blank:]]*=.*$|pexe = strdup(\"$out/lib/\");|g"
+    '';
+
+  buildInputs =
+   [ libtool gettext zlib bzip2 flac libvorbis exiv2
+     libgsf rpm
+     pkgconfig
+   ] ++ stdenv.lib.optionals gtkSupport [ glib gtk3 ]
+     ++ stdenv.lib.optionals videoSupport [ ffmpeg libmpeg2 ];
+
+  configureFlags = [
+    "--disable-ltdl-install"
+    "--with-ltdl-include=${libtool}/include"
+    "--with-ltdl-lib=${libtool.lib}/lib"
+    "--enable-xpdf"
+  ];
+
+  # Checks need to be run after "make install", otherwise plug-ins are not in
+  # the search path, etc.
+  # FIXME: Tests currently fail and the test framework appears to be deeply
+  # broken anyway.
+  doCheck = false;
+  #postInstall = "make check";
+
+  meta = {
+    description = "Simple library for keyword extraction";
+
+    longDescription =
+      '' GNU libextractor is a library used to extract meta-data from files
+         of arbitrary type.  It is designed to use helper-libraries to perform
+         the actual extraction, and to be trivially extendable by linking
+         against external extractors for additional file types.
+
+         The goal is to provide developers of file-sharing networks or
+         WWW-indexing bots with a universal library to obtain simple keywords
+         to match against queries.  libextractor contains a shell-command
+         extract that, similar to the well-known file command, can extract
+         meta-data from a file an print the results to stdout.
+
+         Currently, libextractor supports the following formats: HTML, PDF,
+         PS, OLE2 (DOC, XLS, PPT), OpenOffice (sxw), StarOffice (sdw), DVI,
+         MAN, FLAC, MP3 (ID3v1 and ID3v2), NSF(E) (NES music), SID (C64
+         music), OGG, WAV, EXIV2, JPEG, GIF, PNG, TIFF, DEB, RPM, TAR(.GZ),
+         ZIP, ELF, S3M (Scream Tracker 3), XM (eXtended Module), IT (Impulse
+         Tracker), FLV, REAL, RIFF (AVI), MPEG, QT and ASF.  Also, various
+         additional MIME types are detected.
+      '';
+
+    license = stdenv.lib.licenses.gpl2Plus;
+
+    maintainers = [ ];
+    platforms = stdenv.lib.platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libexttextcat/default.nix b/nixpkgs/pkgs/development/libraries/libexttextcat/default.nix
new file mode 100644
index 000000000000..7b3df42c24c3
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libexttextcat/default.nix
@@ -0,0 +1,17 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "libexttextcat-3.4.5";
+
+  src = fetchurl {
+    url = "https://dev-www.libreoffice.org/src/libexttextcat/${name}.tar.xz";
+    sha256 = "1j6sjwkyhqvsgyw938bxxfwkzzi1mahk66g5342lv6j89jfvrz8k";
+  };
+
+  meta = with stdenv.lib; {
+    description = "An N-Gram-Based Text Categorization library primarily intended for language guessing";
+    homepage = https://wiki.documentfoundation.org/Libexttextcat;
+    platforms = platforms.all;
+    license = licenses.bsd3;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libf2c/default.nix b/nixpkgs/pkgs/development/libraries/libf2c/default.nix
new file mode 100644
index 000000000000..2de407e8f639
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libf2c/default.nix
@@ -0,0 +1,35 @@
+{stdenv, fetchurl, unzip}:
+
+stdenv.mkDerivation rec {
+  name = "libf2c-20160102";
+
+  src = fetchurl {
+    url = http://www.netlib.org/f2c/libf2c.zip;
+    sha256 = "1q78y8j8xpl8zdzdxmn5ablss56hi5a7vz3idam9l2nfx5q40h6a";
+  };
+
+  unpackPhase = ''
+    mkdir build
+    cd build
+    unzip ${src}
+  '';
+
+  makeFlags = "-f makefile.u";
+
+  installPhase = ''
+    mkdir -p $out/include $out/lib
+    cp libf2c.a $out/lib
+    cp f2c.h $out/include
+  '';
+
+  buildInputs = [ unzip ];
+
+  hardeningDisable = [ "format" ];
+
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libfakekey/default.nix b/nixpkgs/pkgs/development/libraries/libfakekey/default.nix
new file mode 100644
index 000000000000..e36c4ee12b94
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libfakekey/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchurl, libX11, libXi, libXtst, pkgconfig, xorgproto }:
+
+stdenv.mkDerivation rec {
+  name = "libfakekey-${version}";
+  version = "0.1";
+
+  src = fetchurl {
+    url = "https://downloads.yoctoproject.org/releases/matchbox/libfakekey/0.1/${name}.tar.gz";
+    sha256 = "10msplyn535hmzbmbdnx4zc20hkaw6d81if5lzxs82k8sq2mkx9k";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ libX11 libXi libXtst xorgproto ];
+  NIX_LDFLAGS = [
+    "-lX11"
+  ];
+
+  meta = with stdenv.lib; {
+    description = "X virtual keyboard library";
+    homepage = https://www.yoctoproject.org/tools-resources/projects/matchbox;
+    license = licenses.gpl2;
+    maintainers = [ maintainers.goibhniu ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libfaketime/default.nix b/nixpkgs/pkgs/development/libraries/libfaketime/default.nix
new file mode 100644
index 000000000000..65d04cb53f16
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libfaketime/default.nix
@@ -0,0 +1,36 @@
+{ stdenv, fetchurl, bash, perl }:
+
+stdenv.mkDerivation rec {
+  name = "libfaketime-${version}";
+  version = "0.9.7";
+
+  src = fetchurl {
+    url = "https://github.com/wolfcw/libfaketime/archive/v${version}.tar.gz";
+    sha256 = "07l189881q0hybzmlpjyp7r5fwz23iafkm957bwy4gnmn9lg6rad";
+  };
+
+  patches = [
+    ./no-date-in-gzip-man-page.patch
+  ];
+
+  postPatch = ''
+    patchShebangs test src
+    for a in test/functests/test_exclude_mono.sh src/faketime.c ; do
+      substituteInPlace $a \
+        --replace /bin/bash ${stdenv.shell}
+    done
+  '';
+
+  PREFIX = placeholder "out";
+  LIBDIRNAME = "/lib";
+
+  checkInputs = [ perl ];
+
+  meta = with stdenv.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;
+    platforms = platforms.all;
+    maintainers = [ maintainers.bjornfor ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libfaketime/no-date-in-gzip-man-page.patch b/nixpkgs/pkgs/development/libraries/libfaketime/no-date-in-gzip-man-page.patch
new file mode 100644
index 000000000000..7b7e362fbf0f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libfaketime/no-date-in-gzip-man-page.patch
@@ -0,0 +1,12 @@
+diff -ur libfaketime-0.9.5.orig/man/Makefile libfaketime-0.9.5/man/Makefile
+--- libfaketime-0.9.5.orig/man/Makefile	2013-10-13 11:19:30.000000000 +0200
++++ libfaketime-0.9.5/man/Makefile	2014-04-13 01:22:14.362296519 +0200
+@@ -6,7 +6,7 @@
+ 
+ install:
+ 	$(INSTALL) -Dm0644 faketime.1 "${DESTDIR}${PREFIX}/share/man/man1/faketime.1"
+-	gzip -f "${DESTDIR}${PREFIX}/share/man/man1/faketime.1"
++	gzip -9nf "${DESTDIR}${PREFIX}/share/man/man1/faketime.1"
+ 
+ uninstall:
+ 	rm -f "${DESTDIR}${PREFIX}/share/man/man1/faketime.1.gz"
diff --git a/nixpkgs/pkgs/development/libraries/libfann/default.nix b/nixpkgs/pkgs/development/libraries/libfann/default.nix
new file mode 100644
index 000000000000..5ac7a244df20
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libfann/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, lib, fetchFromGitHub, cmake }:
+
+stdenv.mkDerivation rec {
+  name = "libfann-${version}";
+  version = "2.2.0";
+
+  src = fetchFromGitHub {
+    owner = "libfann";
+    repo = "fann";
+    rev = version;
+    sha256 = "0awbs0vjsrdglqiaybb0ln13ciizmyrw9ahllahvgbq4nr0nvf6y";
+  };
+
+  nativeBuildInputs = [ cmake ];
+
+  outputs = [ "out" "dev" ];
+
+  meta = {
+    homepage = http://leenissen.dk/fann/wp/;
+    description = "Fast Artificial Neural Network Library";
+    maintainers = with lib.maintainers; [ fpletz ];
+    license = lib.licenses.lgpl21;
+    platforms = lib.platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libffcall/default.nix b/nixpkgs/pkgs/development/libraries/libffcall/default.nix
new file mode 100644
index 000000000000..513a4dc3d384
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libffcall/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "libffcall-${version}";
+  version = "2.1";
+
+  src = fetchurl {
+    url = "mirror://gnu/libffcall/libffcall-${version}.tar.gz";
+    sha256 = "0iwcad6w78jp84vd6xaz5fwqm84n3cb42bdf5m5cj5xzpa5zp4d0";
+  };
+
+  enableParallelBuilding = false;
+
+  outputs = [ "dev" "out" "doc" "man" ];
+
+  postInstall = ''
+    mkdir -p $doc/share/doc/libffcall
+    mv $out/share/html $doc/share/doc/libffcall
+    rm -rf $out/share
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Foreign function call library";
+    homepage = https://www.gnu.org/software/libffcall/;
+    license = licenses.gpl2Plus;
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libffi/3.2.1-cygwin.patch b/nixpkgs/pkgs/development/libraries/libffi/3.2.1-cygwin.patch
new file mode 100644
index 000000000000..f3b38dbd1c16
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libffi/3.2.1-cygwin.patch
@@ -0,0 +1,10 @@
+--- libffi-3.2.1/src/closures.c	2014-11-08 13:47:24.000000000 +0100
++++ libffi-3.2.1/src/closures.c	2015-05-19 10:15:50.059325900 +0200
+@@ -212,6 +212,7 @@
+ #include <sys/mman.h>
+ 
+ /* Cygwin is Linux-like, but not quite that Linux-like.  */
++#define is_emutramp_enabled() 0
+ #define is_selinux_enabled() 0
+ 
+ #endif /* !defined(X86_WIN32) && !defined(X86_WIN64) */
diff --git a/nixpkgs/pkgs/development/libraries/libffi/default.nix b/nixpkgs/pkgs/development/libraries/libffi/default.nix
new file mode 100644
index 000000000000..2918276ef211
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libffi/default.nix
@@ -0,0 +1,96 @@
+{ stdenv, fetchurl, fetchpatch
+, autoreconfHook
+
+# libffi is used in darwin stdenv
+# we cannot run checks within it
+, doCheck ? !stdenv.isDarwin, dejagnu
+}:
+
+stdenv.mkDerivation rec {
+  name = "libffi-3.2.1";
+
+  src = fetchurl {
+    url = "https://sourceware.org/pub/libffi/${name}.tar.gz";
+    sha256 = "0dya49bnhianl0r65m65xndz6ls2jn1xngyn72gd28ls3n7bnvnh";
+  };
+
+  patches = stdenv.lib.optional stdenv.isCygwin ./3.2.1-cygwin.patch
+    ++ stdenv.lib.optional stdenv.isAarch64 (fetchpatch {
+      url = https://src.fedoraproject.org/rpms/libffi/raw/ccffc1700abfadb0969495a6e51b964117fc03f6/f/libffi-aarch64-rhbz1174037.patch;
+      sha256 = "1vpirrgny43hp0885rswgv3xski8hg7791vskpbg3wdjdpb20wbc";
+    })
+    ++ stdenv.lib.optional stdenv.hostPlatform.isMusl (fetchpatch {
+      name = "gnu-linux-define.patch";
+      url = "https://git.alpinelinux.org/cgit/aports/plain/main/libffi/gnu-linux-define.patch?id=bb024fd8ec6f27a76d88396c9f7c5c4b5800d580";
+      sha256 = "11pvy3xkhyvnjfyy293v51f1xjy3x0azrahv1nw9y9mw8bifa2j2";
+    })
+    ++ stdenv.lib.optional stdenv.hostPlatform.isRiscV (fetchpatch {
+      name = "riscv-support.patch";
+      url = https://github.com/sorear/libffi-riscv/commit/e46492e8bb1695a19bc1053ed869e6c2bab02ff2.patch;
+      sha256 = "1vl1vbvdkigs617kckxvj8j4m2cwg62kxm1clav1w5rnw9afxg0y";
+    })
+    ++ stdenv.lib.optionals stdenv.isMips [
+      (fetchpatch {
+        name = "0001-mips-Use-compiler-internal-define-for-linux.patch";
+        url = "http://cgit.openembedded.org/openembedded-core/plain/meta/recipes-support/libffi/libffi/0001-mips-Use-compiler-internal-define-for-linux.patch?id=318e33a708378652edcf61ce7d9d7f3a07743000";
+        sha256 = "1gc53lw90p6hc0cmhj3csrwincfz7va5ss995ksw5gm0yrr9mrvb";
+      })
+      (fetchpatch {
+        name = "0001-mips-fix-MIPS-softfloat-build-issue.patch";
+        url = "http://cgit.openembedded.org/openembedded-core/plain/meta/recipes-support/libffi/libffi/0001-mips-fix-MIPS-softfloat-build-issue.patch?id=318e33a708378652edcf61ce7d9d7f3a07743000";
+        sha256 = "0l8xgdciqalg4z9rcwyk87h8fdxpfv4hfqxwsy2agpnpszl5jjdq";
+      })
+    ];
+
+  outputs = [ "out" "dev" "man" "info" ];
+
+  nativeBuildInputs = stdenv.lib.optional stdenv.hostPlatform.isRiscV autoreconfHook;
+
+  configureFlags = [
+    "--with-gcc-arch=generic" # no detection of -march= or -mtune=
+    "--enable-pax_emutramp"
+  ];
+
+  preCheck = ''
+    # The tests use -O0 which is not compatible with -D_FORTIFY_SOURCE.
+    NIX_HARDENING_ENABLE=''${NIX_HARDENING_ENABLE/fortify/}
+  '';
+
+  checkInputs = [ dejagnu ];
+
+  inherit doCheck;
+
+  dontStrip = stdenv.hostPlatform != stdenv.buildPlatform; # Don't run the native `strip' when cross-compiling.
+
+  # Install headers and libs in the right places.
+  postFixup = ''
+    mkdir -p "$dev/"
+    mv "$out/lib/${name}/include" "$dev/include"
+    rmdir "$out/lib/${name}"
+    substituteInPlace "$dev/lib/pkgconfig/libffi.pc" \
+      --replace 'includedir=''${libdir}/libffi-3.2.1' "includedir=$dev"
+  '';
+
+  meta = with stdenv.lib; {
+    description = "A foreign function call interface library";
+    longDescription = ''
+      The libffi library provides a portable, high level programming
+      interface to various calling conventions.  This allows a
+      programmer to call any function specified by a call interface
+      description at run-time.
+
+      FFI stands for Foreign Function Interface.  A foreign function
+      interface is the popular name for the interface that allows code
+      written in one language to call code written in another
+      language.  The libffi library really only provides the lowest,
+      machine dependent layer of a fully featured foreign function
+      interface.  A layer must exist above libffi that handles type
+      conversions for values passed between the two languages.
+    '';
+    homepage = http://sourceware.org/libffi/;
+    # See https://github.com/atgreen/libffi/blob/master/LICENSE .
+    license = licenses.free;
+    maintainers = [ ];
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libfido2/default.nix b/nixpkgs/pkgs/development/libraries/libfido2/default.nix
new file mode 100644
index 000000000000..b670172ce1ee
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libfido2/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchurl, cmake, pkgconfig, libcbor, libressl, udev }:
+
+stdenv.mkDerivation rec {
+  pname = "libfido2";
+  version = "1.1.0";
+  src = fetchurl {
+    url = "https://developers.yubico.com/libfido2/Releases/libfido2-${version}.tar.gz";
+    sha256 = "1h51q9pgv54czf7k6v90b02gnvqw4dlxmz6vi0n06shpkdzv5jh1";
+  };
+
+  nativeBuildInputs = [ cmake pkgconfig ];
+  buildInputs = [ libcbor libressl udev ];
+
+  cmakeFlags = [ "-DUDEV_RULES_DIR=${placeholder "out"}/etc/udev/rules.d" ];
+
+  meta = with stdenv.lib; {
+    description = ''
+    Provides library functionality for FIDO 2.0, including communication with a device over USB.
+    '';
+    homepage = https://github.com/Yubico/libfido2;
+    license = licenses.bsd2;
+    maintainers = with maintainers; [ dtzWill ];
+
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libfilezilla/default.nix b/nixpkgs/pkgs/development/libraries/libfilezilla/default.nix
new file mode 100644
index 000000000000..4a051f34b0ba
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libfilezilla/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, fetchurl, pkgconfig, nettle }:
+
+stdenv.mkDerivation rec {
+  pname = "libfilezilla";
+  version = "0.16.0";
+
+  src = fetchurl {
+    url = "https://download.filezilla-project.org/${pname}/${pname}-${version}.tar.bz2";
+    sha256 = "1fd71vmllzvljff5l5ka5wnzbdsxx4i54dpxpklydmbsqpilnv1v";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ nettle ];
+
+  meta = with stdenv.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;
+    maintainers = with maintainers; [ pSub ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libfive/default.nix b/nixpkgs/pkgs/development/libraries/libfive/default.nix
new file mode 100644
index 000000000000..4b02d651929b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libfive/default.nix
@@ -0,0 +1,30 @@
+{ stdenv, fetchFromGitHub, cmake, ninja, pkgconfig, eigen,
+zlib, libpng, boost, qt5, guile
+}:
+
+stdenv.mkDerivation rec {
+  name = "libfive-${version}";
+  version = "2018-07-01";
+
+  src = fetchFromGitHub {
+    owner  = "libfive";
+    repo   = "libfive";
+    rev    = "0f517dde9521d751310a22f85ee69b2c84690267";
+    sha256 = "0bfxysf5f4ripgcv546il8wnw5p0d4s75kdjlwvj32549537hlz0";
+  };
+  nativeBuildInputs = [ cmake ninja pkgconfig ];
+  buildInputs = [ eigen zlib libpng boost qt5.qtimageformats guile ];
+
+  # Link "Studio" binary to "libfive-studio" to be more obvious:
+  postFixup = ''
+    ln -s "$out/bin/Studio" "$out/bin/libfive-studio"
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Infrastructure for solid modeling with F-Reps in C, C++, and Guile";
+    homepage = https://libfive.com/;
+    maintainers = with maintainers; [ hodapp ];
+    license = licenses.lgpl2;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libfixposix/default.nix b/nixpkgs/pkgs/development/libraries/libfixposix/default.nix
new file mode 100644
index 000000000000..2d2d56dda4f2
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libfixposix/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchFromGitHub, autoreconfHook, pkgconfig }:
+
+stdenv.mkDerivation rec {
+  name="libfixposix-${version}";
+  version="0.4.3";
+
+  src = fetchFromGitHub {
+    owner = "sionescu";
+    repo = "libfixposix";
+    rev = "v${version}";
+    sha256 = "1x4q6yspi5g2s98vq4qszw4z3zjgk9l5zs8471w4d4cs6l97w08j";
+  };
+
+  nativeBuildInputs = [ autoreconfHook pkgconfig ];
+
+  meta = with stdenv.lib; {
+    homepage = https://github.com/sionescu/libfixposix;
+    description = "Thin wrapper over POSIX syscalls and some replacement functionality";
+    license = licenses.boost;
+    maintainers = with maintainers; [ orivej raskin ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libfm/default.nix b/nixpkgs/pkgs/development/libraries/libfm/default.nix
new file mode 100644
index 000000000000..a0323481be9a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libfm/default.nix
@@ -0,0 +1,40 @@
+{ stdenv, fetchurl, glib, intltool, menu-cache, pango, pkgconfig, vala
+, extraOnly ? false
+, withGtk3 ? false, gtk2, gtk3 }:
+let
+    gtk = if withGtk3 then gtk3 else gtk2;
+    inherit (stdenv.lib) optional;
+in
+stdenv.mkDerivation rec {
+  name = if extraOnly
+    then "libfm-extra-${version}"
+    else "libfm-${version}";
+  version = "1.3.1";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/pcmanfm/libfm-${version}.tar.xz";
+    sha256 = "1r6gl49xrykldwz8y4h2s7gjarxigg3bbkrj0gphxjj1vr5j9ccn";
+  };
+
+  nativeBuildInputs = [ vala pkgconfig intltool ];
+  buildInputs = [ glib gtk pango ] ++ optional (!extraOnly) menu-cache;
+
+  configureFlags = [
+    "--sysconfdir=/etc"
+  ] ++ optional extraOnly "--with-extra-only"
+    ++ optional withGtk3 "--with-gtk=3";
+
+  installFlags = [
+    "sysconfdir=${placeholder "out"}/etc"
+  ];
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    homepage = https://blog.lxde.org/category/pcmanfm/;
+    license = licenses.lgpl21Plus;
+    description = "A glib-based library for file management";
+    maintainers = [ maintainers.ttuegel ];
+    platforms = platforms.linux ++ platforms.darwin;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libfprint/default.nix b/nixpkgs/pkgs/development/libraries/libfprint/default.nix
new file mode 100644
index 000000000000..410496a7bb77
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libfprint/default.nix
@@ -0,0 +1,43 @@
+{ thinkpad ? false, stdenv, fetchFromGitHub, fetchurl, pkgconfig, meson, ninja, libusb, pixman, glib, nss, gtk3
+, coreutils, gtk-doc, docbook_xsl, docbook_xml_dtd_43, openssl ? null }:
+
+assert thinkpad -> openssl != null;
+
+stdenv.mkDerivation rec {
+  pname = "libfprint" + stdenv.lib.optionalString thinkpad "-thinkpad";
+  version = "0.99.0";
+
+  src = {
+    libfprint-thinkpad =
+      fetchFromGitHub {
+        owner = "3v1n0";
+        repo = "libfprint";
+        rev = "2e2e3821717e9042e93a995bdbd3d00f2df0be9c";
+        sha256 = "1vps1wrp7hskf13f7jrv0dwry2fcid76x2w463wplngp63cj7b3b";
+      };
+    libfprint = fetchurl {
+      url = "https://gitlab.freedesktop.org/libfprint/libfprint/uploads/82ba3cef5bdf72997df711eacdb13c0f/libfprint-${version}.tar.xz";
+      sha256 = "16r4nl40y0jri57jiqmdz4s87byblx22lbhyvqpljd6mqm5rg187";
+    };
+  }.${pname};
+
+  buildInputs = [ libusb pixman glib nss gtk3 ]
+    ++ stdenv.lib.optional thinkpad openssl;
+
+  nativeBuildInputs = [ pkgconfig meson ninja gtk-doc docbook_xsl docbook_xml_dtd_43 ];
+
+  mesonFlags = [ "-Dudev_rules_dir=lib/udev/rules.d" "-Dx11-examples=false" ];
+
+  preConfigure = ''
+    substituteInPlace libfprint/meson.build \
+      --replace /bin/echo ${coreutils}/bin/echo
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = https://fprint.freedesktop.org/;
+    description = "A library designed to make it easy to add support for consumer fingerprint readers";
+    license = licenses.lgpl21;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ abbradar ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libfpx/default.nix b/nixpkgs/pkgs/development/libraries/libfpx/default.nix
new file mode 100644
index 000000000000..f4863eb33f26
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libfpx/default.nix
@@ -0,0 +1,32 @@
+{ stdenv, fetchurl, fetchpatch }:
+
+stdenv.mkDerivation rec {
+  name = "libfpx-1.3.1-7";
+
+  src = fetchurl {
+    url = "mirror://imagemagick/delegates/${name}.tar.xz";
+    sha256 = "1s28mwb06w6dj0zl6ashpj8m1qiyadawzl7cvbw7dmj1w39ipghh";
+  };
+
+  # Darwin gets misdetected as Windows without this
+  NIX_CFLAGS_COMPILE = if stdenv.isDarwin then "-D__unix" else null;
+
+  patches = [
+    (fetchpatch {
+      url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/media-libs/libfpx/files/libfpx-1.3.1_p6-gcc6.patch?id=f28a947813dbc0a1fd1a8d4a712d58a64c48ca01";
+      sha256 = "032y8110zgnkdhkdq3745zk53am1x34d912rai8q70k3sskyq22p";
+    })
+  ];
+
+  # This dead code causes a duplicate symbol error in Clang so just remove it
+  postPatch = if stdenv.cc.isClang then ''
+    substituteInPlace jpeg/ejpeg.h --replace "int No_JPEG_Header_Flag" ""
+  '' else null;
+
+  meta = with stdenv.lib; {
+    homepage = http://www.imagemagick.org;
+    description = "A library for manipulating FlashPIX images";
+    license = "Flashpix";
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libfreefare/default.nix b/nixpkgs/pkgs/development/libraries/libfreefare/default.nix
new file mode 100644
index 000000000000..cfae74b4b9e3
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libfreefare/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchurl, pkgconfig, libnfc, openssl
+, libobjc ? null }:
+
+stdenv.mkDerivation rec {
+  name = "libfreefare-${version}";
+  version = "0.4.0";
+
+  src = fetchurl {
+    url = "https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/libfreefare/libfreefare-0.4.0.tar.bz2";
+    sha256 = "0r5wfvwgf35lb1v65wavnwz2wlfyfdims6a9xpslf4lsm4a1v8xz";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ libnfc openssl ] ++ stdenv.lib.optional stdenv.isDarwin libobjc;
+
+  meta = with stdenv.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;
+    maintainers = with maintainers; [bobvanderlinden];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libftdi/1.x.nix b/nixpkgs/pkgs/development/libraries/libftdi/1.x.nix
new file mode 100644
index 000000000000..1b00ff4c0fbb
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libftdi/1.x.nix
@@ -0,0 +1,47 @@
+{ stdenv, fetchurl, cmake, pkgconfig, libusb1, libconfuse
+, cppSupport ? true, boost ? null
+, pythonSupport ? true, python ? null, swig ? null
+, docSupport ? true, doxygen ? null
+}:
+
+assert cppSupport -> boost != null;
+assert pythonSupport -> python != null && swig != null;
+assert docSupport -> doxygen != null;
+
+stdenv.mkDerivation rec {
+  name = "libftdi1-1.4";
+
+  src = fetchurl {
+    url = "https://www.intra2net.com/en/developer/libftdi/download/${name}.tar.bz2";
+    sha256 = "0x0vncf6i92slgrn0h7ghkskqbglbs534220qa84d0qg114zndpc";
+  };
+
+  nativeBuildInputs = [ cmake pkgconfig ];
+  buildInputs = with stdenv.lib; [ libconfuse ]
+    ++ optionals cppSupport [ boost ]
+    ++ optionals pythonSupport [ python swig ]
+    ++ optionals docSupport [ doxygen ];
+
+  preBuild = stdenv.lib.optionalString docSupport ''
+    make doc_i
+  '';
+
+  propagatedBuildInputs = [ libusb1 ];
+
+  postInstall = ''
+    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 ''
+    mkdir -p "$out/share/libftdi/doc/"
+    cp -r doc/html "$out/share/libftdi/doc/"
+  '';
+
+  meta = with stdenv.lib; {
+    description = "A library to talk to FTDI chips using libusb";
+    homepage = https://www.intra2net.com/en/developer/libftdi/;
+    license = with licenses; [ lgpl2 gpl2 ];
+    platforms = with platforms; linux ++ darwin;
+    maintainers = [ maintainers.bjornfor ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libftdi/default.nix b/nixpkgs/pkgs/development/libraries/libftdi/default.nix
new file mode 100644
index 000000000000..74b87a46ef0a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libftdi/default.nix
@@ -0,0 +1,32 @@
+{stdenv, fetchurl, libusb}:
+
+stdenv.mkDerivation rec {
+  name = "libftdi-0.20";
+
+  src = fetchurl {
+    url = "https://www.intra2net.com/en/developer/libftdi/download/${name}.tar.gz";
+    sha256 = "13l39f6k6gff30hsgh0wa2z422g9pyl91rh8a8zz6f34k2sxaxii";
+  };
+
+  buildInputs = [ libusb ];
+
+  propagatedBuildInputs = [ libusb ];
+
+  # Hack to avoid TMPDIR in RPATHs.
+  preFixup = ''rm -rf "$(pwd)" '';
+  configureFlags = [ "--with-async-mode" ];
+
+  # allow async mode. from ubuntu. see:
+  #   https://bazaar.launchpad.net/~ubuntu-branches/ubuntu/trusty/libftdi/trusty/view/head:/debian/patches/04_async_mode.diff
+  patchPhase = ''
+    substituteInPlace ./src/ftdi.c \
+      --replace "ifdef USB_CLASS_PTP" "if 0"
+  '';
+
+  meta = {
+    description = "A library to talk to FTDI chips using libusb";
+    homepage = https://www.intra2net.com/en/developer/libftdi/;
+    license = stdenv.lib.licenses.lgpl21;
+    platforms = stdenv.lib.platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libgadu/default.nix b/nixpkgs/pkgs/development/libraries/libgadu/default.nix
new file mode 100644
index 000000000000..b039c84b2fb1
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libgadu/default.nix
@@ -0,0 +1,21 @@
+{stdenv, fetchurl, zlib}:
+
+stdenv.mkDerivation {
+
+  name = "libgadu-1.11.2";
+
+  src = fetchurl {
+    url = http://toxygen.net/libgadu/files/libgadu-1.11.2.tar.gz;
+    sha256 = "0kifi9blhbimihqw4kaf6wyqhlx8fpp8nq4s6y280ar9p0il2n3z";
+  };
+
+  propagatedBuildInputs = [ zlib ];
+
+  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;
+  };
+
+}
diff --git a/nixpkgs/pkgs/development/libraries/libgaminggear/default.nix b/nixpkgs/pkgs/development/libraries/libgaminggear/default.nix
new file mode 100644
index 000000000000..a6fe2bc1435f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libgaminggear/default.nix
@@ -0,0 +1,40 @@
+{ stdenv, fetchurl, cmake, pkgconfig, gettext
+, gtk2, libcanberra, libnotify, pcre, sqlite, xorg
+}:
+
+stdenv.mkDerivation rec {
+  name = "libgaminggear-${version}";
+  version = "0.15.1";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/libgaminggear/${name}.tar.bz2";
+    sha256 = "0jf5i1iv8j842imgiixbhwcr6qcwa93m27lzr6gb01ri5v35kggz";
+  };
+
+  outputs = [ "dev" "out" "bin" ];
+
+  nativeBuildInputs = [ cmake pkgconfig gettext ];
+
+  propagatedBuildInputs = [
+    gtk2 libcanberra libnotify pcre sqlite xorg.libXdmcp xorg.libpthreadstubs
+  ];
+
+  enableParallelBuilding = true;
+
+  cmakeFlags = [
+    "-DINSTALL_CMAKE_MODULESDIR=lib/cmake"
+    "-DINSTALL_PKGCONFIGDIR=lib/pkgconfig"
+    "-DINSTALL_LIBDIR=lib"
+  ];
+
+  postFixup = ''
+    moveToOutput bin "$bin"
+  '';
+
+  meta = {
+    description = "Provides functionality for gaming input devices";
+    homepage = https://sourceforge.net/projects/libgaminggear/;
+    platforms = stdenv.lib.platforms.linux;
+    license = stdenv.lib.licenses.gpl2Plus;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libgap/default.nix b/nixpkgs/pkgs/development/libraries/libgap/default.nix
new file mode 100644
index 000000000000..42e812ec1f53
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libgap/default.nix
@@ -0,0 +1,25 @@
+{ stdenv
+, fetchurl
+, gmp
+}:
+# will probably be obsolte (or at leat built from the upstream gap sources) soon (gap 4.9?). See
+# - https://github.com/gap-system/gap/projects/5#card-6239828
+# - https://github.com/markuspf/gap/issues/2
+# - https://trac.sagemath.org/ticket/22626
+stdenv.mkDerivation rec {
+  name = "libgap-${version}";
+  # Has to be the same version as "gap"
+  version = "4.8.6";
+  src = fetchurl {
+    url = "mirror://sageupstream/libgap/libgap-${version}.tar.gz";
+    sha256 = "1h5fx5a55857w583ql7ly2jl49qyx9mvs7j5abys00ra9gzrpn5v";
+  };
+  buildInputs = [gmp];
+  meta = {
+    inherit version;
+    description = ''A library-packaged fork of the GAP kernel'';
+    license = stdenv.lib.licenses.gpl3Plus;
+    maintainers = [stdenv.lib.maintainers.raskin];
+    platforms = stdenv.lib.platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libgcrypt/1.5.nix b/nixpkgs/pkgs/development/libraries/libgcrypt/1.5.nix
new file mode 100644
index 000000000000..80cb6641bfba
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libgcrypt/1.5.nix
@@ -0,0 +1,42 @@
+{ lib, stdenv, fetchpatch, fetchurl, libgpgerror, enableCapabilities ? false, libcap }:
+
+assert enableCapabilities -> stdenv.isLinux;
+
+stdenv.mkDerivation rec {
+  name = "libgcrypt-1.5.6";
+
+  src = fetchurl {
+    url = "mirror://gnupg/libgcrypt/${name}.tar.bz2";
+    sha256 = "0ydy7bgra5jbq9mxl5x031nif3m6y3balc6ndw2ngj11wnsjc61h";
+  };
+
+  patches = stdenv.lib.optionals stdenv.isDarwin [
+    (fetchpatch {
+      name = "fix-x86_64-apple-darwin.patch";
+      sha256 = "138sfwl1avpy19320dbd63mskspc1khlc93j1f1zmylxx3w19csi";
+      url = "https://git.gnupg.org/cgi-bin/gitweb.cgi?p=libgcrypt.git;a=patch;h=71939faa7c54e7b4b28d115e748a85f134876a02";
+    })
+  ];
+
+  buildInputs =
+    [ libgpgerror ]
+    ++ lib.optional enableCapabilities libcap;
+
+  # Make sure libraries are correct for .pc and .la files
+  # 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 ''
+    sed -i 's,\(-lcap\),-L${libcap.lib}/lib \1,' $out/lib/libgcrypt.la
+  '';
+
+  doCheck = true;
+
+  meta = with stdenv.lib; {
+    homepage = https://www.gnu.org/software/libgcrypt/;
+    description = "General-pupose cryptographic library";
+    license = licenses.lgpl2Plus;
+    platforms = platforms.all;
+    repositories.git = git://git.gnupg.org/libgcrypt.git;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libgcrypt/default.nix b/nixpkgs/pkgs/development/libraries/libgcrypt/default.nix
new file mode 100644
index 000000000000..4d8a7eac27c8
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libgcrypt/default.nix
@@ -0,0 +1,57 @@
+{ stdenv, fetchurl, gettext, libgpgerror, enableCapabilities ? false, libcap
+, buildPackages
+}:
+
+assert enableCapabilities -> stdenv.isLinux;
+
+stdenv.mkDerivation rec {
+  name = "libgcrypt-${version}";
+  version = "1.8.4";
+
+  src = fetchurl {
+    url = "mirror://gnupg/libgcrypt/${name}.tar.bz2";
+    sha256 = "09r27ywj9zplq6n9qw3mn7zmvf6y2jdmwx5d1kg8yqkj0qx18f7n";
+  };
+
+  outputs = [ "out" "dev" "info" ];
+  outputBin = "dev";
+
+  # 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";
+
+  depsBuildBuild = [ buildPackages.stdenv.cc ];
+
+  buildInputs = [ libgpgerror ]
+    ++ stdenv.lib.optional stdenv.isDarwin gettext
+    ++ stdenv.lib.optional enableCapabilities libcap;
+
+  configureFlags = [ "--with-libgpg-error-prefix=${libgpgerror.dev}" ];
+
+  # Make sure libraries are correct for .pc and .la files
+  # 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 ''
+    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 ''
+    mkdir -p $out/lib
+    cp src/.libs/libgcrypt.20.dylib $out/lib
+  '';
+
+  doCheck = true;
+
+  meta = with stdenv.lib; {
+    homepage = https://www.gnu.org/software/libgcrypt/;
+    description = "General-purpose cryptographic library";
+    license = licenses.lgpl2Plus;
+    platforms = platforms.all;
+    maintainers = with maintainers; [ vrthra ];
+    repositories.git = git://git.gnupg.org/libgcrypt.git;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libgda/default.nix b/nixpkgs/pkgs/development/libraries/libgda/default.nix
new file mode 100644
index 000000000000..bb6402dc4287
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libgda/default.nix
@@ -0,0 +1,44 @@
+{ stdenv, fetchurl, pkgconfig, intltool, itstool, libxml2, gtk3, openssl, gnome3, gobject-introspection, vala, libgee
+, overrideCC, gcc6
+, mysqlSupport ? false, mysql ? null
+, postgresSupport ? false, postgresql ? null
+}:
+
+assert mysqlSupport -> mysql != null;
+assert postgresSupport -> postgresql != null;
+
+(if stdenv.isAarch64 then overrideCC stdenv gcc6 else stdenv).mkDerivation rec {
+  pname = "libgda";
+  version = "5.2.9";
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    sha256 = "16vxv2qvysh22s8h9h6irx96sacagxkz0i4qgi1wc6ibly6fvjjr";
+  };
+  configureFlags = with stdenv.lib; [ "--enable-gi-system-install=no" ]
+    ++ (optional (mysqlSupport) "--with-mysql=yes")
+    ++ (optional (postgresSupport) "--with-postgres=yes");
+
+  enableParallelBuilding = true;
+
+  hardeningDisable = [ "format" ];
+
+  nativeBuildInputs = [ pkgconfig intltool itstool libxml2 gobject-introspection vala ];
+  buildInputs = with stdenv.lib; [ gtk3 openssl libgee ]
+    ++ optional (mysqlSupport) mysql.connector-c
+    ++ optional (postgresSupport) postgresql;
+
+  passthru = {
+    updateScript = gnome3.updateScript {
+      packageName = pname;
+    };
+  };
+
+  meta = with stdenv.lib; {
+    description = "Database access library";
+    homepage = https://www.gnome-db.org/;
+    license = [ licenses.lgpl2 licenses.gpl2 ];
+    maintainers = gnome3.maintainers;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libgdamm/default.nix b/nixpkgs/pkgs/development/libraries/libgdamm/default.nix
new file mode 100644
index 000000000000..4367cc5b2764
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libgdamm/default.nix
@@ -0,0 +1,39 @@
+{ stdenv, fetchurl, pkgconfig, glibmm, libgda, libxml2, gnome3
+, mysqlSupport ? false, mysql ? null
+, postgresSupport ? false, postgresql ? null }:
+
+let
+  gda = libgda.override {
+    inherit mysqlSupport postgresSupport;
+  };
+in stdenv.mkDerivation rec {
+  pname = "libgdamm";
+  version = "4.99.11";
+
+  outputs = [ "out" "dev" ];
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    sha256 = "1fyh15b3f8hmwbswalxk1g4l04yvvybksn5nm7gznn5jl5q010p9";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ glibmm libxml2 ];
+  propagatedBuildInputs = [ gda ];
+
+  enableParallelBuilding = true;
+
+  passthru = {
+    updateScript = gnome3.updateScript {
+      packageName = pname;
+    };
+  };
+
+  meta = with stdenv.lib; {
+    description = "C++ bindings for libgda";
+    homepage = https://www.gnome-db.org/;
+    license = licenses.lgpl21Plus;
+    maintainers = gnome3.maintainers;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libgdata/default.nix b/nixpkgs/pkgs/development/libraries/libgdata/default.nix
new file mode 100644
index 000000000000..59e19750715f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libgdata/default.nix
@@ -0,0 +1,33 @@
+{ stdenv, fetchurl, pkgconfig, intltool, libxml2, glib, json-glib, gcr
+, gobject-introspection, liboauth, gnome3, p11-kit, openssl, uhttpmock }:
+
+stdenv.mkDerivation rec {
+  pname = "libgdata";
+  version = "0.17.9";
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    sha256 = "0fj54yqxdapdppisqm1xcyrpgcichdmipq0a0spzz6009ikzgi45";
+  };
+
+  nativeBuildInputs = [ pkgconfig intltool gobject-introspection ];
+
+  buildInputs = [ gnome3.libsoup libxml2 glib liboauth gcr gnome3.gnome-online-accounts p11-kit openssl uhttpmock ];
+
+  propagatedBuildInputs = [ json-glib ];
+
+  passthru = {
+    updateScript = gnome3.updateScript {
+      packageName = pname;
+      versionPolicy = "none"; # Stable version has not been updated for a long time.
+    };
+  };
+
+  meta = with stdenv.lib; {
+    description = "GData API library";
+    homepage = https://wiki.gnome.org/Projects/libgdata;
+    maintainers = with maintainers; [ raskin lethalman ];
+    platforms = platforms.linux;
+    license = licenses.lgpl21Plus;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libgdiplus/default.nix b/nixpkgs/pkgs/development/libraries/libgdiplus/default.nix
new file mode 100644
index 000000000000..ba9eab432029
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libgdiplus/default.nix
@@ -0,0 +1,56 @@
+{ stdenv, fetchFromGitHub, pkgconfig, glib, cairo, Carbon, fontconfig
+, libtiff, giflib, libjpeg, libpng
+, libXrender, libexif, autoreconfHook, fetchpatch }:
+
+stdenv.mkDerivation rec {
+  name = "libgdiplus-5.6.1";
+
+  src = fetchFromGitHub {
+    owner = "mono";
+    repo = "libgdiplus";
+    rev = "5.6.1";
+    sha256 = "023xf3l2s0mxcdbl2viglzrkhx3lwcrpm66fiq7cfdqz80d4vsj2";
+  };
+
+  NIX_LDFLAGS = "-lgif";
+
+  patches = [ # Series of patches cherry-picked from master, all fixes various sigsegv (or required by other patch)
+    (fetchpatch {
+          url = "https://github.com/mono/libgdiplus/commit/d33a2580a94701ff33abe28c22881d6173be57d0.patch";
+          sha256 = "0rr54jylscn4icqjprqhwrncyr92r0d7kmfrrq3myskplpqv1c11";
+    })
+    (fetchpatch {
+          url ="https://github.com/mono/libgdiplus/commit/aa6aa53906935572f52f519fe4ab9ebedc051d08.patch";
+          sha256 = "1wg0avm8qv5cb4vk80baflfzszm6q7ydhn89c3h6kq68hg6zsf1f";
+    })
+    (fetchpatch {
+          url = "https://github.com/mono/libgdiplus/commit/81e45a1d5a3ac3cf035bcc3fabb2859818b6cc04.patch";
+          sha256 = "07wmc88cd1lqifs5x6npryni65jyy9gi8lgr2i1lb7v0fhvlyswg";
+    })
+  ];
+
+  hardeningDisable = [ "format" ];
+
+  nativeBuildInputs = [ autoreconfHook pkgconfig ];
+
+  buildInputs =
+    [ glib cairo fontconfig libtiff giflib
+      libjpeg libpng libXrender libexif
+    ]
+    ++ stdenv.lib.optional stdenv.isDarwin Carbon;
+
+  postInstall = stdenv.lib.optionalString stdenv.isDarwin ''
+    ln -s $out/lib/libgdiplus.0.dylib $out/lib/libgdiplus.so
+  '';
+
+  checkPhase = ''
+    make check -w
+  '';
+
+  meta = with stdenv.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;
+    license = licenses.mit;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libgee/default.nix b/nixpkgs/pkgs/development/libraries/libgee/default.nix
new file mode 100644
index 000000000000..260c3a3d97bf
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libgee/default.nix
@@ -0,0 +1,35 @@
+{ stdenv, fetchurl, autoconf, vala, pkgconfig, glib, gobject-introspection, gnome3 }:
+
+stdenv.mkDerivation rec {
+  pname = "libgee";
+  version = "0.20.1";
+
+  outputs = [ "out" "dev" ];
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    sha256 = "0c26x8gi3ivmhlbqcmiag4jwrkvcy28ld24j55nqr3jikb904a5v";
+  };
+
+  doCheck = true;
+
+  nativeBuildInputs = [ pkgconfig autoconf vala gobject-introspection ];
+  buildInputs = [ glib ];
+
+  PKG_CONFIG_GOBJECT_INTROSPECTION_1_0_GIRDIR = "${placeholder "dev"}/share/gir-1.0";
+  PKG_CONFIG_GOBJECT_INTROSPECTION_1_0_TYPELIBDIR = "${placeholder "out"}/lib/girepository-1.0";
+
+  passthru = {
+    updateScript = gnome3.updateScript {
+      packageName = pname;
+    };
+  };
+
+  meta = with stdenv.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;
+    platforms = platforms.unix;
+    maintainers = gnome3.maintainers;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libgeotiff/default.nix b/nixpkgs/pkgs/development/libraries/libgeotiff/default.nix
new file mode 100644
index 000000000000..33b9e7830e71
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libgeotiff/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchurl, libtiff, libjpeg, proj, zlib}:
+
+stdenv.mkDerivation rec {
+  version = "1.4.3";
+  name = "libgeotiff-${version}";
+
+  src = fetchurl {
+    url = "https://download.osgeo.org/geotiff/libgeotiff/${name}.tar.gz";
+    sha256 = "0rbjqixi4c8yz19larlzq6jda0px2gpmpp9c52cyhplbjsdhsldq";
+  };
+
+  configureFlags = [
+    "--with-jpeg=${libjpeg.dev}"
+    "--with-zlib=${zlib.dev}"
+  ];
+  buildInputs = [ libtiff proj ];
+
+  hardeningDisable = [ "format" ];
+
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libgepub/default.nix b/nixpkgs/pkgs/development/libraries/libgepub/default.nix
new file mode 100644
index 000000000000..70ec222f88fb
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libgepub/default.nix
@@ -0,0 +1,31 @@
+{ stdenv, fetchurl, meson, ninja, pkgconfig, glib, gobject-introspection, gnome3
+, webkitgtk, libsoup, libxml2, libarchive }:
+
+stdenv.mkDerivation rec {
+  pname = "libgepub";
+  version = "0.6.0";
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    sha256 = "16dkyywqdnfngmwsgbyga0kl9vcnzczxi3lmhm27pifrq5f3k2n7";
+  };
+
+  doCheck = true;
+
+  nativeBuildInputs = [ meson ninja pkgconfig gobject-introspection ];
+  buildInputs = [ glib webkitgtk libsoup libxml2 libarchive ];
+
+  passthru = {
+    updateScript = gnome3.updateScript {
+      packageName = pname;
+      versionPolicy = "none";
+    };
+  };
+
+  meta = with stdenv.lib; {
+    description = "GObject based library for handling and rendering epub documents";
+    license = licenses.lgpl21Plus;
+    platforms = platforms.linux;
+    maintainers = gnome3.maintainers;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libgig/default.nix b/nixpkgs/pkgs/development/libraries/libgig/default.nix
new file mode 100644
index 000000000000..08fce9c521ec
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libgig/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchurl, autoconf, automake, libsndfile, libtool, pkgconfig, libuuid }:
+
+stdenv.mkDerivation rec {
+  name = "libgig-${version}";
+  version = "4.1.0";
+
+  src = fetchurl {
+    url = "https://download.linuxsampler.org/packages/${name}.tar.bz2";
+    sha256 = "02xx6bqxzgkvrawwnzrnxx1ypk244q4kpwfd58266f9ji8kq18h6";
+  };
+
+  nativeBuildInputs = [ autoconf automake libtool pkgconfig ];
+
+  buildInputs = [ libsndfile libuuid ];
+
+  preConfigure = "make -f Makefile.svn";
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    homepage = http://www.linuxsampler.org;
+    description = "Gigasampler file access library";
+    license = licenses.gpl2;
+    maintainers = [ maintainers.goibhniu ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libgit2-glib/default.nix b/nixpkgs/pkgs/development/libraries/libgit2-glib/default.nix
new file mode 100644
index 000000000000..d5edefc5d54b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libgit2-glib/default.nix
@@ -0,0 +1,48 @@
+{ stdenv, fetchurl, gnome3, meson, ninja, pkgconfig, vala, libssh2
+, gtk-doc, gobject-introspection, libgit2, glib, python3 }:
+
+stdenv.mkDerivation rec {
+  pname = "libgit2-glib";
+  version = "0.28.0.1";
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    sha256 = "0a0g7aw66rfgnqr4z7fgbk5zzcjq66m4rp8v4val3a212941h0g7";
+  };
+
+  postPatch = ''
+    for f in meson_vapi_link.py meson_python_compile.py; do
+      chmod +x $f
+      patchShebangs $f
+    done
+  '';
+
+  passthru = {
+    updateScript = gnome3.updateScript {
+      packageName = pname;
+      versionPolicy = "none";
+    };
+  };
+
+  nativeBuildInputs = [
+    meson ninja pkgconfig vala gtk-doc gobject-introspection
+  ];
+
+  propagatedBuildInputs = [
+    # Required by libgit2-glib-1.0.pc
+    libgit2 glib
+  ];
+
+  buildInputs = [
+    libssh2
+    python3.pkgs.pygobject3 # this should really be a propagated input of python output
+  ];
+
+  meta = with stdenv.lib; {
+    description = "A glib wrapper library around the libgit2 git access library";
+    homepage = https://wiki.gnome.org/Projects/Libgit2-glib;
+    license = licenses.lgpl21;
+    maintainers = gnome3.maintainers;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libgksu/default.nix b/nixpkgs/pkgs/development/libraries/libgksu/default.nix
new file mode 100644
index 000000000000..9bec00b9f52d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libgksu/default.nix
@@ -0,0 +1,87 @@
+{ stdenv, fetchurl, pkgconfig, wrapGAppsHook, gtk2, gnome2, gnome3,
+  libstartup_notification, libgtop, perlPackages,
+  autoreconfHook, intltool, docbook_xsl, xauth
+}:
+
+stdenv.mkDerivation rec {
+  version = "2.0.12";
+  pname = "libgksu";
+  name = "${pname}-${version}";
+
+  src = fetchurl {
+    url = "http://people.debian.org/~kov/gksu/${name}.tar.gz";
+    sha256 = "1brz9j3nf7l2gd3a5grbp0s3nksmlrp6rxmgp5s6gjvxcb1wzy92";
+  };
+
+  nativeBuildInputs = [
+    pkgconfig autoreconfHook intltool docbook_xsl wrapGAppsHook
+  ];
+
+  buildInputs = [
+    gtk2 gnome2.GConf libstartup_notification
+    gnome3.libgnome-keyring libgtop gnome2.libglade
+  ] ++ (with perlPackages; [ perl XMLParser ]);
+
+  enableParallelBuilding = true;
+
+  hardeningDisable = [ "format" ];
+
+  patches = [
+        # Patches from the gentoo ebuild
+
+        # Fix compilation on bsdc
+        ./libgksu-2.0.0-fbsd.patch
+
+        # Fix wrong usage of LDFLAGS, gentoo bug #226837
+        ./libgksu-2.0.7-libs.patch
+
+        # Use po/LINGUAS
+        ./libgksu-2.0.7-polinguas.patch
+
+        # Don't forkpty; gentoo bug #298289
+        ./libgksu-2.0.12-revert-forkpty.patch
+
+        # Make this gmake-3.82 compliant, gentoo bug #333961
+        ./libgksu-2.0.12-fix-make-3.82.patch
+
+        # Do not build test programs that are never executed; also fixes gentoo bug #367397 (underlinking issues).
+        ./libgksu-2.0.12-notests.patch
+
+        # Fix automake-1.11.2 compatibility, gentoo bug #397411
+        ./libgksu-2.0.12-automake-1.11.2.patch
+  ];
+
+  postPatch = ''
+    # gentoo bug #467026
+    sed -i -e 's:AM_CONFIG_HEADER:AC_CONFIG_HEADERS:' configure.ac
+
+    # Fix some binary paths
+    sed -i -e 's|/usr/bin/xauth|${xauth}/bin/xauth|g' libgksu/gksu-run-helper.c libgksu/libgksu.c
+    sed -i -e 's|/usr/bin/sudo|/run/wrappers/bin/sudo|g' libgksu/libgksu.c
+    sed -i -e 's|/bin/su\([^d]\)|/run/wrappers/bin/su\1|g' libgksu/libgksu.c
+
+    touch NEWS README
+  '';
+
+  preConfigure = ''
+    intltoolize --force --copy --automake
+  '';
+
+  configureFlags = [
+    "--disable-gtk-doc"
+  ];
+
+  meta = {
+    description = "A library for integration of su into applications";
+    longDescription = ''
+      This library comes from the gksu program. It provides a simple API
+      to use su and sudo in programs that need to execute tasks as other
+      user.  It provides X authentication facilities for running
+      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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libgksu/libgksu-2.0.0-fbsd.patch b/nixpkgs/pkgs/development/libraries/libgksu/libgksu-2.0.0-fbsd.patch
new file mode 100644
index 000000000000..5c007be5b4b4
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libgksu/libgksu-2.0.0-fbsd.patch
@@ -0,0 +1,60 @@
+diff --exclude-from=/home/dang/.diffrc -up -ruN libgksu-2.0.0.orig/libgksu/libgksu.c libgksu-2.0.0/libgksu/libgksu.c
+--- libgksu-2.0.0.orig/libgksu/libgksu.c	2006-09-14 22:35:51.000000000 -0400
++++ libgksu-2.0.0/libgksu/libgksu.c	2006-12-12 11:28:01.000000000 -0500
+@@ -23,7 +23,12 @@
+ #include <unistd.h>
+ #include <string.h>
+ #include <fcntl.h>
++#ifdef __FreeBSD__
++#include <libutil.h>
++#include <termios.h>
++#else
+ #include <pty.h>
++#endif
+ #include <pwd.h>
+ #include <sys/types.h>
+ #include <sys/wait.h>
+diff --exclude-from=/home/dang/.diffrc -up -ruN libgksu-2.0.0.orig/libgksu/Makefile.am libgksu-2.0.0/libgksu/Makefile.am
+--- libgksu-2.0.0.orig/libgksu/Makefile.am	2006-09-14 22:35:52.000000000 -0400
++++ libgksu-2.0.0/libgksu/Makefile.am	2006-12-12 11:28:01.000000000 -0500
+@@ -30,6 +30,6 @@ gksu_run_helper_SOURCES = gksu-run-helpe
+ noinst_PROGRAMS = test-gksu
+ test_gksu_SOURCES = test-gksu.c
+ test_gksu_LDADD = libgksu2.la
+-test_gksu_LDFLAGS = `pkg-config --libs glib-2.0`
++test_gksu_LDFLAGS = `pkg-config --libs glib-2.0 gthread-2.0`
+ 
+ EXTRA_DIST = libgksu.ver
+diff --exclude-from=/home/dang/.diffrc -up -ruN libgksu-2.0.0.orig/libgksu/Makefile.in libgksu-2.0.0/libgksu/Makefile.in
+--- libgksu-2.0.0.orig/libgksu/Makefile.in	2006-09-23 15:37:44.000000000 -0400
++++ libgksu-2.0.0/libgksu/Makefile.in	2006-12-12 11:30:09.000000000 -0500
+@@ -283,7 +283,7 @@ gksu_run_helper_LDFLAGS = `pkg-config --
+ gksu_run_helper_SOURCES = gksu-run-helper.c
+ test_gksu_SOURCES = test-gksu.c
+ test_gksu_LDADD = libgksu2.la
+-test_gksu_LDFLAGS = `pkg-config --libs glib-2.0`
++test_gksu_LDFLAGS = `pkg-config --libs glib-2.0 gthread-2.0`
+ EXTRA_DIST = libgksu.ver
+ all: all-am
+ 
+diff --exclude-from=/home/dang/.diffrc -up -ruN libgksu-2.0.0.orig/libgksuui/Makefile.am libgksu-2.0.0/libgksuui/Makefile.am
+--- libgksu-2.0.0.orig/libgksuui/Makefile.am	2006-09-14 22:35:31.000000000 -0400
++++ libgksu-2.0.0/libgksuui/Makefile.am	2006-12-12 11:28:01.000000000 -0500
+@@ -12,4 +12,4 @@ includedir = ${prefix}/include/$(PACKAGE
+ noinst_PROGRAMS = test-gksuui
+ test_gksuui_SOURCES = test-gksuui.c
+ test_gksuui_LDADD = libgksuui1.0.la
+-test_gksuui_LDFLAGS = `pkg-config --libs glib-2.0`
++test_gksuui_LDFLAGS = `pkg-config --libs glib-2.0 gthread-2.0`
+diff --exclude-from=/home/dang/.diffrc -up -ruN libgksu-2.0.0.orig/libgksuui/Makefile.in libgksu-2.0.0/libgksuui/Makefile.in
+--- libgksu-2.0.0.orig/libgksuui/Makefile.in	2006-09-23 15:37:44.000000000 -0400
++++ libgksu-2.0.0/libgksuui/Makefile.in	2006-12-12 11:30:22.000000000 -0500
+@@ -250,7 +250,7 @@ libgksuui1_0_la_LDFLAGS = -Wl,-O1 `pkg-c
+ noinst_HEADERS = defines.h gksuui.h gksuui-dialog.h
+ test_gksuui_SOURCES = test-gksuui.c
+ test_gksuui_LDADD = libgksuui1.0.la
+-test_gksuui_LDFLAGS = `pkg-config --libs glib-2.0`
++test_gksuui_LDFLAGS = `pkg-config --libs glib-2.0 gthread-2.0`
+ all: all-am
+ 
+ .SUFFIXES:
diff --git a/nixpkgs/pkgs/development/libraries/libgksu/libgksu-2.0.12-automake-1.11.2.patch b/nixpkgs/pkgs/development/libraries/libgksu/libgksu-2.0.12-automake-1.11.2.patch
new file mode 100644
index 000000000000..0f22166fb8b7
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libgksu/libgksu-2.0.12-automake-1.11.2.patch
@@ -0,0 +1,25 @@
+Due to the following change, pkglib_PROGRAMS is invalid:
+    http://git.savannah.gnu.org/cgit/automake.git/commit/?id=9ca632642b006ac6b0fc4ce0ae5b34023faa8cbf
+
+https://savannah.nongnu.org/bugs/index.php?35241
+https://bugs.gentoo.org/show_bug.cgi?id=397411
+
+---
+ libgksu/Makefile.am |    4 ++--
+ 1 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/libgksu/Makefile.am b/libgksu/Makefile.am
+index 49362f9..3cb1090 100644
+--- a/libgksu/Makefile.am
++++ b/libgksu/Makefile.am
+@@ -22,8 +22,8 @@ includedir = ${prefix}/include/${PACKAGE}
+ pkgconfigdir = ${libdir}/pkgconfig
+ pkgconfig_DATA = libgksu2.pc
+ 
+-pkglibdir = ${libdir}/${PACKAGE}
+-pkglib_PROGRAMS = gksu-run-helper
++gksulibdir = ${libdir}/${PACKAGE}
++gksulib_PROGRAMS = gksu-run-helper
+ gksu_run_helper_LDADD = ${GLIB_LIBS} 
+ gksu_run_helper_SOURCES = gksu-run-helper.c
+ 
diff --git a/nixpkgs/pkgs/development/libraries/libgksu/libgksu-2.0.12-fix-make-3.82.patch b/nixpkgs/pkgs/development/libraries/libgksu/libgksu-2.0.12-fix-make-3.82.patch
new file mode 100644
index 000000000000..dd52b8247fa4
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libgksu/libgksu-2.0.12-fix-make-3.82.patch
@@ -0,0 +1,19 @@
+--- libgksu/Makefile.am-orig	2010-08-22 16:11:19.872577459 -0500
++++ libgksu/Makefile.am	2010-08-22 16:11:55.289599110 -0500
+@@ -17,11 +17,11 @@
+ 
+ if GCONF_SCHEMAS_INSTALL
+ install-data-local:
+-        if test -z "$(DESTDIR)" ; then \
+-          for p in $(schemas_DATA) ; do \
+-            GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) $(GCONFTOOL) --makefile-install-rule $(srcdir)/$$p ; \
+-          done \
+-        fi
++	if test -z "$(DESTDIR)" ; then \
++		for p in $(schemas_DATA) ; do \
++			GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) $(GCONFTOOL) --makefile-install-rule $(srcdir)/$$p ; \
++		done \
++	fi
+ else
+ install-data-local:
+ endif
diff --git a/nixpkgs/pkgs/development/libraries/libgksu/libgksu-2.0.12-notests.patch b/nixpkgs/pkgs/development/libraries/libgksu/libgksu-2.0.12-notests.patch
new file mode 100644
index 000000000000..3787ef6bfc13
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libgksu/libgksu-2.0.12-notests.patch
@@ -0,0 +1,26 @@
+Index: libgksu-2.0.12/libgksu/Makefile.am
+===================================================================
+--- libgksu-2.0.12.orig/libgksu/Makefile.am
++++ libgksu-2.0.12/libgksu/Makefile.am
+@@ -27,7 +27,7 @@ pkglib_PROGRAMS = gksu-run-helper
+ gksu_run_helper_LDFLAGS = `pkg-config --libs glib-2.0`
+ gksu_run_helper_SOURCES = gksu-run-helper.c
+ 
+-noinst_PROGRAMS = test-gksu
++EXTRA_PROGRAMS = test-gksu
+ test_gksu_SOURCES = test-gksu.c
+ test_gksu_LDADD = libgksu2.la
+ test_gksu_LDFLAGS = `pkg-config --libs glib-2.0`
+Index: libgksu-2.0.12/libgksuui/Makefile.am
+===================================================================
+--- libgksu-2.0.12.orig/libgksuui/Makefile.am
++++ libgksu-2.0.12/libgksuui/Makefile.am
+@@ -9,7 +9,7 @@ libgksuui1_0_la_LDFLAGS = -Wl,-O1 `pkg-c
+ noinst_HEADERS = defines.h gksuui.h gksuui-dialog.h
+ includedir = ${prefix}/include/$(PACKAGE)
+ 
+-noinst_PROGRAMS = test-gksuui
++EXTRA_PROGRAMS = test-gksuui
+ test_gksuui_SOURCES = test-gksuui.c
+ test_gksuui_LDADD = libgksuui1.0.la
+ test_gksuui_LDFLAGS = `pkg-config --libs glib-2.0`
diff --git a/nixpkgs/pkgs/development/libraries/libgksu/libgksu-2.0.12-revert-forkpty.patch b/nixpkgs/pkgs/development/libraries/libgksu/libgksu-2.0.12-revert-forkpty.patch
new file mode 100644
index 000000000000..2c3a8cc786bb
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libgksu/libgksu-2.0.12-revert-forkpty.patch
@@ -0,0 +1,359 @@
+diff --exclude-from=/home/dang/.scripts/diffrc -up -ruN libgksu-2.0.12.orig/libgksu/libgksu.c libgksu-2.0.12/libgksu/libgksu.c
+--- libgksu-2.0.12.orig/libgksu/libgksu.c	2009-06-29 13:48:24.000000000 -0400
++++ libgksu-2.0.12/libgksu/libgksu.c	2010-01-12 07:32:10.450657456 -0500
+@@ -1,7 +1,6 @@
+ /*
+  * Gksu -- a library providing access to su functionality
+  * Copyright (C) 2004-2009 Gustavo Noronha Silva
+- * Portions Copyright (C) 2009 VMware, Inc.
+  *
+  * This library is free software; you can redistribute it and/or
+  * modify it under the terms of the GNU Lesser General Public
+@@ -56,9 +55,6 @@
+ static void
+ gksu_context_launch_complete (GksuContext *context);
+ 
+-static void
+-read_line (int fd, gchar *buffer, int n);
+-
+ GType
+ gksu_error_get_type (void)
+ {
+@@ -2009,8 +2005,6 @@ gksu_su_fuller (GksuContext *context,
+       for (i = 0 ; cmd[i] != NULL ; i++)
+ 	g_free (cmd[i]);
+       g_free(cmd);
+-
+-      _exit(1);
+     }
+   else if (pid == -1)
+     {
+@@ -2125,10 +2119,10 @@ gksu_su_fuller (GksuContext *context,
+ 	  /* drop the \n echoed on password entry if su did request
+ 	     a password */
+ 	  if (password_needed)
+-	    read_line (fdpty, buf, 255);
++	    read (fdpty, buf, 255);
+ 	  if (context->debug)
+ 	    fprintf (stderr, "DEBUG (run:post-after-pass) buf: -%s-\n", buf);
+-	  read_line (fdpty, buf, 255);
++	  read (fdpty, buf, 255);
+ 	  if (context->debug)
+ 	    fprintf (stderr, "DEBUG (run:post-after-pass) buf: -%s-\n", buf);
+ 	}
+@@ -2142,9 +2136,7 @@ gksu_su_fuller (GksuContext *context,
+ 	{
+ 	  int retval = 0;
+ 
+-	  /* Red Hat's su shows the full path to su in its error messages. */
+-	  if (!strncmp (buf, "su:", 3) ||
+-	      !strncmp (buf, "/bin/su:", 7))
++	  if (!strncmp (buf, "su", 2))
+ 	    {
+ 	      gchar **strings;
+ 
+@@ -2155,11 +2147,7 @@ gksu_su_fuller (GksuContext *context,
+ 		}
+ 
+ 	      strings = g_strsplit (buf, ":", 2);
+-
+-	      /* Red Hat and Fedora use 'incorrect password'. */
+-	      if (strings[1] &&
+-	          (g_str_has_prefix(strings[1], " Authentication failure") ||
+-	           g_str_has_prefix(strings[1], " incorrect password")))
++	      if (strings[1] && !strncmp (strings[1], " Authentication failure", 23))
+ 		{
+ 		  if (used_gnome_keyring)
+ 		    g_set_error (error, gksu_quark,
+@@ -2473,12 +2461,6 @@ gksu_sudo_fuller (GksuContext *context,
+ {
+   char **cmd;
+   char buffer[256] = {0};
+-  char *child_stderr = NULL;
+-  /* This command is used to gain a token */
+-  char *const verifycmd[] =
+-    {
+-      "/usr/bin/sudo", "-p", "GNOME_SUDO_PASS", "-v", NULL
+-    };
+   int argcount = 8;
+   int i, j;
+ 
+@@ -2489,8 +2471,9 @@ gksu_sudo_fuller (GksuContext *context,
+ 
+   pid_t pid;
+   int status;
+-  FILE *fdfile = NULL;
+-  int fdpty = -1;
++  FILE *infile, *outfile;
++  int parent_pipe[2];	/* For talking to the parent */
++  int child_pipe[2];	/* For talking to the child */
+ 
+   context->sudo_mode = TRUE;
+ 
+@@ -2565,10 +2548,6 @@ gksu_sudo_fuller (GksuContext *context,
+   cmd[argcount] = g_strdup("-S");
+   argcount++;
+ 
+-  /* Make sudo noninteractive (we should already have a token) */
+-  cmd[argcount] = g_strdup("-n");
+-  argcount++;
+-
+   /* Make sudo use next arg as prompt */
+   cmd[argcount] = g_strdup("-p");
+   argcount++;
+@@ -2647,21 +2626,26 @@ gksu_sudo_fuller (GksuContext *context,
+ 	fprintf (stderr, "cmd[%d]: %s\n", i, cmd[i]);
+     }
+ 
+-  pid = forkpty(&fdpty, NULL, NULL, NULL);
+-  if (pid == 0)
++  if ((pipe(parent_pipe)) == -1)
+     {
+-      // Child
+-      setsid();   // make us session leader
+-
+-      execv(verifycmd[0], verifycmd);
++      g_set_error (error, gksu_quark, GKSU_ERROR_PIPE,
++		   _("Error creating pipe: %s"),
++		   strerror(errno));
++      sudo_reset_xauth (context, xauth, xauth_env);
++      return FALSE;
++    }
+ 
+-      g_set_error (error, gksu_quark, GKSU_ERROR_EXEC,
+-		   _("Failed to exec new process: %s"),
++  if ((pipe(child_pipe)) == -1)
++    {
++      g_set_error (error, gksu_quark, GKSU_ERROR_PIPE,
++		   _("Error creating pipe: %s"),
+ 		   strerror(errno));
+       sudo_reset_xauth (context, xauth, xauth_env);
+       return FALSE;
+     }
+-  else if (pid == -1)
++
++  pid = fork();
++  if (pid == -1)
+     {
+       g_set_error (error, gksu_quark, GKSU_ERROR_FORK,
+ 		   _("Failed to fork new process: %s"),
+@@ -2669,26 +2653,56 @@ gksu_sudo_fuller (GksuContext *context,
+       sudo_reset_xauth (context, xauth, xauth_env);
+       return FALSE;
+     }
++  else if (pid == 0)
++    {
++      // Child
++      setsid();   // make us session leader
++      close(child_pipe[1]);
++      dup2(child_pipe[0], STDIN_FILENO);
++      dup2(parent_pipe[1], STDERR_FILENO);
+ 
++      execv(cmd[0], cmd);
++
++      g_set_error (error, gksu_quark, GKSU_ERROR_EXEC,
++		   _("Failed to exec new process: %s"),
++		   strerror(errno));
++      sudo_reset_xauth (context, xauth, xauth_env);
++      return FALSE;
++    }
+   else
+     {
+       gint counter = 0;
+       gchar *cmdline = NULL;
+-      struct termios tio;
+ 
+       // Parent
+-      fdfile = fdopen(fdpty, "w+");
++      close(parent_pipe[1]);
+ 
+-      /* make sure we notice that ECHO is turned off, if it gets
+-         turned off */
+-      tcgetattr (fdpty, &tio);
+-      for (counter = 0; (tio.c_lflag & ECHO) && counter < 15; counter++)
+-      {
+-        usleep (1000);
+-        tcgetattr (fdpty, &tio);
+-      }
++      infile = fdopen(parent_pipe[0], "r");
++      if (!infile)
++	{
++	  g_set_error (error, gksu_quark, GKSU_ERROR_PIPE,
++		       _("Error opening pipe: %s"),
++		       strerror(errno));
++	  sudo_reset_xauth (context, xauth, xauth_env);
++	  return FALSE;
++	}
+ 
+-      fcntl (fdpty, F_SETFL, O_NONBLOCK);
++      outfile = fdopen(child_pipe[1], "w");
++      if (!outfile)
++	{
++	  g_set_error (error, gksu_quark, GKSU_ERROR_PIPE,
++		       _("Error opening pipe: %s"),
++		       strerror(errno));
++	  sudo_reset_xauth (context, xauth, xauth_env);
++	  return FALSE;
++	}
++
++      /*
++	we are expecting to receive a GNOME_SUDO_PASS
++	if we don't there are two possibilities: an error
++	or a password is not needed
++      */
++      fcntl (parent_pipe[0], F_SETFL, O_NONBLOCK);
+ 
+       { /* no matter if we can read, since we're using
+ 	   O_NONBLOCK; this is just to avoid the prompt
+@@ -2697,11 +2711,11 @@ gksu_sudo_fuller (GksuContext *context,
+ 	struct timeval tv;
+ 
+ 	FD_ZERO(&rfds);
+-	FD_SET(fdpty, &rfds);
++	FD_SET(parent_pipe[0], &rfds);
+ 	tv.tv_sec = 1;
+ 	tv.tv_usec = 0;
+ 
+-	select (fdpty + 1, &rfds, NULL, NULL, &tv);
++	select (parent_pipe[0] + 1, &rfds, NULL, NULL, &tv);
+       }
+ 
+       /* Try hard to find the prompt; it may happen that we're
+@@ -2713,7 +2727,7 @@ gksu_sudo_fuller (GksuContext *context,
+ 	  if (strncmp (buffer, "GNOME_SUDO_PASS", 15) == 0)
+ 	    break;
+ 
+-	  read_line (fdpty, buffer, 256);
++	  read_line (parent_pipe[0], buffer, 256);
+ 
+ 	  if (context->debug)
+ 	    fprintf (stderr, "buffer: -%s-\n", buffer);
+@@ -2747,17 +2761,18 @@ gksu_sudo_fuller (GksuContext *context,
+ 
+ 	  usleep (1000);
+ 
+-	  write (fdpty, password, strlen(password) + 1);
+-	  write (fdpty, "\n", 1);
++	  fprintf (outfile, "%s\n", password);
++	  fclose (outfile);
+ 
+ 	  nullify_password (password);
+ 
+-	  fcntl(fdpty, F_SETFL, fcntl(fdpty, F_GETFL) & ~O_NONBLOCK);
++	  /* turn NONBLOCK off */
++	  fcntl(parent_pipe[0], F_SETFL, fcntl(parent_pipe[0], F_GETFL) & ~O_NONBLOCK);
+ 	  /* ignore the first newline that comes right after sudo receives
+ 	     the password */
+-	  fgets (buffer, 255, fdfile);
+-	  /* this is the status we are interested in */
+-	  fgets (buffer, 255, fdfile);
++	  fgets (buffer, 255, infile);
++	  /* this is the status we are interessted in */
++	  fgets (buffer, 255, infile);
+ 	}
+       else
+ 	{
+@@ -2766,7 +2781,7 @@ gksu_sudo_fuller (GksuContext *context,
+ 	    fprintf (stderr, "No password prompt found; we'll assume we don't need a password.\n");
+ 
+           /* turn NONBLOCK off, also if have no prompt */
+-          fcntl(fdpty, F_SETFL, fcntl(fdpty, F_GETFL) & ~O_NONBLOCK);
++          fcntl(parent_pipe[0], F_SETFL, fcntl(parent_pipe[0], F_GETFL) & ~O_NONBLOCK);
+ 
+ 	  should_display = gconf_client_get_bool (context->gconf_client,
+ 						  BASE_PATH "display-no-pass-info", NULL);
+@@ -2785,9 +2800,14 @@ gksu_sudo_fuller (GksuContext *context,
+ 	  fprintf (stderr, "%s", buffer);
+ 	}
+ 
+-      if (g_str_has_prefix (buffer, "Sorry, try again."))
++      if (!strcmp (buffer, "Sorry, try again.\n"))
+ 	g_set_error (error, gksu_quark, GKSU_ERROR_WRONGPASS,
+ 		     _("Wrong password."));
++      else if (!strncmp (buffer, "Sorry, user ", 12))
++	g_set_error (error, gksu_quark, GKSU_ERROR_NOT_ALLOWED,
++		     _("The underlying authorization mechanism (sudo) "
++		       "does not allow you to run this program. Contact "
++		       "the system administrator."));
+       else
+ 	{
+ 	  gchar *haystack = buffer;
+@@ -2805,10 +2825,6 @@ gksu_sudo_fuller (GksuContext *context,
+ 	    }
+ 	}
+ 
+-      /* If we have an error, let's just stop sudo right there. */
+-      if (error)
+-        close(fdpty);
+-
+       cmdline = g_strdup("sudo");
+       /* wait for the child process to end or become something other
+ 	 than sudo */
+@@ -2825,23 +2841,17 @@ gksu_sudo_fuller (GksuContext *context,
+       if (context->sn_context)
+ 	gksu_context_launch_complete (context);
+ 
++      while (read (parent_pipe[0], buffer, 255) > 0)
++	{
++	  fprintf (stderr, "%s", buffer);
++	  bzero(buffer, 256);
++	}
++
+       /* if the process is still active waitpid() on it */
+       if (pid_exited != pid)
+ 	waitpid(pid, &status, 0);
+       sudo_reset_xauth (context, xauth, xauth_env);
+ 
+-      /*
+-       * Did token acquisition succeed? If so, spawn sudo in
+-       * non-interactive mode. It should either succeed or die
+-       * immediately if you're not allowed to run the command.
+-       */
+-      if (WEXITSTATUS(status) == 0)
+-        {
+-          g_spawn_sync(NULL, cmd, NULL, 0, NULL, NULL,
+-                       NULL, &child_stderr, &status,
+-                       error);
+-        }
+-
+       if (exit_status)
+       {
+       	if (WIFEXITED(status)) {
+@@ -2853,13 +2863,6 @@ gksu_sudo_fuller (GksuContext *context,
+ 
+       if (WEXITSTATUS(status))
+ 	{
+-          if (g_str_has_prefix(child_stderr, "Sorry, user "))
+-            {
+-              g_set_error (error, gksu_quark, GKSU_ERROR_NOT_ALLOWED,
+-                           _("The underlying authorization mechanism (sudo) "
+-                             "does not allow you to run this program. Contact "
+-                             "the system administrator."));
+-            }
+ 	  if(cmdline)
+ 	    {
+ 	      /* sudo already exec()ed something else, don't report
+@@ -2868,7 +2871,6 @@ gksu_sudo_fuller (GksuContext *context,
+ 	      if (!g_str_has_suffix (cmdline, "sudo"))
+ 		{
+ 		  g_free (cmdline);
+-		  g_free (child_stderr);
+ 		  return FALSE;
+ 		}
+ 	      g_free (cmdline);
+@@ -2881,11 +2883,11 @@ gksu_sudo_fuller (GksuContext *context,
+ 	}
+     }
+ 
+-  fprintf(stderr, child_stderr);
+-  g_free(child_stderr);
+-
+   /* if error is set we have found an error condition */
+-  return (error == NULL);
++  if (error)
++    return FALSE;
++
++  return TRUE;
+ }
+ 
+ /**
diff --git a/nixpkgs/pkgs/development/libraries/libgksu/libgksu-2.0.7-libs.patch b/nixpkgs/pkgs/development/libraries/libgksu/libgksu-2.0.7-libs.patch
new file mode 100644
index 000000000000..b9fb77f27147
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libgksu/libgksu-2.0.7-libs.patch
@@ -0,0 +1,76 @@
+# https://savannah.nongnu.org/bugs/?25362
+# https://bugs.gentoo.org/show_bug.cgi?id=226837
+diff -Nura a/configure.ac b/configure.ac
+--- a/configure.ac	2009-01-19 22:15:30.000000000 +0100
++++ b/configure.ac	2009-01-19 22:18:10.000000000 +0100
+@@ -43,6 +43,9 @@
+ PKG_CHECK_MODULES(LIBGKSU, [gtk+-2.0 >= 2.4.0, gconf-2.0, libstartup-notification-1.0, gnome-keyring-1, libgtop-2.0])
+ PKG_CHECK_MODULES(GKSU_PROPERTIES, [gtk+-2.0 >= 2.4.0, gconf-2.0, libglade-2.0])
+ 
++PKG_CHECK_MODULES(GLIB, [glib-2.0 gthread-2.0])
++PKG_CHECK_MODULES(GTK, [gtk+-2.0 gconf-2.0])
++
+ # Checks for library functions.
+ ALL_LINGUAS="ca cs da de es eu fr hu it ko lt pl pt_BR ro ru sk sv nb nl zh_CN"
+ 
+diff -Nura a/gksu-properties/Makefile.am b/gksu-properties/Makefile.am
+--- a/gksu-properties/Makefile.am	2009-01-19 22:15:59.000000000 +0100
++++ b/gksu-properties/Makefile.am	2009-01-19 22:19:13.000000000 +0100
+@@ -3,7 +3,7 @@
+ AM_CPPFLAGS = -DLOCALEDIR=\"$(datadir)/locale\" -DDATA_DIR=\"$(datadir)\" -DPREFIX=\"$(prefix)\"
+ 
+ bin_PROGRAMS = gksu-properties
+-gksu_properties_LDFLAGS = ${GKSU_PROPERTIES_LIBS}
++gksu_properties_LDADD = ${GKSU_PROPERTIES_LIBS}
+ gksu_properties_SOURCES = gksu-properties.c
+ 
+ gladedir = ${prefix}/share/${PACKAGE}
+diff -Nura a/libgksu/Makefile.am b/libgksu/Makefile.am
+--- a/libgksu/Makefile.am	2009-01-19 22:15:59.000000000 +0100
++++ b/libgksu/Makefile.am	2009-01-19 22:18:25.000000000 +0100
+@@ -8,8 +8,8 @@
+ # major -> breaks backward compatibility (changes to existing ABI)
+ # minor -> keeps compatibility (additions to the API)
+ # micro -> no change to the API/ABI
+-libgksu2_la_LIBADD = ../libgksuui/libgksuui1.0.la
+-libgksu2_la_LDFLAGS = -version-info 0:2:0 -Wl,-O1 -lutil ${LIBGKSU_LIBS}
++libgksu2_la_LIBADD = ../libgksuui/libgksuui1.0.la -lutil ${LIBGKSU_LIBS}
++libgksu2_la_LDFLAGS = -version-info 0:2:0 -Wl,-O1
+ if USE_VERSION_SCRIPT
+ libgksu2_la_LDFLAGS += -Wl,--version-script=libgksu.ver
+ endif
+@@ -24,12 +24,11 @@
+ 
+ pkglibdir = ${libdir}/${PACKAGE}
+ pkglib_PROGRAMS = gksu-run-helper
+-gksu_run_helper_LDFLAGS = `pkg-config --libs glib-2.0`
++gksu_run_helper_LDADD = ${GLIB_LIBS} 
+ gksu_run_helper_SOURCES = gksu-run-helper.c
+ 
+ noinst_PROGRAMS = test-gksu
+ test_gksu_SOURCES = test-gksu.c
+-test_gksu_LDADD = libgksu2.la
+-test_gksu_LDFLAGS = `pkg-config --libs glib-2.0 gthread-2.0`
++test_gksu_LDADD = libgksu2.la ${GLIB_LIBS}
+ 
+ EXTRA_DIST = libgksu.ver
+diff -Nura a/libgksuui/Makefile.am b/libgksuui/Makefile.am
+--- a/libgksuui/Makefile.am	2009-01-19 22:15:59.000000000 +0100
++++ b/libgksuui/Makefile.am	2009-01-19 22:18:54.000000000 +0100
+@@ -4,12 +4,13 @@
+ 
+ noinst_LTLIBRARIES = libgksuui1.0.la
+ libgksuui1_0_la_SOURCES = gksuui-dialog.c
+-libgksuui1_0_la_LDFLAGS = -Wl,-O1 `pkg-config --libs gtk+-2.0 gconf-2.0`
++libgksuui1_0_la_LDFLAGS = -Wl,-O1
++libgksuui1_0_la_LIBADD = ${GTK_LIBS}
+ 
+ noinst_HEADERS = defines.h gksuui.h gksuui-dialog.h
+ includedir = ${prefix}/include/$(PACKAGE)
+ 
+ noinst_PROGRAMS = test-gksuui
+ test_gksuui_SOURCES = test-gksuui.c
+-test_gksuui_LDADD = libgksuui1.0.la
+-test_gksuui_LDFLAGS = `pkg-config --libs glib-2.0 gthread-2.0`
++test_gksuui_LDADD = libgksuui1.0.la ${GLIB_LIBS}
++
diff --git a/nixpkgs/pkgs/development/libraries/libgksu/libgksu-2.0.7-polinguas.patch b/nixpkgs/pkgs/development/libraries/libgksu/libgksu-2.0.7-polinguas.patch
new file mode 100644
index 000000000000..e423af16b44c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libgksu/libgksu-2.0.7-polinguas.patch
@@ -0,0 +1,40 @@
+# https://savannah.nongnu.org/bugs/?25360
+diff -Nura a/configure.ac b/configure.ac
+--- a/configure.ac	2009-01-19 21:50:57.000000000 +0100
++++ b/configure.ac	2009-01-19 21:53:21.000000000 +0100
+@@ -50,7 +50,7 @@
+ GETTEXT_PACKAGE=AC_PACKAGE_NAME
+ AC_SUBST(GETTEXT_PACKAGE)
+ 
+-IT_PROG_INTLTOOL
++IT_PROG_INTLTOOL([0.35.5])
+ AM_GLIB_GNU_GETTEXT
+ 
+ ##################################################
+diff -Nura a/po/LINGUAS b/po/LINGUAS
+--- a/po/LINGUAS	1970-01-01 01:00:00.000000000 +0100
++++ b/po/LINGUAS	2009-01-19 21:54:24.000000000 +0100
+@@ -0,0 +1,23 @@
++# please keep this list sorted alphabetically
++# http://live.gnome.org/GnomeGoals/PoLinguas
++#
++ca
++cs
++da
++de
++es
++eu
++fr
++hu
++it
++ko
++lt
++pl
++pt_BR
++ro
++ru
++sk
++sv
++nb
++nl
++zh_CN
diff --git a/nixpkgs/pkgs/development/libraries/libglvnd/default.nix b/nixpkgs/pkgs/development/libraries/libglvnd/default.nix
new file mode 100644
index 000000000000..62c6b45c5d45
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libglvnd/default.nix
@@ -0,0 +1,60 @@
+{ stdenv, lib, fetchFromGitHub, fetchpatch, autoreconfHook, python2, pkgconfig, libX11, libXext, xorgproto, addOpenGLRunpath }:
+
+stdenv.mkDerivation rec {
+  name = "libglvnd-${version}";
+  version = "1.0.0";
+
+  src = fetchFromGitHub {
+    owner = "NVIDIA";
+    repo = "libglvnd";
+    rev = "v${version}";
+    sha256 = "1a126lzhd2f04zr3rvdl6814lfl0j077spi5dsf2alghgykn5iif";
+  };
+
+  nativeBuildInputs = [ autoreconfHook pkgconfig python2 addOpenGLRunpath ];
+  buildInputs = [ libX11 libXext xorgproto ];
+
+  postPatch = lib.optionalString stdenv.isDarwin ''
+    substituteInPlace src/GLX/Makefile.am \
+      --replace "-Wl,-Bsymbolic " ""
+    substituteInPlace src/EGL/Makefile.am \
+      --replace "-Wl,-Bsymbolic " ""
+  '';
+
+  NIX_CFLAGS_COMPILE = [
+    "-UDEFAULT_EGL_VENDOR_CONFIG_DIRS"
+    # FHS paths are added so that non-NixOS applications can find vendor files.
+    "-DDEFAULT_EGL_VENDOR_CONFIG_DIRS=\"${addOpenGLRunpath.driverLink}/share/glvnd/egl_vendor.d:/etc/glvnd/egl_vendor.d:/usr/share/glvnd/egl_vendor.d\""
+  ] ++ 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";
+
+  # Upstream patch fixing use of libdl, should be in next release.
+  patches = [
+    (fetchpatch {
+      url = "https://github.com/NVIDIA/libglvnd/commit/0177ade40262e31a80608a8e8e52d3da7163dccf.patch";
+      sha256 = "1rnz5jw2gvx4i1lcp0k85jz9xgr3dgzsd583m2dlxkaf2a09j89d";
+    })
+  ] ++ stdenv.lib.optional stdenv.isDarwin
+    (fetchpatch {
+      url = "https://github.com/NVIDIA/libglvnd/commit/294ccb2f49107432567e116e13efac586580a4cc.patch";
+      sha256 = "01339wg27cypv93221rhk3885vxbsg8kvbfyia77jmjdcnwrdwm2";
+    });
+  outputs = [ "out" "dev" ];
+
+  # Set RUNPATH so that driver libraries in /run/opengl-driver(-32)/lib can be found.
+  # See the explanation in addOpenGLRunpath.
+  postFixup = ''
+    addOpenGLRunpath $out/lib/libGLX.so $out/lib/libEGL.so
+  '';
+
+  passthru = { inherit (addOpenGLRunpath) driverLink; };
+
+  meta = with stdenv.lib; {
+    description = "The GL Vendor-Neutral Dispatch library";
+    homepage = https://github.com/NVIDIA/libglvnd;
+    license = licenses.bsd2;
+    platforms = platforms.linux ++ platforms.darwin;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libgnome-keyring/default.nix b/nixpkgs/pkgs/development/libraries/libgnome-keyring/default.nix
new file mode 100644
index 000000000000..33a6a075ae44
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libgnome-keyring/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, fetchurl, glib, dbus, libgcrypt, pkgconfig, 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";
+    sha256 = "030gka96kzqg1r19b4xrmac89hf1xj1kr5p461yvbzfxh46qqf2n";
+  };
+
+  outputs = [ "out" "dev" ];
+
+  propagatedBuildInputs = [ glib dbus libgcrypt ];
+  nativeBuildInputs = [ pkgconfig intltool ];
+
+  meta = {
+    inherit (glib.meta) platforms maintainers;
+    homepage = "https://wiki.gnome.org/Projects/GnomeKeyring";
+    license = with stdenv.lib.licenses; [ gpl2 lgpl2 ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libgnomekbd/default.nix b/nixpkgs/pkgs/development/libraries/libgnomekbd/default.nix
new file mode 100644
index 000000000000..0951ab1fe0c0
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libgnomekbd/default.nix
@@ -0,0 +1,30 @@
+{ stdenv, fetchurl, pkgconfig, file, intltool, glib, gtk3, libxklavier, makeWrapper, gnome3 }:
+
+stdenv.mkDerivation rec {
+  pname = "libgnomekbd";
+  version = "3.26.1";
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    sha256 = "0y962ykn3rr9gylj0pwpww7bi20lmhvsw6qvxs5bisbn2mih5jpp";
+  };
+
+  passthru = {
+    updateScript = gnome3.updateScript { packageName = pname; };
+  };
+
+  nativeBuildInputs = [ pkgconfig file intltool makeWrapper ];
+  buildInputs = [ glib gtk3 libxklavier ];
+
+  preFixup = ''
+    wrapProgram $out/bin/gkbd-keyboard-display \
+      --prefix XDG_DATA_DIRS : "$GSETTINGS_SCHEMAS_PATH"
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Keyboard management library";
+    maintainers = gnome3.maintainers;
+    license = licenses.gpl2;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libgnurl/default.nix b/nixpkgs/pkgs/development/libraries/libgnurl/default.nix
new file mode 100644
index 000000000000..e87f535a1f74
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libgnurl/default.nix
@@ -0,0 +1,31 @@
+{ stdenv, fetchurl, libtool, groff, perl, pkgconfig, python2, zlib, gnutls,
+  libidn2, libunistring, nghttp2 }:
+
+stdenv.mkDerivation rec {
+  version = "7.64.0";
+
+  name = "libgnurl-${version}";
+
+  src = fetchurl {
+    url = "mirror://gnu/gnunet/gnurl-${version}.tar.gz";
+    sha256 = "0pvmbi32lixcpk10prplmwrmi4wzp3bc1aiyhr552kx0wqdqmdk8";
+  };
+
+  nativeBuildInputs = [ libtool groff perl pkgconfig python2 ];
+    
+  buildInputs = [ gnutls zlib libidn2 libunistring nghttp2 ];
+
+  configureFlags = [
+    "--disable-ntlm-wb"
+    "--without-ca-bundle"
+    "--with-ca-fallback"
+  ];
+
+  meta = with stdenv.lib; {
+    description = "A fork of libcurl used by GNUnet";
+    homepage    = https://gnunet.org/gnurl;
+    maintainers = with maintainers; [ falsifian vrthra ];
+    platforms = platforms.linux;
+    license = licenses.curl;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libgpg-error/default.nix b/nixpkgs/pkgs/development/libraries/libgpg-error/default.nix
new file mode 100644
index 000000000000..dc221156f461
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libgpg-error/default.nix
@@ -0,0 +1,72 @@
+{ stdenv, lib, fetchpatch, buildPackages, fetchurl, gettext
+, genPosixLockObjOnly ? false
+}: let
+  genPosixLockObjOnlyAttrs = lib.optionalAttrs genPosixLockObjOnly {
+    buildPhase = ''
+      cd src
+      make gen-posix-lock-obj
+    '';
+
+    installPhase = ''
+      mkdir -p $out/bin
+      install -m755 gen-posix-lock-obj $out/bin
+    '';
+
+    outputs = [ "out" ];
+    outputBin = "out";
+  };
+in stdenv.mkDerivation (rec {
+  pname = "libgpg-error";
+  version = "1.36";
+
+  src = fetchurl {
+    url = "mirror://gnupg/${pname}/${pname}-${version}.tar.bz2";
+    sha256 = "0z696dmhfxm2n6pmr8b857wwljq9h633yi99bhbn7h88f91rigds";
+  };
+
+  postPatch = ''
+    sed '/BUILD_TIMESTAMP=/s/=.*/=1970-01-01T00:01+0000/' -i ./configure
+  '' + lib.optionalString (stdenv.hostPlatform.isAarch32 && stdenv.buildPlatform != stdenv.hostPlatform) ''
+    ln -s lock-obj-pub.arm-unknown-linux-gnueabi.h src/syscfg/lock-obj-pub.linux-gnueabihf.h
+  '' + lib.optionalString (stdenv.hostPlatform.isx86_64 && stdenv.hostPlatform.isMusl) ''
+    ln -s lock-obj-pub.x86_64-pc-linux-musl.h src/syscfg/lock-obj-pub.linux-musl.h
+  '' + lib.optionalString (stdenv.hostPlatform.isAarch32 && stdenv.hostPlatform.isMusl) ''
+    ln -s src/syscfg/lock-obj-pub.arm-unknown-linux-gnueabi.h src/syscfg/lock-obj-pub.arm-unknown-linux-musleabihf.h
+    ln -s src/syscfg/lock-obj-pub.arm-unknown-linux-gnueabi.h src/syscfg/lock-obj-pub.linux-musleabihf.h
+  '';
+
+  outputs = [ "out" "dev" "info" ];
+  outputBin = "dev"; # deps want just the lib, most likely
+
+  # If architecture-dependent MO files aren't available, they're generated
+  # during build, so we need gettext for cross-builds.
+  depsBuildBuild = [ buildPackages.stdenv.cc ];
+  nativeBuildInputs = [ gettext ];
+
+  postConfigure =
+    lib.optionalString stdenv.isSunOS
+    # For some reason, /bin/sh on OpenIndiana leads to this at the end of the
+    # `config.status' run:
+    #   ./config.status[1401]: shift: (null): bad number
+    # (See <http://hydra.nixos.org/build/2931046/nixlog/1/raw>.)
+    # Thus, re-run it with Bash.
+      "${stdenv.shell} config.status";
+
+  doCheck = true; # not cross
+
+  meta = with stdenv.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";
+
+    longDescription = ''
+      Libgpg-error is a small library that defines common error values
+      for all GnuPG components.  Among these are GPG, GPGSM, GPGME,
+      GPG-Agent, libgcrypt, Libksba, DirMngr, Pinentry, SmartCard
+      Daemon and possibly more in the future.
+    '';
+
+    license = licenses.lgpl2Plus;
+    platforms = platforms.all;
+    maintainers = [ maintainers.fuuzetsu maintainers.vrthra ];
+  };
+} // genPosixLockObjOnlyAttrs)
diff --git a/nixpkgs/pkgs/development/libraries/libgphoto2/default.nix b/nixpkgs/pkgs/development/libraries/libgphoto2/default.nix
new file mode 100644
index 000000000000..8616a0146755
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libgphoto2/default.nix
@@ -0,0 +1,43 @@
+{ stdenv, fetchFromGitHub, pkgconfig, libusb1, libtool, libexif, libjpeg, gettext, autoreconfHook }:
+
+stdenv.mkDerivation rec {
+  name = "libgphoto2-${meta.version}";
+
+  src = fetchFromGitHub {
+    owner = "gphoto";
+    repo = "libgphoto2";
+    rev = "${meta.tag}";
+    sha256 = "0pbfg89817qkb35mmajsw2iz6j9nhkkj67m419f8x8yxpqkaa0wb";
+  };
+
+  patches = [];
+
+  nativeBuildInputs = [ pkgconfig gettext autoreconfHook ];
+  buildInputs = [ libtool libjpeg libusb1  ];
+
+  # These are mentioned in the Requires line of libgphoto's pkg-config file.
+  propagatedBuildInputs = [ libexif ];
+
+  hardeningDisable = [ "format" ];
+
+  postInstall = ''
+    mkdir -p $out/lib/udev/rules.d
+    $out/lib/libgphoto2/print-camera-list udev-rules version 175 group camera >$out/lib/udev/rules.d/40-gphoto2.rules
+  '';
+
+  meta = {
+    homepage = http://www.gphoto.org/proj/libgphoto2/;
+    description = "A library for accessing digital cameras";
+    longDescription = ''
+      This is the library backend for gphoto2. It contains the code for PTP,
+      MTP, and other vendor specific protocols for controlling and transferring data
+      from digital cameras.
+    '';
+    version = "2.5.17";
+    tag = "libgphoto2-2_5_17-release";
+    # 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 ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libgpiod/default.nix b/nixpkgs/pkgs/development/libraries/libgpiod/default.nix
new file mode 100644
index 000000000000..c498ef3460ac
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libgpiod/default.nix
@@ -0,0 +1,38 @@
+{ stdenv, fetchgit, autoreconfHook, autoconf-archive, pkgconfig, kmod, enable-tools ? true }:
+
+stdenv.mkDerivation rec {
+  name = "libgpiod-unstable-${version}";
+  version = "2018-10-07";
+
+  src = fetchgit {
+    url = "https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git";
+    rev = "4bf402d3a49336eacd33654441d575bd267780b8";
+    sha256 = "01f3jzb133z189sxdiz9qiy65p0bjqhynfllidbpxdr0cxkyyc1d";
+  };
+
+  buildInputs = [ kmod ];
+  nativeBuildInputs = [
+    autoconf-archive
+    pkgconfig
+    autoreconfHook
+  ];
+
+  configureFlags = [
+    "--enable-tools=${if enable-tools then "yes" else "no"}"
+    "--enable-bindings-cxx"
+    "--prefix=$(out)"
+  ];
+
+  meta = with stdenv.lib; {
+    description = "C library and tools for interacting with the linux GPIO character device";
+    longDescription = ''
+      Since linux 4.8 the GPIO sysfs interface is deprecated. User space should use
+      the character device instead. This library encapsulates the ioctl calls and
+      data structures behind a straightforward API.
+    '';
+    homepage = https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git/about/;
+    license = licenses.lgpl2;
+    maintainers = [ maintainers.expipiplus1 ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libgpod/default.nix b/nixpkgs/pkgs/development/libraries/libgpod/default.nix
new file mode 100644
index 000000000000..b77690bd1593
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libgpod/default.nix
@@ -0,0 +1,39 @@
+{stdenv, lib, fetchurl, gettext, perlPackages, intltool, pkgconfig, glib,
+  libxml2, sqlite, zlib, sg3_utils, gdk_pixbuf, taglib,
+  libimobiledevice, pythonPackages, mutagen,
+  monoSupport ? false, mono, gtk-sharp-2_0
+}:
+
+let
+  inherit (pythonPackages) python pygobject2;
+in stdenv.mkDerivation rec {
+  name = "libgpod-0.8.3";
+  src = fetchurl {
+    url = "mirror://sourceforge/gtkpod/${name}.tar.bz2";
+    sha256 = "0pcmgv1ra0ymv73mlj4qxzgyir026z9jpl5s5bkg35afs1cpk2k3";
+  };
+
+  preConfigure = "configureFlagsArray=( --with-udev-dir=$out/lib/udev )";
+
+  configureFlags = [
+    "--without-hal"
+    "--enable-udev"
+  ] ++ lib.optionals monoSupport [ "--with-mono" ];
+
+  dontStrip = true;
+
+  propagatedBuildInputs = [ glib libxml2 sqlite zlib sg3_utils
+    gdk_pixbuf taglib libimobiledevice python pygobject2 mutagen ];
+
+  nativeBuildInputs = [ gettext intltool pkgconfig ]
+    ++ (with perlPackages; [ perl XMLParser ])
+    ++ lib.optionals monoSupport [ mono gtk-sharp-2_0 ];
+
+  meta = {
+    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;
+    maintainers = [ ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libgringotts/default.nix b/nixpkgs/pkgs/development/libraries/libgringotts/default.nix
new file mode 100644
index 000000000000..89fcfdfde8da
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libgringotts/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, fetchurl, pkgconfig, zlib, bzip2, libmcrypt, libmhash }:
+
+stdenv.mkDerivation rec {
+  name = "libgringotts-${version}";
+  version = "1.2.1";
+
+  src = fetchurl {
+    url = "https://sourceforge.net/projects/gringotts.berlios/files/${name}.tar.bz2";
+    sha256 = "1ldz1lyl1aml5ci1mpnys8dg6n7khpcs4zpycak3spcpgdsnypm7";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ zlib bzip2 libmcrypt libmhash ];
+
+  meta = with stdenv.lib; {
+    description = "A small library to encapsulate data in an encrypted structure";
+    homepage = http://libgringotts.sourceforge.net/;
+    license = licenses.gpl2Plus;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ pSub ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libgroove/default.nix b/nixpkgs/pkgs/development/libraries/libgroove/default.nix
new file mode 100644
index 000000000000..bd5a5f068515
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libgroove/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchFromGitHub, cmake, libav, SDL2, chromaprint, libebur128 }:
+
+stdenv.mkDerivation rec {
+  version = "4.3.0";
+  name = "libgroove-${version}";
+
+  src = fetchFromGitHub {
+    owner = "andrewrk";
+    repo = "libgroove";
+    rev = "${version}";
+    sha256 = "1la9d9kig50mc74bxvhx6hzqv0nrci9aqdm4k2j4q0s1nlfgxipd";
+  };
+
+  patches = [ ./no-warnings-as-errors.patch ];
+
+  buildInputs = [ cmake libav SDL2 chromaprint libebur128 ];
+
+  meta = with stdenv.lib; {
+    description = "Streaming audio processing library";
+    homepage = https://github.com/andrewrk/libgroove;
+    license = licenses.mit;
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ andrewrk ma27 ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libgroove/no-warnings-as-errors.patch b/nixpkgs/pkgs/development/libraries/libgroove/no-warnings-as-errors.patch
new file mode 100644
index 000000000000..86a8a935769c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libgroove/no-warnings-as-errors.patch
@@ -0,0 +1,15 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index a1e8541..6bc9c30 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -135,8 +135,8 @@ configure_file (
+   "${PROJECT_BINARY_DIR}/config.h"
+   )
+ 
+-set(LIB_CFLAGS "${C99_C_FLAGS} -pedantic -Werror -Wall -Werror=strict-prototypes -Werror=old-style-definition -Werror=missing-prototypes -D_REENTRANT -D_POSIX_C_SOURCE=200809L")
+-set(EXAMPLE_CFLAGS "${C99_C_FLAGS} -pedantic -Werror -Wall -g")
++set(LIB_CFLAGS "${C99_C_FLAGS} -pedantic -Wall -Werror=strict-prototypes -Werror=old-style-definition -Werror=missing-prototypes -D_REENTRANT -D_POSIX_C_SOURCE=200809L")
++set(EXAMPLE_CFLAGS "${C99_C_FLAGS} -pedantic -Wall -g")
+ set(EXAMPLE_INCLUDES "${PROJECT_SOURCE_DIR}")
+ 
+ add_library(groove SHARED ${LIBGROOVE_SOURCES} ${LIBGROOVE_HEADERS})
diff --git a/nixpkgs/pkgs/development/libraries/libgrss/default.nix b/nixpkgs/pkgs/development/libraries/libgrss/default.nix
new file mode 100644
index 000000000000..8fc44fb6a8dc
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libgrss/default.nix
@@ -0,0 +1,40 @@
+{ stdenv, fetchurl, pkgconfig, vala, gobject-introspection, gtk-doc, docbook_xsl, docbook_xml_dtd_412, glib, libxml2, libsoup, gnome3 }:
+
+let
+  version = "0.7.0";
+  pname = "libgrss";
+in
+stdenv.mkDerivation {
+  name = "${pname}-${version}";
+
+  outputs = [ "out" "dev" "devdoc" ];
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    sha256 = "1nalslgyglvhpva3px06fj6lv5zgfg0qmj0sbxyyl5d963vc02b7";
+  };
+
+  nativeBuildInputs = [ pkgconfig vala gobject-introspection gtk-doc docbook_xsl docbook_xml_dtd_412 ];
+  buildInputs = [ glib libxml2 libsoup ];
+
+  configureFlags = [
+    "--enable-gtk-doc"
+  ];
+
+  doCheck = true;
+
+  passthru = {
+    updateScript = gnome3.updateScript {
+      packageName = pname;
+      versionPolicy = "none";
+    };
+  };
+
+  meta = with stdenv.lib; {
+    description = "Glib abstaction to handle feeds in RSS, Atom and other formats";
+    homepage = https://wiki.gnome.org/Projects/Libgrss;
+    license = licenses.lgpl3Plus;
+    maintainers = gnome3.maintainers;
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libgsf/default.nix b/nixpkgs/pkgs/development/libraries/libgsf/default.nix
new file mode 100644
index 000000000000..f2d31cf16762
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libgsf/default.nix
@@ -0,0 +1,43 @@
+{ fetchurl, stdenv, pkgconfig, intltool, gettext, glib, libxml2, zlib, bzip2
+, python, perl, gdk_pixbuf, libiconv, libintl, gnome3 }:
+
+stdenv.mkDerivation rec {
+  pname = "libgsf";
+  version = "1.14.46";
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    sha256 = "0bddmlzg719sjhlbzqlhb7chwk93qc7g68m2r9r8xz112jdradpa";
+  };
+
+  nativeBuildInputs = [ pkgconfig intltool libintl ];
+
+  buildInputs = [ gettext bzip2 zlib python ];
+  checkInputs = [ perl ];
+
+  propagatedBuildInputs = [ libxml2 glib gdk_pixbuf libiconv ];
+
+  outputs = [ "out" "dev" ];
+
+  doCheck = true;
+  preCheck = "patchShebangs ./tests/";
+
+  passthru = {
+    updateScript = gnome3.updateScript {
+      packageName = pname;
+    };
+  };
+
+  meta = with stdenv.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;
+
+    longDescription = ''
+      Libgsf aims to provide an efficient extensible I/O abstraction for
+      dealing with different structured file formats.
+    '';
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libgssglue/default.nix b/nixpkgs/pkgs/development/libraries/libgssglue/default.nix
new file mode 100644
index 000000000000..0177869d3e39
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libgssglue/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchurl, kerberos }:
+
+stdenv.mkDerivation rec {
+  name = "libgssglue-0.4";
+
+  src = fetchurl {
+    url = "http://www.citi.umich.edu/projects/nfsv4/linux/libgssglue/${name}.tar.gz";
+    sha256 = "0fh475kxzlabwz30wz3bf7i8kfqiqzhfahayx3jj79rba1sily9z";
+  };
+
+  postPatch = ''
+    sed s:/etc/gssapi_mech.conf:$out/etc/gssapi_mech.conf: -i src/g_initialize.c
+  '';
+
+  postInstall = ''
+    mkdir -p $out/etc
+    cat <<EOF > $out/etc/gssapi_mech.conf
+    ${kerberos}/lib/libgssapi_krb5.so mechglue_internal_krb5_init
+    EOF
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = http://www.citi.umich.edu/projects/nfsv4/linux/;
+    description = "Exports a gssapi interface which calls other random gssapi libraries";
+    license = licenses.bsd3;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ corngood ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libgtop/default.nix b/nixpkgs/pkgs/development/libraries/libgtop/default.nix
new file mode 100644
index 000000000000..fe7986bf21aa
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libgtop/default.nix
@@ -0,0 +1,45 @@
+{ stdenv
+, fetchurl
+, glib
+, pkgconfig
+, perl
+, gettext
+, gobject-introspection
+, gnome3
+, gtk-doc
+}:
+
+stdenv.mkDerivation rec {
+  pname = "libgtop";
+  version = "2.40.0";
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    sha256 = "1m6jbqk8maa52gxrf223442fr5bvvxgb7ham6v039i3r1i62gwvq";
+  };
+
+  nativeBuildInputs = [
+    pkgconfig
+    gtk-doc
+    perl
+    gettext
+    gobject-introspection
+  ];
+
+  propagatedBuildInputs = [
+    glib
+  ];
+
+  passthru = {
+    updateScript = gnome3.updateScript {
+      packageName = pname;
+    };
+  };
+
+  meta = with stdenv.lib; {
+    description = "A library that reads information about processes and the running system";
+    license = licenses.gpl2Plus;
+    maintainers = gnome3.maintainers;
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libgudev/default.nix b/nixpkgs/pkgs/development/libraries/libgudev/default.nix
new file mode 100644
index 000000000000..d3dea766cbbb
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libgudev/default.nix
@@ -0,0 +1,35 @@
+{ stdenv, fetchurl, pkgconfig, udev, glib, gobject-introspection, gnome3 }:
+
+let
+  pname = "libgudev";
+in stdenv.mkDerivation rec {
+  name = "libgudev-${version}";
+  version = "232";
+
+  outputs = [ "out" "dev" ];
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${name}.tar.xz";
+    sha256 = "ee4cb2b9c573cdf354f6ed744f01b111d4b5bed3503ffa956cefff50489c7860";
+  };
+
+  nativeBuildInputs = [ pkgconfig gobject-introspection ];
+  buildInputs = [ udev glib ];
+
+  # There's a dependency cycle with umockdev and the tests fail to LD_PRELOAD anyway.
+  configureFlags = [ "--disable-umockdev" ];
+
+  passthru = {
+    updateScript = gnome3.updateScript {
+      packageName = pname;
+      versionPolicy = "none";
+    };
+  };
+
+  meta = with stdenv.lib; {
+    homepage = https://wiki.gnome.org/Projects/libgudev;
+    maintainers = [ maintainers.eelco ] ++ gnome3.maintainers;
+    platforms = platforms.linux;
+    license = licenses.lgpl2Plus;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libguestfs/appliance.nix b/nixpkgs/pkgs/development/libraries/libguestfs/appliance.nix
new file mode 100644
index 000000000000..9c2b317ab086
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libguestfs/appliance.nix
@@ -0,0 +1,11 @@
+{ fetchzip }:
+
+fetchzip {
+  name = "libguestfs-appliance-1.38.0";
+  url = "http://libguestfs.org/download/binaries/appliance/appliance-1.38.0.tar.xz";
+  sha256 = "15rxwj5qjflizxk7slpbrj9lcwkd2lgm52f5yv101qba4yyn3g76";
+
+  meta = {
+    hydraPlatforms = []; # Hydra fails with "Output limit exceeded"
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libguestfs/default.nix b/nixpkgs/pkgs/development/libraries/libguestfs/default.nix
new file mode 100644
index 000000000000..e3d7741ba869
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libguestfs/default.nix
@@ -0,0 +1,89 @@
+{ stdenv, fetchurl, pkgconfig, autoreconfHook, makeWrapper
+, ncurses, cpio, gperf, cdrkit, flex, bison, qemu, pcre, augeas, libxml2
+, acl, libcap, libcap_ng, libconfig, systemd, fuse, yajl, libvirt, hivex
+, gmp, readline, file, numactl, xen, libapparmor
+, getopt, perlPackages, ocamlPackages
+, appliance ? null
+, javaSupport ? false, jdk ? null }:
+
+assert appliance == null || stdenv.lib.isDerivation appliance;
+assert javaSupport -> jdk != null;
+
+stdenv.mkDerivation rec {
+  name = "libguestfs-${version}";
+  version = "1.38.6";
+
+  src = fetchurl {
+    url = "http://libguestfs.org/download/1.38-stable/libguestfs-${version}.tar.gz";
+    sha256 = "1v2mggx2jlaq4m3p5shc46gzf7vmaayha6r0nwdnyzd7x6q0is7p";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [
+    makeWrapper autoreconfHook ncurses cpio gperf
+    cdrkit flex bison qemu pcre augeas libxml2 acl libcap libcap_ng libconfig
+    systemd fuse yajl libvirt gmp readline file hivex
+    numactl xen libapparmor getopt perlPackages.ModuleBuild
+  ] ++ (with perlPackages; [ perl libintl_perl GetoptLong SysVirt ])
+    ++ (with ocamlPackages; [ ocaml findlib ocamlbuild ocaml_libvirt ocaml_gettext ounit ])
+    ++ stdenv.lib.optional javaSupport jdk;
+
+  prePatch = ''
+    # build-time scripts
+    substituteInPlace run.in        --replace '#!/bin/bash' '#!${stdenv.shell}'
+    substituteInPlace ocaml-link.sh --replace '#!/bin/bash' '#!${stdenv.shell}'
+
+    # $(OCAMLLIB) is read-only "${ocamlPackages.ocaml}/lib/ocaml"
+    substituteInPlace ocaml/Makefile.am            --replace '$(DESTDIR)$(OCAMLLIB)' '$(out)/lib/ocaml'
+    substituteInPlace ocaml/Makefile.in            --replace '$(DESTDIR)$(OCAMLLIB)' '$(out)/lib/ocaml'
+    substituteInPlace v2v/test-harness/Makefile.am --replace '$(DESTDIR)$(OCAMLLIB)' '$(out)/lib/ocaml'
+    substituteInPlace v2v/test-harness/Makefile.in --replace '$(DESTDIR)$(OCAMLLIB)' '$(out)/lib/ocaml'
+
+    # some scripts hardcore /usr/bin/env which is not available in the build env
+    patchShebangs .
+  '';
+  configureFlags = [ "--disable-appliance" "--disable-daemon" "--with-distro=NixOS" ]
+    ++ stdenv.lib.optionals (!javaSupport) [ "--disable-java" "--without-java" ];
+  patches = [ ./libguestfs-syms.patch ];
+  NIX_CFLAGS_COMPILE="-I${libxml2.dev}/include/libxml2/";
+  installFlags = "REALLY_INSTALL=yes";
+  enableParallelBuilding = true;
+
+  postInstall = ''
+    for bin in $out/bin/*; do
+      wrapProgram "$bin" \
+        --prefix PATH     : "$out/bin:${hivex}/bin:${qemu}/bin" \
+        --prefix PERL5LIB : "$out/${perlPackages.perl.libPrefix}"
+    done
+  '';
+
+  postFixup = stdenv.lib.optionalString (appliance != null) ''
+    mkdir -p $out/{lib,lib64}
+    ln -s ${appliance} $out/lib64/guestfs
+    ln -s ${appliance} $out/lib/guestfs
+  '';
+
+  doInstallCheck = appliance != null;
+  installCheckPhase = ''
+    export HOME=$(mktemp -d) # avoid access to /homeless-shelter/.guestfish
+
+    ${qemu}/bin/qemu-img create -f qcow2 disk1.img 10G
+
+    $out/bin/guestfish <<'EOF'
+    add-drive disk1.img
+    run
+    list-filesystems
+    part-disk /dev/sda mbr
+    mkfs ext2 /dev/sda1
+    list-filesystems
+    EOF
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Tools for accessing and modifying virtual machine disk images";
+    license = licenses.gpl2;
+    homepage = http://libguestfs.org/;
+    maintainers = with maintainers; [offline];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libguestfs/libguestfs-syms.patch b/nixpkgs/pkgs/development/libraries/libguestfs/libguestfs-syms.patch
new file mode 100644
index 000000000000..09c4b1393ce7
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libguestfs/libguestfs-syms.patch
@@ -0,0 +1,13 @@
+diff --git a/lib/Makefile.am b/lib/Makefile.am
+--- a/lib/Makefile.am
++++ b/lib/Makefile.am
+@@ -168,8 +168,7 @@ libguestfs_la_LIBADD = \
+ # Force libtool to name the library 'libguestfs.so.0.$(MAX_PROC_NR).0'.
+ # Include the version script to limit which symbols are exported.
+ libguestfs_la_LDFLAGS = \
+-	-version-info $(MAX_PROC_NR):0:$(MAX_PROC_NR) \
+-	$(VERSION_SCRIPT_FLAGS)$(srcdir)/libguestfs.syms
++	-version-info $(MAX_PROC_NR):0:$(MAX_PROC_NR)
+ 
+ if HAVE_FUSE
+ # XXX Unfortunately FUSE_CFLAGS defines _FILE_OFFSET_BITS=64.
diff --git a/nixpkgs/pkgs/development/libraries/libgumath/default.nix b/nixpkgs/pkgs/development/libraries/libgumath/default.nix
new file mode 100644
index 000000000000..d5d35678b4fb
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libgumath/default.nix
@@ -0,0 +1,34 @@
+{ stdenv
+, fetchFromGitHub
+, libndtypes
+, libxnd
+}:
+
+stdenv.mkDerivation rec {
+  name = "libgumath-${version}";
+  version = "unstable-2018-11-27";
+
+  src = fetchFromGitHub {
+    owner = "plures";
+    repo = "gumath";
+    rev = "5a9d27883b40432246d6a93cd6133157267fd166";
+    sha256 = "0w2qzp7anxd1wzkvv5r2pdkkpgrnqzgrq47lrvpqc1i1wqzcwf0w";
+  };
+
+  buildInputs = [ libndtypes libxnd ];
+
+  # Override linker with cc (symlink to either gcc or clang)
+  # Library expects to use cc for linking
+  configureFlags = [
+    "LD=${stdenv.cc.targetPrefix}cc"
+  ];
+
+  doCheck = true;
+
+  meta = with stdenv.lib; {
+    description = "Library supporting function dispatch on general data containers. C base and Python wrapper";
+    homepage = https://xnd.io/;
+    license = licenses.bsd3;
+    maintainers = [ maintainers.costrouc ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libgweather/default.nix b/nixpkgs/pkgs/development/libraries/libgweather/default.nix
new file mode 100644
index 000000000000..3300e9b1d680
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libgweather/default.nix
@@ -0,0 +1,42 @@
+{ stdenv, fetchurl, meson, ninja, pkgconfig, libxml2, glib, gtk3, gettext, libsoup
+, gtk-doc, docbook_xsl, docbook_xml_dtd_43, gobject-introspection, python3, tzdata, geocode-glib, vala, gnome3 }:
+
+stdenv.mkDerivation rec {
+  pname = "libgweather";
+  version = "3.32.1";
+
+  outputs = [ "out" "dev" "devdoc" ];
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    sha256 = "1079d26y8d2zaw9w50l9scqjhbrynpdd6kyaa32x4393f7nih8hw";
+  };
+
+  nativeBuildInputs = [ meson ninja pkgconfig gettext vala gtk-doc docbook_xsl docbook_xml_dtd_43 gobject-introspection python3 ];
+  buildInputs = [ glib gtk3 libsoup libxml2 geocode-glib ];
+
+  postPatch = ''
+    chmod +x meson/meson_post_install.py
+    patchShebangs meson/meson_post_install.py
+  '';
+
+  mesonFlags = [
+    "-Dzoneinfo_dir=${tzdata}/share/zoneinfo"
+    "-Denable_vala=true"
+    "-Dgtk_doc=true"
+  ];
+
+  passthru = {
+    updateScript = gnome3.updateScript {
+      packageName = pname;
+    };
+  };
+
+  meta = with stdenv.lib; {
+    description = "A library to access weather information from online services for numerous locations";
+    homepage = https://wiki.gnome.org/Projects/LibGWeather;
+    license = licenses.gpl2Plus;
+    maintainers = gnome3.maintainers;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libgxps/default.nix b/nixpkgs/pkgs/development/libraries/libgxps/default.nix
new file mode 100644
index 000000000000..30e5e247ab2b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libgxps/default.nix
@@ -0,0 +1,36 @@
+{ stdenv, fetchurl, meson, ninja, pkgconfig, glib, gobject-introspection, cairo
+, libarchive, freetype, libjpeg, libtiff, gnome3, lcms2
+}:
+
+stdenv.mkDerivation rec {
+  pname = "libgxps";
+  version = "0.3.1";
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    sha256 = "157s4c9gjjss6yd7qp7n4q6s72gz1k4ilsx4xjvp357azk49z4qs";
+  };
+
+  nativeBuildInputs = [ meson ninja pkgconfig gobject-introspection ];
+  buildInputs = [ glib cairo freetype libjpeg libtiff lcms2 ];
+  propagatedBuildInputs = [ libarchive ];
+
+  mesonFlags = [
+    "-Denable-test=false"
+  ];
+
+  passthru = {
+    updateScript = gnome3.updateScript {
+      packageName = pname;
+      versionPolicy = "none";
+    };
+  };
+
+  meta = with stdenv.lib; {
+    description = "A GObject based library for handling and rendering XPS documents";
+    homepage = https://wiki.gnome.org/Projects/libgxps;
+    license = licenses.lgpl21Plus;
+    maintainers = gnome3.maintainers;
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libhandy/default.nix b/nixpkgs/pkgs/development/libraries/libhandy/default.nix
new file mode 100644
index 000000000000..d32bb82abcb9
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libhandy/default.nix
@@ -0,0 +1,58 @@
+{ stdenv, fetchFromGitLab, meson, ninja, pkgconfig, gobject-introspection, vala
+, gtk-doc, docbook_xsl, docbook_xml_dtd_43
+, gtk3, gnome3
+, dbus, xvfb_run, libxml2
+, hicolor-icon-theme
+}:
+
+let
+  pname = "libhandy";
+  version = "0.0.9";
+in stdenv.mkDerivation rec {
+  name = "${pname}-${version}";
+
+  outputs = [ "out" "dev" "devdoc" "glade" ];
+  outputBin = "dev";
+
+  src = fetchFromGitLab {
+    domain = "source.puri.sm";
+    owner = "Librem5";
+    repo = pname;
+    rev = "v${version}";
+    sha256 = "0smfnvfba6cnxbrcm1vh3zbr1hww43qcxhawka3hzn2hjr06rfzn";
+  };
+
+  nativeBuildInputs = [
+    meson ninja pkgconfig gobject-introspection vala
+    gtk-doc docbook_xsl docbook_xml_dtd_43
+  ];
+  buildInputs = [ gnome3.gnome-desktop gtk3 gnome3.glade libxml2 ];
+  checkInputs = [ dbus xvfb_run hicolor-icon-theme ];
+
+  mesonFlags = [
+    "-Dgtk_doc=true"
+    "-Dglade_catalog=enabled"
+    "-Dintrospection=enabled"
+  ];
+
+  PKG_CONFIG_GLADEUI_2_0_MODULEDIR = "${placeholder "glade"}/lib/glade/modules";
+  PKG_CONFIG_GLADEUI_2_0_CATALOGDIR = "${placeholder "glade"}/share/glade/catalogs";
+
+  doCheck = true;
+
+  checkPhase = ''
+    NO_AT_BRIDGE=1 \
+    XDG_DATA_DIRS="$XDG_DATA_DIRS:${hicolor-icon-theme}/share" \
+    xvfb-run -s '-screen 0 800x600x24' dbus-run-session \
+      --config-file=${dbus.daemon}/share/dbus-1/session.conf \
+      meson test --print-errorlogs
+  '';
+
+  meta = with stdenv.lib; {
+    description = "A library full of GTK+ widgets for mobile phones";
+    homepage = https://source.puri.sm/Librem5/libhandy;
+    license = licenses.lgpl21Plus;
+    maintainers = with maintainers; [ jtojnar ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libhangul/default.nix b/nixpkgs/pkgs/development/libraries/libhangul/default.nix
new file mode 100644
index 000000000000..9e72d933433b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libhangul/default.nix
@@ -0,0 +1,18 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation {
+  name = "libhangul-0.1.0";
+
+  src = fetchurl {
+    url = "https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/libhangul/libhangul-0.1.0.tar.gz";
+    sha256 = "0ni9b0v70wkm0116na7ghv03pgxsfpfszhgyj3hld3bxamfal1ar";
+  };
+
+  meta = with stdenv.lib; {
+    description = "Core algorithm library for Korean input routines";
+    homepage = https://github.com/choehwanjin/libhangul;
+    license = licenses.lgpl21;
+    maintainers = [ maintainers.ianwookim ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libharu/default.nix b/nixpkgs/pkgs/development/libraries/libharu/default.nix
new file mode 100644
index 000000000000..0830b45b308b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libharu/default.nix
@@ -0,0 +1,20 @@
+{ stdenv, fetchzip, cmake, zlib, libpng }:
+
+stdenv.mkDerivation {
+  name = "libharu-2.3.0";
+
+  src = fetchzip {
+    url = https://github.com/libharu/libharu/archive/RELEASE_2_3_0.tar.gz;
+    sha256 = "15s9hswnl3qqi7yh29jyrg0hma2n99haxznvcywmsp8kjqlyg75q";
+  };
+
+  buildInputs = [ zlib libpng cmake ];
+
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libhdhomerun/default.nix b/nixpkgs/pkgs/development/libraries/libhdhomerun/default.nix
new file mode 100644
index 000000000000..5dc1fb938340
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libhdhomerun/default.nix
@@ -0,0 +1,32 @@
+{ stdenv, fetchgit }:
+
+stdenv.mkDerivation {
+  name = "libhdhomerun-1efbcb";
+
+  src = fetchgit {
+    url = "git://github.com/Silicondust/libhdhomerun.git";
+    rev = "1efbcb2b87b17a82f2b3d873d1c9cc1c6a3a9b77";
+    sha256 = "11iyrfs98xb50n9iqnwfphmmnn5w3mq2l9cjjpf8qp29cvs33cgy";
+  };
+
+  patchPhase = stdenv.lib.optionalString stdenv.isDarwin ''
+    substituteInPlace Makefile --replace "gcc" "cc"
+    substituteInPlace Makefile --replace "-arch i386" ""
+  '';
+
+  installPhase = ''
+    mkdir -p $out/{bin,lib,include/hdhomerun}
+    install -Dm444 libhdhomerun${stdenv.hostPlatform.extensions.sharedLibrary} $out/lib
+    install -Dm555 hdhomerun_config $out/bin
+    cp *.h $out/include/hdhomerun
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Implements the libhdhomerun protocol for use with Silicondust HDHomeRun TV tuners";
+    homepage = https://github.com/Silicondust/libhdhomerun;
+    repositories.git = "https://github.com/Silicondust/libhdhomerun.git";
+    license = stdenv.lib.licenses.lgpl2;
+    platforms = stdenv.lib.platforms.unix;
+    maintainers = [ maintainers.titanous ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libheif/1.4.0-CVE-2019-11471.patch b/nixpkgs/pkgs/development/libraries/libheif/1.4.0-CVE-2019-11471.patch
new file mode 100644
index 000000000000..2ea1b124ce7b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libheif/1.4.0-CVE-2019-11471.patch
@@ -0,0 +1,15 @@
+Adapted from upstream commit 995a4283d8ed2d0d2c1ceb1a577b993df2f0e014
+--- a/libheif/heif_context.cc
++++ b/libheif/heif_context.cc
+@@ -571,6 +571,11 @@
+             image->set_is_alpha_channel_of(refs[0]);
+ 
+             auto master_iter = m_all_images.find(refs[0]);
++            if (master_iter == m_all_images.end()) {
++              return Error(heif_error_Invalid_input,
++                           heif_suberror_Nonexisting_item_referenced,
++                           "Non-existing alpha image referenced");
++            }
+             master_iter->second->set_alpha_channel(image);
+           }
+
diff --git a/nixpkgs/pkgs/development/libraries/libheif/default.nix b/nixpkgs/pkgs/development/libraries/libheif/default.nix
new file mode 100644
index 000000000000..3182345bfd48
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libheif/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchFromGitHub, autoreconfHook, pkgconfig, libde265, x265, libpng, libjpeg }:
+
+stdenv.mkDerivation rec {
+  version = "1.4.0";
+  name = "libheif-${version}";
+
+  src = fetchFromGitHub {
+    owner = "strukturag";
+    repo = "libheif";
+    rev = "v${version}";
+    sha256 = "0vbjknkb2ccmw3xh2j8ljz5sj9i8wv92iw7zghcc5wn64sk1xkk2";
+  };
+
+  patches = [ ./1.4.0-CVE-2019-11471.patch ];
+
+  nativeBuildInputs = [ autoreconfHook pkgconfig ];
+  buildInputs = [ libde265 x265 libpng libjpeg ];
+
+  enableParallelBuilding = true;
+
+  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 ];
+  };
+
+}
diff --git a/nixpkgs/pkgs/development/libraries/libhttpseverywhere/default.nix b/nixpkgs/pkgs/development/libraries/libhttpseverywhere/default.nix
new file mode 100644
index 000000000000..cf5c80c9b219
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libhttpseverywhere/default.nix
@@ -0,0 +1,49 @@
+{ stdenv, fetchurl, pkgconfig, meson, ninja, makeFontsConf, vala, fetchpatch
+, gnome3, glib, json-glib, libarchive, libsoup, gobject-introspection, valadoc }:
+
+let
+  pname = "libhttpseverywhere";
+  version = "0.8.3";
+in stdenv.mkDerivation rec {
+  name = "${pname}-${version}";
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${name}.tar.xz";
+    sha256 = "1jmn6i4vsm89q1axlq4ajqkzqmlmjaml9xhw3h9jnal46db6y00w";
+  };
+
+  nativeBuildInputs = [ vala gobject-introspection meson ninja pkgconfig ];
+  buildInputs = [ glib gnome3.libgee json-glib libsoup libarchive ];
+
+  # Fixes build with vala >=0.42
+  patches = [
+    (fetchpatch {
+      url = "https://gitlab.gnome.org/GNOME/libhttpseverywhere/commit/6da08ef1ade9ea267cecf14dd5cb2c3e6e5e50cb.patch";
+      sha256 = "1nwjlh8iqgjayccwdh0fbpq2g1h8bg1k1g9i324f2bhhvyhmpq8f";
+    })
+  ];
+
+  mesonFlags = [ "-Denable_valadoc=true" ];
+
+  doCheck = true;
+
+  checkPhase = "(cd test && ./httpseverywhere_test)";
+
+  FONTCONFIG_FILE = makeFontsConf { fontDirectories = [ ]; };
+
+  outputs = [ "out" "devdoc" ];
+
+  passthru = {
+    updateScript = gnome3.updateScript {
+      packageName = pname;
+    };
+  };
+
+  meta = with stdenv.lib; {
+    description = "Library to use HTTPSEverywhere in desktop applications";
+    homepage = https://gitlab.gnome.org/GNOME/libhttpseverywhere;
+    license = licenses.lgpl3;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ sternenseemann ] ++ gnome3.maintainers;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libiberty/default.nix b/nixpkgs/pkgs/development/libraries/libiberty/default.nix
new file mode 100644
index 000000000000..ab1858c51a61
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libiberty/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, buildPackages, staticBuild ? false }:
+
+let inherit (buildPackages.buildPackages) gcc; in
+
+stdenv.mkDerivation rec {
+  name = "libiberty-${gcc.cc.version}";
+
+  inherit (gcc.cc) src;
+
+  outputs = [ "out" "dev" ];
+
+  postUnpack = "sourceRoot=\${sourceRoot}/libiberty";
+
+  configureFlags = [ "--enable-install-libiberty" ]
+    ++ stdenv.lib.optional (!staticBuild) "--enable-shared";
+
+  postInstall = stdenv.lib.optionalString (!staticBuild) ''
+    cp pic/libiberty.a $out/lib*/libiberty.a
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = https://gcc.gnu.org/;
+    license = licenses.lgpl2;
+    description = "Collection of subroutines used by various GNU programs";
+    maintainers = with maintainers; [ abbradar ericson2314 ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libibmad/default.nix b/nixpkgs/pkgs/development/libraries/libibmad/default.nix
new file mode 100644
index 000000000000..00bd7e6eeea7
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libibmad/default.nix
@@ -0,0 +1,18 @@
+{ stdenv, fetchurl, libibumad }:
+
+stdenv.mkDerivation rec {
+  name = "libibmad-1.3.13";
+
+  src = fetchurl {
+    url = "https://www.openfabrics.org/downloads/management/${name}.tar.gz";
+    sha256 = "02sj8k2jpcbiq8s0l2lqk4vwji2dbb2lc730cv1yzv0zr0hxgk8p";
+  };
+
+  buildInputs = [ libibumad ];
+
+  meta = with stdenv.lib; {
+    homepage = https://www.openfabrics.org/;
+    license = licenses.gpl2;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libibumad/default.nix b/nixpkgs/pkgs/development/libraries/libibumad/default.nix
new file mode 100644
index 000000000000..689e9a0be5dd
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libibumad/default.nix
@@ -0,0 +1,16 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "libibumad-1.3.10.2";
+
+  src = fetchurl {
+    url = "https://www.openfabrics.org/downloads/management/${name}.tar.gz";
+    sha256 = "0bkygb3lbpaj6s4vsyixybrrkcnilbijv4ga5p1xdwyr3gip83sh";
+  };
+
+  meta = with stdenv.lib; {
+    homepage = https://www.openfabrics.org/;
+    license = licenses.gpl2;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libical/default.nix b/nixpkgs/pkgs/development/libraries/libical/default.nix
new file mode 100644
index 000000000000..916530220526
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libical/default.nix
@@ -0,0 +1,55 @@
+{ stdenv, fetchFromGitHub, perl, pkgconfig, cmake, ninja, vala, gobject-introspection
+, python3, tzdata, gtk-doc, docbook_xsl, docbook_xml_dtd_43, glib, libxml2, icu }:
+
+stdenv.mkDerivation rec {
+  name = "libical-${version}";
+  version = "3.0.4";
+
+  outputs = [ "out" "dev" ]; #"devdoc" ];
+
+  src = fetchFromGitHub {
+    owner = "libical";
+    repo = "libical";
+    rev = "v${version}";
+    sha256 = "1qgpbdjd6jsivw87v5w52268kqp0rv780kli8cgb3ndlv592wlbm";
+  };
+
+  nativeBuildInputs = [
+    perl pkgconfig cmake ninja vala gobject-introspection
+    (python3.withPackages (pkgs: with pkgs; [ pygobject3 ])) # running libical-glib tests
+# Docs building fails: https://github.com/NixOS/nixpkgs/pull/61657#issuecomment-495579489
+#    gtk-doc docbook_xsl docbook_xml_dtd_43 # docs
+  ];
+  buildInputs = [ glib libxml2 icu ];
+
+  cmakeFlags = [
+    "-DGOBJECT_INTROSPECTION=True"
+    "-DICAL_GLIB_VAPI=True"
+  ];
+
+  patches = [
+    # TODO: upstream this patch
+    # https://github.com/libical/libical/issues/350
+    ./respect-env-tzdir.patch
+  ];
+
+  # Using install check so we do not have to manually set
+  # LD_LIBRARY_PATH and GI_TYPELIB_PATH variables
+  doInstallCheck = true;
+  enableParallelChecking = false;
+  installCheckPhase = ''
+    runHook preInstallCheck
+
+    export TZDIR=${tzdata}/share/zoneinfo
+    ctest --output-on-failure
+
+    runHook postInstallCheck
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = https://github.com/libical/libical;
+    description = "An Open Source implementation of the iCalendar protocols";
+    license = licenses.mpl20;
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libical/respect-env-tzdir.patch b/nixpkgs/pkgs/development/libraries/libical/respect-env-tzdir.patch
new file mode 100644
index 000000000000..59d23e490e5a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libical/respect-env-tzdir.patch
@@ -0,0 +1,29 @@
+--- a/src/libical/icaltz-util.c
++++ b/src/libical/icaltz-util.c
+@@ -94,9 +94,9 @@
+ static const char *zdir = NULL;
+ 
+ static const char *search_paths[] = {
++    "/etc/zoneinfo",
+     "/usr/share/zoneinfo",
+     "/usr/lib/zoneinfo",
+-    "/etc/zoneinfo",
+     "/usr/share/lib/zoneinfo"
+ };
+ 
+@@ -178,6 +178,15 @@
+     const char *fname = ZONES_TAB_SYSTEM_FILENAME;
+     size_t i, num_search_paths;
+ 
++   const char *env_tzdir = getenv ("TZDIR");
++   if (env_tzdir) {
++       sprintf (file_path, "%s/%s", env_tzdir, fname);
++       if (!access (file_path, F_OK|R_OK)) {
++           zdir = env_tzdir;
++           return;
++       }
++   }
++
+     num_search_paths = sizeof(search_paths) / sizeof(search_paths[0]);
+     for (i = 0; i < num_search_paths; i++) {
+         snprintf(file_path, MAXPATHLEN, "%s/%s", search_paths[i], fname);
diff --git a/nixpkgs/pkgs/development/libraries/libicns/default.nix b/nixpkgs/pkgs/development/libraries/libicns/default.nix
new file mode 100644
index 000000000000..298d6124505c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libicns/default.nix
@@ -0,0 +1,19 @@
+{ stdenv, fetchurl, libpng, jasper }:
+
+stdenv.mkDerivation rec {
+  name = "libicns-0.8.1";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/icns/${name}.tar.gz";
+    sha256 = "1hjm8lwap7bjyyxsyi94fh5817xzqhk4kb5y0b7mb6675xw10prk";
+  };
+
+  buildInputs = [ libpng jasper ];
+
+  meta = with stdenv.lib; {
+    description = "Library for manipulation of the Mac OS icns resource format";
+    homepage = https://icns.sourceforge.io;
+    license = with licenses; [ gpl2 lgpl2 lgpl21 ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libiconv/default.nix b/nixpkgs/pkgs/development/libraries/libiconv/default.nix
new file mode 100644
index 000000000000..c5379692ad30
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libiconv/default.nix
@@ -0,0 +1,57 @@
+{ fetchurl, stdenv, lib
+, enableStatic ? stdenv.hostPlatform.useAndroidPrebuilt
+, enableShared ? !stdenv.hostPlatform.useAndroidPrebuilt
+}:
+
+# assert !stdenv.hostPlatform.isLinux || stdenv.hostPlatform != stdenv.buildPlatform; # TODO: improve on cross
+
+stdenv.mkDerivation rec {
+  name = "libiconv-${version}";
+  version = "1.16";
+
+  src = fetchurl {
+    url = "mirror://gnu/libiconv/${name}.tar.gz";
+    sha256 = "016c57srqr0bza5fxjxfrx6aqxkqy0s3gkhcg7p7fhk5i6sv38g6";
+  };
+
+  setupHooks = [
+    ../../../build-support/setup-hooks/role.bash
+    ./setup-hook.sh
+  ];
+
+  postPatch =
+    lib.optionalString ((stdenv.hostPlatform != stdenv.buildPlatform && stdenv.hostPlatform.libc == "msvcrt") || stdenv.cc.nativeLibc)
+      ''
+        sed '/^_GL_WARN_ON_USE (gets/d' -i srclib/stdio.in.h
+      ''
+    + lib.optionalString (!enableShared) ''
+      sed -i -e '/preload/d' Makefile.in
+    '';
+
+  configureFlags = [
+    (lib.enableFeature enableStatic "static")
+    (lib.enableFeature enableShared "shared")
+  ] ++ lib.optional stdenv.isFreeBSD "--with-pic";
+
+  meta = {
+    description = "An iconv(3) implementation";
+
+    longDescription = ''
+      Some programs, like mailers and web browsers, must be able to convert
+      between a given text encoding and the user's encoding.  Other programs
+      internally store strings in Unicode, to facilitate internal processing,
+      and need to convert between internal string representation (Unicode)
+      and external string representation (a traditional encoding) when they
+      are doing I/O.  GNU libiconv is a conversion library for both kinds of
+      applications.
+    '';
+
+    homepage = https://www.gnu.org/software/libiconv/;
+    license = lib.licenses.lgpl2Plus;
+
+    maintainers = [ ];
+
+    # This library is not needed on GNU platforms.
+    hydraPlatforms = with lib.platforms; cygwin ++ darwin ++ freebsd;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libiconv/setup-hook.sh b/nixpkgs/pkgs/development/libraries/libiconv/setup-hook.sh
new file mode 100644
index 000000000000..f89361a62998
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libiconv/setup-hook.sh
@@ -0,0 +1,8 @@
+# libiconv must be listed in load flags on non-Glibc
+# it doesn't hurt to have it in Glibc either though
+
+# See pkgs/build-support/setup-hooks/role.bash
+if [ -z "$dontAddExtraLibs" ]; then
+    getHostRole
+    export NIX_${role_pre}LDFLAGS+=" -liconv"
+fi
diff --git a/nixpkgs/pkgs/development/libraries/libid3tag/CVE-2017-11550-and-CVE-2017-11551.patch b/nixpkgs/pkgs/development/libraries/libid3tag/CVE-2017-11550-and-CVE-2017-11551.patch
new file mode 100644
index 000000000000..b1f9d0978cec
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libid3tag/CVE-2017-11550-and-CVE-2017-11551.patch
@@ -0,0 +1,13 @@
+Common subdirectories: libid3tag-0.15.1b/msvc++ and libid3tag-0.15.1b-patched/msvc++
+diff -uwp libid3tag-0.15.1b/utf16.c libid3tag-0.15.1b-patched/utf16.c
+--- libid3tag-0.15.1b/utf16.c	2004-01-23 10:41:32.000000000 +0100
++++ libid3tag-0.15.1b-patched/utf16.c	2018-11-01 13:12:00.866050641 +0100
+@@ -250,6 +250,8 @@ id3_ucs4_t *id3_utf16_deserialize(id3_by
+   id3_ucs4_t *ucs4;
+ 
+   end = *ptr + (length & ~1);
++  if (end == *ptr)
++    return 0;
+ 
+   utf16 = malloc((length / 2 + 1) * sizeof(*utf16));
+   if (utf16 == 0)
diff --git a/nixpkgs/pkgs/development/libraries/libid3tag/debian-patches.patch b/nixpkgs/pkgs/development/libraries/libid3tag/debian-patches.patch
new file mode 100644
index 000000000000..0a828b334cf8
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libid3tag/debian-patches.patch
@@ -0,0 +1,89 @@
+diff --git a/compat.gperf b/compat.gperf
+index 4e24613..5635980 100644
+--- a/compat.gperf
++++ b/compat.gperf
+@@ -236,6 +236,10 @@ int id3_compat_fixup(struct id3_tag *tag)
+
+     encoding = id3_parse_uint(&data, 1);
+     string   = id3_parse_string(&data, end - data, encoding, 0);
++    if (!string)
++    {
++	continue;
++    }
+
+     if (id3_ucs4_length(string) < 4) {
+       free(string);
+diff --git a/genre.dat b/genre.dat
+index 17acab5..1f02779 100644
+--- a/genre.dat
++++ b/genre.dat
+@@ -277,8 +277,8 @@ static id3_ucs4_t const genre_PUNK_ROCK[] =
+   { 'P', 'u', 'n', 'k', ' ', 'R', 'o', 'c', 'k', 0 };
+ static id3_ucs4_t const genre_DRUM_SOLO[] =
+   { 'D', 'r', 'u', 'm', ' ', 'S', 'o', 'l', 'o', 0 };
+-static id3_ucs4_t const genre_A_CAPPELLA[] =
+-  { 'A', ' ', 'C', 'a', 'p', 'p', 'e', 'l', 'l', 'a', 0 };
++static id3_ucs4_t const genre_A_CAPELLA[] =
++  { 'A', ' ', 'C', 'a', 'p', 'e', 'l', 'l', 'a', 0 };
+ static id3_ucs4_t const genre_EURO_HOUSE[] =
+   { 'E', 'u', 'r', 'o', '-', 'H', 'o', 'u', 's', 'e', 0 };
+ static id3_ucs4_t const genre_DANCE_HALL[] =
+@@ -452,7 +452,7 @@ static id3_ucs4_t const *const genre_table[] = {
+   genre_DUET,
+   genre_PUNK_ROCK,
+   genre_DRUM_SOLO,
+-  genre_A_CAPPELLA,
++  genre_A_CAPELLA,
+   genre_EURO_HOUSE,
+   genre_DANCE_HALL,
+   genre_GOA,
+diff --git a/genre.dat.in b/genre.dat.in
+index 872de40..e71e34b 100644
+--- a/genre.dat.in
++++ b/genre.dat.in
+@@ -153,7 +153,7 @@ Freestyle
+ Duet
+ Punk Rock
+ Drum Solo
+-A Cappella
++A Capella
+ Euro-House
+ Dance Hall
+ Goa
+diff --git a/parse.c b/parse.c
+index 86a3f21..947c249 100644
+--- a/parse.c
++++ b/parse.c
+@@ -165,6 +165,9 @@ id3_ucs4_t *id3_parse_string(id3_byte_t const **ptr, id3_length_t length,
+   case ID3_FIELD_TEXTENCODING_UTF_8:
+     ucs4 = id3_utf8_deserialize(ptr, length);
+     break;
++  default:
++  	/* FIXME: Unknown encoding! Print warning? */
++	return NULL;
+   }
+
+   if (ucs4 && !full) {
+diff --git a/utf16.c b/utf16.c
+index 70ee9d5..6e60a75 100644
+--- a/utf16.c
++++ b/utf16.c
+@@ -282,5 +282,18 @@ id3_ucs4_t *id3_utf16_deserialize(id3_byte_t const **ptr, id3_length_t length,
+
+   free(utf16);
+
++  if (end == *ptr && length % 2 != 0)
++  {
++     /* We were called with a bogus length.  It should always
++      * be an even number.  We can deal with this in a few ways:
++      * - Always give an error.
++      * - Try and parse as much as we can and
++      *   - return an error if we're called again when we
++      *     already tried to parse everything we can.
++      *   - tell that we parsed it, which is what we do here.
++      */
++     (*ptr)++;
++  }
++
+   return ucs4;
+ }
\ No newline at end of file
diff --git a/nixpkgs/pkgs/development/libraries/libid3tag/default.nix b/nixpkgs/pkgs/development/libraries/libid3tag/default.nix
new file mode 100644
index 000000000000..4b7d9bdc2e32
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libid3tag/default.nix
@@ -0,0 +1,44 @@
+{stdenv, fetchurl, zlib, gperf}:
+
+stdenv.mkDerivation rec {
+  name = "libid3tag-${version}";
+  version = "0.15.1b";
+
+  src = fetchurl {
+    url = mirror://sourceforge/mad/libid3tag-0.15.1b.tar.gz;
+    sha256 = "63da4f6e7997278f8a3fef4c6a372d342f705051d1eeb6a46a86b03610e26151";
+  };
+
+  outputs = [ "out" "dev" ];
+  setOutputFlags = false;
+
+  propagatedBuildInputs = [ zlib gperf ];
+
+  patches = [
+    ./debian-patches.patch
+    ./CVE-2017-11550-and-CVE-2017-11551.patch
+  ];
+
+  preConfigure = ''
+    configureFlagsArray+=(
+      --includedir=$dev/include
+    )
+  '';
+
+  postInstall = ''
+    mkdir -p $dev/lib/pkgconfig
+    cp ${./id3tag.pc} $dev/lib/pkgconfig/id3tag.pc
+    substituteInPlace $dev/lib/pkgconfig/id3tag.pc \
+      --subst-var-by out $out \
+      --subst-var-by dev $dev \
+      --subst-var-by version "${version}"
+  '';
+
+  meta = with stdenv.lib; {
+    description = "ID3 tag manipulation library";
+    homepage = http://mad.sourceforge.net/;
+    license = licenses.gpl2;
+    maintainers = [ maintainers.fuuzetsu ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libid3tag/id3tag.pc b/nixpkgs/pkgs/development/libraries/libid3tag/id3tag.pc
new file mode 100644
index 000000000000..e3df7b3f9df0
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libid3tag/id3tag.pc
@@ -0,0 +1,11 @@
+prefix=@out@
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=@dev@/include
+
+Name: libid3tag
+Description: ID3 tag manipulation library
+Version: @version@
+
+Libs: -L${libdir} -lid3tag
+Cflags: -I${includedir}
diff --git a/nixpkgs/pkgs/development/libraries/libidn/default.nix b/nixpkgs/pkgs/development/libraries/libidn/default.nix
new file mode 100644
index 000000000000..8291499daf31
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libidn/default.nix
@@ -0,0 +1,47 @@
+{ fetchurl, stdenv, libiconv }:
+
+stdenv.mkDerivation rec {
+  name = "libidn-1.35";
+
+  src = fetchurl {
+    url = "mirror://gnu/libidn/${name}.tar.gz";
+    sha256 = "07pyy0afqikfq51z5kbzbj9ldbd12mri0zvx0mfv3ds6bc0g26pi";
+  };
+
+  outputs = [ "bin" "dev" "out" "info" "devdoc" ];
+
+  # broken with gcc-7
+  #doCheck = !stdenv.isDarwin && !stdenv.hostPlatform.isMusl;
+
+  hardeningDisable = [ "format" ];
+
+  buildInputs = stdenv.lib.optional stdenv.isDarwin libiconv;
+
+  doCheck = false; # fails
+
+  meta = {
+    homepage = https://www.gnu.org/software/libidn/;
+    description = "Library for internationalized domain names";
+
+    longDescription = ''
+      GNU Libidn is a fully documented implementation of the
+      Stringprep, Punycode and IDNA specifications.  Libidn's purpose
+      is to encode and decode internationalized domain names.  The
+      native C, C\# and Java libraries are available under the GNU
+      Lesser General Public License version 2.1 or later.
+
+      The library contains a generic Stringprep implementation.
+      Profiles for Nameprep, iSCSI, SASL, XMPP and Kerberos V5 are
+      included.  Punycode and ASCII Compatible Encoding (ACE) via IDNA
+      are supported.  A mechanism to define Top-Level Domain (TLD)
+      specific validation tables, and to compare strings against those
+      tables, is included.  Default tables for some TLDs are also
+      included.
+    '';
+
+    repositories.git = git://git.savannah.gnu.org/libidn.git;
+    license = stdenv.lib.licenses.lgpl2Plus;
+    platforms = stdenv.lib.platforms.all;
+    maintainers = [ ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libidn2/default.nix b/nixpkgs/pkgs/development/libraries/libidn2/default.nix
new file mode 100644
index 000000000000..5ec5b8e04dd0
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libidn2/default.nix
@@ -0,0 +1,40 @@
+{ fetchurl, stdenv, libiconv, libunistring, help2man, buildPackages }:
+
+with stdenv.lib;
+
+stdenv.mkDerivation rec {
+  name = "libidn2-${version}";
+  version = "2.2.0";
+
+  src = fetchurl {
+    url = "mirror://gnu/gnu/libidn/${name}.tar.gz";
+    sha256 = "1zl1cc2xgxw31pdhvhr5ij36x4vvpy16jq667rspin06nlr4fwzw";
+  };
+
+  outputs = [ "bin" "dev" "out" "info" "devdoc" ];
+
+  patches = optional stdenv.isDarwin ./fix-error-darwin.patch;
+
+  nativeBuildInputs = optional stdenv.isDarwin help2man;
+  buildInputs = [ libunistring ] ++ optional stdenv.isDarwin libiconv;
+  depsBuildBuild = [ buildPackages.stdenv.cc ];
+
+  meta = {
+    homepage = "https://www.gnu.org/software/libidn/#libidn2";
+    description = "Free software implementation of IDNA2008 and TR46";
+
+    longDescription = ''
+      Libidn2 is believed to be a complete IDNA2008 and TR46 implementation,
+      but has yet to be as extensively used as the IDNA2003 Libidn library.
+
+      The installed C library libidn2 is dual-licensed under LGPLv3+|GPLv2+,
+      while the rest of the package is GPLv3+.  See the file COPYING for
+      detailed information.
+    '';
+
+    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 ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libidn2/fix-error-darwin.patch b/nixpkgs/pkgs/development/libraries/libidn2/fix-error-darwin.patch
new file mode 100644
index 000000000000..e2202abd947c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libidn2/fix-error-darwin.patch
@@ -0,0 +1,20 @@
+diff --git a/src/idn2.c b/src/idn2.c
+index 6abbc72..804f0f2 100644
+--- a/src/idn2.c
++++ b/src/idn2.c
+@@ -31,7 +31,6 @@
+ #include <unistr.h>
+ 
+ /* Gnulib headers. */
+-#include "error.h"
+ #include "gettext.h"
+ #define _(String) dgettext (PACKAGE, String)
+ #include "progname.h"
+@@ -222,7 +219,7 @@ main (int argc, char *argv[])
+     }
+ 
+   if (ferror (stdin))
+-    error (EXIT_FAILURE, errno, "%s", _("input error"));
++    perror (_("input error"));
+ 
+   cmdline_parser_free (&args_info);
diff --git a/nixpkgs/pkgs/development/libraries/libiec61883/default.nix b/nixpkgs/pkgs/development/libraries/libiec61883/default.nix
new file mode 100644
index 000000000000..4fa3addc0a66
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libiec61883/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, fetchurl, pkgconfig, libraw1394 }:
+
+stdenv.mkDerivation rec {
+  version = "1.2.0";
+  name = "libiec61883-${version}";
+
+  src = fetchurl {
+    url = "mirror://debian/pool/main/libi/libiec61883/libiec61883_${version}.orig.tar.gz";
+    name = "libiec61883-${version}.tar.gz";
+    sha256 = "7c7879c6b9add3148baea697dfbfdcefffbc8ac74e8e6bcf46125ec1d21b373a";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+
+  propagatedBuildInputs = [ libraw1394 ];
+
+  meta = with stdenv.lib; {
+    homepage = https://www.linux1394.org;
+    license = licenses.lgpl21Plus;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libiio/default.nix b/nixpkgs/pkgs/development/libraries/libiio/default.nix
new file mode 100644
index 000000000000..ee8029966dc2
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libiio/default.nix
@@ -0,0 +1,38 @@
+{ stdenv, fetchFromGitHub
+, cmake, flex, bison
+, libxml2, python
+}:
+
+stdenv.mkDerivation rec {
+  name = "libiio-${version}";
+  version = "0.18";
+
+  src = fetchFromGitHub {
+    owner  = "analogdevicesinc";
+    repo   = "libiio";
+    rev    = "refs/tags/v${version}";
+    sha256 = "1cmg3ipam101iy9yncwz2y48idaqaw4fg7i9i4c8vfjisfcycnkk";
+  };
+
+  outputs = [ "out" "lib" "dev" "python" ];
+
+  nativeBuildInputs = [ cmake flex bison ];
+  buildInputs = [ libxml2 ];
+
+  postInstall = ''
+    mkdir -p $python/lib/${python.libPrefix}/site-packages/
+    touch $python/lib/${python.libPrefix}/site-packages/
+    cp ../bindings/python/iio.py $python/lib/${python.libPrefix}/site-packages/
+
+    substitute ../bindings/python/iio.py $python/lib/${python.libPrefix}/site-packages/iio.py \
+      --replace 'libiio.so.0' $lib/lib/libiio.so.0
+  '';
+
+  meta = with stdenv.lib; {
+    description = "API for interfacing with the Linux Industrial I/O Subsystem";
+    homepage    = https://github.com/analogdevicesinc/libiio;
+    license     = licenses.lgpl21;
+    platforms   = platforms.linux;
+    maintainers = with maintainers; [ thoughtpolice ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libimagequant/default.nix b/nixpkgs/pkgs/development/libraries/libimagequant/default.nix
new file mode 100644
index 000000000000..83afd26bf1d3
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libimagequant/default.nix
@@ -0,0 +1,26 @@
+{ stdenv, fetchFromGitHub }:
+
+stdenv.mkDerivation rec {
+  pname = "libimagequant";
+  version = "2.12.3";
+
+  src = fetchFromGitHub {
+    owner = "ImageOptim";
+    repo = pname;
+    rev = version;
+    sha256 = "0qsfq1kv1m5jzn9v9iz0bac66k4clcis1c9877qabnwzwmwma5v0";
+  };
+
+  preConfigure = ''
+    patchShebangs ./configure
+  '';
+
+  meta = with stdenv.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.";
+    license = licenses.gpl3Plus;
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ ma9e marsam ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libimobiledevice/default.nix b/nixpkgs/pkgs/development/libraries/libimobiledevice/default.nix
new file mode 100644
index 000000000000..83a500c13802
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libimobiledevice/default.nix
@@ -0,0 +1,61 @@
+{ stdenv, fetchFromGitHub, automake, autoconf, libtool, pkgconfig, gnutls
+, libgcrypt, libtasn1, glib, libplist, libusbmuxd }:
+
+stdenv.mkDerivation rec {
+  pname = "libimobiledevice";
+  version = "2019-04-04";
+
+  name = "${pname}-${version}";
+
+  src = fetchFromGitHub {
+    owner = pname;
+    repo = pname;
+    rev = "eea4f1be9107c8ab621fd71460e47d0d38e55d71";
+    sha256 = "0wh6z5f5znlqs0grh7c8jj1s411azgyy45klmql5kj3p8qqybqrs";
+  };
+
+  outputs = [ "out" "dev" ];
+
+  nativeBuildInputs = [
+    autoconf
+    automake
+    libtool
+    pkgconfig
+  ];
+  propagatedBuildInputs = [
+    glib
+    gnutls
+    libgcrypt
+    libplist
+    libtasn1
+    libusbmuxd
+  ];
+
+  preConfigure = "NOCONFIGURE=1 ./autogen.sh";
+
+  configureFlags = [
+    "--disable-static"
+    "--disable-openssl"
+    "--without-cython"
+  ];
+
+  meta = with stdenv.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 = ''
+      libimobiledevice is a software library that talks the protocols to support
+      iPhone®, iPod Touch® and iPad® devices on Linux. Unlike other projects, it
+      does not depend on using any existing proprietary libraries and does not
+      require jailbreaking. It allows other software to easily access the
+      device's filesystem, retrieve information about the device and it's
+      internals, backup/restore the device, manage SpringBoard® icons, manage
+      installed applications, retrieve addressbook/calendars/notes and bookmarks
+      and synchronize music and video to the device. The library is in
+      development since August 2007 with the goal to bring support for these
+      devices to the Linux Desktop.
+    '';
+    license = licenses.lgpl21Plus;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ infinisil ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libindicate/default.nix b/nixpkgs/pkgs/development/libraries/libindicate/default.nix
new file mode 100644
index 000000000000..f6dc85b629dd
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libindicate/default.nix
@@ -0,0 +1,66 @@
+# TODO: Resolve the issues with the Mono bindings.
+
+{ stdenv, fetchurl, lib, file
+, pkgconfig, autoconf
+, glib, dbus-glib, libdbusmenu
+, gtkVersion ? "3", gtk2 ? null, gtk3 ? null
+, pythonPackages, gobject-introspection, vala, gnome-doc-utils
+, monoSupport ? false, mono ? null, gtk-sharp-2_0 ? null
+ }:
+
+with lib;
+
+let
+  inherit (pythonPackages) python pygobject2 pygtk;
+in stdenv.mkDerivation rec {
+  name = let postfix = if gtkVersion == "2" && monoSupport then "sharp" else "gtk${gtkVersion}";
+          in "libindicate-${postfix}-${version}";
+  version = "${versionMajor}.${versionMinor}";
+  versionMajor = "12.10";
+  versionMinor = "1";
+
+  src = fetchurl {
+    url = "${meta.homepage}/${versionMajor}/${version}/+download/libindicate-${version}.tar.gz";
+    sha256 = "10am0ymajx633b33anf6b79j37k61z30v9vaf5f9fwk1x5cw1q21";
+  };
+
+  nativeBuildInputs = [ pkgconfig autoconf gobject-introspection vala gnome-doc-utils ];
+
+  buildInputs = [
+    glib dbus-glib libdbusmenu
+    python pygobject2 pygtk
+  ] ++ (if gtkVersion == "2"
+    then [ gtk2 ] ++ optionals monoSupport [ mono gtk-sharp-2_0 ]
+    else [ gtk3 ]);
+
+  postPatch = ''
+    substituteInPlace configure.ac \
+      --replace '=codegendir pygtk-2.0' '=codegendir pygobject-2.0' \
+      --replace 'pyglib-2.0-python$PYTHON_VERSION' 'pyglib-2.0-python'
+    autoconf
+    for f in {configure,ltmain.sh,m4/libtool.m4}; do
+      substituteInPlace $f \
+        --replace /usr/bin/file ${file}/bin/file
+    done
+  '';
+
+  configureFlags = [
+    "CFLAGS=-Wno-error"
+    "--sysconfdir=/etc"
+    "--localstatedir=/var"
+    "--with-gtk=${gtkVersion}"
+  ];
+
+  installFlags = [
+    "sysconfdir=\${out}/etc"
+    "localstatedir=\${TMPDIR}"
+  ];
+
+  meta = {
+    description = "Library for raising indicators via DBus";
+    homepage = https://launchpad.net/libindicate;
+    license = with licenses; [ lgpl21 lgpl3 ];
+    platforms = platforms.linux;
+    maintainers = [ maintainers.msteen ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libindicator/default.nix b/nixpkgs/pkgs/development/libraries/libindicator/default.nix
new file mode 100644
index 000000000000..33691f79a4c8
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libindicator/default.nix
@@ -0,0 +1,52 @@
+{ stdenv, fetchurl, lib, file
+, pkgconfig
+, gtkVersion ? "3", gtk2 ? null, gtk3 ? null }:
+
+with lib;
+
+stdenv.mkDerivation rec {
+  name = "libindicator-gtk${gtkVersion}-${version}";
+  version = "${versionMajor}.${versionMinor}";
+  versionMajor = "12.10";
+  versionMinor = "1";
+
+  src = fetchurl {
+    url = "${meta.homepage}/${versionMajor}/${version}/+download/libindicator-${version}.tar.gz";
+    sha256 = "b2d2e44c10313d5c9cd60db455d520f80b36dc39562df079a3f29495e8f9447f";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+
+  buildInputs = [ (if gtkVersion == "2" then gtk2 else gtk3) ];
+
+  postPatch = ''
+    substituteInPlace configure \
+      --replace 'LIBINDICATOR_LIBS+="$LIBM"' 'LIBINDICATOR_LIBS+=" $LIBM"'
+    for f in {build-aux/ltmain.sh,configure,m4/libtool.m4}; do
+      substituteInPlace $f\
+        --replace /usr/bin/file ${file}/bin/file
+    done
+  '';
+
+  configureFlags = [
+    "CFLAGS=-Wno-error"
+    "--sysconfdir=/etc"
+    "--localstatedir=/var"
+    "--with-gtk=${gtkVersion}"
+  ];
+
+  installFlags = [
+    "sysconfdir=\${out}/etc"
+    "localstatedir=\${TMPDIR}"
+  ];
+
+  doCheck = false; # fails 8 out of 8 tests
+
+  meta = {
+    description = "A set of symbols and convenience functions for Ayatana indicators";
+    homepage = https://launchpad.net/libindicator;
+    license = licenses.gpl3;
+    platforms = platforms.linux;
+    maintainers = [ maintainers.msteen ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libinfinity/default.nix b/nixpkgs/pkgs/development/libraries/libinfinity/default.nix
new file mode 100644
index 000000000000..c57590aad218
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libinfinity/default.nix
@@ -0,0 +1,53 @@
+{ gtkWidgets ? false # build GTK widgets for libinfinity
+, avahiSupport ? false # build support for Avahi in libinfinity
+, stdenv, fetchurl, pkgconfig, glib, libxml2, gnutls, gsasl
+, gobject-introspection
+, gtk3 ? null, gtk-doc, docbook_xsl, docbook_xml_dtd_412, avahi ? null, libdaemon, libidn, gss
+, libintl }:
+
+assert avahiSupport -> avahi != null;
+assert gtkWidgets -> gtk3 != null;
+
+let
+  mkFlag = flag: feature: (if flag then "--with-" else "--without-") + feature;
+
+  self = stdenv.mkDerivation rec {
+    name = "libinfinity-${version}";
+    version = "0.7.1";
+    src = fetchurl {
+      url = "http://releases.0x539.de/libinfinity/${name}.tar.gz";
+      sha256 = "1jw2fhrcbpyz99bij07iyhy9ffyqdn87vl8cb1qz897y3f2f0vk2";
+    };
+
+    outputs = [ "bin" "out" "dev" "man" "devdoc" ];
+
+    nativeBuildInputs = [ pkgconfig 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;
+
+    propagatedBuildInputs = [ gnutls ];
+
+    configureFlags = [
+      "--enable-gtk-doc"
+      "--enable-introspection"
+      (mkFlag gtkWidgets "inftextgtk")
+      (mkFlag gtkWidgets "infgtk")
+      "--with-infinoted"
+      "--with-libdaemon"
+      (mkFlag avahiSupport "avahi")
+    ];
+
+    passthru = {
+      infinoted = "${self.bin}/bin/infinoted-${stdenv.lib.versions.majorMinor version}";
+    };
+
+    meta = {
+      homepage = http://gobby.0x539.de/;
+      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;
+    };
+  };
+in self
diff --git a/nixpkgs/pkgs/development/libraries/libinotify-kqueue/default.nix b/nixpkgs/pkgs/development/libraries/libinotify-kqueue/default.nix
new file mode 100644
index 000000000000..6fc507daf641
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libinotify-kqueue/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchzip, autoreconfHook }:
+
+stdenv.mkDerivation rec {
+  name = "libinotify-kqueue-${version}";
+  version = "20180201";
+
+  src = fetchzip {
+    url = "https://github.com/libinotify-kqueue/libinotify-kqueue/archive/${version}.tar.gz";
+    sha256 = "0dkh6n0ghhcl7cjkjmpin118h7al6i4vlkmw57vip5f6ngr6q3pl";
+  };
+
+  nativeBuildInputs = [ autoreconfHook ];
+
+  doCheck = true;
+  checkFlags = [ "test" ];
+
+  meta = with stdenv.lib; {
+    description = "Inotify shim for macOS and BSD";
+    homepage = https://github.com/libinotify-kqueue/libinotify-kqueue;
+    license = licenses.mit;
+    maintainers = with maintainers; [ yegortimoshenko ];
+    platforms = with platforms; darwin ++ freebsd ++ netbsd ++ openbsd;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libinput/default.nix b/nixpkgs/pkgs/development/libraries/libinput/default.nix
new file mode 100644
index 000000000000..651c43297082
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libinput/default.nix
@@ -0,0 +1,73 @@
+{ stdenv, fetchurl, pkgconfig, 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
+, testsSupport ? false, check ? null, valgrind ? null, python3 ? null
+}:
+
+assert documentationSupport -> doxygen != null && graphviz != null && python3 != null;
+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}";
+
+  sphinx-build = if documentationSupport then
+    python3.pkgs.sphinx.overrideAttrs (super: {
+      propagatedBuildInputs = super.propagatedBuildInputs ++ (with python3.pkgs; [ recommonmark sphinx_rtd_theme ]);
+
+      postFixup = super.postFixup or "" + ''
+        # Do not propagate Python
+        rm $out/nix-support/propagated-build-inputs
+      '';
+    })
+  else null;
+in
+
+with stdenv.lib;
+stdenv.mkDerivation rec {
+  name = "libinput-${version}";
+  version = "1.13.2";
+
+  src = fetchurl {
+    url = "https://www.freedesktop.org/software/libinput/${name}.tar.xz";
+    sha256 = "0vbapc90m49n0z8w8w4v0qf1iiwaixw9h79jfmps9pj8hdls17qx";
+  };
+
+  outputs = [ "bin" "out" "dev" ];
+
+  mesonFlags = [
+    (mkFlag documentationSupport "documentation")
+    (mkFlag eventGUISupport "debug-gui")
+    (mkFlag testsSupport "tests")
+    "--libexecdir=${placeholder "bin"}/libexec"
+  ];
+
+  nativeBuildInputs = [ pkgconfig meson ninja ]
+    ++ optionals documentationSupport [ doxygen graphviz sphinx-build ]
+    ++ optionals testsSupport [ valgrind ];
+
+  buildInputs = [ libevdev mtdev libwacom (python3.withPackages (pkgs: with pkgs; [ evdev ])) ]
+    ++ optionals eventGUISupport [ cairo glib gtk3 ]
+    ++ optionals testsSupport [ check ];
+
+  propagatedBuildInputs = [ udev ];
+
+  patches = [ ./udev-absolute-path.patch ];
+
+  postPatch = ''
+    patchShebangs tools/helper-copy-and-exec-from-tmp.sh
+    patchShebangs test/symbols-leak-test
+    patchShebangs test/check-leftover-udev-rules.sh
+  '';
+
+  doCheck = testsSupport && stdenv.hostPlatform == stdenv.buildPlatform;
+
+  meta = {
+    description = "Handles input devices in Wayland compositors and provides a generic X.Org input driver";
+    homepage    = http://www.freedesktop.org/wiki/Software/libinput;
+    license     = licenses.mit;
+    platforms   = platforms.unix;
+    maintainers = with maintainers; [ codyopel ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libinput/udev-absolute-path.patch b/nixpkgs/pkgs/development/libraries/libinput/udev-absolute-path.patch
new file mode 100644
index 000000000000..5c85b8639486
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libinput/udev-absolute-path.patch
@@ -0,0 +1,11 @@
+--- a/meson.build
++++ b/meson.build
+@@ -100,7 +100,7 @@
+      args : model_quirks)
+ 
+ udev_rules_config = configuration_data()
+-udev_rules_config.set('UDEV_TEST_PATH', '')
++udev_rules_config.set('UDEV_TEST_PATH', dir_udev + '/')
+ configure_file(input : 'udev/80-libinput-device-groups.rules.in',
+ 	       output : '80-libinput-device-groups.rules',
+ 	       install : true,
diff --git a/nixpkgs/pkgs/development/libraries/libiodbc/default.nix b/nixpkgs/pkgs/development/libraries/libiodbc/default.nix
new file mode 100644
index 000000000000..ad55c6cb18f3
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libiodbc/default.nix
@@ -0,0 +1,27 @@
+{ config, stdenv, fetchurl, pkgconfig, gtk2, Carbon
+, useGTK ? config.libiodbc.gtk or false }:
+
+stdenv.mkDerivation rec {
+  name = "libiodbc-3.52.12";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/iodbc/${name}.tar.gz";
+    sha256 = "0qpvklgr1lcn5g8xbz7fbc9rldqf9r8s6xybhqj20m4sglxgziai";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = stdenv.lib.optionals useGTK [ gtk2 ]
+                ++ stdenv.lib.optional stdenv.isDarwin Carbon;
+
+  preBuild =
+    ''
+      export NIX_LDFLAGS_BEFORE="-rpath $out/lib"
+    '';
+
+  meta = with stdenv.lib; {
+    description = "iODBC driver manager";
+    homepage = http://www.iodbc.org;
+    platforms = platforms.unix;
+    license = licenses.bsd3;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libipfix/default.nix b/nixpkgs/pkgs/development/libraries/libipfix/default.nix
new file mode 100644
index 000000000000..fea5a86da446
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libipfix/default.nix
@@ -0,0 +1,17 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "libipfix-${version}";
+  version = "110209";
+  src = fetchurl {
+    url = "mirror://sourceforge/libipfix/files/libipfix/libipfix_110209.tgz";
+    sha256 = "0h7v0sxjjdc41hl5vq2x0yhyn04bczl11bqm97825mivrvfymhn6";
+  };
+  meta = with stdenv.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;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ lewo ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libiptcdata/default.nix b/nixpkgs/pkgs/development/libraries/libiptcdata/default.nix
new file mode 100644
index 000000000000..8e1ca68a69e7
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libiptcdata/default.nix
@@ -0,0 +1,17 @@
+{stdenv, fetchurl}:
+
+stdenv.mkDerivation rec {
+  name = "libiptcdata-1.0.4";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/libiptcdata/${name}.tar.gz";
+    sha256 = "03pfvkmmx762iydq0q207x2028d275pbdysfsgpmrr0ywy63pxkr";
+  };
+
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libircclient/default.nix b/nixpkgs/pkgs/development/libraries/libircclient/default.nix
new file mode 100644
index 000000000000..71238dda1620
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libircclient/default.nix
@@ -0,0 +1,31 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name    = "${pname}-${version}";
+  version = "1.10";
+  pname   = "libircclient";
+
+  src = fetchurl {
+    url    = "mirror://sourceforge/${pname}/${pname}/${version}/${name}.tar.gz";
+    sha256 = "0b9wa0h3xc31wpqlvgxgnvqp5wgx3kwsf5s9432m5cj8ycx6zcmv";
+  };
+
+  outputs = [ "out" "dev" ];
+
+  configureFlags = [ "--enable-shared" ];
+
+  postPatch = ''
+    substituteInPlace src/Makefile.in \
+      --replace "@prefix@/include" "@prefix@/include/libircclient" \
+      --replace "@libdir@"         "@prefix@/lib" \
+      --replace "cp "              "install "
+  '';
+
+  meta = with stdenv.lib; {
+    description = "A small but extremely powerful library which implements the client IRC protocol";
+    homepage    = http://www.ulduzsoft.com/libircclient/;
+    license     = licenses.lgpl3;
+    maintainers = with maintainers; [ obadz ];
+    platforms   = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libisoburn/default.nix b/nixpkgs/pkgs/development/libraries/libisoburn/default.nix
new file mode 100644
index 000000000000..ce2028e805dc
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libisoburn/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, fetchurl, acl, attr, zlib, libburn, libisofs }:
+
+stdenv.mkDerivation rec {
+  name = "libisoburn-${version}";
+  version = "1.5.0";
+
+  src = fetchurl {
+    url = "http://files.libburnia-project.org/releases/${name}.tar.gz";
+    sha256 = "1r8xbhw21bmcp3jhfmvadivh0fa7f4k6larv8lvg4ka0kiigbhfs";
+  };
+
+  buildInputs = [ attr zlib libburn libisofs ];
+  propagatedBuildInputs = [ acl ];
+
+  meta = with stdenv.lib; {
+    homepage = http://libburnia-project.org/;
+    description = "Enables creation and expansion of ISO-9660 filesystems on CD/DVD/BD ";
+    license = licenses.gpl2Plus;
+    maintainers = with maintainers; [ vrthra ];
+    platforms = with platforms; linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libisofs/default.nix b/nixpkgs/pkgs/development/libraries/libisofs/default.nix
new file mode 100644
index 000000000000..d52814483870
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libisofs/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, fetchurl, acl, attr, zlib }:
+
+stdenv.mkDerivation rec {
+  name = "libisofs-${version}";
+  version = "1.5.0";
+
+  src = fetchurl {
+    url = "http://files.libburnia-project.org/releases/${name}.tar.gz";
+    sha256 = "001l3akf3wb6msl9man776w560iqyvsbwwzs7d7y7msx13irspys";
+  };
+
+  buildInputs = [ attr zlib ];
+  propagatedBuildInputs = [ acl ];
+
+  meta = with stdenv.lib; {
+    homepage = http://libburnia-project.org/;
+    description = "A library to create an ISO-9660 filesystem with extensions like RockRidge or Joliet";
+    license = licenses.gpl2Plus;
+    maintainers = with maintainers; [ abbradar vrthra ];
+    platforms = with platforms; linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libite/default.nix b/nixpkgs/pkgs/development/libraries/libite/default.nix
new file mode 100644
index 000000000000..0b00cf90ba00
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libite/default.nix
@@ -0,0 +1,37 @@
+{ stdenv, fetchFromGitHub, autoreconfHook, pkgconfig, libconfuse }:
+
+stdenv.mkDerivation rec {
+  name = "libite-${version}";
+  version = "2.0.2";
+
+  src = fetchFromGitHub {
+    owner = "troglobit";
+    repo = "libite";
+    rev = "v${version}";
+    sha256 = "0qk7231c1xwvjhkc9w7hasvafvgns10cx9kdhfdbc4r1hsh6d1ca";
+  };
+
+  nativeBuildInputs = [ autoreconfHook pkgconfig ];
+  buildInputs = [ libconfuse ];
+
+  meta = with stdenv.lib; {
+    inherit (src.meta) homepage;
+    description = "Lightweight library of frog DNA";
+    longDescription = ''
+      Libite is a lightweight library of frog DNA. It can be used to fill
+      the gaps in any dinosaur project. It holds useful functions and macros
+      developed by both Finit and the OpenBSD project. Most notably the
+      string functions: strlcpy(3), strlcat(3) and the highly useful *BSD
+      sys/queue.h and sys/tree.h API's.
+
+      Libite is the frog DNA missing in GNU libc. However, -lite does not
+      aim to become another GLIB! One noticeable gap in GLIBC is the missing
+      _SAFE macros in the BSD sys/queue.h API — highly recommended when
+      traversing lists to delete/free nodes.
+    '';
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ fpletz ];
+    license = with licenses; [ mit isc bsd2 bsd3 ];
+  };
+}
+
diff --git a/nixpkgs/pkgs/development/libraries/libivykis/default.nix b/nixpkgs/pkgs/development/libraries/libivykis/default.nix
new file mode 100644
index 000000000000..9419046db4ed
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libivykis/default.nix
@@ -0,0 +1,26 @@
+{ stdenv, fetchurl, autoreconfHook, pkgconfig, file, protobufc }:
+
+stdenv.mkDerivation rec {
+  name = "libivykis-${version}";
+
+  version = "0.42.3";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/libivykis/${version}/ivykis-${version}.tar.gz";
+    sha256 = "1v0ajkm531v4zxzn2x90yb5ab81ssqv2y0fib24wbsggbkajbc69";
+  };
+
+  nativeBuildInputs = [ autoreconfHook pkgconfig ];
+  buildInputs = [ file protobufc ];
+
+  meta = with stdenv.lib; {
+    homepage = http://libivykis.sourceforge.net/;
+    description = ''
+      A thin wrapper over various OS'es implementation of I/O readiness
+      notification facilities
+    '';
+    license = licenses.zlib;
+    maintainers = [ maintainers.rickynils ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libixp-hg/default.nix b/nixpkgs/pkgs/development/libraries/libixp-hg/default.nix
new file mode 100644
index 000000000000..68835c1414c3
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libixp-hg/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchurl, unzip, txt2tags }:
+
+stdenv.mkDerivation rec {
+  rev = "148";
+  version = "hg-2012-12-02";
+  name = "libixp-${version}";
+
+  src = fetchurl {
+    url = https://storage.googleapis.com/google-code-archive-source/v2/code.google.com/libixp/source-archive.zip;
+    sha256 = "0kcdvdcrkw6q39v563ncis6d7ini64xbgn5fd3b4aa95fp9sj3is";
+  };
+
+  configurePhase = ''
+   sed -i -e "s|^PREFIX.*=.*$|PREFIX = $out|" config.mk
+  '';
+
+  buildInputs = [ unzip txt2tags ];
+
+  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;
+    inherit version;
+    platforms = with stdenv.lib.platforms; unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libjpeg-drop/default.nix b/nixpkgs/pkgs/development/libraries/libjpeg-drop/default.nix
new file mode 100644
index 000000000000..0f2c9dce28a2
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libjpeg-drop/default.nix
@@ -0,0 +1,36 @@
+{ stdenv, fetchurl, static ? true }:
+
+with stdenv.lib;
+
+stdenv.mkDerivation rec {
+  name = "libjpeg-drop-9b";
+
+  srcs = [
+    (fetchurl {
+      url = http://www.ijg.org/files/jpegsrc.v9b.tar.gz;
+      sha256 = "0lnhpahgdwlrkd41lx6cr90r199f8mc6ydlh7jznj5klvacd63r4";
+    })
+    (fetchurl {
+      url = http://jpegclub.org/droppatch.v9b.tar.gz;
+      sha256 = "022bnvpird7w5pwbfqpq7j7pwja5kp6x9k3sdypcy3g2nwwy2wwk";
+    })
+  ];
+
+  postUnpack = ''
+    rm jpegtran
+    mv jpegtran.c jpeg-9b/jpegtran.c
+    mv transupp.c jpeg-9b/transupp.c
+    mv transupp.h jpeg-9b/transupp.h
+  '';
+
+  configureFlags = []
+    ++ optional static [ "--enable-static" "--disable-shared" ];
+
+  outputs = [ "bin" "dev" "out" "man" ];
+
+  meta = {
+    homepage = http://jpegclub.org/jpegtran/;
+    description = "Experimental lossless crop 'n' drop (cut & paste) patches for libjpeg";
+    license = stdenv.lib.licenses.free;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libjpeg-turbo/default.nix b/nixpkgs/pkgs/development/libraries/libjpeg-turbo/default.nix
new file mode 100644
index 000000000000..57c35ab86777
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libjpeg-turbo/default.nix
@@ -0,0 +1,33 @@
+{ stdenv, fetchurl, fetchpatch, cmake, nasm }:
+
+stdenv.mkDerivation rec {
+
+  pname = "libjpeg-turbo";
+  version = "2.0.2";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/${pname}/${pname}-${version}.tar.gz";
+    sha256 = "1v9gx1gdzgxf51nd55ncq7rghmj4x9x91rby50ag36irwngmkf5c";
+  };
+
+  patches =
+    stdenv.lib.optional (stdenv.hostPlatform.libc or null == "msvcrt")
+      ./mingw-boolean.patch;
+
+  outputs = [ "bin" "dev" "out" "man" "doc" ];
+
+  nativeBuildInputs = [ cmake nasm ];
+
+  cmakeFlags = [ "-DCMAKE_INSTALL_BINDIR=${placeholder "bin"}/bin" "-DENABLE_STATIC=0" ];
+
+  doInstallCheck = true;
+  installCheckTarget = "test";
+
+  meta = with stdenv.lib; {
+    homepage = http://libjpeg-turbo.virtualgl.org/;
+    description = "A faster (using SIMD) libjpeg implementation";
+    license = licenses.ijg; # and some parts under other BSD-style licenses
+    maintainers = [ maintainers.vcunat ];
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libjpeg-turbo/mingw-boolean.patch b/nixpkgs/pkgs/development/libraries/libjpeg-turbo/mingw-boolean.patch
new file mode 100644
index 000000000000..9b9483d63987
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libjpeg-turbo/mingw-boolean.patch
@@ -0,0 +1,19 @@
+Ported to updated libjpeg-turbo from
+https://github.com/msys2/MINGW-packages/blob/master/mingw-w64-libjpeg-turbo/jpeg-typedefs.patch
+--- a/jmorecfg.h	2012-02-10 06:47:55 +0300
++++ b/jmorecfg.h	2012-05-03 10:29:13 +0400
+@@ -224,7 +224,13 @@
+  * Defining HAVE_BOOLEAN before including jpeglib.h should make it work.
+  */
+ 
+-#ifndef HAVE_BOOLEAN
++#if defined(_WIN32) && !defined(HAVE_BOOLEAN)
++#ifndef __RPCNDR_H__
++typedef unsigned char boolean;
++#endif
++#define HAVE_BOOLEAN
++#endif
++#if !defined(HAVE_BOOLEAN) && !defined(__RPCNDR_H__)
+ typedef int boolean;
+ #endif
+ #ifndef FALSE			/* in case these macros already exist */
diff --git a/nixpkgs/pkgs/development/libraries/libjpeg/builder.sh b/nixpkgs/pkgs/development/libraries/libjpeg/builder.sh
new file mode 100755
index 000000000000..58ca9a790baf
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libjpeg/builder.sh
@@ -0,0 +1,25 @@
+source $stdenv/setup
+
+preConfigure() {
+    # Workarounds for the ancient libtool shipped by libjpeg.
+    ln -s $libtool/bin/libtool .
+    cp $libtool/share/libtool/config.guess .
+    cp $libtool/share/libtool/config.sub .
+}
+
+preInstall() {
+    mkdir $out
+    mkdir $out/bin
+    mkdir $out/lib
+    mkdir $out/include
+    mkdir $out/man
+    mkdir $out/man/man1
+}
+
+patchPhase() {
+    for i in $patches; do
+	patch < $i
+    done
+}
+
+genericBuild
diff --git a/nixpkgs/pkgs/development/libraries/libjpeg/default.nix b/nixpkgs/pkgs/development/libraries/libjpeg/default.nix
new file mode 100644
index 000000000000..96dbd463370b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libjpeg/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchurl, static ? false }:
+
+with stdenv.lib;
+
+stdenv.mkDerivation {
+  name = "libjpeg-9c";
+
+  src = fetchurl {
+    url = http://www.ijg.org/files/jpegsrc.v9c.tar.gz;
+    sha256 = "08kixcf3a7s9x91174abjnk1xbvj4v8crdc73zi4k9h3jfbm00k5";
+  };
+
+  configureFlags = optional static "--enable-static --disable-shared";
+
+  outputs = [ "bin" "dev" "out" "man" ];
+
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libjreen/default.nix b/nixpkgs/pkgs/development/libraries/libjreen/default.nix
new file mode 100644
index 000000000000..2167b4477034
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libjreen/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, fetchurl, cmake, qt4, pkgconfig, gsasl }:
+
+stdenv.mkDerivation rec {
+  name = "libjreen-${version}";
+  version = "1.2.0";
+
+  src = fetchurl {
+    url = "https://qutim.org/dwnl/73/${name}.tar.bz2";
+    sha256 = "14nwwk40xx8w6x7yaysgcr0lgzhs7l064f7ikp32s5y9a8mmp582";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ cmake qt4 gsasl ];
+  enableParallelBuilding = true;
+
+  meta = {
+    description = "C++ Jabber library using Qt framework";
+    homepage = https://qutim.org/jreen/;
+    license = stdenv.lib.licenses.gpl2Plus;
+    platforms = stdenv.lib.platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libjson-rpc-cpp/default.nix b/nixpkgs/pkgs/development/libraries/libjson-rpc-cpp/default.nix
new file mode 100644
index 000000000000..f352c8e9ed19
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libjson-rpc-cpp/default.nix
@@ -0,0 +1,67 @@
+{ stdenv, fetchFromGitHub, cmake, jsoncpp, argtable, curl, libmicrohttpd
+, doxygen, catch, pkgconfig
+}:
+
+stdenv.mkDerivation rec {
+  name = "libjson-rpc-cpp-${version}";
+  version = "0.7.0";
+
+  src = fetchFromGitHub {
+    owner = "cinemast";
+    repo = "libjson-rpc-cpp";
+    sha256 = "07bg4nyvx0yyhy8c4x9i22kwqpx5jlv36dvpabgbb46ayyndhr7a";
+    rev = "v${version}";
+  };
+
+  NIX_CFLAGS_COMPILE = "-I${catch}/include/catch";
+
+  postPatch = ''
+    for f in cmake/FindArgtable.cmake \
+             src/stubgenerator/stubgenerator.cpp \
+             src/stubgenerator/stubgeneratorfactory.cpp
+    do
+      sed -i -re 's/argtable2/argtable3/g' $f
+    done
+
+    sed -i -re 's#MATCHES "jsoncpp"#MATCHES ".*/jsoncpp/json$"#g' cmake/FindJsoncpp.cmake
+  '';
+
+  configurePhase = ''
+    mkdir -p Build/Install
+    pushd Build
+
+    cmake .. -DCMAKE_INSTALL_PREFIX=$(pwd)/Install \
+             -DCMAKE_BUILD_TYPE=Release
+  '';
+
+  installPhase = ''
+    mkdir -p $out
+
+    function fixRunPath {
+      p=$(patchelf --print-rpath $1)
+      q="$p:${stdenv.lib.makeLibraryPath [ jsoncpp argtable libmicrohttpd curl ]}:$out/lib"
+      patchelf --set-rpath $q $1
+    }
+
+    make install
+
+    sed -i -re "s#-([LI]).*/Build/Install(.*)#-\1$out\2#g" Install/lib/pkgconfig/*.pc
+    for f in Install/lib/*.so* $(find Install/bin -executable -type f); do
+      fixRunPath $f
+    done
+
+    cp -r Install/* $out
+  '';
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ cmake jsoncpp argtable curl libmicrohttpd doxygen catch ];
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    description = "C++ framework for json-rpc (json remote procedure call)";
+    homepage = https://github.com/cinemast/libjson-rpc-cpp;
+    license = licenses.mit;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libjson/default.nix b/nixpkgs/pkgs/development/libraries/libjson/default.nix
new file mode 100644
index 000000000000..c83143dd6b13
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libjson/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchurl, unzip }:
+let
+  version = "7.6.1";
+in stdenv.mkDerivation rec {
+  name = "libjson-${version}";
+  src = fetchurl {
+    url = "mirror://sourceforge/libjson/libjson_${version}.zip";
+    sha256 = "0xkk5qc7kjcdwz9l04kmiz1nhmi7iszl3k165phf53h3a4wpl9h7";
+  };
+  patches = [ ./install-fix.patch ];
+  buildInputs = [ unzip ];
+  makeFlags = [ "prefix=$(out)" ];
+  preInstall = "mkdir -p $out/lib";
+
+  meta = with stdenv.lib; {
+    homepage = http://libjson.sourceforge.net/;
+    description = "A JSON reader and writer";
+    longDescription = ''
+      A JSON reader and writer which is super-efficient and
+      usually runs circles around other JSON libraries.
+      It's highly customizable to optimize for your particular project, and
+      very lightweight. For Windows, OSX, or Linux. Works in any language.
+    '';
+    platforms = platforms.unix;
+    license = licenses.bsd2;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libjson/install-fix.patch b/nixpkgs/pkgs/development/libraries/libjson/install-fix.patch
new file mode 100644
index 000000000000..f074c8ba3aa5
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libjson/install-fix.patch
@@ -0,0 +1,12 @@
+diff -Naur libjson-orig/makefile libjson/makefile
+--- libjson-orig/makefile	2012-05-30 05:15:42.000000000 -0400
++++ libjson/makefile	2013-08-15 09:17:41.154245534 -0400
+@@ -266,7 +266,7 @@
+ 	cp -r ./$(srcdir)/JSONDefs $(include_path)/$(libname_hdr)/$(srcdir)
+ 	chmod -R a+r $(include_path)/$(libname_hdr)
+ 	find  $(include_path)/$(libname_hdr) -type d -exec chmod a+x {} \;
+-	cp -rv $(srcdir)/Dependencies/ $(include_path)/$(libname_hdr)/$(srcdir)
++	cp -rv $(srcdir)/../Dependencies/ $(include_path)/$(libname_hdr)/$(srcdir)/..
+ 	@echo "Install header files: Done."
+ 
+ clean: banner
diff --git a/nixpkgs/pkgs/development/libraries/libkate/default.nix b/nixpkgs/pkgs/development/libraries/libkate/default.nix
new file mode 100644
index 000000000000..7eff302397aa
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libkate/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchurl, libogg, libpng }:
+
+stdenv.mkDerivation rec {
+  name = "libkate-0.4.1";
+
+  src = fetchurl {
+    url = "https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/libkate/${name}.tar.gz";
+    sha256 = "0s3vr2nxfxlf1k75iqpp4l78yf4gil3f0v778kvlngbchvaq23n4";
+  };
+
+  buildInputs = [ libogg libpng ];
+
+  meta = with stdenv.lib; {
+    description = "A library for encoding and decoding Kate streams";
+    longDescription = ''
+      This is libkate, the reference implementation of a codec for the Kate
+      bitstream format. Kate is a karaoke and text codec meant for encapsulation
+      in an Ogg container. It can carry Unicode text, images, and animate
+      them.'';
+    homepage = https://code.google.com/archive/p/libkate/;
+    platforms = platforms.unix;
+    license = licenses.bsd3;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libkeyfinder/default.nix b/nixpkgs/pkgs/development/libraries/libkeyfinder/default.nix
new file mode 100644
index 000000000000..93f3b2a4f84d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libkeyfinder/default.nix
@@ -0,0 +1,38 @@
+{ stdenv, fetchFromGitHub, fftw, qtbase, qmake }:
+
+stdenv.mkDerivation rec {
+  name = "libkeyfinder-${version}";
+  version = "2.1";
+
+  src = fetchFromGitHub {
+    sha256 = "07kc0cl6kirgmpdgkgmp6r3yvyf7b1w569z01g8rfl1cig80qdc7";
+    rev = "v${version}";
+    repo = "libKeyFinder";
+    owner = "ibsh";
+  };
+
+  nativeBuildInputs = [ qmake ];
+  buildInputs = [ fftw qtbase ];
+
+  postPatch = ''
+    substituteInPlace LibKeyFinder.pro \
+      --replace "/usr/local" "$out" \
+      --replace "-stdlib=libc++" ""
+  '';
+
+  enableParallelBuilding = true;
+
+  postInstall = ''
+    mkdir -p $out/include/keyfinder
+    install -m644 *.h $out/include/keyfinder
+    mkdir -p $out/lib
+    cp -a lib*.so* $out/lib
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Musical key detection for digital audio (C++ library)";
+    homepage = http://www.ibrahimshaath.co.uk/keyfinder/;
+    license = licenses.gpl3Plus;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libksba/default.nix b/nixpkgs/pkgs/development/libraries/libksba/default.nix
new file mode 100644
index 000000000000..c83a3e40df27
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libksba/default.nix
@@ -0,0 +1,31 @@
+{ buildPackages, stdenv, fetchurl, gettext, libgpgerror }:
+
+stdenv.mkDerivation rec {
+  name = "libksba-1.3.5";
+
+  src = fetchurl {
+    url = "mirror://gnupg/libksba/${name}.tar.bz2";
+    sha256 = "0h53q4sns1jz1pkmhcz5wp9qrfn9f5g9i3vjv6dafwzzlvblyi21";
+  };
+
+  outputs = [ "out" "dev" "info" ];
+
+  buildInputs = [ gettext ];
+  propagatedBuildInputs = [ libgpgerror ];
+  depsBuildBuild = [ buildPackages.stdenv.cc ];
+
+  configureFlags = [ "--with-libgpg-error-prefix=${libgpgerror.dev}" ];
+
+  postInstall = ''
+    mkdir -p $dev/bin
+    mv $out/bin/*-config $dev/bin/
+    rmdir --ignore-fail-on-non-empty $out/bin
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = https://www.gnupg.org;
+    description = "CMS and X.509 access library";
+    platforms = platforms.all;
+    license = licenses.lgpl3;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libksi/default.nix b/nixpkgs/pkgs/development/libraries/libksi/default.nix
new file mode 100644
index 000000000000..92e7d26f5afa
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libksi/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchFromGitHub, autoreconfHook, openssl, curl }:
+
+stdenv.mkDerivation rec {
+  name = "libksi-2015-07-03";
+
+  src = fetchFromGitHub {
+    owner = "Guardtime";
+    repo = "libksi";
+    rev = "b82dd65bd693722db92397cbe0920170e0d2ae1c";
+    sha256 = "1sqd31l55kx6knl0sg26ail1k5rgmamq8760p6aj7bpb4jwb8r1n";
+  };
+
+  nativeBuildInputs = [ autoreconfHook ];
+  buildInputs = [ openssl curl ];
+
+  configureFlags = [
+    "--with-openssl=${openssl.dev}"
+    "--with-cafile=/etc/ssl/certs/ca-certificates.crt"
+  ];
+
+  meta = with stdenv.lib; {
+    homepage = https://github.com/GuardTime/libksi;
+    description = "Keyless Signature Infrastructure API library";
+    license = licenses.asl20;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libktorrent/default.nix b/nixpkgs/pkgs/development/libraries/libktorrent/default.nix
new file mode 100644
index 000000000000..8b5f189a9e1e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libktorrent/default.nix
@@ -0,0 +1,37 @@
+{ stdenv, fetchurl, cmake, extra-cmake-modules
+, karchive, kcrash, ki18n, kio, solid
+, boost, gmp, qca-qt5, libgcrypt
+}:
+
+let
+    mainVersion = "5.1";
+
+in stdenv.mkDerivation rec {
+  name = "libktorrent-2.1";
+
+  src = fetchurl {
+    url    = "mirror://kde/stable/ktorrent/${mainVersion}/${name}.tar.xz";
+    sha256 = "0vz2dwc4xd80q56g6r5bx5wqdl9fxcibxmw2irahqhbkxk7drvry";
+  };
+
+  outputs = [ "out" "dev" ];
+
+  nativeBuildInputs = [ cmake extra-cmake-modules ];
+
+  buildInputs = [ karchive kcrash ki18n kio solid qca-qt5 libgcrypt ];
+
+  propagatedBuildInputs = [ gmp boost ];
+
+  enableParallelBuilding = true;
+
+  passthru = {
+    inherit mainVersion;
+  };
+
+  meta = with stdenv.lib; {
+    description = "A BitTorrent library used by KTorrent";
+    homepage    = https://www.kde.org/applications/internet/ktorrent/;
+    maintainers = with maintainers; [ eelco ];
+    platforms   = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/liblangtag/default.nix b/nixpkgs/pkgs/development/libraries/liblangtag/default.nix
new file mode 100644
index 000000000000..24dd34d7a6a3
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/liblangtag/default.nix
@@ -0,0 +1,52 @@
+{stdenv, fetchurl, fetchFromBitbucket, autoreconfHook, gtk-doc, gettext
+, pkgconfig, glib, libxml2, gobject-introspection, gnome-common, unzip
+}:
+
+stdenv.mkDerivation rec {
+  name = "${pname}-${version}";
+  pname = "liblangtag";
+  version = "0.6.1";
+
+  src = fetchFromBitbucket {
+    owner = "tagoh";
+    repo = "${pname}";
+    rev = "${version}";
+    sha256 = "19dk2qsg7f3ig9xz8d73jvikmf5kvrwi008wrz2psxinbdml442g";
+  };
+
+  core_zip = fetchurl {
+    # please update if an update is available
+    url = "http://www.unicode.org/Public/cldr/33.1/core.zip";
+    sha256 = "0f195aald02ng3ch2q1wf59b5lwp2bi1cd8ia7572pbyy2w8w8cp";
+  };
+
+  language_subtag_registry = fetchurl {
+    url = "http://www.iana.org/assignments/language-subtag-registry";
+    sha256 = "0y9x5gra6jri4sk16f0dp69p06almnsl48rs85605f035kf539qm";
+  };
+
+  postPatch = ''
+    gtkdocize
+    cp "${core_zip}" data/core.zip
+    touch data/stamp-core-zip
+    cp "${language_subtag_registry}" data/language-subtag-registry
+  '';
+
+  configureFlags = [
+    ''--with-locale-alias=${stdenv.cc.libc}/share/locale/locale.alias''
+  ];
+
+  buildInputs = [ gettext glib libxml2 gobject-introspection gnome-common
+    unzip ];
+  nativeBuildInputs = [ autoreconfHook gtk-doc gettext pkgconfig ];
+
+  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;
+    # There are links to a homepage that are broken by a BitBucket change
+    homepage = "https://bitbucket.org/tagoh/liblangtag/overview";
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/liblastfm/default.nix b/nixpkgs/pkgs/development/libraries/liblastfm/default.nix
new file mode 100644
index 000000000000..b7d90100837c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/liblastfm/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchurl, qt4, pkgconfig, libsamplerate, fftwSinglePrec, which, cmake
+, darwin }:
+
+let version = "1.0.9"; in
+
+stdenv.mkDerivation rec {
+  name = "liblastfm-${version}";
+
+  # Upstream does not package git tags as tarballs. Get tarball from github.
+  src = fetchurl {
+    url = "https://github.com/lastfm/liblastfm/tarball/${version}";
+    name = "${name}.tar.gz";
+    sha256 = "09qiaxsxw6g2m7mvkffpfsi5wis8nl1x4lgnk0sa30859z54iw53";
+  };
+
+  prefixKey = "--prefix ";
+  propagatedBuildInputs = [ qt4 libsamplerate fftwSinglePrec ];
+  nativeBuildInputs = [ pkgconfig which cmake ];
+  buildInputs = stdenv.lib.optional stdenv.isDarwin darwin.apple_sdk.frameworks.SystemConfiguration;
+
+  meta = with stdenv.lib; {
+    homepage = https://github.com/lastfm/liblastfm;
+    repositories.git = git://github.com/lastfm/liblastfm.git;
+    description = "Official LastFM library";
+    inherit (qt4.meta) platforms;
+    maintainers =  [ maintainers.phreedom ];
+    license = licenses.gpl3;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/liblastfmSF/default.nix b/nixpkgs/pkgs/development/libraries/liblastfmSF/default.nix
new file mode 100644
index 000000000000..d9f460d44e8c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/liblastfmSF/default.nix
@@ -0,0 +1,20 @@
+{ stdenv, fetchurl, pkgconfig, curl, openssl }:
+
+stdenv.mkDerivation rec {
+  name = "liblastfm-SF-0.5";
+
+  nativeBuildInputs = [ pkgconfig ];
+
+  propagatedBuildInputs = [ curl openssl ];
+
+  src = fetchurl {
+    url = "mirror://sourceforge/liblastfm/libclastfm-0.5.tar.gz";
+    sha256 = "0hpfflvfx6r4vvsbvdc564gkby8kr07p8ma7hgpxiy2pnlbpian9";
+  };
+
+  meta = {
+    homepage = http://liblastfm.sourceforge.net;
+    description = "Unofficial C lastfm library";
+    license = stdenv.lib.licenses.gpl3;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/liblaxjson/default.nix b/nixpkgs/pkgs/development/libraries/liblaxjson/default.nix
new file mode 100644
index 000000000000..cafd6a66aa00
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/liblaxjson/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchFromGitHub, cmake }:
+
+stdenv.mkDerivation rec {
+  version = "1.0.5";
+  name = "liblaxjson-${version}";
+
+  src = fetchFromGitHub {
+    owner = "andrewrk";
+    repo = "liblaxjson";
+    rev = "${version}";
+    sha256 = "01iqbpbhnqfifhv82m6hi8190w5sdim4qyrkss7z1zyv3gpchc5s";
+  };
+
+  buildInputs = [ cmake ];
+
+  meta = with stdenv.lib; {
+    description = "Library for parsing JSON config files";
+    homepage = https://github.com/andrewrk/liblaxjson;
+    license = licenses.mit;
+    platforms = platforms.unix;
+    maintainers = [ maintainers.andrewrk ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/liblcf/default.nix b/nixpkgs/pkgs/development/libraries/liblcf/default.nix
new file mode 100644
index 000000000000..313780a9f0f0
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/liblcf/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchFromGitHub, autoreconfHook, pkgconfig, expat, icu }:
+
+stdenv.mkDerivation rec {
+  name = "liblcf-${version}";
+  version = "0.6.0";
+
+  src = fetchFromGitHub {
+    owner = "EasyRPG";
+    repo = "liblcf";
+    rev = version;
+    sha256 = "1nhwwb32c3x0y82s0w93k0xz8h6xsd0sb4r1a0my8fd8p5rsnwbi";
+  };
+
+  nativeBuildInputs = [ autoreconfHook pkgconfig ];
+  propagatedBuildInputs = [ expat icu ];
+
+  meta = with stdenv.lib; {
+    description = "Library to handle RPG Maker 2000/2003 and EasyRPG projects";
+    homepage = https://github.com/EasyRPG/liblcf;
+    license = licenses.mit;
+    maintainers = with maintainers; [ yegortimoshenko ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/liblinear/default.nix b/nixpkgs/pkgs/development/libraries/liblinear/default.nix
new file mode 100644
index 000000000000..1a177dc22374
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/liblinear/default.nix
@@ -0,0 +1,39 @@
+{stdenv, fetchurl}:
+
+stdenv.mkDerivation rec {
+  name = "liblinear-${version}";
+  version = "2.30";
+
+  src = fetchurl {
+    url = "https://www.csie.ntu.edu.tw/~cjlin/liblinear/liblinear-${version}.tar.gz";
+    sha256 = "1b66jpg9fdwsq7r52fccr8z7nqcivrin5d8zg2f134ygqqwp0748";
+  };
+
+  buildPhase = ''
+    make
+    make lib
+  '';
+
+  installPhase = let
+    libSuff = stdenv.hostPlatform.extensions.sharedLibrary;
+  in ''
+    mkdir -p $out/lib $out/bin $out/include
+    cp liblinear.so.3 $out/lib/liblinear.3${libSuff}
+    ln -s $out/lib/liblinear.3${libSuff} $out/lib/liblinear${libSuff}
+    cp train $out/bin/liblinear-train
+    cp predict $out/bin/liblinear-predict
+    cp linear.h $out/include
+  '';
+
+  postFixup = stdenv.lib.optionalString stdenv.isDarwin ''
+    install_name_tool -id liblinear.3.dylib $out/lib/liblinear.3.dylib
+  '';
+
+  meta = with stdenv.lib; {
+    description = "A library for large linear classification";
+    homepage = https://www.csie.ntu.edu.tw/~cjlin/liblinear/;
+    license = licenses.bsd3;
+    maintainers = [ maintainers.danieldk ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/liblo/default.nix b/nixpkgs/pkgs/development/libraries/liblo/default.nix
new file mode 100644
index 000000000000..2ba5750b1bf3
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/liblo/default.nix
@@ -0,0 +1,20 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "liblo-0.30";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/liblo/liblo/0.30/${name}.tar.gz";
+    sha256 = "06wdjzxjdshr6hyl4c94yvg3jixiylap8yjs8brdfpm297gck9rh";
+  };
+
+  doCheck = false; # fails 1 out of 3 tests
+
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/liblockfile/default.nix b/nixpkgs/pkgs/development/libraries/liblockfile/default.nix
new file mode 100644
index 000000000000..46ea9fe6ee59
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/liblockfile/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  _name   = "liblockfile";
+  version = "1.14";
+  name    = "${_name}-${version}";
+
+  src = fetchurl {
+    url = "mirror://debian/pool/main/libl/${_name}/${_name}_${version}.orig.tar.gz";
+    sha256 = "0q6hn78fnzr6lhisg85a948rmpsd9rx67skzx3vh9hnbx2ix8h5b";
+  };
+
+  preConfigure = ''
+    sed -i -e 's/ -g [^ ]* / /' Makefile.in
+  '';
+
+  preInstall = ''
+    mkdir -p $out/{bin,lib,include,man} $out/man/man{1,3}
+  '';
+
+  meta = {
+    description = "Shared library with NFS-safe locking functions";
+    homepage = http://packages.debian.org/unstable/libs/liblockfile1;
+    license = stdenv.lib.licenses.gpl2Plus;
+
+    maintainers = [ stdenv.lib.maintainers.bluescreen303 ];
+    platforms = stdenv.lib.platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/liblogging/default.nix b/nixpkgs/pkgs/development/libraries/liblogging/default.nix
new file mode 100644
index 000000000000..d0aaebadbaad
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/liblogging/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchurl, pkgconfig
+, systemd ? null
+}:
+
+stdenv.mkDerivation rec {
+  name = "liblogging-1.0.6";
+
+  src = fetchurl {
+    url = "http://download.rsyslog.com/liblogging/${name}.tar.gz";
+    sha256 = "14xz00mq07qmcgprlj5b2r21ljgpa4sbwmpr6jm2wrf8wms6331k";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ systemd ];
+
+  configureFlags = [
+    "--enable-rfc3195"
+    "--enable-stdlog"
+    (if systemd != null then "--enable-journal" else "--disable-journal")
+    "--enable-man-pages"
+  ];
+
+  meta = with stdenv.lib; {
+    homepage = http://www.liblogging.org/;
+    description = "Lightweight signal-safe logging library";
+    license = licenses.bsd2;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/liblognorm/default.nix b/nixpkgs/pkgs/development/libraries/liblognorm/default.nix
new file mode 100644
index 000000000000..d77b452e3e92
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/liblognorm/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, fetchurl, pkgconfig, libestr, json_c, pcre, fastJson }:
+
+stdenv.mkDerivation rec {
+  name = "liblognorm-2.0.6";
+
+  src = fetchurl {
+    url = "http://www.liblognorm.com/files/download/${name}.tar.gz";
+    sha256 = "1wpn15c617r7lfm1z9d5aggmmi339s6yn4pdz698j0r2bkl5gw6g";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ libestr json_c pcre fastJson ];
+
+  configureFlags = [ "--enable-regexp" ];
+
+  meta = with stdenv.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;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/liblouis/default.nix b/nixpkgs/pkgs/development/libraries/liblouis/default.nix
new file mode 100644
index 000000000000..a3af7aab526d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/liblouis/default.nix
@@ -0,0 +1,57 @@
+{ fetchFromGitHub, stdenv, autoreconfHook, pkgconfig, gettext, python3
+, texinfo, help2man, libyaml, perl
+}:
+
+let
+  version = "3.9.0";
+in stdenv.mkDerivation rec {
+  name = "liblouis-${version}";
+
+  src = fetchFromGitHub {
+    owner = "liblouis";
+    repo = "liblouis";
+    rev = "v${version}";
+    sha256 = "11vq9rnmrfqka3fiyrxs0q1gpvpj4m9jmrkwd1yvrq94fndgvh1m";
+  };
+
+  outputs = [ "out" "dev" "man" "info" "doc" ];
+
+  nativeBuildInputs = [
+    autoreconfHook pkgconfig gettext python3
+    # Docs, man, info
+    texinfo help2man
+  ];
+
+  buildInputs = [
+    # lou_checkYaml
+    libyaml
+    # maketable.d
+    perl
+  ];
+
+  configureFlags = [
+    # Required by Python bindings
+    "--enable-ucs4"
+  ];
+
+  postPatch = ''
+    patchShebangs tests
+    substituteInPlace python/louis/__init__.py.in --replace "###LIBLOUIS_SONAME###" "$out/lib/liblouis.so"
+  '';
+
+  postInstall = ''
+    pushd python
+    python setup.py install --prefix="$out" --optimize=1
+    popd
+  '';
+
+  doCheck = true;
+
+  meta = with stdenv.lib; {
+    description = "Open-source braille translator and back-translator";
+    homepage = http://liblouis.org/;
+    license = licenses.lgpl21;
+    maintainers = with maintainers; [ jtojnar ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/liblqr-1/default.nix b/nixpkgs/pkgs/development/libraries/liblqr-1/default.nix
new file mode 100644
index 000000000000..aa6922ea3421
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/liblqr-1/default.nix
@@ -0,0 +1,20 @@
+{ stdenv, fetchurl, pkgconfig, glib }:
+
+stdenv.mkDerivation rec {
+  name = "liblqr-1-0.4.2";
+
+  src = fetchurl {
+    url = "${meta.homepage}/local--files/en:download-page/${name}.tar.bz2";
+    sha256 = "0dzikxzjz5zmy3vnydh90aqk23q0qm8ykx6plz6p4z90zlp84fhp";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  propagatedBuildInputs = [ glib ];
+
+  meta = with stdenv.lib; {
+    homepage = http://liblqr.wikidot.com;
+    description = "Seam-carving C/C++ library called Liquid Rescaling";
+    platforms = platforms.all;
+    license = with licenses; [ gpl3 lgpl3 ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/liblscp/default.nix b/nixpkgs/pkgs/development/libraries/liblscp/default.nix
new file mode 100644
index 000000000000..1a5a4baf8086
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/liblscp/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchurl, autoconf, automake, libtool, pkgconfig }:
+
+stdenv.mkDerivation rec {
+  name = "liblscp-${version}";
+  version = "0.6.0";
+
+  src = fetchurl {
+    url = "https://download.linuxsampler.org/packages/${name}.tar.gz";
+    sha256 = "1rl7ssdzj0z3658yvdijmb27n2lcwmplx4qxg5mwrm07pvs7i75k";
+  };
+
+  nativeBuildInputs = [ autoconf automake libtool pkgconfig ];
+
+  preConfigure = "make -f Makefile.git";
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    homepage = http://www.linuxsampler.org;
+    description = "LinuxSampler Control Protocol (LSCP) wrapper library";
+    license = licenses.gpl2;
+    maintainers = [ maintainers.goibhniu ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libltc/default.nix b/nixpkgs/pkgs/development/libraries/libltc/default.nix
new file mode 100644
index 000000000000..d6918ef30443
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libltc/default.nix
@@ -0,0 +1,17 @@
+{stdenv, fetchurl}:
+
+stdenv.mkDerivation {
+  name = "libltc-1.3.1";
+
+  src = fetchurl {
+    url = https://github.com/x42/libltc/releases/download/v1.3.1/libltc-1.3.1.tar.gz;
+    sha256 = "173h9dgmain3nyrwk6q2d7yl4fnh4vacag4s2p01n5b7nyrkxrjh";
+  };
+
+  meta = with stdenv.lib; {
+    homepage = http://x42.github.io/libltc/;
+    description = "POSIX-C Library for handling Linear/Logitudinal Time Code (LTC)";
+    license = licenses.lgpl3Plus;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libmad/001-mips_removal_h_constraint.patch b/nixpkgs/pkgs/development/libraries/libmad/001-mips_removal_h_constraint.patch
new file mode 100644
index 000000000000..1d8b385e0c57
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libmad/001-mips_removal_h_constraint.patch
@@ -0,0 +1,73 @@
+Taken from openwrt:
+https://dev.openwrt.org/browser/packages/libs/libmad/patches/001-mips_removal_h_constraint.patch?rev=18548
+
+diff -ur libmad-0.15.1b-orig/fixed.h libmad-0.15.1b/fixed.h
+--- libmad-0.15.1b-orig/fixed.h	2004-02-17 12:32:03.000000000 +1030
++++ libmad-0.15.1b/fixed.h	2009-08-05 10:46:30.000000000 +0930
+@@ -299,6 +299,23 @@
+ 
+ # elif defined(FPM_MIPS)
+ 
++/* Test for gcc >= maj.min, as per __GNUC_PREREQ in glibc */
++#if defined (__GNUC__) && defined (__GNUC_MINOR__)
++#define __GNUC_PREREQ(maj, min) \
++	((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
++#else
++#define __GNUC_PREREQ(maj, min)  0
++#endif
++
++#if __GNUC_PREREQ(4,4)
++  typedef unsigned int u64_di_t __attribute__ ((mode (DI)));
++# define MAD_F_MLX(hi, lo, x, y) \
++   do { \
++      u64_di_t __ll = (u64_di_t) (x) * (y); \
++      hi = __ll >> 32; \
++      lo = __ll; \
++   } while (0) 
++#else
+ /*
+  * This MIPS version is fast and accurate; the disposition of the least
+  * significant bit depends on OPT_ACCURACY via mad_f_scale64().
+@@ -328,6 +345,7 @@
+ 	 : "%r" ((x) >> 12), "r" ((y) >> 16))
+ #  define MAD_F_MLZ(hi, lo)  ((mad_fixed_t) (lo))
+ # endif
++#endif /* __GNU_PREREQ(4,4) */
+ 
+ # if defined(OPT_SPEED)
+ #  define mad_f_scale64(hi, lo)  \
+diff -ur libmad-0.15.1b-orig/mad.h libmad-0.15.1b/mad.h
+--- libmad-0.15.1b-orig/mad.h	2004-02-17 13:25:44.000000000 +1030
++++ libmad-0.15.1b/mad.h	2009-08-05 10:42:40.000000000 +0930
+@@ -344,6 +344,23 @@
+ 
+ # elif defined(FPM_MIPS)
+ 
++/* Test for gcc >= maj.min, as per __GNUC_PREREQ in glibc */
++#if defined (__GNUC__) && defined (__GNUC_MINOR__)
++#define __GNUC_PREREQ(maj, min) \
++	((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
++#else
++#define __GNUC_PREREQ(maj, min)  0
++#endif
++
++#if __GNUC_PREREQ(4,4)
++  typedef unsigned int u64_di_t __attribute__ ((mode (DI)));
++# define MAD_F_MLX(hi, lo, x, y) \
++   do { \
++      u64_di_t __ll = (u64_di_t) (x) * (y); \
++      hi = __ll >> 32; \
++      lo = __ll; \
++   } while (0) 
++#else
+ /*
+  * This MIPS version is fast and accurate; the disposition of the least
+  * significant bit depends on OPT_ACCURACY via mad_f_scale64().
+@@ -373,6 +390,7 @@
+ 	 : "%r" ((x) >> 12), "r" ((y) >> 16))
+ #  define MAD_F_MLZ(hi, lo)  ((mad_fixed_t) (lo))
+ # endif
++#endif /* __GNU_PREREQ(4,4) */
+ 
+ # if defined(OPT_SPEED)
+ #  define mad_f_scale64(hi, lo)  \
diff --git a/nixpkgs/pkgs/development/libraries/libmad/default.nix b/nixpkgs/pkgs/development/libraries/libmad/default.nix
new file mode 100644
index 000000000000..f6df090e8b5d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libmad/default.nix
@@ -0,0 +1,33 @@
+{stdenv, fetchurl, autoconf}:
+
+stdenv.mkDerivation rec {
+  name = "libmad-0.15.1b";
+  
+  src = fetchurl {
+    url = "mirror://sourceforge/mad/${name}.tar.gz";
+    sha256 = "bbfac3ed6bfbc2823d3775ebb931087371e142bb0e9bb1bee51a76a6e0078690";
+  };
+
+  patches = [ ./001-mips_removal_h_constraint.patch ./pkgconfig.patch ]
+  # 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.optional stdenv.cc.isClang [ ./optimize.diff ];
+
+  nativeBuildInputs = [ autoconf ];
+
+  # The -fforce-mem flag has been removed in GCC 4.3.
+  preConfigure = ''
+    autoconf
+    substituteInPlace configure --replace "-fforce-mem" ""
+    substituteInPlace configure --replace "arch=\"-march=i486\"" ""
+  '';
+
+  meta = with stdenv.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;
+    maintainers = with maintainers; [ lovek323 ];
+    platforms   = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libmad/optimize.diff b/nixpkgs/pkgs/development/libraries/libmad/optimize.diff
new file mode 100644
index 000000000000..1418dc927073
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libmad/optimize.diff
@@ -0,0 +1,77 @@
+Index: libmad-0.15.1b/configure.ac
+===================================================================
+--- libmad-0.15.1b.orig/configure.ac	2008-03-07 20:31:23.000000000 +0000
++++ libmad-0.15.1b/configure.ac	2008-03-07 20:34:26.000000000 +0000
+@@ -124,71 +124,7 @@
+ 
+ if test "$GCC" = yes
+ then
+-    if test -z "$arch"
+-    then
+-	case "$host" in
+-	    i386-*)           ;;
+-	    i?86-*)           arch="-march=i486" ;;
+-	    arm*-empeg-*)     arch="-march=armv4 -mtune=strongarm1100" ;;
+-	    armv4*-*)         arch="-march=armv4 -mtune=strongarm" ;;
+-	    powerpc-*)        ;;
+-	    mips*-agenda-*)   arch="-mcpu=vr4100" ;;
+-	    mips*-luxsonor-*) arch="-mips1 -mcpu=r3000 -Wa,-m4010" ;;
+-	esac
+-    fi
+-
+-    case "$optimize" in
+-	-O|"-O "*)
+-	    optimize="-O"
+-	    optimize="$optimize -fforce-mem"
+-	    optimize="$optimize -fforce-addr"
+-	    : #x optimize="$optimize -finline-functions"
+-	    : #- optimize="$optimize -fstrength-reduce"
+-	    optimize="$optimize -fthread-jumps"
+-	    optimize="$optimize -fcse-follow-jumps"
+-	    optimize="$optimize -fcse-skip-blocks"
+-	    : #x optimize="$optimize -frerun-cse-after-loop"
+-	    : #x optimize="$optimize -frerun-loop-opt"
+-	    : #x optimize="$optimize -fgcse"
+-	    optimize="$optimize -fexpensive-optimizations"
+-	    optimize="$optimize -fregmove"
+-	    : #* optimize="$optimize -fdelayed-branch"
+-	    : #x optimize="$optimize -fschedule-insns"
+-	    optimize="$optimize -fschedule-insns2"
+-	    : #? optimize="$optimize -ffunction-sections"
+-	    : #? optimize="$optimize -fcaller-saves"
+-	    : #> optimize="$optimize -funroll-loops"
+-	    : #> optimize="$optimize -funroll-all-loops"
+-	    : #x optimize="$optimize -fmove-all-movables"
+-	    : #x optimize="$optimize -freduce-all-givs"
+-	    : #? optimize="$optimize -fstrict-aliasing"
+-	    : #* optimize="$optimize -fstructure-noalias"
+-
+-	    case "$host" in
+-		arm*-*)
+-		    optimize="$optimize -fstrength-reduce"
+-		    ;;
+-		mips*-*)
+-		    optimize="$optimize -fstrength-reduce"
+-		    optimize="$optimize -finline-functions"
+-		    ;;
+-		i?86-*)
+-		    optimize="$optimize -fstrength-reduce"
+-		    ;;
+-		powerpc-apple-*)
+-		    # this triggers an internal compiler error with gcc2
+-		    : #optimize="$optimize -fstrength-reduce"
+-
+-		    # this is really only beneficial with gcc3
+-		    : #optimize="$optimize -finline-functions"
+-		    ;;
+-		*)
+-		    # this sometimes provokes bugs in gcc 2.95.2
+-		    : #optimize="$optimize -fstrength-reduce"
+-		    ;;
+-	    esac
+-	    ;;
+-    esac
++    optimize="-O2"
+ fi
+ 
+ case "$host" in
diff --git a/nixpkgs/pkgs/development/libraries/libmad/pkgconfig.patch b/nixpkgs/pkgs/development/libraries/libmad/pkgconfig.patch
new file mode 100644
index 000000000000..0ac88acb8415
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libmad/pkgconfig.patch
@@ -0,0 +1,117 @@
+diff -ruN libmad-0.15.1b.orig/Makefile.am libmad-0.15.1b/Makefile.am
+--- libmad-0.15.1b.orig/Makefile.am	2004-02-17 02:02:03.000000000 +0000
++++ libmad-0.15.1b/Makefile.am	2005-08-25 12:08:04.000000000 +0000
+@@ -33,9 +33,12 @@
+ minimad_INCLUDES =	
+ minimad_LDADD =		libmad.la
+ 
+-EXTRA_DIST =		mad.h.sed  \
++EXTRA_DIST =		mad.h.sed mad.pc.in \
+ 			CHANGES COPYRIGHT CREDITS README TODO VERSION
+ 
++pkgconfigdir = $(libdir)/pkgconfig
++pkgconfig_DATA= mad.pc
++
+ exported_headers =	version.h fixed.h bit.h timer.h stream.h frame.h  \
+ 			synth.h decoder.h
+ 
+diff -ruN libmad-0.15.1b.orig/Makefile.in libmad-0.15.1b/Makefile.in
+--- libmad-0.15.1b.orig/Makefile.in	2004-02-17 02:33:23.000000000 +0000
++++ libmad-0.15.1b/Makefile.in	2005-08-25 12:09:34.000000000 +0000
+@@ -14,6 +14,8 @@
+ 
+ @SET_MAKE@
+ 
++pkgconfigdir = $(libdir)/pkgconfig
++pkgconfig_DATA = mad.pc
+ 
+ SOURCES = $(libmad_la_SOURCES) $(EXTRA_libmad_la_SOURCES) $(minimad_SOURCES)
+ 
+@@ -43,7 +45,7 @@
+ 	$(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ 	$(srcdir)/config.h.in $(srcdir)/libmad.list.in \
+ 	$(top_srcdir)/configure COPYING INSTALL TODO config.guess \
+-	config.sub depcomp install-sh ltmain.sh missing mkinstalldirs
++	config.sub depcomp install-sh ltmain.sh missing mkinstalldirs mad.pc.in
+ subdir = .
+ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+ am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+@@ -53,7 +55,7 @@
+  configure.lineno configure.status.lineno
+ mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+ CONFIG_HEADER = config.h
+-CONFIG_CLEAN_FILES = libmad.list
++CONFIG_CLEAN_FILES = libmad.list mad.pc
+ am__installdirs = $(DESTDIR)$(libdir) $(DESTDIR)$(includedir)
+ libLTLIBRARIES_INSTALL = $(INSTALL)
+ LTLIBRARIES = $(lib_LTLIBRARIES)
+@@ -218,7 +220,7 @@
+ minimad_SOURCES = minimad.c
+ minimad_INCLUDES = 
+ minimad_LDADD = libmad.la
+-EXTRA_DIST = mad.h.sed  \
++EXTRA_DIST = mad.h.sed  mad.pc.in \
+ 			CHANGES COPYRIGHT CREDITS README TODO VERSION
+ 
+ exported_headers = version.h fixed.h bit.h timer.h stream.h frame.h  \
+@@ -298,6 +300,28 @@
+ 	rm -f stamp-h1
+ 	touch $@
+ 
++mad.pc: $(top_builddir)/config.status mad.pc.in
++	cd $(top_builddir) && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
++
++install-pkgconfigDATA: $(pkgconfig_DATA)
++	@$(NORMAL_INSTALL)
++	$(mkinstalldirs) $(DESTDIR)$(pkgconfigdir)
++	@list='$(pkgconfig_DATA)'; for p in $$list; do \
++	  if test -f $(srcdir)/$$p; then \
++	    echo " $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(pkgconfigdir)/$$p"; \
++	    $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(pkgconfigdir)/$$p; \
++	  else if test -f $$p; then \
++	    echo " $(INSTALL_DATA) $$p $(DESTDIR)$(pkgconfigdir)/$$p"; \
++	    $(INSTALL_DATA) $$p $(DESTDIR)$(pkgconfigdir)/$$p; \
++	  fi; fi; \
++	done
++
++uninstall-pkgconfigDATA:
++	@$(NORMAL_UNINSTALL)
++	list='$(pkgconfig_DATA)'; for p in $$list; do \
++	  rm -f $(DESTDIR)$(pkgconfigdir)/$$p; \
++	done
++
+ distclean-hdr:
+ 	-rm -f config.h stamp-h1
+ libmad.list: $(top_builddir)/config.status $(srcdir)/libmad.list.in
+@@ -726,7 +750,7 @@
+ 
+ info-am:
+ 
+-install-data-am: install-includeHEADERS
++install-data-am: install-includeHEADERS install-pkgconfigDATA
+ 
+ install-exec-am: install-libLTLIBRARIES
+ 
+@@ -757,7 +781,7 @@
+ ps-am:
+ 
+ uninstall-am: uninstall-includeHEADERS uninstall-info-am \
+-	uninstall-libLTLIBRARIES
++	uninstall-libLTLIBRARIES install-pkgconfigDATA
+ 
+ uninstall-info: uninstall-info-recursive
+ 
+diff -ruN libmad-0.15.1b.orig/mad.pc.in libmad-0.15.1b/mad.pc.in
+--- libmad-0.15.1b.orig/mad.pc.in	1970-01-01 00:00:00.000000000 +0000
++++ libmad-0.15.1b/mad.pc.in	2005-08-25 12:08:04.000000000 +0000
+@@ -0,0 +1,10 @@
++prefix=@prefix@
++exec_prefix=@exec_prefix@
++libdir=@libdir@
++includedir=@includedir@
++
++Name: MAD
++Description: libmad - MPEG audio decoder library
++Version: @VERSION@
++Libs: -L${libdir} -lmad
++Cflags:
diff --git a/nixpkgs/pkgs/development/libraries/libmanette/default.nix b/nixpkgs/pkgs/development/libraries/libmanette/default.nix
new file mode 100644
index 000000000000..701238750512
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libmanette/default.nix
@@ -0,0 +1,36 @@
+{ stdenv, fetchurl, ninja, meson, pkgconfig, vala, gobject-introspection
+, glib, libgudev, libevdev, gnome3 }:
+
+let
+  version = "0.2.2";
+  pname = "libmanette";
+in
+stdenv.mkDerivation {
+  name = "${pname}-${version}";
+
+  outputs = [ "out" "dev" ];
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    sha256 = "1lpprk2qz1lsqf9xj6kj2ciyc1zmjhj5lwd584qkh7jgz2x9y6wb";
+  };
+
+  nativeBuildInputs = [ meson ninja pkgconfig vala gobject-introspection ];
+  buildInputs = [ glib libgudev libevdev ];
+
+  doCheck = true;
+
+  passthru = {
+    updateScript = gnome3.updateScript {
+      packageName = pname;
+    };
+  };
+
+  meta = with stdenv.lib; {
+    description = "A simple GObject game controller library";
+    homepage = https://wiki.gnome.org/Apps/Builder;
+    license = licenses.lgpl21Plus;
+    maintainers = gnome3.maintainers;
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libmatchbox/default.nix b/nixpkgs/pkgs/development/libraries/libmatchbox/default.nix
new file mode 100644
index 000000000000..8ff02b49e584
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libmatchbox/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchurl, libX11, libXext, libpng, libXft, libICE, pango, libjpeg}:
+
+stdenv.mkDerivation rec {
+  name = "libmatchbox-${version}";
+  version = "1.11";
+
+  buildInputs = [ libXft libICE pango libjpeg ];
+  propagatedBuildInputs = [ libX11 libXext libpng ];
+  NIX_LDFLAGS = [
+    "-lX11"
+  ];
+
+  src = fetchurl {
+    url = "https://downloads.yoctoproject.org/releases/matchbox/libmatchbox/${version}/libmatchbox-${version}.tar.bz2";
+    sha256 = "0lvv44s3bf96zvkysa4ansxj2ffgj3b5kgpliln538q4wd9ank15";
+  };
+
+  meta = {
+    description = "Library of the matchbox X window manager";
+    homepage = http://matchbox-project.org/;
+    license = stdenv.lib.licenses.gpl2Plus;
+    platforms = stdenv.lib.platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libmatheval/default.nix b/nixpkgs/pkgs/development/libraries/libmatheval/default.nix
new file mode 100644
index 000000000000..0f43c0d46164
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libmatheval/default.nix
@@ -0,0 +1,46 @@
+{ stdenv, fetchurl, pkgconfig, guile, autoconf, flex, fetchpatch }:
+
+stdenv.mkDerivation rec {
+  version = "1.1.11";
+  name = "libmatheval-${version}";
+
+  nativeBuildInputs = [ pkgconfig autoconf flex ];
+  buildInputs = [ guile ];
+
+  src = fetchurl {
+    url = "https://ftp.gnu.org/gnu/libmatheval/${name}.tar.gz";
+    sha256 = "474852d6715ddc3b6969e28de5e1a5fbaff9e8ece6aebb9dc1cc63e9e88e89ab";
+  };
+
+  # Patches coming from debian package
+  # https://packages.debian.org/source/sid/libs/libmatheval
+  patches = [ (fetchpatch {
+                url = "https://salsa.debian.org/science-team/libmatheval/raw/debian/1.1.11+dfsg-3/debian/patches/002-skip-docs.patch";
+                sha256 = "1nnkk9aw4jj6nql46zhwq6vx74zrmr1xq5ix0xyvpawhabhgjg62";
+              } )
+              (fetchpatch {
+                url = "https://salsa.debian.org/science-team/libmatheval/raw/debian/1.1.11+dfsg-3/debian/patches/003-guile2.0.patch";
+                sha256 = "1xgfw4finfvr20kjbpr4yl2djxmyr4lmvfa11pxirfvhrdi602qj";
+               } )
+              (fetchpatch {
+                url = "https://salsa.debian.org/science-team/libmatheval/raw/debian/1.1.11+dfsg-3/debian/patches/disable_coth_test.patch";
+                sha256 = "0bai8jrd5azfz5afmjixlvifk34liq58qb7p9kb45k6kc1fqqxzm";
+               } )
+            ];
+
+  meta = {
+    description = "A library to parse and evaluate symbolic expressions input as text";
+    longDescription = ''
+      GNU libmatheval is a library (callable from C and Fortran) to parse and evaluate symbolic
+      expressions input as text. It supports expressions in any number of variables of arbitrary
+      names, decimal and symbolic constants, basic unary and binary operators, and elementary
+      mathematical functions. In addition to parsing and evaluation, libmatheval can also compute
+      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;
+  };
+}
+
diff --git a/nixpkgs/pkgs/development/libraries/libmatroska/default.nix b/nixpkgs/pkgs/development/libraries/libmatroska/default.nix
new file mode 100644
index 000000000000..b10a62fd389a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libmatroska/default.nix
@@ -0,0 +1,30 @@
+{ stdenv, fetchFromGitHub, cmake, pkgconfig
+, libebml }:
+
+stdenv.mkDerivation rec {
+  pname = "libmatroska";
+  version = "1.5.2";
+
+  src = fetchFromGitHub {
+    owner  = "Matroska-Org";
+    repo   = "libmatroska";
+    rev    = "release-${version}";
+    sha256 = "057iib6p62x31g1ikdjsjzmqzjlajqx6p74h7y4r524pzgb27fzy";
+  };
+
+  nativeBuildInputs = [ cmake pkgconfig ];
+
+  buildInputs = [ libebml ];
+
+  cmakeFlags = [
+    "-DBUILD_SHARED_LIBS=YES"
+  ];
+
+  meta = with stdenv.lib; {
+    description = "A library to parse Matroska files";
+    homepage = https://matroska.org/;
+    license = licenses.lgpl21;
+    maintainers = with maintainers; [ spwhitt ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libmaxminddb/default.nix b/nixpkgs/pkgs/development/libraries/libmaxminddb/default.nix
new file mode 100644
index 000000000000..f1b15a91ccac
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libmaxminddb/default.nix
@@ -0,0 +1,19 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "libmaxminddb-${version}";
+  version = "1.3.2";
+
+  src = fetchurl {
+    url = meta.homepage + "/releases/download/${version}/${name}.tar.gz";
+    sha256 = "1w60yq26x3yr3abxk7fwqqaggw8dc98595jdliaa3kyqdfm83y76";
+  };
+
+  meta = with stdenv.lib; {
+    description = "C library for working with MaxMind geolocation DB files";
+    homepage = https://github.com/maxmind/libmaxminddb;
+    license = licenses.apsl20;
+    platforms = platforms.all;
+    maintainers = [ maintainers.vcunat ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libmbim/default.nix b/nixpkgs/pkgs/development/libraries/libmbim/default.nix
new file mode 100644
index 000000000000..406b88ea8c1b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libmbim/default.nix
@@ -0,0 +1,37 @@
+{ stdenv, fetchurl, pkgconfig, glib, python3, systemd, libgudev }:
+
+stdenv.mkDerivation rec {
+  pname = "libmbim";
+  version = "1.18.2";
+
+  src = fetchurl {
+    url = "https://www.freedesktop.org/software/libmbim/${pname}-${version}.tar.xz";
+    sha256 = "0s4jsfsydp2vykv7lnimalp9i680aas1qcx7zdpjiic64b5g48vp";
+  };
+
+  outputs = [ "out" "dev" "man" ];
+
+  configureFlags = [
+    "--with-udev-base-dir=${placeholder ''out''}/lib/udev"
+  ];
+
+  nativeBuildInputs = [
+    pkgconfig
+    python3
+  ];
+
+  buildInputs = [
+    glib
+    libgudev
+    systemd
+  ];
+
+  doCheck = true;
+
+  meta = with stdenv.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;
+    license = licenses.gpl2;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libmcrypt/default.nix b/nixpkgs/pkgs/development/libraries/libmcrypt/default.nix
new file mode 100644
index 000000000000..2ce11b998a1a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libmcrypt/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchurl, darwin, disablePosixThreads ? false }:
+
+with stdenv.lib;
+
+stdenv.mkDerivation rec {
+  name = "libmcrypt-2.5.8";
+  
+  src = fetchurl {
+    url = mirror://sourceforge/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz;
+    sha256 = "0gipgb939vy9m66d3k8il98rvvwczyaw2ixr8yn6icds9c3nrsz4";
+  };
+
+  buildInputs = optional stdenv.isDarwin darwin.cctools;
+
+  configureFlags = optional disablePosixThreads
+    [ "--disable-posix-threads" ];
+
+  meta = {
+    description = "Replacement for the old crypt() package and crypt(1) command, with extensions";
+    homepage = http://mcrypt.sourceforge.net;
+    license = "GPL";
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libmd/default.nix b/nixpkgs/pkgs/development/libraries/libmd/default.nix
new file mode 100644
index 000000000000..de8baa7ad198
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libmd/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchurl, autoreconfHook }:
+
+stdenv.mkDerivation rec {
+  name = "${pname}-${version}";
+  pname = "libmd";
+  version = "1.0.1";
+
+  src = fetchurl {
+    url = "https://archive.hadrons.org/software/${pname}/${pname}-${version}.tar.xz";
+    sha256 = "0waclg2d5qin3r26gy5jvy4584ik60njc8pqbzwk0lzq3j9ynkp1";
+  };
+
+  nativeBuildInputs = [ autoreconfHook ];
+
+  # Writing the version to a .dist-version file is required for the get-version
+  # shell script because fetchgit removes the .git directory.
+  prePatch = ''
+    echo '${version}' > .dist-version;
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = "https://www.hadrons.org/software/${pname}/";
+    description = "Message Digest functions from BSD systems";
+    license = with licenses; [ bsd3 bsd2 isc beerware publicDomain ];
+    maintainers = with maintainers; [ primeos ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libmediaart/default.nix b/nixpkgs/pkgs/development/libraries/libmediaart/default.nix
new file mode 100644
index 000000000000..64d2cc7577c3
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libmediaart/default.nix
@@ -0,0 +1,34 @@
+{ stdenv, fetchurl, meson, ninja, pkgconfig, vala, gtk-doc, docbook_xsl, docbook_xml_dtd_412, glib, gdk_pixbuf, gobject-introspection, gnome3 }:
+
+stdenv.mkDerivation rec {
+  pname = "libmediaart";
+  version = "1.9.4";
+
+  outputs = [ "out" "dev" "devdoc" ];
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    sha256 = "a57be017257e4815389afe4f58fdacb6a50e74fd185452b23a652ee56b04813d";
+  };
+
+  nativeBuildInputs = [ meson ninja pkgconfig vala gtk-doc docbook_xsl docbook_xml_dtd_412 gobject-introspection ];
+  buildInputs = [ glib gdk_pixbuf ];
+
+  # FIXME: Turn on again when https://github.com/NixOS/nixpkgs/issues/53701
+  # is fixed on master.
+  doCheck = false;
+
+  passthru = {
+    updateScript = gnome3.updateScript {
+      packageName = pname;
+      versionPolicy = "none";
+    };
+  };
+
+  meta = with stdenv.lib; {
+    description = "Library tasked with managing, extracting and handling media art caches";
+    maintainers = gnome3.maintainers;
+    license = licenses.gpl2;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libmediainfo/default.nix b/nixpkgs/pkgs/development/libraries/libmediainfo/default.nix
new file mode 100644
index 000000000000..172b9cd88da5
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libmediainfo/default.nix
@@ -0,0 +1,31 @@
+{ stdenv, fetchurl, autoreconfHook, pkgconfig, libzen, zlib }:
+
+stdenv.mkDerivation rec {
+  version = "19.04";
+  name = "libmediainfo-${version}";
+  src = fetchurl {
+    url = "https://mediaarea.net/download/source/libmediainfo/${version}/libmediainfo_${version}.tar.xz";
+    sha256 = "1yr2vl2z9z1kllr5ygi39r1ryw695cic8yj34yragkk33l1z6xc2";
+  };
+
+  nativeBuildInputs = [ autoreconfHook pkgconfig ];
+  buildInputs = [ libzen zlib ];
+
+  sourceRoot = "./MediaInfoLib/Project/GNU/Library/";
+
+  configureFlags = [ "--enable-shared" ];
+
+  enableParallelBuilding = true;
+
+  postInstall = ''
+    install -vD -m 644 libmediainfo.pc "$out/lib/pkgconfig/libmediainfo.pc"
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Shared library for mediainfo";
+    homepage = https://mediaarea.net/;
+    license = licenses.bsd2;
+    platforms = platforms.unix;
+    maintainers = [ maintainers.devhell ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libmemcached/default.nix b/nixpkgs/pkgs/development/libraries/libmemcached/default.nix
new file mode 100644
index 000000000000..d2fba5cddd82
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libmemcached/default.nix
@@ -0,0 +1,34 @@
+{ stdenv, fetchurl, fetchpatch, cyrus_sasl, libevent }:
+
+stdenv.mkDerivation rec {
+  name = "libmemcached-1.0.18";
+
+  src = fetchurl {
+    url = https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz;
+    sha256 = "10jzi14j32lpq0if0p9vygcl2c1352hwbywzvr9qzq7x6aq0nb72";
+  };
+
+  # Fix linking against libpthread (patch from Fedora)
+  # https://bugzilla.redhat.com/show_bug.cgi?id=1037707
+  # 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 {
+      url = "https://raw.githubusercontent.com/Homebrew/homebrew/bfd4a0a4626b61c2511fdf573bcbbc6bbe86340e/Library/Formula/libmemcached.rb";
+      sha256 = "1gjf3vd7hiyzxjvlg2zfc3y2j0lyr6nhbws4xb5dmin3csyp8qb8";
+    })
+    ++ stdenv.lib.optional stdenv.hostPlatform.isMusl ./musl-fixes.patch;
+
+  buildInputs = [ libevent ];
+  propagatedBuildInputs = [ cyrus_sasl ];
+
+  NIX_CFLAGS_COMPILE = [ "-fpermissive"/*gcc7*/ ];
+
+  meta = with stdenv.lib; {
+    homepage = https://libmemcached.org;
+    description = "Open source C/C++ client library and tools for the memcached server";
+    license = licenses.bsd3;
+    platforms = platforms.linux ++ platforms.darwin;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libmemcached/libmemcached-fix-linking-with-libpthread.patch b/nixpkgs/pkgs/development/libraries/libmemcached/libmemcached-fix-linking-with-libpthread.patch
new file mode 100644
index 000000000000..e5e21c433587
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libmemcached/libmemcached-fix-linking-with-libpthread.patch
@@ -0,0 +1,19 @@
+diff -up libmemcached-1.0.16/build-aux/ltmain.sh.orig libmemcached-1.0.16/build-aux/ltmain.sh
+--- libmemcached-1.0.16/build-aux/ltmain.sh.orig	2013-12-03 16:36:53.222107642 +0100
++++ libmemcached-1.0.16/build-aux/ltmain.sh	2013-12-03 16:37:35.770132249 +0100
+@@ -5664,6 +5664,15 @@ func_mode_link ()
+ 	    *" $arg "*) ;;
+ 	    * ) func_append new_inherited_linker_flags " $arg" ;;
+ 	esac
++	# As we are forced to pass -nostdlib to g++ during linking, the option
++	# -pthread{,s} is not in effect;  add the -lpthread to $deplist
++	# explicitly to link correctly.
++	if test "$tagname" = CXX -a x"$with_gcc" = xyes; then
++	  case "$arg" in
++	    -pthread*) func_append deplibs " -lpthread" ;;
++	  esac
++	fi
++
+ 	continue
+ 	;;
+ 
diff --git a/nixpkgs/pkgs/development/libraries/libmemcached/musl-fixes.patch b/nixpkgs/pkgs/development/libraries/libmemcached/musl-fixes.patch
new file mode 100644
index 000000000000..eb2a6bc980eb
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libmemcached/musl-fixes.patch
@@ -0,0 +1,58 @@
+diff --git a/libhashkit/fnv_64.cc b/libhashkit/fnv_64.cc
+index 68e4dd0..64656b7 100644
+--- a/libhashkit/fnv_64.cc
++++ b/libhashkit/fnv_64.cc
+@@ -37,8 +37,9 @@
+ 
+ 
+ #include <libhashkit/common.h>
++#include <limits.h>
+ 
+-#if __WORDSIZE == 64 && defined(HAVE_FNV64_HASH)
++#if (LONG_BITS == 64) && defined(HAVE_FNV64_HASH)
+ 
+ /* FNV hash'es lifted from Dustin Sallings work */
+ static uint64_t FNV_64_INIT= 0xcbf29ce484222325;
+diff --git a/libhashkit/has.cc b/libhashkit/has.cc
+index 843e32e..4153e5e 100644
+--- a/libhashkit/has.cc
++++ b/libhashkit/has.cc
+@@ -37,6 +37,7 @@
+ 
+ 
+ #include <libhashkit/common.h>
++#include <limits.h>
+ 
+ bool libhashkit_has_algorithm(const hashkit_hash_algorithm_t algo)
+ {
+@@ -44,7 +45,7 @@ bool libhashkit_has_algorithm(const hashkit_hash_algorithm_t algo)
+   {
+   case HASHKIT_HASH_FNV1_64:
+   case HASHKIT_HASH_FNV1A_64:
+-#if __WORDSIZE == 64 && defined(HAVE_FNV64_HASH)
++#if (LONG_BITS == 64) && defined(HAVE_FNV64_HASH)
+     return true;
+ #else
+     return false;
+diff --git a/libtest/cmdline.cc b/libtest/cmdline.cc
+index 29a22de..161c646 100644
+--- a/libtest/cmdline.cc
++++ b/libtest/cmdline.cc
+@@ -61,7 +61,7 @@ using namespace libtest;
+ #include <algorithm>
+ #include <stdexcept>
+ 
+-#ifndef __USE_GNU
++#ifndef _GNU_SOURCE
+ static char **environ= NULL;
+ #endif
+ 
+@@ -201,7 +201,7 @@ Application::error_t Application::run(const char *args[])
+ 
+   fatal_assert(posix_spawnattr_setsigmask(&spawnattr, &mask) == 0);
+ 
+-#if defined(POSIX_SPAWN_USEVFORK) || defined(__linux__)
++#if defined(POSIX_SPAWN_USEVFORK) || defined(__GLIBC__)
+   // Use USEVFORK on linux
+   flags |= POSIX_SPAWN_USEVFORK;
+ #endif
diff --git a/nixpkgs/pkgs/development/libraries/libmesode/default.nix b/nixpkgs/pkgs/development/libraries/libmesode/default.nix
new file mode 100644
index 000000000000..e46eb9208de6
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libmesode/default.nix
@@ -0,0 +1,39 @@
+{ stdenv, fetchFromGitHub, autoreconfHook, libtool, openssl, expat, pkgconfig, check }:
+
+stdenv.mkDerivation rec {
+  name = "libmesode-${version}";
+  version = "0.9.2";
+
+  src = fetchFromGitHub {
+    owner = "boothj5";
+    repo = "libmesode";
+    rev = version;
+    sha256 = "06f5nfaypvxrbsinxa1k2vrxrs7kqmg38g4wwwk5d63hpn1pj8ak";
+  };
+
+  nativeBuildInputs = [ autoreconfHook pkgconfig ];
+  buildInputs = [ openssl expat libtool check ];
+
+  dontDisableStatic = true;
+
+  doCheck = true;
+
+  meta = {
+    description = "Fork of libstrophe (https://github.com/strophe/libstrophe) for use with Profanity XMPP Client";
+    longDescription = ''
+      Reasons for forking:
+
+      - Remove Windows support
+      - Support only one XML Parser implementation (expat)
+      - Support only one SSL implementation (OpenSSL)
+
+      This simplifies maintenance of the library when used in Profanity.
+      Whilst Profanity will run against libstrophe, libmesode provides extra
+      TLS functionality such as manual SSL certificate verification.
+    '';
+    homepage = https://github.com/boothj5/libmesode/;
+    license = stdenv.lib.licenses.gpl3;
+    platforms = stdenv.lib.platforms.unix;
+    maintainers = [ stdenv.lib.maintainers.devhell ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libmhash/autotools-define-conflict-debian-fix.patch b/nixpkgs/pkgs/development/libraries/libmhash/autotools-define-conflict-debian-fix.patch
new file mode 100644
index 000000000000..1e3a5d680df6
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libmhash/autotools-define-conflict-debian-fix.patch
@@ -0,0 +1,78 @@
+Patch fixing #DEFINE redefinitions for generic PACKAGE_* attributes which
+cause collisions when using libmhash in another package also using autotools.
+
+Debian Bug report #473204
+
+diff -x configure -x config.guess -x config.sub -x 'Makefile.*' -Nru
+mhash-0.9.9.orig/configure.in mhash-0.9.9/configure.in
+--- mhash-0.9.9.orig/configure.in       2007-04-04 19:22:28.000000000 -0700
++++ mhash-0.9.9/configure.in    2008-03-29 00:21:24.000000000 -0800
+@@ -6,6 +6,7 @@
+ AM_INIT_AUTOMAKE
+
+ AC_DEFINE([MHASH_VERSION], PROGRAM_VERSION, "MHash Version")
++AC_CONFIG_HEADER([include/mutils/config.h])
+ AC_CONFIG_HEADER([include/mutils/mhash_config.h])
+
+
+diff -x configure -x config.guess -x config.sub -x 'Makefile.*' -Nru
+mhash-0.9.9.orig/include/mutils/config.h.in
+mhash-0.9.9/include/mutils/config.h.in
+--- mhash-0.9.9.orig/include/mutils/config.h.in 1969-12-31 16:00:00.000000000
+-0800
++++ mhash-0.9.9/include/mutils/config.h.in      2008-03-29 00:48:22.000000000
+-0800
+@@ -0,0 +1,22 @@
++/* Name of package */
++#undef PACKAGE
++
++/* Define to the address where bug reports for this package should be sent. */
++#undef PACKAGE_BUGREPORT
++
++/* Define to the full name of this package. */
++#undef PACKAGE_NAME
++
++/* Define to the full name and version of this package. */
++#undef PACKAGE_STRING
++
++/* Define to the one symbol short name of this package. */
++#undef PACKAGE_TARNAME
++
++/* Define to the version of this package. */
++#undef PACKAGE_VERSION
++
++/* Version number of package */
++#undef VERSION
++
++
+diff -x configure -x config.guess -x config.sub -x 'Makefile.*' -Nru
+mhash-0.9.9.orig/include/mutils/mhash_config.h.in
+mhash-0.9.9/include/mutils/mhash_config.h.in
+--- mhash-0.9.9.orig/include/mutils/mhash_config.h.in   2008-03-29
+00:23:29.000000000 -0800
++++ mhash-0.9.9/include/mutils/mhash_config.h.in        2008-03-29
+00:06:41.000000000 -0800
+@@ -181,24 +181,6 @@
+ /* Define to 1 if your C compiler doesn't accept -c and -o together. */
+ #undef NO_MINUS_C_MINUS_O
+
+-/* Name of package */
+-#undef PACKAGE
+-
+-/* Define to the address where bug reports for this package should be sent. */
+-#undef PACKAGE_BUGREPORT
+-
+-/* Define to the full name of this package. */
+-#undef PACKAGE_NAME
+-
+-/* Define to the full name and version of this package. */
+-#undef PACKAGE_STRING
+-
+-/* Define to the one symbol short name of this package. */
+-#undef PACKAGE_TARNAME
+-
+-/* Define to the version of this package. */
+-#undef PACKAGE_VERSION
+-
+ /* Define to 1 if the C compiler supports function prototypes. */
+ #undef PROTOTYPES
diff --git a/nixpkgs/pkgs/development/libraries/libmhash/default.nix b/nixpkgs/pkgs/development/libraries/libmhash/default.nix
new file mode 100644
index 000000000000..d3f30a752732
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libmhash/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  pname = "mhash";
+  version = "0.9.9.9";
+  name = "${pname}-${version}";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/${pname}/${name}.tar.bz2";
+    sha256 = "1w7yiljan8gf1ibiypi6hm3r363imm3sxl1j8hapjdq3m591qljn";
+  };
+
+  dontDisableStatic = true;
+
+  patches = [ ./autotools-define-conflict-debian-fix.patch ];
+
+  meta = {
+    description = "Hash algorithms library";
+    longDescription = ''
+      Libmhash is a library that provides a uniform interface to several hash
+      algorithms. It supports the basics for message authentication by
+      following rfc2104 (HMAC). It also includes some key generation algorithms
+      which are based on hash algorithms.
+    '';
+    homepage = http://mhash.sourceforge.net;
+    license = "LGPL";
+    platforms = stdenv.lib.platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libmicrodns/default.nix b/nixpkgs/pkgs/development/libraries/libmicrodns/default.nix
new file mode 100644
index 000000000000..3c55a6b036cc
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libmicrodns/default.nix
@@ -0,0 +1,30 @@
+{ stdenv
+, fetchFromGitHub
+, autoreconfHook
+, pkgconfig
+}:
+
+stdenv.mkDerivation rec {
+  version = "0.0.10";
+  pname = "libmicrodns";
+
+  src = fetchFromGitHub {
+    owner = "videolabs";
+    repo = pname;
+    rev = version;
+    sha256 = "1xvl9k49ng35wbsqmnjnyqvkyjf8dcq2ywsq3jp3wh0rgmxhq2fh";
+  };
+
+  nativeBuildInputs = [
+    autoreconfHook
+    pkgconfig
+  ];
+
+  meta = with stdenv.lib; {
+    description = "Minimal mDNS resolver library, used by VLC";
+    homepage = https://github.com/videolabs/libmicrodns;
+    license = licenses.lgpl21;
+    platforms = platforms.linux;
+    maintainers = [ maintainers.shazow ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libmicrohttpd/default.nix b/nixpkgs/pkgs/development/libraries/libmicrohttpd/default.nix
new file mode 100644
index 000000000000..0ecd568c3763
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libmicrohttpd/default.nix
@@ -0,0 +1,39 @@
+{ stdenv, fetchurl, libgcrypt, curl, gnutls, pkgconfig, libiconv, libintl }:
+
+stdenv.mkDerivation rec {
+  name = "libmicrohttpd-${version}";
+  version = "0.9.63";
+
+  src = fetchurl {
+    url = "mirror://gnu/libmicrohttpd/${name}.tar.gz";
+    sha256 = "173lj66crwvhzwp1r812sc5h1hda7g6lb9l1y5zf7w3pw4dnzhrp";
+  };
+
+  outputs = [ "out" "dev" "devdoc" "info" ];
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ libgcrypt curl gnutls libiconv libintl ];
+
+  preCheck = ''
+    # Since `localhost' can't be resolved in a chroot, work around it.
+    sed -ie 's/localhost/127.0.0.1/g' src/test*/*.[ch]
+  '';
+
+  # Disabled because the tests can time-out.
+  doCheck = false;
+
+  meta = with stdenv.lib; {
+    description = "Embeddable HTTP server library";
+
+    longDescription = ''
+      GNU libmicrohttpd is a small C library that is supposed to make
+      it easy to run an HTTP server as part of another application.
+    '';
+
+    license = licenses.lgpl2Plus;
+
+    homepage = https://www.gnu.org/software/libmicrohttpd/;
+
+    maintainers = with maintainers; [ eelco vrthra fpletz ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libmikmod/default.nix b/nixpkgs/pkgs/development/libraries/libmikmod/default.nix
new file mode 100644
index 000000000000..ef095fd4336a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libmikmod/default.nix
@@ -0,0 +1,33 @@
+{ stdenv, fetchurl, texinfo, alsaLib, libpulseaudio, CoreAudio }:
+
+let
+  inherit (stdenv.lib) optional optionals optionalString;
+
+in stdenv.mkDerivation rec {
+  name = "libmikmod-3.3.11.1";
+  src = fetchurl {
+    url = "mirror://sourceforge/mikmod/${name}.tar.gz";
+    sha256 = "06bdnhb0l81srdzg6gn2v2ydhhaazza7rshrcj3q8dpqr3gn97dd";
+  };
+
+  buildInputs = [ texinfo ]
+    ++ optional stdenv.isLinux alsaLib
+    ++ optional stdenv.isDarwin CoreAudio;
+  propagatedBuildInputs =
+    optional stdenv.isLinux libpulseaudio;
+
+  NIX_LDFLAGS = optionalString stdenv.isLinux "-lasound";
+
+  meta = with stdenv.lib; {
+    description = "A library for playing tracker music module files";
+    homepage    = https://mikmod.shlomifish.org/;
+    license     = licenses.lgpl2Plus;
+    maintainers = with maintainers; [ astsmtl lovek323 ];
+    platforms   = platforms.unix;
+
+    longDescription = ''
+      A library for playing tracker music module files supporting many formats,
+      including MOD, S3M, IT and XM.
+    '';
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libmilter/default.nix b/nixpkgs/pkgs/development/libraries/libmilter/default.nix
new file mode 100644
index 000000000000..aa606e2a177e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libmilter/default.nix
@@ -0,0 +1,44 @@
+{ stdenv, fetchurl, m4 }:
+
+stdenv.mkDerivation rec {
+  name = "libmilter-${version}";
+  version = "8.15.2";
+
+  src = fetchurl {
+    url = "ftp://ftp.sendmail.org/pub/sendmail/sendmail.${version}.tar.gz";
+    sha256 = "0fdl9ndmspqspdlmghzxlaqk56j3yajk52d7jxcg21b7sxglpy94";
+  };
+
+  buildPhase = ''
+    mkdir -p $out/lib
+    cd libmilter
+    cat > a.m4 <<EOF
+      define(\`confCC', \`$CC')
+      define(\`confAR', \`$AR')
+      define(\`confEBINDIR', \`$out/libexec')
+      define(\`confINCLUDEDIR', \`$out/include')
+      define(\`confLIBDIR', \`$out/lib')
+      define(\`confMANROOT', \`$out/man/cat')
+      define(\`confMANROOTMAN', \`$out/man/man')
+      define(\`confMBINDIR', \`$out/sbin')
+      define(\`confSBINDIR', \`$out/sbin')
+      define(\`confSHAREDLIBDIR', \`$out/lib')
+      define(\`confUBINDIR', \`$out/bin')
+      define(\`confINCGRP', \`root')
+      define(\`confLIBGRP', \`root')
+      APPENDDEF(\`confENVDEF', \`-DNETINET6')
+    EOF
+    sh Build -f ./a.m4
+  '';
+
+  patches = [ ./install.patch ./sharedlib.patch ];
+
+  nativeBuildInputs = [ m4 ];
+
+  meta = with stdenv.lib; {
+    description = "Sendmail Milter mail filtering API library";
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ fpletz ];
+    license = licenses.sendmail;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libmilter/install.patch b/nixpkgs/pkgs/development/libraries/libmilter/install.patch
new file mode 100644
index 000000000000..f6d3574ca4c1
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libmilter/install.patch
@@ -0,0 +1,42 @@
+diff -rc sendmail-8.14.4/devtools/M4/UNIX/library.m4 sendmail-8.14.4-new/devtools/M4/UNIX/library.m4
+*** sendmail-8.14.4/devtools/M4/UNIX/library.m4	Wed Sep  6 00:56:53 2006
+--- sendmail-8.14.4-new/devtools/M4/UNIX/library.m4	Tue Feb  9 11:25:13 2010
+***************
+*** 28,34 ****
+  
+  install-`'bldCURRENT_PRODUCT: bldCURRENT_PRODUCT.a
+  ifdef(`bldINSTALLABLE', `	ifdef(`confMKDIR', `if [ ! -d ${DESTDIR}${bldINSTALL_DIR`'LIBDIR} ]; then confMKDIR -p ${DESTDIR}${bldINSTALL_DIR`'LIBDIR}; else :; fi ')
+! 	${INSTALL} -c -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} bldCURRENT_PRODUCT.a ${DESTDIR}${LIBDIR}')
+  
+  bldCURRENT_PRODUCT-clean:
+  	rm -f ${OBJS} bldCURRENT_PRODUCT.a ${MANPAGES}
+--- 28,34 ----
+  
+  install-`'bldCURRENT_PRODUCT: bldCURRENT_PRODUCT.a
+  ifdef(`bldINSTALLABLE', `	ifdef(`confMKDIR', `if [ ! -d ${DESTDIR}${bldINSTALL_DIR`'LIBDIR} ]; then confMKDIR -p ${DESTDIR}${bldINSTALL_DIR`'LIBDIR}; else :; fi ')
+! 	${INSTALL} -c bldCURRENT_PRODUCT.a ${DESTDIR}${LIBDIR}')
+  
+  bldCURRENT_PRODUCT-clean:
+  	rm -f ${OBJS} bldCURRENT_PRODUCT.a ${MANPAGES}
+diff -rc sendmail-8.14.4/libmilter/Makefile.m4 sendmail-8.14.4-new/libmilter/Makefile.m4
+*** sendmail-8.14.4/libmilter/Makefile.m4	Tue Nov 24 22:59:33 2009
+--- sendmail-8.14.4-new/libmilter/Makefile.m4	Tue Feb  9 10:47:19 2010
+***************
+*** 33,40 ****
+  MFDEF=	${SRCDIR}/inc`'lude/libmilter/mfdef.h
+  install-mfapi: ${MFAPI}
+  	if [ ! -d ${DESTDIR}${INCLUDEDIR}/libmilter ]; then mkdir -p ${DESTDIR}${INCLUDEDIR}/libmilter; else :; fi
+! 	${INSTALL} -c -o ${INCOWN} -g ${INCGRP} -m ${INCMODE} ${MFAPI} ${DESTDIR}${INCLUDEDIR}/libmilter/mfapi.h
+! 	${INSTALL} -c -o ${INCOWN} -g ${INCGRP} -m ${INCMODE} ${MFDEF} ${DESTDIR}${INCLUDEDIR}/libmilter/mfdef.h
+  divert(0)
+  
+  bldFINISH
+--- 33,40 ----
+  MFDEF=	${SRCDIR}/inc`'lude/libmilter/mfdef.h
+  install-mfapi: ${MFAPI}
+  	if [ ! -d ${DESTDIR}${INCLUDEDIR}/libmilter ]; then mkdir -p ${DESTDIR}${INCLUDEDIR}/libmilter; else :; fi
+! 	${INSTALL} -c ${MFAPI} ${DESTDIR}${INCLUDEDIR}/libmilter/mfapi.h
+! 	${INSTALL} -c ${MFDEF} ${DESTDIR}${INCLUDEDIR}/libmilter/mfdef.h
+  divert(0)
+  
+  bldFINISH
diff --git a/nixpkgs/pkgs/development/libraries/libmilter/sharedlib.patch b/nixpkgs/pkgs/development/libraries/libmilter/sharedlib.patch
new file mode 100644
index 000000000000..bbc69a516ffd
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libmilter/sharedlib.patch
@@ -0,0 +1,55 @@
+diff -Nru sendmail-8.14.3.orig/devtools/M4/UNIX/milterlibrary.m4 sendmail-8.14.3/devtools/M4/UNIX/milterlibrary.m4
+--- sendmail-8.14.3.orig/devtools/M4/UNIX/milterlibrary.m4	1970-01-01 01:00:00.000000000 +0100
++++ sendmail-8.14.3/devtools/M4/UNIX/milterlibrary.m4	2009-08-22 21:51:10.000000000 +0200
+@@ -0,0 +1,39 @@
++divert(-1)
++#
++# Copyright (c) 1999-2001 Sendmail, Inc. and its suppliers.
++#	All rights reserved.
++#
++# By using this file, you agree to the terms and conditions set
++# forth in the LICENSE file which can be found at the top level of
++# the sendmail distribution.
++#
++#
++#  Definitions for Makefile construction for sendmail
++#
++divert(0)dnl
++include(confBUILDTOOLSDIR`/M4/'bldM4_TYPE_DIR`/links.m4')dnl
++bldLIST_PUSH_ITEM(`bldC_PRODUCTS', bldCURRENT_PRODUCT)dnl
++bldPUSH_TARGET(bldCURRENT_PRODUCT`.so' bldCURRENT_PRODUCT`.a')dnl
++bldPUSH_INSTALL_TARGET(`install-'bldCURRENT_PRODUCT)dnl
++bldPUSH_CLEAN_TARGET(bldCURRENT_PRODUCT`-clean')dnl
++
++include(confBUILDTOOLSDIR`/M4/'bldM4_TYPE_DIR`/defines.m4')
++divert(bldTARGETS_SECTION)
++bldCURRENT_PRODUCT.so: ${BEFORE} ${bldCURRENT_PRODUCT`OBJS'}
++	${CCLINK} ${LDOPTS_SO} -o bldCURRENT_PRODUCT.so -Wl,confSONAME,bldCURRENT_PRODUCT.so.${MILTER_SOVER} ${bldCURRENT_PRODUCT`OBJS'} -lc ${LIBS}
++bldCURRENT_PRODUCT.a: ${BEFORE} ${bldCURRENT_PRODUCT`OBJS'}
++	${AR} ${AROPTS} bldCURRENT_PRODUCT.a ${bldCURRENT_PRODUCT`OBJS'}
++	${RANLIB} ${RANLIBOPTS} bldCURRENT_PRODUCT.a
++ifdef(`bldLINK_SOURCES', `bldMAKE_SOURCE_LINKS(bldLINK_SOURCES)')
++
++install-`'bldCURRENT_PRODUCT: bldCURRENT_PRODUCT.so bldCURRENT_PRODUCT.a
++ifdef(`bldINSTALLABLE', `	ifdef(`confMKDIR', `if [ ! -d "${DESTDIR}${bldINSTALL_DIR`'LIBDIR}" ]; then confMKDIR -p "${DESTDIR}${bldINSTALL_DIR`'LIBDIR}"; else :; fi ')
++	${INSTALL} -c bldCURRENT_PRODUCT.so "${DESTDIR}${LIBDIR}/bldCURRENT_PRODUCT.so.${MILTER_SOVER}"
++	${LN} ${LNOPTS} bldCURRENT_PRODUCT.so.${MILTER_SOVER} "${DESTDIR}${LIBDIR}/bldCURRENT_PRODUCT.so"
++	${INSTALL} -c bldCURRENT_PRODUCT.a "${DESTDIR}${LIBDIR}"')
++
++bldCURRENT_PRODUCT-clean:
++	rm -f ${OBJS} bldCURRENT_PRODUCT.so bldCURRENT_PRODUCT.a ${MANPAGES}
++
++divert(0)
++COPTS+= confCCOPTS_SO
+diff -Nru sendmail-8.14.3.orig/libmilter/Makefile.m4 sendmail-8.14.3/libmilter/Makefile.m4
+--- sendmail-8.14.3.orig/libmilter/Makefile.m4	2008-04-08 07:23:44.000000000 +0200
++++ sendmail-8.14.3/libmilter/Makefile.m4	2009-08-22 21:53:35.000000000 +0200
+@@ -9,7 +9,7 @@
+ SMSRCDIR=ifdef(`confSMSRCDIR', `confSMSRCDIR', `${SRCDIR}/sendmail')
+ PREPENDDEF(`confINCDIRS', `-I${SMSRCDIR} ')
+ 
+-bldPRODUCT_START(`library', `libmilter')
++bldPRODUCT_START(`milterlibrary', `libmilter')
+ define(`bldINSTALLABLE', `true')
+ define(`LIBMILTER_EXTRAS', `errstring.c strl.c')
+ APPENDDEF(`confENVDEF', `-DNOT_SENDMAIL -Dsm_snprintf=snprintf')
diff --git a/nixpkgs/pkgs/development/libraries/libminc/default.nix b/nixpkgs/pkgs/development/libraries/libminc/default.nix
new file mode 100644
index 000000000000..aea7a5959fac
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libminc/default.nix
@@ -0,0 +1,46 @@
+{ stdenv, fetchFromGitHub, cmake, zlib, netcdf, nifticlib, hdf5 }:
+
+stdenv.mkDerivation rec {
+  pname = "libminc";
+  name  = "${pname}-2018-01-17";
+
+  owner = "BIC-MNI";
+
+  # current master is significantly ahead of most recent release, so use Git version:
+  src = fetchFromGitHub {
+    inherit owner;
+    repo   = pname;
+    rev    = "a9cbe1353eae9791b7d5b03af16e0f86922ce40b";
+    sha256 = "0mn4n3ihzcr1jw2g1vy6c8p4lkc88jwljk04argmj7k4djrgpxpa";
+  };
+
+  postPatch = ''
+    patchShebangs .
+  '';
+
+  nativeBuildInputs = [ cmake ];
+  buildInputs = [ zlib netcdf nifticlib hdf5 ];
+
+  cmakeFlags = [
+    "-DLIBMINC_MINC1_SUPPORT=ON"
+    "-DLIBMINC_BUILD_SHARED_LIBS=ON"
+    "-DLIBMINC_USE_SYSTEM_NIFTI=ON"
+  ];
+
+  doCheck = true;
+  checkPhase = ''
+    export LD_LIBRARY_PATH="$(pwd)"  # see #22060
+    ctest -E 'ezminc_rw_test|minc_conversion' --output-on-failure
+    # ezminc_rw_test can't find libminc_io.so.5.2.0; minc_conversion hits netcdf compilation issue
+  '';
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    homepage = "https://github.com/${owner}/${pname}";
+    description = "Medical imaging library based on HDF5";
+    maintainers = with maintainers; [ bcdarwin ];
+    platforms = platforms.unix;
+    license   = licenses.free;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libmkv/default.nix b/nixpkgs/pkgs/development/libraries/libmkv/default.nix
new file mode 100644
index 000000000000..9c89d2e8d7b8
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libmkv/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchgit, libtool, autoconf, automake }:
+
+stdenv.mkDerivation rec {
+  name = "libmkv-${version}";
+  version = "0.6.5.1";
+
+  src = fetchgit {
+    url = https://github.com/saintdev/libmkv.git;
+    rev = "refs/tags/${version}";
+    sha256 = "0pr9q7yprndl8d15ir7i7cznvmf1yqpvnsyivv763n6wryssq6dl";
+  };
+
+  nativeBuildInputs = [ libtool autoconf automake ];
+
+  preConfigure = "sh bootstrap.sh";
+
+  meta = {
+    description = "Abandoned library. Alternative lightweight Matroska muxer written for HandBrake";
+    longDescription = ''
+      Library was meant to be an alternative to the official libmatroska library.
+      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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libmms/default.nix b/nixpkgs/pkgs/development/libraries/libmms/default.nix
new file mode 100644
index 000000000000..7f73fb09cd16
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libmms/default.nix
@@ -0,0 +1,21 @@
+{ stdenv, fetchurl, glib, pkgconfig }:
+
+stdenv.mkDerivation rec {
+  name = "libmms-0.6.4";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/libmms/${name}.tar.gz";
+    sha256 = "0kvhxr5hkabj9v7ah2rzkbirndfqdijd9hp8v52c1z6bxddf019w";
+  };
+
+  buildInputs = [ glib ];
+
+  nativeBuildInputs = [ pkgconfig ];
+
+  meta = with stdenv.lib; {
+    description = "Library for downloading (streaming) media files using the mmst and mmsh protocols";
+    homepage = http://libmms.sourceforge.net;
+    platforms = platforms.all;
+    license = licenses.lgpl21;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libmng/default.nix b/nixpkgs/pkgs/development/libraries/libmng/default.nix
new file mode 100644
index 000000000000..749a5d60e467
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libmng/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchurl, zlib, libpng, libjpeg, lcms2 }:
+
+stdenv.mkDerivation rec {
+  name = "libmng-2.0.3";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/libmng/${name}.tar.xz";
+    sha256 = "1lvxnpds0vcf0lil6ia2036ghqlbl740c4d2sz0q5g6l93fjyija";
+  };
+
+  outputs = [ "out" "dev" "devdoc" ];
+  outputMan= "devdoc";
+
+  propagatedBuildInputs = [ zlib libpng libjpeg lcms2 ];
+
+  meta = with stdenv.lib; {
+    description = "Reference library for reading, displaying, writing and examining Multiple-Image Network Graphics";
+    homepage = http://www.libmng.com;
+    license = licenses.zlib;
+    maintainers = with maintainers; [ marcweber ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libmnl/default.nix b/nixpkgs/pkgs/development/libraries/libmnl/default.nix
new file mode 100644
index 000000000000..7c4b451ae6d1
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libmnl/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "libmnl-1.0.4";
+
+  src = fetchurl {
+    url = "https://netfilter.org/projects/libmnl/files/${name}.tar.bz2";
+    sha256 = "108zampspaalv44zn0ar9h386dlfixpd149bnxa5hsi8kxlqj7qp";
+  };
+
+  meta = {
+    description = "Minimalistic user-space library oriented to Netlink developers";
+    longDescription = ''
+      libmnl is a minimalistic user-space library oriented to Netlink developers.
+      There are a lot of common tasks in parsing, validating, constructing of both the Netlink
+      header and TLVs that are repetitive and easy to get wrong.
+      This library aims to provide simple helpers that allows you to re-use code and to avoid
+      re-inventing the wheel.
+    '';
+    homepage = https://netfilter.org/projects/libmnl/index.html;
+    license = stdenv.lib.licenses.lgpl21Plus;
+
+    platforms = stdenv.lib.platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libmodbus/default.nix b/nixpkgs/pkgs/development/libraries/libmodbus/default.nix
new file mode 100644
index 000000000000..182d642bc08d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libmodbus/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "libmodbus-3.1.4";
+
+  src = fetchurl {
+    url = "http://libmodbus.org/releases/${name}.tar.gz";
+    sha256 = "0drnil8bzd4n4qb0wv3ilm9zvypxvwmzd65w96d6kfm7x6q65j68";
+  };
+
+  configureFlags = [
+    # when cross-compiling we assume that the host system will return a valid
+    # pointer for calls to malloc(0) or realloc(0)
+    # https://www.uclibc.org/FAQ.html#gnu_malloc
+    # https://www.gnu.org/software/autoconf/manual/autoconf.html#index-AC_005fFUNC_005fMALLOC-454
+    # the upstream source should be patched to avoid needing this
+    "ac_cv_func_malloc_0_nonnull=yes"
+    "ac_cv_func_realloc_0_nonnull=yes"
+  ];
+
+  meta = with stdenv.lib; {
+    description = "Library to send/receive data according to the Modbus protocol";
+    homepage = https://libmodbus.org/;
+    license = licenses.lgpl21Plus;
+    platforms = platforms.linux;
+    maintainers = [ maintainers.bjornfor ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libmodplug/default.nix b/nixpkgs/pkgs/development/libraries/libmodplug/default.nix
new file mode 100644
index 000000000000..858004910160
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libmodplug/default.nix
@@ -0,0 +1,20 @@
+{ stdenv, fetchurl }:
+
+let
+  version = "0.8.9.0";
+in stdenv.mkDerivation rec {
+  name = "libmodplug-${version}";
+
+  meta = with stdenv.lib; {
+    description = "MOD playing library";
+    homepage    = "http://modplug-xmms.sourceforge.net/";
+    license     = licenses.publicDomain;
+    platforms   = platforms.unix;
+    maintainers = with maintainers; [ raskin ];
+  };
+
+  src = fetchurl {
+    url = "mirror://sourceforge/project/modplug-xmms/libmodplug/${version}/${name}.tar.gz";
+    sha256 = "1pnri98a603xk47smnxr551svbmgbzcw018mq1k6srbrq6kaaz25";
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libmongo-client/default.nix b/nixpkgs/pkgs/development/libraries/libmongo-client/default.nix
new file mode 100644
index 000000000000..30cb8c9df2ff
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libmongo-client/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchFromGitHub, autoreconfHook, pkgconfig, glib }:
+
+stdenv.mkDerivation rec {
+  name = "libmongo-client-0.1.8";
+
+  src = fetchFromGitHub {
+    owner = "algernon";
+    repo = "libmongo-client";
+    rev = name;
+    sha256 = "1cjx06i3gd9zkyvwm2ysjrf0hkhr7bjg3c27s7n0y31j10igfjp0";
+  };
+
+  nativeBuildInputs = [ autoreconfHook pkgconfig ];
+  buildInputs = [ ];
+  propagatedBuildInputs = [ glib ];
+
+  postPatch = ''
+    # Fix when uses glib in public headers
+    sed -i 's/Requires.private/Requires/g' src/libmongo-client.pc.in
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = http://algernon.github.io/libmongo-client/;
+    description = "An alternative C driver for MongoDB";
+    license = licenses.asl20;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libmowgli/default.nix b/nixpkgs/pkgs/development/libraries/libmowgli/default.nix
new file mode 100644
index 000000000000..512add5616a0
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libmowgli/default.nix
@@ -0,0 +1,18 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "libmowgli-${version}";
+  version = "2.1.3";
+
+  src = fetchurl {
+    url = "https://github.com/atheme/libmowgli-2/archive/v${version}.tar.gz";
+    sha256 = "0xx4vndmwz40pxa5gikl8z8cskpdl9a30i2i5fjncqzlp4pspymp";
+  };
+
+  meta = with stdenv.lib; {
+    description = "A development framework for C providing high performance and highly flexible algorithms";
+    homepage = https://github.com/atheme/libmowgli-2;
+    license = licenses.isc;
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libmp3splt/default.nix b/nixpkgs/pkgs/development/libraries/libmp3splt/default.nix
new file mode 100644
index 000000000000..52072000115c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libmp3splt/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchurl, libtool, libmad, libid3tag }:
+
+stdenv.mkDerivation rec {
+  name = "libmp3splt-0.9.2";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/mp3splt/${name}.tar.gz";
+    sha256 = "1p1mn2hsmj5cp40fnc8g1yfvk72p8pjxi866gjdkgjsqrr7xdvih";
+  };
+
+  outputs = [ "out" "dev" ];
+  nativeBuildInputs = [ libtool ];
+  buildInputs = [ libmad libid3tag ];
+
+  configureFlags = [ "--disable-pcre" ];
+
+  meta = with stdenv.lib; {
+    homepage    = https://sourceforge.net/projects/mp3splt/;
+    description = "Utility to split mp3, ogg vorbis and FLAC files without decoding";
+    maintainers = with maintainers; [ bosu ];
+    platforms   = platforms.unix;
+    license = licenses.gpl2;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libmpack/default.nix b/nixpkgs/pkgs/development/libraries/libmpack/default.nix
new file mode 100644
index 000000000000..2754c726da2b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libmpack/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchFromGitHub, libtool }:
+
+stdenv.mkDerivation rec {
+  name = "libmpack-${version}";
+  version = "1.0.5";
+  src = fetchFromGitHub {
+    owner = "tarruda";
+    repo = "libmpack";
+    rev = version;
+    sha256 = "0rai5djdkjz7bsn025k5489in7r1amagw1pib0z4qns6b52kiar2";
+  };
+
+  nativeBuildInputs = [ libtool ];
+
+  makeFlags = [ "LIBTOOL=libtool" "PREFIX=$(out)" ];
+
+  meta = with stdenv.lib; {
+    description = "Simple implementation of msgpack in C";
+    homepage = https://github.com/tarruda/libmpack/;
+    license = licenses.mit;
+    maintainers = with maintainers; [ lovek323 garbas ];
+    platforms = platforms.linux ++ platforms.darwin;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libmpc/default.nix b/nixpkgs/pkgs/development/libraries/libmpc/default.nix
new file mode 100644
index 000000000000..106f6fe6c37c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libmpc/default.nix
@@ -0,0 +1,35 @@
+{ stdenv, fetchurl
+, gmp, mpfr
+}:
+
+let
+  version = "1.1.0";
+in
+stdenv.mkDerivation rec {
+  name = "libmpc-${version}"; # to avoid clash with the MPD client
+
+  src = fetchurl {
+    url = "mirror://gnu/mpc/mpc-${version}.tar.gz";
+    sha256 = "0biwnhjm3rx3hc0rfpvyniky4lpzsvdcwhmcn7f0h4iw2hwcb1b9";
+  };
+
+  buildInputs = [ gmp mpfr ];
+
+  doCheck = true; # not cross;
+
+  meta = {
+    description = "Library for multiprecision complex arithmetic with exact rounding";
+
+    longDescription =
+      '' GNU MPC is a C library for the arithmetic of complex numbers with
+         arbitrarily high precision and correct rounding of the result.  It is
+         built upon and follows the same principles as GNU MPFR.
+      '';
+
+    homepage = http://mpc.multiprecision.org/;
+    license = stdenv.lib.licenses.lgpl2Plus;
+
+    platforms = stdenv.lib.platforms.all;
+    maintainers = [ ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libmpcdec/default.nix b/nixpkgs/pkgs/development/libraries/libmpcdec/default.nix
new file mode 100644
index 000000000000..a5a4d68ad969
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libmpcdec/default.nix
@@ -0,0 +1,16 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation {
+  name = "libmpcdec-1.2.6";
+
+  src = fetchurl {
+    url = https://files.musepack.net/source/libmpcdec-1.2.6.tar.bz2;
+    sha256 = "1a0jdyga1zfi4wgkg3905y6inghy3s4xfs5m4x7pal08m0llkmab";
+  };
+
+  meta = {
+    description = "Musepack SV7 decoder library";
+    platforms = stdenv.lib.platforms.unix;
+    license = stdenv.lib.licenses.bsd3;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libmpeg2/default.nix b/nixpkgs/pkgs/development/libraries/libmpeg2/default.nix
new file mode 100644
index 000000000000..dac7cf48aac7
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libmpeg2/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  version = "0.5.1";
+  name = "libmpeg2-${version}";
+
+  src = fetchurl {
+    url = "http://libmpeg2.sourceforge.net/files/${name}.tar.gz";
+    sha256 = "1m3i322n2fwgrvbs1yck7g5md1dbg22bhq5xdqmjpz5m7j4jxqny";
+  };
+
+  # Otherwise clang fails with 'duplicate symbol ___sputc'
+  buildFlags = stdenv.lib.optionalString 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; [ fuuzetsu ];
+    platforms = with stdenv.lib.platforms; unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libmrss/default.nix b/nixpkgs/pkgs/development/libraries/libmrss/default.nix
new file mode 100644
index 000000000000..f1a061e5ab58
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libmrss/default.nix
@@ -0,0 +1,22 @@
+{stdenv, fetchurl, curl, libnxml, pkgconfig}:
+
+stdenv.mkDerivation {
+  name = "libmrss-0.19.2";
+
+  src = fetchurl {
+    url = "https://www.autistici.org/bakunin/libmrss/libmrss-0.19.2.tar.gz";
+    sha256 = "02r1bgj8qlkn63xqfi5yq8y7wrilxcnkycaag8qskhg5ranic507";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  propagatedBuildInputs = [ curl libnxml ];
+
+  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;
+
+    platforms = stdenv.lib.platforms.all;
+    maintainers = [ stdenv.lib.maintainers.viric ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libmspack/default.nix b/nixpkgs/pkgs/development/libraries/libmspack/default.nix
new file mode 100644
index 000000000000..2cb4cd3cd9bf
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libmspack/default.nix
@@ -0,0 +1,17 @@
+{stdenv, fetchurl}:
+
+stdenv.mkDerivation rec {
+  name = "libmspack-0.7.1alpha";
+
+  src = fetchurl {
+    url = "https://www.cabextract.org.uk/libmspack/${name}.tar.gz";
+    sha256 = "0zn4vwzk5ankgd0l88cipan19pzbzv0sm3fba17lvqwka3dp1acp";
+  };
+
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libmtp/default.nix b/nixpkgs/pkgs/development/libraries/libmtp/default.nix
new file mode 100644
index 000000000000..e750c2c6c70e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libmtp/default.nix
@@ -0,0 +1,31 @@
+{ stdenv, fetchurl, pkgconfig, libusb1, libiconv }:
+
+stdenv.mkDerivation rec {
+  name = "libmtp-1.1.16";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/libmtp/${name}.tar.gz";
+    sha256 = "185vh9bds6dcy00ycggg69g4v7m3api40zv8vrcfb3fk3vfzjs2v";
+  };
+
+  outputs = [ "bin" "dev" "out" ];
+
+  buildInputs = [ libiconv ];
+  propagatedBuildInputs = [ libusb1 ];
+  nativeBuildInputs = [ pkgconfig ];
+
+  # tried to install files to /lib/udev, hopefully OK
+  configureFlags = [ "--with-udev=$$bin/lib/udev" ];
+
+  meta = with stdenv.lib; {
+    homepage = http://libmtp.sourceforge.net;
+    description = "An implementation of Microsoft's Media Transfer Protocol";
+    longDescription = ''
+      libmtp is an implementation of Microsoft's Media Transfer Protocol (MTP)
+      in the form of a library suitable primarily for POSIX compliant operating
+      systems. We implement MTP Basic, the stuff proposed for standardization.
+      '';
+    platforms = platforms.unix;
+    license = licenses.lgpl21;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libmusicbrainz/5.x.nix b/nixpkgs/pkgs/development/libraries/libmusicbrainz/5.x.nix
new file mode 100644
index 000000000000..2b59adf8f922
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libmusicbrainz/5.x.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchFromGitHub, cmake, neon, libdiscid, libxml2, pkgconfig }:
+
+stdenv.mkDerivation rec {
+  version = "5.1.0";
+  name = "libmusicbrainz-${version}";
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ cmake neon libdiscid libxml2 ];
+
+  src = fetchFromGitHub {
+    owner  = "metabrainz";
+    repo   = "libmusicbrainz";
+    sha256 = "0ah9kaf3g3iv1cps2vs1hs33nfbjfx1xscpjgxr1cg28p4ri6jhq";
+    rev    = "release-${version}";
+  };
+
+  dontUseCmakeBuildDir=true;
+
+  meta = with stdenv.lib; {
+    homepage = http://musicbrainz.org/doc/libmusicbrainz;
+    description = "MusicBrainz Client Library (5.x version)";
+    longDescription = ''
+      The libmusicbrainz (also known as mb_client or MusicBrainz Client
+      Library) is a development library geared towards developers who wish to
+      add MusicBrainz lookup capabilities to their applications.'';
+    platforms = platforms.all;
+    license = licenses.lgpl21;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libmusicbrainz/default.nix b/nixpkgs/pkgs/development/libraries/libmusicbrainz/default.nix
new file mode 100644
index 000000000000..5335b6577f0a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libmusicbrainz/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchurl, cmake, neon, libdiscid }:
+
+stdenv.mkDerivation rec {
+  name = "libmusicbrainz-3.0.3";
+
+  buildInputs = [ cmake neon libdiscid ];
+
+  src = fetchurl {
+    url = "ftp://ftp.musicbrainz.org/pub/musicbrainz/${name}.tar.gz";
+    sha256 = "1i9qly13bwwmgj68vma766hgvsd1m75236haqsp9zgh5znlmkm3z";
+  };
+
+  meta = with stdenv.lib; {
+    homepage = http://musicbrainz.org/doc/libmusicbrainz;
+    description = "MusicBrainz Client Library (3.x version)";
+    longDescription = ''
+      The libmusicbrainz (also known as mb_client or MusicBrainz Client
+      Library) is a development library geared towards developers who wish to
+      add MusicBrainz lookup capabilities to their applications.'';
+    platforms = platforms.all;
+    license = licenses.lgpl21;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libmwaw/default.nix b/nixpkgs/pkgs/development/libraries/libmwaw/default.nix
new file mode 100644
index 000000000000..a7e52376e3f5
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libmwaw/default.nix
@@ -0,0 +1,31 @@
+{stdenv, fetchurl, boost, pkgconfig, cppunit, zlib, libwpg, libwpd, librevenge}:
+let
+  s = # Generated upstream information
+  rec {
+    baseName="libmwaw";
+    version="0.3.15";
+    name="${baseName}-${version}";
+    hash="1cdhm9yhanyv3w4vr73zhgyynmkhhkp3dyld7m11jd2yy04vnh04";
+    url="mirror://sourceforge/libmwaw/libmwaw/libmwaw-0.3.15/libmwaw-0.3.15.tar.xz";
+    sha256="1cdhm9yhanyv3w4vr73zhgyynmkhhkp3dyld7m11jd2yy04vnh04";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [
+    boost cppunit zlib libwpg libwpd librevenge
+  ];
+in
+stdenv.mkDerivation {
+  inherit (s) name version;
+  inherit nativeBuildInputs buildInputs;
+  src = fetchurl {
+    inherit (s) url sha256;
+  };
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libmwaw/default.upstream b/nixpkgs/pkgs/development/libraries/libmwaw/default.upstream
new file mode 100644
index 000000000000..bcfb53770e1e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libmwaw/default.upstream
@@ -0,0 +1,4 @@
+url https://sourceforge.net/projects/libmwaw/files/libmwaw/
+SF_version_dir libmwaw-
+version_link '[.]tar.xz/download$'
+SF_redirect
diff --git a/nixpkgs/pkgs/development/libraries/libmx/default.nix b/nixpkgs/pkgs/development/libraries/libmx/default.nix
new file mode 100644
index 000000000000..6653025eb056
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libmx/default.nix
@@ -0,0 +1,62 @@
+{ stdenv, fetchurl
+, libtool, pkgconfig, automake, autoconf, intltool
+, glib, gobject-introspection, gtk2, gtk-doc
+, clutter, clutter-gtk
+}:
+
+stdenv.mkDerivation rec {
+  name = "libmx-${version}";
+  version = "1.4.7";
+
+  src = fetchurl {
+    url = "https://github.com/clutter-project/mx/archive/${version}.tar.gz";
+    sha256 = "8a7514ea33c1dec7251d0141e24a702e7701dc9f00348cbcf1816925b7f74dbc";
+  };
+
+  # remove the following superfluous checks
+  preConfigure = ''
+    substituteInPlace "autogen.sh" \
+      --replace '`which intltoolize`' '"x"' \
+      --replace '`which gtkdocize`' '"x"' \
+      --replace '`which autoreconf`' '"x"'
+  '';
+
+  configureFlags = [ "--enable-introspection"
+                     "--without-startup-notification"
+                     "--without-dbus"
+                     "--without-glade"
+                     "--without-clutter-imcontext"
+                     "--without-clutter-gesture"
+                   ];
+
+  configureScript = "sh autogen.sh";
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [
+    automake autoconf libtool
+    intltool
+    gobject-introspection glib
+    gtk2 gtk-doc clutter clutter-gtk
+  ];
+
+  # patch to resolve GL errors
+  # source : https://github.com/clutter-project/mx/pull/62
+  preBuild = ''
+    sed -i 's/GLushort/gushort/g' mx/mx-deform-texture.c
+    sed -i 's/GLfloat/gfloat/g' mx/mx-texture-frame.c
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = http://www.clutter-project.org/;
+    description = "A Clutter-based toolkit";
+    longDescription =
+      ''Mx is a widget toolkit using Clutter that provides a set of standard
+        interface elements, including buttons, progress bars, scroll bars and
+        others. It also implements some standard managers. One other interesting
+        feature is the possibility setting style properties from a CSS format
+        file.'';
+    license = licenses.lgpl21;
+    maintainers = with maintainers; [ cstrahan ];
+    platforms = with platforms; linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libmypaint/default.nix b/nixpkgs/pkgs/development/libraries/libmypaint/default.nix
new file mode 100644
index 000000000000..8719f19acc1d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libmypaint/default.nix
@@ -0,0 +1,40 @@
+{stdenv, autoconf, automake, fetchFromGitHub, fetchpatch, glib, intltool, json_c, libtool, pkgconfig}:
+
+let
+  version = "1.3.0";
+in stdenv.mkDerivation rec {
+  name = "libmypaint-${version}";
+
+  src = fetchFromGitHub {
+    owner = "mypaint";
+    repo = "libmypaint";
+    rev = "v${version}";
+    sha256 = "0b7aynr6ggigwhjkfzi8x3dwz15blj4grkg9hysbgjh6lvzpy9jc";
+  };
+
+  patches = [
+    # build with automake 1.16
+    (fetchpatch {
+      url = https://github.com/mypaint/libmypaint/commit/40d9077a80be13942476f164bddfabe842ab2a45.patch;
+      sha256 = "1dclh7apgvr2bvzy9z3rgas3hk9pf2hpf5h52q94kmx8s4a47qpi";
+    })
+  ];
+
+  nativeBuildInputs = [ autoconf automake intltool libtool pkgconfig ];
+
+  buildInputs = [ glib ];
+
+  propagatedBuildInputs = [ json_c ]; # for libmypaint.pc
+
+  doCheck = true;
+
+  preConfigure = "./autogen.sh";
+
+  meta = with stdenv.lib; {
+    homepage = http://mypaint.org/;
+    description = "Library for making brushstrokes which is used by MyPaint and other projects";
+    license = licenses.isc;
+    maintainers = with maintainers; [ goibhniu jtojnar ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libmysqlconnectorcpp/default.nix b/nixpkgs/pkgs/development/libraries/libmysqlconnectorcpp/default.nix
new file mode 100644
index 000000000000..2b7258031c33
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libmysqlconnectorcpp/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, fetchurl, cmake, boost, mysql }:
+
+stdenv.mkDerivation rec {
+  name = "libmysqlconnectorcpp-${version}";
+  version = "1.1.9";
+
+  src = fetchurl {
+    url = "https://cdn.mysql.com/Downloads/Connector-C++/mysql-connector-c++-${version}.tar.gz";
+    sha256 = "1r6j17sy5816a2ld759iis2k6igc2w9p70y4nw9w3rd4d5x88c9y";
+  };
+
+  buildInputs = [ cmake boost mysql ];
+
+  cmakeFlags = [ "-DMYSQL_LIB_DIR=${mysql}/lib" ];
+
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libnabo/default.nix b/nixpkgs/pkgs/development/libraries/libnabo/default.nix
new file mode 100644
index 000000000000..b461bfb3ddfe
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libnabo/default.nix
@@ -0,0 +1,32 @@
+{stdenv, fetchFromGitHub, cmake, eigen, boost}:
+
+stdenv.mkDerivation rec {
+  version = "1.0.7";
+  name = "libnabo-${version}";
+
+  src = fetchFromGitHub {
+    owner = "ethz-asl";
+    repo = "libnabo";
+    rev = version;
+    sha256 = "17vxlmszzpm95vvfdxnm98d5p297i10fyblblj6kf0ynq8r2mpsh";
+  };
+
+  buildInputs = [cmake eigen boost];
+
+  enableParallelBuilding = true;
+
+  cmakeFlags = "
+    -DEIGEN_INCLUDE_DIR=${eigen}/include/eigen3
+  ";
+
+  doCheck = true;
+  checkTarget = "test";
+
+  meta = with stdenv.lib; {
+    inherit (src.meta) homepage;
+    description = "A fast K Nearest Neighbor library for low-dimensional spaces";
+    license = licenses.bsd3;
+    platforms   = platforms.linux;
+    maintainers = with maintainers; [ cryptix ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libnatpmp/default.nix b/nixpkgs/pkgs/development/libraries/libnatpmp/default.nix
new file mode 100644
index 000000000000..17626bb23e13
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libnatpmp/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "libnatpmp-${version}";
+  version = "20150609";
+
+  src = fetchurl {
+    name = "${name}.tar.gz";
+    url = "http://miniupnp.free.fr/files/download.php?file=${name}.tar.gz";
+    sha256 = "1c1n8n7mp0amsd6vkz32n8zj3vnsckv308bb7na0dg0r8969rap1";
+  };
+
+  makeFlags = [ "INSTALLPREFIX=$(out)" ];
+
+  meta = with stdenv.lib; {
+    homepage = http://miniupnp.free.fr/libnatpmp.html;
+    description = "NAT-PMP client";
+    license = licenses.bsd3;
+    maintainers = with maintainers; [ orivej ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libnatspec/default.nix b/nixpkgs/pkgs/development/libraries/libnatspec/default.nix
new file mode 100644
index 000000000000..db4f6f5d4688
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libnatspec/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchurl, autoreconfHook, popt, libiconv }:
+
+stdenv.mkDerivation (rec {
+  name = "libnatspec-0.3.0";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/natspec/${name}.tar.bz2";
+    sha256 = "0wffxjlc8svilwmrcg3crddpfrpv35mzzjgchf8ygqsvwbrbb3b7";
+  };
+
+  nativeBuildInputs = [ autoreconfHook ];
+
+  buildInputs = [ popt ];
+
+  meta = with stdenv.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) {
+  propagatedBuildInputs = [ libiconv ];
+})
diff --git a/nixpkgs/pkgs/development/libraries/libndctl/default.nix b/nixpkgs/pkgs/development/libraries/libndctl/default.nix
new file mode 100644
index 000000000000..d9db09f1e98e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libndctl/default.nix
@@ -0,0 +1,49 @@
+{ stdenv, fetchFromGitHub, autoreconfHook
+, asciidoctor, pkgconfig, xmlto, docbook_xsl, docbook_xml_dtd_45, libxslt
+, json_c, kmod, which, file, utillinux, systemd, keyutils
+}:
+
+stdenv.mkDerivation rec {
+  name = "libndctl-${version}";
+  version = "65";
+
+  src = fetchFromGitHub {
+    owner  = "pmem";
+    repo   = "ndctl";
+    rev    = "v${version}";
+    sha256 = "0d8hzfvyxs2q8kgkwgdizlml41kin4mhx3vpdsjk34pfi7mqy69y";
+  };
+
+  outputs = [ "out" "lib" "man" "dev" ];
+
+  nativeBuildInputs =
+    [ autoreconfHook asciidoctor pkgconfig xmlto docbook_xml_dtd_45 docbook_xsl libxslt
+      which
+    ];
+
+  buildInputs =
+    [ json_c kmod utillinux systemd keyutils
+    ];
+
+  configureFlags =
+    [ "--without-bash"
+      "--without-systemd"
+    ];
+
+  patchPhase = ''
+    patchShebangs test
+
+    substituteInPlace git-version --replace /bin/bash ${stdenv.shell}
+    substituteInPlace git-version-gen --replace /bin/sh ${stdenv.shell}
+
+    echo "m4_define([GIT_VERSION], [${version}])" > version.m4;
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Tools for managing the Linux Non-Volatile Memory Device sub-system";
+    homepage    = https://github.com/pmem/ndctl;
+    license     = licenses.lgpl21;
+    maintainers = with maintainers; [ thoughtpolice ];
+    platforms   = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libndp/default.nix b/nixpkgs/pkgs/development/libraries/libndp/default.nix
new file mode 100644
index 000000000000..78304246f12b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libndp/default.nix
@@ -0,0 +1,19 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "libndp-1.7";
+
+  src = fetchurl {
+    url = "http://libndp.org/files/${name}.tar.gz";
+    sha256 = "1dlinhl39va00v55qygjc9ap77yqf7xvn4rwmvdr49xhzzxhlj1c";
+  };
+
+  meta = with stdenv.lib; {
+    homepage = http://libndp.org/;
+    description = "Library for Neighbor Discovery Protocol";
+    platforms = platforms.linux;
+    maintainers = [ maintainers.lethalman ];
+    license = licenses.lgpl21;
+  };
+
+}
diff --git a/nixpkgs/pkgs/development/libraries/libndtypes/default.nix b/nixpkgs/pkgs/development/libraries/libndtypes/default.nix
new file mode 100644
index 000000000000..51e4deed462c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libndtypes/default.nix
@@ -0,0 +1,28 @@
+{ stdenv
+, fetchFromGitHub
+}:
+
+stdenv.mkDerivation rec {
+  name = "libndtypes-${version}";
+  version = "unstable-2018-11-27";
+
+  src = fetchFromGitHub {
+    owner = "plures";
+    repo = "ndtypes";
+    rev = "4d810d0c4d54c81a7136f313f0ae6623853d574a";
+    sha256 = "1kk1sa7f17ffh49jc1qlizlsj536fr3s4flb6x4rjyi81rp7psb9";
+  };
+
+  # Override linker with cc (symlink to either gcc or clang)
+  # Library expects to use cc for linking
+  configureFlags = [ "LD=${stdenv.cc.targetPrefix}cc" ];
+
+  doCheck = true;
+
+  meta = with stdenv.lib; {
+    description = "Dynamic types for data description and in-memory computations";
+    homepage = https://xnd.io/;
+    license = licenses.bsdOriginal;
+    maintainers = [ maintainers.costrouc ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libnet/default.nix b/nixpkgs/pkgs/development/libraries/libnet/default.nix
new file mode 100644
index 000000000000..ba116e20177f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libnet/default.nix
@@ -0,0 +1,20 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "libnet-${version}";
+  version = "1.2-rc3";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/libnet-dev/${name}.tar.gz";
+    sha256 = "0qsapqa7dzq9f6lb19kzilif0pj82b64fjv5bq086hflb9w81hvj";
+  };
+
+  patches = [ ./fix-includes.patch ];
+
+  meta = with stdenv.lib; {
+    homepage = https://github.com/sam-github/libnet;
+    description = "Portable framework for low-level network packet construction";
+    license = licenses.bsd3;
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libnet/fix-includes.patch b/nixpkgs/pkgs/development/libraries/libnet/fix-includes.patch
new file mode 100644
index 000000000000..5eb86bc37b79
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libnet/fix-includes.patch
@@ -0,0 +1,29 @@
+--- libnet-1.1.6.orig/src/libnet_link_linux.c
++++ libnet-1.1.6/src/libnet_link_linux.c
+@@ -30,26 +30,15 @@
+ #include <sys/time.h>
+ 
+ #include <net/if.h>
+-#if (__GLIBC__)
+ #include <netinet/if_ether.h>
+ #include <net/if_arp.h>
+-#else
+-#include <linux/if_arp.h>
+-#include <linux/if_ether.h>
+-#endif
+ 
+ #if (HAVE_PACKET_SOCKET)
+ #ifndef SOL_PACKET
+ #define SOL_PACKET 263
+ #endif  /* SOL_PACKET */
+-#if __GLIBC__ >= 2 && __GLIBC_MINOR >= 1
+ #include <netpacket/packet.h>
+ #include <net/ethernet.h>     /* the L2 protocols */
+-#else
+-#include <asm/types.h>
+-#include <linux/if_packet.h>
+-#include <linux/if_ether.h>   /* The L2 protocols */
+-#endif
+ #endif  /* HAVE_PACKET_SOCKET */
+ 
+ #include "../include/libnet.h"
diff --git a/nixpkgs/pkgs/development/libraries/libnetfilter_acct/default.nix b/nixpkgs/pkgs/development/libraries/libnetfilter_acct/default.nix
new file mode 100644
index 000000000000..95533696ddf2
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libnetfilter_acct/default.nix
@@ -0,0 +1,21 @@
+{ stdenv, fetchurl, pkgconfig, libmnl }:
+
+stdenv.mkDerivation rec {
+  version = "1.0.3";
+  name = "libnetfilter_acct-${version}";
+
+  src = fetchurl {
+    url = "https://www.netfilter.org/projects/libnetfilter_acct/files/${name}.tar.bz2";
+    sha256 = "06lsjndgfjsgfjr43px2n2wk3nr7whz6r405mks3887y7vpwwl22";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ libmnl ];
+
+  meta = with stdenv.lib; {
+    homepage = http://www.netfilter.org/projects/libnetfilter_acct/;
+    description = "Userspace library providing interface to extended accounting infrastructure.";
+    license = licenses.gpl2;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libnetfilter_conntrack/default.nix b/nixpkgs/pkgs/development/libraries/libnetfilter_conntrack/default.nix
new file mode 100644
index 000000000000..41245e6539f4
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libnetfilter_conntrack/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchurl, pkgconfig, libnfnetlink, libmnl }:
+
+stdenv.mkDerivation rec {
+  name = "libnetfilter_conntrack-${version}";
+  version = "1.0.7";
+
+  src = fetchurl {
+    url = "https://netfilter.org/projects/libnetfilter_conntrack/files/${name}.tar.bz2";
+    sha256 = "1dl9z50yny04xi5pymlykwmy6hcfc9p4nd7m47697zwxw98m6s1k";
+  };
+
+  buildInputs = [ libmnl ];
+  propagatedBuildInputs = [ libnfnetlink ];
+  nativeBuildInputs = [ pkgconfig ];
+
+  meta = with stdenv.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
+      in-kernel connection tracking state table. The library libnetfilter_conntrack has been
+      previously known as libnfnetlink_conntrack and libctnetlink. This library is currently used
+      by conntrack-tools among many other applications
+    '';
+    homepage = https://netfilter.org/projects/libnetfilter_conntrack/;
+    license = licenses.gpl2Plus;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libnetfilter_cthelper/default.nix b/nixpkgs/pkgs/development/libraries/libnetfilter_cthelper/default.nix
new file mode 100644
index 000000000000..a680e009ab6a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libnetfilter_cthelper/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchurl, pkgconfig, libmnl }:
+
+stdenv.mkDerivation rec {
+  name = "libnetfilter_cthelper-${version}";
+  version = "1.0.0";
+
+  src = fetchurl {
+    url = "https://netfilter.org/projects/libnetfilter_cthelper/files/${name}.tar.bz2";
+    sha256 = "07618e71c4d9a6b6b3dc1986540486ee310a9838ba754926c7d14a17d8fccf3d";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ libmnl ];
+
+  meta = {
+    description = "Userspace library that provides the programming interface to the user-space connection tracking helper infrastructure";
+    longDescription = ''
+      libnetfilter_cthelper is the userspace library that provides the programming interface
+      to the user-space helper infrastructure available since Linux kernel 3.6. With this
+      library, you register, configure, enable and disable user-space helpers. This library
+      is used by conntrack-tools.
+    '';
+    homepage = http://www.netfilter.org/projects/libnetfilter_cthelper/;
+    license = stdenv.lib.licenses.gpl2Plus;
+    platforms = stdenv.lib.platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libnetfilter_cttimeout/default.nix b/nixpkgs/pkgs/development/libraries/libnetfilter_cttimeout/default.nix
new file mode 100644
index 000000000000..d16155374ca8
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libnetfilter_cttimeout/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchurl, pkgconfig, libmnl }:
+
+stdenv.mkDerivation rec {
+  name = "libnetfilter_cttimeout-${version}";
+  version = "1.0.0";
+
+  src = fetchurl {
+    url = "https://netfilter.org/projects/libnetfilter_cttimeout/files/${name}.tar.bz2";
+    sha256 = "aeab12754f557cba3ce2950a2029963d817490df7edb49880008b34d7ff8feba";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ libmnl ];
+
+  meta = {
+    description = "Userspace library that provides the programming interface to the connection tracking timeout infrastructure";
+    longDescription = ''
+      libnetfilter_cttimeout is the userspace library that provides the programming
+      interface to the fine-grain connection tracking timeout infrastructure.
+      With this library, you can create, update and delete timeout policies that can
+      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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libnetfilter_log/default.nix b/nixpkgs/pkgs/development/libraries/libnetfilter_log/default.nix
new file mode 100644
index 000000000000..0d8de14513ed
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libnetfilter_log/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchurl, pkgconfig, libnfnetlink, libmnl }:
+
+stdenv.mkDerivation rec {
+  name = "libnetfilter_log-${version}";
+  version = "1.0.1";
+
+  src = fetchurl {
+    url = "https://netfilter.org/projects/libnetfilter_log/files/${name}.tar.bz2";
+    sha256 = "089vjcfxl5qjqpswrbgklf4wflh44irmw6sk2k0kmfixfmszxq3l";
+  };
+
+  buildInputs = [ libmnl ];
+  propagatedBuildInputs = [ libnfnetlink ];
+  nativeBuildInputs = [ pkgconfig ];
+
+  meta = with stdenv.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
+      that have been logged by the kernel packet filter. It is is part of a
+      system that deprecates the old syslog/dmesg based packet logging. This
+      library has been previously known as libnfnetlink_log.
+    '';
+    homepage = https://netfilter.org/projects/libnetfilter_log/;
+    license = licenses.gpl2Plus;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ orivej ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libnetfilter_queue/default.nix b/nixpkgs/pkgs/development/libraries/libnetfilter_queue/default.nix
new file mode 100644
index 000000000000..94b3dc90a0b6
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libnetfilter_queue/default.nix
@@ -0,0 +1,21 @@
+{ stdenv, fetchurl, pkgconfig, libmnl, libnfnetlink }:
+
+stdenv.mkDerivation rec {
+  version = "1.0.3";
+  name = "libnetfilter_queue-${version}";
+
+  src = fetchurl {
+    url = "https://www.netfilter.org/projects/libnetfilter_queue/files/${name}.tar.bz2";
+    sha256 = "0x77m1fvbqzz5z64jz59fb6j8dvv8b9pg4fmznqwax4x6imjcncq";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ libmnl libnfnetlink ];
+
+  meta = with stdenv.lib; {
+    homepage = http://www.netfilter.org/projects/libnetfilter_queue/;
+    description = "Userspace API to packets queued by the kernel packet filter";
+    license = licenses.gpl2;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libnfc/default.nix b/nixpkgs/pkgs/development/libraries/libnfc/default.nix
new file mode 100644
index 000000000000..bef977caa28e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libnfc/default.nix
@@ -0,0 +1,21 @@
+{ stdenv, fetchurl, libusb, readline }:
+
+stdenv.mkDerivation rec {
+  name = "libnfc-${version}";
+  version = "1.7.1";
+
+  src = fetchurl {
+    url = "http://dl.bintray.com/nfc-tools/sources/libnfc-1.7.1.tar.bz2";
+    sha256 = "0wj0iwwcpmpalyk61aa7yc6i4p9hgdajkrgnlswgk0vnwbc78pll";
+  };
+
+  buildInputs = [ libusb readline ];
+
+  meta = with stdenv.lib; {
+    description = "Open source library libnfc for Near Field Communication";
+    license = licenses.gpl3;
+    homepage = https://github.com/nfc-tools/libnfc;
+    maintainers = with maintainers; [offline];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libnfnetlink/Use-stdlib-uint-instead-of-u_int.patch b/nixpkgs/pkgs/development/libraries/libnfnetlink/Use-stdlib-uint-instead-of-u_int.patch
new file mode 100644
index 000000000000..074bef42b97a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libnfnetlink/Use-stdlib-uint-instead-of-u_int.patch
@@ -0,0 +1,499 @@
+From patchwork Fri Apr  3 22:04:46 2015
+Content-Type: text/plain; charset="utf-8"
+MIME-Version: 1.0
+Content-Transfer-Encoding: 7bit
+Subject: Use stdlib uint* instead of u_int*
+From: Nathan McSween <nwmcsween@gmail.com>
+X-Patchwork-Id: 458131
+X-Patchwork-Delegate: pablo@netfilter.org
+Message-Id: <1428098686-17843-1-git-send-email-nwmcsween@gmail.com>
+To: netfilter-devel@vger.kernel.org
+Cc: Nathan McSween <nwmcsween@gmail.com>
+Date: Fri,  3 Apr 2015 22:04:46 +0000
+
+Signed-off-by: Nathan McSween <nwmcsween@gmail.com>
+---
+ include/libnfnetlink/libnfnetlink.h           | 25 +++++-----
+ include/libnfnetlink/linux_nfnetlink.h        | 11 +++--
+ include/libnfnetlink/linux_nfnetlink_compat.h |  6 ++-
+ src/iftable.c                                 |  9 ++--
+ src/iftable.h                                 |  6 ++-
+ src/libnfnetlink.c                            | 71 ++++++++++++++-------------
+ src/rtnl.c                                    |  5 +-
+ src/rtnl.h                                    |  3 +-
+ 8 files changed, 73 insertions(+), 63 deletions(-)
+
+diff --git a/include/libnfnetlink/libnfnetlink.h b/include/libnfnetlink/libnfnetlink.h
+index 1d8c49d..cd0be3d 100644
+--- a/include/libnfnetlink/libnfnetlink.h
++++ b/include/libnfnetlink/libnfnetlink.h
+@@ -15,6 +15,7 @@
+ #define aligned_u64 unsigned long long __attribute__((aligned(8)))
+ #endif
+ 
++#include <stdint.h>
+ #include <sys/socket.h>	/* for sa_family_t */
+ #include <linux/netlink.h>
+ #include <libnfnetlink/linux_nfnetlink.h>
+@@ -55,7 +56,7 @@ struct nfnlhdr {
+ struct nfnl_callback {
+ 	int (*call)(struct nlmsghdr *nlh, struct nfattr *nfa[], void *data);
+ 	void *data;
+-	u_int16_t attr_count;
++	uint16_t attr_count;
+ };
+ 
+ struct nfnl_handle;
+@@ -69,7 +70,7 @@ extern struct nfnl_handle *nfnl_open(void);
+ extern int nfnl_close(struct nfnl_handle *);
+ 
+ extern struct nfnl_subsys_handle *nfnl_subsys_open(struct nfnl_handle *, 
+-						   u_int8_t, u_int8_t, 
++						   uint8_t, uint8_t,
+ 						   unsigned int);
+ extern void nfnl_subsys_close(struct nfnl_subsys_handle *);
+ 
+@@ -88,8 +89,8 @@ extern int nfnl_sendiov(const struct nfnl_handle *nfnlh,
+ 			const struct iovec *iov, unsigned int num,
+ 			unsigned int flags);
+ extern void nfnl_fill_hdr(struct nfnl_subsys_handle *, struct nlmsghdr *,
+-			  unsigned int, u_int8_t, u_int16_t, u_int16_t,
+-			  u_int16_t);
++			  unsigned int, uint8_t, uint16_t, uint16_t,
++			  uint16_t);
+ extern __attribute__((deprecated)) int
+ nfnl_talk(struct nfnl_handle *, struct nlmsghdr *, pid_t,
+           unsigned, struct nlmsghdr *,
+@@ -103,8 +104,8 @@ nfnl_listen(struct nfnl_handle *,
+ /* receiving */
+ extern ssize_t nfnl_recv(const struct nfnl_handle *h, unsigned char *buf, size_t len);
+ extern int nfnl_callback_register(struct nfnl_subsys_handle *,
+-				  u_int8_t type, struct nfnl_callback *cb);
+-extern int nfnl_callback_unregister(struct nfnl_subsys_handle *, u_int8_t type);
++				  uint8_t type, struct nfnl_callback *cb);
++extern int nfnl_callback_unregister(struct nfnl_subsys_handle *, uint8_t type);
+ extern int nfnl_handle_packet(struct nfnl_handle *, char *buf, int len);
+ 
+ /* parsing */
+@@ -180,12 +181,12 @@ extern int nfnl_query(struct nfnl_handle *h, struct nlmsghdr *nlh);
+ 
+ /* nfnl attribute handling functions */
+ extern int nfnl_addattr_l(struct nlmsghdr *, int, int, const void *, int);
+-extern int nfnl_addattr8(struct nlmsghdr *, int, int, u_int8_t);
+-extern int nfnl_addattr16(struct nlmsghdr *, int, int, u_int16_t);
+-extern int nfnl_addattr32(struct nlmsghdr *, int, int, u_int32_t);
++extern int nfnl_addattr8(struct nlmsghdr *, int, int, uint8_t);
++extern int nfnl_addattr16(struct nlmsghdr *, int, int, uint16_t);
++extern int nfnl_addattr32(struct nlmsghdr *, int, int, uint32_t);
+ extern int nfnl_nfa_addattr_l(struct nfattr *, int, int, const void *, int);
+-extern int nfnl_nfa_addattr16(struct nfattr *, int, int, u_int16_t);
+-extern int nfnl_nfa_addattr32(struct nfattr *, int, int, u_int32_t);
++extern int nfnl_nfa_addattr16(struct nfattr *, int, int, uint16_t);
++extern int nfnl_nfa_addattr32(struct nfattr *, int, int, uint32_t);
+ extern int nfnl_parse_attr(struct nfattr **, int, struct nfattr *, int);
+ #define nfnl_parse_nested(tb, max, nfa) \
+ 	nfnl_parse_attr((tb), (max), NFA_DATA((nfa)), NFA_PAYLOAD((nfa)))
+@@ -197,7 +198,7 @@ extern int nfnl_parse_attr(struct nfattr **, int, struct nfattr *, int);
+ ({	(tail)->nfa_len = (void *) NLMSG_TAIL(nlh) - (void *) tail; })
+ 
+ extern void nfnl_build_nfa_iovec(struct iovec *iov, struct nfattr *nfa, 
+-				 u_int16_t type, u_int32_t len,
++				 uint16_t type, uint32_t len,
+ 				 unsigned char *val);
+ extern unsigned int nfnl_rcvbufsiz(const struct nfnl_handle *h, 
+ 				   unsigned int size);
+diff --git a/include/libnfnetlink/linux_nfnetlink.h b/include/libnfnetlink/linux_nfnetlink.h
+index 76a8550..7b843c6 100644
+--- a/include/libnfnetlink/linux_nfnetlink.h
++++ b/include/libnfnetlink/linux_nfnetlink.h
+@@ -1,5 +1,6 @@
+ #ifndef _NFNETLINK_H
+ #define _NFNETLINK_H
++#include <stdint.h>
+ #include <linux/types.h>
+ #include <libnfnetlink/linux_nfnetlink_compat.h>
+ 
+@@ -25,9 +26,9 @@ enum nfnetlink_groups {
+ /* General form of address family dependent message.
+  */
+ struct nfgenmsg {
+-	u_int8_t  nfgen_family;		/* AF_xxx */
+-	u_int8_t  version;		/* nfnetlink version */
+-	u_int16_t    res_id;		/* resource id */
++	uint8_t  nfgen_family;		/* AF_xxx */
++	uint8_t  version;		/* nfnetlink version */
++	uint16_t    res_id;		/* resource id */
+ };
+ 
+ #define NFNETLINK_V0	0
+@@ -59,7 +60,7 @@ struct nfnl_callback
+ 	int (*call)(struct sock *nl, struct sk_buff *skb, 
+ 		struct nlmsghdr *nlh, struct nlattr *cda[]);
+ 	const struct nla_policy *policy;	/* netlink attribute policy */
+-	const u_int16_t attr_count;		/* number of nlattr's */
++	const uint16_t attr_count;		/* number of nlattr's */
+ };
+ 
+ struct nfnetlink_subsystem
+@@ -76,7 +77,7 @@ extern int nfnetlink_subsys_unregister(const struct nfnetlink_subsystem *n);
+ extern int nfnetlink_has_listeners(unsigned int group);
+ extern int nfnetlink_send(struct sk_buff *skb, u32 pid, unsigned group, 
+ 			  int echo);
+-extern int nfnetlink_unicast(struct sk_buff *skb, u_int32_t pid, int flags);
++extern int nfnetlink_unicast(struct sk_buff *skb, uint32_t pid, int flags);
+ 
+ #define MODULE_ALIAS_NFNL_SUBSYS(subsys) \
+ 	MODULE_ALIAS("nfnetlink-subsys-" __stringify(subsys))
+diff --git a/include/libnfnetlink/linux_nfnetlink_compat.h b/include/libnfnetlink/linux_nfnetlink_compat.h
+index e145176..cd094fc 100644
+--- a/include/libnfnetlink/linux_nfnetlink_compat.h
++++ b/include/libnfnetlink/linux_nfnetlink_compat.h
+@@ -3,6 +3,8 @@
+ #ifndef __KERNEL__
+ /* Old nfnetlink macros for userspace */
+ 
++#include <stdint.h>
++
+ /* nfnetlink groups: Up to 32 maximum */
+ #define NF_NETLINK_CONNTRACK_NEW 		0x00000001
+ #define NF_NETLINK_CONNTRACK_UPDATE		0x00000002
+@@ -20,8 +22,8 @@
+ 
+ struct nfattr
+ {
+-	u_int16_t nfa_len;
+-	u_int16_t nfa_type;	/* we use 15 bits for the type, and the highest
++	uint16_t nfa_len;
++	uint16_t nfa_type;	/* we use 15 bits for the type, and the highest
+ 				 * bit to indicate whether the payload is nested */
+ };
+ 
+diff --git a/src/iftable.c b/src/iftable.c
+index 5976ed8..3411c4c 100644
+--- a/src/iftable.c
++++ b/src/iftable.c
+@@ -9,6 +9,7 @@
+ /* IFINDEX handling */
+ 
+ #include <unistd.h>
++#include <stdint.h>
+ #include <stdlib.h>
+ #include <stdio.h>
+ #include <string.h>
+@@ -27,10 +28,10 @@
+ struct ifindex_node {
+ 	struct list_head head;
+ 
+-	u_int32_t	index;
+-	u_int32_t	type;
+-	u_int32_t	alen;
+-	u_int32_t	flags;
++	uint32_t	index;
++	uint32_t	type;
++	uint32_t	alen;
++	uint32_t	flags;
+ 	char		addr[8];
+ 	char		name[16];
+ };
+diff --git a/src/iftable.h b/src/iftable.h
+index 8df7f24..0cc5335 100644
+--- a/src/iftable.h
++++ b/src/iftable.h
+@@ -1,8 +1,10 @@
+ #ifndef _IFTABLE_H
+ #define _IFTABLE_H
+ 
+-int iftable_delete(u_int32_t dst, u_int32_t mask, u_int32_t gw, u_int32_t oif);
+-int iftable_insert(u_int32_t dst, u_int32_t mask, u_int32_t gw, u_int32_t oif);
++#include <stdint.h>
++
++int iftable_delete(uint32_t dst, uint32_t mask, uint32_t gw, uint32_t oif);
++int iftable_insert(uint32_t dst, uint32_t mask, uint32_t gw, uint32_t oif);
+ 
+ int iftable_init(void);
+ void iftable_fini(void);
+diff --git a/src/libnfnetlink.c b/src/libnfnetlink.c
+index 398b7d7..b8958dc 100644
+--- a/src/libnfnetlink.c
++++ b/src/libnfnetlink.c
+@@ -36,6 +36,7 @@
+  * 	minor cleanups
+  */
+ 
++#include <stdint.h>
+ #include <stdlib.h>
+ #include <stdio.h>
+ #include <unistd.h>
+@@ -72,9 +73,9 @@
+ 
+ struct nfnl_subsys_handle {
+ 	struct nfnl_handle 	*nfnlh;
+-	u_int32_t		subscriptions;
+-	u_int8_t		subsys_id;
+-	u_int8_t		cb_count;
++	uint32_t		subscriptions;
++	uint8_t		subsys_id;
++	uint8_t		cb_count;
+ 	struct nfnl_callback 	*cb;	/* array of callbacks */
+ };
+ 
+@@ -86,11 +87,11 @@ struct nfnl_handle {
+ 	int			fd;
+ 	struct sockaddr_nl	local;
+ 	struct sockaddr_nl	peer;
+-	u_int32_t		subscriptions;
+-	u_int32_t		seq;
+-	u_int32_t		dump;
+-	u_int32_t		rcv_buffer_size;	/* for nfnl_catch */
+-	u_int32_t		flags;
++	uint32_t		subscriptions;
++	uint32_t		seq;
++	uint32_t		dump;
++	uint32_t		rcv_buffer_size;	/* for nfnl_catch */
++	uint32_t		flags;
+ 	struct nlmsghdr 	*last_nlhdr;
+ 	struct nfnl_subsys_handle subsys[NFNL_MAX_SUBSYS+1];
+ };
+@@ -145,7 +146,7 @@ unsigned int nfnl_portid(const struct nfnl_handle *h)
+ static int recalc_rebind_subscriptions(struct nfnl_handle *nfnlh)
+ {
+ 	int i, err;
+-	u_int32_t new_subscriptions = nfnlh->subscriptions;
++	uint32_t new_subscriptions = nfnlh->subscriptions;
+ 
+ 	for (i = 0; i < NFNL_MAX_SUBSYS; i++)
+ 		new_subscriptions |= nfnlh->subsys[i].subscriptions;
+@@ -273,8 +274,8 @@ void nfnl_set_rcv_buffer_size(struct nfnl_handle *h, unsigned int size)
+  * a valid address that points to a nfnl_subsys_handle structure is returned.
+  */
+ struct nfnl_subsys_handle *
+-nfnl_subsys_open(struct nfnl_handle *nfnlh, u_int8_t subsys_id,
+-		 u_int8_t cb_count, u_int32_t subscriptions)
++nfnl_subsys_open(struct nfnl_handle *nfnlh, uint8_t subsys_id,
++		 uint8_t cb_count, uint32_t subscriptions)
+ {
+ 	struct nfnl_subsys_handle *ssh;
+ 
+@@ -435,10 +436,10 @@ int nfnl_sendiov(const struct nfnl_handle *nfnlh, const struct iovec *iov,
+  */
+ void nfnl_fill_hdr(struct nfnl_subsys_handle *ssh,
+ 		    struct nlmsghdr *nlh, unsigned int len, 
+-		    u_int8_t family,
+-		    u_int16_t res_id,
+-		    u_int16_t msg_type,
+-		    u_int16_t msg_flags)
++		    uint8_t family,
++		    uint16_t res_id,
++		    uint16_t msg_type,
++		    uint16_t msg_flags)
+ {
+ 	assert(ssh);
+ 	assert(nlh);
+@@ -849,14 +850,14 @@ int nfnl_nfa_addattr_l(struct nfattr *nfa, int maxlen, int type,
+ }
+ 
+ /**
+- * nfnl_addattr8 - Add u_int8_t attribute to nlmsghdr
++ * nfnl_addattr8 - Add uint8_t attribute to nlmsghdr
+  *
+  * @n: netlink message header to which attribute is to be added
+  * @maxlen: maximum length of netlink message header
+  * @type: type of new attribute
+  * @data: content of new attribute
+  */
+-int nfnl_addattr8(struct nlmsghdr *n, int maxlen, int type, u_int8_t data)
++int nfnl_addattr8(struct nlmsghdr *n, int maxlen, int type, uint8_t data)
+ {
+ 	assert(n);
+ 	assert(maxlen > 0);
+@@ -866,7 +867,7 @@ int nfnl_addattr8(struct nlmsghdr *n, int maxlen, int type, u_int8_t data)
+ }
+ 
+ /**
+- * nfnl_nfa_addattr16 - Add u_int16_t attribute to struct nfattr 
++ * nfnl_nfa_addattr16 - Add uint16_t attribute to struct nfattr
+  *
+  * @nfa: struct nfattr
+  * @maxlen: maximal length of nfattr buffer
+@@ -875,7 +876,7 @@ int nfnl_addattr8(struct nlmsghdr *n, int maxlen, int type, u_int8_t data)
+  *
+  */
+ int nfnl_nfa_addattr16(struct nfattr *nfa, int maxlen, int type, 
+-		       u_int16_t data)
++		       uint16_t data)
+ {
+ 	assert(nfa);
+ 	assert(maxlen > 0);
+@@ -885,7 +886,7 @@ int nfnl_nfa_addattr16(struct nfattr *nfa, int maxlen, int type,
+ }
+ 
+ /**
+- * nfnl_addattr16 - Add u_int16_t attribute to nlmsghdr
++ * nfnl_addattr16 - Add uint16_t attribute to nlmsghdr
+  *
+  * @n: netlink message header to which attribute is to be added
+  * @maxlen: maximum length of netlink message header
+@@ -894,7 +895,7 @@ int nfnl_nfa_addattr16(struct nfattr *nfa, int maxlen, int type,
+  *
+  */
+ int nfnl_addattr16(struct nlmsghdr *n, int maxlen, int type,
+-		   u_int16_t data)
++		   uint16_t data)
+ {
+ 	assert(n);
+ 	assert(maxlen > 0);
+@@ -904,7 +905,7 @@ int nfnl_addattr16(struct nlmsghdr *n, int maxlen, int type,
+ }
+ 
+ /**
+- * nfnl_nfa_addattr32 - Add u_int32_t attribute to struct nfattr 
++ * nfnl_nfa_addattr32 - Add uint32_t attribute to struct nfattr
+  *
+  * @nfa: struct nfattr
+  * @maxlen: maximal length of nfattr buffer
+@@ -913,7 +914,7 @@ int nfnl_addattr16(struct nlmsghdr *n, int maxlen, int type,
+  *
+  */
+ int nfnl_nfa_addattr32(struct nfattr *nfa, int maxlen, int type, 
+-		       u_int32_t data)
++		       uint32_t data)
+ {
+ 	assert(nfa);
+ 	assert(maxlen > 0);
+@@ -923,7 +924,7 @@ int nfnl_nfa_addattr32(struct nfattr *nfa, int maxlen, int type,
+ }
+ 
+ /**
+- * nfnl_addattr32 - Add u_int32_t attribute to nlmsghdr
++ * nfnl_addattr32 - Add uint32_t attribute to nlmsghdr
+  *
+  * @n: netlink message header to which attribute is to be added
+  * @maxlen: maximum length of netlink message header
+@@ -932,7 +933,7 @@ int nfnl_nfa_addattr32(struct nfattr *nfa, int maxlen, int type,
+  *
+  */
+ int nfnl_addattr32(struct nlmsghdr *n, int maxlen, int type,
+-		   u_int32_t data)
++		   uint32_t data)
+ {
+ 	assert(n);
+ 	assert(maxlen > 0);
+@@ -980,7 +981,7 @@ int nfnl_parse_attr(struct nfattr *tb[], int max, struct nfattr *nfa, int len)
+  *
+  */ 
+ void nfnl_build_nfa_iovec(struct iovec *iov, struct nfattr *nfa, 
+-			  u_int16_t type, u_int32_t len, unsigned char *val)
++			  uint16_t type, uint32_t len, unsigned char *val)
+ {
+ 	assert(iov);
+ 	assert(nfa);
+@@ -1115,7 +1116,7 @@ struct nlmsghdr *nfnl_get_msg_next(struct nfnl_handle *h,
+  * appropiately.
+  */
+ int nfnl_callback_register(struct nfnl_subsys_handle *ssh,
+-			   u_int8_t type, struct nfnl_callback *cb)
++			   uint8_t type, struct nfnl_callback *cb)
+ {
+ 	assert(ssh);
+ 	assert(cb);
+@@ -1138,7 +1139,7 @@ int nfnl_callback_register(struct nfnl_subsys_handle *ssh,
+  * On sucess, 0 is returned. On error, -1 is returned and errno is
+  * set appropiately.
+  */
+-int nfnl_callback_unregister(struct nfnl_subsys_handle *ssh, u_int8_t type)
++int nfnl_callback_unregister(struct nfnl_subsys_handle *ssh, uint8_t type)
+ {
+ 	assert(ssh);
+ 
+@@ -1161,8 +1162,8 @@ int nfnl_check_attributes(const struct nfnl_handle *h,
+ 	assert(nfa);
+ 
+ 	int min_len;
+-	u_int8_t type = NFNL_MSG_TYPE(nlh->nlmsg_type);
+-	u_int8_t subsys_id = NFNL_SUBSYS_ID(nlh->nlmsg_type);
++	uint8_t type = NFNL_MSG_TYPE(nlh->nlmsg_type);
++	uint8_t subsys_id = NFNL_SUBSYS_ID(nlh->nlmsg_type);
+ 	const struct nfnl_subsys_handle *ssh;
+ 	struct nfnl_callback *cb;
+ 
+@@ -1212,8 +1213,8 @@ static int __nfnl_handle_msg(struct nfnl_handle *h, struct nlmsghdr *nlh,
+ 			     int len)
+ {
+ 	struct nfnl_subsys_handle *ssh;
+-	u_int8_t type = NFNL_MSG_TYPE(nlh->nlmsg_type);
+-	u_int8_t subsys_id = NFNL_SUBSYS_ID(nlh->nlmsg_type);
++	uint8_t type = NFNL_MSG_TYPE(nlh->nlmsg_type);
++	uint8_t subsys_id = NFNL_SUBSYS_ID(nlh->nlmsg_type);
+ 	int err = 0;
+ 
+ 	if (subsys_id > NFNL_MAX_SUBSYS)
+@@ -1243,7 +1244,7 @@ int nfnl_handle_packet(struct nfnl_handle *h, char *buf, int len)
+ {
+ 
+ 	while (len >= NLMSG_SPACE(0)) {
+-		u_int32_t rlen;
++		uint32_t rlen;
+ 		struct nlmsghdr *nlh = (struct nlmsghdr *)buf;
+ 
+ 		if (nlh->nlmsg_len < sizeof(struct nlmsghdr)
+@@ -1285,8 +1286,8 @@ static int nfnl_is_error(struct nfnl_handle *h, struct nlmsghdr *nlh)
+ static int nfnl_step(struct nfnl_handle *h, struct nlmsghdr *nlh)
+ {
+ 	struct nfnl_subsys_handle *ssh;
+-	u_int8_t type = NFNL_MSG_TYPE(nlh->nlmsg_type);
+-	u_int8_t subsys_id = NFNL_SUBSYS_ID(nlh->nlmsg_type);
++	uint8_t type = NFNL_MSG_TYPE(nlh->nlmsg_type);
++	uint8_t subsys_id = NFNL_SUBSYS_ID(nlh->nlmsg_type);
+ 
+ 	/* Is this an error message? */
+ 	if (nfnl_is_error(h, nlh)) {
+diff --git a/src/rtnl.c b/src/rtnl.c
+index 7b4ac7d..34802fe 100644
+--- a/src/rtnl.c
++++ b/src/rtnl.c
+@@ -11,6 +11,7 @@
+ /* rtnetlink - routing table netlink interface */
+ 
+ #include <unistd.h>
++#include <stdint.h>
+ #include <stdlib.h>
+ #include <string.h>
+ #include <errno.h>
+@@ -30,7 +31,7 @@
+ #define rtnl_log(x, ...)
+ 
+ static inline struct rtnl_handler *
+-find_handler(struct rtnl_handle *rtnl_handle, u_int16_t type)
++find_handler(struct rtnl_handle *rtnl_handle, uint16_t type)
+ {
+ 	struct rtnl_handler *h;
+ 	for (h = rtnl_handle->handlers; h; h = h->next) {
+@@ -41,7 +42,7 @@ find_handler(struct rtnl_handle *rtnl_handle, u_int16_t type)
+ }
+ 
+ static int call_handler(struct rtnl_handle *rtnl_handle,
+-			u_int16_t type,
++			uint16_t type,
+ 			struct nlmsghdr *hdr)
+ {
+ 	struct rtnl_handler *h = find_handler(rtnl_handle, type);
+diff --git a/src/rtnl.h b/src/rtnl.h
+index 0c403dc..9858ae5 100644
+--- a/src/rtnl.h
++++ b/src/rtnl.h
+@@ -1,13 +1,14 @@
+ #ifndef _RTNL_H
+ #define _RTNL_H
+ 
++#include <stdint.h>
+ #include <linux/types.h>
+ #include <linux/rtnetlink.h>
+ 
+ struct rtnl_handler {
+ 	struct rtnl_handler *next;
+ 
+-	u_int16_t	nlmsg_type;
++	uint16_t	nlmsg_type;
+ 	int		(*handlefn)(struct nlmsghdr *h, void *arg);
+ 	void		*arg;
+ };
diff --git a/nixpkgs/pkgs/development/libraries/libnfnetlink/default.nix b/nixpkgs/pkgs/development/libraries/libnfnetlink/default.nix
new file mode 100644
index 000000000000..fa6461d86919
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libnfnetlink/default.nix
@@ -0,0 +1,31 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "libnfnetlink-1.0.1";
+
+  src = fetchurl {
+    url = "https://www.netfilter.org/projects/libnfnetlink/files/${name}.tar.bz2";
+    sha256 = "06mm2x4b01k3m7wnrxblk9j0mybyr4pfz28ml7944xhjx6fy2w7j";
+  };
+
+  patches = [
+    ./Use-stdlib-uint-instead-of-u_int.patch
+  ];
+
+  meta = {
+    description = "Low-level library for netfilter related kernel/userspace communication";
+    longDescription = ''
+      libnfnetlink is the low-level library for netfilter related kernel/userspace communication.
+      It provides a generic messaging infrastructure for in-kernel netfilter subsystems
+      (such as nfnetlink_log, nfnetlink_queue, nfnetlink_conntrack) and their respective users
+      and/or management tools in userspace.
+
+      This library is not meant as a public API for application developers.
+      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;
+
+    platforms = stdenv.lib.platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libnfs/default.nix b/nixpkgs/pkgs/development/libraries/libnfs/default.nix
new file mode 100644
index 000000000000..8ed6dfa8ac0d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libnfs/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchFromGitHub, autoreconfHook }:
+
+stdenv.mkDerivation rec {
+  name = "libnfs-${version}";
+  version = "4.0.0";
+
+  src = fetchFromGitHub {
+    owner = "sahlberg";
+    repo = "libnfs";
+    rev = "libnfs-${version}";
+    sha256 = "0i27wd4zvhjz7620q043p4d4mkx8zv2yz9adm1byin47dynahyda";
+  };
+
+  nativeBuildInputs = [ autoreconfHook ];
+
+  NIX_CFLAGS_COMPILE = stdenv.lib.optionalString stdenv.cc.isClang "-Wno-error=tautological-compare";
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    description = "NFS client library";
+    homepage    = https://github.com/sahlberg/libnfs;
+    license     = with licenses; [ lgpl2 bsd2 gpl3 ];
+    maintainers = with maintainers; [ peterhoeg ];
+    platforms   = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libnftnl/default.nix b/nixpkgs/pkgs/development/libraries/libnftnl/default.nix
new file mode 100644
index 000000000000..ad51ac8d6dbb
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libnftnl/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, fetchurl, pkgconfig, libmnl }:
+
+stdenv.mkDerivation rec {
+  version = "1.1.3";
+  pname = "libnftnl";
+
+  src = fetchurl {
+    url = "https://netfilter.org/projects/${pname}/files/${pname}-${version}.tar.bz2";
+    sha256 = "03xszkcpqk3s1rqc6vh7g5j13kh3d3yjnvjhk5scds3an39rgp92";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ libmnl ];
+
+  meta = with stdenv.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;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ fpletz ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libngspice/default.nix b/nixpkgs/pkgs/development/libraries/libngspice/default.nix
new file mode 100644
index 000000000000..c6348b7b2e67
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libngspice/default.nix
@@ -0,0 +1,26 @@
+{stdenv, fetchurl, bison, flex, fftw}:
+
+# Note that this does not provide the ngspice command-line utility. For that see
+# the ngspice derivation.
+stdenv.mkDerivation rec {
+  name = "libngspice-${version}";
+  version = "30";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/ngspice/ngspice-${version}.tar.gz";
+    sha256 = "15v0jdfy2a2zxp8dmy04fdp7w7a4vwvffcwa688r81b86wphxzh8";
+  };
+
+  nativeBuildInputs = [ flex bison ];
+  buildInputs = [ fftw ];
+
+  configureFlags = [ "--with-ngshared" "--enable-xspice" "--enable-cider" ];
+
+  meta = with stdenv.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
+    maintainers = with maintainers; [ bgamari ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libnice/default.nix b/nixpkgs/pkgs/development/libraries/libnice/default.nix
new file mode 100644
index 000000000000..d6bb8ec50463
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libnice/default.nix
@@ -0,0 +1,53 @@
+{ stdenv, fetchurl, fetchpatch, meson, ninja, pkgconfig, python3, gobject-introspection, gtk-doc, docbook_xsl, docbook_xml_dtd_412, glib, gupnp-igd, gst_all_1, gnutls }:
+
+stdenv.mkDerivation rec {
+  name = "libnice-0.1.16";
+
+  outputs = [ "bin" "out" "dev" "devdoc" ];
+
+  src = fetchurl {
+    url = "https://nice.freedesktop.org/releases/${name}.tar.gz";
+    sha256 = "1pzgxq0qrqlrhd78qnvpfgp8bl5c4znqh599ljaybpcldw37idh6";
+  };
+
+  patches = [
+    # Fix generating data
+    # Note: upstream is not willing to merge our fix
+    # https://gitlab.freedesktop.org/libnice/libnice/merge_requests/35#note_98871
+    (fetchpatch {
+      url = https://gitlab.freedesktop.org/libnice/libnice/commit/d470c4bf4f2449f7842df26ca1ce1efb63452bc6.patch;
+      sha256 = "0z74vizf92flfw1m83p7yz824vfykmnm0xbnk748bnnyq186i6mg";
+    })
+  ];
+
+  nativeBuildInputs = [ meson ninja pkgconfig python3 gobject-introspection gtk-doc docbook_xsl docbook_xml_dtd_412 ];
+  buildInputs = [ gst_all_1.gstreamer gst_all_1.gst-plugins-base gnutls ];
+  propagatedBuildInputs = [ glib gupnp-igd ];
+
+  mesonFlags = [
+    "-Dgupnp=enabled"
+    "-Dgstreamer=enabled"
+    "-Dignored-network-interface-prefix=enabled"
+    "-Dexamples=enabled"
+    "-Dtests=enabled"
+    "-Dgtk_doc=enabled"
+    "-Dintrospection=enabled"
+  ];
+
+  # TODO; see #53293 etc.
+  #doCheck = true;
+
+  meta = with stdenv.lib; {
+    homepage = https://nice.freedesktop.org/wiki/;
+    description = "The GLib ICE implementation";
+    longDescription = ''
+      Libnice is an implementation of the IETF's Interactice Connectivity
+      Establishment (ICE) standard (RFC 5245) and the Session Traversal
+      Utilities for NAT (STUN) standard (RFC 5389).
+
+      It provides a GLib-based library, libnice and a Glib-free library,
+      libstun as well as GStreamer elements.'';
+    platforms = platforms.linux;
+    license = with licenses; [ lgpl21 mpl11 ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libnih/default.nix b/nixpkgs/pkgs/development/libraries/libnih/default.nix
new file mode 100644
index 000000000000..a4b0b26a345b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libnih/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchurl, pkgconfig, dbus, expat }:
+
+let version = "1.0.3"; in
+
+stdenv.mkDerivation rec {
+  name = "libnih-${version}";
+
+  src = fetchurl {
+    url = "https://code.launchpad.net/libnih/1.0/${version}/+download/libnih-${version}.tar.gz";
+    sha256 = "01glc6y7z1g726zwpvp2zm79pyb37ki729jkh45akh35fpgp4xc9";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ dbus expat ];
+
+  doCheck = false; # fails 1 of 17 test
+
+  meta = {
+    description = "A small library for C application development";
+    homepage = https://launchpad.net/libnih;
+    license = stdenv.lib.licenses.gpl2;
+    platforms = stdenv.lib.platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libnotify/default.nix b/nixpkgs/pkgs/development/libraries/libnotify/default.nix
new file mode 100644
index 000000000000..ddadb3cd97b6
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libnotify/default.nix
@@ -0,0 +1,45 @@
+{ stdenv, fetchurl, meson, ninja, pkgconfig, fetchpatch
+, glib, gdk_pixbuf, gobject-introspection, gnome3 }:
+
+stdenv.mkDerivation rec {
+  pname = "libnotify";
+  version = "0.7.8";
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    sha256 = "1371csx0n92g60b5dmai4mmzdnx8081mc3kcgc6a0xipcq5rw839";
+  };
+
+  patches = [
+    # Fix darwin build
+    # https://gitlab.gnome.org/GNOME/libnotify/merge_requests/9
+    (fetchpatch {
+      url = "https://gitlab.gnome.org/GNOME/libnotify/commit/55eb69247fe2b479ea43311503042fc03bf4e67d.patch";
+      sha256 = "1hlb5b7c5axiyir1i5j2pi94bm2gyr1ybkp6yaqy7yk6iiqlvv50";
+    })
+  ];
+
+  mesonFlags = [
+    # disable tests as we don't need to depend on gtk+(2/3)
+    "-Dtests=false"
+    "-Ddocbook_docs=disabled"
+    "-Dgtk_doc=false"
+  ];
+
+  nativeBuildInputs = [ meson ninja pkgconfig gobject-introspection ];
+  buildInputs = [ glib gdk_pixbuf ];
+
+  passthru = {
+    updateScript = gnome3.updateScript {
+      packageName = pname;
+      versionPolicy = "none";
+    };
+  };
+
+  meta = with stdenv.lib; {
+    homepage = https://developer.gnome.org/notification-spec/;
+    description = "A library that sends desktop notifications to a notification daemon";
+    platforms = platforms.unix;
+    license = licenses.lgpl21;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libnova/default.nix b/nixpkgs/pkgs/development/libraries/libnova/default.nix
new file mode 100644
index 000000000000..cb70d803ac0c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libnova/default.nix
@@ -0,0 +1,17 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "libnova-0.12.3";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/libnova/${name}.tar.gz";
+    sha256 = "18mkx79gyhccp5zqhf6k66sbhv97s7839sg15534ijajirkhw9dc";
+  };
+
+  meta = with stdenv.lib; {
+    description = "Celestial Mechanics, Astrometry and Astrodynamics Library";
+    homepage = http://libnova.sf.net;
+    platforms = platforms.unix;
+    license = licenses.gpl2;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libnsl/default.nix b/nixpkgs/pkgs/development/libraries/libnsl/default.nix
new file mode 100644
index 000000000000..790064847432
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libnsl/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchFromGitHub, autoreconfHook, libtirpc, pkgconfig }:
+
+stdenv.mkDerivation rec {
+  pname = "libnsl";
+  version = "1.2.0";
+
+  src = fetchFromGitHub {
+    owner = "thkukuk";
+    repo = pname;
+    rev = "v${version}";
+    sha256 = "1chzqhcgh0yia9js8mh92cmhyka7rh32ql6b3mgdk26n94dqzs8b";
+  };
+
+  nativeBuildInputs = [ autoreconfHook pkgconfig ];
+  buildInputs = [ libtirpc ];
+
+  meta = with stdenv.lib; {
+    description = "Client interface library for NIS(YP) and NIS+";
+    homepage = https://github.com/thkukuk/libnsl;
+    license = licenses.lgpl21;
+    maintainers = [ maintainers.dezgeg ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libnxml/default.nix b/nixpkgs/pkgs/development/libraries/libnxml/default.nix
new file mode 100644
index 000000000000..8d97a13b0a08
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libnxml/default.nix
@@ -0,0 +1,21 @@
+{stdenv, fetchurl, curl}:
+
+stdenv.mkDerivation {
+  name = "libnxml-0.18.3";
+
+  src = fetchurl {
+    url = "https://www.autistici.org/bakunin/libnxml/libnxml-0.18.3.tar.gz";
+    sha256 = "0ix5b9bxd7r517vhgcxwdviq4m0g0pq46s5g3h04gcqnpbin150g";
+  };
+
+  buildInputs = [ curl ];
+
+  meta = {
+    homepage = http://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;
+
+    platforms = stdenv.lib.platforms.all;
+    maintainers = [ stdenv.lib.maintainers.viric ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/liboauth/default.nix b/nixpkgs/pkgs/development/libraries/liboauth/default.nix
new file mode 100644
index 000000000000..ea792b007bae
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/liboauth/default.nix
@@ -0,0 +1,31 @@
+{ fetchurl, stdenv, nss, nspr, pkgconfig }:
+
+
+stdenv.mkDerivation rec {
+  name = "liboauth-1.0.3";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/liboauth/${name}.tar.gz";
+    sha256 = "07w1aq8y8wld43wmbk2q8134p3bfkp2vma78mmsfgw2jn1bh3xhd";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+
+  propagatedBuildInputs = [ nss nspr ];
+
+  configureFlags = [ "--enable-nss" ];
+
+  postInstall = ''
+    substituteInPlace $out/lib/liboauth.la \
+      --replace "-lnss3" "-L${nss.out}/lib -lnss3"
+  '';
+
+  meta = with stdenv.lib; {
+    platforms = platforms.linux;
+    description = "C library implementing the OAuth secure authentication protocol";
+    homepage = http://liboauth.sourceforge.net/;
+    repositories.git = https://github.com/x42/liboauth.git;
+    license = licenses.mit;
+  };
+
+}
diff --git a/nixpkgs/pkgs/development/libraries/libodfgen/default.nix b/nixpkgs/pkgs/development/libraries/libodfgen/default.nix
new file mode 100644
index 000000000000..1723219e8597
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libodfgen/default.nix
@@ -0,0 +1,30 @@
+{stdenv, fetchurl, boost, pkgconfig, cppunit, zlib, libwpg, libwpd, librevenge}:
+let
+  s = # Generated upstream information
+  rec {
+    baseName="libodfgen";
+    version="0.1.7";
+    name="${baseName}-${version}";
+    hash="0cdq48wlpp8m0qmndybv64r0m4vh0qsqx69cn6ms533cjlgljgij";
+    url="mirror://sourceforge/project/libwpd/libodfgen/libodfgen-0.1.7/libodfgen-0.1.7.tar.xz";
+    sha256="0cdq48wlpp8m0qmndybv64r0m4vh0qsqx69cn6ms533cjlgljgij";
+  };
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [
+    boost cppunit zlib libwpg libwpd librevenge
+  ];
+in
+stdenv.mkDerivation {
+  inherit (s) name version;
+  inherit nativeBuildInputs buildInputs;
+  src = fetchurl {
+    inherit (s) url sha256;
+  };
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libodfgen/default.upstream b/nixpkgs/pkgs/development/libraries/libodfgen/default.upstream
new file mode 100644
index 000000000000..bd78e974e42f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libodfgen/default.upstream
@@ -0,0 +1,4 @@
+url https://sourceforge.net/projects/libwpd/files/libodfgen/
+SF_version_dir libodfgen-
+version_link '[.]tar.xz/download$'
+SF_redirect
diff --git a/nixpkgs/pkgs/development/libraries/libofa/default.nix b/nixpkgs/pkgs/development/libraries/libofa/default.nix
new file mode 100644
index 000000000000..8131420cfd65
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libofa/default.nix
@@ -0,0 +1,39 @@
+{ stdenv, fetchurl, expat, curl, fftw }:
+
+let
+  version = "0.9.3";
+  deb_patch = "5";
+in
+stdenv.mkDerivation rec {
+  name = "libofa-${version}";
+
+  src = fetchurl {
+    url = "https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/musicip-libofa/${name}.tar.gz";
+    sha256 = "184ham039l7lwhfgg0xr2vch2xnw1lwh7sid432mh879adhlc5h2";
+  };
+
+  patches = fetchurl {
+    url = "mirror://debian/pool/main/libo/libofa/libofa_${version}-${deb_patch}.debian.tar.gz";
+    sha256 = "1rfkyz13cm8izm90c1xflp4rvsa24aqs6qpbbbqqcbmvzsj6j9yn";
+  };
+
+  outputs = [ "out" "dev" ];
+
+  setOutputFlags = false;
+
+  preConfigure = ''
+    configureFlagsArray=(--includedir=$dev/include --libdir=$out/lib)
+  '';
+
+  propagatedBuildInputs = [ expat curl fftw ];
+
+  meta = with stdenv.lib; {
+    homepage = https://code.google.com/archive/p/musicip-libofa/;
+    description = "Library Open Fingerprint Architecture";
+    longDescription = ''
+      LibOFA (Library Open Fingerprint Architecture) is an open-source audio
+      fingerprint created and provided by MusicIP'';
+    platforms = platforms.linux;
+    license = licenses.gpl2;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libofx/default.nix b/nixpkgs/pkgs/development/libraries/libofx/default.nix
new file mode 100644
index 000000000000..6723c08f0822
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libofx/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchurl, opensp, pkgconfig, libxml2, curl }:
+        
+stdenv.mkDerivation rec {
+  name = "libofx-0.9.14";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/libofx/${name}.tar.gz";
+    sha256 = "02i9zxkp66yxjpjay5dscfh53bz5vxy03zcxncpw09svl6zmf9xq";
+  };
+
+  configureFlags = [ "--with-opensp-includes=${opensp}/include/OpenSP" ];
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ opensp libxml2 curl ];
+
+  meta = { 
+    description = "Opensource implementation of the Open Financial eXchange specification";
+    homepage = http://libofx.sourceforge.net/;
+    license = "LGPL";
+    platforms = stdenv.lib.platforms.linux;
+    maintainers = [ ];
+  };
+}
+
diff --git a/nixpkgs/pkgs/development/libraries/libogg/default.nix b/nixpkgs/pkgs/development/libraries/libogg/default.nix
new file mode 100644
index 000000000000..71a8e528771b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libogg/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "libogg-1.3.3";
+
+  src = fetchurl {
+    url = "http://downloads.xiph.org/releases/ogg/${name}.tar.xz";
+    sha256 = "022wjlzn8fx7mfby4pcgyjwx8zir7jr7cizichh3jgaki8bwcgsg";
+  };
+
+  outputs = [ "out" "dev" "doc" ];
+
+  meta = with stdenv.lib; {
+    description = "Media container library to manipulate Ogg files";
+    longDescription = ''
+      Library to work with Ogg multimedia container format.
+      Ogg is flexible file storage and streaming format that supports
+      plethora of codecs. Open format free for anyone to use.
+    '';
+    homepage = https://xiph.org/ogg/;
+    license = licenses.bsd3;
+    maintainers = [ maintainers.ehmry ];
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/liboggz/default.nix b/nixpkgs/pkgs/development/libraries/liboggz/default.nix
new file mode 100644
index 000000000000..d7c3b747924a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/liboggz/default.nix
@@ -0,0 +1,33 @@
+{ stdenv, fetchurl, libogg, pkgconfig }:
+
+stdenv.mkDerivation rec {
+  name = "liboggz-1.1.1";
+
+  src = fetchurl {
+    url = "http://downloads.xiph.org/releases/liboggz/${name}.tar.gz";
+    sha256 = "0nj17lhnsw4qbbk8jy4j6a78w6v2llhqdwq46g44mbm9w2qsvbvb";
+  };
+
+  propagatedBuildInputs = [ libogg ];
+
+  nativeBuildInputs = [ pkgconfig ];
+
+  meta = with stdenv.lib; {
+    homepage = https://xiph.org/oggz/;
+    description = "A C library and tools for manipulating with Ogg files and streams";
+    longDescription = ''
+      Oggz comprises liboggz and the tool oggz, which provides commands to
+      inspect, edit and validate Ogg files. The oggz-chop tool can also be used
+      to serve time ranges of Ogg media over HTTP by any web server that
+      supports CGI.
+
+      liboggz is a C library for reading and writing Ogg files and streams.  It
+      offers various improvements over the reference libogg, including support
+      for seeking, validation and timestamp interpretation. Ogg is an
+      interleaving data container developed by Monty at Xiph.Org, originally to
+      support the Ogg Vorbis audio format but now used for many free codecs
+      including Dirac, FLAC, Speex and Theora.'';
+    platforms = platforms.unix;
+    license = licenses.bsd3;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/liboil/default.nix b/nixpkgs/pkgs/development/libraries/liboil/default.nix
new file mode 100644
index 000000000000..fb2dad605252
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/liboil/default.nix
@@ -0,0 +1,32 @@
+{stdenv, fetchurl, pkgconfig }:
+
+stdenv.mkDerivation rec {
+  name = "liboil-0.3.17";
+
+  src = fetchurl {
+    url = "${meta.homepage}/download/${name}.tar.gz";
+    sha256 = "0sgwic99hxlb1av8cm0albzh8myb7r3lpcwxfm606l0bkc3h4pqh";
+  };
+
+  patches = [ ./x86_64-cpuid.patch ];
+
+  outputs = [ "out" "dev" "devdoc" ];
+  outputBin = "dev"; # oil-bugreport
+
+  nativeBuildInputs = [ pkgconfig ];
+
+  # fix "argb_paint_i386.c:53:Incorrect register `%rax' used with `l' suffix"
+  # errors
+  configureFlags = stdenv.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";
+
+  meta = with stdenv.lib; {
+    description = "A library of simple functions that are optimized for various CPUs";
+    homepage    = https://liboil.freedesktop.org;
+    license     = licenses.bsd2;
+    maintainers = with maintainers; [ lovek323 ];
+    platforms   = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/liboil/x86_64-cpuid.patch b/nixpkgs/pkgs/development/libraries/liboil/x86_64-cpuid.patch
new file mode 100644
index 000000000000..d86dd79c3bcb
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/liboil/x86_64-cpuid.patch
@@ -0,0 +1,38 @@
+From 705916007fba0a845229a02dc6474cb523eff150 Mon Sep 17 00:00:00 2001
+From: David Schleef <ds@schleef.org>
+Date: Tue, 20 Jul 2010 21:05:26 +0000
+Subject: x86: Fix cpuid function on x86-64
+
+Fixes: #28956.
+---
+diff --git a/liboil/liboilcpu-x86.c b/liboil/liboilcpu-x86.c
+index e7a1978..ef4d3f2 100644
+--- a/liboil/liboilcpu-x86.c
++++ b/liboil/liboilcpu-x86.c
+@@ -162,13 +162,10 @@ get_cpuid (uint32_t op, uint32_t *a, uint32_t *b, uint32_t *c, uint32_t *d)
+ static void
+ get_cpuid (uint32_t op, uint32_t *a, uint32_t *b, uint32_t *c, uint32_t *d)
+ {
++  *a = op;
+   __asm__ (
+-      "  pushq %%rbx\n"
+       "  cpuid\n"
+-      "  mov %%ebx, %%esi\n"
+-      "  popq %%rbx\n"
+-      : "=a" (*a), "=S" (*b), "=c" (*c), "=d" (*d)
+-      : "0" (op));
++      : "+a" (*a), "=b" (*b), "=c" (*c), "=d" (*d));
+ }
+ #endif
+ 
+@@ -185,7 +182,7 @@ oil_cpu_detect_cpuid (void)
+ {
+   uint32_t eax, ebx, ecx, edx;
+   uint32_t level;
+-  char vendor[13] = { 0 };
++  char vendor[13+4] = { 0 };
+   int ret;
+ 
+   oil_fault_check_enable ();
+--
+cgit v0.9.0.2-2-gbebe
diff --git a/nixpkgs/pkgs/development/libraries/libomxil-bellagio/default.nix b/nixpkgs/pkgs/development/libraries/libomxil-bellagio/default.nix
new file mode 100644
index 000000000000..d53b1dc08308
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libomxil-bellagio/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "libomxil-bellagio-${version}";
+  version = "0.9.3";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/omxil/omxil/Bellagio%20${version}/${name}.tar.gz";
+    sha256 = "0k6p6h4npn8p1qlgq6z3jbfld6n1bqswzvxzndki937gr0lhfg2r";
+  };
+
+  configureFlags =
+    stdenv.lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ "ac_cv_func_malloc_0_nonnull=yes" ];
+
+  patches = [ ./fedora-fixes.patch ];
+
+  doCheck = false; # fails
+
+  meta = with stdenv.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;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libomxil-bellagio/fedora-fixes.patch b/nixpkgs/pkgs/development/libraries/libomxil-bellagio/fedora-fixes.patch
new file mode 100644
index 000000000000..2ae3c3c871c5
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libomxil-bellagio/fedora-fixes.patch
@@ -0,0 +1,199 @@
+When libomxdynamicloader.so is loaded, it complains that RM_Deinit can't be resolved.
+Link explicitly against omxil-bellagio so that ld.so can find the reference.
+
+Signed-off-by: Qais Yousef <qais.yousef@imgtec.com>
+
+--- bellagio-0.9.3/src/dynamic_loader/Makefile.am.old	2012-03-23 15:07:47.379021034 +0000
++++ bellagio-0.9.3/src/dynamic_loader/Makefile.am	2012-03-23 15:08:47.563034818 +0000
+@@ -3,7 +3,7 @@
+ omxdynamicloader_LTLIBRARIES = libomxdynamicloader.la
+ libomxdynamicloader_la_SOURCES = ste_dynamic_component_loader.c ste_dynamic_component_loader.h
+ 
+-libomxdynamicloader_la_LDFLAGS =
++libomxdynamicloader_la_LDFLAGS = -L$(abs_top_srcdir)/src/.libs -lomxil-bellagio
+ libomxdynamicloader_la_CFLAGS = -I$(top_srcdir)/include \
+ 			-I$(top_srcdir)/src \
+ 			-I$(top_srcdir)/src/base \
+Fix dependency issue to allow parallel build
+
+Signed-off-by: Qais Yousef <qais.yousef@imgtec.com>
+
+Index: bellagio-0.9.3/src/Makefile.am
+===================================================================
+--- bellagio-0.9.3.orig/src/Makefile.am
++++ bellagio-0.9.3/src/Makefile.am
+@@ -8,6 +8,7 @@ omxregister_bellagio_SOURCES = omxregist
+ omxregister_bellagio_CFLAGS = -DOMXILCOMPONENTSPATH=\"$(plugindir)/\" \
+ 			      -I$(top_srcdir)/include
+ omxregister_bellagio_LDFLAGS = -lomxil-bellagio -L$(builddir)
++omxregister_bellagio_DEPENDENCIES = libomxil-bellagio.la
+ 
+ lib_LTLIBRARIES = libomxil-bellagio.la
+ libomxil_bellagio_la_SOURCES = component_loader.h \
+We always access globalComponentList[] at indexComponent=-1 which causes a
+segfault. Use i as the index instead.
+
+Signed-off-by: Qais Yousef <qais.yousef@imgtec.com>
+
+--- bellagio-0.9.3/src/omx_reference_resource_manager.c.old	2012-03-13 10:15:25.743940980 +0000
++++ bellagio-0.9.3/src/omx_reference_resource_manager.c	2012-03-13 10:18:02.201971009 +0000
+@@ -485,7 +485,6 @@
+ OMX_ERRORTYPE RM_removeFromWaitForResource(OMX_COMPONENTTYPE *openmaxStandComp) {
+ 	omx_base_component_PrivateType* omx_base_component_Private;
+ 	int i = 0;
+-	int indexComponent = -1;
+ 
+ 	DEBUG(DEB_LEV_FUNCTION_NAME, "In %s\n", __func__);
+ 	omx_base_component_Private = (omx_base_component_PrivateType*)openmaxStandComp->pComponentPrivate;
+@@ -493,16 +492,13 @@
+ 	while(listOfcomponentRegistered[i].component_name != NULL ) {
+ 		if (!strcmp(listOfcomponentRegistered[i].component_name, omx_base_component_Private->name)) {
+ 			// found component in the list of the resource manager
+-			removeElemFromList(&globalComponentList[indexComponent], openmaxStandComp);
+-			break;
++			removeElemFromList(&globalComponentList[i], openmaxStandComp);
++			DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s\n", __func__);
++			return OMX_ErrorNone;
+ 		}
+ 		i++;
+ 	}
+-	if (indexComponent <0) {
+-		// No resource to be handled
+-		DEBUG(DEB_LEV_ERR, "In %s No resource to be handled\n", __func__);
+-		return OMX_ErrorNone;
+-	}
+-	DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s\n", __func__);
++	// No resource to be handled
++	DEBUG(DEB_LEV_ERR, "In %s No resource to be handled\n", __func__);
+ 	return OMX_ErrorNone;
+ }
+ OMX_INDEXTYPE/OMX_INDEXVENDORTYPE in one switch
+ src/base/omx_base_component.c |   54 ++++++++++++++++++++++-------------------
+ 1 files changed, 29 insertions(+), 25 deletions(-)
+--- a/src/base/omx_base_component.c	
++++ a/src/base/omx_base_component.c	
+@@ -915,14 +915,6 @@ OSCL_EXPORT_REF OSCL_EXPORT_REF OMX_ERRORTYPE omx_base_component_GetParameter(
+     return OMX_ErrorBadParameter;
+   }
+   switch(nParamIndex) {
+-  case OMX_IndexParameterThreadsID:
+-	    if ((err = checkHeader(ComponentParameterStructure, sizeof(OMX_PARAM_BELLAGIOTHREADS_ID))) != OMX_ErrorNone) {
+-	      break;
+-	    }
+-	  threadID = (OMX_PARAM_BELLAGIOTHREADS_ID *)ComponentParameterStructure;
+-	  threadID->nThreadBufferMngtID = omx_base_component_Private->bellagioThreads->nThreadBufferMngtID;
+-	  threadID->nThreadMessageID = omx_base_component_Private->bellagioThreads->nThreadMessageID;
+-	  break;
+   case OMX_IndexParamAudioInit:
+   case OMX_IndexParamVideoInit:
+   case OMX_IndexParamImageInit:
+@@ -988,28 +980,40 @@ OSCL_EXPORT_REF OSCL_EXPORT_REF OMX_ERRORTYPE omx_base_component_GetParameter(
+       }
+     }
+     break;
+-  case OMX_IndexVendorCompPropTunnelFlags:
+-    pPropTunnelSetup = (OMX_VENDOR_PROP_TUNNELSETUPTYPE*)ComponentParameterStructure;
++  default:
++    /* additional switch statement for extended OMX_INDEXTYPE */
++    switch((OMX_INDEXVENDORTYPE) nParamIndex) {
++    case OMX_IndexParameterThreadsID:
++        if ((err = checkHeader(ComponentParameterStructure, sizeof(OMX_PARAM_BELLAGIOTHREADS_ID))) != OMX_ErrorNone) {
++          break;
++        }
++      threadID = (OMX_PARAM_BELLAGIOTHREADS_ID *)ComponentParameterStructure;
++      threadID->nThreadBufferMngtID = omx_base_component_Private->bellagioThreads->nThreadBufferMngtID;
++      threadID->nThreadMessageID = omx_base_component_Private->bellagioThreads->nThreadMessageID;
++      break;
++    case OMX_IndexVendorCompPropTunnelFlags:
++      pPropTunnelSetup = (OMX_VENDOR_PROP_TUNNELSETUPTYPE*)ComponentParameterStructure;
+ 
+-    if (pPropTunnelSetup->nPortIndex >= (omx_base_component_Private->sPortTypesParam[OMX_PortDomainAudio].nPorts +
+-                                         omx_base_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts +
+-                                         omx_base_component_Private->sPortTypesParam[OMX_PortDomainImage].nPorts +
+-                                         omx_base_component_Private->sPortTypesParam[OMX_PortDomainOther].nPorts)) {
++      if (pPropTunnelSetup->nPortIndex >= (omx_base_component_Private->sPortTypesParam[OMX_PortDomainAudio].nPorts +
++                                           omx_base_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts +
++                                           omx_base_component_Private->sPortTypesParam[OMX_PortDomainImage].nPorts +
++                                           omx_base_component_Private->sPortTypesParam[OMX_PortDomainOther].nPorts)) {
+ 
+-      DEBUG(DEB_LEV_ERR,"In %s OMX_IndexVendorCompPropTunnelFlags nPortIndex=%d Line=%d \n",
+-          __func__,(int)pPropTunnelSetup->nPortIndex,__LINE__);
++        DEBUG(DEB_LEV_ERR,"In %s OMX_IndexVendorCompPropTunnelFlags nPortIndex=%d Line=%d \n",
++            __func__,(int)pPropTunnelSetup->nPortIndex,__LINE__);
+ 
+-      return OMX_ErrorBadPortIndex;
+-    }
++        return OMX_ErrorBadPortIndex;
++      }
+ 
+-    pPort = omx_base_component_Private->ports[pPropTunnelSetup->nPortIndex];
++      pPort = omx_base_component_Private->ports[pPropTunnelSetup->nPortIndex];
+ 
+-    pPropTunnelSetup->nTunnelSetup.nTunnelFlags  = pPort->nTunnelFlags;
+-    pPropTunnelSetup->nTunnelSetup.eSupplier     = pPort->eBufferSupplier;
+-    break;
+-  default:
+-    err = OMX_ErrorUnsupportedIndex;
+-    break;
++      pPropTunnelSetup->nTunnelSetup.nTunnelFlags  = pPort->nTunnelFlags;
++      pPropTunnelSetup->nTunnelSetup.eSupplier     = pPort->eBufferSupplier;
++      break;
++    default:
++      err = OMX_ErrorUnsupportedIndex;
++      break;
++    }
+   }
+   DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s for component %p\n", __func__, hComponent);
+   return err;
+diff -up libomxil-bellagio-0.9.3/Makefile.am.nodoc libomxil-bellagio-0.9.3/Makefile.am
+--- libomxil-bellagio-0.9.3/Makefile.am.nodoc	2011-01-12 08:53:26.000000000 +0100
++++ libomxil-bellagio-0.9.3/Makefile.am	2012-04-23 13:46:15.410823381 +0200
+@@ -7,7 +7,6 @@ EXTRA_DIST = libomxil-bellagio.spec
+ pkgconfigdir = $(libdir)/pkgconfig
+ pkgconfig_DATA = libomxil-bellagio.pc
+ 
+-docdir = $(DESTDIR)$(prefix)/share/doc/@PACKAGE@
+ doc_DATA = README \
+ 	   ChangeLog \
+ 	   TODO
+diff -up libomxil-bellagio-0.9.3/src/omxregister.c.unused libomxil-bellagio-0.9.3/src/omxregister.c
+--- libomxil-bellagio-0.9.3/src/omxregister.c.unused	2011-01-12 08:53:26.000000000 +0100
++++ libomxil-bellagio-0.9.3/src/omxregister.c	2012-12-10 22:02:28.621695659 +0100
+@@ -248,7 +248,15 @@ static int buildComponentsList(FILE* omx
+ 						}
+ 						fptr(stComponents);
+ 						err = fwrite(lib_absolute_path, 1, strlen(lib_absolute_path), omxregistryfp);
+-						err = fwrite("\n", 1, 1, omxregistryfp);
++						if (err != strlen(lib_absolute_path)) {
++							DEBUG(DEB_LEV_ERR, "Failed to write %zu bytes to fd %d\n", strlen(lib_absolute_path), fileno(omxregistryfp));
++							continue;
++						}
++						err = fwrite("\n", 1, strlen(buffer), omxregistryfp);
++						if (err != strlen(buffer)) {
++							DEBUG(DEB_LEV_ERR, "Failed to write %zu bytes to fd %d\n", strlen(buffer), fileno(omxregistryfp));
++							continue;
++						}
+ 
+ 
+ 						for (i = 0; i<num_of_comp; i++) {
+--- libomxil-bellagio-0.9.3/include/OMX_Types.h.orig 2011-01-12 08:53:26.000000000 +0100
++++ libomxil-bellagio-0.9.3/include/OMX_Types.h 2013-02-25 09:53:55.000000000 +0100
+@@ -314,6 +314,18 @@
+  *  platform & operating specific object used to reference the window */
+ typedef void* OMX_NATIVE_WINDOWTYPE;
+
++
++/** Define the OMX IL version that corresponds to this set of header files.
++ *  We also define a combined version that can be used to write or compare
++ *  values of the 32bit nVersion field, assuming a little endian architecture */
++#define OMX_VERSION_MAJOR 1
++#define OMX_VERSION_MINOR 1
++#define OMX_VERSION_REVISION 2
++#define OMX_VERSION_STEP 0
++
++#define OMX_VERSION ((OMX_VERSION_STEP<<24) | (OMX_VERSION_REVISION<<16) | (OMX_VERSION_MINOR<<8) | OMX_VERSION_MAJOR)
++
++
+ /** The OMX_VERSIONTYPE union is used to specify the version for
+     a structure or component.  For a component, the version is entirely
+     specified by the component vendor.  Components doing the same function
diff --git a/nixpkgs/pkgs/development/libraries/liboop/default.nix b/nixpkgs/pkgs/development/libraries/liboop/default.nix
new file mode 100644
index 000000000000..73d51ec49ffc
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/liboop/default.nix
@@ -0,0 +1,17 @@
+{stdenv, fetchurl}:
+
+stdenv.mkDerivation {
+  name = "liboop-1.0";
+  
+  src = fetchurl {
+    url = http://download.ofb.net/liboop/liboop.tar.gz;
+    sha256 = "34d83c6e0f09ee15cb2bc3131e219747c3b612bb57cf7d25318ab90da9a2d97c";
+  };
+
+  meta = {
+    description = "Event loop library";
+    homepage = http://liboop.ofb.net/;
+    license = "LGPL";
+    platforms = stdenv.lib.platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libopcodes/default.nix b/nixpkgs/pkgs/development/libraries/libopcodes/default.nix
new file mode 100644
index 000000000000..450b9058d0b9
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libopcodes/default.nix
@@ -0,0 +1,44 @@
+{ stdenv, buildPackages
+, autoreconfHook, bison, binutils-unwrapped
+, libiberty, libbfd
+}:
+
+stdenv.mkDerivation rec {
+  name = "libopcodes-${version}";
+  inherit (binutils-unwrapped) version src;
+
+  outputs = [ "out" "dev" ];
+
+  patches = binutils-unwrapped.patches ++ [
+    ../../tools/misc/binutils/build-components-separately.patch
+  ];
+
+  # We just want to build libopcodes
+  postPatch = ''
+    cd opcodes
+    find . ../include/opcode -type f -exec sed {} -i -e 's/"bfd.h"/<bfd.h>/' \;
+  '';
+
+  depsBuildBuild = [ buildPackages.stdenv.cc ];
+  nativeBuildInputs = [ autoreconfHook bison ];
+  buildInputs = [ libiberty ];
+  # dis-asm.h includes bfd.h
+  propagatedBuildInputs = [ libbfd ];
+
+  configurePlatforms = [ "build" "host" ];
+  configureFlags = [
+    "--enable-targets=all" "--enable-64-bit-bfd"
+    "--enable-install-libbfd"
+    "--enable-shared"
+  ];
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    description = "A library from binutils for manipulating machine code";
+    homepage = https://www.gnu.org/software/binutils/;
+    license = licenses.gpl3Plus;
+    maintainers = with maintainers; [ ericson2314 ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libopenaptx/default.nix b/nixpkgs/pkgs/development/libraries/libopenaptx/default.nix
new file mode 100644
index 000000000000..a29f8dc4a804
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libopenaptx/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchFromGitHub }:
+
+stdenv.mkDerivation rec {
+  name = "libopenaptx-${version}";
+  version = "0.1.0";
+
+  src = fetchFromGitHub {
+    owner = "pali";
+    repo = "libopenaptx";
+    rev = version;
+    sha256 = "0996qmkmbax7ccknxrd3bx8xibs79a1ffms69scsj59f3kgj6854";
+  };
+
+  makeFlags = [ "PREFIX=$(out)" ];
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    description = "Audio Processing Technology codec (aptX)";
+    license = licenses.lgpl21Plus;
+    homepage = https://github.com/pali/libopenaptx;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ orivej ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/liboping/default.nix b/nixpkgs/pkgs/development/libraries/liboping/default.nix
new file mode 100644
index 000000000000..ca026811d69b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/liboping/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchurl, ncurses ? null, perl ? null }:
+
+stdenv.mkDerivation rec {
+  name = "liboping-1.10.0";
+
+  src = fetchurl {
+    url = "http://verplant.org/liboping/files/${name}.tar.bz2";
+    sha256 = "1n2wkmvw6n80ybdwkjq8ka43z2x8mvxq49byv61b52iyz69slf7b";
+  };
+
+  buildInputs = [ ncurses perl ];
+
+  configureFlags = stdenv.lib.optional (perl == null) "--with-perl-bindings=no";
+
+  meta = with stdenv.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
+      "ping packets". It is intended for use in network monitoring applications
+      or applications that would otherwise need to fork ping(1) frequently.
+      Included is a sample application, called oping, which demonstrates the
+      library's abilities.
+    '';
+    homepage = http://noping.cc/;
+    license = licenses.lgpl21;
+    platforms = platforms.unix;
+    maintainers = [ maintainers.bjornfor ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libopus/default.nix b/nixpkgs/pkgs/development/libraries/libopus/default.nix
new file mode 100644
index 000000000000..10d438500a63
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libopus/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchurl
+, fixedPoint ? false, withCustomModes ? true }:
+
+let
+  version = "1.3.1";
+in
+stdenv.mkDerivation rec {
+  name = "libopus-${version}";
+
+  src = fetchurl {
+    url = "https://archive.mozilla.org/pub/opus/opus-${version}.tar.gz";
+    sha256 = "17gz8kxs4i7icsc1gj713gadiapyklynlwqlf0ai98dj4lg8xdb5";
+  };
+
+  outputs = [ "out" "dev" ];
+
+  configureFlags = stdenv.lib.optional fixedPoint "--enable-fixed-point"
+                ++ stdenv.lib.optional withCustomModes "--enable-custom-modes";
+
+  doCheck = true;
+
+  meta = with stdenv.lib; {
+    description = "Open, royalty-free, highly versatile audio codec";
+    license = stdenv.lib.licenses.bsd3;
+    homepage = http://www.opus-codec.org/;
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libopusenc/default.nix b/nixpkgs/pkgs/development/libraries/libopusenc/default.nix
new file mode 100644
index 000000000000..4ca0849447f3
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libopusenc/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchurl, pkgconfig, libopus }:
+
+let
+  version = "0.2.1";
+in
+stdenv.mkDerivation rec {
+  name = "libopusenc-${version}";
+
+  src = fetchurl {
+    url = "https://archive.mozilla.org/pub/opus/libopusenc-${version}.tar.gz";
+    sha256 = "1ffb0vhlymlsq70pxsjj0ksz77yfm2x0a1x8q50kxmnkm1hxp642";
+  };
+
+  outputs = [ "out" "dev" ];
+
+  doCheck = true;
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ libopus ];
+
+  meta = with stdenv.lib; {
+    description = "Library for encoding .opus audio files and live streams";
+    license = licenses.bsd3;
+    homepage = http://www.opus-codec.org/;
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ pmiddend ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libosinfo/default.nix b/nixpkgs/pkgs/development/libraries/libosinfo/default.nix
new file mode 100644
index 000000000000..9efeb0f678e0
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libosinfo/default.nix
@@ -0,0 +1,46 @@
+{ stdenv, fetchurl, fetchpatch, pkgconfig, intltool, gobject-introspection, gtk-doc, docbook_xsl
+, glib, libsoup, libxml2, libxslt, check, curl, perl, hwdata, osinfo-db, vala ? null
+}:
+
+stdenv.mkDerivation rec {
+  pname = "libosinfo";
+  version = "1.5.0";
+
+  src = fetchurl {
+    url = "https://releases.pagure.org/${pname}/${pname}-${version}.tar.gz";
+    sha256 = "12b0xj9fz9q91d1pz9xm6aqap5k1ip0m9m3qvqmwjy1lk1kjasdz";
+  };
+
+  outputs = [ "out" "dev" "devdoc" ];
+
+  nativeBuildInputs = [
+    pkgconfig vala intltool gobject-introspection gtk-doc docbook_xsl
+  ];
+  buildInputs = [ glib libsoup libxml2 libxslt ];
+  checkInputs = [ check curl perl ];
+
+  patches = [
+    ./osinfo-db-data-dir.patch
+  ];
+
+  postPatch = ''
+    patchShebangs .
+    substituteInPlace osinfo/osinfo_loader.c --subst-var-by OSINFO_DB_DATA_DIR "${osinfo-db}/share"
+  '';
+
+  configureFlags = [
+    "--with-usb-ids-path=${hwdata}/share/hwdata/usb.ids"
+    "--with-pci-ids-path=${hwdata}/share/hwdata/pci.ids"
+    "--enable-gtk-doc"
+  ];
+
+  doCheck = true;
+
+  meta = with stdenv.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;
+    platforms = platforms.linux;
+    maintainers = [ maintainers.bjornfor ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libosinfo/osinfo-db-data-dir.patch b/nixpkgs/pkgs/development/libraries/libosinfo/osinfo-db-data-dir.patch
new file mode 100644
index 000000000000..8d202a92d095
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libosinfo/osinfo-db-data-dir.patch
@@ -0,0 +1,11 @@
+--- a/osinfo/osinfo_loader.c
++++ b/osinfo/osinfo_loader.c
+@@ -2304,7 +2304,7 @@
+     } else {
+         path = g_getenv("OSINFO_SYSTEM_DIR");
+         if (!path)
+-            path = DATA_DIR "/osinfo";
++            path = "@OSINFO_DB_DATA_DIR@/osinfo";
+ 
+         file = g_file_new_for_path(path);
+     }
diff --git a/nixpkgs/pkgs/development/libraries/libosmium/default.nix b/nixpkgs/pkgs/development/libraries/libosmium/default.nix
new file mode 100644
index 000000000000..791e4d890f93
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libosmium/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchFromGitHub, cmake, protozero, expat, zlib, bzip2, boost }:
+
+stdenv.mkDerivation rec {
+  name = "libosmium-${version}";
+  version = "2.15.1";
+
+  src = fetchFromGitHub {
+    owner = "osmcode";
+    repo = "libosmium";
+    rev = "v${version}";
+    sha256 = "1v1m068lcjngxnwirpi0vqjhqnxn9gqvafjp3sy14vzmgl2sw2kr";
+  };
+
+  nativeBuildInputs = [ cmake ];
+  buildInputs = [ protozero zlib bzip2 expat boost ];
+
+
+  meta = with stdenv.lib; {
+    description = "Fast and flexible C++ library for working with OpenStreetMap data";
+    homepage = "https://osmcode.org/libosmium/";
+    license = licenses.boost;
+    maintainers = with maintainers; [ das-g ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libosmpbf/default.nix b/nixpkgs/pkgs/development/libraries/libosmpbf/default.nix
new file mode 100644
index 000000000000..54ee86f0a39a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libosmpbf/default.nix
@@ -0,0 +1,23 @@
+{stdenv, fetchurl, protobuf}:
+
+stdenv.mkDerivation rec {
+  name = "libosmpbf-1.3.3";
+
+  src = fetchurl {
+    url = "https://github.com/scrosby/OSM-binary/archive/v1.3.3.tar.gz";
+    sha256 = "a109f338ce6a8438a8faae4627cd08599d0403b8977c185499de5c17b92d0798";
+  };
+
+  buildInputs = [ protobuf ];
+
+  sourceRoot = "OSM-binary-1.3.3/src";
+
+  installFlags = "PREFIX=$(out)";
+
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libossp-uuid/default.nix b/nixpkgs/pkgs/development/libraries/libossp-uuid/default.nix
new file mode 100644
index 000000000000..952509acc2ee
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libossp-uuid/default.nix
@@ -0,0 +1,47 @@
+{stdenv, fetchurl}:
+
+let version = "1.6.2"; in
+
+stdenv.mkDerivation {
+  name = "libossp-uuid-${version}";
+
+  src = fetchurl {
+    url = "ftp://ftp.ossp.org/pkg/lib/uuid/uuid-${version}.tar.gz";
+    sha256= "11a615225baa5f8bb686824423f50e4427acd3f70d394765bdff32801f0fd5b0";
+  };
+
+  configureFlags = [
+    "ac_cv_va_copy=yes"
+  ] ++ stdenv.lib.optional stdenv.isFreeBSD "--with-pic";
+
+  patches = [ ./shtool.patch ];
+
+  meta = with stdenv.lib; {
+    homepage = http://www.ossp.org/pkg/lib/uuid/;
+    description = "OSSP uuid ISO-C and C++ shared library";
+    longDescription =
+      ''
+        OSSP uuid is a ISO-C:1999 application programming interface
+        (API) and corresponding command line interface (CLI) for the
+        generation of DCE 1.1, ISO/IEC 11578:1996 and RFC 4122
+        compliant Universally Unique Identifier (UUID). It supports
+        DCE 1.1 variant UUIDs of version 1 (time and node based),
+        version 3 (name based, MD5), version 4 (random number based)
+        and version 5 (name based, SHA-1). Additional API bindings are
+        provided for the languages ISO-C++:1998, Perl:5 and
+        PHP:4/5. Optional backward compatibility exists for the ISO-C
+        DCE-1.1 and Perl Data::UUID APIs.
+
+        UUIDs are 128 bit numbers which are intended to have a high
+        likelihood of uniqueness over space and time and are
+        computationally difficult to guess. They are globally unique
+        identifiers which can be locally generated without contacting
+        a global registration authority. UUIDs are intended as unique
+        identifiers for both mass tagging objects with an extremely
+        short lifetime and to reliably identifying very persistent
+        objects across a network.
+      '';
+    license = licenses.bsd2;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libossp-uuid/shtool.patch b/nixpkgs/pkgs/development/libraries/libossp-uuid/shtool.patch
new file mode 100644
index 000000000000..f0c7cc485f50
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libossp-uuid/shtool.patch
@@ -0,0 +1,11 @@
+--- a/shtool	2008-07-05 05:43:08.000000000 +0800
++++ b/shtool	2018-07-25 15:45:40.559587471 +0800
+@@ -1400,7 +1400,7 @@
+             if [ ".$opt_t" = .yes ]; then
+                 echo "strip $dsttmp" 1>&2
+             fi
+-            strip $dsttmp || shtool_exit $?
++            $STRIP $dsttmp || shtool_exit $?
+         fi
+         if [ ".$opt_o" != . ]; then
+             if [ ".$opt_t" = .yes ]; then
diff --git a/nixpkgs/pkgs/development/libraries/libotr/default.nix b/nixpkgs/pkgs/development/libraries/libotr/default.nix
new file mode 100644
index 000000000000..080a19452154
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libotr/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, fetchurl, libgcrypt, autoreconfHook }:
+
+stdenv.mkDerivation rec {
+  name = "libotr-4.1.1";
+
+  src = fetchurl {
+    url = "https://otr.cypherpunks.ca/${name}.tar.gz";
+    sha256 = "1x8rliydhbibmzwdbyr7pd7n87m2jmxnqkpvaalnf4154hj1hfwb";
+  };
+
+  nativeBuildInputs = [ autoreconfHook ];
+  buildInputs = [ ];
+  propagatedBuildInputs = [ libgcrypt ];
+
+  meta = with stdenv.lib; {
+    homepage = http://www.cypherpunks.ca/otr/;
+    repositories.git = git://git.code.sf.net/p/otr/libotr;
+    license = licenses.lgpl21;
+    description = "Library for Off-The-Record Messaging";
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libow/default.nix b/nixpkgs/pkgs/development/libraries/libow/default.nix
new file mode 100644
index 000000000000..66cb0762c25a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libow/default.nix
@@ -0,0 +1,43 @@
+{ stdenv, fetchFromGitHub, autoconf, automake, pkgconfig, libtool }:
+
+stdenv.mkDerivation rec {
+  version = "3.2p1";
+  name = "libow-${version}";
+
+  src = fetchFromGitHub {
+    owner = "owfs";
+    repo = "owfs";
+    rev = "v${version}";
+    sha256 = "17jhhvlqzndf7q3xnb8bjf4j0j905c420cbxabwpz8xac3z62vb8";
+  };
+
+  nativeBuildInputs = [ autoconf automake pkgconfig ];
+
+  meta = with stdenv.lib; {
+    description = "1-Wire File System full library";
+    homepage = http://owfs.org/;
+    license = licenses.gpl2;
+    maintainers = with maintainers; [ disserman ];
+    platforms = platforms.unix;
+  };
+
+  buildInputs = [ libtool ];
+
+  preConfigure = "./bootstrap";
+
+  configureFlags = [
+      "--disable-owtcl"
+      "--disable-owphp"
+      "--disable-owpython"
+      "--disable-zero"
+      "--disable-owshell"
+      "--disable-owhttpd"
+      "--disable-owftpd"
+      "--disable-owserver"
+      "--disable-owperl"
+      "--disable-owtcl"
+      "--disable-owtap"
+      "--disable-owmon"
+      "--disable-owexternal"
+    ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/libowfat/default.nix b/nixpkgs/pkgs/development/libraries/libowfat/default.nix
new file mode 100644
index 000000000000..8c0094a3152b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libowfat/default.nix
@@ -0,0 +1,30 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "libowfat-0.32";
+
+  src = fetchurl {
+    url = "https://www.fefe.de/libowfat/${name}.tar.xz";
+    sha256 = "1hcqg7pvy093bxx8wk7i4gvbmgnxz2grxpyy7b4mphidjbcv7fgl";
+  };
+
+  # Dirty patch because 0.32 "moved headers to <libowfat/> upon install"
+  # but it breaks gatling-0.15 and opentracker-2018-05-26 ...
+  postPatch = ''
+    substituteInPlace GNUmakefile --replace \
+      'install -d $(DESTDIR)$(INCLUDEDIR)/libowfat' \
+      'install -d $(DESTDIR)$(INCLUDEDIR)'
+    substituteInPlace GNUmakefile --replace \
+      'install -m 644 $(INCLUDES) $(DESTDIR)$(INCLUDEDIR)/libowfat' \
+      'install -m 644 $(INCLUDES) $(DESTDIR)$(INCLUDEDIR)'
+  '';
+
+  makeFlags = "prefix=$(out)";
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    homepage = https://www.fefe.de/libowfat/;
+    license = licenses.gpl2;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libp11/default.nix b/nixpkgs/pkgs/development/libraries/libp11/default.nix
new file mode 100644
index 000000000000..774019de0d5b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libp11/default.nix
@@ -0,0 +1,31 @@
+{ stdenv, fetchFromGitHub, autoreconfHook, libtool, pkgconfig
+, openssl }:
+
+stdenv.mkDerivation rec {
+  name = "libp11-${version}";
+  version = "0.4.10";
+
+  src = fetchFromGitHub {
+    owner = "OpenSC";
+    repo = "libp11";
+    rev = name;
+    sha256 = "1m4aw45bqichhx7cn78d8l1r1v0ccvwzlfj09fay2l9rfic5jgfz";
+  };
+
+  configureFlags = [
+    "--with-enginesdir=${placeholder "out"}/lib/engines"
+  ];
+
+  nativeBuildInputs = [ autoreconfHook pkgconfig libtool ];
+
+  buildInputs = [ openssl ];
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.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;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libpaper/default.nix b/nixpkgs/pkgs/development/libraries/libpaper/default.nix
new file mode 100644
index 000000000000..b4b72e5a36d3
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libpaper/default.nix
@@ -0,0 +1,37 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  version = "1.1.24";
+  name = "libpaper-${version}";
+
+  src = fetchurl {
+    url = "mirror://debian/pool/main/libp/libpaper/libpaper_${version}.tar.gz";
+    sha256 = "0zhcx67afb6b5r936w5jmaydj3ks8zh83n9rm5sv3m3k8q8jib1q";
+  };
+
+  # The configure script of libpaper is buggy: it uses AC_SUBST on a headerfile
+  # to compile sysconfdir into the library. Autoconf however defines sysconfdir
+  # as "${prefix}/etc", which is not expanded by AC_SUBST so libpaper will look
+  # for config files in (literally, without expansion) '${prefix}/etc'. Manually
+  # setting sysconfdir fixes this issue.
+  preConfigure = ''
+    configureFlagsArray+=(
+      "--sysconfdir=$out/etc"
+    )
+  '';
+
+  # Set the default paper to letter (this is what libpaper uses as default as well,
+  # if you call getdefaultpapername()).
+  # The user can still override this with the PAPERCONF environment variable.
+  postInstall = ''
+    mkdir -p $out/etc
+    echo letter > $out/etc/papersize
+  '';
+
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libpar2/default.nix b/nixpkgs/pkgs/development/libraries/libpar2/default.nix
new file mode 100644
index 000000000000..cf97744069b3
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libpar2/default.nix
@@ -0,0 +1,26 @@
+{ stdenv, fetchurl, pkgconfig, libsigcxx }:
+
+let version = "0.4"; in
+
+stdenv.mkDerivation rec {
+  name = "libpar2-${version}";
+
+  src = fetchurl {
+    url = "https://launchpad.net/libpar2/trunk/${version}/+download/${name}.tar.gz";
+    sha256 = "1m4ncws1h03zq7zyqbaymvjzzbh1d3lc4wb1aksrdf0ync76yv9i";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ libsigcxx ];
+
+  patches = [ ./libpar2-0.4-external-verification.patch ];
+
+  CXXFLAGS = stdenv.lib.optionalString stdenv.cc.isClang "-std=c++11";
+
+  meta = {
+    homepage = http://parchive.sourceforge.net/;
+    license = stdenv.lib.licenses.gpl2Plus;
+    description = "A library for using Parchives (parity archive volume sets)";
+    platforms = stdenv.lib.platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libpar2/libpar2-0.4-external-verification.patch b/nixpkgs/pkgs/development/libraries/libpar2/libpar2-0.4-external-verification.patch
new file mode 100644
index 000000000000..74879c4fe9b8
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libpar2/libpar2-0.4-external-verification.patch
@@ -0,0 +1,16 @@
+diff -aud -U 5 libpar2-0.4-original/par2repairer.h libpar2-0.4-patched/par2repairer.h
+--- libpar2-0.4-original/par2repairer.h	2013-07-18 15:03:10.000000000 +0200
++++ libpar2-0.4-patched/par2repairer.h	2014-08-06 15:52:59.000000000 +0200
+@@ -94,11 +94,11 @@
+   // Perform a sliding window scan of the DiskFile looking for blocks of data that 
+   // might belong to any of the source files (for which a verification packet was
+   // available). If a block of data might be from more than one source file, prefer
+   // the one specified by the "sourcefile" parameter. If the first data block
+   // found is for a different source file then "sourcefile" is changed accordingly.
+-  bool ScanDataFile(DiskFile                *diskfile,   // [in]     The file being scanned
++  virtual bool ScanDataFile(DiskFile                *diskfile,   // [in]     The file being scanned
+                     Par2RepairerSourceFile* &sourcefile, // [in/out] The source file matched
+                     MatchType               &matchtype,  // [out]    The type of match
+                     MD5Hash                 &hashfull,   // [out]    The full hash of the file
+                     MD5Hash                 &hash16k,    // [out]    The hash of the first 16k
+                     u32                     &count);     // [out]    The number of blocks found
diff --git a/nixpkgs/pkgs/development/libraries/libpcap/default.nix b/nixpkgs/pkgs/development/libraries/libpcap/default.nix
new file mode 100644
index 000000000000..f7cbfeab4709
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libpcap/default.nix
@@ -0,0 +1,46 @@
+{ stdenv, fetchurl, fetchpatch, flex, bison }:
+
+stdenv.mkDerivation rec {
+  name = "libpcap-1.9.0";
+
+  src = fetchurl {
+    url = "https://www.tcpdump.org/release/${name}.tar.gz";
+    sha256 = "06bhydl4vr4z9c3vahl76f2j96z1fbrcl7wwismgs4sris08inrf";
+  };
+
+  nativeBuildInputs = [ flex bison ];
+
+  # We need to force the autodetection because detection doesn't
+  # work in pure build enviroments.
+  configureFlags = [
+    ("--with-pcap=" + {
+      linux = "linux";
+      darwin = "bpf";
+    }.${stdenv.hostPlatform.parsed.kernel.name})
+  ] ++ stdenv.lib.optionals (stdenv.hostPlatform == stdenv.buildPlatform) [
+    "ac_cv_linux_vers=2"
+  ];
+
+  dontStrip = stdenv.hostPlatform != stdenv.buildPlatform;
+
+  prePatch = stdenv.lib.optionalString stdenv.isDarwin ''
+    substituteInPlace configure --replace " -arch i386" ""
+  '';
+
+  patches = [
+    # https://github.com/the-tcpdump-group/libpcap/pull/735
+    (fetchpatch {
+      name = "add-missing-limits-h-include-pr735.patch";
+      url = https://github.com/the-tcpdump-group/libpcap/commit/aafa3512b7b742f5e66a5543e41974cc5e7eebfa.patch;
+      sha256 = "05zb4hx9g24gx07bi02rprk2rn7fdc1ss3249dv5x36qkasnfhvf";
+    })
+  ];
+
+  meta = with stdenv.lib; {
+    homepage = https://www.tcpdump.org;
+    description = "Packet Capture Library";
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ fpletz ];
+    license = licenses.bsd3;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libpeas/default.nix b/nixpkgs/pkgs/development/libraries/libpeas/default.nix
new file mode 100644
index 000000000000..314d5884501f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libpeas/default.nix
@@ -0,0 +1,36 @@
+{ stdenv, fetchurl, pkgconfig, intltool, gnome3
+, glib, gtk3, gobject-introspection, python3, ncurses
+}:
+
+stdenv.mkDerivation rec {
+  pname = "libpeas";
+  version = "1.22.0";
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    sha256 = "0qm908kisyjzjxvygdl18hjqxvvgkq9w0phs2g55pck277sw0bsv";
+  };
+
+  configureFlags = [ "--enable-python3" ];
+
+  nativeBuildInputs = [ pkgconfig intltool gobject-introspection ];
+  buildInputs =  [ glib gtk3 ncurses python3 python3.pkgs.pygobject3 ];
+  propagatedBuildInputs = [
+    # Required by libpeas-1.0.pc
+    gobject-introspection
+  ];
+
+  passthru = {
+    updateScript = gnome3.updateScript {
+      packageName = pname;
+    };
+  };
+
+  meta = with stdenv.lib; {
+    description = "A GObject-based plugins engine";
+    homepage = https://wiki.gnome.org/Projects/Libpeas;
+    license = licenses.gpl2Plus;
+    platforms = platforms.unix;
+    maintainers = gnome3.maintainers;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libpfm/default.nix b/nixpkgs/pkgs/development/libraries/libpfm/default.nix
new file mode 100644
index 000000000000..bf1d26cf90d0
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libpfm/default.nix
@@ -0,0 +1,33 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  version = "4.10.1";
+  name = "libpfm-${version}";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/perfmon2/libpfm4/${name}.tar.gz";
+    sha256 = "0jabhjx77yppr7x38bkfww6n2a480gj62rw0qp7prhdmg19mf766";
+  };
+
+  makeFlags = [
+    "PREFIX=${placeholder "out"}"
+    "LDCONFIG=true"
+    "ARCH=${stdenv.hostPlatform.uname.processor}"
+    "SYS=${stdenv.hostPlatform.uname.system}"
+  ];
+
+  NIX_CFLAGS_COMPILE = [ "-Wno-error" ];
+
+  meta = with stdenv.lib; {
+    description = "Helper library to program the performance monitoring events";
+    longDescription = ''
+      This package provides a library, called libpfm4 which is used to
+      develop monitoring tools exploiting the performance monitoring
+      events such as those provided by the Performance Monitoring Unit
+      (PMU) of modern processors.
+    '';
+    license = licenses.gpl2;
+    maintainers = [ maintainers.pierron ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libpgf/default.nix b/nixpkgs/pkgs/development/libraries/libpgf/default.nix
new file mode 100644
index 000000000000..f8c91df64683
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libpgf/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchurl, autoconf, automake, libtool, dos2unix }:
+
+with stdenv.lib;
+
+let
+  version = "6.14.12";
+in
+stdenv.mkDerivation {
+  name = "libpgf-${version}";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/libpgf/libpgf-src-${version}.tar.gz";
+    sha256 = "1ssqjbh6l5jc04f67n47m9bqcigl46c6lgyabyi6cabnh1frk9dx";
+  };
+
+  buildInputs = [ autoconf automake libtool dos2unix ];
+
+  preConfigure = "dos2unix configure.ac; sh autogen.sh";
+
+# configureFlags = optional static "--enable-static --disable-shared";
+
+  meta = {
+    homepage = http://www.libpgf.org/;
+    description = "Progressive Graphics Format";
+    license = stdenv.lib.licenses.lgpl21Plus;
+    platforms = stdenv.lib.platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libphonenumber/default.nix b/nixpkgs/pkgs/development/libraries/libphonenumber/default.nix
new file mode 100644
index 000000000000..4cb327ff527b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libphonenumber/default.nix
@@ -0,0 +1,38 @@
+{ stdenv, fetchFromGitHub, cmake, gmock, boost, pkgconfig, protobuf, icu }:
+
+let
+  version = "8.9.9";
+in
+stdenv.mkDerivation {
+  name = "phonenumber-${version}";
+  inherit version;
+
+  src = fetchFromGitHub {
+    owner = "googlei18n";
+    repo = "libphonenumber";
+    rev = "v${version}";
+    sha256 = "005visnfnr84blgdi0yp4hrzskwbsnawrzv6lqfi9f073l6w5j6w";
+  };
+
+  nativeBuildInputs = [
+    cmake
+    gmock
+    pkgconfig
+  ];
+
+  buildInputs = [
+    boost
+    protobuf
+    icu
+  ];
+
+  cmakeDir = "../cpp";
+
+  checkPhase = "./libphonenumber_test";
+
+  meta = with stdenv.lib; {
+    description = "Google's i18n library for parsing and using phone numbers";
+    license = licenses.asl20;
+    maintainers = with maintainers; [ illegalprime ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libpinyin/default.nix b/nixpkgs/pkgs/development/libraries/libpinyin/default.nix
new file mode 100644
index 000000000000..26694eb37770
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libpinyin/default.nix
@@ -0,0 +1,33 @@
+{ stdenv, fetchurl, fetchFromGitHub, autoreconfHook, glib, db, pkgconfig }:
+
+let
+  modelData = fetchurl {
+    url    = "mirror://sourceforge/libpinyin/models/model14.text.tar.gz";
+    sha256 = "0qqk30nflj07zjhs231c95ln4yj4ipzwxxiwrxazrg4hb8bhypqq";
+  };
+in
+stdenv.mkDerivation rec {
+  name = "libpinyin-${version}";
+  version = "2.1.91";
+
+  nativeBuildInputs = [ autoreconfHook glib db pkgconfig ];
+
+  postUnpack = ''
+    tar -xzf ${modelData} -C $sourceRoot/data
+  '';
+
+  src = fetchFromGitHub {
+    owner  = "libpinyin";
+    repo   = "libpinyin";
+    rev    = version;
+    sha256 = "0jbvn65p3zh0573hh27aasd3qly5anyfi8jnps2dxi0my09wbrq3";
+  };
+
+  meta = with stdenv.lib; {
+    description = "Library for intelligent sentence-based Chinese pinyin input method";
+    homepage    = https://sourceforge.net/projects/libpinyin;
+    license     = licenses.gpl2;
+    maintainers = with maintainers; [ ericsagnes ];
+    platforms   = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libpipeline/default.nix b/nixpkgs/pkgs/development/libraries/libpipeline/default.nix
new file mode 100644
index 000000000000..eabf2d2a1064
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libpipeline/default.nix
@@ -0,0 +1,19 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "libpipeline-1.5.1";
+
+  src = fetchurl {
+    url = "mirror://savannah/libpipeline/${name}.tar.gz";
+    sha256 = "0bwh5xz5f2czwb7f564jz1mp4znm8pldnvf65fs0hpw4gmmp0cyn";
+  };
+
+  patches = stdenv.lib.optionals stdenv.isDarwin [ ./fix-on-osx.patch ];
+
+  meta = with stdenv.lib; {
+    homepage = http://libpipeline.nongnu.org;
+    description = "C library for manipulating pipelines of subprocesses in a flexible and convenient way";
+    platforms = platforms.unix;
+    license = licenses.gpl3;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libpipeline/fix-on-osx.patch b/nixpkgs/pkgs/development/libraries/libpipeline/fix-on-osx.patch
new file mode 100644
index 000000000000..c539e2dde970
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libpipeline/fix-on-osx.patch
@@ -0,0 +1,13 @@
+diff --git a/lib/pipeline.c b/lib/pipeline.c
+index 26478f9..1612307 100644
+--- a/lib/pipeline.c
++++ b/lib/pipeline.c
+@@ -75,6 +75,8 @@
+ #   endif
+ #endif
+ 
++const char* program_name = "libpipeline";
++
+ #if defined(HAVE_SETENV) && !defined(HAVE_CLEARENV)
+ int clearenv (void)
+ {
diff --git a/nixpkgs/pkgs/development/libraries/libplist/default.nix b/nixpkgs/pkgs/development/libraries/libplist/default.nix
new file mode 100644
index 000000000000..d622584c9da4
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libplist/default.nix
@@ -0,0 +1,41 @@
+{ stdenv,  autoreconfHook, fetchFromGitHub, pkgconfig, python2Packages, glib }:
+
+let
+  inherit (python2Packages) python cython;
+in
+stdenv.mkDerivation rec {
+  pname = "libplist";
+  version = "2019-04-04";
+
+  name = "${pname}-${version}";
+
+  src = fetchFromGitHub {
+    owner = "libimobiledevice";
+    repo = pname;
+    rev = "42bb64ba966082b440cb68cbdadf317f44710017";
+    sha256 = "19yw80yblq29i2jx9yb7bx0lfychy9dncri3fk4as35kq5bf26i8";
+  };
+
+  outputs = ["bin" "dev" "out" "py"];
+
+  nativeBuildInputs = [
+    pkgconfig
+    python
+    cython
+    autoreconfHook
+  ];
+
+  propagatedBuildInputs = [ glib ];
+
+  postFixup = ''
+    moveToOutput "lib/${python.libPrefix}" "$py"
+  '';
+
+  meta = with stdenv.lib; {
+    description = "A library to handle Apple Property List format in binary or XML";
+    homepage = https://github.com/libimobiledevice/libplist;
+    license = licenses.lgpl21Plus;
+    maintainers = with maintainers; [ infinisil ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libpng/12.nix b/nixpkgs/pkgs/development/libraries/libpng/12.nix
new file mode 100644
index 000000000000..2cd8c1debaf2
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libpng/12.nix
@@ -0,0 +1,31 @@
+{ stdenv, fetchurl, zlib }:
+
+assert stdenv.hostPlatform == stdenv.buildPlatform -> zlib != null;
+
+stdenv.mkDerivation rec {
+  name = "libpng-1.2.57";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/libpng/${name}.tar.xz";
+    sha256 = "1n2lrzjkm5jhfg2bs10q398lkwbbx742fi27zgdgx0x23zhj0ihg";
+  };
+
+  outputs = [ "out" "dev" "man" ];
+
+  propagatedBuildInputs = [ zlib ];
+
+  passthru = { inherit zlib; };
+
+  configureFlags = [ "--enable-static" ];
+
+  postInstall = ''mv "$out/bin" "$dev/bin"'';
+
+  meta = with stdenv.lib; {
+    description = "The official reference implementation for the PNG file format";
+    homepage = http://www.libpng.org/pub/png/libpng.html;
+    license = licenses.libpng;
+    maintainers = [ maintainers.fuuzetsu ];
+    branch = "1.2";
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libpng/default.nix b/nixpkgs/pkgs/development/libraries/libpng/default.nix
new file mode 100644
index 000000000000..849f7d29ef6d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libpng/default.nix
@@ -0,0 +1,39 @@
+{ stdenv, fetchurl, zlib, apngSupport ? true }:
+
+assert zlib != null;
+
+let
+  patchVersion = "1.6.37";
+  patch_src = fetchurl {
+    url = "mirror://sourceforge/libpng-apng/libpng-${patchVersion}-apng.patch.gz";
+    sha256 = "1dh0250mw9b2hx7cdmnb2blk7ddl49n6vx8zz7jdmiwxy38v4fw2";
+  };
+  whenPatched = stdenv.lib.optionalString apngSupport;
+
+in stdenv.mkDerivation rec {
+  name = "libpng" + whenPatched "-apng" + "-${version}";
+  version = "1.6.37";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/libpng/libpng-${version}.tar.xz";
+    sha256 = "1jl8in381z0128vgxnvn33nln6hzckl7l7j9nqvkaf1m9n1p0pjh";
+  };
+  postPatch = whenPatched "gunzip < ${patch_src} | patch -Np1";
+
+  outputs = [ "out" "dev" "man" ];
+  outputBin = "dev";
+
+  propagatedBuildInputs = [ zlib ];
+
+  doCheck = true;
+
+  passthru = { inherit zlib; };
+
+  meta = with stdenv.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;
+    platforms = platforms.all;
+    maintainers = [ maintainers.vcunat maintainers.fuuzetsu ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libpointmatcher/default.nix b/nixpkgs/pkgs/development/libraries/libpointmatcher/default.nix
new file mode 100644
index 000000000000..cd841a9d8f84
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libpointmatcher/default.nix
@@ -0,0 +1,36 @@
+{ stdenv, fetchFromGitHub, cmake, eigen, boost, libnabo }:
+
+stdenv.mkDerivation rec {
+  pname = "libpointmatcher";
+  version = "1.3.1";
+
+  src = fetchFromGitHub {
+    owner = "ethz-asl";
+    repo = pname;
+    rev = version;
+    sha256 = "0lai6sr3a9dj1j4pgjjyp7mx10wixy5wpvbka8nsc2danj6xhdyd";
+  };
+
+  nativeBuildInputs = [ cmake ];
+  buildInputs = [ eigen boost libnabo ];
+
+  enableParallelBuilding = true;
+
+  cmakeFlags = "
+    -DEIGEN_INCLUDE_DIR=${eigen}/include/eigen3
+  ";
+
+  doCheck = true;
+  checkPhase = ''
+    export LD_LIBRARY_PATH=$PWD
+    ./utest/utest --path ../examples/data/
+  '';
+
+  meta = with stdenv.lib; {
+    inherit (src.meta) homepage;
+    description = "An \"Iterative Closest Point\" library for 2-D/3-D mapping in robotic";
+    license = licenses.bsd3;
+    platforms = [ "x86_64-linux" ];
+    maintainers = with maintainers; [ cryptix ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libpqxx/default.nix b/nixpkgs/pkgs/development/libraries/libpqxx/default.nix
new file mode 100644
index 000000000000..737c0dc4a0ab
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libpqxx/default.nix
@@ -0,0 +1,30 @@
+{ lib, stdenv, fetchFromGitHub, postgresql, doxygen, xmlto, python2, gnused }:
+
+stdenv.mkDerivation rec {
+  pname = "libpqxx";
+  version = "6.4.4";
+
+  src = fetchFromGitHub {
+    owner = "jtv";
+    repo = pname;
+    rev = version;
+    sha256 = "0l62qlln5q1qhapbnm8n1k0hbzf3287gld1jpcbwr0yj79l9j579";
+  };
+
+  nativeBuildInputs = [ gnused python2 ];
+  buildInputs = [ postgresql doxygen xmlto ];
+
+  preConfigure = ''
+    patchShebangs .
+  '';
+
+  configureFlags = [ "--enable-shared" ];
+
+  meta = {
+    description = "A C++ library to access PostgreSQL databases";
+    homepage = http://pqxx.org/development/libpqxx/;
+    license = lib.licenses.bsd3;
+    platforms = lib.platforms.linux;
+    maintainers = [ lib.maintainers.eelco ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libproxy/default.nix b/nixpkgs/pkgs/development/libraries/libproxy/default.nix
new file mode 100644
index 000000000000..3b050c3dc6a0
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libproxy/default.nix
@@ -0,0 +1,47 @@
+{ stdenv, fetchFromGitHub, pkgconfig, cmake, zlib, fetchpatch
+, dbus, networkmanager, spidermonkey_38, pcre, python2, python3
+, SystemConfiguration, CoreFoundation, JavaScriptCore }:
+
+stdenv.mkDerivation rec {
+  name = "libproxy-${version}";
+  version = "0.4.15";
+
+  src = fetchFromGitHub {
+    owner = "libproxy";
+    repo = "libproxy";
+    rev = version;
+    sha256 = "10swd3x576pinx33iwsbd4h15fbh2snmfxzcmab4c56nb08qlbrs";
+  };
+
+  outputs = [ "out" "dev" ]; # to deal with propagatedBuildInputs
+
+  nativeBuildInputs = [ pkgconfig cmake ];
+
+  buildInputs = [ pcre python2 python3 zlib ]
+        ++ (if stdenv.hostPlatform.isDarwin
+            then [ SystemConfiguration CoreFoundation JavaScriptCore ]
+            else [ spidermonkey_38 dbus networkmanager ]);
+
+  preConfigure = ''
+    cmakeFlagsArray+=(
+      "-DWITH_MOZJS=ON"
+      "-DPYTHON2_SITEPKG_DIR=$out/${python2.sitePackages}"
+      "-DPYTHON3_SITEPKG_DIR=$out/${python3.sitePackages}"
+    )
+  '';
+
+  patches = stdenv.lib.optional stdenv.isDarwin
+    (fetchpatch {
+      url = "https://github.com/libproxy/libproxy/commit/44158f03f8522116758d335688ed840dfcb50ac8.patch";
+      sha256 = "0axfvb6j7gcys6fkwi9dkn006imhvm3kqr83gpwban8419n0q5v1";
+    });
+
+  doCheck = false; # fails 1 out of 10 tests
+
+  meta = with stdenv.lib; {
+    platforms = platforms.linux ++ platforms.darwin;
+    license = licenses.lgpl21;
+    homepage = http://libproxy.github.io/libproxy/;
+    description = "A library that provides automatic proxy configuration management";
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libpseudo/default.nix b/nixpkgs/pkgs/development/libraries/libpseudo/default.nix
new file mode 100644
index 000000000000..c04c8d724d0b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libpseudo/default.nix
@@ -0,0 +1,28 @@
+{stdenv, fetchurl, pkgconfig, glib, ncurses}:
+stdenv.mkDerivation rec {
+  name = "libpseudo-1.2.0";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/libpseudo/${name}.tar.gz";
+    sha256 = "0d3pw0m3frycr3x5kzqcaj4r2qh43iv6b0fpd6l4yk0aa4a9560n";
+  };
+
+  patchPhase = ''
+    sed -i -e s@/usr/local@$out@ -e /ldconfig/d Makefile
+  '';
+
+  preInstall = ''
+    mkdir -p $out/include
+    mkdir -p $out/lib
+  '';
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ glib ncurses ];
+
+  meta = with stdenv.lib; {
+    homepage = http://libpseudo.sourceforge.net/;
+    description = "Simple, thread-safe messaging between threads";
+    license = licenses.gpl2Plus;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libpsl/default.nix b/nixpkgs/pkgs/development/libraries/libpsl/default.nix
new file mode 100644
index 000000000000..7e2443d31e92
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libpsl/default.nix
@@ -0,0 +1,56 @@
+{ stdenv, fetchurl, autoreconfHook, docbook_xsl, docbook_xml_dtd_43, gtk-doc, lzip
+, libidn2, libunistring, libxslt, pkgconfig, python3, valgrind
+, publicsuffix-list
+}:
+
+stdenv.mkDerivation rec {
+  pname = "libpsl";
+  version = "0.21.0";
+
+  src = fetchurl {
+    url = "https://github.com/rockdaboot/${pname}/releases/download/${pname}-${version}/${pname}-${version}.tar.lz";
+    sha256 = "183hadbira0d2zvv8272lspy31dgm9x26z35c61s5axcd5wd9g9i";
+  };
+
+  nativeBuildInputs = [ autoreconfHook docbook_xsl docbook_xml_dtd_43 gtk-doc lzip pkgconfig python3 valgrind ];
+  buildInputs = [ libidn2 libunistring libxslt ];
+  propagatedBuildInputs = [ publicsuffix-list ];
+
+  postPatch = ''
+    patchShebangs src/psl-make-dafsa
+  '';
+
+  preAutoreconf = ''
+    gtkdocize
+  '';
+
+  configureFlags = [
+    "--disable-static"
+#    "--enable-gtk-doc"
+    "--enable-man"
+    "--enable-valgrind-tests"
+    "--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"
+  ];
+
+  enableParallelBuilding = true;
+
+  doCheck = true;
+
+  meta = with stdenv.lib; {
+    description = "C library for the Publix Suffix List";
+    longDescription = ''
+      libpsl is a C library for the Publix Suffix List (PSL). A "public suffix"
+      is a domain name under which Internet users can directly register own
+      names. Browsers and other web clients can use it to avoid privacy-leaking
+      "supercookies" and "super domain" certificates, for highlighting parts of
+      the domain in a user interface or sorting domain lists by site.
+    '';
+    homepage = "https://rockdaboot.github.io/libpsl/";
+    changelog = "https://raw.githubusercontent.com/rockdaboot/${pname}/${pname}-${version}/NEWS";
+    license = licenses.mit;
+    platforms = platforms.unix;
+    maintainers = [ maintainers.c0bw3b ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libpst/default.nix b/nixpkgs/pkgs/development/libraries/libpst/default.nix
new file mode 100644
index 000000000000..564fb96d0be4
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libpst/default.nix
@@ -0,0 +1,31 @@
+{ stdenv, fetchurl, autoreconfHook, boost, libgsf,
+  pkgconfig, bzip2, xmlto, gettext, imagemagick, doxygen }:
+
+stdenv.mkDerivation rec {
+  name = "libpst-0.6.72";
+
+  src = fetchurl {
+    url = "http://www.five-ten-sg.com/libpst/packages/${name}.tar.gz";
+    sha256 = "01ymym0218805g7bqhr7x2rlhzsbsbidi3nr0z2r2w07xf8xh6ca";
+  };
+
+  nativeBuildInputs = [ autoreconfHook pkgconfig ];
+  buildInputs = [
+    boost libgsf bzip2
+    xmlto gettext imagemagick doxygen
+  ];
+
+  configureFlags = [
+    "--enable-python=no"
+  ];
+
+  doCheck = true;
+
+  meta = with stdenv.lib; {
+    homepage = https://www.five-ten-sg.com/libpst/;
+    description = "A library to read PST (MS Outlook Personal Folders) files";
+    license = licenses.gpl2;
+    maintainers = [maintainers.tohl];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libpwquality/default.nix b/nixpkgs/pkgs/development/libraries/libpwquality/default.nix
new file mode 100644
index 000000000000..7d697ee10f17
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libpwquality/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, lib, fetchFromGitHub, autoreconfHook, perl, cracklib, python }:
+
+stdenv.mkDerivation rec {
+  name = "libpwquality-${version}";
+  version = "1.4.0";
+
+  src = fetchFromGitHub {
+    owner = "libpwquality";
+    repo = "libpwquality";
+    rev = name;
+    sha256 = "0k564hj2q13z5ag8cj6rnkzm1na7001k4chz4f736p6aqvspv0bd";
+  };
+
+  nativeBuildInputs = [ autoreconfHook perl ];
+  buildInputs = [ cracklib python ];
+
+  meta = with lib; {
+    description = "Password quality checking and random password generation library";
+    homepage = https://github.com/libpwquality/libpwquality;
+    license = licenses.bsd3;
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libqalculate/default.nix b/nixpkgs/pkgs/development/libraries/libqalculate/default.nix
new file mode 100644
index 000000000000..49490e1f7854
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libqalculate/default.nix
@@ -0,0 +1,48 @@
+{ stdenv, fetchFromGitHub, mpfr, libxml2, intltool, pkgconfig, doxygen,
+  autoreconfHook, readline, libiconv, icu, curl, gnuplot, gettext }:
+
+stdenv.mkDerivation rec {
+  pname = "libqalculate";
+  version = "3.2.0";
+
+  src = fetchFromGitHub {
+    owner = "qalculate";
+    repo = "libqalculate";
+    rev = "v${version}";
+    sha256 = "0f82jss3kjxsk8znvrg1vfh756nnc15sbzr34ww1dvvrxipi7sns";
+  };
+
+  outputs = [ "out" "dev" "doc" ];
+
+  nativeBuildInputs = [ intltool pkgconfig autoreconfHook doxygen ];
+  buildInputs = [ curl gettext libiconv readline ];
+  propagatedBuildInputs = [ libxml2 mpfr icu ];
+  enableParallelBuilding = true;
+
+  preConfigure = ''
+    intltoolize -f
+  '';
+
+  patchPhase = ''
+    substituteInPlace libqalculate/Calculator.cc \
+      --replace 'commandline = "gnuplot"' 'commandline = "${gnuplot}/bin/gnuplot"' \
+      --replace '"gnuplot - ' '"${gnuplot}/bin/gnuplot - '
+  '' + stdenv.lib.optionalString stdenv.cc.isClang ''
+    substituteInPlace src/qalc.cc \
+      --replace 'printf(_("aborted"))' 'printf("%s", _("aborted"))'
+  '';
+
+  preBuild = ''
+    pushd docs/reference
+    doxygen Doxyfile
+    popd
+  '';
+
+  meta = with stdenv.lib; {
+    description = "An advanced calculator library";
+    homepage = http://qalculate.github.io;
+    maintainers = with maintainers; [ gebner ];
+    license = licenses.gpl2Plus;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libqb/default.nix b/nixpkgs/pkgs/development/libraries/libqb/default.nix
new file mode 100644
index 000000000000..25b088f99ec8
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libqb/default.nix
@@ -0,0 +1,19 @@
+{ stdenv, fetchurl, pkgconfig }:
+
+stdenv.mkDerivation rec{
+  name = "libqb-0.17.2";
+
+  src = fetchurl {
+    url = "https://fedorahosted.org/releases/q/u/quarterback/${name}.tar.xz";
+    sha256 = "1zpl45p3n6dn1jgbsrrmccrmv2mvp8aqmnl0qxfjf7ymkrj9qhcs";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+
+  meta = with stdenv.lib; {
+    homepage = https://github.com/clusterlabs/libqb;
+    description = "A library providing high performance logging, tracing, ipc, and poll";
+    license = licenses.lgpl21;
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libqglviewer/default.nix b/nixpkgs/pkgs/development/libraries/libqglviewer/default.nix
new file mode 100644
index 000000000000..e68c5052beb8
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libqglviewer/default.nix
@@ -0,0 +1,26 @@
+{ stdenv, fetchurl, qt4, qmake4Hook, AGL }:
+
+stdenv.mkDerivation rec {
+  name = "libqglviewer-2.6.3";
+  version = "2.6.3";
+
+  src = fetchurl {
+    url = "http://www.libqglviewer.com/src/libQGLViewer-${version}.tar.gz";
+    sha256 = "00jdkyk4wg1356c3ar6nk3hyp494ya3yvshq9m57kfmqpn3inqdy";
+  };
+
+  buildInputs = [ qt4 qmake4Hook ]
+    ++ stdenv.lib.optional stdenv.isDarwin AGL;
+
+  postPatch =
+    ''
+      cd QGLViewer
+    '';
+
+  meta = with stdenv.lib; {
+    description = "C++ library based on Qt that eases the creation of OpenGL 3D viewers";
+    homepage = http://libqglviewer.com/;
+    license = licenses.gpl2;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libqmatrixclient/default.nix b/nixpkgs/pkgs/development/libraries/libqmatrixclient/default.nix
new file mode 100644
index 000000000000..f175bb6ea6d9
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libqmatrixclient/default.nix
@@ -0,0 +1,37 @@
+{ stdenv, fetchFromGitHub, cmake
+, qtbase, qtmultimedia }:
+
+let
+  generic = version: sha256: prefix: stdenv.mkDerivation rec {
+    name = "libqmatrixclient-${version}";
+
+    src = fetchFromGitHub {
+      owner = "QMatrixClient";
+      repo  = "libqmatrixclient";
+      rev   = "${prefix}${version}";
+      inherit sha256;
+    };
+
+    postPatch = ''
+      sed -i -e '/example/Id' CMakeLists.txt
+    '';
+
+    buildInputs = [ qtbase qtmultimedia ];
+
+    nativeBuildInputs = [ cmake ];
+
+    meta = with stdenv.lib; {
+      description= "A Qt5 library to write cross-platfrom clients for Matrix";
+      homepage = https://matrix.org/docs/projects/sdk/libqmatrixclient.html;
+      license = licenses.lgpl21;
+      platforms = with platforms; linux ++ darwin;
+      maintainers = with maintainers; [ peterhoeg ];
+    };
+  };
+
+in rec {
+  libqmatrixclient_0_4 = generic "0.4.2.1" "056hvp2m74wx72yd8vai18siddj9l8bhrvrkc4ia4cwjsqw02kid" "v";
+  libqmatrixclient_0_5 = generic "0.5.2"   "1bhlqfs7251fss4icx794ka614npr6zyrpp4qwc4q5408ykfm7lr" "";
+
+  libqmatrixclient = libqmatrixclient_0_4;
+}
diff --git a/nixpkgs/pkgs/development/libraries/libqmi/default.nix b/nixpkgs/pkgs/development/libraries/libqmi/default.nix
new file mode 100644
index 000000000000..8a2390483908
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libqmi/default.nix
@@ -0,0 +1,37 @@
+{ stdenv, fetchurl, pkgconfig, glib, python3, libgudev, libmbim }:
+
+stdenv.mkDerivation rec {
+  pname = "libqmi";
+  version = "1.22.4";
+
+  src = fetchurl {
+    url = "https://www.freedesktop.org/software/libqmi/${pname}-${version}.tar.xz";
+    sha256 = "1wgrrb9vb3myl8xgck8ik86876ycbg8crylybs3ssi21vrxqwnsc";
+  };
+
+  outputs = [ "out" "dev" "devdoc" ];
+
+  configureFlags = [
+    "--with-udev-base-dir=${placeholder ''out''}/lib/udev"
+  ];
+
+  nativeBuildInputs = [
+    pkgconfig
+    python3
+  ];
+
+  buildInputs = [
+    glib
+    libgudev
+    libmbim
+  ];
+
+  doCheck = true;
+
+  meta = with stdenv.lib; {
+    homepage = https://www.freedesktop.org/wiki/Software/libqmi/;
+    description = "Modem protocol helper library";
+    platforms = platforms.linux;
+    license = licenses.gpl2;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libqtav/default.nix b/nixpkgs/pkgs/development/libraries/libqtav/default.nix
new file mode 100644
index 000000000000..048ba48bb674
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libqtav/default.nix
@@ -0,0 +1,51 @@
+{ mkDerivation, lib, fetchFromGitHub, extra-cmake-modules
+, qtbase, qtmultimedia, qtquick1, qttools
+, libGL, libX11
+, libass, openal, ffmpeg, libuchardet
+, alsaLib, libpulseaudio, libva
+}:
+
+with lib;
+
+mkDerivation rec {
+  name = "libqtav-${version}";
+  version = "1.12.0";
+
+  nativeBuildInputs = [ extra-cmake-modules qttools ];
+  buildInputs = [
+    qtbase qtmultimedia qtquick1
+    libGL libX11
+    libass openal ffmpeg libuchardet
+    alsaLib libpulseaudio libva
+  ];
+
+  src = fetchFromGitHub {
+    sha256 = "03ii9l38l3fsr27g42fx4151ipzkip2kr4akdr8x28sx5r9rr5m2";
+    rev = "v${version}";
+    repo = "QtAV";
+    owner = "wang-bin";
+    fetchSubmodules = true;
+  };
+
+  # Make sure libqtav finds its libGL dependency at both link and run time
+  # by adding libGL to rpath. Not sure why it wasn't done automatically like
+  # the other libraries as `libGL` is part of our `buildInputs`.
+  NIX_CFLAGS_LINK = [ "-Wl,-rpath,${libGL}/lib"];
+
+  preFixup = ''
+    mkdir -p "$out/bin"
+    cp -a "./bin/"* "$out/bin"
+  '';
+
+  stripDebugList = [ "lib" "libexec" "bin" "qml" ];
+
+  meta = {
+    description = "A multimedia playback framework based on Qt + FFmpeg";
+    #license = licenses.lgpl21; # For the libraries / headers only.
+    license = licenses.gpl3; # With the examples (under bin) and most likely some of the optional dependencies used.
+    homepage = http://www.qtav.org/;
+    maintainers = [ maintainers.jraygauthier ];
+    platforms = platforms.linux;
+  };
+}
+
diff --git a/nixpkgs/pkgs/development/libraries/libr3/default.nix b/nixpkgs/pkgs/development/libraries/libr3/default.nix
new file mode 100644
index 000000000000..cf848d02a048
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libr3/default.nix
@@ -0,0 +1,33 @@
+{ stdenv
+, fetchFromGitHub
+, pcre
+, pkgconfig
+, check
+, autoreconfHook
+}:
+
+stdenv.mkDerivation rec {
+  pname = "r3";
+  version = "1.3.4";
+
+  src = fetchFromGitHub {
+    owner = "c9s";
+    repo = "r3";
+    rev = version;
+    sha256 = "09cixbms817p6nb77wz3rxp0znnac8ybycvsrrzgwlbfn58a3zwl";
+  };
+
+  nativeBuildInputs = [ autoreconfHook pkgconfig ];
+
+  buildInputs = [ check ];
+  propagatedBuildInputs = [ pcre ];
+
+  strictDeps = true;
+
+  meta = {
+    description = "A high-performance path dispatching library";
+    homepage = https://github.com/c9s/r3;
+    license = [ stdenv.lib.licenses.mit ];
+  };
+
+}
diff --git a/nixpkgs/pkgs/development/libraries/libraw/default.nix b/nixpkgs/pkgs/development/libraries/libraw/default.nix
new file mode 100644
index 000000000000..1a998c044359
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libraw/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchurl, lcms2, jasper, pkgconfig }:
+
+stdenv.mkDerivation rec {
+  name = "libraw-${version}";
+  version = "0.19.2";
+
+  src = fetchurl {
+    url = "https://www.libraw.org/data/LibRaw-${version}.tar.gz";
+    sha256 = "0i4nhjm5556xgn966x0i503ygk2wafq6z83kg0lisacjjab4f3a0";
+  };
+
+  outputs = [ "out" "lib" "dev" "doc" ];
+
+  buildInputs = [ jasper ];
+
+  propagatedBuildInputs = [ lcms2 ];
+
+  nativeBuildInputs = [ pkgconfig ];
+
+  meta = {
+    description = "Library for reading RAW files obtained from digital photo cameras (CRW/CR2, NEF, RAF, DNG, and others)";
+    homepage = https://www.libraw.org/;
+    license = stdenv.lib.licenses.gpl2Plus;
+    platforms = stdenv.lib.platforms.unix;
+  };
+}
+
diff --git a/nixpkgs/pkgs/development/libraries/libraw1394/default.nix b/nixpkgs/pkgs/development/libraries/libraw1394/default.nix
new file mode 100644
index 000000000000..a99e4d22077e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libraw1394/default.nix
@@ -0,0 +1,17 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "libraw1394-2.1.2";
+
+  src = fetchurl {
+    url = "mirror://kernel/linux/libs/ieee1394/${name}.tar.gz";
+    sha256 = "0z5md84941ky5l7afayx2z6j0sk0mildxbjajq6niznd44ky7i6x";
+  };
+
+  meta = with stdenv.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;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/librdf/default.nix b/nixpkgs/pkgs/development/libraries/librdf/default.nix
new file mode 100644
index 000000000000..d92b017712d4
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/librdf/default.nix
@@ -0,0 +1,34 @@
+{ config, stdenv, fetchurl, pkgconfig, autoreconfHook
+, librdf_raptor2, ladspaH, openssl, zlib
+, doCheck ? config.doCheckByDefault or false, ladspaPlugins
+}:
+
+stdenv.mkDerivation rec {
+  version = "0.5.0";
+  name = "liblrdf-${version}";
+
+  src = fetchurl {
+    url = "https://github.com/swh/LRDF/archive/${version}.tar.gz";
+    sha256 = "18p2flb2sv2hq6w2qkd29z9c7knnwqr3f12i2srshlzx6vwkm05s";
+  };
+
+  postPatch = stdenv.lib.optionalString doCheck ''
+    sed -i -e 's:usr/local:${ladspaPlugins}:' examples/{instances,remove}_test.c
+  '';
+
+  preAutoreconf = "rm m4/*";
+  nativeBuildInputs = [ autoreconfHook pkgconfig ];
+  buildInputs = [ ladspaH openssl zlib ];
+
+  propagatedBuildInputs = [ librdf_raptor2 ];
+
+  inherit doCheck;
+
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/librdf/raptor.nix b/nixpkgs/pkgs/development/libraries/librdf/raptor.nix
new file mode 100644
index 000000000000..14e3e1891bae
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/librdf/raptor.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchurl, libxml2, curl }:
+
+stdenv.mkDerivation rec {
+  name = "raptor-1.4.21";
+
+  src = fetchurl {
+    url = "http://download.librdf.org/source/${name}.tar.gz";
+    sha256 = "db3172d6f3c432623ed87d7d609161973d2f7098e3d2233d0702fbcc22cfd8ca";
+  };
+
+  buildInputs = [ libxml2 curl ];
+
+  preBuild = ''
+    sed -e '/curl\/types/d' -i src/*.c src/*.h
+  '';
+
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/librdf/raptor2.nix b/nixpkgs/pkgs/development/libraries/librdf/raptor2.nix
new file mode 100644
index 000000000000..3f4366771235
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/librdf/raptor2.nix
@@ -0,0 +1,22 @@
+{ stdenv, fetchurl, libxml2, libxslt }:
+
+stdenv.mkDerivation rec {
+  name = "raptor2-2.0.15";
+
+  src = fetchurl {
+    url = "http://download.librdf.org/source/${name}.tar.gz";
+    sha256 = "ada7f0ba54787b33485d090d3d2680533520cd4426d2f7fb4782dd4a6a1480ed";
+  };
+
+  buildInputs = [ libxml2 libxslt ];
+
+  postInstall = "rm -rvf $out/share/gtk-doc";
+
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/librdf/rasqal.nix b/nixpkgs/pkgs/development/libraries/librdf/rasqal.nix
new file mode 100644
index 000000000000..124fd0178182
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/librdf/rasqal.nix
@@ -0,0 +1,30 @@
+{ stdenv, fetchurl, librdf_raptor2, gmp, pkgconfig, pcre, libxml2, perl }:
+
+stdenv.mkDerivation rec {
+  name = "rasqal-0.9.33";
+
+  src = fetchurl {
+    url = "http://download.librdf.org/source/${name}.tar.gz";
+    sha256 = "0z6rrwn4jsagvarg8d5zf0j352kjgi33py39jqd29gbhcnncj939";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+
+  buildInputs = [ gmp pcre libxml2 ];
+
+  propagatedBuildInputs = [ librdf_raptor2 ];
+
+  postInstall = "rm -rvf $out/share/gtk-doc";
+
+  checkInputs = [ perl ];
+  doCheck = false; # fails with "No testsuite plan file sparql-query-plan.ttl could be created in build/..."
+  doInstallCheck = false; # fails with "rasqal-config does not support (--help|--version)"
+
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/librdf/redland.nix b/nixpkgs/pkgs/development/libraries/librdf/redland.nix
new file mode 100644
index 000000000000..30d8d8a94e9d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/librdf/redland.nix
@@ -0,0 +1,47 @@
+{ stdenv, fetchurl, pkgconfig, openssl, libxslt, perl
+, curl, pcre, libxml2, librdf_rasqal, gmp
+, mysql, withMysql ? false
+, postgresql, withPostgresql ? false
+, sqlite, withSqlite ? true
+, db, withBdb ? false
+}:
+
+stdenv.mkDerivation rec {
+  name = "redland-1.0.17";
+
+  src = fetchurl {
+    url = "http://download.librdf.org/source/${name}.tar.gz";
+    sha256 = "de1847f7b59021c16bdc72abb4d8e2d9187cd6124d69156f3326dd34ee043681";
+  };
+
+  nativeBuildInputs = [ perl pkgconfig ];
+
+  buildInputs = [ openssl libxslt curl pcre libxml2 gmp ]
+    ++ stdenv.lib.optional withMysql mysql.connector-c
+    ++ stdenv.lib.optional withSqlite sqlite
+    ++ stdenv.lib.optional withPostgresql postgresql
+    ++ stdenv.lib.optional withBdb db;
+
+  propagatedBuildInputs = [ librdf_rasqal ];
+
+  postInstall = "rm -rvf $out/share/gtk-doc";
+
+  configureFlags =
+    [ "--with-threads" ]
+    ++ stdenv.lib.optionals withBdb [
+      "--with-bdb-include=${db.dev}/include"
+      "--with-bdb-lib=${db.out}/lib"
+    ];
+
+  # Fix broken DT_NEEDED in lib/redland/librdf_storage_sqlite.so.
+  NIX_CFLAGS_LINK = "-lraptor2";
+
+  doCheck = false; # fails 1 out of 17 tests with a segmentation fault
+
+  meta = with stdenv.lib; {
+    description = "C libraries that provide support for the Resource Description Framework (RDF)";
+    homepage = http://librdf.org/;
+    platforms = platforms.unix;
+    license = licenses.asl20;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libre/default.nix b/nixpkgs/pkgs/development/libraries/libre/default.nix
new file mode 100644
index 000000000000..c9debe61743d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libre/default.nix
@@ -0,0 +1,24 @@
+{stdenv, fetchurl, zlib, openssl}:
+stdenv.mkDerivation rec {
+  version = "0.6.0";
+  name = "libre-${version}";
+  src = fetchurl {
+    url = "http://www.creytiv.com/pub/re-${version}.tar.gz";
+    sha256 = "0cc1x6pm1nz09046bfzgvp2p3wjbgm6f53d71a9dd14grjsvr5qf";
+  };
+  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}"
+  ;
+  meta = {
+    homepage = http://www.creytiv.com/re.html;
+    platforms = with stdenv.lib.platforms; linux;
+    maintainers = with stdenv.lib.maintainers; [raskin];
+    license = stdenv.lib.licenses.bsd3;
+    inherit version;
+    downloadPage = "http://www.creytiv.com/pub/";
+    updateWalker = true;
+    downloadURLRegexp = "/re-.*[.]tar[.].*";
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/librealsense/default.nix b/nixpkgs/pkgs/development/libraries/librealsense/default.nix
new file mode 100644
index 000000000000..db8dfcf2eecb
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/librealsense/default.nix
@@ -0,0 +1,33 @@
+{ stdenv, fetchFromGitHub, cmake, libusb, ninja, pkgconfig}:
+
+stdenv.mkDerivation rec {
+  name = "librealsense-${version}";
+  version = "2.21.0";
+
+  src = fetchFromGitHub {
+    owner = "IntelRealSense";
+    repo = "librealsense";
+    rev = "v${version}";
+    sha256 = "0fg4js390gj9lhyh9hmr7k3lhg5q1r47skyvziv9dmbj9dqm1ll7";
+  };
+
+  buildInputs = [
+    libusb
+  ];
+
+  nativeBuildInputs = [
+    cmake
+    ninja
+    pkgconfig
+  ];
+
+  cmakeFlags = [ "-DBUILD_EXAMPLES=false" ];
+
+  meta = with stdenv.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;
+    maintainers = with maintainers; [ brian-dawn ];
+    platforms = ["i686-linux" "x86_64-linux" "x86_64-darwin"];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/librelp/default.nix b/nixpkgs/pkgs/development/libraries/librelp/default.nix
new file mode 100644
index 000000000000..82a71be52105
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/librelp/default.nix
@@ -0,0 +1,20 @@
+{ stdenv, fetchurl, pkgconfig, gnutls, zlib }:
+
+stdenv.mkDerivation rec {
+  name = "librelp-1.3.0";
+
+  src = fetchurl {
+    url = "http://download.rsyslog.com/librelp/${name}.tar.gz";
+    sha256 = "1xg99ndn65984mrh30qvys5npc73ag4348whshghrcj9azya494z";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ gnutls zlib ];
+
+  meta = with stdenv.lib; {
+    homepage = https://www.librelp.com/;
+    description = "A reliable logging library";
+    license = licenses.gpl2;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/librem/default.nix b/nixpkgs/pkgs/development/libraries/librem/default.nix
new file mode 100644
index 000000000000..50c20d12ccc8
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/librem/default.nix
@@ -0,0 +1,27 @@
+{stdenv, fetchurl, zlib, openssl, libre}:
+stdenv.mkDerivation rec {
+  version = "0.6.0";
+  name = "librem-${version}";
+  src=fetchurl {
+    url = "http://www.creytiv.com/pub/rem-${version}.tar.gz";
+    sha256 = "0b17wma5w9acizk02isk5k83vv47vf1cf9zkmsc1ail677d20xj1";
+  };
+  buildInputs = [zlib openssl libre];
+  makeFlags = [
+    "LIBRE_MK=${libre}/share/re/re.mk"
+    "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}"
+  ;
+  meta = {
+    homepage = http://www.creytiv.com/rem.html;
+    platforms = with stdenv.lib.platforms; linux;
+    maintainers = with stdenv.lib.maintainers; [raskin];
+    license = stdenv.lib.licenses.bsd3;
+    downloadPage = "http://www.creytiv.com/pub/";
+    updateWalker = true;
+    downloadURLRegexp = "/rem-.*[.]tar[.].*";
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/librep/default.nix b/nixpkgs/pkgs/development/libraries/librep/default.nix
new file mode 100644
index 000000000000..2f78222cebb1
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/librep/default.nix
@@ -0,0 +1,41 @@
+{ stdenv, fetchurl
+, pkgconfig, autoreconfHook
+, readline, texinfo
+, gdbm, gmp, libffi }:
+
+with stdenv.lib;
+
+stdenv.mkDerivation rec {
+  name = "librep-${version}";
+  version = "0.92.7";
+  sourceName = "librep_${version}";
+
+  src = fetchurl {
+    url = "https://download.tuxfamily.org/librep/${sourceName}.tar.xz";
+    sha256 = "1bmcjl1x1rdh514q9z3hzyjmjmwwwkziipjpjsl301bwmiwrd8a8";
+  };
+
+  nativeBuildInputs = [ autoreconfHook pkgconfig ];
+  buildInputs = [ readline texinfo ];
+  propagatedBuildInputs = [ gdbm gmp libffi ];
+
+  configureFlags = [
+    "--disable-static"
+  ];
+
+  setupHook = ./setup-hook.sh;
+
+  meta = {
+    description = "Fast, lightweight, and versatile Lisp environment";
+    longDescription = ''
+      librep is a Lisp system for UNIX, comprising an
+      interpreter, a byte-code compiler, and a virtual
+      machine. It can serve as an application extension language
+      but is also suitable for standalone scripts.
+     '';
+    homepage = http://sawfish.wikia.com;
+    license = licenses.gpl2;
+    maintainers = [ maintainers.AndersonTorres ];
+  };
+}
+# TODO: investigate fetchFromGithub
diff --git a/nixpkgs/pkgs/development/libraries/librep/setup-hook.sh b/nixpkgs/pkgs/development/libraries/librep/setup-hook.sh
new file mode 100644
index 000000000000..4d875b693304
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/librep/setup-hook.sh
@@ -0,0 +1,5 @@
+addRepDLLoadPath () {
+    addToSearchPath REP_DL_LOAD_PATH $1/lib/rep
+}
+
+addEnvHooks "$hostOffset" addRepDLLoadPath
diff --git a/nixpkgs/pkgs/development/libraries/libresample/default.nix b/nixpkgs/pkgs/development/libraries/libresample/default.nix
new file mode 100644
index 000000000000..3684fd924f77
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libresample/default.nix
@@ -0,0 +1,28 @@
+{stdenv, fetchurl, cmake}:
+
+let
+  patch = fetchurl {
+    url = mirror://debian/pool/main/libr/libresample/libresample_0.1.3-3.diff.gz;
+    sha256 = "063w8rqxw87fc89gas47vk0ll7xl8cy7d8g70gm1l62bqkkajklx";
+  };
+in
+stdenv.mkDerivation {
+  name = "libresample-0.1.3";
+  src = fetchurl {
+    url = mirror://debian/pool/main/libr/libresample/libresample_0.1.3.orig.tar.gz;
+    sha256 = "05a8mmh1bw5afqx0kfdqzmph4x2npcs4idx0p0v6q95lwf22l8i0";
+  };
+  patches = [ patch ];
+  preConfigure = ''
+    cat debian/patches/1001_shlib-cmake.patch | patch -p1
+  '';
+  buildInputs = [ cmake ];
+  
+  meta = {
+    description = "A real-time library for sampling rate conversion library";
+    license = stdenv.lib.licenses.lgpl2Plus;
+    homepage = https://ccrma.stanford.edu/~jos/resample/Free_Resampling_Software.html;
+    maintainers = [ stdenv.lib.maintainers.sander ];
+    platforms = stdenv.lib.platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libressl/default.nix b/nixpkgs/pkgs/development/libraries/libressl/default.nix
new file mode 100644
index 000000000000..fb4b1ac54a9f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libressl/default.nix
@@ -0,0 +1,59 @@
+{ stdenv, fetchurl, lib, cmake }:
+
+let
+
+  generic = { version, sha256 }: stdenv.mkDerivation rec {
+    name = "libressl-${version}";
+    inherit version;
+
+    src = fetchurl {
+      url = "mirror://openbsd/LibreSSL/${name}.tar.gz";
+      inherit sha256;
+    };
+
+    nativeBuildInputs = [ cmake ];
+
+    cmakeFlags = [ "-DENABLE_NC=ON" "-DBUILD_SHARED_LIBS=ON" ];
+
+    # The autoconf build is broken as of 2.9.1, resulting in the following error:
+    # libressl-2.9.1/tls/.libs/libtls.a', needed by 'handshake_table'.
+    # Fortunately LibreSSL provides a CMake build as well, so opt for CMake by
+    # removing ./configure pre-config.
+    preConfigure = ''
+      rm configure
+    '';
+
+    enableParallelBuilding = true;
+
+    outputs = [ "bin" "dev" "out" "man" "nc" ];
+
+    postFixup = ''
+      moveToOutput "bin/nc" "$nc"
+      moveToOutput "bin/openssl" "$bin"
+      moveToOutput "bin/ocspcheck" "$bin"
+      moveToOutput "share/man/man1/nc.1${lib.optionalString (dontGzipMan==null) ".gz"}" "$nc"
+    '';
+
+    dontGzipMan = if stdenv.isDarwin then true else null; # not sure what's wrong
+
+    meta = with lib; {
+      description = "Free TLS/SSL implementation";
+      homepage    = "https://www.libressl.org";
+      license = with licenses; [ publicDomain bsdOriginal bsd0 bsd3 gpl3 isc ];
+      platforms   = platforms.all;
+      maintainers = with maintainers; [ thoughtpolice fpletz globin ];
+    };
+  };
+
+in {
+
+  libressl_2_8 = generic {
+    version = "2.8.3";
+    sha256 = "0xw4z4z6m7lyf1r4m2w2w1k7as791c04ygnfk4d7d0ki0h9hnr4v";
+  };
+
+  libressl_2_9 = generic {
+    version = "2.9.2";
+    sha256 = "1m6mz515dcbrbnyz8hrpdfjzdmj1c15vbgnqxdxb89g3z9kq3iy4";
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/librest/default.nix b/nixpkgs/pkgs/development/libraries/librest/default.nix
new file mode 100644
index 000000000000..e70ac9a53626
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/librest/default.nix
@@ -0,0 +1,31 @@
+{ stdenv, fetchurl, pkgconfig, 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";
+    sha256 = "0513aad38e5d3cedd4ae3c551634e3be1b9baaa79775e53b2dba9456f15b01c9";
+  };
+
+  nativeBuildInputs = [ pkgconfig gobject-introspection ];
+  buildInputs = [ glib libsoup ];
+
+  configureFlags = [ "--with-ca-certificates=/etc/ssl/certs/ca-certificates.crt" ];
+
+  passthru = {
+    updateScript = gnome3.updateScript {
+      packageName = pname;
+      attrPath = "librest";
+    };
+  };
+
+  meta = with stdenv.lib; {
+    description = "Helper library for RESTful services";
+    homepage = https://wiki.gnome.org/Projects/Librest;
+    license = licenses.lgpl21;
+    platforms = platforms.linux;
+    maintainers = gnome3.maintainers;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/librevenge/default.nix b/nixpkgs/pkgs/development/libraries/librevenge/default.nix
new file mode 100644
index 000000000000..2c6e792ae8ce
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/librevenge/default.nix
@@ -0,0 +1,42 @@
+{stdenv, fetchurl, boost, pkgconfig, cppunit, zlib}:
+let
+  s = # Generated upstream information
+  rec {
+    baseName="librevenge";
+    version="0.0.4";
+    name="${baseName}-${version}";
+    hash="1cj76cz4mqcy2mgv9l5xlc95bypyk8zbq0ls9cswqrs2y0lhfgwk";
+    url="mirror://sourceforge/project/libwpd/librevenge/librevenge-0.0.4/librevenge-0.0.4.tar.xz";
+    sha256="1cj76cz4mqcy2mgv9l5xlc95bypyk8zbq0ls9cswqrs2y0lhfgwk";
+  };
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [
+    boost cppunit zlib
+  ];
+in
+stdenv.mkDerivation {
+  inherit (s) name version;
+  inherit nativeBuildInputs buildInputs;
+  src = fetchurl {
+    inherit (s) url sha256;
+  };
+
+  # Clang and gcc-7 generate warnings, and
+  # -Werror causes these warnings to be interpreted as errors
+  # Simplest solution: disable -Werror
+  configureFlags = [ "--disable-werror" ];
+
+  # Fix an issue with boost 1.59
+  # This is fixed upstream so please remove this when updating
+  postPatch = ''
+    sed -i 's,-DLIBREVENGE_BUILD,\0 -DBOOST_ERROR_CODE_HEADER_ONLY,g' src/lib/Makefile.in
+  '';
+
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/librevenge/default.upstream b/nixpkgs/pkgs/development/libraries/librevenge/default.upstream
new file mode 100644
index 000000000000..78e47f83433f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/librevenge/default.upstream
@@ -0,0 +1,4 @@
+url https://sourceforge.net/projects/libwpd/files/librevenge/
+SF_version_dir librevenge-
+version_link '[.]tar.xz/download$'
+SF_redirect
diff --git a/nixpkgs/pkgs/development/libraries/librevisa/default.nix b/nixpkgs/pkgs/development/libraries/librevisa/default.nix
new file mode 100644
index 000000000000..d412e1e8ebb6
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/librevisa/default.nix
@@ -0,0 +1,30 @@
+{ stdenv, fetchurl, pkgconfig, libusb1 }:
+
+# TODO: add VXI development files, for VXI-11 (TCPIP) support
+
+stdenv.mkDerivation rec {
+  name = "librevisa-0.0.20130412";
+
+  src = fetchurl {
+    url = "http://www.librevisa.org/download/${name}.tar.gz";
+    sha256 = "0bjzq23s3xzw0l9qx4l8achrx5id8xdd6r52lvdl4a28dxzbcfhq";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ libusb1 ];
+
+  meta = with stdenv.lib; {
+    description = "Implementation of the VISA standard (for instrument control)";
+    longDescription = ''
+      LibreVISA aims to be a compliant implementation of the VISA standard in a
+      free software library.
+
+      We currently support targets connected via USB, exposing the USBTMC
+      interface, and VXI-11 devices.
+    '';
+    homepage = http://www.librevisa.org/;
+    license = licenses.gpl3Plus;
+    platforms = platforms.linux ++ platforms.darwin;
+    maintainers = [ maintainers.bjornfor ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/librime/default.nix b/nixpkgs/pkgs/development/libraries/librime/default.nix
new file mode 100644
index 000000000000..71362fd7ef7b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/librime/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchFromGitHub, cmake, boost, glog, leveldb, marisa, opencc,
+  libyamlcpp, gmock }:
+
+stdenv.mkDerivation rec {
+  pname = "librime";
+  version = "1.5.0";
+
+  src = fetchFromGitHub {
+    owner = "rime";
+    repo = "librime";
+    rev = "${version}";
+    sha256 = "10wvh1l4317yzcys4rzlkw42i6cj5p8g62r1xzyjw32ky2d0ndxl";
+  };
+
+  nativeBuildInputs = [ cmake ];
+
+  buildInputs = [ boost glog leveldb marisa opencc libyamlcpp gmock ];
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    homepage    = https://rime.im/;
+    description = "Rime Input Method Engine, the core library";
+    license     = licenses.bsd3;
+    maintainers = with maintainers; [ sifmelcara ];
+    platforms   = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libroxml/default.nix b/nixpkgs/pkgs/development/libraries/libroxml/default.nix
new file mode 100644
index 000000000000..3993451e19f0
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libroxml/default.nix
@@ -0,0 +1,16 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation {
+  name = "libroxml-2.3.0";
+  src = fetchurl {
+    url = "http://download.libroxml.net/pool/v2.x/libroxml-2.3.0.tar.gz";
+    sha256  = "0y0vc9n4rfbimjp28nx4kdfzz08j5xymh5xjy84l9fhfac5z5a0x";
+  };
+  meta = with stdenv.lib; {
+    homepage = "http://www.libroxml.net/";
+    description = "This library is minimum, easy-to-use, C implementation for xml file parsing.";
+    license = licenses.lgpl3;
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ mpickering ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/librsvg/default.nix b/nixpkgs/pkgs/development/libraries/librsvg/default.nix
new file mode 100644
index 000000000000..0cbd60409b43
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/librsvg/default.nix
@@ -0,0 +1,86 @@
+{ lib, stdenv, fetchurl, pkgconfig, glib, gdk_pixbuf, pango, cairo, libxml2, libgsf
+, bzip2, libcroco, libintl, darwin, rustc, cargo, gnome3
+, withGTK ? false, gtk3 ? null
+, vala, gobject-introspection }:
+
+let
+  pname = "librsvg";
+  version = "2.44.14";
+in
+stdenv.mkDerivation rec {
+  name = "${pname}-${version}";
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${name}.tar.xz";
+    sha256 = "00z3qimpk909pcqq0jlsis5sskc6kn7cqia20smd9k9rhs3ag1ba";
+  };
+
+  outputs = [ "out" "dev" "installedTests" ];
+
+  buildInputs = [ libxml2 libgsf bzip2 libcroco pango libintl ];
+
+  propagatedBuildInputs = [ glib gdk_pixbuf cairo ] ++ lib.optional withGTK gtk3;
+
+  nativeBuildInputs = [ pkgconfig rustc cargo vala gobject-introspection ]
+    ++ lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [
+      ApplicationServices
+    ]);
+
+  configureFlags = [
+    "--enable-introspection"
+    "--enable-vala"
+    "--enable-installed-tests"
+    "--enable-always-build-tests"
+  ] ++ stdenv.lib.optional stdenv.isDarwin "--disable-Bsymbolic";
+
+  makeFlags = [
+    "installed_test_metadir=$(installedTests)/share/installed-tests/RSVG"
+    "installed_testdir=$(installedTests)/libexec/installed-tests/RSVG"
+  ];
+
+  NIX_CFLAGS_COMPILE
+    = stdenv.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
+  # relevant loader.cache here.
+  # The loaders.cache can be used by setting GDK_PIXBUF_MODULE_FILE to
+  # point to this file in a wrapper.
+  postConfigure = ''
+    GDK_PIXBUF=$out/lib/gdk-pixbuf-2.0/2.10.0
+    mkdir -p $GDK_PIXBUF/loaders
+    sed -e "s#gdk_pixbuf_moduledir = .*#gdk_pixbuf_moduledir = $GDK_PIXBUF/loaders#" \
+        -i gdk-pixbuf-loader/Makefile
+    sed -e "s#gdk_pixbuf_cache_file = .*#gdk_pixbuf_cache_file = $GDK_PIXBUF/loaders.cache#" \
+        -i gdk-pixbuf-loader/Makefile
+    sed -e "s#\$(GDK_PIXBUF_QUERYLOADERS)#GDK_PIXBUF_MODULEDIR=$GDK_PIXBUF/loaders \$(GDK_PIXBUF_QUERYLOADERS)#" \
+         -i gdk-pixbuf-loader/Makefile
+
+    # Fix thumbnailer path
+    sed -e "s#@bindir@\(/gdk-pixbuf-thumbnailer\)#${gdk_pixbuf}/bin\1#g" \
+        -i gdk-pixbuf-loader/librsvg.thumbnailer.in
+  '';
+
+  doCheck = false; # fails 20 of 145 tests, very likely to be buggy
+
+  # Merge gdkpixbuf and librsvg loaders
+  postInstall = ''
+    mv $GDK_PIXBUF/loaders.cache $GDK_PIXBUF/loaders.cache.tmp
+    cat ${gdk_pixbuf.out}/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache $GDK_PIXBUF/loaders.cache.tmp > $GDK_PIXBUF/loaders.cache
+    rm $GDK_PIXBUF/loaders.cache.tmp
+  '';
+
+  passthru = {
+    updateScript = gnome3.updateScript {
+      packageName = pname;
+    };
+  };
+
+  meta = with stdenv.lib; {
+    description = "A small library to render SVG images to Cairo surfaces";
+    homepage = https://wiki.gnome.org/Projects/LibRsvg;
+    license = licenses.lgpl2Plus;
+    maintainers = gnome3.maintainers;
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/librsync/0.9.nix b/nixpkgs/pkgs/development/libraries/librsync/0.9.nix
new file mode 100644
index 000000000000..3ca84ed2ce5f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/librsync/0.9.nix
@@ -0,0 +1,26 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation {
+  name = "librsync-0.9.7";
+
+  src = fetchurl {
+    url = mirror://sourceforge/librsync/librsync-0.9.7.tar.gz;
+    sha256 = "1mj1pj99mgf1a59q9f2mxjli2fzxpnf55233pc1klxk2arhf8cv6";
+  };
+
+  hardeningDisable = [ "format" ];
+
+  configureFlags = [
+    (stdenv.lib.enableFeature stdenv.isCygwin    "static")
+    (stdenv.lib.enableFeature (!stdenv.isCygwin) "shared")
+  ];
+
+  dontStrip = stdenv.hostPlatform != stdenv.buildPlatform;
+
+  meta = {
+    homepage = http://librsync.sourceforge.net/;
+    license = stdenv.lib.licenses.lgpl2Plus;
+    description = "Implementation of the rsync remote-delta algorithm";
+    platforms = stdenv.lib.platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/librsync/default.nix b/nixpkgs/pkgs/development/libraries/librsync/default.nix
new file mode 100644
index 000000000000..e4e96df86c16
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/librsync/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchFromGitHub, cmake, perl, zlib, bzip2, popt }:
+
+stdenv.mkDerivation rec {
+  name = "librsync-${version}";
+  version = "2.0.2";
+
+  src = fetchFromGitHub {
+    owner = "librsync";
+    repo = "librsync";
+    rev = "v${version}";
+    sha256 = "1qnr4rk93mhggqjh2025clmlhhgnjhq983p1vbh8i1g8aiqdnapi";
+  };
+
+  nativeBuildInputs = [ cmake ];
+  buildInputs = [ perl zlib bzip2 popt ];
+
+  dontStrip = stdenv.hostPlatform != stdenv.buildPlatform;
+
+  meta = with stdenv.lib; {
+    homepage = http://librsync.sourceforge.net/;
+    license = licenses.lgpl2Plus;
+    description = "Implementation of the rsync remote-delta algorithm";
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libs3/default.nix b/nixpkgs/pkgs/development/libraries/libs3/default.nix
new file mode 100644
index 000000000000..dfec4bc48974
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libs3/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchFromGitHub, curl, libxml2 }:
+
+stdenv.mkDerivation {
+  name = "libs3-2018-12-03";
+
+  src = fetchFromGitHub {
+    owner = "bji";
+    repo = "libs3";
+    rev = "111dc30029f64bbf82031f3e160f253a0a63c119";
+    sha256 = "1ahf08hc7ql3fazfmlyj9vrhq7cvarsmgn2v8149y63zr1fl61hs";
+  };
+
+  buildInputs = [ curl libxml2 ];
+
+  makeFlags = [ "DESTDIR=$(out)" ];
+
+  meta = with stdenv.lib; {
+    homepage = https://github.com/bji/libs3;
+    description = "A library for interfacing with amazon s3";
+    license = licenses.lgpl3Plus;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libsamplerate/default.nix b/nixpkgs/pkgs/development/libraries/libsamplerate/default.nix
new file mode 100644
index 000000000000..b23bff415a25
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libsamplerate/default.nix
@@ -0,0 +1,37 @@
+{ stdenv, fetchurl, pkgconfig, libsndfile, ApplicationServices, Carbon, CoreServices }:
+
+let
+  inherit (stdenv.lib) optionals optionalString;
+
+in stdenv.mkDerivation rec {
+  name = "libsamplerate-0.1.9";
+
+  src = fetchurl {
+    url = "http://www.mega-nerd.com/SRC/${name}.tar.gz";
+    sha256 = "1ha46i0nbibq0pl0pjwcqiyny4hj8lp1bnl4dpxm64zjw9lb2zha";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ libsndfile ]
+    ++ optionals stdenv.isDarwin [ ApplicationServices CoreServices ];
+
+  configureFlags = [ "--disable-fftw" ];
+
+  outputs = [ "bin" "dev" "out" ];
+
+  postConfigure = optionalString stdenv.isDarwin ''
+    # need headers from the Carbon.framework in /System/Library/Frameworks to
+    # compile this on darwin -- not sure how to handle
+    NIX_CFLAGS_COMPILE+=" -I${Carbon}/Library/Frameworks/Carbon.framework/Headers"
+
+    substituteInPlace examples/Makefile --replace "-fpascal-strings" ""
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Sample Rate Converter for audio";
+    homepage    = http://www.mega-nerd.com/SRC/index.html;
+    license     = licenses.bsd2;
+    maintainers = with maintainers; [ lovek323 ];
+    platforms   = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libsass/default.nix b/nixpkgs/pkgs/development/libraries/libsass/default.nix
new file mode 100644
index 000000000000..957201b83abc
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libsass/default.nix
@@ -0,0 +1,32 @@
+{ stdenv, fetchFromGitHub, autoreconfHook }:
+
+stdenv.mkDerivation rec {
+  pname = "libsass";
+  version = "3.6.0";
+
+  src = fetchFromGitHub {
+    owner = "sass";
+    repo = pname;
+    rev = version;
+    sha256 = "0c2cfmxv1h4f258l9ph6jrnk1ip5bngapzbw1x3vsqxw7hy20n4a";
+    # Remove unicode file names which leads to different checksums on HFS+
+    # vs. other filesystems because of unicode normalisation.
+    extraPostFetch = ''
+      rm -r $out/test/e2e/unicode-pwd
+    '';
+  };
+
+  preConfigure = ''
+    export LIBSASS_VERSION=${version}
+  '';
+
+  nativeBuildInputs = [ autoreconfHook ];
+
+  meta = with stdenv.lib; {
+    description = "A C/C++ implementation of a Sass compiler";
+    homepage = https://github.com/sass/libsass;
+    license = licenses.mit;
+    maintainers = with maintainers; [ codyopel offline ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libscrypt/default.nix b/nixpkgs/pkgs/development/libraries/libscrypt/default.nix
new file mode 100644
index 000000000000..479da52f8d9b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libscrypt/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchFromGitHub }:
+
+stdenv.mkDerivation rec {
+  name = "libscrypt-${version}";
+  version = "1.21";
+
+  src = fetchFromGitHub {
+    owner = "technion";
+    repo = "libscrypt";
+    rev = "v${version}";
+    sha256 = "1d76ys6cp7fi4ng1w3mz2l0p9dbr7ljbk33dcywyimzjz8bahdng";
+  };
+
+  buildFlags = stdenv.lib.optional stdenv.isDarwin "LDFLAGS= CFLAGS_EXTRA=";
+
+  installFlags = [ "PREFIX=$(out)" ];
+  installTargets = if stdenv.isDarwin then "install-osx" else "install";
+
+  doCheck = true;
+
+  meta = with stdenv.lib; {
+    description = "Shared library that implements scrypt() functionality";
+    homepage = https://lolware.net/2014/04/29/libscrypt.html;
+    license = licenses.bsd2;
+    maintainers = with maintainers; [ davidak ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libsearpc/default.nix b/nixpkgs/pkgs/development/libraries/libsearpc/default.nix
new file mode 100644
index 000000000000..785dac4aef29
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libsearpc/default.nix
@@ -0,0 +1,31 @@
+{stdenv, fetchFromGitHub, automake, autoconf, pkgconfig, libtool, python2Packages, glib, jansson}:
+
+stdenv.mkDerivation rec {
+  version = "3.1.0";
+  name = "libsearpc-${version}";
+
+  src = fetchFromGitHub {
+    owner = "haiwen";
+    repo = "libsearpc";
+    rev = "v${version}";
+    sha256 = "1zf8xxsl95wdx0372kl8s153hd8q3lhwwvwr2k96ia8scbn2ylkp";
+  };
+
+  patches = [ ./libsearpc.pc.patch ];
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ automake autoconf libtool python2Packages.python python2Packages.simplejson ];
+  propagatedBuildInputs = [ glib jansson ];
+
+  postPatch = "patchShebangs autogen.sh";
+
+  preConfigure = "./autogen.sh";
+
+  meta = with stdenv.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;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libsearpc/libsearpc.pc.patch b/nixpkgs/pkgs/development/libraries/libsearpc/libsearpc.pc.patch
new file mode 100644
index 000000000000..6f30932ba6db
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libsearpc/libsearpc.pc.patch
@@ -0,0 +1,10 @@
+From: Aaron Lindsay <aaron@aclindsay.com>
+
+--- a/libsearpc.pc.in	2013-01-10 01:35:24.000000000 -0500
++++ b/libsearpc.pc.in	2013-01-19 11:31:50.479301798 -0500
+@@ -1,4 +1,4 @@
+-prefix=(DESTDIR)@prefix@
++prefix=@prefix@
+ exec_prefix=@exec_prefix@
+ libdir=@libdir@
+ includedir=@includedir@
diff --git a/nixpkgs/pkgs/development/libraries/libseccomp/default.nix b/nixpkgs/pkgs/development/libraries/libseccomp/default.nix
new file mode 100644
index 000000000000..6b38bcf2c778
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libseccomp/default.nix
@@ -0,0 +1,38 @@
+{ stdenv, fetchurl, getopt, makeWrapper, utillinux }:
+
+stdenv.mkDerivation rec {
+  name = "libseccomp-${version}";
+  version = "2.4.1";
+
+  src = fetchurl {
+    url = "https://github.com/seccomp/libseccomp/releases/download/v${version}/libseccomp-${version}.tar.gz";
+    sha256 = "1s06h2cgk0xxwmhwj72z33bllafc1xqnxzk2yyra2rmg959778qw";
+  };
+
+  outputs = [ "out" "lib" "dev" "man" ];
+
+  buildInputs = [ getopt makeWrapper ];
+
+  patchPhase = ''
+    patchShebangs .
+  '';
+
+  checkInputs = [ utillinux ];
+  doCheck = false; # dependency cycle
+
+  # Hack to ensure that patchelf --shrink-rpath get rids of a $TMPDIR reference.
+  preFixup = "rm -rfv src";
+
+  meta = with stdenv.lib; {
+    description = "High level library for the Linux Kernel seccomp filter";
+    homepage    = "https://github.com/seccomp/libseccomp";
+    license     = licenses.lgpl21;
+    platforms   = platforms.linux;
+    badPlatforms = [
+      "alpha-linux"
+      "riscv64-linux" "riscv32-linux"
+      "sparc-linux" "sparc64-linux"
+    ];
+    maintainers = with maintainers; [ thoughtpolice ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libsecret/default.nix b/nixpkgs/pkgs/development/libraries/libsecret/default.nix
new file mode 100644
index 000000000000..6c2723bbd907
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libsecret/default.nix
@@ -0,0 +1,53 @@
+{ stdenv, fetchurl, glib, pkgconfig, gettext, libxslt, python3, docbook_xsl, docbook_xml_dtd_42
+, libgcrypt, gobject-introspection, vala, gtk-doc, gnome3, libintl, dbus, xvfb_run }:
+
+stdenv.mkDerivation rec {
+  pname = "libsecret";
+  version = "0.18.8";
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    sha256 = "058x64689k55wxfkdp4svhnwvv8jmqm7z5mrynybl38f4sfqiyiv";
+  };
+
+  postPatch = ''
+    patchShebangs .
+  '';
+
+  outputs = [ "out" "dev" "devdoc" ];
+
+  propagatedBuildInputs = [ glib ];
+  nativeBuildInputs = [ pkgconfig gettext libxslt docbook_xsl docbook_xml_dtd_42 libintl gobject-introspection vala gtk-doc ];
+  buildInputs = [ libgcrypt ];
+  # optional: build docs with gtk-doc? (probably needs a flag as well)
+
+  configureFlags = [
+    "--with-libgcrypt-prefix=${libgcrypt.dev}"
+  ];
+
+  enableParallelBuilding = true;
+
+  installCheckInputs = [ python3 python3.pkgs.dbus-python python3.pkgs.pygobject3 xvfb_run dbus gnome3.gjs ];
+
+  # needs to run after install because typelibs point to absolute paths
+  doInstallCheck = false; # Failed to load shared library '/force/shared/libmock_service.so.0' referenced by the typelib
+  installCheckPhase = ''
+    export NO_AT_BRIDGE=1
+    xvfb-run -s '-screen 0 800x600x24' dbus-run-session \
+      --config-file=${dbus.daemon}/share/dbus-1/session.conf \
+      make check
+  '';
+
+  passthru = {
+    updateScript = gnome3.updateScript {
+      packageName = pname;
+    };
+  };
+
+  meta = {
+    description = "A library for storing and retrieving passwords and other secrets";
+    homepage = https://wiki.gnome.org/Projects/Libsecret;
+    license = stdenv.lib.licenses.lgpl21Plus;
+    inherit (glib.meta) platforms maintainers;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libserialport/default.nix b/nixpkgs/pkgs/development/libraries/libserialport/default.nix
new file mode 100644
index 000000000000..2c34c1d8b7bf
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libserialport/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, fetchurl, pkgconfig, udev, darwin }:
+
+stdenv.mkDerivation rec {
+  name = "libserialport-0.1.1";
+
+  src = fetchurl {
+    url = "https://sigrok.org/download/source/libserialport/${name}.tar.gz";
+    sha256 = "17ajlwgvyyrap8z7f16zcs59pksvncwbmd3mzf98wj7zqgczjaja";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = stdenv.lib.optional stdenv.isLinux udev
+    ++ stdenv.lib.optional stdenv.isDarwin darwin.apple_sdk.frameworks.IOKit;
+
+  meta = with stdenv.lib; {
+    description = "Cross-platform shared library for serial port access";
+    homepage = https://sigrok.org/;
+    license = licenses.gpl3Plus;
+    platforms = platforms.linux ++ platforms.darwin;
+    maintainers = [ maintainers.bjornfor ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libsexy/default.nix b/nixpkgs/pkgs/development/libraries/libsexy/default.nix
new file mode 100644
index 000000000000..49cdb2c95ba0
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libsexy/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchurl, pkgconfig
+, glib, gtk2, libxml2, pango
+}:
+ 
+stdenv.mkDerivation {
+  name = "libsexy-0.1.11";
+
+  src = fetchurl {
+    url = http://releases.chipx86.com/libsexy/libsexy/libsexy-0.1.11.tar.gz;
+    sha256 = "8c4101a8cda5fccbba85ba1a15f46f2cf75deaa8b3c525ce5b135b9e1a8fe49e";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+
+  buildInputs = [ glib gtk2 libxml2 pango ];
+
+  meta = with stdenv.lib; {
+    description = "A collection of GTK+ widgets";
+    homepage = https://blog.chipx86.com/tag/libsexy/;
+    license = licenses.lgpl21;
+    maintainers = with maintainers; [ ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libshout/default.nix b/nixpkgs/pkgs/development/libraries/libshout/default.nix
new file mode 100644
index 000000000000..3753a070c639
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libshout/default.nix
@@ -0,0 +1,33 @@
+{ stdenv, fetchurl, pkgconfig
+, libvorbis, libtheora, speex }:
+
+# need pkgconfig so that libshout installs ${out}/lib/pkgconfig/shout.pc
+
+stdenv.mkDerivation rec {
+  name = "libshout-2.4.2";
+
+  src = fetchurl {
+    url = "http://downloads.xiph.org/releases/libshout/${name}.tar.gz";
+    sha256 = "0qgwarqp2p6jy3zadds6dzj8z1jfb2mbwc3lsdlidf527h0a86ym";
+  };
+
+  outputs = [ "out" "dev" "doc" ];
+
+  nativeBuildInputs = [ pkgconfig ];
+  propagatedBuildInputs = [ libvorbis libtheora speex ];
+
+  meta = {
+    description = "icecast 'c' language bindings";
+
+    longDescription = ''
+      Libshout is a library for communicating with and sending data to an icecast
+      server.  It handles the socket connection, the timing of the data, and prevents
+      bad data from getting to the icecast server.
+    '';
+
+    homepage = http://www.icecast.org;
+    license = stdenv.lib.licenses.gpl2;
+    maintainers = with stdenv.lib.maintainers; [ jcumming ];
+    platforms = with stdenv.lib.platforms; unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libsidplayfp/default.nix b/nixpkgs/pkgs/development/libraries/libsidplayfp/default.nix
new file mode 100644
index 000000000000..82caacf93e6a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libsidplayfp/default.nix
@@ -0,0 +1,39 @@
+{ stdenv, fetchurl, pkgconfig
+, docSupport ? true, doxygen ? null, graphviz ? null }:
+
+assert docSupport -> doxygen != null && graphviz != null;
+
+stdenv.mkDerivation rec {
+  pname = "libsidplayfp";
+  major = "1";
+  minor = "8";
+  level = "7";
+  version = "${major}.${minor}.${level}";
+  name = "${pname}-${version}";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/sidplay-residfp/${pname}/${major}.${minor}/${name}.tar.gz";
+    sha256 = "14k1sbdcbhykwfcadq5lbpnm9xp2r7vs7fyi84h72g89y8pjg0da";
+  };
+
+  nativeBuildInputs = [ pkgconfig ]
+    ++ stdenv.lib.optionals docSupport [ doxygen graphviz ];
+
+  installTargets = [ "install" ]
+    ++ stdenv.lib.optionals docSupport [ "doc" ];
+
+  outputs = [ "out" ] ++ stdenv.lib.optionals docSupport [ "doc" ];
+
+  postInstall = stdenv.lib.optionalString docSupport ''
+    mkdir -p $doc/share/doc/libsidplayfp
+    mv docs/html $doc/share/doc/libsidplayfp/
+  '';
+
+  meta = with stdenv.lib; {
+    description = "A library to play Commodore 64 music derived from libsidplay2";
+    homepage = https://sourceforge.net/projects/sidplay-residfp/;
+    license = with licenses; [ gpl2Plus ];
+    maintainers = with maintainers; [ ramkromberg ];
+    platforms = with platforms; unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libsieve/default.nix b/nixpkgs/pkgs/development/libraries/libsieve/default.nix
new file mode 100644
index 000000000000..2da5d68d1174
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libsieve/default.nix
@@ -0,0 +1,17 @@
+{stdenv, fetchurl}:
+stdenv.mkDerivation rec {
+  version = "2.3.1";
+  name = "libsieve-${version}";
+
+  src = fetchurl {
+    url = "https://github.com/downloads/sodabrew/libsieve/libsieve-${version}.tar.gz";
+    sha256 = "1gllhl9hbmc86dq3k98d4kjs5bwk0p2rlk7ywqj3fjn7jw6mbhcj";
+  };
+
+  meta = with stdenv.lib; {
+    description = "An interpreter for RFC 3028 Sieve and various extensions";
+    homepage = http://sodabrew.com/libsieve/;
+    license = licenses.lgpl21;
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libsigcxx/1.2.nix b/nixpkgs/pkgs/development/libraries/libsigcxx/1.2.nix
new file mode 100644
index 000000000000..fa27a80e22ed
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libsigcxx/1.2.nix
@@ -0,0 +1,21 @@
+{stdenv, fetchurl, pkgconfig, m4}:
+
+stdenv.mkDerivation rec {
+  name = "libsigc++-1.2.7";
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/libsigc++/1.2/${name}.tar.bz2";
+    sha256 = "099224v5y0y1ggqrfc8vga8afr3nb93iicn7cj8xxgsrwa83s5nr";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ m4];
+
+  meta = with stdenv.lib; {
+    homepage = https://libsigcplusplus.github.io/libsigcplusplus/;
+    description = "A typesafe callback system for standard C++";
+    branch = "1.2";
+    platforms = platforms.unix;
+    license = licenses.lgpl3;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libsigcxx/default.nix b/nixpkgs/pkgs/development/libraries/libsigcxx/default.nix
new file mode 100644
index 000000000000..434dbfb9f725
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libsigcxx/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchurl, pkgconfig, 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";
+    sha256 = "00v08km4wwzbh6vjxb21388wb9dm6g2xh14rgwabnv4c2wk5z8n9";
+  };
+
+  nativeBuildInputs = [ pkgconfig gnum4 ];
+
+  doCheck = true;
+
+  passthru = {
+    updateScript = gnome3.updateScript {
+      packageName = pname;
+      attrPath = "libsigcxx";
+    };
+  };
+
+  meta = with stdenv.lib; {
+    homepage = https://libsigcplusplus.github.io/libsigcplusplus/;
+    description = "A typesafe callback system for standard C++";
+    license = licenses.lgpl21;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libsignal-protocol-c/default.nix b/nixpkgs/pkgs/development/libraries/libsignal-protocol-c/default.nix
new file mode 100644
index 000000000000..f3549d52f69e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libsignal-protocol-c/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchFromGitHub, cmake, openssl }:
+
+stdenv.mkDerivation rec {
+  pname = "libsignal-protocol-c";
+  version = "2.3.2";
+
+  src = fetchFromGitHub {
+    owner = "signalapp";
+    repo = "libsignal-protocol-c";
+    rev = "v${version}";
+    sha256 = "1qj2w4csy6j9jg1jy66n1qwysx7hgjywk4n35hlqcnh1kpa14k3p";
+  };
+
+  nativeBuildInputs = [ cmake ];
+
+  buildInputs = [ openssl ];
+
+  cmakeFlags = [ "-DBUILD_SHARED_LIBS=ON" ];
+
+  outputs = [ "out" "dev" ];
+
+  meta = with stdenv.lib; {
+    description = "Signal Protocol C Library";
+    homepage = https://github.com/signalapp/libsignal-protocol-c;
+    license = licenses.gpl3;
+    platforms = platforms.all;
+    maintainers = with maintainers; [ orivej ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libsignon-glib/default.nix b/nixpkgs/pkgs/development/libraries/libsignon-glib/default.nix
new file mode 100644
index 000000000000..c7f49a6f6dcf
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libsignon-glib/default.nix
@@ -0,0 +1,53 @@
+{ stdenv, fetchgit, pkgconfig, 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";
+  version = "2.1";
+
+  outputs = [ "out" "dev" "devdoc" "py" ];
+
+  src = fetchgit {
+    url = "https://gitlab.com/accounts-sso/${pname}";
+    rev = "refs/tags/${version}";
+    sha256 = "0gnx9gqsh0hcfm1lk7w60g64mkn1iicga5f5xcy1j9a9byacsfd0";
+    fetchSubmodules = true;
+  };
+
+  nativeBuildInputs = [
+    check
+    docbook_xml_dtd_412
+    docbook_xml_dtd_43
+    docbook_xsl
+    gobject-introspection
+    gtk-doc
+    meson
+    ninja
+    pkgconfig
+    python3
+    vala
+  ];
+
+  buildInputs = [
+    glib
+    python3.pkgs.pygobject3
+  ];
+
+  mesonFlags = [
+    "-Dintrospection=true"
+    "-Dpy-overrides-dir=${placeholder "py"}/${python3.sitePackages}/gi/overrides"
+  ];
+
+  postPatch = ''
+    chmod +x build-aux/gen-error-map.py
+    patchShebangs build-aux/gen-error-map.py
+  '';
+
+  meta = with stdenv.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;
+    maintainers = with maintainers; [ worldofpeace ];
+    platforms = platforms.linux;
+  };
+}
+
diff --git a/nixpkgs/pkgs/development/libraries/libsigsegv/default.nix b/nixpkgs/pkgs/development/libraries/libsigsegv/default.nix
new file mode 100644
index 000000000000..b50a7c371a74
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libsigsegv/default.nix
@@ -0,0 +1,36 @@
+{ stdenv, fetchurl
+, enableSigbusFix ? false # required by kernels < 3.18.6
+}:
+
+stdenv.mkDerivation rec {
+  name = "libsigsegv-2.12";
+
+  src = fetchurl {
+    url = "mirror://gnu/libsigsegv/${name}.tar.gz";
+    sha256 = "1dlhqf4igzpqayms25lkhycjq1ccavisx8cnb3y4zapbkqsszq9s";
+  };
+
+  patches = if enableSigbusFix then [ ./sigbus_fix.patch ] else null;
+
+  doCheck = true; # not cross;
+
+  meta = {
+    homepage = https://www.gnu.org/software/libsigsegv/;
+    description = "Library to handle page faults in user mode";
+
+    longDescription = ''
+      GNU libsigsegv is a library for handling page faults in user mode. A
+      page fault occurs when a program tries to access to a region of memory
+      that is currently not available. Catching and handling a page fault is
+      a useful technique for implementing pageable virtual memory,
+      memory-mapped access to persistent databases, generational garbage
+      collectors, stack overflow handlers, distributed shared memory, and
+      more.
+    '';
+
+    license = stdenv.lib.licenses.gpl2Plus;
+
+    maintainers = [ ];
+    platforms = stdenv.lib.platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libsigsegv/sigbus_fix.patch b/nixpkgs/pkgs/development/libraries/libsigsegv/sigbus_fix.patch
new file mode 100644
index 000000000000..6f1c399041dd
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libsigsegv/sigbus_fix.patch
@@ -0,0 +1,8 @@
+--- a/src/signals.h	2017-08-23 14:07:05.000000000 +0100
++++ b/src/signals.h	2017-08-23 14:06:53.000000000 +0100
+@@ -18,4 +18,4 @@
+ /* List of signals that are sent when an invalid virtual memory address
+    is accessed, or when the stack overflows.  */
+ #define SIGSEGV_FOR_ALL_SIGNALS(var,body) \
+-  { int var; var = SIGSEGV; { body } }
++  { int var; var = SIGSEGV; { body } var = SIGBUS; { body } }
diff --git a/nixpkgs/pkgs/development/libraries/libsixel/default.nix b/nixpkgs/pkgs/development/libraries/libsixel/default.nix
new file mode 100644
index 000000000000..34d959423a36
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libsixel/default.nix
@@ -0,0 +1,20 @@
+{stdenv, fetchFromGitHub}:
+stdenv.mkDerivation rec {
+  version = "1.8.2";
+  name = "libsixel-${version}";
+
+  src = fetchFromGitHub {
+    repo = "libsixel";
+    rev = "v${version}";
+    owner = "saitoha";
+    sha256 = "1jn5z2ylccjkp9i12n5x53x2zzhhsgmgs6xxi7aja6qimfw90h1n";
+  };
+
+  meta = with stdenv.lib; {
+    description = "The SIXEL library for console graphics, and converter programs";
+    homepage = http://saitoha.github.com/libsixel;
+    maintainers = with maintainers; [ vrthra ];
+    license = licenses.mit;
+    platforms = with platforms; unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libskk/default.nix b/nixpkgs/pkgs/development/libraries/libskk/default.nix
new file mode 100644
index 000000000000..19ebbd363e1e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libskk/default.nix
@@ -0,0 +1,49 @@
+{ stdenv, fetchFromGitHub,
+  libtool, gettext, pkgconfig,
+  vala, gnome-common, gobject-introspection,
+  libgee, json-glib, skk-dicts, libxkbcommon }:
+
+stdenv.mkDerivation rec {
+  name = "libskk-${version}";
+  version = "1.0.5";
+
+  src = fetchFromGitHub {
+    owner = "ueno";
+    repo = "libskk";
+    rev = version;
+    sha256 = "0y279pcgs3jrsi9vzx086xhz9jbz23dqqijp4agygc9ackp9sxy5";
+  };
+
+  buildInputs = [ skk-dicts libxkbcommon ];
+  nativeBuildInputs = [ vala gnome-common gobject-introspection libtool gettext pkgconfig ];
+  propagatedBuildInputs = [ libgee json-glib ];
+
+  preConfigure = ''
+    ./autogen.sh
+  '';
+
+  # link SKK-JISYO.L from skkdicts for the bundled tool `skk`
+  preInstall = ''
+    dictDir=$out/share/skk
+    mkdir -p $dictDir
+    ln -s ${skk-dicts}/share/SKK-JISYO.L $dictDir/
+  '';
+
+  enableParallelBuilding = true;
+
+  meta = {
+    description = "A library to deal with Japanese kana-to-kanji conversion method";
+    longDescription = ''
+      Libskk is a library that implements basic features of SKK including:
+      new word registration, completion, numeric conversion, abbrev mode, kuten input,
+      hankaku-katakana input, Lisp expression evaluation (concat only), and re-conversion.
+      It also supports various typing rules including: romaji-to-kana, AZIK, TUT-Code, and NICOLA,
+      as well as various dictionary types including: file dictionary (such as SKK-JISYO.[SML]),
+      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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libsmi/default.nix b/nixpkgs/pkgs/development/libraries/libsmi/default.nix
new file mode 100644
index 000000000000..25f2a1e0846b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libsmi/default.nix
@@ -0,0 +1,18 @@
+{ stdenv , fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "libsmi-${version}";
+  version = "0.5.0";
+
+  src = fetchurl {
+    url = "https://www.ibr.cs.tu-bs.de/projects/libsmi/download/${name}.tar.gz";
+    sha256 = "1lslaxr2qcj6hf4naq5n5mparfhmswsgq4wa7zm2icqvvgdcq6pj";
+  };
+
+  meta = with stdenv.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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libsnark/default.nix b/nixpkgs/pkgs/development/libraries/libsnark/default.nix
new file mode 100644
index 000000000000..15d8169f1024
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libsnark/default.nix
@@ -0,0 +1,30 @@
+{ stdenv, fetchFromGitHub, cmake, pkgconfig, openssl, boost, gmp, procps }:
+
+let
+  rev = "9e6b19ff15bc19fba5da1707ba18e7f160e5ed07";
+  inherit (stdenv) lib;
+in stdenv.mkDerivation rec {
+  name = "libsnark-pre${version}";
+  version = stdenv.lib.substring 0 8 rev;
+
+  buildInputs = [ cmake pkgconfig openssl boost gmp ] ++ lib.optional stdenv.hostPlatform.isLinux procps;
+
+  cmakeFlags = lib.optionals stdenv.hostPlatform.isDarwin [ "-DWITH_PROCPS=OFF" "-DWITH_SUPERCOP=OFF" ];
+
+  src = fetchFromGitHub {
+    inherit rev;
+    owner           = "scipr-lab";
+    repo            = "libsnark";
+    sha256          = "13f02qp2fmfhvxlp4xi69m0l8r5nq913l2f0zwdk7hl46lprfdca";
+    fetchSubmodules = true;
+  };
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libsndfile/default.nix b/nixpkgs/pkgs/development/libraries/libsndfile/default.nix
new file mode 100644
index 000000000000..b150dd0f59c3
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libsndfile/default.nix
@@ -0,0 +1,91 @@
+{ stdenv, fetchurl, flac, libogg, libvorbis, pkgconfig
+, Carbon, AudioToolbox
+}:
+
+stdenv.mkDerivation rec {
+  name = "libsndfile-1.0.28";
+
+  src = fetchurl {
+    url = "http://www.mega-nerd.com/libsndfile/files/${name}.tar.gz";
+    sha256 = "1afzm7jx34jhqn32clc5xghyjglccam2728yxlx37yj2y0lkkwqz";
+  };
+
+  patches = [
+    (fetchurl {
+      name = "CVE-2017-12562.patch";
+      url = "https://github.com/erikd/libsndfile/commit/cf7a8182c2642c50f1cf90dddea9ce96a8bad2e8.patch";
+      sha256 = "1jg3wq30wdn9nv52mcyv6jyi4d80h4r1h9p96czcria7l91yh4sy";
+    })
+    (fetchurl {
+      name = "CVE-2017-6892.patch";
+      url = "https://github.com/erikd/libsndfile/commit/f833c53cb596e9e1792949f762e0b33661822748.patch";
+      sha256 = "05xkmz2ihc1zcj73sbmj1ikrv9qlcym2bkp1v6ak7w53ky619mwq";
+    })
+    (fetchurl {
+      name = "CVE-2017-8361+CVE-2017-8363+CVE-2017-8365.patch";
+      url = "https://github.com/erikd/libsndfile/commit/fd0484aba8e51d16af1e3a880f9b8b857b385eb3.patch";
+      sha256 = "0ccndnvjzx5fw18zvy03vnb29rr81h5vsh1m16msqbxk8ibndln2";
+    })
+    (fetchurl {
+      name = "CVE-2017-8362.patch";
+      url = "https://github.com/erikd/libsndfile/commit/ef1dbb2df1c0e741486646de40bd638a9c4cd808.patch";
+      sha256 = "1xyv30ga71cpy4wx5f76sc4dma91la2lcc6s9f3pk9rndyi7gj9x";
+    })
+    (fetchurl {
+      name = "CVE-2017-14634.patch";
+      url = "https://github.com/erikd/libsndfile/commit/85c877d5072866aadbe8ed0c3e0590fbb5e16788.patch";
+      sha256 = "0kc7vp22qsxidhvmlc6nfamw7k92n0hcfpmwhb3gaksjamwhb2df";
+    })
+    (fetchurl {
+      name = "CVE-2018-13139.patch";
+      url = "https://github.com/erikd/libsndfile/commit/aaea680337267bfb6d2544da878890ee7f1c5077.patch";
+      sha256 = "01q3m7pa3xqkh05ijmfgv064v8flkg4p24bgy9wxnc6wfcdifggx";
+    })
+  ];
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ flac libogg libvorbis ]
+    ++ stdenv.lib.optionals stdenv.isDarwin [ Carbon AudioToolbox ];
+
+  enableParallelBuilding = true;
+
+  outputs = [ "bin" "dev" "out" "man" "doc" ];
+
+  # 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
+    ''
+      NIX_CFLAGS_COMPILE+=" -I$SDKROOT/System/Library/Frameworks/Carbon.framework/Versions/A/Headers"
+    '';
+
+  # Needed on Darwin.
+  NIX_CFLAGS_LINK = "-logg -lvorbis";
+
+  meta = with stdenv.lib; {
+    description = "A C library for reading and writing files containing sampled sound";
+    homepage    = http://www.mega-nerd.com/libsndfile/;
+    license     = licenses.lgpl2Plus;
+    maintainers = with maintainers; [ lovek323 ];
+    platforms   = platforms.unix;
+
+    longDescription = ''
+      Libsndfile is a C library for reading and writing files containing
+      sampled sound (such as MS Windows WAV and the Apple/SGI AIFF format)
+      through one standard library interface.  It is released in source
+      code format under the GNU Lesser General Public License.
+
+      The library was written to compile and run on a Linux system but
+      should compile and run on just about any Unix (including macOS).
+      There are also pre-compiled binaries available for 32 and 64 bit
+      windows.
+
+      It was designed to handle both little-endian (such as WAV) and
+      big-endian (such as AIFF) data, and to compile and run correctly on
+      little-endian (such as Intel and DEC/Compaq Alpha) processor systems
+      as well as big-endian processor systems such as Motorola 68k, Power
+      PC, MIPS and SPARC.  Hopefully the design of the library will also
+      make it easy to extend for reading and writing new sound file
+      formats.
+    '';
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libsodium/default.nix b/nixpkgs/pkgs/development/libraries/libsodium/default.nix
new file mode 100644
index 000000000000..8c88abd2c441
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libsodium/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "libsodium-1.0.18";
+
+  src = fetchurl {
+    url = "https://download.libsodium.org/libsodium/releases/${name}.tar.gz";
+    sha256 = "1h9ncvj23qbbni958knzsli8dvybcswcjbx0qjjgi922nf848l3g";
+  };
+
+  outputs = [ "out" "dev" ];
+  separateDebugInfo = stdenv.isLinux;
+
+  enableParallelBuilding = true;
+
+  doCheck = true;
+
+  meta = with stdenv.lib; {
+    description = "A modern and easy-to-use crypto library";
+    homepage = http://doc.libsodium.org/;
+    license = licenses.isc;
+    maintainers = with maintainers; [ raskin ];
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libsolv/default.nix b/nixpkgs/pkgs/development/libraries/libsolv/default.nix
new file mode 100644
index 000000000000..4c1e0d830d10
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libsolv/default.nix
@@ -0,0 +1,32 @@
+{ stdenv, fetchFromGitHub, cmake, ninja, zlib, expat, rpm, db }:
+
+stdenv.mkDerivation rec {
+  version  = "0.7.4";
+  name = "libsolv-${version}";
+
+  src = fetchFromGitHub {
+    owner  = "openSUSE";
+    repo   = "libsolv";
+    rev    = version;
+    sha256 = "0d7xwykb3mxg8bhmlswnj5f0iyl1qsjyidxswzhcbk21fcgm5d4y";
+  };
+
+  cmakeFlags = [
+    "-DENABLE_COMPLEX_DEPS=true"
+    "-DENABLE_RPMMD=true"
+    "-DENABLE_RPMDB=true"
+    "-DENABLE_PUBKEY=true"
+    "-DENABLE_RPMDB_BYRPMHEADER=true"
+  ];
+
+  nativeBuildInputs = [ cmake ninja ];
+  buildInputs = [ zlib expat rpm db ];
+
+  meta = with stdenv.lib; {
+    description = "A free package dependency solver";
+    license     = licenses.bsd3;
+    platforms   = platforms.linux;
+    maintainers = with maintainers; [ copumpkin ];
+  };
+}
+
diff --git a/nixpkgs/pkgs/development/libraries/libsoundio/default.nix b/nixpkgs/pkgs/development/libraries/libsoundio/default.nix
new file mode 100644
index 000000000000..f53db7241cf7
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libsoundio/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchFromGitHub, cmake, alsaLib, libjack2, libpulseaudio, AudioUnit }:
+
+stdenv.mkDerivation rec {
+  version = "2.0.0";
+  name = "libsoundio-${version}";
+
+  src = fetchFromGitHub {
+    owner = "andrewrk";
+    repo = "libsoundio";
+    rev = "${version}";
+    sha256 = "12l4rvaypv87vigdrmjz48d4d6sq4gfxf5asvnc4adyabxb73i4x";
+  };
+
+  nativeBuildInputs = [ cmake ];
+
+  buildInputs = [ libjack2 libpulseaudio ]
+    ++ stdenv.lib.optional stdenv.isLinux alsaLib
+    ++ stdenv.lib.optional stdenv.isDarwin AudioUnit;
+
+  NIX_CFLAGS_COMPILE = stdenv.lib.optionalString stdenv.isDarwin "-Wno-strict-prototypes";
+
+  meta = with stdenv.lib; {
+    description = "Cross platform audio input and output";
+    homepage = http://libsound.io/;
+    license = licenses.mit;
+    platforms = platforms.unix;
+    maintainers = [ maintainers.andrewrk ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libsoup/default.nix b/nixpkgs/pkgs/development/libraries/libsoup/default.nix
new file mode 100644
index 000000000000..52a52e7e7324
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libsoup/default.nix
@@ -0,0 +1,47 @@
+{ stdenv, fetchurl, glib, libxml2, meson, ninja, pkgconfig, gnome3
+, gnomeSupport ? true, sqlite, glib-networking, gobject-introspection, vala
+, libpsl, python3 }:
+
+stdenv.mkDerivation rec {
+  name = "${pname}-${version}";
+  pname = "libsoup";
+  version = "2.66.2";
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${name}.tar.xz";
+    sha256 = "0amfw1yvy1kjrg41rfh2vvrw5gkwnyckqbw1fab50hm6xc1acbmx";
+  };
+
+  postPatch = ''
+    patchShebangs libsoup/
+  '';
+
+  outputs = [ "out" "dev" ];
+
+  buildInputs = [ python3 sqlite libpsl ];
+  nativeBuildInputs = [ meson ninja pkgconfig gobject-introspection vala ];
+  propagatedBuildInputs = [ glib libxml2 ];
+
+  mesonFlags = [
+    "-Dtls_check=false" # glib-networking is a runtime dependency, not a compile-time dependency
+    "-Dgssapi=false"
+    "-Dvapi=true"
+    "-Dgnome=${if gnomeSupport then "true" else "false"}"
+  ];
+
+  doCheck = false; # ERROR:../tests/socket-test.c:37:do_unconnected_socket_test: assertion failed (res == SOUP_STATUS_OK): (2 == 200)
+
+  passthru = {
+    propagatedUserEnvPackages = [ glib-networking.out ];
+    updateScript = gnome3.updateScript {
+      packageName = pname;
+    };
+  };
+
+  meta = {
+    description = "HTTP client/server library for GNOME";
+    homepage = https://wiki.gnome.org/Projects/libsoup;
+    license = stdenv.lib.licenses.gpl2;
+    inherit (glib.meta) maintainers platforms;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libspatialindex/default.nix b/nixpkgs/pkgs/development/libraries/libspatialindex/default.nix
new file mode 100644
index 000000000000..8018b84a52be
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libspatialindex/default.nix
@@ -0,0 +1,21 @@
+{ stdenv, fetchurl }:
+
+let version = "1.8.5"; in
+
+stdenv.mkDerivation rec {
+  name = "libspatialindex-${version}";
+
+  src = fetchurl {
+    url = "https://download.osgeo.org/libspatialindex/spatialindex-src-${version}.tar.gz";
+    sha256 = "1vxzm7kczwnb6qdmc0hb00z8ykx11zk3sb68gc7rch4vrfi4dakw";
+  };
+
+  enableParallelBuilding = true;
+
+  meta = {
+    description = "Extensible spatial index library in C++";
+    homepage = http://libspatialindex.github.io/;
+    license = stdenv.lib.licenses.mit;
+    platforms = stdenv.lib.platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libspatialite/default.nix b/nixpkgs/pkgs/development/libraries/libspatialite/default.nix
new file mode 100644
index 000000000000..8e7b539527e1
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libspatialite/default.nix
@@ -0,0 +1,31 @@
+{ stdenv, lib, fetchurl, pkgconfig, libxml2, sqlite, zlib, proj, geos, libiconv }:
+
+with lib;
+
+stdenv.mkDerivation rec {
+  name = "libspatialite-4.3.0a";
+
+  src = fetchurl {
+    url = "https://www.gaia-gis.it/gaia-sins/libspatialite-sources/${name}.tar.gz";
+    sha256 = "16d4lpl7xrm9zy4gphy6nwanpjp8wn9g4wq2i2kh8abnlhq01448";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ libxml2 sqlite zlib proj geos libiconv ];
+
+  configureFlags = [ "--disable-freexl" ];
+
+  enableParallelBuilding = true;
+
+  postInstall = "" + optionalString stdenv.isDarwin ''
+    ln -s $out/lib/mod_spatialite.{so,dylib}
+  '';
+
+  meta = {
+    description = "Extensible spatial index library in C++";
+    homepage = https://www.gaia-gis.it/fossil/libspatialite;
+    # They allow any of these
+    license = with licenses; [ gpl2Plus lgpl21Plus mpl11 ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libspectre/default.nix b/nixpkgs/pkgs/development/libraries/libspectre/default.nix
new file mode 100644
index 000000000000..f1e4169bd48e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libspectre/default.nix
@@ -0,0 +1,33 @@
+{ fetchurl, stdenv, pkgconfig, ghostscript, cairo }:
+
+stdenv.mkDerivation rec {
+  name = "libspectre-0.2.7";
+
+  src = fetchurl {
+    url = "https://libspectre.freedesktop.org/releases/${name}.tar.gz";
+    sha256 = "1v63lqc6bhhxwkpa43qmz8phqs8ci4dhzizyy16d3vkb20m846z8";
+  };
+
+  patches = [ ./libspectre-0.2.7-gs918.patch ];
+
+  buildInputs = [
+    # Need `libgs.so'.
+    pkgconfig ghostscript cairo /*for tests*/
+  ];
+
+  doCheck = true;
+
+  meta = {
+    homepage = http://libspectre.freedesktop.org/;
+    description = "PostScript rendering library";
+
+    longDescription = ''
+      libspectre is a small library for rendering Postscript
+      documents.  It provides a convenient easy to use API for
+      handling and rendering Postscript documents.
+    '';
+
+    license = stdenv.lib.licenses.gpl2Plus;
+    platforms = stdenv.lib.platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libspectre/libspectre-0.2.7-gs918.patch b/nixpkgs/pkgs/development/libraries/libspectre/libspectre-0.2.7-gs918.patch
new file mode 100644
index 000000000000..e9a4eda192ba
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libspectre/libspectre-0.2.7-gs918.patch
@@ -0,0 +1,42 @@
+Fixed error namespace for >=ghostscript-gpl-9.18
+
+https://bugs.gentoo.org/563540
+
+--- libspectre-0.2.7/libspectre/spectre-gs.c
++++ libspectre-0.2.7/libspectre/spectre-gs.c
+@@ -43,12 +43,12 @@
+ 	
+ 	if (code <= -100) {
+ 		switch (code) {
+-			case e_Fatal:
++			case gs_error_Fatal:
+ 				fprintf (stderr, "fatal internal error %d", code);
+ 				return TRUE;
+ 				break;
+ 
+-			case e_ExecStackUnderflow:
++			case gs_error_ExecStackUnderflow:
+ 				fprintf (stderr, "stack overflow %d", code);
+ 				return TRUE;
+ 				break;
+@@ -109,9 +109,9 @@
+ 		set = _spectre_strdup_printf ("%d %d translate\n", -x, -y);
+ 		error = gsapi_run_string_continue (ghostscript_instance, set, strlen (set),
+ 						   0, &exit_code);
+-		error = error == e_NeedInput ? 0 : error;
++		error = error == gs_error_NeedInput ? 0 : error;
+ 		free (set);
+-		if (error != e_NeedInput && critic_error_code (error)) {
++		if (error != gs_error_NeedInput && critic_error_code (error)) {
+ 			fclose (fd);
+ 			return FALSE;
+ 		}
+@@ -126,7 +126,7 @@
+ 		read = fread (buf, sizeof (char), to_read, fd);
+ 		error = gsapi_run_string_continue (ghostscript_instance,
+ 						   buf, read, 0, &exit_code);
+-		error = error == e_NeedInput ? 0 : error;
++		error = error == gs_error_NeedInput ? 0 : error;
+ 		left -= read;
+ 	}
+ 	
diff --git a/nixpkgs/pkgs/development/libraries/libspiro/default.nix b/nixpkgs/pkgs/development/libraries/libspiro/default.nix
new file mode 100644
index 000000000000..00579600cb76
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libspiro/default.nix
@@ -0,0 +1,18 @@
+{stdenv, pkgconfig, fetchurl}:
+
+stdenv.mkDerivation rec {
+  name = "libspiro-${version}";
+  version = "0.5.20150702";
+  src = fetchurl {
+    url = "https://github.com/fontforge/libspiro/releases/download/${version}/${name}.tar.gz";
+    sha256 = "0z4zpxd3nwwchqdsbmmjbp13aw5jg8v5p1993190bpykkrjlh6nv";
+  };
+
+  nativeBuildInputs = [pkgconfig];
+
+  meta = with stdenv.lib; {
+    description = "A library that simplifies the drawing of beautiful curves";
+    homepage = https://github.com/fontforge/libspiro;
+    license = licenses.gpl3Plus;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libspotify/default.nix b/nixpkgs/pkgs/development/libraries/libspotify/default.nix
new file mode 100644
index 000000000000..5bae04a88f94
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libspotify/default.nix
@@ -0,0 +1,89 @@
+{ stdenv, fetchurl, libspotify, alsaLib, readline, pkgconfig, apiKey ? null, unzip, gnused }:
+
+let
+  version = "12.1.51";
+  isLinux = (stdenv.hostPlatform.system == "x86_64-linux" || stdenv.hostPlatform.system == "i686-linux");
+in
+
+if (stdenv.hostPlatform.system != "x86_64-linux" && stdenv.hostPlatform.system != "x86_64-darwin" && stdenv.hostPlatform.system != "i686-linux")
+then throw "Check https://developer.spotify.com/technologies/libspotify/ for a tarball for your system and add it here"
+else stdenv.mkDerivation {
+  name = "libspotify-${version}";
+
+  src =
+    if stdenv.hostPlatform.system == "x86_64-linux" then
+      fetchurl {
+        url    = "https://developer.spotify.com/download/libspotify/libspotify-${version}-Linux-x86_64-release.tar.gz";
+        sha256 = "0n0h94i4xg46hfba95n3ypah93crwb80bhgsg00f6sms683lx8a3";
+      }
+    else if stdenv.hostPlatform.system == "x86_64-darwin" then
+      fetchurl {
+        url    = "https://developer.spotify.com/download/libspotify/libspotify-${version}-Darwin-universal.zip";
+        sha256 = "1gcgrc8arim3hnszcc886lmcdb4iigc08abkaa02l6gng43ky1c0";
+      }
+    else if stdenv.hostPlatform.system == "i686-linux" then
+      fetchurl {
+        url    = "https://developer.spotify.com/download/libspotify/libspotify-${version}-Linux-i686-release.tar.gz";
+        sha256 = "1bjmn64gbr4p9irq426yap4ipq9rb84zsyhjjr7frmmw22xb86ll";
+      }
+    else
+      null;
+
+  dontBuild = true;
+
+  installPhase = if (isLinux)
+    then "installPhase"
+    else ''
+      mkdir -p "$out"/include/libspotify
+      mv -v libspotify.framework/Versions/Current/Headers/api.h \
+        "$out"/include/libspotify
+      mkdir -p "$out"/lib
+      mv -v libspotify.framework/Versions/Current/libspotify \
+        "$out"/lib/libspotify.dylib
+      mkdir -p "$out"/share/man
+      mv -v man3 "$out"/share/man
+    '';
+
+
+  # darwin-specific
+  buildInputs = stdenv.lib.optional (stdenv.hostPlatform.system == "x86_64-darwin") unzip;
+
+  # linux-specific
+  installFlags = stdenv.lib.optionalString (isLinux)
+    "prefix=$(out)";
+  patchPhase = stdenv.lib.optionalString (isLinux)
+    "${gnused}/bin/sed -i 's/ldconfig//' Makefile";
+  postInstall = stdenv.lib.optionalString (isLinux)
+    "mv -v share $out";
+
+  passthru = {
+    samples = if apiKey == null
+      then throw ''
+        Please visit ${libspotify.meta.homepage} to get an api key then set config.libspotify.apiKey accordingly
+      '' else stdenv.mkDerivation {
+        name = "libspotify-samples-${version}";
+        src = libspotify.src;
+  nativeBuildInputs = [ pkgconfig ];
+        buildInputs = [ libspotify readline ]
+          ++ stdenv.lib.optional (!stdenv.isDarwin) alsaLib;
+        postUnpack = "sourceRoot=$sourceRoot/share/doc/libspotify/examples";
+        patchPhase = "cp ${apiKey} appkey.c";
+        installPhase = ''
+          mkdir -p $out/bin
+          install -m 755 jukebox/jukebox $out/bin
+          install -m 755 spshell/spshell $out/bin
+          install -m 755 localfiles/posix_stu $out/bin
+        '';
+        meta = libspotify.meta // { description = "Spotify API library samples"; };
+      };
+
+    inherit apiKey;
+  };
+
+  meta = with stdenv.lib; {
+    description = "Spotify API library";
+    homepage    = https://developer.spotify.com/technologies/libspotify;
+    maintainers = with maintainers; [ lovek323 ];
+    license     = licenses.unfree;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libsrs2/default.nix b/nixpkgs/pkgs/development/libraries/libsrs2/default.nix
new file mode 100644
index 000000000000..7d9ea25e9d26
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libsrs2/default.nix
@@ -0,0 +1,18 @@
+{ stdenv, lib, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "libsrs2-${version}";
+  version = "1.0.18";
+
+  src = fetchurl {
+    url = "https://www.libsrs2.org/srs/libsrs2-${version}.tar.gz";
+    sha256 = "9d1191b705d7587a5886736899001d04168392bbb6ed6345a057ade50943a492";
+  };
+
+  meta = {
+    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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libssh/default.nix b/nixpkgs/pkgs/development/libraries/libssh/default.nix
new file mode 100644
index 000000000000..fe7bc094fdce
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libssh/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchurl, fetchpatch, pkgconfig, cmake, zlib, openssl, libsodium }:
+
+stdenv.mkDerivation rec {
+  name = "libssh-0.8.7";
+
+  src = fetchurl {
+    url = "https://www.libssh.org/files/0.8/${name}.tar.xz";
+    sha256 = "14nmwfnnrhkwcfk5hn7azl905ivbh4wllmsbw5abd80b5yi4qc23";
+  };
+
+  postPatch = ''
+    # Fix headers to use libsodium instead of NaCl
+    sed -i 's,nacl/,sodium/,g' ./include/libssh/curve25519.h src/curve25519.c
+  '';
+
+  # single output, otherwise cmake and .pc files point to the wrong directory
+  # outputs = [ "out" "dev" ];
+
+  buildInputs = [ zlib openssl libsodium ];
+
+  nativeBuildInputs = [ cmake pkgconfig ];
+
+  meta = with stdenv.lib; {
+    description = "SSH client library";
+    license = licenses.lgpl2Plus;
+    maintainers = with maintainers; [ sander ];
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libssh2/default.nix b/nixpkgs/pkgs/development/libraries/libssh2/default.nix
new file mode 100644
index 000000000000..483a56dcdce6
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libssh2/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchurl, openssl, zlib, windows }:
+
+stdenv.mkDerivation rec {
+  pname = "libssh2";
+  version = "1.8.2";
+
+  src = fetchurl {
+    url = "${meta.homepage}/download/${pname}-${version}.tar.gz";
+    sha256 = "0rqd37pc80nm2pz4sa2m9pfc48axys7jwq1l7z0vii5nyvchg0q8";
+  };
+
+  outputs = [ "out" "dev" "devdoc" ];
+
+  buildInputs = [ openssl zlib ]
+    ++ stdenv.lib.optional stdenv.hostPlatform.isMinGW windows.mingw_w64;
+
+  meta = with stdenv.lib; {
+    description = "A client-side C library implementing the SSH2 protocol";
+    homepage = https://www.libssh2.org;
+    platforms = platforms.all;
+    license = licenses.bsd3;
+    maintainers = [ ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libstatgrab/default.nix b/nixpkgs/pkgs/development/libraries/libstatgrab/default.nix
new file mode 100644
index 000000000000..8896447590ba
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libstatgrab/default.nix
@@ -0,0 +1,20 @@
+{ stdenv, fetchurl
+, IOKit ? null }:
+
+stdenv.mkDerivation rec {
+  name = "libstatgrab-0.91";
+
+  src = fetchurl {
+    url = "https://ftp.i-scream.org/pub/i-scream/libstatgrab/${name}.tar.gz";
+    sha256 = "1azinx2yzs442ycwq6p15skl3mscmqj7fd5hq7fckhjp92735s83";
+  };
+
+  buildInputs = [] ++ stdenv.lib.optional stdenv.isDarwin IOKit;
+
+  meta = with stdenv.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;
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libstemmer/default.nix b/nixpkgs/pkgs/development/libraries/libstemmer/default.nix
new file mode 100644
index 000000000000..67d6d8d42ead
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libstemmer/default.nix
@@ -0,0 +1,22 @@
+{ lib, stdenv, fetchFromGitHub, cmake }:
+
+stdenv.mkDerivation rec {
+  name = "libstemmer-2017-03-02";
+
+  src = fetchFromGitHub {
+    owner = "zvelo";
+    repo = "libstemmer";
+    rev = "78c149a3a6f262a35c7f7351d3f77b725fc646cf";
+    sha256 = "06md6n6h1f2zvnjrpfrq7ng46l1x12c14cacbrzmh5n0j98crpq7";
+  };
+
+  nativeBuildInputs = [ cmake ];
+
+  meta = with lib; {
+    description = "Snowball Stemming Algorithms";
+    homepage = "http://snowball.tartarus.org/";
+    license = licenses.bsd3;
+    maintainers = with maintainers; [ fpletz ];
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libstroke/default.nix b/nixpkgs/pkgs/development/libraries/libstroke/default.nix
new file mode 100644
index 000000000000..400a107c5186
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libstroke/default.nix
@@ -0,0 +1,34 @@
+{stdenv, fetchurl, automake, autoconf, xlibsWrapper}:
+
+stdenv.mkDerivation {
+  name = "libstroke-0.5.1";
+
+  src = fetchurl {
+    url = https://web.archive.org/web/20161204100704/http://etla.net/libstroke/libstroke-0.5.1.tar.gz;
+    sha256 = "0bbpqzsqh9zrc6cg62f6vp1p4dzvv37blsd0gdlzdskgwvyzba8d";
+  };
+
+  buildInputs = [ automake autoconf xlibsWrapper ];
+
+  # libstroke ships with an ancient config.sub that doesn't know about x86_64, so regenerate it.
+  # Also, modern automake doesn't like things and returns error code 63.  But it generates the file.
+  preConfigure = ''
+      rm config.sub
+      autoconf
+      automake -a || true
+    '';
+
+  meta = {
+    description = "Libstroke, a library for simple gesture recognition";
+    homepage = https://web.archive.org/web/20161204100704/http://etla.net/libstroke/;
+    license = stdenv.lib.licenses.gpl2;
+
+    longDescription =
+      '' libstroke, last updated in 2001, still successfully provides a basic
+        gesture recognition engine based around a 3x3 grid.  It's simple and
+        easy to work with, and notably used by FVWM.
+      '';
+
+    platforms = stdenv.lib.platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libstrophe/default.nix b/nixpkgs/pkgs/development/libraries/libstrophe/default.nix
new file mode 100644
index 000000000000..c1e6a1f7fb89
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libstrophe/default.nix
@@ -0,0 +1,35 @@
+{ stdenv, fetchFromGitHub, automake, autoconf, libtool, openssl, expat, pkgconfig, check }:
+
+stdenv.mkDerivation rec {
+  name = "libstrophe-${version}";
+  version = "0.9.2";
+
+  src = fetchFromGitHub {
+    owner = "strophe";
+    repo = "libstrophe";
+    rev = version;
+    sha256 = "1milna92h8wzxax8ll362zvb70091nmfks5lmd105vk0478zraca";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ automake autoconf openssl expat libtool check ];
+
+  dontDisableStatic = true;
+
+  preConfigure = "mkdir m4 && sh bootstrap.sh";
+
+  doCheck = true;
+
+  meta = {
+    description = "A simple, lightweight C library for writing XMPP clients";
+    longDescription = ''
+      libstrophe is a lightweight XMPP client library written in C. It has
+      minimal dependencies and is configurable for various environments. It
+      runs well on both Linux, Unix, and Windows based platforms.
+    '';
+    homepage = http://strophe.im/libstrophe/;
+    license = with stdenv.lib.licenses; [gpl3 mit];
+    platforms = stdenv.lib.platforms.linux;
+    maintainers = with stdenv.lib.maintainers; [devhell flosse];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libsvm/default.nix b/nixpkgs/pkgs/development/libraries/libsvm/default.nix
new file mode 100644
index 000000000000..6eb8b6b1a8e9
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libsvm/default.nix
@@ -0,0 +1,38 @@
+{stdenv, fetchurl}:
+
+stdenv.mkDerivation rec {
+  name = "libsvm-${version}";
+  version = "3.23";
+
+  src = fetchurl {
+    url = "https://www.csie.ntu.edu.tw/~cjlin/libsvm/libsvm-${version}.tar.gz";
+    sha256 = "0jpaq0rr92x38p4nk3gjan79ip67m6p80anb28z1d8601miysyi5";
+  };
+
+  buildPhase = ''
+  make
+  make lib
+  '';
+
+  installPhase = let
+    libSuff = stdenv.hostPlatform.extensions.sharedLibrary;
+  in ''
+    mkdir -p $out/lib $out/bin $out/include;
+    cp libsvm.so.2 $out/lib/libsvm.2${libSuff};
+    ln -s $out/lib/libsvm.2${libSuff} $out/lib/libsvm${libSuff};
+    cp svm-scale svm-train svm-predict $out/bin;
+    cp svm.h $out/include;
+  '';
+
+  postFixup = stdenv.lib.optionalString stdenv.isDarwin ''
+    install_name_tool -id libsvm.2.dylib $out/lib/libsvm.2.dylib;
+  '';
+
+  meta = with stdenv.lib; {
+    description = "A library for support vector machines";
+    homepage = https://www.csie.ntu.edu.tw/~cjlin/libsvm/;
+    license = licenses.bsd3;
+    maintainers = [ maintainers.spwhitt ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libtap/default.nix b/nixpkgs/pkgs/development/libraries/libtap/default.nix
new file mode 100644
index 000000000000..29d83bcd9d70
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libtap/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchurl, pkgconfig, cmake, perl }:
+
+with stdenv.lib;
+stdenv.mkDerivation rec{
+
+  name = "libtap-${version}";
+  version = "1.12.0";
+
+  src = fetchurl {
+    url = "https://web-cpan.shlomifish.org/downloads/${name}.tar.bz2";
+    sha256 = "1ms1770cx8c6q3lhn1chkzy12vzmjgvlms7cqhd2d3260j2wwv5s";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  propagatedBuildInputs = [ cmake perl ];
+
+  meta = with stdenv.lib; {
+    description = "A library to implement a test protocol";
+    longDescription = ''
+      libtap is a library to implement the Test Anything Protocol for
+      C originally created by Nik Clayton. This is a maintenance
+      branch by Shlomi Fish.
+    '';
+    homepage = https://www.shlomifish.org/open-source/projects/libtap/;
+    license = licenses.bsd3;
+    maintainers = [ maintainers.AndersonTorres ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libtar/default.nix b/nixpkgs/pkgs/development/libraries/libtar/default.nix
new file mode 100644
index 000000000000..f2cb879b3e07
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libtar/default.nix
@@ -0,0 +1,37 @@
+{ stdenv, fetchgit, fetchpatch, autoreconfHook }:
+
+stdenv.mkDerivation rec {
+  version = "1.2.20";
+  name = "libtar-${version}";
+
+  # Maintenance repo for libtar (Arch Linux uses this)
+  src = fetchgit {
+    url = "git://repo.or.cz/libtar.git";
+    rev = "refs/tags/v${version}";
+    sha256 = "1pjsqnqjaqgkzf1j8m6y5h76bwprffsjjj6gk8rh2fjsha14rqn9";
+  };
+
+  patches = let
+    fp =  name: sha256:
+      fetchpatch {
+        url = "https://sources.debian.net/data/main/libt/libtar/1.2.20-4/debian/patches/${name}.patch";
+        inherit sha256;
+      };
+    in [
+      (fp "no_static_buffers"         "0yv90bhvqjj0v650gzn8fbzhdhzx5z0r1lh5h9nv39wnww435bd0")
+      (fp "no_maxpathlen"             "11riv231wpbdb1cm4nbdwdsik97wny5sxcwdgknqbp61ibk572b7")
+      (fp "CVE-2013-4420"             "0d010190bqgr2ggy02qwxvjaymy9a22jmyfwdfh4086v876cbxpq")
+      (fp "th_get_size-unsigned-int"  "1ravbs5yrfac98mnkrzciw9hd2fxq4dc07xl3wx8y2pv1bzkwm41")
+    ];
+
+  nativeBuildInputs = [ autoreconfHook ];
+  buildInputs = [ ];
+
+  meta = with stdenv.lib; {
+    description = "C library for manipulating POSIX tar files";
+    homepage = https://repo.or.cz/libtar;
+    license = licenses.bsd3;
+    platforms = with platforms; linux ++ darwin;
+    maintainers = [ maintainers.bjornfor ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libtasn1/default.nix b/nixpkgs/pkgs/development/libraries/libtasn1/default.nix
new file mode 100644
index 000000000000..302400388437
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libtasn1/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchurl, perl, texinfo }:
+
+stdenv.mkDerivation rec {
+  name = "libtasn1-4.13";
+
+  src = fetchurl {
+    url = "mirror://gnu/libtasn1/${name}.tar.gz";
+    sha256 = "1jlc1iahj8k3haz28j55nzg7sgni5h41vqy461i1bpbx6668wlky";
+  };
+
+  outputs = [ "out" "dev" "devdoc" ];
+  outputBin = "dev";
+
+  nativeBuildInputs = [ texinfo perl ];
+
+  doCheck = true;
+
+  meta = with stdenv.lib; {
+    homepage = https://www.gnu.org/software/libtasn1/;
+    description = "An ASN.1 library";
+    longDescription = ''
+      Libtasn1 is the ASN.1 library used by GnuTLS, GNU Shishi and some
+      other packages.  The goal of this implementation is to be highly
+      portable, and only require an ANSI C89 platform.
+    '';
+    license = licenses.lgpl2Plus;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libtcod/default.nix b/nixpkgs/pkgs/development/libraries/libtcod/default.nix
new file mode 100644
index 000000000000..4e859c282276
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libtcod/default.nix
@@ -0,0 +1,33 @@
+{ stdenv, fetchFromBitbucket, cmake, SDL, libGLU_combined, upx, zlib }:
+
+stdenv.mkDerivation rec {
+
+  name = "libtcod-${version}";
+  version = "1.5.1";
+
+  src = fetchFromBitbucket {
+    owner = "libtcod";
+    repo = "libtcod";
+    rev = "1.5.1";
+    sha256 = "1ibsnmnim712npxkqklc5ibnd32hgsx2yzyfzzc5fis5mhinbl63";
+  };
+
+  prePatch = ''
+    sed -i CMakeLists.txt \
+      -e "s,SET(ROOT_DIR.*,SET(ROOT_DIR $out),g" \
+      -e "s,SET(INSTALL_DIR.*,SET(INSTALL_DIR $out),g"
+    echo 'INSTALL(DIRECTORY include DESTINATION .)' >> CMakeLists.txt
+  '';
+
+  cmakeFlags="-DLIBTCOD_SAMPLES=OFF";
+
+  buildInputs = [ cmake SDL libGLU_combined upx zlib ];
+
+  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 ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libtelnet/default.nix b/nixpkgs/pkgs/development/libraries/libtelnet/default.nix
new file mode 100644
index 000000000000..0bc619051c69
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libtelnet/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchFromGitHub, pkgconfig, autoreconfHook, zlib }:
+
+stdenv.mkDerivation rec {
+  name = "libtelnet-${version}";
+  version = "0.21+45f2d5c";
+
+  src = fetchFromGitHub {
+    owner = "seanmiddleditch";
+    repo = "libtelnet";
+    rev = "45f2d5cfcf383312280e61c85b107285fed260cf";
+    sha256 = "1lp6gdbndsp2w8mhy88c2jknxj2klvnggvq04ln7qjg8407ifpda";
+  };
+
+  nativeBuildInputs = [ pkgconfig autoreconfHook ];
+  buildInputs = [ zlib ];
+
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libtensorflow/default.nix b/nixpkgs/pkgs/development/libraries/libtensorflow/default.nix
new file mode 100644
index 000000000000..98096371e400
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libtensorflow/default.nix
@@ -0,0 +1,80 @@
+{ config, stdenv
+, fetchurl
+, patchelf
+, cudaSupport ? config.cudaSupport or false, symlinkJoin, cudatoolkit, cudnn, nvidia_x11
+}:
+with stdenv.lib;
+let
+  tfType = if cudaSupport then "gpu" else "cpu";
+  system =
+    if stdenv.isx86_64
+    then if      stdenv.isLinux  then "linux-x86_64"
+         else if stdenv.isDarwin then "darwin-x86_64" else unavailable
+    else unavailable;
+  unavailable = throw "libtensorflow is not available for this platform!";
+  cudatoolkit_joined = symlinkJoin {
+    name = "unsplit_cudatoolkit";
+    paths = [ cudatoolkit.out
+              cudatoolkit.lib ];};
+  rpath = makeLibraryPath ([stdenv.cc.libc stdenv.cc.cc.lib] ++
+            optionals cudaSupport [ cudatoolkit_joined cudnn nvidia_x11 ]);
+  patchLibs =
+    if stdenv.isDarwin
+    then ''
+      install_name_tool -id $out/lib/libtensorflow.so $out/lib/libtensorflow.so
+      install_name_tool -id $out/lib/libtensorflow_framework.so $out/lib/libtensorflow_framework.so
+    ''
+    else ''
+      ${patchelf}/bin/patchelf --set-rpath "${rpath}:$out/lib" $out/lib/libtensorflow.so
+      ${patchelf}/bin/patchelf --set-rpath "${rpath}" $out/lib/libtensorflow_framework.so
+    '';
+
+in stdenv.mkDerivation rec {
+  pname = "libtensorflow";
+  version = "1.9.0";
+  name = "${pname}-${version}";
+  src = fetchurl {
+    url = "https://storage.googleapis.com/tensorflow/${pname}/${pname}-${tfType}-${system}-${version}.tar.gz";
+    sha256 =
+      if system == "linux-x86_64" then
+        if cudaSupport
+        then "1q3mh06x344im25z7r3vgrfksfdsi8fh8ldn6y2mf86h4d11yxc3"
+        else "0l9ps115ng5ffzdwphlqmj3jhidps2v5afppdzrbpzmy41xz0z21"
+      else if system == "darwin-x86_64" then
+        if cudaSupport
+        then unavailable
+        else "1qj0v1706w6mczycdsh38h2glyv5d25v62kdn98wxd5rw8f9v657"
+      else unavailable;
+  };
+
+  # Patch library to use our libc, libstdc++ and others
+  buildCommand = ''
+    . $stdenv/setup
+    mkdir -pv $out
+    tar -C $out -xzf $src
+    chmod +w $out/lib/libtensorflow.so
+    chmod +w $out/lib/libtensorflow_framework.so
+    ${patchLibs}
+    chmod -w $out/lib/libtensorflow.so
+    chmod -w $out/lib/libtensorflow_framework.so
+
+    # Write pkgconfig file.
+    mkdir $out/lib/pkgconfig
+    cat > $out/lib/pkgconfig/tensorflow.pc << EOF
+    Name: TensorFlow
+    Version: ${version}
+    Description: Library for computation using data flow graphs for scalable machine learning
+    Requires:
+    Libs: -L$out/lib -ltensorflow
+    Cflags: -I$out/include/tensorflow
+    EOF
+  '';
+
+  meta = {
+    description = "C API for TensorFlow";
+    homepage = https://www.tensorflow.org/versions/master/install/install_c;
+    license = licenses.asl20;
+    platforms = with platforms; linux ++ darwin;
+    maintainers = [maintainers.basvandijk];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libtermkey/default.nix b/nixpkgs/pkgs/development/libraries/libtermkey/default.nix
new file mode 100644
index 000000000000..7261fb7b6b74
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libtermkey/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, lib, fetchzip, libtool, pkgconfig, ncurses }:
+
+stdenv.mkDerivation rec {
+  name = "libtermkey-${version}";
+
+  version = "0.20";
+
+  src = fetchzip {
+    url = "http://www.leonerd.org.uk/code/libtermkey/libtermkey-${version}.tar.gz";
+    sha256 = "1i5a2zangq61ba1vdkag34ig5g4gzccldccdbcmqmk93saa6lkbx";
+  };
+
+  makeFlags = [ "PREFIX=$(out)" ]
+    ++ stdenv.lib.optional stdenv.isDarwin "LIBTOOL=${libtool}/bin/libtool";
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ libtool ncurses ];
+
+  meta = with lib; {
+    description = "Terminal keypress reading library";
+    license = licenses.mit;
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libtheora/default.nix b/nixpkgs/pkgs/development/libraries/libtheora/default.nix
new file mode 100644
index 000000000000..81bd35ff293c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libtheora/default.nix
@@ -0,0 +1,30 @@
+{stdenv, fetchurl, libogg, libvorbis, pkgconfig}:
+
+stdenv.mkDerivation rec {
+  name = "libtheora-1.1.1";
+
+  src = fetchurl {
+    url = "http://downloads.xiph.org/releases/theora/${name}.tar.gz";
+    sha256 = "0swiaj8987n995rc7hw0asvpwhhzpjiws8kr3s6r44bqqib2k5a0";
+  };
+
+  outputs = [ "out" "dev" "devdoc" ];
+  outputDoc = "devdoc";
+
+  nativeBuildInputs = [ pkgconfig ];
+  propagatedBuildInputs = [ libogg libvorbis ];
+
+  # 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 ''
+    substituteInPlace configure --replace "-fforce-addr" ""
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = https://www.theora.org/;
+    description = "Library for Theora, a free and open video compression format";
+    license = licenses.bsd3;
+    maintainers = with maintainers; [ spwhitt ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libtiff/default.nix b/nixpkgs/pkgs/development/libraries/libtiff/default.nix
new file mode 100644
index 000000000000..55c747540f77
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libtiff/default.nix
@@ -0,0 +1,36 @@
+{ stdenv
+, fetchurl
+
+, pkgconfig
+
+, zlib
+, libjpeg
+, xz
+}:
+
+stdenv.mkDerivation rec {
+  version = "4.0.10";
+  name = "libtiff-${version}";
+
+  src = fetchurl {
+    url = "https://download.osgeo.org/libtiff/tiff-${version}.tar.gz";
+    sha256 = "1r4np635gr6zlc0bic38dzvxia6iqzcrary4n1ylarzpr8fd2lic";
+  };
+
+  outputs = [ "bin" "dev" "out" "man" "doc" ];
+
+  nativeBuildInputs = [ pkgconfig ];
+
+  propagatedBuildInputs = [ zlib libjpeg xz ]; #TODO: opengl support (bogus configure detection)
+
+  enableParallelBuilding = true;
+
+  doCheck = true; # not cross;
+
+  meta = with stdenv.lib; {
+    description = "Library and utilities for working with the TIFF image file format";
+    homepage = http://download.osgeo.org/libtiff;
+    license = licenses.libtiff;
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libtiger/default.nix b/nixpkgs/pkgs/development/libraries/libtiger/default.nix
new file mode 100644
index 000000000000..7a72fa2b7a31
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libtiger/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, lib, fetchurl, libkate, pango, cairo, pkgconfig, darwin }:
+
+stdenv.mkDerivation rec {
+  name = "libtiger-0.3.4";
+
+  src = fetchurl {
+    url = "https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/libtiger/${name}.tar.gz";
+    sha256 = "0rj1bmr9kngrgbxrjbn4f4f9pww0wmf6viflinq7ava7zdav4hkk";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ libkate pango cairo ]
+    ++ lib.optional stdenv.isDarwin darwin.apple_sdk.frameworks.ApplicationServices;
+
+  meta = {
+    homepage = https://code.google.com/archive/p/libtiger/;
+    description = "A rendering library for Kate streams using Pango and Cairo";
+    platforms = lib.platforms.unix;
+    license = lib.licenses.lgpl21Plus;
+    maintainers = with lib.maintainers; [ matthewbauer ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libtins/default.nix b/nixpkgs/pkgs/development/libraries/libtins/default.nix
new file mode 100644
index 000000000000..c90cff31677b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libtins/default.nix
@@ -0,0 +1,48 @@
+{ boost, cmake, fetchFromGitHub, gtest, libpcap, openssl, stdenv }:
+
+stdenv.mkDerivation rec {
+  pname = "libtins";
+  version = "4.2";
+
+  src = fetchFromGitHub {
+    owner = "mfontanini";
+    repo = pname;
+    rev = "v${version}";
+    sha256 = "0gv661gdf018zk1sr6fnvcmd5akqjihs4h6zzxv6881v6yhhglrz";
+  };
+
+  postPatch = ''
+    rm -rf googletest
+    cp -r ${gtest.src}/googletest googletest
+    chmod -R a+w googletest
+  '';
+
+  nativeBuildInputs = [ cmake gtest ];
+  buildInputs = [
+    openssl
+    libpcap
+    boost
+  ];
+
+  configureFlags = [
+    "--with-boost-libdir=${boost.out}/lib"
+    "--with-boost=${boost.dev}"
+  ];
+
+  enableParallelBuilding = true;
+  doCheck = true;
+  preCheck = ''
+    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD${placeholder "out"}/lib
+    export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$PWD${placeholder "out"}/lib
+  '';
+  checkTarget = "tests test";
+
+  meta = with stdenv.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;
+    maintainers = with maintainers; [ fdns ];
+    platforms = stdenv.lib.platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libtomcrypt/default.nix b/nixpkgs/pkgs/development/libraries/libtomcrypt/default.nix
new file mode 100644
index 000000000000..f9e7f9684bac
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libtomcrypt/default.nix
@@ -0,0 +1,34 @@
+{ stdenv, fetchurl, libtool }:
+
+stdenv.mkDerivation rec {
+  name = "libtomcrypt-${version}";
+  version = "1.18.2";
+
+  src = fetchurl {
+    url = "https://github.com/libtom/libtomcrypt/releases/download/v${version}/crypt-${version}.tar.xz";
+    sha256 = "113vfrgapyv72lalhd3nkw7jnks8az0gcb5wqn9hj19nhcxlrbcn";
+  };
+
+  nativeBuildInputs = [ libtool ];
+
+  postPatch = ''
+    substituteInPlace makefile.shared --replace "LT:=glibtool" "LT:=libtool"
+  '';
+
+  preBuild = ''
+    makeFlagsArray=(PREFIX=$out \
+      INSTALL_GROUP=$(id -g) \
+      INSTALL_USER=$(id -u))
+  '';
+
+  makefile = "makefile.shared";
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    homepage = https://www.libtom.net/LibTomCrypt/;
+    description = "A fairly comprehensive, modular and portable cryptographic toolkit";
+    license = with licenses; [ publicDomain wtfpl ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libtommath/default.nix b/nixpkgs/pkgs/development/libraries/libtommath/default.nix
new file mode 100644
index 000000000000..a90377dad34a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libtommath/default.nix
@@ -0,0 +1,35 @@
+{ stdenv, fetchurl, libtool }:
+
+stdenv.mkDerivation rec {
+  name = "libtommath-${version}";
+  version = "1.1.0";
+
+  src = fetchurl {
+    url = "https://github.com/libtom/libtommath/releases/download/v${version}/ltm-${version}.tar.xz";
+    sha256 = "1bbyagqzfdbg37k1n08nsqzdf44z8zsnjjinqbsyj7rxg246qilh";
+  };
+
+  nativeBuildInputs = [ libtool ];
+
+  postPatch = ''
+    substituteInPlace makefile.shared --replace glibtool libtool
+    substituteInPlace makefile_include.mk --replace "shell arch" "shell uname -m"
+  '';
+
+  preBuild = ''
+    makeFlagsArray=(PREFIX=$out \
+      INSTALL_GROUP=$(id -g) \
+      INSTALL_USER=$(id -u))
+  '';
+
+  makefile = "makefile.shared";
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    homepage = https://www.libtom.net/LibTomMath/;
+    description = "A library for integer-based number-theoretic applications";
+    license = with licenses; [ publicDomain wtfpl ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libtorrent-rasterbar/default.nix b/nixpkgs/pkgs/development/libraries/libtorrent-rasterbar/default.nix
new file mode 100644
index 000000000000..cd8192e34fb9
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libtorrent-rasterbar/default.nix
@@ -0,0 +1,51 @@
+{ stdenv, lib, fetchFromGitHub, fetchpatch, pkgconfig, automake, autoconf
+, zlib, boost, openssl, libtool, python, libiconv, geoip, ncurses
+}:
+
+let
+  version = "1.1.11";
+  formattedVersion = lib.replaceChars ["."] ["_"] version;
+
+  # Make sure we override python, so the correct version is chosen
+  # for the bindings, if overridden
+  boostPython = boost.override { enablePython = true; inherit python; };
+
+in stdenv.mkDerivation {
+  name = "libtorrent-rasterbar-${version}";
+
+  src = fetchFromGitHub {
+    owner = "arvidn";
+    repo = "libtorrent";
+    rev = "libtorrent_${formattedVersion}";
+    sha256 = "0nwdsv6d2gkdsh7l5a46g6cqx27xwh3msify5paf02l1qzjy4s5l";
+  };
+
+  enableParallelBuilding = true;
+  nativeBuildInputs = [ automake autoconf libtool pkgconfig ];
+  buildInputs = [ boostPython openssl zlib python libiconv geoip ncurses ];
+  preConfigure = "./autotool.sh";
+
+  postInstall = ''
+    moveToOutput "include" "$dev"
+    moveToOutput "lib/${python.libPrefix}" "$python"
+  '';
+
+  outputs = [ "out" "dev" "python" ];
+
+  configureFlags = [
+    "--enable-python-binding"
+    "--with-libgeoip=system"
+    "--with-libiconv=yes"
+    "--with-boost=${boostPython.dev}"
+    "--with-boost-libdir=${boostPython.out}/lib"
+    "--with-libiconv=yes"
+  ];
+
+  meta = with stdenv.lib; {
+    homepage = "https://libtorrent.org/";
+    description = "A C++ BitTorrent implementation focusing on efficiency and scalability";
+    license = licenses.bsd3;
+    maintainers = [ maintainers.phreedom ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libtoxcore/default.nix b/nixpkgs/pkgs/development/libraries/libtoxcore/default.nix
new file mode 100644
index 000000000000..1605abf6efa1
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libtoxcore/default.nix
@@ -0,0 +1,54 @@
+{ stdenv, fetchFromGitHub, cmake, libsodium, ncurses, libopus, msgpack
+, libvpx, check, libconfig, pkgconfig }:
+
+let
+  generic = { version, sha256 }:
+  stdenv.mkDerivation rec {
+    name = "libtoxcore-${version}";
+
+    src = fetchFromGitHub {
+      owner  = "TokTok";
+      repo   = "c-toxcore";
+      rev    = "v${version}";
+      inherit sha256;
+    };
+
+    cmakeFlags = [
+      "-DBUILD_NTOX=ON"
+      "-DDHT_BOOTSTRAP=ON"
+      "-DBOOTSTRAP_DAEMON=ON"
+    ];
+
+    buildInputs = [
+      libsodium msgpack ncurses libconfig
+    ] ++ stdenv.lib.optionals (!stdenv.isAarch32) [
+      libopus libvpx
+    ];
+
+    nativeBuildInputs = [ cmake pkgconfig ];
+
+    enableParallelBuilding = true;
+
+    doCheck = false; # hangs, tries to access the net?
+    checkInputs = [ check ];
+
+    meta = with stdenv.lib; {
+      description = "P2P FOSS instant messaging application aimed to replace Skype";
+      homepage = https://tox.chat;
+      license = licenses.gpl3Plus;
+      maintainers = with maintainers; [ peterhoeg ];
+      platforms = platforms.all;
+    };
+  };
+
+in rec {
+  libtoxcore_0_1 = generic {
+    version = "0.1.11";
+    sha256 = "1fya5gfiwlpk6fxhalv95n945ymvp2iidiyksrjw1xw95fzsp1ij";
+  };
+
+  libtoxcore_0_2 = generic {
+    version = "0.2.9";
+    sha256 = "0aljr9hqybla6p61af6fdkv0x8gph7c2wacqqa9hq2z9w0p4fs5j";
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libtoxcore/new-api.nix b/nixpkgs/pkgs/development/libraries/libtoxcore/new-api.nix
new file mode 100644
index 000000000000..c3981f5c58ea
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libtoxcore/new-api.nix
@@ -0,0 +1,56 @@
+{ stdenv, fetchFromGitHub, autoreconfHook, libsodium, ncurses, libopus
+, libvpx, check, libconfig, pkgconfig }:
+
+stdenv.mkDerivation rec {
+  name = "tox-core-new-20160727";
+
+  src = fetchFromGitHub {
+    owner  = "irungentoo";
+    repo   = "toxcore";
+    rev    = "755f084e8720b349026c85afbad58954cb7ff1d4";
+    sha256 = "0ap1gvlyihnfivv235dbrgsxsiiz70bhlmlr5gn1027w3h5kqz8w";
+  };
+
+  NIX_LDFLAGS = "-lgcc_s";
+
+  postPatch = ''
+    # within Nix chroot builds, localhost is unresolvable
+    sed -i -e '/DEFTESTCASE(addr_resolv_localhost)/d' \
+      auto_tests/network_test.c
+    # takes WAAAY too long (~10 minutes) and would timeout
+    sed -i -e '/DEFTESTCASE[^(]*(many_clients\>/d' \
+      auto_tests/tox_test.c
+  '';
+
+  configureFlags = [
+    "--with-libsodium-headers=${libsodium.dev}/include"
+    "--with-libsodium-libs=${libsodium.out}/lib"
+    "--enable-ntox"
+    "--enable-daemon"
+  ];
+
+
+  nativeBuildInputs = [ autoreconfHook pkgconfig ];
+  buildInputs = [
+    autoreconfHook libsodium ncurses check libconfig
+  ] ++ stdenv.lib.optionals (!stdenv.isAarch32) [
+    libopus
+  ];
+
+  propagatedBuildInputs = stdenv.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}
+  # They don't recommend running tests on 50core machines with other cpu-bound
+  # tests running in parallel.
+  #
+  # NOTE: run the tests locally on your machine before upgrading this package!
+  doCheck = false;
+
+  meta = with stdenv.lib; {
+    description = "P2P FOSS instant messaging application aimed to replace Skype with crypto";
+    license = licenses.gpl3Plus;
+    maintainers = with maintainers; [ ];
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libtsm/darwin.patch b/nixpkgs/pkgs/development/libraries/libtsm/darwin.patch
new file mode 100644
index 000000000000..d447be456e0e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libtsm/darwin.patch
@@ -0,0 +1,37 @@
+From 4e7b7b1124bfbccb43820997164b00720bf5ca31 Mon Sep 17 00:00:00 2001
+From: Florian Gilcher <florian.gilcher@asquera.de>
+Date: Sun, 23 Mar 2014 23:05:44 +0100
+Subject: [PATCH] Remove GCC specific flags
+
+---
+ Makefile.am | 10 ++--------
+ 1 file changed, 2 insertions(+), 8 deletions(-)
+
+diff --git a/Makefile.am b/Makefile.am
+index f1e872b..c011f02 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -69,11 +69,7 @@ AM_CFLAGS = \
+ AM_CPPFLAGS = \
+ 	-include $(top_builddir)/config.h \
+ 	-I $(srcdir)/src
+-AM_LDFLAGS = \
+-	-Wl,--as-needed \
+-	-Wl,--gc-sections \
+-	-Wl,-z,relro \
+-	-Wl,-z,now
++AM_LDFLAGS =
+ 
+ if BUILD_ENABLE_DEBUG
+ AM_CFLAGS += -g
+@@ -134,9 +130,7 @@ libtsm_la_CPPFLAGS = $(AM_CPPFLAGS)
+ libtsm_la_LIBADD = libshl.la
+ EXTRA_libtsm_la_DEPENDENCIES = $(top_srcdir)/docs/libtsm.sym
+ libtsm_la_LDFLAGS = \
+-	$(AM_LDFLAGS) \
+-	-version-info $(LIBTSM_CURRENT):$(LIBTSM_REVISION):$(LIBTSM_AGE) \
+-	-Wl,--version-script="$(top_srcdir)/docs/libtsm.sym"
++	$(AM_LDFLAGS)
+ 
+ if BUILD_HAVE_XKBCOMMON
+ libtsm_la_CPPFLAGS += $(XKBCOMMON_CFLAGS)
diff --git a/nixpkgs/pkgs/development/libraries/libtsm/default.nix b/nixpkgs/pkgs/development/libraries/libtsm/default.nix
new file mode 100644
index 000000000000..18ceb5302292
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libtsm/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, lib, fetchurl, libxkbcommon, pkgconfig, autoreconfHook }:
+
+stdenv.mkDerivation rec {
+  name = "libtsm-3";
+
+  src = fetchurl {
+    url = "https://freedesktop.org/software/kmscon/releases/${name}.tar.xz";
+    sha256 = "01ygwrsxfii0pngfikgqsb4fxp8n1bbs47l7hck81h9b9bc1ah8i";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ libxkbcommon ] ++ lib.optionals stdenv.isDarwin [
+    autoreconfHook
+  ];
+
+  configureFlags = [ "--disable-debug" ];
+
+  patches = lib.optional stdenv.isDarwin ./darwin.patch;
+
+  meta = with lib; {
+    description = "Terminal-emulator State Machine";
+    homepage = http://www.freedesktop.org/wiki/Software/kmscon/libtsm/;
+    license = licenses.mit;
+    maintainers = with maintainers; [ cstrahan ];
+    platforms = with platforms; unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libtxc_dxtn/default.nix b/nixpkgs/pkgs/development/libraries/libtxc_dxtn/default.nix
new file mode 100644
index 000000000000..b0be3cb3c12d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libtxc_dxtn/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, fetchurl, autoreconfHook, libGLU_combined }:
+
+let version = "1.0.1"; in
+
+stdenv.mkDerivation rec {
+  name = "libtxc_dxtn-${version}";
+
+  src = fetchurl {
+    url = "https://people.freedesktop.org/~cbrill/libtxc_dxtn/${name}.tar.bz2";
+    sha256 = "0q5fjaknl7s0z206dd8nzk9bdh8g4p23bz7784zrllnarl90saa5";
+  };
+
+  nativeBuildInputs = [ autoreconfHook ];
+  buildInputs = [ libGLU_combined ];
+
+  meta = with stdenv.lib; {
+    homepage = http://dri.freedesktop.org/wiki/S3TC;
+    repositories.git = git://people.freedesktop.org/~mareko/libtxc_dxtn;
+    license = licenses.mit;
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libtxc_dxtn_s2tc/default.nix b/nixpkgs/pkgs/development/libraries/libtxc_dxtn_s2tc/default.nix
new file mode 100644
index 000000000000..aad8ae00c114
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libtxc_dxtn_s2tc/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchurl, autoreconfHook, libGLU_combined }:
+
+let version = "1.0"; in
+
+stdenv.mkDerivation rec {
+  name = "libtxc_dxtn_s2tc-${version}";
+
+  src = fetchurl {
+    url = "https://github.com/divVerent/s2tc/archive/v${version}.tar.gz";
+    sha256 = "0ibfdib277fhbqvxzan0bmglwnsl1y1rw2g8skvz82l1sfmmn752";
+  };
+
+  nativeBuildInputs = [ autoreconfHook ];
+  buildInputs = [ libGLU_combined ];
+
+  meta = {
+    description = "A patent-free S3TC compatible implementation";
+    homepage = https://github.com/divVerent/s2tc;
+    repositories.git = https://github.com/divVerent/s2tc.git;
+    license = stdenv.lib.licenses.mit;
+    platforms = stdenv.lib.platforms.linux;
+    maintainers = [ stdenv.lib.maintainers.cpages ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libu2f-host/default.nix b/nixpkgs/pkgs/development/libraries/libu2f-host/default.nix
new file mode 100644
index 000000000000..ad0557049e3e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libu2f-host/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchurl, pkgconfig, json_c, hidapi }:
+
+stdenv.mkDerivation rec {
+  pname = "libu2f-host";
+  version = "1.1.10";
+
+  src = fetchurl {
+    url = "https://developers.yubico.com/${pname}/Releases/${pname}-${version}.tar.xz";
+    sha256 = "0vrivl1dwql6nfi48z6dy56fwy2z13d7abgahgrs2mcmqng7hra2";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ json_c hidapi ];
+
+  doCheck = true;
+
+  postInstall = ''
+    install -D -t $out/lib/udev/rules.d 70-u2f.rules
+  '';
+
+  meta = with stdenv.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 = licenses.bsd2;
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libu2f-server/default.nix b/nixpkgs/pkgs/development/libraries/libu2f-server/default.nix
new file mode 100644
index 000000000000..6140c13e493d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libu2f-server/default.nix
@@ -0,0 +1,20 @@
+{ stdenv, fetchurl, pkgconfig, json_c, openssl, check, file, help2man, which, gengetopt }:
+
+stdenv.mkDerivation rec {
+  name = "libu2f-server-1.1.0";
+  src = fetchurl {
+    url = "https://developers.yubico.com/libu2f-server/Releases/${name}.tar.xz";
+    sha256 = "0xx296nmmqa57w0v5p2kasl5zr1ms2gh6qi4lhv6xvzbmjp3rkcd";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ json_c openssl check file help2man which gengetopt ];
+
+  meta = with stdenv.lib; {
+    homepage = https://developers.yubico.com/libu2f-server/;
+    description = "A C library that implements the server-side of the U2F protocol";
+    license = licenses.bsd2;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ philandstuff ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libubox/default.nix b/nixpkgs/pkgs/development/libraries/libubox/default.nix
new file mode 100644
index 000000000000..71ac22e85a8f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libubox/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, lib, fetchgit, cmake, pkgconfig, json_c }:
+
+stdenv.mkDerivation {
+  name = "libubox-2017-09-29";
+
+  src = fetchgit {
+    url = "https://git.openwrt.org/project/libubox.git";
+    rev = "632688e8d6cde32781e4ec685d59afb0938300ad";
+    sha256 = "1rkwn287k7p802hbd9ap13xxrxsghq6827r86ymqbbcmbcrna13c";
+  };
+
+  cmakeFlags = [ "-DBUILD_LUA=OFF" "-DBUILD_EXAMPLES=OFF" ];
+
+  nativeBuildInputs = [ cmake pkgconfig ];
+  buildInputs = [ json_c ];
+
+  meta = with lib; {
+    description = "C utility functions for OpenWrt";
+    homepage = "https://git.openwrt.org/?p=project/libubox.git;a=summary";
+    license = licenses.isc;
+    platforms = platforms.all;
+    maintainers = with maintainers; [ fpletz ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libuchardet/default.nix b/nixpkgs/pkgs/development/libraries/libuchardet/default.nix
new file mode 100644
index 000000000000..5aa26a749e4f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libuchardet/default.nix
@@ -0,0 +1,32 @@
+{ stdenv, fetchurl, cmake }:
+
+stdenv.mkDerivation rec {
+  pname = "uchardet";
+  version = "0.0.6";
+
+  outputs = [ "bin" "out" "man" "dev" ];
+
+  src = fetchurl {
+    url = "https://www.freedesktop.org/software/${pname}/releases/${pname}-${version}.tar.xz";
+    sha256 = "0q9c02b6nmw41yfsiqsnphgc3f0yg3fj31wkccp47cmwvy634lc3";
+  };
+
+  buildInputs = [ cmake ];
+
+  cmakeFlags = [
+    "-DCMAKE_SKIP_BUILD_RPATH=OFF" # for tests
+    # TODO: move the following to CMake setup hook
+    "-DCMAKE_INSTALL_BINDIR=${placeholder "bin"}/bin"
+    "-DCMAKE_INSTALL_MANDIR=${placeholder "man"}/share/man"
+  ];
+
+  doCheck = true;
+
+  meta = with stdenv.lib; {
+    description = "Mozilla's Universal Charset Detector C/C++ API";
+    homepage = https://www.freedesktop.org/wiki/Software/uchardet/;
+    license = licenses.mpl11;
+    maintainers = with maintainers; [ cstrahan ];
+    platforms = with platforms; unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libuecc/default.nix b/nixpkgs/pkgs/development/libraries/libuecc/default.nix
new file mode 100644
index 000000000000..3b45d4de8842
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libuecc/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchgit, cmake }:
+
+stdenv.mkDerivation rec {
+  version = "7";
+  name = "libuecc-${version}";
+
+  src = fetchgit {
+    url = "git://git.universe-factory.net/libuecc";
+    rev = "refs/tags/v${version}";
+    sha256 = "1sm05aql75sh13ykgsv3ns4x4zzw9lvzid6misd22gfgf6r9n5fs";
+  };
+
+  buildInputs = [ cmake ];
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    description = "Very small Elliptic Curve Cryptography library";
+    homepage = https://git.universe-factory.net/libuecc;
+    license = licenses.bsd2;
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ fpletz ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libui/default.nix b/nixpkgs/pkgs/development/libraries/libui/default.nix
new file mode 100644
index 000000000000..dcc406accbd7
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libui/default.nix
@@ -0,0 +1,53 @@
+{ stdenv, fetchgit, cmake, pkgconfig, gtk3, cf-private, Cocoa }:
+
+let
+  shortName = "libui";
+  version   = "3.1a";
+  backend   = if stdenv.isDarwin then "darwin" else "unix";
+in
+
+stdenv.mkDerivation rec {
+  name = "${shortName}-${version}";
+  src  = fetchgit {
+    url    = "https://github.com/andlabs/libui.git";
+    rev    = "6ebdc96b93273c3cedf81159e7843025caa83058";
+    sha256 = "1lpbfa298c61aarlzgp7vghrmxg1274pzxh1j9isv8x758gk6mfn";
+  };
+
+  nativeBuildInputs = [ cmake pkgconfig ];
+  buildInputs = stdenv.lib.optional stdenv.isLinux gtk3
+    ++ stdenv.lib.optionals stdenv.isDarwin [ Cocoa cf-private /* For NSDefaultRunLoopMode */ ];
+
+  preConfigure = stdenv.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 ''
+    mv ./out/${shortName}.so.0 $out/lib/
+    ln -s $out/lib/${shortName}.so.0 $out/lib/${shortName}.so
+  '' + stdenv.lib.optionalString stdenv.isDarwin ''
+    mv ./out/${shortName}.A.dylib $out/lib/
+    ln -s $out/lib/${shortName}.A.dylib $out/lib/${shortName}.dylib
+  '' + ''
+    cp $src/ui.h $out/include
+    cp $src/ui_${backend}.h $out/include
+
+    cp ${./libui.pc} $out/lib/pkgconfig/${shortName}.pc
+    substituteInPlace $out/lib/pkgconfig/${shortName}.pc \
+      --subst-var-by out $out \
+      --subst-var-by version "${version}"
+  '';
+  postInstall = stdenv.lib.optionalString stdenv.isDarwin ''
+    install_name_tool -id $out/lib/${shortName}.A.dylib $out/lib/${shortName}.A.dylib
+  '';
+
+  meta = with stdenv.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;
+    platforms   = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libui/libui.pc b/nixpkgs/pkgs/development/libraries/libui/libui.pc
new file mode 100644
index 000000000000..42ee86fb550f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libui/libui.pc
@@ -0,0 +1,11 @@
+prefix=@out@
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${exec_prefix}/include
+
+Name: libui
+Description: Simple and portable (but not inflexible) GUI library
+Version: @version@
+
+Libs: -L${libdir} -lui
+Cflags: -I${includedir}
diff --git a/nixpkgs/pkgs/development/libraries/libunarr/default.nix b/nixpkgs/pkgs/development/libraries/libunarr/default.nix
new file mode 100644
index 000000000000..e21f9400848d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libunarr/default.nix
@@ -0,0 +1,21 @@
+{ stdenv, fetchurl, cmake }:
+
+stdenv.mkDerivation rec {
+  name = "libunarr-${version}";
+  version = "1.0.1";
+
+  src = fetchurl {
+    url = "https://github.com/selmf/unarr/releases/download/v${version}/unarr-${version}.tar.xz";
+    sha256 = "1db500k6w90qn6qb4j3zcczailmmv81q9lv4bwq516hbncg5p4sl";
+  };
+
+  nativeBuildInputs = [ cmake ];
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.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/nixpkgs/pkgs/development/libraries/libunibreak/default.nix b/nixpkgs/pkgs/development/libraries/libunibreak/default.nix
new file mode 100644
index 000000000000..50bc05395895
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libunibreak/default.nix
@@ -0,0 +1,19 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "libunibreak-${version}";
+  version = "1.1";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/vimgadgets/libunibreak/${version}/${name}.tar.gz";
+    sha256 = "02657l426bk5d8h42b9ixxy1clc50mx4bzwg02nkdhs09wqw32wn";
+  };
+
+  meta = with stdenv.lib; {
+    homepage = http://vimgadgets.sourceforge.net/libunibreak/;
+    description = "A library implementing a line breaking algorithm as described in Unicode 6.0.0 Standard";
+    license = licenses.zlib;
+    platforms = platforms.unix;
+    maintainers = [ maintainers.coroa ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libunique/1.1.6-G_CONST_RETURN.patch b/nixpkgs/pkgs/development/libraries/libunique/1.1.6-G_CONST_RETURN.patch
new file mode 100644
index 000000000000..1cc5b6e01be4
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libunique/1.1.6-G_CONST_RETURN.patch
@@ -0,0 +1,143 @@
+From 557b0e5045c9eadb556ce11e16965cf0d0787438 Mon Sep 17 00:00:00 2001
+From: Stef Walter <stefw@collabora.co.uk>
+Date: Tue, 14 Jun 2011 12:33:45 +0100
+Subject: [PATCH] Remove G_CONST_RETURN usage, now that its gone in glib.
+
+https://bugzilla.gnome.org/show_bug.cgi?id=652545
+
+[Alexandre Rostovtsev <tetromino@gmail.com>: backported to unique-1.1]
+---
+ unique/uniqueapp.c       |    4 ++--
+ unique/uniquebackend.c   |    4 ++--
+ unique/uniquebackend.h   |    4 ++--
+ unique/uniqueinternals.h |    4 ++--
+ unique/uniquemessage.c   |    4 ++--
+ unique/uniquemessage.h   |    4 ++--
+ 6 files changed, 12 insertions(+), 12 deletions(-)
+
+diff --git a/unique/uniqueapp.c b/unique/uniqueapp.c
+index b40a86c..e8edc94 100644
+--- a/unique/uniqueapp.c
++++ b/unique/uniqueapp.c
+@@ -781,7 +781,7 @@ unique_app_watch_window (UniqueApp *app,
+ }
+ 
+ 
+-G_CONST_RETURN gchar *
++const gchar *
+ unique_command_to_string (UniqueApp *app,
+                           gint       command)
+ {
+@@ -863,7 +863,7 @@ unique_command_from_string (UniqueApp   *app,
+   return retval;
+ }
+ 
+-G_CONST_RETURN gchar *
++const gchar *
+ unique_response_to_string (UniqueResponse response)
+ {
+   GEnumClass *enum_class;
+diff --git a/unique/uniquebackend.c b/unique/uniquebackend.c
+index a76e42e..68e2735 100644
+--- a/unique/uniquebackend.c
++++ b/unique/uniquebackend.c
+@@ -111,7 +111,7 @@ unique_backend_set_name (UniqueBackend *backend,
+  *
+  * Return value: FIXME
+  */
+-G_CONST_RETURN gchar *
++const gchar *
+ unique_backend_get_name (UniqueBackend *backend)
+ {
+   g_return_val_if_fail (UNIQUE_IS_BACKEND (backend), NULL);
+@@ -154,7 +154,7 @@ unique_backend_set_startup_id (UniqueBackend *backend,
+  *
+  * Return value: FIXME
+  */
+-G_CONST_RETURN gchar *
++const gchar *
+ unique_backend_get_startup_id (UniqueBackend *backend)
+ {
+   g_return_val_if_fail (UNIQUE_IS_BACKEND (backend), NULL);
+diff --git a/unique/uniquebackend.h b/unique/uniquebackend.h
+index a50ce4e..b19ad3e 100644
+--- a/unique/uniquebackend.h
++++ b/unique/uniquebackend.h
+@@ -94,10 +94,10 @@ GType                 unique_backend_get_type       (void) G_GNUC_CONST;
+ 
+ UniqueBackend *       unique_backend_create         (void);
+ 
+-G_CONST_RETURN gchar *unique_backend_get_name       (UniqueBackend     *backend);
++const gchar *         unique_backend_get_name       (UniqueBackend     *backend);
+ void                  unique_backend_set_name       (UniqueBackend     *backend,
+                                                      const gchar       *name);
+-G_CONST_RETURN gchar *unique_backend_get_startup_id (UniqueBackend     *backend);
++const gchar *         unique_backend_get_startup_id (UniqueBackend     *backend);
+ void                  unique_backend_set_startup_id (UniqueBackend     *backend,
+                                                      const gchar       *startup_id);
+ GdkScreen *           unique_backend_get_screen     (UniqueBackend     *backend);
+diff --git a/unique/uniqueinternals.h b/unique/uniqueinternals.h
+index 3cec152..ccae0cd 100644
+--- a/unique/uniqueinternals.h
++++ b/unique/uniqueinternals.h
+@@ -44,11 +44,11 @@ UniqueResponse unique_app_emit_message_received (UniqueApp         *app,
+  * and then back into an id
+  */
+ UniqueResponse        unique_response_from_string  (const gchar    *response);
+-G_CONST_RETURN gchar *unique_response_to_string    (UniqueResponse  response);
++const gchar *         unique_response_to_string    (UniqueResponse  response);
+ 
+ gint                  unique_command_from_string   (UniqueApp      *app,
+                                                     const gchar    *command);
+-G_CONST_RETURN gchar *unique_command_to_string     (UniqueApp      *app,
++const gchar *         unique_command_to_string     (UniqueApp      *app,
+                                                     gint            command);
+ 
+ G_END_DECLS
+diff --git a/unique/uniquemessage.c b/unique/uniquemessage.c
+index c74392d..2b2a9fc 100644
+--- a/unique/uniquemessage.c
++++ b/unique/uniquemessage.c
+@@ -185,7 +185,7 @@ unique_message_data_set (UniqueMessageData *message_data,
+  *
+  * Since: 1.0.2
+  */
+-G_CONST_RETURN guchar *
++const guchar *
+ unique_message_data_get (UniqueMessageData *message_data,
+                          gsize             *length)
+ {
+@@ -525,7 +525,7 @@ unique_message_data_get_screen (UniqueMessageData *message_data)
+  *   owned by the #UniqueMessageData structure and should not be
+  *   modified or freed
+  */
+-G_CONST_RETURN gchar *
++const gchar *
+ unique_message_data_get_startup_id (UniqueMessageData *message_data)
+ {
+   g_return_val_if_fail (message_data != NULL, NULL);
+diff --git a/unique/uniquemessage.h b/unique/uniquemessage.h
+index d3e9c3c..93eee21 100644
+--- a/unique/uniquemessage.h
++++ b/unique/uniquemessage.h
+@@ -48,7 +48,7 @@ void                   unique_message_data_free           (UniqueMessageData *me
+ void                   unique_message_data_set            (UniqueMessageData *message_data,
+                                                            const guchar      *data,
+                                                            gsize              length);
+-G_CONST_RETURN guchar *unique_message_data_get            (UniqueMessageData *message_data,
++const guchar *         unique_message_data_get            (UniqueMessageData *message_data,
+                                                            gsize             *length);
+ 
+ gboolean               unique_message_data_set_text       (UniqueMessageData *message_data,
+@@ -63,7 +63,7 @@ void                   unique_message_data_set_filename   (UniqueMessageData *me
+ gchar *                unique_message_data_get_filename   (UniqueMessageData *message_data);
+ 
+ GdkScreen *            unique_message_data_get_screen     (UniqueMessageData *message_data);
+-G_CONST_RETURN gchar * unique_message_data_get_startup_id (UniqueMessageData *message_data);
++const gchar *          unique_message_data_get_startup_id (UniqueMessageData *message_data);
+ guint                  unique_message_data_get_workspace  (UniqueMessageData *message_data);
+ 
+ G_END_DECLS
+-- 
+1.7.6
+
diff --git a/nixpkgs/pkgs/development/libraries/libunique/1.1.6-compiler-warnings.patch b/nixpkgs/pkgs/development/libraries/libunique/1.1.6-compiler-warnings.patch
new file mode 100644
index 000000000000..f47e66267d50
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libunique/1.1.6-compiler-warnings.patch
@@ -0,0 +1,50 @@
+From 9df132a70d54b768a8e1d0335d24b85ac9b3fb76 Mon Sep 17 00:00:00 2001
+From: Emmanuele Bassi <ebassi@linux.intel.com>
+Date: Sun, 27 Mar 2011 08:42:22 +0000
+Subject: Remove compiler warnings
+
+(cherry picked from commit f791ed16b19dddc7fbaf90d8f797520e67883021)
+
+Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
+---
+diff --git a/unique/dbus/uniquebackend-dbus.c b/unique/dbus/uniquebackend-dbus.c
+index 3ae1bed..69faa00 100644
+--- a/unique/dbus/uniquebackend-dbus.c
++++ b/unique/dbus/uniquebackend-dbus.c
+@@ -84,7 +84,6 @@ unique_backend_dbus_register_proxy (UniqueBackendDBus *backend_dbus)
+ static gboolean
+ unique_backend_dbus_request_name (UniqueBackend *backend)
+ {
+-  UniqueBackendDBus *backend_dbus;
+   const gchar *name;
+   DBusGConnection *connection;
+   DBusGProxy *proxy;
+@@ -97,8 +96,6 @@ unique_backend_dbus_request_name (UniqueBackend *backend)
+   if (!connection)
+     return FALSE;
+ 
+-  backend_dbus = UNIQUE_BACKEND_DBUS (backend);
+-
+   retval = TRUE;
+   name = unique_backend_get_name (backend);
+   g_assert (name != NULL);
+@@ -207,10 +204,14 @@ unique_backend_dbus_send_message (UniqueBackend     *backend,
+                                         cmd, data, time_,
+                                         &resp,
+                                         &error);
+-  if (error)
++  if (!res)
+     {
+-      g_warning ("Error while sending message: %s", error->message);
+-      g_error_free (error);
++      if (error)
++        {
++          g_warning ("Error while sending message: %s", error->message);
++          g_error_free (error);
++        }
++
+       g_free (cmd);
+       
+       return UNIQUE_RESPONSE_INVALID;
+--
+cgit v0.9
diff --git a/nixpkgs/pkgs/development/libraries/libunique/1.1.6-fix-test.patch b/nixpkgs/pkgs/development/libraries/libunique/1.1.6-fix-test.patch
new file mode 100644
index 000000000000..b2e85e4d71a5
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libunique/1.1.6-fix-test.patch
@@ -0,0 +1,26 @@
+From caf736f4b84808393b0d7030ae6128a3322a71e2 Mon Sep 17 00:00:00 2001
+From: Tobias Mueller <tobiasmue@gnome.org>
+Date: Mon, 12 Apr 2010 13:01:42 +0000
+Subject: test-unique: Resolve format string issues
+
+Provide a proper literal format string to not expose potential vulnerabilites.
+Fixes bug 615522.
+---
+diff --git a/tests/test-unique.c b/tests/test-unique.c
+index b7cde45..c9958c9 100644
+--- a/tests/test-unique.c
++++ b/tests/test-unique.c
+@@ -82,9 +82,11 @@ app_message_cb (UniqueApp         *app,
+                                    GTK_DIALOG_DESTROY_WITH_PARENT,
+                                    GTK_MESSAGE_INFO,
+                                    GTK_BUTTONS_CLOSE,
++                                   "%s",
+                                    title);
+   if (message)
+     gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
++                                              "%s",
+                                               message);
+ 
+   gtk_window_set_urgency_hint (GTK_WINDOW (dialog), TRUE);
+--
+cgit v0.9
diff --git a/nixpkgs/pkgs/development/libraries/libunique/1.1.6-include-terminator.patch b/nixpkgs/pkgs/development/libraries/libunique/1.1.6-include-terminator.patch
new file mode 100644
index 000000000000..927771e7311b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libunique/1.1.6-include-terminator.patch
@@ -0,0 +1,37 @@
+From 30ca2903a8ed4eed974ea744e4b9bd96198c425d Mon Sep 17 00:00:00 2001
+From: Rodney Lorrimar <r.lorrimar@fugro-fsi.com.au>
+Date: Mon, 21 Dec 2009 02:07:46 +0000
+Subject: Include NUL terminator in unique_message_data_get_filename()
+
+https://bugzilla.gnome.org/show_bug.cgi?id=605104
+
+Signed-off-by: Emmanuele Bassi <ebassi@gnome.org>
+---
+diff --git a/unique/uniqueinternals.h b/unique/uniqueinternals.h
+index ace40ed..3cec152 100644
+--- a/unique/uniqueinternals.h
++++ b/unique/uniqueinternals.h
+@@ -13,7 +13,7 @@ G_BEGIN_DECLS
+ struct _UniqueMessageData
+ {
+   guchar *data;
+-  gint length;
++  gint length;  /* length of data not including NUL terminator */
+ 
+   GdkScreen *screen;
+   gchar *startup_id;
+diff --git a/unique/uniquemessage.c b/unique/uniquemessage.c
+index 10f6df5..c74392d 100644
+--- a/unique/uniquemessage.c
++++ b/unique/uniquemessage.c
+@@ -493,7 +493,7 @@ unique_message_data_get_filename (UniqueMessageData *message_data)
+ {
+   g_return_val_if_fail (message_data != NULL, NULL);
+ 
+-  return g_memdup (message_data->data, message_data->length);
++  return g_memdup (message_data->data, message_data->length + 1);
+ }
+ 
+ /**
+--
+cgit v0.9
diff --git a/nixpkgs/pkgs/development/libraries/libunique/3.x.nix b/nixpkgs/pkgs/development/libraries/libunique/3.x.nix
new file mode 100644
index 000000000000..b302e1d0ba03
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libunique/3.x.nix
@@ -0,0 +1,30 @@
+{ stdenv, fetchurl, pkgconfig
+, dbus, dbus-glib, gtk3, gobject-introspection
+, gtk-doc, docbook_xml_dtd_45, docbook_xsl
+, libxslt, libxml2 }:
+
+with stdenv.lib;
+stdenv.mkDerivation rec {
+
+  majorVer = "3.0";
+  minorVer = "2";
+  version = "${majorVer}.${minorVer}";
+  name = "libunique3-${version}";
+  srcName = "libunique-${version}";
+
+  src = fetchurl {
+    url = "http://ftp.gnome.org/pub/GNOME/sources/libunique/${majorVer}/${srcName}.tar.xz";
+    sha256 = "0f70lkw66v9cj72q0iw1s2546r6bwwcd8idcm3621fg2fgh2rw58";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ dbus dbus-glib gtk3 gobject-introspection gtk-doc docbook_xml_dtd_45 docbook_xsl libxslt libxml2 ];
+
+  meta = {
+    homepage = https://wiki.gnome.org/Attic/LibUnique;
+    description = "A library for writing single instance applications";
+    license = licenses.lgpl21;
+    maintainers = [ maintainers.AndersonTorres ];
+    platforms = stdenv.lib.platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libunique/default.nix b/nixpkgs/pkgs/development/libraries/libunique/default.nix
new file mode 100644
index 000000000000..b96fdf5eeddc
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libunique/default.nix
@@ -0,0 +1,36 @@
+{ stdenv, fetchurl, pkgconfig, 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";
+    sha256 = "1fsgvmncd9caw552lyfg8swmsd6bh4ijjsph69bwacwfxwf09j75";
+  };
+
+  NIX_CFLAGS_COMPILE = "-Wno-error=deprecated-declarations";
+
+  # Patches from Gentoo portage
+  patches = [
+    ./1.1.6-compiler-warnings.patch
+    ./1.1.6-fix-test.patch
+    ./1.1.6-G_CONST_RETURN.patch
+    ./1.1.6-include-terminator.patch
+  ] ++ [ ./gcc7-bug.patch ];
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ glib gtk2 dbus-glib ];
+
+  # Don't make deprecated usages hard errors
+  preBuild = ''substituteInPlace unique/dbus/Makefile --replace -Werror ""'';
+
+  doCheck = true;
+
+  meta = {
+    homepage = "https://wiki.gnome.org/Attic/LibUnique";
+    description = "A library for writing single instance applications";
+    license = stdenv.lib.licenses.lgpl21;
+    platforms = stdenv.lib.platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libunique/gcc7-bug.patch b/nixpkgs/pkgs/development/libraries/libunique/gcc7-bug.patch
new file mode 100644
index 000000000000..2b0587510bc0
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libunique/gcc7-bug.patch
@@ -0,0 +1,18 @@
+gcc-7 newly detects this class of bugs.
+In this particular case it's clear that the inention was
+to detect if the string is non-NULL *and* non-empty.
+
+
+diff --git a/unique/uniqueapp.c b/unique/uniqueapp.c
+index b40a86c..66a7226 100644
+--- a/unique/uniqueapp.c
++++ b/unique/uniqueapp.c
+@@ -176,7 +176,7 @@ set_startup_id (UniqueBackend *backend,
+ {
+   gchar *id;
+ 
+-  if (startup_id && startup_id != '\0')
++  if (startup_id && *startup_id != '\0')
+     id = g_strdup (startup_id);
+   else
+     {
diff --git a/nixpkgs/pkgs/development/libraries/libunistring/default.nix b/nixpkgs/pkgs/development/libraries/libunistring/default.nix
new file mode 100644
index 000000000000..e066c0723679
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libunistring/default.nix
@@ -0,0 +1,67 @@
+{ fetchurl, stdenv, libiconv }:
+
+stdenv.mkDerivation rec {
+  name = "libunistring-${version}";
+  version = "0.9.10";
+
+  src = fetchurl {
+    url = "mirror://gnu/libunistring/${name}.tar.gz";
+    sha256 = "02v17za10mxnj095x4pvm80jxyqwk93kailfc2j8xa1r6crmnbm8";
+  };
+
+  outputs = [ "out" "dev" "info" "doc" ];
+
+  propagatedBuildInputs = stdenv.lib.optional (!stdenv.isLinux) libiconv;
+
+  configureFlags = [
+    "--with-libiconv-prefix=${libiconv}"
+  ];
+
+  doCheck = true;
+
+  /* This seems to cause several random failures like these, which I assume
+     is because of bad or missing target dependencies in their build system:
+
+        ./unistdio/test-u16-vasnprintf2.sh: line 16: ./test-u16-vasnprintf1: No such file or directory
+        FAIL unistdio/test-u16-vasnprintf2.sh (exit status: 1)
+
+        FAIL: unistdio/test-u16-vasnprintf3.sh
+        ======================================
+
+        ./unistdio/test-u16-vasnprintf3.sh: line 16: ./test-u16-vasnprintf1: No such file or directory
+        FAIL unistdio/test-u16-vasnprintf3.sh (exit status: 1)
+  */
+  enableParallelBuilding = false;
+
+  meta = {
+    homepage = https://www.gnu.org/software/libunistring/;
+
+    description = "Unicode string library";
+
+    longDescription = ''
+      This library provides functions for manipulating Unicode strings
+      and for manipulating C strings according to the Unicode
+      standard.
+
+      GNU libunistring is for you if your application involves
+      non-trivial text processing, such as upper/lower case
+      conversions, line breaking, operations on words, or more
+      advanced analysis of text.  Text provided by the user can, in
+      general, contain characters of all kinds of scripts.  The text
+      processing functions provided by this library handle all scripts
+      and all languages.
+
+      libunistring is for you if your application already uses the ISO
+      C / POSIX <ctype.h>, <wctype.h> functions and the text it
+      operates on is provided by the user and can be in any language.
+
+      libunistring is also for you if your application uses Unicode
+      strings as internal in-memory representation.
+    '';
+
+    license = stdenv.lib.licenses.lgpl3Plus;
+
+    maintainers = [ ];
+    platforms = stdenv.lib.platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libunity/default.nix b/nixpkgs/pkgs/development/libraries/libunity/default.nix
new file mode 100644
index 000000000000..a0ec3b74cc17
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libunity/default.nix
@@ -0,0 +1,62 @@
+{ stdenv
+, fetchgit
+, pkgconfig
+, glib
+, vala
+, dee
+, gobject-introspection
+, libdbusmenu
+, gtk3
+, intltool
+, python3
+, autoreconfHook
+}:
+
+stdenv.mkDerivation rec {
+  pname = "libunity";
+  version = "unstable-2019-03-19";
+
+  outputs = [ "out" "dev" "py" ];
+
+  src = fetchgit {
+    url = "https://git.launchpad.net/ubuntu/+source/libunity";
+    rev = "import/7.1.4+19.04.20190319-0ubuntu1";
+    sha256 = "15b49v88v74q20a5c0lq867qnlz7fx20xifl6j8ha359r0zkfwzj";
+  };
+
+  nativeBuildInputs = [
+    autoreconfHook
+    gobject-introspection
+    intltool
+    pkgconfig
+    python3
+    vala
+  ];
+
+  buildInputs = [
+    glib
+    gtk3
+  ];
+
+  propagatedBuildInputs = [
+    dee
+    libdbusmenu
+  ];
+
+  preConfigure = ''
+    intltoolize
+  '';
+
+  configureFlags = [
+    "--disable-static"
+    "--with-pygi-overrides-dir=${placeholder ''py''}/${python3.sitePackages}/gi/overrides"
+  ];
+
+  meta = with stdenv.lib; {
+    description = "A library for instrumenting and integrating with all aspects of the Unity shell";
+    homepage = https://launchpad.net/libunity;
+    license = licenses.lgpl3;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ worldofpeace ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libunwind/backtrace-only-with-glibc.patch b/nixpkgs/pkgs/development/libraries/libunwind/backtrace-only-with-glibc.patch
new file mode 100644
index 000000000000..5fcaa72c0c01
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libunwind/backtrace-only-with-glibc.patch
@@ -0,0 +1,45 @@
+From 04437142399662b576bd55a85485c6dcc14d0812 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem at gmail.com>
+Date: Thu, 31 Dec 2015 06:44:07 +0000
+Subject: [PATCH] backtrace: Use only with glibc and uclibc
+
+backtrace API is glibc specific not linux specific
+so make it behave so.
+
+Signed-off-by: Khem Raj <raj.khem at gmail.com>
+---
+Upstream-Status: Pending
+
+ tests/test-coredump-unwind.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/tests/test-coredump-unwind.c b/tests/test-coredump-unwind.c
+index 5254708..8767b42 100644
+--- a/tests/test-coredump-unwind.c
++++ b/tests/test-coredump-unwind.c
+@@ -57,7 +57,9 @@
+ #include <grp.h>
+ 
+ /* For SIGSEGV handler code */
++#ifdef __GLIBC__
+ #include <execinfo.h>
++#endif
+ #include <sys/ucontext.h>
+ 
+ #include <libunwind-coredump.h>
+@@ -238,11 +240,11 @@ void handle_sigsegv(int sig, siginfo_t *info, void *ucontext)
+ 			ip);
+ 
+   {
++#ifdef __GLIBC__
+     /* glibc extension */
+     void *array[50];
+     int size;
+     size = backtrace(array, 50);
+-#ifdef __linux__
+     backtrace_symbols_fd(array, size, 2);
+ #endif
+   }
+-- 
+2.6.4
+
diff --git a/nixpkgs/pkgs/development/libraries/libunwind/default.nix b/nixpkgs/pkgs/development/libraries/libunwind/default.nix
new file mode 100644
index 000000000000..9bea14bd8e85
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libunwind/default.nix
@@ -0,0 +1,37 @@
+{ stdenv, fetchurl, autoreconfHook, xz }:
+
+stdenv.mkDerivation rec {
+  name = "libunwind-${version}";
+  version = "1.3.1";
+
+  src = fetchurl {
+    url = "mirror://savannah/libunwind/${name}.tar.gz";
+    sha256 = "1y0l08k6ak1mqbfj6accf9s5686kljwgsl4vcqpxzk5n74wpm6a3";
+  };
+
+  patches = [ ./backtrace-only-with-glibc.patch ];
+
+  nativeBuildInputs = [ autoreconfHook ];
+
+  outputs = [ "out" "dev" ];
+
+  propagatedBuildInputs = [ xz ];
+
+  postInstall = ''
+    find $out -name \*.la | while read file; do
+      sed -i 's,-llzma,${xz.out}/lib/liblzma.la,' $file
+    done
+  '';
+
+  doCheck = false; # fails
+
+  meta = with stdenv.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 ];
+    platforms = platforms.linux;
+    license = licenses.mit;
+  };
+
+  passthru.supportsHost = !stdenv.hostPlatform.isRiscV;
+}
diff --git a/nixpkgs/pkgs/development/libraries/liburcu/default.nix b/nixpkgs/pkgs/development/libraries/liburcu/default.nix
new file mode 100644
index 000000000000..0cc1b0d08f9d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/liburcu/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchurl, perl }:
+
+stdenv.mkDerivation rec {
+  version = "0.11.0";
+  name = "liburcu-${version}";
+
+  src = fetchurl {
+    url = "https://lttng.org/files/urcu/userspace-rcu-${version}.tar.bz2";
+    sha256 = "1rxk5vbkbmqlsnjnvkjz0pkx2076mqnq6jzblpmz8rk29x66kx8s";
+  };
+
+  checkInputs = [ perl ];
+
+  preCheck = "patchShebangs tests/unit";
+  doCheck = true;
+
+  meta = with stdenv.lib; {
+    description = "Userspace RCU (read-copy-update) library";
+    homepage = https://lttng.org/urcu;
+    license = licenses.lgpl21Plus;
+    platforms = platforms.unix;
+    maintainers = [ maintainers.bjornfor ];
+  };
+
+}
diff --git a/nixpkgs/pkgs/development/libraries/liburing/default.nix b/nixpkgs/pkgs/development/libraries/liburing/default.nix
new file mode 100644
index 000000000000..cce10a761d3f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/liburing/default.nix
@@ -0,0 +1,41 @@
+{ stdenv, fetchgit
+}:
+
+stdenv.mkDerivation rec {
+  name = "liburing-${version}";
+  version = "1.0.0pre137_${builtins.substring 0 7 src.rev}";
+
+  src = fetchgit {
+    url    = "http://git.kernel.dk/liburing";
+    rev    = "91dde5c956b1af491bc6c16ee230daa4b4b66706";
+    sha256 = "0rk1ikrn3s6sp3gx7kc4y6msx7yncr3845m67vhk8lxvhd90sgza";
+  };
+
+  separateDebugInfo = true;
+  enableParallelBuilding = true;
+
+  outputs = [ "out" "lib" "dev" "man" ];
+
+  configurePhase = ''
+    ./configure \
+      --prefix=$out \
+      --includedir=$dev/include \
+      --libdir=$lib/lib \
+      --mandir=$man/share/man \
+  '';
+
+  # Copy the examples into $out.
+  postInstall = ''
+    mkdir -p $out/bin
+    cp ./examples/io_uring-cp examples/io_uring-test $out/bin
+    cp ./examples/link-cp $out/bin/io_uring-link-cp
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Userspace library for the Linux io_uring API";
+    homepage    = http://git.kernel.dk/cgit/liburing/;
+    license     = licenses.lgpl21;
+    platforms   = platforms.linux;
+    maintainers = with maintainers; [ thoughtpolice ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libusb/default.nix b/nixpkgs/pkgs/development/libraries/libusb/default.nix
new file mode 100644
index 000000000000..adf354c45f2e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libusb/default.nix
@@ -0,0 +1,30 @@
+{stdenv, fetchurl, pkgconfig, libusb1}:
+
+stdenv.mkDerivation {
+  name = "libusb-compat-0.1.5";
+
+  outputs = [ "out" "dev" ]; # get rid of propagating systemd closure
+  outputBin = "dev";
+
+  nativeBuildInputs = [ pkgconfig ];
+  propagatedBuildInputs = [ libusb1 ];
+
+  src = fetchurl {
+    url = mirror://sourceforge/libusb/libusb-compat-0.1.5.tar.bz2;
+    sha256 = "0nn5icrfm9lkhzw1xjvaks9bq3w6mjg86ggv3fn7kgi4nfvg8kj0";
+  };
+
+  patches = stdenv.lib.optional stdenv.hostPlatform.isMusl ./fix-headers.patch;
+
+  meta = with stdenv.lib; {
+    homepage = "https://libusb.info/";
+    repositories.git = "https://github.com/libusb/libusb-compat-0.1";
+    description = "cross-platform user-mode USB device library";
+    longDescription = ''
+      libusb is a cross-platform user-mode library that provides access to USB devices.
+      The current API is of 1.0 version (libusb-1.0 API), this library is a wrapper exposing the legacy API.
+    '';
+    license = licenses.lgpl2Plus;
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libusb/fix-headers.patch b/nixpkgs/pkgs/development/libraries/libusb/fix-headers.patch
new file mode 100644
index 000000000000..ea9cbc34978e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libusb/fix-headers.patch
@@ -0,0 +1,10 @@
+--- libusb-compat-0.1.5.orig/libusb/usb.h
++++ libusb-compat-0.1.5/libusb/usb.h
+@@ -25,6 +25,7 @@
+ #ifndef __USB_H__
+ #define __USB_H__
+ 
++#include <sys/types.h>
+ #include <unistd.h>
+ #include <stdlib.h>
+ #include <limits.h>
diff --git a/nixpkgs/pkgs/development/libraries/libusb1/default.nix b/nixpkgs/pkgs/development/libraries/libusb1/default.nix
new file mode 100644
index 000000000000..0620163bb320
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libusb1/default.nix
@@ -0,0 +1,39 @@
+{ stdenv, fetchurl, pkgconfig, systemd ? null, libobjc, IOKit, withStatic ? false }:
+
+stdenv.mkDerivation (rec {
+  name = "libusb-1.0.22";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/libusb/${name}.tar.bz2";
+    sha256 = "0mw1a5ss4alg37m6bd4k44v35xwrcwp5qm4s686q1nsgkbavkbkm";
+  };
+
+  outputs = [ "out" "dev" ]; # get rid of propagating systemd closure
+
+  nativeBuildInputs = [ pkgconfig ];
+  propagatedBuildInputs =
+    stdenv.lib.optional stdenv.isLinux systemd ++
+    stdenv.lib.optionals stdenv.isDarwin [ libobjc IOKit ];
+
+  NIX_LDFLAGS = stdenv.lib.optionalString stdenv.isLinux "-lgcc_s";
+
+  preFixup = stdenv.lib.optionalString stdenv.isLinux ''
+    sed 's,-ludev,-L${systemd.lib}/lib -ludev,' -i $out/lib/libusb-1.0.la
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = "https://libusb.info/";
+    repositories.git = "https://github.com/libusb/libusb";
+    description = "cross-platform user-mode USB device library";
+    longDescription = ''
+      libusb is a cross-platform user-mode library that provides access to USB devices.
+    '';
+    platforms = platforms.all;
+    license = licenses.lgpl21Plus;
+    maintainers = [ ];
+  };
+} // stdenv.lib.optionalAttrs withStatic {
+  # Carefully added here to avoid a mass rebuild.
+  # Inline this the next time this package changes.
+  dontDisableStatic = withStatic;
+})
diff --git a/nixpkgs/pkgs/development/libraries/libusbmuxd/default.nix b/nixpkgs/pkgs/development/libraries/libusbmuxd/default.nix
new file mode 100644
index 000000000000..d9e008af9770
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libusbmuxd/default.nix
@@ -0,0 +1,26 @@
+{ stdenv, fetchFromGitHub, autoreconfHook, pkgconfig, libplist }:
+
+stdenv.mkDerivation rec {
+  pname = "libusbmuxd";
+  version = "2019-03-23";
+
+  name = "${pname}-${version}";
+
+  src = fetchFromGitHub {
+    owner = "libimobiledevice";
+    repo = pname;
+    rev = "873252dc8b4e469c7dc692064ac616104fca5f65";
+    sha256 = "0qx3q0n1f2ajfm3vnairikayzln6iyb2y0i7sqfl8mj45ahl6wyj";
+  };
+
+  nativeBuildInputs = [ autoreconfHook pkgconfig ];
+  buildInputs = [ libplist ];
+
+  meta = with stdenv.lib; {
+    description = "A client library to multiplex connections from and to iOS devices";
+    homepage    = https://github.com/libimobiledevice/libusbmuxd;
+    license     = licenses.lgpl21Plus;
+    platforms   = platforms.linux;
+    maintainers = with maintainers; [ infinisil ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libutempter/default.nix b/nixpkgs/pkgs/development/libraries/libutempter/default.nix
new file mode 100644
index 000000000000..f9703e3c5932
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libutempter/default.nix
@@ -0,0 +1,39 @@
+{ stdenv, fetchurl, lib, glib }:
+
+with lib;
+
+stdenv.mkDerivation rec {
+  name = "libutempter-${version}";
+  version = "1.1.6";
+
+  src = fetchurl {
+    url = "http://archive.ubuntu.com/ubuntu/pool/main/libu/libutempter/libutempter_${version}.orig.tar.bz2";
+    sha256 = "15y3xbgznjxnfmix4xg3bwmqdvghdw7slbhazb0ybmyf65gmd65q";
+  };
+
+  buildInputs = [ glib ];
+
+  patches = [ ./exec_path.patch ];
+
+  prePatch = ''
+    substituteInPlace Makefile --replace 2711 0711
+  '';
+
+  makeFlags = [
+    "libdir=\${out}/lib"
+    "libexecdir=\${out}/lib"
+    "includedir=\${out}/include"
+    "mandir=\${out}/share/man"
+  ];
+
+  meta = {
+    description = "Interface for terminal emulators such as screen and xterm to record user sessions to utmp and wtmp files";
+    longDescription = ''
+      The bundled utempter binary must be able to run as a user belonging to group utmp.
+      On NixOS systems, this can be achieved by creating a setguid wrapper.
+    '';
+    license = licenses.lgpl21Plus;
+    platforms = platforms.linux;
+    maintainers = [ maintainers.msteen ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libutempter/exec_path.patch b/nixpkgs/pkgs/development/libraries/libutempter/exec_path.patch
new file mode 100644
index 000000000000..bd5f56611ef9
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libutempter/exec_path.patch
@@ -0,0 +1,25 @@
+diff -ur libutempter-1.1.6/iface.c libutempter-1.1.6.patched/iface.c
+--- libutempter-1.1.6/iface.c	2010-11-04 18:14:53.000000000 +0100
++++ libutempter-1.1.6.patched/iface.c	2018-06-06 15:09:11.417755549 +0200
+@@ -60,9 +60,9 @@
+ 		_exit(EXIT_FAILURE);
+ 	}
+ 
+-	execv(path, argv);
++	execvp(path, argv);
+ #ifdef	UTEMPTER_DEBUG
+-	fprintf(stderr, "libutempter: execv: %s\n", strerror(errno));
++	fprintf(stderr, "libutempter: execvp: %s\n", strerror(errno));
+ #endif
+ 
+ 	while (EACCES == errno)
+@@ -79,7 +79,7 @@
+ 		if (setgid(sgid))
+ 			break;
+ 
+-		(void) execv(path, argv);
++		(void) execvp(path, argv);
+ 		break;
+ 	}
+ 
+Only in libutempter-1.1.6.patched: result
diff --git a/nixpkgs/pkgs/development/libraries/libuv/default.nix b/nixpkgs/pkgs/development/libraries/libuv/default.nix
new file mode 100644
index 000000000000..e725439a3f1a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libuv/default.nix
@@ -0,0 +1,75 @@
+{ stdenv, lib, fetchpatch, fetchFromGitHub, autoconf, automake, libtool, pkgconfig, ApplicationServices, CoreServices }:
+
+stdenv.mkDerivation rec {
+  version = "1.29.1";
+  pname = "libuv";
+
+  src = fetchFromGitHub {
+    owner = pname;
+    repo = pname;
+    rev = "v${version}";
+    sha256 = "0scnircr6khgh7l3bw9zyfzdgx2c11mpfhd9d8qlw47arrvqg7l8";
+  };
+
+  postPatch = let
+    toDisable = [
+      "getnameinfo_basic" "udp_send_hang_loop" # probably network-dependent
+      "spawn_setuid_fails" "spawn_setgid_fails" "fs_chown" # user namespaces
+      "getaddrinfo_fail" "getaddrinfo_fail_sync"
+      "threadpool_multiple_event_loops" # times out on slow machines
+      "get_passwd" # passed on NixOS but failed on other Linuxes
+      "tcp_writealot" # times out sometimes
+    ] ++ stdenv.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.
+        "process_title" "emfile" "poll_duplex" "poll_unidirectional"
+        "ipc_listen_before_write" "ipc_listen_after_write" "ipc_tcp_connection"
+        "tcp_alloc_cb_fail" "tcp_ping_pong" "tcp_ref3" "tcp_ref4"
+        "tcp_bind6_error_inval" "tcp_bind6_error_addrinuse" "tcp_read_stop"
+        "tcp_unexpected_read" "tcp_write_to_half_open_connection"
+        "tcp_oob" "tcp_close_accept" "tcp_create_early_accept"
+        "tcp_create_early" "tcp_close" "tcp_bind_error_inval"
+        "tcp_bind_error_addrinuse" "tcp_shutdown_after_write"
+        "tcp_open" "tcp_write_queue_order" "tcp_try_write" "tcp_writealot"
+        "multiple_listen" "delayed_accept"
+        "shutdown_close_tcp" "shutdown_eof" "shutdown_twice" "callback_stack"
+        "tty_pty" "condvar_5"
+        # Tests that fail when sandboxing is enabled.
+        "fs_event_close_in_callback" "fs_event_watch_dir"
+        "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 [
+      # I observe this test failing with some regularity on ARMv7:
+      # https://github.com/libuv/libuv/issues/1871
+      "shutdown_close_pipe"
+    ];
+    tdRegexp = lib.concatStringsSep "\\|" toDisable;
+    in lib.optionalString doCheck ''
+      sed '/${tdRegexp}/d' -i test/test-list.h
+    '';
+
+  nativeBuildInputs = [ automake autoconf libtool pkgconfig ];
+  buildInputs = stdenv.lib.optionals stdenv.isDarwin [ ApplicationServices CoreServices ];
+
+  preConfigure = ''
+    LIBTOOLIZE=libtoolize ./autogen.sh
+  '';
+
+  enableParallelBuilding = true;
+
+  doCheck = true;
+
+  # Some of the tests use localhost networking.
+  __darwinAllowLocalNetworking = true;
+
+  meta = with lib; {
+    description = "A multi-platform support library with a focus on asynchronous I/O";
+    homepage    = https://github.com/libuv/libuv;
+    maintainers = with maintainers; [ cstrahan ];
+    platforms   = with platforms; linux ++ darwin;
+    license     = with licenses; [ mit isc bsd2 bsd3 cc-by-40 ];
+  };
+
+}
diff --git a/nixpkgs/pkgs/development/libraries/libva-utils/default.nix b/nixpkgs/pkgs/development/libraries/libva-utils/default.nix
new file mode 100644
index 000000000000..e41ca206c510
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libva-utils/default.nix
@@ -0,0 +1,35 @@
+{ stdenv, fetchFromGitHub, pkgconfig
+, libdrm, libva, libX11, libXext, libXfixes, wayland, meson, ninja
+}:
+
+stdenv.mkDerivation rec {
+  name = "libva-utils-${version}";
+  inherit (libva) version;
+
+  src = fetchFromGitHub {
+    owner  = "01org";
+    repo   = "libva-utils";
+    rev    = version;
+    sha256 = "1yk9bg1wg4nqva3l01s6bghcvc3hb02gp62p1sy5qk0r9mn5kpik";
+  };
+
+  nativeBuildInputs = [ meson ninja pkgconfig ];
+
+  buildInputs = [ libdrm libva libX11 libXext libXfixes wayland ];
+
+  mesonFlags = [
+    "-Ddrm=true"
+    "-Dx11=true"
+    "-Dwayland=true"
+  ];
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    description = "VAAPI tools: Video Acceleration API";
+    homepage = http://www.freedesktop.org/wiki/Software/vaapi;
+    license = licenses.mit;
+    maintainers = with maintainers; [ garbas ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libva/1.0.0.nix b/nixpkgs/pkgs/development/libraries/libva/1.0.0.nix
new file mode 100644
index 000000000000..097ac0e3e98e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libva/1.0.0.nix
@@ -0,0 +1,37 @@
+{ stdenv, lib, fetchurl, libX11, pkgconfig, libXext, libdrm, libXfixes, wayland, libffi
+, libGL, libGL_driver
+, minimal ? false, libva1-minimal
+}:
+
+stdenv.mkDerivation rec {
+  name = "libva-${version}";
+  version = "1.7.3";
+
+  src = fetchurl {
+    url = "https://www.freedesktop.org/software/vaapi/releases/libva/${name}.tar.bz2";
+    sha256 = "1ndrf136rlw03xag7j1xpmf9015d1h0dpnv6v587jnh6k2a17g12";
+  };
+
+  outputs = [ "bin" "dev" "out" ];
+
+  nativeBuildInputs = [ pkgconfig ];
+
+  buildInputs = [ libdrm ]
+    ++ lib.optionals (!minimal) [ libva1-minimal libX11 libXext libXfixes wayland libffi libGL ];
+  # TODO: share libs between minimal and !minimal - perhaps just symlink them
+
+  configureFlags =
+    # Add FHS paths for non-NixOS applications.
+    [ "--with-drivers-path=${libGL_driver.driverLink}/lib/dri:/usr/lib/dri:/usr/lib32/dri" ] ++
+    lib.optionals (!minimal) [ "--enable-glx" ];
+
+  installFlags = [ "dummy_drv_video_ladir=$(out)/lib/dri" ];
+
+  meta = with stdenv.lib; {
+    homepage = http://www.freedesktop.org/wiki/Software/vaapi;
+    license = licenses.mit;
+    description = "VAAPI library: Video Acceleration API";
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ garbas ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libva/default.nix b/nixpkgs/pkgs/development/libraries/libva/default.nix
new file mode 100644
index 000000000000..752d56a344e4
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libva/default.nix
@@ -0,0 +1,45 @@
+{ stdenv, lib, fetchFromGitHub, autoreconfHook, pkgconfig
+, libXext, libdrm, libXfixes, wayland, libffi, libX11
+, libGL, libGL_driver
+, minimal ? false, libva-minimal
+}:
+
+stdenv.mkDerivation rec {
+  name = "libva-${lib.optionalString minimal "minimal-"}${version}";
+  version = "2.4.1";
+
+  # update libva-utils and vaapiIntel as well
+  src = fetchFromGitHub {
+    owner  = "01org";
+    repo   = "libva";
+    rev    = version;
+    sha256 = "06kqff05jhd87yi53gyc2qivgg4sbf19qyznm9s4dyz92k04cl5c";
+  };
+
+  outputs = [ "dev" "out" ];
+
+  nativeBuildInputs = [ autoreconfHook pkgconfig ];
+
+  buildInputs = [ libdrm ]
+    ++ lib.optionals (!minimal) [ libva-minimal libX11 libXext libXfixes wayland libffi libGL ];
+  # TODO: share libs between minimal and !minimal - perhaps just symlink them
+
+  enableParallelBuilding = true;
+
+  configureFlags = [
+    # Add FHS paths for non-NixOS applications.
+    "--with-drivers-path=${libGL_driver.driverLink}/lib/dri:/usr/lib/dri:/usr/lib32/dri"
+  ] ++ lib.optionals (!minimal) [ "--enable-glx" ];
+
+  installFlags = [
+    "dummy_drv_video_ladir=$(out)/lib/dri"
+  ];
+
+  meta = with stdenv.lib; {
+    description = "VAAPI library: Video Acceleration API";
+    homepage = http://www.freedesktop.org/wiki/Software/vaapi;
+    license = licenses.mit;
+    maintainers = with maintainers; [ garbas ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libvdpau-va-gl/default.nix b/nixpkgs/pkgs/development/libraries/libvdpau-va-gl/default.nix
new file mode 100644
index 000000000000..50b995a03568
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libvdpau-va-gl/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchFromGitHub, cmake, pkgconfig, libX11, libpthreadstubs, libXau, libXdmcp
+, libXext, libvdpau, glib, libva, ffmpeg, libGLU }:
+
+stdenv.mkDerivation rec {
+  name = "libvdpau-va-gl-${version}";
+  version = "0.4.2";
+
+  src = fetchFromGitHub {
+    owner = "i-rinat";
+    repo = "libvdpau-va-gl";
+    rev = "v${version}";
+    sha256 = "0asndybfv8xb0fx73sjjw5kydqrahqkm6n04lh589pbf18s5qlld";
+  };
+
+  nativeBuildInputs = [ cmake pkgconfig ];
+  buildInputs = [ libX11 libpthreadstubs libXau libXdmcp libXext libvdpau glib libva ffmpeg libGLU ];
+
+  doCheck = false; # fails. needs DRI access
+
+  meta = with stdenv.lib; {
+    homepage = https://github.com/i-rinat/libvdpau-va-gl;
+    description = "VDPAU driver with OpenGL/VAAPI backend";
+    license = licenses.lgpl3;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ abbradar ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libvdpau/default.nix b/nixpkgs/pkgs/development/libraries/libvdpau/default.nix
new file mode 100644
index 000000000000..a61b3c3f2ac9
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libvdpau/default.nix
@@ -0,0 +1,33 @@
+{ stdenv, fetchurl, pkgconfig, xorg, libGL_driver }:
+
+stdenv.mkDerivation rec {
+  name = "libvdpau-${version}";
+  version = "1.2";
+
+  src = fetchurl {
+    url = "https://gitlab.freedesktop.org/vdpau/libvdpau/uploads/14b620084c027d546fa0b3f083b800c6/${name}.tar.bz2";
+    sha256 = "6a499b186f524e1c16b4f5b57a6a2de70dfceb25c4ee546515f26073cd33fa06";
+  };
+
+  outputs = [ "out" "dev" ];
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = with xorg; [ xorgproto libXext ];
+
+  propagatedBuildInputs = [ xorg.libX11 ];
+
+  configureFlags = stdenv.lib.optional stdenv.isLinux
+    "--with-module-dir=${libGL_driver.driverLink}/lib/vdpau";
+
+  NIX_LDFLAGS = if stdenv.isDarwin then "-lX11" else null;
+
+  installFlags = [ "moduledir=$(out)/lib/vdpau" ];
+
+  meta = with stdenv.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
+    platforms = platforms.unix;
+    maintainers = [ maintainers.vcunat ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libversion/default.nix b/nixpkgs/pkgs/development/libraries/libversion/default.nix
new file mode 100644
index 000000000000..0ace54582ebc
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libversion/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchFromGitHub, cmake }:
+
+let
+  version = "2.8.1";
+in
+stdenv.mkDerivation {
+  name = "libversion-${version}";
+
+  src = fetchFromGitHub {
+    owner = "repology";
+    repo = "libversion";
+    rev = version;
+    sha256 = "0h0yfcgxll09dckzjb1im3yf54cjkpsflr7r4kwz1jcr3fxq41fz";
+  };
+
+  nativeBuildInputs = [ cmake ];
+
+  doCheck = true;
+  checkTarget = "test";
+
+  meta = with stdenv.lib; {
+    description = "Advanced version string comparison library";
+    homepage = https://github.com/repology/libversion;
+    license = with licenses; [ mit ];
+    maintainers = with maintainers; [ ryantm ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libviper/default.nix b/nixpkgs/pkgs/development/libraries/libviper/default.nix
new file mode 100644
index 000000000000..6ca3d997e659
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libviper/default.nix
@@ -0,0 +1,28 @@
+{stdenv, fetchurl, pkgconfig, glib, ncurses, gpm}:
+stdenv.mkDerivation rec {
+  name = "libviper-1.4.6";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/libviper/${name}.tar.gz";
+    sha256 = "1jvm7wdgw6ixyhl0pcfr9lnr9g6sg6whyrs9ihjiz0agvqrgvxwc";
+  };
+
+  patchPhase = ''
+    sed -i -e s@/usr/local@$out@ -e /ldconfig/d -e '/cd vdk/d' Makefile
+  '';
+
+  preInstall = ''
+    mkdir -p $out/include
+    mkdir -p $out/lib
+  '';
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ glib ncurses gpm];
+
+  meta = with stdenv.lib; {
+    homepage = http://libviper.sourceforge.net/;
+    description = "Simple window creation and management facilities for the console";
+    license = licenses.gpl2Plus;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libvirt-glib/default.nix b/nixpkgs/pkgs/development/libraries/libvirt-glib/default.nix
new file mode 100644
index 000000000000..74c3d24560cd
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libvirt-glib/default.nix
@@ -0,0 +1,42 @@
+{ stdenv, fetchurl, pkgconfig, libvirt, glib, libxml2, intltool, libtool, yajl
+, nettle, libgcrypt, pythonPackages, gobject-introspection, libcap_ng, numactl
+, xen, libapparmor, vala
+}:
+
+let
+  inherit (pythonPackages) python pygobject2;
+in stdenv.mkDerivation rec {
+  name = "libvirt-glib-2.0.0";
+
+  outputs = [ "out" "dev" ];
+
+  src = fetchurl {
+    url = "https://libvirt.org/sources/glib/${name}.tar.gz";
+    sha256 = "0six9ckmvlwwyavyjkgc262qkpvfqgi8rjij7cyk00bmqq8c9s4l";
+  };
+
+  nativeBuildInputs = [ pkgconfig vala ];
+  buildInputs = [
+    libvirt glib libxml2 intltool libtool yajl nettle libgcrypt
+    python pygobject2 gobject-introspection libcap_ng numactl libapparmor
+  ] ++ stdenv.lib.optionals stdenv.isx86_64 [
+    xen
+  ];
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    description = "Library for working with virtual machines";
+    longDescription = ''
+      libvirt-glib wraps libvirt to provide a high-level object-oriented API better
+      suited for glib-based applications, via three libraries:
+
+      - libvirt-glib    - GLib main loop integration & misc helper APIs
+      - libvirt-gconfig - GObjects for manipulating libvirt XML documents
+      - libvirt-gobject - GObjects for managing libvirt objects
+    '';
+    homepage = http://libvirt.org/;
+    license = licenses.lgpl2Plus;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libvirt/default.nix b/nixpkgs/pkgs/development/libraries/libvirt/default.nix
new file mode 100644
index 000000000000..85b8b128d208
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libvirt/default.nix
@@ -0,0 +1,136 @@
+{ stdenv, fetchurl, fetchgit
+, pkgconfig, makeWrapper, libtool, autoconf, automake
+, coreutils, libxml2, gnutls, perl, python2, attr
+, iproute, iptables, readline, lvm2, utillinux, systemd, libpciaccess, gettext
+, libtasn1, ebtables, libgcrypt, yajl, pmutils, libcap_ng, libapparmor
+, dnsmasq, libnl, libpcap, libxslt, xhtml1, numad, numactl, perlPackages
+, curl, libiconv, gmp, zfs, parted, bridge-utils, dmidecode
+, enableXen ? false, xen ? null
+, enableIscsi ? false, openiscsi
+, enableCeph ? false, ceph
+}:
+
+with stdenv.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
+  buildFromTarball = stdenv.isDarwin;
+in stdenv.mkDerivation rec {
+  name = "libvirt-${version}";
+  version = "4.10.0";
+
+  src =
+    if buildFromTarball then
+      fetchurl {
+        url = "http://libvirt.org/sources/${name}.tar.xz";
+        sha256 = "0v17zzyyb25nn9l18v5244myg7590dp6ppwgi8xysipifc0q77bz";
+      }
+    else
+      fetchgit {
+        url = git://libvirt.org/libvirt.git;
+        rev = "v${version}";
+        sha256 = "0dlpv3v6jpbmgvhpn29ryp0w2a1xny8ciqid8hnlf3klahz9kwz9";
+        fetchSubmodules = true;
+      };
+
+  nativeBuildInputs = [ makeWrapper pkgconfig ];
+  buildInputs = [
+    libxml2 gnutls perl python2 readline gettext libtasn1 libgcrypt yajl
+    libxslt xhtml1 perlPackages.XMLXPath curl libpcap
+  ] ++ optionals (!buildFromTarball) [
+    libtool autoconf automake
+  ] ++ optionals stdenv.isLinux [
+    libpciaccess lvm2 utillinux systemd libnl numad zfs
+    libapparmor libcap_ng numactl attr parted
+  ] ++ optionals (enableXen && stdenv.isLinux && stdenv.isx86_64) [
+    xen
+  ] ++ optionals enableIscsi [
+    openiscsi
+  ] ++ optionals enableCeph [
+    ceph
+  ] ++ optionals stdenv.isDarwin [
+    libiconv gmp
+  ];
+
+  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
+
+    # 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
+  '';
+
+  configureFlags = [
+    "--localstatedir=/var"
+    "--sysconfdir=/var/lib"
+    "--with-libpcap"
+    "--with-qemu"
+    "--with-vmware"
+    "--with-vbox"
+    "--with-test"
+    "--with-esx"
+    "--with-remote"
+  ] ++ optionals stdenv.isLinux [
+    "--with-attr"
+    "--with-apparmor"
+    "--with-secdriver-apparmor"
+    "--with-numad"
+    "--with-macvtap"
+    "--with-virtualport"
+    "--with-init-script=systemd+redhat"
+    "--with-storage-disk"
+  ] ++ optionals (stdenv.isLinux && zfs != null) [
+    "--with-storage-zfs"
+  ] ++ optionals enableIscsi [
+    "--with-storage-iscsi"
+  ] ++ optionals enableCeph [
+    "--with-storage-rbd"
+  ] ++ optionals stdenv.isDarwin [
+    "--with-init-script=none"
+  ];
+
+  installFlags = [
+    "localstatedir=$(TMPDIR)/var"
+    "sysconfdir=$(out)/var/lib"
+  ];
+
+
+  postInstall = let
+    binPath = [ iptables iproute pmutils numad numactl bridge-utils dmidecode dnsmasq ebtables ] ++ optionals enableIscsi [ openiscsi ];
+  in ''
+    substituteInPlace $out/libexec/libvirt-guests.sh \
+      --replace 'ON_SHUTDOWN=suspend' 'ON_SHUTDOWN=''${ON_SHUTDOWN:-suspend}' \
+      --replace "$out/bin"            '${gettext}/bin' \
+      --replace 'lock/subsys'         'lock' \
+      --replace 'gettext.sh'          'gettext.sh
+  # Added in nixpkgs:
+  gettext() { "${gettext}/bin/gettext" "$@"; }
+  '
+  '' + optionalString stdenv.isLinux ''
+    substituteInPlace $out/lib/systemd/system/libvirtd.service --replace /bin/kill ${coreutils}/bin/kill
+    rm $out/lib/systemd/system/{virtlockd,virtlogd}.*
+    wrapProgram $out/sbin/libvirtd \
+      --prefix PATH : /run/libvirt/nix-emulators:${makeBinPath binPath}
+  '';
+
+  enableParallelBuilding = true;
+
+  NIX_CFLAGS_COMPILE = "-fno-stack-protector";
+
+  meta = {
+    homepage = http://libvirt.org/;
+    repositories.git = git://libvirt.org/libvirt.git;
+    description = ''
+      A toolkit to interact with the virtualization capabilities of recent
+      versions of Linux (and other OSes)
+    '';
+    license = licenses.lgpl2Plus;
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ fpletz ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libvisio/default.nix b/nixpkgs/pkgs/development/libraries/libvisio/default.nix
new file mode 100644
index 000000000000..a09e2cf2f72a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libvisio/default.nix
@@ -0,0 +1,31 @@
+{ stdenv, fetchurl, boost, libwpd, libwpg, pkgconfig, zlib, gperf
+, librevenge, libxml2, icu, perl, cppunit, doxygen
+}:
+
+stdenv.mkDerivation rec {
+  name = "libvisio-${version}";
+  version = "0.1.6";
+
+  outputs = [ "out" "bin" "dev" "doc" ];
+
+  src = fetchurl {
+    url = "https://dev-www.libreoffice.org/src/libvisio/${name}.tar.xz";
+    sha256 = "1yahpfl13qk6178irv8jn5ppxdn7isafqisyqsdw0lqxcz9h447y";
+  };
+
+  nativeBuildInputs = [ pkgconfig cppunit doxygen ];
+  buildInputs = [ boost libwpd libwpg zlib gperf librevenge libxml2 icu perl ];
+
+  configureFlags = [
+    "--disable-werror"
+  ];
+
+  doCheck = true;
+
+  meta = with stdenv.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;
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libvisual/default.nix b/nixpkgs/pkgs/development/libraries/libvisual/default.nix
new file mode 100644
index 000000000000..2a53a1d0e7c4
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libvisual/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, fetchurl, pkgconfig, glib }:
+
+stdenv.mkDerivation rec {
+  name = "libvisual-0.4.0";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/libvisual/${name}.tar.gz";
+    sha256 = "1my1ipd5k1ixag96kwgf07bgxkjlicy9w22jfxb2kq95f6wgsk8b";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ glib ];
+
+  hardeningDisable = [ "format" ];
+
+  meta = {
+    description = "An abstraction library for audio visualisations";
+    homepage = https://sourceforge.net/projects/libvisual/;
+    license = stdenv.lib.licenses.lgpl21Plus;
+    platforms = stdenv.lib.platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libvmi/default.nix b/nixpkgs/pkgs/development/libraries/libvmi/default.nix
new file mode 100644
index 000000000000..44b2a81b2d3c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libvmi/default.nix
@@ -0,0 +1,51 @@
+{ stdenv,
+  fetchFromGitHub,
+  autoreconfHook,
+  bison,
+  flex,
+  glib,
+  pkgconfig,
+  json_c,
+  xen,
+  libvirt,
+  xenSupport ? true }:
+
+with stdenv.lib;
+
+stdenv.mkDerivation rec {
+  name = "libvmi-${version}";
+  version = "0.12.0";
+  libVersion = "0.0.12";
+
+  src = fetchFromGitHub {
+    owner = "libvmi";
+    repo = "libvmi";
+    rev = "v${version}";
+    sha256 = "0wbi2nasb1gbci6cq23g6kq7i10rwi1y7r44rl03icr5prqjpdyv";
+  };
+
+  buildInputs = [ glib libvirt json_c ] ++ (optional xenSupport xen);
+  nativeBuildInputs = [ autoreconfHook bison flex pkgconfig ];
+
+  configureFlags = optional (!xenSupport) "--disable-xen";
+
+  # libvmi uses dlopen() for the xen libraries, however autoPatchelfHook doesn't work here
+  postFixup = optionalString xenSupport ''
+    libvmi="$out/lib/libvmi.so.${libVersion}"
+    oldrpath=$(patchelf --print-rpath "$libvmi")
+    patchelf --set-rpath "$oldrpath:${makeLibraryPath [ xen ]}" "$libvmi"
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = "http://libvmi.com/";
+    description = "A C library for virtual machine introspection";
+    longDescription = ''
+      LibVMI is a C library with Python bindings that makes it easy to monitor the low-level
+      details of a running virtual machine by viewing its memory, trapping on hardware events,
+      and accessing the vCPU registers.
+    '';
+    license = with licenses; [ gpl3 lgpl3 ];
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ lschuermann ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libvncserver/default.nix b/nixpkgs/pkgs/development/libraries/libvncserver/default.nix
new file mode 100644
index 000000000000..0a7819743e03
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libvncserver/default.nix
@@ -0,0 +1,43 @@
+{stdenv, fetchurl, fetchpatch,
+ libtool, libjpeg, openssl, zlib, libgcrypt, autoreconfHook, pkgconfig, libpng,
+ systemd
+}:
+
+let
+  s = # Generated upstream information
+  rec {
+    baseName="libvncserver";
+    version="0.9.11";
+    name="${baseName}-${version}";
+    url="https://github.com/LibVNC/libvncserver/archive/LibVNCServer-${version}.tar.gz";
+    sha256="15189n09r1pg2nqrpgxqrcvad89cdcrca9gx6qhm6akjf81n6g8r";
+  };
+in
+stdenv.mkDerivation {
+  inherit (s) name version;
+  src = fetchurl {
+    inherit (s) url sha256;
+  };
+  patches = [
+    # CVE-2018-7225. Remove with the next release
+    (fetchpatch {
+      url = https://salsa.debian.org/debian/libvncserver/raw/master/debian/patches/CVE-2018-7225.patch;
+      sha256 = "1hj1lzxsrdmzzl061vg0ncdpvfmvvkrpk8q12mp70qvszcqa7ja3";
+    })
+  ];
+  preConfigure = ''
+    sed -e 's@/usr/include/linux@${stdenv.cc.libc}/include/linux@g' -i configure
+  '';
+  nativeBuildInputs = [ pkgconfig autoreconfHook ];
+  buildInputs = [
+    libtool libjpeg openssl libgcrypt libpng
+  ] ++ stdenv.lib.optional stdenv.isLinux systemd;
+  propagatedBuildInputs = [ zlib ];
+  meta = {
+    inherit (s) version;
+    description =  "VNC server library";
+    license = stdenv.lib.licenses.gpl2Plus ;
+    maintainers = [stdenv.lib.maintainers.raskin];
+    platforms = stdenv.lib.platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libvorbis/default.nix b/nixpkgs/pkgs/development/libraries/libvorbis/default.nix
new file mode 100644
index 000000000000..5457b1075a3e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libvorbis/default.nix
@@ -0,0 +1,37 @@
+{ stdenv, fetchurl, libogg, pkgconfig, fetchpatch }:
+
+stdenv.mkDerivation rec {
+  name = "libvorbis-1.3.6";
+
+  src = fetchurl {
+    url = "http://downloads.xiph.org/releases/vorbis/${name}.tar.xz";
+    sha256 = "05dlzjkdpv46zb837wysxqyn8l636x3dw8v8ymlrwz2fg1dbn05g";
+  };
+
+  outputs = [ "out" "dev" "doc" ];
+
+  patches = [
+    (fetchpatch {
+      url = "https://gitlab.xiph.org/xiph/vorbis/uploads/a68cf70fa10c8081a633f77b5c6576b7/0001-CVE-2017-14160-make-sure-we-don-t-overflow.patch";
+      sha256 = "0v21p59cb3z77ch1v6q5dcrd733h91f3m8ifnd7kkkr8gzn17d5x";
+      name = "CVE-2017-14160";
+    })
+    (fetchpatch {
+      url = "https://gitlab.xiph.org/xiph/vorbis/commit/112d3bd0aaa.diff";
+      sha256 = "1k77y3q36npy8mkkz40f6cb46l2ldrwyrd191m29s8rnbhnafdf7";
+      name = "CVE-2018-10392.patch";
+    })
+  ];
+
+  nativeBuildInputs = [ pkgconfig ];
+  propagatedBuildInputs = [ libogg ];
+
+  doCheck = true;
+
+  meta = with stdenv.lib; {
+    homepage = https://xiph.org/vorbis/;
+    license = licenses.bsd3;
+    maintainers = [ maintainers.ehmry ];
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libvpx/default.nix b/nixpkgs/pkgs/development/libraries/libvpx/default.nix
new file mode 100644
index 000000000000..cd0cc9798fa0
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libvpx/default.nix
@@ -0,0 +1,175 @@
+{ stdenv, fetchFromGitHub, perl, yasm
+, vp8DecoderSupport ? true # VP8 decoder
+, vp8EncoderSupport ? true # VP8 encoder
+, vp9DecoderSupport ? true # VP9 decoder
+, vp9EncoderSupport ? true # VP9 encoder
+, extraWarningsSupport ? false # emit non-fatal warnings
+, werrorSupport ? false # treat warnings as errors (not available with all compilers)
+, debugSupport ? false # debug mode
+, gprofSupport ? false # gprof profiling instrumentation
+, gcovSupport ? false # gcov coverage instrumentation
+, sizeLimitSupport ? true # limit max size to allow in the decoder
+, optimizationsSupport ? true # compiler optimization flags
+, runtimeCpuDetectSupport ? true # detect cpu capabilities at runtime
+, thumbSupport ? false # build arm assembly in thumb mode
+, examplesSupport ? true # build examples (vpxdec & vpxenc are part of examples)
+, debugLibsSupport ? false # include debug version of each library
+, postprocSupport ? true # postprocessing
+, multithreadSupport ? true # multithreaded decoding & encoding
+, internalStatsSupport ? false # output of encoder internal stats for debug, if supported (encoders)
+, spatialResamplingSupport ? true # spatial sampling (scaling)
+, realtimeOnlySupport ? false # build for real-time encoding
+, ontheflyBitpackingSupport ? false # on-the-fly bitpacking in real-time encoding
+, errorConcealmentSupport ? false # decoder conceals losses
+, smallSupport ? false # favor smaller binary over speed
+, postprocVisualizerSupport ? false # macro block/block level visualizers
+, unitTestsSupport ? false, curl ? null, coreutils ? null # unit tests
+, webmIOSupport ? true # input from and output to webm container
+, libyuvSupport ? true # libyuv
+, decodePerfTestsSupport ? false # build decoder perf tests with unit tests
+, encodePerfTestsSupport ? false # build encoder perf tests with unit tests
+, multiResEncodingSupport ? false # multiple-resolution encoding
+, temporalDenoisingSupport ? true # use temporal denoising instead of spatial denoising
+, coefficientRangeCheckingSupport ? false # decoder checks if intermediate transform coefficients are in valid range
+, vp9HighbitdepthSupport ? true # 10/12 bit color support in VP9
+# Experimental features
+, experimentalSpatialSvcSupport ? false # Spatial scalable video coding
+, experimentalFpMbStatsSupport ? false
+, experimentalEmulateHardwareSupport ? false
+}:
+
+let
+  inherit (stdenv) is64bit isMips isDarwin isCygwin;
+  inherit (stdenv.lib) enableFeature optional optionals;
+in
+
+assert vp8DecoderSupport || vp8EncoderSupport || vp9DecoderSupport || vp9EncoderSupport;
+assert internalStatsSupport && (vp9DecoderSupport || vp9EncoderSupport) -> postprocSupport;
+/* If spatialResamplingSupport not enabled, build will fail with undeclared variable errors.
+   Variables called in vpx_scale/generic/vpx_scale.c are declared by vpx_scale/vpx_scale_rtcd.pl,
+   but is only executed if spatialResamplingSupport is enabled */
+assert spatialResamplingSupport;
+assert postprocVisualizerSupport -> postprocSupport;
+assert unitTestsSupport -> curl != null && coreutils != null;
+assert vp9HighbitdepthSupport -> (vp9DecoderSupport || vp9EncoderSupport);
+assert isCygwin -> unitTestsSupport && webmIOSupport && libyuvSupport;
+
+stdenv.mkDerivation rec {
+  name = "libvpx-${version}";
+  version = "1.7.0";
+
+  src = fetchFromGitHub {
+    owner = "webmproject";
+    repo = "libvpx";
+    rev = "v${version}";
+    sha256 = "0vvh89hvp8qg9an9vcmwb7d9k3nixhxaz6zi65qdjnd0i56kkcz6";
+  };
+
+  patchPhase = ''patchShebangs .'';
+
+  outputs = [ "bin" "dev" "out" ];
+  setOutputFlags = false;
+
+  configurePlatforms = [];
+  configureFlags = [
+    (enableFeature (vp8EncoderSupport || vp8DecoderSupport) "vp8")
+    (enableFeature vp8EncoderSupport "vp8-encoder")
+    (enableFeature vp8DecoderSupport "vp8-decoder")
+    (enableFeature (vp9EncoderSupport || vp9DecoderSupport) "vp9")
+    (enableFeature vp9EncoderSupport "vp9-encoder")
+    (enableFeature vp9DecoderSupport "vp9-decoder")
+    (enableFeature extraWarningsSupport "extra-warnings")
+    (enableFeature werrorSupport "werror")
+    "--disable-install-docs"
+    (enableFeature examplesSupport "install-bins")
+    "--enable-install-libs"
+    "--disable-install-srcs"
+    (enableFeature debugSupport "debug")
+    (enableFeature gprofSupport "gprof")
+    (enableFeature gcovSupport "gcov")
+    # Required to build shared libraries
+    (enableFeature (!isCygwin) "pic")
+    (enableFeature optimizationsSupport "optimizations")
+    (enableFeature runtimeCpuDetectSupport "runtime-cpu-detect")
+    (enableFeature thumbSupport "thumb")
+    "--enable-libs"
+    (enableFeature examplesSupport "examples")
+    "--disable-docs"
+    "--as=yasm"
+    # Limit default decoder max to WHXGA
+    (if sizeLimitSupport then "--size-limit=5120x3200" else null)
+    "--disable-codec-srcs"
+    (enableFeature debugLibsSupport "debug-libs")
+    (enableFeature isMips "dequant-tokens")
+    (enableFeature isMips "dc-recon")
+    (enableFeature postprocSupport "postproc")
+    (enableFeature (postprocSupport && (vp9DecoderSupport || vp9EncoderSupport)) "vp9-postproc")
+    (enableFeature multithreadSupport "multithread")
+    (enableFeature internalStatsSupport "internal-stats")
+    (enableFeature spatialResamplingSupport "spatial-resampling")
+    (enableFeature realtimeOnlySupport "realtime-only")
+    (enableFeature ontheflyBitpackingSupport "onthefly-bitpacking")
+    (enableFeature errorConcealmentSupport "error-concealment")
+    # Shared libraries are only supported on ELF platforms
+    (if isDarwin || isCygwin then
+       "--enable-static --disable-shared"
+     else
+       "--disable-static --enable-shared")
+    (enableFeature smallSupport "small")
+    (enableFeature postprocVisualizerSupport "postproc-visualizer")
+    (enableFeature unitTestsSupport "unit-tests")
+    (enableFeature webmIOSupport "webm-io")
+    (enableFeature libyuvSupport "libyuv")
+    (enableFeature decodePerfTestsSupport "decode-perf-tests")
+    (enableFeature encodePerfTestsSupport "encode-perf-tests")
+    (enableFeature multiResEncodingSupport "multi-res-encoding")
+    (enableFeature temporalDenoisingSupport "temporal-denoising")
+    (enableFeature (temporalDenoisingSupport && (vp9DecoderSupport || vp9EncoderSupport)) "vp9-temporal-denoising")
+    (enableFeature coefficientRangeCheckingSupport "coefficient-range-checking")
+    (enableFeature (vp9HighbitdepthSupport && is64bit) "vp9-highbitdepth")
+    (enableFeature (experimentalSpatialSvcSupport ||
+                    experimentalFpMbStatsSupport ||
+                    experimentalEmulateHardwareSupport) "experimental")
+  ] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
+    #"--extra-cflags="
+    #"--extra-cxxflags="
+    #"--prefix="
+    #"--libc="
+    #"--libdir="
+    "--enable-external-build"
+    # libvpx darwin targets include darwin version (ie. ARCH-darwinXX-gcc, XX being the darwin version)
+    # See all_platforms: https://github.com/webmproject/libvpx/blob/master/configure
+    # Darwin versions: 10.4=8, 10.5=9, 10.6=10, 10.7=11, 10.8=12, 10.9=13, 10.10=14
+    "--force-target=${stdenv.hostPlatform.config}${
+            if stdenv.hostPlatform.isDarwin then
+              if      stdenv.hostPlatform.osxMinVersion == "10.10" then "14"
+              else if stdenv.hostPlatform.osxMinVersion == "10.9"  then "13"
+              else if stdenv.hostPlatform.osxMinVersion == "10.8"  then "12"
+              else if stdenv.hostPlatform.osxMinVersion == "10.7"  then "11"
+              else if stdenv.hostPlatform.osxMinVersion == "10.6"  then "10"
+              else if stdenv.hostPlatform.osxMinVersion == "10.5"  then "9"
+              else "8"
+            else ""}-gcc"
+    (if stdenv.hostPlatform.isCygwin then "--enable-static-msvcrt" else "")
+  ] # Experimental features
+    ++ optional experimentalSpatialSvcSupport "--enable-spatial-svc"
+    ++ optional experimentalFpMbStatsSupport "--enable-fp-mb-stats"
+    ++ optional experimentalEmulateHardwareSupport "--enable-emulate-hardware";
+
+  nativeBuildInputs = [ perl yasm ];
+
+  buildInputs = [ ]
+    ++ optionals unitTestsSupport [ coreutils curl ];
+
+  enableParallelBuilding = true;
+
+  postInstall = ''moveToOutput bin "$bin" '';
+
+  meta = with stdenv.lib; {
+    description = "WebM VP8/VP9 codec SDK";
+    homepage    = https://www.webmproject.org/;
+    license     = licenses.bsd3;
+    maintainers = with maintainers; [ codyopel ];
+    platforms   = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libvterm-neovim/default.nix b/nixpkgs/pkgs/development/libraries/libvterm-neovim/default.nix
new file mode 100644
index 000000000000..e00b3e1c7b3a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libvterm-neovim/default.nix
@@ -0,0 +1,33 @@
+{ stdenv
+, fetchFromGitHub
+, perl
+, libtool
+}:
+
+stdenv.mkDerivation rec {
+  pname = "libvterm-neovim";
+  version = "2018-11-26";
+
+  src = fetchFromGitHub {
+    owner = "neovim";
+    repo = "libvterm";
+    rev = "f600f523545b7d4018ebf320e3273795dbe43c8a";
+    sha256 = "08lxd8xs9cg4axgq6bkb7afjxg3s29s1a3niqqm4wjb7iyi2jx5b";
+  };
+
+  buildInputs = [ perl ];
+  nativeBuildInputs = [ libtool ];
+
+  makeFlags = [ "PREFIX=$(out)" ]
+    ++ stdenv.lib.optional stdenv.isDarwin "LIBTOOL=${libtool}/bin/libtool";
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    description = "VT220/xterm/ECMA-48 terminal emulator library";
+    homepage = http://www.leonerd.org.uk/code/libvterm/;
+    license = licenses.mit;
+    maintainers = with maintainers; [ garbas ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libvterm/default.nix b/nixpkgs/pkgs/development/libraries/libvterm/default.nix
new file mode 100644
index 000000000000..472539ea24bb
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libvterm/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchurl, pkgconfig, glib, ncurses }:
+
+stdenv.mkDerivation rec {
+  name = "libvterm-0.99.7";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/libvterm/${name}.tar.gz";
+    sha256 = "10gaqygmmwp0cwk3j8qflri5caf8vl3f7pwfl2svw5whv8wkn0k2";
+  };
+
+  patchPhase = ''
+    sed -i -e s@/usr@$out@ -e /ldconfig/d Makefile
+  '';
+
+  preInstall = ''
+    mkdir -p $out/include
+    mkdir -p $out/lib
+  '';
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ glib ncurses ];
+
+  meta = with stdenv.lib; {
+    homepage = http://libvterm.sourceforge.net/;
+    description = "Terminal emulator library to mimic both vt100 and rxvt";
+    license = licenses.gpl2Plus;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libwacom/default.nix b/nixpkgs/pkgs/development/libraries/libwacom/default.nix
new file mode 100644
index 000000000000..a1e10b6d003d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libwacom/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchFromGitHub, autoreconfHook, glib, pkgconfig, udev, libgudev }:
+
+stdenv.mkDerivation rec {
+  name = "libwacom-${version}";
+  version = "0.33";
+
+  src = fetchFromGitHub {
+    owner = "linuxwacom";
+    repo = "libwacom";
+    rev = "libwacom-${version}";
+    sha256 = "0np0a7rpnlm9iqw1i8ycz5mprin6bb99p4h522v9vjk4lhzsp34m";
+  };
+
+  nativeBuildInputs = [ pkgconfig autoreconfHook ];
+  buildInputs = [ glib udev libgudev ];
+
+  meta = with stdenv.lib; {
+    platforms = platforms.linux;
+    homepage = https://linuxwacom.github.io/;
+    description = "Libraries, configuration, and diagnostic tools for Wacom tablets running under Linux";
+    license = licenses.mit;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libwebp/default.nix b/nixpkgs/pkgs/development/libraries/libwebp/default.nix
new file mode 100644
index 000000000000..14be410bd165
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libwebp/default.nix
@@ -0,0 +1,67 @@
+{ stdenv, fetchurl
+, threadingSupport ? true # multi-threading
+, openglSupport ? false, freeglut ? null, libGLU_combined ? null # OpenGL (required for vwebp)
+, pngSupport ? true, libpng ? null # PNG image format
+, jpegSupport ? true, libjpeg ? null # JPEG image format
+, tiffSupport ? true, libtiff ? null # TIFF image format
+, gifSupport ? true, giflib ? null # GIF image format
+#, wicSupport ? true # Windows Imaging Component
+, alignedSupport ? false # Force aligned memory operations
+, swap16bitcspSupport ? false # Byte swap for 16bit color spaces
+, experimentalSupport ? false # Experimental code
+, libwebpmuxSupport ? true # Build libwebpmux
+, libwebpdemuxSupport ? true # Build libwebpdemux
+, libwebpdecoderSupport ? true # Build libwebpdecoder
+}:
+
+assert openglSupport -> ((freeglut != null) && (libGLU_combined != null));
+assert pngSupport -> (libpng != null);
+assert jpegSupport -> (libjpeg != null);
+assert tiffSupport -> (libtiff != null);
+assert gifSupport -> (giflib != null);
+
+let
+  mkFlag = optSet: flag: if optSet then "--enable-${flag}" else "--disable-${flag}";
+in
+
+with stdenv.lib;
+stdenv.mkDerivation rec {
+  name = "libwebp-${version}";
+  version = "1.0.2";
+
+  src = fetchurl {
+    url = "http://downloads.webmproject.org/releases/webp/${name}.tar.gz";
+    sha256 = "1cb4sm6h1czvk9kqqgld3g5f0d9qv60xnbbv0kl7cr7d826b8irx";
+  };
+
+  configureFlags = [
+    (mkFlag threadingSupport "threading")
+    (mkFlag openglSupport "gl")
+    (mkFlag pngSupport "png")
+    (mkFlag jpegSupport "jpeg")
+    (mkFlag tiffSupport "tiff")
+    (mkFlag gifSupport "gif")
+    #(mkFlag (wicSupport && stdenv.isCygwin) "wic")
+    (mkFlag alignedSupport "aligned")
+    (mkFlag swap16bitcspSupport "swap-16bit-csp")
+    (mkFlag experimentalSupport "experimental")
+    (mkFlag libwebpmuxSupport "libwebpmux")
+    (mkFlag libwebpdemuxSupport "libwebpdemux")
+    (mkFlag libwebpdecoderSupport "libwebpdecoder")
+  ];
+
+  buildInputs = [ ]
+    ++ optionals openglSupport [ freeglut libGLU_combined ]
+    ++ optional pngSupport libpng
+    ++ optional jpegSupport libjpeg
+    ++ optional tiffSupport libtiff
+    ++ optional gifSupport giflib;
+
+  meta = {
+    description = "Tools and library for the WebP image format";
+    homepage = https://developers.google.com/speed/webp/;
+    license = licenses.bsd3;
+    platforms = platforms.all;
+    maintainers = with maintainers; [ codyopel ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libwebsockets/default.nix b/nixpkgs/pkgs/development/libraries/libwebsockets/default.nix
new file mode 100644
index 000000000000..7c1d58d2980f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libwebsockets/default.nix
@@ -0,0 +1,28 @@
+{ fetchFromGitHub, stdenv, cmake, openssl, zlib, libuv }:
+
+stdenv.mkDerivation rec {
+  name = "libwebsockets-${version}";
+  version = "3.1.0";
+
+  src = fetchFromGitHub {
+    owner = "warmcat";
+    repo = "libwebsockets";
+    rev = "v${version}";
+    sha256 = "1w1wz6snf3cmcpa3f4dci2nz9za2f5rrylxl109id7bcb36xhbdl";
+  };
+
+  buildInputs = [ cmake openssl zlib libuv ];
+  cmakeFlags = [ "-DLWS_WITH_PLUGINS=ON" ];
+
+  meta = {
+    description = "Light, portable C library for websockets";
+    longDescription = ''
+      Libwebsockets is a lightweight pure C library built to
+      use minimal CPU and memory resources, and provide fast
+      throughput in both directions.
+    '';
+    homepage = https://github.com/warmcat/libwebsockets;
+    license = stdenv.lib.licenses.lgpl21;
+    platforms = stdenv.lib.platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libwhereami/default.nix b/nixpkgs/pkgs/development/libraries/libwhereami/default.nix
new file mode 100644
index 000000000000..2af550c7d99a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libwhereami/default.nix
@@ -0,0 +1,32 @@
+{ stdenv, fetchFromGitHub, cmake, boost, curl, leatherman }:
+
+stdenv.mkDerivation rec {
+  name = "libwhereami-${version}";
+  version = "0.2.2";
+
+  src = fetchFromGitHub {
+    sha256 = "084n153jaq8fmhjififk0xlx1d1i3lclnw2j3ly8bixvc392vzly";
+    rev = version;
+    repo = "libwhereami";
+    owner = "puppetlabs";
+  };
+
+  # post gcc7, upstream bug: https://tickets.puppetlabs.com/browse/FACT-1828
+  NIX_CFLAGS_COMPILE = "-Wno-error=deprecated";
+
+  nativeBuildInputs = [ cmake ];
+
+  buildInputs = [ boost curl leatherman ];
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    inherit (src.meta) homepage;
+    description = "Library to report hypervisor information from inside a VM";
+    license = licenses.asl20;
+    maintainers = [ maintainers.womfoo ];
+    platforms = platforms.linux;
+    badPlatforms = platforms.arm;
+  };
+
+}
diff --git a/nixpkgs/pkgs/development/libraries/libwmf/default.nix b/nixpkgs/pkgs/development/libraries/libwmf/default.nix
new file mode 100644
index 000000000000..e7aa5f7ecc9f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libwmf/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchFromGitHub, pkgconfig
+, freetype, glib, imagemagick, libjpeg, libpng, libxml2, zlib
+}:
+
+stdenv.mkDerivation rec {
+  pname = "libwmf";
+  version = "0.2.12";
+
+  src = fetchFromGitHub {
+    owner = "caolanm";
+    repo = pname;
+    rev = "v${version}";
+    sha256 = "0i2w5hg8mbgmgabxyd48qp1gx2mhk33hgr3jqvg72k0nhkd2jhf6";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ zlib imagemagick libpng glib freetype libjpeg libxml2 ];
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    description = "WMF library from wvWare";
+    homepage = "http://wvware.sourceforge.net/libwmf.html";
+    downloadPage = "https://github.com/caolanm/libwmf/releases";
+    license = licenses.gpl2Plus;
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libwnck/3.x.nix b/nixpkgs/pkgs/development/libraries/libwnck/3.x.nix
new file mode 100644
index 000000000000..9c35d3373505
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libwnck/3.x.nix
@@ -0,0 +1,38 @@
+{ stdenv, fetchurl, pkgconfig, libX11, gtk3, intltool, gobject-introspection, gnome3 }:
+
+let
+  pname = "libwnck";
+  version = "3.30.0";
+in stdenv.mkDerivation rec{
+  name = "${pname}-${version}";
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${name}.tar.xz";
+    sha256 = "0f9lvhm3w25046dqq8xyg7nzggxpmdriwrb661nng05a8qk0svdc";
+  };
+
+  outputs = [ "out" "dev" "devdoc" ];
+  outputBin = "dev";
+
+  configureFlags = [ "--enable-introspection" ];
+
+  nativeBuildInputs = [ pkgconfig intltool gobject-introspection ];
+  propagatedBuildInputs = [ libX11 gtk3 ];
+
+  PKG_CONFIG_GOBJECT_INTROSPECTION_1_0_GIRDIR = "${placeholder "dev"}/share/gir-1.0";
+  PKG_CONFIG_GOBJECT_INTROSPECTION_1_0_TYPELIBDIR = "${placeholder "out"}/lib/girepository-1.0";
+
+  passthru = {
+    updateScript = gnome3.updateScript {
+      packageName = pname;
+      attrPath = "gnome3.${pname}";
+    };
+  };
+
+  meta = with stdenv.lib; {
+    description = "Library to manage X windows and workspaces (via pagers, tasklists, etc.)";
+    license = licenses.lgpl21Plus;
+    platforms = platforms.linux;
+    maintainers = [ maintainers.worldofpeace ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libwnck/default.nix b/nixpkgs/pkgs/development/libraries/libwnck/default.nix
new file mode 100644
index 000000000000..2872181a36d8
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libwnck/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchurl, pkgconfig, 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";
+    sha256 = "17isfjvrzgj5znld2a7zsk9vd39q9wnsysnw5jr8iz410z935xw3";
+  };
+
+  outputs = [ "out" "dev" "devdoc" ];
+  outputBin = "dev";
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ gtk2 intltool xorg.libX11 xorg.libXres ];
+  # ?another optional: startup-notification
+
+  configureFlags = [ "--disable-introspection" ]; # not needed anywhere AFAIK
+
+  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 ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libwpd/0.8.nix b/nixpkgs/pkgs/development/libraries/libwpd/0.8.nix
new file mode 100644
index 000000000000..736b1a45fa20
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libwpd/0.8.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchurl, pkgconfig, glib, libgsf, libxml2, bzip2 }:
+
+stdenv.mkDerivation rec {
+  name = "libwpd-0.8.14";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/libwpd/${name}.tar.gz";
+    sha256 = "1syli6i5ma10cwzpa61a18pyjmianjwsf6pvmvzsh5md6yk4yx01";
+  };
+
+  patches = [ ./gcc-0.8.patch ];
+
+  buildInputs = [ glib libgsf libxml2 ];
+
+  nativeBuildInputs = [ pkgconfig bzip2 ];
+
+  meta = with stdenv.lib; {
+    description = "Library for importing WordPerfect documents";
+    homepage = http://libwpd.sourceforge.net;
+    license = with licenses; [ lgpl21 mpl20 ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libwpd/default.nix b/nixpkgs/pkgs/development/libraries/libwpd/default.nix
new file mode 100644
index 000000000000..56c598ca7de9
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libwpd/default.nix
@@ -0,0 +1,21 @@
+{ stdenv, fetchurl, zlib, pkgconfig, glib, libgsf, libxml2, librevenge }:
+
+stdenv.mkDerivation rec {
+  name = "libwpd-0.10.0";
+  
+  src = fetchurl {
+    url = "mirror://sourceforge/libwpd/${name}.tar.xz";
+    sha256 = "0b6krzr6kxzm89g6bapn805kdayq70hn16n5b5wfs2lwrf0ag2wx";
+  };
+  
+  buildInputs = [ glib libgsf libxml2 zlib librevenge ];
+
+  nativeBuildInputs = [ pkgconfig ];
+
+  meta = with stdenv.lib; {
+    description = "A library for importing and exporting WordPerfect documents";
+    homepage = http://libwpd.sourceforge.net/;
+    license = licenses.lgpl21;
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libwpd/gcc-0.8.patch b/nixpkgs/pkgs/development/libraries/libwpd/gcc-0.8.patch
new file mode 100644
index 000000000000..05eb3293ed7c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libwpd/gcc-0.8.patch
@@ -0,0 +1,13 @@
+diff --git a/src/lib/WPXTable.h b/src/lib/WPXTable.h
+index 6d1e921..0234ad7 100644
+--- a/src/lib/WPXTable.h
++++ b/src/lib/WPXTable.h
+@@ -76,7 +76,7 @@ public:
+ 	WPXTableList & operator=(const WPXTableList & tableList);
+ 	virtual ~WPXTableList();
+ 
+-	WPXTable * operator[](size_t i) { return (*m_tableList)[i]; }
++	WPXTable * operator[](std::size_t i) { return (*m_tableList)[i]; }
+ 	void add(WPXTable *table) { m_tableList->push_back(table); }
+ 
+ private:
diff --git a/nixpkgs/pkgs/development/libraries/libwpg/default.nix b/nixpkgs/pkgs/development/libraries/libwpg/default.nix
new file mode 100644
index 000000000000..e80cefe16e2d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libwpg/default.nix
@@ -0,0 +1,20 @@
+{ stdenv, fetchurl, pkgconfig, libwpd, zlib, librevenge }:
+
+stdenv.mkDerivation rec {
+  name = "libwpg-0.3.3";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/libwpg/${name}.tar.xz";
+    sha256 = "074x159immf139szkswv2zapnq75p7xk10dbha2p9193hgwggcwr";
+  };
+
+  buildInputs = [ libwpd zlib librevenge ];
+  nativeBuildInputs = [ pkgconfig ];
+
+  meta = with stdenv.lib; {
+    homepage = http://libwpg.sourceforge.net;
+    description = "C++ library to parse WPG";
+    license = with licenses; [ lgpl21 mpl20 ];
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libwps/default.nix b/nixpkgs/pkgs/development/libraries/libwps/default.nix
new file mode 100644
index 000000000000..76ac946d6187
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libwps/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchurl, boost, pkgconfig, librevenge, zlib }:
+
+stdenv.mkDerivation rec {
+  name = "libwps-${version}";
+  version = "0.4.10";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/libwps/${name}.tar.bz2";
+    sha256 = "1adx2wawl0i16p8df80m6k6a137h709ip4zc0zlzr6wal8gpn0i4";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ boost librevenge zlib ];
+
+  NIX_CFLAGS_COMPILE = [ "-Wno-error=implicit-fallthrough" ]; # newly detected by gcc-7
+
+  meta = with stdenv.lib; {
+    homepage = http://libwps.sourceforge.net/;
+    description = "Microsoft Works document format import filter library";
+    platforms = platforms.unix;
+    license = licenses.lgpl21;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libx86/constants.patch b/nixpkgs/pkgs/development/libraries/libx86/constants.patch
new file mode 100644
index 000000000000..10fc829d6743
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libx86/constants.patch
@@ -0,0 +1,20 @@
+--- libx86/lrmi.c	2008-09-06 12:24:36.070136428 +0200
++++ libx86/lrmi.c	2008-09-06 12:28:10.584287458 +0200
+@@ -56,5 +56,17 @@
+ 
+ #if defined(__linux__)
++#ifndef TF_MASK
++#define TF_MASK X86_EFLAGS_TF
++#endif
++#ifndef IF_MASK
++#define IF_MASK X86_EFLAGS_IF
++#endif
++#ifndef IOPL_MASK
++#define IOPL_MASK X86_EFLAGS_IOPL
++#endif
++#ifndef VIF_MASK
++#define VIF_MASK X86_EFLAGS_VIF
++#endif
+ #define DEFAULT_VM86_FLAGS 	(IF_MASK | IOPL_MASK)
+ #elif defined(__NetBSD__) || defined(__FreeBSD__)
+ #define DEFAULT_VM86_FLAGS  (PSL_I | PSL_IOPL)
diff --git a/nixpkgs/pkgs/development/libraries/libx86/default.nix b/nixpkgs/pkgs/development/libraries/libx86/default.nix
new file mode 100644
index 000000000000..d56c20cb75af
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libx86/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "libx86-${version}";
+  version = "1.1";
+  src = fetchurl {
+    url = "https://www.codon.org.uk/~mjg59/libx86/downloads/${name}.tar.gz";
+    sha256 = "0j6h6bc02c6qi0q7c1ncraz4d1hkm5936r35rfsp4x1jrc233wav";
+  };
+  patches = [./constants.patch ./non-x86.patch ];
+
+  # using BACKEND=x86emu on 64bit systems fixes:
+  #  http://www.mail-archive.com/suspend-devel@lists.sourceforge.net/msg02355.html
+  makeFlags = [
+    "DESTDIR=$(out)"
+  ] ++ stdenv.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; {
+    description = "Real-mode x86 code emulator";
+    maintainers = with maintainers; [ raskin ];
+    platforms = [ "x86_64-linux" "i686-linux" ];
+    license = licenses.mit;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libx86/non-x86.patch b/nixpkgs/pkgs/development/libraries/libx86/non-x86.patch
new file mode 100644
index 000000000000..286057c4ba87
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libx86/non-x86.patch
@@ -0,0 +1,38 @@
+diff -Naur libx86-1.1+ds1.orig/Makefile libx86-1.1+ds1/Makefile
+--- libx86-1.1+ds1.orig/Makefile	2008-05-19 12:28:59.000000000 +0300
++++ libx86-1.1+ds1/Makefile	2012-02-20 01:32:03.750068423 +0200
+@@ -5,6 +5,7 @@
+ ifeq ($(BACKEND),x86emu)
+ 	OBJECTS += thunk.o x86emu/decode.o x86emu/debug.o x86emu/fpu.o \
+ 	x86emu/ops.o x86emu/ops2.o x86emu/prim_ops.o x86emu/sys.o
++	CFLAGS += -DX86EMU -fno-delete-null-pointer-checks
+ else
+ 	OBJECTS += lrmi.o
+ endif
+diff -Naur libx86-1.1+ds1.orig/thunk.c libx86-1.1+ds1/thunk.c
+--- libx86-1.1+ds1.orig/thunk.c	2008-04-03 03:48:00.000000000 +0300
++++ libx86-1.1+ds1/thunk.c	2012-02-20 01:12:56.468820192 +0200
+@@ -32,6 +32,7 @@
+ #define TRUE 1
+ #define FALSE 0
+ 
++#ifndef X86EMU
+ #define __BUILDIO(bwl,bw,type) \
+ static inline void out##bwl##_local(unsigned long port, unsigned type value) {        __asm__ __volatile__("out" #bwl " %" #bw "0, %w1" : : "a"(value), "Nd"(port)); \
+ }\
+@@ -44,6 +45,15 @@
+ __BUILDIO(b,b,char)
+ __BUILDIO(w,w,short)
+ __BUILDIO(l,,int)
++#else
++/* use libc functions */
++#define inb_local inb
++#define inw_local inw
++#define inl_local inl
++#define outb_local outb
++#define outw_local outw
++#define outl_local outl
++#endif /* X86EMU */
+ 
+ 
+ char *mmap_addr = SHMERRORPTR;
diff --git a/nixpkgs/pkgs/development/libraries/libx86/src-for-default.nix b/nixpkgs/pkgs/development/libraries/libx86/src-for-default.nix
new file mode 100644
index 000000000000..30be467f9fd2
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libx86/src-for-default.nix
@@ -0,0 +1,9 @@
+rec {
+   version="1.1";
+   name="libx86-1.1";
+   hash="0j6h6bc02c6qi0q7c1ncraz4d1hkm5936r35rfsp4x1jrc233wav";
+   url="http://www.codon.org.uk/~mjg59/libx86/downloads/libx86-${version}.tar.gz";
+   advertisedUrl="http://www.codon.org.uk/~mjg59/libx86/downloads/libx86-1.1.tar.gz";
+  
+  
+}
diff --git a/nixpkgs/pkgs/development/libraries/libx86/src-info-for-default.nix b/nixpkgs/pkgs/development/libraries/libx86/src-info-for-default.nix
new file mode 100644
index 000000000000..9861e21f6559
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libx86/src-info-for-default.nix
@@ -0,0 +1,4 @@
+{
+  downloadPage = "http://www.codon.org.uk/~mjg59/libx86/downloads/?C=M;O=D";
+  baseName = "libx86";
+}
diff --git a/nixpkgs/pkgs/development/libraries/libx86emu/default.nix b/nixpkgs/pkgs/development/libraries/libx86emu/default.nix
new file mode 100644
index 000000000000..2e00b5b5ab9c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libx86emu/default.nix
@@ -0,0 +1,35 @@
+{ stdenv, fetchFromGitHub, perl }:
+
+stdenv.mkDerivation rec {
+  name = "libx86emu-${version}";
+  version = "2.3";
+
+  src = fetchFromGitHub {
+    owner = "wfeldt";
+    repo = "libx86emu";
+    rev = version;
+    sha256 = "158mrg9xb0sb4l3s60084j6i7nr90smpsks9f02gbssk495h2k8l";
+  };
+
+  nativeBuildInputs = [ perl ];
+
+  postUnpack = "rm $sourceRoot/git2log";
+  patchPhase = ''
+    # VERSION is usually generated using Git
+    echo "${version}" > VERSION
+    substituteInPlace Makefile --replace "/usr" "/"
+  '';
+
+  buildFlags = [ "shared" ];
+  enableParallelBuilding = true;
+
+  installFlags = [ "DESTDIR=$(out)" "LIBDIR=/lib" ];
+
+  meta = with stdenv.lib; {
+    description = "x86 emulation library";
+    license = licenses.bsd2;
+    homepage = https://github.com/wfeldt/libx86emu;
+    maintainers = with maintainers; [ bobvanderlinden ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libxc/default.nix b/nixpkgs/pkgs/development/libraries/libxc/default.nix
new file mode 100644
index 000000000000..7bd89b44d889
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libxc/default.nix
@@ -0,0 +1,32 @@
+{ stdenv, fetchurl, gfortran, perl }:
+
+let
+  version = "4.3.4";
+
+in stdenv.mkDerivation {
+  name = "libxc-${version}";
+  src = fetchurl {
+    url = "http://www.tddft.org/programs/octopus/down.php?file=libxc/${version}/libxc-${version}.tar.gz";
+    sha256 = "0dw356dfwn2bwjdfwwi4h0kimm69aql2f4yk9f2kk4q7qpfkgvm8";
+  };
+
+  buildInputs = [ gfortran ];
+  nativeBuildInputs = [ perl ];
+
+  preConfigure = ''
+    patchShebangs ./
+  '';
+
+  configureFlags = [ "--enable-shared" ];
+
+  doCheck = true;
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    description = "Library of exchange-correlation functionals for density-functional theory";
+    homepage = https://octopus-code.org/wiki/Libxc;
+    license = licenses.lgpl3;
+    platforms = [ "x86_64-linux" ];
+    maintainers = with maintainers; [ markuskowa ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libxcomp/default.nix b/nixpkgs/pkgs/development/libraries/libxcomp/default.nix
new file mode 100644
index 000000000000..b4ad501c2efe
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libxcomp/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchurl, autoreconfHook, pkgconfig, libjpeg, libpng, libX11, zlib }:
+
+stdenv.mkDerivation rec {
+  name = "libxcomp-${version}";
+  version = "3.5.99.16";
+
+  src = fetchurl {
+    sha256 = "1m3z9w3h6qpgk265xf030w7lcs181jgw2cdyzshb7l97mn1f7hh2";
+    url = "https://code.x2go.org/releases/source/nx-libs/nx-libs-${version}-lite.tar.gz";
+  };
+
+  buildInputs = [ libjpeg libpng libX11 zlib ];
+  nativeBuildInputs = [ autoreconfHook pkgconfig ];
+
+  preAutoreconf = ''
+    cd nxcomp/
+    sed -i 's|/src/.libs/libXcomp.a|/src/.libs/libXcomp.la|' test/Makefile.am
+  '';
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    description = "NX compression library";
+    homepage = http://wiki.x2go.org/doku.php/wiki:libs:nx-libs;
+    license = licenses.gpl2;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libxdg-basedir/default.nix b/nixpkgs/pkgs/development/libraries/libxdg-basedir/default.nix
new file mode 100644
index 000000000000..f0e63efc0d14
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libxdg-basedir/default.nix
@@ -0,0 +1,24 @@
+{stdenv, fetchurl, fetchpatch}:
+
+stdenv.mkDerivation rec {
+  name = "libxdg-basedir-1.2.0";
+  src = fetchurl {
+    url = "https://nevill.ch/libxdg-basedir/downloads/${name}.tar.gz";
+    sha256 = "2757a949618742d80ac59ee2f0d946adc6e71576406cdf798e6ced507708cdf4";
+  };
+
+  patches = [
+    # Overflow bug
+    (fetchpatch {
+      url = "https://github.com/devnev/libxdg-basedir/commit/14e000f696ef8b83264b0ca4407669bdb365fb23.patch";
+      sha256 = "0lpy1ijir0x0hhb0fz0w5vxy1wl1cw9kkd6gva0rkp41i6vrp2wq";
+    })
+  ];
+
+  meta = with stdenv.lib; {
+    homepage = https://github.com/devnev/libxdg-basedir;
+    description = "Implementation of the XDG Base Directory specification";
+    license = licenses.mit;
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libxkbcommon/default.nix b/nixpkgs/pkgs/development/libraries/libxkbcommon/default.nix
new file mode 100644
index 000000000000..3e0a2872c005
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libxkbcommon/default.nix
@@ -0,0 +1,39 @@
+{ stdenv, fetchurl, fetchpatch, meson, ninja, pkgconfig, yacc, xkeyboard_config, libxcb, libX11, doxygen }:
+
+stdenv.mkDerivation rec {
+  name = "libxkbcommon-0.8.0";
+
+  src = fetchurl {
+    url = "https://xkbcommon.org/download/${name}.tar.xz";
+    sha256 = "0vgy84vfbig5bqznr137h5arjidnfwrxrdli0pxyn2jfn1fjcag8";
+  };
+
+  outputs = [ "out" "dev" "doc" ];
+
+  nativeBuildInputs = [ meson ninja pkgconfig yacc doxygen ];
+  buildInputs = [ xkeyboard_config libxcb ];
+
+  patches = [
+    # darwin compatibility
+    (fetchpatch {
+      url = https://github.com/xkbcommon/libxkbcommon/commit/edb1c662394578a54b7bbed231d918925e5d8150.patch;
+      sha256 = "0ydjlir32r3xfsbqhnsx1bz6ags2m908yhf9i09i1s7sgcimbcx5";
+    })
+  ];
+
+  mesonFlags = [
+    "-Denable-wayland=false"
+    "-Dxkb-config-root=${xkeyboard_config}/etc/X11/xkb"
+    "-Dx-locale-root=${libX11.out}/share/X11/locale"
+  ];
+
+  doCheck = false; # fails, needs unicode locale
+
+  meta = with stdenv.lib; {
+    description = "A library to handle keyboard descriptions";
+    homepage = https://xkbcommon.org;
+    license = licenses.mit;
+    maintainers = with maintainers; [ garbas ttuegel ];
+    platforms = with platforms; unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libxkbcommon/libxkbcommon_7.nix b/nixpkgs/pkgs/development/libraries/libxkbcommon/libxkbcommon_7.nix
new file mode 100644
index 000000000000..0d034f5385f5
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libxkbcommon/libxkbcommon_7.nix
@@ -0,0 +1,32 @@
+{ stdenv, fetchurl, pkgconfig, yacc, flex, xkeyboard_config, libxcb, libX11 }:
+
+stdenv.mkDerivation rec {
+  name = "libxkbcommon-0.7.2";
+
+  src = fetchurl {
+    url = "http://xkbcommon.org/download/${name}.tar.xz";
+    sha256 = "1n5rv5n210kjnkyrvbh04gfwaa7zrmzy1393p8nyqfw66lkxr918";
+  };
+
+  outputs = [ "out" "dev" ];
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ yacc flex xkeyboard_config libxcb ];
+
+  configureFlags = [
+    "--with-xkb-config-root=${xkeyboard_config}/etc/X11/xkb"
+    "--with-x-locale-root=${libX11.out}/share/X11/locale"
+  ];
+
+  preBuild = stdenv.lib.optionalString stdenv.isDarwin ''
+    sed -i 's/,--version-script=.*$//' Makefile
+  '';
+
+  meta = with stdenv.lib; {
+    description = "A library to handle keyboard descriptions";
+    homepage = https://xkbcommon.org;
+    license = licenses.mit;
+    maintainers = with maintainers; [ garbas ttuegel ];
+    platforms = with platforms; unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libxklavier/default.nix b/nixpkgs/pkgs/development/libraries/libxklavier/default.nix
new file mode 100644
index 000000000000..773389e60f54
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libxklavier/default.nix
@@ -0,0 +1,43 @@
+{ stdenv, fetchgit, autoreconfHook, pkgconfig, gtk-doc, xkeyboard_config, libxml2, xorg, docbook_xsl
+, glib, isocodes, gobject-introspection }:
+
+let
+  version = "5.4";
+in
+stdenv.mkDerivation rec {
+  name = "libxklavier-${version}";
+
+  src = fetchgit {
+    url = "git://anongit.freedesktop.org/git/libxklavier";
+    rev = name;
+    sha256 = "1w1x5mrgly2ldiw3q2r6y620zgd89gk7n90ja46775lhaswxzv7a";
+  };
+
+  outputs = [ "out" "dev" "devdoc" ];
+
+  # TODO: enable xmodmap support, needs xmodmap DB
+  propagatedBuildInputs = with xorg; [ libX11 libXi xkeyboard_config libxml2 libICE glib libxkbfile isocodes ];
+
+  nativeBuildInputs = [ autoreconfHook pkgconfig gtk-doc docbook_xsl ];
+
+  buildInputs = [ gobject-introspection ];
+
+  preAutoreconf = ''
+    export NOCONFIGURE=1
+    gtkdocize
+  '';
+
+  configureFlags = [
+    "--with-xkb-base=${xkeyboard_config}/etc/X11/xkb"
+    "--with-xkb-bin-base=${xorg.xkbcomp}/bin"
+    "--disable-xmodmap-support"
+    "--enable-gtk-doc"
+  ];
+
+  meta = with stdenv.lib; {
+    description = "Library providing high-level API for X Keyboard Extension known as XKB";
+    homepage = http://freedesktop.org/wiki/Software/LibXklavier;
+    license = licenses.lgpl2Plus;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libxl/default.nix b/nixpkgs/pkgs/development/libraries/libxl/default.nix
new file mode 100644
index 000000000000..44949cf2deb4
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libxl/default.nix
@@ -0,0 +1,26 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  pname = "libxl";
+  version = "3.8.4";
+
+  src = fetchurl {
+    url = "http://www.libxl.com/download/${pname}-lin-${version}.tar.gz";
+    sha256 = "0jnvc9ilir3lvs81l6ldnyf6jbfsy7bcs5pkc75qfnvz01y7p6as";
+  };
+
+  phases = [ "unpackPhase" "installPhase" "fixupPhase" ];
+
+  installPhase = ''
+    mkdir $out
+    cp -rva include_c include_cpp license.txt $out/
+    cp -rva lib64 $out/lib
+  '';
+
+  meta = with stdenv.lib; {
+    description = "A lbrary for parsing excel files";
+    license     = licenses.unfree;
+    platforms   = platforms.linux;
+    maintainers = with maintainers; [  ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libxls/default.nix b/nixpkgs/pkgs/development/libraries/libxls/default.nix
new file mode 100644
index 000000000000..a2a576edc0f7
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libxls/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchurl, unzip }:
+
+stdenv.mkDerivation rec {
+  name = "libxls-${version}";
+  version = "1.5.1";
+
+  src = fetchurl {
+    url = "https://github.com/libxls/libxls/releases/download/v${version}/libxls-${version}.tar.gz";
+    sha256 = "0dam8qgbc5ykzaxmrjhpmfm8lnlcdk6cbpzyaya91qwwa80qbj1v";
+  };
+
+  nativeBuildInputs = [ unzip ];
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    description = "Extract Cell Data From Excel xls files";
+    homepage = https://sourceforge.net/projects/libxls/;
+    license = licenses.bsd2;
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ abbradar ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libxmi/default.nix b/nixpkgs/pkgs/development/libraries/libxmi/default.nix
new file mode 100644
index 000000000000..aff5f8ac4451
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libxmi/default.nix
@@ -0,0 +1,21 @@
+{ stdenv, fetchurl, libtool }:
+
+stdenv.mkDerivation {
+  name = "libxmi-1.2";
+
+  src = fetchurl {
+    url = mirror://gnu/libxmi/libxmi-1.2.tar.gz;
+    sha256 = "03d4ikh29l38rl1wavb0icw7m5pp7yilnv7bb2k8qij1dinsymlx";
+  };
+
+  # For the x86_64 GNU/Linux arch to be recognized by 'configure'
+  preConfigure = "cp ${libtool}/share/libtool/build-aux/config.sub .";
+
+  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
+    maintainers = [ ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libxml2/default.nix b/nixpkgs/pkgs/development/libraries/libxml2/default.nix
new file mode 100644
index 000000000000..de131052314a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libxml2/default.nix
@@ -0,0 +1,70 @@
+{ stdenv, lib, fetchurl, fetchpatch
+, zlib, xz, python2, ncurses, findXMLCatalogs
+, pythonSupport ? stdenv.buildPlatform == stdenv.hostPlatform
+, icuSupport ? false, icu ? null
+, enableShared ? stdenv.hostPlatform.libc != "msvcrt"
+, enableStatic ? !enableShared,
+}:
+
+let
+  python = python2;
+
+in stdenv.mkDerivation rec {
+  name = "libxml2-${version}";
+  version = "2.9.9";
+
+  src = fetchurl {
+    url = "http://xmlsoft.org/sources/${name}.tar.gz";
+    sha256 = "0wd881jzvqayx0ihzba29jl80k06xj9ywp16kxacdqs3064p1ywl";
+  };
+
+  outputs = [ "bin" "dev" "out" "man" "doc" ]
+    ++ lib.optional pythonSupport "py"
+    ++ lib.optional (enableStatic && enableShared) "static";
+  propagatedBuildOutputs = "out bin" + lib.optionalString pythonSupport " py";
+
+  buildInputs = lib.optional pythonSupport python
+    ++ lib.optional (pythonSupport && python?isPy3 && python.isPy3) ncurses
+    # Libxml2 has an optional dependency on liblzma.  However, on impure
+    # platforms, it may end up using that from /usr/lib, and thus lack a
+    # RUNPATH for that, leading to undefined references for its users.
+    ++ lib.optional stdenv.isFreeBSD xz;
+
+  propagatedBuildInputs = [ zlib findXMLCatalogs ] ++ lib.optional icuSupport icu;
+
+  configureFlags = [
+    "--exec_prefix=$dev"
+    (lib.enableFeature enableStatic "static")
+    (lib.enableFeature enableShared "shared")
+    (lib.withFeature icuSupport "icu")
+    (lib.withFeatureAs pythonSupport "python" python)
+  ];
+
+  enableParallelBuilding = true;
+
+  doCheck = (stdenv.hostPlatform == stdenv.buildPlatform) && !stdenv.isDarwin &&
+    stdenv.hostPlatform.libc != "musl";
+
+  preInstall = lib.optionalString pythonSupport
+    ''substituteInPlace python/libxml2mod.la --replace "${python}" "$py"'';
+  installFlags = lib.optionalString pythonSupport
+    ''pythondir="$(py)/lib/${python.libPrefix}/site-packages"'';
+
+  postFixup = ''
+    moveToOutput bin/xml2-config "$dev"
+    moveToOutput lib/xml2Conf.sh "$dev"
+    moveToOutput share/man/man1 "$bin"
+  '' + lib.optionalString (enableStatic && enableShared) ''
+    moveToOutput lib/libxml2.a "$static"
+  '';
+
+  passthru = { inherit version; pythonSupport = pythonSupport; };
+
+  meta = {
+    homepage = http://xmlsoft.org/;
+    description = "An XML parsing library for C";
+    license = lib.licenses.mit;
+    platforms = lib.platforms.all;
+    maintainers = [ lib.maintainers.eelco ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libxmlb/default.nix b/nixpkgs/pkgs/development/libraries/libxmlb/default.nix
new file mode 100644
index 000000000000..9edb9b475e8a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libxmlb/default.nix
@@ -0,0 +1,38 @@
+{ stdenv, fetchFromGitHub, meson, ninja, pkgconfig, glib, libuuid, gobject-introspection, gtk-doc, shared-mime-info, python3, docbook_xsl, docbook_xml_dtd_43 }:
+
+stdenv.mkDerivation rec {
+  name = "libxmlb-${version}";
+  version = "0.1.10";
+
+  outputs = [ "out" "lib" "dev" "devdoc" ];
+
+  src = fetchFromGitHub {
+    owner = "hughsie";
+    repo = "libxmlb";
+    rev = version;
+    sha256 = "1ismh3bdwd0l1fjlhwycam89faxjmpb0wxqlbv58m0z6cxykp6rd";
+  };
+
+  nativeBuildInputs = [ meson ninja python3 pkgconfig gobject-introspection gtk-doc shared-mime-info docbook_xsl docbook_xml_dtd_43 ];
+
+  buildInputs = [ glib libuuid ];
+
+  mesonFlags = [
+    "--libexecdir=${placeholder "out"}/libexec"
+    "-Dgtkdoc=true"
+  ];
+
+  preCheck = ''
+    export XDG_DATA_DIRS=$XDG_DATA_DIRS:${shared-mime-info}/share
+  '';
+
+  doCheck = true;
+
+  meta = with stdenv.lib; {
+    description = "A library to help create and query binary XML blobs";
+    homepage = https://github.com/hughsie/libxmlb;
+    license = licenses.lgpl21Plus;
+    maintainers = with maintainers; [ jtojnar ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libxmlxx/default.nix b/nixpkgs/pkgs/development/libraries/libxmlxx/default.nix
new file mode 100644
index 000000000000..c80808081ffb
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libxmlxx/default.nix
@@ -0,0 +1,31 @@
+{ stdenv, fetchurl, pkgconfig, 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";
+    sha256 = "1sb3akryklvh2v6m6dihdnbpf1lkx441v972q9hlz1sq6bfspm2a";
+  };
+
+  outputs = [ "out" "devdoc" ];
+
+  nativeBuildInputs = [ pkgconfig perl ];
+
+  propagatedBuildInputs = [ libxml2 glibmm ];
+
+  passthru = {
+    updateScript = gnome3.updateScript {
+      packageName = pname;
+    };
+  };
+
+  meta = with stdenv.lib; {
+    homepage = "http://libxmlplusplus.sourceforge.net/";
+    description = "C++ wrapper for the libxml2 XML parser library";
+    license = licenses.lgpl2Plus;
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ phreedom ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libxmlxx/v3.nix b/nixpkgs/pkgs/development/libraries/libxmlxx/v3.nix
new file mode 100644
index 000000000000..5e1e947b8f7c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libxmlxx/v3.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchurl, pkgconfig, libxml2, glibmm, perl }:
+
+stdenv.mkDerivation rec {
+  name = "libxml++-${maj_ver}.${min_ver}";
+  maj_ver = "3.0";
+  min_ver = "1";
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/libxml++/${maj_ver}/${name}.tar.xz";
+    sha256 = "19kik79fmg61nv0by0a5f9wchrcfjwzvih4v2waw01hqflhqvp0r";
+  };
+
+  outputs = [ "out" "devdoc" ];
+
+  nativeBuildInputs = [ pkgconfig perl ];
+
+  buildInputs = [ glibmm ];
+
+  propagatedBuildInputs = [ libxml2 ];
+
+  meta = with stdenv.lib; {
+    homepage = http://libxmlplusplus.sourceforge.net/;
+    description = "C++ wrapper for the libxml2 XML parser library, version 3";
+    license = licenses.lgpl2Plus;
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ loskutov ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libxmp/default.nix b/nixpkgs/pkgs/development/libraries/libxmp/default.nix
new file mode 100644
index 000000000000..ca4d7edbf32d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libxmp/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "libxmp-4.4.1";
+
+  meta = with stdenv.lib; {
+    description = "Extended module player library";
+    homepage    = "http://xmp.sourceforge.net/";
+    longDescription = ''
+      Libxmp is a library that renders module files to PCM data. It supports
+      over 90 mainstream and obscure module formats including Protracker (MOD),
+      Scream Tracker 3 (S3M), Fast Tracker II (XM), and Impulse Tracker (IT).
+    '';
+    license     = licenses.lgpl21Plus;
+    platforms   = platforms.linux;
+  };
+
+  src = fetchurl {
+    url = "mirror://sourceforge/xmp/libxmp/${name}.tar.gz";
+    sha256 = "1kycz4jsyvmf7ny9227b497wc7y5ligydi6fvvldmkf8hk63ad9m";
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libxnd/default.nix b/nixpkgs/pkgs/development/libraries/libxnd/default.nix
new file mode 100644
index 000000000000..cb93ec63e670
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libxnd/default.nix
@@ -0,0 +1,39 @@
+{ lib
+, stdenv
+, fetchFromGitHub
+, libndtypes
+}:
+
+stdenv.mkDerivation rec {
+  name = "libxnd-${version}";
+  version = "unstable-2018-11-27";
+
+  src = fetchFromGitHub {
+    owner = "plures";
+    repo = "xnd";
+    rev = "8a9f3bd1d01d872828b40bc9dbd0bc0184524da3";
+    sha256 = "10jh2kqvhpzwy50adayh9az7z2lm16yxy4flrh99alzzbqdyls44";
+  };
+
+  buildInputs = [ libndtypes ];
+
+  # Override linker with cc (symlink to either gcc or clang)
+  # Library expects to use cc for linking
+  configureFlags = [
+      # Override linker with cc (symlink to either gcc or clang)
+      # Library expects to use cc for linking
+      "LD=${stdenv.cc.targetPrefix}cc"
+      # needed for tests
+      "--with-includes=${libndtypes}/include"
+      "--with-libs=${libndtypes}/lib"
+  ];
+
+  doCheck = true;
+
+  meta = {
+    description = "C library for managing typed memory blocks and Python container module";
+    homepage = https://xnd.io/;
+    license = lib.licenses.bsdOriginal;
+    maintainers = with lib.maintainers; [ costrouc ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libxslt/default.nix b/nixpkgs/pkgs/development/libraries/libxslt/default.nix
new file mode 100644
index 000000000000..41633d91f3bd
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libxslt/default.nix
@@ -0,0 +1,66 @@
+{ stdenv, fetchurl, fetchpatch, libxml2, findXMLCatalogs, python2, libgcrypt
+, cryptoSupport ? false
+, pythonSupport ? stdenv.buildPlatform == stdenv.hostPlatform
+}:
+
+assert pythonSupport -> python2 != null;
+assert pythonSupport -> libxml2.pythonSupport;
+
+with stdenv.lib;
+
+stdenv.mkDerivation rec {
+  pname = "libxslt";
+  version = "1.1.33";
+  name = pname + "-" + version;
+
+  src = fetchurl {
+    url = "http://xmlsoft.org/sources/${name}.tar.gz";
+    sha256 = "1j1q1swnsy8jgi9x7mclvkrqhfgn09886gdlr9wzk7a08i8n0dlf";
+  };
+
+  patches = [
+    (fetchpatch {
+      name = "CVE-2019-11068.patch";
+      url = "https://gitlab.gnome.org/GNOME/libxslt/commit/e03553605b45c88f0b4b2980adfbbb8f6fca2fd6.patch";
+      sha256 = "0pkpb4837km15zgg6h57bncp66d5lwrlvkr73h0lanywq7zrwhj8";
+    })
+  ];
+
+  outputs = [ "bin" "dev" "out" "man" "doc" ] ++ stdenv.lib.optional pythonSupport "py";
+
+  buildInputs = [ libxml2.dev ]
+    ++ stdenv.lib.optionals pythonSupport [ libxml2.py python2 ]
+    ++ stdenv.lib.optionals cryptoSupport [ libgcrypt ];
+
+  propagatedBuildInputs = [ findXMLCatalogs ];
+
+  configureFlags = [
+    "--with-libxml-prefix=${libxml2.dev}"
+    "--without-debug"
+    "--without-mem-debug"
+    "--without-debugger"
+  ] ++ optional pythonSupport "--with-python=${python2}"
+    ++ optional (!cryptoSupport) "--without-crypto";
+
+  postFixup = ''
+    moveToOutput bin/xslt-config "$dev"
+    moveToOutput lib/xsltConf.sh "$dev"
+    moveToOutput share/man/man1 "$bin"
+  '' + optionalString pythonSupport ''
+    mkdir -p $py/nix-support
+    echo ${libxml2.py} >> $py/nix-support/propagated-build-inputs
+    moveToOutput lib/python2.7 "$py"
+  '';
+
+  passthru = {
+    inherit pythonSupport;
+  };
+
+  meta = with stdenv.lib; {
+    homepage = http://xmlsoft.org/XSLT/;
+    description = "A C library and tools to do XSL transformations";
+    license = licenses.mit;
+    platforms = platforms.all;
+    maintainers = [ maintainers.eelco ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libyaml-cpp/default.nix b/nixpkgs/pkgs/development/libraries/libyaml-cpp/default.nix
new file mode 100644
index 000000000000..af665c6d9a4a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libyaml-cpp/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchFromGitHub, cmake }:
+
+stdenv.mkDerivation rec {
+  name = "libyaml-cpp-${version}";
+  version = "0.6.2";
+
+  src = fetchFromGitHub {
+    owner = "jbeder";
+    repo = "yaml-cpp";
+    rev = "yaml-cpp-${version}";
+    sha256 = "16lclpa487yghf9019wymj419wkyx4795wv9q7539hhimajw9kpb";
+  };
+
+  outputs = [ "out" "dev" ];
+
+  nativeBuildInputs = [ cmake ];
+
+  cmakeFlags = "-DBUILD_SHARED_LIBS=ON";
+
+  meta = with stdenv.lib; {
+    inherit (src.meta) homepage;
+    description = "A YAML parser and emitter for C++";
+    license = licenses.mit;
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ andir ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libyaml/default.nix b/nixpkgs/pkgs/development/libraries/libyaml/default.nix
new file mode 100644
index 000000000000..c1f34bd33980
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libyaml/default.nix
@@ -0,0 +1,35 @@
+{ stdenv, fetchurl, fetchpatch }:
+
+let
+
+  version = "0.2.1";
+
+  # https://github.com/yaml/pyyaml/issues/214
+  p1 = fetchpatch {
+         url = https://github.com/yaml/libyaml/commit/8ee83c0da22fe9aa7dea667be8f899a7e32ffb83.patch;
+         sha256 = "00jh39zww6s4gyhxfmlxwb6lz90nl3p51k5h1qm6z3ymik5vljmz";
+       };
+  p2 = fetchpatch {
+         url = https://github.com/yaml/libyaml/commit/56f4b17221868593d6903ee58d6d679b690cf4df.patch;
+         sha256 = "0najcay1y4kgfpsidj7dnyafnwjbav5jyawhyv215zl9gg3386n0";
+       };
+
+in
+
+stdenv.mkDerivation {
+  name = "libyaml-${version}";
+
+  src = fetchurl {
+    url = "https://pyyaml.org/download/libyaml/yaml-${version}.tar.gz";
+    sha256 = "1karpcfgacgppa82wm2drcfn2kb6q2wqfykf5nrhy20sci2i2a3q";
+  };
+
+  patches = [ p1 p2 ];  # remove when the next release comes out
+
+  meta = with stdenv.lib; {
+    homepage = https://pyyaml.org/;
+    description = "A YAML 1.1 parser and emitter written in C";
+    license = licenses.mit;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libykclient/default.nix b/nixpkgs/pkgs/development/libraries/libykclient/default.nix
new file mode 100644
index 000000000000..9aa189586f05
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libykclient/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, fetchFromGitHub, autoreconfHook, pkgconfig, help2man, curl }:
+
+stdenv.mkDerivation rec {
+  pname = "libykclient";
+  version = "unstable-2019-03-18";
+  src = fetchFromGitHub {
+    owner = "Yubico";
+    repo = "yubico-c-client";
+    rev = "ad9eda6aac4c3f81784607c30b971f4a050b5c2e";
+    sha256 = "01b19jgv2lypih6lhw9yjjsfl8q1ahl955vhr2ai8ccshh0050yj";
+  };
+
+  nativeBuildInputs = [ autoreconfHook pkgconfig help2man ];
+  buildInputs = [ curl ];
+
+  meta = with stdenv.lib; {
+    description = "Yubikey C client library";
+    homepage = https://developers.yubico.com/yubico-c-client;
+    license = licenses.bsd2;
+    maintainers = with maintainers; [ dtzWill ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libykneomgr/default.nix b/nixpkgs/pkgs/development/libraries/libykneomgr/default.nix
new file mode 100644
index 000000000000..be493828486c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libykneomgr/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchurl, pkgconfig, pcsclite, libzip, help2man }:
+
+stdenv.mkDerivation rec {
+  name = "libykneomgr-0.1.8";
+
+  src = fetchurl {
+    url = "https://developers.yubico.com/libykneomgr/Releases/${name}.tar.gz";
+    sha256 = "12gqblz400kr11m1fdr1vvwr85lgy5v55zy0cf782whpk8lyyj97";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ pcsclite libzip help2man ];
+
+  configureFlags = [
+    "--with-backend=pcsc"
+  ];
+
+  meta = with stdenv.lib; {
+    homepage = https://developers.yubico.com/libykneomgr;
+    description = "A C library to interact with the CCID-part of the Yubikey NEO";
+    license = licenses.bsd3;
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libytnef/default.nix b/nixpkgs/pkgs/development/libraries/libytnef/default.nix
new file mode 100644
index 000000000000..710e7a3f0729
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libytnef/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, lib, fetchFromGitHub, autoreconfHook }:
+
+with lib;
+
+stdenv.mkDerivation rec {
+  name = "libytnef-${version}";
+  version = "1.9.3";
+
+  src = fetchFromGitHub {
+    owner = "Yeraze";
+    repo = "ytnef";
+    rev = "v${version}";
+    sha256 = "07h48s5qf08503pp9kafqbwipdqghiif22ghki7z8j67gyp04l6l";
+  };
+
+  nativeBuildInputs = [ autoreconfHook ];
+
+  meta = {
+    inherit (src.meta) homepage;
+    description = "Yeraze's TNEF Stream Reader - for winmail.dat files";
+    license = licenses.gpl2Plus;
+    platforms = platforms.all;
+    maintainers = with maintainers; [ fpletz ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libyubikey/default.nix b/nixpkgs/pkgs/development/libraries/libyubikey/default.nix
new file mode 100644
index 000000000000..010eecb0fa97
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libyubikey/default.nix
@@ -0,0 +1,17 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "libyubikey-1.13";
+
+  src = fetchurl {
+    url = "https://developers.yubico.com/yubico-c/Releases/${name}.tar.gz";
+    sha256 = "009l3k2zyn06dbrlja2d4p2vfnzjhlcqxi88v02mlrnb17mx1v84";
+  };
+
+  meta = with stdenv.lib; {
+    homepage = http://opensource.yubico.com/yubico-c/;
+    description = "C library for manipulating Yubico YubiKey One-Time Passwords (OTPs)";
+    license = licenses.bsd2;
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libzapojit/default.nix b/nixpkgs/pkgs/development/libraries/libzapojit/default.nix
new file mode 100644
index 000000000000..2ad017dc90be
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libzapojit/default.nix
@@ -0,0 +1,30 @@
+{ stdenv, fetchurl, pkgconfig, glib, intltool, json-glib, librest, libsoup, gnome3, gobject-introspection }:
+
+stdenv.mkDerivation rec {
+  pname = "libzapojit";
+  version = "0.0.3";
+
+  outputs = [ "out" "dev" ];
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    sha256 = "0zn3s7ryjc3k1abj4k55dr2na844l451nrg9s6cvnnhh569zj99x";
+  };
+
+  nativeBuildInputs = [ pkgconfig intltool gobject-introspection ];
+  propagatedBuildInputs = [ glib json-glib librest libsoup gnome3.gnome-online-accounts ]; # zapojit-0.0.pc
+
+  passthru = {
+    updateScript = gnome3.updateScript {
+      packageName = pname;
+    };
+  };
+
+  meta = with stdenv.lib; {
+    description = "GObject wrapper for the SkyDrive and Hotmail REST APIs";
+    homepage = https://wiki.gnome.org/Projects/Zapojit;
+    license = licenses.lgpl21Plus;
+    maintainers = gnome3.maintainers;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libzdb/default.nix b/nixpkgs/pkgs/development/libraries/libzdb/default.nix
new file mode 100644
index 000000000000..f3cbddf1ec41
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libzdb/default.nix
@@ -0,0 +1,24 @@
+{stdenv, fetchurl, sqlite}:
+
+stdenv.mkDerivation rec
+{
+  version = "3.1";
+  name = "libzdb-${version}";
+
+  src = fetchurl
+  {
+    url = "https://www.tildeslash.com/libzdb/dist/libzdb-${version}.tar.gz";
+    sha256 = "1596njvy518x7vsvsykmnk1ky82x8jxd6nmmp551y6hxn2qsn08g";
+  };
+
+  buildInputs = [ sqlite ];
+
+  meta =
+  {
+    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;
+    maintainers = [ ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libzen/default.nix b/nixpkgs/pkgs/development/libraries/libzen/default.nix
new file mode 100644
index 000000000000..afa7696aca99
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libzen/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchurl, autoreconfHook }:
+
+stdenv.mkDerivation rec {
+  version = "0.4.37";
+  name = "libzen-${version}";
+  src = fetchurl {
+    url = "https://mediaarea.net/download/source/libzen/${version}/libzen_${version}.tar.bz2";
+    sha256 = "1hcsrmn85b0xp0mp33aazk7g071q1v3f163nnhv8b0mv9c4bgsfn";
+  };
+
+  nativeBuildInputs = [ autoreconfHook ];
+  configureFlags = [ "--enable-shared" ];
+
+  sourceRoot = "./ZenLib/Project/GNU/Library/";
+
+  preConfigure = "sh autogen.sh";
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    description = "Shared library for libmediainfo and mediainfo";
+    homepage = https://mediaarea.net/;
+    license = licenses.bsd2;
+    platforms = platforms.unix;
+    maintainers = [ maintainers.devhell ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libzip/default.nix b/nixpkgs/pkgs/development/libraries/libzip/default.nix
new file mode 100644
index 000000000000..50ed00711df7
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libzip/default.nix
@@ -0,0 +1,41 @@
+{ stdenv, fetchurl, perl, zlib }:
+
+stdenv.mkDerivation rec {
+  name = "libzip-${version}";
+  version = "1.3.0";
+
+  src = fetchurl {
+    url = "https://www.nih.at/libzip/${name}.tar.gz";
+    sha256 = "1633dvjc08zwwhzqhnv62rjf1abx8y5njmm8y16ik9iwd07ka6d9";
+  };
+
+  postPatch = ''
+    patchShebangs test-driver
+    patchShebangs man/handle_links
+  '';
+
+  outputs = [ "out" "dev" ];
+
+  nativeBuildInputs = [ perl ];
+  propagatedBuildInputs = [ zlib ];
+
+  preCheck = ''
+    # regress/runtests is a generated file
+    patchShebangs regress
+  '';
+
+  # At least mysqlWorkbench cannot find zipconf.h; I think also openoffice
+  # had this same problem.  This links it somewhere that mysqlworkbench looks.
+  postInstall = ''
+    mkdir -p $dev/lib
+    mv $out/lib/libzip $dev/lib/libzip
+    ( cd $dev/include ; ln -s ../lib/libzip/include/zipconf.h zipconf.h )
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = https://www.nih.at/libzip;
+    description = "A C library for reading, creating and modifying zip archives";
+    license = licenses.bsd3;
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libzmf/default.nix b/nixpkgs/pkgs/development/libraries/libzmf/default.nix
new file mode 100644
index 000000000000..1413da4a18db
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libzmf/default.nix
@@ -0,0 +1,27 @@
+{stdenv, fetchurl, boost, icu, libpng, librevenge, zlib, doxygen, pkgconfig, cppunit}:
+
+stdenv.mkDerivation rec {
+  name = "${pname}-${version}";
+  pname = "libzmf";
+  version = "0.0.2";
+
+  src = fetchurl {
+    url = "http://dev-www.libreoffice.org/src/libzmf/${name}.tar.xz";
+    sha256 = "08mg5kmkjrmqrd8j5rkzw9vdqlvibhb1ynp6bmfxnzq5rcq1l197";
+  };
+
+  buildInputs = [ boost icu libpng librevenge zlib cppunit ];
+  nativeBuildInputs = [ doxygen pkgconfig ];
+  configureFlags = [ "--disable-werror" ];
+
+  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;
+    homepage = https://wiki.documentfoundation.org/DLP/Libraries/libzmf;
+    downloadPage = "http://dev-www.libreoffice.org/src/libzmf/";
+    updateWalker = true;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/lief/default.nix b/nixpkgs/pkgs/development/libraries/lief/default.nix
new file mode 100644
index 000000000000..410c60bff9f3
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/lief/default.nix
@@ -0,0 +1,14 @@
+{ 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; {
+    description = "Library to Instrument Executable Formats";
+    homepage = https://lief.quarkslab.com/;
+    license = [ licenses.asl20 ];
+    platforms = platforms.linux;
+    maintainers = [ maintainers.lassulus ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/lightning/default.nix b/nixpkgs/pkgs/development/libraries/lightning/default.nix
new file mode 100644
index 000000000000..3f963c7ca19a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/lightning/default.nix
@@ -0,0 +1,32 @@
+{ stdenv, fetchurl, libopcodes }:
+
+with stdenv.lib;
+stdenv.mkDerivation rec {
+
+  name = "lightning-${version}";
+  version = "2.1.2";
+
+  src = fetchurl {
+    url = "mirror://gnu/lightning/${name}.tar.gz";
+    sha256 = "0sbs2lm8b9in2m8d52zf0x9gpp40x6r7sl6sha92yq3pr78rwa4v";
+  };
+
+  checkInputs = [ libopcodes ];
+
+  doCheck = true;
+
+  meta = {
+    homepage = https://www.gnu.org/software/lightning/;
+    description = "Run-time code generation library";
+    longDescription = ''
+      GNU lightning is a library that generates assembly language code
+      at run-time; it is very fast, making it ideal for Just-In-Time
+      compilers, and it abstracts over the target CPU, as it exposes
+      to the clients a standardized RISC instruction set inspired by
+      the MIPS and SPARC chips.
+    '';
+    maintainers = [ maintainers.AndersonTorres ];
+    license = licenses.lgpl3Plus;
+    platforms = stdenv.lib.platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/lightstep-tracer-cpp/default.nix b/nixpkgs/pkgs/development/libraries/lightstep-tracer-cpp/default.nix
new file mode 100644
index 000000000000..ab0e51bae261
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/lightstep-tracer-cpp/default.nix
@@ -0,0 +1,49 @@
+{ stdenv, lib, fetchFromGitHub, pkgconfig, protobuf, cmake, zlib
+, opentracing-cpp, enableGrpc ? false
+}:
+
+let
+  # be sure to use the right revision based on the submodule!
+  common =
+    fetchFromGitHub {
+      owner = "lightstep";
+      repo = "lightstep-tracer-common";
+      rev = "5fe3bf885bcece14c3c65df06c86c826ba45ad69";
+      sha256 = "1q39a0zaqbnqyhl2hza2xzc44235p65bbkfkzs2981niscmggq8w";
+    };
+
+in
+
+stdenv.mkDerivation rec {
+  name = "lightstep-tracer-cpp-${version}";
+  version = "0.8.1";
+
+  src = fetchFromGitHub {
+    owner = "lightstep";
+    repo = "lightstep-tracer-cpp";
+    rev = "v${version}";
+    sha256 = "1m4kl70lhvy1bsmkdh6bf2fddz5v1ikb27vgi99i2akpq40g4fvf";
+  };
+
+  postUnpack = ''
+    cp -r ${common}/* $sourceRoot/lightstep-tracer-common
+  '';
+
+  cmakeFlags = ["-DOPENTRACING_INCLUDE_DIR=${opentracing-cpp}/include" "-DOPENTRACING_LIBRARY=${opentracing-cpp}/lib/libopentracing.so"] ++ lib.optional (!enableGrpc) [ "-DWITH_GRPC=OFF" ];
+
+  nativeBuildInputs = [
+    pkgconfig cmake
+  ];
+
+  buildInputs = [
+    protobuf zlib
+  ];
+
+  meta = with lib; {
+    description = "Distributed tracing system built on top of the OpenTracing standard";
+    homepage = "https://lightstep.com/";
+    license = licenses.mit;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ cstrahan ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/linbox/default.nix b/nixpkgs/pkgs/development/libraries/linbox/default.nix
new file mode 100644
index 000000000000..11f975187b0b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/linbox/default.nix
@@ -0,0 +1,67 @@
+{ stdenv
+, fetchFromGitHub
+, fetchpatch
+, autoreconfHook
+, givaro
+, pkgconfig
+, blas
+, fflas-ffpack
+, gmpxx
+, withSage ? false # sage support
+}:
+stdenv.mkDerivation rec {
+  name = "${pname}-${version}";
+  pname = "linbox";
+  version = "1.6.2";
+
+
+  src = fetchFromGitHub {
+    owner = "linbox-team";
+    repo = "${pname}";
+    rev = "v${version}";
+    sha256 = "038br15hhc8dc1hq0pkv6vb1qx9hjr7hjv3w9fq9qwkd870h2v1q";
+  };
+
+  nativeBuildInputs = [
+    autoreconfHook
+    pkgconfig
+  ];
+
+  buildInputs = [
+    givaro
+    blas
+    gmpxx
+    fflas-ffpack
+  ];
+
+  configureFlags = [
+    "--with-blas-libs=-l${blas.linkName}"
+    "--disable-optimization"
+  ] ++ stdenv.lib.optionals stdenv.isx86_64 {
+    # disable SIMD instructions (which are enabled *when available* by default)
+    "default"        = [ "--disable-sse3" "--disable-ssse3" "--disable-sse41" "--disable-sse42" "--disable-avx" "--disable-avx2" "--disable-fma" "--disable-fma4" ];
+    "westmere"       = [                                                                        "--disable-avx" "--disable-avx2" "--disable-fma" "--disable-fma4" ];
+    "sandybridge"    = [                                                                                        "--disable-avx2" "--disable-fma" "--disable-fma4" ];
+    "ivybridge"      = [                                                                                        "--disable-avx2" "--disable-fma" "--disable-fma4" ];
+    "haswell"        = [                                                                                                                         "--disable-fma4" ];
+    "broadwell"      = [                                                                                                                         "--disable-fma4" ];
+    "skylake"        = [                                                                                                                         "--disable-fma4" ];
+    "skylake-avx512" = [                                                                                                                         "--disable-fma4" ];
+  }.${stdenv.hostPlatform.platform.gcc.arch or "default"}
+  ++ stdenv.lib.optionals withSage [
+    "--enable-sage"
+  ];
+
+  doCheck = true;
+
+  enableParallelBuilding = true;
+
+  meta = {
+    inherit version;
+    description = "C++ library for exact, high-performance linear algebra";
+    license = stdenv.lib.licenses.lgpl21Plus;
+    maintainers = [stdenv.lib.maintainers.timokau];
+    platforms = stdenv.lib.platforms.unix;
+    homepage = http://linalg.org/;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/linenoise-ng/default.nix b/nixpkgs/pkgs/development/libraries/linenoise-ng/default.nix
new file mode 100644
index 000000000000..5fa1035868d1
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/linenoise-ng/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchFromGitHub, cmake }:
+
+stdenv.mkDerivation rec {
+  name = "linenoise-ng-${version}";
+  version = "1.0.1";
+
+  src = fetchFromGitHub {
+    owner = "arangodb";
+    repo = "linenoise-ng";
+    rev = "v${version}";
+    sha256 = "176iz0kj0p8d8i3jqps4z8xkxwl3f1986q88i9xg5fvqgpzsxp20";
+  };
+
+  nativeBuildInputs = [ cmake ];
+
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/linenoise/create-pkg-config-file.sh b/nixpkgs/pkgs/development/libraries/linenoise/create-pkg-config-file.sh
new file mode 100755
index 000000000000..e3c38f05ab4c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/linenoise/create-pkg-config-file.sh
@@ -0,0 +1,13 @@
+cat <<EOF > linenoise.pc
+prefix=$out
+exec_prefix=\${prefix}
+libdir=\${exec_prefix}/lib
+includedir=\${prefix}/include
+
+Name: linenoise
+Description: A minimal, zero-config, BSD licensed, readline replacement.
+Requires:
+Version: 1.0.10
+Cflags: -I\${includedir}/ \${prefix}/src/linenoise.c
+
+EOF
diff --git a/nixpkgs/pkgs/development/libraries/linenoise/default.nix b/nixpkgs/pkgs/development/libraries/linenoise/default.nix
new file mode 100644
index 000000000000..6bbcc725f22f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/linenoise/default.nix
@@ -0,0 +1,30 @@
+{ stdenv, fetchFromGitHub }:
+
+stdenv.mkDerivation rec {
+  name = "linenoise-${version}";
+  version = "1.0.10";  # Its version 1.0 plus 10 commits
+
+  src = fetchFromGitHub {
+    owner = "antirez";
+    repo = "linenoise";
+    rev = "c894b9e59f02203dbe4e2be657572cf88c4230c3";
+    sha256 = "0wasql7ph5g473zxhc2z47z3pjp42q0dsn4gpijwzbxawid71b4w";
+  };
+
+  buildPhase = ./create-pkg-config-file.sh;
+
+  installPhase = ''
+    mkdir -p $out/{lib/pkgconfig,src,include}
+    cp linenoise.c $out/src/
+    cp linenoise.h $out/include/
+    cp linenoise.pc $out/lib/pkgconfig/
+  '';
+
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/liquid-dsp/default.nix b/nixpkgs/pkgs/development/libraries/liquid-dsp/default.nix
new file mode 100644
index 000000000000..391606d59e68
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/liquid-dsp/default.nix
@@ -0,0 +1,23 @@
+{stdenv, fetchFromGitHub, autoreconfHook }:
+
+stdenv.mkDerivation rec {
+  name = "liquid-dsp-${version}";
+  version = "20170307";
+
+  src = fetchFromGitHub {
+    owner = "jgaeddert";
+    repo = "liquid-dsp";
+    rev = "8c1978fa4f5662b8849fe712be716958f29cec0e";
+    sha256 = "0zpxvdsrw0vzzp3iaag3wh4z8ygl7fkswgjppp2fz2zhhqh93k2w";
+  };
+
+  nativeBuildInputs = [ autoreconfHook ];
+
+  meta = {
+    homepage = http://liquidsdr.org/;
+    description = "Digital signal processing library for software-defined radios";
+    license = stdenv.lib.licenses.mit;
+    platforms = stdenv.lib.platforms.unix;
+  };
+
+}
diff --git a/nixpkgs/pkgs/development/libraries/liquidfun/default.nix b/nixpkgs/pkgs/development/libraries/liquidfun/default.nix
new file mode 100644
index 000000000000..9c1815f840b4
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/liquidfun/default.nix
@@ -0,0 +1,48 @@
+{ stdenv, requireFile, cmake, libGLU_combined, libX11, libXi }:
+
+let 
+  sourceInfo = rec {
+    version="1.1.0";
+    name="liquidfun-${version}";
+    url="https://github.com/google/liquidfun/releases/download/v${version}/${name}";
+    hash="5011a000eacd6202a47317c489e44aa753a833fb562d970e7b8c0da9de01df86";
+  };
+in
+stdenv.mkDerivation rec {
+  src = requireFile {
+    url = sourceInfo.url;
+    sha256 = sourceInfo.hash;
+    name = sourceInfo.name + ".tar.gz";
+  };
+
+  inherit (sourceInfo) name version;
+  buildInputs = [ cmake libGLU_combined libX11 libXi ];
+
+  sourceRoot = "liquidfun/Box2D/";
+
+  preConfigurePhases = "preConfigure";
+
+  preConfigure = ''
+    sed -i Box2D/Common/b2Settings.h -e 's@b2_maxPolygonVertices .*@b2_maxPolygonVertices 15@'
+    substituteInPlace Box2D/CMakeLists.txt --replace "Common/b2GrowableStack.h" "Common/b2GrowableStack.h Common/b2GrowableBuffer.h"
+  '';
+      
+  configurePhase = ''
+    mkdir Build
+    cd Build; 
+    cmake -DBOX2D_INSTALL=ON -DBOX2D_BUILD_SHARED=ON -DCMAKE_INSTALL_PREFIX=$out ..
+  '';
+
+  meta = {
+    description = "2D physics engine based on Box2D";
+    maintainers = with stdenv.lib.maintainers;
+    [
+      qknight
+    ];
+    platforms = stdenv.lib.platforms.linux;
+    hydraPlatforms = [];
+    license = stdenv.lib.licenses.bsd2;
+    homepage = https://google.github.io/liquidfun/;
+  };
+}
+
diff --git a/nixpkgs/pkgs/development/libraries/lirc/default.nix b/nixpkgs/pkgs/development/libraries/lirc/default.nix
new file mode 100644
index 000000000000..13fbe2b55b67
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/lirc/default.nix
@@ -0,0 +1,58 @@
+{ stdenv, fetchurl, fetchpatch, autoreconfHook, pkgconfig, help2man, python3,
+  alsaLib, xlibsWrapper, libxslt, systemd, libusb, libftdi1 }:
+
+stdenv.mkDerivation rec {
+  name = "lirc-0.10.1";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/lirc/${name}.tar.bz2";
+    sha256 = "1whlyifvvc7w04ahq07nnk1h18wc8j7c6wnvlb6mszravxh3qxcb";
+  };
+
+  # Fix installation of Python bindings
+  patches = [ (fetchpatch {
+    url = "https://sourceforge.net/p/lirc/tickets/339/attachment/0001-Fix-Python-bindings.patch";
+    sha256 = "088a39x8c1qd81qwvbiqd6crb2lk777wmrs8rdh1ga06lglyvbly";
+  }) ];
+
+  postPatch = ''
+    patchShebangs .
+
+    # fix overriding PYTHONPATH
+    sed -i 's,^PYTHONPATH *= *,PYTHONPATH := $(PYTHONPATH):,' \
+      Makefile.in
+    sed -i 's,PYTHONPATH=,PYTHONPATH=$(PYTHONPATH):,' \
+      doc/Makefile.in
+  '';
+
+  preConfigure = ''
+    # use empty inc file instead of a from linux kernel generated one
+    touch lib/lirc/input_map.inc
+  '';
+
+  nativeBuildInputs = [ autoreconfHook pkgconfig help2man
+    (python3.withPackages (p: with p; [ pyyaml setuptools ])) ];
+
+  buildInputs = [ alsaLib xlibsWrapper libxslt systemd libusb libftdi1 ];
+
+  configureFlags = [
+    "--sysconfdir=/etc"
+    "--localstatedir=/var"
+    "--with-systemdsystemunitdir=$(out)/lib/systemd/system"
+    "--enable-uinput" # explicit activation because build env has no uinput
+    "--enable-devinput" # explicit activation because build env has no /dev/input
+  ];
+
+  installFlags = [
+    "sysconfdir=$out/etc"
+    "localstatedir=$TMPDIR"
+  ];
+
+  meta = with stdenv.lib; {
+    description = "Allows to receive and send infrared signals";
+    homepage = http://www.lirc.org/;
+    license = licenses.gpl2;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ pSub ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/live555/default.nix b/nixpkgs/pkgs/development/libraries/live555/default.nix
new file mode 100644
index 000000000000..bf5b7bb1d0da
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/live555/default.nix
@@ -0,0 +1,62 @@
+{ stdenv, fetchurl, lib, darwin }:
+
+# Based on https://projects.archlinux.org/svntogit/packages.git/tree/trunk/PKGBUILD
+stdenv.mkDerivation rec {
+  name = "live555-${version}";
+  version = "2019.05.29";
+
+  src = fetchurl { # the upstream doesn't provide a stable URL
+    urls = [
+      "mirror://sourceforge/slackbuildsdirectlinks/live.${version}.tar.gz"
+      "https://download.videolan.org/contrib/live555/live.${version}.tar.gz"
+    ];
+    sha256 = "08i63jr8ihn1xiq5z5n3yls3yz6li5sg0s454l56p5bcvbrw81my";
+  };
+
+  postPatch = ''
+    sed 's,/bin/rm,rm,g' -i genMakefiles
+    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) ''
+    substituteInPlace liveMedia/include/Locale.hh \
+      --replace '<xlocale.h>' '<locale.h>'
+  '';
+
+  configurePhase = ''
+    runHook preConfigure
+
+    ./genMakefiles ${{
+      x86_64-darwin = "macosx";
+      i686-linux = "linux";
+      x86_64-linux = "linux-64bit";
+      aarch64-linux = "linux-64bit";
+    }.${stdenv.hostPlatform.system}}
+
+    runHook postConfigure
+  '';
+
+  installPhase = ''
+    runHook preInstall
+
+    for dir in BasicUsageEnvironment groupsock liveMedia UsageEnvironment; do
+      install -dm755 $out/{bin,lib,include/$dir}
+      install -m644 $dir/*.a "$out/lib"
+      install -m644 $dir/include/*.h* "$out/include/$dir"
+    done
+
+    runHook postInstall
+  '';
+
+  nativeBuildInputs = lib.optional stdenv.isDarwin darwin.cctools;
+
+  enableParallelBuilding = true;
+
+  meta = with lib; {
+    description = "Set of C++ libraries for multimedia streaming, using open standard protocols (RTP/RTCP, RTSP, SIP)";
+    homepage = http://www.live555.com/liveMedia/;
+    license = licenses.lgpl21Plus;
+    platforms = platforms.unix;
+    broken = stdenv.hostPlatform.isAarch64;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/lmdb/default.nix b/nixpkgs/pkgs/development/libraries/lmdb/default.nix
new file mode 100644
index 000000000000..9d57d4721820
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/lmdb/default.nix
@@ -0,0 +1,61 @@
+{ stdenv, fetchFromGitHub }:
+
+stdenv.mkDerivation rec {
+  name = "lmdb-${version}";
+  version = "0.9.23";
+
+  src = fetchFromGitHub {
+    owner = "LMDB";
+    repo = "lmdb";
+    rev = "LMDB_${version}";
+    sha256 = "0ag7l5180ajvm73y59m7sn3p52xm8m972d08cshxhpwgwa4v35k6";
+  };
+
+  postUnpack = "sourceRoot=\${sourceRoot}/libraries/liblmdb";
+
+  patches = [ ./hardcoded-compiler.patch ];
+  patchFlags = "-p3";
+
+  outputs = [ "bin" "out" "dev" ];
+
+  makeFlags = [
+    "prefix=$(out)"
+    "CC=${stdenv.cc.targetPrefix}cc"
+    "AR=${stdenv.cc.targetPrefix}ar"
+  ]
+    ++ stdenv.lib.optional stdenv.isDarwin "LDFLAGS=-Wl,-install_name,$(out)/lib/liblmdb.so";
+
+  doCheck = true;
+  checkPhase = "make test";
+
+  postInstall = ''
+    moveToOutput bin "$bin"
+  ''
+    # add lmdb.pc (dynamic only)
+    + ''
+    mkdir -p "$dev/lib/pkgconfig"
+    cat > "$dev/lib/pkgconfig/lmdb.pc" <<EOF
+    Name: lmdb
+    Description: ${meta.description}
+    Version: ${version}
+
+    Cflags: -I$dev/include
+    Libs: -L$out/lib -llmdb
+    EOF
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Lightning memory-mapped database";
+    longDescription = ''
+      LMDB is an ultra-fast, ultra-compact key-value embedded data store
+      developed by Symas for the OpenLDAP Project. It uses memory-mapped files,
+      so it has the read performance of a pure in-memory database while still
+      offering the persistence of standard disk-based databases, and is only
+      limited to the size of the virtual address space.
+    '';
+    homepage = http://symas.com/mdb/;
+    maintainers = with maintainers; [ jb55 vcunat ];
+    license = licenses.openldap;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/lmdb/hardcoded-compiler.patch b/nixpkgs/pkgs/development/libraries/lmdb/hardcoded-compiler.patch
new file mode 100644
index 000000000000..ddb247b7f113
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/lmdb/hardcoded-compiler.patch
@@ -0,0 +1,26 @@
+commit 029031a68873bc3784a8561bd8e049efbd34f9d0 (HEAD)
+Author: Vladimír Čunát <vcunat@gmail.com>
+Date:   Sun Apr 1 11:05:31 2018 +0200
+
+    make: gcc -> $(CC)
+
+diff --git a/libraries/liblmdb/Makefile b/libraries/liblmdb/Makefile
+index f254511..612484e 100644
+--- a/libraries/liblmdb/Makefile
++++ b/libraries/liblmdb/Makefile
+@@ -102,13 +102,13 @@ COV_OBJS=xmdb.o xmidl.o
+ 
+ coverage: xmtest
+ 	for i in mtest*.c [0-9]*.c; do j=`basename \$$i .c`; $(MAKE) $$j.o; \
+-		gcc -o x$$j $$j.o $(COV_OBJS) -pthread $(COV_FLAGS); \
++		$(CC) -o x$$j $$j.o $(COV_OBJS) -pthread $(COV_FLAGS); \
+ 		rm -rf testdb; mkdir testdb; ./x$$j; done
+ 	gcov xmdb.c
+ 	gcov xmidl.c
+ 
+ xmtest:	mtest.o xmdb.o xmidl.o
+-	gcc -o xmtest mtest.o xmdb.o xmidl.o -pthread $(COV_FLAGS)
++	$(CC) -o xmtest mtest.o xmdb.o xmidl.o -pthread $(COV_FLAGS)
+ 
+ xmdb.o: mdb.c lmdb.h midl.h
+ 	$(CC) $(CFLAGS) -fPIC $(CPPFLAGS) -O0 $(COV_FLAGS) -c mdb.c -o $@
diff --git a/nixpkgs/pkgs/development/libraries/lmdbxx/default.nix b/nixpkgs/pkgs/development/libraries/lmdbxx/default.nix
new file mode 100644
index 000000000000..232a67c23f3b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/lmdbxx/default.nix
@@ -0,0 +1,26 @@
+{ stdenv
+, fetchFromGitHub
+, lmdb }:
+
+stdenv.mkDerivation rec {
+  name = "lmdbxx-${version}";
+  version = "0.9.14.0";
+
+  src = fetchFromGitHub {
+    owner = "drycpp";
+    repo = "lmdbxx";
+    rev = "${version}";
+    sha256 = "1jmb9wg2iqag6ps3z71bh72ymbcjrb6clwlkgrqf1sy80qwvlsn6";
+  };
+
+  buildInputs = [ lmdb ];
+  makeFlags = [ "PREFIX=$(out)" ];
+
+  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 ];
+  };
+}
+
diff --git a/nixpkgs/pkgs/development/libraries/loadcaffe/default.nix b/nixpkgs/pkgs/development/libraries/loadcaffe/default.nix
new file mode 100644
index 000000000000..f0904726eedf
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/loadcaffe/default.nix
@@ -0,0 +1,19 @@
+{stdenv, fetchFromGitHub, cmake, torch, protobuf, protobufc}:
+stdenv.mkDerivation rec {
+  name = "loadcaffe-${version}";
+  version = "0.0pre2016.08.01";
+  buildInputs = [cmake torch protobuf protobufc];
+  src = fetchFromGitHub {
+    owner = "szagoruyko";
+    repo = "loadcaffe";
+    rev = "9be65cf6fa08e9333eae3553f68a8082debe9978";
+    sha256 = "0b22hvd9nvjsan2h93nl6y34kkkbs36d0k1zr3csjfb5l13xz0lh";
+  };
+  meta = {
+    inherit version;
+    description = ''Torch7 loader for Caffe networks'';
+    license = stdenv.lib.licenses.bsd2 ;
+    maintainers = [stdenv.lib.maintainers.raskin];
+    platforms = stdenv.lib.platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/log4cplus/default.nix b/nixpkgs/pkgs/development/libraries/log4cplus/default.nix
new file mode 100644
index 000000000000..cc86ab19379d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/log4cplus/default.nix
@@ -0,0 +1,20 @@
+{ stdenv, fetchurl }:
+
+let
+  name = "log4cplus-2.0.4";
+in
+stdenv.mkDerivation {
+  inherit name;
+
+  src = fetchurl {
+    url = "mirror://sourceforge/log4cplus/${name}.tar.bz2";
+    sha256 = "0lh2i22znx573jchcfy4n5lrr9yjg2hd3iphhlih61zzmd67p2hc";
+  };
+
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/log4cpp/default.nix b/nixpkgs/pkgs/development/libraries/log4cpp/default.nix
new file mode 100644
index 000000000000..d2918c87f335
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/log4cpp/default.nix
@@ -0,0 +1,19 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "log4cpp-1.1.3";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/log4cpp/${name}.tar.gz";
+    sha256 = "07gmr3jyaf2239n9sp6h7hwdz1pv7b7aka8n06gmr2fnlmaymfrc";
+  };
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    homepage    = "http://log4cpp.sourceforge.net/";
+    description = "A logging framework for C++ patterned after Apache log4j";
+    license     = licenses.lgpl21Plus;
+    platforms   = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/log4cxx/default.nix b/nixpkgs/pkgs/development/libraries/log4cxx/default.nix
new file mode 100644
index 000000000000..8e8541564245
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/log4cxx/default.nix
@@ -0,0 +1,42 @@
+{ stdenv, fetchurl, libtool, libxml2, cppunit, boost
+, apr, aprutil, db, expat
+}:
+
+stdenv.mkDerivation rec {
+  name = "log4cxx-${version}";
+  version = "0.10.0";
+
+  src = fetchurl {
+    url = "http://apache.mirrors.hoobly.com/logging/log4cxx/${version}/apache-${name}.tar.gz";
+    sha256 = "130cjafck1jlqv92mxbn47yhxd2ccwwnprk605c6lmm941i3kq0d";
+  };
+
+  patches = [
+    # adapted from upstream commit; will be fixed in next version
+    ./narrowing-fixes.patch
+  ];
+
+  postPatch = ''
+    sed -i -e '1,/^#include/ {
+      /^#include/i \
+        #include <cstdio> \
+        #include <cstdlib> \
+        #include <cstring>
+    }' src/examples/cpp/console.cpp \
+       src/main/cpp/inputstreamreader.cpp \
+       src/main/cpp/socketoutputstream.cpp
+  '' + stdenv.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
+  '';
+
+  buildInputs = [ libxml2 cppunit boost apr aprutil db expat ];
+  nativeBuildInputs = [ libtool ];
+
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/log4cxx/narrowing-fixes.patch b/nixpkgs/pkgs/development/libraries/log4cxx/narrowing-fixes.patch
new file mode 100644
index 000000000000..e583e7661d1d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/log4cxx/narrowing-fixes.patch
@@ -0,0 +1,117 @@
+diff --git a/src/main/cpp/locationinfo.cpp b/src/main/cpp/locationinfo.cpp
+index e76ea29..bd22a1d 100644
+--- a/src/main/cpp/locationinfo.cpp
++++ b/src/main/cpp/locationinfo.cpp
+@@ -149,18 +149,21 @@ void LocationInfo::write(ObjectOutputStream& os, Pool& p) const {
+          os.writeNull(p);
+     } else {
+         char prolog[] = {
+-         0x72, 0x00, 0x21, 0x6F, 0x72, 0x67, 0x2E, 
+-         0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2E, 0x6C, 
+-         0x6F, 0x67, 0x34, 0x6A, 0x2E, 0x73, 0x70, 0x69, 
+-         0x2E, 0x4C, 0x6F, 0x63, 0x61, 0x74, 0x69, 0x6F, 
+-         0x6E, 0x49, 0x6E, 0x66, 0x6F, 0xED, 0x99, 0xBB, 
+-         0xE1, 0x4A, 0x91, 0xA5, 0x7C, 0x02, 0x00, 0x01, 
+-         0x4C, 0x00, 0x08, 0x66, 0x75, 0x6C, 0x6C, 0x49, 
+-         0x6E, 0x66, 0x6F, 
+-            0x74, 0x00, 0x12, 0x4C, 0x6A, 
+-                0x61, 0x76, 0x61, 0x2F, 0x6C, 0x61, 0x6E, 0x67, 
+-                0x2F, 0x53, 0x74, 0x72, 0x69, 0x6E, 0x67, 0x3B,
+-         0x78, 0x70 };
++         0x72,
++         0x00,
++         0x21, 0x6F, 0x72, 0x67, 0x2E, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2E,
++         0x6C, 0x6F, 0x67, 0x34, 0x6A, 0x2E, 0x73, 0x70, 0x69, 0x2E, 0x4C, 0x6F,
++         0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x49, 0x6E, 0x66, 0x6F, static_cast<char>(0xED),
++         static_cast<char>(0x99), static_cast<char>(0xBB), static_cast<char>(0xE1),
++         0x4A, static_cast<char>(0x91), static_cast<char>(0xA5), 0x7C, 0x02,
++         0x00,
++         0x01, 0x4C,
++         0x00,
++         0x08, 0x66, 0x75, 0x6C, 0x6C, 0x49, 0x6E, 0x66, 0x6F, 0x74,
++         0x00,
++         0x12, 0x4C, 0x6A, 0x61, 0x76, 0x61, 0x2F, 0x6C, 0x61, 0x6E, 0x67, 0x2F,
++         0x53, 0x74, 0x72, 0x69, 0x6E, 0x67, 0x3B, 0x78, 0x70
++        };
+       os.writeProlog("org.apache.log4j.spi.LocationInfo", 2, prolog, sizeof(prolog), p);
+         char* line = p.itoa(lineNumber);
+         //
+diff --git a/src/main/cpp/loggingevent.cpp b/src/main/cpp/loggingevent.cpp
+index 1c0d4be..edbf40b 100644
+--- a/src/main/cpp/loggingevent.cpp
++++ b/src/main/cpp/loggingevent.cpp
+@@ -242,7 +242,7 @@ void LoggingEvent::writeProlog(ObjectOutputStream& os, Pool& p)  {
+         0x68, 0x65, 0x2E, 0x6C, 0x6F, 0x67, 0x34, 0x6A, 
+         0x2E, 0x73, 0x70, 0x69, 0x2E, 0x4C, 0x6F, 0x67, 
+         0x67, 0x69, 0x6E, 0x67, 0x45, 0x76, 0x65, 0x6E, 
+-        0x74, 0xF3, 0xF2, 0xB9, 0x23, 0x74, 0x0B, 0xB5, 
++        0x74, static_cast<char>(0xF3), static_cast<char>(0xF2), static_cast<char>(0xB9), 0x23, 0x74, 0x0B, static_cast<char>(0xB5), 
+         0x3F, 0x03, 0x00, 0x0A, 0x5A, 0x00, 0x15, 0x6D, 
+         0x64, 0x63, 0x43, 0x6F, 0x70, 0x79, 0x4C, 0x6F, 
+         0x6F, 0x6B, 0x75, 0x70, 0x52, 0x65, 0x71, 0x75, 
+diff --git a/src/main/cpp/objectoutputstream.cpp b/src/main/cpp/objectoutputstream.cpp
+index 7cd696b..5442420 100644
+--- a/src/main/cpp/objectoutputstream.cpp
++++ b/src/main/cpp/objectoutputstream.cpp
+@@ -36,7 +36,7 @@ ObjectOutputStream::ObjectOutputStream(OutputStreamPtr outputStream, Pool& p)
+        objectHandle(0x7E0000),
+        classDescriptions(new ClassDescriptionMap())
+ {
+-   char start[] = { 0xAC, 0xED, 0x00, 0x05 };
++   char start[] = { static_cast<char>(0xAC), static_cast<char>(0xED), 0x00, 0x05 };
+    ByteBuffer buf(start, sizeof(start));
+    os->write(buf, p);
+ }
+@@ -81,15 +81,15 @@ void ObjectOutputStream::writeObject(const MDC::Map& val, Pool& p) {
+     //
+     //  TC_OBJECT and the classDesc for java.util.Hashtable
+     //
+-    char prolog[] = {
+-        0x72, 0x00, 0x13, 0x6A, 0x61, 0x76, 0x61, 
+-        0x2E, 0x75, 0x74, 0x69, 0x6C, 0x2E, 0x48, 0x61, 
+-        0x73, 0x68, 0x74, 0x61, 0x62, 0x6C, 0x65, 0x13, 
+-        0xBB, 0x0F, 0x25, 0x21, 0x4A, 0xE4, 0xB8, 0x03, 
+-        0x00, 0x02, 0x46, 0x00, 0x0A, 0x6C, 0x6F, 0x61, 
+-        0x64, 0x46, 0x61, 0x63, 0x74, 0x6F, 0x72, 0x49, 
+-        0x00, 0x09, 0x74, 0x68, 0x72, 0x65, 0x73, 0x68, 
+-        0x6F, 0x6C, 0x64, 0x78, 0x70  };
++	char prolog[] = {
++		0x72, 0x00, 0x13, 0x6A, 0x61, 0x76, 0x61,
++		0x2E, 0x75, 0x74, 0x69, 0x6C, 0x2E, 0x48, 0x61,
++		0x73, 0x68, 0x74, 0x61, 0x62, 0x6C, 0x65, 0x13,
++		static_cast<char>(0xBB), 0x0F, 0x25, 0x21, 0x4A, static_cast<char>(0xE4), static_cast<char>(0xB8), 0x03,
++		0x00, 0x02, 0x46, 0x00, 0x0A, 0x6C, 0x6F, 0x61,
++		0x64, 0x46, 0x61, 0x63, 0x74, 0x6F, 0x72, 0x49,
++		0x00, 0x09, 0x74, 0x68, 0x72, 0x65, 0x73, 0x68,
++		0x6F, 0x6C, 0x64, 0x78, 0x70  };
+     writeProlog("java.util.Hashtable", 1, prolog, sizeof(prolog), p);
+     //
+     //   loadFactor = 0.75, threshold = 5, blockdata start, buckets.size = 7
+diff --git a/src/test/cpp/xml/domtestcase.cpp b/src/test/cpp/xml/domtestcase.cpp
+index a500628..29d67dd 100644
+--- a/src/test/cpp/xml/domtestcase.cpp
++++ b/src/test/cpp/xml/domtestcase.cpp
+@@ -190,9 +190,9 @@ public:
+                 DOMConfigurator::configure(LOG4CXX_TEST_STR("input/xml/DOMTestCase3.xml"));
+                 LOG4CXX_INFO(logger, "File name is expected to end with a superscript 3");
+ #if LOG4CXX_LOGCHAR_IS_UTF8
+-                const logchar fname[] = { 0x6F, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2F, 0x64, 0x6F, 0x6D, 0xC2, 0xB3, 0 };
++                const logchar fname[] = { 0x6F, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2F, 0x64, 0x6F, 0x6D, static_cast<logchar>(0xC2), static_cast<logchar>(0xB3), 0 };
+ #else
+-                const logchar fname[] = { 0x6F, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2F, 0x64, 0x6F, 0x6D, 0xB3, 0 };
++                const logchar fname[] = { 0x6F, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2F, 0x64, 0x6F, 0x6D, static_cast<logchar>(0xB3), 0 };
+ #endif
+                 File file;
+                 file.setPath(fname);
+@@ -209,9 +209,9 @@ public:
+                 DOMConfigurator::configure(LOG4CXX_TEST_STR("input/xml/DOMTestCase4.xml"));
+                 LOG4CXX_INFO(logger, "File name is expected to end with an ideographic 4");
+ #if LOG4CXX_LOGCHAR_IS_UTF8
+-                const logchar fname[] = { 0x6F, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2F, 0x64, 0x6F, 0x6D, 0xE3, 0x86, 0x95, 0 };
++                const logchar fname[] = { 0x6F, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2F, 0x64, 0x6F, 0x6D, static_cast<logchar>(0xE3), static_cast<logchar>(0x86), static_cast<logchar>(0x95), 0 };
+ #else
+-                const logchar fname[] = { 0x6F, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2F, 0x64, 0x6F, 0x6D, 0x3195, 0 };
++                const logchar fname[] = { 0x6F, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2F, 0x64, 0x6F, 0x6D, static_cast<logchar>(0x3195), 0 };
+ #endif
+                 File file;
+                 file.setPath(fname);
\ No newline at end of file
diff --git a/nixpkgs/pkgs/development/libraries/log4shib/default.nix b/nixpkgs/pkgs/development/libraries/log4shib/default.nix
new file mode 100644
index 000000000000..b2fba7df509b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/log4shib/default.nix
@@ -0,0 +1,21 @@
+{ stdenv, fetchgit, autoreconfHook }:
+
+stdenv.mkDerivation rec {
+  name = "log4shib-${version}";
+  version = "1.0.9";
+
+  src = fetchgit {
+    url = "https://git.shibboleth.net/git/cpp-log4shib.git";
+    rev = "a1afe19b7b49c32fcb03e6d72809501b8965cf85";
+    sha256 = "06rrc5l6qxlc8abzim2jcxwz2c577qrjqx15cbfqq1zfqagj9hix";
+  };
+
+  nativeBuildInputs = [ autoreconfHook ];
+
+  meta = with stdenv.lib; {
+    description = "A forked version of log4cpp that has been created for the Shibboleth project";
+    maintainers = [ maintainers.jammerful ];
+    license = licenses.lgpl21;
+    homepage = http://log4cpp.sf.net;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/loki/default.nix b/nixpkgs/pkgs/development/libraries/loki/default.nix
new file mode 100644
index 000000000000..2ff927048ad5
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/loki/default.nix
@@ -0,0 +1,26 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "loki-${version}";
+  version = "0.1.7";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/loki-lib/Loki/Loki%20${version}/loki-${version}.tar.gz";
+    sha256 = "1xhwna961fl4298ac5cc629x5030zlw31vx4h8zws290amw5860g";
+  };
+
+  buildPhase = ''
+    substituteInPlace Makefile.common --replace /usr $out
+    make build-shared
+  '';
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.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;
+    platforms = platforms.all;
+    maintainers = with maintainers; [ peterhoeg ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/loudmouth/default.nix b/nixpkgs/pkgs/development/libraries/loudmouth/default.nix
new file mode 100644
index 000000000000..cad5d0d7ecad
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/loudmouth/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchurl, openssl, libidn, glib, pkgconfig, zlib }:
+
+stdenv.mkDerivation rec {
+  version = "1.5.3";
+  name = "loudmouth-${version}";
+
+  src = fetchurl {
+    url = "https://mcabber.com/files/loudmouth/${name}.tar.bz2";
+    sha256 = "0b6kd5gpndl9nzis3n6hcl0ldz74bnbiypqgqa1vgb0vrcar8cjl";
+  };
+
+  patches = [
+  ];
+
+  configureFlags = [ "--with-ssl=openssl" ];
+
+  propagatedBuildInputs = [ openssl libidn glib zlib ];
+
+  nativeBuildInputs = [ pkgconfig ];
+
+  meta = with stdenv.lib; {
+    description = "A lightweight C library for the Jabber protocol";
+    platforms = platforms.linux;
+    downloadPage = "http://mcabber.com/files/loudmouth/";
+    downloadURLRegexp = "loudmouth-[0-9.]+[.]tar[.]bz2$";
+    updateWalker = true;
+    license = licenses.lgpl21;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/loudmouth/glib-2.32.patch b/nixpkgs/pkgs/development/libraries/loudmouth/glib-2.32.patch
new file mode 100644
index 000000000000..87fc170c80da
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/loudmouth/glib-2.32.patch
@@ -0,0 +1,13 @@
+Index: loudmouth-1.4.3/loudmouth/lm-error.c
+===================================================================
+--- loudmouth-1.4.3.orig/loudmouth/lm-error.c
++++ loudmouth-1.4.3/loudmouth/lm-error.c
+@@ -19,7 +19,7 @@
+  */
+ 
+ #include <config.h>
+-#include <glib/gerror.h>
++#include <glib.h>
+ #include "lm-error.h"
+ 
+ /**
diff --git a/nixpkgs/pkgs/development/libraries/luabind/0.9.1_boost_1.57_fix.patch b/nixpkgs/pkgs/development/libraries/luabind/0.9.1_boost_1.57_fix.patch
new file mode 100644
index 000000000000..7ac495777b54
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/luabind/0.9.1_boost_1.57_fix.patch
@@ -0,0 +1,23 @@
+diff --git a/luabind/object.hpp b/luabind/object.hpp
+index f7b7ca5..1c18e04 100644
+--- a/luabind/object.hpp
++++ b/luabind/object.hpp
+@@ -536,6 +536,8 @@ namespace detail
+       handle m_key;
+   };
+ 
++#if BOOST_VERSION < 105700
++
+ // Needed because of some strange ADL issues.
+ 
+ #define LUABIND_OPERATOR_ADL_WKND(op) \
+@@ -557,7 +559,8 @@ namespace detail
+   LUABIND_OPERATOR_ADL_WKND(!=)
+ 
+ #undef LUABIND_OPERATOR_ADL_WKND
+- 
++
++#endif // BOOST_VERSION < 105700 
+ } // namespace detail
+ 
+ namespace adl
diff --git a/nixpkgs/pkgs/development/libraries/luabind/0.9.1_discover_luajit.patch b/nixpkgs/pkgs/development/libraries/luabind/0.9.1_discover_luajit.patch
new file mode 100644
index 000000000000..6e5fe6aa6f82
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/luabind/0.9.1_discover_luajit.patch
@@ -0,0 +1,22 @@
+diff --git a/Jamroot b/Jamroot
+index 94494bf..83dfcbb 100755
+--- a/Jamroot
++++ b/Jamroot
+@@ -64,7 +64,7 @@ else if [ os.name ] in LINUX MACOSX FREEBSD
+         $(LUA_PATH) $(HOME)/Library/Frameworks /Library/Frameworks /usr /usr/local /opt/local /opt ;
+ 
+     local possible-suffixes =
+-        include/lua5.1 include/lua51 include/lua include ;
++        include/lua5.1 include/lua51 include/lua include include/luajit-2.0 ;
+ 
+     local includes = [ GLOB $(possible-prefixes)/$(possible-suffixes) : lua.h ] ;
+ 
+@@ -83,7 +83,7 @@ else if [ os.name ] in LINUX MACOSX FREEBSD
+ 
+     local lib = $(prefix)/lib ;
+ 
+-    local names = liblua5.1 liblua51 liblua ;
++    local names = liblua5.1 liblua51 liblua libluajit-5.1 ;
+     local extensions = .a .so ;
+ 
+     library = [ GLOB $(lib)/lua51 $(lib)/lua5.1 $(lib)/lua $(lib) :
diff --git a/nixpkgs/pkgs/development/libraries/luabind/0.9.1_modern_boost_fix.patch b/nixpkgs/pkgs/development/libraries/luabind/0.9.1_modern_boost_fix.patch
new file mode 100644
index 000000000000..92e32828a03c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/luabind/0.9.1_modern_boost_fix.patch
@@ -0,0 +1,59 @@
+diff --git luabind-0.9.1/luabind/detail/call_function.hpp luabind-0.9.1-fixed/luabind/detail/call_function.hpp
+index 1b45ec1..8f5afff 100644
+--- luabind-0.9.1/luabind/detail/call_function.hpp
++++ luabind-0.9.1-fixed/luabind/detail/call_function.hpp
+@@ -323,7 +323,8 @@ namespace luabind
+ 
+ #endif // LUABIND_CALL_FUNCTION_HPP_INCLUDED
+ 
+-#elif BOOST_PP_ITERATION_FLAGS() == 1
++#else
++#if BOOST_PP_ITERATION_FLAGS() == 1
+ 
+ #define LUABIND_TUPLE_PARAMS(z, n, data) const A##n *
+ #define LUABIND_OPERATOR_PARAMS(z, n, data) const A##n & a##n
+@@ -440,4 +441,5 @@ namespace luabind
+ 
+ 
+ #endif
++#endif
+ 
+diff --git luabind-0.9.1/luabind/detail/call_member.hpp luabind-0.9.1-fixed/luabind/detail/call_member.hpp
+index de8d563..e63555b 100644
+--- luabind-0.9.1/luabind/detail/call_member.hpp
++++ luabind-0.9.1-fixed/luabind/detail/call_member.hpp
+@@ -316,7 +316,8 @@ namespace luabind
+ 
+ #endif // LUABIND_CALL_MEMBER_HPP_INCLUDED
+ 
+-#elif BOOST_PP_ITERATION_FLAGS() == 1
++#else
++#if BOOST_PP_ITERATION_FLAGS() == 1
+ 
+ #define LUABIND_TUPLE_PARAMS(z, n, data) const A##n *
+ #define LUABIND_OPERATOR_PARAMS(z, n, data) const A##n & a##n
+@@ -360,4 +361,5 @@ namespace luabind
+ #undef LUABIND_TUPLE_PARAMS
+ 
+ #endif
++#endif
+ 
+diff --git luabind-0.9.1/luabind/wrapper_base.hpp luabind-0.9.1-fixed/luabind/wrapper_base.hpp
+index d54c668..0f88cc5 100755
+--- luabind-0.9.1/luabind/wrapper_base.hpp
++++ luabind-0.9.1-fixed/luabind/wrapper_base.hpp
+@@ -89,7 +89,8 @@ namespace luabind
+ 
+ #endif // LUABIND_WRAPPER_BASE_HPP_INCLUDED
+ 
+-#elif BOOST_PP_ITERATION_FLAGS() == 1
++#else
++#if BOOST_PP_ITERATION_FLAGS() == 1
+ 
+ #define LUABIND_TUPLE_PARAMS(z, n, data) const A##n *
+ #define LUABIND_OPERATOR_PARAMS(z, n, data) const A##n & a##n
+@@ -188,3 +189,4 @@ namespace luabind
+ #undef N
+ 
+ #endif
++#endif
diff --git a/nixpkgs/pkgs/development/libraries/luabind/default.nix b/nixpkgs/pkgs/development/libraries/luabind/default.nix
new file mode 100644
index 000000000000..50baad6a7a0b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/luabind/default.nix
@@ -0,0 +1,31 @@
+{stdenv, fetchurl, boost-build, lua, boost}:
+
+stdenv.mkDerivation rec {
+  name = "luabind-0.9.1";
+
+  src = fetchurl {
+    url = "https://github.com/luabind/luabind/archive/v0.9.1.tar.gz";
+    sha256 = "0e5ead50a07668d29888f2fa6f53220f900c886e46a2c99c7e8656842f05ff2d";
+  };
+
+  patches = [ ./0.9.1_modern_boost_fix.patch ./0.9.1_boost_1.57_fix.patch ./0.9.1_discover_luajit.patch ];
+
+  buildInputs = [ boost-build lua boost ];
+
+  propagatedBuildInputs = [ lua ];
+
+  buildPhase = "LUA_PATH=${lua} bjam release";
+
+  installPhase = "LUA_PATH=${lua} bjam --prefix=$out release install";
+
+  passthru = {
+    inherit lua;
+  };
+
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/luaffi/darwin.patch b/nixpkgs/pkgs/development/libraries/luaffi/darwin.patch
new file mode 100644
index 000000000000..50db81b776d7
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/luaffi/darwin.patch
@@ -0,0 +1,17 @@
+diff --git a/Makefile b/Makefile
+index b2b5f2c..b690a5d 100644
+--- a/Makefile
++++ b/Makefile
+@@ -18,10 +18,10 @@ test:
+ 	if [ `uname` = "Darwin" ]; then $(MAKE) test_macosx; else $(MAKE) test_posix; fi
+ 
+ macosx:
+-	$(MAKE) posix "SOCC=MACOSX_DEPLOYMENT_TARGET=10.3 $(CC) -dynamiclib -single_module -undefined dynamic_lookup $(SOCFLAGS)"
++	$(MAKE) posix "SOCC= $(CC) -dynamiclib -single_module -undefined dynamic_lookup -Wl,-install_name,$(PREFIX)/lib/$(MODSO) $(SOCFLAGS)"
+ 
+ test_macosx:
+-	$(MAKE) test_posix "SOCC=MACOSX_DEPLOYMENT_TARGET=10.3 $(CC) -dynamiclib -single_module -undefined dynamic_lookup $(SOCFLAGS)"
++	$(MAKE) test_posix "SOCC= $(CC) -dynamiclib -single_module -undefined dynamic_lookup -Wl,-install_name,$(PREFIX)/lib/$(MODSO) $(SOCFLAGS)"
+ 
+ posix: $(MODSO) test_cdecl.so
+ 
diff --git a/nixpkgs/pkgs/development/libraries/luaffi/default.nix b/nixpkgs/pkgs/development/libraries/luaffi/default.nix
new file mode 100644
index 000000000000..065562ac82ec
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/luaffi/default.nix
@@ -0,0 +1,31 @@
+{ stdenv, fetchFromGitHub, lua, pkgconfig }:
+
+stdenv.mkDerivation {
+  name = "luaffi-2013-11-08";
+  src = fetchFromGitHub {
+    owner = "jmckaskill";
+    repo = "luaffi";
+    rev = "abc638c9341025580099dcf77795c4b320ba0e63";
+    sha256 = "1hv1y9i66p473hfy36nqj220sfrxdmbd75c1gpjvpk8073vx55ac";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ lua ];
+
+  patches = [ ./darwin.patch ./makefile-errors.patch ];
+
+  makeFlags = [ "PREFIX=$(out)" ];
+
+  installPhase = ''
+    mkdir -p $out/lib
+    cp ffi.so $out/lib/ffi.so
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Standalone FFI library for calling C functions from lua. Compatible with the luajit FFI interface.";
+    homepage = https://github.com/jmckaskill/luaffi;
+    maintainers = with maintainers; [ ma27 ];
+    license = licenses.mit;
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/luaffi/makefile-errors.patch b/nixpkgs/pkgs/development/libraries/luaffi/makefile-errors.patch
new file mode 100644
index 000000000000..0ee6e6390068
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/luaffi/makefile-errors.patch
@@ -0,0 +1,13 @@
+diff --git a/Makefile b/Makefile
+index b2b5f2c..49d4c99 100644
+--- a/Makefile
++++ b/Makefile
+@@ -6,7 +6,7 @@ LUA=lua
+ LUA_CFLAGS=`$(PKG_CONFIG) --cflags lua5.2 2>/dev/null || $(PKG_CONFIG) --cflags lua`
+ SOCFLAGS=-fPIC
+ SOCC=$(CC) -shared $(SOCFLAGS)
+-CFLAGS=-fPIC -g -Wall -Werror $(LUA_CFLAGS) -fvisibility=hidden -Wno-unused-function --std=gnu99
++CFLAGS=-fPIC -g -Wall $(LUA_CFLAGS) -fvisibility=hidden -Wno-unused-function --std=gnu99
+ 
+ MODNAME=ffi
+ MODSO=$(MODNAME).so
diff --git a/nixpkgs/pkgs/development/libraries/lucene++/default.nix b/nixpkgs/pkgs/development/libraries/lucene++/default.nix
new file mode 100644
index 000000000000..c45fa6bc61aa
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/lucene++/default.nix
@@ -0,0 +1,32 @@
+{ stdenv, fetchurl, cmake, boost, gtest }:
+
+stdenv.mkDerivation rec {
+  name = "lucene++-${version}";
+  version = "3.0.7";
+
+  src = fetchurl {
+    url = "https://github.com/luceneplusplus/LucenePlusPlus/"
+        + "archive/rel_${version}.tar.gz";
+    sha256 = "032yb35b381ifm7wb8cy2m3yndklnxyi5cgprjh48jqy641z46bc";
+  };
+
+  postPatch = ''
+    sed -i -e '/Subversion *REQUIRED/d' \
+           -e '/include.*CMakeExternal/d' \
+           CMakeLists.txt
+  '';
+
+  cmakeFlags = [ "-DGTEST_INCLUDE_DIR=${gtest}/include" ];
+  buildInputs = [ cmake boost gtest ];
+
+  enableParallelBuilding = true;
+  doCheck = true;
+  checkTarget = "test";
+
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/lzo/default.nix b/nixpkgs/pkgs/development/libraries/lzo/default.nix
new file mode 100644
index 000000000000..c7667b554f4e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/lzo/default.nix
@@ -0,0 +1,34 @@
+{stdenv, fetchurl}:
+
+stdenv.mkDerivation rec {
+  name = "lzo-2.10";
+
+  src = fetchurl {
+    url = "${meta.homepage}/download/${name}.tar.gz";
+    sha256 = "0wm04519pd3g8hqpjqhfr72q8qmbiwqaxcs3cndny9h86aa95y60";
+  };
+
+  configureFlags = [ "--enable-shared" ];
+
+  enableParallelBuilding = true;
+
+  doCheck = true; # not cross;
+
+  meta = with stdenv.lib; {
+    description = "Real-time data (de)compression library";
+    longDescription = ''
+      LZO is a portable lossless data compression library written in ANSI C.
+      Both the source code and the compressed data format are designed to be
+      portable across platforms.
+      LZO offers pretty fast compression and *extremely* fast decompression.
+      While it favours speed over compression ratio, it includes slower
+      compression levels achieving a quite competitive compression ratio
+      while still decompressing at this very high speed.
+    '';
+
+    homepage = http://www.oberhumer.com/opensource/lzo;
+    license = licenses.gpl2Plus;
+
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/mac/default.nix b/nixpkgs/pkgs/development/libraries/mac/default.nix
new file mode 100644
index 000000000000..8a8a004a5e69
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/mac/default.nix
@@ -0,0 +1,36 @@
+{ stdenv, fetchurl, fetchpatch, yasm }:
+
+stdenv.mkDerivation rec {
+  name = "mac-${version}";
+  version = "4.11-u4-b5-s7";
+
+  src = fetchurl {
+    url = "https://www.deb-multimedia.org/pool/main/m/monkeys-audio/monkeys-audio_${version}.orig.tar.gz";
+    sha256 = "16i96cw5r3xbsivjigqp15vv32wa38k86mxq11qx1pzmpryqpqkk";
+  };
+
+  patches = [
+    (fetchpatch {
+      name = "mac-4.11.4.5.7-gcc6.patch";
+      url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/media-sound/mac/files/mac-4.11.4.5.7-gcc6.patch?id=1bd4e0e30e4d8a8862217d7067323851b34c7fe4";
+      sha256 = "093b8m8p8s6dmc62fc8vb4hlmjc2ncb4rdgc82g0a8gg6w5kcj8x";
+    })
+    (fetchpatch {
+      name = "mac-4.11.4.5.7-output.patch";
+      url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/media-sound/mac/files/mac-4.11.4.5.7-output.patch?id=1bd4e0e30e4d8a8862217d7067323851b34c7fe4";
+      sha256 = "0njmwj6d9jqi4pz4fax02w37gk22vda0grszrs2nn97zzmjl36zk";
+    })
+  ];
+
+  CXXFLAGS = "-DSHNTOOL";
+
+  nativeBuildInputs = [ yasm ];
+
+  meta = with stdenv.lib; {
+    description = "APE codec and decompressor";
+    homepage = http://www.deb-multimedia.org/dists/testing/main/binary-amd64/package/monkeys-audio.php;
+    license = licenses.unfreeRedistributable;
+    platforms = [ "x86_64-linux" ];
+    maintainers = with maintainers; [ jfrankenau ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/mailcore2/default.nix b/nixpkgs/pkgs/development/libraries/mailcore2/default.nix
new file mode 100644
index 000000000000..c7794b1a8bfb
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/mailcore2/default.nix
@@ -0,0 +1,59 @@
+{ stdenv, lib, fetchFromGitHub, cmake, libetpan, icu, cyrus_sasl, libctemplate
+, libuchardet, pkgconfig, glib, html-tidy, libxml2, libuuid, openssl
+}:
+
+stdenv.mkDerivation rec {
+  name = "mailcore2-${version}";
+
+  version = "0.6.3";
+
+  src = fetchFromGitHub {
+    owner  = "MailCore";
+    repo   = "mailcore2";
+    rev    = version;
+    sha256 = "0yxynvfmifpw9hdhv499a813hb2ynan74r353lhcdajkkm7w8br5";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [
+    libetpan cmake icu cyrus_sasl libctemplate libuchardet glib
+    html-tidy libxml2 libuuid openssl
+  ];
+
+  postPatch = ''
+    substituteInPlace CMakeLists.txt \
+       --replace " icule iculx" "" \
+       --replace "tidy/tidy.h" "tidy.h" \
+       --replace "/usr/include/tidy" "${html-tidy}/include" \
+       --replace "/usr/include/libxml2" "${libxml2.dev}/include/libxml2"
+    substituteInPlace src/core/basetypes/MCHTMLCleaner.cpp \
+      --replace buffio.h tidybuffio.h
+  '';
+
+  cmakeFlags = [
+    "-DBUILD_SHARED_LIBS=ON"
+  ];
+
+  installPhase = ''
+    mkdir $out
+    cp -r src/include $out
+
+    mkdir $out/lib
+    cp src/libMailCore.so $out/lib
+  '';
+
+  doCheck = true;
+  checkPhase = ''
+    (
+      cd unittest
+      LD_LIBRARY_PATH="$(cd ../src; pwd)" TZ=PST8PDT ./unittestcpp ../../unittest/data
+    )
+  '';
+
+  meta = with lib; {
+    description = "A simple and asynchronous API to work with e-mail protocols IMAP, POP and SMTP";
+    homepage    = http://libmailcore.com;
+    license     = licenses.bsd3;
+    maintainers = with maintainers; [ cstrahan ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/mapnik/default.nix b/nixpkgs/pkgs/development/libraries/mapnik/default.nix
new file mode 100644
index 000000000000..1424ef9e12b4
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/mapnik/default.nix
@@ -0,0 +1,73 @@
+{ stdenv, fetchzip, fetchpatch
+, boost, cairo, freetype, gdal, harfbuzz, icu, libjpeg, libpng, libtiff
+, libwebp, libxml2, proj, python, scons, sqlite, zlib
+
+# supply a postgresql package to enable the PostGIS input plugin
+, postgresql ? null
+}:
+
+stdenv.mkDerivation rec {
+  name = "mapnik-${version}";
+  version = "3.0.22";
+
+  src = fetchzip {
+    # this one contains all git submodules and is cheaper than fetchgit
+    url = "https://github.com/mapnik/mapnik/releases/download/v${version}/mapnik-v${version}.tar.bz2";
+    sha256 = "18yvnnbwqndagzaa2nwh3g7gb52dghaypxpkmc2h5l88770bl17f";
+  };
+
+  # a distinct dev output makes python-mapnik fail
+  outputs = [ "out" ];
+
+  nativeBuildInputs = [ python ];
+
+  buildInputs =
+    [ boost cairo freetype gdal harfbuzz icu libjpeg libpng libtiff
+      libwebp libxml2 proj python sqlite zlib
+
+      # optional inputs
+      postgresql
+    ];
+
+  prefixKey = "PREFIX=";
+
+  preConfigure = ''
+    patchShebangs ./configure
+  '';
+
+  configureFlags = [
+    "BOOST_INCLUDES=${boost.dev}/include"
+    "BOOST_LIBS=${boost.out}/lib"
+    "CAIRO_INCLUDES=${cairo.dev}/include"
+    "CAIRO_LIBS=${cairo.out}/lib"
+    "FREETYPE_INCLUDES=${freetype.dev}/include"
+    "FREETYPE_LIBS=${freetype.out}/lib"
+    "GDAL_CONFIG=${gdal}/bin/gdal-config"
+    "HB_INCLUDES=${harfbuzz.dev}/include"
+    "HB_LIBS=${harfbuzz.out}/lib"
+    "ICU_INCLUDES=${icu.dev}/include"
+    "ICU_LIBS=${icu.out}/lib"
+    "JPEG_INCLUDES=${libjpeg.dev}/include"
+    "JPEG_LIBS=${libjpeg.out}/lib"
+    "PNG_INCLUDES=${libpng.dev}/include"
+    "PNG_LIBS=${libpng.out}/lib"
+    "PROJ_INCLUDES=${proj}/include"
+    "PROJ_LIBS=${proj}/lib"
+    "SQLITE_INCLUDES=${sqlite.dev}/include"
+    "SQLITE_LIBS=${sqlite.out}/lib"
+    "TIFF_INCLUDES=${libtiff.dev}/include"
+    "TIFF_LIBS=${libtiff.out}/lib"
+    "WEBP_INCLUDES=${libwebp}/include"
+    "WEBP_LIBS=${libwebp}/lib"
+    "XML2_INCLUDES=${libxml2.dev}/include"
+    "XML2_LIBS=${libxml2.out}/lib"
+  ];
+
+  meta = with stdenv.lib; {
+    description = "An open source toolkit for developing mapping applications";
+    homepage = http://mapnik.org;
+    maintainers = with maintainers; [ hrdinka ];
+    license = licenses.lgpl21;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/marisa/default.nix b/nixpkgs/pkgs/development/libraries/marisa/default.nix
new file mode 100644
index 000000000000..4b06c58af5f7
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/marisa/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchFromGitHub, autoreconfHook }:
+
+stdenv.mkDerivation rec {
+  pname = "marisa";
+  version = "0.2.5";
+
+  src = fetchFromGitHub {
+    owner = "s-yata";
+    repo = "marisa-trie";
+    rev = "v${version}";
+    sha256 = "0z4bf55np08q3cbi6gvj3cpw3zp8kf2d0jq6k74pjk066m7rapbb";
+  };
+
+  enableParallelBuilding = true;
+
+  nativeBuildInputs = [ autoreconfHook ];
+
+  meta = with stdenv.lib; {
+    homepage    = https://github.com/s-yata/marisa-trie;
+    description = "Static and space-efficient trie data structure library";
+    license     = licenses.bsd3;
+    maintainers = with maintainers; [ sifmelcara ];
+    platforms   = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/martyr/default.nix b/nixpkgs/pkgs/development/libraries/martyr/default.nix
new file mode 100644
index 000000000000..064f04f220cd
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/martyr/default.nix
@@ -0,0 +1,25 @@
+{stdenv, fetchurl, ant, jdk}:
+
+stdenv.mkDerivation rec {
+	name = "martyr-${version}";
+  version = "0.3.9";
+	src = fetchurl {
+		url = "mirror://sourceforge/martyr/${name}.tar.gz";
+		sha256 = "1ks8j413bcby345kmq1i7av8kwjvz5vxdn1zpv0p7ywxq54i4z59";
+	};
+
+  buildInputs = [ ant jdk ];
+
+  buildPhase = "ant";
+
+  installPhase = ''
+    mkdir -p "$out/share/java"
+    cp -v *.jar "$out/share/java"
+  '';
+
+  meta = {
+    description = "Martyr is a 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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/matio/default.nix b/nixpkgs/pkgs/development/libraries/matio/default.nix
new file mode 100644
index 000000000000..9abdf4bbd854
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/matio/default.nix
@@ -0,0 +1,16 @@
+{ stdenv, fetchurl }:
+stdenv.mkDerivation rec {
+  name = "matio-1.5.15";
+  src = fetchurl {
+    url = "mirror://sourceforge/matio/${name}.tar.gz";
+    sha256 = "1kxi15ph68nnbi0s1m8icb0685wg8ql8gj7wnkdk20kzpf3lbgr1";
+  };
+
+  meta = with stdenv.lib; {
+    description = "A C library for reading and writing Matlab MAT files";
+    license = licenses.bsd2;
+    platforms = platforms.all;
+    maintainers = [ maintainers.vbgl ];
+    homepage = http://matio.sourceforge.net/;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/mbedtls/1.3.nix b/nixpkgs/pkgs/development/libraries/mbedtls/1.3.nix
new file mode 100644
index 000000000000..8b8d8cd0be80
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/mbedtls/1.3.nix
@@ -0,0 +1,34 @@
+{ stdenv, fetchurl, perl }:
+
+stdenv.mkDerivation rec {
+  name = "mbedtls-1.3.22";
+
+  src = fetchurl {
+    url = "https://tls.mbed.org/download/${name}-gpl.tgz";
+    sha256 = "0ms4s41z88mz7b6gsnp7jslms4v0115k7gw51i6kx6ng9am43l6y";
+  };
+
+  nativeBuildInputs = [ perl ];
+
+  postPatch = ''
+    patchShebangs .
+  '';
+
+  makeFlags = [
+    "SHARED=1"
+  ];
+
+  installFlags = [
+    "DESTDIR=\${out}"
+  ];
+
+  doCheck = true;
+
+  meta = with stdenv.lib; {
+    homepage = https://tls.mbed.org/;
+    description = "Portable cryptographic and SSL/TLS library, aka polarssl";
+    license = licenses.gpl3;
+    platforms = platforms.all;
+    maintainers = with maintainers; [ fpletz ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/mbedtls/default.nix b/nixpkgs/pkgs/development/libraries/mbedtls/default.nix
new file mode 100644
index 000000000000..a72d5a825c6a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/mbedtls/default.nix
@@ -0,0 +1,39 @@
+{ stdenv
+, fetchFromGitHub
+
+, cmake
+, ninja
+, perl # Project uses Perl for scripting and testing
+, python
+
+, enableThreading ? true # Threading can be disabled to increase security https://tls.mbed.org/kb/development/thread-safety-and-multi-threading
+}:
+
+stdenv.mkDerivation rec {
+  name = "mbedtls-${version}";
+  version = "2.17.0";
+
+  src = fetchFromGitHub {
+    owner = "ARMmbed";
+    repo = "mbedtls";
+    rev = name;
+    sha256 = "1mk3xv61wvqqrzd6jnrz8csyfnwwwwpjzywj3fsfy99p51d7wqgw";
+  };
+
+  nativeBuildInputs = [ cmake ninja perl python ];
+
+  postConfigure = stdenv.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; {
+    homepage = https://tls.mbed.org/;
+    description = "Portable cryptographic and TLS library, formerly known as PolarSSL";
+    license = licenses.asl20;
+    platforms = platforms.all;
+    maintainers = with maintainers; [ fpletz ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/mdds/default.nix b/nixpkgs/pkgs/development/libraries/mdds/default.nix
new file mode 100644
index 000000000000..16502ca4e612
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/mdds/default.nix
@@ -0,0 +1,26 @@
+{ stdenv, fetchurl, boost }:
+
+stdenv.mkDerivation rec {
+  pname = "mdds";
+  version = "1.4.3";
+
+  src = fetchurl {
+    url = "https://kohei.us/files/${pname}/src/${pname}-${version}.tar.bz2";
+    sha256 = "10cw6irdm6d15nxnys2v5akp8yz52qijpcjvw0frwq7nz5d3vki5";
+  };
+
+  postInstall = ''
+    mkdir -p "$out/lib/pkgconfig"
+    cp "$out/share/pkgconfig/"* "$out/lib/pkgconfig"
+  '';
+
+  checkInputs = [ boost ];
+
+  meta = with stdenv.lib; {
+    inherit version;
+    homepage = https://gitlab.com/mdds/mdds;
+    description = "A collection of multi-dimensional data structure and indexing algorithm";
+    platforms = platforms.all;
+    license = licenses.mit;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/mdds/default.upstream b/nixpkgs/pkgs/development/libraries/mdds/default.upstream
new file mode 100644
index 000000000000..96c5bc35d169
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/mdds/default.upstream
@@ -0,0 +1,10 @@
+url https://gitlab.com/mdds/mdds
+version_link 'mdds-.*[.]tar[.][a-z0-9]+$'
+version '.*-([0-9.]+)[.]tar[.].*' '\1'
+
+do_overwrite(){
+  ensure_hash
+  ensure_version
+  set_var_value version $CURRENT_VERSION
+  set_var_value sha256 $CURRENT_HASH
+}
diff --git a/nixpkgs/pkgs/development/libraries/medfile/default.nix b/nixpkgs/pkgs/development/libraries/medfile/default.nix
new file mode 100644
index 000000000000..8f0a6317a257
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/medfile/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchurl, cmake, hdf5 }:
+
+stdenv.mkDerivation rec {
+  name = "medfile-${version}";
+  version = "4.0.0";
+
+  src = fetchurl {
+    url = "http://files.salome-platform.org/Salome/other/med-${version}.tar.gz";
+    sha256 = "017h9p0x533fm4gn6pwc8kmp72rvqmcn6vznx72nkkl2b05yjx54";
+  };
+
+  enableParallelBuilding = true;
+
+  nativeBuildInputs = [ cmake ];
+  buildInputs = [ hdf5 ];
+
+  checkPhase = "make test";
+
+  postInstall = "rm -r $out/bin/testc";
+
+  meta = with stdenv.lib; {
+    description = "Library to read and write MED files";
+    homepage = http://salome-platform.org/;
+    platforms = platforms.linux;
+    license = licenses.lgpl3Plus;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/mediastreamer/default.nix b/nixpkgs/pkgs/development/libraries/mediastreamer/default.nix
new file mode 100644
index 000000000000..4b69d5d0aafe
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/mediastreamer/default.nix
@@ -0,0 +1,46 @@
+{ stdenv, pkgconfig, intltool, alsaLib, libpulseaudio, speex, gsm
+, libopus, ffmpeg, libX11, libXv, libGLU_combined, glew, libtheora, libvpx, SDL, libupnp
+, ortp, libv4l, libpcap, srtp, fetchFromGitHub, cmake, bctoolbox, doxygen
+, python, libXext, libmatroska, openssl, fetchpatch
+}:
+
+stdenv.mkDerivation rec {
+  baseName = "mediastreamer2";
+  version = "2.16.1";
+  name = "${baseName}-${version}";
+
+  src = fetchFromGitHub {
+    owner = "BelledonneCommunications";
+    repo = "${baseName}";
+    rev = "${version}";
+    sha256 = "02745bzl2r1jqvdqzyv94fjd4w92zr976la4c4nfvsy52waqah7j";
+  };
+
+  patches = [
+    (fetchpatch {
+      name = "allow-build-without-git.patch";
+      url = "https://github.com/BelledonneCommunications/mediastreamer2/commit/de3a24b795d7a78e78eab6b974e7ec5abf2259ac.patch";
+      sha256 = "1zqkrab42n4dha0knfsyj4q0wc229ma125gk9grj67ps7r7ipscy";
+    })
+    ./plugins_dir.patch
+  ];
+
+  nativeBuildInputs = [ pkgconfig intltool cmake doxygen python ];
+
+  propagatedBuildInputs = [
+    alsaLib libpulseaudio speex gsm libopus
+    ffmpeg libX11 libXv libGLU_combined glew libtheora libvpx SDL libupnp
+    ortp libv4l libpcap srtp bctoolbox libXext libmatroska
+    openssl
+  ];
+
+  NIX_CFLAGS_COMPILE = " -DGIT_VERSION=\"v2.14.0\" -Wno-error=deprecated-declarations ";
+  NIX_LDFLAGS = " -lXext -lssl ";
+
+  meta = with stdenv.lib; {
+    description = "A powerful and lightweight streaming engine specialized for voice/video telephony applications";
+    homepage = http://www.linphone.org/technical-corner/mediastreamer2/overview;
+    license = licenses.gpl2;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/mediastreamer/msopenh264.nix b/nixpkgs/pkgs/development/libraries/mediastreamer/msopenh264.nix
new file mode 100644
index 000000000000..b8a8c64011ca
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/mediastreamer/msopenh264.nix
@@ -0,0 +1,24 @@
+{ stdenv, autoreconfHook, pkgconfig, mediastreamer, openh264
+, fetchgit, cmake
+}:
+
+stdenv.mkDerivation rec {
+  name = "mediastreamer-openh264-${version}";
+  version = "0.0pre20160801";
+
+  src = fetchgit {
+    url = "git://git.linphone.org/msopenh264.git";
+    rev = "4cb4b134bf0f1538fd0c2c928eee2d5388115abc";
+    sha256 = "001km4xy1ifwbg1c19ncc75h867fzfcxy9pxvl4pxqb64169xc1k";
+  };
+
+  nativeBuildInputs = [ autoreconfHook cmake pkgconfig ];
+  buildInputs = [ mediastreamer openh264 ];
+
+  meta = with stdenv.lib; {
+    description = "H.264 encoder/decoder plugin for mediastreamer2";
+    homepage = http://www.linphone.org/technical-corner/mediastreamer2/overview;
+    license = licenses.gpl2;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/mediastreamer/plugins_dir.patch b/nixpkgs/pkgs/development/libraries/mediastreamer/plugins_dir.patch
new file mode 100644
index 000000000000..e64bfc5a43a1
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/mediastreamer/plugins_dir.patch
@@ -0,0 +1,24 @@
+diff -uNr mediastreamer2/src/base/msfactory.c mediastreamer2-new/src/base/msfactory.c
+--- a/src/base/msfactory.c	2015-05-13 16:53:49.801113249 +0200
++++ b/src/base/msfactory.c	2015-08-26 21:35:44.994724647 +0200
+@@ -630,12 +630,18 @@
+ }
+ 
+ void ms_factory_init_plugins(MSFactory *obj) {
++	char *package_plugins_dir;
+ 	if (obj->plugins_dir == NULL) {
++		package_plugins_dir=getenv("MEDIASTREAMER_PLUGINS_DIR");
++		if (package_plugins_dir!=NULL){
++			obj->plugins_dir = ms_strdup(package_plugins_dir);
++		} else {
+ #ifdef PACKAGE_PLUGINS_DIR
+-		obj->plugins_dir = ms_strdup(PACKAGE_PLUGINS_DIR);
++			obj->plugins_dir = ms_strdup(PACKAGE_PLUGINS_DIR);
+ #else
+-		obj->plugins_dir = ms_strdup("");
++			obj->plugins_dir = ms_strdup("");
+ #endif
++		}
+ 	}
+ 	if (strlen(obj->plugins_dir) > 0) {
+ 		ms_message("Loading ms plugins from [%s]",obj->plugins_dir);
diff --git a/nixpkgs/pkgs/development/libraries/menu-cache/default.nix b/nixpkgs/pkgs/development/libraries/menu-cache/default.nix
new file mode 100644
index 000000000000..d64b7f123127
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/menu-cache/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchurl, glib, pkgconfig, libfm-extra }:
+
+let name = "menu-cache-1.1.0";
+in
+stdenv.mkDerivation {
+  inherit name;
+  src = fetchurl {
+    url = "mirror://sourceforge/lxde/${name}.tar.xz";
+    sha256 = "1iry4zlpppww8qai2cw4zid4081hh7fz8nzsp5lqyffbkm2yn0pd";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+
+  buildInputs = [ glib libfm-extra ];
+
+  meta = with stdenv.lib; {
+    description = "Library to read freedesktop.org menu files";
+    homepage = https://blog.lxde.org/tag/menu-cache/;
+    license = licenses.gpl2Plus;
+    maintainers = [ maintainers.ttuegel ];
+    platforms = platforms.linux ++ platforms.darwin;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/mesa-glu/default.nix b/nixpkgs/pkgs/development/libraries/mesa-glu/default.nix
new file mode 100644
index 000000000000..94622b8a8f94
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/mesa-glu/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchurl, pkgconfig, libGL, ApplicationServices }:
+
+stdenv.mkDerivation rec {
+  name = "glu-${version}";
+  version = "9.0.0";
+
+  src = fetchurl {
+    url = "ftp://ftp.freedesktop.org/pub/mesa/glu/${name}.tar.bz2";
+    sha256 = "04nzlil3a6fifcmb95iix3yl8mbxdl66b99s62yzq8m7g79x0yhz";
+  };
+  postPatch = ''
+    echo 'Cflags: -I''${includedir}' >> glu.pc.in
+  '';
+
+  nativeBuildInputs = [ pkgconfig ];
+  propagatedBuildInputs = [ libGL ]
+    ++ stdenv.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;
+    broken = stdenv.hostPlatform.isAndroid;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/mesa/default.nix b/nixpkgs/pkgs/development/libraries/mesa/default.nix
new file mode 100644
index 000000000000..b34ca5253a29
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/mesa/default.nix
@@ -0,0 +1,375 @@
+{ stdenv, fetchurl, fetchpatch, lib
+, pkgconfig, autoreconfHook, python2, python2Packages
+, expat, zlib
+, OpenGL, Xplugin
+
+, enableRadv ? stdenv.isLinux
+
+, galliumDrivers ? null
+, driDrivers ? null
+, vulkanDrivers ? null
+, eglPlatforms ? [ "x11" ] ++ lib.optionals stdenv.isLinux [ "wayland" "drm" ]
+, xorg, wayland, wayland-protocols
+
+, xvmcSupport ? true
+, vdpauSupport ? true, libvdpau
+, omxBellagioSupport ? stdenv.isLinux, libomxil-bellagio
+, vaSupport ? stdenv.isLinux, libva-minimal
+, libdrmSupport ? stdenv.isLinux, libdrm
+, libelfSupport ? stdenv.isLinux, libelf
+, llvmSupport ? true, llvmPackages
+, libglvndSupport ? true, libglvnd
+, withValgrind ? stdenv.hostPlatform.isLinux && !stdenv.hostPlatform.isAarch32, valgrind-light
+}:
+
+with lib;
+
+assert elem "drm" eglPlatforms -> libdrmSupport;
+assert elem "wayland" eglPlatforms -> libdrmSupport;
+assert xvmcSupport -> elem "x11" eglPlatforms;
+assert vdpauSupport -> elem "x11" eglPlatforms;
+assert enableRadv -> libdrmSupport && llvmSupport && libelfSupport;
+
+/** Packaging design:
+  - The basic mesa ($out) contains headers and libraries (GLU is in libGLU now).
+    This or the mesa attribute (which also contains GLU) are small (~ 2 MB, mostly headers)
+    and are designed to be the buildInput of other packages.
+  - DRI drivers are compiled into $drivers output, which is much bigger and
+    depends on LLVM. These should be searched at runtime in
+    "/run/opengl-driver{,-32}/lib/*" and so are kind-of impure (given by NixOS).
+    (I suppose on non-NixOS one would create the appropriate symlinks from there.)
+  - libOSMesa is in $osmesa (~4 MB)
+*/
+
+let
+  # platforms that have PCIe slots and thus can use most non-integrated GPUs
+  pciePlatform = !stdenv.hostPlatform.isAarch32 && !stdenv.hostPlatform.isAarch64;
+  defaultGalliumDrivers = optionals (elem "drm" eglPlatforms) ([ "virgl" ]
+    ++ optionals (pciePlatform || stdenv.hostPlatform.isAarch32 || stdenv.hostPlatform.isAarch64) [ "nouveau" ]
+    ++ optionals (stdenv.hostPlatform.isAarch32 || stdenv.hostPlatform.isAarch64) [ "vc4" ]
+    ++ optionals stdenv.hostPlatform.isAarch64 [ "freedreno" "etnaviv" "imx" ]
+    ++ optionals stdenv.hostPlatform.isx86 [ "svga" "i915" ]
+    ++ optional (pciePlatform && llvmSupport) "r300"
+    ++ optionals (pciePlatform && llvmSupport && libelfSupport) [ "r600" "radeonsi" ]);
+
+  defaultDriDrivers = optionals (elem "drm" eglPlatforms) ([ ]
+    ++ optionals pciePlatform [ "radeon" "r200" ]
+    ++ optionals (pciePlatform || stdenv.hostPlatform.isAarch32 || stdenv.hostPlatform.isAarch64) [ "nouveau" ]
+    ++ optionals stdenv.hostPlatform.isx86 [ "i915" "i965" ]);
+
+  defaultVulkanDrivers = optionals stdenv.hostPlatform.isLinux ([ ]
+    ++ optional (libdrmSupport && stdenv.hostPlatform.isx86) "intel"
+    ++ optional enableRadv "radeon");
+
+  gallium_ = galliumDrivers; dri_ = driDrivers; vulkan_ = vulkanDrivers;
+in
+
+let
+  galliumDrivers =
+    (if gallium_ == null
+          then defaultGalliumDrivers
+          else gallium_)
+    ++ optional stdenv.isLinux "swrast";
+  driDrivers =
+    (if dri_ == null
+      then optionals (elem "drm" eglPlatforms) defaultDriDrivers
+      else dri_) ++ optional stdenv.isLinux "swrast";
+  vulkanDrivers =
+    if vulkan_ == null
+    then defaultVulkanDrivers
+    else vulkan_;
+
+  version = "18.3.4";
+  branch  = head (splitString "." version);
+
+  self =
+    assert xvmcSupport ->
+      elem "r600" galliumDrivers || elem "nouveau" galliumDrivers;
+    assert omxBellagioSupport ->
+      intersectLists galliumDrivers [ "r600" "radeonsi" "nouveau" ] != [];
+    assert vaSupport ->
+      intersectLists galliumDrivers [ "r600" "radeonsi" "nouveau" ] != [];
+    assert vdpauSupport ->
+      intersectLists galliumDrivers [ "r300" "r600" "radeonsi" "nouveau" ] != [];
+
+    stdenv.mkDerivation {
+      name = "mesa-noglu-${version}";
+
+      src =  fetchurl {
+        urls = [
+          "ftp://ftp.freedesktop.org/pub/mesa/mesa-${version}.tar.xz"
+          "ftp://ftp.freedesktop.org/pub/mesa/${version}/mesa-${version}.tar.xz"
+          "ftp://ftp.freedesktop.org/pub/mesa/older-versions/${branch}.x/${version}/mesa-${version}.tar.xz"
+          "https://mesa.freedesktop.org/archive/mesa-${version}.tar.xz"
+        ];
+        sha256 = "01xv03ah4l5lcfx015n3fg1620dh4nbbv6gmhh6zhdsx6sj4sc9j";
+      };
+
+      prePatch = "patchShebangs .";
+
+      # TODO:
+      #  revive ./dricore-gallium.patch when it gets ported (from Ubuntu), as it saved
+      #  ~35 MB in $drivers; watch https://launchpad.net/ubuntu/+source/mesa/+changelog
+      patches = [
+        ./symlink-drivers.patch
+        ./missing-includes.patch # dev_t needs sys/stat.h, time_t needs time.h, etc.-- fixes build w/musl
+        ./disk_cache-include-dri-driver-path-in-cache-key.patch
+
+        (fetchpatch {
+          url = https://cgit.freedesktop.org/mesa/mesa/patch/?id=eb44c36cf1729e7e200b77cf8ea755dff72d1639;
+          sha256 = "1izp38yja917241y7qslbkbmxv5ll9746ivgg2q5s64cwiydwrcc";
+        })
+        (fetchpatch {
+          url = https://cgit.freedesktop.org/mesa/mesa/patch/?id=bcc4bfc8e80da5dc4c6ee44f791f2112dac208d1;
+          sha256 = "0rijkx80anbb7g14cg9g11ha7lcf7sixc7xsjam6myyd68nl3n5n";
+        })
+      ];
+
+      outputs = [ "out" "dev" "drivers" ]
+                ++ optional (elem "swrast" galliumDrivers) "osmesa";
+
+      # TODO: Figure out how to enable opencl without having a runtime dependency on clang
+      configureFlags = [
+        "--sysconfdir=${libglvnd.driverLink}/etc"
+        "--localstatedir=/var"
+        "--with-dri-driverdir=$(drivers)/lib/dri"
+        "--with-dri-searchpath=${libglvnd.driverLink}/lib/dri"
+        "--with-va-libdir=$(drivers)/lib/dri"
+        "--with-platforms=${concatStringsSep "," eglPlatforms}"
+        "--with-gallium-drivers=${concatStringsSep "," galliumDrivers}"
+        "--with-dri-drivers=${concatStringsSep "," driDrivers}"
+        "--with-vulkan-drivers=${concatStringsSep "," vulkanDrivers}"
+        "--with-d3d-libdir=$(drivers)/lib"
+        "--with-xvmc-libdir=$(drivers)/lib"
+        "--with-vdpau-libdir=$(drivers)/lib"
+        "--with-omx-bellagio-libdir=$(drivers)/lib"
+        "--enable-texture-float"
+        "--enable-shared-glapi"
+        "--enable-llvm-shared-libs"
+
+        # XXX: I'm not sure whether x11 is actually required in theory for
+        #      dri3, but attempting to build with dri3 and without x11
+        #      results in a compile error. For future versions, check
+        #      whether this is still the case and remove the check if not:
+        #
+        #      Last checked: v18.3.4
+        (enableFeature (stdenv.isLinux && elem "x11" eglPlatforms && libdrmSupport) "dri3")
+
+        # Direct3D in Wine
+        (enableFeature (any (d: d != "swrast") galliumDrivers) "nine")
+
+        (enableFeature libglvndSupport "libglvnd")
+        "--enable-dri"
+        "--enable-driglx-direct"
+        "--enable-gles1"
+        "--enable-gles2"
+        (enableFeature (elem "x11" eglPlatforms && libdrmSupport) "glx")
+
+        # https://bugs.freedesktop.org/show_bug.cgi?id=35268
+        (enableFeature (!stdenv.hostPlatform.isMusl) "glx-tls")
+
+        # used by wine
+        (enableFeature (elem "swrast" galliumDrivers) "gallium-osmesa")
+
+        (enableFeature llvmSupport "llvm")
+        (enableFeature stdenv.isLinux "egl")
+
+        # used in vmware driver
+        (enableFeature (any (d: d != "swrast") galliumDrivers) "xa")
+
+        (enableFeature libdrmSupport "gbm")
+        (enableFeature xvmcSupport "xvmc")
+        (enableFeature vdpauSupport "vdpau")
+        (enableFeature omxBellagioSupport "omx-bellagio")
+        (enableFeature vaSupport "va")
+        "--disable-opencl"
+      ];
+
+      nativeBuildInputs = [ autoreconfHook pkgconfig python2 ]
+        ++ optionals enableRadv [ python2Packages.Mako ];
+
+      propagatedBuildInputs =
+        optionals (elem "x11" eglPlatforms) (with xorg; [ libXdamage libXxf86vm ])
+        ++ optional libdrmSupport libdrm
+        ++ optionals stdenv.isDarwin [ OpenGL Xplugin ];
+
+      buildInputs = [ expat zlib ]
+        ++ optional libglvndSupport libglvnd
+        ++ optional llvmSupport llvmPackages.llvm
+        ++ optional libelfSupport libelf
+        ++ optionals (elem "wayland" eglPlatforms) [ wayland wayland-protocols ]
+        ++ optional xvmcSupport xorg.libXvMC
+        ++ optional vdpauSupport libvdpau
+        ++ optional vaSupport libva-minimal
+        ++ optional omxBellagioSupport libomxil-bellagio
+        ++ optional withValgrind valgrind-light
+
+        ++ optionals (elem "x11" eglPlatforms)
+          ((with xorg; [ xorgproto libX11 ]))
+
+        ++ optionals (elem "x11" eglPlatforms && libdrmSupport)
+          (with xorg; [ libXext libxcb libxshmfence ])
+
+        ++ optional (elem "x11" eglPlatforms && elem "drm" eglPlatforms)
+          xorg.libXrandr;
+
+      enableParallelBuilding = true;
+      doCheck = false;
+
+      installFlags = [
+        "sysconfdir=\${drivers}/etc"
+        "localstatedir=\${TMPDIR}"
+        "vendorjsondir=\${out}/share/glvnd/egl_vendor.d"
+      ];
+
+      # TODO: probably not all .la files are completely fixed, but it shouldn't matter;
+      postInstall = ''
+        # Some installs don't have any drivers so this directory is never created.
+        mkdir -p $drivers
+      '' + optionalString (galliumDrivers != []) ''
+        # move libOSMesa to $osmesa, as it's relatively big
+        mkdir -p {$osmesa,$drivers}/lib/
+        mv -t $osmesa/lib/ $out/lib/libOSMesa*
+
+        # now fix references in .la files
+        sed "/^libdir=/s,$out,$osmesa," -i $osmesa/lib/libOSMesa*.la
+
+        # set the default search path for DRI drivers; used e.g. by X server
+        substituteInPlace "$dev/lib/pkgconfig/dri.pc" --replace '$(drivers)' "${libglvnd.driverLink}"
+
+        # remove GLES libraries; they are provided by libglvnd
+        rm $out/lib/lib{GLESv1_CM,GLESv2}.*
+
+        # remove pkgconfig files for GL/GLES/EGL; they are provided by libGL.
+        rm -f $dev/lib/pkgconfig/{gl,egl,glesv1_cm,glesv2}.pc
+
+        # move vendor files
+        mv $out/share/ $drivers/
+
+        # Update search path used by glvnd
+        for js in $drivers/share/glvnd/egl_vendor.d/*.json; do
+          substituteInPlace "$js" --replace '"libEGL_' '"'"$drivers/lib/libEGL_"
+        done
+
+        # Update search path used by pkg-config
+        substituteInPlace $dev/lib/pkgconfig/dri.pc --replace $out $drivers
+      '' + optionalString (vulkanDrivers != []) ''
+        # Update search path used by Vulkan (it's pointing to $out but
+        # drivers are in $drivers)
+        for js in $drivers/share/vulkan/icd.d/*.json; do
+          substituteInPlace "$js" --replace "$out" "$drivers"
+        done
+      '' + optionalString (any (d: d != "swrast") galliumDrivers) ''
+        # Update search path used by pkg-config
+        for pc in $dev/lib/pkgconfig/{d3d,xatracker}.pc; do
+          substituteInPlace "$pc" --replace $out $drivers
+        done
+        # move gallium-related stuff to $drivers, so $out doesn't depend on LLVM
+        mv $out/lib/libxatracker* $drivers/lib
+      '' + optionalString (vulkanDrivers != []) ''
+        # move gallium-related stuff to $drivers, so $out doesn't depend on LLVM
+        mv $out/lib/libvulkan_* $drivers/lib
+      '' + optionalString libglvndSupport ''
+        # Move other drivers to a separate output
+        mv $out/lib/lib*_mesa* $drivers/lib
+      '';
+
+      # TODO:
+      #  check $out doesn't depend on llvm: builder failures are ignored
+      #  for some reason grep -qv '${llvmPackages.llvm}' -R "$out";
+      postFixup = optionalString (galliumDrivers != []) ''
+        # add RPATH so the drivers can find the moved libgallium and libdricore9
+        # moved here to avoid problems with stripping patchelfed files
+        for lib in $drivers/lib/*.so* $drivers/lib/*/*.so*; do
+          if [[ ! -L "$lib" ]]; then
+            patchelf --set-rpath "$(patchelf --print-rpath $lib):$drivers/lib" "$lib"
+          fi
+        done
+      '';
+
+      passthru = {
+        inherit libdrm version;
+        inherit (libglvnd) driverLink;
+
+        # Use stub libraries from libglvnd and headers from Mesa.
+        stubs = stdenv.mkDerivation {
+          name = "libGL-${libglvnd.version}";
+          outputs = [ "out" "dev" ];
+
+          # On macOS, libglvnd is not supported, so we just use what mesa
+          # build. We need to also include OpenGL.framework, and some
+          # extra tricks to go along with. We add mesa’s libGLX to support
+          # the X extensions to OpenGL.
+          buildCommand = if stdenv.hostPlatform.isDarwin then ''
+            mkdir -p $out/nix-support $dev
+            echo ${OpenGL} >> $out/nix-support/propagated-build-inputs
+            ln -s ${self.out}/lib $out/lib
+
+            mkdir -p $dev/lib/pkgconfig $dev/nix-support
+            echo "$out" > $dev/nix-support/propagated-build-inputs
+            ln -s ${self.dev}/include $dev/include
+
+            cat <<EOF >$dev/lib/pkgconfig/gl.pc
+          Name: gl
+          Description: gl library
+          Version: ${self.version}
+          Libs: -L${self.out}/lib -lGL
+          Cflags: -I${self.dev}/include
+          EOF
+
+            cat <<EOF >$dev/lib/pkgconfig/glesv1_cm.pc
+          Name: glesv1_cm
+          Description: glesv1_cm library
+          Version: ${self.version}
+          Libs: -L${self.out}/lib -lGLESv1_CM
+          Cflags: -I${self.dev}/include
+          EOF
+
+            cat <<EOF >$dev/lib/pkgconfig/glesv2.pc
+          Name: glesv2
+          Description: glesv2 library
+          Version: ${self.version}
+          Libs: -L${self.out}/lib -lGLESv2
+          Cflags: -I${self.dev}/include
+          EOF
+          ''
+
+          # Otherwise, setup gl stubs to use libglvnd.
+          else ''
+            mkdir -p $out/nix-support
+            ln -s ${libglvnd.out}/lib $out/lib
+
+            mkdir -p $dev/{,lib/pkgconfig,nix-support}
+            echo "$out" > $dev/nix-support/propagated-build-inputs
+            ln -s ${self.dev}/include $dev/include
+
+            genPkgConfig() {
+              local name="$1"
+              local lib="$2"
+
+              cat <<EOF >$dev/lib/pkgconfig/$name.pc
+            Name: $name
+            Description: $lib library
+            Version: ${self.version}
+            Libs: -L${libglvnd.out}/lib -l$lib
+            Cflags: -I${self.dev}/include
+            EOF
+            }
+
+            genPkgConfig gl GL
+            genPkgConfig egl EGL
+            genPkgConfig glesv1_cm GLESv1_CM
+            genPkgConfig glesv2 GLESv2
+          '';
+        };
+      };
+
+      meta = {
+        description = "An open source implementation of OpenGL";
+        homepage = https://www.mesa3d.org/;
+        license = licenses.mit; # X11 variant, in most files
+        platforms = platforms.mesaPlatforms;
+        maintainers = with maintainers; [ vcunat ];
+      };
+    };
+in self
diff --git a/nixpkgs/pkgs/development/libraries/mesa/disk_cache-include-dri-driver-path-in-cache-key.patch b/nixpkgs/pkgs/development/libraries/mesa/disk_cache-include-dri-driver-path-in-cache-key.patch
new file mode 100644
index 000000000000..37813db89347
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/mesa/disk_cache-include-dri-driver-path-in-cache-key.patch
@@ -0,0 +1,52 @@
+From 2a1e32b4105fe95413a615a44d40938920ea1a19 Mon Sep 17 00:00:00 2001
+From: David McFarland <corngood@gmail.com>
+Date: Mon, 6 Aug 2018 15:52:11 -0300
+Subject: [PATCH] disk_cache: include dri driver path in cache key
+
+This fixes invalid cache hits on NixOS where all shared library
+timestamps in /nix/store are zero.
+---
+ src/util/Makefile.am  | 3 +++
+ src/util/disk_cache.c | 3 +++
+ 2 files changed, 6 insertions(+)
+
+diff --git a/src/util/Makefile.am b/src/util/Makefile.am
+index bafb57439a..a22e2e41eb 100644
+--- a/src/util/Makefile.am
++++ b/src/util/Makefile.am
+@@ -35,6 +35,9 @@ noinst_LTLIBRARIES = \
+ 	libmesautil.la \
+ 	libxmlconfig.la
+ 
++AM_CFLAGS = \
++	-DDISK_CACHE_KEY=\"$(drivers)\"
++
+ AM_CPPFLAGS = \
+ 	$(PTHREAD_CFLAGS) \
+ 	-I$(top_srcdir)/include
+diff --git a/src/util/disk_cache.c b/src/util/disk_cache.c
+index 368ec41792..071220b2ba 100644
+--- a/src/util/disk_cache.c
++++ b/src/util/disk_cache.c
+@@ -388,8 +388,10 @@ disk_cache_create(const char *gpu_name, const char *driver_id,
+ 
+    /* Create driver id keys */
+    size_t id_size = strlen(driver_id) + 1;
++   size_t key_size = strlen(DISK_CACHE_KEY) + 1;
+    size_t gpu_name_size = strlen(gpu_name) + 1;
+    cache->driver_keys_blob_size += id_size;
++   cache->driver_keys_blob_size += key_size;
+    cache->driver_keys_blob_size += gpu_name_size;
+ 
+    /* We sometimes store entire structs that contains a pointers in the cache,
+@@ -410,6 +412,7 @@ disk_cache_create(const char *gpu_name, const char *driver_id,
+    uint8_t *drv_key_blob = cache->driver_keys_blob;
+    DRV_KEY_CPY(drv_key_blob, &cache_version, cv_size)
+    DRV_KEY_CPY(drv_key_blob, driver_id, id_size)
++   DRV_KEY_CPY(drv_key_blob, DISK_CACHE_KEY, key_size)
+    DRV_KEY_CPY(drv_key_blob, gpu_name, gpu_name_size)
+    DRV_KEY_CPY(drv_key_blob, &ptr_size, ptr_size_size)
+    DRV_KEY_CPY(drv_key_blob, &driver_flags, driver_flags_size)
+-- 
+2.19.1
+
diff --git a/nixpkgs/pkgs/development/libraries/mesa/missing-includes.patch b/nixpkgs/pkgs/development/libraries/mesa/missing-includes.patch
new file mode 100644
index 000000000000..18e7d5437b15
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/mesa/missing-includes.patch
@@ -0,0 +1,45 @@
+--- ./src/gallium/winsys/svga/drm/vmw_screen.h.orig
++++ ./src/gallium/winsys/svga/drm/vmw_screen.h
+@@ -34,7 +34,7 @@
+ #ifndef VMW_SCREEN_H_
+ #define VMW_SCREEN_H_
+ 
+-
++#include <sys/stat.h>
+ #include "pipe/p_compiler.h"
+ #include "pipe/p_state.h"
+ 
+--- ./src/gallium/state_trackers/nine/threadpool.h.orig	2015-05-07 14:10:53.443337212 +0200
++++ ./src/gallium/state_trackers/nine/threadpool.h	2015-05-07 14:11:04.210307653 +0200
+@@ -24,6 +24,8 @@
+ #ifndef _THREADPOOL_H_
+ #define _THREADPOOL_H_
+ 
++#include <pthread.h>
++
+ #define MAXTHREADS 1
+ 
+ struct threadpool {
+--- ./src/util/rand_xor.c.orig	2017-06-20 00:38:57.199474067 +0200
++++ ./src/util/rand_xor.c	2017-06-20 00:40:31.351279557 +0200
+@@ -23,7 +23,9 @@
+  */
+ 
+ #if defined(__linux__)
++#include <sys/types.h>
+ #include <sys/file.h>
++#include <sys/stat.h>
+ #include <unistd.h>
+ #include <fcntl.h>
+ #else
+--- ./src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.h
++++ ./src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.h
+@@ -28,6 +28,8 @@
+ #ifndef RADV_AMDGPU_WINSYS_H
+ #define RADV_AMDGPU_WINSYS_H
+ 
++#include <sys/types.h>
++
+ #include "radv_radeon_winsys.h"
+ #include "ac_gpu_info.h"
+ #include "addrlib/addrinterface.h"<Paste>
diff --git a/nixpkgs/pkgs/development/libraries/mesa/symlink-drivers.patch b/nixpkgs/pkgs/development/libraries/mesa/symlink-drivers.patch
new file mode 100644
index 000000000000..af2ec9fdb096
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/mesa/symlink-drivers.patch
@@ -0,0 +1,112 @@
+diff -ru -x '*~' mesa-12.0.3-orig/src/gallium/targets/dri/Makefile.am mesa-12.0.3/src/gallium/targets/dri/Makefile.am
+--- mesa-12.0.3-orig/src/gallium/targets/dri/Makefile.am	2016-09-08 18:57:48.000000000 +0200
++++ mesa-12.0.3/src/gallium/targets/dri/Makefile.am	2016-09-22 14:42:19.173575498 +0200
+@@ -134,14 +134,13 @@
+ 	done;
+ endif
+ 
+-# hardlink each megadriver instance, but don't actually have
+-# gallium_dri.so in the set of final installed files.
++# symlink each megadriver instance.
+ install-data-hook:
+ 	for i in $(TARGET_DRIVERS); do                                  \
+-		ln -f $(DESTDIR)$(dridir)/gallium_dri.so                \
++		ln -srf $(DESTDIR)$(dridir)/gallium_dri.so              \
+ 		      $(DESTDIR)$(dridir)/$${i}_dri.so;                 \
+ 	done;                                                           \
+-	$(RM) $(DESTDIR)$(dridir)/gallium_dri.*;                        \
++	$(RM) $(DESTDIR)$(dridir)/gallium_dri.la                        \
+ 	$(RM) -d $(DESTDIR)$(dridir) &>/dev/null || true
+ 
+ uninstall-hook:
+ 	for i in $(TARGET_DRIVERS); do                                  \
+diff -ru -x '*~' mesa-12.0.3-orig/src/gallium/targets/va/Makefile.am mesa-12.0.3/src/gallium/targets/va/Makefile.am
+--- mesa-12.0.3-orig/src/gallium/targets/va/Makefile.am	2016-09-08 18:57:48.000000000 +0200
++++ mesa-12.0.3/src/gallium/targets/va/Makefile.am	2016-09-22 14:45:39.635963339 +0200
+@@ -71,10 +71,10 @@
+ # gallium_drv_video.so in the set of final installed files.
+ install-data-hook:
+ 	for i in $(TARGET_DRIVERS); do                                  \
+-		ln -f $(DESTDIR)$(vadir)/gallium_drv_video.so                \
++		ln -srf $(DESTDIR)$(vadir)/gallium_drv_video.so                \
+ 		      $(DESTDIR)$(vadir)/$${i}_drv_video.so;                 \
+ 	done;                                                           \
+-	$(RM) $(DESTDIR)$(vadir)/gallium_drv_video.*
++	$(RM) $(DESTDIR)$(vadir)/gallium_drv_video.la
+ 
+ uninstall-hook:
+ 	for i in $(TARGET_DRIVERS); do                                  \
+diff -ru -x '*~' mesa-12.0.3-orig/src/gallium/targets/vdpau/Makefile.am mesa-12.0.3/src/gallium/targets/vdpau/Makefile.am
+--- mesa-12.0.3-orig/src/gallium/targets/vdpau/Makefile.am	2016-05-24 21:19:37.000000000 +0200
++++ mesa-12.0.3/src/gallium/targets/vdpau/Makefile.am	2016-09-22 14:42:19.173575498 +0200
+@@ -103,15 +103,14 @@
+ 	done;
+ endif
+ 
+-# hardlink each megadriver instance, but don't actually have
+-# libvdpau_gallium.so in the set of final installed files.
++# symlink each megadriver instance.
+ install-data-hook:
+ 	$(AM_V_GEN)dest_dir=$(DESTDIR)/$(vdpaudir);			\
+ 	for i in $(TARGET_DRIVERS); do					\
+ 		j=libvdpau_gallium.$(LIB_EXT);				\
+ 		k=libvdpau_$${i}.$(LIB_EXT);				\
+ 		l=$${k}.$(VDPAU_MAJOR).$(VDPAU_MINOR).0;		\
+-		ln -f $${dest_dir}/$${j}.$(VDPAU_MAJOR).$(VDPAU_MINOR).0 \
++		ln -srf $${dest_dir}/$${j}.$(VDPAU_MAJOR).$(VDPAU_MINOR).0 \
+ 		      $${dest_dir}/$${l};				\
+ 		ln -sf $${l}						\
+ 		       $${dest_dir}/$${k}.$(VDPAU_MAJOR).$(VDPAU_MINOR); \
+@@ -120,7 +119,7 @@
+ 		ln -sf $${l}						\
+ 		       $${dest_dir}/$${k};				\
+ 	done;								\
+-	$(RM) $${dest_dir}/libvdpau_gallium.*;				\
++	$(RM) $${dest_dir}/libvdpau_gallium.la				\
+ 	$(RM) -d $${dest_dir} &>/dev/null || true
+ 
+ uninstall-hook:
+ 	for i in $(TARGET_DRIVERS); do					\
+diff -ru -x '*~' mesa-12.0.3-orig/src/gallium/targets/xvmc/Makefile.am mesa-12.0.3/src/gallium/targets/xvmc/Makefile.am
+--- mesa-12.0.3-orig/src/gallium/targets/xvmc/Makefile.am	2016-05-24 21:19:37.000000000 +0200
++++ mesa-12.0.3/src/gallium/targets/xvmc/Makefile.am	2016-09-22 14:54:22.291014543 +0200
+@@ -73,7 +73,7 @@
+ 		j=libXvMCgallium.$(LIB_EXT);				\
+ 		k=libXvMC$${i}.$(LIB_EXT);				\
+ 		l=$${k}.$(XVMC_MAJOR).$(XVMC_MINOR).0;			\
+-		ln -f $${dest_dir}/$${j}.$(XVMC_MAJOR).$(XVMC_MINOR).0	\
++		ln -srf $${dest_dir}/$${j}.$(XVMC_MAJOR).$(XVMC_MINOR).0 \
+ 		      $${dest_dir}/$${l};				\
+ 		ln -sf $${l}						\
+ 		       $${dest_dir}/$${k}.$(XVMC_MAJOR).$(XVMC_MINOR);	\
+@@ -82,7 +82,7 @@
+ 		ln -sf $${l}						\
+ 		       $${dest_dir}/$${k};				\
+ 	done;								\
+-	$(RM) $${dest_dir}/libXvMCgallium.*;				\
++	$(RM) $${dest_dir}/libXvMCgallium.la				\
+ 	$(RM) -d $${dest_dir} &>/dev/null || true
+ 
+ uninstall-hook:
+ 	for i in $(TARGET_DRIVERS); do					\
+diff -ru -x '*~' mesa-12.0.3-orig/src/mesa/drivers/dri/Makefile.am mesa-12.0.3/src/mesa/drivers/dri/Makefile.am
+--- mesa-12.0.3-orig/src/mesa/drivers/dri/Makefile.am	2016-09-08 18:57:48.000000000 +0200
++++ mesa-12.0.3/src/mesa/drivers/dri/Makefile.am	2016-09-22 14:42:19.173575498 +0200
+@@ -94,14 +94,13 @@
+ 	done;
+ endif
+ 
+-# hardlink each megadriver instance, but don't actually have
+-# mesa_dri_drivers.so in the set of final installed files.
++# symink each megadriver instance.
+ install-data-hook:
+ 	for i in $(MEGADRIVERS); do \
+-		ln -f $(DESTDIR)$(dridir)/mesa_dri_drivers.so \
++		ln -srf $(DESTDIR)$(dridir)/mesa_dri_drivers.so \
+ 		      $(DESTDIR)$(dridir)/$$i; \
+ 	done;
+-	$(RM) $(DESTDIR)$(dridir)/mesa_dri_drivers.*
++	$(RM) $(DESTDIR)$(dridir)/mesa_dri_drivers.la
+ 
+ uninstall-hook:
+ 	for i in $(MEGADRIVERS); do \
diff --git a/nixpkgs/pkgs/development/libraries/microsoft_gsl/default.nix b/nixpkgs/pkgs/development/libraries/microsoft_gsl/default.nix
new file mode 100644
index 000000000000..788d2c5d6188
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/microsoft_gsl/default.nix
@@ -0,0 +1,40 @@
+{ stdenv, fetchFromGitHub, catch, cmake
+}:
+
+let
+  nativeBuild = stdenv.hostPlatform == stdenv.buildPlatform;
+in
+stdenv.mkDerivation rec {
+  name = "microsoft_gsl-${version}";
+  version = "2.0.0";
+
+  src = fetchFromGitHub {
+    owner = "Microsoft";
+    repo = "GSL";
+    rev = "v${version}";
+    sha256 = "1kxfca9ik934nkzyn34ingkyvwpc09li81cg1yc6vqcrdw51l4ri";
+  };
+
+  # build phase just runs the unit tests, so skip it if
+  # we're doing a cross build
+  nativeBuildInputs = [ catch cmake ];
+  buildPhase = if nativeBuild then "make" else "true";
+
+  installPhase = ''
+    mkdir -p $out/include
+    mv ../include/ $out/
+  '';
+
+  meta = with stdenv.lib; {
+    description = "C++ Core Guideline support library";
+    longDescription = ''
+     The Guideline Support Library (GSL) contains functions and types that are suggested for
+     use by the C++ Core Guidelines maintained by the Standard C++ Foundation.
+     This package contains Microsoft's implementation of GSL.
+    '';
+    homepage    = "https://github.com/Microsoft/GSL";
+    license     = licenses.mit;
+    platforms   = platforms.all;
+    maintainers = with maintainers; [ thoughtpolice xwvvvvwx yuriaisaka ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/mimetic/default.nix b/nixpkgs/pkgs/development/libraries/mimetic/default.nix
new file mode 100644
index 000000000000..7a06f9277c95
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/mimetic/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, fetchurl, cutee }:
+
+stdenv.mkDerivation rec {
+  pname = "mimetic";
+  version = "0.9.8";
+  name = "${pname}-${version}";
+
+  src = fetchurl {
+    url    = "http://www.codesink.org/download/${pname}-${version}.tar.gz";
+    sha256 = "003715lvj4nx23arn1s9ss6hgc2yblkwfy5h94li6pjz2a6xc1rs";
+  };
+
+  buildInputs = [ cutee ];
+
+  meta = with stdenv.lib; {
+    description = "MIME handling library";
+    homepage    = http://www.codesink.org/mimetic_mime_library.html;
+    license     = licenses.mit;
+    maintainers = with maintainers; [ leenaars];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/miniball/default.nix b/nixpkgs/pkgs/development/libraries/miniball/default.nix
new file mode 100644
index 000000000000..791cc9f3f911
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/miniball/default.nix
@@ -0,0 +1,26 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "miniball-${version}";
+  version = "3.0";
+
+  src = fetchurl {
+    url = "https://www.inf.ethz.ch/personal/gaertner/miniball/Miniball.hpp";
+    sha256 = "1piap5v8wqq0aachrq6j50qkr01gzpyndl6vf661vyykrfq0nnd2";
+  };
+
+  phases = [ "installPhase" ];
+
+  installPhase = ''
+    mkdir -p $out/include
+    cp $src $out/include/miniball.hpp
+  '';
+
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/minixml/default.nix b/nixpkgs/pkgs/development/libraries/minixml/default.nix
new file mode 100644
index 000000000000..972cc3e738c7
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/minixml/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchFromGitHub }:
+
+stdenv.mkDerivation rec {
+  name = "mxml-${version}";
+  version = "3.0";
+
+  src = fetchFromGitHub {
+    owner = "michaelrsweet";
+    repo = "mxml";
+    rev = "v${version}";
+    sha256 = "0madp2v2md3xq96aham91byns6qy4byd5pbg28q827fdahfhpmq7";
+  };
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    description = "A small XML library";
+    homepage = https://www.msweet.org/mxml/;
+    license = licenses.asl20;
+    platforms = platforms.linux;
+    maintainers = [ maintainers.goibhniu ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/minizip/default.nix b/nixpkgs/pkgs/development/libraries/minizip/default.nix
new file mode 100644
index 000000000000..c88a978574a7
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/minizip/default.nix
@@ -0,0 +1,16 @@
+{ stdenv, zlib, autoreconfHook }:
+
+stdenv.mkDerivation {
+  name = "minizip-${zlib.version}";
+  inherit (zlib) src;
+
+  nativeBuildInputs = [ autoreconfHook ];
+  buildInputs = [ zlib ];
+
+  sourceRoot = "zlib-${zlib.version}/contrib/minizip";
+
+  meta = {
+    inherit (zlib.meta) license homepage;
+    platforms = stdenv.lib.platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/mlt/default.nix b/nixpkgs/pkgs/development/libraries/mlt/default.nix
new file mode 100644
index 000000000000..d8075c41a703
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/mlt/default.nix
@@ -0,0 +1,49 @@
+{ stdenv, fetchFromGitHub, makeWrapper
+, SDL, ffmpeg, frei0r, libjack2, libdv, libsamplerate
+, libvorbis, libxml2, movit, pkgconfig, sox
+, gtk2
+}:
+
+stdenv.mkDerivation rec {
+  name = "mlt-${version}";
+  version = "6.10.0";
+
+  src = fetchFromGitHub {
+    owner = "mltframework";
+    repo = "mlt";
+    rev = "v${version}";
+    sha256 = "0ki86yslr5ywa6sz8pjrgd9a4rn2rr4mss2zkmqi7pq8prgsm1fr";
+  };
+
+  buildInputs = [
+    SDL ffmpeg frei0r libjack2 libdv libsamplerate libvorbis libxml2
+    makeWrapper movit pkgconfig sox
+    gtk2
+  ];
+
+  # Mostly taken from:
+  # http://www.kdenlive.org/user-manual/downloading-and-installing-kdenlive/installing-source/installing-mlt-rendering-engine
+  configureFlags = [
+    "--avformat-swscale" "--enable-gpl" "--enable-gpl" "--enable-gpl3"
+    "--enable-opengl"
+  ];
+
+  enableParallelBuilding = true;
+
+  postInstall = ''
+    wrapProgram $out/bin/melt --prefix FREI0R_PATH : ${frei0r}/lib/frei0r-1
+
+    # Remove an unnecessary reference to movit.dev.
+    s=${movit.dev}/include
+    t=$(for ((i = 0; i < ''${#s}; i++)); do echo -n X; done)
+    sed -i $out/lib/mlt/libmltopengl.so -e "s|$s|$t|g"
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Open source multimedia framework, designed for television broadcasting";
+    homepage = https://www.mltframework.org;
+    license = licenses.gpl3;
+    maintainers = [ maintainers.tohl ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/mlt/qt-5.nix b/nixpkgs/pkgs/development/libraries/mlt/qt-5.nix
new file mode 100644
index 000000000000..85ea7a6292a5
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/mlt/qt-5.nix
@@ -0,0 +1,67 @@
+{ stdenv, fetchFromGitHub, SDL, ffmpeg, frei0r, libjack2, libdv, libsamplerate
+, libvorbis, libxml2, makeWrapper, movit, pkgconfig, sox, qtbase, qtsvg
+, fftw, vid-stab, opencv3, ladspa-sdk
+}:
+
+let inherit (stdenv.lib) getDev; in
+
+stdenv.mkDerivation rec {
+  name = "mlt-${version}";
+  version = "6.14.0";
+
+  src = fetchFromGitHub {
+    owner = "mltframework";
+    repo = "mlt";
+    rev = "v${version}";
+    sha256 = "0lxjrd0rsadkfwg86qp0p176kqd9zdfhbmjygmrg5jklmxzd5i25";
+  };
+
+  buildInputs = [
+    SDL ffmpeg frei0r libjack2 libdv libsamplerate libvorbis libxml2
+    makeWrapper movit pkgconfig qtbase qtsvg sox fftw vid-stab opencv3
+    ladspa-sdk
+  ];
+
+  outputs = [ "out" "dev" ];
+
+  # Mostly taken from:
+  # http://www.kdenlive.org/user-manual/downloading-and-installing-kdenlive/installing-source/installing-mlt-rendering-engine
+  configureFlags = [
+    "--avformat-swscale" "--enable-gpl" "--enable-gpl" "--enable-gpl3"
+    "--enable-opengl"
+  ];
+
+  # mlt is unable to cope with our multi-prefix Qt build
+  # because it does not use CMake or qmake.
+  NIX_CFLAGS_COMPILE = [ "-I${getDev qtsvg}/include/QtSvg" ];
+
+  CXXFLAGS = "-std=c++11";
+
+  enableParallelBuilding = true;
+
+  postInstall = ''
+    wrapProgram $out/bin/melt --prefix FREI0R_PATH : ${frei0r}/lib/frei0r-1
+
+    # Remove an unnecessary reference to movit.dev.
+    s=${movit.dev}/include
+    t=$(for ((i = 0; i < ''${#s}; i++)); do echo -n X; done)
+    sed -i $out/lib/mlt/libmltopengl.so -e "s|$s|$t|g"
+
+    # Remove an unnecessary reference to movit.dev.
+    s=${qtbase.dev}/include
+    t=$(for ((i = 0; i < ''${#s}; i++)); do echo -n X; done)
+    sed -i $out/lib/mlt/libmltqt.so -e "s|$s|$t|g"
+  '';
+
+  passthru = {
+    inherit ffmpeg;
+  };
+
+  meta = with stdenv.lib; {
+    description = "Open source multimedia framework, designed for television broadcasting";
+    homepage = https://www.mltframework.org/;
+    license = licenses.gpl3;
+    maintainers = [ maintainers.goibhniu ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/mm-common/default.nix b/nixpkgs/pkgs/development/libraries/mm-common/default.nix
new file mode 100644
index 000000000000..9519e295213b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/mm-common/default.nix
@@ -0,0 +1,33 @@
+{ stdenv, fetchurl, gnome3 }:
+
+stdenv.mkDerivation rec {
+  pname = "mm-common";
+  version = "0.9.12";
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    sha256 = "02vwgv404b56wxy0gnm9xq9fvzgn9dhfqcy2hhl78ljv3v7drzyf";
+  };
+
+  passthru = {
+    updateScript = gnome3.updateScript {
+      packageName = pname;
+      versionPolicy = "none";
+    };
+  };
+
+  meta = with stdenv.lib; {
+    description = "Common build files of GLib/GTK+ C++ bindings";
+    longDescription = ''
+      The mm-common module provides the build infrastructure and utilities
+      shared among the GNOME C++ binding libraries. It is only a required
+      dependency for building the C++ bindings from the gnome.org version
+      control repository. An installation of mm-common is not required for
+      building tarball releases, unless configured to use maintainer-mode.
+    '';
+    homepage = https://www.gtkmm.org;
+    license = licenses.gpl2Plus;
+    maintainers = gnome3.maintainers;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/mongoc/default.nix b/nixpkgs/pkgs/development/libraries/mongoc/default.nix
new file mode 100644
index 000000000000..2a933ef78401
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/mongoc/default.nix
@@ -0,0 +1,26 @@
+{ stdenv, fetchzip, perl, pkgconfig, libbson
+, openssl, which, zlib, snappy
+}:
+
+stdenv.mkDerivation rec {
+  name = "mongoc-${version}";
+  version = "1.8.0";
+
+  src = fetchzip {
+    url = "https://github.com/mongodb/mongo-c-driver/releases/download/${version}/mongo-c-driver-${version}.tar.gz";
+    sha256 = "1vnnk3pwbcmwva1010bl111kdcdx3yb2w7j7a78hhvrm1k9r1wp8";
+  };
+
+  nativeBuildInputs = [ pkgconfig which perl ];
+  buildInputs = [ openssl zlib ];
+  propagatedBuildInputs = [ libbson snappy ];
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    description = "The official C client library for MongoDB";
+    homepage = https://github.com/mongodb/mongo-c-driver;
+    license = licenses.asl20;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/mono-addins/default.nix b/nixpkgs/pkgs/development/libraries/mono-addins/default.nix
new file mode 100644
index 000000000000..58905cce82ab
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/mono-addins/default.nix
@@ -0,0 +1,32 @@
+{ stdenv, fetchFromGitHub, autoreconfHook, pkgconfig, mono4, gtk-sharp-2_0 }:
+
+stdenv.mkDerivation rec {
+  name = "mono-addins-${version}";
+  version = "1.3.3";
+
+  src = fetchFromGitHub {
+    owner = "mono";
+    repo = "mono-addins";
+
+    rev = "mono-addins-${version}";
+    sha256 = "018g3bd8afjc39h22h2j5r6ldsdn08ynx7wg889gdvnxg3hrxgl2";
+  };
+
+  nativeBuildInputs = [ pkgconfig autoreconfHook ];
+
+  # Use msbuild when https://github.com/NixOS/nixpkgs/pull/43680 is merged
+  buildInputs = [ mono4 gtk-sharp-2_0 ];
+
+  dontStrip = true;
+
+  meta = with stdenv.lib; {
+    homepage = https://www.mono-project.com/archived/monoaddins/;
+    description = "A generic framework for creating extensible applications";
+    longDescription = ''
+      Mono.Addins is a generic framework for creating extensible applications,
+      and for creating libraries which extend those applications.
+    '';
+    platforms = platforms.linux;
+    license = licenses.mit;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/mono-zeroconf/default.nix b/nixpkgs/pkgs/development/libraries/mono-zeroconf/default.nix
new file mode 100644
index 000000000000..ba9e2a741e40
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/mono-zeroconf/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchurl, which, pkgconfig, mono }:
+
+stdenv.mkDerivation rec {
+  name = "mono-zeroconf-${version}";
+  version = "0.9.0";
+
+  src = fetchurl {
+    url = "http://download.banshee-project.org/mono-zeroconf/mono-zeroconf-${version}.tar.bz2";
+    sha256 = "1qfp4qvsx7rc2shj1chi2y7fxn10rwi70rw2y54b2i8a4jq7gpkb";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ which mono ];
+
+  dontStrip = true;
+
+  configureFlags = [ "--disable-docs" ];
+
+  meta = with stdenv.lib; {
+    description = "A cross platform Zero Configuration Networking library for Mono and .NET";
+    homepage = https://www.mono-project.com/archived/monozeroconf/;
+    platforms = platforms.linux;
+    license = licenses.mit;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/motif/Add-X.Org-to-bindings-file.patch b/nixpkgs/pkgs/development/libraries/motif/Add-X.Org-to-bindings-file.patch
new file mode 100644
index 000000000000..84b62dcd4eb0
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/motif/Add-X.Org-to-bindings-file.patch
@@ -0,0 +1,7 @@
+--- a/bindings/xmbind.alias
++++ b/bindings/xmbind.alias
+@@ -62,3 +62,4 @@
+ "Sun Microsystems, Inc."				sun
+ ! "Sun Microsystems, Inc."				sun_at
+ "Tektronix, Inc."					tek
++"The X.Org Foundation"				tpc
diff --git a/nixpkgs/pkgs/development/libraries/motif/Remove-unsupported-weak-refs-on-darwin.patch b/nixpkgs/pkgs/development/libraries/motif/Remove-unsupported-weak-refs-on-darwin.patch
new file mode 100644
index 000000000000..801310ba41ce
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/motif/Remove-unsupported-weak-refs-on-darwin.patch
@@ -0,0 +1,12 @@
+--- a/lib/Xm/XmP.h
++++ b/lib/Xm/XmP.h
+@@ -1437,7 +1437,7 @@ extern void _XmDestroyParentCallback(
+ 
+ #endif /* NO_XM_1_2_BC */
+ 
+-#if __GNUC__
++#if __GNUC__ && ! __APPLE__
+ #  define XM_DEPRECATED  __attribute__((__deprecated__))
+ #  define XM_ALIAS(sym)  __attribute__((__weak__,alias(#sym)))
+ #else
+
diff --git a/nixpkgs/pkgs/development/libraries/motif/Use-correct-header-for-malloc.patch b/nixpkgs/pkgs/development/libraries/motif/Use-correct-header-for-malloc.patch
new file mode 100644
index 000000000000..d91e43ba2d3c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/motif/Use-correct-header-for-malloc.patch
@@ -0,0 +1,19 @@
+--- a/demos/programs/workspace/xrmLib.c
++++ b/demos/programs/workspace/xrmLib.c
+@@ -30,7 +30,14 @@ static char rcsid[] = "$XConsortium: xrmLib.c /main/6 1995/07/14 10:01:41 drk $"
+ #endif
+ 
+ #include <stdio.h>
+-#include <malloc.h>
++#if defined(__cplusplus) || defined(__STDC__) || defined(__EXTENSIONS__)
++#  include <stdlib.h>
++#  if defined(HAVE_MALLOC_H)
++#  include <malloc.h>
++#  elif defined(HAVE_SYS_MALLOC_H)
++#  include <sys/malloc.h>
++#  endif
++#endif
+ #include <Xm/Xm.h>
+ #include "wsm.h"
+ #include "wsmDebug.h"
+
diff --git a/nixpkgs/pkgs/development/libraries/motif/default.nix b/nixpkgs/pkgs/development/libraries/motif/default.nix
new file mode 100644
index 000000000000..51591c9d8e8b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/motif/default.nix
@@ -0,0 +1,51 @@
+{ stdenv, fetchurl, pkgconfig, libtool
+, xlibsWrapper, xbitmaps, libXrender, libXmu, libXt
+, expat, libjpeg, libpng, libiconv
+, flex
+, libXp, libXau
+, demoSupport ? false
+}:
+# refer to the gentoo package
+
+stdenv.mkDerivation rec {
+  name = "motif-${version}";
+  version = "2.3.6";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/motif/${name}.tar.gz";
+    sha256 = "1ksqbp0bzdw6wcrx8s4hj4ivvxmw54hz85l2xfigb87cxmmhx0gs";
+  };
+
+  buildInputs = [
+    libtool
+    xlibsWrapper xbitmaps libXrender libXmu libXt
+    expat libjpeg libpng libiconv
+  ];
+
+  nativeBuildInputs = [ pkgconfig flex ];
+
+  propagatedBuildInputs = [ libXp libXau ];
+
+  hardeningDisable = [ "format" ];
+
+  makeFlags = [ "CFLAGS=-fno-strict-aliasing" ];
+
+  prePatch = ''
+    rm lib/Xm/Xm.h
+  '' + stdenv.lib.optionalString (!demoSupport) ''
+    sed '/^SUBDIRS =,^$/s/\<demos\>//' -i Makefile.{am,in}
+  '';
+
+  patches = [ ./Remove-unsupported-weak-refs-on-darwin.patch
+              ./Use-correct-header-for-malloc.patch
+              ./Add-X.Org-to-bindings-file.patch
+            ];
+
+  meta = with stdenv.lib; {
+    homepage = https://motif.ics.com;
+    description = "Unix standard widget-toolkit and window-manager";
+    platforms = with platforms; linux ++ darwin;
+    license = with licenses; [ lgpl21 ];
+    maintainers = with maintainers; [ ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/movit/default.nix b/nixpkgs/pkgs/development/libraries/movit/default.nix
new file mode 100644
index 000000000000..849da2e6cad5
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/movit/default.nix
@@ -0,0 +1,30 @@
+{ stdenv, fetchurl, SDL2, eigen, epoxy, fftw, gtest, pkgconfig }:
+
+stdenv.mkDerivation rec {
+  name = "movit-${version}";
+  version = "1.6.2";
+
+  src = fetchurl {
+    url = "https://movit.sesse.net/${name}.tar.gz";
+    sha256 = "1q9h086v6h3da4b9qyflcjx73cgnqjhb92rv6g4j90m34dndaa3l";
+  };
+
+  outputs = [ "out" "dev" ];
+
+  GTEST_DIR = "${gtest.src}/googletest";
+
+  propagatedBuildInputs = [ eigen epoxy ];
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ SDL2 fftw gtest ];
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    description = "High-performance, high-quality video filters for the GPU";
+    homepage = https://movit.sesse.net;
+    license = licenses.gpl2Plus;
+    maintainers = [ maintainers.goibhniu ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/mp4v2/default.nix b/nixpkgs/pkgs/development/libraries/mp4v2/default.nix
new file mode 100644
index 000000000000..51081f25bf2d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/mp4v2/default.nix
@@ -0,0 +1,39 @@
+{ stdenv, lib, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "mp4v2-2.0.0";
+
+  src = fetchurl {
+    url = "https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/mp4v2/${name}.tar.bz2";
+    sha256 = "0f438bimimsvxjbdp4vsr8hjw2nwggmhaxgcw07g2z361fkbj683";
+  };
+
+  patches = [
+    (fetchurl {
+      name = "gcc-7.patch";
+      url = "https://src.fedoraproject.org/cgit/rpms/libmp4v2.git/plain/"
+          + "0004-Fix-GCC7-build.patch?id=d7aeedabb";
+      sha256 = "0sbn0il7lmk77yrjyb4f0a3z3h8gsmdkscvz5n9hmrrrhrwf672w";
+    })
+  ];
+
+  # `faac' expects `mp4.h'.
+  postInstall = "ln -s mp4v2/mp4v2.h $out/include/mp4.h";
+
+  hardeningDisable = [ "format" ];
+
+  enableParallelBuilding = true;
+
+  meta = {
+    description = "Abandoned library. Provides functions to read, create, and modify mp4 files";
+    longDescription = ''
+      MP4v2 library provides an API to work with mp4 files
+      as defined by ISO-IEC:14496-1:2001 MPEG-4 Systems.
+      This container format is derived from Apple's QuickTime format.
+    '';
+    homepage = https://code.google.com/archive/p/mp4v2/;
+    maintainers = [ lib.maintainers.Anton-Latukha ];
+    platforms = lib.platforms.unix;
+    license = lib.licenses.mpl11;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/mpfi/default.nix b/nixpkgs/pkgs/development/libraries/mpfi/default.nix
new file mode 100644
index 000000000000..6b607e94bd49
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/mpfi/default.nix
@@ -0,0 +1,22 @@
+{stdenv, fetchurl, mpfr}:
+stdenv.mkDerivation rec {
+  name = "mpfi-${version}";
+  version = "1.5.3";
+  file_nr = "37331";
+  src = fetchurl {
+    # NOTE: the file_nr is whats important here. The actual package name (including the version)
+    # is ignored. To find out the correct file_nr, go to https://gforge.inria.fr/projects/mpfi/
+    # and click on Download in the section "Latest File Releases".
+    url = "https://gforge.inria.fr/frs/download.php/file/${file_nr}/mpfi-${version}.tar.bz2";
+    sha256 = "0bqr8yibl7jbrp0bw7xk1lm7nis7rv26jsz6y8ycvih8n9bx90r3";
+  };
+  buildInputs = [mpfr];
+  meta = {
+    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.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/mpfr/default.nix b/nixpkgs/pkgs/development/libraries/mpfr/default.nix
new file mode 100644
index 000000000000..e32c83af8a75
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/mpfr/default.nix
@@ -0,0 +1,49 @@
+{ stdenv, fetchurl, gmp }:
+
+stdenv.mkDerivation rec {
+  version = "4.0.2";
+  name = "mpfr-${version}";
+
+  src = fetchurl {
+    urls = [
+      #"https://www.mpfr.org/${name}/${name}.tar.xz"
+      "mirror://gnu/mpfr/${name}.tar.xz"
+    ];
+    sha256 = "12m3amcavhpqygc499s3fzqlb8f2j2rr7fkqsm10xbjfc04fffqx";
+  };
+
+  outputs = [ "out" "dev" "doc" "info" ];
+
+  # mpfr.h requires gmp.h
+  propagatedBuildInputs = [ gmp ];
+
+  configureFlags =
+    stdenv.lib.optional stdenv.hostPlatform.isSunOS "--disable-thread-safe" ++
+    stdenv.lib.optional stdenv.hostPlatform.is64bit "--with-pic";
+
+  doCheck = true; # not cross;
+
+  enableParallelBuilding = true;
+
+  meta = {
+    homepage = https://www.mpfr.org/;
+    description = "Library for multiple-precision floating-point arithmetic";
+
+    longDescription = ''
+      The GNU MPFR library is a C library for multiple-precision
+      floating-point computations with correct rounding.  MPFR is
+      based on the GMP multiple-precision library.
+
+      The main goal of MPFR is to provide a library for
+      multiple-precision floating-point computation which is both
+      efficient and has a well-defined semantics.  It copies the good
+      ideas from the ANSI/IEEE-754 standard for double-precision
+      floating-point arithmetic (53-bit mantissa).
+    '';
+
+    license = stdenv.lib.licenses.lgpl2Plus;
+
+    maintainers = [ ];
+    platforms = stdenv.lib.platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/mpich/default.nix b/nixpkgs/pkgs/development/libraries/mpich/default.nix
new file mode 100644
index 000000000000..1c6b8df15114
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/mpich/default.nix
@@ -0,0 +1,55 @@
+{ stdenv, fetchurl, perl, gfortran
+,  openssh, hwloc
+} :
+
+stdenv.mkDerivation  rec {
+  name = "mpich-${version}";
+  version = "3.3.1";
+
+  src = fetchurl {
+    url = "https://www.mpich.org/static/downloads/${version}/mpich-${version}.tar.gz";
+    sha256 = "1raism1r4jsx4cybc9ddyr1xkccbxm0l8j3ryrw8kslfkkr1wmgy";
+  };
+
+  configureFlags = [
+    "--enable-shared"
+    "--enable-sharedlib"
+  ];
+
+  enableParallelBuilding = true;
+
+  buildInputs = [ perl gfortran openssh hwloc ];
+
+  doCheck = true;
+
+  preFixup = ''
+    # Ensure the default compilers are the ones mpich was built with
+    sed -i 's:CC="gcc":CC=${stdenv.cc}/bin/gcc:' $out/bin/mpicc
+    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) ''
+    # /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"
+      patchelf --set-rpath "$out/lib" $entry
+    done
+    '';
+
+  meta = with stdenv.lib; {
+    description = "Implementation of the Message Passing Interface (MPI) standard";
+
+    longDescription = ''
+      MPICH2 is a free high-performance and portable implementation of
+      the Message Passing Interface (MPI) standard, both version 1 and
+      version 2.
+    '';
+    homepage = http://www.mcs.anl.gov/mpi/mpich2/;
+    license = {
+      url = http://git.mpich.org/mpich.git/blob/a385d6d0d55e83c3709ae851967ce613e892cd21:/COPYRIGHT;
+      fullName = "MPICH license (permissive)";
+    };
+    maintainers = [ maintainers.markuskowa ];
+    platforms = platforms.linux ++ platforms.darwin;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/mpir/default.nix b/nixpkgs/pkgs/development/libraries/mpir/default.nix
new file mode 100644
index 000000000000..fe9cd6f492e5
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/mpir/default.nix
@@ -0,0 +1,26 @@
+{ stdenv, fetchurl, m4, which, yasm }:
+
+stdenv.mkDerivation rec {
+  name = "mpir-${version}";
+  version = "3.0.0";
+
+  nativeBuildInputs = [ m4 which yasm ];
+
+  src = fetchurl {
+    url = "http://mpir.org/mpir-${version}.tar.bz2";
+    sha256 = "1fvmhrqdjs925hzr2i8bszm50h00gwsh17p2kn2pi51zrxck9xjj";
+  };
+
+  configureFlags = [ "--enable-cxx" ];
+
+  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;
+    downloadPage = "http://mpir.org/downloads.html";
+    homepage = http://mpir.org/;
+    updateWalker = true;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/mps/default.nix b/nixpkgs/pkgs/development/libraries/mps/default.nix
new file mode 100644
index 000000000000..1430a3dfca15
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/mps/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchurl, autoreconfHook, sqlite }:
+
+stdenv.mkDerivation rec {
+  name = "mps-${version}";
+  version = "1.117.0";
+
+  src = fetchurl {
+    url    = "https://www.ravenbrook.com/project/mps/release/${version}/mps-kit-${version}.tar.gz";
+    sha256 = "04ix4l7lk6nxxk9sawpnxbybvqb82lks5606ym10bc1qbc2kqdcz";
+  };
+
+  nativeBuildInputs = [ autoreconfHook ];
+  buildInputs = [ sqlite ];
+
+  # needed for 1.116.0 to build with gcc7
+  NIX_CFLAGS_COMPILE = [
+    "-Wno-implicit-fallthrough"
+    "-Wno-error=clobbered"
+  ];
+
+
+  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 ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/msgpack/default.nix b/nixpkgs/pkgs/development/libraries/msgpack/default.nix
new file mode 100644
index 000000000000..bf51f8954025
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/msgpack/default.nix
@@ -0,0 +1,12 @@
+{ callPackage, fetchFromGitHub, ... } @ args:
+
+callPackage ./generic.nix (args // rec {
+  version = "3.0.1";
+
+  src = fetchFromGitHub {
+    owner  = "msgpack";
+    repo   = "msgpack-c";
+    rev    = "cpp-${version}";
+    sha256 = "0nr6y9v4xbvzv717j9w9lhmags1y2s5mq103v044qlyd2jkbg2p4";
+  };
+})
diff --git a/nixpkgs/pkgs/development/libraries/msgpack/generic.nix b/nixpkgs/pkgs/development/libraries/msgpack/generic.nix
new file mode 100644
index 000000000000..29ec205d7a11
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/msgpack/generic.nix
@@ -0,0 +1,27 @@
+{ stdenv, cmake
+, version, src, patches ? [ ]
+, ...
+}:
+
+stdenv.mkDerivation rec {
+  name = "msgpack-${version}";
+
+  inherit src patches;
+
+  nativeBuildInputs = [ cmake ];
+
+  enableParallelBuilding = true;
+
+  cmakeFlags = []
+    ++ stdenv.lib.optional (stdenv.hostPlatform != stdenv.buildPlatform)
+                           "-DMSGPACK_BUILD_EXAMPLES=OFF"
+    ;
+
+  meta = with stdenv.lib; {
+    description = "MessagePack implementation for C and C++";
+    homepage    = https://msgpack.org;
+    license     = licenses.asl20;
+    maintainers = with maintainers; [ redbaron ];
+    platforms   = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/msgpuck/default.nix b/nixpkgs/pkgs/development/libraries/msgpuck/default.nix
new file mode 100644
index 000000000000..e177694e894e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/msgpuck/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchFromGitHub, cmake, pkgconfig }:
+
+stdenv.mkDerivation rec {
+  name = "msgpuck-${version}";
+  version = "2.0";
+
+  src = fetchFromGitHub {
+    owner = "rtsisyk";
+    repo = "msgpuck";
+    rev = "${version}";
+    sha256 = "0cjq86kncn3lv65vig9cqkqqv2p296ymcjjbviw0j1s85cfflps0";
+  };
+
+  outputs = [ "out" "dev" ];
+
+  nativeBuildInputs = [ cmake pkgconfig ];
+
+  meta = with stdenv.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;
+     platforms = platforms.linux;
+     maintainers = with maintainers; [ izorkin ];
+ };
+}
diff --git a/nixpkgs/pkgs/development/libraries/msilbc/default.nix b/nixpkgs/pkgs/development/libraries/msilbc/default.nix
new file mode 100644
index 000000000000..601e70427a13
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/msilbc/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchurl, ilbc, mediastreamer, pkgconfig }:
+
+stdenv.mkDerivation rec {
+  name = "msilbc-2.1.2";
+
+  src = fetchurl {
+    url = "mirror://savannah/linphone/plugins/sources/${name}.tar.gz";
+    sha256 = "07j02y994ybh274fp7ydjvi76h34y2c34ndwjpjfcwwr03b48cfp";
+  };
+
+  propagatedBuildInputs = [ ilbc mediastreamer ];
+  nativeBuildInputs = [ pkgconfig ];
+
+  configureFlags = [
+    "ILBC_LIBS=ilbc" "ILBC_CFLAGS=-I${ilbc}/include"
+    "MEDIASTREAMER_LIBS=mediastreamer" "MEDIASTREAMER_CFLAGS=-I${mediastreamer}/include"
+  ];
+
+  meta = with stdenv.lib; {
+    description = "Mediastreamer plugin for the iLBC audio codec";
+    platforms = platforms.linux;
+    license = licenses.gpl2;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/mtdev/default.nix b/nixpkgs/pkgs/development/libraries/mtdev/default.nix
new file mode 100644
index 000000000000..e999ea73ae2e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/mtdev/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "mtdev-1.1.5";
+
+  src = fetchurl {
+    url = "http://bitmath.org/code/mtdev/${name}.tar.bz2";
+    sha256 = "0zxs7shzgbalkvlaiibi25bd902rbmkv9n1lww6q8j3ri9qdaxv6";
+  };
+
+  meta = with stdenv.lib; {
+    homepage = http://bitmath.org/code/mtdev/;
+    description = "Multitouch Protocol Translation Library";
+    longDescription = ''
+      The mtdev is a stand-alone library which transforms all variants of
+      kernel MT events to the slotted type B protocol. The events put into
+      mtdev may be from any MT device, specifically type A without contact
+      tracking, type A with contact tracking, or type B with contact tracking.
+      See the kernel documentation for further details.
+    '';
+    license = licenses.mit;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/mtxclient/default.nix b/nixpkgs/pkgs/development/libraries/mtxclient/default.nix
new file mode 100644
index 000000000000..3ab1e0a79749
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/mtxclient/default.nix
@@ -0,0 +1,39 @@
+{ stdenv, fetchFromGitHub, fetchpatch, cmake, pkgconfig
+, boost, openssl, zlib, libsodium, olm, gtest, spdlog, nlohmann_json }:
+
+stdenv.mkDerivation rec {
+  name = "mtxclient-${version}";
+  version = "0.2.0";
+
+  src = fetchFromGitHub {
+    owner = "mujx";
+    repo = "mtxclient";
+    rev = "v${version}";
+    sha256 = "19v1qa6mzvc65m7wy7x0g4i24bcg9xk31y1grwvd3zr0l4v6xcgs";
+  };
+
+  patches = [
+    # remove on the next mtxclient update
+    (fetchpatch {
+      url = "https://github.com/Nheko-Reborn/mtxclient/commit/41314809da7eb17ec00cff1795af6a528c5e904a.diff";
+      sha256 = "17pzrkdhd4jr8xwd7hhyzak880k8yb9nkg3vcbyjfp5si89dha5j";
+    })
+  ];
+
+  postPatch = ''
+    ln -s ${nlohmann_json}/include/nlohmann/json.hpp include/json.hpp
+  '';
+
+  cmakeFlags = [ "-DBUILD_LIB_TESTS=OFF" "-DBUILD_LIB_EXAMPLES=OFF" ];
+
+  nativeBuildInputs = [ cmake pkgconfig ];
+  buildInputs = [ boost openssl zlib libsodium olm ];
+
+  meta = with stdenv.lib; {
+    description = "Client API library for Matrix, built on top of Boost.Asio";
+    homepage = https://github.com/mujx/mtxclient;
+    license = licenses.mit;
+    maintainers = with maintainers; [ fpletz ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/multipart-parser-c/default.nix b/nixpkgs/pkgs/development/libraries/multipart-parser-c/default.nix
new file mode 100644
index 000000000000..8808ccefeaf1
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/multipart-parser-c/default.nix
@@ -0,0 +1,34 @@
+{ stdenv
+, fetchFromGitHub
+}:
+
+stdenv.mkDerivation rec {
+  pname = "multipart-parser-c";
+  version = "unstable-2015-12-14";
+
+  src = fetchFromGitHub {
+    owner = "iafonov";
+    repo = pname;
+    rev = "772639cf10db6d9f5a655ee9b7eb20b815fab396";
+    sha256 = "sha256:056r63vj8f1rwf3wk7jmwhm8ba25l6h1gs6jnkh0schbwcvi56xl";
+  };
+
+  buildPhase = ''
+    make solib
+  '';
+
+  installPhase = ''
+    mkdir -p $out/lib
+    mv lib*${stdenv.targetPlatform.extensions.sharedLibrary} $out/lib/
+
+    mkdir -p $out/include
+    mv *.h $out/include/
+  '';
+
+  meta = {
+    description = "Http multipart parser implemented in C ";
+    homepage = https://github.com/iafonov/multipart-parser-c;
+    license = [ stdenv.lib.licenses.mit ];
+  };
+
+}
diff --git a/nixpkgs/pkgs/development/libraries/muparser/default.nix b/nixpkgs/pkgs/development/libraries/muparser/default.nix
new file mode 100644
index 000000000000..53f348f93f8e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/muparser/default.nix
@@ -0,0 +1,21 @@
+{stdenv, fetchurl, unzip}:
+
+stdenv.mkDerivation rec {
+  name = "muparser-${version}";
+  version = "2.2.3";
+  url-version = stdenv.lib.replaceChars ["."] ["_"] version;
+
+  src = fetchurl {
+    url = "mirror://sourceforge/muparser/muparser_v${url-version}.zip";
+    sha256 = "00l92k231yb49wijzkspa2l58mapn6vh2dlxnlg0pawjjfv33s6z";
+  };
+
+  buildInputs = [ unzip ];
+
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/mygui/default.nix b/nixpkgs/pkgs/development/libraries/mygui/default.nix
new file mode 100644
index 000000000000..f4a869255f8c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/mygui/default.nix
@@ -0,0 +1,31 @@
+{  stdenv, fetchFromGitHub, libX11, unzip, cmake, ois, freetype, libuuid,
+   boost, pkgconfig, withOgre ? false, ogre ? null, libGLU_combined ? null } :
+
+let
+  renderSystem = if withOgre then "3" else "4";
+in stdenv.mkDerivation rec {
+  name = "mygui-${version}";
+  version = "3.2.2";
+
+  src = fetchFromGitHub {
+    owner = "MyGUI";
+    repo = "mygui";
+    rev = "MyGUI${version}";
+    sha256 = "1wk7jmwm55rhlqqcyvqsxdmwvl70bysl9azh4kd9n57qlmgk3zmw";
+  };
+
+  enableParallelBuilding = true;
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ libX11 unzip cmake ois freetype libuuid boost (if withOgre then ogre else libGLU_combined) ];
+
+  # Tools are disabled due to compilation failures.
+  cmakeFlags = [ "-DMYGUI_BUILD_TOOLS=OFF" "-DMYGUI_BUILD_DEMOS=OFF" "-DMYGUI_RENDERSYSTEM=${renderSystem}" ];
+
+  meta = with stdenv.lib; {
+    homepage = http://mygui.info/;
+    description = "Library for creating GUIs for games and 3D applications";
+    license = licenses.lgpl3Plus;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/mypaint-brushes/default.nix b/nixpkgs/pkgs/development/libraries/mypaint-brushes/default.nix
new file mode 100644
index 000000000000..140dbcc937b5
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/mypaint-brushes/default.nix
@@ -0,0 +1,35 @@
+{stdenv, fetchpatch, autoconf, automake, fetchFromGitHub, pkgconfig}:
+
+let
+  pname = "mypaint-brushes";
+  version = "1.3.0";
+in stdenv.mkDerivation rec {
+  name = "${pname}-${version}";
+
+  src = fetchFromGitHub {
+    owner = "Jehan";
+    repo = pname;
+    rev = "v${version}";
+    sha256 = "1iz89z6v2mp8j1lrf942k561s8311i3s34ap36wh4rybb2lq15m0";
+  };
+
+  nativeBuildInputs = [ autoconf automake pkgconfig ];
+
+  patches = [
+    # build with automake 1.16
+    (fetchpatch {
+      url = https://github.com/Jehan/mypaint-brushes/commit/1e9109dde3bffd416ed351c3f30ecd6ffd0ca2cd.patch;
+      sha256 = "0mi8rwbirl0ib22f2hz7kdlgi4hw8s3ab29b003dsshdyzn5iha9";
+    })
+  ];
+
+  preConfigure = "./autogen.sh";
+
+  meta = with stdenv.lib; {
+    homepage = http://mypaint.org/;
+    description = "Brushes used by MyPaint and other software using libmypaint.";
+    license = licenses.cc0;
+    maintainers = with maintainers; [ jtojnar ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/mysocketw/default.nix b/nixpkgs/pkgs/development/libraries/mysocketw/default.nix
new file mode 100644
index 000000000000..6ec288f985b0
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/mysocketw/default.nix
@@ -0,0 +1,26 @@
+{ stdenv, fetchurl, openssl }:
+
+stdenv.mkDerivation rec {
+  name = "mysocketw-031026";
+  src = fetchurl {
+    url = http://www.digitalfanatics.org/cal/socketw/files/SocketW031026.tar.gz;
+    sha256 = "0crinikhdl7xihzmc3k3k41pgxy16d5ci8m9sza1lbibns7pdwj4";
+  };
+
+  patches = [ ./gcc.patch ];
+
+  buildInputs = [ openssl ];
+
+  postPatch = stdenv.lib.optionalString stdenv.isDarwin ''
+    substituteInPlace src/Makefile \
+        --replace -Wl,-soname, -Wl,-install_name,$out/lib/
+  '';
+
+  makeFlags = [ "PREFIX=$(out)" "CXX=c++" ];
+
+  meta = {
+    description = "Cross platform (Linux/FreeBSD/Unix/Win32) streaming socket C++";
+    license = stdenv.lib.licenses.lgpl21Plus;
+    platforms = stdenv.lib.platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/mysocketw/gcc.patch b/nixpkgs/pkgs/development/libraries/mysocketw/gcc.patch
new file mode 100644
index 000000000000..7779a18fa528
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/mysocketw/gcc.patch
@@ -0,0 +1,13 @@
+I picked it up from:
+http://www.rigsofrods.com/wiki/images/c/c0/Socketw.patch
+
+--- a/src/sw_base.cxx.old	2009-12-19 21:19:31.057051328 -0800
++++ b/src/sw_base.cxx	2009-12-19 21:19:44.939551918 -0800
+@@ -19,6 +19,7 @@
+ #include <time.h>
+ #include <stdio.h>
+ #include <string.h>
++#include <stdlib.h>
+ 
+ #ifndef __WIN32__
+   #include <netdb.h>
diff --git a/nixpkgs/pkgs/development/libraries/mythes/default.nix b/nixpkgs/pkgs/development/libraries/mythes/default.nix
new file mode 100644
index 000000000000..01bf863bbbb1
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/mythes/default.nix
@@ -0,0 +1,20 @@
+{ stdenv, fetchurl, hunspell, ncurses, pkgconfig, perl }:
+
+stdenv.mkDerivation rec {
+  name = "mythes-1.2.4";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/hunspell/${name}.tar.gz";
+    sha256 = "0prh19wy1c74kmzkkavm9qslk99gz8h8wmjvwzjc6lf8v2az708y";
+  };
+
+  buildInputs = [ hunspell ];
+  nativeBuildInputs = [ ncurses pkgconfig perl ];
+
+  meta = {
+    homepage = http://hunspell.sourceforge.net/;
+    description = "Thesaurus library from Hunspell project";
+    license = stdenv.lib.licenses.bsd3;
+    inherit (hunspell.meta) platforms;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/nanoflann/default.nix b/nixpkgs/pkgs/development/libraries/nanoflann/default.nix
new file mode 100644
index 000000000000..f29fb9564f31
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/nanoflann/default.nix
@@ -0,0 +1,25 @@
+{stdenv, fetchFromGitHub, cmake}:
+
+stdenv.mkDerivation rec {
+  version = "1.3.0";
+  name = "nanoflann-${version}";
+  
+  src = fetchFromGitHub {
+    owner = "jlblancoc";
+    repo = "nanoflann";
+    rev = "v${version}";
+    sha256 = "1bwdmrz1qygp9qy2nzrp1axa1i4nvm0ljkn6mnhlcvbfsyvhzigv";
+  };
+
+  buildInputs = [ cmake ];
+
+  doCheck = true;
+  checkTarget = "test";
+
+  meta = {
+    homepage = https://github.com/jlblancoc/nanoflann;
+    license = stdenv.lib.licenses.bsd3;
+    description = "Header only C++ library for approximate nearest neighbor search";
+    platforms = stdenv.lib.platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/nanomsg/default.nix b/nixpkgs/pkgs/development/libraries/nanomsg/default.nix
new file mode 100644
index 000000000000..8f72b333aa48
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/nanomsg/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, cmake, fetchFromGitHub }:
+
+stdenv.mkDerivation rec {
+  version = "1.1.5";
+  name = "nanomsg-${version}";
+
+  src = fetchFromGitHub {
+    owner = "nanomsg";
+    repo = "nanomsg";
+    rev = version;
+    sha256 = "01ddfzjlkf2dgijrmm3j3j8irccsnbgfvjcnwslsfaxnrmrq5s64";
+  };
+
+  buildInputs = [ cmake ];
+
+  meta = with stdenv.lib; {
+    description= "Socket library that provides several common communication patterns";
+    homepage = https://nanomsg.org/;
+    license = licenses.mit;
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/nco/default.nix b/nixpkgs/pkgs/development/libraries/nco/default.nix
new file mode 100644
index 000000000000..f801e25d91fb
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/nco/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, fetchurl, netcdf, netcdfcxx4, gsl, udunits, antlr, which, curl }:
+
+stdenv.mkDerivation rec {
+  version = "4.5.5";
+  name = "nco-${version}";
+
+  buildInputs = [ netcdf netcdfcxx4 gsl udunits antlr which curl ];
+
+  src = fetchurl {
+    url = "https://github.com/nco/nco/archive/${version}.tar.gz";
+    sha256 = "bc6f5b976fdfbdec51f2ebefa158fa54672442c2fd5f042ba884f9f32c2ad666";
+  };
+
+  meta = { 
+    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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/ncurses/clang.patch b/nixpkgs/pkgs/development/libraries/ncurses/clang.patch
new file mode 100644
index 000000000000..ce33049bf405
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/ncurses/clang.patch
@@ -0,0 +1,42 @@
+diff -ruNp ncurses-5.8.orig/c++/cursesf.h ncurses-5.8/c++/cursesf.h
+--- ncurses-5.8.orig/c++/cursesf.h	2005-08-13 21:08:24.000000000 +0300
++++ ncurses-5.8/c++/cursesf.h	2011-04-03 18:29:29.000000000 +0300
+@@ -681,7 +681,7 @@ public:
+ 		   const T* p_UserData = STATIC_CAST(T*)(0),
+ 		   bool with_frame=FALSE,
+ 		   bool autoDelete_Fields=FALSE)
+-    : NCursesForm (Fields, with_frame, autoDelete_Fields) {
++    : NCursesForm (&Fields, with_frame, autoDelete_Fields) {
+       if (form)
+ 	set_user (const_cast<void *>(p_UserData));
+   };
+@@ -694,7 +694,7 @@ public:
+ 		   const T* p_UserData = STATIC_CAST(T*)(0),
+ 		   bool with_frame=FALSE,
+ 		   bool autoDelete_Fields=FALSE)
+-    : NCursesForm (Fields, nlines, ncols, begin_y, begin_x,
++    : NCursesForm (&Fields, nlines, ncols, begin_y, begin_x,
+ 		   with_frame, autoDelete_Fields) {
+       if (form)
+ 	set_user (const_cast<void *>(p_UserData));
+diff -ruNp ncurses-5.8.orig/c++/cursesm.h ncurses-5.8/c++/cursesm.h
+--- ncurses-5.8.orig/c++/cursesm.h	2005-08-13 21:10:36.000000000 +0300
++++ ncurses-5.8/c++/cursesm.h	2011-04-03 18:31:42.000000000 +0300
+@@ -639,7 +639,7 @@ public:
+ 		   const T* p_UserData = STATIC_CAST(T*)(0),
+ 		   bool with_frame=FALSE,
+ 		   bool autoDelete_Items=FALSE)
+-    : NCursesMenu (Items, with_frame, autoDelete_Items) {
++    : NCursesMenu (&Items, with_frame, autoDelete_Items) {
+       if (menu)
+ 	set_user (const_cast<void *>(p_UserData));
+   };
+@@ -651,7 +651,7 @@ public:
+ 		   int begin_x = 0,
+ 		   const T* p_UserData = STATIC_CAST(T*)(0),
+ 		   bool with_frame=FALSE)
+-    : NCursesMenu (Items, nlines, ncols, begin_y, begin_x, with_frame) {
++    : NCursesMenu (&Items, nlines, ncols, begin_y, begin_x, with_frame) {
+       if (menu)
+ 	set_user (const_cast<void *>(p_UserData));
+   };
diff --git a/nixpkgs/pkgs/development/libraries/ncurses/default.nix b/nixpkgs/pkgs/development/libraries/ncurses/default.nix
new file mode 100644
index 000000000000..708ba46b42eb
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/ncurses/default.nix
@@ -0,0 +1,177 @@
+{ lib, stdenv, fetchurl, pkgconfig
+
+, abiVersion ? "6"
+, mouseSupport ? false
+, unicode ? true
+, enableStatic ? stdenv.hostPlatform.useAndroidPrebuilt
+, enableShared ? !enableStatic
+, withCxx ? !stdenv.hostPlatform.useAndroidPrebuilt
+
+, gpm
+
+, buildPackages
+}:
+
+stdenv.mkDerivation rec {
+  # Note the revision needs to be adjusted.
+  version = "6.1-20190112";
+  name = "ncurses-${version}" + lib.optionalString (abiVersion == "5") "-abi5-compat";
+
+  # We cannot use fetchFromGitHub (which calls fetchzip)
+  # because we need to be able to use fetchurlBoot.
+  src = let
+    # Note the version needs to be adjusted.
+    rev = "acb4184f8f69fddd052a3daa8c8675f4bf8ce369";
+  in fetchurl {
+    url = "https://github.com/mirror/ncurses/archive/${rev}.tar.gz";
+    sha256 = "1z8v63cj2y7dxf4m1api8cvk0ns9frif9c60m2sxhibs06pjy4q0";
+  };
+
+  patches = lib.optional (!stdenv.cc.isClang) ./clang.patch;
+
+  outputs = [ "out" "dev" "man" ];
+  setOutputFlags = false; # some aren't supported
+
+  configureFlags = [
+    (lib.withFeature enableShared "shared")
+    "--without-debug"
+    "--enable-pc-files"
+    "--enable-symlinks"
+    "--with-manpage-format=normal"
+    "--disable-stripping"
+  ] ++ lib.optional unicode "--enable-widec"
+    ++ lib.optional (!withCxx) "--without-cxx"
+    ++ lib.optional (abiVersion == "5") "--with-abi-version=5"
+    ++ lib.optionals stdenv.hostPlatform.isWindows [
+      "--enable-sp-funcs"
+      "--enable-term-driver"
+    ];
+
+  # Only the C compiler, and explicitly not C++ compiler needs this flag on solaris:
+  CFLAGS = lib.optionalString stdenv.isSunOS "-D_XOPEN_SOURCE_EXTENDED";
+
+  depsBuildBuild = [ buildPackages.stdenv.cc ];
+  nativeBuildInputs = [
+    pkgconfig
+  ] ++ lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [
+    buildPackages.ncurses
+  ];
+  buildInputs = lib.optional (mouseSupport && stdenv.isLinux) gpm;
+
+  preConfigure = ''
+    export PKG_CONFIG_LIBDIR="$dev/lib/pkgconfig"
+    mkdir -p "$PKG_CONFIG_LIBDIR"
+    configureFlagsArray+=(
+      "--libdir=$out/lib"
+      "--includedir=$dev/include"
+      "--bindir=$dev/bin"
+      "--mandir=$man/share/man"
+      "--with-pkg-config-libdir=$PKG_CONFIG_LIBDIR"
+    )
+  ''
+  + lib.optionalString stdenv.isSunOS ''
+    sed -i -e '/-D__EXTENSIONS__/ s/-D_XOPEN_SOURCE=\$cf_XOPEN_SOURCE//' \
+           -e '/CPPFLAGS="$CPPFLAGS/s/ -D_XOPEN_SOURCE_EXTENDED//' \
+        configure
+    CFLAGS=-D_XOPEN_SOURCE_EXTENDED
+  '';
+
+  enableParallelBuilding = true;
+
+  doCheck = false;
+
+  # When building a wide-character (Unicode) build, create backward
+  # compatibility links from the the "normal" libraries to the
+  # wide-character libraries (e.g. libncurses.so to libncursesw.so).
+  postFixup = let
+    abiVersion-extension = if stdenv.isDarwin then "${abiVersion}.$dylibtype" else "$dylibtype.${abiVersion}"; in
+  ''
+    # Determine what suffixes our libraries have
+    suffix="$(awk -F': ' 'f{print $3; f=0} /default library suffix/{f=1}' config.log)"
+    libs="$(ls $dev/lib/pkgconfig | tr ' ' '\n' | sed "s,\(.*\)$suffix\.pc,\1,g")"
+    suffixes="$(echo "$suffix" | awk '{for (i=1; i < length($0); i++) {x=substr($0, i+1, length($0)-i); print x}}')"
+
+    # Get the path to the config util
+    cfg=$(basename $dev/bin/ncurses*-config)
+
+    # symlink the full suffixed include directory
+    ln -svf . $dev/include/ncurses$suffix
+
+    for newsuffix in $suffixes ""; do
+      # Create a non-abi versioned config util links
+      ln -svf $cfg $dev/bin/ncurses$newsuffix-config
+
+      # Allow for end users who #include <ncurses?w/*.h>
+      ln -svf . $dev/include/ncurses$newsuffix
+
+      for library in $libs; do
+        for dylibtype in so dll dylib; do
+          if [ -e "$out/lib/lib''${library}$suffix.$dylibtype" ]; then
+            ln -svf lib''${library}$suffix.$dylibtype $out/lib/lib$library$newsuffix.$dylibtype
+            ln -svf lib''${library}$suffix.${abiVersion-extension} $out/lib/lib$library$newsuffix.${abiVersion-extension}
+            if [ "ncurses" = "$library" ]
+            then
+              # make libtinfo symlinks
+              ln -svf lib''${library}$suffix.$dylibtype $out/lib/libtinfo$newsuffix.$dylibtype
+              ln -svf lib''${library}$suffix.${abiVersion-extension} $out/lib/libtinfo$newsuffix.${abiVersion-extension}
+            fi
+          fi
+        done
+        for statictype in a dll.a la; do
+          if [ -e "$out/lib/lib''${library}$suffix.$statictype" ]; then
+            ln -svf lib''${library}$suffix.$statictype $out/lib/lib$library$newsuffix.$statictype
+            if [ "ncurses" = "$library" ]
+            then
+              # make libtinfo symlinks
+              ln -svf lib''${library}$suffix.$statictype $out/lib/libtinfo$newsuffix.$statictype
+            fi
+          fi
+        done
+        ln -svf ''${library}$suffix.pc $dev/lib/pkgconfig/$library$newsuffix.pc
+      done
+    done
+
+    # move some utilities to $bin
+    # these programs are used at runtime and don't really belong in $dev
+    moveToOutput "bin/clear" "$out"
+    moveToOutput "bin/reset" "$out"
+    moveToOutput "bin/tabs" "$out"
+    moveToOutput "bin/tic" "$out"
+    moveToOutput "bin/tput" "$out"
+    moveToOutput "bin/tset" "$out"
+    moveToOutput "bin/captoinfo" "$out"
+    moveToOutput "bin/infotocap" "$out"
+  '';
+
+  preFixup = lib.optionalString (!stdenv.hostPlatform.isCygwin && !enableStatic) ''
+    rm "$out"/lib/*.a
+  '';
+
+  meta = {
+    description = "Free software emulation of curses in SVR4 and more";
+
+    longDescription = ''
+      The Ncurses (new curses) library is a free software emulation of
+      curses in System V Release 4.0, and more.  It uses Terminfo
+      format, supports pads and color and multiple highlights and
+      forms characters and function-key mapping, and has all the other
+      SYSV-curses enhancements over BSD Curses.
+
+      The ncurses code was developed under GNU/Linux.  It has been in
+      use for some time with OpenBSD as the system curses library, and
+      on FreeBSD and NetBSD as an external package.  It should port
+      easily to any ANSI/POSIX-conforming UNIX.  It has even been
+      ported to OS/2 Warp!
+    '';
+
+    homepage = https://www.gnu.org/software/ncurses/;
+
+    license = lib.licenses.mit;
+    platforms = lib.platforms.all;
+  };
+
+  passthru = {
+    ldflags = "-lncurses";
+    inherit unicode abiVersion;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/ndn-cxx/default.nix b/nixpkgs/pkgs/development/libraries/ndn-cxx/default.nix
new file mode 100644
index 000000000000..cbe1f9840593
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/ndn-cxx/default.nix
@@ -0,0 +1,41 @@
+{ stdenv, fetchFromGitHub, openssl, doxygen
+, boost, sqlite, pkgconfig, python, pythonPackages, wafHook }:
+let
+  version = "0.6.3";
+in
+stdenv.mkDerivation {
+  name = "ndn-cxx-${version}";
+  src = fetchFromGitHub {
+    owner = "named-data";
+    repo = "ndn-cxx";
+    rev = "a3bf4319ed483a4a6fe2c96b79ec4491d7217f00";
+    sha256 = "076jhrjigisqz5n8dgxwd5fhimg69zhm834m7w9yvf9afgzrr50h";
+  };
+  nativeBuildInputs = [ pkgconfig wafHook ];
+  buildInputs = [ openssl doxygen boost sqlite python pythonPackages.sphinx];
+  wafConfigureFlags = [
+    "--with-openssl=${openssl.dev}"
+    "--boost-includes=${boost.dev}/include"
+    "--boost-libs=${boost.out}/lib"
+  ];
+  meta = with stdenv.lib; {
+    homepage = http://named-data.net/;
+    description = "A Named Data Neworking (NDN) or Content Centric Networking (CCN) abstraction";
+    longDescription = ''
+      ndn-cxx is a C++ library, implementing Named Data Networking (NDN)
+      primitives that can be used to implement various NDN applications.
+      NDN operates by addressing and delivering Content Objects directly
+      by Name instead of merely addressing network end-points. In addition,
+      the NDN security model explicitly secures individual Content Objects
+      rather than securing the connection or “pipe”. Named and secured
+      content resides in distributed caches automatically populated on
+      demand or selectively pre-populated. When requested by name, NDN
+      delivers named content to the user from the nearest cache, thereby
+      traversing fewer network hops, eliminating redundant requests,
+      and consuming less resources overall.
+    '';
+    license = licenses.lgpl3;
+    platforms = stdenv.lib.platforms.unix;
+    maintainers = [ maintainers.sjmackenzie ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/ndpi/default.nix b/nixpkgs/pkgs/development/libraries/ndpi/default.nix
new file mode 100644
index 000000000000..913a4a087a97
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/ndpi/default.nix
@@ -0,0 +1,30 @@
+{ stdenv, fetchFromGitHub, which, autoconf, automake, libtool, libpcap }:
+
+let version = "2.8"; in
+
+stdenv.mkDerivation rec {
+  name = "ndpi-${version}";
+
+  src = fetchFromGitHub {
+    owner = "ntop";
+    repo = "nDPI";
+    rev = "${version}";
+    sha256 = "0lc4vga89pm954vf92g9fa6xwsjkb13jd6wrcc35zy5j04nf9rzf";
+  };
+
+  configureScript = "./autogen.sh";
+
+  nativeBuildInputs = [which autoconf automake libtool];
+  buildInputs = [libpcap];
+
+  meta = with stdenv.lib; {
+    description = "A library for deep-packet inspection";
+    longDescription = ''
+      nDPI is a library for deep-packet inspection based on OpenDPI.
+    '';
+    homepage = https://www.ntop.org/products/deep-packet-inspection/ndpi/;
+    license = with licenses; lgpl3;
+    maintainers = with maintainers; [ takikawa ];
+    platforms = with platforms; unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/neardal/default.nix b/nixpkgs/pkgs/development/libraries/neardal/default.nix
new file mode 100644
index 000000000000..65679c7e2825
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/neardal/default.nix
@@ -0,0 +1,31 @@
+{ stdenv, fetchFromGitHub, autoconf, automake, libtool, pkgconfig, glib, readline, makeWrapper }:
+
+stdenv.mkDerivation rec {
+  name = "neardal-0.7-post-git-20150930";
+
+  src = fetchFromGitHub {
+    owner = "connectivity";
+    repo = "neardal";
+    rev = "5b1c8b5c2c45c10f11cee12fbcb397f8953850d7";
+    sha256 = "12qwg7qiw2wfpaxfg2fjkmj5lls0g33xp6w433g8bnkvwlq4s29g";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ autoconf automake libtool glib readline makeWrapper ];
+
+  preConfigure = ''
+    substituteInPlace "ncl/Makefile.am" --replace "noinst_PROGRAMS" "bin_PROGRAMS"
+    substituteInPlace "demo/Makefile.am" --replace "noinst_PROGRAMS" "bin_PROGRAMS"
+    sh autogen.sh
+  '';
+
+  configureFlags = [ "--disable-dependency-tracking" "--disable-traces" ];
+
+  meta = with stdenv.lib; {
+    description = "C APIs to exchange datas with the NFC daemon 'Neard'";
+    license = licenses.lgpl2;
+    homepage = https://01.org/linux-nfc;
+    maintainers = with maintainers; [ tstrobel ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/neon/0.29.6-darwin-fix-configure.patch b/nixpkgs/pkgs/development/libraries/neon/0.29.6-darwin-fix-configure.patch
new file mode 100644
index 000000000000..87222a9c0ce0
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/neon/0.29.6-darwin-fix-configure.patch
@@ -0,0 +1,12 @@
+diff -Nuar neon-0.29.6/configure neon-0.29.6-darwin-fix-configure/configure
+--- neon-0.29.6/configure	2011-05-03 14:25:31.000000000 +0200
++++ neon-0.29.6-darwin-fix-configure/configure	2012-06-06 23:32:21.000000000 +0200
+@@ -4184,7 +4184,7 @@
+ $as_echo "$ne_cv_os_uname" >&6; }
+ 
+ if test "$ne_cv_os_uname" = "Darwin"; then
+-  CPPFLAGS="$CPPFLAGS -no-cpp-precomp"
++  CPPFLAGS="$CPPFLAGS"
+   LDFLAGS="$LDFLAGS -flat_namespace"
+   # poll has various issues in various Darwin releases
+   if test x${ac_cv_func_poll+set} != xset; then
diff --git a/nixpkgs/pkgs/development/libraries/neon/0.29.nix b/nixpkgs/pkgs/development/libraries/neon/0.29.nix
new file mode 100644
index 000000000000..87f9b5effacd
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/neon/0.29.nix
@@ -0,0 +1,49 @@
+{ stdenv, fetchurl, libxml2, pkgconfig, perl
+, compressionSupport ? true, zlib ? null
+, sslSupport ? true, openssl ? null
+, static ? false
+, shared ? true
+}:
+
+assert compressionSupport -> zlib != null;
+assert sslSupport -> openssl != null;
+assert static || shared;
+
+let
+   inherit (stdenv.lib) optionals;
+in
+
+stdenv.mkDerivation rec {
+  version = "0.29.6";
+  name = "neon-${version}";
+
+  src = fetchurl {
+    url = "http://www.webdav.org/neon/${name}.tar.gz";
+    sha256 = "0hzbjqdx1z8zw0vmbknf159wjsxbcq8ii0wgwkqhxj3dimr0nr4w";
+  };
+
+  patches = optionals stdenv.isDarwin [ ./0.29.6-darwin-fix-configure.patch ];
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [libxml2 openssl]
+    ++ stdenv.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")
+  ];
+
+  passthru = {inherit compressionSupport sslSupport;};
+
+  checkInputs = [ perl ];
+  doCheck = false; # fails, needs the net
+
+  meta = with stdenv.lib; {
+    description = "An HTTP and WebDAV client library";
+    homepage = http://www.webdav.org/neon/;
+    platforms = platforms.unix;
+    license = licenses.lgpl2;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/neon/default.nix b/nixpkgs/pkgs/development/libraries/neon/default.nix
new file mode 100644
index 000000000000..61a40753a56f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/neon/default.nix
@@ -0,0 +1,49 @@
+{ stdenv, fetchurl, libxml2, pkgconfig, perl
+, compressionSupport ? true, zlib ? null
+, sslSupport ? true, openssl ? null
+, static ? false
+, shared ? true
+}:
+
+assert compressionSupport -> zlib != null;
+assert sslSupport -> openssl != null;
+assert static || shared;
+
+let
+   inherit (stdenv.lib) optionals;
+in
+
+stdenv.mkDerivation rec {
+  version = "0.30.2";
+  name = "neon-${version}";
+
+  src = fetchurl {
+    url = "http://www.webdav.org/neon/${name}.tar.gz";
+    sha256 = "1jpvczcx658vimqm7c8my2q41fnmjaf1j03g7bsli6rjxk6xh2yv";
+  };
+
+  patches = optionals stdenv.isDarwin [ ./0.29.6-darwin-fix-configure.patch ];
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [libxml2 openssl]
+    ++ stdenv.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")
+  ];
+
+  passthru = {inherit compressionSupport sslSupport;};
+
+  checkInputs = [ perl ];
+  doCheck = false; # fails, needs the net
+
+  meta = with stdenv.lib; {
+    description = "An HTTP and WebDAV client library";
+    homepage = http://www.webdav.org/neon/;
+    platforms = platforms.unix;
+    license = licenses.lgpl2;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/netcdf-cxx4/default.nix b/nixpkgs/pkgs/development/libraries/netcdf-cxx4/default.nix
new file mode 100644
index 000000000000..a57884912bae
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/netcdf-cxx4/default.nix
@@ -0,0 +1,20 @@
+{ stdenv, fetchurl, netcdf, hdf5, curl }:
+stdenv.mkDerivation rec {
+  name = "netcdf-cxx4-${version}";
+  version = "4.3.0";
+
+  src = fetchurl {
+    url = "https://github.com/Unidata/netcdf-cxx4/archive/v${version}.tar.gz";
+    sha256 = "13zi8cbk18gggx1c12a580wdsbl714lw68a1wg7c86x0sybirni5";
+  };
+
+  buildInputs = [ netcdf hdf5 curl ];
+  doCheck = true;
+
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/netcdf-fortran/default.nix b/nixpkgs/pkgs/development/libraries/netcdf-fortran/default.nix
new file mode 100644
index 000000000000..bb621a3eda6c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/netcdf-fortran/default.nix
@@ -0,0 +1,21 @@
+{ stdenv, fetchurl, netcdf, hdf5, curl, gfortran }:
+stdenv.mkDerivation rec {
+  name = "netcdf-fortran-${version}";
+  version = "4.4.5";
+
+  src = fetchurl {
+    url = "https://github.com/Unidata/netcdf-fortran/archive/v${version}.tar.gz";
+    sha256 = "00qwg4v250yg8kxp68srrnvfbfim241fnlm071p9ila2mihk8r01";
+  };
+
+  buildInputs = [ netcdf hdf5 curl gfortran ];
+  doCheck = true;
+
+  meta = with stdenv.lib; {
+    description = "Fortran API to manipulate netcdf files";
+    homepage = https://www.unidata.ucar.edu/software/netcdf/;
+    license = licenses.free;
+    maintainers = [ maintainers.bzizou ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/netcdf/default.nix b/nixpkgs/pkgs/development/libraries/netcdf/default.nix
new file mode 100644
index 000000000000..0c597fc4b335
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/netcdf/default.nix
@@ -0,0 +1,50 @@
+{ stdenv
+, fetchurl
+, hdf5
+, m4
+, curl # for DAP
+}:
+
+let
+  mpiSupport = hdf5.mpiSupport;
+  mpi = hdf5.mpi;
+in stdenv.mkDerivation rec {
+  name = "netcdf-4.6.1";
+
+  src = fetchurl {
+    url = "https://www.unidata.ucar.edu/downloads/netcdf/ftp/${name}.tar.gz";
+    sha256 = "0hi61cdihwwvz5jz1l7yq712j7ca1cj4bhr8x0x7c2vlb1s9biw9";
+  };
+
+  postPatch = ''
+    patchShebangs .
+
+    # this test requires the net
+    for a in ncdap_test/Makefile.am ncdap_test/Makefile.in; do
+      substituteInPlace $a --replace testurl.sh " "
+    done
+  '';
+
+  nativeBuildInputs = [ m4 ];
+  buildInputs = [ hdf5 curl mpi ];
+
+  passthru = {
+    mpiSupport = mpiSupport;
+    inherit mpi;
+  };
+
+  configureFlags = [
+      "--enable-netcdf-4"
+      "--enable-dap"
+      "--enable-shared"
+  ]
+  ++ (stdenv.lib.optionals mpiSupport [ "--enable-parallel-tests" "CC=${mpi}/bin/mpicc" ]);
+
+  meta = {
+      platforms = stdenv.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/nixpkgs/pkgs/development/libraries/nettle/cygwin.patch b/nixpkgs/pkgs/development/libraries/nettle/cygwin.patch
new file mode 100644
index 000000000000..d5036237c8d5
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/nettle/cygwin.patch
@@ -0,0 +1,12 @@
+Cygwin sucks.  Patch suggested by Niel Möller.
+
+--- nettle-2.0/examples/setup-env	2009-06-08 20:27:12.000000000 +0200
++++ nettle-2.0/examples/setup-env	2009-09-18 16:58:03.000000000 +0200
+@@ -3,5 +3,5 @@
+ set -e
+ 
+ if [ -x rsa-keygen ] ; then
+-  ./rsa-keygen -r rsa-decrypt -o testkey || exit 1
++  ./rsa-keygen -r rsa-decrypt.exe -o testkey || exit 1
+ fi
+
diff --git a/nixpkgs/pkgs/development/libraries/nettle/default.nix b/nixpkgs/pkgs/development/libraries/nettle/default.nix
new file mode 100644
index 000000000000..900451351c82
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/nettle/default.nix
@@ -0,0 +1,10 @@
+{ callPackage, fetchurl, ... } @ args:
+
+callPackage ./generic.nix (args // rec {
+  version = "3.4.1";
+
+  src = fetchurl {
+    url = "mirror://gnu/nettle/nettle-${version}.tar.gz";
+    sha256 = "1bcji95n1iz9p9vsgdgr26v6s7zhpsxfbjjwpqcihpfd6lawyhgr";
+  };
+})
diff --git a/nixpkgs/pkgs/development/libraries/nettle/generic.nix b/nixpkgs/pkgs/development/libraries/nettle/generic.nix
new file mode 100644
index 000000000000..d78a31d65cd3
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/nettle/generic.nix
@@ -0,0 +1,68 @@
+{ stdenv, buildPackages, gmp, gnum4
+
+# Version specific args
+, version, src
+, ...}:
+
+stdenv.mkDerivation (rec {
+  name = "nettle-${version}";
+
+  inherit src;
+
+  outputs = [ "out" "dev" ];
+  outputBin = "dev";
+
+  depsBuildBuild = [ buildPackages.stdenv.cc ];
+  nativeBuildInputs = [ gnum4 ];
+  propagatedBuildInputs = [ gmp ];
+
+  doCheck = (stdenv.hostPlatform.system != "i686-cygwin" && !stdenv.isDarwin);
+
+  enableParallelBuilding = true;
+
+  patches = stdenv.lib.optional (stdenv.hostPlatform.system == "i686-cygwin")
+              ./cygwin.patch;
+
+  meta = with stdenv.lib; {
+    description = "Cryptographic library";
+
+    longDescription = ''
+        Nettle is a cryptographic library that is designed to fit
+        easily in more or less any context: In crypto toolkits for
+        object-oriented languages (C++, Python, Pike, ...), in
+        applications like LSH or GNUPG, or even in kernel space.  In
+        most contexts, you need more than the basic cryptographic
+        algorithms, you also need some way to keep track of available
+        algorithms, their properties and variants.  You often have
+        some algorithm selection process, often dictated by a protocol
+        you want to implement.
+
+        And as the requirements of applications differ in subtle and
+        not so subtle ways, an API that fits one application well can
+        be a pain to use in a different context.  And that is why
+        there are so many different cryptographic libraries around.
+
+        Nettle tries to avoid this problem by doing one thing, the
+        low-level crypto stuff, and providing a simple but general
+        interface to it.  In particular, Nettle doesn't do algorithm
+        selection.  It doesn't do memory allocation. It doesn't do any
+        I/O.
+     '';
+
+     license = licenses.gpl2Plus;
+
+     homepage = http://www.lysator.liu.se/~nisse/nettle/;
+
+     platforms = platforms.all;
+  };
+}
+
+//
+
+stdenv.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>
+  # for details.
+  configureFlags = [ "--with-include-path=${gmp.dev}/include" ];
+})
diff --git a/nixpkgs/pkgs/development/libraries/newt/default.nix b/nixpkgs/pkgs/development/libraries/newt/default.nix
new file mode 100644
index 000000000000..60dc00a335d9
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/newt/default.nix
@@ -0,0 +1,38 @@
+{ fetchurl, stdenv, slang, popt }:
+
+stdenv.mkDerivation rec {
+  pname = "newt";
+  version = "0.52.21";
+
+  src = fetchurl {
+    url = "https://fedorahosted.org/releases/n/e/${pname}/${pname}-${version}.tar.gz";
+    sha256 = "0cdvbancr7y4nrj8257y5n45hmhizr8isynagy4fpsnpammv8pi6";
+  };
+
+  patchPhase = ''
+    sed -i -e s,/usr/bin/install,install, -e s,-I/usr/include/slang,, Makefile.in po/Makefile
+  '';
+
+  buildInputs = [ slang popt ];
+
+  NIX_LDFLAGS = "-lncurses";
+
+  preConfigure = ''
+    # If CPP is set explicitly, configure and make will not agree about which
+    # programs to use at different stages.
+    unset CPP
+  '';
+
+  makeFlags = stdenv.lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [
+    "CROSS_COMPILE=${stdenv.cc.targetPrefix}"
+  ];
+
+  meta = with stdenv.lib; {
+    homepage = https://fedorahosted.org/newt/;
+    description = "Library for color text mode, widget based user interfaces";
+
+    license = licenses.lgpl2;
+    platforms = platforms.linux;
+    maintainers = [ maintainers.viric ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/nghttp2/default.nix b/nixpkgs/pkgs/development/libraries/nghttp2/default.nix
new file mode 100644
index 000000000000..2642ee5510a1
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/nghttp2/default.nix
@@ -0,0 +1,54 @@
+{ stdenv, fetchurl, pkgconfig
+
+# Optional Dependencies
+, openssl ? null, libev ? null, zlib ? null, c-ares ? null
+, enableHpack ? false, jansson ? null
+, enableAsioLib ? false, boost ? null
+, enableGetAssets ? false, libxml2 ? null
+, enableJemalloc ? false, jemalloc ? null
+, enableApp ? !stdenv.hostPlatform.isWindows
+}:
+
+assert enableHpack -> jansson != null;
+assert enableAsioLib -> boost != null;
+assert enableGetAssets -> libxml2 != null;
+assert enableJemalloc -> jemalloc != null;
+
+let inherit (stdenv.lib) optional; in
+
+stdenv.mkDerivation rec {
+  pname = "nghttp2";
+  version = "1.38.0";
+
+  src = fetchurl {
+    url = "https://github.com/${pname}/${pname}/releases/download/v${version}/${pname}-${version}.tar.bz2";
+    sha256 = "156r3myrglkmrdv4zh151g9zcr7b92zjn15wx5i9ypw0naanjc4g";
+  };
+
+  outputs = [ "bin" "out" "dev" "lib" ];
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ openssl libev zlib c-ares ]
+    ++ optional enableHpack jansson
+    ++ optional enableAsioLib boost
+    ++ optional enableGetAssets libxml2
+    ++ optional enableJemalloc jemalloc;
+
+  enableParallelBuilding = true;
+
+  configureFlags = [
+    "--with-spdylay=no"
+    "--disable-examples"
+    "--disable-python-bindings"
+    (stdenv.lib.enableFeature enableApp "app")
+  ] ++ optional enableAsioLib "--enable-asio-lib --with-boost-libdir=${boost}/lib";
+
+  #doCheck = true;  # requires CUnit ; currently failing at test_util_localtime_date in util_test.cc
+
+  meta = with stdenv.lib; {
+    homepage = https://nghttp2.org/;
+    description = "A C implementation of HTTP/2";
+    license = licenses.mit;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/nix-plugins/default.nix b/nixpkgs/pkgs/development/libraries/nix-plugins/default.nix
new file mode 100644
index 000000000000..cc5a115ed71e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/nix-plugins/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchFromGitHub, nix, cmake, pkgconfig, boost }:
+let version = "6.0.0"; in
+stdenv.mkDerivation {
+  name = "nix-plugins-${version}";
+
+  src = fetchFromGitHub {
+    owner = "shlevy";
+    repo = "nix-plugins";
+    rev = version;
+    sha256 = "08kxdci0sijj1hfkn3dbr7nbpb9xck0xr3xa3a0j116n4kvwb6qv";
+  };
+
+  nativeBuildInputs = [ cmake pkgconfig ];
+
+  buildInputs = [ nix boost ];
+
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/nlohmann_json/default.nix b/nixpkgs/pkgs/development/libraries/nlohmann_json/default.nix
new file mode 100644
index 000000000000..129cc7ed84c3
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/nlohmann_json/default.nix
@@ -0,0 +1,31 @@
+{ stdenv, fetchFromGitHub, cmake
+}:
+
+stdenv.mkDerivation rec {
+  pname = "nlohmann_json";
+  version = "3.6.1";
+
+  src = fetchFromGitHub {
+    owner = "nlohmann";
+    repo = "json";
+    rev = "v${version}";
+    sha256 = "1dgx3j9pb0f52dh73z8dpwdy79bra1qi5vpl66b9inq4gamf813z";
+  };
+
+  nativeBuildInputs = [ cmake ];
+
+  enableParallelBuilding = true;
+
+  cmakeFlags = [
+    "-DBuildTests=${if doCheck then "ON" else "OFF"}"
+  ];
+
+  doCheck = stdenv.hostPlatform == stdenv.buildPlatform;
+
+  meta = with stdenv.lib; {
+    description = "Header only C++ library for the JSON file format";
+    homepage = https://github.com/nlohmann/json;
+    license = licenses.mit;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/nlopt/default.nix b/nixpkgs/pkgs/development/libraries/nlopt/default.nix
new file mode 100644
index 000000000000..e9b89e83907f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/nlopt/default.nix
@@ -0,0 +1,37 @@
+{ stdenv, fetchFromGitHub, cmake, octave ? null }:
+
+stdenv.mkDerivation rec {
+  pname = "nlopt";
+  version = "2.6.1";
+
+  src = fetchFromGitHub {
+    owner = "stevengj";
+    repo = pname;
+    rev = "v${version}";
+    sha256 = "1k6x14lgyfhfqpbs7xx8mrgklp8l6jkkcs39zgi2sj3kg6n0hdc9";
+  };
+
+  nativeBuildInputs = [ cmake ];
+  buildInputs = [ octave ];
+
+  configureFlags = [
+    "--with-cxx"
+    "--enable-shared"
+    "--with-pic"
+    "--without-guile"
+    "--without-python"
+    "--without-matlab"
+  ] ++ stdenv.lib.optionals (octave != null) [
+    "--with-octave"
+    "M_INSTALL_DIR=$(out)/${octave.sitePath}/m"
+    "OCT_INSTALL_DIR=$(out)/${octave.sitePath}/oct"
+  ];
+
+  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;
+  };
+
+}
diff --git a/nixpkgs/pkgs/development/libraries/notify-sharp/default.nix b/nixpkgs/pkgs/development/libraries/notify-sharp/default.nix
new file mode 100644
index 000000000000..3c5ae8537a41
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/notify-sharp/default.nix
@@ -0,0 +1,36 @@
+{ stdenv, fetchFromGitHub, pkgconfig, autoreconfHook
+, mono, gtk-sharp-3_0, dbus-sharp-1_0, dbus-sharp-glib-1_0 }:
+
+stdenv.mkDerivation rec {
+  name = "notify-sharp-${version}";
+  version = "3.0.3";
+
+  src = fetchFromGitHub {
+    owner = "GNOME";
+    repo = "notify-sharp";
+
+    rev = "${version}";
+    sha256 = "1vm7mnmxdwrgy4mr07lfva8sa6a32f2ah5x7w8yzcmahaks3sj5m";
+  };
+
+  nativeBuildInputs = [
+    pkgconfig autoreconfHook
+  ];
+
+  buildInputs = [
+    mono gtk-sharp-3_0
+    dbus-sharp-1_0 dbus-sharp-glib-1_0
+  ];
+
+  dontStrip = true;
+
+  postPatch = ''
+    sed -i 's#^[ \t]*DOCDIR=.*$#DOCDIR=$out/lib/monodoc#' ./configure.ac
+  '';
+
+  meta = with stdenv.lib; {
+    description = "D-Bus for .NET";
+    platforms = platforms.linux;
+    license = licenses.mit;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/npapi-sdk/default.nix b/nixpkgs/pkgs/development/libraries/npapi-sdk/default.nix
new file mode 100644
index 000000000000..43732406064e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/npapi-sdk/default.nix
@@ -0,0 +1,21 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "npapi-sdk-${version}";
+
+  version = "0.27.2";
+
+  src = fetchurl {
+    url = "https://bitbucket.org/mgorny/npapi-sdk/downloads/${name}.tar.bz2";
+
+    sha256 = "0xxfcsjmmgbbyl9zwpzdshbx27grj5fnzjfmldmm9apws2yk9gq1";
+  };
+
+  meta = with stdenv.lib; {
+    description = "A bundle of NPAPI headers by Mozilla";
+
+    homepage = https://bitbucket.org/mgorny/npapi-sdk; # see also https://github.com/mozilla/npapi-sdk
+    license = licenses.bsd3;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/npth/default.nix b/nixpkgs/pkgs/development/libraries/npth/default.nix
new file mode 100644
index 000000000000..c02998184fc5
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/npth/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "npth-1.6";
+
+  src = fetchurl {
+    url = "mirror://gnupg/npth/${name}.tar.bz2";
+    sha256 = "1lg2lkdd3z1s3rpyf88786l243adrzyk9p4q8z9n41ygmpcsp4qk";
+  };
+
+  doCheck = true;
+
+  meta = with stdenv.lib; {
+    description = "The New GNU Portable Threads Library";
+    longDescription = ''
+      This is a library to provide the GNU Pth API and thus a non-preemptive
+      threads implementation.
+
+      In contrast to GNU Pth is is based on the system's standard threads
+      implementation.  This allows the use of libraries which are not
+      compatible to GNU Pth.  Experience with a Windows Pth emulation showed
+      that this is a solid way to provide a co-routine based framework.
+    '';
+    homepage = http://www.gnupg.org;
+    license = licenses.lgpl3;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/nspr/0001-Makefile-use-SOURCE_DATE_EPOCH-for-reproducibility.patch b/nixpkgs/pkgs/development/libraries/nspr/0001-Makefile-use-SOURCE_DATE_EPOCH-for-reproducibility.patch
new file mode 100644
index 000000000000..d7fec73910fb
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/nspr/0001-Makefile-use-SOURCE_DATE_EPOCH-for-reproducibility.patch
@@ -0,0 +1,84 @@
+From e5cc8f7c387e3238ebb8239e2555c933a41502c0 Mon Sep 17 00:00:00 2001
+From: Graham Christensen <graham@grahamc.com>
+Date: Thu, 7 Mar 2019 08:11:32 -0500
+Subject: [PATCH] Makefile: use SOURCE_DATE_EPOCH for reproducibility
+
+---
+ nspr/lib/ds/Makefile.in        | 4 ++--
+ nspr/lib/libc/src/Makefile.in  | 4 ++--
+ nspr/lib/prstreams/Makefile.in | 4 ++--
+ nspr/pr/src/Makefile.in        | 6 +++---
+ 4 files changed, 9 insertions(+), 9 deletions(-)
+
+diff --git a/nspr/lib/ds/Makefile.in b/nspr/lib/ds/Makefile.in
+index e737791..d56b0a7 100644
+--- a/nspr/lib/ds/Makefile.in
++++ b/nspr/lib/ds/Makefile.in
+@@ -101,8 +101,8 @@ ECHO = echo
+ TINC = $(OBJDIR)/_pl_bld.h
+ PROD = $(notdir $(SHARED_LIBRARY))
+ NOW = $(MOD_DEPTH)/config/$(OBJDIR)/now
+-SH_DATE = $(shell date "+%Y-%m-%d %T")
+-SH_NOW = $(shell $(NOW))
++SH_DATE = $(shell date "+%Y-%m-%d %T" --date $(SOURCE_DATE_EPOCH))
++SH_NOW = $(SOURCE_DATE_EPOCH)000000
+ 
+ ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT)
+ 	SUF = i64
+diff --git a/nspr/lib/libc/src/Makefile.in b/nspr/lib/libc/src/Makefile.in
+index e8a6d9f..0485737 100644
+--- a/nspr/lib/libc/src/Makefile.in
++++ b/nspr/lib/libc/src/Makefile.in
+@@ -103,8 +103,8 @@ ECHO = echo
+ TINC = $(OBJDIR)/_pl_bld.h
+ PROD = $(notdir $(SHARED_LIBRARY))
+ NOW = $(MOD_DEPTH)/config/$(OBJDIR)/now
+-SH_DATE = $(shell date "+%Y-%m-%d %T")
+-SH_NOW = $(shell $(NOW))
++SH_DATE = $(shell date "+%Y-%m-%d %T" --date $(SOURCE_DATE_EPOCH))
++SH_NOW = $(SOURCE_DATE_EPOCH)000000
+ 
+ ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT)
+ 	SUF = i64
+diff --git a/nspr/lib/prstreams/Makefile.in b/nspr/lib/prstreams/Makefile.in
+index aeb2944..83ae423 100644
+--- a/nspr/lib/prstreams/Makefile.in
++++ b/nspr/lib/prstreams/Makefile.in
+@@ -105,8 +105,8 @@ ECHO = echo
+ TINC = $(OBJDIR)/_pl_bld.h
+ PROD = $(notdir $(SHARED_LIBRARY))
+ NOW = $(MOD_DEPTH)/config/$(OBJDIR)/now
+-SH_DATE = $(shell date "+%Y-%m-%d %T")
+-SH_NOW = $(shell $(NOW))
++SH_DATE = $(shell date "+%Y-%m-%d %T" --date $(SOURCE_DATE_EPOCH))
++SH_NOW = $(SOURCE_DATE_EPOCH)000000
+ 
+ ifeq ($(OS_ARCH), WINNT)
+ 	SUF = i64
+diff --git a/nspr/pr/src/Makefile.in b/nspr/pr/src/Makefile.in
+index 19c5a69..989cc8c 100644
+--- a/nspr/pr/src/Makefile.in
++++ b/nspr/pr/src/Makefile.in
+@@ -46,7 +46,7 @@ MKSHLIB += -M $(MAPFILE)
+ endif
+ #
+ # In Solaris 2.6 or earlier, -lrt is called -lposix4.
+-# 
++#
+ LIBRT_TEST=$(firstword $(sort 5.7 $(OS_RELEASE)))
+ ifeq (5.7, $(LIBRT_TEST))
+ LIBRT=-lrt
+@@ -311,8 +311,8 @@ PROD = $(notdir $(SHARED_LIBRARY))
+ endif
+ 
+ NOW = $(MOD_DEPTH)/config/$(OBJDIR)/now
+-SH_DATE = $(shell date "+%Y-%m-%d %T")
+-SH_NOW = $(shell $(NOW))
++SH_DATE = $(shell date "+%Y-%m-%d %T" --date $(SOURCE_DATE_EPOCH))
++SH_NOW = $(SOURCE_DATE_EPOCH)000000
+ 
+ ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT)
+ 	SUF = i64
+-- 
+2.19.2
+
diff --git a/nixpkgs/pkgs/development/libraries/nspr/default.nix b/nixpkgs/pkgs/development/libraries/nspr/default.nix
new file mode 100644
index 000000000000..4772f1111aca
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/nspr/default.nix
@@ -0,0 +1,51 @@
+{ stdenv, fetchurl
+, CoreServices ? null
+, buildPackages }:
+
+let version = "4.21"; in
+
+stdenv.mkDerivation {
+  name = "nspr-${version}";
+
+  src = fetchurl {
+    url = "mirror://mozilla/nspr/releases/v${version}/src/nspr-${version}.tar.gz";
+    sha256 = "0nkbgk0x31nfm4xl8la0a3vrnpa8gzkh7g4k65p7n880n73k5shm";
+  };
+
+  patches = [
+    ./0001-Makefile-use-SOURCE_DATE_EPOCH-for-reproducibility.patch
+  ];
+
+  outputs = [ "out" "dev" ];
+  outputBin = "dev";
+
+  preConfigure = ''
+    cd nspr
+  '' + stdenv.lib.optionalString stdenv.isDarwin ''
+    substituteInPlace configure --replace '@executable_path/' "$out/lib/"
+    substituteInPlace configure.in --replace '@executable_path/' "$out/lib/"
+  '';
+
+  HOST_CC = "cc";
+  depsBuildBuild = [ buildPackages.stdenv.cc ];
+  configureFlags = [
+    "--enable-optimize"
+    "--disable-debug"
+  ] ++ stdenv.lib.optional stdenv.is64bit "--enable-64bit";
+
+  postInstall = ''
+    find $out -name "*.a" -delete
+    moveToOutput share "$dev" # just aclocal
+  '';
+
+  buildInputs = [] ++ stdenv.lib.optionals stdenv.isDarwin [ CoreServices ];
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.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;
+    license = licenses.mpl20;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/nss/85_security_load.patch b/nixpkgs/pkgs/development/libraries/nss/85_security_load.patch
new file mode 100644
index 000000000000..132d5a96b29f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/nss/85_security_load.patch
@@ -0,0 +1,81 @@
+diff -ru -x '*~' -x '*.orig' -x '*.rej' nss/cmd/shlibsign/shlibsign.c nss/cmd/shlibsign/shlibsign.c
+--- nss/cmd/shlibsign/shlibsign.c	2017-01-04 15:24:24.000000000 +0100
++++ nss/cmd/shlibsign/shlibsign.c	2017-01-24 14:43:31.030420852 +0100
+@@ -875,6 +875,8 @@
+         goto cleanup;
+     }
+     lib = PR_LoadLibrary(libname);
++    if (!lib)
++        lib = PR_LoadLibrary(NIX_NSS_LIBDIR"libsoftokn3.so");
+     assert(lib != NULL);
+     if (!lib) {
+         PR_fprintf(PR_STDERR, "loading softokn3 failed");
+diff -ru -x '*~' -x '*.orig' -x '*.rej' nss/coreconf/config.mk nss/coreconf/config.mk
+--- nss/coreconf/config.mk	2017-01-04 15:24:24.000000000 +0100
++++ nss/coreconf/config.mk	2017-01-24 14:43:47.989432372 +0100
+@@ -202,3 +202,6 @@
+ 
+ # Hide old, deprecated, TLS cipher suite names when building NSS
+ DEFINES += -DSSL_DISABLE_DEPRECATED_CIPHER_SUITE_NAMES
++
++# Nix specific stuff.
++DEFINES += -DNIX_NSS_LIBDIR=\"$(out)/lib/\"
+diff -ru -x '*~' -x '*.orig' -x '*.rej' nss/lib/pk11wrap/pk11load.c nss/lib/pk11wrap/pk11load.c
+--- nss/lib/pk11wrap/pk11load.c	2017-01-04 15:24:24.000000000 +0100
++++ nss/lib/pk11wrap/pk11load.c	2017-01-24 14:45:06.883485652 +0100
+@@ -440,6 +440,13 @@
+          * unload the library if anything goes wrong from here on out...
+          */
+         library = PR_LoadLibrary(mod->dllName);
++        if ((library == NULL) &&
++            !rindex(mod->dllName, PR_GetDirectorySeparator())) {
++            library = PORT_LoadLibraryFromOrigin(my_shlib_name,
++                (PRFuncPtr) &softoken_LoadDSO,
++                mod->dllName);
++        }
++
+         mod->library = (void *)library;
+ 
+         if (library == NULL) {
+diff -ru -x '*~' -x '*.orig' -x '*.rej' nss/lib/util/secload.c nss/lib/util/secload.c
+--- nss/lib/util/secload.c	2017-01-04 15:24:24.000000000 +0100
++++ nss/lib/util/secload.c	2017-01-24 14:43:31.030420852 +0100
+@@ -70,9 +70,14 @@
+ 
+     /* Remove the trailing filename from referencePath and add the new one */
+     c = strrchr(referencePath, PR_GetDirectorySeparator());
++    if (!c) { /* referencePath doesn't contain a / means that dladdr gave us argv[0]
++               * and program was called from $PATH. Hack to get libs from NIX_NSS_LIBDIR */
++        referencePath = NIX_NSS_LIBDIR;
++        c = (char*) &referencePath[sizeof(NIX_NSS_LIBDIR) - 1]; /* last / */
++    }
+     if (c) {
+         size_t referencePathSize = 1 + c - referencePath;
+-        fullName = (char*)PORT_Alloc(strlen(name) + referencePathSize + 1);
++        fullName = (char*) PORT_Alloc(strlen(name) + referencePathSize + 5);
+         if (fullName) {
+             memcpy(fullName, referencePath, referencePathSize);
+             strcpy(fullName + referencePathSize, name);
+@@ -82,6 +87,11 @@
+ #endif
+             libSpec.type = PR_LibSpec_Pathname;
+             libSpec.value.pathname = fullName;
++            if ((referencePathSize >= 4) &&
++                (strncmp(fullName + referencePathSize - 4, "bin", 3) == 0)) {
++                memcpy(fullName + referencePathSize -4, "lib", 3);
++            }
++            strcpy(fullName + referencePathSize, name);
+             dlh = PR_LoadLibraryWithFlags(libSpec, PR_LD_NOW | PR_LD_LOCAL
+ #ifdef PR_LD_ALT_SEARCH_PATH
+                                                        /* allow library's dependencies to be found in the same directory
+@@ -89,6 +99,10 @@
+                                                        | PR_LD_ALT_SEARCH_PATH
+ #endif
+                                           );
++            if (! dlh) {
++                strcpy(fullName + referencePathSize, name);
++                dlh = PR_LoadLibraryWithFlags(libSpec, PR_LD_NOW | PR_LD_LOCAL);
++            }
+             PORT_Free(fullName);
+         }
+     }
diff --git a/nixpkgs/pkgs/development/libraries/nss/ckpem.patch b/nixpkgs/pkgs/development/libraries/nss/ckpem.patch
new file mode 100644
index 000000000000..c1a65a6c0b28
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/nss/ckpem.patch
@@ -0,0 +1,11 @@
+--- nss/lib/ckfw/pem/ckpem.h	2018-01-03 13:36:12.000000000 -0800
++++ nss/lib/ckfw/pem/ckpem.h	2018-01-03 13:36:20.000000000 -0800
+@@ -156,8 +156,6 @@
+ NSS_EXTERN_DATA pemInternalObject nss_pem_data[];
+ NSS_EXTERN_DATA const PRUint32               nss_pem_nObjects;
+ 
+-  PRBool          logged_in;
+-
+ /* our raw object data array */
+ NSS_EXTERN_DATA pemInternalObject nss_pem_data[];
+ NSS_EXTERN_DATA const PRUint32               nss_pem_nObjects;
diff --git a/nixpkgs/pkgs/development/libraries/nss/default.nix b/nixpkgs/pkgs/development/libraries/nss/default.nix
new file mode 100644
index 000000000000..f3fc4caf3154
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/nss/default.nix
@@ -0,0 +1,139 @@
+{ stdenv, fetchurl, nspr, perl, zlib, sqlite, fixDarwinDylibNames, buildPackages }:
+
+let
+  nssPEM = fetchurl {
+    url = http://dev.gentoo.org/~polynomial-c/mozilla/nss-3.15.4-pem-support-20140109.patch.xz;
+    sha256 = "10ibz6y0hknac15zr6dw4gv9nb5r5z9ym6gq18j3xqx7v7n3vpdw";
+  };
+  version = "3.44";
+  underscoreVersion = builtins.replaceStrings ["."] ["_"] version;
+
+in stdenv.mkDerivation rec {
+  name = "nss-${version}";
+  inherit version;
+
+  src = fetchurl {
+    url = "mirror://mozilla/security/nss/releases/NSS_${underscoreVersion}_RTM/src/${name}.tar.gz";
+    sha256 = "1zvabgxlyvz3fnv4w89y4a5qkscjmm88naf929dgvvgfnrchwqm5";
+  };
+
+  depsBuildBuild = [ buildPackages.stdenv.cc ];
+
+  nativeBuildInputs = [ perl ];
+
+  buildInputs = [ zlib sqlite ]
+    ++ stdenv.lib.optional stdenv.isDarwin fixDarwinDylibNames;
+
+  propagatedBuildInputs = [ nspr ];
+
+  prePatch = ''
+    xz -d < ${nssPEM} | patch -p1
+  '';
+
+  patches =
+    [
+      # Based on http://patch-tracker.debian.org/patch/series/dl/nss/2:3.15.4-1/85_security_load.patch
+      ./85_security_load.patch
+      ./ckpem.patch
+    ];
+
+  patchFlags = "-p0";
+
+  postPatch = stdenv.lib.optionalString stdenv.isDarwin ''
+    substituteInPlace nss/coreconf/Darwin.mk --replace '@executable_path/$(notdir $@)' "$out/lib/\$(notdir \$@)"
+  '';
+
+  outputs = [ "out" "dev" "tools" ];
+
+  preConfigure = "cd nss";
+
+  makeFlags = let
+    cpu = stdenv.hostPlatform.parsed.cpu.name;
+  in [
+    "NSPR_INCLUDE_DIR=${nspr.dev}/include"
+    "NSPR_LIB_DIR=${nspr.out}/lib"
+    "NSDISTMODE=copy"
+    "BUILD_OPT=1"
+    "SOURCE_PREFIX=\$(out)"
+    "NSS_ENABLE_ECC=1"
+    "USE_SYSTEM_ZLIB=1"
+    "NSS_USE_SYSTEM_SQLITE=1"
+    "NATIVE_CC=${buildPackages.stdenv.cc}/bin/cc"
+  ] ++ stdenv.lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) [
+    "OS_TEST=${cpu}"
+    "CPU_ARCH=${cpu}"
+    "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++";
+
+  NIX_CFLAGS_COMPILE = "-Wno-error";
+
+  # TODO(@oxij): investigate this: `make -n check` works but `make
+  # check` fails with "no rule", same for "installcheck".
+  doCheck = false;
+  doInstallCheck = false;
+
+  postInstall = ''
+    rm -rf $out/private
+    mv $out/public $out/include
+    mv $out/*.OBJ/* $out/
+    rmdir $out/*.OBJ
+
+    ln -s lib $out/lib64
+
+    # Upstream issue: https://bugzilla.mozilla.org/show_bug.cgi?id=530672
+    # https://gitweb.gentoo.org/repo/gentoo.git/plain/dev-libs/nss/files/nss-3.32-gentoo-fixups.patch?id=af1acce6c6d2c3adb17689261dfe2c2b6771ab8a
+    NSS_MAJOR_VERSION=`grep "NSS_VMAJOR" lib/nss/nss.h | awk '{print $3}'`
+    NSS_MINOR_VERSION=`grep "NSS_VMINOR" lib/nss/nss.h | awk '{print $3}'`
+    NSS_PATCH_VERSION=`grep "NSS_VPATCH" lib/nss/nss.h | awk '{print $3}'`
+    PREFIX="$out"
+
+    mkdir -p $out/lib/pkgconfig
+    sed -e "s,%prefix%,$PREFIX," \
+        -e "s,%exec_prefix%,$PREFIX," \
+        -e "s,%libdir%,$PREFIX/lib64," \
+        -e "s,%includedir%,$dev/include/nss," \
+        -e "s,%NSS_VERSION%,$NSS_MAJOR_VERSION.$NSS_MINOR_VERSION.$NSS_PATCH_VERSION,g" \
+        -e "s,%NSPR_VERSION%,4.16,g" \
+        pkg/pkg-config/nss.pc.in > $out/lib/pkgconfig/nss.pc
+    chmod 0644 $out/lib/pkgconfig/nss.pc
+
+    sed -e "s,@prefix@,$PREFIX," \
+        -e "s,@MOD_MAJOR_VERSION@,$NSS_MAJOR_VERSION," \
+        -e "s,@MOD_MINOR_VERSION@,$NSS_MINOR_VERSION," \
+        -e "s,@MOD_PATCH_VERSION@,$NSS_PATCH_VERSION," \
+        pkg/pkg-config/nss-config.in > $out/bin/nss-config
+    chmod 0755 $out/bin/nss-config
+  '';
+
+  postFixup = let
+    isCross = stdenv.hostPlatform != stdenv.buildPlatform;
+    nss = if isCross then buildPackages.nss.tools else "$out";
+  in ''
+    for libname in freebl3 nssdbm3 softokn3
+    do '' +
+    (if stdenv.isDarwin
+     then ''
+       libfile="$out/lib/lib$libname.dylib"
+       DYLD_LIBRARY_PATH=$out/lib:${nspr.out}/lib \
+     '' else ''
+       libfile="$out/lib/lib$libname.so"
+       LD_LIBRARY_PATH=$out/lib:${nspr.out}/lib \
+     '') + ''
+        ${nss}/bin/shlibsign -v -i "$libfile"
+    done
+
+    moveToOutput bin "$tools"
+    moveToOutput bin/nss-config "$dev"
+    moveToOutput lib/libcrmf.a "$dev" # needed by firefox, for example
+    rm -f "$out"/lib/*.a
+  '';
+
+  meta = with stdenv.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;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/nss_wrapper/default.nix b/nixpkgs/pkgs/development/libraries/nss_wrapper/default.nix
new file mode 100644
index 000000000000..e165f037be63
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/nss_wrapper/default.nix
@@ -0,0 +1,20 @@
+{ stdenv, fetchurl, cmake, pkgconfig }:
+
+stdenv.mkDerivation rec {
+  name = "nss_wrapper-1.1.5";
+
+  src = fetchurl {
+    url = "mirror://samba/cwrap/${name}.tar.gz";
+    sha256 = "0srk7hffhkwl811q4pjy0n0gm8rh26akb2bh6avcpbns0zzn9ldn";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ cmake ];
+
+  meta = with stdenv.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;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/nsss/default.nix b/nixpkgs/pkgs/development/libraries/nsss/default.nix
new file mode 100644
index 000000000000..f503799e6b1c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/nsss/default.nix
@@ -0,0 +1,33 @@
+{ stdenv, skawarePackages }:
+
+with skawarePackages;
+
+buildPackage {
+  pname = "nsss";
+  version = "0.0.1.1";
+  sha256 = "14y1vl7n8vd5fh9bwiwwxxslisli8pz3a2f1sfv12l0p8ngpgm57";
+
+  description = "An implementation of a subset of the pwd.h, group.h and shadow.h family of functions.";
+
+  # TODO: nsss support
+  configureFlags = [
+    "--libdir=\${lib}/lib"
+    "--dynlibdir=\${lib}/lib"
+    "--bindir=\${bin}/bin"
+    "--includedir=\${dev}/include"
+    "--with-sysdeps=${skalibs.lib}/lib/skalibs/sysdeps"
+    "--with-include=${skalibs.dev}/include"
+    "--with-lib=${skalibs.lib}/lib"
+    "--with-dynlib=${skalibs.lib}/lib"
+  ];
+
+  postInstall = ''
+    # remove all nsss executables from build directory
+    rm $(find -name "nsssd-*" -type f -mindepth 1 -maxdepth 1 -executable)
+    rm libnsss.* libnsssd.*
+
+    mv doc $doc/share/doc/nsss/html
+    mv examples $doc/share/doc/nsss/examples
+  '';
+
+}
diff --git a/nixpkgs/pkgs/development/libraries/ntbtls/default.nix b/nixpkgs/pkgs/development/libraries/ntbtls/default.nix
new file mode 100644
index 000000000000..dac65e1c2f9a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/ntbtls/default.nix
@@ -0,0 +1,30 @@
+{ stdenv, fetchurl, gettext, libgpgerror, libgcrypt, libksba, zlib }:
+
+with stdenv.lib;
+
+stdenv.mkDerivation rec {
+  name = "ntbtls-${version}";
+  version = "0.1.2";
+
+  src = fetchurl {
+    url = "mirror://gnupg/ntbtls/ntbtls-${version}.tar.bz2";
+    sha256 = "1rywgdyj7prmwdi5r1rpglakqpnjskgln1mqksqm28qcwn2dnh42";
+  };
+
+  outputs = [ "dev" "out" ];
+
+  buildInputs = [ libgcrypt libgpgerror libksba zlib ]
+    ++ stdenv.lib.optional stdenv.isDarwin gettext;
+
+  postInstall = ''
+    moveToOutput "bin/ntbtls-config" $dev
+  '';
+
+  meta = {
+    description = "A tiny TLS 1.2 only implementation";
+    homepage = "https://www.gnupg.org/software/ntbtls/";
+    license = licenses.gpl3Plus;
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ joachifm ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/ntdb/default.nix b/nixpkgs/pkgs/development/libraries/ntdb/default.nix
new file mode 100644
index 000000000000..a310d2f27802
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/ntdb/default.nix
@@ -0,0 +1,33 @@
+{ stdenv, fetchurl, python, pkgconfig, readline, gettext, libxslt
+, docbook_xsl, docbook_xml_dtd_42
+}:
+
+stdenv.mkDerivation rec {
+  name = "ntdb-1.0";
+
+  src = fetchurl {
+    url = "mirror://samba/tdb/${name}.tar.gz";
+    sha256 = "0jdzgrz5sr25k83yrw7wqb3r0yj1v04z4s3lhsmnr5z6n5ifhyl1";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [
+    python readline gettext libxslt docbook_xsl docbook_xml_dtd_42
+  ];
+
+  preConfigure = ''
+    patchShebangs buildtools/bin/waf
+  '';
+
+  configureFlags = [
+    "--bundled-libraries=NONE"
+    "--builtin-libraries=replace,ccan"
+  ];
+
+  meta = with stdenv.lib; {
+    description = "The not-so trivial database";
+    homepage = https://tdb.samba.org/;
+    license = licenses.lgpl3Plus;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/ntl/default.nix b/nixpkgs/pkgs/development/libraries/ntl/default.nix
new file mode 100644
index 000000000000..12d3c9ad9420
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/ntl/default.nix
@@ -0,0 +1,74 @@
+{ stdenv
+, lib
+, fetchurl
+, perl
+, gmp
+, gf2x ? null
+# I asked the ntl maintainer weather or not to include gf2x by default:
+# > If I remember correctly, gf2x is now thread safe, so there's no reason not to use it.
+, withGf2x ? true
+, tune ? false # tune for current system; non reproducible and time consuming
+}:
+
+assert withGf2x -> gf2x != null;
+
+stdenv.mkDerivation rec {
+  name = "ntl-${version}";
+  version = "11.3.2";
+
+  src = fetchurl {
+    url = "http://www.shoup.net/ntl/ntl-${version}.tar.gz";
+    sha256 = "17bfsvn72zjqfibnxscyf4hbk3inndh4r89jd2zg7mgqmd2k3fl4";
+  };
+
+  buildInputs = [
+    gmp
+  ];
+
+  nativeBuildInputs = [
+    perl # needed for ./configure
+  ];
+
+  sourceRoot = "${name}/src";
+
+  enableParallelBuilding = true;
+
+  dontAddPrefix = true; # DEF_PREFIX instead
+
+  # reference: http://shoup.net/ntl/doc/tour-unix.html
+  configureFlags = [
+    "DEF_PREFIX=$(out)"
+    "SHARED=on" # genereate a shared library (as well as static)
+    "NATIVE=off" # don't target code to current hardware (reproducibility, portability)
+    "TUNE=${
+      if tune then
+        "auto"
+      else if stdenv.targetPlatform.isx86 then
+        "x86" # "chooses options that should be well suited for most x86 platforms"
+      else
+        "generic" # "chooses options that should be OK for most platforms"
+    }"
+    "CXX=c++"
+  ] ++ lib.optionals withGf2x [
+    "NTL_GF2X_LIB=on"
+    "GF2X_PREFIX=${gf2x}"
+  ];
+
+  doCheck = true; # takes some time
+
+  meta = with lib; {
+    description = "A Library for doing Number Theory";
+    longDescription = ''
+      NTL is a high-performance, portable C++ library providing data
+      structures and algorithms for manipulating signed, arbitrary
+      length integers, and for vectors, matrices, and polynomials over
+      the integers and over finite fields.
+    '';
+    # Upstream contact: maintainer is victorshoup on GitHub. Alternatively the
+    # email listed on the homepage.
+    homepage = http://www.shoup.net/ntl/;
+    maintainers = with maintainers; [ timokau ];
+    license = licenses.gpl2Plus;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/ntrack/default.nix b/nixpkgs/pkgs/development/libraries/ntrack/default.nix
new file mode 100644
index 000000000000..c0a73fa984e7
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/ntrack/default.nix
@@ -0,0 +1,37 @@
+{ stdenv, fetchurl, qt4, pkgconfig, libnl, python }:
+
+let
+  version = "016";
+in
+
+stdenv.mkDerivation rec {
+  name = "ntrack-${version}";
+
+  src = fetchurl {
+    url = "https://launchpad.net/ntrack/main/${version}/+download/${name}.tar.gz";
+    sha256 = "037ig5y0mp327m0hh4pnfr3vmsk3wrxgfjy3645q4ws9vdhx807w";
+  };
+
+  buildInputs = [ libnl qt4 ];
+
+  nativeBuildInputs = [ pkgconfig python ];
+
+  # error: ISO C does not support '__FUNCTION__' predefined identifier [-Werror=pedantic]
+  NIX_CFLAGS_COMPILE = [ "-Wno-error" ];
+
+  configureFlags = [ "--without-gobject" "CFLAGS=--std=gnu99" ];
+
+  # Remove this patch after version 016
+  patches = [ ./libnl-fix.patch ];
+
+  postPatch = ''
+    sed -e "s@/usr\(/lib/ntrack/modules/\)@$out&@" -i common/ntrack.c
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Network Connectivity Tracking library for Desktop Applications";
+    homepage = https://launchpad.net/ntrack;
+    platforms = platforms.linux;
+    license = licenses.lgpl3Plus;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/ntrack/libnl-fix.patch b/nixpkgs/pkgs/development/libraries/ntrack/libnl-fix.patch
new file mode 100644
index 000000000000..806a0178ec8a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/ntrack/libnl-fix.patch
@@ -0,0 +1,11 @@
+--- ./modules/ntrack-libnl.c.orig	2013-12-02 11:31:54.749215448 -0600
++++ ./modules/ntrack-libnl.c	2013-12-02 11:34:46.597684553 -0600
+@@ -530,7 +530,7 @@
+ 		op_default_route_disappeared ((struct _ntrack_monitor_arch*) self, nl_info);
+ 	} else if (nl_info->topmost_route && topmost_route) {
+ 		int diff_bits;
+-		if ((diff_bits = (route_obj_ops.oo_id_attrs | ROUTE_ATTR_OIF
++		if ((diff_bits = (nl_object_get_id_attrs(OBJ_CAST(topmost_route)) | ROUTE_ATTR_OIF
+ 		                  | ROUTE_ATTR_GATEWAY) &
+ 		                  nl_object_diff (OBJ_CAST (nl_info->topmost_route),
+ 		                                  OBJ_CAST (topmost_route)))) {
diff --git a/nixpkgs/pkgs/development/libraries/nuspell/default.nix b/nixpkgs/pkgs/development/libraries/nuspell/default.nix
new file mode 100644
index 000000000000..b667dea8d49f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/nuspell/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchFromGitHub, cmake, pkgconfig, boost, icu, catch2 }:
+
+stdenv.mkDerivation rec {
+  name = "nuspell-${version}";
+  version = "2.2.0";
+
+  src = fetchFromGitHub {
+    owner = "nuspell";
+    repo = "nuspell";
+    rev = "v${version}";
+    sha256 = "17khkb1sxn1p6rfql72l7a4lxafbxj0dwi95hsmyi6wajvfrg9sy";
+  };
+
+  nativeBuildInputs = [ cmake pkgconfig ];
+  buildInputs = [ boost icu ];
+
+  enableParallelBuilding = true;
+
+  postPatch = ''
+    rm -rf external/Catch2
+    ln -sf ${catch2.src} external/Catch2
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Free and open source C++ spell checking library";
+    homepage = "https://nuspell.github.io/";
+    maintainers = with maintainers; [ fpletz ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/nuspell/wrapper.nix b/nixpkgs/pkgs/development/libraries/nuspell/wrapper.nix
new file mode 100644
index 000000000000..4386542ff20e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/nuspell/wrapper.nix
@@ -0,0 +1,13 @@
+{ stdenv, lib, nuspell, makeWrapper, dicts ? [] }:
+with lib;
+let
+  searchPath = makeSearchPath "share/hunspell" dicts;
+in
+stdenv.mkDerivation {
+  name = (appendToName "with-dicts" nuspell).name;
+  buildInputs = [ makeWrapper ];
+  buildCommand = ''
+    makeWrapper ${nuspell}/bin/nuspell $out/bin/nuspell --prefix DICPATH : ${searchPath}
+  '';
+  meta = removeAttrs nuspell.meta ["outputsToInstall"];
+}
diff --git a/nixpkgs/pkgs/development/libraries/nv-codec-headers/default.nix b/nixpkgs/pkgs/development/libraries/nv-codec-headers/default.nix
new file mode 100644
index 000000000000..f74030a02df8
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/nv-codec-headers/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, fetchgit }:
+
+stdenv.mkDerivation rec {
+  pname = "nv-codec-headers";
+  version = "9.0.18.1";
+
+  src = fetchgit {
+    url = "https://git.videolan.org/git/ffmpeg/nv-codec-headers.git";
+    rev = "n${version}";
+    sha256 = "0354fivb92ix341jds7a7qn3mgwimrnxbganhlhr4vayj25c3hw5";
+  };
+
+  makeFlags = [ "PREFIX=$(out)" ];
+
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/nvidia-texture-tools/default.nix b/nixpkgs/pkgs/development/libraries/nvidia-texture-tools/default.nix
new file mode 100644
index 000000000000..77167361ff20
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/nvidia-texture-tools/default.nix
@@ -0,0 +1,41 @@
+{ stdenv, fetchFromGitHub, cmake }:
+
+stdenv.mkDerivation rec {
+  name = "nvidia-texture-tools-${version}";
+  version = "2.1.0";
+
+  src = fetchFromGitHub {
+    owner = "castano";
+    repo = "nvidia-texture-tools";
+    rev = version;
+    sha256 = "0p8ja0k323nkgm07z0qlslg6743vimy9rf3wad2968az0vwzjjyx";
+  };
+
+  nativeBuildInputs = [ cmake ];
+
+  outputs = [ "out" "dev" "lib" ];
+
+  postPatch = ''
+    # Make a recently added pure virtual function just virtual,
+    # to keep compatibility.
+    sed -i 's/virtual void endImage() = 0;/virtual void endImage() {}/' src/nvtt/nvtt.h
+  '';
+
+  cmakeFlags = [
+    "-DNVTT_SHARED=TRUE"
+  ];
+
+  postInstall = ''
+    moveToOutput include "$dev"
+    moveToOutput lib "$lib"
+  '';
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    description = "A set of cuda-enabled texture tools and compressors";
+    homepage = https://github.com/castano/nvidia-texture-tools;
+    license = licenses.mit;
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/nvidia-video-sdk/default.nix b/nixpkgs/pkgs/development/libraries/nvidia-video-sdk/default.nix
new file mode 100644
index 000000000000..798f9d3a3965
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/nvidia-video-sdk/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchurl, unzip }:
+
+stdenv.mkDerivation rec {
+  name = "nvidia-video-sdk-6.0.1";
+
+  src = fetchurl {
+    url = "https://developer.nvidia.com/video-sdk-601";
+    name = "nvidia_video_sdk_6.0.1.zip";
+    sha256 = "08h1vnqsv22js9v3pyim5yb80z87baxb7s2g5gsvvjax07j7w8h5";
+  };
+
+  buildInputs = [ unzip ];
+
+  # We only need the header files. The library files are
+  # in the nvidia_x11 driver.
+  installPhase = ''
+    mkdir -p $out/include
+    cp -R Samples/common/inc/* $out/include
+  '';
+
+  meta = with stdenv.lib; {
+    description = "The NVIDIA Video Codec SDK";
+    homepage = https://developer.nvidia.com/nvidia-video-codec-sdk;
+    license = licenses.unfree;
+  };
+}
+
diff --git a/nixpkgs/pkgs/development/libraries/ocl-icd/default.nix b/nixpkgs/pkgs/development/libraries/ocl-icd/default.nix
new file mode 100644
index 000000000000..abdc7502052b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/ocl-icd/default.nix
@@ -0,0 +1,32 @@
+{stdenv, fetchurl, ruby, opencl-headers, addOpenGLRunpath }:
+
+stdenv.mkDerivation rec {
+  name = "ocl-icd-${version}";
+  version = "2.2.10";
+
+  src = fetchurl {
+    url = "https://forge.imag.fr/frs/download.php/810/${name}.tar.gz";
+    sha256 = "0f14gpa13sdm0kzqv5yycp4pschbmi6n5fj7wl4ilspzsrqcgqr2";
+  };
+
+  nativeBuildInputs = [ ruby addOpenGLRunpath ];
+
+  buildInputs = [ opencl-headers ];
+
+  postPatch = ''
+    sed -i 's,"/etc/OpenCL/vendors","${addOpenGLRunpath.driverLink}/etc/OpenCL/vendors",g' ocl_icd_loader.c
+  '';
+
+  # Set RUNPATH so that driver libraries in /run/opengl-driver(-32)/lib can be found.
+  # See the explanation in addOpenGLRunpath.
+  postFixup = ''
+    addOpenGLRunpath $out/lib/libOpenCL.so
+  '';
+
+  meta = with stdenv.lib; {
+    description = "OpenCL ICD Loader for ${opencl-headers.name}";
+    homepage    = https://forge.imag.fr/projects/ocl-icd/;
+    license     = licenses.bsd2;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/ode/default.nix b/nixpkgs/pkgs/development/libraries/ode/default.nix
new file mode 100644
index 000000000000..aa1886508609
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/ode/default.nix
@@ -0,0 +1,18 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "ode-${version}";
+  version = "0.12";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/opende/ode-${version}.tar.bz2";
+    sha256 = "0l63ymlkgfp5cb0ggqwm386lxmc3al21nb7a07dd49f789d33ib5";
+  };
+
+  meta = with stdenv.lib; {
+    description = "Open Dynamics Engine";
+    homepage = https://sourceforge.net/projects/opende;
+    platforms = platforms.linux;
+    license = with licenses; [ bsd3 lgpl21 lgpl3 zlib ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/odpic/default.nix b/nixpkgs/pkgs/development/libraries/odpic/default.nix
new file mode 100644
index 000000000000..931ecc186be6
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/odpic/default.nix
@@ -0,0 +1,40 @@
+{ stdenv, fetchurl, fixDarwinDylibNames, oracle-instantclient, libaio }:
+
+stdenv.mkDerivation rec {
+  name = "odpic-${version}";
+  version = "3.1.0";
+
+  src = fetchurl {
+    url = "https://github.com/oracle/odpi/archive/v${version}.tar.gz";
+    sha256 = "0m6g7lbvfir4amf2cnap9wz9fmqrihqpihd84igrd7fp076894c0";
+  };
+
+  nativeBuildInputs = stdenv.lib.optional stdenv.isDarwin [ fixDarwinDylibNames ];
+
+  buildInputs = [ oracle-instantclient ]
+    ++ stdenv.lib.optionals stdenv.isLinux [ libaio ];
+
+  libPath = stdenv.lib.makeLibraryPath
+    [ oracle-instantclient ];
+
+  dontPatchELF = true;
+  makeFlags = [ "PREFIX=$(out)" "CC=cc" "LD=cc"];
+
+  postFixup = ''
+    ${stdenv.lib.optionalString (stdenv.isLinux) ''
+      patchelf --set-rpath "${libPath}" $out/lib/libodpic${stdenv.hostPlatform.extensions.sharedLibrary}
+    ''}
+    ${stdenv.lib.optionalString (stdenv.isDarwin) ''
+      install_name_tool -add_rpath "${libPath}" $out/lib/libodpic${stdenv.hostPlatform.extensions.sharedLibrary}
+    ''}
+    '';
+
+  meta = with stdenv.lib; {
+    description = "Oracle ODPI-C library";
+    homepage = "https://oracle.github.io/odpi/";
+    maintainers = with maintainers; [ mkazulak flokli ];
+    license = licenses.asl20;
+    platforms = [ "x86_64-linux" "x86_64-darwin" ];
+    hydraPlatforms = [];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/ogre/1.10.x.nix b/nixpkgs/pkgs/development/libraries/ogre/1.10.x.nix
new file mode 100644
index 000000000000..d847f447048d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/ogre/1.10.x.nix
@@ -0,0 +1,42 @@
+{ fetchurl, stdenv, lib
+, cmake, libGLU_combined
+, freetype, freeimage, zziplib, xorgproto, libXrandr
+, libXaw, freeglut, libXt, libpng, boost, ois
+, libX11, libXmu, libSM, pkgconfig
+, libXxf86vm, libICE
+, libXrender
+, withNvidiaCg ? false, nvidia_cg_toolkit
+, withSamples ? false }:
+
+stdenv.mkDerivation {
+  name = "ogre-1.10.11";
+
+  src = fetchurl {
+     url = "https://bitbucket.org/sinbad/ogre/get/v1-10-11.tar.gz";
+     sha256 = "1zwvlx5dz9nwjazhnrhzb0w8ilpa84r0hrxrmmy69pgr1p1yif5a";
+  };
+
+  cmakeFlags = [ "-DOGRE_BUILD_SAMPLES=${toString withSamples}" ]
+    ++ map (x: "-DOGRE_BUILD_PLUGIN_${x}=on")
+           ([ "BSP" "OCTREE" "PCZ" "PFX" ] ++ lib.optional withNvidiaCg "CG")
+    ++ map (x: "-DOGRE_BUILD_RENDERSYSTEM_${x}=on") [ "GL" ];
+
+  enableParallelBuilding = true;
+
+  buildInputs =
+   [ cmake libGLU_combined
+     freetype freeimage zziplib xorgproto libXrandr
+     libXaw freeglut libXt libpng boost ois
+     libX11 libXmu libSM pkgconfig
+     libXxf86vm libICE
+     libXrender
+   ] ++ lib.optional withNvidiaCg nvidia_cg_toolkit;
+
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/ogre/1.9.x.nix b/nixpkgs/pkgs/development/libraries/ogre/1.9.x.nix
new file mode 100644
index 000000000000..42babc32ecdb
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/ogre/1.9.x.nix
@@ -0,0 +1,46 @@
+{ fetchFromGitHub, stdenv, lib
+, cmake, libGLU_combined
+, freetype, freeimage, zziplib, xorgproto, libXrandr
+, libXaw, freeglut, libXt, libpng, boost, ois
+, libX11, libXmu, libSM, pkgconfig
+, libXxf86vm, libICE
+, libXrender
+, withNvidiaCg ? false, nvidia_cg_toolkit
+, withSamples ? false }:
+
+stdenv.mkDerivation rec {
+  pname = "ogre";
+  version = "1.9.1";
+  name = "${pname}-${version}";
+
+  src = fetchFromGitHub {
+    owner = "OGRECave";
+    repo = "ogre";
+    rev = "v${version}";
+    sha256 = "11lfgzqaps3728dswrq3cbwk7aicigyz08q4hfyy6ikc6m35r4wg";
+  };
+
+  cmakeFlags = [ "-DOGRE_BUILD_SAMPLES=${toString withSamples}" ]
+    ++ map (x: "-DOGRE_BUILD_PLUGIN_${x}=on")
+           ([ "BSP" "OCTREE" "PCZ" "PFX" ] ++ lib.optional withNvidiaCg "CG")
+    ++ map (x: "-DOGRE_BUILD_RENDERSYSTEM_${x}=on") [ "GL" ];
+
+  enableParallelBuilding = true;
+
+  buildInputs =
+   [ cmake libGLU_combined
+     freetype freeimage zziplib xorgproto libXrandr
+     libXaw freeglut libXt libpng boost ois
+     libX11 libXmu libSM pkgconfig
+     libXxf86vm libICE
+     libXrender
+   ] ++ lib.optional withNvidiaCg nvidia_cg_toolkit;
+
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/ogre/default.nix b/nixpkgs/pkgs/development/libraries/ogre/default.nix
new file mode 100644
index 000000000000..a6de278a7a7f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/ogre/default.nix
@@ -0,0 +1,46 @@
+{ fetchurl, stdenv, lib
+, cmake, libGLU_combined
+, freetype, freeimage, zziplib, xorgproto, libXrandr
+, libXaw, freeglut, libXt, libpng, boost, ois
+, libX11, libXmu, libSM, pkgconfig
+, libXxf86vm, libICE
+, unzip
+, libXrender
+, withNvidiaCg ? false, nvidia_cg_toolkit
+, withSamples ? false }:
+
+stdenv.mkDerivation rec {
+  name = "ogre-${version}";
+  version = "1.12.0";
+
+  src = fetchurl {
+     url = "https://github.com/OGRECave/ogre/archive/v${version}.zip";
+     sha256 = "1hkkg5prixppiq1p5jz7wz1npm5s7kwm1s86079280waccvr2v6x";
+  };
+
+  cmakeFlags = [ "-DOGRE_BUILD_SAMPLES=${toString withSamples}" ]
+    ++ map (x: "-DOGRE_BUILD_PLUGIN_${x}=on")
+           ([ "BSP" "OCTREE" "PCZ" "PFX" ] ++ lib.optional withNvidiaCg "CG")
+    ++ map (x: "-DOGRE_BUILD_RENDERSYSTEM_${x}=on") [ "GL" ];
+
+  enableParallelBuilding = true;
+
+  buildInputs =
+   [ cmake libGLU_combined
+     freetype freeimage zziplib xorgproto libXrandr
+     libXaw freeglut libXt libpng boost ois
+     libX11 libXmu libSM pkgconfig
+     libXxf86vm libICE
+     libXrender
+   ] ++ lib.optional withNvidiaCg nvidia_cg_toolkit;
+
+  nativeBuildInputs = [ unzip ];
+
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/ogrepaged/default.nix b/nixpkgs/pkgs/development/libraries/ogrepaged/default.nix
new file mode 100644
index 000000000000..e4045bcd5dc4
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/ogrepaged/default.nix
@@ -0,0 +1,42 @@
+{ stdenv, fetchurl, fetchpatch, cmake, pkgconfig, ois, ogre, libX11, boost }:
+
+stdenv.mkDerivation rec {
+  name = "ogre-paged-${version}";
+  version = "1.2.0";
+
+  src = fetchurl {
+    url = "https://github.com/RigsOfRods/ogre-pagedgeometry/archive/v${version}.tar.gz";
+    sha256 = "17j7rw9wbkynxbhm2lay3qgjnnagb2vd5jn9iijnn2lf8qzbgy82";
+  };
+
+  patches = [
+    # These patches come from https://github.com/RigsOfRods/ogre-pagedgeometry/pull/6
+    # and make ogre-paged build with ogre-1.10.
+    (fetchpatch {
+      url = "https://github.com/RigsOfRods/ogre-pagedgeometry/commit/2d4df577decba37ec3cdafc965deae0f6d31fe45.patch";
+      sha256 = "0mdqa9w1p6cmli6976v4wi0sw9r4p5prkj7lzfd1877wk11c9c73";
+    })
+    (fetchpatch {
+      url = "https://github.com/RigsOfRods/ogre-pagedgeometry/commit/4d81789ec6f55e294a5ad040ea7abe2b415cbc92.patch";
+      sha256 = "17q8djdz2y3g46azxc3idhyvi6vf0sqkxld4bbyp3l9zn7dq76rp";
+    })
+    (fetchpatch {
+      url = "https://github.com/RigsOfRods/ogre-pagedgeometry/commit/10f7c5ce5b422e9cbac59d466f3567a24c8831a4.patch";
+      sha256 = "1kk0dbadzg73ai99l3w04q51sil36vzbkaqc79mdwy0vjrn4ardb";
+    })
+  ];
+
+  buildInputs = [ ois ogre libX11 boost ];
+  nativeBuildInputs = [ cmake pkgconfig ];
+
+  cmakeFlags = [ "-DPAGEDGEOMETRY_BUILD_SAMPLES=OFF" ];
+
+  enableParallelBuilding = true;
+
+  meta = {
+    description = "Paged Geometry for Ogre3D";
+    homepage = https://github.com/RigsOfRods/ogre-paged;
+    license = stdenv.lib.licenses.mit;
+    platforms = stdenv.lib.platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/ois/default.nix b/nixpkgs/pkgs/development/libraries/ois/default.nix
new file mode 100644
index 000000000000..253d185fa0cd
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/ois/default.nix
@@ -0,0 +1,41 @@
+{ stdenv, fetchurl, autoconf, automake, libtool, libX11, xorgproto
+, libXi, libXaw, libXmu, libXt }:
+
+let
+  majorVersion = "1";
+  minorVersion = "3";
+in
+
+stdenv.mkDerivation rec {
+  name = "ois-${version}";
+  version = "${majorVersion}.${minorVersion}";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/project/wgois/Source%20Release/${version}/ois_v${majorVersion}-${minorVersion}.tar.gz";
+    sha256 = "18gs6xxhbqb91x2gm95hh1pmakimqim1k9c65h7ah6g14zc7dyjh";
+  };
+
+  patches = [
+    (fetchurl {
+      url = http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/dev-games/ois/files/ois-1.3-gcc47.patch;
+      sha256 = "026jw06n42bcrmg0sbdhzc4cqxsnf7fw30a2z9cigd9x282zhii8";
+      name = "gcc47.patch";
+    })
+  ];
+
+  patchFlags = "-p0";
+
+  buildInputs = [
+    autoconf automake libtool libX11 xorgproto libXi libXaw
+    libXmu libXt
+  ];
+
+  preConfigure = "sh bootstrap";
+
+  meta = with stdenv.lib; {
+    description = "Object-oriented C++ input system";
+    maintainers = [ maintainers.raskin ];
+    platforms = platforms.linux;
+    license = licenses.zlib;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/olm/default.nix b/nixpkgs/pkgs/development/libraries/olm/default.nix
new file mode 100644
index 000000000000..4749efb5f006
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/olm/default.nix
@@ -0,0 +1,26 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "olm-${version}";
+  version = "3.0.0";
+
+  meta = {
+    description = "Implements double cryptographic ratchet and Megolm ratchet";
+    license = stdenv.lib.licenses.asl20;
+    homepage = https://matrix.org/git/olm/about;
+    platforms = stdenv.lib.platforms.linux;
+  };
+
+  src = fetchurl {
+    url = "https://matrix.org/git/olm/snapshot/${name}.tar.gz";
+    sha256 = "1iivxjk458v9lhqgzp0c4k5azligsh9k3rk6irf9ssj29wzgjm2c";
+  };
+
+  doCheck = true;
+  checkTarget = "test";
+
+  # requires optimisation but memory operations are compiled with -O0
+  hardeningDisable = ["fortify"];
+
+  installFlags = "PREFIX=$(out)";
+}
diff --git a/nixpkgs/pkgs/development/libraries/oniguruma/default.nix b/nixpkgs/pkgs/development/libraries/oniguruma/default.nix
new file mode 100644
index 000000000000..b54f34fbb2c3
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/oniguruma/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchFromGitHub, cmake }:
+
+stdenv.mkDerivation rec {
+  name = "onig-${version}";
+  version = "6.9.2";
+
+  src = fetchFromGitHub {
+    owner = "kkos";
+    repo = "oniguruma";
+    rev = "v${version}";
+    sha256 = "15asc9v6ylal8fwzlnrh673mp62wngxvv9jx7h86vhljjdap6yfc";
+  };
+
+  nativeBuildInputs = [ cmake ];
+
+  meta = with stdenv.lib; {
+    homepage = https://github.com/kkos/oniguruma;
+    description = "Regular expressions library";
+    license = licenses.bsd2;
+    maintainers = with maintainers; [ fuuzetsu ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/opae/default.nix b/nixpkgs/pkgs/development/libraries/opae/default.nix
new file mode 100644
index 000000000000..b60a53e55ca1
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/opae/default.nix
@@ -0,0 +1,44 @@
+{ stdenv, fetchFromGitHub, cmake
+, libuuid, json_c
+, doxygen, perl, python2, python2Packages
+}:
+
+stdenv.mkDerivation rec {
+  name    = "opae-${version}";
+  version = "1.0.0";
+
+  # the tag has a silly name for some reason. drop this in the future if
+  # possible
+  tver    = "${version}-5";
+
+  src = fetchFromGitHub {
+    owner  = "opae";
+    repo   = "opae-sdk";
+    rev    = "refs/tags/${tver}";
+    sha256 = "1dmkpnr9dqxwjhbdzx2r3fdfylvinda421yyg319am5gzlysxwi8";
+  };
+
+  doCheck = false;
+
+  nativeBuildInputs = [ cmake doxygen perl python2Packages.sphinx ];
+  buildInputs = [ libuuid json_c python2 ];
+
+  # Set the Epoch to 1980; otherwise the Python wheel/zip code
+  # gets very angry
+  preConfigure = ''
+    find . -type f | while read file; do
+      touch -d @315532800 $file;
+    done
+  '';
+
+  cmakeFlags = [ "-DBUILD_ASE=1" ];
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    description = "Open Programmable Acceleration Engine SDK";
+    homepage    = https://01.org/opae;
+    license     = licenses.bsd3;
+    platforms   = [ "x86_64-linux" ];
+    maintainers = with maintainers; [ thoughtpolice ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/opal/default.nix b/nixpkgs/pkgs/development/libraries/opal/default.nix
new file mode 100644
index 000000000000..dd19fccd822a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/opal/default.nix
@@ -0,0 +1,43 @@
+{ stdenv, fetchurl, pkgconfig, ptlib, srtp, libtheora, speex, gnome3
+, ffmpeg, x264, cyrus_sasl, openldap, openssl, expat, unixODBC }:
+
+stdenv.mkDerivation rec {
+  pname = "opal";
+  version = "3.10.10";
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    sha256 = "f208985003461b2743575eccac13ad890b3e5baac35b68ddef17162460aff864";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ ptlib srtp libtheora speex
+                  ffmpeg x264 cyrus_sasl openldap openssl expat unixODBC ];
+  propagatedBuildInputs = [ speex ];
+
+  configureFlags = [ "--enable-h323" ];
+
+  enableParallelBuilding = true;
+
+  NIX_CFLAGS_COMPILE = "-D__STDC_CONSTANT_MACROS=1 -std=gnu++98";
+
+  patches = [ ./disable-samples-ftbfs.diff ./libav9.patch ./libav10.patch ];
+
+  meta = with stdenv.lib; {
+    description = "VoIP library";
+    maintainers = [ maintainers.raskin ];
+    platforms = platforms.linux;
+    homepage = "http://www.opalvoip.org/";
+    license = with licenses; [ bsdOriginal mpl10 gpl2Plus lgpl21 ];
+  };
+
+  passthru = {
+    updateInfo = {
+      downloadPage = "http://ftp.gnome.org/pub/GNOME/sources/opal";
+    };
+    updateScript = gnome3.updateScript {
+      packageName = pname;
+    };
+  };
+}
+
diff --git a/nixpkgs/pkgs/development/libraries/opal/disable-samples-ftbfs.diff b/nixpkgs/pkgs/development/libraries/opal/disable-samples-ftbfs.diff
new file mode 100644
index 000000000000..1b0738216079
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/opal/disable-samples-ftbfs.diff
@@ -0,0 +1,14 @@
+Index: opal-3.10.4~dfsg/Makefile.in
+===================================================================
+--- opal-3.10.4~dfsg.orig/Makefile.in	2012-02-22 10:08:36.000000000 +1100
++++ opal-3.10.4~dfsg/Makefile.in	2012-03-08 08:32:44.000000000 +1100
+@@ -45,8 +45,7 @@
+            samples/codectest \
+            samples/callgen \
+            samples/opalecho \
+-           samples/faxopal \
+-           samples/c_api
++           samples/faxopal 
+ ifeq ($(OPAL_IVR),yes)
+ SUBDIRS += samples/opalmcu \
+            samples/ivropal \
diff --git a/nixpkgs/pkgs/development/libraries/opal/libav10.patch b/nixpkgs/pkgs/development/libraries/opal/libav10.patch
new file mode 100644
index 000000000000..3e02704f8998
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/opal/libav10.patch
@@ -0,0 +1,208 @@
+Description: Fix compilation against libav10 
+Author: Reinhard Tartler <siretart@tauware.de>
+Bug-Debian: http://bugs.debian.org/739439
+
+--- a/plugins/video/H.263-1998/h263-1998.cxx
++++ b/plugins/video/H.263-1998/h263-1998.cxx
+@@ -94,7 +94,7 @@ static struct StdSizes {
+   { CIF16_WIDTH, CIF16_HEIGHT, PLUGINCODEC_CIF16_MPI },
+ };
+ 
+-static FFMPEGLibrary FFMPEGLibraryInstance(CODEC_ID_H263P);
++static FFMPEGLibrary FFMPEGLibraryInstance(AV_CODEC_ID_H263P);
+ 
+ 
+ /////////////////////////////////////////////////////////////////////////////
+@@ -203,7 +203,7 @@ H263_Base_EncoderContext::~H263_Base_Enc
+   PTRACE(4, m_prefix, "Encoder closed");
+ }
+ 
+-bool H263_Base_EncoderContext::Init(CodecID codecId)
++bool H263_Base_EncoderContext::Init(AVCodecID codecId)
+ {
+   PTRACE(5, m_prefix, "Opening encoder");
+ 
+@@ -589,7 +589,7 @@ void H263_RFC2190_EncoderContext::RTPCal
+ 
+ bool H263_RFC2190_EncoderContext::Init()
+ {
+-  if (!H263_Base_EncoderContext::Init(CODEC_ID_H263))
++  if (!H263_Base_EncoderContext::Init(AV_CODEC_ID_H263))
+     return false;
+ 
+ #if LIBAVCODEC_RTP_MODE
+@@ -632,7 +632,7 @@ H263_RFC2429_EncoderContext::~H263_RFC24
+ 
+ bool H263_RFC2429_EncoderContext::Init()
+ {
+-  return H263_Base_EncoderContext::Init(CODEC_ID_H263P);
++  return H263_Base_EncoderContext::Init(AV_CODEC_ID_H263P);
+ }
+ 
+ 
+@@ -656,7 +656,7 @@ H263_Base_DecoderContext::H263_Base_Deco
+   if (!FFMPEGLibraryInstance.Load())
+     return;
+ 
+-  if ((m_codec = FFMPEGLibraryInstance.AvcodecFindDecoder(CODEC_ID_H263)) == NULL) {
++  if ((m_codec = FFMPEGLibraryInstance.AvcodecFindDecoder(AV_CODEC_ID_H263)) == NULL) {
+     PTRACE(1, m_prefix, "Codec not found for decoder");
+     return;
+   }
+--- a/plugins/video/H.264/h264-x264.cxx
++++ b/plugins/video/H.264/h264-x264.cxx
+@@ -105,7 +105,7 @@ static struct PluginCodec_information Li
+ 
+ ///////////////////////////////////////////////////////////////////////////////
+ 
+-FFMPEGLibrary FFMPEGLibraryInstance(CODEC_ID_H264);
++FFMPEGLibrary FFMPEGLibraryInstance(AV_CODEC_ID_H264);
+ 
+ PLUGINCODEC_CONTROL_LOG_FUNCTION_DEF
+ 
+@@ -1065,17 +1065,17 @@ class MyDecoder : public PluginCodec<MY_
+          allows you to fail the create operation (return false), which cannot
+          be done in the normal C++ constructor. */
+ 
+-      if ((m_codec = FFMPEGLibraryInstance.AvcodecFindDecoder(CODEC_ID_H264)) == NULL)
++      if ((m_codec = FFMPEGLibraryInstance.AvcodecFindDecoder(AV_CODEC_ID_H264)) == NULL)
+         return false;
+ 
+       if ((m_context = FFMPEGLibraryInstance.AvcodecAllocContext(m_codec)) == NULL)
+         return false;
+ 
+       m_context->workaround_bugs = FF_BUG_AUTODETECT;
+-      m_context->idct_algo = FF_IDCT_H264;
++      m_context->idct_algo = FF_IDCT_AUTO;
+       m_context->error_concealment = FF_EC_GUESS_MVS | FF_EC_DEBLOCK;
+       m_context->flags = CODEC_FLAG_INPUT_PRESERVED | CODEC_FLAG_EMU_EDGE;
+-      m_context->flags2 = CODEC_FLAG2_SKIP_RD |
++      m_context->flags2 = 
+ #ifdef CODEC_FLAG2_DROP_FRAME_TIMECODE
+                           CODEC_FLAG2_DROP_FRAME_TIMECODE |
+ #endif
+--- a/plugins/video/MPEG4-ffmpeg/mpeg4.cxx
++++ b/plugins/video/MPEG4-ffmpeg/mpeg4.cxx
+@@ -205,7 +205,7 @@ const static struct mpeg4_resolution {
+     { 0 }
+ };
+ 
+-FFMPEGLibrary FFMPEGLibraryInstance(CODEC_ID_MPEG4);
++FFMPEGLibrary FFMPEGLibraryInstance(AV_CODEC_ID_MPEG4);
+ 
+ 
+ static bool mpeg4IsIframe (BYTE * frameBuffer, unsigned int frameLen )
+@@ -688,7 +688,7 @@ void MPEG4EncoderContext::ResizeEncoding
+ 
+ bool MPEG4EncoderContext::OpenCodec()
+ {
+-  if((m_avcodec = FFMPEGLibraryInstance.AvcodecFindEncoder(CODEC_ID_MPEG4)) == NULL){
++  if((m_avcodec = FFMPEGLibraryInstance.AvcodecFindEncoder(AV_CODEC_ID_MPEG4)) == NULL){
+     PTRACE(1, "MPEG4", "Encoder not found");
+     return false;
+   }
+@@ -1390,7 +1390,7 @@ void MPEG4DecoderContext::ResizeDecoding
+ 
+ bool MPEG4DecoderContext::OpenCodec()
+ {
+-    if ((m_avcodec = FFMPEGLibraryInstance.AvcodecFindDecoder(CODEC_ID_MPEG4)) == NULL) {
++    if ((m_avcodec = FFMPEGLibraryInstance.AvcodecFindDecoder(AV_CODEC_ID_MPEG4)) == NULL) {
+         PTRACE(1, "MPEG4", "Decoder not found for encoder");
+         return false;
+     }
+--- a/plugins/video/H.263-1998/h263-1998.h
++++ b/plugins/video/H.263-1998/h263-1998.h
+@@ -115,7 +115,7 @@ class H263_Base_EncoderContext
+     virtual ~H263_Base_EncoderContext();
+ 
+     virtual bool Init() = 0;
+-    virtual bool Init(CodecID codecId);
++    virtual bool Init(AVCodecID codecId);
+ 
+     virtual bool SetOptions(const char * const * options);
+     virtual void SetOption(const char * option, const char * value);
+--- a/plugins/video/common/dyna.cxx
++++ b/plugins/video/common/dyna.cxx
+@@ -217,14 +217,14 @@ static void logCallbackFFMPEG(void * avc
+ #endif
+ 
+ 
+-FFMPEGLibrary::FFMPEGLibrary(CodecID codec)
++FFMPEGLibrary::FFMPEGLibrary(AVCodecID codec)
+ {
+   m_codec = codec;
+-  if (m_codec==CODEC_ID_H264)
++  if (m_codec==AV_CODEC_ID_H264)
+       snprintf( m_codecString, sizeof(m_codecString), "H264");
+-  if (m_codec==CODEC_ID_H263P)
++  if (m_codec==AV_CODEC_ID_H263P)
+       snprintf( m_codecString, sizeof(m_codecString), "H263+");
+-  if (m_codec==CODEC_ID_MPEG4)
++  if (m_codec==AV_CODEC_ID_MPEG4)
+       snprintf( m_codecString, sizeof(m_codecString), "MPEG4");
+   m_isLoadedOK = false;
+ }
+@@ -268,12 +268,12 @@ bool FFMPEGLibrary::Load()
+   return true;
+ }
+ 
+-AVCodec *FFMPEGLibrary::AvcodecFindEncoder(enum CodecID id)
++AVCodec *FFMPEGLibrary::AvcodecFindEncoder(enum AVCodecID id)
+ {
+   return avcodec_find_encoder(id);
+ }
+ 
+-AVCodec *FFMPEGLibrary::AvcodecFindDecoder(enum CodecID id)
++AVCodec *FFMPEGLibrary::AvcodecFindDecoder(enum AVCodecID id)
+ {
+   WaitAndSignal m(processLock);
+ 
+@@ -308,13 +308,18 @@ int FFMPEGLibrary::AvcodecClose(AVCodecC
+   return avcodec_close(ctx);
+ }
+ 
++#undef  FFMAX
++#define FFMAX(a,b) ((a) > (b) ? (a) : (b)) 
+ int FFMPEGLibrary::AvcodecEncodeVideo(AVCodecContext *ctx, BYTE *buf, int buf_size, const AVFrame *pict)
+ {
++  AVPacket pkt = { 0 };
++  int ret, got_output;
+   int res;
+ 
+-  res = avcodec_encode_video(ctx, buf, buf_size, pict);
++  ret = avcodec_encode_video2(ctx, &pkt, pict, &got_output);
+ 
+-  PTRACE(6, m_codecString, "DYNA\tEncoded into " << res << " bytes, max " << buf_size);
++  PTRACE(6, m_codecString, "DYNA\tEncoded into " << ret << " bytes, max " << buf_size);
++  memcpy(buf, pkt.data, FFMAX(pkt.size, buf_size));
+   return res;
+ }
+ 
+--- a/plugins/video/common/dyna.h
++++ b/plugins/video/common/dyna.h
+@@ -88,13 +88,13 @@ class DynaLink
+ class FFMPEGLibrary 
+ {
+   public:
+-    FFMPEGLibrary(CodecID codec);
++    FFMPEGLibrary(AVCodecID codec);
+     ~FFMPEGLibrary();
+ 
+     bool Load();
+ 
+-    AVCodec *AvcodecFindEncoder(enum CodecID id);
+-    AVCodec *AvcodecFindDecoder(enum CodecID id);
++    AVCodec *AvcodecFindEncoder(enum AVCodecID id);
++    AVCodec *AvcodecFindDecoder(enum AVCodecID id);
+     AVCodecContext *AvcodecAllocContext(AVCodec*);
+     AVFrame *AvcodecAllocFrame(void);
+     int AvcodecOpen(AVCodecContext *ctx, AVCodec *codec);
+@@ -117,7 +117,7 @@ class FFMPEGLibrary
+     DynaLink m_libAvcodec;
+     DynaLink m_libAvutil;
+ 
+-    CodecID m_codec;
++    AVCodecID m_codec;
+     char m_codecString[32];
+ 
+     bool m_isLoadedOK;
diff --git a/nixpkgs/pkgs/development/libraries/opal/libav9.patch b/nixpkgs/pkgs/development/libraries/opal/libav9.patch
new file mode 100644
index 000000000000..f91a8c033fe3
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/opal/libav9.patch
@@ -0,0 +1,543 @@
+Description: Backport changes for the libav 9 API
+ Also replace loading of libavcodec and libavutil via dlopen by linking against
+ it.
+Author: Sebastian Ramacher <sramacher@debian.org>
+Bug-Debian: http://bugs.debian.org/720824
+Last-Update: 2013-09-12
+
+--- a/plugins/video/H.263-1998/h263-1998.cxx
++++ b/plugins/video/H.263-1998/h263-1998.cxx
+@@ -216,7 +216,7 @@
+     return false;
+   }
+ 
+-  m_context = FFMPEGLibraryInstance.AvcodecAllocContext();
++  m_context = FFMPEGLibraryInstance.AvcodecAllocContext(m_codec);
+   if (m_context == NULL) {
+     PTRACE(1, m_prefix, "Failed to allocate context for encoder");
+     return false;
+@@ -312,6 +312,7 @@
+     return;
+   }
+ 
++#ifdef CODEC_FLAG_H263P_UMV
+   if (STRCMPI(option, H263_ANNEX_D) == 0) {
+     // Annex D: Unrestructed Motion Vectors
+     // Level 2+ 
+@@ -322,6 +323,7 @@
+       m_context->flags &= ~CODEC_FLAG_H263P_UMV; 
+     return;
+   }
++#endif
+ 
+ #if 0 // DO NOT ENABLE THIS FLAG. FFMPEG IS NOT THREAD_SAFE WHEN THIS FLAG IS SET
+   if (STRCMPI(option, H263_ANNEX_F) == 0) {
+@@ -356,6 +358,7 @@
+     return;
+   }
+ 
++#ifdef CODEC_FLAG_H263P_SLICE_STRUCT
+   if (STRCMPI(option, H263_ANNEX_K) == 0) {
+     // Annex K: Slice Structure
+     // does not work with eyeBeam
+@@ -365,7 +368,9 @@
+       m_context->flags &= ~CODEC_FLAG_H263P_SLICE_STRUCT; 
+     return;
+   }
++#endif
+ 
++#ifdef CODEC_FLAG_H263P_AIV
+   if (STRCMPI(option, H263_ANNEX_S) == 0) {
+     // Annex S: Alternative INTER VLC mode
+     // does not work with eyeBeam
+@@ -375,6 +380,7 @@
+       m_context->flags &= ~CODEC_FLAG_H263P_AIV; 
+     return;
+   }
++#endif
+ 
+   if (STRCMPI(option, PLUGINCODEC_MEDIA_PACKETIZATION) == 0 ||
+       STRCMPI(option, PLUGINCODEC_MEDIA_PACKETIZATIONS) == 0) {
+@@ -450,15 +456,6 @@
+   PTRACE(5, m_prefix, "qmax set to " << m_context->qmax);
+   PTRACE(5, m_prefix, "payload size set to " << m_context->rtp_payload_size);
+ 
+-  #define CODEC_TRACER_FLAG(tracer, flag) \
+-    PTRACE(4, m_prefix, #flag " is " << ((m_context->flags & flag) ? "enabled" : "disabled"));
+-  CODEC_TRACER_FLAG(tracer, CODEC_FLAG_H263P_UMV);
+-  CODEC_TRACER_FLAG(tracer, CODEC_FLAG_OBMC);
+-  CODEC_TRACER_FLAG(tracer, CODEC_FLAG_AC_PRED);
+-  CODEC_TRACER_FLAG(tracer, CODEC_FLAG_H263P_SLICE_STRUCT)
+-  CODEC_TRACER_FLAG(tracer, CODEC_FLAG_LOOP_FILTER);
+-  CODEC_TRACER_FLAG(tracer, CODEC_FLAG_H263P_AIV);
+-
+   return FFMPEGLibraryInstance.AvcodecOpen(m_context, m_codec) == 0;
+ }
+ 
+@@ -521,7 +518,7 @@
+ 
+     // Need to copy to local buffer to guarantee 16 byte alignment
+     memcpy(m_inputFrame->data[0], OPAL_VIDEO_FRAME_DATA_PTR(header), header->width*header->height*3/2);
+-    m_inputFrame->pict_type = (flags & PluginCodec_CoderForceIFrame) ? FF_I_TYPE : AV_PICTURE_TYPE_NONE;
++    m_inputFrame->pict_type = (flags & PluginCodec_CoderForceIFrame) ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_NONE;
+ 
+     /*
+     m_inputFrame->pts = (int64_t)srcRTP.GetTimestamp()*m_context->time_base.den/m_context->time_base.num/VIDEO_CLOCKRATE;
+@@ -603,13 +600,19 @@
+   m_context->rtp_callback = &H263_RFC2190_EncoderContext::RTPCallBack;
+   m_context->opaque = this; // used to separate out packets from different encode threads
+ 
++#ifdef CODEC_FLAG_H263P_UMV
+   m_context->flags &= ~CODEC_FLAG_H263P_UMV;
++#endif
+   m_context->flags &= ~CODEC_FLAG_4MV;
+ #if LIBAVCODEC_RTP_MODE
+   m_context->flags &= ~CODEC_FLAG_H263P_AIC;
+ #endif
++#ifdef CODEC_FLAG_H263P_AIV
+   m_context->flags &= ~CODEC_FLAG_H263P_AIV;
++#endif
++#ifdef CODEC_FLAG_H263P_SLICE_STRUCT
+   m_context->flags &= ~CODEC_FLAG_H263P_SLICE_STRUCT;
++#endif
+ 
+   return true;
+ }
+@@ -658,7 +661,7 @@
+     return;
+   }
+ 
+-  m_context = FFMPEGLibraryInstance.AvcodecAllocContext();
++  m_context = FFMPEGLibraryInstance.AvcodecAllocContext(m_codec);
+   if (m_context == NULL) {
+     PTRACE(1, m_prefix, "Failed to allocate context for decoder");
+     return;
+--- a/plugins/video/H.264/h264-x264.cxx
++++ b/plugins/video/H.264/h264-x264.cxx
+@@ -48,6 +48,7 @@
+ #include "shared/h264frame.h"
+ #include "shared/x264wrap.h"
+ 
++#include <cstdio>
+ 
+ #define MY_CODEC      x264                                  // Name of codec (use C variable characters)
+ #define MY_CODEC_LOG "x264"
+@@ -1067,18 +1068,17 @@
+       if ((m_codec = FFMPEGLibraryInstance.AvcodecFindDecoder(CODEC_ID_H264)) == NULL)
+         return false;
+ 
+-      if ((m_context = FFMPEGLibraryInstance.AvcodecAllocContext()) == NULL)
++      if ((m_context = FFMPEGLibraryInstance.AvcodecAllocContext(m_codec)) == NULL)
+         return false;
+ 
+       m_context->workaround_bugs = FF_BUG_AUTODETECT;
+-      m_context->error_recognition = FF_ER_AGGRESSIVE;
+       m_context->idct_algo = FF_IDCT_H264;
+       m_context->error_concealment = FF_EC_GUESS_MVS | FF_EC_DEBLOCK;
+       m_context->flags = CODEC_FLAG_INPUT_PRESERVED | CODEC_FLAG_EMU_EDGE;
+-      m_context->flags2 = CODEC_FLAG2_BRDO |
+-                          CODEC_FLAG2_MEMC_ONLY |
++      m_context->flags2 = CODEC_FLAG2_SKIP_RD |
++#ifdef CODEC_FLAG2_DROP_FRAME_TIMECODE
+                           CODEC_FLAG2_DROP_FRAME_TIMECODE |
+-                          CODEC_FLAG2_SKIP_RD |
++#endif
+                           CODEC_FLAG2_CHUNKS;
+ 
+       if ((m_picture = FFMPEGLibraryInstance.AvcodecAllocFrame()) == NULL)
+--- a/plugins/video/MPEG4-ffmpeg/mpeg4.cxx
++++ b/plugins/video/MPEG4-ffmpeg/mpeg4.cxx
+@@ -589,17 +589,14 @@
+     m_avpicture->quality = m_videoQMin;
+ 
+ #ifdef USE_ORIG
+-    m_avcontext->flags |= CODEC_FLAG_PART;   // data partitioning
+     m_avcontext->flags |= CODEC_FLAG_4MV;    // 4 motion vectors
+ #else
+     m_avcontext->max_b_frames=0; /*don't use b frames*/
+     m_avcontext->flags|=CODEC_FLAG_AC_PRED;
+-    m_avcontext->flags|=CODEC_FLAG_H263P_UMV;
+     /*c->flags|=CODEC_FLAG_QPEL;*/ /*don't enable this one: this forces profile_level to advanced simple profile */
+     m_avcontext->flags|=CODEC_FLAG_4MV;
+     m_avcontext->flags|=CODEC_FLAG_GMC;
+     m_avcontext->flags|=CODEC_FLAG_LOOP_FILTER;
+-    m_avcontext->flags|=CODEC_FLAG_H263P_SLICE_STRUCT;
+ #endif
+     m_avcontext->opaque = this;              // for use in RTP callback
+ }
+@@ -691,7 +688,12 @@
+ 
+ bool MPEG4EncoderContext::OpenCodec()
+ {
+-  m_avcontext = FFMPEGLibraryInstance.AvcodecAllocContext();
++  if((m_avcodec = FFMPEGLibraryInstance.AvcodecFindEncoder(CODEC_ID_MPEG4)) == NULL){
++    PTRACE(1, "MPEG4", "Encoder not found");
++    return false;
++  }
++
++  m_avcontext = FFMPEGLibraryInstance.AvcodecAllocContext(m_avcodec);
+   if (m_avcontext == NULL) {
+     PTRACE(1, "MPEG4", "Encoder failed to allocate context for encoder");
+     return false;
+@@ -703,11 +705,6 @@
+     return false;
+   }
+ 
+-  if((m_avcodec = FFMPEGLibraryInstance.AvcodecFindEncoder(CODEC_ID_MPEG4)) == NULL){
+-    PTRACE(1, "MPEG4", "Encoder not found");
+-    return false;
+-  }
+-
+ #if PLUGINCODEC_TRACING
+   // debugging flags
+   if (PTRACE_CHECK(4)) {
+@@ -804,7 +801,7 @@
+         // Should the next frame be an I-Frame?
+         if ((flags & PluginCodec_CoderForceIFrame) || (m_frameNum == 0))
+         {
+-            m_avpicture->pict_type = FF_I_TYPE;
++            m_avpicture->pict_type = AV_PICTURE_TYPE_I;
+         }
+         else // No IFrame requested, let avcodec decide what to do
+         {
+@@ -1325,7 +1322,6 @@
+ 
+ void MPEG4DecoderContext::SetStaticDecodingParams() {
+     m_avcontext->flags |= CODEC_FLAG_4MV; 
+-    m_avcontext->flags |= CODEC_FLAG_PART;
+     m_avcontext->workaround_bugs = 0; // no workaround for buggy implementations
+ }
+ 
+@@ -1399,7 +1395,7 @@
+         return false;
+     }
+         
+-    m_avcontext = FFMPEGLibraryInstance.AvcodecAllocContext();
++    m_avcontext = FFMPEGLibraryInstance.AvcodecAllocContext(m_avcodec);
+     if (m_avcontext == NULL) {
+         PTRACE(1, "MPEG4", "Decoder failed to allocate context");
+         return false;
+--- a/plugins/video/common/dyna.cxx
++++ b/plugins/video/common/dyna.cxx
+@@ -38,6 +38,13 @@
+  *                 Matthias Schneider (ma30002000@yahoo.de)
+  */
+ #include "dyna.h"
++#include <cstdio>
++#include <cstdarg>
++
++extern "C" {
++#include <libavcodec/avcodec.h>
++#include <libavutil/mem.h>
++}
+ 
+ bool DynaLink::Open(const char *name)
+ {
+@@ -228,101 +235,15 @@
+   m_libAvutil.Close();
+ }
+ 
+-#define CHECK_AVUTIL(name, func) \
+-      (seperateLibAvutil ? \
+-        m_libAvutil.GetFunction(name,  (DynaLink::Function &)func) : \
+-        m_libAvcodec.GetFunction(name, (DynaLink::Function &)func) \
+-       ) \
+-
+-
+ bool FFMPEGLibrary::Load()
+ {
+   WaitAndSignal m(processLock);
+   if (IsLoaded())
+     return true;
+ 
+-  bool seperateLibAvutil = false;
+-
+-#ifdef LIBAVCODEC_LIB_NAME
+-  if (m_libAvcodec.Open(LIBAVCODEC_LIB_NAME))
+-    seperateLibAvutil = true;
+-  else
+-#endif
+-  if (m_libAvcodec.Open("libavcodec"))
+-    seperateLibAvutil = false;
+-  else if (m_libAvcodec.Open("avcodec-" AV_STRINGIFY(LIBAVCODEC_VERSION_MAJOR)))
+-    seperateLibAvutil = true;
+-  else {
+-    PTRACE(1, m_codecString, "Failed to load FFMPEG libavcodec library");
+-    return false;
+-  }
+-
+-  if (seperateLibAvutil &&
+-        !(
+-#ifdef LIBAVUTIL_LIB_NAME
+-          m_libAvutil.Open(LIBAVUTIL_LIB_NAME) ||
+-#endif
+-          m_libAvutil.Open("libavutil") ||
+-          m_libAvutil.Open("avutil-" AV_STRINGIFY(LIBAVUTIL_VERSION_MAJOR))
+-        ) ) {
+-    PTRACE(1, m_codecString, "Failed to load FFMPEG libavutil library");
+-    return false;
+-  }
+-
+-  strcpy(m_libAvcodec.m_codecString, m_codecString);
+-  strcpy(m_libAvutil.m_codecString,  m_codecString);
+-
+-  if (!m_libAvcodec.GetFunction("avcodec_init", (DynaLink::Function &)Favcodec_init))
+-    return false;
+-
+-  if (!m_libAvcodec.GetFunction("av_init_packet", (DynaLink::Function &)Fav_init_packet))
+-    return false;
+-
+-  if (!m_libAvcodec.GetFunction("avcodec_register_all", (DynaLink::Function &)Favcodec_register_all))
+-    return false;
+-
+-  if (!m_libAvcodec.GetFunction("avcodec_find_encoder", (DynaLink::Function &)Favcodec_find_encoder))
+-    return false;
+-
+-  if (!m_libAvcodec.GetFunction("avcodec_find_decoder", (DynaLink::Function &)Favcodec_find_decoder))
+-    return false;
+-
+-  if (!m_libAvcodec.GetFunction("avcodec_alloc_context", (DynaLink::Function &)Favcodec_alloc_context))
+-    return false;
+-
+-  if (!m_libAvcodec.GetFunction("avcodec_alloc_frame", (DynaLink::Function &)Favcodec_alloc_frame))
+-    return false;
+-
+-  if (!m_libAvcodec.GetFunction("avcodec_open", (DynaLink::Function &)Favcodec_open))
+-    return false;
+-
+-  if (!m_libAvcodec.GetFunction("avcodec_close", (DynaLink::Function &)Favcodec_close))
+-    return false;
+-
+-  if (!m_libAvcodec.GetFunction("avcodec_encode_video", (DynaLink::Function &)Favcodec_encode_video))
+-    return false;
+-
+-  if (!m_libAvcodec.GetFunction("avcodec_decode_video2", (DynaLink::Function &)Favcodec_decode_video))
+-    return false;
+-
+-  if (!m_libAvcodec.GetFunction("avcodec_set_dimensions", (DynaLink::Function &)Favcodec_set_dimensions))
+-    return false;
+-
+-  if (!CHECK_AVUTIL("av_free", Favcodec_free))
+-    return false;
+-
+-  if(!m_libAvcodec.GetFunction("avcodec_version", (DynaLink::Function &)Favcodec_version))
+-    return false;
+-
+-  if (!CHECK_AVUTIL("av_log_set_level", FAv_log_set_level))
+-    return false;
+-
+-  if (!CHECK_AVUTIL("av_log_set_callback", FAv_log_set_callback))
+-    return false;
+-
+   // must be called before using avcodec lib
+ 
+-  unsigned libVer = Favcodec_version();
++  unsigned libVer = avcodec_version();
+   if (libVer != LIBAVCODEC_VERSION_INT) {
+     PTRACE(2, m_codecString, "Warning: compiled against libavcodec headers from version "
+            << LIBAVCODEC_VERSION_MAJOR << '.' << LIBAVCODEC_VERSION_MINOR << '.' << LIBAVCODEC_VERSION_MICRO
+@@ -334,8 +255,7 @@
+            << (libVer >> 16) << ((libVer>>8) & 0xff) << (libVer & 0xff));
+   }
+ 
+-  Favcodec_init();
+-  Favcodec_register_all ();
++  avcodec_register_all();
+ 
+ #if PLUGINCODEC_TRACING
+   AvLogSetLevel(AV_LOG_DEBUG);
+@@ -350,49 +270,49 @@
+ 
+ AVCodec *FFMPEGLibrary::AvcodecFindEncoder(enum CodecID id)
+ {
+-  return Favcodec_find_encoder(id);
++  return avcodec_find_encoder(id);
+ }
+ 
+ AVCodec *FFMPEGLibrary::AvcodecFindDecoder(enum CodecID id)
+ {
+   WaitAndSignal m(processLock);
+ 
+-  return Favcodec_find_decoder(id);
++  return avcodec_find_decoder(id);
+ }
+ 
+-AVCodecContext *FFMPEGLibrary::AvcodecAllocContext(void)
++AVCodecContext *FFMPEGLibrary::AvcodecAllocContext(AVCodec *codec)
+ {
+   WaitAndSignal m(processLock);
+ 
+-  return Favcodec_alloc_context();
++  return avcodec_alloc_context3(codec);
+ }
+ 
+ AVFrame *FFMPEGLibrary::AvcodecAllocFrame(void)
+ {
+   WaitAndSignal m(processLock);
+ 
+-  return Favcodec_alloc_frame();
++  return avcodec_alloc_frame();
+ }
+ 
+ int FFMPEGLibrary::AvcodecOpen(AVCodecContext *ctx, AVCodec *codec)
+ {
+   WaitAndSignal m(processLock);
+ 
+-  return Favcodec_open(ctx, codec);
++  return avcodec_open2(ctx, codec, NULL);
+ }
+ 
+ int FFMPEGLibrary::AvcodecClose(AVCodecContext *ctx)
+ {
+   WaitAndSignal m(processLock);
+ 
+-  return Favcodec_close(ctx);
++  return avcodec_close(ctx);
+ }
+ 
+ int FFMPEGLibrary::AvcodecEncodeVideo(AVCodecContext *ctx, BYTE *buf, int buf_size, const AVFrame *pict)
+ {
+   int res;
+ 
+-  res = Favcodec_encode_video(ctx, buf, buf_size, pict);
++  res = avcodec_encode_video(ctx, buf, buf_size, pict);
+ 
+   PTRACE(6, m_codecString, "DYNA\tEncoded into " << res << " bytes, max " << buf_size);
+   return res;
+@@ -401,35 +321,35 @@
+ int FFMPEGLibrary::AvcodecDecodeVideo(AVCodecContext *ctx, AVFrame *pict, int *got_picture_ptr, BYTE *buf, int buf_size)
+ {
+   AVPacket avpkt;
+-  Fav_init_packet(&avpkt);
++  av_init_packet(&avpkt);
+   avpkt.data = buf;
+   avpkt.size = buf_size;
+ 
+-  return Favcodec_decode_video(ctx, pict, got_picture_ptr, &avpkt);
++  return avcodec_decode_video2(ctx, pict, got_picture_ptr, &avpkt);
+ }
+ 
+ void FFMPEGLibrary::AvcodecFree(void * ptr)
+ {
+   WaitAndSignal m(processLock);
+ 
+-  Favcodec_free(ptr);
++  av_free(ptr);
+ }
+ 
+ void FFMPEGLibrary::AvSetDimensions(AVCodecContext *s, int width, int height)
+ {
+   WaitAndSignal m(processLock);
+ 
+-  Favcodec_set_dimensions(s, width, height);
++  avcodec_set_dimensions(s, width, height);
+ }
+ 
+ void FFMPEGLibrary::AvLogSetLevel(int level)
+ {
+-  FAv_log_set_level(level);
++  av_log_set_level(level);
+ }
+ 
+ void FFMPEGLibrary::AvLogSetCallback(void (*callback)(void*, int, const char*, va_list))
+ {
+-  FAv_log_set_callback(callback);
++  av_log_set_callback(callback);
+ }
+ 
+ bool FFMPEGLibrary::IsLoaded()
+--- a/plugins/video/common/dyna.h
++++ b/plugins/video/common/dyna.h
+@@ -95,7 +95,7 @@
+ 
+     AVCodec *AvcodecFindEncoder(enum CodecID id);
+     AVCodec *AvcodecFindDecoder(enum CodecID id);
+-    AVCodecContext *AvcodecAllocContext(void);
++    AVCodecContext *AvcodecAllocContext(AVCodec*);
+     AVFrame *AvcodecAllocFrame(void);
+     int AvcodecOpen(AVCodecContext *ctx, AVCodec *codec);
+     int AvcodecClose(AVCodecContext *ctx);
+@@ -120,26 +120,6 @@
+     CodecID m_codec;
+     char m_codecString[32];
+ 
+-    void (*Favcodec_init)(void);
+-    void (*Fav_init_packet)(AVPacket *pkt);
+-
+-    void (*Favcodec_register_all)(void);
+-    AVCodec *(*Favcodec_find_encoder)(enum CodecID id);
+-    AVCodec *(*Favcodec_find_decoder)(enum CodecID id);
+-    AVCodecContext *(*Favcodec_alloc_context)(void);
+-    AVFrame *(*Favcodec_alloc_frame)(void);
+-    int (*Favcodec_open)(AVCodecContext *ctx, AVCodec *codec);
+-    int (*Favcodec_close)(AVCodecContext *ctx);
+-    int (*Favcodec_encode_video)(AVCodecContext *ctx, BYTE *buf, int buf_size, const AVFrame *pict);
+-    int (*Favcodec_decode_video)(AVCodecContext *ctx, AVFrame *pict, int *got_picture_ptr, AVPacket *avpkt);
+-    unsigned (*Favcodec_version)(void);
+-    void (*Favcodec_set_dimensions)(AVCodecContext *ctx, int width, int height);
+-
+-    void (*Favcodec_free)(void *);
+-
+-    void (*FAv_log_set_level)(int level);
+-    void (*FAv_log_set_callback)(void (*callback)(void*, int, const char*, va_list));
+-
+     bool m_isLoadedOK;
+ };
+ 
+--- a/plugins/video/common/ffmpeg.h
++++ b/plugins/video/common/ffmpeg.h
+@@ -45,11 +45,13 @@
+ 
+ #include "platform.h"
+ 
+-#include "libavcodec/avcodec.h"
++extern "C" {
++#include <libavcodec/avcodec.h>
+ // AVPacket was declared in avformat.h before April 2009
+ #if LIBAVCODEC_VERSION_INT <= AV_VERSION_INT(52, 25, 0)
+-#include "libavformat/avformat.h"
++#include <libavformat/avformat.h>
+ #endif
++}
+ 
+ #ifndef LIBAVCODEC_VERSION_INT
+ #error Libavcodec include is not correct
+--- a/plugins/video/H.263-1998/Makefile.in
++++ b/plugins/video/H.263-1998/Makefile.in
+@@ -34,8 +34,8 @@
+              $(COMMONDIR)/mpi.cxx \
+              $(COMMONDIR)/dyna.cxx
+ 
+-CFLAGS += @LIBAVCODEC_CFLAGS@ -I$(COMMONDIR)
+-LIBS   += @DL_LIBS@
++CFLAGS += @LIBAVCODEC_CFLAGS@ @LIBAVUTIL_CFLAGS@ -I$(COMMONDIR)
++LIBS   += @DL_LIBS@ @LIBAVCODEC_LIBS@ @LIBAVUTIL_LIBS@
+ 
+ HAVE_LIBAVCODEC_RTP_MODE=@HAVE_LIBAVCODEC_RTP_MODE@
+ ifeq ($(HAVE_LIBAVCODEC_RTP_MODE),yes)
+--- a/plugins/video/H.264/Makefile.in
++++ b/plugins/video/H.264/Makefile.in
+@@ -34,8 +34,8 @@
+            $(SHAREDDIR)/x264wrap.cxx \
+            $(COMMONDIR)/dyna.cxx \
+ 
+-CFLAGS += @LIBAVCODEC_CFLAGS@ -I$(COMMONDIR) -DLIB_DIR='"$(libdir)"' -DVC_PLUGIN_DIR='"@VC_PLUGIN_DIR@"'
+-LIBS   += @DL_LIBS@
++CFLAGS += @LIBAVCODEC_CFLAGS@ @LIBAVUTIL_CFLAGS@ -I$(COMMONDIR) -DLIB_DIR='"$(libdir)"' -DVC_PLUGIN_DIR='"@VC_PLUGIN_DIR@"'
++LIBS   += @DL_LIBS@ @LIBAVCODEC_LIBS@ @LIBAVUTIL_LIBS@
+ 
+ IS_H264_LICENSED:=@IS_H264_LICENSED@
+ ifeq ($(IS_H264_LICENSED),yes)
+--- a/plugins/video/MPEG4-ffmpeg/Makefile.in
++++ b/plugins/video/MPEG4-ffmpeg/Makefile.in
+@@ -30,8 +30,8 @@
+ SRCDIR    := .
+ SRCS      := mpeg4.cxx $(COMMONDIR)/dyna.cxx
+ 
+-CFLAGS += @LIBAVCODEC_CFLAGS@ -I$(COMMONDIR)
+-LIBS   += @DL_LIBS@
++CFLAGS += @LIBAVCODEC_CFLAGS@ @LIBAVUTIL_CFLAGS@ -I$(COMMONDIR)
++LIBS   += @DL_LIBS@ @LIBAVCODEC_LIBS@ @LIBAVUTIL_LIBS@
+ 
+ # Add LIBAVCODEC_SOURCE_DIR to the include path so we can #include <libavcodec/...h>
+ # Also add libavutil, so ffmpeg headers can #include "log.h".
diff --git a/nixpkgs/pkgs/development/libraries/openal-soft/default.nix b/nixpkgs/pkgs/development/libraries/openal-soft/default.nix
new file mode 100644
index 000000000000..3c082926e06c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/openal-soft/default.nix
@@ -0,0 +1,41 @@
+{ stdenv, fetchFromGitHub, cmake
+, alsaSupport ? !stdenv.isDarwin, alsaLib ? null
+, pulseSupport ? !stdenv.isDarwin, libpulseaudio ? null
+, CoreServices, AudioUnit, AudioToolbox
+}:
+
+with stdenv.lib;
+
+assert alsaSupport -> alsaLib != null;
+assert pulseSupport -> libpulseaudio != null;
+
+stdenv.mkDerivation rec {
+  version = "1.19.1";
+  name = "openal-soft-${version}";
+
+  src = fetchFromGitHub {
+    owner = "kcat";
+    repo = "openal-soft";
+    rev = name;
+    sha256 = "0b0g0q1c36nfb289xcaaj3cmyfpiswvvgky3qyalsf9n4dj7vnzi";
+  };
+
+  nativeBuildInputs = [ cmake ];
+
+  buildInputs = []
+    ++ optional alsaSupport alsaLib
+    ++ optional pulseSupport libpulseaudio
+    ++ optionals stdenv.isDarwin [ CoreServices AudioUnit AudioToolbox ];
+
+  NIX_LDFLAGS = []
+    ++ optional alsaSupport "-lasound"
+    ++ optional pulseSupport "-lpulse";
+
+  meta = {
+    description = "OpenAL alternative";
+    homepage = https://kcat.strangesoft.net/openal.html;
+    license = licenses.lgpl2;
+    maintainers = with maintainers; [ftrvxmtrx];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/openbabel/default.nix b/nixpkgs/pkgs/development/libraries/openbabel/default.nix
new file mode 100644
index 000000000000..81754ffad4d2
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/openbabel/default.nix
@@ -0,0 +1,32 @@
+{stdenv, fetchurl, fetchpatch, cmake, zlib, libxml2, eigen, python, cairo, pcre, pkgconfig }:
+
+stdenv.mkDerivation rec {
+  name = "openbabel-${version}";
+  version = "2.4.1";
+
+  src = fetchurl {
+    url = "https://github.com/openbabel/openbabel/archive/openbabel-${stdenv.lib.replaceStrings ["."] ["-"] version}.tar.gz";
+    sha256 = "0xm7y859ivq2cp0q08mwshfxm0jq31xkyr4x8s0j6l7khf57yk2r";
+  };
+
+  patches = [
+    # ARM / AArch64 fixes.
+    (fetchpatch {
+      url = https://github.com/openbabel/openbabel/commit/ee11c98a655296550710db1207b294f00e168216.patch;
+      sha256 = "0wjqjrkr4pfirzzicdvlyr591vppydk572ix28jd2sagnfnf566g";
+    })
+  ];
+
+  # TODO : perl & python bindings;
+  # TODO : wxGTK: I have no time to compile
+  # TODO : separate lib and apps
+  buildInputs = [ zlib libxml2 eigen python cairo pcre ];
+
+  nativeBuildInputs = [ cmake pkgconfig ];
+
+  meta = {
+    platforms = stdenv.lib.platforms.all;
+    maintainers = [ ];
+    license = stdenv.lib.licenses.gpl2Plus;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/openbr/default.nix b/nixpkgs/pkgs/development/libraries/openbr/default.nix
new file mode 100644
index 000000000000..4d3e9e9a04eb
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/openbr/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchFromGitHub, cmake, opencv, qtbase, qtsvg }:
+
+stdenv.mkDerivation rec {
+
+  version = "0.5";
+  name = "openbr-${version}";
+
+  src = fetchFromGitHub {
+    owner = "biometrics";
+    repo = "openbr";
+    rev = "cc364a89a86698cd8d3052f42a3cb520c929b325";
+    sha256 = "12y00cf5dlzp9ciiwbihf6xhlkdxpydhscv5hwp83qjdllid9rrz";
+  };
+
+  buildInputs = [ opencv qtbase qtsvg ];
+
+  nativeBuildInputs = [ cmake ];
+
+  enableParallelBuilding = true;
+
+  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;
+    broken = true;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/openbsm/bsm-add-audit_token_to_pid.patch b/nixpkgs/pkgs/development/libraries/openbsm/bsm-add-audit_token_to_pid.patch
new file mode 100644
index 000000000000..77b9e1febddc
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/openbsm/bsm-add-audit_token_to_pid.patch
@@ -0,0 +1,24 @@
+Subject: Add audit_token_to_pid()
+
+Description: Apple provides audit_token_to_pid to get the pid of an
+audit token. Unfortunately, they have never released this to the
+OpenBSM project.
+
+diff -r -u -p1 a/bsm/libbsm.h b/bsm/libbsm.h
+--- a/bsm/libbsm.h	      2009-04-15 16:45:54.000000000 -0500
++++ b/bsm/libbsm.h	      2018-05-11 04:11:14.063083147 -0500
+@@ -1298,1 +1298,2 @@ int audit_set_stat(au_stat_t *stats, siz
+ int audit_send_trigger(int *trigger);
++pid_t audit_token_to_pid(audit_token_t atoken);
+
+diff -r -u -p1 a/libbsm/bsm_wrappers.c b/libbsm/bsm_wrappers.c
+--- a/libbsm/bsm_wrappers.c	       2009-04-15 16:46:06.000000000 -0500
++++ b/libbsm/bsm_wrappers.c	       2018-05-11 04:10:15.710820393 -0500
+@@ -823,1 +823,6 @@ audit_get_car(char *path, size_t sz)
+ }
++
++pid_t audit_token_to_pid(audit_token_t atoken)
++{
++	return atoken.val[5];
++}
+ 
\ No newline at end of file
diff --git a/nixpkgs/pkgs/development/libraries/openbsm/default.nix b/nixpkgs/pkgs/development/libraries/openbsm/default.nix
new file mode 100644
index 000000000000..136665425280
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/openbsm/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchFromGitHub, lib }:
+
+stdenv.mkDerivation rec {
+  pname = "openbsm";
+  name = "${pname}-${version}";
+  version = "1.1";
+
+  src = fetchFromGitHub {
+    owner = pname;
+    repo = pname;
+    rev = "${lib.toUpper (builtins.replaceStrings ["." "-"] ["_" "_"] name)}";
+    sha256 = "0b98359hd8mm585sh145ss828pg2y8vgz38lqrb7nypapiyqdnd1";
+  };
+
+  patches = lib.optional stdenv.isDarwin [ ./bsm-add-audit_token_to_pid.patch ];
+
+  meta = {
+    homepage = http://www.openbsm.org/;
+    platforms = lib.platforms.unix;
+    maintainers = with lib.maintainers; [ matthewbauer ];
+    license = lib.licenses.bsd2;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/opencascade-occt/default.nix b/nixpkgs/pkgs/development/libraries/opencascade-occt/default.nix
new file mode 100644
index 000000000000..2d1e0ffb2005
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/opencascade-occt/default.nix
@@ -0,0 +1,42 @@
+{ stdenv
+, fetchurl
+, cmake
+, tcl
+, tk
+, vtk
+, mesa_glu
+, libXext
+, libXmu
+, libXi
+, doxygen
+}:
+
+let version = "7.3.0p3";
+    commit = "V${builtins.replaceStrings ["."] ["_"] version}";
+
+in stdenv.mkDerivation {
+
+  name = "opencascade-occt-${version}";
+
+  src = fetchurl {
+    name = "occt-${commit}.tar.gz";
+    url = "https://git.dev.opencascade.org/gitweb/?p=occt.git;a=snapshot;h=${commit};sf=tgz";
+    sha256 = "0k9c3ypcnjcilq1dhsf6xxbd52gyq4h5rchvp30k3c8ph4ris5pz";
+  };
+
+  nativeBuildInputs = [ cmake ];
+  buildInputs = [ tcl tk vtk mesa_glu libXext libXmu libXi doxygen ];
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    description = "Open CASCADE Technology, libraries for 3D modeling and numerical simulation";
+    homepage = "https://www.opencascade.org/";
+    license = licenses.lgpl21;  # essentially...
+    # The special exception defined in the file OCCT_LGPL_EXCEPTION.txt
+    # are basically about making the license a little less share-alike.
+    maintainers = with maintainers; [ amiloradovsky ];
+    platforms = platforms.all;
+  };
+
+}
diff --git a/nixpkgs/pkgs/development/libraries/opencascade/default.nix b/nixpkgs/pkgs/development/libraries/opencascade/default.nix
new file mode 100644
index 000000000000..8334bf195f7b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/opencascade/default.nix
@@ -0,0 +1,51 @@
+{ stdenv, fetchFromGitHub, fetchpatch, libGL, libGLU, libXmu, cmake, ninja,
+  pkgconfig, fontconfig, freetype, expat, freeimage, vtk }:
+
+stdenv.mkDerivation rec {
+  pname = "opencascade-oce";
+  version = "0.18.3";
+
+  src = fetchFromGitHub {
+    owner = "tpaviot";
+    repo = "oce";
+    rev = "OCE-${version}";
+    sha256 = "17wy8dcf44vqisishv1jjf3cmcxyygqq29y9c3wjdj983qi2hsig";
+  };
+
+  nativeBuildInputs = [ cmake ninja pkgconfig ];
+  buildInputs = [ libGL libGLU libXmu freetype fontconfig expat freeimage vtk ];
+
+  cmakeFlags = [
+    "-DOCE_INSTALL_PREFIX=${placeholder "out"}"
+    "-DOCE_WITH_FREEIMAGE=ON"
+    "-DOCE_WITH_VTK=ON"
+  ];
+
+  patches = [
+    # Use fontconfig instead of hardcoded directory list
+    # https://github.com/tpaviot/oce/pull/714
+    (fetchpatch {
+      url = "https://github.com/tpaviot/oce/commit/9643432b27fec8974ca0ee15c3c372f5fe8fc069.patch";
+      sha256 = "1wd940rszmh5apcpk5fv6126h8mcjcy4rjifrql5d4ac90v06v4c";
+    })
+    # Fix for glibc 2.26
+    (fetchpatch {
+      url = "https://github.com/tpaviot/oce/commit/3b44656e93270d782009b06ec4be84d2a13f8126.patch";
+      sha256 = "1ccakkcwy5g0184m23x0mnh22i0lk45xm8kgiv5z3pl7nh35dh8k";
+    })
+  ];
+
+  postPatch = ''
+    # make sure the installed cmake file uses absolute paths for fontconfig
+    substituteInPlace adm/cmake/TKService/CMakeLists.txt \
+      --replace FONTCONFIG_LIBRARIES FONTCONFIG_LINK_LIBRARIES
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Open CASCADE Technology, libraries for 3D modeling and numerical simulation";
+    homepage = "https://github.com/tpaviot/oce";
+    maintainers = [ maintainers.viric ];
+    platforms = platforms.linux;
+    license = licenses.lgpl21;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/opencl-clhpp/default.nix b/nixpkgs/pkgs/development/libraries/opencl-clhpp/default.nix
new file mode 100644
index 000000000000..613aeddd77be
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/opencl-clhpp/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchFromGitHub, cmake, python, opencl-headers }:
+
+stdenv.mkDerivation rec {
+  name = "opencl-clhpp-${version}";
+  version = "2.0.10";
+
+  src = fetchFromGitHub {
+    owner = "KhronosGroup";
+    repo = "OpenCL-CLHPP";
+    rev = "v${version}";
+    sha256 = "0h5kpg5cl8wzfnqmv6i26aig2apv06ffm9p3rh35938n9r8rladm";
+  };
+
+  nativeBuildInputs = [ cmake python ];
+
+  propagatedBuildInputs = [ opencl-headers ];
+
+  preConfigure = ''
+    cmakeFlags="-DCMAKE_INSTALL_PREFIX=$out/include -DBUILD_EXAMPLES=OFF -DBUILD_TESTS=OFF"
+  '';
+
+  meta = with stdenv.lib; {
+    description = "OpenCL Host API C++ bindings";
+    homepage = http://github.khronos.org/OpenCL-CLHPP/;
+    license = licenses.mit;
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/opencl-headers/default.nix b/nixpkgs/pkgs/development/libraries/opencl-headers/default.nix
new file mode 100644
index 000000000000..9ce8bb618bf9
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/opencl-headers/default.nix
@@ -0,0 +1,26 @@
+{ stdenv, fetchFromGitHub
+, version # "12" for "1.2", "22" for "2.2" and so on
+}:
+
+stdenv.mkDerivation rec {
+  name = "opencl-headers-${version}-2017-07-18";
+
+  src = fetchFromGitHub {
+    owner = "KhronosGroup";
+    repo = "OpenCL-Headers";
+    rev = "f039db6764d52388658ef15c30b2237bbda49803";
+    sha256 = "0z04i330zr8czak2624q71aajdcq7ly8mb5bgala5m235qjpsrh7";
+  };
+
+  installPhase = ''
+    mkdir -p $out/include/CL
+    cp opencl${version}/CL/* $out/include/CL
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Khronos OpenCL headers version ${version}";
+    homepage = https://www.khronos.org/registry/cl/;
+    license = licenses.mit;
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/opencollada/default.nix b/nixpkgs/pkgs/development/libraries/opencollada/default.nix
new file mode 100644
index 000000000000..d3e1482feb4d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/opencollada/default.nix
@@ -0,0 +1,38 @@
+{ lib, stdenv, fetchFromGitHub, cmake, pkgconfig, libxml2, pcre
+, darwin}:
+
+stdenv.mkDerivation rec {
+  name = "opencollada-${version}";
+
+  version = "1.6.67";
+
+  src = fetchFromGitHub {
+    owner = "KhronosGroup";
+    repo = "OpenCOLLADA";
+    rev = "v${version}";
+    sha256 = "0x1h2ns0y05bdvn3i5s600jz6nb8qw8qqgg54njz7833bcy913mj";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ cmake ]
+    ++ lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [ AGL ]);
+
+  propagatedBuildInputs = [ libxml2 pcre ];
+
+  enableParallelBuilding = true;
+
+  patchPhase = ''
+    patch -p1 < ${./pcre.patch}
+  '' + lib.optionalString stdenv.isDarwin ''
+    substituteInPlace GeneratedSaxParser/src/GeneratedSaxParserUtils.cpp \
+      --replace math.h cmath
+  '';
+
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/opencollada/pcre.patch b/nixpkgs/pkgs/development/libraries/opencollada/pcre.patch
new file mode 100644
index 000000000000..39408f5a61e3
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/opencollada/pcre.patch
@@ -0,0 +1,14 @@
+diff --git a/COLLADABaseUtils/include/COLLADABUPcreCompiledPattern.h b/COLLADABaseUtils/include/COLLADABUPcreCompiledPattern.h
+index 22f2598b..269c50ca 100644
+--- a/COLLADABaseUtils/include/COLLADABUPcreCompiledPattern.h
++++ b/COLLADABaseUtils/include/COLLADABUPcreCompiledPattern.h
+@@ -13,8 +13,7 @@
+ 

+ #include "COLLADABUPrerequisites.h"

+ 

+-struct real_pcre;
+-typedef struct real_pcre pcre;
++#include "pcre.h"
+ 

+ 

+ namespace COLLADABU

diff --git a/nixpkgs/pkgs/development/libraries/opencolorio/default.nix b/nixpkgs/pkgs/development/libraries/opencolorio/default.nix
new file mode 100644
index 000000000000..3081c6c839c8
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/opencolorio/default.nix
@@ -0,0 +1,47 @@
+{ stdenv, lib, fetchFromGitHub, cmake, boost, pkgconfig, lcms2, tinyxml, git }:
+
+with lib;
+
+stdenv.mkDerivation rec {
+  name = "opencolorio-${version}";
+  version = "1.1.1";
+
+  src = fetchFromGitHub {
+    owner = "imageworks";
+    repo = "OpenColorIO";
+    rev = "v${version}";
+    sha256 = "12srvxca51czpfjl0gabpidj9n84mw78ivxy5w75qhq2mmc798sb";
+  };
+
+  outputs = [ "bin" "out" "dev" ];
+
+  # TODO: Investigate whether git can be dropped: It's only used to apply patches
+  nativeBuildInputs = [ cmake pkgconfig git ];
+
+  buildInputs = [ lcms2 tinyxml ] ++ optional stdenv.isDarwin boost;
+
+  postPatch = ''
+    substituteInPlace src/core/CMakeLists.txt --replace "-Werror" ""
+    substituteInPlace src/pyglue/CMakeLists.txt --replace "-Werror" ""
+  '';
+
+  cmakeFlags = [
+    "-DUSE_EXTERNAL_LCMS=ON"
+    "-DUSE_EXTERNAL_TINYXML=ON"
+    # External libyamlcpp 0.6.* not compatible: https://github.com/imageworks/OpenColorIO/issues/517
+    "-DUSE_EXTERNAL_YAML=OFF"
+  ] ++ optional stdenv.isDarwin "-DOCIO_USE_BOOST_PTR=ON"
+    ++ optional (!stdenv.hostPlatform.isi686 && !stdenv.hostPlatform.isx86_64) "-DOCIO_USE_SSE=OFF";
+
+  postInstall = ''
+    mkdir -p $bin/bin; mv $out/bin $bin/
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = http://opencolorio.org;
+    description = "A color management framework for visual effects and animation";
+    license = licenses.bsd3;
+    maintainers = [ maintainers.goibhniu ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/opencore-amr/default.nix b/nixpkgs/pkgs/development/libraries/opencore-amr/default.nix
new file mode 100644
index 000000000000..9a8787ad7f49
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/opencore-amr/default.nix
@@ -0,0 +1,20 @@
+{ stdenv, fetchurl }:
+
+let
+    version = "0.1.5";
+in 
+stdenv.mkDerivation {
+  name = "opencore-amr-${version}";
+  src = fetchurl {
+    url = "https://vorboss.dl.sourceforge.net/project/opencore-amr/opencore-amr/opencore-amr-${version}.tar.gz";
+    sha256 = "0hfk9khz3by0119h3jdwgdfd7jgkdbzxnmh1wssvylgnsnwnq01c";
+  };
+  
+  meta = {
+    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 ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/opencsg/default.nix b/nixpkgs/pkgs/development/libraries/opencsg/default.nix
new file mode 100644
index 000000000000..11c66f0d497b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/opencsg/default.nix
@@ -0,0 +1,52 @@
+{stdenv, fetchurl, libGLU_combined, freeglut, glew, libXmu, libXext, libX11
+, qmake, GLUT, fixDarwinDylibNames }:
+
+stdenv.mkDerivation rec {
+  version = "1.4.2";
+  name = "opencsg-${version}";
+  src = fetchurl {
+    url = "http://www.opencsg.org/OpenCSG-${version}.tar.gz";
+    sha256 = "1ysazynm759gnw1rdhn9xw9nixnzrlzrc462340a6iif79fyqlnr";
+  };
+
+  nativeBuildInputs = [ qmake ]
+    ++ stdenv.lib.optional stdenv.isDarwin fixDarwinDylibNames;
+
+  buildInputs = [ glew ]
+    ++ stdenv.lib.optionals stdenv.isLinux [ libGLU_combined freeglut libXmu libXext libX11 ]
+    ++ stdenv.lib.optional stdenv.isDarwin GLUT;
+
+  doCheck = false;
+
+  patches = [ ./fix-pro-files.patch ];
+
+  preConfigure = ''
+    rm example/Makefile src/Makefile
+    qmakeFlags="$qmakeFlags INSTALLDIR=$out"
+  '';
+
+  postInstall = ''
+    install -D license.txt "$out/share/doc/opencsg/license.txt"
+  '' + stdenv.lib.optionalString stdenv.isDarwin ''
+    mkdir -p $out/Applications
+    mv $out/bin/*.app $out/Applications
+    rmdir $out/bin || true
+  '';
+
+  postFixup = stdenv.lib.optionalString stdenv.isDarwin ''
+    app=$out/Applications/opencsgexample.app/Contents/MacOS/opencsgexample
+    install_name_tool -change \
+      $(otool -L $app | awk '/opencsg.+dylib/ { print $1 }') \
+      $(otool -D $out/lib/libopencsg.dylib | tail -n 1) \
+      $app
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Constructive Solid Geometry library";
+    homepage = http://www.opencsg.org/;
+    platforms = platforms.unix;
+    maintainers = [ maintainers.raskin ];
+    license = licenses.gpl2;
+  };
+}
+
diff --git a/nixpkgs/pkgs/development/libraries/opencsg/fix-pro-files.patch b/nixpkgs/pkgs/development/libraries/opencsg/fix-pro-files.patch
new file mode 100644
index 000000000000..462b44c8f40c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/opencsg/fix-pro-files.patch
@@ -0,0 +1,21 @@
+diff -ur OpenCSG-1.4.2-pristine/example/example.pro OpenCSG-1.4.2/example/example.pro
+--- OpenCSG-1.4.2-pristine/example/example.pro	2016-09-27 06:11:16.000000000 +0900
++++ OpenCSG-1.4.2/example/example.pro	2019-05-07 10:45:18.785251737 +0900
+@@ -6,7 +6,9 @@
+ INCLUDEPATH += ../include
+ LIBS += -L../lib -lopencsg -lGLEW
+ 
+-INSTALLDIR = /usr/local
++isEmpty(INSTALLDIR) {
++  INSTALLDIR = /usr/local
++}
+ INSTALLS += target
+ target.path = $$INSTALLDIR/bin
+ 
+diff -ur OpenCSG-1.4.2-pristine/opencsg.pro OpenCSG-1.4.2/opencsg.pro
+--- OpenCSG-1.4.2-pristine/opencsg.pro	2016-09-27 06:11:16.000000000 +0900
++++ OpenCSG-1.4.2/opencsg.pro	2019-05-07 10:44:50.578698165 +0900
+@@ -1,2 +1,3 @@
+ TEMPLATE = subdirs
+ SUBDIRS  = src example
++CONFIG   += ordered
diff --git a/nixpkgs/pkgs/development/libraries/openct/default.nix b/nixpkgs/pkgs/development/libraries/openct/default.nix
new file mode 100644
index 000000000000..5ad7eecace1b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/openct/default.nix
@@ -0,0 +1,41 @@
+{ stdenv, fetchFromGitHub, autoreconfHook, pkgconfig, pcsclite, libusb
+, doxygen, libxslt
+}:
+
+stdenv.mkDerivation rec {
+  name = "openct-${version}";
+  version = "0.6.20";
+
+  src = fetchFromGitHub {
+    owner = "OpenSC";
+    repo = "openct";
+    rev = name;
+    sha256 = "09wxq0jxdxhci3zr7jd3zcxjkl3j0r1v00k3q8gqrg9gighh8nk2";
+  };
+
+  postPatch = ''
+    sed -i 's,$(DESTDIR),$(out),g' etc/Makefile.am
+  '';
+
+  configureFlags = [
+    "--enable-api-doc"
+    "--enable-usb"
+    "--enable-pcsc"
+    "--localstatedir=/var"
+    "--sysconfdir=/etc"
+  ];
+
+  nativeBuildInputs = [ autoreconfHook pkgconfig ];
+  buildInputs = [ pcsclite libusb doxygen libxslt ];
+
+  preInstall = ''
+    mkdir -p $out/etc
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = https://github.com/OpenSC/openct/;
+    license = licenses.lgpl21;
+    description = "Drivers for several smart card readers";
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/opencv/3.x.nix b/nixpkgs/pkgs/development/libraries/opencv/3.x.nix
new file mode 100644
index 000000000000..676666d7f472
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/opencv/3.x.nix
@@ -0,0 +1,278 @@
+{ lib, stdenv
+, fetchurl, fetchFromGitHub, fetchpatch
+, cmake, pkgconfig, unzip, zlib, pcre, hdf5
+, glog, boost, google-gflags, protobuf
+, config
+
+, enableJPEG      ? true, libjpeg
+, enablePNG       ? true, libpng
+, enableTIFF      ? true, libtiff
+, enableWebP      ? true, libwebp
+, enableEXR ?     !stdenv.isDarwin, openexr, ilmbase
+, enableJPEG2K    ? true, jasper
+, enableEigen     ? true, eigen
+, enableOpenblas  ? true, openblas
+, enableContrib   ? true
+
+, enableCuda      ? config.cudaSupport or false, cudatoolkit
+
+, enableUnfree    ? false
+, enableIpp       ? false
+, enablePython    ? false, pythonPackages
+, enableGtk2      ? false, gtk2
+, enableGtk3      ? false, gtk3
+, enableVtk       ? false, vtk
+, enableFfmpeg    ? false, ffmpeg
+, enableGStreamer ? false, gst_all_1
+, enableTesseract ? false, tesseract, leptonica
+, enableTbb       ? false, tbb
+, enableOvis      ? false, ogre
+, enableGPhoto2   ? false, libgphoto2
+, enableDC1394    ? false, libdc1394
+, enableDocs      ? false, doxygen, graphviz-nox
+
+, cf-private, AVFoundation, Cocoa, VideoDecodeAcceleration, bzip2
+}:
+
+let
+  version = "3.4.5";
+
+  src = fetchFromGitHub {
+    owner  = "opencv";
+    repo   = "opencv";
+    rev    = version;
+    sha256 = "0hz9316ys2qi0lx9dcbsk3mkn8cn08q12hc96p6zz2d4is6d5wsc";
+  };
+
+  contribSrc = fetchFromGitHub {
+    owner  = "opencv";
+    repo   = "opencv_contrib";
+    rev    = version;
+    sha256 = "1fw7qwgibiznqal2dg4alkw8hrrrpjc0jaicf2406604rjm2lx6h";
+  };
+
+  # Contrib must be built in order to enable Tesseract support:
+  buildContrib = enableContrib || enableTesseract;
+
+  useSystemProtobuf = ! stdenv.isDarwin;
+
+  # See opencv/3rdparty/ippicv/ippicv.cmake
+  ippicv = {
+    src = fetchFromGitHub {
+      owner  = "opencv";
+      repo   = "opencv_3rdparty";
+      rev    = "bdb7bb85f34a8cb0d35e40a81f58da431aa1557a";
+      sha256 = "1ys9mshfpm8iy8h4ml792gnqrq959dsrcv26axx14niivxyjbji8";
+    } + "/ippicv";
+    files = let name = platform : "ippicv_2017u3_${platform}_general_20180518.tgz"; in
+      if stdenv.hostPlatform.system == "x86_64-linux" then
+      { ${name "lnx_intel64"} = "b7cc351267db2d34b9efa1cd22ff0572"; }
+      else if stdenv.hostPlatform.system == "i686-linux" then
+      { ${name "lnx_ia32"}    = "ea72de74dae3c604eb6348395366e78e"; }
+      else if stdenv.hostPlatform.system == "x86_64-darwin" then
+      { ${name "mac_intel64"} = "3ae52b9be0fe73dd45bc5e9429cd3732"; }
+      else
+      throw "ICV is not available for this platform (or not yet supported by this package)";
+    dst = ".cache/ippicv";
+  };
+
+  # See opencv_contrib/modules/xfeatures2d/cmake/download_vgg.cmake
+  vgg = {
+    src = fetchFromGitHub {
+      owner  = "opencv";
+      repo   = "opencv_3rdparty";
+      rev    = "fccf7cd6a4b12079f73bbfb21745f9babcd4eb1d";
+      sha256 = "0r9fam8dplyqqsd3qgpnnfgf9l7lj44di19rxwbm8mxiw0rlcdvy";
+    };
+    files = {
+      "vgg_generated_48.i"  = "e8d0dcd54d1bcfdc29203d011a797179";
+      "vgg_generated_64.i"  = "7126a5d9a8884ebca5aea5d63d677225";
+      "vgg_generated_80.i"  = "7cd47228edec52b6d82f46511af325c5";
+      "vgg_generated_120.i" = "151805e03568c9f490a5e3a872777b75";
+    };
+    dst = ".cache/xfeatures2d/vgg";
+  };
+
+  # See opencv_contrib/modules/xfeatures2d/cmake/download_boostdesc.cmake
+  boostdesc = {
+    src = fetchFromGitHub {
+      owner  = "opencv";
+      repo   = "opencv_3rdparty";
+      rev    = "34e4206aef44d50e6bbcd0ab06354b52e7466d26";
+      sha256 = "13yig1xhvgghvxspxmdidss5lqiikpjr0ddm83jsi0k85j92sn62";
+    };
+    files = {
+      "boostdesc_bgm.i"          = "0ea90e7a8f3f7876d450e4149c97c74f";
+      "boostdesc_bgm_bi.i"       = "232c966b13651bd0e46a1497b0852191";
+      "boostdesc_bgm_hd.i"       = "324426a24fa56ad9c5b8e3e0b3e5303e";
+      "boostdesc_binboost_064.i" = "202e1b3e9fec871b04da31f7f016679f";
+      "boostdesc_binboost_128.i" = "98ea99d399965c03d555cef3ea502a0b";
+      "boostdesc_binboost_256.i" = "e6dcfa9f647779eb1ce446a8d759b6ea";
+      "boostdesc_lbgm.i"         = "0ae0675534aa318d9668f2a179c2a052";
+    };
+    dst = ".cache/xfeatures2d/boostdesc";
+  };
+
+  # See opencv_contrib/modules/face/CMakeLists.txt
+  face = {
+    src = fetchFromGitHub {
+      owner  = "opencv";
+      repo   = "opencv_3rdparty";
+      rev    = "8afa57abc8229d611c4937165d20e2a2d9fc5a12";
+      sha256 = "061lsvqdidq9xa2hwrcvwi9ixflr2c2lfpc8drr159g68zi8bp4v";
+    };
+    files = {
+      "face_landmark_model.dat" = "7505c44ca4eb54b4ab1e4777cb96ac05";
+    };
+    dst = ".cache/data";
+  };
+
+  # See opencv/cmake/OpenCVDownload.cmake
+  installExtraFiles = extra : with lib; ''
+    mkdir -p "${extra.dst}"
+  '' + concatStrings (mapAttrsToList (name : md5 : ''
+    ln -s "${extra.src}/${name}" "${extra.dst}/${md5}-${name}"
+  '') extra.files);
+
+  opencvFlag = name: enabled: "-DWITH_${name}=${printEnabled enabled}";
+
+  printEnabled = enabled : if enabled then "ON" else "OFF";
+in
+
+stdenv.mkDerivation rec {
+  name = "opencv-${version}";
+  inherit version src;
+
+  postUnpack = lib.optionalString buildContrib ''
+    cp --no-preserve=mode -r "${contribSrc}/modules" "$NIX_BUILD_TOP/opencv_contrib"
+  '';
+
+  # This prevents cmake from using libraries in impure paths (which
+  # causes build failure on non NixOS)
+  # Also, work around https://github.com/NixOS/nixpkgs/issues/26304 with
+  # what appears to be some stray headers in dnn/misc/tensorflow
+  # in contrib when generating the Python bindings:
+  postPatch = ''
+    sed -i '/Add these standard paths to the search paths for FIND_LIBRARY/,/^\s*$/{d}' CMakeLists.txt
+    sed -i -e 's|if len(decls) == 0:|if len(decls) == 0 or "opencv2/" not in hdr:|' ./modules/python/src2/gen2.py
+  '';
+
+  preConfigure =
+    lib.optionalString enableIpp (installExtraFiles ippicv) + (
+    lib.optionalString buildContrib ''
+      cmakeFlagsArray+=("-DOPENCV_EXTRA_MODULES_PATH=$NIX_BUILD_TOP/opencv_contrib")
+
+      ${installExtraFiles vgg}
+      ${installExtraFiles boostdesc}
+      ${installExtraFiles face}
+    '');
+
+  postConfigure = ''
+    [ -e modules/core/version_string.inc ]
+    echo '"(build info elided)"' > modules/core/version_string.inc
+  '';
+
+  buildInputs =
+       [ zlib pcre hdf5 glog boost google-gflags ]
+    ++ lib.optional useSystemProtobuf protobuf
+    ++ lib.optional enablePython pythonPackages.python
+    ++ lib.optional enableGtk2 gtk2
+    ++ lib.optional enableGtk3 gtk3
+    ++ lib.optional enableVtk vtk
+    ++ lib.optional enableJPEG libjpeg
+    ++ lib.optional enablePNG libpng
+    ++ lib.optional enableTIFF libtiff
+    ++ lib.optional enableWebP libwebp
+    ++ lib.optionals enableEXR [ openexr ilmbase ]
+    ++ lib.optional enableJPEG2K jasper
+    ++ lib.optional enableFfmpeg ffmpeg
+    ++ lib.optionals (enableFfmpeg && stdenv.isDarwin)
+                     [ VideoDecodeAcceleration bzip2 ]
+    ++ lib.optionals enableGStreamer (with gst_all_1; [ gstreamer gst-plugins-base ])
+    ++ lib.optional enableOvis ogre
+    ++ lib.optional enableGPhoto2 libgphoto2
+    ++ lib.optional enableDC1394 libdc1394
+    ++ lib.optional enableEigen eigen
+    ++ lib.optional enableOpenblas openblas
+    # There is seemingly no compile-time flag for Tesseract.  It's
+    # simply enabled automatically if contrib is built, and it detects
+    # tesseract & leptonica.
+    ++ lib.optionals enableTesseract [ tesseract leptonica ]
+    ++ lib.optional enableTbb tbb
+    ++ lib.optional enableCuda cudatoolkit
+    ++ lib.optionals stdenv.isDarwin [ cf-private AVFoundation Cocoa VideoDecodeAcceleration bzip2 ]
+    ++ lib.optionals enableDocs [ doxygen graphviz-nox ];
+
+  propagatedBuildInputs = lib.optional enablePython pythonPackages.numpy;
+
+  nativeBuildInputs = [ cmake pkgconfig unzip ];
+
+  NIX_CFLAGS_COMPILE = lib.optional enableEXR "-I${ilmbase.dev}/include/OpenEXR";
+
+  # Configure can't find the library without this.
+  OpenBLAS_HOME = lib.optionalString enableOpenblas openblas;
+
+  cmakeFlags = [
+    "-DWITH_OPENMP=ON"
+    "-DBUILD_PROTOBUF=${printEnabled (!useSystemProtobuf)}"
+    "-DPROTOBUF_UPDATE_FILES=${printEnabled useSystemProtobuf}"
+    "-DOPENCV_ENABLE_NONFREE=${printEnabled enableUnfree}"
+    "-DBUILD_TESTS=OFF"
+    "-DBUILD_PERF_TESTS=OFF"
+    "-DBUILD_DOCS=${printEnabled enableDocs}"
+    (opencvFlag "IPP" enableIpp)
+    (opencvFlag "TIFF" enableTIFF)
+    (opencvFlag "JASPER" enableJPEG2K)
+    (opencvFlag "WEBP" enableWebP)
+    (opencvFlag "JPEG" enableJPEG)
+    (opencvFlag "PNG" enablePNG)
+    (opencvFlag "OPENEXR" enableEXR)
+    (opencvFlag "CUDA" enableCuda)
+    (opencvFlag "CUBLAS" enableCuda)
+    (opencvFlag "TBB" enableTbb)
+  ] ++ lib.optionals enableCuda [
+    "-DCUDA_FAST_MATH=ON"
+    "-DCUDA_HOST_COMPILER=${cudatoolkit.cc}/bin/cc"
+    "-DCUDA_NVCC_FLAGS=--expt-relaxed-constexpr"
+  ] ++ lib.optionals stdenv.isDarwin [
+    "-DWITH_OPENCL=OFF"
+    "-DWITH_LAPACK=OFF"
+    "-DBUILD_opencv_videoio=OFF"
+  ] ++ lib.optionals enablePython [
+    "-DOPENCV_SKIP_PYTHON_LOADER=ON"
+  ];
+
+  enableParallelBuilding = true;
+
+  postBuild = lib.optionalString enableDocs ''
+    make doxygen
+  '';
+
+  # By default $out/lib/pkgconfig/opencv.pc looks something like this:
+  #
+  #   prefix=/nix/store/10pzq1a8fkh8q4sysj8n6mv0w0nl0miq-opencv-3.4.1
+  #   exec_prefix=${prefix}
+  #   libdir=${exec_prefix}//nix/store/10pzq1a8fkh8q4sysj8n6mv0w0nl0miq-opencv-3.4.1/lib
+  #   ...
+  #   Libs: -L${exec_prefix}//nix/store/10pzq1a8fkh8q4sysj8n6mv0w0nl0miq-opencv-3.4.1/lib ...
+  #
+  # Note that ${exec_prefix} is set to $out but that $out is also appended to
+  # ${exec_prefix}. This causes linker errors in downstream packages so we strip
+  # of $out after the ${exec_prefix} prefix:
+  postInstall = ''
+    sed -i "s|{exec_prefix}/$out|{exec_prefix}|" \
+      "$out/lib/pkgconfig/opencv.pc"
+  '';
+
+  hardeningDisable = [ "bindnow" "relro" ];
+
+  passthru = lib.optionalAttrs enablePython { pythonPath = []; };
+
+  meta = with stdenv.lib; {
+    description = "Open Computer Vision Library with more than 500 algorithms";
+    homepage = https://opencv.org/;
+    license = with licenses; if enableUnfree then unfree else bsd3;
+    maintainers = with maintainers; [mdaiter basvandijk];
+    platforms = with platforms; linux ++ darwin;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/opencv/4.x.nix b/nixpkgs/pkgs/development/libraries/opencv/4.x.nix
new file mode 100644
index 000000000000..a21cd6d079bf
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/opencv/4.x.nix
@@ -0,0 +1,293 @@
+{ lib, stdenv
+, fetchurl, fetchFromGitHub
+, cmake, pkgconfig, unzip, zlib, pcre, hdf5
+, glog, boost, google-gflags, protobuf
+, config
+
+, enableJPEG      ? true, libjpeg
+, enablePNG       ? true, libpng
+, enableTIFF      ? true, libtiff
+, enableWebP      ? true, libwebp
+, enableEXR ?     !stdenv.isDarwin, openexr, ilmbase
+, enableJPEG2K    ? true, jasper
+, enableEigen     ? true, eigen
+, enableOpenblas  ? true, openblas
+, enableContrib   ? true
+
+, enableCuda      ? config.cudaSupport or false, cudatoolkit
+
+, enableUnfree    ? false
+, enableIpp       ? false
+, enablePython    ? false, pythonPackages
+, enableGtk2      ? false, gtk2
+, enableGtk3      ? false, gtk3
+, enableVtk       ? false, vtk
+, enableFfmpeg    ? false, ffmpeg
+, enableGStreamer ? false, gst_all_1
+, enableTesseract ? false, tesseract, leptonica
+, enableTbb       ? false, tbb
+, enableOvis      ? false, ogre
+, enableGPhoto2   ? false, libgphoto2
+, enableDC1394    ? false, libdc1394
+, enableDocs      ? false, doxygen, graphviz-nox
+
+, cf-private, AVFoundation, Cocoa, VideoDecodeAcceleration, bzip2
+}:
+
+let
+  version = "4.0.1";
+
+  src = fetchFromGitHub {
+    owner  = "opencv";
+    repo   = "opencv";
+    rev    = version;
+    sha256 = "1f0n2a57sn47w55vaxlwhr3g6xgchvr3gxicxbkyzai3pvj55k48";
+  };
+
+  contribSrc = fetchFromGitHub {
+    owner  = "opencv";
+    repo   = "opencv_contrib";
+    rev    = version;
+    sha256 = "0svw8f6nvnzmrc0baj6priq4hbijla4kl6gzy8yif1jfvcwb1syy";
+  };
+
+  # Contrib must be built in order to enable Tesseract support:
+  buildContrib = enableContrib || enableTesseract || enableOvis;
+
+  # See opencv/3rdparty/ippicv/ippicv.cmake
+  ippicv = {
+    src = fetchFromGitHub {
+      owner  = "opencv";
+      repo   = "opencv_3rdparty";
+      rev    = "32e315a5b106a7b89dbed51c28f8120a48b368b4";
+      sha256 = "19w9f0r16072s59diqxsr5q6nmwyz9gnxjs49nglzhd66p3ddbkp";
+    } + "/ippicv";
+    files = let name = platform : "ippicv_2019_${platform}_general_20180723.tgz"; in
+      if stdenv.hostPlatform.system == "x86_64-linux" then
+      { ${name "lnx_intel64"} = "c0bd78adb4156bbf552c1dfe90599607"; }
+      else if stdenv.hostPlatform.system == "i686-linux" then
+      { ${name "lnx_ia32"}    = "4f38432c30bfd6423164b7a24bbc98a0"; }
+      else if stdenv.hostPlatform.system == "x86_64-darwin" then
+      { ${name "mac_intel64"} = "fe6b2bb75ae0e3f19ad3ae1a31dfa4a2"; }
+      else
+      throw "ICV is not available for this platform (or not yet supported by this package)";
+    dst = ".cache/ippicv";
+  };
+
+  # See opencv_contrib/modules/xfeatures2d/cmake/download_vgg.cmake
+  vgg = {
+    src = fetchFromGitHub {
+      owner  = "opencv";
+      repo   = "opencv_3rdparty";
+      rev    = "fccf7cd6a4b12079f73bbfb21745f9babcd4eb1d";
+      sha256 = "0r9fam8dplyqqsd3qgpnnfgf9l7lj44di19rxwbm8mxiw0rlcdvy";
+    };
+    files = {
+      "vgg_generated_48.i"  = "e8d0dcd54d1bcfdc29203d011a797179";
+      "vgg_generated_64.i"  = "7126a5d9a8884ebca5aea5d63d677225";
+      "vgg_generated_80.i"  = "7cd47228edec52b6d82f46511af325c5";
+      "vgg_generated_120.i" = "151805e03568c9f490a5e3a872777b75";
+    };
+    dst = ".cache/xfeatures2d/vgg";
+  };
+
+  # See opencv_contrib/modules/xfeatures2d/cmake/download_boostdesc.cmake
+  boostdesc = {
+    src = fetchFromGitHub {
+      owner  = "opencv";
+      repo   = "opencv_3rdparty";
+      rev    = "34e4206aef44d50e6bbcd0ab06354b52e7466d26";
+      sha256 = "13yig1xhvgghvxspxmdidss5lqiikpjr0ddm83jsi0k85j92sn62";
+    };
+    files = {
+      "boostdesc_bgm.i"          = "0ea90e7a8f3f7876d450e4149c97c74f";
+      "boostdesc_bgm_bi.i"       = "232c966b13651bd0e46a1497b0852191";
+      "boostdesc_bgm_hd.i"       = "324426a24fa56ad9c5b8e3e0b3e5303e";
+      "boostdesc_binboost_064.i" = "202e1b3e9fec871b04da31f7f016679f";
+      "boostdesc_binboost_128.i" = "98ea99d399965c03d555cef3ea502a0b";
+      "boostdesc_binboost_256.i" = "e6dcfa9f647779eb1ce446a8d759b6ea";
+      "boostdesc_lbgm.i"         = "0ae0675534aa318d9668f2a179c2a052";
+    };
+    dst = ".cache/xfeatures2d/boostdesc";
+  };
+
+  # See opencv_contrib/modules/face/CMakeLists.txt
+  face = {
+    src = fetchFromGitHub {
+      owner  = "opencv";
+      repo   = "opencv_3rdparty";
+      rev    = "8afa57abc8229d611c4937165d20e2a2d9fc5a12";
+      sha256 = "061lsvqdidq9xa2hwrcvwi9ixflr2c2lfpc8drr159g68zi8bp4v";
+    };
+    files = {
+      "face_landmark_model.dat" = "7505c44ca4eb54b4ab1e4777cb96ac05";
+    };
+    dst = ".cache/data";
+  };
+
+  # See opencv/modules/gapi/cmake/DownloadADE.cmake
+  ade = rec {
+    src = fetchurl {
+      url = "https://github.com/opencv/ade/archive/${name}";
+      sha256 = "1r85vdkvcka7bcxk69pd0ai4hld4iakpj4xl0xbinx3p9pv5a4l8";
+    };
+    name = "v0.1.1d.zip";
+    md5 = "37479d90e3a5d47f132f512b22cbe206";
+    dst = ".cache/ade";
+  };
+
+  # See opencv/cmake/OpenCVDownload.cmake
+  installExtraFiles = extra : with lib; ''
+    mkdir -p "${extra.dst}"
+  '' + concatStrings (flip mapAttrsToList extra.files (name : md5 : ''
+    ln -s "${extra.src}/${name}" "${extra.dst}/${md5}-${name}"
+  ''));
+  installExtraFile = extra: ''
+    mkdir -p "${extra.dst}"
+    ln -s "${extra.src}" "${extra.dst}/${extra.md5}-${extra.name}"
+  '';
+
+  opencvFlag = name: enabled: "-DWITH_${name}=${printEnabled enabled}";
+
+  printEnabled = enabled : if enabled then "ON" else "OFF";
+in
+
+stdenv.mkDerivation rec {
+  name = "opencv-${version}";
+  inherit version src;
+
+  postUnpack = lib.optionalString buildContrib ''
+    cp --no-preserve=mode -r "${contribSrc}/modules" "$NIX_BUILD_TOP/source/opencv_contrib"
+  '';
+
+  # This prevents cmake from using libraries in impure paths (which
+  # causes build failure on non NixOS)
+  # Also, work around https://github.com/NixOS/nixpkgs/issues/26304 with
+  # what appears to be some stray headers in dnn/misc/tensorflow
+  # in contrib when generating the Python bindings:
+  postPatch = ''
+    sed -i '/Add these standard paths to the search paths for FIND_LIBRARY/,/^\s*$/{d}' CMakeLists.txt
+    sed -i -e 's|if len(decls) == 0:|if len(decls) == 0 or "opencv2/" not in hdr:|' ./modules/python/src2/gen2.py
+  '';
+
+  preConfigure =
+    installExtraFile ade +
+    lib.optionalString enableIpp (installExtraFiles ippicv) + (
+    lib.optionalString buildContrib ''
+      cmakeFlagsArray+=("-DOPENCV_EXTRA_MODULES_PATH=$NIX_BUILD_TOP/source/opencv_contrib")
+
+      ${installExtraFiles vgg}
+      ${installExtraFiles boostdesc}
+      ${installExtraFiles face}
+    '');
+
+  postConfigure = ''
+    [ -e modules/core/version_string.inc ]
+    echo '"(build info elided)"' > modules/core/version_string.inc
+  '';
+
+  buildInputs =
+       [ zlib pcre hdf5 glog boost google-gflags protobuf ]
+    ++ lib.optional enablePython pythonPackages.python
+    ++ lib.optional enableGtk2 gtk2
+    ++ lib.optional enableGtk3 gtk3
+    ++ lib.optional enableVtk vtk
+    ++ lib.optional enableJPEG libjpeg
+    ++ lib.optional enablePNG libpng
+    ++ lib.optional enableTIFF libtiff
+    ++ lib.optional enableWebP libwebp
+    ++ lib.optionals enableEXR [ openexr ilmbase ]
+    ++ lib.optional enableJPEG2K jasper
+    ++ lib.optional enableFfmpeg ffmpeg
+    ++ lib.optionals (enableFfmpeg && stdenv.isDarwin)
+                     [ VideoDecodeAcceleration bzip2 ]
+    ++ lib.optionals enableGStreamer (with gst_all_1; [ gstreamer gst-plugins-base ])
+    ++ lib.optional enableOvis ogre
+    ++ lib.optional enableGPhoto2 libgphoto2
+    ++ lib.optional enableDC1394 libdc1394
+    ++ lib.optional enableEigen eigen
+    ++ lib.optional enableOpenblas openblas
+    # There is seemingly no compile-time flag for Tesseract.  It's
+    # simply enabled automatically if contrib is built, and it detects
+    # tesseract & leptonica.
+    ++ lib.optionals enableTesseract [ tesseract leptonica ]
+    ++ lib.optional enableTbb tbb
+    ++ lib.optional enableCuda cudatoolkit
+    ++ lib.optionals stdenv.isDarwin [ cf-private AVFoundation Cocoa VideoDecodeAcceleration bzip2 ]
+    ++ lib.optionals enableDocs [ doxygen graphviz-nox ];
+
+  propagatedBuildInputs = lib.optional enablePython pythonPackages.numpy;
+
+  nativeBuildInputs = [ cmake pkgconfig unzip ];
+
+  NIX_CFLAGS_COMPILE = lib.optional enableEXR "-I${ilmbase.dev}/include/OpenEXR";
+
+  # Configure can't find the library without this.
+  OpenBLAS_HOME = lib.optionalString enableOpenblas openblas;
+
+  cmakeFlags = [
+    "-DOPENCV_GENERATE_PKGCONFIG=ON"
+    "-DWITH_OPENMP=ON"
+    "-DBUILD_PROTOBUF=OFF"
+    "-DPROTOBUF_UPDATE_FILES=ON"
+    "-DOPENCV_ENABLE_NONFREE=${printEnabled enableUnfree}"
+    "-DBUILD_TESTS=OFF"
+    "-DBUILD_PERF_TESTS=OFF"
+    "-DBUILD_DOCS=${printEnabled enableDocs}"
+    (opencvFlag "IPP" enableIpp)
+    (opencvFlag "TIFF" enableTIFF)
+    (opencvFlag "JASPER" enableJPEG2K)
+    (opencvFlag "WEBP" enableWebP)
+    (opencvFlag "JPEG" enableJPEG)
+    (opencvFlag "PNG" enablePNG)
+    (opencvFlag "OPENEXR" enableEXR)
+    (opencvFlag "CUDA" enableCuda)
+    (opencvFlag "CUBLAS" enableCuda)
+    (opencvFlag "TBB" enableTbb)
+  ] ++ lib.optionals enableCuda [
+    "-DCUDA_FAST_MATH=ON"
+    "-DCUDA_HOST_COMPILER=${cudatoolkit.cc}/bin/cc"
+    "-DCUDA_NVCC_FLAGS=--expt-relaxed-constexpr"
+  ] ++ lib.optionals stdenv.isDarwin [
+    "-DWITH_OPENCL=OFF"
+    "-DWITH_LAPACK=OFF"
+    "-DBUILD_opencv_videoio=OFF"
+  ] ++ lib.optionals enablePython [
+    "-DOPENCV_SKIP_PYTHON_LOADER=ON"
+  ];
+
+  enableParallelBuilding = true;
+
+  postBuild = lib.optionalString enableDocs ''
+    make doxygen
+  '';
+
+  # By default $out/lib/pkgconfig/opencv4.pc looks something like this:
+  #
+  #   prefix=/nix/store/g0wnfyjjh4rikkvp22cpkh41naa43i4i-opencv-4.0.0
+  #   exec_prefix=${prefix}
+  #   libdir=${exec_prefix}//nix/store/g0wnfyjjh4rikkvp22cpkh41naa43i4i-opencv-4.0.0/lib
+  #   includedir_old=${prefix}//nix/store/g0wnfyjjh4rikkvp22cpkh41naa43i4i-opencv-4.0.0/include/opencv4/opencv
+  #   includedir_new=${prefix}//nix/store/g0wnfyjjh4rikkvp22cpkh41naa43i4i-opencv-4.0.0/include/opencv4
+  #   ...
+  #   Libs: -L${exec_prefix}//nix/store/g0wnfyjjh4rikkvp22cpkh41naa43i4i-opencv-4.0.0/lib ...
+  # Note that ${exec_prefix} is set to $out but that $out is also appended to
+  # ${exec_prefix}. This causes linker errors in downstream packages so we strip
+  # of $out after the ${exec_prefix} and ${prefix} prefixes:
+  postInstall = ''
+    sed -i "s|{exec_prefix}/$out|{exec_prefix}|;s|{prefix}/$out|{prefix}|" \
+      "$out/lib/pkgconfig/opencv4.pc"
+  '';
+
+  hardeningDisable = [ "bindnow" "relro" ];
+
+  passthru = lib.optionalAttrs enablePython { pythonPath = []; };
+
+  meta = with stdenv.lib; {
+    description = "Open Computer Vision Library with more than 500 algorithms";
+    homepage = https://opencv.org/;
+    license = with licenses; if enableUnfree then unfree else bsd3;
+    maintainers = with maintainers; [mdaiter basvandijk];
+    platforms = with platforms; linux ++ darwin;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/opencv/default.nix b/nixpkgs/pkgs/development/libraries/opencv/default.nix
new file mode 100644
index 000000000000..123b8807a74f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/opencv/default.nix
@@ -0,0 +1,94 @@
+{ lib, stdenv, fetchFromGitHub, cmake, pkgconfig, unzip
+, zlib
+, enablePython ? false, pythonPackages
+, enableGtk2 ? false, gtk2
+, enableJPEG ? true, libjpeg
+, enablePNG ? true, libpng
+, enableTIFF ? true, libtiff
+, enableEXR ? (!stdenv.isDarwin), openexr, ilmbase
+, enableJPEG2K ? true, jasper
+, enableFfmpeg ? false, ffmpeg
+, enableGStreamer ? false, gst_all_1
+, enableEigen ? true, eigen
+, cf-private, Cocoa, QTKit
+}:
+
+let
+  opencvFlag = name: enabled: "-DWITH_${name}=${if enabled then "ON" else "OFF"}";
+
+in
+
+stdenv.mkDerivation rec {
+  name = "opencv-${version}";
+  version = "2.4.13";
+
+  src = fetchFromGitHub {
+    owner = "Itseez";
+    repo = "opencv";
+    rev = version;
+    sha256 = "1k29rxlvrhgc5hadg2nc50wa3d2ls9ndp373257p756a0aividxh";
+  };
+
+  patches =
+    [ # Don't include a copy of the CMake status output in the
+      # build. This causes a runtime dependency on GCC.
+      ./no-build-info.patch
+    ];
+
+  # This prevents cmake from using libraries in impure paths (which causes build failure on non NixOS)
+  postPatch = ''
+    sed -i '/Add these standard paths to the search paths for FIND_LIBRARY/,/^\s*$/{d}' CMakeLists.txt
+  '';
+
+  outputs = [ "out" "dev" ];
+
+  buildInputs =
+       [ zlib ]
+    ++ lib.optional enablePython pythonPackages.python
+    ++ lib.optional enableGtk2 gtk2
+    ++ lib.optional enableJPEG libjpeg
+    ++ lib.optional enablePNG libpng
+    ++ lib.optional enableTIFF libtiff
+    ++ lib.optionals enableEXR [ openexr ilmbase ]
+    ++ lib.optional enableJPEG2K jasper
+    ++ lib.optional enableFfmpeg ffmpeg
+    ++ lib.optionals enableGStreamer (with gst_all_1; [ gstreamer gst-plugins-base ])
+    ++ lib.optional enableEigen eigen
+    ++ lib.optionals stdenv.isDarwin [ Cocoa QTKit cf-private /* For NSDefaultRunLoopMode */ ]
+    ;
+
+  propagatedBuildInputs = lib.optional enablePython pythonPackages.numpy;
+
+  nativeBuildInputs = [ cmake pkgconfig unzip ];
+
+  NIX_CFLAGS_COMPILE = lib.optional enableEXR "-I${ilmbase.dev}/include/OpenEXR";
+
+  cmakeFlags = [
+    (opencvFlag "TIFF" enableTIFF)
+    (opencvFlag "JASPER" enableJPEG2K)
+    (opencvFlag "JPEG" enableJPEG)
+    (opencvFlag "PNG" enablePNG)
+    (opencvFlag "OPENEXR" enableEXR)
+    (opencvFlag "GSTREAMER" enableGStreamer)
+  ];
+
+  enableParallelBuilding = true;
+
+  hardeningDisable = [ "bindnow" "relro" ];
+
+  # Fix pkgconfig file that gets broken with multiple outputs
+  postFixup = ''
+    sed -i $dev/lib/pkgconfig/opencv.pc -e "s|includedir_old=.*|includedir_old=$dev/include/opencv|"
+    sed -i $dev/lib/pkgconfig/opencv.pc -e "s|includedir_new=.*|includedir_new=$dev/include|"
+  '';
+
+  passthru = lib.optionalAttrs enablePython { pythonPath = []; };
+
+  meta = with stdenv.lib; {
+    description = "Open Computer Vision Library with more than 500 algorithms";
+    homepage = https://opencv.org/;
+    license = licenses.bsd3;
+    maintainers = with maintainers; [ ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/opencv/no-build-info.patch b/nixpkgs/pkgs/development/libraries/opencv/no-build-info.patch
new file mode 100644
index 000000000000..4ee9701583a0
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/opencv/no-build-info.patch
@@ -0,0 +1,14 @@
+diff -ru -x '*~' opencv-2.4.13-orig/modules/core/src/system.cpp opencv-2.4.13/modules/core/src/system.cpp
+--- opencv-2.4.13-orig/modules/core/src/system.cpp	1970-01-01 01:00:01.000000000 +0100
++++ opencv-2.4.13/modules/core/src/system.cpp	2016-10-02 18:44:53.674181762 +0200
+@@ -442,9 +442,7 @@
+ 
+ const std::string& getBuildInformation()
+ {
+-    static std::string build_info =
+-#include "version_string.inc"
+-    ;
++    static std::string build_info = "(build info elided)";
+     return build_info;
+ }
+ 
diff --git a/nixpkgs/pkgs/development/libraries/opendbx/default.nix b/nixpkgs/pkgs/development/libraries/opendbx/default.nix
new file mode 100644
index 000000000000..f954aaf72457
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/opendbx/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchurl, readline, mysql, postgresql, sqlite }:
+
+stdenv.mkDerivation rec {
+  name = "opendbx-1.4.6";
+
+  src = fetchurl {
+    url = "https://linuxnetworks.de/opendbx/download/${name}.tar.gz";
+    sha256 = "0z29h6zx5f3gghkh1a0060w6wr572ci1rl2a3480znf728wa0ii2";
+  };
+
+  preConfigure = ''
+    export CPPFLAGS="-I${mysql.connector-c}/include/mysql"
+    export LDFLAGS="-L${mysql.connector-c}/lib/mysql -L${postgresql}/lib"
+    configureFlagsArray=(--with-backends="mysql pgsql sqlite3")
+  '';
+
+  buildInputs = [ readline mysql.connector-c postgresql sqlite ];
+
+  meta = with stdenv.lib; {
+    description = "Extremely lightweight but extensible database access library written in C";
+    license = licenses.lgpl21;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/opendht/default.nix b/nixpkgs/pkgs/development/libraries/opendht/default.nix
new file mode 100644
index 000000000000..17e2c9098a10
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/opendht/default.nix
@@ -0,0 +1,39 @@
+{ stdenv, fetchFromGitHub
+, autoreconfHook, pkgconfig
+, nettle, gnutls, msgpack, readline, libargon2
+}:
+
+stdenv.mkDerivation rec {
+  name = "opendht-${version}";
+  version = "1.8.0";
+
+  src = fetchFromGitHub {
+    owner = "savoirfairelinux";
+    repo = "opendht";
+    rev = "${version}";
+    sha256 = "1mj3zsywxphh9wcazyqsldwwn14r77xv9cjsmc0nmcybsl2bwnpl";
+  };
+
+  nativeBuildInputs =
+    [ autoreconfHook
+      pkgconfig
+    ];
+
+  buildInputs =
+    [ nettle
+      gnutls
+      msgpack
+      readline
+      libargon2
+    ];
+
+  outputs = [ "out" "lib" "dev" "man" ];
+
+  meta = with stdenv.lib; {
+    description = "A C++11 Kademlia distributed hash table implementation";
+    homepage    = https://github.com/savoirfairelinux/opendht;
+    license     = licenses.gpl3Plus;
+    maintainers = with maintainers; [ taeer olynch thoughtpolice ];
+    platforms   = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/opendkim/default.nix b/nixpkgs/pkgs/development/libraries/opendkim/default.nix
new file mode 100644
index 000000000000..3d110910b159
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/opendkim/default.nix
@@ -0,0 +1,35 @@
+{ stdenv, fetchurl, pkgconfig, libbsd, openssl, libmilter
+, perl, makeWrapper }:
+
+stdenv.mkDerivation rec {
+  name = "opendkim-${version}";
+  version = "2.10.3";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/opendkim/files/${name}.tar.gz";
+    sha256 = "06v8bqhh604sz9rh5bvw278issrwjgc4h1wx2pz9a84lpxbvm823";
+  };
+
+  configureFlags= [
+    "--with-milter=${libmilter}"
+    "ac_cv_func_malloc_0_nonnull=yes"
+    "ac_cv_func_realloc_0_nonnull=yes"
+  ];
+
+  nativeBuildInputs = [ pkgconfig makeWrapper ];
+
+  buildInputs = [ libbsd openssl libmilter perl ];
+
+  postInstall = ''
+    wrapProgram $out/sbin/opendkim-genkey \
+      --prefix PATH : ${openssl.bin}/bin
+  '';
+
+  meta = with stdenv.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 ];
+    license = licenses.bsd3;
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/openexr/bootstrap.patch b/nixpkgs/pkgs/development/libraries/openexr/bootstrap.patch
new file mode 100644
index 000000000000..af6669c16a45
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/openexr/bootstrap.patch
@@ -0,0 +1,15 @@
+diff -ur openexr-v2.2.0-src-orig/OpenEXR/bootstrap openexr-v2.2.0-src/OpenEXR/bootstrap
+--- OpenEXR/bootstrap	2015-03-31 01:02:41.000000000 -0400
++++ OpenEXR/bootstrap	2015-03-31 01:03:35.000000000 -0400
+@@ -47,11 +47,6 @@
+     fi
+ }
+ 
+-# Check if /usr/local/share/aclocal exists
+-if [ -d /usr/local/share/aclocal ]; then
+-	ACLOCAL_INCLUDE="$ACLOCAL_INCLUDE -I /usr/local/share/aclocal"
+-fi	
+-
+ run_cmd aclocal -I m4 $ACLOCAL_INCLUDE
+ run_cmd $LIBTOOLIZE --automake --copy
+ run_cmd automake --add-missing --copy
diff --git a/nixpkgs/pkgs/development/libraries/openexr/default.nix b/nixpkgs/pkgs/development/libraries/openexr/default.nix
new file mode 100644
index 000000000000..54b617fdc014
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/openexr/default.nix
@@ -0,0 +1,55 @@
+{ lib, stdenv, buildPackages, fetchurl, autoconf, automake, libtool, pkgconfig, zlib, ilmbase, }:
+
+let
+  # Doesn't really do anything when not crosscompiling
+  emulator = stdenv.hostPlatform.emulator buildPackages;
+in
+
+stdenv.mkDerivation rec {
+  name = "openexr-${version}";
+  version = lib.getVersion ilmbase;
+
+  src = fetchurl {
+    url = "https://github.com/openexr/openexr/releases/download/v${version}/${name}.tar.gz";
+    sha256 = "19jywbs9qjvsbkvlvzayzi81s976k53wg53vw4xj66lcgylb6v7x";
+  };
+
+  patches = [
+    ./bootstrap.patch
+  ];
+
+  outputs = [ "bin" "dev" "out" "doc" ];
+
+  # Needed because there are some generated sources. Solution: just run them under QEMU.
+  postPatch = ''
+    for file in b44ExpLogTable dwaLookups
+    do
+      # Ecape for both sh and Automake
+      emu=${lib.escapeShellArg (lib.replaceStrings ["$"] ["$$"] emulator)}
+      before="./$file > $file.h"
+      after="$emu $before"
+      substituteInPlace IlmImf/Makefile.am \
+        --replace "$before" "$after"
+    done
+
+    # Make sure the patch succeeded
+    [[ $(grep "$emu" IlmImf/Makefile.am | wc -l) = 2 ]]
+  '';
+
+  preConfigure = ''
+    patchShebangs ./bootstrap
+    ./bootstrap
+  '';
+
+  nativeBuildInputs = [ pkgconfig autoconf automake libtool ];
+  propagatedBuildInputs = [ ilmbase zlib ];
+
+  enableParallelBuilding = true;
+  doCheck = false; # fails 1 of 1 tests
+
+  meta = with stdenv.lib; {
+    homepage = http://www.openexr.com/;
+    license = licenses.bsd3;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/openexrid-unstable/default.nix b/nixpkgs/pkgs/development/libraries/openexrid-unstable/default.nix
new file mode 100644
index 000000000000..099bd8d1e973
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/openexrid-unstable/default.nix
@@ -0,0 +1,55 @@
+{ stdenv, fetchFromGitHub, unzip, re2, openfx, zlib, ilmbase, libGLU_combined, openexr }:
+
+stdenv.mkDerivation rec
+{
+  name = "openexrid-unstable-${version}";
+  version = "2017-09-17";
+
+  src = fetchFromGitHub {
+    owner = "MercenariesEngineering";
+    repo = "openexrid";
+    rev = "bec0081548a096f9bcdd1504970c96264b0fc050";
+    sha256 = "0h4b74lv59p4hhrvrqdmlnchn2i0v5id4kl8xc7j26l9884q0383";
+  };
+
+  outputs = [ "dev" "out" "lib" ];
+
+  patches = [ ./openexrid.patch ];
+
+  postPatch = ''
+    substituteInPlace openexrid/makefile \
+        --replace g++ c++
+  '';
+
+  NIX_CFLAGS_COMPILE=''-I${ilmbase.dev}/include/OpenEXR
+                       -I${openexr.dev}/include/OpenEXR
+                       -I${openfx.dev}/include/OpenFX
+                      '';
+
+  buildInputs = [ unzip re2 openfx zlib ilmbase libGLU_combined openexr ];
+
+  enableParallelBuilding = true;
+
+  buildPhase = ''
+      mkdir openexrid/release
+
+      PREFIX=$out make -C openexrid install
+
+      mkdir $dev;
+      mkdir $lib;
+  '';
+
+  installPhase = ''
+      find $out
+      mv $out/include $dev/
+      mv $out/lib $lib/
+  '';
+
+  meta = with stdenv.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 ];
+    platforms = platforms.all;
+    license = licenses.mit;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/openexrid-unstable/openexrid.patch b/nixpkgs/pkgs/development/libraries/openexrid-unstable/openexrid.patch
new file mode 100644
index 000000000000..bbbf75b575dc
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/openexrid-unstable/openexrid.patch
@@ -0,0 +1,35 @@
+diff --git a/makefile b/makefile
+index 7a92771..31ef664 100644
+--- a/makefile
++++ b/makefile
+@@ -8,8 +8,8 @@ _openexrid:
+ _openfx:
+ 	make -C openfx
+ 
+-_test: _openexrid
+-	make -C test
++#_test: _openexrid
++#	make -C test
+ 
+ clean:
+ 	make -C openfx clean
+diff --git a/makefile.config b/makefile.config
+index 0c6cdfa..0166c4c 100644
+--- a/makefile.config
++++ b/makefile.config
+@@ -4,7 +4,7 @@
+ 
+ PREFIX ?= ~/openexrid
+ 
+-OFX_INCLUDE ?= /usr/include/openfx
++OFX_INCLUDE ?= /usr/include/OpenFX
+ EXR_INCLUDE ?= /usr/include/OpenEXR
+ EXR_LIB ?= /usr/lib
+ RE2_INCLUDE ?= /usr/include
+@@ -13,5 +13,5 @@ RE2_LIB ?= /usr/lib
+ VERSION ?= release
+ CPPFLAGS += -O3 -Wall -DNDEBUG -fPIC -I $(EXR_INCLUDE) -I $(OFX_INCLUDE) -I $(RE2_INCLUDE) -Dlinux
+ LDFLAGS += -L$(EXR_LIB) -L$(RE2_LIB) -L../openexrid/$(VERSION) -lpthread
+-LDFLAGS += -Wl,-Bstatic -lopenexrid -lIlmImf -lIlmThread -lIex -lImath -lHalf -lz -lre2 -Wl,-Bdynamic
++LDFLAGS += -lopenexrid -lIlmImf -lIlmThread -lIex -lImath -lHalf -lz -lre2 -Wl,-Bdynamic
+ 
diff --git a/nixpkgs/pkgs/development/libraries/openfst/default.nix b/nixpkgs/pkgs/development/libraries/openfst/default.nix
new file mode 100644
index 000000000000..cd3210dd08b1
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/openfst/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "${pname}-${version}";
+  pname = "openfst";
+  version = "1.7.2";
+
+  src = fetchurl {
+    url = "http://www.openfst.org/twiki/pub/FST/FstDownload/${name}.tar.gz";
+    sha256 = "0fqgk8195kz21is09gwzwnrg7fr9526bi9mh4apyskapz27pbhr1";
+  };
+  meta = {
+    description = "Library for working with finite-state transducers";
+    longDescription = ''
+      Library for constructing, combining, optimizing, and searching weighted finite-state transducers (FSTs).
+      FSTs have key applications in speech recognition and synthesis, machine translation, optical character recognition,
+      pattern matching, string processing, machine learning, information extraction and retrieval among others
+    '';
+    homepage = http://www.openfst.org/twiki/bin/view/FST/WebHome;
+    license = stdenv.lib.licenses.asl20;
+    maintainers = [ stdenv.lib.maintainers.dfordivam ];
+    platforms = stdenv.lib.platforms.unix;
+  };
+}
+
diff --git a/nixpkgs/pkgs/development/libraries/openfx/default.nix b/nixpkgs/pkgs/development/libraries/openfx/default.nix
new file mode 100644
index 000000000000..42edb1958ce0
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/openfx/default.nix
@@ -0,0 +1,38 @@
+{ stdenv, fetchFromGitHub, unzip }:
+
+stdenv.mkDerivation rec
+{
+  name = "openfx-${version}";
+  version = "1.4";
+
+  src = fetchFromGitHub {
+    owner = "ofxa";
+    repo = "openfx";
+    rev = "OFX_Release_1_4_TAG";
+    sha256 = "0k9ggzr6bisn77mipjfvawg3mv4bz50b63v8f7w1jhldi1sfy548";
+  };
+
+  buildInputs = [ unzip ];
+
+  outputs = [ "dev" "out" ];
+
+  enableParallelBuilding = true;
+
+  buildPhase = ''
+      mkdir $dev
+      mkdir $out
+      '';
+
+  installPhase = ''
+     mkdir -p $dev/include/OpenFX/
+     cp -r include/* $dev/include/OpenFX/
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Image processing plug-in standard";
+    homepage = "http://openeffects.org/";
+    license = licenses.bsd3;
+    platforms = platforms.all;
+    maintainers = [ maintainers.guibou ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/openh264/default.nix b/nixpkgs/pkgs/development/libraries/openh264/default.nix
new file mode 100644
index 000000000000..c8208ce27bae
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/openh264/default.nix
@@ -0,0 +1,26 @@
+{ stdenv, fetchFromGitHub, nasm }:
+
+stdenv.mkDerivation rec {
+  name = "openh264-${version}";
+  version = "1.8.0";
+
+  src = fetchFromGitHub {
+    owner = "cisco";
+    repo = "openh264";
+    rev = "v${version}";
+    sha256 = "1pl7hpk25nh7lcx1lbbv984gvnim0d6hxf4qfmrjjfjf6w37sjw4";
+  };
+
+  buildInputs = [ nasm ];
+
+  installPhase = ''
+    make PREFIX=$out install
+  '';
+
+  meta = with stdenv.lib; {
+    description = "A codec library which supports H.264 encoding and decoding";
+    homepage = http://www.openh264.org;
+    license = stdenv.lib.licenses.bsd2;
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/openhmd/default.nix b/nixpkgs/pkgs/development/libraries/openhmd/default.nix
new file mode 100644
index 000000000000..66656a142342
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/openhmd/default.nix
@@ -0,0 +1,54 @@
+{ lib, stdenv, fetchFromGitHub, pkgconfig, cmake, hidapi
+, withExamples ? true, SDL2 ? null, libGL ? null, glew ? null
+}:
+
+with lib;
+
+let onoff = if withExamples then "ON" else "OFF"; in
+
+stdenv.mkDerivation {
+  pname = "openhmd";
+  version = "0.3.0-rc1-20181218";
+
+  src = fetchFromGitHub {
+    owner = "OpenHMD";
+    repo = "OpenHMD";
+    rev = "80d51bea575a5bf71bb3a0b9683b80ac3146596a";
+    sha256 = "09011vnlsn238r5vbb1ab57x888ljaa34xibrnfbm5bl9417ii4z";
+  };
+
+  nativeBuildInputs = [ pkgconfig cmake ];
+
+  buildInputs = [
+    hidapi
+  ] ++ optionals withExamples [
+    SDL2 libGL glew
+  ];
+
+  cmakeFlags = [
+    "-DBUILD_BOTH_STATIC_SHARED_LIBS=ON"
+    "-DOPENHMD_EXAMPLE_SIMPLE=${onoff}"
+    "-DOPENHMD_EXAMPLE_SDL=${onoff}"
+    "-DOpenGL_GL_PREFERENCE=GLVND"
+  ];
+
+  postInstall = 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 = {
+    homepage = "http://www.openhmd.net";
+    description = "Library API and drivers immersive technology";
+    longDescription = ''
+      OpenHMD is a very simple FLOSS C library and a set of drivers
+      for interfacing with Virtual Reality (VR) Headsets aka
+      Head-mounted Displays (HMDs), controllers and trackers like
+      Oculus Rift, HTC Vive, Windows Mixed Reality, and etc.
+    '';
+    license = licenses.boost;
+    maintainers = [ maintainers.oxij ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/openjpeg/1.x.nix b/nixpkgs/pkgs/development/libraries/openjpeg/1.x.nix
new file mode 100644
index 000000000000..dfa5605dec8b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/openjpeg/1.x.nix
@@ -0,0 +1,8 @@
+{ callPackage, ... } @ args:
+
+callPackage ./generic.nix (args // rec {
+  version = "1.5.2";
+  branch = "1.5";
+  revision = "version.1.5.2";
+  sha256 = "1dvvpvb597i5z8srz2v4c5dsbxb966h125jx3m2z0r2gd2wvpfkp";
+})
diff --git a/nixpkgs/pkgs/development/libraries/openjpeg/2.x.nix b/nixpkgs/pkgs/development/libraries/openjpeg/2.x.nix
new file mode 100644
index 000000000000..e865e2e8549d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/openjpeg/2.x.nix
@@ -0,0 +1,17 @@
+{ callPackage, fetchpatch, ... } @ args:
+
+callPackage ./generic.nix (args // rec {
+  version = "2.3.1";
+  branch = "2.3";
+  revision = "v${version}";
+  sha256 = "1dn98d2dfa1lqyxxmab6rrcv52dyhjr4g7i4xf2w54fqsx14ynrb";
+
+  extraFlags = [
+    "-DOPENJPEG_INSTALL_INCLUDE_DIR=${placeholder "dev"}/include/openjpeg-${branch}"
+    "-DOPENJPEG_INSTALL_PACKAGE_DIR=${placeholder "dev"}/lib/openjpeg-${branch}"
+  ];
+
+  patches = [
+    ./fix-cmake-config-includedir.patch
+  ];
+})
diff --git a/nixpkgs/pkgs/development/libraries/openjpeg/fix-cmake-config-includedir.patch b/nixpkgs/pkgs/development/libraries/openjpeg/fix-cmake-config-includedir.patch
new file mode 100644
index 000000000000..6ff720ead4e1
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/openjpeg/fix-cmake-config-includedir.patch
@@ -0,0 +1,55 @@
+--- a/cmake/OpenJPEGConfig.cmake.in
++++ b/cmake/OpenJPEGConfig.cmake.in
+@@ -32,7 +32,7 @@
+   set(INC_DIR "@CMAKE_INSTALL_PREFIX@/@OPENJPEG_INSTALL_INCLUDE_DIR@")
+   file(RELATIVE_PATH PKG_TO_INC_RPATH "${PKG_DIR}" "${INC_DIR}")
+ 
+-  get_filename_component(OPENJPEG_INCLUDE_DIRS "${SELF_DIR}/${PKG_TO_INC_RPATH}" ABSOLUTE)
++  get_filename_component(OPENJPEG_INCLUDE_DIRS "@OPENJPEG_INSTALL_INCLUDE_DIR@" ABSOLUTE)
+ 
+ else()
+   if(EXISTS ${SELF_DIR}/OpenJPEGExports.cmake)
+--- a/src/lib/openjp2/libopenjp2.pc.cmake.in
++++ b/src/lib/openjp2/libopenjp2.pc.cmake.in
+@@ -3,7 +3,7 @@
+ mandir=${prefix}/@OPENJPEG_INSTALL_MAN_DIR@
+ docdir=${prefix}/@OPENJPEG_INSTALL_DOC_DIR@
+ libdir=${prefix}/@OPENJPEG_INSTALL_LIB_DIR@
+-includedir=${prefix}/@OPENJPEG_INSTALL_INCLUDE_DIR@
++includedir=@OPENJPEG_INSTALL_INCLUDE_DIR@
+ 
+ Name: openjp2
+ Description: JPEG2000 library (Part 1 and 2)
+--- a/src/lib/openjp3d/libopenjp3d.pc.cmake.in
++++ b/src/lib/openjp3d/libopenjp3d.pc.cmake.in
+@@ -3,7 +3,7 @@
+ mandir=${prefix}/@OPENJPEG_INSTALL_MAN_DIR@
+ docdir=${prefix}/@OPENJPEG_INSTALL_DOC_DIR@
+ libdir=${prefix}/@OPENJPEG_INSTALL_LIB_DIR@
+-includedir=${prefix}/@OPENJPEG_INSTALL_INCLUDE_DIR@
++includedir=@OPENJPEG_INSTALL_INCLUDE_DIR@
+ 
+ Name: openjp3d
+ Description: JPEG2000 Extensions for three-dimensional data (Part 10)
+--- a/src/lib/openjpip/libopenjpip.pc.cmake.in
++++ b/src/lib/openjpip/libopenjpip.pc.cmake.in
+@@ -3,7 +3,7 @@
+ mandir=${prefix}/@OPENJPEG_INSTALL_MAN_DIR@
+ docdir=${prefix}/@OPENJPEG_INSTALL_DOC_DIR@
+ libdir=${prefix}/@OPENJPEG_INSTALL_LIB_DIR@
+-includedir=${prefix}/@OPENJPEG_INSTALL_INCLUDE_DIR@
++includedir=@OPENJPEG_INSTALL_INCLUDE_DIR@
+ 
+ Name: openjpip
+ Description: JPEG2000 Interactivity tools, APIs and protocols (Part 9)
+--- a/src/lib/openjpwl/libopenjpwl.pc.cmake.in
++++ b/src/lib/openjpwl/libopenjpwl.pc.cmake.in
+@@ -3,7 +3,7 @@
+ mandir=${prefix}/@OPENJPEG_INSTALL_MAN_DIR@
+ docdir=${prefix}/@OPENJPEG_INSTALL_DOC_DIR@
+ libdir=${prefix}/@OPENJPEG_INSTALL_LIB_DIR@
+-includedir=${prefix}/@OPENJPEG_INSTALL_INCLUDE_DIR@
++includedir=@OPENJPEG_INSTALL_INCLUDE_DIR@
+ 
+ Name: openjpwl
+ Description: JPEG2000 Wireless library (Part 11)
diff --git a/nixpkgs/pkgs/development/libraries/openjpeg/generic.nix b/nixpkgs/pkgs/development/libraries/openjpeg/generic.nix
new file mode 100644
index 000000000000..d3130a64b030
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/openjpeg/generic.nix
@@ -0,0 +1,76 @@
+{ stdenv, fetchFromGitHub, cmake, pkgconfig
+, libpng, libtiff, lcms2
+, mj2Support ? true # MJ2 executables
+, jpwlLibSupport ? true # JPWL library & executables
+, jpipLibSupport ? false # JPIP library & executables
+, jpipServerSupport ? false, curl ? null, fcgi ? null # JPIP Server
+#, opjViewerSupport ? false, wxGTK ? null # OPJViewer executable
+, openjpegJarSupport ? false # Openjpeg jar (Java)
+, jp3dSupport ? true # # JP3D comp
+, thirdPartySupport ? false # Third party libraries - OFF: only build when found, ON: always build
+, testsSupport ? false
+, jdk ? null
+# Inherit generics
+, branch, version, revision, sha256, patches ? [], extraFlags ? [], ...
+}:
+
+assert jpipServerSupport -> jpipLibSupport && curl != null && fcgi != null;
+#assert opjViewerSupport -> (wxGTK != null);
+assert (openjpegJarSupport || jpipLibSupport) -> jdk != null;
+
+let
+  inherit (stdenv.lib) optional optionals;
+  mkFlag = optSet: flag: "-D${flag}=${if optSet then "ON" else "OFF"}";
+in
+
+stdenv.mkDerivation rec {
+  name = "openjpeg-${version}";
+
+  src = fetchFromGitHub {
+    owner = "uclouvain";
+    repo = "openjpeg";
+    rev = revision;
+    inherit sha256;
+  };
+
+  inherit patches;
+
+  outputs = [ "out" "dev" ];
+
+  cmakeFlags = [
+    "-DCMAKE_INSTALL_NAME_DIR=\${CMAKE_INSTALL_PREFIX}/lib"
+    "-DBUILD_SHARED_LIBS=ON"
+    "-DBUILD_CODEC=ON"
+    (mkFlag mj2Support "BUILD_MJ2")
+    (mkFlag jpwlLibSupport "BUILD_JPWL")
+    (mkFlag jpipLibSupport "BUILD_JPIP")
+    (mkFlag jpipServerSupport "BUILD_JPIP_SERVER")
+    #(mkFlag opjViewerSupport "BUILD_VIEWER")
+    "-DBUILD_VIEWER=OFF"
+    (mkFlag openjpegJarSupport "BUILD_JAVA")
+    (mkFlag jp3dSupport "BUILD_JP3D")
+    (mkFlag thirdPartySupport "BUILD_THIRDPARTY")
+    (mkFlag testsSupport "BUILD_TESTING")
+  ] ++ extraFlags;
+
+  nativeBuildInputs = [ cmake pkgconfig ];
+
+  buildInputs = [ ]
+    ++ optionals jpipServerSupport [ curl fcgi ]
+    #++ optional opjViewerSupport wxGTK
+    ++ optional (openjpegJarSupport || jpipLibSupport) jdk;
+
+  propagatedBuildInputs = [ libpng libtiff lcms2 ];
+
+  passthru = {
+    incDir = "openjpeg-${branch}";
+  };
+
+  meta = with stdenv.lib; {
+    description = "Open-source JPEG 2000 codec written in C language";
+    homepage = http://www.openjpeg.org/;
+    license = licenses.bsd2;
+    maintainers = with maintainers; [ codyopel ];
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/openldap/default.nix b/nixpkgs/pkgs/development/libraries/openldap/default.nix
new file mode 100644
index 000000000000..04988debb723
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/openldap/default.nix
@@ -0,0 +1,67 @@
+{ stdenv, fetchurl, openssl, cyrus_sasl, db, groff, libtool }:
+
+stdenv.mkDerivation rec {
+  name = "openldap-2.4.47";
+
+  src = fetchurl {
+    url = "https://www.openldap.org/software/download/OpenLDAP/openldap-release/${name}.tgz";
+    sha256 = "02sj0p1pq12hqq29b22m3f5zs2rykgvc0q3wlynxjcsjhrvmhk7m";
+  };
+
+  # TODO: separate "out" and "bin"
+  outputs = [ "out" "dev" "man" "devdoc" ];
+
+  enableParallelBuilding = true;
+
+  nativeBuildInputs = [ groff ];
+
+  buildInputs = [ openssl cyrus_sasl db libtool ];
+
+  # Disable install stripping as it breaks cross-compiling.
+  # We strip binaries anyway in fixupPhase.
+  makeFlags= [ "STRIP=" ];
+
+  configureFlags = [
+    "--enable-overlays"
+    "--disable-dependency-tracking"   # speeds up one-time build
+    "--enable-modules"
+    "--sysconfdir=/etc"
+    "--localstatedir=/var"
+    "--enable-crypt"
+  ] ++ stdenv.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";
+
+  doCheck = false; # needs a running LDAP server
+
+  installFlags = [ "sysconfdir=$(out)/etc" "localstatedir=$(out)/var" ];
+
+  # 1. Fixup broken libtool
+  # 2. Libraries left in the build location confuse `patchelf --shrink-rpath`
+  #    Delete these to let patchelf discover the right path instead.
+  #    FIXME: that one can be removed when https://github.com/NixOS/patchelf/pull/98
+  #    is in Nixpkgs patchelf.
+  preFixup = ''
+    sed -e 's,-lsasl2,-L${cyrus_sasl.out}/lib -lsasl2,' \
+        -e 's,-lssl,-L${openssl.out}/lib -lssl,' \
+        -i $out/lib/libldap.la -i $out/lib/libldap_r.la
+
+    rm -rf $out/var
+    rm -r libraries/*/.libs
+  '';
+
+  postInstall = ''
+    chmod +x "$out"/lib/*.{so,dylib}
+  '';
+
+  meta = with stdenv.lib; {
+    homepage    = http://www.openldap.org/;
+    description = "An open source implementation of the Lightweight Directory Access Protocol";
+    license = licenses.openldap;
+    maintainers = with maintainers; [ lovek323 ];
+    platforms   = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/openmpi/default.nix b/nixpkgs/pkgs/development/libraries/openmpi/default.nix
new file mode 100644
index 000000000000..1a0e589373ca
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/openmpi/default.nix
@@ -0,0 +1,54 @@
+{ stdenv, fetchurl, fetchpatch, gfortran, perl, libnl
+, rdma-core, zlib, numactl, libevent, hwloc
+
+# Enable the Sun Grid Engine bindings
+, enableSGE ? false
+
+# Pass PATH/LD_LIBRARY_PATH to point to current mpirun by default
+, enablePrefix ? false
+}:
+
+let
+  version = "4.0.1";
+
+in stdenv.mkDerivation rec {
+  name = "openmpi-${version}";
+
+  src = with stdenv.lib.versions; fetchurl {
+    url = "http://www.open-mpi.org/software/ompi/v${major version}.${minor version}/downloads/${name}.tar.bz2";
+    sha256 = "02cpzcp113gj5hb0j2xc0cqma2fn04i2i0bzf80r71120p9bdryc";
+  };
+
+  postPatch = ''
+    patchShebangs ./
+  '';
+
+  buildInputs = with stdenv; [ gfortran zlib ]
+    ++ lib.optionals isLinux [ libnl numactl libevent hwloc ]
+    ++ lib.optional (isLinux || isFreeBSD) rdma-core;
+
+  nativeBuildInputs = [ perl ];
+
+  configureFlags = with stdenv; [ "--disable-mca-dso" ]
+    ++ lib.optional isLinux  "--with-libnl=${libnl.dev}"
+    ++ lib.optional enableSGE "--with-sge"
+    ++ lib.optional enablePrefix "--enable-mpirun-prefix-by-default"
+    ;
+
+  enableParallelBuilding = true;
+
+  postInstall = ''
+    rm -f $out/lib/*.la
+   '';
+
+  doCheck = true;
+
+  meta = with stdenv.lib; {
+    homepage = http://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.";
+    maintainers = with maintainers; [ markuskowa ];
+    license = licenses.bsd3;
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/openpa/default.nix b/nixpkgs/pkgs/development/libraries/openpa/default.nix
new file mode 100644
index 000000000000..ed646b9e221b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/openpa/default.nix
@@ -0,0 +1,34 @@
+{ stdenv, fetchurl, file }:
+
+stdenv.mkDerivation rec {
+  pname = "openpa";
+  version = "1.0.4";
+  name = "${pname}-${version}";
+
+  src = fetchurl {
+    url = "https://trac.mpich.org/projects/${pname}/raw-attachment/wiki/Downloads/${name}.tar.gz";
+    sha256 = "0flyi596hm6fv7xyw2iykx3s65p748s62bf15624xcnwpfrh8ncy";
+  };
+
+  prePatch = ''substituteInPlace configure --replace /usr/bin/file ${file}/bin/file'';
+
+  doCheck = true;
+
+  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;
+    longDescription = ''
+      OPA (or sometimes OpenPA or Open Portable Atomics) is an
+      open source library intended to provide a consistent C API for performing
+      atomic operations on a variety of platforms. The main goal of the project is to
+      enable the portable usage of atomic operations in concurrent software.
+      Developers of client software can worry about implementing and improving their
+      concurrent algorithms instead of fiddling with inline assembly syntax and
+      learning new assembly dialects in order improve or maintain application
+      portability.
+    '';
+   };
+}
diff --git a/nixpkgs/pkgs/development/libraries/openpam/default.nix b/nixpkgs/pkgs/development/libraries/openpam/default.nix
new file mode 100644
index 000000000000..339f60649997
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/openpam/default.nix
@@ -0,0 +1,19 @@
+{ stdenv, fetchurl, lib }:
+
+stdenv.mkDerivation rec {
+  name = "openpam-${version}";
+  version = "20170430";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/openpam/openpam/Resedacea/${name}.tar.gz";
+    sha256 = "0pz8kf9mxj0k8yp8jgmhahddz58zv2b7gnyjwng75xgsx4i55xi2";
+  };
+
+  meta = with lib; {
+    homepage = https://www.openpam.org;
+    description = "An open source PAM library that focuses on simplicity, correctness, and cleanliness";
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ matthewbauer ];
+    license = licenses.bsd3;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/opensaml-cpp/default.nix b/nixpkgs/pkgs/development/libraries/opensaml-cpp/default.nix
new file mode 100644
index 000000000000..659c4fb7cff6
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/opensaml-cpp/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchgit, autoreconfHook, boost, openssl, log4shib, xercesc, xml-security-c, xml-tooling-c, zlib }:
+
+stdenv.mkDerivation rec {
+  name = "opensaml-cpp-${version}";
+  version = "2.6.1";
+
+  src = fetchgit {
+    url = "https://git.shibboleth.net/git/cpp-opensaml.git";
+    rev = version;
+    sha256 = "0wjb6jyvh4hwpy1pvhh63i821746nqijysrd4vasbirkf4h6z7nx";
+  };
+
+  buildInputs = [ boost openssl log4shib xercesc xml-security-c xml-tooling-c zlib ];
+  nativeBuildInputs = [ autoreconfHook ];
+
+  configureFlags = [ "--with-xmltooling=${xml-tooling-c}" ];
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.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;
+    license     = licenses.asl20;
+    maintainers = [ maintainers.jammerful ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/openscenegraph/3.4.0.nix b/nixpkgs/pkgs/development/libraries/openscenegraph/3.4.0.nix
new file mode 100644
index 000000000000..8d0839041890
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/openscenegraph/3.4.0.nix
@@ -0,0 +1,39 @@
+{ stdenv, lib, fetchurl, cmake, pkgconfig, doxygen, unzip
+, freetype, libjpeg, jasper, libxml2, zlib, gdal, curl, libX11
+, cairo, poppler, librsvg, libpng, libtiff, libXrandr
+, xineLib, boost
+, withApps ? false
+, withSDL ? false, SDL
+, withQt4 ? false, qt4
+}:
+
+stdenv.mkDerivation rec {
+  name = "openscenegraph-${version}";
+  version = "3.4.0";
+
+  src = fetchurl {
+    url = "http://trac.openscenegraph.org/downloads/developer_releases/OpenSceneGraph-${version}.zip";
+    sha256 = "03h4wfqqk7rf3mpz0sa99gy715cwpala7964z2npd8jxfn27swjw";
+  };
+
+  nativeBuildInputs = [ pkgconfig cmake doxygen unzip ];
+
+  buildInputs = [
+    freetype libjpeg jasper libxml2 zlib gdal curl libX11
+    cairo poppler librsvg libpng libtiff libXrandr boost
+    xineLib
+  ] ++ lib.optional withSDL SDL
+    ++ lib.optional withQt4 qt4;
+
+  enableParallelBuilding = true;
+
+  cmakeFlags = lib.optional (!withApps) "-DBUILD_OSG_APPLICATIONS=OFF";
+
+  meta = with stdenv.lib; {
+    description = "A 3D graphics toolkit";
+    homepage = http://www.openscenegraph.org/;
+    maintainers = [ maintainers.raskin ];
+    platforms = platforms.linux;
+    license = "OpenSceneGraph Public License - free LGPL-based license";
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/openscenegraph/default.nix b/nixpkgs/pkgs/development/libraries/openscenegraph/default.nix
new file mode 100644
index 000000000000..9f5ef3ff68c8
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/openscenegraph/default.nix
@@ -0,0 +1,78 @@
+{ stdenv, lib, fetchFromGitHub, cmake, pkgconfig, doxygen,
+  libX11, libXinerama, libXrandr, libGLU_combined,
+  glib, ilmbase, libxml2, pcre, zlib,
+  jpegSupport ? true, libjpeg,
+  jasperSupport ? true, jasper,
+  exrSupport ? false, openexr,
+  gifSupport ? true, giflib,
+  pngSupport ? true, libpng,
+  tiffSupport ? true, libtiff,
+  gdalSupport ? false, gdal,
+  curlSupport ? true, curl,
+  colladaSupport ? false, opencollada,
+  opencascadeSupport ? false, opencascade,
+  ffmpegSupport ? false, ffmpeg,
+  nvttSupport ? false, nvidia-texture-tools,
+  freetypeSupport ? true, freetype,
+  svgSupport ? false, librsvg,
+  pdfSupport ? false, poppler,
+  vncSupport ? false, libvncserver,
+  lasSupport ? false, libLAS,
+  luaSupport ? false, lua,
+  sdlSupport ? false, SDL2,
+  restSupport ? false, asio, boost,
+  withApps ? false,
+  withExamples ? false, fltk, wxGTK,
+}:
+
+stdenv.mkDerivation rec {
+  name = "openscenegraph-${version}";
+  version = "3.6.3";
+
+  src = fetchFromGitHub {
+    owner = "openscenegraph";
+    repo = "OpenSceneGraph";
+    rev = "d011ca4e8d83549a3688bf6bb8cd468dd9684822";
+    sha256 = "0h32z15sa8sbq276j0iib0n707m8bs4p5ji9z2ah411446paad9q";
+  };
+
+  nativeBuildInputs = [ pkgconfig cmake doxygen ];
+
+  buildInputs = [
+    libX11 libXinerama libXrandr libGLU_combined
+    glib ilmbase libxml2 pcre zlib
+  ] ++ lib.optional jpegSupport libjpeg
+    ++ lib.optional jasperSupport jasper
+    ++ lib.optional exrSupport openexr
+    ++ lib.optional gifSupport giflib
+    ++ lib.optional pngSupport libpng
+    ++ lib.optional tiffSupport libtiff
+    ++ lib.optional gdalSupport gdal
+    ++ lib.optional curlSupport curl
+    ++ lib.optional colladaSupport opencollada
+    ++ lib.optional opencascadeSupport opencascade
+    ++ lib.optional ffmpegSupport ffmpeg
+    ++ lib.optional nvttSupport nvidia-texture-tools
+    ++ lib.optional freetypeSupport freetype
+    ++ lib.optional svgSupport librsvg
+    ++ lib.optional pdfSupport poppler
+    ++ lib.optional vncSupport libvncserver
+    ++ lib.optional lasSupport libLAS
+    ++ lib.optional luaSupport lua
+    ++ lib.optional sdlSupport SDL2
+    ++ lib.optionals restSupport [ asio boost ]
+    ++ lib.optionals withExamples [ fltk wxGTK ]
+  ;
+
+  enableParallelBuilding = true;
+
+  cmakeFlags = lib.optional (!withApps) "-DBUILD_OSG_APPLICATIONS=OFF" ++ lib.optional withExamples "-DBUILD_OSG_EXAMPLES=ON";
+
+  meta = with stdenv.lib; {
+    description = "A 3D graphics toolkit";
+    homepage = http://www.openscenegraph.org/;
+    maintainers = [ maintainers.raskin ];
+    platforms = platforms.linux;
+    license = "OpenSceneGraph Public License - free LGPL-based license";
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/openslp/CVE-2016-4912.patch b/nixpkgs/pkgs/development/libraries/openslp/CVE-2016-4912.patch
new file mode 100644
index 000000000000..06223deda89b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/openslp/CVE-2016-4912.patch
@@ -0,0 +1,11 @@
+--- a/common/slp_xmalloc.c
++++ b/common/slp_xmalloc.c
+@@ -206,7 +206,7 @@ void * _xrealloc(const char * file, int line, void * ptr, size_t size)
+          if (newptr == 0)
+             return 0;
+          memcpy(newptr, ptr, x->size);
+-         _xfree(file, line, x);
++         _xfree(file, line, ptr);
+       }
+       return newptr;
+    }
diff --git a/nixpkgs/pkgs/development/libraries/openslp/default.nix b/nixpkgs/pkgs/development/libraries/openslp/default.nix
new file mode 100644
index 000000000000..537b67c5a3c3
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/openslp/default.nix
@@ -0,0 +1,33 @@
+{ stdenv, fetchurl, fetchpatch }:
+
+stdenv.mkDerivation {
+  name = "openslp-2.0.0";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/openslp/2.0.0/2.0.0/openslp-2.0.0.tar.gz";
+    sha256 = "16splwmqp0400w56297fkipaq9vlbhv7hapap8z09gp5m2i3fhwj";
+  };
+
+  patches = [
+    (fetchpatch {
+      name = "openslp-2.0.0-null-pointer-deref.patch";
+      url = "https://src.fedoraproject.org/cgit/rpms/openslp.git/plain/openslp-2.0.0-null-pointer-deref.patch";
+      sha256 = "186f3rj3z2lf5h1lpbhqk0szj2a9far1p3mjqg6422f29yjfnz6a";
+    })
+    (fetchpatch {
+      name = "openslp-2.0.0-CVE-2016-7567.patch";
+      url = "https://src.fedoraproject.org/cgit/rpms/openslp.git/plain/openslp-2.0.0-cve-2016-7567.patch";
+      sha256 = "0zp61axx93b7nrbsyhn2x4dnw7n9y6g4rys21hyqxk4khrnc2yr9";
+    })
+    ./CVE-2016-4912.patch
+  ];
+
+  meta = with stdenv.lib; {
+    homepage = http://www.openslp.org/;
+    description = "An open-source implementation of the IETF Service Location Protocol";
+    maintainers = with maintainers; [ ttuegel ];
+    license = licenses.bsd3;
+    platforms = platforms.all;
+  };
+
+}
diff --git a/nixpkgs/pkgs/development/libraries/openssl/1.0.2/nix-ssl-cert-file.patch b/nixpkgs/pkgs/development/libraries/openssl/1.0.2/nix-ssl-cert-file.patch
new file mode 100644
index 000000000000..5765409fdd57
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/openssl/1.0.2/nix-ssl-cert-file.patch
@@ -0,0 +1,16 @@
+diff --git a/crypto/x509/by_file.c b/crypto/x509/by_file.c
+index e6d0e6e1a6..b89456fd87 100644
+--- a/crypto/x509/by_file.c
++++ b/crypto/x509/by_file.c
+@@ -97,7 +97,10 @@ static int by_file_ctrl(X509_LOOKUP *ctx, int cmd, const char *argp,
+     switch (cmd) {
+     case X509_L_FILE_LOAD:
+         if (argl == X509_FILETYPE_DEFAULT) {
+-            file = ossl_safe_getenv(X509_get_default_cert_file_env());
++            file = ossl_safe_getenv("NIX_SSL_CERT_FILE");
++
++            if (!file)
++                file = ossl_safe_getenv(X509_get_default_cert_file_env());
+ 
+             if (file)
+                 ok = (X509_load_cert_crl_file(ctx, file,
diff --git a/nixpkgs/pkgs/development/libraries/openssl/1.0.2/use-etc-ssl-certs-darwin.patch b/nixpkgs/pkgs/development/libraries/openssl/1.0.2/use-etc-ssl-certs-darwin.patch
new file mode 100644
index 000000000000..3d9ee7e6a822
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/openssl/1.0.2/use-etc-ssl-certs-darwin.patch
@@ -0,0 +1,13 @@
+diff -ru -x '*~' openssl-1.0.1r-orig/crypto/cryptlib.h openssl-1.0.1r/crypto/cryptlib.h
+--- openssl-1.0.1r-orig/crypto/cryptlib.h	2016-01-28 14:38:30.000000000 +0100
++++ openssl-1.0.1r/crypto/cryptlib.h	2016-02-03 12:54:29.193165176 +0100
+@@ -81,8 +81,8 @@
+ 
+ # ifndef OPENSSL_SYS_VMS
+ #  define X509_CERT_AREA          OPENSSLDIR
+ #  define X509_CERT_DIR           OPENSSLDIR "/certs"
+-#  define X509_CERT_FILE          OPENSSLDIR "/cert.pem"
++#  define X509_CERT_FILE          "/nix/var/nix/profiles/default/etc/ssl/certs/ca-bundle.crt"
+ #  define X509_PRIVATE_DIR        OPENSSLDIR "/private"
+ # else
+ #  define X509_CERT_AREA          "SSLROOT:[000000]"
diff --git a/nixpkgs/pkgs/development/libraries/openssl/1.0.2/use-etc-ssl-certs.patch b/nixpkgs/pkgs/development/libraries/openssl/1.0.2/use-etc-ssl-certs.patch
new file mode 100644
index 000000000000..813c6bdf44ab
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/openssl/1.0.2/use-etc-ssl-certs.patch
@@ -0,0 +1,13 @@
+diff -ru -x '*~' openssl-1.0.1r-orig/crypto/cryptlib.h openssl-1.0.1r/crypto/cryptlib.h
+--- openssl-1.0.1r-orig/crypto/cryptlib.h	2016-01-28 14:38:30.000000000 +0100
++++ openssl-1.0.1r/crypto/cryptlib.h	2016-02-03 12:54:29.193165176 +0100
+@@ -81,8 +81,8 @@
+ 
+ # ifndef OPENSSL_SYS_VMS
+ #  define X509_CERT_AREA          OPENSSLDIR
+ #  define X509_CERT_DIR           OPENSSLDIR "/certs"
+-#  define X509_CERT_FILE          OPENSSLDIR "/cert.pem"
++#  define X509_CERT_FILE          "/etc/ssl/certs/ca-certificates.crt"
+ #  define X509_PRIVATE_DIR        OPENSSLDIR "/private"
+ # else
+ #  define X509_CERT_AREA          "SSLROOT:[000000]"
diff --git a/nixpkgs/pkgs/development/libraries/openssl/1.1/nix-ssl-cert-file.patch b/nixpkgs/pkgs/development/libraries/openssl/1.1/nix-ssl-cert-file.patch
new file mode 100644
index 000000000000..9e871cfb1d31
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/openssl/1.1/nix-ssl-cert-file.patch
@@ -0,0 +1,15 @@
+diff --git a/crypto/x509/by_file.c b/crypto/x509/by_file.c
+index 244512c935..f0b70d7ea1 100644
+--- a/crypto/x509/by_file.c
++++ b/crypto/x509/by_file.c
+@@ -46,7 +46,9 @@ static int by_file_ctrl(X509_LOOKUP *ctx, int cmd, const char *argp,
+     switch (cmd) {
+     case X509_L_FILE_LOAD:
+         if (argl == X509_FILETYPE_DEFAULT) {
+-            file = ossl_safe_getenv(X509_get_default_cert_file_env());
++            file = ossl_safe_getenv("NIX_SSL_CERT_FILE");
++            if (!file)
++                file = ossl_safe_getenv(X509_get_default_cert_file_env());
+             if (file)
+                 ok = (X509_load_cert_crl_file(ctx, file,
+                                               X509_FILETYPE_PEM) != 0);
diff --git a/nixpkgs/pkgs/development/libraries/openssl/1.1/use-etc-ssl-certs-darwin.patch b/nixpkgs/pkgs/development/libraries/openssl/1.1/use-etc-ssl-certs-darwin.patch
new file mode 100644
index 000000000000..2c98ccfa7ed0
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/openssl/1.1/use-etc-ssl-certs-darwin.patch
@@ -0,0 +1,13 @@
+diff --git a/include/internal/cryptlib.h b/include/internal/cryptlib.h
+index 329ef62..9a8df64 100644
+--- a/include/internal/cryptlib.h
++++ b/include/internal/cryptlib.h
+@@ -56,7 +56,7 @@ DEFINE_LHASH_OF(MEM);
+ # ifndef OPENSSL_SYS_VMS
+ #  define X509_CERT_AREA          OPENSSLDIR
+ #  define X509_CERT_DIR           OPENSSLDIR "/certs"
+-#  define X509_CERT_FILE          OPENSSLDIR "/cert.pem"
++#  define X509_CERT_FILE          "/nix/var/nix/profiles/default/etc/ssl/certs/ca-bundle.crt"
+ #  define X509_PRIVATE_DIR        OPENSSLDIR "/private"
+ #  define CTLOG_FILE              OPENSSLDIR "/ct_log_list.cnf"
+ # else
diff --git a/nixpkgs/pkgs/development/libraries/openssl/1.1/use-etc-ssl-certs.patch b/nixpkgs/pkgs/development/libraries/openssl/1.1/use-etc-ssl-certs.patch
new file mode 100644
index 000000000000..67d199681f96
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/openssl/1.1/use-etc-ssl-certs.patch
@@ -0,0 +1,13 @@
+diff --git a/include/internal/cryptlib.h b/include/internal/cryptlib.h
+index 329ef62..9a8df64 100644
+--- a/include/internal/cryptlib.h
++++ b/include/internal/cryptlib.h
+@@ -56,7 +56,7 @@ DEFINE_LHASH_OF(MEM);
+ # ifndef OPENSSL_SYS_VMS
+ #  define X509_CERT_AREA          OPENSSLDIR
+ #  define X509_CERT_DIR           OPENSSLDIR "/certs"
+-#  define X509_CERT_FILE          OPENSSLDIR "/cert.pem"
++#  define X509_CERT_FILE          "/etc/ssl/certs/ca-certificates.crt"
+ #  define X509_PRIVATE_DIR        OPENSSLDIR "/private"
+ #  define CTLOG_FILE              OPENSSLDIR "/ct_log_list.cnf"
+ # else
diff --git a/nixpkgs/pkgs/development/libraries/openssl/chacha.nix b/nixpkgs/pkgs/development/libraries/openssl/chacha.nix
new file mode 100644
index 000000000000..f07ebad9e810
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/openssl/chacha.nix
@@ -0,0 +1,82 @@
+{ stdenv, fetchFromGitHub, perl, zlib
+, withCryptodev ? false, cryptodev
+}:
+
+with stdenv.lib;
+stdenv.mkDerivation rec {
+  name = "openssl-chacha-${version}";
+  version = "2016-08-22";
+
+  src = fetchFromGitHub {
+    owner = "PeterMosmans";
+    repo = "openssl";
+    rev = "293717318e903b95f4d7e83a98a087282f37efc3";
+    sha256 = "134j3anjnj2q99xsd8d47bwvjp73qkdsimdd9riyjxa3hd8ysr00";
+  };
+
+  outputs = [ "bin" "dev" "out" "man" ];
+  setOutputFlags = false;
+
+  nativeBuildInputs = [ perl zlib ];
+  buildInputs = stdenv.lib.optional withCryptodev cryptodev;
+
+  configureScript = "./config";
+
+  configureFlags = [
+    "zlib"
+    "shared"
+    "experimental-jpake"
+    "enable-md2"
+    "enable-rc5"
+    "enable-rfc3779"
+    "enable-gost"
+    "--libdir=lib"
+    "--openssldir=etc/ssl"
+  ] ++ stdenv.lib.optionals withCryptodev [
+    "-DHAVE_CRYPTODEV"
+    "-DUSE_CRYPTODEV_DIGESTS"
+  ];
+
+  makeFlags = [
+    "MANDIR=$(man)/share/man"
+  ];
+
+  # Parallel building is broken in OpenSSL.
+  enableParallelBuilding = false;
+
+  postInstall = ''
+    # 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
+        rm "$out/lib/"*.a
+    fi
+
+    mkdir -p $bin
+    mv $out/bin $bin/
+
+    mkdir $dev
+    mv $out/include $dev/
+
+    # remove dependency on Perl at runtime
+    rm -r $out/etc/ssl/misc
+
+    rmdir $out/etc/ssl/{certs,private}
+  '';
+
+  postFixup = ''
+    # Check to make sure we don't depend on perl
+    if grep -r '${perl}' $out; then
+      echo "Found an erroneous dependency on perl ^^^" >&2
+      exit 1
+    fi
+  '';
+
+  meta = {
+    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 ];
+    license = licenses.openssl;
+    priority = 10; # resolves collision with ‘man-pages’
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/openssl/default.nix b/nixpkgs/pkgs/development/libraries/openssl/default.nix
new file mode 100644
index 000000000000..ef617a92eaa7
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/openssl/default.nix
@@ -0,0 +1,147 @@
+{ stdenv, fetchurl, buildPackages, perl, coreutils
+, withCryptodev ? false, cryptodev
+, enableSSL2 ? false
+, static ? false
+}:
+
+with stdenv.lib;
+
+let
+  common = args@{ version, sha256, patches ? [], withDocs ? false }: stdenv.mkDerivation rec {
+    name = "openssl-${version}";
+
+    src = fetchurl {
+      url = "https://www.openssl.org/source/${name}.tar.gz";
+      inherit sha256;
+    };
+
+    inherit patches;
+
+    postPatch = ''
+      patchShebangs Configure
+    '' + optionalString (versionOlder version "1.1.0") ''
+      patchShebangs test/*
+      for a in test/t* ; do
+        substituteInPlace "$a" \
+          --replace /bin/rm rm
+      done
+    '' + optionalString (versionAtLeast version "1.1.1") ''
+      substituteInPlace config --replace '/usr/bin/env' '${coreutils}/bin/env'
+    '' + optionalString (versionAtLeast version "1.1.0" && stdenv.hostPlatform.isMusl) ''
+      substituteInPlace crypto/async/arch/async_posix.h \
+        --replace '!defined(__ANDROID__) && !defined(__OpenBSD__)' \
+                  '!defined(__ANDROID__) && !defined(__OpenBSD__) && 0'
+    '';
+
+    outputs = [ "bin" "dev" "out" "man" ] ++ optional withDocs "doc";
+    setOutputFlags = false;
+    separateDebugInfo = stdenv.hostPlatform.isLinux;
+
+    nativeBuildInputs = [ perl ];
+    buildInputs = stdenv.lib.optional withCryptodev cryptodev;
+
+    # TODO(@Ericson2314): Improve with mass rebuild
+    configurePlatforms = [];
+    configureScript = {
+        "x86_64-darwin"  = "./Configure darwin64-x86_64-cc";
+        "x86_64-solaris" = "./Configure solaris64-x86_64-gcc";
+        "armv6l-linux" = "./Configure linux-armv4 -march=armv6";
+        "armv7l-linux" = "./Configure linux-armv4 -march=armv7-a";
+      }.${stdenv.hostPlatform.system} or (
+        if stdenv.hostPlatform == stdenv.buildPlatform
+          then "./config"
+        else if stdenv.hostPlatform.isMinGW
+          then "./Configure mingw${optionalString
+                                     (stdenv.hostPlatform.parsed.cpu.bits != 32)
+                                     (toString stdenv.hostPlatform.parsed.cpu.bits)}"
+        else if stdenv.hostPlatform.isLinux
+          then "./Configure linux-generic${toString stdenv.hostPlatform.parsed.cpu.bits}"
+        else if stdenv.hostPlatform.isiOS
+          then "./Configure ios${toString stdenv.hostPlatform.parsed.cpu.bits}-cross"
+        else
+          throw "Not sure what configuration to use for ${stdenv.hostPlatform.config}"
+      );
+
+    configureFlags = [
+      "shared" # "shared" builds both shared and static libraries
+      "--libdir=lib"
+      "--openssldir=etc/ssl"
+    ] ++ stdenv.lib.optionals withCryptodev [
+      "-DHAVE_CRYPTODEV"
+      "-DUSE_CRYPTODEV_DIGESTS"
+    ] ++ stdenv.lib.optional enableSSL2 "enable-ssl2"
+      ++ stdenv.lib.optional (versionAtLeast version "1.1.0" && stdenv.hostPlatform.isAarch64) "no-afalgeng";
+
+    makeFlags = [ "MANDIR=$(man)/share/man" ];
+
+    enableParallelBuilding = true;
+
+    postInstall =
+    stdenv.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
+          rm "$out/lib/"*.a
+      fi
+
+    '' +
+    ''
+      mkdir -p $bin
+      substituteInPlace $out/bin/c_rehash --replace ${buildPackages.perl} ${perl}
+      mv $out/bin $bin/
+
+      mkdir $dev
+      mv $out/include $dev/
+
+      # remove dependency on Perl at runtime
+      rm -r $out/etc/ssl/misc
+
+      rmdir $out/etc/ssl/{certs,private}
+    '';
+
+    postFixup = ''
+      # 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
+        exit 1
+      fi
+    '';
+
+    meta = with stdenv.lib; {
+      homepage = https://www.openssl.org/;
+      description = "A cryptographic library that implements the SSL and TLS protocols";
+      license = licenses.openssl;
+      platforms = platforms.all;
+      maintainers = [ maintainers.peti ];
+      priority = 10; # resolves collision with ‘man-pages’
+    };
+  };
+
+in {
+
+  openssl_1_0_2 = common {
+    version = "1.0.2s";
+    sha256 = "15mbmg8hf7s12vr3v2bdc0pi9y4pdbnsxhzk4fyyap42jaa5rgfa";
+    patches = [
+      ./1.0.2/nix-ssl-cert-file.patch
+
+      (if stdenv.hostPlatform.isDarwin
+       then ./1.0.2/use-etc-ssl-certs-darwin.patch
+       else ./1.0.2/use-etc-ssl-certs.patch)
+    ];
+  };
+
+  openssl_1_1 = common {
+    version = "1.1.1c";
+    sha256 = "142c7zdlz06hjrrvinb9f276czc78bnkyhd9xma621qmmmwk1yzn";
+    patches = [
+      ./1.1/nix-ssl-cert-file.patch
+
+      (if stdenv.hostPlatform.isDarwin
+       then ./1.1/use-etc-ssl-certs-darwin.patch
+       else ./1.1/use-etc-ssl-certs.patch)
+    ];
+    withDocs = true;
+  };
+
+}
diff --git a/nixpkgs/pkgs/development/libraries/opensubdiv/default.nix b/nixpkgs/pkgs/development/libraries/opensubdiv/default.nix
new file mode 100644
index 000000000000..57f1c9830a68
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/opensubdiv/default.nix
@@ -0,0 +1,54 @@
+{ config, lib, stdenv, fetchFromGitHub, cmake, pkgconfig, xorg, libGLU
+, libGL, glew, ocl-icd, python3
+, cudaSupport ? config.cudaSupport or false, cudatoolkit
+, darwin
+}:
+
+stdenv.mkDerivation rec {
+  name = "opensubdiv-${version}";
+  version = "3.3.3";
+
+  src = fetchFromGitHub {
+    owner = "PixarAnimationStudios";
+    repo = "OpenSubdiv";
+    rev = "v${lib.replaceChars ["."] ["_"] version}";
+    sha256 = "1rld4hgl9yrbnk5sd6bhvnm8jdnqq09hq93hrmx0nhccccximi9z";
+  };
+
+  outputs = [ "out" "dev" ];
+
+  buildInputs =
+    [ cmake pkgconfig libGLU libGL python3
+      # FIXME: these are not actually needed, but the configure script wants them.
+      glew xorg.libX11 xorg.libXrandr xorg.libXxf86vm xorg.libXcursor
+      xorg.libXinerama xorg.libXi
+    ]
+    ++ lib.optional (!stdenv.isDarwin) ocl-icd
+    ++ lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [OpenCL Cocoa CoreVideo IOKit AppKit AGL ])
+    ++ lib.optional cudaSupport cudatoolkit;
+
+  cmakeFlags =
+    [ "-DNO_TUTORIALS=1"
+      "-DNO_REGRESSION=1"
+      "-DNO_EXAMPLES=1"
+      "-DNO_METAL=1" # don’t have metal in apple sdk
+    ] ++ lib.optionals (!stdenv.isDarwin) [
+      "-DGLEW_INCLUDE_DIR=${glew.dev}/include"
+      "-DGLEW_LIBRARY=${glew.dev}/lib"
+    ] ++ lib.optionals cudaSupport [
+      "-DOSD_CUDA_NVCC_FLAGS=--gpu-architecture=compute_30"
+      "-DCUDA_HOST_COMPILER=${cudatoolkit.cc}/bin/cc"
+    ];
+
+  enableParallelBuilding = true;
+
+  postInstall = "rm $out/lib/*.a";
+
+  meta = {
+    description = "An Open-Source subdivision surface library";
+    homepage = http://graphics.pixar.com/opensubdiv;
+    platforms = lib.platforms.unix;
+    maintainers = [ lib.maintainers.eelco ];
+    license = lib.licenses.asl20;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/opentracing-cpp/default.nix b/nixpkgs/pkgs/development/libraries/opentracing-cpp/default.nix
new file mode 100644
index 000000000000..00f4f45df96a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/opentracing-cpp/default.nix
@@ -0,0 +1,20 @@
+{ stdenv, fetchFromGitHub, cmake }:
+stdenv.mkDerivation rec {
+  name = "opentracing-cpp-${version}";
+  version = "1.5.1";
+  src = fetchFromGitHub {
+    owner = "opentracing";
+    repo = "opentracing-cpp";
+    rev = "v${version}";
+    sha256 = "04kw19g8qrv3kd40va3sqbfish7kfczkdpxdwraifk9950wfs3gx";
+  };
+  buildInputs = [ cmake ];
+
+  meta = {
+    description = "C++ implementation of the OpenTracing API";
+    homepage = https://opentracing.io;
+    license = stdenv.lib.licenses.asl20;
+    maintainers = with stdenv.lib.maintainers; [ rob ];
+  };
+
+}
diff --git a/nixpkgs/pkgs/development/libraries/openvdb/default.nix b/nixpkgs/pkgs/development/libraries/openvdb/default.nix
new file mode 100644
index 000000000000..aa8032c52800
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/openvdb/default.nix
@@ -0,0 +1,49 @@
+{ stdenv, fetchFromGitHub, unzip, openexr, boost, jemalloc, c-blosc, ilmbase, tbb }:
+
+stdenv.mkDerivation rec
+{
+  name = "openvdb-${version}";
+  version = "6.0.0";
+
+  src = fetchFromGitHub {
+    owner = "dreamworksanimation";
+    repo = "openvdb";
+    rev = "v${version}";
+    sha256 = "07m012a966l821f09jmrrhs25cs2rcmhlxcicywibllaac10wk5k";
+  };
+
+  outputs = [ "out" ];
+
+  buildInputs = [ unzip openexr boost tbb jemalloc c-blosc ilmbase ];
+
+  setSourceRoot = ''
+    sourceRoot=$(echo */openvdb)
+  '';
+
+  installTargets = "install_lib";
+
+  enableParallelBuilding = true;
+
+  buildFlags = ''lib
+    DESTDIR=$(out)
+    HALF_LIB=-lHalf
+    TBB_LIB=-ltbb
+    BLOSC_LIB=-lblosc
+    LOG4CPLUS_LIB=
+    BLOSC_INCLUDE_DIR=${c-blosc}/include/
+    BLOSC_LIB_DIR=${c-blosc}/lib/
+  '';
+
+  installFlags = ''DESTDIR=$(out)'';
+
+  NIX_CFLAGS_COMPILE="-I${openexr.dev}/include/OpenEXR -I${ilmbase.dev}/include/OpenEXR/";
+  NIX_LDFLAGS="-lboost_iostreams";
+
+  meta = with stdenv.lib; {
+    description = "An open framework for voxel";
+    homepage = "https://www.openvdb.org";
+    maintainers = [ maintainers.guibou ];
+    platforms = platforms.linux;
+    license = licenses.mpl20;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/openwsman/default.nix b/nixpkgs/pkgs/development/libraries/openwsman/default.nix
new file mode 100644
index 000000000000..a986b71bc1dd
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/openwsman/default.nix
@@ -0,0 +1,40 @@
+{ stdenv, fetchFromGitHub, cmake, pkgconfig
+, curl, libxml2, pam, sblim-sfcc }:
+
+stdenv.mkDerivation rec {
+  name = "openwsman-${version}";
+  version = "2.6.9";
+
+  src = fetchFromGitHub {
+    owner  = "Openwsman";
+    repo   = "openwsman";
+    rev    = "v${version}";
+    sha256 = "19s5h551ppxmi2kljf8z58jjc6yrpczbxdrl4hh2l4jxv7iphk5i";
+  };
+
+  nativeBuildInputs = [ cmake pkgconfig ];
+
+  buildInputs = [ curl libxml2 pam sblim-sfcc ];
+
+  cmakeFlags = [
+    "-DCMAKE_BUILD_RUBY_GEM=no"
+    "-DBUILD_PYTHON=no"
+    "-DBUILD_PYTHON3=yes"
+  ];
+
+  preConfigure = ''
+    cmakeFlags="$cmakeFlags -DPACKAGE_ARCHITECTURE=$(uname -m)";
+  '';
+
+  configureFlags = [ "--disable-more-warnings" ];
+
+  meta = with stdenv.lib; {
+    description  = "Openwsman server implementation and client API with bindings";
+    downloadPage = https://github.com/Openwsman/openwsman/releases;
+    homepage     = https://openwsman.github.io;
+    license      = licenses.bsd3;
+    maintainers  = with maintainers; [ deepfire ];
+    platforms    = platforms.linux; # PAM is not available on Darwin
+    inherit version;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/openzwave/default.nix b/nixpkgs/pkgs/development/libraries/openzwave/default.nix
new file mode 100644
index 000000000000..5a5e8ffaef7c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/openzwave/default.nix
@@ -0,0 +1,60 @@
+{ stdenv, fetchFromGitHub
+, doxygen, fontconfig, graphviz-nox, libxml2, pkgconfig, which
+, systemd }:
+
+let
+  version = "2018-11-13";
+
+in stdenv.mkDerivation rec {
+  name = "openzwave-${version}";
+
+  # Use fork by Home Assistant because this package is mainly used for python.pkgs.homeassistant-pyozw.
+  # See https://github.com/OpenZWave/open-zwave/compare/master...home-assistant:hass for the difference.
+  src = fetchFromGitHub {
+    owner = "home-assistant";
+    repo = "open-zwave";
+    rev = "0679daef6aa5a39e2441a68f7b45cfe022c4d961";
+    sha256 = "1d13maj93i6h792cbvqpx43ffss44dxmvbwj2777vzvvjib8m4n8";
+  };
+
+  nativeBuildInputs = [ doxygen fontconfig graphviz-nox libxml2 pkgconfig which ];
+
+  buildInputs = [ systemd ];
+
+  hardeningDisable = [ "format" ];
+
+  enableParallelBuilding = true;
+
+  installPhase = ''
+    runHook preInstall
+
+    DESTDIR=$out PREFIX= pkgconfigdir=lib/pkgconfig make install $installFlags
+
+    runHook postInstall
+  '';
+
+  FONTCONFIG_FILE="${fontconfig.out}/etc/fonts/fonts.conf";
+  FONTCONFIG_PATH="${fontconfig.out}/etc/fonts/";
+
+  postPatch = ''
+    substituteInPlace cpp/src/Options.cpp \
+      --replace /etc/openzwave $out/etc/openzwave
+  '';
+
+  fixupPhase = ''
+    substituteInPlace $out/lib/pkgconfig/libopenzwave.pc \
+      --replace prefix= prefix=$out \
+      --replace dir=    dir=$out
+
+    substituteInPlace $out/bin/ozw_config \
+      --replace pcfile=${pkgconfig} pcfile=$out
+  '';
+
+  meta = with stdenv.lib; {
+    description = "C++ library to control Z-Wave Networks via a USB Z-Wave Controller";
+    homepage = http://www.openzwave.net/;
+    license = licenses.gpl3;
+    maintainers = with maintainers; [ etu ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/oracle-instantclient/default.nix b/nixpkgs/pkgs/development/libraries/oracle-instantclient/default.nix
new file mode 100644
index 000000000000..fe260e0c2ad2
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/oracle-instantclient/default.nix
@@ -0,0 +1,83 @@
+{ stdenv, requireFile, autoPatchelfHook, fixDarwinDylibNames, unzip, libaio, makeWrapper, odbcSupport ? false, unixODBC }:
+
+assert odbcSupport -> unixODBC != null;
+
+let
+  inherit (stdenv.lib) optional optionals optionalString;
+
+  baseVersion = "12.2";
+  version = "${baseVersion}.0.1.0";
+
+  requireSource = component: arch: version: rel: hash: (requireFile rec {
+    name = "instantclient-${component}-${arch}-${version}" + (optionalString (rel != "") "-${rel}") + ".zip";
+    url = "http://www.oracle.com/technetwork/database/database-technologies/instant-client/downloads/index.html";
+    sha256 = hash;
+  });
+
+  throwSystem = throw "Unsupported system: ${stdenv.hostPlatform.system}";
+
+  arch = {
+    "x86_64-linux" = "linux.x64";
+    "x86_64-darwin" = "macos.x64";
+  }."${stdenv.hostPlatform.system}" or throwSystem;
+
+  srcs = {
+    "x86_64-linux" = [
+      (requireSource "basic" arch version "" "5015e3c9fba84e009f7519893f798a1622c37d1ae2c55104ff502c52a0fe5194")
+      (requireSource "sdk" arch version "" "7f404c3573c062ce487a51ac4cfe650c878d7edf8e73b364ec852645ed1098cb")
+      (requireSource "sqlplus" arch version "" "d49b2bd97376591ca07e7a836278933c3f251875c215044feac73ba9f451dfc2") ]
+      ++ optional odbcSupport (requireSource "odbc" arch version "2" "365a4ae32c7062d9fbc3fb41add748e7881f774484a175a4b41a2c294ce9095d");
+    "x86_64-darwin" = [
+      (requireSource "basic" arch version "2" "3ed3102e5a24f0da638694191edb34933309fb472eb1df21ad5c86eedac3ebb9")
+      (requireSource "sdk" arch version "2" "e0befca9c4e71ebc9f444957ffa70f01aeeec5976ea27c40406471b04c34848b")
+      (requireSource "sqlplus" arch version "2" "d147cbb5b2a954fdcb4b642df4f0bd1153fd56e0f56e7fa301601b4f7e2abe0e") ]
+      ++ optional odbcSupport (requireSource "odbc" arch version "2" "1805c1ab6c8c5e8df7bdcc35d7f2b94c329ecf4dff9bde55d5f9b159ecd8b64e");
+  }."${stdenv.hostPlatform.system}" or throwSystem;
+
+  extLib = stdenv.hostPlatform.extensions.sharedLibrary;
+in stdenv.mkDerivation rec {
+  inherit version srcs;
+  name = "oracle-instantclient-${version}";
+
+  buildInputs = [ stdenv.cc.cc.lib ]
+    ++ optionals (stdenv.isLinux) [ libaio ]
+    ++ optional odbcSupport unixODBC;
+
+  nativeBuildInputs = [ makeWrapper unzip ]
+    ++ optional stdenv.isLinux autoPatchelfHook
+    ++ optional stdenv.isDarwin fixDarwinDylibNames;
+
+  unpackCmd = "unzip $curSrc";
+
+  installPhase = ''
+    mkdir -p "$out/"{bin,include,lib,"share/java","share/${name}/demo/"}
+    install -Dm755 {sqlplus,adrci,genezi} $out/bin
+    ${optionalString stdenv.isDarwin ''
+      for exe in "$out/bin/"* ; do
+        install_name_tool -add_rpath "$out/lib" "$exe"
+      done
+    ''}
+    ln -sfn $out/bin/sqlplus $out/bin/sqlplus64
+    install -Dm644 *${extLib}* $out/lib
+    install -Dm644 *.jar $out/share/java
+    install -Dm644 sdk/include/* $out/include
+    install -Dm644 sdk/demo/* $out/share/${name}/demo
+
+    # PECL::oci8 will not build without this
+    # this symlink only exists in dist zipfiles for some platforms
+    ln -sfn $out/lib/libclntsh${extLib}.12.1 $out/lib/libclntsh${extLib}
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Oracle instant client libraries and sqlplus CLI";
+    longDescription = ''
+      Oracle instant client provides access to Oracle databases (OCI,
+      OCCI, Pro*C, ODBC or JDBC). This package includes the sqlplus
+      command line SQL client.
+    '';
+    license = licenses.unfree;
+    platforms = [ "x86_64-linux" "x86_64-darwin" ];
+    maintainers = with maintainers; [ pesterhazy flokli ];
+    hydraPlatforms = [];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/ortp/default.nix b/nixpkgs/pkgs/development/libraries/ortp/default.nix
new file mode 100644
index 000000000000..e58e347c7f3e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/ortp/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, cmake, fetchFromGitHub, bctoolbox }:
+
+stdenv.mkDerivation rec {
+  baseName = "ortp";
+  version = "1.0.2";
+  name = "${baseName}-${version}";
+
+  src = fetchFromGitHub {
+    owner = "BelledonneCommunications";
+    repo = "${baseName}";
+    rev = "${version}";
+    sha256 = "12cwv593bsdnxs0zfcp07vwyk7ghlz2wv7vdbs1ksv293w3vj2rv";
+  };
+
+  buildInputs = [ bctoolbox ];
+  nativeBuildInputs = [ cmake ];
+
+  meta = with stdenv.lib; {
+    description = "A Real-Time Transport Protocol (RFC3550) stack";
+    homepage = http://www.linphone.org/index.php/eng/code_review/ortp;
+    license = licenses.lgpl21;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/osip/default.nix b/nixpkgs/pkgs/development/libraries/osip/default.nix
new file mode 100644
index 000000000000..ce917ccbe7f4
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/osip/default.nix
@@ -0,0 +1,18 @@
+{stdenv, fetchurl}:
+stdenv.mkDerivation rec {
+  version = "5.1.0";
+  src = fetchurl {
+    url = "mirror://gnu/osip/libosip2-${version}.tar.gz";
+    sha256 = "0igic785fh458ck33kxb6i34l7bzdp9zpfjy5dxrcvv5gacklms0";
+  };
+  name = "libosip2-${version}";
+
+  meta = {
+    license = stdenv.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;
+    inherit version;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/osip/default.upstream b/nixpkgs/pkgs/development/libraries/osip/default.upstream
new file mode 100644
index 000000000000..ba0ed2a9b299
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/osip/default.upstream
@@ -0,0 +1,3 @@
+url http://ftp.u-tx.net/gnu/osip/
+attribute_name libosip
+minimize_overwrite
diff --git a/nixpkgs/pkgs/development/libraries/osm-gps-map/default.nix b/nixpkgs/pkgs/development/libraries/osm-gps-map/default.nix
new file mode 100644
index 000000000000..a1e7215fd9a2
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/osm-gps-map/default.nix
@@ -0,0 +1,28 @@
+{ cairo, fetchzip, glib, gnome3, gtk3, gobject-introspection, pkgconfig, stdenv }:
+
+stdenv.mkDerivation rec {
+  name = "osm-gps-map-${version}";
+  version = "1.1.0";
+
+  src = fetchzip {
+    url = "https://github.com/nzjrs/osm-gps-map/releases/download/${version}/osm-gps-map-${version}.tar.gz";
+    sha256 = "0fal3mqcf3yypir4f7njz0dm5wr7lqwpimjx28wz9imh48cqx9n9";
+  };
+
+  outputs = [ "out" "dev" "doc" ];
+
+  nativeBuildInputs = [ pkgconfig ];
+
+  buildInputs = [
+    cairo glib gobject-introspection
+    gnome3.gnome-common gtk3 gnome3.libsoup
+  ];
+
+  meta = with stdenv.lib; {
+    description = "Gtk+ widget for displaying OpenStreetMap tiles";
+    homepage = https://nzjrs.github.io/osm-gps-map;
+    license = licenses.gpl2Plus;
+    maintainers = with maintainers; [ hrdinka ];
+    platforms = platforms.linux ++ platforms.darwin;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/p11-kit/default.nix b/nixpkgs/pkgs/development/libraries/p11-kit/default.nix
new file mode 100644
index 000000000000..0e1be8633468
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/p11-kit/default.nix
@@ -0,0 +1,62 @@
+{ stdenv, fetchFromGitHub, fetchpatch, autoreconfHook, pkgconfig, which
+, gettext, libffi, libiconv, libtasn1
+}:
+
+stdenv.mkDerivation rec {
+  pname = "p11-kit";
+  version = "0.23.15";
+
+  src = fetchFromGitHub {
+    owner = "p11-glue";
+    repo = pname;
+    rev = version;
+    sha256 = "0kf7zz2cvd6j09qkff3rl3wfisva82ia1z9h8bmy4ifwkv4yl9fv";
+  };
+
+  patches = [
+    (fetchpatch {
+      # https://github.com/p11-glue/p11-kit/issues/212
+      url = "https://github.com/p11-glue/p11-kit/commit/2a474e1fe8f4bd8b4ed7622e5cf3b2718a202562.patch";
+      sha256 = "13wi32hpzilvzxn57crn79h88q38jm2fzd5zxj4wnhv9dhwqr6lg";
+    })
+    (fetchpatch {
+      # https://github.com/p11-glue/p11-kit/issues/220
+      url = "https://github.com/p11-glue/p11-kit/commit/e2170b295992cb7fdf115227a78028ac3780619f.patch";
+      sha256 = "0433d8drfxaabsxwkkl4kr0jx8jr2l3a9ar11szipd9jwvrqnyr7";
+    })
+  ];
+
+  outputs = [ "out" "dev"];
+  outputBin = "dev";
+
+  nativeBuildInputs = [ autoreconfHook pkgconfig which ];
+  buildInputs = [ gettext libffi libiconv libtasn1 ];
+
+  autoreconfPhase = ''
+    NOCONFIGURE=1 ./autogen.sh
+  '';
+
+  configureFlags = [
+    "--sysconfdir=/etc"
+    "--localstatedir=/var"
+    "--without-trust-paths"
+  ]; # TODO: store trust anchors in a directory common to Nix and NixOS
+
+  enableParallelBuilding = true;
+
+  doCheck = !stdenv.isDarwin;
+
+  installFlags = [ "exampledir=\${out}/etc/pkcs11" ];
+
+  meta = with stdenv.lib; {
+    description = "Library for loading and sharing PKCS#11 modules";
+    longDescription = ''
+      Provides a way to load and enumerate PKCS#11 modules.
+      Provides a standard configuration setup for installing
+      PKCS#11 modules in such a way that they're discoverable.
+    '';
+    homepage = https://p11-glue.github.io/p11-glue/p11-kit.html;
+    platforms = platforms.all;
+    license = licenses.bsd3;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/pagmo2/default.nix b/nixpkgs/pkgs/development/libraries/pagmo2/default.nix
new file mode 100644
index 000000000000..842fae5ea938
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/pagmo2/default.nix
@@ -0,0 +1,44 @@
+{ lib
+, fetchFromGitHub
+, stdenv
+, cmake
+, eigen
+, nlopt
+, ipopt
+, boost
+, writeText
+}:
+
+stdenv.mkDerivation rec {
+  name = "pagmo2-${version}";
+  version = "2.9";
+
+  src = fetchFromGitHub {
+     owner = "esa";
+     repo = "pagmo2";
+     rev = "v${version}";
+     sha256 = "0al2i59m5qr83wz5n5408zvys0b3mc40rszf0l5b9a0gp1axj400";
+  };
+
+  nativeBuildInputs = [ cmake ];
+  buildInputs = [ eigen nlopt ipopt boost ];
+
+  cmakeFlags = [
+    "-DPAGMO_BUILD_TESTS=no"
+    "-DPAGMO_WITH_EIGEN3=yes"
+    "-DPAGMO_WITH_NLOPT=yes"
+    "-DNLOPT_LIBRARY=${nlopt}/lib/libnlopt.so"
+    "-DPAGMO_WITH_IPOPT=yes"
+    "-DCMAKE_CXX_FLAGS='-fuse-ld=gold'"
+  ];
+
+  # tests pass but take 30+ minutes
+  doCheck = false;
+
+  meta = with stdenv.lib; {
+    homepage = https://esa.github.io/pagmo2/;
+    description = "Scientific library for massively parallel optimization";
+    license = licenses.gpl3Plus;
+    maintainers = [ maintainers.costrouc ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/pango/default.nix b/nixpkgs/pkgs/development/libraries/pango/default.nix
new file mode 100644
index 000000000000..b67db91ef642
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/pango/default.nix
@@ -0,0 +1,83 @@
+{ stdenv, fetchurl, pkgconfig, cairo, harfbuzz
+, libintl, 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;
+
+let
+  pname = "pango";
+  version = "1.43.0";
+in stdenv.mkDerivation rec {
+  name = "${pname}-${version}";
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${name}.tar.xz";
+    sha256 = "1lnxldmv1a12dq5h0dlq5jyzl4w75k76dp8cn360x2ijlm9w5h6j";
+  };
+
+  # FIXME: docs fail on darwin
+  outputs = [ "bin" "dev" "out" ] ++ optional (!stdenv.isDarwin) "devdoc";
+
+  nativeBuildInputs = [
+    meson ninja
+    pkgconfig gobject-introspection gtk-doc docbook_xsl docbook_xml_dtd_43
+  ];
+  buildInputs = [
+    harfbuzz fribidi
+  ] ++ optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [
+    ApplicationServices
+    Carbon
+    CoreGraphics
+    CoreText
+  ]);
+  propagatedBuildInputs = [ cairo glib libintl ] ++
+    optional x11Support libXft;
+
+  patches = [
+    (fetchurl {
+      # Add gobject-2 to .pc file
+      url = "https://gitlab.gnome.org/GNOME/pango/commit/546f4c242d6f4fe312de3b7c918a848e5172e18d.patch";
+      sha256 = "034na38cq98vk8gggn3yfr65jmv3jgig8d25zg89wydrandp14yr";
+    })
+  ];
+
+  mesonFlags = [
+    "-Denable_docs=${if stdenv.isDarwin then "false" else "true"}"
+  ];
+
+  enableParallelBuilding = true;
+
+  # Fontconfig error: Cannot load default config file
+  FONTCONFIG_FILE = makeFontsConf {
+    fontDirectories = [ freefont_ttf ];
+  };
+
+  doCheck = false; # /layout/valid-1.markup: FAIL
+
+  passthru = {
+    updateScript = gnome3.updateScript {
+      packageName = pname;
+    };
+  };
+
+  meta = with stdenv.lib; {
+    description = "A library for laying out and rendering of text, with an emphasis on internationalization";
+
+    longDescription = ''
+      Pango is a library for laying out and rendering of text, with an
+      emphasis on internationalization.  Pango can be used anywhere
+      that text layout is needed, though most of the work on Pango so
+      far has been done in the context of the GTK+ widget toolkit.
+      Pango forms the core of text and font handling for GTK+-2.x.
+    '';
+
+    homepage = https://www.pango.org/;
+    license = licenses.lgpl2Plus;
+
+    maintainers = with maintainers; [ raskin ];
+    platforms = platforms.linux ++ platforms.darwin;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/pangolin/default.nix b/nixpkgs/pkgs/development/libraries/pangolin/default.nix
new file mode 100644
index 000000000000..6fb123f50949
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/pangolin/default.nix
@@ -0,0 +1,57 @@
+{ stdenv, lib, fetchFromGitHub, cmake, pkgconfig, doxygen, libGL, glew
+, xorg , ffmpeg, python3 , libjpeg, libpng, libtiff, eigen
+, Carbon ? null, Cocoa ? null
+}:
+
+stdenv.mkDerivation rec {
+  name = "pangolin-${version}";
+
+  version = "2017-08-02";
+
+  src = fetchFromGitHub {
+    owner = "stevenlovegrove";
+    repo = "Pangolin";
+    rev = "f05a8cdc4f0e32cc1664a430f1f85e60e233c407";
+    sha256 = "0pfbaarlsw7f7cmsppm7m13nz0k530wwwyczy2l9k448p3v7x9j0";
+  };
+
+  nativeBuildInputs = [ cmake pkgconfig doxygen ]; 
+
+  buildInputs = [ 
+    libGL 
+    glew 
+    xorg.libX11 
+    ffmpeg 
+    python3 
+    libjpeg 
+    libpng 
+    libtiff 
+    eigen 
+  ]
+  ++ lib.optionals stdenv.isDarwin [ Carbon Cocoa ];
+
+  enableParallelBuilding = true;
+
+  # The tests use cmake's findPackage to find the installed version of
+  # pangolin, which isn't what we want (or available).
+  doCheck = false;
+  cmakeFlags = [ "-DBUILD_TESTS=OFF" ];
+
+  meta = {
+    description = "A lightweight portable rapid development library for managing OpenGL display / interaction and abstracting video input";
+    longDescription = ''
+      Pangolin is a lightweight portable rapid development library for managing
+      OpenGL display / interaction and abstracting video input. At its heart is
+      a simple OpenGl viewport manager which can help to modularise 3D
+      visualisation without adding to its complexity, and offers an advanced
+      but intuitive 3D navigation handler. Pangolin also provides a mechanism
+      for manipulating program variables through config files and ui
+      integration, and has a flexible real-time plotter for visualising
+      graphical data.
+    '';
+    homepage = https://github.com/stevenlovegrove/Pangolin;
+    license = stdenv.lib.licenses.mit;
+    maintainers = [ stdenv.lib.maintainers.expipiplus1 ];
+    platforms = stdenv.lib.platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/pangomm/default.nix b/nixpkgs/pkgs/development/libraries/pangomm/default.nix
new file mode 100644
index 000000000000..064ebf71cc32
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/pangomm/default.nix
@@ -0,0 +1,43 @@
+{ stdenv, fetchurl, pkgconfig, pango, glibmm, cairomm, gnome3
+, ApplicationServices }:
+
+stdenv.mkDerivation rec {
+  pname = "pangomm";
+  version= "2.42.0";
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    sha256 = "0mmzxp3wniaafkxr30sb22mq9x44xckb5d60h1bl99lkzxks0vfa";
+  };
+
+  outputs = [ "out" "dev" ];
+
+  nativeBuildInputs = [ pkgconfig ] ++ stdenv.lib.optional stdenv.isDarwin [
+    ApplicationServices
+  ];
+  propagatedBuildInputs = [ pango glibmm cairomm ];
+
+  doCheck = true;
+
+  passthru = {
+    updateScript = gnome3.updateScript {
+      packageName = pname;
+    };
+  };
+
+  meta = with stdenv.lib; {
+    description = "C++ interface to the Pango text rendering library";
+    homepage    = https://www.pango.org/;
+    license     = with licenses; [ lgpl2 lgpl21 ];
+    maintainers = with maintainers; [ lovek323 raskin ];
+    platforms   = platforms.unix;
+
+    longDescription = ''
+      Pango is a library for laying out and rendering of text, with an
+      emphasis on internationalization.  Pango can be used anywhere
+      that text layout is needed, though most of the work on Pango so
+      far has been done in the context of the GTK+ widget toolkit.
+      Pango forms the core of text and font handling for GTK+-2.x.
+    '';
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/pangox-compat/default.nix b/nixpkgs/pkgs/development/libraries/pangox-compat/default.nix
new file mode 100644
index 000000000000..1ae2f1b81321
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/pangox-compat/default.nix
@@ -0,0 +1,21 @@
+{ stdenv, fetchurl, pkgconfig, glib, pango, libX11 }:
+
+stdenv.mkDerivation rec {
+  pname = "pangox-compat";
+  version = "0.0.2";
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    sha256 = "0ip0ziys6mrqqmz4n71ays0kf5cs1xflj1gfpvs4fgy2nsrr482m";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ glib pango libX11 ];
+
+  meta = {
+    description = "A compatibility library for pango>1.30.*";
+    homepage = "https://gitlab.gnome.org/Archive/pangox-compat";
+    license = stdenv.lib.licenses.lgpl2Plus;
+    platforms = stdenv.lib.platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/pangoxsl/default.nix b/nixpkgs/pkgs/development/libraries/pangoxsl/default.nix
new file mode 100644
index 000000000000..b69ded648397
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/pangoxsl/default.nix
@@ -0,0 +1,22 @@
+{stdenv, fetchurl, pkgconfig, glib, pango}:
+
+stdenv.mkDerivation {
+  name = "pangoxsl-1.6.0.3";
+  src = fetchurl {
+    url = mirror://sourceforge/pangopdf/pangoxsl-1.6.0.3.tar.gz;
+    sha256 = "1wcd553nf4nwkrfrh765cyzwj9bsg7zpkndg2hjs8mhwgx04lm8n";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [
+    glib
+    pango
+  ];
+
+  meta = with stdenv.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;
+    license = licenses.lgpl2;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/parquet-cpp/api.patch b/nixpkgs/pkgs/development/libraries/parquet-cpp/api.patch
new file mode 100644
index 000000000000..3fd567ea098f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/parquet-cpp/api.patch
@@ -0,0 +1,12 @@
+diff --git a/src/parquet/arrow/reader.cc b/src/parquet/arrow/reader.cc
+--- a/src/parquet/arrow/reader.cc
++++ b/src/parquet/arrow/reader.cc
+@@ -1421,7 +1421,7 @@ Status StructImpl::DefLevelsToNullArray(std::shared_ptr<Buffer>* null_bitmap_out
+   const int16_t* def_levels_data;
+   size_t def_levels_length;
+   RETURN_NOT_OK(GetDefLevels(&def_levels_data, &def_levels_length));
+-  RETURN_NOT_OK(AllocateEmptyBitmap(pool_, def_levels_length, &null_bitmap));
++  RETURN_NOT_OK(GetEmptyBitmap(pool_, def_levels_length, &null_bitmap));
+   uint8_t* null_bitmap_ptr = null_bitmap->mutable_data();
+   for (size_t i = 0; i < def_levels_length; i++) {
+     if (def_levels_data[i] < struct_def_level_) {
diff --git a/nixpkgs/pkgs/development/libraries/partio/default.nix b/nixpkgs/pkgs/development/libraries/partio/default.nix
new file mode 100644
index 000000000000..b45ed2966916
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/partio/default.nix
@@ -0,0 +1,45 @@
+{ stdenv, fetchFromGitHub, unzip, cmake, freeglut, libGLU_combined, zlib, swig, python, doxygen, xorg }:
+
+stdenv.mkDerivation rec
+{
+  name = "partio-${version}";
+  version = "2018-03-01";
+
+  src = fetchFromGitHub {
+    owner = "wdas";
+    repo = "partio";
+    rev = "8b6ea0d20f1ab77cd7f18390999251e60932de4a";
+    sha256 = "16sdj103v02l2dgq9y9cna9jakafabz9jxzdxsd737ir6wn10ksb";
+  };
+
+  outputs = [ "dev" "out" "lib" ];
+
+  nativeBuildInputs = [ unzip cmake doxygen ];
+  buildInputs = [ freeglut libGLU_combined zlib swig python xorg.libXi xorg.libXmu ];
+
+  enableParallelBuilding = true;
+
+  buildPhase = ''
+    make partio
+
+    mkdir $dev
+    mkdir $out
+      '';
+
+  # TODO:
+  # Sexpr support
+
+  installPhase = ''
+    make install prefix=$out
+    mkdir $dev/include/partio
+    mv $dev/include/*.h $dev/include/partio
+  '';
+
+  meta = with stdenv.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;
+    platforms = platforms.linux;
+    maintainers = [ maintainers.guibou ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/pcaudiolib/default.nix b/nixpkgs/pkgs/development/libraries/pcaudiolib/default.nix
new file mode 100644
index 000000000000..2050e5cdfe79
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/pcaudiolib/default.nix
@@ -0,0 +1,30 @@
+{ config, stdenv, lib, fetchFromGitHub
+, autoconf, automake, which, libtool, pkgconfig
+, portaudio, alsaLib
+, pulseaudioSupport ? config.pulseaudio or stdenv.isLinux, libpulseaudio }:
+
+stdenv.mkDerivation rec {
+  name = "pcaudiolib-${version}";
+  version = "2016-07-19";
+
+  src = fetchFromGitHub {
+    owner = "rhdunn";
+    repo = "pcaudiolib";
+    rev = "4f836ea909bdaa8a6e0e89c587efc745b546b459";
+    sha256 = "0z99nh4ibb9md2cd21762n1dmv6jk988785s1cxd8lsy4hp4pwfa";
+  };
+
+  nativeBuildInputs = [ autoconf automake which libtool pkgconfig ];
+
+  buildInputs = [ portaudio alsaLib ] ++ lib.optional pulseaudioSupport libpulseaudio;
+
+  preConfigure = "./autogen.sh";
+
+  meta = with stdenv.lib; {
+    description = "Provides a C API to different audio devices";
+    homepage = https://github.com/rhdunn/pcaudiolib;
+    license = licenses.gpl3;
+    maintainers = with maintainers; [ aske ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/pcg-c/default.nix b/nixpkgs/pkgs/development/libraries/pcg-c/default.nix
new file mode 100644
index 000000000000..654698c1b32d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/pcg-c/default.nix
@@ -0,0 +1,39 @@
+{ stdenv, fetchzip }:
+
+with stdenv.lib;
+
+stdenv.mkDerivation rec {
+  version = "0.94";
+  name = "pcg-c-${version}";
+
+  src = fetchzip {
+    url = "http://www.pcg-random.org/downloads/${name}.zip";
+    sha256 = "0smm811xbvs03a5nc2668zd0178wnyri2h023pqffy767bpy1vlv";
+  };
+
+  enableParallelBuilding = true;
+
+  patches = [
+    ./prefix-variable.patch
+    ];
+
+  preInstall = ''
+    sed -i s,/usr/local,$out, Makefile
+    mkdir -p $out/lib $out/include
+  '';
+
+  meta = {
+    description = "A family of better random number generators";
+    homepage = http://www.pcg-random.org/;
+    license = stdenv.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,
+      they are also hard to predict.
+    '';
+    platforms = platforms.unix;
+    maintainers = [ maintainers.linus ];
+    repositories.git = git://github.com/imneme/pcg-c.git;
+    broken = stdenv.isi686; # https://github.com/imneme/pcg-c/issues/11
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/pcg-c/prefix-variable.patch b/nixpkgs/pkgs/development/libraries/pcg-c/prefix-variable.patch
new file mode 100644
index 000000000000..bfdcdfa7b17e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/pcg-c/prefix-variable.patch
@@ -0,0 +1,15 @@
+diff --git a/Makefile b/Makefile
+index dddea44..fdb9401 100644
+--- a/Makefile
++++ b/Makefile
+@@ -30,8 +30,8 @@ all:
+ PREFIX = /usr/local
+ 
+ install: all
+-	install src/libpcg_random.a $PREFIX/lib
+-	install -m 0644 include/pcg_variants.h $PREFIX/include
++	install src/libpcg_random.a ${PREFIX}/lib
++	install -m 0644 include/pcg_variants.h ${PREFIX}/include
+ 
+ test:   all
+ 	cd test-low; $(MAKE) test
diff --git a/nixpkgs/pkgs/development/libraries/pcl/default.nix b/nixpkgs/pkgs/development/libraries/pcl/default.nix
new file mode 100644
index 000000000000..08a1613c2feb
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/pcl/default.nix
@@ -0,0 +1,34 @@
+{ stdenv, fetchFromGitHub, fetchpatch, cmake
+, qhull, flann, boost, vtk, eigen, pkgconfig, qtbase
+, libusb1, libpcap, libXt, libpng, Cocoa, AGL, cf-private, OpenGL
+}:
+
+stdenv.mkDerivation rec {
+  name = "pcl-1.9.1";
+
+  src = fetchFromGitHub {
+    owner = "PointCloudLibrary";
+    repo = "pcl";
+    rev = name;
+    sha256 = "0g0am3bf14sadfw231l5nmf5d2g1p9i7yq12c6q8rl7nw501ny9j";
+  };
+
+  enableParallelBuilding = true;
+
+  nativeBuildInputs = [ pkgconfig cmake ];
+  buildInputs = [ qhull flann boost eigen libusb1 libpcap
+                  libpng vtk qtbase libXt ]
+
+    ++ stdenv.lib.optionals stdenv.isDarwin [ Cocoa AGL cf-private ];
+  cmakeFlags = stdenv.lib.optionals stdenv.isDarwin [
+    "-DOPENGL_INCLUDE_DIR=${OpenGL}/Library/Frameworks"
+  ];
+
+  meta = {
+    homepage = http://pointclouds.org/;
+    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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/pcre/default.nix b/nixpkgs/pkgs/development/libraries/pcre/default.nix
new file mode 100644
index 000000000000..6d2896ac3396
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/pcre/default.nix
@@ -0,0 +1,67 @@
+{ stdenv, fetchurl
+, pcre, windows ? null
+, variant ? null
+}:
+
+with stdenv.lib;
+
+assert elem variant [ null "cpp" "pcre16" "pcre32" ];
+
+let
+  version = "8.43";
+  pname = if (variant == null) then "pcre"
+    else  if (variant == "cpp") then "pcre-cpp"
+    else  variant;
+
+in stdenv.mkDerivation rec {
+  name = "${pname}-${version}";
+
+  src = fetchurl {
+    url = "https://ftp.pcre.org/pub/pcre/pcre-${version}.tar.bz2";
+    sha256 = "0sxg1wlknq05ryq63h21cchjmcjkin9lmnqsmhs3h08301965rwi";
+  };
+
+  outputs = [ "bin" "dev" "out" "doc" "man" ];
+
+  configureFlags = optional (!stdenv.hostPlatform.isRiscV) "--enable-jit" ++ [
+    "--enable-unicode-properties"
+    "--disable-cpp"
+  ]
+    ++ optional (variant != null) "--enable-${variant}";
+
+  buildInputs = optional (stdenv.hostPlatform.libc == "msvcrt") windows.mingw_w64_pthreads;
+
+  # https://bugs.exim.org/show_bug.cgi?id=2173
+  patches = [ ./stacksize-detection.patch ];
+
+  preCheck = ''
+    patchShebangs RunGrepTest
+  '';
+
+  doCheck = !(with stdenv.hostPlatform; isCygwin || isFreeBSD) && stdenv.hostPlatform == stdenv.buildPlatform;
+    # XXX: test failure on Cygwin
+    # we are running out of stack on both freeBSDs on Hydra
+
+  postFixup = ''
+    moveToOutput bin/pcre-config "$dev"
+  ''
+    + optionalString (variant != null) ''
+    ln -sf -t "$out/lib/" '${pcre.out}'/lib/libpcre{,posix}.{so.*.*.*,*dylib}
+  '';
+
+  meta = {
+    homepage = http://www.pcre.org/;
+    description = "A library for Perl Compatible Regular Expressions";
+    license = stdenv.lib.licenses.bsd3;
+
+    longDescription = ''
+      The PCRE library is a set of functions that implement regular
+      expression pattern matching using the same syntax and semantics as
+      Perl 5. PCRE has its own native API, as well as a set of wrapper
+      functions that correspond to the POSIX regular expression API. The
+      PCRE library is free, even for building proprietary software.
+    '';
+
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/pcre/stacksize-detection.patch b/nixpkgs/pkgs/development/libraries/pcre/stacksize-detection.patch
new file mode 100644
index 000000000000..4bc97069b1e2
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/pcre/stacksize-detection.patch
@@ -0,0 +1,16 @@
+diff --git a/pcre_exec.c b/pcre_exec.c
+--- a/pcre_exec.c
++++ b/pcre_exec.c
+@@ -509,6 +509,12 @@
+                  (e.g. stopped by repeated call or recursion limit)
+ */
+ 
++#ifdef __GNUC__
++static int
++match(REGISTER PCRE_PUCHAR eptr, REGISTER const pcre_uchar *ecode,
++  PCRE_PUCHAR mstart, int offset_top, match_data *md, eptrblock *eptrb,
++  unsigned int rdepth) __attribute__((noinline,noclone));
++#endif
+ static int
+ match(REGISTER PCRE_PUCHAR eptr, REGISTER const pcre_uchar *ecode,
+   PCRE_PUCHAR mstart, int offset_top, match_data *md, eptrblock *eptrb,
diff --git a/nixpkgs/pkgs/development/libraries/pcre2/default.nix b/nixpkgs/pkgs/development/libraries/pcre2/default.nix
new file mode 100644
index 000000000000..f080de82ddc2
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/pcre2/default.nix
@@ -0,0 +1,32 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "pcre2-${version}";
+  version = "10.33";
+  src = fetchurl {
+    url = "https://ftp.pcre.org/pub/pcre/${name}.tar.bz2";
+    sha256 = "1anqi7vpbfzag7imccrc6di1zl5rl63ab7rfpmajpw6d1kzlsl9m";
+  };
+
+  configureFlags = [
+    "--enable-pcre2-16"
+    "--enable-pcre2-32"
+    "--enable-jit"
+  ];
+
+  outputs = [ "bin" "dev" "out" "doc" "man" "devdoc" ];
+
+  doCheck = false; # fails 1 out of 3 tests, looks like a bug
+
+  postFixup = ''
+    moveToOutput bin/pcre2-config "$dev"
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Perl Compatible Regular Expressions";
+    homepage = http://www.pcre.org/;
+    license = licenses.bsd3;
+    maintainers = with maintainers; [ ttuegel ];
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/pdf2xml/default.nix b/nixpkgs/pkgs/development/libraries/pdf2xml/default.nix
new file mode 100644
index 000000000000..c4cb57f3fa22
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/pdf2xml/default.nix
@@ -0,0 +1,38 @@
+{stdenv, fetchurl, libxpdf, libxml2}:
+
+stdenv.mkDerivation {
+  name = "pdf2xml";
+
+  src = fetchurl {
+      url = http://tarballs.nixos.org/pdf2xml.tar.gz;
+      sha256 = "04rl7ppxqgnvxvvws669cxp478lnrdmiqj0g3m4p69bawfjc4z3w";
+  };
+  sourceRoot = "pdf2xml/pdf2xml";
+
+  buildInputs = [libxml2 libxpdf];
+
+  patches = [./pdf2xml.patch];
+
+  hardeningDisable = [ "format" ];
+
+  preBuild = ''
+    cp Makefile.linux Makefile
+
+    sed -i 's|/usr/include/libxml2|${libxml2.dev}/include/libxml2|' Makefile
+    sed -i 's|-lxml2|-lxml2 -L${libxml2.out}/lib|' Makefile
+    sed -i 's|XPDF = xpdf_3.01|XPDF = ${libxpdf}/lib|' Makefile
+
+    mkdir exe
+
+    buildFlags+=" CXX=$CXX"
+  '';
+
+  installPhase = ''
+    mkdir -p $out/bin
+    cp exe/* $out/bin
+  '';
+
+  meta = {
+    platforms = stdenv.lib.platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/pdf2xml/pdf2xml.patch b/nixpkgs/pkgs/development/libraries/pdf2xml/pdf2xml.patch
new file mode 100644
index 000000000000..596a3aea6749
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/pdf2xml/pdf2xml.patch
@@ -0,0 +1,48 @@
+diff -rc pdf2xml/pdf2xml/Makefile.linux pdf2xml-new/pdf2xml/Makefile.linux
+*** pdf2xml/Makefile.linux	2008-02-07 17:43:10.000000000 +0100
+--- pdf2xml-new/Makefile.linux	2010-08-25 15:41:23.000000000 +0200
+***************
+*** 30,36 ****
+  
+  
+  # Executable name
+! PDFTOXMLEXE=pdftoxml.exe
+  
+  # Main target
+  all: pdftoxmlEXE
+--- 30,36 ----
+  
+  
+  # Executable name
+! PDFTOXMLEXE=pdftoxml
+  
+  # Main target
+  all: pdftoxmlEXE
+diff -rc pdf2xml/pdf2xml/src/pdftoxml.cc pdf2xml-new/pdf2xml/src/pdftoxml.cc
+*** pdf2xml/src/pdftoxml.cc	2010-04-26 10:58:01.000000000 +0200
+--- pdf2xml-new/src/pdftoxml.cc	2010-08-25 15:36:15.000000000 +0200
+***************
+*** 11,21 ****
+  //
+  //===========================================================================
+  
+  #include <aconf.h>
+- #include <stdio.h>
+  #include <stdlib.h>
+  #include <stddef.h>
+! #include <string.h>
+  #include "parseargs.h"
+  #include "GString.h"
+  #include "gmem.h"
+--- 11,21 ----
+  //
+  //===========================================================================
+  
++ #include <string.h>
+  #include <aconf.h>
+  #include <stdlib.h>
+  #include <stddef.h>
+! #include <cstdio>
+  #include "parseargs.h"
+  #include "GString.h"
+  #include "gmem.h"
diff --git a/nixpkgs/pkgs/development/libraries/phash/default.nix b/nixpkgs/pkgs/development/libraries/phash/default.nix
new file mode 100644
index 000000000000..4cc607345e8c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/phash/default.nix
@@ -0,0 +1,38 @@
+{ stdenv, fetchFromGitHub, pkgconfig, cimg, imagemagick }:
+
+stdenv.mkDerivation rec {
+  name = "${pname}-${version}";
+  pname = "pHash";
+  version = "0.9.4";
+
+  buildInputs = [ cimg ];
+
+  # CImg.h calls to external binary `convert` from the `imagemagick` package
+  # at runtime
+  propagatedBuildInputs = [ imagemagick ];
+
+  nativeBuildInputs = [ pkgconfig ];
+
+  configureFlags = ["--enable-video-hash=no" "--enable-audio-hash=no"];
+  postInstall = ''
+    cp ${cimg}/include/CImg.h $out/include/
+  '';
+
+  src = fetchFromGitHub {
+    owner = "clearscene";
+    repo = "pHash";
+    rev = version;
+    sha256 = "0y4gknfkns5sssfaj0snyx29752my20xmxajg6xggijx0myabbv0";
+  };
+
+  meta = with stdenv.lib; {
+    inherit version;
+    description = "Compute the perceptual hash of an image";
+    license = licenses.gpl3;
+    maintainers = [maintainers.imalsogreg];
+    platforms = platforms.all;
+    homepage = http://www.phash.org;
+    downloadPage = "https://github.com/clearscene/pHash";
+    updateWalker = true;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/phonon/backends/gst-plugin-paths.patch b/nixpkgs/pkgs/development/libraries/phonon/backends/gst-plugin-paths.patch
new file mode 100644
index 000000000000..39c1b9c0d290
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/phonon/backends/gst-plugin-paths.patch
@@ -0,0 +1,13 @@
+Index: phonon-gstreamer-4.9.0/gstreamer/backend.cpp
+===================================================================
+--- phonon-gstreamer-4.9.0.orig/gstreamer/backend.cpp
++++ phonon-gstreamer-4.9.0/gstreamer/backend.cpp
+@@ -85,6 +85,8 @@ Backend::Backend(QObject *parent, const
+         "--gst-debug-no-color"
+     };
+ 
++    qputenv("GST_PLUGIN_PATH_1_0", GST_PLUGIN_PATH_1_0);
++
+     int argc = sizeof(args) / sizeof(*args);
+     char **argv = const_cast<char**>(args);
+     GError *err = 0;
diff --git a/nixpkgs/pkgs/development/libraries/phonon/backends/gstreamer.nix b/nixpkgs/pkgs/development/libraries/phonon/backends/gstreamer.nix
new file mode 100644
index 000000000000..67f343d60380
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/phonon/backends/gstreamer.nix
@@ -0,0 +1,68 @@
+{ stdenv, lib, fetchurl, cmake, gst_all_1, phonon, pkgconfig
+, extra-cmake-modules, qtbase ? null, qtx11extras ? null, qt4 ? null
+, withQt5 ? false
+, debug ? false
+}:
+
+with lib;
+
+let
+  v = "4.9.0";
+  pname = "phonon-backend-gstreamer";
+in
+
+assert withQt5 -> qtbase != null;
+assert withQt5 -> qtx11extras != null;
+
+stdenv.mkDerivation rec {
+  name = "${pname}-${if withQt5 then "qt5" else "qt4"}-${v}";
+
+  meta = with stdenv.lib; {
+    homepage = https://phonon.kde.org/;
+    description = "GStreamer backend for Phonon";
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ ttuegel ];
+    license = licenses.lgpl21;
+  };
+
+  src = fetchurl {
+    url = "mirror://kde/stable/phonon/${pname}/${v}/${pname}-${v}.tar.xz";
+    sha256 = "1wc5p1rqglf0n1avp55s50k7fjdzdrhg0gind15k8796w7nfbhyf";
+  };
+
+  # Hardcode paths to useful plugins so the backend doesn't depend
+  # on system paths being set.
+  patches = [ ./gst-plugin-paths.patch ];
+
+  NIX_CFLAGS_COMPILE =
+    let gstPluginPaths =
+          lib.makeSearchPathOutput "lib" "/lib/gstreamer-1.0"
+          (with gst_all_1; [
+            gstreamer
+            gst-plugins-base
+            gst-plugins-good
+            gst-plugins-ugly
+            gst-plugins-bad
+            gst-libav
+          ]);
+    in [
+      # This flag should be picked up through pkgconfig, but it isn't.
+      "-I${gst_all_1.gstreamer.dev}/lib/gstreamer-1.0/include"
+
+      ''-DGST_PLUGIN_PATH_1_0="${gstPluginPaths}"''
+    ];
+
+  buildInputs = with gst_all_1;
+    [ gstreamer gst-plugins-base phonon ]
+    ++ (if withQt5 then [ qtbase qtx11extras ] else [ qt4 ]);
+
+  # cleanup: the build system creates (empty) $out/$out/share/icons (double prefix)
+  # if DESTDIR is unset
+  DESTDIR="/";
+
+  nativeBuildInputs = [ cmake pkgconfig ] ++ optional withQt5 extra-cmake-modules;
+
+  cmakeFlags =
+    [ "-DCMAKE_BUILD_TYPE=${if debug then "Debug" else "Release"}" ]
+    ++ optional withQt5 "-DPHONON_BUILD_PHONON4QT5=ON";
+}
diff --git a/nixpkgs/pkgs/development/libraries/phonon/backends/vlc.nix b/nixpkgs/pkgs/development/libraries/phonon/backends/vlc.nix
new file mode 100644
index 000000000000..829ecdb86e06
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/phonon/backends/vlc.nix
@@ -0,0 +1,42 @@
+{ stdenv, lib, fetchurl, cmake, phonon, pkgconfig, vlc
+, extra-cmake-modules, qtbase ? null, qtx11extras ? null, qt4 ? null
+, withQt4 ? false
+, debug ? false
+}:
+
+with lib;
+
+let
+  v = "0.10.2";
+  pname = "phonon-backend-vlc";
+in
+
+assert withQt4 -> qt4 != null;
+assert !withQt4 -> qtbase != null;
+assert !withQt4 -> qtx11extras != null;
+
+stdenv.mkDerivation rec {
+  name = "${pname}-${if withQt4 then "qt4" else "qt5"}-${v}";
+
+  meta = with stdenv.lib; {
+    homepage = https://phonon.kde.org/;
+    description = "GStreamer backend for Phonon";
+    platforms = platforms.linux;
+    license = with licenses; [ bsd3 lgpl2Plus ];
+  };
+
+  src = fetchurl {
+    url = "mirror://kde/stable/phonon/${pname}/${v}/${pname}-${v}.tar.xz";
+    sha256 = "163jqq5p9n0yfw2fqk0cqn3c6mqycxsvc4956zhkw5345g81a2a9";
+  };
+
+  buildInputs =
+    [ phonon vlc ]
+    ++ (if withQt4 then [ qt4 ] else [ qtbase qtx11extras ]);
+
+  nativeBuildInputs = [ cmake pkgconfig ] ++ optional (!withQt4) extra-cmake-modules;
+
+  cmakeFlags =
+    [ "-DCMAKE_BUILD_TYPE=${if debug then "Debug" else "Release"}" ]
+    ++ optional (!withQt4) "-DPHONON_BUILD_PHONON4QT5=ON";
+}
diff --git a/nixpkgs/pkgs/development/libraries/phonon/default.nix b/nixpkgs/pkgs/development/libraries/phonon/default.nix
new file mode 100644
index 000000000000..4d68d3718c0a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/phonon/default.nix
@@ -0,0 +1,79 @@
+{ stdenv, lib, fetchurl, cmake, libGLU_combined, pkgconfig, libpulseaudio
+, qt4 ? null, extra-cmake-modules ? null, qtbase ? null, qttools ? null
+, withQt5 ? false
+, debug ? false }:
+
+with lib;
+
+let
+  v = "4.10.2";
+
+  soname = if withQt5 then "phonon4qt5" else "phonon";
+  buildsystemdir = "share/cmake/${soname}";
+in
+
+assert withQt5 -> qtbase != null;
+assert withQt5 -> qttools != null;
+
+stdenv.mkDerivation rec {
+  name = "phonon-${if withQt5 then "qt5" else "qt4"}-${v}";
+
+  meta = {
+    homepage = https://phonon.kde.org/;
+    description = "Multimedia API for Qt";
+    license = stdenv.lib.licenses.lgpl2;
+    platforms = stdenv.lib.platforms.linux;
+    maintainers = with stdenv.lib.maintainers; [ ttuegel ];
+  };
+
+  src = fetchurl {
+    url = "mirror://kde/stable/phonon/${v}/phonon-${v}.tar.xz";
+    sha256 = "02c8fyyvg5qb0lxwxmnxc5grkg6p3halakjf02vmwmvqaycb3v9l";
+  };
+
+  buildInputs =
+    [ libGLU_combined libpulseaudio ]
+    ++ (if withQt5 then [ qtbase qttools ] else [ qt4 ]);
+
+  nativeBuildInputs =
+    [ cmake pkgconfig ]
+    ++ optional withQt5 extra-cmake-modules;
+
+  outputs = [ "out" "dev" ];
+
+  NIX_CFLAGS_COMPILE = "-fPIC";
+
+  cmakeFlags =
+    [ "-DCMAKE_BUILD_TYPE=${if debug then "Debug" else "Release"}" ]
+    ++ optional withQt5 "-DPHONON_BUILD_PHONON4QT5=ON";
+
+  preConfigure = ''
+    cmakeFlags+=" -DPHONON_QT_MKSPECS_INSTALL_DIR=''${!outputDev}/mkspecs"
+    cmakeFlags+=" -DPHONON_QT_IMPORTS_INSTALL_DIR=''${!outputBin}/$qtQmlPrefix"
+    cmakeFlags+=" -DPHONON_QT_PLUGIN_INSTALL_DIR=''${!outputBin}/$qtPluginPrefix/designer"
+  '';
+
+  postPatch = ''
+    sed -i PhononConfig.cmake.in \
+        -e "/get_filename_component(rootDir/ s/^.*$//" \
+        -e "/^set(PHONON_INCLUDE_DIR/ s|\''${rootDir}/||" \
+        -e "/^set(PHONON_LIBRARY_DIR/ s|\''${rootDir}/||" \
+        -e "/^set(PHONON_BUILDSYSTEM_DIR/ s|\''${rootDir}|''${!outputDev}|"
+
+    sed -i cmake/FindPhononInternal.cmake \
+        -e "/set(INCLUDE_INSTALL_DIR/ c set(INCLUDE_INSTALL_DIR \"''${!outputDev}/include\")"
+
+    ${optionalString withQt5 ''
+    sed -i cmake/FindPhononInternal.cmake \
+        -e "/set(PLUGIN_INSTALL_DIR/ c set(PLUGIN_INSTALL_DIR \"$qtPluginPrefix/..\")"
+    ''}
+
+    sed -i CMakeLists.txt \
+        -e "/set(BUILDSYSTEM_INSTALL_DIR/ c set(BUILDSYSTEM_INSTALL_DIR \"''${!outputDev}/${buildsystemdir}\")"
+  '';
+
+  postFixup = ''
+    sed -i "''${!outputDev}/lib/pkgconfig/${soname}.pc" \
+        -e "/^exec_prefix=/ c exec_prefix=''${!outputBin}/bin"
+  '';
+}
diff --git a/nixpkgs/pkgs/development/libraries/physfs/default.nix b/nixpkgs/pkgs/development/libraries/physfs/default.nix
new file mode 100644
index 000000000000..6edea7f51419
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/physfs/default.nix
@@ -0,0 +1,41 @@
+{ stdenv, fetchurl, cmake, doxygen
+, zlib }:
+
+let
+  generic = version: sha256:
+  stdenv.mkDerivation rec {
+    name = "physfs-${version}";
+
+    src = fetchurl {
+      url = "${meta.homepage}/downloads/${name}.tar.bz2";
+      inherit sha256;
+    };
+
+    nativeBuildInputs = [ cmake doxygen ];
+
+    buildInputs = [ zlib ];
+
+    enableParallelBuilding = true;
+
+    patchPhase = ''
+      sed s,-Werror,, -i CMakeLists.txt
+    '';
+
+    doInstallCheck = true;
+
+    installCheckPhase = ''
+      ./test_physfs --version
+    '';
+
+    meta = with stdenv.lib; {
+      homepage = http://icculus.org/physfs/;
+      description = "Library to provide abstract access to various archives";
+      license = licenses.free;
+      platforms = platforms.linux;
+    };
+  };
+
+in {
+  physfs_2 = generic "2.0.3" "0sbbyqzqhyf0g68fcvvv20n3928j0x6ik1njmhn1yigvq2bj11na";
+  physfs   = generic "3.0.2" "0qzqz4r88gvd8m7sh2z5hvqcr0jfr4wb2f77c19xycyn0rigfk9h";
+}
diff --git a/nixpkgs/pkgs/development/libraries/physics/apfel/default.nix b/nixpkgs/pkgs/development/libraries/physics/apfel/default.nix
new file mode 100644
index 000000000000..30b56afb8a95
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/physics/apfel/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchFromGitHub, gfortran, lhapdf, python2 }:
+
+stdenv.mkDerivation rec {
+  name = "apfel-${version}";
+  version = "3.0.3";
+
+  src = fetchFromGitHub {
+    owner = "scarrazza";
+    repo = "apfel";
+    rev = version;
+    sha256 = "13dvcc5ba6djflrcy5zf5ikaw8s78zd8ac6ickc0hxhbmx1gjb4j";
+  };
+
+  buildInputs = [ gfortran lhapdf python2 ];
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    description = "A PDF Evolution Library";
+    license     = licenses.gpl3;
+    homepage    = https://apfel.mi.infn.it/;
+    platforms   = platforms.unix;
+    maintainers = with maintainers; [ veprbl ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/physics/apfelgrid/default.nix b/nixpkgs/pkgs/development/libraries/physics/apfelgrid/default.nix
new file mode 100644
index 000000000000..983523e1f2fb
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/physics/apfelgrid/default.nix
@@ -0,0 +1,26 @@
+{ stdenv, fetchFromGitHub, autoreconfHook, apfel, applgrid, lhapdf, root5 }:
+
+stdenv.mkDerivation rec {
+  name = "apfelgrid-${version}";
+  version = "1.0.1";
+
+  src = fetchFromGitHub {
+    owner = "nhartland";
+    repo = "APFELgrid";
+    rev = "v${version}";
+    sha256 = "0l0cyxd00kmb5aggzwsxg83ah0qiwav0shbxkxwrz3dvw78n89jk";
+  };
+
+  nativeBuildInputs = [ autoreconfHook ];
+  buildInputs = [ apfel applgrid lhapdf root5 ];
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    description = "Ultra-fast theory predictions for collider observables";
+    license     = licenses.mit;
+    homepage    = http://nhartland.github.io/APFELgrid/;
+    platforms   = platforms.unix;
+    maintainers = with maintainers; [ veprbl ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/physics/applgrid/bad_code.patch b/nixpkgs/pkgs/development/libraries/physics/applgrid/bad_code.patch
new file mode 100644
index 000000000000..e90000efe2db
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/physics/applgrid/bad_code.patch
@@ -0,0 +1,50 @@
+diff --git a/appl_grid/appl_grid.h b/appl_grid/appl_grid.h
+index 5059622..a0651c9 100644
+--- a/appl_grid/appl_grid.h
++++ b/appl_grid/appl_grid.h
+@@ -56,7 +56,7 @@ public:
+   class exception : public std::exception { 
+   public:
+     exception(const std::string& s) { std::cerr << what() << " " << s << std::endl; }; 
+-    exception(std::ostream& s)      { std::cerr << what() << " " << s << std::endl; }; 
++    exception(std::ostream& s)      { s << what() << " " << std::endl; }; 
+     virtual const char* what() const throw() { return "appl::grid::exception"; }
+   };
+ 
+diff --git a/appl_grid/appl_pdf.h b/appl_grid/appl_pdf.h
+index c71fd84..2525527 100644
+--- a/appl_grid/appl_pdf.h
++++ b/appl_grid/appl_pdf.h
+@@ -51,7 +51,7 @@ public:
+   class exception : public std::exception { 
+   public: 
+     exception(const std::string& s="") { std::cerr << what() << " " << s << std::endl; }; 
+-    exception(std::ostream& s)         { std::cerr << what() << " " << s << std::endl; }; 
++    exception(std::ostream& s)         { s << " " << std::endl; }; 
+     const char* what() const throw() { return "appl::appl_pdf::exception "; }
+   };
+   
+diff --git a/src/appl_igrid.h b/src/appl_igrid.h
+index d25288e..be354df 100644
+--- a/src/appl_igrid.h
++++ b/src/appl_igrid.h
+@@ -52,7 +52,7 @@ private:
+   class exception { 
+   public:
+     exception(const std::string& s) { std::cerr << s << std::endl; }; 
+-    exception(std::ostream& s)      { std::cerr << s << std::endl; }; 
++    exception(std::ostream& s)      { s << std::endl; }; 
+   };
+ 
+   typedef double (igrid::*transform_t)(double) const;
+diff --git a/src/lumi_pdf.cxx b/src/lumi_pdf.cxx
+--- a/src/lumi_pdf.cxx
++++ b/src/lumi_pdf.cxx
+@@ -235,6 +235,6 @@ void lumi_pdf::write(const std::string& filename) const {
+ // std::string lumi_pdf::summary(std::ostream& s=std::cout) const { 
+ std::string lumi_pdf::summary() const { 
+   std::stringstream s;
+-  s << "lumi_pdf::lumi_pdf() " << s << "\tsize " << m_combinations.size() << " lookup size " << m_lookup.size() << " " << this; 
++  s << "lumi_pdf::lumi_pdf() " << "\tsize " << m_combinations.size() << " lookup size " << m_lookup.size() << " " << this; 
+   return s.str();
+ }
diff --git a/nixpkgs/pkgs/development/libraries/physics/applgrid/default.nix b/nixpkgs/pkgs/development/libraries/physics/applgrid/default.nix
new file mode 100644
index 000000000000..1ad5dcb8b25b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/physics/applgrid/default.nix
@@ -0,0 +1,42 @@
+{ stdenv, fetchurl, gfortran, hoppet, lhapdf, root5 }:
+
+stdenv.mkDerivation rec {
+  name = "applgrid-${version}";
+  version = "1.4.70";
+
+  src = fetchurl {
+    url = "https://www.hepforge.org/archive/applgrid/${name}.tgz";
+    sha256 = "1yw9wrk3vjv84kd3j4s1scfhinirknwk6xq0hvj7x2srx3h93q9p";
+  };
+
+  buildInputs = [ gfortran hoppet lhapdf root5 ];
+
+  patches = [
+    ./bad_code.patch
+  ];
+
+  preConfigure = ''
+    substituteInPlace src/Makefile.in \
+      --replace "-L\$(subst /libgfortran.a, ,\$(FRTLIB) )" "-L${gfortran.cc.lib}/lib"
+  '' + (if stdenv.isDarwin then ''
+    substituteInPlace src/Makefile.in \
+      --replace "gfortran -print-file-name=libgfortran.a" "gfortran -print-file-name=libgfortran.dylib"
+  '' else "");
+
+  enableParallelBuilding = false; # broken
+
+  # Install private headers required by APFELgrid
+  postInstall = ''
+    for header in src/*.h; do
+      install -Dm644 "$header" "$out"/include/appl_grid/"`basename $header`"
+    done
+  '';
+
+  meta = with stdenv.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;
+    platforms   = platforms.unix;
+    maintainers = with maintainers; [ veprbl ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/physics/cernlib/default.nix b/nixpkgs/pkgs/development/libraries/physics/cernlib/default.nix
new file mode 100644
index 000000000000..f01fab74635b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/physics/cernlib/default.nix
@@ -0,0 +1,66 @@
+{ stdenv, fetchurl, gfortran, gnumake, imake, makedepend, motif, xorg }:
+
+stdenv.mkDerivation rec {
+  version = "2006";
+  name = "cernlib-${version}";
+
+  src = fetchurl {
+    url = "https://cernlib.web.cern.ch/cernlib/download/${version}_source/tar/${version}_src.tar.gz";
+    sha256 = "0awla1rl96z82br7slcmg8ks1d2a7slk6dj79ywb871j2ksi3fky";
+  };
+
+  buildInputs = with xorg; [ gfortran motif libX11 libXft libXt ];
+  nativeBuildInputs = [ gnumake imake makedepend ];
+  sourceRoot = ".";
+
+  patches = [ ./patch ];
+
+  postPatch = ''
+    substituteInPlace 2006/src/config/site.def \
+      --replace "# define MakeCmd gmake" "# define MakeCmd make"
+    substituteInPlace 2006/src/config/lnxLib.rules \
+      --replace "# lib" "// lib"
+  '';
+
+  configurePhase = ''
+    export CERN=`pwd`
+    export CERN_LEVEL=${version}
+    export CERN_ROOT=$CERN/$CERN_LEVEL
+    export CVSCOSRC=`pwd`/$CERN_LEVEL/src
+    export PATH=$PATH:$CERN_ROOT/bin
+  '';
+
+  buildPhase = ''
+    cd $CERN_ROOT
+    mkdir -p build bin lib
+
+    cd $CERN_ROOT/build
+    $CVSCOSRC/config/imake_boot
+    make bin/kuipc
+    make scripts/Makefile
+    pushd scripts
+    make install.bin
+    popd
+    make
+  '';
+
+  installPhase = ''
+    mkdir "$out"
+    cp -r "$CERN_ROOT/bin" "$out"
+    cp -r "$CERN_ROOT/lib" "$out"
+    mkdir "$out/$CERN_LEVEL"
+    ln -s "$out/bin" "$out/$CERN_LEVEL/bin"
+    ln -s "$out/lib" "$out/$CERN_LEVEL/lib"
+  '';
+
+  setupHook = ./setup-hook.sh;
+
+  meta = {
+    homepage = http://cernlib.web.cern.ch;
+    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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/physics/cernlib/patch b/nixpkgs/pkgs/development/libraries/physics/cernlib/patch
new file mode 100644
index 000000000000..2d75b6bf0f88
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/physics/cernlib/patch
@@ -0,0 +1,186 @@
+diff --git a/2006/src/config/Imake.tmpl b/2006/src/config/Imake.tmpl
+index 054fb04..a3b3828 100644
+--- a/2006/src/config/Imake.tmpl
++++ b/2006/src/config/Imake.tmpl
+@@ -455,7 +455,7 @@ XCOMM the platform-specific parameters - edit site.def to change
+ #define NoRConst NO /* YES if const for structs of funcs is bad */
+ #endif
+ #ifndef InstPgmFlags
+-#define InstPgmFlags -s
++#define InstPgmFlags
+ #endif
+ #ifndef InstBinFlags
+ #define InstBinFlags -m 0755
+diff --git a/2006/src/config/biglib.rules b/2006/src/config/biglib.rules
+index c90e58a..9173bdc 100644
+--- a/2006/src/config/biglib.rules
++++ b/2006/src/config/biglib.rules
+@@ -368,7 +368,7 @@ define build-object-list						@@\
+ @ (set -e;\							@@\
+ 	 case '${MFLAGS}' in *[i]*) set +e;; esac; \		@@\
+ 	 subdirs=Quote(dirs);\					@@\
+-	 list=`/bin/pwd`/$@;\					@@\
++	 list=`pwd`/$@;\					@@\
+ 	 for dir in $$subdirs; do \				@@\
+ 	  (set -e;cd $$dir;SedCmd -e "\=^[^/]=s=^.=$$dir/&=" $@ >> $$list);\@@\
+ 	 done) || (rm $@; exit 1)				@@\
+diff --git a/2006/src/config/imake_boot b/2006/src/config/imake_boot
+index b52d0d3..69cf1b3 100755
+--- a/2006/src/config/imake_boot
++++ b/2006/src/config/imake_boot
+@@ -10,8 +10,8 @@ if [ "$CVSCOSRC" = "" ] ; then
+ fi
+ if [ -f Imakefile ] ; then
+ 	imake -DUseInstalled -I$CVSCOSRC/config \
+-		-DTOPDIR=`/bin/pwd` -DCURDIR= -fImakefile
++		-DTOPDIR=`pwd` -DCURDIR= -fImakefile
+ else
+ 	imake -DUseInstalled -I$CVSCOSRC/config \
+-		-DTOPDIR=`/bin/pwd` -DCURDIR= -f$CVSCOSRC/Imakefile
++		-DTOPDIR=`pwd` -DCURDIR= -f$CVSCOSRC/Imakefile
+ fi
+diff --git a/2006/src/config/linux-lp64.cf b/2006/src/config/linux-lp64.cf
+index e071b2f..3cc5c3b 100644
+--- a/2006/src/config/linux-lp64.cf
++++ b/2006/src/config/linux-lp64.cf
+@@ -173,7 +173,7 @@
+ #define FortranCmd		g77
+ #define XargsCmd		xargs
+ #define FortranSaveFlags	/* */ /* Everything static !? */
+-#define DefaultFCOptions	-fno-automatic -fno-second-underscore -fugly-complex
++#define DefaultFCOptions	-fno-automatic -fno-second-underscore
+ #define CernlibSystem	        -DCERNLIB_LINUX -DCERNLIB_UNIX -DCERNLIB_LNX -DCERNLIB_QMGLIBC -DCERNLIB_QMLXIA64
+ 
+ # endif
+diff --git a/2006/src/config/linux.cf b/2006/src/config/linux.cf
+index cc0bee5..a8dd954 100644
+--- a/2006/src/config/linux.cf
++++ b/2006/src/config/linux.cf
+@@ -258,7 +258,7 @@ endif									@@\
+ #define FortranCmd		g77
+ #define XargsCmd		xargs
+ #define FortranSaveFlags	/* */ /* Everything static !? */
+-#define DefaultFCOptions	-fno-automatic -fno-second-underscore -fugly-complex
++#define DefaultFCOptions	-fno-automatic -fno-second-underscore
+ #define CernlibSystem	        -DCERNLIB_LINUX -DCERNLIB_UNIX -DCERNLIB_LNX -DCERNLIB_QMGLIBC
+ 
+ # endif
+diff --git a/2006/src/packlib/kuip/code_kuip/kkern.c b/2006/src/packlib/kuip/code_kuip/kkern.c
+index 3a5579f..5f3c352 100644
+--- a/2006/src/packlib/kuip/code_kuip/kkern.c
++++ b/2006/src/packlib/kuip/code_kuip/kkern.c
+@@ -543,24 +543,6 @@ char *str0dup( const char *str )
+ 
+ 
+ /*
+- * like strdup() but string is n characters long and not terminated
+- */
+-char *strndup( const char *str,
+-              size_t len )
+-{
+-  size_t bytes = len + 1;
+-  char *p;
+-
+-  if( bytes < ALLOC_MIN_BYTES )
+-    bytes = ALLOC_MIN_BYTES;
+-
+-  p = strncpy( malloc( bytes ), str, len );
+-  p[len] = '\0';
+-  return p;
+-}
+-
+-
+-/*
+  * strdup() of character representation of integer n
+  */
+ char *stridup( int n )
+diff --git a/2006/src/packlib/kuip/code_kuip/kmenu.c b/2006/src/packlib/kuip/code_kuip/kmenu.c
+index f135b07..23007a8 100644
+--- a/2006/src/packlib/kuip/code_kuip/kmenu.c
++++ b/2006/src/packlib/kuip/code_kuip/kmenu.c
+@@ -1404,7 +1404,7 @@ void interactive_find( char *expr, int keym )
+          printf ("See also:\n    ");
+          for (i = 0; i < nval; i++) {
+              if (i == ncmd) continue;
+-             printf (flis_name[i]);
++             printf ("%s", flis_name[i]);
+              if (i < nval-1)
+                 printf (", ");
+              else
+diff --git a/2006/src/packlib/kuip/kuip/kstring.h b/2006/src/packlib/kuip/kuip/kstring.h
+index 7811f15..12a1344 100644
+--- a/2006/src/packlib/kuip/kuip/kstring.h
++++ b/2006/src/packlib/kuip/kuip/kstring.h
+@@ -21,7 +21,6 @@ extern "C" {
+  */
+ 
+ #ifndef WIN32
+-extern void* memmove( void* dst, const void* src, size_t n );
+ #endif
+ 
+ /* GF. make conform to kkern.c#if !defined(__convexc__)*/
+@@ -46,7 +45,6 @@ extern char* str4dup( const char* str1, const char* str2, const char* str3,
+                      const char* str4 );
+ extern char* str5dup( const char* str1, const char* str2, const char* str3,
+                      const char* str4, const char* str5 );
+-extern char* strndup( const char* buf, size_t n );
+ extern char* stridup( int i );
+ 
+ extern char* mstrcat( char* ptr, const char* str );
+diff --git a/2006/src/pawlib/paw/cpaw/bugrep.c b/2006/src/pawlib/paw/cpaw/bugrep.c
+index d503a45..d26e30f 100644
+--- a/2006/src/pawlib/paw/cpaw/bugrep.c
++++ b/2006/src/pawlib/paw/cpaw/bugrep.c
+@@ -432,51 +432,7 @@ br_add_config( char * tmp_file )
+ 
+ static int
+ br_mail_file( char *addr, char *subj, char *file )
+-#if (defined(CERNLIB_UNIX))&&(!defined(CERNLIB_WINNT))&&(!defined(CERNLIB_MACOSX))
+-{
+-        FILE            *mfp, *fp;
+-        char            line[1024], my_addr[L_cuserid];
+-        time_t          clock;
+-        struct tm       *ts;
+-
+-        fp = fopen( file, "r" );
+-        if ( fp == NULL ) {
+-                printf( "BUGREPORT: cannot (re)open temporary file\n" );
+-                return MAIL_ERROR;
+-        }
+-
+-        cuserid( my_addr );
+-
+-        sprintf( line, "/usr/lib/sendmail -t" );
+-        mfp = popen( line, "w" );
+-
+-        if ( mfp == NULL ) {
+-                printf( "BUGREPORT: cannot run sendmail\n" );
+-                return MAIL_ERROR;
+-        }
+-
+-
+-        clock = time( (time_t *) 0 );
+-        ts = localtime( &clock );
+-        strftime( line, sizeof( line ),
+-                "%a, %d %h %y %H:%M:%S", ts );
+-        fprintf ( mfp, "To: %s\n", addr );
+-        fprintf ( mfp, "Bcc: %s\n", my_addr );
+-        fprintf ( mfp, "Date: %s\n", line );
+-        fprintf ( mfp, "Subject: %s\n", subj );
+-        fprintf ( mfp, "\n" );
+-
+-        while( fgets( line, sizeof( line ), fp ) != NULL ) {
+-                fputs( line, mfp );
+-        }
+-        fclose( fp );
+-
+-        pclose( mfp );
+-
+-        return MAIL_OK;
+-}
+-#endif
+-#if defined(CERNLIB_MACOSX)
++#if (defined(CERNLIB_UNIX))&&(!defined(CERNLIB_WINNT))
+ {
+         FILE            *mfp, *fp;
+         char            line[1024], *my_addr;
diff --git a/nixpkgs/pkgs/development/libraries/physics/cernlib/setup-hook.sh b/nixpkgs/pkgs/development/libraries/physics/cernlib/setup-hook.sh
new file mode 100644
index 000000000000..d83759327760
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/physics/cernlib/setup-hook.sh
@@ -0,0 +1,3 @@
+export CERN_LEVEL=@version@
+export CERN=@out@
+export CERN_ROOT=$CERN/$CERN_LEVEL
diff --git a/nixpkgs/pkgs/development/libraries/physics/fastjet/default.nix b/nixpkgs/pkgs/development/libraries/physics/fastjet/default.nix
new file mode 100644
index 000000000000..3828cfda2aff
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/physics/fastjet/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchurl, python2 }:
+
+stdenv.mkDerivation rec {
+  name = "fastjet-${version}";
+  version = "3.3.2";
+
+  src = fetchurl {
+    url = "http://fastjet.fr/repo/fastjet-${version}.tar.gz";
+    sha256 = "1hk3k7dyik640dzg21filpywc2dl862nl2hbpg384hf5pw9syn9z";
+  };
+
+  buildInputs = [ python2 ];
+
+  configureFlags = [
+    "--enable-allcxxplugins"
+    "--enable-pyext"
+    ];
+
+  enableParallelBuilding = true;
+
+  meta = {
+    description = "A software package for jet finding in pp and e+e− collisions";
+    license     = stdenv.lib.licenses.gpl2Plus;
+    homepage    = http://fastjet.fr/;
+    platforms   = stdenv.lib.platforms.unix;
+    maintainers = with stdenv.lib.maintainers; [ veprbl ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/physics/fastnlo/default.nix b/nixpkgs/pkgs/development/libraries/physics/fastnlo/default.nix
new file mode 100644
index 000000000000..e3291907d31f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/physics/fastnlo/default.nix
@@ -0,0 +1,33 @@
+{ stdenv, fetchurl, boost, fastjet, gfortran, lhapdf, python2, root, yoda, zlib }:
+
+stdenv.mkDerivation rec {
+  name = "fastnlo_toolkit-${version}";
+  version = "2.3.1pre-2402";
+
+  src = fetchurl {
+    url = "https://fastnlo.hepforge.org/code/v23/${name}.tar.gz";
+    sha256 = "1h41xnqcz401x3zbs8i2dsb4xlhbv8i5ps0561p6y7gcyridgcbl";
+  };
+
+  buildInputs = [ boost fastjet gfortran gfortran.cc.lib lhapdf python2 root yoda ];
+  propagatedBuildInputs = [ zlib ];
+
+  preConfigure = ''
+    substituteInPlace ./fastnlotoolkit/Makefile.in \
+      --replace "-fext-numeric-literals" ""
+  '';
+
+  configureFlags = [
+    "--with-yoda=${yoda}"
+  ];
+
+  enableParallelBuilding = true;
+
+  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;
+    homepage     = http://fastnlo.hepforge.org;
+    platforms    = stdenv.lib.platforms.unix;
+    maintainers = with stdenv.lib.maintainers; [ veprbl ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/physics/geant4/datasets-hook.sh b/nixpkgs/pkgs/development/libraries/physics/geant4/datasets-hook.sh
new file mode 100644
index 000000000000..14e3b8f2fc38
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/physics/geant4/datasets-hook.sh
@@ -0,0 +1,5 @@
+@name@ () {
+    export G4@envvar@DATA="@out@/data"
+}
+
+postHooks+=(@name@)
diff --git a/nixpkgs/pkgs/development/libraries/physics/geant4/datasets.nix b/nixpkgs/pkgs/development/libraries/physics/geant4/datasets.nix
new file mode 100644
index 000000000000..88f2dc2cd6d4
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/physics/geant4/datasets.nix
@@ -0,0 +1,103 @@
+{ stdenv, fetchurl, }:
+
+let
+  mkDataset = { name, version, sha256, envvar}:
+    stdenv.mkDerivation {
+      inherit name version;
+
+      src = fetchurl {
+        url = "https://geant4-data.web.cern.ch/geant4-data/datasets/${name}.${version}.tar.gz";
+        inherit sha256;
+      };
+
+      preferLocalBuild = true;
+      dontBuild = true;
+      dontConfigure = true;
+
+      installPhase = ''
+        mkdir -p $out/data
+        mv ./* $out/data
+      '';
+
+      inherit envvar;
+      setupHook = ./datasets-hook.sh;
+
+      meta = with stdenv.lib; {
+        description = "Data files for the Geant4 toolkit";
+        homepage = "https://geant4.web.cern.ch/support/download";
+        license = licenses.g4sl;
+        platforms = platforms.all;
+      };
+    };
+in
+  builtins.listToAttrs (map (a: { inherit (a) name; value = mkDataset a; }) [
+    {
+      name = "G4NDL";
+      version = "4.5";
+      sha256 = "cba928a520a788f2bc8229c7ef57f83d0934bb0c6a18c31ef05ef4865edcdf8e";
+      envvar = "NEUTRONHP";
+    }
+
+    {
+      name = "G4EMLOW";
+      version = "7.3";
+      sha256 = "583aa7f34f67b09db7d566f904c54b21e95a9ac05b60e2bfb794efb569dba14e";
+      envvar = "LE";
+    }
+
+    {
+      name = "G4PhotonEvaporation";
+      version = "5.2";
+      sha256 = "83607f8d36827b2a7fca19c9c336caffbebf61a359d0ef7cee44a8bcf3fc2d1f";
+      envvar = "LEVELGAMMA";
+    }
+
+    {
+      name = "G4RadioactiveDecay";
+      version = "5.2";
+      sha256 = "99c038d89d70281316be15c3c98a66c5d0ca01ef575127b6a094063003e2af5d";
+      envvar = "RADIOACTIVE";
+    }
+
+    {
+      name = "G4SAIDDATA";
+      version = "1.1";
+      sha256 = "a38cd9a83db62311922850fe609ecd250d36adf264a88e88c82ba82b7da0ed7f";
+      envvar = "SAIDXS";
+    }
+
+    {
+      name = "G4NEUTRONXS";
+      version = "1.4";
+      sha256 = "57b38868d7eb060ddd65b26283402d4f161db76ed2169437c266105cca73a8fd";
+      envvar = "NEUTRONXS";
+    }
+
+    {
+      name = "G4ABLA";
+      version = "3.1";
+      sha256 = "7698b052b58bf1b9886beacdbd6af607adc1e099fc730ab6b21cf7f090c027ed";
+      envvar = "ABLA";
+    }
+
+    {
+      name = "G4PII";
+      version = "1.3";
+      sha256 = "6225ad902675f4381c98c6ba25fc5a06ce87549aa979634d3d03491d6616e926";
+      envvar = "PII";
+    }
+
+    {
+      name = "G4ENSDFSTATE";
+      version = "2.2";
+      sha256 = "dd7e27ef62070734a4a709601f5b3bada6641b111eb7069344e4f99a01d6e0a6";
+      envvar = "ENSDFSTATE";
+    }
+
+    {
+      name = "G4RealSurface";
+      version = "2.1";
+      sha256 = "2a287adbda1c0292571edeae2082a65b7f7bd6cf2bf088432d1d6f889426dcf3";
+      envvar = "REALSURFACE";
+    }
+  ])
diff --git a/nixpkgs/pkgs/development/libraries/physics/geant4/default.nix b/nixpkgs/pkgs/development/libraries/physics/geant4/default.nix
new file mode 100644
index 000000000000..7123858b8edc
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/physics/geant4/default.nix
@@ -0,0 +1,101 @@
+{ enableMultiThreading ? true
+, enableG3toG4         ? false
+, enableInventor       ? false
+, enableGDML           ? false
+, enableQT             ? false
+, enableXM             ? false
+, enableOpenGLX11      ? true
+, enableRaytracerX11   ? false
+
+# Standard build environment with cmake.
+, stdenv, fetchurl, cmake
+
+# Optional system packages, otherwise internal GEANT4 packages are used.
+, clhep ? null # not packaged currently
+, expat
+, zlib
+
+# For enableGDML.
+, xercesc
+
+# For enableQT.
+, qtbase
+
+# For enableXM.
+, motif
+
+# For enableInventor
+, coin3d
+, soxt
+, libXpm
+
+# For enableQT, enableXM, enableOpenGLX11, enableRaytracerX11.
+, libGLU_combined
+, xlibsWrapper
+, libXmu
+}:
+
+stdenv.mkDerivation rec {
+  version = "10.4.1";
+  name = "geant4-${version}";
+
+  src = fetchurl{
+    url = "http://cern.ch/geant4-data/releases/geant4.10.04.p01.tar.gz";
+    sha256 = "a3eb13e4f1217737b842d3869dc5b1fb978f761113e74bd4eaf6017307d234dd";
+  };
+
+  cmakeFlags = [
+    "-DGEANT4_INSTALL_DATA=OFF"
+    "-DGEANT4_USE_GDML=${if enableGDML then "ON" else "OFF"}"
+    "-DGEANT4_USE_G3TOG4=${if enableG3toG4 then "ON" else "OFF"}"
+    "-DGEANT4_USE_QT=${if enableQT then "ON" else "OFF"}"
+    "-DGEANT4_USE_XM=${if enableXM then "ON" else "OFF"}"
+    "-DGEANT4_USE_OPENGL_X11=${if enableOpenGLX11 then "ON" else "OFF"}"
+    "-DGEANT4_USE_INVENTOR=${if enableInventor then "ON" else "OFF"}"
+    "-DGEANT4_USE_RAYTRACER_X11=${if enableRaytracerX11 then "ON" else "OFF"}"
+    "-DGEANT4_USE_SYSTEM_CLHEP=${if clhep != null then "ON" else "OFF"}"
+    "-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 enableInventor [
+    "-DINVENTOR_INCLUDE_DIR=${coin3d}/include"
+    "-DINVENTOR_LIBRARY_RELEASE=${coin3d}/lib/libCoin.so"
+  ];
+
+  enableParallelBuilding = true;
+  nativeBuildInputs =  [ cmake ];
+  buildInputs = [ clhep expat zlib libGLU_combined xlibsWrapper libXmu ]
+    ++ stdenv.lib.optionals enableGDML [ xercesc ]
+    ++ stdenv.lib.optionals enableXM [ motif ]
+    ++ stdenv.lib.optionals enableQT [ qtbase ]
+    ++ stdenv.lib.optionals enableInventor [ libXpm coin3d soxt ];
+
+  postFixup = ''
+    # Don't try to export invalid environment variables.
+    sed -i 's/export G4\([A-Z]*\)DATA/#export G4\1DATA/' "$out"/bin/geant4.sh
+  '';
+
+  setupHook = ./geant4-hook.sh;
+
+  passthru = {
+    data = import ./datasets.nix { inherit stdenv fetchurl; };
+  };
+
+  # Set the myriad of envars required by Geant4 if we use a nix-shell.
+  shellHook = ''
+    source $out/nix-support/setup-hook
+  '';
+
+  meta = with stdenv.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.
+      Its areas of application include high energy, nuclear and accelerator physics, as well as studies in medical and space science.
+      The two main reference papers for Geant4 are published in Nuclear Instruments and Methods in Physics Research A 506 (2003) 250-303, and IEEE Transactions on Nuclear Science 53 No. 1 (2006) 270-278.
+    '';
+    homepage = http://www.geant4.org;
+    license = licenses.g4sl;
+    maintainers = with maintainers; [ tmplt ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/physics/geant4/g4py/default.nix b/nixpkgs/pkgs/development/libraries/physics/geant4/g4py/default.nix
new file mode 100644
index 000000000000..f28f0fd64203
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/physics/geant4/g4py/default.nix
@@ -0,0 +1,63 @@
+{ stdenv, fetchurl, cmake, xercesc
+
+# The target version of Geant4
+, geant4
+
+# Python (obviously) and boost::python for wrapping.
+, python
+, boost
+}:
+
+let
+  # g4py does not support MT and will fail to build against MT geant
+  geant4_nomt = geant4.override { enableMultiThreading = false; };
+  boost_python = boost.override { enablePython = true; inherit python; };
+in
+
+stdenv.mkDerivation rec {
+  inherit (geant4_nomt) version src;
+  name = "g4py-${version}";
+
+  sourceRoot = "geant4.10.04.p01/environments/g4py";
+
+  nativeBuildInputs = [ cmake ];
+  buildInputs = [ geant4_nomt xercesc boost_python python ];
+
+  GEANT4_INSTALL = geant4_nomt;
+
+  preConfigure = ''
+    # Fix for boost 1.67+
+    substituteInPlace CMakeLists.txt \
+    --replace "find_package(Boost)" "find_package(Boost 1.40 REQUIRED COMPONENTS python${builtins.replaceStrings ["."] [""] python.pythonVersion})"
+    for f in `find . -name CMakeLists.txt`; do
+      substituteInPlace "$f" \
+        --replace "boost_python" "\''${Boost_LIBRARIES}"
+    done
+  '';
+
+  enableParallelBuilding = true;
+
+  setupHook = ./setup-hook.sh;
+
+  # Make sure we set PYTHONPATH
+  shellHook = ''
+    source $out/nix-support/setup-hook
+  '';
+
+  meta = {
+    description = "Python bindings and utilities for Geant4";
+    longDescription = ''
+      Geant4 is a toolkit for the simulation of the passage of particles
+      through matter.  Its areas of application include high energy,
+      nuclear and accelerator physics, as well as studies in medical and
+      space science.  The two main reference papers for Geant4 are
+      published in Nuclear Instruments and Methods in Physics Research A
+      506 (2003) 250-303, and IEEE Transactions on Nuclear Science 53 No. 1
+      (2006) 270-278.
+    '';
+    homepage = http://www.geant4.org;
+    license = stdenv.lib.licenses.g4sl;
+    maintainers = [ ];
+    platforms = stdenv.lib.platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/physics/geant4/g4py/setup-hook.sh b/nixpkgs/pkgs/development/libraries/physics/geant4/g4py/setup-hook.sh
new file mode 100644
index 000000000000..8abfb461fc0f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/physics/geant4/g4py/setup-hook.sh
@@ -0,0 +1 @@
+export PYTHONPATH=$PYTHONPATH:@out@/lib
diff --git a/nixpkgs/pkgs/development/libraries/physics/geant4/geant4-hook.sh b/nixpkgs/pkgs/development/libraries/physics/geant4/geant4-hook.sh
new file mode 100644
index 000000000000..0b775d432831
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/physics/geant4/geant4-hook.sh
@@ -0,0 +1 @@
+source @out@/bin/geant4.sh
diff --git a/nixpkgs/pkgs/development/libraries/physics/hepmc/default.nix b/nixpkgs/pkgs/development/libraries/physics/hepmc/default.nix
new file mode 100644
index 000000000000..b935a3d56ea9
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/physics/hepmc/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchurl, cmake }:
+
+stdenv.mkDerivation rec {
+  name = "hepmc-${version}";
+  version = "2.06.09";
+
+  src = fetchurl {
+    url = "http://lcgapp.cern.ch/project/simu/HepMC/download/HepMC-${version}.tar.gz";
+    sha256 = "020sc7hzy7d6d1i6bs352hdzy5zy5zxkc33cw0jhh8s0jz5281y6";
+  };
+
+  patches = [ ./in_source.patch ];
+  buildInputs = [ cmake ];
+
+  cmakeFlags = [
+    "-Dmomentum:STRING=GEV"
+    "-Dlength:STRING=MM"
+  ];
+
+  enableParallelBuilding = true;
+
+  meta = {
+    description = "The HepMC package is an object oriented event record written in C++ for High Energy Physics Monte Carlo Generators";
+    license     = stdenv.lib.licenses.gpl2;
+    homepage    = http://lcgapp.cern.ch/project/simu/HepMC/;
+    platforms   = stdenv.lib.platforms.unix;
+    maintainers = with stdenv.lib.maintainers; [ veprbl ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/physics/hepmc/in_source.patch b/nixpkgs/pkgs/development/libraries/physics/hepmc/in_source.patch
new file mode 100644
index 000000000000..836a56558691
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/physics/hepmc/in_source.patch
@@ -0,0 +1,25 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -37,21 +37,6 @@ message(STATUS "default momentum and length are ${HEPMC_DEFAULT_MOM_UNIT} ${HEPM
+ # find the HepMC cmake modules
+ set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules ${CMAKE_MODULE_PATH})
+ 
+-# make sure we are not building from within the source code directory
+-string(COMPARE EQUAL "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" in_source)
+-string( REGEX MATCH "${CMAKE_SOURCE_DIR}/" in_source_subdir
+-"${CMAKE_BINARY_DIR}")
+-if (in_source OR in_source_subdir)
+-  message(FATAL_ERROR "
+-ERROR: In source builds of this project are not allowed.
+-A separate build directory is required.
+-Please create one and run cmake from the build directory.
+-Also note that cmake has just added files to your source code directory.
+-We suggest getting a new copy of the source code.
+-Otherwise, delete `CMakeCache.txt' and the directory `CMakeFiles'.
+-  ")
+-endif ()
+-
+ # build_docs is OFF (false) by default
+ if ( build_docs )
+    message(STATUS "documents WILL be built and installed" )
diff --git a/nixpkgs/pkgs/development/libraries/physics/hepmc3/default.nix b/nixpkgs/pkgs/development/libraries/physics/hepmc3/default.nix
new file mode 100644
index 000000000000..c4717800f70d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/physics/hepmc3/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchurl, cmake, coreutils, root }:
+
+stdenv.mkDerivation rec {
+  name = "hepmc3-${version}";
+  version = "3.1.1";
+
+  src = fetchurl {
+    url = "http://hepmc.web.cern.ch/hepmc/releases/HepMC3-${version}.tar.gz";
+    sha256 = "1fs8ha5issls886g03azpwamry1k633zjrcx51v7g7vg9nbckjrg";
+  };
+
+  buildInputs = [ cmake root ];
+
+  postInstall = ''
+    substituteInPlace "$out"/bin/HepMC3-config \
+      --replace 'greadlink' '${coreutils}/bin/readlink'
+  '';
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.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/;
+    platforms   = platforms.unix;
+    maintainers = with maintainers; [ veprbl ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/physics/herwig/default.nix b/nixpkgs/pkgs/development/libraries/physics/herwig/default.nix
new file mode 100644
index 000000000000..7a146bb7309a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/physics/herwig/default.nix
@@ -0,0 +1,36 @@
+{ stdenv, fetchurl, boost, fastjet, gfortran, gsl, lhapdf, thepeg, zlib, autoconf, automake, libtool }:
+
+stdenv.mkDerivation rec {
+  name = "herwig-${version}";
+  version = "7.1.5";
+
+  src = fetchurl {
+    url = "https://www.hepforge.org/archive/herwig/Herwig-${version}.tar.bz2";
+    sha256 = "0jnrv59zfa41gc37pqr3vaiz5jkh7w0k0alcax37b3mlbsnacr9r";
+  };
+
+  nativeBuildInputs = [ autoconf automake libtool ];
+
+  buildInputs = [ boost fastjet gfortran gsl thepeg zlib ]
+    # There is a bug that requires for MMHT PDF's to be presend during the build
+    ++ (with lhapdf.pdf_sets; [ MMHT2014lo68cl MMHT2014nlo68cl ]);
+
+  postPatch = ''
+    patchShebangs ./
+  '';
+
+  configureFlags = [
+    "--with-thepeg=${thepeg}"
+  ];
+
+  enableParallelBuilding = true;
+
+  meta = {
+    description = "A multi-purpose particle physics event generator";
+    license     = stdenv.lib.licenses.gpl2;
+    homepage    = https://herwig.hepforge.org/;
+    platforms   = stdenv.lib.platforms.unix;
+    maintainers = with stdenv.lib.maintainers; [ veprbl ];
+    broken      = stdenv.isAarch64; # doesn't compile: ignoring return value of 'FILE* freopen...
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/physics/hoppet/default.nix b/nixpkgs/pkgs/development/libraries/physics/hoppet/default.nix
new file mode 100644
index 000000000000..9c379f6a3474
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/physics/hoppet/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchurl, gfortran, perl }:
+
+stdenv.mkDerivation rec {
+  name = "hoppet-${version}";
+  version = "1.2.0";
+
+  src = fetchurl {
+    url = "https://hoppet.hepforge.org/downloads/${name}.tgz";
+    sha256 = "0j7437rh4xxbfzmkjr22ry34xm266gijzj6mvrq193fcsfzipzdz";
+  };
+
+  buildInputs = [ gfortran ];
+  nativeBuildInputs = [ perl ];
+
+  enableParallelBuilding = true;
+
+  preConfigure = ''
+    patchShebangs .
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Higher Order Perturbative Parton Evolution Toolkit";
+    license     = licenses.gpl2;
+    homepage    = https://hoppet.hepforge.org;
+    platforms   = platforms.unix;
+    maintainers = with maintainers; [ veprbl ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/physics/lhapdf/default.nix b/nixpkgs/pkgs/development/libraries/physics/lhapdf/default.nix
new file mode 100644
index 000000000000..3ad0b3dc4cc1
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/physics/lhapdf/default.nix
@@ -0,0 +1,32 @@
+{ stdenv, fetchurl, python2, makeWrapper }:
+
+stdenv.mkDerivation rec {
+  name = "lhapdf-${version}";
+  version = "6.2.3";
+
+  src = fetchurl {
+    url = "https://www.hepforge.org/archive/lhapdf/LHAPDF-${version}.tar.gz";
+    sha256 = "1l9dv37k4jz18wahyfm9g53nyl81v5bgqgy4dllbcmvcqpfkmrnn";
+  };
+
+  nativeBuildInputs = [ makeWrapper ];
+  buildInputs = [ python2 ];
+
+  enableParallelBuilding = true;
+
+  passthru = {
+    pdf_sets = import ./pdf_sets.nix { inherit stdenv fetchurl; };
+  };
+
+  postInstall = ''
+    wrapProgram $out/bin/lhapdf --prefix PYTHONPATH : "$(toPythonPath "$out")"
+  '';
+
+  meta = {
+    description = "A general purpose interpolator, used for evaluating Parton Distribution Functions from discretised data files";
+    license     = stdenv.lib.licenses.gpl2;
+    homepage    = http://lhapdf.hepforge.org;
+    platforms   = stdenv.lib.platforms.unix;
+    maintainers = with stdenv.lib.maintainers; [ veprbl ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/physics/lhapdf/maintainer.sh b/nixpkgs/pkgs/development/libraries/physics/lhapdf/maintainer.sh
new file mode 100755
index 000000000000..94bf252ec10a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/physics/lhapdf/maintainer.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+set -e
+
+BASE_URL="https://lhapdf.hepforge.org/downloads?f=pdfsets/6.2/"
+
+for pdf_set in `curl $BASE_URL 2>/dev/null | gsed -e "s/.*<a href=\"[^\"]*\/\([^\"/]*.tar.gz\)\".*/\1/;tx;d;:x" | gsed -e "s/%2B/+/g" | sort -u`; do
+	echo -n "    \"${pdf_set%.tar.gz}\" = \""
+	nix-prefetch-url "${BASE_URL}${pdf_set}" 2>/dev/null | tr -d '\n'
+	echo "\";"
+done
diff --git a/nixpkgs/pkgs/development/libraries/physics/lhapdf/pdf_sets.nix b/nixpkgs/pkgs/development/libraries/physics/lhapdf/pdf_sets.nix
new file mode 100644
index 000000000000..8f693a32e35c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/physics/lhapdf/pdf_sets.nix
@@ -0,0 +1,833 @@
+{ stdenv, fetchurl }:
+
+let
+  mkPdfSet = name: sha256:
+    stdenv.mkDerivation {
+      inherit name;
+
+      src = fetchurl {
+        url = "https://www.hepforge.org/archive/lhapdf/pdfsets/6.2/${name}.tar.gz";
+        inherit sha256;
+      };
+
+      preferLocalBuild = true;
+
+      installPhase = ''
+        mkdir -p $out/${name}/
+        cp * $out/${name}/
+      '';
+
+      setupHook = ./pdfset-hook.sh;
+    };
+in
+  stdenv.lib.mapAttrs mkPdfSet {
+    "ABMP15_3_nnlo" = "028q5xixxjxhb8sr7l5v5mwh9mkszm5m59fgnpb69yxvv40a70v0";
+    "ABMP15_4_nnlo" = "11zjp4dxmgp69kdkmdwqkpsajvwjrbwylmwgs56mgjb0vgb8wk0i";
+    "ABMP15_5_nnlo" = "0z47g5fwh53gg5ws5bbip5q2m5mm7vl09q2w58g6ah9dk25r10ll";
+    "ABMP16_3_nlo" = "1ylppc7clyk74mr7qgk0r2cknj2m58y38r3h1dfhjjjmdkw1g1sn";
+    "ABMP16_3_nnlo" = "0bwirm3wqyjj6i3asya7kjmmjhqi69l1rnc6gnq7v136ajmv96y0";
+    "ABMP16_4_nlo" = "0wx00x98wgvhwsj2fg4kp76n9fhv2s5mbar75dsp6xs4v0d1w1g3";
+    "ABMP16_4_nnlo" = "1cw52ijyrhgvyqc28pp278bavy9acvs6qywysgc7qjifygb14mca";
+    "ABMP16_5_nlo" = "0s7yz85fjfkmmxj3xdkhz5658n3nx8rr4yjz4hrqbcy00zdcscr2";
+    "ABMP16_5_nnlo" = "0iyypvj4645g7nh8w6v88pz37p81bxilgc4p7wlkaa90hiq0wrk0";
+    "ABMP16als112_5_nnlo" = "17kg6gvl09p5gm99yb9d8hkl1q51904qflsziv3r5ybxs18ym5g8";
+    "ABMP16als113_5_nnlo" = "1gaiyq70zxx7c7c0gkkad3ygbhdwc563al2a6ksy78q8is3bhdy9";
+    "ABMP16als114_5_nlo" = "0vnwbz6v2d02d5r34ysd7b4d22h948f3zri2n3yj93k6za9y42gw";
+    "ABMP16als114_5_nnlo" = "1gd41d8ay8i8m35qfqsm96jcv8vx6hpdsrdzsj415f4zpw5j29fm";
+    "ABMP16als115_5_nlo" = "0pyk43d6v3hzcq487nzj5awd2zhcjbg9ak0pcs1lykhvxwm227hz";
+    "ABMP16als115_5_nnlo" = "0i70z8i0qgzr875szdh8sa6x3xcdkvrfsba97a6ha7b6km4p1yjk";
+    "ABMP16als116_5_nlo" = "0nyrcb3hbzngj5j3yhpwlnz8a7dx7higngzmp26kmcrr4bmhiq6w";
+    "ABMP16als116_5_nnlo" = "11rph6vmmvvsi8msfp2agb7747n7xjgxb7z766i5jkvnggbmz75m";
+    "ABMP16als117_5_nlo" = "1pfjdxxdwrwz5n5206jcv61l8ycliwigqgram6hlm8ibl9a828cy";
+    "ABMP16als117_5_nnlo" = "1sz9hy2m983aiwyssg60v4kq1zvz4xxvbzrgsdik1qv13bj4wx9w";
+    "ABMP16als118_5_nlo" = "0ddaf2a7v3kdynsmls6zxld9zflv9m8qkp8gibc5xd6vqsg64f8x";
+    "ABMP16als118_5_nnlo" = "1slvr5ygwwryk63mah45xp5x31qwrf0gkrnh4p9fvl4rdkji6z0z";
+    "ABMP16als119_5_nlo" = "1brv76x4z0r0vrxr51gqvfzn4d03srhvab6dmxhhj3sy23qnbxg5";
+    "ABMP16als119_5_nnlo" = "1iqs1bi8r22awflf698cj39q8s2w86fwvdfgqb6sr8csm36ih6qp";
+    "ABMP16als120_5_nlo" = "133vy2zhvh49fa9xkp889mxy6xbriv10q8r4lx74wb9d1kqwfx81";
+    "ABMP16als120_5_nnlo" = "051bqfyh2017vnvlisvkm1ik6x7n829p8205f5algsw7wi1s7b9v";
+    "ABMP16als121_5_nlo" = "1l41qgba24rslg6ascsn1i0y0y0d7yh6hszhclxqyn07gzwq7p78";
+    "ABMP16als122_5_nlo" = "1ivy4m9fah8i0ipfxfq8caxa7pz8y86wgrqydg9wal9qin8n8xcd";
+    "ABMP16als123_5_nlo" = "0gcf7dqr1gzjfa6iy0qzivyibw72qpagfda0a5aksd0h6aap5mxc";
+    "ABMP16free_3_nlo" = "1hxlbmc2kzd8yai7ipyc95khdsawdcnzxzr0vkk3h42fxczx9y6q";
+    "ABMP16free_4_nlo" = "1ckwbyj18bgvpv16r6lx3866ca4frq6rxmzvz14ak6h8mpwvcnmq";
+    "ABMP16free_5_nlo" = "0sbkrn3g4048bn0y5bm6dqpn1za3761n6x40k7i4pdi0b1g7zlc0";
+    "ATLAS-epWZ12-EIG" = "010ddmyfrmscgd1xdjsxsjc773jlvbh3s6mjbwk9zd298i3bf4kx";
+    "ATLAS-epWZ12-VAR" = "1r9ip8549dzhs02skm8v00g6nsh7q1rwd3syz3bd6cl4sqhs0k37";
+    "ATLAS-epWZ16-EIG" = "0b1zzp8p0kh4xjn76nm6waqlvdpqvnwyqsnnqdp2n7b9r9ssryyf";
+    "ATLAS-epWZ16-THEO" = "0b0wqa203b2x159y54xhf9yh34lkchp48vp9693k51g9aznx8gjm";
+    "ATLAS-epWZ16-VAR" = "1zkhlv8yxfla46gj57119w9prsd3zyy5vg275bayfwa6b71gmc0b";
+    "ATLAS-epWZtop18-EIG" = "069rysd9mf3cshx7xkcv7735ydh2g6szvljbfkcqwckaqjg2x3v5";
+    "ATLAS-epWZtop18-VAR" = "0hpyp52dwl8fnw47pyw8g7fsz97wr6sk4yli6sx0zbj8yy2j28yj";
+    "CJ12max" = "1vk2zkaiqbl6fixaxy7mrggmmxv7lvnw736lxm5sh25dapg6s8ag";
+    "CJ12mid" = "0s2558ihypn0l9qqx25qwnawbc7fkbi2wwwhbyb108rjk2klaf8v";
+    "CJ12min" = "1kdla638m3axr65ndid9irmqhby4gl084r297xw3jxxlrb0b7hj9";
+    "CJ15lo" = "0hww26wbcb3i61z41s518gj41mn5gcikb08pdzyb5vyrl63b39bf";
+    "CJ15nlo" = "0acmyr5zpb7yzs2pikhgf8nx8l7csmai4sv361l7x3miqir56ss4";
+    "CSKK_nnlo_EIG" = "0fdc2a7xax7xl5n5f3ff5dcf7zbpk43z4kfy3ffij2qykrwfx7bp";
+    "CSKK_nnlo_THEO" = "0srs535f9xydqfzyy208304yxah1rg1r5ilx8hk9nvgaiy7kwnvq";
+    "CSKK_nnlo_VAR" = "1iyiam3kbjrckh0sw290hwi04h5cqif081afgd16f0a44wbcjsi1";
+    "CT09MC1" = "18ap08vh1f4ivibq5z57wv7lwvw1pzwl865xznzzcr0jy4f59103";
+    "CT09MC2" = "04yxg4bl0dcgh6hb9g223wm084w0q1y2lbd4z7w8vmvvvn579ij8";
+    "CT09MCS" = "01vjpdgy79gvk3w4blwjgfqpf50mjdi5kmfcgnlnwxp5q0804pgf";
+    "CT10" = "17glhnqj4yknqy70zs7m097n1qq9fqljj3mna6qxchmgql04dvxw";
+    "CT10as" = "1709bb3ky4mpn4cgx9lda8swmvb2pl70ly1gzk4ahgsflkb8iaj3";
+    "CT10f3" = "0ijrx0wm03r0yg6f0n4vwp1c3kypdjpmmnv12gk79y193bfk362l";
+    "CT10f4" = "14icbh8lg9290wfalr1bsx0zff1df19x0qrjqh8n0y9ckqmkbh6l";
+    "CT10nlo" = "14ib003sxpxc8awywjckbw124aqhmi70wg4hlwc2nvdh46sqk11b";
+    "CT10nlo_as_0112" = "0n2abywijgjys56kz5qm30arh3v5k685l0gayl4mdablbw0ccaca";
+    "CT10nlo_as_0113" = "123kbzzfjlparffgmqpimygzjcn0wi1vnyrkjfjn2kwcdjazz8dp";
+    "CT10nlo_as_0114" = "17lgcbf7914dfb89d4v8fal69zq7gmadvha8gpz0wfw4p0pq765b";
+    "CT10nlo_as_0115" = "0rgpc3mcsd18yg4j41k9hhvbjbi3d1zrd9fq1314m4qvviq6d9j7";
+    "CT10nlo_as_0116" = "15xyhmipv9xbiz3jaqdj59nyczn35nq14183xz4py68l2v20smqi";
+    "CT10nlo_as_0117" = "1qf9azafrwqpyp5flc912g2frfpi899vb032yrrgqj2l1flg474x";
+    "CT10nlo_as_0118" = "1jra85s6df6vvmljkf8gg2jkj3r6b1yl6aidzlm3j59di0fk9xp8";
+    "CT10nlo_as_0119" = "0y7k0w592j777jpbrh8v2zh1l6n38xbxjvyiv5x4pvwi6zrp9ppf";
+    "CT10nlo_as_0120" = "0mh1hdmic5c3krlb1xypy0n6r86r7da0ay9183xwb68d1kh4j630";
+    "CT10nlo_as_0121" = "1gwvgj3bwv8fz8mbmgnfsy0bvsm4h9d898mf1kcaaivh56sfial8";
+    "CT10nlo_as_0122" = "1jkkqcmjynd30paxc9z9gpmxkfhs6ad3x5sms5980jx291rc8hgd";
+    "CT10nlo_as_0123" = "0gppcp49275pg3yv37mzkx7az6298wwy7gqla3gzxfzlas0ybg0b";
+    "CT10nlo_as_0124" = "1irl19q4wyw36dwhln1m4y7y40by5xgdjqpgj7sqaix8jvijc9bz";
+    "CT10nlo_as_0125" = "17c6n2prdsry2phqmaykrf1yc02mvhacb87r7yl0nhkhx80kysk2";
+    "CT10nlo_as_0126" = "183p4fd85zs2c1j0zwfsa08wq6v780xvwbg44bpm52m4ih1dgqy3";
+    "CT10nlo_as_0127" = "1vcpadkf90x9qiqaplc25hld7qljk5d3lzs1dssqi5fh1kci8qd1";
+    "CT10nlo_nf3" = "1dfzas3z075riwx26bkmvjck42pjgbm32d1flg5rccsxjn4pmmm0";
+    "CT10nlo_nf4" = "0npv1h5gi2vhgxzcbcsl740z2p7j9p8pg3jwfb0yz88wlbj5bkah";
+    "CT10nnlo" = "1la35l1b3hxdkihh9vkibfh68rghcfgq48q27x2b05dfhcvcz9lz";
+    "CT10nnlo_as_0110" = "0j1f6lbjhwcpgfb8kwzsij0hfmzb3dggi6zwwv9f2w39ax2rfb8i";
+    "CT10nnlo_as_0111" = "1519hvpi1zrjk8p31ksna39n9l8v02ggj5q775q243p9qyfayxlf";
+    "CT10nnlo_as_0112" = "0asnbr0va5p1j81kmv8ar267aciap638kcb48cs5ghz9fvhxp197";
+    "CT10nnlo_as_0113" = "1j5cfbv1d5q2hscyrvig6xkk7gfv4x5cxn1142qmd8pdm9ky2fdb";
+    "CT10nnlo_as_0114" = "03rkvf4ljv7bnzp0fyyrypbbx4rxd1y6id3dfvg4w22s65kp0csm";
+    "CT10nnlo_as_0115" = "1d8rkwvnymx4pi0v1s2vbc880mggdmfnzjppd7fghjqj4lkkanyi";
+    "CT10nnlo_as_0116" = "039i2bq4xr6hlvg0syzmyfv4lm7lrwr59myrhd609dybiky4aqd8";
+    "CT10nnlo_as_0117" = "0q3a5lbpxh24zv7ypbc680kqrkwy5m7xbgx5v44b6cdzlib6lvsn";
+    "CT10nnlo_as_0118" = "0b11mpgrkqn2n37asg8qg3qmhdhbr8lmj8qjixxpca0h1j7m71a5";
+    "CT10nnlo_as_0119" = "1j411yqrlbhqmby8mplgghmb4zxclf1h3pdsffx9iv8sq1q6dy2i";
+    "CT10nnlo_as_0120" = "1djf9qfqrywpsyv0w6igidg9a4ca739dvqgc7qz7qg2bpclbaly9";
+    "CT10nnlo_as_0121" = "0nlm5iwcvb02fd7kan4yp60qbc0fgir4dii3xg03n42xzqixy2qm";
+    "CT10nnlo_as_0122" = "1kwq04i5ln8wv32vf4akjnzid3jdq67zccfg7xriqrwd9367x5kv";
+    "CT10nnlo_as_0123" = "0w4fmsmyci09v0cxnmhdbqxv3xq3wa9ma7m4g39sg2gdsxqz1rgd";
+    "CT10nnlo_as_0124" = "0yzrj1pdigssi39z21k9jxbiahhc1785rjxhq7xl8zx38paspbg7";
+    "CT10nnlo_as_0125" = "0qvdvj3wkbkw0b0zv79ybds2pk5z9kbriwsm5ffpnycrfkzrm2kd";
+    "CT10nnlo_as_0126" = "1cf8bqi1g4c3xqg5k9m4fa8v8bcnwkzblmfn7zc396pgbzhhz610";
+    "CT10nnlo_as_0127" = "0zknrx60h8jdf2pfg2zq6xk73hn86gcv69ml78ik5ms0y5gp21av";
+    "CT10nnlo_as_0128" = "09yn8l3nv29frj3xn9pafiz2iamccp8ii8j7hmp63iaji6c7m5fg";
+    "CT10nnlo_as_0129" = "1ypq63r5myz2phn4y5sbb5dbxvycwis8jixjl0n95xmqlx5zhixi";
+    "CT10nnlo_as_0130" = "0ilr6ijbbh1zki66ma006h1qhdq7wmzm0ipki78bk01jnr5yl5sg";
+    "CT10w" = "1qkwz1drbkxcb4gskkfn0r7fsa6g9hjlc8716m633x35kha1v52j";
+    "CT10was" = "00s4n3nkngwyhh82l132v88c4jgkg03ff4x7m7nna21lvkv4wkb3";
+    "CT10wf3" = "1r43pzb1291bjcmahgfh0f86pvb3nhdpxw7gikqmypdmck0n2mqf";
+    "CT10wf4" = "18bf9k0jp95y9yz0m896sdzy9q1fyp0r4f5hrv4jq4d1z84zdis5";
+    "CT10wnlo" = "17wsw6p0h618q68swn9mjsahfyqikjgsiykiby7y27ryairv709n";
+    "CT10wnlo_as_0112" = "0p7mh56zyqh9i72llbmjchwm50ifa358snd8i1nqr3r6lr5265hb";
+    "CT10wnlo_as_0113" = "0nl4lk3cscsn6p50b3qqaabqfnkn5xgjmcxvfrr1n4njh411kmln";
+    "CT10wnlo_as_0114" = "1vck1i34dspbzskzpbqxbq11gp79drlrik52waklvsl5110xawnv";
+    "CT10wnlo_as_0115" = "070cl0prprqqkkzwxnvyw7r4ivvs8slb98v5yza0gvpwck0blnzn";
+    "CT10wnlo_as_0116" = "0v50pyjqpcrarbx886la0hr6vwvnavsldm9amcdp1vlck5w8mmg9";
+    "CT10wnlo_as_0117" = "108sb5h79mpgkvdzqlx830dykba5kw9zqgxa60i7bcyjnv0277si";
+    "CT10wnlo_as_0118" = "0zf335291hwfmdbhgl5v2y5pbc9slm7dmjfkijdv0jm33drpkcg2";
+    "CT10wnlo_as_0119" = "0kvwc0k5y51p4qvlb6hhxvn9c2n8x0xn0xyp5zkz75ad3vaz9yvn";
+    "CT10wnlo_as_0120" = "0yvbcni3xf718xild7s9g6cxw7dwa38f4iqdm5z7dd9ahxyw9rxv";
+    "CT10wnlo_as_0121" = "1z0mlrbdn8a9n6h0jpha3p1lqz4iamrwa80svqn9y4qii9h5pjkn";
+    "CT10wnlo_as_0122" = "1dh5czjvyjnwlzc14vz91693pr3nyls5g926g347rdrkqkjq8dcz";
+    "CT10wnlo_as_0123" = "0nf7qpgb83ahm5dkzr10xafhcx4lvb3zlxnz70jczl1jd4v2cld9";
+    "CT10wnlo_as_0124" = "14h07z06csxb6v6ai1w5ba0kygnsrzdwxr2nx1kcn93axcsqqbhv";
+    "CT10wnlo_as_0125" = "0g0w6mwy5y4l36cn4z8gfmigzharyn5xqk5ricasracrnf7ydix2";
+    "CT10wnlo_as_0126" = "0dbkkyimpll9r3979vbk4xqi5cfhzr6b28x6j73fbxxxi1xfavl5";
+    "CT10wnlo_as_0127" = "1svmgs55kg74rifjyns38lggv1c18mzmpmvsv116rrllklb19pfp";
+    "CT10wnlo_nf3" = "1m13if0d9xijq695x41snpwwrsgs5a0jvil6j2ww8cspc33d7vr3";
+    "CT10wnlo_nf4" = "1b9lz23rn2w7fqwxxgf6fcg620ac58dnb1ssj3ml3vfn7z88yx43";
+    "CT14MC1nlo" = "0z82q7xr9agq8iyw7w2rcclh27mry5snn5jswn3cxpgnalls50rx";
+    "CT14MC1nnlo" = "0fj6hjdv82fp4iv7iyk9gna7sksnpkgqx0bsrl2wjbigm4ys031g";
+    "CT14MC2nlo" = "1x6a6js1jpvkykagz6w3klh6hb2wf56r3kh65i6qlnzak4m7b8sq";
+    "CT14MC2nnlo" = "0hbdz8agjm16mm51hclpl2nsa5ji88zpqdsn682xgihq64kahsnb";
+    "CT14llo" = "0sz2ni8xcjjg8034qjrhb77ak1akzlf5fwq00qs9c196lk5b2x7s";
+    "CT14llo_NF3" = "07zzs3jprh0haqx5bcsii213m99m2nh9vki76d9cbhicyzx23pc1";
+    "CT14llo_NF4" = "0bxkw5qms6dpab0zf1hhd8dllrjip2izbv23aqpg72d5rqxb6ny4";
+    "CT14llo_NF6" = "060fx2xrc90id3nb7rlmrvkxlyafx3g7nhdb5jmbr3hxwrzrq674";
+    "CT14lo" = "0y36qkjqd75zf1w1hs1q51qxgin7sm3bhmcbwczwrb17c3vb4m2m";
+    "CT14lo_NF3" = "06iad9lrpxsy0d365vrjv6gjlgggakylrmj1px17y6s796jq6c6g";
+    "CT14lo_NF4" = "18c03j26mbapjidq01s4yrfdh0i7j75gbswdhwcllwdvcg3gnki1";
+    "CT14lo_NF6" = "09ncggqnqcdpzakm16dzxd6ikay9gd5k8si80k52hrr9m2gf36ci";
+    "CT14nlo" = "137i0n7g9rgfsf5rx65d50njwsqawprazp5an513kmz1cwq0cqmd";
+    "CT14nlo_NF3" = "0pmamazh9i8pahalasr7mwx67ixbgrbsh8004grg0cimr2y4iwjj";
+    "CT14nlo_NF4" = "1k7sy8lpzkwy0dc4ig9i9134k854fk0r0lann6pj3jsxs0l6h5km";
+    "CT14nlo_NF6" = "1gfwr0sjbq41gx3057hqy8v6ysivjf1xrh6fp3qqn6m13gy2kbas";
+    "CT14nlo_as_0111" = "0kgg9r635grdwp152ylzklawzy8nf2ywlp75bjc1yyagg765k6jv";
+    "CT14nlo_as_0112" = "0j0bxx0gjdnj41gjasgd153gd811wyhsza56fvzrpka820bkk6rg";
+    "CT14nlo_as_0113" = "06if5wk1asazvff57ah944mnzkh5460yqkkwcs8zhnwx2kbq9v85";
+    "CT14nlo_as_0114" = "1szy7jwjvdvqqpjvcra1f0wn8qgrja6wx4kwcq9vf60pns7mzk7v";
+    "CT14nlo_as_0115" = "1kkahzmrbdr7s06v093arnss0xpxv7byqqx2f5aqh4fzimwp9n7v";
+    "CT14nlo_as_0116" = "0qpkmmpq1b33grf85jzkanwpa02j1cam39pkxchql95hv2jlgw4l";
+    "CT14nlo_as_0117" = "0381620r6h9s2qby52jvys4z8m6jfafa5qnia2fq3q1pc0xp1q2p";
+    "CT14nlo_as_0118" = "13hgxmjx6bv7njb6jdlypy1z61nqf5m5bavxsbrmwwfxlsl4jdzn";
+    "CT14nlo_as_0119" = "06pjl10js0xq7p14ifjn7xhndxyb39sxyc9ksd6wx55i6zyqf08l";
+    "CT14nlo_as_0120" = "1wyygxxjlcsh1qg6npk5szfbf59k4j80hnxnxhah9x9wrg5kg9j2";
+    "CT14nlo_as_0121" = "064afbxxqx4rsa3l73rki8wxa08a1rb53qyf3nwwjb4zb426jfgg";
+    "CT14nlo_as_0122" = "172xvndzcm8s4hzjgrq3szg6j7z4s2f4pgr07vr178zvn9986ham";
+    "CT14nlo_as_0123" = "0q2dansvna4p04ilb1sajz3s5mi89jgd8badqh6r72g26s96dman";
+    "CT14nnlo" = "1y3gd5wzpwv024xcrn70bz6h62n96mgqqwyl5r7q6czw0is52dzq";
+    "CT14nnloIC" = "1wnpwy0mz0c5y29wi497jcn5k47bndd0h65d6a18qcfk0l15rfzx";
+    "CT14nnlo_NF3" = "0ijns9bjkw8zcinba7rflc7ic03mn5701lqfrxqjyq4q6kh8fia7";
+    "CT14nnlo_NF4" = "0fhyzaxnm17pi7wfh5hwaic9q4y0hb05ripd6r648wnnhhi353xy";
+    "CT14nnlo_NF6" = "1rnacbsh0y9qjd2x7ggs87zi9msrxrp2l6lidg92i2la4pri27zk";
+    "CT14nnlo_as_0111" = "1hl88j40czr73h9fbz0zbliawlqwng7ikrmq01hsfns190axm8w9";
+    "CT14nnlo_as_0112" = "1w9344v9ihr0w8vrfhhxn81gcnr0qm6ihwwijvcdds09jpdlp6vr";
+    "CT14nnlo_as_0113" = "11symfb1ljislbksrars1k766fa2n1inbarzbw3kp01vxpw8gxf5";
+    "CT14nnlo_as_0114" = "1s1zz0ibr72jvx9c7w3kcryiywnmg264gprn020yxl9sqfzm0kzz";
+    "CT14nnlo_as_0115" = "19c4c4s7djav1zai2nlxbvy8fzg8hqlynri1y4hyhc8hhl00lwb4";
+    "CT14nnlo_as_0116" = "1shjwky7jjwcci0frra2lfc0wycvza7na89c4bsqiksnk413v2z3";
+    "CT14nnlo_as_0117" = "1mp5xxv810khs59zg4kfsdj5qp6ny0878fbz7jf101mpyhdawf0m";
+    "CT14nnlo_as_0118" = "1mvyv13agnmc2c47i9yl8ki5d0qac3l6ipn3nf5rwxjgah495rv6";
+    "CT14nnlo_as_0119" = "02b14lrx3zpbl5s4nj1rvh30i9xdji37yvvg2xwjiw3i56vl8b2l";
+    "CT14nnlo_as_0120" = "0wf29wz9k2v39pbzh91bxwifbs4cn0gsnjdzm24cpgq7bnhyszn3";
+    "CT14nnlo_as_0121" = "1w12xmxqclrrwvfb2g3zvivkq858n0lpp0bzfibvh4wamdyyx3an";
+    "CT14nnlo_as_0122" = "1hgghn4ad7fj3ya17qnka3xcwz7sp4fl0vpcbqkrs9mbbz570fjc";
+    "CT14nnlo_as_0123" = "0m66gwhw2n668sg4srq683qbavwabrk4f4vfcsbppzbcgm7i4yz7";
+    "CT14qed_inc_neutron" = "0ph835nfx98i74nncmspj7qb5798yciq76hqvc505n5zd0hwp87x";
+    "CT14qed_inc_proton" = "0gv0rlr6l62gidqp02ifn75d1ribvbihgpaqc92fww73zwilr7l0";
+    "CT14qed_neutron" = "0ck1vmqk17i7rq42hra79cz2rm8ngxv4da6dvz62l6m2nrga3l2k";
+    "CT14qed_proton" = "1gijxkq5gpsljijblzd13kgr7xjjvnjv18v02jivylf73igsakd7";
+    "EPPS16nlo_CT14nlo_Ag108" = "1p7gckhv44h04rvknd6fdizy9c1jqfwic7ppf0ra14ic8wp1g7wg";
+    "EPPS16nlo_CT14nlo_Al27" = "0hxyakfgknmixxndfj14i44afp5gcfz9afjvjdaj702sv42a7qa8";
+    "EPPS16nlo_CT14nlo_Au197" = "1g272110y3a1fr6raxdfhagn68i0lcnwbdhiiqg4j6wb6v4m3p6i";
+    "EPPS16nlo_CT14nlo_Be9" = "0zxsdmvz919ajwwb917613byshhpr876jcg9kik0pkz8c4ddr2z0";
+    "EPPS16nlo_CT14nlo_C12" = "0mjmjk9n36aikhm8i6zwzfszyb5zcy1syn13vs2rm12x535j6dm5";
+    "EPPS16nlo_CT14nlo_Ca40" = "18vd67splj75sjijfvhyq0q6068yr8l083sczamwpmy8z3l798ih";
+    "EPPS16nlo_CT14nlo_Cu64" = "0g64gpc5cssmwl1sn7cl0ramsg2zfq7snr9bzr41q2dznbvqahgd";
+    "EPPS16nlo_CT14nlo_Fe56" = "0dxfzpx99ha9g27bxx6xzxxh87va91qqwq6hnz1qsligjfx7q4yz";
+    "EPPS16nlo_CT14nlo_He4" = "1ln5kz3270kyx6m3ji6q5xyp5a23f3kbwh9z9dmdwwsw7q9n8way";
+    "EPPS16nlo_CT14nlo_Li6" = "04rviiml0rnym9qppsczcydw37r923ljx8hj63vv6dxng0g617qb";
+    "EPPS16nlo_CT14nlo_Pb208" = "1b2zibpigdvvkg29zh7zm32jpdr2prm35jasafh17pfpwlfc55mb";
+    "EPPS16nlo_CT14nlo_Pt195" = "14v1gicvm8i8z9d98rlv5rbhaglkbi9fhs3z465p4d764al6znnc";
+    "EPPS16nlo_CT14nlo_Sn119" = "10nxn6rdp7svsrkdcdwxryjmirn1s871yj1w493adpfcy3chqw9k";
+    "EPPS16nlo_CT14nlo_W184" = "1x8ndmkzmnl79vz1bgi9972190x03asvgnls6qiz746xl37q4ky7";
+    "GKG18_DPDF_FitA_LO" = "0ql03hp30wfaw9gfyska0v5vf4p3n2dsxvkapjqnyfl01ad6vjw2";
+    "GKG18_DPDF_FitA_NLO" = "0n9khzvhyxfwbl758vzy8jgyqkgcgl328m657vlami3w22hmpbrz";
+    "GKG18_DPDF_FitB_LO" = "0s15ia8mcn00xl28rhdxjigpq0ai80a831366sx0w7qx44bb5n0p";
+    "GKG18_DPDF_FitB_NLO" = "0qlv7p1fx3gq2cqrvamlpn6r54nssbk7rrx1znhfdzx3x9v1ii1q";
+    "GRVPI0" = "0i5icsw9hf4jm25d0szxqc3r1131n417lv8b4gslg93xqj4ry1hf";
+    "GRVPI1" = "05j3mcrb0sq4nzv7y0k68f2m3v8vnd13mzbhq43gjq712cbj126p";
+    "H1PDF2017" = "10yfikq1mlw6bzhbvwblajicpqzhi06gl1aabhxr6mcf9vby4zw8";
+    "HERAPDF15LO_EIG" = "12cqj3vqwi86sfgxkiwbd7rnpw1awnbqbc852b0x32d9j18nz9c2";
+    "HERAPDF15NLO_ALPHAS" = "06yiid611zi5i9snqrkjr3g4z2n1gwkvqjs606ha0b4nrwlpnkhc";
+    "HERAPDF15NLO_EIG" = "0h5brmk7w70dgbwhjikfpprni924c2f3kxsmxzcm2qlrlgj0nswd";
+    "HERAPDF15NLO_VAR" = "049bfsgkcfnz4z7vzkl4vr6ivp9kvak2f07nmarm8q2wwd6pjjqy";
+    "HERAPDF15NNLO_ALPHAS" = "09qf93b336yak3aqnfqlvz5j6xvvrsqkc4ag41xh4prpswj8fmrc";
+    "HERAPDF15NNLO_EIG" = "1yf48sr7nak6lph2s1vd3s91mrw0da9kjxlvqzcg3n9j48l3f3r0";
+    "HERAPDF15NNLO_VAR" = "0di4b75ag82iysyrv5wfvn8728jdi8mkq96ycpq534078ps2n3bd";
+    "HERAPDF20_AG_NLO_EIG" = "0jr2s4dj5w9xwidrqbqi8af2dqycm4vr36qy3x5javllp4dn04cr";
+    "HERAPDF20_AG_NNLO_EIG" = "11cdhjwz4qm2hxf8i5kl38ny4nbsrd2vf3jkwz17lrgls716wh00";
+    "HERAPDF20_HiQ2_NLO_EIG" = "09wwkv8lk7gy14avvamk3sqdsvig2bvnzha5d4v5s2ln7g6g7vhq";
+    "HERAPDF20_HiQ2_NLO_VAR" = "1cgprisw1bksi8nryqqsy6ac097ywxdgj5yg796izari7j72p4bh";
+    "HERAPDF20_HiQ2_NNLO_EIG" = "05670fr76fx14gp4ywywz71scr6f25jk14i4k84gpcb2l6rnbv9g";
+    "HERAPDF20_HiQ2_NNLO_VAR" = "15nxgq5hy6ncvqma6ai8k7601bfw97p0h9db2gqbbyyvxf2ldnc7";
+    "HERAPDF20_Jets_NLO_EIG" = "1c2n2cn9l8x9jc8c4dh2whgz3378nnnvb3448cgpv0qfm589ygxy";
+    "HERAPDF20_Jets_NLO_VAR_Duv" = "0z2pkmlpffy29x2bh0086m1ybbb94x507fkr4khmdb4d0h33ppdw";
+    "HERAPDF20_Jets_NLO_VAR_fsdn" = "1ya4hbr3shjggpqi6h3g9j3jnbmmgrva2djbsaxgp7icii39yf1a";
+    "HERAPDF20_Jets_NLO_VAR_fshdn" = "1sl2sq27xx40mj4zn00vc44k3vf1yxb7fwpqp0p3lqlp9gcwlycp";
+    "HERAPDF20_Jets_NLO_VAR_fshup" = "0qs8g45s70d0l3g7xh0bqhk65ac9g003bjpacd9v97gzpm6jvr45";
+    "HERAPDF20_Jets_NLO_VAR_fsup" = "17ix21qwjkp9gy9gvn3143d8ganzg9r78n6q47wdfxh12jzvgc7k";
+    "HERAPDF20_Jets_NLO_VAR_haddn" = "15rbsdddm5ayg5r0gljxxcmrrvzhfdr44ky2d6a70wjr2g6lc5yc";
+    "HERAPDF20_Jets_NLO_VAR_hadup" = "1x3rnr2hkcfglpmv732blziygzvdlw2rkks1ap9majnayh01vvfk";
+    "HERAPDF20_Jets_NLO_VAR_mbdn" = "1fi0rp4gpqj7yjmv6b68ac7m8v4f9m4q9kd6nq4ndk2gp11i6799";
+    "HERAPDF20_Jets_NLO_VAR_mbup" = "062dfx73lihlhndn5xjlsimfxalxbfhn1xyqzbk7bsqj9mffmwli";
+    "HERAPDF20_Jets_NLO_VAR_mcdn" = "092hwkx9kliib8lf405sy9bvxg6xgydnsxl92yjqwyicajihhij4";
+    "HERAPDF20_Jets_NLO_VAR_mcup" = "0qcirk0sqnkfyb3pdxlpkl51pbj2gybw7kgw9xzmj4j3jdg2zjqg";
+    "HERAPDF20_Jets_NLO_VAR_q0dn" = "1xv319ai4pwy1mcy6i3wk3mp4nkdpjb2zcnz17gxvdx2l6z1bz5m";
+    "HERAPDF20_Jets_NLO_VAR_q0up" = "0bfsqx23jsrjjsczl5j90hp3njvlwaw8mypj1si83mr1z0s9q4rx";
+    "HERAPDF20_Jets_NLO_VAR_q2mdn" = "16qfw118c3lh91zsg2nb49xjynbd9w1rh4y5ybr35v38i4acpdab";
+    "HERAPDF20_Jets_NLO_VAR_q2mup" = "1q80h7r0cklpz1jam3nzxs7h3i8jpgpc03l7c3g4mkz61ynh0ida";
+    "HERAPDF20_LO_EIG" = "1r6ylwi2yszsk5dmw27734s0ghkvdawmqa6fik1k3j82d9s22mkl";
+    "HERAPDF20_NLO_ALPHAS_110" = "0zmmg0k33bf52skbz42cgxdjw0ap33fyf0h1kfd9ciw4gra2rakn";
+    "HERAPDF20_NLO_ALPHAS_111" = "1mlc33kfs4zlmn305hifjh2d85byvym1mzdj9bc3nlypv4zcszlf";
+    "HERAPDF20_NLO_ALPHAS_112" = "0wswbdmkyv0a6fw531s1s7jnskzxsvwh9bydvgiav53pfpibsyx6";
+    "HERAPDF20_NLO_ALPHAS_113" = "0qx7kh3cmqz59sm6vjcvi2hj5c7d816mc7jfhqr03hvavqcsla14";
+    "HERAPDF20_NLO_ALPHAS_114" = "1n2434j9gvdz24h30sng8z5jmc9hhnm9nbr3hi82n6ssnwabsl97";
+    "HERAPDF20_NLO_ALPHAS_115" = "05wk9glb6xpg5n689slihcfkdvm3kgwpxw8dxp4rp8zyvrsh6l6f";
+    "HERAPDF20_NLO_ALPHAS_116" = "133vvg5bh1lx6zcacnaphkj11608wafim4rb6lcqx4mkpxabmzxa";
+    "HERAPDF20_NLO_ALPHAS_117" = "18n1s7qqzf67lg8gphpm606dvz802i6xmlz5if5jdhjz8r3qklzf";
+    "HERAPDF20_NLO_ALPHAS_118" = "07xj5j7k54bwi9xq51cf8zanqlkjcbdrvw9k8ch3h40bk961c5pz";
+    "HERAPDF20_NLO_ALPHAS_119" = "0njyfp84kf51m9rw9z3d3figp23043p5ml7cdb45dvh9hbpssh40";
+    "HERAPDF20_NLO_ALPHAS_120" = "02paa7bng9nycd8dd2zf2099592mbaz8c4a5hamcmvzqfz0sdy7d";
+    "HERAPDF20_NLO_ALPHAS_121" = "07hmbvpm96pm5yp9bsx9aksznksh6k4qrw0k28bns0wjn75khxsl";
+    "HERAPDF20_NLO_ALPHAS_122" = "1pjn3h1wr6l6sy7kjvk72qc409dr939z787q2qbaph7xh5rf7k2s";
+    "HERAPDF20_NLO_ALPHAS_123" = "09hz6pw4nklwf94krna7g80659v9c2c0f5rf99mnx900xyhk7pxa";
+    "HERAPDF20_NLO_ALPHAS_124" = "1d9gmc3g0j32kgwyfddmx9f3gxwrgnq3xcbrabdx9cw554ysd6sg";
+    "HERAPDF20_NLO_ALPHAS_125" = "0mi2q9yhkcdpj7336kbs1vw4zvm8c9fryz0c7hdj246kj26rb0mv";
+    "HERAPDF20_NLO_ALPHAS_126" = "067rng6gv24qf1j8lz37115mc42k8wjpzrfcw4jw2d1yg22ci0lb";
+    "HERAPDF20_NLO_ALPHAS_127" = "0v3xcdr8wsradqf3bzayvvlsdjzr54qa2kbqb5pyvfi3rafrwrmi";
+    "HERAPDF20_NLO_ALPHAS_128" = "0ywnd9c6bq5bp02s3b3pql8a74wm472p11alqi4b4pmlzphzk1ix";
+    "HERAPDF20_NLO_ALPHAS_129" = "055ya2wxscbzp2w3zx2a5xgs94wl60bm6c2vxrs2rgnab72382j9";
+    "HERAPDF20_NLO_ALPHAS_130" = "0k91azhwxrfni5yfasn83f67ma9w8fax2k1k9xc8pvgmbh3c14wi";
+    "HERAPDF20_NLO_EIG" = "1ryamdwblj1ysbha672q2z9qai62h6cibb0laizfq2nq4j4ml3vz";
+    "HERAPDF20_NLO_FF3A_EIG" = "1fs6ldnwflmn5ysqkq9aky2xskd0dvq372h48x89h4vmsvd302wn";
+    "HERAPDF20_NLO_FF3A_VAR" = "0jd9wgrhchqjcjrkh5hjx7x8agm43jq5p8dmyvk0rniz9zybx64d";
+    "HERAPDF20_NLO_FF3B_EIG" = "0r04zjfaaq686g3bd6c753vkcwsbgdcfzr67ngm7vsz27zscbjbz";
+    "HERAPDF20_NLO_FF3B_VAR" = "12qrfld8958gvk9c2q8l0mvccx6wkrgnsiapgzl37s6s6zcgid10";
+    "HERAPDF20_NLO_VAR" = "0q5ih9ac3z6n158h6q149h0ggkfjrdn5rqwf7nzi3j50fhs63swj";
+    "HERAPDF20_NNLO_ALPHAS_110" = "1828i4ybdzs7zj62lzsifgshxdas81vjvhfg86ixry4xqkfprlfg";
+    "HERAPDF20_NNLO_ALPHAS_111" = "011d1a900jjpa78ph05sdy353gfmrr8azpngcf0cjigcn4fwdna6";
+    "HERAPDF20_NNLO_ALPHAS_112" = "0xb2bnigwlhs0vs3fwzsz66zidchwgs97kn6vjfhxnik8xdfkyb8";
+    "HERAPDF20_NNLO_ALPHAS_113" = "13b8gh0qwpy574ra6184vgff3wba0blr44lxj56xrkaql9zi1jx1";
+    "HERAPDF20_NNLO_ALPHAS_114" = "09n30p5pbw2wyjss2jjz1h4nl9scin42s91sxdcrwinnc3y5n1in";
+    "HERAPDF20_NNLO_ALPHAS_115" = "0nlimqmfhx2ijx48ylciih5diwlsb5zzkli82rgnnxci3r4ycjq4";
+    "HERAPDF20_NNLO_ALPHAS_116" = "0nr8svx60zrf42nxg74v0h759y9lwg54892xpdmswg7mw0nwcrm9";
+    "HERAPDF20_NNLO_ALPHAS_117" = "0xiqdr2r5dyyp5q56b3w04wy3raqrh1mjsv1fm05xswxn2xwyhlq";
+    "HERAPDF20_NNLO_ALPHAS_118" = "0d0w0f077g11s4clx1556y9xx5nn1dgm8zcp0bk92v4lapngf33c";
+    "HERAPDF20_NNLO_ALPHAS_119" = "1w9nl0pnfc1cii4knmqdq4cnh6shhhgj8pg4a42bx20lvqc3aqgb";
+    "HERAPDF20_NNLO_ALPHAS_120" = "1lksn0rcxq2scwpnps8dawlzijhvwbg0pn2is4r29igbqck2jvb3";
+    "HERAPDF20_NNLO_ALPHAS_121" = "03d58rbibvgcvmsw86q3030qnw5nnvq8p6diqscd9srb8br06p8m";
+    "HERAPDF20_NNLO_ALPHAS_122" = "0541yx5fcadw7rggpypd8kg393m5hwzsw5jangsmsrsby1rc2m4a";
+    "HERAPDF20_NNLO_ALPHAS_123" = "1ckc8s04jf7x19xpwwb8g60likrlz3dp91qzaafljvbd9b27aa61";
+    "HERAPDF20_NNLO_ALPHAS_124" = "13dx2wh0dhxsjjk6ak7wy1gr8g297dpc9xvkxvb5ayd0rzmhjlwb";
+    "HERAPDF20_NNLO_ALPHAS_125" = "0yh6jakycsqhh4h6jqrilw1afmk1jkcq2px978z4qcz4y0m6bx4a";
+    "HERAPDF20_NNLO_ALPHAS_126" = "0045sa1kl4w75ja6an38i2a3fi78q6xg22av536l9h1c8j82ql13";
+    "HERAPDF20_NNLO_ALPHAS_127" = "1f5l9cy59dc3rc9xqrsq85g0mbhyaqkbpzi40f3gjg6bxjlgb4rx";
+    "HERAPDF20_NNLO_ALPHAS_128" = "1c2pbd4zam5av582r777197638l6i5a0chmw9ci7l05lzm19nzmi";
+    "HERAPDF20_NNLO_ALPHAS_129" = "1aipmxxn7s1r66m6gmrjgr2yca7sxvpf8r86s4a5j768akkgmlld";
+    "HERAPDF20_NNLO_ALPHAS_130" = "1g2q3438bivd20i685jmx565cq108yv72vhxmpmhysh4qwvwpqqw";
+    "HERAPDF20_NNLO_EIG" = "12zn49jx7qjr8apgpbhknzll4vwlz3x9y1ai908ix2h86pgap2ml";
+    "HERAPDF20_NNLO_VAR" = "152h21khvkhxwx87c5lqwzpakmahcpj1ixw6kgl0wrrwjknvfgxn";
+    "JR14NLO08FF" = "16azkqxf1yw1j32ay6j01gf8n9n7qm56jh4yzgjag0zdhm01lbip";
+    "JR14NLO08VF" = "1ilw38pp4vy8c8v1glfi4ixca73wjkdg3di1wh9p8xqrifdb096p";
+    "JR14NNLO08FF" = "1w0pywmjb4xi7bsvv1mdd4q2adf1g7khspfbkphmlh8zipx29nxx";
+    "JR14NNLO08VF" = "0kzszj1r141fcg9vbf53480224nxcc5wfk9zmpmzbmrxzi0w127r";
+    "JR14NNLO20FF" = "0wc3qib90dpd1wgiymrn5lzwhqmh58ji2s92vpj2v9v4spws7pdq";
+    "JR14NNLO20VF" = "18l4ipn80gmh9kdw7a1k49fwgbl7b1frgc0hsa04vbwnv6hm73hn";
+    "LUXqed17_plus_PDF4LHC15_nnlo_100" = "18y3pa6gjmcv2s21si9a5dvbq6xxqphbqz5qiy39c62g2zf8512c";
+    "LUXqed17_plus_PDF4LHC15_nnlo_30" = "1bnwlxr8p4xmr36zd2flhqssil6w7jh50k46j0mxfnd8jgxgwn6n";
+    "LUXqed_plus_PDF4LHC15_nnlo_100" = "08jzl4wcsrr9agycq1r5kd5bqxsx4b637nxk34s82vs7vwpq7qib";
+    "METAv10LHC" = "1vn4wnx1blz6wylbzirswdqqf0knmyh1pcfh62wvj695mh7i0w16";
+    "METAv10LHCH" = "1p4wy7m1ksz0r1fylwz3cbq7jl8s58v817n3d898l83ic2ghp4vj";
+    "METAv10LHCHfull" = "1w623939fjdyx1316rxyaavf6kmxff19himr00br57jrw3v49nfg";
+    "METAv10LHCas0116" = "0y1l6djkmx8zcsii9j9krwhvgh071a9y5d4m1rkqpbqf6dnq9kll";
+    "METAv10LHCas0120" = "1g1izkf3j0vdrjskbjzh8lzsdn1bqssidr0gsapyzlx0dzc2ixdp";
+    "MMHT2014lo68cl" = "03wrjv448zdqblv4zx5b2p4m0nj8h4igabh8pzskj0327w7g91lm";
+    "MMHT2014lo_asmzsmallrange" = "16ki4aib5dslb7lx6w9nzx18nh0sgh41zbiw4hszf2qxn3asdyhz";
+    "MMHT2014nlo68cl" = "039zw5zrzm661bgjv7d0imzhfv3j3ixnrssi13ynfpin9v2izy6g";
+    "MMHT2014nlo68cl_nf3" = "0bjmng4ifdswi88kf59zzxpdq8ka80m01208nb2ij3dkpw0n5hnf";
+    "MMHT2014nlo68cl_nf4" = "01g0bbfwxaqhgpv0yz17fvwa4q1a1vh9867kp9fyavn600kd91ds";
+    "MMHT2014nlo68cl_nf4as5" = "1wdrk7b1hs6s8f2gxp7b3c1qrxvncs41h4aph1dhf8zffn3653yy";
+    "MMHT2014nlo68clas118" = "1nv7h2j31z061mgph5154qgxn8rl5sdgwzzs3d3clxfshh5gcccn";
+    "MMHT2014nlo68clas118_nf3" = "1d7k0vablssy1vfimsvxdiklaachw44lg37fgj1im52k81qxzd3n";
+    "MMHT2014nlo68clas118_nf4" = "1s8gv434b4mz6y5rv4kms69ghliafcmih09icj4qwk66hj7pn5lj";
+    "MMHT2014nlo68clas118_nf4as5" = "00zvf9zkrp9lk9psqvzsn04l1rw1xmq37bd2c8mqc2px3zdq9q0f";
+    "MMHT2014nlo_asmzlargerange" = "186jz5r74qas28x04daqkxhs5p31i68hhy8a7q6lzd5nh42x6kk0";
+    "MMHT2014nlo_asmzsmallrange" = "1x347h5g8d2k73wg6naj6zs7m2glankiwjgzy0gmmrnz3pyryq6x";
+    "MMHT2014nlo_asmzsmallrange_nf3" = "0ckw5971pwvvix8idw2m6j7w6bjivqpa1ynm6ml0bhc75cmm6l4i";
+    "MMHT2014nlo_asmzsmallrange_nf4" = "1asnk3pl3dw1sh76k0s95jb57cv5k90zjgpbkr3nnrbhvnkizl5a";
+    "MMHT2014nlo_mbrange_nf3" = "0bghvriw01jxmzcm9isz7in43ph7vz6zzr0rmmi81snrwvg8918h";
+    "MMHT2014nlo_mbrange_nf4" = "1gad7269hz4jj3946yyqzmcx3zyxx2p4r0h88x3lfrm0rd0fg00d";
+    "MMHT2014nlo_mbrange_nf5" = "03id7bfds16kbnd0nwjla8sn4pl3q3qa5v0a3pykdwj14k9igi3n";
+    "MMHT2014nlo_mcrange_nf3" = "1zfmdclsgwf6517v88zg34wby40606sspcghh4yahc2bbznd6a63";
+    "MMHT2014nlo_mcrange_nf4" = "0hzhkv81a0z3ichj5kfhwnhc720xw48h63llijl0pcfv8qqpvl19";
+    "MMHT2014nlo_mcrange_nf5" = "148hg5dc60yhfmwsm0svasxc7l1py6ggj7lzv0mrshl07rwfh62a";
+    "MMHT2014nloas118_mbrange_nf3" = "03w1wish6ig3mw9j195rakxsjr7gr46qz8dh009sigqcgp3s9fad";
+    "MMHT2014nloas118_mbrange_nf4" = "1lbj3r1bbxx2y1ybnxpd0cw7jzkdz0rb1grn1pmwmrl0l13s7j59";
+    "MMHT2014nloas118_mbrange_nf5" = "12q0gkqzhxqwrvy8lpg66ldsxnwr8id6jv6k4dj6f0p93qif5wr8";
+    "MMHT2014nloas118_mcrange_nf3" = "093yh7wa3p4028x5zxw15pwkrkjxzfl7kcdm7jqlf08zwm52clyx";
+    "MMHT2014nloas118_mcrange_nf4" = "0q0y77i0fgdvjk9y76kqzxpn22jbzsh64qbx8186ri9fqzfi868i";
+    "MMHT2014nloas118_mcrange_nf5" = "187wsfm49ack0jh9rwy5h29b1511b17myqn28bm6nbn7r4rfvnkz";
+    "MMHT2014nnlo68cl" = "0sss77zwv94vcy4ghv6493vbw08xwm264dk081w34jc4ifa0vg90";
+    "MMHT2014nnlo68cl_nf3" = "06paq3nzs87babpksabnkqi38gvvyfvpqlh8p18140zrdpdffaj2";
+    "MMHT2014nnlo68cl_nf4" = "0lbqpdy66v3ns6ax9vj1ix4wjn2pwlw5y1z26hlbrxz3l8hbizg1";
+    "MMHT2014nnlo68cl_nf4as5" = "1bh5nsral3lrlqq6afvq9ahkfmhfw3mq0m0qcvsx4ma5jx5rv7dv";
+    "MMHT2014nnlo_asmzlargerange" = "00l2jqccsl3jfwdj7lndr4b5cpx44krjvnm3h0hjw6hkv4irxb5s";
+    "MMHT2014nnlo_asmzsmallrange" = "1x36pv9nhj74whibb16bc414ypcks6nd1s7q1jc0fb7ndf5rijy6";
+    "MMHT2014nnlo_asmzsmallrange_nf3" = "0svpc51n25cbz2b43zbd60bfckrlz3q2jn3x668xnha9qsd3c2vq";
+    "MMHT2014nnlo_asmzsmallrange_nf4" = "15jggp2nbm828nprxyyinmp7kfxngpm0apg446hvwd8hg7blb1a4";
+    "MMHT2014nnlo_mbrange_nf3" = "0r9gi5cw76zn0lq3fcs7s2xxh6jl9y5vdv31bhv6mac9jmhjb458";
+    "MMHT2014nnlo_mbrange_nf4" = "190wva3k49mymflbm1v5xd449j38jm7ylfcdiflym8pgkdvwcgyl";
+    "MMHT2014nnlo_mbrange_nf5" = "19mnv9nz01lmbiv01qmflhg24kldhqpmcc8mgp7bnkhicgivb5ib";
+    "MMHT2014nnlo_mcrange_nf3" = "0zskxladqr40v6wqafbl1pl04vq43babqf437c4xxg4sz9435l3l";
+    "MMHT2014nnlo_mcrange_nf4" = "0sny8r9zap8gnjh9id1klr59d9hs0bb40pf8hpy8q5pg6052vx3q";
+    "MMHT2014nnlo_mcrange_nf5" = "1l340c1x4fz647bhybrvbb6z00mla81b78jfqpnwd4vwfxnqmq9y";
+    "MRST2004qed" = "1kdrzk2arvs36lnpkbc94w06hx3nh8nixh2qjhb271c2blwgahzh";
+    "MRST2004qed_neutron" = "12vna0ic6gh313k22b44b0k9kd939v7zjl2hj65k1075j23mq425";
+    "MRST2004qed_proton" = "10z0cr8pnr0lfxxi916naiz381a2cqn461jblfzvvddwqmqbllbc";
+    "MRST2007lomod" = "13ar6hzw9al20zlm8lg0hvwmgrmv0dbam820gm36rj8p7i33qlr6";
+    "MRSTMCal" = "0kbyp4rypw8jm28zfpvf0grvfvxmsrp3grwsmfxpa2c38x6la3rq";
+    "MSTW2008CPdeutnlo68cl" = "1x2y7hl8ckplx175bp3wi04xafm44dd7vzfgnmvvai1x0072xi51";
+    "MSTW2008CPdeutnnlo68cl" = "1szsdqjkmny30mpw4pdzi97vj7i55agxm285dvnkzp06ycgp1ld3";
+    "MSTW2008lo68cl" = "0j12mv286r4ds9v7piqh4n44yjnc51hm74lqa4vv5xznxhibng7l";
+    "MSTW2008lo68cl_nf3" = "1s5z55b2aj37bx0p305lcgrdclgvyl99xgfrl0rhmdgr2byg33wi";
+    "MSTW2008lo68cl_nf4" = "0m539ihcz3dxy4gpfbam5badhhsimywlbgnczbybph8yn1118j9r";
+    "MSTW2008lo68cl_nf4as5" = "0vl1q7xnr425sscbk4djqi56jbpzpi8l3z2nknfqiy3l7ykg23ng";
+    "MSTW2008lo90cl" = "0af5j0s1i8yn0mjs4nb77migihw643lhd7dfl184v6wik3031yg3";
+    "MSTW2008lo90cl_nf3" = "1a6kc1lgswjk800jzcqlbpwzz4rs3g6agckhnlr8cizmp9p7risk";
+    "MSTW2008lo90cl_nf4" = "1bdjl58gslhw539650qwi7vbvsr22hpxpca17rkbqz9szh0ljhym";
+    "MSTW2008lo90cl_nf4as5" = "1crsm7dfcs0fn1i2ng18wy23z2ap01xr2rsnafqlra0q135m6hfp";
+    "MSTW2008nlo68cl" = "0pdvb5nshjjw7ddmdmj1v88m3jlk3vwfnab0pf2kf8hfx10hbv4q";
+    "MSTW2008nlo68cl_asmz+68cl" = "1zbvbpfy30612ygr9rz7ickdrbdsg0gd6p8xs7ylzj5h06sckq84";
+    "MSTW2008nlo68cl_asmz+68clhalf" = "174spwhpl6cvj8bw8wns0jiznnsjrv3i7cvd4x9vi0fa5z4sb5d3";
+    "MSTW2008nlo68cl_asmz-68cl" = "15mmdnd3wwlrs5pwwhfa9f88vjpgza8vwxwxpyadxsmhx9jk79hy";
+    "MSTW2008nlo68cl_asmz-68clhalf" = "0dd7llc6ip6myy2yvf16riqs334f20l8wkmkksq53xngmz9qf263";
+    "MSTW2008nlo68cl_nf3" = "1j82imyylvnf3x39x1mb19hhp2nbcq2lk82hf7sj72c557l3qpjk";
+    "MSTW2008nlo68cl_nf4" = "08f008by768c8v3cmrsbgxpglqdj58nwwf22dmk2mbf2jq449s0n";
+    "MSTW2008nlo68cl_nf4as5" = "0hrqmmnp20vpj6dpz3bvm531i0pvl06als8irqz91cknv6zsvxf9";
+    "MSTW2008nlo90cl" = "1d3p4cialrngci9kn7225zcmyrr547dskzi74dfgdhbqc0256a2r";
+    "MSTW2008nlo90cl_asmz+90cl" = "1g4gwmriyl71xd2k49jc391vfr02dic0q73lc2wphm1y8qmbphdd";
+    "MSTW2008nlo90cl_asmz+90clhalf" = "0743kimz3ljlb921pacw2lii104j0yfvv073wddz89r877np6mi5";
+    "MSTW2008nlo90cl_asmz-90cl" = "0fnqj7ywnp9nz5733ggjwmhxpy15zs2xgxjz7ixmql5mmaz3sxb6";
+    "MSTW2008nlo90cl_asmz-90clhalf" = "1jrp9q8li7a4bwhgh7q9h9zc0sdhck957zn14q9ca9kjsflyb9f5";
+    "MSTW2008nlo90cl_nf3" = "02ihabrcgp474wkq4w2fshpiqdznjaxyg5vawv52yj6hxifyy5a9";
+    "MSTW2008nlo90cl_nf4" = "1wrdl79qy8mimqk48705f3sd651zy130k1dmvvzwvdsjd9y8q58w";
+    "MSTW2008nlo90cl_nf4as5" = "18d1pvijcyfxkipmd2v2zrkxdbhxygkcyn3p8vz0vzq5q7s1s7r2";
+    "MSTW2008nlo_asmzrange" = "161364fvc8w8ggad58r1c58b0kngqa1bjpabaqi5cigmzazj3rl8";
+    "MSTW2008nlo_mbrange" = "1b7z4mm3f8wjjbxb8hs8l7kclh1yfz5yffzdsch2i09c7wh79616";
+    "MSTW2008nlo_mbrange_nf4" = "02s7ljzwamsha87i6nsd4kdfb9ky4k6m8xpqa1iz9wgrcy4pmw5p";
+    "MSTW2008nlo_mcrange" = "1bndxfi27r8k0m4r26bfsflbbrjc4s2vp5ixy7qidkw33g6mqh96";
+    "MSTW2008nlo_mcrange_fixasmz" = "10s2sfhdx5668cffwb0sbh5m54zq0inmpfnhkj0zk9ij4f5y815f";
+    "MSTW2008nlo_mcrange_fixasmz_nf3" = "0zwnicbmmqbak5sw92njpmvxpjnnhwl1ggvlj8q39hn5w5kdy1kq";
+    "MSTW2008nlo_mcrange_nf3" = "01mlzqwk30glr95g7n2y3yvvy7s6mkbdb5cqwl1m7k8d6m18n49g";
+    "MSTW2008nnlo68cl" = "0y6lv1wkhydfnlakjrrrjapxaapa0bcbmfx0w9c4psgy156kv1fv";
+    "MSTW2008nnlo68cl_asmz+68cl" = "0ik5c4vcv1ki5cnvnyk381lw36bsqp8mjkzh8ghqjz6z8fr2hb97";
+    "MSTW2008nnlo68cl_asmz+68clhalf" = "1d8c0rr3lscin28622f82s79xgbam4qhqkpvvjgynhyn0wy46b4j";
+    "MSTW2008nnlo68cl_asmz-68cl" = "1qhjhdzpy67665ccwv0n3g7jlyb2vfk60cphjr0jb1adgv9fxa7q";
+    "MSTW2008nnlo68cl_asmz-68clhalf" = "0rlsis3r7l32jdiq2yhx1mz7q6qlzlsrarljvrmxf0g0g2d8nr4c";
+    "MSTW2008nnlo68cl_nf3" = "07nrz7afd1mcsqc3lqv9vk2phs1nfxdl63qh1bc0g7nznxwmmn97";
+    "MSTW2008nnlo68cl_nf4" = "1kd62hzk2p3q56kj79bs101arp55ajlyhwwa3vq3yp37i3ynz9ds";
+    "MSTW2008nnlo68cl_nf4as5" = "0x19rq5k9c97vzskqppf4k0fjahwiw2c1nb6iy5c2fq8mj1pz2gj";
+    "MSTW2008nnlo90cl" = "13xqlfys37b8chinah2yqmzd0clzli06p7vjk30ha22wgwm02dq3";
+    "MSTW2008nnlo90cl_asmz+90cl" = "03p1af5962smr5794322gj3s4f0fvnvmfizsabch03ivyaqpr1nq";
+    "MSTW2008nnlo90cl_asmz+90clhalf" = "0v99vr5kkgkscqvs8b3ahnvg5yl9rfzgf7hams1j12vjg2b9kd4z";
+    "MSTW2008nnlo90cl_asmz-90cl" = "10wxgh52zs0fp0bwd0b6csnz9x6mvp45gvjhk0y1dhgfwbcvw9y9";
+    "MSTW2008nnlo90cl_asmz-90clhalf" = "1kmvp1yfgsx4jhsjc4drg82cq4xs6as4grwrymfkrqnvhcg86vap";
+    "MSTW2008nnlo90cl_nf3" = "0vw0cmszwp49fsskacccl921za88cl5cfy0sqckgxzs4hx21x43n";
+    "MSTW2008nnlo90cl_nf4" = "1b3fy8mfclgsmvpyzfs34fjry6djmkjcjppdxni1ipjyp1bcaia3";
+    "MSTW2008nnlo90cl_nf4as5" = "05phi752spikwq74i0hfid7lsqi51hdvwxm520kdmbdz2pblbz4f";
+    "MSTW2008nnlo_asmzrange" = "1nj68qhvlsqi7299d9rrsmq7pr6bdil4gzr6yla2cgn4wwiggdwn";
+    "MSTW2008nnlo_mbrange" = "0jnmy4i593wz80lbm0r0cwdj9xw496p3in0lq8ksr4yjwz0agpbk";
+    "MSTW2008nnlo_mbrange_nf4" = "0lw3p4q0ixj7plcmwqh43lfgv1i7ljar3f3k1v6f0imyvz8swfgr";
+    "MSTW2008nnlo_mcrange" = "17v549iq2wn5zvxfdvq8pf5f7zvgnpa72i6gxvxzfqwkji7mv522";
+    "MSTW2008nnlo_mcrange_fixasmz" = "05c8z2q2866550clx2mwb1jvhpn0agkyg82vvrswi3h4hgkvlfjx";
+    "MSTW2008nnlo_mcrange_fixasmz_nf3" = "0r86xsl1wfphwdj2hhlilkwc2949m7bcn42dms14g7w45i24g6id";
+    "MSTW2008nnlo_mcrange_nf3" = "1c9lsggncwghvw9mgd18h50ljrnlpp1p5r2zlzf8z3g8i4f3aaih";
+    "NNFF10_KAm_lo" = "19wn44svz61lhk33kzc6id18w6qbkw4bfnwncar19phrjjp965v6";
+    "NNFF10_KAm_nlo" = "191db9pj5yspiqc7598r147j9wvfc4s6cm0q805m5vmzpfg2cgr6";
+    "NNFF10_KAm_nnlo" = "1hm8vhk1p31zdn72bgcyyq0w5qii1ba0cf81wjlbhwv4fadfd4sy";
+    "NNFF10_KAp_lo" = "13yas11c7xxij45zrd3r6njjvx33kn9lg8i28ki0y4nw6ss21w3b";
+    "NNFF10_KAp_nlo" = "1jza83klbcb3j2pcg2xhgj2imh4llb6hsfkbfj294q0isqypgzsv";
+    "NNFF10_KAp_nnlo" = "0xwl34a31ajxwlgx6bhzzyf9b2xiq7bpv51p4zi6k1xihs91vwzc";
+    "NNFF10_KAsum_lo" = "128cj81qp09hn99dnkm9q06wf2dr7xjq9qmwvrmdizrd8cwfa4l1";
+    "NNFF10_KAsum_nlo" = "19pglfl1i5qg8sj3hg0qnhr1f66isfbrv7f901hnxniibbdjxib2";
+    "NNFF10_KAsum_nnlo" = "1769ybc49a94appmiw0bbn3kkvcpw82sggxgvvda5jq9m36m9yzb";
+    "NNFF10_PIm_lo" = "095xl0cs6p5z44hydfa963ylxvzqxdwwj1n8jn7n0c48rwssx357";
+    "NNFF10_PIm_nlo" = "1fn8863092fn4aqacprbsdxlgz27q6pam08pccwq9ps0dwjn7cc5";
+    "NNFF10_PIm_nnlo" = "0j4p50k821pphy8i6s73h3c29d7jb3bp5s4l8rl3bfb0nfx4p6hq";
+    "NNFF10_PIp_lo" = "0hhw2ympx1a8d3sl953k27yzww0j2f5m9b865gv1ybb3l9ccv1i6";
+    "NNFF10_PIp_nlo" = "18k3s7i1xvh8717n5cdllbb6zs8svh2bkw0k2zf4ql5ijiypvc10";
+    "NNFF10_PIp_nnlo" = "16mywhpc3439dpk2c1i6gxrv9khyyg0kl4gsc41qyi3r4d7k6n2c";
+    "NNFF10_PIsum_lo" = "1yh3hxfmgzgpwqidmzlc189syjbsj4vyswc4kch7yykxw4dqf6sa";
+    "NNFF10_PIsum_nlo" = "12rgg0nc9rjvwfpf0y9kl1w9814a4pv4b17p46h8qm6kfyqqwjia";
+    "NNFF10_PIsum_nnlo" = "19iz4q31apgm2il9478c7zmmc6kgz2wyp84qja761jvyl6z0img5";
+    "NNFF10_PRm_lo" = "0c5pavhf5flx2nmld2dprgp1lsbvsrjw5mqdzvgkks7ibvq0ap5j";
+    "NNFF10_PRm_nlo" = "0nfwhp9hacnm95w2qa5hvmfwaj7drc0w7lxqw1lrdp074bpd0ma3";
+    "NNFF10_PRm_nnlo" = "084dz4xxmydf71vkhcrmj03jkwyj56jxvmbzm22mdh2dxmkz3l1g";
+    "NNFF10_PRp_lo" = "014m0vjzrr4rbi84qxzmrym07kc4wax29fs66mfxkmrimxpb9l21";
+    "NNFF10_PRp_nlo" = "0lrzw2618kgk7vsksbr1qxqc4h9lza573bz6208hwdgkmh7awasc";
+    "NNFF10_PRp_nnlo" = "0bv07hh5rxvqw58jcam3piiiy19w325nrwivrifyv5wii8sybz8r";
+    "NNFF10_PRsum_lo" = "1a9m77rl49wzzgdkr6x618bzcm2p50f915bbggknx5xjw550dqd1";
+    "NNFF10_PRsum_nlo" = "1qambqywda7lvvkd6kx2r1g60v6lnqcamdd51396id33fvw3k45h";
+    "NNFF10_PRsum_nnlo" = "1kijaxw6v1w33q6l89raz7ic59zcmd3nx5djp83lyg134a15crmw";
+    "NNFF11_HadronSum_nlo" = "1n9fb71kl7y8rp1smyal28wdvdx1b410mhqkxmavnr1fs85hkh85";
+    "NNPDF21_lo_as_0119_100" = "19qw2hp1yk82qgcrpx8wp2fg8wklaj6rr653m6mndhhr0aa0w80v";
+    "NNPDF21_lo_as_0130_100" = "0p5cw77dg5pkhl3d0y6r3k8vhw4m467wf3gd8kp2l5vcbdwb4izv";
+    "NNPDF21_lostar_as_0119_100" = "0i23axf0xl11nb2dn6p34bnm1xfisnn3a82db9dz863n60gqb5x4";
+    "NNPDF21_lostar_as_0130_100" = "1aka01747071l53jx4v7rgmfj5danzjillbwincgi1b28mw78yhq";
+    "NNPDF23_lo_as_0119_qed" = "02d85an11mr66yg3vi5fq4919ymbrh9h8b8qzzzm9dvfarzmbwxi";
+    "NNPDF23_lo_as_0130_qed" = "0qsxxw3nds42924xqnhs56wmd8ihmrip28glj47q9r9i3kgw3lv0";
+    "NNPDF23_nlo_FFN_NF4_as_0116" = "1d5wccg8l5xmdr8pvks6851zxrlgq1rk2y5dgp10k6r108059rgn";
+    "NNPDF23_nlo_FFN_NF4_as_0116_mc" = "1sc13cqah6di97fmlnb6qw454jyrp0i9jv2pfxvi8ix2vzd6km00";
+    "NNPDF23_nlo_FFN_NF4_as_0117" = "1gkzb46fnf9k97fgbbxljdnklffwnxmg58z01x55iklq4sn2aww3";
+    "NNPDF23_nlo_FFN_NF4_as_0117_mc" = "0nc3fx9ggqybymw5kglwq3kmznc9hm28sp58gs1l4gwx3xiy0bj6";
+    "NNPDF23_nlo_FFN_NF4_as_0118" = "1zlcqh0nfy8yf2cnzs0iy615nbmhpa2zh4carvifcqd4lv4azkp6";
+    "NNPDF23_nlo_FFN_NF4_as_0118_mc" = "0518z8jakc9r74kzanraf2n8haminfipp2rvr1288ymhsl5bxyp0";
+    "NNPDF23_nlo_FFN_NF4_as_0119" = "1k5mcql2411020m6vq26ck8ig3q01j79ndjgci2biq743m8nlvm2";
+    "NNPDF23_nlo_FFN_NF4_as_0119_mc" = "06yv9mwgvhag5442581r7by3nsxcy7c76llgaalphbzszqr2vy0p";
+    "NNPDF23_nlo_FFN_NF4_as_0120" = "1m97g47p44vq3izjji6agwmj2fwdvgddzy8w40mqqbr9fk19lbyi";
+    "NNPDF23_nlo_FFN_NF4_as_0120_mc" = "0bjllckv61jc1y6f8c1gqdh36r15glqn8fqp99q0kckaxyszy5vw";
+    "NNPDF23_nlo_FFN_NF5_as_0116" = "0x4kjj791hkwng4l5dvch8z0ig1nkliirlz9mkv02g54qrilnkmy";
+    "NNPDF23_nlo_FFN_NF5_as_0116_mc" = "055clf0m8l8gnby2lgwh4wkyqciskwp54y34vb1kwfbhdf71zmnj";
+    "NNPDF23_nlo_FFN_NF5_as_0117" = "1cplvrizlsjcixsjzlm2drssbjsrzj9bvq0k5mnv79r3p1xdp997";
+    "NNPDF23_nlo_FFN_NF5_as_0117_mc" = "17nic3kw991dbrhyjyxpk0zzv8rjh0r0whd6nl8v6wsf5q5h0ny2";
+    "NNPDF23_nlo_FFN_NF5_as_0118" = "07fgr71x2zk2ywcbnw0ikv0p9kzsmd83kdidfs49vm7azcbm0qfw";
+    "NNPDF23_nlo_FFN_NF5_as_0118_mc" = "0s365gsidichyj9x5926q1gm0x1bp52chv7fkpirflrrsywf0lc3";
+    "NNPDF23_nlo_FFN_NF5_as_0119" = "1qspxbwswz7ssqj2rx2jdg0bkj8prawwshvjd26ifz9i0l9qnqc0";
+    "NNPDF23_nlo_FFN_NF5_as_0119_mc" = "0aqyhrcrzs3kqhj1hndilpibvdwfw9qhg1x0cypx97h16n37j46x";
+    "NNPDF23_nlo_FFN_NF5_as_0120" = "1k9savpyg2iqr1ab4i5y7q1qhd8zxq413040h2v46jl8mp7x6bjn";
+    "NNPDF23_nlo_FFN_NF5_as_0120_mc" = "01g7mh7v62s47cwdf6ws6j37gxl4mrb26ivdzzwmhy6ydiw8ka53";
+    "NNPDF23_nlo_as_0114" = "0mmq32kddspgpacx2qj086das9z2bxh3l37qvp9yf84gqzjj7mml";
+    "NNPDF23_nlo_as_0115" = "0jn1gv137d2x3vxq7ny0qc0hnfmcd4hs3cxkyn7j26w7p59q81x7";
+    "NNPDF23_nlo_as_0116" = "1mnq360acd5vfwz9z8fzynldchkqrfiqhsxvi3s9a263h3p44bsa";
+    "NNPDF23_nlo_as_0116_mc" = "0ngw2hls52bax6dmis3nfa2ix8q8nh2d9mwjax4cjdkmmf7rdn2g";
+    "NNPDF23_nlo_as_0117" = "01wkq68b8zl3mznzvc4p7p9b4ik2bnqgjq97mw2287i448mnj9jn";
+    "NNPDF23_nlo_as_0117_mc" = "1s2g55240gh9j32ach9rban0iw4hjmw5haj1c21wgyh4nqiqlfwr";
+    "NNPDF23_nlo_as_0117_qed" = "1l2rbxn9fw72nmhqazfkh568q4df0q2jp0pn0fj368wdpf36fk0b";
+    "NNPDF23_nlo_as_0117_qed_neutron" = "17rpz4bdp3fxvafiz32aawxw64prkhqwqpnfnbqsigcslm18bwnc";
+    "NNPDF23_nlo_as_0118" = "01kax3g4d8nd6n1gip70d02kl3kvbqib93b99xgwc1f0np85p3r0";
+    "NNPDF23_nlo_as_0118_mc" = "0qhs7r4zzw68grrmfh7qdad49w4y4mvf55qnp86piri5vi8lklwk";
+    "NNPDF23_nlo_as_0118_qed" = "10xfv8nkg2jjy3yg9m9gakz6lixdvmahdy1z12znqyr1br57bdhy";
+    "NNPDF23_nlo_as_0118_qed_neutron" = "1zffxfykx2v3dniypsvyyqbz5pb4dcww653amaxv96hplw3fvr0h";
+    "NNPDF23_nlo_as_0119" = "1v24iwddahxy6sd43bxv6ywf8n7302qkwl9hv7d074q1d932kgr1";
+    "NNPDF23_nlo_as_0119_mc" = "0l95fgr5bwhsh0h3qqlnx9czkgmrf5y084zlzk3qhix3ldh8zbp4";
+    "NNPDF23_nlo_as_0119_qed" = "0rayscazcacy89lzg0ynpwrl9g4pnjwwp0l0vwc3gjz9cwznmwsk";
+    "NNPDF23_nlo_as_0119_qed_mc" = "1cc3candpavcfbv681zpg8gmwbh3g14vqkhs2s6v7rr9xhx6zqv1";
+    "NNPDF23_nlo_as_0119_qed_neutron" = "12h4x97yglcklrvwh937xa5bgqahq949a5wm3nyjbvrfsw9n330i";
+    "NNPDF23_nlo_as_0120" = "0f8lwydw45vy7c0mqmz60hpc0b40czx0gx35liyrhcbjvj9129m7";
+    "NNPDF23_nlo_as_0120_mc" = "0kqiizf0c0mbdavnv7ivk89kga84j7p7xprqi10589ggplchx8ag";
+    "NNPDF23_nlo_as_0121" = "17603srm35158sdwrqijyxm614splx7k6bjyzphgvznnkwpgi0i3";
+    "NNPDF23_nlo_as_0122" = "0c16498ngx436k9mb8fwkhhvcbdyjd4m0jh54v2n1dl354jz60sm";
+    "NNPDF23_nlo_as_0123" = "1j6d7k8d04gfx532iipd4vzm0nldbvy86pg8asgv4xrh80c1zslc";
+    "NNPDF23_nlo_as_0124" = "0dwv41kc9qsvvp22gvxi56gj13dnklgfp4ndrm0475q6gvfz25ak";
+    "NNPDF23_nlo_collider_as_0116" = "1hl7xw8jz0gijxh9cjkxv1rb1xncb1622ghf6wnsaarlqr4947ky";
+    "NNPDF23_nlo_collider_as_0117" = "08krhmjbgza9f4mbq7cdj9g7hh260aaniqqi5awbgp7idbn3nccj";
+    "NNPDF23_nlo_collider_as_0118" = "17645h9l8z8nk7pdaxdhvcfmcvi8ib8yylhiijkkw9yrywb5pakm";
+    "NNPDF23_nlo_collider_as_0119" = "0csf74lpxgzg48v6962falxd8n2nc9xdrqnxxwadqqyrnrfs06dw";
+    "NNPDF23_nlo_collider_as_0120" = "17xqx8hnwy7a67ah0ds8m3nv3cbq20vri83nlwahwfsbig7w505x";
+    "NNPDF23_nlo_noLHC_as_0116" = "02nhh7n2qzx3ak7ih2d3vw3a4dffxbbpv9wrh2yhz30zbrqqlzv2";
+    "NNPDF23_nlo_noLHC_as_0117" = "14j8hx346krwbi2fyyk77k60d7dlk2xlsc6zd543y03jdpk4ahlx";
+    "NNPDF23_nlo_noLHC_as_0118" = "0vwi6h1fkwjg28p2f3br1g601i8ca4dpfjs9vxg80kjzkif6k310";
+    "NNPDF23_nlo_noLHC_as_0119" = "02l15h62gn0njnj459pkp3k1nhiaivlknmbxb3giqpg6wmm2m9y1";
+    "NNPDF23_nlo_noLHC_as_0120" = "13lxmwmywg7wrwhgp0cb41b42479fgfa1bz3aqkbrnf6gi6pviln";
+    "NNPDF23_nnlo_FFN_NF4_as_0116" = "0j4ng2vl955vnq40zv5v9sb0wk8qari61v7995p2l0sxz268sz50";
+    "NNPDF23_nnlo_FFN_NF4_as_0117" = "1wjqlv6mbl2lgvwr5av47amrs8gnqkpkxzq91jvpaxkya3bmglc3";
+    "NNPDF23_nnlo_FFN_NF4_as_0118" = "113s8lxrmif79c6f11pnk5jz7q4lq7108gcfx84nanpksr9dmi6m";
+    "NNPDF23_nnlo_FFN_NF4_as_0119" = "1688qacmp9kl50q1vzffcprf9ydbi2bb2brc68jvid5f7bjkyfmw";
+    "NNPDF23_nnlo_FFN_NF4_as_0120" = "1i3cjnz5zgk8jw5jcrqy6kxx1i5v2a2lgy2fdck3j19cvn0iqqr9";
+    "NNPDF23_nnlo_FFN_NF5_as_0116" = "0v6ap405v9zapbi5sqldvs5lyhz5wsh4cxl8ssxj0l4789qm24hb";
+    "NNPDF23_nnlo_FFN_NF5_as_0117" = "153f95cqd0hkxfy9p81mf2dfdp13h3fhhp0qyxmiknhqm10ykdxq";
+    "NNPDF23_nnlo_FFN_NF5_as_0118" = "0fch9i9qj1k8h3sdwfdcd75idi0bv2q7a338dvj4697xqpxf2mj4";
+    "NNPDF23_nnlo_FFN_NF5_as_0119" = "03r72mrbvy9jkkbmgvp2776xxgjx0jyxsv4bvpxmhscpym9mjvq7";
+    "NNPDF23_nnlo_FFN_NF5_as_0120" = "0rsflim77kdp849pg6f87rq6j0wirj4gayvrnvi4xvfjlk1mxkll";
+    "NNPDF23_nnlo_as_0114" = "1p32hw48zwmvj9i5iyg9pqhf11zwf7m7g5q8prfj8825dvsgql94";
+    "NNPDF23_nnlo_as_0115" = "0smmwd7xla73sb3bci46grj1kfd751pybkf7fz3w3qdkp5jjglqp";
+    "NNPDF23_nnlo_as_0116" = "14blxcfb2jbdgwh73f2spvqxy5dhn5v6ygwi346dzwswipwbixir";
+    "NNPDF23_nnlo_as_0117" = "0di0a5dkskalllnh90ngfb046z5hm9ihjra1r1ck06v9ryam2w9c";
+    "NNPDF23_nnlo_as_0117_qed" = "0dvzz7ac45j4m655k0i3ycy6xwfm6y6801qsb5bgp1kdv7g2pj3z";
+    "NNPDF23_nnlo_as_0117_qed_neutron" = "0v05yw5nc1r7vh8sjag4fmdklkn4jmcdpsmgvwm7sblgfc6gnssm";
+    "NNPDF23_nnlo_as_0118" = "14p9y1ryc1j26gl01sn60pmrfpnkm81bhark2g98xz8dmfmjp7iq";
+    "NNPDF23_nnlo_as_0118_qed" = "15mcq4q20ijmf06pcc626jlk22fm8c473p4i80bmi27h5x2pl56i";
+    "NNPDF23_nnlo_as_0118_qed_neutron" = "15vsjjc1i2x6lb0603h6knj68si8cvxml2xk97pw343qn3p8h4ka";
+    "NNPDF23_nnlo_as_0119" = "1qzap9zlpwyyshh8hc0gm82y9rl9hpy232j03gd6vwmcw5pgm2d2";
+    "NNPDF23_nnlo_as_0119_qed" = "1cqvdmq0hm9rh6749bn08i6c94gshpjafmwv8siizdlm8v9af442";
+    "NNPDF23_nnlo_as_0119_qed_mc" = "0a77i8grscxwnybgikik94ldiddrif3yy6d4bqb6x1aj4hr9i5ag";
+    "NNPDF23_nnlo_as_0119_qed_neutron" = "182jqm5019n94givs4rwblpz02hp90mbizp0b5svrxf21zdyrmbx";
+    "NNPDF23_nnlo_as_0120" = "1v8ykgxnqbvfra57xpamhgbcjvj89dndhk62pmji004gvqpmwi61";
+    "NNPDF23_nnlo_as_0121" = "1fv1m86ya7zi77ajd8r1nls2zcr7n6s3wqrdiwq5ikxidqxc6cgy";
+    "NNPDF23_nnlo_as_0122" = "0bn6bmvs8w9qsqcpq8y8a7w64xbkvrqwiikm5shjprwqy9xbspyf";
+    "NNPDF23_nnlo_as_0123" = "0w7sqyyf98ymxpgqfh8gr9g1pdwr2pw12zc8gqykn5nkjbbmijgy";
+    "NNPDF23_nnlo_as_0124" = "1hilgda0gqyj81a5h0mxrl5g9ahlm1n6mhd3ajkicxz2fvxm2n1l";
+    "NNPDF23_nnlo_collider_as_0116" = "07m2jwjwzjc4bdsx9dkrp41qn04f9z3k2m6n4q308hwdq9lmcm99";
+    "NNPDF23_nnlo_collider_as_0117" = "0i4kggkkkp407r33a2nsdy329zxpx8h6dq0h0wwpvq1kmyrjk6i4";
+    "NNPDF23_nnlo_collider_as_0118" = "027wlw7lk04grz5qavyymj21ik4zr9fy9yk2kwjc9gx2ycp3sj2z";
+    "NNPDF23_nnlo_collider_as_0119" = "0jq3q3sh1p8rn1qap77794v9hh3j0b7pmfl24wxvpc4dly4al0vs";
+    "NNPDF23_nnlo_collider_as_0120" = "1s0jic8amasmxczdflbbhn6071nx8cxr3ynfrinllp36d92pmgsx";
+    "NNPDF23_nnlo_noLHC_as_0116" = "0jzn78p2gygsqip50jfnnrmwl7issbp4vzpf71cbvj39ihsmavy0";
+    "NNPDF23_nnlo_noLHC_as_0117" = "0zns2yy50c0bm91y8xaafmzhgx1wafvmv39cykw7xwsnkgclh487";
+    "NNPDF23_nnlo_noLHC_as_0118" = "0v5bdc8d9w5g606h42rpn6zw31y1a5nk9akgfd1lyrhilvh7ayck";
+    "NNPDF23_nnlo_noLHC_as_0119" = "1zacfd5jc5wvcig0g8g4jkr77zcxvzcvppa4ci81c1n8d0whnr5s";
+    "NNPDF23_nnlo_noLHC_as_0120" = "1lx7m8ajwvhkzxck2ngxng1g90fpay5r5iwdnk2w7xgp1hb1ayc3";
+    "NNPDF30_lo_as_0118" = "12adhizxskpjzdr6inc2hi6bxrs8ns3bnyihz09hfh9q53d5ayik";
+    "NNPDF30_lo_as_0118_nf_3" = "1gjaiwqdhlswf1qmw39xr6g0w4bnnbinfpwl9c37jnggk6dxwdjz";
+    "NNPDF30_lo_as_0118_nf_4" = "121xn280f5xx04q0rr4ina9iqzbc1v8cay78km836kqvgb3pcpyx";
+    "NNPDF30_lo_as_0118_nf_6" = "1s77g0bf1qjb9rn1svnpfx10laxx87lw660ark9fhhx14zgybs3i";
+    "NNPDF30_lo_as_0130" = "0nvpwbmdzm8fn4wlb2rhzar71kk4myfddpqsqhd7wb1fqxkj5b7y";
+    "NNPDF30_lo_as_0130_nf_3" = "10diiahiy3yk6y7m1r4bd6nr1kf4mnccgj5qyq2lw49highn4s8k";
+    "NNPDF30_lo_as_0130_nf_4" = "0j3b3rj5pr2ws3yaq6h74hhsjy7lv3d2x5nryc55q22xfkgf451i";
+    "NNPDF30_lo_as_0130_nf_6" = "0w7k4a9ir4xvfh3v6dba70rhwkkq7qk16z178wld26zl6a7gw1hk";
+    "NNPDF30_nlo_as_0115" = "15g9alyc317qydqy3g7sqlh6pc4pxn3xmhmzv9lcw2ghg3gn35fi";
+    "NNPDF30_nlo_as_0115_nf_3" = "05b5xl89jvk6bgp86yl5hwdh3x8211czdsbianqkfix35rqrvlx3";
+    "NNPDF30_nlo_as_0115_nf_4" = "02p9lhvricjl5r79pkcm2fv14p9gw1d2qizka4w254ang3i1hcm0";
+    "NNPDF30_nlo_as_0115_nf_6" = "1iabf2qszv1270ac2sr2bqs7rb3gm58fj388saqbhnra4p2kv9fw";
+    "NNPDF30_nlo_as_0117" = "01my1m7vx7yax8ldnjp7s1mz1w3x3m0h1gdd8mamfrvphaghwp4x";
+    "NNPDF30_nlo_as_0117_atlas" = "0vjfh6kihsypvkpg3fwqf96kd2ldq0azcl72ia6w1nr52rsqc27l";
+    "NNPDF30_nlo_as_0117_cms" = "1sbaq99731ihrkp9a2fj6lxj9dr2c9j4vp2335249nrkinfpf4mq";
+    "NNPDF30_nlo_as_0117_cons" = "14qwjsa633v3h0sbizmhifrwdm7fmglyk608lq4ims8y7nn491nq";
+    "NNPDF30_nlo_as_0117_hera" = "05gs9ril5vkm7xrnz5pvjd6pk8ivgk0bl4bh45gx658fgg2snhiy";
+    "NNPDF30_nlo_as_0117_nf_3" = "0jc8p8h9pny0l7j3hv55iwaw684ymj0hl62d6bxlvw8sqvhxcqyl";
+    "NNPDF30_nlo_as_0117_nf_4" = "0a37b46ach3m0gqniwk79qk963w0m96dknda2rhp1glpg5xdxl0z";
+    "NNPDF30_nlo_as_0117_nf_6" = "1hjj6k5g2fia7xq5piy0dhsqs9lwriasmppjwil9wxnwklnwmr2m";
+    "NNPDF30_nlo_as_0117_nojet" = "0z3s8ixmq2l4znv2dn0dcz9rq5f9b3jgnlwmvjzcab3wvj1za687";
+    "NNPDF30_nlo_as_0117_nolhc" = "1x9nbnxm72wzaky4rvlrq1kmqs86ypphqwvsng33n0zdd9yr82pr";
+    "NNPDF30_nlo_as_0118" = "0b51qb2i3h9d7hrviarfszwljsy88m8ibzgz7dd5gn88k9kardrm";
+    "NNPDF30_nlo_as_0118_1000" = "17yla3w0rqy1a5hxq3bfq94ddda2qv6zzj76lfrm4zahl6m02kdy";
+    "NNPDF30_nlo_as_0118_atlas" = "034h2wgakbm3mx70034nwb44ii38rca7xv3az3fhcnjbpg9vnf0p";
+    "NNPDF30_nlo_as_0118_cms" = "08g9315fpc4khwfjf76vvyqa9nannvwq0bpc42f9f7yc0pck71qa";
+    "NNPDF30_nlo_as_0118_cons" = "1lw0fhy9gwk3zr7vq7qh9p6zprbyd4faln3npnxs2snncic1mnz6";
+    "NNPDF30_nlo_as_0118_hera" = "1833gd9h3gg75hblxf5qh5hp61k7n9vavb91ll9lbqmcbfr34aas";
+    "NNPDF30_nlo_as_0118_hera_1000" = "0lljb96d3q25yw3fz3cbk2in90q6srpc4alkz95nyrvgp25xgbgy";
+    "NNPDF30_nlo_as_0118_hessian" = "0h8d2zc02ccr1rmlsf4xd5a41irbs9q9wx68caj2xy0i7qr8rsmp";
+    "NNPDF30_nlo_as_0118_mc" = "12nnyzh2f6mv4gq4x4b8nlqx34lbj5y2y60zivfdbcpyg2spj5y8";
+    "NNPDF30_nlo_as_0118_nf_3" = "10f5md8bhf44n5x6r7ln8c58a9ylm4mfgxg30vd0d8mvjc3zpsng";
+    "NNPDF30_nlo_as_0118_nf_4" = "0q14zqkzqy2hgh8wli5db7dsqgsljgbc717da661wj8kqa23w4r4";
+    "NNPDF30_nlo_as_0118_nf_6" = "08ajfn1r27hdarff464j2gpi7ffjjxs6pwzh3vil8lpjij5y7d4l";
+    "NNPDF30_nlo_as_0118_nojet" = "0zzzk72n7nq1mcaalbv7mpfpb9kh095j0zazbzfjf2k6r3p0v082";
+    "NNPDF30_nlo_as_0118_nolhc" = "1p7iac75znr1li8qg9xf1my37i70flhvjkfjmrb5b0h3hk9agb1r";
+    "NNPDF30_nlo_as_0118_nolhc_1000" = "04mgjfq1ncy90gqljfdzw1iwzav5infkfv7zj2rid088n3qfs91p";
+    "NNPDF30_nlo_as_0119" = "0p0kgw17c97p99zy3ffr6g7pphhc8ccdhcq4iip5drqm4hc6nb58";
+    "NNPDF30_nlo_as_0119_atlas" = "1hpx2jm4y6kz9b4j42ags98j115hd2s41km670979z9zxmj2qm5q";
+    "NNPDF30_nlo_as_0119_cms" = "1j0135mxdiyn22iqrmg0d44w2w7ql1cdacprxgdz4jfb0ppn68rx";
+    "NNPDF30_nlo_as_0119_cons" = "00qvhq9ypqv62zvlg32k3x5gibl5jh0b78hyrpvxf1l3y2b77nw1";
+    "NNPDF30_nlo_as_0119_hera" = "008f4m8p9gi4w61mgjiqqpw346rgqxaayc1rncy2fggl4gs64yi1";
+    "NNPDF30_nlo_as_0119_nf_3" = "1bh0sl8pjy5n90j5dz9c80n3vy21hdsv8vxwbqkq0b2lkv8gzw5g";
+    "NNPDF30_nlo_as_0119_nf_4" = "0swgnmbxz0g3ziib1992s0454jfsdi7l0x3lrvs5qzzjk6rg6qgd";
+    "NNPDF30_nlo_as_0119_nf_6" = "001awj8h76wybmxj9vvkxgqixzak4zbhsvjmj2lscb2v5qq3y68r";
+    "NNPDF30_nlo_as_0119_nojet" = "1x961nmad1rxmf4yzbz2drpi5hfac2ag1bs1jbvvlw3p04xr2c38";
+    "NNPDF30_nlo_as_0119_nolhc" = "1yx6f4n577zqwhp0i440r6zk06702jg4kkib9nmgws3jl5f28big";
+    "NNPDF30_nlo_as_0121" = "10k01z1amzp3jmfvfb2snrm8d04vr31kly1m30pw4fv0qn78idlw";
+    "NNPDF30_nlo_as_0121_nf_3" = "1gb40ycnf42fkrbdwfhb8wp56nmzxyi7fzbqgvlkby7pn86m2f7m";
+    "NNPDF30_nlo_as_0121_nf_4" = "18ywp6b9f83rxmh7gfn648wslvvf5g4ffm83rradp308smr1sv6p";
+    "NNPDF30_nlo_as_0121_nf_6" = "12dps7n3glrzwb8vsfghwbvnh1yyxvjnvqfilbrrcy0dm3sams7b";
+    "NNPDF30_nlo_nf_4_pdfas" = "0hrx872m52bb894c32jrvlvm9lcpy3yllj5ps52nmywqd8n1simj";
+    "NNPDF30_nlo_nf_5_pdfas" = "0q25jxvwpz8inkax0j2zq9pj8swqfn4jmkhs4ibkl6xs78bhjfb8";
+    "NNPDF30_nnlo_as_0115" = "03apmzw7krj77zdyl6sxwqg5fyv3vicp8iax445qdx8ld9kv225w";
+    "NNPDF30_nnlo_as_0115_nf_3" = "08y1gjzkpnjn6mn247n7a9ya8z6pml3602p08rjha4ljggxhyffq";
+    "NNPDF30_nnlo_as_0115_nf_4" = "19mjfk1rib9dxbsn0473ggi6akwv1zs9y3q9nzjg47mdjqlspb2q";
+    "NNPDF30_nnlo_as_0115_nf_6" = "1zcjjbjwjgbkrhgh0kira7wzwmy5vvi1n15wycg33yk09m06db6b";
+    "NNPDF30_nnlo_as_0117" = "1225gj4ihmphnfav2h38rz17lj1dyi9j1lazqlwww8vizl8933bz";
+    "NNPDF30_nnlo_as_0117_atlas" = "0i9nc7q1cwl8cxxaj1xaz28wmj09q5bjmh19p1fcbcln7hklvj5x";
+    "NNPDF30_nnlo_as_0117_cms" = "01ffhsw191nrr58x6wnjizx7bbijkknicvgk73pjbwyr67gfj581";
+    "NNPDF30_nnlo_as_0117_cons" = "1blfi0p231r5j34wspk192fmbv34gbvx3bkisjh7wxpiab80qdws";
+    "NNPDF30_nnlo_as_0117_hera" = "0ds02aj1q6y4dndfk9l9fyxci0dhpwr7jx1jq1qb9g5bb7bbhzz1";
+    "NNPDF30_nnlo_as_0117_nf_3" = "087rz8bz3j2h7yk7rknlqz3rpbczgx2r2zdag8pjccdqi9jnk9pg";
+    "NNPDF30_nnlo_as_0117_nf_4" = "1w44bwx6m6g8r990vl6f505bgf3v583mi19r0nfh2pahx2k2djaw";
+    "NNPDF30_nnlo_as_0117_nf_6" = "1l7gwbsl2haqaj6hqsnnqwrnxrkdv1h63qbs7iwfdq6474ndzwsf";
+    "NNPDF30_nnlo_as_0117_nojet" = "1nmv44arab9gfhs02jf4zijdb0644pvdmi6k809bxbfhir9sry8v";
+    "NNPDF30_nnlo_as_0117_nolhc" = "0zn2b05jv9da7394in14mswvma48y26lvpw7rwh7wmyw323rxpfv";
+    "NNPDF30_nnlo_as_0118" = "09xxi0vq90n9vfzq72c0mbf4yz4zif3kl6xwcjdb8r620ihwrnfw";
+    "NNPDF30_nnlo_as_0118_1000" = "1iy5inrsfpn70w65hy42pmz0630pbrgg4l48qgsamcjgqdhd3n84";
+    "NNPDF30_nnlo_as_0118_atlas" = "013jm6f2hnmzc2di7spf6zp31fwhm6c9sddwql36hww63w8sys71";
+    "NNPDF30_nnlo_as_0118_cms" = "1w0ax68rg5877s35zlg13c451fcz2rij4adzwhz4yf4skkbgflng";
+    "NNPDF30_nnlo_as_0118_cons" = "1qniswwj6cmcs7bm4n11jx2disqcwszl08cb7im824nvrcjka2pg";
+    "NNPDF30_nnlo_as_0118_hera" = "05j5yrra93dxh1nah19hszd0q3pj4zfica8a7vm5akbfn02rccj6";
+    "NNPDF30_nnlo_as_0118_hera_1000" = "0ssiw9fk5fqwg77rbycrxrclldws35n6gj4a4sj6d9yc87vz1g7z";
+    "NNPDF30_nnlo_as_0118_hessian" = "1hb32bamwlx5il8g2sf5gy6xjr7r4rky7xgvdhf5ndq7v3n1ncx1";
+    "NNPDF30_nnlo_as_0118_mc" = "1gxl4c5z2vh382y8l2kpr8vy4fqvbxvrw6xjc6dp229ak89cd6c2";
+    "NNPDF30_nnlo_as_0118_nf_3" = "0iccjcds9j9pp8s3mwrshhzl5anklax4rgcwm5im90hipj450rgj";
+    "NNPDF30_nnlo_as_0118_nf_4" = "002r0179jsl0l43psvw3hd1drg9fcrlzw57sbyndlswvq4zkyzyc";
+    "NNPDF30_nnlo_as_0118_nf_6" = "1mwh2dxymayxa2khxjfxqmbhaj85jdnz548wmq6fyrxr63cfmw07";
+    "NNPDF30_nnlo_as_0118_nojet" = "0nly14fxfww78qihrd8b6wk3da24x5sxkb13h8l2cgdxkq90fxbd";
+    "NNPDF30_nnlo_as_0118_nolhc" = "11yvr5h66v37376d5p2m2g8fajdycv9baqq6mjfphf4a2abrl7m5";
+    "NNPDF30_nnlo_as_0118_nolhc_1000" = "1bi0mxs6v1izlbvich55vi7qab72v1sizd4wj13787w47ffqm89p";
+    "NNPDF30_nnlo_as_0119" = "11bvbqqjbyz0vjd4kh5qyd0a4rb62l103n10d1cyffgdfxxsk8f9";
+    "NNPDF30_nnlo_as_0119_atlas" = "1fm46crfparx2swpxnyscpwqgicxb4skhclnc5xaijcpzraflzp7";
+    "NNPDF30_nnlo_as_0119_cms" = "0i2d4wq7bsbfp8hqdr88nbii980zhfmpg6758czz7swd5yv8076a";
+    "NNPDF30_nnlo_as_0119_cons" = "0v54zyz410rg3wcdw44japzynzvvrbjrspk91d0129rdv2xz51cg";
+    "NNPDF30_nnlo_as_0119_hera" = "09w3krirq117cnhfkxlb8pld3xb5g2r3nhgc11v3ksavq746jhvk";
+    "NNPDF30_nnlo_as_0119_nf_3" = "1k00h1c0lv6884lb02qmqki7sfmxkqpj88fkvf057frk120f59ah";
+    "NNPDF30_nnlo_as_0119_nf_4" = "0pqjvaw2ad3g9zzjdyhh72580jrj4p8hxlvy9h6q9hhpwdihnnmh";
+    "NNPDF30_nnlo_as_0119_nf_6" = "096fc9958s3z559knxqccwj3vylxviq2g58rwirj3qdjvy96y2cc";
+    "NNPDF30_nnlo_as_0119_nojet" = "0l5crj00jm2vxgyr5nhs6h1n64xnxwpanrsjk8f8qfis37s68ar7";
+    "NNPDF30_nnlo_as_0119_nolhc" = "1nl4gkjjz3kpq1sbzqk2d0d50vmb3ks7j5z14hqf9dib2xr39jl1";
+    "NNPDF30_nnlo_as_0121" = "1c0ddbjskxw4rq1p8sp63vayxkvcnls062qp16wvrrbw7zkj1jaa";
+    "NNPDF30_nnlo_as_0121_nf_3" = "1sj9g0wg6x2cvwp45i726dcs44hpqjiqa011xzindnjh8cq7m6xn";
+    "NNPDF30_nnlo_as_0121_nf_4" = "1j4khzpw52vc26n7a95xg1wyqz720fnz2kbb8l9a5bsbmxmaa7xv";
+    "NNPDF30_nnlo_as_0121_nf_6" = "1kln7zjgl0hwl621wnhhsih0m8f9ir2i8ligfg2s0qp8s3787lrg";
+    "NNPDF30_nnlo_nf_4_pdfas" = "0s460v9712ahz09fhzhlnsnkl9arsy3l82g1z6xjz4la8fwkr9wq";
+    "NNPDF30_nnlo_nf_5_pdfas" = "1vjfm9j39m4389b0r51axlbzdbkpk2vbs3vks3yqcr3hr09g9myk";
+    "NNPDF31_lo_as_0118" = "1n3n3irw0lb1vmcr9qxgcd6xj8prdz6xbrrfbx1815avqs1pyb94";
+    "NNPDF31_lo_as_0130" = "1amkzj0jcx35zrcwl067zf3sz7h2kanj8q49661ayl8yw2c1ncib";
+    "NNPDF31_lo_pch_as_0118" = "02f294h655vn85vqx32hipnmfifal28pn6f18an821jrb72plnzp";
+    "NNPDF31_lo_pch_as_0130" = "0qmjfr147zx9hp3znjxd44rx3hz2zwyvs5lbbbd0y0y1argc25dx";
+    "NNPDF31_nlo_as_0116" = "0px6id1q66pdn47ja09shn0cbwxzw6sj4r3qfzz30w3srr93i4jd";
+    "NNPDF31_nlo_as_0118" = "17avv0qpn7k7lg26rxmcpcrv127w30d20n286vd523b9x6qknkds";
+    "NNPDF31_nlo_as_0118_1000" = "1ms69qgi3mhrwi3jxapykfsiqwq3cfpx38jwmsv4pq2g2hhawvfq";
+    "NNPDF31_nlo_as_0118_C1p6" = "10y6fb4fmsv7mvsj7zrv6g7x80yxglaq2d0ir4hsn3vs3yqq7r0d";
+    "NNPDF31_nlo_as_0118_hessian" = "1jlqbq9wb97l9jhm2r4mkvnhb3vfp0bdhz6lhxnd0a9ipsgmc1wi";
+    "NNPDF31_nlo_as_0118_luxqed" = "0zsyp7g93d1z7fpdd5a43i8wd9jfriw2pkligdy78xxlv9zngbkl";
+    "NNPDF31_nlo_as_0118_mc" = "0iqk4fq0g4v0khymzab6cxhly7ybxw6f010b5x6ybgw2vzizvmq4";
+    "NNPDF31_nlo_as_0118_nf_4" = "0swfqsn68n60r4n3m5szzds8a5pz6p1ad2kkvwawhkgmp2ww0yf7";
+    "NNPDF31_nlo_as_0118_nf_6" = "1b44sygil9ngxmdn0273nvh3pzry2k03mkdibf3kfxn5s0ymkl4h";
+    "NNPDF31_nlo_as_0120" = "0114g1y2h090137wnhjmycrd67nb8s2gg9byx0j7hm1vy7sajj1j";
+    "NNPDF31_nlo_hessian_pdfas" = "0hhm5k3i9ls6fsncfn5cxsx6b1fhb1x581d2cz2balabvby9kf8h";
+    "NNPDF31_nlo_pch_as_0116" = "1q037ai33p0p9s9x5vr0p2v3jy0ghrg9djkyimy1lw00cmkj28xc";
+    "NNPDF31_nlo_pch_as_0118" = "1sym62b0n1rln2fybpppl8sz555wb6cymr20djrwvs45wdkmbbyz";
+    "NNPDF31_nlo_pch_as_0118_1000" = "0mdqa9w1p6cmli6976v4wi0sw9r4p5prkj7lzfd1877wk11c9c73";
+    "NNPDF31_nlo_pch_as_0118_hessian" = "0fqkq9jq6l6mfl73ykkn9f6w52wpfys4vqh97ngkm331qkm9y6z8";
+    "NNPDF31_nlo_pch_as_0118_mc" = "1q5ihiwzm9vm5v8k47b691cccv0ikvzqahi2vxigqdvhnlq8nrq5";
+    "NNPDF31_nlo_pch_as_0118_nf_3" = "040kfq43a1hb5z4inhw1pzqhk62yr0sf1kq32jv1wkbc1524j5gf";
+    "NNPDF31_nlo_pch_as_0118_nf_4" = "18vj61dv179ypq3l8wgvc5m0ksc1i6mm3r1jj45bk0dxszlrsrv6";
+    "NNPDF31_nlo_pch_as_0118_nf_6" = "02zmby2c6adp1q0kcjx4f3qvabn5qif82q942xnxflgpnpk9qafq";
+    "NNPDF31_nlo_pch_as_0120" = "0kgslc183vaxj1fxcwfabs6ah4lx787gi98q02nci010w2zmx7zm";
+    "NNPDF31_nlo_pch_hessian_pdfas" = "1bmja7lqdwakqfhf7q72snyjg3qg84xdkwjwmz6lvy75r1810dhl";
+    "NNPDF31_nlo_pch_pdfas" = "027prs00nc8laqpjvz20ij5ipzcp291szdpz02aiinf2a5sy2f0j";
+    "NNPDF31_nlo_pdfas" = "0d8krd9akg486k8gp1kj4qn4zwy4pjd4j3xz2527a8hkiv99v8bi";
+    "NNPDF31_nnlo_as_0108" = "16hhkvmk2cpmqx7jgkh7ckdzas9c6v23l04z7mlnvvc4682n5zvz";
+    "NNPDF31_nnlo_as_0110" = "1hznzg01dvpa77nxr11dmqdhwbrj310hhw1h088bz5svfh15ga2r";
+    "NNPDF31_nnlo_as_0112" = "0cdjiiniwikkda593sv1lk1wywdxgzfqg5fvhczgwq588xmac2wa";
+    "NNPDF31_nnlo_as_0114" = "1q6phbv3w4dsyw0jasbpzid8r39mr8icw4av85dyim4n1ncqag9a";
+    "NNPDF31_nnlo_as_0116" = "1fz1h7vd910vm8li56j0w1b5jqalym0zkqv8msr01zyq6dwr1hfj";
+    "NNPDF31_nnlo_as_0117" = "181xc88i392rbfwqg1p7imkh71ilbcxdibi1mh0zk4kmnx6sskfp";
+    "NNPDF31_nnlo_as_0118" = "1p4idzrg8i67h8anzanizas7a1hkxbhrw7ch6x6d1swbigw40ajf";
+    "NNPDF31_nnlo_as_0118_1000" = "1bcjsxnp205v9ipf0j57pfnzl7kd89ds3w0gnjdsq8q86s0c5k23";
+    "NNPDF31_nnlo_as_0118_CMSW1" = "0ibgi8jbick51fh3pdnc7zrjsdpjyc3gg2hnm0jmxw3hck7rp2x2";
+    "NNPDF31_nnlo_as_0118_CMSW2" = "1h49ygmp58zs0ml1lza6clykhylw4bgvsi6nadwmc2bqs4hqqp8a";
+    "NNPDF31_nnlo_as_0118_CMSW3" = "0z4djd7nrkqd55dvswr85l4sphjbrgsh5bslgypbf2axizlscdyc";
+    "NNPDF31_nnlo_as_0118_CMSW4" = "13wkx8a4zkivk832f0ng6zq4m9ahka2lm3l6230yicl2fwb9znsx";
+    "NNPDF31_nnlo_as_0118_collider" = "00fgz6m8qbhgmvkli8pyh1gsazajqz8cqbad117z1ijvidhdkxs0";
+    "NNPDF31_nnlo_as_0118_hessian" = "0rzfcmwadff2p7qk19dj2skd4dpv9z59jmnv51c44yis07fmsjbb";
+    "NNPDF31_nnlo_as_0118_luxqed" = "0smmsn2b2lxwzpr4wr5wg4rg8kjy3lz0xhjdwlimv5gmf24dswds";
+    "NNPDF31_nnlo_as_0118_mc" = "1nmwb3v0aiqjhhlzlrf9qkydgfhk6lp48ydbvy4w5fnhs4rqas4j";
+    "NNPDF31_nnlo_as_0118_mc_138" = "1bv63m9lxxy3mrbmkjbn3jjansghlphxwmqywkcynk6z42krpgdn";
+    "NNPDF31_nnlo_as_0118_mc_164" = "1dkj741r29lh1011c8v2d8ax41a9pxvj8ksvz12y18ipf5p0jrnb";
+    "NNPDF31_nnlo_as_0118_mc_hessian_pdfas" = "1b9ijn595qfq32yz9rlnn2br7lssbk8ka39ripfcfyf33v9sv460";
+    "NNPDF31_nnlo_as_0118_nf_4" = "11dl3c2anh2v140vn6v4mx9lj65844svsd0f84wng0sngrn6dli9";
+    "NNPDF31_nnlo_as_0118_nf_6" = "0s102m1gf8r30g7zy4c91imn26ksj4q600711rgmw2ada1xn87f8";
+    "NNPDF31_nnlo_as_0118_noLHC" = "1ypim2zfa2i3r1hcw0j6w9abmxx67g1rhdacsajfp479s68kmi3c";
+    "NNPDF31_nnlo_as_0118_noZpt" = "1dx3hlcf8c1a40iyccw84v6f2h5jfyw1pp3n01q2rls9i5b12r15";
+    "NNPDF31_nnlo_as_0118_nojets" = "05rkknl44j0pm7kb1l6ihy6rlvwxrkram4sn9zm0za1pv0r9dr6k";
+    "NNPDF31_nnlo_as_0118_notop" = "16prpxwn081v63a0pkgjvcizvn33ng5cafv6664yp44j7vbpwi4n";
+    "NNPDF31_nnlo_as_0118_proton" = "0xjfambqz14vvg506kj8mqkb37q1bq7m3wgh089fjzq0acrmh9kl";
+    "NNPDF31_nnlo_as_0118_wEMC" = "0hkpr14cxgz2r47bfh7k706l22pl6nlhbdqxd7wmrlyrk19vgar3";
+    "NNPDF31_nnlo_as_0119" = "13ys6fkvna2i0ifzw2dz3g4jn1zsacslffylrkmj6zxmkc0qganp";
+    "NNPDF31_nnlo_as_0120" = "19gszb3kxgwdskabdsk183bdn9b0zyphkk8v1r8s372fg52c8jgg";
+    "NNPDF31_nnlo_as_0122" = "1mg40xkp5sb7mpwz420b1mv8cqxldi9rsddnmgdhc5pal5wpgaf6";
+    "NNPDF31_nnlo_as_0124" = "1lag0smkh7pjbl449wipn3rq59yi48313xrma531i9ldh68a4ssg";
+    "NNPDF31_nnlo_hessian_pdfas" = "0yirp5jhns652a4f2jvhxhvd4y117z3mc5vcd2vsvqyjijx6q0gi";
+    "NNPDF31_nnlo_pch_as_0116" = "144bgqmxci7ibwp84kg8a6mw3mwmsilq2ay14y48vsx1ydp56w5q";
+    "NNPDF31_nnlo_pch_as_0118" = "1vkpr9js1xwr0g6fz66j2a22b3k5003adf34x0nb6pjm2nxh0njf";
+    "NNPDF31_nnlo_pch_as_0118_1000" = "1kwc21p2s383973k5jqciqjpmp4xlvj59zsxjs9nvsywzp9k7vaq";
+    "NNPDF31_nnlo_pch_as_0118_hessian" = "18pjqnjkz6jgia5jb4a59s9568yf3b7cp6iqb6fk3xmqlwx5vdd9";
+    "NNPDF31_nnlo_pch_as_0118_mc" = "0wyccq58w705ayy5r9fcfnybb9rw43nl46rrnfysi65myqgcfjnc";
+    "NNPDF31_nnlo_pch_as_0118_mc_138" = "1rzbff1dmdybkgc5ky7qqcvm5g7npiq4nwjjsq714zajlm0r4y1f";
+    "NNPDF31_nnlo_pch_as_0118_mc_164" = "0ymnwm3n45jsxz6dl8ys0p7zswf6w21q3m016lsrcrmyy756c6a5";
+    "NNPDF31_nnlo_pch_as_0118_nf_3" = "1hhz6h8mcj6n8309sw5b3w6dinm54hgbxc7c07xjzkb9xmliqwa6";
+    "NNPDF31_nnlo_pch_as_0118_nf_4" = "0jldm9dlcngdqcy05y8kjszm8g6s3dvamkz8wh70d260ifh2jb23";
+    "NNPDF31_nnlo_pch_as_0118_nf_6" = "0kpnhryf8g0s2ykvbwxiiczycrknbrfsnbs08h1zg0cpq8whljqd";
+    "NNPDF31_nnlo_pch_as_0120" = "0bgr66vrjm749pzif53yqq15023yva03x32wkn5gynq083gfdw37";
+    "NNPDF31_nnlo_pch_hessian_pdfas" = "1004frva4k0s59naxys505fjc83wkz1andzz5gll6v5flfscfch0";
+    "NNPDF31_nnlo_pch_pdfas" = "1p26cb6h1czrdlzk166668900ilzr7r93dmksvc3pqafq2mi80jb";
+    "NNPDF31_nnlo_pdfas" = "0d2cv8y23w30cgxs5090ygb614fwrdj0vwh6pjshqv9403maykr8";
+    "NNPDFpol10_100" = "0r5qfa8cyanalphgjdsh57s3viqv9i10v51p1pyamj1f90gb9pr8";
+    "NNPDFpol11_100" = "0nny1lpw37jcillpfxjx82hq7wlzp4yksxialmc2ivr192qqdda8";
+    "PDF4LHC15_nlo_30" = "05n0i1mr7v7ssvxvdmv9fn621rinl08frz71apjj7wfdm7s7bk72";
+    "PDF4LHC15_nlo_30_pdfas" = "0xi4xydx0x4ina0wmqv9jf4978xhd8x0l91dwfxh5vy39r5x4lm4";
+    "PDF4LHC15_nlo_100" = "0m9d4zy7608iryqy1ypgkr1d3yhw2wv1nrrc70zrfih7x0fp7lz7";
+    "PDF4LHC15_nlo_100_pdfas" = "05wyqyh9y32sxflq69igcnnsl0ifnkyw3vnnnjn6kscl8h8hs7lp";
+    "PDF4LHC15_nlo_asvar" = "14hdgj5g8ia7y6hi40zbh925dacrk7hd6cli6lkhlqzxl755nbs3";
+    "PDF4LHC15_nlo_mc" = "09p7y0z04r6wdkf8gi3yj85qk5hmp0mmhab8c7a7lly4731fyf42";
+    "PDF4LHC15_nlo_mc_pdfas" = "0sds9rkvbjkk7pardwq959qqbrvgwswxmsqcfppky2p0qmdsjs0s";
+    "PDF4LHC15_nlo_nf4_30" = "1ysy6dqlacg4bwb2f16p1aza5gwm9qnhmc0g0mhsdw4d2i4ml5yg";
+    "PDF4LHC15_nnlo_30" = "10cm4wa0mk34rnvsr5q8g9w7fs9cblsryms2nl370wdvcrhzsxph";
+    "PDF4LHC15_nnlo_30_pdfas" = "13xln0y8l0qcj9951glj4f1kqfaagj8gwkxzlvdkgjnj1scdy6yj";
+    "PDF4LHC15_nnlo_100" = "1gcq3qrf39dhq2pmpjrj3z0i0ycrk76mjdwmgfvzdxysp530ax54";
+    "PDF4LHC15_nnlo_100_pdfas" = "16r8far43ymsd64a4bbqlj56qvbjmcyxbawv4lkfxysjvbydxj4w";
+    "PDF4LHC15_nnlo_asvar" = "03fh1jcbmvla7n2jj3zq4ibwvq66h0rniply7h93d94zawcgsy4v";
+    "PDF4LHC15_nnlo_mc" = "0c6nfkv3x1p5iw514knjvqcs1dcaryf74qqg1za8x234yr5ndi3p";
+    "PDF4LHC15_nnlo_mc_pdfas" = "0l8hlcz69cdii7mpgargi9nsx7iy746nad5pnn7pvycrc40marij";
+    "abkm09_3_nlo" = "0h268l7j1zkxm2nacari10f86lpha511xhgrg0q9r8hc47sw2vxs";
+    "abkm09_3_nnlo" = "1gzhvblckskscql53pfxp79qclhhhhm45sqjhc9jrm1bp3x52w8i";
+    "abkm09_4_nlo" = "0yq3gy0qgnk5dh0hh3ldrf5bqzx5wpkhw509nvz5arlh0bfwhyg4";
+    "abkm09_4_nnlo" = "1b8470v2n5v87mmhp2dhmfh7iv3280ad67z2vyl0sfv87iic409j";
+    "abkm09_5_nlo" = "1nhck955mw94h3pyhm2vd3q60qxwsmclkfqdscp06fc3avyvrzfv";
+    "abkm09_5_nnlo" = "0wklkcjknn7ys1akg56zxdrkd7ardlc5qnbjq51mva1nf2bxk0np";
+    "abm11_3n_nlo" = "06r54q3ph851a0hyn4di1ifwjmdkdklf3wlsdpz7qn0w4w3xcg29";
+    "abm11_3n_nnlo" = "03rgkj2hyn3zmj8yxllfnc2iqr12j8shjcpdjka33v270lim3gq2";
+    "abm11_4n_nlo" = "02r9ba7rz8f5438rfckzny5amnq9qjgl164x8il6xqh5crxn4vb3";
+    "abm11_4n_nnlo" = "0z6a9wxy6018qm9nyyip9wdq46j7rh2if5xch19h4qx20gx6m48a";
+    "abm11_5n_as_nlo" = "0x2w81w9cz955k9dd45872k98my57w83cjdsv4gvjb64d1hsygzq";
+    "abm11_5n_as_nnlo" = "0091vwjkc686d1dnfn2dpa7jb56p8gli2z687fpx5f8yhjzpbh80";
+    "abm11_5n_nlo" = "1bpf37mg5wgcf1id2am98l5mj162xrnb8k16ppfx3qxlakp0iabl";
+    "abm11_5n_nnlo" = "1mpk322mqs078pk2nxxk8fa29ka6cxzsf65ffiny38678djmfqd2";
+    "abm12lhc_3_nnlo" = "09k90vhjq7p0i0aaq2697pq2dc86bkmnv4q8zyqxjp3wnqx1v95f";
+    "abm12lhc_4_nnlo" = "1hciv1z9b5fiz7swv21gr0rshijj9yj2n8x4l54v9g0jyd061jaz";
+    "abm12lhc_5_nnlo" = "00xxkrhbfkxhg33mkpwwk5nsdp4nmi0zmllx5z5ygxl24rinsq9j";
+    "cteq6" = "0lp110wldhliad354v29f0rhdzf5qrs1ibklj0cmzp2rcbp8zrix";
+    "cteq66" = "09i69ac3gkrai5jmazjyjvi5sl8k2vm48m90ijn6pl24p31qf68y";
+    "cteq6l1" = "1b5m7g7wawk72h76l9yr3gx3n67jggna1004lwffvj43gffwkjap";
+    "nCTEQ15FullNuc_108_54" = "107klcpsr9d4dwavcqqs3849k90mdb3bdjam3pd79cmsy7ncr2hf";
+    "nCTEQ15FullNuc_119_59" = "14az155s3xfl8nscwpajzwj0dy94dadc4qdc64njlg3xlnxsgxy7";
+    "nCTEQ15FullNuc_12_6" = "14z11wyzclx5k6dl46zr0jp6mja178bvd547cqqfy811nbzmmri3";
+    "nCTEQ15FullNuc_131_54" = "1984nphc6sqizaq1c1laphw3hdvkp5k7sy7g563wq18578fifbmk";
+    "nCTEQ15FullNuc_14_7" = "11i2xcd6ncp2aqw3y8pgcp63zkaj383ciwvqpzmjnqraiqqqa77i";
+    "nCTEQ15FullNuc_184_74" = "1m311m5bkzq00qf117dli9xrmcmx8qqh716wff1yj8ri4c4h9m8x";
+    "nCTEQ15FullNuc_197_79" = "0vi29fdxaj7fnpc01k3y2ylb7ngpdnmbnzgxdnr6p9bj5wfa69z5";
+    "nCTEQ15FullNuc_197_98" = "0qjkdfgpbcmwc39wzyfb07wrqnkkwn7v8235y1m25x4wy5bbpjbg";
+    "nCTEQ15FullNuc_1_1" = "0nx1n814mkikd01pxmpndk2qxpwqwd55cbn6z1kgxm8qlhhhd2zw";
+    "nCTEQ15FullNuc_207_103" = "09py38s7shcyy07p5mxfiil5wlxijzbv9k4l3x0g1v191k0vi3m6";
+    "nCTEQ15FullNuc_208_82" = "1c9r5wr43291rw965axdzpshzjhnynsrlf28kfr17v7vpd9dykl4";
+    "nCTEQ15FullNuc_20_10" = "19vhxi7ch9vxa1vyjpxknk69hnnm2n5wpz4qybg1cznk59dvpi28";
+    "nCTEQ15FullNuc_27_13" = "09pflgyxl2ydzrmys7rv0mmvl32z3dmdx63wpilrw592aa70bc2i";
+    "nCTEQ15FullNuc_3_2" = "1l2js36nh4jawwkpiq386blgwbmgi9ccvvzbwq92jb5kpd2fvh7z";
+    "nCTEQ15FullNuc_40_18" = "11pw23fbrz97i9278cxrvc0a4wbdyhz788axq8jn7yka9mg9kch6";
+    "nCTEQ15FullNuc_40_20" = "0raiqn6w90n17irf4l197my77999ygqwhim9lnjqgbn68yjqfqf3";
+    "nCTEQ15FullNuc_4_2" = "0fip3n3pjd94rz3f4gcv2szrx5k72m5b8xcmsgjfd1671r5kmlkd";
+    "nCTEQ15FullNuc_56_26" = "13msj49c1lfisgcigvc4wr32w597jwir8cggrcdq74b0d0ab85ch";
+    "nCTEQ15FullNuc_64_32" = "1spgcb340nz8by8051hngnh6pa1wjf19vi5a40xr8gyprdzhwb4a";
+    "nCTEQ15FullNuc_6_3" = "0v5yabjw3xkjq5c1zjqmj3wwb7yz1blkprxnrpvai54v17w3sk3r";
+    "nCTEQ15FullNuc_7_3" = "1ncarbncfkqk6l3rx3zg34a3sj7mpm2diqsafyldpn92cw66bcs2";
+    "nCTEQ15FullNuc_84_42" = "1z719mcx5lnx2ciwlnxxhgc4s00jrr9sfrxcimh69sj14hmzgx0d";
+    "nCTEQ15FullNuc_9_4" = "180ipb4m2zy54h7n4s0jwqk9k6562bygvnv7mg9dp2f7vf5317a1";
+    "nCTEQ15_108_54" = "1bjx2d61qjhabfx28pfi64hf8br4gl67nzir3ygdpwdcah4k6lz8";
+    "nCTEQ15_119_59" = "0g7wffsyjh84r2wv8w67skx8gwdb3clv9c1dlpijwqmpkcm3b8q5";
+    "nCTEQ15_12_6" = "1xnnqp38zz3b61jb38hz54wv09w06fwwnb66sf93r1agcajvv1vi";
+    "nCTEQ15_131_54" = "062sg81yrrdsc376gpq01xzsb6114sp6814ah9jbrd08qqxh04p2";
+    "nCTEQ15_14_7" = "164p2fhlsmkcc6fibi28lysbfn8q5vds4f0k0kppi96absgrfa70";
+    "nCTEQ15_184_74" = "1zqyvla6dj93cgfjw5z97b6wh6qy8pkrvcbwirjva769210rax75";
+    "nCTEQ15_197_79" = "0mp1gddlwxk2vdyhra5lafvblc82g6n2p19lmjwkmnrmjqdqsz12";
+    "nCTEQ15_197_98" = "0z2ymk9y0syzqj88mnr2kjn104602ajg17s31d9vi29lggy4cn44";
+    "nCTEQ15_1_1" = "14dlybcc038ssv2xbyhing27b9zx07nkqvgf66ysbb83ym5dvibs";
+    "nCTEQ15_207_103" = "1zpxky925n9jssdr036dyax8wxa0d478l4mjl50bjmzqhr8wl7hv";
+    "nCTEQ15_208_82" = "01jf2mrknx5igs0cvhm7xr25gr6z93bvj12cbq53k15fk5niyglv";
+    "nCTEQ15_20_10" = "1vhk2lmpf5kci9173v5qh2gsz7zghvjb11x1mln8yqcdxaq4az8x";
+    "nCTEQ15_27_13" = "1md9xv99m6jcdqldhbbypdix581nmhpyanvr049l5c1a2ab5nbpa";
+    "nCTEQ15_3_2" = "0nq1aj4hxjih4z4xlhjfbza2dp2fyhwbccjgmgh2za5y7rzgz9fk";
+    "nCTEQ15_40_18" = "1gb4kfs207izq4dij9pqbmwm10vx6f1h7pdnf749jysmf6nayndh";
+    "nCTEQ15_40_20" = "0b44nkk315a9zaq3280wmsj67rkxw4jyk9v37s859fikr5v7s0sv";
+    "nCTEQ15_4_2" = "0c8r4vq3phi40v5h4p3nm7by72pz27zqwd67z9slmf1jy1yilnly";
+    "nCTEQ15_56_26" = "0ndyjjh7sxnhkamx182rpax0kcc2iqzwnmh391m5wh629zk0av8i";
+    "nCTEQ15_64_32" = "0ixbr2d30v6slqvp6gpry1159rx5m4hd1msymgli1w9k7pp7xjz5";
+    "nCTEQ15_6_3" = "14ars149pssaiyhaln9zm7vz3wzj2597cy2xasyhlrfqhlgrq056";
+    "nCTEQ15_7_3" = "13b9wbm2hqx4lixq3dad1y3cr6didcch8kg7mqm9lgbism7dwaqw";
+    "nCTEQ15_84_42" = "12vkqpvjjyh0x0hbn7r4gx5za01yqs9a7lqirdxd15k04fp5rnjr";
+    "nCTEQ15_9_4" = "1rkxhxwp0v9dm6f71c5635ihlspfx0sj666maif4iaw1sf4hazln";
+    "nCTEQ15npFullNuc_108_54" = "1g8id10rpys9566r8h92diqrr43mww6q8nhvlns0kfjkvkr22m9y";
+    "nCTEQ15npFullNuc_119_59" = "0df499pvfls1281zkvngrhicnc0ac0bfwamzs027k7f2y6ygkfb4";
+    "nCTEQ15npFullNuc_12_6" = "0mb3zixcikagsqzpxb7jzrcg05dln37d7anz5359ssjyd6p1mqyi";
+    "nCTEQ15npFullNuc_131_54" = "0i83f1wg81nr742jf9407w7fbknigz6pyx64h7p65x82s4wmj9gf";
+    "nCTEQ15npFullNuc_14_7" = "1k2554rg82msxzkarjx85p6di3kmfqxmbfxpasi1x74laz38663n";
+    "nCTEQ15npFullNuc_184_74" = "1pnl4y2arxf87b1pp95b9jajzlqdyzs7mv82xhmw9fcn9yliy5s0";
+    "nCTEQ15npFullNuc_197_79" = "0d5c6g4185k6pwm5bs5fqlwc97l0gvf6bhk9l8a5vc039dggsgkj";
+    "nCTEQ15npFullNuc_197_98" = "0ql9xnwggsqibld13yisvsdkkymzph8wnqffnxhlyp5digwhl64v";
+    "nCTEQ15npFullNuc_1_1" = "1fq80hzfy16gs00knvl0g0yqrys27vzyk8h5jzs1ra981zgcw1zp";
+    "nCTEQ15npFullNuc_207_103" = "04bg7hnngfsckk92gdrxbrxhsbb1ac1s7dscj7ycdy64fxn4lq8x";
+    "nCTEQ15npFullNuc_208_82" = "0f9ddimq9av2jr3yr15n630bi30bxh5nxrsbrcfw9cx8dwnjscwb";
+    "nCTEQ15npFullNuc_20_10" = "03dv3z7j69l97xacd38wbp7iyyi36g0bbc2xmxhm3l64rjs21bmz";
+    "nCTEQ15npFullNuc_27_13" = "03lb2dznl5dpv0cwsl08dlrh7x26yi9acx3n70imr13gspfxp8ag";
+    "nCTEQ15npFullNuc_3_2" = "0rqjxc8q53jndxjrxd293r1m8gin3vif33jzr35y2ail9bhkjyzp";
+    "nCTEQ15npFullNuc_40_18" = "1827gpzdrxdkg9ikk7pjgv9h983mwzk21p60635l1zhwby5p4mn6";
+    "nCTEQ15npFullNuc_40_20" = "11mjdibgypwpphm1wmf4z311wg4lp37010vwyys8q6d927jzikn2";
+    "nCTEQ15npFullNuc_4_2" = "12gx03drv7hnmsgk6sni7mc7c4rbpag5gn2czyha1n19v13rry93";
+    "nCTEQ15npFullNuc_56_26" = "1hq6qv19gqzjv57msdajb9kc0lv5jvl3b6x2fc905lg0dc7h2ab5";
+    "nCTEQ15npFullNuc_64_32" = "15gq3l91p69dba5gfxvh7j4npwl7rwkakjnsv9lx84hvys7hgba9";
+    "nCTEQ15npFullNuc_6_3" = "1gcxs7vcjcdyniczd1rprvzlc1p9yf08sy1fcrny2jfbxkfndqwx";
+    "nCTEQ15npFullNuc_7_3" = "09kwf5kbshw4pwh6iilqy1mzgvlg83jhakmvvgz27f569f20ci68";
+    "nCTEQ15npFullNuc_84_42" = "0ah349jih2ia0x14mnrygzzw38prfgcmbxyw1hdvzqvgk73wazwa";
+    "nCTEQ15npFullNuc_9_4" = "0gsh5jmyn7jlasp9ixx7imvkbp5rxmvfa480vy0bnxwjwz0924ia";
+    "nCTEQ15np_108_54" = "16hsl5ihcbx7wvrabrff5h422zfhlfrpskn5dy8s1phhla4r4ff3";
+    "nCTEQ15np_119_59" = "1bwhbfhw5xyb1dm18vxm095l1d9l9v0yl072qdbb6z9l29pa71dp";
+    "nCTEQ15np_12_6" = "0zv9g7r648f1h1f9qifii0mk2afdvphbfib3hp2sf960zb0d0nsv";
+    "nCTEQ15np_131_54" = "19sn6ig1c5smxi845qyflrrqaivm4pphwbxpz2zd9r0qhn032mlm";
+    "nCTEQ15np_14_7" = "07pyaik3h2yi05hn49fv3x191i4x6429bb6kywy999bzfrkjndcp";
+    "nCTEQ15np_184_74" = "1s2vmirmi1npw3pkxpzxjf9i69gmrl1dqrm2s0cfzl6286h87scb";
+    "nCTEQ15np_197_79" = "0p7lnffr4gy8qad8nsm6qfaw05s9pndkw0n9yb6v5i6mqg0j3cgd";
+    "nCTEQ15np_197_98" = "0vmjvjqkdn5cixsnvl9lvg07lrq17yw5pf2mdbzkrrfblqki6g0x";
+    "nCTEQ15np_1_1" = "1fndfff1lialb2qy08qp44w4605j9c2acrwpdb16k3awj88kx7mf";
+    "nCTEQ15np_207_103" = "1fcaw2hqxnzhs9glrh9lxvpfh0sn3mwahgd8d7hnfikrw93v0sbz";
+    "nCTEQ15np_208_82" = "0glf5nw1mr42icmbcjliz627nlsb7a5hyp591ng9y7dh41hxr01w";
+    "nCTEQ15np_20_10" = "1ka5hnq9cmr4l12ajmw4fpgdzcf0pjlw2pk4lkw6ai1h5h5absa5";
+    "nCTEQ15np_27_13" = "02dmzdqqh58h7232s2hcjnpd76rll8vxynq1bx059mvxak5lr5kw";
+    "nCTEQ15np_3_2" = "0jxg5f5n4yp4zbdkm9y7xd40m89pbw5687hz7mylpn9n3phsi58y";
+    "nCTEQ15np_40_18" = "0yp65xq318qw6xh3wm0n4s4a3s4ahvl14kq3cmwq9b954c5a5vkl";
+    "nCTEQ15np_40_20" = "1c367xb361p5mdwyda5iwswg7wb6s6gjibdv27n2kq41p1qp41y0";
+    "nCTEQ15np_4_2" = "04q9gq8163lhfjrrp0ysqyb5sx2nkw5mpz70daqnxvybavbkg7mm";
+    "nCTEQ15np_56_26" = "1qgh3g6xwk9jc6sd7kjj89w8mr89bhpdaiml5g7lvdqn39l95ng6";
+    "nCTEQ15np_64_32" = "02966xmh15i7kg9iif19p5c27rv369yikpm1xqclf8dz45a7xsry";
+    "nCTEQ15np_6_3" = "1rr7wr9wwsjfgnrnfvm7nrplhb38zym6qiyg2sagq7saw6kqpprz";
+    "nCTEQ15np_7_3" = "0ndqi05g88b769p1chfc6maz6wvs33rx45r4k8f68n79yy6kvrh1";
+    "nCTEQ15np_84_42" = "0v968jw1m9ky1mh82w1bjidvg7r7cx23bnpv0vr4c1kqz0n5hb5s";
+    "nCTEQ15np_9_4" = "0akxbyrs4y8gmnjiwma8z8ryrzmaw6dj148iq7ihsllwar3hp3p0";
+  }
diff --git a/nixpkgs/pkgs/development/libraries/physics/lhapdf/pdfset-hook.sh b/nixpkgs/pkgs/development/libraries/physics/lhapdf/pdfset-hook.sh
new file mode 100644
index 000000000000..c499d370d866
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/physics/lhapdf/pdfset-hook.sh
@@ -0,0 +1,5 @@
+@name@ () {
+  addToSearchPath LHAPDF_DATA_PATH "@out@"
+}
+
+postHooks+=(@name@)
diff --git a/nixpkgs/pkgs/development/libraries/physics/mcgrid/default.nix b/nixpkgs/pkgs/development/libraries/physics/mcgrid/default.nix
new file mode 100644
index 000000000000..b287e52b2431
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/physics/mcgrid/default.nix
@@ -0,0 +1,30 @@
+{ stdenv, fetchurl, fastnlo, rivet, pkgconfig }:
+
+stdenv.mkDerivation rec {
+  name = "mcgrid-${version}";
+  version = "2.0.2";
+
+  src = fetchurl {
+    url = "https://www.hepforge.org/archive/mcgrid/${name}.tar.gz";
+    sha256 = "1mw82x7zqbdchnd6shj3dirsav5i2cndp2hjwb8a8xdh4xh9zvfy";
+  };
+
+  buildInputs = [ fastnlo rivet ];
+  propagatedNativeBuildInputs = [ pkgconfig ];
+
+  preConfigure = ''
+    substituteInPlace mcgrid.pc.in \
+      --replace "Cflags:" "Cflags: -std=c++11"
+  '';
+
+  CXXFLAGS = "-std=c++11";
+  enableParallelBuilding = true;
+
+  meta = {
+    description = "A software package that provides access to the APPLgrid and fastNLO interpolation tools for Monte Carlo event generator codes, allowing for fast and flexible variations of scales, coupling parameters and PDFs in cutting edge leading- and next-to-leading-order QCD calculations";
+    license     = stdenv.lib.licenses.gpl3;
+    homepage    = http://mcgrid.hepforge.org;
+    platforms   = stdenv.lib.platforms.unix;
+    maintainers = with stdenv.lib.maintainers; [ veprbl ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/physics/mela/default.nix b/nixpkgs/pkgs/development/libraries/physics/mela/default.nix
new file mode 100644
index 000000000000..a608a7f6b0f7
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/physics/mela/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchFromGitHub, gfortran }:
+
+stdenv.mkDerivation rec {
+  name = "mela-${version}";
+  version = "2.0.1";
+
+  src = fetchFromGitHub {
+    owner = "vbertone";
+    repo = "MELA";
+    rev = version;
+    sha256 = "01sgd4mwx4n58x95brphp4dskqkkx8434bvsr38r5drg9na5nc9y";
+  };
+
+  buildInputs = [ gfortran ];
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    description = "a Mellin Evolution LibrAry";
+    license     = licenses.gpl3;
+    homepage    = https://github.com/vbertone/MELA;
+    platforms   = platforms.unix;
+    maintainers = with maintainers; [ veprbl ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/physics/nlojet/default.nix b/nixpkgs/pkgs/development/libraries/physics/nlojet/default.nix
new file mode 100644
index 000000000000..2f79a2b76ab9
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/physics/nlojet/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "nlojet++-${version}";
+  version = "4.1.3";
+
+  src = fetchurl {
+    url = "https://desy.de/~znagy/hep-programs/nlojet++/nlojet++-${version}.tar.gz";
+    sha256 = "18qfn5kjzvnyh29x40zm2maqzfmrnay9r58n8pfpq5lcphdhhv8p";
+  };
+
+  patches = [
+    ./nlojet_clang_fix.patch
+  ];
+
+  meta = {
+    homepage    = "http://www.desy.de/~znagy/Site/NLOJet++.html";
+    license     = stdenv.lib.licenses.gpl2;
+    description = "Implementation of calculation of the hadron jet cross sections";
+    platforms   = stdenv.lib.platforms.unix;
+    maintainers = with stdenv.lib.maintainers; [ veprbl ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/physics/nlojet/nlojet_clang_fix.patch b/nixpkgs/pkgs/development/libraries/physics/nlojet/nlojet_clang_fix.patch
new file mode 100644
index 000000000000..917c57e8cb47
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/physics/nlojet/nlojet_clang_fix.patch
@@ -0,0 +1,30 @@
+diff -rupN nlojet++-4.1.3-orig/nlo-hep/hep-lorentz/bits/hep-lorentzvector_complex.h nlojet++-4.1.3/nlo-hep/hep-lorentz/bits/hep-lorentzvector_complex.h
+--- nlojet++-4.1.3-orig/nlo-hep/hep-lorentz/bits/hep-lorentzvector_complex.h	2010-05-11 11:06:00.000000000 -0400
++++ nlojet++-4.1.3/nlo-hep/hep-lorentz/bits/hep-lorentzvector_complex.h	2014-08-23 03:22:51.000000000 -0400
+@@ -26,8 +26,11 @@
+ namespace nlo {
+ 
+   //   Spacializations
++  template<>
+   class lorentzvector<std::complex<float> >;
++  template<>
+   class lorentzvector<std::complex<double> >;
++  template<>
+   class lorentzvector<std::complex<long double> >;
+   
+   template<>
+diff -rupN nlojet++-4.1.3-orig/nlo-hep/hep-lorentz/bits/hep-threevector_complex.h nlojet++-4.1.3/nlo-hep/hep-lorentz/bits/hep-threevector_complex.h
+--- nlojet++-4.1.3-orig/nlo-hep/hep-lorentz/bits/hep-threevector_complex.h	2010-05-11 11:06:00.000000000 -0400
++++ nlojet++-4.1.3/nlo-hep/hep-lorentz/bits/hep-threevector_complex.h	2014-08-23 03:23:09.000000000 -0400
+@@ -26,8 +26,11 @@
+ namespace nlo {
+   
+   //    Specializations
++  template<>
+   class threevector<std::complex<float> >;
++  template<>
+   class threevector<std::complex<double> >;
++  template<>
+   class threevector<std::complex<long double> >;
+   
+   template<>
diff --git a/nixpkgs/pkgs/development/libraries/physics/pythia/default.nix b/nixpkgs/pkgs/development/libraries/physics/pythia/default.nix
new file mode 100644
index 000000000000..e84aaf373255
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/physics/pythia/default.nix
@@ -0,0 +1,33 @@
+{ stdenv, fetchurl, boost, fastjet, hepmc, lhapdf, rsync, zlib }:
+
+stdenv.mkDerivation rec {
+  name = "pythia-${version}";
+  version = "8.240";
+
+  src = fetchurl {
+    url = "http://home.thep.lu.se/~torbjorn/pythia8/pythia${builtins.replaceStrings ["."] [""] version}.tgz";
+    sha256 = "13cd86030j1f00n4xw30g26cgir3a5lsn9n0z13dh1vprbc9ax6j";
+  };
+
+  buildInputs = [ boost fastjet hepmc zlib rsync lhapdf ];
+
+  preConfigure = ''
+    patchShebangs ./configure
+  '';
+
+  configureFlags = [
+    "--enable-shared"
+    "--with-hepmc2=${hepmc}"
+    "--with-lhapdf6=${lhapdf}"
+  ];
+
+  enableParallelBuilding = true;
+
+  meta = {
+    description = "A program for the generation of high-energy physics events";
+    license     = stdenv.lib.licenses.gpl2;
+    homepage    = http://home.thep.lu.se/~torbjorn/Pythia.html;
+    platforms   = stdenv.lib.platforms.unix;
+    maintainers = with stdenv.lib.maintainers; [ veprbl ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/physics/qcdnum/default.nix b/nixpkgs/pkgs/development/libraries/physics/qcdnum/default.nix
new file mode 100644
index 000000000000..620f227250dd
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/physics/qcdnum/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchurl, gfortran }:
+
+stdenv.mkDerivation rec {
+  name = "QCDNUM-${version}";
+  version = "17-01-13";
+
+  src = fetchurl {
+    url = "http://www.nikhef.nl/user/h24/qcdnum-files/download/qcdnum${builtins.replaceStrings ["-"] [""] version}.tar.gz";
+    sha256 = "0568rjviwvjkfihq2ka7g91vmialr31ryn7c69iqf13rcv5vzcw7";
+  };
+
+  nativeBuildInputs = [ gfortran ];
+
+  enableParallelBuilding = true;
+
+  meta = {
+    description = "QCDNUM is a very fast QCD evolution program written in FORTRAN77";
+    license     = stdenv.lib.licenses.gpl3;
+    homepage    = https://www.nikhef.nl/~h24/qcdnum/index.html;
+    platforms   = stdenv.lib.platforms.unix;
+    maintainers = with stdenv.lib.maintainers; [ veprbl ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/physics/rivet/darwin.patch b/nixpkgs/pkgs/development/libraries/physics/rivet/darwin.patch
new file mode 100644
index 000000000000..2d397f1da6ca
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/physics/rivet/darwin.patch
@@ -0,0 +1,33 @@
+diff --git a/include/Rivet/Tools/osdir.hh b/include/Rivet/Tools/osdir.hh
+index 05f06ca..59af7de 100644
+--- a/include/Rivet/Tools/osdir.hh
++++ b/include/Rivet/Tools/osdir.hh
+@@ -21,7 +21,7 @@
+ 
+ /// @cond OSDIR
+ 
+-#if defined(unix) || defined(__unix) || defined(__unix__)
++#if defined(unix) || defined(__unix) || defined(__unix__) || defined(__APPLE__)
+ #define OSLINK_OSDIR_POSIX
+ #elif defined(_WIN32)
+ #define OSLINK_OSDIR_WINDOWS
+@@ -32,18 +32,7 @@
+ #include <string>
+ 
+ #if defined(OSLINK_OSDIR_NOTSUPPORTED)
+-
+-namespace oslink
+-{
+-	class directory
+-	{
+-		public:
+-			directory(const std::string&)		{ }
+-			operator void*() const				{ return (void*)0; }
+-			std::string next()					{ return ""; }
+-	};
+-}
+-
++#error Platform misdetected or oslink is not implemented
+ #elif defined(OSLINK_OSDIR_POSIX)
+ 
+ #include <sys/types.h>
diff --git a/nixpkgs/pkgs/development/libraries/physics/rivet/default.nix b/nixpkgs/pkgs/development/libraries/physics/rivet/default.nix
new file mode 100644
index 000000000000..40ccd8cfd20b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/physics/rivet/default.nix
@@ -0,0 +1,80 @@
+{ stdenv, fetchurl, fastjet, ghostscript, gsl, hepmc, imagemagick, less, python2, texlive, yoda, which, makeWrapper }:
+
+stdenv.mkDerivation rec {
+  name = "rivet-${version}";
+  version = "2.7.0";
+
+  src = fetchurl {
+    url = "https://www.hepforge.org/archive/rivet/Rivet-${version}.tar.bz2";
+    sha256 = "1bxcb99a3l5d2gl93zgfzgw6v95kx1ss5045mkz3ciyw8w5nmb9l";
+  };
+
+  patches = [
+    ./darwin.patch # configure relies on impure sw_vers to -Dunix
+  ];
+
+  latex = texlive.combine { inherit (texlive)
+    scheme-basic
+    collection-pstricks
+    collection-fontsrecommended
+    l3kernel
+    l3packages
+    mathastext
+    pgf
+    relsize
+    sfmath
+    siunitx
+    xcolor
+    xkeyval
+    xstring
+    ;};
+  buildInputs = [ hepmc imagemagick python2 latex makeWrapper ];
+  propagatedBuildInputs = [ fastjet ghostscript gsl yoda ];
+
+  preConfigure = ''
+    substituteInPlace analyses/Makefile.in \
+      --replace "!(tmp)" ""
+    substituteInPlace bin/rivet-buildplugin.in \
+      --replace 'which' '"${which}/bin/which"' \
+      --replace 'mycxx=' 'mycxx=${stdenv.cc}/bin/${if stdenv.cc.isClang or false then "clang++" else "g++"}  #' \
+      --replace 'mycxxflags="' "mycxxflags=\"-std=c++11 $NIX_CFLAGS_COMPILE $NIX_CXXSTDLIB_COMPILE $NIX_CFLAGS_LINK "
+  '';
+
+  preInstall = ''
+    substituteInPlace bin/make-plots \
+      --replace '"which"' '"${which}/bin/which"' \
+      --replace '"latex"' '"${latex}/bin/latex"' \
+      --replace '"dvips"' '"${latex}/bin/dvips"' \
+      --replace '"ps2pdf"' '"${ghostscript}/bin/ps2pdf"' \
+      --replace '"ps2eps"' '"${ghostscript}/bin/ps2eps"' \
+      --replace '"kpsewhich"' '"${latex}/bin/kpsewhich"' \
+      --replace '"convert"' '"${imagemagick.out}/bin/convert"'
+    substituteInPlace bin/rivet \
+      --replace '"less"' '"${less}/bin/less"'
+    substituteInPlace bin/rivet-mkhtml \
+      --replace '"make-plots"' \"$out/bin/make-plots\" \
+      --replace '"rivet-cmphistos"' \"$out/bin/rivet-cmphistos\"
+  '';
+
+  configureFlags = [
+    "--with-fastjet=${fastjet}"
+    "--with-hepmc=${hepmc}"
+    "--with-yoda=${yoda}"
+  ];
+
+  enableParallelBuilding = true;
+
+  postInstall = ''
+    for prog in "$out"/bin/*; do
+      wrapProgram "$prog" --set PYTHONPATH $PYTHONPATH:$(toPythonPath "$out")
+    done
+  '';
+
+  meta = {
+    description = "A framework for comparison of experimental measurements from high-energy particle colliders to theory predictions";
+    license     = stdenv.lib.licenses.gpl2;
+    homepage    = https://rivet.hepforge.org;
+    platforms   = stdenv.lib.platforms.unix;
+    maintainers = with stdenv.lib.maintainers; [ veprbl ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/physics/thepeg/default.nix b/nixpkgs/pkgs/development/libraries/physics/thepeg/default.nix
new file mode 100644
index 000000000000..046413c64f49
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/physics/thepeg/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchurl, boost, fastjet, gsl, hepmc, lhapdf, rivet, zlib }:
+
+stdenv.mkDerivation rec {
+  name = "thepeg-${version}";
+  version = "2.1.5";
+
+  src = fetchurl {
+    url = "https://www.hepforge.org/archive/thepeg/ThePEG-${version}.tar.bz2";
+    sha256 = "1rmmwhk9abn9mc9j3127axjwpvymv21ld4wcivwz01pldkxh06n6";
+  };
+
+  buildInputs = [ boost fastjet gsl hepmc lhapdf rivet zlib ];
+
+  configureFlags = [
+    "--with-hepmc=${hepmc}"
+    "--with-rivet=${rivet}"
+    "--without-javagui"
+  ];
+
+  enableParallelBuilding = true;
+
+  meta = {
+    description = "Toolkit for High Energy Physics Event Generation";
+    license     = stdenv.lib.licenses.gpl2;
+    homepage    = https://herwig.hepforge.org/;
+    platforms   = stdenv.lib.platforms.unix;
+    maintainers = with stdenv.lib.maintainers; [ veprbl ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/physics/yoda/default.nix b/nixpkgs/pkgs/development/libraries/physics/yoda/default.nix
new file mode 100644
index 000000000000..7a89d61753d1
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/physics/yoda/default.nix
@@ -0,0 +1,35 @@
+{ stdenv, fetchurl, python2Packages, root, makeWrapper, zlib, withRootSupport ? false }:
+
+stdenv.mkDerivation rec {
+  name = "yoda-${version}";
+  version = "1.7.4";
+
+  src = fetchurl {
+    url = "https://www.hepforge.org/archive/yoda/YODA-${version}.tar.bz2";
+    sha256 = "0w9s3qv87hrmpq4dkrxcrl2hn2vcsbvy8ml99w85404wksw1dwrx";
+  };
+
+  pythonPath = []; # python wrapper support
+
+  buildInputs = with python2Packages; [ python numpy matplotlib makeWrapper ]
+    ++ stdenv.lib.optional withRootSupport root;
+  propagatedBuildInputs = [ zlib ];
+
+  enableParallelBuilding = true;
+
+  postInstall = ''
+    for prog in "$out"/bin/*; do
+      wrapProgram "$prog" --set PYTHONPATH $PYTHONPATH:$(toPythonPath "$out")
+    done
+  '';
+
+  hardeningDisable = [ "format" ];
+
+  meta = {
+    description = "Provides small set of data analysis (specifically histogramming) classes";
+    license     = stdenv.lib.licenses.gpl3;
+    homepage    = https://yoda.hepforge.org;
+    platforms   = stdenv.lib.platforms.unix;
+    maintainers = with stdenv.lib.maintainers; [ veprbl ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/pipewire/default.nix b/nixpkgs/pkgs/development/libraries/pipewire/default.nix
new file mode 100644
index 000000000000..cc12cd02a693
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/pipewire/default.nix
@@ -0,0 +1,49 @@
+{ stdenv, fetchFromGitHub, meson, ninja, pkgconfig, doxygen, graphviz, valgrind
+, glib, dbus, gst_all_1, alsaLib, ffmpeg, libjack2, udev, libva, xorg
+, sbc, SDL2, makeFontsConf
+}:
+
+let
+  fontsConf = makeFontsConf {
+    fontDirectories = [ ];
+  };
+in stdenv.mkDerivation rec {
+  pname = "pipewire";
+  version = "0.2.6";
+
+  src = fetchFromGitHub {
+    owner = "PipeWire";
+    repo = "pipewire";
+    rev = version;
+    sha256 = "1rv1cprga0zy696pjk6gbb29p7nrbkvyla9iviii0pigflgnz6yl";
+  };
+
+  outputs = [ "out" "lib" "dev" "doc" ];
+
+  nativeBuildInputs = [
+    meson ninja pkgconfig doxygen graphviz valgrind
+  ];
+  buildInputs = [
+    glib dbus gst_all_1.gst-plugins-base gst_all_1.gstreamer
+    alsaLib ffmpeg libjack2 udev libva xorg.libX11 sbc SDL2
+  ];
+
+  mesonFlags = [
+    "-Ddocs=true"
+    "-Dgstreamer=enabled"
+  ];
+
+  PKG_CONFIG_SYSTEMD_SYSTEMDUSERUNITDIR = "${placeholder "out"}/lib/systemd/user";
+
+  FONTCONFIG_FILE = fontsConf; # Fontconfig error: Cannot load default config file
+
+  doCheck = true;
+
+  meta = with stdenv.lib; {
+    description = "Server and user space API to deal with multimedia pipelines";
+    homepage = https://pipewire.org/;
+    license = licenses.lgpl21;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ jtojnar ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/pixman/default.nix b/nixpkgs/pkgs/development/libraries/pixman/default.nix
new file mode 100644
index 000000000000..2a033304b66e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/pixman/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchurl, fetchpatch, pkgconfig, libpng, glib /*just passthru*/ }:
+
+stdenv.mkDerivation rec {
+  name = "pixman-${version}";
+  version = "0.38.4";
+
+  src = fetchurl {
+    url = "mirror://xorg/individual/lib/${name}.tar.bz2";
+    sha256 = "0l0m48lnmdlmnaxn2021qi5cj366d9fzfjxkqgcj9bs14pxbgaw4";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+
+  buildInputs = [ libpng ];
+
+  configureFlags = stdenv.lib.optional stdenv.isAarch32 "--disable-arm-iwmmxt";
+
+  doCheck = true;
+
+  postInstall = glib.flattenInclude;
+
+  meta = with stdenv.lib; {
+    homepage = http://pixman.org;
+    description = "A low-level library for pixel manipulation";
+    license = licenses.mit;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/pkcs11helper/default.nix b/nixpkgs/pkgs/development/libraries/pkcs11helper/default.nix
new file mode 100644
index 000000000000..5cf5d34b9aff
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/pkcs11helper/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchFromGitHub, pkgconfig, openssl, autoreconfHook }:
+
+stdenv.mkDerivation rec {
+  name = "pkcs11-helper-${version}";
+  version = "1.25.1";
+
+  src = fetchFromGitHub {
+    owner = "OpenSC";
+    repo = "pkcs11-helper";
+    rev = "${name}";
+    sha256 = "1nvj6kdbps860kw64m2rz3v2slyn7jkagfdmskrl6966n99iy2ns";
+  };
+
+  nativeBuildInputs = [ autoreconfHook pkgconfig ];
+  buildInputs = [ openssl ];
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    homepage = https://github.com/OpenSC/pkcs11-helper;
+    license = with licenses; [ bsd3 gpl2 ];
+    description = "Library that simplifies the interaction with PKCS#11 providers";
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/plib/default.nix b/nixpkgs/pkgs/development/libraries/plib/default.nix
new file mode 100644
index 000000000000..c9e8c632c7f1
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/plib/default.nix
@@ -0,0 +1,50 @@
+{ fetchurl, fetchpatch, stdenv, libGLU_combined, freeglut, SDL
+, libXi, libSM, libXmu, libXext, libX11 }:
+
+stdenv.mkDerivation rec {
+  name = "plib-1.8.5";
+
+  src = fetchurl {
+    # XXX: The author doesn't use the orthodox SF way to store tarballs.
+    url = "http://plib.sourceforge.net/dist/${name}.tar.gz";
+    sha256 = "0cha71mflpa10vh2l7ipyqk67dq2y0k5xbafwdks03fwdyzj4ns8";
+  };
+
+  patches = [
+    (fetchpatch {
+      url = "https://sources.debian.net/data/main/p/plib/1.8.5-7/debian/patches/04_CVE-2011-4620.diff";
+      sha256 = "1b7y0vqqdzd48q68ldlzw0zzqy9mg4c10a754r4hi3ldjmcplf0j";
+    })
+    (fetchpatch {
+      url = "https://sources.debian.net/data/main/p/plib/1.8.5-7/debian/patches/05_CVE-2012-4552.diff";
+      sha256 = "0b6cwdwii5b5vy78sbw5cw1s96l4jyzr4dk69v63pa0wwi2b5dki";
+    })
+  ];
+
+  propagatedBuildInputs = [
+    libGLU_combined freeglut SDL
+
+    # The following libs ought to be propagated build inputs of Mesa.
+    libXi libSM libXmu libXext libX11
+  ];
+
+  meta = {
+    description = "A suite of portable game libraries";
+
+    longDescription = ''
+      PLIB includes sound effects, music, a complete 3D engine, font
+      rendering, a simple Windowing library, a game scripting
+      language, a GUI, networking, 3D math library and a collection of
+      handy utility functions.  All are 100% portable across nearly
+      all modern computing platforms.  What's more, it's all available
+      on line - and completely free.  Each library component is fairly
+      independent of the others - so if you want to use SDL, GTK,
+      GLUT, or FLTK instead of PLIB's 'PW' windowing library, you can.
+    '';
+
+    license = stdenv.lib.licenses.lgpl2Plus;
+
+    homepage = http://plib.sourceforge.net/;
+    platforms = stdenv.lib.platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/pmdk/default.nix b/nixpkgs/pkgs/development/libraries/pmdk/default.nix
new file mode 100644
index 000000000000..ceb49fc01538
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/pmdk/default.nix
@@ -0,0 +1,40 @@
+{ stdenv, fetchFromGitHub
+, autoconf, libndctl, pkgconfig
+}:
+
+stdenv.mkDerivation rec {
+  name = "pmdk-${version}";
+  version = "1.6";
+
+  src = fetchFromGitHub {
+    owner  = "pmem";
+    repo   = "pmdk";
+    rev    = "refs/tags/${version}";
+    sha256 = "11h9h5ifgaa5f6v9y77s5lmsj7k61qg52992s1361cmvl0ndgl9k";
+  };
+
+  nativeBuildInputs = [ autoconf pkgconfig ];
+  buildInputs = [ libndctl ];
+  enableParallelBuilding = true;
+
+  outputs = [ "out" "lib" "dev" "man" ];
+
+  patchPhase = "patchShebangs utils";
+
+  installPhase = ''
+    make install prefix=$out
+
+    mkdir -p $lib $dev $man/share
+    mv $out/share/man $man/share/man
+    mv $out/include $dev/include
+    mv $out/lib     $lib/lib
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Persistent Memory Development Kit";
+    homepage    = https://github.com/pmem/pmdk;
+    license     = licenses.lgpl21;
+    maintainers = with maintainers; [ thoughtpolice ];
+    platforms   = [ "x86_64-linux" ]; # aarch64 is experimental
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/png++/default.nix b/nixpkgs/pkgs/development/libraries/png++/default.nix
new file mode 100644
index 000000000000..54a563c518fc
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/png++/default.nix
@@ -0,0 +1,45 @@
+{ stdenv, fetchurl, libpng
+, docSupport ? true, doxygen ? null
+}:
+assert docSupport -> doxygen != null;
+
+stdenv.mkDerivation rec {
+  name = "pngpp-${version}";
+  version = "0.2.9";
+
+  src = fetchurl {
+    url = "mirror://savannah/pngpp/png++-${version}.tar.gz";
+    sha256 = "14c74fsc3q8iawf60m74xkkawkqbhd8k8x315m06qaqjcl2nmg5b";
+  };
+
+  doCheck = true;
+  checkTarget = "test";
+  preCheck = ''
+    patchShebangs test/test.sh
+    substituteInPlace test/test.sh --replace "exit 1" "exit 0"
+  '';
+
+  postCheck = "cat test/test.log";
+
+  buildInputs = stdenv.lib.optional docSupport doxygen;
+
+  propagatedBuildInputs = [ libpng ];
+
+  preConfigure = stdenv.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";
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    homepage = https://www.nongnu.org/pngpp/;
+    description = "C++ wrapper for libpng library";
+    license = licenses.bsd3;
+    platforms = platforms.unix;
+    maintainers = [ maintainers.ramkromberg ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/pocketsphinx/default.nix b/nixpkgs/pkgs/development/libraries/pocketsphinx/default.nix
new file mode 100644
index 000000000000..f892540ae5c1
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/pocketsphinx/default.nix
@@ -0,0 +1,47 @@
+{ stdenv
+, fetchurl
+, sphinxbase
+, pkgconfig
+, python27 # >= 2.6
+, swig2 # 2.0
+}:
+
+stdenv.mkDerivation rec {
+  name = "pocketsphinx-5prealpha";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/cmusphinx/${name}.tar.gz";
+    sha256 = "1n9yazzdgvpqgnfzsbl96ch9cirayh74jmpjf7svs4i7grabanzg";
+  };
+
+  propagatedBuildInputs = [ sphinxbase ];
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ python27 swig2 ];
+
+  meta = {
+    description = "Voice recognition library written in C";
+    homepage = http://cmusphinx.sourceforge.net;
+    license = stdenv.lib.licenses.free;
+    platforms = stdenv.lib.platforms.linux;
+  };
+}
+
+/* Example usage:
+
+
+1.
+
+$ cat << EOF > vocabulary.txt
+oh mighty computer /1e-40/
+hello world /1e-30/
+EOF
+
+2.
+
+$ pocketsphinx_continuous -inmic yes -kws vocabulary.txt 2> /dev/null
+# after you say "hello world":
+hello world
+...
+
+*/
diff --git a/nixpkgs/pkgs/development/libraries/poco/default.nix b/nixpkgs/pkgs/development/libraries/poco/default.nix
new file mode 100644
index 000000000000..4dffa7486a1c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/poco/default.nix
@@ -0,0 +1,33 @@
+{ stdenv, fetchurl, cmake, pkgconfig, zlib, pcre, expat, sqlite, openssl, unixODBC, mysql }:
+
+stdenv.mkDerivation rec {
+  name = "poco-${version}";
+
+  version = "1.9.0";
+
+  src = fetchurl {
+    url = "https://pocoproject.org/releases/${name}/${name}-all.tar.gz";
+    sha256 = "11z1i0drbacs7c7d5virc3kz7wh79svd06iffh8j6giikl7vz1q3";
+  };
+
+  nativeBuildInputs = [ cmake pkgconfig ];
+
+  buildInputs = [ zlib pcre expat sqlite openssl unixODBC mysql.connector-c ];
+
+  MYSQL_DIR = mysql.connector-c;
+  MYSQL_INCLUDE_DIR = "${MYSQL_DIR}/include/mysql";
+
+  cmakeFlags = [
+    "-DPOCO_UNBUNDLED=ON"
+  ];
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    homepage = https://pocoproject.org/;
+    description = "Cross-platform C++ libraries with a network/internet focus";
+    license = licenses.boost;
+    maintainers = with maintainers; [ orivej ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/podofo/default.nix b/nixpkgs/pkgs/development/libraries/podofo/default.nix
new file mode 100644
index 000000000000..ce3f5ab6b789
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/podofo/default.nix
@@ -0,0 +1,47 @@
+{ stdenv, fetchurl, cmake, zlib, freetype, libjpeg, libtiff, fontconfig
+, openssl, libpng, lua5, pkgconfig, libidn, expat, fetchpatch
+, gcc5 # TODO(@Dridus) remove this at next hash break
+}:
+
+stdenv.mkDerivation rec {
+  version = "0.9.6";
+  name = "podofo-${version}";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/podofo/${name}.tar.gz";
+    sha256 = "0wj0y4zcmj4q79wrn3vv3xq4bb0vhhxs8yifafwy9f2sjm83c5p9";
+  };
+
+  patches = [
+    # https://sourceforge.net/p/podofo/tickets/24/
+    (fetchpatch {
+      url = "https://sourceforge.net/p/podofo/tickets/24/attachment/podofo-cmake-3.12.patch";
+      extraPrefix = "";
+      sha256 = "087h51x60zrakzx09baan77hwz99cwb5l1j802r5g4wj7pbjz0mb";
+    })
+  ];
+
+  outputs = [ "out" "dev" "lib" ];
+
+  nativeBuildInputs = [ cmake pkgconfig ];
+
+  buildInputs = [ zlib freetype libjpeg libtiff fontconfig openssl libpng
+                  libidn expat lua5 ];
+
+  cmakeFlags = [
+    "-DPODOFO_BUILD_SHARED=ON"
+    "-DPODOFO_BUILD_STATIC=OFF"
+    "-DCMAKE_BUILD_WITH_INSTALL_NAME_DIR=ON"
+  ];
+
+  postInstall = ''
+    moveToOutput lib "$lib"
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = http://podofo.sourceforge.net;
+    description = "A library to work with the PDF file format";
+    platforms = platforms.all;
+    license = with licenses; [ gpl2 lgpl2 ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/polkit-qt-1/qt-4.nix b/nixpkgs/pkgs/development/libraries/polkit-qt-1/qt-4.nix
new file mode 100644
index 000000000000..b13335561ac0
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/polkit-qt-1/qt-4.nix
@@ -0,0 +1,34 @@
+{ stdenv, fetchurl, cmake, pkgconfig, polkit, automoc4, glib, qt4 }:
+
+with stdenv.lib;
+
+stdenv.mkDerivation {
+  name = "polkit-qt-1-qt4-0.112.0";
+
+  src = fetchurl {
+    url = "mirror://kde/stable/apps/KDE4.x/admin/polkit-qt-1-0.112.0.tar.bz2";
+    sha256 = "1ip78x20hjqvm08kxhp6gb8hf6k5n6sxyx6kk2yvvq53djzh7yv7";
+  };
+
+  outputs = [ "out" "dev" ];
+
+  nativeBuildInputs = [ cmake pkgconfig automoc4 ];
+
+  propagatedBuildInputs = [ polkit glib qt4 ];
+
+  postFixup =
+    ''
+      for i in $dev/lib/cmake/*/*.cmake; do
+        echo "fixing $i"
+        substituteInPlace $i \
+          --replace "\''${PACKAGE_PREFIX_DIR}/lib" $out/lib
+      done
+    '';
+
+  meta = with stdenv.lib; {
+    description = "A Qt wrapper around PolKit";
+    maintainers = [ maintainers.ttuegel ];
+    platforms = platforms.linux;
+    license = licenses.lgpl21;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/polkit-qt-1/qt-5.nix b/nixpkgs/pkgs/development/libraries/polkit-qt-1/qt-5.nix
new file mode 100644
index 000000000000..f6cbf7e972b3
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/polkit-qt-1/qt-5.nix
@@ -0,0 +1,30 @@
+{ stdenv, fetchurl, cmake, pkgconfig, polkit, glib, qtbase }:
+
+with stdenv.lib;
+
+stdenv.mkDerivation {
+  name = "polkit-qt-1-qt5-0.112.0";
+
+  outputs = [ "out" "dev" ];
+
+  src = fetchurl {
+    url = "mirror://kde/stable/apps/KDE4.x/admin/polkit-qt-1-0.112.0.tar.bz2";
+    sha256 = "1ip78x20hjqvm08kxhp6gb8hf6k5n6sxyx6kk2yvvq53djzh7yv7";
+  };
+
+  nativeBuildInputs = [ cmake pkgconfig ];
+
+  propagatedBuildInputs = [ polkit glib qtbase ];
+
+  postFixup = ''
+    # Fix library location in CMake module
+    sed -i "$dev/lib/cmake/PolkitQt5-1/PolkitQt5-1Config.cmake" \
+        -e "s,\\(set_and_check.POLKITQT-1_LIB_DIR\\).*$,\\1 \"''${!outputLib}/lib\"),"
+  '';
+
+  meta = {
+    description = "A Qt wrapper around PolKit";
+    maintainers = with stdenv.lib.maintainers; [ ttuegel ];
+    platforms = with stdenv.lib.platforms; linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/polkit/default.nix b/nixpkgs/pkgs/development/libraries/polkit/default.nix
new file mode 100644
index 000000000000..fb16a7fb6939
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/polkit/default.nix
@@ -0,0 +1,91 @@
+{ stdenv, fetchurl, fetchpatch, autoreconfHook, pkgconfig, glib, expat, pam, perl
+, intltool, spidermonkey_60 , gobject-introspection, libxslt, docbook_xsl, dbus
+, docbook_xml_dtd_412, gtk-doc, coreutils
+, useSystemd ? stdenv.isLinux, systemd
+, withGnome ? true
+, doCheck ? stdenv.isLinux
+}:
+
+let
+
+  system = "/run/current-system/sw";
+  setuid = "/run/wrappers/bin"; #TODO: from <nixos> config.security.wrapperDir;
+
+in
+
+stdenv.mkDerivation rec {
+  pname = "polkit";
+  version = "0.116";
+
+  src = fetchurl {
+    url = "https://www.freedesktop.org/software/${pname}/releases/${pname}-${version}.tar.gz";
+    sha256 = "1c9lbpndh5zis22f154vjrhnqw65z8s85nrgl42v738yf6g0q5w8";
+  };
+
+  postPatch = stdenv.lib.optionalString stdenv.isDarwin ''
+    sed -i -e "s/-Wl,--as-needed//" configure.ac
+  '';
+
+  outputs = [ "bin" "dev" "out" ]; # small man pages in $bin
+
+  nativeBuildInputs =
+    [ glib gtk-doc pkgconfig intltool perl ]
+    ++ [ libxslt docbook_xsl docbook_xml_dtd_412 ]; # man pages
+  buildInputs =
+    [ glib expat pam spidermonkey_60 ]
+    ++ stdenv.lib.optional useSystemd systemd
+    ++ stdenv.lib.optional withGnome gobject-introspection;
+
+  NIX_CFLAGS_COMPILE = " -Wno-deprecated-declarations "; # for polkit 0.114 and glib 2.56
+
+  preConfigure = ''
+    chmod +x test/mocklibc/bin/mocklibc{,-test}.in
+    patchShebangs .
+
+    # ‘libpolkit-agent-1.so’ should call the setuid wrapper on
+    # NixOS.  Hard-coding the path is kinda ugly.  Maybe we can just
+    # call through $PATH, but that might have security implications.
+    substituteInPlace src/polkitagent/polkitagentsession.c \
+      --replace   'PACKAGE_PREFIX "/lib/polkit-1/'   '"${setuid}/'
+    substituteInPlace test/data/etc/polkit-1/rules.d/10-testing.rules \
+      --replace   /bin/true ${coreutils}/bin/true \
+      --replace   /bin/false ${coreutils}/bin/false
+
+  '' + stdenv.lib.optionalString useSystemd /* bogus chroot detection */ ''
+    sed '/libsystemd autoconfigured/s/.*/:/' -i configure
+  '';
+
+  configureFlags = [
+    "--datadir=${system}/share"
+    "--sysconfdir=/etc"
+    "--with-systemdsystemunitdir=${placeholder "out"}/etc/systemd/system"
+    "--with-polkitd-user=polkituser" #TODO? <nixos> config.ids.uids.polkituser
+    "--with-os-type=NixOS" # not recognized but prevents impurities on non-NixOS
+    (if withGnome then "--enable-introspection" else "--disable-introspection")
+  ] ++ stdenv.lib.optional (!doCheck) "--disable-test";
+
+  makeFlags = [
+    "INTROSPECTION_GIRDIR=${placeholder "out"}/share/gir-1.0"
+    "INTROSPECTION_TYPELIBDIR=${placeholder "out"}/lib/girepository-1.0"
+  ];
+
+  installFlags = [
+    "datadir=${placeholder "out"}/share"
+    "sysconfdir=${placeholder "out"}/etc"
+  ];
+
+  inherit doCheck;
+  checkInputs = [dbus];
+  checkPhase = ''
+    # tests need access to the system bus
+    dbus-run-session --config-file=${./system_bus.conf} -- sh -c 'DBUS_SYSTEM_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS make check'
+  '';
+
+  meta = with stdenv.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;
+    platforms = platforms.unix;
+    maintainers = [ ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/polkit/system_bus.conf b/nixpkgs/pkgs/development/libraries/polkit/system_bus.conf
new file mode 100644
index 000000000000..435b4740a2f7
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/polkit/system_bus.conf
@@ -0,0 +1,58 @@
+<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-Bus Bus Configuration 1.0//EN"
+ "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
+<busconfig>
+  <!-- Our well-known bus type, do not change this -->
+  <type>system</type>
+
+  <!-- Fork into daemon mode -->
+  <fork/>
+
+  <!-- Enable logging to syslog -->
+  <syslog/>
+
+  <!-- Only allow socket-credentials-based authentication -->
+  <auth>EXTERNAL</auth>
+
+  <!-- Only listen on a local socket. (abstract=/path/to/socket 
+       means use abstract namespace, don't really create filesystem 
+       file; only Linux supports this. Use path=/whatever on other 
+       systems.) -->
+  <listen>unix:path=/tmp/system_bus_socket</listen>
+
+  <policy context="default">
+    <!-- All users can connect to system bus -->
+    <allow user="*"/>
+
+    <!-- Holes must be punched in service configuration files for
+         name ownership and sending method calls -->
+    <deny own="*"/>
+    <deny send_type="method_call"/>
+
+    <!-- Signals and reply messages (method returns, errors) are allowed
+         by default -->
+    <allow send_type="signal"/>
+    <allow send_requested_reply="true" send_type="method_return"/>
+    <allow send_requested_reply="true" send_type="error"/>
+
+    <!-- All messages may be received by default -->
+    <allow receive_type="method_call"/>
+    <allow receive_type="method_return"/>
+    <allow receive_type="error"/>
+    <allow receive_type="signal"/>
+
+    <!-- Allow anyone to talk to the message bus -->
+    <allow send_destination="org.freedesktop.DBus"
+           send_interface="org.freedesktop.DBus" />
+    <allow send_destination="org.freedesktop.DBus"
+           send_interface="org.freedesktop.DBus.Introspectable"/>
+    <!-- But disallow some specific bus services -->
+    <deny send_destination="org.freedesktop.DBus"
+          send_interface="org.freedesktop.DBus"
+          send_member="UpdateActivationEnvironment"/>
+    <deny send_destination="org.freedesktop.DBus"
+          send_interface="org.freedesktop.DBus.Debug.Stats"/>
+    <deny send_destination="org.freedesktop.DBus"
+          send_interface="org.freedesktop.systemd1.Activator"/>
+  </policy>
+
+</busconfig>
diff --git a/nixpkgs/pkgs/development/libraries/poppler/0.61.nix b/nixpkgs/pkgs/development/libraries/poppler/0.61.nix
new file mode 100644
index 000000000000..633c3d69618b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/poppler/0.61.nix
@@ -0,0 +1,67 @@
+{ stdenv, lib, fetchurl, cmake, ninja, pkgconfig, libiconv, libintl
+, zlib, curl, cairo, freetype, fontconfig, lcms, libjpeg, openjpeg, fetchpatch
+, withData ? true, poppler_data
+, qt5Support ? false, qtbase ? null
+, introspectionSupport ? false, gobject-introspection ? null
+, utils ? false
+, minimal ? false, suffix ? "glib"
+}:
+
+let
+  version = "0.61.0";
+  mkFlag = optset: flag: "-DENABLE_${flag}=${if optset then "on" else "off"}";
+in
+stdenv.mkDerivation rec {
+  name = "poppler-${suffix}-${version}";
+
+  src = fetchurl {
+    url = "${meta.homepage}/poppler-${version}.tar.xz";
+    sha256 = "0zrbb1b77k6bm2qdnra08jnbyllv6vj29790igmp6fzs59xf3kak";
+  };
+
+  outputs = [ "out" "dev" ];
+
+  patches = [
+    (fetchpatch {
+      name = "CVE-2018-13988";
+      url = "https://cgit.freedesktop.org/poppler/poppler/patch/?id=004e3c10df0abda214f0c293f9e269fdd979c5ee";
+      sha256 = "1l8713s57xc6g81bldw934rsfm140fqc7ggd50ha5mxdl1b3app2";
+    })
+  ];
+
+  buildInputs = [ libiconv libintl ] ++ lib.optional withData poppler_data;
+
+  # TODO: reduce propagation to necessary libs
+  propagatedBuildInputs = with lib;
+    [ zlib freetype fontconfig libjpeg openjpeg ]
+    ++ optionals (!minimal) [ cairo lcms curl ]
+    ++ optional qt5Support qtbase
+    ++ optional introspectionSupport gobject-introspection;
+
+  nativeBuildInputs = [ cmake ninja pkgconfig ];
+
+  # Not sure when and how to pass it.  It seems an upstream bug anyway.
+  CXXFLAGS = stdenv.lib.optionalString stdenv.cc.isClang "-std=c++11";
+
+  cmakeFlags = [
+    (mkFlag true "XPDF_HEADERS")
+    (mkFlag (!minimal) "GLIB")
+    (mkFlag (!minimal) "CPP")
+    (mkFlag (!minimal) "LIBCURL")
+    (mkFlag utils "UTILS")
+    (mkFlag qt5Support "QT5")
+  ];
+
+  meta = with lib; {
+    homepage = https://poppler.freedesktop.org/;
+    description = "A PDF rendering library";
+
+    longDescription = ''
+      Poppler is a PDF rendering library based on the xpdf-3.0 code base.
+    '';
+
+    license = licenses.gpl2;
+    platforms = platforms.all;
+    maintainers = with maintainers; [ ttuegel ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/poppler/default.nix b/nixpkgs/pkgs/development/libraries/poppler/default.nix
new file mode 100644
index 000000000000..28408cb91f88
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/poppler/default.nix
@@ -0,0 +1,64 @@
+{ stdenv, lib, fetchurl, cmake, ninja, pkgconfig, libiconv, libintl
+, zlib, curl, cairo, freetype, fontconfig, lcms, libjpeg, openjpeg
+, withData ? true, poppler_data
+, qt5Support ? false, qtbase ? null
+, introspectionSupport ? false, gobject-introspection ? null
+, utils ? false, nss ? null
+, minimal ? false, suffix ? "glib"
+}:
+
+let # beware: updates often break cups-filters build
+  version = "0.74.0";
+  mkFlag = optset: flag: "-DENABLE_${flag}=${if optset then "on" else "off"}";
+in
+stdenv.mkDerivation rec {
+  name = "poppler-${suffix}-${version}";
+
+  src = fetchurl {
+    url = "${meta.homepage}/poppler-${version}.tar.xz";
+    sha256 = "0bvb0yq9zsl2b811j4l4x0vf8g5lgmqbndkb2hvgsrr5639rzq4j";
+  };
+
+  outputs = [ "out" "dev" ];
+
+  buildInputs = [ libiconv libintl ] ++ lib.optional withData poppler_data;
+
+  # TODO: reduce propagation to necessary libs
+  propagatedBuildInputs = with lib;
+    [ zlib freetype fontconfig libjpeg openjpeg ]
+    ++ optionals (!minimal) [ cairo lcms curl ]
+    ++ optional qt5Support qtbase
+    ++ optional utils nss
+    ++ optional introspectionSupport gobject-introspection;
+
+  nativeBuildInputs = [ cmake ninja pkgconfig ];
+
+  # Workaround #54606
+  preConfigure = stdenv.lib.optionalString stdenv.isDarwin ''
+    sed -i -e '1i cmake_policy(SET CMP0025 NEW)' CMakeLists.txt
+  '';
+
+  cmakeFlags = [
+    (mkFlag true "UNSTABLE_API_ABI_HEADERS") # previously "XPDF_HEADERS"
+    (mkFlag (!minimal) "GLIB")
+    (mkFlag (!minimal) "CPP")
+    (mkFlag (!minimal) "LIBCURL")
+    (mkFlag utils "UTILS")
+    (mkFlag qt5Support "QT5")
+  ];
+
+  meta = with lib; {
+    homepage = https://poppler.freedesktop.org/;
+    description = "A PDF rendering library";
+
+    longDescription = ''
+      Poppler is a PDF rendering library based on the xpdf-3.0 code
+      base. In addition it provides a number of tools that can be
+      installed separately.
+    '';
+
+    license = licenses.gpl2;
+    platforms = platforms.all;
+    maintainers = with maintainers; [ ttuegel ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/popt/1.16-cygwin.patch b/nixpkgs/pkgs/development/libraries/popt/1.16-cygwin.patch
new file mode 100644
index 000000000000..9c084f0b8eaa
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/popt/1.16-cygwin.patch
@@ -0,0 +1,11 @@
+--- origsrc/poptconfig.c	2009-05-20 08:18:07.000000000 -0500
++++ src/poptconfig.c	2012-03-29 18:13:46.869286100 -0500
+@@ -42,7 +42,7 @@ extern int glob_pattern_p (const char *_
+ /*@=declundef =exportheader =incondefs =protoparammatch =redecl =type @*/
+ #endif	/* __LCLINT__ */
+ 
+-#if !defined(__GLIBC__)
++#if !defined(__GLIBC__) && !defined(__CYGWIN__)
+ /* Return nonzero if PATTERN contains any metacharacters.
+    Metacharacters can be quoted with backslashes if QUOTE is nonzero.  */
+ static int
diff --git a/nixpkgs/pkgs/development/libraries/popt/1.16-vpath.patch b/nixpkgs/pkgs/development/libraries/popt/1.16-vpath.patch
new file mode 100644
index 000000000000..4cfa1c8fb4db
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/popt/1.16-vpath.patch
@@ -0,0 +1,34 @@
+--- origsrc/Doxyfile.in	2008-04-26 16:57:32.000000000 -0500
++++ src/Doxyfile.in	2012-03-29 18:15:56.649709100 -0500
+@@ -460,14 +460,14 @@ WARN_LOGFILE           =
+ # with spaces.
+ 
+ INPUT                  = \
+-                        ./popt.c \
+-                        ./popt.h \
+-                        ./poptconfig.c \
+-                        ./popthelp.c \
+-                        ./poptint.c \
+-                        ./poptint.h \
+-                        ./poptparse.c \
+-			./system.h
++                        @srcdir@/popt.c \
++                        @srcdir@/popt.h \
++                        @srcdir@/poptconfig.c \
++                        @srcdir@/popthelp.c \
++                        @srcdir@/poptint.c \
++                        @srcdir@/poptint.h \
++                        @srcdir@/poptparse.c \
++			@srcdir@/system.h
+ 
+ # If the value of the INPUT tag contains directories, you can use the 
+ # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp 
+@@ -658,7 +658,7 @@ HTML_HEADER            =
+ # each generated HTML page. If it is left blank doxygen will generate a 
+ # standard footer.
+ 
+-HTML_FOOTER            = footer_no_timestamp.html
++HTML_FOOTER            = @srcdir@/footer_no_timestamp.html
+ 
+ # The HTML_STYLESHEET tag can be used to specify a user-defined cascading 
+ # style sheet that is used by each HTML page. It can be used to 
diff --git a/nixpkgs/pkgs/development/libraries/popt/default.nix b/nixpkgs/pkgs/development/libraries/popt/default.nix
new file mode 100644
index 000000000000..592a1f1470a4
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/popt/default.nix
@@ -0,0 +1,23 @@
+{stdenv, fetchurl}:
+
+stdenv.mkDerivation rec {
+  name = "popt-1.16";
+
+  src = fetchurl {
+    url = "http://rpm5.org/files/popt/${name}.tar.gz";
+    sha256 = "1j2c61nn2n351nhj4d25mnf3vpiddcykq005w2h6kw79dwlysa77";
+  };
+
+  patches = stdenv.lib.optionals stdenv.isCygwin [
+    ./1.16-cygwin.patch
+    ./1.16-vpath.patch
+  ];
+
+  doCheck = false; # fails
+
+  meta = with stdenv.lib; {
+    description = "Command line option parsing library";
+    platforms = platforms.unix;
+    license = licenses.mit;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/portaudio/default.nix b/nixpkgs/pkgs/development/libraries/portaudio/default.nix
new file mode 100644
index 000000000000..89248597f5d9
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/portaudio/default.nix
@@ -0,0 +1,52 @@
+{ stdenv, fetchurl, alsaLib, pkgconfig, libjack2
+, AudioUnit, AudioToolbox, CoreAudio, CoreServices, Carbon }:
+
+stdenv.mkDerivation rec {
+  name = "portaudio-190600-20161030";
+
+  src = fetchurl {
+    url = http://www.portaudio.com/archives/pa_stable_v190600_20161030.tgz;
+    sha256 = "04qmin6nj144b8qb9kkd9a52xfvm0qdgm8bg8jbl7s3frmyiv8pm";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ libjack2 ]
+    ++ stdenv.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";
+
+  propagatedBuildInputs = stdenv.lib.optionals stdenv.isDarwin [ AudioUnit AudioToolbox CoreAudio CoreServices Carbon ];
+
+  patchPhase = stdenv.lib.optionalString stdenv.isDarwin ''
+    sed -i '50 i\
+      #include <CoreAudio/AudioHardware.h>\
+      #include <CoreAudio/AudioHardwareBase.h>\
+      #include <CoreAudio/AudioHardwareDeprecated.h>' \
+      include/pa_mac_core.h
+  '';
+
+  # not sure why, but all the headers seem to be installed by the make install
+  installPhase = ''
+    make install
+  '' + stdenv.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 ''
+    cp include/pa_mac_core.h $out/include/pa_mac_core.h
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Portable cross-platform Audio API";
+    homepage    = http://www.portaudio.com/;
+    # Not exactly a bsd license, but alike
+    license     = licenses.mit;
+    maintainers = with maintainers; [ lovek323 ];
+    platforms   = platforms.unix;
+  };
+
+  passthru = {
+    api_version = 19;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/portmidi/default.nix b/nixpkgs/pkgs/development/libraries/portmidi/default.nix
new file mode 100644
index 000000000000..f790c62f5af2
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/portmidi/default.nix
@@ -0,0 +1,57 @@
+{ stdenv, fetchurl, unzip, cmake, /*jdk,*/ alsaLib }:
+
+stdenv.mkDerivation rec {
+  name = "portmidi-${version}";
+  version = "217";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/portmedia/portmidi-src-${version}.zip";
+    sha256 = "03rfsk7z6rdahq2ihy5k13qjzgx757f75yqka88v3gc0pn9ais88";
+  };
+
+  cmakeFlags = let
+    #base = "${jdk}/jre/lib/${jdk.architecture}";
+  in [
+    "-DPORTMIDI_ENABLE_JAVA=0"
+    /* TODO: Fix Java support.
+    "-DJAVA_AWT_LIBRARY=${base}/libawt.so"
+    "-DJAVA_JVM_LIBRARY=${base}/server/libjvm.so"
+    */
+    "-DCMAKE_ARCHIVE_OUTPUT_DIRECTORY=Release"
+    "-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=Release"
+    "-DCMAKE_RUNTIME_OUTPUT_DIRECTORY=Release"
+  ];
+
+  # XXX: This is to deactivate Java support.
+  patches = stdenv.lib.singleton (fetchurl rec {
+    url = "https://raw.github.com/Rogentos/argent-gentoo/master/media-libs/"
+        + "portmidi/files/portmidi-217-cmake-libdir-java-opts.patch";
+    sha256 = "1jbjwan61iqq9fqfpq2a4fd30k3clg7a6j0gfgsw87r8c76kqf6h";
+  });
+
+  postPatch = ''
+    sed -i -e 's|/usr/local/|'"$out"'|' -e 's|/usr/share/|'"$out"'/share/|' \
+      pm_common/CMakeLists.txt pm_dylib/CMakeLists.txt pm_java/CMakeLists.txt
+    sed -i \
+        -e 's|-classpath .|-classpath '"$(pwd)"'/pm_java|' \
+        -e 's|pmdefaults/|'"$(pwd)"'/pm_java/&|g' \
+        -e 's|jportmidi/|'"$(pwd)"'/pm_java/&|g' \
+        -e 's/WORKING_DIRECTORY pm_java//' \
+        pm_java/CMakeLists.txt
+  '';
+
+  postInstall = ''
+    ln -s libportmidi.so "$out/lib/libporttime.so"
+  '';
+
+  buildInputs = [ unzip cmake /*jdk*/ alsaLib ];
+
+  hardeningDisable = [ "format" ];
+
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/ppl/default.nix b/nixpkgs/pkgs/development/libraries/ppl/default.nix
new file mode 100644
index 000000000000..566d88dcdb56
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/ppl/default.nix
@@ -0,0 +1,60 @@
+{ fetchurl, fetchpatch, stdenv, gmpxx, perl, gnum4 }:
+
+let version = "1.2"; in
+
+stdenv.mkDerivation rec {
+  name = "ppl-${version}";
+
+  src = fetchurl {
+    url = "http://bugseng.com/products/ppl/download/ftp/releases/${version}/ppl-${version}.tar.bz2";
+    sha256 = "1wgxcbgmijgk11df43aiqfzv31r3bkxmgb4yl68g21194q60nird";
+  };
+
+  patches = [(fetchpatch {
+    name = "ppl.patch";
+    url = "http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=patch;h=c39f6a07b51f89e365b05ba4147aa2aa448febd7";
+    sha256 = "1zj90hm25pkgvk4jlkfzh18ak9b98217gbidl3731fdccbw6hr87";
+  })];
+
+  nativeBuildInputs = [ perl gnum4 ];
+  propagatedBuildInputs = [ gmpxx ];
+
+  configureFlags = [ "--disable-watchdog" ] ++
+    stdenv.lib.optionals stdenv.isDarwin [
+      "CPPFLAGS=-fexceptions"
+      "--disable-ppl_lcdd" "--disable-ppl_lpsol" "--disable-ppl_pips"
+    ];
+
+  # Beware!  It took ~6 hours to compile PPL and run its tests on a 1.2 GHz
+  # x86_64 box.  Nevertheless, being a dependency of GCC, it probably ought
+  # to be tested.
+  doCheck = false;
+
+  enableParallelBuilding = true;
+
+  meta = {
+    description = "The Parma Polyhedra Library";
+
+    longDescription = ''
+      The Parma Polyhedra Library (PPL) provides numerical abstractions
+      especially targeted at applications in the field of analysis and
+      verification of complex systems.  These abstractions include convex
+      polyhedra, defined as the intersection of a finite number of (open or
+      closed) halfspaces, each described by a linear inequality (strict or
+      non-strict) with rational coefficients; some special classes of
+      polyhedra shapes that offer interesting complexity/precision tradeoffs;
+      and grids which represent regularly spaced points that satisfy a set of
+      linear congruence relations.  The library also supports finite
+      powersets and products of (any kind of) polyhedra and grids and a mixed
+      integer linear programming problem solver using an exact-arithmetic
+      version of the simplex algorithm.
+    '';
+
+    homepage = http://bugseng.com/products/ppl/;
+
+    license = stdenv.lib.licenses.gpl3Plus;
+
+    maintainers = [ ];
+    platforms = stdenv.lib.platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/prison/default.nix b/nixpkgs/pkgs/development/libraries/prison/default.nix
new file mode 100644
index 000000000000..d40b4442e38e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/prison/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, fetchurl, cmake, qrencode, qt4, libdmtx }:
+
+let v = "1.0"; in
+
+stdenv.mkDerivation rec {
+  name = "prison-${v}";
+
+  src = fetchurl {
+    url = "mirror://kde/stable/prison/${v}/src/${name}.tar.gz";
+    sha256 = "08hkzzda36jpdywjqlyzcvli7cx17h4l9yffzsdnhdd788n28krr";
+  };
+
+  buildInputs = [ qt4 qrencode libdmtx ];
+
+  nativeBuildInputs = [ cmake ];
+
+  meta = {
+    description = "Qt4 library for QR-codes";
+    license = stdenv.lib.licenses.mit;
+    inherit (qt4.meta) platforms;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/proj/default.nix b/nixpkgs/pkgs/development/libraries/proj/default.nix
new file mode 100644
index 000000000000..8fb4515e70da
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/proj/default.nix
@@ -0,0 +1,20 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation {
+  name = "proj-5.2.0";
+
+  src = fetchurl {
+    url = https://download.osgeo.org/proj/proj-5.2.0.tar.gz;
+    sha256 = "0q3ydh2j8qhwlxmnac72pg69rw2znbi5b6k5wama8qmwzycr94gg";
+  };
+
+  doCheck = stdenv.is64bit;
+
+  meta = with stdenv.lib; {
+    description = "Cartographic Projections Library";
+    homepage = https://proj4.org;
+    license = licenses.mit;
+    platforms = platforms.linux ++ platforms.darwin;
+    maintainers = with maintainers; [ vbgl ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/prometheus-cpp/default.nix b/nixpkgs/pkgs/development/libraries/prometheus-cpp/default.nix
new file mode 100644
index 000000000000..23c8257ac8fe
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/prometheus-cpp/default.nix
@@ -0,0 +1,41 @@
+{ stdenv
+, fetchFromGitHub
+, cmake
+, gbenchmark
+, gtest
+, civetweb
+, zlib
+, curl
+}:
+
+stdenv.mkDerivation rec {
+  pname = "prometheus-cpp";
+  version = "0.6.0";
+
+  src = fetchFromGitHub {
+    owner = "jupp0r";
+    repo = pname;
+    rev = "v${version}";
+    sha256 = "sha256:1a0gpfmk0z9wgsbzvx823aqbs7w836l0j0rnsxl9ifwgdxnxbl6m";
+  };
+
+  nativeBuildInputs = [ cmake ];
+  buildInputs = [ gbenchmark civetweb gtest zlib curl ];
+
+  strictDeps = true;
+
+  cmakeFlags = [
+    "-DUSE_THIRDPARTY_LIBRARIES=OFF"
+    "-DCIVETWEB_INCLUDE_DIR=${civetweb.dev}/include"
+    "-DCIVETWEB_CXX_LIBRARY=${civetweb}/lib/libcivetweb${stdenv.targetPlatform.extensions.sharedLibrary}"
+  ];
+
+  NIX_LDFLAGS = [ "-ldl" ];
+
+  meta = {
+    description = "Prometheus Client Library for Modern C++";
+    homepage = https://github.com/jupp0r/prometheus-cpp;
+    license = [ stdenv.lib.licenses.mit ];
+  };
+
+}
diff --git a/nixpkgs/pkgs/development/libraries/properties-cpp/default.nix b/nixpkgs/pkgs/development/libraries/properties-cpp/default.nix
new file mode 100644
index 000000000000..06444e776703
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/properties-cpp/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, lib, fetchurl, cmake, pkgconfig, gtest, doxygen
+, graphviz, lcov, writeText }:
+
+stdenv.mkDerivation rec {
+  pname = "properties-cpp";
+  version = "0.0.1";
+
+  src = let srcver = version+"+14.10.20140730"; in
+  fetchurl {
+    url = "https://launchpad.net/ubuntu/+archive/primary/+files/${pname}_${srcver}.orig.tar.gz";
+    sha256 = "08vjyv7ibn6jh2ikj5v48kjpr3n6hlkp9qlvdn8r0vpiwzah0m2w";
+  };
+
+  buildInputs = [ cmake gtest doxygen pkgconfig graphviz lcov ];
+
+  patchPhase = ''
+    sed -i "/add_subdirectory(tests)/d" CMakeLists.txt
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = https://launchpad.net/properties-cpp;
+    description = "A very simple convenience library for handling properties and signals in C++11.";
+    license = licenses.lgpl3;
+    maintainers = with maintainers; [ edwtjo ];
+  };
+
+}
diff --git a/nixpkgs/pkgs/development/libraries/protobuf/2.5.nix b/nixpkgs/pkgs/development/libraries/protobuf/2.5.nix
new file mode 100644
index 000000000000..550d0b1bace2
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/protobuf/2.5.nix
@@ -0,0 +1,10 @@
+{ callPackage, fetchurl, ... } @ args:
+
+callPackage ./generic.nix (args // rec {
+  version = "2.5.0";
+  # make sure you test also -A pythonPackages.protobuf
+  src = fetchurl {
+    url = "http://protobuf.googlecode.com/files/${version}.tar.bz2";
+    sha256 = "0xxn9gxhvsgzz2sgmihzf6pf75clr05mqj6218camwrwajpcbgqk";
+  };
+})
\ No newline at end of file
diff --git a/nixpkgs/pkgs/development/libraries/protobuf/3.1.nix b/nixpkgs/pkgs/development/libraries/protobuf/3.1.nix
new file mode 100644
index 000000000000..91ef87512c84
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/protobuf/3.1.nix
@@ -0,0 +1,6 @@
+{ callPackage, ... }:
+
+callPackage ./generic-v3.nix {
+  version = "3.1.0";
+  sha256 = "0qlvpsmqgh9nw0k4zrxlxf75pafi3p0ahz99v6761b903y8qyv4i";
+}
diff --git a/nixpkgs/pkgs/development/libraries/protobuf/3.4.nix b/nixpkgs/pkgs/development/libraries/protobuf/3.4.nix
new file mode 100644
index 000000000000..5a9034a56a80
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/protobuf/3.4.nix
@@ -0,0 +1,6 @@
+{ callPackage, lib, ... }:
+
+lib.overrideDerivation (callPackage ./generic-v3.nix {
+  version = "3.4.1";
+  sha256 = "1lzxmbqlnmi34kymnf399azv86gmdbrf71xiad6wc24bzpkzqybb";
+}) (attrs: { NIX_CFLAGS_COMPILE = "-Wno-error"; })
diff --git a/nixpkgs/pkgs/development/libraries/protobuf/3.5.nix b/nixpkgs/pkgs/development/libraries/protobuf/3.5.nix
new file mode 100644
index 000000000000..db9cb6f0371b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/protobuf/3.5.nix
@@ -0,0 +1,6 @@
+{ callPackage, lib, ... }:
+
+lib.overrideDerivation (callPackage ./generic-v3.nix {
+  version = "3.5.1.1";
+  sha256 = "1h4xydr5j2zg1888ncn8a1jvqq8fgpgckrmjg6lqzy9jpkvqvfdk";
+}) (attrs: { NIX_CFLAGS_COMPILE = "-Wno-error"; })
diff --git a/nixpkgs/pkgs/development/libraries/protobuf/3.6.nix b/nixpkgs/pkgs/development/libraries/protobuf/3.6.nix
new file mode 100644
index 000000000000..16decc44e847
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/protobuf/3.6.nix
@@ -0,0 +1,6 @@
+{ callPackage, ... }:
+
+callPackage ./generic-v3.nix {
+  version = "3.6.1.3";
+  sha256 = "1spj0d4flx6h3phxx3sg9r00yv734hina3365avkcz9brnm089c1";
+}
diff --git a/nixpkgs/pkgs/development/libraries/protobuf/3.7.nix b/nixpkgs/pkgs/development/libraries/protobuf/3.7.nix
new file mode 100644
index 000000000000..9bfb307e3286
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/protobuf/3.7.nix
@@ -0,0 +1,6 @@
+{ callPackage, ... }:
+
+callPackage ./generic-v3.nix {
+  version = "3.7.1";
+  sha256 = "00zkijvj80bmhlj8290x4bc416mng2dlbzwc4bkvfmbal1fx93m2";
+}
diff --git a/nixpkgs/pkgs/development/libraries/protobuf/generic-v3.nix b/nixpkgs/pkgs/development/libraries/protobuf/generic-v3.nix
new file mode 100644
index 000000000000..883dff56f2ee
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/protobuf/generic-v3.nix
@@ -0,0 +1,63 @@
+{ stdenv
+, fetchFromGitHub
+, autoreconfHook, zlib, gmock, which, buildPackages
+, version, sha256
+, ...
+}:
+
+let
+mkProtobufDerivation = buildProtobuf: stdenv: stdenv.mkDerivation rec {
+  name = "protobuf-${version}";
+
+  # make sure you test also -A pythonPackages.protobuf
+  src = fetchFromGitHub {
+    owner = "protocolbuffers";
+    repo = "protobuf";
+    rev = "v${version}";
+    inherit sha256;
+  };
+
+  postPatch = ''
+    rm -rf gmock
+    cp -r ${gmock.src}/googlemock gmock
+    cp -r ${gmock.src}/googletest googletest
+    chmod -R a+w gmock
+    chmod -R a+w googletest
+    ln -s ../googletest gmock/gtest
+  '' + stdenv.lib.optionalString stdenv.isDarwin ''
+    substituteInPlace src/google/protobuf/testing/googletest.cc \
+      --replace 'tmpnam(b)' '"'$TMPDIR'/foo"'
+  '';
+
+  nativeBuildInputs = [ autoreconfHook buildPackages.which buildPackages.stdenv.cc buildProtobuf ];
+
+  buildInputs = [ zlib ];
+  configureFlags = if buildProtobuf == null then [] else [ "--with-protoc=${buildProtobuf}/bin/protoc" ];
+
+  enableParallelBuilding = true;
+
+  doCheck = true;
+
+  dontDisableStatic = true;
+
+  NIX_CFLAGS_COMPILE = with stdenv.lib;
+    # gcc before 6 doesn't know this option
+    optionalString (hasPrefix "gcc-6" stdenv.cc.cc.name) "-Wno-error=misleading-indentation";
+
+  meta = {
+    description = "Google's data interchange format";
+    longDescription =
+      ''Protocol Buffers are a way of encoding structured data in an efficient
+        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;
+    homepage = https://developers.google.com/protocol-buffers/;
+  };
+
+  passthru.version = version;
+};
+in mkProtobufDerivation(if (stdenv.buildPlatform != stdenv.hostPlatform)
+                        then (mkProtobufDerivation null buildPackages.stdenv)
+                        else null) stdenv
diff --git a/nixpkgs/pkgs/development/libraries/protobuf/generic.nix b/nixpkgs/pkgs/development/libraries/protobuf/generic.nix
new file mode 100644
index 000000000000..1a20d806b968
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/protobuf/generic.nix
@@ -0,0 +1,60 @@
+{ stdenv, version, src
+, autoreconfHook, zlib, gtest
+, ...
+}:
+
+stdenv.mkDerivation rec {
+  name = "protobuf-${version}";
+
+  inherit src;
+
+  postPatch = ''
+    rm -rf gtest
+    cp -r ${gtest.src}/googletest gtest
+    chmod -R a+w gtest
+  '' + stdenv.lib.optionalString stdenv.isDarwin ''
+    substituteInPlace src/google/protobuf/testing/googletest.cc \
+      --replace 'tmpnam(b)' '"'$TMPDIR'/foo"'
+  '';
+
+  outputs = [ "out" "lib" ];
+
+  nativeBuildInputs = [ autoreconfHook ];
+  buildInputs = [ zlib ];
+
+  # The generated C++ code uses static initializers which mutate a global data
+  # structure. This causes problems for an executable when:
+  #
+  # 1) it dynamically links to two libs, both of which contain generated C++ for
+  #    the same proto file, and
+  # 2) the two aforementioned libs both dynamically link to libprotobuf.
+  #
+  # One solution is to statically link libprotobuf, that way the global
+  # variables are not shared; in fact, this is necessary for the python Mesos
+  # binding to not crash, as the python lib contains two C extensions which
+  # both refer to the same proto schema.
+  #
+  # See: https://github.com/NixOS/nixpkgs/pull/19064#issuecomment-255082684
+  #      https://github.com/google/protobuf/issues/1489
+  dontDisableStatic = true;
+  configureFlags = [
+    "CFLAGS=-fPIC"
+    "CXXFLAGS=-fPIC"
+  ];
+
+  doCheck = true;
+
+  meta = {
+    description = "Protocol Buffers - Google's data interchange format";
+    longDescription =
+      '' Protocol Buffers are a way of encoding structured data in an
+         efficient yet extensible format.  Google uses Protocol Buffers for
+         almost all of its internal RPC protocols and file formats.
+      '';
+    license = "mBSD";
+    homepage = https://developers.google.com/protocol-buffers/;
+    platforms = stdenv.lib.platforms.unix;
+  };
+
+  passthru.version = version;
+}
diff --git a/nixpkgs/pkgs/development/libraries/protobufc/1.3.nix b/nixpkgs/pkgs/development/libraries/protobufc/1.3.nix
new file mode 100644
index 000000000000..c3a815c45ac8
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/protobufc/1.3.nix
@@ -0,0 +1,12 @@
+{ callPackage, fetchFromGitHub, ... } @ args:
+
+callPackage ./generic.nix (args // rec {
+  version = "1.3.1";
+  src = fetchFromGitHub {
+    owner = "protobuf-c";
+    repo = "protobuf-c";
+    #rev = "v${version}";
+    rev = "9412830d0680150d429d2aa170b8d7218ab49397";
+    sha256 = "175cmaj5231iqzhf5a9sxw2y3i165chk3681m1b5mp8di927q5ai";
+  };
+})
diff --git a/nixpkgs/pkgs/development/libraries/protobufc/generic.nix b/nixpkgs/pkgs/development/libraries/protobufc/generic.nix
new file mode 100644
index 000000000000..e0c5d4db9305
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/protobufc/generic.nix
@@ -0,0 +1,20 @@
+{ stdenv, src, version
+, autoreconfHook, pkgconfig, protobuf, zlib
+, ...
+}:
+
+stdenv.mkDerivation rec {
+  name = "protobuf-c-${version}";
+
+  inherit src;
+
+  nativeBuildInputs = [ autoreconfHook pkgconfig ];
+  buildInputs = [ protobuf zlib ];
+
+  meta = with stdenv.lib; {
+    homepage = https://github.com/protobuf-c/protobuf-c/;
+    description = "C bindings for Google's Protocol Buffers";
+    license = licenses.bsd2;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/prototypejs/default.nix b/nixpkgs/pkgs/development/libraries/prototypejs/default.nix
new file mode 100644
index 000000000000..a56b14384e5b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/prototypejs/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchurl, ... }:
+let
+  version = "1.7.3.0";
+in fetchurl {
+  name = "prototype-${version}.js";
+  url = "https://ajax.googleapis.com/ajax/libs/prototype/${version}/prototype.js";
+  sha256 = "0q43vvrsb22h4jvavs1gk3v4ps61yx9k85b5n6q9mxivhmxprg26";
+
+  meta = with stdenv.lib; {
+    description = "A foundation for ambitious web user interfaces";
+    longDescription = ''
+      Prototype takes the complexity out of client-side web
+      programming. Built to solve real-world problems, it adds
+      useful extensions to the browser scripting environment
+      and provides elegant APIs around the clumsy interfaces
+      of Ajax and the Document Object Model.
+    '';
+    homepage = http://prototypejs.org/;
+    downloadPage = http://prototypejs.org/download/;
+    license = licenses.mit;
+    maintainers = with maintainers; [ das_j ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/protozero/default.nix b/nixpkgs/pkgs/development/libraries/protozero/default.nix
new file mode 100644
index 000000000000..a18d768c288c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/protozero/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, fetchFromGitHub, cmake }:
+
+stdenv.mkDerivation rec {
+  name = "protozero-${version}";
+  version = "1.6.7";
+
+  src = fetchFromGitHub {
+    owner = "mapbox";
+    repo = "protozero";
+    rev = "v${version}";
+    sha256 = "1ryvn3iwxiaih3mvyy45nbwxnhzfc8vby0xh9m6d6fpakhcpf6s3";
+  };
+
+  nativeBuildInputs = [ cmake ];
+
+  meta = with stdenv.lib; {
+    description = "Minimalistic protocol buffer decoder and encoder in C++";
+    homepage = "https://github.com/mapbox/protozero";
+    license = with licenses; [ bsd2 asl20 ];
+    maintainers = with maintainers; [ das-g ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/psol/default.nix b/nixpkgs/pkgs/development/libraries/psol/default.nix
new file mode 100644
index 000000000000..270c24dc01f4
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/psol/default.nix
@@ -0,0 +1,5 @@
+{ callPackage }:
+callPackage ./generic.nix {} {
+  version = "1.13.35.2"; # Latest stable, 2018-02-05
+  sha256  = "0xi2srf9gx0x2sz9r45zb35k2n0iv457if1lqzvbanls3f935cmr";
+}
diff --git a/nixpkgs/pkgs/development/libraries/psol/generic.nix b/nixpkgs/pkgs/development/libraries/psol/generic.nix
new file mode 100644
index 000000000000..c61926fe13fa
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/psol/generic.nix
@@ -0,0 +1,16 @@
+{ fetchzip, stdenv }:
+{ version, sha256 }:
+{ inherit version; } // fetchzip {
+  inherit sha256;
+  name   = "psol-${version}";
+  url    = "https://dl.google.com/dl/page-speed/psol/${version}-x64.tar.gz";
+
+  meta = {
+    description = "PageSpeed Optimization Libraries";
+    homepage    = "https://developers.google.com/speed/pagespeed/psol";
+    license     = stdenv.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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/psqlodbc/default.nix b/nixpkgs/pkgs/development/libraries/psqlodbc/default.nix
new file mode 100644
index 000000000000..2364e0913bc8
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/psqlodbc/default.nix
@@ -0,0 +1,21 @@
+{ stdenv, fetchurl, libiodbc, postgresql, openssl }:
+
+stdenv.mkDerivation rec {
+  name = "psqlodbc-09.01.0200";
+
+  src = fetchurl {
+    url = "https://ftp.postgresql.org/pub/odbc/versions/src/${name}.tar.gz";
+    sha256 = "0b4w1ahfpp34jpscfk2kv9050lh3xl9pvcysqvaigkcd0vsk1hl9";
+  };
+
+  buildInputs = [ libiodbc postgresql openssl ];
+
+  configureFlags = [ "--with-iodbc=${libiodbc}" ];
+
+  meta = with stdenv.lib; {
+    homepage = http://psqlodbc.projects.postgresql.org/;
+    description = "ODBC driver for PostgreSQL";
+    license = licenses.lgpl2;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/ptex/default.nix b/nixpkgs/pkgs/development/libraries/ptex/default.nix
new file mode 100644
index 000000000000..aa17771ec9f2
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/ptex/default.nix
@@ -0,0 +1,43 @@
+{ stdenv, fetchFromGitHub, zlib, python, cmake }:
+
+stdenv.mkDerivation rec
+{
+  name = "ptex-${version}";
+  version = "2.3.0";
+
+  src = fetchFromGitHub {
+    owner = "wdas";
+    repo = "ptex";
+    rev = "v${version}";
+    sha256 = "0nfz0y66bmi6xckn1whi4sfd8i3ibln212fgm4img2z98b6vccyg";
+  };
+
+  outputs = [ "bin" "dev" "out" "lib" ];
+
+  buildInputs = [ zlib python cmake ];
+
+  enableParallelBuilding = true;
+
+  buildPhase = ''
+      mkdir -p $out
+
+      make prefix=$out
+
+      mkdir -p $bin/bin
+      mkdir -p $dev/include
+      mkdir -p $lib/lib
+      '';
+
+  installPhase = ''
+    make install
+    mv $out/bin $bin/
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Per-Face Texture Mapping for Production Rendering";
+    homepage = "http://ptex.us/";
+    license = licenses.bsd3;
+    platforms = platforms.all;
+    maintainers = [ maintainers.guibou ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/pth/default.nix b/nixpkgs/pkgs/development/libraries/pth/default.nix
new file mode 100644
index 000000000000..c315cb8f72b4
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/pth/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "pth-2.0.7";
+
+  src = fetchurl {
+    url = "mirror://gnu/pth/${name}.tar.gz";
+    sha256 = "0ckjqw5kz5m30srqi87idj7xhpw6bpki43mj07bazjm2qmh3cdbj";
+  };
+
+  preConfigure = stdenv.lib.optionalString stdenv.isAarch32 ''
+    configureFlagsArray=("CFLAGS=-DJB_SP=8 -DJB_PC=9")
+  '';
+
+  meta = with stdenv.lib; {
+    description = "The GNU Portable Threads library";
+    homepage = https://www.gnu.org/software/pth;
+    license = licenses.lgpl21Plus;
+    platforms = platforms.all;
+    broken = stdenv.hostPlatform != stdenv.buildPlatform && stdenv.hostPlatform.isAarch64;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/ptlib/default.nix b/nixpkgs/pkgs/development/libraries/ptlib/default.nix
new file mode 100644
index 000000000000..d1dcc5fdb97a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/ptlib/default.nix
@@ -0,0 +1,54 @@
+{ stdenv, fetchurl, fetchpatch, pkgconfig, bison, flex, unixODBC, gnome3
+, openssl, openldap, cyrus_sasl, kerberos, expat, SDL, libdv, libv4l, alsaLib }:
+
+stdenv.mkDerivation rec {
+  pname = "ptlib";
+  version = "2.10.11";
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    sha256 = "1jf27mjz8vqnclhrhrpn7niz4c177kcjbd1hc7vn65ihcqfz05rs";
+  };
+
+  NIX_CFLAGS_COMPILE = "-std=gnu++98";
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ bison flex unixODBC openssl openldap
+                  cyrus_sasl kerberos expat SDL libdv libv4l alsaLib ];
+
+  enableParallelBuilding = true;
+
+  patches = [
+    (fetchpatch { url = http://sources.debian.net/data/main/p/ptlib/2.10.11~dfsg-2.1/debian/patches/bison-fix;
+      sha256 = "0vzv9kyn9s628z8wy2gva380gi1rmhxilwlg5pikl5a0wn8p46nw";
+    })
+    (fetchpatch { url = http://sources.debian.net/data/main/p/ptlib/2.10.11~dfsg-2.1/debian/patches/no-sslv3;
+      sha256 = "172s1dnnrl54p9sf1nl7s475sm78rpw3p8jxi0pdx6izzl8hcdr0";
+    })
+    ./ptlib-2.10.11-glibc-2.26.patch
+  ];
+
+  # fix typedef clashes with unixODBC>=2.3.5
+  postPatch = ''
+    substituteInPlace include/ptlib/unix/ptlib/contain.h \
+      --replace "typedef uintptr_t    UINT" "typedef unsigned int    UINT" \
+      --replace "typedef wchar_t                 WCHAR" "typedef unsigned short          WCHAR"
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Portable Tools from OPAL VoIP";
+    maintainers = [ maintainers.raskin ];
+    homepage = "http://www.opalvoip.org/";
+    platforms = platforms.linux;
+    license = with licenses; [ beerware bsdOriginal mpl10 ];
+  };
+
+  passthru = {
+    updateInfo = {
+      downloadPage = "http://ftp.gnome.org/sources/ptlib/";
+    };
+    updateScript = gnome3.updateScript {
+      packageName = pname;
+    };
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/ptlib/ptlib-2.10.11-glibc-2.26.patch b/nixpkgs/pkgs/development/libraries/ptlib/ptlib-2.10.11-glibc-2.26.patch
new file mode 100644
index 000000000000..300c3736abf7
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/ptlib/ptlib-2.10.11-glibc-2.26.patch
@@ -0,0 +1,13 @@
+diff --git a/src/ptlib/unix/channel.cxx b/src/ptlib/unix/channel.cxx
+index 3b17dda..2dcaa18 100644
+--- a/src/ptlib/unix/channel.cxx
++++ b/src/ptlib/unix/channel.cxx
+@@ -36,7 +36,7 @@
+ 
+ #include <ptlib.h>
+ #include <sys/ioctl.h>
+-
++#include <sys/uio.h>
+ 
+ #include "../common/pchannel.cxx"
+ 
diff --git a/nixpkgs/pkgs/development/libraries/pugixml/default.nix b/nixpkgs/pkgs/development/libraries/pugixml/default.nix
new file mode 100644
index 000000000000..74c6e8ef1b30
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/pugixml/default.nix
@@ -0,0 +1,38 @@
+{ stdenv, fetchFromGitHub, fetchpatch, cmake, shared ? false }:
+
+stdenv.mkDerivation rec {
+  name = "pugixml-${version}";
+  version = "1.9";
+
+  src = fetchFromGitHub {
+    owner = "zeux";
+    repo = "pugixml";
+    rev = "v${version}";
+    sha256 = "0iraznwm78pyyzc9snvd3dyz8gddvmxsm1b3kpw7wixkvcawdviv";
+  };
+
+  patches = [
+    # To be removed after a version newer than 1.9 is released
+    (fetchpatch {
+      url = "https://github.com/zeux/pugixml/pull/193.patch";
+      sha256 = "0s4anqlr2ppfibxyl29nrqbcprrg89k7il6303dm91s6620ydmka";
+    })
+  ];
+
+  nativeBuildInputs = [ cmake ];
+
+  cmakeFlags = [ "-DBUILD_SHARED_LIBS=${if shared then "ON" else "OFF"}" ];
+
+  preConfigure = ''
+    # Enable long long support (required for filezilla)
+    sed -ire '/PUGIXML_HAS_LONG_LONG/ s/^\/\///' src/pugiconfig.hpp
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Light-weight, simple and fast XML parser for C++ with XPath support";
+    homepage = https://pugixml.org;
+    license = licenses.mit;
+    maintainers = with maintainers; [ pSub ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/pupnp/default.nix b/nixpkgs/pkgs/development/libraries/pupnp/default.nix
new file mode 100644
index 000000000000..b5a01698e5e9
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/pupnp/default.nix
@@ -0,0 +1,34 @@
+{ fetchFromGitHub, stdenv, autoreconfHook }:
+
+stdenv.mkDerivation rec {
+  name = "libupnp-${version}";
+  version = "1.8.4";
+
+  src = fetchFromGitHub {
+    owner = "mrjimenez";
+    repo = "pupnp";
+    rev = "release-${version}";
+    sha256 = "1daml02z4rs9cxls95p2v24jvwcsp43a0gqv06s84ay5yn6r47wx";
+  };
+  outputs = [ "dev" "out" ];
+
+  nativeBuildInputs = [ autoreconfHook ];
+
+  hardeningDisable = [ "fortify" ];
+
+  meta = {
+    description = "libupnp, an open source UPnP development kit for Linux";
+
+    longDescription = ''
+      The Linux SDK for UPnP Devices (libupnp) provides developers
+      with an API and open source code for building control points,
+      devices, and bridges that are compliant with Version 1.0 of the
+      UPnP Device Architecture Specification.
+    '';
+
+    license = "BSD-style";
+
+    homepage = http://pupnp.sourceforge.net/;
+    platforms = stdenv.lib.platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/pybind11/default.nix b/nixpkgs/pkgs/development/libraries/pybind11/default.nix
new file mode 100644
index 000000000000..aa1f8d10ba97
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/pybind11/default.nix
@@ -0,0 +1,47 @@
+{ stdenv, fetchurl, fetchFromGitHub, cmake, catch, python, eigen }:
+
+stdenv.mkDerivation rec {
+  name = "pybind-${version}";
+  version = "2.2.4";
+
+  src = fetchFromGitHub {
+    owner = "pybind";
+    repo = "pybind11";
+    rev = "v${version}";
+    sha256 = "0pa79ymcasv8br5ifbx7878id5py2jpjac3i20cqxr6gs9l6ivlv";
+  };
+
+  nativeBuildInputs = [ cmake ];
+  checkInputs = with python.pkgs; [ catch eigen pytest numpy scipy ];
+
+  # Disable test_cmake_build test, as it fails in sandbox
+  # https://github.com/pybind/pybind11/issues/1355
+  patches = [
+    ./no_test_cmake_build.patch
+    (fetchurl { # Remove on bump to v2.2.5
+      name = "pytest_namespace_to_configure.patch";
+      url = "https://github.com/pybind/pybind11/commit/e7ef34f23f194cfa40bdbf967c6d34712261a4ee.patch";
+      sha256 = "1dhv6p0b5fxzxc8j3sfy8kvfmdshczk22xfxh6bk0cfnfdy9iqrq";
+    })
+  ];
+
+  doCheck = true;
+
+  cmakeFlags = [ 
+    "-DPYTHON_EXECUTABLE=${python.interpreter}" 
+    "-DPYBIND11_TEST=${if doCheck then "ON" else "OFF"}"
+  ];
+
+  meta = {
+    homepage = https://github.com/pybind/pybind11;
+    description = "Seamless operability between C++11 and Python";
+    longDescription = ''
+      Pybind11 is a lightweight header-only library that exposes
+      C++ types in Python and vice versa, mainly to create Python
+      bindings of existing C++ code.
+    '';
+    platforms = with stdenv.lib.platforms; unix;
+    license = stdenv.lib.licenses.bsd3;
+    maintainers = with stdenv.lib.maintainers; [ yuriaisaka ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/pybind11/no_test_cmake_build.patch b/nixpkgs/pkgs/development/libraries/pybind11/no_test_cmake_build.patch
new file mode 100644
index 000000000000..c5d6ecc4481e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/pybind11/no_test_cmake_build.patch
@@ -0,0 +1,7 @@
+--- a/tests/CMakeLists.txt	2019-01-28 14:13:55.822119328 +0100
++++ b/tests/CMakeLists.txt	2019-01-28 14:14:06.741161928 +0100
+@@ -233,4 +233,3 @@
+ add_subdirectory(test_embed)
+ 
+ # Test CMake build using functions and targets from subdirectory or installed location
+-add_subdirectory(test_cmake_build)
diff --git a/nixpkgs/pkgs/development/libraries/pyotherside/default.nix b/nixpkgs/pkgs/development/libraries/pyotherside/default.nix
new file mode 100644
index 000000000000..c7d43ae70268
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/pyotherside/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchFromGitHub
+, python3, qmake, qtbase, qtquickcontrols, qtsvg, ncurses }:
+
+stdenv.mkDerivation rec {
+  pname = "pyotherside";
+  version = "1.5.6";
+
+  src = fetchFromGitHub {
+    owner = "thp";
+    repo = "pyotherside";
+    rev = version;
+    sha256 = "1cjx0fbrq9qvbirwy76pw1f5skm2afd51k4qb269ql4gpl67d5lv";
+  };
+
+  nativeBuildInputs = [ qmake ];
+  buildInputs = [
+    python3 qtbase qtquickcontrols qtsvg ncurses
+  ];
+
+  patches = [ ./qml-path.patch ];
+  installTargets = [ "sub-src-install_subtargets" ];
+
+  meta = with stdenv.lib; {
+    description = "Asynchronous Python 3 Bindings for Qt 5";
+    homepage = https://thp.io/2011/pyotherside/;
+    license = licenses.isc;
+    maintainers = [ maintainers.mic92 ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/pyotherside/qml-path.patch b/nixpkgs/pkgs/development/libraries/pyotherside/qml-path.patch
new file mode 100644
index 000000000000..9f7208909970
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/pyotherside/qml-path.patch
@@ -0,0 +1,12 @@
+diff -Naur --strip-trailing-cr source.org/src/src.pro source/src/src.pro
+--- source.org/src/src.pro	1970-01-01 01:00:01.000000000 +0100
++++ source/src/src.pro	2019-01-17 19:14:46.256821852 +0000
+@@ -10,7 +10,7 @@
+ CONFIG += qt plugin
+ QT += qml quick svg
+ 
+-target.path = $$[QT_INSTALL_QML]/$$PLUGIN_IMPORT_PATH
++target.path = $$NIX_OUTPUT_QML/$$PLUGIN_IMPORT_PATH
+ INSTALLS += target
+ 
+ qmldir.files += $$_PRO_FILE_PWD_/qmldir $$_PRO_FILE_PWD_/pyotherside.qmltypes
diff --git a/nixpkgs/pkgs/development/libraries/python-qt/default.nix b/nixpkgs/pkgs/development/libraries/python-qt/default.nix
new file mode 100644
index 000000000000..4b5b7ace074b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/python-qt/default.nix
@@ -0,0 +1,42 @@
+{ stdenv, fetchurl, python, qmake,
+  qtwebengine, qtxmlpatterns,
+  qttools, unzip }:
+
+stdenv.mkDerivation rec {
+  version = "3.2";
+  name = "python-qt-${version}";
+
+  src = fetchurl {
+    url="mirror://sourceforge/pythonqt/PythonQt${version}.zip";
+    sha256="13hzprk58m3yj39sj0xn6acg8796lll1256mpd81kw0z3yykyl8c";
+  };
+
+  hardeningDisable = [ "all" ];
+
+  nativeBuildInputs = [ qmake qtwebengine  qtxmlpatterns qttools ];
+
+  buildInputs = [ python unzip ];
+
+  qmakeFlags = [ "PythonQt.pro"
+                 "INCLUDEPATH+=${python}/include/python3.6"
+                 "PYTHON_PATH=${python}/bin"
+                 "PYTHON_LIB=${python}/lib"];
+
+  unpackCmd = "unzip $src";
+
+  installPhase = ''
+    mkdir -p $out/include/PythonQt
+    cp -r ./lib $out
+    cp -r ./src/* $out/include/PythonQt
+    cp -r ./build $out/include/PythonQt
+    cp -r ./extensions $out/include/PythonQt
+  '';
+
+  meta = with stdenv.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;
+    platforms = platforms.all;
+    maintainers = with maintainers; [ hlolli ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/qca-qt5/default.nix b/nixpkgs/pkgs/development/libraries/qca-qt5/default.nix
new file mode 100644
index 000000000000..79b105a2d1c8
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qca-qt5/default.nix
@@ -0,0 +1,32 @@
+{ stdenv, fetchurl, cmake, openssl, pkgconfig, qtbase }:
+
+stdenv.mkDerivation rec {
+  pname = "qca-qt5";
+  version = "2.2.1";
+
+  src = fetchurl {
+    url = "http://download.kde.org/stable/qca/${version}/qca-${version}.tar.xz";
+    sha256 = "00kv1vsrc8fp556hm8s6yw3240vx3l4067q6vfxrb3gdwgcd45np";
+  };
+
+  buildInputs = [ openssl qtbase ];
+  nativeBuildInputs = [ cmake pkgconfig ];
+
+  # 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 ;
+
+  # tells CMake to use this CA bundle file if it is accessible
+  preConfigure = ''export QC_CERTSTORE_PATH=/etc/ssl/certs/ca-certificates.crt'';
+
+  # 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; {
+    description = "Qt 5 Cryptographic Architecture";
+    homepage = http://delta.affinix.com/qca;
+    maintainers = with maintainers; [ ttuegel ];
+    license = licenses.lgpl21Plus;
+    platforms = with platforms; unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/qca-qt5/move-project.patch b/nixpkgs/pkgs/development/libraries/qca-qt5/move-project.patch
new file mode 100644
index 000000000000..dcecb83d7db9
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qca-qt5/move-project.patch
@@ -0,0 +1,17 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 2f2b5d0..971dee3 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -6,10 +6,11 @@ if(NOT CMAKE_INSTALL_PREFIX)
+   unset(CMAKE_INSTALL_PREFIX CACHE)
+ endif(NOT CMAKE_INSTALL_PREFIX)
+ 
+-project(qca)
+ 
+ cmake_minimum_required(VERSION 3.4)
+ 
++project(qca)
++
+ set(QCA_LIB_MAJOR_VERSION "2")
+ set(QCA_LIB_MINOR_VERSION "2")
+ set(QCA_LIB_PATCH_VERSION "1")
diff --git a/nixpkgs/pkgs/development/libraries/qca2/default.nix b/nixpkgs/pkgs/development/libraries/qca2/default.nix
new file mode 100644
index 000000000000..ec32c44a91fc
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qca2/default.nix
@@ -0,0 +1,37 @@
+{ stdenv, fetchurl, cmake, pkgconfig, qt, darwin }:
+
+stdenv.mkDerivation rec {
+  name = "qca-${version}";
+  version = "2.1.3";
+
+  src = fetchurl {
+    url = "http://download.kde.org/stable/qca/${version}/src/qca-${version}.tar.xz";
+    sha256 = "0lz3n652z208daxypdcxiybl0a9fnn6ida0q7fh5f42269mdhgq0";
+  };
+
+  nativeBuildInputs = [ cmake pkgconfig ];
+  buildInputs = [ qt ]
+    ++ stdenv.lib.optional stdenv.isDarwin darwin.apple_sdk.frameworks.Security;
+
+  enableParallelBuilding = true;
+
+  # tells CMake to use this CA bundle file if it is accessible
+  preConfigure = ''
+    export QC_CERTSTORE_PATH=/etc/ssl/certs/ca-certificates.crt
+  '';
+
+  # 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" ];
+
+  postPatch = ''
+    sed -i -e '1i cmake_policy(SET CMP0025 NEW)' CMakeLists.txt
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Qt Cryptographic Architecture";
+    license = "LGPL";
+    homepage = http://delta.affinix.com/qca;
+    maintainers = [ maintainers.sander ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/qca2/libressl.patch b/nixpkgs/pkgs/development/libraries/qca2/libressl.patch
new file mode 100644
index 000000000000..c9b0267f85d8
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qca2/libressl.patch
@@ -0,0 +1,28 @@
+--- a/plugins/qca-ossl/qca-ossl.cpp	2015-12-02 09:34:25.810682094 +0000
++++ b/plugins/qca-ossl/qca-ossl.cpp	2015-12-02 09:29:51.720392423 +0000
+@@ -5403,11 +5403,13 @@
+ 			ctx = SSL_CTX_new(SSLv2_client_method());
+ 			break;
+ #endif
++#ifndef OPENSSL_NO_SSL3
+ 		case TLS::SSL_v3:
+ 			ctx = SSL_CTX_new(SSLv3_client_method());
+ 			break;
++#endif
+ 		case TLS::TLS_v1:
++			ctx = SSL_CTX_new(SSLv23_client_method());
+-			ctx = SSL_CTX_new(TLSv1_client_method());
+ 			break;
+ 		case TLS::DTLS_v1:
+ 		default:
+@@ -7133,8 +7135,10 @@
+ 			return new opensslInfoContext(this);
+ 		else if ( type == "sha1" )
+ 			return new opensslHashContext( EVP_sha1(), this, type);
++#ifndef OPENSSL_NO_SHA0
+ 		else if ( type == "sha0" )
+ 			return new opensslHashContext( EVP_sha(), this, type);
++#endif
+ 		else if ( type == "ripemd160" )
+ 			return new opensslHashContext( EVP_ripemd160(), this, type);
+ #ifdef HAVE_OPENSSL_MD2
diff --git a/nixpkgs/pkgs/development/libraries/qgnomeplatform/default.nix b/nixpkgs/pkgs/development/libraries/qgnomeplatform/default.nix
new file mode 100644
index 000000000000..1fb3a415dc6c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qgnomeplatform/default.nix
@@ -0,0 +1,37 @@
+{ stdenv, fetchFromGitHub, pkgconfig, gtk3, qtbase, qmake }:
+
+stdenv.mkDerivation rec {
+  name = "qgnomeplatform-${version}";
+  version = "0.5";
+
+  src = fetchFromGitHub {
+    owner = "FedoraQt";
+    repo = "QGnomePlatform";
+    rev = version;
+    sha256 = "01ncj21cxd5p7pch6p3zbhv5wp0dgn9vy5hrw54g49fmqnbb1ymz";
+  };
+
+  nativeBuildInputs = [
+    pkgconfig
+    qmake
+  ];
+
+  buildInputs = [
+    gtk3
+    qtbase
+  ];
+
+  postPatch = ''
+    # Fix plugin dir
+    substituteInPlace qgnomeplatform.pro \
+      --replace "\$\$[QT_INSTALL_PLUGINS]" "$out/$qtPluginPrefix"
+  '';
+
+  meta = with stdenv.lib; {
+    description = "QPlatformTheme for a better Qt application inclusion in GNOME";
+    homepage = https://github.com/FedoraQt/QGnomePlatform;
+    license = licenses.lgpl21Plus;
+    maintainers = with maintainers; [ worldofpeace ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/qhull/default.nix b/nixpkgs/pkgs/development/libraries/qhull/default.nix
new file mode 100644
index 000000000000..596dc543e335
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qhull/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, fetchFromGitHub, cmake }:
+
+stdenv.mkDerivation rec {
+  name = "qhull-2016.1";
+
+  src = fetchFromGitHub {
+    owner = "qhull";
+    repo = "qhull";
+    rev = "5bbc75608c817b50383a0c24c3977cc09d0bbfde";
+    sha256 = "0wrgqc2mih7h8fs9v5jcn9dr56afqi9bgh2w9dcvzvzvxizr9kjj";
+  };
+
+  nativeBuildInputs = [ cmake ];
+
+  meta = with stdenv.lib; {
+    homepage = http://www.qhull.org/;
+    description = "Compute the convex hull, Delaunay triangulation, Voronoi diagram and more";
+    license = licenses.free;
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ orivej ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/qimageblitz/default.nix b/nixpkgs/pkgs/development/libraries/qimageblitz/default.nix
new file mode 100644
index 000000000000..51253676341f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qimageblitz/default.nix
@@ -0,0 +1,26 @@
+{stdenv, fetchurl, cmake, qt4}:
+
+let
+  pn = "qimageblitz";
+  v = "0.0.4";
+in
+
+stdenv.mkDerivation {
+  name = "${pn}-${v}";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/${pn}/${pn}-${v}.tar.bz2";
+    sha256 = "0pnaf3qi7rgkxzs2mssmslb3f9ya4cyx09wzwlis3ppyvf72j0p9";
+  };
+
+  buildInputs = [ cmake qt4 ];
+
+  patches = [ ./qimageblitz-9999-exec-stack.patch ];
+
+  meta = {
+    description = "Graphical effect and filter library for KDE4";
+    license = stdenv.lib.licenses.bsd2;
+    homepage = "http://${pn}.sourceforge.net";
+    platforms = stdenv.lib.platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/qimageblitz/qimageblitz-9999-exec-stack.patch b/nixpkgs/pkgs/development/libraries/qimageblitz/qimageblitz-9999-exec-stack.patch
new file mode 100644
index 000000000000..8692c240f7bb
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qimageblitz/qimageblitz-9999-exec-stack.patch
@@ -0,0 +1,11 @@
+diff -uar qimageblitz/blitz/asm_scale.S qimageblitz~/blitz/asm_scale.S
+--- qimageblitz-orig/blitz/asm_scale.S	2007-10-17 01:17:57.000000000 +0200
++++ qimageblitz/blitz/asm_scale.S	2007-10-17 01:19:12.000000000 +0200
+@@ -814,3 +814,7 @@
+ SIZE(qimageScale_mmx_AARGBA)
+ 
+ #endif
++#if defined(__linux__) && defined(__ELF__)
++.section .note.GNU-stack,"",%progbits
++#endif
++
diff --git a/nixpkgs/pkgs/development/libraries/qjson/default.nix b/nixpkgs/pkgs/development/libraries/qjson/default.nix
new file mode 100644
index 000000000000..a7077c69dd8d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qjson/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, fetchFromGitHub, cmake, qt4 }:
+
+stdenv.mkDerivation rec {
+  version = "0.9.0";
+  name = "qjson-${version}";
+
+  src = fetchFromGitHub {
+    owner = "flavio";
+    repo = "qjson";
+    rev = "${version}";
+    sha256 = "1f4wnxzx0qdmxzc7hqk28m0sva7z9p9xmxm6aifvjlp0ha6pmfxs";
+  };
+
+  buildInputs = [ cmake qt4 ];
+
+  meta = with stdenv.lib; {
+    description = "Lightweight data-interchange format";
+    homepage = http://qjson.sourceforge.net/;
+    license = licenses.lgpl21;
+    inherit (qt4.meta) platforms;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/qmlbox2d/default.nix b/nixpkgs/pkgs/development/libraries/qmlbox2d/default.nix
new file mode 100644
index 000000000000..083e0a51b813
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qmlbox2d/default.nix
@@ -0,0 +1,31 @@
+{stdenv, qtdeclarative, fetchFromGitHub, qmake }:
+stdenv.mkDerivation rec {
+  name = "qml-box2d-2018-04-06";
+  src = fetchFromGitHub {
+    owner = "qml-box2d";
+    repo = "qml-box2d";
+    sha256 = "0gb8limy6ck23z3k0k2j7c4c4s95p40f6lbzk4szq7fjnnw22kb7";
+    rev = "b7212d5640701f93f0cd88fbd3a32c619030ae62";
+  };
+
+  enableParallelBuilding = true;
+  nativeBuildInputs = [ qmake ];
+
+  buildInputs = [ qtdeclarative ];
+
+  patchPhase = ''
+    substituteInPlace box2d.pro \
+      --replace '$$[QT_INSTALL_QML]' "/$qtQmlPrefix/"
+    qmakeFlags="$qmakeFlags PREFIXSHORTCUT=$out"
+    '';
+
+  installFlags = [ "INSTALL_ROOT=$(out)" ];
+
+  meta = with stdenv.lib; {
+    description = "A QML plugin for Box2D engine";
+    homepage = "https://github.com/qml-box2d/qml-box2d";
+    maintainers = [ maintainers.guibou ];
+    platforms = platforms.linux;
+    license = licenses.zlib;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/qmltermwidget/default.nix b/nixpkgs/pkgs/development/libraries/qmltermwidget/default.nix
new file mode 100644
index 000000000000..ba62324d586e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qmltermwidget/default.nix
@@ -0,0 +1,34 @@
+{ stdenv, fetchFromGitHub, qtbase, qtquick1, qmake, qtmultimedia, utmp }:
+
+stdenv.mkDerivation rec {
+  version = "2018-11-24";
+  name = "qmltermwidget-unstable-${version}";
+
+  src = fetchFromGitHub {
+    repo = "qmltermwidget";
+    owner = "Swordfish90";
+    rev = "48274c75660e28d44af7c195e79accdf1bd44963";
+    sha256 = "028nb1xp84jmakif5mmzx52q3rsjwckw27jdpahyaqw7j7i5znq6";
+  };
+
+  buildInputs = [ qtbase qtquick1 qtmultimedia ]
+                ++ stdenv.lib.optional stdenv.isDarwin utmp;
+  nativeBuildInputs = [ qmake ];
+
+  patchPhase = ''
+    substituteInPlace qmltermwidget.pro \
+      --replace '$$[QT_INSTALL_QML]' "/$qtQmlPrefix/"
+  '';
+
+  installFlags = [ "INSTALL_ROOT=$(out)" ];
+
+  enableParallelBuilding = true;
+
+  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 ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/qoauth/default.nix b/nixpkgs/pkgs/development/libraries/qoauth/default.nix
new file mode 100644
index 000000000000..0d9ae21e87e3
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qoauth/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchurl, qt5, qca2-qt5 }:
+
+stdenv.mkDerivation {
+  name = "qoauth-2.0.0";
+
+  src = fetchurl {
+    url = https://github.com/ayoy/qoauth/archive/v2.0.0.tar.gz;
+    name = "qoauth-2.0.0.tar.gz";
+    sha256 = "a28005986410d333e03d077679cdf6c504ec5a33342867dc0f9fb0b74285e333";
+  };
+
+  postPatch = ''
+    sed -i src/src.pro \
+        -e 's/lib64/lib/g' \
+        -e '/features.path =/ s|$$\[QMAKE_MKSPECS\]|$$NIX_OUTPUT_DEV/mkspecs|'
+  '';
+
+  buildInputs = [ qt5.qtbase qca2-qt5 ];
+  nativeBuildInputs = [ qt5.qmake ];
+
+  NIX_CFLAGS_COMPILE = [ "-I${qca2-qt5}/include/Qca-qt5/QtCrypto" ];
+  NIX_LDFLAGS = [ "-lqca-qt5" ];
+
+  meta = with stdenv.lib; {
+    description = "Qt library for OAuth authentication";
+    inherit (qt5.qtbase.meta) platforms;
+    license = licenses.lgpl21;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/qpdf/default.nix b/nixpkgs/pkgs/development/libraries/qpdf/default.nix
new file mode 100644
index 000000000000..dceda3c04bd4
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qpdf/default.nix
@@ -0,0 +1,35 @@
+{ stdenv, fetchurl, fetchpatch, libjpeg, zlib, perl }:
+
+let version = "8.4.2";
+in
+stdenv.mkDerivation rec {
+  name = "qpdf-${version}";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/qpdf/qpdf/${version}/${name}.tar.gz";
+    sha256 = "1hrys6zmia8fw6f6ih3ckgsc1jr12fizdwaiy7dyd64kxxjhm8v9";
+  };
+
+  nativeBuildInputs = [ perl ];
+
+  buildInputs = [ zlib libjpeg ];
+
+  postPatch = ''
+    patchShebangs qpdf/fix-qdf
+  '';
+
+  preCheck = ''
+    patchShebangs qtest/bin/qtest-driver
+  '';
+
+  doCheck = true;
+  enableParallelBuilding = true;
+
+  meta = with stdenv.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
+    maintainers = with maintainers; [ abbradar ];
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/qrencode/default.nix b/nixpkgs/pkgs/development/libraries/qrencode/default.nix
new file mode 100644
index 000000000000..9e8d9ce239bf
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qrencode/default.nix
@@ -0,0 +1,47 @@
+{ stdenv, fetchurl, pkgconfig, SDL2, libpng, libiconv }:
+
+stdenv.mkDerivation rec {
+  pname = "qrencode";
+  version = "4.0.2";
+
+  outputs = [ "bin" "out" "man" "dev" ];
+
+  src = fetchurl {
+    url = "https://fukuchi.org/works/qrencode/qrencode-${version}.tar.gz";
+    sha256 = "079v3a15ydpr67zdi3xbgvic8n2kxvi0m32dyz8jaik10yffgayv";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ SDL2 libpng ] ++ stdenv.lib.optionals stdenv.isDarwin [ libiconv ];
+
+  configureFlags = [
+    "--with-tests"
+  ];
+
+  doCheck = true;
+
+  checkPhase = ''
+    runHook preCheck
+
+    pushd tests
+    ./test_basic.sh
+    popd
+
+    runHook postCheck
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = https://fukuchi.org/works/qrencode/;
+    description = "C library for encoding data in a QR Code symbol";
+
+    longDescription = ''
+      Libqrencode is a C library for encoding data in a QR Code symbol,
+      a kind of 2D symbology that can be scanned by handy terminals
+      such as a mobile phone with CCD.
+    '';
+
+    license = licenses.lgpl21Plus;
+    maintainers = with maintainers; [ adolfogc yegortimoshenko ];
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/qrupdate/default.nix b/nixpkgs/pkgs/development/libraries/qrupdate/default.nix
new file mode 100644
index 000000000000..85e45d3fad03
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qrupdate/default.nix
@@ -0,0 +1,43 @@
+{ stdenv
+, fetchurl
+, gfortran
+, openblas
+}:
+stdenv.mkDerivation {
+  name = "qrupdate-1.1.2";
+  src = fetchurl {
+    url = mirror://sourceforge/qrupdate/qrupdate-1.1.2.tar.gz ;
+    sha256 = "024f601685phcm1pg8lhif3lpy5j9j0k6n0r46743g4fvh8wg8g2";
+  };
+
+  configurePhase =
+    ''
+      export PREFIX=$out
+      sed -i -e 's,^BLAS=.*,BLAS=-L${openblas}/lib -lopenblas,' \
+          -e 's,^LAPACK=.*,LAPACK=-L${openblas}/lib -lopenblas,' \
+          Makeconf
+    ''
+    + stdenv.lib.optionalString openblas.blas64
+    ''
+      sed -i Makeconf -e '/^FFLAGS=.*/ s/$/-fdefault-integer-8/'
+    '';
+
+  doCheck = true;
+
+  checkTarget = "test";
+
+  buildFlags = [ "lib" "solib" ];
+
+  installTargets = if stdenv.isDarwin
+                   then ["install-staticlib" "install-shlib"]
+                   else "install";
+
+  buildInputs = [ gfortran openblas ];
+
+  meta = with stdenv.lib; {
+    description = "Library for fast updating of qr and cholesky decompositions";
+    homepage = https://sourceforge.net/projects/qrupdate/;
+    license = licenses.gpl3;
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/qscintilla/default.nix b/nixpkgs/pkgs/development/libraries/qscintilla/default.nix
new file mode 100644
index 000000000000..43f0e431bb15
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qscintilla/default.nix
@@ -0,0 +1,72 @@
+{ stdenv, lib, fetchurl, unzip
+, qt4 ? null, qmake4Hook ? null
+, withQt5 ? false, qtbase ? null, qtmacextras ? null, qmake ? null
+, fixDarwinDylibNames
+}:
+
+# Fix Xcode 8 compilation problem
+let xcodePatch =
+  fetchurl { url = "https://raw.githubusercontent.com/Homebrew/formula-patches/a651d71/qscintilla2/xcode-8.patch";
+             sha256 = "1a88309fdfd421f4458550b710a562c622d72d6e6fdd697107e4a43161d69bc9"; };
+in
+stdenv.mkDerivation rec {
+  pname = "qscintilla";
+  version = "2.9.4";
+
+  name = "${pname}-${if withQt5 then "qt5" else "qt4"}-${version}";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/pyqt/QScintilla2/QScintilla-${version}/QScintilla_gpl-${version}.zip";
+    sha256 = "04678skipydx68zf52vznsfmll2v9aahr66g50lcqbr6xsmgr1yi";
+  };
+
+  buildInputs = [ (if withQt5 then qtbase else qt4) ];
+
+  propagatedBuildInputs = lib.optional (withQt5 && stdenv.isDarwin) qtmacextras;
+
+  nativeBuildInputs = [ unzip ]
+    ++ (if withQt5 then [ qmake ] else [ qmake4Hook ])
+    ++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
+
+
+  patches = lib.optional (stdenv.isDarwin && withQt5) [ xcodePatch ];
+
+  enableParallelBuilding = true;
+
+  preConfigure = ''
+    cd Qt4Qt5
+    sed -i qscintilla.pro \
+      -e "s,\$\$\\[QT_INSTALL_LIBS\\],$out/lib," \
+      -e "s,\$\$\\[QT_INSTALL_HEADERS\\],$out/include/," \
+      -e "s,\$\$\\[QT_INSTALL_TRANSLATIONS\\],$out/translations," \
+    ${if withQt5 then ''
+      -e "s,\$\$\\[QT_HOST_DATA\\]/mkspecs,$out/mkspecs," \
+      -e "s,\$\$\\[QT_INSTALL_DATA\\]/mkspecs,$out/mkspecs," \
+      -e "s,\$\$\\[QT_INSTALL_DATA\\],$out/share,"
+    '' else ''
+      -e "s,\$\$\\[QT_INSTALL_DATA\\],$out/share/qt,"
+    ''}
+  '';
+
+  meta = with stdenv.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
+      control.
+
+      As well as features found in standard text editing components,
+      QScintilla includes features especially useful when editing and
+      debugging source code. These include support for syntax styling,
+      error indicators, code completion and call tips. The selection
+      margin can contain markers like those used in debuggers to
+      indicate breakpoints and the current line. Styling choices are
+      more open than with many editors, allowing the use of
+      proportional fonts, bold and italics, multiple foreground and
+      background colours and multiple fonts.
+    '';
+    homepage = http://www.riverbankcomputing.com/software/qscintilla/intro;
+    license = with licenses; [ gpl2 gpl3 ]; # and commercial
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ peterhoeg ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/qt-3/builder.sh b/nixpkgs/pkgs/development/libraries/qt-3/builder.sh
new file mode 100644
index 000000000000..460ae17766af
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-3/builder.sh
@@ -0,0 +1,38 @@
+source $stdenv/setup
+
+
+preConfigure() {
+
+    # Patch some of the configure files a bit to get of global paths.
+    # (Buildings using stuff in those paths will fail anyway, but it
+    # will cause ./configure misdetections).
+    for i in config.tests/unix/checkavail config.tests/*/*.test mkspecs/*/qmake.conf; do
+        echo "patching $i..."
+        substituteInPlace "$i" \
+            --replace " /lib" " /FOO" \
+            --replace "/usr" "/FOO"
+    done
+}
+
+
+# !!! TODO: -system-libmng
+configureFlags="-prefix $out $configureFlags"
+dontAddPrefix=1
+
+configureScript=configureScript
+configureScript() {
+    echo yes | ./configure $configureFlags
+    export LD_LIBRARY_PATH=$(pwd)/lib
+}
+
+
+postInstall() {
+    # Qt's `make install' is broken; it copies ./bin/qmake, which
+    # is a symlink to ./qmake/qmake.  So we end up with a dangling
+    # symlink.
+    rm $out/bin/qmake
+    cp -p qmake/qmake $out/bin
+}
+
+
+genericBuild
diff --git a/nixpkgs/pkgs/development/libraries/qt-3/default.nix b/nixpkgs/pkgs/development/libraries/qt-3/default.nix
new file mode 100644
index 000000000000..dc05251478c9
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-3/default.nix
@@ -0,0 +1,91 @@
+{ stdenv, fetchurl
+, xftSupport ? true, libXft ? null
+, xrenderSupport ? true, libXrender ? null
+, xrandrSupport ? true, libXrandr ? null
+, xineramaSupport ? true, libXinerama ? null
+, cursorSupport ? true, libXcursor ? null
+, threadSupport ? true
+, mysqlSupport ? false, mysql ? null
+, libGLSupported
+, openglSupport ? libGLSupported, libGLU_combined ? null, libXmu ? null
+, xlibsWrapper, xorgproto, zlib, libjpeg, libpng, which
+}:
+
+assert xftSupport -> libXft != null;
+assert xrenderSupport -> xftSupport && libXrender != null;
+assert xrandrSupport -> libXrandr != null;
+assert cursorSupport -> libXcursor != null;
+assert mysqlSupport -> mysql != null;
+assert openglSupport -> libGLU_combined != null && libXmu != null;
+
+stdenv.mkDerivation {
+  name = "qt-3.3.8";
+
+  builder = ./builder.sh;
+
+  setupHook = ./setup-hook.sh;
+
+  src = fetchurl {
+    url = http://download.qt.io/archive/qt/3/qt-x11-free-3.3.8.tar.bz2;
+    sha256 = "0jd4g3bwkgk2s4flbmgisyihm7cam964gzb3pawjlkhas01zghz8";
+  };
+
+  nativeBuildInputs = [ which ];
+  propagatedBuildInputs = [libpng xlibsWrapper libXft libXrender zlib libjpeg];
+
+  hardeningDisable = [ "format" ];
+
+  configureFlags = let
+    mk = cond: name: "-${stdenv.lib.optionalString (!cond) "no-"}${name}";
+  in [
+    "-v"
+    "-system-zlib" "-system-libpng" "-system-libjpeg"
+    "-qt-gif"
+    "-I${xorgproto}/include"
+    (mk threadSupport "thread")
+    (mk xrenderSupport "xrender")
+    (mk xrandrSupport "xrandr")
+    (mk xineramaSupport "xinerama")
+    (mk xrandrSupport "xrandr")
+    (mk xftSupport "xft")
+  ] ++ stdenv.lib.optionals openglSupport [
+    "-dlopen-opengl"
+    "-L${libGLU_combined}/lib" "-I${libGLU_combined}/include"
+    "-L${libXmu.out}/lib" "-I${libXmu.dev}/include"
+  ] ++ stdenv.lib.optionals xrenderSupport [
+    "-L${libXrender.out}/lib" "-I${libXrender.dev}/include"
+  ] ++ stdenv.lib.optionals xrandrSupport [
+    "-L${libXrandr.out}/lib" "-I${libXrandr.dev}/include"
+  ] ++ stdenv.lib.optionals xineramaSupport [
+    "-L${libXinerama.out}/lib" "-I${libXinerama.dev}/include"
+  ] ++ stdenv.lib.optionals cursorSupport [
+    "-L${libXcursor.out}/lib -I${libXcursor.dev}/include"
+  ] ++ stdenv.lib.optionals mysqlSupport [
+    "-qt-sql-mysql" "-L${mysql.connector-c}/lib/mysql" "-I${mysql.connector-c}/include/mysql"
+  ] ++ stdenv.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"
+  ];
+
+  patches = [
+    # Don't strip everything so we can get useful backtraces.
+    ./strip.patch
+
+    # Build on NixOS.
+    ./qt-pwd.patch
+
+    # randr.h and Xrandr.h need not be in the same prefix.
+    ./xrandr.patch
+
+    # Make it build with gcc 4.6.0
+    ./qt3-gcc4.6.0.patch
+  ];
+
+  passthru = {inherit mysqlSupport;};
+
+  meta = with stdenv.lib; {
+    license = with licenses; [ gpl2 qpl ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/qt-3/qt-pwd.patch b/nixpkgs/pkgs/development/libraries/qt-3/qt-pwd.patch
new file mode 100644
index 000000000000..763f785726b7
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-3/qt-pwd.patch
@@ -0,0 +1,15 @@
+diff -ruN qt-x11-free-3.3.3/configure qt-x11-free-3.3.3.new/configure
+--- qt-x11-free-3.3.3/configure	2004-06-14 11:18:55.000000000 +0200
++++ qt-x11-free-3.3.3.new/configure	2005-11-12 19:39:43.000000000 +0100
+@@ -16,9 +16,9 @@
+ relconf=`basename $0`
+ # the directory of this script is the "source tree"
+ relpath=`dirname $0`
+-relpath=`(cd $relpath; /bin/pwd)`
++relpath=`(cd $relpath; pwd)`
+ # the current directory is the "build tree" or "object tree"
+-outpath=`/bin/pwd`
++outpath=`pwd`
+ 
+ # later cache the command line in config.status
+ OPT_CMDLINE=`echo $@ | sed "s,-v ,,g; s,-v$,,g"`
diff --git a/nixpkgs/pkgs/development/libraries/qt-3/qt3-gcc4.6.0.patch b/nixpkgs/pkgs/development/libraries/qt-3/qt3-gcc4.6.0.patch
new file mode 100644
index 000000000000..c1a903c130c7
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-3/qt3-gcc4.6.0.patch
@@ -0,0 +1,23 @@
+I picked it here:
+https://bugs.archlinux.org/task/23915
+
+--- qt-x11-free-3.3.8b/src/tools/qmap.h~	2008-01-15 19:09:13.000000000 +0000
++++ qt-x11-free-3.3.8b/src/tools/qmap.h	2011-04-11 00:16:04.000000000 +0100
+@@ -50,6 +50,7 @@
+ #endif // QT_H
+ 
+ #ifndef QT_NO_STL
++#include <cstddef>
+ #include <iterator>
+ #include <map>
+ #endif
+--- qt-x11-free-3.3.8b/src/tools/qvaluelist.h~	2008-01-15 19:09:13.000000000 +0000
++++ qt-x11-free-3.3.8b/src/tools/qvaluelist.h	2011-04-11 00:16:49.000000000 +0100
+@@ -48,6 +48,7 @@
+ #endif // QT_H
+ 
+ #ifndef QT_NO_STL
++#include <cstddef>
+ #include <iterator>
+ #include <list>
+ #endif
diff --git a/nixpkgs/pkgs/development/libraries/qt-3/setup-hook.sh b/nixpkgs/pkgs/development/libraries/qt-3/setup-hook.sh
new file mode 100644
index 000000000000..db1a2529ff54
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-3/setup-hook.sh
@@ -0,0 +1 @@
+export QTDIR=@out@
diff --git a/nixpkgs/pkgs/development/libraries/qt-3/strip.patch b/nixpkgs/pkgs/development/libraries/qt-3/strip.patch
new file mode 100644
index 000000000000..a0c9fa738898
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-3/strip.patch
@@ -0,0 +1,18 @@
+diff -rc qt-x11-free-3.3.3-orig/mkspecs/linux-g++/qmake.conf qt-x11-free-3.3.3/mkspecs/linux-g++/qmake.conf
+*** qt-x11-free-3.3.3-orig/mkspecs/linux-g++/qmake.conf	2004-08-05 16:42:57.000000000 +0200
+--- qt-x11-free-3.3.3/mkspecs/linux-g++/qmake.conf	2005-03-02 12:25:55.000000000 +0100
+***************
+*** 85,90 ****
+  QMAKE_DEL_FILE		= rm -f
+  QMAKE_DEL_DIR		= rmdir
+  QMAKE_STRIP             = strip
+! QMAKE_STRIPFLAGS_LIB 	+= --strip-unneeded
+  QMAKE_CHK_DIR_EXISTS	= test -d
+  QMAKE_MKDIR		= mkdir -p
+--- 85,90 ----
+  QMAKE_DEL_FILE		= rm -f
+  QMAKE_DEL_DIR		= rmdir
+  QMAKE_STRIP             = strip
+! QMAKE_STRIPFLAGS_LIB 	+= --strip-debug
+  QMAKE_CHK_DIR_EXISTS	= test -d
+  QMAKE_MKDIR		= mkdir -p
diff --git a/nixpkgs/pkgs/development/libraries/qt-3/xrandr.patch b/nixpkgs/pkgs/development/libraries/qt-3/xrandr.patch
new file mode 100644
index 000000000000..0389c7fdd068
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-3/xrandr.patch
@@ -0,0 +1,42 @@
+diff -rc qt-x11-free-3.3.6-orig/config.tests/x11/xrandr.test qt-x11-free-3.3.6/config.tests/x11/xrandr.test
+*** qt-x11-free-3.3.6-orig/config.tests/x11/xrandr.test	2006-09-14 14:00:08.000000000 +0200
+--- qt-x11-free-3.3.6/config.tests/x11/xrandr.test	2006-09-14 14:10:39.000000000 +0200
+***************
+*** 52,69 ****
+      INCDIRS="$IN_INCDIRS $XDIRS /FOO/include /include"
+      F=
+      for INCDIR in $INCDIRS; do
+! 	if [ -f $INCDIR/$INC -a -f $INCDIR/$INC2 ]; then
+  	    F=yes
+! 	    XRANDR_H=$INCDIR/$INC
+  	    RANDR_H=$INCDIR/$INC2
+! 	    [ "$VERBOSE" = "yes" ] && echo "  Found $INC in $INCDIR"
+  	    break
+  	fi
+      done
+      if [ -z "$F" ]
+      then
+  	XRANDR=no
+! 	[ "$VERBOSE" = "yes" ] && echo "  Could not find $INC anywhere in $INCDIRS"
+      fi
+  fi
+  
+--- 52,69 ----
+      INCDIRS="$IN_INCDIRS $XDIRS /FOO/include /include"
+      F=
+      for INCDIR in $INCDIRS; do
+! 	if [ -f $INCDIR/$INC2 ]; then
+  	    F=yes
+! #	    XRANDR_H=$INCDIR/$INC
+  	    RANDR_H=$INCDIR/$INC2
+! 	    [ "$VERBOSE" = "yes" ] && echo "  Found $INC2 in $INCDIR"
+  	    break
+  	fi
+      done
+      if [ -z "$F" ]
+      then
+  	XRANDR=no
+! 	[ "$VERBOSE" = "yes" ] && echo "  Could not find $INC2 anywhere in $INCDIRS"
+      fi
+  fi
+  
diff --git a/nixpkgs/pkgs/development/libraries/qt-4.x/4.8/clang-5-darwin.patch b/nixpkgs/pkgs/development/libraries/qt-4.x/4.8/clang-5-darwin.patch
new file mode 100644
index 000000000000..7b181f3ad896
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-4.x/4.8/clang-5-darwin.patch
@@ -0,0 +1,13 @@
+diff --git a/src/gui/text/qfontengine_coretext.mm b/src/gui/text/qfontengine_coretext.mm
+index 204d685..e05179e 100644
+--- a/src/gui/text/qfontengine_coretext.mm
++++ b/src/gui/text/qfontengine_coretext.mm
+@@ -886,7 +886,7 @@ void QCoreTextFontEngine::getUnscaledGlyph(glyph_t glyph, QPainterPath *path, gl
+ 
+ QFixed QCoreTextFontEngine::emSquareSize() const
+ {
+-    return QFixed::QFixed(int(CTFontGetUnitsPerEm(ctfont)));
++    return QFixed(int(CTFontGetUnitsPerEm(ctfont)));
+ }
+ 
+ QFontEngine *QCoreTextFontEngine::cloneWithSize(qreal pixelSize) const
diff --git a/nixpkgs/pkgs/development/libraries/qt-4.x/4.8/default.nix b/nixpkgs/pkgs/development/libraries/qt-4.x/4.8/default.nix
new file mode 100644
index 000000000000..d5bd065ab648
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-4.x/4.8/default.nix
@@ -0,0 +1,235 @@
+{ stdenv, lib, fetchurl, fetchpatch, substituteAll
+, libXrender, libXinerama, libXcursor, libXv, libXext
+, libXfixes, libXrandr, libSM, freetype, fontconfig, zlib, libjpeg, libpng
+, libmng, which, libGLSupported, libGLU, openssl, dbus, cups, pkgconfig
+, libtiff, glib, icu, mysql, postgresql, sqlite, perl, coreutils, libXi
+, buildMultimedia ? stdenv.isLinux, alsaLib, gstreamer, gst-plugins-base
+, buildWebkit ? (stdenv.isLinux || stdenv.isDarwin)
+, flashplayerFix ? false, gdk_pixbuf
+, gtkStyle ? stdenv.hostPlatform == stdenv.buildPlatform, gtk2
+, gnomeStyle ? false, libgnomeui, GConf, gnome_vfs
+, developerBuild ? false
+, docs ? false
+, examples ? false
+, demos ? false
+# darwin support
+, cf-private, libobjc, ApplicationServices, OpenGL, Cocoa, AGL, libcxx
+}:
+
+let
+  v_maj = "4.8";
+  v_min = "7";
+  vers = "${v_maj}.${v_min}";
+in
+
+# TODO:
+#  * move some plugins (e.g., SQL plugins) to dedicated derivations to avoid
+#    false build-time dependencies
+
+stdenv.mkDerivation rec {
+  name = "qt-${vers}";
+
+  src = fetchurl {
+    url = "http://download.qt-project.org/official_releases/qt/"
+      + "${v_maj}/${vers}/qt-everywhere-opensource-src-${vers}.tar.gz";
+    sha256 = "183fca7n7439nlhxyg1z7aky0izgbyll3iwakw4gwivy16aj5272";
+  };
+
+  outputs = [ "out" "dev" ];
+
+  outputInclude = "out";
+
+  setOutputFlags = false;
+
+  # The version property must be kept because it will be included into the QtSDK package name
+  version = vers;
+
+  prePatch = ''
+    substituteInPlace configure --replace /bin/pwd pwd
+    substituteInPlace src/corelib/global/global.pri --replace /bin/ls ${coreutils}/bin/ls
+    sed -e 's@/\(usr\|opt\)/@/var/empty/@g' -i config.tests/*/*.test -i mkspecs/*/*.conf
+  '' + lib.optionalString stdenv.isDarwin ''
+    # remove impure reference to /usr/lib/libstdc++.6.dylib
+    # there might be more references, but this is the only one I could find
+    substituteInPlace tools/macdeployqt/tests/tst_deployment_mac.cpp \
+      --replace /usr/lib/libstdc++.6.dylib "${stdenv.cc}/lib/libstdc++.6.dylib"
+  '' + lib.optionalString stdenv.cc.isClang ''
+    substituteInPlace src/3rdparty/webkit/Source/WebCore/html/HTMLImageElement.cpp \
+      --replace 'optionalHeight > 0' 'optionalHeight != NULL'
+
+    substituteInPlace ./tools/linguist/linguist/messagemodel.cpp \
+      --replace 'm->comment()) >= 0' 'm->comment()) != NULL'
+  '';
+
+  patches =
+    lib.optionals (stdenv.hostPlatform == stdenv.buildPlatform) [
+      ./glib-2.32.patch
+      ./libressl.patch
+      ./parallel-configure.patch
+      ./clang-5-darwin.patch
+      ./qt-4.8.7-unixmake-darwin.patch
+      ./kill-legacy-darwin-apis.patch
+      (substituteAll {
+        src = ./dlopen-absolute-paths.diff;
+        cups = if cups != null then lib.getLib cups else null;
+        icu = icu.out;
+        libXfixes = libXfixes.out;
+        glibc = stdenv.cc.libc.out;
+      })
+      (fetchpatch {
+        name = "fix-medium-font.patch";
+        url = "https://salsa.debian.org/qt-kde-team/qt/qt4-x11/raw/"
+          + "21b342d71c19e6d68b649947f913410fe6129ea4/debian/patches/kubuntu_39_fix_medium_font.diff";
+        sha256 = "0bli44chn03c2y70w1n8l7ss4ya0b40jqqav8yxrykayi01yf95j";
+      })
+      (fetchpatch {
+        name = "qt4-gcc6.patch";
+        url = "https://git.archlinux.org/svntogit/packages.git/plain/trunk/qt4-gcc6.patch?h=packages/qt4&id=ca773a144f5abb244ac4f2749eeee9333cac001f";
+        sha256 = "07lrva7bjh6i40p7b3ml26a2jlznri8bh7y7iyx5zmvb1gfxmj34";
+      })
+    ]
+    ++ lib.optional gtkStyle (substituteAll ({
+        src = ./dlopen-gtkstyle.diff;
+        # substituteAll ignores env vars starting with capital letter
+        gtk = gtk2.out;
+      } // lib.optionalAttrs gnomeStyle {
+        gconf = GConf.out;
+        libgnomeui = libgnomeui.out;
+        gnome_vfs = gnome_vfs.out;
+      }))
+    ++ lib.optional flashplayerFix (substituteAll {
+        src = ./dlopen-webkit-nsplugin.diff;
+        gtk = gtk2.out;
+      })
+    ++ lib.optional stdenv.isAarch64 (fetchpatch {
+        url = "https://src.fedoraproject.org/rpms/qt/raw/ecf530486e0fb7fe31bad26805cde61115562b2b/f/qt-aarch64.patch";
+        sha256 = "1fbjh78nmafqmj7yk67qwjbhl3f6ylkp6x33b1dqxfw9gld8b3gl";
+      })
+    ++ lib.optionals stdenv.hostPlatform.isMusl [
+        ./qt-musl.patch
+        ./qt-musl-iconv-no-bom.patch
+        ./patch-qthread-stacksize.diff
+        ./qsettings-recursive-global-mutex.patch
+      ];
+
+  preConfigure = ''
+    export LD_LIBRARY_PATH="`pwd`/lib:$LD_LIBRARY_PATH"
+    configureFlags+="
+      -docdir $out/share/doc/${name}
+      -plugindir $out/lib/qt4/plugins
+      -importdir $out/lib/qt4/imports
+      -examplesdir $TMPDIR/share/doc/${name}/examples
+      -demosdir $TMPDIR/share/doc/${name}/demos
+      -datadir $out/share/${name}
+      -translationdir $out/share/${name}/translations
+      --jobs=$NIX_BUILD_CORES
+    "
+    unset LD # Makefile uses gcc for linking; setting LD interferes
+  '' + lib.optionalString stdenv.cc.isClang ''
+    sed -i 's/QMAKE_CC = gcc/QMAKE_CC = clang/' mkspecs/common/g++-base.conf
+    sed -i 's/QMAKE_CXX = g++/QMAKE_CXX = clang++/' mkspecs/common/g++-base.conf
+  '' + lib.optionalString stdenv.hostPlatform.isWindows ''
+    sed -i -e 's/ g++/ ${stdenv.cc.targetPrefix}g++/' \
+      -e 's/ gcc/ ${stdenv.cc.targetPrefix}gcc/' \
+      -e 's/ ar/ ${stdenv.cc.targetPrefix}ar/' \
+      -e 's/ strip/ ${stdenv.cc.targetPrefix}strip/' \
+      -e 's/ windres/ ${stdenv.cc.targetPrefix}windres/' \
+      mkspecs/win32-g++/qmake.conf
+  '';
+
+  prefixKey = "-prefix ";
+
+  configurePlatforms = [];
+  configureFlags = let
+    mk = cond: name: "-${lib.optionalString (!cond) "no-"}${name}";
+    platformFlag =
+      if stdenv.hostPlatform != stdenv.buildPlatform
+      then "-xplatform"
+      else "-platform";
+  in (if stdenv.hostPlatform != stdenv.buildPlatform then [
+    # I've not tried any case other than i686-pc-mingw32.
+    # -nomake tools: it fails linking some asian language symbols
+    # -no-svg: it fails to build on mingw64
+    "-static" "-release" "-confirm-license" "-opensource"
+    "-no-opengl" "-no-phonon"
+    "-no-svg"
+    "-make" "qmake" "-make" "libs" "-nomake" "tools"
+  ] else [
+    "-v" "-no-separate-debug-info" "-release" "-fast" "-confirm-license" "-opensource"
+
+    (mk (!stdenv.isFreeBSD) "opengl") "-xrender" "-xrandr" "-xinerama" "-xcursor" "-xinput" "-xfixes" "-fontconfig"
+    "-qdbus" (mk (cups != null) "cups") "-glib" "-dbus-linked" "-openssl-linked"
+
+    "-${if mysql != null then "plugin" else "no"}-sql-mysql" "-system-sqlite"
+
+    "-exceptions" "-xmlpatterns"
+
+    "-make" "libs" "-make" "tools" "-make" "translations"
+    "-no-phonon" (mk buildWebkit "webkit") (mk buildMultimedia "multimedia") "-audio-backend"
+  ]) ++ [
+    "-${if demos then "" else "no"}make" "demos"
+    "-${if examples then "" else "no"}make" "examples"
+    "-${if docs then "" else "no"}make" "docs"
+  ] ++ lib.optional developerBuild "-developer-build"
+    ++ lib.optionals stdenv.hostPlatform.isDarwin [ platformFlag "unsupported/macx-clang-libc++" ]
+    ++ lib.optionals stdenv.hostPlatform.isWindows [ platformFlag "win32-g++-4.6" ];
+
+  propagatedBuildInputs =
+    [ libXrender libXrandr libXinerama libXcursor libXext libXfixes libXv libXi
+      libSM zlib libpng openssl dbus freetype fontconfig glib ]
+        # Qt doesn't directly need GLU (just GL), but many apps use, it's small and doesn't remain a runtime-dep if not used
+    ++ lib.optional libGLSupported libGLU
+    ++ lib.optional ((buildWebkit || buildMultimedia) && stdenv.isLinux ) alsaLib
+    ++ lib.optionals (buildWebkit || buildMultimedia) [ gstreamer gst-plugins-base ];
+
+  # The following libraries are only used in plugins
+  buildInputs =
+    [ cups # Qt dlopen's libcups instead of linking to it
+      postgresql sqlite libjpeg libmng libtiff icu ]
+    ++ lib.optionals (mysql != null) [ mysql.connector-c ]
+    ++ lib.optionals gtkStyle [ gtk2 gdk_pixbuf ]
+    ++ lib.optionals stdenv.isDarwin [ cf-private ApplicationServices OpenGL Cocoa AGL libcxx libobjc ];
+
+  nativeBuildInputs = [ perl pkgconfig which ];
+
+  enableParallelBuilding = true;
+
+  NIX_CFLAGS_COMPILE =
+    # with gcc7 the warnings blow the log over Hydra's limit
+    [ "-Wno-expansion-to-defined" "-Wno-unused-local-typedefs" ]
+    ++ lib.optional stdenv.isLinux "-std=gnu++98" # gnu++ in (Obj)C flags is no good on Darwin
+    ++ lib.optionals (stdenv.isFreeBSD || stdenv.isDarwin)
+      [ "-I${glib.dev}/include/glib-2.0" "-I${glib.out}/lib/glib-2.0/include" ]
+    ++ lib.optional stdenv.isDarwin "-I${libcxx}/include/c++/v1";
+
+  NIX_LDFLAGS = lib.optionalString (stdenv.isFreeBSD || stdenv.isDarwin) "-lglib-2.0";
+
+  preBuild = lib.optionalString stdenv.isDarwin ''
+    # resolve "extra qualification on member" error
+    sed -i 's/struct ::TabletProximityRec;/struct TabletProximityRec;/' \
+      src/gui/kernel/qt_cocoa_helpers_mac_p.h
+    find . -name "Makefile*" | xargs sed -i 's/^\(LINK[[:space:]]* = clang++\)/\1 ${NIX_LDFLAGS}/'
+    sed -i 's/^\(LIBS[[:space:]]*=.*$\)/\1 -lobjc/' ./src/corelib/Makefile.Release
+  '';
+
+  doCheck = false; # qwebframe test fails with fontconfig errors
+
+  postInstall = ''
+    rm -rf $out/tests
+  ''
+  # I don't know why it does not install qmake
+  + lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) ''
+    cp bin/qmake* $out/bin
+  '';
+
+  dontStrip = stdenv.hostPlatform != stdenv.buildPlatform;
+
+  meta = {
+    homepage    = http://qt-project.org/;
+    description = "A cross-platform application framework for C++";
+    license     = lib.licenses.lgpl21Plus; # or gpl3
+    maintainers = with lib.maintainers; [ orivej lovek323 phreedom sander ];
+    platforms   = lib.platforms.unix;
+    badPlatforms = [ "x86_64-darwin" ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/qt-4.x/4.8/dlopen-absolute-paths.diff b/nixpkgs/pkgs/development/libraries/qt-4.x/4.8/dlopen-absolute-paths.diff
new file mode 100644
index 000000000000..4c64e9e26e30
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-4.x/4.8/dlopen-absolute-paths.diff
@@ -0,0 +1,74 @@
+diff --git a/src/corelib/tools/qlocale_icu.cpp b/src/corelib/tools/qlocale_icu.cpp
+index c3e2907..2fac4e1 100644
+--- a/src/corelib/tools/qlocale_icu.cpp
++++ b/src/corelib/tools/qlocale_icu.cpp
+@@ -81,7 +81,7 @@ bool qt_initIcu(const QString &localeString)
+     if (status == NotLoaded) {
+ 
+         // resolve libicui18n
+-        QLibrary lib(QLatin1String("icui18n"), QLatin1String(U_ICU_VERSION_SHORT));
++        QLibrary lib(QLatin1String("@icu@/lib/libicui18n"), QLatin1String(U_ICU_VERSION_SHORT));
+         lib.setLoadHints(QLibrary::ImprovedSearchHeuristics);
+         if (!lib.load()) {
+             qWarning() << "Unable to load library icui18n" << lib.errorString();
+@@ -111,7 +111,7 @@ bool qt_initIcu(const QString &localeString)
+         }
+ 
+         // resolve libicuuc
+-        QLibrary ucLib(QLatin1String("icuuc"), QLatin1String(U_ICU_VERSION_SHORT));
++        QLibrary ucLib(QLatin1String("@icu@/lib/libicuuc"), QLatin1String(U_ICU_VERSION_SHORT));
+         ucLib.setLoadHints(QLibrary::ImprovedSearchHeuristics);
+         if (!ucLib.load()) {
+             qWarning() << "Unable to load library icuuc" << ucLib.errorString();
+diff --git a/src/gui/painting/qcups.cpp b/src/gui/painting/qcups.cpp
+index 99ea43f..acdf9c9 100644
+--- a/src/gui/painting/qcups.cpp
++++ b/src/gui/painting/qcups.cpp
+@@ -87,7 +87,7 @@ static CupsPrintFile _cupsPrintFile = 0;
+ 
+ static void resolveCups()
+ {
+-    QLibrary cupsLib(QLatin1String("cups"), 2);
++    QLibrary cupsLib(QLatin1String("@cups@/lib/libcups"), 2);
+     if(cupsLib.load()) {
+         _cupsGetDests = (CupsGetDests) cupsLib.resolve("cupsGetDests");
+         _cupsFreeDests = (CupsFreeDests) cupsLib.resolve("cupsFreeDests");
+diff --git a/src/gui/painting/qprinterinfo_unix.cpp b/src/gui/painting/qprinterinfo_unix.cpp
+index 3d15538..f0f5351 100644
+--- a/src/gui/painting/qprinterinfo_unix.cpp
++++ b/src/gui/painting/qprinterinfo_unix.cpp
+@@ -454,7 +454,7 @@ int qt_retrieveNisPrinters(QList<QPrinterDescription> *printers)
+     char *domain;
+     int err;
+ 
+-    QLibrary lib(QLatin1String("nsl"));
++    QLibrary lib(QLatin1String("@glibc@/lib/libnsl"));
+     typedef int (*ypGetDefaultDomain)(char **);
+     ypGetDefaultDomain _ypGetDefaultDomain = (ypGetDefaultDomain)lib.resolve("yp_get_default_domain");
+     typedef int (*ypAll)(const char *, const char *, const struct ypall_callback *);
+diff --git a/src/network/kernel/qhostinfo_unix.cpp b/src/network/kernel/qhostinfo_unix.cpp
+index 6b42d1e..f88b628 100644
+--- a/src/network/kernel/qhostinfo_unix.cpp
++++ b/src/network/kernel/qhostinfo_unix.cpp
+@@ -95,7 +95,7 @@ static res_state_ptr local_res = 0;
+ static void resolveLibrary()
+ {
+ #if !defined(QT_NO_LIBRARY) && !defined(Q_OS_QNX)
+-    QLibrary lib(QLatin1String("resolv"));
++    QLibrary lib(QLatin1String("@glibc@/lib/libresolv"));
+     lib.setLoadHints(QLibrary::ImprovedSearchHeuristics);
+     if (!lib.load())
+         return;
+diff --git a/src/plugins/platforms/xlib/qxlibstatic.cpp b/src/plugins/platforms/xlib/qxlibstatic.cpp
+index f8f3d69..d63c5bc 100644
+--- a/src/plugins/platforms/xlib/qxlibstatic.cpp
++++ b/src/plugins/platforms/xlib/qxlibstatic.cpp
+@@ -242,7 +242,7 @@ static void* qt_load_library_runtime(const char *library, int vernum,
+ }
+ 
+ #  define XFIXES_LOAD_RUNTIME(vernum, symbol, symbol_type) \
+-    (symbol_type)qt_load_library_runtime("libXfixes", vernum, 4, #symbol);
++    (symbol_type)qt_load_library_runtime("@libXfixes@/lib/libXfixes", vernum, 4, #symbol);
+ #  define XFIXES_LOAD_V1(symbol) \
+     XFIXES_LOAD_RUNTIME(1, symbol, Ptr##symbol)
+ #  define XFIXES_LOAD_V2(symbol) \
diff --git a/nixpkgs/pkgs/development/libraries/qt-4.x/4.8/dlopen-gtkstyle.diff b/nixpkgs/pkgs/development/libraries/qt-4.x/4.8/dlopen-gtkstyle.diff
new file mode 100644
index 000000000000..a1c9238be1ae
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-4.x/4.8/dlopen-gtkstyle.diff
@@ -0,0 +1,37 @@
+diff --git a/src/gui/styles/qgtkstyle_p.cpp b/src/gui/styles/qgtkstyle_p.cpp
+index 3b128e6..39434db 100644
+--- a/src/gui/styles/qgtkstyle_p.cpp
++++ b/src/gui/styles/qgtkstyle_p.cpp
+@@ -312,7 +312,7 @@ GtkStyle* QGtkStylePrivate::gtkStyle(const QHashableLatin1Literal &path)
+ void QGtkStylePrivate::resolveGtk() const
+ {
+     // enforce the "0" suffix, so we'll open libgtk-x11-2.0.so.0
+-    QLibrary libgtk(QLS("gtk-x11-2.0"), 0, 0);
++    QLibrary libgtk(QLS("@gtk@/lib/libgtk-x11-2.0"), 0, 0);
+     libgtk.setLoadHints(QLibrary::ImprovedSearchHeuristics);
+ 
+     gtk_init = (Ptr_gtk_init)libgtk.resolve("gtk_init");
+@@ -435,8 +435,8 @@ void QGtkStylePrivate::resolveGtk() const
+     pango_font_description_get_family = (Ptr_pango_font_description_get_family)libgtk.resolve("pango_font_description_get_family");
+     pango_font_description_get_style = (Ptr_pango_font_description_get_style)libgtk.resolve("pango_font_description_get_style");
+ 
+-    gnome_icon_lookup_sync = (Ptr_gnome_icon_lookup_sync)QLibrary::resolve(QLS("gnomeui-2"), 0, "gnome_icon_lookup_sync");
+-    gnome_vfs_init= (Ptr_gnome_vfs_init)QLibrary::resolve(QLS("gnomevfs-2"), 0, "gnome_vfs_init");
++    gnome_icon_lookup_sync = (Ptr_gnome_icon_lookup_sync)QLibrary::resolve(QLS("@libgnomeui@/lib/libgnomeui-2"), 0, "gnome_icon_lookup_sync");
++    gnome_vfs_init= (Ptr_gnome_vfs_init)QLibrary::resolve(QLS("@gnome_vfs@/lib/libgnomevfs-2"), 0, "gnome_vfs_init");
+ }
+ 
+ /* \internal
+@@ -608,9 +608,9 @@ void QGtkStylePrivate::cleanupGtkWidgets()
+ static bool resolveGConf()
+ {
+     if (!QGtkStylePrivate::gconf_client_get_default) {
+-        QGtkStylePrivate::gconf_client_get_default = (Ptr_gconf_client_get_default)QLibrary::resolve(QLS("gconf-2"), 4, "gconf_client_get_default");
+-        QGtkStylePrivate::gconf_client_get_string =  (Ptr_gconf_client_get_string)QLibrary::resolve(QLS("gconf-2"), 4, "gconf_client_get_string");
+-        QGtkStylePrivate::gconf_client_get_bool =  (Ptr_gconf_client_get_bool)QLibrary::resolve(QLS("gconf-2"), 4, "gconf_client_get_bool");
++        QGtkStylePrivate::gconf_client_get_default = (Ptr_gconf_client_get_default)QLibrary::resolve(QLS("@gconf@/lib/libgconf-2"), 4, "gconf_client_get_default");
++        QGtkStylePrivate::gconf_client_get_string =  (Ptr_gconf_client_get_string)QLibrary::resolve(QLS("@gconf@/lib/libgconf-2"), 4, "gconf_client_get_string");
++        QGtkStylePrivate::gconf_client_get_bool =  (Ptr_gconf_client_get_bool)QLibrary::resolve(QLS("@gconf@/lib/libgconf-2"), 4, "gconf_client_get_bool");
+     }
+     return (QGtkStylePrivate::gconf_client_get_default !=0);
+ }
diff --git a/nixpkgs/pkgs/development/libraries/qt-4.x/4.8/dlopen-webkit-nsplugin.diff b/nixpkgs/pkgs/development/libraries/qt-4.x/4.8/dlopen-webkit-nsplugin.diff
new file mode 100644
index 000000000000..d2ebbf3b45a8
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-4.x/4.8/dlopen-webkit-nsplugin.diff
@@ -0,0 +1,52 @@
+diff --git a/src/3rdparty/webkit/Source/WebCore/plugins/qt/PluginPackageQt.cpp b/src/3rdparty/webkit/Source/WebCore/plugins/qt/PluginPackageQt.cpp
+index 19941d6..0ec15e2 100644
+--- a/src/3rdparty/webkit/Source/WebCore/plugins/qt/PluginPackageQt.cpp
++++ b/src/3rdparty/webkit/Source/WebCore/plugins/qt/PluginPackageQt.cpp
+@@ -121,7 +121,7 @@ static void initializeGtk(QLibrary* module = 0)
+         }
+     }
+ 
+-    QLibrary library(QLatin1String("libgtk-x11-2.0.so.0"));
++    QLibrary library(QLatin1String("@gtk@/lib/libgtk-x11-2.0"), 0);
+     if (library.load()) {
+         typedef void *(*gtk_init_check_ptr)(int*, char***);
+         gtk_init_check_ptr gtkInitCheck = (gtk_init_check_ptr)library.resolve("gtk_init_check");
+diff --git a/src/3rdparty/webkit/Source/WebCore/plugins/qt/PluginViewQt.cpp b/src/3rdparty/webkit/Source/WebCore/plugins/qt/PluginViewQt.cpp
+index 2fe69d1..b658e4a 100644
+--- a/src/3rdparty/webkit/Source/WebCore/plugins/qt/PluginViewQt.cpp
++++ b/src/3rdparty/webkit/Source/WebCore/plugins/qt/PluginViewQt.cpp
+@@ -857,7 +857,7 @@ static Display *getPluginDisplay()
+     // support gdk based plugins (like flash) that use a different X connection.
+     // The code below has the same effect as this one:
+     // Display *gdkDisplay = gdk_x11_display_get_xdisplay(gdk_display_get_default());
+-    QLibrary library(QLatin1String("libgdk-x11-2.0"), 0);
++    QLibrary library(QLatin1String("@gtk@/lib/libgdk-x11-2.0"), 0);
+     if (!library.load())
+         return 0;
+ 
+diff --git a/src/3rdparty/webkit/Source/WebKit2/Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp b/src/3rdparty/webkit/Source/WebKit2/Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp
+index 2c9b465..56b3074 100644
+--- a/src/3rdparty/webkit/Source/WebKit2/Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp
++++ b/src/3rdparty/webkit/Source/WebKit2/Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp
+@@ -42,7 +42,7 @@ namespace WebKit {
+ #if PLATFORM(QT)
+ static void initializeGTK()
+ {
+-    QLibrary library(QLatin1String("libgtk-x11-2.0.so.0"));
++    QLibrary library(QLatin1String("@gtk@/lib/libgtk-x11-2.0"), 0);
+     if (library.load()) {
+         typedef void *(*gtk_init_check_ptr)(int*, char***);
+         gtk_init_check_ptr gtkInitCheck = reinterpret_cast<gtk_init_check_ptr>(library.resolve("gtk_init_check"));
+diff --git a/src/3rdparty/webkit/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp b/src/3rdparty/webkit/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp
+index b8c8f2a..e7f4dc5 100644
+--- a/src/3rdparty/webkit/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp
++++ b/src/3rdparty/webkit/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp
+@@ -54,7 +54,7 @@ static Display *getPluginDisplay()
+     // The code below has the same effect as this one:
+     // Display *gdkDisplay = gdk_x11_display_get_xdisplay(gdk_display_get_default());
+ 
+-    QLibrary library(QLatin1String("libgdk-x11-2.0"), 0);
++    QLibrary library(QLatin1String("@gtk@/lib/libgdk-x11-2.0"), 0);
+     if (!library.load())
+         return 0;
+ 
diff --git a/nixpkgs/pkgs/development/libraries/qt-4.x/4.8/glib-2.32.patch b/nixpkgs/pkgs/development/libraries/qt-4.x/4.8/glib-2.32.patch
new file mode 100644
index 000000000000..4593c1b4ba8d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-4.x/4.8/glib-2.32.patch
@@ -0,0 +1,12 @@
+diff -Naur qt-everywhere-opensource-src-4.8.2-orig/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Threading.h qt-everywhere-opensource-src-4.8.2/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Threading.h
+--- qt-everywhere-opensource-src-4.8.2-orig/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Threading.h	2012-04-26 15:46:22.000000000 -0400
++++ qt-everywhere-opensource-src-4.8.2/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Threading.h	2012-07-14 22:47:02.145152876 -0400
+@@ -89,7 +89,7 @@
+ #include <pthread.h>
+ #elif PLATFORM(GTK)
+ #include <wtf/gtk/GOwnPtr.h>
+-typedef struct _GMutex GMutex;
++typedef union _GMutex GMutex;
+ typedef struct _GCond GCond;
+ #endif
+ 
diff --git a/nixpkgs/pkgs/development/libraries/qt-4.x/4.8/kill-legacy-darwin-apis.patch b/nixpkgs/pkgs/development/libraries/qt-4.x/4.8/kill-legacy-darwin-apis.patch
new file mode 100644
index 000000000000..c1338e98d851
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-4.x/4.8/kill-legacy-darwin-apis.patch
@@ -0,0 +1,330 @@
+diff --git a/src/corelib/io/qfilesystemengine_unix.cpp b/src/corelib/io/qfilesystemengine_unix.cpp
+index 4a9049b..c0ac9db 100644
+--- a/src/corelib/io/qfilesystemengine_unix.cpp
++++ b/src/corelib/io/qfilesystemengine_unix.cpp
+@@ -242,9 +242,8 @@ QFileSystemEntry QFileSystemEngine::canonicalName(const QFileSystemEntry &entry,
+ #else
+     char *ret = 0;
+ # if defined(Q_OS_MAC) && !defined(Q_OS_IOS)
+-    // When using -mmacosx-version-min=10.4, we get the legacy realpath implementation,
+-    // which does not work properly with the realpath(X,0) form. See QTBUG-28282.
+-    if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_6) {
++    // In Nix-on-Darwin, we don't support ancient macOS anyway, and the deleted branch relies on
++    // a symbol that's been deprecated for years and that our CF doesn't have
+         ret = (char*)malloc(PATH_MAX + 1);
+         if (ret && realpath(entry.nativeFilePath().constData(), (char*)ret) == 0) {
+             const int savedErrno = errno; // errno is checked below, and free() might change it
+@@ -252,19 +251,6 @@ QFileSystemEntry QFileSystemEngine::canonicalName(const QFileSystemEntry &entry,
+             errno = savedErrno;
+             ret = 0;
+         }
+-    } else {
+-        // on 10.5 we can use FSRef to resolve the file path.
+-        QString path = QDir::cleanPath(entry.filePath());
+-        FSRef fsref;
+-        if (FSPathMakeRef((const UInt8 *)path.toUtf8().data(), &fsref, 0) == noErr) {
+-            CFURLRef urlref = CFURLCreateFromFSRef(NULL, &fsref);
+-            CFStringRef canonicalPath = CFURLCopyFileSystemPath(urlref, kCFURLPOSIXPathStyle);
+-            QString ret = QCFString::toQString(canonicalPath);
+-            CFRelease(canonicalPath);
+-            CFRelease(urlref);
+-            return QFileSystemEntry(ret);
+-        }
+-    }
+ # else
+ #  if _POSIX_VERSION >= 200801L
+     ret = realpath(entry.nativeFilePath().constData(), (char*)0);
+diff --git a/src/3rdparty/webkit/Source/WebCore/platform/mac/WebCoreNSStringExtras.h b/src/3rdparty/webkit/Source/WebCore/platform/mac/WebCoreNSStringExtras.h
+index 3bf7342..b6bcfc0 100644
+--- a/src/3rdparty/webkit/Source/WebCore/platform/mac/WebCoreNSStringExtras.h
++++ b/src/3rdparty/webkit/Source/WebCore/platform/mac/WebCoreNSStringExtras.h
+@@ -43,7 +43,6 @@ BOOL stringIsCaseInsensitiveEqualToString(NSString *first, NSString *second);
+ BOOL hasCaseInsensitiveSuffix(NSString *string, NSString *suffix);
+ BOOL hasCaseInsensitiveSubstring(NSString *string, NSString *substring);
+ NSString *filenameByFixingIllegalCharacters(NSString *string);
+-CFStringEncoding stringEncodingForResource(Handle resource);
+ 
+ #ifdef __cplusplus
+ }
+diff --git a/src/3rdparty/webkit/Source/WebCore/platform/mac/WebCoreNSStringExtras.mm b/src/3rdparty/webkit/Source/WebCore/platform/mac/WebCoreNSStringExtras.mm
+index d6c3f0c..c88ca76 100644
+--- a/src/3rdparty/webkit/Source/WebCore/platform/mac/WebCoreNSStringExtras.mm
++++ b/src/3rdparty/webkit/Source/WebCore/platform/mac/WebCoreNSStringExtras.mm
+@@ -68,45 +68,4 @@ BOOL hasCaseInsensitiveSubstring(NSString *string, NSString *substring)
+     return filename;
+ }
+ 
+-CFStringEncoding stringEncodingForResource(Handle resource)
+-{
+-    short resRef = HomeResFile(resource);
+-    if (ResError() != noErr)
+-        return NSMacOSRomanStringEncoding;
+-    
+-    // Get the FSRef for the current resource file
+-    FSRef fref;
+-    OSStatus error = FSGetForkCBInfo(resRef, 0, NULL, NULL, NULL, &fref, NULL);
+-    if (error != noErr)
+-        return NSMacOSRomanStringEncoding;
+-    
+-    RetainPtr<CFURLRef> url(AdoptCF, CFURLCreateFromFSRef(NULL, &fref));
+-    if (!url)
+-        return NSMacOSRomanStringEncoding;
+-
+-    NSString *path = [(NSURL *)url.get() path];
+-
+-    // Get the lproj directory name
+-    path = [path stringByDeletingLastPathComponent];
+-    if (!stringIsCaseInsensitiveEqualToString([path pathExtension], @"lproj"))
+-        return NSMacOSRomanStringEncoding;
+-    
+-    NSString *directoryName = [[path stringByDeletingPathExtension] lastPathComponent];
+-    RetainPtr<CFStringRef> locale(AdoptCF, CFLocaleCreateCanonicalLocaleIdentifierFromString(NULL, (CFStringRef)directoryName));
+-    if (!locale)
+-        return NSMacOSRomanStringEncoding;
+-
+-    LangCode lang;
+-    RegionCode region;
+-    error = LocaleStringToLangAndRegionCodes([(NSString *)locale.get() UTF8String], &lang, &region);
+-    if (error != noErr)
+-        return NSMacOSRomanStringEncoding;
+-
+-    TextEncoding encoding;
+-    error = UpgradeScriptInfoToTextEncoding(kTextScriptDontCare, lang, region, NULL, &encoding);
+-    if (error != noErr)
+-        return NSMacOSRomanStringEncoding;
+-    
+-    return encoding;
+-}
+ 
+diff --git a/src/3rdparty/webkit/Source/WebCore/plugins/mac/PluginPackageMac.cpp b/src/3rdparty/webkit/Source/WebCore/plugins/mac/PluginPackageMac.cpp
+index 865ea32..20bda8d 100644
+--- a/src/3rdparty/webkit/Source/WebCore/plugins/mac/PluginPackageMac.cpp
++++ b/src/3rdparty/webkit/Source/WebCore/plugins/mac/PluginPackageMac.cpp
+@@ -101,33 +101,6 @@ static WTF::RetainPtr<CFDictionaryRef> readPListFile(CFStringRef fileName, bool
+     return map;
+ }
+ 
+-static Vector<String> stringListFromResourceId(SInt16 id)
+-{
+-    Vector<String> list;
+-
+-    Handle handle = Get1Resource('STR#', id);
+-    if (!handle)
+-        return list;
+-
+-    CFStringEncoding encoding = stringEncodingForResource(handle);
+-
+-    unsigned char* p = (unsigned char*)*handle;
+-    if (!p)
+-        return list;
+-
+-    SInt16 count = *(SInt16*)p;
+-    p += sizeof(SInt16);
+-
+-    for (SInt16 i = 0; i < count; ++i) {
+-        unsigned char length = *p;
+-        WTF::RetainPtr<CFStringRef> str = CFStringCreateWithPascalString(0, p, encoding);
+-        list.append(str.get());
+-        p += 1 + length;
+-    }
+-
+-    return list;
+-}
+-
+ bool PluginPackage::fetchInfo()
+ {
+     if (!load())
+@@ -202,36 +175,8 @@ bool PluginPackage::fetchInfo()
+         m_description = (CFStringRef)CFBundleGetValueForInfoDictionaryKey(m_module, CFSTR("WebPluginDescription"));
+ 
+     } else {
+-        int resFile = CFBundleOpenBundleResourceMap(m_module);
+-
+-        UseResFile(resFile);
+-
+-        Vector<String> mimes = stringListFromResourceId(MIMEListStringStringNumber);
+-
+-        if (mimes.size() % 2 != 0)
+-            return false;
+-
+-        Vector<String> descriptions = stringListFromResourceId(MIMEDescriptionStringNumber);
+-        if (descriptions.size() != mimes.size() / 2)
+-            return false;
+-
+-        for (size_t i = 0;  i < mimes.size(); i += 2) {
+-            String mime = mimes[i].lower();
+-            Vector<String> extensions;
+-            mimes[i + 1].lower().split(UChar(','), extensions);
+-
+-            m_mimeToExtensions.set(mime, extensions);
+-
+-            m_mimeToDescriptions.set(mime, descriptions[i / 2]);
+-        }
+-
+-        Vector<String> names = stringListFromResourceId(PluginNameOrDescriptionStringNumber);
+-        if (names.size() == 2) {
+-            m_description = names[0];
+-            m_name = names[1];
+-        }
+-
+-        CFBundleCloseBundleResourceMap(m_module, resFile);
++        LOG(Plugins, "Nix removed ancient code that relies on long-deprecated functionality that we don't want to support!");
++        return false;
+     }
+ 
+     LOG(Plugins, "PluginPackage::fetchInfo(): Found plug-in '%s'", m_name.utf8().data());
+diff --git a/src/3rdparty/webkit/Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm b/src/3rdparty/webkit/Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm
+index b206e48..669d442 100644
+--- a/src/3rdparty/webkit/Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm
++++ b/src/3rdparty/webkit/Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm
+@@ -26,7 +26,6 @@
+ #import "config.h"
+ #import "NetscapePluginModule.h"
+ 
+-#import <WebCore/WebCoreNSStringExtras.h>
+ #import <wtf/HashSet.h>
+ 
+ using namespace WebCore;
+@@ -196,132 +195,6 @@ static bool getPluginInfoFromPropertyLists(CFBundleRef bundle, PluginInfo& plugi
+     return true;    
+ }
+ 
+-class ResourceMap {
+-public:
+-    explicit ResourceMap(CFBundleRef bundle)
+-        : m_bundle(bundle)
+-        , m_currentResourceFile(CurResFile())
+-        , m_bundleResourceMap(CFBundleOpenBundleResourceMap(m_bundle))
+-    {
+-        UseResFile(m_bundleResourceMap);
+-    }
+-
+-    ~ResourceMap()
+-    {
+-        // Close the resource map.
+-        CFBundleCloseBundleResourceMap(m_bundle, m_bundleResourceMap);
+-        
+-        // And restore the old resource.
+-        UseResFile(m_currentResourceFile);
+-    }
+-
+-    bool isValid() const { return m_bundleResourceMap != -1; }
+-
+-private:
+-    CFBundleRef m_bundle;
+-    ResFileRefNum m_currentResourceFile;
+-    ResFileRefNum m_bundleResourceMap;
+-};
+-
+-static bool getStringListResource(ResID resourceID, Vector<String>& stringList) {
+-    Handle stringListHandle = Get1Resource('STR#', resourceID);
+-    if (!stringListHandle || !*stringListHandle)
+-        return false;
+-
+-    // Get the string list size.
+-    Size stringListSize = GetHandleSize(stringListHandle);
+-    if (stringListSize < static_cast<Size>(sizeof(UInt16)))
+-        return false;
+-
+-    CFStringEncoding stringEncoding = stringEncodingForResource(stringListHandle);
+-
+-    unsigned char* ptr = reinterpret_cast<unsigned char*>(*stringListHandle);
+-    unsigned char* end = ptr + stringListSize;
+-    
+-    // Get the number of strings in the string list.
+-    UInt16 numStrings = *reinterpret_cast<UInt16*>(ptr);
+-    ptr += sizeof(UInt16);
+-
+-    for (UInt16 i = 0; i < numStrings; ++i) {
+-        // We're past the end of the string, bail.
+-        if (ptr >= end)
+-            return false;
+-
+-        // Get the string length.
+-        unsigned char stringLength = *ptr++;
+-
+-        RetainPtr<CFStringRef> cfString(AdoptCF, CFStringCreateWithBytesNoCopy(kCFAllocatorDefault, ptr, stringLength, stringEncoding, false, kCFAllocatorNull));
+-        if (!cfString.get())
+-            return false;
+-
+-        stringList.append(cfString.get());
+-        ptr += stringLength;
+-    }
+-
+-    if (ptr != end)
+-        return false;
+-
+-    return true;
+-}
+-
+-static const ResID PluginNameOrDescriptionStringNumber = 126;
+-static const ResID MIMEDescriptionStringNumber = 127;
+-static const ResID MIMEListStringStringNumber = 128;
+-
+-static bool getPluginInfoFromCarbonResources(CFBundleRef bundle, PluginInfo& pluginInfo)
+-{
+-    ResourceMap resourceMap(bundle);
+-    if (!resourceMap.isValid())
+-        return false;
+-
+-    // Get the description and name string list.
+-    Vector<String> descriptionAndName;
+-    if (!getStringListResource(PluginNameOrDescriptionStringNumber, descriptionAndName))
+-        return false;
+-
+-    // Get the MIME types and extensions string list. This list needs to be a multiple of two.
+-    Vector<String> mimeTypesAndExtensions;
+-    if (!getStringListResource(MIMEListStringStringNumber, mimeTypesAndExtensions))
+-        return false;
+-
+-    if (mimeTypesAndExtensions.size() % 2)
+-        return false;
+-
+-    // Now get the MIME type descriptions string list. This string list needs to be the same length as the number of MIME types.
+-    Vector<String> mimeTypeDescriptions;
+-    if (!getStringListResource(MIMEDescriptionStringNumber, mimeTypeDescriptions))
+-        return false;
+-
+-    // Add all MIME types.
+-    for (size_t i = 0; i < mimeTypesAndExtensions.size() / 2; ++i) {
+-        MimeClassInfo mimeClassInfo;
+-        
+-        const String& mimeType = mimeTypesAndExtensions[i * 2];
+-        String description;
+-        if (i < mimeTypeDescriptions.size())
+-            description = mimeTypeDescriptions[i];
+-        
+-        mimeClassInfo.type = mimeType.lower();
+-        mimeClassInfo.desc = description;
+-        
+-        Vector<String> extensions;
+-        mimeTypesAndExtensions[i * 2 + 1].split(',', extensions);
+-        
+-        for (size_t i = 0; i < extensions.size(); ++i)
+-            mimeClassInfo.extensions.append(extensions[i].lower());
+-
+-        pluginInfo.mimes.append(mimeClassInfo);
+-    }
+-
+-    // Set the description and name if they exist.
+-    if (descriptionAndName.size() > 0)
+-        pluginInfo.desc = descriptionAndName[0];
+-    if (descriptionAndName.size() > 1)
+-        pluginInfo.name = descriptionAndName[1];
+-
+-    return true;
+-}
+-
+ bool NetscapePluginModule::getPluginInfo(const String& pluginPath, PluginInfoStore::Plugin& plugin)
+ {
+     RetainPtr<CFStringRef> bundlePath(AdoptCF, pluginPath.createCFString());
+@@ -344,8 +217,7 @@ static bool getPluginInfoFromCarbonResources(CFBundleRef bundle, PluginInfo& plu
+         return false;
+     
+     // Check that there's valid info for this plug-in.
+-    if (!getPluginInfoFromPropertyLists(bundle.get(), plugin.info) &&
+-        !getPluginInfoFromCarbonResources(bundle.get(), plugin.info))
++    if (!getPluginInfoFromPropertyLists(bundle.get(), plugin.info))
+         return false;
+     
+     plugin.path = pluginPath;
diff --git a/nixpkgs/pkgs/development/libraries/qt-4.x/4.8/libressl.patch b/nixpkgs/pkgs/development/libraries/qt-4.x/4.8/libressl.patch
new file mode 100644
index 000000000000..5432610d9dc9
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-4.x/4.8/libressl.patch
@@ -0,0 +1,64 @@
+$OpenBSD: patch-src_network_ssl_qsslsocket_openssl_symbols_cpp,v 1.3 2015/09/17 12:24:42 dcoppa Exp $
+--- a/src/network/ssl/qsslsocket_openssl_symbols.cpp	Wed Sep 16 13:27:39 2015
++++ b/src/network/ssl/qsslsocket_openssl_symbols.cpp	Wed Sep 16 13:33:06 2015
+@@ -228,13 +228,17 @@ DEFINEFUNC(int, SSL_shutdown, SSL *a, a, return -1, re
+ #ifndef OPENSSL_NO_SSL2
+ DEFINEFUNC(const SSL_METHOD *, SSLv2_client_method, DUMMYARG, DUMMYARG, return 0, return)
+ #endif
++#ifndef OPENSSL_NO_SSL3
+ DEFINEFUNC(const SSL_METHOD *, SSLv3_client_method, DUMMYARG, DUMMYARG, return 0, return)
++#endif
+ DEFINEFUNC(const SSL_METHOD *, SSLv23_client_method, DUMMYARG, DUMMYARG, return 0, return)
+ DEFINEFUNC(const SSL_METHOD *, TLSv1_client_method, DUMMYARG, DUMMYARG, return 0, return)
+ #ifndef OPENSSL_NO_SSL2
+ DEFINEFUNC(const SSL_METHOD *, SSLv2_server_method, DUMMYARG, DUMMYARG, return 0, return)
+ #endif
++#ifndef OPENSSL_NO_SSL3
+ DEFINEFUNC(const SSL_METHOD *, SSLv3_server_method, DUMMYARG, DUMMYARG, return 0, return)
++#endif
+ DEFINEFUNC(const SSL_METHOD *, SSLv23_server_method, DUMMYARG, DUMMYARG, return 0, return)
+ DEFINEFUNC(const SSL_METHOD *, TLSv1_server_method, DUMMYARG, DUMMYARG, return 0, return)
+ #else
+@@ -822,13 +826,17 @@ bool q_resolveOpenSslSymbols()
+ #ifndef OPENSSL_NO_SSL2
+     RESOLVEFUNC(SSLv2_client_method)
+ #endif
++#ifndef OPENSSL_NO_SSL3
+     RESOLVEFUNC(SSLv3_client_method)
++#endif
+     RESOLVEFUNC(SSLv23_client_method)
+     RESOLVEFUNC(TLSv1_client_method)
+ #ifndef OPENSSL_NO_SSL2
+     RESOLVEFUNC(SSLv2_server_method)
+ #endif
++#ifndef OPENSSL_NO_SSL3
+     RESOLVEFUNC(SSLv3_server_method)
++#endif
+     RESOLVEFUNC(SSLv23_server_method)
+     RESOLVEFUNC(TLSv1_server_method)
+     RESOLVEFUNC(X509_NAME_entry_count)
+--- a/src/network/ssl/qsslsocket_openssl.cpp	Thu May  7 16:14:44 2015
++++ b/src/network/ssl/qsslsocket_openssl.cpp	Wed Sep 16 13:30:03 2015
+@@ -267,15 +267,19 @@ init_context:
+ #endif
+         break;
+     case QSsl::SslV3:
++#ifndef OPENSSL_NO_SSL3
+         ctx = q_SSL_CTX_new(client ? q_SSLv3_client_method() : q_SSLv3_server_method());
++#else
++        ctx = 0; // SSL 3 not supported by the system, but chosen deliberately -> error
++#endif
+         break;
+-    case QSsl::SecureProtocols: // SslV2 will be disabled below
+-    case QSsl::TlsV1SslV3: // SslV2 will be disabled below
+     case QSsl::AnyProtocol:
+-    default:
+         ctx = q_SSL_CTX_new(client ? q_SSLv23_client_method() : q_SSLv23_server_method());
+         break;
+     case QSsl::TlsV1:
++    case QSsl::SecureProtocols:
++    case QSsl::TlsV1SslV3:
++    default:
+         ctx = q_SSL_CTX_new(client ? q_TLSv1_client_method() : q_TLSv1_server_method());
+         break;
+     }
diff --git a/nixpkgs/pkgs/development/libraries/qt-4.x/4.8/parallel-configure.patch b/nixpkgs/pkgs/development/libraries/qt-4.x/4.8/parallel-configure.patch
new file mode 100644
index 000000000000..b9b9d6d0a683
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-4.x/4.8/parallel-configure.patch
@@ -0,0 +1,22 @@
+--- a/configure
++++ b/configure
+@@ -1087,2 +1087,3 @@ fi
+ #-------------------------------------------------------------------------------
++JOBS=
+ 
+@@ -2528,2 +2529,5 @@ while [ "$#" -gt 0 ]; do
+         ;;
++    jobs)
++        JOBS=-j$VAL
++        ;;
+     *)
+@@ -5072,3 +5076,3 @@ if true; then ###[ '!' -f "$outpath/bin/qmake" ];
+         if "$WHICH" makedepend >/dev/null 2>&1 && grep 'depend:' "$mkfile" >/dev/null 2>&1; then
+-            (cd "$outpath/qmake" && "$MAKE" -f "$mkfile" depend) >/dev/null 2>&1
++            (cd "$outpath/qmake" && "$MAKE" $JOBS -f "$mkfile" depend) >/dev/null 2>&1
+            sed "s,^.*/\([^/]*.o\):,\1:,g" "$mkfile" >"$mkfile.tmp"
+@@ -5080,3 +5084,3 @@ if true; then ###[ '!' -f "$outpath/bin/qmake" ];
+     QMAKE_BUILD_ERROR=no
+-    (cd "$outpath/qmake"; "$MAKE") || QMAKE_BUILD_ERROR=yes
++    (cd "$outpath/qmake"; "$MAKE" $JOBS) || QMAKE_BUILD_ERROR=yes
+     [ '!' -z "$QCONFIG_H" ] && mv -f "$QCONFIG_H" "$QMAKE_QCONFIG_H" #move qmake's qconfig.h to qconfig.h.qmake
diff --git a/nixpkgs/pkgs/development/libraries/qt-4.x/4.8/patch-qthread-stacksize.diff b/nixpkgs/pkgs/development/libraries/qt-4.x/4.8/patch-qthread-stacksize.diff
new file mode 100644
index 000000000000..53a4c70ac3ae
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-4.x/4.8/patch-qthread-stacksize.diff
@@ -0,0 +1,54 @@
+--- a/src/corelib/thread/qthread_unix.cpp.orig	2015-11-23 19:05:40.000000000 +0100
++++ b/src/corelib/thread/qthread_unix.cpp	2015-11-24 11:22:31.000000000 +0100
+@@ -79,6 +79,7 @@
+ #endif
+ 
++#include <sys/resource.h> // getrlimit/setrlimit
+ #if defined(Q_OS_MAC)
+ # ifdef qDebug
+ #   define old_qDebug qDebug
+ #   undef qDebug
+@@ -649,6 +650,43 @@
+ #endif // QT_HAS_THREAD_PRIORITY_SCHEDULING
+ 
+ 
++    if (d->stackSize == 0) {
++        // Fix the default (too small) stack size for threads on OS X,
++        // which also affects the thread pool.
++        // See also:
++        // https://bugreports.qt.io/browse/QTBUG-2568
++        // This fix can also be found in Chromium:
++        // https://chromium.googlesource.com/chromium/src.git/+/master/base/threading/platform_thread_mac.mm#186
++
++        // The Mac OS X default for a pthread stack size is 512kB.
++        // Libc-594.1.4/pthreads/pthread.c's pthread_attr_init uses
++        // DEFAULT_STACK_SIZE for this purpose.
++        //
++        // 512kB isn't quite generous enough for some deeply recursive threads that
++        // otherwise request the default stack size by specifying 0. Here, adopt
++        // glibc's behavior as on Linux, which is to use the current stack size
++        // limit (ulimit -s) as the default stack size. See
++        // glibc-2.11.1/nptl/nptl-init.c's __pthread_initialize_minimal_internal. To
++        // avoid setting the limit below the Mac OS X default or the minimum usable
++        // stack size, these values are also considered. If any of these values
++        // can't be determined, or if stack size is unlimited (ulimit -s unlimited),
++        // stack_size is left at 0 to get the system default.
++        //
++        // Mac OS X normally only applies ulimit -s to the main thread stack. On
++        // contemporary OS X and Linux systems alike, this value is generally 8MB
++        // or in that neighborhood.
++        size_t default_stack_size = 0;
++        struct rlimit stack_rlimit;
++        if (pthread_attr_getstacksize(&attr, &default_stack_size) == 0 &&
++            getrlimit(RLIMIT_STACK, &stack_rlimit) == 0 &&
++            stack_rlimit.rlim_cur != RLIM_INFINITY) {
++            default_stack_size =
++                    std::max(std::max(default_stack_size,
++                                      static_cast<size_t>(PTHREAD_STACK_MIN)),
++                             static_cast<size_t>(stack_rlimit.rlim_cur));
++        }
++        d->stackSize = default_stack_size;
++    }
+     if (d->stackSize > 0) {
+ #if defined(_POSIX_THREAD_ATTR_STACKSIZE) && (_POSIX_THREAD_ATTR_STACKSIZE-0 > 0)
+         int code = pthread_attr_setstacksize(&attr, d->stackSize);
diff --git a/nixpkgs/pkgs/development/libraries/qt-4.x/4.8/qmake-hook.sh b/nixpkgs/pkgs/development/libraries/qt-4.x/4.8/qmake-hook.sh
new file mode 100644
index 000000000000..f288e99dd12a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-4.x/4.8/qmake-hook.sh
@@ -0,0 +1,16 @@
+qmakeConfigurePhase() {
+    runHook preConfigure
+
+    $QMAKE PREFIX=$out $qmakeFlags
+
+    if ! [[ -v enableParallelBuilding ]]; then
+        enableParallelBuilding=1
+        echo "qmake4Hook: enabled parallel building"
+    fi
+
+    runHook postConfigure
+}
+
+export QMAKE=@qt4@/bin/qmake
+
+configurePhase=qmakeConfigurePhase
diff --git a/nixpkgs/pkgs/development/libraries/qt-4.x/4.8/qsettings-recursive-global-mutex.patch b/nixpkgs/pkgs/development/libraries/qt-4.x/4.8/qsettings-recursive-global-mutex.patch
new file mode 100644
index 000000000000..229123c54f76
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-4.x/4.8/qsettings-recursive-global-mutex.patch
@@ -0,0 +1,17 @@
+Calling qsettings before constructing qapplications causes a dead-lock.
+
+http://sourceforge.net/tracker/?func=detail&aid=3168620&group_id=4932&atid=104932
+http://developer.qt.nokia.com/forums/viewthread/10365
+
+
+--- ./src/corelib/io/qsettings.cpp.orig
++++ ./src/corelib/io/qsettings.cpp
+@@ -122,7 +122,7 @@
+ Q_GLOBAL_STATIC(ConfFileCache, unusedCacheFunc)
+ Q_GLOBAL_STATIC(PathHash, pathHashFunc)
+ Q_GLOBAL_STATIC(CustomFormatVector, customFormatVectorFunc)
+-Q_GLOBAL_STATIC(QMutex, globalMutex)
++Q_GLOBAL_STATIC_WITH_ARGS(QMutex, globalMutex, (QMutex::Recursive))
+ static QSettings::Format globalDefaultFormat = QSettings::NativeFormat;
+ 
+ #ifndef Q_OS_WIN
diff --git a/nixpkgs/pkgs/development/libraries/qt-4.x/4.8/qt-4.8.7-unixmake-darwin.patch b/nixpkgs/pkgs/development/libraries/qt-4.x/4.8/qt-4.8.7-unixmake-darwin.patch
new file mode 100644
index 000000000000..99a36a24fe43
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-4.x/4.8/qt-4.8.7-unixmake-darwin.patch
@@ -0,0 +1,11 @@
+--- a/qmake/generators/unix/unixmake.cpp
++++ b/qmake/generators/unix/unixmake.cpp
+@@ -831,7 +831,7 @@ UnixMakefileGenerator::defaultInstall(const QString &t)
+             else if(project->first("TEMPLATE") == "app" && !project->isEmpty("QMAKE_STRIPFLAGS_APP"))
+                 ret += " " + var("QMAKE_STRIPFLAGS_APP");
+             if(bundle)
+-                ret = " \"" + dst_targ + "/Contents/MacOS/$(QMAKE_TARGET)\"";
++                ret += " \"" + dst_targ + "/Contents/MacOS/$(QMAKE_TARGET)\"";
+             else
+                 ret += " \"" + dst_targ + "\"";
+         }
diff --git a/nixpkgs/pkgs/development/libraries/qt-4.x/4.8/qt-musl-iconv-no-bom.patch b/nixpkgs/pkgs/development/libraries/qt-4.x/4.8/qt-musl-iconv-no-bom.patch
new file mode 100644
index 000000000000..35380ad6714d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-4.x/4.8/qt-musl-iconv-no-bom.patch
@@ -0,0 +1,11 @@
+--- qt-everywhere-opensource-src-4.8.5/src/corelib/codecs/qiconvcodec.cpp.orig
++++ qt-everywhere-opensource-src-4.8.5/src/corelib/codecs/qiconvcodec.cpp
+@@ -62,7 +62,7 @@
+ #elif defined(Q_OS_AIX)
+ #  define NO_BOM
+ #  define UTF16 "UCS-2"
+-#elif defined(Q_OS_FREEBSD) || defined(Q_OS_MAC)
++#elif defined(Q_OS_FREEBSD) || defined(Q_OS_MAC) || (defined(Q_OS_LINUX) && !defined(__GLIBC__))
+ #  define NO_BOM
+ #  if Q_BYTE_ORDER == Q_BIG_ENDIAN
+ #    define UTF16 "UTF-16BE"
diff --git a/nixpkgs/pkgs/development/libraries/qt-4.x/4.8/qt-musl.patch b/nixpkgs/pkgs/development/libraries/qt-4.x/4.8/qt-musl.patch
new file mode 100644
index 000000000000..90b9ccda08c9
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-4.x/4.8/qt-musl.patch
@@ -0,0 +1,14 @@
+--- qt-everywhere-opensource-src-4.8.5/mkspecs/linux-g++/qplatformdefs.h.orig
++++ qt-everywhere-opensource-src-4.8.5/mkspecs/linux-g++/qplatformdefs.h
+@@ -86,11 +86,7 @@
+ 
+ #undef QT_SOCKLEN_T
+ 
+-#if defined(__GLIBC__) && (__GLIBC__ >= 2)
+ #define QT_SOCKLEN_T            socklen_t
+-#else
+-#define QT_SOCKLEN_T            int
+-#endif
+ 
+ #if defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 500)
+ #define QT_SNPRINTF		::snprintf
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.11/default.nix b/nixpkgs/pkgs/development/libraries/qt-5/5.11/default.nix
new file mode 100644
index 000000000000..f43329d35539
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.11/default.nix
@@ -0,0 +1,153 @@
+/*
+
+# Updates
+
+Before a major version update, make a copy of this directory. (We like to
+keep the old version around for a short time after major updates.) Add a
+top-level attribute to `top-level/all-packages.nix`.
+
+1. Update the URL in `pkgs/development/libraries/qt-5/$VERSION/fetch.sh`.
+2. From the top of the Nixpkgs tree, run
+   `./maintainers/scripts/fetch-kde-qt.sh > pkgs/development/libraries/qt-5/$VERSION/srcs.nix`.
+3. Update `qtCompatVersion` below if the minor version number changes.
+4. Check that the new packages build correctly.
+5. Commit the changes and open a pull request.
+
+*/
+
+{
+  newScope,
+  stdenv, fetchurl, fetchFromGitHub, makeSetupHook,
+  bison, cups ? null, harfbuzz, libGL, perl,
+  gstreamer, gst-plugins-base, gtk3, dconf,
+  cf-private, llvmPackages_5,
+
+  # options
+  developerBuild ? false,
+  decryptSslTraffic ? false,
+  debug ? false,
+}:
+
+with stdenv.lib;
+
+let
+
+  qtCompatVersion = "5.11";
+
+  mirror = "https://download.qt.io";
+  srcs = import ./srcs.nix { inherit fetchurl; inherit mirror; } // {
+    # Community port of the now unmaintained upstream qtwebkit.
+    qtwebkit = {
+      src = fetchFromGitHub {
+        owner = "annulen";
+        repo = "webkit";
+        rev = "4ce8ebc4094512b9916bfa5984065e95ac97c9d8";
+        sha256 = "05h1xnxzbf7sp3plw5dndsvpf6iigh0bi4vlj4svx0hkf1giakjf";
+      };
+      version = "5.212-alpha-01-26-2018";
+    };
+  };
+
+  patches = {
+    qtbase = [
+      ./qtbase.patch
+      ./qtbase-fixguicmake.patch
+    ];
+    qtdeclarative = [ ./qtdeclarative.patch ];
+    qtscript = [ ./qtscript.patch ];
+    qtserialport = [ ./qtserialport.patch ];
+    qttools = [ ./qttools.patch ];
+    qtwebengine = [
+      ./qtwebengine-no-build-skip.patch
+      ./qtwebengine-darwin-no-platform-check.patch
+    ];
+    qtwebkit = [ ./qtwebkit.patch ];
+  };
+
+  mkDerivation =
+    import ../mkDerivation.nix {
+      inherit (stdenv) lib;
+      stdenv = if stdenv.cc.isClang then llvmPackages_5.stdenv else stdenv;
+    }
+    { inherit debug; };
+
+  qtModule =
+    import ../qtModule.nix
+    { inherit mkDerivation perl; inherit (stdenv) lib; }
+    { inherit self srcs patches; };
+
+  addPackages = self: with self;
+    let
+      callPackage = self.newScope { inherit qtCompatVersion qtModule srcs; };
+    in {
+
+      inherit mkDerivation;
+
+      qtbase = callPackage ../modules/qtbase.nix {
+        inherit (srcs.qtbase) src version;
+        patches = patches.qtbase;
+        inherit bison cups harfbuzz libGL;
+        withGtk3 = true; inherit dconf gtk3;
+        inherit developerBuild decryptSslTraffic;
+      };
+
+      qtcharts = callPackage ../modules/qtcharts.nix {};
+      qtconnectivity = callPackage ../modules/qtconnectivity.nix {
+        inherit cf-private;
+      };
+      qtdeclarative = callPackage ../modules/qtdeclarative.nix {};
+      qtdoc = callPackage ../modules/qtdoc.nix {};
+      qtgraphicaleffects = callPackage ../modules/qtgraphicaleffects.nix {};
+      qtimageformats = callPackage ../modules/qtimageformats.nix {};
+      qtlocation = callPackage ../modules/qtlocation.nix { };
+      qtmacextras = callPackage ../modules/qtmacextras.nix {
+        inherit cf-private;
+      };
+      qtmultimedia = callPackage ../modules/qtmultimedia.nix {
+        inherit gstreamer gst-plugins-base;
+      };
+      qtnetworkauth = callPackage ../modules/qtnetworkauth.nix {};
+      qtquick1 = null;
+      qtquickcontrols = callPackage ../modules/qtquickcontrols.nix {};
+      qtquickcontrols2 = callPackage ../modules/qtquickcontrols2.nix {};
+      qtscript = callPackage ../modules/qtscript.nix {};
+      qtsensors = callPackage ../modules/qtsensors.nix {};
+      qtserialport = callPackage ../modules/qtserialport.nix {};
+      qtspeech = callPackage ../modules/qtspeech.nix {};
+      qtsvg = callPackage ../modules/qtsvg.nix {};
+      qttools = callPackage ../modules/qttools.nix {};
+      qttranslations = callPackage ../modules/qttranslations.nix {};
+      qtvirtualkeyboard = callPackage ../modules/qtvirtualkeyboard.nix {};
+      qtwayland = callPackage ../modules/qtwayland.nix {};
+      qtwebchannel = callPackage ../modules/qtwebchannel.nix {};
+      qtwebengine = callPackage ../modules/qtwebengine.nix {};
+      qtwebglplugin = callPackage ../modules/qtwebglplugin.nix {};
+      qtwebkit = callPackage ../modules/qtwebkit.nix {};
+      qtwebsockets = callPackage ../modules/qtwebsockets.nix {};
+      qtwebview = callPackage ../modules/qtwebview.nix {};
+      qtx11extras = callPackage ../modules/qtx11extras.nix {};
+      qtxmlpatterns = callPackage ../modules/qtxmlpatterns.nix {};
+
+      env = callPackage ../qt-env.nix {};
+      full = env "qt-full-${qtbase.version}" ([
+        qtcharts qtconnectivity qtdeclarative qtdoc qtgraphicaleffects
+        qtimageformats qtlocation qtmultimedia qtquickcontrols qtquickcontrols2
+        qtscript qtsensors qtserialport qtsvg qttools qttranslations
+        qtvirtualkeyboard qtwebchannel qtwebengine qtwebkit qtwebsockets
+        qtwebview qtx11extras qtxmlpatterns
+      ] ++ optional (!stdenv.isDarwin) qtwayland
+        ++ optional (stdenv.isDarwin) qtmacextras);
+
+      qmake = makeSetupHook {
+        deps = [ self.qtbase.dev ];
+        substitutions = {
+          inherit (stdenv) isDarwin;
+          qtbase_dev = self.qtbase.dev;
+          fix_qt_builtin_paths = ../hooks/fix-qt-builtin-paths.sh;
+        };
+      } ../hooks/qmake-hook.sh;
+    };
+
+   self = makeScope newScope addPackages;
+
+in self
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.11/fetch.sh b/nixpkgs/pkgs/development/libraries/qt-5/5.11/fetch.sh
new file mode 100644
index 000000000000..2ab3dd71c24f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.11/fetch.sh
@@ -0,0 +1 @@
+WGET_ARGS=( http://download.qt.io/official_releases/qt/5.11/5.11.3/submodules/ )
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.11/qtbase-fixguicmake.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.11/qtbase-fixguicmake.patch
new file mode 100644
index 000000000000..8b46d432812a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.11/qtbase-fixguicmake.patch
@@ -0,0 +1,30 @@
+diff --git a/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in b/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
+index 0bbc871..3673634 100644
+--- a/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
++++ b/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
+@@ -286,7 +286,7 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
+     macro(_populate_$${CMAKE_MODULE_NAME}_plugin_properties Plugin Configuration PLUGIN_LOCATION)
+         set_property(TARGET Qt5::${Plugin} APPEND PROPERTY IMPORTED_CONFIGURATIONS ${Configuration})
+ 
+-        set(imported_location \"$${CMAKE_PLUGIN_DIR}${PLUGIN_LOCATION}\")
++        set(imported_location \"${PLUGIN_LOCATION}\")
+         _qt5_$${CMAKE_MODULE_NAME}_check_file_exists(${imported_location})
+         set_target_properties(Qt5::${Plugin} PROPERTIES
+             \"IMPORTED_LOCATION_${Configuration}\" ${imported_location}
+diff --git a/mkspecs/features/data/cmake/Qt5PluginTarget.cmake.in b/mkspecs/features/data/cmake/Qt5PluginTarget.cmake.in
+index 5baf0fd..3583745 100644
+--- a/mkspecs/features/data/cmake/Qt5PluginTarget.cmake.in
++++ b/mkspecs/features/data/cmake/Qt5PluginTarget.cmake.in
+@@ -2,10 +2,10 @@
+ add_library(Qt5::$$CMAKE_PLUGIN_NAME MODULE IMPORTED)
+ 
+ !!IF !isEmpty(CMAKE_RELEASE_TYPE)
+-_populate_$${CMAKE_MODULE_NAME}_plugin_properties($$CMAKE_PLUGIN_NAME RELEASE \"$${CMAKE_PLUGIN_LOCATION_RELEASE}\")
++_populate_$${CMAKE_MODULE_NAME}_plugin_properties($$CMAKE_PLUGIN_NAME RELEASE \"$${CMAKE_PLUGIN_DIR}$${CMAKE_PLUGIN_LOCATION_RELEASE}\")
+ !!ENDIF
+ !!IF !isEmpty(CMAKE_DEBUG_TYPE)
+-_populate_$${CMAKE_MODULE_NAME}_plugin_properties($$CMAKE_PLUGIN_NAME DEBUG \"$${CMAKE_PLUGIN_LOCATION_DEBUG}\")
++_populate_$${CMAKE_MODULE_NAME}_plugin_properties($$CMAKE_PLUGIN_NAME DEBUG \"$${CMAKE_PLUGIN_DIR}$${CMAKE_PLUGIN_LOCATION_DEBUG}\")
+ !!ENDIF
+ 
+ list(APPEND Qt5$${CMAKE_MODULE_NAME}_PLUGINS Qt5::$$CMAKE_PLUGIN_NAME)
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.11/qtbase.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.11/qtbase.patch
new file mode 100644
index 000000000000..7d8407f6daf8
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.11/qtbase.patch
@@ -0,0 +1,1106 @@
+diff -ur qtbase-everywhere-src-5.11.3-orig/mkspecs/common/mac.conf qtbase-everywhere-src-5.11.3/mkspecs/common/mac.conf
+--- qtbase-everywhere-src-5.11.3-orig/mkspecs/common/mac.conf	2018-11-25 13:51:11.000000000 +0100
++++ qtbase-everywhere-src-5.11.3/mkspecs/common/mac.conf	2019-01-31 00:42:55.843577249 +0100
+@@ -23,7 +23,7 @@
+ 
+ QMAKE_FIX_RPATH         = install_name_tool -id
+ 
+-QMAKE_LFLAGS_RPATH      = -Wl,-rpath,
++QMAKE_LFLAGS_RPATH      =
+ QMAKE_LFLAGS_GCSECTIONS = -Wl,-dead_strip
+ 
+ QMAKE_LFLAGS_REL_RPATH  =
+diff -ur qtbase-everywhere-src-5.11.3-orig/mkspecs/features/create_cmake.prf qtbase-everywhere-src-5.11.3/mkspecs/features/create_cmake.prf
+--- qtbase-everywhere-src-5.11.3-orig/mkspecs/features/create_cmake.prf	2018-11-25 13:51:11.000000000 +0100
++++ qtbase-everywhere-src-5.11.3/mkspecs/features/create_cmake.prf	2019-01-31 00:42:55.843577249 +0100
+@@ -21,7 +21,7 @@
+ # at cmake time whether package has been found via a symlink, and correct
+ # that to an absolute path. This is only done for installations to
+ # the /usr or / prefix.
+-CMAKE_INSTALL_LIBS_DIR = $$cmakeTargetPath($$[QT_INSTALL_LIBS])
++CMAKE_INSTALL_LIBS_DIR = $$cmakeTargetPath($$NIX_OUTPUT_OUT/lib/)
+ contains(CMAKE_INSTALL_LIBS_DIR, ^(/usr)?/lib(64)?.*): CMAKE_USR_MOVE_WORKAROUND = $$CMAKE_INSTALL_LIBS_DIR
+ 
+ CMAKE_OUT_DIR = $$MODULE_BASE_OUTDIR/lib/cmake
+@@ -51,45 +51,20 @@
+         $$cmake_extra_source_includes.output
+ }
+ 
+-CMAKE_INCLUDE_DIR = $$cmakeRelativePath($$[QT_INSTALL_HEADERS], $$[QT_INSTALL_PREFIX])
+-contains(CMAKE_INCLUDE_DIR, "^\\.\\./.*") {
+-    CMAKE_INCLUDE_DIR = $$[QT_INSTALL_HEADERS]/
+-    CMAKE_INCLUDE_DIR_IS_ABSOLUTE = True
+-}
++CMAKE_INCLUDE_DIR = $$NIX_OUTPUT_DEV/include/
++CMAKE_INCLUDE_DIR_IS_ABSOLUTE = True
+ 
+-CMAKE_LIB_DIR = $$cmakeRelativePath($$[QT_INSTALL_LIBS], $$[QT_INSTALL_PREFIX])
+-contains(CMAKE_LIB_DIR,"^\\.\\./.*") {
+-    CMAKE_LIB_DIR = $$[QT_INSTALL_LIBS]/
+-    CMAKE_LIB_DIR_IS_ABSOLUTE = True
+-} else {
+-    CMAKE_RELATIVE_INSTALL_LIBS_DIR = $$cmakeRelativePath($$[QT_INSTALL_PREFIX], $$[QT_INSTALL_LIBS])
+-    # We need to go up another two levels because the CMake files are
+-    # installed in $${CMAKE_LIB_DIR}/cmake/Qt5$${CMAKE_MODULE_NAME}
+-    CMAKE_RELATIVE_INSTALL_DIR = "$${CMAKE_RELATIVE_INSTALL_LIBS_DIR}../../"
+-}
++CMAKE_BIN_DIR = $$NIX_OUTPUT_BIN/bin/
++CMAKE_BIN_DIR_IS_ABSOLUTE = True
+ 
+-CMAKE_BIN_DIR = $$cmakeRelativePath($$[QT_HOST_BINS], $$[QT_INSTALL_PREFIX])
+-contains(CMAKE_BIN_DIR, "^\\.\\./.*") {
+-    CMAKE_BIN_DIR = $$[QT_HOST_BINS]/
+-    CMAKE_BIN_DIR_IS_ABSOLUTE = True
+-}
++CMAKE_LIB_DIR = $$NIX_OUTPUT_OUT/lib/
++CMAKE_LIB_DIR_IS_ABSOLUTE = True
+ 
+-CMAKE_PLUGIN_DIR = $$cmakeRelativePath($$[QT_INSTALL_PLUGINS], $$[QT_INSTALL_PREFIX])
+-contains(CMAKE_PLUGIN_DIR, "^\\.\\./.*") {
+-    CMAKE_PLUGIN_DIR = $$[QT_INSTALL_PLUGINS]/
+-    CMAKE_PLUGIN_DIR_IS_ABSOLUTE = True
+-}
+-
+-win32:!static:!staticlib {
+-    CMAKE_DLL_DIR = $$cmakeRelativePath($$[QT_INSTALL_BINS], $$[QT_INSTALL_PREFIX])
+-    contains(CMAKE_DLL_DIR, "^\\.\\./.*") {
+-        CMAKE_DLL_DIR = $$[QT_INSTALL_BINS]/
+-        CMAKE_DLL_DIR_IS_ABSOLUTE = True
+-    }
+-} else {
+-    CMAKE_DLL_DIR = $$CMAKE_LIB_DIR
+-    CMAKE_DLL_DIR_IS_ABSOLUTE = $$CMAKE_LIB_DIR_IS_ABSOLUTE
+-}
++CMAKE_PLUGIN_DIR = $$NIX_OUTPUT_PLUGIN/
++CMAKE_PLUGIN_DIR_IS_ABSOLUTE = True
++ 
++CMAKE_DLL_DIR = $$NIX_OUTPUT_OUT/lib/
++CMAKE_DLL_DIR_IS_ABSOLUTE = True
+ 
+ static|staticlib:CMAKE_STATIC_TYPE = true
+ 
+@@ -169,7 +144,7 @@
+       cmake_target_file
+ 
+     cmake_qt5_plugin_file.files = $$cmake_target_file.output
+-    cmake_qt5_plugin_file.path = $$[QT_INSTALL_LIBS]/cmake/Qt5$${CMAKE_MODULE_NAME}
++    cmake_qt5_plugin_file.path = $$NIX_OUTPUT_OUT/lib/cmake/Qt5$${CMAKE_MODULE_NAME}
+     INSTALLS += cmake_qt5_plugin_file
+ 
+     return()
+@@ -316,7 +291,7 @@
+     cmake_qt5_module_files.files += $$cmake_macros_file.output
+ }
+ 
+-cmake_qt5_module_files.path = $$[QT_INSTALL_LIBS]/cmake/Qt5$${CMAKE_MODULE_NAME}
++cmake_qt5_module_files.path = $$NIX_OUTPUT_OUT/lib/cmake/Qt5$${CMAKE_MODULE_NAME}
+ 
+ # We are generating cmake files. Most developers of Qt are not aware of cmake,
+ # so we require automatic tests to be available. The only module which should
+diff -ur qtbase-everywhere-src-5.11.3-orig/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in qtbase-everywhere-src-5.11.3/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
+--- qtbase-everywhere-src-5.11.3-orig/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in	2018-11-25 13:51:11.000000000 +0100
++++ qtbase-everywhere-src-5.11.3/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in	2019-01-31 00:42:55.843577249 +0100
+@@ -3,30 +3,6 @@
+     message(FATAL_ERROR \"Qt 5 $${CMAKE_MODULE_NAME} module requires at least CMake version 3.1.0\")
+ endif()
+ 
+-!!IF !isEmpty(CMAKE_USR_MOVE_WORKAROUND)
+-!!IF !isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-set(_qt5$${CMAKE_MODULE_NAME}_install_prefix \"$$[QT_INSTALL_PREFIX]\")
+-!!ELSE
+-get_filename_component(_IMPORT_PREFIX \"${CMAKE_CURRENT_LIST_FILE}\" PATH)
+-# Use original install prefix when loaded through a
+-# cross-prefix symbolic link such as /lib -> /usr/lib.
+-get_filename_component(_realCurr \"${_IMPORT_PREFIX}\" REALPATH)
+-get_filename_component(_realOrig \"$$CMAKE_INSTALL_LIBS_DIR/cmake/Qt5$${CMAKE_MODULE_NAME}\" REALPATH)
+-if(_realCurr STREQUAL _realOrig)
+-    get_filename_component(_qt5$${CMAKE_MODULE_NAME}_install_prefix \"$$CMAKE_INSTALL_LIBS_DIR/$${CMAKE_RELATIVE_INSTALL_LIBS_DIR}\" ABSOLUTE)
+-else()
+-    get_filename_component(_qt5$${CMAKE_MODULE_NAME}_install_prefix \"${CMAKE_CURRENT_LIST_DIR}/$${CMAKE_RELATIVE_INSTALL_DIR}\" ABSOLUTE)
+-endif()
+-unset(_realOrig)
+-unset(_realCurr)
+-unset(_IMPORT_PREFIX)
+-!!ENDIF
+-!!ELIF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-get_filename_component(_qt5$${CMAKE_MODULE_NAME}_install_prefix \"${CMAKE_CURRENT_LIST_DIR}/$${CMAKE_RELATIVE_INSTALL_DIR}\" ABSOLUTE)
+-!!ELSE
+-set(_qt5$${CMAKE_MODULE_NAME}_install_prefix \"$$[QT_INSTALL_PREFIX]\")
+-!!ENDIF
+-
+ !!IF !equals(TEMPLATE, aux)
+ # For backwards compatibility only. Use Qt5$${CMAKE_MODULE_NAME}_VERSION instead.
+ set(Qt5$${CMAKE_MODULE_NAME}_VERSION_STRING "$$eval(QT.$${MODULE}.VERSION)")
+@@ -52,11 +28,7 @@
+ macro(_populate_$${CMAKE_MODULE_NAME}_target_properties Configuration LIB_LOCATION IMPLIB_LOCATION)
+     set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} APPEND PROPERTY IMPORTED_CONFIGURATIONS ${Configuration})
+ 
+-!!IF isEmpty(CMAKE_DLL_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_DLL_DIR}${LIB_LOCATION}\")
+-!!ELSE
+     set(imported_location \"$${CMAKE_DLL_DIR}${LIB_LOCATION}\")
+-!!ENDIF
+     _qt5_$${CMAKE_MODULE_NAME}_check_file_exists(${imported_location})
+     set_target_properties(Qt5::$${CMAKE_MODULE_NAME} PROPERTIES
+         \"INTERFACE_LINK_LIBRARIES\" \"${_Qt5$${CMAKE_MODULE_NAME}_LIB_DEPENDENCIES}\"
+@@ -69,11 +41,7 @@
+     )
+ 
+ !!IF !isEmpty(CMAKE_WINDOWS_BUILD)
+-!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-    set(imported_implib \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\")
+-!!ELSE
+     set(imported_implib \"IMPORTED_IMPLIB_${Configuration}\" \"$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\")
+-!!ENDIF
+     _qt5_$${CMAKE_MODULE_NAME}_check_file_exists(${imported_implib})
+     if(NOT \"${IMPLIB_LOCATION}\" STREQUAL \"\")
+         set_target_properties(Qt5::$${CMAKE_MODULE_NAME} PROPERTIES
+@@ -89,24 +57,13 @@
+ !!IF !no_module_headers
+ !!IF !isEmpty(CMAKE_BUILD_IS_FRAMEWORK)
+     set(_Qt5$${CMAKE_MODULE_NAME}_OWN_INCLUDE_DIRS
+-      \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}Qt$${CMAKE_MODULE_NAME}.framework\"
+-      \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}Qt$${CMAKE_MODULE_NAME}.framework/Headers\"
++      \"$${CMAKE_LIB_DIR}Qt$${CMAKE_MODULE_NAME}.framework\"
++      \"$${CMAKE_LIB_DIR}Qt$${CMAKE_MODULE_NAME}.framework/Headers\"
+     )
+ !!IF isEmpty(CMAKE_NO_PRIVATE_INCLUDES)
+     set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS
+-        \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}Qt$${CMAKE_MODULE_NAME}.framework/Versions/$$section(VERSION, ., 0, 0)/Headers/$$VERSION/\"
+-        \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}Qt$${CMAKE_MODULE_NAME}.framework/Versions/$$section(VERSION, ., 0, 0)/Headers/$$VERSION/$${MODULE_INCNAME}\"
+-    )
+-!!ELSE
+-    set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS \"\")
+-!!ENDIF
+-!!ELSE
+-!!IF isEmpty(CMAKE_INCLUDE_DIR_IS_ABSOLUTE)
+-    set(_Qt5$${CMAKE_MODULE_NAME}_OWN_INCLUDE_DIRS \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$$CMAKE_INCLUDE_DIR\" \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_INCLUDE_DIR}$${MODULE_INCNAME}\")
+-!!IF isEmpty(CMAKE_NO_PRIVATE_INCLUDES)
+-    set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS
+-        \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_INCLUDE_DIR}$${MODULE_INCNAME}/$$VERSION\"
+-        \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_INCLUDE_DIR}$${MODULE_INCNAME}/$$VERSION/$${MODULE_INCNAME}\"
++        \"$${CMAKE_LIB_DIR}Qt$${CMAKE_MODULE_NAME}.framework/Versions/$$section(VERSION, ., 0, 0)/Headers/$$VERSION/\"
++        \"$${CMAKE_LIB_DIR}Qt$${CMAKE_MODULE_NAME}.framework/Versions/$$section(VERSION, ., 0, 0)/Headers/$$VERSION/$${MODULE_INCNAME}\"
+     )
+ !!ELSE
+     set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS \"\")
+@@ -122,7 +79,6 @@
+     set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS \"\")
+ !!ENDIF
+ !!ENDIF
+-!!ENDIF
+ !!IF !isEmpty(CMAKE_ADD_SOURCE_INCLUDE_DIRS)
+     include(\"${CMAKE_CURRENT_LIST_DIR}/ExtraSourceIncludes.cmake\" OPTIONAL)
+ !!ENDIF
+@@ -269,25 +225,13 @@
+ !!IF !isEmpty(CMAKE_FIND_OTHER_LIBRARY_BUILD)
+ !!IF isEmpty(CMAKE_DEBUG_TYPE)
+ !!IF !isEmpty(CMAKE_STATIC_WINDOWS_BUILD)
+-!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-    if (EXISTS \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" )
+-!!ELSE // CMAKE_LIB_DIR_IS_ABSOLUTE
+     if (EXISTS \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" )
+-!!ENDIF // CMAKE_LIB_DIR_IS_ABSOLUTE
+         _populate_$${CMAKE_MODULE_NAME}_target_properties(DEBUG \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" \"\" )
+ !!ELSE // CMAKE_STATIC_WINDOWS_BUILD
+     if (EXISTS
+-!!IF isEmpty(CMAKE_DLL_DIR_IS_ABSOLUTE)
+-        \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_DLL_DIR}$${CMAKE_LIB_FILE_LOCATION_DEBUG}\"
+-!!ELSE
+         \"$${CMAKE_LIB_FILE_LOCATION_DEBUG}\"
+-!!ENDIF
+       AND EXISTS
+-!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-        \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" )
+-!!ELSE
+         \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" )
+-!!ENDIF
+         _populate_$${CMAKE_MODULE_NAME}_target_properties(DEBUG \"$${CMAKE_LIB_FILE_LOCATION_DEBUG}\" \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" )
+ !!ENDIF // CMAKE_STATIC_WINDOWS_BUILD
+     endif()
+@@ -306,25 +250,13 @@
+ !!IF !isEmpty(CMAKE_FIND_OTHER_LIBRARY_BUILD)
+ !!IF isEmpty(CMAKE_RELEASE_TYPE)
+ !!IF !isEmpty(CMAKE_STATIC_WINDOWS_BUILD)
+-!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-    if (EXISTS \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" )
+-!!ELSE // CMAKE_LIB_DIR_IS_ABSOLUTE
+     if (EXISTS \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" )
+-!!ENDIF // CMAKE_LIB_DIR_IS_ABSOLUTE
+         _populate_$${CMAKE_MODULE_NAME}_target_properties(RELEASE \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" \"\" )
+ !!ELSE // CMAKE_STATIC_WINDOWS_BUILD
+     if (EXISTS
+-!!IF isEmpty(CMAKE_DLL_DIR_IS_ABSOLUTE)
+-        \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_DLL_DIR}$${CMAKE_LIB_FILE_LOCATION_RELEASE}\"
+-!!ELSE
+         \"$${CMAKE_LIB_FILE_LOCATION_RELEASE}\"
+-!!ENDIF
+       AND EXISTS
+-!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-        \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" )
+-!!ELSE
+         \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" )
+-!!ENDIF
+         _populate_$${CMAKE_MODULE_NAME}_target_properties(RELEASE \"$${CMAKE_LIB_FILE_LOCATION_RELEASE}\" \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" )
+ !!ENDIF // CMAKE_STATIC_WINDOWS_BUILD
+     endif()
+@@ -343,11 +275,7 @@
+     macro(_populate_$${CMAKE_MODULE_NAME}_plugin_properties Plugin Configuration PLUGIN_LOCATION)
+         set_property(TARGET Qt5::${Plugin} APPEND PROPERTY IMPORTED_CONFIGURATIONS ${Configuration})
+ 
+-!!IF isEmpty(CMAKE_PLUGIN_DIR_IS_ABSOLUTE)
+-        set(imported_location \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_PLUGIN_DIR}${PLUGIN_LOCATION}\")
+-!!ELSE
+         set(imported_location \"$${CMAKE_PLUGIN_DIR}${PLUGIN_LOCATION}\")
+-!!ENDIF
+         _qt5_$${CMAKE_MODULE_NAME}_check_file_exists(${imported_location})
+         set_target_properties(Qt5::${Plugin} PROPERTIES
+             \"IMPORTED_LOCATION_${Configuration}\" ${imported_location}
+diff -ur qtbase-everywhere-src-5.11.3-orig/mkspecs/features/mac/default_post.prf qtbase-everywhere-src-5.11.3/mkspecs/features/mac/default_post.prf
+--- qtbase-everywhere-src-5.11.3-orig/mkspecs/features/mac/default_post.prf	2018-11-25 13:51:11.000000000 +0100
++++ qtbase-everywhere-src-5.11.3/mkspecs/features/mac/default_post.prf	2019-01-31 00:45:14.585621324 +0100
+@@ -62,199 +62,3 @@
+         }
+     }
+ }
+-
+-# Add the same default rpaths as Xcode does for new projects.
+-# This is especially important for iOS/tvOS/watchOS where no other option is possible.
+-!no_default_rpath {
+-    QMAKE_RPATHDIR += @executable_path/Frameworks
+-    equals(TEMPLATE, lib):!plugin:lib_bundle: QMAKE_RPATHDIR += @loader_path/Frameworks
+-}
+-
+-# Don't pass -headerpad_max_install_names when using Bitcode.
+-# In that case the linker emits a warning stating that the flag is ignored when
+-# used with bitcode, for reasons that cannot be determined (rdar://problem/20748962).
+-# Using this flag is also unnecessary in practice on UIKit platforms since they
+-# are sandboxed, and only UIKit platforms support bitcode to begin with.
+-!bitcode: QMAKE_LFLAGS += $$QMAKE_LFLAGS_HEADERPAD
+-
+-app_extension_api_only {
+-    QMAKE_CFLAGS              += $$QMAKE_CFLAGS_APPLICATION_EXTENSION
+-    QMAKE_CXXFLAGS            += $$QMAKE_CFLAGS_APPLICATION_EXTENSION
+-    QMAKE_CXXFLAGS_PRECOMPILE += $$QMAKE_CFLAGS_APPLICATION_EXTENSION
+-    QMAKE_LFLAGS              += $$QMAKE_CFLAGS_APPLICATION_EXTENSION
+-}
+-
+-macx-xcode {
+-    qmake_pkginfo_typeinfo.name = QMAKE_PKGINFO_TYPEINFO
+-    !isEmpty(QMAKE_PKGINFO_TYPEINFO): \
+-        qmake_pkginfo_typeinfo.value = $$QMAKE_PKGINFO_TYPEINFO
+-    else: \
+-        qmake_pkginfo_typeinfo.value = "????"
+-    QMAKE_MAC_XCODE_SETTINGS += qmake_pkginfo_typeinfo
+-
+-    !isEmpty(VERSION) {
+-        l = $$split(VERSION, '.') 0 0  # make sure there are at least three
+-        VER_MAJ = $$member(l, 0, 0)
+-        VER_MIN = $$member(l, 1, 1)
+-        VER_PAT = $$member(l, 2, 2)
+-        unset(l)
+-
+-        qmake_full_version.name = QMAKE_FULL_VERSION
+-        qmake_full_version.value = $${VER_MAJ}.$${VER_MIN}.$${VER_PAT}
+-        QMAKE_MAC_XCODE_SETTINGS += qmake_full_version
+-
+-        qmake_short_version.name = QMAKE_SHORT_VERSION
+-        qmake_short_version.value = $${VER_MAJ}.$${VER_MIN}
+-        QMAKE_MAC_XCODE_SETTINGS += qmake_short_version
+-    }
+-
+-    !isEmpty(QMAKE_XCODE_DEBUG_INFORMATION_FORMAT) {
+-        debug_information_format.name = DEBUG_INFORMATION_FORMAT
+-        debug_information_format.value = $$QMAKE_XCODE_DEBUG_INFORMATION_FORMAT
+-        debug_information_format.build = debug
+-        QMAKE_MAC_XCODE_SETTINGS += debug_information_format
+-    }
+-
+-    QMAKE_XCODE_ARCHS =
+-
+-    arch_device.name = "ARCHS[sdk=$${device.sdk}*]"
+-    arch_device.value = $$QMAKE_APPLE_DEVICE_ARCHS
+-    QMAKE_XCODE_ARCHS += $$QMAKE_APPLE_DEVICE_ARCHS
+-    QMAKE_MAC_XCODE_SETTINGS += arch_device
+-
+-    simulator {
+-        arch_simulator.name = "ARCHS[sdk=$${simulator.sdk}*]"
+-        arch_simulator.value = $$QMAKE_APPLE_SIMULATOR_ARCHS
+-        QMAKE_XCODE_ARCHS += $$QMAKE_APPLE_SIMULATOR_ARCHS
+-        QMAKE_MAC_XCODE_SETTINGS += arch_simulator
+-    }
+-
+-    only_active_arch.name = ONLY_ACTIVE_ARCH
+-    only_active_arch.value = YES
+-    only_active_arch.build = debug
+-    QMAKE_MAC_XCODE_SETTINGS += only_active_arch
+-} else {
+-    device|!simulator: VALID_DEVICE_ARCHS = $$QMAKE_APPLE_DEVICE_ARCHS
+-    simulator: VALID_SIMULATOR_ARCHS = $$QMAKE_APPLE_SIMULATOR_ARCHS
+-    VALID_ARCHS = $$VALID_DEVICE_ARCHS $$VALID_SIMULATOR_ARCHS
+-
+-    isEmpty(VALID_ARCHS): \
+-        error("QMAKE_APPLE_DEVICE_ARCHS or QMAKE_APPLE_SIMULATOR_ARCHS must contain at least one architecture")
+-
+-    single_arch: VALID_ARCHS = $$first(VALID_ARCHS)
+-
+-    ACTIVE_ARCHS = $(filter $(EXPORT_VALID_ARCHS), $(ARCHS))
+-    ARCH_ARGS = $(foreach arch, $(if $(EXPORT_ACTIVE_ARCHS), $(EXPORT_ACTIVE_ARCHS), $(EXPORT_VALID_ARCHS)), -arch $(arch))
+-
+-    QMAKE_EXTRA_VARIABLES += VALID_ARCHS ACTIVE_ARCHS ARCH_ARGS
+-
+-    arch_flags = $(EXPORT_ARCH_ARGS)
+-
+-    QMAKE_CFLAGS += $$arch_flags
+-    QMAKE_CXXFLAGS += $$arch_flags
+-    QMAKE_LFLAGS += $$arch_flags
+-
+-    QMAKE_PCH_ARCHS = $$VALID_ARCHS
+-
+-    macos: deployment_target = $$QMAKE_MACOSX_DEPLOYMENT_TARGET
+-    ios: deployment_target = $$QMAKE_IOS_DEPLOYMENT_TARGET
+-    tvos: deployment_target = $$QMAKE_TVOS_DEPLOYMENT_TARGET
+-    watchos: deployment_target = $$QMAKE_WATCHOS_DEPLOYMENT_TARGET
+-
+-    # If we're doing a simulator and device build, device and simulator
+-    # architectures use different paths and flags for the sysroot and
+-    # deployment target switch, so we must multiplex them across multiple
+-    # architectures using -Xarch. Otherwise we fall back to the simple path.
+-    # This is not strictly necessary, but results in cleaner command lines
+-    # and makes it easier for people to override EXPORT_VALID_ARCHS to limit
+-    # individual rules to a different set of architecture(s) from the overall
+-    # build (such as machtest in QtCore).
+-    simulator:device {
+-        QMAKE_XARCH_CFLAGS =
+-        QMAKE_XARCH_LFLAGS =
+-        QMAKE_EXTRA_VARIABLES += QMAKE_XARCH_CFLAGS QMAKE_XARCH_LFLAGS
+-
+-        for (arch, VALID_ARCHS) {
+-            contains(VALID_SIMULATOR_ARCHS, $$arch) {
+-                sdk = $$simulator.sdk
+-                version_identifier = $$simulator.deployment_identifier
+-            } else {
+-                sdk = $$device.sdk
+-                version_identifier = $$device.deployment_identifier
+-            }
+-
+-            version_min_flags = \
+-                -Xarch_$${arch} \
+-                -m$${version_identifier}-version-min=$$deployment_target
+-            QMAKE_XARCH_CFLAGS_$${arch} = $$version_min_flags \
+-                -Xarch_$${arch} \
+-                -isysroot$$xcodeSDKInfo(Path, $$sdk)
+-            QMAKE_XARCH_LFLAGS_$${arch} = $$version_min_flags \
+-                -Xarch_$${arch} \
+-                -Wl,-syslibroot,$$xcodeSDKInfo(Path, $$sdk)
+-
+-            QMAKE_XARCH_CFLAGS += $(EXPORT_QMAKE_XARCH_CFLAGS_$${arch})
+-            QMAKE_XARCH_LFLAGS += $(EXPORT_QMAKE_XARCH_LFLAGS_$${arch})
+-
+-            QMAKE_EXTRA_VARIABLES += \
+-                QMAKE_XARCH_CFLAGS_$${arch} \
+-                QMAKE_XARCH_LFLAGS_$${arch}
+-        }
+-
+-        QMAKE_CFLAGS += $(EXPORT_QMAKE_XARCH_CFLAGS)
+-        QMAKE_CXXFLAGS += $(EXPORT_QMAKE_XARCH_CFLAGS)
+-        QMAKE_LFLAGS += $(EXPORT_QMAKE_XARCH_LFLAGS)
+-    } else {
+-        simulator: \
+-            version_identifier = $$simulator.deployment_identifier
+-        else: \
+-            version_identifier = $$device.deployment_identifier
+-        version_min_flag = -m$${version_identifier}-version-min=$$deployment_target
+-        QMAKE_CFLAGS += -isysroot $$QMAKE_MAC_SDK_PATH $$version_min_flag
+-        QMAKE_CXXFLAGS += -isysroot $$QMAKE_MAC_SDK_PATH $$version_min_flag
+-        QMAKE_LFLAGS += -Wl,-syslibroot,$$QMAKE_MAC_SDK_PATH $$version_min_flag
+-    }
+-
+-    # Enable precompiled headers for multiple architectures
+-    QMAKE_CFLAGS_USE_PRECOMPILE =
+-    for (arch, VALID_ARCHS) {
+-        icc_pch_style: \
+-            use_flag = "-pch-use "
+-        else: \
+-            use_flag = -include
+-
+-        # Only use Xarch with multi-arch, as the option confuses ccache
+-        count(VALID_ARCHS, 1, greaterThan): \
+-            QMAKE_CFLAGS_USE_PRECOMPILE += \
+-                -Xarch_$${arch}
+-
+-        QMAKE_CFLAGS_USE_PRECOMPILE += \
+-            $${use_flag}${QMAKE_PCH_OUTPUT_$${arch}}
+-    }
+-    icc_pch_style {
+-        QMAKE_CXXFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE -include ${QMAKE_PCH_INPUT}
+-        QMAKE_CFLAGS_USE_PRECOMPILE =
+-    } else {
+-        QMAKE_CXXFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE
+-        QMAKE_OBJCFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE
+-        QMAKE_OBJCXXFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE
+-    }
+-
+-    QMAKE_PCH_OUTPUT_EXT = _${QMAKE_PCH_ARCH}$${QMAKE_PCH_OUTPUT_EXT}
+-}
+-
+-cache(QMAKE_XCODE_DEVELOPER_PATH, stash)
+-!isEmpty(QMAKE_XCODE_VERSION): \
+-    cache(QMAKE_XCODE_VERSION, stash)
+-
+-QMAKE_XCODE_LIBRARY_SUFFIX = $$qtPlatformTargetSuffix()
+-
+-xcode_product_bundle_identifier_setting.name = PRODUCT_BUNDLE_IDENTIFIER
+-xcode_product_bundle_identifier_setting.value = $$QMAKE_TARGET_BUNDLE_PREFIX
+-isEmpty(xcode_product_bundle_identifier_setting.value): \
+-    xcode_product_bundle_identifier_setting.value = "com.yourcompany"
+-xcode_product_bundle_target = $$QMAKE_BUNDLE
+-isEmpty(xcode_product_bundle_target): \
+-    xcode_product_bundle_target = ${PRODUCT_NAME:rfc1034identifier}
+-xcode_product_bundle_identifier_setting.value = "$${xcode_product_bundle_identifier_setting.value}.$${xcode_product_bundle_target}"
+-QMAKE_MAC_XCODE_SETTINGS += xcode_product_bundle_identifier_setting
+Only in qtbase-everywhere-src-5.11.3/mkspecs/features/mac: default_post.prf.orig
+diff -ur qtbase-everywhere-src-5.11.3-orig/mkspecs/features/mac/default_pre.prf qtbase-everywhere-src-5.11.3/mkspecs/features/mac/default_pre.prf
+--- qtbase-everywhere-src-5.11.3-orig/mkspecs/features/mac/default_pre.prf	2018-11-25 13:51:11.000000000 +0100
++++ qtbase-everywhere-src-5.11.3/mkspecs/features/mac/default_pre.prf	2019-01-31 00:42:55.843577249 +0100
+@@ -1,60 +1,2 @@
+ CONFIG = asset_catalogs rez $$CONFIG
+ load(default_pre)
+-
+-isEmpty(QMAKE_XCODE_DEVELOPER_PATH) {
+-    # Get path of Xcode's Developer directory
+-    QMAKE_XCODE_DEVELOPER_PATH = $$system("/usr/bin/xcode-select --print-path 2>/dev/null")
+-    isEmpty(QMAKE_XCODE_DEVELOPER_PATH): \
+-        error("Xcode path is not set. Please use xcode-select to choose Xcode installation path.")
+-
+-    # Make sure Xcode path is valid
+-    !exists($$QMAKE_XCODE_DEVELOPER_PATH): \
+-        error("Xcode is not installed in $${QMAKE_XCODE_DEVELOPER_PATH}. Please use xcode-select to choose Xcode installation path.")
+-}
+-
+-isEmpty(QMAKE_XCODEBUILD_PATH): \
+-    QMAKE_XCODEBUILD_PATH = $$system("/usr/bin/xcrun -find xcodebuild 2>/dev/null")
+-
+-!isEmpty(QMAKE_XCODEBUILD_PATH) {
+-    # Make sure Xcode is set up properly
+-    !system("/usr/bin/xcrun xcodebuild -license check 2>/dev/null"): \
+-        error("Xcode not set up properly. You need to confirm the license agreement by running 'sudo xcrun xcodebuild -license accept'.")
+-
+-    isEmpty(QMAKE_XCODE_VERSION) {
+-        # Extract Xcode version using xcodebuild
+-        xcode_version = $$system("/usr/bin/xcrun xcodebuild -version")
+-        QMAKE_XCODE_VERSION = $$member(xcode_version, 1)
+-        isEmpty(QMAKE_XCODE_VERSION): error("Could not resolve Xcode version.")
+-        unset(xcode_version)
+-    }
+-}
+-
+-isEmpty(QMAKE_TARGET_BUNDLE_PREFIX) {
+-    QMAKE_XCODE_PREFERENCES_FILE = $$(HOME)/Library/Preferences/com.apple.dt.Xcode.plist
+-    exists($$QMAKE_XCODE_PREFERENCES_FILE): \
+-        QMAKE_TARGET_BUNDLE_PREFIX = $$system("/usr/libexec/PlistBuddy -c 'print IDETemplateOptions:bundleIdentifierPrefix' $$QMAKE_XCODE_PREFERENCES_FILE 2>/dev/null")
+-
+-    !isEmpty(_QMAKE_CACHE_):!isEmpty(QMAKE_TARGET_BUNDLE_PREFIX): \
+-        cache(QMAKE_TARGET_BUNDLE_PREFIX)
+-}
+-
+-QMAKE_ASSET_CATALOGS_APP_ICON = AppIcon
+-
+-# Make the default debug info format for static debug builds
+-# DWARF instead of DWARF with dSYM. This cuts down build times
+-# for application debug builds significantly, as Xcode doesn't
+-# have to pull out all the DWARF info from the Qt static libs
+-# and put it into a dSYM file. We don't need that dSYM file in
+-# the first place, since the information is available in the
+-# object files inside the archives (static libraries).
+-macx-xcode:qtConfig(static): \
+-    QMAKE_XCODE_DEBUG_INFORMATION_FORMAT = dwarf
+-
+-# This variable is used by the xcode_dynamic_library_suffix
+-# feature, which allows Xcode to choose the Qt libraries to link to
+-# at build time, depending on the current Xcode SDK and configuration.
+-QMAKE_XCODE_LIBRARY_SUFFIX_SETTING = QT_LIBRARY_SUFFIX
+-
+-xcode_copy_phase_strip_setting.name = COPY_PHASE_STRIP
+-xcode_copy_phase_strip_setting.value = NO
+-QMAKE_MAC_XCODE_SETTINGS += xcode_copy_phase_strip_setting
+diff -ur qtbase-everywhere-src-5.11.3-orig/mkspecs/features/mac/sdk.prf qtbase-everywhere-src-5.11.3/mkspecs/features/mac/sdk.prf
+--- qtbase-everywhere-src-5.11.3-orig/mkspecs/features/mac/sdk.prf	2018-11-25 13:51:11.000000000 +0100
++++ qtbase-everywhere-src-5.11.3/mkspecs/features/mac/sdk.prf	2019-01-31 00:42:55.843577249 +0100
+@@ -1,58 +1 @@
+ 
+-isEmpty(QMAKE_MAC_SDK): \
+-    error("QMAKE_MAC_SDK must be set when using CONFIG += sdk.")
+-
+-contains(QMAKE_MAC_SDK, .*/.*): \
+-    error("QMAKE_MAC_SDK can only contain short-form SDK names (eg. macosx, iphoneos)")
+-
+-defineReplace(xcodeSDKInfo) {
+-    info = $$1
+-    equals(info, "Path"): \
+-        infoarg = --show-sdk-path
+-    equals(info, "PlatformPath"): \
+-        infoarg = --show-sdk-platform-path
+-    equals(info, "SDKVersion"): \
+-        infoarg = --show-sdk-version
+-    sdk = $$2
+-    isEmpty(sdk): \
+-        sdk = $$QMAKE_MAC_SDK
+-
+-    isEmpty(QMAKE_MAC_SDK.$${sdk}.$${info}) {
+-        QMAKE_MAC_SDK.$${sdk}.$${info} = $$system("/usr/bin/xcrun --sdk $$sdk $$infoarg 2>/dev/null")
+-        # --show-sdk-platform-path won't work for Command Line Tools; this is fine
+-        # only used by the XCTest backend to testlib
+-        isEmpty(QMAKE_MAC_SDK.$${sdk}.$${info}):if(!isEmpty(QMAKE_XCODEBUILD_PATH)|!equals(infoarg, "--show-sdk-platform-path")): \
+-            error("Could not resolve SDK $$info for \'$$sdk\' using $$infoarg")
+-        cache(QMAKE_MAC_SDK.$${sdk}.$${info}, set stash, QMAKE_MAC_SDK.$${sdk}.$${info})
+-    }
+-
+-    return($$eval(QMAKE_MAC_SDK.$${sdk}.$${info}))
+-}
+-
+-QMAKE_MAC_SDK_PATH = $$xcodeSDKInfo(Path)
+-QMAKE_MAC_SDK_PLATFORM_PATH = $$xcodeSDKInfo(PlatformPath)
+-QMAKE_MAC_SDK_VERSION = $$xcodeSDKInfo(SDKVersion)
+-
+-sysrootified =
+-for(val, QMAKE_INCDIR_OPENGL): sysrootified += $${QMAKE_MAC_SDK_PATH}$$val
+-QMAKE_INCDIR_OPENGL = $$sysrootified
+-
+-QMAKESPEC_NAME = $$basename(QMAKESPEC)
+-
+-# Resolve SDK version of various tools
+-for(tool, $$list(QMAKE_CC QMAKE_CXX QMAKE_FIX_RPATH QMAKE_AR QMAKE_RANLIB QMAKE_LINK QMAKE_LINK_SHLIB QMAKE_ACTOOL QMAKE_LINK_C QMAKE_LINK_C_SHLIB)) {
+-    tool_variable = QMAKE_MAC_SDK.$${QMAKESPEC_NAME}.$${QMAKE_MAC_SDK}.$${tool}
+-    !isEmpty($$tool_variable) {
+-        $$tool = $$eval($$tool_variable)
+-        next()
+-    }
+-
+-    value = $$eval($$tool)
+-    isEmpty(value): next()
+-
+-    sysrooted = $$system("/usr/bin/xcrun -sdk $$QMAKE_MAC_SDK -find $$first(value) 2>/dev/null")
+-    isEmpty(sysrooted): next()
+-
+-    $$tool = $$sysrooted $$member(value, 1, -1)
+-    cache($$tool_variable, set stash, $$tool)
+-}
+diff -ur qtbase-everywhere-src-5.11.3-orig/mkspecs/features/qml_module.prf qtbase-everywhere-src-5.11.3/mkspecs/features/qml_module.prf
+--- qtbase-everywhere-src-5.11.3-orig/mkspecs/features/qml_module.prf	2018-11-25 13:51:11.000000000 +0100
++++ qtbase-everywhere-src-5.11.3/mkspecs/features/qml_module.prf	2019-01-31 00:42:55.843577249 +0100
+@@ -23,13 +23,8 @@
+ 
+ load(qt_build_paths)
+ 
+-qml1_target {
+-    DESTDIR = $$MODULE_BASE_OUTDIR/imports/$$TARGETPATH
+-    instbase = $$[QT_INSTALL_IMPORTS]
+-} else {
+-    DESTDIR = $$MODULE_BASE_OUTDIR/qml/$$TARGETPATH
+-    instbase = $$[QT_INSTALL_QML]
+-}
++DESTDIR = $$MODULE_BASE_OUTDIR/qml/$$TARGETPATH
++instbase = $$NIX_OUTPUT_QML
+ 
+ !qml1_target:static: CONFIG += builtin_resources
+ 
+diff -ur qtbase-everywhere-src-5.11.3-orig/mkspecs/features/qml_plugin.prf qtbase-everywhere-src-5.11.3/mkspecs/features/qml_plugin.prf
+--- qtbase-everywhere-src-5.11.3-orig/mkspecs/features/qml_plugin.prf	2018-11-25 13:51:11.000000000 +0100
++++ qtbase-everywhere-src-5.11.3/mkspecs/features/qml_plugin.prf	2019-01-31 00:42:55.844577264 +0100
+@@ -48,13 +48,8 @@
+ 
+ load(qt_build_paths)
+ 
+-qml1_target {
+-    DESTDIR = $$MODULE_BASE_OUTDIR/imports/$$TARGETPATH
+-    instbase = $$[QT_INSTALL_IMPORTS]
+-} else {
+-    DESTDIR = $$MODULE_BASE_OUTDIR/qml/$$TARGETPATH
+-    instbase = $$[QT_INSTALL_QML]
+-}
++DESTDIR = $$MODULE_BASE_OUTDIR/qml/$$TARGETPATH
++instbase = $$NIX_OUTPUT_QML
+ 
+ target.path = $$instbase/$$TARGETPATH
+ INSTALLS += target
+diff -ur qtbase-everywhere-src-5.11.3-orig/mkspecs/features/qt_app.prf qtbase-everywhere-src-5.11.3/mkspecs/features/qt_app.prf
+--- qtbase-everywhere-src-5.11.3-orig/mkspecs/features/qt_app.prf	2018-11-25 13:51:11.000000000 +0100
++++ qtbase-everywhere-src-5.11.3/mkspecs/features/qt_app.prf	2019-01-31 00:42:55.844577264 +0100
+@@ -33,7 +33,7 @@
+     target.path = $$[QT_HOST_BINS]
+ } else {
+     !build_pass:qtConfig(debug_and_release): CONFIG += release
+-    target.path = $$[QT_INSTALL_BINS]
++    target.path = $$NIX_OUTPUT_BIN/bin
+     CONFIG += relative_qt_rpath  # Qt's tools and apps should be relocatable
+ }
+ INSTALLS += target
+diff -ur qtbase-everywhere-src-5.11.3-orig/mkspecs/features/qt_build_paths.prf qtbase-everywhere-src-5.11.3/mkspecs/features/qt_build_paths.prf
+--- qtbase-everywhere-src-5.11.3-orig/mkspecs/features/qt_build_paths.prf	2018-11-25 13:51:11.000000000 +0100
++++ qtbase-everywhere-src-5.11.3/mkspecs/features/qt_build_paths.prf	2019-01-31 00:42:55.844577264 +0100
+@@ -24,6 +24,6 @@
+ !force_independent {
+     # If the module is not built independently, everything ends up in qtbase.
+     # This is the case in non-prefix builds, except for selected modules.
+-    MODULE_BASE_OUTDIR = $$[QT_HOST_PREFIX]
+-    MODULE_QMAKE_OUTDIR = $$[QT_HOST_PREFIX]
++    MODULE_BASE_OUTDIR = $$NIX_OUTPUT_OUT
++    MODULE_QMAKE_OUTDIR = $$NIX_OUTPUT_OUT
+ }
+Only in qtbase-everywhere-src-5.11.3/mkspecs/features: qt_build_paths.prf.orig
+diff -ur qtbase-everywhere-src-5.11.3-orig/mkspecs/features/qt_common.prf qtbase-everywhere-src-5.11.3/mkspecs/features/qt_common.prf
+--- qtbase-everywhere-src-5.11.3-orig/mkspecs/features/qt_common.prf	2018-11-25 13:51:11.000000000 +0100
++++ qtbase-everywhere-src-5.11.3/mkspecs/features/qt_common.prf	2019-01-31 00:42:55.844577264 +0100
+@@ -32,8 +32,8 @@
+         qqt_libdir = \$\$\$\$[QT_HOST_LIBS]
+         qt_libdir = $$[QT_HOST_LIBS]
+     } else {
+-        qqt_libdir = \$\$\$\$[QT_INSTALL_LIBS]
+-        qt_libdir = $$[QT_INSTALL_LIBS]
++        qqt_libdir = \$\$\$\$NIX_OUTPUT_OUT/lib
++        qt_libdir = $$NIX_OUTPUT_OUT/lib
+     }
+     contains(QMAKE_DEFAULT_LIBDIRS, $$qt_libdir) {
+         lib_replace.match = "[^ ']*$$rplbase/lib"
+diff -ur qtbase-everywhere-src-5.11.3-orig/mkspecs/features/qt_docs.prf qtbase-everywhere-src-5.11.3/mkspecs/features/qt_docs.prf
+--- qtbase-everywhere-src-5.11.3-orig/mkspecs/features/qt_docs.prf	2018-11-25 13:51:11.000000000 +0100
++++ qtbase-everywhere-src-5.11.3/mkspecs/features/qt_docs.prf	2019-01-31 00:42:55.844577264 +0100
+@@ -45,7 +45,7 @@
+ 
+ QDOC += -outputdir $$shell_quote($$QMAKE_DOCS_OUTPUTDIR)
+ !build_online_docs: \
+-    QDOC += -installdir $$shell_quote($$[QT_INSTALL_DOCS])
++    QDOC += -installdir $$shell_quote($$NIX_OUTPUT_DOC)
+ PREP_DOC_INDEXES =
+ DOC_INDEXES =
+ !isEmpty(QTREPOS) {
+@@ -64,8 +64,8 @@
+         DOC_INDEXES += -indexdir $$shell_quote($$qrep/doc)
+ } else {
+     prepare_docs: \
+-        PREP_DOC_INDEXES += -indexdir $$shell_quote($$[QT_INSTALL_DOCS/get])
+-    DOC_INDEXES += -indexdir $$shell_quote($$[QT_INSTALL_DOCS/get])
++        PREP_DOC_INDEXES += -indexdir $$shell_quote($$NIX_OUTPUT_DOC)
++    DOC_INDEXES += -indexdir $$shell_quote($$NIX_OUTPUT_DOC)
+ }
+ 
+ qtattributionsscanner.target = qtattributionsscanner
+@@ -88,12 +88,12 @@
+     qch_docs.commands = $$QHELPGENERATOR $$shell_quote($$QMAKE_DOCS_OUTPUTDIR/$${QMAKE_DOCS_TARGET}.qhp) -o $$shell_quote($$QMAKE_DOCS_BASE_OUTDIR/$${QMAKE_DOCS_TARGET}.qch)
+ 
+     inst_html_docs.files = $$QMAKE_DOCS_OUTPUTDIR
+-    inst_html_docs.path = $$[QT_INSTALL_DOCS]
++    inst_html_docs.path = $$NIX_OUTPUT_DOC
+     inst_html_docs.CONFIG += no_check_exist directory no_default_install no_build
+     INSTALLS += inst_html_docs
+ 
+     inst_qch_docs.files = $$QMAKE_DOCS_BASE_OUTDIR/$${QMAKE_DOCS_TARGET}.qch
+-    inst_qch_docs.path = $$[QT_INSTALL_DOCS]
++    inst_qch_docs.path = $$NIX_OUTPUT_DOC
+     inst_qch_docs.CONFIG += no_check_exist no_default_install no_build
+     INSTALLS += inst_qch_docs
+ 
+diff -ur qtbase-everywhere-src-5.11.3-orig/mkspecs/features/qt_example_installs.prf qtbase-everywhere-src-5.11.3/mkspecs/features/qt_example_installs.prf
+--- qtbase-everywhere-src-5.11.3-orig/mkspecs/features/qt_example_installs.prf	2018-11-25 13:51:11.000000000 +0100
++++ qtbase-everywhere-src-5.11.3/mkspecs/features/qt_example_installs.prf	2019-01-31 00:42:55.844577264 +0100
+@@ -88,7 +88,7 @@
+     $$SOURCES $$HEADERS $$FORMS $$RESOURCES $$TRANSLATIONS \
+     $$DBUS_ADAPTORS $$DBUS_INTERFACES
+ addInstallFiles(sources.files, $$sourcefiles)
+-sources.path = $$[QT_INSTALL_EXAMPLES]/$$probase
++sources.path = $$NIX_OUTPUT_DEV/share/examples/$$probase
+ INSTALLS += sources
+ 
+ check_examples {
+diff -ur qtbase-everywhere-src-5.11.3-orig/mkspecs/features/qt_functions.prf qtbase-everywhere-src-5.11.3/mkspecs/features/qt_functions.prf
+--- qtbase-everywhere-src-5.11.3-orig/mkspecs/features/qt_functions.prf	2018-11-25 13:51:11.000000000 +0100
++++ qtbase-everywhere-src-5.11.3/mkspecs/features/qt_functions.prf	2019-01-31 00:42:55.844577264 +0100
+@@ -69,7 +69,7 @@
+ defineTest(qtPrepareTool) {
+     cmd = $$eval(QT_TOOL.$${2}.binary)
+     isEmpty(cmd) {
+-        cmd = $$[QT_HOST_BINS]/$$2
++        cmd = $$system("command -v $$2")
+         exists($${cmd}.pl) {
+             $${1}_EXE = $${cmd}.pl
+             cmd = perl -w $$system_path($${cmd}.pl)
+diff -ur qtbase-everywhere-src-5.11.3-orig/mkspecs/features/qt_installs.prf qtbase-everywhere-src-5.11.3/mkspecs/features/qt_installs.prf
+--- qtbase-everywhere-src-5.11.3-orig/mkspecs/features/qt_installs.prf	2018-11-25 13:51:11.000000000 +0100
++++ qtbase-everywhere-src-5.11.3/mkspecs/features/qt_installs.prf	2019-01-31 00:42:55.844577264 +0100
+@@ -12,16 +12,10 @@
+ #library
+ !qt_no_install_library {
+     win32 {
+-       host_build: \
+-           dlltarget.path = $$[QT_HOST_BINS]
+-       else: \
+-           dlltarget.path = $$[QT_INSTALL_BINS]
++        dlltarget.path = $$NIX_OUTPUT_BIN/bin
+        INSTALLS += dlltarget
+     }
+-    host_build: \
+-        target.path = $$[QT_HOST_LIBS]
+-    else: \
+-        target.path = $$[QT_INSTALL_LIBS]
++    target.path = $$NIX_OUTPUT_OUT/lib
+     !static: target.CONFIG = no_dll
+     INSTALLS += target
+ }
+@@ -29,33 +23,33 @@
+ #headers
+ qt_install_headers {
+     gen_headers.files = $$SYNCQT.GENERATED_HEADER_FILES
+-    gen_headers.path = $$[QT_INSTALL_HEADERS]/$$MODULE_INCNAME
++    gen_headers.path = $$NIX_OUTPUT_DEV/include/$$MODULE_INCNAME
+     INSTALLS += gen_headers
+ 
+     targ_headers.files = $$SYNCQT.HEADER_FILES $$SYNCQT.INJECTED_HEADER_FILES
+-    targ_headers.path = $$[QT_INSTALL_HEADERS]/$$MODULE_INCNAME
++    targ_headers.path = $$NIX_OUTPUT_DEV/include/$$MODULE_INCNAME
+     INSTALLS += targ_headers
+ 
+     private_headers.files = $$SYNCQT.PRIVATE_HEADER_FILES $$SYNCQT.INJECTED_PRIVATE_HEADER_FILES
+-    private_headers.path = $$[QT_INSTALL_HEADERS]/$$MODULE_INCNAME/$$VERSION/$$MODULE_INCNAME/private
++    private_headers.path = $$NIX_OUTPUT_DEV/include/$$MODULE_INCNAME/$$VERSION/$$MODULE_INCNAME/private
+     INSTALLS += private_headers
+ 
+     qpa_headers.files = $$SYNCQT.QPA_HEADER_FILES
+-    qpa_headers.path = $$[QT_INSTALL_HEADERS]/$$MODULE_INCNAME/$$VERSION/$$MODULE_INCNAME/qpa
++    qpa_headers.path = $$NIX_OUTPUT_DEV/include/$$MODULE_INCNAME/$$VERSION/$$MODULE_INCNAME/qpa
+     INSTALLS += qpa_headers
+ }
+ 
+ #module
+ qt_install_module {
+     !isEmpty(MODULE_PRI) {
+-        pritarget.path = $$[QT_HOST_DATA]/mkspecs/modules
++        pritarget.path = $$NIX_OUTPUT_DEV/mkspecs/modules
+         pritarget.files = $$MODULE_PRI
+         INSTALLS += pritarget
+     } else: isEmpty(MODULE_PRIVATE_PRI) {
+         warning("Project $$basename(_PRO_FILE_) is a module, but has not defined MODULE_PRI, which is required for Qt to expose the module to other projects.")
+     }
+     !isEmpty(MODULE_PRIVATE_PRI) {
+-        privpritarget.path = $$[QT_HOST_DATA]/mkspecs/modules
++        privpritarget.path = $$NIX_OUTPUT_DEV/mkspecs/modules
+         privpritarget.files = $$MODULE_PRIVATE_PRI
+         INSTALLS += privpritarget
+     }
+diff -ur qtbase-everywhere-src-5.11.3-orig/mkspecs/features/qt_plugin.prf qtbase-everywhere-src-5.11.3/mkspecs/features/qt_plugin.prf
+--- qtbase-everywhere-src-5.11.3-orig/mkspecs/features/qt_plugin.prf	2018-11-25 13:51:11.000000000 +0100
++++ qtbase-everywhere-src-5.11.3/mkspecs/features/qt_plugin.prf	2019-01-31 00:42:55.844577264 +0100
+@@ -88,7 +88,7 @@
+     }
+ }
+ 
+-target.path = $$[QT_INSTALL_PLUGINS]/$$PLUGIN_TYPE
++target.path = $$NIX_OUTPUT_PLUGIN/$$PLUGIN_TYPE
+ INSTALLS += target
+ 
+ TARGET = $$qt5LibraryTarget($$TARGET)
+diff -ur qtbase-everywhere-src-5.11.3-orig/src/corelib/kernel/qcoreapplication.cpp qtbase-everywhere-src-5.11.3/src/corelib/kernel/qcoreapplication.cpp
+--- qtbase-everywhere-src-5.11.3-orig/src/corelib/kernel/qcoreapplication.cpp	2018-11-25 13:51:11.000000000 +0100
++++ qtbase-everywhere-src-5.11.3/src/corelib/kernel/qcoreapplication.cpp	2019-01-31 00:42:55.845577279 +0100
+@@ -2612,6 +2612,15 @@
+         QStringList *app_libpaths = new QStringList;
+         coreappdata()->app_libpaths.reset(app_libpaths);
+ 
++        // Add library paths derived from PATH
++        const QStringList paths = QFile::decodeName(qgetenv("PATH")).split(':');
++        const QString plugindir = QStringLiteral("../" NIXPKGS_QT_PLUGIN_PREFIX);
++        for (const QString &path: paths) {
++            if (!path.isEmpty()) {
++                app_libpaths->append(QDir::cleanPath(path + QDir::separator() + plugindir));
++            }
++        }
++
+         const QByteArray libPathEnv = qgetenv("QT_PLUGIN_PATH");
+         if (!libPathEnv.isEmpty()) {
+             QStringList paths = QFile::decodeName(libPathEnv).split(QDir::listSeparator(), QString::SkipEmptyParts);
+Only in qtbase-everywhere-src-5.11.3/src/corelib/kernel: qcoreapplication.cpp.orig
+diff -ur qtbase-everywhere-src-5.11.3-orig/src/corelib/Qt5CoreConfigExtras.cmake.in qtbase-everywhere-src-5.11.3/src/corelib/Qt5CoreConfigExtras.cmake.in
+--- qtbase-everywhere-src-5.11.3-orig/src/corelib/Qt5CoreConfigExtras.cmake.in	2018-11-25 13:51:11.000000000 +0100
++++ qtbase-everywhere-src-5.11.3/src/corelib/Qt5CoreConfigExtras.cmake.in	2019-01-31 00:42:55.844577264 +0100
+@@ -3,7 +3,7 @@
+     add_executable(Qt5::qmake IMPORTED)
+ 
+ !!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5Core_install_prefix}/$${CMAKE_BIN_DIR}qmake$$CMAKE_BIN_SUFFIX\")
++    set(imported_location \"$$NIX_OUTPUT_DEV/$${CMAKE_BIN_DIR}qmake$$CMAKE_BIN_SUFFIX\")
+ !!ELSE
+     set(imported_location \"$${CMAKE_BIN_DIR}qmake$$CMAKE_BIN_SUFFIX\")
+ !!ENDIF
+@@ -18,7 +18,7 @@
+     add_executable(Qt5::moc IMPORTED)
+ 
+ !!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5Core_install_prefix}/$${CMAKE_BIN_DIR}moc$$CMAKE_BIN_SUFFIX\")
++    set(imported_location \"$$NIX_OUTPUT_DEV/$${CMAKE_BIN_DIR}moc$$CMAKE_BIN_SUFFIX\")
+ !!ELSE
+     set(imported_location \"$${CMAKE_BIN_DIR}moc$$CMAKE_BIN_SUFFIX\")
+ !!ENDIF
+@@ -35,7 +35,7 @@
+     add_executable(Qt5::rcc IMPORTED)
+ 
+ !!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5Core_install_prefix}/$${CMAKE_BIN_DIR}rcc$$CMAKE_BIN_SUFFIX\")
++    set(imported_location \"$$NIX_OUTPUT_DEV/$${CMAKE_BIN_DIR}rcc$$CMAKE_BIN_SUFFIX\")
+ !!ELSE
+     set(imported_location \"$${CMAKE_BIN_DIR}rcc$$CMAKE_BIN_SUFFIX\")
+ !!ENDIF
+@@ -116,7 +116,7 @@
+ !!IF !isEmpty(CMAKE_RELEASE_TYPE)
+     set_property(TARGET Qt5::WinMain APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
+ !!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5Core_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_RELEASE}\")
++    set(imported_location \"$$NIX_OUTPUT_DEV/$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_RELEASE}\")
+ !!ELSE
+     set(imported_location \"$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_RELEASE}\")
+ !!ENDIF
+@@ -130,7 +130,7 @@
+     set_property(TARGET Qt5::WinMain APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
+ 
+ !!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5Core_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_DEBUG}\")
++    set(imported_location \"$$NIX_OUTPUT_DEV/$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_DEBUG}\")
+ !!ELSE
+     set(imported_location \"$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_DEBUG}\")
+ !!ENDIF
+diff -ur qtbase-everywhere-src-5.11.3-orig/src/corelib/Qt5CoreConfigExtrasMkspecDir.cmake.in qtbase-everywhere-src-5.11.3/src/corelib/Qt5CoreConfigExtrasMkspecDir.cmake.in
+--- qtbase-everywhere-src-5.11.3-orig/src/corelib/Qt5CoreConfigExtrasMkspecDir.cmake.in	2018-11-25 13:51:11.000000000 +0100
++++ qtbase-everywhere-src-5.11.3/src/corelib/Qt5CoreConfigExtrasMkspecDir.cmake.in	2019-01-31 00:42:55.844577264 +0100
+@@ -1,6 +1,6 @@
+ 
+ !!IF isEmpty(CMAKE_HOST_DATA_DIR_IS_ABSOLUTE)
+-set(_qt5_corelib_extra_includes \"${_qt5Core_install_prefix}/$${CMAKE_HOST_DATA_DIR}/mkspecs/$${CMAKE_MKSPEC}\")
++set(_qt5_corelib_extra_includes \"$$NIX_OUTPUT_DEV/$${CMAKE_HOST_DATA_DIR}/mkspecs/$${CMAKE_MKSPEC}\")
+ !!ELSE
+ set(_qt5_corelib_extra_includes \"$${CMAKE_HOST_DATA_DIR}mkspecs/$${CMAKE_MKSPEC}\")
+ !!ENDIF
+diff -ur qtbase-everywhere-src-5.11.3-orig/src/corelib/Qt5CoreConfigExtrasMkspecDirForInstall.cmake.in qtbase-everywhere-src-5.11.3/src/corelib/Qt5CoreConfigExtrasMkspecDirForInstall.cmake.in
+--- qtbase-everywhere-src-5.11.3-orig/src/corelib/Qt5CoreConfigExtrasMkspecDirForInstall.cmake.in	2018-11-25 13:51:11.000000000 +0100
++++ qtbase-everywhere-src-5.11.3/src/corelib/Qt5CoreConfigExtrasMkspecDirForInstall.cmake.in	2019-01-31 00:42:55.844577264 +0100
+@@ -1,6 +1,6 @@
+ 
+ !!IF isEmpty(CMAKE_INSTALL_DATA_DIR_IS_ABSOLUTE)
+-set(_qt5_corelib_extra_includes \"${_qt5Core_install_prefix}/$${CMAKE_INSTALL_DATA_DIR}/mkspecs/$${CMAKE_MKSPEC}\")
++set(_qt5_corelib_extra_includes \"$$NIX_OUTPUT_DEV/$${CMAKE_INSTALL_DATA_DIR}/mkspecs/$${CMAKE_MKSPEC}\")
+ !!ELSE
+ set(_qt5_corelib_extra_includes \"$${CMAKE_INSTALL_DATA_DIR}mkspecs/$${CMAKE_MKSPEC}\")
+ !!ENDIF
+diff -ur qtbase-everywhere-src-5.11.3-orig/src/corelib/tools/qtimezoneprivate_tz.cpp qtbase-everywhere-src-5.11.3/src/corelib/tools/qtimezoneprivate_tz.cpp
+--- qtbase-everywhere-src-5.11.3-orig/src/corelib/tools/qtimezoneprivate_tz.cpp	2018-11-25 13:51:11.000000000 +0100
++++ qtbase-everywhere-src-5.11.3/src/corelib/tools/qtimezoneprivate_tz.cpp	2019-01-31 00:42:55.845577279 +0100
+@@ -70,7 +70,11 @@
+ // Parse zone.tab table, assume lists all installed zones, if not will need to read directories
+ static QTzTimeZoneHash loadTzTimeZones()
+ {
+-    QString path = QStringLiteral("/usr/share/zoneinfo/zone.tab");
++    // Try TZDIR first, in case we're running on NixOS.
++    QString path = QFile::decodeName(qgetenv("TZDIR")) + QStringLiteral("/zone.tab");
++    // Fallback to traditional paths in case we are not on NixOS.
++    if (!QFile::exists(path))
++        path = QStringLiteral("/usr/share/zoneinfo/zone.tab");
+     if (!QFile::exists(path))
+         path = QStringLiteral("/usr/lib/zoneinfo/zone.tab");
+ 
+@@ -644,12 +648,16 @@
+         if (!tzif.open(QIODevice::ReadOnly))
+             return;
+     } else {
+-        // Open named tz, try modern path first, if fails try legacy path
+-        tzif.setFileName(QLatin1String("/usr/share/zoneinfo/") + QString::fromLocal8Bit(ianaId));
++        // Try TZDIR first, in case we're running on NixOS
++        tzif.setFileName(QFile::decodeName(qgetenv("TZDIR")) + QStringLiteral("/") + QString::fromLocal8Bit(ianaId));
+         if (!tzif.open(QIODevice::ReadOnly)) {
+-            tzif.setFileName(QLatin1String("/usr/lib/zoneinfo/") + QString::fromLocal8Bit(ianaId));
+-            if (!tzif.open(QIODevice::ReadOnly))
+-                return;
++            // Open named tz, try modern path first, if fails try legacy path
++            tzif.setFileName(QLatin1String("/usr/share/zoneinfo/") + QString::fromLocal8Bit(ianaId));
++            if (!tzif.open(QIODevice::ReadOnly)) {
++                tzif.setFileName(QLatin1String("/usr/lib/zoneinfo/") + QString::fromLocal8Bit(ianaId));
++                if (!tzif.open(QIODevice::ReadOnly))
++                    return;
++            }
+         }
+     }
+ 
+diff -ur qtbase-everywhere-src-5.11.3-orig/src/dbus/Qt5DBusConfigExtras.cmake.in qtbase-everywhere-src-5.11.3/src/dbus/Qt5DBusConfigExtras.cmake.in
+--- qtbase-everywhere-src-5.11.3-orig/src/dbus/Qt5DBusConfigExtras.cmake.in	2018-11-25 13:51:11.000000000 +0100
++++ qtbase-everywhere-src-5.11.3/src/dbus/Qt5DBusConfigExtras.cmake.in	2019-01-31 00:42:55.845577279 +0100
+@@ -2,11 +2,7 @@
+ if (NOT TARGET Qt5::qdbuscpp2xml)
+     add_executable(Qt5::qdbuscpp2xml IMPORTED)
+ 
+-!!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5DBus_install_prefix}/$${CMAKE_BIN_DIR}qdbuscpp2xml$$CMAKE_BIN_SUFFIX\")
+-!!ELSE
+-    set(imported_location \"$${CMAKE_BIN_DIR}qdbuscpp2xml$$CMAKE_BIN_SUFFIX\")
+-!!ENDIF
++    set(imported_location \"$$NIX_OUTPUT_DEV/bin/qdbuscpp2xml$$CMAKE_BIN_SUFFIX\")
+     _qt5_DBus_check_file_exists(${imported_location})
+ 
+     set_target_properties(Qt5::qdbuscpp2xml PROPERTIES
+@@ -17,11 +13,7 @@
+ if (NOT TARGET Qt5::qdbusxml2cpp)
+     add_executable(Qt5::qdbusxml2cpp IMPORTED)
+ 
+-!!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5DBus_install_prefix}/$${CMAKE_BIN_DIR}qdbusxml2cpp$$CMAKE_BIN_SUFFIX\")
+-!!ELSE
+-    set(imported_location \"$${CMAKE_BIN_DIR}qdbusxml2cpp$$CMAKE_BIN_SUFFIX\")
+-!!ENDIF
++    set(imported_location \"$$NIX_OUTPUT_DEV/bin/qdbusxml2cpp$$CMAKE_BIN_SUFFIX\")
+     _qt5_DBus_check_file_exists(${imported_location})
+ 
+     set_target_properties(Qt5::qdbusxml2cpp PROPERTIES
+diff -ur qtbase-everywhere-src-5.11.3-orig/src/gui/Qt5GuiConfigExtras.cmake.in qtbase-everywhere-src-5.11.3/src/gui/Qt5GuiConfigExtras.cmake.in
+--- qtbase-everywhere-src-5.11.3-orig/src/gui/Qt5GuiConfigExtras.cmake.in	2018-11-25 13:51:11.000000000 +0100
++++ qtbase-everywhere-src-5.11.3/src/gui/Qt5GuiConfigExtras.cmake.in	2019-01-31 00:42:55.845577279 +0100
+@@ -2,7 +2,7 @@
+ !!IF !isEmpty(CMAKE_ANGLE_EGL_DLL_RELEASE)
+ 
+ !!IF isEmpty(CMAKE_INCLUDE_DIR_IS_ABSOLUTE)
+-set(Qt5Gui_EGL_INCLUDE_DIRS \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$$CMAKE_INCLUDE_DIR/QtANGLE\")
++set(Qt5Gui_EGL_INCLUDE_DIRS \"$$NIX_OUTPUT_DEV/$$CMAKE_INCLUDE_DIR/QtANGLE\")
+ !!ELSE
+ set(Qt5Gui_EGL_INCLUDE_DIRS \"$$CMAKE_INCLUDE_DIR/QtANGLE\")
+ !!ENDIF
+@@ -17,13 +17,13 @@
+     set_property(TARGET Qt5::${TargetName} APPEND PROPERTY IMPORTED_CONFIGURATIONS ${Configuration})
+ 
+ !!IF isEmpty(CMAKE_DLL_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5Gui_install_prefix}/$${CMAKE_DLL_DIR}${LIB_LOCATION}\")
++    set(imported_location \"$$NIX_OUTPUT_OUT/$${CMAKE_DLL_DIR}${LIB_LOCATION}\")
+ !!ELSE
+     set(imported_location \"$${CMAKE_DLL_DIR}${LIB_LOCATION}\")
+ !!ENDIF
+ 
+ !!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-    set(imported_implib \"${_qt5Gui_install_prefix}/$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\")
++    set(imported_implib \"$$NIX_OUTPUT_OUT/$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\")
+ !!ELSE
+     set(imported_implib \"$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\")
+ !!ENDIF
+diff -ur qtbase-everywhere-src-5.11.3-orig/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp qtbase-everywhere-src-5.11.3/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp
+--- qtbase-everywhere-src-5.11.3-orig/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp	2018-11-25 13:51:11.000000000 +0100
++++ qtbase-everywhere-src-5.11.3/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp	2019-01-31 00:42:55.845577279 +0100
+@@ -265,12 +265,9 @@
+     m_possibleLocations.reserve(7);
+     if (qEnvironmentVariableIsSet("QTCOMPOSE"))
+         m_possibleLocations.append(QString::fromLocal8Bit(qgetenv("QTCOMPOSE")));
+-    m_possibleLocations.append(QStringLiteral("/usr/share/X11/locale"));
+-    m_possibleLocations.append(QStringLiteral("/usr/local/share/X11/locale"));
+-    m_possibleLocations.append(QStringLiteral("/usr/lib/X11/locale"));
+-    m_possibleLocations.append(QStringLiteral("/usr/local/lib/X11/locale"));
+     m_possibleLocations.append(QStringLiteral(X11_PREFIX "/share/X11/locale"));
+     m_possibleLocations.append(QStringLiteral(X11_PREFIX "/lib/X11/locale"));
++    m_possibleLocations.append(QLatin1String(NIXPKGS_QTCOMPOSE));
+ }
+ 
+ QString TableGenerator::findComposeFile()
+diff -ur qtbase-everywhere-src-5.11.3-orig/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp qtbase-everywhere-src-5.11.3/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp
+--- qtbase-everywhere-src-5.11.3-orig/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp	2018-11-25 13:51:11.000000000 +0100
++++ qtbase-everywhere-src-5.11.3/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp	2019-01-31 00:42:55.845577279 +0100
+@@ -650,9 +650,14 @@
+ #if QT_CONFIG(library)
+                 extern const QString qt_gl_library_name();
+ //                QLibrary lib(qt_gl_library_name());
++                // Check system library paths first
+                 QLibrary lib(QLatin1String("GL"));
+-                if (!lib.load())
+-                    lib.setFileNameAndVersion(QLatin1String("GL"), 1);
++#ifdef NIXPKGS_MESA_GL
++                if (!lib.load()) {
++                    // Fallback to Mesa driver
++                    lib.setFileName(QLatin1String(NIXPKGS_MESA_GL));
++                }
++#endif // NIXPKGS_MESA_GL
+                 glXGetProcAddressARB = (qt_glXGetProcAddressARB) lib.resolve("glXGetProcAddressARB");
+ #endif
+             }
+Only in qtbase-everywhere-src-5.11.3/src/plugins/platforms/xcb/gl_integrations/xcb_glx: qglxintegration.cpp.orig
+diff -ur qtbase-everywhere-src-5.11.3-orig/src/plugins/platforms/xcb/qxcbcursor.cpp qtbase-everywhere-src-5.11.3/src/plugins/platforms/xcb/qxcbcursor.cpp
+--- qtbase-everywhere-src-5.11.3-orig/src/plugins/platforms/xcb/qxcbcursor.cpp	2018-11-25 13:51:11.000000000 +0100
++++ qtbase-everywhere-src-5.11.3/src/plugins/platforms/xcb/qxcbcursor.cpp	2019-01-31 00:42:55.846577295 +0100
+@@ -316,10 +316,10 @@
+ #if QT_CONFIG(xcb_xlib) && QT_CONFIG(library)
+     static bool function_ptrs_not_initialized = true;
+     if (function_ptrs_not_initialized) {
+-        QLibrary xcursorLib(QLatin1String("Xcursor"), 1);
++        QLibrary xcursorLib(QLatin1String(NIXPKGS_LIBXCURSOR), 1);
+         bool xcursorFound = xcursorLib.load();
+         if (!xcursorFound) { // try without the version number
+-            xcursorLib.setFileName(QLatin1String("Xcursor"));
++            xcursorLib.setFileName(QLatin1String(NIXPKGS_LIBXCURSOR));
+             xcursorFound = xcursorLib.load();
+         }
+         if (xcursorFound) {
+diff -ur qtbase-everywhere-src-5.11.3-orig/src/plugins/platformthemes/gtk3/main.cpp qtbase-everywhere-src-5.11.3/src/plugins/platformthemes/gtk3/main.cpp
+--- qtbase-everywhere-src-5.11.3-orig/src/plugins/platformthemes/gtk3/main.cpp	2018-11-25 13:51:11.000000000 +0100
++++ qtbase-everywhere-src-5.11.3/src/plugins/platformthemes/gtk3/main.cpp	2019-01-31 00:42:55.846577295 +0100
+@@ -39,6 +39,7 @@
+ 
+ #include <qpa/qplatformthemeplugin.h>
+ #include "qgtk3theme.h"
++#include <QFile>
+ 
+ QT_BEGIN_NAMESPACE
+ 
+@@ -54,8 +55,22 @@
+ QPlatformTheme *QGtk3ThemePlugin::create(const QString &key, const QStringList &params)
+ {
+     Q_UNUSED(params);
+-    if (!key.compare(QLatin1String(QGtk3Theme::name), Qt::CaseInsensitive))
++    if (!key.compare(QLatin1String(QGtk3Theme::name), Qt::CaseInsensitive)) {
++
++#ifdef NIXPKGS_QGTK3_XDG_DATA_DIRS
++        QStringList XDG_DATA_DIRS = QFile::decodeName(qgetenv("XDG_DATA_DIRS")).split(':');
++        XDG_DATA_DIRS << QLatin1String(NIXPKGS_QGTK3_XDG_DATA_DIRS);
++        qputenv("XDG_DATA_DIRS", QFile::encodeName(XDG_DATA_DIRS.join(':')));
++#endif
++
++#ifdef NIXPKGS_QGTK3_GIO_EXTRA_MODULES
++        QStringList GIO_EXTRA_MODULES = QFile::decodeName(qgetenv("GIO_EXTRA_MODULES")).split(':');
++        GIO_EXTRA_MODULES << QLatin1String(NIXPKGS_QGTK3_GIO_EXTRA_MODULES);
++        qputenv("GIO_EXTRA_MODULES", QFile::encodeName(GIO_EXTRA_MODULES.join(':')));
++#endif
++
+         return new QGtk3Theme;
++    }
+ 
+     return 0;
+ }
+diff -ur qtbase-everywhere-src-5.11.3-orig/src/testlib/qtestassert.h qtbase-everywhere-src-5.11.3/src/testlib/qtestassert.h
+--- qtbase-everywhere-src-5.11.3-orig/src/testlib/qtestassert.h	2018-11-25 13:51:11.000000000 +0100
++++ qtbase-everywhere-src-5.11.3/src/testlib/qtestassert.h	2019-01-31 00:42:55.846577295 +0100
+@@ -44,10 +44,13 @@
+ 
+ QT_BEGIN_NAMESPACE
+ 
+-
++#if defined(QT_NO_DEBUG) && !defined(QT_FORCE_ASSERTS)
++#define QTEST_ASSERT(cond) do { } while ((false) && (cond))
++#define QTEST_ASSERT_X(cond, where, what) do { } while ((false) && (cond))
++#else
+ #define QTEST_ASSERT(cond) do { if (!(cond)) qt_assert(#cond,__FILE__,__LINE__); } while (false)
+-
+ #define QTEST_ASSERT_X(cond, where, what) do { if (!(cond)) qt_assert_x(where, what,__FILE__,__LINE__); } while (false)
++#endif
+ 
+ QT_END_NAMESPACE
+ 
+diff -ur qtbase-everywhere-src-5.11.3-orig/src/widgets/Qt5WidgetsConfigExtras.cmake.in qtbase-everywhere-src-5.11.3/src/widgets/Qt5WidgetsConfigExtras.cmake.in
+--- qtbase-everywhere-src-5.11.3-orig/src/widgets/Qt5WidgetsConfigExtras.cmake.in	2018-11-25 13:51:11.000000000 +0100
++++ qtbase-everywhere-src-5.11.3/src/widgets/Qt5WidgetsConfigExtras.cmake.in	2019-01-31 00:42:55.846577295 +0100
+@@ -3,7 +3,7 @@
+     add_executable(Qt5::uic IMPORTED)
+ 
+ !!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5Widgets_install_prefix}/$${CMAKE_BIN_DIR}uic$$CMAKE_BIN_SUFFIX\")
++    set(imported_location \"$$NIX_OUTPUT_DEV/$${CMAKE_BIN_DIR}uic$$CMAKE_BIN_SUFFIX\")
+ !!ELSE
+     set(imported_location \"$${CMAKE_BIN_DIR}uic$$CMAKE_BIN_SUFFIX\")
+ !!ENDIF
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.11/qtdeclarative.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.11/qtdeclarative.patch
new file mode 100644
index 000000000000..cfa68eb8102c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.11/qtdeclarative.patch
@@ -0,0 +1,46 @@
+diff --git a/src/qml/qml/qqmlimport.cpp b/src/qml/qml/qqmlimport.cpp
+index 005db4248..685c5b1b2 100644
+--- a/src/qml/qml/qqmlimport.cpp
++++ b/src/qml/qml/qqmlimport.cpp
+@@ -1760,6 +1760,15 @@ QQmlImportDatabase::QQmlImportDatabase(QQmlEngine *e)
+     QString installImportsPath =  QLibraryInfo::location(QLibraryInfo::Qml2ImportsPath);
+     addImportPath(installImportsPath);
+ 
++    // Add import paths derived from PATH
++    const QStringList paths = QFile::decodeName(qgetenv("PATH")).split(':');
++    const QString qmldir = QStringLiteral("../" NIXPKGS_QML2_IMPORT_PREFIX);
++    for (const QString &path: paths) {
++        if (!path.isEmpty()) {
++            addImportPath(QDir::cleanPath(path + QDir::separator() + qmldir));
++        }
++    }
++
+     // env import paths
+     if (Q_UNLIKELY(!qEnvironmentVariableIsEmpty("QML2_IMPORT_PATH"))) {
+         const QString envImportPath = qEnvironmentVariable("QML2_IMPORT_PATH");
+diff --git a/tools/qmlcachegen/Qt5QuickCompilerConfig.cmake b/tools/qmlcachegen/Qt5QuickCompilerConfig.cmake
+index 56cb3fb55..74509d601 100644
+--- a/tools/qmlcachegen/Qt5QuickCompilerConfig.cmake
++++ b/tools/qmlcachegen/Qt5QuickCompilerConfig.cmake
+@@ -17,7 +17,7 @@ function(QTQUICK_COMPILER_ADD_RESOURCES outfiles)
+ 
+     find_package(Qt5 COMPONENTS Qml Core)
+ 
+-    set(compiler_path "${_qt5Core_install_prefix}/bin/qmlcachegen")
++    set(compiler_path "qmlcachegen")
+ 
+     get_target_property(rcc_path ${Qt5Core_RCC_EXECUTABLE} IMPORTED_LOCATION)
+ 
+diff --git a/tools/qmlcachegen/qmlcache.prf b/tools/qmlcachegen/qmlcache.prf
+index 537eaf62e..e21de58f6 100644
+--- a/tools/qmlcachegen/qmlcache.prf
++++ b/tools/qmlcachegen/qmlcache.prf
+@@ -26,7 +26,7 @@ defineReplace(qmlCacheOutputFileName) {
+ }
+ 
+ qmlcacheinst.base = $$QMLCACHE_DESTDIR
+-qmlcacheinst.path = $$[QT_INSTALL_QML]/$$TARGETPATH
++qmlcacheinst.path = $$NIX_OUTPUT_QML/$$TARGETPATH
+ qmlcacheinst.CONFIG = no_check_exist
+ 
+ qmlcachegen.input = CACHEGEN_FILES
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.11/qtscript.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.11/qtscript.patch
new file mode 100644
index 000000000000..5508dec1280e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.11/qtscript.patch
@@ -0,0 +1,13 @@
+diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Threading.h b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Threading.h
+index 1f6d25e..087c3fb 100644
+--- a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Threading.h
++++ b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Threading.h
+@@ -81,7 +81,7 @@
+ #include <pthread.h>
+ #elif PLATFORM(GTK)
+ #include <wtf/gtk/GOwnPtr.h>
+-typedef struct _GMutex GMutex;
++typedef union _GMutex GMutex;
+ typedef struct _GCond GCond;
+ #endif
+ 
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.11/qtserialport.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.11/qtserialport.patch
new file mode 100644
index 000000000000..f25524e80bcf
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.11/qtserialport.patch
@@ -0,0 +1,22 @@
+diff --git a/src/serialport/qtudev_p.h b/src/serialport/qtudev_p.h
+index af2dab2..8e17f64 100644
+--- a/src/serialport/qtudev_p.h
++++ b/src/serialport/qtudev_p.h
+@@ -111,9 +111,17 @@ inline QFunctionPointer resolveSymbol(QLibrary *udevLibrary, const char *symbolN
+ inline bool resolveSymbols(QLibrary *udevLibrary)
+ {
+     if (!udevLibrary->isLoaded()) {
++#ifdef NIXPKGS_LIBUDEV
++        udevLibrary->setFileNameAndVersion(QLatin1String(NIXPKGS_LIBUDEV), 1);
++#else
+         udevLibrary->setFileNameAndVersion(QStringLiteral("udev"), 1);
++#endif
+         if (!udevLibrary->load()) {
++#ifdef NIXPKGS_LIBUDEV
++            udevLibrary->setFileNameAndVersion(QLatin1String(NIXPKGS_LIBUDEV), 0);
++#else
+             udevLibrary->setFileNameAndVersion(QStringLiteral("udev"), 0);
++#endif
+             if (!udevLibrary->load()) {
+                 qWarning("Failed to load the library: %s, supported version(s): %i and %i", qPrintable(udevLibrary->fileName()), 1, 0);
+                 return false;
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.11/qttools.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.11/qttools.patch
new file mode 100644
index 000000000000..fbba439ef7a5
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.11/qttools.patch
@@ -0,0 +1,71 @@
+diff --git a/src/assistant/help/Qt5HelpConfigExtras.cmake.in b/src/assistant/help/Qt5HelpConfigExtras.cmake.in
+index 3b97923a..63336bd5 100644
+--- a/src/assistant/help/Qt5HelpConfigExtras.cmake.in
++++ b/src/assistant/help/Qt5HelpConfigExtras.cmake.in
+@@ -2,11 +2,10 @@
+ if (NOT TARGET Qt5::qcollectiongenerator)
+     add_executable(Qt5::qcollectiongenerator IMPORTED)
+ 
+-!!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5Help_install_prefix}/$${CMAKE_BIN_DIR}qcollectiongenerator$$CMAKE_BIN_SUFFIX\")
+-!!ELSE
+     set(imported_location \"$${CMAKE_BIN_DIR}qcollectiongenerator$$CMAKE_BIN_SUFFIX\")
+-!!ENDIF
++    if(NOT EXISTS \"${imported_location}\")
++        set(imported_location \"$${CMAKE_BIN_DIR}qcollectiongenerator$$CMAKE_BIN_SUFFIX\")
++    endif()
+     _qt5_Help_check_file_exists(${imported_location})
+ 
+     set_target_properties(Qt5::qcollectiongenerator PROPERTIES
+@@ -17,11 +16,7 @@ endif()
+ if (NOT TARGET Qt5::qhelpgenerator)
+     add_executable(Qt5::qhelpgenerator IMPORTED)
+ 
+-!!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5Help_install_prefix}/$${CMAKE_BIN_DIR}qhelpgenerator$$CMAKE_BIN_SUFFIX\")
+-!!ELSE
+     set(imported_location \"$${CMAKE_BIN_DIR}qhelpgenerator$$CMAKE_BIN_SUFFIX\")
+-!!ENDIF
+     _qt5_Help_check_file_exists(${imported_location})
+ 
+     set_target_properties(Qt5::qhelpgenerator PROPERTIES
+diff --git a/src/linguist/Qt5LinguistToolsConfig.cmake.in b/src/linguist/Qt5LinguistToolsConfig.cmake.in
+index 4318b16f..d60db4ff 100644
+--- a/src/linguist/Qt5LinguistToolsConfig.cmake.in
++++ b/src/linguist/Qt5LinguistToolsConfig.cmake.in
+@@ -44,11 +44,7 @@ endmacro()
+ if (NOT TARGET Qt5::lrelease)
+     add_executable(Qt5::lrelease IMPORTED)
+ 
+-!!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5_linguisttools_install_prefix}/$${CMAKE_BIN_DIR}lrelease$$CMAKE_BIN_SUFFIX\")
+-!!ELSE
+     set(imported_location \"$${CMAKE_BIN_DIR}lrelease$$CMAKE_BIN_SUFFIX\")
+-!!ENDIF
+     _qt5_LinguistTools_check_file_exists(${imported_location})
+ 
+     set_target_properties(Qt5::lrelease PROPERTIES
+@@ -59,11 +55,7 @@ endif()
+ if (NOT TARGET Qt5::lupdate)
+     add_executable(Qt5::lupdate IMPORTED)
+ 
+-!!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5_linguisttools_install_prefix}/$${CMAKE_BIN_DIR}lupdate$$CMAKE_BIN_SUFFIX\")
+-!!ELSE
+     set(imported_location \"$${CMAKE_BIN_DIR}lupdate$$CMAKE_BIN_SUFFIX\")
+-!!ENDIF
+     _qt5_LinguistTools_check_file_exists(${imported_location})
+ 
+     set_target_properties(Qt5::lupdate PROPERTIES
+@@ -74,11 +66,7 @@ endif()
+ if (NOT TARGET Qt5::lconvert)
+     add_executable(Qt5::lconvert IMPORTED)
+ 
+-!!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5_linguisttools_install_prefix}/$${CMAKE_BIN_DIR}lconvert$$CMAKE_BIN_SUFFIX\")
+-!!ELSE
+     set(imported_location \"$${CMAKE_BIN_DIR}lconvert$$CMAKE_BIN_SUFFIX\")
+-!!ENDIF
+     _qt5_LinguistTools_check_file_exists(${imported_location})
+ 
+     set_target_properties(Qt5::lconvert PROPERTIES
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.11/qtwebengine-darwin-no-platform-check.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.11/qtwebengine-darwin-no-platform-check.patch
new file mode 100644
index 000000000000..3e1a8762b361
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.11/qtwebengine-darwin-no-platform-check.patch
@@ -0,0 +1,37 @@
+diff --git a/mkspecs/features/platform.prf b/mkspecs/features/platform.prf
+--- a/mkspecs/features/platform.prf
++++ b/mkspecs/features/platform.prf
+@@ -38,10 +38,6 @@ defineTest(isPlatformSupported) {
+          return(false)
+     }
+   } else:osx {
+-    !isMinXcodeVersion(7, 3) {
+-      skipBuild("Using Xcode version $$QMAKE_XCODE_VERSION, but at least version 7.3 is required to build Qt WebEngine.")
+-      return(false)
+-    }
+     !clang|intel_icc {
+         skipBuild("Qt WebEngine on macOS requires Clang.")
+         return(false)
+@@ -52,10 +48,6 @@ defineTest(isPlatformSupported) {
+       skipBuild("Building Qt WebEngine requires macOS version 10.11 or newer.")
+       return(false)
+     }
+-    !isMinOSXSDKVersion(10, 10): {
+-      skipBuild("Building Qt WebEngine requires a macOS SDK version of 10.11 or newer. Current version is $${WEBENGINE_OSX_SDK_PRODUCT_VERSION}.")
+-      return(false)
+-    }
+   } else {
+     skipBuild("Unknown platform. Qt WebEngine only supports Linux, Windows, and macOS.")
+     return(false)
+diff --git a/src/core/config/mac_osx.pri b/src/core/config/mac_osx.pri
+--- a/src/core/config/mac_osx.pri
++++ b/src/core/config/mac_osx.pri
+@@ -5,8 +5,6 @@ load(functions)
+ # otherwise query for it.
+ QMAKE_MAC_SDK_VERSION = $$eval(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.SDKVersion)
+ isEmpty(QMAKE_MAC_SDK_VERSION) {
+-     QMAKE_MAC_SDK_VERSION = $$system("/usr/bin/xcodebuild -sdk $${QMAKE_MAC_SDK} -version SDKVersion 2>/dev/null")
+-     isEmpty(QMAKE_MAC_SDK_VERSION): error("Could not resolve SDK version for \'$${QMAKE_MAC_SDK}\'")
+ }
+ 
+ QMAKE_CLANG_DIR = "/usr"
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.11/qtwebengine-no-build-skip.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.11/qtwebengine-no-build-skip.patch
new file mode 100644
index 000000000000..f332d5e1bb2b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.11/qtwebengine-no-build-skip.patch
@@ -0,0 +1,12 @@
+diff --git a/qtwebengine.pro b/qtwebengine.pro
+--- a/qtwebengine.pro
++++ b/qtwebengine.pro
+@@ -5,7 +5,7 @@ runConfigure()
+ 
+ !isEmpty(skipBuildReason) {
+     SUBDIRS =
+-    log($${skipBuildReason}$${EOL})
++    error($${skipBuildReason}$${EOL})
+     log(QtWebEngine will not be built.$${EOL})
+ }
+ 
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.11/qtwebkit.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.11/qtwebkit.patch
new file mode 100644
index 000000000000..b94a4b76cbab
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.11/qtwebkit.patch
@@ -0,0 +1,12 @@
+diff --git a/Source/WebKit2/PlatformQt.cmake b/Source/WebKit2/PlatformQt.cmake
+--- a/Source/WebKit2/PlatformQt.cmake
++++ b/Source/WebKit2/PlatformQt.cmake
+@@ -261,6 +261,7 @@
+ list(APPEND WebKit2_SYSTEM_INCLUDE_DIRECTORIES
+     ${GLIB_INCLUDE_DIRS}
+     ${GSTREAMER_INCLUDE_DIRS}
++    ${GSTREAMER_PBUTILS_INCLUDE_DIRS}
+     ${Qt5Quick_INCLUDE_DIRS}
+     ${Qt5Quick_PRIVATE_INCLUDE_DIRS}
+     ${SQLITE_INCLUDE_DIR}
+
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.11/srcs.nix b/nixpkgs/pkgs/development/libraries/qt-5/5.11/srcs.nix
new file mode 100644
index 000000000000..cff49b180337
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.11/srcs.nix
@@ -0,0 +1,325 @@
+# DO NOT EDIT! This file is generated automatically by fetch-kde-qt.sh
+{ fetchurl, mirror }:
+
+{
+  qt3d = {
+    version = "5.11.3";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.11/5.11.3/submodules/qt3d-everywhere-src-5.11.3.tar.xz";
+      sha256 = "1awyv40jgbb30yp5zxf6j9wq96nmk8zyhbh4fpn9gn35ychmr984";
+      name = "qt3d-everywhere-src-5.11.3.tar.xz";
+    };
+  };
+  qtactiveqt = {
+    version = "5.11.3";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.11/5.11.3/submodules/qtactiveqt-everywhere-src-5.11.3.tar.xz";
+      sha256 = "0g35yhp01c34m91fp5vzzq0d2kzz0yswpjjk5cg36j0ddnfcsh4d";
+      name = "qtactiveqt-everywhere-src-5.11.3.tar.xz";
+    };
+  };
+  qtandroidextras = {
+    version = "5.11.3";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.11/5.11.3/submodules/qtandroidextras-everywhere-src-5.11.3.tar.xz";
+      sha256 = "0clqz10ry70f0v8hbw37fhlwrsr5jddg99yjsk9db250dwbqzq27";
+      name = "qtandroidextras-everywhere-src-5.11.3.tar.xz";
+    };
+  };
+  qtbase = {
+    version = "5.11.3";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.11/5.11.3/submodules/qtbase-everywhere-src-5.11.3.tar.xz";
+      sha256 = "071yc9iz14qs4s8yvrwllyfdzp5yjxsdpvbjxdrf0g5q69vqigy6";
+      name = "qtbase-everywhere-src-5.11.3.tar.xz";
+    };
+  };
+  qtcanvas3d = {
+    version = "5.11.3";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.11/5.11.3/submodules/qtcanvas3d-everywhere-src-5.11.3.tar.xz";
+      sha256 = "0f110z7cmkzns9k00aa5zhzq2fpybfxkd7gdlwzcbhc8hn20986m";
+      name = "qtcanvas3d-everywhere-src-5.11.3.tar.xz";
+    };
+  };
+  qtcharts = {
+    version = "5.11.3";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.11/5.11.3/submodules/qtcharts-everywhere-src-5.11.3.tar.xz";
+      sha256 = "1p4m1nkbbxlkwmbmasx5r83skzssmlcgfzyvj30x2dyrqkmz7627";
+      name = "qtcharts-everywhere-src-5.11.3.tar.xz";
+    };
+  };
+  qtconnectivity = {
+    version = "5.11.3";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.11/5.11.3/submodules/qtconnectivity-everywhere-src-5.11.3.tar.xz";
+      sha256 = "0amks3qad31i7cha85kvcaxvlmmgkc3gm4jdkw2p02ixxfygr30l";
+      name = "qtconnectivity-everywhere-src-5.11.3.tar.xz";
+    };
+  };
+  qtdatavis3d = {
+    version = "5.11.3";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.11/5.11.3/submodules/qtdatavis3d-everywhere-src-5.11.3.tar.xz";
+      sha256 = "1kqwr3avcvcyy4i28vjgxk1bsjj9011zr668hsk1zrjxnnwjwdl3";
+      name = "qtdatavis3d-everywhere-src-5.11.3.tar.xz";
+    };
+  };
+  qtdeclarative = {
+    version = "5.11.3";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.11/5.11.3/submodules/qtdeclarative-everywhere-src-5.11.3.tar.xz";
+      sha256 = "1rhsf9bma2zwwpixk2fsg31x7c1pmsk144npypgc9w86swhkc9lf";
+      name = "qtdeclarative-everywhere-src-5.11.3.tar.xz";
+    };
+  };
+  qtdoc = {
+    version = "5.11.3";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.11/5.11.3/submodules/qtdoc-everywhere-src-5.11.3.tar.xz";
+      sha256 = "06nl8lzrilj8yify5qy4fm9la6dh71aamg19jhvvi657cshiclsq";
+      name = "qtdoc-everywhere-src-5.11.3.tar.xz";
+    };
+  };
+  qtgamepad = {
+    version = "5.11.3";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.11/5.11.3/submodules/qtgamepad-everywhere-src-5.11.3.tar.xz";
+      sha256 = "1k222cx18zq48sfna91hmy427qzk2n2xz3dlyz59iyz72k6915g9";
+      name = "qtgamepad-everywhere-src-5.11.3.tar.xz";
+    };
+  };
+  qtgraphicaleffects = {
+    version = "5.11.3";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.11/5.11.3/submodules/qtgraphicaleffects-everywhere-src-5.11.3.tar.xz";
+      sha256 = "1qjpdzkamf27cg5n1wsf0zk939lcgppgydfjzap9s4fxzj1nkn0l";
+      name = "qtgraphicaleffects-everywhere-src-5.11.3.tar.xz";
+    };
+  };
+  qtimageformats = {
+    version = "5.11.3";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.11/5.11.3/submodules/qtimageformats-everywhere-src-5.11.3.tar.xz";
+      sha256 = "0zq8igsjyyhxsjr43vpaasrqjw3x0g6rwqf8kaz7y9vs7ny63ch4";
+      name = "qtimageformats-everywhere-src-5.11.3.tar.xz";
+    };
+  };
+  qtlocation = {
+    version = "5.11.3";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.11/5.11.3/submodules/qtlocation-everywhere-src-5.11.3.tar.xz";
+      sha256 = "1sq0f41jwmsimv9a1wl2nk5nifjppm5j92rr4n4s7qwnnjjrir2q";
+      name = "qtlocation-everywhere-src-5.11.3.tar.xz";
+    };
+  };
+  qtmacextras = {
+    version = "5.11.3";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.11/5.11.3/submodules/qtmacextras-everywhere-src-5.11.3.tar.xz";
+      sha256 = "1j9sqmcwswr8v9z8mcbm10bj7nz8nv9mir0xsc5123ik1gw2c3lk";
+      name = "qtmacextras-everywhere-src-5.11.3.tar.xz";
+    };
+  };
+  qtmultimedia = {
+    version = "5.11.3";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.11/5.11.3/submodules/qtmultimedia-everywhere-src-5.11.3.tar.xz";
+      sha256 = "0h9wx86zj20n4xc3qnml0i360x2dc1yd2z2af1flj8fwyzppi03j";
+      name = "qtmultimedia-everywhere-src-5.11.3.tar.xz";
+    };
+  };
+  qtnetworkauth = {
+    version = "5.11.3";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.11/5.11.3/submodules/qtnetworkauth-everywhere-src-5.11.3.tar.xz";
+      sha256 = "0dd35698wzg89975vi2ijl2lym495fjizsl03mjixsjnvb1x0q50";
+      name = "qtnetworkauth-everywhere-src-5.11.3.tar.xz";
+    };
+  };
+  qtpurchasing = {
+    version = "5.11.3";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.11/5.11.3/submodules/qtpurchasing-everywhere-src-5.11.3.tar.xz";
+      sha256 = "1fd0gxdj5mrh81iwimq1243i3n47sqv9ik8nslahfh0q3dsx7k8n";
+      name = "qtpurchasing-everywhere-src-5.11.3.tar.xz";
+    };
+  };
+  qtquickcontrols = {
+    version = "5.11.3";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.11/5.11.3/submodules/qtquickcontrols-everywhere-src-5.11.3.tar.xz";
+      sha256 = "0dvmy31qbl76yy0j5y8m7mvnmqyg2c01fmlkn0snvc5h5ah5skjf";
+      name = "qtquickcontrols-everywhere-src-5.11.3.tar.xz";
+    };
+  };
+  qtquickcontrols2 = {
+    version = "5.11.3";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.11/5.11.3/submodules/qtquickcontrols2-everywhere-src-5.11.3.tar.xz";
+      sha256 = "11nhpb0xckv5jjkqj5szr94c2rvyjwr89ch58hh64nsqaav30mpl";
+      name = "qtquickcontrols2-everywhere-src-5.11.3.tar.xz";
+    };
+  };
+  qtremoteobjects = {
+    version = "5.11.3";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.11/5.11.3/submodules/qtremoteobjects-everywhere-src-5.11.3.tar.xz";
+      sha256 = "1d3jzsxfyjhgb6wj9iv1388bv7j6pi08346nmkm1c1a4iykhc0zp";
+      name = "qtremoteobjects-everywhere-src-5.11.3.tar.xz";
+    };
+  };
+  qtscript = {
+    version = "5.11.3";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.11/5.11.3/submodules/qtscript-everywhere-src-5.11.3.tar.xz";
+      sha256 = "027cvggbcvwyz76cn1bl1zvqg0nq7iica1b7yx7xyy0hb36g715v";
+      name = "qtscript-everywhere-src-5.11.3.tar.xz";
+    };
+  };
+  qtscxml = {
+    version = "5.11.3";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.11/5.11.3/submodules/qtscxml-everywhere-src-5.11.3.tar.xz";
+      sha256 = "1mv8mz36v34dckrzy5r41mq3sqznbalrhndk3avz2154xmkjf5qk";
+      name = "qtscxml-everywhere-src-5.11.3.tar.xz";
+    };
+  };
+  qtsensors = {
+    version = "5.11.3";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.11/5.11.3/submodules/qtsensors-everywhere-src-5.11.3.tar.xz";
+      sha256 = "0n88c8xi9pbyh7q1pcqv4yjv6nx62abflj8qgfr4qzb0sp8m6mx7";
+      name = "qtsensors-everywhere-src-5.11.3.tar.xz";
+    };
+  };
+  qtserialbus = {
+    version = "5.11.3";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.11/5.11.3/submodules/qtserialbus-everywhere-src-5.11.3.tar.xz";
+      sha256 = "0vf12jk1ma0v0dlpliw1x9i04iaik1kjkiaby7gaxm2abprxwr2n";
+      name = "qtserialbus-everywhere-src-5.11.3.tar.xz";
+    };
+  };
+  qtserialport = {
+    version = "5.11.3";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.11/5.11.3/submodules/qtserialport-everywhere-src-5.11.3.tar.xz";
+      sha256 = "1nkbfsxzgicwns3k11hhzjxy2hgrigj8xcw2by0jc1j71mnmxi4n";
+      name = "qtserialport-everywhere-src-5.11.3.tar.xz";
+    };
+  };
+  qtspeech = {
+    version = "5.11.3";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.11/5.11.3/submodules/qtspeech-everywhere-src-5.11.3.tar.xz";
+      sha256 = "158p7zqd0vg55gf88jzc3d4f7649ihh80k0m1q46m2yp6fpdjbxr";
+      name = "qtspeech-everywhere-src-5.11.3.tar.xz";
+    };
+  };
+  qtsvg = {
+    version = "5.11.3";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.11/5.11.3/submodules/qtsvg-everywhere-src-5.11.3.tar.xz";
+      sha256 = "14a4rprbj9f9rhixbk7143xdz34d7d39xh9v2sc1w43q9sf2rsi1";
+      name = "qtsvg-everywhere-src-5.11.3.tar.xz";
+    };
+  };
+  qttools = {
+    version = "5.11.3";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.11/5.11.3/submodules/qttools-everywhere-src-5.11.3.tar.xz";
+      sha256 = "13lzdxxi02yhvx4mflhisl6aqv2fiss5m804cqccd1wvp8dyh1f2";
+      name = "qttools-everywhere-src-5.11.3.tar.xz";
+    };
+  };
+  qttranslations = {
+    version = "5.11.3";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.11/5.11.3/submodules/qttranslations-everywhere-src-5.11.3.tar.xz";
+      sha256 = "0j8i2kabz22vqb0qj41pkjv848zblqxs71sydc3xcd5av22b517s";
+      name = "qttranslations-everywhere-src-5.11.3.tar.xz";
+    };
+  };
+  qtvirtualkeyboard = {
+    version = "5.11.3";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.11/5.11.3/submodules/qtvirtualkeyboard-everywhere-src-5.11.3.tar.xz";
+      sha256 = "17jb7cbfy5c19fr9frql6q22in3ra3a4fbff0kjykllxb8j40p4c";
+      name = "qtvirtualkeyboard-everywhere-src-5.11.3.tar.xz";
+    };
+  };
+  qtwayland = {
+    version = "5.11.3";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.11/5.11.3/submodules/qtwayland-everywhere-src-5.11.3.tar.xz";
+      sha256 = "1chz4wchgkzd45h143i5hkqg0whcgdbj37gkg7j4kj31whllzjb2";
+      name = "qtwayland-everywhere-src-5.11.3.tar.xz";
+    };
+  };
+  qtwebchannel = {
+    version = "5.11.3";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.11/5.11.3/submodules/qtwebchannel-everywhere-src-5.11.3.tar.xz";
+      sha256 = "1wrdawlqvcw84h8q52mvbjhp1vkd6fhz6c8ijlg9rw0s3fj4y99w";
+      name = "qtwebchannel-everywhere-src-5.11.3.tar.xz";
+    };
+  };
+  qtwebengine = {
+    version = "5.11.3";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.11/5.11.3/submodules/qtwebengine-everywhere-src-5.11.3.tar.xz";
+      sha256 = "1zmqsdais85cdfh2jh8h4a5jcamp1mzdk3vgqm6xnldqf6nrxd2v";
+      name = "qtwebengine-everywhere-src-5.11.3.tar.xz";
+    };
+  };
+  qtwebglplugin = {
+    version = "5.11.3";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.11/5.11.3/submodules/qtwebglplugin-everywhere-src-5.11.3.tar.xz";
+      sha256 = "0wqz8lycmi7pffzy0pz5960w109lbk4mkbw0l1lh64avl6clq7b9";
+      name = "qtwebglplugin-everywhere-src-5.11.3.tar.xz";
+    };
+  };
+  qtwebsockets = {
+    version = "5.11.3";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.11/5.11.3/submodules/qtwebsockets-everywhere-src-5.11.3.tar.xz";
+      sha256 = "1ffmapfy68xwwbxbg19ng6b5h8v42cf78s21j7rgq49gm70r0402";
+      name = "qtwebsockets-everywhere-src-5.11.3.tar.xz";
+    };
+  };
+  qtwebview = {
+    version = "5.11.3";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.11/5.11.3/submodules/qtwebview-everywhere-src-5.11.3.tar.xz";
+      sha256 = "1njmn1n03dp4md8cz58cq2z6bsxd8nwlw0238zmavh7px3jzc9kh";
+      name = "qtwebview-everywhere-src-5.11.3.tar.xz";
+    };
+  };
+  qtwinextras = {
+    version = "5.11.3";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.11/5.11.3/submodules/qtwinextras-everywhere-src-5.11.3.tar.xz";
+      sha256 = "1xf9gc0wqk9jz2ayx29vx0vmm72x9h4qxp2fvgpclns621wyhw72";
+      name = "qtwinextras-everywhere-src-5.11.3.tar.xz";
+    };
+  };
+  qtx11extras = {
+    version = "5.11.3";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.11/5.11.3/submodules/qtx11extras-everywhere-src-5.11.3.tar.xz";
+      sha256 = "11fd2mc20qmnyv1vqhaqad2q6m0i4lmkr432rmqvpkgphpkfp7pr";
+      name = "qtx11extras-everywhere-src-5.11.3.tar.xz";
+    };
+  };
+  qtxmlpatterns = {
+    version = "5.11.3";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.11/5.11.3/submodules/qtxmlpatterns-everywhere-src-5.11.3.tar.xz";
+      sha256 = "1vhfvgi39miqsx3iq7c9sii2sykq0yfng69b70i0smr20zihpl4b";
+      name = "qtxmlpatterns-everywhere-src-5.11.3.tar.xz";
+    };
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.12/default.nix b/nixpkgs/pkgs/development/libraries/qt-5/5.12/default.nix
new file mode 100644
index 000000000000..ef0cf97a428d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.12/default.nix
@@ -0,0 +1,157 @@
+/*
+
+# Updates
+
+Before a major version update, make a copy of this directory. (We like to
+keep the old version around for a short time after major updates.) Add a
+top-level attribute to `top-level/all-packages.nix`.
+
+1. Update the URL in `pkgs/development/libraries/qt-5/$VERSION/fetch.sh`.
+2. From the top of the Nixpkgs tree, run
+   `./maintainers/scripts/fetch-kde-qt.sh > pkgs/development/libraries/qt-5/$VERSION/srcs.nix`.
+3. Update `qtCompatVersion` below if the minor version number changes.
+4. Check that the new packages build correctly.
+5. Commit the changes and open a pull request.
+
+*/
+
+{
+  newScope,
+  stdenv, fetchurl, fetchFromGitHub, makeSetupHook,
+  bison, cups ? null, harfbuzz, libGL, perl,
+  gstreamer, gst-plugins-base, gtk3, dconf,
+  cf-private, llvmPackages_5,
+
+  # options
+  developerBuild ? false,
+  decryptSslTraffic ? false,
+  debug ? false,
+}:
+
+with stdenv.lib;
+
+let
+
+  qtCompatVersion = "5.12";
+
+  mirror = "https://download.qt.io";
+  srcs = import ./srcs.nix { inherit fetchurl; inherit mirror; } // {
+    # Community port of the now unmaintained upstream qtwebkit.
+    qtwebkit = {
+      src = fetchFromGitHub {
+        owner = "annulen";
+        repo = "webkit";
+        rev = "4ce8ebc4094512b9916bfa5984065e95ac97c9d8";
+        sha256 = "05h1xnxzbf7sp3plw5dndsvpf6iigh0bi4vlj4svx0hkf1giakjf";
+      };
+      version = "5.212-alpha-01-26-2018";
+    };
+  };
+
+  patches = {
+    qtbase = [
+      ./qtbase.patch
+      ./qtbase-fixguicmake.patch
+    ];
+    qtdeclarative = [ ./qtdeclarative.patch ];
+    qtscript = [ ./qtscript.patch ];
+    qtserialport = [ ./qtserialport.patch ];
+    qtwebengine = [
+      ./qtwebengine-no-build-skip.patch
+      ./qtwebengine-CVE-2019-5786.patch
+    ]
+      ++ optional stdenv.isDarwin ./qtwebengine-darwin-no-platform-check.patch;
+    qtwebkit = [ ./qtwebkit.patch ]
+      ++ optionals stdenv.isDarwin [
+        ./qtwebkit-darwin-no-readline.patch
+        ./qtwebkit-darwin-no-qos-classes.patch
+      ];
+  };
+
+  mkDerivation =
+    import ../mkDerivation.nix {
+      inherit (stdenv) lib;
+      stdenv = if stdenv.cc.isClang then llvmPackages_5.stdenv else stdenv;
+    }
+    { inherit debug; };
+
+  qtModule =
+    import ../qtModule.nix
+    { inherit mkDerivation perl; inherit (stdenv) lib; }
+    { inherit self srcs patches; };
+
+  addPackages = self: with self;
+    let
+      callPackage = self.newScope { inherit qtCompatVersion qtModule srcs; };
+    in {
+
+      inherit mkDerivation;
+
+      qtbase = callPackage ../modules/qtbase.nix {
+        inherit (srcs.qtbase) src version;
+        patches = patches.qtbase;
+        inherit bison cups harfbuzz libGL;
+        withGtk3 = true; inherit dconf gtk3;
+        inherit developerBuild decryptSslTraffic;
+      };
+
+      qtcharts = callPackage ../modules/qtcharts.nix {};
+      qtconnectivity = callPackage ../modules/qtconnectivity.nix {
+        inherit cf-private;
+      };
+      qtdeclarative = callPackage ../modules/qtdeclarative.nix {};
+      qtdoc = callPackage ../modules/qtdoc.nix {};
+      qtgraphicaleffects = callPackage ../modules/qtgraphicaleffects.nix {};
+      qtimageformats = callPackage ../modules/qtimageformats.nix {};
+      qtlocation = callPackage ../modules/qtlocation.nix {};
+      qtmacextras = callPackage ../modules/qtmacextras.nix {
+        inherit cf-private;
+      };
+      qtmultimedia = callPackage ../modules/qtmultimedia.nix {
+        inherit gstreamer gst-plugins-base;
+      };
+      qtnetworkauth = callPackage ../modules/qtnetworkauth.nix {};
+      qtquick1 = null;
+      qtquickcontrols = callPackage ../modules/qtquickcontrols.nix {};
+      qtquickcontrols2 = callPackage ../modules/qtquickcontrols2.nix {};
+      qtscript = callPackage ../modules/qtscript.nix {};
+      qtsensors = callPackage ../modules/qtsensors.nix {};
+      qtserialport = callPackage ../modules/qtserialport.nix {};
+      qtspeech = callPackage ../modules/qtspeech.nix {};
+      qtsvg = callPackage ../modules/qtsvg.nix {};
+      qttools = callPackage ../modules/qttools.nix {};
+      qttranslations = callPackage ../modules/qttranslations.nix {};
+      qtvirtualkeyboard = callPackage ../modules/qtvirtualkeyboard.nix {};
+      qtwayland = callPackage ../modules/qtwayland.nix {};
+      qtwebchannel = callPackage ../modules/qtwebchannel.nix {};
+      qtwebengine = callPackage ../modules/qtwebengine.nix {};
+      qtwebglplugin = callPackage ../modules/qtwebglplugin.nix {};
+      qtwebkit = callPackage ../modules/qtwebkit.nix {};
+      qtwebsockets = callPackage ../modules/qtwebsockets.nix {};
+      qtwebview = callPackage ../modules/qtwebview.nix {};
+      qtx11extras = callPackage ../modules/qtx11extras.nix {};
+      qtxmlpatterns = callPackage ../modules/qtxmlpatterns.nix {};
+
+      env = callPackage ../qt-env.nix {};
+      full = env "qt-full-${qtbase.version}" ([
+        qtcharts qtconnectivity qtdeclarative qtdoc qtgraphicaleffects
+        qtimageformats qtlocation qtmultimedia qtquickcontrols qtquickcontrols2
+        qtscript qtsensors qtserialport qtsvg qttools qttranslations
+        qtvirtualkeyboard qtwebchannel qtwebengine qtwebkit qtwebsockets
+        qtwebview qtx11extras qtxmlpatterns
+      ] ++ optional (!stdenv.isDarwin) qtwayland
+        ++ optional (stdenv.isDarwin) qtmacextras);
+
+      qmake = makeSetupHook {
+        deps = [ self.qtbase.dev ];
+        substitutions = {
+          inherit (stdenv) isDarwin;
+          qtbase_dev = self.qtbase.dev;
+          fix_qt_builtin_paths = ../hooks/fix-qt-builtin-paths.sh;
+        };
+      } ../hooks/qmake-hook.sh;
+    };
+
+   self = makeScope newScope addPackages;
+
+in self
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.12/fetch.sh b/nixpkgs/pkgs/development/libraries/qt-5/5.12/fetch.sh
new file mode 100644
index 000000000000..aa3a0fe94898
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.12/fetch.sh
@@ -0,0 +1 @@
+WGET_ARGS=( http://download.qt.io/official_releases/qt/5.12/5.12.0/submodules/ )
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtbase-fixguicmake.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtbase-fixguicmake.patch
new file mode 100644
index 000000000000..8b46d432812a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtbase-fixguicmake.patch
@@ -0,0 +1,30 @@
+diff --git a/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in b/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
+index 0bbc871..3673634 100644
+--- a/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
++++ b/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
+@@ -286,7 +286,7 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
+     macro(_populate_$${CMAKE_MODULE_NAME}_plugin_properties Plugin Configuration PLUGIN_LOCATION)
+         set_property(TARGET Qt5::${Plugin} APPEND PROPERTY IMPORTED_CONFIGURATIONS ${Configuration})
+ 
+-        set(imported_location \"$${CMAKE_PLUGIN_DIR}${PLUGIN_LOCATION}\")
++        set(imported_location \"${PLUGIN_LOCATION}\")
+         _qt5_$${CMAKE_MODULE_NAME}_check_file_exists(${imported_location})
+         set_target_properties(Qt5::${Plugin} PROPERTIES
+             \"IMPORTED_LOCATION_${Configuration}\" ${imported_location}
+diff --git a/mkspecs/features/data/cmake/Qt5PluginTarget.cmake.in b/mkspecs/features/data/cmake/Qt5PluginTarget.cmake.in
+index 5baf0fd..3583745 100644
+--- a/mkspecs/features/data/cmake/Qt5PluginTarget.cmake.in
++++ b/mkspecs/features/data/cmake/Qt5PluginTarget.cmake.in
+@@ -2,10 +2,10 @@
+ add_library(Qt5::$$CMAKE_PLUGIN_NAME MODULE IMPORTED)
+ 
+ !!IF !isEmpty(CMAKE_RELEASE_TYPE)
+-_populate_$${CMAKE_MODULE_NAME}_plugin_properties($$CMAKE_PLUGIN_NAME RELEASE \"$${CMAKE_PLUGIN_LOCATION_RELEASE}\")
++_populate_$${CMAKE_MODULE_NAME}_plugin_properties($$CMAKE_PLUGIN_NAME RELEASE \"$${CMAKE_PLUGIN_DIR}$${CMAKE_PLUGIN_LOCATION_RELEASE}\")
+ !!ENDIF
+ !!IF !isEmpty(CMAKE_DEBUG_TYPE)
+-_populate_$${CMAKE_MODULE_NAME}_plugin_properties($$CMAKE_PLUGIN_NAME DEBUG \"$${CMAKE_PLUGIN_LOCATION_DEBUG}\")
++_populate_$${CMAKE_MODULE_NAME}_plugin_properties($$CMAKE_PLUGIN_NAME DEBUG \"$${CMAKE_PLUGIN_DIR}$${CMAKE_PLUGIN_LOCATION_DEBUG}\")
+ !!ENDIF
+ 
+ list(APPEND Qt5$${CMAKE_MODULE_NAME}_PLUGINS Qt5::$$CMAKE_PLUGIN_NAME)
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtbase.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtbase.patch
new file mode 100644
index 000000000000..68ebd56b76c0
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtbase.patch
@@ -0,0 +1,1096 @@
+diff --git a/mkspecs/common/mac.conf b/mkspecs/common/mac.conf
+index 61bea952b2..9909dae726 100644
+--- a/mkspecs/common/mac.conf
++++ b/mkspecs/common/mac.conf
+@@ -23,7 +23,7 @@ QMAKE_INCDIR_OPENGL     = \
+ 
+ QMAKE_FIX_RPATH         = install_name_tool -id
+ 
+-QMAKE_LFLAGS_RPATH      = -Wl,-rpath,
++QMAKE_LFLAGS_RPATH      =
+ QMAKE_LFLAGS_GCSECTIONS = -Wl,-dead_strip
+ 
+ QMAKE_LFLAGS_REL_RPATH  =
+diff --git a/mkspecs/features/create_cmake.prf b/mkspecs/features/create_cmake.prf
+index 2ed708e085..05e60ff45f 100644
+--- a/mkspecs/features/create_cmake.prf
++++ b/mkspecs/features/create_cmake.prf
+@@ -21,7 +21,7 @@ load(cmake_functions)
+ # at cmake time whether package has been found via a symlink, and correct
+ # that to an absolute path. This is only done for installations to
+ # the /usr or / prefix.
+-CMAKE_INSTALL_LIBS_DIR = $$cmakeTargetPath($$[QT_INSTALL_LIBS])
++CMAKE_INSTALL_LIBS_DIR = $$cmakeTargetPath($$NIX_OUTPUT_OUT/lib/)
+ contains(CMAKE_INSTALL_LIBS_DIR, ^(/usr)?/lib(64)?.*): CMAKE_USR_MOVE_WORKAROUND = $$CMAKE_INSTALL_LIBS_DIR
+ 
+ CMAKE_OUT_DIR = $$MODULE_BASE_OUTDIR/lib/cmake
+@@ -51,45 +51,20 @@ split_incpath {
+         $$cmake_extra_source_includes.output
+ }
+ 
+-CMAKE_INCLUDE_DIR = $$cmakeRelativePath($$[QT_INSTALL_HEADERS], $$[QT_INSTALL_PREFIX])
+-contains(CMAKE_INCLUDE_DIR, "^\\.\\./.*") {
+-    CMAKE_INCLUDE_DIR = $$[QT_INSTALL_HEADERS]/
+-    CMAKE_INCLUDE_DIR_IS_ABSOLUTE = True
+-}
++CMAKE_INCLUDE_DIR = $$NIX_OUTPUT_DEV/include/
++CMAKE_INCLUDE_DIR_IS_ABSOLUTE = True
+ 
+-CMAKE_LIB_DIR = $$cmakeRelativePath($$[QT_INSTALL_LIBS], $$[QT_INSTALL_PREFIX])
+-contains(CMAKE_LIB_DIR,"^\\.\\./.*") {
+-    CMAKE_LIB_DIR = $$[QT_INSTALL_LIBS]/
+-    CMAKE_LIB_DIR_IS_ABSOLUTE = True
+-} else {
+-    CMAKE_RELATIVE_INSTALL_LIBS_DIR = $$cmakeRelativePath($$[QT_INSTALL_PREFIX], $$[QT_INSTALL_LIBS])
+-    # We need to go up another two levels because the CMake files are
+-    # installed in $${CMAKE_LIB_DIR}/cmake/Qt5$${CMAKE_MODULE_NAME}
+-    CMAKE_RELATIVE_INSTALL_DIR = "$${CMAKE_RELATIVE_INSTALL_LIBS_DIR}../../"
+-}
++CMAKE_BIN_DIR = $$NIX_OUTPUT_BIN/bin/
++CMAKE_BIN_DIR_IS_ABSOLUTE = True
+ 
+-CMAKE_BIN_DIR = $$cmakeRelativePath($$[QT_HOST_BINS], $$[QT_INSTALL_PREFIX])
+-contains(CMAKE_BIN_DIR, "^\\.\\./.*") {
+-    CMAKE_BIN_DIR = $$[QT_HOST_BINS]/
+-    CMAKE_BIN_DIR_IS_ABSOLUTE = True
+-}
++CMAKE_LIB_DIR = $$NIX_OUTPUT_OUT/lib/
++CMAKE_LIB_DIR_IS_ABSOLUTE = True
+ 
+-CMAKE_PLUGIN_DIR = $$cmakeRelativePath($$[QT_INSTALL_PLUGINS], $$[QT_INSTALL_PREFIX])
+-contains(CMAKE_PLUGIN_DIR, "^\\.\\./.*") {
+-    CMAKE_PLUGIN_DIR = $$[QT_INSTALL_PLUGINS]/
+-    CMAKE_PLUGIN_DIR_IS_ABSOLUTE = True
+-}
+-
+-win32:!static:!staticlib {
+-    CMAKE_DLL_DIR = $$cmakeRelativePath($$[QT_INSTALL_BINS], $$[QT_INSTALL_PREFIX])
+-    contains(CMAKE_DLL_DIR, "^\\.\\./.*") {
+-        CMAKE_DLL_DIR = $$[QT_INSTALL_BINS]/
+-        CMAKE_DLL_DIR_IS_ABSOLUTE = True
+-    }
+-} else {
+-    CMAKE_DLL_DIR = $$CMAKE_LIB_DIR
+-    CMAKE_DLL_DIR_IS_ABSOLUTE = $$CMAKE_LIB_DIR_IS_ABSOLUTE
+-}
++CMAKE_PLUGIN_DIR = $$NIX_OUTPUT_PLUGIN/
++CMAKE_PLUGIN_DIR_IS_ABSOLUTE = True
++ 
++CMAKE_DLL_DIR = $$NIX_OUTPUT_OUT/lib/
++CMAKE_DLL_DIR_IS_ABSOLUTE = True
+ 
+ static|staticlib:CMAKE_STATIC_TYPE = true
+ 
+@@ -169,7 +144,7 @@ contains(CONFIG, plugin) {
+       cmake_target_file
+ 
+     cmake_qt5_plugin_file.files = $$cmake_target_file.output
+-    cmake_qt5_plugin_file.path = $$[QT_INSTALL_LIBS]/cmake/Qt5$${CMAKE_MODULE_NAME}
++    cmake_qt5_plugin_file.path = $$NIX_OUTPUT_OUT/lib/cmake/Qt5$${CMAKE_MODULE_NAME}
+     INSTALLS += cmake_qt5_plugin_file
+ 
+     return()
+@@ -316,7 +291,7 @@ exists($$cmake_macros_file.input) {
+     cmake_qt5_module_files.files += $$cmake_macros_file.output
+ }
+ 
+-cmake_qt5_module_files.path = $$[QT_INSTALL_LIBS]/cmake/Qt5$${CMAKE_MODULE_NAME}
++cmake_qt5_module_files.path = $$NIX_OUTPUT_OUT/lib/cmake/Qt5$${CMAKE_MODULE_NAME}
+ 
+ # We are generating cmake files. Most developers of Qt are not aware of cmake,
+ # so we require automatic tests to be available. The only module which should
+diff --git a/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in b/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
+index 3ed6dd5889..4c7c8da21a 100644
+--- a/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
++++ b/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
+@@ -3,30 +3,6 @@ if (CMAKE_VERSION VERSION_LESS 3.1.0)
+     message(FATAL_ERROR \"Qt 5 $${CMAKE_MODULE_NAME} module requires at least CMake version 3.1.0\")
+ endif()
+ 
+-!!IF !isEmpty(CMAKE_USR_MOVE_WORKAROUND)
+-!!IF !isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-set(_qt5$${CMAKE_MODULE_NAME}_install_prefix \"$$[QT_INSTALL_PREFIX]\")
+-!!ELSE
+-get_filename_component(_IMPORT_PREFIX \"${CMAKE_CURRENT_LIST_FILE}\" PATH)
+-# Use original install prefix when loaded through a
+-# cross-prefix symbolic link such as /lib -> /usr/lib.
+-get_filename_component(_realCurr \"${_IMPORT_PREFIX}\" REALPATH)
+-get_filename_component(_realOrig \"$$CMAKE_INSTALL_LIBS_DIR/cmake/Qt5$${CMAKE_MODULE_NAME}\" REALPATH)
+-if(_realCurr STREQUAL _realOrig)
+-    get_filename_component(_qt5$${CMAKE_MODULE_NAME}_install_prefix \"$$CMAKE_INSTALL_LIBS_DIR/$${CMAKE_RELATIVE_INSTALL_LIBS_DIR}\" ABSOLUTE)
+-else()
+-    get_filename_component(_qt5$${CMAKE_MODULE_NAME}_install_prefix \"${CMAKE_CURRENT_LIST_DIR}/$${CMAKE_RELATIVE_INSTALL_DIR}\" ABSOLUTE)
+-endif()
+-unset(_realOrig)
+-unset(_realCurr)
+-unset(_IMPORT_PREFIX)
+-!!ENDIF
+-!!ELIF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-get_filename_component(_qt5$${CMAKE_MODULE_NAME}_install_prefix \"${CMAKE_CURRENT_LIST_DIR}/$${CMAKE_RELATIVE_INSTALL_DIR}\" ABSOLUTE)
+-!!ELSE
+-set(_qt5$${CMAKE_MODULE_NAME}_install_prefix \"$$[QT_INSTALL_PREFIX]\")
+-!!ENDIF
+-
+ !!IF !equals(TEMPLATE, aux)
+ # For backwards compatibility only. Use Qt5$${CMAKE_MODULE_NAME}_VERSION instead.
+ set(Qt5$${CMAKE_MODULE_NAME}_VERSION_STRING "$$eval(QT.$${MODULE}.VERSION)")
+@@ -52,11 +28,7 @@ endmacro()
+ macro(_populate_$${CMAKE_MODULE_NAME}_target_properties Configuration LIB_LOCATION IMPLIB_LOCATION)
+     set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} APPEND PROPERTY IMPORTED_CONFIGURATIONS ${Configuration})
+ 
+-!!IF isEmpty(CMAKE_DLL_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_DLL_DIR}${LIB_LOCATION}\")
+-!!ELSE
+     set(imported_location \"$${CMAKE_DLL_DIR}${LIB_LOCATION}\")
+-!!ENDIF
+     _qt5_$${CMAKE_MODULE_NAME}_check_file_exists(${imported_location})
+     set_target_properties(Qt5::$${CMAKE_MODULE_NAME} PROPERTIES
+         \"INTERFACE_LINK_LIBRARIES\" \"${_Qt5$${CMAKE_MODULE_NAME}_LIB_DEPENDENCIES}\"
+@@ -69,11 +41,7 @@ macro(_populate_$${CMAKE_MODULE_NAME}_target_properties Configuration LIB_LOCATI
+     )
+ 
+ !!IF !isEmpty(CMAKE_WINDOWS_BUILD)
+-!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-    set(imported_implib \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\")
+-!!ELSE
+     set(imported_implib \"IMPORTED_IMPLIB_${Configuration}\" \"$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\")
+-!!ENDIF
+     _qt5_$${CMAKE_MODULE_NAME}_check_file_exists(${imported_implib})
+     if(NOT \"${IMPLIB_LOCATION}\" STREQUAL \"\")
+         set_target_properties(Qt5::$${CMAKE_MODULE_NAME} PROPERTIES
+@@ -89,24 +57,13 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
+ !!IF !no_module_headers
+ !!IF !isEmpty(CMAKE_BUILD_IS_FRAMEWORK)
+     set(_Qt5$${CMAKE_MODULE_NAME}_OWN_INCLUDE_DIRS
+-      \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}Qt$${CMAKE_MODULE_NAME}.framework\"
+-      \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}Qt$${CMAKE_MODULE_NAME}.framework/Headers\"
++      \"$${CMAKE_LIB_DIR}Qt$${CMAKE_MODULE_NAME}.framework\"
++      \"$${CMAKE_LIB_DIR}Qt$${CMAKE_MODULE_NAME}.framework/Headers\"
+     )
+ !!IF isEmpty(CMAKE_NO_PRIVATE_INCLUDES)
+     set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS
+-        \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}Qt$${CMAKE_MODULE_NAME}.framework/Versions/$$section(VERSION, ., 0, 0)/Headers/$$VERSION/\"
+-        \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}Qt$${CMAKE_MODULE_NAME}.framework/Versions/$$section(VERSION, ., 0, 0)/Headers/$$VERSION/$${MODULE_INCNAME}\"
+-    )
+-!!ELSE
+-    set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS \"\")
+-!!ENDIF
+-!!ELSE
+-!!IF isEmpty(CMAKE_INCLUDE_DIR_IS_ABSOLUTE)
+-    set(_Qt5$${CMAKE_MODULE_NAME}_OWN_INCLUDE_DIRS \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$$CMAKE_INCLUDE_DIR\" \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_INCLUDE_DIR}$${MODULE_INCNAME}\")
+-!!IF isEmpty(CMAKE_NO_PRIVATE_INCLUDES)
+-    set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS
+-        \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_INCLUDE_DIR}$${MODULE_INCNAME}/$$VERSION\"
+-        \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_INCLUDE_DIR}$${MODULE_INCNAME}/$$VERSION/$${MODULE_INCNAME}\"
++        \"$${CMAKE_LIB_DIR}Qt$${CMAKE_MODULE_NAME}.framework/Versions/$$section(VERSION, ., 0, 0)/Headers/$$VERSION/\"
++        \"$${CMAKE_LIB_DIR}Qt$${CMAKE_MODULE_NAME}.framework/Versions/$$section(VERSION, ., 0, 0)/Headers/$$VERSION/$${MODULE_INCNAME}\"
+     )
+ !!ELSE
+     set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS \"\")
+@@ -122,7 +79,6 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
+     set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS \"\")
+ !!ENDIF
+ !!ENDIF
+-!!ENDIF
+ !!IF !isEmpty(CMAKE_ADD_SOURCE_INCLUDE_DIRS)
+     include(\"${CMAKE_CURRENT_LIST_DIR}/ExtraSourceIncludes.cmake\" OPTIONAL)
+ !!ENDIF
+@@ -272,25 +228,13 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
+ !!IF !isEmpty(CMAKE_FIND_OTHER_LIBRARY_BUILD)
+ !!IF isEmpty(CMAKE_DEBUG_TYPE)
+ !!IF !isEmpty(CMAKE_STATIC_WINDOWS_BUILD)
+-!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-    if (EXISTS \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" )
+-!!ELSE // CMAKE_LIB_DIR_IS_ABSOLUTE
+     if (EXISTS \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" )
+-!!ENDIF // CMAKE_LIB_DIR_IS_ABSOLUTE
+         _populate_$${CMAKE_MODULE_NAME}_target_properties(DEBUG \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" \"\" )
+ !!ELSE // CMAKE_STATIC_WINDOWS_BUILD
+     if (EXISTS
+-!!IF isEmpty(CMAKE_DLL_DIR_IS_ABSOLUTE)
+-        \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_DLL_DIR}$${CMAKE_LIB_FILE_LOCATION_DEBUG}\"
+-!!ELSE
+         \"$${CMAKE_LIB_FILE_LOCATION_DEBUG}\"
+-!!ENDIF
+       AND EXISTS
+-!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-        \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" )
+-!!ELSE
+         \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" )
+-!!ENDIF
+         _populate_$${CMAKE_MODULE_NAME}_target_properties(DEBUG \"$${CMAKE_LIB_FILE_LOCATION_DEBUG}\" \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" )
+ !!ENDIF // CMAKE_STATIC_WINDOWS_BUILD
+     endif()
+@@ -309,25 +253,13 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
+ !!IF !isEmpty(CMAKE_FIND_OTHER_LIBRARY_BUILD)
+ !!IF isEmpty(CMAKE_RELEASE_TYPE)
+ !!IF !isEmpty(CMAKE_STATIC_WINDOWS_BUILD)
+-!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-    if (EXISTS \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" )
+-!!ELSE // CMAKE_LIB_DIR_IS_ABSOLUTE
+     if (EXISTS \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" )
+-!!ENDIF // CMAKE_LIB_DIR_IS_ABSOLUTE
+         _populate_$${CMAKE_MODULE_NAME}_target_properties(RELEASE \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" \"\" )
+ !!ELSE // CMAKE_STATIC_WINDOWS_BUILD
+     if (EXISTS
+-!!IF isEmpty(CMAKE_DLL_DIR_IS_ABSOLUTE)
+-        \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_DLL_DIR}$${CMAKE_LIB_FILE_LOCATION_RELEASE}\"
+-!!ELSE
+         \"$${CMAKE_LIB_FILE_LOCATION_RELEASE}\"
+-!!ENDIF
+       AND EXISTS
+-!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-        \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" )
+-!!ELSE
+         \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" )
+-!!ENDIF
+         _populate_$${CMAKE_MODULE_NAME}_target_properties(RELEASE \"$${CMAKE_LIB_FILE_LOCATION_RELEASE}\" \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" )
+ !!ENDIF // CMAKE_STATIC_WINDOWS_BUILD
+     endif()
+@@ -346,11 +278,7 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
+     macro(_populate_$${CMAKE_MODULE_NAME}_plugin_properties Plugin Configuration PLUGIN_LOCATION)
+         set_property(TARGET Qt5::${Plugin} APPEND PROPERTY IMPORTED_CONFIGURATIONS ${Configuration})
+ 
+-!!IF isEmpty(CMAKE_PLUGIN_DIR_IS_ABSOLUTE)
+-        set(imported_location \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_PLUGIN_DIR}${PLUGIN_LOCATION}\")
+-!!ELSE
+         set(imported_location \"$${CMAKE_PLUGIN_DIR}${PLUGIN_LOCATION}\")
+-!!ENDIF
+         _qt5_$${CMAKE_MODULE_NAME}_check_file_exists(${imported_location})
+         set_target_properties(Qt5::${Plugin} PROPERTIES
+             \"IMPORTED_LOCATION_${Configuration}\" ${imported_location}
+diff --git a/mkspecs/features/mac/default_post.prf b/mkspecs/features/mac/default_post.prf
+index 99f68b78f5..dde69cb7c2 100644
+--- a/mkspecs/features/mac/default_post.prf
++++ b/mkspecs/features/mac/default_post.prf
+@@ -63,199 +63,3 @@ qt {
+         }
+     }
+ }
+-
+-# Add the same default rpaths as Xcode does for new projects.
+-# This is especially important for iOS/tvOS/watchOS where no other option is possible.
+-!no_default_rpath {
+-    QMAKE_RPATHDIR += @executable_path/Frameworks
+-    equals(TEMPLATE, lib):!plugin:lib_bundle: QMAKE_RPATHDIR += @loader_path/Frameworks
+-}
+-
+-# Don't pass -headerpad_max_install_names when using Bitcode.
+-# In that case the linker emits a warning stating that the flag is ignored when
+-# used with bitcode, for reasons that cannot be determined (rdar://problem/20748962).
+-# Using this flag is also unnecessary in practice on UIKit platforms since they
+-# are sandboxed, and only UIKit platforms support bitcode to begin with.
+-!bitcode: QMAKE_LFLAGS += $$QMAKE_LFLAGS_HEADERPAD
+-
+-app_extension_api_only {
+-    QMAKE_CFLAGS              += $$QMAKE_CFLAGS_APPLICATION_EXTENSION
+-    QMAKE_CXXFLAGS            += $$QMAKE_CFLAGS_APPLICATION_EXTENSION
+-    QMAKE_CXXFLAGS_PRECOMPILE += $$QMAKE_CFLAGS_APPLICATION_EXTENSION
+-    QMAKE_LFLAGS              += $$QMAKE_CFLAGS_APPLICATION_EXTENSION
+-}
+-
+-macx-xcode {
+-    qmake_pkginfo_typeinfo.name = QMAKE_PKGINFO_TYPEINFO
+-    !isEmpty(QMAKE_PKGINFO_TYPEINFO): \
+-        qmake_pkginfo_typeinfo.value = $$QMAKE_PKGINFO_TYPEINFO
+-    else: \
+-        qmake_pkginfo_typeinfo.value = "????"
+-    QMAKE_MAC_XCODE_SETTINGS += qmake_pkginfo_typeinfo
+-
+-    !isEmpty(VERSION) {
+-        l = $$split(VERSION, '.') 0 0  # make sure there are at least three
+-        VER_MAJ = $$member(l, 0, 0)
+-        VER_MIN = $$member(l, 1, 1)
+-        VER_PAT = $$member(l, 2, 2)
+-        unset(l)
+-
+-        qmake_full_version.name = QMAKE_FULL_VERSION
+-        qmake_full_version.value = $${VER_MAJ}.$${VER_MIN}.$${VER_PAT}
+-        QMAKE_MAC_XCODE_SETTINGS += qmake_full_version
+-
+-        qmake_short_version.name = QMAKE_SHORT_VERSION
+-        qmake_short_version.value = $${VER_MAJ}.$${VER_MIN}
+-        QMAKE_MAC_XCODE_SETTINGS += qmake_short_version
+-    }
+-
+-    !isEmpty(QMAKE_XCODE_DEBUG_INFORMATION_FORMAT) {
+-        debug_information_format.name = DEBUG_INFORMATION_FORMAT
+-        debug_information_format.value = $$QMAKE_XCODE_DEBUG_INFORMATION_FORMAT
+-        debug_information_format.build = debug
+-        QMAKE_MAC_XCODE_SETTINGS += debug_information_format
+-    }
+-
+-    QMAKE_XCODE_ARCHS =
+-
+-    arch_device.name = "ARCHS[sdk=$${device.sdk}*]"
+-    arch_device.value = $$QMAKE_APPLE_DEVICE_ARCHS
+-    QMAKE_XCODE_ARCHS += $$QMAKE_APPLE_DEVICE_ARCHS
+-    QMAKE_MAC_XCODE_SETTINGS += arch_device
+-
+-    simulator {
+-        arch_simulator.name = "ARCHS[sdk=$${simulator.sdk}*]"
+-        arch_simulator.value = $$QMAKE_APPLE_SIMULATOR_ARCHS
+-        QMAKE_XCODE_ARCHS += $$QMAKE_APPLE_SIMULATOR_ARCHS
+-        QMAKE_MAC_XCODE_SETTINGS += arch_simulator
+-    }
+-
+-    only_active_arch.name = ONLY_ACTIVE_ARCH
+-    only_active_arch.value = YES
+-    only_active_arch.build = debug
+-    QMAKE_MAC_XCODE_SETTINGS += only_active_arch
+-} else {
+-    device|!simulator: VALID_DEVICE_ARCHS = $$QMAKE_APPLE_DEVICE_ARCHS
+-    simulator: VALID_SIMULATOR_ARCHS = $$QMAKE_APPLE_SIMULATOR_ARCHS
+-    VALID_ARCHS = $$VALID_DEVICE_ARCHS $$VALID_SIMULATOR_ARCHS
+-
+-    isEmpty(VALID_ARCHS): \
+-        error("QMAKE_APPLE_DEVICE_ARCHS or QMAKE_APPLE_SIMULATOR_ARCHS must contain at least one architecture")
+-
+-    single_arch: VALID_ARCHS = $$first(VALID_ARCHS)
+-
+-    ACTIVE_ARCHS = $(filter $(EXPORT_VALID_ARCHS), $(ARCHS))
+-    ARCH_ARGS = $(foreach arch, $(if $(EXPORT_ACTIVE_ARCHS), $(EXPORT_ACTIVE_ARCHS), $(EXPORT_VALID_ARCHS)), -arch $(arch))
+-
+-    QMAKE_EXTRA_VARIABLES += VALID_ARCHS ACTIVE_ARCHS ARCH_ARGS
+-
+-    arch_flags = $(EXPORT_ARCH_ARGS)
+-
+-    QMAKE_CFLAGS += $$arch_flags
+-    QMAKE_CXXFLAGS += $$arch_flags
+-    QMAKE_LFLAGS += $$arch_flags
+-
+-    QMAKE_PCH_ARCHS = $$VALID_ARCHS
+-
+-    macos: deployment_target = $$QMAKE_MACOSX_DEPLOYMENT_TARGET
+-    ios: deployment_target = $$QMAKE_IOS_DEPLOYMENT_TARGET
+-    tvos: deployment_target = $$QMAKE_TVOS_DEPLOYMENT_TARGET
+-    watchos: deployment_target = $$QMAKE_WATCHOS_DEPLOYMENT_TARGET
+-
+-    # If we're doing a simulator and device build, device and simulator
+-    # architectures use different paths and flags for the sysroot and
+-    # deployment target switch, so we must multiplex them across multiple
+-    # architectures using -Xarch. Otherwise we fall back to the simple path.
+-    # This is not strictly necessary, but results in cleaner command lines
+-    # and makes it easier for people to override EXPORT_VALID_ARCHS to limit
+-    # individual rules to a different set of architecture(s) from the overall
+-    # build (such as machtest in QtCore).
+-    simulator:device {
+-        QMAKE_XARCH_CFLAGS =
+-        QMAKE_XARCH_LFLAGS =
+-        QMAKE_EXTRA_VARIABLES += QMAKE_XARCH_CFLAGS QMAKE_XARCH_LFLAGS
+-
+-        for (arch, VALID_ARCHS) {
+-            contains(VALID_SIMULATOR_ARCHS, $$arch) {
+-                sdk = $$simulator.sdk
+-                version_identifier = $$simulator.deployment_identifier
+-            } else {
+-                sdk = $$device.sdk
+-                version_identifier = $$device.deployment_identifier
+-            }
+-
+-            version_min_flags = \
+-                -Xarch_$${arch} \
+-                -m$${version_identifier}-version-min=$$deployment_target
+-            QMAKE_XARCH_CFLAGS_$${arch} = $$version_min_flags \
+-                -Xarch_$${arch} \
+-                -isysroot$$xcodeSDKInfo(Path, $$sdk)
+-            QMAKE_XARCH_LFLAGS_$${arch} = $$version_min_flags \
+-                -Xarch_$${arch} \
+-                -Wl,-syslibroot,$$xcodeSDKInfo(Path, $$sdk)
+-
+-            QMAKE_XARCH_CFLAGS += $(EXPORT_QMAKE_XARCH_CFLAGS_$${arch})
+-            QMAKE_XARCH_LFLAGS += $(EXPORT_QMAKE_XARCH_LFLAGS_$${arch})
+-
+-            QMAKE_EXTRA_VARIABLES += \
+-                QMAKE_XARCH_CFLAGS_$${arch} \
+-                QMAKE_XARCH_LFLAGS_$${arch}
+-        }
+-
+-        QMAKE_CFLAGS += $(EXPORT_QMAKE_XARCH_CFLAGS)
+-        QMAKE_CXXFLAGS += $(EXPORT_QMAKE_XARCH_CFLAGS)
+-        QMAKE_LFLAGS += $(EXPORT_QMAKE_XARCH_LFLAGS)
+-    } else {
+-        simulator: \
+-            version_identifier = $$simulator.deployment_identifier
+-        else: \
+-            version_identifier = $$device.deployment_identifier
+-        version_min_flag = -m$${version_identifier}-version-min=$$deployment_target
+-        QMAKE_CFLAGS += -isysroot $$QMAKE_MAC_SDK_PATH $$version_min_flag
+-        QMAKE_CXXFLAGS += -isysroot $$QMAKE_MAC_SDK_PATH $$version_min_flag
+-        QMAKE_LFLAGS += -Wl,-syslibroot,$$QMAKE_MAC_SDK_PATH $$version_min_flag
+-    }
+-
+-    # Enable precompiled headers for multiple architectures
+-    QMAKE_CFLAGS_USE_PRECOMPILE =
+-    for (arch, VALID_ARCHS) {
+-        icc_pch_style: \
+-            use_flag = "-pch-use "
+-        else: \
+-            use_flag = -include
+-
+-        # Only use Xarch with multi-arch, as the option confuses ccache
+-        count(VALID_ARCHS, 1, greaterThan): \
+-            QMAKE_CFLAGS_USE_PRECOMPILE += \
+-                -Xarch_$${arch}
+-
+-        QMAKE_CFLAGS_USE_PRECOMPILE += \
+-            $${use_flag}${QMAKE_PCH_OUTPUT_$${arch}}
+-    }
+-    icc_pch_style {
+-        QMAKE_CXXFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE -include ${QMAKE_PCH_INPUT}
+-        QMAKE_CFLAGS_USE_PRECOMPILE =
+-    } else {
+-        QMAKE_CXXFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE
+-        QMAKE_OBJCFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE
+-        QMAKE_OBJCXXFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE
+-    }
+-
+-    QMAKE_PCH_OUTPUT_EXT = _${QMAKE_PCH_ARCH}$${QMAKE_PCH_OUTPUT_EXT}
+-}
+-
+-cache(QMAKE_XCODE_DEVELOPER_PATH, stash)
+-!isEmpty(QMAKE_XCODE_VERSION): \
+-    cache(QMAKE_XCODE_VERSION, stash)
+-
+-QMAKE_XCODE_LIBRARY_SUFFIX = $$qtPlatformTargetSuffix()
+-
+-xcode_product_bundle_identifier_setting.name = PRODUCT_BUNDLE_IDENTIFIER
+-xcode_product_bundle_identifier_setting.value = $$QMAKE_TARGET_BUNDLE_PREFIX
+-isEmpty(xcode_product_bundle_identifier_setting.value): \
+-    xcode_product_bundle_identifier_setting.value = "com.yourcompany"
+-xcode_product_bundle_target = $$QMAKE_BUNDLE
+-isEmpty(xcode_product_bundle_target): \
+-    xcode_product_bundle_target = ${PRODUCT_NAME:rfc1034identifier}
+-xcode_product_bundle_identifier_setting.value = "$${xcode_product_bundle_identifier_setting.value}.$${xcode_product_bundle_target}"
+-QMAKE_MAC_XCODE_SETTINGS += xcode_product_bundle_identifier_setting
+diff --git a/mkspecs/features/mac/default_pre.prf b/mkspecs/features/mac/default_pre.prf
+index e3534561a5..3b01424e67 100644
+--- a/mkspecs/features/mac/default_pre.prf
++++ b/mkspecs/features/mac/default_pre.prf
+@@ -1,60 +1,2 @@
+ CONFIG = asset_catalogs rez $$CONFIG
+ load(default_pre)
+-
+-isEmpty(QMAKE_XCODE_DEVELOPER_PATH) {
+-    # Get path of Xcode's Developer directory
+-    QMAKE_XCODE_DEVELOPER_PATH = $$system("/usr/bin/xcode-select --print-path 2>/dev/null")
+-    isEmpty(QMAKE_XCODE_DEVELOPER_PATH): \
+-        error("Xcode path is not set. Please use xcode-select to choose Xcode installation path.")
+-
+-    # Make sure Xcode path is valid
+-    !exists($$QMAKE_XCODE_DEVELOPER_PATH): \
+-        error("Xcode is not installed in $${QMAKE_XCODE_DEVELOPER_PATH}. Please use xcode-select to choose Xcode installation path.")
+-}
+-
+-isEmpty(QMAKE_XCODEBUILD_PATH): \
+-    QMAKE_XCODEBUILD_PATH = $$system("/usr/bin/xcrun -find xcodebuild 2>/dev/null")
+-
+-!isEmpty(QMAKE_XCODEBUILD_PATH) {
+-    # Make sure Xcode is set up properly
+-    !system("/usr/bin/xcrun xcodebuild -license check 2>/dev/null"): \
+-        error("Xcode not set up properly. You need to confirm the license agreement by running 'sudo xcrun xcodebuild -license accept'.")
+-
+-    isEmpty(QMAKE_XCODE_VERSION) {
+-        # Extract Xcode version using xcodebuild
+-        xcode_version = $$system("/usr/bin/xcrun xcodebuild -version")
+-        QMAKE_XCODE_VERSION = $$member(xcode_version, 1)
+-        isEmpty(QMAKE_XCODE_VERSION): error("Could not resolve Xcode version.")
+-        unset(xcode_version)
+-    }
+-}
+-
+-isEmpty(QMAKE_TARGET_BUNDLE_PREFIX) {
+-    QMAKE_XCODE_PREFERENCES_FILE = $$(HOME)/Library/Preferences/com.apple.dt.Xcode.plist
+-    exists($$QMAKE_XCODE_PREFERENCES_FILE): \
+-        QMAKE_TARGET_BUNDLE_PREFIX = $$system("/usr/libexec/PlistBuddy -c 'print IDETemplateOptions:bundleIdentifierPrefix' $$QMAKE_XCODE_PREFERENCES_FILE 2>/dev/null")
+-
+-    !isEmpty(_QMAKE_CACHE_):!isEmpty(QMAKE_TARGET_BUNDLE_PREFIX): \
+-        cache(QMAKE_TARGET_BUNDLE_PREFIX)
+-}
+-
+-QMAKE_ASSET_CATALOGS_APP_ICON = AppIcon
+-
+-# Make the default debug info format for static debug builds
+-# DWARF instead of DWARF with dSYM. This cuts down build times
+-# for application debug builds significantly, as Xcode doesn't
+-# have to pull out all the DWARF info from the Qt static libs
+-# and put it into a dSYM file. We don't need that dSYM file in
+-# the first place, since the information is available in the
+-# object files inside the archives (static libraries).
+-macx-xcode:qtConfig(static): \
+-    QMAKE_XCODE_DEBUG_INFORMATION_FORMAT = dwarf
+-
+-# This variable is used by the xcode_dynamic_library_suffix
+-# feature, which allows Xcode to choose the Qt libraries to link to
+-# at build time, depending on the current Xcode SDK and configuration.
+-QMAKE_XCODE_LIBRARY_SUFFIX_SETTING = QT_LIBRARY_SUFFIX
+-
+-xcode_copy_phase_strip_setting.name = COPY_PHASE_STRIP
+-xcode_copy_phase_strip_setting.value = NO
+-QMAKE_MAC_XCODE_SETTINGS += xcode_copy_phase_strip_setting
+diff --git a/mkspecs/features/mac/sdk.prf b/mkspecs/features/mac/sdk.prf
+index 8360dd8b38..8b13789179 100644
+--- a/mkspecs/features/mac/sdk.prf
++++ b/mkspecs/features/mac/sdk.prf
+@@ -1,58 +1 @@
+ 
+-isEmpty(QMAKE_MAC_SDK): \
+-    error("QMAKE_MAC_SDK must be set when using CONFIG += sdk.")
+-
+-contains(QMAKE_MAC_SDK, .*/.*): \
+-    error("QMAKE_MAC_SDK can only contain short-form SDK names (eg. macosx, iphoneos)")
+-
+-defineReplace(xcodeSDKInfo) {
+-    info = $$1
+-    equals(info, "Path"): \
+-        infoarg = --show-sdk-path
+-    equals(info, "PlatformPath"): \
+-        infoarg = --show-sdk-platform-path
+-    equals(info, "SDKVersion"): \
+-        infoarg = --show-sdk-version
+-    sdk = $$2
+-    isEmpty(sdk): \
+-        sdk = $$QMAKE_MAC_SDK
+-
+-    isEmpty(QMAKE_MAC_SDK.$${sdk}.$${info}) {
+-        QMAKE_MAC_SDK.$${sdk}.$${info} = $$system("/usr/bin/xcrun --sdk $$sdk $$infoarg 2>/dev/null")
+-        # --show-sdk-platform-path won't work for Command Line Tools; this is fine
+-        # only used by the XCTest backend to testlib
+-        isEmpty(QMAKE_MAC_SDK.$${sdk}.$${info}):if(!isEmpty(QMAKE_XCODEBUILD_PATH)|!equals(infoarg, "--show-sdk-platform-path")): \
+-            error("Could not resolve SDK $$info for \'$$sdk\' using $$infoarg")
+-        cache(QMAKE_MAC_SDK.$${sdk}.$${info}, set stash, QMAKE_MAC_SDK.$${sdk}.$${info})
+-    }
+-
+-    return($$eval(QMAKE_MAC_SDK.$${sdk}.$${info}))
+-}
+-
+-QMAKE_MAC_SDK_PATH = $$xcodeSDKInfo(Path)
+-QMAKE_MAC_SDK_PLATFORM_PATH = $$xcodeSDKInfo(PlatformPath)
+-QMAKE_MAC_SDK_VERSION = $$xcodeSDKInfo(SDKVersion)
+-
+-sysrootified =
+-for(val, QMAKE_INCDIR_OPENGL): sysrootified += $${QMAKE_MAC_SDK_PATH}$$val
+-QMAKE_INCDIR_OPENGL = $$sysrootified
+-
+-QMAKESPEC_NAME = $$basename(QMAKESPEC)
+-
+-# Resolve SDK version of various tools
+-for(tool, $$list(QMAKE_CC QMAKE_CXX QMAKE_FIX_RPATH QMAKE_AR QMAKE_RANLIB QMAKE_LINK QMAKE_LINK_SHLIB QMAKE_ACTOOL QMAKE_LINK_C QMAKE_LINK_C_SHLIB)) {
+-    tool_variable = QMAKE_MAC_SDK.$${QMAKESPEC_NAME}.$${QMAKE_MAC_SDK}.$${tool}
+-    !isEmpty($$tool_variable) {
+-        $$tool = $$eval($$tool_variable)
+-        next()
+-    }
+-
+-    value = $$eval($$tool)
+-    isEmpty(value): next()
+-
+-    sysrooted = $$system("/usr/bin/xcrun -sdk $$QMAKE_MAC_SDK -find $$first(value) 2>/dev/null")
+-    isEmpty(sysrooted): next()
+-
+-    $$tool = $$sysrooted $$member(value, 1, -1)
+-    cache($$tool_variable, set stash, $$tool)
+-}
+diff --git a/mkspecs/features/qml_module.prf b/mkspecs/features/qml_module.prf
+index 65212b2abf..accd4c07f0 100644
+--- a/mkspecs/features/qml_module.prf
++++ b/mkspecs/features/qml_module.prf
+@@ -52,7 +52,7 @@ qmldir.base = $$_PRO_FILE_PWD_
+ # Tools need qmldir and plugins.qmltypes always installed on the file system
+ qmldir.files = $$qmldir_file $$fq_aux_qml_files
+ install_qml_files: qmldir.files += $$fq_qml_files
+-qmldir.path = $$instbase/$$TARGETPATH
++qmldir.path = $$NIX_OUTPUT_QML/$$TARGETPATH
+ INSTALLS += qmldir
+ 
+ !debug_and_release|!build_all|CONFIG(release, debug|release) {
+diff --git a/mkspecs/features/qml_plugin.prf b/mkspecs/features/qml_plugin.prf
+index cd6377dcc6..e98bf98151 100644
+--- a/mkspecs/features/qml_plugin.prf
++++ b/mkspecs/features/qml_plugin.prf
+@@ -56,7 +56,7 @@ qml1_target {
+     instbase = $$[QT_INSTALL_QML]
+ }
+ 
+-target.path = $$instbase/$$TARGETPATH
++target.path = $$NIX_OUTPUT_QML/$$TARGETPATH
+ INSTALLS += target
+ 
+ # Some final setup
+diff --git a/mkspecs/features/qt_app.prf b/mkspecs/features/qt_app.prf
+index 8354f30eea..62028fef8e 100644
+--- a/mkspecs/features/qt_app.prf
++++ b/mkspecs/features/qt_app.prf
+@@ -30,7 +30,7 @@ host_build:force_bootstrap {
+     target.path = $$[QT_HOST_BINS]
+ } else {
+     !build_pass:qtConfig(debug_and_release): CONFIG += release
+-    target.path = $$[QT_INSTALL_BINS]
++    target.path = $$NIX_OUTPUT_BIN/bin
+     CONFIG += relative_qt_rpath  # Qt's tools and apps should be relocatable
+ }
+ INSTALLS += target
+diff --git a/mkspecs/features/qt_build_paths.prf b/mkspecs/features/qt_build_paths.prf
+index 3bb3823a8e..655b7b7db8 100644
+--- a/mkspecs/features/qt_build_paths.prf
++++ b/mkspecs/features/qt_build_paths.prf
+@@ -24,6 +24,6 @@ exists($$MODULE_BASE_INDIR/.git): \
+ !force_independent {
+     # If the module is not built independently, everything ends up in qtbase.
+     # This is the case in non-prefix builds, except for selected modules.
+-    MODULE_BASE_OUTDIR = $$[QT_HOST_PREFIX]
+-    MODULE_QMAKE_OUTDIR = $$[QT_HOST_PREFIX]
++    MODULE_BASE_OUTDIR = $$NIX_OUTPUT_OUT
++    MODULE_QMAKE_OUTDIR = $$NIX_OUTPUT_OUT
+ }
+diff --git a/mkspecs/features/qt_common.prf b/mkspecs/features/qt_common.prf
+index 4ad9946ae0..6d66f29c26 100644
+--- a/mkspecs/features/qt_common.prf
++++ b/mkspecs/features/qt_common.prf
+@@ -34,8 +34,8 @@ contains(TEMPLATE, .*lib) {
+         qqt_libdir = \$\$\$\$[QT_HOST_LIBS]
+         qt_libdir = $$[QT_HOST_LIBS]
+     } else {
+-        qqt_libdir = \$\$\$\$[QT_INSTALL_LIBS]
+-        qt_libdir = $$[QT_INSTALL_LIBS]
++        qqt_libdir = \$\$\$\$NIX_OUTPUT_OUT/lib
++        qt_libdir = $$NIX_OUTPUT_OUT/lib
+     }
+     contains(QMAKE_DEFAULT_LIBDIRS, $$qt_libdir) {
+         lib_replace.match = "[^ ']*$$rplbase/lib"
+diff --git a/mkspecs/features/qt_docs.prf b/mkspecs/features/qt_docs.prf
+index 3139c443c6..1b4f2fddd8 100644
+--- a/mkspecs/features/qt_docs.prf
++++ b/mkspecs/features/qt_docs.prf
+@@ -45,7 +45,7 @@ QMAKE_DOCS_OUTPUTDIR = $$QMAKE_DOCS_BASE_OUTDIR/$$QMAKE_DOCS_TARGETDIR
+ 
+ QDOC += -outputdir $$shell_quote($$QMAKE_DOCS_OUTPUTDIR)
+ !build_online_docs: \
+-    QDOC += -installdir $$shell_quote($$[QT_INSTALL_DOCS])
++    QDOC += -installdir $$shell_quote($$NIX_OUTPUT_DOC)
+ PREP_DOC_INDEXES =
+ DOC_INDEXES =
+ !isEmpty(QTREPOS) {
+@@ -64,8 +64,8 @@ DOC_INDEXES =
+         DOC_INDEXES += -indexdir $$shell_quote($$qrep/doc)
+ } else {
+     prepare_docs: \
+-        PREP_DOC_INDEXES += -indexdir $$shell_quote($$[QT_INSTALL_DOCS/get])
+-    DOC_INDEXES += -indexdir $$shell_quote($$[QT_INSTALL_DOCS/get])
++        PREP_DOC_INDEXES += -indexdir $$shell_quote($$NIX_OUTPUT_DOC)
++    DOC_INDEXES += -indexdir $$shell_quote($$NIX_OUTPUT_DOC)
+ }
+ 
+ qtattributionsscanner.target = qtattributionsscanner
+@@ -88,12 +88,12 @@ prepare_docs {
+     qch_docs.commands = $$QHELPGENERATOR $$shell_quote($$QMAKE_DOCS_OUTPUTDIR/$${QMAKE_DOCS_TARGET}.qhp) -o $$shell_quote($$QMAKE_DOCS_BASE_OUTDIR/$${QMAKE_DOCS_TARGET}.qch)
+ 
+     inst_html_docs.files = $$QMAKE_DOCS_OUTPUTDIR
+-    inst_html_docs.path = $$[QT_INSTALL_DOCS]
++    inst_html_docs.path = $$NIX_OUTPUT_DOC
+     inst_html_docs.CONFIG += no_check_exist directory no_default_install no_build
+     INSTALLS += inst_html_docs
+ 
+     inst_qch_docs.files = $$QMAKE_DOCS_BASE_OUTDIR/$${QMAKE_DOCS_TARGET}.qch
+-    inst_qch_docs.path = $$[QT_INSTALL_DOCS]
++    inst_qch_docs.path = $$NIX_OUTPUT_DOC
+     inst_qch_docs.CONFIG += no_check_exist no_default_install no_build
+     INSTALLS += inst_qch_docs
+ 
+diff --git a/mkspecs/features/qt_example_installs.prf b/mkspecs/features/qt_example_installs.prf
+index 43b58817fe..e635b8f67a 100644
+--- a/mkspecs/features/qt_example_installs.prf
++++ b/mkspecs/features/qt_example_installs.prf
+@@ -88,7 +88,7 @@ sourcefiles += \
+     $$SOURCES $$HEADERS $$FORMS $$RESOURCES $$TRANSLATIONS \
+     $$DBUS_ADAPTORS $$DBUS_INTERFACES
+ addInstallFiles(sources.files, $$sourcefiles)
+-sources.path = $$[QT_INSTALL_EXAMPLES]/$$probase
++sources.path = $$NIX_OUTPUT_DEV/share/examples/$$probase
+ INSTALLS += sources
+ 
+ check_examples {
+diff --git a/mkspecs/features/qt_functions.prf b/mkspecs/features/qt_functions.prf
+index 1903e509c8..ae7b585989 100644
+--- a/mkspecs/features/qt_functions.prf
++++ b/mkspecs/features/qt_functions.prf
+@@ -69,7 +69,7 @@ defineTest(qtHaveModule) {
+ defineTest(qtPrepareTool) {
+     cmd = $$eval(QT_TOOL.$${2}.binary)
+     isEmpty(cmd) {
+-        cmd = $$[QT_HOST_BINS]/$$2
++        cmd = $$system("command -v $$2")
+         exists($${cmd}.pl) {
+             $${1}_EXE = $${cmd}.pl
+             cmd = perl -w $$system_path($${cmd}.pl)
+diff --git a/mkspecs/features/qt_installs.prf b/mkspecs/features/qt_installs.prf
+index 8f98987b99..21b3bb8b32 100644
+--- a/mkspecs/features/qt_installs.prf
++++ b/mkspecs/features/qt_installs.prf
+@@ -12,16 +12,10 @@
+ #library
+ !qt_no_install_library {
+     win32 {
+-       host_build: \
+-           dlltarget.path = $$[QT_HOST_BINS]
+-       else: \
+-           dlltarget.path = $$[QT_INSTALL_BINS]
++        dlltarget.path = $$NIX_OUTPUT_BIN/bin
+        INSTALLS += dlltarget
+     }
+-    host_build: \
+-        target.path = $$[QT_HOST_LIBS]
+-    else: \
+-        target.path = $$[QT_INSTALL_LIBS]
++    target.path = $$NIX_OUTPUT_OUT/lib
+     !static: target.CONFIG = no_dll
+     INSTALLS += target
+ }
+@@ -29,33 +23,33 @@
+ #headers
+ qt_install_headers {
+     gen_headers.files = $$SYNCQT.GENERATED_HEADER_FILES
+-    gen_headers.path = $$[QT_INSTALL_HEADERS]/$$MODULE_INCNAME
++    gen_headers.path = $$NIX_OUTPUT_DEV/include/$$MODULE_INCNAME
+     INSTALLS += gen_headers
+ 
+     targ_headers.files = $$SYNCQT.HEADER_FILES $$SYNCQT.INJECTED_HEADER_FILES
+-    targ_headers.path = $$[QT_INSTALL_HEADERS]/$$MODULE_INCNAME
++    targ_headers.path = $$NIX_OUTPUT_DEV/include/$$MODULE_INCNAME
+     INSTALLS += targ_headers
+ 
+     private_headers.files = $$SYNCQT.PRIVATE_HEADER_FILES $$SYNCQT.INJECTED_PRIVATE_HEADER_FILES
+-    private_headers.path = $$[QT_INSTALL_HEADERS]/$$MODULE_INCNAME/$$VERSION/$$MODULE_INCNAME/private
++    private_headers.path = $$NIX_OUTPUT_DEV/include/$$MODULE_INCNAME/$$VERSION/$$MODULE_INCNAME/private
+     INSTALLS += private_headers
+ 
+     qpa_headers.files = $$SYNCQT.QPA_HEADER_FILES
+-    qpa_headers.path = $$[QT_INSTALL_HEADERS]/$$MODULE_INCNAME/$$VERSION/$$MODULE_INCNAME/qpa
++    qpa_headers.path = $$NIX_OUTPUT_DEV/include/$$MODULE_INCNAME/$$VERSION/$$MODULE_INCNAME/qpa
+     INSTALLS += qpa_headers
+ }
+ 
+ #module
+ qt_install_module {
+     !isEmpty(MODULE_PRI) {
+-        pritarget.path = $$[QT_HOST_DATA]/mkspecs/modules
++        pritarget.path = $$NIX_OUTPUT_DEV/mkspecs/modules
+         pritarget.files = $$MODULE_PRI
+         INSTALLS += pritarget
+     } else: isEmpty(MODULE_PRIVATE_PRI) {
+         warning("Project $$basename(_PRO_FILE_) is a module, but has not defined MODULE_PRI, which is required for Qt to expose the module to other projects.")
+     }
+     !isEmpty(MODULE_PRIVATE_PRI) {
+-        privpritarget.path = $$[QT_HOST_DATA]/mkspecs/modules
++        privpritarget.path = $$NIX_OUTPUT_DEV/mkspecs/modules
+         privpritarget.files = $$MODULE_PRIVATE_PRI
+         INSTALLS += privpritarget
+     }
+diff --git a/mkspecs/features/qt_plugin.prf b/mkspecs/features/qt_plugin.prf
+index 40528a65e2..903f795284 100644
+--- a/mkspecs/features/qt_plugin.prf
++++ b/mkspecs/features/qt_plugin.prf
+@@ -88,7 +88,7 @@ CONFIG(static, static|shared)|prefix_build {
+     }
+ }
+ 
+-target.path = $$[QT_INSTALL_PLUGINS]/$$PLUGIN_TYPE
++target.path = $$NIX_OUTPUT_PLUGIN/$$PLUGIN_TYPE
+ INSTALLS += target
+ 
+ TARGET = $$qt5LibraryTarget($$TARGET)
+diff --git a/src/corelib/Qt5CoreConfigExtras.cmake.in b/src/corelib/Qt5CoreConfigExtras.cmake.in
+index e0652fdcf9..450b2a2d28 100644
+--- a/src/corelib/Qt5CoreConfigExtras.cmake.in
++++ b/src/corelib/Qt5CoreConfigExtras.cmake.in
+@@ -3,7 +3,7 @@ if (NOT TARGET Qt5::qmake)
+     add_executable(Qt5::qmake IMPORTED)
+ 
+ !!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5Core_install_prefix}/$${CMAKE_BIN_DIR}qmake$$CMAKE_BIN_SUFFIX\")
++    set(imported_location \"$$NIX_OUTPUT_DEV/$${CMAKE_BIN_DIR}qmake$$CMAKE_BIN_SUFFIX\")
+ !!ELSE
+     set(imported_location \"$${CMAKE_BIN_DIR}qmake$$CMAKE_BIN_SUFFIX\")
+ !!ENDIF
+@@ -18,7 +18,7 @@ if (NOT TARGET Qt5::moc)
+     add_executable(Qt5::moc IMPORTED)
+ 
+ !!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5Core_install_prefix}/$${CMAKE_BIN_DIR}moc$$CMAKE_BIN_SUFFIX\")
++    set(imported_location \"$$NIX_OUTPUT_DEV/$${CMAKE_BIN_DIR}moc$$CMAKE_BIN_SUFFIX\")
+ !!ELSE
+     set(imported_location \"$${CMAKE_BIN_DIR}moc$$CMAKE_BIN_SUFFIX\")
+ !!ENDIF
+@@ -35,7 +35,7 @@ if (NOT TARGET Qt5::rcc)
+     add_executable(Qt5::rcc IMPORTED)
+ 
+ !!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5Core_install_prefix}/$${CMAKE_BIN_DIR}rcc$$CMAKE_BIN_SUFFIX\")
++    set(imported_location \"$$NIX_OUTPUT_DEV/$${CMAKE_BIN_DIR}rcc$$CMAKE_BIN_SUFFIX\")
+ !!ELSE
+     set(imported_location \"$${CMAKE_BIN_DIR}rcc$$CMAKE_BIN_SUFFIX\")
+ !!ENDIF
+@@ -116,7 +116,7 @@ if (NOT TARGET Qt5::WinMain)
+ !!IF !isEmpty(CMAKE_RELEASE_TYPE)
+     set_property(TARGET Qt5::WinMain APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
+ !!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5Core_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_RELEASE}\")
++    set(imported_location \"$$NIX_OUTPUT_DEV/$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_RELEASE}\")
+ !!ELSE
+     set(imported_location \"$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_RELEASE}\")
+ !!ENDIF
+@@ -130,7 +130,7 @@ if (NOT TARGET Qt5::WinMain)
+     set_property(TARGET Qt5::WinMain APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
+ 
+ !!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5Core_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_DEBUG}\")
++    set(imported_location \"$$NIX_OUTPUT_DEV/$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_DEBUG}\")
+ !!ELSE
+     set(imported_location \"$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_DEBUG}\")
+ !!ENDIF
+diff --git a/src/corelib/Qt5CoreConfigExtrasMkspecDir.cmake.in b/src/corelib/Qt5CoreConfigExtrasMkspecDir.cmake.in
+index c357237d0e..6f0c75de3c 100644
+--- a/src/corelib/Qt5CoreConfigExtrasMkspecDir.cmake.in
++++ b/src/corelib/Qt5CoreConfigExtrasMkspecDir.cmake.in
+@@ -1,6 +1,6 @@
+ 
+ !!IF isEmpty(CMAKE_HOST_DATA_DIR_IS_ABSOLUTE)
+-set(_qt5_corelib_extra_includes \"${_qt5Core_install_prefix}/$${CMAKE_HOST_DATA_DIR}/mkspecs/$${CMAKE_MKSPEC}\")
++set(_qt5_corelib_extra_includes \"$$NIX_OUTPUT_DEV/$${CMAKE_HOST_DATA_DIR}/mkspecs/$${CMAKE_MKSPEC}\")
+ !!ELSE
+ set(_qt5_corelib_extra_includes \"$${CMAKE_HOST_DATA_DIR}mkspecs/$${CMAKE_MKSPEC}\")
+ !!ENDIF
+diff --git a/src/corelib/Qt5CoreConfigExtrasMkspecDirForInstall.cmake.in b/src/corelib/Qt5CoreConfigExtrasMkspecDirForInstall.cmake.in
+index 706304cf34..546420f6ad 100644
+--- a/src/corelib/Qt5CoreConfigExtrasMkspecDirForInstall.cmake.in
++++ b/src/corelib/Qt5CoreConfigExtrasMkspecDirForInstall.cmake.in
+@@ -1,6 +1,6 @@
+ 
+ !!IF isEmpty(CMAKE_INSTALL_DATA_DIR_IS_ABSOLUTE)
+-set(_qt5_corelib_extra_includes \"${_qt5Core_install_prefix}/$${CMAKE_INSTALL_DATA_DIR}/mkspecs/$${CMAKE_MKSPEC}\")
++set(_qt5_corelib_extra_includes \"$$NIX_OUTPUT_DEV/$${CMAKE_INSTALL_DATA_DIR}/mkspecs/$${CMAKE_MKSPEC}\")
+ !!ELSE
+ set(_qt5_corelib_extra_includes \"$${CMAKE_INSTALL_DATA_DIR}mkspecs/$${CMAKE_MKSPEC}\")
+ !!ENDIF
+diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
+index 463e30e1c3..0e1ab669e4 100644
+--- a/src/corelib/kernel/qcoreapplication.cpp
++++ b/src/corelib/kernel/qcoreapplication.cpp
+@@ -2665,6 +2665,15 @@ QStringList QCoreApplication::libraryPaths()
+         QStringList *app_libpaths = new QStringList;
+         coreappdata()->app_libpaths.reset(app_libpaths);
+ 
++        // Add library paths derived from PATH
++        const QStringList paths = QFile::decodeName(qgetenv("PATH")).split(':');
++        const QString plugindir = QStringLiteral("../" NIXPKGS_QT_PLUGIN_PREFIX);
++        for (const QString &path: paths) {
++            if (!path.isEmpty()) {
++                app_libpaths->append(QDir::cleanPath(path + QDir::separator() + plugindir));
++            }
++        }
++
+         const QByteArray libPathEnv = qgetenv("QT_PLUGIN_PATH");
+         if (!libPathEnv.isEmpty()) {
+             QStringList paths = QFile::decodeName(libPathEnv).split(QDir::listSeparator(), QString::SkipEmptyParts);
+diff --git a/src/corelib/tools/qtimezoneprivate_tz.cpp b/src/corelib/tools/qtimezoneprivate_tz.cpp
+index bed62a02bd..73158993f7 100644
+--- a/src/corelib/tools/qtimezoneprivate_tz.cpp
++++ b/src/corelib/tools/qtimezoneprivate_tz.cpp
+@@ -70,7 +70,11 @@ typedef QHash<QByteArray, QTzTimeZone> QTzTimeZoneHash;
+ // Parse zone.tab table, assume lists all installed zones, if not will need to read directories
+ static QTzTimeZoneHash loadTzTimeZones()
+ {
+-    QString path = QStringLiteral("/usr/share/zoneinfo/zone.tab");
++    // Try TZDIR first, in case we're running on NixOS.
++    QString path = QFile::decodeName(qgetenv("TZDIR")) + QStringLiteral("/zone.tab");
++    // Fallback to traditional paths in case we are not on NixOS.
++    if (!QFile::exists(path))
++        path = QStringLiteral("/usr/share/zoneinfo/zone.tab");
+     if (!QFile::exists(path))
+         path = QStringLiteral("/usr/lib/zoneinfo/zone.tab");
+ 
+@@ -644,12 +648,16 @@ void QTzTimeZonePrivate::init(const QByteArray &ianaId)
+         if (!tzif.open(QIODevice::ReadOnly))
+             return;
+     } else {
+-        // Open named tz, try modern path first, if fails try legacy path
+-        tzif.setFileName(QLatin1String("/usr/share/zoneinfo/") + QString::fromLocal8Bit(ianaId));
++        // Try TZDIR first, in case we're running on NixOS
++        tzif.setFileName(QFile::decodeName(qgetenv("TZDIR")) + QStringLiteral("/") + QString::fromLocal8Bit(ianaId));
+         if (!tzif.open(QIODevice::ReadOnly)) {
+-            tzif.setFileName(QLatin1String("/usr/lib/zoneinfo/") + QString::fromLocal8Bit(ianaId));
+-            if (!tzif.open(QIODevice::ReadOnly))
+-                return;
++            // Open named tz, try modern path first, if fails try legacy path
++            tzif.setFileName(QLatin1String("/usr/share/zoneinfo/") + QString::fromLocal8Bit(ianaId));
++            if (!tzif.open(QIODevice::ReadOnly)) {
++                tzif.setFileName(QLatin1String("/usr/lib/zoneinfo/") + QString::fromLocal8Bit(ianaId));
++                if (!tzif.open(QIODevice::ReadOnly))
++                    return;
++            }
+         }
+     }
+ 
+diff --git a/src/dbus/Qt5DBusConfigExtras.cmake.in b/src/dbus/Qt5DBusConfigExtras.cmake.in
+index 1d947159e2..b36865fc48 100644
+--- a/src/dbus/Qt5DBusConfigExtras.cmake.in
++++ b/src/dbus/Qt5DBusConfigExtras.cmake.in
+@@ -2,11 +2,7 @@
+ if (NOT TARGET Qt5::qdbuscpp2xml)
+     add_executable(Qt5::qdbuscpp2xml IMPORTED)
+ 
+-!!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5DBus_install_prefix}/$${CMAKE_BIN_DIR}qdbuscpp2xml$$CMAKE_BIN_SUFFIX\")
+-!!ELSE
+-    set(imported_location \"$${CMAKE_BIN_DIR}qdbuscpp2xml$$CMAKE_BIN_SUFFIX\")
+-!!ENDIF
++    set(imported_location \"$$NIX_OUTPUT_DEV/bin/qdbuscpp2xml$$CMAKE_BIN_SUFFIX\")
+     _qt5_DBus_check_file_exists(${imported_location})
+ 
+     set_target_properties(Qt5::qdbuscpp2xml PROPERTIES
+@@ -17,11 +13,7 @@ endif()
+ if (NOT TARGET Qt5::qdbusxml2cpp)
+     add_executable(Qt5::qdbusxml2cpp IMPORTED)
+ 
+-!!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5DBus_install_prefix}/$${CMAKE_BIN_DIR}qdbusxml2cpp$$CMAKE_BIN_SUFFIX\")
+-!!ELSE
+-    set(imported_location \"$${CMAKE_BIN_DIR}qdbusxml2cpp$$CMAKE_BIN_SUFFIX\")
+-!!ENDIF
++    set(imported_location \"$$NIX_OUTPUT_DEV/bin/qdbusxml2cpp$$CMAKE_BIN_SUFFIX\")
+     _qt5_DBus_check_file_exists(${imported_location})
+ 
+     set_target_properties(Qt5::qdbusxml2cpp PROPERTIES
+diff --git a/src/gui/Qt5GuiConfigExtras.cmake.in b/src/gui/Qt5GuiConfigExtras.cmake.in
+index 07869efd7d..fb4183bada 100644
+--- a/src/gui/Qt5GuiConfigExtras.cmake.in
++++ b/src/gui/Qt5GuiConfigExtras.cmake.in
+@@ -2,7 +2,7 @@
+ !!IF !isEmpty(CMAKE_ANGLE_EGL_DLL_RELEASE)
+ 
+ !!IF isEmpty(CMAKE_INCLUDE_DIR_IS_ABSOLUTE)
+-set(Qt5Gui_EGL_INCLUDE_DIRS \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$$CMAKE_INCLUDE_DIR/QtANGLE\")
++set(Qt5Gui_EGL_INCLUDE_DIRS \"$$NIX_OUTPUT_DEV/$$CMAKE_INCLUDE_DIR/QtANGLE\")
+ !!ELSE
+ set(Qt5Gui_EGL_INCLUDE_DIRS \"$$CMAKE_INCLUDE_DIR/QtANGLE\")
+ !!ENDIF
+@@ -17,13 +17,13 @@ macro(_populate_qt5gui_gl_target_properties TargetName Configuration LIB_LOCATIO
+     set_property(TARGET Qt5::${TargetName} APPEND PROPERTY IMPORTED_CONFIGURATIONS ${Configuration})
+ 
+ !!IF isEmpty(CMAKE_DLL_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5Gui_install_prefix}/$${CMAKE_DLL_DIR}${LIB_LOCATION}\")
++    set(imported_location \"$$NIX_OUTPUT_OUT/$${CMAKE_DLL_DIR}${LIB_LOCATION}\")
+ !!ELSE
+     set(imported_location \"$${CMAKE_DLL_DIR}${LIB_LOCATION}\")
+ !!ENDIF
+ 
+ !!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-    set(imported_implib \"${_qt5Gui_install_prefix}/$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\")
++    set(imported_implib \"$$NIX_OUTPUT_OUT/$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\")
+ !!ELSE
+     set(imported_implib \"$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\")
+ !!ENDIF
+diff --git a/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp b/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp
+index b5a0a5bbeb..6c20305f4d 100644
+--- a/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp
++++ b/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp
+@@ -265,12 +265,9 @@ void TableGenerator::initPossibleLocations()
+     m_possibleLocations.reserve(7);
+     if (qEnvironmentVariableIsSet("QTCOMPOSE"))
+         m_possibleLocations.append(QString::fromLocal8Bit(qgetenv("QTCOMPOSE")));
+-    m_possibleLocations.append(QStringLiteral("/usr/share/X11/locale"));
+-    m_possibleLocations.append(QStringLiteral("/usr/local/share/X11/locale"));
+-    m_possibleLocations.append(QStringLiteral("/usr/lib/X11/locale"));
+-    m_possibleLocations.append(QStringLiteral("/usr/local/lib/X11/locale"));
+     m_possibleLocations.append(QStringLiteral(X11_PREFIX "/share/X11/locale"));
+     m_possibleLocations.append(QStringLiteral(X11_PREFIX "/lib/X11/locale"));
++    m_possibleLocations.append(QLatin1String(NIXPKGS_QTCOMPOSE));
+ }
+ 
+ QString TableGenerator::findComposeFile()
+diff --git a/src/plugins/platforms/xcb/qxcbcursor.cpp b/src/plugins/platforms/xcb/qxcbcursor.cpp
+index 57629ac03a..8a7f219a98 100644
+--- a/src/plugins/platforms/xcb/qxcbcursor.cpp
++++ b/src/plugins/platforms/xcb/qxcbcursor.cpp
+@@ -316,10 +316,10 @@ QXcbCursor::QXcbCursor(QXcbConnection *conn, QXcbScreen *screen)
+ #if QT_CONFIG(xcb_xlib) && QT_CONFIG(library)
+     static bool function_ptrs_not_initialized = true;
+     if (function_ptrs_not_initialized) {
+-        QLibrary xcursorLib(QLatin1String("Xcursor"), 1);
++        QLibrary xcursorLib(QLatin1String(NIXPKGS_LIBXCURSOR), 1);
+         bool xcursorFound = xcursorLib.load();
+         if (!xcursorFound) { // try without the version number
+-            xcursorLib.setFileName(QLatin1String("Xcursor"));
++            xcursorLib.setFileName(QLatin1String(NIXPKGS_LIBXCURSOR));
+             xcursorFound = xcursorLib.load();
+         }
+         if (xcursorFound) {
+diff --git a/src/plugins/platformthemes/gtk3/main.cpp b/src/plugins/platformthemes/gtk3/main.cpp
+index fb1c425d8e..bb8bab9795 100644
+--- a/src/plugins/platformthemes/gtk3/main.cpp
++++ b/src/plugins/platformthemes/gtk3/main.cpp
+@@ -39,6 +39,7 @@
+ 
+ #include <qpa/qplatformthemeplugin.h>
+ #include "qgtk3theme.h"
++#include <QFile>
+ 
+ QT_BEGIN_NAMESPACE
+ 
+@@ -54,8 +55,22 @@ public:
+ QPlatformTheme *QGtk3ThemePlugin::create(const QString &key, const QStringList &params)
+ {
+     Q_UNUSED(params);
+-    if (!key.compare(QLatin1String(QGtk3Theme::name), Qt::CaseInsensitive))
++    if (!key.compare(QLatin1String(QGtk3Theme::name), Qt::CaseInsensitive)) {
++
++#ifdef NIXPKGS_QGTK3_XDG_DATA_DIRS
++        QStringList XDG_DATA_DIRS = QFile::decodeName(qgetenv("XDG_DATA_DIRS")).split(':');
++        XDG_DATA_DIRS << QLatin1String(NIXPKGS_QGTK3_XDG_DATA_DIRS);
++        qputenv("XDG_DATA_DIRS", QFile::encodeName(XDG_DATA_DIRS.join(':')));
++#endif
++
++#ifdef NIXPKGS_QGTK3_GIO_EXTRA_MODULES
++        QStringList GIO_EXTRA_MODULES = QFile::decodeName(qgetenv("GIO_EXTRA_MODULES")).split(':');
++        GIO_EXTRA_MODULES << QLatin1String(NIXPKGS_QGTK3_GIO_EXTRA_MODULES);
++        qputenv("GIO_EXTRA_MODULES", QFile::encodeName(GIO_EXTRA_MODULES.join(':')));
++#endif
++
+         return new QGtk3Theme;
++    }
+ 
+     return 0;
+ }
+diff --git a/src/testlib/qtestassert.h b/src/testlib/qtestassert.h
+index 6498ea84ef..d821ced7fc 100644
+--- a/src/testlib/qtestassert.h
++++ b/src/testlib/qtestassert.h
+@@ -44,10 +44,13 @@
+ 
+ QT_BEGIN_NAMESPACE
+ 
+-
++#if defined(QT_NO_DEBUG) && !defined(QT_FORCE_ASSERTS)
++#define QTEST_ASSERT(cond) do { } while ((false) && (cond))
++#define QTEST_ASSERT_X(cond, where, what) do { } while ((false) && (cond))
++#else
+ #define QTEST_ASSERT(cond) do { if (!(cond)) qt_assert(#cond,__FILE__,__LINE__); } while (false)
+-
+ #define QTEST_ASSERT_X(cond, where, what) do { if (!(cond)) qt_assert_x(where, what,__FILE__,__LINE__); } while (false)
++#endif
+ 
+ QT_END_NAMESPACE
+ 
+diff --git a/src/widgets/Qt5WidgetsConfigExtras.cmake.in b/src/widgets/Qt5WidgetsConfigExtras.cmake.in
+index 99d87e2e46..a4eab2aa72 100644
+--- a/src/widgets/Qt5WidgetsConfigExtras.cmake.in
++++ b/src/widgets/Qt5WidgetsConfigExtras.cmake.in
+@@ -3,7 +3,7 @@ if (NOT TARGET Qt5::uic)
+     add_executable(Qt5::uic IMPORTED)
+ 
+ !!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5Widgets_install_prefix}/$${CMAKE_BIN_DIR}uic$$CMAKE_BIN_SUFFIX\")
++    set(imported_location \"$$NIX_OUTPUT_DEV/$${CMAKE_BIN_DIR}uic$$CMAKE_BIN_SUFFIX\")
+ !!ELSE
+     set(imported_location \"$${CMAKE_BIN_DIR}uic$$CMAKE_BIN_SUFFIX\")
+ !!ENDIF
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtdeclarative.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtdeclarative.patch
new file mode 100644
index 000000000000..8f5b5d4790fb
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtdeclarative.patch
@@ -0,0 +1,33 @@
+diff --git a/src/qml/qml/qqmlimport.cpp b/src/qml/qml/qqmlimport.cpp
+index 005db4248..685c5b1b2 100644
+--- a/src/qml/qml/qqmlimport.cpp
++++ b/src/qml/qml/qqmlimport.cpp
+@@ -1760,6 +1760,15 @@ QQmlImportDatabase::QQmlImportDatabase(QQmlEngine *e)
+     QString installImportsPath =  QLibraryInfo::location(QLibraryInfo::Qml2ImportsPath);
+     addImportPath(installImportsPath);
+ 
++    // Add import paths derived from PATH
++    const QStringList paths = QFile::decodeName(qgetenv("PATH")).split(':');
++    const QString qmldir = QStringLiteral("../" NIXPKGS_QML2_IMPORT_PREFIX);
++    for (const QString &path: paths) {
++        if (!path.isEmpty()) {
++            addImportPath(QDir::cleanPath(path + QDir::separator() + qmldir));
++        }
++    }
++
+     // env import paths
+     if (Q_UNLIKELY(!qEnvironmentVariableIsEmpty("QML2_IMPORT_PATH"))) {
+         const QString envImportPath = qEnvironmentVariable("QML2_IMPORT_PATH");
+diff --git a/tools/qmlcachegen/qmlcache.prf b/tools/qmlcachegen/qmlcache.prf
+index 537eaf62e..e21de58f6 100644
+--- a/tools/qmlcachegen/qmlcache.prf
++++ b/tools/qmlcachegen/qmlcache.prf
+@@ -26,7 +26,7 @@ defineReplace(qmlCacheOutputFileName) {
+ }
+ 
+ qmlcacheinst.base = $$QMLCACHE_DESTDIR
+-qmlcacheinst.path = $$[QT_INSTALL_QML]/$$TARGETPATH
++qmlcacheinst.path = $$NIX_OUTPUT_QML/$$TARGETPATH
+ qmlcacheinst.CONFIG = no_check_exist
+ 
+ qmlcachegen.input = CACHEGEN_FILES
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtscript.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtscript.patch
new file mode 100644
index 000000000000..5508dec1280e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtscript.patch
@@ -0,0 +1,13 @@
+diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Threading.h b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Threading.h
+index 1f6d25e..087c3fb 100644
+--- a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Threading.h
++++ b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Threading.h
+@@ -81,7 +81,7 @@
+ #include <pthread.h>
+ #elif PLATFORM(GTK)
+ #include <wtf/gtk/GOwnPtr.h>
+-typedef struct _GMutex GMutex;
++typedef union _GMutex GMutex;
+ typedef struct _GCond GCond;
+ #endif
+ 
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtserialport.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtserialport.patch
new file mode 100644
index 000000000000..f25524e80bcf
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtserialport.patch
@@ -0,0 +1,22 @@
+diff --git a/src/serialport/qtudev_p.h b/src/serialport/qtudev_p.h
+index af2dab2..8e17f64 100644
+--- a/src/serialport/qtudev_p.h
++++ b/src/serialport/qtudev_p.h
+@@ -111,9 +111,17 @@ inline QFunctionPointer resolveSymbol(QLibrary *udevLibrary, const char *symbolN
+ inline bool resolveSymbols(QLibrary *udevLibrary)
+ {
+     if (!udevLibrary->isLoaded()) {
++#ifdef NIXPKGS_LIBUDEV
++        udevLibrary->setFileNameAndVersion(QLatin1String(NIXPKGS_LIBUDEV), 1);
++#else
+         udevLibrary->setFileNameAndVersion(QStringLiteral("udev"), 1);
++#endif
+         if (!udevLibrary->load()) {
++#ifdef NIXPKGS_LIBUDEV
++            udevLibrary->setFileNameAndVersion(QLatin1String(NIXPKGS_LIBUDEV), 0);
++#else
+             udevLibrary->setFileNameAndVersion(QStringLiteral("udev"), 0);
++#endif
+             if (!udevLibrary->load()) {
+                 qWarning("Failed to load the library: %s, supported version(s): %i and %i", qPrintable(udevLibrary->fileName()), 1, 0);
+                 return false;
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtwebengine-CVE-2019-5786.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtwebengine-CVE-2019-5786.patch
new file mode 100644
index 000000000000..ec9a432ea708
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtwebengine-CVE-2019-5786.patch
@@ -0,0 +1,26 @@
+--- a/src/3rdparty/chromium/third_party/blink/renderer/core/fileapi/file_reader_loader.cc
++++ b/src/3rdparty/chromium/third_party/blink/renderer/core/fileapi/file_reader_loader.cc
+@@ -135,14 +135,16 @@
+   if (!raw_data_ || error_code_)
+     return nullptr;
+ 
+-  DOMArrayBuffer* result = DOMArrayBuffer::Create(raw_data_->ToArrayBuffer());
+-  if (finished_loading_) {
+-    array_buffer_result_ = result;
+-    AdjustReportedMemoryUsageToV8(
+-        -1 * static_cast<int64_t>(raw_data_->ByteLength()));
+-    raw_data_.reset();
++  if (!finished_loading_) {
++    return DOMArrayBuffer::Create(
++        ArrayBuffer::Create(raw_data_->Data(), raw_data_->ByteLength()));
+   }
+-  return result;
++  array_buffer_result_ = DOMArrayBuffer::Create(raw_data_->ToArrayBuffer());
++  AdjustReportedMemoryUsageToV8(-1 *
++                                static_cast<int64_t>(raw_data_->ByteLength()));
++
++  raw_data_.reset();
++  return array_buffer_result_;
+ }
+ 
+ String FileReaderLoader::StringResult() {
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtwebengine-darwin-no-platform-check.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtwebengine-darwin-no-platform-check.patch
new file mode 100644
index 000000000000..364330169bf1
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtwebengine-darwin-no-platform-check.patch
@@ -0,0 +1,21 @@
+diff --git a/mkspecs/features/platform.prf b/mkspecs/features/platform.prf
+--- a/mkspecs/features/platform.prf
++++ b/mkspecs/features/platform.prf
+@@ -40,8 +40,6 @@ defineTest(isPlatformSupported) {
+   } else:osx {
+     # FIXME: Try to get it back down to 8.2 for building on OS X 10.11
+     !isMinXcodeVersion(8, 3, 3) {
+-      skipBuild("Using Xcode version $$QMAKE_XCODE_VERSION, but at least version 8.3.3 is required to build Qt WebEngine.")
+-      return(false)
+     }
+     !clang|intel_icc {
+         skipBuild("Qt WebEngine on macOS requires Clang.")
+@@ -54,8 +52,6 @@ defineTest(isPlatformSupported) {
+       return(false)
+     }
+     !isMinOSXSDKVersion(10, 12): {
+-      skipBuild("Building Qt WebEngine requires a macOS SDK version of 10.12 or newer. Current version is $${WEBENGINE_OSX_SDK_PRODUCT_VERSION}.")
+-      return(false)
+     }
+   } else {
+     skipBuild("Unknown platform. Qt WebEngine only supports Linux, Windows, and macOS.")
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtwebengine-no-build-skip.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtwebengine-no-build-skip.patch
new file mode 100644
index 000000000000..f332d5e1bb2b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtwebengine-no-build-skip.patch
@@ -0,0 +1,12 @@
+diff --git a/qtwebengine.pro b/qtwebengine.pro
+--- a/qtwebengine.pro
++++ b/qtwebengine.pro
+@@ -5,7 +5,7 @@ runConfigure()
+ 
+ !isEmpty(skipBuildReason) {
+     SUBDIRS =
+-    log($${skipBuildReason}$${EOL})
++    error($${skipBuildReason}$${EOL})
+     log(QtWebEngine will not be built.$${EOL})
+ }
+ 
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtwebkit-darwin-no-qos-classes.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtwebkit-darwin-no-qos-classes.patch
new file mode 100644
index 000000000000..a7087f517623
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtwebkit-darwin-no-qos-classes.patch
@@ -0,0 +1,11 @@
+diff --git a/Source/cmake/OptionsQt.cmake b/Source/cmake/OptionsQt.cmake
+--- a/Source/cmake/OptionsQt.cmake
++++ b/Source/cmake/OptionsQt.cmake
+@@ -683,7 +683,6 @@ if (WIN32 AND COMPILER_IS_GCC_OR_CLANG)
+ endif ()
+ 
+ if (APPLE)
+-    SET_AND_EXPOSE_TO_BUILD(HAVE_QOS_CLASSES 1)
+ endif ()
+ 
+ if (ENABLE_MATHML)
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtwebkit-darwin-no-readline.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtwebkit-darwin-no-readline.patch
new file mode 100644
index 000000000000..26d189d86019
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtwebkit-darwin-no-readline.patch
@@ -0,0 +1,45 @@
+diff --git a/Source/JavaScriptCore/shell/CMakeLists.txt b/Source/JavaScriptCore/shell/CMakeLists.txt
+--- a/Source/JavaScriptCore/shell/CMakeLists.txt
++++ b/Source/JavaScriptCore/shell/CMakeLists.txt
+@@ -9,7 +9,6 @@ set(JSC_LIBRARIES
+ )
+ 
+ if (WTF_OS_MAC_OS_X)
+-    list(APPEND JSC_LIBRARIES edit)
+ endif ()
+ 
+ if ("${JavaScriptCore_LIBRARY_TYPE}" MATCHES "STATIC")
+diff --git a/Source/WTF/wtf/Platform.h b/Source/WTF/wtf/Platform.h
+--- a/Source/WTF/wtf/Platform.h
++++ b/Source/WTF/wtf/Platform.h
+@@ -563,7 +563,6 @@
+ #if PLATFORM(IOS)
+ 
+ #define HAVE_NETWORK_EXTENSION 1
+-#define HAVE_READLINE 1
+ #if USE(APPLE_INTERNAL_SDK)
+ #define USE_CFNETWORK 1
+ #endif
+@@ -650,7 +649,6 @@
+ #define HAVE_MADV_DONTNEED 1
+ #define HAVE_MERGESORT 1
+ #define HAVE_PTHREAD_SETNAME_NP 1
+-#define HAVE_READLINE 1
+ #define HAVE_SYS_TIMEB_H 1
+ 
+ #if !PLATFORM(GTK) && !PLATFORM(QT)
+diff --git a/Source/WTF/wtf/PlatformMac.cmake b/Source/WTF/wtf/PlatformMac.cmake
+--- a/Source/WTF/wtf/PlatformMac.cmake
++++ b/Source/WTF/wtf/PlatformMac.cmake
+@@ -2,11 +2,9 @@ set(WTF_LIBRARY_TYPE SHARED)
+ 
+ find_library(COCOA_LIBRARY Cocoa)
+ find_library(COREFOUNDATION_LIBRARY CoreFoundation)
+-find_library(READLINE_LIBRARY Readline)
+ list(APPEND WTF_LIBRARIES
+     ${COREFOUNDATION_LIBRARY}
+     ${COCOA_LIBRARY}
+-    ${READLINE_LIBRARY}
+     libicucore.dylib
+ )
+ 
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtwebkit.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtwebkit.patch
new file mode 100644
index 000000000000..b94a4b76cbab
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtwebkit.patch
@@ -0,0 +1,12 @@
+diff --git a/Source/WebKit2/PlatformQt.cmake b/Source/WebKit2/PlatformQt.cmake
+--- a/Source/WebKit2/PlatformQt.cmake
++++ b/Source/WebKit2/PlatformQt.cmake
+@@ -261,6 +261,7 @@
+ list(APPEND WebKit2_SYSTEM_INCLUDE_DIRECTORIES
+     ${GLIB_INCLUDE_DIRS}
+     ${GSTREAMER_INCLUDE_DIRS}
++    ${GSTREAMER_PBUTILS_INCLUDE_DIRS}
+     ${Qt5Quick_INCLUDE_DIRS}
+     ${Qt5Quick_PRIVATE_INCLUDE_DIRS}
+     ${SQLITE_INCLUDE_DIR}
+
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.12/srcs.nix b/nixpkgs/pkgs/development/libraries/qt-5/5.12/srcs.nix
new file mode 100644
index 000000000000..d83edc97e94f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.12/srcs.nix
@@ -0,0 +1,325 @@
+# DO NOT EDIT! This file is generated automatically by fetch-kde-qt.sh
+{ fetchurl, mirror }:
+
+{
+  qt3d = {
+    version = "5.12.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.12/5.12.0/submodules/qt3d-everywhere-src-5.12.0.tar.xz";
+      sha256 = "1nii8qz8791ripmqd158qah40j2dj50zn7lmqksqz8gz2jfdqam1";
+      name = "qt3d-everywhere-src-5.12.0.tar.xz";
+    };
+  };
+  qtactiveqt = {
+    version = "5.12.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.12/5.12.0/submodules/qtactiveqt-everywhere-src-5.12.0.tar.xz";
+      sha256 = "0gkdx3mc6ysqlf0ci77kf9c961dc9sbi4j3z5q237d1w4js7ca52";
+      name = "qtactiveqt-everywhere-src-5.12.0.tar.xz";
+    };
+  };
+  qtandroidextras = {
+    version = "5.12.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.12/5.12.0/submodules/qtandroidextras-everywhere-src-5.12.0.tar.xz";
+      sha256 = "0s083ngvya8bknp0bvgb3hyk6zr8shg8rmkzn98956dqz0xs3agm";
+      name = "qtandroidextras-everywhere-src-5.12.0.tar.xz";
+    };
+  };
+  qtbase = {
+    version = "5.12.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.12/5.12.0/submodules/qtbase-everywhere-src-5.12.0.tar.xz";
+      sha256 = "1jzfx8c0hzch0kmz2m4vkn65s7ikiymnm29lsymil4hfg0fj40sy";
+      name = "qtbase-everywhere-src-5.12.0.tar.xz";
+    };
+  };
+  qtcanvas3d = {
+    version = "5.12.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.12/5.12.0/submodules/qtcanvas3d-everywhere-src-5.12.0.tar.xz";
+      sha256 = "0a61z5amp409aq9v7j0fyk003fbz2i247idl7lgfbl4qqh0ry6xj";
+      name = "qtcanvas3d-everywhere-src-5.12.0.tar.xz";
+    };
+  };
+  qtcharts = {
+    version = "5.12.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.12/5.12.0/submodules/qtcharts-everywhere-src-5.12.0.tar.xz";
+      sha256 = "0l6lrrwqbqaf6agsghaw4ysm2vb6b4n9j5lgrs1i0q8h9i51rmww";
+      name = "qtcharts-everywhere-src-5.12.0.tar.xz";
+    };
+  };
+  qtconnectivity = {
+    version = "5.12.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.12/5.12.0/submodules/qtconnectivity-everywhere-src-5.12.0.tar.xz";
+      sha256 = "1912a4my72wcqmmdyj24wkwq9p9ih4gzzzvgiq75pfwyhnxa3g4f";
+      name = "qtconnectivity-everywhere-src-5.12.0.tar.xz";
+    };
+  };
+  qtdatavis3d = {
+    version = "5.12.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.12/5.12.0/submodules/qtdatavis3d-everywhere-src-5.12.0.tar.xz";
+      sha256 = "0czlj088gf2r6w5ahh0p8n36lbwmds86mxqijshmhzax5cspxnjf";
+      name = "qtdatavis3d-everywhere-src-5.12.0.tar.xz";
+    };
+  };
+  qtdeclarative = {
+    version = "5.12.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.12/5.12.0/submodules/qtdeclarative-everywhere-src-5.12.0.tar.xz";
+      sha256 = "0yr29hm3bqlwxcmna0bzyxw8k4hw3x8k3k4iiw2sw52p5c85izag";
+      name = "qtdeclarative-everywhere-src-5.12.0.tar.xz";
+    };
+  };
+  qtdoc = {
+    version = "5.12.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.12/5.12.0/submodules/qtdoc-everywhere-src-5.12.0.tar.xz";
+      sha256 = "1k8caa1nmc9nrhb29vq1qzaz608klnjxy509w6ppxlzz2zbpcr9h";
+      name = "qtdoc-everywhere-src-5.12.0.tar.xz";
+    };
+  };
+  qtgamepad = {
+    version = "5.12.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.12/5.12.0/submodules/qtgamepad-everywhere-src-5.12.0.tar.xz";
+      sha256 = "14b0np15gm5lzvip33pg6w9dfs065wwdfz18na28bhbxj6wh06ac";
+      name = "qtgamepad-everywhere-src-5.12.0.tar.xz";
+    };
+  };
+  qtgraphicaleffects = {
+    version = "5.12.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.12/5.12.0/submodules/qtgraphicaleffects-everywhere-src-5.12.0.tar.xz";
+      sha256 = "0m9l031zhw8il66ld8bj1lwqlc2xx89nl6dvssz1kl2d5nqqy1c1";
+      name = "qtgraphicaleffects-everywhere-src-5.12.0.tar.xz";
+    };
+  };
+  qtimageformats = {
+    version = "5.12.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.12/5.12.0/submodules/qtimageformats-everywhere-src-5.12.0.tar.xz";
+      sha256 = "0bkkk5skpplwfbqv7g41rhgynyxs3khvf8gk2rl2gdixdplpv42z";
+      name = "qtimageformats-everywhere-src-5.12.0.tar.xz";
+    };
+  };
+  qtlocation = {
+    version = "5.12.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.12/5.12.0/submodules/qtlocation-everywhere-src-5.12.0.tar.xz";
+      sha256 = "0ja4cwj59y1xhwwf4f5gzr0fdrrsxbh14g2x812n03x0yd6i78xh";
+      name = "qtlocation-everywhere-src-5.12.0.tar.xz";
+    };
+  };
+  qtmacextras = {
+    version = "5.12.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.12/5.12.0/submodules/qtmacextras-everywhere-src-5.12.0.tar.xz";
+      sha256 = "00xhkj66i3srwmzzin1mcx9m94l5ns08f93c1za3wl23ani7n2nr";
+      name = "qtmacextras-everywhere-src-5.12.0.tar.xz";
+    };
+  };
+  qtmultimedia = {
+    version = "5.12.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.12/5.12.0/submodules/qtmultimedia-everywhere-src-5.12.0.tar.xz";
+      sha256 = "1a96x6c2w9rs6vfsdcnzmmad4w32dxy2dvismldcwmwcq2whqjsw";
+      name = "qtmultimedia-everywhere-src-5.12.0.tar.xz";
+    };
+  };
+  qtnetworkauth = {
+    version = "5.12.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.12/5.12.0/submodules/qtnetworkauth-everywhere-src-5.12.0.tar.xz";
+      sha256 = "0x877ra8375pf8d8p6hgdkyw8yzjqfca6rgki6vi1q8fyi31j4a1";
+      name = "qtnetworkauth-everywhere-src-5.12.0.tar.xz";
+    };
+  };
+  qtpurchasing = {
+    version = "5.12.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.12/5.12.0/submodules/qtpurchasing-everywhere-src-5.12.0.tar.xz";
+      sha256 = "1nk0dp247v1rfbnj84g99zsj6iv86pq32f478r92adz9qcgfs2yr";
+      name = "qtpurchasing-everywhere-src-5.12.0.tar.xz";
+    };
+  };
+  qtquickcontrols = {
+    version = "5.12.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.12/5.12.0/submodules/qtquickcontrols-everywhere-src-5.12.0.tar.xz";
+      sha256 = "0wyd24aphpixi3k9vbxw73z3dy1xnf8hwc99wimr5mpf1cj67yrb";
+      name = "qtquickcontrols-everywhere-src-5.12.0.tar.xz";
+    };
+  };
+  qtquickcontrols2 = {
+    version = "5.12.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.12/5.12.0/submodules/qtquickcontrols2-everywhere-src-5.12.0.tar.xz";
+      sha256 = "1ikxj32rd9pipnrz81l5ln700lnw8w6bx573w01x424sx0p7wxw9";
+      name = "qtquickcontrols2-everywhere-src-5.12.0.tar.xz";
+    };
+  };
+  qtremoteobjects = {
+    version = "5.12.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.12/5.12.0/submodules/qtremoteobjects-everywhere-src-5.12.0.tar.xz";
+      sha256 = "0pwx2m17yw1qqv8qigfndgj1yd5kq8w5cbiaqlw4zdk1m6jd0h09";
+      name = "qtremoteobjects-everywhere-src-5.12.0.tar.xz";
+    };
+  };
+  qtscript = {
+    version = "5.12.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.12/5.12.0/submodules/qtscript-everywhere-src-5.12.0.tar.xz";
+      sha256 = "1a7ziipvy8cfmrpw2b868167sw21zrqhfv2la0w9vs6hwli1mzlp";
+      name = "qtscript-everywhere-src-5.12.0.tar.xz";
+    };
+  };
+  qtscxml = {
+    version = "5.12.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.12/5.12.0/submodules/qtscxml-everywhere-src-5.12.0.tar.xz";
+      sha256 = "0syx3bx9pxxrsxanfv245ifppjhbj7sbrndh8il86xlrcr9cwvnw";
+      name = "qtscxml-everywhere-src-5.12.0.tar.xz";
+    };
+  };
+  qtsensors = {
+    version = "5.12.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.12/5.12.0/submodules/qtsensors-everywhere-src-5.12.0.tar.xz";
+      sha256 = "19n5vlx0j5a0h86mpgs86qzsxbyq8fcrls7yqnjdaw0zga234cf5";
+      name = "qtsensors-everywhere-src-5.12.0.tar.xz";
+    };
+  };
+  qtserialbus = {
+    version = "5.12.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.12/5.12.0/submodules/qtserialbus-everywhere-src-5.12.0.tar.xz";
+      sha256 = "16imi82v17n18a5m0i2fcfj6hqdpnzn2z9kdcf6a8h93fv4qd4kb";
+      name = "qtserialbus-everywhere-src-5.12.0.tar.xz";
+    };
+  };
+  qtserialport = {
+    version = "5.12.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.12/5.12.0/submodules/qtserialport-everywhere-src-5.12.0.tar.xz";
+      sha256 = "1fx9fm0418jq05j2hlb52lblq8nr4m0hj8sizi86p708jmb01m2r";
+      name = "qtserialport-everywhere-src-5.12.0.tar.xz";
+    };
+  };
+  qtspeech = {
+    version = "5.12.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.12/5.12.0/submodules/qtspeech-everywhere-src-5.12.0.tar.xz";
+      sha256 = "1yx4wahl7iaj6lgpvnw8pdi2q4wc2fkpzfidd3j1bc98wpna4f8r";
+      name = "qtspeech-everywhere-src-5.12.0.tar.xz";
+    };
+  };
+  qtsvg = {
+    version = "5.12.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.12/5.12.0/submodules/qtsvg-everywhere-src-5.12.0.tar.xz";
+      sha256 = "1kpvqd0p7dblgh26p3a99npqr0wmyg5yv0dcmf78ssrvsy58vrpb";
+      name = "qtsvg-everywhere-src-5.12.0.tar.xz";
+    };
+  };
+  qttools = {
+    version = "5.12.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.12/5.12.0/submodules/qttools-everywhere-src-5.12.0.tar.xz";
+      sha256 = "1hyschrj568h65m3kl35xqz25hpk61vr98r08375vkavdr5y6k2p";
+      name = "qttools-everywhere-src-5.12.0.tar.xz";
+    };
+  };
+  qttranslations = {
+    version = "5.12.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.12/5.12.0/submodules/qttranslations-everywhere-src-5.12.0.tar.xz";
+      sha256 = "023m68vdjj75xnbpc1jflyg85amnjc9i6nwv650k0w4n1dp1hksv";
+      name = "qttranslations-everywhere-src-5.12.0.tar.xz";
+    };
+  };
+  qtvirtualkeyboard = {
+    version = "5.12.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.12/5.12.0/submodules/qtvirtualkeyboard-everywhere-src-5.12.0.tar.xz";
+      sha256 = "1nnns0i577zda6qxxd7pxcy06dq0y7lnni8ghn4adh9yl6dvi4yv";
+      name = "qtvirtualkeyboard-everywhere-src-5.12.0.tar.xz";
+    };
+  };
+  qtwayland = {
+    version = "5.12.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.12/5.12.0/submodules/qtwayland-everywhere-src-5.12.0.tar.xz";
+      sha256 = "1mvyv4wkcxj4h3q0mqw53zb1d0pahf8mz3r29kckadvk64djsp2m";
+      name = "qtwayland-everywhere-src-5.12.0.tar.xz";
+    };
+  };
+  qtwebchannel = {
+    version = "5.12.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.12/5.12.0/submodules/qtwebchannel-everywhere-src-5.12.0.tar.xz";
+      sha256 = "1w2b31d7xjzdcgwkb4mz3qrl9ci7c9l4c3v4h8y59isip45g66l5";
+      name = "qtwebchannel-everywhere-src-5.12.0.tar.xz";
+    };
+  };
+  qtwebengine = {
+    version = "5.12.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.12/5.12.0/submodules/qtwebengine-everywhere-src-5.12.0.tar.xz";
+      sha256 = "0z38ad25n7ckylxnmqrxy95ds4pn7i5k7qxh856zgq1h18wiwn5x";
+      name = "qtwebengine-everywhere-src-5.12.0.tar.xz";
+    };
+  };
+  qtwebglplugin = {
+    version = "5.12.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.12/5.12.0/submodules/qtwebglplugin-everywhere-src-5.12.0.tar.xz";
+      sha256 = "0bk5dg33kn2l5lmgd6slsrs9xg15x9h9li91lr1q7qs67b8kl8k5";
+      name = "qtwebglplugin-everywhere-src-5.12.0.tar.xz";
+    };
+  };
+  qtwebsockets = {
+    version = "5.12.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.12/5.12.0/submodules/qtwebsockets-everywhere-src-5.12.0.tar.xz";
+      sha256 = "0gzwfjnlgcijym5bn9gi93qlvzizrhf1q9dq06576419sg0s2ka4";
+      name = "qtwebsockets-everywhere-src-5.12.0.tar.xz";
+    };
+  };
+  qtwebview = {
+    version = "5.12.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.12/5.12.0/submodules/qtwebview-everywhere-src-5.12.0.tar.xz";
+      sha256 = "11b16b31bxcazqzg1ag9rzh4gj9pif2cf3jz2mj1sdprxp22ra5p";
+      name = "qtwebview-everywhere-src-5.12.0.tar.xz";
+    };
+  };
+  qtwinextras = {
+    version = "5.12.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.12/5.12.0/submodules/qtwinextras-everywhere-src-5.12.0.tar.xz";
+      sha256 = "1l6s140vrfxb9ar4p1dq9w2gfk3zvgrpqdxbbzs4ngfpwk6mlky6";
+      name = "qtwinextras-everywhere-src-5.12.0.tar.xz";
+    };
+  };
+  qtx11extras = {
+    version = "5.12.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.12/5.12.0/submodules/qtx11extras-everywhere-src-5.12.0.tar.xz";
+      sha256 = "114b4akzpcgx57c6gkl558bl0mbasi34r22fmq3ny84dhvlv9m06";
+      name = "qtx11extras-everywhere-src-5.12.0.tar.xz";
+    };
+  };
+  qtxmlpatterns = {
+    version = "5.12.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.12/5.12.0/submodules/qtxmlpatterns-everywhere-src-5.12.0.tar.xz";
+      sha256 = "0xckcw1j6f5l92c269pb8cx77d21sghp7m7dc05jl1dqmyy7jqpk";
+      name = "qtxmlpatterns-everywhere-src-5.12.0.tar.xz";
+    };
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.6/default.nix b/nixpkgs/pkgs/development/libraries/qt-5/5.6/default.nix
new file mode 100644
index 000000000000..e493fc169aba
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.6/default.nix
@@ -0,0 +1,183 @@
+/*
+
+# New packages
+
+READ THIS FIRST
+
+This module is for official packages in Qt 5. All available packages are listed
+in `./srcs.nix`, although a few are not yet packaged in Nixpkgs (see below).
+
+IF YOUR PACKAGE IS NOT LISTED IN `./srcs.nix`, IT DOES NOT GO HERE.
+
+Many of the packages released upstream are not yet built in Nixpkgs due to lack
+of demand. To add a Nixpkgs build for an upstream package, copy one of the
+existing packages here and modify it as necessary.
+
+# Updates
+
+1. Update the URL in `./fetch.sh`.
+2. Run `./maintainers/scripts/fetch-kde-qt.sh pkgs/development/libraries/qt-5/$VERSION/`
+   from the top of the Nixpkgs tree.
+3. Update `qtCompatVersion` below if the minor version number changes.
+4. Check that the new packages build correctly.
+5. Commit the changes and open a pull request.
+
+*/
+
+{
+  newScope,
+  stdenv, fetchurl, fetchpatch, makeSetupHook,
+  bison, cups ? null, harfbuzz, libGL, perl,
+  gstreamer, gst-plugins-base,
+  cf-private,
+
+  # options
+  developerBuild ? false,
+  decryptSslTraffic ? false,
+  debug ? false,
+}:
+
+with stdenv.lib;
+
+let
+
+  qtCompatVersion = "5.6";
+
+  mirror = "http://download.qt.io";
+  srcs = import ./srcs.nix { inherit fetchurl; inherit mirror; };
+
+  patches = {
+    qtbase = [
+      ./qtbase.patch
+      ./qtbase-fixguicmake.patch
+      (fetchpatch {
+        name = "CVE-2018-15518.patch";
+        url = "https://codereview.qt-project.org/gitweb?p=qt/qtbase.git;a=patch;h=28a6e642af2ccb454dd019f551c2908753f76f08";
+        sha256 = "0nyssg7d0br7qgzp481f1w8b4p1bj2ggv9iyfrm1mng5v9fypdd7";
+      })
+      (fetchpatch {
+        name = "CVE-2018-19873.patch";
+        url = "https://codereview.qt-project.org/gitweb?p=qt/qtbase.git;a=patch;h=c9b9f663d7243988bcb5fee9180ea9cb3a321a86";
+        sha256 = "1q01cafy92c1j8cgrv4sk133mi3d48x8kbg3glbnnbijpc4k6di5";
+      })
+      (fetchpatch {
+        name = "CVE-2018-19870.patch";
+        url = "http://code.qt.io/cgit/qt/qtbase.git/patch/?id=ac0a910756f91726e03c0e6a89d213bdb4f48fec";
+        sha256 = "00qb9yqwvwnp202am3lqirkjxln1cj8v4wvmlyqya6hna176lj2l";
+      })
+    ];
+    qtdeclarative = [ ./qtdeclarative.patch ];
+    qtscript = [ ./qtscript.patch ];
+    qtserialport = [ ./qtserialport.patch ];
+    qttools = [ ./qttools.patch ];
+    qtwebengine = [ ./qtwebengine-seccomp.patch ];
+    qtwebkit = [ ./qtwebkit.patch ];
+    qtvirtualkeyboard = [
+      (fetchpatch {
+        name = "CVE-2018-19865-A.patch";
+        url = "https://codereview.qt-project.org/gitweb?p=qt/qtvirtualkeyboard.git;a=patch;h=c02115db1de1f3aba81e109043766d600f886522";
+        sha256 = "0ncnyl8f3ypi1kcb9z2i8j33snix111h28njrx8rb49ny01ap8x2";
+      })
+      (fetchpatch {
+        name = "CVE-2018-19865-B.patch";
+        url = "https://codereview.qt-project.org/gitweb?p=qt/qtvirtualkeyboard.git;a=patch;h=01fc537adc74d5e102c8cc93384cdf5cb08b4442";
+        sha256 = "19z8kxqf2lpjqr8189ingrpadch4niviw3p5v93zgx24v7950q27";
+      })
+      (fetchpatch {
+        name = "CVE-2018-19865-C.patch";
+        url = "https://codereview.qt-project.org/gitweb?p=qt/qtvirtualkeyboard.git;a=patch;h=993a21ba03534b172d5354405cc9d50a2a822e24";
+        sha256 = "1bipqxr9bvy8z402pv9kj2w1yzcsj1v03l09pg5jyg1xh6jbgiky";
+      })
+    ];
+    qtimageformats = [
+      (fetchpatch {
+        name = "CVE-2018-19871.patch";
+        url = "https://codereview.qt-project.org/gitweb?p=qt/qtimageformats.git;a=patch;h=9299ab07df61c56b70e047f1fe5f06b6ff541aa3";
+        sha256 = "0fd3mxdlc0s405j02bc0g72fvdfvpi31a837xfwf40m5j4jbyndr";
+      })
+    ];
+    qtsvg = [
+      (fetchpatch {
+        name = "CVE-2018-19869.patch";
+        url = "http://code.qt.io/cgit/qt/qtsvg.git/patch/?id=c5f1dd14098d1cc2cb52448fb44f53966d331443";
+        sha256 = "1kgyfsxw2f0qv5fx9y7wysjsvqikam0qc7wzhklf0406zz6rhxbl";
+      })
+    ];
+  };
+
+  mkDerivation =
+    import ../mkDerivation.nix
+    { inherit stdenv; inherit (stdenv) lib; }
+    { inherit debug; };
+
+  qtModule =
+    import ../qtModule.nix
+    { inherit mkDerivation perl; inherit (stdenv) lib; }
+    { inherit self srcs patches; };
+
+  addPackages = self: with self;
+    let
+      callPackage = self.newScope { inherit qtCompatVersion qtModule srcs; };
+    in {
+
+      inherit mkDerivation;
+
+      qtbase = callPackage ../modules/qtbase.nix {
+        inherit bison cups harfbuzz libGL;
+        inherit (srcs.qtbase) src version;
+        patches = patches.qtbase;
+        inherit developerBuild decryptSslTraffic;
+      };
+
+      /* qt3d = not packaged */
+      /* qtactiveqt = not packaged */
+      /* qtandroidextras = not packaged */
+      /* qtcanvas3d = not packaged */
+      qtconnectivity = callPackage ../modules/qtconnectivity.nix {
+        inherit cf-private;
+      };
+      qtdeclarative = callPackage ../modules/qtdeclarative.nix {};
+      qtdoc = callPackage ../modules/qtdoc.nix {};
+      qtgraphicaleffects = callPackage ../modules/qtgraphicaleffects.nix {};
+      qtimageformats = callPackage ../modules/qtimageformats.nix {};
+      qtlocation = callPackage ../modules/qtlocation.nix {};
+      /* qtmacextras = not packaged */
+      qtmultimedia = callPackage ../modules/qtmultimedia.nix {
+        inherit gstreamer gst-plugins-base;
+      };
+      qtquick1 = null;
+      qtquickcontrols = callPackage ../modules/qtquickcontrols.nix {};
+      qtquickcontrols2 = callPackage ../modules/qtquickcontrols2.nix {};
+      qtscript = callPackage ../modules/qtscript.nix {};
+      qtsensors = callPackage ../modules/qtsensors.nix {};
+      qtserialport = callPackage ../modules/qtserialport.nix {};
+      qtsvg = callPackage ../modules/qtsvg.nix {};
+      qttools = callPackage ../modules/qttools.nix {};
+      qttranslations = callPackage ../modules/qttranslations.nix {};
+      qtwayland = callPackage ../modules/qtwayland.nix {};
+      qtwebchannel = callPackage ../modules/qtwebchannel.nix {};
+      qtwebengine = callPackage ../modules/qtwebengine.nix {};
+      qtwebkit = callPackage ../modules/qtwebkit.nix {};
+      qtwebsockets = callPackage ../modules/qtwebsockets.nix {};
+      /* qtwinextras = not packaged */
+      qtx11extras = callPackage ../modules/qtx11extras.nix {};
+      qtxmlpatterns = callPackage ../modules/qtxmlpatterns.nix {};
+      qtvirtualkeyboard = callPackage ../modules/qtvirtualkeyboard.nix {};
+
+      env = callPackage ../qt-env.nix {};
+      full = env "qt-full-${qtbase.version}" [
+        qtconnectivity qtdeclarative qtdoc qtgraphicaleffects qtimageformats
+        qtlocation qtmultimedia qtquickcontrols qtquickcontrols2 qtscript
+        qtsensors qtserialport qtsvg qttools qttranslations qtwayland
+        qtwebchannel qtwebengine qtwebkit qtwebsockets qtx11extras qtxmlpatterns
+      ];
+
+      qmake = makeSetupHook {
+        deps = [ self.qtbase.dev ];
+        substitutions = { inherit (stdenv) isDarwin; };
+      } ../hooks/qmake-hook.sh;
+    };
+
+   self = makeScope newScope addPackages;
+
+in self
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.6/fetch.sh b/nixpkgs/pkgs/development/libraries/qt-5/5.6/fetch.sh
new file mode 100644
index 000000000000..bb9eb66a01dc
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.6/fetch.sh
@@ -0,0 +1,2 @@
+WGET_ARGS=( http://download.qt.io/official_releases/qt/5.6/5.6.3/submodules/ \
+            http://download.qt.io/community_releases/5.6/5.6.3/ )
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.6/qtbase-fixguicmake.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.6/qtbase-fixguicmake.patch
new file mode 100644
index 000000000000..8b46d432812a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.6/qtbase-fixguicmake.patch
@@ -0,0 +1,30 @@
+diff --git a/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in b/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
+index 0bbc871..3673634 100644
+--- a/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
++++ b/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
+@@ -286,7 +286,7 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
+     macro(_populate_$${CMAKE_MODULE_NAME}_plugin_properties Plugin Configuration PLUGIN_LOCATION)
+         set_property(TARGET Qt5::${Plugin} APPEND PROPERTY IMPORTED_CONFIGURATIONS ${Configuration})
+ 
+-        set(imported_location \"$${CMAKE_PLUGIN_DIR}${PLUGIN_LOCATION}\")
++        set(imported_location \"${PLUGIN_LOCATION}\")
+         _qt5_$${CMAKE_MODULE_NAME}_check_file_exists(${imported_location})
+         set_target_properties(Qt5::${Plugin} PROPERTIES
+             \"IMPORTED_LOCATION_${Configuration}\" ${imported_location}
+diff --git a/mkspecs/features/data/cmake/Qt5PluginTarget.cmake.in b/mkspecs/features/data/cmake/Qt5PluginTarget.cmake.in
+index 5baf0fd..3583745 100644
+--- a/mkspecs/features/data/cmake/Qt5PluginTarget.cmake.in
++++ b/mkspecs/features/data/cmake/Qt5PluginTarget.cmake.in
+@@ -2,10 +2,10 @@
+ add_library(Qt5::$$CMAKE_PLUGIN_NAME MODULE IMPORTED)
+ 
+ !!IF !isEmpty(CMAKE_RELEASE_TYPE)
+-_populate_$${CMAKE_MODULE_NAME}_plugin_properties($$CMAKE_PLUGIN_NAME RELEASE \"$${CMAKE_PLUGIN_LOCATION_RELEASE}\")
++_populate_$${CMAKE_MODULE_NAME}_plugin_properties($$CMAKE_PLUGIN_NAME RELEASE \"$${CMAKE_PLUGIN_DIR}$${CMAKE_PLUGIN_LOCATION_RELEASE}\")
+ !!ENDIF
+ !!IF !isEmpty(CMAKE_DEBUG_TYPE)
+-_populate_$${CMAKE_MODULE_NAME}_plugin_properties($$CMAKE_PLUGIN_NAME DEBUG \"$${CMAKE_PLUGIN_LOCATION_DEBUG}\")
++_populate_$${CMAKE_MODULE_NAME}_plugin_properties($$CMAKE_PLUGIN_NAME DEBUG \"$${CMAKE_PLUGIN_DIR}$${CMAKE_PLUGIN_LOCATION_DEBUG}\")
+ !!ENDIF
+ 
+ list(APPEND Qt5$${CMAKE_MODULE_NAME}_PLUGINS Qt5::$$CMAKE_PLUGIN_NAME)
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.6/qtbase.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.6/qtbase.patch
new file mode 100644
index 000000000000..d8322cbc1997
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.6/qtbase.patch
@@ -0,0 +1,795 @@
+diff --git a/mkspecs/features/create_cmake.prf b/mkspecs/features/create_cmake.prf
+index 11fb52a0b1..614fdbb046 100644
+--- a/mkspecs/features/create_cmake.prf
++++ b/mkspecs/features/create_cmake.prf
+@@ -21,7 +21,7 @@ load(cmake_functions)
+ # at cmake time whether package has been found via a symlink, and correct
+ # that to an absolute path. This is only done for installations to
+ # the /usr or / prefix.
+-CMAKE_INSTALL_LIBS_DIR = $$cmakeTargetPath($$[QT_INSTALL_LIBS])
++CMAKE_INSTALL_LIBS_DIR = $$cmakeTargetPath($$NIX_OUTPUT_OUT/lib/)
+ contains(CMAKE_INSTALL_LIBS_DIR, ^(/usr)?/lib(64)?.*): CMAKE_USR_MOVE_WORKAROUND = $$CMAKE_INSTALL_LIBS_DIR
+ 
+ CMAKE_OUT_DIR = $$MODULE_BASE_OUTDIR/lib/cmake
+@@ -47,47 +47,22 @@ split_incpath {
+         $$cmake_extra_source_includes.output
+ }
+ 
+-CMAKE_INCLUDE_DIR = $$cmakeRelativePath($$[QT_INSTALL_HEADERS], $$[QT_INSTALL_PREFIX])
+-contains(CMAKE_INCLUDE_DIR, "^\\.\\./.*") {
+-    CMAKE_INCLUDE_DIR = $$[QT_INSTALL_HEADERS]/
+-    CMAKE_INCLUDE_DIR_IS_ABSOLUTE = True
+-}
++CMAKE_INCLUDE_DIR = $$NIX_OUTPUT_DEV/include/
++CMAKE_INCLUDE_DIR_IS_ABSOLUTE = True
+ 
+ !exists($$first(QT.$${MODULE}_private.includes)): CMAKE_NO_PRIVATE_INCLUDES = true
+ 
+-CMAKE_LIB_DIR = $$cmakeRelativePath($$[QT_INSTALL_LIBS], $$[QT_INSTALL_PREFIX])
+-contains(CMAKE_LIB_DIR,"^\\.\\./.*") {
+-    CMAKE_LIB_DIR = $$[QT_INSTALL_LIBS]/
+-    CMAKE_LIB_DIR_IS_ABSOLUTE = True
+-} else {
+-    CMAKE_RELATIVE_INSTALL_LIBS_DIR = $$cmakeRelativePath($$[QT_INSTALL_PREFIX], $$[QT_INSTALL_LIBS])
+-    # We need to go up another two levels because the CMake files are
+-    # installed in $${CMAKE_LIB_DIR}/cmake/Qt5$${CMAKE_MODULE_NAME}
+-    CMAKE_RELATIVE_INSTALL_DIR = "$${CMAKE_RELATIVE_INSTALL_LIBS_DIR}../../"
+-}
++CMAKE_LIB_DIR = $$NIX_OUTPUT_OUT/lib/
++CMAKE_LIB_DIR_IS_ABSOLUTE = True
+ 
+-CMAKE_BIN_DIR = $$cmakeRelativePath($$[QT_HOST_BINS], $$[QT_INSTALL_PREFIX])
+-contains(CMAKE_BIN_DIR, "^\\.\\./.*") {
+-    CMAKE_BIN_DIR = $$[QT_HOST_BINS]/
+-    CMAKE_BIN_DIR_IS_ABSOLUTE = True
+-}
++CMAKE_BIN_DIR = $$NIX_OUTPUT_BIN/bin/
++CMAKE_BIN_DIR_IS_ABSOLUTE = True
+ 
+-CMAKE_PLUGIN_DIR = $$cmakeRelativePath($$[QT_INSTALL_PLUGINS], $$[QT_INSTALL_PREFIX])
+-contains(CMAKE_PLUGIN_DIR, "^\\.\\./.*") {
+-    CMAKE_PLUGIN_DIR = $$[QT_INSTALL_PLUGINS]/
+-    CMAKE_PLUGIN_DIR_IS_ABSOLUTE = True
+-}
++CMAKE_PLUGIN_DIR = $$NIX_OUTPUT_PLUGIN/
++CMAKE_PLUGIN_DIR_IS_ABSOLUTE = True
+ 
+-win32:!wince:!static:!staticlib {
+-    CMAKE_DLL_DIR = $$cmakeRelativePath($$[QT_INSTALL_BINS], $$[QT_INSTALL_PREFIX])
+-    contains(CMAKE_DLL_DIR, "^\\.\\./.*") {
+-        CMAKE_DLL_DIR = $$[QT_INSTALL_BINS]/
+-        CMAKE_DLL_DIR_IS_ABSOLUTE = True
+-    }
+-} else {
+-    CMAKE_DLL_DIR = $$CMAKE_LIB_DIR
+-    CMAKE_DLL_DIR_IS_ABSOLUTE = $$CMAKE_LIB_DIR_IS_ABSOLUTE
+-}
++CMAKE_DLL_DIR = $$NIX_OUTPUT_OUT/lib/
++CMAKE_DLL_DIR_IS_ABSOLUTE = True
+ 
+ static|staticlib:CMAKE_STATIC_TYPE = true
+ 
+@@ -167,7 +142,7 @@ contains(CONFIG, plugin) {
+       cmake_target_file
+ 
+     cmake_qt5_plugin_file.files = $$cmake_target_file.output
+-    cmake_qt5_plugin_file.path = $$[QT_INSTALL_LIBS]/cmake/Qt5$${CMAKE_MODULE_NAME}
++    cmake_qt5_plugin_file.path = $$NIX_OUTPUT_OUT/lib/cmake/Qt5$${CMAKE_MODULE_NAME}
+     INSTALLS += cmake_qt5_plugin_file
+ 
+     return()
+@@ -314,7 +289,7 @@ exists($$cmake_macros_file.input) {
+     cmake_qt5_module_files.files += $$cmake_macros_file.output
+ }
+ 
+-cmake_qt5_module_files.path = $$[QT_INSTALL_LIBS]/cmake/Qt5$${CMAKE_MODULE_NAME}
++cmake_qt5_module_files.path = $$NIX_OUTPUT_OUT/lib/cmake/Qt5$${CMAKE_MODULE_NAME}
+ 
+ # We are generating cmake files. Most developers of Qt are not aware of cmake,
+ # so we require automatic tests to be available. The only module which should
+diff --git a/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in b/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
+index d2358cae4b..61d8cc0471 100644
+--- a/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
++++ b/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
+@@ -9,30 +9,6 @@ if (CMAKE_VERSION VERSION_LESS 3.0.0)
+ endif()
+ !!ENDIF
+ 
+-!!IF !isEmpty(CMAKE_USR_MOVE_WORKAROUND)
+-!!IF !isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-set(_qt5$${CMAKE_MODULE_NAME}_install_prefix \"$$[QT_INSTALL_PREFIX]\")
+-!!ELSE
+-get_filename_component(_IMPORT_PREFIX \"${CMAKE_CURRENT_LIST_FILE}\" PATH)
+-# Use original install prefix when loaded through a
+-# cross-prefix symbolic link such as /lib -> /usr/lib.
+-get_filename_component(_realCurr \"${_IMPORT_PREFIX}\" REALPATH)
+-get_filename_component(_realOrig \"$$CMAKE_INSTALL_LIBS_DIR/cmake/Qt5$${CMAKE_MODULE_NAME}\" REALPATH)
+-if(_realCurr STREQUAL _realOrig)
+-    get_filename_component(_qt5$${CMAKE_MODULE_NAME}_install_prefix \"$$CMAKE_INSTALL_LIBS_DIR/$${CMAKE_RELATIVE_INSTALL_LIBS_DIR}\" ABSOLUTE)
+-else()
+-    get_filename_component(_qt5$${CMAKE_MODULE_NAME}_install_prefix \"${CMAKE_CURRENT_LIST_DIR}/$${CMAKE_RELATIVE_INSTALL_DIR}\" ABSOLUTE)
+-endif()
+-unset(_realOrig)
+-unset(_realCurr)
+-unset(_IMPORT_PREFIX)
+-!!ENDIF
+-!!ELIF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-get_filename_component(_qt5$${CMAKE_MODULE_NAME}_install_prefix \"${CMAKE_CURRENT_LIST_DIR}/$${CMAKE_RELATIVE_INSTALL_DIR}\" ABSOLUTE)
+-!!ELSE
+-set(_qt5$${CMAKE_MODULE_NAME}_install_prefix \"$$[QT_INSTALL_PREFIX]\")
+-!!ENDIF
+-
+ !!IF !equals(TEMPLATE, aux)
+ # For backwards compatibility only. Use Qt5$${CMAKE_MODULE_NAME}_VERSION instead.
+ set(Qt5$${CMAKE_MODULE_NAME}_VERSION_STRING "$$eval(QT.$${MODULE}.MAJOR_VERSION).$$eval(QT.$${MODULE}.MINOR_VERSION).$$eval(QT.$${MODULE}.PATCH_VERSION)")
+@@ -58,11 +34,7 @@ endmacro()
+ macro(_populate_$${CMAKE_MODULE_NAME}_target_properties Configuration LIB_LOCATION IMPLIB_LOCATION)
+     set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} APPEND PROPERTY IMPORTED_CONFIGURATIONS ${Configuration})
+ 
+-!!IF isEmpty(CMAKE_DLL_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_DLL_DIR}${LIB_LOCATION}\")
+-!!ELSE
+     set(imported_location \"$${CMAKE_DLL_DIR}${LIB_LOCATION}\")
+-!!ENDIF
+     _qt5_$${CMAKE_MODULE_NAME}_check_file_exists(${imported_location})
+     set_target_properties(Qt5::$${CMAKE_MODULE_NAME} PROPERTIES
+         \"INTERFACE_LINK_LIBRARIES\" \"${_Qt5$${CMAKE_MODULE_NAME}_LIB_DEPENDENCIES}\"
+@@ -75,11 +47,7 @@ macro(_populate_$${CMAKE_MODULE_NAME}_target_properties Configuration LIB_LOCATI
+     )
+ 
+ !!IF !isEmpty(CMAKE_WINDOWS_BUILD)
+-!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-    set(imported_implib \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\")
+-!!ELSE
+     set(imported_implib \"IMPORTED_IMPLIB_${Configuration}\" \"$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\")
+-!!ENDIF
+     _qt5_$${CMAKE_MODULE_NAME}_check_file_exists(${imported_implib})
+     if(NOT \"${IMPLIB_LOCATION}\" STREQUAL \"\")
+         set_target_properties(Qt5::$${CMAKE_MODULE_NAME} PROPERTIES
+@@ -95,24 +63,13 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
+ !!IF !no_module_headers
+ !!IF !isEmpty(CMAKE_BUILD_IS_FRAMEWORK)
+     set(_Qt5$${CMAKE_MODULE_NAME}_OWN_INCLUDE_DIRS
+-      \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}Qt$${CMAKE_MODULE_NAME}.framework\"
+-      \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}Qt$${CMAKE_MODULE_NAME}.framework/Headers\"
++      \"$${CMAKE_LIB_DIR}Qt$${CMAKE_MODULE_NAME}.framework\"
++      \"$${CMAKE_LIB_DIR}Qt$${CMAKE_MODULE_NAME}.framework/Headers\"
+     )
+ !!IF isEmpty(CMAKE_NO_PRIVATE_INCLUDES)
+     set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS
+-        \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}Qt$${CMAKE_MODULE_NAME}.framework/Versions/$$section(VERSION, ., 0, 0)/Headers/$$VERSION/\"
+-        \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}Qt$${CMAKE_MODULE_NAME}.framework/Versions/$$section(VERSION, ., 0, 0)/Headers/$$VERSION/$${MODULE_INCNAME}\"
+-    )
+-!!ELSE
+-    set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS \"\")
+-!!ENDIF
+-!!ELSE
+-!!IF isEmpty(CMAKE_INCLUDE_DIR_IS_ABSOLUTE)
+-    set(_Qt5$${CMAKE_MODULE_NAME}_OWN_INCLUDE_DIRS \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$$CMAKE_INCLUDE_DIR\" \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_INCLUDE_DIR}$${MODULE_INCNAME}\")
+-!!IF isEmpty(CMAKE_NO_PRIVATE_INCLUDES)
+-    set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS
+-        \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_INCLUDE_DIR}$${MODULE_INCNAME}/$$VERSION\"
+-        \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_INCLUDE_DIR}$${MODULE_INCNAME}/$$VERSION/$${MODULE_INCNAME}\"
++        \"$${CMAKE_LIB_DIR}Qt$${CMAKE_MODULE_NAME}.framework/Versions/$$section(VERSION, ., 0, 0)/Headers/$$VERSION/\"
++        \"$${CMAKE_LIB_DIR}Qt$${CMAKE_MODULE_NAME}.framework/Versions/$$section(VERSION, ., 0, 0)/Headers/$$VERSION/$${MODULE_INCNAME}\"
+     )
+ !!ELSE
+     set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS \"\")
+@@ -128,7 +85,6 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
+     set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS \"\")
+ !!ENDIF
+ !!ENDIF
+-!!ENDIF
+ !!IF !isEmpty(CMAKE_ADD_SOURCE_INCLUDE_DIRS)
+     include(\"${CMAKE_CURRENT_LIST_DIR}/ExtraSourceIncludes.cmake\" OPTIONAL)
+ !!ENDIF
+@@ -254,25 +210,13 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
+ !!IF !isEmpty(CMAKE_FIND_OTHER_LIBRARY_BUILD)
+ !!IF isEmpty(CMAKE_DEBUG_TYPE)
+ !!IF !isEmpty(CMAKE_STATIC_WINDOWS_BUILD)
+-!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-    if (EXISTS \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" )
+-!!ELSE // CMAKE_LIB_DIR_IS_ABSOLUTE
+     if (EXISTS \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" )
+-!!ENDIF // CMAKE_LIB_DIR_IS_ABSOLUTE
+         _populate_$${CMAKE_MODULE_NAME}_target_properties(DEBUG \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" \"\" )
+ !!ELSE // CMAKE_STATIC_WINDOWS_BUILD
+     if (EXISTS
+-!!IF isEmpty(CMAKE_DLL_DIR_IS_ABSOLUTE)
+-        \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_DLL_DIR}$${CMAKE_LIB_FILE_LOCATION_DEBUG}\"
+-!!ELSE
+         \"$${CMAKE_LIB_FILE_LOCATION_DEBUG}\"
+-!!ENDIF
+       AND EXISTS
+-!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-        \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" )
+-!!ELSE
+         \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" )
+-!!ENDIF
+         _populate_$${CMAKE_MODULE_NAME}_target_properties(DEBUG \"$${CMAKE_LIB_FILE_LOCATION_DEBUG}\" \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" )
+ !!ENDIF // CMAKE_STATIC_WINDOWS_BUILD
+     endif()
+@@ -291,25 +235,13 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
+ !!IF !isEmpty(CMAKE_FIND_OTHER_LIBRARY_BUILD)
+ !!IF isEmpty(CMAKE_RELEASE_TYPE)
+ !!IF !isEmpty(CMAKE_STATIC_WINDOWS_BUILD)
+-!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-    if (EXISTS \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" )
+-!!ELSE // CMAKE_LIB_DIR_IS_ABSOLUTE
+     if (EXISTS \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" )
+-!!ENDIF // CMAKE_LIB_DIR_IS_ABSOLUTE
+         _populate_$${CMAKE_MODULE_NAME}_target_properties(RELEASE \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" \"\" )
+ !!ELSE // CMAKE_STATIC_WINDOWS_BUILD
+     if (EXISTS
+-!!IF isEmpty(CMAKE_DLL_DIR_IS_ABSOLUTE)
+-        \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_DLL_DIR}$${CMAKE_LIB_FILE_LOCATION_RELEASE}\"
+-!!ELSE
+         \"$${CMAKE_LIB_FILE_LOCATION_RELEASE}\"
+-!!ENDIF
+       AND EXISTS
+-!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-        \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" )
+-!!ELSE
+         \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" )
+-!!ENDIF
+         _populate_$${CMAKE_MODULE_NAME}_target_properties(RELEASE \"$${CMAKE_LIB_FILE_LOCATION_RELEASE}\" \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" )
+ !!ENDIF // CMAKE_STATIC_WINDOWS_BUILD
+     endif()
+@@ -328,11 +260,7 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
+     macro(_populate_$${CMAKE_MODULE_NAME}_plugin_properties Plugin Configuration PLUGIN_LOCATION)
+         set_property(TARGET Qt5::${Plugin} APPEND PROPERTY IMPORTED_CONFIGURATIONS ${Configuration})
+ 
+-!!IF isEmpty(CMAKE_PLUGIN_DIR_IS_ABSOLUTE)
+-        set(imported_location \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_PLUGIN_DIR}${PLUGIN_LOCATION}\")
+-!!ELSE
+         set(imported_location \"$${CMAKE_PLUGIN_DIR}${PLUGIN_LOCATION}\")
+-!!ENDIF
+         _qt5_$${CMAKE_MODULE_NAME}_check_file_exists(${imported_location})
+         set_target_properties(Qt5::${Plugin} PROPERTIES
+             \"IMPORTED_LOCATION_${Configuration}\" ${imported_location}
+diff --git a/mkspecs/features/qml_module.prf b/mkspecs/features/qml_module.prf
+index 47ebe78400..25aa2b93e7 100644
+--- a/mkspecs/features/qml_module.prf
++++ b/mkspecs/features/qml_module.prf
+@@ -17,10 +17,7 @@ fq_qml_files = $$_PRO_FILE_PWD_/qmldir
+ 
+ for(qmlf, QML_FILES): fq_qml_files += $$absolute_path($$qmlf, $$_PRO_FILE_PWD_)
+ 
+-qml1_target: \
+-    instbase = $$[QT_INSTALL_IMPORTS]
+-else: \
+-    instbase = $$[QT_INSTALL_QML]
++instbase = $$NIX_OUTPUT_QML
+ 
+ # Install rules
+ qmldir.base = $$_PRO_FILE_PWD_
+diff --git a/mkspecs/features/qml_plugin.prf b/mkspecs/features/qml_plugin.prf
+index ebec1db8da..62ace84a6c 100644
+--- a/mkspecs/features/qml_plugin.prf
++++ b/mkspecs/features/qml_plugin.prf
+@@ -46,13 +46,8 @@ exists($$QMLTYPEFILE): QML_FILES += $$QMLTYPEFILE
+ 
+ load(qt_build_paths)
+ 
+-qml1_target {
+-    DESTDIR = $$MODULE_BASE_OUTDIR/imports/$$TARGETPATH
+-    instbase = $$[QT_INSTALL_IMPORTS]
+-} else {
+-    DESTDIR = $$MODULE_BASE_OUTDIR/qml/$$TARGETPATH
+-    instbase = $$[QT_INSTALL_QML]
+-}
++DESTDIR = $$MODULE_BASE_OUTDIR/qml/$$TARGETPATH
++instbase = $$NIX_OUTPUT_QML
+ 
+ target.path = $$instbase/$$TARGETPATH
+ INSTALLS += target
+diff --git a/mkspecs/features/qt_app.prf b/mkspecs/features/qt_app.prf
+index 46aca50cc2..4f4e634724 100644
+--- a/mkspecs/features/qt_app.prf
++++ b/mkspecs/features/qt_app.prf
+@@ -29,7 +29,7 @@ host_build:force_bootstrap {
+     target.path = $$[QT_HOST_BINS]
+ } else {
+     !build_pass:contains(QT_CONFIG, debug_and_release): CONFIG += release
+-    target.path = $$[QT_INSTALL_BINS]
++    target.path = $$NIX_OUTPUT_BIN/bin
+     CONFIG += relative_qt_rpath  # Qt's tools and apps should be relocatable
+ }
+ INSTALLS += target
+diff --git a/mkspecs/features/qt_build_paths.prf b/mkspecs/features/qt_build_paths.prf
+index 1848f00e90..2af93675c5 100644
+--- a/mkspecs/features/qt_build_paths.prf
++++ b/mkspecs/features/qt_build_paths.prf
+@@ -23,6 +23,6 @@ exists($$MODULE_BASE_INDIR/.git): \
+ !force_independent {
+     # If the module is not built independently, everything ends up in qtbase.
+     # This is the case in non-prefix builds, except for selected modules.
+-    MODULE_BASE_OUTDIR = $$[QT_HOST_PREFIX]
+-    MODULE_QMAKE_OUTDIR = $$[QT_HOST_PREFIX]
++    MODULE_BASE_OUTDIR = $$NIX_OUTPUT_OUT
++    MODULE_QMAKE_OUTDIR = $$NIX_OUTPUT_OUT
+ }
+diff --git a/mkspecs/features/qt_common.prf b/mkspecs/features/qt_common.prf
+index 08b3f3e5af..5ffeafd9d8 100644
+--- a/mkspecs/features/qt_common.prf
++++ b/mkspecs/features/qt_common.prf
+@@ -30,8 +30,8 @@ contains(TEMPLATE, .*lib) {
+         qqt_libdir = \$\$\$\$[QT_HOST_LIBS]
+         qt_libdir = $$[QT_HOST_LIBS]
+     } else {
+-        qqt_libdir = \$\$\$\$[QT_INSTALL_LIBS]
+-        qt_libdir = $$[QT_INSTALL_LIBS]
++        qqt_libdir = \$\$\$\$NIX_OUTPUT_OUT/lib
++        qt_libdir = $$NIX_OUTPUT_OUT/lib
+     }
+     contains(QMAKE_DEFAULT_LIBDIRS, $$qt_libdir) {
+         lib_replace.match = "[^ ']*$$rplbase/lib"
+diff --git a/mkspecs/features/qt_docs.prf b/mkspecs/features/qt_docs.prf
+index 183d0c9502..17982b04ec 100644
+--- a/mkspecs/features/qt_docs.prf
++++ b/mkspecs/features/qt_docs.prf
+@@ -41,7 +41,7 @@ QMAKE_DOCS_OUTPUTDIR = $$QMAKE_DOCS_BASE_OUTDIR/$$QMAKE_DOCS_TARGETDIR
+ 
+ QDOC += -outputdir $$shell_quote($$QMAKE_DOCS_OUTPUTDIR)
+ !build_online_docs: \
+-    QDOC += -installdir $$shell_quote($$[QT_INSTALL_DOCS])
++    QDOC += -installdir $$shell_quote($$NIX_OUTPUT_DOC)
+ PREP_DOC_INDEXES =
+ DOC_INDEXES =
+ !isEmpty(QTREPOS) {
+@@ -60,8 +60,8 @@ DOC_INDEXES =
+         DOC_INDEXES += -indexdir $$shell_quote($$qrep/doc)
+ } else {
+     prepare_docs: \
+-        PREP_DOC_INDEXES += -indexdir $$shell_quote($$[QT_INSTALL_DOCS/get])
+-    DOC_INDEXES += -indexdir $$shell_quote($$[QT_INSTALL_DOCS/get])
++        PREP_DOC_INDEXES += -indexdir $$shell_quote($$NIX_OUTPUT_DOC)
++    DOC_INDEXES += -indexdir $$shell_quote($$NIX_OUTPUT_DOC)
+ }
+ doc_command = $$QDOC $$QMAKE_DOCS
+ prepare_docs {
+@@ -75,12 +75,12 @@ prepare_docs {
+     qch_docs.commands = $$QHELPGENERATOR $$shell_quote($$QMAKE_DOCS_OUTPUTDIR/$${QMAKE_DOCS_TARGET}.qhp) -o $$shell_quote($$QMAKE_DOCS_BASE_OUTDIR/$${QMAKE_DOCS_TARGET}.qch)
+ 
+     inst_html_docs.files = $$QMAKE_DOCS_OUTPUTDIR
+-    inst_html_docs.path = $$[QT_INSTALL_DOCS]
++    inst_html_docs.path = $$NIX_OUTPUT_DOC
+     inst_html_docs.CONFIG += no_check_exist directory no_default_install no_build
+     INSTALLS += inst_html_docs
+ 
+     inst_qch_docs.files = $$QMAKE_DOCS_BASE_OUTDIR/$${QMAKE_DOCS_TARGET}.qch
+-    inst_qch_docs.path = $$[QT_INSTALL_DOCS]
++    inst_qch_docs.path = $$NIX_OUTPUT_DOC
+     inst_qch_docs.CONFIG += no_check_exist no_default_install no_build
+     INSTALLS += inst_qch_docs
+ 
+diff --git a/mkspecs/features/qt_example_installs.prf b/mkspecs/features/qt_example_installs.prf
+index 4c68cfd72f..f422f18266 100644
+--- a/mkspecs/features/qt_example_installs.prf
++++ b/mkspecs/features/qt_example_installs.prf
+@@ -70,7 +70,7 @@ probase = $$relative_path($$_PRO_FILE_PWD_, $$dirname(_QMAKE_CONF_)/examples)
+         $$SOURCES $$HEADERS $$FORMS $$RESOURCES $$TRANSLATIONS \
+         $$DBUS_ADAPTORS $$DBUS_INTERFACES
+     addInstallFiles(sources.files, $$sourcefiles)
+-    sources.path = $$[QT_INSTALL_EXAMPLES]/$$probase
++    sources.path = $$NIX_OUTPUT_DEV/share/examples/$$probase
+     INSTALLS += sources
+ 
+     check_examples {
+diff --git a/mkspecs/features/qt_functions.prf b/mkspecs/features/qt_functions.prf
+index 4a1d265a8b..d346424b5b 100644
+--- a/mkspecs/features/qt_functions.prf
++++ b/mkspecs/features/qt_functions.prf
+@@ -70,7 +70,7 @@ defineTest(qtHaveModule) {
+ defineTest(qtPrepareTool) {
+     cmd = $$eval(QT_TOOL.$${2}.binary)
+     isEmpty(cmd) {
+-        cmd = $$[QT_HOST_BINS]/$$2
++        cmd = $$system("command -v $$2")
+         exists($${cmd}.pl) {
+             cmd = perl -w $$system_path($${cmd}.pl)
+         } else: contains(QMAKE_HOST.os, Windows) {
+diff --git a/mkspecs/features/qt_installs.prf b/mkspecs/features/qt_installs.prf
+index 3a5dbb6274..24f321bd82 100644
+--- a/mkspecs/features/qt_installs.prf
++++ b/mkspecs/features/qt_installs.prf
+@@ -12,16 +12,10 @@
+ #library
+ !qt_no_install_library {
+     win32 {
+-       host_build: \
+-           dlltarget.path = $$[QT_HOST_BINS]
+-       else: \
+-           dlltarget.path = $$[QT_INSTALL_BINS]
++        dlltarget.path = $$NIX_OUTPUT_BIN/bin
+        INSTALLS += dlltarget
+     }
+-    host_build: \
+-        target.path = $$[QT_HOST_LIBS]
+-    else: \
+-        target.path = $$[QT_INSTALL_LIBS]
++    target.path = $$NIX_OUTPUT_OUT/lib
+     !static: target.CONFIG = no_dll
+     INSTALLS += target
+ }
+@@ -29,33 +23,33 @@
+ #headers
+ qt_install_headers {
+     class_headers.files = $$SYNCQT.HEADER_CLASSES
+-    class_headers.path = $$[QT_INSTALL_HEADERS]/$$MODULE_INCNAME
++    class_headers.path = $$NIX_OUTPUT_DEV/include/$$MODULE_INCNAME
+     INSTALLS += class_headers
+ 
+     targ_headers.files = $$SYNCQT.HEADER_FILES
+-    targ_headers.path = $$[QT_INSTALL_HEADERS]/$$MODULE_INCNAME
++    targ_headers.path = $$NIX_OUTPUT_DEV/include/$$MODULE_INCNAME
+     INSTALLS += targ_headers
+ 
+     private_headers.files = $$SYNCQT.PRIVATE_HEADER_FILES
+-    private_headers.path = $$[QT_INSTALL_HEADERS]/$$MODULE_INCNAME/$$VERSION/$$MODULE_INCNAME/private
++    private_headers.path = $$NIX_OUTPUT_DEV/include/$$MODULE_INCNAME/$$VERSION/$$MODULE_INCNAME/private
+     INSTALLS += private_headers
+ 
+     qpa_headers.files = $$SYNCQT.QPA_HEADER_FILES
+-    qpa_headers.path = $$[QT_INSTALL_HEADERS]/$$MODULE_INCNAME/$$VERSION/$$MODULE_INCNAME/qpa
++    qpa_headers.path = $$NIX_OUTPUT_DEV/include/$$MODULE_INCNAME/$$VERSION/$$MODULE_INCNAME/qpa
+     INSTALLS += qpa_headers
+ }
+ 
+ #module
+ qt_install_module {
+     !isEmpty(MODULE_PRI) {
+-        pritarget.path = $$[QT_HOST_DATA]/mkspecs/modules
++        pritarget.path = $$NIX_OUTPUT_DEV/mkspecs/modules
+         pritarget.files = $$MODULE_PRI
+         INSTALLS += pritarget
+     } else: isEmpty(MODULE_PRIVATE_PRI) {
+         warning("Project $$basename(_PRO_FILE_) is a module, but has not defined MODULE_PRI, which is required for Qt to expose the module to other projects.")
+     }
+     !isEmpty(MODULE_PRIVATE_PRI) {
+-        privpritarget.path = $$[QT_HOST_DATA]/mkspecs/modules
++        privpritarget.path = $$NIX_OUTPUT_DEV/mkspecs/modules
+         privpritarget.files = $$MODULE_PRIVATE_PRI
+         INSTALLS += privpritarget
+     }
+diff --git a/mkspecs/features/qt_plugin.prf b/mkspecs/features/qt_plugin.prf
+index 3cf6c7349c..83e68025a5 100644
+--- a/mkspecs/features/qt_plugin.prf
++++ b/mkspecs/features/qt_plugin.prf
+@@ -82,7 +82,7 @@ CONFIG(static, static|shared)|prefix_build {
+     }
+ }
+ 
+-target.path = $$[QT_INSTALL_PLUGINS]/$$PLUGIN_TYPE
++target.path = $$NIX_OUTPUT_PLUGIN/$$PLUGIN_TYPE
+ INSTALLS += target
+ 
+ TARGET = $$qt5LibraryTarget($$TARGET)
+diff --git a/src/corelib/Qt5CoreConfigExtras.cmake.in b/src/corelib/Qt5CoreConfigExtras.cmake.in
+index 91a4eb619a..08b533e69c 100644
+--- a/src/corelib/Qt5CoreConfigExtras.cmake.in
++++ b/src/corelib/Qt5CoreConfigExtras.cmake.in
+@@ -3,7 +3,7 @@ if (NOT TARGET Qt5::qmake)
+     add_executable(Qt5::qmake IMPORTED)
+ 
+ !!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5Core_install_prefix}/$${CMAKE_BIN_DIR}qmake$$CMAKE_BIN_SUFFIX\")
++    set(imported_location \"$$NIX_OUTPUT_DEV/$${CMAKE_BIN_DIR}qmake$$CMAKE_BIN_SUFFIX\")
+ !!ELSE
+     set(imported_location \"$${CMAKE_BIN_DIR}qmake$$CMAKE_BIN_SUFFIX\")
+ !!ENDIF
+@@ -18,7 +18,7 @@ if (NOT TARGET Qt5::moc)
+     add_executable(Qt5::moc IMPORTED)
+ 
+ !!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5Core_install_prefix}/$${CMAKE_BIN_DIR}moc$$CMAKE_BIN_SUFFIX\")
++    set(imported_location \"$$NIX_OUTPUT_DEV/$${CMAKE_BIN_DIR}moc$$CMAKE_BIN_SUFFIX\")
+ !!ELSE
+     set(imported_location \"$${CMAKE_BIN_DIR}moc$$CMAKE_BIN_SUFFIX\")
+ !!ENDIF
+@@ -35,7 +35,7 @@ if (NOT TARGET Qt5::rcc)
+     add_executable(Qt5::rcc IMPORTED)
+ 
+ !!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5Core_install_prefix}/$${CMAKE_BIN_DIR}rcc$$CMAKE_BIN_SUFFIX\")
++    set(imported_location \"$$NIX_OUTPUT_DEV/$${CMAKE_BIN_DIR}rcc$$CMAKE_BIN_SUFFIX\")
+ !!ELSE
+     set(imported_location \"$${CMAKE_BIN_DIR}rcc$$CMAKE_BIN_SUFFIX\")
+ !!ENDIF
+@@ -131,7 +131,7 @@ if (NOT TARGET Qt5::WinMain)
+ !!IF !isEmpty(CMAKE_RELEASE_TYPE)
+     set_property(TARGET Qt5::WinMain APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
+ !!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5Core_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_RELEASE}\")
++    set(imported_location \"$$NIX_OUTPUT_DEV/$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_RELEASE}\")
+ !!ELSE
+     set(imported_location \"$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_RELEASE}\")
+ !!ENDIF
+@@ -145,7 +145,7 @@ if (NOT TARGET Qt5::WinMain)
+     set_property(TARGET Qt5::WinMain APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
+ 
+ !!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5Core_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_DEBUG}\")
++    set(imported_location \"$$NIX_OUTPUT_DEV/$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_DEBUG}\")
+ !!ELSE
+     set(imported_location \"$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_DEBUG}\")
+ !!ENDIF
+diff --git a/src/corelib/Qt5CoreConfigExtrasMkspecDir.cmake.in b/src/corelib/Qt5CoreConfigExtrasMkspecDir.cmake.in
+index c357237d0e..6f0c75de3c 100644
+--- a/src/corelib/Qt5CoreConfigExtrasMkspecDir.cmake.in
++++ b/src/corelib/Qt5CoreConfigExtrasMkspecDir.cmake.in
+@@ -1,6 +1,6 @@
+ 
+ !!IF isEmpty(CMAKE_HOST_DATA_DIR_IS_ABSOLUTE)
+-set(_qt5_corelib_extra_includes \"${_qt5Core_install_prefix}/$${CMAKE_HOST_DATA_DIR}/mkspecs/$${CMAKE_MKSPEC}\")
++set(_qt5_corelib_extra_includes \"$$NIX_OUTPUT_DEV/$${CMAKE_HOST_DATA_DIR}/mkspecs/$${CMAKE_MKSPEC}\")
+ !!ELSE
+ set(_qt5_corelib_extra_includes \"$${CMAKE_HOST_DATA_DIR}mkspecs/$${CMAKE_MKSPEC}\")
+ !!ENDIF
+diff --git a/src/corelib/Qt5CoreConfigExtrasMkspecDirForInstall.cmake.in b/src/corelib/Qt5CoreConfigExtrasMkspecDirForInstall.cmake.in
+index 706304cf34..546420f6ad 100644
+--- a/src/corelib/Qt5CoreConfigExtrasMkspecDirForInstall.cmake.in
++++ b/src/corelib/Qt5CoreConfigExtrasMkspecDirForInstall.cmake.in
+@@ -1,6 +1,6 @@
+ 
+ !!IF isEmpty(CMAKE_INSTALL_DATA_DIR_IS_ABSOLUTE)
+-set(_qt5_corelib_extra_includes \"${_qt5Core_install_prefix}/$${CMAKE_INSTALL_DATA_DIR}/mkspecs/$${CMAKE_MKSPEC}\")
++set(_qt5_corelib_extra_includes \"$$NIX_OUTPUT_DEV/$${CMAKE_INSTALL_DATA_DIR}/mkspecs/$${CMAKE_MKSPEC}\")
+ !!ELSE
+ set(_qt5_corelib_extra_includes \"$${CMAKE_INSTALL_DATA_DIR}mkspecs/$${CMAKE_MKSPEC}\")
+ !!ENDIF
+diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
+index bd3c12ce97..a796775970 100644
+--- a/src/corelib/kernel/qcoreapplication.cpp
++++ b/src/corelib/kernel/qcoreapplication.cpp
+@@ -2533,6 +2533,15 @@ QStringList QCoreApplication::libraryPaths()
+         QStringList *app_libpaths = new QStringList;
+         coreappdata()->app_libpaths.reset(app_libpaths);
+ 
++        // Add library paths derived from PATH
++        const QStringList paths = QFile::decodeName(qgetenv("PATH")).split(':');
++        const QString plugindir = QStringLiteral("../" NIXPKGS_QT_PLUGIN_PREFIX);
++        for (const QString &path: paths) {
++            if (!path.isEmpty()) {
++                app_libpaths->append(QDir::cleanPath(path + QDir::separator() + plugindir));
++            }
++        }
++
+         const QByteArray libPathEnv = qgetenv("QT_PLUGIN_PATH");
+         if (!libPathEnv.isEmpty()) {
+             QStringList paths = QFile::decodeName(libPathEnv).split(QDir::listSeparator(), QString::SkipEmptyParts);
+diff --git a/src/corelib/tools/qtimezoneprivate_tz.cpp b/src/corelib/tools/qtimezoneprivate_tz.cpp
+index c13c9a5223..6936851511 100644
+--- a/src/corelib/tools/qtimezoneprivate_tz.cpp
++++ b/src/corelib/tools/qtimezoneprivate_tz.cpp
+@@ -64,7 +64,11 @@ typedef QHash<QByteArray, QTzTimeZone> QTzTimeZoneHash;
+ // Parse zone.tab table, assume lists all installed zones, if not will need to read directories
+ static QTzTimeZoneHash loadTzTimeZones()
+ {
+-    QString path = QStringLiteral("/usr/share/zoneinfo/zone.tab");
++    // Try TZDIR first, in case we're running on NixOS.
++    QString path = QFile::decodeName(qgetenv("TZDIR")) + QStringLiteral("/zone.tab");
++    // Fallback to traditional paths in case we are not on NixOS.
++    if (!QFile::exists(path))
++        path = QStringLiteral("/usr/share/zoneinfo/zone.tab");
+     if (!QFile::exists(path))
+         path = QStringLiteral("/usr/lib/zoneinfo/zone.tab");
+ 
+@@ -636,12 +640,16 @@ void QTzTimeZonePrivate::init(const QByteArray &ianaId)
+         if (!tzif.open(QIODevice::ReadOnly))
+             return;
+     } else {
+-        // Open named tz, try modern path first, if fails try legacy path
+-        tzif.setFileName(QLatin1String("/usr/share/zoneinfo/") + QString::fromLocal8Bit(ianaId));
++        // Try TZDIR first, in case we're running on NixOS
++        tzif.setFileName(QFile::decodeName(qgetenv("TZDIR")) + QStringLiteral("/") + QString::fromLocal8Bit(ianaId));
+         if (!tzif.open(QIODevice::ReadOnly)) {
+-            tzif.setFileName(QLatin1String("/usr/lib/zoneinfo/") + QString::fromLocal8Bit(ianaId));
+-            if (!tzif.open(QIODevice::ReadOnly))
+-                return;
++            // Open named tz, try modern path first, if fails try legacy path
++            tzif.setFileName(QLatin1String("/usr/share/zoneinfo/") + QString::fromLocal8Bit(ianaId));
++            if (!tzif.open(QIODevice::ReadOnly)) {
++                tzif.setFileName(QLatin1String("/usr/lib/zoneinfo/") + QString::fromLocal8Bit(ianaId));
++                if (!tzif.open(QIODevice::ReadOnly))
++                    return;
++            }
+         }
+     }
+ 
+diff --git a/src/dbus/Qt5DBusConfigExtras.cmake.in b/src/dbus/Qt5DBusConfigExtras.cmake.in
+index 1d947159e2..b36865fc48 100644
+--- a/src/dbus/Qt5DBusConfigExtras.cmake.in
++++ b/src/dbus/Qt5DBusConfigExtras.cmake.in
+@@ -2,11 +2,7 @@
+ if (NOT TARGET Qt5::qdbuscpp2xml)
+     add_executable(Qt5::qdbuscpp2xml IMPORTED)
+ 
+-!!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5DBus_install_prefix}/$${CMAKE_BIN_DIR}qdbuscpp2xml$$CMAKE_BIN_SUFFIX\")
+-!!ELSE
+-    set(imported_location \"$${CMAKE_BIN_DIR}qdbuscpp2xml$$CMAKE_BIN_SUFFIX\")
+-!!ENDIF
++    set(imported_location \"$$NIX_OUTPUT_DEV/bin/qdbuscpp2xml$$CMAKE_BIN_SUFFIX\")
+     _qt5_DBus_check_file_exists(${imported_location})
+ 
+     set_target_properties(Qt5::qdbuscpp2xml PROPERTIES
+@@ -17,11 +13,7 @@ endif()
+ if (NOT TARGET Qt5::qdbusxml2cpp)
+     add_executable(Qt5::qdbusxml2cpp IMPORTED)
+ 
+-!!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5DBus_install_prefix}/$${CMAKE_BIN_DIR}qdbusxml2cpp$$CMAKE_BIN_SUFFIX\")
+-!!ELSE
+-    set(imported_location \"$${CMAKE_BIN_DIR}qdbusxml2cpp$$CMAKE_BIN_SUFFIX\")
+-!!ENDIF
++    set(imported_location \"$$NIX_OUTPUT_DEV/bin/qdbusxml2cpp$$CMAKE_BIN_SUFFIX\")
+     _qt5_DBus_check_file_exists(${imported_location})
+ 
+     set_target_properties(Qt5::qdbusxml2cpp PROPERTIES
+diff --git a/src/gui/Qt5GuiConfigExtras.cmake.in b/src/gui/Qt5GuiConfigExtras.cmake.in
+index 07869efd7d..fb4183bada 100644
+--- a/src/gui/Qt5GuiConfigExtras.cmake.in
++++ b/src/gui/Qt5GuiConfigExtras.cmake.in
+@@ -2,7 +2,7 @@
+ !!IF !isEmpty(CMAKE_ANGLE_EGL_DLL_RELEASE)
+ 
+ !!IF isEmpty(CMAKE_INCLUDE_DIR_IS_ABSOLUTE)
+-set(Qt5Gui_EGL_INCLUDE_DIRS \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$$CMAKE_INCLUDE_DIR/QtANGLE\")
++set(Qt5Gui_EGL_INCLUDE_DIRS \"$$NIX_OUTPUT_DEV/$$CMAKE_INCLUDE_DIR/QtANGLE\")
+ !!ELSE
+ set(Qt5Gui_EGL_INCLUDE_DIRS \"$$CMAKE_INCLUDE_DIR/QtANGLE\")
+ !!ENDIF
+@@ -17,13 +17,13 @@ macro(_populate_qt5gui_gl_target_properties TargetName Configuration LIB_LOCATIO
+     set_property(TARGET Qt5::${TargetName} APPEND PROPERTY IMPORTED_CONFIGURATIONS ${Configuration})
+ 
+ !!IF isEmpty(CMAKE_DLL_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5Gui_install_prefix}/$${CMAKE_DLL_DIR}${LIB_LOCATION}\")
++    set(imported_location \"$$NIX_OUTPUT_OUT/$${CMAKE_DLL_DIR}${LIB_LOCATION}\")
+ !!ELSE
+     set(imported_location \"$${CMAKE_DLL_DIR}${LIB_LOCATION}\")
+ !!ENDIF
+ 
+ !!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-    set(imported_implib \"${_qt5Gui_install_prefix}/$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\")
++    set(imported_implib \"$$NIX_OUTPUT_OUT/$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\")
+ !!ELSE
+     set(imported_implib \"$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\")
+ !!ENDIF
+diff --git a/src/network/kernel/qdnslookup_unix.cpp b/src/network/kernel/qdnslookup_unix.cpp
+index 584f0b0f0e..24d80063f2 100644
+--- a/src/network/kernel/qdnslookup_unix.cpp
++++ b/src/network/kernel/qdnslookup_unix.cpp
+@@ -83,7 +83,7 @@ static bool resolveLibraryInternal()
+     if (!lib.load())
+ #endif
+     {
+-        lib.setFileName(QLatin1String("resolv"));
++        lib.setFileName(QLatin1String(NIXPKGS_LIBRESOLV));
+         if (!lib.load())
+             return false;
+     }
+diff --git a/src/network/kernel/qhostinfo_unix.cpp b/src/network/kernel/qhostinfo_unix.cpp
+index dabf1913cc..53bb867e07 100644
+--- a/src/network/kernel/qhostinfo_unix.cpp
++++ b/src/network/kernel/qhostinfo_unix.cpp
+@@ -94,7 +94,7 @@ static bool resolveLibraryInternal()
+     if (!lib.load())
+ #endif
+     {
+-        lib.setFileName(QLatin1String("resolv"));
++        lib.setFileName(QLatin1String(NIXPKGS_LIBRESOLV));
+         if (!lib.load())
+             return false;
+     }
+diff --git a/src/network/ssl/qsslcontext_openssl.cpp b/src/network/ssl/qsslcontext_openssl.cpp
+index 68caaeb6dc..fef4a81474 100644
+--- a/src/network/ssl/qsslcontext_openssl.cpp
++++ b/src/network/ssl/qsslcontext_openssl.cpp
+@@ -340,7 +340,7 @@ init_context:
+ 
+     const QVector<QSslEllipticCurve> qcurves = sslContext->sslConfiguration.ellipticCurves();
+     if (!qcurves.isEmpty()) {
+-#if OPENSSL_VERSION_NUMBER >= 0x10002000L && !defined(OPENSSL_NO_EC)
++#if OPENSSL_VERSION_NUMBER >= 0x10002000L && defined(SSL_CTRL_SET_CURVES) && !defined(OPENSSL_NO_EC)
+         // Set the curves to be used
+         if (q_SSLeay() >= 0x10002000L) {
+             // SSL_CTX_ctrl wants a non-const pointer as last argument,
+@@ -354,7 +354,7 @@ init_context:
+                 return sslContext;
+             }
+         } else
+-#endif // OPENSSL_VERSION_NUMBER >= 0x10002000L && !defined(OPENSSL_NO_EC)
++#endif // OPENSSL_VERSION_NUMBER >= 0x10002000L && defined(SSL_CTRL_SET_CURVES) && !defined(OPENSSL_NO_EC)
+         {
+             // specific curves requested, but not possible to set -> error
+             sslContext->errorStr = msgErrorSettingEllipticCurves(QSslSocket::tr("OpenSSL version too old, need at least v1.0.2"));
+diff --git a/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp b/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp
+index 338c7ca3be..dd52114bac 100644
+--- a/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp
++++ b/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp
+@@ -251,12 +251,9 @@ void TableGenerator::initPossibleLocations()
+     // the QTCOMPOSE environment variable
+     if (qEnvironmentVariableIsSet("QTCOMPOSE"))
+         m_possibleLocations.append(QString::fromLocal8Bit(qgetenv("QTCOMPOSE")));
+-    m_possibleLocations.append(QStringLiteral("/usr/share/X11/locale"));
+-    m_possibleLocations.append(QStringLiteral("/usr/local/share/X11/locale"));
+-    m_possibleLocations.append(QStringLiteral("/usr/lib/X11/locale"));
+-    m_possibleLocations.append(QStringLiteral("/usr/local/lib/X11/locale"));
+     m_possibleLocations.append(QStringLiteral(X11_PREFIX "/share/X11/locale"));
+     m_possibleLocations.append(QStringLiteral(X11_PREFIX "/lib/X11/locale"));
++    m_possibleLocations.append(QLatin1String(NIXPKGS_QTCOMPOSE));
+ }
+ 
+ QString TableGenerator::findComposeFile()
+diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp
+index c2b7a562a9..4fa5f6d6a5 100644
+--- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp
++++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp
+@@ -570,7 +570,14 @@ void (*QGLXContext::getProcAddress(const QByteArray &procName)) ()
+ #ifndef QT_NO_LIBRARY
+                 extern const QString qt_gl_library_name();
+ //                QLibrary lib(qt_gl_library_name());
++                // Check system library paths first
+                 QLibrary lib(QLatin1String("GL"));
++#ifdef NIXPKGS_MESA_GL
++                if (!lib.load()) {
++                    // Fallback to Mesa driver
++                    lib.setFileName(QLatin1String(NIXPKGS_MESA_GL));
++                }
++#endif // NIXPKGS_MESA_GL
+                 glXGetProcAddressARB = (qt_glXGetProcAddressARB) lib.resolve("glXGetProcAddressARB");
+ #endif
+             }
+diff --git a/src/plugins/platforms/xcb/qxcbcursor.cpp b/src/plugins/platforms/xcb/qxcbcursor.cpp
+index 4646ced954..ff3111f393 100644
+--- a/src/plugins/platforms/xcb/qxcbcursor.cpp
++++ b/src/plugins/platforms/xcb/qxcbcursor.cpp
+@@ -303,10 +303,10 @@ QXcbCursor::QXcbCursor(QXcbConnection *conn, QXcbScreen *screen)
+ #if defined(XCB_USE_XLIB) && !defined(QT_NO_LIBRARY)
+     static bool function_ptrs_not_initialized = true;
+     if (function_ptrs_not_initialized) {
+-        QLibrary xcursorLib(QLatin1String("Xcursor"), 1);
++        QLibrary xcursorLib(QLatin1String(NIXPKGS_LIBXCURSOR), 1);
+         bool xcursorFound = xcursorLib.load();
+         if (!xcursorFound) { // try without the version number
+-            xcursorLib.setFileName(QLatin1String("Xcursor"));
++            xcursorLib.setFileName(QLatin1String(NIXPKGS_LIBXCURSOR));
+             xcursorFound = xcursorLib.load();
+         }
+         if (xcursorFound) {
+diff --git a/src/testlib/qtestassert.h b/src/testlib/qtestassert.h
+index ca3e02ca06..28dd73d772 100644
+--- a/src/testlib/qtestassert.h
++++ b/src/testlib/qtestassert.h
+@@ -38,10 +38,13 @@
+ 
+ QT_BEGIN_NAMESPACE
+ 
+-
+-#define QTEST_ASSERT(cond) do { if (!(cond)) qt_assert(#cond,__FILE__,__LINE__); } while (0)
+-
+-#define QTEST_ASSERT_X(cond, where, what) do { if (!(cond)) qt_assert_x(where, what,__FILE__,__LINE__); } while (0)
++#if defined(QT_NO_DEBUG) && !defined(QT_FORCE_ASSERTS)
++#define QTEST_ASSERT(cond) do { } while ((false) && (cond))
++#define QTEST_ASSERT_X(cond, where, what) do { } while ((false) && (cond))
++#else
++#define QTEST_ASSERT(cond) do { if (!(cond)) qt_assert(#cond,__FILE__,__LINE__); } while (false)
++#define QTEST_ASSERT_X(cond, where, what) do { if (!(cond)) qt_assert_x(where, what,__FILE__,__LINE__); } while (false)
++#endif
+ 
+ QT_END_NAMESPACE
+ 
+diff --git a/src/widgets/Qt5WidgetsConfigExtras.cmake.in b/src/widgets/Qt5WidgetsConfigExtras.cmake.in
+index 99d87e2e46..a4eab2aa72 100644
+--- a/src/widgets/Qt5WidgetsConfigExtras.cmake.in
++++ b/src/widgets/Qt5WidgetsConfigExtras.cmake.in
+@@ -3,7 +3,7 @@ if (NOT TARGET Qt5::uic)
+     add_executable(Qt5::uic IMPORTED)
+ 
+ !!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5Widgets_install_prefix}/$${CMAKE_BIN_DIR}uic$$CMAKE_BIN_SUFFIX\")
++    set(imported_location \"$$NIX_OUTPUT_DEV/$${CMAKE_BIN_DIR}uic$$CMAKE_BIN_SUFFIX\")
+ !!ELSE
+     set(imported_location \"$${CMAKE_BIN_DIR}uic$$CMAKE_BIN_SUFFIX\")
+ !!ENDIF
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.6/qtdeclarative.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.6/qtdeclarative.patch
new file mode 100644
index 000000000000..dbddaa2a1d60
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.6/qtdeclarative.patch
@@ -0,0 +1,20 @@
+diff --git a/src/qml/qml/qqmlimport.cpp b/src/qml/qml/qqmlimport.cpp
+index dfdf2edbe..7ee96049d 100644
+--- a/src/qml/qml/qqmlimport.cpp
++++ b/src/qml/qml/qqmlimport.cpp
+@@ -1568,6 +1568,15 @@ QQmlImportDatabase::QQmlImportDatabase(QQmlEngine *e)
+     QString installImportsPath =  QLibraryInfo::location(QLibraryInfo::Qml2ImportsPath);
+     addImportPath(installImportsPath);
+ 
++    // Add import paths derived from PATH
++    const QStringList paths = QFile::decodeName(qgetenv("PATH")).split(':');
++    const QString qmldir = QStringLiteral("../" NIXPKGS_QML2_IMPORT_PREFIX);
++    for (const QString &path: paths) {
++        if (!path.isEmpty()) {
++            addImportPath(QDir::cleanPath(path + QDir::separator() + qmldir));
++        }
++    }
++
+     // env import paths
+     if (Q_UNLIKELY(!qEnvironmentVariableIsEmpty("QML2_IMPORT_PATH"))) {
+         const QByteArray envImportPath = qgetenv("QML2_IMPORT_PATH");
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.6/qtscript.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.6/qtscript.patch
new file mode 100644
index 000000000000..5508dec1280e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.6/qtscript.patch
@@ -0,0 +1,13 @@
+diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Threading.h b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Threading.h
+index 1f6d25e..087c3fb 100644
+--- a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Threading.h
++++ b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Threading.h
+@@ -81,7 +81,7 @@
+ #include <pthread.h>
+ #elif PLATFORM(GTK)
+ #include <wtf/gtk/GOwnPtr.h>
+-typedef struct _GMutex GMutex;
++typedef union _GMutex GMutex;
+ typedef struct _GCond GCond;
+ #endif
+ 
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.6/qtserialport.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.6/qtserialport.patch
new file mode 100644
index 000000000000..b2cffbe4f39b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.6/qtserialport.patch
@@ -0,0 +1,22 @@
+diff --git a/src/serialport/qtudev_p.h b/src/serialport/qtudev_p.h
+index 6f2cabd..cd3c0ed 100644
+--- a/src/serialport/qtudev_p.h
++++ b/src/serialport/qtudev_p.h
+@@ -105,9 +105,17 @@ inline QFunctionPointer resolveSymbol(QLibrary *udevLibrary, const char *symbolN
+ inline bool resolveSymbols(QLibrary *udevLibrary)
+ {
+     if (!udevLibrary->isLoaded()) {
++#ifdef NIXPKGS_LIBUDEV
++        udevLibrary->setFileNameAndVersion(QLatin1String(NIXPKGS_LIBUDEV), 1);
++#else
+         udevLibrary->setFileNameAndVersion(QStringLiteral("udev"), 1);
++#endif
+         if (!udevLibrary->load()) {
++#ifdef NIXPKGS_LIBUDEV
++            udevLibrary->setFileNameAndVersion(QLatin1String(NIXPKGS_LIBUDEV), 0);
++#else
+             udevLibrary->setFileNameAndVersion(QStringLiteral("udev"), 0);
++#endif
+             if (!udevLibrary->load()) {
+                 qWarning("Failed to load the library: %s, supported version(s): %i and %i", qPrintable(udevLibrary->fileName()), 1, 0);
+                 return false;
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.6/qttools.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.6/qttools.patch
new file mode 100644
index 000000000000..dcb15e0e55a6
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.6/qttools.patch
@@ -0,0 +1,64 @@
+diff --git a/src/assistant/help/Qt5HelpConfigExtras.cmake.in b/src/assistant/help/Qt5HelpConfigExtras.cmake.in
+index 5a5bd5ce..1c6727d4 100644
+--- a/src/assistant/help/Qt5HelpConfigExtras.cmake.in
++++ b/src/assistant/help/Qt5HelpConfigExtras.cmake.in
+@@ -2,14 +2,13 @@
+ if (NOT TARGET Qt5::qcollectiongenerator)
+     add_executable(Qt5::qcollectiongenerator IMPORTED)
+ 
+-!!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5Help_install_prefix}/$${CMAKE_BIN_DIR}qcollectiongenerator$$CMAKE_BIN_SUFFIX\")
+-!!ELSE
+     set(imported_location \"$${CMAKE_BIN_DIR}qcollectiongenerator$$CMAKE_BIN_SUFFIX\")
+-!!ENDIF
++    if(NOT EXISTS \"${imported_location}\")
++        set(imported_location \"$${CMAKE_BIN_DIR}qcollectiongenerator$$CMAKE_BIN_SUFFIX\")
++    endif()
+     _qt5_Help_check_file_exists(${imported_location})
+ 
+     set_target_properties(Qt5::qcollectiongenerator PROPERTIES
+         IMPORTED_LOCATION ${imported_location}
+     )
+-endif()
++endif()
+\ No newline at end of file
+diff --git a/src/linguist/Qt5LinguistToolsConfig.cmake.in b/src/linguist/Qt5LinguistToolsConfig.cmake.in
+index 4318b16f..d60db4ff 100644
+--- a/src/linguist/Qt5LinguistToolsConfig.cmake.in
++++ b/src/linguist/Qt5LinguistToolsConfig.cmake.in
+@@ -44,11 +44,7 @@ endmacro()
+ if (NOT TARGET Qt5::lrelease)
+     add_executable(Qt5::lrelease IMPORTED)
+ 
+-!!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5_linguisttools_install_prefix}/$${CMAKE_BIN_DIR}lrelease$$CMAKE_BIN_SUFFIX\")
+-!!ELSE
+     set(imported_location \"$${CMAKE_BIN_DIR}lrelease$$CMAKE_BIN_SUFFIX\")
+-!!ENDIF
+     _qt5_LinguistTools_check_file_exists(${imported_location})
+ 
+     set_target_properties(Qt5::lrelease PROPERTIES
+@@ -59,11 +55,7 @@ endif()
+ if (NOT TARGET Qt5::lupdate)
+     add_executable(Qt5::lupdate IMPORTED)
+ 
+-!!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5_linguisttools_install_prefix}/$${CMAKE_BIN_DIR}lupdate$$CMAKE_BIN_SUFFIX\")
+-!!ELSE
+     set(imported_location \"$${CMAKE_BIN_DIR}lupdate$$CMAKE_BIN_SUFFIX\")
+-!!ENDIF
+     _qt5_LinguistTools_check_file_exists(${imported_location})
+ 
+     set_target_properties(Qt5::lupdate PROPERTIES
+@@ -74,11 +66,7 @@ endif()
+ if (NOT TARGET Qt5::lconvert)
+     add_executable(Qt5::lconvert IMPORTED)
+ 
+-!!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5_linguisttools_install_prefix}/$${CMAKE_BIN_DIR}lconvert$$CMAKE_BIN_SUFFIX\")
+-!!ELSE
+     set(imported_location \"$${CMAKE_BIN_DIR}lconvert$$CMAKE_BIN_SUFFIX\")
+-!!ENDIF
+     _qt5_LinguistTools_check_file_exists(${imported_location})
+ 
+     set_target_properties(Qt5::lconvert PROPERTIES
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.6/qtwebengine-seccomp.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.6/qtwebengine-seccomp.patch
new file mode 100644
index 000000000000..bf6af8059823
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.6/qtwebengine-seccomp.patch
@@ -0,0 +1,24 @@
+Backported to Qt 5.6 for epoll_pwait fix on newer glibc
+Part of upstream Chromium's 4e8083b4ab953ba298aedfc4e79d464be15e4012
+Review URL: https://codereview.chromium.org/1613883002
+---
+diff --git a/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc b/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc
+index 10278dc5fc9b..b30b3e6acef6 100644
+--- a/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc
++++ b/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc
+@@ -414,6 +414,7 @@ bool SyscallSets::IsAllowedEpoll(int sysno) {
+     case __NR_epoll_create:
+     case __NR_epoll_wait:
+ #endif
++    case __NR_epoll_pwait:
+     case __NR_epoll_create1:
+     case __NR_epoll_ctl:
+       return true;
+@@ -421,7 +422,6 @@ bool SyscallSets::IsAllowedEpoll(int sysno) {
+ #if defined(__x86_64__)
+     case __NR_epoll_ctl_old:
+ #endif
+-    case __NR_epoll_pwait:
+ #if defined(__x86_64__)
+     case __NR_epoll_wait_old:
+ #endif
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.6/qtwebkit.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.6/qtwebkit.patch
new file mode 100644
index 000000000000..da1658554e44
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.6/qtwebkit.patch
@@ -0,0 +1,149 @@
+diff --git a/Source/JavaScriptCore/API/JSStringRef.cpp b/Source/JavaScriptCore/API/JSStringRef.cpp
+index 812f3d413..77a3fd0f4 100644
+--- a/Source/JavaScriptCore/API/JSStringRef.cpp
++++ b/Source/JavaScriptCore/API/JSStringRef.cpp
+@@ -37,7 +37,7 @@ using namespace WTF::Unicode;
+ JSStringRef JSStringCreateWithCharacters(const JSChar* chars, size_t numChars)
+ {
+     initializeThreading();
+-    return OpaqueJSString::create(chars, numChars).leakRef();
++    return OpaqueJSString::create(reinterpret_cast<const UChar*>(chars), numChars).leakRef();
+ }
+ 
+ JSStringRef JSStringCreateWithUTF8CString(const char* string)
+@@ -62,7 +62,7 @@ JSStringRef JSStringCreateWithUTF8CString(const char* string)
+ JSStringRef JSStringCreateWithCharactersNoCopy(const JSChar* chars, size_t numChars)
+ {
+     initializeThreading();
+-    return OpaqueJSString::create(StringImpl::createWithoutCopying(chars, numChars, WTF::DoesNotHaveTerminatingNullCharacter)).leakRef();
++    return OpaqueJSString::create(StringImpl::createWithoutCopying(reinterpret_cast<const UChar*>(chars), numChars, WTF::DoesNotHaveTerminatingNullCharacter)).leakRef();
+ }
+ 
+ JSStringRef JSStringRetain(JSStringRef string)
+@@ -83,7 +83,7 @@ size_t JSStringGetLength(JSStringRef string)
+ 
+ const JSChar* JSStringGetCharactersPtr(JSStringRef string)
+ {
+-    return string->characters();
++    return reinterpret_cast<const JSChar*>(string->characters());
+ }
+ 
+ size_t JSStringGetMaximumUTF8CStringSize(JSStringRef string)
+diff --git a/Source/JavaScriptCore/runtime/DateConversion.cpp b/Source/JavaScriptCore/runtime/DateConversion.cpp
+index 0b57f012d..05e27338b 100644
+--- a/Source/JavaScriptCore/runtime/DateConversion.cpp
++++ b/Source/JavaScriptCore/runtime/DateConversion.cpp
+@@ -107,7 +107,8 @@ String formatDateTime(const GregorianDateTime& t, DateTimeFormat format, bool as
+ #if OS(WINDOWS)
+             TIME_ZONE_INFORMATION timeZoneInformation;
+             GetTimeZoneInformation(&timeZoneInformation);
+-            const WCHAR* timeZoneName = t.isDST() ? timeZoneInformation.DaylightName : timeZoneInformation.StandardName;
++            const WCHAR* winTimeZoneName = t.isDST() ? timeZoneInformation.DaylightName : timeZoneInformation.StandardName;
++            String timeZoneName(reinterpret_cast<const UChar*>(winTimeZoneName));
+ #else
+             struct tm gtm = t;
+             char timeZoneName[70];
+diff --git a/Source/WTF/WTF.pri b/Source/WTF/WTF.pri
+index 1f4866d66..bb61e4ba3 100644
+--- a/Source/WTF/WTF.pri
++++ b/Source/WTF/WTF.pri
+@@ -12,7 +12,7 @@ mac {
+     # Mac OS does ship libicu but not the associated header files.
+     # Therefore WebKit provides adequate header files.
+     INCLUDEPATH = $${ROOT_WEBKIT_DIR}/Source/WTF/icu $$INCLUDEPATH
+-    LIBS += -licucore
++    LIBS += /usr/lib/libicucore.dylib
+ } else:!use?(wchar_unicode): {
+     win32 {
+         CONFIG(static, static|shared) {
+diff --git a/Source/WTF/wtf/TypeTraits.h b/Source/WTF/wtf/TypeTraits.h
+index 9df2c95cf..f5d6121fd 100644
+--- a/Source/WTF/wtf/TypeTraits.h
++++ b/Source/WTF/wtf/TypeTraits.h
+@@ -72,6 +72,9 @@ namespace WTF {
+     template<> struct IsInteger<unsigned long>      { static const bool value = true; };
+     template<> struct IsInteger<long long>          { static const bool value = true; };
+     template<> struct IsInteger<unsigned long long> { static const bool value = true; };
++#if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__) || (defined(_HAS_CHAR16_T_LANGUAGE_SUPPORT) && _HAS_CHAR16_T_LANGUAGE_SUPPORT)
++    template<> struct IsInteger<char16_t>           { static const bool value = true; };
++#endif
+ #if !COMPILER(MSVC) || defined(_NATIVE_WCHAR_T_DEFINED)
+     template<> struct IsInteger<wchar_t>            { static const bool value = true; };
+ #endif
+diff --git a/Source/WebCore/plugins/qt/PluginPackageQt.cpp b/Source/WebCore/plugins/qt/PluginPackageQt.cpp
+index a923d49aa..46772a4bb 100644
+--- a/Source/WebCore/plugins/qt/PluginPackageQt.cpp
++++ b/Source/WebCore/plugins/qt/PluginPackageQt.cpp
+@@ -136,7 +136,11 @@ static void initializeGtk(QLibrary* module = 0)
+         }
+     }
+ 
++#ifdef NIXPKGS_LIBGTK2
++    QLibrary library(QLatin1String(NIXPKGS_LIBGTK2), 0);
++#else
+     QLibrary library(QLatin1String("libgtk-x11-2.0"), 0);
++#endif
+     if (library.load()) {
+         typedef void *(*gtk_init_check_ptr)(int*, char***);
+         gtk_init_check_ptr gtkInitCheck = (gtk_init_check_ptr)library.resolve("gtk_init_check");
+diff --git a/Source/WebCore/plugins/qt/PluginViewQt.cpp b/Source/WebCore/plugins/qt/PluginViewQt.cpp
+index de06a2fea..86fe39ef1 100644
+--- a/Source/WebCore/plugins/qt/PluginViewQt.cpp
++++ b/Source/WebCore/plugins/qt/PluginViewQt.cpp
+@@ -697,7 +697,11 @@ static Display *getPluginDisplay()
+     // support gdk based plugins (like flash) that use a different X connection.
+     // The code below has the same effect as this one:
+     // Display *gdkDisplay = gdk_x11_display_get_xdisplay(gdk_display_get_default());
++#ifdef NIXPKGS_LIBGDK2
++    QLibrary library(QLatin1String(NIXPKGS_LIBGDK2), 0);
++#else
+     QLibrary library(QLatin1String("libgdk-x11-2.0"), 0);
++#endif
+     if (!library.load())
+         return 0;
+ 
+diff --git a/Source/WebKit2/PluginProcess/qt/PluginProcessMainQt.cpp b/Source/WebKit2/PluginProcess/qt/PluginProcessMainQt.cpp
+index 8de65216b..38f5c05e5 100644
+--- a/Source/WebKit2/PluginProcess/qt/PluginProcessMainQt.cpp
++++ b/Source/WebKit2/PluginProcess/qt/PluginProcessMainQt.cpp
+@@ -53,7 +53,11 @@ static void messageHandler(QtMsgType type, const QMessageLogContext&, const QStr
+ 
+ static bool initializeGtk()
+ {
++#ifdef NIXPKGS_LIBGTK2
++    QLibrary gtkLibrary(QLatin1String(NIXPKGS_LIBGTK2), 0);
++#else
+     QLibrary gtkLibrary(QLatin1String("libgtk-x11-2.0"), 0);
++#endif
+     if (!gtkLibrary.load())
+         return false;
+     typedef void* (*gtk_init_ptr)(void*, void*);
+diff --git a/Source/WebKit2/Shared/API/c/WKString.cpp b/Source/WebKit2/Shared/API/c/WKString.cpp
+index cbac67dd8..23400a64e 100644
+--- a/Source/WebKit2/Shared/API/c/WKString.cpp
++++ b/Source/WebKit2/Shared/API/c/WKString.cpp
+@@ -55,7 +55,7 @@ size_t WKStringGetLength(WKStringRef stringRef)
+ size_t WKStringGetCharacters(WKStringRef stringRef, WKChar* buffer, size_t bufferLength)
+ {
+     COMPILE_ASSERT(sizeof(WKChar) == sizeof(UChar), WKStringGetCharacters_sizeof_WKChar_matches_UChar);
+-    return (toImpl(stringRef)->getCharacters(static_cast<UChar*>(buffer), bufferLength));
++    return (toImpl(stringRef)->getCharacters(reinterpret_cast<UChar*>(buffer), bufferLength));
+ }
+ 
+ size_t WKStringGetMaximumUTF8CStringSize(WKStringRef stringRef)
+diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp b/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp
+index d734ff684..0f6ff63d1 100644
+--- a/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp
++++ b/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp
+@@ -64,7 +64,11 @@ static Display* getPluginDisplay()
+     // The code below has the same effect as this one:
+     // Display *gdkDisplay = gdk_x11_display_get_xdisplay(gdk_display_get_default());
+ 
++#ifdef NIXPKGS_LIBGDK2
++    QLibrary library(QLatin1String(NIXPKGS_LIBGDK2), 0);
++#else
+     QLibrary library(QLatin1String("libgdk-x11-2.0"), 0);
++#endif
+     if (!library.load())
+         return 0;
+ 
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.6/srcs.nix b/nixpkgs/pkgs/development/libraries/qt-5/5.6/srcs.nix
new file mode 100644
index 000000000000..87d35a43d86b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.6/srcs.nix
@@ -0,0 +1,309 @@
+# DO NOT EDIT! This file is generated automatically by fetch-kde-qt.sh
+{ fetchurl, mirror }:
+
+{
+  qt3d = {
+    version = "5.6.3";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.6/5.6.3/submodules/qt3d-opensource-src-5.6.3.tar.xz";
+      sha256 = "1zkzc3wh2i89nacb55mbgl09zhrjbrxg9ir626bsvz15x4q5ml0h";
+      name = "qt3d-opensource-src-5.6.3.tar.xz";
+    };
+  };
+  qtactiveqt = {
+    version = "5.6.3";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.6/5.6.3/submodules/qtactiveqt-opensource-src-5.6.3.tar.xz";
+      sha256 = "00qscqjpkv5ssrjdwwcjp9q1rqgp8lsdjjksjpyyg4v6knd74s0i";
+      name = "qtactiveqt-opensource-src-5.6.3.tar.xz";
+    };
+  };
+  qtandroidextras = {
+    version = "5.6.3";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.6/5.6.3/submodules/qtandroidextras-opensource-src-5.6.3.tar.xz";
+      sha256 = "1v19p1pqcdicylj3hd2lbm5swqddydlv9aqmws3qwsc2vwh15d4n";
+      name = "qtandroidextras-opensource-src-5.6.3.tar.xz";
+    };
+  };
+  qtbase = {
+    version = "5.6.3";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.6/5.6.3/submodules/qtbase-opensource-src-5.6.3.tar.xz";
+      sha256 = "18ad7cxln61276cm8h8hzm0y6svw6b5m5nbm1niif9pwlqlqbx7y";
+      name = "qtbase-opensource-src-5.6.3.tar.xz";
+    };
+  };
+  qtcanvas3d = {
+    version = "5.6.3";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.6/5.6.3/submodules/qtcanvas3d-opensource-src-5.6.3.tar.xz";
+      sha256 = "1zsn3xbsqapivfg80cldjlh7z07nf88958a7g6dm7figkwahx7p9";
+      name = "qtcanvas3d-opensource-src-5.6.3.tar.xz";
+    };
+  };
+  qtcharts = {
+    version = "2.1.3";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.6/5.6.3/submodules/qtcharts-opensource-src-2.1.3.tar.xz";
+      sha256 = "0bvxmqx7094mq1svrv1i1jp6vl87r2mp7k9n3gqpixjmqaqsjdpn";
+      name = "qtcharts-opensource-src-2.1.3.tar.xz";
+    };
+  };
+  qtconnectivity = {
+    version = "5.6.3";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.6/5.6.3/submodules/qtconnectivity-opensource-src-5.6.3.tar.xz";
+      sha256 = "1pnc0zmps5iw5yhn2w0wl8cnyxhcy88d3rnaiv62ljpsccynwh7s";
+      name = "qtconnectivity-opensource-src-5.6.3.tar.xz";
+    };
+  };
+  qtdatavis3d = {
+    version = "1.2.3";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.6/5.6.3/submodules/qtdatavis3d-opensource-src-1.2.3.tar.xz";
+      sha256 = "0rqhr6s3fic91r6r1g2ws57j6ixvkh4zhcwh7savs1risx374vya";
+      name = "qtdatavis3d-opensource-src-1.2.3.tar.xz";
+    };
+  };
+  qtdeclarative = {
+    version = "5.6.3";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.6/5.6.3/submodules/qtdeclarative-opensource-src-5.6.3.tar.xz";
+      sha256 = "1z4ih5jbydnk5dz0arhvwc54fjw7fynqx3rhm6f8lsyis19w0gzn";
+      name = "qtdeclarative-opensource-src-5.6.3.tar.xz";
+    };
+  };
+  qtdeclarative-render2d = {
+    version = "5.6.3";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.6/5.6.3/submodules/qtdeclarative-render2d-opensource-src-5.6.3.tar.xz";
+      sha256 = "0r2qn8l3wh73cj75rq34zmc6rgl7v11c31pjdcsybad76nw5wb2p";
+      name = "qtdeclarative-render2d-opensource-src-5.6.3.tar.xz";
+    };
+  };
+  qtdoc = {
+    version = "5.6.3";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.6/5.6.3/submodules/qtdoc-opensource-src-5.6.3.tar.xz";
+      sha256 = "11zhlry8hlql1q3pm4mf7qyky9i2irxqdrr9nr5m93wjyfsjbh7f";
+      name = "qtdoc-opensource-src-5.6.3.tar.xz";
+    };
+  };
+  qtenginio = {
+    version = "1.6.3";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.6/5.6.3/submodules/qtenginio-opensource-src-1.6.3.tar.xz";
+      sha256 = "04ir5pa8wpkc7cq08s0b69a0vhkr7479ixn3m2vww4jm6l5hc1yr";
+      name = "qtenginio-opensource-src-1.6.3.tar.xz";
+    };
+  };
+  qtgraphicaleffects = {
+    version = "5.6.3";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.6/5.6.3/submodules/qtgraphicaleffects-opensource-src-5.6.3.tar.xz";
+      sha256 = "1vcrm4jfmxjlw23dnwf45mzq2z5s4fz6j2znknr25ca5bqnmjhn7";
+      name = "qtgraphicaleffects-opensource-src-5.6.3.tar.xz";
+    };
+  };
+  qtimageformats = {
+    version = "5.6.3";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.6/5.6.3/submodules/qtimageformats-opensource-src-5.6.3.tar.xz";
+      sha256 = "1hs8b258xsbc4xb4844mas9ka54f5cfhhszblawwjxn9j0ydmr7g";
+      name = "qtimageformats-opensource-src-5.6.3.tar.xz";
+    };
+  };
+  qtlocation = {
+    version = "5.6.3";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.6/5.6.3/submodules/qtlocation-opensource-src-5.6.3.tar.xz";
+      sha256 = "0rhlmyi5kkhl1bimaj1fmp36v7x5r79j3flgx9dv27rkric1ra5p";
+      name = "qtlocation-opensource-src-5.6.3.tar.xz";
+    };
+  };
+  qtmacextras = {
+    version = "5.6.3";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.6/5.6.3/submodules/qtmacextras-opensource-src-5.6.3.tar.xz";
+      sha256 = "10v2a058yv6k76gg9dgpy4fc0xd652dknzsw5432gm8d9391382i";
+      name = "qtmacextras-opensource-src-5.6.3.tar.xz";
+    };
+  };
+  qtmultimedia = {
+    version = "5.6.3";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.6/5.6.3/submodules/qtmultimedia-opensource-src-5.6.3.tar.xz";
+      sha256 = "0ihvbv0ldravbrx6406ps0z8y6521iz6h58n5ws44xq3m2g06dmf";
+      name = "qtmultimedia-opensource-src-5.6.3.tar.xz";
+    };
+  };
+  qtpurchasing = {
+    version = "5.6.3";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.6/5.6.3/submodules/qtpurchasing-opensource-src-5.6.3.tar.xz";
+      sha256 = "0lf269jzd6y4x5bxjwgz9dpw7hxmc6sp39qpxwlswd505cf0wgd7";
+      name = "qtpurchasing-opensource-src-5.6.3.tar.xz";
+    };
+  };
+  qtquickcontrols = {
+    version = "5.6.3";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.6/5.6.3/submodules/qtquickcontrols-opensource-src-5.6.3.tar.xz";
+      sha256 = "13nvn0d2i4lf4igc1xqf7m98n4j66az1bi02zzv5m18vyb40zfri";
+      name = "qtquickcontrols-opensource-src-5.6.3.tar.xz";
+    };
+  };
+  qtquickcontrols2 = {
+    version = "5.6.3";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.6/5.6.3/submodules/qtquickcontrols2-opensource-src-5.6.3.tar.xz";
+      sha256 = "1jw1zykrx8aa9p781hc74h9za7lnnm4ifpdyqa4ahbdy193phl7c";
+      name = "qtquickcontrols2-opensource-src-5.6.3.tar.xz";
+    };
+  };
+  qtscript = {
+    version = "5.6.3";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.6/5.6.3/submodules/qtscript-opensource-src-5.6.3.tar.xz";
+      sha256 = "12dkf2s1l9y9cwdyayg2mpnwvx14kq93pymp3iy3fw1s1vfj11zh";
+      name = "qtscript-opensource-src-5.6.3.tar.xz";
+    };
+  };
+  qtsensors = {
+    version = "5.6.3";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.6/5.6.3/submodules/qtsensors-opensource-src-5.6.3.tar.xz";
+      sha256 = "0ws96fmk5zz9szrw9x1dwa6gnv9rpv1q0h9ax9z5m1kiapfd80km";
+      name = "qtsensors-opensource-src-5.6.3.tar.xz";
+    };
+  };
+  qtserialbus = {
+    version = "5.6.3";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.6/5.6.3/submodules/qtserialbus-opensource-src-5.6.3.tar.xz";
+      sha256 = "17lskz4r549hc02riv0a3jdjbyaq4y4a94xd3jhy454lhzirpj3i";
+      name = "qtserialbus-opensource-src-5.6.3.tar.xz";
+    };
+  };
+  qtserialport = {
+    version = "5.6.3";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.6/5.6.3/submodules/qtserialport-opensource-src-5.6.3.tar.xz";
+      sha256 = "06mfkd88rcn4p8pfzsyqbfg956vwwcql0khchjgx3bh34zp1yb88";
+      name = "qtserialport-opensource-src-5.6.3.tar.xz";
+    };
+  };
+  qtsvg = {
+    version = "5.6.3";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.6/5.6.3/submodules/qtsvg-opensource-src-5.6.3.tar.xz";
+      sha256 = "1v6wz8fcgsh4lfv68bhavms0l1z3mcn8vggakc3m8rdl2wsih3qh";
+      name = "qtsvg-opensource-src-5.6.3.tar.xz";
+    };
+  };
+  qttools = {
+    version = "5.6.3";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.6/5.6.3/submodules/qttools-opensource-src-5.6.3.tar.xz";
+      sha256 = "09krlrgcglylsv7xx4r681v7zmyy6nr8j18482skrmsqh21vlqqs";
+      name = "qttools-opensource-src-5.6.3.tar.xz";
+    };
+  };
+  qttranslations = {
+    version = "5.6.3";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.6/5.6.3/submodules/qttranslations-opensource-src-5.6.3.tar.xz";
+      sha256 = "1avcfymi9bxk02i1rqh89c6hnvf4bg9qry94z29g1r62c80lxvbd";
+      name = "qttranslations-opensource-src-5.6.3.tar.xz";
+    };
+  };
+  qtvirtualkeyboard = {
+    version = "2.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.6/5.6.3/submodules/qtvirtualkeyboard-opensource-src-2.0.tar.xz";
+      sha256 = "1v0saqz76h9gnb13b8mri4jq93i7f1gr7hj81zj3vz433s2klm0x";
+      name = "qtvirtualkeyboard-opensource-src-2.0.tar.xz";
+    };
+  };
+  qtwayland = {
+    version = "5.6.3";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.6/5.6.3/submodules/qtwayland-opensource-src-5.6.3.tar.xz";
+      sha256 = "18ys14fzjybx02aj85vyqzsp89ypv2c6vfpklxzslwyvn9w54iss";
+      name = "qtwayland-opensource-src-5.6.3.tar.xz";
+    };
+  };
+  qtwebchannel = {
+    version = "5.6.3";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.6/5.6.3/submodules/qtwebchannel-opensource-src-5.6.3.tar.xz";
+      sha256 = "04q7wmdnv4pskah2s5nnrzbsb207fvkj333m69wkqrc64anb1ccf";
+      name = "qtwebchannel-opensource-src-5.6.3.tar.xz";
+    };
+  };
+  qtwebengine = {
+    version = "5.6.3";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.6/5.6.3/submodules/qtwebengine-opensource-src-5.6.3.tar.xz";
+      sha256 = "19xpvnjwrjpj6wx7sy1cs1r1ibnh5hqfk9w9rnqf5h7n77xnk780";
+      name = "qtwebengine-opensource-src-5.6.3.tar.xz";
+    };
+  };
+  qtwebkit = {
+    version = "5.6.3";
+    src = fetchurl {
+      url = "${mirror}/community_releases/5.6/5.6.3/qtwebkit-opensource-src-5.6.3.tar.xz";
+      sha256 = "15iqgaw3jznfq1mdg1mmr7pn8w3qhw964h5m36vg3ywqayr6p309";
+      name = "qtwebkit-opensource-src-5.6.3.tar.xz";
+    };
+  };
+  qtwebkit-examples = {
+    version = "5.6.3";
+    src = fetchurl {
+      url = "${mirror}/community_releases/5.6/5.6.3/qtwebkit-examples-opensource-src-5.6.3.tar.xz";
+      sha256 = "17hnls8j4wz0kyzzq7m3105lqz71zsxr0hya7i23pl4qc8affv1d";
+      name = "qtwebkit-examples-opensource-src-5.6.3.tar.xz";
+    };
+  };
+  qtwebsockets = {
+    version = "5.6.3";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.6/5.6.3/submodules/qtwebsockets-opensource-src-5.6.3.tar.xz";
+      sha256 = "1sr8q0wqw4xwcdl6nvnv04pcjxb0fbs4ywrkcghdz2bcc52r0hx2";
+      name = "qtwebsockets-opensource-src-5.6.3.tar.xz";
+    };
+  };
+  qtwebview = {
+    version = "5.6.3";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.6/5.6.3/submodules/qtwebview-opensource-src-5.6.3.tar.xz";
+      sha256 = "076q9g2ca41v8lyhn7354rs8w2ca0wp2hsxc76zprzghi5p4b2kn";
+      name = "qtwebview-opensource-src-5.6.3.tar.xz";
+    };
+  };
+  qtwinextras = {
+    version = "5.6.3";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.6/5.6.3/submodules/qtwinextras-opensource-src-5.6.3.tar.xz";
+      sha256 = "0nmhvd1g18w12q6i8s87aq7rwikcn1m8m9m0a02l3p22xvimkxzf";
+      name = "qtwinextras-opensource-src-5.6.3.tar.xz";
+    };
+  };
+  qtx11extras = {
+    version = "5.6.3";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.6/5.6.3/submodules/qtx11extras-opensource-src-5.6.3.tar.xz";
+      sha256 = "0zv70z5z48wlg0q2zd7nbp7i0wimdcalns6yg0mjp7v2w2b8wyhy";
+      name = "qtx11extras-opensource-src-5.6.3.tar.xz";
+    };
+  };
+  qtxmlpatterns = {
+    version = "5.6.3";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.6/5.6.3/submodules/qtxmlpatterns-opensource-src-5.6.3.tar.xz";
+      sha256 = "1xjimf88j2s5jrqgr9ki82zmis8r979rrzq4k6dxw43k1ngzyqd4";
+      name = "qtxmlpatterns-opensource-src-5.6.3.tar.xz";
+    };
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.9/default.nix b/nixpkgs/pkgs/development/libraries/qt-5/5.9/default.nix
new file mode 100644
index 000000000000..9baca8124bd7
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.9/default.nix
@@ -0,0 +1,152 @@
+/*
+
+# Updates
+
+Before a major version update, make a copy of this directory. (We like to
+keep the old version around for a short time after major updates.) Add a
+top-level attribute to `top-level/all-packages.nix`.
+
+1. Update the URL in `pkgs/development/libraries/qt-5/$VERSION/fetch.sh`.
+2. From the top of the Nixpkgs tree, run
+   `./maintainers/scripts/fetch-kde-qt.sh > pkgs/development/libraries/qt-5/$VERSION/srcs.nix`.
+3. Update `qtCompatVersion` below if the minor version number changes.
+4. Check that the new packages build correctly.
+5. Commit the changes and open a pull request.
+
+*/
+
+{
+  newScope,
+  stdenv, fetchurl, fetchpatch, makeSetupHook,
+  bison, cups ? null, harfbuzz, libGL, perl,
+  gstreamer, gst-plugins-base, gtk3, dconf,
+  cf-private,
+
+  # options
+  developerBuild ? false,
+  decryptSslTraffic ? false,
+  debug ? false,
+}:
+
+with stdenv.lib;
+
+let
+
+  qtCompatVersion = "5.9";
+
+  mirror = "http://download.qt.io";
+  srcs = import ./srcs.nix { inherit fetchurl; inherit mirror; };
+
+  patches = {
+    qtbase = [ ./qtbase.patch ./qtbase-fixguicmake.patch ];
+    qtdeclarative = [ ./qtdeclarative.patch ];
+    qtscript = [ ./qtscript.patch ];
+    qtserialport = [ ./qtserialport.patch ];
+    qttools = [ ./qttools.patch ];
+    qtwebengine = [ ./qtwebengine-no-build-skip.patch ]
+      ++ optional stdenv.cc.isClang ./qtwebengine-clang-fix.patch
+      ++ optional stdenv.isDarwin ./qtwebengine-darwin-no-platform-check.patch;
+    qtwebkit = [ ./qtwebkit.patch ];
+    qtvirtualkeyboard = [
+      (fetchpatch {
+        name = "CVE-2018-19865-A.patch";
+        url = "https://codereview.qt-project.org/gitweb?p=qt/qtvirtualkeyboard.git;a=patch;h=61780a113f02b3c62fb14516fe8ea47d91f9ed9a";
+        sha256 = "0jd4nzaz9ndm9ryvrkav7kjs437l661288diklhbmgh249f8gki0";
+      })
+      (fetchpatch {
+        name = "CVE-2018-19865-B.patch";
+        url = "https://codereview.qt-project.org/gitweb?p=qt/qtvirtualkeyboard.git;a=patch;h=c0ac7a4c684e2fed60a72ceee53da89eea3f95a7";
+        sha256 = "0yvxrx5vx6845vgnq8ml3q93y61py5j0bvhqj7nqvpbmyj1wy1p3";
+
+      })
+      (fetchpatch {
+        name = "CVE-2018-19865-C.patch";
+        url = "https://codereview.qt-project.org/gitweb?p=qt/qtvirtualkeyboard.git;a=patch;h=a2e7b8412f56841e12ed20a39f4a38e32d3c1e30";
+        sha256 = "1yijysa9gy5xbxndx5ri0dkfrjqja0d1bsx52qz4mhzi4pkbib02";
+      })
+    ];
+
+  };
+
+  mkDerivation =
+    import ../mkDerivation.nix
+    { inherit stdenv; inherit (stdenv) lib; }
+    { inherit debug; };
+
+  qtModule =
+    import ../qtModule.nix
+    { inherit mkDerivation perl; inherit (stdenv) lib; }
+    { inherit self srcs patches; };
+
+  addPackages = self: with self;
+    let
+      callPackage = self.newScope { inherit qtCompatVersion qtModule srcs; };
+    in {
+
+      inherit mkDerivation;
+
+      qtbase = callPackage ../modules/qtbase.nix {
+        inherit (srcs.qtbase) src version;
+        patches = patches.qtbase;
+        inherit bison cups harfbuzz libGL;
+        withGtk3 = true; inherit dconf gtk3;
+        inherit developerBuild decryptSslTraffic;
+      };
+
+      qtcharts = callPackage ../modules/qtcharts.nix {};
+      qtconnectivity = callPackage ../modules/qtconnectivity.nix {
+        inherit cf-private;
+      };
+      qtdeclarative = callPackage ../modules/qtdeclarative.nix {};
+      qtdoc = callPackage ../modules/qtdoc.nix {};
+      qtgraphicaleffects = callPackage ../modules/qtgraphicaleffects.nix {};
+      qtimageformats = callPackage ../modules/qtimageformats.nix {};
+      qtlocation = callPackage ../modules/qtlocation.nix {};
+      qtmacextras = callPackage ../modules/qtmacextras.nix {
+        inherit cf-private;
+      };
+      qtmultimedia = callPackage ../modules/qtmultimedia.nix {
+        inherit gstreamer gst-plugins-base;
+      };
+      qtnetworkauth = callPackage ../modules/qtnetworkauth.nix {};
+      qtquick1 = null;
+      qtquickcontrols = callPackage ../modules/qtquickcontrols.nix {};
+      qtquickcontrols2 = callPackage ../modules/qtquickcontrols2.nix {};
+      qtscript = callPackage ../modules/qtscript.nix {};
+      qtsensors = callPackage ../modules/qtsensors.nix {};
+      qtserialport = callPackage ../modules/qtserialport.nix {};
+      qtsvg = callPackage ../modules/qtsvg.nix {};
+      qttools = callPackage ../modules/qttools.nix {};
+      qttranslations = callPackage ../modules/qttranslations.nix {};
+      qtvirtualkeyboard = callPackage ../modules/qtvirtualkeyboard.nix {};
+      qtwayland = callPackage ../modules/qtwayland.nix {};
+      qtwebchannel = callPackage ../modules/qtwebchannel.nix {};
+      qtwebengine = callPackage ../modules/qtwebengine.nix {};
+      qtwebkit = callPackage ../modules/qtwebkit.nix {};
+      qtwebsockets = callPackage ../modules/qtwebsockets.nix {};
+      qtx11extras = callPackage ../modules/qtx11extras.nix {};
+      qtxmlpatterns = callPackage ../modules/qtxmlpatterns.nix {};
+
+      env = callPackage ../qt-env.nix {};
+      full = env "qt-full-${qtbase.version}" ([
+        qtcharts qtconnectivity qtdeclarative qtdoc qtgraphicaleffects
+        qtimageformats qtlocation qtmultimedia qtquickcontrols qtquickcontrols2
+        qtscript qtsensors qtserialport qtsvg qttools qttranslations
+        qtvirtualkeyboard qtwebchannel qtwebengine qtwebkit qtwebsockets
+        qtx11extras qtxmlpatterns
+      ] ++ optional (!stdenv.isDarwin) qtwayland
+        ++ optional (stdenv.isDarwin) qtmacextras);
+
+      qmake = makeSetupHook {
+        deps = [ self.qtbase.dev ];
+        substitutions = {
+          inherit (stdenv) isDarwin;
+          qtbase_dev = self.qtbase.dev;
+          fix_qt_builtin_paths = ../hooks/fix-qt-builtin-paths.sh;
+        };
+      } ../hooks/qmake-hook.sh;
+    };
+
+   self = makeScope newScope addPackages;
+
+in self
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.9/fetch.sh b/nixpkgs/pkgs/development/libraries/qt-5/5.9/fetch.sh
new file mode 100644
index 000000000000..17ebe1e532df
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.9/fetch.sh
@@ -0,0 +1 @@
+WGET_ARGS=( http://download.qt.io/official_releases/qt/5.9/5.9.7/submodules/ )
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.9/qtbase-fixguicmake.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.9/qtbase-fixguicmake.patch
new file mode 100644
index 000000000000..8b46d432812a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.9/qtbase-fixguicmake.patch
@@ -0,0 +1,30 @@
+diff --git a/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in b/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
+index 0bbc871..3673634 100644
+--- a/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
++++ b/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
+@@ -286,7 +286,7 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
+     macro(_populate_$${CMAKE_MODULE_NAME}_plugin_properties Plugin Configuration PLUGIN_LOCATION)
+         set_property(TARGET Qt5::${Plugin} APPEND PROPERTY IMPORTED_CONFIGURATIONS ${Configuration})
+ 
+-        set(imported_location \"$${CMAKE_PLUGIN_DIR}${PLUGIN_LOCATION}\")
++        set(imported_location \"${PLUGIN_LOCATION}\")
+         _qt5_$${CMAKE_MODULE_NAME}_check_file_exists(${imported_location})
+         set_target_properties(Qt5::${Plugin} PROPERTIES
+             \"IMPORTED_LOCATION_${Configuration}\" ${imported_location}
+diff --git a/mkspecs/features/data/cmake/Qt5PluginTarget.cmake.in b/mkspecs/features/data/cmake/Qt5PluginTarget.cmake.in
+index 5baf0fd..3583745 100644
+--- a/mkspecs/features/data/cmake/Qt5PluginTarget.cmake.in
++++ b/mkspecs/features/data/cmake/Qt5PluginTarget.cmake.in
+@@ -2,10 +2,10 @@
+ add_library(Qt5::$$CMAKE_PLUGIN_NAME MODULE IMPORTED)
+ 
+ !!IF !isEmpty(CMAKE_RELEASE_TYPE)
+-_populate_$${CMAKE_MODULE_NAME}_plugin_properties($$CMAKE_PLUGIN_NAME RELEASE \"$${CMAKE_PLUGIN_LOCATION_RELEASE}\")
++_populate_$${CMAKE_MODULE_NAME}_plugin_properties($$CMAKE_PLUGIN_NAME RELEASE \"$${CMAKE_PLUGIN_DIR}$${CMAKE_PLUGIN_LOCATION_RELEASE}\")
+ !!ENDIF
+ !!IF !isEmpty(CMAKE_DEBUG_TYPE)
+-_populate_$${CMAKE_MODULE_NAME}_plugin_properties($$CMAKE_PLUGIN_NAME DEBUG \"$${CMAKE_PLUGIN_LOCATION_DEBUG}\")
++_populate_$${CMAKE_MODULE_NAME}_plugin_properties($$CMAKE_PLUGIN_NAME DEBUG \"$${CMAKE_PLUGIN_DIR}$${CMAKE_PLUGIN_LOCATION_DEBUG}\")
+ !!ENDIF
+ 
+ list(APPEND Qt5$${CMAKE_MODULE_NAME}_PLUGINS Qt5::$$CMAKE_PLUGIN_NAME)
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.9/qtbase.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.9/qtbase.patch
new file mode 100644
index 000000000000..086ddf4fe3e7
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.9/qtbase.patch
@@ -0,0 +1,1141 @@
+diff --git a/mkspecs/common/mac.conf b/mkspecs/common/mac.conf
+index 5208379f9a..92fe29a0ac 100644
+--- a/mkspecs/common/mac.conf
++++ b/mkspecs/common/mac.conf
+@@ -23,7 +23,7 @@ QMAKE_INCDIR_OPENGL     = \
+ 
+ QMAKE_FIX_RPATH         = install_name_tool -id
+ 
+-QMAKE_LFLAGS_RPATH      = -Wl,-rpath,
++QMAKE_LFLAGS_RPATH      =
+ QMAKE_LFLAGS_GCSECTIONS = -Wl,-dead_strip
+ 
+ QMAKE_LFLAGS_REL_RPATH  =
+diff --git a/mkspecs/features/create_cmake.prf b/mkspecs/features/create_cmake.prf
+index bb5083c925..77034f9bb6 100644
+--- a/mkspecs/features/create_cmake.prf
++++ b/mkspecs/features/create_cmake.prf
+@@ -21,7 +21,7 @@ load(cmake_functions)
+ # at cmake time whether package has been found via a symlink, and correct
+ # that to an absolute path. This is only done for installations to
+ # the /usr or / prefix.
+-CMAKE_INSTALL_LIBS_DIR = $$cmakeTargetPath($$[QT_INSTALL_LIBS])
++CMAKE_INSTALL_LIBS_DIR = $$cmakeTargetPath($$NIX_OUTPUT_OUT/lib/)
+ contains(CMAKE_INSTALL_LIBS_DIR, ^(/usr)?/lib(64)?.*): CMAKE_USR_MOVE_WORKAROUND = $$CMAKE_INSTALL_LIBS_DIR
+ 
+ CMAKE_OUT_DIR = $$MODULE_BASE_OUTDIR/lib/cmake
+@@ -47,47 +47,22 @@ split_incpath {
+         $$cmake_extra_source_includes.output
+ }
+ 
+-CMAKE_INCLUDE_DIR = $$cmakeRelativePath($$[QT_INSTALL_HEADERS], $$[QT_INSTALL_PREFIX])
+-contains(CMAKE_INCLUDE_DIR, "^\\.\\./.*") {
+-    CMAKE_INCLUDE_DIR = $$[QT_INSTALL_HEADERS]/
+-    CMAKE_INCLUDE_DIR_IS_ABSOLUTE = True
+-}
++CMAKE_INCLUDE_DIR = $$NIX_OUTPUT_DEV/include/
++CMAKE_INCLUDE_DIR_IS_ABSOLUTE = True
+ 
+ !exists($$first(QT.$${MODULE}_private.includes)): CMAKE_NO_PRIVATE_INCLUDES = true
+ 
+-CMAKE_LIB_DIR = $$cmakeRelativePath($$[QT_INSTALL_LIBS], $$[QT_INSTALL_PREFIX])
+-contains(CMAKE_LIB_DIR,"^\\.\\./.*") {
+-    CMAKE_LIB_DIR = $$[QT_INSTALL_LIBS]/
+-    CMAKE_LIB_DIR_IS_ABSOLUTE = True
+-} else {
+-    CMAKE_RELATIVE_INSTALL_LIBS_DIR = $$cmakeRelativePath($$[QT_INSTALL_PREFIX], $$[QT_INSTALL_LIBS])
+-    # We need to go up another two levels because the CMake files are
+-    # installed in $${CMAKE_LIB_DIR}/cmake/Qt5$${CMAKE_MODULE_NAME}
+-    CMAKE_RELATIVE_INSTALL_DIR = "$${CMAKE_RELATIVE_INSTALL_LIBS_DIR}../../"
+-}
++CMAKE_LIB_DIR = $$NIX_OUTPUT_OUT/lib/
++CMAKE_LIB_DIR_IS_ABSOLUTE = True
+ 
+-CMAKE_BIN_DIR = $$cmakeRelativePath($$[QT_HOST_BINS], $$[QT_INSTALL_PREFIX])
+-contains(CMAKE_BIN_DIR, "^\\.\\./.*") {
+-    CMAKE_BIN_DIR = $$[QT_HOST_BINS]/
+-    CMAKE_BIN_DIR_IS_ABSOLUTE = True
+-}
++CMAKE_BIN_DIR = $$NIX_OUTPUT_BIN/bin/
++CMAKE_BIN_DIR_IS_ABSOLUTE = True
+ 
+-CMAKE_PLUGIN_DIR = $$cmakeRelativePath($$[QT_INSTALL_PLUGINS], $$[QT_INSTALL_PREFIX])
+-contains(CMAKE_PLUGIN_DIR, "^\\.\\./.*") {
+-    CMAKE_PLUGIN_DIR = $$[QT_INSTALL_PLUGINS]/
+-    CMAKE_PLUGIN_DIR_IS_ABSOLUTE = True
+-}
++CMAKE_PLUGIN_DIR = $$NIX_OUTPUT_PLUGIN/
++CMAKE_PLUGIN_DIR_IS_ABSOLUTE = True
+ 
+-win32:!static:!staticlib {
+-    CMAKE_DLL_DIR = $$cmakeRelativePath($$[QT_INSTALL_BINS], $$[QT_INSTALL_PREFIX])
+-    contains(CMAKE_DLL_DIR, "^\\.\\./.*") {
+-        CMAKE_DLL_DIR = $$[QT_INSTALL_BINS]/
+-        CMAKE_DLL_DIR_IS_ABSOLUTE = True
+-    }
+-} else {
+-    CMAKE_DLL_DIR = $$CMAKE_LIB_DIR
+-    CMAKE_DLL_DIR_IS_ABSOLUTE = $$CMAKE_LIB_DIR_IS_ABSOLUTE
+-}
++CMAKE_DLL_DIR = $$NIX_OUTPUT_OUT/lib/
++CMAKE_DLL_DIR_IS_ABSOLUTE = True
+ 
+ static|staticlib:CMAKE_STATIC_TYPE = true
+ 
+@@ -167,7 +142,7 @@ contains(CONFIG, plugin) {
+       cmake_target_file
+ 
+     cmake_qt5_plugin_file.files = $$cmake_target_file.output
+-    cmake_qt5_plugin_file.path = $$[QT_INSTALL_LIBS]/cmake/Qt5$${CMAKE_MODULE_NAME}
++    cmake_qt5_plugin_file.path = $$NIX_OUTPUT_OUT/lib/cmake/Qt5$${CMAKE_MODULE_NAME}
+     INSTALLS += cmake_qt5_plugin_file
+ 
+     return()
+@@ -314,7 +289,7 @@ exists($$cmake_macros_file.input) {
+     cmake_qt5_module_files.files += $$cmake_macros_file.output
+ }
+ 
+-cmake_qt5_module_files.path = $$[QT_INSTALL_LIBS]/cmake/Qt5$${CMAKE_MODULE_NAME}
++cmake_qt5_module_files.path = $$NIX_OUTPUT_OUT/lib/cmake/Qt5$${CMAKE_MODULE_NAME}
+ 
+ # We are generating cmake files. Most developers of Qt are not aware of cmake,
+ # so we require automatic tests to be available. The only module which should
+diff --git a/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in b/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
+index 55c74aad66..0bbc8718eb 100644
+--- a/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
++++ b/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
+@@ -9,30 +9,6 @@ if (CMAKE_VERSION VERSION_LESS 3.0.0)
+ endif()
+ !!ENDIF
+ 
+-!!IF !isEmpty(CMAKE_USR_MOVE_WORKAROUND)
+-!!IF !isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-set(_qt5$${CMAKE_MODULE_NAME}_install_prefix \"$$[QT_INSTALL_PREFIX]\")
+-!!ELSE
+-get_filename_component(_IMPORT_PREFIX \"${CMAKE_CURRENT_LIST_FILE}\" PATH)
+-# Use original install prefix when loaded through a
+-# cross-prefix symbolic link such as /lib -> /usr/lib.
+-get_filename_component(_realCurr \"${_IMPORT_PREFIX}\" REALPATH)
+-get_filename_component(_realOrig \"$$CMAKE_INSTALL_LIBS_DIR/cmake/Qt5$${CMAKE_MODULE_NAME}\" REALPATH)
+-if(_realCurr STREQUAL _realOrig)
+-    get_filename_component(_qt5$${CMAKE_MODULE_NAME}_install_prefix \"$$CMAKE_INSTALL_LIBS_DIR/$${CMAKE_RELATIVE_INSTALL_LIBS_DIR}\" ABSOLUTE)
+-else()
+-    get_filename_component(_qt5$${CMAKE_MODULE_NAME}_install_prefix \"${CMAKE_CURRENT_LIST_DIR}/$${CMAKE_RELATIVE_INSTALL_DIR}\" ABSOLUTE)
+-endif()
+-unset(_realOrig)
+-unset(_realCurr)
+-unset(_IMPORT_PREFIX)
+-!!ENDIF
+-!!ELIF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-get_filename_component(_qt5$${CMAKE_MODULE_NAME}_install_prefix \"${CMAKE_CURRENT_LIST_DIR}/$${CMAKE_RELATIVE_INSTALL_DIR}\" ABSOLUTE)
+-!!ELSE
+-set(_qt5$${CMAKE_MODULE_NAME}_install_prefix \"$$[QT_INSTALL_PREFIX]\")
+-!!ENDIF
+-
+ !!IF !equals(TEMPLATE, aux)
+ # For backwards compatibility only. Use Qt5$${CMAKE_MODULE_NAME}_VERSION instead.
+ set(Qt5$${CMAKE_MODULE_NAME}_VERSION_STRING "$$eval(QT.$${MODULE}.VERSION)")
+@@ -58,11 +34,7 @@ endmacro()
+ macro(_populate_$${CMAKE_MODULE_NAME}_target_properties Configuration LIB_LOCATION IMPLIB_LOCATION)
+     set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} APPEND PROPERTY IMPORTED_CONFIGURATIONS ${Configuration})
+ 
+-!!IF isEmpty(CMAKE_DLL_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_DLL_DIR}${LIB_LOCATION}\")
+-!!ELSE
+     set(imported_location \"$${CMAKE_DLL_DIR}${LIB_LOCATION}\")
+-!!ENDIF
+     _qt5_$${CMAKE_MODULE_NAME}_check_file_exists(${imported_location})
+     set_target_properties(Qt5::$${CMAKE_MODULE_NAME} PROPERTIES
+         \"INTERFACE_LINK_LIBRARIES\" \"${_Qt5$${CMAKE_MODULE_NAME}_LIB_DEPENDENCIES}\"
+@@ -75,11 +47,7 @@ macro(_populate_$${CMAKE_MODULE_NAME}_target_properties Configuration LIB_LOCATI
+     )
+ 
+ !!IF !isEmpty(CMAKE_WINDOWS_BUILD)
+-!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-    set(imported_implib \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\")
+-!!ELSE
+     set(imported_implib \"IMPORTED_IMPLIB_${Configuration}\" \"$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\")
+-!!ENDIF
+     _qt5_$${CMAKE_MODULE_NAME}_check_file_exists(${imported_implib})
+     if(NOT \"${IMPLIB_LOCATION}\" STREQUAL \"\")
+         set_target_properties(Qt5::$${CMAKE_MODULE_NAME} PROPERTIES
+@@ -95,24 +63,13 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
+ !!IF !no_module_headers
+ !!IF !isEmpty(CMAKE_BUILD_IS_FRAMEWORK)
+     set(_Qt5$${CMAKE_MODULE_NAME}_OWN_INCLUDE_DIRS
+-      \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}Qt$${CMAKE_MODULE_NAME}.framework\"
+-      \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}Qt$${CMAKE_MODULE_NAME}.framework/Headers\"
++      \"$${CMAKE_LIB_DIR}Qt$${CMAKE_MODULE_NAME}.framework\"
++      \"$${CMAKE_LIB_DIR}Qt$${CMAKE_MODULE_NAME}.framework/Headers\"
+     )
+ !!IF isEmpty(CMAKE_NO_PRIVATE_INCLUDES)
+     set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS
+-        \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}Qt$${CMAKE_MODULE_NAME}.framework/Versions/$$section(VERSION, ., 0, 0)/Headers/$$VERSION/\"
+-        \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}Qt$${CMAKE_MODULE_NAME}.framework/Versions/$$section(VERSION, ., 0, 0)/Headers/$$VERSION/$${MODULE_INCNAME}\"
+-    )
+-!!ELSE
+-    set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS \"\")
+-!!ENDIF
+-!!ELSE
+-!!IF isEmpty(CMAKE_INCLUDE_DIR_IS_ABSOLUTE)
+-    set(_Qt5$${CMAKE_MODULE_NAME}_OWN_INCLUDE_DIRS \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$$CMAKE_INCLUDE_DIR\" \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_INCLUDE_DIR}$${MODULE_INCNAME}\")
+-!!IF isEmpty(CMAKE_NO_PRIVATE_INCLUDES)
+-    set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS
+-        \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_INCLUDE_DIR}$${MODULE_INCNAME}/$$VERSION\"
+-        \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_INCLUDE_DIR}$${MODULE_INCNAME}/$$VERSION/$${MODULE_INCNAME}\"
++        \"$${CMAKE_LIB_DIR}Qt$${CMAKE_MODULE_NAME}.framework/Versions/$$section(VERSION, ., 0, 0)/Headers/$$VERSION/\"
++        \"$${CMAKE_LIB_DIR}Qt$${CMAKE_MODULE_NAME}.framework/Versions/$$section(VERSION, ., 0, 0)/Headers/$$VERSION/$${MODULE_INCNAME}\"
+     )
+ !!ELSE
+     set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS \"\")
+@@ -128,7 +85,6 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
+     set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS \"\")
+ !!ENDIF
+ !!ENDIF
+-!!ENDIF
+ !!IF !isEmpty(CMAKE_ADD_SOURCE_INCLUDE_DIRS)
+     include(\"${CMAKE_CURRENT_LIST_DIR}/ExtraSourceIncludes.cmake\" OPTIONAL)
+ !!ENDIF
+@@ -280,25 +236,13 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
+ !!IF !isEmpty(CMAKE_FIND_OTHER_LIBRARY_BUILD)
+ !!IF isEmpty(CMAKE_DEBUG_TYPE)
+ !!IF !isEmpty(CMAKE_STATIC_WINDOWS_BUILD)
+-!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-    if (EXISTS \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" )
+-!!ELSE // CMAKE_LIB_DIR_IS_ABSOLUTE
+     if (EXISTS \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" )
+-!!ENDIF // CMAKE_LIB_DIR_IS_ABSOLUTE
+         _populate_$${CMAKE_MODULE_NAME}_target_properties(DEBUG \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" \"\" )
+ !!ELSE // CMAKE_STATIC_WINDOWS_BUILD
+     if (EXISTS
+-!!IF isEmpty(CMAKE_DLL_DIR_IS_ABSOLUTE)
+-        \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_DLL_DIR}$${CMAKE_LIB_FILE_LOCATION_DEBUG}\"
+-!!ELSE
+         \"$${CMAKE_LIB_FILE_LOCATION_DEBUG}\"
+-!!ENDIF
+       AND EXISTS
+-!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-        \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" )
+-!!ELSE
+         \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" )
+-!!ENDIF
+         _populate_$${CMAKE_MODULE_NAME}_target_properties(DEBUG \"$${CMAKE_LIB_FILE_LOCATION_DEBUG}\" \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" )
+ !!ENDIF // CMAKE_STATIC_WINDOWS_BUILD
+     endif()
+@@ -317,25 +261,13 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
+ !!IF !isEmpty(CMAKE_FIND_OTHER_LIBRARY_BUILD)
+ !!IF isEmpty(CMAKE_RELEASE_TYPE)
+ !!IF !isEmpty(CMAKE_STATIC_WINDOWS_BUILD)
+-!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-    if (EXISTS \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" )
+-!!ELSE // CMAKE_LIB_DIR_IS_ABSOLUTE
+     if (EXISTS \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" )
+-!!ENDIF // CMAKE_LIB_DIR_IS_ABSOLUTE
+         _populate_$${CMAKE_MODULE_NAME}_target_properties(RELEASE \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" \"\" )
+ !!ELSE // CMAKE_STATIC_WINDOWS_BUILD
+     if (EXISTS
+-!!IF isEmpty(CMAKE_DLL_DIR_IS_ABSOLUTE)
+-        \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_DLL_DIR}$${CMAKE_LIB_FILE_LOCATION_RELEASE}\"
+-!!ELSE
+         \"$${CMAKE_LIB_FILE_LOCATION_RELEASE}\"
+-!!ENDIF
+       AND EXISTS
+-!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-        \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" )
+-!!ELSE
+         \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" )
+-!!ENDIF
+         _populate_$${CMAKE_MODULE_NAME}_target_properties(RELEASE \"$${CMAKE_LIB_FILE_LOCATION_RELEASE}\" \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" )
+ !!ENDIF // CMAKE_STATIC_WINDOWS_BUILD
+     endif()
+@@ -354,11 +286,7 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
+     macro(_populate_$${CMAKE_MODULE_NAME}_plugin_properties Plugin Configuration PLUGIN_LOCATION)
+         set_property(TARGET Qt5::${Plugin} APPEND PROPERTY IMPORTED_CONFIGURATIONS ${Configuration})
+ 
+-!!IF isEmpty(CMAKE_PLUGIN_DIR_IS_ABSOLUTE)
+-        set(imported_location \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_PLUGIN_DIR}${PLUGIN_LOCATION}\")
+-!!ELSE
+         set(imported_location \"$${CMAKE_PLUGIN_DIR}${PLUGIN_LOCATION}\")
+-!!ENDIF
+         _qt5_$${CMAKE_MODULE_NAME}_check_file_exists(${imported_location})
+         set_target_properties(Qt5::${Plugin} PROPERTIES
+             \"IMPORTED_LOCATION_${Configuration}\" ${imported_location}
+diff --git a/mkspecs/features/mac/default_post.prf b/mkspecs/features/mac/default_post.prf
+index e645ba5803..a0e5c68b7e 100644
+--- a/mkspecs/features/mac/default_post.prf
++++ b/mkspecs/features/mac/default_post.prf
+@@ -24,166 +24,3 @@ qt {
+         }
+     }
+ }
+-
+-# Add the same default rpaths as Xcode does for new projects.
+-# This is especially important for iOS/tvOS/watchOS where no other option is possible.
+-!no_default_rpath {
+-    QMAKE_RPATHDIR += @executable_path/Frameworks
+-    equals(TEMPLATE, lib):!plugin:lib_bundle: QMAKE_RPATHDIR += @loader_path/Frameworks
+-}
+-
+-# Don't pass -headerpad_max_install_names when using Bitcode.
+-# In that case the linker emits a warning stating that the flag is ignored when
+-# used with bitcode, for reasons that cannot be determined (rdar://problem/20748962).
+-# Using this flag is also unnecessary in practice on UIKit platforms since they
+-# are sandboxed, and only UIKit platforms support bitcode to begin with.
+-!bitcode: QMAKE_LFLAGS += $$QMAKE_LFLAGS_HEADERPAD
+-
+-app_extension_api_only {
+-    QMAKE_CFLAGS              += $$QMAKE_CFLAGS_APPLICATION_EXTENSION
+-    QMAKE_CXXFLAGS            += $$QMAKE_CFLAGS_APPLICATION_EXTENSION
+-    QMAKE_CXXFLAGS_PRECOMPILE += $$QMAKE_CFLAGS_APPLICATION_EXTENSION
+-    QMAKE_LFLAGS              += $$QMAKE_CFLAGS_APPLICATION_EXTENSION
+-}
+-
+-macx-xcode {
+-    !isEmpty(QMAKE_XCODE_DEBUG_INFORMATION_FORMAT) {
+-        debug_information_format.name = DEBUG_INFORMATION_FORMAT
+-        debug_information_format.value = $$QMAKE_XCODE_DEBUG_INFORMATION_FORMAT
+-        debug_information_format.build = debug
+-        QMAKE_MAC_XCODE_SETTINGS += debug_information_format
+-    }
+-
+-    QMAKE_XCODE_ARCHS =
+-
+-    arch_device.name = "ARCHS[sdk=$${device.sdk}*]"
+-    arch_device.value = $$QMAKE_APPLE_DEVICE_ARCHS
+-    QMAKE_XCODE_ARCHS += $$QMAKE_APPLE_DEVICE_ARCHS
+-    QMAKE_MAC_XCODE_SETTINGS += arch_device
+-
+-    simulator {
+-        arch_simulator.name = "ARCHS[sdk=$${simulator.sdk}*]"
+-        arch_simulator.value = $$QMAKE_APPLE_SIMULATOR_ARCHS
+-        QMAKE_XCODE_ARCHS += $$QMAKE_APPLE_SIMULATOR_ARCHS
+-        QMAKE_MAC_XCODE_SETTINGS += arch_simulator
+-    }
+-
+-    only_active_arch.name = ONLY_ACTIVE_ARCH
+-    only_active_arch.value = YES
+-    only_active_arch.build = debug
+-    QMAKE_MAC_XCODE_SETTINGS += only_active_arch
+-} else {
+-    device|!simulator: VALID_DEVICE_ARCHS = $$QMAKE_APPLE_DEVICE_ARCHS
+-    simulator: VALID_SIMULATOR_ARCHS = $$QMAKE_APPLE_SIMULATOR_ARCHS
+-    VALID_ARCHS = $$VALID_DEVICE_ARCHS $$VALID_SIMULATOR_ARCHS
+-
+-    isEmpty(VALID_ARCHS): \
+-        error("QMAKE_APPLE_DEVICE_ARCHS or QMAKE_APPLE_SIMULATOR_ARCHS must contain at least one architecture")
+-
+-    single_arch: VALID_ARCHS = $$first(VALID_ARCHS)
+-
+-    ACTIVE_ARCHS = $(filter $(EXPORT_VALID_ARCHS), $(ARCHS))
+-    ARCH_ARGS = $(foreach arch, $(if $(EXPORT_ACTIVE_ARCHS), $(EXPORT_ACTIVE_ARCHS), $(EXPORT_VALID_ARCHS)), -arch $(arch))
+-
+-    QMAKE_EXTRA_VARIABLES += VALID_ARCHS ACTIVE_ARCHS ARCH_ARGS
+-
+-    arch_flags = $(EXPORT_ARCH_ARGS)
+-
+-    QMAKE_CFLAGS += $$arch_flags
+-    QMAKE_CXXFLAGS += $$arch_flags
+-    QMAKE_LFLAGS += $$arch_flags
+-
+-    QMAKE_PCH_ARCHS = $$VALID_ARCHS
+-
+-    macos: deployment_target = $$QMAKE_MACOSX_DEPLOYMENT_TARGET
+-    ios: deployment_target = $$QMAKE_IOS_DEPLOYMENT_TARGET
+-    tvos: deployment_target = $$QMAKE_TVOS_DEPLOYMENT_TARGET
+-    watchos: deployment_target = $$QMAKE_WATCHOS_DEPLOYMENT_TARGET
+-
+-    # If we're doing a simulator and device build, device and simulator
+-    # architectures use different paths and flags for the sysroot and
+-    # deployment target switch, so we must multiplex them across multiple
+-    # architectures using -Xarch. Otherwise we fall back to the simple path.
+-    # This is not strictly necessary, but results in cleaner command lines
+-    # and makes it easier for people to override EXPORT_VALID_ARCHS to limit
+-    # individual rules to a different set of architecture(s) from the overall
+-    # build (such as machtest in QtCore).
+-    simulator:device {
+-        QMAKE_XARCH_CFLAGS =
+-        QMAKE_XARCH_LFLAGS =
+-        QMAKE_EXTRA_VARIABLES += QMAKE_XARCH_CFLAGS QMAKE_XARCH_LFLAGS
+-
+-        for (arch, VALID_ARCHS) {
+-            contains(VALID_SIMULATOR_ARCHS, $$arch) {
+-                sdk = $$simulator.sdk
+-                version_identifier = $$simulator.deployment_identifier
+-            } else {
+-                sdk = $$device.sdk
+-                version_identifier = $$device.deployment_identifier
+-            }
+-
+-            version_min_flags = \
+-                -Xarch_$${arch} \
+-                -m$${version_identifier}-version-min=$$deployment_target
+-            QMAKE_XARCH_CFLAGS_$${arch} = $$version_min_flags \
+-                -Xarch_$${arch} \
+-                -isysroot$$xcodeSDKInfo(Path, $$sdk)
+-            QMAKE_XARCH_LFLAGS_$${arch} = $$version_min_flags \
+-                -Xarch_$${arch} \
+-                -Wl,-syslibroot,$$xcodeSDKInfo(Path, $$sdk)
+-
+-            QMAKE_XARCH_CFLAGS += $(EXPORT_QMAKE_XARCH_CFLAGS_$${arch})
+-            QMAKE_XARCH_LFLAGS += $(EXPORT_QMAKE_XARCH_LFLAGS_$${arch})
+-
+-            QMAKE_EXTRA_VARIABLES += \
+-                QMAKE_XARCH_CFLAGS_$${arch} \
+-                QMAKE_XARCH_LFLAGS_$${arch}
+-        }
+-
+-        QMAKE_CFLAGS += $(EXPORT_QMAKE_XARCH_CFLAGS)
+-        QMAKE_CXXFLAGS += $(EXPORT_QMAKE_XARCH_CFLAGS)
+-        QMAKE_LFLAGS += $(EXPORT_QMAKE_XARCH_LFLAGS)
+-    } else {
+-        simulator: \
+-            version_identifier = $$simulator.deployment_identifier
+-        else: \
+-            version_identifier = $$device.deployment_identifier
+-        version_min_flag = -m$${version_identifier}-version-min=$$deployment_target
+-        QMAKE_CFLAGS += -isysroot $$QMAKE_MAC_SDK_PATH $$version_min_flag
+-        QMAKE_CXXFLAGS += -isysroot $$QMAKE_MAC_SDK_PATH $$version_min_flag
+-        QMAKE_LFLAGS += -Wl,-syslibroot,$$QMAKE_MAC_SDK_PATH $$version_min_flag
+-    }
+-
+-    # Enable precompiled headers for multiple architectures
+-    QMAKE_CFLAGS_USE_PRECOMPILE =
+-    for (arch, VALID_ARCHS) {
+-        icc_pch_style: \
+-            use_flag = "-pch-use "
+-        else: \
+-            use_flag = -include
+-
+-        # Only use Xarch with multi-arch, as the option confuses ccache
+-        count(VALID_ARCHS, 1, greaterThan): \
+-            QMAKE_CFLAGS_USE_PRECOMPILE += \
+-                -Xarch_$${arch}
+-
+-        QMAKE_CFLAGS_USE_PRECOMPILE += \
+-            $${use_flag}${QMAKE_PCH_OUTPUT_$${arch}}
+-    }
+-    icc_pch_style {
+-        QMAKE_CXXFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE -include ${QMAKE_PCH_INPUT}
+-        QMAKE_CFLAGS_USE_PRECOMPILE =
+-    } else {
+-        QMAKE_CXXFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE
+-        QMAKE_OBJCFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE
+-        QMAKE_OBJCXXFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE
+-    }
+-
+-    QMAKE_PCH_OUTPUT_EXT = _${QMAKE_PCH_ARCH}$${QMAKE_PCH_OUTPUT_EXT}
+-}
+-
+-cache(QMAKE_XCODE_DEVELOPER_PATH, stash)
+-!isEmpty(QMAKE_XCODE_VERSION): \
+-    cache(QMAKE_XCODE_VERSION, stash)
+-
+-QMAKE_XCODE_LIBRARY_SUFFIX = $$qtPlatformTargetSuffix()
+diff --git a/mkspecs/features/mac/default_pre.prf b/mkspecs/features/mac/default_pre.prf
+index 44636f2288..3b01424e67 100644
+--- a/mkspecs/features/mac/default_pre.prf
++++ b/mkspecs/features/mac/default_pre.prf
+@@ -1,56 +1,2 @@
+ CONFIG = asset_catalogs rez $$CONFIG
+ load(default_pre)
+-
+-isEmpty(QMAKE_XCODE_DEVELOPER_PATH) {
+-    # Get path of Xcode's Developer directory
+-    QMAKE_XCODE_DEVELOPER_PATH = $$system("/usr/bin/xcode-select --print-path 2>/dev/null")
+-    isEmpty(QMAKE_XCODE_DEVELOPER_PATH): \
+-        error("Xcode path is not set. Please use xcode-select to choose Xcode installation path.")
+-
+-    # Make sure Xcode path is valid
+-    !exists($$QMAKE_XCODE_DEVELOPER_PATH): \
+-        error("Xcode is not installed in $${QMAKE_XCODE_DEVELOPER_PATH}. Please use xcode-select to choose Xcode installation path.")
+-}
+-
+-isEmpty(QMAKE_XCODEBUILD_PATH): \
+-    QMAKE_XCODEBUILD_PATH = $$system("/usr/bin/xcrun -find xcodebuild 2>/dev/null")
+-
+-!isEmpty(QMAKE_XCODEBUILD_PATH) {
+-    # Make sure Xcode is set up properly
+-    !system("/usr/bin/xcrun xcodebuild -license check 2>/dev/null"): \
+-        error("Xcode not set up properly. You need to confirm the license agreement by running 'sudo xcrun xcodebuild -license accept'.")
+-
+-    isEmpty(QMAKE_XCODE_VERSION) {
+-        # Extract Xcode version using xcodebuild
+-        xcode_version = $$system("/usr/bin/xcrun xcodebuild -version")
+-        QMAKE_XCODE_VERSION = $$member(xcode_version, 1)
+-        isEmpty(QMAKE_XCODE_VERSION): error("Could not resolve Xcode version.")
+-        unset(xcode_version)
+-    }
+-}
+-
+-isEmpty(QMAKE_TARGET_BUNDLE_PREFIX) {
+-    QMAKE_XCODE_PREFERENCES_FILE = $$(HOME)/Library/Preferences/com.apple.dt.Xcode.plist
+-    exists($$QMAKE_XCODE_PREFERENCES_FILE): \
+-        QMAKE_TARGET_BUNDLE_PREFIX = $$system("/usr/libexec/PlistBuddy -c 'print IDETemplateOptions:bundleIdentifierPrefix' $$QMAKE_XCODE_PREFERENCES_FILE 2>/dev/null")
+-
+-    !isEmpty(_QMAKE_CACHE_):!isEmpty(QMAKE_TARGET_BUNDLE_PREFIX): \
+-        cache(QMAKE_TARGET_BUNDLE_PREFIX)
+-}
+-
+-QMAKE_ASSET_CATALOGS_APP_ICON = AppIcon
+-
+-# Make the default debug info format for static debug builds
+-# DWARF instead of DWARF with dSYM. This cuts down build times
+-# for application debug builds significantly, as Xcode doesn't
+-# have to pull out all the DWARF info from the Qt static libs
+-# and put it into a dSYM file. We don't need that dSYM file in
+-# the first place, since the information is available in the
+-# object files inside the archives (static libraries).
+-macx-xcode:qtConfig(static): \
+-    QMAKE_XCODE_DEBUG_INFORMATION_FORMAT = dwarf
+-
+-# This variable is used by the xcode_dynamic_library_suffix
+-# feature, which allows Xcode to choose the Qt libraries to link to
+-# at build time, depending on the current Xcode SDK and configuration.
+-QMAKE_XCODE_LIBRARY_SUFFIX_SETTING = QT_LIBRARY_SUFFIX
+diff --git a/mkspecs/features/mac/sdk.prf b/mkspecs/features/mac/sdk.prf
+index 3f6dc076ca..e69de29bb2 100644
+--- a/mkspecs/features/mac/sdk.prf
++++ b/mkspecs/features/mac/sdk.prf
+@@ -1,58 +0,0 @@
+-
+-isEmpty(QMAKE_MAC_SDK): \
+-    error("QMAKE_MAC_SDK must be set when using CONFIG += sdk.")
+-
+-contains(QMAKE_MAC_SDK, .*/.*): \
+-    error("QMAKE_MAC_SDK can only contain short-form SDK names (eg. macosx, iphoneos)")
+-
+-defineReplace(xcodeSDKInfo) {
+-    info = $$1
+-    equals(info, "Path"): \
+-        info = --show-sdk-path
+-    equals(info, "PlatformPath"): \
+-        info = --show-sdk-platform-path
+-    equals(info, "SDKVersion"): \
+-        info = --show-sdk-version
+-    sdk = $$2
+-    isEmpty(sdk): \
+-        sdk = $$QMAKE_MAC_SDK
+-
+-    isEmpty(QMAKE_MAC_SDK.$${sdk}.$${info}) {
+-        QMAKE_MAC_SDK.$${sdk}.$${info} = $$system("/usr/bin/xcrun --sdk $$sdk $$info 2>/dev/null")
+-        # --show-sdk-platform-path won't work for Command Line Tools; this is fine
+-        # only used by the XCTest backend to testlib
+-        isEmpty(QMAKE_MAC_SDK.$${sdk}.$${info}):if(!isEmpty(QMAKE_XCODEBUILD_PATH)|!equals(info, "--show-sdk-platform-path")): \
+-            error("Could not resolve SDK $$info for \'$$sdk\'")
+-        cache(QMAKE_MAC_SDK.$${sdk}.$${info}, set stash, QMAKE_MAC_SDK.$${sdk}.$${info})
+-    }
+-
+-    return($$eval(QMAKE_MAC_SDK.$${sdk}.$${info}))
+-}
+-
+-QMAKE_MAC_SDK_PATH = $$xcodeSDKInfo(Path)
+-QMAKE_MAC_SDK_PLATFORM_PATH = $$xcodeSDKInfo(PlatformPath)
+-QMAKE_MAC_SDK_VERSION = $$xcodeSDKInfo(SDKVersion)
+-
+-sysrootified =
+-for(val, QMAKE_INCDIR_OPENGL): sysrootified += $${QMAKE_MAC_SDK_PATH}$$val
+-QMAKE_INCDIR_OPENGL = $$sysrootified
+-
+-QMAKESPEC_NAME = $$basename(QMAKESPEC)
+-
+-# Resolve SDK version of various tools
+-for(tool, $$list(QMAKE_CC QMAKE_CXX QMAKE_FIX_RPATH QMAKE_AR QMAKE_RANLIB QMAKE_LINK QMAKE_LINK_SHLIB QMAKE_ACTOOL)) {
+-    tool_variable = QMAKE_MAC_SDK.$${QMAKESPEC_NAME}.$${QMAKE_MAC_SDK}.$${tool}
+-    !isEmpty($$tool_variable) {
+-        $$tool = $$eval($$tool_variable)
+-        next()
+-    }
+-
+-    value = $$eval($$tool)
+-    isEmpty(value): next()
+-
+-    sysrooted = $$system("/usr/bin/xcrun -sdk $$QMAKE_MAC_SDK -find $$first(value) 2>/dev/null")
+-    isEmpty(sysrooted): next()
+-
+-    $$tool = $$sysrooted $$member(value, 1, -1)
+-    cache($$tool_variable, set stash, $$tool)
+-}
+diff --git a/mkspecs/features/qml_module.prf b/mkspecs/features/qml_module.prf
+index 4db0040dc5..65d6da1f4d 100644
+--- a/mkspecs/features/qml_module.prf
++++ b/mkspecs/features/qml_module.prf
+@@ -23,13 +23,8 @@ for(qmlf, AUX_QML_FILES): fq_aux_qml_files += $$absolute_path($$qmlf, $$_PRO_FIL
+ 
+ load(qt_build_paths)
+ 
+-qml1_target {
+-    DESTDIR = $$MODULE_BASE_OUTDIR/imports/$$TARGETPATH
+-    instbase = $$[QT_INSTALL_IMPORTS]
+-} else {
+-    DESTDIR = $$MODULE_BASE_OUTDIR/qml/$$TARGETPATH
+-    instbase = $$[QT_INSTALL_QML]
+-}
++DESTDIR = $$MODULE_BASE_OUTDIR/qml/$$TARGETPATH
++instbase = $$NIX_OUTPUT_QML
+ 
+ !qml1_target:static: CONFIG += builtin_resources
+ 
+diff --git a/mkspecs/features/qml_plugin.prf b/mkspecs/features/qml_plugin.prf
+index d49f4c49c1..097dcd7d39 100644
+--- a/mkspecs/features/qml_plugin.prf
++++ b/mkspecs/features/qml_plugin.prf
+@@ -48,13 +48,8 @@ exists($$QMLTYPEFILE): AUX_QML_FILES += $$QMLTYPEFILE
+ 
+ load(qt_build_paths)
+ 
+-qml1_target {
+-    DESTDIR = $$MODULE_BASE_OUTDIR/imports/$$TARGETPATH
+-    instbase = $$[QT_INSTALL_IMPORTS]
+-} else {
+-    DESTDIR = $$MODULE_BASE_OUTDIR/qml/$$TARGETPATH
+-    instbase = $$[QT_INSTALL_QML]
+-}
++DESTDIR = $$MODULE_BASE_OUTDIR/qml/$$TARGETPATH
++instbase = $$NIX_OUTPUT_QML
+ 
+ target.path = $$instbase/$$TARGETPATH
+ INSTALLS += target
+diff --git a/mkspecs/features/qt_app.prf b/mkspecs/features/qt_app.prf
+index 883f8ca215..81db8eb2d4 100644
+--- a/mkspecs/features/qt_app.prf
++++ b/mkspecs/features/qt_app.prf
+@@ -33,7 +33,7 @@ host_build:force_bootstrap {
+     target.path = $$[QT_HOST_BINS]
+ } else {
+     !build_pass:qtConfig(debug_and_release): CONFIG += release
+-    target.path = $$[QT_INSTALL_BINS]
++    target.path = $$NIX_OUTPUT_BIN/bin
+     CONFIG += relative_qt_rpath  # Qt's tools and apps should be relocatable
+ }
+ INSTALLS += target
+diff --git a/mkspecs/features/qt_build_paths.prf b/mkspecs/features/qt_build_paths.prf
+index 1848f00e90..2af93675c5 100644
+--- a/mkspecs/features/qt_build_paths.prf
++++ b/mkspecs/features/qt_build_paths.prf
+@@ -23,6 +23,6 @@ exists($$MODULE_BASE_INDIR/.git): \
+ !force_independent {
+     # If the module is not built independently, everything ends up in qtbase.
+     # This is the case in non-prefix builds, except for selected modules.
+-    MODULE_BASE_OUTDIR = $$[QT_HOST_PREFIX]
+-    MODULE_QMAKE_OUTDIR = $$[QT_HOST_PREFIX]
++    MODULE_BASE_OUTDIR = $$NIX_OUTPUT_OUT
++    MODULE_QMAKE_OUTDIR = $$NIX_OUTPUT_OUT
+ }
+diff --git a/mkspecs/features/qt_common.prf b/mkspecs/features/qt_common.prf
+index fb96d1b6a0..508ed17d30 100644
+--- a/mkspecs/features/qt_common.prf
++++ b/mkspecs/features/qt_common.prf
+@@ -32,8 +32,8 @@ contains(TEMPLATE, .*lib) {
+         qqt_libdir = \$\$\$\$[QT_HOST_LIBS]
+         qt_libdir = $$[QT_HOST_LIBS]
+     } else {
+-        qqt_libdir = \$\$\$\$[QT_INSTALL_LIBS]
+-        qt_libdir = $$[QT_INSTALL_LIBS]
++        qqt_libdir = \$\$\$\$NIX_OUTPUT_OUT/lib
++        qt_libdir = $$NIX_OUTPUT_OUT/lib
+     }
+     contains(QMAKE_DEFAULT_LIBDIRS, $$qt_libdir) {
+         lib_replace.match = "[^ ']*$$rplbase/lib"
+diff --git a/mkspecs/features/qt_docs.prf b/mkspecs/features/qt_docs.prf
+index 72dde61a40..f891a2baed 100644
+--- a/mkspecs/features/qt_docs.prf
++++ b/mkspecs/features/qt_docs.prf
+@@ -45,7 +45,7 @@ QMAKE_DOCS_OUTPUTDIR = $$QMAKE_DOCS_BASE_OUTDIR/$$QMAKE_DOCS_TARGETDIR
+ 
+ QDOC += -outputdir $$shell_quote($$QMAKE_DOCS_OUTPUTDIR)
+ !build_online_docs: \
+-    QDOC += -installdir $$shell_quote($$[QT_INSTALL_DOCS])
++    QDOC += -installdir $$shell_quote($$NIX_OUTPUT_DOC)
+ PREP_DOC_INDEXES =
+ DOC_INDEXES =
+ !isEmpty(QTREPOS) {
+@@ -64,8 +64,8 @@ DOC_INDEXES =
+         DOC_INDEXES += -indexdir $$shell_quote($$qrep/doc)
+ } else {
+     prepare_docs: \
+-        PREP_DOC_INDEXES += -indexdir $$shell_quote($$[QT_INSTALL_DOCS/get])
+-    DOC_INDEXES += -indexdir $$shell_quote($$[QT_INSTALL_DOCS/get])
++        PREP_DOC_INDEXES += -indexdir $$shell_quote($$NIX_OUTPUT_DOC)
++    DOC_INDEXES += -indexdir $$shell_quote($$NIX_OUTPUT_DOC)
+ }
+ 
+ qtattributionsscanner.target = qtattributionsscanner
+@@ -88,12 +88,12 @@ prepare_docs {
+     qch_docs.commands = $$QHELPGENERATOR $$shell_quote($$QMAKE_DOCS_OUTPUTDIR/$${QMAKE_DOCS_TARGET}.qhp) -o $$shell_quote($$QMAKE_DOCS_BASE_OUTDIR/$${QMAKE_DOCS_TARGET}.qch)
+ 
+     inst_html_docs.files = $$QMAKE_DOCS_OUTPUTDIR
+-    inst_html_docs.path = $$[QT_INSTALL_DOCS]
++    inst_html_docs.path = $$NIX_OUTPUT_DOC
+     inst_html_docs.CONFIG += no_check_exist directory no_default_install no_build
+     INSTALLS += inst_html_docs
+ 
+     inst_qch_docs.files = $$QMAKE_DOCS_BASE_OUTDIR/$${QMAKE_DOCS_TARGET}.qch
+-    inst_qch_docs.path = $$[QT_INSTALL_DOCS]
++    inst_qch_docs.path = $$NIX_OUTPUT_DOC
+     inst_qch_docs.CONFIG += no_check_exist no_default_install no_build
+     INSTALLS += inst_qch_docs
+ 
+diff --git a/mkspecs/features/qt_example_installs.prf b/mkspecs/features/qt_example_installs.prf
+index 668669e4cd..eb4840a0aa 100644
+--- a/mkspecs/features/qt_example_installs.prf
++++ b/mkspecs/features/qt_example_installs.prf
+@@ -82,7 +82,7 @@ sourcefiles += \
+     $$SOURCES $$HEADERS $$FORMS $$RESOURCES $$TRANSLATIONS \
+     $$DBUS_ADAPTORS $$DBUS_INTERFACES
+ addInstallFiles(sources.files, $$sourcefiles)
+-sources.path = $$[QT_INSTALL_EXAMPLES]/$$probase
++sources.path = $$NIX_OUTPUT_DEV/share/examples/$$probase
+ INSTALLS += sources
+ 
+ check_examples {
+diff --git a/mkspecs/features/qt_functions.prf b/mkspecs/features/qt_functions.prf
+index 1903e509c8..ae7b585989 100644
+--- a/mkspecs/features/qt_functions.prf
++++ b/mkspecs/features/qt_functions.prf
+@@ -69,7 +69,7 @@ defineTest(qtHaveModule) {
+ defineTest(qtPrepareTool) {
+     cmd = $$eval(QT_TOOL.$${2}.binary)
+     isEmpty(cmd) {
+-        cmd = $$[QT_HOST_BINS]/$$2
++        cmd = $$system("command -v $$2")
+         exists($${cmd}.pl) {
+             $${1}_EXE = $${cmd}.pl
+             cmd = perl -w $$system_path($${cmd}.pl)
+diff --git a/mkspecs/features/qt_installs.prf b/mkspecs/features/qt_installs.prf
+index 0d3dfb6b93..5f935b4424 100644
+--- a/mkspecs/features/qt_installs.prf
++++ b/mkspecs/features/qt_installs.prf
+@@ -12,16 +12,10 @@
+ #library
+ !qt_no_install_library {
+     win32 {
+-       host_build: \
+-           dlltarget.path = $$[QT_HOST_BINS]
+-       else: \
+-           dlltarget.path = $$[QT_INSTALL_BINS]
++        dlltarget.path = $$NIX_OUTPUT_BIN/bin
+        INSTALLS += dlltarget
+     }
+-    host_build: \
+-        target.path = $$[QT_HOST_LIBS]
+-    else: \
+-        target.path = $$[QT_INSTALL_LIBS]
++    target.path = $$NIX_OUTPUT_OUT/lib
+     !static: target.CONFIG = no_dll
+     INSTALLS += target
+ }
+@@ -29,33 +23,33 @@
+ #headers
+ qt_install_headers {
+     class_headers.files = $$SYNCQT.HEADER_CLASSES
+-    class_headers.path = $$[QT_INSTALL_HEADERS]/$$MODULE_INCNAME
++    class_headers.path = $$NIX_OUTPUT_DEV/include/$$MODULE_INCNAME
+     INSTALLS += class_headers
+ 
+     targ_headers.files = $$SYNCQT.HEADER_FILES
+-    targ_headers.path = $$[QT_INSTALL_HEADERS]/$$MODULE_INCNAME
++    targ_headers.path = $$NIX_OUTPUT_DEV/include/$$MODULE_INCNAME
+     INSTALLS += targ_headers
+ 
+     private_headers.files = $$SYNCQT.PRIVATE_HEADER_FILES $$SYNCQT.INJECTED_PRIVATE_HEADER_FILES
+-    private_headers.path = $$[QT_INSTALL_HEADERS]/$$MODULE_INCNAME/$$VERSION/$$MODULE_INCNAME/private
++    private_headers.path = $$NIX_OUTPUT_DEV/include/$$MODULE_INCNAME/$$VERSION/$$MODULE_INCNAME/private
+     INSTALLS += private_headers
+ 
+     qpa_headers.files = $$SYNCQT.QPA_HEADER_FILES
+-    qpa_headers.path = $$[QT_INSTALL_HEADERS]/$$MODULE_INCNAME/$$VERSION/$$MODULE_INCNAME/qpa
++    qpa_headers.path = $$NIX_OUTPUT_DEV/include/$$MODULE_INCNAME/$$VERSION/$$MODULE_INCNAME/qpa
+     INSTALLS += qpa_headers
+ }
+ 
+ #module
+ qt_install_module {
+     !isEmpty(MODULE_PRI) {
+-        pritarget.path = $$[QT_HOST_DATA]/mkspecs/modules
++        pritarget.path = $$NIX_OUTPUT_DEV/mkspecs/modules
+         pritarget.files = $$MODULE_PRI
+         INSTALLS += pritarget
+     } else: isEmpty(MODULE_PRIVATE_PRI) {
+         warning("Project $$basename(_PRO_FILE_) is a module, but has not defined MODULE_PRI, which is required for Qt to expose the module to other projects.")
+     }
+     !isEmpty(MODULE_PRIVATE_PRI) {
+-        privpritarget.path = $$[QT_HOST_DATA]/mkspecs/modules
++        privpritarget.path = $$NIX_OUTPUT_DEV/mkspecs/modules
+         privpritarget.files = $$MODULE_PRIVATE_PRI
+         INSTALLS += privpritarget
+     }
+diff --git a/mkspecs/features/qt_plugin.prf b/mkspecs/features/qt_plugin.prf
+index 62e1b69fde..abd63123f9 100644
+--- a/mkspecs/features/qt_plugin.prf
++++ b/mkspecs/features/qt_plugin.prf
+@@ -88,7 +88,7 @@ CONFIG(static, static|shared)|prefix_build {
+     }
+ }
+ 
+-target.path = $$[QT_INSTALL_PLUGINS]/$$PLUGIN_TYPE
++target.path = $$NIX_OUTPUT_PLUGIN/$$PLUGIN_TYPE
+ INSTALLS += target
+ 
+ TARGET = $$qt5LibraryTarget($$TARGET)
+diff --git a/src/corelib/Qt5CoreConfigExtras.cmake.in b/src/corelib/Qt5CoreConfigExtras.cmake.in
+index 545b9a3d1e..6ac0cdefe4 100644
+--- a/src/corelib/Qt5CoreConfigExtras.cmake.in
++++ b/src/corelib/Qt5CoreConfigExtras.cmake.in
+@@ -3,7 +3,7 @@ if (NOT TARGET Qt5::qmake)
+     add_executable(Qt5::qmake IMPORTED)
+ 
+ !!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5Core_install_prefix}/$${CMAKE_BIN_DIR}qmake$$CMAKE_BIN_SUFFIX\")
++    set(imported_location \"$$NIX_OUTPUT_DEV/$${CMAKE_BIN_DIR}qmake$$CMAKE_BIN_SUFFIX\")
+ !!ELSE
+     set(imported_location \"$${CMAKE_BIN_DIR}qmake$$CMAKE_BIN_SUFFIX\")
+ !!ENDIF
+@@ -18,7 +18,7 @@ if (NOT TARGET Qt5::moc)
+     add_executable(Qt5::moc IMPORTED)
+ 
+ !!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5Core_install_prefix}/$${CMAKE_BIN_DIR}moc$$CMAKE_BIN_SUFFIX\")
++    set(imported_location \"$$NIX_OUTPUT_DEV/$${CMAKE_BIN_DIR}moc$$CMAKE_BIN_SUFFIX\")
+ !!ELSE
+     set(imported_location \"$${CMAKE_BIN_DIR}moc$$CMAKE_BIN_SUFFIX\")
+ !!ENDIF
+@@ -35,7 +35,7 @@ if (NOT TARGET Qt5::rcc)
+     add_executable(Qt5::rcc IMPORTED)
+ 
+ !!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5Core_install_prefix}/$${CMAKE_BIN_DIR}rcc$$CMAKE_BIN_SUFFIX\")
++    set(imported_location \"$$NIX_OUTPUT_DEV/$${CMAKE_BIN_DIR}rcc$$CMAKE_BIN_SUFFIX\")
+ !!ELSE
+     set(imported_location \"$${CMAKE_BIN_DIR}rcc$$CMAKE_BIN_SUFFIX\")
+ !!ENDIF
+@@ -133,7 +133,7 @@ if (NOT TARGET Qt5::WinMain)
+ !!IF !isEmpty(CMAKE_RELEASE_TYPE)
+     set_property(TARGET Qt5::WinMain APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
+ !!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5Core_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_RELEASE}\")
++    set(imported_location \"$$NIX_OUTPUT_DEV/$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_RELEASE}\")
+ !!ELSE
+     set(imported_location \"$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_RELEASE}\")
+ !!ENDIF
+@@ -147,7 +147,7 @@ if (NOT TARGET Qt5::WinMain)
+     set_property(TARGET Qt5::WinMain APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
+ 
+ !!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5Core_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_DEBUG}\")
++    set(imported_location \"$$NIX_OUTPUT_DEV/$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_DEBUG}\")
+ !!ELSE
+     set(imported_location \"$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_DEBUG}\")
+ !!ENDIF
+diff --git a/src/corelib/Qt5CoreConfigExtrasMkspecDir.cmake.in b/src/corelib/Qt5CoreConfigExtrasMkspecDir.cmake.in
+index c357237d0e..6f0c75de3c 100644
+--- a/src/corelib/Qt5CoreConfigExtrasMkspecDir.cmake.in
++++ b/src/corelib/Qt5CoreConfigExtrasMkspecDir.cmake.in
+@@ -1,6 +1,6 @@
+ 
+ !!IF isEmpty(CMAKE_HOST_DATA_DIR_IS_ABSOLUTE)
+-set(_qt5_corelib_extra_includes \"${_qt5Core_install_prefix}/$${CMAKE_HOST_DATA_DIR}/mkspecs/$${CMAKE_MKSPEC}\")
++set(_qt5_corelib_extra_includes \"$$NIX_OUTPUT_DEV/$${CMAKE_HOST_DATA_DIR}/mkspecs/$${CMAKE_MKSPEC}\")
+ !!ELSE
+ set(_qt5_corelib_extra_includes \"$${CMAKE_HOST_DATA_DIR}mkspecs/$${CMAKE_MKSPEC}\")
+ !!ENDIF
+diff --git a/src/corelib/Qt5CoreConfigExtrasMkspecDirForInstall.cmake.in b/src/corelib/Qt5CoreConfigExtrasMkspecDirForInstall.cmake.in
+index 706304cf34..546420f6ad 100644
+--- a/src/corelib/Qt5CoreConfigExtrasMkspecDirForInstall.cmake.in
++++ b/src/corelib/Qt5CoreConfigExtrasMkspecDirForInstall.cmake.in
+@@ -1,6 +1,6 @@
+ 
+ !!IF isEmpty(CMAKE_INSTALL_DATA_DIR_IS_ABSOLUTE)
+-set(_qt5_corelib_extra_includes \"${_qt5Core_install_prefix}/$${CMAKE_INSTALL_DATA_DIR}/mkspecs/$${CMAKE_MKSPEC}\")
++set(_qt5_corelib_extra_includes \"$$NIX_OUTPUT_DEV/$${CMAKE_INSTALL_DATA_DIR}/mkspecs/$${CMAKE_MKSPEC}\")
+ !!ELSE
+ set(_qt5_corelib_extra_includes \"$${CMAKE_INSTALL_DATA_DIR}mkspecs/$${CMAKE_MKSPEC}\")
+ !!ENDIF
+diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
+index cba279c184..5ae3fd62e5 100644
+--- a/src/corelib/kernel/qcoreapplication.cpp
++++ b/src/corelib/kernel/qcoreapplication.cpp
+@@ -2533,6 +2533,15 @@ QStringList QCoreApplication::libraryPaths()
+         QStringList *app_libpaths = new QStringList;
+         coreappdata()->app_libpaths.reset(app_libpaths);
+ 
++        // Add library paths derived from PATH
++        const QStringList paths = QFile::decodeName(qgetenv("PATH")).split(':');
++        const QString plugindir = QStringLiteral("../" NIXPKGS_QT_PLUGIN_PREFIX);
++        for (const QString &path: paths) {
++            if (!path.isEmpty()) {
++                app_libpaths->append(QDir::cleanPath(path + QDir::separator() + plugindir));
++            }
++        }
++
+         const QByteArray libPathEnv = qgetenv("QT_PLUGIN_PATH");
+         if (!libPathEnv.isEmpty()) {
+             QStringList paths = QFile::decodeName(libPathEnv).split(QDir::listSeparator(), QString::SkipEmptyParts);
+diff --git a/src/corelib/tools/qtimezoneprivate_tz.cpp b/src/corelib/tools/qtimezoneprivate_tz.cpp
+index 4fdc2e36ac..d3ec222543 100644
+--- a/src/corelib/tools/qtimezoneprivate_tz.cpp
++++ b/src/corelib/tools/qtimezoneprivate_tz.cpp
+@@ -70,7 +70,11 @@ typedef QHash<QByteArray, QTzTimeZone> QTzTimeZoneHash;
+ // Parse zone.tab table, assume lists all installed zones, if not will need to read directories
+ static QTzTimeZoneHash loadTzTimeZones()
+ {
+-    QString path = QStringLiteral("/usr/share/zoneinfo/zone.tab");
++    // Try TZDIR first, in case we're running on NixOS.
++    QString path = QFile::decodeName(qgetenv("TZDIR")) + QStringLiteral("/zone.tab");
++    // Fallback to traditional paths in case we are not on NixOS.
++    if (!QFile::exists(path))
++        path = QStringLiteral("/usr/share/zoneinfo/zone.tab");
+     if (!QFile::exists(path))
+         path = QStringLiteral("/usr/lib/zoneinfo/zone.tab");
+ 
+@@ -645,12 +649,16 @@ void QTzTimeZonePrivate::init(const QByteArray &ianaId)
+         if (!tzif.open(QIODevice::ReadOnly))
+             return;
+     } else {
+-        // Open named tz, try modern path first, if fails try legacy path
+-        tzif.setFileName(QLatin1String("/usr/share/zoneinfo/") + QString::fromLocal8Bit(ianaId));
++        // Try TZDIR first, in case we're running on NixOS
++        tzif.setFileName(QFile::decodeName(qgetenv("TZDIR")) + QStringLiteral("/") + QString::fromLocal8Bit(ianaId));
+         if (!tzif.open(QIODevice::ReadOnly)) {
+-            tzif.setFileName(QLatin1String("/usr/lib/zoneinfo/") + QString::fromLocal8Bit(ianaId));
+-            if (!tzif.open(QIODevice::ReadOnly))
+-                return;
++            // Open named tz, try modern path first, if fails try legacy path
++            tzif.setFileName(QLatin1String("/usr/share/zoneinfo/") + QString::fromLocal8Bit(ianaId));
++            if (!tzif.open(QIODevice::ReadOnly)) {
++                tzif.setFileName(QLatin1String("/usr/lib/zoneinfo/") + QString::fromLocal8Bit(ianaId));
++                if (!tzif.open(QIODevice::ReadOnly))
++                    return;
++            }
+         }
+     }
+ 
+diff --git a/src/dbus/Qt5DBusConfigExtras.cmake.in b/src/dbus/Qt5DBusConfigExtras.cmake.in
+index 1d947159e2..b36865fc48 100644
+--- a/src/dbus/Qt5DBusConfigExtras.cmake.in
++++ b/src/dbus/Qt5DBusConfigExtras.cmake.in
+@@ -2,11 +2,7 @@
+ if (NOT TARGET Qt5::qdbuscpp2xml)
+     add_executable(Qt5::qdbuscpp2xml IMPORTED)
+ 
+-!!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5DBus_install_prefix}/$${CMAKE_BIN_DIR}qdbuscpp2xml$$CMAKE_BIN_SUFFIX\")
+-!!ELSE
+-    set(imported_location \"$${CMAKE_BIN_DIR}qdbuscpp2xml$$CMAKE_BIN_SUFFIX\")
+-!!ENDIF
++    set(imported_location \"$$NIX_OUTPUT_DEV/bin/qdbuscpp2xml$$CMAKE_BIN_SUFFIX\")
+     _qt5_DBus_check_file_exists(${imported_location})
+ 
+     set_target_properties(Qt5::qdbuscpp2xml PROPERTIES
+@@ -17,11 +13,7 @@ endif()
+ if (NOT TARGET Qt5::qdbusxml2cpp)
+     add_executable(Qt5::qdbusxml2cpp IMPORTED)
+ 
+-!!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5DBus_install_prefix}/$${CMAKE_BIN_DIR}qdbusxml2cpp$$CMAKE_BIN_SUFFIX\")
+-!!ELSE
+-    set(imported_location \"$${CMAKE_BIN_DIR}qdbusxml2cpp$$CMAKE_BIN_SUFFIX\")
+-!!ENDIF
++    set(imported_location \"$$NIX_OUTPUT_DEV/bin/qdbusxml2cpp$$CMAKE_BIN_SUFFIX\")
+     _qt5_DBus_check_file_exists(${imported_location})
+ 
+     set_target_properties(Qt5::qdbusxml2cpp PROPERTIES
+diff --git a/src/gui/Qt5GuiConfigExtras.cmake.in b/src/gui/Qt5GuiConfigExtras.cmake.in
+index 07869efd7d..fb4183bada 100644
+--- a/src/gui/Qt5GuiConfigExtras.cmake.in
++++ b/src/gui/Qt5GuiConfigExtras.cmake.in
+@@ -2,7 +2,7 @@
+ !!IF !isEmpty(CMAKE_ANGLE_EGL_DLL_RELEASE)
+ 
+ !!IF isEmpty(CMAKE_INCLUDE_DIR_IS_ABSOLUTE)
+-set(Qt5Gui_EGL_INCLUDE_DIRS \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$$CMAKE_INCLUDE_DIR/QtANGLE\")
++set(Qt5Gui_EGL_INCLUDE_DIRS \"$$NIX_OUTPUT_DEV/$$CMAKE_INCLUDE_DIR/QtANGLE\")
+ !!ELSE
+ set(Qt5Gui_EGL_INCLUDE_DIRS \"$$CMAKE_INCLUDE_DIR/QtANGLE\")
+ !!ENDIF
+@@ -17,13 +17,13 @@ macro(_populate_qt5gui_gl_target_properties TargetName Configuration LIB_LOCATIO
+     set_property(TARGET Qt5::${TargetName} APPEND PROPERTY IMPORTED_CONFIGURATIONS ${Configuration})
+ 
+ !!IF isEmpty(CMAKE_DLL_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5Gui_install_prefix}/$${CMAKE_DLL_DIR}${LIB_LOCATION}\")
++    set(imported_location \"$$NIX_OUTPUT_OUT/$${CMAKE_DLL_DIR}${LIB_LOCATION}\")
+ !!ELSE
+     set(imported_location \"$${CMAKE_DLL_DIR}${LIB_LOCATION}\")
+ !!ENDIF
+ 
+ !!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-    set(imported_implib \"${_qt5Gui_install_prefix}/$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\")
++    set(imported_implib \"$$NIX_OUTPUT_OUT/$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\")
+ !!ELSE
+     set(imported_implib \"$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\")
+ !!ENDIF
+diff --git a/src/network/kernel/qdnslookup_unix.cpp b/src/network/kernel/qdnslookup_unix.cpp
+index 1da00813ce..0bf877afcb 100644
+--- a/src/network/kernel/qdnslookup_unix.cpp
++++ b/src/network/kernel/qdnslookup_unix.cpp
+@@ -92,7 +92,7 @@ static bool resolveLibraryInternal()
+     if (!lib.load())
+ #endif
+     {
+-        lib.setFileName(QLatin1String("resolv"));
++        lib.setFileName(QLatin1String(NIXPKGS_LIBRESOLV));
+         if (!lib.load())
+             return false;
+     }
+diff --git a/src/network/kernel/qhostinfo_unix.cpp b/src/network/kernel/qhostinfo_unix.cpp
+index 9a24938284..74962b4ae2 100644
+--- a/src/network/kernel/qhostinfo_unix.cpp
++++ b/src/network/kernel/qhostinfo_unix.cpp
+@@ -102,7 +102,7 @@ static bool resolveLibraryInternal()
+     if (!lib.load())
+ #endif
+     {
+-        lib.setFileName(QLatin1String("resolv"));
++        lib.setFileName(QLatin1String(NIXPKGS_LIBRESOLV));
+         if (!lib.load())
+             return false;
+     }
+diff --git a/src/network/ssl/qsslcontext_openssl.cpp b/src/network/ssl/qsslcontext_openssl.cpp
+index c92d8fc3f8..6008063bcf 100644
+--- a/src/network/ssl/qsslcontext_openssl.cpp
++++ b/src/network/ssl/qsslcontext_openssl.cpp
+@@ -351,7 +351,7 @@ init_context:
+ 
+     const QVector<QSslEllipticCurve> qcurves = sslContext->sslConfiguration.ellipticCurves();
+     if (!qcurves.isEmpty()) {
+-#if OPENSSL_VERSION_NUMBER >= 0x10002000L && !defined(OPENSSL_NO_EC)
++#if OPENSSL_VERSION_NUMBER >= 0x10002000L && defined(SSL_CTRL_SET_CURVES) && !defined(OPENSSL_NO_EC)
+         // Set the curves to be used
+         if (q_SSLeay() >= 0x10002000L) {
+             // SSL_CTX_ctrl wants a non-const pointer as last argument,
+@@ -364,7 +364,7 @@ init_context:
+                 sslContext->errorCode = QSslError::UnspecifiedError;
+             }
+         } else
+-#endif // OPENSSL_VERSION_NUMBER >= 0x10002000L && !defined(OPENSSL_NO_EC)
++#endif // OPENSSL_VERSION_NUMBER >= 0x10002000L && defined(SSL_CTRL_SET_CURVES) && !defined(OPENSSL_NO_EC)
+         {
+             // specific curves requested, but not possible to set -> error
+             sslContext->errorStr = msgErrorSettingEllipticCurves(QSslSocket::tr("OpenSSL version too old, need at least v1.0.2"));
+diff --git a/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp b/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp
+index b5a0a5bbeb..6c20305f4d 100644
+--- a/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp
++++ b/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp
+@@ -265,12 +265,9 @@ void TableGenerator::initPossibleLocations()
+     m_possibleLocations.reserve(7);
+     if (qEnvironmentVariableIsSet("QTCOMPOSE"))
+         m_possibleLocations.append(QString::fromLocal8Bit(qgetenv("QTCOMPOSE")));
+-    m_possibleLocations.append(QStringLiteral("/usr/share/X11/locale"));
+-    m_possibleLocations.append(QStringLiteral("/usr/local/share/X11/locale"));
+-    m_possibleLocations.append(QStringLiteral("/usr/lib/X11/locale"));
+-    m_possibleLocations.append(QStringLiteral("/usr/local/lib/X11/locale"));
+     m_possibleLocations.append(QStringLiteral(X11_PREFIX "/share/X11/locale"));
+     m_possibleLocations.append(QStringLiteral(X11_PREFIX "/lib/X11/locale"));
++    m_possibleLocations.append(QLatin1String(NIXPKGS_QTCOMPOSE));
+ }
+ 
+ QString TableGenerator::findComposeFile()
+diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp
+index e2e573f0e1..1c8289f81e 100644
+--- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp
++++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp
+@@ -580,7 +580,14 @@ QFunctionPointer QGLXContext::getProcAddress(const char *procName)
+ #if QT_CONFIG(library)
+                 extern const QString qt_gl_library_name();
+ //                QLibrary lib(qt_gl_library_name());
++                // Check system library paths first
+                 QLibrary lib(QLatin1String("GL"));
++#ifdef NIXPKGS_MESA_GL
++                if (!lib.load()) {
++                    // Fallback to Mesa driver
++                    lib.setFileName(QLatin1String(NIXPKGS_MESA_GL));
++                }
++#endif // NIXPKGS_MESA_GL
+                 glXGetProcAddressARB = (qt_glXGetProcAddressARB) lib.resolve("glXGetProcAddressARB");
+ #endif
+             }
+diff --git a/src/plugins/platforms/xcb/qxcbcursor.cpp b/src/plugins/platforms/xcb/qxcbcursor.cpp
+index 7c62c2e2b3..fefa40e0f6 100644
+--- a/src/plugins/platforms/xcb/qxcbcursor.cpp
++++ b/src/plugins/platforms/xcb/qxcbcursor.cpp
+@@ -311,10 +311,10 @@ QXcbCursor::QXcbCursor(QXcbConnection *conn, QXcbScreen *screen)
+ #if QT_CONFIG(xcb_xlib) && QT_CONFIG(library)
+     static bool function_ptrs_not_initialized = true;
+     if (function_ptrs_not_initialized) {
+-        QLibrary xcursorLib(QLatin1String("Xcursor"), 1);
++        QLibrary xcursorLib(QLatin1String(NIXPKGS_LIBXCURSOR), 1);
+         bool xcursorFound = xcursorLib.load();
+         if (!xcursorFound) { // try without the version number
+-            xcursorLib.setFileName(QLatin1String("Xcursor"));
++            xcursorLib.setFileName(QLatin1String(NIXPKGS_LIBXCURSOR));
+             xcursorFound = xcursorLib.load();
+         }
+         if (xcursorFound) {
+diff --git a/src/plugins/platformthemes/gtk3/main.cpp b/src/plugins/platformthemes/gtk3/main.cpp
+index c4cd66c33b..b6f2691587 100644
+--- a/src/plugins/platformthemes/gtk3/main.cpp
++++ b/src/plugins/platformthemes/gtk3/main.cpp
+@@ -39,6 +39,7 @@
+ 
+ #include <qpa/qplatformthemeplugin.h>
+ #include "qgtk3theme.h"
++#include <QFile>
+ 
+ QT_BEGIN_NAMESPACE
+ 
+@@ -54,8 +55,22 @@ public:
+ QPlatformTheme *QGtk3ThemePlugin::create(const QString &key, const QStringList &params)
+ {
+     Q_UNUSED(params);
+-    if (!key.compare(QLatin1String(QGtk3Theme::name), Qt::CaseInsensitive))
++    if (!key.compare(QLatin1String(QGtk3Theme::name), Qt::CaseInsensitive)) {
++
++#ifdef NIXPKGS_QGTK3_XDG_DATA_DIRS
++        QStringList XDG_DATA_DIRS = QFile::decodeName(qgetenv("XDG_DATA_DIRS")).split(':');
++        XDG_DATA_DIRS << QLatin1String(NIXPKGS_QGTK3_XDG_DATA_DIRS);
++        qputenv("XDG_DATA_DIRS", QFile::encodeName(XDG_DATA_DIRS.join(':')));
++#endif
++
++#ifdef NIXPKGS_QGTK3_GIO_EXTRA_MODULES
++        QStringList GIO_EXTRA_MODULES = QFile::decodeName(qgetenv("GIO_EXTRA_MODULES")).split(':');
++        GIO_EXTRA_MODULES << QLatin1String(NIXPKGS_QGTK3_GIO_EXTRA_MODULES);
++        qputenv("GIO_EXTRA_MODULES", QFile::encodeName(GIO_EXTRA_MODULES.join(':')));
++#endif
++
+         return new QGtk3Theme;
++    }
+ 
+     return 0;
+ }
+diff --git a/src/testlib/qtestassert.h b/src/testlib/qtestassert.h
+index 6498ea84ef..d821ced7fc 100644
+--- a/src/testlib/qtestassert.h
++++ b/src/testlib/qtestassert.h
+@@ -44,10 +44,13 @@
+ 
+ QT_BEGIN_NAMESPACE
+ 
+-
++#if defined(QT_NO_DEBUG) && !defined(QT_FORCE_ASSERTS)
++#define QTEST_ASSERT(cond) do { } while ((false) && (cond))
++#define QTEST_ASSERT_X(cond, where, what) do { } while ((false) && (cond))
++#else
+ #define QTEST_ASSERT(cond) do { if (!(cond)) qt_assert(#cond,__FILE__,__LINE__); } while (false)
+-
+ #define QTEST_ASSERT_X(cond, where, what) do { if (!(cond)) qt_assert_x(where, what,__FILE__,__LINE__); } while (false)
++#endif
+ 
+ QT_END_NAMESPACE
+ 
+diff --git a/src/widgets/Qt5WidgetsConfigExtras.cmake.in b/src/widgets/Qt5WidgetsConfigExtras.cmake.in
+index 99d87e2e46..a4eab2aa72 100644
+--- a/src/widgets/Qt5WidgetsConfigExtras.cmake.in
++++ b/src/widgets/Qt5WidgetsConfigExtras.cmake.in
+@@ -3,7 +3,7 @@ if (NOT TARGET Qt5::uic)
+     add_executable(Qt5::uic IMPORTED)
+ 
+ !!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5Widgets_install_prefix}/$${CMAKE_BIN_DIR}uic$$CMAKE_BIN_SUFFIX\")
++    set(imported_location \"$$NIX_OUTPUT_DEV/$${CMAKE_BIN_DIR}uic$$CMAKE_BIN_SUFFIX\")
+ !!ELSE
+     set(imported_location \"$${CMAKE_BIN_DIR}uic$$CMAKE_BIN_SUFFIX\")
+ !!ENDIF
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.9/qtdeclarative.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.9/qtdeclarative.patch
new file mode 100644
index 000000000000..bb1bbbeb05e0
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.9/qtdeclarative.patch
@@ -0,0 +1,33 @@
+diff --git a/src/qml/qml/qqmlimport.cpp b/src/qml/qml/qqmlimport.cpp
+index ee5b38717..bbccef8c4 100644
+--- a/src/qml/qml/qqmlimport.cpp
++++ b/src/qml/qml/qqmlimport.cpp
+@@ -1678,6 +1678,15 @@ QQmlImportDatabase::QQmlImportDatabase(QQmlEngine *e)
+     QString installImportsPath =  QLibraryInfo::location(QLibraryInfo::Qml2ImportsPath);
+     addImportPath(installImportsPath);
+ 
++    // Add import paths derived from PATH
++    const QStringList paths = QFile::decodeName(qgetenv("PATH")).split(':');
++    const QString qmldir = QStringLiteral("../" NIXPKGS_QML2_IMPORT_PREFIX);
++    for (const QString &path: paths) {
++        if (!path.isEmpty()) {
++            addImportPath(QDir::cleanPath(path + QDir::separator() + qmldir));
++        }
++    }
++
+     // env import paths
+     if (Q_UNLIKELY(!qEnvironmentVariableIsEmpty("QML2_IMPORT_PATH"))) {
+         const QByteArray envImportPath = qgetenv("QML2_IMPORT_PATH");
+diff --git a/tools/qmlcachegen/qmlcache.prf b/tools/qmlcachegen/qmlcache.prf
+index 330da358b..cdf570205 100644
+--- a/tools/qmlcachegen/qmlcache.prf
++++ b/tools/qmlcachegen/qmlcache.prf
+@@ -44,7 +44,7 @@ defineReplace(qmlCacheOutputFileName) {
+ }
+ 
+ qmlcacheinst.base = $$QMLCACHE_DESTDIR
+-qmlcacheinst.path = $$[QT_INSTALL_QML]/$$TARGETPATH
++qmlcacheinst.path = $$NIX_OUTPUT_QML/$$TARGETPATH
+ qmlcacheinst.CONFIG = no_check_exist
+ 
+ qmlcachegen.input = CACHEGEN_FILES
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.9/qtscript.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.9/qtscript.patch
new file mode 100644
index 000000000000..5508dec1280e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.9/qtscript.patch
@@ -0,0 +1,13 @@
+diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Threading.h b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Threading.h
+index 1f6d25e..087c3fb 100644
+--- a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Threading.h
++++ b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Threading.h
+@@ -81,7 +81,7 @@
+ #include <pthread.h>
+ #elif PLATFORM(GTK)
+ #include <wtf/gtk/GOwnPtr.h>
+-typedef struct _GMutex GMutex;
++typedef union _GMutex GMutex;
+ typedef struct _GCond GCond;
+ #endif
+ 
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.9/qtserialport.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.9/qtserialport.patch
new file mode 100644
index 000000000000..f25524e80bcf
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.9/qtserialport.patch
@@ -0,0 +1,22 @@
+diff --git a/src/serialport/qtudev_p.h b/src/serialport/qtudev_p.h
+index af2dab2..8e17f64 100644
+--- a/src/serialport/qtudev_p.h
++++ b/src/serialport/qtudev_p.h
+@@ -111,9 +111,17 @@ inline QFunctionPointer resolveSymbol(QLibrary *udevLibrary, const char *symbolN
+ inline bool resolveSymbols(QLibrary *udevLibrary)
+ {
+     if (!udevLibrary->isLoaded()) {
++#ifdef NIXPKGS_LIBUDEV
++        udevLibrary->setFileNameAndVersion(QLatin1String(NIXPKGS_LIBUDEV), 1);
++#else
+         udevLibrary->setFileNameAndVersion(QStringLiteral("udev"), 1);
++#endif
+         if (!udevLibrary->load()) {
++#ifdef NIXPKGS_LIBUDEV
++            udevLibrary->setFileNameAndVersion(QLatin1String(NIXPKGS_LIBUDEV), 0);
++#else
+             udevLibrary->setFileNameAndVersion(QStringLiteral("udev"), 0);
++#endif
+             if (!udevLibrary->load()) {
+                 qWarning("Failed to load the library: %s, supported version(s): %i and %i", qPrintable(udevLibrary->fileName()), 1, 0);
+                 return false;
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.9/qttools.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.9/qttools.patch
new file mode 100644
index 000000000000..fbba439ef7a5
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.9/qttools.patch
@@ -0,0 +1,71 @@
+diff --git a/src/assistant/help/Qt5HelpConfigExtras.cmake.in b/src/assistant/help/Qt5HelpConfigExtras.cmake.in
+index 3b97923a..63336bd5 100644
+--- a/src/assistant/help/Qt5HelpConfigExtras.cmake.in
++++ b/src/assistant/help/Qt5HelpConfigExtras.cmake.in
+@@ -2,11 +2,10 @@
+ if (NOT TARGET Qt5::qcollectiongenerator)
+     add_executable(Qt5::qcollectiongenerator IMPORTED)
+ 
+-!!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5Help_install_prefix}/$${CMAKE_BIN_DIR}qcollectiongenerator$$CMAKE_BIN_SUFFIX\")
+-!!ELSE
+     set(imported_location \"$${CMAKE_BIN_DIR}qcollectiongenerator$$CMAKE_BIN_SUFFIX\")
+-!!ENDIF
++    if(NOT EXISTS \"${imported_location}\")
++        set(imported_location \"$${CMAKE_BIN_DIR}qcollectiongenerator$$CMAKE_BIN_SUFFIX\")
++    endif()
+     _qt5_Help_check_file_exists(${imported_location})
+ 
+     set_target_properties(Qt5::qcollectiongenerator PROPERTIES
+@@ -17,11 +16,7 @@ endif()
+ if (NOT TARGET Qt5::qhelpgenerator)
+     add_executable(Qt5::qhelpgenerator IMPORTED)
+ 
+-!!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5Help_install_prefix}/$${CMAKE_BIN_DIR}qhelpgenerator$$CMAKE_BIN_SUFFIX\")
+-!!ELSE
+     set(imported_location \"$${CMAKE_BIN_DIR}qhelpgenerator$$CMAKE_BIN_SUFFIX\")
+-!!ENDIF
+     _qt5_Help_check_file_exists(${imported_location})
+ 
+     set_target_properties(Qt5::qhelpgenerator PROPERTIES
+diff --git a/src/linguist/Qt5LinguistToolsConfig.cmake.in b/src/linguist/Qt5LinguistToolsConfig.cmake.in
+index 4318b16f..d60db4ff 100644
+--- a/src/linguist/Qt5LinguistToolsConfig.cmake.in
++++ b/src/linguist/Qt5LinguistToolsConfig.cmake.in
+@@ -44,11 +44,7 @@ endmacro()
+ if (NOT TARGET Qt5::lrelease)
+     add_executable(Qt5::lrelease IMPORTED)
+ 
+-!!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5_linguisttools_install_prefix}/$${CMAKE_BIN_DIR}lrelease$$CMAKE_BIN_SUFFIX\")
+-!!ELSE
+     set(imported_location \"$${CMAKE_BIN_DIR}lrelease$$CMAKE_BIN_SUFFIX\")
+-!!ENDIF
+     _qt5_LinguistTools_check_file_exists(${imported_location})
+ 
+     set_target_properties(Qt5::lrelease PROPERTIES
+@@ -59,11 +55,7 @@ endif()
+ if (NOT TARGET Qt5::lupdate)
+     add_executable(Qt5::lupdate IMPORTED)
+ 
+-!!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5_linguisttools_install_prefix}/$${CMAKE_BIN_DIR}lupdate$$CMAKE_BIN_SUFFIX\")
+-!!ELSE
+     set(imported_location \"$${CMAKE_BIN_DIR}lupdate$$CMAKE_BIN_SUFFIX\")
+-!!ENDIF
+     _qt5_LinguistTools_check_file_exists(${imported_location})
+ 
+     set_target_properties(Qt5::lupdate PROPERTIES
+@@ -74,11 +66,7 @@ endif()
+ if (NOT TARGET Qt5::lconvert)
+     add_executable(Qt5::lconvert IMPORTED)
+ 
+-!!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5_linguisttools_install_prefix}/$${CMAKE_BIN_DIR}lconvert$$CMAKE_BIN_SUFFIX\")
+-!!ELSE
+     set(imported_location \"$${CMAKE_BIN_DIR}lconvert$$CMAKE_BIN_SUFFIX\")
+-!!ENDIF
+     _qt5_LinguistTools_check_file_exists(${imported_location})
+ 
+     set_target_properties(Qt5::lconvert PROPERTIES
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.9/qtwebengine-clang-fix.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.9/qtwebengine-clang-fix.patch
new file mode 100644
index 000000000000..cf082cddd11a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.9/qtwebengine-clang-fix.patch
@@ -0,0 +1,38 @@
+Fix a following build error:
+
+In file included from ../../3rdparty/chromium/device/bluetooth/bluetooth_remote_gatt_characteristic_mac.mm:7:
+In file included from ../../3rdparty/chromium/base/bind.h:8:
+../../3rdparty/chromium/base/bind_internal.h:214:31: error: cannot initialize a parameter of type 'NSError *' with an lvalue of type 'const long'
+    return (receiver.*method)(std::forward<RunArgs>(args)...);
+                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~
+../../3rdparty/chromium/base/bind_internal.h:285:20: note: in instantiation of function template specialization 'base::internal::FunctorTraits<void (device::BluetoothRemoteGat
+tCharacteristicMac::*)(NSError *), void>::Invoke<device::BluetoothRemoteGattCharacteristicMac *, const long &>' requested here
+    return Traits::Invoke(std::forward<Functor>(functor),
+                   ^
+../../3rdparty/chromium/base/bind_internal.h:361:43: note: in instantiation of function template specialization 'base::internal::InvokeHelper<false, void>::MakeItSo<void (devi
+ce::BluetoothRemoteGattCharacteristicMac::*const &)(NSError *), device::BluetoothRemoteGattCharacteristicMac *, const long &>' requested here
+    return InvokeHelper<is_weak_call, R>::MakeItSo(
+                                          ^
+../../3rdparty/chromium/base/bind_internal.h:339:12: note: in instantiation of function template specialization 'base::internal::Invoker<base::internal::BindState<void (device::BluetoothRemoteGattCharacteristicMac::*)(NSError *), base::internal::UnretainedWrapper<device::BluetoothRemoteGattCharacteristicMac>, long>, void ()>::RunImpl<void (device::BluetoothRemoteGattCharacteristicMac::*const &)(NSError *), const std::__1::tuple<base::internal::UnretainedWrapper<device::BluetoothRemoteGattCharacteristicMac>, long> &, 0, 1>' requested here
+    return RunImpl(storage->functor_,
+           ^
+../../3rdparty/chromium/base/bind.h:62:45: note: in instantiation of member function 'base::internal::Invoker<base::internal::BindState<void (device::BluetoothRemoteGattCharacteristicMac::*)(NSError *), base::internal::UnretainedWrapper<device::BluetoothRemoteGattCharacteristicMac>, long>, void ()>::Run' requested here
+  PolymorphicInvoke invoke_func = &Invoker::Run;
+                                            ^
+../../3rdparty/chromium/base/bind.h:77:10: note: in instantiation of function template specialization 'base::BindRepeating<void (device::BluetoothRemoteGattCharacteristicMac::*)(NSError *), base::internal::UnretainedWrapper<device::BluetoothRemoteGattCharacteristicMac>, long>' requested here
+  return BindRepeating(std::forward<Functor>(functor),
+         ^
+../../3rdparty/chromium/device/bluetooth/bluetooth_remote_gatt_characteristic_mac.mm:241:15: note: in instantiation of function template specialization 'base::Bind<void (device::BluetoothRemoteGattCharacteristicMac::*)(NSError *), base::internal::UnretainedWrapper<device::BluetoothRemoteGattCharacteristicMac>, long>' requested here
+        base::Bind(&BluetoothRemoteGattCharacteristicMac::DidWriteValue,
+
+--- a/src/3rdparty/chromium/device/bluetooth/bluetooth_remote_gatt_characteristic_mac.mm
++++ b/src/3rdparty/chromium/device/bluetooth/bluetooth_remote_gatt_characteristic_mac.mm
+@@ -239,7 +239,7 @@ void BluetoothRemoteGattCharacteristicMac::WriteRemoteCharacteristic(
+     base::ThreadTaskRunnerHandle::Get()->PostTask(
+         FROM_HERE,
+         base::Bind(&BluetoothRemoteGattCharacteristicMac::DidWriteValue,
+-                   base::Unretained(this), nil));
++                   base::Unretained(this), nullptr));
+   }
+ }
+ 
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.9/qtwebengine-darwin-no-platform-check.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.9/qtwebengine-darwin-no-platform-check.patch
new file mode 100644
index 000000000000..7156c41c5ec1
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.9/qtwebengine-darwin-no-platform-check.patch
@@ -0,0 +1,50 @@
+diff --git a/mkspecs/features/configure.prf b/mkspecs/features/configure.prf
+--- a/mkspecs/features/configure.prf
++++ b/mkspecs/features/configure.prf
+@@ -194,9 +194,6 @@ defineTest(runConfigure) {
+         } else {
+             log("Native Spellchecker .............. Not enabled         (Default, enable with WEBENGINE_CONFIG+=use_native_spellchecker)$${EOL}")
+         }
+-        !isMinOSXSDKVersion(10, 10, 3) {
+-            log("  Force Touch API usage .............. Not enabled         (Because the OS X SDK version to be used \"$${WEBENGINE_OSX_SDK_PRODUCT_VERSION}\" is lower than the required \"10.10.3\")$${EOL}")
+-        }
+     }
+ }
+ 
+diff --git a/mkspecs/features/functions.prf b/mkspecs/features/functions.prf
+--- a/mkspecs/features/functions.prf
++++ b/mkspecs/features/functions.prf
+@@ -38,10 +38,6 @@ defineTest(isPlatformSupported) {
+       return(false)
+     }
+   } else:osx {
+-    !isMinXcodeVersion(5, 1) {
+-      skipBuild("Using XCode version $$QMAKE_XCODE_VERSION, but at least version 5.1 is required to build Qt WebEngine.")
+-      return(false)
+-    }
+     !clang|intel_icc {
+         skipBuild("Qt WebEngine on macOS requires Clang.")
+         return(false)
+@@ -52,10 +48,6 @@ defineTest(isPlatformSupported) {
+       skipBuild("Qt WebEngine requires OS X version 10.10 or newer.")
+       return(false)
+     }
+-    !isMinOSXSDKVersion(10, 10): {
+-      skipBuild("Qt WebEngine requires an OS X SDK version of 10.10 or newer. Current version is $${WEBENGINE_OSX_SDK_PRODUCT_VERSION}.")
+-      return(false)
+-    }
+   } else {
+     skipBuild("Unknown platform. Qt WebEngine only supports Linux, Windows, and OS X.")
+     return(false)
+diff --git a/src/core/config/mac_osx.pri b/src/core/config/mac_osx.pri
+--- a/src/core/config/mac_osx.pri
++++ b/src/core/config/mac_osx.pri
+@@ -5,8 +5,6 @@ load(functions)
+ # otherwise query for it.
+ QMAKE_MAC_SDK_VERSION = $$eval(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.SDKVersion)
+ isEmpty(QMAKE_MAC_SDK_VERSION) {
+-     QMAKE_MAC_SDK_VERSION = $$system("/usr/bin/xcodebuild -sdk $${QMAKE_MAC_SDK} -version SDKVersion 2>/dev/null")
+-     isEmpty(QMAKE_MAC_SDK_VERSION): error("Could not resolve SDK version for \'$${QMAKE_MAC_SDK}\'")
+ }
+ 
+ QMAKE_CLANG_DIR = "/usr"
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.9/qtwebengine-no-build-skip.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.9/qtwebengine-no-build-skip.patch
new file mode 100644
index 000000000000..f332d5e1bb2b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.9/qtwebengine-no-build-skip.patch
@@ -0,0 +1,12 @@
+diff --git a/qtwebengine.pro b/qtwebengine.pro
+--- a/qtwebengine.pro
++++ b/qtwebengine.pro
+@@ -5,7 +5,7 @@ runConfigure()
+ 
+ !isEmpty(skipBuildReason) {
+     SUBDIRS =
+-    log($${skipBuildReason}$${EOL})
++    error($${skipBuildReason}$${EOL})
+     log(QtWebEngine will not be built.$${EOL})
+ }
+ 
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.9/qtwebkit.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.9/qtwebkit.patch
new file mode 100644
index 000000000000..718bda361943
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.9/qtwebkit.patch
@@ -0,0 +1,64 @@
+diff --git a/Source/WebCore/plugins/qt/PluginPackageQt.cpp b/Source/WebCore/plugins/qt/PluginPackageQt.cpp
+index a923d49aa..46772a4bb 100644
+--- a/Source/WebCore/plugins/qt/PluginPackageQt.cpp
++++ b/Source/WebCore/plugins/qt/PluginPackageQt.cpp
+@@ -136,7 +136,11 @@ static void initializeGtk(QLibrary* module = 0)
+         }
+     }
+ 
++#ifdef NIXPKGS_LIBGTK2
++    QLibrary library(QLatin1String(NIXPKGS_LIBGTK2), 0);
++#else
+     QLibrary library(QLatin1String("libgtk-x11-2.0"), 0);
++#endif
+     if (library.load()) {
+         typedef void *(*gtk_init_check_ptr)(int*, char***);
+         gtk_init_check_ptr gtkInitCheck = (gtk_init_check_ptr)library.resolve("gtk_init_check");
+diff --git a/Source/WebCore/plugins/qt/PluginViewQt.cpp b/Source/WebCore/plugins/qt/PluginViewQt.cpp
+index de06a2fea..86fe39ef1 100644
+--- a/Source/WebCore/plugins/qt/PluginViewQt.cpp
++++ b/Source/WebCore/plugins/qt/PluginViewQt.cpp
+@@ -697,7 +697,11 @@ static Display *getPluginDisplay()
+     // support gdk based plugins (like flash) that use a different X connection.
+     // The code below has the same effect as this one:
+     // Display *gdkDisplay = gdk_x11_display_get_xdisplay(gdk_display_get_default());
++#ifdef NIXPKGS_LIBGDK2
++    QLibrary library(QLatin1String(NIXPKGS_LIBGDK2), 0);
++#else
+     QLibrary library(QLatin1String("libgdk-x11-2.0"), 0);
++#endif
+     if (!library.load())
+         return 0;
+ 
+diff --git a/Source/WebKit2/PluginProcess/qt/PluginProcessMainQt.cpp b/Source/WebKit2/PluginProcess/qt/PluginProcessMainQt.cpp
+index 8de65216b..38f5c05e5 100644
+--- a/Source/WebKit2/PluginProcess/qt/PluginProcessMainQt.cpp
++++ b/Source/WebKit2/PluginProcess/qt/PluginProcessMainQt.cpp
+@@ -53,7 +53,11 @@ static void messageHandler(QtMsgType type, const QMessageLogContext&, const QStr
+ 
+ static bool initializeGtk()
+ {
++#ifdef NIXPKGS_LIBGTK2
++    QLibrary gtkLibrary(QLatin1String(NIXPKGS_LIBGTK2), 0);
++#else
+     QLibrary gtkLibrary(QLatin1String("libgtk-x11-2.0"), 0);
++#endif
+     if (!gtkLibrary.load())
+         return false;
+     typedef void* (*gtk_init_ptr)(void*, void*);
+diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp b/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp
+index d734ff684..0f6ff63d1 100644
+--- a/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp
++++ b/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp
+@@ -64,7 +64,11 @@ static Display* getPluginDisplay()
+     // The code below has the same effect as this one:
+     // Display *gdkDisplay = gdk_x11_display_get_xdisplay(gdk_display_get_default());
+ 
++#ifdef NIXPKGS_LIBGDK2
++    QLibrary library(QLatin1String(NIXPKGS_LIBGDK2), 0);
++#else
+     QLibrary library(QLatin1String("libgdk-x11-2.0"), 0);
++#endif
+     if (!library.load())
+         return 0;
+ 
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.9/srcs.nix b/nixpkgs/pkgs/development/libraries/qt-5/5.9/srcs.nix
new file mode 100644
index 000000000000..09b6293daebc
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.9/srcs.nix
@@ -0,0 +1,333 @@
+# DO NOT EDIT! This file is generated automatically by fetch-kde-qt.sh
+{ fetchurl, mirror }:
+
+{
+  qt3d = {
+    version = "5.9.7";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.9/5.9.7/submodules/qt3d-opensource-src-5.9.7.tar.xz";
+      sha256 = "0skdp72jlfy97cw9lpa3l2ivs6f5x9w53978sf2xbkl9k1ai268l";
+      name = "qt3d-opensource-src-5.9.7.tar.xz";
+    };
+  };
+  qtactiveqt = {
+    version = "5.9.7";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.9/5.9.7/submodules/qtactiveqt-opensource-src-5.9.7.tar.xz";
+      sha256 = "01yp0railyc80ldvpiy36lpsdk26rs8vfp78xca9jy1glm4cmaik";
+      name = "qtactiveqt-opensource-src-5.9.7.tar.xz";
+    };
+  };
+  qtandroidextras = {
+    version = "5.9.7";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.9/5.9.7/submodules/qtandroidextras-opensource-src-5.9.7.tar.xz";
+      sha256 = "1bl05hr0zm23z7qig3kxhzyvm440wfrjfgsxvpmlvk9pbb8h2q63";
+      name = "qtandroidextras-opensource-src-5.9.7.tar.xz";
+    };
+  };
+  qtbase = {
+    version = "5.9.7";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.9/5.9.7/submodules/qtbase-opensource-src-5.9.7.tar.xz";
+      sha256 = "004gs95ig51jv2wz64kwzl4rvqqzs4rln3kqmzjs3sh6y1s9bp9n";
+      name = "qtbase-opensource-src-5.9.7.tar.xz";
+    };
+  };
+  qtcanvas3d = {
+    version = "5.9.7";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.9/5.9.7/submodules/qtcanvas3d-opensource-src-5.9.7.tar.xz";
+      sha256 = "131zwqddjns7cpkdbr33jahqgvnw6f8gdcr1b2hmadi0p2shrcwq";
+      name = "qtcanvas3d-opensource-src-5.9.7.tar.xz";
+    };
+  };
+  qtcharts = {
+    version = "5.9.7";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.9/5.9.7/submodules/qtcharts-opensource-src-5.9.7.tar.xz";
+      sha256 = "1rkj4lkpgdqk4ygxivkj7gc8mlccb5sgi9mfr0xwvq5j85r3dk8n";
+      name = "qtcharts-opensource-src-5.9.7.tar.xz";
+    };
+  };
+  qtconnectivity = {
+    version = "5.9.7";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.9/5.9.7/submodules/qtconnectivity-opensource-src-5.9.7.tar.xz";
+      sha256 = "0f7g2lfnfgsjka7y5hdf0lbzpfxlxh8bfhdxix44cwlmwzjizy3l";
+      name = "qtconnectivity-opensource-src-5.9.7.tar.xz";
+    };
+  };
+  qtdatavis3d = {
+    version = "5.9.7";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.9/5.9.7/submodules/qtdatavis3d-opensource-src-5.9.7.tar.xz";
+      sha256 = "08anm8byxcym7h1n49j3cbxkh3kh3xjlxd3b8vi8fxyqqhvll4lv";
+      name = "qtdatavis3d-opensource-src-5.9.7.tar.xz";
+    };
+  };
+  qtdeclarative = {
+    version = "5.9.7";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.9/5.9.7/submodules/qtdeclarative-opensource-src-5.9.7.tar.xz";
+      sha256 = "0p26c96fb33khbf7ws91ha73n72lwmn714v8spg0bla9m1jkfhk8";
+      name = "qtdeclarative-opensource-src-5.9.7.tar.xz";
+    };
+  };
+  qtdoc = {
+    version = "5.9.7";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.9/5.9.7/submodules/qtdoc-opensource-src-5.9.7.tar.xz";
+      sha256 = "1vs6dy0mdcn65fhpl8nib0pjw9bliqkjnaahqm833ayvxr15vzyj";
+      name = "qtdoc-opensource-src-5.9.7.tar.xz";
+    };
+  };
+  qtgamepad = {
+    version = "5.9.7";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.9/5.9.7/submodules/qtgamepad-opensource-src-5.9.7.tar.xz";
+      sha256 = "0242683h9jz6b0n11s4m4ii2691dbws0gkj45n6sx6z513blfx9f";
+      name = "qtgamepad-opensource-src-5.9.7.tar.xz";
+    };
+  };
+  qtgraphicaleffects = {
+    version = "5.9.7";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.9/5.9.7/submodules/qtgraphicaleffects-opensource-src-5.9.7.tar.xz";
+      sha256 = "1yhxa3i3jvfnc9l6a3q3pyk7y702a3pp87ypshb63607xvrxrv2d";
+      name = "qtgraphicaleffects-opensource-src-5.9.7.tar.xz";
+    };
+  };
+  qtimageformats = {
+    version = "5.9.7";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.9/5.9.7/submodules/qtimageformats-opensource-src-5.9.7.tar.xz";
+      sha256 = "1an0k3rzxjc4x4rscnibdk36zff6g1n41lh5dasys4jc05k3w1b2";
+      name = "qtimageformats-opensource-src-5.9.7.tar.xz";
+    };
+  };
+  qtlocation = {
+    version = "5.9.7";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.9/5.9.7/submodules/qtlocation-opensource-src-5.9.7.tar.xz";
+      sha256 = "0lp6zn630px1lj7623shq47dlv02nr0aj7iqscrk0yzhygbv7dc2";
+      name = "qtlocation-opensource-src-5.9.7.tar.xz";
+    };
+  };
+  qtmacextras = {
+    version = "5.9.7";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.9/5.9.7/submodules/qtmacextras-opensource-src-5.9.7.tar.xz";
+      sha256 = "0b0znccbach41la226cmps9aaigpz8mj940xj890arjf8hn4jd97";
+      name = "qtmacextras-opensource-src-5.9.7.tar.xz";
+    };
+  };
+  qtmultimedia = {
+    version = "5.9.7";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.9/5.9.7/submodules/qtmultimedia-opensource-src-5.9.7.tar.xz";
+      sha256 = "060gic3gl27r7k4vw4n550384b4wadqfn3biajbq6lbyj3zhgxxx";
+      name = "qtmultimedia-opensource-src-5.9.7.tar.xz";
+    };
+  };
+  qtnetworkauth = {
+    version = "5.9.7";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.9/5.9.7/submodules/qtnetworkauth-opensource-src-5.9.7.tar.xz";
+      sha256 = "14n8wzsyq7bw67r1k442widfvszawgi5sh0b10h2jcrp5aikqr0p";
+      name = "qtnetworkauth-opensource-src-5.9.7.tar.xz";
+    };
+  };
+  qtpurchasing = {
+    version = "5.9.7";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.9/5.9.7/submodules/qtpurchasing-opensource-src-5.9.7.tar.xz";
+      sha256 = "1qvxsi0ar04qy0zajbhvwj5blldhfq2mn3laq15g0xxy1xh4m46i";
+      name = "qtpurchasing-opensource-src-5.9.7.tar.xz";
+    };
+  };
+  qtquickcontrols = {
+    version = "5.9.7";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.9/5.9.7/submodules/qtquickcontrols-opensource-src-5.9.7.tar.xz";
+      sha256 = "1jkz2b2wzxzmskvwwb4afqxz0yp0siaf3yhj2i01y865sp6q1wz0";
+      name = "qtquickcontrols-opensource-src-5.9.7.tar.xz";
+    };
+  };
+  qtquickcontrols2 = {
+    version = "5.9.7";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.9/5.9.7/submodules/qtquickcontrols2-opensource-src-5.9.7.tar.xz";
+      sha256 = "0w9rq77a8vc9avhbwbx7swg7zw7jn21wd7si59822rw9ln1p6zb0";
+      name = "qtquickcontrols2-opensource-src-5.9.7.tar.xz";
+    };
+  };
+  qtremoteobjects = {
+    version = "5.9.7";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.9/5.9.7/submodules/qtremoteobjects-opensource-src-5.9.7.tar.xz";
+      sha256 = "1ninscf4jkframv585zzi76fml1lyz0mhb091r2r54lrf66wl3lw";
+      name = "qtremoteobjects-opensource-src-5.9.7.tar.xz";
+    };
+  };
+  qtscript = {
+    version = "5.9.7";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.9/5.9.7/submodules/qtscript-opensource-src-5.9.7.tar.xz";
+      sha256 = "0mv33a1mjaahq7ixfasvjasc881bprfbkjhx8pn3z5f0l8213m67";
+      name = "qtscript-opensource-src-5.9.7.tar.xz";
+    };
+  };
+  qtscxml = {
+    version = "5.9.7";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.9/5.9.7/submodules/qtscxml-opensource-src-5.9.7.tar.xz";
+      sha256 = "0xz2q2bl1n43gxx00nrzyc0bsnq4wch0k2rkj3prc9gsgmpq0bih";
+      name = "qtscxml-opensource-src-5.9.7.tar.xz";
+    };
+  };
+  qtsensors = {
+    version = "5.9.7";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.9/5.9.7/submodules/qtsensors-opensource-src-5.9.7.tar.xz";
+      sha256 = "0pfh4lr9zxsh9winzx1lmcgl2hgp9lr45smcvslr4an93z6mbf8r";
+      name = "qtsensors-opensource-src-5.9.7.tar.xz";
+    };
+  };
+  qtserialbus = {
+    version = "5.9.7";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.9/5.9.7/submodules/qtserialbus-opensource-src-5.9.7.tar.xz";
+      sha256 = "0n6z56axm0gbrxmnwbz8fv40ar9mw1rlfvmpqvpg5xb9031qil1b";
+      name = "qtserialbus-opensource-src-5.9.7.tar.xz";
+    };
+  };
+  qtserialport = {
+    version = "5.9.7";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.9/5.9.7/submodules/qtserialport-opensource-src-5.9.7.tar.xz";
+      sha256 = "05qy4m1p5j5bh6af7d97iblsmgy9kppm5wif3bl63p6yghn319sh";
+      name = "qtserialport-opensource-src-5.9.7.tar.xz";
+    };
+  };
+  qtspeech = {
+    version = "5.9.7";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.9/5.9.7/submodules/qtspeech-opensource-src-5.9.7.tar.xz";
+      sha256 = "0nnbqnh18vw26vphancs38vjr816xha8m6wl389kjqi01kjrcz70";
+      name = "qtspeech-opensource-src-5.9.7.tar.xz";
+    };
+  };
+  qtsvg = {
+    version = "5.9.7";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.9/5.9.7/submodules/qtsvg-opensource-src-5.9.7.tar.xz";
+      sha256 = "0r2mqy6lb2ypmilf83zyp73v5d9ars314jfm6f0fv5if8yw253v2";
+      name = "qtsvg-opensource-src-5.9.7.tar.xz";
+    };
+  };
+  qttools = {
+    version = "5.9.7";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.9/5.9.7/submodules/qttools-opensource-src-5.9.7.tar.xz";
+      sha256 = "18b7jg25434p80yr929nfihk0i124bxpd2dv9mqdcicnv5q0ybnn";
+      name = "qttools-opensource-src-5.9.7.tar.xz";
+    };
+  };
+  qttranslations = {
+    version = "5.9.7";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.9/5.9.7/submodules/qttranslations-opensource-src-5.9.7.tar.xz";
+      sha256 = "051a3igp1qnd7d7bg2dvjaqwh6f67fvkn19jdfjzrdis7kcsfvdk";
+      name = "qttranslations-opensource-src-5.9.7.tar.xz";
+    };
+  };
+  qtvirtualkeyboard = {
+    version = "5.9.7";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.9/5.9.7/submodules/qtvirtualkeyboard-opensource-src-5.9.7.tar.xz";
+      sha256 = "1qcj6ncg53rv4pg4ijdq7vbkzgzfr9bn40aif7g4dndykj0zwla7";
+      name = "qtvirtualkeyboard-opensource-src-5.9.7.tar.xz";
+    };
+  };
+  qtwayland = {
+    version = "5.9.7";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.9/5.9.7/submodules/qtwayland-opensource-src-5.9.7.tar.xz";
+      sha256 = "0y6ky1ipg42gq390ibgr4nns9i4j648yb7bkmx6b7lhsi7mvnp2n";
+      name = "qtwayland-opensource-src-5.9.7.tar.xz";
+    };
+  };
+  qtwebchannel = {
+    version = "5.9.7";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.9/5.9.7/submodules/qtwebchannel-opensource-src-5.9.7.tar.xz";
+      sha256 = "189qkfxixddfblwkaf46yrqjp91vhmw90gpafjryqfmd2141r8qj";
+      name = "qtwebchannel-opensource-src-5.9.7.tar.xz";
+    };
+  };
+  qtwebengine = {
+    version = "5.9.7";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.9/5.9.7/submodules/qtwebengine-opensource-src-5.9.7.tar.xz";
+      sha256 = "0kzpgks5h19rm7gbhr688lr5f5d9ykf062kj91q7wf6fk7qd72v2";
+      name = "qtwebengine-opensource-src-5.9.7.tar.xz";
+    };
+  };
+  qtwebkit = {
+    version = "5.9.1";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.9/5.9.1/submodules/qtwebkit-opensource-src-5.9.1.tar.xz";
+      sha256 = "1ksjn1vjbfhdm4y4rg08ag4krk87ahp7qcdcpwll42l0rnz61998";
+      name = "qtwebkit-opensource-src-5.9.1.tar.xz";
+    };
+  };
+  qtwebkit-examples = {
+    version = "5.9.1";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.9/5.9.1/submodules/qtwebkit-examples-opensource-src-5.9.1.tar.xz";
+      sha256 = "1l2l7ycgqql6rf4gx6sjhsqjapdhvy6vxaxssax3l938nkk4vkp4";
+      name = "qtwebkit-examples-opensource-src-5.9.1.tar.xz";
+    };
+  };
+  qtwebsockets = {
+    version = "5.9.7";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.9/5.9.7/submodules/qtwebsockets-opensource-src-5.9.7.tar.xz";
+      sha256 = "1qqvd6qf7m2xq71mdaidwabj5c03cbbi1hwc7p95fvbnz9crz79x";
+      name = "qtwebsockets-opensource-src-5.9.7.tar.xz";
+    };
+  };
+  qtwebview = {
+    version = "5.9.7";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.9/5.9.7/submodules/qtwebview-opensource-src-5.9.7.tar.xz";
+      sha256 = "1zwqkmzik4f83hdffmw0hz90mzga34hkyz7d0skfbdp25y278r12";
+      name = "qtwebview-opensource-src-5.9.7.tar.xz";
+    };
+  };
+  qtwinextras = {
+    version = "5.9.7";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.9/5.9.7/submodules/qtwinextras-opensource-src-5.9.7.tar.xz";
+      sha256 = "1a57v7krglfdi4gizm402jn9pg7fqpcma7xk6sm68zg1siv11a6x";
+      name = "qtwinextras-opensource-src-5.9.7.tar.xz";
+    };
+  };
+  qtx11extras = {
+    version = "5.9.7";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.9/5.9.7/submodules/qtx11extras-opensource-src-5.9.7.tar.xz";
+      sha256 = "02jdiw94dasnkszi5w1pysfgz8xrr71pzah37nbnqg0knn4dzich";
+      name = "qtx11extras-opensource-src-5.9.7.tar.xz";
+    };
+  };
+  qtxmlpatterns = {
+    version = "5.9.7";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.9/5.9.7/submodules/qtxmlpatterns-opensource-src-5.9.7.tar.xz";
+      sha256 = "0j0rxkpyww5cgcjhy0332jsyka1d811wf6zmr16d5fdkbryp7d65";
+      name = "qtxmlpatterns-opensource-src-5.9.7.tar.xz";
+    };
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/README.md b/nixpkgs/pkgs/development/libraries/qt-5/README.md
new file mode 100644
index 000000000000..b2ef74d0aef1
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/README.md
@@ -0,0 +1,81 @@
+# Qt 5 Maintainer's Notes
+
+## Minor Updates
+
+Let `$major` be the major version number, e.g. `5.9`.
+
+1. Change the version number in the `$major/fetch.sh`.
+2. Run `./maintainers/scripts/fetch-kde-qt.sh pkgs/development/libraries/qt-5/$major`
+   from the top of the Nixpkgs tree.
+
+See below if it is necessary to update any patches.
+
+## Major Updates
+
+Let `$major` be the new major version number, e.g. `5.10`.
+
+1. Copy the subdirectory from the previous major version to `$major`.
+2. Change the version number in `$major/fetch.sh`.
+3. Run `./maintainers/scripts/fetch-kde-qt.sh pkgs/development/libraries/qt-5/$major`
+   from the top of the Nixpkgs tree.
+4. Add a top-level attribute in `pkgs/top-level/all-packages.nix` for the new
+   major version.
+5. Change the `qt5` top-level attribute to point to the new major version.
+6. If the previous major version is _not_ a long-term support release,
+   remove it from Nixpkgs.
+
+See below if it is necessary to update any patches.
+
+## Patches
+
+Nixpkgs maintains several patches for Qt which cannot be submitted upstream. To
+facilitate maintenance, a fork of the upstream repository is created for each patched module:
+
+- [qtbase](https://github.com/ttuegel/qtbase)
+- [qtwebkit](https://github.com/ttuegel/qtwebkit)
+- [qttools](https://github.com/ttuegel/qttools)
+- [qtscript](https://github.com/ttuegel/qtscript)
+- [qtserialport](https://github.com/ttuegel/qtserialport)
+- [qtdeclarative](https://github.com/ttuegel/qtdeclarative)
+- [qtwebengine](https://github.com/ttuegel/qtwebengine)
+
+In each repository, the patches are contained in a branch named `nixpkgs/$major`
+for each major version. Please make a pull request to add or update any patch
+which will be maintained in Nixpkgs.
+
+The forked repository for each module is used to create a single patch in
+Nixpkgs. To recreate the patch for module `$module` (e.g. `qtbase`) at version
+`$version` (e.g. `5.9.1`) in the branch `$major` (e.g. `5.9`),
+
+1. Clone the fork for `$module` from the list above.
+2. Checkout the active branch, `git checkout nixpkgs/$major`.
+3. Compare the patched branch to the release tag,
+   `git diff v$version > $module.patch`.
+4. Copy `$module.patch` into the Nixpkgs tree.
+
+### Minor Version Updates
+
+To update module `$module` to version `$version` from an older version in the
+same branch `$major`,
+
+1. Clone the fork for `$module` from the list above.
+2. Checkout the active branch, `git checkout nixpkgs/$major`.
+3. Merge the new version into the active branch,
+   `git merge --no-ff v$version`.
+4. Fix any conflicts.
+5. Open a pull request for the changes.
+6. Follow the instructions above to recreate the module patch in Nixpkgs.
+
+### Major Version Updates
+
+To update module `$module` from `$oldversion` in branch `$oldmajor` to version
+`$version` in branch `$major`,
+
+1. Clone the fork for `$module` from the list above.
+2. Checkout a new branch for the new major version,
+   `git checkout -b nixpkgs/$major nixpkgs/$oldmajor`.
+3. Rebase the patches from `$oldversion` onto the new branch,
+   `git rebase v$oldversion --onto v$version`.
+4. Fix any conflicts.
+5. Open a pull request for the changes.
+6. Follow the instructions above to recreate the module patch in Nixpkgs.
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/hooks/fix-qt-builtin-paths.sh b/nixpkgs/pkgs/development/libraries/qt-5/hooks/fix-qt-builtin-paths.sh
new file mode 100644
index 000000000000..4ca11a223de2
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/hooks/fix-qt-builtin-paths.sh
@@ -0,0 +1,64 @@
+# fixQtBuiltinPaths
+#
+# Usage: fixQtBuiltinPaths _dir_ _pattern_
+#
+# Fix Qt builtin paths in files matching _pattern_ under _dir_.
+#
+fixQtBuiltinPaths() {
+    local dir="$1"
+    local pattern="$2"
+    local bin="${!outputBin}"
+    local dev="${!outputDev}"
+    local doc="${!outputDoc}"
+    local lib="${!outputLib}"
+
+    if [ -d "$dir" ]; then
+        find "$dir" -name "$pattern" | while read pr_; do
+            if grep -q '\$\$\[QT_' "${pr_:?}"; then
+                echo "fixQtBuiltinPaths: Fixing Qt builtin paths in \`${pr_:?}'..."
+                sed -i "${pr_:?}" \
+                    -e "s|\\\$\\\$\\[QT_HOST_BINS[^]]*\\]|$dev/bin|g" \
+                    -e "s|\\\$\\\$\\[QT_HOST_DATA[^]]*\\]/mkspecs|$dev/mkspecs|g" \
+                    -e "s|\\\$\\\$\\[QT_HOST_PREFIX[^]]*\\]|$dev|g" \
+                    -e "s|\\\$\\\$\\[QT_INSTALL_ARCHDATA[^]]*\\]|$lib|g" \
+                    -e "s|\\\$\\\$\\[QT_INSTALL_BINS[^]]*\\]|$bin/bin|g" \
+                    -e "s|\\\$\\\$\\[QT_INSTALL_CONFIGURATION[^]]*\\]|$bin|g" \
+                    -e "s|\\\$\\\$\\[QT_INSTALL_DATA[^]]*\\]|$lib|g" \
+                    -e "s|\\\$\\\$\\[QT_INSTALL_DOCS[^]]*\\]|$doc/share/doc|g" \
+                    -e "s|\\\$\\\$\\[QT_INSTALL_EXAMPLES[^]]*\\]|$doc/examples|g" \
+                    -e "s|\\\$\\\$\\[QT_INSTALL_HEADERS[^]]*\\]|$dev/include|g" \
+                    -e "s|\\\$\\\$\\[QT_INSTALL_LIBS[^]]*\\]|$lib/lib|g" \
+                    -e "s|\\\$\\\$\\[QT_INSTALL_LIBEXECS[^]]*\\]|$lib/libexec|g" \
+                    -e "s|\\\$\\\$\\[QT_INSTALL_PLUGINS[^]]*\\]|$bin/$qtPluginPrefix|g" \
+                    -e "s|\\\$\\\$\\[QT_INSTALL_PREFIX[^]]*\\]|$lib|g" \
+                    -e "s|\\\$\\\$\\[QT_INSTALL_TESTS[^]]*\\]|$dev/tests|g" \
+                    -e "s|\\\$\\\$\\[QT_INSTALL_TRANSLATIONS[^]]*\\]|$lib/translations|g" \
+                    -e "s|\\\$\\\$\\[QT_INSTALL_QML[^]]*\\]|$bin/$qtQmlPrefix|g"
+            fi
+        done
+    elif [ -e "$dir" ]; then
+        if grep -q '\$\$\[QT_' "${dir:?}"; then
+            echo "fixQtBuiltinPaths: Fixing Qt builtin paths in \`${dir:?}'..."
+            sed -i "${dir:?}" \
+                -e "s|\\\$\\\$\\[QT_HOST_BINS[^]]*\\]|$dev/bin|g" \
+                -e "s|\\\$\\\$\\[QT_HOST_DATA[^]]*\\]/mkspecs|$dev/mkspecs|g" \
+                -e "s|\\\$\\\$\\[QT_HOST_PREFIX[^]]*\\]|$dev|g" \
+                -e "s|\\\$\\\$\\[QT_INSTALL_ARCHDATA[^]]*\\]|$lib|g" \
+                -e "s|\\\$\\\$\\[QT_INSTALL_BINS[^]]*\\]|$bin/bin|g" \
+                -e "s|\\\$\\\$\\[QT_INSTALL_CONFIGURATION[^]]*\\]|$bin|g" \
+                -e "s|\\\$\\\$\\[QT_INSTALL_DATA[^]]*\\]|$lib|g" \
+                -e "s|\\\$\\\$\\[QT_INSTALL_DOCS[^]]*\\]|$doc/share/doc|g" \
+                -e "s|\\\$\\\$\\[QT_INSTALL_EXAMPLES[^]]*\\]|$doc/examples|g" \
+                -e "s|\\\$\\\$\\[QT_INSTALL_HEADERS[^]]*\\]|$dev/include|g" \
+                -e "s|\\\$\\\$\\[QT_INSTALL_LIBS[^]]*\\]|$lib/lib|g" \
+                -e "s|\\\$\\\$\\[QT_INSTALL_LIBEXECS[^]]*\\]|$lib/libexec|g" \
+                -e "s|\\\$\\\$\\[QT_INSTALL_PLUGINS[^]]*\\]|$bin/$qtPluginPrefix|g" \
+                -e "s|\\\$\\\$\\[QT_INSTALL_PREFIX[^]]*\\]|$lib|g" \
+                -e "s|\\\$\\\$\\[QT_INSTALL_TESTS[^]]*\\]|$dev/tests|g" \
+                -e "s|\\\$\\\$\\[QT_INSTALL_TRANSLATIONS[^]]*\\]|$lib/translations|g" \
+                -e "s|\\\$\\\$\\[QT_INSTALL_QML[^]]*\\]|$bin/$qtQmlPrefix|g"
+        fi
+    else
+        echo "fixQtBuiltinPaths: Warning: \`$dir' does not exist"
+    fi
+}
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/hooks/fix-qt-module-paths.sh b/nixpkgs/pkgs/development/libraries/qt-5/hooks/fix-qt-module-paths.sh
new file mode 100644
index 000000000000..33682f6f3c69
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/hooks/fix-qt-module-paths.sh
@@ -0,0 +1,36 @@
+# fixQtModulePaths
+#
+# Usage: fixQtModulePaths _dir_
+#
+# Find Qt module definitions in directory _dir_ and patch the module paths.
+#
+fixQtModulePaths () {
+    local dir="$1"
+    local bin="${!outputBin}"
+    local dev="${!outputDev}"
+    local lib="${!outputLib}"
+
+    if [ -d "$dir" ]; then
+        find "$dir" -name 'qt_*.pri' | while read pr; do
+            if grep -q '\$\$QT_MODULE_' "${pr:?}"; then
+                echo "fixQtModulePaths: Fixing module paths in \`${pr:?}'..."
+                sed -i "${pr:?}" \
+                    -e "s|\\\$\\\$QT_MODULE_LIB_BASE|$lib/lib|g" \
+                    -e "s|\\\$\\\$QT_MODULE_HOST_LIB_BASE|$lib/lib|g" \
+                    -e "s|\\\$\\\$QT_MODULE_INCLUDE_BASE|$dev/include|g" \
+                    -e "s|\\\$\\\$QT_MODULE_BIN_BASE|$dev/bin|g"
+            fi
+        done
+    elif [ -e "$dir" ]; then
+        echo "fixQtModulePaths: Warning: \`$dir' is not a directory"
+    else
+        echo "fixQtModulePaths: Warning: \`$dir' does not exist"
+    fi
+
+    if [ "z$bin" != "z$dev" ]; then
+        if [ -d "$bin/bin" ]; then
+            mkdir -p "$dev/bin"
+            lndir -silent "$bin/bin" "$dev/bin"
+        fi
+    fi
+}
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/hooks/move-qt-dev-tools.sh b/nixpkgs/pkgs/development/libraries/qt-5/hooks/move-qt-dev-tools.sh
new file mode 100644
index 000000000000..85489c85105b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/hooks/move-qt-dev-tools.sh
@@ -0,0 +1,34 @@
+updateToolPath() {
+    local tool="$1"
+    local target="$2"
+    local original="${!outputBin}/$tool"
+    local actual="${!outputDev}/$tool"
+    if grep -q "$original" "$target"; then
+        echo "updateToolPath: Updating \`$original' in \`$target\'..."
+        sed -i "$target" -e "s|$original|$actual|"
+    fi
+}
+
+moveQtDevTools() {
+    if [ -n "$devTools" ]; then
+        for tool in $devTools; do
+            moveToOutput "$tool" "${!outputDev}"
+        done
+
+        if [ -d "${!outputDev}/mkspecs" ]; then
+            find "${!outputDev}/mkspecs" -name '*.pr?' | while read pr_; do
+                for tool in $devTools; do
+                    updateToolPath "$tool" "$pr_"
+                done
+            done
+        fi
+
+        if [ -d "${!outputDev}/lib/cmake" ]; then
+            find "${!outputDev}/lib/cmake" -name '*.cmake' | while read cmake; do
+                for tool in $devTools; do
+                    updateToolPath "$tool" "$cmake"
+                done
+            done
+        fi
+    fi
+}
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/hooks/qmake-hook.sh b/nixpkgs/pkgs/development/libraries/qt-5/hooks/qmake-hook.sh
new file mode 100644
index 000000000000..eef2c7d24dfc
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/hooks/qmake-hook.sh
@@ -0,0 +1,23 @@
+qmakeConfigurePhase() {
+    runHook preConfigure
+
+    qmake PREFIX=$out \
+          NIX_OUTPUT_OUT=$out \
+          NIX_OUTPUT_DEV=${!outputDev} \
+          NIX_OUTPUT_BIN=${!outputBin} \
+          NIX_OUTPUT_DOC=${!outputDev}/${qtDocPrefix:?} \
+          NIX_OUTPUT_QML=${!outputBin}/${qtQmlPrefix:?} \
+          NIX_OUTPUT_PLUGIN=${!outputBin}/${qtPluginPrefix:?} \
+          $qmakeFlags
+
+    if ! [[ -v enableParallelBuilding ]]; then
+        enableParallelBuilding=1
+        echo "qmake: enabled parallel building"
+    fi
+
+    runHook postConfigure
+}
+
+if [ -z "$dontUseQmakeConfigure" -a -z "$configurePhase" ]; then
+    configurePhase=qmakeConfigurePhase
+fi
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/hooks/qtbase-setup-hook.sh b/nixpkgs/pkgs/development/libraries/qt-5/hooks/qtbase-setup-hook.sh
new file mode 100644
index 000000000000..3a558153988c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/hooks/qtbase-setup-hook.sh
@@ -0,0 +1,64 @@
+qtPluginPrefix=@qtPluginPrefix@
+qtQmlPrefix=@qtQmlPrefix@
+qtDocPrefix=@qtDocPrefix@
+
+. @fix_qt_builtin_paths@
+. @fix_qt_module_paths@
+
+providesQtRuntime() {
+    [ -d "$1/$qtPluginPrefix" ] || [ -d "$1/$qtQmlPrefix" ]
+}
+
+# Build tools are often confused if QMAKE is unset.
+QMAKE=@dev@/bin/qmake
+export QMAKE
+
+QMAKEPATH=
+export QMAKEPATH
+
+QMAKEMODULES=
+export QMAKEMODULES
+
+addToQMAKEPATH() {
+    if [ -d "$1/mkspecs" ]; then
+        QMAKEMODULES="${QMAKEMODULES}${QMAKEMODULES:+:}/mkspecs"
+        QMAKEPATH="${QMAKEPATH}${QMAKEPATH:+:}$1"
+    fi
+}
+
+# Propagate any runtime dependency of the building package.
+# Each dependency is propagated to the user environment and as a build
+# input so that it will be re-propagated to the user environment by any
+# package depending on the building package. (This is necessary in case
+# the building package does not provide runtime dependencies itself and so
+# would not be propagated to the user environment.)
+qtEnvHook() {
+    addToQMAKEPATH "$1"
+    if providesQtRuntime "$1"; then
+        if [ "z${!outputBin}" != "z${!outputDev}" ]; then
+            propagatedBuildInputs+=" $1"
+        fi
+        propagatedUserEnvPkgs+=" $1"
+    fi
+}
+envHostTargetHooks+=(qtEnvHook)
+
+postPatchMkspecs() {
+    local bin="${!outputBin}"
+    local dev="${!outputDev}"
+    local doc="${!outputDoc}"
+    local lib="${!outputLib}"
+
+    moveToOutput "mkspecs" "$dev"
+
+    if [ -d "$dev/mkspecs/modules" ]; then
+        fixQtModulePaths "$dev/mkspecs/modules"
+    fi
+
+    if [ -d "$dev/mkspecs" ]; then
+        fixQtBuiltinPaths "$dev/mkspecs" '*.pr?'
+    fi
+}
+if [ -z "$dontPatchMkspecs" ]; then
+    postPhases="${postPhases}${postPhases:+ }postPatchMkspecs"
+fi
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/hooks/qttools-setup-hook.sh b/nixpkgs/pkgs/development/libraries/qt-5/hooks/qttools-setup-hook.sh
new file mode 100644
index 000000000000..b09cf5f46c9c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/hooks/qttools-setup-hook.sh
@@ -0,0 +1 @@
+qmakeFlags="$qmakeFlags${qmakeFlags:+ }QMAKE_LRELEASE=@dev@/bin/lrelease"
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/mkDerivation.nix b/nixpkgs/pkgs/development/libraries/qt-5/mkDerivation.nix
new file mode 100644
index 000000000000..d4e2143d564b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/mkDerivation.nix
@@ -0,0 +1,30 @@
+{ stdenv, lib }:
+
+let inherit (lib) optional; in
+
+{ debug }:
+
+args:
+
+let
+  args_ = {
+
+    qmakeFlags = [ ("CONFIG+=" + (if debug then "debug" else "release")) ]
+              ++ (args.qmakeFlags or []);
+
+    NIX_CFLAGS_COMPILE =
+      optional (!debug) "-DQT_NO_DEBUG"
+      ++ lib.toList (args.NIX_CFLAGS_COMPILE or []);
+
+    cmakeFlags =
+      (args.cmakeFlags or [])
+      ++ [
+        ("-DCMAKE_BUILD_TYPE=" + (if debug then "Debug" else "Release"))
+      ];
+
+    enableParallelBuilding = args.enableParallelBuilding or true;
+
+  };
+in
+
+stdenv.mkDerivation (args // args_)
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/modules/qtbase.nix b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtbase.nix
new file mode 100644
index 000000000000..bd92d9bc27cc
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtbase.nix
@@ -0,0 +1,384 @@
+{
+  stdenv, lib,
+  src, patches, version, qtCompatVersion,
+
+  coreutils, bison, flex, gdb, gperf, lndir, perl, pkgconfig, python2,
+  which,
+  # darwin support
+  darwin, libiconv,
+
+  dbus, fontconfig, freetype, glib, harfbuzz, icu, libX11, libXcomposite,
+  libXcursor, libXext, libXi, libXrender, libinput, libjpeg, libpng, libtiff,
+  libxcb, libxkbcommon, libxml2, libxslt, openssl, pcre16, pcre2, sqlite, udev,
+  xcbutil, xcbutilimage, xcbutilkeysyms, xcbutilrenderutil, xcbutilwm,
+  zlib,
+
+  # optional dependencies
+  cups ? null, mysql ? null, postgresql ? null,
+  withGtk3 ? false, dconf ? null, gtk3 ? null,
+
+  # options
+  libGLSupported ? !stdenv.isDarwin,
+  libGL,
+  buildExamples ? false,
+  buildTests ? false,
+  developerBuild ? false,
+  decryptSslTraffic ? false
+}:
+
+assert withGtk3 -> dconf != null;
+assert withGtk3 -> gtk3 != null;
+
+let
+  compareVersion = v: builtins.compareVersions version v;
+in
+
+stdenv.mkDerivation {
+
+  name = "qtbase-${version}";
+  inherit qtCompatVersion src version;
+
+  propagatedBuildInputs =
+    [
+      libxml2 libxslt openssl sqlite zlib
+
+      # Text rendering
+      harfbuzz icu
+
+      # Image formats
+      libjpeg libpng libtiff
+      (if compareVersion "5.9.0" >= 0 then pcre2 else pcre16)
+    ]
+    ++ (
+      if stdenv.isDarwin
+      then with darwin.apple_sdk.frameworks;
+        [
+          # TODO: move to buildInputs, this should not be propagated.
+          AGL AppKit ApplicationServices Carbon Cocoa CoreAudio CoreBluetooth
+          CoreLocation CoreServices DiskArbitration Foundation OpenGL
+          darwin.libobjc libiconv
+        ]
+      else
+        [
+          dbus glib udev
+
+          # Text rendering
+          fontconfig freetype
+
+          # X11 libs
+          libX11 libXcomposite libXext libXi libXrender libxcb libxkbcommon xcbutil
+          xcbutilimage xcbutilkeysyms xcbutilrenderutil xcbutilwm
+        ]
+        ++ lib.optional libGLSupported libGL
+    );
+
+  buildInputs =
+    lib.optionals (!stdenv.isDarwin)
+    (
+      [ libinput ]
+      ++ lib.optional withGtk3 gtk3
+    )
+       # Needed for OBJC_CLASS_$_NSDate symbols.
+    ++ lib.optional stdenv.isDarwin darwin.cf-private
+    ++ lib.optional developerBuild gdb
+    ++ lib.optional (cups != null) cups
+    ++ lib.optional (mysql != null) mysql.connector-c
+    ++ lib.optional (postgresql != null) postgresql;
+
+  nativeBuildInputs =
+    [ bison flex gperf lndir perl pkgconfig python2 which ];
+
+  propagatedNativeBuildInputs = [ lndir ];
+
+  outputs = [ "bin" "dev" "out" ];
+
+  inherit patches;
+
+  fix_qt_builtin_paths = ../hooks/fix-qt-builtin-paths.sh;
+  fix_qt_module_paths = ../hooks/fix-qt-module-paths.sh;
+  preHook = ''
+    . "$fix_qt_builtin_paths"
+    . "$fix_qt_module_paths"
+    . ${../hooks/move-qt-dev-tools.sh}
+  '';
+
+  postPatch =
+    ''
+      for prf in qml_plugin.prf qt_plugin.prf qt_docs.prf qml_module.prf create_cmake.prf; do
+          substituteInPlace "mkspecs/features/$prf" \
+              --subst-var qtPluginPrefix \
+              --subst-var qtQmlPrefix \
+              --subst-var qtDocPrefix
+      done
+
+      substituteInPlace configure --replace /bin/pwd pwd
+      substituteInPlace src/corelib/global/global.pri --replace /bin/ls ${coreutils}/bin/ls
+      sed -e 's@/\(usr\|opt\)/@/var/empty/@g' -i mkspecs/*/*.conf
+
+      sed -i '/PATHS.*NO_DEFAULT_PATH/ d' src/corelib/Qt5Config.cmake.in
+      sed -i '/PATHS.*NO_DEFAULT_PATH/ d' src/corelib/Qt5CoreMacros.cmake
+      sed -i 's/NO_DEFAULT_PATH//' src/gui/Qt5GuiConfigExtras.cmake.in
+      sed -i '/PATHS.*NO_DEFAULT_PATH/ d' mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
+    ''
+
+    + (
+      if stdenv.isDarwin
+      then
+        ''
+          sed -i \
+              -e 's|! /usr/bin/xcode-select --print-path >/dev/null 2>&1;|false;|' \
+              -e 's|! /usr/bin/xcrun -find xcodebuild >/dev/null 2>&1;|false;|' \
+              -e 's|sysroot=$(/usr/bin/xcodebuild -sdk $sdk -version Path 2>/dev/null)|sysroot=/nonsense|' \
+              -e 's|sysroot=$(/usr/bin/xcrun --sdk $sdk --show-sdk-path 2>/dev/null)|sysroot=/nonsense|' \
+              -e 's|QMAKE_CONF_COMPILER=`getXQMakeConf QMAKE_CXX`|QMAKE_CXX="clang++"\nQMAKE_CONF_COMPILER="clang++"|' \
+              -e 's|XCRUN=`/usr/bin/xcrun -sdk macosx clang -v 2>&1`|XCRUN="clang -v 2>&1"|' \
+              -e 's#sdk_val=$(/usr/bin/xcrun -sdk $sdk -find $(echo $val | cut -d \x27 \x27 -f 1))##' \
+              -e 's#val=$(echo $sdk_val $(echo $val | cut -s -d \x27 \x27 -f 2-))##' \
+              ./configure
+              substituteInPlace ./mkspecs/common/mac.conf \
+                  --replace "/System/Library/Frameworks/OpenGL.framework/" "${darwin.apple_sdk.frameworks.OpenGL}/Library/Frameworks/OpenGL.framework/"
+              substituteInPlace ./mkspecs/common/mac.conf \
+                  --replace "/System/Library/Frameworks/AGL.framework/" "${darwin.apple_sdk.frameworks.AGL}/Library/Frameworks/AGL.framework/"
+        ''
+        # Note on the above: \x27 is a way if including a single-quote
+        # character in the sed string arguments.
+      else
+        lib.optionalString libGLSupported
+          ''
+            sed -i mkspecs/common/linux.conf \
+                -e "/^QMAKE_INCDIR_OPENGL/ s|$|${libGL.dev or libGL}/include|" \
+                -e "/^QMAKE_LIBDIR_OPENGL/ s|$|${libGL.out}/lib|"
+          ''
+    );
+
+  qtPluginPrefix = "lib/qt-${qtCompatVersion}/plugins";
+  qtQmlPrefix = "lib/qt-${qtCompatVersion}/qml";
+  qtDocPrefix = "share/doc/qt-${qtCompatVersion}";
+
+  setOutputFlags = false;
+  preConfigure = ''
+    export LD_LIBRARY_PATH="$PWD/lib:$PWD/plugins/platforms:$LD_LIBRARY_PATH"
+    ${lib.optionalString (compareVersion "5.9.0" < 0) ''
+    # We need to set LD to CXX or otherwise we get nasty compile errors
+    export LD=$CXX
+    ''}
+
+    configureFlags+="\
+        -plugindir $out/$qtPluginPrefix \
+        -qmldir $out/$qtQmlPrefix \
+        -docdir $out/$qtDocPrefix"
+
+    createQmakeCache() {
+        cat >>"$1" <<EOF
+    NIX_OUTPUT_BIN = $bin
+    NIX_OUTPUT_DEV = $dev
+    NIX_OUTPUT_OUT = $out
+    NIX_OUTPUT_DOC = $dev/$qtDocPrefix
+    NIX_OUTPUT_QML = $bin/$qtQmlPrefix
+    NIX_OUTPUT_PLUGIN = $bin/$qtPluginPrefix
+    EOF
+    }
+
+    find . -name '.qmake.conf' | while read conf; do
+        cache=$(dirname $conf)/.qmake.cache
+        echo "Creating \`$cache'"
+        createQmakeCache "$cache"
+    done
+
+    NIX_CFLAGS_COMPILE+=" -DNIXPKGS_QT_PLUGIN_PREFIX=\"$qtPluginPrefix\""
+  '';
+
+
+  NIX_CFLAGS_COMPILE =
+    [
+      "-Wno-error=sign-compare" # freetype-2.5.4 changed signedness of some struct fields
+      ''-DNIXPKGS_QTCOMPOSE="${libX11.out}/share/X11/locale"''
+      ''-D${if compareVersion "5.11.0" >= 0 then "LIBRESOLV_SO" else "NIXPKGS_LIBRESOLV"}="${stdenv.cc.libc.out}/lib/libresolv"''
+      ''-DNIXPKGS_LIBXCURSOR="${libXcursor.out}/lib/libXcursor"''
+    ]
+
+    ++ lib.optional libGLSupported ''-DNIXPKGS_MESA_GL="${libGL.out}/lib/libGL"''
+    ++ lib.optionals withGtk3 [
+         ''-DNIXPKGS_QGTK3_XDG_DATA_DIRS="${gtk3}/share/gsettings-schemas/${gtk3.name}"''
+         ''-DNIXPKGS_QGTK3_GIO_EXTRA_MODULES="${dconf.lib}/lib/gio/modules"''
+       ]
+    ++ lib.optional decryptSslTraffic "-DQT_DECRYPT_SSL_TRAFFIC";
+
+  prefixKey = "-prefix ";
+
+  # PostgreSQL autodetection fails sporadically because Qt omits the "-lpq" flag
+  # if dependency paths contain the string "pq", which can occur in the hash.
+  # To prevent these failures, we need to override PostgreSQL detection.
+  PSQL_LIBS = lib.optionalString (postgresql != null) "-L${postgresql.lib}/lib -lpq";
+
+  # -no-eglfs, -no-directfb, -no-linuxfb and -no-kms because of the current minimalist mesa
+  # TODO Remove obsolete and useless flags once the build will be totally mastered
+  configureFlags =
+    [
+      "-verbose"
+      "-confirm-license"
+      "-opensource"
+
+      "-release"
+      "-shared"
+      "-accessibility"
+      "-optimized-qmake"
+      "-strip"
+      "-system-proxies"
+      "-pkg-config"
+
+      "-gui"
+      "-widgets"
+      "-opengl desktop"
+      "-icu"
+      "-pch"
+    ]
+    ++ lib.optionals (compareVersion "5.11.0" < 0)
+    [
+      "-qml-debug"
+    ]
+    ++ lib.optionals (compareVersion "5.9.0" < 0)
+    [
+      "-c++11"
+      "-no-reduce-relocations"
+    ]
+    ++ lib.optionals developerBuild [
+      "-developer-build"
+      "-no-warnings-are-errors"
+    ]
+    ++ (
+      if (!stdenv.hostPlatform.isx86_64)
+      then [ "-no-sse2" ]
+      else lib.optionals (compareVersion "5.9.0" >= 0) {
+        "default"        = [ "-sse2" "-no-sse3" "-no-ssse3" "-no-sse4.1" "-no-sse4.2" "-no-avx" "-no-avx2" ];
+        "westmere"       = [ "-sse2"    "-sse3"    "-ssse3"    "-sse4.1"    "-sse4.2" "-no-avx" "-no-avx2" ];
+        "sandybridge"    = [ "-sse2"    "-sse3"    "-ssse3"    "-sse4.1"    "-sse4.2"    "-avx" "-no-avx2" ];
+        "ivybridge"      = [ "-sse2"    "-sse3"    "-ssse3"    "-sse4.1"    "-sse4.2"    "-avx" "-no-avx2" ];
+        "haswell"        = [ "-sse2"    "-sse3"    "-ssse3"    "-sse4.1"    "-sse4.2"    "-avx"    "-avx2" ];
+        "broadwell"      = [ "-sse2"    "-sse3"    "-ssse3"    "-sse4.1"    "-sse4.2"    "-avx"    "-avx2" ];
+        "skylake"        = [ "-sse2"    "-sse3"    "-ssse3"    "-sse4.1"    "-sse4.2"    "-avx"    "-avx2" ];
+        "skylake-avx512" = [ "-sse2"    "-sse3"    "-ssse3"    "-sse4.1"    "-sse4.2"    "-avx"    "-avx2" ];
+      }.${stdenv.hostPlatform.platform.gcc.arch or "default"}
+    )
+    ++ [
+      "-no-mips_dsp"
+      "-no-mips_dspr2"
+    ]
+
+    ++ [
+      "-system-zlib"
+      "-system-libjpeg"
+      "-system-harfbuzz"
+      "-system-pcre"
+      "-openssl-linked"
+      "-system-sqlite"
+      ''-${if mysql != null then "plugin" else "no"}-sql-mysql''
+      ''-${if postgresql != null then "plugin" else "no"}-sql-psql''
+
+      "-make libs"
+      "-make tools"
+      ''-${lib.optionalString (!buildExamples) "no"}make examples''
+      ''-${lib.optionalString (!buildTests) "no"}make tests''
+      "-v"
+    ]
+
+    ++ (
+      if stdenv.isDarwin
+      then
+        [
+          "-platform macx-clang"
+          "-no-fontconfig"
+          "-qt-freetype"
+          "-qt-libpng"
+          "-no-framework"
+        ]
+      else
+        [
+          "-${lib.optionalString (compareVersion "5.9.0" < 0) "no-"}rpath"
+
+          "-system-xcb"
+          "-xcb"
+          "-qpa xcb"
+
+          "-system-xkbcommon"
+          "-libinput"
+          "-xkbcommon-evdev"
+
+          "-no-eglfs"
+          "-no-gbm"
+          "-no-kms"
+          "-no-linuxfb"
+
+          ''-${lib.optionalString (cups == null) "no-"}cups''
+          "-dbus-linked"
+          "-glib"
+          "-system-libjpeg"
+          "-system-libpng"
+        ]
+        ++ lib.optional withGtk3 "-gtk"
+        ++ lib.optional (compareVersion "5.9.0" >= 0) "-inotify"
+        ++ lib.optionals (compareVersion "5.10.0" >= 0) [
+          # Without these, Qt stops working on kernels < 3.17. See:
+          # https://github.com/NixOS/nixpkgs/issues/38832
+          "-no-feature-renameat2"
+          "-no-feature-getentropy"
+        ]
+    );
+
+  enableParallelBuilding = true;
+
+  postInstall =
+    # Move selected outputs.
+    ''
+      moveToOutput "mkspecs" "$dev"
+    '';
+
+  devTools = [
+    "bin/fixqt4headers.pl"
+    "bin/moc"
+    "bin/qdbuscpp2xml"
+    "bin/qdbusxml2cpp"
+    "bin/qlalr"
+    "bin/qmake"
+    "bin/rcc"
+    "bin/syncqt.pl"
+    "bin/uic"
+  ];
+
+  postFixup =
+    # Don't retain build-time dependencies like gdb.
+    ''
+      sed '/QMAKE_DEFAULT_.*DIRS/ d' -i $dev/mkspecs/qconfig.pri
+    ''
+
+    + ''
+      fixQtModulePaths "''${!outputDev}/mkspecs/modules"
+      fixQtBuiltinPaths "''${!outputDev}" '*.pr?'
+    ''
+
+    # Move development tools to $dev
+    + ''
+      moveQtDevTools
+      moveToOutput bin "$dev"
+    ''
+
+    + (
+        # fixup .pc file (where to find 'moc' etc.)
+        ''
+          sed -i "$dev/lib/pkgconfig/Qt5Core.pc" \
+              -e "/^host_bins=/ c host_bins=$dev/bin"
+        ''
+    );
+
+  setupHook = ../hooks/qtbase-setup-hook.sh;
+
+  meta = with lib; {
+    homepage = http://www.qt.io;
+    description = "A cross-platform application framework for C++";
+    license = with licenses; [ fdl13 gpl2 lgpl21 lgpl3 ];
+    maintainers = with maintainers; [ qknight ttuegel periklis bkchr ];
+    platforms = platforms.unix;
+    broken = stdenv.isDarwin && (compareVersion "5.9.0" < 0);
+  };
+
+}
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/modules/qtcharts.nix b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtcharts.nix
new file mode 100644
index 000000000000..84d3a17ea8ce
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtcharts.nix
@@ -0,0 +1,7 @@
+{ qtModule, qtbase, qtdeclarative }:
+
+qtModule {
+  name = "qtcharts";
+  qtInputs = [ qtbase qtdeclarative ];
+  outputs = [ "out" "dev" "bin" ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/modules/qtconnectivity.nix b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtconnectivity.nix
new file mode 100644
index 000000000000..17e7f0ee7cff
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtconnectivity.nix
@@ -0,0 +1,8 @@
+{ qtModule, stdenv, qtbase, qtdeclarative, bluez, cf-private }:
+
+qtModule {
+  name = "qtconnectivity";
+  qtInputs = [ qtbase qtdeclarative ];
+  buildInputs = if stdenv.isDarwin then [ cf-private ] else [ bluez ];
+  outputs = [ "out" "dev" "bin" ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/modules/qtdeclarative.nix b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtdeclarative.nix
new file mode 100644
index 000000000000..7c1fa449ebba
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtdeclarative.nix
@@ -0,0 +1,26 @@
+{ qtModule, lib, python2, qtbase, qtsvg }:
+
+with lib;
+
+qtModule {
+  name = "qtdeclarative";
+  qtInputs = [ qtbase qtsvg ];
+  nativeBuildInputs = [ python2 ];
+  outputs = [ "out" "dev" "bin" ];
+  preConfigure = ''
+    NIX_CFLAGS_COMPILE+=" -DNIXPKGS_QML2_IMPORT_PREFIX=\"$qtQmlPrefix\""
+  '';
+  configureFlags = lib.optionals (lib.versionAtLeast qtbase.version "5.11.0") [ "-qml-debug" ];
+  devTools = [
+    "bin/qml"
+    "bin/qmlcachegen"
+    "bin/qmleasing"
+    "bin/qmlimportscanner"
+    "bin/qmllint"
+    "bin/qmlmin"
+    "bin/qmlplugindump"
+    "bin/qmlprofiler"
+    "bin/qmlscene"
+    "bin/qmltestrunner"
+  ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/modules/qtdoc.nix b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtdoc.nix
new file mode 100644
index 000000000000..10623962c430
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtdoc.nix
@@ -0,0 +1,7 @@
+{ qtModule, qtdeclarative }:
+
+qtModule {
+  name = "qtdoc";
+  qtInputs = [ qtdeclarative ];
+  outputs = [ "out" ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/modules/qtgraphicaleffects.nix b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtgraphicaleffects.nix
new file mode 100644
index 000000000000..d0be6ae77694
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtgraphicaleffects.nix
@@ -0,0 +1,7 @@
+{ qtModule, qtdeclarative }:
+
+qtModule {
+  name = "qtgraphicaleffects";
+  qtInputs = [ qtdeclarative ];
+  outputs = [ "out" "dev" ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/modules/qtimageformats.nix b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtimageformats.nix
new file mode 100644
index 000000000000..1a7726070be3
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtimageformats.nix
@@ -0,0 +1,6 @@
+{ qtModule, qtbase }:
+
+qtModule {
+  name = "qtimageformats";
+  qtInputs = [ qtbase ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/modules/qtlocation.nix b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtlocation.nix
new file mode 100644
index 000000000000..0eee684a53fd
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtlocation.nix
@@ -0,0 +1,14 @@
+{ stdenv, qtModule, qtbase, qtmultimedia }:
+
+qtModule {
+  name = "qtlocation";
+  qtInputs = [ qtbase qtmultimedia ];
+  outputs = [ "bin" "out" "dev" ];
+  qmakeFlags = stdenv.lib.optional stdenv.isDarwin [
+     # boost uses std::auto_ptr which has been disabled in clang with libcxx
+     # This flag re-enables this feature
+     # https://libcxx.llvm.org/docs/UsingLibcxx.html#c-17-specific-configuration-macros
+     "QMAKE_CXXFLAGS+=-D_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR"
+  ];
+
+}
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/modules/qtmacextras.nix b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtmacextras.nix
new file mode 100644
index 000000000000..3f254885986e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtmacextras.nix
@@ -0,0 +1,12 @@
+{ stdenv, qtModule, qtbase, cf-private }:
+
+qtModule {
+  name = "qtmacextras";
+  qtInputs = [ qtbase ]
+    # Needed for _OBJC_CLASS_$_NSData symbols.
+    ++ stdenv.lib.optional stdenv.isDarwin cf-private;
+  meta = with stdenv.lib; {
+    maintainers = with maintainers; [ periklis ];
+    platforms = platforms.darwin;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/modules/qtmultimedia.nix b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtmultimedia.nix
new file mode 100644
index 000000000000..d0bab88b2f21
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtmultimedia.nix
@@ -0,0 +1,16 @@
+{ qtModule, stdenv, qtbase, qtdeclarative, pkgconfig
+, alsaLib, gstreamer, gst-plugins-base, libpulseaudio
+}:
+
+with stdenv.lib;
+
+qtModule {
+  name = "qtmultimedia";
+  qtInputs = [ qtbase qtdeclarative ];
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ gstreamer gst-plugins-base libpulseaudio]
+    ++ optional (stdenv.isLinux) alsaLib;
+  outputs = [ "bin" "dev" "out" ];
+  qmakeFlags = [ "GST_VERSION=1.0" ];
+  NIX_LDFLAGS = optionalString (stdenv.isDarwin) "-lobjc";
+}
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/modules/qtnetworkauth.nix b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtnetworkauth.nix
new file mode 100644
index 000000000000..e6ef428cc3c4
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtnetworkauth.nix
@@ -0,0 +1,6 @@
+{ qtModule, qtbase }:
+
+qtModule {
+  name = "qtnetworkauth";
+  qtInputs = [ qtbase ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/modules/qtquickcontrols.nix b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtquickcontrols.nix
new file mode 100644
index 000000000000..ba0f20bc0d83
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtquickcontrols.nix
@@ -0,0 +1,6 @@
+{ qtModule, qtdeclarative }:
+
+qtModule {
+  name = "qtquickcontrols";
+  qtInputs = [ qtdeclarative ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/modules/qtquickcontrols2.nix b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtquickcontrols2.nix
new file mode 100644
index 000000000000..a9522f4b1f0c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtquickcontrols2.nix
@@ -0,0 +1,7 @@
+{ qtModule, qtdeclarative }:
+
+qtModule {
+  name = "qtquickcontrols2";
+  qtInputs = [ qtdeclarative ];
+  outputs = [ "out" "dev" "bin" ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/modules/qtscript.nix b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtscript.nix
new file mode 100644
index 000000000000..5a1a462a9640
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtscript.nix
@@ -0,0 +1,6 @@
+{ qtModule, qtbase, qttools }:
+
+qtModule {
+  name = "qtscript";
+  qtInputs = [ qtbase qttools ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/modules/qtsensors.nix b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtsensors.nix
new file mode 100644
index 000000000000..3b8732b68851
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtsensors.nix
@@ -0,0 +1,7 @@
+{ qtModule, qtbase, qtdeclarative }:
+
+qtModule {
+  name = "qtsensors";
+  qtInputs = [ qtbase qtdeclarative ];
+  outputs = [ "out" "dev" "bin" ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/modules/qtserialport.nix b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtserialport.nix
new file mode 100644
index 000000000000..516d38340dc5
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtserialport.nix
@@ -0,0 +1,11 @@
+{ qtModule, stdenv, lib, qtbase, systemd }:
+
+let inherit (lib) getLib optional; in
+
+qtModule {
+  name = "qtserialport";
+  qtInputs = [ qtbase ];
+  NIX_CFLAGS_COMPILE =
+    optional stdenv.isLinux
+    ''-DNIXPKGS_LIBUDEV="${getLib systemd}/lib/libudev"'';
+}
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/modules/qtspeech.nix b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtspeech.nix
new file mode 100644
index 000000000000..7b4b19ccab5a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtspeech.nix
@@ -0,0 +1,7 @@
+{ qtModule }:
+
+qtModule {
+  name = "qtspeech";
+  qtInputs = [ ];
+  outputs = [ "out" "dev" "bin" ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/modules/qtsvg.nix b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtsvg.nix
new file mode 100644
index 000000000000..3ce68e56e412
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtsvg.nix
@@ -0,0 +1,7 @@
+{ qtModule, qtbase }:
+
+qtModule {
+  name = "qtsvg";
+  qtInputs = [ qtbase ];
+  outputs = [ "out" "dev" "bin" ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/modules/qttools.nix b/nixpkgs/pkgs/development/libraries/qt-5/modules/qttools.nix
new file mode 100644
index 000000000000..622d841b4051
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/modules/qttools.nix
@@ -0,0 +1,36 @@
+{ qtModule, stdenv, lib, qtbase }:
+
+with lib;
+
+qtModule {
+  name = "qttools";
+  qtInputs = [ qtbase ];
+  outputs = [ "out" "dev" "bin" ];
+
+  # fixQtBuiltinPaths overwrites a builtin path we should keep
+  postPatch = ''
+    sed -i "src/linguist/linguist.pro" \
+        -e '/^cmake_linguist_config_version_file.input =/ s|$$\[QT_HOST_DATA.*\]|${getDev qtbase}|'
+  '';
+
+  devTools = [
+    "bin/qcollectiongenerator"
+    "bin/linguist"
+    "bin/assistant"
+    "bin/qdoc"
+    "bin/lconvert"
+    "bin/designer"
+    "bin/qtattributesscanner"
+    "bin/lrelease"
+    "bin/pixeltool"
+    "bin/lupdate"
+    "bin/qtdiag"
+    "bin/qhelpgenerator"
+    "bin/qtplugininfo"
+    "bin/qthelpconverter"
+  ] ++ optionals stdenv.isDarwin [
+    "bin/macdeployqt"
+  ];
+
+  setupHook = ../hooks/qttools-setup-hook.sh;
+}
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/modules/qttranslations.nix b/nixpkgs/pkgs/development/libraries/qt-5/modules/qttranslations.nix
new file mode 100644
index 000000000000..11a6e3fedcb1
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/modules/qttranslations.nix
@@ -0,0 +1,6 @@
+{ qtModule, qttools }:
+
+qtModule {
+  name = "qttranslations";
+  qtInputs = [ qttools ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/modules/qtvirtualkeyboard.nix b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtvirtualkeyboard.nix
new file mode 100644
index 000000000000..2ba720c8eedc
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtvirtualkeyboard.nix
@@ -0,0 +1,6 @@
+{ qtModule, qtbase, qtdeclarative, qtsvg, hunspell  }:
+
+qtModule {
+  name = "qtvirtualkeyboard";
+  qtInputs = [ qtbase qtdeclarative qtsvg hunspell ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/modules/qtwayland.nix b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtwayland.nix
new file mode 100644
index 000000000000..c7a7704f2837
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtwayland.nix
@@ -0,0 +1,9 @@
+{ qtModule, qtbase, qtquickcontrols, wayland, pkgconfig }:
+
+qtModule {
+  name = "qtwayland";
+  qtInputs = [ qtbase qtquickcontrols ];
+  buildInputs = [ wayland ];
+  nativeBuildInputs = [ pkgconfig ];
+  outputs = [ "out" "dev" "bin" ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/modules/qtwebchannel.nix b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtwebchannel.nix
new file mode 100644
index 000000000000..84fb88385a3e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtwebchannel.nix
@@ -0,0 +1,8 @@
+{ qtModule, qtbase, qtdeclarative }:
+
+qtModule {
+  name = "qtwebchannel";
+  qtInputs = [ qtbase qtdeclarative ];
+  outputs = [ "out" "dev" "bin" ];
+}
+
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/modules/qtwebengine.nix b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtwebengine.nix
new file mode 100644
index 000000000000..aa9cdb4d5ae7
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtwebengine.nix
@@ -0,0 +1,233 @@
+{ qtModule, qtCompatVersion,
+  qtdeclarative, qtquickcontrols, qtlocation, qtwebchannel
+
+, bison, coreutils, flex, git, gperf, ninja, pkgconfig, python2, which
+
+, xorg, libXcursor, libXScrnSaver, libXrandr, libXtst
+, fontconfig, freetype, harfbuzz, icu, dbus, libdrm
+, zlib, minizip, libjpeg, libpng, libtiff, libwebp, libopus
+, jsoncpp, protobuf, libvpx, srtp, snappy, nss, libevent
+, alsaLib
+, libcap
+, pciutils
+, systemd
+, enableProprietaryCodecs ? true
+, gn
+, cups, darwin, openbsm, runCommand, xcbuild
+, ffmpeg ? null
+, lib, stdenv
+}:
+
+with stdenv.lib;
+
+let qt56 = qtCompatVersion == "5.6"; in
+
+qtModule {
+  name = "qtwebengine";
+  qtInputs = [ qtdeclarative qtquickcontrols qtlocation qtwebchannel ];
+  nativeBuildInputs = [
+    bison coreutils flex git gperf ninja pkgconfig python2 which gn
+  ] ++ optional stdenv.isDarwin xcbuild;
+  doCheck = true;
+  outputs = [ "bin" "dev" "out" ];
+
+  enableParallelBuilding = true;
+
+  # Don’t use the gn setup hook
+  dontUseGnConfigure = true;
+
+  # ninja builds some components with -Wno-format,
+  # which cannot be set at the same time as -Wformat-security
+  hardeningDisable = [ "format" ];
+
+  postPatch =
+    # Patch Chromium build tools
+    ''
+      ( cd src/3rdparty/chromium; patchShebangs . )
+    ''
+    # Patch Chromium build files
+    + optionalString (lib.versionOlder qtCompatVersion "5.12") ''
+      substituteInPlace ./src/3rdparty/chromium/build/common.gypi --replace /bin/echo ${coreutils}/bin/echo
+      substituteInPlace ./src/3rdparty/chromium/v8/${if qt56 then "build" else "gypfiles"}/toolchain.gypi \
+        --replace /bin/echo ${coreutils}/bin/echo
+      substituteInPlace ./src/3rdparty/chromium/v8/${if qt56 then "build" else "gypfiles"}/standalone.gypi \
+        --replace /bin/echo ${coreutils}/bin/echo
+    ''
+    # Patch library paths in Qt sources
+    + ''
+      sed -i \
+        -e "s,QLibraryInfo::location(QLibraryInfo::DataPath),QLatin1String(\"$out\"),g" \
+        -e "s,QLibraryInfo::location(QLibraryInfo::TranslationsPath),QLatin1String(\"$out/translations\"),g" \
+        -e "s,QLibraryInfo::location(QLibraryInfo::LibraryExecutablesPath),QLatin1String(\"$out/libexec\"),g" \
+        src/core/web_engine_library_info.cpp
+    ''
+    # Patch library paths in Chromium sources
+    + optionalString (!stdenv.isDarwin) ''
+      sed -i -e '/lib_loader.*Load/s!"\(libudev\.so\)!"${systemd.lib}/lib/\1!' \
+        src/3rdparty/chromium/device/udev_linux/udev?_loader.cc
+
+      sed -i -e '/libpci_loader.*Load/s!"\(libpci\.so\)!"${pciutils}/lib/\1!' \
+        src/3rdparty/chromium/gpu/config/gpu_info_collector_linux.cc
+    ''
+    + optionalString stdenv.isDarwin (''
+      substituteInPlace src/core/config/mac_osx.pri \
+        --replace /usr ${stdenv.cc}
+    ''
+    + (optionalString (lib.versionAtLeast qtCompatVersion "5.11") ''
+      substituteInPlace src/3rdparty/chromium/third_party/crashpad/crashpad/util/BUILD.gn \
+        --replace '$sysroot/usr' "${darwin.xnu}"
+    '')
+    + ''
+
+    cat <<EOF > src/3rdparty/chromium/build/mac/find_sdk.py
+#!/usr/bin/env python
+print("${darwin.apple_sdk.sdk}")
+print("10.12.0")
+EOF
+
+    cat <<EOF > src/3rdparty/chromium/build/config/mac/sdk_info.py
+#!/usr/bin/env python
+print('xcode_version="0910"')
+print('xcode_version_int=910')
+print('xcode_build="9B55"')
+print('machine_os_build="17E199"')
+print('sdk_path=""')
+print('sdk_version="10.10"')
+print('sdk_platform_path=""')
+print('sdk_build="17B41"')
+EOF
+
+    # Apple has some secret stuff they don't share with OpenBSM
+    substituteInPlace src/3rdparty/chromium/base/mac/mach_port_broker.mm \
+      --replace "audit_token_to_pid(msg.trailer.msgh_audit)" "msg.trailer.msgh_audit.val[5]"
+
+    substituteInPlace src/3rdparty/chromium/sandbox/mac/BUILD.gn \
+      --replace 'libs = [ "sandbox" ]' 'libs = [ "/usr/lib/libsandbox.1.dylib" ]'
+    '');
+
+  NIX_CFLAGS_COMPILE =
+  # it fails when compiled with -march=sandybridge https://github.com/NixOS/nixpkgs/pull/59148#discussion_r276696940
+  # TODO: investigate and fix properly
+    lib.optionals (stdenv.hostPlatform.platform.gcc.arch or "" == "sandybridge") [ "-march=westmere" ] ++
+    lib.optionals stdenv.isDarwin [
+      "-DMAC_OS_X_VERSION_MAX_ALLOWED=MAC_OS_X_VERSION_10_10"
+      "-DMAC_OS_X_VERSION_MIN_REQUIRED=MAC_OS_X_VERSION_10_10"
+
+      #
+      # Prevent errors like
+      # /nix/store/xxx-apple-framework-CoreData/Library/Frameworks/CoreData.framework/Headers/NSEntityDescription.h:51:7:
+      # error: pointer to non-const type 'id' with no explicit ownership
+      #     id** _kvcPropertyAccessors;
+      #
+      # TODO remove when new Apple SDK is in
+      #
+      "-fno-objc-arc"
+    ];
+
+  preConfigure = ''
+    export NINJAFLAGS=-j$NIX_BUILD_CORES
+
+    if [ -d "$PWD/tools/qmake" ]; then
+        QMAKEPATH="$PWD/tools/qmake''${QMAKEPATH:+:}$QMAKEPATH"
+    fi
+   '';
+
+  qmakeFlags = if stdenv.hostPlatform.isAarch32 || stdenv.hostPlatform.isAarch64
+    then [ "--" "-system-ffmpeg" ] ++ optional enableProprietaryCodecs "-proprietary-codecs"
+    else optional enableProprietaryCodecs "-- -proprietary-codecs";
+
+  propagatedBuildInputs = [
+    # Image formats
+    libjpeg libpng libtiff libwebp
+
+    # Video formats
+    srtp libvpx
+
+    # Audio formats
+    libopus
+
+    # Text rendering
+    harfbuzz icu
+
+    libevent
+  ] ++ optionals (stdenv.hostPlatform.isAarch32 || stdenv.hostPlatform.isAarch64) [
+    ffmpeg
+  ] ++ optionals (!stdenv.isDarwin) [
+    dbus zlib minizip snappy nss protobuf jsoncpp
+
+    # Audio formats
+    alsaLib
+
+    # Text rendering
+    fontconfig freetype
+
+    libcap
+    pciutils
+
+    # X11 libs
+    xorg.xrandr libXScrnSaver libXcursor libXrandr xorg.libpciaccess libXtst
+    xorg.libXcomposite xorg.libXdamage libdrm
+  ]
+
+  # FIXME These dependencies shouldn't be needed but can't find a way
+  # around it. Chromium pulls this in while bootstrapping GN.
+  ++ lib.optionals stdenv.isDarwin (with darwin; with apple_sdk.frameworks; [
+    libobjc
+    cctools
+
+    # frameworks
+    ApplicationServices
+    AVFoundation
+    Foundation
+    ForceFeedback
+    GameController
+    AppKit
+    ImageCaptureCore
+    CoreBluetooth
+    IOBluetooth
+    CoreWLAN
+    Quartz
+    Cocoa
+
+    openbsm
+    libunwind
+  ]);
+
+  buildInputs = optionals stdenv.isDarwin (with darwin; [
+    cups
+
+    # For sandbox.h include
+    (runCommand "MacOS_SDK_sandbox.h" {} ''
+      install -Dm444 "${lib.getDev darwin.apple_sdk.sdk}"/include/sandbox.h "$out"/include/sandbox.h
+    '')
+
+    # For:
+    # _NSDefaultRunLoopMode
+    # _OBJC_CLASS_$_NSDate
+    # _OBJC_CLASS_$_NSDictionary
+    # _OBJC_CLASS_$_NSRunLoop
+    # _OBJC_CLASS_$_NSURL
+    darwin.cf-private
+  ]);
+
+  __impureHostDeps = optional stdenv.isDarwin "/usr/lib/libsandbox.1.dylib";
+
+  dontUseNinjaBuild = true;
+  dontUseNinjaInstall = true;
+  dontUseXcbuild = true;
+
+  postInstall = lib.optionalString stdenv.isLinux ''
+    cat > $out/libexec/qt.conf <<EOF
+    [Paths]
+    Prefix = ..
+    EOF
+  '';
+
+  meta = with lib; {
+    description = "A web engine based on the Chromium web browser";
+    maintainers = with maintainers; [ matthewbauer ];
+    platforms = platforms.unix;
+    broken = qt56; # 2018-09-13, no successful build since 2018-04-25
+  };
+
+}
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/modules/qtwebglplugin.nix b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtwebglplugin.nix
new file mode 100644
index 000000000000..444d0c1beae8
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtwebglplugin.nix
@@ -0,0 +1,6 @@
+{ qtModule, qtbase, qtwebsockets }:
+
+qtModule {
+  name = "qtwebglplugin";
+  qtInputs = [ qtbase qtwebsockets ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/modules/qtwebkit.nix b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtwebkit.nix
new file mode 100644
index 000000000000..2a474ab0ffea
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtwebkit.nix
@@ -0,0 +1,72 @@
+{ qtModule, stdenv, lib, fetchurl
+, qtbase, qtdeclarative, qtlocation, qtmultimedia, qtsensors, qtwebchannel
+, fontconfig, gdk_pixbuf, gtk2, libwebp, libxml2, libxslt
+, sqlite, systemd, glib, gst_all_1, cmake
+, bison2, flex, gdb, gperf, perl, pkgconfig, python2, ruby
+, darwin
+, flashplayerFix ? false
+}:
+
+let
+  inherit (lib) optional optionals getDev getLib;
+  hyphen = stdenv.mkDerivation rec {
+    name = "hyphen-2.8.8";
+    src = fetchurl {
+      url = "http://dev-www.libreoffice.org/src/5ade6ae2a99bc1e9e57031ca88d36dad-${name}.tar.gz";
+      sha256 = "304636d4eccd81a14b6914d07b84c79ebb815288c76fe027b9ebff6ff24d5705";
+    };
+    postPatch = ''
+      patchShebangs tests
+    '';
+    buildInputs = [ perl ];
+  };
+  usingAnnulenWebkitFork = lib.versionAtLeast qtbase.version "5.11.0";
+in
+qtModule {
+  name = "qtwebkit";
+  qtInputs = [ qtbase qtdeclarative qtlocation qtsensors ]
+    ++ optional (stdenv.isDarwin && lib.versionAtLeast qtbase.version "5.9.0") qtmultimedia
+    ++ optional usingAnnulenWebkitFork qtwebchannel;
+  buildInputs = [ fontconfig libwebp libxml2 libxslt sqlite glib gst_all_1.gstreamer gst_all_1.gst-plugins-base ]
+    ++ optionals (stdenv.isDarwin) (with darwin; with apple_sdk.frameworks; [ cf-private ICU OpenGL ])
+    ++ optional usingAnnulenWebkitFork hyphen;
+  nativeBuildInputs = [
+    bison2 flex gdb gperf perl pkgconfig python2 ruby
+  ] ++ optional usingAnnulenWebkitFork cmake;
+
+  cmakeFlags = optionals usingAnnulenWebkitFork ([ "-DPORT=Qt" ]
+    ++ optionals stdenv.isDarwin [
+      "-DQt5Multimedia_DIR=${getDev qtmultimedia}/lib/cmake/Qt5Multimedia"
+      "-DQt5MultimediaWidgets_DIR=${getDev qtmultimedia}/lib/cmake/Qt5MultimediaWidgets"
+      "-DMACOS_FORCE_SYSTEM_XML_LIBRARIES=OFF"
+    ]);
+
+  # QtWebKit overrides qmake's default_pre and default_post features,
+  # so its custom qmake files must be found first at the front of QMAKEPATH.
+  preConfigure = stdenv.lib.optionalString (!usingAnnulenWebkitFork) ''
+    QMAKEPATH="$PWD/Tools/qmake''${QMAKEPATH:+:}$QMAKEPATH"
+    fixQtBuiltinPaths . '*.pr?'
+    # Fix hydra's "Log limit exceeded"
+    export qmakeFlags="$qmakeFlags CONFIG+=silent"
+  '';
+
+  NIX_CFLAGS_COMPILE =
+    # with gcc7 this warning blows the log over Hydra's limit
+    [ "-Wno-expansion-to-defined" ]
+    # with clang this warning blows the log over Hydra's limit
+    ++ optional stdenv.isDarwin "-Wno-inconsistent-missing-override"
+    ++ optionals flashplayerFix
+      [
+        ''-DNIXPKGS_LIBGTK2="${getLib gtk2}/lib/libgtk-x11-2.0"''
+        # this file used to exist in gdk_pixbuf?
+        ''-DNIXPKGS_LIBGDK2="${getLib gtk2}/lib/libgdk-x11-2.0"''
+      ]
+    ++ optional (!stdenv.isDarwin) ''-DNIXPKGS_LIBUDEV="${getLib systemd}/lib/libudev"'';
+
+  doCheck = false; # fails 13 out of 13 tests (ctest)
+
+  # Hack to avoid TMPDIR in RPATHs.
+  preFixup = ''rm -rf "$(pwd)" && mkdir "$(pwd)" '';
+
+  meta.maintainers = with stdenv.lib.maintainers; [ abbradar periklis ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/modules/qtwebsockets.nix b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtwebsockets.nix
new file mode 100644
index 000000000000..ad5e7625f289
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtwebsockets.nix
@@ -0,0 +1,7 @@
+{ qtModule, qtbase, qtdeclarative }:
+
+qtModule {
+  name = "qtwebsockets";
+  qtInputs = [ qtbase qtdeclarative ];
+  outputs = [ "out" "dev" "bin" ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/modules/qtwebview.nix b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtwebview.nix
new file mode 100644
index 000000000000..6d5274cbc586
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtwebview.nix
@@ -0,0 +1,20 @@
+{ darwin, stdenv, qtModule, qtdeclarative, qtwebengine }:
+
+with stdenv.lib;
+ 
+qtModule {
+  name = "qtwebview";
+  qtInputs = [ qtdeclarative qtwebengine ];
+  buildInputs = optional (stdenv.isDarwin) [
+    darwin.apple_sdk.frameworks.CoreFoundation
+    darwin.apple_sdk.frameworks.WebKit
+
+    # For:
+    # _OBJC_CLASS_$_NSArray
+    # _OBJC_CLASS_$_NSDate
+    # _OBJC_CLASS_$_NSURL
+    darwin.cf-private
+  ];
+  outputs = [ "out" "dev" "bin" ];
+  NIX_LDFLAGS = optionalString stdenv.isDarwin "-framework CoreFoundation -framework WebKit";
+}
\ No newline at end of file
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/modules/qtx11extras.nix b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtx11extras.nix
new file mode 100644
index 000000000000..4d431fee278b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtx11extras.nix
@@ -0,0 +1,6 @@
+{ qtModule, qtbase }:
+
+qtModule {
+  name = "qtx11extras";
+  qtInputs = [ qtbase ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/modules/qtxmlpatterns.nix b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtxmlpatterns.nix
new file mode 100644
index 000000000000..7ac922421f08
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtxmlpatterns.nix
@@ -0,0 +1,7 @@
+{ qtModule, qtbase, qtdeclarative }:
+
+qtModule {
+  name = "qtxmlpatterns";
+  qtInputs = [ qtbase qtdeclarative ];
+  devTools = [ "bin/xmlpatterns" "bin/xmlpatternsvalidator" ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/qt-env.nix b/nixpkgs/pkgs/development/libraries/qt-5/qt-env.nix
new file mode 100644
index 000000000000..da56c07779b9
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/qt-env.nix
@@ -0,0 +1,21 @@
+{ buildEnv, qtbase }: name: paths:
+
+buildEnv {
+  inherit name;
+  paths = [ qtbase ] ++ paths;
+
+  pathsToLink = [ "/bin" "/mkspecs" "/include" "/lib" "/share" ];
+  extraOutputsToInstall = [ "dev" ];
+
+  postBuild = ''
+    rm "$out/bin/qmake"
+    cp "${qtbase.dev}/bin/qmake" "$out/bin"
+    cat >"$out/bin/qt.conf" <<EOF
+    [Paths]
+    Prefix = $out
+    Plugins = ${qtbase.qtPluginPrefix}
+    Qml2Imports = ${qtbase.qtQmlPrefix}
+    Documentation = ${qtbase.qtDocPrefix}
+    EOF
+  '';
+}
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/qtModule.nix b/nixpkgs/pkgs/development/libraries/qt-5/qtModule.nix
new file mode 100644
index 000000000000..84a9d30918b1
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/qtModule.nix
@@ -0,0 +1,59 @@
+{ lib, mkDerivation, perl }:
+
+let inherit (lib) licenses maintainers platforms; in
+
+{ self, srcs, patches }:
+
+args:
+
+let
+  inherit (args) name;
+  version = args.version or srcs."${name}".version;
+  src = args.src or srcs."${name}".src;
+in
+
+mkDerivation (args // {
+  name = "${name}-${version}";
+  inherit src;
+  patches = args.patches or patches."${name}" or [];
+
+  nativeBuildInputs = (args.nativeBuildInputs or []) ++ [ perl self.qmake ];
+  propagatedBuildInputs = args.qtInputs ++ (args.propagatedBuildInputs or []);
+
+  outputs = args.outputs or [ "out" "dev" ];
+  setOutputFlags = args.setOutputFlags or false;
+
+  preHook = ''
+    . ${./hooks/move-qt-dev-tools.sh}
+    . ${./hooks/fix-qt-builtin-paths.sh}
+  '';
+
+  preConfigure = ''
+    ${args.preConfigure or ""}
+
+    fixQtBuiltinPaths . '*.pr?'
+  '';
+
+  postFixup = ''
+    if [ -d "''${!outputDev}/lib/pkgconfig" ]; then
+        find "''${!outputDev}/lib/pkgconfig" -name '*.pc' | while read pc; do
+            sed -i "$pc" \
+                -e "/^prefix=/ c prefix=''${!outputLib}" \
+                -e "/^exec_prefix=/ c exec_prefix=''${!outputBin}" \
+                -e "/^includedir=/ c includedir=''${!outputDev}/include"
+        done
+    fi
+
+    moveQtDevTools
+
+    ${args.postFixup or ""}
+  '';
+
+  meta = {
+    homepage = http://www.qt.io;
+    description = "A cross-platform application framework for C++";
+    license = with licenses; [ fdl13 gpl2 lgpl21 lgpl3 ];
+    maintainers = with maintainers; [ qknight ttuegel periklis bkchr ];
+    platforms = platforms.unix;
+  } // (args.meta or {});
+})
diff --git a/nixpkgs/pkgs/development/libraries/qt-mobility/default.nix b/nixpkgs/pkgs/development/libraries/qt-mobility/default.nix
new file mode 100644
index 000000000000..ae99035d2267
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-mobility/default.nix
@@ -0,0 +1,54 @@
+{ stdenv, fetchFromGitHub, qt4, libX11, coreutils, bluez, perl }:
+# possible additional dependencies: pulseaudio udev networkmanager immerson qmf
+
+stdenv.mkDerivation rec {
+  version = "1.2.0";
+  name = "qt-mobility-${version}";
+  src = fetchFromGitHub {
+    owner = "qtproject";
+    repo = "qt-mobility";
+    rev = "v${version}";
+    sha256 = "14713pbscysd6d0b9rgm7gg145jzwvgdn22778pf2v13qzvfmy1i";
+  };
+
+  NIX_CFLAGS_COMPILE="-fpermissive";
+
+  configurePhase = ''
+    ./configure -prefix $out
+  '';
+
+  # we need to prevent the 'make install' to want to write to ${qt4}!
+  # according to thiago#qt@freenode these are used for the QML engine
+  preBuild = ''
+    for i in connectivity contacts feedback gallery location multimedia organizer publishsubscribe sensors serviceframework systeminfo; do
+      substituteInPlace plugins/declarative/$i/Makefile --replace "${qt4}/lib/qt4/imports/" "$out/lib/qt4/imports/"
+    done
+  '';
+
+  # Features files (*.prf) are not installed on nixos
+  # https://bugreports.qt-project.org/browse/QTMOBILITY-1085
+  #  - features/mobility.prf (/tmp/nix-build-9kh12nhf9cyplfwiws96gz414v6wgl67-qt-mobility-1.2.0.drv-0/qt-mobility-opensource-src-1.2.0)
+
+  patchPhase = ''
+    # required to make the configure script work
+    substituteInPlace configure --replace "/bin/pwd" "${coreutils}/bin/pwd"
+
+    # required to make /include generator work
+    substituteInPlace bin/syncheaders --replace "/usr/bin/perl" "${perl}/bin/perl"
+
+    # required to make the -prefix variable parsing work
+    substituteInPlace bin/pathhelper --replace "/usr/bin/perl" "${perl}/bin/perl"
+  '';
+
+  buildInputs = [ qt4 libX11 bluez perl ];
+
+  meta = with stdenv.lib; {
+    description = "Qt Mobility";
+    homepage = http://qt.nokia.com/products/qt-addons/mobility;
+    maintainers = [ maintainers.qknight ];
+    platforms = platforms.linux;
+    license = with licenses; [ bsd3 fdl13 gpl3 lgpl21 ];
+  };
+}
+
+
diff --git a/nixpkgs/pkgs/development/libraries/qtinstaller/default.nix b/nixpkgs/pkgs/development/libraries/qtinstaller/default.nix
new file mode 100644
index 000000000000..1578593b8aea
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qtinstaller/default.nix
@@ -0,0 +1,46 @@
+{ stdenv, fetchurl, qtdeclarative , qttools, qtbase, qmake }:
+
+stdenv.mkDerivation rec {
+  name = "qtinstaller-${version}";
+
+  propagatedBuildInputs = [ qtdeclarative qttools ];
+  nativeBuildInputs = [ qmake ];
+
+  version = "2.0.3";
+  src = fetchurl {
+    url = "http://download.qt.io/official_releases/qt-installer-framework/${version}/qt-installer-framework-opensource-${version}-src.tar.gz";
+    sha256 = "003gwjg02isw8qjyka377g1ahlisfyi44l6xfa4hvvdgqqq0hy2f";
+    name = "qt-installer-framework-opensource-src-${version}.tar.gz";
+  };
+
+  outputs = [ "out" "dev" "doc" ];
+
+  setOutputFlags = false;
+  enableParallelBuilding = true;
+  NIX_QT_SUBMODULE = true;
+
+  installPhase = ''
+    mkdir -p $out/{bin,lib,share/qt-installer-framework}
+    cp -a bin/{archivegen,binarycreator,devtool,installerbase,repogen} $out/bin
+    cp -a lib/{libinstaller.so*,lib7z.a} $out/lib
+    cp -a examples $out/share/qt-installer-framework/
+  '';
+
+  postFixup = ''
+    moveToOutput "bin/archivegen" "$out"
+    moveToOutput "bin/binarycreator" "$out"
+    moveToOutput "bin/devtool" "$out"
+    moveToOutput "bin/installerbase" "$out"
+    moveToOutput "bin/repogen" "$out"
+    moveToOutput "share" "$doc"
+    moveToOutput "lib/libinstaller.so" "$out"
+    moveToOutput "lib/libinstaller.so.1" "$out"
+    moveToOutput "lib/libinstaller.so.1.0" "$out"
+    moveToOutput "lib/libinstaller.so.1.0.0" "$out"
+  '';
+
+  meta = {
+    description = ''Qt installer framework'';
+    inherit (qtbase.meta) platforms license homepage;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/qtkeychain/0001-Fixes-build-with-Qt4.patch b/nixpkgs/pkgs/development/libraries/qtkeychain/0001-Fixes-build-with-Qt4.patch
new file mode 100644
index 000000000000..4cd7214e61e2
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qtkeychain/0001-Fixes-build-with-Qt4.patch
@@ -0,0 +1,25 @@
+From f72e5b67ee1137a0ccd57db5d077a197b01b3cdc Mon Sep 17 00:00:00 2001
+From: Samuel Dionne-Riel <samuel@dionne-riel.com>
+Date: Tue, 4 Sep 2018 23:19:29 -0400
+Subject: [PATCH] Fixes build with Qt4.
+
+---
+ keychain_unix.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/keychain_unix.cpp b/keychain_unix.cpp
+index 30b26c3..b27ebef 100644
+--- a/keychain_unix.cpp
++++ b/keychain_unix.cpp
+@@ -91,7 +91,7 @@ static bool isKwallet5Available()
+     // a wallet can be opened.
+ 
+     iface.setTimeout(500);
+-    QDBusMessage reply = iface.call(QStringLiteral("networkWallet"));
++    QDBusMessage reply = iface.call("networkWallet");
+     return reply.type() == QDBusMessage::ReplyMessage;
+ }
+ 
+-- 
+2.16.4
+
diff --git a/nixpkgs/pkgs/development/libraries/qtkeychain/default.nix b/nixpkgs/pkgs/development/libraries/qtkeychain/default.nix
new file mode 100644
index 000000000000..3de84d859111
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qtkeychain/default.nix
@@ -0,0 +1,43 @@
+{ stdenv, fetchFromGitHub, cmake, pkgconfig, qt4 ? null
+, withQt5 ? false, qtbase ? null, qttools ? null
+, darwin ? null
+, libsecret
+}:
+
+assert withQt5 -> qtbase != null;
+assert withQt5 -> qttools != null;
+assert stdenv.isDarwin -> darwin != null;
+
+stdenv.mkDerivation rec {
+  name = "qtkeychain-${if withQt5 then "qt5" else "qt4"}-${version}";
+  version = "0.9.1";            # verify after nix-build with `grep -R "set(PACKAGE_VERSION " result/`
+
+  src = fetchFromGitHub {
+    owner = "frankosterfeld";
+    repo = "qtkeychain";
+    rev = "v${version}";
+    sha256 = "0h4wgngn2yl35hapbjs24amkjfbzsvnna4ixfhn87snjnq5lmjbc"; # v0.9.1
+  };
+
+  patches = if withQt5 then null else [ ./0001-Fixes-build-with-Qt4.patch ];
+
+  cmakeFlags = [ "-DQT_TRANSLATIONS_DIR=share/qt/translations" ];
+
+  nativeBuildInputs = [ cmake ]
+    ++ stdenv.lib.optional (!stdenv.isDarwin) [ pkgconfig ] # for finding libsecret
+  ;
+
+  buildInputs = stdenv.lib.optional (!stdenv.isDarwin) [ libsecret ]
+    ++ (if withQt5 then [ qtbase qttools ] else [ qt4 ])
+    ++ stdenv.lib.optional stdenv.isDarwin (with darwin.apple_sdk.frameworks; [
+      CoreFoundation Security
+    ])
+  ;
+
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/qtscriptgenerator/default.nix b/nixpkgs/pkgs/development/libraries/qtscriptgenerator/default.nix
new file mode 100644
index 000000000000..88591e880dee
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qtscriptgenerator/default.nix
@@ -0,0 +1,48 @@
+{ stdenv, fetchurl, qt4 }:
+
+stdenv.mkDerivation {
+  name = "qtscriptgenerator-0.1.0";
+  src = fetchurl {
+    url = "https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/qtscriptgenerator/qtscriptgenerator-src-0.1.0.tar.gz";
+    sha256 = "0h8zjh38n2wfz7jld0jz6a09y66dbsd2jhm4f2024qfgcmxcabj6";
+  };
+  buildInputs = [ qt4 ];
+
+  patches = [ ./qtscriptgenerator.gcc-4.4.patch ./qt-4.8.patch ];
+
+  postPatch = ''
+    # remove phonon stuff which causes errors (thanks to Gentoo bug reports)
+    sed -i "/typesystem_phonon.xml/d" generator/generator.qrc
+    sed -i "/qtscript_phonon/d" qtbindings/qtbindings.pro
+  '';
+
+  configurePhase = ''
+    ( cd generator; qmake )
+    ( cd qtbindings; qmake )
+  '';
+
+  buildPhase = ''
+    makeFlags="SHELL=$SHELL ''${enableParallelBuilding:+-j$NIX_BUILD_CORES -l$NIX_BUILD_CORES}"
+    make $makeFlags -C generator
+
+    # Set QTDIR, see https://code.google.com/archive/p/qtscriptgenerator/issues/38
+    ( cd generator; QTDIR=${qt4} ./generator )
+    make $makeFlags -C qtbindings
+  '';
+
+  installPhase = ''
+    mkdir -p $out/lib/qt4/plugins/script
+    cp -av plugins/script/* $out/lib/qt4/plugins/script
+  '';
+
+  enableParallelBuilding = true;
+
+  hardeningDisable = [ "format" ];
+
+  meta = {
+    description = "QtScript bindings generator";
+    homepage = https://code.qt.io/cgit/qt-labs/qtscriptgenerator.git/;
+    inherit (qt4.meta) platforms;
+    license = stdenv.lib.licenses.lgpl21;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/qtscriptgenerator/qt-4.8.patch b/nixpkgs/pkgs/development/libraries/qtscriptgenerator/qt-4.8.patch
new file mode 100644
index 000000000000..8fe643e2c98f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qtscriptgenerator/qt-4.8.patch
@@ -0,0 +1,23 @@
+Origin: http://src.fedoraproject.org/gitweb/?p=qtscriptgenerator.git;a=blob_plain;f=qtscriptgenerator-src-0.1.0-no_QFileOpenEvent.patch;h=f397b5ab13bcfc268e6d7b7ba4c6bc66ae38b5c0;hb=HEAD
+diff -up qtscriptgenerator-src-0.1.0/generator/typesystem_gui-common.xml.no_QFileOpenEvent qtscriptgenerator-src-0.1.0/generator/typesystem_gui-common.xml
+--- qtscriptgenerator-src-0.1.0/generator/typesystem_gui-common.xml.no_QFileOpenEvent	2011-12-22 11:34:52.615149619 -0600
++++ qtscriptgenerator-src-0.1.0/generator/typesystem_gui-common.xml	2011-12-22 11:35:31.808659632 -0600
+@@ -2233,7 +2233,6 @@
+     
+                
+   </object-type>
+-  <object-type name="QFileOpenEvent" polymorphic-id-expression="%1-&gt;type() == QEvent::FileOpen"/>
+   <object-type name="QFocusEvent" polymorphic-id-expression="%1-&gt;type() == QEvent::FocusIn || %1-&gt;type() == QEvent::FocusOut">
+         <modify-function signature="reason()const">
+             <remove/>
+diff -up qtscriptgenerator-src-0.1.0/generator/typesystem_gui.xml.no_QFileOpenEvent qtscriptgenerator-src-0.1.0/generator/typesystem_gui.xml
+--- qtscriptgenerator-src-0.1.0/generator/typesystem_gui.xml.no_QFileOpenEvent	2009-02-20 05:42:24.000000000 -0600
++++ qtscriptgenerator-src-0.1.0/generator/typesystem_gui.xml	2011-12-22 11:33:43.058019203 -0600
+@@ -2555,7 +2555,6 @@
+     
+                
+   </object-type>
+-  <object-type name="QFileOpenEvent" polymorphic-id-expression="%1-&gt;type() == QEvent::FileOpen"/>
+   <object-type name="QFocusEvent" polymorphic-id-expression="%1-&gt;type() == QEvent::FocusIn || %1-&gt;type() == QEvent::FocusOut">
+         <modify-function signature="reason()const">
+             <remove/>
diff --git a/nixpkgs/pkgs/development/libraries/qtscriptgenerator/qtscriptgenerator.gcc-4.4.patch b/nixpkgs/pkgs/development/libraries/qtscriptgenerator/qtscriptgenerator.gcc-4.4.patch
new file mode 100644
index 000000000000..c0a710efb157
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qtscriptgenerator/qtscriptgenerator.gcc-4.4.patch
@@ -0,0 +1,11 @@
+diff -uNr generator.orig/parser/rpp/pp.h generator/parser/rpp/pp.h
+--- qtscriptgenerator-src-0.1.0/generator.orig/parser/rpp/pp.h	2008-12-05 11:01:44.000000000 +0100
++++ qtscriptgenerator-src-0.1.0/generator/parser/rpp/pp.h	2008-12-13 10:42:22.000000000 +0100
+@@ -30,6 +30,7 @@
+ #include <cctype>
+ 
+ #include <fcntl.h>
++#include <cstdio>
+ 
+ #ifdef HAVE_MMAP
+ #  include <sys/mman.h>
diff --git a/nixpkgs/pkgs/development/libraries/qtstyleplugin-kvantum-qt4/default.nix b/nixpkgs/pkgs/development/libraries/qtstyleplugin-kvantum-qt4/default.nix
new file mode 100644
index 000000000000..88330712dcd4
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qtstyleplugin-kvantum-qt4/default.nix
@@ -0,0 +1,38 @@
+{ stdenv, fetchFromGitHub, qmake4Hook , qt4, libX11, libXext }:
+
+stdenv.mkDerivation rec {
+  pname = "qtstyleplugin-kvantum-qt4";
+  version = "0.11.0";
+
+  src = fetchFromGitHub {
+    owner = "tsujan";
+    repo = "Kvantum";
+    rev = "V${version}";
+    sha256 = "0aqlv7mj7r9vjm6pvb8pv3cyx35lgz8rjjas3k8wfdr3sqyyy25g";
+  };
+
+  nativeBuildInputs = [ qmake4Hook ];
+  buildInputs = [ qt4 libX11 libXext ];
+
+  postUnpack = "sourceRoot=\${sourceRoot}/Kvantum";
+
+  buildPhase = ''
+    qmake kvantum.pro
+    make
+  '';
+
+  installPhase = ''
+    mkdir $TMP/kvantum
+    make INSTALL_ROOT="$TMP/kvantum" install
+    mv $TMP/kvantum/usr/ $out
+    mv $TMP/kvantum/${qt4}/lib $out
+  '';
+
+  meta = with stdenv.lib; {
+    description = "SVG-based Qt4 theme engine";
+    homepage = "https://github.com/tsujan/Kvantum";
+    license = licenses.gpl2;
+    platforms = platforms.linux;
+    maintainers = [ maintainers.bugworm ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/qtstyleplugin-kvantum/default.nix b/nixpkgs/pkgs/development/libraries/qtstyleplugin-kvantum/default.nix
new file mode 100644
index 000000000000..dc11cb560910
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qtstyleplugin-kvantum/default.nix
@@ -0,0 +1,32 @@
+{ stdenv, fetchFromGitHub, qmake, qtbase, qtsvg, qtx11extras, kwindowsystem, libX11, libXext, qttools }:
+
+stdenv.mkDerivation rec {
+  pname = "qtstyleplugin-kvantum";
+  version = "0.11.0";
+
+  src = fetchFromGitHub {
+    owner = "tsujan";
+    repo = "Kvantum";
+    rev = "V${version}";
+    sha256 = "0aqlv7mj7r9vjm6pvb8pv3cyx35lgz8rjjas3k8wfdr3sqyyy25g";
+  };
+
+  nativeBuildInputs = [ qmake qttools ];
+  buildInputs = [ qtbase qtsvg qtx11extras kwindowsystem libX11 libXext  ];
+
+  sourceRoot = "source/Kvantum";
+
+  postPatch = ''
+    # Fix plugin dir
+    substituteInPlace style/style.pro \
+      --replace "\$\$[QT_INSTALL_PLUGINS]" "$out/$qtPluginPrefix"
+  '';
+
+  meta = with stdenv.lib; {
+    description = "SVG-based Qt5 theme engine plus a config tool and extra themes";
+    homepage = "https://github.com/tsujan/Kvantum";
+    license = licenses.gpl3;
+    platforms = platforms.linux;
+    maintainers = [ maintainers.bugworm ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/qtstyleplugins/default.nix b/nixpkgs/pkgs/development/libraries/qtstyleplugins/default.nix
new file mode 100644
index 000000000000..b94cdd22f7f0
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qtstyleplugins/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchFromGitHub, qmake, pkgconfig, gtk2 }:
+
+stdenv.mkDerivation rec {
+  name = "qtstyleplugins-2017-03-11";
+
+  src = fetchFromGitHub {
+    owner = "qt";
+    repo = "qtstyleplugins";
+    rev = "335dbece103e2cbf6c7cf819ab6672c2956b17b3";
+    sha256 = "085wyn85nrmzr8nv5zv7fi2kqf8rp1gnd30h72s30j55xvhmxvmy";
+  };
+
+  nativeBuildInputs = [ pkgconfig qmake ];
+  buildInputs = [ gtk2 ];
+
+  meta = with stdenv.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;
+    maintainers = [ maintainers.gnidorah ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/qtwebkit-plugins/default.nix b/nixpkgs/pkgs/development/libraries/qtwebkit-plugins/default.nix
new file mode 100644
index 000000000000..46a9785739a6
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qtwebkit-plugins/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchFromGitHub, qmake, qtwebkit, hunspell }:
+
+stdenv.mkDerivation {
+  name = "qtwebkit-plugins-2017-01-25";
+
+  src = fetchFromGitHub {
+    owner = "QupZilla";
+    repo = "qtwebkit-plugins";
+    rev = "b58ee9d5b31977491662aa4e8bee16404638bf14";
+    sha256 = "04wvlhdj45g1v1a3zl0pkf9r72i22h1br10lhhrgad7ypym974gw";
+  };
+
+  nativeBuildInputs = [ qmake ];
+
+  buildInputs = [ qtwebkit hunspell ];
+
+  postPatch = ''
+    sed -i "s,-lhunspell,-lhunspell-${stdenv.lib.versions.majorMinor hunspell.version}," src/spellcheck/spellcheck.pri
+    sed -i "s,\$\$\[QT_INSTALL_PLUGINS\],$out/$qtPluginPrefix," src/src.pro
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Spell checking plugin using Hunspell and HTML5 Notifications plugin for QtWebKit";
+    homepage = https://github.com/QupZilla/qtwebkit-plugins;
+    license = licenses.gpl3;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ abbradar ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/quazip/default.nix b/nixpkgs/pkgs/development/libraries/quazip/default.nix
new file mode 100644
index 000000000000..cac861fe2248
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/quazip/default.nix
@@ -0,0 +1,24 @@
+{ fetchFromGitHub, stdenv, zlib, qtbase, cmake, fixDarwinDylibNames }:
+
+stdenv.mkDerivation rec {
+  pname = "quazip";
+  version = "0.8.1";
+
+  src = fetchFromGitHub {
+    owner = "stachenov";
+    repo = pname;
+    rev = "v${version}";
+    sha256 = "1g473gnsbkvxpsv8lbsmhspn7jnq86b05zzgqh11r581v8ndvz5s";
+  };
+
+  buildInputs = [ zlib qtbase ];
+  nativeBuildInputs = [ cmake ]
+    ++ stdenv.lib.optional stdenv.isDarwin fixDarwinDylibNames;
+
+  meta = with stdenv.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/
+    platforms = with platforms; linux ++ darwin;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/quesoglc/default.nix b/nixpkgs/pkgs/development/libraries/quesoglc/default.nix
new file mode 100644
index 000000000000..84be9876c1cb
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/quesoglc/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchurl, libGLU_combined, glew, freetype, fontconfig, fribidi, libX11 }:
+stdenv.mkDerivation rec {
+  pname = "quesoglc";
+  version = "0.7.2";
+  name = "${pname}-${version}";
+  src = fetchurl {
+    url = "mirror://sourceforge/${pname}/${name}.tar.bz2";
+    sha256 = "0cf9ljdzii5d4i2m23gdmf3kn521ljcldzq69lsdywjid3pg5zjl";
+  };
+  buildInputs = [ libGLU_combined glew freetype fontconfig fribidi libX11 ];
+  # FIXME: Configure fails to use system glew.
+  meta = with stdenv.lib; {
+    description = "A free implementation of the OpenGL Character Renderer";
+    longDescription = ''
+      QuesoGLC is a free (as in free speech) implementation of the OpenGL
+      Character Renderer (GLC). QuesoGLC is based on the FreeType library,
+      provides Unicode support and is designed to be easily ported to any
+      platform that supports both FreeType and the OpenGL API.
+    '';
+    homepage = http://quesoglc.sourceforge.net/;
+    license = licenses.lgpl21Plus;
+    maintainers = with maintainers; [ astsmtl ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/quickder/default.nix b/nixpkgs/pkgs/development/libraries/quickder/default.nix
new file mode 100644
index 000000000000..35d16ee5e19b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/quickder/default.nix
@@ -0,0 +1,59 @@
+{ stdenv, fetchFromGitHub, python2Packages, hexio
+, which, cmake, bash, arpa2cm, git, asn2quickder, pkgconfig }:
+
+stdenv.mkDerivation rec {
+  pname = "quickder";
+  name = "${pname}-${version}";
+  version = "1.2-6";
+
+  src = fetchFromGitHub {
+    sha256 = "00wifjydgmqw2i5vmr049visc3shjqccgzqynkmmhkjhs86ghzr6";
+    rev = "version-${version}";
+    owner = "vanrein";
+    repo = "quick-der";
+  };
+
+  buildInputs = with python2Packages; [
+    arpa2cm
+    asn1ate
+    bash
+    cmake
+    git
+    hexio
+    pyparsing
+    python
+    six
+    which
+    asn1ate
+    asn2quickder
+    pkgconfig
+  ];
+
+  postPatch = ''
+    substituteInPlace ./CMakeLists.txt \
+      --replace "get_version_from_git" "set (Quick-DER_VERSION 1.2) #"
+    substituteInPlace ./CMakeLists.txt \
+      --replace \$\{ARPA2CM_TOOLCHAIN_DIR} "$out/share/ARPA2CM/toolchain/"
+    patchShebangs python/scripts/
+  '';
+
+  cmakeFlags = [
+    "-DNO_TESTING=ON"
+    "-DARPA2CM_TOOLCHAIN_DIR=$out/share/ARPA2CM/toolchain/"
+    "-DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON"
+    "-DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=ON"
+    "-DPACKAGE_NO_PACKAGE_REGISTRY=ON"
+  ];
+
+  preConfigure = ''
+    export PREFIX=$out
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Quick (and Easy) DER, a Library for parsing ASN.1";
+    homepage = https://github.com/vanrein/quick-der;
+    license = licenses.bsd2;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ leenaars ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/qwt/6.nix b/nixpkgs/pkgs/development/libraries/qwt/6.nix
new file mode 100644
index 000000000000..6e0fa53aa828
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qwt/6.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchurl, qtbase, qtsvg, qttools, qmake }:
+
+stdenv.mkDerivation rec {
+  name = "qwt-6.1.2";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/qwt/${name}.tar.bz2";
+    sha256 = "031x4hz1jpbirv9k35rqb52bb9mf2w7qav89qv1yfw1r3n6z221b";
+  };
+
+  propagatedBuildInputs = [ qtbase qtsvg qttools ];
+  nativeBuildInputs = [ qmake ];
+
+  postPatch = ''
+    sed -e "s|QWT_INSTALL_PREFIX.*=.*|QWT_INSTALL_PREFIX = $out|g" -i qwtconfig.pri
+  '';
+
+  qmakeFlags = [ "-after doc.path=$out/share/doc/${name}" ];
+
+  meta = with stdenv.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;
+    platforms = platforms.unix;
+    maintainers = [ maintainers.bjornfor ];
+    branch = "6";
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/qwt/6_qt4.nix b/nixpkgs/pkgs/development/libraries/qwt/6_qt4.nix
new file mode 100644
index 000000000000..b6e0acb603d3
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qwt/6_qt4.nix
@@ -0,0 +1,41 @@
+{ stdenv, fetchurl, qt4, qmake4Hook, AGL }:
+
+stdenv.mkDerivation rec {
+  name = "qwt-6.1.4";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/qwt/${name}.tar.bz2";
+    sha256 = "1navkcnmn0qz8kzsyqmk32d929zl72l0b580w1ica7z5559j2a8m";
+  };
+
+  buildInputs = [
+    qt4
+  ] ++ stdenv.lib.optionals stdenv.isDarwin [ AGL ];
+
+  nativeBuildInputs = [ qmake4Hook ];
+
+  enableParallelBuilding = true;
+
+  postPatch = ''
+    sed -e "s|QWT_INSTALL_PREFIX.*=.*|QWT_INSTALL_PREFIX = $out|g" -i qwtconfig.pri
+  '';
+
+  # qwt.framework output includes a relative reference to itself, which breaks dependents
+  preFixup =
+    stdenv.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; {
+    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;
+    platforms = platforms.linux ++ platforms.darwin;
+    maintainers = [ maintainers.bjornfor ];
+    branch = "6";
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/qwt/default.nix b/nixpkgs/pkgs/development/libraries/qwt/default.nix
new file mode 100644
index 000000000000..f900de5e578b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qwt/default.nix
@@ -0,0 +1,31 @@
+{ stdenv, fetchurl, qt4, qmake4Hook }:
+
+stdenv.mkDerivation rec {
+  name = "qwt-5.2.3";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/qwt/${name}.tar.bz2";
+    sha256 = "1dqa096mm6n3bidfq2b67nmdsvsw4ndzzd1qhl6hn8skcwqazzip";
+  };
+
+  propagatedBuildInputs = [ qt4 ];
+  nativeBuildInputs = [ qmake4Hook ];
+
+  postPatch = ''
+    sed -e "s@\$\$\[QT_INSTALL_PLUGINS\]@$out/lib/qt4/plugins@" -i designer/designer.pro
+    sed -e "s|INSTALLBASE.*=.*|INSTALLBASE = $out|g" -i qwtconfig.pri
+  '';
+
+  preConfigure = ''
+    qmakeFlags="$qmakeFlags INSTALLBASE=$out -after doc.path=$out/share/doc/${name}"
+  '';
+
+  meta = with stdenv.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;
+    platforms = platforms.unix;
+    maintainers = [ maintainers.bjornfor ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/qxt/default.nix b/nixpkgs/pkgs/development/libraries/qxt/default.nix
new file mode 100644
index 000000000000..5ed05ec6b322
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qxt/default.nix
@@ -0,0 +1,34 @@
+{ stdenv, which, coreutils, fetchzip, qt4 }:
+
+stdenv.mkDerivation rec {
+  name = "qxt-${version}";
+  version = "0.6.2";
+  
+  src = fetchzip {
+    url = "https://bitbucket.org/libqxt/libqxt/get/v${version}.tar.gz";
+    sha256 = "0zmqfn0h8cpky7wgaaxlfh0l89r9r0isi87587kaicyap7a6kxwz";
+  };
+
+  buildInputs = [ qt4 which ];
+
+  patchPhase = ''
+    patchShebangs configure
+    substituteInPlace configure --replace "/bin/pwd" "${coreutils}/bin/pwd"
+  '';
+
+  prefixKey = "-prefix ";
+
+  meta = {
+    homepage = http://libqxt.org;
+    description = "An extension library for Qt";
+    longDescription = ''
+      An extension library for Qt providing a suite of cross-platform utility
+      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 ];
+    broken = true;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/rabbitmq-c/default.nix b/nixpkgs/pkgs/development/libraries/rabbitmq-c/default.nix
new file mode 100644
index 000000000000..286c5c868dff
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/rabbitmq-c/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, fetchFromGitHub, cmake, openssl, popt, xmlto }:
+
+stdenv.mkDerivation rec {
+  name = "rabbitmq-c-${version}";
+  version = "0.9.0";
+
+  src = fetchFromGitHub {
+    owner = "alanxz";
+    repo = "rabbitmq-c";
+    rev = "v${version}";
+    sha256 = "1mhzxyh9pmpxjjbyy8hd34gm39sxf73r1ldk8zjfsfbs26ggrppz";
+  };
+
+  buildInputs = [ cmake openssl popt xmlto ];
+
+  meta = with stdenv.lib; {
+    description = "RabbitMQ C AMQP client library";
+    homepage = https://github.com/alanxz/rabbitmq-c;
+    license = licenses.mit;
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/rabbitmq-java-client/default.nix b/nixpkgs/pkgs/development/libraries/rabbitmq-java-client/default.nix
new file mode 100644
index 000000000000..96a2347c50fa
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/rabbitmq-java-client/default.nix
@@ -0,0 +1,30 @@
+{ fetchurl, stdenv, ant, jdk, jre, python, makeWrapper }:
+
+stdenv.mkDerivation rec {
+  name = "rabbitmq-java-client-3.3.4";
+
+  src = fetchurl {
+    url = "https://www.rabbitmq.com/releases/rabbitmq-java-client/v3.3.4/rabbitmq-java-client-3.3.4.tar.gz";
+    sha256 = "03kspkgzzjsbq6f8yl2zj5m30qwgxv3l58hrbf6gcgxb5rpfk6sh";
+  };
+
+  buildInputs = [ ant jdk python makeWrapper ];
+
+  buildPhase = "ant dist";
+
+  installPhase = ''
+    mkdir -p $out/bin $out/share/java
+    cp build/lib/*.jar lib/*.jar $out/share/java
+
+    # There is a script in the source archive, but ours is cleaner
+    makeWrapper ${jre}/bin/java $out/bin/PerfTest \
+      --add-flags "-Djava.awt.headless=true -cp $out/share/java/\* com.rabbitmq.examples.PerfTest"
+  '';
+
+  meta = with stdenv.lib; {
+    description = "RabbitMQ Java client library which allows Java code to interface to AMQP servers";
+    homepage = http://www.rabbitmq.com/java-client.html;
+    license = with licenses; [ mpl11 gpl2 ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/range-v3/default.nix b/nixpkgs/pkgs/development/libraries/range-v3/default.nix
new file mode 100644
index 000000000000..256b756ed45d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/range-v3/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchFromGitHub, cmake }:
+
+stdenv.mkDerivation rec {
+  name = "range-v3-${version}";
+  version = "0.5.0";
+
+  src = fetchFromGitHub {
+    owner = "ericniebler";
+    repo = "range-v3";
+    rev = version;
+    sha256 = "0fzbpaa4vwlivi417zxm1d6v4lkp5c9f5bd706nn2fmw3zxjj815";
+  };
+
+  nativeBuildInputs = [ cmake ];
+
+  doCheck = true;
+  checkTarget = "test";
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    description = "Experimental range library for C++11/14/17";
+    homepage = https://github.com/ericniebler/range-v3;
+    license = licenses.boost;
+    platforms = platforms.all;
+    maintainers = with maintainers; [ xwvvvvwx ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/rapidcheck/default.nix b/nixpkgs/pkgs/development/libraries/rapidcheck/default.nix
new file mode 100644
index 000000000000..9d8ce8cef202
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/rapidcheck/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, cmake, fetchFromGitHub }:
+
+stdenv.mkDerivation rec{
+  name = "rapidcheck-${version}";
+  version = "unstable-2018-09-27";
+
+  src = fetchFromGitHub {
+    owner = "emil-e";
+    repo  = "rapidcheck";
+    rev   = "de54478fa35c0d9cea14ec0c5c9dfae906da524c";
+    sha256 = "0n8l0mlq9xqmpkgcj5xicicd1my2cfwxg25zdy8347dqkl1ppgbs";
+  };
+
+  nativeBuildInputs = [ cmake ];
+
+  postInstall = ''
+    cp ../extras/boost_test/include/rapidcheck/boost_test.h $out/include/rapidcheck
+  '';
+
+  meta = with stdenv.lib; {
+    description = "A C++ framework for property based testing inspired by QuickCheck";
+    inherit (src.meta) homepage;
+    maintainers = with maintainers; [ jb55 ];
+    license = licenses.bsd2;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/rapidjson/default.nix b/nixpkgs/pkgs/development/libraries/rapidjson/default.nix
new file mode 100644
index 000000000000..a1671aa3e0f9
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/rapidjson/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, lib, fetchFromGitHub, pkgconfig, cmake }:
+
+stdenv.mkDerivation rec {
+  name = "rapidjson-${version}";
+  version = "1.1.0";
+
+  src = fetchFromGitHub {
+    owner = "miloyip";
+    repo = "rapidjson";
+    rev = "v${version}";
+    sha256 = "1jixgb8w97l9gdh3inihz7avz7i770gy2j2irvvlyrq3wi41f5ab";
+  };
+
+  nativeBuildInputs = [ pkgconfig cmake ];
+
+  preConfigure = ''
+    substituteInPlace CMakeLists.txt --replace "-Werror" ""
+    substituteInPlace example/CMakeLists.txt --replace "-Werror" ""
+  '';
+
+  meta = with lib; {
+    description = "Fast JSON parser/generator for C++ with both SAX/DOM style API";
+    homepage = "http://rapidjson.org/";
+    license = licenses.mit;
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ cstrahan ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/rapidxml/default.nix b/nixpkgs/pkgs/development/libraries/rapidxml/default.nix
new file mode 100644
index 000000000000..99f880916907
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/rapidxml/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchurl, unzip }:
+
+stdenv.mkDerivation rec {
+  pname = "rapidxml";
+  version = "1.13";
+  name = "${pname}-${version}";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/${pname}/${name}.zip";
+    sha256 = "0w9mbdgshr6sh6a5jr10lkdycjyvapbj7wxwz8hbp0a96y3biw63";
+  };
+
+  nativeBuildInputs = [ unzip ];
+
+  installPhase = ''
+    mkdir -p $out/include/${pname}
+    cp * $out/include/${pname}
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Fast XML DOM-style parser in C++";
+    homepage = "http://rapidxml.sourceforge.net/";
+    license = licenses.boost;
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ cpages ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/rarian/default.nix b/nixpkgs/pkgs/development/libraries/rarian/default.nix
new file mode 100644
index 000000000000..bd79e3628a14
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/rarian/default.nix
@@ -0,0 +1,32 @@
+{stdenv, fetchurl, pkgconfig, perlPackages, libxml2, libxslt, docbook_xml_dtd_42, gnome3}:
+let
+  pname = "rarian";
+  version = "0.8.1";
+in stdenv.mkDerivation rec {
+  name = "${pname}-${version}";
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${name}.tar.gz";
+    sha256 = "aafe886d46e467eb3414e91fa9e42955bd4b618c3e19c42c773026b205a84577";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ libxml2 libxslt ]
+    ++ (with perlPackages; [ perl XMLParser ]);
+  configureFlags = [ "--with-xml-catalog=${docbook_xml_dtd_42}/xml/dtd/docbook/docbook.cat" ];
+
+  passthru = {
+    updateScript = gnome3.updateScript {
+      packageName = pname;
+      attrPath = "gnome3.${pname}";
+    };
+  };
+
+  meta = with stdenv.lib; {
+    description = "Documentation metadata library based on the proposed Freedesktop.org spec";
+    homepage = https://rarian.freedesktop.org/;
+    license = licenses.lgpl21Plus;
+    maintainers = gnome3.maintainers;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/rdkafka/default.nix b/nixpkgs/pkgs/development/libraries/rdkafka/default.nix
new file mode 100644
index 000000000000..840891d55ef9
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/rdkafka/default.nix
@@ -0,0 +1,30 @@
+{ stdenv, fetchFromGitHub, zlib, perl, pkgconfig, python, openssl }:
+
+stdenv.mkDerivation rec {
+  name = "rdkafka-${version}";
+  version = "1.0.0";
+
+  src = fetchFromGitHub {
+    owner = "edenhill";
+    repo = "librdkafka";
+    rev = "v${version}";
+    sha256 = "1k4lk2vvvni87brs3j51by3j69ff2892jiq2f4979sxncq0apzlg";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ zlib perl python openssl ];
+
+  NIX_CFLAGS_COMPILE = "-Wno-error=strict-overflow";
+
+  postPatch = ''
+    patchShebangs .
+  '';
+
+  meta = with stdenv.lib; {
+    description = "librdkafka - Apache Kafka C/C++ client library";
+    homepage = https://github.com/edenhill/librdkafka;
+    license = licenses.bsd2;
+    platforms = platforms.linux ++ platforms.darwin;
+    maintainers = with maintainers; [ boothead ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/re2/default.nix b/nixpkgs/pkgs/development/libraries/re2/default.nix
new file mode 100644
index 000000000000..a6a5fbed4fc5
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/re2/default.nix
@@ -0,0 +1,33 @@
+{ stdenv, fetchFromGitHub }:
+
+stdenv.mkDerivation rec {
+  name = "re2-${version}";
+  version = "20190401";
+
+  src = fetchFromGitHub {
+    owner = "google";
+    repo = "re2";
+    rev = "2019-04-01";
+    sha256 = "018b8z3fgcr02rmhxdz80r363k40938cbgmk1c9b46k6xkc4q0hd";
+  };
+
+  preConfigure = ''
+    substituteInPlace Makefile --replace "/usr/local" "$out"
+    # we're using gnu sed, even on darwin
+    substituteInPlace Makefile  --replace "SED_INPLACE=sed -i '''" "SED_INPLACE=sed -i"
+  '';
+
+  preCheck = "patchShebangs runtests";
+  doCheck = true;
+  checkTarget = "test";
+
+  doInstallCheck = true;
+  installCheckTarget = "testinstall";
+
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/readline/5.x.nix b/nixpkgs/pkgs/development/libraries/readline/5.x.nix
new file mode 100644
index 000000000000..84062408d45c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/readline/5.x.nix
@@ -0,0 +1,20 @@
+{ stdenv, fetchurl, ncurses }:
+
+stdenv.mkDerivation {
+  name = "readline-5.2";
+
+  src = fetchurl {
+    url = mirror://gnu/readline/readline-5.2.tar.gz;
+    sha256 = "0icz4hqqq8mlkwrpczyaha94kns0am9z0mh3a2913kg2msb8vs0j";
+  };
+
+  propagatedBuildInputs = [ncurses];
+
+  patches = stdenv.lib.optional stdenv.isDarwin ./shobj-darwin.patch;
+
+  meta = with stdenv.lib; {
+    branch = "5";
+    platforms = platforms.unix;
+    license = licenses.gpl2;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/readline/6.2.nix b/nixpkgs/pkgs/development/libraries/readline/6.2.nix
new file mode 100644
index 000000000000..54aa42439d97
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/readline/6.2.nix
@@ -0,0 +1,63 @@
+{ fetchurl, stdenv, ncurses
+}:
+
+stdenv.mkDerivation (rec {
+  name = "readline-6.2";
+
+  src = fetchurl {
+    url = "mirror://gnu/readline/${name}.tar.gz";
+    sha256 = "10ckm2bd2rkxhvdmj7nmbsylmihw0abwcsnxf8y27305183rd9kr";
+  };
+
+  propagatedBuildInputs = [ncurses];
+
+  patchFlags = "-p0";
+  patches =
+    [ ./link-against-ncurses.patch
+      ./no-arch_only.patch
+      ./clang.patch
+    ]
+    ++
+    (let
+       patch = nr: sha256:
+         fetchurl {
+           url = "mirror://gnu/readline/${name}-patches/readline62-${nr}";
+           inherit sha256;
+         };
+     in
+       import ./readline-6.2-patches.nix patch);
+
+  meta = {
+    description = "Library for interactive line editing";
+
+    longDescription = ''
+      The GNU Readline library provides a set of functions for use by
+      applications that allow users to edit command lines as they are
+      typed in.  Both Emacs and vi editing modes are available.  The
+      Readline library includes additional functions to maintain a
+      list of previously-entered command lines, to recall and perhaps
+      reedit those lines, and perform csh-like history expansion on
+      previous commands.
+
+      The history facilities are also placed into a separate library,
+      the History library, as part of the build process.  The History
+      library may be used without Readline in applications which
+      desire its capabilities.
+    '';
+
+    homepage = https://savannah.gnu.org/projects/readline/;
+
+    license = stdenv.lib.licenses.gpl3Plus;
+
+    maintainers = [ ];
+    branch = "6.2";
+    platforms = stdenv.lib.platforms.unix;
+  };
+}
+
+//
+
+# Don't run the native `strip' when cross-compiling.
+(if stdenv.hostPlatform != stdenv.buildPlatform
+ then { dontStrip = true; }
+ else { }))
diff --git a/nixpkgs/pkgs/development/libraries/readline/6.3.nix b/nixpkgs/pkgs/development/libraries/readline/6.3.nix
new file mode 100644
index 000000000000..f9a20a535cb3
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/readline/6.3.nix
@@ -0,0 +1,68 @@
+{ fetchurl, stdenv, ncurses }:
+
+stdenv.mkDerivation rec {
+  name = "readline-6.3p08";
+
+  src = fetchurl {
+    url = "mirror://gnu/readline/readline-6.3.tar.gz";
+    sha256 = "0hzxr9jxqqx5sxsv9vmlxdnvlr9vi4ih1avjb869hbs6p5qn1fjn";
+  };
+
+  outputs = [ "out" "dev" "man" "doc" "info" ];
+
+  propagatedBuildInputs = [ncurses];
+
+  patchFlags = "-p0";
+
+  configureFlags =
+    stdenv.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
+    ++
+    (let
+       patch = nr: sha256:
+         fetchurl {
+           url = "mirror://gnu/readline/readline-6.3-patches/readline63-${nr}";
+           inherit sha256;
+         };
+     in
+       import ./readline-6.3-patches.nix patch);
+
+  # Don't run the native `strip' when cross-compiling.
+  dontStrip = stdenv.hostPlatform != stdenv.buildPlatform;
+  bash_cv_func_sigsetjmp = if stdenv.isCygwin then "missing" else null;
+
+  meta = with stdenv.lib; {
+    description = "Library for interactive line editing";
+
+    longDescription = ''
+      The GNU Readline library provides a set of functions for use by
+      applications that allow users to edit command lines as they are
+      typed in.  Both Emacs and vi editing modes are available.  The
+      Readline library includes additional functions to maintain a
+      list of previously-entered command lines, to recall and perhaps
+      reedit those lines, and perform csh-like history expansion on
+      previous commands.
+
+      The history facilities are also placed into a separate library,
+      the History library, as part of the build process.  The History
+      library may be used without Readline in applications which
+      desire its capabilities.
+    '';
+
+    homepage = https://savannah.gnu.org/projects/readline/;
+
+    license = licenses.gpl3Plus;
+
+    maintainers = [ ];
+
+    platforms = platforms.unix;
+    branch = "6.3";
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/readline/7.0.nix b/nixpkgs/pkgs/development/libraries/readline/7.0.nix
new file mode 100644
index 000000000000..e96b4f1ebe27
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/readline/7.0.nix
@@ -0,0 +1,66 @@
+{ fetchurl, stdenv, ncurses
+}:
+
+stdenv.mkDerivation rec {
+  name = "readline-${version}";
+  version = "7.0p${toString (builtins.length upstreamPatches)}";
+
+  src = fetchurl {
+    url = "mirror://gnu/readline/readline-${meta.branch}.tar.gz";
+    sha256 = "0d13sg9ksf982rrrmv5mb6a2p4ys9rvg9r71d6il0vr8hmql63bm";
+  };
+
+  outputs = [ "out" "dev" "man" "doc" "info" ];
+
+  propagatedBuildInputs = [ncurses];
+
+  patchFlags = "-p0";
+
+  upstreamPatches =
+    (let
+       patch = nr: sha256:
+         fetchurl {
+           url = "mirror://gnu/readline/readline-${meta.branch}-patches/readline70-${nr}";
+           inherit sha256;
+         };
+     in
+       import ./readline-7.0-patches.nix patch);
+
+  patches =
+    [ ./link-against-ncurses.patch
+      ./no-arch_only-6.3.patch
+    ]
+    ++ upstreamPatches;
+
+  # Don't run the native `strip' when cross-compiling.
+  dontStrip = stdenv.hostPlatform != stdenv.buildPlatform;
+  bash_cv_func_sigsetjmp = if stdenv.isCygwin then "missing" else null;
+
+  meta = with stdenv.lib; {
+    description = "Library for interactive line editing";
+
+    longDescription = ''
+      The GNU Readline library provides a set of functions for use by
+      applications that allow users to edit command lines as they are
+      typed in.  Both Emacs and vi editing modes are available.  The
+      Readline library includes additional functions to maintain a
+      list of previously-entered command lines, to recall and perhaps
+      reedit those lines, and perform csh-like history expansion on
+      previous commands.
+
+      The history facilities are also placed into a separate library,
+      the History library, as part of the build process.  The History
+      library may be used without Readline in applications which
+      desire its capabilities.
+    '';
+
+    homepage = https://savannah.gnu.org/projects/readline/;
+
+    license = licenses.gpl3Plus;
+
+    maintainers = [ maintainers.vanschelven ];
+
+    platforms = platforms.unix;
+    branch = "7.0";
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/readline/8.0.nix b/nixpkgs/pkgs/development/libraries/readline/8.0.nix
new file mode 100644
index 000000000000..eefef9727663
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/readline/8.0.nix
@@ -0,0 +1,66 @@
+{ fetchurl, stdenv, ncurses
+}:
+
+stdenv.mkDerivation rec {
+  name = "readline-${version}";
+  version = "8.0p${toString (builtins.length upstreamPatches)}";
+
+  src = fetchurl {
+    url = "mirror://gnu/readline/readline-${meta.branch}.tar.gz";
+    sha256 = "0qg4924hf4hg0r0wbx2chswsr08734536fh5iagkd3a7f4czafg3";
+  };
+
+  outputs = [ "out" "dev" "man" "doc" "info" ];
+
+  propagatedBuildInputs = [ncurses];
+
+  patchFlags = "-p0";
+
+  upstreamPatches =
+    (let
+       patch = nr: sha256:
+         fetchurl {
+           url = "mirror://gnu/readline/readline-${meta.branch}-patches/readline80-${nr}";
+           inherit sha256;
+         };
+     in
+       import ./readline-8.0-patches.nix patch);
+
+  patches =
+    [ ./link-against-ncurses.patch
+      ./no-arch_only-6.3.patch
+    ]
+    ++ upstreamPatches;
+
+  # Don't run the native `strip' when cross-compiling.
+  dontStrip = stdenv.hostPlatform != stdenv.buildPlatform;
+  bash_cv_func_sigsetjmp = if stdenv.isCygwin then "missing" else null;
+
+  meta = with stdenv.lib; {
+    description = "Library for interactive line editing";
+
+    longDescription = ''
+      The GNU Readline library provides a set of functions for use by
+      applications that allow users to edit command lines as they are
+      typed in.  Both Emacs and vi editing modes are available.  The
+      Readline library includes additional functions to maintain a
+      list of previously-entered command lines, to recall and perhaps
+      reedit those lines, and perform csh-like history expansion on
+      previous commands.
+
+      The history facilities are also placed into a separate library,
+      the History library, as part of the build process.  The History
+      library may be used without Readline in applications which
+      desire its capabilities.
+    '';
+
+    homepage = https://savannah.gnu.org/projects/readline/;
+
+    license = licenses.gpl3Plus;
+
+    maintainers = with maintainers; [ vanschelven dtzWill ];
+
+    platforms = platforms.unix;
+    branch = "8.0";
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/readline/android.patch b/nixpkgs/pkgs/development/libraries/readline/android.patch
new file mode 100644
index 000000000000..7e81774be369
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/readline/android.patch
@@ -0,0 +1,16 @@
+diff --git histlib.h histlib.h
+index c938a10..925ab72 100644
+--- histlib.h
++++ histlib.h
+@@ -51,9 +51,9 @@
+ #endif
+ 
+ #ifndef member
+-#  ifndef strchr
++#  if !defined (strchr) && !defined (__STDC__)
+ extern char *strchr ();
+-#  endif
++#  endif /* !strchr && !__STDC__ */
+ #define member(c, s) ((c) ? ((char *)strchr ((s), (c)) != (char *)NULL) : 0)
+ #endif
+ 
diff --git a/nixpkgs/pkgs/development/libraries/readline/clang.patch b/nixpkgs/pkgs/development/libraries/readline/clang.patch
new file mode 100644
index 000000000000..42bb0be09c39
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/readline/clang.patch
@@ -0,0 +1,13 @@
+diff --git a/support/shobj-conf b/support/shobj-conf
+index 5a63e80..4b2a741 100644
+--- support/shobj-conf
++++ support/shobj-conf
+@@ -189,7 +189,7 @@ darwin*|macosx*)
+ 	darwin[789]*|darwin10*)	SHOBJ_LDFLAGS=''
+ 			SHLIB_XLDFLAGS='-dynamiclib -arch_only `/usr/bin/arch` -install_name $(libdir)/$@ -current_version $(SHLIB_MAJOR)$(SHLIB_MINOR) -compatibility_version $(SHLIB_MAJOR) -v'
+ 			;;
+-	*)		SHOBJ_LDFLAGS='-dynamic'
++	*)		SHOBJ_LDFLAGS='-dynamiclib'
+ 			SHLIB_XLDFLAGS='-arch_only `/usr/bin/arch` -install_name $(libdir)/$@ -current_version $(SHLIB_MAJOR)$(SHLIB_MINOR) -compatibility_version $(SHLIB_MAJOR) -v'
+ 			;;
+ 	esac
diff --git a/nixpkgs/pkgs/development/libraries/readline/link-against-ncurses.patch b/nixpkgs/pkgs/development/libraries/readline/link-against-ncurses.patch
new file mode 100644
index 000000000000..0fd0598f4650
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/readline/link-against-ncurses.patch
@@ -0,0 +1,18 @@
+This patch is to make sure that `libncurses' is among the `NEEDED'
+dependencies of `libreadline.so' and `libhistory.so'.
+
+Failing to do that, applications linking against Readline are
+forced to explicitly link against libncurses as well; in addition,
+this trick doesn't work when using GNU ld's `--as-needed'.
+
+--- shlib/Makefile.in	2009-01-06 18:03:22.000000000 +0100
++++ shlib/Makefile.in	2009-07-27 14:43:25.000000000 +0200
+@@ -84,7 +84,7 @@ SHOBJ_LDFLAGS = @SHOBJ_LDFLAGS@
+ SHOBJ_XLDFLAGS = @SHOBJ_XLDFLAGS@
+ SHOBJ_LIBS = @SHOBJ_LIBS@
+ 
+-SHLIB_XLDFLAGS = @LDFLAGS@ @SHLIB_XLDFLAGS@
++SHLIB_XLDFLAGS = @LDFLAGS@ @SHLIB_XLDFLAGS@ -lncurses
+ SHLIB_LIBS = @SHLIB_LIBS@
+ 
+ SHLIB_DOT = @SHLIB_DOT@
diff --git a/nixpkgs/pkgs/development/libraries/readline/no-arch_only-6.3.patch b/nixpkgs/pkgs/development/libraries/readline/no-arch_only-6.3.patch
new file mode 100644
index 000000000000..7c46dbad962a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/readline/no-arch_only-6.3.patch
@@ -0,0 +1,13 @@
+diff -ru -x '*~' readline-6.3-orig/support/shobj-conf readline-6.3/support/shobj-conf
+--- support/shobj-conf	2014-02-24 03:06:29.000000000 +0100
++++ support/shobj-conf	2014-07-22 11:18:52.000000000 +0200
+@@ -194,9 +194,6 @@
+ 	# Darwin 8 == Mac OS X 10.4; Mac OS X 10.N == Darwin N+4
+ 	*)
+ 		case "${host_os}" in
+-		darwin[89]*|darwin1[012]*)
+-			SHOBJ_ARCHFLAGS='-arch_only `/usr/bin/arch`'
+-			;;
+ 		 *) 	# Mac OS X 10.9 (Mavericks) and later
+ 			SHOBJ_ARCHFLAGS=
+ 			# for 32 and 64bit universal library
diff --git a/nixpkgs/pkgs/development/libraries/readline/no-arch_only.patch b/nixpkgs/pkgs/development/libraries/readline/no-arch_only.patch
new file mode 100644
index 000000000000..b23eab5d9d73
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/readline/no-arch_only.patch
@@ -0,0 +1,14 @@
+diff -ru -x '*~' readline-6.2-orig/support/shobj-conf readline-6.2/support/shobj-conf
+--- support/shobj-conf	2009-10-28 14:20:21.000000000 +0100
++++ support/shobj-conf	2014-07-01 13:03:28.000000000 +0200
+@@ -168,8 +168,8 @@
+ 	SHLIB_LIBVERSION='$(SHLIB_MAJOR)$(SHLIB_MINOR).$(SHLIB_LIBSUFF)'
+ 	SHLIB_LIBSUFF='dylib'
+ 
+-	SHOBJ_LDFLAGS='-dynamiclib -dynamic -undefined dynamic_lookup -arch_only `/usr/bin/arch`'
+-	SHLIB_XLDFLAGS='-dynamiclib -arch_only `/usr/bin/arch` -install_name $(libdir)/$@ -current_version $(SHLIB_MAJOR)$(SHLIB_MINOR) -compatibility_version $(SHLIB_MAJOR) -v'
++	SHOBJ_LDFLAGS='-dynamiclib -dynamic -undefined dynamic_lookup'
++	SHLIB_XLDFLAGS='-dynamiclib -install_name $(libdir)/$@ -current_version $(SHLIB_MAJOR)$(SHLIB_MINOR) -compatibility_version $(SHLIB_MAJOR) -v'
+ 
+ 	SHLIB_LIBS='-lncurses'	# see if -lcurses works on MacOS X 10.1 
+ 	;;
diff --git a/nixpkgs/pkgs/development/libraries/readline/readline-6.2-patches.nix b/nixpkgs/pkgs/development/libraries/readline/readline-6.2-patches.nix
new file mode 100644
index 000000000000..9fdcb3743b72
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/readline/readline-6.2-patches.nix
@@ -0,0 +1,9 @@
+# Automatically generated by `update-patch-set.sh'; do not edit.
+
+patch: [
+(patch "001" "1qxl74f4n0hv4a807byrgbk4ixd8m50apj3922q2ss9pfi0nra1q")
+(patch "002" "1m670g2xzib6r81315q9r24nh9brmxkpq07acch1fwxmih94jqqy")
+(patch "003" "0x13c9wir4r44v2vdg96y0ahn8kl3wcmb5y0xn15yvid6pzk28fb")
+(patch "004" "0xjlkxfssfsd6jwbqhfjs4hybcps0b9zgz8v86vbhnzag4j39g89")
+(patch "005" "1x61bjl3wgs1gwla9b3y1hh12m1j5qlbis22258mljjl9mg900pg")
+]
diff --git a/nixpkgs/pkgs/development/libraries/readline/readline-6.3-patches.nix b/nixpkgs/pkgs/development/libraries/readline/readline-6.3-patches.nix
new file mode 100644
index 000000000000..d0aaaf38f706
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/readline/readline-6.3-patches.nix
@@ -0,0 +1,12 @@
+# Automatically generated by `update-patch-set.sh'; do not edit.
+
+patch: [
+(patch "001" "0vqlj22mkbn3x42qx2iqir7capx462dhagbzdw6hwxgfxavbny8s")
+(patch "002" "19g0l6vlfcqzwfwjj1slkmxzndjp4543hwrf26g8z216lp3h9qrr")
+(patch "003" "0bx53k876w8vwf4h2s6brr1i46ym87gi71bh8zl89n0gn3cbshgc")
+(patch "004" "1k2m8dg1awmjhmivdbx1c25866gfbpg0fy4845n8cw15zc3bjis5")
+(patch "005" "0jr7c28bzn882as5i54l53bhi723s1nkvzmwlh3rj6ld4bwqhxw7")
+(patch "006" "0mp5zgx50792gigkmjap3d0zpdv5qanii8djab7j6z69qsrpl8sw")
+(patch "007" "1sjv9w0mglh395i6hlq3ck7wdxvi2wyddlyb2j0jwg7cmnibayad")
+(patch "008" "11rpqhsxd132gc8455v51ma3a5zshznb0mh2p0zc5skcab7r7h1v")
+]
diff --git a/nixpkgs/pkgs/development/libraries/readline/readline-7.0-patches.nix b/nixpkgs/pkgs/development/libraries/readline/readline-7.0-patches.nix
new file mode 100644
index 000000000000..c34ef2bf97bb
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/readline/readline-7.0-patches.nix
@@ -0,0 +1,9 @@
+# Automatically generated by `update-patch-set.sh'; do not edit.
+
+patch: [
+(patch "001" "0xm3sxvwmss7ddyfb11n6pgcqd1aglnpy15g143vzcf75snb7hcs")
+(patch "002" "0n1dxmqsbjgrfxb1hgk5c6lsraw4ncbnzxlsx7m35nym6lncjiw7")
+(patch "003" "1027kmymniizcy0zbdlrczxfx3clxcdln5yq05q9yzlc6y9slhwy")
+(patch "004" "0r3bbaf12iz8m02z6p3fzww2m365fhn71xmzab2p62gj54s6h9gr")
+(patch "005" "0lxpa4f72y2nsgj6fgrhjk2nmmxvccys6aciwfxwchb5f21rq5fa")
+]
diff --git a/nixpkgs/pkgs/development/libraries/readline/readline-8.0-patches.nix b/nixpkgs/pkgs/development/libraries/readline/readline-8.0-patches.nix
new file mode 100644
index 000000000000..b8019fb33502
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/readline/readline-8.0-patches.nix
@@ -0,0 +1,4 @@
+# Automatically generated by `update-patch-set.sh'; do not edit.
+
+patch: [
+]
diff --git a/nixpkgs/pkgs/development/libraries/readline/shobj-darwin.patch b/nixpkgs/pkgs/development/libraries/readline/shobj-darwin.patch
new file mode 100644
index 000000000000..a9199ca3e89a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/readline/shobj-darwin.patch
@@ -0,0 +1,11 @@
+--- a/support/shobj-conf.orig	2006-04-11 06:15:43.000000000 -0700
++++ b/support/shobj-conf	2007-11-08 01:15:43.000000000 -0800
+@@ -171,7 +171,7 @@
+ 	SHLIB_LIBSUFF='dylib'
+ 
+ 	case "${host_os}" in
+-	darwin[78]*)	SHOBJ_LDFLAGS=''
++	darwin[789]*)	SHOBJ_LDFLAGS=''
+ 			SHLIB_XLDFLAGS='-dynamiclib -arch_only `/usr/bin/arch` -install_name $(libdir)/$@ -current_version $(SHLIB_MAJOR)$(SHLIB_MINOR) -compatibility_version $(SHLIB_MAJOR) -v'
+ 			;;
+ 	*)		SHOBJ_LDFLAGS='-dynamic'
diff --git a/nixpkgs/pkgs/development/libraries/readosm/default.nix b/nixpkgs/pkgs/development/libraries/readosm/default.nix
new file mode 100644
index 000000000000..1c777e849a46
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/readosm/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchurl, expat, zlib, geos, libspatialite }:
+
+stdenv.mkDerivation rec {
+  name = "readosm-1.1.0";
+
+  src = fetchurl {
+    url = "https://www.gaia-gis.it/gaia-sins/readosm-sources/${name}.tar.gz";
+    sha256 = "1v20pnda67imjd70fn0zw30aar525xicy3d3v49md5cvqklws265";
+  };
+
+  buildInputs = [ expat zlib geos libspatialite ];
+
+  configureFlags = [ "--disable-freexl" ];
+
+  enableParallelBuilding = true;
+
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/rep-gtk/default.nix b/nixpkgs/pkgs/development/libraries/rep-gtk/default.nix
new file mode 100644
index 000000000000..681fc3a012fe
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/rep-gtk/default.nix
@@ -0,0 +1,30 @@
+{ stdenv, fetchurl, pkgconfig, autoreconfHook, librep, gtk2 }:
+
+with stdenv.lib;
+stdenv.mkDerivation rec {
+
+  name = "rep-gtk-${version}";
+  version = "0.90.8.3";
+  sourceName = "rep-gtk_${version}";
+
+  src = fetchurl {
+    url = "https://download.tuxfamily.org/librep/rep-gtk/${sourceName}.tar.xz";
+    sha256 = "0hgkkywm8zczir3lqr727bn7ybgg71x9cwj1av8fykkr8pdpard9";
+  };
+
+  nativeBuildInputs = [ autoreconfHook pkgconfig ];
+  buildInputs = [ ];
+  propagatedBuildInputs = [ librep gtk2 ];
+
+  patchPhase = ''
+    sed -e 's|installdir=$(repexecdir)|installdir=$(libdir)/rep|g' -i Makefile.in
+  '';
+
+  meta = {
+    description = "GTK+ bindings for librep";
+    homepage = http://sawfish.wikia.com;
+    license = licenses.gpl2;
+    maintainers = [ maintainers.AndersonTorres ];
+  };
+}
+# TODO: investigate fetchFromGithub
diff --git a/nixpkgs/pkgs/development/libraries/rep-gtk/setup-hook.sh b/nixpkgs/pkgs/development/libraries/rep-gtk/setup-hook.sh
new file mode 100644
index 000000000000..4d875b693304
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/rep-gtk/setup-hook.sh
@@ -0,0 +1,5 @@
+addRepDLLoadPath () {
+    addToSearchPath REP_DL_LOAD_PATH $1/lib/rep
+}
+
+addEnvHooks "$hostOffset" addRepDLLoadPath
diff --git a/nixpkgs/pkgs/development/libraries/resolv_wrapper/default.nix b/nixpkgs/pkgs/development/libraries/resolv_wrapper/default.nix
new file mode 100644
index 000000000000..e221c82edeca
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/resolv_wrapper/default.nix
@@ -0,0 +1,19 @@
+{ stdenv, fetchurl, cmake, pkgconfig }:
+
+stdenv.mkDerivation rec {
+  name = "resolv_wrapper-1.1.5";
+
+  src = fetchurl {
+    url = "mirror://samba/cwrap/${name}.tar.gz";
+    sha256 = "0v5hw5ipq2rrpraf4ck4r9w9xihmgwzkpf5wgppz7gc52fmgv2g9";
+  };
+
+  nativeBuildInputs = [ cmake pkgconfig ];
+
+  meta = with stdenv.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;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/rlog/default.nix b/nixpkgs/pkgs/development/libraries/rlog/default.nix
new file mode 100644
index 000000000000..f8268b5eb7cd
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/rlog/default.nix
@@ -0,0 +1,17 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation {
+  name = "rlog-1.4";
+
+  src = fetchurl {
+    url = "http://rlog.googlecode.com/files/rlog-1.4.tar.gz";
+    sha256 = "0y9zg0pd7vmnskwac1qdyzl282z7kb01nmn57lsg2mjdxgnywf59";
+  };
+
+  meta = {
+    homepage = http://www.arg0.net/rlog;
+    description = "A C++ logging library used in encfs";
+    platforms = stdenv.lib.platforms.linux;
+    license = stdenv.lib.licenses.lgpl3;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/robin-map/default.nix b/nixpkgs/pkgs/development/libraries/robin-map/default.nix
new file mode 100644
index 000000000000..87c855251e0f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/robin-map/default.nix
@@ -0,0 +1,26 @@
+{ stdenv
+, fetchFromGitHub
+, cmake
+}:
+
+stdenv.mkDerivation rec {
+  pname = "robin-map";
+  version = "0.6.1";
+
+  src = fetchFromGitHub {
+    owner = "Tessil";
+    repo = pname;
+    rev = "v${version}";
+    sha256 = "0blvvbr14f0drbd6dp0cs8x4ng3ppb5i72dmhk43ylg6yjgh4fhq";
+  };
+
+  nativeBuildInputs = [ cmake ];
+
+  meta = with stdenv.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;
+    maintainers = with maintainers; [ goibhniu jtojnar ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/rocksdb/default.nix b/nixpkgs/pkgs/development/libraries/rocksdb/default.nix
new file mode 100644
index 000000000000..4e51051dfe0a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/rocksdb/default.nix
@@ -0,0 +1,86 @@
+{ stdenv
+, fetchFromGitHub
+, fixDarwinDylibNames
+, which, perl
+
+# Optional Arguments
+, snappy ? null, google-gflags ? null, zlib ? null, bzip2 ? null, lz4 ? null
+
+# Malloc implementation
+, jemalloc ? null, gperftools ? null
+
+, enableLite ? false
+}:
+
+let
+  malloc = if jemalloc != null then jemalloc else gperftools;
+  tools = [ "sst_dump" "ldb" "rocksdb_dump" "rocksdb_undump" "blob_dump" ];
+in
+stdenv.mkDerivation rec {
+  name = "rocksdb-${version}";
+  version = "5.11.3";
+
+  outputs = [ "dev" "out" "static" "bin" ];
+
+  src = fetchFromGitHub {
+    owner = "facebook";
+    repo = "rocksdb";
+    rev = "v${version}";
+    sha256 = "15x2r7aib1xinwcchl32wghs8g96k4q5xgv6z97mxgp35475x01p";
+  };
+
+  nativeBuildInputs = [ which perl ];
+  buildInputs = [ snappy google-gflags zlib bzip2 lz4 malloc fixDarwinDylibNames ];
+
+  postPatch = ''
+    # Hack to fix typos
+    sed -i 's,#inlcude,#include,g' build_tools/build_detect_platform
+  '';
+
+  # Environment vars used for building certain configurations
+  PORTABLE = "1";
+  USE_SSE = "1";
+  CMAKE_CXX_FLAGS = "-std=gnu++11";
+  JEMALLOC_LIB = stdenv.lib.optionalString (malloc == jemalloc) "-ljemalloc";
+
+  LIBNAME = "librocksdb${stdenv.lib.optionalString enableLite "_lite"}";
+  ${if enableLite then "CXXFLAGS" else null} = "-DROCKSDB_LITE=1";
+
+  buildAndInstallFlags = [
+    "USE_RTTI=1"
+    "DEBUG_LEVEL=0"
+    "DISABLE_WARNING_AS_ERROR=1"
+  ];
+
+  buildFlags = buildAndInstallFlags ++ [
+    "shared_lib"
+    "static_lib"
+  ] ++ tools ;
+
+  installFlags = buildAndInstallFlags ++ [
+    "INSTALL_PATH=\${out}"
+    "install-shared"
+    "install-static"
+  ];
+
+  postInstall = ''
+    # Might eventually remove this when we are confident in the build process
+    echo "BUILD CONFIGURATION FOR SANITY CHECKING"
+    cat make_config.mk
+    mkdir -pv $static/lib/
+    mv -vi $out/lib/${LIBNAME}.a $static/lib/
+
+    install -d ''${!outputBin}/bin
+    install -D ${stdenv.lib.concatStringsSep " " tools} ''${!outputBin}/bin
+  '';
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    homepage = https://rocksdb.org;
+    description = "A library that provides an embeddable, persistent key-value store for fast storage";
+    license = licenses.bsd3;
+    platforms = platforms.x86_64;
+    maintainers = with maintainers; [ adev ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/rote/default.nix b/nixpkgs/pkgs/development/libraries/rote/default.nix
new file mode 100644
index 000000000000..195db9a16858
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/rote/default.nix
@@ -0,0 +1,30 @@
+{ stdenv, fetchurl, ncurses }:
+
+stdenv.mkDerivation rec {
+  name = "rote-${version}";
+  version = "0.2.8";
+
+  src = fetchurl {
+    sha256 = "05v1lw99jv4cwxl7spyi7by61j2scpdsvx809x5cga7dm5dhlmky";
+    url = "mirror://sourceforge/rote/${name}.tar.gz";
+  };
+
+  buildInputs = [ ncurses ];
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    description = "Our Own Terminal Emulation Library";
+    longDescription = ''
+      ROTE is a simple C library for VT102 terminal emulation. It allows the
+      programmer to set up virtual 'screens' and send them data. The virtual
+      screens will emulate the behavior of a VT102 terminal, interpreting
+      escape sequences, control characters and such. The library supports
+      ncurses as well so that you may render the virtual screen to the real
+      screen when you need to.
+    '';
+    homepage = http://rote.sourceforge.net/;
+    license = licenses.lgpl21;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/rttr/default.nix b/nixpkgs/pkgs/development/libraries/rttr/default.nix
new file mode 100644
index 000000000000..74b8e381f931
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/rttr/default.nix
@@ -0,0 +1,31 @@
+{ stdenv, fetchFromGitHub, cmake, ninja }:
+
+stdenv.mkDerivation rec {
+  pname = "rttr";
+  version = "0.9.6";
+
+  src = fetchFromGitHub {
+    owner = "${pname}org";
+    repo = pname;
+    rev = "v${version}";
+    sha256 = "1yxad8sj40wi75hny8w6imrsx8wjasjmsipnlq559n4b6kl84ijp";
+  };
+
+  nativeBuildInputs = [
+    cmake
+    ninja
+  ];
+
+  cmakeFlags = [
+    "-DBUILD_EXAMPLES=OFF"
+    "-DBUILD_UNIT_TESTS=OFF"
+    "-DBUILD_PACKAGE=OFF"
+  ];
+
+  meta = with stdenv.lib; {
+    description = "C++ Reflection Library";
+    homepage = https://www.rttr.org;
+    license = licenses.mit;
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/rubberband/default.nix b/nixpkgs/pkgs/development/libraries/rubberband/default.nix
new file mode 100644
index 000000000000..c9ba339ae0ea
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/rubberband/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchurl, pkgconfig, libsamplerate, libsndfile, fftw
+, vampSDK, ladspaH }:
+
+stdenv.mkDerivation {
+  name = "rubberband-1.8.1";
+
+  src = fetchurl {
+    url = http://code.breakfastquay.com/attachments/download/23/rubberband-1.8.1.tar.bz2;
+    sha256 = "0x9bm2nqd6w2f35w2sqcp7h5z34i4w7mdg53m0vzjhffnnq6637z";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ libsamplerate libsndfile fftw vampSDK ladspaH ];
+
+  meta = with stdenv.lib; {
+    description = "High quality software library for audio time-stretching and pitch-shifting";
+    homepage = https://www.breakfastquay.com/rubberband/index.html;
+    # commercial license available as well, see homepage. You'll get some more optimized routines
+    license = licenses.gpl2Plus;
+    maintainers = [ maintainers.goibhniu maintainers.marcweber ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/safefile/default.nix b/nixpkgs/pkgs/development/libraries/safefile/default.nix
new file mode 100644
index 000000000000..daa499061c5b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/safefile/default.nix
@@ -0,0 +1,31 @@
+{ stdenv, fetchurl, path, runtimeShell }:
+stdenv.mkDerivation rec {
+  name = "${pname}-${version}";
+  pname = "safefile";
+  version = "1.0.5";
+
+  src = fetchurl {
+    url = "http://research.cs.wisc.edu/mist/${pname}/releases/${name}.tar.gz";
+    sha256 = "1y0gikds2nr8jk8smhrl617njk23ymmpxyjb2j1xbj0k82xspv78";
+  };
+
+  buildInputs = [];
+
+  passthru = {
+    updateScript = ''
+      #!${runtimeShell}
+      cd ${toString ./.}
+      ${toString path}/pkgs/build-support/upstream-updater/update-walker.sh default.nix
+    '';
+  };
+
+  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;
+    homepage = http://research.cs.wisc.edu/mist/safefile/;
+    updateWalker = true;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/sbc/default.nix b/nixpkgs/pkgs/development/libraries/sbc/default.nix
new file mode 100644
index 000000000000..ce8db3ee9ea9
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/sbc/default.nix
@@ -0,0 +1,20 @@
+{ stdenv, fetchurl, pkgconfig, libsndfile }:
+
+stdenv.mkDerivation rec {
+  name = "sbc-1.4";
+
+  src = fetchurl {
+    url = "http://www.kernel.org/pub/linux/bluetooth/${name}.tar.xz";
+    sha256 = "1jal98pnrjkzxlkiqy0ykh4qmgnydz9bmsp1jn581p5kddpg92si";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ libsndfile ];
+
+  meta = with stdenv.lib; {
+    description = "SubBand Codec Library";
+    homepage = http://www.bluez.org/;
+    license = licenses.gpl2;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/sblim-sfcc/default.nix b/nixpkgs/pkgs/development/libraries/sblim-sfcc/default.nix
new file mode 100644
index 000000000000..ba0b8f4e996f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/sblim-sfcc/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchFromGitHub, autoreconfHook, curl }:
+
+stdenv.mkDerivation rec {
+  name = "sblim-sfcc-${version}";
+  version = "2.2.9"; # this is technically 2.2.9-preview
+
+  src = fetchFromGitHub {
+    owner  = "kkaempf";
+    repo   = "sblim-sfcc";
+    rev    = "514a76af2020fd6dc6fc380df76cbe27786a76a2";
+    sha256 = "06c1mskl9ixbf26v88w0lvn6v2xd6n5f0jd5mckqrn9j4vmh70hs";
+  };
+
+  buildInputs = [ curl ];
+
+  nativeBuildInputs = [ autoreconfHook ];
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    description = "Small Footprint CIM Client Library";
+    homepage    = https://sourceforge.net/projects/sblim/;
+    license     = licenses.cpl10;
+    maintainers = with maintainers; [ deepfire ];
+    platforms   = platforms.unix;
+    inherit version;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/schroedinger/default.nix b/nixpkgs/pkgs/development/libraries/schroedinger/default.nix
new file mode 100644
index 000000000000..25126edbc0f4
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/schroedinger/default.nix
@@ -0,0 +1,35 @@
+{ stdenv, fetchurl, orc, pkgconfig, fetchpatch, autoreconfHook }:
+
+stdenv.mkDerivation {
+  name = "schroedinger-1.0.11";
+
+  src = fetchurl {
+    urls = [
+      http://diracvideo.org/download/schroedinger/schroedinger-1.0.11.tar.gz
+      https://download.videolan.org/contrib/schroedinger-1.0.11.tar.gz
+    ];
+    sha256 = "04prr667l4sn4zx256v1z36a0nnkxfdqyln48rbwlamr6l3jlmqy";
+  };
+
+  outputs = [ "out" "dev" "devdoc" ];
+
+  nativeBuildInputs = [ pkgconfig autoreconfHook ];
+  buildInputs = [ orc ];
+
+  doCheck = (!stdenv.isDarwin);
+
+  patchFlags = "-p0";
+  patches = [
+    (fetchpatch {
+      url = "https://raw.githubusercontent.com/macports/macports-ports/master/multimedia/schroedinger/files/patch-testsuite-Makefile.am.diff";
+      sha256 = "0cc8ymvgjgwy7ghca2dd8m8pxpinf27s2i8krf2m3fzv2ckq09v3";
+    })
+  ];
+
+  meta = with stdenv.lib; {
+    homepage = http://diracvideo.org/;
+    maintainers = [ maintainers.spwhitt ];
+    license = [ licenses.mpl11 licenses.lgpl2 licenses.mit ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/science/benchmark/papi/default.nix b/nixpkgs/pkgs/development/libraries/science/benchmark/papi/default.nix
new file mode 100644
index 000000000000..f727728943bd
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/science/benchmark/papi/default.nix
@@ -0,0 +1,30 @@
+{ stdenv
+, fetchurl
+}:
+
+stdenv.mkDerivation rec {
+  version = "5.6.0";
+  name = "papi-${version}";
+
+  src = fetchurl {
+    url = "https://bitbucket.org/icl/papi/get/papi-5-6-0-t.tar.gz";
+    sha256 = "13mngf9kl0y2wfxqvkad0smdaag7k8fvw82b4312gx62nwhc1i6r";
+  };
+
+  buildInputs = [ stdenv ];
+
+  preConfigure = ''
+    cd src
+  '';
+
+  doCheck = true;
+  checkTarget = "test";
+
+  meta = with stdenv.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;
+    platforms = platforms.linux;
+    maintainers = [ maintainers.costrouc ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/science/biology/EBTKS/default.nix b/nixpkgs/pkgs/development/libraries/science/biology/EBTKS/default.nix
new file mode 100644
index 000000000000..f4353f51d66c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/science/biology/EBTKS/default.nix
@@ -0,0 +1,26 @@
+{ stdenv, fetchFromGitHub, cmake, libminc }:
+
+stdenv.mkDerivation rec {
+  pname = "EBTKS";
+  name  = "${pname}-2017-09-23";
+
+  src = fetchFromGitHub {
+    owner  = "BIC-MNI";
+    repo   = pname;
+    rev    = "67e4e197d8a32d6462c9bdc7af44d64ebde4fb5c";
+    sha256 = "1a1qw6i47fs1izx60l1ysabpmyx9j5sjnbdv8b47wi2xcc9i3hpq";
+  };
+
+  nativeBuildInputs = [ cmake ];
+  buildInputs = [ libminc ];
+
+  cmakeFlags = [ "-DLIBMINC_DIR=${libminc}/lib/" ];
+
+  meta = with stdenv.lib; {
+    homepage = "https://github.com/BIC-MNI/${pname}";
+    description = "Library for working with MINC files";
+    maintainers = with maintainers; [ bcdarwin ];
+    platforms = platforms.unix;
+    license   = licenses.free;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/science/biology/bicgl/default.nix b/nixpkgs/pkgs/development/libraries/science/biology/bicgl/default.nix
new file mode 100644
index 000000000000..3c9b8f8257ce
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/science/biology/bicgl/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchFromGitHub, cmake, libminc, bicpl, freeglut, mesa_glu }:
+
+stdenv.mkDerivation rec {
+  pname = "bicgl";
+  name  = "${pname}-2017-09-10";
+
+  owner = "BIC-MNI";
+
+  src = fetchFromGitHub {
+    inherit owner;
+    repo   = pname;
+    rev    = "b7f7e52d1039d6202a93d9055f516186033656cc";
+    sha256 = "0lzirdi1mf4yl8srq7vjn746sbydz7h0wjh7wy8gycy6hq04qrg4";
+  };
+
+  nativeBuildInputs = [ cmake ];
+  buildInputs = [ libminc bicpl freeglut mesa_glu ];
+
+  cmakeFlags = [ "-DLIBMINC_DIR=${libminc}/lib" "-DBICPL_DIR=${bicpl}/lib" ];
+
+  meta = with stdenv.lib; {
+    homepage = "https://github.com/${owner}/${pname}";
+    description = "Brain Imaging Centre graphics library";
+    maintainers = with maintainers; [ bcdarwin ];
+    platforms = platforms.unix;
+    license   = licenses.free;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/science/biology/bicpl/default.nix b/nixpkgs/pkgs/development/libraries/science/biology/bicpl/default.nix
new file mode 100644
index 000000000000..0c634c0f265c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/science/biology/bicpl/default.nix
@@ -0,0 +1,32 @@
+{ stdenv, fetchFromGitHub, cmake, libminc, netpbm }:
+
+stdenv.mkDerivation rec {
+  pname = "bicpl";
+  name  = "${pname}-2017-09-10";
+
+  owner = "BIC-MNI";
+
+  # current master is significantly ahead of most recent release, so use Git version:
+  src = fetchFromGitHub {
+    inherit owner;
+    repo   = pname;
+    rev    = "612a63e740fadb162fcf27ee00da6a18dec4d5a9";
+    sha256 = "1vv9gi184bkvp3f99v9xmmw1ly63ip5b09y7zdjn39g7kmwzrga7";
+  };
+
+  nativeBuildInputs = [ cmake ];
+  buildInputs = [ libminc netpbm ];
+
+  cmakeFlags = [ "-DLIBMINC_DIR=${libminc}/lib" ];
+
+  doCheck = false;
+  # internal_volume_io.h: No such file or directory
+
+  meta = with stdenv.lib; {
+    homepage = "https://github.com/${owner}/${pname}";
+    description = "Brain Imaging Centre programming library";
+    maintainers = with maintainers; [ bcdarwin ];
+    platforms = platforms.unix;
+    license   = licenses.free;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/science/biology/elastix/default.nix b/nixpkgs/pkgs/development/libraries/science/biology/elastix/default.nix
new file mode 100644
index 000000000000..5f4cbbaa5670
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/science/biology/elastix/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchurl, cmake, itk, python }:
+
+stdenv.mkDerivation rec {
+  pname    = "elastix";
+  pversion = "4.9.0";
+  name  = "${pname}-${pversion}";
+
+  src = fetchurl {
+    url    = "https://github.com/SuperElastix/${pname}/archive/${pversion}.tar.gz";
+    sha256 = "02pbln36nq98xxfyqwlxg7b6gmigdq4fgfqr9mym1qn58aj04shg";
+  };
+
+  nativeBuildInputs = [ cmake python ];
+  buildInputs = [ itk ];
+
+  meta = with stdenv.lib; {
+    homepage = http://elastix.isi.uu.nl/;
+    description = "Image registration toolkit based on ITK";
+    maintainers = with maintainers; [ bcdarwin ];
+    platforms = platforms.linux;
+    license = licenses.asl20;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/science/biology/htslib/default.nix b/nixpkgs/pkgs/development/libraries/science/biology/htslib/default.nix
new file mode 100644
index 000000000000..2ee9144b316d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/science/biology/htslib/default.nix
@@ -0,0 +1,37 @@
+{ stdenv, fetchurl, zlib, bzip2, lzma, curl, perl }:
+
+stdenv.mkDerivation rec {
+  name = "${pname}-${version}";
+  pname = "htslib";
+  version = "1.9";
+
+  src = fetchurl {
+    url = "https://github.com/samtools/htslib/releases/download/${version}/${name}.tar.bz2";
+    sha256 = "16ljv43sc3fxmv63w7b2ff8m1s7h89xhazwmbm1bicz8axq8fjz0";
+  };
+
+  # perl is only used during the check phase.
+  nativeBuildInputs = [ perl ];
+
+  buildInputs = [ zlib bzip2 lzma curl ];
+
+  configureFlags = [ "--enable-libcurl" ]; # optional but strongly recommended
+
+  installFlags = "prefix=$(out)";
+
+  preCheck = ''
+    patchShebangs test/
+  '';
+
+  enableParallelBuilding = true;
+
+  doCheck = true;
+
+  meta = with stdenv.lib; {
+    description = "A C library for reading/writing high-throughput sequencing data";
+    license = licenses.mit;
+    homepage = http://www.htslib.org/;
+    platforms = platforms.unix;
+    maintainers = [ maintainers.mimadrid ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/science/biology/mirtk/default.nix b/nixpkgs/pkgs/development/libraries/science/biology/mirtk/default.nix
new file mode 100644
index 000000000000..51beba898f6c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/science/biology/mirtk/default.nix
@@ -0,0 +1,42 @@
+{ stdenv, lib, gtest, fetchFromGitHub, cmake, boost, eigen, python, vtk, zlib }:
+
+stdenv.mkDerivation rec {
+  version = "2.0.0";
+  name = "mirtk-${version}";
+
+  src = fetchFromGitHub {
+    owner = "BioMedIA";
+    repo = "MIRTK";
+    rev = "v${version}";
+    sha256 = "0i2v97m66ir5myvi5b123r7zcagwy551b73s984gk7lksl5yiqxk";
+    fetchSubmodules = true;
+  };
+
+  cmakeFlags = "-DWITH_VTK=ON -DBUILD_ALL_MODULES=ON";
+
+  doCheck = true;
+
+  checkPhase = ''
+    ctest -E '(Polynomial|ConvolutionFunction|Downsampling|EdgeTable|InterpolateExtrapolateImage)'
+  '';
+  # testPolynomial - segfaults for some reason
+  # testConvolutionFunction, testDownsampling - main not called correctly
+  # testEdgeTable, testInterpolateExtrapolateImageFunction - setup fails
+
+  postInstall = ''
+    install -Dm644 -t "$out/share/bash-completion/completions/mirtk" share/completion/bash/mirtk
+  '';
+
+  enableParallelBuilding = true;
+
+  nativeBuildInputs = [ cmake gtest ];
+  buildInputs = [ boost eigen python vtk zlib ];
+
+  meta = with stdenv.lib; {
+    homepage = "https://github.com/BioMedIA/MIRTK";
+    description = "Medical image registration library and tools";
+    maintainers = with maintainers; [ bcdarwin ];
+    platforms = platforms.linux;
+    license = licenses.asl20;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/science/biology/nifticlib/default.nix b/nixpkgs/pkgs/development/libraries/science/biology/nifticlib/default.nix
new file mode 100644
index 000000000000..51eed36312dd
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/science/biology/nifticlib/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchurl, cmake, zlib }:
+
+stdenv.mkDerivation rec {
+  pname    = "nifticlib";
+  pversion = "2.0.0";
+  name  = "${pname}-${pversion}";
+
+  src = fetchurl {
+    url    = "mirror://sourceforge/project/niftilib/${pname}/${pname}_2_0_0/${name}.tar.gz";
+    sha256 = "123z9bwzgin5y8gi5ni8j217k7n683whjsvg0lrpii9flgk8isd3";
+  };
+
+  nativeBuildInputs = [ cmake ];
+  buildInputs = [ zlib ];
+
+  doCheck = false; # fails 7 out of 293 tests
+
+  meta = with stdenv.lib; {
+    homepage = https://sourceforge.net/projects/niftilib;
+    description = "Medical imaging format C API";
+    maintainers = with maintainers; [ bcdarwin ];
+    platforms = platforms.linux;
+    license = licenses.publicDomain;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/science/biology/oobicpl/default.nix b/nixpkgs/pkgs/development/libraries/science/biology/oobicpl/default.nix
new file mode 100644
index 000000000000..8755b7fd2eba
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/science/biology/oobicpl/default.nix
@@ -0,0 +1,31 @@
+{ stdenv, fetchFromGitHub, cmake, libminc, bicpl, arguments, pcre-cpp }:
+
+stdenv.mkDerivation rec {
+  pname = "oobicpl";
+  name  = "${pname}-2016-03-02";
+
+  owner = "BIC-MNI";
+
+  src = fetchFromGitHub {
+    inherit owner;
+    repo   = pname;
+    rev    = "bc062a65dead2e58461f5afb37abedfa6173f10c";
+    sha256 = "05l4ml9djw17bgdnrldhcxydrzkr2f2scqlyak52ph5azj5n4zsx";
+  };
+
+  nativeBuildInputs = [ cmake ];
+  buildInputs = [ libminc bicpl arguments pcre-cpp ];
+
+  cmakeFlags = [ "-DLIBMINC_DIR=${libminc}/lib"
+                 "-DBICPL_DIR=${bicpl}/lib"
+                 "-DARGUMENTS_DIR=${arguments}/lib"
+                 "-DOOBICPL_BUILD_SHARED_LIBS=TRUE" ];
+
+  meta = with stdenv.lib; {
+    homepage = "https://github.com/${owner}/${pname}";
+    description = "Brain Imaging Centre object-oriented programming library (and tools)";
+    maintainers = with maintainers; [ bcdarwin ];
+    platforms = platforms.unix;
+    license   = licenses.free;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/science/math/QuadProgpp/default.nix b/nixpkgs/pkgs/development/libraries/science/math/QuadProgpp/default.nix
new file mode 100644
index 000000000000..4668839ebb9c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/science/math/QuadProgpp/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchFromGitHub, cmake }:
+
+stdenv.mkDerivation rec {
+  name = "QuadProgpp-${version}";
+  version = "4b6bd65f09fbff99c172a86d6e96ca74449b323f";
+
+  src = fetchFromGitHub {
+    owner = "liuq";
+    repo = "QuadProgpp";
+    rev = version;
+    sha256 = "02r0dlk2yjpafknvm945vbgs4sl26w2i1gw3pllar9hi364y8hnx";
+  };
+
+  nativeBuildInputs = [ cmake ];
+  buildInputs = [ ];
+
+  meta = with stdenv.lib; {
+    homepage = https://github.com/liuq/QuadProgpp;
+    license = licenses.mit;
+    description = ''
+      A C++ library for Quadratic Programming which implements the
+      Goldfarb-Idnani active-set dual method.
+    '';
+    maintainers = with maintainers; [ fuuzetsu ];
+    platforms = with platforms; linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/science/math/arpack/default.nix b/nixpkgs/pkgs/development/libraries/science/math/arpack/default.nix
new file mode 100644
index 000000000000..05373cd1cbda
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/science/math/arpack/default.nix
@@ -0,0 +1,56 @@
+{ stdenv, fetchFromGitHub, cmake
+, gfortran, openblas, eigen }:
+
+with stdenv.lib;
+
+let
+  version = "3.7.0";
+in
+stdenv.mkDerivation {
+  name = "arpack-${version}";
+
+  src = fetchFromGitHub {
+    owner = "opencollab";
+    repo = "arpack-ng";
+    rev = version;
+    sha256 = "1x7a1dj3dg43nlpvjlh8jzzbadjyr3mbias6f0256qkmgdyk4izr";
+  };
+
+  nativeBuildInputs = [ cmake ];
+  buildInputs = [ gfortran openblas eigen ];
+
+  doCheck = true;
+
+  BLAS_LIBS = "-L${openblas}/lib -lopenblas";
+
+  cmakeFlags = [
+    "-DBUILD_SHARED_LIBS=ON"
+    "-DINTERFACE64=${optionalString openblas.blas64 "1"}"
+  ];
+
+  preCheck = if stdenv.isDarwin then ''
+    export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:`pwd`/lib
+  '' else ''
+    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:`pwd`/lib
+  '' + ''
+    # Prevent tests from using all cores
+    export OMP_NUM_THREADS=2
+  '';
+
+  postInstall = ''
+    mkdir -p $out/lib/pkgconfig
+    cp arpack.pc $out/lib/pkgconfig/
+  '';
+
+
+  meta = {
+    homepage = https://github.com/opencollab/arpack-ng;
+    description = ''
+      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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/science/math/blas/default.nix b/nixpkgs/pkgs/development/libraries/science/math/blas/default.nix
new file mode 100644
index 000000000000..286be260052b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/science/math/blas/default.nix
@@ -0,0 +1,68 @@
+{ stdenv, fetchurl, gfortran }:
+
+stdenv.mkDerivation rec {
+  name = "blas-${version}";
+  version = "3.8.0";
+
+  src = fetchurl {
+    url = "http://www.netlib.org/blas/${name}.tgz";
+    sha256 = "1s24iry5197pskml4iygasw196bdhplj0jmbsb9jhabcjqj2mpsm";
+  };
+
+  buildInputs = [ gfortran ];
+
+  configurePhase = ''
+    echo >make.inc  "SHELL = ${stdenv.shell}"
+    echo >>make.inc "PLAT = _LINUX"
+    echo >>make.inc "FORTRAN = gfortran"
+    echo >>make.inc "OPTS = -O2 -fPIC"
+    echo >>make.inc "DRVOPTS = $$(OPTS)"
+    echo >>make.inc "NOOPT = -O0 -fPIC"
+    echo >>make.inc "LOADER = gfortran"
+    echo >>make.inc "LOADOPTS ="
+    echo >>make.inc "ARCH = gfortran"
+    echo >>make.inc "ARCHFLAGS = -shared -o"
+    echo >>make.inc "RANLIB = echo"
+    echo >>make.inc "BLASLIB = libblas.so.${version}"
+  '';
+
+  buildPhase = ''
+    make
+    echo >>make.inc "ARCHFLAGS = "
+    echo >>make.inc "BLASLIB = libblas.a"
+    echo >>make.inc "ARCH = ar rcs"
+    echo >>make.inc "RANLIB = ranlib"
+    make
+  '';
+
+  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 ;")
+    + ''
+    install ${dashD} -m755 libblas.a "$out/lib/libblas.a"
+    install ${dashD} -m755 libblas.so.${version} "$out/lib/libblas.so.${version}"
+    ln -s libblas.so.${version} "$out/lib/libblas.so.3"
+    ln -s libblas.so.${version} "$out/lib/libblas.so"
+  '';
+
+  preFixup = stdenv.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"
+    done
+  '';
+
+  meta = {
+    description = "Basic Linear Algebra Subprograms";
+    license = stdenv.lib.licenses.publicDomain;
+    homepage = http://www.netlib.org/blas/;
+    platforms = stdenv.lib.platforms.unix;
+  };
+
+  # We use linkName to pass a different name to --with-blas-libs for
+  # fflas-ffpack and linbox, because we use blas on darwin but openblas
+  # elsewhere.
+  # See see https://github.com/NixOS/nixpkgs/pull/45013.
+  passthru.linkName = "blas";
+}
diff --git a/nixpkgs/pkgs/development/libraries/science/math/brial/default.nix b/nixpkgs/pkgs/development/libraries/science/math/brial/default.nix
new file mode 100644
index 000000000000..38b77781867d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/science/math/brial/default.nix
@@ -0,0 +1,46 @@
+{ stdenv
+, fetchFromGitHub
+, autoreconfHook
+, pkgconfig
+, boost
+, m4ri
+, gd
+}:
+
+stdenv.mkDerivation rec {
+  version = "1.2.4";
+  name = "brial-${version}";
+
+  src = fetchFromGitHub {
+    owner = "BRiAl";
+    repo = "BRiAl";
+    rev = version;
+    sha256 = "08skgmwz190mvpkh0ddx92ilva6bxidxwh1qg16ipi768x92193s";
+  };
+
+  # FIXME package boost-test and enable checks
+  doCheck = false;
+
+  configureFlags = [
+    "--with-boost-unit-test-framework=no"
+  ];
+
+  buildInputs = [
+    boost
+    m4ri
+    gd
+  ];
+
+  nativeBuildInputs = [
+    autoreconfHook
+    pkgconfig
+  ];
+
+  meta = with stdenv.lib; {
+    homepage = https://github.com/BRiAl/BRiAl;
+    description = "Legacy version of PolyBoRi maintained by sagemath developers";
+    license = licenses.gpl2Plus;
+    maintainers = with maintainers; [ timokau ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/science/math/caffe2/default.nix b/nixpkgs/pkgs/development/libraries/science/math/caffe2/default.nix
new file mode 100644
index 000000000000..d568e9452021
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/science/math/caffe2/default.nix
@@ -0,0 +1,144 @@
+{ stdenv, lib, config, fetchFromGitHub
+, cmake
+, glog, google-gflags, gtest
+, protobuf, snappy
+, python, future, six, python-protobuf, numpy, pydot
+, eigen
+, doxygen
+, useCuda ? (config.cudaSupport or false), cudatoolkit ? null
+, useCudnn ? (config.cudnnSupport or false), cudnn ? null
+, useOpenmp ? false, openmp ? null
+, useOpencv3 ? true, opencv3 ? null
+, useLeveldb ? false, leveldb ? null
+, useLmdb ? true, lmdb ? null
+, useRocksdb ? false, rocksdb ? null
+, useZeromq ? false, zeromq ? null
+, useMpi ? false, mpi ? null
+# TODO: distributed computations
+#, useGloo ? false
+#, useNccl ? false
+#, useNnpack ? false
+}:
+
+assert useCuda -> cudatoolkit != null;
+assert useCudnn -> (useCuda && cudnn != null);
+assert useOpencv3 -> opencv3 != null;
+assert useLeveldb -> leveldb != null;
+assert useLmdb -> lmdb != null;
+assert useRocksdb -> rocksdb != null;
+assert useZeromq -> zeromq != null;
+assert useMpi -> mpi != null;
+
+let
+  # Third party modules that caffe2 holds as git submodules.
+  # Download them and create symlinks from caffe2/third_party.
+  installExtraSrc = extra: ''
+    rmdir "third_party/${extra.dst}"
+    ln -s "${extra.src}" "third_party/${extra.dst}"
+  '';
+
+  cub = {
+    src = fetchFromGitHub rec {
+      owner  = "NVlabs";
+      repo   = "cub";
+      rev    = "v1.7.4";
+      sha256 = "0ksd5n1lxqhm5l5cd2lps4cszhjkf6gmzahaycs7nxb06qci8c66";
+    };
+    dst = "cub";
+  };
+
+  pybind11 = {
+    src = fetchFromGitHub {
+      owner  = "pybind";
+      repo   = "pybind11";
+      rev    = "86e2ad4f77442c3350f9a2476650da6bee253c52";
+      sha256 = "05gi58dirvc8fgm0avpydvidzsbh2zrzgfaq671ym09f6dz0bcgz";
+    };
+    dst = "pybind11";
+  };
+
+  ccVersion = (builtins.parseDrvName stdenv.cc.name).version;
+in
+
+stdenv.mkDerivation rec {
+  name = "caffe2-${version}";
+  version = "0.8.1";
+  src = fetchFromGitHub {
+    owner = "caffe2";
+    repo = "caffe2";
+    rev = "v${version}";
+    sha256 = "18y7zjc69j6n5642l9caddl641b0djf3pjn4wacdsc1wk1jiyqk8";
+  };
+
+  nativeBuildInputs = [ cmake doxygen gtest ];
+  outputs = [ "bin" "out" ];
+  propagatedBuildOutputs = [ ]; # otherwise propagates out -> bin cycle
+
+  buildInputs = [ glog google-gflags protobuf snappy eigen ]
+    ++ lib.optional useCuda cudatoolkit
+    ++ lib.optional useCudnn cudnn
+    ++ lib.optional useOpenmp openmp
+    ++ lib.optional useOpencv3 opencv3
+    ++ lib.optional useLeveldb leveldb
+    ++ lib.optional useLmdb lmdb
+    ++ lib.optional useRocksdb rocksdb
+    ++ lib.optional useZeromq zeromq
+  ;
+  propagatedBuildInputs = [ numpy future six python-protobuf pydot ];
+
+  patches = lib.optional (stdenv.cc.isGNU && lib.versionAtLeast ccVersion "7.0.0") [
+    ./fix_compilation_on_gcc7.patch
+  ] ++ lib.optional stdenv.cc.isClang [ ./update_clang_cvtsh_bugfix.patch ];
+
+  cmakeFlags = [ ''-DBUILD_TEST=OFF''
+                 ''-DBUILD_PYTHON=ON''
+                 ''-DUSE_CUDA=${if useCuda then ''ON''else ''OFF''}''
+                 ''-DUSE_OPENMP=${if useOpenmp then ''ON''else ''OFF''}''
+                 ''-DUSE_OPENCV=${if useOpencv3 then ''ON''else ''OFF''}''
+                 ''-DUSE_MPI=${if useMpi then ''ON''else ''OFF''}''
+                 ''-DUSE_LEVELDB=${if useLeveldb then ''ON''else ''OFF''}''
+                 ''-DUSE_LMDB=${if useLmdb then ''ON''else ''OFF''}''
+                 ''-DUSE_ROCKSDB=${if useRocksdb then ''ON''else ''OFF''}''
+                 ''-DUSE_ZMQ=${if useZeromq  then ''ON''else ''OFF''}''
+                 ''-DUSE_GLOO=OFF''
+                 ''-DUSE_NNPACK=OFF''
+                 ''-DUSE_NCCL=OFF''
+                 ''-DUSE_REDIS=OFF''
+                 ''-DUSE_FFMPEG=OFF''
+               ]
+               ++ lib.optional useCuda [
+                 ''-DCUDA_TOOLKIT_ROOT_DIR=${cudatoolkit}''
+                 ''-DCUDA_FAST_MATH=ON''
+                 ''-DCUDA_HOST_COMPILER=${cudatoolkit.cc}/bin/gcc''
+               ];
+
+  preConfigure = ''
+    ${installExtraSrc cub}
+    ${installExtraSrc pybind11}
+    # XXX hack
+    export NIX_CFLAGS_COMPILE="-I ${eigen}/include/eigen3/ $NIX_CFLAGS_COMPILE"
+  '';
+
+  postInstall = ''
+    moveToOutput "bin" "$bin"
+    mkdir -p $out/lib/${python.libPrefix}
+    ln -s $out/ $out/${python.sitePackages}
+  '';
+
+  doCheck = false;
+  enableParallelBuilding = true;
+
+  meta = {
+    homepage = https://caffe2.ai/;
+    description = "A new lightweight, modular, and scalable deep learning framework";
+    longDescription = ''
+      Caffe2 aims to provide an easy and straightforward way for you to experiment
+      with deep learning and leverage community contributions of new models and
+      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 ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/science/math/caffe2/fix_compilation_on_gcc7.patch b/nixpkgs/pkgs/development/libraries/science/math/caffe2/fix_compilation_on_gcc7.patch
new file mode 100644
index 000000000000..f319f20233a2
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/science/math/caffe2/fix_compilation_on_gcc7.patch
@@ -0,0 +1,46 @@
+diff --git a/caffe2/operators/recurrent_network_op.cc b/caffe2/operators/recurrent_network_op.cc
+index dd4fded..5995e8a 100644
+--- a/caffe2/operators/recurrent_network_op.cc
++++ b/caffe2/operators/recurrent_network_op.cc
+@@ -1,4 +1,4 @@
+-#include "recurrent_network_op.h"
++#include "caffe2/operators/recurrent_network_op.h"
+ #include "caffe2/core/workspace.h"
+ 
+ namespace caffe2 {
+diff --git a/caffe2/operators/recurrent_network_op.h b/caffe2/operators/recurrent_network_op.h
+index 55328e5..ea898bc 100644
+--- a/caffe2/operators/recurrent_network_op.h
++++ b/caffe2/operators/recurrent_network_op.h
+@@ -762,8 +762,8 @@ class AccumulateInputGradientOp : public Operator<Context> {
+   USE_OPERATOR_CONTEXT_FUNCTIONS;
+ 
+   bool RunOnDevice() override {
+-    const auto t =
+-        OperatorBase::Input<Tensor<CPUContext>>(0).template data<int32_t>()[0];
++    const auto& t0 = OperatorBase::Input<Tensor<CPUContext>>(0);
++    const auto t = t0.template data<int32_t>()[0];
+     auto& og = Input(1);
+     auto* g = Output(0);
+ 
+diff --git a/caffe2/queue/queue_ops.h b/caffe2/queue/queue_ops.h
+index f2c0a33..642343f 100644
+--- a/caffe2/queue/queue_ops.h
++++ b/caffe2/queue/queue_ops.h
+@@ -17,13 +17,10 @@ class CreateBlobsQueueOp final : public Operator<Context> {
+         name(operator_def.output().Get(0)) {}
+ 
+   bool RunOnDevice() override {
+-    const auto capacity =
+-        OperatorBase::template GetSingleArgument<int>("capacity", 1);
+-    const auto numBlobs =
+-        OperatorBase::template GetSingleArgument<int>("num_blobs", 1);
++    const auto capacity = GetSingleArgument("capacity", 1);
++    const auto numBlobs = GetSingleArgument("num_blobs", 1);
+     const auto enforceUniqueName =
+-        OperatorBase::template GetSingleArgument<int>(
+-            "enforce_unique_name", false);
++        GetSingleArgument("enforce_unique_name", false);
+     const auto fieldNames =
+         OperatorBase::template GetRepeatedArgument<std::string>("field_names");
+     CAFFE_ENFORCE_EQ(this->OutputSize(), 1);
diff --git a/nixpkgs/pkgs/development/libraries/science/math/caffe2/update_clang_cvtsh_bugfix.patch b/nixpkgs/pkgs/development/libraries/science/math/caffe2/update_clang_cvtsh_bugfix.patch
new file mode 100644
index 000000000000..d908cb6ba80b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/science/math/caffe2/update_clang_cvtsh_bugfix.patch
@@ -0,0 +1,55 @@
+diff --git a/caffe2/perfkernels/cvtsh_ss_bugfix.h b/caffe2/perfkernels/cvtsh_ss_bugfix.h
+index bd06681..00172b7 100644
+--- a/caffe2/perfkernels/cvtsh_ss_bugfix.h
++++ b/caffe2/perfkernels/cvtsh_ss_bugfix.h
+@@ -1,10 +1,36 @@
++/**
++ * Copyright (c) 2016-present, Facebook, Inc.
++ *
++ * Licensed under the Apache License, Version 2.0 (the "License");
++ * you may not use this file except in compliance with the License.
++ * You may obtain a copy of the License at
++ *
++ *     http://www.apache.org/licenses/LICENSE-2.0
++ *
++ * Unless required by applicable law or agreed to in writing, software
++ * distributed under the License is distributed on an "AS IS" BASIS,
++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++ * See the License for the specific language governing permissions and
++ * limitations under the License.
++ */
++
+ #pragma once
+ 
+-#if defined(__APPLE__) && (__clang_major__ < 8)
++// Apple clang was fixed in 8.1
++#if defined(__apple_build_version__) && ((__clang_major__ < 8) || ((__clang_major__ == 8) && (__clang_minor__ < 1)))
++#define __APPLE_NEED_FIX 1
++#endif
++
++// Regular clang was fixed in 3.9
++#if defined(__clang__) && (__clang_major__ < 4) && (__clang_minor__ < 9)
++#define __CLANG_NEED_FIX 1
++#endif
++
++#if __APPLE_NEED_FIX || __CLANG_NEED_FIX
+ 
+ #include <emmintrin.h>
+ 
+-// This version of apple clang has a bug that _cvtsh_ss is not defined, see
++// This version of clang has a bug that _cvtsh_ss is not defined, see
+ // https://reviews.llvm.org/D16177
+ static __inline float
+     __attribute__((__always_inline__, __nodebug__, __target__("f16c")))
+@@ -15,7 +41,10 @@ _cvtsh_ss(unsigned short a)
+   return r[0];
+ }
+ 
+-#endif // defined(__APPLE__) && (__clang_major__ < 8)
++#endif // __APPLE_NEED_FIX || __CLANG_NEED_FIX
++
++#undef __APPLE_NEED_FIX
++#undef __CLANG_NEED_FIX
+ 
+ #ifdef _MSC_VER
+ 
diff --git a/nixpkgs/pkgs/development/libraries/science/math/cholmod-extra/default.nix b/nixpkgs/pkgs/development/libraries/science/math/cholmod-extra/default.nix
new file mode 100644
index 000000000000..537fcb93a87e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/science/math/cholmod-extra/default.nix
@@ -0,0 +1,41 @@
+{ stdenv, fetchFromGitHub, gfortran, suitesparse, openblas }:
+let
+  suitesparse_ = suitesparse;
+in let
+  # SuiteSparse must use the same openblas
+  suitesparse = suitesparse_.override { inherit openblas; };
+in stdenv.mkDerivation rec {
+
+  name = "${pname}-${version}";
+  pname = "cholmod-extra";
+  version = "1.2.0";
+
+  src = fetchFromGitHub {
+    repo = pname;
+    owner = "jluttine";
+    rev = version;
+    sha256 = "0hz1lfp0zaarvl0dv0zgp337hyd8np41kmdpz5rr3fc6yzw7vmkg";
+  };
+
+  buildInputs = [ suitesparse gfortran openblas ];
+
+  buildFlags = [
+    "BLAS=-lopenblas"
+  ];
+
+  installFlags = [
+    "INSTALL_LIB=$(out)/lib"
+    "INSTALL_INCLUDE=$(out)/include"
+  ];
+
+  doCheck = true;
+
+  meta = with stdenv.lib; {
+    homepage = https://github.com/jluttine/cholmod-extra;
+    description = "A set of additional routines for SuiteSparse CHOLMOD Module";
+    license = with licenses; [ gpl2Plus ];
+    maintainers = with maintainers; [ jluttine ];
+    platforms = with platforms; unix;
+  };
+
+}
diff --git a/nixpkgs/pkgs/development/libraries/science/math/clblas/default.nix b/nixpkgs/pkgs/development/libraries/science/math/clblas/default.nix
new file mode 100644
index 000000000000..40dbfc53e2cb
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/science/math/clblas/default.nix
@@ -0,0 +1,69 @@
+{ stdenv
+, fetchFromGitHub
+, cmake
+, gfortran
+, blas
+, boost
+, python
+, ocl-icd
+, opencl-headers
+, Accelerate, CoreGraphics, CoreVideo, OpenCL
+}:
+
+stdenv.mkDerivation rec {
+  name = "clblas-${version}";
+  version = "2.12";
+
+  src = fetchFromGitHub {
+    owner = "clMathLibraries";
+    repo = "clBLAS";
+    rev = "v${version}";
+    sha256 = "154mz52r5hm0jrp5fqrirzzbki14c1jkacj75flplnykbl36ibjs";
+  };
+
+  patches = [ ./platform.patch ];
+
+  postPatch = ''
+    sed -i -re 's/(set\(\s*Boost_USE_STATIC_LIBS\s+).*/\1OFF\ \)/g' src/CMakeLists.txt
+  '';
+
+  preConfigure = ''
+    cd src
+  '';
+
+  cmakeFlags = [
+     "-DBUILD_TEST=OFF"
+  ];
+
+  buildInputs = [
+    cmake
+    gfortran
+    blas
+    python
+    boost
+  ] ++ stdenv.lib.optionals (!stdenv.isDarwin) [
+    ocl-icd
+    opencl-headers
+  ] ++ stdenv.lib.optionals stdenv.isDarwin [
+    Accelerate
+    CoreGraphics
+    CoreVideo
+  ];
+  propagatedBuildInputs = stdenv.lib.optionals stdenv.isDarwin [
+    OpenCL
+  ];
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    homepage = "https://github.com/clMathLibraries/clBLAS";
+    description = "A software library containing BLAS functions written in OpenCL";
+    longDescription = ''
+      This package contains a library of BLAS functions on top of OpenCL.
+    '';
+    license = licenses.asl20;
+    maintainers = with maintainers; [ artuuge ];
+    platforms = platforms.unix;
+  };
+
+}
diff --git a/nixpkgs/pkgs/development/libraries/science/math/clblas/platform.patch b/nixpkgs/pkgs/development/libraries/science/math/clblas/platform.patch
new file mode 100644
index 000000000000..87404a426a4b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/science/math/clblas/platform.patch
@@ -0,0 +1,34 @@
+diff --git a/src/library/tools/ktest/config.cpp b/src/library/tools/ktest/config.cpp
+index 8b20128..faf9bde 100644
+--- a/src/library/tools/ktest/config.cpp
++++ b/src/library/tools/ktest/config.cpp
+@@ -24,8 +24,6 @@
+ 
+ using namespace clMath;
+ 
+-static const char DEFAULT_PLATFORM_NAME[] = "AMD Accelerated Parallel Processing";
+-
+ Config::Config() :
+     defaultConfig_(""),
+     cpp_("ktest.cpp"),
+@@ -35,7 +33,10 @@ Config::Config() :
+     hasFuncID_(false), hasSubdims_(false),
+     skipAccuracy_(false)
+ {
+-    setPlatform(DEFAULT_PLATFORM_NAME);
++    platform_ = NULL;
++    setPlatform("");
++
++    device_ = NULL;
+     setDevice("");
+ 
+     memset(&kargs_, 0, sizeof(kargs_));
+@@ -262,7 +263,7 @@ Config::setPlatform(const std::string& name)
+             continue;
+         }
+         if (name.empty()) {
+-            found = (strcmp(pname, DEFAULT_PLATFORM_NAME) == 0);
++	    found = true;
+         }
+         else {
+             found = (strcmp(pname, name.c_str()) == 0);
diff --git a/nixpkgs/pkgs/development/libraries/science/math/cliquer/default.nix b/nixpkgs/pkgs/development/libraries/science/math/cliquer/default.nix
new file mode 100644
index 000000000000..2441aff9fa30
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/science/math/cliquer/default.nix
@@ -0,0 +1,38 @@
+{ stdenv
+, fetchFromGitHub
+, autoreconfHook
+}:
+
+stdenv.mkDerivation rec {
+  version = "1.21";
+  name = "cliquer-${version}";
+
+  # autotoolized version of the original cliquer
+  src = fetchFromGitHub {
+    owner = "dimpase";
+    repo = "autocliquer";
+    rev = "v${version}";
+    sha256 = "180i4qj1a25qfp75ig2d3144xfpb1dgcgpha0iqqghd7di4awg7z";
+  };
+
+  doCheck = true;
+
+  buildInputs = [
+    autoreconfHook
+  ];
+
+  meta = with stdenv.lib; {
+    homepage = https://users.aalto.fi/~pat/cliquer.html;
+    downloadPage = src.meta.homepage; # autocliquer
+    description = "Routines for clique searching";
+    longDescription = ''
+      Cliquer is a set of C routines for finding cliques in an arbitrary weighted graph.
+      It uses an exact branch-and-bound algorithm developed by Patric Östergård.
+      It is designed with the aim of being efficient while still being flexible and
+      easy to use.
+    '';
+    license = licenses.gpl2Plus;
+    maintainers = with maintainers; [ timokau ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/science/math/cudnn/default.nix b/nixpkgs/pkgs/development/libraries/science/math/cudnn/default.nix
new file mode 100644
index 000000000000..a33e3ec20096
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/science/math/cudnn/default.nix
@@ -0,0 +1,69 @@
+{ callPackage, cudatoolkit_7, cudatoolkit_7_5, cudatoolkit_8, cudatoolkit_9_0, cudatoolkit_9_1, cudatoolkit_9_2, cudatoolkit_10_0 }:
+
+let
+  generic = args: callPackage (import ./generic.nix (removeAttrs args ["cudatoolkit"])) {
+    inherit (args) cudatoolkit;
+  };
+
+in rec {
+  cudnn_cudatoolkit_7 = generic rec {
+    # Old URL is v4 instead of v4.0 for some reason...
+    version = "4";
+    cudatoolkit = cudatoolkit_7;
+    srcName = "cudnn-${cudatoolkit.majorVersion}-linux-x64-v4.0-prod.tgz";
+    sha256 = "01a4v5j4v9n2xjqcc4m28c3m67qrvsx87npvy7zhx7w8smiif2fd";
+  };
+
+  cudnn_cudatoolkit_7_5 = generic rec {
+    version = "6.0";
+    cudatoolkit = cudatoolkit_7_5;
+    srcName = "cudnn-${cudatoolkit.majorVersion}-linux-x64-v${version}.tgz";
+    sha256 = "0b68hv8pqcvh7z8xlgm4cxr9rfbjs0yvg1xj2n5ap4az1h3lp3an";
+  };
+
+  cudnn6_cudatoolkit_8 = generic rec {
+    version = "6.0";
+    cudatoolkit = cudatoolkit_8;
+    srcName = "cudnn-${cudatoolkit.majorVersion}-linux-x64-v${version}.tgz";
+    sha256 = "173zpgrk55ri8if7s5yngsc89ajd6hz4pss4cdxlv6lcyh5122cv";
+  };
+
+  cudnn_cudatoolkit_8 = generic rec {
+    version = "7.0.5";
+    cudatoolkit = cudatoolkit_8;
+    srcName = "cudnn-${cudatoolkit.majorVersion}-linux-x64-v7.tgz";
+    sha256 = "9e0b31735918fe33a79c4b3e612143d33f48f61c095a3b993023cdab46f6d66e";
+  };
+
+  cudnn_cudatoolkit_9_0 = generic rec {
+    version = "7.3.0";
+    cudatoolkit = cudatoolkit_9_0;
+    srcName = "cudnn-${cudatoolkit.majorVersion}-linux-x64-v7.3.0.29.tgz";
+    sha256 = "16z4vgbcmbayk4hppz0xshgs3g07blkp4j25cxcjqyrczx1r0gs0";
+  };
+
+  cudnn_cudatoolkit_9_1 = generic rec {
+    version = "7.1.3";
+    cudatoolkit = cudatoolkit_9_1;
+    srcName = "cudnn-${cudatoolkit.majorVersion}-linux-x64-v7.1.tgz";
+    sha256 = "0a0237gpr0p63s92njai0xvxmkbailzgfsvh7n9fnz0njhvnsqfx";
+  };
+
+  cudnn_cudatoolkit_9_2 = generic rec {
+    version = "7.2.1";
+    cudatoolkit = cudatoolkit_9_2;
+    srcName = "cudnn-${cudatoolkit.majorVersion}-linux-x64-v7.2.1.38.tgz";
+    sha256 = "1sf215wm6zgr17gs6sxfhw61b7a0qmcxiwhgy1b4nqdyxpqgay1y";
+  };
+
+  cudnn_cudatoolkit_9 = cudnn_cudatoolkit_9_2;
+
+  cudnn_cudatoolkit_10_0 = generic rec {
+    version = "7.4.2";
+    cudatoolkit = cudatoolkit_10_0;
+    srcName = "cudnn-${cudatoolkit.majorVersion}-linux-x64-v7.4.2.24.tgz";
+    sha256 = "18ys0apiz9afid2s6lvy9qbyi8g66aimb2a7ikl1f3dm09mciprf";
+  };
+
+  cudnn_cudatoolkit_10 = cudnn_cudatoolkit_10_0;
+}
diff --git a/nixpkgs/pkgs/development/libraries/science/math/cudnn/generic.nix b/nixpkgs/pkgs/development/libraries/science/math/cudnn/generic.nix
new file mode 100644
index 000000000000..3c448abeccf6
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/science/math/cudnn/generic.nix
@@ -0,0 +1,59 @@
+{ version
+, srcName
+, sha256
+}:
+
+{ stdenv
+, lib
+, cudatoolkit
+, fetchurl
+, addOpenGLRunpath
+}:
+
+stdenv.mkDerivation rec {
+  name = "cudatoolkit-${cudatoolkit.majorVersion}-cudnn-${version}";
+
+  inherit version;
+  src = fetchurl {
+    # URL from NVIDIA docker containers: https://gitlab.com/nvidia/cuda/blob/centos7/7.0/runtime/cudnn4/Dockerfile
+    url = "https://developer.download.nvidia.com/compute/redist/cudnn/v${version}/${srcName}";
+    inherit sha256;
+  };
+
+  nativeBuildInputs = [ addOpenGLRunpath ];
+
+  installPhase = ''
+    function fixRunPath {
+      p=$(patchelf --print-rpath $1)
+      patchelf --set-rpath "$p:${lib.makeLibraryPath [ stdenv.cc.cc ]}" $1
+    }
+    fixRunPath lib64/libcudnn.so
+
+    mkdir -p $out
+    cp -a include $out/include
+    cp -a lib64 $out/lib64
+  '';
+
+  # Set RUNPATH so that libcuda in /run/opengl-driver(-32)/lib can be found.
+  # See the explanation in addOpenGLRunpath.
+  postFixup = ''
+    addOpenGLRunpath $out/lib/lib*.so
+  '';
+
+  propagatedBuildInputs = [
+    cudatoolkit
+  ];
+
+  passthru = {
+    inherit cudatoolkit;
+    majorVersion = lib.head (lib.splitString "." version);
+  };
+
+  meta = with stdenv.lib; {
+    description = "NVIDIA CUDA Deep Neural Network library (cuDNN)";
+    homepage = "https://developer.nvidia.com/cudnn";
+    license = licenses.unfree;
+    platforms = [ "x86_64-linux" ];
+    maintainers = with maintainers; [ mdaiter ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/science/math/ecos/default.nix b/nixpkgs/pkgs/development/libraries/science/math/ecos/default.nix
new file mode 100644
index 000000000000..645a865eb955
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/science/math/ecos/default.nix
@@ -0,0 +1,37 @@
+{ stdenv, fetchFromGitHub }:
+
+stdenv.mkDerivation rec {
+  name = "ecos-${version}";
+  version = "2.0.6";
+
+  src = fetchFromGitHub {
+    owner = "embotech";
+    repo = "ecos";
+    rev = "v${version}";
+    sha256 = "11v958j66wq30gxpjpkgl7n3rvla845lygz8fl39pgf1vk9sdyc7";
+  };
+
+  buildPhase = ''
+    make all shared
+  '';
+
+  doCheck = true;
+  checkPhase = ''
+    make test
+    ./runecos
+  '';
+
+  installPhase = ''
+    mkdir -p $out/lib
+    cp lib*.a lib*.so $out/lib
+    cp -r include $out/
+  '';
+
+  meta = with stdenv.lib; {
+    description = "A lightweight conic solver for second-order cone programming";
+    homepage = https://www.embotech.com/ECOS;
+    license = licenses.gpl3;
+    platforms = platforms.all;
+    maintainers = [ maintainers.bhipple ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/science/math/fenics/default.nix b/nixpkgs/pkgs/development/libraries/science/math/fenics/default.nix
new file mode 100644
index 000000000000..8134cc63eb02
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/science/math/fenics/default.nix
@@ -0,0 +1,169 @@
+{ stdenv
+, fetchurl
+, boost
+, cmake
+, doxygen
+, eigen
+, numpy
+, pkgconfig
+, pytest
+, pythonPackages
+, six
+, sympy
+, gtest ? null
+, hdf5 ? null
+, mpi ? null
+, ply ? null
+, python ? null
+, sphinx ? null
+, suitesparse ? null
+, swig ? null
+, vtk ? null
+, zlib ? null
+, docs ? false
+, pythonBindings ? false
+, doCheck ? true }:
+
+assert pythonBindings -> python != null && ply != null && swig != null;
+
+let
+  version = "2017.1.0";
+
+  dijitso = pythonPackages.buildPythonPackage {
+    name = "dijitso-${version}";
+    src = fetchurl {
+      url = "https://bitbucket.org/fenics-project/dijitso/downloads/dijitso-${version}.tar.gz";
+      sha256 = "0mw6mynjmg6yl3l2k33yra2x84s4r6mh44ylhk9znjfk74jra8zg";
+    };
+    buildInputs = [ numpy six ];
+    nativeBuildInputs = [ pytest ];
+    preCheck = ''
+      export HOME=$PWD
+    '';
+    checkPhase = ''
+      runHook preCheck
+      py.test test/
+      runHook postCheck
+    '';
+    meta = {
+      description = "Distributed just-in-time shared library building";
+      homepage = https://fenicsproject.org/;
+      platforms = stdenv.lib.platforms.all;
+      license = stdenv.lib.licenses.lgpl3;
+    };
+  };
+
+  fiat = pythonPackages.buildPythonPackage {
+    name = "fiat-${version}";
+    src = fetchurl {
+      url = "https://bitbucket.org/fenics-project/fiat/downloads/fiat-${version}.tar.gz";
+      sha256 = "156ybz70n4n7p88q4pfkvbmg1xr2ll80inzr423mki0nml0q8a6l";
+    };
+    buildInputs = [ numpy pytest six sympy ];
+    checkPhase = ''
+      py.test test/unit/
+    '';
+    meta = {
+      description = "Automatic generation of finite element basis functions";
+      homepage = https://fenicsproject.org/;
+      platforms = stdenv.lib.platforms.all;
+      license = stdenv.lib.licenses.lgpl3;
+    };
+  };
+
+  ufl = pythonPackages.buildPythonPackage {
+    name = "ufl-${version}";
+    src = fetchurl {
+      url = "https://bitbucket.org/fenics-project/ufl/downloads/ufl-${version}.tar.gz";
+      sha256 = "13ysimmwad429fjjs07j1fw1gq196p021j7mv66hwrljyh8gm1xg";
+    };
+    buildInputs = [ numpy pytest six ];
+    checkPhase = ''
+      py.test test/
+    '';
+    meta = {
+      description = "A domain-specific language for finite element variational forms";
+      homepage = http://fenicsproject.org/;
+      platforms = stdenv.lib.platforms.all;
+      license = stdenv.lib.licenses.lgpl3;
+    };
+  };
+
+  ffc = pythonPackages.buildPythonPackage {
+    name = "ffc-${version}";
+    src = fetchurl {
+      url = "https://bitbucket.org/fenics-project/ffc/downloads/ffc-${version}.tar.gz";
+      sha256 = "1cw7zsrjms11xrfg7x9wjd90x3w4v5s1wdwa18xqlycqz7cc8wr0";
+    };
+    buildInputs = [ dijitso fiat numpy pytest six sympy ufl ];
+    checkPhase = ''
+      export HOME=$PWD
+      py.test test/unit/
+    '';
+    meta = {
+      description = "A compiler for finite element variational forms";
+      homepage = http://fenicsproject.org/;
+      platforms = stdenv.lib.platforms.all;
+      license = stdenv.lib.licenses.lgpl3;
+    };
+  };
+
+  instant = pythonPackages.buildPythonPackage {
+    name = "instant-${version}";
+    src = fetchurl {
+      url = "https://bitbucket.org/fenics-project/instant/downloads/instant-${version}.tar.gz";
+      sha256 = "1rsyh6n04w0na2zirfdcdjip8k8ikb8fc2x94fq8ylc3lpcnpx9q";
+    };
+    buildInputs = [ numpy six ];
+    meta = {
+      description = "Instant inlining of C and C++ code in Python";
+      homepage = http://fenicsproject.org/;
+      platforms = stdenv.lib.platforms.all;
+      license = stdenv.lib.licenses.lgpl3;
+    };
+  };
+
+in
+stdenv.mkDerivation {
+  name = "dolfin-${version}";
+  src = fetchurl {
+    url = "https://bitbucket.org/fenics-project/dolfin/downloads/dolfin-${version}.tar.gz";
+    sha256 = "14hfb5q6rz79zmy742s2fiqkb9j2cgh5bsg99v76apcr84nklyds";
+  };
+  propagatedBuildInputs = [ dijitso fiat numpy six ufl ];
+  buildInputs = [
+    boost cmake dijitso doxygen eigen ffc fiat gtest hdf5 instant mpi
+    numpy pkgconfig six sphinx suitesparse sympy ufl vtk zlib
+    ] ++ stdenv.lib.optionals pythonBindings [ ply python numpy swig ];
+  patches = [ ./unicode.patch ];
+  cmakeFlags = "-DDOLFIN_CXX_FLAGS=-std=c++11"
+    + " -DDOLFIN_AUTO_DETECT_MPI=OFF"
+    + " -DDOLFIN_ENABLE_CHOLMOD=" + (if suitesparse != null then "ON" else "OFF")
+    + " -DDOLFIN_ENABLE_DOCS=" + (if docs then "ON" else "OFF")
+    + " -DDOLFIN_ENABLE_GTEST=" + (if gtest != null then "ON" else "OFF")
+    + " -DDOLFIN_ENABLE_HDF5=" + (if hdf5 != null then "ON" else "OFF")
+    + " -DDOLFIN_ENABLE_MPI=" + (if mpi != null then "ON" else "OFF")
+    + " -DDOLFIN_ENABLE_PARMETIS=OFF"
+    + " -DDOLFIN_ENABLE_PETSC4PY=OFF"
+    + " -DDOLFIN_ENABLE_PETSC=OFF"
+    + " -DDOLFIN_ENABLE_PYTHON=" + (if pythonBindings then "ON" else "OFF")
+    + " -DDOLFIN_ENABLE_SCOTCH=OFF"
+    + " -DDOLFIN_ENABLE_SLEPC4PY=OFF"
+    + " -DDOLFIN_ENABLE_SLEPC=OFF"
+    + " -DDOLFIN_ENABLE_SPHINX=" + (if sphinx != null then "ON" else "OFF")
+    + " -DDOLFIN_ENABLE_TESTING=" + (if doCheck then "ON" else "OFF")
+    + " -DDOLFIN_ENABLE_TRILINOS=OFF"
+    + " -DDOLFIN_ENABLE_UMFPACK=" + (if suitesparse != null then "ON" else "OFF")
+    + " -DDOLFIN_ENABLE_VTK=" + (if vtk != null then "ON" else "OFF")
+    + " -DDOLFIN_ENABLE_ZLIB=" + (if zlib != null then "ON" else "OFF");
+  checkPhase = ''
+    make runtests
+  '';
+  postInstall = "source $out/share/dolfin/dolfin.conf";
+  meta = {
+    description = "The FEniCS Problem Solving Environment in Python and C++";
+    homepage = http://fenicsproject.org/;
+    platforms = stdenv.lib.platforms.darwin;
+    license = stdenv.lib.licenses.lgpl3;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/science/math/fenics/unicode.patch b/nixpkgs/pkgs/development/libraries/science/math/fenics/unicode.patch
new file mode 100644
index 000000000000..2ef2709263ab
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/science/math/fenics/unicode.patch
@@ -0,0 +1,67 @@
+From 0cc9e68de1181d950d4185bf3a87b69a87e4358f Mon Sep 17 00:00:00 2001
+From: "James D. Trotter" <james@simula.no>
+Date: Mon, 14 Aug 2017 16:43:53 +0200
+Subject: [PATCH] Use a UTF-8 encoding to avoid errors with decoding non-ascii
+ characters
+
+---
+ cmake/scripts/generate-swig-interface.py |  6 +++---
+ utils/pylit/pylit.py                     | 10 +++++++---
+ 2 files changed, 10 insertions(+), 6 deletions(-)
+
+diff --git a/cmake/scripts/generate-swig-interface.py b/cmake/scripts/generate-swig-interface.py
+index 843a49229..7b85453d0 100644
+--- a/cmake/scripts/generate-swig-interface.py
++++ b/cmake/scripts/generate-swig-interface.py
+@@ -212,10 +212,10 @@ def extract_swig_modules_dependencies(module_to_submodules, submodule_info):
+                     continue
+ 
+                 # Read code
+-                with open(header_file) as f:
+-                    code = f.read()
+-
+                 try:
++                    with open(header_file, encoding='utf-8') as f:
++                        code = f.read()
++
+                     # Extract type info
+                     used_types, declared_types = parse_and_extract_type_info(code)
+                 except Exception as e:
+diff --git a/utils/pylit/pylit.py b/utils/pylit/pylit.py
+index bcd8ec5e0..8c2964fbd 100755
+--- a/utils/pylit/pylit.py
++++ b/utils/pylit/pylit.py
+@@ -1496,7 +1496,7 @@ def open_streams(infile = '-', outfile = '-', overwrite='update', **keyw):
+     if infile == '-':
+         in_stream = sys.stdin
+     else:
+-        in_stream = open(infile, 'r')
++        in_stream = open(infile, 'r', encoding='utf-8')
+ 
+     if outfile == '-':
+         out_stream = sys.stdout
+@@ -1505,7 +1505,7 @@ def open_streams(infile = '-', outfile = '-', overwrite='update', **keyw):
+     elif overwrite == 'update' and is_newer(outfile, infile):
+         raise IOError((1, "Output file is newer than input file!", outfile))
+     else:
+-        out_stream = open(outfile, 'w')
++        out_stream = open(outfile, 'w', encoding='utf-8')
+     return (in_stream, out_stream)
+ 
+ # is_newer
+@@ -1731,7 +1731,11 @@ def main(args=sys.argv[1:], **defaults):
+ 
+ # Convert and write to out_stream::
+ 
+-    out_stream.write(str(converter))
++    try:
++        out_stream.write(str(converter))
++    except Exception as e:
++        print("Failed to write extract to", out_stream.name)
++        raise
+ 
+     if out_stream is not sys.stdout:
+         print("extract written to", out_stream.name)
+-- 
+2.14.0
+
diff --git a/nixpkgs/pkgs/development/libraries/science/math/flintqs/default.nix b/nixpkgs/pkgs/development/libraries/science/math/flintqs/default.nix
new file mode 100644
index 000000000000..2891429c8578
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/science/math/flintqs/default.nix
@@ -0,0 +1,40 @@
+{ stdenv
+, fetchFromGitHub
+, autoreconfHook
+, gmp
+}:
+
+stdenv.mkDerivation rec {
+  version = "1.0";
+  pname = "flintqs";
+  name = "${pname}-${version}";
+
+  src = fetchFromGitHub {
+    owner = "sagemath";
+    repo = "FlintQS";
+    rev = "v${version}";
+    sha256 = "1f0lnayz6j6qgasx8pbq61d2fqam0wwhsmh6h15l4vq58l1vvbwj";
+  };
+
+  preAutoreconf = ''
+    touch ChangeLog
+  '';
+
+  buildInputs = [
+    gmp
+  ];
+
+  nativeBuildInputs = [
+    autoreconfHook
+  ];
+
+  doCheck = true;
+
+  meta = with stdenv.lib; {
+    homepage = https://github.com/sagemath/FlintQS;
+    description = "Highly optimized multi-polynomial quadratic sieve for integer factorization";
+    license = with licenses; [ gpl2 ];
+    maintainers = with maintainers; [ timokau ];
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/science/math/ipopt/default.nix b/nixpkgs/pkgs/development/libraries/science/math/ipopt/default.nix
new file mode 100644
index 000000000000..30453086d457
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/science/math/ipopt/default.nix
@@ -0,0 +1,32 @@
+{ stdenv, fetchurl, unzip, openblas, gfortran }:
+
+stdenv.mkDerivation rec {
+  name = "ipopt-${version}";
+  version = "3.12.13";
+
+  src = fetchurl {
+    url = "https://www.coin-or.org/download/source/Ipopt/Ipopt-${version}.zip";
+    sha256 = "0kzf05aypx8q5mr3sciclk926ans0yi2d2chjdxxgpi3sza609dx";
+  };
+
+  CXXDEFS = [ "-DHAVE_RAND" "-DHAVE_CSTRING" "-DHAVE_CSTDIO" ];
+
+  configureFlags = [
+    "--with-blas-lib=-lopenblas"
+    "--with-lapack-lib=-lopenblas"
+  ];
+
+  nativeBuildInputs = [ unzip ];
+
+  buildInputs = [ gfortran openblas ];
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    description = "A software package for large-scale nonlinear optimization";
+    homepage = https://projects.coin-or.org/Ipopt;
+    license = licenses.epl10;
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ abbradar ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/science/math/lcalc/default.nix b/nixpkgs/pkgs/development/libraries/science/math/lcalc/default.nix
new file mode 100644
index 000000000000..51fbd9f14cb4
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/science/math/lcalc/default.nix
@@ -0,0 +1,98 @@
+{ stdenv
+, fetchurl
+, fetchpatch
+, pari
+}:
+
+stdenv.mkDerivation rec {
+  version = "1.23";
+  pname = "lcalc";
+  name = "${pname}-${version}";
+
+  src = fetchurl {
+    # original at http://oto.math.uwaterloo.ca/~mrubinst/L_function_public/CODE/L-${version}.tar.gz, no longer available
+    # "newer" version at google code https://code.google.com/archive/p/l-calc/source/default/source
+    url = "mirror://sageupstream/lcalc/lcalc-${version}.tar.bz2";
+    sha256 = "1c6dsdshgxhqppjxvxhp8yhpxaqvnz3d1mlh26r571gkq8z2bm43";
+  };
+
+  preConfigure = "cd src";
+
+  buildInputs = [
+    pari
+  ];
+
+  patches = [
+    # Port to newer pari
+    (fetchpatch {
+      url = "https://git.sagemath.org/sage.git/plain/build/pkgs/lcalc/patches/pari-2.7.patch?id=07d6c37d18811e2b377a9689790a7c5e24da16ba";
+      sha256 = "1x3aslldm8njjm7p9g9s9w2c91kphnci2vpkxkrcxfihw3ayss6c";
+    })
+
+    # Uncomment the definition of lcalc_to_double(const long double& x).
+    # (Necessary for GCC >= 4.6.0, cf. https://trac.sagemath.org/ticket/10892)
+    (fetchpatch {
+      url = "https://git.sagemath.org/sage.git/plain/build/pkgs/lcalc/patches/Lcommon.h.patch?id=07d6c37d18811e2b377a9689790a7c5e24da16ba";
+      sha256 = "0g4ybvsrcv48rmlh1xjnkms19jp25k58azv6ds1f2cm34hxs8fdx";
+    })
+
+    # Include also <time.h> in Lcommandline_numbertheory.h (at least required
+    # on Cygwin, cf. https://trac.sagemath.org/ticket/9845)
+    (fetchpatch {
+      url = "https://git.sagemath.org/sage.git/plain/build/pkgs/lcalc/patches/time.h.patch?id=07d6c37d18811e2b377a9689790a7c5e24da16ba";
+      sha256 = "1brf04n11kkc43ylagf8dm32j5r2g9zv51dp5wag1mpm4p04l7cl";
+    })
+
+    # Fix for gcc >4.6
+    (fetchpatch {
+      url = "https://git.sagemath.org/sage.git/plain/build/pkgs/lcalc/patches/lcalc-1.23_default_parameters_1.patch?id=07d6c37d18811e2b377a9689790a7c5e24da16ba";
+      sha256 = "0i2yvxm5fx4z0v6m4srgh8rj98kijmlvyirlxf1ky0bp2si6bpka";
+    })
+
+    # gcc 5.1
+    (fetchpatch {
+      url = "https://git.sagemath.org/sage.git/plain/build/pkgs/lcalc/patches/lcalc-1.23_default_parameters_2.patch?id=07d6c37d18811e2b377a9689790a7c5e24da16ba";
+      sha256 = "0dqwmxpm9wb53qbypsyfkgsvk2f8nf67sydphd4dkc2vw4yz6vlh";
+    })
+
+    # based on gentoos makefile patch -- fix paths, adhere to flags
+    ./makefile.patch
+
+    # (fetchpatch {
+    #   name = "default-double.patch";
+    #   url = "https://github.com/dimpase/lcalc/pull/1/commits/0500c67b6aa1f492715591669f6647c8f7a3ea59.patch";
+    #   sha256 = "0dqwmxpm9wb53qbypsyfkgsvk2f8nf67sydphd4dkc2vw4yz6vla";
+    # })
+
+    (fetchpatch {
+      name = "c++11.patch";
+      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
+  (fetchpatch {
+    url = "https://git.sagemath.org/sage.git/plain/build/pkgs/lcalc/patches/clang.patch";
+    sha256 = "0bb7656z6cp6i4p2qj745cmq0lhh52v2akl9whi760dynfdxbl18";
+  });
+
+  postPatch = stdenv.lib.optionalString stdenv.isDarwin ''
+    substituteInPlace src/Makefile --replace g++ c++
+  '';
+
+  installFlags = [
+    "DESTDIR=$(out)"
+  ];
+
+  makeFlags = [
+    "PARI_DEFINE=-DINCLUDE_PARI"
+    "PARI_PREFIX=${pari}"
+  ];
+
+  meta = with stdenv.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 ];
+    maintainers = with maintainers; [ timokau ];
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/science/math/lcalc/makefile.patch b/nixpkgs/pkgs/development/libraries/science/math/lcalc/makefile.patch
new file mode 100644
index 000000000000..f55bbe3f24fa
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/science/math/lcalc/makefile.patch
@@ -0,0 +1,113 @@
+diff --git a/src/Makefile b/src/Makefile
+index 84e4e88..56ca676 100644
+--- a/src/Makefile
++++ b/src/Makefile
+@@ -58,7 +58,7 @@ ifeq ($(G5),TRUE)
+    #MACHINE_SPECIFIC_FLAGS = -mpowerpc -mpowerpc64 -m64
+ endif
+ 
+-CCFLAGS =  -Wa,-W -O3 $(OPENMP_FLAG) -Wno-deprecated $(PREPROCESSOR_DEFINE) $(MACHINE_SPECIFIC_FLAGS) $(EXTRA)
++CCFLAGS = $(CXXFLAGS) $(OPENMP_FLAG) $(PREPROCESSOR_DEFINE) $(MACHINE_SPECIFIC_FLAGS)
+ #CCFLAGS =  -Wa,-W -O3 $(OPENMP_FLAG)  $(PREPROCESSOR_DEFINE) $(MACHINE_SPECIFIC_FLAGS) $(EXTRA)
+ #CCFLAGS =  -Wa,-W -O2 -fno-exceptions -Wno-deprecated $(PREPROCESSOR_DEFINE) $(MACHINE_SPECIFIC_FLAGS) $(EXTRA)
+ 
+@@ -68,12 +68,12 @@ CCFLAGS =  -Wa,-W -O3 $(OPENMP_FLAG) -Wno-deprecated $(PREPROCESSOR_DEFINE) $(MA
+ 
+ ifeq ($(PARI_DEFINE),-DINCLUDE_PARI)
+     #location of pari.h.
+-    LOCATION_PARI_H = /usr/local/include/pari #usual location
++    LOCATION_PARI_H = $(PARI_PREFIX)/include/pari #usual location
+ 
+     #location of libpari.a or of libpari.so
+     #depending on whether static or dynamic libraries are being used.
+     #On mac os x it's the former, on linux I think usually the latter.
+-    LOCATION_PARI_LIBRARY = /usr/local/lib #usual location
++    LOCATION_PARI_LIBRARY = $(PARI_PREFIX)/lib #usual location
+ else
+     #supplied as a dummy so as to avoid more ifeq's below
+     LOCATION_PARI_H = .
+@@ -89,24 +89,24 @@ INCLUDEFILES= -I../include
+ 
+ ifeq ($(OS_NAME),Darwin)
+     LDFLAGS2 =
+-    DYN_OPTION=dynamiclib
++    DYN_OPTION=-dynamiclib
+ else
+-    LDFLAGS1 = -Xlinker -export-dynamic #not sure why pari calls these when linking but on the web I found
++    LDFLAGS1 = #not sure why pari calls these when linking but on the web I found
+     #'Libtool provides the `-export-dynamic' link flag (see section Link mode), which does this declaration.
+     #You need to use this flag if you are linking a shared library that will be dlopened'
+     #see notes below
+     #ifeq ($(PARI_DEFINE),-DINCLUDE_PARI)
+-       LDFLAGS2 = $(LDFLAGS1) -Xlinker -rpath -Xlinker $(LOCATION_PARI_LIBRARY)
++       LDFLAGS2 = $(LDFLAGS)
+     #else
+     #    LDFLAGS2 = $(LDFLAGS1)
+     #endif
+-    DYN_OPTION=shared
++    DYN_OPTION=$(LDFLAGS) -shared -Wl,-soname,libLfunction.so
+ endif
+ 
+ ifeq ($(PARI_DEFINE),-DINCLUDE_PARI)
+-    LDFLAGS = $(LDFLAGS2) -L$(LOCATION_PARI_LIBRARY) -lpari
++    MYLDFLAGS = $(LDFLAGS2) -L$(LOCATION_PARI_LIBRARY) -lpari
+ else
+-    LDFLAGS = $(LDFLAGS2)
++    MYLDFLAGS = $(LDFLAGS2)
+ endif
+ 
+ 
+@@ -129,7 +129,8 @@ endif
+ #become clear which libraries the computer can find.
+ 
+ 
+-INSTALL_DIR= /usr/local
++INSTALL_DIR= $(DESTDIR)
++LIB_DIR ?=lib
+ 
+ #object files for the libLfunction library
+ OBJ_L = Lglobals.o Lgamma.o Lriemannsiegel.o Lriemannsiegel_blfi.o Ldokchitser.o
+@@ -141,9 +142,8 @@ OBJECTS = $(OBJ3)
+ 
+ all:
+ #	make print_vars
+-	make libLfunction.so
+-	make lcalc
+-	make examples
++	${MAKE} libLfunction.so
++	${MAKE} lcalc
+ #	make find_L
+ #	make test
+ 
+@@ -151,7 +151,7 @@ print_vars:
+ 	@echo OS_NAME = $(OS_NAME)
+ 
+ lcalc: $(OBJECTS)
+-	$(CC) $(CCFLAGS) $(INCLUDEFILES) $(OBJECTS) $(LDFLAGS) -o lcalc $(GMP_FLAGS)
++	$(CC) $(CCFLAGS) $(INCLUDEFILES) $(OBJECTS) $(MYLDFLAGS) -o lcalc $(GMP_FLAGS)
+ 
+ examples:
+ 	$(CC) $(CCFLAGS) $(INCLUDEFILES) example_programs/example.cc libLfunction.so -o example_programs/example $(GMP_FLAGS)
+@@ -262,15 +262,18 @@ Lcommandline.o: ../include/Lcommandline_values_zeros.h
+ 
+ 
+ libLfunction.so: $(OBJ_L)
+-	g++ -$(DYN_OPTION)  -o libLfunction.so $(OBJ_L)
++	g++ $(DYN_OPTION) -o libLfunction.so $(OBJ_L)
+ 
+ clean:
+ 	rm -f *.o lcalc libLfunction.so example_programs/example
+ 
+ install:
+-	cp -f lcalc $(INSTALL_DIR)/bin/.
+-	cp -f libLfunction.so $(INSTALL_DIR)/lib/.
+-	cp -rf ../include $(INSTALL_DIR)/include/Lfunction
++	install -d $(INSTALL_DIR)/bin
++	install -d $(INSTALL_DIR)/$(LIB_DIR)
++	install -d $(INSTALL_DIR)/include/libLfunction
++	install lcalc $(INSTALL_DIR)/bin
++	install libLfunction.so $(INSTALL_DIR)/$(LIB_DIR)
++	install -m 644 -t $(INSTALL_DIR)/include/libLfunction ../include/*.h
+ 
+ 
+ SRCS = Lcommandline.cc Lcommandline_elliptic.cc Lcommandline_globals.cc Lcommandline_misc.cc Lcommandline_numbertheory.cc Lcommandline_twist.cc Lcommandline_values_zeros.cc Lgamma.cc Lglobals.cc Lmisc.cc Lriemannsiegel.cc Lriemannsiegel_blfi.cc cmdline.c
diff --git a/nixpkgs/pkgs/development/libraries/science/math/libbraiding/default.nix b/nixpkgs/pkgs/development/libraries/science/math/libbraiding/default.nix
new file mode 100644
index 000000000000..be650f3c3ce8
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/science/math/libbraiding/default.nix
@@ -0,0 +1,34 @@
+{ stdenv
+, fetchFromGitHub
+, autoreconfHook
+}:
+
+stdenv.mkDerivation rec {
+  version = "1.0";
+  name = "libbraiding-${version}";
+
+  src = fetchFromGitHub {
+    owner = "miguelmarco";
+    repo = "libbraiding";
+    rev = version;
+    sha256 = "0l68rikfr7k2l547gb3pp3g8cj5zzxwipm79xrb5r8ffj466ydxg";
+  };
+
+  nativeBuildInputs = [
+    autoreconfHook
+  ];
+
+  # no tests included for now (2018-08-05), but can't hurt to activate
+  doCheck = true;
+
+  meta = with stdenv.lib; {
+    homepage = https://github.com/miguelmarco/libbraiding/;
+    description = "C++ library for computations on braid groups";
+    longDescription = ''
+      A library to compute several properties of braids, including centralizer and conjugacy check.
+    '';
+    license = licenses.gpl3;
+    maintainers = with maintainers; [ timokau ];
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/science/math/libhomfly/default.nix b/nixpkgs/pkgs/development/libraries/science/math/libhomfly/default.nix
new file mode 100644
index 000000000000..e96ee475d7d2
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/science/math/libhomfly/default.nix
@@ -0,0 +1,35 @@
+{ stdenv
+, fetchFromGitHub
+, autoreconfHook
+, boehmgc
+}:
+
+stdenv.mkDerivation rec {
+  version = "1.02r5";
+  name = "llibhomfly-${version}";
+
+  src = fetchFromGitHub {
+    owner = "miguelmarco";
+    repo = "libhomfly";
+    rev = version;
+    sha256 = "1szv8iwlhvmy3saigi15xz8vgch92p2lbsm6440v5s8vxj455bvd";
+  };
+
+  buildInputs = [
+    boehmgc
+  ];
+
+  nativeBuildInputs = [
+    autoreconfHook
+  ];
+
+  doCheck = true;
+
+  meta = with stdenv.lib; {
+    homepage = https://github.com/miguelmarco/libhomfly/;
+    description = "Library to compute the homfly polynomial of knots and links";
+    license = licenses.unlicense;
+    maintainers = with maintainers; [ timokau ];
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/science/math/liblapack/default.nix b/nixpkgs/pkgs/development/libraries/science/math/liblapack/default.nix
new file mode 100644
index 000000000000..c26e9c575ab2
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/science/math/liblapack/default.nix
@@ -0,0 +1,42 @@
+{
+  stdenv,
+  fetchurl,
+  gfortran,
+  cmake,
+  python2,
+  shared ? false
+}:
+let
+  usedLibExtension = if shared then ".so" else ".a";
+  inherit (stdenv.lib) optional optionals;
+  version = "3.8.0";
+in
+
+stdenv.mkDerivation rec {
+  name = "liblapack-${version}";
+  src = fetchurl {
+    url = "http://www.netlib.org/lapack/lapack-${version}.tar.gz";
+    sha256 = "1xmwi2mqmipvg950gb0rhgprcps8gy8sjm8ic9rgy2qjlv22rcny";
+  };
+
+  buildInputs = [ gfortran cmake ];
+  nativeBuildInputs = [ python2 ];
+
+  cmakeFlags = [
+    "-DUSE_OPTIMIZED_BLAS=ON"
+    "-DCMAKE_Fortran_FLAGS=-fPIC"
+  ]
+  ++ (optional shared "-DBUILD_SHARED_LIBS=ON");
+
+  doCheck = ! shared;
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    inherit version;
+    description = "Linear Algebra PACKage";
+    homepage = http://www.netlib.org/lapack/;
+    license = licenses.bsd3;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/science/math/liblbfgs/default.nix b/nixpkgs/pkgs/development/libraries/science/math/liblbfgs/default.nix
new file mode 100644
index 000000000000..33e8baada834
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/science/math/liblbfgs/default.nix
@@ -0,0 +1,17 @@
+{ stdenv, fetchurl }:
+stdenv.mkDerivation {
+  name = "liblbfgs-1.10";
+
+  configureFlags = [ "--enable-sse2" ];
+  src = fetchurl {
+    url = https://github.com/downloads/chokkan/liblbfgs/liblbfgs-1.10.tar.gz;
+    sha256 = "1kv8d289rbz38wrpswx5dkhr2yh4fg4h6sszkp3fawxm09sann21";
+  };
+
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/science/math/lrs/default.nix b/nixpkgs/pkgs/development/libraries/science/math/lrs/default.nix
new file mode 100644
index 000000000000..3cf5c3619a9e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/science/math/lrs/default.nix
@@ -0,0 +1,27 @@
+{stdenv, fetchurl, gmp}:
+
+stdenv.mkDerivation rec {
+  name = "${pname}-${version}";
+  pname = "lrs";
+  version = "7.0";
+
+  src = fetchurl {
+    url = "http://cgm.cs.mcgill.ca/~avis/C/lrslib/archive/lrslib-070.tar.gz";
+    sha256 = "1zjdmkjracz695k73c2pvipc0skpyn1wzagkhilsvcw9pqljpwg9";
+  };
+
+  buildInputs = [ gmp ];
+
+  preBuild = ''
+    export makeFlags="$makeFlags prefix=$out";
+  '';
+
+  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;
+    homepage = "http://cgm.cs.mcgill.ca/~avis/C/lrs.html";
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/science/math/m4ri/default.nix b/nixpkgs/pkgs/development/libraries/science/math/m4ri/default.nix
new file mode 100644
index 000000000000..b9ee1e2a10d7
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/science/math/m4ri/default.nix
@@ -0,0 +1,30 @@
+{ stdenv
+, fetchFromBitbucket
+, autoreconfHook
+}:
+
+stdenv.mkDerivation rec {
+  version = "20140914";
+  name = "m4ri-${version}";
+
+  src = fetchFromBitbucket {
+    owner = "malb";
+    repo = "m4ri";
+    rev = "release-${version}";
+    sha256 = "0xfg6pffbn8r1s0y7bn9b8i55l00d41dkmhrpf7pwk53qa3achd3";
+  };
+
+  doCheck = true;
+
+  nativeBuildInputs = [
+    autoreconfHook
+  ];
+
+  meta = with stdenv.lib; {
+    homepage = https://malb.bitbucket.io/m4ri/;
+    description = "Library to do fast arithmetic with dense matrices over F_2";
+    license = licenses.gpl2Plus;
+    maintainers = with maintainers; [ timokau ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/science/math/m4rie/default.nix b/nixpkgs/pkgs/development/libraries/science/math/m4rie/default.nix
new file mode 100644
index 000000000000..23fc03655cf3
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/science/math/m4rie/default.nix
@@ -0,0 +1,39 @@
+{ stdenv
+, fetchFromBitbucket
+, autoreconfHook
+, m4ri
+}:
+
+stdenv.mkDerivation rec {
+  version = "20150908";
+  name = "m4rie-${version}";
+
+  src = fetchFromBitbucket {
+    owner = "malb";
+    repo = "m4rie";
+    rev = "release-${version}";
+    sha256 = "0r8lv46qx5mkz5kp3ay2jnsp0mbhlqr5z2z220wdk73wdshcznss";
+  };
+
+  doCheck = true;
+
+  buildInputs = [
+    m4ri
+  ];
+
+  nativeBuildInputs = [
+    autoreconfHook
+  ];
+
+  meta = with stdenv.lib; {
+    homepage = https://malb.bitbucket.io/m4rie/;
+    description = "Library for matrix multiplication, reduction and inversion over GF(2^k) for 2 <= k <= 10";
+    longDescription = ''
+      M4RIE is a library for fast arithmetic with dense matrices over small finite fields of even characteristic.
+      It uses the M4RI library, implementing the same operations over the finite field F2.
+    '';
+    license = licenses.gpl2Plus;
+    maintainers = with maintainers; [ timokau ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/science/math/magma/default.nix b/nixpkgs/pkgs/development/libraries/science/math/magma/default.nix
new file mode 100644
index 000000000000..8444d88809af
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/science/math/magma/default.nix
@@ -0,0 +1,46 @@
+{ stdenv, fetchurl, cmake, gfortran, cudatoolkit, libpthreadstubs, liblapack }:
+
+with stdenv.lib;
+
+let version = "2.0.2";
+
+in stdenv.mkDerivation {
+  name = "magma-${version}";
+  src = fetchurl {
+    url = "https://icl.cs.utk.edu/projectsfiles/magma/downloads/magma-${version}.tar.gz";
+    sha256 = "0w3z6k1npfh0d3r8kpw873f1m7lny29sz2bvvfxzk596d4h083lk";
+    name = "magma-${version}.tar.gz";
+  };
+
+  buildInputs = [ gfortran cudatoolkit libpthreadstubs liblapack cmake ];
+
+  doCheck = false;
+  #checkTarget = "tests";
+
+  enableParallelBuilding=true;
+
+  # MAGMA's default CMake setup does not care about installation. So we copy files directly.
+  installPhase = ''
+    mkdir -p $out
+    mkdir -p $out/include
+    mkdir -p $out/lib
+    mkdir -p $out/lib/pkgconfig
+    cp -a ../include/*.h $out/include
+    #cp -a sparse-iter/include/*.h $out/include
+    cp -a lib/*.a $out/lib
+    cat ../lib/pkgconfig/magma.pc.in                   | \
+    sed -e s:@INSTALL_PREFIX@:"$out":          | \
+    sed -e s:@CFLAGS@:"-I$out/include":    | \
+    sed -e s:@LIBS@:"-L$out/lib -lmagma -lmagma_sparse": | \
+    sed -e s:@MAGMA_REQUIRED@::                       \
+        > $out/lib/pkgconfig/magma.pc
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Matrix Algebra on GPU and Multicore Architectures";
+    license = licenses.bsd3;
+    homepage = http://icl.cs.utk.edu/magma/index.html;
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ ianwookim ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/science/math/metis/default.nix b/nixpkgs/pkgs/development/libraries/science/math/metis/default.nix
new file mode 100644
index 000000000000..3ce94f28ac2a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/science/math/metis/default.nix
@@ -0,0 +1,20 @@
+{ stdenv, fetchurl, unzip, cmake }:
+
+stdenv.mkDerivation {
+  name = "metis-5.1.0";
+
+  src = fetchurl {
+    url = "http://glaros.dtc.umn.edu/gkhome/fetch/sw/metis/metis-5.1.0.tar.gz";
+    sha256 = "1cjxgh41r8k6j029yxs8msp3z6lcnpm16g5pvckk35kc7zhfpykn";
+  };
+
+  cmakeFlags = [ "-DGKLIB_PATH=../GKlib" ];
+  buildInputs = [ unzip cmake ];
+
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/science/math/mkl/default.nix b/nixpkgs/pkgs/development/libraries/science/math/mkl/default.nix
new file mode 100644
index 000000000000..350cfb1f7a24
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/science/math/mkl/default.nix
@@ -0,0 +1,96 @@
+{ stdenvNoCC, writeText, fetchurl, rpmextract, undmg, darwin }:
+/*
+  For details on using mkl as a blas provider for python packages such as numpy,
+  numexpr, scipy, etc., see the Python section of the NixPkgs manual.
+*/
+stdenvNoCC.mkDerivation (rec {
+  name = "mkl-${version}";
+  version = "${date}.${rel}";
+  date = "2019.3";
+  rel = "199";
+
+  src = if stdenvNoCC.isDarwin
+    then
+      (fetchurl {
+        url = "http://registrationcenter-download.intel.com/akdlm/irc_nas/tec/15235/m_mkl_${version}.dmg";
+        sha256 = "14b3ciz7995sqcd6jz7hc8g2x4zwvqxmgxgni46vrlb7n523l62f";
+      })
+    else
+      (fetchurl {
+        url = "http://registrationcenter-download.intel.com/akdlm/irc_nas/tec/15275/l_mkl_${version}.tgz";
+        sha256 = "13rb2v2872jmvzcqm4fqsvhry0j2r5cn4lqql4wpqbl1yia2pph6";
+      });
+
+  nativeBuildInputs = if stdenvNoCC.isDarwin
+    then
+      [ undmg
+        darwin.cctools
+      ]
+    else
+      [ rpmextract ];
+
+  buildPhase = if stdenvNoCC.isDarwin then ''
+      for f in Contents/Resources/pkg/*.tgz; do
+          tar xzvf $f
+      done
+  '' else ''
+    rpmextract rpm/intel-mkl-common-c-${date}-${rel}-${date}-${rel}.noarch.rpm
+    rpmextract rpm/intel-mkl-core-rt-${date}-${rel}-${date}-${rel}.x86_64.rpm
+    rpmextract rpm/intel-openmp-19.0.3-${rel}-19.0.3-${rel}.x86_64.rpm
+  '';
+
+  installPhase = if stdenvNoCC.isDarwin then ''
+      mkdir -p $out/lib
+
+      cp -r compilers_and_libraries_${version}/mac/mkl/include $out/
+
+      cp -r compilers_and_libraries_${version}/licensing/mkl/en/license.txt $out/lib/
+      cp -r compilers_and_libraries_${version}/mac/compiler/lib/* $out/lib/
+      cp -r compilers_and_libraries_${version}/mac/mkl/lib/* $out/lib/
+      cp -r compilers_and_libraries_${version}/mac/tbb/lib/* $out/lib/
+  '' else ''
+      mkdir -p $out/lib
+
+      cp -r opt/intel/compilers_and_libraries_${version}/linux/mkl/include $out/
+
+      cp -r opt/intel/compilers_and_libraries_${version}/linux/compiler/lib/intel64_lin/* $out/lib/
+      cp -r opt/intel/compilers_and_libraries_${version}/linux/mkl/lib/intel64_lin/* $out/lib/
+      cp license.txt $out/lib/
+  '';
+
+  # fixDarwinDylibName fails for libmkl_cdft_core.dylib because the
+  # larger updated load commands do not fit. Use install_name_tool
+  # explicitly and ignore the error.
+  postFixup = stdenvNoCC.lib.optionalString stdenvNoCC.isDarwin ''
+      for f in $out/lib/*.dylib; do
+          install_name_tool -id $out/lib/$(basename $f) $f || true
+      done
+      install_name_tool -change @rpath/libiomp5.dylib $out/lib/libiomp5.dylib $out/lib/libmkl_intel_thread.dylib
+      install_name_tool -change @rpath/libtbb.dylib $out/lib/libtbb.dylib $out/lib/libmkl_tbb_thread.dylib
+      install_name_tool -change @rpath/libtbbmalloc.dylib $out/lib/libtbbmalloc.dylib $out/lib/libtbbmalloc_proxy.dylib
+  '';
+
+  # Per license agreement, do not modify the binary
+  dontStrip = true;
+  dontPatchELF = true;
+
+  meta = with stdenvNoCC.lib; {
+    description = "Intel Math Kernel Library";
+    longDescription = ''
+      Intel Math Kernel Library (Intel MKL) optimizes code with minimal effort
+      for future generations of Intel processors. It is compatible with your
+      choice of compilers, languages, operating systems, and linking and
+      threading models.
+    '';
+    homepage = https://software.intel.com/en-us/mkl;
+    license = licenses.issl;
+    platforms = [ "x86_64-linux" "x86_64-darwin" ];
+    maintainers = [ maintainers.bhipple ];
+  };
+ } // stdenvNoCC.lib.optionalAttrs stdenvNoCC.isLinux {
+  # Since on Linux binaries are unmodified, we can make them
+  # fixed-output derivations.
+	outputHashAlgo = "sha256";
+	outputHashMode = "recursive";
+	outputHash = "101krzh2mjbfx8kvxim2zphdvgg7iijhbf9xdz3ad3ncgybxbdvw";
+ })
diff --git a/nixpkgs/pkgs/development/libraries/science/math/nccl/default.nix b/nixpkgs/pkgs/development/libraries/science/math/nccl/default.nix
new file mode 100644
index 000000000000..a099b779a781
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/science/math/nccl/default.nix
@@ -0,0 +1,48 @@
+{ stdenv, fetchFromGitHub, which, cudatoolkit, addOpenGLRunpath }:
+
+stdenv.mkDerivation rec {
+  name = "nccl-${version}-cuda-${cudatoolkit.majorVersion}";
+  version = "2.4.2-1";
+
+  src = fetchFromGitHub {
+    owner = "NVIDIA";
+    repo = "nccl";
+    rev = "v${version}";
+    sha256 = "0aa4gv51nbmmdhx6vp40l249m4arp30sijrn6kwxdfi1k9kajiq5";
+  };
+
+  outputs = [ "out" "dev" ];
+
+  nativeBuildInputs = [ which addOpenGLRunpath ];
+
+  buildInputs = [ cudatoolkit ];
+
+  preConfigure = ''
+    patchShebangs src/collectives/device/gen_rules.sh
+  '';
+
+  makeFlags = [
+    "CUDA_HOME=${cudatoolkit}"
+    "PREFIX=$(out)"
+  ];
+
+  postFixup = ''
+    moveToOutput lib/libnccl_static.a $dev
+
+    # Set RUNPATH so that libnvidia-ml in /run/opengl-driver(-32)/lib can be found.
+    # See the explanation in addOpenGLRunpath.
+    addOpenGLRunpath $out/lib/lib*.so
+  '';
+
+  NIX_CFLAGS_COMPILE = [ "-Wno-unused-function" ];
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    description = "Multi-GPU and multi-node collective communication primitives for NVIDIA GPUs";
+    homepage = https://developer.nvidia.com/nccl;
+    license = licenses.bsd3;
+    platforms = [ "x86_64-linux" ];
+    maintainers = with maintainers; [ mdaiter orivej ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/science/math/openblas/default.nix b/nixpkgs/pkgs/development/libraries/science/math/openblas/default.nix
new file mode 100644
index 000000000000..8ec00f7e2b8b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/science/math/openblas/default.nix
@@ -0,0 +1,170 @@
+{ stdenv, fetchFromGitHub, fetchpatch, gfortran, perl, which, config
+# 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).
+, blas64 ? null
+, buildPackages
+# Select a specific optimization target (other than the default)
+# See https://github.com/xianyi/OpenBLAS/blob/develop/TargetList.txt
+, target ? null
+, enableStatic ? false
+}:
+
+with stdenv.lib;
+
+let blas64_ = blas64; in
+
+let
+  setTarget = x: if target == null then x else target;
+
+  # To add support for a new platform, add an element to this set.
+  configs = {
+    armv6l-linux = {
+      BINARY = 32;
+      TARGET = setTarget "ARMV6";
+      DYNAMIC_ARCH = false;
+      USE_OPENMP = true;
+    };
+
+    armv7l-linux = {
+      BINARY = 32;
+      TARGET = setTarget "ARMV7";
+      DYNAMIC_ARCH = false;
+      USE_OPENMP = true;
+    };
+
+    aarch64-linux = {
+      BINARY = 64;
+      TARGET = setTarget "ARMV8";
+      DYNAMIC_ARCH = true;
+      USE_OPENMP = true;
+    };
+
+    i686-linux = {
+      BINARY = 32;
+      TARGET = setTarget "P2";
+      DYNAMIC_ARCH = true;
+      USE_OPENMP = true;
+    };
+
+    x86_64-darwin = {
+      BINARY = 64;
+      TARGET = setTarget "ATHLON";
+      DYNAMIC_ARCH = true;
+      USE_OPENMP = false;
+      MACOSX_DEPLOYMENT_TARGET = "10.7";
+    };
+
+    x86_64-linux = {
+      BINARY = 64;
+      TARGET = setTarget "ATHLON";
+      DYNAMIC_ARCH = true;
+      NO_AVX512 = true;
+      USE_OPENMP = true;
+    };
+  };
+in
+
+let
+  config =
+    configs.${stdenv.hostPlatform.system}
+    or (throw "unsupported system: ${stdenv.hostPlatform.system}");
+in
+
+let
+  blas64 =
+    if blas64_ != null
+      then blas64_
+      else hasPrefix "x86_64" stdenv.hostPlatform.system;
+  # Convert flag values to format OpenBLAS's build expects.
+  # `toString` is almost what we need other than bools,
+  # which we need to map {true -> 1, false -> 0}
+  # (`toString` produces empty string `""` for false instead of `0`)
+  mkMakeFlagValue = val:
+    if !builtins.isBool val then toString val
+    else if val then "1" else "0";
+  mkMakeFlagsFromConfig = mapAttrsToList (var: val: "${var}=${mkMakeFlagValue val}");
+in
+stdenv.mkDerivation rec {
+  name = "openblas-${version}";
+  version = "0.3.6";
+  src = fetchFromGitHub {
+    owner = "xianyi";
+    repo = "OpenBLAS";
+    rev = "v${version}";
+    sha256 = "12vg0g3s4m49fr8z04j15yrgscqnaaflnkckjbffqxnrf90fcav1";
+  };
+
+  inherit blas64;
+
+  # Some hardening features are disabled due to sporadic failures in
+  # OpenBLAS-based programs. The problem may not be with OpenBLAS itself, but
+  # with how these flags interact with hardening measures used downstream.
+  # In either case, OpenBLAS must only be used by trusted code--it is
+  # inherently unsuitable for security-conscious applications--so there should
+  # be no objection to disabling these hardening measures.
+  hardeningDisable = [
+    # don't modify or move the stack
+    "stackprotector" "pic"
+    # don't alter index arithmetic
+    "strictoverflow"
+    # don't interfere with dynamic target detection
+    "relro" "bindnow"
+  ];
+
+  nativeBuildInputs = [
+    perl
+    which
+    buildPackages.gfortran
+    buildPackages.stdenv.cc
+  ];
+
+  makeFlags = mkMakeFlagsFromConfig (config // {
+    FC = "${stdenv.cc.targetPrefix}gfortran";
+    CC = "${stdenv.cc.targetPrefix}${if stdenv.cc.isClang then "clang" else "cc"}";
+    PREFIX = placeholder "out";
+    NUM_THREADS = 64;
+    INTERFACE64 = blas64;
+    NO_STATIC = !enableStatic;
+    CROSS = stdenv.hostPlatform != stdenv.buildPlatform;
+    HOSTCC = "cc";
+    # Makefile.system only checks defined status
+    # This seems to be a bug in the openblas Makefile:
+    # on x86_64 it expects NO_BINARY_MODE=
+    # but on aarch64 it expects NO_BINARY_MODE=0
+    NO_BINARY_MODE = if stdenv.isx86_64
+        then toString (stdenv.hostPlatform != stdenv.buildPlatform)
+        else stdenv.hostPlatform != stdenv.buildPlatform;
+  });
+
+  doCheck = true;
+  checkTarget = "tests";
+
+  postInstall = ''
+    # Write pkgconfig aliases. Upstream report:
+    # https://github.com/xianyi/OpenBLAS/issues/1740
+    for alias in blas cblas lapack; do
+      cat <<EOF > $out/lib/pkgconfig/$alias.pc
+Name: $alias
+Version: ${version}
+Description: $alias provided by the OpenBLAS package.
+Cflags: -I$out/include
+Libs: -L$out/lib -lopenblas
+EOF
+    done
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Basic Linear Algebra Subprograms";
+    license = licenses.bsd3;
+    homepage = https://github.com/xianyi/OpenBLAS;
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ ttuegel ];
+  };
+
+  # We use linkName to pass a different name to --with-blas-libs for
+  # fflas-ffpack and linbox, because we use blas on darwin but openblas
+  # elsewhere.
+  # See see https://github.com/NixOS/nixpkgs/pull/45013.
+  passthru.linkName = "openblas";
+}
diff --git a/nixpkgs/pkgs/development/libraries/science/math/openlibm/default.nix b/nixpkgs/pkgs/development/libraries/science/math/openlibm/default.nix
new file mode 100644
index 000000000000..01b0faf89f90
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/science/math/openlibm/default.nix
@@ -0,0 +1,20 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "openlibm-${version}";
+  version = "0.6.0";
+  src = fetchurl {
+    url = "https://github.com/JuliaLang/openlibm/archive/v${version}.tar.gz";
+    sha256 = "0a5fpm8nra5ldhjk0cqd2rx1qh32wiarkxmcqcm5xl8z7l4kjm6l";
+  };
+
+  makeFlags = [ "prefix=$(out)" ];
+
+  meta = {
+    description = "High quality system independent, portable, open source libm implementation";
+    homepage = https://www.openlibm.org/;
+    license = stdenv.lib.licenses.mit;
+    maintainers = [ stdenv.lib.maintainers.ttuegel ];
+    platforms = stdenv.lib.platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/science/math/openspecfun/default.nix b/nixpkgs/pkgs/development/libraries/science/math/openspecfun/default.nix
new file mode 100644
index 000000000000..3a4c5a784385
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/science/math/openspecfun/default.nix
@@ -0,0 +1,21 @@
+{ stdenv, fetchurl, gfortran }:
+
+stdenv.mkDerivation {
+  name = "openspecfun-0.5.3";
+  src = fetchurl {
+    url = "https://github.com/JuliaLang/openspecfun/archive/v0.5.3.tar.gz";
+    sha256 = "1rs1bv8jq751fv9vq79890wqf9xlbjc7lvz3ighzyfczbyjcf18m";
+  };
+
+  makeFlags = [ "prefix=$(out)" ];
+
+  nativeBuildInputs = [ gfortran ];
+
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/science/math/or-tools/default.nix b/nixpkgs/pkgs/development/libraries/science/math/or-tools/default.nix
new file mode 100644
index 000000000000..ba6827bf6947
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/science/math/or-tools/default.nix
@@ -0,0 +1,70 @@
+{ stdenv, fetchFromGitHub, cmake, abseil-cpp, google-gflags, which
+, lsb-release, glog, protobuf, cbc, zlib
+, ensureNewerSourcesForZipFilesHook, python, swig
+, pythonProtobuf }:
+
+stdenv.mkDerivation rec {
+  name = "or-tools-${version}";
+  version = "v7.0";
+
+  src = fetchFromGitHub {
+    owner = "google";
+    repo = "or-tools";
+    rev = version;
+    sha256 = "09rs2j3w4ljw9qhhnsjlvfii297njjszwvkbgj1i6kns3wnlr7cp";
+  };
+
+  # The original build system uses cmake which does things like pull
+  # in dependencies through git and Makefile creation time. We
+  # obviously don't want to do this so instead we provide the
+  # dependencies straight from nixpkgs and use the make build method.
+  configurePhase = ''
+    cat <<EOF > Makefile.local
+    UNIX_ABSL_DIR=${abseil-cpp}
+    UNIX_GFLAGS_DIR=${google-gflags}
+    UNIX_GLOG_DIR=${glog}
+    UNIX_PROTOBUF_DIR=${protobuf}
+    UNIX_CBC_DIR=${cbc}
+    EOF
+  '';
+
+  makeFlags = [
+    "prefix=${placeholder "out"}"
+    "PROTOBUF_PYTHON_DESC=${pythonProtobuf}/${python.sitePackages}/google/protobuf/descriptor_pb2.py"
+  ];
+  buildFlags = [ "cc" "pypi_archive" ];
+
+  checkTarget = "test_cc";
+  doCheck = true;
+
+  installTargets = [ "install_cc" ];
+  # The upstream install_python target installs to $HOME.
+  postInstall = ''
+    mkdir -p "$python/${python.sitePackages}"
+    (cd temp_python/ortools; PYTHONPATH="$python/${python.sitePackages}:$PYTHONPATH" python setup.py install '--prefix=$python')
+  '';
+
+  nativeBuildInputs = [
+    cmake lsb-release swig which zlib python
+    ensureNewerSourcesForZipFilesHook
+    python.pkgs.setuptools python.pkgs.wheel
+  ];
+  propagatedBuildInputs = [
+    abseil-cpp google-gflags glog protobuf cbc
+    pythonProtobuf python.pkgs.six
+  ];
+
+  enableParallelBuilding = true;
+
+  outputs = [ "out" "python" ];
+
+  meta = with stdenv.lib; {
+    homepage = https://github.com/google/or-tools;
+    license = licenses.asl20;
+    description = ''
+      Google's software suite for combinatorial optimization.
+    '';
+    maintainers = with maintainers; [ fuuzetsu ];
+    platforms = with platforms; linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/science/math/parmetis/default.nix b/nixpkgs/pkgs/development/libraries/science/math/parmetis/default.nix
new file mode 100644
index 000000000000..ca35ce2f4134
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/science/math/parmetis/default.nix
@@ -0,0 +1,33 @@
+{ stdenv
+, fetchurl
+, cmake
+, mpi
+}:
+
+stdenv.mkDerivation rec {
+  name = "parmetis-${version}";
+  version = "4.0.3";
+
+  src = fetchurl {
+    url = "http://glaros.dtc.umn.edu/gkhome/fetch/sw/parmetis/parmetis-${version}.tar.gz";
+    sha256 = "0pvfpvb36djvqlcc3lq7si0c5xpb2cqndjg8wvzg35ygnwqs5ngj";
+  };
+
+  buildInputs = [ cmake mpi ];
+
+  # metis and GKlib are packaged with distribution
+  # AUR https://aur.archlinux.org/packages/parmetis/ has reported that
+  # it easier to build with the included packages as opposed to using the metis
+  # package. Compilation time is short.
+  configurePhase = ''
+    make config metis_path=$PWD/metis gklib_path=$PWD/metis/GKlib prefix=$out
+  '';
+
+  meta = with stdenv.lib; {
+    description = "ParMETIS is 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;
+    license = licenses.unfree;
+    maintainers = [ maintainers.costrouc ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/science/math/petsc/default.nix b/nixpkgs/pkgs/development/libraries/science/math/petsc/default.nix
new file mode 100644
index 000000000000..ac8129c9032f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/science/math/petsc/default.nix
@@ -0,0 +1,50 @@
+{ stdenv
+, fetchurl
+, blas
+, gfortran
+, liblapack
+, python }:
+
+stdenv.mkDerivation rec {
+  name = "petsc-${version}";
+  version = "3.8.4";
+
+  src = fetchurl {
+    url = "http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc-${version}.tar.gz";
+    sha256 = "1iy49gagxncx09d88kxnwkj876p35683mpfk33x37165si6xqy4z";
+  };
+
+  nativeBuildInputs = [ blas gfortran.cc.lib liblapack python ];
+
+  prePatch = stdenv.lib.optionalString stdenv.isDarwin ''
+    substituteInPlace config/install.py \
+      --replace /usr/bin/install_name_tool install_name_tool
+  '';
+
+  preConfigure = ''
+    patchShebangs .
+    configureFlagsArray=(
+      $configureFlagsArray
+      "--CC=$CC"
+      "--with-cxx=0"
+      "--with-fc=0"
+      "--with-mpi=0"
+      "--with-blas-lib=[${blas}/lib/libblas.a,${gfortran.cc.lib}/lib/libgfortran.a]"
+      "--with-lapack-lib=[${liblapack}/lib/liblapack.a,${gfortran.cc.lib}/lib/libgfortran.a]"
+    )
+  '';
+
+  postInstall = ''
+    rm $out/bin/petscmpiexec
+    rm $out/bin/popup
+    rm $out/bin/uncrustify.cfg
+    rm -rf $out/bin/win32fe
+  '';
+
+  meta = {
+    description = "Library of linear algebra algorithms for solving partial differential equations";
+    homepage = https://www.mcs.anl.gov/petsc/index.html;
+    platforms = stdenv.lib.platforms.all;
+    license = stdenv.lib.licenses.bsd2;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/science/math/planarity/default.nix b/nixpkgs/pkgs/development/libraries/science/math/planarity/default.nix
new file mode 100644
index 000000000000..7394fb9e1b41
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/science/math/planarity/default.nix
@@ -0,0 +1,40 @@
+{ stdenv
+, fetchFromGitHub
+, fetchpatch
+, autoreconfHook
+}:
+
+stdenv.mkDerivation rec {
+  pname = "planarity";
+  version = "3.0.0.5";
+  name = "${pname}-${version}";
+
+  src = fetchFromGitHub {
+    owner = "graph-algorithms";
+    repo = "edge-addition-planarity-suite";
+    rev = "Version_${version}";
+    sha256 = "01cm7ay1njkfsdnmnvh5zwc7wg7x189hq1vbfhh9p3ihrbnmqzh8";
+  };
+
+  nativeBuildInputs = [
+    autoreconfHook
+  ];
+
+  doCheck = true;
+
+  patches = [
+    # declare variables declared in headers as extern, not yet merged upstream
+    (fetchpatch {
+      url = "https://github.com/graph-algorithms/edge-addition-planarity-suite/pull/3.patch";
+      sha256 = "1nqjc4clr326imz4jxqxcxv2hgh1sjgzll27k5cwkdin8lnmmil8";
+    })
+  ];
+
+  meta = with stdenv.lib; {
+    homepage = https://github.com/graph-algorithms/edge-addition-planarity-suite;
+    description = "A library for implementing graph algorithms";
+    license = licenses.bsd3;
+    maintainers = with maintainers; [ timokau ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/science/math/primesieve/default.nix b/nixpkgs/pkgs/development/libraries/science/math/primesieve/default.nix
new file mode 100644
index 000000000000..3eee63dbf4f6
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/science/math/primesieve/default.nix
@@ -0,0 +1,21 @@
+{ stdenv, fetchurl, cmake }:
+
+stdenv.mkDerivation rec {
+  name = "primesieve-${version}";
+  version = "7.4";
+
+  nativeBuildInputs = [cmake];
+
+  src = fetchurl {
+    url = "https://github.com/kimwalisch/primesieve/archive/v${version}.tar.gz";
+    sha256 = "16930d021ai8cl3gsnn2v6l30n6mklwwqd53z51cddd3dj69x6zz";
+  };
+
+  meta = with stdenv.lib; {
+    description = "Fast C/C++ prime number generator";
+    homepage = "https://primesieve.org/";
+    license = licenses.bsd2;
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ abbradar ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/science/math/rankwidth/default.nix b/nixpkgs/pkgs/development/libraries/science/math/rankwidth/default.nix
new file mode 100644
index 000000000000..fda54fe44ab1
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/science/math/rankwidth/default.nix
@@ -0,0 +1,28 @@
+{ stdenv
+, fetchurl
+}:
+
+stdenv.mkDerivation rec {
+  pname = "rankwidth";
+  version = "0.7";
+  name = "${pname}-${version}";
+
+  src = fetchurl {
+    url = "mirror://sageupstream/rw/rw-${version}.tar.gz";
+    sha256 = "1rv2v42x2506x7f10349m1wpmmfxrv9l032bkminni2gbip9cjg0";
+  };
+
+  configureFlags = [
+    "--enable-executable=no" # no igraph dependency
+  ];
+
+  # check phase is empty for now (as of version 0.7)
+  doCheck = true;
+
+  meta = with stdenv.lib; {
+    description = "Calculates rank-width and rank-decompositions";
+    license = with licenses; [ gpl2Plus ];
+    maintainers = with maintainers; [ timokau ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/science/math/rubiks/default.nix b/nixpkgs/pkgs/development/libraries/science/math/rubiks/default.nix
new file mode 100644
index 000000000000..624885c501aa
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/science/math/rubiks/default.nix
@@ -0,0 +1,82 @@
+{ stdenv
+, fetchurl
+, fetchpatch
+, coreutils
+}:
+
+stdenv.mkDerivation rec {
+  pname = "rubiks";
+  version = "20070912";
+  name = "${pname}-${version}";
+
+  src = fetchurl {
+    url = "mirror://sageupstream/rubiks/rubiks-${version}.tar.bz2";
+    sha256 = "0zdmkb0j1kyspdpsszzb2k3279xij79jkx0dxd9f3ix1yyyg3yfq";
+  };
+
+  preConfigure = ''
+    export INSTALL="${coreutils}/bin/install"
+  '';
+
+  # everything is done in `make install`
+  buildPhase = "true";
+
+  installFlags = [
+    "PREFIX=$(out)"
+  ];
+
+  patches = [
+    # Fix makefiles which use all the variables in all the wrong ways and
+    # hardcode values for some variables.
+    (fetchpatch {
+      url = "https://git.sagemath.org/sage.git/plain/build/pkgs/rubiks/patches/dietz-cu2-Makefile.patch?id=07d6c37d18811e2b377a9689790a7c5e24da16ba";
+      sha256 = "1ry3w1mk9q4jqd91zlaa1bdiiplld4hpfjaldbhlmzlgrrc99qmq";
+    })
+    (fetchpatch {
+      url = "https://git.sagemath.org/sage.git/plain/build/pkgs/rubiks/patches/dietz-mcube-Makefile.patch?id=07d6c37d18811e2b377a9689790a7c5e24da16ba";
+      sha256 = "0zsbh6k3kqdg82fv0kzghr1x7pafisv943gmssqscp107bhg77bz";
+    })
+    (fetchpatch {
+      url = "https://git.sagemath.org/sage.git/plain/build/pkgs/rubiks/patches/dietz-solver-Makefile.patch?id=07d6c37d18811e2b377a9689790a7c5e24da16ba";
+      sha256 = "0vhw70ylnmydgjhwx8jjlb2slccj4pfqn6vzirkyz1wp8apsmfhp";
+    })
+    (fetchpatch {
+      url = "https://git.sagemath.org/sage.git/plain/build/pkgs/rubiks/patches/reid-Makefile.patch?id=07d6c37d18811e2b377a9689790a7c5e24da16ba";
+      sha256 = "1r311sn012xs135s0d21qwsig2kld7rdcq19nm0zbnklviid57df";
+    })
+  ];
+
+  meta = with stdenv.lib; {
+    homepage = https://wiki.sagemath.org/spkg/rubiks;
+    description = "Several programs for working with Rubik's cubes";
+    # The individual websites are no longer available
+    longDescription = ''
+      There are several programs for working with Rubik's cubes, by three
+      different people. Look inside the directories under /src to see
+      specific info and licensing. In summary the three contributers are:
+
+
+      Michael Reid (GPL) http://www.math.ucf.edu/~reid/Rubik/optimal_solver.html
+          optimal - uses many pre-computed tables to find an optimal
+                    solution to the 3x3x3 Rubik's cube
+
+
+      Dik T. Winter (MIT License)
+          cube    - uses Kociemba's algorithm to iteratively find a short
+                    solution to the 3x3x3 Rubik's cube
+          size222 - solves a 2x2x2 Rubik's cube
+
+
+      Eric Dietz (GPL) http://www.wrongway.org/?rubiksource
+          cu2   - A fast, non-optimal 2x2x2 solver
+          cubex - A fast, non-optimal 3x3x3 solver
+          mcube - A fast, non-optimal 4x4x4 solver
+    '';
+    license = with licenses; [
+      gpl2 # Michael Reid's and Eric Dietz software
+      mit # Dik T. Winter's software
+    ];
+    maintainers = with maintainers; [ timokau ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/science/math/scalapack/default.nix b/nixpkgs/pkgs/development/libraries/science/math/scalapack/default.nix
new file mode 100644
index 000000000000..b4c6574d13a6
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/science/math/scalapack/default.nix
@@ -0,0 +1,55 @@
+{ stdenv, fetchurl, cmake, openssh
+, gfortran, mpi, openblasCompat
+} :
+
+
+stdenv.mkDerivation rec {
+  name = "scalapack-${version}";
+  version = "2.0.2";
+
+  src = fetchurl {
+    url = "http://www.netlib.org/scalapack/scalapack-${version}.tgz";
+    sha256 = "0p1r61ss1fq0bs8ynnx7xq4wwsdvs32ljvwjnx6yxr8gd6pawx0c";
+  };
+
+  # patch to rename outdated MPI functions
+  patches = [ ./openmpi4.patch ];
+
+  nativeBuildInputs = [ cmake openssh ];
+  buildInputs = [ mpi gfortran openblasCompat ];
+
+  enableParallelBuilding = true;
+
+  doCheck = true;
+
+  preConfigure = ''
+    cmakeFlagsArray+=(
+      -DBUILD_SHARED_LIBS=ON -DBUILD_STATIC_LIBS=OFF
+      -DLAPACK_LIBRARIES="-lopenblas"
+      -DBLAS_LIBRARIES="-lopenblas"
+      )
+  '';
+
+  # Increase individual test timeout from 1500s to 10000s because hydra's builds
+  # sometimes fail due to this
+  checkFlagsArray = [ "ARGS=--timeout 10000" ];
+
+  preCheck = ''
+    # make sure the test starts even if we have less than 4 cores
+    export OMPI_MCA_rmaps_base_oversubscribe=1
+
+    # Run single threaded
+    export OMP_NUM_THREADS=1
+
+    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:`pwd`/lib
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = http://www.netlib.org/scalapack/;
+    description = "Library of high-performance linear algebra routines for parallel distributed memory machines";
+    license = licenses.bsd3;
+    platforms = [ "x86_64-linux" ];
+    maintainers = with maintainers; [ costrouc markuskowa ];
+  };
+
+}
diff --git a/nixpkgs/pkgs/development/libraries/science/math/scalapack/openmpi4.patch b/nixpkgs/pkgs/development/libraries/science/math/scalapack/openmpi4.patch
new file mode 100644
index 000000000000..5d0afb58c027
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/science/math/scalapack/openmpi4.patch
@@ -0,0 +1,143 @@
+diff --git a/BLACS/SRC/blacs_get_.c b/BLACS/SRC/blacs_get_.c
+index e979767..d4b04cf 100644
+--- a/BLACS/SRC/blacs_get_.c
++++ b/BLACS/SRC/blacs_get_.c
+@@ -23,7 +23,7 @@ F_VOID_FUNC blacs_get_(int *ConTxt, int *what, int *val)
+    case SGET_MSGIDS:
+       if (BI_COMM_WORLD == NULL) Cblacs_pinfo(val, &val[1]);
+       iptr = &val[1];
+-      ierr=MPI_Attr_get(MPI_COMM_WORLD, MPI_TAG_UB, (BVOID **) &iptr,val);
++      ierr=MPI_Comm_get_attr(MPI_COMM_WORLD, MPI_TAG_UB, (BVOID **) &iptr,val);
+       val[0] = 0;
+       val[1] = *iptr;
+       break;
+diff --git a/BLACS/SRC/cgamn2d_.c b/BLACS/SRC/cgamn2d_.c
+index 2db6ccb..6958f32 100644
+--- a/BLACS/SRC/cgamn2d_.c
++++ b/BLACS/SRC/cgamn2d_.c
+@@ -221,7 +221,7 @@ F_VOID_FUNC cgamn2d_(int *ConTxt, F_CHAR scope, F_CHAR top, int *m, int *n,
+       {
+ #endif
+       i = 2;
+-      ierr=MPI_Type_struct(i, len, disp, dtypes, &MyType);
++      ierr=MPI_Type_create_struct(i, len, disp, dtypes, &MyType);
+       ierr=MPI_Type_commit(&MyType);
+       bp->N = bp2->N = 1;
+       bp->dtype = bp2->dtype = MyType;
+diff --git a/BLACS/SRC/cgamx2d_.c b/BLACS/SRC/cgamx2d_.c
+index 707c0b6..f802d01 100644
+--- a/BLACS/SRC/cgamx2d_.c
++++ b/BLACS/SRC/cgamx2d_.c
+@@ -221,7 +221,7 @@ F_VOID_FUNC cgamx2d_(int *ConTxt, F_CHAR scope, F_CHAR top, int *m, int *n,
+       {
+ #endif
+       i = 2;
+-      ierr=MPI_Type_struct(i, len, disp, dtypes, &MyType);
++      ierr=MPI_Type_create_struct(i, len, disp, dtypes, &MyType);
+       ierr=MPI_Type_commit(&MyType);
+       bp->N = bp2->N = 1;
+       bp->dtype = bp2->dtype = MyType;
+diff --git a/BLACS/SRC/dgamn2d_.c b/BLACS/SRC/dgamn2d_.c
+index dff23b4..a2627ac 100644
+--- a/BLACS/SRC/dgamn2d_.c
++++ b/BLACS/SRC/dgamn2d_.c
+@@ -221,7 +221,7 @@ F_VOID_FUNC dgamn2d_(int *ConTxt, F_CHAR scope, F_CHAR top, int *m, int *n,
+       {
+ #endif
+       i = 2;
+-      ierr=MPI_Type_struct(i, len, disp, dtypes, &MyType);
++      ierr=MPI_Type_create_struct(i, len, disp, dtypes, &MyType);
+       ierr=MPI_Type_commit(&MyType);
+       bp->N = bp2->N = 1;
+       bp->dtype = bp2->dtype = MyType;
+diff --git a/BLACS/SRC/dgamx2d_.c b/BLACS/SRC/dgamx2d_.c
+index a51f731..2a644d0 100644
+--- a/BLACS/SRC/dgamx2d_.c
++++ b/BLACS/SRC/dgamx2d_.c
+@@ -221,7 +221,7 @@ F_VOID_FUNC dgamx2d_(int *ConTxt, F_CHAR scope, F_CHAR top, int *m, int *n,
+       {
+ #endif
+       i = 2;
+-      ierr=MPI_Type_struct(i, len, disp, dtypes, &MyType);
++      ierr=MPI_Type_create_struct(i, len, disp, dtypes, &MyType);
+       ierr=MPI_Type_commit(&MyType);
+       bp->N = bp2->N = 1;
+       bp->dtype = bp2->dtype = MyType;
+diff --git a/BLACS/SRC/igamn2d_.c b/BLACS/SRC/igamn2d_.c
+index 16bc003..f6a7859 100644
+--- a/BLACS/SRC/igamn2d_.c
++++ b/BLACS/SRC/igamn2d_.c
+@@ -218,7 +218,7 @@ F_VOID_FUNC igamn2d_(int *ConTxt, F_CHAR scope, F_CHAR top, int *m, int *n,
+       {
+ #endif
+       i = 2;
+-      ierr=MPI_Type_struct(i, len, disp, dtypes, &MyType);
++      ierr=MPI_Type_create_struct(i, len, disp, dtypes, &MyType);
+       ierr=MPI_Type_commit(&MyType);
+       bp->N = bp2->N = 1;
+       bp->dtype = bp2->dtype = MyType;
+diff --git a/BLACS/SRC/igamx2d_.c b/BLACS/SRC/igamx2d_.c
+index 8165cbe..a7cfcc6 100644
+--- a/BLACS/SRC/igamx2d_.c
++++ b/BLACS/SRC/igamx2d_.c
+@@ -218,7 +218,7 @@ F_VOID_FUNC igamx2d_(int *ConTxt, F_CHAR scope, F_CHAR top, int *m, int *n,
+       {
+ #endif
+       i = 2;
+-      ierr=MPI_Type_struct(i, len, disp, dtypes, &MyType);
++      ierr=MPI_Type_create_struct(i, len, disp, dtypes, &MyType);
+       ierr=MPI_Type_commit(&MyType);
+       bp->N = bp2->N = 1;
+       bp->dtype = bp2->dtype = MyType;
+diff --git a/BLACS/SRC/sgamn2d_.c b/BLACS/SRC/sgamn2d_.c
+index d6c95e5..569c797 100644
+--- a/BLACS/SRC/sgamn2d_.c
++++ b/BLACS/SRC/sgamn2d_.c
+@@ -221,7 +221,7 @@ F_VOID_FUNC sgamn2d_(int *ConTxt, F_CHAR scope, F_CHAR top, int *m, int *n,
+       {
+ #endif
+       i = 2;
+-      ierr=MPI_Type_struct(i, len, disp, dtypes, &MyType);
++      ierr=MPI_Type_create_struct(i, len, disp, dtypes, &MyType);
+       ierr=MPI_Type_commit(&MyType);
+       bp->N = bp2->N = 1;
+       bp->dtype = bp2->dtype = MyType;
+diff --git a/BLACS/SRC/sgamx2d_.c b/BLACS/SRC/sgamx2d_.c
+index 4b0af6f..8897ece 100644
+--- a/BLACS/SRC/sgamx2d_.c
++++ b/BLACS/SRC/sgamx2d_.c
+@@ -221,7 +221,7 @@ F_VOID_FUNC sgamx2d_(int *ConTxt, F_CHAR scope, F_CHAR top, int *m, int *n,
+       {
+ #endif
+       i = 2;
+-      ierr=MPI_Type_struct(i, len, disp, dtypes, &MyType);
++      ierr=MPI_Type_create_struct(i, len, disp, dtypes, &MyType);
+       ierr=MPI_Type_commit(&MyType);
+       bp->N = bp2->N = 1;
+       bp->dtype = bp2->dtype = MyType;
+diff --git a/BLACS/SRC/zgamn2d_.c b/BLACS/SRC/zgamn2d_.c
+index 9de2b23..37897df 100644
+--- a/BLACS/SRC/zgamn2d_.c
++++ b/BLACS/SRC/zgamn2d_.c
+@@ -221,7 +221,7 @@ F_VOID_FUNC zgamn2d_(int *ConTxt, F_CHAR scope, F_CHAR top, int *m, int *n,
+       {
+ #endif
+       i = 2;
+-      ierr=MPI_Type_struct(i, len, disp, dtypes, &MyType);
++      ierr=MPI_Type_create_struct(i, len, disp, dtypes, &MyType);
+       ierr=MPI_Type_commit(&MyType);
+       bp->N = bp2->N = 1;
+       bp->dtype = bp2->dtype = MyType;
+diff --git a/BLACS/SRC/zgamx2d_.c b/BLACS/SRC/zgamx2d_.c
+index 414c381..0e9d474 100644
+--- a/BLACS/SRC/zgamx2d_.c
++++ b/BLACS/SRC/zgamx2d_.c
+@@ -221,7 +221,7 @@ F_VOID_FUNC zgamx2d_(int *ConTxt, F_CHAR scope, F_CHAR top, int *m, int *n,
+       {
+ #endif
+       i = 2;
+-      ierr=MPI_Type_struct(i, len, disp, dtypes, &MyType);
++      ierr=MPI_Type_create_struct(i, len, disp, dtypes, &MyType);
+       ierr=MPI_Type_commit(&MyType);
+       bp->N = bp2->N = 1;
+       bp->dtype = bp2->dtype = MyType;
diff --git a/nixpkgs/pkgs/development/libraries/science/math/scs/default.nix b/nixpkgs/pkgs/development/libraries/science/math/scs/default.nix
new file mode 100644
index 000000000000..f9d1a84b1f03
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/science/math/scs/default.nix
@@ -0,0 +1,50 @@
+{ stdenv, fetchFromGitHub, blas, liblapack, gfortran, fixDarwinDylibNames }:
+
+stdenv.mkDerivation rec {
+  name = "scs-${version}";
+  version = "2.0.2";
+
+  src = fetchFromGitHub {
+    owner = "cvxgrp";
+    repo = "scs";
+    rev = "v${version}";
+    sha256 = "17lbcmcsniqlyzgbzmjipfd0rrk25a8hzh7l5wl2wp1iwsd8c3a9";
+  };
+
+  # Actually link and add libgfortran to the rpath
+  postPatch = ''
+    substituteInPlace scs.mk \
+      --replace "#-lgfortran" "-lgfortran" \
+      --replace "gcc" "cc"
+  '';
+
+  nativeBuildInputs = stdenv.lib.optional stdenv.isDarwin fixDarwinDylibNames;
+
+  buildInputs = [ blas liblapack gfortran.cc.lib ];
+
+  doCheck = true;
+
+  # Test demo requires passing data and seed; numbers chosen arbitrarily.
+  postCheck = ''
+    ./out/demo_socp_indirect 42 0.42 0.42 42
+  '';
+
+  installPhase = ''
+    runHook preInstall
+    mkdir -p $out/lib
+    cp -r include $out/
+    cp out/*.a out/*.so out/*.dylib $out/lib/
+    runHook postInstall
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Splitting Conic Solver";
+    longDescription = ''
+      Numerical optimization package for solving large-scale convex cone problems
+    '';
+    homepage = https://github.com/cvxgrp/scs;
+    license = licenses.mit;
+    platforms = platforms.all;
+    maintainers = [ maintainers.bhipple ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/science/math/suitesparse/4.2.nix b/nixpkgs/pkgs/development/libraries/science/math/suitesparse/4.2.nix
new file mode 100644
index 000000000000..7e71eafef697
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/science/math/suitesparse/4.2.nix
@@ -0,0 +1,43 @@
+{ stdenv, fetchurl, gfortran, openblas }:
+
+let
+  int_t = if openblas.blas64 then "int64_t" else "int32_t";
+in
+stdenv.mkDerivation rec {
+  version = "4.2.1";
+  name = "suitesparse-${version}";
+  src = fetchurl {
+    url = "http://www.cise.ufl.edu/research/sparse/SuiteSparse/SuiteSparse-${version}.tar.gz" ;
+    sha256 = "1ga69637x7kdkiy3w3lq9dvva7220bdangv2lch2wx1hpi83h0p8";
+  };
+
+  nativeBuildInputs = [ gfortran ];
+  buildInputs = [ openblas ];
+
+  preConfigure = ''
+    mkdir -p $out/lib
+    mkdir -p $out/include
+
+    sed -i "SuiteSparse_config/SuiteSparse_config.mk" \
+        -e 's/METIS .*$/METIS =/' \
+        -e 's/METIS_PATH .*$/METIS_PATH =/' \
+        -e '/CHOLMOD_CONFIG/ s/$/-DNPARTITION -DLONGBLAS=${int_t}/' \
+        -e '/UMFPACK_CONFIG/ s/$/-DLONGBLAS=${int_t}/'
+  '';
+
+  makeFlags = [
+    "PREFIX=\"$(out)\""
+    "INSTALL_LIB=$(out)/lib"
+    "INSTALL_INCLUDE=$(out)/include"
+    "BLAS=-lopenblas"
+    "LAPACK="
+  ];
+
+  meta = with stdenv.lib; {
+    homepage = http://faculty.cse.tamu.edu/davis/suitesparse.html;
+    description = "A suite of sparse matrix algorithms";
+    license = with licenses; [ bsd2 gpl2Plus lgpl21Plus ];
+    maintainers = with maintainers; [ ttuegel ];
+    platforms = with platforms; unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/science/math/suitesparse/4.4.nix b/nixpkgs/pkgs/development/libraries/science/math/suitesparse/4.4.nix
new file mode 100644
index 000000000000..1ce56d1e49f7
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/science/math/suitesparse/4.4.nix
@@ -0,0 +1,100 @@
+{ stdenv, fetchurl, gfortran, openblas
+, enableCuda  ? false, cudatoolkit
+}:
+
+let
+  version = "4.4.4";
+  name = "suitesparse-${version}";
+
+  int_t = if openblas.blas64 then "int64_t" else "int32_t";
+  SHLIB_EXT = stdenv.hostPlatform.extensions.sharedLibrary;
+in
+stdenv.mkDerivation {
+  inherit name;
+
+  src = fetchurl {
+    url = "http://faculty.cse.tamu.edu/davis/SuiteSparse/SuiteSparse-${version}.tar.gz";
+    sha256 = "1zdn1y0ij6amj7smmcslkqgbqv9yy5cwmbyzqc9v6drzdzllgbpj";
+  };
+
+  preConfigure = ''
+    mkdir -p $out/lib
+    mkdir -p $out/include
+
+    sed -i "SuiteSparse_config/SuiteSparse_config.mk" \
+        -e 's/METIS .*$/METIS =/' \
+        -e 's/METIS_PATH .*$/METIS_PATH =/' \
+        -e '/CHOLMOD_CONFIG/ s/$/-DNPARTITION -DLONGBLAS=${int_t}/' \
+        -e '/UMFPACK_CONFIG/ s/$/-DLONGBLAS=${int_t}/'
+  ''
+  + stdenv.lib.optionalString stdenv.isDarwin ''
+    sed -i "SuiteSparse_config/SuiteSparse_config.mk" \
+        -e 's/^[[:space:]]*\(LIB = -lm\) -lrt/\1/'
+  ''
+  + stdenv.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)|' \
+        -e 's|^[[:space:]]*\(GPU_CONFIG    =\)|GPU_CONFIG = -I$(CUDA_ROOT)/include -DGPU_BLAS -DCHOLMOD_OMP_NUM_THREADS=$(NIX_BUILD_CORES) |' \
+        -e 's|^[[:space:]]*\(CUDA_PATH     =\)|CUDA_PATH = $(CUDA_ROOT)|' \
+        -e 's|^[[:space:]]*\(CUDART_LIB    =\)|CUDART_LIB = $(CUDA_ROOT)/lib64/libcudart.so|' \
+        -e 's|^[[:space:]]*\(CUBLAS_LIB    =\)|CUBLAS_LIB = $(CUDA_ROOT)/lib64/libcublas.so|' \
+        -e 's|^[[:space:]]*\(CUDA_INC_PATH =\)|CUDA_INC_PATH = $(CUDA_ROOT)/include/|' \
+        -e 's|^[[:space:]]*\(NV20          =\)|NV20 = -arch=sm_20 -Xcompiler -fPIC|' \
+        -e 's|^[[:space:]]*\(NV30          =\)|NV30 = -arch=sm_30 -Xcompiler -fPIC|' \
+        -e 's|^[[:space:]]*\(NV35          =\)|NV35 = -arch=sm_35 -Xcompiler -fPIC|' \
+        -e 's|^[[:space:]]*\(NVCC          =\) echo|NVCC = $(CUDA_ROOT)/bin/nvcc|' \
+        -e 's|^[[:space:]]*\(NVCCFLAGS     =\)|NVCCFLAGS = $(NV20) -O3 -gencode=arch=compute_20,code=sm_20 -gencode=arch=compute_30,code=sm_30 -gencode=arch=compute_35,code=sm_35 -gencode=arch=compute_60,code=sm_60|'
+  '';
+
+  makeFlags = [
+    "PREFIX=\"$(out)\""
+    "INSTALL_LIB=$(out)/lib"
+    "INSTALL_INCLUDE=$(out)/include"
+    "BLAS=-lopenblas"
+    "LAPACK="
+  ];
+
+  NIX_CFLAGS_COMPILE = stdenv.lib.optionalString stdenv.isDarwin " -DNTIMER";
+
+  postInstall = ''
+    # Build and install shared library
+    (
+        cd "$(mktemp -d)"
+        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}" -lopenblas ${stdenv.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}
+    done
+
+    # Install documentation
+    outdoc=$out/share/doc/${name}
+    mkdir -p $outdoc
+    cp -r AMD/Doc $outdoc/amd
+    cp -r BTF/Doc $outdoc/bft
+    cp -r CAMD/Doc $outdoc/camd
+    cp -r CCOLAMD/Doc $outdoc/ccolamd
+    cp -r CHOLMOD/Doc $outdoc/cholmod
+    cp -r COLAMD/Doc $outdoc/colamd
+    cp -r CXSparse/Doc $outdoc/cxsparse
+    cp -r KLU/Doc $outdoc/klu
+    cp -r LDL/Doc $outdoc/ldl
+    cp -r RBio/Doc $outdoc/rbio
+    cp -r SPQR/Doc $outdoc/spqr
+    cp -r UMFPACK/Doc $outdoc/umfpack
+  '';
+
+  nativeBuildInputs = [ gfortran ];
+  buildInputs = [ openblas ];
+
+  meta = with stdenv.lib; {
+    homepage = http://faculty.cse.tamu.edu/davis/suitesparse.html;
+    description = "A suite of sparse matrix algorithms";
+    license = with licenses; [ bsd2 gpl2Plus lgpl21Plus ];
+    maintainers = with maintainers; [ ttuegel ];
+    platforms = with platforms; unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/science/math/suitesparse/default.nix b/nixpkgs/pkgs/development/libraries/science/math/suitesparse/default.nix
new file mode 100644
index 000000000000..a6c803be260a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/science/math/suitesparse/default.nix
@@ -0,0 +1,138 @@
+{ stdenv, fetchurl, gfortran, openblas, cmake, fixDarwinDylibNames
+, gnum4
+, enableCuda  ? false, cudatoolkit
+}:
+
+let
+  version = "5.4.0";
+  name = "suitesparse-${version}";
+
+  SHLIB_EXT = stdenv.hostPlatform.extensions.sharedLibrary;
+in
+stdenv.mkDerivation rec {
+  inherit name;
+
+  src = fetchurl {
+    url = "http://faculty.cse.tamu.edu/davis/SuiteSparse/SuiteSparse-${version}.tar.gz";
+    sha256 = "1lfvjj787yqyhk25w7brlrkrl7dnnn5dq4ijxws3wrbcd4vd2k9p";
+  };
+
+  dontUseCmakeConfigure = true;
+
+  preConfigure = ''
+    mkdir -p $out/lib
+    mkdir -p $out/include
+    mkdir -p $out/share/doc/${name}
+
+    sed -i "SuiteSparse_config/SuiteSparse_config.mk" \
+        -e 's/METIS .*$/METIS =/' \
+        -e 's/METIS_PATH .*$/METIS_PATH =/' \
+        -e '/CHOLMOD_CONFIG/ s/$/-DNPARTITION/'
+  ''
+  + stdenv.lib.optionalString stdenv.isDarwin ''
+    sed -i "SuiteSparse_config/SuiteSparse_config.mk" \
+        -e 's/^[[:space:]]*\(LIB = -lm\) -lrt/\1/'
+  ''
+  + stdenv.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)|' \
+        -e 's|^[[:space:]]*\(GPU_CONFIG    =\)|GPU_CONFIG = -I$(CUDA_ROOT)/include -DGPU_BLAS -DCHOLMOD_OMP_NUM_THREADS=$(NIX_BUILD_CORES) |' \
+        -e 's|^[[:space:]]*\(CUDA_PATH     =\)|CUDA_PATH = $(CUDA_ROOT)|' \
+        -e 's|^[[:space:]]*\(CUDART_LIB    =\)|CUDART_LIB = $(CUDA_ROOT)/lib64/libcudart.so|' \
+        -e 's|^[[:space:]]*\(CUBLAS_LIB    =\)|CUBLAS_LIB = $(CUDA_ROOT)/lib64/libcublas.so|' \
+        -e 's|^[[:space:]]*\(CUDA_INC_PATH =\)|CUDA_INC_PATH = $(CUDA_ROOT)/include/|' \
+        -e 's|^[[:space:]]*\(NV20          =\)|NV20 = -arch=sm_20 -Xcompiler -fPIC|' \
+        -e 's|^[[:space:]]*\(NV30          =\)|NV30 = -arch=sm_30 -Xcompiler -fPIC|' \
+        -e 's|^[[:space:]]*\(NV35          =\)|NV35 = -arch=sm_35 -Xcompiler -fPIC|' \
+        -e 's|^[[:space:]]*\(NVCC          =\) echo|NVCC = $(CUDA_ROOT)/bin/nvcc|' \
+        -e 's|^[[:space:]]*\(NVCCFLAGS     =\)|NVCCFLAGS = $(NV20) -O3 -gencode=arch=compute_20,code=sm_20 -gencode=arch=compute_30,code=sm_30 -gencode=arch=compute_35,code=sm_35 -gencode=arch=compute_60,code=sm_60|'
+  '';
+
+  NIX_CFLAGS_COMPILE = stdenv.lib.optionalString stdenv.isDarwin " -DNTIMER";
+
+  buildPhase = ''
+    runHook preBuild
+
+    # Build individual shared libraries
+    make library        \
+        BLAS=-lopenblas \
+        LAPACK=""       \
+        ${stdenv.lib.optionalString openblas.blas64 "CFLAGS=-DBLAS64"}
+
+    # Build libsuitesparse.so which bundles all the individual libraries.
+    # Bundling is done by building the static libraries, extracting objects from
+    # them and combining the objects into one shared library.
+    mkdir -p static
+    make static AR_TARGET=$(pwd)/static/'$(LIBRARY).a'
+    (
+        cd static
+        for i in lib*.a; do
+          ar -x $i
+        done
+    )
+    ${if enableCuda then "${cudatoolkit}/bin/nvcc" else "${stdenv.cc.outPath}/bin/cc"} \
+        static/*.o                                                                     \
+        ${if stdenv.isDarwin then "-dynamiclib" else "--shared"}                       \
+        -o "lib/libsuitesparse${SHLIB_EXT}"                                            \
+        -lopenblas                                                                     \
+        ${stdenv.lib.optionalString enableCuda "-lcublas"}
+
+    runHook postBuild
+  '';
+
+  installPhase = ''
+    runHook preInstall
+
+    mkdir -p $out
+    cp -r lib $out/
+    cp -r include $out/
+    cp -r share $out/
+    ''
+    + stdenv.lib.optionalString stdenv.isDarwin ''
+    # The fixDarwinDylibNames in nixpkgs can't seem to fix all the libraries.
+    # We manually fix them up here.
+    fixDarwinDylibNames() {
+        local flags=()
+        local old_id
+
+        for fn in "$@"; do
+            flags+=(-change "$PWD/lib/$(basename "$fn")" "$fn")
+        done
+
+        for fn in "$@"; do
+            if [ -L "$fn" ]; then continue; fi
+            echo "$fn: fixing dylib"
+            install_name_tool -id "$fn" "''${flags[@]}" "$fn"
+        done
+    }
+
+    fixDarwinDylibNames $(find "$out" -name "*.dylib")
+    ''
+    + stdenv.lib.optionalString (!stdenv.isDarwin) ''
+    # Fix rpaths
+    cd $out
+    find -name \*.so\* -type f -exec \
+      patchelf --set-rpath "$out/lib:${stdenv.lib.makeLibraryPath buildInputs}" {} \;
+    ''
+    +
+    ''
+    runHook postInstall
+    '';
+
+  nativeBuildInputs = [
+    cmake
+    gnum4
+  ] ++ stdenv.lib.optional stdenv.isDarwin fixDarwinDylibNames;
+
+  buildInputs = [ openblas gfortran.cc.lib ]
+    ++ stdenv.lib.optional enableCuda cudatoolkit;
+
+  meta = with stdenv.lib; {
+    homepage = http://faculty.cse.tamu.edu/davis/suitesparse.html;
+    description = "A suite of sparse matrix algorithms";
+    license = with licenses; [ bsd2 gpl2Plus lgpl21Plus ];
+    maintainers = with maintainers; [ ttuegel ];
+    platforms = with platforms; unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/science/math/superlu/add-superlu-lib-as-dependency-for-the-unit-tests.patch b/nixpkgs/pkgs/development/libraries/science/math/superlu/add-superlu-lib-as-dependency-for-the-unit-tests.patch
new file mode 100644
index 000000000000..29d86238af08
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/science/math/superlu/add-superlu-lib-as-dependency-for-the-unit-tests.patch
@@ -0,0 +1,7 @@
+--- a/TESTING/MATGEN/CMakeLists.txt
++++ b/TESTING/MATGEN/CMakeLists.txt
+@@ -97,3 +97,4 @@ if(enable_complex16)
+ endif()
+ 
+ add_library(matgen ${sources})
++target_link_libraries(matgen superlu)
diff --git a/nixpkgs/pkgs/development/libraries/science/math/superlu/default.nix b/nixpkgs/pkgs/development/libraries/science/math/superlu/default.nix
new file mode 100644
index 000000000000..9938a3096a02
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/science/math/superlu/default.nix
@@ -0,0 +1,36 @@
+{ stdenv, fetchurl, cmake,
+  gfortran, openblasCompat}:
+
+stdenv.mkDerivation rec {
+  version = "5.2.1";
+  name = "superlu-${version}";
+
+  src = fetchurl {
+    url = "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/superlu_${version}.tar.gz";
+    sha256 = "0qzlb7cd608q62kyppd0a8c65l03vrwqql6gsm465rky23b6dyr8";
+  };
+
+  buildInputs = [ cmake gfortran ];
+
+  propagatedBuildInputs = [ openblasCompat ];
+
+  cmakeFlags = [
+    "-DBUILD_SHARED_LIBS=true"
+    "-DUSE_XSDK_DEFAULTS=true"
+  ];
+
+  patches = [
+    ./find-openblas-library.patch
+    ./add-superlu-lib-as-dependency-for-the-unit-tests.patch
+  ];
+
+  doCheck = true;
+  checkTarget = "test";
+
+  meta = {
+    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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/science/math/superlu/find-openblas-library.patch b/nixpkgs/pkgs/development/libraries/science/math/superlu/find-openblas-library.patch
new file mode 100644
index 000000000000..ce7bc6974c95
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/science/math/superlu/find-openblas-library.patch
@@ -0,0 +1,11 @@
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -75,6 +75,8 @@ set(CMAKE_C_FLAGS_RELEASE "-O3" CACHE STRING "")
+ ######################################################################
+ #
+ #--------------------- BLAS ---------------------
++find_package(OpenBLAS)
++set(TPL_BLAS_LIBRARIES ${OpenBLAS_LIBRARIES})
+ if(NOT enable_blaslib)
+   if (TPL_BLAS_LIBRARIES)
+     set(BLAS_FOUND TRUE)
diff --git a/nixpkgs/pkgs/development/libraries/science/math/sympow/default.nix b/nixpkgs/pkgs/development/libraries/science/math/sympow/default.nix
new file mode 100644
index 000000000000..080cab86ca4b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/science/math/sympow/default.nix
@@ -0,0 +1,89 @@
+{ stdenv
+, fetchurl
+, fetchpatch
+, makeWrapper
+}:
+
+stdenv.mkDerivation rec {
+  version = "1.018.1";
+  name = "sympow-${version}";
+
+  src = fetchurl {
+    # Original website no longer reachable
+    url = "mirror://sageupstream/sympow/sympow-${version}.tar.bz2";
+    sha256 = "0hphs7ia1wr5mydf288zvwj4svrymfpadcg3pi6w80km2yg5bm3c";
+  };
+
+  nativeBuildInputs = [
+    makeWrapper
+  ];
+
+  configurePhase = ''
+    runHook preConfigure
+    ./Configure # doesn't take any options
+    runHook postConfigure
+  '';
+
+  installPhase = ''
+    runHook preInstall
+    install -D datafiles/* --target-directory "$out/share/sympow/datafiles/"
+    install *.gp "$out/share/sympow/"
+    install -Dm755 sympow "$out/share/sympow/sympow"
+    install -D new_data "$out/bin/new_data"
+
+    makeWrapper "$out/share/sympow/sympow" "$out/bin/sympow" \
+      --run 'export SYMPOW_LOCAL="$HOME/.local/share/sympow"' \
+      --run 'if [ ! -d "$SYMPOW_LOCAL" ]; then
+        mkdir -p "$SYMPOW_LOCAL" 
+        cp -r ${placeholder "out"}/share/sympow/* "$SYMPOW_LOCAL"
+        chmod -R +xw "$SYMPOW_LOCAL"
+    fi' \
+      --run 'cd "$SYMPOW_LOCAL"'
+    runHook postInstall
+  '';
+
+  patches = [
+    # don't hardcode paths
+    (fetchpatch {
+      name = "do_not_hardcode_paths.patch";
+      url = "https://git.sagemath.org/sage.git/plain/build/pkgs/sympow/patches/Configure.patch?id=07d6c37d18811e2b377a9689790a7c5e24da16ba";
+      sha256 = "1611p8ra8zkxvmxn3gm2l64bd4ma4m6r4vd6vwswcic91k1fci04";
+    })
+
+    # bug on some platforms in combination with a newer gcc:
+    # https://trac.sagemath.org/ticket/11920
+    (fetchpatch {
+      name = "fix_newer_gcc1.patch";
+      url = "https://git.sagemath.org/sage.git/plain/build/pkgs/sympow/patches/fpu.patch?id=07d6c37d18811e2b377a9689790a7c5e24da16ba";
+      sha256 = "14gfa56w3ddfmd4d5ir9a40y2zi43cj1i4d2l2ij9l0qlqdy9jyx";
+    })
+    (fetchpatch {
+      name = "fix_newer_gcc2.patch";
+      url = "https://git.sagemath.org/sage.git/plain/build/pkgs/sympow/patches/execlp.patch?id=07d6c37d18811e2b377a9689790a7c5e24da16ba";
+      sha256 = "190gqhgz9wgw4lqwz0nwb1izc9zffx34bazsiw2a2sz94bmgb54v";
+    })
+
+    # fix pointer initialization bug (https://trac.sagemath.org/ticket/22862)
+    (fetchpatch {
+      name = "fix_pointer_initialization1.patch";
+      url = "https://git.sagemath.org/sage.git/plain/build/pkgs/sympow/patches/initialize-tacks.patch?id=07d6c37d18811e2b377a9689790a7c5e24da16ba";
+      sha256 = "02341vdbbidfs39s26vi4n5wigz619sw8fdbl0h9qsmwwhscgf85";
+    })
+    (fetchpatch {
+      name = "fix_pointer_initialization2.patch";
+      url = "https://git.archlinux.org/svntogit/community.git/plain/trunk/sympow-datafiles.patch?h=packages/sympow&id=5088e641a45b23d0385d8e63be65315129b4cf58";
+      sha256 = "1m0vz048layb47r1jjf7fplw650ccc9x0w3l322iqmppzmv3022a";
+    })
+  ];
+
+  meta = with stdenv.lib; {
+    description = "A package to compute special values of symmetric power elliptic curve L-functions";
+    license = {
+      shortName = "sympow";
+      fullName = "Custom, BSD-like. See COPYING file.";
+      free = true;
+    };
+    maintainers = with maintainers; [ timokau ];
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/science/math/zn_poly/default.nix b/nixpkgs/pkgs/development/libraries/science/math/zn_poly/default.nix
new file mode 100644
index 000000000000..ad4d4c017376
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/science/math/zn_poly/default.nix
@@ -0,0 +1,75 @@
+{ stdenv
+, lib
+, fetchFromGitLab
+, fetchpatch
+, gmp
+, python2
+, tune ? false # tune to hardware, impure
+}:
+
+stdenv.mkDerivation rec {
+  version = "0.9.1";
+  pname = "zn_poly";
+  name = "${pname}-${version}";
+
+  # sage has picked up the maintenance (bug fixes and building, not development)
+  # from the original, now unmaintained project which can be found at
+  # http://web.maths.unsw.edu.au/~davidharvey/code/zn_poly/
+  src = fetchFromGitLab {
+    owner = "sagemath";
+    repo = "zn_poly";
+    rev = version;
+    sha256 = "0ra5vy585bqq7g3317iw6fp44iqgqvds3j0l1va6mswimypq4vxb";
+  };
+
+  buildInputs = [
+    gmp
+  ];
+
+  nativeBuildInputs = [
+    python2 # needed by ./configure to create the makefile
+  ];
+
+  # name of library file ("libzn_poly.so")
+  libbasename = "libzn_poly";
+  libext = "${stdenv.targetPlatform.extensions.sharedLibrary}";
+
+  makeFlags = [ "CC=cc" ];
+
+  # Tuning (either autotuning or with hand-written paramters) is possible
+  # but not implemented here.
+  # It seems buggy anyways (see homepage).
+  buildFlags = [ "all" "${libbasename}${libext}" ];
+
+  configureFlags = lib.optionals (!tune) [
+    "--disable-tuning"
+  ];
+
+  patches = [
+    # fix format-security by not passing variables directly to printf
+    # https://gitlab.com/sagemath/zn_poly/merge_requests/1
+    (fetchpatch {
+      name = "format-security.patch";
+      url = "https://gitlab.com/timokau/zn_poly/commit/1950900a80ec898d342b8bcafa148c8027649766.patch";
+      sha256 = "1gks9chvsfpc6sg5h3nqqfia4cgvph7jmj9dw67k7dk7kv9y0rk1";
+    })
+  ];
+
+  # `make install` fails to install some header files and the lib file.
+  installPhase = ''
+    mkdir -p "$out/include/zn_poly"
+    mkdir -p "$out/lib"
+    cp "${libbasename}"*"${libext}" "$out/lib"
+    cp include/*.h "$out/include/zn_poly"
+  '';
+
+  doCheck = true;
+
+  meta = with lib; {
+    homepage = http://web.maths.unsw.edu.au/~davidharvey/code/zn_poly/;
+    description = "Polynomial arithmetic over Z/nZ";
+    license = with licenses; [ gpl3 ];
+    maintainers = with maintainers; [ timokau ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/science/networking/ns3/default.nix b/nixpkgs/pkgs/development/libraries/science/networking/ns3/default.nix
new file mode 100644
index 000000000000..5218de075093
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/science/networking/ns3/default.nix
@@ -0,0 +1,96 @@
+{ stdenv
+, fetchFromGitHub
+, python
+, wafHook
+
+# for binding generation
+, castxml ? null
+
+# can take a long time, generates > 30000 images/graphs
+, enableDoxygen ? false
+
+# e.g. "optimized" or "debug". If not set, use default one
+, build_profile ? null
+
+# --enable-examples
+, withExamples ? false
+
+# very long
+, withManual ? false, doxygen ? null, graphviz ? null, imagemagick ? null
+# for manual, tetex is used to get the eps2pdf binary
+# texlive to get latexmk. building manual still fails though
+, dia, tetex ? null, ghostscript ? null, texlive ? null
+
+# generates python bindings
+, generateBindings ? false, ncurses ? null
+
+# All modules can be enabled by choosing 'all_modules'.
+# we include here the DCE mandatory ones
+, modules ? [ "core" "network" "internet" "point-to-point" "fd-net-device" "netanim"]
+, gcc6
+, lib
+}:
+
+let
+  pythonEnv = python.withPackages(ps:
+    stdenv.lib.optional withManual ps.sphinx
+    ++ stdenv.lib.optionals generateBindings (with ps;[ pybindgen pygccxml ])
+  );
+in
+stdenv.mkDerivation rec {
+
+  name = "ns-3.${version}";
+  version = "28";
+
+  # the all in one https://www.nsnam.org/release/ns-allinone-3.27.tar.bz2;
+  # fetches everything (netanim, etc), this package focuses on ns3-core
+  src = fetchFromGitHub {
+    owner  = "nsnam";
+    repo   = "ns-3-dev-git";
+    rev    = name;
+    sha256 = "17kzfjpgw2mvyx1c9bxccnvw67jpk09fxmcnlkqx9xisk10qnhng";
+  };
+
+  nativeBuildInputs = [ wafHook ];
+  # ncurses is a hidden dependency of waf when checking python
+  buildInputs = lib.optionals generateBindings [ castxml ncurses ]
+    ++ stdenv.lib.optional enableDoxygen [ doxygen graphviz imagemagick ]
+    ++ stdenv.lib.optional withManual [ dia tetex ghostscript texlive.combined.scheme-medium ];
+
+  propagatedBuildInputs = [ gcc6 pythonEnv ];
+
+  postPatch = ''
+    patchShebangs doc/ns3_html_theme/get_version.sh
+  '';
+
+  wafConfigureFlags = with stdenv.lib; [
+      "--enable-modules=${stdenv.lib.concatStringsSep "," modules}"
+      "--with-python=${pythonEnv.interpreter}"
+  ]
+  ++ optional (build_profile != null) "--build-profile=${build_profile}"
+  ++ optional generateBindings [  ]
+  ++ optional withExamples " --enable-examples "
+  ++ optional doCheck " --enable-tests "
+  ;
+
+  buildTargets = "build"
+    + lib.optionalString enableDoxygen " doxygen"
+    + lib.optionalString withManual "sphinx";
+
+  doCheck = true;
+
+  # we need to specify the proper interpreter else ns3 can check against a
+  # different version even though we
+  checkPhase =  ''
+    ${pythonEnv.interpreter} ./test.py
+  '';
+
+  hardeningDisable = [ "fortify" ];
+
+  meta = {
+    homepage = http://www.nsnam.org;
+    license = stdenv.lib.licenses.gpl3;
+    description = "A discrete time event network simulator";
+    platforms = with stdenv.lib.platforms; unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/science/robotics/ispike/default.nix b/nixpkgs/pkgs/development/libraries/science/robotics/ispike/default.nix
new file mode 100644
index 000000000000..5f2263d821d0
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/science/robotics/ispike/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchurl, cmake, boost
+}:
+
+stdenv.mkDerivation rec {
+  name = "ispike-${version}";
+  version = "2.1.1";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/ispike/${name}.tar.gz";
+    sha256 = "0khrxp43bi5kisr8j4lp9fl4r5marzf7b4inys62ac108sfb28lp";
+  };
+
+  buildInputs = [ cmake boost ];
+
+  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 ];
+  };
+
+  
+}
diff --git a/nixpkgs/pkgs/development/libraries/scmccid/default.nix b/nixpkgs/pkgs/development/libraries/scmccid/default.nix
new file mode 100644
index 000000000000..c9c26ca0d66c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/scmccid/default.nix
@@ -0,0 +1,40 @@
+{stdenv, fetchurl, patchelf, libusb}:
+
+assert stdenv ? cc && stdenv.cc.libc != null;
+
+stdenv.mkDerivation rec {
+  name = "scmccid-5.0.11";
+
+  src = if stdenv.hostPlatform.system == "i686-linux" then (fetchurl {
+      url = "http://www.scmmicro.com/support/download/scmccid_5.0.11_linux.tar.gz";
+      sha256 = "1r5wkarhzl09ncgj55baizf573czw0nplh1pgddzx9xck66kh5bm";
+    })
+    else if stdenv.hostPlatform.system == "x86_64-linux" then (fetchurl {
+        url = "http://www.scmmicro.com/support/download/scmccid_5.0.11_linux_x64.tar.gz";
+        sha256 = "0k9lzlk01sl4ycfqgrqqy3bildz0mcr1r0kkicgjz96l4s0jgz0i";
+    })
+    else throw "Architecture not supported";
+
+  nativeBuildInputs = [ patchelf ];
+
+  installPhase = ''
+    RPATH=${libusb.out}/lib:${stdenv.cc.libc.out}/lib
+
+    for a in proprietary/*/Contents/Linux/*.so*; do
+        if ! test -L $a; then
+            patchelf --set-rpath $RPATH $a
+        fi
+    done
+
+    mkdir -p $out/pcsc/drivers
+    cp -R proprietary/* $out/pcsc/drivers
+  '';
+
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/scriptaculous/default.nix b/nixpkgs/pkgs/development/libraries/scriptaculous/default.nix
new file mode 100644
index 000000000000..ba291dc97ff2
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/scriptaculous/default.nix
@@ -0,0 +1,30 @@
+{ stdenv, fetchurl, unzip, ... }: stdenv.mkDerivation rec {
+  name = "scriptaculous-${version}";
+  version = "1.9.0";
+
+  src = fetchurl {
+    url = "https://script.aculo.us/dist/scriptaculous-js-${version}.zip";
+    sha256 = "1xpnk3cq8n07lxd69k5jxh48s21zh41ihq10z4a6lcnk238rp8qz";
+  };
+
+  nativeBuildInputs = [ unzip ];
+
+  installPhase = ''
+    mkdir $out
+    cp src/*.js $out
+  '';
+
+  meta = with stdenv.lib; {
+    description = "A set of JavaScript libraries to enhance the user interface of web sites";
+    longDescription = ''
+      script.aculo.us provides you with
+      easy-to-use, cross-browser user
+      interface JavaScript libraries to make
+      your web sites and web applications fly.
+    '';
+    homepage = https://script.aculo.us/;
+    downloadPage = https://script.aculo.us/dist/;
+    license = licenses.mit;
+    maintainers = with maintainers; [ das_j ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/sdformat/3.nix b/nixpkgs/pkgs/development/libraries/sdformat/3.nix
new file mode 100644
index 000000000000..116f248b3b4e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/sdformat/3.nix
@@ -0,0 +1,7 @@
+{ stdenv, fetchurl, callPackage, ... } @ args:
+
+callPackage ./default.nix (args // rec {
+  version = "3.7.0";
+  srchash-sha256 = "07kn8bgvj9mwwinsp2cbmz11z7zw2lgnj61mi1gi1pjg7q9in98q";
+})
+
diff --git a/nixpkgs/pkgs/development/libraries/sdformat/default.nix b/nixpkgs/pkgs/development/libraries/sdformat/default.nix
new file mode 100644
index 000000000000..f81eb9b259e8
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/sdformat/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchurl, cmake, boost, ruby, ignition, tinyxml
+  , name ? "sdformat-${version}"
+  , version ? "4.0.0" # versions known to work with this expression include 3.7.0
+  , srchash-sha256 ? "b0f94bb40b0d83e35ff250a7916fdfd6df5cdc1e60c47bc53dd2da5e2378163e"
+  , ...
+  }:
+
+stdenv.mkDerivation rec {
+  src = fetchurl { 
+      url = "http://osrf-distributions.s3.amazonaws.com/sdformat/releases/${name}.tar.bz2";
+      sha256 = srchash-sha256;
+  };
+
+  inherit name;
+
+  prePatch = ''
+    substituteInPlace cmake/sdf_config.cmake.in --replace "@CMAKE_INSTALL_PREFIX@/@LIB_INSTALL_DIR@" "@LIB_INSTALL_DIR@"
+  '';
+
+  enableParallelBuilding = true;
+  buildInputs = [
+    cmake boost ruby ignition.math2 tinyxml
+  ];
+
+  meta = {
+    broken = true;
+    platforms = stdenv.lib.platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/seasocks/default.nix b/nixpkgs/pkgs/development/libraries/seasocks/default.nix
new file mode 100644
index 000000000000..c6bb2afc2705
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/seasocks/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchFromGitHub, cmake, python, zlib }:
+
+stdenv.mkDerivation rec {
+  pname = "seasocks";
+  version = "1.4.2";
+
+  src = fetchFromGitHub {
+    owner = "mattgodbolt";
+    repo = pname;
+    rev = "v${version}";
+    sha256 = "1vzdhp61bq2bddz7kkpygdq5adxdspjw1q6a03j6qyyimapblrg8";
+  };
+
+  nativeBuildInputs = [ cmake ];
+  buildInputs = [ zlib python ];
+
+  meta = with stdenv.lib; {
+    homepage = https://github.com/mattgodbolt/seasocks;
+    description = "Tiny embeddable C++ HTTP and WebSocket server";
+    license = licenses.bsd2;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ fredeb ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/serd/default.nix b/nixpkgs/pkgs/development/libraries/serd/default.nix
new file mode 100644
index 000000000000..533fefa9f194
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/serd/default.nix
@@ -0,0 +1,21 @@
+{ stdenv, fetchurl, pkgconfig, python, wafHook }:
+
+stdenv.mkDerivation rec {
+  name = "serd-${version}";
+  version = "0.30.0";
+
+  src = fetchurl {
+    url = "https://download.drobilla.net/${name}.tar.bz2";
+    sha256 = "1yyfyvc6kwagi5w43ljp1bbjdvdpmgpds74lmjxycm91bkx0xyvf";
+  };
+
+  nativeBuildInputs = [ pkgconfig python wafHook ];
+
+  meta = with stdenv.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;
+    maintainers = [ maintainers.goibhniu ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/serf/default.nix b/nixpkgs/pkgs/development/libraries/serf/default.nix
new file mode 100644
index 000000000000..3fd47125bcb3
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/serf/default.nix
@@ -0,0 +1,38 @@
+{ stdenv, fetchurl, apr, scons, openssl, aprutil, zlib, kerberos
+, pkgconfig, libiconv }:
+
+stdenv.mkDerivation rec {
+  name = "serf-1.3.9";
+
+  src = fetchurl {
+    url = "https://www.apache.org/dist/serf/${name}.tar.bz2";
+    sha256 = "1k47gbgpp52049andr28y28nbwh9m36bbb0g8p0aka3pqlhjv72l";
+  };
+
+  nativeBuildInputs = [ pkgconfig scons ];
+  buildInputs = [ apr openssl aprutil zlib libiconv ]
+    ++ stdenv.lib.optional (!stdenv.isCygwin) kerberos;
+
+  patches = [ ./scons.patch ];
+
+  prefixKey = "PREFIX=";
+
+  preConfigure = ''
+    sconsFlags+=" APR=$(echo ${apr.dev}/bin/*-config)"
+    sconsFlags+=" APU=$(echo ${aprutil.dev}/bin/*-config)"
+    sconsFlags+=" CC=$CC"
+    sconsFlags+=" OPENSSL=${openssl}"
+    sconsFlags+=" ZLIB=${zlib}"
+  '' + stdenv.lib.optionalString (!stdenv.isCygwin) ''
+    sconsFlags+=" GSSAPI=${kerberos.dev}"
+  '';
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    description = "HTTP client library based on APR";
+    license = licenses.asl20;
+    maintainers = with maintainers; [ orivej raskin ];
+    platforms = platforms.linux ++ platforms.darwin;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/serf/scons.patch b/nixpkgs/pkgs/development/libraries/serf/scons.patch
new file mode 100644
index 000000000000..a7eefe7d5c1f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/serf/scons.patch
@@ -0,0 +1,12 @@
+diff --git a/SConstruct b/SConstruct
+index 4358a23..0d862e7 100644
+--- a/SConstruct
++++ b/SConstruct
+@@ -155,6 +155,7 @@ if sys.platform == 'win32':
+ env = Environment(variables=opts,
+                   tools=('default', 'textfile',),
+                   CPPPATH=['.', ],
++                  ENV=os.environ,
+                   )
+ 
+ env.Append(BUILDERS = {
diff --git a/nixpkgs/pkgs/development/libraries/sfml/default.nix b/nixpkgs/pkgs/development/libraries/sfml/default.nix
new file mode 100644
index 000000000000..8e1b9ae394b5
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/sfml/default.nix
@@ -0,0 +1,44 @@
+{ stdenv, fetchzip, cmake, libX11, freetype, libjpeg, openal, flac, libvorbis
+, glew, libXrandr, libXrender, udev, xcbutilimage
+, cf-private, IOKit, Foundation, AppKit, OpenAL
+}:
+
+let
+  version = "2.5.1";
+in
+
+stdenv.mkDerivation rec {
+  name = "sfml-${version}";
+
+  src = fetchzip {
+    url = "https://github.com/SFML/SFML/archive/${version}.tar.gz";
+    sha256 = "0abr8ri2ssfy9ylpgjrr43m6rhrjy03wbj9bn509zqymifvq5pay";
+  };
+
+  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
+    # Needed for _NSDefaultRunLoopMode, _OBJC_CLASS_$_NSArray, _OBJC_CLASS_$_NSDate
+    cf-private
+    ];
+
+  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; {
+    homepage = https://www.sfml-dev.org/;
+    description = "Simple and fast multimedia library";
+    longDescription = ''
+      SFML is a simple, fast, cross-platform and object-oriented multimedia API.
+      It provides access to windowing, graphics, audio and network.
+      It is written in C++, and has bindings for various languages such as C, .Net, Ruby, Python.
+    '';
+    license = licenses.zlib;
+    maintainers = [ maintainers.astsmtl ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/sfsexp/default.nix b/nixpkgs/pkgs/development/libraries/sfsexp/default.nix
new file mode 100644
index 000000000000..1e9a8ba6a58b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/sfsexp/default.nix
@@ -0,0 +1,19 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "sfsexp-${version}";
+  version = "1.3";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/sexpr/sexpr-${version}.tar.gz";
+    sha256 = "18gdwxjja0ip378hlzs8sp7q2g6hrmy7x10yf2wnxfmmylbpqn8k";
+  };
+
+  meta = with stdenv.lib; {
+    description = "Small, fast s-expression library";
+    homepage = http://sexpr.sourceforge.net/;
+    maintainers = with maintainers; [ jb55 ];
+    license = licenses.gpl3;
+    platforms = with platforms; unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/shapelib/default.nix b/nixpkgs/pkgs/development/libraries/shapelib/default.nix
new file mode 100644
index 000000000000..9da54a370425
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/shapelib/default.nix
@@ -0,0 +1,17 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "shapelib-1.5.0";
+
+  src = fetchurl {
+    url = "https://download.osgeo.org/shapelib/${name}.tar.gz";
+    sha256 = "1qfsgb8b3yiqwvr6h9m81g6k9fjhfys70c22p7kzkbick20a9h0z";
+  };
+
+  meta = with stdenv.lib; {
+    description = "C Library for reading, writing and updating ESRI Shapefiles";
+    homepage = http://shapelib.maptools.org/;
+    license = licenses.gpl2;
+    maintainers = [ maintainers.ehmry ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/shhmsg/default.nix b/nixpkgs/pkgs/development/libraries/shhmsg/default.nix
new file mode 100644
index 000000000000..5f14a7bb5ee5
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/shhmsg/default.nix
@@ -0,0 +1,20 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "shhmsg-1.4.2";
+
+  src = fetchurl {
+    url = "http://shh.thathost.com/pub-unix/files/${name}.tar.gz";
+    sha256 = "0ax02fzqpaxr7d30l5xbndy1s5vgg1ag643c7zwiw2wj1czrxil8";
+  };
+
+  installFlags = "INSTBASEDIR=$(out)";
+
+  meta = with stdenv.lib; {
+    description = "A library for displaying messages";
+    homepage = http://shh.thathost.com/pub-unix/;
+    license = licenses.artistic1;
+    platforms = platforms.linux;
+  };
+}
+
diff --git a/nixpkgs/pkgs/development/libraries/shhopt/default.nix b/nixpkgs/pkgs/development/libraries/shhopt/default.nix
new file mode 100644
index 000000000000..dbac4c859619
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/shhopt/default.nix
@@ -0,0 +1,19 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "shhopt-1.1.7";
+
+  src = fetchurl {
+    url = "http://shh.thathost.com/pub-unix/files/${name}.tar.gz";
+    sha256 = "0yd6bl6qw675sxa81nxw6plhpjf9d2ywlm8a5z66zyjf28sl7sds";
+  };
+
+  installFlags = "INSTBASEDIR=$(out)";
+
+  meta = with stdenv.lib; {
+    description = "A library for parsing command line options";
+    homepage = http://shh.thathost.com/pub-unix/;
+    license = licenses.artistic1;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/shibboleth-sp/default.nix b/nixpkgs/pkgs/development/libraries/shibboleth-sp/default.nix
new file mode 100644
index 000000000000..74f861297d1a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/shibboleth-sp/default.nix
@@ -0,0 +1,32 @@
+{ stdenv, fetchgit, autoreconfHook, boost, fcgi, openssl, opensaml-cpp, log4shib, pkgconfig, xercesc, xml-security-c, xml-tooling-c }:
+
+stdenv.mkDerivation rec {
+  name = "shibboleth-sp-${version}";
+  version = "2.6.1";
+
+  src = fetchgit {
+    url = "https://git.shibboleth.net/git/cpp-sp.git";
+    rev = version;
+    sha256 = "01q13p7gc0janjfml6zs46na8qnval8hc833fk2wrnmi4w9xw4fd";
+  };
+
+  nativeBuildInputs = [ autoreconfHook pkgconfig ];
+  buildInputs = [ boost fcgi openssl opensaml-cpp log4shib xercesc xml-security-c xml-tooling-c ];
+
+  configureFlags = [
+    "--without-apxs"
+    "--with-xmltooling=${xml-tooling-c}"
+    "--with-saml=${opensaml-cpp}"
+    "--with-fastcgi"
+  ];
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.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;
+    license     = licenses.asl20;
+    maintainers = [ maintainers.jammerful ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/silgraphite/default.nix b/nixpkgs/pkgs/development/libraries/silgraphite/default.nix
new file mode 100644
index 000000000000..9d0aca0ab14b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/silgraphite/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, fetchurl, pkgconfig, freetype, libXft, pango, fontconfig }:
+
+stdenv.mkDerivation rec {
+  version = "2.3.1";
+  name = "silgraphite-2.3.1";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/silgraphite/silgraphite/${version}/${name}.tar.gz";
+    sha256 = "9b07c6e91108b1fa87411af4a57e25522784cfea0deb79b34ced608444f2ed65";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ freetype libXft pango fontconfig];
+
+  NIX_CFLAGS_COMPILE = "-I${freetype.dev}/include/freetype2";
+
+  meta = {
+    description = "An advanced font engine";
+    maintainers = [ stdenv.lib.maintainers.raskin ];
+    platforms = stdenv.lib.platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/silgraphite/graphite2.nix b/nixpkgs/pkgs/development/libraries/silgraphite/graphite2.nix
new file mode 100644
index 000000000000..f795dfef9e4c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/silgraphite/graphite2.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchurl, pkgconfig, freetype, cmake, python }:
+
+stdenv.mkDerivation rec {
+  version = "1.3.6";
+  name = "graphite2-${version}";
+
+  src = fetchurl {
+    url = "https://github.com/silnrsi/graphite/releases/download/"
+      + "${version}/graphite-${version}.tgz";
+    sha256 = "0xdg6bc02bl8yz39l5i2skczfg17q4lif0qqan0dhvk0mibpcpj7";
+  };
+
+  nativeBuildInputs = [ pkgconfig cmake ];
+  buildInputs = [ freetype ];
+
+  patches = stdenv.lib.optionals stdenv.isDarwin [ ./macosx.patch ];
+
+  checkInputs = [ python ];
+  doCheck = false; # fails, probably missing something
+
+  meta = with stdenv.lib; {
+    description = "An advanced font engine";
+    maintainers = [ maintainers.raskin ];
+    platforms = platforms.unix;
+    license = licenses.lgpl21;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/silgraphite/macosx.patch b/nixpkgs/pkgs/development/libraries/silgraphite/macosx.patch
new file mode 100644
index 000000000000..7929c1967c82
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/silgraphite/macosx.patch
@@ -0,0 +1,13 @@
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -102,7 +102,8 @@ set_target_properties(graphite2 PROPERTIES  PUBLIC_HEADER "${GRAPHITE_HEADERS}"
+                                             VERSION ${GRAPHITE_VERSION}
+                                             LT_VERSION_CURRENT ${GRAPHITE_API_CURRENT}
+                                             LT_VERSION_REVISION ${GRAPHITE_API_REVISION}
+-                                            LT_VERSION_AGE ${GRAPHITE_API_AGE})
++                                            LT_VERSION_AGE ${GRAPHITE_API_AGE}
++                                            INSTALL_NAME_DIR ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX})
+ 
+ if (${CMAKE_BUILD_TYPE} STREQUAL "ClangASN")
+     set(GRAPHITE_LINK_FLAGS "-fsanitize=address")
+
diff --git a/nixpkgs/pkgs/development/libraries/simgear/default.nix b/nixpkgs/pkgs/development/libraries/simgear/default.nix
new file mode 100644
index 000000000000..11612eeb2884
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/simgear/default.nix
@@ -0,0 +1,30 @@
+{ stdenv, fetchurl, plib, freeglut, xorgproto, libX11, libXext, libXi
+, libICE, libSM, libXt, libXmu, libGLU_combined, boost, zlib, libjpeg, freealut
+, openscenegraph, openal, expat, cmake, apr
+, curl
+}:
+
+stdenv.mkDerivation rec {
+  name = "simgear-${version}";
+  version = "2018.3.1";
+  shortVersion = "2018.3";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/flightgear/release-${shortVersion}/${name}.tar.bz2";
+    sha256 = "0sm0v8v1sw5xzkzhf0gzh6fwx93hd62h5lm9s9hgci40x7480i99";
+  };
+
+  buildInputs = [ plib freeglut xorgproto libX11 libXext libXi
+                  libICE libSM libXt libXmu libGLU_combined boost zlib libjpeg freealut
+                  openscenegraph openal expat cmake apr curl ];
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    description = "Simulation construction toolkit";
+    homepage = https://gitorious.org/fg/simgear;
+    maintainers = with maintainers; [ raskin ];
+    platforms = platforms.linux;
+    license = licenses.lgpl2;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/simpleitk/default.nix b/nixpkgs/pkgs/development/libraries/simpleitk/default.nix
new file mode 100644
index 000000000000..90dfe8ebfab8
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/simpleitk/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchurl, cmake, git, swig, lua, itk }:
+
+stdenv.mkDerivation rec {
+  pname    = "simpleitk";
+  version = "1.2.0";
+  name  = "${pname}-${version}";
+
+  src = fetchurl {
+    url    = "https://sourceforge.net/projects/${pname}/files/SimpleITK/${version}/Source/SimpleITK-${version}.tar.gz";
+    sha256 = "10lxsr0144li6bmfgs646cvczczqkgmvvs3ndds66q8lg9zwbnky";
+  };
+
+  nativeBuildInputs = [ cmake git swig ];
+  buildInputs = [ lua itk ];
+
+  cmakeFlags = [ "-DBUILD_SHARED_LIBS=ON" "-DCMAKE_CXX_FLAGS='-Wno-attributes'" ];
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    homepage = http://www.simpleitk.org;
+    description = "Simplified interface to ITK";
+    maintainers = with maintainers; [ bcdarwin ];
+    platforms = platforms.unix;
+    license = licenses.asl20;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/skalibs/default.nix b/nixpkgs/pkgs/development/libraries/skalibs/default.nix
new file mode 100644
index 000000000000..e56d677e8a46
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/skalibs/default.nix
@@ -0,0 +1,30 @@
+{ stdenv, skawarePackages }:
+
+with skawarePackages;
+
+buildPackage {
+  pname = "skalibs";
+  version = "2.8.0.0";
+  sha256 = "06hyiq68jh32qwr2mydw3dbnm4zzpynnnmprd5g4iqavsycyvh53";
+
+  description = "A set of general-purpose C programming libraries";
+
+  outputs = [ "lib" "dev" "doc" "out" ];
+
+  configureFlags = [
+    # assume /dev/random works
+    "--enable-force-devr"
+    "--libdir=\${lib}/lib"
+    "--dynlibdir=\${lib}/lib"
+    "--includedir=\${dev}/include"
+    "--sysdepdir=\${lib}/lib/skalibs/sysdeps"
+  ];
+
+  postInstall = ''
+    rm -rf sysdeps.cfg
+    rm libskarnet.*
+
+    mv doc $doc/share/doc/skalibs/html
+  '';
+
+}
diff --git a/nixpkgs/pkgs/development/libraries/slang/default.nix b/nixpkgs/pkgs/development/libraries/slang/default.nix
new file mode 100644
index 000000000000..f868f6bd4947
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/slang/default.nix
@@ -0,0 +1,50 @@
+{ stdenv, fetchurl, ncurses, pcre, libpng, zlib, readline, libiconv }:
+
+stdenv.mkDerivation rec {
+  name = "slang-2.3.2";
+  src = fetchurl {
+    url = "https://www.jedsoft.org/releases/slang/${name}.tar.bz2";
+    sha256 = "06p379fqn6w38rdpqi98irxi2bf4llb0rja3dlgkqz7nqh7kp7pw";
+  };
+
+  outputs = [ "out" "dev" "man" "doc" ];
+
+  patches = [ ./terminfo-dirs.patch ];
+
+  # Fix some wrong hardcoded paths
+  preConfigure = ''
+    sed -i -e "s|/usr/lib/terminfo|${ncurses.out}/lib/terminfo|" configure
+    sed -i -e "s|/usr/lib/terminfo|${ncurses.out}/lib/terminfo|" src/sltermin.c
+    sed -i -e "s|/bin/ln|ln|" src/Makefile.in
+    sed -i -e "s|-ltermcap|-lncurses|" ./configure
+  '';
+
+  configureFlags = [
+    "--with-png=${libpng.dev}"
+    "--with-z=${zlib.dev}"
+    "--with-pcre=${pcre.dev}"
+    "--with-readline=${readline.dev}"
+  ];
+
+  buildInputs = [
+    pcre libpng zlib readline
+  ] ++ stdenv.lib.optionals (stdenv.isDarwin) [ libiconv ];
+
+  propagatedBuildInputs = [ ncurses ];
+
+  # slang 2.3.2 does not support parallel building
+  enableParallelBuilding = false;
+
+  postInstall = ''
+    find "$out"/lib/ -name '*.so' -exec chmod +x "{}" \;
+    sed '/^Libs:/s/$/ -lncurses/' -i "$dev"/lib/pkgconfig/slang.pc
+  '';
+
+  meta = with stdenv.lib; {
+    description = "A multi-platform programmer's library designed to allow a developer to create robust software";
+    homepage = http://www.jedsoft.org/slang/;
+    license = licenses.gpl2Plus;
+    maintainers = with maintainers; [ fuuzetsu ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/slang/terminfo-dirs.patch b/nixpkgs/pkgs/development/libraries/slang/terminfo-dirs.patch
new file mode 100644
index 000000000000..2229b759a3d4
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/slang/terminfo-dirs.patch
@@ -0,0 +1,172 @@
+commit c7aa0c07b6522fbbb47ef47bd22f47f1611e7423
+Author: John E. Davis <jed@jedsoft.org>
+Date:   Wed Nov 28 00:46:28 2018 -0500
+
+    pre2.3.3-5: Added support for TERMINFO_DIRS env var
+
+Modified: removed changes to changelog and version number.
+
+diff --git a/src/sltermin.c b/src/sltermin.c
+index a06d0e4..65d3bbc 100644
+--- a/src/sltermin.c
++++ b/src/sltermin.c
+@@ -133,6 +133,9 @@ static FILE *open_terminfo (char *file, SLterminfo_Type *h)
+    unsigned char buf[12];
+    int magic;
+ 
++#ifdef SLANG_UNTIC
++   (void) fprintf (stdout,"# Trying %s\n", file);
++#endif
+    /* Alan Cox reported a security problem here if the application using the
+     * library is setuid.  So, I need to make sure open the file as a normal
+     * user.  Unfortunately, there does not appear to be a portable way of
+@@ -269,10 +272,73 @@ static char *read_string_table (FILE *fp, SLterminfo_Type *t)
+  * are implemented by multiple links to the same compiled file.
+  */
+ 
++static FILE *try_open_tidir (SLterminfo_Type *ti, const char *tidir, const char *term)
++{
++   char file[1024];
++
++   if (sizeof (file) > strlen (tidir) + 5 + strlen (term))
++     {
++	FILE *fp;
++
++	sprintf (file, "%s/%c/%s", tidir, *term, term);
++	if (NULL != (fp = open_terminfo (file, ti)))
++	  return fp;
++
++	sprintf (file, "%s/%02x/%s", tidir, (unsigned char)*term, term);
++	if (NULL != (fp = open_terminfo (file, ti)))
++	  return fp;
++     }
++
++   return NULL;
++}
++
++static FILE *try_open_env (SLterminfo_Type *ti, const char *term, const char *envvar)
++{
++   char *tidir;
++
++   if (NULL == (tidir = _pSLsecure_getenv (envvar)))
++     return NULL;
++
++   return try_open_tidir (ti, tidir, term);
++}
++
++static FILE *try_open_home (SLterminfo_Type *ti, const char *term)
++{
++   char home_ti[1024];
++   char *env;
++
++   if (NULL == (env = _pSLsecure_getenv ("HOME")))
++     return NULL;
++
++   strncpy (home_ti, env, sizeof (home_ti) - 11);
++   home_ti [sizeof(home_ti) - 11] = 0;
++   strcat (home_ti, "/.terminfo");
++
++   return try_open_tidir (ti, home_ti, term);
++}
++
++static FILE *try_open_env_path (SLterminfo_Type *ti, const char *term, const char *envvar)
++{
++   char tidir[1024];
++   char *env;
++   unsigned int i;
++
++   if (NULL == (env = _pSLsecure_getenv (envvar)))
++     return NULL;
++
++   i = 0;
++   while (-1 != SLextract_list_element (env, i, ':', tidir, sizeof(tidir)))
++     {
++	FILE *fp = try_open_tidir (ti, tidir, term);
++	if (fp != NULL) return fp;
++	i++;
++     }
++
++   return NULL;
++}
++
+ static SLCONST char *Terminfo_Dirs [] =
+ {
+-   "", /* $TERMINFO */
+-   "", /* $HOME/.terminfo */
+ #ifdef MISC_TERMINFO_DIRS
+    MISC_TERMINFO_DIRS,
+ #endif
+@@ -287,6 +353,23 @@ static SLCONST char *Terminfo_Dirs [] =
+    NULL,
+ };
+ 
++static FILE *try_open_hardcoded (SLterminfo_Type *ti, const char *term)
++{
++   const char *tidir, **tidirs;
++
++   tidirs = Terminfo_Dirs;
++   while (NULL != (tidir = *tidirs++))
++     {
++	FILE *fp;
++
++	if ((*tidir != 0)
++	    && (NULL != (fp = try_open_tidir (ti, tidir, term))))
++	  return fp;
++     }
++
++   return NULL;
++}
++
+ void _pSLtt_tifreeent (SLterminfo_Type *t)
+ {
+    if (t == NULL)
+@@ -305,11 +388,7 @@ void _pSLtt_tifreeent (SLterminfo_Type *t)
+ 
+ SLterminfo_Type *_pSLtt_tigetent (SLCONST char *term)
+ {
+-   SLCONST char **tidirs, *tidir;
+    FILE *fp = NULL;
+-   char file[1024];
+-   static char home_ti [1024];
+-   char *env;
+    SLterminfo_Type *ti;
+ 
+    if (
+@@ -341,33 +420,10 @@ SLterminfo_Type *_pSLtt_tigetent (SLCONST char *term)
+    /* If we are on a termcap based system, use termcap */
+    if (0 == tcap_getent (term, ti)) return ti;
+ 
+-   if (NULL != (env = _pSLsecure_getenv ("TERMINFO")))
+-     Terminfo_Dirs[0] = env;
+-
+-   if (NULL != (env = _pSLsecure_getenv ("HOME")))
+-     {
+-	strncpy (home_ti, env, sizeof (home_ti) - 11);
+-	home_ti [sizeof(home_ti) - 11] = 0;
+-	strcat (home_ti, "/.terminfo");
+-	Terminfo_Dirs [1] = home_ti;
+-     }
+-
+-   tidirs = Terminfo_Dirs;
+-   while (NULL != (tidir = *tidirs++))
+-     {
+-	if (*tidir == 0)
+-	  continue;
+-
+-	if (sizeof (file) > strlen (tidir) + 5 + strlen (term))
+-	  {
+-	     sprintf (file, "%s/%c/%s", tidir, *term, term);
+-	     if (NULL != (fp = open_terminfo (file, ti)))
+-	       break;
+-	     sprintf (file, "%s/%02x/%s", tidir, (unsigned char)*term, term);
+-	     if (NULL != (fp = open_terminfo (file, ti)))
+-	       break;
+-	  }
+-     }
++   fp = try_open_env_path (ti, term, "TERMINFO_DIRS");
++   if (fp == NULL) fp = try_open_env (ti, term, "TERMINFO");
++   if (fp == NULL) fp = try_open_home (ti, term);
++   if (fp == NULL) fp = try_open_hardcoded (ti, term);
+ 
+ #ifdef SLANG_UNTIC
+    fp_open_label:
diff --git a/nixpkgs/pkgs/development/libraries/slib/catalog-in-library-vicinity.patch b/nixpkgs/pkgs/development/libraries/slib/catalog-in-library-vicinity.patch
new file mode 100644
index 000000000000..9b803a35fbdd
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/slib/catalog-in-library-vicinity.patch
@@ -0,0 +1,29 @@
+Write the catalog in under `(library-vicinity)', which is a subdir of $out,
+rather than under `(implementation-vicinity)', which is a subdir of ${scheme}.
+
+The downside is that we can't build an SLIB for several Schemes at the
+same time.
+
+--- slib/mklibcat.scm	2007-12-24 05:47:34.000000000 +0100
++++ slib/mklibcat.scm	2009-09-29 14:08:28.000000000 +0200
+@@ -17,7 +17,7 @@
+ ;promotional, or sales literature without prior written consent in
+ ;each case.
+ 
+-(let ((catpath (in-vicinity (implementation-vicinity) "slibcat")))
++(let ((catpath (in-vicinity (library-vicinity) "slibcat")))
+   (and (file-exists? catpath) (delete-file catpath))
+   (call-with-output-file catpath
+     (lambda (op)
+
+--- slib/require.scm	2009-08-03 04:09:47.000000000 +0200
++++ slib/require.scm	2009-09-29 14:13:56.000000000 +0200
+@@ -74,7 +74,7 @@
+ 
+ (define (catalog:get feature)
+   (if (not *catalog*)
+-      (let ((slibcat (catalog:try-read (implementation-vicinity) "slibcat")))
++      (let ((slibcat (catalog:try-read (library-vicinity) "slibcat")))
+ 	(cond ((not (catalog/require-version-match? slibcat))
+ 	       (slib:load-source (in-vicinity (library-vicinity) "mklibcat"))
+ 	       (set! slibcat
diff --git a/nixpkgs/pkgs/development/libraries/slib/default.nix b/nixpkgs/pkgs/development/libraries/slib/default.nix
new file mode 100644
index 000000000000..665f025ffcf3
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/slib/default.nix
@@ -0,0 +1,52 @@
+{ fetchurl, stdenv, unzip, scheme, texinfo }:
+
+stdenv.mkDerivation rec {
+  name = "slib-3b5";
+
+  src = fetchurl {
+    url = "https://groups.csail.mit.edu/mac/ftpdir/scm/${name}.zip";
+    sha256 = "0q0p2d53p8qw2592yknzgy2y1p5a9k7ppjx0cfrbvk6242c4mdpq";
+  };
+
+  patches = [ ./catalog-in-library-vicinity.patch ];
+
+  buildInputs = [ unzip scheme texinfo ];
+
+  postInstall = ''
+    ln -s mklibcat{.scm,}
+    SCHEME_LIBRARY_PATH="$out/lib/slib" make catalogs
+
+    sed -i "$out/bin/slib" \
+        -e "/^SCHEME_LIBRARY_PATH/i export PATH=\"${scheme}/bin:\$PATH\""
+  '';
+
+  # There's no test suite (?!).
+  doCheck = false;
+
+  setupHook = ./setup-hook.sh;
+
+  meta = {
+    description = "The SLIB Portable Scheme Library";
+
+    longDescription = ''
+      SLIB is a portable library for the programming language Scheme.  It
+      provides a platform independent framework for using packages of Scheme
+      procedures and syntax.  As distributed, SLIB contains useful packages
+      for all Scheme implementations.  Its catalog can be transparently
+      extended to accommodate packages specific to a site, implementation,
+      user, or directory.
+
+      SLIB supports Bigloo, Chez, ELK 3.0, Gambit 4.0, Guile, JScheme, Kawa,
+      Larceny, MacScheme, MIT/GNU Scheme, Pocket Scheme, RScheme, scheme->C,
+      Scheme48, SCM, SCM Mac, scsh, sisc, Stk, T3.1, umb-scheme, and VSCM.
+    '';
+
+    # Public domain + permissive (non-copyleft) licensing of some files.
+    license = stdenv.lib.licenses.publicDomain;
+
+    homepage = http://people.csail.mit.edu/jaffer/SLIB;
+
+    maintainers = [ ];
+    platforms = stdenv.lib.platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/slib/setup-hook.sh b/nixpkgs/pkgs/development/libraries/slib/setup-hook.sh
new file mode 100644
index 000000000000..3c7e91e81886
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/slib/setup-hook.sh
@@ -0,0 +1,13 @@
+addSlibPath () {
+    if test -f "$1/lib/slib/slibcat"
+    then
+	export SCHEME_LIBRARY_PATH="$1/lib/slib/"
+	echo "SLIB found in \`$1'; setting \$SCHEME_LIBRARY_PATH to \`$SCHEME_LIBRARY_PATH'"
+
+	# This is needed so that `(load-from-path "slib/guile.init")' works.
+	export GUILE_LOAD_PATH="$1/lib:$GUILE_LOAD_PATH"
+	echo "SLIB: setting \$GUILE_LOAD_PATH to \`$GUILE_LOAD_PATH'"
+    fi
+}
+
+addEnvHooks "$hostOffset" addSlibPath
diff --git a/nixpkgs/pkgs/development/libraries/smarty3-i18n/default.nix b/nixpkgs/pkgs/development/libraries/smarty3-i18n/default.nix
new file mode 100644
index 000000000000..941e75b8ba92
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/smarty3-i18n/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchFromGitHub, ... }: stdenv.mkDerivation rec {
+  name = "smarty-i18n-${version}";
+  version = "1.0";
+
+  src = fetchFromGitHub {
+    owner = "kikimosha";
+    repo = "smarty3-i18n";
+    rev = "${version}";
+    sha256 = "0rjxq4wka73ayna3hb5dxc5pgc8bw8p5fy507yc6cv2pl4h4nji2";
+  };
+
+  installPhase = ''
+    mkdir $out
+    cp block.t.php $out
+  '';
+
+  meta = with stdenv.lib; {
+    description = "gettext for the smarty3 framework";
+    license = licenses.lgpl21;
+    homepage = https://github.com/kikimosha/smarty3-i18n;
+    maintainers = with maintainers; [ das_j ];
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/smarty3/default.nix b/nixpkgs/pkgs/development/libraries/smarty3/default.nix
new file mode 100644
index 000000000000..66bfd601a62d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/smarty3/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchFromGitHub, ... }: stdenv.mkDerivation rec {
+  name = "smarty3-${version}";
+  version = "3.1.33";
+
+  src = fetchFromGitHub {
+    owner = "smarty-php";
+    repo = "smarty";
+    rev = "v${version}";
+    sha256 = "12kll8nv4b90nlx3y0213lsncqw2ydshjx4g6dv7jah6j1pv29ix";
+  };
+
+  installPhase = ''
+    mkdir $out
+    cp -r libs/* $out
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Smarty 3 template engine";
+    longDescription = ''
+      Smarty is a template engine for PHP, facilitating the
+      separation of presentation (HTML/CSS) from application
+      logic. This implies that PHP code is application
+      logic, and is separated from the presentation.
+    '';
+    homepage = https://www.smarty.net;
+    license = licenses.lgpl21Plus;
+    maintainers = with maintainers; [ das_j ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/smesh/default.nix b/nixpkgs/pkgs/development/libraries/smesh/default.nix
new file mode 100644
index 000000000000..529f910c35ae
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/smesh/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchFromGitHub, cmake, ninja, opencascade }:
+
+stdenv.mkDerivation rec {
+  pname = "smesh";
+  version = "6.7.6";
+
+  src = fetchFromGitHub {
+    owner = "tpaviot";
+    repo = "smesh";
+    rev = version;
+    sha256 = "1b07j3bw3lnxk8dk3x1kkl2mbsmfwi98si84054038lflaaijzi0";
+  };
+
+  nativeBuildInputs = [ cmake ninja ];
+  buildInputs = [ opencascade ];
+
+  meta = with stdenv.lib; {
+    description = "Extension to OCE providing advanced meshing features";
+    homepage = "https://github.com/tpaviot/smesh";
+    license = licenses.lgpl21;
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ gebner ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/smpeg/default.nix b/nixpkgs/pkgs/development/libraries/smpeg/default.nix
new file mode 100644
index 000000000000..35d5075a949a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/smpeg/default.nix
@@ -0,0 +1,50 @@
+{ stdenv, fetchsvn, SDL, autoconf, automake, libtool, gtk2, m4, pkgconfig, libGLU_combined, makeWrapper }:
+
+stdenv.mkDerivation rec {
+  name = "smpeg-svn${version}";
+  version = "390";
+
+  src = fetchsvn {
+    url = svn://svn.icculus.org/smpeg/trunk;
+    rev = version;
+    sha256 = "0ynwn7ih5l2b1kpzpibns9bb9wzfjak7mgrb1ji0dkn2q5pv6lr0";
+  };
+
+  patches = [
+    ./format.patch
+    ./gcc6.patch
+  ];
+
+  enableParallelBuilding = true;
+
+  buildInputs = [ SDL gtk2 libGLU_combined ];
+
+  nativeBuildInputs = [ autoconf automake libtool m4 pkgconfig makeWrapper ];
+
+  preConfigure = ''
+    touch NEWS AUTHORS ChangeLog
+    sh autogen.sh
+  '';
+
+  postInstall = ''
+    sed -i -e 's,"SDL.h",<SDL/SDL.h>,' \
+    -e 's,"SDL_mutex.h",<SDL/SDL_mutex.h>,' \
+    -e 's,"SDL_audio.h",<SDL/SDL_audio.h>,' \
+    -e 's,"SDL_thread.h",<SDL/SDL_thread.h>,' \
+    -e 's,"SDL_types.h",<SDL/SDL_types.h>,' \
+      $out/include/smpeg/*.h
+
+    wrapProgram $out/bin/smpeg-config \
+      --prefix PATH ":" "${pkgconfig}/bin" \
+      --prefix PKG_CONFIG_PATH ":" "${SDL.dev}/lib/pkgconfig"
+  '';
+
+  NIX_LDFLAGS = [ "-lX11" ];
+
+  meta = {
+    homepage = http://icculus.org/smpeg/;
+    description = "MPEG decoding library";
+    license = stdenv.lib.licenses.gpl2Plus;
+    platforms = stdenv.lib.platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/smpeg/format.patch b/nixpkgs/pkgs/development/libraries/smpeg/format.patch
new file mode 100644
index 000000000000..8486dee5cda4
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/smpeg/format.patch
@@ -0,0 +1,11 @@
+--- a/plaympeg.c	2014-09-04 08:55:10.646132150 +0200
++++ b/plaympeg.c	2014-09-04 08:56:57.465210820 +0200
+@@ -262,7 +262,7 @@
+       answer[i] = c;
+     }
+     answer[i] = 0;
+-    fprintf(stderr, answer + 4);
++    fprintf(stderr, "%s", answer + 4);
+   }
+   while(answer[3] == '-');
+ 
diff --git a/nixpkgs/pkgs/development/libraries/smpeg/gcc6.patch b/nixpkgs/pkgs/development/libraries/smpeg/gcc6.patch
new file mode 100644
index 000000000000..165feb4428c2
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/smpeg/gcc6.patch
@@ -0,0 +1,33 @@
+--- a/audio/hufftable.cpp
++++ b/audio/hufftable.cpp
+@@ -9,6 +9,7 @@
+ #include "config.h"
+ #endif
+ 
++#include <climits>
+ #include "MPEGaudio.h"
+ 
+ static const unsigned int
+@@ -550,11 +551,11 @@ htd33[ 31][2]={{ 16,  1},{  8,  1},{  4,
+ 
+ const HUFFMANCODETABLE MPEGaudio::ht[HTN]=
+ {
+-  { 0, 0-1, 0-1, 0,  0, htd33},
++  { 0, UINT_MAX, UINT_MAX, 0,  0, htd33},
+   { 1, 2-1, 2-1, 0,  7,htd01},
+   { 2, 3-1, 3-1, 0, 17,htd02},
+   { 3, 3-1, 3-1, 0, 17,htd03},
+-  { 4, 0-1, 0-1, 0,  0, htd33},
++  { 4, UINT_MAX, UINT_MAX, 0,  0, htd33},
+   { 5, 4-1, 4-1, 0, 31,htd05},
+   { 6, 4-1, 4-1, 0, 31,htd06},
+   { 7, 6-1, 6-1, 0, 71,htd07},
+@@ -564,7 +565,7 @@ const HUFFMANCODETABLE MPEGaudio::ht[HTN
+   {11, 8-1, 8-1, 0,127,htd11},
+   {12, 8-1, 8-1, 0,127,htd12},
+   {13,16-1,16-1, 0,511,htd13},
+-  {14, 0-1, 0-1, 0,  0, htd33},
++  {14, UINT_MAX, UINT_MAX, 0,  0, htd33},
+   {15,16-1,16-1, 0,511,htd15},
+   {16,16-1,16-1, 1,511,htd16},
+   {17,16-1,16-1, 2,511,htd16},
diff --git a/nixpkgs/pkgs/development/libraries/smpeg2/default.nix b/nixpkgs/pkgs/development/libraries/smpeg2/default.nix
new file mode 100644
index 000000000000..900437864717
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/smpeg2/default.nix
@@ -0,0 +1,44 @@
+{ stdenv, darwin, fetchsvn, autoconf, automake, pkgconfig, makeWrapper, SDL2 }:
+
+stdenv.mkDerivation rec {
+  name = "smpeg2-svn${version}";
+  version = "412";
+
+  src = fetchsvn {
+    url = svn://svn.icculus.org/smpeg/trunk;
+    rev = version;
+    sha256 = "1irf2d8f150j8cx8lbb0pz1rijap536crsz0mw871xrh6wd2fd96";
+  };
+
+  patches = [
+    ./gcc6.patch
+    ./sdl2.patch
+  ];
+
+  nativeBuildInputs = [ autoconf automake pkgconfig makeWrapper ];
+
+  buildInputs = [ SDL2 ]
+    ++ stdenv.lib.optional stdenv.isDarwin darwin.libobjc;
+
+  preConfigure = ''
+    sh autogen.sh
+  '';
+
+  postInstall = ''
+    sed -e 's,#include "\(SDL.*.h\)",#include <SDL2/\1>,' -i $out/include/smpeg2/*.h
+
+    wrapProgram $out/bin/smpeg2-config \
+      --prefix PATH ":" "${pkgconfig}/bin" \
+      --prefix PKG_CONFIG_PATH ":" "${SDL2.dev}/lib/pkgconfig"
+  '';
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    homepage = http://icculus.org/smpeg/;
+    description = "SDL2 MPEG Player Library";
+    license = licenses.lgpl2;
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ orivej ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/smpeg2/gcc6.patch b/nixpkgs/pkgs/development/libraries/smpeg2/gcc6.patch
new file mode 100644
index 000000000000..165feb4428c2
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/smpeg2/gcc6.patch
@@ -0,0 +1,33 @@
+--- a/audio/hufftable.cpp
++++ b/audio/hufftable.cpp
+@@ -9,6 +9,7 @@
+ #include "config.h"
+ #endif
+ 
++#include <climits>
+ #include "MPEGaudio.h"
+ 
+ static const unsigned int
+@@ -550,11 +551,11 @@ htd33[ 31][2]={{ 16,  1},{  8,  1},{  4,
+ 
+ const HUFFMANCODETABLE MPEGaudio::ht[HTN]=
+ {
+-  { 0, 0-1, 0-1, 0,  0, htd33},
++  { 0, UINT_MAX, UINT_MAX, 0,  0, htd33},
+   { 1, 2-1, 2-1, 0,  7,htd01},
+   { 2, 3-1, 3-1, 0, 17,htd02},
+   { 3, 3-1, 3-1, 0, 17,htd03},
+-  { 4, 0-1, 0-1, 0,  0, htd33},
++  { 4, UINT_MAX, UINT_MAX, 0,  0, htd33},
+   { 5, 4-1, 4-1, 0, 31,htd05},
+   { 6, 4-1, 4-1, 0, 31,htd06},
+   { 7, 6-1, 6-1, 0, 71,htd07},
+@@ -564,7 +565,7 @@ const HUFFMANCODETABLE MPEGaudio::ht[HTN
+   {11, 8-1, 8-1, 0,127,htd11},
+   {12, 8-1, 8-1, 0,127,htd12},
+   {13,16-1,16-1, 0,511,htd13},
+-  {14, 0-1, 0-1, 0,  0, htd33},
++  {14, UINT_MAX, UINT_MAX, 0,  0, htd33},
+   {15,16-1,16-1, 0,511,htd15},
+   {16,16-1,16-1, 1,511,htd16},
+   {17,16-1,16-1, 2,511,htd16},
diff --git a/nixpkgs/pkgs/development/libraries/smpeg2/sdl2.patch b/nixpkgs/pkgs/development/libraries/smpeg2/sdl2.patch
new file mode 100644
index 000000000000..63bc352976ec
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/smpeg2/sdl2.patch
@@ -0,0 +1,22 @@
+diff --git a/smpeg2-config.in b/smpeg2-config.in
+index 5cce954..0e61939 100644
+--- a/smpeg2-config.in
++++ b/smpeg2-config.in
+@@ -42,7 +42,7 @@ while test $# -gt 0; do
+       if test @includedir@ != /usr/include ; then
+         includes=-I@includedir@
+       fi
+-      echo $includes -I@includedir@/smpeg2 `@SDL_CONFIG@ --cflags`
++      echo $includes -I@includedir@/smpeg2 `@SDL2_CONFIG@ --cflags`
+       ;;
+     --libs)
+       if [ "`uname`" = "SunOS" ]; then
+@@ -50,7 +50,7 @@ while test $# -gt 0; do
+       else
+         libdirs="-L@libdir@ @SMPEG_RLD_FLAGS@"
+       fi
+-      echo $libdirs -lsmpeg2 `@SDL_CONFIG@ --libs`
++      echo $libdirs -lsmpeg2 `@SDL2_CONFIG@ --libs`
+       ;;
+     *)
+       echo "${usage}" 1>&2
diff --git a/nixpkgs/pkgs/development/libraries/snack/default.nix b/nixpkgs/pkgs/development/libraries/snack/default.nix
new file mode 100644
index 000000000000..acf10cc497c8
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/snack/default.nix
@@ -0,0 +1,35 @@
+# alsaLib vorbis-tools python can be made optional
+
+{ stdenv, fetchurl, python, tcl, tk, vorbis-tools, pkgconfig, xlibsWrapper }:
+
+stdenv.mkDerivation {
+  name = "snack-2.2.10";
+
+  src = fetchurl {
+    url = https://www.speech.kth.se/snack/dist/snack2.2.10.tar.gz;
+    sha256 = "07p89jv9qnjqkszws9sssq93ayvwpdnkcxrvyicbm4mb8x2pdzjb";
+  };
+
+  configureFlags = [ "--with-tcl=${tcl}/lib" "--with-tk=${tk}/lib" ];
+
+  postUnpack = ''sourceRoot="$sourceRoot/unix"'';
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ python tcl tk vorbis-tools xlibsWrapper ];
+
+  hardeningDisable = [ "format" ];
+
+  postInstall = "aoeu";
+
+  installPhase = ''
+    mkdir -p $out
+    make install DESTDIR="$out" 
+  '';
+
+  meta = { 
+    description = "The Snack Sound Toolkit (Tcl)";
+    homepage = http://www.speech.kth.se/snack/;
+    license = stdenv.lib.licenses.gpl2;
+    broken = true;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/snappy/default.nix b/nixpkgs/pkgs/development/libraries/snappy/default.nix
new file mode 100644
index 000000000000..36077d71126a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/snappy/default.nix
@@ -0,0 +1,37 @@
+{ stdenv, fetchFromGitHub, cmake }:
+
+stdenv.mkDerivation rec {
+  name = "snappy-${version}";
+  version = "1.1.7";
+
+  src = fetchFromGitHub {
+    owner = "google";
+    repo = "snappy";
+    rev = "${version}";
+    sha256 = "1x7r8sjmdqlqjz0xfiwdyrqpgaj5yrvrgb28ivgpvnxgar5qv6m2";
+  };
+
+  patches = [ ./disable-benchmark.patch ];
+
+  outputs = [ "out" "dev" ];
+
+  nativeBuildInputs = [ cmake ];
+
+  cmakeFlags = [ "-DBUILD_SHARED_LIBS=ON" "-DCMAKE_SKIP_BUILD_RPATH=OFF" ];
+
+  postInstall = ''
+    substituteInPlace "$out"/lib/cmake/Snappy/SnappyTargets.cmake \
+      --replace 'INTERFACE_INCLUDE_DIRECTORIES "''${_IMPORT_PREFIX}/include"' 'INTERFACE_INCLUDE_DIRECTORIES "'$dev'"'
+  '';
+
+  checkTarget = "test";
+
+  doCheck = true;
+
+  meta = with stdenv.lib; {
+    homepage = https://google.github.io/snappy/;
+    license = licenses.bsd3;
+    description = "Compression/decompression library for very high speeds";
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/snappy/disable-benchmark.patch b/nixpkgs/pkgs/development/libraries/snappy/disable-benchmark.patch
new file mode 100644
index 000000000000..c891c13fe74c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/snappy/disable-benchmark.patch
@@ -0,0 +1,5 @@
+--- a/snappy-test.cc
++++ b/snappy-test.cc
+@@ -46 +46 @@
+-DEFINE_bool(run_microbenchmarks, true,
++DEFINE_bool(run_microbenchmarks, false,
diff --git a/nixpkgs/pkgs/development/libraries/socket_wrapper/default.nix b/nixpkgs/pkgs/development/libraries/socket_wrapper/default.nix
new file mode 100644
index 000000000000..2903e79f8910
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/socket_wrapper/default.nix
@@ -0,0 +1,19 @@
+{ stdenv, fetchurl, cmake, pkgconfig }:
+
+stdenv.mkDerivation rec {
+  name = "socket_wrapper-1.2.3";
+
+  src = fetchurl {
+    url = "mirror://samba/cwrap/${name}.tar.gz";
+    sha256 = "1jprm8f7xb91b3yrapdbf51l36j6g038n379akz7ds0dicjh0fh7";
+  };
+
+  nativeBuildInputs = [ cmake pkgconfig ];
+
+  meta = with stdenv.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;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/sofia-sip/default.nix b/nixpkgs/pkgs/development/libraries/sofia-sip/default.nix
new file mode 100644
index 000000000000..ca2ff666b7a5
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/sofia-sip/default.nix
@@ -0,0 +1,20 @@
+{ stdenv, fetchurl, glib, openssl, pkgconfig }:
+
+stdenv.mkDerivation rec {
+  name = "sofia-sip-1.12.11";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/sofia-sip/${name}.tar.gz";
+    sha256 = "10bwsdfijpbk9ahlfpk94kzdapxiahl9mljpgwghvq1630pbq09b";
+  };
+
+  buildInputs = [ glib openssl ];
+  nativeBuildInputs = [ pkgconfig ];
+
+  meta = with stdenv.lib; {
+    description = "Open-source SIP User-Agent library, compliant with the IETF RFC3261 specification";
+    homepage = http://sofia-sip.sourceforge.net/;
+    platforms = platforms.linux;
+    license = licenses.lgpl2;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/soil/default.nix b/nixpkgs/pkgs/development/libraries/soil/default.nix
new file mode 100644
index 000000000000..6e30825cfb39
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/soil/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchurl, unzip, mesa_noglu, libX11 }:
+
+stdenv.mkDerivation rec {
+  name = "soil";
+
+  src = fetchurl {
+    url    = "http://www.lonesock.net/files/soil.zip";
+    sha256 = "00gpwp9dldzhsdhksjvmbhsd2ialraqbv6v6dpikdmpncj6mnc52";
+  };
+
+  buildInputs = [ unzip mesa_noglu libX11 ];
+  
+  sourceRoot = "Simple OpenGL Image Library/projects/makefile";
+  preBuild   = "mkdir obj";
+  preInstall = "mkdir -p $out/lib $out/include";
+  makeFlags  = [ "LOCAL=$(out)" ];
+
+  meta = {
+    description     = "Simple OpenGL Image Library";
+    longDescription = ''
+      SOIL is a tiny C library used primarily for uploading textures
+      into OpenGL.
+    '';
+    homepage  = https://www.lonesock.net/soil.html;
+    license   = stdenv.lib.licenses.publicDomain;
+    platforms = stdenv.lib.platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/sonic/default.nix b/nixpkgs/pkgs/development/libraries/sonic/default.nix
new file mode 100644
index 000000000000..48ee1af0e30d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/sonic/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchFromGitHub }:
+
+stdenv.mkDerivation rec {
+  name = "sonic-${version}";
+  version = "2016-03-01";
+
+  src = fetchFromGitHub {
+    owner = "waywardgeek";
+    repo = "sonic";
+    rev = "71bdf26c55716a45af50c667c0335a9519e952dd";
+    sha256 = "1kcl8fdf92kafmfhvyjal5gvkn99brkjyzbi9gw3rd5b30m3xz2b";
+  };
+
+  postPatch = ''
+    sed -i "s,^PREFIX=.*,PREFIX=$out," Makefile
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Simple library to speed up or slow down speech";
+    homepage = https://github.com/waywardgeek/sonic;
+    license = licenses.asl20;
+    maintainers = with maintainers; [ aske ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/soprano/default.nix b/nixpkgs/pkgs/development/libraries/soprano/default.nix
new file mode 100644
index 000000000000..4739c7363979
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/soprano/default.nix
@@ -0,0 +1,26 @@
+{ stdenv, fetchurl, cmake, qt4, clucene_core, librdf_redland, libiodbc
+, pkgconfig }:
+
+stdenv.mkDerivation rec {
+  name = "soprano-2.9.4";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/soprano/${name}.tar.bz2";
+    sha256 = "1rg0x7yg0a1cbnxz7kqk52580wla8jbnj4d4r3j7l7g7ajyny1k4";
+  };
+
+  patches = [ ./find-virtuoso.patch ];
+
+  # We disable the Java backend, since we do not need them and they make the closure size much bigger
+  buildInputs = [ qt4 clucene_core librdf_redland libiodbc ];
+
+  nativeBuildInputs = [ cmake pkgconfig ];
+
+  meta = {
+    homepage = http://soprano.sourceforge.net/;
+    description = "An object-oriented C++/Qt4 framework for RDF data";
+    license = "LGPL";
+    maintainers = with stdenv.lib.maintainers; [ sander ];
+    inherit (qt4.meta) platforms;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/soprano/find-virtuoso.patch b/nixpkgs/pkgs/development/libraries/soprano/find-virtuoso.patch
new file mode 100644
index 000000000000..95a2c7e96565
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/soprano/find-virtuoso.patch
@@ -0,0 +1,86 @@
+From: Yury G. Kudryashov <urkud.urkud@gmail.com>
+Subject: [PATCH] Find virtuoso if virtuoso-t is in PATH
+
+---
+ backends/virtuoso/virtuosobackend.cpp |   31 ++++++++++++++++++++++---------
+ backends/virtuoso/virtuosobackend.h   |    2 +-
+ 2 files changed, 23 insertions(+), 10 deletions(-)
+
+diff --git a/backends/virtuoso/virtuosobackend.cpp b/backends/virtuoso/virtuosobackend.cpp
+index c245101..249958a 100644
+--- a/backends/virtuoso/virtuosobackend.cpp
++++ b/backends/virtuoso/virtuosobackend.cpp
+@@ -28,6 +28,7 @@
+ #include "odbcconnectionpool.h"
+ 
+ #include "sopranodirs.h"
++#include "soprano-config.h"
+ 
+ #include <QtCore/QDebug>
+ #include <QtCore/QtPlugin>
+@@ -210,19 +211,19 @@ Soprano::BackendFeatures Soprano::Virtuoso::BackendPlugin::supportedFeatures() c
+ 
+ bool Soprano::Virtuoso::BackendPlugin::isAvailable() const
+ {
+-#ifndef Q_OS_WIN
+-    if ( findVirtuosoDriver().isEmpty() ) {
+-        qDebug() << Q_FUNC_INFO << "could not find Virtuoso ODBC driver";
+-        return false;
+-    }
+-#endif
+-
+     QString virtuosoBin = locateVirtuosoBinary();
+     if ( virtuosoBin.isEmpty() ) {
+         qDebug() << Q_FUNC_INFO << "could not find virtuoso-t binary";
+         return false;
+     }
+ 
++#ifndef Q_OS_WIN
++    if ( findVirtuosoDriver( virtuosoBin ).isEmpty() ) {
++        qDebug() << Q_FUNC_INFO << "could not find Virtuoso ODBC driver";
++        return false;
++    }
++#endif
++
+     QString vs = determineVirtuosoVersion( virtuosoBin );
+     if ( vs.isEmpty() ) {
+         qDebug() << Q_FUNC_INFO << "Failed to determine version of the Virtuoso server at" << virtuosoBin;
+@@ -267,9 +268,21 @@ QString Soprano::Virtuoso::BackendPlugin::locateVirtuosoBinary()
+ 
+ #ifndef Q_OS_WIN
+ // static
+-QString Soprano::Virtuoso::BackendPlugin::findVirtuosoDriver()
++QString Soprano::Virtuoso::BackendPlugin::findVirtuosoDriver( const QString &virtuosoBinHint )
+ {
+-    return Soprano::findLibraryPath( "virtodbc_r", QStringList(), QStringList() << QLatin1String( "virtuoso/plugins/" ) << QLatin1String( "odbc/" ) );
++    QString virtuosoBin;
++    if (virtuosoBinHint.isEmpty())
++        virtuosoBin = locateVirtuosoBinary();
++    else
++        virtuosoBin = virtuosoBinHint;
++
++    QDir virtuosoBinDir = QFileInfo(virtuosoBin).absoluteDir();
++    return Soprano::findLibraryPath( "virtodbc_r",
++            QStringList()
++			<< virtuosoBinDir.absoluteFilePath("../lib"SOPRANO_LIB_SUFFIX)
++			<< virtuosoBinDir.absoluteFilePath("../lib"),
++            QStringList() << QLatin1String( "virtuoso/plugins/" ) <<
++            QLatin1String( "odbc/" ) );
+ }
+ #endif
+ 
+diff --git a/backends/virtuoso/virtuosobackend.h b/backends/virtuoso/virtuosobackend.h
+index 646b9f8..535fbb9 100644
+--- a/backends/virtuoso/virtuosobackend.h
++++ b/backends/virtuoso/virtuosobackend.h
+@@ -52,7 +52,7 @@ namespace Soprano {
+ 
+ #ifndef Q_OS_WIN
+         private:
+-            static QString findVirtuosoDriver();
++            static QString findVirtuosoDriver(const QString &virtuosoBinHint = QString());
+ #endif
+         };
+     }
+-- 
+tg: (2321148..) t/find-virtuoso (depends on: master)
diff --git a/nixpkgs/pkgs/development/libraries/soqt/default.nix b/nixpkgs/pkgs/development/libraries/soqt/default.nix
new file mode 100644
index 000000000000..9769596621b1
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/soqt/default.nix
@@ -0,0 +1,24 @@
+{ fetchurl, stdenv, coin3d, qt4, pkgconfig }:
+
+stdenv.mkDerivation rec {
+  name = "soqt-${version}";
+  version = "1.5.0";
+
+  src = fetchurl {
+    url = "https://bitbucket.org/Coin3D/coin/downloads/SoQt-${version}.tar.gz";
+    sha256 = "14dbh8ynzjcgwgxjc6530c5plji7vn62kbdf447w0dp53564p8zn";
+  };
+
+  buildInputs = [ coin3d qt4 ];
+
+  nativeBuildInputs = [ pkgconfig ];
+
+  meta = {
+    homepage = https://bitbucket.org/Coin3D/coin/wiki/Home;
+    license = stdenv.lib.licenses.gpl2Plus;
+    description = "Glue between Coin high-level 3D visualization library and Qt";
+
+    maintainers = [ stdenv.lib.maintainers.viric ];
+    platforms = stdenv.lib.platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/sord/default.nix b/nixpkgs/pkgs/development/libraries/sord/default.nix
new file mode 100644
index 000000000000..10258e791ba6
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/sord/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, fetchurl, pkgconfig, python, serd, pcre, wafHook }:
+
+stdenv.mkDerivation rec {
+  name = "sord-${version}";
+  version = "0.16.2";
+
+  src = fetchurl {
+    url = "https://download.drobilla.net/${name}.tar.bz2";
+    sha256 = "13fshxwpipjrvsah1m2jw1kf022z2q5vpw24bzcznglgvms13x89";
+  };
+
+  nativeBuildInputs = [ pkgconfig wafHook ];
+  buildInputs = [ python serd pcre ];
+
+  meta = with stdenv.lib; {
+    homepage = http://drobilla.net/software/sord;
+    description = "A lightweight C library for storing RDF data in memory";
+    license = licenses.mit;
+    maintainers = [ maintainers.goibhniu ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/soundtouch/default.nix b/nixpkgs/pkgs/development/libraries/soundtouch/default.nix
new file mode 100644
index 000000000000..95a97f30b6e6
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/soundtouch/default.nix
@@ -0,0 +1,22 @@
+{stdenv, fetchurl, autoconf, automake, libtool}:
+
+stdenv.mkDerivation rec {
+  pName = "soundtouch";
+  name = "${pName}-2.0.0";
+  src = fetchurl {
+    url = "https://www.surina.net/soundtouch/${name}.tar.gz";
+    sha256 = "09cxr02mfyj2bg731bj0i9hh565x8l9p91aclxs8wpqv8b8zf96j";
+  };
+
+  buildInputs = [ autoconf automake libtool ];
+
+  preConfigure = "./bootstrap";
+
+  meta = {
+      description = "A program and library for changing the tempo, pitch and playback rate of audio";
+      homepage = http://www.surina.net/soundtouch/;
+      downloadPage = http://www.surina.net/soundtouch/sourcecode.html;
+      license = stdenv.lib.licenses.lgpl21;
+      platforms = stdenv.lib.platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/soxt/default.nix b/nixpkgs/pkgs/development/libraries/soxt/default.nix
new file mode 100644
index 000000000000..c219d5bfb362
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/soxt/default.nix
@@ -0,0 +1,21 @@
+{ fetchurl, stdenv, coin3d, motif, xlibsWrapper, libGLU_combined }:
+
+stdenv.mkDerivation rec {
+  name = "soxt-${version}";
+  version = "1.3.0";
+
+  src = fetchurl {
+    url = "https://bitbucket.org/Coin3D/coin/downloads/SoXt-${version}.tar.gz";
+    sha256= "f5443aadafe8e2222b9b5a23d1f228bb0f3e7d98949b8ea8676171b7ea5bf013";
+  };
+
+  buildInputs = [ coin3d motif xlibsWrapper libGLU_combined ];
+
+  meta = with stdenv.lib; {
+    homepage = https://bitbucket.org/Coin3D/coin/wiki/Home;
+    license = licenses.bsd3;
+    description = "A GUI binding for using Open Inventor with Xt/Motif";
+    maintainers = with maintainers; [ tmplt ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/spandsp/default.nix b/nixpkgs/pkgs/development/libraries/spandsp/default.nix
new file mode 100644
index 000000000000..be2fc503e390
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/spandsp/default.nix
@@ -0,0 +1,21 @@
+{stdenv, fetchurl, audiofile, libtiff}:
+stdenv.mkDerivation rec {
+  version = "0.0.6";
+  name = "spandsp-${version}";
+  src=fetchurl {
+    url = "https://www.soft-switch.org/downloads/spandsp/spandsp-${version}.tar.gz";
+    sha256 = "0rclrkyspzk575v8fslzjpgp4y2s4x7xk3r55ycvpi4agv33l1fc";
+  };
+  buildInputs = [];
+  propagatedBuildInputs = [audiofile libtiff];
+  meta = {
+    homepage = http://www.creytiv.com/baresip.html;
+    platforms = with stdenv.lib.platforms; linux;
+    maintainers = with stdenv.lib.maintainers; [raskin];
+    license = stdenv.lib.licenses.gpl2;
+    downloadPage = "http://www.soft-switch.org/downloads/spandsp/";
+    inherit version;
+    updateWalker = true;
+  };
+}
+
diff --git a/nixpkgs/pkgs/development/libraries/sparsehash/default.nix b/nixpkgs/pkgs/development/libraries/sparsehash/default.nix
new file mode 100644
index 000000000000..f898152d820e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/sparsehash/default.nix
@@ -0,0 +1,20 @@
+{ stdenv, fetchFromGitHub }:
+
+stdenv.mkDerivation rec {
+  name = "sparsehash-2.0.3";
+
+  src = fetchFromGitHub {
+    owner = "sparsehash";
+    repo = "sparsehash";
+    rev = name;
+    sha256 = "0m3f0cnpnpf6aak52wn8xbrrdw8p0yhq8csgc8nlvf9zp8c402na";
+  };
+
+  meta = with stdenv.lib; {
+    homepage = https://github.com/sparsehash/sparsehash;
+    description = "An extremely memory-efficient hash_map implementation";
+    platforms = platforms.all;
+    license = licenses.bsd3;
+    maintainers = with maintainers; [ pSub ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/spatialite-tools/default.nix b/nixpkgs/pkgs/development/libraries/spatialite-tools/default.nix
new file mode 100644
index 000000000000..2708e49eb2b6
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/spatialite-tools/default.nix
@@ -0,0 +1,26 @@
+{ stdenv, fetchurl, pkgconfig, sqlite, expat, zlib, proj, geos, libspatialite, readosm }:
+
+stdenv.mkDerivation rec {
+  name = "spatialite-tools-4.1.1";
+
+  src = fetchurl {
+    url = "https://www.gaia-gis.it/gaia-sins/spatialite-tools-sources/${name}.tar.gz";
+    sha256 = "14aqmhvab63ydbb82fglsbig7jw1wmci8jjvci07aavdhvh1pyrv";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ sqlite expat zlib proj geos libspatialite readosm ];
+
+  configureFlags = [ "--disable-freexl" ];
+
+  enableParallelBuilding = true;
+
+  NIX_LDFLAGS = [ "-lsqlite3" ];
+
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/spdk/default.nix b/nixpkgs/pkgs/development/libraries/spdk/default.nix
new file mode 100644
index 000000000000..cab0e69ad1a7
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/spdk/default.nix
@@ -0,0 +1,35 @@
+{ stdenv, fetchFromGitHub, python, cunit, dpdk, libaio, libuuid, numactl, openssl }:
+
+stdenv.mkDerivation rec {
+  name = "spdk-${version}";
+  version = "19.04";
+
+  src = fetchFromGitHub {
+    owner = "spdk";
+    repo = "spdk";
+    rev = "v${version}";
+    sha256 = "10mzal1hspnh26ws5d7sc54gyjfzkf6amr0gkd7b368ng2a9z8s6";
+  };
+
+  nativeBuildInputs = [ python ];
+
+  buildInputs = [ cunit dpdk libaio libuuid numactl openssl ];
+
+  postPatch = ''
+    patchShebangs .
+  '';
+
+  configureFlags = [ "--with-dpdk=${dpdk}" ];
+
+  NIX_CFLAGS_COMPILE = [ "-mssse3" ]; # Necessary to compile.
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    description = "Set of libraries for fast user-mode storage";
+    homepage = "https://spdk.io/";
+    license = licenses.bsd3;
+    platforms =  [ "x86_64-linux" ];
+    maintainers = with maintainers; [ orivej ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/spdlog/default.nix b/nixpkgs/pkgs/development/libraries/spdlog/default.nix
new file mode 100644
index 000000000000..c746925150bb
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/spdlog/default.nix
@@ -0,0 +1,46 @@
+{ stdenv, fetchFromGitHub, cmake }:
+
+let
+  generic = { version, sha256 }:
+    stdenv.mkDerivation {
+      name = "spdlog-${version}";
+      inherit version;
+
+      src = fetchFromGitHub {
+        owner  = "gabime";
+        repo   = "spdlog";
+        rev    = "v${version}";
+        inherit sha256;
+      };
+
+      nativeBuildInputs = [ cmake ];
+
+      cmakeFlags = [ "-DSPDLOG_BUILD_EXAMPLES=OFF" "-DSPDLOG_BUILD_BENCH=OFF" ];
+
+      outputs = [ "out" "doc" ];
+
+      postInstall = ''
+        mkdir -p $out/share/doc/spdlog
+        cp -rv ../example $out/share/doc/spdlog
+      '';
+
+      meta = with stdenv.lib; {
+        description    = "Very fast, header only, C++ logging library.";
+        homepage       = https://github.com/gabime/spdlog;
+        license        = licenses.mit;
+        maintainers    = with maintainers; [ obadz ];
+        platforms      = platforms.all;
+      };
+    };
+in
+{
+  spdlog_1 = generic {
+    version = "1.3.1";
+    sha256 = "1rd4zmrlkcdjx0m0wpmjm1g9srj7jak6ai08qkhbn2lsn0niifzd";
+  };
+
+  spdlog_0 = generic {
+    version = "0.17.0";
+    sha256 = "112kfh4fbpm5cvrmgbgz4d8s802db91mhyjpg7cwhlywffnzkwr9";
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/speech-tools/default.nix b/nixpkgs/pkgs/development/libraries/speech-tools/default.nix
new file mode 100644
index 000000000000..771ad033ed91
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/speech-tools/default.nix
@@ -0,0 +1,49 @@
+{ stdenv, fetchurl, alsaLib, ncurses }:
+
+stdenv.mkDerivation rec {
+  name = "speech_tools-${version}.0";
+  version = "2.5";
+
+  src = fetchurl {
+    url = "http://www.festvox.org/packed/festival/${version}/${name}-release.tar.gz";
+    sha256 = "1k2xh13miyv48gh06rgsq2vj25xwj7z6vwq9ilsn8i7ig3nrgzg4";
+  };
+
+  buildInputs = [ alsaLib ncurses ];
+
+  preConfigure = ''
+    sed -e s@/usr/bin/@@g -i $( grep -rl '/usr/bin/' . )
+    sed -re 's@/bin/(rm|printf|uname)@\1@g' -i $( grep -rl '/bin/' . )
+
+    # c99 makes isnan valid for float and double
+    substituteInPlace include/EST_math.h \
+      --replace '__isnanf(X)' 'isnan(X)'
+  '';
+
+  installPhase = ''
+    mkdir -p "$out"/{bin,lib}
+    for d in bin lib; do
+      for i in ./$d/*; do
+        test "$(basename "$i")" = "Makefile" ||
+          cp -r "$(readlink -f $i)" "$out/$d"
+      done
+    done
+  '';
+
+  doCheck = true;
+
+  checkTarget = "test";
+
+  meta = with stdenv.lib; {
+    description = "Text-to-speech engine";
+    maintainers = with maintainers; [ raskin ];
+    platforms = platforms.linux;
+    license = licenses.free;
+  };
+
+  passthru = {
+    updateInfo = {
+      downloadPage = "http://www.festvox.org/packed/festival/";
+    };
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/speechd/default.nix b/nixpkgs/pkgs/development/libraries/speechd/default.nix
new file mode 100644
index 000000000000..b27fd0843bc0
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/speechd/default.nix
@@ -0,0 +1,81 @@
+{ stdenv, pkgconfig, fetchurl, python3Packages
+, intltool, itstool, libtool, texinfo, autoreconfHook
+, glib, dotconf, libsndfile
+, withLibao ? true, libao
+, withPulse ? false, libpulseaudio
+, withAlsa ? false, alsaLib
+, withOss ? false
+, withFlite ? true, flite
+# , withFestival ? false, festival-freebsoft-utils
+, withEspeak ? true, espeak, sonic, pcaudiolib
+, withPico ? true, svox
+# , withIvona ? false, libdumbtts
+}:
+
+let
+  inherit (stdenv.lib) optional optionals;
+  inherit (python3Packages) python pyxdg wrapPython;
+
+  # speechd hard-codes espeak, even when built without support for it.
+  selectedDefaultModule =
+    if withEspeak then
+      "espeak-ng"
+    else if withPico then
+      "pico"
+    else if withFlite then
+      "flite"
+    else
+      throw "You need to enable at least one output module.";
+in stdenv.mkDerivation rec {
+  name = "speech-dispatcher-${version}";
+  version = "0.8.8";
+
+  src = fetchurl {
+    url = "http://www.freebsoft.org/pub/projects/speechd/${name}.tar.gz";
+    sha256 = "1wvck00w9ixildaq6hlhnf6wa576y02ac96lp6932h3k1n08jaiw";
+  };
+
+  nativeBuildInputs = [ pkgconfig autoreconfHook intltool libtool itstool texinfo wrapPython ];
+
+  buildInputs = [ glib dotconf libsndfile libao libpulseaudio alsaLib python ]
+    ++ optionals withEspeak [ espeak sonic pcaudiolib ]
+    ++ optional withFlite flite
+    ++ optional withPico svox
+    # TODO: add flint/festival support with festival-freebsoft-utils package
+    # ++ optional withFestival festival-freebsoft-utils
+    # TODO: add Ivona support with libdumbtts package
+    # ++ optional withIvona libdumbtts
+  ;
+
+  pythonPath = [ pyxdg ];
+
+  configureFlags = [
+    # Audio method falls back from left to right.
+    "--with-default-audio-method=\"libao,pulse,alsa,oss\""
+  ] ++ optional withPulse "--with-pulse"
+    ++ optional withAlsa "--with-alsa"
+    ++ optional withLibao "--with-libao"
+    ++ optional withOss "--with-oss"
+    ++ optional withEspeak "--with-espeak-ng"
+    ++ optional withPico "--with-pico"
+    # ++ optional withFestival "--with-flint"
+    # ++ optional withIvona "--with-ivona"
+  ;
+
+  postPatch = ''
+    substituteInPlace config/speechd.conf --replace "DefaultModule espeak" "DefaultModule ${selectedDefaultModule}"
+    substituteInPlace src/modules/pico.c --replace "/usr/share/pico/lang" "${svox}/share/pico/lang"
+  '';
+
+  postInstall = ''
+    wrapPythonPrograms
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Common interface to speech synthesis";
+    homepage = https://devel.freebsoft.org/speechd;
+    license = licenses.gpl2Plus;
+    maintainers = with maintainers; [ berce ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/speex/default.nix b/nixpkgs/pkgs/development/libraries/speex/default.nix
new file mode 100644
index 000000000000..7bf3a5faa7d1
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/speex/default.nix
@@ -0,0 +1,33 @@
+{ stdenv, fetchurl, autoreconfHook, pkgconfig, fftw, speexdsp }:
+
+stdenv.mkDerivation rec {
+  name = "speex-1.2.0";
+
+  src = fetchurl {
+    url = "http://downloads.us.xiph.org/releases/speex/${name}.tar.gz";
+    sha256 = "150047wnllz4r94whb9r73l5qf0z5z3rlhy98bawfbblmkq8mbpa";
+  };
+
+  postPatch = ''
+    sed -i '/AC_CONFIG_MACRO_DIR/i PKG_PROG_PKG_CONFIG' configure.ac
+  '';
+
+  outputs = [ "out" "dev" "doc" ];
+
+  nativeBuildInputs = [ autoreconfHook pkgconfig ];
+  buildInputs = [ fftw speexdsp ];
+
+  # TODO: Remove this will help with immediate backward compatability
+  propagatedBuildInputs = [ speexdsp ];
+
+  configureFlags = [
+    "--with-fft=gpl-fftw3"
+  ];
+
+  meta = with stdenv.lib; {
+    homepage = https://www.speex.org/;
+    description = "An Open Source/Free Software patent-free audio compression format designed for speech";
+    license = licenses.bsd3;
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/speexdsp/build-fix.patch b/nixpkgs/pkgs/development/libraries/speexdsp/build-fix.patch
new file mode 100644
index 000000000000..13cd5e7d21a5
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/speexdsp/build-fix.patch
@@ -0,0 +1,24 @@
+diff --git a/libspeexdsp/Makefile.am b/libspeexdsp/Makefile.am
+index d0499b9..42e8d50 100644
+--- a/libspeexdsp/Makefile.am
++++ b/libspeexdsp/Makefile.am
+@@ -29,7 +29,7 @@ noinst_HEADERS = 	arch.h 	bfin.h \
+ 	pseudofloat.h smallft.h vorbis_psy.h resample_sse.h resample_neon.h
+ 
+ libspeexdsp_la_LDFLAGS = -no-undefined -version-info @SPEEXDSP_LT_CURRENT@:@SPEEXDSP_LT_REVISION@:@SPEEXDSP_LT_AGE@
+-libspeexdsp_la_LIBADD = $(LIBM)
++libspeexdsp_la_LIBADD = @FFT_LIBS@ $(LIBM)
+ 
+ if BUILD_EXAMPLES
+ noinst_PROGRAMS = testdenoise testecho testjitter testresample
+diff --git a/speexdsp.pc.in b/speexdsp.pc.in
+index 6c6d26f..d40d856 100644
+--- a/speexdsp.pc.in
++++ b/speexdsp.pc.in
+@@ -11,5 +11,5 @@ Version: @PACKAGE_VERSION@
+ Requires: @FFT_PKGCONFIG@
+ Conflicts:
+ Libs: -L${libdir} -lspeexdsp
+-Libs.private: @LIBM@
++Libs.private: @FFT_LIBS@ @LIBM@
+ Cflags: -I${includedir}
diff --git a/nixpkgs/pkgs/development/libraries/speexdsp/default.nix b/nixpkgs/pkgs/development/libraries/speexdsp/default.nix
new file mode 100644
index 000000000000..16be9fa1e3b1
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/speexdsp/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchurl, autoreconfHook, pkgconfig, fftw }:
+
+stdenv.mkDerivation rec {
+  name = "speexdsp-1.2rc3";
+
+  src = fetchurl {
+    url = "http://downloads.us.xiph.org/releases/speex/${name}.tar.gz";
+    sha256 = "1wcjyrnwlkayb20zdhp48y260rfyzg925qpjpljd5x9r01h8irja";
+  };
+
+  patches = [ ./build-fix.patch ];
+  postPatch = "sed '3i#include <stdint.h>' -i ./include/speex/speexdsp_config_types.h.in";
+
+  outputs = [ "out" "dev" "doc" ];
+
+  nativeBuildInputs = [ autoreconfHook pkgconfig ];
+  buildInputs = [ fftw ];
+
+  configureFlags = [
+    "--with-fft=gpl-fftw3"
+  ] ++ stdenv.lib.optional stdenv.isAarch64 "--disable-neon";
+
+  meta = with stdenv.lib; {
+    homepage = https://www.speex.org/;
+    description = "An Open Source/Free Software patent-free audio compression format designed for speech";
+    license = licenses.bsd3;
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/sphinxbase/default.nix b/nixpkgs/pkgs/development/libraries/sphinxbase/default.nix
new file mode 100644
index 000000000000..57c3ae40fd97
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/sphinxbase/default.nix
@@ -0,0 +1,39 @@
+{ stdenv
+, fetchurl
+, bison
+, pkgconfig
+, python27 # >= 2.6
+, swig2 # 2.0
+, multipleOutputs ? false #Uses incomplete features of nix!
+}:
+
+stdenv.mkDerivation (rec {
+  name = "sphinxbase-5prealpha";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/cmusphinx/${name}.tar.gz";
+    sha256 = "0vr4k8pv5a8nvq9yja7kl13b5lh0f9vha8fc8znqnm8bwmcxnazp";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ swig2 python27 bison ];
+
+  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; [ fuuzetsu ];
+  };
+
+} // (stdenv.lib.optionalAttrs multipleOutputs {
+  outputs = [ "out" "lib" "headers" ];
+
+  postInstall = ''
+    mkdir -p $lib
+    cp -av $out/lib* $lib
+
+    mkdir -p $headers
+    cp -av $out/include $headers
+  '';
+}))
diff --git a/nixpkgs/pkgs/development/libraries/spice-gtk/default.nix b/nixpkgs/pkgs/development/libraries/spice-gtk/default.nix
new file mode 100644
index 000000000000..0169a42ed65e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/spice-gtk/default.nix
@@ -0,0 +1,133 @@
+{ stdenv
+, fetchurl
+, pkgconfig
+, fetchpatch
+, meson
+, ninja
+, python3
+, spice-protocol
+, gettext
+, openssl
+, libpulseaudio
+, pixman
+, gobject-introspection
+, libjpeg_turbo
+, zlib
+, cyrus_sasl
+, usbredir
+, libsoup
+, polkit
+, acl
+, usbutils
+, vala
+, gtk3
+, epoxy
+, libdrm
+, gst_all_1
+, phodav
+, libopus
+, gtk-doc
+, json-glib
+, lz4
+, libcacard
+, perl
+, docbook_xsl
+, withPolkit ? true
+}:
+
+# If this package is built with polkit support (withPolkit=true),
+# usb redirection reqires spice-client-glib-usb-acl-helper to run setuid root.
+# The helper confirms via polkit that the user has an active session,
+# then adds a device acl entry for that user.
+# Example NixOS config to create a setuid wrapper for the helper:
+# security.wrappers.spice-client-glib-usb-acl-helper.source =
+#   "${pkgs.spice-gtk}/bin/spice-client-glib-usb-acl-helper";
+# On non-NixOS installations, make a setuid copy of the helper
+# outside the store and adjust PATH to find the setuid version.
+
+# If this package is built without polkit support (withPolkit=false),
+# usb redirection requires read-write access to usb devices.
+# This can be granted by adding users to a custom group like "usb"
+# and using a udev rule to put all usb devices in that group.
+# Example NixOS config:
+#  users.groups.usb = {};
+#  users.users.dummy.extraGroups = [ "usb" ];
+#  services.udev.extraRules = ''
+#    KERNEL=="*", SUBSYSTEMS=="usb", MODE="0664", GROUP="usb"
+#  '';
+
+stdenv.mkDerivation rec {
+  pname = "spice-gtk";
+  version = "0.37";
+
+  outputs = [ "out" "dev" "devdoc" "man" ];
+
+  src = fetchurl {
+    url = "https://www.spice-space.org/download/gtk/${pname}-${version}.tar.bz2";
+    sha256 = "1drvj8y35gnxbnrxsipwi15yh0vs9ixzv4wslz6r3lra8w3bfa0z";
+  };
+
+  postPatch = ''
+    # get rid of absolute path to helper in store so we can use a setuid wrapper
+    substituteInPlace src/usb-acl-helper.c \
+      --replace 'ACL_HELPER_PATH"/' '"'
+  '';
+
+  nativeBuildInputs = [
+    docbook_xsl
+    gettext
+    gobject-introspection
+    gtk-doc
+    libsoup
+    meson
+    ninja
+    perl
+    pkgconfig
+    python3
+    python3.pkgs.pyparsing
+    python3.pkgs.six
+    vala
+  ];
+
+  buildInputs = [
+    cyrus_sasl
+    epoxy
+    gst_all_1.gst-plugins-base
+    gtk3
+    json-glib
+    libcacard
+    libdrm
+    libjpeg_turbo
+    lz4
+    openssl
+    libopus
+    phodav
+    pixman
+    spice-protocol
+    usbredir
+    zlib
+  ] ++ stdenv.lib.optionals withPolkit [ polkit acl usbutils ] ;
+
+  PKG_CONFIG_POLKIT_GOBJECT_1_POLICYDIR = "${placeholder "out"}/share/polkit-1/actions";
+
+  mesonFlags = [
+    "-Dauto_features=enabled"
+    "-Dcelt051=disabled"
+    "-Dpulse=disabled" # is deprecated upstream
+  ];
+
+  meta = with stdenv.lib; {
+    description = "A GTK+3 SPICE widget";
+    longDescription = ''
+      spice-gtk is a GTK+3 SPICE widget. It features glib-based
+      objects for SPICE protocol parsing and a gtk widget for embedding
+      the SPICE display into other applications such as virt-manager.
+      Python bindings are available too.
+    '';
+
+    homepage = https://www.spice-space.org/;
+    license = licenses.lgpl21;
+    maintainers = [ maintainers.xeji ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/spice-protocol/default.nix b/nixpkgs/pkgs/development/libraries/spice-protocol/default.nix
new file mode 100644
index 000000000000..c32f336939cb
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/spice-protocol/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  pname = "spice-protocol";
+  version = "0.14.0";
+
+  src = fetchurl {
+    url = "https://www.spice-space.org/download/releases/${pname}-${version}.tar.bz2";
+    sha256 = "1b3f44c13pqsp7aabmcinfbmgl79038bp5548l5pjs16lcfam95n";
+  };
+
+  postInstall = ''
+    mkdir -p $out/lib
+    ln -sv ../share/pkgconfig $out/lib/pkgconfig
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Protocol headers for the SPICE protocol";
+    homepage = https://www.spice-space.org/;
+    license = licenses.bsd3;
+    maintainers = with maintainers; [ bluescreen303 ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/spice/correct-meson.patch b/nixpkgs/pkgs/development/libraries/spice/correct-meson.patch
new file mode 100644
index 000000000000..d3422cb915b3
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/spice/correct-meson.patch
@@ -0,0 +1,26 @@
+diff --git a/meson.build b/meson.build
+index 8b8ae8bb..e58c436c 100644
+--- a/meson.build
++++ b/meson.build
+@@ -2,7 +2,7 @@
+ # project definition
+ #
+ project('spice', 'c',
+-        version : run_command('build-aux/git-version-gen', '${MESON_SOURCE_ROOT}/.tarball-version', check : true).stdout().strip(),
++        version : run_command('build-aux/git-version-gen', meson.source_root() + '/.tarball-version', check : true).stdout().strip(),
+         license : 'LGPLv2.1',
+         meson_version : '>= 0.48')
+
+diff --git a/server/meson.build b/server/meson.build
+index 34d8eef1..988ccab2 100644
+--- a/server/meson.build
++++ b/server/meson.build
+@@ -7,7 +7,7 @@ version_info = meson.project_version().split('.')
+ major = '@0@'.format(version_info[0])
+ minor = '@0@'.format(version_info[1])
+ micro = version_info[2].to_int()
+-if not version_info[3].contains('git')
++if not version_info.contains('git')
+   micro += 1
+ endif
+ micro = '@0@'.format(micro)
diff --git a/nixpkgs/pkgs/development/libraries/spice/default.nix b/nixpkgs/pkgs/development/libraries/spice/default.nix
new file mode 100644
index 000000000000..902bc6a5560f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/spice/default.nix
@@ -0,0 +1,105 @@
+{ stdenv
+, substituteAll
+, fetchurl
+, meson
+, ninja
+, pkgconfig
+, pixman
+, alsaLib
+, openssl
+, libXrandr
+, libXfixes
+, libXext
+, libXrender
+, libXinerama
+, libjpeg
+, zlib
+, spice-protocol
+, python3
+, glib
+, cyrus_sasl
+, libcacard
+, lz4
+, libopus
+, gst_all_1
+, orc
+}:
+
+stdenv.mkDerivation rec {
+  pname = "spice";
+  version = "0.14.2";
+
+  src = fetchurl {
+    url = "https://www.spice-space.org/download/releases/${pname}-${version}.tar.bz2";
+    sha256 = "19r999py9v9c7md2bb8ysj809ag1hh6djl1ik8jcgx065s4b60xj";
+  };
+
+  patches = [
+    # submitted https://gitlab.freedesktop.org/spice/spice/merge_requests/4
+    ./correct-meson.patch
+  ];
+
+  postPatch = ''
+    patchShebangs build-aux
+  '';
+
+
+  nativeBuildInputs = [
+    meson
+    ninja
+    pkgconfig
+    spice-protocol
+    python3
+    python3.pkgs.six
+    python3.pkgs.pyparsing
+  ];
+
+  buildInputs = [
+    alsaLib
+    cyrus_sasl
+    glib
+    gst_all_1.gst-plugins-base
+    libXext
+    libXfixes
+    libXinerama
+    libXrandr
+    libXrender
+    libcacard
+    libjpeg
+    libopus
+    lz4
+    openssl
+    orc
+    pixman
+    python3.pkgs.pyparsing
+    zlib
+  ];
+
+  NIX_CFLAGS_COMPILE = "-fno-stack-protector";
+
+  mesonFlags = [
+    "-Dauto_features=enabled"
+    "-Dgstreamer=1.0"
+    "-Dcelt051=disabled"
+  ];
+
+  postInstall = ''
+    ln -s spice-server $out/include/spice
+  '';
+
+  meta = with stdenv.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
+      with virtualized desktop devices.The Spice project deals with both the virtualized
+      devices and the front-end. Interaction between front-end and back-end is done using
+      VD-Interfaces. The VD-Interfaces (VDI) enable both ends of the solution to be easily
+      utilized by a third-party component.
+    '';
+    homepage = https://www.spice-space.org/;
+    license = licenses.lgpl21;
+
+    maintainers = [ maintainers.bluescreen303 ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/spirv-headers/default.nix b/nixpkgs/pkgs/development/libraries/spirv-headers/default.nix
new file mode 100644
index 000000000000..40d272fd07d6
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/spirv-headers/default.nix
@@ -0,0 +1,21 @@
+{ stdenv, fetchFromGitHub, cmake }:
+stdenv.mkDerivation rec {
+  name = "spirv-headers-${version}";
+  version = "2019.1"; # spirv-tools version whose DEPS file calls for this commit
+
+  src = fetchFromGitHub {
+    owner = "KhronosGroup";
+    repo = "SPIRV-Headers";
+    rev = "79b6681aadcb53c27d1052e5f8a0e82a981dbf2f"; # from spirv-tools' DEPS
+    sha256 = "0flng2rdmc4ndq3j71h6wk1ibcjvhjrg2rzd6rv445vcsf0jh2pj";
+  };
+
+  nativeBuildInputs = [ cmake ];
+
+  meta = with stdenv.lib; {
+    inherit (src.meta) homepage;
+    description = "Machine-readable components of the Khronos SPIR-V Registry";
+    license = licenses.mit;
+    maintainers = [ maintainers.ralith ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/sqlcipher/default.nix b/nixpkgs/pkgs/development/libraries/sqlcipher/default.nix
new file mode 100644
index 000000000000..ce72c2737be9
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/sqlcipher/default.nix
@@ -0,0 +1,31 @@
+{ stdenv, lib, fetchFromGitHub, openssl, tcl, readline ? null, ncurses ? null }:
+
+assert readline != null -> ncurses != null;
+
+stdenv.mkDerivation rec {
+  name = "sqlcipher-${version}";
+  version = "4.1.0";
+
+  src = fetchFromGitHub {
+    owner = "sqlcipher";
+    repo = "sqlcipher";
+    rev = "v${version}";
+    sha256 = "0w0f4pg3jfzismpgqnbf60bjbbll2ang48216bc4m20mm2dpp5ar";
+  };
+
+  buildInputs = [ readline ncurses openssl tcl ];
+
+  configureFlags = [ "--enable-threadsafe" "--disable-tcl" ];
+
+  CFLAGS = [ "-DSQLITE_ENABLE_COLUMN_METADATA=1" "-DSQLITE_SECURE_DELETE=1" "-DSQLITE_ENABLE_UNLOCK_NOTIFY=1" "-DSQLITE_HAS_CODEC" ];
+  LDFLAGS = lib.optional (readline != null) "-lncurses";
+
+  doCheck = false; # fails. requires tcl?
+
+  meta = with stdenv.lib; {
+    homepage = http://sqlcipher.net/;
+    description = "Full Database Encryption for SQLite";
+    platforms = platforms.unix;
+    license = licenses.bsd3;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/sqlite/analyzer.nix b/nixpkgs/pkgs/development/libraries/sqlite/analyzer.nix
new file mode 100644
index 000000000000..f0390486b10e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/sqlite/analyzer.nix
@@ -0,0 +1,31 @@
+{ stdenv, fetchurl, unzip, sqlite, tcl }:
+
+let
+  archiveVersion = import ./archive-version.nix stdenv.lib;
+in
+
+stdenv.mkDerivation rec {
+  name = "sqlite-analyzer-${version}";
+  version = "3.28.0";
+
+  src = assert version == sqlite.version; fetchurl {
+    url = "https://sqlite.org/2019/sqlite-src-${archiveVersion version}.zip";
+    sha256 = "15v57b113bpgcshfsx5jw93szar3da94rr03i053xhl15la7jllh";
+  };
+
+  nativeBuildInputs = [ unzip ];
+  buildInputs = [ tcl ];
+
+  makeFlags = [ "sqlite3_analyzer" ];
+
+  installPhase = "install -Dt $out/bin sqlite3_analyzer";
+
+  meta = with stdenv.lib; {
+    description = "A tool that shows statistics about SQLite databases";
+    downloadPage = http://sqlite.org/download.html;
+    homepage = https://www.sqlite.org;
+    license = licenses.publicDomain;
+    maintainers = with maintainers; [ pesterhazy ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/sqlite/archive-version.nix b/nixpkgs/pkgs/development/libraries/sqlite/archive-version.nix
new file mode 100644
index 000000000000..1f312ecef23a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/sqlite/archive-version.nix
@@ -0,0 +1,11 @@
+lib: version:
+
+with lib;
+  
+let
+  fragments = splitString "." version;
+  major = head fragments;
+  minor = concatMapStrings (fixedWidthNumber 2) (tail fragments);
+in
+
+major + minor + "00"
diff --git a/nixpkgs/pkgs/development/libraries/sqlite/default.nix b/nixpkgs/pkgs/development/libraries/sqlite/default.nix
new file mode 100644
index 000000000000..b2351a32fa63
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/sqlite/default.nix
@@ -0,0 +1,85 @@
+{ stdenv, fetchurl, zlib, interactive ? false, readline ? null, ncurses ? null }:
+
+assert interactive -> readline != null && ncurses != null;
+
+with stdenv.lib;
+
+let
+  archiveVersion = import ./archive-version.nix stdenv.lib;
+in
+
+stdenv.mkDerivation rec {
+  pname = "sqlite";
+  version = "3.28.0";
+
+  # NB! Make sure to update analyzer.nix src (in the same directory).
+  src = fetchurl {
+    url = "https://sqlite.org/2019/sqlite-autoconf-${archiveVersion version}.tar.gz";
+    sha256 = "1hxpi45crbqp6lacl7z611lna02k956m9bsy2bjzrbb2y23546yn";
+  };
+
+  outputs = [ "bin" "dev" "out" ];
+  separateDebugInfo = stdenv.isLinux;
+
+  buildInputs = [ zlib ] ++ optionals interactive [ readline ncurses ];
+
+  configureFlags = [ "--enable-threadsafe" ] ++ optional interactive "--enable-readline";
+
+  NIX_CFLAGS_COMPILE = [
+    "-DSQLITE_ENABLE_COLUMN_METADATA"
+    "-DSQLITE_ENABLE_DBSTAT_VTAB"
+    "-DSQLITE_ENABLE_JSON1"
+    "-DSQLITE_ENABLE_FTS3"
+    "-DSQLITE_ENABLE_FTS3_PARENTHESIS"
+    "-DSQLITE_ENABLE_FTS3_TOKENIZER"
+    "-DSQLITE_ENABLE_FTS4"
+    "-DSQLITE_ENABLE_FTS5"
+    "-DSQLITE_ENABLE_RTREE"
+    "-DSQLITE_ENABLE_STMT_SCANSTATUS"
+    "-DSQLITE_ENABLE_UNLOCK_NOTIFY"
+    "-DSQLITE_SOUNDEX"
+    "-DSQLITE_SECURE_DELETE"
+    "-DSQLITE_MAX_VARIABLE_NUMBER=250000"
+    "-DSQLITE_MAX_EXPR_DEPTH=10000"
+  ];
+
+  # Test for features which may not be available at compile time
+  preBuild = ''
+    # Use pread(), pread64(), pwrite(), pwrite64() functions for better performance if they are available.
+    if cc -Werror=implicit-function-declaration -x c - -o "$TMPDIR/pread_pwrite_test" <<< \
+      ''$'#include <unistd.h>\nint main()\n{\n  pread(0, NULL, 0, 0);\n  pwrite(0, NULL, 0, 0);\n  return 0;\n}'; then
+      export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -DUSE_PREAD"
+    fi
+    if cc -Werror=implicit-function-declaration -x c - -o "$TMPDIR/pread64_pwrite64_test" <<< \
+      ''$'#include <unistd.h>\nint main()\n{\n  pread64(0, NULL, 0, 0);\n  pwrite64(0, NULL, 0, 0);\n  return 0;\n}'; then
+      export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -DUSE_PREAD64"
+    elif cc -D_LARGEFILE64_SOURCE -Werror=implicit-function-declaration -x c - -o "$TMPDIR/pread64_pwrite64_test" <<< \
+      ''$'#include <unistd.h>\nint main()\n{\n  pread64(0, NULL, 0, 0);\n  pwrite64(0, NULL, 0, 0);\n  return 0;\n}'; then
+      export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -DUSE_PREAD64 -D_LARGEFILE64_SOURCE"
+    fi
+
+    # Necessary for FTS5 on Linux
+    export NIX_LDFLAGS="$NIX_LDFLAGS -lm"
+
+    echo ""
+    echo "NIX_CFLAGS_COMPILE = $NIX_CFLAGS_COMPILE"
+    echo ""
+  '';
+
+  postInstall = ''
+    # Do not contaminate dependent libtool-based projects with sqlite dependencies.
+    sed -i $out/lib/libsqlite3.la -e "s/dependency_libs=.*/dependency_libs='''/"
+  '';
+
+  enableParallelBuilding = true;
+  doCheck = false; # fails to link against tcl
+
+  meta = {
+    description = "A self-contained, serverless, zero-configuration, transactional SQL database engine";
+    downloadPage = https://sqlite.org/download.html;
+    homepage = https://www.sqlite.org/;
+    license = licenses.publicDomain;
+    maintainers = with maintainers; [ eelco np ];
+    platforms = platforms.unix ++ platforms.windows;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/sqlite/sqlar.nix b/nixpkgs/pkgs/development/libraries/sqlite/sqlar.nix
new file mode 100644
index 000000000000..e5d322330e8e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/sqlite/sqlar.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchurl, fuse, zlib }:
+
+stdenv.mkDerivation rec {
+  name = "sqlar-${version}";
+  version = "2018-01-07";
+
+  src = fetchurl {
+    url = "https://www.sqlite.org/sqlar/tarball/4824e73896/sqlar-src-4824e73896.tar.gz";
+    sha256 = "09pikkbp93gqypn3da9zi0dzc47jyypkwc9vnmfzhmw7kpyv8nm9";
+  };
+
+  buildInputs = [ fuse zlib ];
+
+  buildFlags = [ "sqlar" "sqlarfs" ];
+
+  installPhase = ''
+    install -D -t $out/bin sqlar sqlarfs
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = https://sqlite.org/sqlar;
+    description = "SQLite Archive utilities";
+    license = licenses.bsd2;
+    platforms = platforms.all;
+    maintainers = with maintainers; [ dtzWill ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/srt/default.nix b/nixpkgs/pkgs/development/libraries/srt/default.nix
new file mode 100644
index 000000000000..bb66174c8841
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/srt/default.nix
@@ -0,0 +1,34 @@
+{ stdenv, fetchFromGitHub, cmake, openssl
+}:
+
+with stdenv.lib;
+stdenv.mkDerivation rec {
+  pname = "srt";
+  version = "1.3.2";
+
+  src = fetchFromGitHub {
+    owner = "Haivision";
+    repo = "srt";
+    rev = "v${version}";
+    sha256 = "1h1kim9vvqnwx95yd9768ds30h731yg27jz63r90kjxm7b5kmja4";
+  };
+
+  nativeBuildInputs = [ cmake ];
+
+  buildInputs = [ openssl ];
+
+  cmakeFlags = [
+    # TODO Remove this when https://github.com/Haivision/srt/issues/538 is fixed and available to nixpkgs
+    # Workaround for the fact that srt incorrectly disables GNUInstallDirs when LIBDIR is specified,
+    # see https://github.com/NixOS/nixpkgs/pull/54463#discussion_r249878330
+    "-UCMAKE_INSTALL_LIBDIR"
+  ];
+
+  meta = {
+    description = "Secure, Reliable, Transport";
+    homepage    = https://www.srtalliance.org;
+    license     = licenses.mpl20;
+    maintainers = with maintainers; [ nh2 ];
+    platforms   = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/srtp/default.nix b/nixpkgs/pkgs/development/libraries/srtp/default.nix
new file mode 100644
index 000000000000..c9073fc0b7e7
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/srtp/default.nix
@@ -0,0 +1,38 @@
+{ stdenv, fetchFromGitHub, pkgconfig
+, openssl ? null, libpcap ? null
+}:
+
+with stdenv.lib;
+stdenv.mkDerivation rec {
+  name = "libsrtp-${version}";
+  version = "2.2.0";
+
+  src = fetchFromGitHub {
+    owner = "cisco";
+    repo = "libsrtp";
+    rev = "v${version}";
+    sha256 = "1ac7xs1djb03j131f1gmqyfmrplblid9qqyxahs0shdy707r5ll6";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+
+  # libsrtp.pc references -lcrypto -lpcap without -L
+  propagatedBuildInputs = [ openssl libpcap ];
+
+  configureFlags = [
+    "--disable-debug"
+  ] ++ optional (openssl != null) "--enable-openssl";
+
+  buildFlags = [ "shared_library" ];
+
+  postInstall = ''
+    rm -rf $out/bin
+  '';
+
+  meta = {
+    homepage = https://github.com/cisco/libsrtp;
+    description = "Secure RTP (SRTP) Reference Implementation";
+    license = licenses.bsd3;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/startup-notification/default.nix b/nixpkgs/pkgs/development/libraries/startup-notification/default.nix
new file mode 100644
index 000000000000..fc771a493b6d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/startup-notification/default.nix
@@ -0,0 +1,21 @@
+{stdenv, fetchurl, libX11, libxcb, pkgconfig, xcbutil}:
+
+let
+  version = "0.12";
+in
+stdenv.mkDerivation {
+  name = "libstartup-notification-${version}";
+  src = fetchurl {
+    url = "https://www.freedesktop.org/software/startup-notification/releases/startup-notification-${version}.tar.gz";
+    sha256 = "3c391f7e930c583095045cd2d10eb73a64f085c7fde9d260f2652c7cb3cfbe4a";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ libX11 libxcb xcbutil ];
+
+  meta = {
+    homepage = http://www.freedesktop.org/software/startup-notification;
+    description = "Application startup notification and feedback library";
+    license = stdenv.lib.licenses.lgpl2;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/stb/default.nix b/nixpkgs/pkgs/development/libraries/stb/default.nix
new file mode 100644
index 000000000000..4f36ac2ba1c7
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/stb/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchFromGitHub }:
+
+stdenv.mkDerivation rec {
+  name = "stb-${version}";
+  version = "20180211";
+
+  src = fetchFromGitHub {
+    owner = "nothings";
+    repo = "stb";
+    rev = "e6afb9cbae4064da8c3e69af3ff5c4629579c1d2";
+    sha256 = "079nsn9bnb8c0vfq26g5l53q6gzx19a5x9q2nb55mpcljxsgxnmf";
+  };
+
+  dontBuild = true;
+
+  installPhase = ''
+    mkdir -p $out/include/stb
+    cp *.h $out/include/stb/
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Single-file public domain libraries for C/C++";
+    homepage = https://github.com/nothings/stb;
+    license = licenses.publicDomain;
+    platforms = platforms.all;
+    maintainers = with maintainers; [ jfrankenau ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/stfl/default.nix b/nixpkgs/pkgs/development/libraries/stfl/default.nix
new file mode 100644
index 000000000000..89261b665f50
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/stfl/default.nix
@@ -0,0 +1,36 @@
+{ stdenv, fetchurl, ncurses, libiconv }:
+
+stdenv.mkDerivation rec {
+  name = "stfl-0.24";
+
+  src = fetchurl {
+    url = "http://www.clifford.at/stfl/${name}.tar.gz";
+    sha256 = "1460d5lc780p3q38l3wc9jfr2a7zlyrcra0li65aynj738cam9yl";
+  };
+
+  buildInputs = [ ncurses libiconv ];
+
+  buildPhase = ''
+    sed -i s/gcc/cc/g Makefile
+    sed -i s%ncursesw/ncurses.h%ncurses.h% stfl_internals.h
+  '' + ( stdenv.lib.optionalString stdenv.isDarwin ''
+    sed -i s/-soname/-install_name/ Makefile
+  '' ) + ''
+    make
+  '';
+
+  installPhase = ''
+    DESTDIR=$out prefix=\"\" make install
+
+    # some programs rely on libstfl.so.0 to be present, so link it
+    ln -s $out/lib/libstfl.so.0.24 $out/lib/libstfl.so.0
+  '';
+
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/stlport/default.nix b/nixpkgs/pkgs/development/libraries/stlport/default.nix
new file mode 100644
index 000000000000..ff1a7b57f4a5
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/stlport/default.nix
@@ -0,0 +1,26 @@
+{stdenv, fetchurl}:
+
+stdenv.mkDerivation rec {
+  name = "STLport-5.2.1";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/stlport/${name}.tar.bz2";
+    sha256 = "1jbgak1m1qk7d4gyn1p2grbws2icsf7grbs3dh44ai9ck1xh0nvm";
+  };
+
+  # fix hardcoded /usr/bin; not recognizing the standard --disable-static flag
+  configurePhase = ''
+    echo Preconf: build/Makefiles/gmake/*/sys.mak
+    for f in build/Makefiles/gmake/*/sys.mak; do
+      substituteInPlace "$f" --replace /usr/bin/ ""
+    done
+    ./configure --prefix=$out
+  '';
+
+  meta = {
+    description = "An implementation of the C++ Standard Library";
+    homepage = https://sourceforge.net/projects/stlport/;
+    license = stdenv.lib.licenses.free; # seems BSD-like
+    broken = true; # probably glibc-2.20 -related issue
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/strigi/default.nix b/nixpkgs/pkgs/development/libraries/strigi/default.nix
new file mode 100644
index 000000000000..36768acd991a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/strigi/default.nix
@@ -0,0 +1,43 @@
+{ stdenv, fetchurl, cmake, qt4, perl, bzip2, libxml2, exiv2
+, clucene_core, fam, zlib, dbus, pkgconfig
+}:
+
+stdenv.mkDerivation rec {
+  name = "strigi-${version}";
+  version = "0.7.8";
+
+  src = fetchurl {
+    url = "https://www.vandenoever.info/software/strigi/${name}.tar.bz2";
+    sha256 = "12grxzqwnvbyqw7q1gnz42lypadxmq89vk2qpxczmpmc4nk63r23";
+  };
+
+  includeAllQtDirs = true;
+
+  CLUCENE_HOME = clucene_core;
+
+  buildInputs =
+    [ zlib bzip2 libxml2 qt4 exiv2 clucene_core fam dbus.out ];
+
+  nativeBuildInputs = [ cmake pkgconfig perl ];
+
+  patches = [ ./export_bufferedstream.patch ./gcc6.patch ];
+
+  enableParallelBuilding = true;
+
+  # Strigi installs some libraries in an incorrect place
+  # ($out/$out/lib instead of $out/lib), so move them to the right
+  # place.
+  postInstall =
+    ''
+      mv $out/$out/lib/* $out/lib
+      rm -rf $out/nix
+    '';
+
+  meta = {
+    homepage = http://strigi.sourceforge.net;
+    description = "A very fast and efficient crawler to index data on your harddrive";
+    license = "LGPL";
+    maintainers = with stdenv.lib.maintainers; [ sander ];
+    inherit (qt4.meta) platforms;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/strigi/export_bufferedstream.patch b/nixpkgs/pkgs/development/libraries/strigi/export_bufferedstream.patch
new file mode 100644
index 000000000000..4c6b34fe1bec
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/strigi/export_bufferedstream.patch
@@ -0,0 +1,12 @@
+diff -u -r strigi-0.7.8/libstreams/include/strigi/bufferedstream.h strigi-0.7.8_new/libstreams/include/strigi/bufferedstream.h
+--- strigi-0.7.8/libstreams/include/strigi/bufferedstream.h	2013-02-05 13:34:57.000000000 -0800
++++ strigi-0.7.8_new/libstreams/include/strigi/bufferedstream.h	2013-07-14 17:01:54.000000000 -0700
+@@ -34,7 +34,7 @@
+  * BufferedStream will do the rest.
+  */
+ template <class T>
+-class BufferedStream : public StreamBase<T> {
++class STRIGI_EXPORT BufferedStream : public StreamBase<T> {
+ private:
+     StreamBuffer<T> buffer;
+     bool finishedWritingToBuffer;
diff --git a/nixpkgs/pkgs/development/libraries/strigi/gcc6.patch b/nixpkgs/pkgs/development/libraries/strigi/gcc6.patch
new file mode 100644
index 000000000000..b46f6c52b823
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/strigi/gcc6.patch
@@ -0,0 +1,45 @@
+https://sourceforge.net/p/strigi/patches/4/
+
+and a fix for
+
+/tmp/nix-build-strigi-0.7.8.drv-0/strigi-0.7.8/libstreamanalyzer/plugins/indexers/clucenengindexer/cluceneindexreader.cpp:325:37: error: no matching function for call to 'make_pair(std::__cxx11::string, std::__cxx11::string&)'
+             wchartoutf8(name), value));
+
+diff -Naur strigi-0.7.8.old/libstreamanalyzer/cmake/MacroCheckGccVisibility.cmake strigi-0.7.8/libstreamanalyzer/cmake/MacroCheckGccVisibility.cmake
+--- strigi-0.7.8.old/libstreamanalyzer/cmake/MacroCheckGccVisibility.cmake	2013-02-05 16:34:52.000000000 -0500
++++ strigi-0.7.8/libstreamanalyzer/cmake/MacroCheckGccVisibility.cmake	2016-05-14 11:39:54.586260564 -0400
+@@ -15,7 +15,7 @@
+    # get the gcc version
+    exec_program(${CMAKE_C_COMPILER} ARGS ${CMAKE_C_COMPILER_ARG1} --version OUTPUT_VARIABLE _gcc_version_info)
+ 
+-   string (REGEX MATCH "[345]\\.[0-9]\\.[0-9]" _gcc_version "${_gcc_version_info}")
++   string (REGEX MATCH "[3456789]\\.[0-9]\\.[0-9]" _gcc_version "${_gcc_version_info}")
+    # gcc on mac just reports: "gcc (GCC) 3.3 20030304 ..." without the patch level, handle this here:
+    if (NOT _gcc_version)
+       string (REGEX REPLACE ".*\\(GCC\\).* ([34]\\.[0-9]) .*" "\\1.0" _gcc_version "${_gcc_version_info}")
+diff -Naur strigi-0.7.8.old/libstreams/cmake/MacroCheckGccVisibility.cmake strigi-0.7.8/libstreams/cmake/MacroCheckGccVisibility.cmake
+--- strigi-0.7.8.old/libstreams/cmake/MacroCheckGccVisibility.cmake	2013-02-05 16:34:57.000000000 -0500
++++ strigi-0.7.8/libstreams/cmake/MacroCheckGccVisibility.cmake	2016-05-14 11:40:11.340134414 -0400
+@@ -15,7 +15,7 @@
+    # get the gcc version
+    exec_program(${CMAKE_C_COMPILER} ARGS ${CMAKE_C_COMPILER_ARG1} --version OUTPUT_VARIABLE _gcc_version_info)
+ 
+-   string (REGEX MATCH "[345]\\.[0-9]\\.[0-9]" _gcc_version "${_gcc_version_info}")
++   string (REGEX MATCH "[3456789]\\.[0-9]\\.[0-9]" _gcc_version "${_gcc_version_info}")
+    # gcc on mac just reports: "gcc (GCC) 3.3 20030304 ..." without the patch level, handle this here:
+    if (NOT _gcc_version)
+       string (REGEX REPLACE ".*\\(GCC\\).* ([34]\\.[0-9]) .*" "\\1.0" _gcc_version "${_gcc_version_info}")
+
+diff -ru strigi-0.7.8-orig/libstreamanalyzer/plugins/indexers/clucenengindexer/cluceneindexreader.cpp strigi-0.7.8/libstreamanalyzer/plugins/indexers/clucenengindexer/cluceneindexreader.cpp
+--- strigi-0.7.8-orig/libstreamanalyzer/plugins/indexers/clucenengindexer/cluceneindexreader.cpp	2013-02-05 22:34:52.000000000 +0100
++++ strigi-0.7.8/libstreamanalyzer/plugins/indexers/clucenengindexer/cluceneindexreader.cpp	2017-07-31 10:56:27.067902643 +0200
+@@ -321,8 +321,7 @@
+         string size = value;
+         doc.size = atoi(size.c_str());
+     } else {
+-        doc.properties.insert(make_pair<const string, string>(
+-            wchartoutf8(name), value));
++        doc.properties.emplace(wchartoutf8(name), value);
+     }
+ }
+ Variant
diff --git a/nixpkgs/pkgs/development/libraries/stxxl/default.nix b/nixpkgs/pkgs/development/libraries/stxxl/default.nix
new file mode 100644
index 000000000000..2244803f4d32
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/stxxl/default.nix
@@ -0,0 +1,37 @@
+{ stdenv, fetchurl, cmake
+, parallel ? true
+}:
+
+let
+  mkFlag = optset: flag: if optset then "-D${flag}=ON" else "-D${flag}=OFF";
+in
+
+stdenv.mkDerivation rec {
+  name = "stxxl-${version}";
+  version = "1.4.1";
+
+  src = fetchurl {
+    url = "https://github.com/stxxl/stxxl/archive/${version}.tar.gz";
+    sha256 = "54006a5fccd1435abc2f3ec201997a4d7dacddb984d2717f62191798e5372f6c";
+  };
+
+  nativeBuildInputs = [ cmake ];
+
+  cmakeFlags = [
+    "-DBUILD_SHARED_LIBS=ON"
+    "-DBUILD_STATIC_LIBS=OFF"
+    (mkFlag parallel "USE_GNU_PARALLEL")
+  ];
+
+  passthru = {
+    inherit parallel;
+  };
+
+  meta = with stdenv.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;
+    maintainers = with maintainers; [ ];
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/subunit/default.nix b/nixpkgs/pkgs/development/libraries/subunit/default.nix
new file mode 100644
index 000000000000..35bacff0525a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/subunit/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchurl, pkgconfig, check, cppunit, perl, pythonPackages }:
+
+# NOTE: for subunit python library see pkgs/top-level/python-packages.nix
+
+stdenv.mkDerivation rec {
+  name = "subunit-${version}";
+  version = "1.1.0";
+
+  src = fetchurl {
+    url = "https://launchpad.net/subunit/trunk/${version}/+download/${name}.tar.gz";
+    sha256 = "0lcah7p66c05p7xpw6ns1is0i02lh0nq8gq51mv4wyvbr6zaasa8";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ check cppunit perl pythonPackages.wrapPython ];
+
+  propagatedBuildInputs = with pythonPackages; [ testtools testscenarios ];
+
+  postFixup = "wrapPythonPrograms";
+
+  meta = with stdenv.lib; {
+    description = "A streaming protocol for test results";
+    homepage = https://launchpad.net/subunit;
+    license = licenses.asl20;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/sundials/default.nix b/nixpkgs/pkgs/development/libraries/sundials/default.nix
new file mode 100644
index 000000000000..abe444c63c32
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/sundials/default.nix
@@ -0,0 +1,28 @@
+{ cmake, fetchurl, python, stdenv }:
+
+stdenv.mkDerivation rec {
+
+  pname = "sundials";
+  version = "4.1.0";
+
+  src = fetchurl {
+    url = "https://computation.llnl.gov/projects/${pname}/download/${pname}-${version}.tar.gz";
+    sha256 = "19ca4nmlf6i9ijqcibyvpprxzsdfnackgjs6dw51fq13gg1f2398";
+  };
+
+  preConfigure = ''
+    export cmakeFlags="-DCMAKE_INSTALL_PREFIX=$out -DEXAMPLES_INSTALL_PATH=$out/share/examples $cmakeFlags"
+  '';
+
+  nativeBuildInputs = [ cmake ];
+  buildInputs = [ python ];
+
+  meta = with stdenv.lib; {
+    description = "Suite of nonlinear differential/algebraic equation solvers";
+    homepage    = https://computation.llnl.gov/projects/sundials;
+    platforms   = platforms.all;
+    maintainers = [ maintainers.idontgetoutmuch ];
+    license     = licenses.bsd3;
+  };
+
+}
diff --git a/nixpkgs/pkgs/development/libraries/svrcore/default.nix b/nixpkgs/pkgs/development/libraries/svrcore/default.nix
new file mode 100644
index 000000000000..2e6e2d3fbbfd
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/svrcore/default.nix
@@ -0,0 +1,20 @@
+{ stdenv, fetchurl, pkgconfig, nss, nspr }:
+
+stdenv.mkDerivation rec {
+  name = "svrcore-${version}";
+  version = "4.0.4";
+
+  src = fetchurl {
+    url = "mirror://mozilla/directory/svrcore/releases/${version}/src/${name}.tar.bz2";
+    sha256 = "0n3alg6bxml8952fb6h0bi0l29farvq21q6k20gy2ba90m3znwj7";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ nss nspr ];
+
+  meta = with stdenv.lib; {
+    description = "Secure PIN handling using NSS crypto";
+    license = licenses.mpl11;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/swiften/default.nix b/nixpkgs/pkgs/development/libraries/swiften/default.nix
new file mode 100644
index 000000000000..c83f5b0f5ac3
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/swiften/default.nix
@@ -0,0 +1,33 @@
+{ stdenv, python, fetchurl, openssl, boost, scons }:
+stdenv.mkDerivation rec {
+  name    = "swiften-${version}";
+  version = "4.0.2";
+
+  nativeBuildInputs = [ scons];
+  buildInputs           = [ python ];
+  propagatedBuildInputs = [ openssl boost ];
+
+  src = fetchurl {
+    url    = "https://swift.im/downloads/releases/swift-${version}/swift-${version}.tar.gz";
+    sha256 = "0w0aiszjd58ynxpacwcgf052zpmbpcym4dhci64vbfgch6wryz0w";
+  };
+
+  sconsFlags = [
+    "openssl=${openssl.dev}"
+    "boost_includedir=${boost.dev}/include"
+    "boost_libdir=${boost.out}/lib"
+    "boost_bundled_enable=false"
+  ];
+  preInstall = ''
+    installTargets="$out"
+    installFlags+=" SWIFT_INSTALLDIR=$out"
+  '';
+
+  meta = with stdenv.lib; {
+    description = "An XMPP library for C++, used by the Swift client";
+    homepage    = http://swift.im/swiften.html;
+    license     = licenses.gpl2Plus;
+    platforms   = platforms.linux;
+    maintainers = [ maintainers.twey ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/sword/default.nix b/nixpkgs/pkgs/development/libraries/sword/default.nix
new file mode 100644
index 000000000000..a8a110cf9b14
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/sword/default.nix
@@ -0,0 +1,42 @@
+{ stdenv, fetchurl, pkgconfig, icu, clucene_core, curl }:
+
+stdenv.mkDerivation rec {
+
+  name = "sword-${version}";
+  version = "1.7.4";
+
+  src = fetchurl {
+    url = "https://www.crosswire.org/ftpmirror/pub/sword/source/v1.7/${name}.tar.gz";
+    sha256 = "0g91kpfkwccvdikddffdbzd6glnp1gdvkx4vh04iyz10bb7shpcr";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ icu clucene_core curl ];
+
+  prePatch = ''
+    patchShebangs .;
+  '';
+
+  patches = [
+    (fetchurl {
+      url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/app-text/sword/files/sword-1.7.4-gcc6.patch";
+      sha256 = "0cvnya5swc7dxabir6bz6la2h1qxd32g3xi06m9b5l5ahb6g10y7";
+    })
+  ];
+
+  configureFlags = [ "--without-conf" "--enable-tests=no" ];
+  CXXFLAGS = [
+    "-Wno-unused-but-set-variable"
+    # compat with icu61+ https://github.com/unicode-org/icu/blob/release-64-2/icu4c/readme.html#L554
+    "-DU_USING_ICU_NAMESPACE=1"
+  ];
+
+  meta = with stdenv.lib; {
+    description = "A software framework that allows research manipulation of Biblical texts";
+    homepage = http://www.crosswire.org/sword/;
+    platforms = platforms.linux;
+    license = licenses.gpl2;
+    maintainers = [ maintainers.piotr maintainers.AndersonTorres ];
+  };
+
+}
diff --git a/nixpkgs/pkgs/development/libraries/symengine/default.nix b/nixpkgs/pkgs/development/libraries/symengine/default.nix
new file mode 100644
index 000000000000..40e1a280aa24
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/symengine/default.nix
@@ -0,0 +1,47 @@
+{ stdenv
+, fetchFromGitHub
+, cmake
+, gmp
+, flint
+, mpfr
+, libmpc
+}:
+
+stdenv.mkDerivation rec {
+  name = "symengine-${version}";
+  version = "0.4.0";
+
+  src = fetchFromGitHub {
+    owner = "symengine";
+    repo = "symengine";
+    rev = "v${version}";
+    sha256 = "1kz893p3pmsw3gfwickk2nliw8p63yp89xriad7kpw4kmhvgr8gb";
+  };
+
+  nativeBuildInputs = [ cmake ];
+
+  buildInputs = [ gmp flint mpfr libmpc ];
+
+  cmakeFlags = [
+    "-DWITH_FLINT=ON"
+    "-DINTEGER_CLASS=flint"
+    "-DWITH_SYMENGINE_THREAD_SAFE=yes"
+    "-DWITH_MPC=yes"
+    "-DBUILD_FOR_DISTRIBUTION=yes"
+  ];
+
+  doCheck = true;
+
+  checkPhase = ''
+    ctest
+  '';
+
+  meta = with stdenv.lib; {
+    description = "SymEngine is a fast symbolic manipulation library";
+    homepage = https://github.com/symengine/symengine;
+    platforms = platforms.unix ++ platforms.windows;
+    license = licenses.bsd3;
+    maintainers = [ maintainers.costrouc ];
+  };
+
+}
diff --git a/nixpkgs/pkgs/development/libraries/szip/default.nix b/nixpkgs/pkgs/development/libraries/szip/default.nix
new file mode 100644
index 000000000000..6577ebeae28e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/szip/default.nix
@@ -0,0 +1,16 @@
+{ stdenv, fetchurl }:
+    
+stdenv.mkDerivation rec {
+  name = "szip-${version}";
+  version = "2.1.1";
+  src = fetchurl {
+    url = "https://support.hdfgroup.org/ftp/lib-external/szip/${version}/src/szip-${version}.tar.gz";
+    sha256 = "04nlhkzzf1gihvrfbzc6rq4kc13p92ly39dzrb4y4jrd9y5rbvi1";
+  };
+
+  meta = {
+    description = "Compression library that can be used with the hdf5 library";
+    homepage = http://www.hdfgroup.org/doc_resource/SZIP/;
+    license = stdenv.lib.licenses.unfree;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/t1lib/default.nix b/nixpkgs/pkgs/development/libraries/t1lib/default.nix
new file mode 100644
index 000000000000..b8e7518cd332
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/t1lib/default.nix
@@ -0,0 +1,39 @@
+{ stdenv, fetchurl, fetchpatch, libX11, libXaw }:
+
+let
+  getPatch = { name, sha256 }: fetchpatch {
+    inherit name sha256;
+    url = "https://projects.archlinux.org/svntogit/packages.git/plain/trunk/${name}"
+      + "?h=packages/t1lib&id=643a4c2c58e70072b5bc1e9e4624162517b58357";
+  };
+
+  patches = map getPatch [
+    { name = "lib-cleanup.diff"; sha256 = "1w3q1y4zk0y4mf2s2x9z4cd8d4af8i868c8837p40mz3dqrai4zp"; }
+    { name = "format-security.diff"; sha256 = "0cca94bif9dsc6iwpcnk1504gb3sl3nsqhni85c21q9aywyz26l3"; }
+    { name = "CVE-2011-0764.diff"; sha256 = "1j0y3f38im7srpqjg9jvx8as6sxkz8gw7hglcxnxl9qylx8mr2jh"; }
+    { name = "CVE-2011-1552_1553_1554.patch"; sha256 = "16cyq6jhyhh8912j8hapx9pq4rzxk36ljlkxlnyi7i3wr8iz1dir"; }
+    { name = "CVE-2010-2642.patch"; sha256 = "175zvyr9v1xs22k2svgxqjcpz5nihfa7j46hn9nzvkqcrhm5m9y8"; }
+      # this ^ also fixes CVE-2011-5244
+  ];
+in
+stdenv.mkDerivation {
+  name = "t1lib-5.1.2";
+
+  src = fetchurl {
+    url = "mirror://metalab/libs/graphics/t1lib-5.1.2.tar.gz";
+    sha256 = "0nbvjpnmcznib1nlgg8xckrmsw3haa154byds2h90y2g0nsjh4w2";
+  };
+  inherit patches;
+
+  buildInputs = [ libX11 libXaw ];
+  buildFlags = "without_doc";
+
+  postInstall = stdenv.lib.optional (!stdenv.isDarwin) "chmod +x $out/lib/*.so.*"; # ??
+
+  meta = with stdenv.lib; {
+    description = "A type 1 font rasterizer library for UNIX/X11";
+    homepage = http://www.t1lib.org/;
+    license = with licenses; [ gpl2 lgpl2 ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/tachyon/darwin.patch b/nixpkgs/pkgs/development/libraries/tachyon/darwin.patch
new file mode 100644
index 000000000000..dbede586f073
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/tachyon/darwin.patch
@@ -0,0 +1,31 @@
+diff --git a/unix/Make-arch b/unix/Make-arch
+index 08afb85..822c4fc 100644
+--- a/unix/Make-arch
++++ b/unix/Make-arch
+@@ -924,7 +924,7 @@ macosx-thr:
+ 	$(MAKE) all \
+ 	"ARCH = macosx-thr" \
+ 	"CC = cc" \
+-	"CFLAGS = -Os -ffast-math -DBsd -DTHR -F/System/Library/Frameworks $(MISCFLAGS)" \
++	"CFLAGS = -Os -ffast-math -DBsd -DTHR $(MISCFLAGS)" \
+ 	"AR = ar" \
+ 	"ARFLAGS = r" \
+ 	"STRIP = strip" \
+@@ -946,7 +946,7 @@ macosx-x86-thr:
+ 	$(MAKE) all \
+ 	"ARCH = macosx-x86-thr" \
+ 	"CC = cc" \
+-	"CFLAGS = -O2 -ffast-math -DBsd -DTHR -F/System/Library/Frameworks $(MISCFLAGS)" \
++	"CFLAGS = -O2 -ffast-math -DBsd -DTHR $(MISCFLAGS)" \
+ 	"AR = ar" \
+ 	"ARFLAGS = r" \
+ 	"STRIP = strip" \
+@@ -957,7 +957,7 @@ macosx-x86-thr-ogl:
+ 	$(MAKE) all \
+ 	"ARCH = macosx-x86-thr-ogl" \
+ 	"CC = cc" \
+-	"CFLAGS = -O2 -ffast-math -DBsd -DTHR -I/usr/X11R6/include -F/System/Library/Frameworks $(MISCFLAGS) -DUSEOPENGL" \
++	"CFLAGS = -O2 -ffast-math -DBsd -DTHR -I/usr/X11R6/include $(MISCFLAGS) -DUSEOPENGL" \
+ 	"AR = ar" \
+ 	"ARFLAGS = r" \
+ 	"STRIP = strip" \
diff --git a/nixpkgs/pkgs/development/libraries/tachyon/default.nix b/nixpkgs/pkgs/development/libraries/tachyon/default.nix
new file mode 100644
index 000000000000..27ac0fdd5ff9
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/tachyon/default.nix
@@ -0,0 +1,74 @@
+{ stdenv
+, fetchurl
+, Carbon ? null
+, libjpeg ? null
+, libpng ? null
+, withJpegSupport ? true # support jpeg output
+, withPngSupport ? true # support png output
+}:
+
+assert withJpegSupport -> libjpeg != null;
+assert withPngSupport -> libpng != null;
+assert stdenv.isDarwin -> Carbon != null;
+
+stdenv.mkDerivation rec {
+  name = "tachyon-${version}";
+  version = "0.99b2";
+  src = fetchurl {
+    url = "http://jedi.ks.uiuc.edu/~johns/tachyon/files/${version}/${name}.tar.gz";
+    sha256 = "04m0bniszyg7ryknj8laj3rl5sspacw5nr45x59j2swcsxmdvn1v";
+  };
+  buildInputs = stdenv.lib.optionals stdenv.isDarwin [
+    Carbon
+  ] ++ stdenv.lib.optionals withJpegSupport [
+    libjpeg
+  ] ++ stdenv.lib.optionals withPngSupport [
+    libpng
+  ];
+  preBuild = ''
+    cd unix
+  '' + stdenv.lib.optionalString withJpegSupport ''
+    export USEJPEG=" -DUSEJPEG"
+    export JPEGLIB=" -ljpeg"
+  '' + stdenv.lib.optionalString withPngSupport ''
+    export USEPNG=" -DUSEPNG"
+    export PNGLIB=" -lpng -lz"
+  '';
+  arch = if stdenv.hostPlatform.system == "x86_64-linux"   then "linux-64-thr"  else
+         if stdenv.hostPlatform.system == "i686-linux"     then "linux-thr"     else
+         if stdenv.hostPlatform.system == "aarch64-linux"  then "linux-arm-thr" else
+         if stdenv.hostPlatform.system == "armv7l-linux"   then "linux-arm-thr" else
+         if stdenv.hostPlatform.system == "x86_64-darwin"  then "macosx-thr"    else
+         if stdenv.hostPlatform.system == "i686-darwin"    then "macosx-64-thr" else
+         if stdenv.hostPlatform.system == "i686-cygwin"    then "win32"         else
+         if stdenv.hostPlatform.system == "x86_64-freebsd" then "bsd"           else
+         if stdenv.hostPlatform.system == "x686-freebsd"   then "bsd"           else
+         throw "Don't know what arch to select for tachyon build";
+  makeFlags = "${arch}";
+  patches = [
+    # Remove absolute paths in Make-config (and unset variables so they can be set in preBuild)
+    ./no-absolute-paths.patch
+    # Include new targets (like arm)
+    ./make-archs.patch
+  ] ++
+  # Ensure looks for nix-provided Carbon, not system frameworks
+  stdenv.lib.optional stdenv.isDarwin ./darwin.patch;
+
+  installPhase = ''
+    cd ../compile/${arch}
+    mkdir -p "$out"/{bin,lib,include,share/doc/tachyon,share/tachyon}
+    cp tachyon "$out"/bin
+    cp libtachyon.* "$out/lib"
+    cd ../..
+    cp Changes Copyright README "$out/share/doc/tachyon"
+    cp -r scenes "$out/share/tachyon/scenes"
+  '';
+  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;
+    homepage = http://jedi.ks.uiuc.edu/~johns/tachyon/;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/tachyon/make-archs.patch b/nixpkgs/pkgs/development/libraries/tachyon/make-archs.patch
new file mode 100644
index 000000000000..cf83f8c8c31c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/tachyon/make-archs.patch
@@ -0,0 +1,37 @@
+diff --git a/unix/Make-arch b/unix/Make-arch
+index 08afb85..dbeb691 100644
+--- a/unix/Make-arch
++++ b/unix/Make-arch
+@@ -920,6 +920,15 @@ macosx:
+ 	"RANLIB = ranlib" \
+ 	"LIBS = -L. -ltachyon $(MISCLIB)"
+ 
++macosx-64:
++	$(MAKE) all \
++	"ARCH = macosx" \
++	"CFLAGS = -Os -m64 -ffast-math -DBsd $(MISCFLAGS)" \
++	"ARFLAGS = r" \
++	"STRIP = strip" \
++	"RANLIB = ranlib" \
++	"LIBS = -L. -ltachyon $(MISCLIB)"
++
+ macosx-thr:
+ 	$(MAKE) all \
+ 	"ARCH = macosx-thr" \
+@@ -1209,6 +1218,16 @@ linux-thr:
+ 	"RANLIB = ranlib" \
+ 	"LIBS = -L. -ltachyon $(MISCLIB) -lm -lpthread"
+ 
++# Linux Arm using gcc, with threads
++linux-arm-thr:
++	$(MAKE) all \
++	"ARCH = linux-arm-thr" \
++	"CFLAGS = -Wall -O3 -fomit-frame-pointer -ffast-math -DLinux -DTHR -D_REENTRANT $(MISCFLAGS)" \
++	"ARFLAGS = r" \
++	"STRIP = strip" \
++	"RANLIB = ranlib" \
++	"LIBS = -L. -ltachyon $(MISCLIB) -lm -lpthread"
++
+ # Linux x86 using gcc, threads, and OpenGL
+ linux-thr-ogl:
+ 	$(MAKE) all \
diff --git a/nixpkgs/pkgs/development/libraries/tachyon/no-absolute-paths.patch b/nixpkgs/pkgs/development/libraries/tachyon/no-absolute-paths.patch
new file mode 100644
index 000000000000..faa3810fb5c6
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/tachyon/no-absolute-paths.patch
@@ -0,0 +1,57 @@
+diff --git a/unix/Make-config b/unix/Make-config
+index ee4f388..c1d51d4 100644
+--- a/unix/Make-config
++++ b/unix/Make-config
+@@ -18,7 +18,7 @@
+ # Bourne Shell Configuration:
+ #   set SHELL=/bin/sh or wherever your bourne shell is
+ ##########################################################################
+-SHELL=/bin/sh
++# SHELL=/bin/sh
+ 
+ 
+ 
+@@ -30,7 +30,7 @@ SHELL=/bin/sh
+ 
+ # The following line should be set to -Ixxx where xxx is your X11 include path
+ # Sun puts X11 in /usr/openwin/xxx
+-X11INC= -I/usr/openwin/include
++# X11INC= -I/usr/openwin/include
+ 
+ # Others typically use /usr/X11 or /usr/X11R6
+ #X11INC= -I/usr/X11
+@@ -57,7 +57,7 @@ X11LIB= -lX11
+ ##########################################################################
+ 
+ # Standard MPICH installation location
+-MPIDIR=/usr/local/mpi
++# MPIDIR=/usr/local/mpi
+ 
+ # UMR CS Dept
+ #MPIDIR=/software/all/mpi
+@@ -108,9 +108,9 @@ MBOX=
+ #   http://www.ijg.org/files/
+ ##########################################################################
+ # Uncomment the following lines to disable JPEG support
+-USEJPEG=
+-JPEGINC=
+-JPEGLIB=
++# USEJPEG=
++# JPEGINC=
++# JPEGLIB=
+ 
+ # Uncomment the following lines to enable JPEG support
+ #USEJPEG= -DUSEJPEG
+@@ -128,9 +128,9 @@ JPEGLIB=
+ #   http://www.libpng.org/
+ ##########################################################################
+ # Uncomment the following lines to disable PNG support
+-USEPNG=
+-PNGINC=
+-PNGLIB=
++# USEPNG=
++# PNGINC=
++# PNGLIB=
+ 
+ # Uncomment the following lines to enable PNG support
+ #USEPNG= -DUSEPNG
diff --git a/nixpkgs/pkgs/development/libraries/taglib-extras/default.nix b/nixpkgs/pkgs/development/libraries/taglib-extras/default.nix
new file mode 100644
index 000000000000..b667e6047400
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/taglib-extras/default.nix
@@ -0,0 +1,22 @@
+{stdenv, fetchurl, cmake, taglib}:
+
+stdenv.mkDerivation rec {
+  name = "taglib-extras-1.0.1";
+  src = fetchurl {
+    url = "http://ftp.rz.uni-wuerzburg.de/pub/unix/kde/taglib-extras/1.0.1/src/${name}.tar.gz";
+    sha256 = "0cln49ws9svvvals5fzxjxlzqm0fzjfymn7yfp4jfcjz655nnm7y";
+  };
+  buildInputs = [ taglib ];
+  nativeBuildInputs = [ cmake ];
+
+  # Workaround for upstream bug https://bugs.kde.org/show_bug.cgi?id=357181
+  preConfigure = ''
+    sed -i -e 's/STRLESS/VERSION_LESS/g' cmake/modules/FindTaglib.cmake
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Additional taglib plugins";
+    platforms = platforms.unix;
+    license = licenses.lgpl2;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/taglib-sharp/default.nix b/nixpkgs/pkgs/development/libraries/taglib-sharp/default.nix
new file mode 100644
index 000000000000..86006806baa0
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/taglib-sharp/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchFromGitHub, autoreconfHook, which, pkgconfig, mono }:
+
+stdenv.mkDerivation rec {
+  name = "taglib-sharp-${version}";
+  version = "2.1.0.0";
+
+  src = fetchFromGitHub {
+    owner = "mono";
+    repo = "taglib-sharp";
+    rev = "taglib-sharp-${version}";
+    sha256 = "12pk4z6ag8w7kj6vzplrlasq5lwddxrww1w1ya5ivxrfki15h5cp";
+  };
+
+  nativeBuildInputs = [ pkgconfig autoreconfHook which ];
+  buildInputs = [ mono ];
+
+  dontStrip = true;
+
+  configureFlags = [ "--disable-docs" ];
+
+  meta = with stdenv.lib; {
+    description = "Library for reading and writing metadata in media files";
+    homepage = https://github.com/mono/taglib-sharp;
+    platforms = platforms.linux;
+    license = licenses.lgpl21;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/taglib/1.9.nix b/nixpkgs/pkgs/development/libraries/taglib/1.9.nix
new file mode 100644
index 000000000000..8992c7e75c05
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/taglib/1.9.nix
@@ -0,0 +1,22 @@
+{stdenv, fetchurl, zlib, cmake}:
+
+stdenv.mkDerivation rec {
+  name = "taglib-1.9.1";
+
+  src = fetchurl {
+    url = https://taglib.github.io/releases/taglib-1.9.1.tar.gz;
+    sha256 = "06n7gnbcqa3r6c9gv00y0y1r48dyyazm6yj403i7ma0r2k6p3lvj";
+  };
+
+  nativeBuildInputs = [ cmake ];
+
+  buildInputs = [ zlib ];
+
+  meta = {
+    homepage = https://taglib.org/;
+    repositories.git = git://github.com/taglib/taglib.git;
+    description = "A library for reading and editing the meta-data of several popular audio formats";
+    inherit (cmake.meta) platforms;
+    license = with stdenv.lib.licenses; [ lgpl21 mpl11 ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/taglib/default.nix b/nixpkgs/pkgs/development/libraries/taglib/default.nix
new file mode 100644
index 000000000000..a2cb103a1821
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/taglib/default.nix
@@ -0,0 +1,47 @@
+{stdenv, fetchurl, zlib, cmake, fetchpatch}:
+
+stdenv.mkDerivation rec {
+  name = "taglib-1.11.1";
+
+  src = fetchurl {
+    url = "http://taglib.org/releases/${name}.tar.gz";
+    sha256 = "0ssjcdjv4qf9liph5ry1kngam1y7zp8fzr9xv4wzzrma22kabldn";
+  };
+
+  patches = [
+    (fetchpatch {
+      # https://github.com/taglib/taglib/issues/829
+      name = "CVE-2017-12678.patch";
+      url = "https://github.com/taglib/taglib/commit/eb9ded1206f18.patch";
+      sha256 = "1bvpxsvmlpi3by7myzss9kkpdkv405612n8ff68mw1ambj8h1m90";
+    })
+
+    (fetchpatch {
+      # https://github.com/taglib/taglib/pull/869
+      name = "CVE-2018-11439.patch";
+      url = "https://github.com/taglib/taglib/commit/272648ccfcccae30e002ccf34a22e075dd477278.patch";
+      sha256 = "0p397qq4anvcm0p8xs68mxa8hg6dl07chg260lc6k2929m34xv72";
+    })
+  ];
+
+  nativeBuildInputs = [ cmake ];
+
+  buildInputs = [ zlib ];
+
+  cmakeFlags = [ "-DBUILD_SHARED_LIBS=ON" ];
+
+  meta = with stdenv.lib; {
+    homepage = http://taglib.org/;
+    repositories.git = git://github.com/taglib/taglib.git;
+    description = "A library for reading and editing audio file metadata.";
+    longDescription = ''
+      TagLib is a library for reading and editing the meta-data of several
+      popular audio formats. Currently it supports both ID3v1 and ID3v2 for MP3
+      files, Ogg Vorbis comments and ID3 tags and Vorbis comments in FLAC, MPC,
+      Speex, WavPack, TrueAudio, WAV, AIFF, MP4 and ASF files.
+    '';
+    license = with licenses; [ lgpl3 mpl11 ];
+    inherit (cmake.meta) platforms;
+    maintainers = with maintainers; [ ttuegel ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/talloc/default.nix b/nixpkgs/pkgs/development/libraries/talloc/default.nix
new file mode 100644
index 000000000000..5a8ebe84ba69
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/talloc/default.nix
@@ -0,0 +1,41 @@
+{ stdenv, fetchurl, python, pkgconfig, readline, libxslt
+, docbook_xsl, docbook_xml_dtd_42, fixDarwinDylibNames
+, wafHook
+}:
+
+stdenv.mkDerivation rec {
+  name = "talloc-2.1.14";
+
+  src = fetchurl {
+    url = "mirror://samba/talloc/${name}.tar.gz";
+    sha256 = "1kk76dyav41ip7ddbbf04yfydb4jvywzi2ps0z2vla56aqkn11di";
+  };
+
+  nativeBuildInputs = [ pkgconfig fixDarwinDylibNames python wafHook
+                        docbook_xsl docbook_xml_dtd_42 ];
+  buildInputs = [ readline libxslt ];
+
+  wafPath = "buildtools/bin/waf";
+
+  wafConfigureFlags = [
+    "--enable-talloc-compat1"
+    "--bundled-libraries=NONE"
+    "--builtin-libraries=replace"
+  ];
+
+  # this must not be exported before the ConfigurePhase otherwise waf whines
+  preBuild = stdenv.lib.optionalString stdenv.hostPlatform.isMusl ''
+    export NIX_CFLAGS_LINK="-no-pie -shared";
+  '';
+
+  postInstall = ''
+    ${stdenv.cc.targetPrefix}ar q $out/lib/libtalloc.a bin/default/talloc_[0-9]*.o
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Hierarchical pool based memory allocator with destructors";
+    homepage = https://tdb.samba.org/;
+    license = licenses.gpl3;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/tbb/default.nix b/nixpkgs/pkgs/development/libraries/tbb/default.nix
new file mode 100644
index 000000000000..b406e792d165
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/tbb/default.nix
@@ -0,0 +1,45 @@
+{ stdenv, fetchFromGitHub, compiler ? if stdenv.cc.isClang then "clang" else null, stdver ? null }:
+
+with stdenv.lib; stdenv.mkDerivation rec {
+  name = "tbb-${version}";
+  version = "2019_U7";
+
+  src = fetchFromGitHub {
+    owner = "01org";
+    repo = "tbb";
+    rev = version;
+    sha256 = "0hf8vkb1g2dqihqw7fzhc90i1p7yvp45gbamj0mnnhffz2ablz1b";
+  };
+
+  makeFlags = concatStringsSep " " (
+    optional (compiler != null) "compiler=${compiler}" ++
+    optional (stdver != null) "stdver=${stdver}"
+  );
+
+  patches = stdenv.lib.optional stdenv.hostPlatform.isMusl ./glibc-struct-mallinfo.patch;
+
+  installPhase = ''
+    mkdir -p $out/lib
+    cp "build/"*release*"/"*${stdenv.hostPlatform.extensions.sharedLibrary}* $out/lib/
+    mv include $out/
+    rm $out/include/index.html
+  '';
+
+  enableParallelBuilding = true;
+
+  meta = {
+    description = "Intel Thread Building Blocks C++ Library";
+    homepage = "http://threadingbuildingblocks.org/";
+    license = licenses.asl20;
+    longDescription = ''
+      Intel Threading Building Blocks offers a rich and complete approach to
+      expressing parallelism in a C++ program. It is a library that helps you
+      take advantage of multi-core processor performance without having to be a
+      threading expert. Intel TBB is not just a threads-replacement library. It
+      represents a higher-level, task-based parallelism that abstracts platform
+      details and threading mechanisms for scalability and performance.
+    '';
+    platforms = with platforms; linux ++ darwin;
+    maintainers = with maintainers; [ thoughtpolice dizfer ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/tbb/glibc-struct-mallinfo.patch b/nixpkgs/pkgs/development/libraries/tbb/glibc-struct-mallinfo.patch
new file mode 100644
index 000000000000..64056ecb1462
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/tbb/glibc-struct-mallinfo.patch
@@ -0,0 +1,43 @@
+From b577153a10c98f4e13405dc93ea2ab1a7b990e07 Mon Sep 17 00:00:00 2001
+From: David Huffman <storedbox+alpine@outlook.com>
+Date: Wed, 6 Jan 2016 07:09:30 -0500
+Subject: [PATCH] hard-code glibc's definition of struct mallinfo
+
+---
+ src/tbbmalloc/proxy.h | 20 ++++++++++++++++++++
+ 1 file changed, 20 insertions(+)
+
+diff --git a/src/tbbmalloc/proxy.h b/src/tbbmalloc/proxy.h
+index 781cadc..e1ea1ae 100644
+--- a/src/tbbmalloc/proxy.h
++++ b/src/tbbmalloc/proxy.h
+@@ -32,6 +32,26 @@
+ 
+ #include <stddef.h>
+ 
++// The following definition was taken from /usr/include/malloc.h as provided by
++// the glibc-devel-2.19-17.4.x86_64 package on openSUSE Leap 42.1; it is
++// made available under the GNU Lesser General Public License v2.1 or later.
++// See <https://www.gnu.org/licenses>.
++//
++// Copyright (C) 1996-2014 Free Software Foundation, Inc.
++struct mallinfo
++{
++  int arena;    /* non-mmapped space allocated from system */
++  int ordblks;  /* number of free chunks */
++  int smblks;   /* number of fastbin blocks */
++  int hblks;    /* number of mmapped regions */
++  int hblkhd;   /* space in mmapped regions */
++  int usmblks;  /* maximum total allocated space */
++  int fsmblks;  /* space available in freed fastbin blocks */
++  int uordblks; /* total allocated space */
++  int fordblks; /* total free space */
++  int keepcost; /* top-most, releasable (via malloc_trim) space */
++};
++
+ extern "C" {
+     void * scalable_malloc(size_t size);
+     void * scalable_calloc(size_t nobj, size_t size);
+-- 
+2.6.2
+
diff --git a/nixpkgs/pkgs/development/libraries/tclap/default.nix b/nixpkgs/pkgs/development/libraries/tclap/default.nix
new file mode 100644
index 000000000000..293baa492c56
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/tclap/default.nix
@@ -0,0 +1,17 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "tclap-1.2.2";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/tclap/${name}.tar.gz";
+    sha256 = "0dsqvsgzam3mypj2ladn6v1yjq9zd47p3lg21jx6kz5azkkkn0gm";
+  };
+
+  meta = with stdenv.lib; {
+    homepage = http://tclap.sourceforge.net/;
+    description = "Templatized C++ Command Line Parser Library";
+    platforms = platforms.all;
+    license = licenses.mit;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/tcllib/default.nix b/nixpkgs/pkgs/development/libraries/tcllib/default.nix
new file mode 100644
index 000000000000..24b1d477b8a0
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/tcllib/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchurl, tcl }:
+
+stdenv.mkDerivation rec {
+  name = "tcllib-${version}";
+  version = "1.19";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/tcllib/tcllib-${version}.tar.gz";
+    sha256 = "173abxaazdmf210v651708ab6h7xhskvd52krxk6ifam337qgzh1";
+  };
+
+  passthru = {
+    libPrefix = "tcllib${version}";
+  };
+
+  buildInputs = [ tcl ];
+
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/tcltls/default.nix b/nixpkgs/pkgs/development/libraries/tcltls/default.nix
new file mode 100644
index 000000000000..4e1f0bcab035
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/tcltls/default.nix
@@ -0,0 +1,34 @@
+{ stdenv, fetchurl, tcl, openssl }:
+
+stdenv.mkDerivation rec {
+  name = "tcltls-${version}";
+  version = "1.6.7";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/tls/tls${version}-src.tar.gz";
+    sha256 = "1f53sfcnrridjl5ayrq1xrqkahs8khf8c3d0m2brndbhahzdw6ai";
+  };
+
+  buildInputs = [ tcl openssl ];
+
+  configureFlags = [
+    "--with-tcl=${tcl}/lib"
+    "--with-tclinclude=${tcl}/include"
+    "--with-ssl-dir=${openssl.dev}"
+  ];
+
+  preConfigure = ''
+    configureFlags="--exec_prefix=$prefix $configureFlags"
+  '';
+
+  passthru = {
+    libPrefix = "tls${version}";
+  };
+
+  meta = {
+    homepage = http://tls.sourceforge.net/;
+    description = "An OpenSSL / RSA-bsafe Tcl extension";
+    license = stdenv.lib.licenses.tcltk;
+    platforms = stdenv.lib.platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/tclx/default.nix b/nixpkgs/pkgs/development/libraries/tclx/default.nix
new file mode 100644
index 000000000000..1cb063773998
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/tclx/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchurl, tcl }:
+
+stdenv.mkDerivation rec {
+  name = "tclx-${version}.${patch}";
+  version = "8.4";
+  patch = "1";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/tclx/tclx${version}.${patch}.tar.bz2";
+    sha256 = "1v2qwzzidz0is58fd1p7wfdbscxm3ip2wlbqkj5jdhf6drh1zd59";
+  };
+
+  passthru = {
+    libPrefix = ""; # Using tclx${version} did not work
+  };
+
+  buildInputs = [ tcl ];
+
+  configureFlags = [ "--with-tcl=${tcl}/lib" "--exec-prefix=\${prefix}" ];
+
+  meta = {
+    homepage = http://tclx.sourceforge.net/;
+    description = "Tcl extensions";
+    license = stdenv.lib.licenses.tcltk;
+    maintainers = with stdenv.lib.maintainers; [ kovirobi ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/tdb/default.nix b/nixpkgs/pkgs/development/libraries/tdb/default.nix
new file mode 100644
index 000000000000..4df80140aa5d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/tdb/default.nix
@@ -0,0 +1,37 @@
+{ stdenv, fetchurl, wafHook, pkgconfig, readline, libxslt
+, docbook_xsl, docbook_xml_dtd_42
+}:
+
+stdenv.mkDerivation rec {
+  name = "tdb-1.3.16";
+
+  src = fetchurl {
+    url = "mirror://samba/tdb/${name}.tar.gz";
+    sha256 = "1ibcz466xwk1x6xvzlgzd5va4lyrjzm3rnjak29kkwk7cmhw4gva";
+  };
+
+  nativeBuildInputs = [ pkgconfig wafHook ];
+  buildInputs = [
+    readline libxslt docbook_xsl docbook_xml_dtd_42
+  ];
+
+  wafPath = "buildtools/bin/waf";
+
+  wafConfigureFlags = [
+    "--bundled-libraries=NONE"
+    "--builtin-libraries=replace"
+  ];
+
+  meta = with stdenv.lib; {
+    description = "The trivial database";
+    longDescription = ''
+      TDB is a Trivial Database. In concept, it is very much like GDBM,
+      and BSD's DB except that it allows multiple simultaneous writers
+      and uses locking internally to keep writers from trampling on each
+      other. TDB is also extremely small.
+    '';
+    homepage = https://tdb.samba.org/;
+    license = licenses.lgpl3Plus;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/tecla/default.nix b/nixpkgs/pkgs/development/libraries/tecla/default.nix
new file mode 100644
index 000000000000..e835d1d86fdc
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/tecla/default.nix
@@ -0,0 +1,19 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "tecla-1.6.3";
+
+  src = fetchurl {
+    url = "http://www.astro.caltech.edu/~mcs/tecla/lib${name}.tar.gz";
+    sha256 = "06pfq5wa8d25i9bdjkp4xhms5101dsrbg82riz7rz1a0a32pqxgj";
+  };
+
+  meta = {
+    homepage = http://www.astro.caltech.edu/~mcs/tecla/;
+    description = "Command-line editing library";
+    license = "as-is";
+
+    platforms = stdenv.lib.platforms.unix;
+    maintainers = [ stdenv.lib.maintainers.peti ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/telepathy/farstream/default.nix b/nixpkgs/pkgs/development/libraries/telepathy/farstream/default.nix
new file mode 100644
index 000000000000..1247d9ffa843
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/telepathy/farstream/default.nix
@@ -0,0 +1,21 @@
+{ stdenv, fetchurl, pkgconfig, telepathy-glib, farstream, dbus-glib }:
+
+stdenv.mkDerivation rec {
+  name = "${pname}-0.6.2";
+  pname = "telepathy-farstream";
+
+  src = fetchurl {
+    url = "https://telepathy.freedesktop.org/releases/${pname}/${name}.tar.gz";
+    sha256 = "02ky12bb92prr5f6xmvmfq4yz2lj33li6nj4829a98hk5pr9k83g";
+  };
+
+  propagatedBuildInputs = [ dbus-glib telepathy-glib farstream ];
+  nativeBuildInputs = [ pkgconfig ];
+
+  meta = with stdenv.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;
+    license = licenses.lgpl21;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/telepathy/glib/default.nix b/nixpkgs/pkgs/development/libraries/telepathy/glib/default.nix
new file mode 100644
index 000000000000..7436da503190
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/telepathy/glib/default.nix
@@ -0,0 +1,36 @@
+{ stdenv, fetchurl, dbus-glib, glib, python2, pkgconfig, libxslt
+, gobject-introspection, vala, glibcLocales }:
+
+stdenv.mkDerivation rec {
+  name = "telepathy-glib-0.24.1";
+
+  outputs = [ "out" "dev" ];
+
+  src = fetchurl {
+    url = "${meta.homepage}/releases/telepathy-glib/${name}.tar.gz";
+    sha256 = "1symyzbjmxvksn2ifdkk50lafjm2llf2sbmky062gq2pz3cg23cy";
+  };
+
+  configureFlags = [
+    "--enable-vala-bindings"
+  ];
+  LC_ALL = "en_US.UTF-8";
+  propagatedBuildInputs = [ dbus-glib glib ];
+
+  nativeBuildInputs = [ pkgconfig libxslt gobject-introspection vala ];
+  buildInputs = [ glibcLocales python2 ];
+
+  enableParallelBuilding = true;
+
+  preConfigure = ''
+    substituteInPlace telepathy-glib/telepathy-glib.pc.in --replace Requires.private Requires
+  '';
+
+  passthru.python = python2;
+
+  meta = with stdenv.lib; {
+    homepage = https://telepathy.freedesktop.org;
+    platforms = platforms.unix;
+    license = with licenses; [ bsd2 bsd3 lgpl21Plus ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/telepathy/qt/default.nix b/nixpkgs/pkgs/development/libraries/telepathy/qt/default.nix
new file mode 100644
index 000000000000..d14010c857e4
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/telepathy/qt/default.nix
@@ -0,0 +1,40 @@
+{ stdenv, fetchurl, cmake, qtbase, pkgconfig, python2Packages, dbus-glib, dbus
+, telepathy-farstream, telepathy-glib, fetchpatch }:
+
+let
+  inherit (python2Packages) python dbus-python;
+in stdenv.mkDerivation rec {
+  name = "telepathy-qt-0.9.7";
+
+  src = fetchurl {
+    url = "https://telepathy.freedesktop.org/releases/telepathy-qt/${name}.tar.gz";
+    sha256 = "0krxd4hhfx6r0ja19wh3848j7gn1rv8jrnakgmkbmi7bww5x7fi1";
+  };
+
+  nativeBuildInputs = [ cmake pkgconfig python ];
+  propagatedBuildInputs = [ qtbase telepathy-farstream telepathy-glib ];
+  buildInputs = [ dbus-glib ];
+  checkInputs = [ dbus.daemon dbus-python ];
+
+  patches = [
+    # https://github.com/TelepathyIM/telepathy-qt/issues/25
+    (fetchpatch {
+      url = https://github.com/TelepathyIM/telepathy-qt/commit/d654dc70dbec7097e96e6d96ca74ab1b5b00ef8c.patch;
+      sha256 = "1jzd9b9rqh3c8xlq8dr7c0r8aabzf5ywv2gpkk6phh3xwngzrfbh";
+    })
+  ];
+
+  # 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";
+
+  enableParallelBuilding = true;
+  doCheck = false; # giving up for now
+
+  meta = with stdenv.lib; {
+    description = "Telepathy Qt bindings";
+    homepage = https://telepathy.freedesktop.org/components/telepathy-qt/;
+    license = licenses.lgpl21;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/template-glib/default.nix b/nixpkgs/pkgs/development/libraries/template-glib/default.nix
new file mode 100644
index 000000000000..4314abd2548a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/template-glib/default.nix
@@ -0,0 +1,36 @@
+{ stdenv, fetchurl, meson, ninja, pkgconfig, glib, gobject-introspection, flex, bison, vala, gettext, gnome3, gtk-doc, docbook_xsl, docbook_xml_dtd_43 }:
+let
+  version = "3.32.0";
+  pname = "template-glib";
+in
+stdenv.mkDerivation {
+  name = "${pname}-${version}";
+
+  outputs = [ "out" "dev" "devdoc" ];
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    sha256 = "1g0zx0sxpw8kqp7p3sgl9kngaqrg9xl6cir24nrahks0vgsk98rr";
+  };
+
+  buildInputs = [ meson ninja pkgconfig gettext flex bison vala glib gtk-doc docbook_xsl docbook_xml_dtd_43 ];
+  nativeBuildInputs = [ glib gobject-introspection ];
+
+  mesonFlags = [
+    "-Denable_gtk_doc=true"
+  ];
+
+  passthru = {
+    updateScript = gnome3.updateScript {
+      packageName = pname;
+    };
+  };
+
+  meta = with stdenv.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;
+    maintainers = gnome3.maintainers;
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/tepl/default.nix b/nixpkgs/pkgs/development/libraries/tepl/default.nix
new file mode 100644
index 000000000000..0ca382baeca3
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/tepl/default.nix
@@ -0,0 +1,42 @@
+{ stdenv, fetchurl
+, amtk, gnome3, gtk3, gtksourceview4, libuchardet, libxml2, pkgconfig }:
+let
+  version = "4.2.0";
+  pname = "tepl";
+in stdenv.mkDerivation {
+  name = "${pname}-${version}";
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    sha256 = "1kcwcr72dv3xwi2ni579c9raa0cnbazfnmy6mgapzn6dir1d8fc8";
+  };
+
+  nativeBuildInputs = [
+    pkgconfig
+  ];
+
+  buildInputs = [
+    amtk
+    libxml2
+    gtksourceview4
+    libuchardet
+    gtk3
+  ];
+
+  doCheck = false;
+  # TODO: one test fails because of
+  # (./test-file-metadata:20931): Tepl-WARNING **: 14:41:36.942: GVfs metadata
+  # is not supported. Fallback to TeplMetadataManager. Either GVfs is not
+  # correctly installed or GVfs metadata are not supported on this platform. In
+  # the latter case, you should configure Tepl with --disable-gvfs-metadata.
+
+  passthru.updateScript = gnome3.updateScript { packageName = pname; };
+
+  meta = with stdenv.lib; {
+    homepage = https://wiki.gnome.org/Projects/Tepl;
+    description = "Text editor product line";
+    maintainers = [ maintainers.manveru ];
+    license = licenses.lgpl21Plus;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/termbox/default.nix b/nixpkgs/pkgs/development/libraries/termbox/default.nix
new file mode 100644
index 000000000000..eefc976a62b0
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/termbox/default.nix
@@ -0,0 +1,31 @@
+{ stdenv, fetchFromGitHub, python3, wafHook, fetchpatch }:
+
+stdenv.mkDerivation rec {
+  name = "termbox-${version}";
+  version = "1.1.2";
+  src = fetchFromGitHub {
+    owner = "nsf";
+    repo = "termbox";
+    rev = "v${version}";
+    sha256 = "08yqxzb8fny8806p7x8a6f3phhlbfqdd7dhkv25calswj7w1ssvs";
+  };
+
+  # patch which updates the `waf` version used to build
+  # to make the package buildable on Python 3.7
+  patches = [
+    (fetchpatch {
+      url = https://github.com/nsf/termbox/commit/6fe63ac3ad63dc2c3ac45b770541cc8b7a1d2db7.patch;
+      sha256 = "1s5747v51sdwvpsg6k9y1j60yn9f63qnylkgy8zrsifjzzd5fzl6";
+    })
+  ];
+
+  nativeBuildInputs = [ python3 wafHook ];
+
+  meta = with stdenv.lib; {
+    description = "Library for writing text-based user interfaces";
+    license = licenses.mit;
+    homepage = "https://github.com/nsf/termbox#readme";
+    downloadPage = "https://github.com/nsf/termbox/releases";
+    maintainers = with maintainers; [ fgaz ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/tevent/default.nix b/nixpkgs/pkgs/development/libraries/tevent/default.nix
new file mode 100644
index 000000000000..9f94f4f7217d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/tevent/default.nix
@@ -0,0 +1,33 @@
+{ stdenv, fetchurl, python, pkgconfig, readline, talloc
+, libxslt, docbook_xsl, docbook_xml_dtd_42
+}:
+
+stdenv.mkDerivation rec {
+  name = "tevent-0.9.37";
+
+  src = fetchurl {
+    url = "mirror://samba/tevent/${name}.tar.gz";
+    sha256 = "1q77vbjic2bb79li2a54ffscnrnwwww55fbpry2kgh7acpnlb0qn";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [
+    python readline talloc libxslt docbook_xsl docbook_xml_dtd_42
+  ];
+
+  preConfigure = ''
+    sed -i 's,#!/usr/bin/env python,#!${python}/bin/python,g' buildtools/bin/waf
+  '';
+
+  configureFlags = [
+    "--bundled-libraries=NONE"
+    "--builtin-libraries=replace"
+  ];
+
+  meta = with stdenv.lib; {
+    description = "An event system based on the talloc memory management library";
+    homepage = https://tevent.samba.org/;
+    license = licenses.lgpl3Plus;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/theft/default.nix b/nixpkgs/pkgs/development/libraries/theft/default.nix
new file mode 100644
index 000000000000..881f9c033a38
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/theft/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchFromGitHub }:
+
+stdenv.mkDerivation rec {
+  version = "0.4.4";
+  name = "theft-${version}";
+
+  src = fetchFromGitHub {
+    owner = "silentbicycle";
+    repo = "theft";
+    rev = "v${version}";
+    sha256 = "1csdhnb10k7vsyd44vjpg430nf6a909wj8af2zawdkbvnxn5wxc4";
+  };
+
+  preConfigure = "patchShebangs ./scripts/mk_bits_lut";
+
+  doCheck = true;
+  checkTarget = "test";
+  
+  installFlags = [ "PREFIX=$(out)" ];
+  postInstall = "install -m644 vendor/greatest.h $out/include/";
+  
+  meta = {
+    description = "A C library for property-based testing";
+    platforms = stdenv.lib.platforms.linux;
+    homepage = "https://github.com/silentbicycle/theft/";
+    license = stdenv.lib.licenses.isc;
+    maintainers = [ stdenv.lib.maintainers.kquick ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/thrift/default.nix b/nixpkgs/pkgs/development/libraries/thrift/default.nix
new file mode 100644
index 000000000000..92cc76273ba1
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/thrift/default.nix
@@ -0,0 +1,39 @@
+{ stdenv, fetchurl, boost, zlib, libevent, openssl, python, pkgconfig, bison
+, flex, twisted
+}:
+
+stdenv.mkDerivation rec {
+  name = "thrift-${version}";
+  version = "0.12.0";
+
+  src = fetchurl {
+    url = "https://archive.apache.org/dist/thrift/${version}/${name}.tar.gz";
+    sha256 = "0a04v7dgm1qzgii7v0sisnljhxc9xpq2vxkka60scrdp6aahjdn3";
+  };
+
+  #enableParallelBuilding = true; problems on hydra
+
+  # Workaround to make the python wrapper not drop this package:
+  # pythonFull.buildEnv.override { extraLibs = [ thrift ]; }
+  pythonPath = [];
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [
+    boost zlib libevent openssl python bison flex twisted
+  ];
+
+  preConfigure = "export PY_PREFIX=$out";
+
+  # TODO: package boost-test, so we can run the test suite. (Currently it fails
+  # to find libboost_unit_test_framework.a.)
+  configureFlags = [ "--enable-tests=no" ];
+  doCheck = false;
+
+  meta = with stdenv.lib; {
+    description = "Library for scalable cross-language services";
+    homepage = http://thrift.apache.org/;
+    license = licenses.asl20;
+    platforms = platforms.linux ++ platforms.darwin;
+    maintainers = [ maintainers.bjornfor ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/ti-rpc/default.nix b/nixpkgs/pkgs/development/libraries/ti-rpc/default.nix
new file mode 100644
index 000000000000..d67d76185745
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/ti-rpc/default.nix
@@ -0,0 +1,53 @@
+{ fetchurl, stdenv, autoreconfHook, libkrb5 }:
+
+stdenv.mkDerivation rec {
+  name = "libtirpc-1.1.4";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/libtirpc/${name}.tar.bz2";
+    sha256 = "07anqypf7c719x9y683qz65cxllmzlgmlab2hlahrqcj4bq2k99c";
+  };
+
+  outputs = [ "out" "dev" ];
+
+  postPatch = ''
+    sed '1i#include <stdint.h>' -i src/xdr_sizeof.c
+  '' + stdenv.lib.optionalString stdenv.hostPlatform.isMusl ''
+    substituteInPlace tirpc/rpc/types.h \
+      --replace '#if defined __APPLE_CC__ || defined __FreeBSD__' \
+                '#if defined __APPLE_CC__ || defined __FreeBSD__ || !defined __GLIBC__'
+  '';
+
+  KRB5_CONFIG = "${libkrb5.dev}/bin/krb5-config";
+  nativeBuildInputs = [ autoreconfHook ];
+  propagatedBuildInputs = [ libkrb5 ];
+
+  preConfigure = ''
+    sed -es"|/etc/netconfig|$out/etc/netconfig|g" -i doc/Makefile.in tirpc/netconfig.h
+  '';
+
+  preInstall = "mkdir -p $out/etc";
+
+  doCheck = true;
+
+  meta = with stdenv.lib; {
+    homepage = https://sourceforge.net/projects/libtirpc/;
+    description = "The transport-independent Sun RPC implementation (TI-RPC)";
+    license = licenses.bsd3;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ abbradar ];
+    longDescription = ''
+       Currently, NFS commands use the SunRPC routines provided by the
+       glibc.  These routines do not support IPv6 addresses.  Ulrich
+       Drepper, who is the maintainer of the glibc, refuses any change in
+       the glibc concerning the RPC.  He wants the RPC to become a separate
+       library.  Other OS (NetBSD, FreeBSD, Solarix, HP-UX, AIX) have
+       migrated their SunRPC library to a TI-RPC (Transport Independent
+       RPC) implementation.  This implementation allows the support of
+       other transports than UDP and TCP over IPv4.  FreeBSD provides a
+       TI-RPC library ported from NetBSD with improvements.  This library
+       already supports IPv6.  So, the FreeBSD release 5.2.1 TI-RPC has
+       been ported to replace the SunRPC of the glibc.
+    '';
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/ticpp/default.nix b/nixpkgs/pkgs/development/libraries/ticpp/default.nix
new file mode 100644
index 000000000000..e46bf2418bcf
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/ticpp/default.nix
@@ -0,0 +1,35 @@
+{ stdenv
+, fetchFromGitHub
+, cmake
+}:
+
+stdenv.mkDerivation {
+  pname = "ticpp";
+  version = "unstable-2019-01-09";
+
+  src = fetchFromGitHub {
+    owner = "wxFormBuilder";
+    repo = "ticpp";
+    rev = "eb79120ea16b847ce9f483a298a394050f463d6b";
+    sha256 = "sha256:0xk4cy0xbkr6326cqd1vd6b2x0rfsx4iz2sq8f5jz3yl3slxgjm2";
+  };
+
+  nativeBuildInputs = [ cmake ];
+
+  cmakeFlags = [ "-DBUILD_TICPP_DLL=1" ];
+
+  installPhase = ''
+    cd ..
+    mkdir -p $out/lib
+    install build/*.{a,so} $out/lib
+    mkdir -p $out/include
+    install *.h $out/include
+  '';
+
+  meta = {
+    description = "Interface to TinyXML";
+    license = stdenv.lib.licenses.mit;
+    homepage = https://github.com/wxFormBuilder/ticpp;
+  };
+
+}
diff --git a/nixpkgs/pkgs/development/libraries/tidyp/default.nix b/nixpkgs/pkgs/development/libraries/tidyp/default.nix
new file mode 100644
index 000000000000..51dabbd2beb7
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/tidyp/default.nix
@@ -0,0 +1,20 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "tidyp-1.04";
+
+  src = fetchurl {
+    url = "https://github.com/downloads/petdance/tidyp/${name}.tar.gz";
+    sha256 = "0f5ky0ih4vap9c6j312jn73vn8m2bj69pl2yd3a5nmv35k9zmc10";
+  };
+
+  hardeningDisable = [ "format" ];
+
+  meta = with stdenv.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;
+    maintainers = with maintainers; [ pSub ];
+    license = licenses.bsd3;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/tinyxml-2/default.nix b/nixpkgs/pkgs/development/libraries/tinyxml-2/default.nix
new file mode 100644
index 000000000000..7f1b3ebcbf5b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/tinyxml-2/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, fetchFromGitHub, cmake }:
+
+stdenv.mkDerivation rec {
+  name = "tinyxml-2-${version}";
+  version = "6.0.0";
+
+  src = fetchFromGitHub {
+    repo = "tinyxml2";
+    owner = "leethomason";
+    rev = version;
+    sha256 = "031fmhpah449h3rkyamzzdpzccrrfrvjb4qn6vx2vjm47jwc54qv";
+  };
+
+  nativeBuildInputs = [ cmake ];
+
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/tinyxml/2.6.2-add-pkgconfig.patch b/nixpkgs/pkgs/development/libraries/tinyxml/2.6.2-add-pkgconfig.patch
new file mode 100644
index 000000000000..ca89685a458f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/tinyxml/2.6.2-add-pkgconfig.patch
@@ -0,0 +1,13 @@
+--- a/tinyxml.pc	1970-01-01 01:00:00.000000000 +0100
++++ b/tinyxml.pc	2012-12-29 08:52:07.512266072 +0100
+@@ -0,0 +1,10 @@
++prefix=@out@
++exec_prefix=${prefix}
++libdir=${exec_prefix}/lib
++includedir=${prefix}/include
++
++Name: TinyXML
++Description: A simple, small, C++ XML parser
++Version: @version@
++Libs: -L${libdir} -ltinyxml
++Cflags: -I${includedir}
diff --git a/nixpkgs/pkgs/development/libraries/tinyxml/2.6.2-cxx.patch b/nixpkgs/pkgs/development/libraries/tinyxml/2.6.2-cxx.patch
new file mode 100644
index 000000000000..e55d0be43bcc
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/tinyxml/2.6.2-cxx.patch
@@ -0,0 +1,17 @@
+diff -u a/Makefile b/Makefile
+--- a/Makefile	2011-05-14 22:24:57.000000000 -0400
++++ b/Makefile	2016-04-01 14:53:05.000000000 -0400
+@@ -19,9 +19,9 @@
+ 
+ #****************************************************************************
+ 
+-CC     := gcc
+-CXX    := g++
+-LD     := g++
++CC     ?= gcc
++CXX    ?= g++
++LD     ?= g++
+ AR     := ar rc
+ RANLIB := ranlib
+ 
+Common subdirectories: a/docs and b/docs
diff --git a/nixpkgs/pkgs/development/libraries/tinyxml/2.6.2-entity.patch b/nixpkgs/pkgs/development/libraries/tinyxml/2.6.2-entity.patch
new file mode 100644
index 000000000000..3164261291ba
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/tinyxml/2.6.2-entity.patch
@@ -0,0 +1,64 @@
+? entity.patch
+Index: a/tinyxml.cpp
+===================================================================
+RCS file: b/tinyxml.cpp,v
+retrieving revision 1.105
+diff -u -r1.105 a/tinyxml.cpp
+--- tinyxml.cpp	5 Jun 2010 19:06:57 -0000	1.105
++++ tinyxml.cpp	19 Jul 2010 21:24:16 -0000
+@@ -57,30 +57,7 @@
+ 	{
+ 		unsigned char c = (unsigned char) str[i];
+ 
+-		if (    c == '&' 
+-		     && i < ( (int)str.length() - 2 )
+-			 && str[i+1] == '#'
+-			 && str[i+2] == 'x' )
+-		{
+-			// Hexadecimal character reference.
+-			// Pass through unchanged.
+-			// &#xA9;	-- copyright symbol, for example.
+-			//
+-			// The -1 is a bug fix from Rob Laveaux. It keeps
+-			// an overflow from happening if there is no ';'.
+-			// There are actually 2 ways to exit this loop -
+-			// while fails (error case) and break (semicolon found).
+-			// However, there is no mechanism (currently) for
+-			// this function to return an error.
+-			while ( i<(int)str.length()-1 )
+-			{
+-				outString->append( str.c_str() + i, 1 );
+-				++i;
+-				if ( str[i] == ';' )
+-					break;
+-			}
+-		}
+-		else if ( c == '&' )
++		if ( c == '&' )
+ 		{
+ 			outString->append( entity[0].str, entity[0].strLength );
+ 			++i;
+Index: a/xmltest.cpp
+===================================================================
+RCS file: b/xmltest.cpp,v
+retrieving revision 1.89
+diff -u -r1.89 a/xmltest.cpp
+--- xmltest.cpp	5 Jun 2010 17:41:52 -0000	1.89
++++ xmltest.cpp	19 Jul 2010 21:24:16 -0000
+@@ -1340,6 +1340,16 @@
+ 		}*/
+ 	}
+ 
++	#ifdef TIXML_USE_STL
++	{
++		TiXmlDocument xml;
++		xml.Parse("<foo>foo&amp;#xa+bar</foo>");
++		std::string str;
++		str << xml;
++		XmlTest( "Entity escaping", "<foo>foo&amp;#xa+bar</foo>", str.c_str() );
++	}
++	#endif
++
+ 	/*  1417717 experiment
+ 	{
+ 		TiXmlDocument xml;
diff --git a/nixpkgs/pkgs/development/libraries/tinyxml/2.6.2.nix b/nixpkgs/pkgs/development/libraries/tinyxml/2.6.2.nix
new file mode 100644
index 000000000000..d61076e569bc
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/tinyxml/2.6.2.nix
@@ -0,0 +1,79 @@
+{ stdenv, fetchurl, unzip }:
+
+let
+  version = "2.6.2";
+  SHLIB_EXT = stdenv.hostPlatform.extensions.sharedLibrary;
+in stdenv.mkDerivation {
+  name = "tinyxml-${version}";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/project/tinyxml/tinyxml/${version}/tinyxml_2_6_2.zip";
+    sha256 = "04nmw6im2d1xp12yir8va93xns5iz816pwi25n9cql3g3i8bjsxc";
+  };
+
+  patches = [
+    # add pkgconfig file
+    ./2.6.2-add-pkgconfig.patch
+
+    # https://sourceforge.net/tracker/index.php?func=detail&aid=3031828&group_id=13559&atid=313559
+    ./2.6.2-entity.patch
+
+    # Use CC, CXX, and LD from environment
+    ./2.6.2-cxx.patch
+  ];
+
+  preConfigure = "export LD=${if stdenv.isDarwin then "clang++" else "g++"}";
+
+  hardeningDisable = [ "format" ];
+
+  NIX_CFLAGS_COMPILE =
+    stdenv.lib.optional stdenv.isDarwin "-mmacosx-version-min=10.9";
+
+  buildInputs = [ unzip ];
+  buildPhase = ''
+    # use STL (xbmc requires it)
+    sed '1i#define TIXML_USE_STL 1' -i tinyxml.h
+    sed '1i#define TIXML_USE_STL 1' -i xmltest.cpp
+
+    # build xmltest
+    make
+
+    # build the lib as a shared library
+    ''${CXX} -Wall -O2 -shared -fpic tinyxml.cpp \
+    tinyxmlerror.cpp tinyxmlparser.cpp      \
+    tinystr.cpp -o libtinyxml${SHLIB_EXT}
+  '';
+
+  doCheck = true;
+  checkPhase = ''
+    ./xmltest
+    result=$?
+    if [[ $result != 0 ]] ; then
+      exit $result
+    fi
+  '';
+
+  installPhase = ''
+    mkdir -pv $out/include/
+    mkdir -pv $out/lib/pkgconfig/
+    mkdir -pv $out/share/doc/tinyxml/
+
+    cp -v libtinyxml${SHLIB_EXT} $out/lib/
+    cp -v *.h $out/include/
+
+    substituteInPlace tinyxml.pc --replace "@out@" "$out"
+    substituteInPlace tinyxml.pc --replace "@version@" "${version}"
+    cp -v tinyxml.pc $out/lib/pkgconfig/
+
+    cp -v docs/* $out/share/doc/tinyxml/
+  '' + stdenv.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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/tix/default.nix b/nixpkgs/pkgs/development/libraries/tix/default.nix
new file mode 100644
index 000000000000..232c95e6257e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/tix/default.nix
@@ -0,0 +1,55 @@
+{ stdenv, fetchurl, tcl, tk, fetchpatch } :
+
+stdenv.mkDerivation rec {
+  version = "8.4.3";
+  name = "tix-${version}";
+  src = fetchurl {
+     url = "mirror://sourceforge/tix/tix/8.4.3/Tix8.4.3-src.tar.gz";
+     sha256 = "1jq3dkyk9mqkj4cg7mdk5r0cclqsby9l2b7wrysi0zk5yw7h8bsn";
+  };
+  patches = [ 
+  (fetchpatch {
+    name = "tix-8.4.3-tcl8.5.patch";
+    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")
+  (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";
+    sha256 = "1jaz0l22xj7x1k4rb9ia6i1psnbwk4pblgq4gfvya7gg7fbb7r36";
+    })
+  ;
+  buildInputs = [ tcl tk ];
+  # the configure script expects to find the location of the sources of
+  # tcl and tk in {tcl,tk}Config.sh
+  # In fact, it only needs some private headers. We copy them in 
+  # the private_headers folders and trick the configure script into believing
+  # the sources are here.
+  preConfigure = ''
+    mkdir -p private_headers/generic
+    < ${tcl}/lib/tclConfig.sh sed "s@TCL_SRC_DIR=.*@TCL_SRC_DIR=private_headers@" > tclConfig.sh
+    < ${tk}/lib/tkConfig.sh sed "s@TK_SRC_DIR=.*@TK_SRC_DIR=private_headers@" > tkConfig.sh
+    for i in ${tcl}/include/* ${tk.dev}/include/*; do
+      ln -s $i private_headers/generic;
+    done;
+    '';
+  configureFlags = [
+    "--with-tclinclude=${tcl}/include"
+    "--with-tclconfig=."
+    "--with-tkinclude=${tk.dev}/include"
+    "--with-tkconfig=."
+    "--libdir=\${prefix}/lib"
+  ];
+
+  meta = with stdenv.lib; {
+    description = "A widget library for Tcl/Tk";
+    homepage    = http://tix.sourceforge.net/;
+    platforms   = platforms.all;
+    license     = with licenses; [
+      bsd2 # tix
+      gpl2 # patches from portage
+    ];
+  };
+}
+
diff --git a/nixpkgs/pkgs/development/libraries/tk/8.5.nix b/nixpkgs/pkgs/development/libraries/tk/8.5.nix
new file mode 100644
index 000000000000..141f6da14ce4
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/tk/8.5.nix
@@ -0,0 +1,10 @@
+{ callPackage, fetchurl, tcl, ... } @ args:
+
+callPackage ./generic.nix (args // rec {
+
+  src = fetchurl {
+    url = "mirror://sourceforge/tcl/tk${tcl.version}-src.tar.gz";
+    sha256 = "0an3wqkjzlyyq6l9l3nawz76axsrsppbyylx0zk9lkv7llrala03";
+  };
+
+})
diff --git a/nixpkgs/pkgs/development/libraries/tk/8.6.nix b/nixpkgs/pkgs/development/libraries/tk/8.6.nix
new file mode 100644
index 000000000000..5013db64bbae
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/tk/8.6.nix
@@ -0,0 +1,12 @@
+{ callPackage, fetchurl, tcl, stdenv, ... } @ args:
+
+callPackage ./generic.nix (args // rec {
+
+  src = fetchurl {
+    url = "mirror://sourceforge/tcl/tk${tcl.version}.1-src.tar.gz"; # TODO: remove '.1' for v8.6.10 or v8.7.x
+    sha256 = "1d7bfkxpacy33w5nahf73lkwxqpff44w1jplg7i2gmwgiaawvjwg";
+  };
+
+  patches = [ ./different-prefix-with-tcl.patch ] ++ stdenv.lib.optionals stdenv.isDarwin [ ./Fix-bad-install_name-for-libtk8.6.dylib.patch ];
+
+})
diff --git a/nixpkgs/pkgs/development/libraries/tk/Fix-bad-install_name-for-libtk8.6.dylib.patch b/nixpkgs/pkgs/development/libraries/tk/Fix-bad-install_name-for-libtk8.6.dylib.patch
new file mode 100644
index 000000000000..528a75e1c91f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/tk/Fix-bad-install_name-for-libtk8.6.dylib.patch
@@ -0,0 +1,29 @@
+From f90278dac42135acd55200b7d2153f44d72fec53 Mon Sep 17 00:00:00 2001
+From: Josef Knedl <josef.kemetmueller@aon.at>
+Date: Wed, 24 Feb 2016 00:37:40 +0100
+Subject: [PATCH] Fix bad install_name for libtk8.6.dylib
+
+This follows: https://trac.macports.org/ticket/37395
+and https://trac.macports.org/changeset/100816
+Alternative would be to use Quartz build instead:
+https://sourceforge.net/p/tktoolkit/bugs/3048/
+---
+ unix/Makefile.in | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/unix/Makefile.in b/unix/Makefile.in
+index f21fdbb..1b89256 100644
+--- a/unix/Makefile.in
++++ b/unix/Makefile.in
+@@ -283,7 +283,7 @@ CC_SEARCH_FLAGS	= @CC_SEARCH_FLAGS@
+ LD_SEARCH_FLAGS	= @LD_SEARCH_FLAGS@
+ 
+ # support for embedded libraries on Darwin / Mac OS X
+-DYLIB_INSTALL_DIR	= ${LIB_RUNTIME_DIR}
++DYLIB_INSTALL_DIR	= $(libdir)
+ 
+ # support for building the Aqua resource file
+ TK_RSRC_FILE		= @TK_RSRC_FILE@
+-- 
+2.7.1
+
diff --git a/nixpkgs/pkgs/development/libraries/tk/different-prefix-with-tcl.patch b/nixpkgs/pkgs/development/libraries/tk/different-prefix-with-tcl.patch
new file mode 100644
index 000000000000..aee46e149b1a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/tk/different-prefix-with-tcl.patch
@@ -0,0 +1,25 @@
+diff --git a/generic/tkWindow.c b/generic/tkWindow.c
+index b5cbbab..96b5501 100644
+--- a/generic/tkWindow.c
++++ b/generic/tkWindow.c
+@@ -988,6 +988,7 @@ TkCreateMainWindow(
+ 
+     Tcl_SetVar2(interp, "tk_patchLevel", NULL, TK_PATCH_LEVEL, TCL_GLOBAL_ONLY);
+     Tcl_SetVar2(interp, "tk_version",    NULL, TK_VERSION,     TCL_GLOBAL_ONLY);
++    Tcl_SetVar2(interp, "tk_library",    NULL, TK_LIBRARY,     TCL_GLOBAL_ONLY);
+ 
+     tsdPtr->numMainWindows++;
+     return tkwin;
+diff --git a/unix/Makefile.in b/unix/Makefile.in
+index f21fdbb..c61b0df 100644
+--- a/unix/Makefile.in
++++ b/unix/Makefile.in
+@@ -1029,7 +1029,7 @@ tkVisual.o: $(GENERIC_DIR)/tkVisual.c
+ 	$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkVisual.c
+ 
+ tkWindow.o: $(GENERIC_DIR)/tkWindow.c
+-	$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkWindow.c
++	$(CC) -c $(CC_SWITCHES) -DTK_LIBRARY=\"${TK_LIBRARY}\" $(GENERIC_DIR)/tkWindow.c
+ 
+ tkButton.o: $(GENERIC_DIR)/tkButton.c
+ 	$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkButton.c
diff --git a/nixpkgs/pkgs/development/libraries/tk/generic.nix b/nixpkgs/pkgs/development/libraries/tk/generic.nix
new file mode 100644
index 000000000000..6e4640fabb7b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/tk/generic.nix
@@ -0,0 +1,58 @@
+{ stdenv, lib, src, pkgconfig, tcl, libXft, fontconfig, patches ? []
+, enableAqua ? stdenv.isDarwin, darwin
+, ... }:
+
+stdenv.mkDerivation {
+  name = "tk-${tcl.version}";
+
+  inherit src patches;
+
+  outputs = [ "out" "man" "dev" ];
+
+  setOutputFlags = false;
+
+  preConfigure = ''
+    configureFlagsArray+=(--mandir=$man/share/man --enable-man-symlinks)
+    cd unix
+  '';
+
+  postInstall = ''
+    ln -s $out/bin/wish* $out/bin/wish
+    cp ../{unix,generic}/*.h $out/include
+    ln -s $out/lib/libtk${tcl.release}.so $out/lib/libtk.so
+  ''
+  + stdenv.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";
+
+  nativeBuildInputs = [ pkgconfig ];
+
+  propagatedBuildInputs = [ tcl libXft ]
+    ++ lib.optional enableAqua (with darwin; with apple_sdk.frameworks; [
+      Cocoa cf-private
+    ]);
+
+  doCheck = false; # fails. can't find itself
+
+  inherit tcl;
+
+  passthru = rec {
+    inherit (tcl) release version;
+    libPrefix = "tk${tcl.release}";
+    libdir = "lib/${libPrefix}";
+  };
+
+  meta = with stdenv.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;
+    platforms = platforms.all;
+    maintainers = with maintainers; [ lovek323 vrthra ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/tnt/default.nix b/nixpkgs/pkgs/development/libraries/tnt/default.nix
new file mode 100644
index 000000000000..229e4cfaa6c0
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/tnt/default.nix
@@ -0,0 +1,25 @@
+{stdenv, fetchurl, unzip}:
+
+stdenv.mkDerivation rec {
+  name = "tnt-${version}";
+  version = "3.0.12";
+  
+  src = fetchurl {
+    url = https://math.nist.gov/tnt/tnt_3_0_12.zip;
+    sha256 = "1bzkfdb598584qlc058n8wqq9vbz714gr5r57401rsa9qaxhk5j7";
+  };
+
+  buildInputs = [ unzip ];
+
+  installPhase = ''
+      mkdir -p $out/include
+      cp *.h $out/include
+  '';
+
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/tntdb/default.nix b/nixpkgs/pkgs/development/libraries/tntdb/default.nix
new file mode 100644
index 000000000000..9edfcc88f164
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/tntdb/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchurl, cxxtools, postgresql, mysql, sqlite, zlib, openssl }:
+
+stdenv.mkDerivation rec {
+  name = "tntdb-${version}";
+  version = "1.3";
+
+  src = fetchurl {
+    url = "http://www.tntnet.org/download/${name}.tar.gz";
+    sha256 = "0js79dbvkic30bzw1pf26m64vs2ssw2sbj55w1dc0sy69dlv4fh9";
+  };
+
+  buildInputs = [ cxxtools postgresql mysql.connector-c sqlite zlib openssl ];
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    homepage = http://www.tntnet.org/tntdb.html;
+    description = "C++ library which makes accessing SQL databases easy and robust";
+    platforms = platforms.linux ;
+    license = licenses.lgpl21;
+    maintainers = [ maintainers.juliendehos ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/tntnet/default.nix b/nixpkgs/pkgs/development/libraries/tntnet/default.nix
new file mode 100644
index 000000000000..aaff759525b6
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/tntnet/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchurl, cxxtools, zlib, openssl, zip }:
+
+stdenv.mkDerivation rec {
+  name = "tntnet-${version}";
+  version = "2.2.1";
+
+  src = fetchurl {
+    url = "http://www.tntnet.org/download/${name}.tar.gz";
+    sha256 = "08bmak9mpbamwwl3h9p8x5qzwqlm9g3jh70y0ml5hk7hiv870cf8";
+  };
+
+  buildInputs = [ cxxtools zlib openssl zip ];
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    homepage = http://www.tntnet.org/tntnet.html;
+    description = "Web server which allows users to develop web applications using C++";
+    platforms = platforms.linux ;
+    license = licenses.lgpl21;
+    maintainers = [ maintainers.juliendehos ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/tokyo-cabinet/default.nix b/nixpkgs/pkgs/development/libraries/tokyo-cabinet/default.nix
new file mode 100644
index 000000000000..b8969588b3c5
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/tokyo-cabinet/default.nix
@@ -0,0 +1,43 @@
+{ fetchurl, stdenv, zlib, bzip2 }:
+
+stdenv.mkDerivation rec {
+  name = "tokyocabinet-1.4.48";
+
+  src = fetchurl {
+    url = "http://fallabs.com/tokyocabinet/${name}.tar.gz";
+    sha256 = "140zvr0n8kvsl0fbn2qn3f2kh3yynfwnizn4dgbj47m975yg80x0";
+  };
+
+  buildInputs = [ zlib bzip2 ];
+
+  postInstall =
+    '' sed -i "$out/lib/pkgconfig/tokyocabinet.pc" \
+           -e 's|-lz|-L${zlib.out}/lib -lz|g;
+               s|-lbz2|-L${bzip2.out}/lib -lbz2|g'
+    '';
+
+  meta = {
+    description = "Tokyo Cabinet: a modern implementation of DBM";
+
+    longDescription =
+      '' Tokyo Cabinet is a library of routines for managing a database. The
+         database is a simple data file containing records, each is a pair of
+         a key and a value.  Every key and value is serial bytes with
+         variable length.  Both binary data and character string can be used
+         as a key and a value.  There is neither concept of data tables nor
+         data types.  Records are organized in hash table, B+ tree, or
+         fixed-length array.
+
+         Tokyo Cabinet is developed as the successor of GDBM and QDBM on the
+         following purposes.  They are achieved and Tokyo Cabinet replaces
+         conventional DBM products: improves space efficiency, improves time
+         efficiency, improves parallelism, improves usability, improves
+         robustness, supports 64-bit architecture.
+      '';
+
+    license = stdenv.lib.licenses.lgpl2Plus;
+
+    maintainers = [ ];
+    platforms = stdenv.lib.platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/tokyo-tyrant/default.nix b/nixpkgs/pkgs/development/libraries/tokyo-tyrant/default.nix
new file mode 100644
index 000000000000..7bf08a3560ae
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/tokyo-tyrant/default.nix
@@ -0,0 +1,41 @@
+{ fetchurl, stdenv, tokyocabinet, pkgconfig }:
+
+stdenv.mkDerivation rec {
+  name = "tokyotyrant-1.1.41";
+
+  src = fetchurl {
+    url = "http://fallabs.com/tokyotyrant/${name}.tar.gz";
+    sha256 = "13xqcinhydqmh7231qlir6pymacjwcf98drybkhd9597kzxp1bs2";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ tokyocabinet ];
+
+  doCheck = false;                                # FIXME
+
+  meta = {
+    description = "Network interface of the Tokyo Cabinet DBM";
+
+    longDescription =
+      '' Tokyo Tyrant is a package of network interface to the DBM called
+         Tokyo Cabinet.  Though the DBM has high performance, you might
+         bother in case that multiple processes share the same database, or
+         remote processes access the database.  Thus, Tokyo Tyrant is
+         provided for concurrent and remote connections to Tokyo Cabinet.  It
+         is composed of the server process managing a database and its access
+         library for client applications.
+
+         Tokyo Tyrant is written in the C language, and provided as API of C,
+         Perl, and Ruby.  Tokyo Tyrant is available on platforms which have
+         API conforming to C99 and POSIX.  Tokyo Tyrant is a free software
+         licensed under the GNU Lesser General Public License.
+       '';
+
+    homepage = http://fallabs.com/tokyotyrant/;
+
+    license = stdenv.lib.licenses.lgpl21Plus;
+
+    platforms = stdenv.lib.platforms.gnu ++ stdenv.lib.platforms.linux;         # arbitrary choice
+    maintainers = [ ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/torch-hdf5/default.nix b/nixpkgs/pkgs/development/libraries/torch-hdf5/default.nix
new file mode 100644
index 000000000000..e5803d644f3b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/torch-hdf5/default.nix
@@ -0,0 +1,19 @@
+{stdenv, fetchFromGitHub, torch, cmake, hdf5}:
+stdenv.mkDerivation rec {
+  name = "torch-hdf5-${version}";
+  version = "0.0pre2016-07-01";
+  buildInputs = [cmake torch hdf5];
+  src = fetchFromGitHub {
+    owner = "deepmind";
+    repo = "torch-hdf5";
+    rev = "639bb4e62417ac392bf31a53cdd495d19337642b";
+    sha256 = "0x1si2c30d95vmw0xqyq242wghfih3m5i43785vwahlzm7h6n6xz";
+  };
+  meta = {
+    inherit version;
+    description = ''HDF5 format support for Torch'';
+    license = stdenv.lib.licenses.bsd3;
+    maintainers = [stdenv.lib.maintainers.raskin];
+    platforms = stdenv.lib.platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/torch/default.nix b/nixpkgs/pkgs/development/libraries/torch/default.nix
new file mode 100644
index 000000000000..d4c61890afb1
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/torch/default.nix
@@ -0,0 +1,37 @@
+{stdenv, fetchgit, luajit, openblas, imagemagick, cmake, curl, fftw, gnuplot
+  , libjpeg, zeromq3, ncurses, openssl, libpng, qt4, readline, unzip
+  , pkgconfig, zlib, libX11, which
+  }:
+stdenv.mkDerivation rec{
+  version = "0.0pre20160820";
+  name = "torch-${version}";
+  buildInputs = [
+    luajit openblas imagemagick cmake curl fftw gnuplot unzip qt4
+    libjpeg zeromq3 ncurses openssl libpng readline pkgconfig
+    zlib libX11 which
+  ];
+
+  src = fetchgit {
+    url = "https://github.com/torch/distro";
+    rev = "8b6a834f8c8755f6f5f84ef9d8da9cfc79c5ce1f";
+    sha256 = "120hnz82d7izinsmv5smyqww71dhpix23pm43s522dfcglpql8xy";
+    fetchSubmodules = true;
+  };
+
+  buildPhase = ''
+    cd ..
+    export PREFIX=$out
+
+    mkdir "$out"
+    sh install.sh -s
+  '';
+  installPhase = ''
+  '';
+  meta = {
+    inherit version;
+    description = ''A scientific computing framework with wide support for machine learning algorithms'';
+    license = stdenv.lib.licenses.bsd3 ;
+    maintainers = [stdenv.lib.maintainers.raskin];
+    platforms = stdenv.lib.platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/totem-pl-parser/default.nix b/nixpkgs/pkgs/development/libraries/totem-pl-parser/default.nix
new file mode 100644
index 000000000000..dd8a300d70f4
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/totem-pl-parser/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchurl, meson, ninja, pkgconfig, gettext, libxml2, gobject-introspection, gnome3 }:
+
+stdenv.mkDerivation rec {
+  pname = "totem-pl-parser";
+  version = "3.26.3";
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    sha256 = "13a45py2j1r9967zgww8kd24bn2fhycd4m3kzr90sxx9l2w03z8f";
+  };
+
+  passthru = {
+    updateScript = gnome3.updateScript {
+      packageName = pname;
+    };
+  };
+
+  nativeBuildInputs = [ meson ninja pkgconfig gettext gobject-introspection ];
+  buildInputs = [ libxml2 ];
+
+  meta = with stdenv.lib; {
+    homepage = https://wiki.gnome.org/Apps/Videos;
+    description = "Simple GObject-based library to parse and save a host of playlist formats";
+    maintainers = gnome3.maintainers;
+    license = licenses.lgpl2;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/tpm2-tss/default.nix b/nixpkgs/pkgs/development/libraries/tpm2-tss/default.nix
new file mode 100644
index 000000000000..cb1052356786
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/tpm2-tss/default.nix
@@ -0,0 +1,47 @@
+{ stdenv, lib, fetchurl
+, cmocka, doxygen, ibm-sw-tpm2, iproute, openssl, perl, pkgconfig, procps
+, uthash, which }:
+
+stdenv.mkDerivation rec {
+  pname = "tpm2-tss";
+  version = "2.2.3";
+
+  src = fetchurl {
+    url = "https://github.com/tpm2-software/${pname}/releases/download/${version}/${pname}-${version}.tar.gz";
+    sha256 = "1hwrka0g817a4d1177vv0z13gp66bxzxhflfxswjhcdk93kaws8k";
+  };
+
+  nativeBuildInputs = [
+    doxygen perl pkgconfig
+    # For unit tests and integration tests.
+    ibm-sw-tpm2 iproute procps which
+  ];
+  buildInputs = [
+    openssl
+    # For unit tests and integration tests.
+    cmocka uthash
+  ];
+
+  postPatch = "patchShebangs script";
+
+  configureFlags = [
+    "--enable-unit"
+    "--enable-integration"
+  ];
+
+  doCheck = true;
+
+  postInstall = ''
+    # Do not install the upstream udev rules, they rely on specific
+    # users/groups which aren't guaranteed to exist on the system.
+    rm -R $out/lib/udev
+  '';
+
+  meta = with lib; {
+    description = "OSS implementation of the TCG TPM2 Software Stack (TSS2)";
+    homepage = https://github.com/tpm2-software/tpm2-tss;
+    license = licenses.bsd2;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ delroth ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/tre/default.nix b/nixpkgs/pkgs/development/libraries/tre/default.nix
new file mode 100644
index 000000000000..901b6aa097fd
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/tre/default.nix
@@ -0,0 +1,21 @@
+{stdenv, fetchurl, fetchpatch}:
+
+stdenv.mkDerivation rec {
+  name = "tre-0.8.0";
+  src = fetchurl {
+    url = "https://laurikari.net/tre/${name}.tar.gz";
+    sha256 = "1pd7qsa7vc3ybdc6h2gr4pm9inypjysf92kab945gg4qa6jp11my";
+  };
+
+  patches = [
+    (fetchpatch {
+      url = https://sources.debian.net/data/main/t/tre/0.8.0-6/debian/patches/03-cve-2016-8859;
+      sha256 = "0navhizym6qxd4gngrsslbij8x9r3s67p1jzzhvsnq6ky49j7w3p";
+    })
+  ];
+
+  meta = {
+    platforms = stdenv.lib.platforms.unix;
+    license = stdenv.lib.licenses.bsd2;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/tremor/default.nix b/nixpkgs/pkgs/development/libraries/tremor/default.nix
new file mode 100644
index 000000000000..5609f1d67d17
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/tremor/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchgit, autoreconfHook, pkgconfig, libogg }:
+
+stdenv.mkDerivation rec {
+  name = "tremor-unstable-2018-03-16";
+
+  src = fetchgit {
+    url = https://git.xiph.org/tremor.git;
+    rev = "562307a4a7082e24553f3d2c55dab397a17c4b4f";
+    sha256 = "0m07gq4zfgigsiz8b518xyb19v7qqp76qmp7lb262825vkqzl3zq";
+  };
+
+  nativeBuildInputs = [ autoreconfHook pkgconfig ];
+  propagatedBuildInputs = [ libogg ];
+
+  preConfigure = ''
+    sed -i /XIPH_PATH_OGG/d configure
+  '';
+
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/tsocks/default.nix b/nixpkgs/pkgs/development/libraries/tsocks/default.nix
new file mode 100644
index 000000000000..bcc91d058f04
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/tsocks/default.nix
@@ -0,0 +1,36 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "tsocks-${version}";
+  version = "1.8beta5";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/tsocks/${name}.tar.gz";
+    sha256 = "0ixkymiph771dcdzvssi9dr2pk1bzaw9zv85riv3xl40mzspx7c4";
+  };
+
+  patches = [ ./poll.patch ];
+
+  preConfigure = ''
+    sed -i -e "s,\\\/usr,"$(echo $out|sed -e "s,\\/,\\\\\\\/,g")",g" tsocks
+    substituteInPlace tsocks --replace /usr $out
+    export configureFlags="$configureFlags --libdir=$out/lib"
+  '';
+
+  preBuild = ''
+    # We don't need the saveme binary, it is in fact never stored and we're
+    # never injecting stuff into ld.so.preload anyway
+    sed -i \
+      -e "s,TARGETS=\(.*\)..SAVE.\(.*\),TARGETS=\1\2," \
+      -e "/SAVE/d" Makefile
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Transparent SOCKS v4 proxying library";
+    homepage = http://tsocks.sourceforge.net/;
+    license = stdenv.lib.licenses.gpl2;
+    maintainers = with maintainers; [ edwtjo phreedom ];
+    platforms = platforms.unix;
+    broken = stdenv.hostPlatform.isDarwin;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/tsocks/poll.patch b/nixpkgs/pkgs/development/libraries/tsocks/poll.patch
new file mode 100644
index 000000000000..2bfeb9f779ca
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/tsocks/poll.patch
@@ -0,0 +1,26 @@
+From Ingo Hadan <ingo.hadan@sdm.de> Fri, 02 Apr 2010 21:08:50 +0200
+From: Julien Moutinho <julm+tsocks@autogeree.net>
+Date: Fri, 26 Apr 2013 01:57:26 +0200
+Subject: tsocks fails if socksified application uses poll(2) (e.g. subversion-1.5)
+
+---
+diff --git a/tsocks.c b/tsocks.c
+index 9cfdfff..470babd 100644
+--- a/tsocks.c
++++ b/tsocks.c
+@@ -657,10 +657,11 @@ int poll(POLL_SIGNATURE) {
+              * be ready for writing), otherwise we'll just let the select loop
+              * come around again (since we can't flag it for read, we don't know
+              * if there is any data to be read and can't be bothered checking) */
+-            if (conn->selectevents & WRITE) {
+-               setevents |= POLLOUT; 
++            if (conn->selectevents & POLLOUT) {
++               ufds[i].revents |= POLLOUT; 
+                nevents++;
+             }
++            ufds[i].events = conn->selectevents;
+          }
+       }
+    } while (nevents == 0);
+
+
diff --git a/nixpkgs/pkgs/development/libraries/twolame/default.nix b/nixpkgs/pkgs/development/libraries/twolame/default.nix
new file mode 100644
index 000000000000..a752da8cb57d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/twolame/default.nix
@@ -0,0 +1,34 @@
+{ stdenv, fetchFromGitHub
+, autoreconfHook, pkgconfig
+, libsndfile }:
+
+stdenv.mkDerivation rec {
+
+  name = "twolame-${version}";
+  version = "2017-09-27";
+
+  src = fetchFromGitHub {
+    owner = "njh";
+    repo = "twolame";
+    rev = "977c8ac55d8ca6d5f35d1d413a119dac2b3b0333";
+    sha256 = "1rq3yc8ygzdqid9zk6pixmm4w9sk2vrlx217lhn5bjaglv7iyf7x";
+  };
+
+  nativeBuildInputs = [ autoreconfHook pkgconfig ];
+  buildInputs = [ libsndfile ];
+
+  doCheck = false; # fails with "../build-scripts/test-driver: line 107: -Mstrict: command not found"
+
+  meta = with stdenv.lib;{
+    description = "A MP2 encoder";
+    longDescription = ''
+      TwoLAME is an optimised MPEG Audio Layer 2 (MP2) encoder based on
+      tooLAME by Mike Cheng, which in turn is based upon the ISO dist10
+      code and portions of LAME.
+    '';
+    homepage = http://www.twolame.org/;
+    license = with licenses; [ lgpl2Plus ];
+    platforms = with platforms; unix;
+    maintainers = with maintainers; [ AndersonTorres ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/ucl/default.nix b/nixpkgs/pkgs/development/libraries/ucl/default.nix
new file mode 100644
index 000000000000..933a3afef35b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/ucl/default.nix
@@ -0,0 +1,19 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation {
+  name = "ucl-1.03";
+  src = fetchurl {
+    url = https://www.oberhumer.com/opensource/ucl/download/ucl-1.03.tar.gz;
+    sha256 = "b865299ffd45d73412293369c9754b07637680e5c826915f097577cd27350348";
+  };
+
+  # needed to successfully compile with gcc 6
+  NIX_CFLAGS_COMPILE = stdenv.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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/ucommon/default.nix b/nixpkgs/pkgs/development/libraries/ucommon/default.nix
new file mode 100644
index 000000000000..53e10b468ba6
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/ucommon/default.nix
@@ -0,0 +1,41 @@
+{ stdenv, fetchurl, pkgconfig
+, openssl ? null, zlib ? null, gnutls ? null
+}:
+
+let
+  xor = a: b: (a || b) && (!(a && b));
+in
+
+assert xor (openssl != null) (gnutls != null);
+assert !(xor (openssl != null) (zlib != null));
+
+stdenv.mkDerivation rec {
+  name = "ucommon-7.0.0";
+
+  src = fetchurl {
+    url = "mirror://gnu/commoncpp/${name}.tar.gz";
+    sha256 = "6ac9f76c2af010f97e916e4bae1cece341dc64ca28e3881ff4ddc3bc334060d7";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+
+  # disable flaky networking test
+  postPatch = ''
+    substituteInPlace test/stream.cpp \
+      --replace 'ifndef UCOMMON_SYSRUNTIME' 'if 0'
+  '';
+
+  # ucommon.pc has link time depdendencies on -lssl, -lcrypto, -lz, -lgnutls
+  propagatedBuildInputs = [ openssl zlib gnutls ];
+
+  doCheck = true;
+
+  meta = {
+    description = "C++ library to facilitate using C++ design patterns";
+    homepage = https://www.gnu.org/software/commoncpp/;
+    license = stdenv.lib.licenses.lgpl3Plus;
+
+    maintainers = with stdenv.lib.maintainers; [ ];
+    platforms = stdenv.lib.platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/udns/default.nix b/nixpkgs/pkgs/development/libraries/udns/default.nix
new file mode 100644
index 000000000000..9c899eb21ba7
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/udns/default.nix
@@ -0,0 +1,46 @@
+{ stdenv, fetchurl }:
+
+# this expression is mostly based on debian's packaging
+# https://tracker.debian.org/media/packages/u/udns/rules-0.4-1
+
+stdenv.mkDerivation rec {
+  name = "udns-${version}";
+  version = "0.4";
+
+  configurePhase = "./configure --enable-ipv6";
+
+  buildPhase = "make staticlib sharedlib rblcheck_s dnsget_s";
+
+  src = fetchurl {
+    url = "http://www.corpit.ru/mjt/udns/${name}.tar.gz";
+    sha256 = "0447fv1hmb44nnchdn6p5pd9b44x8p5jn0ahw6crwbqsg7f0hl8i";
+  };
+
+  installPhase = ''
+    mkdir -p $out/bin
+    mkdir -p $out/include
+    mkdir -p $out/lib
+    mkdir -p $out/share/man/man1
+    mkdir -p $out/share/man/man3
+    cp dnsget_s $out/bin/dnsget
+    cp rblcheck_s $out/bin/rblcheck
+    cp udns.h $out/include/
+    cp libudns.a $out/lib/
+    cp libudns.so.0 $out/lib/
+    ln -rs $out/lib/libudns.so.0 $out/lib/libudns.so
+    cp dnsget.1 rblcheck.1 $out/share/man/man1
+    cp udns.3 $out/share/man/man3
+  '';
+
+  # keep man3
+  outputDevdoc = "out";
+
+  meta = with stdenv.lib; {
+    homepage = http://www.corpit.ru/mjt/udns.html;
+    description = "Async-capable DNS stub resolver library";
+    license = licenses.lgpl21Plus;
+    maintainers = [ maintainers.womfoo ];
+    platforms = platforms.linux;
+  };
+
+}
diff --git a/nixpkgs/pkgs/development/libraries/udunits/default.nix b/nixpkgs/pkgs/development/libraries/udunits/default.nix
new file mode 100644
index 000000000000..664bc29a72de
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/udunits/default.nix
@@ -0,0 +1,26 @@
+{ stdenv, fetchFromGitHub, autoreconfHook,
+  texinfo, bison, flex, expat, file
+}:
+
+stdenv.mkDerivation rec {
+  name = "udunits-${version}";
+  version = "2.2.27.6";
+  
+  src = fetchFromGitHub {
+    owner = "Unidata";
+    repo = "UDUNITS-2";
+    rev = "v${version}";
+    sha256 = "0621pac24c842dyipzaa59rh6pza9phdqi3snd4cq4pib0wjw6gm";
+  };
+
+  nativeBuildInputs = [ autoreconfHook texinfo bison flex file ];
+  buildInputs = [ expat ];
+
+  meta = with stdenv.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;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ pSub ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/uhttpmock/default.nix b/nixpkgs/pkgs/development/libraries/uhttpmock/default.nix
new file mode 100644
index 000000000000..6eef95309aab
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/uhttpmock/default.nix
@@ -0,0 +1,26 @@
+{ stdenv, lib, fetchFromGitLab, autoconf, gtk-doc, automake, libtool, pkgconfig, glib, libsoup, gobject-introspection }:
+
+stdenv.mkDerivation rec {
+  version="0.5.0";
+  name = "uhttpmock-${version}";
+
+  src = fetchFromGitLab {
+    repo = "uhttpmock";
+    owner = "uhttpmock";
+    rev = version;
+    sha256 = "0kkf670abkq5ikm3mqls475lydfsd9by1kv5im4k757xrl1br1d4";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ autoconf gtk-doc automake libtool glib libsoup gobject-introspection ];
+
+  preConfigure = "./autogen.sh";
+
+  meta = with lib; {
+    description = "Project for mocking web service APIs which use HTTP or HTTPS";
+    homepage = https://gitlab.com/groups/uhttpmock/;
+    license = licenses.lgpl21;
+    maintainers = with maintainers; [ ];
+    platforms = with platforms; linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/uid_wrapper/default.nix b/nixpkgs/pkgs/development/libraries/uid_wrapper/default.nix
new file mode 100644
index 000000000000..bd9fb796247d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/uid_wrapper/default.nix
@@ -0,0 +1,19 @@
+{ stdenv, fetchurl, cmake, pkgconfig }:
+
+stdenv.mkDerivation rec {
+  name = "uid_wrapper-1.2.4";
+
+  src = fetchurl {
+    url = "mirror://samba/cwrap/${name}.tar.gz";
+    sha256 = "1yjhrm3rcyiykkrgpifmig117mzjxrms75kp8gpp8022f59zcq1w";
+  };
+
+  nativeBuildInputs = [ cmake pkgconfig ];
+
+  meta = with stdenv.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;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/umockdev/default.nix b/nixpkgs/pkgs/development/libraries/umockdev/default.nix
new file mode 100644
index 000000000000..b6f1136ea2b9
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/umockdev/default.nix
@@ -0,0 +1,34 @@
+{ stdenv, fetchFromGitHub, autoreconfHook, umockdev, gobject-introspection
+, pkgconfig, glib, systemd, libgudev, vala }:
+
+stdenv.mkDerivation rec {
+  name = "umockdev-${version}";
+  version = "0.12.1";
+
+  outputs = [ "bin" "out" "dev" "doc" ];
+
+  src = fetchFromGitHub {
+    owner  = "martinpitt";
+    repo   = "umockdev";
+    rev    = version;
+    sha256 = "0wnmz4jh04mvqzjnqvxrah969gg4x4v8d6ip61zc7jpbwnqb2fpg";
+  };
+
+  # autoreconfHook complains if we try to build the documentation
+  postPatch = ''
+    echo 'EXTRA_DIST =' > docs/gtk-doc.make
+  '';
+
+  buildInputs = [ glib systemd libgudev ];
+
+  nativeBuildInputs = [ autoreconfHook pkgconfig vala gobject-introspection ];
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    description = "Mock hardware devices for creating unit tests";
+    license = licenses.lgpl2;
+    maintainers = with maintainers; [ ndowens ];
+    platforms = with platforms; linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/unibilium/default.nix b/nixpkgs/pkgs/development/libraries/unibilium/default.nix
new file mode 100644
index 000000000000..717edda18a2b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/unibilium/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, lib, fetchFromGitHub, libtool, pkgconfig, perl, ncurses }:
+
+stdenv.mkDerivation rec {
+  name = "unibilium-${version}";
+
+  version = "2.0.0";
+
+  src = fetchFromGitHub {
+    owner = "mauke";
+    repo = "unibilium";
+    rev = "v${version}";
+    sha256 = "1wa9a32wzqnxqh1jh554afj13dzjr6mw2wzqzw8d08nza9pg2ra2";
+  };
+
+  makeFlags = [ "PREFIX=$(out)" ]
+    ++ stdenv.lib.optional stdenv.isDarwin "LIBTOOL=${libtool}/bin/libtool";
+
+  nativeBuildInputs = [ pkgconfig perl ];
+  buildInputs = [ libtool ncurses ];
+
+  meta = with lib; {
+    description = "A very basic terminfo library";
+    license = licenses.lgpl3Plus;
+    platforms = platforms.linux ++ platforms.darwin;
+    maintainers = with maintainers; [ pSub ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/unicap/default.nix b/nixpkgs/pkgs/development/libraries/unicap/default.nix
new file mode 100644
index 000000000000..1aa5e6717021
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/unicap/default.nix
@@ -0,0 +1,34 @@
+{ stdenv, fetchurl, libusb, libraw1394, dcraw, intltool, perl, v4l_utils }:
+
+stdenv.mkDerivation rec {
+  name = "libunicap-${version}";
+  version="0.9.12";
+
+  src = fetchurl {
+    url = "https://www.unicap-imaging.org/downloads/${name}.tar.gz";
+    sha256 = "05zcnnm4dfc6idihfi0fq5xka6x86zi89wip2ca19yz768sd33s9";
+  };
+
+  buildInputs = [ libusb libraw1394 dcraw intltool perl v4l_utils ];
+
+  patches = [
+    # Debian has a patch that fixes the build.
+    (fetchurl {
+      url = "https://sources.debian.net/data/main/u/unicap/0.9.12-2/debian/patches/1009_v4l1.patch";
+      sha256 = "1lgypmhdj681m7d1nmzgvh19cz8agj2f31wlnfib0ha8i3g5hg5w";
+    })
+  ];
+
+  postPatch = ''
+    find . -type f -exec sed -e '/linux\/types\.h/d' -i '{}' ';'
+    sed -e 's@/etc/udev@'"$out"'/&@' -i data/Makefile.*
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Universal video capture API";
+    homepage = http://www.unicap-imaging.org/;
+    maintainers = [ maintainers.raskin ];
+    license = licenses.gpl2Plus;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/unicorn-emu/default.nix b/nixpkgs/pkgs/development/libraries/unicorn-emu/default.nix
new file mode 100644
index 000000000000..aa4a7890b23e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/unicorn-emu/default.nix
@@ -0,0 +1,26 @@
+{ stdenv, fetchurl, pkgconfig, python }:
+
+stdenv.mkDerivation rec {
+  name    = "unicorn-emulator-${version}";
+  version = "1.0.1";
+
+  src = fetchurl {
+    url    = "https://github.com/unicorn-engine/unicorn/archive/${version}.tar.gz";
+    sha256 = "0z01apwmvhvdldm372ww9pjfn45awkw3m90c0h4v0nj0ihmlysis";
+  };
+
+  configurePhase = '' patchShebangs make.sh '';
+  buildPhase = '' ./make.sh '';
+  installPhase = '' env PREFIX=$out ./make.sh install '';
+
+  nativeBuildInputs = [ pkgconfig python ];
+  enableParallelBuilding = true;
+
+  meta = {
+    description = "Lightweight multi-platform CPU emulator library";
+    homepage    = "http://www.unicorn-engine.org";
+    license     = stdenv.lib.licenses.bsd3;
+    platforms   = stdenv.lib.platforms.linux;
+    maintainers = [ stdenv.lib.maintainers.thoughtpolice ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/unittest-cpp/default.nix b/nixpkgs/pkgs/development/libraries/unittest-cpp/default.nix
new file mode 100644
index 000000000000..90a28df6a15a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/unittest-cpp/default.nix
@@ -0,0 +1,27 @@
+{stdenv, fetchFromGitHub, cmake}:
+
+with stdenv.lib;
+
+stdenv.mkDerivation rec {
+  name = "unittest-cpp-${version}";
+  version = "2.0.0";
+
+  src = fetchFromGitHub {
+    owner = "unittest-cpp";
+    repo = "unittest-cpp";
+    rev = "v${version}";
+    sha256 = "0sxb3835nly1jxn071f59fwbdzmqi74j040r81fanxyw3s1azw0i";
+  };
+
+  buildInputs = [cmake];
+
+  doCheck = false;
+
+  meta = {
+    homepage = https://github.com/unittest-cpp/unittest-cpp;
+    description = "Lightweight unit testing framework for C++";
+    license = licenses.mit;
+    maintainers = [];
+    platforms = stdenv.lib.platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/unixODBC/default.nix b/nixpkgs/pkgs/development/libraries/unixODBC/default.nix
new file mode 100644
index 000000000000..1275df69f596
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/unixODBC/default.nix
@@ -0,0 +1,20 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "unixODBC-${version}";
+  version = "2.3.7";
+
+  src = fetchurl {
+    url = "ftp://ftp.unixodbc.org/pub/unixODBC/${name}.tar.gz";
+    sha256 = "0xry3sg497wly8f7715a7gwkn2k36bcap0mvzjw74jj53yx6kwa5";
+  };
+
+  configureFlags = [ "--disable-gui" "--sysconfdir=/etc" ];
+
+  meta = with stdenv.lib; {
+    description = "ODBC driver manager for Unix";
+    homepage = http://www.unixodbc.org/;
+    license = licenses.lgpl2;
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/unixODBCDrivers/default.nix b/nixpkgs/pkgs/development/libraries/unixODBCDrivers/default.nix
new file mode 100644
index 000000000000..7d4c6c7a2994
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/unixODBCDrivers/default.nix
@@ -0,0 +1,163 @@
+{ fetchurl, stdenv, unixODBC, cmake, postgresql, mysql55, mariadb, sqlite, zlib, libxml2, dpkg, lib, openssl, kerberos, curl, libuuid, autoPatchelfHook }:
+
+# I haven't done any parameter tweaking.. So the defaults provided here might be bad
+
+{
+  psql = stdenv.mkDerivation rec {
+    name = "psqlodbc-${version}";
+    version = "10.01.0000";
+
+    src = fetchurl {
+      url = "http://ftp.postgresql.org/pub/odbc/versions/src/${name}.tar.gz";
+      sha256 = "1cyams7157f3gry86x64xrplqi2vyqrq3rqka59gv4lb4rpl7jl7";
+    };
+
+    buildInputs = [ unixODBC postgresql ];
+
+    passthru = {
+      fancyName = "PostgreSQL";
+      driver = "lib/psqlodbcw.so";
+    };
+
+    meta = with stdenv.lib; {
+      description = "Official PostgreSQL ODBC Driver";
+      homepage =  https://odbc.postgresql.org/;
+      license = licenses.lgpl2;
+      platforms = platforms.linux;
+    };
+  };
+
+  mariadb = stdenv.mkDerivation rec {
+    name = "mariadb-connector-odbc-${version}";
+    version = "2.0.10";
+
+    src = fetchurl {
+      url = "https://downloads.mariadb.org/interstitial/connector-odbc-${version}/src/${name}-ga-src.tar.gz";
+      sha256 = "0b6ximy0dg0xhqbrm1l7pn8hjapgpmddi67kh54h6i9cq9hqfdvz";
+    };
+
+    nativeBuildInputs = [ cmake ];
+    buildInputs = [ unixODBC mariadb.connector-c ];
+
+    cmakeFlags = [
+      "-DMARIADB_INCLUDE_DIR=${mariadb.connector-c}/include/mariadb"
+    ];
+
+    passthru = {
+      fancyName = "MariaDB";
+      driver = "lib/libmaodbc.so";
+    };
+
+    meta = with stdenv.lib; {
+      description = "MariaDB ODBC database driver";
+      homepage =  https://downloads.mariadb.org/connector-odbc/;
+      license = licenses.gpl2;
+      platforms = platforms.linux;
+    };
+  };
+
+  mysql = stdenv.mkDerivation rec {
+    name = "mysql-connector-odbc-${version}";
+    majorVersion = "5.3";
+    version = "${majorVersion}.6";
+
+    src = fetchurl {
+      url = "https://dev.mysql.com/get/Downloads/Connector-ODBC/${majorVersion}/${name}-src.tar.gz";
+      sha256 = "1smi4z49i4zm7cmykjkwlxxzqvn7myngsw5bc35z6gqxmi8c55xr";
+    };
+
+    nativeBuildInputs = [ cmake ];
+    buildInputs = [ unixODBC mysql55 ];
+
+    cmakeFlags = [ "-DWITH_UNIXODBC=1" ];
+
+    passthru = {
+      fancyName = "MySQL";
+      driver = "lib/libmyodbc3-3.51.12.so";
+    };
+
+    meta = with stdenv.lib; {
+      description = "MariaDB ODBC database driver";
+      homepage = https://dev.mysql.com/downloads/connector/odbc/;
+      license = licenses.gpl2;
+      platforms = platforms.linux;
+      broken = true;
+    };
+  };
+
+  sqlite = stdenv.mkDerivation rec {
+    name = "sqlite-connector-odbc-${version}";
+    version = "0.9993";
+ 
+    src = fetchurl {
+      url = "http://www.ch-werner.de/sqliteodbc/sqliteodbc-${version}.tar.gz";
+      sha256 = "0dgsj28sc7f7aprmdd0n5a1rmcx6pv7170c8dfjl0x1qsjxim6hs";
+    };
+ 
+    buildInputs = [ unixODBC sqlite zlib libxml2 ];
+ 
+    configureFlags = [ "--with-odbc=${unixODBC}" ];
+ 
+    installTargets = [ "install-3" ];
+
+    # move libraries to $out/lib where they're expected to be
+    postInstall = ''
+      mkdir -p "$out/lib"
+      mv "$out"/*.* "$out/lib"
+    '';
+ 
+    passthru = {
+      fancyName = "SQLite";
+      driver = "lib/libsqlite3odbc.so";
+    };
+
+    meta = with stdenv.lib; {
+      description = "ODBC driver for SQLite";
+      homepage = http://www.ch-werner.de/sqliteodbc;
+      license = licenses.bsd2;
+      platforms = platforms.linux;
+      maintainers = with maintainers; [ vlstill ];
+    };
+  };
+
+  msodbcsql17 = stdenv.mkDerivation rec {
+    name = "msodbcsql17-${version}";
+    version = "${versionMajor}.${versionMinor}.${versionAdditional}-1";
+
+    versionMajor = "17";
+    versionMinor = "2";
+    versionAdditional = "0.1";
+
+    src = fetchurl {
+      url = "https://packages.microsoft.com/debian/9/prod/pool/main/m/msodbcsql17/msodbcsql${versionMajor}_${version}_amd64.deb";
+      sha256 = "1966ymbbk0jsacqwzi3dmhxv2n8hfgnpjsx3hr3n7s9d88chgpx5";
+    };
+
+    nativeBuildInputs = [ autoPatchelfHook ];
+    buildInputs = [ unixODBC dpkg openssl kerberos curl libuuid stdenv.cc.cc ];
+
+    unpackPhase = "dpkg -x $src ./";
+    buildPhase = "";
+
+    installPhase = ''
+      mkdir -p $out
+      mkdir -p $out/lib
+      ln -s ${lib.getLib openssl}/lib/libssl.so.1.0.0 $out/lib/libssl.so.1.0.2
+      ln -s ${lib.getLib openssl}/lib/libcrypto.so.1.0.0 $out/lib/libcrypto.so.1.0.2
+      cp -r opt/microsoft/msodbcsql${versionMajor}/lib64 opt/microsoft/msodbcsql${versionMajor}/share $out/
+    '';
+
+    passthru = {
+      fancyName = "ODBC Driver 17 for SQL Server";
+      driver = "lib/libmsodbcsql-${versionMajor}.${versionMinor}.so.${versionAdditional}";
+    };
+
+    meta = with stdenv.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;
+      platforms = platforms.linux;
+      maintainers = with maintainers; [ spencerjanssen ];
+    };
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/uri/default.nix b/nixpkgs/pkgs/development/libraries/uri/default.nix
new file mode 100644
index 000000000000..46eac0fb88bb
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/uri/default.nix
@@ -0,0 +1,32 @@
+{ stdenv, fetchFromGitHub, cmake, doxygen }:
+
+stdenv.mkDerivation {
+  name = "uri-2017-07-16";
+
+  src = fetchFromGitHub {
+    owner = "cpp-netlib";
+    repo = "uri";
+    rev = "ac30f19cc7a4745667a8ebd3eac68d5e70b9a4a6";
+    sha256 = "0ys295ij071rilwkk3xq1p3sdzgb0gyybvd3f0cahh67kh8hyk6n";
+  };
+
+  nativeBuildInputs = [ cmake doxygen ];
+
+  cmakeFlags = [
+    "-DUri_BUILD_TESTS=OFF" "-DUri_BUILD_DOCS=ON" "-DBUILD_SHARED_LIBS=ON"
+  ];
+
+  postBuild = "make doc";
+
+  postInstall = ''
+    install -vd $out/share/doc
+    cp -vR html $out/share/doc
+  '';
+
+  meta = {
+    description = "C++ URI library";
+    homepage = https://cpp-netlib.org;
+    license = stdenv.lib.licenses.boost;
+    platforms = stdenv.lib.platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/uriparser/default.nix b/nixpkgs/pkgs/development/libraries/uriparser/default.nix
new file mode 100644
index 000000000000..89efdc006a54
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/uriparser/default.nix
@@ -0,0 +1,30 @@
+{ lib, stdenv, fetchurl, gtest, pkgconfig, doxygen, graphviz }:
+
+stdenv.mkDerivation rec {
+  name = "uriparser-${version}";
+  version = "0.9.1";
+
+  # Release tarball differs from source tarball
+  src = fetchurl {
+    url = "https://github.com/uriparser/uriparser/releases/download/${name}/${name}.tar.bz2";
+    sha256 = "1gisi7h8hd6mswbiaaa3s25bnb77xf37pzrmjy63rcdpwcyqy93m";
+  };
+
+  nativeBuildInputs = [ pkgconfig doxygen graphviz ];
+  buildInputs = lib.optional doCheck gtest;
+  configureFlags = lib.optional (!doCheck) "--disable-tests";
+
+  doCheck = stdenv.targetPlatform.system == stdenv.hostPlatform.system;
+
+  meta = with stdenv.lib; {
+    homepage = https://uriparser.github.io/;
+    description = "Strictly RFC 3986 compliant URI parsing library";
+    longDescription = ''
+      uriparser is a strictly RFC 3986 compliant URI parsing and handling library written in C.
+      API documentation is available on uriparser website.
+    '';
+    license = licenses.bsd3;
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ bosu ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/usbredir/default.nix b/nixpkgs/pkgs/development/libraries/usbredir/default.nix
new file mode 100644
index 000000000000..3d09545c9317
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/usbredir/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchurl, pkgconfig, libusb }:
+
+stdenv.mkDerivation rec {
+  name = "usbredir-${version}";
+  version = "0.8.0";
+
+  src = fetchurl {
+    url = "https://spice-space.org/download/usbredir/${name}.tar.bz2";
+    sha256 = "002yik1x7kn0427xahvnhjby2np14a6xqw7c3dx530n9h5d9rg47";
+  };
+
+  NIX_CFLAGS_COMPILE = [ "-Wno-error" ];
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ libusb ];
+  propagatedBuildInputs = [ libusb ];
+
+  outputs = [ "out" "dev" ];
+
+  meta = with stdenv.lib; {
+    description = "USB traffic redirection protocol";
+    homepage = http://spice-space.org/page/UsbRedir;
+    license = licenses.lgpl21;
+
+    maintainers = [ maintainers.offline ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/ustr/default.nix b/nixpkgs/pkgs/development/libraries/ustr/default.nix
new file mode 100644
index 000000000000..c15259c585ad
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/ustr/default.nix
@@ -0,0 +1,42 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "ustr-${version}";
+  version = "1.0.4";
+
+  src = fetchurl {
+    url = "http://www.and.org/ustr/${version}/${name}.tar.bz2";
+    sha256 = "1i623ygdj7rkizj7985q9d6vj5amwg686aqb5j3ixpkqkyp6xbrx";
+  };
+
+  # Fixes bogus warnings that failed libsemanage
+  patches = [ ./va_args.patch ];
+
+  # Work around gcc5 switch to gnu11
+  NIX_CFLAGS_COMPILE = "-std=gnu89";
+
+  # Fix detection of stdint.h
+  postPatch = ''
+    sed -i 's,\(have_stdint_h\)=0,\1=1,g' Makefile
+    sed -i 's,\(USTR_CONF_HAVE_STDINT_H\) 0,\1 1,g' ustr-import.in
+  '';
+
+  preBuild = ''
+    makeFlagsArray+=("prefix=$out")
+    makeFlagsArray+=("LDCONFIG=echo")
+    makeFlagsArray+=("HIDE=")
+  '';
+
+  # Remove debug libraries
+  postInstall = ''
+    find $out/lib -name \*debug\* -delete
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = http://www.and.org/ustr/;
+    description = "Micro String API for C language";
+    license = licenses.bsd2;
+    maintainers = [ maintainers.phreedom ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/ustr/va_args.patch b/nixpkgs/pkgs/development/libraries/ustr/va_args.patch
new file mode 100644
index 000000000000..f75b537485d8
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/ustr/va_args.patch
@@ -0,0 +1,23 @@
+diff --git a/ustr-compiler.h b/ustr-compiler.h
+index 9e71276..c5f847a 100644
+--- a/ustr-compiler.h
++++ b/ustr-compiler.h
+@@ -11,17 +11,11 @@
+ #define USTR_CONF_HAVE_ATTR_FMT 1
+ #endif
+ 
++#include <stdarg.h>
+ /* We assume this is enough,
+  * C99 specifies that va_copy() exists and is a macro */
+-#ifdef va_copy
+ # define USTR_CONF_HAVE_VA_COPY 1
+ # define USTR__VA_COPY(x, y)   va_copy(x, y)
+-#elif __va_copy
+-# define USTR_CONF_HAVE_VA_COPY 1
+-# define USTR__VA_COPY(x, y) __va_copy(x, y)
+-#else
+-# define USTR_CONF_HAVE_VA_COPY 0
+-#endif
+ 
+ #ifndef USTR_CONF_HAVE_ATTR_NONNULL
+ #if defined(__GNUC__) && (__GNUC__ > 3) /* not sure */
diff --git a/nixpkgs/pkgs/development/libraries/utf8proc/default.nix b/nixpkgs/pkgs/development/libraries/utf8proc/default.nix
new file mode 100644
index 000000000000..91bf7e393784
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/utf8proc/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchFromGitHub }:
+
+stdenv.mkDerivation rec {
+  pname = "utf8proc";
+  version = "2.4.0";
+
+  src = fetchFromGitHub {
+    owner = "JuliaStrings";
+    repo = pname;
+    rev = "v${version}";
+    sha256 = "1i42hqwc8znqii9brangwkxk5cyc2lk95ip405fg88zr7z2ncr34";
+  };
+
+  makeFlags = [ "prefix=$(out)" ];
+
+  meta = with stdenv.lib; {
+    description = "A clean C library for processing UTF-8 Unicode data";
+    homepage = "https://juliastrings.github.io/utf8proc/";
+    license = licenses.mit;
+    platforms = platforms.all;
+    maintainers = [ maintainers.ftrvxmtrx ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/uthash/default.nix b/nixpkgs/pkgs/development/libraries/uthash/default.nix
new file mode 100644
index 000000000000..b80984303d76
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/uthash/default.nix
@@ -0,0 +1,31 @@
+{ stdenv, fetchurl, perl }:
+
+let
+  version = "2.1.0";
+in
+stdenv.mkDerivation rec {
+  name = "uthash-${version}";
+
+  src = fetchurl {
+    url = "https://github.com/troydhanson/uthash/archive/v${version}.tar.gz";
+    sha256 = "17k6k97n20jpi9zj3lzvqfw8pv670r6rdqrjf8vrbx6hcj7csb0m";
+  };
+
+  dontBuild = false;
+
+  doCheck = true;
+  checkInputs = [ perl ];
+  checkTarget = "-C tests/";
+
+  installPhase = ''
+    mkdir -p "$out/include"
+    cp ./src/* "$out/include/"
+  '';
+
+  meta = with stdenv.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
+    platforms   = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/utmps/default.nix b/nixpkgs/pkgs/development/libraries/utmps/default.nix
new file mode 100644
index 000000000000..81562659c0d9
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/utmps/default.nix
@@ -0,0 +1,32 @@
+{ stdenv, skawarePackages }:
+
+with skawarePackages;
+
+buildPackage {
+  pname = "utmps";
+  version = "0.0.2.1";
+  sha256 = "1q90mcn50irhhrzl3h9bvhsn7hac0zgg67b6hfhmc5yvh4c8wnr4";
+
+  description = "A secure utmpx and wtmp implementation";
+
+  configureFlags = [
+    "--libdir=\${lib}/lib"
+    "--dynlibdir=\${lib}/lib"
+    "--bindir=\${bin}/bin"
+    "--includedir=\${dev}/include"
+    "--with-sysdeps=${skalibs.lib}/lib/skalibs/sysdeps"
+    "--with-include=${skalibs.dev}/include"
+    "--with-lib=${skalibs.lib}/lib"
+    "--with-dynlib=${skalibs.lib}/lib"
+  ];
+
+  postInstall = ''
+    # remove all execline executables from build directory
+    rm $(find -type f -mindepth 1 -maxdepth 1 -executable)
+    rm libutmps.*
+
+    mv doc $doc/share/doc/utmps/html
+    mv examples $doc/share/doc/utmps/examples
+  '';
+}
+
diff --git a/nixpkgs/pkgs/development/libraries/v8/3.14.nix b/nixpkgs/pkgs/development/libraries/v8/3.14.nix
new file mode 100644
index 000000000000..827274251ed9
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/v8/3.14.nix
@@ -0,0 +1,86 @@
+# This old version of V8 is still needed for the R V8 module
+{ stdenv, fetchFromGitHub, gyp, readline, python, which, icu, ... }:
+
+assert readline != null;
+
+with stdenv.lib;
+let
+  version = "3.14.5.10";
+  sha256 = "08vhl84166x13b3cbx8y0g99yqx772zd33gawsa1nxqkyrykql6k";
+
+  arch = if stdenv.is64bit then "x64" else "ia32";
+
+in
+stdenv.mkDerivation rec {
+  name = "v8-${version}";
+  inherit version;
+
+  src = fetchFromGitHub {
+    owner = "v8";
+    repo = "v8";
+    rev = "${version}";
+    inherit sha256;
+  };
+  patchPhase = ''
+    sed -i 's,#!/usr/bin/env python,#!${python}/bin/python,' build/gyp_v8
+    sed -i 's,#!/usr/bin/python,#!${python}/bin/python,' build/gyp_v8
+  '';
+
+  configurePhase = ''
+    PYTHONPATH="tools/generate_shim_headers:$PYTHONPATH" \
+    PYTHONPATH="$(toPythonPath ${gyp}):$PYTHONPATH" \
+      build/gyp_v8 \
+        -f make \
+        --generator-output="out" \
+        -Dflock_index=0 \
+        -Dv8_enable_i18n_support=1 \
+        -Duse_system_icu=1 \
+        -Dconsole=readline \
+        -Dcomponent=shared_library \
+        -Dv8_target_arch=${arch}
+  '';
+
+  nativeBuildInputs = [ which ];
+  buildInputs = [ readline python icu ];
+
+  # http://code.google.com/p/v8/issues/detail?id=2149
+  NIX_CFLAGS_COMPILE = concatStringsSep " " [
+    "-Wno-error=strict-overflow"
+    "-Wno-unused-local-typedefs"
+    "-Wno-aggressive-loop-optimizations"
+  ];
+
+  buildFlags = [
+    "LINK=g++"
+    "-C out"
+    "builddir=$(CURDIR)/Release"
+    "BUILDTYPE=Release"
+  ];
+
+  postPatch = stdenv.lib.optionalString (!stdenv.cc.isClang) ''
+    sed -i build/standalone.gyp -e 's,-Wno-format-pedantic,,g'
+  '';
+
+  enableParallelBuilding = true;
+
+  installPhase = ''
+    install -vD out/Release/d8 "$out/bin/d8"
+    ${if stdenv.hostPlatform.system == "x86_64-darwin" then ''
+    install -vD out/Release/lib.target/libv8.dylib "$out/lib/libv8.dylib"
+    '' else ''
+    install -vD out/Release/lib.target/libv8.so "$out/lib/libv8.so"
+    ''}
+    cp -vr include "$out/"
+  '';
+
+  postFixup = if stdenv.isDarwin then ''
+    install_name_tool -change /usr/local/lib/libv8.dylib $out/lib/libv8.dylib -change /usr/lib/libgcc_s.1.dylib ${stdenv.cc.cc.lib}/lib/libgcc_s.1.dylib $out/bin/d8
+    install_name_tool -id $out/lib/libv8.dylib -change /usr/lib/libgcc_s.1.dylib ${stdenv.cc.cc.lib}/lib/libgcc_s.1.dylib $out/lib/libv8.dylib
+  '' else null;
+
+  meta = with stdenv.lib; {
+    description = "Google's open source JavaScript engine";
+    platforms = platforms.linux;
+    license = licenses.bsd3;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/v8/3.16.14.nix b/nixpkgs/pkgs/development/libraries/v8/3.16.14.nix
new file mode 100644
index 000000000000..a7dddd141246
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/v8/3.16.14.nix
@@ -0,0 +1,81 @@
+{ stdenv, lib, fetchurl, gyp, readline, python, which, icu, utillinux, cctools }:
+
+assert readline != null;
+
+let
+  arch = if stdenv.isAarch32
+    then (if stdenv.is64bit then "arm64" else "arm")
+    else (if stdenv.is64bit then "x64" else "ia32");
+  armHardFloat = stdenv.isAarch32 && (stdenv.hostPlatform.platform.gcc.float or null) == "hard";
+in
+
+stdenv.mkDerivation rec {
+  name = "v8-${version}";
+  version = "3.16.14.11";
+
+  src = fetchurl {
+    url = "https://commondatastorage.googleapis.com/chromium-browser-official/"
+        + "${name}.tar.bz2";
+    sha256 = "1gpf2xvhxfs5ll3m2jlslsx9jfjbmrbz55iq362plflrvf8mbxhj";
+  };
+
+  postPatch = ''
+    sed -i 's/-Werror//' build/standalone.gypi build/common.gypi
+  '';
+
+  configurePhase = stdenv.lib.optionalString stdenv.isDarwin ''
+    export GYP_DEFINES="mac_deployment_target=$MACOSX_DEPLOYMENT_TARGET"
+  '' + ''
+    PYTHONPATH="tools/generate_shim_headers:$PYTHONPATH" \
+      ${gyp}/bin/gyp \
+        -f make \
+        --generator-output="out" \
+        -Dflock_index=0 \
+        -Dv8_enable_i18n_support=1 \
+        -Duse_system_icu=1 \
+        -Dconsole=readline \
+        -Dcomponent=shared_library \
+        -Dv8_target_arch=${arch} \
+        ${lib.optionalString armHardFloat "-Dv8_use_arm_eabi_hardfloat=true"} \
+        --depth=. -Ibuild/standalone.gypi \
+        build/all.gyp
+  '' + stdenv.lib.optionalString stdenv.isDarwin ''
+    sed -i 's@/usr/bin/env python@${python}/bin/python@g' out/gyp-mac-tool
+  '';
+
+  nativeBuildInputs = [ which ];
+  buildInputs = [ readline python icu ]
+                  ++ lib.optional stdenv.isLinux utillinux
+                  ++ lib.optional stdenv.isDarwin cctools;
+
+  NIX_CFLAGS_COMPILE = "-Wno-error -w";
+
+  buildFlags = [
+    "-C out"
+    "builddir=$(CURDIR)/Release"
+    "BUILDTYPE=Release"
+  ];
+
+  enableParallelBuilding = true;
+
+  installPhase = ''
+    install -vD out/Release/d8 "$out/bin/d8"
+    ${if stdenv.isDarwin then ''
+    install -vD out/Release/libv8.dylib "$out/lib/libv8.dylib"
+    '' else ''
+    install -vD out/Release/lib.target/libv8.so "$out/lib/libv8.so"
+    ''}
+    cp -vr include "$out/"
+  '';
+
+  postFixup = if stdenv.isDarwin then ''
+    install_name_tool -change /usr/local/lib/libv8.dylib $out/lib/libv8.dylib $out/bin/d8
+    install_name_tool -id $out/lib/libv8.dylib $out/lib/libv8.dylib
+  '' else null;
+
+  meta = with stdenv.lib; {
+    description = "V8 is Google's open source JavaScript engine";
+    platforms = platforms.linux ++ platforms.darwin;
+    license = licenses.bsd3;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/v8/5_x.nix b/nixpkgs/pkgs/development/libraries/v8/5_x.nix
new file mode 100644
index 000000000000..2b9fa5cc04c0
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/v8/5_x.nix
@@ -0,0 +1,199 @@
+{ stdenv, lib, fetchgit, fetchFromGitHub, gyp, readline, python, which, icu
+, patchelf, coreutils, xcbuild
+, doCheck ? false
+, static ? false
+}:
+
+assert readline != null;
+
+let
+  arch = if stdenv.isx86_64 then "x64"
+            else if stdenv.isi686 then "ia32"
+            else if stdenv.isAarch64 then "arm64"
+            else if stdenv.isAarch32 then "arm"
+            else throw "Unknown architecture for v8";
+  git_url = "https://chromium.googlesource.com";
+  clangFlag = if stdenv.isDarwin then "1" else "0";
+  sharedFlag = if static then "static_library" else "shared_library";
+
+  deps = {
+    "build" = fetchgit {
+      url = "${git_url}/chromium/src/build.git";
+      rev = "2c67d4d74b6b3673228fab191918500a582ef3b0";
+      sha256 = "0jc7hci5yh792pw0ahjfxrk5xzllnlrv9llmwlgcgn2x8x6bn34q";
+    };
+    "tools/gyp" = fetchgit {
+      url = "${git_url}/external/gyp.git";
+      rev = "e7079f0e0e14108ab0dba58728ff219637458563";
+      sha256 = "0yd1ds13z0r9d2sb67f9i1gjn1zgzwyfv96qqqp6pn5pcfbialg6";
+    };
+    "third_party/icu" = fetchgit {
+      url = "${git_url}/chromium/deps/icu.git";
+      rev = "b5ecbb29a26532f72ef482569b223d5a51fd50bf";
+      sha256 = "0ld47wdnk8grcba221z67l3pnphv9zwifk4y44f5b946w3iwmpns";
+    };
+    "buildtools" = fetchgit {
+      url = "${git_url}/chromium/buildtools.git";
+      rev = "60f7f9a8b421ebf9a46041dfa2ff11c0fe59c582";
+      sha256 = "0i10bw7yhslklqwcx5krs3k05sicb73cpwd0mkaz96yxsvmkvjq0";
+    };
+    "base/trace_event/common" = fetchgit {
+      url = "${git_url}/chromium/src/base/trace_event/common.git";
+      rev = "315bf1e2d45be7d53346c31cfcc37424a32c30c8";
+      sha256 = "1pp2ygvp20j6g4868hrmiw0j704kdvsi9d9wx2gbk7w79rc36695";
+    };
+    "platform/inspector_protocol" = fetchgit {
+      url = "${git_url}/chromium/src/third_party/WebKit/Source/platform/inspector_protocol.git";
+      rev = "f49542089820a34a9a6e33264e09b73779407512";
+      sha256 = "1lwpass3p4rpp2kjmxxxpkqyv4lznxhf4i0yy7mmrd7jkpc7kn8k";
+    };
+    "tools/mb" = fetchgit {
+      url = "${git_url}/chromium/src/tools/mb.git";
+      rev = "0c4dc43c454f26936ddf3074ab8e9a41e3dc03a3";
+      sha256 = "0f96qphbmwn1pprv0a6xf68p01s1jzx2sz6pmadqbrs1dgh1xwnk";
+    };
+    "tools/swarming_client" = fetchgit {
+      url = "${git_url}/external/swarming.client.git";
+      rev = "7f63a272f7d9785ce41b6d10bb3106c49a968e57";
+      sha256 = "1pmb8bq4qifjf2dzz8c4jdwhlvwgrl9ycjaalcyh1sbh4lx3yvv2";
+    };
+    "testing/gtest" = fetchgit {
+      url = "${git_url}/external/github.com/google/googletest.git";
+      rev = "6f8a66431cb592dad629028a50b3dd418a408c87";
+      sha256 = "0bdba2lr6pg15bla9600zg0r0vm4lnrx0wqz84p376wfdxra24vw";
+    };
+    "testing/gmock" = fetchgit {
+      url = "${git_url}/external/googlemock.git";
+      rev = "0421b6f358139f02e102c9c332ce19a33faf75be";
+      sha256 = "1xiky4v98maxs8fg1avcd56y0alv3hw8qyrlpd899zgzbq2k10pp";
+    };
+    "test/benchmarks/data" = fetchgit {
+      url = "${git_url}/v8/deps/third_party/benchmarks.git";
+      rev = "05d7188267b4560491ff9155c5ee13e207ecd65f";
+      sha256 = "0ad2ay14bn67d61ks4dmzadfnhkj9bw28r4yjdjjyzck7qbnzchl";
+    };
+    "test/mozilla/data" = fetchgit {
+      url = "${git_url}/v8/deps/third_party/mozilla-tests.git";
+      rev = "f6c578a10ea707b1a8ab0b88943fe5115ce2b9be";
+      sha256 = "0rfdan76yfawqxbwwb35aa57b723j3z9fx5a2w16nls02yk2kqyn";
+    };
+    "test/simdjs/data" = fetchgit {
+      url = "${git_url}/external/github.com/tc39/ecmascript_simd.git";
+      rev = "baf493985cb9ea7cdbd0d68704860a8156de9556";
+      sha256 = "178r0k40a58c1187gfzqz2i6as34l8cliy1g1x870wyy0qcvlq2q";
+    };
+    "test/test262/data" = fetchgit {
+      url = "${git_url}/external/github.com/tc39/test262.git";
+      rev = "88bc7fe7586f161201c5f14f55c9c489f82b1b67";
+      sha256 = "0gc7fmaqrgwb6rl02jnrm3synpwzzg0dfqy3zm386r1qcisl93xs";
+    };
+    "test/test262/harness" = fetchgit {
+      url = "${git_url}/external/github.com/test262-utils/test262-harness-py.git";
+      rev = "cbd968f54f7a95c6556d53ba852292a4c49d11d8";
+      sha256 = "094c3600a4wh1m3fvvlivn290kik1pzzvwabq77lk8bh4jkkv7ki";
+    };
+    "tools/clang" = fetchgit {
+      url = "${git_url}/chromium/src/tools/clang.git";
+      rev = "496622ab4aaa5be7e5a9b80617013cb02f45dc87";
+      sha256 = "1gkhk2bzpxwzkirzcqfixxpprbr8mn6rk00krm25daarm3smydmf";
+    };
+  };
+
+in
+
+stdenv.mkDerivation rec {
+  name = "v8-${version}";
+  version = "5.4.232";
+
+  inherit doCheck;
+
+  src = fetchFromGitHub {
+    owner = "v8";
+    repo = "v8";
+    rev = version;
+    sha256 = "1nqxbkz75m8xrjih0sj3f3iqvif4192vxdaxzy8r787rihjwg9nx";
+  };
+
+  postUnpack = ''
+    ${lib.concatStringsSep "\n" (
+      lib.mapAttrsToList (n: v: ''
+        mkdir -p $sourceRoot/${n}
+        cp -r ${v}/* $sourceRoot/${n}
+      '') deps)}
+  '';
+
+  # Patch based off of:
+  # https://github.com/cowboyd/libv8/tree/v5.1.281.67.0/patches
+  patches = lib.optional (!doCheck) ./libv8-5.4.232.patch;
+
+  postPatch = ''
+    sed -i 's,#!/usr/bin/env python,#!${python}/bin/python,' gypfiles/gyp_v8
+    sed -i 's,/bin/echo,${coreutils}/bin/echo,' gypfiles/standalone.gypi
+    sed -i '/CR_CLANG_REVISION/ d' gypfiles/standalone.gypi
+    sed -i 's/-Wno-format-pedantic//g' gypfiles/standalone.gypi
+  '';
+
+  configurePhase = ''
+    PYTHONPATH="tools/generate_shim_headers:$PYTHONPATH" \
+    PYTHONPATH="$(toPythonPath ${gyp}):$PYTHONPATH" \
+      gypfiles/gyp_v8 \
+        -f make \
+        --generator-output="out" \
+        -Dflock_index=0 \
+        -Dclang=${clangFlag} \
+        -Dv8_enable_i18n_support=1 \
+        -Duse_system_icu=1 \
+        -Dcomponent=${sharedFlag} \
+        -Dconsole=readline \
+        -Dv8_target_arch=${arch} \
+        -Dv8_use_external_startup_data=0
+  '';
+
+  nativeBuildInputs = [ which ];
+  buildInputs = [ readline python icu ]
+    ++ stdenv.lib.optional stdenv.isDarwin xcbuild
+    ++ stdenv.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";
+
+  buildFlags = [
+    "LINK=c++"
+    "-C out"
+    "builddir=$(CURDIR)/Release"
+    "BUILDTYPE=Release"
+  ];
+
+  enableParallelBuilding = true;
+
+  dontUpdateAutotoolsGnuConfigScripts = if stdenv.isAarch64 then true else null;
+
+  # the `libv8_libplatform` target is _only_ built as a static library,
+  # and is expected to be statically linked in when needed.
+  # see the following link for further commentary:
+  # https://github.com/cowboyd/therubyracer/issues/391
+  installPhase = ''
+    install -vD out/Release/d8 "$out/bin/d8"
+    install -vD out/Release/mksnapshot "$out/bin/mksnapshot"
+    ${if static then ""
+    else if stdenv.isDarwin then ''
+    install -vD out/Release/libv8.dylib "$out/lib/libv8.dylib"
+    install_name_tool -change /usr/local/lib/libv8.dylib $out/lib/libv8.dylib -change /usr/lib/libgcc_s.1.dylib ${stdenv.cc.cc.lib}/lib/libgcc_s.1.dylib $out/bin/d8
+    install_name_tool -id $out/lib/libv8.dylib -change /usr/lib/libgcc_s.1.dylib ${stdenv.cc.cc.lib}/lib/libgcc_s.1.dylib $out/lib/libv8.dylib
+    '' else ''
+    install -vD out/Release/lib.target/libv8.so "$out/lib/libv8.so"
+    ''}
+    mkdir -p "$out/include"
+    cp -vr include/*.h "$out/include"
+    cp -vr include/libplatform "$out/include"
+    mkdir -p "$out/lib"
+    cp -v  out/Release/*.a "$out/lib"
+  '';
+
+  meta = with lib; {
+    description = "Google's open source JavaScript engine";
+    maintainers = with maintainers; [ cstrahan proglodyte ];
+    platforms = platforms.linux ++ platforms.darwin;
+    license = licenses.bsd3;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/v8/darwin.patch b/nixpkgs/pkgs/development/libraries/v8/darwin.patch
new file mode 100644
index 000000000000..629d5e4dc392
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/v8/darwin.patch
@@ -0,0 +1,22 @@
+diff --git a/toolchain/gcc_toolchain.gni b/toolchain/gcc_toolchain.gni
+index 80e2a362a..df138c87b 100644
+--- a/build/toolchain/gcc_toolchain.gni
++++ b/build/toolchain/gcc_toolchain.gni
+@@ -355,6 +355,8 @@ template("gcc_toolchain") {
+         # AIX does not support either -D (deterministic output) or response
+         # files.
+         command = "$ar -X64 {{arflags}} -r -c -s {{output}} {{inputs}}"
++      } else if (current_os == "mac") {
++        command = "$ar {{arflags}} -r -c -s {{output}} {{inputs}}"
+       } else {
+         rspfile = "{{output}}.rsp"
+         rspfile_content = "{{inputs}}"
+@@ -546,7 +548,7 @@ template("gcc_toolchain") {
+ 
+       start_group_flag = ""
+       end_group_flag = ""
+-      if (current_os != "aix") {
++      if (current_os != "aix" && current_os != "mac") {
+         # the "--start-group .. --end-group" feature isn't available on the aix ld.
+         start_group_flag = "-Wl,--start-group"
+         end_group_flag = "-Wl,--end-group "
diff --git a/nixpkgs/pkgs/development/libraries/v8/default.nix b/nixpkgs/pkgs/development/libraries/v8/default.nix
new file mode 100644
index 000000000000..f7c4f34e8e6e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/v8/default.nix
@@ -0,0 +1,115 @@
+{ stdenv, lib, fetchgit, fetchFromGitHub
+, gn, ninja, python, glib, pkgconfig, icu
+, xcbuild, darwin
+, fetchpatch
+}:
+
+let
+  git_url = "https://chromium.googlesource.com";
+
+  # This data is from the DEPS file in the root of a V8 checkout
+  deps = {
+    "base/trace_event/common" = fetchgit {
+      url    = "${git_url}/chromium/src/base/trace_event/common.git";
+      rev    = "936ba8a963284a6b3737cf2f0474a7131073abee";
+      sha256 = "14nr22fqdpxma1kzjflj6a865vr3hfnnm2gs4vcixyq4kmfzfcy2";
+    };
+    "build" = fetchgit {
+      url    = "${git_url}/chromium/src/build.git";
+      rev    = "325e95d6dae64f35b160b3dc7d73218cee5ec079";
+      sha256 = "0dddyxa76p2xpjhmxif05v63i5ar6h5v684fdl667sg84f5bhhxf";
+    };
+    "third_party/googletest/src" = fetchgit {
+      url    = "${git_url}/external/github.com/google/googletest.git";
+      rev    = "5ec7f0c4a113e2f18ac2c6cc7df51ad6afc24081";
+      sha256 = "0gmr10042c0xybxnn6g7ndj1na1mmd3l9w7449qlcv4s8gmfs7k6";
+    };
+    "third_party/icu" = fetchgit {
+      url    = "${git_url}/chromium/deps/icu.git";
+      rev    = "960f195aa87acaec46e6104ec93a596da7ae0843";
+      sha256 = "073kh6gpcairgjxf3hlhpqljc13gwl2aj8fz91fv220xibwqs834";
+    };
+    "third_party/jinja2" = fetchgit {
+      url    = "${git_url}/chromium/src/third_party/jinja2.git";
+      rev    = "b41863e42637544c2941b574c7877d3e1f663e25";
+      sha256 = "1qgilclkav67m6cl2xq2kmzkswrkrb2axc2z8mw58fnch4j1jf1r";
+    };
+    "third_party/markupsafe" = fetchgit {
+      url    = "${git_url}/chromium/src/third_party/markupsafe.git";
+      rev    = "8f45f5cfa0009d2a70589bcda0349b8cb2b72783";
+      sha256 = "168ppjmicfdh4i1l0l25s86mdbrz9fgxmiq1rx33x79mph41scfz";
+    };
+  };
+
+in
+
+stdenv.mkDerivation rec {
+  name = "v8-${version}";
+  version = "7.4.255";
+
+  doCheck = true;
+
+  patches = [
+    (fetchpatch {
+      url = "https://raw.githubusercontent.com/RPi-Distro/chromium-browser/master/debian/patches/revert-Xclang-instcombine-lower-dbg-declare.patch";
+      sha256 = "02hczcg43m36q8j1kv5j3hq9czj9niiil9w13w22vzv2f3c67dvn";
+    })
+    ./darwin.patch
+  ];
+
+  src = fetchFromGitHub {
+    owner = "v8";
+    repo = "v8";
+    rev = version;
+    sha256 = "14i0c71hmffzqnq9n73dh9dnabdxhbjhzkhqpk5yv9y90bwrzi2n";
+  };
+
+  postUnpack = ''
+    ${lib.concatStringsSep "\n" (
+      lib.mapAttrsToList (n: v: ''
+        mkdir -p $sourceRoot/${n}
+        cp -r ${v}/* $sourceRoot/${n}
+      '') deps)}
+    chmod u+w -R .
+  '';
+
+  gnFlags = [
+    "use_custom_libcxx=false"
+    "is_clang=${if stdenv.cc.isClang then "true" else "false"}"
+    "use_sysroot=false"
+    # "use_system_icu=true"
+    "is_component_build=false"
+    "v8_use_external_startup_data=false"
+    "v8_monolithic=true"
+    "is_debug=true"
+    "is_official_build=false"
+    "treat_warnings_as_errors=false"
+    "v8_enable_i18n_support=true"
+    "use_gold=false"
+    "use_system_xcode=true"
+    # ''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}"'';
+
+  nativeBuildInputs = [ gn ninja pkgconfig python ]
+    ++ stdenv.lib.optionals stdenv.isDarwin [ xcbuild darwin.DarwinTools ];
+  buildInputs = [ glib icu ];
+
+  ninjaFlags = [ ":d8" "v8_monolith" ];
+
+  enableParallelBuilding = true;
+
+  installPhase = ''
+    install -D d8 $out/bin/d8
+    install -D obj/libv8_monolith.a $out/lib/libv8.a
+    cp -r ../../include $out
+  '';
+
+  meta = with lib; {
+    description = "Google's open source JavaScript engine";
+    maintainers = with maintainers; [ cstrahan proglodyte matthewbauer ];
+    platforms = platforms.unix;
+    license = licenses.bsd3;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/v8/libv8-5.4.232.patch b/nixpkgs/pkgs/development/libraries/v8/libv8-5.4.232.patch
new file mode 100644
index 000000000000..16c227cfe38d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/v8/libv8-5.4.232.patch
@@ -0,0 +1,97 @@
+From c9f42d1314c6026efcfcc01824f4e2fdfd05ebcf Mon Sep 17 00:00:00 2001
+From: Ben Sklaroff <bsklaroff@gmail.com>
+Date: Sat, 23 Jul 2016 18:16:55 -0400
+Subject: [PATCH] libv8-5.4.232
+
+---
+ Makefile                 |  5 +----
+ gypfiles/all.gyp         | 32 --------------------------------
+ gypfiles/standalone.gypi |  5 ++++-
+ 3 files changed, 5 insertions(+), 37 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index 5ea5c58..d1b2d73 100644
+--- a/Makefile
++++ b/Makefile
+@@ -261,11 +261,8 @@ GYPFILES = third_party/icu/icu.gypi third_party/icu/icu.gyp \
+ 	   gypfiles/shim_headers.gypi gypfiles/features.gypi \
+            gypfiles/standalone.gypi \
+ 	   gypfiles/toolchain.gypi gypfiles/all.gyp gypfiles/mac/asan.gyp \
+-	   test/cctest/cctest.gyp test/fuzzer/fuzzer.gyp \
+-	   test/unittests/unittests.gyp src/v8.gyp \
+-	   tools/parser-shell.gyp testing/gmock.gyp testing/gtest.gyp \
+ 	   buildtools/third_party/libc++abi/libc++abi.gyp \
+-	   buildtools/third_party/libc++/libc++.gyp samples/samples.gyp \
++	   buildtools/third_party/libc++/libc++.gyp \
+ 	   src/third_party/vtune/v8vtune.gyp src/d8.gyp
+ 
+ # If vtunejit=on, the v8vtune.gyp will be appended.
+diff --git a/gypfiles/all.gyp b/gypfiles/all.gyp
+index ff1bea4..96820a0 100644
+--- a/gypfiles/all.gyp
++++ b/gypfiles/all.gyp
+@@ -16,38 +16,6 @@
+             '../tools/parser-shell.gyp:parser-shell',
+           ],
+         }],
+-        # These items don't compile for Android on Mac.
+-        ['host_os!="mac" or OS!="android"', {
+-          'dependencies': [
+-            '../samples/samples.gyp:*',
+-            '../test/cctest/cctest.gyp:*',
+-            '../test/fuzzer/fuzzer.gyp:*',
+-            '../test/unittests/unittests.gyp:*',
+-            ],
+-        }],
+-        ['test_isolation_mode != "noop"', {
+-          'dependencies': [
+-            '../test/bot_default.gyp:*',
+-            '../test/benchmarks/benchmarks.gyp:*',
+-            '../test/default.gyp:*',
+-            '../test/ignition.gyp:*',
+-            '../test/intl/intl.gyp:*',
+-            '../test/message/message.gyp:*',
+-            '../test/mjsunit/mjsunit.gyp:*',
+-            '../test/mozilla/mozilla.gyp:*',
+-            '../test/optimize_for_size.gyp:*',
+-            '../test/perf.gyp:*',
+-            '../test/preparser/preparser.gyp:*',
+-            '../test/simdjs/simdjs.gyp:*',
+-            '../test/test262/test262.gyp:*',
+-            '../test/webkit/webkit.gyp:*',
+-            '../tools/check-static-initializers.gyp:*',
+-            '../tools/gcmole/run_gcmole.gyp:*',
+-            '../tools/jsfunfuzz/jsfunfuzz.gyp:*',
+-            '../tools/run-deopt-fuzzer.gyp:*',
+-            '../tools/run-valgrind.gyp:*',
+-          ],
+-        }],
+       ]
+     }
+   ]
+diff --git a/gypfiles/standalone.gypi b/gypfiles/standalone.gypi
+index 89f06a0..a43976d 100644
+--- a/gypfiles/standalone.gypi
++++ b/gypfiles/standalone.gypi
+@@ -506,6 +506,9 @@
+       }],  # fastbuild!=0
+     ],
+     'target_conditions': [
++      ['_type=="static_library"', {
++        'standalone_static_library': 1,
++      }],
+       ['v8_code == 0', {
+         'defines!': [
+           'DEBUG',
+@@ -770,7 +773,7 @@
+           [ 'visibility=="hidden" and v8_enable_backtrace==0', {
+             'cflags': [ '-fvisibility=hidden' ],
+           }],
+-          [ 'component=="shared_library"', {
++          [ 'component=="shared_library" or component=="static_library" and (v8_target_arch=="x64" or v8_target_arch=="arm64" or v8_target_arch=="arm")', {
+             'cflags': [ '-fPIC', ],
+           }],
+           [ 'clang==0 and coverage==1', {
+-- 
+2.9.0
+
diff --git a/nixpkgs/pkgs/development/libraries/v8/plv8_6_x.nix b/nixpkgs/pkgs/development/libraries/v8/plv8_6_x.nix
new file mode 100644
index 000000000000..8d2276def705
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/v8/plv8_6_x.nix
@@ -0,0 +1,187 @@
+# NOTE: this expression is NOT exported from the top-level of all-packages.nix,
+# it is exclusively used by the 'plv8' PostgreSQL extension, which requires a
+# very exact version.
+
+{ stdenv, lib, fetchgit, fetchFromGitHub, gn, ninja, python, glib, pkgconfig
+, doCheck ? false
+, snapshot ? true
+}:
+
+let
+  arch = if stdenv.isAarch32
+         then if stdenv.is64bit
+              then"arm64"
+              else "arm"
+         else if stdenv.is64bit
+              then"x64"
+              else "ia32";
+  git_url = "https://chromium.googlesource.com";
+
+  # This data is from the DEPS file in the root of a V8 checkout
+  deps = {
+    "base/trace_event/common" = fetchgit {
+      url    = "${git_url}/chromium/src/base/trace_event/common.git";
+      rev    = "0e9a47d74970bee1bbfc063c47215406f8918699";
+      sha256 = "07rbzrlscp8adh4z86yl5jxdnvgkc3xs950xldpk318wf9i3bh6c";
+    };
+    "build" = fetchgit {
+      url    = "${git_url}/chromium/src/build.git";
+      rev    = "9338ce52d0b9bcef34c38285fbd5023b62739fac";
+      sha256 = "1s2sa8dy3waidsirjylc82ggb18l1108bczjc8z0v4ywyj4k0cvh";
+    };
+    "buildtools" = fetchgit {
+      url    = "${git_url}/chromium/buildtools.git";
+      rev    = "505de88083136eefd056e5ee4ca0f01fe9b33de8";
+      sha256 = "0vj216nhb803bggsl0hnyagj8njrm96pn8sim6xcnqb7nhz1vabw";
+    };
+    "test/benchmarks/data" = fetchgit {
+      url    = "${git_url}/v8/deps/third_party/benchmarks.git";
+      rev    = "05d7188267b4560491ff9155c5ee13e207ecd65f";
+      sha256 = "0ad2ay14bn67d61ks4dmzadfnhkj9bw28r4yjdjjyzck7qbnzchl";
+    };
+    "test/mozilla/data" = fetchgit {
+      url    = "${git_url}/v8/deps/third_party/mozilla-tests.git";
+      rev    = "f6c578a10ea707b1a8ab0b88943fe5115ce2b9be";
+      sha256 = "0rfdan76yfawqxbwwb35aa57b723j3z9fx5a2w16nls02yk2kqyn";
+    };
+    "test/test262/data" = fetchgit {
+      url    = "${git_url}/external/github.com/tc39/test262.git";
+      rev    = "5d4c667b271a9b39d0de73aef5ffe6879c6f8811";
+      sha256 = "0q9iwb2nkybf9np95wgf5m372aw2lhx9wlsw41a2a80kbkvb2kqg";
+    };
+    "test/test262/harness" = fetchgit {
+      url    = "${git_url}/external/github.com/test262-utils/test262-harness-py.git";
+      rev    = "0f2acdd882c84cff43b9d60df7574a1901e2cdcd";
+      sha256 = "00brj5avp43yamc92kinba2mg3a2x1rcd7wnm7z093l73idprvkp";
+    };
+    "test/wasm-js" = fetchgit {
+      url    = "${git_url}/external/github.com/WebAssembly/spec.git";
+      rev    = "a7e226a92e660a3d5413cfea4269824f513259d2";
+      sha256 = "0z3aybj3ykajwh2bv5fwd6pwqjjsq8dnwrqc2wncb6r9xcjwbgxp";
+    };
+    "testing/gtest" = fetchgit {
+      url    = "${git_url}/external/github.com/google/googletest.git";
+      rev    = "6f8a66431cb592dad629028a50b3dd418a408c87";
+      sha256 = "0bdba2lr6pg15bla9600zg0r0vm4lnrx0wqz84p376wfdxra24vw";
+    };
+    "third_party/icu" = fetchgit {
+      url    = "${git_url}/chromium/deps/icu.git";
+      rev    = "741688ebf328da9adc52505248bf4e2ef868722c";
+      sha256 = "02ifm18qjlrkn5nm2rxkf9yz9bdlyq7c65jfjndv63vi1drqh1r9";
+    };
+    "third_party/instrumented_libraries" = fetchgit {
+      url    = "${git_url}/chromium/src/third_party/instrumented_libraries.git";
+      rev    = "28417458ac4dc79f68915079d0f283f682504cc0";
+      sha256 = "1qf5c2946n37p843yriv7xawi6ss6samabghq43s49cgd4wq8dc3";
+    };
+    "third_party/jinja2" = fetchgit {
+      url    = "${git_url}/chromium/src/third_party/jinja2.git";
+      rev    = "d34383206fa42d52faa10bb9931d6d538f3a57e0";
+      sha256 = "0d9hyw0bvp3p0dbwy833cm9vdqxcam0qbm9jc561ynphddxlkmgd";
+    };
+    "third_party/markupsafe" = fetchgit {
+      url    = "${git_url}/chromium/src/third_party/markupsafe.git";
+      rev    = "8f45f5cfa0009d2a70589bcda0349b8cb2b72783";
+      sha256 = "168ppjmicfdh4i1l0l25s86mdbrz9fgxmiq1rx33x79mph41scfz";
+    };
+    "tools/clang" = fetchgit {
+      url    = "${git_url}/chromium/src/tools/clang.git";
+      rev    = "8688d267571de76a56746324dcc249bf4232b85a";
+      sha256 = "0krq4zz1vnwp064bm517gwr2napy18wyccdh8w5s4qgkjwwxd63s";
+    };
+    "tools/gyp" = fetchgit {
+      url    = "${git_url}/external/gyp.git";
+      rev    = "d61a9397e668fa9843c4aa7da9e79460fe590bfb";
+      sha256 = "1z081h72mjy285jb1kj5xd0pb4p12n9blvsimsavyn3ldmswv0r0";
+    };
+    "tools/luci-go" = fetchgit {
+      url    = "${git_url}/chromium/src/tools/luci-go.git";
+      rev    = "45a8a51fda92e123619a69e7644d9c64a320b0c1";
+      sha256 = "0r7736gqk7r0i7ig0b5ib10d9q8a8xzsmc0f0fbkm9k78v847vpj";
+    };
+    "tools/swarming_client" = fetchgit {
+      url    = "${git_url}/infra/luci/client-py.git";
+      rev    = "4bd9152f8a975d57c972c071dfb4ddf668e02200";
+      sha256 = "03zk91gzvqv01g1vbl8d7h8al7vs4ymrrdc8ipg9wpq52yh65smh";
+    };
+  };
+
+in
+
+stdenv.mkDerivation rec {
+  name = "v8-${version}";
+  version = "6.4.388.40";
+
+  inherit doCheck;
+
+  src = fetchFromGitHub {
+    owner = "v8";
+    repo = "v8";
+    rev = version;
+    sha256 = "1lq239cgqyidrynz8g3wbdv70ymzv6s0ppad8s219gb3jnizm16a";
+  };
+
+  postUnpack = ''
+    ${lib.concatStringsSep "\n" (
+      lib.mapAttrsToList (n: v: ''
+        mkdir -p $sourceRoot/${n}
+        cp -r ${v}/* $sourceRoot/${n}
+      '') deps)}
+  '';
+
+  prePatch = ''
+    # use our gn, not the bundled one
+    sed -i -e 's#gn_path = .*#gn_path = "${gn}/bin/gn"#' tools/mb/mb.py
+
+    # disable tests
+    if [ "$doCheck" = "" ]; then sed -i -e '/"test:gn_all",/d' BUILD.gn; fi
+
+    # disable sysroot usage
+    chmod u+w build/config build/config/sysroot.gni
+    sed -i build/config/sysroot.gni \
+        -e '/use_sysroot =/ { s#\(use_sysroot =\).*#\1 false#; :a  n; /current_cpu/ { s/^/#/; ba };  }'
+
+    # patch shebangs (/usr/bin/env)
+    patchShebangs tools/dev/v8gen.py
+  '';
+
+  configurePhase = ''
+    tools/dev/v8gen.py -vv ${arch}.release -- \
+        is_component_build=true               \
+        ${if snapshot then "v8_use_external_startup_data=false" else "v8_use_snapshot=false"} \
+        is_clang=false                        \
+        linux_use_bundled_binutils=false      \
+        treat_warnings_as_errors=false        \
+        use_custom_libcxx=false               \
+        use_custom_libcxx_for_host=false
+  '';
+
+  nativeBuildInputs = [ gn ninja pkgconfig ];
+  buildInputs = [ python glib ];
+
+  buildPhase = ''
+    ninja -C out.gn/${arch}.release/
+  '';
+
+  enableParallelBuilding = true;
+
+  installPhase = ''
+    install -vD out.gn/${arch}.release/d8 "$out/bin/d8"
+    install -vD out.gn/${arch}.release/mksnapshot "$out/bin/mksnapshot"
+    mkdir -p "$out/lib"
+    for f in libicui18n.so libicuuc.so libv8_libbase.so libv8_libplatform.so libv8.so; do
+        install -vD out.gn/${arch}.release/$f "$out/lib/$f"
+    done
+    install -vD out.gn/${arch}.release/icudtl.dat "$out/lib/icudtl.dat"
+    mkdir -p "$out/include"
+    cp -vr include/*.h "$out/include"
+    cp -vr include/libplatform "$out/include"
+  '';
+
+  meta = with lib; {
+    description = "Google's open source JavaScript engine";
+    maintainers = with maintainers; [ cstrahan proglodyte ];
+    platforms = platforms.linux;
+    license = licenses.bsd3;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/v8/update.sh b/nixpkgs/pkgs/development/libraries/v8/update.sh
new file mode 100755
index 000000000000..f046bb8e6885
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/v8/update.sh
@@ -0,0 +1,47 @@
+#!/usr/bin/env nix-shell
+#! nix-shell -i bash -p curl -p nix-prefetch-git
+VERSION_OVERVIEW=https://omahaproxy.appspot.com/all?os=linux
+TARGET_CHANNEL=beta
+FILE_PATH=6_x.nix
+
+set -eo pipefail
+
+v8_version=$(curl -s "$VERSION_OVERVIEW" | awk -F "," "\$2 ~ /${TARGET_CHANNEL}/ { print \$11 }")
+
+echo "Using V8 version --> $v8_version"
+sed -e "s#\\(version = \\)\"[0-9\.]*\"#\1\"$v8_version\"#" -i ${FILE_PATH}
+
+sha256=$(nix-prefetch-git --no-deepClone https://github.com/v8/v8.git "refs/tags/${v8_version}" \
+    | sed -ne '/sha256/ { s#.*: "\(.*\)".*#\1#; p }')
+sed -e "/repo = \"v8\"/ { n;n; s#\".*\"#\"${sha256}\"# }" -i ${FILE_PATH}
+
+deps="$(mktemp)"
+
+curl -s -o "$deps" "https://raw.githubusercontent.com/v8/v8/${v8_version}/DEPS"
+echo $deps
+
+sed -ne '/= fetchgit {/ { s/.*"\(.*\)".*/\1/; p }' < ${FILE_PATH} | while read dep; do
+    echo "Processing dependency --> $dep"
+    escaped_dep=$(echo "$dep" | sed -e 's#/#\\/#g')
+    dep_rev=$(sed -ne "/\"v8\/${escaped_dep}\":/ { n; s#.*+ \"##; s#\".*##;  p }" "$deps")
+
+    if [ "$dep_rev" = "" ]; then
+        echo "Failed to resolve dependency $dep, not listed in DEPS file"
+        rm -f "$deps"
+        exit 2
+    fi
+
+    repo_url=$(sed -ne "/\"${escaped_dep}\" = fetchgit/ { n; s/.*\"\(.*\)\".*/\1/; s#\${git_url}#https://chromium.googlesource.com#; p }"  ${FILE_PATH})
+    sha256=$(nix-prefetch-git --no-deepClone "$repo_url" "$dep_rev" 2>/dev/null | sed -ne '/sha256/ { s#.*: "\(.*\)".*#\1#; p }')
+
+    if [ "$sha256" = "" ]; then
+        echo "Failed to get sha256 via nix-prefetch-git $repo_url $dep_rev"
+        rm -f "$deps"
+        exit 2
+    fi
+
+    sed -e "/\"${escaped_dep}\" = fetchgit/ { n; n; s/\".*\"/\"${dep_rev}\"/; n; s/\".*\"/\"${sha256}\"/  }" -i ${FILE_PATH}
+done
+
+rm -f "$deps"
+echo done.
diff --git a/nixpkgs/pkgs/development/libraries/vaapi-intel-hybrid/default.nix b/nixpkgs/pkgs/development/libraries/vaapi-intel-hybrid/default.nix
new file mode 100644
index 000000000000..56ded2c56447
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/vaapi-intel-hybrid/default.nix
@@ -0,0 +1,47 @@
+{ stdenv, fetchurl, autoreconfHook, pkgconfig, cmrt, libdrm, libva, libX11, libGL, wayland }:
+
+stdenv.mkDerivation rec {
+  name = "intel-hybrid-driver-${version}";
+  version = "1.0.2";
+
+  src = fetchurl {
+    url = "https://github.com/01org/intel-hybrid-driver/archive/${version}.tar.gz";
+    sha256 = "0ywdhbvzwzzrq4qhylnw1wc8l3j67h26l0cs1rncwhw05s3ndk8n";
+  };
+
+  patches = [
+    # driver_init: load libva-x11.so for any ABI version
+    (fetchurl {
+      url = https://github.com/01org/intel-hybrid-driver/pull/26.diff;
+      sha256 = "1ql4mbi5x1d2a5c8mkjvciaq60zj8nhx912992winbhfkyvpb3gx";
+    })
+  ];
+
+  nativeBuildInputs = [ autoreconfHook pkgconfig ];
+
+  buildInputs = [ cmrt libdrm libva libX11 libGL wayland ];
+
+  enableParallelBuilding = true;
+
+  configureFlags = [
+    "--enable-drm"
+    "--enable-x11"
+    "--enable-wayland"
+  ];
+
+  postPatch = ''
+    patchShebangs ./src/shaders/gpp.py
+  '';
+
+  preConfigure = ''
+    sed -i -e "s,LIBVA_DRIVERS_PATH=.*,LIBVA_DRIVERS_PATH=$out/lib/dri," configure
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = https://01.org/linuxmedia;
+    description = "Intel driver for the VAAPI library with partial HW acceleration";
+    license = licenses.mit;
+    maintainers = with maintainers; [ tadfisher ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/vaapi-intel/default.nix b/nixpkgs/pkgs/development/libraries/vaapi-intel/default.nix
new file mode 100644
index 000000000000..14d49c3d0f0b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/vaapi-intel/default.nix
@@ -0,0 +1,52 @@
+{ stdenv, fetchFromGitHub, autoreconfHook, gnum4, pkgconfig, python2
+, intel-gpu-tools, libdrm, libva, libX11, libGL, wayland, libXext
+, enableHybridCodec ? false, vaapi-intel-hybrid
+}:
+
+stdenv.mkDerivation rec {
+  name = "intel-vaapi-driver-${version}";
+  # TODO: go back to stable releases with the next stable release after 2.3.0.
+  #       see: https://github.com/NixOS/nixpkgs/issues/55975 (and the libva comment v)
+  rev = "329975c63123610fc750241654a3bd18add75beb"; # generally try to match libva version, but not required
+  version = "git-20190211";
+
+  src = fetchFromGitHub {
+    owner  = "intel";
+    repo   = "intel-vaapi-driver";
+    rev    = rev;
+    sha256 = "10333wh2d0hvz5lxl3gjvqs71s7v9ajb0269b3bj5kbflj03v3n5";
+  };
+
+  patchPhase = ''
+    patchShebangs ./src/shaders/gpp.py
+  '';
+
+  preConfigure = ''
+    sed -i -e "s,LIBVA_DRIVERS_PATH=.*,LIBVA_DRIVERS_PATH=$out/lib/dri," configure
+  '';
+
+  postInstall = stdenv.lib.optionalString enableHybridCodec ''
+    ln -s ${vaapi-intel-hybrid}/lib/dri/* $out/lib/dri/
+  '';
+
+  configureFlags = [
+    "--enable-drm"
+    "--enable-x11"
+    "--enable-wayland"
+  ] ++ stdenv.lib.optional enableHybridCodec "--enable-hybrid-codec";
+
+  nativeBuildInputs = [ autoreconfHook gnum4 pkgconfig python2 ];
+
+  buildInputs = [ intel-gpu-tools libdrm libva libX11 libXext libGL wayland ]
+    ++ stdenv.lib.optional enableHybridCodec vaapi-intel-hybrid;
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    homepage = https://01.org/linuxmedia;
+    license = licenses.mit;
+    description = "Intel driver for the VAAPI library";
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ garbas ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/vaapi-vdpau/default.nix b/nixpkgs/pkgs/development/libraries/vaapi-vdpau/default.nix
new file mode 100644
index 000000000000..07ca9d2e62e1
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/vaapi-vdpau/default.nix
@@ -0,0 +1,37 @@
+{ stdenv, fetchurl, libvdpau, libGLU_combined, libva, pkgconfig }:
+let
+  libvdpau08patch = (fetchurl { url = "http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/x11-libs/libva-vdpau-driver/files/libva-vdpau-driver-0.7.4-libvdpau-0.8.patch?revision=1.1";
+                                name = "libva-vdpau-driver-0.7.4-libvdpau-0.8.patch";
+                                sha256 = "1n2cys59wyv8ylx9i5m3s6856mgx24hzcp45w1ahdfbzdv9wrfbl";
+                              });
+in
+stdenv.mkDerivation rec {
+  name = "libva-vdpau-driver-0.7.4";
+  
+  src = fetchurl {
+    url = "https://www.freedesktop.org/software/vaapi/releases/libva-vdpau-driver/${name}.tar.bz2";
+    sha256 = "1fcvgshzyc50yb8qqm6v6wn23ghimay23ci0p8sm8gxcy211jp0m";
+  };
+
+  patches = [ ./glext85.patch
+              (fetchurl { url = "http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/x11-libs/libva-vdpau-driver/files/libva-vdpau-driver-0.7.4-VAEncH264VUIBufferType.patch?revision=1.1";
+                          name = "libva-vdpau-driver-0.7.4-VAEncH264VUIBufferType.patch";
+                          sha256 = "166svcav6axkrlb3i4rbf6dkwjnqdf69xw339az1f5yabj72pqqs";
+                        }) ];
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ libvdpau libGLU_combined libva ];
+
+  preConfigure = ''
+    patch -p0 < ${libvdpau08patch}  # use -p0 instead of -p1
+    sed -i -e "s,LIBVA_DRIVERS_PATH=.*,LIBVA_DRIVERS_PATH=$out/lib/dri," configure
+  '';
+
+
+  meta = {
+    homepage = https://cgit.freedesktop.org/vaapi/vdpau-driver/;
+    license = stdenv.lib.licenses.gpl2Plus;
+    description = "VDPAU driver for the VAAPI library";
+    platforms = stdenv.lib.platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/vaapi-vdpau/glext85.patch b/nixpkgs/pkgs/development/libraries/vaapi-vdpau/glext85.patch
new file mode 100644
index 000000000000..073b8cf11904
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/vaapi-vdpau/glext85.patch
@@ -0,0 +1,20 @@
+http://www.mail-archive.com/libva@lists.freedesktop.org/msg01457.html
+
+diff --git a/src/utils_glx.h b/src/utils_glx.h
+index 19d03e4..f270fba 100644
+--- a/src/utils_glx.h
++++ b/src/utils_glx.h
+@@ -42,6 +42,13 @@ typedef void (*PFNGLVDPAUMAPSURFACESNVPROC)(GLsizei numSurfaces, const GLvdpauSu
+ typedef void (*PFNGLVDPAUUNMAPSURFACESNVPROC)(GLsizei numSurface, const GLvdpauSurfaceNV *surfaces);
+ #endif
+ 
++#if GL_GLEXT_VERSION >= 85
++/* XXX: PFNGLMULTITEXCOORD2FPROC got out of the GL_VERSION_1_3_DEPRECATED
++   block and is not defined if GL_VERSION_1_3 is defined in <GL/gl.h>
++   Redefine the type here as an interim solution */
++typedef void (*PFNGLMULTITEXCOORD2FPROC) (GLenum target, GLfloat s, GLfloat t);
++#endif
++
+ /* GLX_EXT_texture_from_pixmap */
+ #if GLX_GLXEXT_VERSION < 18
+ typedef void (*PFNGLXBINDTEXIMAGEEXTPROC)(Display *, GLXDrawable, int, const int *);
diff --git a/nixpkgs/pkgs/development/libraries/vapoursynth-mvtools/default.nix b/nixpkgs/pkgs/development/libraries/vapoursynth-mvtools/default.nix
new file mode 100644
index 000000000000..abdf9fbeed3c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/vapoursynth-mvtools/default.nix
@@ -0,0 +1,30 @@
+{ stdenv, fetchFromGitHub, pkgconfig, autoreconfHook,
+  vapoursynth, nasm, fftwFloat
+}:
+
+stdenv.mkDerivation rec {
+  name = "vapoursynth-mvtools-${version}";
+  version = "21";
+
+  src = fetchFromGitHub {
+    owner  = "dubhater";
+    repo   = "vapoursynth-mvtools";
+    rev    = "v${version}";
+    sha256 = "0vjxpp4jmmjhcp8z81idsbgq6jyx0l4r4i32b8alnp6c9fahjh6p";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [
+    autoreconfHook
+    nasm vapoursynth fftwFloat
+  ];
+
+  configureFlags = [ "--libdir=$(out)/lib/vapoursynth" ];
+
+  meta = with stdenv.lib; {
+    description = "A set of filters for motion estimation and compensation";
+    homepage = https://github.com/dubhater/vapoursynth-mvtools;
+    license  = licenses.gpl2;
+    maintainers = with maintainers; [ rnhmjoj ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/vapoursynth/default.nix b/nixpkgs/pkgs/development/libraries/vapoursynth/default.nix
new file mode 100644
index 000000000000..7121b6fed02d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/vapoursynth/default.nix
@@ -0,0 +1,48 @@
+{ stdenv, fetchFromGitHub, pkgconfig, autoreconfHook
+, zimg, libass, python3, libiconv
+, ApplicationServices, nasm
+, ocrSupport ?  false, tesseract ? null
+, imwriSupport? true,  imagemagick7 ? null
+}:
+
+assert ocrSupport   -> tesseract != null;
+assert imwriSupport -> imagemagick7 != null;
+
+with stdenv.lib;
+
+stdenv.mkDerivation rec {
+  name = "vapoursynth-${version}";
+  version = "R45.1";
+
+  src = fetchFromGitHub {
+    owner  = "vapoursynth";
+    repo   = "vapoursynth";
+    rev    = version;
+    sha256 = "09fj4k75cksx1imivqfyr945swlr8k392kkdgzldwc4404qv82s6";
+  };
+
+  nativeBuildInputs = [ pkgconfig autoreconfHook nasm ];
+  buildInputs = [
+    zimg libass
+    (python3.withPackages (ps: with ps; [ sphinx cython ]))
+  ] ++ optionals stdenv.isDarwin [ libiconv ApplicationServices ]
+    ++ optional ocrSupport   tesseract
+    ++ optional imwriSupport imagemagick7;
+
+  configureFlags = [
+    "--disable-static"
+    (optionalString (!ocrSupport)   "--disable-ocr")
+    (optionalString (!imwriSupport) "--disable-imwri")
+  ];
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    description = "A video processing framework with the future in mind";
+    homepage    = http://www.vapoursynth.com/;
+    license     = licenses.lgpl21;
+    platforms   = platforms.x86_64;
+    maintainers = with maintainers; [ rnhmjoj ];
+  };
+
+}
diff --git a/nixpkgs/pkgs/development/libraries/vc/0.7.nix b/nixpkgs/pkgs/development/libraries/vc/0.7.nix
new file mode 100644
index 000000000000..1af70056d2eb
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/vc/0.7.nix
@@ -0,0 +1,30 @@
+{ stdenv, fetchFromGitHub, cmake }:
+
+stdenv.mkDerivation rec {
+  name = "Vc-${version}";
+  version = "0.7.5";
+
+  src = fetchFromGitHub {
+    owner = "VcDevel";
+    repo = "Vc";
+    rev = version;
+    sha256 = "190s4r2n3jsivl4j2m288j3rqmgjj6gl308hi9mzwyhcfn17q8br";
+  };
+
+  nativeBuildInputs = [ cmake ];
+
+  enableParallelBuilding = true;
+
+  postPatch = ''
+    sed -i '/OptimizeForArchitecture()/d' cmake/VcMacros.cmake
+    sed -i '/AutodetectHostArchitecture()/d' print_target_architecture.cmake
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Library for multiprecision complex arithmetic with exact rounding";
+    homepage = https://github.com/VcDevel/Vc;
+    license = licenses.bsd3;
+    platforms = platforms.all;
+    maintainers = with maintainers; [ abbradar ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/vc/default.nix b/nixpkgs/pkgs/development/libraries/vc/default.nix
new file mode 100644
index 000000000000..66c8e4fbc531
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/vc/default.nix
@@ -0,0 +1,30 @@
+{ stdenv, fetchFromGitHub, cmake }:
+
+stdenv.mkDerivation rec {
+  name = "Vc-${version}";
+  version = "1.4.1";
+
+  src = fetchFromGitHub {
+    owner = "VcDevel";
+    repo = "Vc";
+    rev = version;
+    sha256 = "09nf6j1hyq2yv0c1cmnv4ff5243ylsajy1xj3dz8c2qqcm14y6cm";
+  };
+
+  nativeBuildInputs = [ cmake ];
+
+  enableParallelBuilding = true;
+
+  postPatch = ''
+    sed -i '/OptimizeForArchitecture()/d' cmake/VcMacros.cmake
+    sed -i '/AutodetectHostArchitecture()/d' print_target_architecture.cmake
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Library for multiprecision complex arithmetic with exact rounding";
+    homepage = https://github.com/VcDevel/Vc;
+    license = licenses.bsd3;
+    platforms = platforms.all;
+    maintainers = with maintainers; [ abbradar ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/vcdimager/default.nix b/nixpkgs/pkgs/development/libraries/vcdimager/default.nix
new file mode 100644
index 000000000000..480b8f7bcd7b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/vcdimager/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, lib, fetchurl, pkgconfig, libcdio, libxml2, popt
+, libiconv, darwin }:
+
+stdenv.mkDerivation rec {
+  name = "vcdimager-2.0.1";
+
+  src = fetchurl {
+    url = "mirror://gnu/vcdimager/${name}.tar.gz";
+    sha256 = "0ypnb1vp49nmzp5571ynlz6n1gh90f23w3z4x95hb7c2p7pmylb7";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+
+  buildInputs = [ libxml2 popt libiconv ]
+             ++ lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [ IOKit DiskArbitration ]);
+
+  propagatedBuildInputs = [ libcdio ];
+
+  meta = with lib; {
+    homepage = https://www.gnu.org/software/vcdimager/;
+    description = "Full-featured mastering suite for authoring, disassembling and analyzing Video CDs and Super Video CDs";
+    platforms = platforms.unix;
+    license = licenses.gpl2;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/vcg/default.nix b/nixpkgs/pkgs/development/libraries/vcg/default.nix
new file mode 100644
index 000000000000..b7249c8ee82c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/vcg/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchFromGitHub, eigen }:
+
+stdenv.mkDerivation rec {
+  name = "vcg-${version}";
+  version = "1.0.1";
+
+  src = fetchFromGitHub {
+    owner = "cnr-isti-vclab";
+    repo = "vcglib";
+    rev = "v${version}";
+    sha256 = "0jh8jc8rn7rci8qr3q03q574fk2hsc3rllysck41j8xkr3rmxz2f";
+  };
+
+  propagatedBuildInputs = [ eigen ];
+
+  installPhase = ''
+    mkdir -p $out/include
+    cp -r vcg wrap $out/include
+    find $out -name \*.h -exec sed -i 's,<eigenlib/,<eigen3/,g' {} \;
+  '';
+
+  meta = with stdenv.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;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ abbradar ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/vid-stab/default.nix b/nixpkgs/pkgs/development/libraries/vid-stab/default.nix
new file mode 100644
index 000000000000..e516c94866a2
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/vid-stab/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, fetchurl, cmake }:
+
+stdenv.mkDerivation rec {
+  name = "vid-stab-${version}";
+  version = "0.98b";
+  
+  src = fetchurl {
+    url = "https://github.com/georgmartius/vid.stab/archive/release-${version}.tar.gz";
+    sha256 = "09fh6xbd1f5xp3il3dpvr87skmnp2mm2hfmg4s9rvj4y8zvhn3sk";
+  };
+
+  nativeBuildInputs = [ cmake ];
+  
+  meta = with stdenv.lib; {
+    description = "Video stabilization library";
+    homepage    = http://public.hronopik.de/vid.stab/;
+    license     = licenses.gpl2;
+    maintainers = with maintainers; [ codyopel ];
+    platforms   = platforms.all;
+  };
+}
+
diff --git a/nixpkgs/pkgs/development/libraries/vigra/default.nix b/nixpkgs/pkgs/development/libraries/vigra/default.nix
new file mode 100644
index 000000000000..fb69d4bf63e7
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/vigra/default.nix
@@ -0,0 +1,45 @@
+{ stdenv, fetchurl, boost, cmake, fftw, fftwSinglePrec, hdf5, ilmbase
+, libjpeg, libpng, libtiff, openexr, python2Packages }:
+
+let
+  inherit (python2Packages) python numpy;
+  # Might want to use `python2.withPackages(ps: [ps.numpy]);` here...
+in stdenv.mkDerivation rec {
+  name = "vigra-${version}";
+  version = "1.11.1";
+
+  src = fetchurl {
+    url = "https://github.com/ukoethe/vigra/archive/Version-${stdenv.lib.replaceChars ["."] ["-"] version}.tar.gz";
+    sha256 = "03i5wfscv83jb8vnwwhfmm8yfiniwkvk13myzhr1kbwbs9884wdj";
+  };
+
+  NIX_CFLAGS_COMPILE = "-I${ilmbase.dev}/include/OpenEXR";
+
+  # Fixes compilation with clang (on darwin) see https://github.com/ukoethe/vigra/issues/414
+  patches =
+    let clangPatch = fetchurl { url = "https://github.com/ukoethe/vigra/commit/81958d302494e137f98a8b1d7869841532f90388.patch";
+                                sha256 = "1i1w6smijgb5z8bg9jaq84ccy00k2sxm87s37lgjpyix901gjlgi"; };
+    in [ clangPatch ];
+
+  buildInputs = [ boost cmake fftw fftwSinglePrec hdf5 ilmbase libjpeg libpng
+                  libtiff numpy openexr python ];
+
+  preConfigure = "cmakeFlags+=\" -DVIGRANUMPY_INSTALL_DIR=$out/lib/${python.libPrefix}/site-packages\"";
+
+  cmakeFlags = [ "-DWITH_OPENEXR=1" ]
+            ++ stdenv.lib.optionals (stdenv.hostPlatform.system == "x86_64-linux")
+                  [ "-DCMAKE_CXX_FLAGS=-fPIC" "-DCMAKE_C_FLAGS=-fPIC" ];
+
+  enableParallelBuilding = true;
+
+  # 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; {
+    description = "Novel computer vision C++ library with customizable algorithms and data structures";
+    homepage = https://hci.iwr.uni-heidelberg.de/vigra;
+    license = licenses.mit;
+    maintainers = [ maintainers.viric ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/virglrenderer/default.nix b/nixpkgs/pkgs/development/libraries/virglrenderer/default.nix
new file mode 100644
index 000000000000..4473100a9f20
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/virglrenderer/default.nix
@@ -0,0 +1,31 @@
+{ stdenv, fetchurl, pkgconfig, libGLU, epoxy, libX11, libdrm, mesa_noglu }:
+
+
+stdenv.mkDerivation rec {
+
+  name = "virglrenderer-${version}";
+  version = "0.7.0";
+
+  src = fetchurl {
+    url = "https://www.freedesktop.org/software/virgl/${name}.tar.bz2";
+    sha256 = "041agg1d6i8hg250y30f08n3via0hs9rbijxdrfifb8ara805v0m";
+  };
+
+  buildInputs = [ libGLU epoxy libX11 libdrm mesa_noglu ];
+
+  nativeBuildInputs = [ pkgconfig ];
+
+  # Fix use of fd_set without proper include
+  prePatch = ''
+    sed -e '1i#include <sys/select.h>' -i vtest/util.c
+  '';
+
+  meta = with stdenv.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;
+    platforms = platforms.linux;
+    maintainers = [ maintainers.xeji ];
+  };
+
+}
diff --git a/nixpkgs/pkgs/development/libraries/vmime/default.nix b/nixpkgs/pkgs/development/libraries/vmime/default.nix
new file mode 100644
index 000000000000..e0398487abc3
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/vmime/default.nix
@@ -0,0 +1,31 @@
+{stdenv, fetchFromGitHub
+, gsasl, gnutls, pkgconfig, cmake, zlib, libtasn1, libgcrypt, gtk3
+# this will not work on non-nixos systems
+, sendmailPath ? "/run/wrappers/bin/sendmail"
+}:
+
+stdenv.mkDerivation rec {
+  name = "vmime-${version}";
+  version = "0.9.2";
+  src = fetchFromGitHub {
+    owner = "kisli";
+    repo = "vmime";
+    rev = "v${version}";
+    sha256 = "1304n50ny2av8bagjpgz55ag0nd7m313akm9bb73abjn6h5nzacv";
+  };
+
+  buildInputs = [ gsasl gnutls zlib libtasn1 libgcrypt gtk3 ];
+  nativeBuildInputs = [ pkgconfig cmake ];
+
+  cmakeFlags = [
+    "-DVMIME_SENDMAIL_PATH=${sendmailPath}"
+  ];
+
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/vmmlib/default.nix b/nixpkgs/pkgs/development/libraries/vmmlib/default.nix
new file mode 100644
index 000000000000..18b9278539fc
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/vmmlib/default.nix
@@ -0,0 +1,46 @@
+{ stdenv, fetchFromGitHub, cmake, pkgconfig, boost, blas
+, Accelerate, CoreGraphics, CoreVideo
+}:
+
+stdenv.mkDerivation rec {
+  version = "1.6.2";
+  name = "vmmlib-${version}";
+
+  src = fetchFromGitHub {
+    owner = "VMML";
+    repo = "vmmlib";
+    rev = "release-${version}";
+    sha256 = "0sn6jl1r5k6ka0vkjsdnn14hb95dqq8158dapby6jk72wqj9kdml";
+  };
+
+  patches = [
+    ./disable-cpack.patch   #disable the need of cpack/rpm
+  ];
+
+  nativeBuildInputs = [ pkgconfig cmake ];
+  buildInputs = [ boost blas ]
+    ++ stdenv.lib.optionals stdenv.isDarwin [ Accelerate CoreGraphics CoreVideo ];
+
+  enableParallelBuilding = true;
+
+  doCheck = !stdenv.isDarwin;
+
+  checkTarget = "test";
+
+  meta = with stdenv.lib; {
+    description = "A vector and matrix math library implemented using C++ templates";
+
+    longDescription = ''vmmlib is a vector and matrix math library implemented 
+            using C++ templates. Its basic functionality includes a vector 
+            and a matrix class, with additional functionality for the 
+            often-used 3d and 4d vectors and 3x3 and 4x4 matrices.
+            More advanced functionality include solvers, frustum 
+            computations and frustum culling classes, and spatial data structures'';
+
+    license     = licenses.bsd2;
+    homepage    = https://github.com/VMML/vmmlib/;
+    maintainers = [ maintainers.adev ];
+    platforms   = platforms.all;
+  };
+}
+
diff --git a/nixpkgs/pkgs/development/libraries/vmmlib/disable-cpack.patch b/nixpkgs/pkgs/development/libraries/vmmlib/disable-cpack.patch
new file mode 100644
index 000000000000..8b9a7983a928
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/vmmlib/disable-cpack.patch
@@ -0,0 +1,11 @@
+diff -ur a/CMakeLists.txt b/CMakeLists.txt
+--- a/CMakeLists.txt	1970-01-01 00:00:01.000000000 +0000
++++ b/CMakeLists.txt	2016-02-19 08:49:30.053759000 +0000
+@@ -178,6 +178,5 @@
+ install(FILES ${DOCS} DESTINATION share/vmmlib COMPONENT dev)
+ 
+ include(DoxygenRule) # must be after all targets
+-include(CPackConfig)
+ include(CTest)
+-include(PackageConfig)
++
diff --git a/nixpkgs/pkgs/development/libraries/vo-amrwbenc/default.nix b/nixpkgs/pkgs/development/libraries/vo-amrwbenc/default.nix
new file mode 100644
index 000000000000..1a900c3135ca
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/vo-amrwbenc/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, fetchurl, autoreconfHook }:
+
+let
+    version = "0.1.3";
+in
+stdenv.mkDerivation {
+  name = "vo-amrwbenc-${version}";
+  version = "0.1.3";
+  buildInputs = [ autoreconfHook ];
+  src = fetchurl {
+    url = "https://github.com/mstorsjo/vo-amrwbenc/archive/v${version}.tar.gz";
+    sha256 = "85c79997ba7ddb9c95b5ddbe9ea032e27595390f3cbd686ed46a69e485cc053c";
+  };
+
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/volume-key/default.nix b/nixpkgs/pkgs/development/libraries/volume-key/default.nix
new file mode 100644
index 000000000000..32f816023e5a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/volume-key/default.nix
@@ -0,0 +1,48 @@
+{ stdenv, fetchgit, autoreconfHook, pkgconfig, gettext, python3
+, ncurses, swig, glib, utillinux, cryptsetup, nss, gpgme
+, autoconf, automake, libtool
+, writeShellScriptBin
+, buildPackages
+}:
+
+let
+  version = "0.3.11";
+in stdenv.mkDerivation rec {
+  name = "volume_key-${version}";
+
+  src = fetchgit {
+    url = https://pagure.io/volume_key.git;
+    rev = "volume_key-${version}";
+    sha256 = "1sqdbcih1c39bjiv4mm1m7acc3lfh2i2hf2r9i7rk8adfzq8awma";
+  };
+
+  outputs = [ "out" "man" "dev" "py" ];
+
+  nativeBuildInputs = [ autoconf automake libtool pkgconfig gettext swig ];
+
+  buildInputs = [ autoreconfHook glib cryptsetup nss utillinux gpgme ncurses ];
+
+  configureFlags = [
+    "--with-gpgme-prefix=${gpgme.dev}"
+  ];
+
+  preConfigure = ''
+    export PYTHON="${buildPackages.python3}/bin/python"
+    export PYTHON3_CONFIG="${python3}/bin/python3-config"
+  '';
+
+  makeFlags = [
+    "pyexecdir=$(py)/${python3.sitePackages}"
+    "pythondir=$(py)/${python3.sitePackages}"
+  ];
+
+  doCheck = false; # fails 1 out of 1 tests, needs `certutil`
+
+  meta = with stdenv.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;
+    maintainers = with maintainers; [];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/vrb/default.nix b/nixpkgs/pkgs/development/libraries/vrb/default.nix
new file mode 100644
index 000000000000..4f72cc138acf
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/vrb/default.nix
@@ -0,0 +1,34 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "vrb-${version}";
+  version = "0.5.1";
+
+  src = fetchurl {
+    url = "http://vrb.sourceforge.net/download/${name}.tar.bz2";
+    sha256 = "d579ed1998ef2d78e2ef8481a748d26e1fa12cdda806d2e31d8ec66ffb0e289f";
+  };
+
+  patches = [
+    ./removed_options.patch
+    ./unused-but-set-variable.patch
+  ];
+
+  postPatch = ''
+    patchShebangs configure
+  '';
+
+  postInstall = ''
+    mkdir -p $out/share/man/man3
+    cp -p vrb/man/man3/*.3 $out/share/man/man3/
+  '';
+
+  meta = with stdenv.lib; {
+    description = "A virtual ring buffer library written in C";
+    license     = licenses.lgpl21;
+    homepage    = http://vrb.sourceforge.net/;
+    maintainers = [ maintainers.bobvanderlinden ];
+    platforms   = platforms.linux;
+  };
+}
+
diff --git a/nixpkgs/pkgs/development/libraries/vrb/removed_options.patch b/nixpkgs/pkgs/development/libraries/vrb/removed_options.patch
new file mode 100644
index 000000000000..eda88e751843
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/vrb/removed_options.patch
@@ -0,0 +1,13 @@
+--- a/configure	2010-10-05 16:32:59.000000000 +0200
++++ b/configure	2010-10-05 16:33:08.000000000 +0200
+@@ -341,8 +341,8 @@
+     pgm_warn=( "${pgm_warn[@]}" -Winline )
+ fi
+ 
+-lib_feat=( -fomit-frame-pointer -funsigned-char -funsigned-bitfields -fgnu-linker -frerun-loop-opt -finline -finline-functions -fmove-all-movables )
+-pgm_feat=( -fomit-frame-pointer -funsigned-char -funsigned-bitfields -fgnu-linker -frerun-loop-opt -finline -finline-functions -fmove-all-movables )
++lib_feat=( -fomit-frame-pointer -funsigned-char -funsigned-bitfields -frerun-loop-opt -finline -finline-functions )
++pgm_feat=( -fomit-frame-pointer -funsigned-char -funsigned-bitfields -frerun-loop-opt -finline -finline-functions )
+ 
+ lib_cp_opt=( -pipe )
+ pgm_cp_opt=( -pipe )
diff --git a/nixpkgs/pkgs/development/libraries/vrb/unused-but-set-variable.patch b/nixpkgs/pkgs/development/libraries/vrb/unused-but-set-variable.patch
new file mode 100644
index 000000000000..43429255e8cd
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/vrb/unused-but-set-variable.patch
@@ -0,0 +1,19 @@
+--- a/vrb/src/bin/vbuf.c1	2011-06-13 22:14:24.000000000 +0200
++++ b/vrb/src/bin/vbuf.c	2011-06-13 22:14:43.000000000 +0200
+@@ -426,7 +426,6 @@
+     int			opt_progress		;
+     int			output_fd		;
+     int			poll_time		;
+-    int			poll_num		;
+     int			poll_write		;
+     int			poll_read		;
+ 
+@@ -861,7 +860,7 @@
+ 	    poll_time = display_time - get_time_ms();
+ 	    if ( poll_time < 0 ) poll_time = 0;
+ 	}
+-	poll_num = poll( poll_list, 2, poll_time );
++	poll( poll_list, 2, poll_time );
+ 
+ 	//-----------------------
+ 	// Check for poll events.
diff --git a/nixpkgs/pkgs/development/libraries/vrpn/default.nix b/nixpkgs/pkgs/development/libraries/vrpn/default.nix
new file mode 100644
index 000000000000..0ae5ba147cb7
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/vrpn/default.nix
@@ -0,0 +1,34 @@
+{ stdenv, fetchFromGitHub, unzip, cmake, libGLU_combined }:
+
+stdenv.mkDerivation rec {
+  name    = "${pname}-${date}";
+  pname   = "vrpn";
+  date    = "2016-08-27";
+
+  src = fetchFromGitHub {
+    owner  = "vrpn";
+    repo   = "vrpn";
+    rev    = "9fa0ab3676a43527301c9efd3637f80220eb9462";
+    sha256 = "032q295d68w34rk5q8nfqdd29s55n00bfik84y7xzkjrpspaprlh";
+  };
+
+  buildInputs = [ unzip cmake libGLU_combined ];
+
+  doCheck = false; # FIXME: test failure
+  checkTarget = "test";
+
+  meta = with stdenv.lib; {
+    description = "Virtual Reality Peripheral Network";
+    longDescription = ''
+      The Virtual-Reality Peripheral Network (VRPN) is a set of classes
+      within a library and a set of servers that are designed to implement
+      a network-transparent interface between application programs and the
+      set of physical devices (tracker, etc.) used in a virtual-reality
+      (VR) system.
+    '';
+    homepage    = https://github.com/vrpn/vrpn;
+    license     = licenses.boost; # see https://github.com/vrpn/vrpn/wiki/License
+    platforms   = platforms.linux;
+    maintainers = with maintainers; [ ludo ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/vsqlite/default.nix b/nixpkgs/pkgs/development/libraries/vsqlite/default.nix
new file mode 100644
index 000000000000..e706c730ddd3
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/vsqlite/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchurl, boost, sqlite }:
+
+stdenv.mkDerivation rec {
+  name = "vsqlite-${version}";
+  version = "0.3.13";
+
+  src = fetchurl {
+    url = "https://evilissimo.fedorapeople.org/releases/vsqlite--/0.3.13/vsqlite++-${version}.tar.gz";
+    sha256 = "17fkj0d2jh0xkjpcayhs1xvbnh1d69f026i7vs1zqnbiwbkpz237";
+  };
+
+  buildInputs = [ boost sqlite ];
+
+  prePatch = stdenv.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; {
+    homepage = http://vsqlite.virtuosic-bytes.com/;
+    description = "C++ wrapper library for sqlite.";
+    license = licenses.bsd3;
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/vte/2.90.nix b/nixpkgs/pkgs/development/libraries/vte/2.90.nix
new file mode 100644
index 000000000000..4b2b74c5e1d5
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/vte/2.90.nix
@@ -0,0 +1,41 @@
+{ stdenv, fetchurl, intltool, pkgconfig, gnome3, glib, gtk3, ncurses, gobject-introspection }:
+
+stdenv.mkDerivation rec {
+  versionMajor = "0.36";
+  versionMinor = "3";
+  moduleName   = "vte";
+
+  name = "${moduleName}-${versionMajor}.${versionMinor}";
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/${moduleName}/${versionMajor}/${name}.tar.xz";
+    sha256 = "54e5b07be3c0f7b158302f54ee79d4de1cb002f4259b6642b79b1e0e314a959c";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ gobject-introspection intltool glib gtk3 ncurses ];
+
+  configureFlags = [ "--enable-introspection" ];
+
+  enableParallelBuilding = true;
+
+  postInstall = ''
+    substituteInPlace $out/lib/libvte2_90.la --replace "-lncurses" "-L${ncurses.out}/lib -lncurses"
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = https://www.gnome.org/;
+    description = "A library implementing a terminal emulator widget for GTK+";
+    longDescription = ''
+      VTE is a library (libvte) implementing a terminal emulator widget for
+      GTK+, and a minimal sample application (vte) using that.  Vte is
+      mainly used in gnome-terminal, but can also be used to embed a
+      console/terminal in games, editors, IDEs, etc. VTE supports Unicode and
+      character set conversion, as well as emulating any terminal known to
+      the system's terminfo database.
+    '';
+    license = licenses.lgpl2;
+    maintainers = with maintainers; [ astsmtl antono lethalman ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/vte/default.nix b/nixpkgs/pkgs/development/libraries/vte/default.nix
new file mode 100644
index 000000000000..273072e93239
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/vte/default.nix
@@ -0,0 +1,51 @@
+{ stdenv, fetchurl, intltool, pkgconfig
+, gnome3, glib, gtk3, ncurses, gobject-introspection, vala, libxml2, gnutls
+, gperf, pcre2
+}:
+
+stdenv.mkDerivation rec {
+  pname = "vte";
+  version = "0.56.3";
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    sha256 = "0j166gic5znssdb9r45qazq4kb4v9fial82czand5wa8i2yd988p";
+  };
+
+  passthru = {
+    updateScript = gnome3.updateScript { packageName = pname; };
+  };
+
+  nativeBuildInputs = [ gobject-introspection intltool pkgconfig vala gperf libxml2 ];
+  buildInputs = [ glib gtk3 ncurses ];
+
+  propagatedBuildInputs = [
+    # Required by vte-2.91.pc.
+    gtk3
+    gnutls
+    pcre2
+  ];
+
+  preConfigure = "patchShebangs .";
+
+  configureFlags = [ "--enable-introspection" "--disable-Bsymbolic" ];
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    homepage = https://www.gnome.org/;
+    description = "A library implementing a terminal emulator widget for GTK+";
+    longDescription = ''
+      VTE is a library (libvte) implementing a terminal emulator widget for
+      GTK+, and a minimal sample application (vte) using that.  Vte is
+      mainly used in gnome-terminal, but can also be used to embed a
+      console/terminal in games, editors, IDEs, etc. VTE supports Unicode and
+      character set conversion, as well as emulating any terminal known to
+      the system's terminfo database.
+    '';
+    license = licenses.lgpl2;
+    maintainers = with maintainers; [ astsmtl antono lethalman ];
+    platforms = platforms.linux ++ platforms.darwin;
+  };
+}
+
diff --git a/nixpkgs/pkgs/development/libraries/vte/ng.nix b/nixpkgs/pkgs/development/libraries/vte/ng.nix
new file mode 100644
index 000000000000..c00be4c008f7
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/vte/ng.nix
@@ -0,0 +1,27 @@
+{ vte, fetchFromGitHub, fetchpatch, autoconf, automake, gtk-doc, gettext, libtool, gperf }:
+
+vte.overrideAttrs (oldAttrs: rec {
+  name = "vte-ng-${version}";
+  version = "0.54.2.a";
+
+  src = fetchFromGitHub {
+    owner = "thestinger";
+    repo = "vte-ng";
+    rev = version;
+    sha256 = "1r7d9m07cpdr4f7rw3yx33hmp4jmsk0dn5byq5wgksb2qjbc4ags";
+  };
+
+  patches = [
+    # Fix build with vala 0.44
+    # See: https://github.com/thestinger/vte-ng/issues/32
+    (fetchpatch {
+      url = "https://gitlab.gnome.org/GNOME/vte/commit/53690d5cee51bdb7c3f7680d3c22b316b1086f2c.patch";
+      sha256 = "1jrpqsx5hqa01g7cfqrsns6vz51mwyqwdp43ifcpkhz3wlp5dy66";
+    })
+  ];
+
+  preConfigure = oldAttrs.preConfigure + "; NOCONFIGURE=1 ./autogen.sh";
+
+  nativeBuildInputs = oldAttrs.nativeBuildInputs or []
+    ++ [ gtk-doc autoconf automake gettext libtool gperf ];
+})
diff --git a/nixpkgs/pkgs/development/libraries/vtk/default.nix b/nixpkgs/pkgs/development/libraries/vtk/default.nix
new file mode 100644
index 000000000000..9843b1289cfc
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/vtk/default.nix
@@ -0,0 +1,60 @@
+{ stdenv, fetchurl, cmake, libGLU_combined, libX11, xorgproto, libXt
+, qtLib ? null
+# Darwin support
+, Cocoa, CoreServices, DiskArbitration, IOKit, CFNetwork, Security, GLUT, OpenGL
+, ApplicationServices, CoreText, IOSurface, cf-private, ImageIO, xpc, libobjc }:
+
+with stdenv.lib;
+
+let
+  os = stdenv.lib.optionalString;
+  majorVersion = "7.0";
+  minorVersion = "0";
+  version = "${majorVersion}.${minorVersion}";
+in
+
+stdenv.mkDerivation rec {
+  name = "vtk-${os (qtLib != null) "qvtk-"}${version}";
+  src = fetchurl {
+    url = "${meta.homepage}files/release/${majorVersion}/VTK-${version}.tar.gz";
+    sha256 = "1hrjxkcvs3ap0bdhk90vymz5pgvxmg7q6sz8ab3wsyddbshr1abq";
+  };
+
+  buildInputs =
+    if !stdenv.isDarwin
+    then [ cmake libGLU_combined libX11 xorgproto libXt ] ++ optional (qtLib != null) qtLib
+    else [ cmake qtLib xpc CoreServices DiskArbitration IOKit cf-private
+           CFNetwork Security ApplicationServices CoreText IOSurface ImageIO
+           OpenGL GLUT ];
+  propagatedBuildInputs = stdenv.lib.optionals stdenv.isDarwin [ Cocoa libobjc ];
+
+
+  preBuild = ''
+    export LD_LIBRARY_PATH="$(pwd)/lib";
+  '';
+
+  # Shared libraries don't work, because of rpath troubles with the current
+  # nixpkgs camke approach. It wants to call a binary at build time, just
+  # built and requiring one of the shared objects.
+  # At least, we use -fPIC for other packages to be able to use this in shared
+  # objects.
+  cmakeFlags = [ "-DCMAKE_C_FLAGS=-fPIC" "-DCMAKE_CXX_FLAGS=-fPIC" ]
+    ++ optional (qtLib != null) [ "-DVTK_USE_QT:BOOL=ON" ]
+    ++ optional stdenv.isDarwin "-DOPENGL_INCLUDE_DIR=${OpenGL}/Library/Frameworks";
+
+  postPatch = stdenv.lib.optionalString stdenv.isDarwin ''
+    sed -i 's|COMMAND vtkHashSource|COMMAND "DYLD_LIBRARY_PATH=''${VTK_BINARY_DIR}/lib" ''${VTK_BINARY_DIR}/bin/vtkHashSource-7.0|' ./Parallel/Core/CMakeLists.txt
+    sed -i 's/fprintf(output, shift)/fprintf(output, "%s", shift)/' ./ThirdParty/libxml2/vtklibxml2/xmlschemas.c
+    sed -i 's/fprintf(output, shift)/fprintf(output, "%s", shift)/g' ./ThirdParty/libxml2/vtklibxml2/xpath.c
+  '';
+
+  enableParallelBuilding = true;
+
+  meta = {
+    description = "Open source libraries for 3D computer graphics, image processing and visualization";
+    homepage = http://www.vtk.org/;
+    license = stdenv.lib.licenses.bsd3;
+    maintainers = with stdenv.lib.maintainers; [ ];
+    platforms = with stdenv.lib.platforms; unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/vulkan-headers/default.nix b/nixpkgs/pkgs/development/libraries/vulkan-headers/default.nix
new file mode 100644
index 000000000000..f7c1bf9a65b9
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/vulkan-headers/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, fetchFromGitHub, cmake }:
+stdenv.mkDerivation rec {
+  name = "vulkan-headers-${version}";
+  version = "1.1.106";
+
+  buildInputs = [ cmake ];
+
+  src = fetchFromGitHub {
+    owner = "KhronosGroup";
+    repo = "Vulkan-Headers";
+    rev = "sdk-${version}";
+    sha256 = "0idw7q715ikj575qmspvgq2gzc6c1sj581b8z3xnv6wz9qbzrmsd";
+  };
+
+  meta = with stdenv.lib; {
+    description = "Vulkan Header files and API registry";
+    homepage    = https://www.lunarg.com;
+    platforms   = platforms.linux;
+    license     = licenses.asl20;
+    maintainers = [ maintainers.ralith ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/vulkan-loader/default.nix b/nixpkgs/pkgs/development/libraries/vulkan-loader/default.nix
new file mode 100644
index 000000000000..891ad373e027
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/vulkan-loader/default.nix
@@ -0,0 +1,44 @@
+{ stdenv, fetchFromGitHub, cmake, python3, vulkan-headers, pkgconfig
+, xlibsWrapper, libxcb, libXrandr, libXext, wayland, addOpenGLRunpath }:
+
+let
+  version = "1.1.106";
+in
+
+assert version == vulkan-headers.version;
+stdenv.mkDerivation rec {
+  name = "vulkan-loader-${version}";
+  inherit version;
+
+  src = fetchFromGitHub {
+    owner = "KhronosGroup";
+    repo = "Vulkan-Loader";
+    rev = "sdk-${version}";
+    sha256 = "0zhrwj1gi90x2w8gaaaw5h4b969a8gfy244kn0drrplhhb1nqz3b";
+  };
+
+  nativeBuildInputs = [ pkgconfig addOpenGLRunpath ];
+  buildInputs = [ cmake python3 xlibsWrapper libxcb libXrandr libXext wayland ];
+  enableParallelBuilding = true;
+
+  cmakeFlags = [
+    "-DFALLBACK_DATA_DIRS=${addOpenGLRunpath.driverLink}/share:/usr/local/share:/usr/share"
+    "-DVULKAN_HEADERS_INSTALL_DIR=${vulkan-headers}"
+  ];
+
+  outputs = [ "out" "dev" ];
+
+  # Set RUNPATH so that driver libraries in /run/opengl-driver(-32)/lib can be found.
+  # See the explanation in addOpenGLRunpath.
+  postFixup = ''
+    addOpenGLRunpath $out/lib/libvulkan.so
+  '';
+
+  meta = with stdenv.lib; {
+    description = "LunarG Vulkan loader";
+    homepage    = https://www.lunarg.com;
+    platforms   = platforms.linux;
+    license     = licenses.asl20;
+    maintainers = [ maintainers.ralith ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/vxl/default.nix b/nixpkgs/pkgs/development/libraries/vxl/default.nix
new file mode 100644
index 000000000000..9651e9a5f80c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/vxl/default.nix
@@ -0,0 +1,32 @@
+{ stdenv, fetchFromGitHub, unzip, cmake, libtiff, expat, zlib, libpng, libjpeg }:
+stdenv.mkDerivation {
+  name = "vxl-1.17.0-nix1";
+
+  src = fetchFromGitHub {
+    owner = "vxl";
+    repo = "vxl";
+    rev = "777c0beb7c8b30117400f6fc9a6d63bf8cb7c67a";
+    sha256 = "0xpkwwb93ka6c3da8zjhfg9jk5ssmh9ifdh1by54sz6c7mbp55m8";
+  };
+
+  buildInputs = [ cmake unzip libtiff expat zlib libpng libjpeg ];
+
+  # BUILD_OUL wants old linux headers for videodev.h, not available
+  # in stdenv linux headers
+  # BUILD_BRL fails to find open()
+  cmakeFlags = "-DBUILD_OUL=OFF -DBUILD_BRL=OFF -DBUILD_CONTRIB=OFF "
+    + (if stdenv.hostPlatform.system == "x86_64-linux" then
+      "-DCMAKE_CXX_FLAGS=-fPIC -DCMAKE_C_FLAGS=-fPIC"
+    else
+      "");
+
+  enableParallelBuilding = true;
+
+  meta = {
+    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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/wasilibc/default.nix b/nixpkgs/pkgs/development/libraries/wasilibc/default.nix
new file mode 100644
index 000000000000..229d67b81edd
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/wasilibc/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchFromGitHub, lib }:
+
+stdenv.mkDerivation {
+  name = "wasilibc-20190413";
+  src = fetchFromGitHub {
+    owner = "CraneStation";
+    repo = "wasi-sysroot";
+    rev = "079d7bda78bc0ad8f69c1594444b54786545ce57";
+    sha256 = "09s906bc9485wzkgibnpfh0mii7jkldzr1a6g8k7ch0si8rshi5r";
+  };
+  makeFlags = [
+    "WASM_CC=${stdenv.cc.targetPrefix}cc"
+    "WASM_NM=${stdenv.cc.targetPrefix}nm"
+    "WASM_AR=${stdenv.cc.targetPrefix}ar"
+    "INSTALL_DIR=${placeholder "out"}"
+  ];
+
+  postInstall = ''
+    mv $out/lib/*/* $out/lib
+    ln -s $out/share/wasm32-wasi/undefined-symbols.txt $out/lib/wasi.imports
+  '';
+
+  meta = {
+    description = "WASI libc implementation for WebAssembly";
+    homepage    = "https://wasi.dev";
+    platforms   = lib.platforms.wasi;
+    maintainers = [ lib.maintainers.matthewbauer ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/wavpack/default.nix b/nixpkgs/pkgs/development/libraries/wavpack/default.nix
new file mode 100644
index 000000000000..9eb3254001d5
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/wavpack/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchurl, libiconv }:
+
+stdenv.mkDerivation rec {
+  name = "wavpack-${version}";
+  version = "5.1.0";
+
+  enableParallelBuilding = true;
+
+  buildInputs = stdenv.lib.optional stdenv.isDarwin libiconv;
+
+  src = fetchurl {
+    url = "http://www.wavpack.com/${name}.tar.bz2";
+    sha256 = "0i19c6krc0p9krwrqy9s5xahaafigqzxcn31piidmlaqadyn4f8r";
+  };
+
+  meta = with stdenv.lib; {
+    description = "Hybrid audio compression format";
+    homepage    = http://www.wavpack.com/;
+    license     = licenses.bsd3;
+    platforms   = platforms.unix;
+    maintainers = with maintainers; [ codyopel ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/wayland/1.9.nix b/nixpkgs/pkgs/development/libraries/wayland/1.9.nix
new file mode 100644
index 000000000000..3fda417d8e1f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/wayland/1.9.nix
@@ -0,0 +1,33 @@
+{ lib, stdenv, fetchurl, pkgconfig
+, libffi, libxml2
+, expat ? null # Build wayland-scanner (currently cannot be disabled as of 1.7.0)
+}:
+
+# Require the optional to be enabled until upstream fixes or removes the configure flag
+assert expat != null;
+
+stdenv.mkDerivation rec {
+  name = "wayland-${version}";
+  version = "1.9.0";
+
+  src = fetchurl {
+    url = "https://wayland.freedesktop.org/releases/${name}.tar.xz";
+    sha256 = "1yhy62vkbq8j8c9zaa6yzvn75cd99kfa8n2zfdwl80x019r711ww";
+  };
+
+  configureFlags = [ "--with-scanner" "--disable-documentation" ];
+
+  nativeBuildInputs = [ pkgconfig ];
+
+  buildInputs = [ libffi /* docbook_xsl doxygen graphviz libxslt xmlto */ expat libxml2 ];
+
+  meta = {
+    description = "Reference implementation of the wayland protocol";
+    homepage    = https://wayland.freedesktop.org/;
+    license     = lib.licenses.mit;
+    platforms   = lib.platforms.linux;
+    maintainers = with lib.maintainers; [ codyopel ];
+  };
+
+  passthru.version = version;
+}
diff --git a/nixpkgs/pkgs/development/libraries/wayland/default.nix b/nixpkgs/pkgs/development/libraries/wayland/default.nix
new file mode 100644
index 000000000000..60d240552d4f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/wayland/default.nix
@@ -0,0 +1,44 @@
+{ lib, stdenv, fetchurl, pkgconfig
+, libffi, libxml2, wayland
+, expat ? null # Build wayland-scanner (currently cannot be disabled as of 1.7.0)
+}:
+
+# Require the optional to be enabled until upstream fixes or removes the configure flag
+assert expat != null;
+
+stdenv.mkDerivation rec {
+  pname = "wayland";
+  version = "1.17.0";
+
+  src = fetchurl {
+    url = "https://wayland.freedesktop.org/releases/${pname}-${version}.tar.xz";
+    sha256 = "194ibzwpdcn6fvk4xngr4bf5axpciwg2bj82fdvz88kfmjw13akj";
+  };
+
+  separateDebugInfo = true;
+
+  configureFlags = [
+    "--disable-documentation"
+  ] ++ lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [
+    "--with-host-scanner"
+  ];
+
+  nativeBuildInputs = [
+    pkgconfig
+  ] ++ lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [
+    # for wayland-scanner during build
+    wayland
+  ];
+
+  buildInputs = [ libffi /* docbook_xsl doxygen graphviz libxslt xmlto */ expat libxml2 ];
+
+  meta = {
+    description = "Reference implementation of the wayland protocol";
+    homepage    = https://wayland.freedesktop.org/;
+    license     = lib.licenses.mit;
+    platforms   = lib.platforms.linux;
+    maintainers = with lib.maintainers; [ codyopel ];
+  };
+
+  passthru.version = version;
+}
diff --git a/nixpkgs/pkgs/development/libraries/wayland/protocols.nix b/nixpkgs/pkgs/development/libraries/wayland/protocols.nix
new file mode 100644
index 000000000000..b14dc03385cf
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/wayland/protocols.nix
@@ -0,0 +1,27 @@
+{ lib, stdenv, fetchurl, pkgconfig
+, wayland
+}:
+
+stdenv.mkDerivation rec {
+  name = "wayland-protocols-${version}";
+  version = "1.17";
+
+  src = fetchurl {
+    url = "https://wayland.freedesktop.org/releases/${name}.tar.xz";
+    sha256 = "0bw1sqixqk2a7mqw630cs4dlgcp5yib90vyikzm3lr05jz7ij4yz";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+
+  buildInputs = [ wayland ];
+
+  meta = {
+    description = "Wayland protocol extensions";
+    homepage    = https://wayland.freedesktop.org/;
+    license     = lib.licenses.mit;
+    platforms   = lib.platforms.linux;
+    maintainers = with lib.maintainers; [ ];
+  };
+
+  passthru.version = version;
+}
diff --git a/nixpkgs/pkgs/development/libraries/waylandpp/default.nix b/nixpkgs/pkgs/development/libraries/waylandpp/default.nix
new file mode 100644
index 000000000000..4fd94a29f9cd
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/waylandpp/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchFromGitHub, cmake, pkgconfig, pugixml, wayland, libGL }:
+
+stdenv.mkDerivation rec {
+  pname = "waylandpp";
+  version = "0.2.5";
+
+  src = fetchFromGitHub {
+    owner = "NilsBrause";
+    repo = pname;
+    rev = version;
+    sha256 = "16h57hzd688664qcyznzhjp3hxipdkzgv46x82yhkww24av8b55n";
+  };
+
+  nativeBuildInputs = [ cmake pkgconfig ];
+  buildInputs = [ pugixml wayland libGL ];
+
+  meta = with stdenv.lib; {
+    description = "Wayland C++ binding";
+    homepage = https://github.com/NilsBrause/waylandpp/;
+    license = with licenses; [ bsd2 hpnd ];
+    maintainers = with maintainers; [ minijackson ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/wcslib/default.nix b/nixpkgs/pkgs/development/libraries/wcslib/default.nix
new file mode 100644
index 000000000000..187eed6ae83a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/wcslib/default.nix
@@ -0,0 +1,33 @@
+{ fetchurl,  stdenv, flex }:
+
+stdenv.mkDerivation rec {
+  version = "6.2";
+  name = "wcslib-${version}";
+
+  buildInputs = [ flex ];
+
+  src = fetchurl {
+    url = "ftp://ftp.atnf.csiro.au/pub/software/wcslib/${name}.tar.bz2";
+    sha256 ="01fqckazhbfqqhyr0wd9vcks1m2afmsh83l981alxg2r54jgwkdv";
+  };
+
+  prePatch = ''
+    substituteInPlace GNUmakefile --replace 2775 0775
+    substituteInPlace C/GNUmakefile --replace 2775 0775
+  '';
+
+  enableParallelBuilding = true;
+
+  meta = {
+    description = "World Coordinate System Library for Astronomy";
+    homepage = http://www.atnf.csiro.au/people/mcalabre/WCS/;
+
+    longDescription = ''Library for world coordinate systems for
+    spherical geometries and their conversion to image coordinate
+    systems. This is the standard library for this purpose in
+    astronomy.'';
+
+    license = stdenv.lib.licenses.lgpl3Plus;
+    platforms = stdenv.lib.platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/webkitgtk/2.4.nix b/nixpkgs/pkgs/development/libraries/webkitgtk/2.4.nix
new file mode 100644
index 000000000000..04758ace7fa4
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/webkitgtk/2.4.nix
@@ -0,0 +1,111 @@
+{ stdenv, fetchurl, fetchpatch, perl, python, ruby, bison, gperf, flex
+, pkgconfig, which, gettext, gobject-introspection
+, gtk2, gtk3, wayland, libwebp, enchant, sqlite
+, libxml2, libsoup, libsecret, libxslt, harfbuzz, xorg
+, gst-plugins-base, libobjc
+, withGtk2 ? false
+, enableIntrospection ? !stdenv.isDarwin
+, enableCredentialStorage ? !stdenv.isDarwin
+, readline, libedit
+}:
+
+assert stdenv.isDarwin -> !enableIntrospection;
+assert stdenv.isDarwin -> !enableCredentialStorage;
+
+with stdenv.lib;
+stdenv.mkDerivation rec {
+  name = "webkitgtk-${version}";
+  version = "2.4.11";
+
+  meta = with stdenv.lib; {
+    description = "Web content rendering engine, GTK+ port";
+    homepage = http://webkitgtk.org/;
+    license = licenses.bsd2;
+    platforms = with platforms; linux ++ darwin;
+    maintainers = [];
+    knownVulnerabilities = [
+      "WSA-2016-0004"
+      "WSA-2016-0005"
+      "WSA-2016-0006"
+      "WSA-2017-0001"
+      "WSA-2017-0002"
+    ];
+  };
+
+  src = fetchurl {
+    url = "https://webkitgtk.org/releases/${name}.tar.xz";
+    sha256 = "1xsvnvyvlywwyf6m9ainpsg87jkxjmd37q6zgz9cxb7v3c2ym2jq";
+  };
+
+  CC = "cc";
+
+  prePatch = ''
+    patchShebangs Tools/gtk
+  '';
+  patches = [
+    ./webcore-svg-libxml-cflags.patch
+    (fetchpatch {
+      url = https://raw.githubusercontent.com/gentoo/gentoo/7c5457e265bd40c156a8fe6b2ff94a4e34bcea8e/net-libs/webkit-gtk/files/webkit-gtk-2.4.9-gcc-6.patch;
+      sha256 = "0ll93dr5vxd40wvly1jaw41lvw86krac0jc6k6cacrps4i5ql5j0";
+    })
+  ] ++ optionals stdenv.isDarwin [
+    ./configure.patch
+    ./quartz-webcore.patch
+    ./libc++.patch
+    ./plugin-none.patch
+  ] ++ optionals stdenv.hostPlatform.isMusl [
+    ./fix-execinfo.patch
+  ];
+
+  configureFlags = with stdenv.lib; [
+    "--disable-geolocation"
+    "--disable-jit"
+    # needed for parallel building
+    "--enable-dependency-tracking"
+    (optionalString enableIntrospection "--enable-introspection")
+  ] ++ optional withGtk2 [
+    "--with-gtk=2.0"
+  ] ++ optionals (withGtk2 || stdenv.isDarwin) [
+    "--disable-webkit2"
+  ] ++ optionals stdenv.isDarwin [
+    "--disable-x11-target"
+    "--enable-quartz-target"
+    "--disable-web-audio"
+    "CFLAGS=-DJSC_OBJC_API_ENABLED=0"
+    "CXXFLAGS=-DJSC_OBJC_API_ENABLED=0"
+  ] ++ optionals (!enableCredentialStorage) [
+    "--disable-credential-storage"
+  ];
+
+  NIX_CFLAGS_COMPILE = [
+    "-DU_NOEXCEPT="
+    "-Wno-expansion-to-defined"
+  ];
+
+  dontAddDisableDepTrack = true;
+
+  nativeBuildInputs = [
+    perl python ruby bison gperf flex
+    pkgconfig which gettext gobject-introspection
+  ];
+
+  buildInputs = [
+    gtk2 libwebp enchant
+    libxml2 libxslt
+    gst-plugins-base sqlite xorg.libXt xorg.libXdamage
+  ] ++ optionals enableCredentialStorage [
+    libsecret
+  ] ++ (if stdenv.isDarwin then [
+    readline libedit libobjc
+  ] else [
+    wayland
+  ]);
+
+  propagatedBuildInputs = [
+    libsoup harfbuzz/*icu in *.la*/
+    (if withGtk2 then gtk2 else gtk3)
+  ];
+
+  enableParallelBuilding = true;
+
+}
diff --git a/nixpkgs/pkgs/development/libraries/webkitgtk/configure.patch b/nixpkgs/pkgs/development/libraries/webkitgtk/configure.patch
new file mode 100644
index 000000000000..2f4c1e7ad314
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/webkitgtk/configure.patch
@@ -0,0 +1,20 @@
+--- webkitgtk-2.4.11-orig/configure	2016-04-10 17:00:06.000000000 +0800
++++ webkitgtk-2.4.11/configure	2016-07-21 23:04:10.000000000 +0800
+@@ -17738,7 +17738,7 @@
+   cat >>confdefs.h <<_ACEOF
+ #define HAVE_WEBP_DECODE_H 1
+ _ACEOF
+- WEBP_LIBS='-lwebp'
++ WEBP_LIBS=`$PKG_CONFIG --libs libwebp`
+ else
+   as_fn_error $? "WebP library (libwebp) not found" "$LINENO" 5
+ fi
+@@ -18388,7 +18388,7 @@
+ case "$host" in
+     *-*-darwin*)
+         UNICODE_CFLAGS="-I$srcdir/Source/JavaScriptCore/icu -I$srcdir/Source/WebCore/icu"
+-        UNICODE_LIBS="-licucore"
++        UNICODE_LIBS="/usr/lib/libicucore.dylib"
+         ;;
+     *-*-mingw*)
+ 
diff --git a/nixpkgs/pkgs/development/libraries/webkitgtk/default.nix b/nixpkgs/pkgs/development/libraries/webkitgtk/default.nix
new file mode 100644
index 000000000000..91848ce1fb6b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/webkitgtk/default.nix
@@ -0,0 +1,83 @@
+{ stdenv, fetchurl, perl, python2, ruby, bison, gperf, cmake, ninja
+, pkgconfig, gettext, gobject-introspection, libnotify, gnutls, libgcrypt
+, gtk3, wayland, libwebp, enchant2, xorg, libxkbcommon, epoxy, at-spi2-core
+, libxml2, libsoup, libsecret, libxslt, harfbuzz, libpthreadstubs, pcre, nettle, libtasn1, p11-kit
+, libidn, libedit, readline, libGLU_combined, libintl, openjpeg
+, enableGeoLocation ? true, geoclue2, sqlite
+, enableGtk2Plugins ? false, gtk2 ? null
+, gst-plugins-base, gst-plugins-bad, woff2
+}:
+
+assert enableGeoLocation -> geoclue2 != null;
+assert enableGtk2Plugins -> gtk2 != null;
+assert stdenv.isDarwin -> !enableGtk2Plugins;
+
+with stdenv.lib;
+stdenv.mkDerivation rec {
+  name = "webkitgtk-${version}";
+  version = "2.24.2";
+
+  meta = {
+    description = "Web content rendering engine, GTK+ port";
+    homepage = https://webkitgtk.org/;
+    license = licenses.bsd2;
+    platforms = platforms.linux;
+    hydraPlatforms = [];
+    maintainers = with maintainers; [ ];
+  };
+
+  src = fetchurl {
+    url = "https://webkitgtk.org/releases/${name}.tar.xz";
+    sha256 = "071jnjvjq6wsxx1jh4ql3j53h1nhphs5ga67fa5i9xjvs3qb3701";
+  };
+
+  patches = optionals stdenv.isDarwin [
+    ## TODO add necessary patches for Darwin
+  ];
+
+  postPatch = ''
+    patchShebangs .
+  '';
+
+  cmakeFlags = [
+  "-DPORT=GTK"
+  "-DUSE_LIBHYPHEN=0"
+  "-DENABLE_INTROSPECTION=ON"
+  ]
+  ++ optional (!enableGtk2Plugins) "-DENABLE_PLUGIN_PROCESS_GTK2=OFF"
+  ++ optional stdenv.isLinux "-DENABLE_GLES2=ON"
+  ++ optionals stdenv.isDarwin [
+  "-DUSE_SYSTEM_MALLOC=ON"
+  "-DUSE_ACCELERATE=0"
+  "-DENABLE_MINIBROWSER=OFF"
+  "-DENABLE_VIDEO=ON"
+  "-DENABLE_QUARTZ_TARGET=ON"
+  "-DENABLE_X11_TARGET=OFF"
+  "-DENABLE_OPENGL=OFF"
+  "-DENABLE_WEB_AUDIO=OFF"
+  "-DENABLE_WEBGL=OFF"
+  "-DENABLE_GRAPHICS_CONTEXT_3D=OFF"
+  "-DENABLE_GTKDOC=OFF"
+  ];
+
+  nativeBuildInputs = [
+    cmake ninja perl python2 ruby bison gperf
+    pkgconfig gettext gobject-introspection
+  ];
+
+  buildInputs = [
+    libintl libwebp enchant2 libnotify gnutls pcre nettle libidn libgcrypt woff2
+    libxml2 libsecret libxslt harfbuzz libpthreadstubs libtasn1 p11-kit openjpeg
+    sqlite gst-plugins-base gst-plugins-bad libxkbcommon epoxy at-spi2-core
+  ] ++ optional enableGeoLocation geoclue2
+    ++ optional enableGtk2Plugins gtk2
+    ++ (with xorg; [ libXdmcp libXt libXtst libXdamage ])
+    ++ optionals stdenv.isDarwin [ libedit readline libGLU_combined ]
+    ++ optional stdenv.isLinux wayland;
+
+  propagatedBuildInputs = [
+    libsoup gtk3
+  ];
+
+  outputs = [ "out" "dev" ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/webkitgtk/fix-execinfo.patch b/nixpkgs/pkgs/development/libraries/webkitgtk/fix-execinfo.patch
new file mode 100644
index 000000000000..eb825312f3be
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/webkitgtk/fix-execinfo.patch
@@ -0,0 +1,20 @@
+--- webkitgtk-2.2.0.orig/Source/WTF/wtf/Assertions.cpp
++++ webkitgtk-2.2.0/Source/WTF/wtf/Assertions.cpp
+@@ -64,7 +64,7 @@
+ #include <windows.h>
+ #endif
+ 
+-#if OS(DARWIN) || (OS(LINUX) && !defined(__UCLIBC__))
++#if OS(DARWIN) || (OS(LINUX) && defined(__GLIBC__) && !defined(__UCLIBC__))
+ #include <cxxabi.h>
+ #include <dlfcn.h>
+ #include <execinfo.h>
+@@ -242,7 +242,7 @@
+ 
+ void WTFGetBacktrace(void** stack, int* size)
+ {
+-#if OS(DARWIN) || (OS(LINUX) && !defined(__UCLIBC__))
++#if OS(DARWIN) || (OS(LINUX) && defined(__GLIBC__) && !defined(__UCLIBC__))
+     *size = backtrace(stack, *size);
+ #elif OS(WINDOWS) && !OS(WINCE)
+     // The CaptureStackBackTrace function is available in XP, but it is not defined
diff --git a/nixpkgs/pkgs/development/libraries/webkitgtk/libc++.patch b/nixpkgs/pkgs/development/libraries/webkitgtk/libc++.patch
new file mode 100644
index 000000000000..5a9df0ddae98
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/webkitgtk/libc++.patch
@@ -0,0 +1,20 @@
+--- webkitgtk-2.4.9-orig/GNUmakefile.in	2016-02-02 13:23:23.000000000 -0500
++++ webkitgtk-2.4.9/GNUmakefile.in	2016-02-02 22:10:23.000000000 -0500
+@@ -23321,7 +23321,7 @@
+ 	$(WINMM_LIBS) \
+ 	-lm \
+ 	-lpthread \
+-	-lstdc++
++	-lc++
+ 
+ Programs_minidom_LDFLAGS = \
+ 	-no-install
+@@ -23344,7 +23344,7 @@
+ 	$(WINMM_LIBS) \
+ 	-lm \
+ 	-lpthread \
+-	-lstdc++
++	-lc++
+ 
+ Programs_LLIntOffsetsExtractor_LDFLAGS = \
+ 	-no-install
diff --git a/nixpkgs/pkgs/development/libraries/webkitgtk/plugin-none.patch b/nixpkgs/pkgs/development/libraries/webkitgtk/plugin-none.patch
new file mode 100644
index 000000000000..5e2b36bf62dd
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/webkitgtk/plugin-none.patch
@@ -0,0 +1,38 @@
+--- webkitgtk-2.4.9-orig/GNUmakefile.in	2016-02-02 13:23:23.000000000 -0500
++++ webkitgtk-2.4.9/GNUmakefile.in	2016-02-08 00:27:10.000000000 -0500
+@@ -4799,6 +4799,8 @@
+ 	Source/WebCore/plugins/PluginViewBase.h \
+ 	Source/WebCore/plugins/PluginView.cpp \
+ 	Source/WebCore/plugins/PluginView.h \
++	Source/WebCore/plugins/PluginViewNone.cpp \
++	Source/WebCore/plugins/PluginPackageNone.cpp \
+ 	Source/WebCore/plugins/npapi.h \
+ 	Source/WebCore/plugins/npfunctions.h \
+ 	Source/WebCore/plugins/npruntime.h \
+@@ -6375,6 +6377,8 @@
+ 	Source/WebCore/plugins/libWebCore_la-PluginPackage.lo \
+ 	Source/WebCore/plugins/libWebCore_la-PluginStream.lo \
+ 	Source/WebCore/plugins/libWebCore_la-PluginView.lo \
++	Source/WebCore/plugins/libWebCore_la-PluginViewNone.lo \
++	Source/WebCore/plugins/libWebCore_la-PluginPackageNone.lo \
+ 	Source/WebCore/rendering/libWebCore_la-AutoTableLayout.lo \
+ 	Source/WebCore/rendering/libWebCore_la-BidiRun.lo \
+ 	Source/WebCore/rendering/libWebCore_la-break_lines.lo \
+@@ -10796,6 +10800,8 @@
+ 	Source/WebKit2/WebProcess/Plugins/libwebkit2gtk_@WEBKITGTK_API_MAJOR_VERSION@_@WEBKITGTK_API_MINOR_VERSION@_la-PluginProcessConnectionManager.lo \
+ 	Source/WebKit2/WebProcess/Plugins/libwebkit2gtk_@WEBKITGTK_API_MAJOR_VERSION@_@WEBKITGTK_API_MINOR_VERSION@_la-PluginProxy.lo \
+ 	Source/WebKit2/WebProcess/Plugins/libwebkit2gtk_@WEBKITGTK_API_MAJOR_VERSION@_@WEBKITGTK_API_MINOR_VERSION@_la-PluginView.lo \
++	Source/WebKit2/WebProcess/Plugins/libwebkit2gtk_@WEBKITGTK_API_MAJOR_VERSION@_@WEBKITGTK_API_MINOR_VERSION@_la-PluginViewNone.lo \
++	Source/WebKit2/WebProcess/Plugins/libwebkit2gtk_@WEBKITGTK_API_MAJOR_VERSION@_@WEBKITGTK_API_MINOR_VERSION@_la-PluginPackageNone.lo \
+ 	Source/WebKit2/WebProcess/ResourceCache/libwebkit2gtk_@WEBKITGTK_API_MAJOR_VERSION@_@WEBKITGTK_API_MINOR_VERSION@_la-WebResourceCacheManager.lo \
+ 	Source/WebKit2/WebProcess/Storage/libwebkit2gtk_@WEBKITGTK_API_MAJOR_VERSION@_@WEBKITGTK_API_MINOR_VERSION@_la-StorageAreaImpl.lo \
+ 	Source/WebKit2/WebProcess/Storage/libwebkit2gtk_@WEBKITGTK_API_MAJOR_VERSION@_@WEBKITGTK_API_MINOR_VERSION@_la-StorageAreaMap.lo \
+@@ -19503,6 +19509,8 @@
+ 	Source/WebCore/plugins/PluginViewBase.h \
+ 	Source/WebCore/plugins/PluginView.cpp \
+ 	Source/WebCore/plugins/PluginView.h \
++	Source/WebCore/plugins/PluginViewNone.cpp \
++	Source/WebCore/plugins/PluginPackageNone.cpp \
+ 	Source/WebCore/plugins/npapi.h \
+ 	Source/WebCore/plugins/npfunctions.h \
+ 	Source/WebCore/plugins/npruntime.h \
diff --git a/nixpkgs/pkgs/development/libraries/webkitgtk/quartz-webcore.patch b/nixpkgs/pkgs/development/libraries/webkitgtk/quartz-webcore.patch
new file mode 100644
index 000000000000..a7bf859d6c62
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/webkitgtk/quartz-webcore.patch
@@ -0,0 +1,22 @@
+--- webkitgtk-2.4.9-orig/Source/WebCore/plugins/PluginView.cpp	2016-02-02 13:23:23.000000000 -0500
++++ webkitgtk-2.4.9/Source/WebCore/plugins/PluginView.cpp	2016-02-02 18:28:07.000000000 -0500
+@@ -839,7 +839,7 @@
+ #if defined(XP_MACOSX)
+     , m_contextRef(0)
+ #endif
+-#if defined(XP_UNIX) && ENABLE(NETSCAPE_PLUGIN_API)
++#if defined(X11) && ENABLE(NETSCAPE_PLUGIN_API)
+     , m_hasPendingGeometryChange(true)
+     , m_drawable(0)
+     , m_visual(0)
+--- webkitgtk-2.4.9-orig/Source/WebCore/plugins/PluginView.h	2016-02-02 13:23:23.000000000 -0500
++++ webkitgtk-2.4.9/Source/WebCore/plugins/PluginView.h	2016-02-02 18:26:37.000000000 -0500
+@@ -378,7 +378,7 @@
+         void setNPWindowIfNeeded();
+ #endif
+ 
+-#if defined(XP_UNIX) && ENABLE(NETSCAPE_PLUGIN_API)
++#if PLATFORM(X11) && ENABLE(NETSCAPE_PLUGIN_API)
+         bool m_hasPendingGeometryChange;
+         Pixmap m_drawable;
+         Visual* m_visual;
diff --git a/nixpkgs/pkgs/development/libraries/webkitgtk/webcore-svg-libxml-cflags.patch b/nixpkgs/pkgs/development/libraries/webkitgtk/webcore-svg-libxml-cflags.patch
new file mode 100644
index 000000000000..03fc3f3f97de
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/webkitgtk/webcore-svg-libxml-cflags.patch
@@ -0,0 +1,8 @@
+--- webkitgtk-2.2.3-orig/GNUmakefile.in	2013-12-04 17:56:28.000000000 +0800
++++ webkitgtk-2.2.3/GNUmakefile.in	2013-12-05 17:32:37.976689248 +0800
+@@ -21911,6 +21911,7 @@
+ @ENABLE_SVG_TRUE@	$(CAIRO_CFLAGS) \
+ @ENABLE_SVG_TRUE@	$(FREETYPE_CFLAGS) \
+ @ENABLE_SVG_TRUE@	$(LIBSOUP_CFLAGS) \
++@ENABLE_SVG_TRUE@	$(LIBXML_CFLAGS) \
+ @ENABLE_SVG_TRUE@	$(UNICODE_CFLAGS)
diff --git a/nixpkgs/pkgs/development/libraries/webrtc-audio-processing/default.nix b/nixpkgs/pkgs/development/libraries/webrtc-audio-processing/default.nix
new file mode 100644
index 000000000000..b22d339617c2
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/webrtc-audio-processing/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchurl, darwin }:
+
+stdenv.mkDerivation rec {
+  name = "webrtc-audio-processing-0.3.1";
+
+  src = fetchurl {
+    url = "https://freedesktop.org/software/pulseaudio/webrtc-audio-processing/${name}.tar.xz";
+    sha256 = "1gsx7k77blfy171b6g3m0k0s0072v6jcawhmx1kjs9w5zlwdkzd0";
+  };
+
+  buildInputs = stdenv.lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [ ApplicationServices ]);
+
+  patchPhase = stdenv.lib.optionalString stdenv.hostPlatform.isMusl ''
+    substituteInPlace webrtc/base/checks.cc --replace 'defined(__UCLIBC__)' 1
+  '';
+
+  meta = with stdenv.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;
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/websocket++/default.nix b/nixpkgs/pkgs/development/libraries/websocket++/default.nix
new file mode 100644
index 000000000000..d84f30aad55b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/websocket++/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchFromGitHub, cmake }:
+
+stdenv.mkDerivation rec {
+  name = "websocket++-${version}";
+  version = "0.8.1";
+
+  src = fetchFromGitHub {
+    owner = "zaphoyd";
+    repo = "websocketpp";
+    rev = version;
+    sha256 = "12ffczcrryh74c1xssww35ic6yiy2l2xgdd30lshiq9wnzl2brgy";
+  };
+
+  buildInputs = [ cmake ];
+
+  meta = with stdenv.lib; {
+    homepage = https://www.zaphoyd.com/websocketpp/;
+    description = "C++/Boost Asio based websocket client/server library";
+    license = licenses.bsd3;
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ andir ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/wildmidi/default.nix b/nixpkgs/pkgs/development/libraries/wildmidi/default.nix
new file mode 100644
index 000000000000..3b0a447f7376
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/wildmidi/default.nix
@@ -0,0 +1,38 @@
+{ stdenv, fetchurl, cmake, alsaLib, freepats }:
+
+stdenv.mkDerivation rec {
+  name = "wildmidi-0.4.3";
+
+  src = fetchurl {
+    url = "https://github.com/Mindwerks/wildmidi/archive/${name}.tar.gz";
+    sha256 = "1igkxv4axnqap59d8pjgqj94x0khn3fdd2hq6wdvkd2v8nb5m3j9";
+  };
+
+  nativeBuildInputs = [ cmake ];
+
+  buildInputs = [ alsaLib stdenv.cc.libc/*couldn't find libm*/ ];
+
+  preConfigure = ''
+    substituteInPlace CMakeLists.txt \
+      --replace /etc/wildmidi $out/etc
+  '';
+
+  postInstall = ''
+    mkdir "$out"/etc
+    echo "dir ${freepats}" > "$out"/etc/wildmidi.cfg
+    echo "source ${freepats}/freepats.cfg" >> "$out"/etc/wildmidi.cfg
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Software MIDI player and library";
+    longDescription = ''
+      WildMIDI is a simple software midi player which has a core softsynth
+      library that can be use with other applications.
+    '';
+    homepage = http://wildmidi.sourceforge.net/;
+    # The library is LGPLv3, the wildmidi executable is GPLv3
+    license = licenses.lgpl3;
+    platforms = platforms.linux;
+    maintainers = [ maintainers.bjornfor ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/wiredtiger/default.nix b/nixpkgs/pkgs/development/libraries/wiredtiger/default.nix
new file mode 100644
index 000000000000..c45f521dcbb0
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/wiredtiger/default.nix
@@ -0,0 +1,74 @@
+{ stdenv, fetchFromGitHub, automake, autoconf, libtool
+
+# Optional Dependencies
+, lz4 ? null, snappy ? null, zlib ? null, bzip2 ? null, db ? null
+, gperftools ? null, leveldb ? null
+}:
+
+with stdenv.lib;
+let
+  mkFlag = trueStr: falseStr: cond: name: val: "--"
+    + (if cond then trueStr else falseStr)
+    + name
+    + optionalString (val != null && cond != false) "=${val}";
+  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;
+
+  optLz4 = shouldUsePkg lz4;
+  optSnappy = shouldUsePkg snappy;
+  optZlib = shouldUsePkg zlib;
+  optBzip2 = shouldUsePkg bzip2;
+  optDb = shouldUsePkg db;
+  optGperftools = shouldUsePkg gperftools;
+  optLeveldb = shouldUsePkg leveldb;
+in
+stdenv.mkDerivation rec {
+  name = "wiredtiger-${version}";
+  version = "2.6.1";
+
+  src = fetchFromGitHub {
+    repo = "wiredtiger";
+    owner = "wiredtiger";
+    rev = version;
+    sha256 = "1nj319w3hvkq3za2dz9m0p1w683gycdb392v1jb910bhzpsq30pd";
+  };
+
+  nativeBuildInputs = [ automake autoconf libtool ];
+  buildInputs = [ optLz4 optSnappy optZlib optBzip2 optDb optGperftools optLeveldb ];
+
+  configureFlags = [
+    (mkWith   false                   "attach"     null)
+    (mkWith   true                    "builtins"   "")
+    (mkEnable (optBzip2 != null)      "bzip2"      null)
+    (mkEnable false                   "diagnostic" null)
+    (mkEnable false                   "java"       null)
+    (mkEnable (optLeveldb != null)    "leveldb"    null)
+    (mkEnable false                   "python"     null)
+    (mkEnable (optSnappy != null)     "snappy"     null)
+    (mkEnable (optLz4 != null)        "lz4"        null)
+    (mkEnable (optGperftools != null) "tcmalloc"   null)
+    (mkEnable (optZlib != null)       "zlib"       null)
+    (mkWith   (optDb != null)         "berkeleydb" optDb)
+    (mkWith   false                   "helium"     null)
+  ];
+
+  preConfigure = ''
+    ./autogen.sh
+  '';
+
+  prePatch = stdenv.lib.optionalString stdenv.isDarwin ''
+    substituteInPlace api/leveldb/leveldb_wt.h --replace \
+      '#include "wiredtiger.h"' \
+      ''$'#include "wiredtiger.h"\n#include "pthread.h"'
+  '';
+
+  meta = {
+    homepage = http://wiredtiger.com/;
+    description = "";
+    license = licenses.gpl2;
+    platforms = intersectLists platforms.unix platforms.x86_64;
+    broken = true; # Broken by f689a6d1c6796c4a4f116ffec6c4624379e04bc9.
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/wlc/default.nix b/nixpkgs/pkgs/development/libraries/wlc/default.nix
new file mode 100644
index 000000000000..572adfeb0bb6
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/wlc/default.nix
@@ -0,0 +1,39 @@
+{ stdenv, fetchFromGitHub, cmake, pkgconfig
+, wayland, pixman, libxkbcommon, libinput, xcbutilwm, xcbutilimage, libGL
+, libX11, dbus, wayland-protocols, libdrm, mesa_noglu
+, libpthreadstubs, libXdmcp, libXext, libXfixes
+, withOptionalPackages ? true, zlib, valgrind, doxygen
+}:
+
+stdenv.mkDerivation rec {
+  name = "wlc-${version}";
+  version = "0.0.11";
+
+  src = fetchFromGitHub {
+    owner = "Cloudef";
+    repo = "wlc";
+    rev = "v${version}";
+    fetchSubmodules = true;
+    sha256 = "1qnak907gjd35hq4b0rrhgb7kz5iwnirh8yk372yzxpgk7dq0gz9";
+  };
+
+  nativeBuildInputs = [ cmake pkgconfig ];
+
+  buildInputs = [
+    wayland pixman libxkbcommon libinput xcbutilwm xcbutilimage libGL
+    libX11 libXfixes dbus wayland-protocols
+    libpthreadstubs libXdmcp libXext libdrm mesa_noglu ]
+    ++ stdenv.lib.optionals withOptionalPackages [ zlib valgrind doxygen ];
+
+  doCheck = true;
+  checkTarget = "test";
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    description = "A library for making a simple Wayland compositor";
+    homepage    = https://github.com/Cloudef/wlc;
+    license     = licenses.mit;
+    platforms   = platforms.linux;
+    maintainers = with maintainers; [ primeos ]; # Trying to keep it up-to-date.
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/wlroots/0001-Fix-missing-headers-when-building-without-X11.patch b/nixpkgs/pkgs/development/libraries/wlroots/0001-Fix-missing-headers-when-building-without-X11.patch
new file mode 100644
index 000000000000..7eb55132100f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/wlroots/0001-Fix-missing-headers-when-building-without-X11.patch
@@ -0,0 +1,133 @@
+From 3588e89124d37c8d1968b3b6dbb723b4f6c4525c Mon Sep 17 00:00:00 2001
+From: Alyssa Ross <hi@alyssa.is>
+Date: Sun, 21 Apr 2019 00:35:57 +0000
+Subject: [PATCH] Fix missing headers when building without X11
+
+The deleted includes are redundant, because other headers will include
+the necessary files. Additionally, they cause build failures, because
+including EGL/egl.h or EGL/eglext.h directly, instead of through
+wlr/render/egl.h or wlr/render/interface.h, will mean that
+MESA_EGL_NO_X11_HEADERS will not have been defined, and so the EGL
+headers will attempt to pull in unnecessary X11 headers that may not
+exist on the system.
+
+For the headers produced by glgen.sh, the includes couldn't simply be
+deleted, because no other header would include the EGL headers. Neither
+wlr/render/egl.h or wlr/render/interface.h felt appropriate to include,
+so I opted instead to copy the MESA_EGL_NO_X11_HEADERS definition before
+the EGL includes.
+---
+ backend/drm/drm.c         | 2 --
+ backend/drm/renderer.c    | 2 --
+ backend/headless/output.c | 2 --
+ backend/wayland/backend.c | 2 --
+ glgen.sh                  | 5 +++++
+ include/render/gles2.h    | 2 --
+ render/egl.c              | 2 --
+ rootston/output.c         | 1 -
+ 8 files changed, 5 insertions(+), 13 deletions(-)
+
+diff --git a/backend/drm/drm.c b/backend/drm/drm.c
+index 7fd36794..74aeeb42 100644
+--- a/backend/drm/drm.c
++++ b/backend/drm/drm.c
+@@ -2,8 +2,6 @@
+ #include <assert.h>
+ #include <drm_fourcc.h>
+ #include <drm_mode.h>
+-#include <EGL/egl.h>
+-#include <EGL/eglext.h>
+ #include <errno.h>
+ #include <gbm.h>
+ #include <GLES2/gl2.h>
+diff --git a/backend/drm/renderer.c b/backend/drm/renderer.c
+index 72cfd430..1771e725 100644
+--- a/backend/drm/renderer.c
++++ b/backend/drm/renderer.c
+@@ -1,6 +1,4 @@
+ #include <assert.h>
+-#include <EGL/egl.h>
+-#include <EGL/eglext.h>
+ #include <gbm.h>
+ #include <stdbool.h>
+ #include <stdlib.h>
+diff --git a/backend/headless/output.c b/backend/headless/output.c
+index 3cb35dce..283b5513 100644
+--- a/backend/headless/output.c
++++ b/backend/headless/output.c
+@@ -1,6 +1,4 @@
+ #include <assert.h>
+-#include <EGL/egl.h>
+-#include <EGL/eglext.h>
+ #include <stdlib.h>
+ #include <wlr/interfaces/wlr_output.h>
+ #include <wlr/render/wlr_renderer.h>
+diff --git a/backend/wayland/backend.c b/backend/wayland/backend.c
+index 2a937de7..7c8bb4e0 100644
+--- a/backend/wayland/backend.c
++++ b/backend/wayland/backend.c
+@@ -5,8 +5,6 @@
+ 
+ #include <wlr/config.h>
+ 
+-#include <EGL/egl.h>
+-#include <EGL/eglext.h>
+ #include <wayland-server.h>
+ 
+ #include <wlr/backend/interface.h>
+diff --git a/glgen.sh b/glgen.sh
+index fb3bb3c6..daa98b00 100755
+--- a/glgen.sh
++++ b/glgen.sh
+@@ -62,6 +62,11 @@ cat > "$OUTDIR/$BASE.h" << EOF
+ #define $INCLUDE_GUARD
+ 
+ #include <stdbool.h>
++#include <wlr/config.h>
++
++#if !WLR_HAS_X11_BACKEND && !WLR_HAS_XWAYLAND && !defined MESA_EGL_NO_X11_HEADERS
++#define MESA_EGL_NO_X11_HEADERS
++#endif
+ 
+ #include <EGL/egl.h>
+ #include <EGL/eglext.h>
+diff --git a/include/render/gles2.h b/include/render/gles2.h
+index 593c7d1c..7e0782d4 100644
+--- a/include/render/gles2.h
++++ b/include/render/gles2.h
+@@ -1,8 +1,6 @@
+ #ifndef RENDER_GLES2_H
+ #define RENDER_GLES2_H
+ 
+-#include <EGL/egl.h>
+-#include <EGL/eglext.h>
+ #include <GLES2/gl2.h>
+ #include <GLES2/gl2ext.h>
+ #include <stdbool.h>
+diff --git a/render/egl.c b/render/egl.c
+index cc00dece..c0d43609 100644
+--- a/render/egl.c
++++ b/render/egl.c
+@@ -1,7 +1,5 @@
+ #include <assert.h>
+ #include <drm_fourcc.h>
+-#include <EGL/egl.h>
+-#include <EGL/eglext.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <wlr/render/egl.h>
+diff --git a/rootston/output.c b/rootston/output.c
+index bc2f4d6c..4e9e9d18 100644
+--- a/rootston/output.c
++++ b/rootston/output.c
+@@ -13,7 +13,6 @@
+ #include <wlr/types/wlr_xdg_shell.h>
+ #include <wlr/util/log.h>
+ #include <wlr/util/region.h>
+-#include <wlr/xwayland.h>
+ #include "rootston/config.h"
+ #include "rootston/layers.h"
+ #include "rootston/output.h"
+-- 
+2.19.2
+
diff --git a/nixpkgs/pkgs/development/libraries/wlroots/default.nix b/nixpkgs/pkgs/development/libraries/wlroots/default.nix
new file mode 100644
index 000000000000..602b112ef594
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/wlroots/default.nix
@@ -0,0 +1,86 @@
+{ stdenv, lib, fetchFromGitHub, fetchpatch, meson, ninja, pkgconfig
+, wayland, libGL, wayland-protocols, libinput, libxkbcommon, pixman, mesa_noglu
+
+, libcapSupport ? true, libcap
+, x11Support ? true, libX11
+, xcbIcccmSupport ? x11Support, xcbutilwm
+, xcbErrorsSupport ? x11Support, xcbutilerrors
+}:
+
+stdenv.mkDerivation rec {
+  pname = "wlroots";
+  version = "0.6.0";
+
+  src = fetchFromGitHub {
+    owner = "swaywm";
+    repo = "wlroots";
+    rev = version;
+    sha256 = "1rdcmll5b8w242n6yfjpsaprq280ck2jmbz46dxndhignxgda7k4";
+  };
+
+  # $out for the library, $bin for rootston, and $examples for the example
+  # programs (in examples) AND rootston
+  outputs = [ "out" "bin" "examples" ];
+
+  nativeBuildInputs = [ meson ninja pkgconfig ];
+
+  buildInputs = [
+    wayland libGL wayland-protocols libinput libxkbcommon pixman mesa_noglu
+  ] ++ lib.optional libcapSupport libcap
+    ++ lib.optional x11Support libX11
+    ++ lib.optional xcbErrorsSupport xcbutilerrors
+    ++ lib.optional xcbIcccmSupport xcbutilwm;
+
+  mesonFlags = [ "-Dlogind=enabled" ]
+    ++ lib.optional libcapSupport "-Dlibcap=enabled"
+    ++ lib.optionals x11Support [ "-Dxwayland=enabled" "-Dx11-backend=enabled" ]
+    ++ lib.optional xcbErrorsSupport "-Dxcb-errors=enabled"
+    ++ lib.optional xcbIcccmSupport  "-Dxcb-icccm=enabled";
+
+  postPatch = ''
+    # It happens from time to time that the version wasn't updated:
+    sed -iE "s/version: '[0-9]\.[0-9]\.[0-9]'/version: '${version}.0'/" meson.build
+  '';
+
+  postInstall = ''
+    # Copy the library to $bin and $examples
+    for output in "$bin" "$examples"; do
+      mkdir -p $output/lib
+      cp -P libwlroots* $output/lib/
+    done
+  '';
+
+  postFixup = ''
+    # Install rootston (the reference compositor) to $bin and $examples (this
+    # has to be done after the fixup phase to prevent broken binaries):
+    for output in "$bin" "$examples"; do
+      mkdir -p $output/bin
+      cp rootston/rootston $output/bin/
+      patchelf \
+        --set-rpath "$(patchelf --print-rpath $output/bin/rootston | sed s,$out,$output,g)" \
+        $output/bin/rootston
+      mkdir $output/etc
+      cp ../rootston/rootston.ini.example $output/etc/rootston.ini
+    done
+    # Install ALL example programs to $examples:
+    # screencopy dmabuf-capture input-inhibitor layer-shell idle-inhibit idle
+    # screenshot output-layout multi-pointer rotation tablet touch pointer
+    # simple
+    mkdir -p $examples/bin
+    cd ./examples
+    for binary in $(find . -executable -type f -printf '%P\n' | grep -vE '\.so'); do
+      cp "$binary" "$examples/bin/wlroots-$binary"
+      patchelf \
+        --set-rpath "$(patchelf --print-rpath $output/bin/rootston | sed s,$out,$examples,g)" \
+        "$examples/bin/wlroots-$binary"
+    done
+  '';
+
+  meta = with lib; {
+    description = "A modular Wayland compositor library";
+    inherit (src.meta) homepage;
+    license     = licenses.mit;
+    platforms   = platforms.linux;
+    maintainers = with maintainers; [ primeos ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/wolfssl/default.nix b/nixpkgs/pkgs/development/libraries/wolfssl/default.nix
new file mode 100644
index 000000000000..e7feaabc739a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/wolfssl/default.nix
@@ -0,0 +1,35 @@
+{ stdenv, fetchFromGitHub, autoreconfHook }:
+
+stdenv.mkDerivation rec {
+  name = "wolfssl-${version}";
+  version = "4.0.0";
+
+  src = fetchFromGitHub {
+    owner = "wolfSSL";
+    repo = "wolfssl";
+    rev = "v${version}-stable";
+    sha256 = "155lmgz81ky0x04c8m2yzlsm58i9jk6hiw1ajc3wizvbpczbca57";
+  };
+
+  configureFlags = [ "--enable-all" ];
+
+  outputs = [ "out" "dev" "doc" "lib" ];
+
+  nativeBuildInputs = [ autoreconfHook ];
+
+  postInstall = ''
+     # fix recursive cycle:
+     # wolfssl-config points to dev, dev propagates bin
+     moveToOutput bin/wolfssl-config "$dev"
+     # moveToOutput also removes "$out" so recreate it
+     mkdir -p "$out"
+  '';
+
+  meta = with stdenv.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;
+    maintainers = with maintainers; [ mcmtroffaes ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/wt/default.nix b/nixpkgs/pkgs/development/libraries/wt/default.nix
new file mode 100644
index 000000000000..e1c339d1e0fe
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/wt/default.nix
@@ -0,0 +1,54 @@
+{ stdenv, fetchFromGitHub, cmake, boost, pkgconfig, doxygen, qt48Full, libharu
+, pango, fcgi, firebird, mysql, postgresql, graphicsmagick, glew, openssl
+, pcre
+}:
+
+let
+  generic =
+    { version, sha256 }:
+    stdenv.mkDerivation rec {
+      name = "wt-${version}";
+
+      src = fetchFromGitHub {
+        owner = "emweb";
+        repo = "wt";
+        rev = version;
+        inherit sha256;
+      };
+
+      enableParallelBuilding = true;
+
+      nativeBuildInputs = [ pkgconfig ];
+      buildInputs = [
+        cmake boost doxygen qt48Full libharu
+        pango fcgi firebird mysql.connector-c postgresql graphicsmagick glew
+        openssl pcre
+      ];
+
+      cmakeFlags = [
+        "-DWT_WRASTERIMAGE_IMPLEMENTATION=GraphicsMagick"
+        "-DWT_CPP_11_MODE=-std=c++11"
+        "-DGM_PREFIX=${graphicsmagick}"
+        "-DMYSQL_PREFIX=${mysql.connector-c}"
+        "--no-warn-unused-cli"
+      ];
+
+      meta = with stdenv.lib; {
+        homepage = https://www.webtoolkit.eu/wt;
+        description = "C++ library for developing web applications";
+        platforms = platforms.linux;
+        license = licenses.gpl2;
+        maintainers = with maintainers; [ juliendehos willibutz ];
+      };
+    };
+in {
+  wt3 = generic {
+    version = "3.3.11";
+    sha256 = "1s1bwg3s7brnspr9ya1vg5mr29dbvhf05s606fiv409b7ladqvxq";
+  };
+
+  wt4 = generic {
+    version = "4.0.5";
+    sha256 = "1gn8f30mjmn9aaxdazk49wijz37nglfww15ydrjiyhl6v5xhsjdv";
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/wtk/builder.sh b/nixpkgs/pkgs/development/libraries/wtk/builder.sh
new file mode 100644
index 000000000000..86f2719537cd
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/wtk/builder.sh
@@ -0,0 +1,27 @@
+source $stdenv/setup
+
+mkdir unzipped
+pushd unzipped
+unzip $src || true
+popd
+
+mkdir -p $out
+mv unzipped/* $out/
+
+# Remove crap in the root directory.
+for file in $out/*
+do
+  if test -f $file ; then
+    rm $file
+  fi
+done
+
+# Set the dynamic linker.
+rpath=
+for i in $libraries; do
+    rpath=$rpath${rpath:+:}$i/lib
+done
+find $out -type f -perm -0100 \
+    -exec patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" {} \;
+find $out -type f -perm -0100 \
+    -exec patchelf --set-rpath "$rpath" {} \;
diff --git a/nixpkgs/pkgs/development/libraries/wtk/default.nix b/nixpkgs/pkgs/development/libraries/wtk/default.nix
new file mode 100644
index 000000000000..2791c97f5ae6
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/wtk/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, requireFile, unzip, xorg }:
+
+assert stdenv.hostPlatform.system == "i686-linux";
+
+stdenv.mkDerivation rec {
+  name = "sun-java-wtk-2.5.2_01";
+
+  src = requireFile {
+    url = meta.homepage;
+    name = "sun_java_wireless_toolkit-2.5.2_01-linuxi486.bin.sh";
+    sha256 = "1cjb9c27847wv0hq3j645ckn4di4vsfvp29fr4zmdqsnvk4ahvj1";
+  };
+
+  builder = ./builder.sh;
+
+  buildInputs = [ unzip ];
+
+  libraries = [ xorg.libXpm xorg.libXt xorg.libX11 xorg.libICE xorg.libSM stdenv.cc.cc ];
+
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/wxSVG/default.nix b/nixpkgs/pkgs/development/libraries/wxSVG/default.nix
new file mode 100644
index 000000000000..b18dd23ec82a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/wxSVG/default.nix
@@ -0,0 +1,34 @@
+{ stdenv, fetchurl
+, pkgconfig, wxGTK
+, ffmpeg, libexif
+, cairo, pango }:
+
+stdenv.mkDerivation rec {
+
+  name = "wxSVG-${version}";
+  srcName = "wxsvg-${version}";
+  version = "1.5.17";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/project/wxsvg/wxsvg/${version}/${srcName}.tar.bz2";
+    sha256 = "154d9ad91ff0g9ah2k8f22yhlfkss307anyliyf3111kghil929z";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+
+  propagatedBuildInputs = [ wxGTK ffmpeg libexif ];
+
+  buildInputs = [ cairo pango ];
+
+  meta = with stdenv.lib; {
+    description = "A SVG manipulation library built with wxWidgets";
+    longDescription = ''
+    wxSVG is C++ library to create, manipulate and render
+    Scalable Vector Graphics (SVG) files with the wxWidgets toolkit.
+    '';
+    homepage = http://wxsvg.sourceforge.net/;
+    license = with licenses; gpl2;
+    maintainers = with maintainers; [ AndersonTorres ];
+    platforms = with platforms; linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/wxsqlite3/default.nix b/nixpkgs/pkgs/development/libraries/wxsqlite3/default.nix
new file mode 100644
index 000000000000..49f12842533b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/wxsqlite3/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchFromGitHub, wxGTK, sqlite
+, darwin }:
+
+stdenv.mkDerivation rec {
+  name = "wxsqlite3-${version}";
+  version = "3.3.1";
+
+  src = fetchFromGitHub {
+    owner = "utelle";
+    repo = "wxsqlite3";
+    rev = "v${version}";
+    sha1 = "bb8p58g88nkdcsj3h4acx7h925n2cy9g";
+  };
+
+  preBuild = stdenv.lib.optionalString stdenv.isDarwin ''
+    cp build28/Info.plist.in build28/wxmac.icns build/
+  '';
+
+  buildInputs = [ wxGTK sqlite ]
+    ++ stdenv.lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.Cocoa darwin.stubs.setfile darwin.stubs.rez darwin.stubs.derez ];
+
+  meta = with stdenv.lib; {
+    homepage = https://utelle.github.io/wxsqlite3/ ;
+    description = "A C++ wrapper around the public domain SQLite 3.x for wxWidgets";
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ vrthra ];
+    license = [ licenses.lgpl2 ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/wxsqliteplus/default.nix b/nixpkgs/pkgs/development/libraries/wxsqliteplus/default.nix
new file mode 100644
index 000000000000..998f6a9e5f69
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/wxsqliteplus/default.nix
@@ -0,0 +1,38 @@
+{ stdenv, fetchFromGitHub, wxGTK, wxsqlite3, sqlite }:
+
+stdenv.mkDerivation rec {
+  name = "wxsqliteplus-${version}";
+  version = "0.3.6";
+
+  src = fetchFromGitHub {
+    owner = "guanlisheng";
+    repo = "wxsqliteplus";
+    rev = "v${version}";
+    sha1 = "yr9ysviv4hbrxn900z1wz8j32frimvx1";
+  };
+
+  buildInputs = [ wxGTK wxsqlite3 sqlite ];
+
+  makeFlags = [
+    "LDFLAGS=-L${wxsqlite3}/lib"
+  ];
+
+  preBuild = ''
+    sed -ie 's|all: $(LIBPREFIX)wxsqlite$(LIBEXT)|all: |g' Makefile
+    sed -ie 's|wxsqliteplus$(EXEEXT): $(WXSQLITEPLUS_OBJECTS) $(LIBPREFIX)wxsqlite$(LIBEXT)|wxsqliteplus$(EXEEXT):  $(WXSQLITEPLUS_OBJECTS) |g' Makefile
+    sed -ie 's|-lwxsqlite |-lwxcode_gtk2u_wxsqlite3-3.0 |g' Makefile
+  '';
+
+  installPhase = ''
+    mkdir -p $out/bin
+    cp wxsqliteplus $out/bin/
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = http://guanlisheng.com/;
+    description = "A simple SQLite database browser built with wxWidgets";
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ vrthra ];
+    license = licenses.gpl2;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/wxwidgets/2.8/default.nix b/nixpkgs/pkgs/development/libraries/wxwidgets/2.8/default.nix
new file mode 100644
index 000000000000..1b08bb090b4d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/wxwidgets/2.8/default.nix
@@ -0,0 +1,75 @@
+{ stdenv, fetchurl, pkgconfig, gtk2, libXinerama, libSM, libXxf86vm, xorgproto
+, gstreamer, gst-plugins-base, GConf, libX11, cairo
+, libGLSupported
+, withMesa ? libGLSupported, libGLU ? null, libGL ? null
+, compat24 ? false, compat26 ? true, unicode ? true,
+}:
+
+assert withMesa -> libGLU != null && libGL != null;
+
+with stdenv.lib;
+
+stdenv.mkDerivation rec {
+  version = "2.8.12.1";
+  name = "wxGTK-${version}";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/wxpython/wxPython-src-${version}.tar.bz2";
+    sha256 = "1l1w4i113csv3bd5r8ybyj0qpxdq83lj6jrc5p7cc10mkwyiagqz";
+  };
+
+  buildInputs = [ gtk2 libXinerama libSM libXxf86vm xorgproto gstreamer gst-plugins-base GConf libX11 cairo ]
+    ++ optional withMesa libGLU;
+
+  nativeBuildInputs = [ pkgconfig ];
+
+  hardeningDisable = [ "format" ];
+
+  configureFlags = [
+    "--enable-gtk2"
+    (if compat24 then "--enable-compat24" else "--disable-compat24")
+    (if compat26 then "--enable-compat26" else "--disable-compat26")
+    "--disable-precomp-headers"
+    (if unicode then "--enable-unicode" else "")
+    "--enable-mediactrl"
+    "--enable-graphics_ctx"
+  ] ++ optional withMesa "--with-opengl";
+
+  # These variables are used by configure to find some dependencies.
+  SEARCH_INCLUDE =
+    "${libXinerama.dev}/include ${libSM.dev}/include ${libXxf86vm.dev}/include";
+  SEARCH_LIB =
+    "${libXinerama.out}/lib ${libSM.out}/lib ${libXxf86vm.out}/lib "
+    + optionalString withMesa "${libGLU.out}/lib ${libGL.out}/lib ";
+
+  # Work around a bug in configure.
+  NIX_CFLAGS_COMPILE = [ "-DHAVE_X11_XLIB_H=1" "-lX11" "-lcairo" "-Wno-narrowing" ];
+
+  preConfigure = "
+    substituteInPlace configure --replace 'SEARCH_INCLUDE=' 'DUMMY_SEARCH_INCLUDE='
+    substituteInPlace configure --replace 'SEARCH_LIB=' 'DUMMY_SEARCH_LIB='
+    substituteInPlace configure --replace /usr /no-such-path
+  ";
+
+  postBuild = "(cd contrib/src && make)";
+
+  postInstall = "
+    (cd contrib/src && make install)
+    (cd $out/include && ln -s wx-*/* .)
+  ";
+
+  passthru = {
+    inherit compat24 compat26 unicode;
+    gtk = gtk2;
+  };
+
+  enableParallelBuilding = true;
+
+  meta = {
+    platforms = platforms.linux;
+    license = licenses.wxWindows;
+    homepage = https://www.wxwidgets.org/;
+    description = "a C++ library that lets developers create applications for Windows, macOS, Linux and other platforms with a single code base";
+    longDescription = "wxWidgets gives you a single, easy-to-use API for writing GUI applications on multiple platforms that still utilize the native platform's controls and utilities. Link with the appropriate library for your platform and compiler, and your application will adopt the look and feel appropriate to that platform. On top of great GUI functionality, wxWidgets gives you: online help, network programming, streams, clipboard and drag and drop, multithreading, image loading and saving in a variety of popular formats, database support, HTML viewing and printing, and much more.";
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/wxwidgets/2.9/default.nix b/nixpkgs/pkgs/development/libraries/wxwidgets/2.9/default.nix
new file mode 100644
index 000000000000..18e0cebec859
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/wxwidgets/2.9/default.nix
@@ -0,0 +1,86 @@
+{ stdenv, fetchurl, pkgconfig, gtk2, libXinerama, libSM, libXxf86vm, xorgproto
+, gstreamer, gst-plugins-base, GConf, setfile
+, libGLSupported
+, withMesa ? libGLSupported, libGLU ? null, libGL ? null
+, compat24 ? false, compat26 ? true, unicode ? true
+, Carbon ? null, Cocoa ? null, Kernel ? null, QuickTime ? null, AGL ? null
+}:
+
+assert withMesa -> libGLU != null && libGL != null;
+
+with stdenv.lib;
+
+let
+  version = "2.9.4";
+in
+stdenv.mkDerivation {
+  name = "wxwidgets-${version}";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/wxwindows/wxWidgets-${version}.tar.bz2";
+    sha256 = "04jda4bns7cmp7xy68qz112yg0lribpc6xs5k9gilfqcyhshqlvc";
+  };
+
+  patches = [
+    (fetchurl { # https://trac.wxwidgets.org/ticket/17942
+      url = "https://trac.wxwidgets.org/raw-attachment/ticket/17942/"
+          + "fix_assertion_using_hide_in_destroy.diff";
+      sha256 = "009y3dav79wiig789vkkc07g1qdqprg1544lih79199kb1h64lvy";
+    })
+  ];
+
+  buildInputs =
+    [ gtk2 libXinerama libSM libXxf86vm xorgproto gstreamer
+      gst-plugins-base GConf ]
+    ++ optional withMesa libGLU
+    ++ optionals stdenv.isDarwin [ setfile Carbon Cocoa Kernel QuickTime ];
+
+  nativeBuildInputs = [ pkgconfig ];
+
+  propagatedBuildInputs = optional stdenv.isDarwin AGL;
+
+  configureFlags =
+    [ "--enable-gtk2" "--disable-precomp-headers" "--enable-mediactrl"
+      (if compat24 then "--enable-compat24" else "--disable-compat24")
+      (if compat26 then "--enable-compat26" else "--disable-compat26") ]
+    ++ optional unicode "--enable-unicode"
+    ++ optional withMesa "--with-opengl"
+    ++ optionals stdenv.isDarwin
+      # allow building on 64-bit
+      [ "--with-cocoa" "--enable-universal-binaries" "--with-macosx-version-min=10.7" ];
+
+  SEARCH_LIB = "${libGLU.out}/lib ${libGL.out}/lib ";
+
+  preConfigure = "
+    substituteInPlace configure --replace 'SEARCH_INCLUDE=' 'DUMMY_SEARCH_INCLUDE='
+    substituteInPlace configure --replace 'SEARCH_LIB=' 'DUMMY_SEARCH_LIB='
+    substituteInPlace configure --replace /usr /no-such-path
+  " + optionalString stdenv.isDarwin ''
+    substituteInPlace configure --replace \
+      'ac_cv_prog_SETFILE="/Developer/Tools/SetFile"' \
+      'ac_cv_prog_SETFILE="${setfile}/bin/SetFile"'
+    substituteInPlace configure --replace \
+      "-framework System" \
+      -lSystem
+  '';
+
+  postInstall = "
+    (cd $out/include && ln -s wx-*/* .)
+  ";
+
+  passthru = {
+    inherit compat24 compat26 unicode;
+    gtk = gtk2;
+  };
+
+  enableParallelBuilding = true;
+
+  meta = {
+    platforms = with platforms; darwin ++ linux;
+    license = licenses.wxWindows;
+    homepage = https://www.wxwidgets.org/;
+    description = "a C++ library that lets developers create applications for Windows, macOS, Linux and other platforms with a single code base";
+    longDescription = "wxWidgets gives you a single, easy-to-use API for writing GUI applications on multiple platforms that still utilize the native platform's controls and utilities. Link with the appropriate library for your platform and compiler, and your application will adopt the look and feel appropriate to that platform. On top of great GUI functionality, wxWidgets gives you: online help, network programming, streams, clipboard and drag and drop, multithreading, image loading and saving in a variety of popular formats, database support, HTML viewing and printing, and much more.";
+    badPlatforms = [ "x86_64-darwin" ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/wxwidgets/3.0/default.nix b/nixpkgs/pkgs/development/libraries/wxwidgets/3.0/default.nix
new file mode 100644
index 000000000000..a89f132b8322
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/wxwidgets/3.0/default.nix
@@ -0,0 +1,94 @@
+{ stdenv, fetchFromGitHub, fetchurl, fetchpatch, pkgconfig
+, gtk2, gtk3, libXinerama, libSM, libXxf86vm
+, xorgproto, gstreamer, gst-plugins-base, GConf, setfile
+, libGLSupported
+, withMesa ? libGLSupported, libGLU ? null, libGL ? null
+, compat24 ? false, compat26 ? true, unicode ? true
+, withGtk2 ? true
+, withWebKit ? false, webkitgtk24x-gtk2 ? null, webkitgtk ? null
+, AGL ? null, Carbon ? null, Cocoa ? null, Kernel ? null, QTKit ? null
+}:
+
+
+assert withMesa -> libGLU != null && libGL != null;
+assert withWebKit -> (if withGtk2 then webkitgtk24x-gtk2 else webkitgtk) != null;
+
+with stdenv.lib;
+
+stdenv.mkDerivation rec {
+  version = "3.0.4";
+  name = "wxwidgets-${version}";
+
+  src = fetchFromGitHub {
+    owner = "wxWidgets";
+    repo = "wxWidgets";
+    rev = "v${version}";
+    sha256 = "19mqglghjjqjgz4rbybn3qdgn2cz9xc511nq1pvvli9wx2k8syl1";
+  };
+
+  buildInputs =
+    [ (if withGtk2 then gtk2 else gtk3) libXinerama libSM libXxf86vm xorgproto gstreamer
+      gst-plugins-base GConf ]
+    ++ optional withMesa libGLU
+    ++ optional withWebKit (if withGtk2 then webkitgtk24x-gtk2 else webkitgtk)
+    ++ optionals stdenv.isDarwin [ setfile Carbon Cocoa Kernel QTKit ];
+
+  nativeBuildInputs = [ pkgconfig ];
+
+  propagatedBuildInputs = optional stdenv.isDarwin AGL;
+
+  patches = [
+    (fetchurl { # https://trac.wxwidgets.org/ticket/17942
+      url = "https://trac.wxwidgets.org/raw-attachment/ticket/17942/"
+          + "fix_assertion_using_hide_in_destroy.diff";
+      sha256 = "009y3dav79wiig789vkkc07g1qdqprg1544lih79199kb1h64lvy";
+    })
+  ];
+
+  configureFlags =
+    [ "--disable-precomp-headers" "--enable-mediactrl"
+      (if compat24 then "--enable-compat24" else "--disable-compat24")
+      (if compat26 then "--enable-compat26" else "--disable-compat26") ]
+    ++ optional unicode "--enable-unicode"
+    ++ optional withMesa "--with-opengl"
+    ++ optionals stdenv.isDarwin
+      # allow building on 64-bit
+      [ "--with-cocoa" "--enable-universal-binaries" "--with-macosx-version-min=10.7" ]
+    ++ optionals withWebKit
+      ["--enable-webview" "--enable-webview-webkit"];
+
+  SEARCH_LIB = "${libGLU.out}/lib ${libGL.out}/lib ";
+
+  preConfigure = "
+    substituteInPlace configure --replace 'SEARCH_INCLUDE=' 'DUMMY_SEARCH_INCLUDE='
+    substituteInPlace configure --replace 'SEARCH_LIB=' 'DUMMY_SEARCH_LIB='
+    substituteInPlace configure --replace /usr /no-such-path
+  " + optionalString stdenv.isDarwin ''
+    substituteInPlace configure --replace \
+      'ac_cv_prog_SETFILE="/Developer/Tools/SetFile"' \
+      'ac_cv_prog_SETFILE="${setfile}/bin/SetFile"'
+    substituteInPlace configure --replace \
+      "-framework System" \
+      -lSystem
+  '';
+
+  postInstall = "
+    (cd $out/include && ln -s wx-*/* .)
+  ";
+
+  passthru = {
+    inherit compat24 compat26 unicode;
+    gtk = if withGtk2 then gtk2 else gtk3;
+  };
+
+  enableParallelBuilding = true;
+
+  meta = {
+    platforms = with platforms; darwin ++ linux;
+    license = licenses.wxWindows;
+    homepage = https://www.wxwidgets.org/;
+    description = "a C++ library that lets developers create applications for Windows, macOS, Linux and other platforms with a single code base";
+    longDescription = "wxWidgets gives you a single, easy-to-use API for writing GUI applications on multiple platforms that still utilize the native platform's controls and utilities. Link with the appropriate library for your platform and compiler, and your application will adopt the look and feel appropriate to that platform. On top of great GUI functionality, wxWidgets gives you: online help, network programming, streams, clipboard and drag and drop, multithreading, image loading and saving in a variety of popular formats, database support, HTML viewing and printing, and much more.";
+    badPlatforms = [ "x86_64-darwin" ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/wxwidgets/3.0/mac.nix b/nixpkgs/pkgs/development/libraries/wxwidgets/3.0/mac.nix
new file mode 100644
index 000000000000..6e559cfb6a94
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/wxwidgets/3.0/mac.nix
@@ -0,0 +1,76 @@
+{ stdenv, fetchzip, fetchpatch, expat, libiconv, libjpeg, libpng, libtiff, zlib
+# darwin only attributes
+, cf-private, derez, rez, setfile
+, AGL, Cocoa, Kernel
+}:
+
+stdenv.mkDerivation rec {
+  version = "3.0.4";
+  name = "wxmac-${version}";
+
+  src = fetchzip {
+    url = "https://github.com/wxWidgets/wxWidgets/archive/v${version}.tar.gz";
+    sha256 = "19mqglghjjqjgz4rbybn3qdgn2cz9xc511nq1pvvli9wx2k8syl1";
+  };
+
+  buildInputs = [
+    expat libiconv libjpeg libpng libtiff zlib
+    derez rez setfile
+    Cocoa Kernel
+
+    # Needed for CFURLGetFSRef, etc. which have deen deprecated
+    # since 10.9 and are not part of swift-corelibs CoreFoundation.
+    cf-private
+  ];
+
+  propagatedBuildInputs = [ AGL ];
+
+  postPatch = ''
+    substituteInPlace configure --replace "-framework System" -lSystem
+  '';
+
+  configureFlags = [
+    "wx_cv_std_libfullpath=/var/empty"
+    "--with-macosx-version-min=10.7"
+    "--enable-unicode"
+    "--with-osx_cocoa"
+    "--enable-std_string"
+    "--enable-display"
+    "--with-opengl"
+    "--with-libjpeg"
+    "--with-libtiff"
+    "--without-liblzma"
+    "--with-libpng"
+    "--with-zlib"
+    "--enable-dnd"
+    "--enable-clipboard"
+    "--enable-webkit"
+    "--enable-svg"
+    "--enable-graphics_ctx"
+    "--enable-controls"
+    "--enable-dataviewctrl"
+    "--with-expat"
+    "--disable-precomp-headers"
+    "--disable-mediactrl"
+  ];
+
+  checkPhase = ''
+    ./wx-config --libs
+  '';
+
+  NIX_CFLAGS_COMPILE = "-Wno-undef";
+
+  doCheck = true;
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    platforms = platforms.darwin;
+    license = licenses.wxWindows;
+    maintainers = [ maintainers.lnl7 ];
+    homepage = https://www.wxwidgets.org/;
+    description = "a C++ library that lets developers create applications for Windows, macOS, Linux and other platforms with a single code base";
+    longDescription = "wxWidgets gives you a single, easy-to-use API for writing GUI applications on multiple platforms that still utilize the native platform's controls and utilities. Link with the appropriate library for your platform and compiler, and your application will adopt the look and feel appropriate to that platform. On top of great GUI functionality, wxWidgets gives you: online help, network programming, streams, clipboard and drag and drop, multithreading, image loading and saving in a variety of popular formats, database support, HTML viewing and printing, and much more.";
+    broken = true;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/wxwidgets/3.1/default.nix b/nixpkgs/pkgs/development/libraries/wxwidgets/3.1/default.nix
new file mode 100644
index 000000000000..4b410a307bb4
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/wxwidgets/3.1/default.nix
@@ -0,0 +1,16 @@
+{ stdenv, fetchFromGitHub
+, wxGTK30
+}:
+
+with stdenv.lib;
+
+wxGTK30.overrideAttrs (oldAttrs : rec {
+    name = "wxwidgets-${version}";
+    version = "3.1.0";
+    src = fetchFromGitHub {
+        owner = "wxWidgets";
+        repo = "wxWidgets";
+        rev = "v${version}";
+        sha256 = "14kl1rsngm70v3mbyv1mal15iz2b18k97avjx8jn7s81znha1c7f";
+    };
+})
\ No newline at end of file
diff --git a/nixpkgs/pkgs/development/libraries/x264/default.nix b/nixpkgs/pkgs/development/libraries/x264/default.nix
new file mode 100644
index 000000000000..9998add0d930
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/x264/default.nix
@@ -0,0 +1,37 @@
+{ stdenv, fetchurl, nasm }:
+
+stdenv.mkDerivation rec {
+  pname = "x264";
+  version = "20190517-2245";
+
+  src = fetchurl {
+    url = "https://download.videolan.org/x264/snapshots/x264-snapshot-${version}-stable.tar.bz2";
+    sha256 = "1xv41z04km3rf374xk3ny7v8ibr211ph0j5am0909ln63mphc48f";
+  };
+
+  postPatch = ''
+    patchShebangs .
+  '';
+
+  enableParallelBuilding = true;
+
+  outputs = [ "out" "lib" "dev" ];
+
+  preConfigure = ''
+    # `AS' is set to the binutils assembler, but we need nasm
+    unset AS
+  '';
+
+  configureFlags = [ "--enable-shared" ]
+    ++ stdenv.lib.optional (!stdenv.isi686) "--enable-pic";
+
+  nativeBuildInputs = [ nasm ];
+
+  meta = with stdenv.lib; {
+    description = "Library for encoding H264/AVC video streams";
+    homepage    = http://www.videolan.org/developers/x264.html;
+    license     = licenses.gpl2;
+    platforms   = platforms.unix;
+    maintainers = with maintainers; [ spwhitt tadeokondrak ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/x265/default.nix b/nixpkgs/pkgs/development/libraries/x265/default.nix
new file mode 100644
index 000000000000..398c309d938d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/x265/default.nix
@@ -0,0 +1,74 @@
+{ stdenv, fetchurl, fetchpatch, 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)
+, highbitdepthSupport ? false # false=8bits per channel, true=10/12bits per channel
+, werrorSupport ? false # Warnings as errors
+, ppaSupport ? false # PPA profiling instrumentation
+, vtuneSupport ? false # Vtune profiling instrumentation
+, custatsSupport ? false # Internal profiling of encoder work
+, cliSupport ? true # Build standalone CLI application
+, unittestsSupport ? false # Unit tests
+}:
+
+let
+  mkFlag = optSet: flag: if optSet then "-D${flag}=ON" else "-D${flag}=OFF";
+  inherit (stdenv) is64bit;
+in
+
+stdenv.mkDerivation rec {
+  name = "x265-${version}";
+  version = "3.0";
+
+  src = fetchurl {
+    urls = [
+      "https://get.videolan.org/x265/x265_${version}.tar.gz"
+      "ftp://ftp.videolan.org/pub/videolan/x265/x265_${version}.tar.gz"
+    ];
+    sha256 = "0qh65wdpasrspkm1y0dlfa123myax568yi0sas0lmg5b1hkgrff5";
+  };
+
+  enableParallelBuilding = true;
+
+  patches = [
+    # Fix build on ARM (#406)
+    (fetchpatch {
+      url = "https://bitbucket.org/multicoreware/x265/issues/attachments/406/multicoreware/x265/1527562952.26/406/X265-2.8-asm-primitives.patch";
+      sha256 = "1vf8bpl37gbd9dcbassgkq9i0rp24qm3bl6hx9zv325174bn402v";
+    })
+  ];
+
+  postPatch = ''
+    sed -i 's/unknown/${version}/g' source/cmake/version.cmake
+  '';
+
+  cmakeFlags = [
+    (mkFlag debugSupport "CHECKED_BUILD")
+    "-DSTATIC_LINK_CRT=OFF"
+    (mkFlag (highbitdepthSupport && is64bit) "HIGH_BIT_DEPTH")
+    (mkFlag werrorSupport "WARNINGS_AS_ERRORS")
+    (mkFlag ppaSupport "ENABLE_PPA")
+    (mkFlag vtuneSupport "ENABLE_VTUNE")
+    (mkFlag custatsSupport "DETAILED_CU_STATS")
+    "-DENABLE_SHARED=ON"
+    (mkFlag cliSupport "ENABLE_CLI")
+    (mkFlag unittestsSupport "ENABLE_TESTS")
+  ];
+
+  preConfigure = ''
+    cd source
+  '';
+
+  postInstall = ''
+    rm $out/lib/*.a
+  '';
+
+  nativeBuildInputs = [ cmake nasm ] ++ stdenv.lib.optional numaSupport numactl;
+
+  meta = with stdenv.lib; {
+    description = "Library for encoding h.265/HEVC video streams";
+    homepage    = http://x265.org;
+    license     = licenses.gpl2;
+    maintainers = with maintainers; [ codyopel ];
+    platforms   = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/xalanc/default.nix b/nixpkgs/pkgs/development/libraries/xalanc/default.nix
new file mode 100644
index 000000000000..aeb741dbae7b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/xalanc/default.nix
@@ -0,0 +1,32 @@
+{ stdenv, fetchurl, xercesc, getopt }:
+
+let
+  platform = if stdenv.isLinux then "linux" else
+             if stdenv.isDarwin then "macosx" else
+             throw "Unsupported platform";
+in stdenv.mkDerivation rec {
+  name = "xalan-c-${version}";
+  version = "1.11";
+
+  src = fetchurl {
+    url = "http://www.eu.apache.org/dist/xalan/xalan-c/sources/xalan_c-${version}-src.tar.gz";
+    sha256 = "0a3a2b15vpacnqgpp6fiy1pwyc8q6ywzvyb5445f6wixfdspypjg";
+  };
+
+  configurePhase = ''
+    export XALANCROOT=`pwd`/c
+    cd `pwd`/c
+    mkdir -p $out
+    ./runConfigure -p ${platform} -c cc -x c++ -P$out
+  '';
+
+  buildInputs = [ xercesc getopt ];
+
+  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 ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/xapian/default.nix b/nixpkgs/pkgs/development/libraries/xapian/default.nix
new file mode 100644
index 000000000000..c10dfdaa961c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/xapian/default.nix
@@ -0,0 +1,42 @@
+{ stdenv, fetchurl, autoreconfHook
+, libuuid, zlib }:
+
+let
+  generic = version: sha256: stdenv.mkDerivation rec {
+    name = "xapian-${version}";
+    passthru = { inherit version; };
+
+    src = fetchurl {
+      url = "https://oligarchy.co.uk/xapian/${version}/xapian-core-${version}.tar.xz";
+      inherit sha256;
+    };
+
+    outputs = [ "out" "man" "doc" ];
+
+    buildInputs = [ libuuid zlib ];
+    nativeBuildInputs = [ autoreconfHook ];
+
+    doCheck = true;
+
+    patches = stdenv.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 ''
+      substituteInPlace config.h \
+        --replace "#define HAVE___EXP10 1" "#undef HAVE___EXP10"
+    '';
+
+    meta = with stdenv.lib; {
+      description = "Search engine library";
+      homepage = https://xapian.org/;
+      license = licenses.gpl2Plus;
+      maintainers = with maintainers; [ ];
+      platforms = platforms.unix;
+    };
+  };
+in {
+  # xapian-ruby needs 1.2.22 as of 2017-05-06
+  xapian_1_2_22 = generic "1.2.22" "0zsji22n0s7cdnbgj0kpil05a6bgm5cfv0mvx12d8ydg7z58g6r6";
+  xapian_1_4 = generic "1.4.11" "01xwqljnp5afjf9097lyfbqc6x5bcqszfdkn9l1j86imwbrv45lz";
+}
diff --git a/nixpkgs/pkgs/development/libraries/xapian/skip-flaky-darwin-test.patch b/nixpkgs/pkgs/development/libraries/xapian/skip-flaky-darwin-test.patch
new file mode 100644
index 000000000000..72a7c3e721f4
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/xapian/skip-flaky-darwin-test.patch
@@ -0,0 +1,33 @@
+diff -Naur xapian-core.old/tests/api_db.cc xapian-core.new/tests/api_db.cc
+--- xapian-core.old/tests/api_db.cc
++++ xapian-core.new/tests/api_db.cc
+@@ -998,6 +998,7 @@
+ 
+ // test for keepalives
+ DEFINE_TESTCASE(keepalive1, remote) {
++    SKIP_TEST("Fails in darwin nix build environment");
+     Xapian::Database db(get_remote_database("apitest_simpledata", 5000));
+ 
+     /* Test that keep-alives work */
+diff -Naur xapian-core.old/tests/api_scalability.cc xapian-core.new/tests/api_scalability.cc
+--- xapian-core.old/tests/api_scalability.cc
++++ xapian-core.new/tests/api_scalability.cc
+@@ -53,6 +53,7 @@
+ }
+ 
+ DEFINE_TESTCASE(bigoaddvalue1, writable) {
++    SKIP_TEST("Fails in darwin nix build environment");
+     // O(n*n) is bad, but O(n*log(n)) is acceptable.
+     test_scalability(bigoaddvalue1_helper, 5000, O_N_LOG_N);
+     return true;
+diff -Naur xapian-core.old/tests/api_serialise.cc xapian-core.new/tests/api_serialise.cc
+--- xapian-core.old/tests/api_serialise.cc
++++ xapian-core.new/tests/api_serialise.cc
+@@ -110,6 +110,7 @@
+ 
+ // Test for serialising a document obtained from a database.
+ DEFINE_TESTCASE(serialise_document2, writable) {
++    SKIP_TEST("Fails in darwin nix build environment");
+     Xapian::Document origdoc;
+     origdoc.add_term("foo", 2);
+     origdoc.add_posting("foo", 10);
diff --git a/nixpkgs/pkgs/development/libraries/xapian/tools/omega/default.nix b/nixpkgs/pkgs/development/libraries/xapian/tools/omega/default.nix
new file mode 100644
index 000000000000..1203f19d6c82
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/xapian/tools/omega/default.nix
@@ -0,0 +1,21 @@
+{ stdenv, fetchurl, pkgconfig, xapian, perl, pcre, zlib, libmagic }:
+
+stdenv.mkDerivation rec {
+  name = "xapian-omega-${version}";
+  inherit (xapian) version;
+
+  src = fetchurl {
+    url = "https://oligarchy.co.uk/xapian/${version}/xapian-omega-${version}.tar.xz";
+    sha256 = "0zji8ckp4h5xdy2wbir3lvk680w1g1l4h5swmaxsx7ah12lkrjcr";
+  };
+
+  buildInputs = [ xapian perl pcre zlib libmagic ];
+  nativeBuildInputs = [ pkgconfig ];
+
+  meta = with stdenv.lib; {
+    description = "Indexer and CGI search front-end built on Xapian library";
+    homepage = https://xapian.org/;
+    license = licenses.gpl2Plus;
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/xavs/default.nix b/nixpkgs/pkgs/development/libraries/xavs/default.nix
new file mode 100644
index 000000000000..31c31164e010
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/xavs/default.nix
@@ -0,0 +1,48 @@
+{ stdenv, fetchsvn }:
+
+stdenv.mkDerivation rec {
+  name = "xavs-${version}";
+  version = "55";
+
+  src = fetchsvn {
+    url = "https://svn.code.sf.net/p/xavs/code/trunk";
+    rev = "${version}";
+    sha256 = "0drw16wm95dqszpl7j33y4gckz0w0107lnz6wkzb66f0dlbv48cf";
+  };
+
+  enableParallelBuilding = true;
+
+  patchPhase = ''
+    patchShebangs configure
+    patchShebangs config.sub
+    patchShebangs version.sh
+    patchShebangs tools/countquant_xavs.pl
+    patchShebangs tools/patcheck
+    patchShebangs tools/regression-test.pl
+    patchShebangs tools/xavs-format
+    '' + stdenv.lib.optionalString stdenv.isDarwin ''
+    substituteInPlace config.guess --replace 'uname -p' 'uname -m'
+    substituteInPlace configure \
+      --replace '-O4' '-O3' \
+      --replace ' -s ' ' ' \
+      --replace 'LDFLAGS -s' 'LDFLAGS' \
+      --replace '-dynamiclib' ' ' \
+      --replace '-falign-loops=16' ' '
+    substituteInPlace Makefile --replace '-Wl,-soname,' ' '
+    '';
+
+  configureFlags = [
+    "--enable-pic"
+    "--enable-shared"
+    # Bug preventing compilation with assembly enabled
+    "--disable-asm"
+  ];
+
+  meta = with stdenv.lib; {
+    description = "AVS encoder and decoder";
+    homepage    = http://xavs.sourceforge.net/;
+    license     = licenses.lgpl2;
+    platforms   = platforms.linux ++ platforms.darwin;
+    maintainers = with maintainers; [ codyopel ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/xbase/default.nix b/nixpkgs/pkgs/development/libraries/xbase/default.nix
new file mode 100644
index 000000000000..3dd2cb5b874c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/xbase/default.nix
@@ -0,0 +1,34 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation {
+  name = "xbase-3.1.2";
+
+  src = fetchurl {
+    url = mirror://sourceforge/xdb/xbase64-3.1.2.tar.gz;
+    sha256 = "17287kz1nmmm64y7zp9nhhl7slzlba09h6cc83w4mvsqwd9w882r";
+  };
+
+  prePatch = "find . -type f -not -name configure -print0 | xargs -0 chmod -x";
+  patches = [
+    ./xbase-fixes.patch
+    (fetchurl {
+      url = "http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/dev-db/xbase/files/xbase-3.1.2-gcc47.patch?revision=1.1";
+      sha256 = "1kpcrkkcqdwl609yd0qxlvp743icz3vni13993sz6fkgn5lah8yl";
+    })
+    (fetchurl {
+      url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/dev-db/xbase/files/xbase-3.1.2-gcc6.patch";
+      sha256 = "1994pqiip5njkcmm5czb1bg6zdldkx1mpandgmvzqrja0iacf953";
+    })
+    (fetchurl {
+      url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/dev-db/xbase/files/xbase-3.1.2-gcc7.patch";
+      sha256 = "1304gn9dbdv8xf61crkg0fc8cal0h4qkyhlbqa8y618w134cxh1q";
+    })
+  ];
+
+  meta = with stdenv.lib; {
+    homepage = http://linux.techass.com/projects/xdb/;
+    description = "C++ class library formerly known as XDB";
+    platforms = platforms.linux;
+    license = licenses.lgpl2;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/xbase/xbase-fixes.patch b/nixpkgs/pkgs/development/libraries/xbase/xbase-fixes.patch
new file mode 100644
index 000000000000..a23658049b98
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/xbase/xbase-fixes.patch
@@ -0,0 +1,34 @@
+diff --git a/xbase64/xbase64.cpp b/xbase64/xbase64.cpp
+index fc5613d..2449535 100644
+--- a/xbase64/xbase64.cpp
++++ b/xbase64/xbase64.cpp
+@@ -51,6 +51,7 @@
+ #include <xbase64/xbase64.h>
+ #include <ctype.h>
+ #include <string.h>
++#include <cerrno>
+ 
+ //#include <xbase64/xbexcept.h>
+ 
+diff --git a/xbase64/xblock.cpp b/xbase64/xblock.cpp
+index c44cbb9..3554fc1 100644
+--- a/xbase64/xblock.cpp
++++ b/xbase64/xblock.cpp
+@@ -53,6 +53,7 @@
+ #endif
+ 
+ #include <xbase64/xbase64.h>
++#include <cerrno>
+ 
+ #ifdef HAVE_IO_H     // windows locking
+ #include <io.h>
+diff --git a/xbase64/xbnode.cpp b/xbase64/xbnode.cpp
+index 5e688c1..3c652b3 100644
+--- a/xbase64/xbnode.cpp
++++ b/xbase64/xbnode.cpp
+@@ -1,4 +1,4 @@
+-#include "xbNode.h"

++#include "xbnode.h"

+ 

+ void xbNodeLink::AddNode(xbNodeLink* node)

+ {

diff --git a/nixpkgs/pkgs/development/libraries/xcb-util-cursor/HEAD.nix b/nixpkgs/pkgs/development/libraries/xcb-util-cursor/HEAD.nix
new file mode 100644
index 000000000000..e343c301127f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/xcb-util-cursor/HEAD.nix
@@ -0,0 +1,42 @@
+{ stdenv, fetchgit, autoconf, automake, libtool, pkgconfig
+, xorg, gnum4, libxcb, gperf }:
+
+stdenv.mkDerivation rec {
+  name = "xcb-util-cursor-0.1.1-3-unstable-${version}";
+  version = "2017-04-05";
+
+  src = fetchgit {
+    url    = http://anongit.freedesktop.org/git/xcb/util-cursor.git;
+    rev    = "f03cc278c6cce0cf721adf9c3764d3c5fba63392";
+    sha256 = "127zfmihd8nqlj8jjaja06xb84xdgl263w0av1xnprx05mkbkcyc";
+  };
+
+  meta = with stdenv.lib; {
+    description = "XCB cursor library (libxcursor port)";
+    homepage    = https://cgit.freedesktop.org/xcb/util-cursor;
+    license     = licenses.mit;
+    maintainers = with maintainers; [ lovek323 ];
+    platforms   = platforms.linux ++ platforms.darwin;
+  };
+
+  outputs = [ "out" "dev" ];
+
+  buildInputs = [
+    autoconf
+    automake
+    gnum4
+    gperf
+    libtool
+    libxcb
+    pkgconfig
+    xorg.utilmacros
+    xorg.xcbutilimage
+    xorg.xcbutilrenderutil
+  ];
+
+  configurePhase = ''
+    sed -i '15 i\
+      LT_INIT' configure.ac
+    ${stdenv.shell} autogen.sh --prefix="$out"
+  '';
+}
diff --git a/nixpkgs/pkgs/development/libraries/xcb-util-cursor/m4/ax_compare_version.m4 b/nixpkgs/pkgs/development/libraries/xcb-util-cursor/m4/ax_compare_version.m4
new file mode 100644
index 000000000000..e22b50fd9fdc
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/xcb-util-cursor/m4/ax_compare_version.m4
@@ -0,0 +1,174 @@
+# ===========================================================================
+#           http://autoconf-archive.cryp.to/ax_compare_version.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_COMPARE_VERSION(VERSION_A, OP, VERSION_B, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
+#
+# DESCRIPTION
+#
+#   This macro compares two version strings. Due to the various number of
+#   minor-version numbers that can exist, and the fact that string
+#   comparisons are not compatible with numeric comparisons, this is not
+#   necessarily trivial to do in a autoconf script. This macro makes doing
+#   these comparisons easy.
+#
+#   The six basic comparisons are available, as well as checking equality
+#   limited to a certain number of minor-version levels.
+#
+#   The operator OP determines what type of comparison to do, and can be one
+#   of:
+#
+#    eq  - equal (test A == B)
+#    ne  - not equal (test A != B)
+#    le  - less than or equal (test A <= B)
+#    ge  - greater than or equal (test A >= B)
+#    lt  - less than (test A < B)
+#    gt  - greater than (test A > B)
+#
+#   Additionally, the eq and ne operator can have a number after it to limit
+#   the test to that number of minor versions.
+#
+#    eq0 - equal up to the length of the shorter version
+#    ne0 - not equal up to the length of the shorter version
+#    eqN - equal up to N sub-version levels
+#    neN - not equal up to N sub-version levels
+#
+#   When the condition is true, shell commands ACTION-IF-TRUE are run,
+#   otherwise shell commands ACTION-IF-FALSE are run. The environment
+#   variable 'ax_compare_version' is always set to either 'true' or 'false'
+#   as well.
+#
+#   Examples:
+#
+#     AX_COMPARE_VERSION([3.15.7],[lt],[3.15.8])
+#     AX_COMPARE_VERSION([3.15],[lt],[3.15.8])
+#
+#   would both be true.
+#
+#     AX_COMPARE_VERSION([3.15.7],[eq],[3.15.8])
+#     AX_COMPARE_VERSION([3.15],[gt],[3.15.8])
+#
+#   would both be false.
+#
+#     AX_COMPARE_VERSION([3.15.7],[eq2],[3.15.8])
+#
+#   would be true because it is only comparing two minor versions.
+#
+#     AX_COMPARE_VERSION([3.15.7],[eq0],[3.15])
+#
+#   would be true because it is only comparing the lesser number of minor
+#   versions of the two values.
+#
+#   Note: The characters that separate the version numbers do not matter. An
+#   empty string is the same as version 0. OP is evaluated by autoconf, not
+#   configure, so must be a string, not a variable.
+#
+#   The author would like to acknowledge Guido Draheim whose advice about
+#   the m4_case and m4_ifvaln functions make this macro only include the
+#   portions necessary to perform the specific comparison specified by the
+#   OP argument in the final configure script.
+#
+# LICENSE
+#
+#   Copyright (c) 2008 Tim Toolan <toolan@ele.uri.edu>
+#
+#   Copying and distribution of this file, with or without modification, are
+#   permitted in any medium without royalty provided the copyright notice
+#   and this notice are preserved.
+
+dnl #########################################################################
+AC_DEFUN([AX_COMPARE_VERSION], [
+  AC_PROG_AWK
+
+  # Used to indicate true or false condition
+  ax_compare_version=false
+
+  # Convert the two version strings to be compared into a format that
+  # allows a simple string comparison.  The end result is that a version
+  # string of the form 1.12.5-r617 will be converted to the form
+  # 0001001200050617.  In other words, each number is zero padded to four
+  # digits, and non digits are removed.
+  AS_VAR_PUSHDEF([A],[ax_compare_version_A])
+  A=`echo "$1" | sed -e 's/\([[0-9]]*\)/Z\1Z/g' \
+                     -e 's/Z\([[0-9]]\)Z/Z0\1Z/g' \
+                     -e 's/Z\([[0-9]][[0-9]]\)Z/Z0\1Z/g' \
+                     -e 's/Z\([[0-9]][[0-9]][[0-9]]\)Z/Z0\1Z/g' \
+                     -e 's/[[^0-9]]//g'`
+
+  AS_VAR_PUSHDEF([B],[ax_compare_version_B])
+  B=`echo "$3" | sed -e 's/\([[0-9]]*\)/Z\1Z/g' \
+                     -e 's/Z\([[0-9]]\)Z/Z0\1Z/g' \
+                     -e 's/Z\([[0-9]][[0-9]]\)Z/Z0\1Z/g' \
+                     -e 's/Z\([[0-9]][[0-9]][[0-9]]\)Z/Z0\1Z/g' \
+                     -e 's/[[^0-9]]//g'`
+
+  dnl # In the case of le, ge, lt, and gt, the strings are sorted as necessary
+  dnl # then the first line is used to determine if the condition is true.
+  dnl # The sed right after the echo is to remove any indented white space.
+  m4_case(m4_tolower($2),
+  [lt],[
+    ax_compare_version=`echo "x$A
+x$B" | sed 's/^ *//' | sort -r | sed "s/x${A}/false/;s/x${B}/true/;1q"`
+  ],
+  [gt],[
+    ax_compare_version=`echo "x$A
+x$B" | sed 's/^ *//' | sort | sed "s/x${A}/false/;s/x${B}/true/;1q"`
+  ],
+  [le],[
+    ax_compare_version=`echo "x$A
+x$B" | sed 's/^ *//' | sort | sed "s/x${A}/true/;s/x${B}/false/;1q"`
+  ],
+  [ge],[
+    ax_compare_version=`echo "x$A
+x$B" | sed 's/^ *//' | sort -r | sed "s/x${A}/true/;s/x${B}/false/;1q"`
+  ],[
+    dnl Split the operator from the subversion count if present.
+    m4_bmatch(m4_substr($2,2),
+    [0],[
+      # A count of zero means use the length of the shorter version.
+      # Determine the number of characters in A and B.
+      ax_compare_version_len_A=`echo "$A" | $AWK '{print(length)}'`
+      ax_compare_version_len_B=`echo "$B" | $AWK '{print(length)}'`
+
+      # Set A to no more than B's length and B to no more than A's length.
+      A=`echo "$A" | sed "s/\(.\{$ax_compare_version_len_B\}\).*/\1/"`
+      B=`echo "$B" | sed "s/\(.\{$ax_compare_version_len_A\}\).*/\1/"`
+    ],
+    [[0-9]+],[
+      # A count greater than zero means use only that many subversions
+      A=`echo "$A" | sed "s/\(\([[0-9]]\{4\}\)\{m4_substr($2,2)\}\).*/\1/"`
+      B=`echo "$B" | sed "s/\(\([[0-9]]\{4\}\)\{m4_substr($2,2)\}\).*/\1/"`
+    ],
+    [.+],[
+      AC_WARNING(
+        [illegal OP numeric parameter: $2])
+    ],[])
+
+    # Pad zeros at end of numbers to make same length.
+    ax_compare_version_tmp_A="$A`echo $B | sed 's/./0/g'`"
+    B="$B`echo $A | sed 's/./0/g'`"
+    A="$ax_compare_version_tmp_A"
+
+    # Check for equality or inequality as necessary.
+    m4_case(m4_tolower(m4_substr($2,0,2)),
+    [eq],[
+      test "x$A" = "x$B" && ax_compare_version=true
+    ],
+    [ne],[
+      test "x$A" != "x$B" && ax_compare_version=true
+    ],[
+      AC_WARNING([illegal OP parameter: $2])
+    ])
+  ])
+
+  AS_VAR_POPDEF([A])dnl
+  AS_VAR_POPDEF([B])dnl
+
+  dnl # Execute ACTION-IF-TRUE / ACTION-IF-FALSE.
+  if test "$ax_compare_version" = "true" ; then
+    m4_ifvaln([$4],[$4],[:])dnl
+    m4_ifvaln([$5],[else $5])dnl
+  fi
+]) dnl AX_COMPARE_VERSION
diff --git a/nixpkgs/pkgs/development/libraries/xcb-util-cursor/m4/xcb_util_common.m4 b/nixpkgs/pkgs/development/libraries/xcb-util-cursor/m4/xcb_util_common.m4
new file mode 100644
index 000000000000..f9463d37fcaa
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/xcb-util-cursor/m4/xcb_util_common.m4
@@ -0,0 +1,44 @@
+# XCB_UTIL_COMMON(xcb-required-version, xcb-proto-required-version)
+# -----------------------------------------------------------------
+#
+# Defines default options for xcb-util libraries.  xorg/util/macros >=
+# 1.6.0 is  required for  cross-platform compiler  flags and  to build
+# library documentation.
+#
+AC_DEFUN([XCB_UTIL_COMMON], [
+m4_ifndef([AX_COMPARE_VERSION],
+          [m4_fatal([could not find AX_COMPARE_VERSION in macros search path])])
+
+AC_REQUIRE([AC_PROG_LIBTOOL])
+
+# Define header files and pkgconfig paths
+xcbincludedir='${includedir}/xcb'
+AC_SUBST(xcbincludedir)
+pkgconfigdir='${libdir}/pkgconfig'
+AC_SUBST(pkgconfigdir)
+
+# Check xcb version
+PKG_CHECK_MODULES(XCB, xcb >= [$1])
+
+# Check version of xcb-proto that xcb was compiled against
+xcbproto_required=[$2]
+
+AC_MSG_CHECKING([whether libxcb was compiled against xcb-proto >= $xcbproto_required])
+xcbproto_version=`$PKG_CONFIG --variable=xcbproto_version xcb`
+AX_COMPARE_VERSION([$xcbproto_version],[ge],[$xcbproto_required], xcbproto_ok="yes",
+                   xcbproto_ok="no")
+AC_MSG_RESULT([$xcbproto_ok])
+
+if test $xcbproto_ok = no; then
+   AC_MSG_ERROR([libxcb was compiled against xcb-proto $xcbproto_version; it needs to be compiled against version $xcbproto_required or higher])
+fi
+
+# Call macros from Xorg util-macros
+m4_ifndef([XORG_MACROS_VERSION],
+          [m4_fatal([must install xorg-macros 1.6.0 or later before running autoconf/autogen])])
+
+XORG_MACROS_VERSION([1.6.0])
+XORG_DEFAULT_OPTIONS
+XORG_ENABLE_DEVEL_DOCS
+XORG_WITH_DOXYGEN
+]) # XCB_UTIL_COMMON
diff --git a/nixpkgs/pkgs/development/libraries/xcb-util-cursor/m4/xcb_util_m4_with_include_path.m4 b/nixpkgs/pkgs/development/libraries/xcb-util-cursor/m4/xcb_util_m4_with_include_path.m4
new file mode 100644
index 000000000000..a3ddce4a706f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/xcb-util-cursor/m4/xcb_util_m4_with_include_path.m4
@@ -0,0 +1,24 @@
+# XCB_UTIL_M4_WITH_INCLUDE_PATH
+# ------------------------------
+#
+# This macro attempts to locate an m4 macro processor which supports
+# -I option and is only useful for modules relying on M4 in order to
+# expand macros in source code files.
+#
+# M4: variable holding the path to an usable m4 program.
+#
+# This macro  requires Autoconf 2.62  or later  as it is  relying upon
+# AC_PATH_PROGS_FEATURE_CHECK  macro. NOTE:  As  soon  as the  minimum
+# required version of Autoconf for Xorg  is bumped to 2.62, this macro
+# is supposed to be shipped with xorg/util/macros.
+#
+AC_DEFUN([XCB_UTIL_M4_WITH_INCLUDE_PATH], [
+AC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
+   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
+       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
+         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
+   [AC_MSG_ERROR([could not find m4 that supports -I option])],
+   [$PATH:/usr/gnu/bin])])
+
+AC_SUBST([M4], [$ac_cv_path_M4])
+]) # XCB_UTIL_M4_WITH_INCLUDE_PATH
diff --git a/nixpkgs/pkgs/development/libraries/xdg-dbus-proxy/default.nix b/nixpkgs/pkgs/development/libraries/xdg-dbus-proxy/default.nix
new file mode 100644
index 000000000000..d1605aac3342
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/xdg-dbus-proxy/default.nix
@@ -0,0 +1,30 @@
+{ stdenv, fetchurl, pkgconfig, libxslt, docbook_xsl, docbook_xml_dtd_43, dbus, glib }:
+
+stdenv.mkDerivation rec {
+  pname = "xdg-dbus-proxy";
+  version = "0.1.1";
+
+  src = fetchurl {
+    url = "https://github.com/flatpak/xdg-dbus-proxy/releases/download/${version}/${pname}-${version}.tar.xz";
+    sha256 = "1w8yg5j51zsr9d97d4jjp9dvd7iq893p2xk54i6lf3lx01ribdqh";
+  };
+
+  nativeBuildInputs = [ pkgconfig libxslt docbook_xsl docbook_xml_dtd_43 ];
+  buildInputs = [ glib ];
+  checkInputs = [ dbus ];
+
+  configureFlags = [
+    "--enable-man"
+  ];
+
+  # 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; {
+    description = "DBus proxy for Flatpak and others";
+    homepage = https://flatpak.org/;
+    license = licenses.lgpl21Plus;
+    maintainers = with maintainers; [ jtojnar ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/xdg-desktop-portal-gtk/default.nix b/nixpkgs/pkgs/development/libraries/xdg-desktop-portal-gtk/default.nix
new file mode 100644
index 000000000000..780b7d630cb7
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/xdg-desktop-portal-gtk/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchFromGitHub, autoreconfHook, pkgconfig, libxml2, xdg-desktop-portal, gtk3, glib, wrapGAppsHook, gnome3, gsettings-desktop-schemas }:
+
+stdenv.mkDerivation rec {
+  pname = "xdg-desktop-portal-gtk";
+  version = "1.2.0";
+
+  src = fetchFromGitHub {
+    owner = "flatpak";
+    repo = pname;
+    rev = version;
+    sha256 = "1vgnsahljzrjcdjzv1dxhp2rf709pnf8595an82llnylwa8rdp1j";
+  };
+
+  nativeBuildInputs = [ autoreconfHook pkgconfig libxml2 xdg-desktop-portal wrapGAppsHook ];
+  buildInputs = [ glib gtk3 gsettings-desktop-schemas ];
+
+  meta = with stdenv.lib; {
+    description = "Desktop integration portals for sandboxed apps";
+    maintainers = with maintainers; [ jtojnar ];
+    platforms = platforms.linux;
+    license = licenses.lgpl21;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/xdg-desktop-portal/default.nix b/nixpkgs/pkgs/development/libraries/xdg-desktop-portal/default.nix
new file mode 100644
index 000000000000..3f02946c7704
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/xdg-desktop-portal/default.nix
@@ -0,0 +1,44 @@
+{ stdenv, fetchFromGitHub, substituteAll, autoreconfHook, pkgconfig, libxml2, glib, pipewire, fontconfig, flatpak, gsettings-desktop-schemas, acl, dbus, fuse, geoclue2, wrapGAppsHook }:
+
+stdenv.mkDerivation rec {
+  pname = "xdg-desktop-portal";
+  version = "1.2.0";
+
+  outputs = [ "out" "installedTests" ];
+
+  src = fetchFromGitHub {
+    owner = "flatpak";
+    repo = pname;
+    rev = version;
+    sha256 = "1gjyif4gly0mkdx6ir6wc4vhfh1raah9jq03q28i88hr7phjdy71";
+  };
+
+  patches = [
+    ./respect-path-env-var.patch
+    (substituteAll {
+      src = ./fix-paths.patch;
+      inherit flatpak;
+    })
+  ];
+
+  nativeBuildInputs = [ autoreconfHook pkgconfig libxml2 wrapGAppsHook ];
+  buildInputs = [ glib pipewire fontconfig flatpak acl dbus geoclue2 fuse gsettings-desktop-schemas ];
+
+  doCheck = true; # XXX: investigate!
+
+  configureFlags = [
+    "--enable-installed-tests"
+  ];
+
+  makeFlags = [
+    "installed_testdir=$(installedTests)/libexec/installed-tests/xdg-desktop-portal"
+    "installed_test_metadir=$(installedTests)/share/installed-tests/xdg-desktop-portal"
+  ];
+
+  meta = with stdenv.lib; {
+    description = "Desktop integration portals for sandboxed apps";
+    license = licenses.lgpl21;
+    maintainers = with maintainers; [ jtojnar ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/xdg-desktop-portal/fix-paths.patch b/nixpkgs/pkgs/development/libraries/xdg-desktop-portal/fix-paths.patch
new file mode 100644
index 000000000000..f4b103eb38b1
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/xdg-desktop-portal/fix-paths.patch
@@ -0,0 +1,13 @@
+diff --git a/src/notification.c b/src/notification.c
+index 1367114..72ba033 100644
+--- a/src/notification.c
++++ b/src/notification.c
+@@ -401,7 +401,7 @@ validate_icon_more (GVariant *v)
+   int status;
+   g_autofree char *err = NULL;
+   g_autoptr(GError) error = NULL;
+-  const char *icon_validator = LIBEXECDIR "/flatpak-validate-icon";
++  const char *icon_validator = "@flatpak@/libexec/flatpak-validate-icon";
+   const char *args[6];
+
+   if (G_IS_THEMED_ICON (icon))
diff --git a/nixpkgs/pkgs/development/libraries/xdg-desktop-portal/respect-path-env-var.patch b/nixpkgs/pkgs/development/libraries/xdg-desktop-portal/respect-path-env-var.patch
new file mode 100644
index 000000000000..f884899ecd19
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/xdg-desktop-portal/respect-path-env-var.patch
@@ -0,0 +1,76 @@
+--- a/src/xdg-desktop-portal.c
++++ b/src/xdg-desktop-portal.c
+@@ -177,38 +177,50 @@
+ static void
+ load_installed_portals (void)
+ {
+-  const char *portal_dir = PKGDATADIR "/portals";
+-  g_autoptr(GFile) dir = g_file_new_for_path (portal_dir);
+-  g_autoptr(GFileEnumerator) enumerator = NULL;
+ 
+-  enumerator = g_file_enumerate_children (dir, "*", G_FILE_QUERY_INFO_NONE, NULL, NULL);
++  g_auto(GStrv) portal_dir_list;
++  int i;
++  const char *portal_dir = g_getenv ("XDG_DESKTOP_PORTAL_PATH");
++
++  if (portal_dir == NULL)
++    portal_dir = PKGDATADIR "/portals";
+ 
+-  if (enumerator == NULL)
+-    return;
++  portal_dir_list = g_strsplit (portal_dir, G_SEARCHPATH_SEPARATOR_S, 0);
+ 
+-  while (TRUE)
++  for (i = 0; portal_dir_list[i] != NULL; i++)
+     {
+-      g_autoptr(GFileInfo) info = g_file_enumerator_next_file (enumerator, NULL, NULL);
+-      g_autoptr(GFile) child = NULL;
+-      g_autofree char *path = NULL;
+-      const char *name;
+-      g_autoptr(GError) error = NULL;
++      portal_dir = portal_dir_list[i];
++      g_autoptr(GFile) dir = g_file_new_for_path (portal_dir);
++      g_autoptr(GFileEnumerator) enumerator = NULL;
++      enumerator = g_file_enumerate_children (dir, "*", G_FILE_QUERY_INFO_NONE, NULL, NULL);
+ 
+-      if (info == NULL)
+-        break;
++      if (enumerator == NULL)
++        continue;
+ 
+-      name = g_file_info_get_name (info);
++      while (TRUE)
++        {
++          g_autoptr(GFileInfo) info = g_file_enumerator_next_file (enumerator, NULL, NULL);
++          g_autoptr(GFile) child = NULL;
++          g_autofree char *path = NULL;
++          const char *name;
++          g_autoptr(GError) error = NULL;
+ 
+-      if (!g_str_has_suffix (name, ".portal"))
+-        continue;
++          if (info == NULL)
++            break;
+ 
+-      child = g_file_enumerator_get_child (enumerator, info);
+-      path = g_file_get_path (child);
++          name = g_file_info_get_name (info);
+ 
+-      if (!register_portal (path, &error))
+-        {
+-          g_warning ("Error loading %s: %s", path, error->message);
+-          continue;
++          if (!g_str_has_suffix (name, ".portal"))
++            continue;
++
++          child = g_file_enumerator_get_child (enumerator, info);
++          path = g_file_get_path (child);
++
++          if (!register_portal (path, &error))
++            {
++              g_warning ("Error loading %s: %s", path, error->message);
++              continue;
++            }
+         }
+     }
+ 
diff --git a/nixpkgs/pkgs/development/libraries/xercesc/default.nix b/nixpkgs/pkgs/development/libraries/xercesc/default.nix
new file mode 100644
index 000000000000..8ad4e6d6a8a6
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/xercesc/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "xerces-c-${version}";
+  version = "3.2.2";
+
+  src = fetchurl {
+    url = "mirror://apache/xerces/c/3/sources/${name}.tar.gz";
+    sha256 = "04q4c460wqzyzmprjm22igcm1d52xr20ajxnhr33nv95mbw92qfx";
+  };
+
+  # Disable SSE2 extensions on platforms for which they are not enabled by default
+  configureFlags = [ "--disable-sse2" ];
+  enableParallelBuilding = true;
+
+  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;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/xgboost/default.nix b/nixpkgs/pkgs/development/libraries/xgboost/default.nix
new file mode 100644
index 000000000000..37e55afc4e9f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/xgboost/default.nix
@@ -0,0 +1,46 @@
+{ config, stdenv, lib, fetchgit, cmake
+, cudaSupport ? config.cudaSupport or false, cudatoolkit
+, ncclSupport ? false, nccl
+, llvmPackages
+}:
+
+assert ncclSupport -> cudaSupport;
+
+stdenv.mkDerivation rec {
+  name = "xgboost-${version}";
+  version = "0.90";
+
+  # needs submodules
+  src = fetchgit {
+    url = "https://github.com/dmlc/xgboost";
+    rev = "refs/tags/v${version}";
+    sha256 = "1zs15k9crkiq7bnr4gqq53mkn3w8z9dq4nwlavmfcr5xr5gw2pw4";
+  };
+
+  enableParallelBuilding = true;
+
+  nativeBuildInputs = [ cmake ] ++ lib.optional stdenv.isDarwin llvmPackages.openmp;
+
+  buildInputs = lib.optional cudaSupport cudatoolkit
+                ++ lib.optional ncclSupport nccl;
+
+  cmakeFlags = lib.optionals cudaSupport [ "-DUSE_CUDA=ON" "-DCUDA_HOST_COMPILER=${cudatoolkit.cc}/bin/cc" ]
+               ++ lib.optional ncclSupport "-DUSE_NCCL=ON";
+
+  installPhase = let
+    libname = if stdenv.isDarwin then "libxgboost.dylib" else "libxgboost.so";
+  in ''
+    mkdir -p $out
+    cp -r ../include $out
+    install -Dm755 ../lib/${libname} $out/lib/${libname}
+    install -Dm755 ../xgboost $out/bin/xgboost
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Scalable, Portable and Distributed Gradient Boosting (GBDT, GBRT or GBM) Library";
+    homepage = https://github.com/dmlc/xgboost;
+    license = licenses.asl20;
+    platforms = [ "x86_64-linux" "i686-linux" "x86_64-darwin" ];
+    maintainers = with maintainers; [ abbradar ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/xine-lib/default.nix b/nixpkgs/pkgs/development/libraries/xine-lib/default.nix
new file mode 100644
index 000000000000..d86dac050731
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/xine-lib/default.nix
@@ -0,0 +1,35 @@
+{ stdenv, fetchurl, pkgconfig, xorg, alsaLib, libGLU_combined, aalib
+, libvorbis, libtheora, speex, zlib, perl, ffmpeg
+, flac, libcaca, libpulseaudio, libmng, libcdio, libv4l, vcdimager
+, libmpcdec
+}:
+
+stdenv.mkDerivation rec {
+  name = "xine-lib-1.2.9";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/xine/${name}.tar.xz";
+    sha256 = "13clir4qxl2zvsvvjd9yv3yrdhsnvcn5s7ambbbn5dzy9604xcrj";
+  };
+
+  nativeBuildInputs = [ pkgconfig perl ];
+
+  buildInputs = [
+    xorg.libX11 xorg.libXv xorg.libXinerama xorg.libxcb xorg.libXext
+    alsaLib libGLU_combined aalib libvorbis libtheora speex perl ffmpeg flac
+    libcaca libpulseaudio libmng libcdio libv4l vcdimager libmpcdec
+  ];
+
+  NIX_LDFLAGS = "-lxcb-shm";
+
+  propagatedBuildInputs = [zlib];
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    homepage = http://www.xine-project.org/;
+    description = "A high-performance, portable and reusable multimedia playback engine";
+    platforms = platforms.linux;
+    license = with licenses; [ gpl2 lgpl2 ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/xlibs-wrapper/default.nix b/nixpkgs/pkgs/development/libraries/xlibs-wrapper/default.nix
new file mode 100644
index 000000000000..049c54d792b4
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/xlibs-wrapper/default.nix
@@ -0,0 +1,21 @@
+{stdenv, packages}:
+
+stdenv.mkDerivation {
+  name = "xlibs-wrapper";
+
+  dontBuild = true;
+
+  installPhase = "mkdir -p $out";
+  unpackPhase = "sourceRoot=.";
+
+  propagatedBuildInputs = packages;
+
+  preferLocalBuild = true;
+} // {
+  # For compatability with XFree86.
+  buildClientLibs = true;
+
+  meta = {
+    platforms = stdenv.lib.platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/xlslib/default.nix b/nixpkgs/pkgs/development/libraries/xlslib/default.nix
new file mode 100644
index 000000000000..718554b20a48
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/xlslib/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchurl, autoreconfHook, unzip }:
+
+stdenv.mkDerivation rec {
+  name = "xlslib-${version}";
+  version = "2.5.0";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/xlslib/xlslib-package-${version}.zip";
+    sha256 = "1wx3jbpkz2rvgs45x6mwawamd1b2llb0vn29b5sr0rfxzx9d1985";
+  };
+
+  nativeBuildInputs = [ unzip autoreconfHook ];
+
+  setSourceRoot = "export sourceRoot=xlslib/xlslib";
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    description = "C++/C library to construct Excel .xls files in code";
+    homepage = https://sourceforge.net/projects/xlslib/;
+    license = licenses.bsd2;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ abbradar ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/xml-security-c/cxx11.patch b/nixpkgs/pkgs/development/libraries/xml-security-c/cxx11.patch
new file mode 100644
index 000000000000..bc87d4c1411e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/xml-security-c/cxx11.patch
@@ -0,0 +1,11 @@
+--- xml-security-c-1.6.1/xsec/tools/checksig/InteropResolver.cpp.orig	2016-02-02 23:57:26.204655144 +0000
++++ xml-security-c-1.6.1/xsec/tools/checksig/InteropResolver.cpp	2016-02-02 23:57:35.796692305 +0000
+@@ -645,7 +645,7 @@
+ 
+ 	}
+ 
+-	return false;
++	return NULL;
+ 
+ }
+ 
diff --git a/nixpkgs/pkgs/development/libraries/xml-security-c/default.nix b/nixpkgs/pkgs/development/libraries/xml-security-c/default.nix
new file mode 100644
index 000000000000..fec4bbe8efe2
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/xml-security-c/default.nix
@@ -0,0 +1,36 @@
+{ stdenv, fetchurl, xalanc, xercesc, openssl, pkgconfig }:
+
+stdenv.mkDerivation rec {
+  name = "xml-security-c-${version}";
+  version = "1.7.3";
+
+  src = fetchurl {
+    url = "https://www.apache.org/dist/santuario/c-library/${name}.tar.gz";
+    sha256 = "e5226e7319d44f6fd9147a13fb853f5c711b9e75bf60ec273a0ef8a190592583";
+  };
+
+  patches = [ ./cxx11.patch ];
+
+  postPatch = ''
+    mkdir -p xsec/yes/lib
+    sed -i -e 's/-O2 -DNDEBUG/-DNDEBUG/g' configure
+  '';
+
+  configureFlags = [
+    "--with-openssl"
+    "--with-xerces"
+    "--with-xalan"
+    "--disable-static"
+  ];
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ xalanc xercesc openssl ];
+
+  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 ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/xml-tooling-c/default.nix b/nixpkgs/pkgs/development/libraries/xml-tooling-c/default.nix
new file mode 100644
index 000000000000..8e1d71fab3fa
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/xml-tooling-c/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchgit, autoreconfHook, boost, curl, openssl, log4shib, xercesc, xml-security-c }:
+
+stdenv.mkDerivation rec {
+  name = "xml-tooling-c-${version}";
+  version = "1.6.3";
+
+  src = fetchgit {
+    url = "https://git.shibboleth.net/git/cpp-xmltooling.git";
+    rev = version;
+    sha256 = "09z2pp3yy3kqx22vwgxyi3s0vlpdv9camw8dpi3q8piff6zxak3q";
+  };
+
+  buildInputs = [ boost curl openssl log4shib xercesc xml-security-c ];
+  nativeBuildInputs = [ autoreconfHook ];
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    description = "A low-level library that provides a high level interface to XML processing for OpenSAML 2";
+    platforms   = platforms.unix;
+    license     = licenses.asl20;
+    maintainers = [ maintainers.jammerful ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/xmlrpc-c/default.nix b/nixpkgs/pkgs/development/libraries/xmlrpc-c/default.nix
new file mode 100644
index 000000000000..8a0017109bbf
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/xmlrpc-c/default.nix
@@ -0,0 +1,33 @@
+{ stdenv, fetchurl, curl, libxml2 }:
+
+stdenv.mkDerivation rec {
+  name = "xmlrpc-c-1.39.12";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/xmlrpc-c/${name}.tgz";
+    sha256 = "026fh7w7y3q9pvxd09i5d4hq3l6gd81n9k19yq4zwbc398kg6c6q";
+  };
+
+  buildInputs = [ curl libxml2 ];
+
+  configureFlags = [
+    "--enable-libxml2-backend"
+  ];
+
+  # Build and install the "xmlrpc" tool (like the Debian package)
+  postInstall = ''
+    (cd tools/xmlrpc && make && make install)
+  '';
+
+  hardeningDisable = [ "format" ];
+
+  meta = with stdenv.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",
+    # "ABYSS Web Server License" and "Python 1.5.2 License"
+    license = licenses.bsd3;
+    platforms = platforms.unix;
+    maintainers = [ maintainers.bjornfor ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/xmlsec/default.nix b/nixpkgs/pkgs/development/libraries/xmlsec/default.nix
new file mode 100644
index 000000000000..b19bf000b0d4
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/xmlsec/default.nix
@@ -0,0 +1,48 @@
+{ stdenv, fetchurl, libxml2, gnutls, libxslt, pkgconfig, libgcrypt, libtool
+, openssl, nss, makeWrapper }:
+
+let
+  version = "1.2.28";
+in
+stdenv.mkDerivation rec {
+  name = "xmlsec-${version}";
+
+  src = fetchurl {
+    url = "https://www.aleksey.com/xmlsec/download/xmlsec1-${version}.tar.gz";
+    sha256 = "1m12caglhyx08g8lh2sl3nkldlpryzdx2d572q73y3m33s0w9vhk";
+  };
+
+  outputs = [ "out" "dev" ];
+
+  nativeBuildInputs = [ makeWrapper pkgconfig ];
+
+  buildInputs = [ libxml2 gnutls libxslt libgcrypt libtool openssl nss ];
+
+  enableParallelBuilding = true;
+  doCheck = true;
+
+  # enable deprecated soap headers required by lasso
+  # https://dev.entrouvert.org/issues/18771
+  configureFlags = [ "--enable-soap" ];
+
+  # otherwise libxmlsec1-gnutls.so won't find libgcrypt.so, after #909
+  NIX_LDFLAGS = [ "-lgcrypt" ];
+
+  postInstall = ''
+    moveToOutput "bin/xmlsec1-config" "$dev"
+    moveToOutput "lib/xmlsec1Conf.sh" "$dev"
+  '';
+
+  postFixup = ''
+    wrapProgram "$out/bin/xmlsec1" --prefix LD_LIBRARY_PATH ":" "$out/lib"
+  '';
+
+  meta = {
+    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;
+    updateWalker = true;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/xsd/default.nix b/nixpkgs/pkgs/development/libraries/xsd/default.nix
new file mode 100644
index 000000000000..051a194af98e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/xsd/default.nix
@@ -0,0 +1,38 @@
+{ stdenv, fetchurl, xercesc }:
+
+let
+  fixed_paths = ''LDFLAGS="-L${xercesc}/lib" CPPFLAGS="-I${xercesc}/include"'';
+in
+stdenv.mkDerivation rec {
+  name = "xsd-${version}";
+  version = "4.0.0";
+
+  src = fetchurl {
+    url = "https://codesynthesis.com/download/xsd/4.0/xsd-4.0.0+dep.tar.bz2";
+    sha256 = "05wqhmd5cd4pdky8i8qysnh96d2h16ly8r73whmbxkajiyf2m9gc";
+  };
+
+  patches = [ ./xsdcxx.patch ];
+
+  configurePhase = ''
+    patchShebangs .
+  '';
+
+  buildPhase = ''
+    make ${fixed_paths}
+  '';
+
+  buildInputs = [ xercesc ];
+
+  installPhase = ''
+    make ${fixed_paths} install_prefix="$out" install
+  '';
+
+  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 ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/xsd/xsdcxx.patch b/nixpkgs/pkgs/development/libraries/xsd/xsdcxx.patch
new file mode 100644
index 000000000000..88a893c6e602
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/xsd/xsdcxx.patch
@@ -0,0 +1,126 @@
+--- xsd-4.0.0+dep/xsd/doc/xsd.1~	2014-09-14 12:25:36.862267587 +0000
++++ xsd-4.0.0+dep/xsd/doc/xsd.1	2014-09-14 12:28:25.728229892 +0000
+@@ -1,16 +1,16 @@
+ .\" Process this file with
+-.\" groff -man -Tascii xsd.1
++.\" groff -man -Tascii xsdcxx.1
+ .\"
+ .TH XSD 1 "July 2014" "XSD 4.0.0"
+ .SH NAME
+-xsd \- W3C XML Schema to C++ Compiler
++xsdcxx \- W3C XML Schema to C++ Compiler
+ .\"
+ .\"
+ .\"
+ .\"--------------------------------------------------------------------
+ .SH SYNOPSIS
+ .\"--------------------------------------------------------------------
+-.B xsd
++.B xsdcxx
+ .I command
+ .B [
+ .I options
+@@ -20,19 +20,19 @@
+ .I file
+ .B ...]
+ .in
+-.B xsd help
++.B xsdcxx help
+ .B [
+ .I command
+ .B ]
+ .in
+-.B xsd version
++.B xsdcxx version
+ .\"
+ .\"
+ .\"
+ .\"--------------------------------------------------------------------
+ .SH DESCRIPTION
+ .\"--------------------------------------------------------------------
+-.B xsd
++.B xsdcxx
+ generates vocabulary-specific, statically-typed C++ mapping from W3C XML
+ Schema definitions. Particular mapping to produce is selected by a
+ .IR command .
+@@ -96,7 +96,7 @@
+ .PP
+ .RS
+ .RS 3
+-.B xsd help
++.B xsdcxx help
+ .I command
+ .RE
+ .PP
+@@ -206,7 +206,7 @@
+ \fIfilename\fP \fInamespace\fP
+ 
+ For example, if you have file \fBhello\.xsd\fP with namespace
+-\fBhttp://example\.com/hello\fP and you run \fBxsd\fP on this file, then the
++\fBhttp://example\.com/hello\fP and you run \fBxsdcxx\fP on this file, then the
+ string in question will be:
+ 
+ \fBhello\.xsd\. http://example\.com/hello\fP
+@@ -1632,7 +1632,7 @@
+ .\"
+ .SH DIAGNOSTICS
+ If the input file is not a valid W3C XML Schema definition,
+-.B xsd
++.B xsdcxx
+ will issue diagnostic messages to
+ .B STDERR
+ and exit with non-zero exit code.
+--- xsd-4.0.0+dep/xsd/doc/xsd.xhtml~	2014-09-14 12:28:37.731513138 +0000
++++ xsd-4.0.0+dep/xsd/doc/xsd.xhtml	2014-09-14 12:30:11.277789610 +0000
+@@ -50,19 +50,19 @@
+ 
+   <h1>NAME</h1>
+ 
+-  <p>xsd - W3C XML Schema to C++ Compiler</p>
++  <p>xsdcxx - W3C XML Schema to C++ Compiler</p>
+ 
+   <h1>SYNOPSIS</h1>
+ 
+   <dl id="synopsis">
+-    <dt><code><b>xsd</b> <i>command</i> [<i>options</i>] <i>file</i> [<i>file</i> ...]</code></dt>
+-    <dt><code><b>xsd help</b> [<i>command</i>]</code></dt>
+-    <dt><code><b>xsd version</b></code></dt>
++    <dt><code><b>xsdcxx</b> <i>command</i> [<i>options</i>] <i>file</i> [<i>file</i> ...]</code></dt>
++    <dt><code><b>xsdcxx help</b> [<i>command</i>]</code></dt>
++    <dt><code><b>xsdcxx version</b></code></dt>
+   </dl>
+ 
+   <h1>DESCRIPTION</h1>
+ 
+-  <p><code><b>xsd</b></code> generates vocabulary-specific, statically-typed
++  <p><code><b>xsdcxx</b></code> generates vocabulary-specific, statically-typed
+   C++ mapping from W3C XML Schema definitions. Particular mapping to
+   produce is selected by a <code><i>command</i></code>. Each mapping has
+   a number of mapping-specific <code><i>options</i></code> that should
+@@ -104,7 +104,7 @@
+ 
+     <dt><code><b>help</b></code></dt>
+     <dd>Print usage information and exit. Use
+-      <p><code><b>xsd help</b> <i>command</i></code></p>
++      <p><code><b>xsdcxx help</b> <i>command</i></code></p>
+       for command-specific help.
+     </dd>
+ 
+@@ -219,7 +219,7 @@
+ 
+   <p>For example, if you have file <code><b>hello.xsd</b></code> with
+   namespace <code><b>http://example.com/hello</b></code> and you run
+-  <code><b>xsd</b></code> on this file, then the string in question will
++  <code><b>xsdcxx</b></code> on this file, then the string in question will
+   be:</p>
+ 
+   <p><code><b>hello.xsd. http://example.com/hello</b></code></p>
+@@ -1530,7 +1530,7 @@
+   <h1>DIAGNOSTICS</h1>
+ 
+   <p>If the input file is not a valid W3C XML Schema definition,
+-    <code><b>xsd</b></code> will issue diagnostic messages to STDERR
++    <code><b>xsdcxx</b></code> will issue diagnostic messages to STDERR
+     and exit with non-zero exit code.</p>
+ 
+   <h1>BUGS</h1>
diff --git a/nixpkgs/pkgs/development/libraries/xvidcore/default.nix b/nixpkgs/pkgs/development/libraries/xvidcore/default.nix
new file mode 100644
index 000000000000..17d7320cb648
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/xvidcore/default.nix
@@ -0,0 +1,47 @@
+{ stdenv, fetchurl, yasm, autoconf, automake, libtool }:
+
+with stdenv.lib;
+stdenv.mkDerivation rec {
+  name = "xvidcore-${version}";
+  version = "1.3.5";
+
+  src = fetchurl {
+    url = "http://downloads.xvid.org/downloads/${name}.tar.bz2";
+    sha256 = "1d0hy1w9sn6491a3vhyf3vmhq4xkn6yd4ralx1191s6qz5wz483w";
+  };
+
+  preConfigure = ''
+    # Configure script is not in the root of the source directory
+    cd build/generic
+  '' + optionalString stdenv.isDarwin ''
+    # Undocumented darwin hack
+    substituteInPlace configure --replace "-no-cpp-precomp" ""
+  '';
+
+  configureFlags = [ ]
+    # Undocumented darwin hack (assembly is probably disabled due to an
+    # issue with nasm, however yasm is now used)
+    ++ optional stdenv.isDarwin "--enable-macosx_module --disable-assembly";
+
+  nativeBuildInputs = [ ]
+    ++ optional (!stdenv.isDarwin) yasm;
+
+  buildInputs = [ ]
+    # Undocumented darwin hack
+    ++ optionals stdenv.isDarwin [ autoconf automake libtool ];
+
+  # Don't remove static libraries (e.g. 'libs/*.a') on darwin.  They're needed to
+  # compile ffmpeg (and perhaps other things).
+  postInstall = optionalString (!stdenv.isDarwin) ''
+    rm $out/lib/*.a
+  '';
+
+  meta = {
+    description = "MPEG-4 video codec for PC";
+    homepage    = https://www.xvid.com/;
+    license     = licenses.gpl2;
+    maintainers = with maintainers; [ codyopel lovek323 ];
+    platforms   = platforms.all;
+  };
+}
+
diff --git a/nixpkgs/pkgs/development/libraries/xxHash/default.nix b/nixpkgs/pkgs/development/libraries/xxHash/default.nix
new file mode 100644
index 000000000000..9f2b83d7597c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/xxHash/default.nix
@@ -0,0 +1,32 @@
+{ stdenv, fetchFromGitHub }:
+
+stdenv.mkDerivation rec {
+  name = "xxHash-${version}";
+  version = "0.7.0";
+
+  src = fetchFromGitHub {
+    owner = "Cyan4973";
+    repo = "xxHash";
+    rev = "v${version}";
+    sha256 = "19iyr7x0s7in9kp9wrj4iimdx58nv6jndz9x5ndnl07gd90y7jxb";
+  };
+
+  outputs = [ "out" "dev" ];
+
+  makeFlags = [ "PREFIX=$(out)" "INCLUDEDIR=$(dev)/include" ];
+
+  meta = with stdenv.lib; {
+    description = "Extremely fast hash algorithm";
+    longDescription = ''
+      xxHash is an Extremely fast Hash algorithm, running at RAM speed limits.
+      It successfully completes the SMHasher test suite which evaluates
+      collision, dispersion and randomness qualities of hash functions. Code is
+      highly portable, and hashes are identical on all platforms (little / big
+      endian).
+    '';
+    homepage = https://github.com/Cyan4973/xxHash;
+    license = with licenses; [ bsd2 gpl2 ];
+    maintainers = with maintainers; [ orivej ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/xylib/default.nix b/nixpkgs/pkgs/development/libraries/xylib/default.nix
new file mode 100644
index 000000000000..c9c84f4e1d89
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/xylib/default.nix
@@ -0,0 +1,21 @@
+{ stdenv, fetchurl, boost, zlib, bzip2, wxGTK30 }:
+
+stdenv.mkDerivation rec {
+  name = "xylib-${version}";
+  version = "1.5";
+
+  src = fetchurl {
+    url = "https://github.com/wojdyr/xylib/releases/download/v${version}/${name}.tar.bz2";
+    sha256 = "1r2kx80zhdvz39k6h2fsncm2742xxvxl3z8a3fnr13jl9sl7mnnd";
+  };
+
+  buildInputs = [ boost zlib bzip2 wxGTK30 ];
+
+  meta = with stdenv.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/;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ pSub ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/yajl/default.nix b/nixpkgs/pkgs/development/libraries/yajl/default.nix
new file mode 100644
index 000000000000..f9ce555cf27d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/yajl/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchurl, cmake }:
+
+stdenv.mkDerivation rec {
+  name = "yajl-2.1.0";
+
+  src = fetchurl {
+    url = https://github.com/lloyd/yajl/tarball/2.1.0;
+    name = "${name}.tar.gz";
+    sha256 = "0f6yrjc05aa26wfi7lqn2gslm19m6rm81b30ksllpkappvh162ji";
+  };
+
+  nativeBuildInputs = [ cmake ];
+
+  meta = {
+    description = "Yet Another JSON Library";
+    longDescription = ''
+      YAJL is a small event-driven (SAX-style) JSON parser written in ANSI
+      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; [ z77z ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/yojimbo/default.nix b/nixpkgs/pkgs/development/libraries/yojimbo/default.nix
new file mode 100644
index 000000000000..6305b6c03a46
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/yojimbo/default.nix
@@ -0,0 +1,43 @@
+{ stdenv, fetchFromGitHub, premake5, doxygen, libsodium, mbedtls }:
+
+stdenv.mkDerivation rec {
+  pname = "yojimbo";
+  version = "1.1";
+
+  src = fetchFromGitHub {
+    owner = "networkprotocol";
+    repo = "yojimbo";
+    rev = "e02219c102d9b440290539036992d77608eab3b0";
+    sha256 = "0jn25ddv73hwjals883a910m66kwj6glxxhnmn96bpzsvsaimnkr";
+    fetchSubmodules = true;
+  };
+
+  nativeBuildInputs = [ premake5 doxygen ];
+  propagatedBuildInputs = [ libsodium mbedtls ];
+
+  postBuild = ''
+    premake5 docs
+  '';
+
+  installPhase = ''
+    install -Dm555 -t $out/lib bin/libyojimbo.a
+    install -Dm444 -t $out/include yojimbo.h
+    mkdir -p $out/share/doc/yojimbo
+    cp -r docs/html $out/share/doc/yojimbo
+  '';
+
+  doCheck = true;
+
+  meta = with stdenv.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.
+      It's designed around the networking requirements of competitive multiplayer games like first person shooters.
+      As such it provides a time critical networking layer on top of UDP, with a client/server architecture supporting up to 64 players per-dedicated server instance.
+    '';
+    homepage = https://github.com/networkprotocol/yojimbo;
+    license = licenses.bsd3;
+    platforms = platforms.x86_64;
+    maintainers = with maintainers; [ paddygord ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/yubico-pam/default.nix b/nixpkgs/pkgs/development/libraries/yubico-pam/default.nix
new file mode 100644
index 000000000000..5d7d0e664c64
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/yubico-pam/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchFromGitHub, autoreconfHook, pkgconfig
+, asciidoc, libxslt, docbook_xsl
+, pam, yubikey-personalization, libyubikey, libykclient }:
+
+stdenv.mkDerivation rec {
+  pname = "yubico-pam";
+  version = "unstable-2019-03-19";
+  src = fetchFromGitHub {
+    owner = "Yubico";
+    repo = pname;
+    rev = "1c6fa66825e77b3ad8df46513d0125bed9bde704";
+    sha256 = "1g41wdwa1wbp391w1crbis4hwz60m3y06rd6j59m003zx40sk9s4";
+  };
+
+  nativeBuildInputs = [ autoreconfHook pkgconfig asciidoc libxslt docbook_xsl ];
+  buildInputs = [ pam yubikey-personalization libyubikey libykclient ];
+
+  meta = with stdenv.lib; {
+    description = "Yubico PAM module";
+    homepage = https://developers.yubico.com/yubico-pam;
+    license = licenses.bsd2;
+    maintainers = with maintainers; [ dtzWill ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/zeitgeist/default.nix b/nixpkgs/pkgs/development/libraries/zeitgeist/default.nix
new file mode 100644
index 000000000000..c5dc775d0755
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/zeitgeist/default.nix
@@ -0,0 +1,50 @@
+{ stdenv, fetchFromGitLab, pkgconfig, glib, sqlite, gobject-introspection, vala
+, autoconf, automake, libtool, gettext, dbus, telepathy-glib
+, gtk3, json-glib, librdf_raptor2, dbus-glib
+, pythonSupport ? true, python2Packages
+}:
+
+stdenv.mkDerivation rec {
+  pname = "zeitgeist";
+  version = "1.0.2";
+
+  outputs = [ "out" "lib" "dev" "man" ] ++ stdenv.lib.optional pythonSupport "py";
+
+  src = fetchFromGitLab {
+    domain = "gitlab.freedesktop.org";
+    owner = pname;
+    repo = pname;
+    rev = "v${version}";
+    sha256 = "0ig3d3j1n0ghaxsgfww6g2hhcdwx8cljwwfmp9jk1nrvkxd6rnmv";
+  };
+
+  preConfigure = "NOCONFIGURE=1 ./autogen.sh";
+
+  configureFlags = [ "--with-session-bus-services-dir=${placeholder ''out''}/share/dbus-1/services" ];
+
+  nativeBuildInputs = [
+    autoconf automake libtool pkgconfig gettext gobject-introspection vala python2Packages.python
+  ];
+  buildInputs = [
+    glib sqlite dbus telepathy-glib dbus-glib
+    gtk3 json-glib librdf_raptor2 python2Packages.rdflib
+  ];
+
+  postPatch = ''
+    patchShebangs data/ontology2code
+  '';
+
+  enableParallelBuilding = true;
+
+  postFixup = stdenv.lib.optionalString pythonSupport ''
+    moveToOutput lib/${python2Packages.python.libPrefix} "$py"
+  '';
+
+  meta = with stdenv.lib; {
+    description = "A service which logs the users's activities and events";
+    homepage = https://zeitgeist.freedesktop.org/;
+    maintainers = with maintainers; [ lethalman worldofpeace ];
+    license = licenses.gpl2;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/zeroc-ice/default.nix b/nixpkgs/pkgs/development/libraries/zeroc-ice/default.nix
new file mode 100644
index 000000000000..82b53402fc78
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/zeroc-ice/default.nix
@@ -0,0 +1,41 @@
+{ stdenv, fetchFromGitHub, mcpp, bzip2, expat, openssl, db5
+, darwin, libiconv, Security
+}:
+
+stdenv.mkDerivation rec {
+  name = "zeroc-ice-${version}";
+  version = "3.6.3";
+
+  src = fetchFromGitHub {
+    owner = "zeroc-ice";
+    repo = "ice";
+    rev = "v${version}";
+    sha256 = "05xympbns32aalgcfcpxwfd7bvg343f16xpg6jv5s335ski3cjy2";
+  };
+
+  patches = [ ./makefile.patch ];
+
+  buildInputs = [ mcpp bzip2 expat openssl db5 ]
+    ++ stdenv.lib.optionals stdenv.isDarwin [ darwin.cctools libiconv Security ];
+
+  postUnpack = ''
+    sourceRoot=$sourceRoot/cpp
+  '';
+
+  prePatch = ''
+    substituteInPlace config/Make.rules.Darwin \
+        --replace xcrun ""
+  '';
+
+  makeFlags = [ "prefix=$(out)" "OPTIMIZE=yes" ];
+
+  # cannot find -lIceXML (linking bin/transformdb)
+  #enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    homepage = http://www.zeroc.com/ice.html;
+    description = "The internet communications engine";
+    license = licenses.gpl2;
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/zeroc-ice/makefile.patch b/nixpkgs/pkgs/development/libraries/zeroc-ice/makefile.patch
new file mode 100644
index 000000000000..6955bcd0a6d7
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/zeroc-ice/makefile.patch
@@ -0,0 +1,9 @@
+--- a/src/Makefile
++++ b/src/Makefile
+@@ -77,4 +77,6 @@ FreezeScript: Freeze
+ Glacier2 IceGridLib Glacier2CryptPermissionsVerifier: Glacier2Lib
+ 
++Glacier2: IceSSL
++
+ IcePatch2: IcePatch2Lib
+ 
diff --git a/nixpkgs/pkgs/development/libraries/zeromq/3.x.nix b/nixpkgs/pkgs/development/libraries/zeromq/3.x.nix
new file mode 100644
index 000000000000..2fcf8bd91791
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/zeromq/3.x.nix
@@ -0,0 +1,22 @@
+{ stdenv, fetchurl, libuuid }:
+
+stdenv.mkDerivation rec {
+  name = "zeromq-3.2.5";
+
+  src = fetchurl {
+    url = "http://download.zeromq.org/${name}.tar.gz";
+    sha256 = "0911r7q4i1x9gnfinj39vx08fnz59mf05vl75zdkws36lib3wr89";
+  };
+
+  buildInputs = [ libuuid ];
+
+  doCheck = false; # fails all the tests (ctest)
+
+  meta = with stdenv.lib; {
+    branch = "3";
+    homepage = http://www.zeromq.org;
+    description = "The Intelligent Transport Layer";
+    license = licenses.gpl3;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/zeromq/4.x.nix b/nixpkgs/pkgs/development/libraries/zeromq/4.x.nix
new file mode 100644
index 000000000000..9fc0c4ac2306
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/zeromq/4.x.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchFromGitHub, cmake, asciidoc }:
+
+stdenv.mkDerivation rec {
+  name = "zeromq-${version}";
+  version = "4.3.1";
+
+  src = fetchFromGitHub {
+    owner = "zeromq";
+    repo = "libzmq";
+    rev = "v${version}";
+    sha256 = "0z7ka82ihlsncqmf8jj4lnjyr418dzxfs0psx5mccqb09yx9shgm";
+  };
+
+  nativeBuildInputs = [ cmake asciidoc ];
+
+  enableParallelBuilding = true;
+
+  doCheck = false; # fails all the tests (ctest)
+
+  meta = with stdenv.lib; {
+    branch = "4";
+    homepage = http://www.zeromq.org;
+    description = "The Intelligent Transport Layer";
+    license = licenses.gpl3;
+    platforms = platforms.all;
+    maintainers = with maintainers; [ fpletz ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/zimg/default.nix b/nixpkgs/pkgs/development/libraries/zimg/default.nix
new file mode 100644
index 000000000000..12fb076d946b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/zimg/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchFromGitHub, autoreconfHook }:
+
+stdenv.mkDerivation rec{
+  name = "zimg-${version}";
+  version = "2.8";
+
+  src = fetchFromGitHub {
+    owner  = "sekrit-twc";
+    repo   = "zimg";
+    rev    = "release-${version}";
+    sha256 = "0s4n1swg1hgv81l8hvf0ny0fn305vf6l6dakbj452304p6ihxd83";
+  };
+
+  nativeBuildInputs = [ autoreconfHook ];
+
+  meta = with stdenv.lib; {
+    description = "Scaling, colorspace conversion and dithering library";
+    homepage    = https://github.com/sekrit-twc/zimg;
+    license     = licenses.wtfpl;
+    platforms   = platforms.linux ++ platforms.darwin;
+    maintainers = with maintainers; [ rnhmjoj ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/zimlib/default.nix b/nixpkgs/pkgs/development/libraries/zimlib/default.nix
new file mode 100644
index 000000000000..9b7a90266284
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/zimlib/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchurl, lzma }:
+
+stdenv.mkDerivation rec {
+  name = "zimlib-${version}";
+  version = "1.4";
+
+  src = fetchurl {
+    url = "http://www.openzim.org/download/${name}.tar.gz";
+    sha256 = "14ra3iq42x53k1nqxb5lsg4gadlkpkgv6cbjjl6305ajmbrghcdq";
+  };
+
+  buildInputs = [ lzma ];
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    description = "Library for reading and writing ZIM files";
+    homepage =  http://www.openzim.org/wiki/Zimlib;
+    license = licenses.gpl2;
+    maintainers = with maintainers; [ robbinch ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/zlib/default.nix b/nixpkgs/pkgs/development/libraries/zlib/default.nix
new file mode 100644
index 000000000000..3a5638b22814
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/zlib/default.nix
@@ -0,0 +1,90 @@
+{ stdenv
+, fetchurl
+, static ? true
+, shared ? true
+}:
+
+stdenv.mkDerivation (rec {
+  name = "zlib-${version}";
+  version = "1.2.11";
+
+  src = fetchurl {
+    urls =
+      [ "https://www.zlib.net/fossils/${name}.tar.gz"  # stable archive path
+        "mirror://sourceforge/libpng/zlib/${version}/${name}.tar.gz"
+      ];
+    sha256 = "c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1";
+  };
+
+  patches = stdenv.lib.optional stdenv.hostPlatform.isCygwin ./disable-cygwin-widechar.patch;
+
+  postPatch = stdenv.lib.optionalString stdenv.hostPlatform.isDarwin ''
+    substituteInPlace configure \
+      --replace '/usr/bin/libtool' 'ar' \
+      --replace 'AR="libtool"' 'AR="ar"' \
+      --replace 'ARFLAGS="-o"' 'ARFLAGS="-r"'
+  '';
+
+  outputs = [ "out" "dev" ]
+    ++ stdenv.lib.optional (shared && static) "static";
+  setOutputFlags = false;
+  outputDoc = "dev"; # single tiny man3 page
+
+  configureFlags = stdenv.lib.optional shared "--shared"
+                   ++ stdenv.lib.optional (static && !shared) "--static";
+
+  postInstall = stdenv.lib.optionalString (shared && static) ''
+    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 ''
+    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") ''
+    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";
+
+  dontStrip = stdenv.hostPlatform != stdenv.buildPlatform && static;
+  configurePlatforms = [];
+
+  installFlags = stdenv.lib.optionals (stdenv.hostPlatform.libc == "msvcrt") [
+    "BINARY_PATH=$(out)/bin"
+    "INCLUDE_PATH=$(dev)/include"
+    "LIBRARY_PATH=$(out)/lib"
+  ];
+
+  makeFlags = [
+    "PREFIX=${stdenv.cc.targetPrefix}"
+  ] ++ stdenv.lib.optionals (stdenv.hostPlatform.libc == "msvcrt") [
+    "-f" "win32/Makefile.gcc"
+  ] ++ stdenv.lib.optionals shared [
+    "SHARED_MODE=1"
+  ];
+
+  passthru = {
+    inherit version;
+  };
+
+  meta = with stdenv.lib; {
+    homepage = https://zlib.net;
+    description = "Lossless data-compression library";
+    license = licenses.zlib;
+    platforms = platforms.all;
+  };
+} // stdenv.lib.optionalAttrs (stdenv.hostPlatform != stdenv.buildPlatform) {
+  preConfigure = ''
+    export CHOST=${stdenv.hostPlatform.config}
+  '';
+} // stdenv.lib.optionalAttrs (stdenv.hostPlatform.libc == "msvcrt") {
+  configurePhase = ":";
+})
diff --git a/nixpkgs/pkgs/development/libraries/zlib/disable-cygwin-widechar.patch b/nixpkgs/pkgs/development/libraries/zlib/disable-cygwin-widechar.patch
new file mode 100644
index 000000000000..3de4978c3066
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/zlib/disable-cygwin-widechar.patch
@@ -0,0 +1,13 @@
+diff --git a/gzguts.h b/gzguts.h
+index 990a4d2..6378d46 100644
+--- a/gzguts.h
++++ b/gzguts.h
+@@ -39,7 +39,7 @@
+ #  include <io.h>
+ #endif
+ 
+-#if defined(_WIN32) || defined(__CYGWIN__)
++#if defined(_WIN32)
+ #  define WIDECHAR
+ #endif
+ 
diff --git a/nixpkgs/pkgs/development/libraries/zlog/default.nix b/nixpkgs/pkgs/development/libraries/zlog/default.nix
new file mode 100644
index 000000000000..d3dc41371de3
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/zlog/default.nix
@@ -0,0 +1,34 @@
+{ stdenv, fetchzip }:
+
+stdenv.mkDerivation rec {
+  version = "1.2.12";
+  name = "zlog-${version}";
+
+  src = fetchzip {
+    name = "${name}-src";
+    url = "https://github.com/HardySimpson/zlog/archive/${version}.tar.gz";
+    sha256 = "1ychld0dcfdak2wnmkj941i0xav6ynlb3n6hz1kz03yy74ll2fqi";
+  };
+
+  configurePhase = ''
+    sed -i 's;-Werror;;' src/makefile
+  '';
+
+  buildPhase = ''
+    mkdir -p $out
+    make PREFIX=$out
+  '';
+
+  installPhase = ''
+    make PREFIX=$out install
+  '';
+
+  meta = with stdenv.lib; {
+    description= "Reliable, high-performance, thread safe, flexible, clear-model, pure C logging library";
+    homepage = http://hardysimpson.github.com/zlog;
+    license = licenses.lgpl21;
+    platforms = platforms.linux; # cannot test on something else
+    maintainers = [ maintainers.matthiasbeyer ];
+  };
+
+}
diff --git a/nixpkgs/pkgs/development/libraries/zmqpp/default.nix b/nixpkgs/pkgs/development/libraries/zmqpp/default.nix
new file mode 100644
index 000000000000..f7e849f6a334
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/zmqpp/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchFromGitHub, cmake, pkgconfig, zeromq }:
+
+stdenv.mkDerivation rec {
+  name = "zmqpp-${version}";
+  version = "4.2.0";
+
+  src = fetchFromGitHub {
+    owner = "zeromq";
+    repo = "zmqpp";
+    rev = version;
+    sha256 = "08v34q3sd8g1b95k73n7jwryb0xzwca8ib9dz8ngczqf26j8k72i";
+  };
+
+  outputs = [ "out" "dev" ];
+
+  nativeBuildInputs = [ cmake pkgconfig ];
+
+  propagatedBuildInputs = [ zeromq ];
+
+  meta = with stdenv.lib; {
+    inherit (src.meta) homepage;
+    description = "C++ wrapper for czmq. Aims to be minimal, simple and consistent";
+    license = licenses.lgpl3;
+    platforms = platforms.linux ++ platforms.darwin;
+    maintainers = with maintainers; [ chris-martin ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/zookeeper_mt/default.nix b/nixpkgs/pkgs/development/libraries/zookeeper_mt/default.nix
new file mode 100644
index 000000000000..58e1940a3ef4
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/zookeeper_mt/default.nix
@@ -0,0 +1,20 @@
+{ stdenv, zookeeper, bash }:
+
+stdenv.mkDerivation rec {
+   name = "zookeeper_mt-${stdenv.lib.getVersion zookeeper}";
+   
+   src = zookeeper.src;
+   
+   setSourceRoot = "export sourceRoot=${zookeeper.name}/src/c";
+
+   buildInputs = [ zookeeper bash ];
+
+   meta = with stdenv.lib; {
+   	homepage = http://zookeeper.apache.org;
+   	description = "Apache Zookeeper";
+   	license = licenses.asl20;
+   	maintainers = [ maintainers.boothead ];	
+   	platforms = platforms.unix;	
+   };
+}
+
diff --git a/nixpkgs/pkgs/development/libraries/zxcvbn-c/default.nix b/nixpkgs/pkgs/development/libraries/zxcvbn-c/default.nix
new file mode 100644
index 000000000000..65509d766b96
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/zxcvbn-c/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchFromGitHub }:
+stdenv.mkDerivation rec {
+  name = "zxcvbn-c-${version}";
+  version = "2.4";
+
+  src = fetchFromGitHub {
+    owner = "tsyrogit";
+    repo = "zxcvbn-c";
+    rev = "v${version}";
+    sha256 = "12ksdnpxlqlmg9zhyyk3bspcf0sfj5zk735vr4ry635qi7gzcaas";
+  };
+
+  installPhase = ''
+    install -D -t $out/lib libzxcvbn.so*
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = https://github.com/tsyrogit/zxcvbn-c;
+    description = "A C/C++ implementation of the zxcvbn password strength estimation";
+    license = licenses.mit;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ xurei ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/zziplib/default.nix b/nixpkgs/pkgs/development/libraries/zziplib/default.nix
new file mode 100644
index 000000000000..6aede4e9653f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/zziplib/default.nix
@@ -0,0 +1,42 @@
+{ docbook_xml_dtd_412, fetchurl, stdenv, perl, python2, zip, xmlto, zlib }:
+
+stdenv.mkDerivation rec {
+  name = "zziplib-${version}";
+  version = "0.13.69";
+
+  src = fetchurl {
+    url = "https://github.com/gdraheim/zziplib/archive/v${version}.tar.gz";
+    sha256 = "0i052a7shww0fzsxrdp3rd7g4mbzx7324a8ysbc0br7frpblcql4";
+  };
+
+  postPatch = ''
+    sed -i -e s,--export-dynamic,, configure
+  '';
+
+  buildInputs = [ docbook_xml_dtd_412 perl python2 zip xmlto zlib ];
+
+  # tests are broken (https://github.com/gdraheim/zziplib/issues/20),
+  # and test/zziptests.py requires network access
+  # (https://github.com/gdraheim/zziplib/issues/24)
+  doCheck = false;
+
+  meta = with stdenv.lib; {
+    description = "Library to extract data from files archived in a zip file";
+
+    longDescription = ''
+      The zziplib library is intentionally lightweight, it offers the ability
+      to easily extract data from files archived in a single zip
+      file.  Applications can bundle files into a single zip archive and
+      access them.  The implementation is based only on the (free) subset of
+      compression with the zlib algorithm which is actually used by the
+      zip/unzip tools.
+    '';
+
+    license = with licenses; [ lgpl2Plus mpl11 ];
+
+    homepage = http://zziplib.sourceforge.net/;
+
+    maintainers = [ ];
+    platforms = python2.meta.platforms;
+  };
+}