diff --git a/pkgs/applications/audio/picard/default.nix b/pkgs/applications/audio/picard/default.nix index 5830e1eefb88c..0c612338361f4 100644 --- a/pkgs/applications/audio/picard/default.nix +++ b/pkgs/applications/audio/picard/default.nix @@ -21,7 +21,15 @@ in pythonPackages.buildPythonApplication rec { sha256 = "0xalg4dvaqb396h4s6gzxnplgv1lcvsczmmrlhyrj0kfj10amhsj"; }; - nativeBuildInputs = [ gettext qt5.wrapQtAppsHook qt5.qtbase ] + nativeBuildInputs = [ gettext qt5.wrapQtAppsHook ]; + + propagatedBuildInputs = with pythonPackages; [ + qt5.qtbase + pyqt5 + mutagen + chromaprint + discid + ] ++ stdenv.lib.optionals (pyqt5.multimediaEnabled) [ qt5.qtmultimedia.bin gst_all_1.gstreamer @@ -32,18 +40,12 @@ in pythonPackages.buildPythonApplication rec { ] ; - propagatedBuildInputs = with pythonPackages; [ - pyqt5 - mutagen - chromaprint - discid - ]; - prePatch = '' # Pesky unicode punctuation. substituteInPlace setup.cfg --replace "‘" "'" ''; + dontWrapPythonPrograms = (qt5.wrapQtAppsHook == null); # In order to spare double wrapping, we use: preFixup = '' makeWrapperArgs+=("''${qtWrapperArgs[@]}") diff --git a/pkgs/build-support/neowrap.nix b/pkgs/build-support/neowrap.nix new file mode 100644 index 0000000000000..88b954779bba8 --- /dev/null +++ b/pkgs/build-support/neowrap.nix @@ -0,0 +1,294 @@ +{ lib +, symlinkJoin +, makeWrapper +, lndir +, pkgs +, extraPkgsByOverride ? [] +}: + +# A single pkg or a list of pkgs mainly packaged +pkgList: + +let + wrapper = { + extraPkgs ? [], + extraMakeWrapperArgs ? "", + # An attribute set that tells the builder how to handle links per file / + # directory found in every key of propagateEnv. E.g: + /*** example value *** + linkByEnv = { + # Tells the builder to link the files in every directory that propagates + # XDG_DATA_DIRS. + XDG_DATA_DIRS = "link"; + # Tells the builder to simply link all the files of a package that + # propagets this env var. Note that this may affect closure size of the + # result as every pkg's all outputs are used unconditionally. Useful for + # python / other languages wrappings + GI_TYPELIB_PATH = "linkPkg"; + }, + /*** Another example value *** + linkByEnv ? { + QT_PLUGIN_PATH = "link"; + QML2_IMPORT_PATH = "link"; + }, + */ + # TODO: Decide what to do when `linkPkg` is used here and the file + # nix-support/propagated-build-inputs has different values per package + linkByEnv ? {}, + # If we want the wrapping to also include an environmental variable in + # out, we list here for every env var what path to add to the wrapper's + # values. + /*** example value *** + wrapOut ? { + XDG_DATA_DIRS = "$out/share"; + PYTHONPATH = "$out/${pkgs.python3.sitePackages}"; + }, + */ + wrapOut ? {}, + }: + let + # Where we keep general knowledge about known to be used environmental variables + encyclopedia = { + # Here we write the separator string between values of every env var, the + # default is ":" + separators = { + # XDG_DATA_DIRS = ":"; + }; + # If the `link` argument was supplied, we use the keys provided here as a + # dictionary that defines where to symlink the files that the caller + # wants to be symlinked as well, per env var. If a key shows up here and + # in wrapOut as well, it is expected they will have the same value. + linkPaths = { + XDG_DATA_DIRS = "$out/share"; + GI_TYPELIB_PATH = "$out/lib/girepository-1.0"; + QT_PLUGIN_PATH = "$out/${pkgs.qt5.qtbase.qtPluginPrefix}"; + QML2_IMPORT_PATH = "$out/${pkgs.qt5.qtbase.qtQmlPrefix}"; + # Not using a strict version here as it may confuse someone digging + # into the results of this wrapper + PYTHONPATH = "$out/python-sitePackages"; + }; + # If you want an environment variable to have a single value and that's it, + # put it here: + singleValue = [ + "GDK_PIXBUF_MODULE_FILE" + ]; + # To prevent a stack overflow when inspecting a derivation's inputs + # recursively, we use this list to tell the function that dives into the + # dependency graph, what packages should be skipped instantly. + skipDivingInto = with pkgs; [ + gnu-efi iptables kexectools libapparmor libcap libidn2 libmicrohttpd + libnetfilter_conntrack libnftnl libseccomp pciutils systemd acl autogen + gnutls guile libevent p11-kit unbound xorg.libXext freetype xorg.libICE + libpng_apng kmod libgcrypt curl libkrb5 libssh2 nghttp2 libtool nettle + glib libselinux utillinux xorg.libX11 xorg.libxcb xorg.libXdmcp libxslt cracklib + linux-pam xorg.libXau libxml2 sqlite readline bison zlib libffi openssl ncurses + # Note we add perl itself here, not any library of it + perl xorg.xorgproto expat xz fontconfig xorg.libXfixes llvm + ]; + }; + # recursive function that goes deep through the dependency graph of a given + # list of packages and creates a list of all buildInputs they all depend + # on. The 2nd argument pkgsFound is used internally and it's expected to be + # [] at the first call. + getAllInputs = + pkgs: + pkgsFound: + map ( + pkg: + if builtins.isAttrs pkg then + let + inEncyclopedia = + inputPkg: + lib.lists.any ( + knownPkg: + if builtins.isAttrs inputPkg then + # builtins.trace "testing ${inputPkg.name} if in encyclopedia: ${builtins.toJSON (inputPkg.name == knownPkg.name)}" inputPkg.name == knownPkg.name + inputPkg.name == knownPkg.name + else + false + ) encyclopedia.skipDivingInto + ; + notInEncyclopedia = + inputPkg: + !(inEncyclopedia inputPkg) + ; + hasInputs = pkg.buildInputs != [] || pkg.propagatedBuildInputs != []; + in + if !(inEncyclopedia pkg) && hasInputs then + let + # From some reason, pkg == knownPkg doesn't work :/ don't know + # why... Never the less this should be good enough + deeperPkgs = builtins.filter notInEncyclopedia (pkg.buildInputs ++ pkg.propagatedBuildInputs); + deeperPkgs_ = builtins.trace "deeper is ${builtins.toJSON deeperPkgs}" deeperPkgs; + currentPkgs = pkgsFound ++ pkgs; + in + (getAllInputs deeperPkgs currentPkgs) + else + pkgsFound ++ [ pkg ] + else + [] + ) pkgs + ; + allPkgs = (lib.lists.flatten pkgList) ++ extraPkgsByOverride ++ extraPkgs; + # Useful for debugging, not evaluated if not used. + allPkgs_ = builtins.trace "allPkgs is: ${builtins.toJSON allPkgs}" allPkgs; + allInputs = lib.lists.unique (lib.lists.flatten (getAllInputs allPkgs [])); + # Useful for debugging, not evaluated if not used. + allInputs_ = builtins.trace "allInputs is: ${builtins.toJSON allInputs}" allInputs; + # filter out of all the inputs the packages with the propagateEnv attribute + envPkgs = builtins.filter ( + pkg: + if builtins.isAttrs pkg then + (builtins.hasAttr "propagateEnv" pkg) + else + false + ) allInputs; + # Useful for debugging, not evaluated if not used. + envPkgs_ = builtins.trace "envPkgs is: ${builtins.toJSON envPkgs}" envPkgs; + # Given a package, it's outputs and an envStr such as found in the values + # of passthru's `propagateEnv`, it replaces all occurences of %% + # from envStr according to the pkg.outputs + replaceAllOutputs = { + pkg, + envStr, + outputs, + outname ? "out", + }: + let + outname = builtins.elemAt outputs 0; + in + if (builtins.length outputs) == 0 then + envStr + else + replaceAllOutputs { + inherit pkg; + outputs = lib.lists.subtractLists [outname] outputs; + envStr = builtins.replaceStrings + [ "@${outname}@" ] + [ "${pkg.${outname}}" ] + envStr; + } + ; + # Where we calculate every env var's values. This also considers the `link` + # argument's value - if it was requested to `link` directories of certain + # env vars or paths, that's taken care of later, at `linkInfo`. The + # encyclopedia's `linkPaths` set is used if needed. + envInfo = lib.attrsets.foldAttrs (n: a: lib.lists.unique ([n] ++ a)) [] (map ( + pkg: + # for every package in envPkgs, do the following for every env key and value + (lib.attrsets.mapAttrs ( + # env var name + name: + # env var value + value: + let + real_value = replaceAllOutputs { + inherit pkg; + outputs = pkg.outputs; + envStr = value; + }; + in + if builtins.hasAttr name linkByEnv then + if linkByEnv.${name} == "link" then + if builtins.hasAttr name encyclopedia.linkPaths then + { + linkType = "normal"; + linkTo = encyclopedia.linkPaths.${name}; + linkFrom = real_value; + } + else + abort "neowrap.nix: I was requested to symlink paths of propagated environment for env var `${name}` but I don't know where to put these files as they are not in my encyclopedia" + else + if linkByEnv.${name} != "linkPkg" then + abort "neowrap.nix: got an unknown value for a linkByenv env key: ${name}" + else + { + linkType = "pkg"; + linkTo = "$out"; + # Should this be `pkg.dev` or simply `pkg` ? + linkFrom = pkg.out; + } + else + real_value + ) pkg.propagateEnv) + ) envPkgs); + # Useful for debugging, not evaluated if not used. + envInfo_ = builtins.trace "envInfo is ${(builtins.toJSON envInfo)}" envInfo; + makeWrapperArgs = lib.lists.flatten (lib.attrsets.mapAttrsToList ( + key: + value: + (let + sep = encyclopedia.separators.${key} or ":"; # default separator used for most wrappings + in + # To filter out envInfo changed via the `linkByEnv` argument + if builtins.isString (builtins.elemAt value 0) then + if builtins.elem key encyclopedia.singleValue then + if (builtins.length value) > 1 then + abort "neowrap.nix: There is more then 1 derivation in all inputs of: ${builtins.toJSON allPkgs} that set ${key} to a value via a passthru. This env key, is defined in my encyclopedia as a single value key. Hence I don't know what value to use in wrapping." + else + # Should this be "--set" ? + "--set-default ${key} ${builtins.elemAt value 0}" + else + "--prefix ${key} ${sep} ${builtins.concatStringsSep sep value}" + else + # duplicates are removed by lib.lists.flatten at the beginning + if (builtins.elemAt value 0).linkType == "normal" then + "--prefix ${key} ${sep} ${(builtins.elemAt value 0).linkTo}" + else # (builtins.elemAt value 0).linkType == "pkg" then + if builtins.hasAttr key wrapOut || builtins.hasAttr key encyclopedia.linkPaths then + "--prefix ${key} ${sep} ${wrapOut.${key} or encyclopedia.linkPaths.${key}}" + else + abort "neowrap.nix: When requested to link packages of env var ${key}, I couldn't decide where to link them _to_, either set wrapOut.${key} to e.g $out/${key}, and that directory will be added to the values of ${key}, or add an entry to the encyclopedia.linkPaths attribute set" + ) + ) + # Before calculating makeWrapperArgs, we need to add values to env vars + # according to the `wrapOut` argument: + (lib.attrsets.mapAttrs ( + name: + values: + if builtins.hasAttr name wrapOut && builtins.isList values then + if builtins.elem wrapOut.${name} values then + values + else + values ++ [wrapOut.${name}] + else + values + ) envInfo) + ); + makeWrapperArgs_ = builtins.trace "makeWrapperArgs is ${builtins.toJSON makeWrapperArgs}" makeWrapperArgs; + linkCmds = lib.lists.flatten (lib.attrsets.mapAttrsToList ( + key: + values: + (let + sep = encyclopedia.separators.${key} or ":"; # default separator used for most wrappings + in + if builtins.isAttrs (builtins.elemAt values 0) then + (map ( + v: + "mkdir -p ${v.linkTo} && lndir -silent ${v.linkFrom} ${v.linkTo}" + ) values) + else + # removed by lib.lists.flatten at the beginning + [] + ) + ) + envInfo + ); + # Useful for debugging, not evaluated if not used. + linkCmds_ = builtins.trace "linkCmds is ${builtins.toJSON linkCmds}" linkCmds; + in + symlinkJoin { + name = "runtime-env"; + paths = pkgList; + passthru.unwrapped = pkgList; + + buildInputs = [ makeWrapper lndir ]; + postBuild = '' + ${builtins.concatStringsSep "\n" linkCmds} + for i in $out/bin/*; do + wrapProgram "$i" ${builtins.concatStringsSep " " makeWrapperArgs} + done + ''; + }; +in + lib.makeOverridable wrapper diff --git a/pkgs/development/libraries/atk/default.nix b/pkgs/development/libraries/atk/default.nix index 400ddd5125953..bbbd4f6a8cc3e 100644 --- a/pkgs/development/libraries/atk/default.nix +++ b/pkgs/development/libraries/atk/default.nix @@ -38,6 +38,9 @@ stdenv.mkDerivation rec { updateScript = gnome3.updateScript { packageName = pname; }; + propagateEnv = { + GI_TYPELIB_PATH = "@out@/lib/girepository-1.0"; + }; }; meta = { diff --git a/pkgs/development/libraries/dconf/default.nix b/pkgs/development/libraries/dconf/default.nix index 8c3a2965484f3..9f4926fa41397 100644 --- a/pkgs/development/libraries/dconf/default.nix +++ b/pkgs/development/libraries/dconf/default.nix @@ -35,6 +35,9 @@ stdenv.mkDerivation rec { updateScript = gnome3.updateScript { packageName = pname; }; + propagateEnv = { + GIO_EXTRA_MODULES = "@lib@/lib/gio/modules"; + }; }; meta = with stdenv.lib; { diff --git a/pkgs/development/libraries/gdk-pixbuf/default.nix b/pkgs/development/libraries/gdk-pixbuf/default.nix index b45b578eac0e4..3d297fc9d505c 100644 --- a/pkgs/development/libraries/gdk-pixbuf/default.nix +++ b/pkgs/development/libraries/gdk-pixbuf/default.nix @@ -98,6 +98,10 @@ in stdenv.mkDerivation rec { # gdk_pixbuf_moduledir variable from gdk-pixbuf-2.0.pc moduleDir = "lib/gdk-pixbuf-2.0/2.10.0/loaders"; + cacheFile = "lib/gdk-pixbuf-2.0/2.10.0/loaders.cache"; + propagateEnv = { + GI_TYPELIB_PATH = "@out@/lib/girepository-1.0"; + }; }; meta = with stdenv.lib; { diff --git a/pkgs/development/libraries/gobject-introspection/default.nix b/pkgs/development/libraries/gobject-introspection/default.nix index b9303bd5731eb..8156e1a765bdf 100644 --- a/pkgs/development/libraries/gobject-introspection/default.nix +++ b/pkgs/development/libraries/gobject-introspection/default.nix @@ -72,6 +72,9 @@ stdenv.mkDerivation rec { updateScript = gnome3.updateScript { packageName = pname; }; + propagateEnv = { + GI_TYPELIB_PATH = "@out@/lib/girepository-1.0"; + }; }; meta = with stdenv.lib; { diff --git a/pkgs/development/libraries/gsettings-desktop-schemas/default.nix b/pkgs/development/libraries/gsettings-desktop-schemas/default.nix index a23027946a491..b6aee0f4c1030 100644 --- a/pkgs/development/libraries/gsettings-desktop-schemas/default.nix +++ b/pkgs/development/libraries/gsettings-desktop-schemas/default.nix @@ -16,6 +16,10 @@ stdenv.mkDerivation rec { passthru = { updateScript = gnome3.updateScript { packageName = "gsettings-desktop-schemas"; }; + propagateEnv = { + XDG_DATA_DIRS = "@out@/share/gsettings-schemas/${pname}-${version}"; + GI_TYPELIB_PATH = "@out@/lib/girepository-1.0"; + }; }; # meson installs the schemas to share/glib-2.0/schemas diff --git a/pkgs/development/libraries/gstreamer/bad/default.nix b/pkgs/development/libraries/gstreamer/bad/default.nix index ae5fd7531325f..a43ec17c2b8c9 100644 --- a/pkgs/development/libraries/gstreamer/bad/default.nix +++ b/pkgs/development/libraries/gstreamer/bad/default.nix @@ -278,6 +278,12 @@ in stdenv.mkDerivation rec { # that trip up clang with format security enabled. hardeningDisable = [ "format" ]; + passthru = { + propagateEnv = { + GST_PLUGIN_SYSTEM_PATH_1_0 = "@out@/lib/gstreamer-1.0"; + }; + }; + doCheck = false; # fails 20 out of 58 tests, expensive meta = with stdenv.lib; { diff --git a/pkgs/development/libraries/gstreamer/base/default.nix b/pkgs/development/libraries/gstreamer/base/default.nix index 79405e5077e03..02cbe7326f3d1 100644 --- a/pkgs/development/libraries/gstreamer/base/default.nix +++ b/pkgs/development/libraries/gstreamer/base/default.nix @@ -135,6 +135,9 @@ stdenv.mkDerivation rec { doCheck = false; # fails, wants DRI access for OpenGL passthru = { + propagateEnv = { + GST_PLUGIN_SYSTEM_PATH_1_0 = "@out@/lib/gstreamer-1.0"; + }; # Downstream `gst-*` packages depending on `gst-plugins-base` # have meson build options like 'gl' etc. that depend # on these features being built in `-base`. diff --git a/pkgs/development/libraries/gstreamer/core/default.nix b/pkgs/development/libraries/gstreamer/core/default.nix index 67a0aa9f3f890..b49f0f8e5956e 100644 --- a/pkgs/development/libraries/gstreamer/core/default.nix +++ b/pkgs/development/libraries/gstreamer/core/default.nix @@ -100,6 +100,12 @@ stdenv.mkDerivation rec { moveToOutput "share/bash-completion" "$dev" ''; + passthru = { + propagateEnv = { + GST_PLUGIN_SYSTEM_PATH_1_0 = "@out@/lib/gstreamer-1.0"; + }; + }; + setupHook = ./setup-hook.sh; meta = with lib ;{ diff --git a/pkgs/development/libraries/gstreamer/ges/default.nix b/pkgs/development/libraries/gstreamer/ges/default.nix index af2579d0594bb..2c2c7495c50c2 100644 --- a/pkgs/development/libraries/gstreamer/ges/default.nix +++ b/pkgs/development/libraries/gstreamer/ges/default.nix @@ -55,6 +55,12 @@ stdenv.mkDerivation rec { sed -i -r -e 's/p(bad|good) = .*/p\1 = pbase/' tests/check/meson.build ''; + passthru = { + propagateEnv = { + GST_PLUGIN_SYSTEM_PATH_1_0 = "@out@/lib/gstreamer-1.0"; + }; + }; + meta = with stdenv.lib; { description = "Library for creation of audio/video non-linear editors"; homepage = "https://gstreamer.freedesktop.org"; diff --git a/pkgs/development/libraries/gstreamer/good/default.nix b/pkgs/development/libraries/gstreamer/good/default.nix index a7c2bcf838e7b..8ef2abf21156e 100644 --- a/pkgs/development/libraries/gstreamer/good/default.nix +++ b/pkgs/development/libraries/gstreamer/good/default.nix @@ -136,6 +136,12 @@ stdenv.mkDerivation rec { # fails 1 tests with "Unexpected critical/warning: g_object_set_is_valid_property: object class 'GstRtpStorage' has no property named ''" doCheck = false; + passthru = { + propagateEnv = { + GST_PLUGIN_SYSTEM_PATH_1_0 = "@out@/lib/gstreamer-1.0"; + }; + }; + meta = with stdenv.lib; { description = "GStreamer Good Plugins"; homepage = "https://gstreamer.freedesktop.org"; diff --git a/pkgs/development/libraries/gstreamer/libav/default.nix b/pkgs/development/libraries/gstreamer/libav/default.nix index e36eba3700712..b800ac6c321ab 100644 --- a/pkgs/development/libraries/gstreamer/libav/default.nix +++ b/pkgs/development/libraries/gstreamer/libav/default.nix @@ -37,6 +37,12 @@ stdenv.mkDerivation rec { libav ]; + passthru = { + propagateEnv = { + GST_PLUGIN_SYSTEM_PATH_1_0 = "@out@/lib/gstreamer-1.0"; + }; + }; + meta = with lib; { description = "FFmpeg/libav plugin for GStreamer"; homepage = "https://gstreamer.freedesktop.org"; diff --git a/pkgs/development/libraries/gstreamer/ugly/default.nix b/pkgs/development/libraries/gstreamer/ugly/default.nix index d8c36fa40705c..2c4ab2615c32f 100644 --- a/pkgs/development/libraries/gstreamer/ugly/default.nix +++ b/pkgs/development/libraries/gstreamer/ugly/default.nix @@ -55,6 +55,12 @@ stdenv.mkDerivation rec { DiskArbitration ]); + passthru = { + propagateEnv = { + GST_PLUGIN_SYSTEM_PATH_1_0 = "@out@/lib/gstreamer-1.0"; + }; + }; + mesonFlags = [ "-Dexamples=disabled" # requires many dependencies and probably not useful for our users "-Dsidplay=disabled" # sidplay / sidplay/player.h isn't packaged in nixpkgs as of writing diff --git a/pkgs/development/libraries/gstreamer/vaapi/default.nix b/pkgs/development/libraries/gstreamer/vaapi/default.nix index cac56f64cc91c..2095378654d8d 100644 --- a/pkgs/development/libraries/gstreamer/vaapi/default.nix +++ b/pkgs/development/libraries/gstreamer/vaapi/default.nix @@ -62,6 +62,12 @@ stdenv.mkDerivation rec { "-Dexamples=disabled" # requires many dependencies and probably not useful for our users ]; + passthru = { + propagateEnv = { + GST_PLUGIN_SYSTEM_PATH_1_0 = "@out@/lib/gstreamer-1.0"; + }; + }; + meta = with stdenv.lib; { description = "Set of VAAPI GStreamer Plug-ins"; homepage = "https://gstreamer.freedesktop.org"; diff --git a/pkgs/development/libraries/gtk/3.x.nix b/pkgs/development/libraries/gtk/3.x.nix index fc3d79891e44c..0ca84923f5e1c 100644 --- a/pkgs/development/libraries/gtk/3.x.nix +++ b/pkgs/development/libraries/gtk/3.x.nix @@ -189,6 +189,10 @@ stdenv.mkDerivation rec { packageName = "gtk+"; attrPath = "gtk3"; }; + propagateEnv = { + XDG_DATA_DIRS = "@out@/share/gsettings-schemas/${pname}-${version}"; + GI_TYPELIB_PATH = "@out@/lib/girepository-1.0"; + }; }; meta = { diff --git a/pkgs/development/libraries/gvfs/default.nix b/pkgs/development/libraries/gvfs/default.nix index 1caed4cacf7aa..9904e40550ab7 100644 --- a/pkgs/development/libraries/gvfs/default.nix +++ b/pkgs/development/libraries/gvfs/default.nix @@ -120,6 +120,9 @@ stdenv.mkDerivation rec { updateScript = gnome3.updateScript { packageName = pname; }; + propagateEnv = { + GIO_EXTRA_MODULES = "@out@/lib/gio/modules"; + }; }; meta = with stdenv.lib; { diff --git a/pkgs/development/libraries/librsvg/default.nix b/pkgs/development/libraries/librsvg/default.nix index 911286efb7fc5..1f45849e04611 100644 --- a/pkgs/development/libraries/librsvg/default.nix +++ b/pkgs/development/libraries/librsvg/default.nix @@ -76,6 +76,10 @@ stdenv.mkDerivation rec { updateScript = gnome3.updateScript { packageName = pname; }; + propagateEnv = { + GDK_PIXBUF_MODULE_FILE = "@out@/${gdk-pixbuf.cacheFile}"; + GI_TYPELIB_PATH = "@out@/lib/girepository-1.0"; + }; }; meta = with stdenv.lib; { diff --git a/pkgs/development/libraries/pango/default.nix b/pkgs/development/libraries/pango/default.nix index 358ae3df99112..0e142cf1023b6 100644 --- a/pkgs/development/libraries/pango/default.nix +++ b/pkgs/development/libraries/pango/default.nix @@ -54,6 +54,9 @@ in stdenv.mkDerivation rec { updateScript = gnome3.updateScript { packageName = pname; }; + propagateEnv = { + GI_TYPELIB_PATH = "@out@/lib/girepository-1.0"; + }; }; meta = with stdenv.lib; { diff --git a/pkgs/development/libraries/qt-5/modules/qtbase.nix b/pkgs/development/libraries/qt-5/modules/qtbase.nix index a4c12793abb3b..77eab41278efd 100644 --- a/pkgs/development/libraries/qt-5/modules/qtbase.nix +++ b/pkgs/development/libraries/qt-5/modules/qtbase.nix @@ -35,7 +35,7 @@ let if compareVersion "5.12.4" < 0 then ".qmake.cache" else ".qmake.stash"; in -stdenv.mkDerivation { +stdenv.mkDerivation rec { name = "qtbase-${version}"; inherit qtCompatVersion src version; @@ -161,6 +161,12 @@ stdenv.mkDerivation { qtPluginPrefix = "lib/qt-${qtCompatVersion}/plugins"; qtQmlPrefix = "lib/qt-${qtCompatVersion}/qml"; qtDocPrefix = "share/doc/qt-${qtCompatVersion}"; + passthru = { + propagateEnv = { + QT_PLUGIN_PATH = "@bin@/${qtPluginPrefix}"; + # QML2_IMPORT_PATH = "@bin@/${qtQmlPrefix}"; + }; + }; setOutputFlags = false; preConfigure = '' diff --git a/pkgs/development/libraries/qt-5/modules/qtcharts.nix b/pkgs/development/libraries/qt-5/modules/qtcharts.nix index 84d3a17ea8cef..14ebe8d69948a 100644 --- a/pkgs/development/libraries/qt-5/modules/qtcharts.nix +++ b/pkgs/development/libraries/qt-5/modules/qtcharts.nix @@ -4,4 +4,10 @@ qtModule { name = "qtcharts"; qtInputs = [ qtbase qtdeclarative ]; outputs = [ "out" "dev" "bin" ]; + passthru = { + propagateEnv = { + QT_PLUGIN_PATH = "@bin@/${qtbase.qtPluginPrefix}"; + QML2_IMPORT_PATH = "@bin@/${qtbase.qtQmlPrefix}"; + }; + }; } diff --git a/pkgs/development/libraries/qt-5/modules/qtdeclarative.nix b/pkgs/development/libraries/qt-5/modules/qtdeclarative.nix index b611282294c65..889b56f268f45 100644 --- a/pkgs/development/libraries/qt-5/modules/qtdeclarative.nix +++ b/pkgs/development/libraries/qt-5/modules/qtdeclarative.nix @@ -23,4 +23,10 @@ qtModule { "bin/qmlscene" "bin/qmltestrunner" ]; + passthru = { + propagateEnv = { + QT_PLUGIN_PATH = "@bin@/${qtbase.qtPluginPrefix}"; + QML2_IMPORT_PATH = "@bin@/${qtbase.qtQmlPrefix}"; + }; + }; } diff --git a/pkgs/development/libraries/qt-5/modules/qtmultimedia.nix b/pkgs/development/libraries/qt-5/modules/qtmultimedia.nix index d0bab88b2f214..6919ed9328f53 100644 --- a/pkgs/development/libraries/qt-5/modules/qtmultimedia.nix +++ b/pkgs/development/libraries/qt-5/modules/qtmultimedia.nix @@ -13,4 +13,10 @@ qtModule { outputs = [ "bin" "dev" "out" ]; qmakeFlags = [ "GST_VERSION=1.0" ]; NIX_LDFLAGS = optionalString (stdenv.isDarwin) "-lobjc"; + passthru = { + propagateEnv = { + QT_PLUGIN_PATH = "@bin@/${qtbase.qtPluginPrefix}"; + QML2_IMPORT_PATH = "@bin@/${qtbase.qtQmlPrefix}"; + }; + }; } diff --git a/pkgs/development/libraries/qt-5/modules/qtquickcontrols2.nix b/pkgs/development/libraries/qt-5/modules/qtquickcontrols2.nix index a9522f4b1f0cd..e2794c6ccb7e1 100644 --- a/pkgs/development/libraries/qt-5/modules/qtquickcontrols2.nix +++ b/pkgs/development/libraries/qt-5/modules/qtquickcontrols2.nix @@ -1,7 +1,13 @@ -{ qtModule, qtdeclarative }: +{ qtModule, qtdeclarative, qtbase }: qtModule { name = "qtquickcontrols2"; qtInputs = [ qtdeclarative ]; outputs = [ "out" "dev" "bin" ]; + passthru = { + propagateEnv = { + # QT_PLUGIN_PATH = "@bin@/${qtbase.qtPluginPrefix}"; + QML2_IMPORT_PATH = "@bin@/${qtbase.qtQmlPrefix}"; + }; + }; } diff --git a/pkgs/development/libraries/qt-5/modules/qtsvg.nix b/pkgs/development/libraries/qt-5/modules/qtsvg.nix index 3ce68e56e4126..827d0f4c1ec9f 100644 --- a/pkgs/development/libraries/qt-5/modules/qtsvg.nix +++ b/pkgs/development/libraries/qt-5/modules/qtsvg.nix @@ -4,4 +4,10 @@ qtModule { name = "qtsvg"; qtInputs = [ qtbase ]; outputs = [ "out" "dev" "bin" ]; + passthru = { + propagateEnv = { + QT_PLUGIN_PATH = "@bin@/${qtbase.qtPluginPrefix}"; + # QML2_IMPORT_PATH = "@bin@/${qtbase.qtQmlPrefix}"; + }; + }; } diff --git a/pkgs/development/libraries/qt-5/modules/qtwayland.nix b/pkgs/development/libraries/qt-5/modules/qtwayland.nix index c7a7704f28372..0a848b2b11b87 100644 --- a/pkgs/development/libraries/qt-5/modules/qtwayland.nix +++ b/pkgs/development/libraries/qt-5/modules/qtwayland.nix @@ -6,4 +6,10 @@ qtModule { buildInputs = [ wayland ]; nativeBuildInputs = [ pkgconfig ]; outputs = [ "out" "dev" "bin" ]; + passthru = { + propagateEnv = { + QT_PLUGIN_PATH = "@bin@/${qtbase.qtPluginPrefix}"; + QML2_IMPORT_PATH = "@bin@/${qtbase.qtQmlPrefix}"; + }; + }; } diff --git a/pkgs/development/python-modules/Babel/default.nix b/pkgs/development/python-modules/Babel/default.nix index 1074d2eef48c8..d25ad2a4ba71a 100644 --- a/pkgs/development/python-modules/Babel/default.nix +++ b/pkgs/development/python-modules/Babel/default.nix @@ -1,4 +1,4 @@ -{ stdenv, lib, buildPythonPackage, fetchPypi, fetchpatch, pytz, pytest, freezegun, glibcLocales }: +{ stdenv, python, lib, buildPythonPackage, fetchPypi, fetchpatch, pytz, pytest, freezegun, glibcLocales }: buildPythonPackage rec { pname = "Babel"; @@ -29,6 +29,11 @@ buildPythonPackage rec { sha256 = "09yny8614knr8ngrrddmqzkxk70am135rccv2ncc6dji4xbqbfln"; }) ]; + passthru = { + propagateEnv = { + NIX_PYTHONPATH = "@out@/${python.sitePackages}"; + }; + }; propagatedBuildInputs = [ pytz ]; diff --git a/pkgs/development/python-modules/alabaster/default.nix b/pkgs/development/python-modules/alabaster/default.nix index d54741b63ea2c..1c4be72668d87 100644 --- a/pkgs/development/python-modules/alabaster/default.nix +++ b/pkgs/development/python-modules/alabaster/default.nix @@ -1,4 +1,4 @@ -{ stdenv, buildPythonPackage, fetchPypi +{ stdenv, buildPythonPackage, fetchPypi, python , pygments }: buildPythonPackage rec { @@ -14,6 +14,11 @@ buildPythonPackage rec { # No tests included doCheck = false; + passthru = { + propagateEnv = { + NIX_PYTHONPATH = "@out@/${python.sitePackages}"; + }; + }; meta = with stdenv.lib; { homepage = "https://github.com/bitprophet/alabaster"; diff --git a/pkgs/development/python-modules/certifi/default.nix b/pkgs/development/python-modules/certifi/default.nix index 35df76e68cdbe..fc85208742044 100644 --- a/pkgs/development/python-modules/certifi/default.nix +++ b/pkgs/development/python-modules/certifi/default.nix @@ -1,6 +1,7 @@ { lib , fetchPypi , buildPythonPackage +, python }: buildPythonPackage rec { @@ -11,6 +12,11 @@ buildPythonPackage rec { inherit pname version; sha256 = "25b64c7da4cd7479594d035c08c2d809eb4aab3a26e5a990ea98cc450c320f1f"; }; + passthru = { + propagateEnv = { + NIX_PYTHONPATH = "@out@/${python.sitePackages}"; + }; + }; meta = { homepage = "http://certifi.io/"; diff --git a/pkgs/development/python-modules/chardet/default.nix b/pkgs/development/python-modules/chardet/default.nix index 1a8b1f36e998c..7794df8e2d76b 100644 --- a/pkgs/development/python-modules/chardet/default.nix +++ b/pkgs/development/python-modules/chardet/default.nix @@ -1,4 +1,4 @@ -{ stdenv, buildPythonPackage, fetchPypi, fetchpatch +{ stdenv, buildPythonPackage, fetchPypi, fetchpatch, python , pytest, pytestrunner, hypothesis }: buildPythonPackage rec { @@ -9,6 +9,11 @@ buildPythonPackage rec { inherit pname version; sha256 = "1bpalpia6r5x1kknbk11p1fzph56fmmnp405ds8icksd3knr5aw4"; }; + passthru = { + propagateEnv = { + NIX_PYTHONPATH = "@out@/${python.sitePackages}"; + }; + }; patches = [ # Add pytest 4 support. See: https://github.com/chardet/chardet/pull/174 diff --git a/pkgs/development/python-modules/cycler/default.nix b/pkgs/development/python-modules/cycler/default.nix index 643a57e259ff5..ea267d1d37736 100644 --- a/pkgs/development/python-modules/cycler/default.nix +++ b/pkgs/development/python-modules/cycler/default.nix @@ -27,6 +27,12 @@ buildPythonPackage rec { # https://github.com/matplotlib/cycler/issues/31 doCheck = false; + passthru = { + propagateEnv = { + NIX_PYTHONPATH = "@out@/${python.sitePackages}"; + }; + }; + meta = { description = "Composable style cycles"; homepage = "https://github.com/matplotlib/cycler"; diff --git a/pkgs/development/python-modules/dateutil/default.nix b/pkgs/development/python-modules/dateutil/default.nix index 88024265d9482..93062a57fa071 100644 --- a/pkgs/development/python-modules/dateutil/default.nix +++ b/pkgs/development/python-modules/dateutil/default.nix @@ -1,4 +1,4 @@ -{ stdenv, buildPythonPackage, fetchPypi, six, setuptools_scm, pytest }: +{ stdenv, buildPythonPackage, fetchPypi, six, setuptools_scm, pytest, python }: buildPythonPackage rec { pname = "python-dateutil"; version = "2.8.1"; @@ -17,6 +17,11 @@ buildPythonPackage rec { # Requires fixing doCheck = false; + passthru = { + propagateEnv = { + NIX_PYTHONPATH = "@out@/${python.sitePackages}"; + }; + }; meta = with stdenv.lib; { description = "Powerful extensions to the standard datetime module"; diff --git a/pkgs/development/python-modules/dbus/default.nix b/pkgs/development/python-modules/dbus/default.nix index 855ee930b7725..23a4e1c3421e3 100644 --- a/pkgs/development/python-modules/dbus/default.nix +++ b/pkgs/development/python-modules/dbus/default.nix @@ -19,6 +19,12 @@ buildPythonPackage rec { disabled = isPyPy; + passthru = { + propagateEnv = { + NIX_PYTHONPATH = "@out@/${python.sitePackages}"; + }; + }; + nativeBuildInputs = [ pkgconfig ]; buildInputs = [ dbus dbus-glib ] # My guess why it's sometimes trying to -lncurses. diff --git a/pkgs/development/python-modules/discid/default.nix b/pkgs/development/python-modules/discid/default.nix index 2684d4a06a911..d37c0ebea5f20 100644 --- a/pkgs/development/python-modules/discid/default.nix +++ b/pkgs/development/python-modules/discid/default.nix @@ -1,4 +1,4 @@ -{ stdenv, libdiscid, buildPythonPackage, fetchPypi }: +{ stdenv, libdiscid, buildPythonPackage, fetchPypi, python }: buildPythonPackage rec { pname = "discid"; @@ -8,6 +8,11 @@ buildPythonPackage rec { inherit pname version; sha256 = "1fc6kvnqwaz9lrs2qgsp8wh0nabf49010r0r53wnsmpmafy315nd"; }; + passthru = { + propagateEnv = { + NIX_PYTHONPATH = "@out@/${python.sitePackages}"; + }; + }; patchPhase = let extension = stdenv.hostPlatform.extensions.sharedLibrary; in diff --git a/pkgs/development/python-modules/docutils/default.nix b/pkgs/development/python-modules/docutils/default.nix index 8c1fb3720ca12..54db9e15cd893 100644 --- a/pkgs/development/python-modules/docutils/default.nix +++ b/pkgs/development/python-modules/docutils/default.nix @@ -21,6 +21,11 @@ buildPythonPackage rec { checkPhase = lib.optionalString (isPy3k && stdenv.isDarwin) ''LANG="en_US.UTF-8" LC_ALL="en_US.UTF-8" '' + '' ${python.interpreter} test/alltests.py ''; + passthru = { + propagateEnv = { + NIX_PYTHONPATH = "@out@/${python.sitePackages}"; + }; + }; # Create symlinks lacking a ".py" suffix, many programs depend on these names postFixup = '' diff --git a/pkgs/development/python-modules/html5lib/default.nix b/pkgs/development/python-modules/html5lib/default.nix index 81042ac340983..6ebf1b77c8882 100644 --- a/pkgs/development/python-modules/html5lib/default.nix +++ b/pkgs/development/python-modules/html5lib/default.nix @@ -7,6 +7,7 @@ , mock , six , webencodings +, python }: buildPythonPackage rec { @@ -29,6 +30,11 @@ buildPythonPackage rec { rm html5lib/tests/test_stream.py py.test ''; + passthru = { + propagateEnv = { + NIX_PYTHONPATH = "@out@/${python.sitePackages}"; + }; + }; meta = { homepage = "https://github.com/html5lib/html5lib-python"; diff --git a/pkgs/development/python-modules/idna/default.nix b/pkgs/development/python-modules/idna/default.nix index 5e5d623ff10e8..54d357750d5d8 100644 --- a/pkgs/development/python-modules/idna/default.nix +++ b/pkgs/development/python-modules/idna/default.nix @@ -1,6 +1,7 @@ { lib , buildPythonPackage , fetchPypi +, python }: buildPythonPackage rec { @@ -11,10 +12,15 @@ buildPythonPackage rec { inherit pname version; sha256 = "c357b3f628cf53ae2c4c05627ecc484553142ca23264e593d327bcde5e9c3407"; }; + passthru = { + propagateEnv = { + NIX_PYTHONPATH = "@out@/${python.sitePackages}"; + }; + }; meta = { homepage = "https://github.com/kjd/idna/"; description = "Internationalized Domain Names in Applications (IDNA)"; license = lib.licenses.bsd3; }; -} \ No newline at end of file +} diff --git a/pkgs/development/python-modules/imagesize/default.nix b/pkgs/development/python-modules/imagesize/default.nix index aa7f1ea472491..a711eff68f981 100644 --- a/pkgs/development/python-modules/imagesize/default.nix +++ b/pkgs/development/python-modules/imagesize/default.nix @@ -1,6 +1,7 @@ { stdenv , buildPythonPackage , fetchPypi +, python }: buildPythonPackage rec { @@ -11,6 +12,11 @@ buildPythonPackage rec { inherit pname version; sha256 = "f3832918bc3c66617f92e35f5d70729187676313caa60c187eb0f28b8fe5e3b5"; }; + passthru = { + propagateEnv = { + NIX_PYTHONPATH = "@out@/${python.sitePackages}"; + }; + }; meta = with stdenv.lib; { description = "Getting image size from png/jpeg/jpeg2000/gif file"; diff --git a/pkgs/development/python-modules/jinja2/default.nix b/pkgs/development/python-modules/jinja2/default.nix index 87c44d11a8c8d..28d77b90ff6d4 100644 --- a/pkgs/development/python-modules/jinja2/default.nix +++ b/pkgs/development/python-modules/jinja2/default.nix @@ -3,6 +3,7 @@ , isPy3k , fetchPypi , pytest +, python , markupsafe }: buildPythonPackage rec { @@ -24,6 +25,11 @@ buildPythonPackage rec { checkPhase = '' pytest -v tests ''; + passthru = { + propagateEnv = { + NIX_PYTHONPATH = "@out@/${python.sitePackages}"; + }; + }; meta = with stdenv.lib; { homepage = "http://jinja.pocoo.org/"; diff --git a/pkgs/development/python-modules/kiwisolver/default.nix b/pkgs/development/python-modules/kiwisolver/default.nix index c54cad1987aa8..1a1d341fe586f 100644 --- a/pkgs/development/python-modules/kiwisolver/default.nix +++ b/pkgs/development/python-modules/kiwisolver/default.nix @@ -3,6 +3,7 @@ , fetchPypi , stdenv , libcxx +, python }: buildPythonPackage rec { @@ -18,6 +19,11 @@ buildPythonPackage rec { # Does not include tests doCheck = false; + passthru = { + propagateEnv = { + NIX_PYTHONPATH = "@out@/${python.sitePackages}"; + }; + }; meta = { description = "A fast implementation of the Cassowary constraint solver"; diff --git a/pkgs/development/python-modules/matplotlib/default.nix b/pkgs/development/python-modules/matplotlib/default.nix index 658388eabae4a..822283ee91b18 100644 --- a/pkgs/development/python-modules/matplotlib/default.nix +++ b/pkgs/development/python-modules/matplotlib/default.nix @@ -34,9 +34,7 @@ buildPythonPackage rec { XDG_RUNTIME_DIR = "/tmp"; - nativeBuildInputs = [ pkgconfig ]; - - buildInputs = [ python which sphinx stdenv ] + nativeBuildInputs = [ pkgconfig python which sphinx stdenv ] ++ stdenv.lib.optional enableGhostscript ghostscript ++ stdenv.lib.optional stdenv.isDarwin [ Cocoa ]; @@ -48,6 +46,12 @@ buildPythonPackage rec { ++ stdenv.lib.optionals enableTk [ tcl tk tkinter libX11 ] ++ stdenv.lib.optionals enableQt [ pyqt5 ]; + passthru = { + propagateEnv = { + NIX_PYTHONPATH = "@out@/${python.sitePackages}"; + }; + }; + patches = [ ./basedirlist.patch ]; diff --git a/pkgs/development/python-modules/mock/default.nix b/pkgs/development/python-modules/mock/default.nix index de1ff58243e67..b07843c684e1a 100644 --- a/pkgs/development/python-modules/mock/default.nix +++ b/pkgs/development/python-modules/mock/default.nix @@ -28,6 +28,11 @@ buildPythonPackage rec { checkPhase = '' ${python.interpreter} -m unittest discover ''; + passthru = { + propagateEnv = { + NIX_PYTHONPATH = "@out@/${python.sitePackages}"; + }; + }; meta = with lib; { description = "Mock objects for Python"; diff --git a/pkgs/development/python-modules/mutagen/default.nix b/pkgs/development/python-modules/mutagen/default.nix index 304aeead76ff0..dacc2f5fd3a0b 100644 --- a/pkgs/development/python-modules/mutagen/default.nix +++ b/pkgs/development/python-modules/mutagen/default.nix @@ -8,6 +8,7 @@ , pytest , setuptools , pkgs +, python }: buildPythonPackage rec { @@ -25,6 +26,12 @@ buildPythonPackage rec { pkgs.glibcLocales pycodestyle pyflakes pytest hypothesis ]; LC_ALL = "en_US.UTF-8"; + passthru = { + propagateEnv = { + NIX_PYTHONPATH = "@out@/${python.sitePackages}"; + }; + }; + meta = with lib; { description = "Python multimedia tagging library"; diff --git a/pkgs/development/python-modules/numpy/default.nix b/pkgs/development/python-modules/numpy/default.nix index a863ef60d4aa7..9986b081a9147 100644 --- a/pkgs/development/python-modules/numpy/default.nix +++ b/pkgs/development/python-modules/numpy/default.nix @@ -70,6 +70,9 @@ in buildPythonPackage rec { passthru = { blas = blas; inherit blasImplementation cfg; + propagateEnv = { + NIX_PYTHONPATH = "@out@/${python.sitePackages}"; + }; }; # Disable test diff --git a/pkgs/development/python-modules/pycairo/default.nix b/pkgs/development/python-modules/pycairo/default.nix index fbefd7efefa66..03a3aaf60e2c7 100644 --- a/pkgs/development/python-modules/pycairo/default.nix +++ b/pkgs/development/python-modules/pycairo/default.nix @@ -1,4 +1,4 @@ -{ lib, fetchFromGitHub, meson, ninja, buildPythonPackage, pytest, pkgconfig, cairo, xlibsWrapper, isPy33, isPy3k }: +{ lib, fetchFromGitHub, meson, ninja, buildPythonPackage, pytest, python, pkgconfig, cairo, xlibsWrapper, isPy33, isPy3k }: buildPythonPackage rec { pname = "pycairo"; @@ -26,6 +26,12 @@ buildPythonPackage rec { xlibsWrapper ]; + passthru = { + propagateEnv = { + NIX_PYTHONPATH = "@out@/${python.sitePackages}"; + }; + }; + checkInputs = [ pytest ]; mesonFlags = [ "-Dpython=${if isPy3k then "python3" else "python"}" ]; diff --git a/pkgs/development/python-modules/pygobject/3.nix b/pkgs/development/python-modules/pygobject/3.nix index 2a1b8bcb4105f..a0916d6444833 100644 --- a/pkgs/development/python-modules/pygobject/3.nix +++ b/pkgs/development/python-modules/pygobject/3.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, buildPythonPackage, pkgconfig, glib, gobject-introspection, +{ stdenv, fetchurl, buildPythonPackage, pkgconfig, glib, gobject-introspection, python, pycairo, cairo, which, ncurses, meson, ninja, isPy3k, gnome3 }: buildPythonPackage rec { @@ -28,6 +28,9 @@ buildPythonPackage rec { packageName = pname; attrPath = "python3.pkgs.${pname}3"; }; + propagateEnv = { + NIX_PYTHONPATH = "@out@/${python.sitePackages}"; + }; }; meta = with stdenv.lib; { diff --git a/pkgs/development/python-modules/pyparsing/default.nix b/pkgs/development/python-modules/pyparsing/default.nix index 4acc4fa804b36..5dae0cc9e3a58 100644 --- a/pkgs/development/python-modules/pyparsing/default.nix +++ b/pkgs/development/python-modules/pyparsing/default.nix @@ -1,7 +1,7 @@ { buildPythonPackage , fetchFromGitHub , lib - +, python # pythonPackages , coverage }: @@ -23,6 +23,11 @@ buildPythonPackage rec { coverage run --branch simple_unit_tests.py coverage run --branch unitTests.py ''; + passthru = { + propagateEnv = { + NIX_PYTHONPATH = "@out@/${python.sitePackages}"; + }; + }; meta = with lib; { homepage = "https://github.com/pyparsing/pyparsing"; diff --git a/pkgs/development/python-modules/pyqt/5.x.nix b/pkgs/development/python-modules/pyqt/5.x.nix index 52b27638ac72e..94573672a62dc 100644 --- a/pkgs/development/python-modules/pyqt/5.x.nix +++ b/pkgs/development/python-modules/pyqt/5.x.nix @@ -88,7 +88,7 @@ in buildPythonPackage rec { configurePhase = '' runHook preConfigure - export PYTHONPATH=$PYTHONPATH:$out/${python.sitePackages} + export NIX_PYTHONPATH=$NIX_PYTHONPATH:$out/${python.sitePackages} ${python.executable} configure.py -w \ --confirm-license \ @@ -106,7 +106,7 @@ in buildPythonPackage rec { postInstall = '' ln -s ${sip}/${python.sitePackages}/PyQt5/sip.* $out/${python.sitePackages}/PyQt5/ for i in $out/bin/*; do - wrapProgram $i --prefix PYTHONPATH : "$PYTHONPATH" + wrapProgram $i --prefix NIX_PYTHONPATH : "$NIX_PYTHONPATH" done # Let's make it a namespace package @@ -135,6 +135,12 @@ in buildPythonPackage rec { ${python.interpreter} -c "${imports}" ''; + passthru = { + propagateEnv = { + NIX_PYTHONPATH = "@out@/${python.sitePackages}"; + }; + }; + doCheck = true; enableParallelBuilding = true; diff --git a/pkgs/development/python-modules/pytz/default.nix b/pkgs/development/python-modules/pytz/default.nix index e7ce3b62b5b8d..dd46a80162901 100644 --- a/pkgs/development/python-modules/pytz/default.nix +++ b/pkgs/development/python-modules/pytz/default.nix @@ -12,6 +12,11 @@ buildPythonPackage rec { checkPhase = '' ${python.interpreter} -m unittest discover -s pytz/tests ''; + passthru = { + propagateEnv = { + NIX_PYTHONPATH = "@out@/${python.sitePackages}"; + }; + }; meta = with lib; { description = "World timezone definitions, modern and historical"; diff --git a/pkgs/development/python-modules/requests/default.nix b/pkgs/development/python-modules/requests/default.nix index 3d216e4bc44f8..064c5c4446052 100644 --- a/pkgs/development/python-modules/requests/default.nix +++ b/pkgs/development/python-modules/requests/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchPypi, buildPythonPackage +{ stdenv, fetchPypi, buildPythonPackage, python , urllib3, idna, chardet, certifi , pytest }: @@ -10,6 +10,11 @@ buildPythonPackage rec { inherit pname version; sha256 = "11e007a8a2aa0323f5a921e9e6a2d7e4e67d9877e85773fba9ba6419025cbeb4"; }; + passthru = { + propagateEnv = { + NIX_PYTHONPATH = "@out@/${python.sitePackages}"; + }; + }; nativeBuildInputs = [ pytest ]; propagatedBuildInputs = [ urllib3 idna chardet certifi ]; diff --git a/pkgs/development/python-modules/setuptools/default.nix b/pkgs/development/python-modules/setuptools/default.nix index c4ff18697e564..c35f819bab44d 100644 --- a/pkgs/development/python-modules/setuptools/default.nix +++ b/pkgs/development/python-modules/setuptools/default.nix @@ -55,6 +55,11 @@ in buildPythonPackage rec { preBuild = lib.strings.optionalString (!stdenv.hostPlatform.isWindows) '' export SETUPTOOLS_INSTALL_WINDOWS_SPECIFIC_FILES=0 ''; + passthru = { + propagateEnv = { + NIX_PYTHONPATH = "@out@/${python.sitePackages}"; + }; + }; pipInstallFlags = [ "--ignore-installed" ]; diff --git a/pkgs/development/python-modules/simplejson/default.nix b/pkgs/development/python-modules/simplejson/default.nix index fe08f5bbe2e53..6de9b8ace649b 100644 --- a/pkgs/development/python-modules/simplejson/default.nix +++ b/pkgs/development/python-modules/simplejson/default.nix @@ -3,6 +3,7 @@ , fetchFromGitHub , stdenv , pytest +, python }: buildPythonPackage rec { @@ -24,6 +25,11 @@ buildPythonPackage rec { checkPhase = '' PYTHONWARNINGS="ignore" pytest simplejson/tests ''; + passthru = { + propagateEnv = { + NIX_PYTHONPATH = "@out@/${python.sitePackages}"; + }; + }; meta = { description = "A simple, fast, extensible JSON encoder/decoder for Python"; diff --git a/pkgs/development/python-modules/six/default.nix b/pkgs/development/python-modules/six/default.nix index 46f7f6d38b6bb..29b700d900fb1 100644 --- a/pkgs/development/python-modules/six/default.nix +++ b/pkgs/development/python-modules/six/default.nix @@ -1,6 +1,7 @@ { lib , buildPythonPackage , fetchPypi +, python , pytest }: @@ -18,6 +19,11 @@ buildPythonPackage rec { checkPhase = '' py.test test_six.py ''; + passthru = { + propagateEnv = { + NIX_PYTHONPATH = "@out@/${python.sitePackages}"; + }; + }; # To prevent infinite recursion with pytest doCheck = false; diff --git a/pkgs/development/python-modules/snowballstemmer/default.nix b/pkgs/development/python-modules/snowballstemmer/default.nix index c546fefcf5034..499b8b77b05a8 100644 --- a/pkgs/development/python-modules/snowballstemmer/default.nix +++ b/pkgs/development/python-modules/snowballstemmer/default.nix @@ -1,4 +1,4 @@ -{ stdenv, buildPythonPackage, PyStemmer, fetchPypi }: +{ stdenv, python, buildPythonPackage, PyStemmer, fetchPypi }: buildPythonPackage rec { pname = "snowballstemmer"; @@ -12,6 +12,12 @@ buildPythonPackage rec { # No tests included doCheck = false; + passthru = { + propagateEnv = { + NIX_PYTHONPATH = "@out@/${python.sitePackages}"; + }; + }; + propagatedBuildInputs = [ PyStemmer ]; meta = with stdenv.lib; { diff --git a/pkgs/development/python-modules/sphinx/default.nix b/pkgs/development/python-modules/sphinx/default.nix index 9c7d699d20f03..b3d0821583409 100644 --- a/pkgs/development/python-modules/sphinx/default.nix +++ b/pkgs/development/python-modules/sphinx/default.nix @@ -39,6 +39,11 @@ buildPythonPackage rec { sha256 = "19a28nsb0w4bs6k8rdfyk6vzrcwdpvhs2wq77rgpmww59yvndrz6"; }; LC_ALL = "en_US.UTF-8"; + passthru = { + propagateEnv = { + NIX_PYTHONPATH = "@out@/${python.sitePackages}"; + }; + }; checkInputs = [ pytest ]; buildInputs = [ simplejson mock glibcLocales html5lib ] ++ lib.optional (pythonOlder "3.4") enum34; diff --git a/pkgs/development/python-modules/tkinter/default.nix b/pkgs/development/python-modules/tkinter/default.nix index 1efebed987218..3d24d4060a674 100644 --- a/pkgs/development/python-modules/tkinter/default.nix +++ b/pkgs/development/python-modules/tkinter/default.nix @@ -23,6 +23,11 @@ buildPythonPackage { new_rpath=$(sed "s#${py}#${python}#g" <<< "$old_rpath" ) patchelf --set-rpath $new_rpath $out/${py.sitePackages}/_tkinter* ''; + passthru = { + propagateEnv = { + PYTHONPATH = "@out@/${py.sitePackages}"; + }; + }; meta = py.meta; diff --git a/pkgs/development/python-modules/tornado/default.nix b/pkgs/development/python-modules/tornado/default.nix index 102cf0fed5740..44aea604aa440 100644 --- a/pkgs/development/python-modules/tornado/default.nix +++ b/pkgs/development/python-modules/tornado/default.nix @@ -37,6 +37,11 @@ buildPythonPackage rec { checkPhase = '' ${python.interpreter} -m unittest discover *_test.py ''; + passthru = { + propagateEnv = { + NIX_PYTHONPATH = "@out@/${python.sitePackages}"; + }; + }; src = fetchPypi { inherit pname sha256 version; diff --git a/pkgs/development/python-modules/urllib3/default.nix b/pkgs/development/python-modules/urllib3/default.nix index 5abf99670c19b..04659a7942612 100644 --- a/pkgs/development/python-modules/urllib3/default.nix +++ b/pkgs/development/python-modules/urllib3/default.nix @@ -1,4 +1,4 @@ -{ stdenv, buildPythonPackage, fetchPypi +{ stdenv, buildPythonPackage, fetchPypi, python , pytest, mock, tornado, pyopenssl, cryptography , idna, certifi, ipaddress, pysocks }: @@ -10,6 +10,11 @@ buildPythonPackage rec { inherit pname version; sha256 = "87716c2d2a7121198ebcb7ce7cccf6ce5e9ba539041cfbaeecfb641dc0bf6acc"; }; + passthru = { + propagateEnv = { + NIX_PYTHONPATH = "@out@/${python.sitePackages}"; + }; + }; NOSE_EXCLUDE = stdenv.lib.concatStringsSep "," [ "test_headers" "test_headerdict" "test_can_validate_ip_san" "test_delayed_body_read_timeout" diff --git a/pkgs/development/python-modules/whoosh/default.nix b/pkgs/development/python-modules/whoosh/default.nix index e203cdb293441..96de28ac55e64 100644 --- a/pkgs/development/python-modules/whoosh/default.nix +++ b/pkgs/development/python-modules/whoosh/default.nix @@ -1,4 +1,4 @@ -{ stdenv, buildPythonPackage, fetchPypi, pytest }: +{ stdenv, buildPythonPackage, fetchPypi, pytest, python }: buildPythonPackage rec { pname = "Whoosh"; @@ -19,6 +19,11 @@ buildPythonPackage rec { # FIXME: test_minimize_dfa fails on python 3.6 py.test -k "not test_timelimit and not test_minimize_dfa" ''; + passthru = { + propagateEnv = { + NIX_PYTHONPATH = "@out@/${python.sitePackages}"; + }; + }; meta = with stdenv.lib; { description = "Fast, pure-Python full text indexing, search, and spell diff --git a/pkgs/tools/X11/arandr/default.nix b/pkgs/tools/X11/arandr/default.nix index 94e3ac36d078b..853d18e09bec3 100644 --- a/pkgs/tools/X11/arandr/default.nix +++ b/pkgs/tools/X11/arandr/default.nix @@ -23,6 +23,8 @@ in buildPythonApplication rec { # no tests doCheck = false; + dontWrapPythonPrograms = (wrapGAppsHook == null); + # hook for gobject-introspection doesn't like strictDeps # https://github.com/NixOS/nixpkgs/issues/56943 strictDeps = false; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index b22a35f4f5e4a..c2d31cc6e340a 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -659,7 +659,18 @@ in archivemount = callPackage ../tools/filesystems/archivemount { }; - arandr = callPackage ../tools/X11/arandr { }; + arandr-oldy-wrapped = callPackage ../tools/X11/arandr { }; + + arandr-newly-wrapped = wrapGApps ( + arandr-oldy-wrapped.override { + wrapGAppsHook = null; + }) { + wrapOut = { + XDG_DATA_DIRS = "$out/share"; + NIX_PYTHONPATH = "$out/${python3.sitePackages}"; + }; + } + ; inherit (callPackages ../servers/nosql/arangodb { stdenv = gcc8Stdenv; @@ -19748,7 +19759,7 @@ in gvisor-containerd-shim = callPackage ../applications/virtualization/gvisor/containerd-shim.nix { }; - guvcview = callPackage ../os-specific/linux/guvcview { }; + guvcview = wrapGApps (callPackage ../os-specific/linux/guvcview { }) { }; gxmessage = callPackage ../applications/misc/gxmessage { }; @@ -21191,7 +21202,44 @@ in pianobooster = qt5.callPackage ../applications/audio/pianobooster { }; - picard = callPackage ../applications/audio/picard { }; + test-new-py-env = wrapGeneric python3 { + linkByEnv = { + PYTHONPATH = "linkPkg"; + }; + extraPkgs = with python3.pkgs; [ + # Note how when you use matplot with and without qt, the environment + # calculated in `result/bin/python` has QT_PLUGIN_PATH and other env + # vars. + + # matplotlib + (matplotlib.override { + enableQt = true; + }) + ]; + }; + test-old-py-env = python3.withPackages(ps: with ps; [ + (matplotlib.override { + enableQt = true; + }) + ]); + + picard-oldy-wrapped = callPackage ../applications/audio/picard { }; + + picard-newly-wrapped = wrapGeneric ( + picard-oldy-wrapped.override { + qt5 = qt5 // { + wrapQtAppsHook = null; + }; + }) { + wrapOut = { + XDG_DATA_DIRS = "$out/share"; + NIX_PYTHONPATH = "$out/${python3.sitePackages}"; + }; + linkByEnv = { + NIX_PYTHONPATH = "linkPkg"; + }; + } + ; picocom = callPackage ../tools/misc/picocom { inherit (darwin.apple_sdk.frameworks) IOKit; @@ -22274,6 +22322,16 @@ in wrapNeovim = callPackage ../applications/editors/neovim/wrapper.nix { }; + wrapGeneric = callPackage ../build-support/neowrap.nix { lndir = xorg.lndir; }; + wrapGApps = wrapGeneric.override { + extraPkgsByOverride = [ + dconf + librsvg + gdk-pixbuf + atk + ]; + }; + neovim-unwrapped = callPackage ../applications/editors/neovim { lua = # neovim doesn't work with luajit on aarch64: https://github.com/neovim/neovim/issues/7879