From 242a7da5b7a116b374cd01523a32fa7d72c43b1e Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Fri, 10 Apr 2020 13:13:03 +0300 Subject: [PATCH 01/31] Write a prototype derivation that knows allInputs --- pkgs/build-support/neowrap.nix | 51 +++++++++++++++++++++++++++++++++ pkgs/top-level/all-packages.nix | 4 +++ 2 files changed, 55 insertions(+) create mode 100644 pkgs/build-support/neowrap.nix diff --git a/pkgs/build-support/neowrap.nix b/pkgs/build-support/neowrap.nix new file mode 100644 index 0000000000000..a6e0e02ce1221 --- /dev/null +++ b/pkgs/build-support/neowrap.nix @@ -0,0 +1,51 @@ +{ lib +, buildEnv +, jq +}: + +pkgList: + +let + wrapper = { + extraMakeWrapperArgs ? "" + }: + let + # 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.typeOf pkg) == "set" then + if builtins.hasAttr "buildInputs" pkg then + # builtins.trace "pkg is of type ${(builtins.typeOf pkg)} and it's ${(builtins.toJSON pkg)}" (getAllInputs pkg.buildInputs pkgsFound ++ [ pkg ]) + (getAllInputs pkg.buildInputs pkgsFound ++ [ pkg ]) + else + pkgsFound ++ [ pkg ] + else + # builtins.trace "pkg is not a set but a ${(builtins.typeOf pkg)} at ${(builtins.toJSON pkg)}, current pkgsFound is ${(builtins.toJSON pkgsFound)}" pkgsFound + pkgsFound + ) pkgs; + # allInputs = builtins.trace "allinputs is ${builtins.toJSON (getAllInputs pkgList [])}" (getAllInputs pkgList []); + allInputs = lib.lists.flatten (getAllInputs pkgList []); + # filter out of all the inputs the packages with the propagateEnv attribute + envPkgs = builtins.filter ( + pkg: + (builtins.hasAttr "propagateEnv" pkg) + ) allInputs; + in + buildEnv { + name = "runtime-env"; + paths = pkgList; + + buildInputs = [ jq ]; + postBuild = '' + printf '%s\n' ${builtins.concatStringsSep " " envPkgs} + exit 1 + ''; + }; +in + lib.makeOverridable wrapper diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index b22a35f4f5e4a..d2d6eb1de35cf 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -147,6 +147,10 @@ in buildFHSUserEnv = callPackage ../build-support/build-fhs-userenv { }; + wrapWithRuntimeDeps = callPackage ../build-support/neowrap.nix { }; # not actually a package + + somthing-else = wrapWithRuntimeDeps mutt { }; + buildMaven = callPackage ../build-support/build-maven.nix {}; castget = callPackage ../applications/networking/feedreaders/castget { }; From 30f26fe01f168afe96d3d756dd5bd38beb98e0ee Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Sun, 12 Apr 2020 16:49:32 +0300 Subject: [PATCH 02/31] Now %out% is string replaced --- pkgs/build-support/neowrap.nix | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/pkgs/build-support/neowrap.nix b/pkgs/build-support/neowrap.nix index a6e0e02ce1221..808345f510b1b 100644 --- a/pkgs/build-support/neowrap.nix +++ b/pkgs/build-support/neowrap.nix @@ -36,6 +36,20 @@ let pkg: (builtins.hasAttr "propagateEnv" pkg) ) allInputs; + envInfo = map ( + pkg: + (lib.attrsets.mapAttrs ( + name: + value: + # TODO: make this work with other outputs as well + builtins.replaceStrings + [ "%out%" ] + [ "${pkg.out}" ] + value + ) pkg.propagateEnv) + ) envPkgs; + envInfo_ = builtins.trace "envInfo is ${(builtins.toJSON envInfo)}" envInfo; + # envInfoFolded = lib.attrsets.foldAttrs (n: a: [n] ++ a) [] envInfo; in buildEnv { name = "runtime-env"; @@ -43,7 +57,7 @@ let buildInputs = [ jq ]; postBuild = '' - printf '%s\n' ${builtins.concatStringsSep " " envPkgs} + printf '%s\n' ${builtins.concatStringsSep " " envInfo_} exit 1 ''; }; From 112882f6ed8a98d355b86f9085d1247c8aee2e98 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Sun, 12 Apr 2020 17:31:24 +0300 Subject: [PATCH 03/31] Make more stuff work --- pkgs/build-support/neowrap.nix | 23 ++++++++++++++++--- .../gsettings-desktop-schemas/default.nix | 3 +++ pkgs/development/libraries/gtk/3.x.nix | 3 +++ pkgs/top-level/all-packages.nix | 9 ++++---- 4 files changed, 31 insertions(+), 7 deletions(-) diff --git a/pkgs/build-support/neowrap.nix b/pkgs/build-support/neowrap.nix index 808345f510b1b..f8025787da539 100644 --- a/pkgs/build-support/neowrap.nix +++ b/pkgs/build-support/neowrap.nix @@ -10,6 +10,11 @@ let extraMakeWrapperArgs ? "" }: let + # Where we keep information about every environmental variable and the + # separator between it's values + encyclopedia_of_separators = { + XDG_DATA_DIRS = ":"; + }; # 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 @@ -48,8 +53,20 @@ let value ) pkg.propagateEnv) ) envPkgs; - envInfo_ = builtins.trace "envInfo is ${(builtins.toJSON envInfo)}" envInfo; - # envInfoFolded = lib.attrsets.foldAttrs (n: a: [n] ++ a) [] envInfo; + # envInfo_ = builtins.trace "envInfo is ${(builtins.toJSON envInfo)}" envInfo; + envInfoFolded = lib.attrsets.foldAttrs (n: a: [n] ++ a) [] envInfo; + # envInfoFolded_ = builtins.trace "envInfoFolded is ${(builtins.toJSON envInfoFolded)}" envInfoFolded; + # TODO: add here also this build's $out /share (e.g) to $out + makeWrapperArgs = lib.attrsets.mapAttrsToList ( + key: + value: + (let + sep = encyclopedia_of_separators.${key}; + in + "--prefix ${key} ${sep} ${builtins.concatStringsSep sep value}" + ) + ) envInfoFolded; + # makeWrapperArgs_ = builtins.trace "makeWrapperArgs is ${(builtins.toJSON makeWrapperArgs)}" makeWrapperArgs; in buildEnv { name = "runtime-env"; @@ -57,7 +74,7 @@ let buildInputs = [ jq ]; postBuild = '' - printf '%s\n' ${builtins.concatStringsSep " " envInfo_} + printf '%s\n' '${builtins.concatStringsSep " " makeWrapperArgs_}' exit 1 ''; }; diff --git a/pkgs/development/libraries/gsettings-desktop-schemas/default.nix b/pkgs/development/libraries/gsettings-desktop-schemas/default.nix index a23027946a491..198a653c26e6f 100644 --- a/pkgs/development/libraries/gsettings-desktop-schemas/default.nix +++ b/pkgs/development/libraries/gsettings-desktop-schemas/default.nix @@ -16,6 +16,9 @@ stdenv.mkDerivation rec { passthru = { updateScript = gnome3.updateScript { packageName = "gsettings-desktop-schemas"; }; + propagateEnv = { + XDG_DATA_DIRS = "%out%/share/gsettings-schemas/${pname}-${version}"; + }; }; # meson installs the schemas to share/glib-2.0/schemas diff --git a/pkgs/development/libraries/gtk/3.x.nix b/pkgs/development/libraries/gtk/3.x.nix index fc3d79891e44c..4f9e3ffc6889c 100644 --- a/pkgs/development/libraries/gtk/3.x.nix +++ b/pkgs/development/libraries/gtk/3.x.nix @@ -189,6 +189,9 @@ stdenv.mkDerivation rec { packageName = "gtk+"; attrPath = "gtk3"; }; + propagateEnv = { + XDG_DATA_DIRS = "%out%/share/gsettings-schemas/${pname}-${version}"; + }; }; meta = { diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index d2d6eb1de35cf..de65b278675ec 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -147,10 +147,6 @@ in buildFHSUserEnv = callPackage ../build-support/build-fhs-userenv { }; - wrapWithRuntimeDeps = callPackage ../build-support/neowrap.nix { }; # not actually a package - - somthing-else = wrapWithRuntimeDeps mutt { }; - buildMaven = callPackage ../build-support/build-maven.nix {}; castget = callPackage ../applications/networking/feedreaders/castget { }; @@ -665,6 +661,9 @@ in arandr = callPackage ../tools/X11/arandr { }; + arandr-newly-unwrapped = arandr.override { wrapGAppsHook = null; }; + arandr-newly-wrapped = wrapWithEnv [ arandr-newly-unwrapped ] { }; + inherit (callPackages ../servers/nosql/arangodb { stdenv = gcc8Stdenv; }) arangodb_3_3 arangodb_3_4 arangodb_3_5; @@ -22278,6 +22277,8 @@ in wrapNeovim = callPackage ../applications/editors/neovim/wrapper.nix { }; + wrapWithEnv = callPackage ../build-support/neowrap.nix { }; # not actually a package + neovim-unwrapped = callPackage ../applications/editors/neovim { lua = # neovim doesn't work with luajit on aarch64: https://github.com/neovim/neovim/issues/7879 From 9893944c7965373227277ded38d1c2b0c72dc84e Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Sun, 12 Apr 2020 17:50:25 +0300 Subject: [PATCH 04/31] Add more passthrus and make basic functionality work The problem now is that wrapGAppsHook is smarter - it knows about packages that need certain search directories even if they are not in the dependency tree. --- pkgs/build-support/neowrap.nix | 20 ++++++++++--------- pkgs/development/libraries/atk/default.nix | 3 +++ pkgs/development/libraries/dconf/default.nix | 3 +++ .../libraries/gdk-pixbuf/default.nix | 3 +++ .../gobject-introspection/default.nix | 3 +++ .../gsettings-desktop-schemas/default.nix | 1 + pkgs/development/libraries/gtk/3.x.nix | 1 + pkgs/development/libraries/gvfs/default.nix | 3 +++ .../development/libraries/librsvg/default.nix | 4 ++++ pkgs/development/libraries/pango/default.nix | 3 +++ pkgs/top-level/all-packages.nix | 4 ++-- 11 files changed, 37 insertions(+), 11 deletions(-) diff --git a/pkgs/build-support/neowrap.nix b/pkgs/build-support/neowrap.nix index f8025787da539..0ee518413c427 100644 --- a/pkgs/build-support/neowrap.nix +++ b/pkgs/build-support/neowrap.nix @@ -1,6 +1,7 @@ { lib -, buildEnv +, symlinkJoin , jq +, makeWrapper }: pkgList: @@ -11,9 +12,9 @@ let }: let # Where we keep information about every environmental variable and the - # separator between it's values + # separator between it's values, the default value used is `:` encyclopedia_of_separators = { - XDG_DATA_DIRS = ":"; + # XDG_DATA_DIRS = ":"; }; # 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 @@ -61,21 +62,22 @@ let key: value: (let - sep = encyclopedia_of_separators.${key}; + sep = encyclopedia_of_separators.${key} or ":"; in "--prefix ${key} ${sep} ${builtins.concatStringsSep sep value}" ) ) envInfoFolded; - # makeWrapperArgs_ = builtins.trace "makeWrapperArgs is ${(builtins.toJSON makeWrapperArgs)}" makeWrapperArgs; + makeWrapperArgs_ = builtins.trace "makeWrapperArgs is ${(builtins.toJSON makeWrapperArgs)}" makeWrapperArgs; in - buildEnv { + symlinkJoin { name = "runtime-env"; paths = pkgList; - buildInputs = [ jq ]; + buildInputs = [ jq makeWrapper ]; postBuild = '' - printf '%s\n' '${builtins.concatStringsSep " " makeWrapperArgs_}' - exit 1 + for i in $out/bin/*; do + wrapProgram "$i" ${(builtins.concatStringsSep " " makeWrapperArgs_)} + done ''; }; in diff --git a/pkgs/development/libraries/atk/default.nix b/pkgs/development/libraries/atk/default.nix index 400ddd5125953..a7e7fda2b558f 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..cf462ae3fec95 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 = "%out%/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..95b39d1d2fd8f 100644 --- a/pkgs/development/libraries/gdk-pixbuf/default.nix +++ b/pkgs/development/libraries/gdk-pixbuf/default.nix @@ -98,6 +98,9 @@ in stdenv.mkDerivation rec { # gdk_pixbuf_moduledir variable from gdk-pixbuf-2.0.pc moduleDir = "lib/gdk-pixbuf-2.0/2.10.0/loaders"; + 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..aec0ce92a78d8 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 198a653c26e6f..661ef54c0e401 100644 --- a/pkgs/development/libraries/gsettings-desktop-schemas/default.nix +++ b/pkgs/development/libraries/gsettings-desktop-schemas/default.nix @@ -18,6 +18,7 @@ stdenv.mkDerivation rec { 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"; }; }; diff --git a/pkgs/development/libraries/gtk/3.x.nix b/pkgs/development/libraries/gtk/3.x.nix index 4f9e3ffc6889c..ca08d1334d16e 100644 --- a/pkgs/development/libraries/gtk/3.x.nix +++ b/pkgs/development/libraries/gtk/3.x.nix @@ -191,6 +191,7 @@ stdenv.mkDerivation rec { }; propagateEnv = { XDG_DATA_DIRS = "%out%/share/gsettings-schemas/${pname}-${version}"; + GI_TYPELIB_PATH = "%out%/lib/girepository-1.0"; }; }; diff --git a/pkgs/development/libraries/gvfs/default.nix b/pkgs/development/libraries/gvfs/default.nix index 1caed4cacf7aa..d734315868ca2 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..9232b612b8b8d 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%/lib/${gdk-pixbuf.moduleDir}/loaders.cache"; + 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..28bc5f3bfdc28 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/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index de65b278675ec..8659e9ae56f8e 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -662,7 +662,7 @@ in arandr = callPackage ../tools/X11/arandr { }; arandr-newly-unwrapped = arandr.override { wrapGAppsHook = null; }; - arandr-newly-wrapped = wrapWithEnv [ arandr-newly-unwrapped ] { }; + arandr-newly-wrapped = wrapGeneric [ arandr-newly-unwrapped ] { }; inherit (callPackages ../servers/nosql/arangodb { stdenv = gcc8Stdenv; @@ -22277,7 +22277,7 @@ in wrapNeovim = callPackage ../applications/editors/neovim/wrapper.nix { }; - wrapWithEnv = callPackage ../build-support/neowrap.nix { }; # not actually a package + wrapGeneric = callPackage ../build-support/neowrap.nix { }; # not actually a package neovim-unwrapped = callPackage ../applications/editors/neovim { lua = From 1e1464e731b8c0c78923d68e98ace2158c77c6b1 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Sun, 12 Apr 2020 18:27:21 +0300 Subject: [PATCH 05/31] Create a very much working :) wrapGApps function --- pkgs/build-support/neowrap.nix | 5 ++++- pkgs/top-level/all-packages.nix | 12 ++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/pkgs/build-support/neowrap.nix b/pkgs/build-support/neowrap.nix index 0ee518413c427..9dd650e99120a 100644 --- a/pkgs/build-support/neowrap.nix +++ b/pkgs/build-support/neowrap.nix @@ -2,12 +2,14 @@ , symlinkJoin , jq , makeWrapper +, extraPkgsByOverride ? [] }: pkgList: let wrapper = { + extraPkgs ? [], extraMakeWrapperArgs ? "" }: let @@ -36,7 +38,8 @@ let pkgsFound ) pkgs; # allInputs = builtins.trace "allinputs is ${builtins.toJSON (getAllInputs pkgList [])}" (getAllInputs pkgList []); - allInputs = lib.lists.flatten (getAllInputs pkgList []); + allPkgs = (lib.lists.flatten pkgList) ++ extraPkgsByOverride ++ extraPkgs; + allInputs = lib.lists.flatten (getAllInputs allPkgs []); # filter out of all the inputs the packages with the propagateEnv attribute envPkgs = builtins.filter ( pkg: diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 8659e9ae56f8e..214a1a3eca03b 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -662,7 +662,7 @@ in arandr = callPackage ../tools/X11/arandr { }; arandr-newly-unwrapped = arandr.override { wrapGAppsHook = null; }; - arandr-newly-wrapped = wrapGeneric [ arandr-newly-unwrapped ] { }; + arandr-newly-wrapped = wrapGApps arandr-newly-unwrapped { }; inherit (callPackages ../servers/nosql/arangodb { stdenv = gcc8Stdenv; @@ -22277,7 +22277,15 @@ in wrapNeovim = callPackage ../applications/editors/neovim/wrapper.nix { }; - wrapGeneric = callPackage ../build-support/neowrap.nix { }; # not actually a package + wrapGeneric = callPackage ../build-support/neowrap.nix {}; + wrapGApps = wrapGeneric.override { + extraPkgsByOverride = [ + dconf + librsvg + pango + atk + ]; + }; neovim-unwrapped = callPackage ../applications/editors/neovim { lua = From 78cbe774a84c12abf922885c33a2674c797db017 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Sun, 12 Apr 2020 18:29:12 +0300 Subject: [PATCH 06/31] fix gdk pixbuf module file env --- pkgs/development/libraries/librsvg/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/libraries/librsvg/default.nix b/pkgs/development/libraries/librsvg/default.nix index 9232b612b8b8d..a11a33a7cd878 100644 --- a/pkgs/development/libraries/librsvg/default.nix +++ b/pkgs/development/libraries/librsvg/default.nix @@ -77,7 +77,7 @@ stdenv.mkDerivation rec { packageName = pname; }; propagateEnv = { - GDK_PIXBUF_MODULE_FILE = "%out%/lib/${gdk-pixbuf.moduleDir}/loaders.cache"; + GDK_PIXBUF_MODULE_FILE = "%out%/${gdk-pixbuf.moduleDir}/loaders.cache"; GI_TYPELIB_PATH = "%out%/lib/girepository-1.0"; }; }; From 74a01b38fc290b67bb93cb9d26898cf6f4941ba1 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Sun, 12 Apr 2020 19:15:07 +0300 Subject: [PATCH 07/31] Replace _all_ occurences of %outname% in env's strings --- pkgs/build-support/neowrap.nix | 34 ++++++++++++++++--- pkgs/development/libraries/dconf/default.nix | 2 +- .../libraries/gdk-pixbuf/default.nix | 1 + .../development/libraries/librsvg/default.nix | 2 +- pkgs/top-level/all-packages.nix | 2 +- 5 files changed, 33 insertions(+), 8 deletions(-) diff --git a/pkgs/build-support/neowrap.nix b/pkgs/build-support/neowrap.nix index 9dd650e99120a..6ef51a36190f8 100644 --- a/pkgs/build-support/neowrap.nix +++ b/pkgs/build-support/neowrap.nix @@ -45,16 +45,40 @@ let pkg: (builtins.hasAttr "propagateEnv" pkg) ) allInputs; + # 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; + } + ; envInfo = map ( pkg: (lib.attrsets.mapAttrs ( name: value: - # TODO: make this work with other outputs as well - builtins.replaceStrings - [ "%out%" ] - [ "${pkg.out}" ] - value + replaceAllOutputs { + inherit pkg; + outputs = pkg.outputs; + envStr = value; + } ) pkg.propagateEnv) ) envPkgs; # envInfo_ = builtins.trace "envInfo is ${(builtins.toJSON envInfo)}" envInfo; diff --git a/pkgs/development/libraries/dconf/default.nix b/pkgs/development/libraries/dconf/default.nix index cf462ae3fec95..6698ba0773cf2 100644 --- a/pkgs/development/libraries/dconf/default.nix +++ b/pkgs/development/libraries/dconf/default.nix @@ -36,7 +36,7 @@ stdenv.mkDerivation rec { packageName = pname; }; propagateEnv = { - GIO_EXTRA_MODULES = "%out%/lib/gio/modules"; + GIO_EXTRA_MODULES = "%lib%/lib/gio/modules"; }; }; diff --git a/pkgs/development/libraries/gdk-pixbuf/default.nix b/pkgs/development/libraries/gdk-pixbuf/default.nix index 95b39d1d2fd8f..f697392962959 100644 --- a/pkgs/development/libraries/gdk-pixbuf/default.nix +++ b/pkgs/development/libraries/gdk-pixbuf/default.nix @@ -98,6 +98,7 @@ 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"; }; diff --git a/pkgs/development/libraries/librsvg/default.nix b/pkgs/development/libraries/librsvg/default.nix index a11a33a7cd878..dc4ef59117b5a 100644 --- a/pkgs/development/libraries/librsvg/default.nix +++ b/pkgs/development/libraries/librsvg/default.nix @@ -77,7 +77,7 @@ stdenv.mkDerivation rec { packageName = pname; }; propagateEnv = { - GDK_PIXBUF_MODULE_FILE = "%out%/${gdk-pixbuf.moduleDir}/loaders.cache"; + GDK_PIXBUF_MODULE_FILE = "%out%/${gdk-pixbuf.cacheFile}"; GI_TYPELIB_PATH = "%out%/lib/girepository-1.0"; }; }; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 214a1a3eca03b..91e835a1f5938 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -22282,7 +22282,7 @@ in extraPkgsByOverride = [ dconf librsvg - pango + gdk-pixbuf atk ]; }; From a18f52172369a0f3ce2acec09040f1a6e0ea9b18 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Sun, 12 Apr 2020 19:21:54 +0300 Subject: [PATCH 08/31] prepare neowrap for XDG_DATA_DIRS=$out/share --- pkgs/build-support/neowrap.nix | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/pkgs/build-support/neowrap.nix b/pkgs/build-support/neowrap.nix index 6ef51a36190f8..28006e2966653 100644 --- a/pkgs/build-support/neowrap.nix +++ b/pkgs/build-support/neowrap.nix @@ -13,10 +13,18 @@ let extraMakeWrapperArgs ? "" }: let - # Where we keep information about every environmental variable and the - # separator between it's values, the default value used is `:` - encyclopedia_of_separators = { - # XDG_DATA_DIRS = ":"; + # 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 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 args + wrapOut = { + XDG_DATA_DIRS = "$out/share"; + }; }; # 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 @@ -89,8 +97,8 @@ let key: value: (let - sep = encyclopedia_of_separators.${key} or ":"; - in + sep = encyclopedia.separators.${key} or ":"; # default separator used for most wrappings + in "--prefix ${key} ${sep} ${builtins.concatStringsSep sep value}" ) ) envInfoFolded; From 72d647897a5721b4b80c236744c2326b094174fa Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Sun, 12 Apr 2020 19:47:55 +0300 Subject: [PATCH 09/31] teach it to deal with encyclopedia.wrapOut --- pkgs/build-support/neowrap.nix | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/pkgs/build-support/neowrap.nix b/pkgs/build-support/neowrap.nix index 28006e2966653..835f436c725a9 100644 --- a/pkgs/build-support/neowrap.nix +++ b/pkgs/build-support/neowrap.nix @@ -21,7 +21,8 @@ let # XDG_DATA_DIRS = ":"; }; # 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 args + # out, we list here for every env var what path to add to the wrapper's + # args. You can put a list as a value as well. wrapOut = { XDG_DATA_DIRS = "$out/share"; }; @@ -92,16 +93,26 @@ let # envInfo_ = builtins.trace "envInfo is ${(builtins.toJSON envInfo)}" envInfo; envInfoFolded = lib.attrsets.foldAttrs (n: a: [n] ++ a) [] envInfo; # envInfoFolded_ = builtins.trace "envInfoFolded is ${(builtins.toJSON envInfoFolded)}" envInfoFolded; - # TODO: add here also this build's $out /share (e.g) to $out + # Where we add stuff according to encyclopedia.wrapOut + envInfoWithLocal = lib.attrsets.mapAttrs ( + name: + values: + if builtins.hasAttr name encyclopedia.wrapOut then + values ++ (lib.lists.flatten encyclopedia.wrapOut.${name}) + else + values + ) envInfoFolded; + # envInfoWithLocal_ = builtins.trace "envInfoWithLocal is ${(builtins.toJSON envInfoWithLocal)}" envInfoWithLocal; makeWrapperArgs = lib.attrsets.mapAttrsToList ( key: value: - (let + (let + # TODO: make sure this works with any separator according to encyclopedia.separators sep = encyclopedia.separators.${key} or ":"; # default separator used for most wrappings in "--prefix ${key} ${sep} ${builtins.concatStringsSep sep value}" ) - ) envInfoFolded; + ) envInfoWithLocal; makeWrapperArgs_ = builtins.trace "makeWrapperArgs is ${(builtins.toJSON makeWrapperArgs)}" makeWrapperArgs; in symlinkJoin { From d0ed3a55666fc834e728f852a9b7780af227df30 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Sun, 12 Apr 2020 21:14:17 +0300 Subject: [PATCH 10/31] Prepare for a PR --- pkgs/build-support/neowrap.nix | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pkgs/build-support/neowrap.nix b/pkgs/build-support/neowrap.nix index 835f436c725a9..9acb17483bb97 100644 --- a/pkgs/build-support/neowrap.nix +++ b/pkgs/build-support/neowrap.nix @@ -1,6 +1,5 @@ { lib , symlinkJoin -, jq , makeWrapper , extraPkgsByOverride ? [] }: @@ -113,16 +112,16 @@ let "--prefix ${key} ${sep} ${builtins.concatStringsSep sep value}" ) ) envInfoWithLocal; - makeWrapperArgs_ = builtins.trace "makeWrapperArgs is ${(builtins.toJSON makeWrapperArgs)}" makeWrapperArgs; + # makeWrapperArgs_ = builtins.trace "makeWrapperArgs is ${(builtins.toJSON makeWrapperArgs)}" makeWrapperArgs; in symlinkJoin { name = "runtime-env"; paths = pkgList; - buildInputs = [ jq makeWrapper ]; + buildInputs = [ makeWrapper ]; postBuild = '' for i in $out/bin/*; do - wrapProgram "$i" ${(builtins.concatStringsSep " " makeWrapperArgs_)} + wrapProgram "$i" ${(builtins.concatStringsSep " " makeWrapperArgs)} done ''; }; From c0dab185c18e525f406e3cd706264f557d8a00d5 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Sun, 12 Apr 2020 22:11:56 +0300 Subject: [PATCH 11/31] dumbly add passthrus to some qt packages --- pkgs/development/libraries/qt-5/modules/qtbase.nix | 8 +++++++- pkgs/development/libraries/qt-5/modules/qtcharts.nix | 6 ++++++ pkgs/development/libraries/qt-5/modules/qtdeclarative.nix | 6 ++++++ pkgs/development/libraries/qt-5/modules/qtmultimedia.nix | 6 ++++++ .../libraries/qt-5/modules/qtquickcontrols2.nix | 6 ++++++ pkgs/development/libraries/qt-5/modules/qtsvg.nix | 6 ++++++ pkgs/development/libraries/qt-5/modules/qtwayland.nix | 6 ++++++ 7 files changed, 43 insertions(+), 1 deletion(-) diff --git a/pkgs/development/libraries/qt-5/modules/qtbase.nix b/pkgs/development/libraries/qt-5/modules/qtbase.nix index a4c12793abb3b..f629492507e52 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_PLUGIN_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..c0f46cebcc301 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_PLUGIN_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..85ebd61c302b8 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_PLUGIN_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..bfb303f44b42c 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_PLUGIN_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..5d2fa086f9ca6 100644 --- a/pkgs/development/libraries/qt-5/modules/qtquickcontrols2.nix +++ b/pkgs/development/libraries/qt-5/modules/qtquickcontrols2.nix @@ -4,4 +4,10 @@ qtModule { name = "qtquickcontrols2"; qtInputs = [ qtdeclarative ]; outputs = [ "out" "dev" "bin" ]; + passthru = { + propagateEnv = { + # QT_PLUGIN_PATH = "%bin%/${qtbase.qtPluginPrefix}"; + QML2_PLUGIN_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..7ec1189acab0b 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_PLUGIN_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..c12b04dd9dc85 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_PLUGIN_PATH = "%bin%/${qtbase.qtQmlPrefix}"; + }; + }; } From 6283f15bb9b65af64571a78b039115807dcc2958 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Sun, 12 Apr 2020 23:03:35 +0300 Subject: [PATCH 12/31] Make picard work perfectly with new wrapping method --- pkgs/applications/audio/picard/default.nix | 17 +++++++------- pkgs/build-support/neowrap.nix | 22 +++++++++---------- .../libraries/gstreamer/bad/default.nix | 6 +++++ .../libraries/gstreamer/base/default.nix | 3 +++ .../libraries/gstreamer/core/default.nix | 6 +++++ .../libraries/gstreamer/ges/default.nix | 6 +++++ .../libraries/gstreamer/good/default.nix | 6 +++++ .../libraries/gstreamer/libav/default.nix | 6 +++++ .../libraries/gstreamer/ugly/default.nix | 6 +++++ .../libraries/gstreamer/vaapi/default.nix | 6 +++++ .../libraries/qt-5/modules/qtbase.nix | 2 +- .../libraries/qt-5/modules/qtcharts.nix | 2 +- .../libraries/qt-5/modules/qtdeclarative.nix | 2 +- .../libraries/qt-5/modules/qtmultimedia.nix | 2 +- .../qt-5/modules/qtquickcontrols2.nix | 2 +- .../libraries/qt-5/modules/qtsvg.nix | 2 +- .../libraries/qt-5/modules/qtwayland.nix | 2 +- pkgs/top-level/all-packages.nix | 11 +++++++++- 18 files changed, 82 insertions(+), 27 deletions(-) diff --git a/pkgs/applications/audio/picard/default.nix b/pkgs/applications/audio/picard/default.nix index 5830e1eefb88c..8a5c947d3d39a 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,13 +40,6 @@ in pythonPackages.buildPythonApplication rec { ] ; - propagatedBuildInputs = with pythonPackages; [ - pyqt5 - mutagen - chromaprint - discid - ]; - prePatch = '' # Pesky unicode punctuation. substituteInPlace setup.cfg --replace "‘" "'" diff --git a/pkgs/build-support/neowrap.nix b/pkgs/build-support/neowrap.nix index 9acb17483bb97..7b01ab2d11960 100644 --- a/pkgs/build-support/neowrap.nix +++ b/pkgs/build-support/neowrap.nix @@ -36,18 +36,18 @@ let map ( pkg: if (builtins.typeOf pkg) == "set" then - if builtins.hasAttr "buildInputs" pkg then - # builtins.trace "pkg is of type ${(builtins.typeOf pkg)} and it's ${(builtins.toJSON pkg)}" (getAllInputs pkg.buildInputs pkgsFound ++ [ pkg ]) - (getAllInputs pkg.buildInputs pkgsFound ++ [ pkg ]) + if builtins.hasAttr "buildInputs" pkg || builtins.hasAttr "propagatedBuildInputs" pkg then + # builtins.trace "pkg is of type ${builtins.typeOf pkg} and it's ${builtins.toJSON pkg}, with inputs: ${builtins.toJSON (pkg.buildInputs ++ pkg.propagatedBuildInputs)}" (getAllInputs (pkg.buildInputs ++ pkg.propagatedBuildInputs) (pkgsFound ++ [ pkg ])) + (getAllInputs (pkg.buildInputs ++ pkg.propagatedBuildInputs) (pkgsFound ++ [ pkg ])) else pkgsFound ++ [ pkg ] else - # builtins.trace "pkg is not a set but a ${(builtins.typeOf pkg)} at ${(builtins.toJSON pkg)}, current pkgsFound is ${(builtins.toJSON pkgsFound)}" pkgsFound + # builtins.trace "pkg is not a set but a ${builtins.typeOf pkg} at ${builtins.toJSON pkg}, current pkgsFound is ${builtins.toJSON pkgsFound}" pkgsFound pkgsFound ) pkgs; - # allInputs = builtins.trace "allinputs is ${builtins.toJSON (getAllInputs pkgList [])}" (getAllInputs pkgList []); allPkgs = (lib.lists.flatten pkgList) ++ extraPkgsByOverride ++ extraPkgs; - allInputs = lib.lists.flatten (getAllInputs allPkgs []); + allInputs = lib.lists.unique (lib.lists.flatten (getAllInputs allPkgs [])); + allInputs_ = builtins.trace "${builtins.toJSON allInputs}" allInputs; # filter out of all the inputs the packages with the propagateEnv attribute envPkgs = builtins.filter ( pkg: @@ -89,9 +89,9 @@ let } ) pkg.propagateEnv) ) envPkgs; - # envInfo_ = builtins.trace "envInfo is ${(builtins.toJSON envInfo)}" envInfo; + envInfo_ = builtins.trace "envInfo is ${(builtins.toJSON envInfo)}" envInfo; envInfoFolded = lib.attrsets.foldAttrs (n: a: [n] ++ a) [] envInfo; - # envInfoFolded_ = builtins.trace "envInfoFolded is ${(builtins.toJSON envInfoFolded)}" envInfoFolded; + envInfoFolded_ = builtins.trace "envInfoFolded is ${(builtins.toJSON envInfoFolded)}" envInfoFolded; # Where we add stuff according to encyclopedia.wrapOut envInfoWithLocal = lib.attrsets.mapAttrs ( name: @@ -101,7 +101,7 @@ let else values ) envInfoFolded; - # envInfoWithLocal_ = builtins.trace "envInfoWithLocal is ${(builtins.toJSON envInfoWithLocal)}" envInfoWithLocal; + envInfoWithLocal_ = builtins.trace "envInfoWithLocal is ${(builtins.toJSON envInfoWithLocal)}" envInfoWithLocal; makeWrapperArgs = lib.attrsets.mapAttrsToList ( key: value: @@ -112,7 +112,7 @@ let "--prefix ${key} ${sep} ${builtins.concatStringsSep sep value}" ) ) envInfoWithLocal; - # makeWrapperArgs_ = builtins.trace "makeWrapperArgs is ${(builtins.toJSON makeWrapperArgs)}" makeWrapperArgs; + makeWrapperArgs_ = builtins.trace "makeWrapperArgs is ${(builtins.toJSON makeWrapperArgs)}" makeWrapperArgs; in symlinkJoin { name = "runtime-env"; @@ -121,7 +121,7 @@ let buildInputs = [ makeWrapper ]; postBuild = '' for i in $out/bin/*; do - wrapProgram "$i" ${(builtins.concatStringsSep " " makeWrapperArgs)} + wrapProgram "$i" ${(builtins.concatStringsSep " " makeWrapperArgs_)} done ''; }; diff --git a/pkgs/development/libraries/gstreamer/bad/default.nix b/pkgs/development/libraries/gstreamer/bad/default.nix index ae5fd7531325f..b854d97983102 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..c31883aa855fb 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..6ded813d642ce 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..aabbe73a670f1 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..8df1a2a20553b 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..57816076c2485 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..3edc3a4401e5a 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..a02c997a88762 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/qt-5/modules/qtbase.nix b/pkgs/development/libraries/qt-5/modules/qtbase.nix index f629492507e52..70e8e8a11ec0b 100644 --- a/pkgs/development/libraries/qt-5/modules/qtbase.nix +++ b/pkgs/development/libraries/qt-5/modules/qtbase.nix @@ -164,7 +164,7 @@ stdenv.mkDerivation rec { passthru = { propagateEnv = { QT_PLUGIN_PATH = "%bin%/${qtPluginPrefix}"; - # QML2_PLUGIN_PATH = "%bin%/${qtQmlPrefix}"; + # QML2_IMPORT_PATH = "%bin%/${qtQmlPrefix}"; }; }; diff --git a/pkgs/development/libraries/qt-5/modules/qtcharts.nix b/pkgs/development/libraries/qt-5/modules/qtcharts.nix index c0f46cebcc301..ba6a45c4e5ef1 100644 --- a/pkgs/development/libraries/qt-5/modules/qtcharts.nix +++ b/pkgs/development/libraries/qt-5/modules/qtcharts.nix @@ -7,7 +7,7 @@ qtModule { passthru = { propagateEnv = { QT_PLUGIN_PATH = "%bin%/${qtbase.qtPluginPrefix}"; - QML2_PLUGIN_PATH = "%bin%/${qtbase.qtQmlPrefix}"; + 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 85ebd61c302b8..feedbb619c125 100644 --- a/pkgs/development/libraries/qt-5/modules/qtdeclarative.nix +++ b/pkgs/development/libraries/qt-5/modules/qtdeclarative.nix @@ -26,7 +26,7 @@ qtModule { passthru = { propagateEnv = { QT_PLUGIN_PATH = "%bin%/${qtbase.qtPluginPrefix}"; - QML2_PLUGIN_PATH = "%bin%/${qtbase.qtQmlPrefix}"; + 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 bfb303f44b42c..6988483f4dcc7 100644 --- a/pkgs/development/libraries/qt-5/modules/qtmultimedia.nix +++ b/pkgs/development/libraries/qt-5/modules/qtmultimedia.nix @@ -16,7 +16,7 @@ qtModule { passthru = { propagateEnv = { QT_PLUGIN_PATH = "%bin%/${qtbase.qtPluginPrefix}"; - QML2_PLUGIN_PATH = "%bin%/${qtbase.qtQmlPrefix}"; + 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 5d2fa086f9ca6..0b72685339e4c 100644 --- a/pkgs/development/libraries/qt-5/modules/qtquickcontrols2.nix +++ b/pkgs/development/libraries/qt-5/modules/qtquickcontrols2.nix @@ -7,7 +7,7 @@ qtModule { passthru = { propagateEnv = { # QT_PLUGIN_PATH = "%bin%/${qtbase.qtPluginPrefix}"; - QML2_PLUGIN_PATH = "%bin%/${qtbase.qtQmlPrefix}"; + 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 7ec1189acab0b..3786845c298fa 100644 --- a/pkgs/development/libraries/qt-5/modules/qtsvg.nix +++ b/pkgs/development/libraries/qt-5/modules/qtsvg.nix @@ -7,7 +7,7 @@ qtModule { passthru = { propagateEnv = { QT_PLUGIN_PATH = "%bin%/${qtbase.qtPluginPrefix}"; - # QML2_PLUGIN_PATH = "%bin%/${qtbase.qtQmlPrefix}"; + # 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 c12b04dd9dc85..1d191b031bd40 100644 --- a/pkgs/development/libraries/qt-5/modules/qtwayland.nix +++ b/pkgs/development/libraries/qt-5/modules/qtwayland.nix @@ -9,7 +9,7 @@ qtModule { passthru = { propagateEnv = { QT_PLUGIN_PATH = "%bin%/${qtbase.qtPluginPrefix}"; - QML2_PLUGIN_PATH = "%bin%/${qtbase.qtQmlPrefix}"; + QML2_IMPORT_PATH = "%bin%/${qtbase.qtQmlPrefix}"; }; }; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 91e835a1f5938..679e35ee99623 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -19751,7 +19751,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 { }; @@ -21196,6 +21196,15 @@ in picard = callPackage ../applications/audio/picard { }; + picard-newly-unwrapped = (picard.override { + qt5 = qt5 // { + wrapQtAppsHook = null; + }; + }).overrideAttrs(oldAttrs: { + preFixup = ""; + }); + picard-newly-wrapped = wrapGeneric picard-newly-unwrapped {}; + picocom = callPackage ../tools/misc/picocom { inherit (darwin.apple_sdk.frameworks) IOKit; }; From b4d36333d34d7ae8f8bb00623daa837c173a2016 Mon Sep 17 00:00:00 2001 From: Ryan Mulligan Date: Sun, 12 Apr 2020 14:50:19 -0700 Subject: [PATCH 13/31] fix missing semicolon pkgs/development/libraries/gvfs/default.nix Co-Authored-By: Cole Helbling --- pkgs/development/libraries/gvfs/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/libraries/gvfs/default.nix b/pkgs/development/libraries/gvfs/default.nix index d734315868ca2..b3e01d4d03fa9 100644 --- a/pkgs/development/libraries/gvfs/default.nix +++ b/pkgs/development/libraries/gvfs/default.nix @@ -121,7 +121,7 @@ stdenv.mkDerivation rec { packageName = pname; }; propagateEnv = { - GIO_EXTRA_MODULES = "%out%/lib/gio/modules" + GIO_EXTRA_MODULES = "%out%/lib/gio/modules"; }; }; From ea9640aee0326665895d6e4da86e3e1258c0908f Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Mon, 13 Apr 2020 10:52:12 +0300 Subject: [PATCH 14/31] Fix another ofborg error --- pkgs/development/libraries/qt-5/modules/qtquickcontrols2.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/libraries/qt-5/modules/qtquickcontrols2.nix b/pkgs/development/libraries/qt-5/modules/qtquickcontrols2.nix index 0b72685339e4c..4c117005b9b6e 100644 --- a/pkgs/development/libraries/qt-5/modules/qtquickcontrols2.nix +++ b/pkgs/development/libraries/qt-5/modules/qtquickcontrols2.nix @@ -1,4 +1,4 @@ -{ qtModule, qtdeclarative }: +{ qtModule, qtdeclarative, qtbase }: qtModule { name = "qtquickcontrols2"; From 8074b9cdf723c473143cda26444033ef09252862 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Mon, 13 Apr 2020 11:03:57 +0300 Subject: [PATCH 15/31] Stop using builtins.trace to avoid ofborg complaints --- pkgs/build-support/neowrap.nix | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pkgs/build-support/neowrap.nix b/pkgs/build-support/neowrap.nix index 7b01ab2d11960..96efd15271420 100644 --- a/pkgs/build-support/neowrap.nix +++ b/pkgs/build-support/neowrap.nix @@ -47,7 +47,7 @@ let ) pkgs; allPkgs = (lib.lists.flatten pkgList) ++ extraPkgsByOverride ++ extraPkgs; allInputs = lib.lists.unique (lib.lists.flatten (getAllInputs allPkgs [])); - allInputs_ = builtins.trace "${builtins.toJSON allInputs}" allInputs; + # allInputs_ = builtins.trace "${builtins.toJSON allInputs}" allInputs; # filter out of all the inputs the packages with the propagateEnv attribute envPkgs = builtins.filter ( pkg: @@ -89,9 +89,9 @@ let } ) pkg.propagateEnv) ) envPkgs; - envInfo_ = builtins.trace "envInfo is ${(builtins.toJSON envInfo)}" envInfo; + # envInfo_ = builtins.trace "envInfo is ${(builtins.toJSON envInfo)}" envInfo; envInfoFolded = lib.attrsets.foldAttrs (n: a: [n] ++ a) [] envInfo; - envInfoFolded_ = builtins.trace "envInfoFolded is ${(builtins.toJSON envInfoFolded)}" envInfoFolded; + # envInfoFolded_ = builtins.trace "envInfoFolded is ${(builtins.toJSON envInfoFolded)}" envInfoFolded; # Where we add stuff according to encyclopedia.wrapOut envInfoWithLocal = lib.attrsets.mapAttrs ( name: @@ -101,7 +101,7 @@ let else values ) envInfoFolded; - envInfoWithLocal_ = builtins.trace "envInfoWithLocal is ${(builtins.toJSON envInfoWithLocal)}" envInfoWithLocal; + # envInfoWithLocal_ = builtins.trace "envInfoWithLocal is ${(builtins.toJSON envInfoWithLocal)}" envInfoWithLocal; makeWrapperArgs = lib.attrsets.mapAttrsToList ( key: value: @@ -112,7 +112,7 @@ let "--prefix ${key} ${sep} ${builtins.concatStringsSep sep value}" ) ) envInfoWithLocal; - makeWrapperArgs_ = builtins.trace "makeWrapperArgs is ${(builtins.toJSON makeWrapperArgs)}" makeWrapperArgs; + # makeWrapperArgs_ = builtins.trace "makeWrapperArgs is ${(builtins.toJSON makeWrapperArgs)}" makeWrapperArgs; in symlinkJoin { name = "runtime-env"; @@ -121,7 +121,7 @@ let buildInputs = [ makeWrapper ]; postBuild = '' for i in $out/bin/*; do - wrapProgram "$i" ${(builtins.concatStringsSep " " makeWrapperArgs_)} + wrapProgram "$i" ${(builtins.concatStringsSep " " makeWrapperArgs)} done ''; }; From f173b808ed9e68f252dbbc78d409a7a7fb5f36de Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Mon, 13 Apr 2020 11:05:34 +0300 Subject: [PATCH 16/31] use @out@ and not %out% --- pkgs/build-support/neowrap.nix | 2 +- pkgs/development/libraries/atk/default.nix | 2 +- pkgs/development/libraries/dconf/default.nix | 2 +- pkgs/development/libraries/gdk-pixbuf/default.nix | 2 +- pkgs/development/libraries/gobject-introspection/default.nix | 2 +- .../libraries/gsettings-desktop-schemas/default.nix | 4 ++-- pkgs/development/libraries/gstreamer/bad/default.nix | 2 +- pkgs/development/libraries/gstreamer/base/default.nix | 2 +- pkgs/development/libraries/gstreamer/core/default.nix | 2 +- pkgs/development/libraries/gstreamer/ges/default.nix | 2 +- pkgs/development/libraries/gstreamer/good/default.nix | 2 +- pkgs/development/libraries/gstreamer/libav/default.nix | 2 +- pkgs/development/libraries/gstreamer/ugly/default.nix | 2 +- pkgs/development/libraries/gstreamer/vaapi/default.nix | 2 +- pkgs/development/libraries/gtk/3.x.nix | 4 ++-- pkgs/development/libraries/gvfs/default.nix | 2 +- pkgs/development/libraries/librsvg/default.nix | 4 ++-- pkgs/development/libraries/pango/default.nix | 2 +- pkgs/development/libraries/qt-5/modules/qtbase.nix | 4 ++-- pkgs/development/libraries/qt-5/modules/qtcharts.nix | 4 ++-- pkgs/development/libraries/qt-5/modules/qtdeclarative.nix | 4 ++-- pkgs/development/libraries/qt-5/modules/qtmultimedia.nix | 4 ++-- pkgs/development/libraries/qt-5/modules/qtquickcontrols2.nix | 4 ++-- pkgs/development/libraries/qt-5/modules/qtsvg.nix | 4 ++-- pkgs/development/libraries/qt-5/modules/qtwayland.nix | 4 ++-- 25 files changed, 35 insertions(+), 35 deletions(-) diff --git a/pkgs/build-support/neowrap.nix b/pkgs/build-support/neowrap.nix index 96efd15271420..2c78a6878c875 100644 --- a/pkgs/build-support/neowrap.nix +++ b/pkgs/build-support/neowrap.nix @@ -72,7 +72,7 @@ let inherit pkg; outputs = lib.lists.subtractLists [outname] outputs; envStr = builtins.replaceStrings - [ "%${outname}%" ] + [ "@${outname}@" ] [ "${pkg.${outname}}" ] envStr; } diff --git a/pkgs/development/libraries/atk/default.nix b/pkgs/development/libraries/atk/default.nix index a7e7fda2b558f..bbbd4f6a8cc3e 100644 --- a/pkgs/development/libraries/atk/default.nix +++ b/pkgs/development/libraries/atk/default.nix @@ -39,7 +39,7 @@ stdenv.mkDerivation rec { packageName = pname; }; propagateEnv = { - GI_TYPELIB_PATH = "%out%/lib/girepository-1.0"; + GI_TYPELIB_PATH = "@out@/lib/girepository-1.0"; }; }; diff --git a/pkgs/development/libraries/dconf/default.nix b/pkgs/development/libraries/dconf/default.nix index 6698ba0773cf2..9f4926fa41397 100644 --- a/pkgs/development/libraries/dconf/default.nix +++ b/pkgs/development/libraries/dconf/default.nix @@ -36,7 +36,7 @@ stdenv.mkDerivation rec { packageName = pname; }; propagateEnv = { - GIO_EXTRA_MODULES = "%lib%/lib/gio/modules"; + GIO_EXTRA_MODULES = "@lib@/lib/gio/modules"; }; }; diff --git a/pkgs/development/libraries/gdk-pixbuf/default.nix b/pkgs/development/libraries/gdk-pixbuf/default.nix index f697392962959..3d297fc9d505c 100644 --- a/pkgs/development/libraries/gdk-pixbuf/default.nix +++ b/pkgs/development/libraries/gdk-pixbuf/default.nix @@ -100,7 +100,7 @@ in stdenv.mkDerivation rec { 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"; + GI_TYPELIB_PATH = "@out@/lib/girepository-1.0"; }; }; diff --git a/pkgs/development/libraries/gobject-introspection/default.nix b/pkgs/development/libraries/gobject-introspection/default.nix index aec0ce92a78d8..8156e1a765bdf 100644 --- a/pkgs/development/libraries/gobject-introspection/default.nix +++ b/pkgs/development/libraries/gobject-introspection/default.nix @@ -73,7 +73,7 @@ stdenv.mkDerivation rec { packageName = pname; }; propagateEnv = { - GI_TYPELIB_PATH = "%out%/lib/girepository-1.0"; + GI_TYPELIB_PATH = "@out@/lib/girepository-1.0"; }; }; diff --git a/pkgs/development/libraries/gsettings-desktop-schemas/default.nix b/pkgs/development/libraries/gsettings-desktop-schemas/default.nix index 661ef54c0e401..b6aee0f4c1030 100644 --- a/pkgs/development/libraries/gsettings-desktop-schemas/default.nix +++ b/pkgs/development/libraries/gsettings-desktop-schemas/default.nix @@ -17,8 +17,8 @@ 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"; + XDG_DATA_DIRS = "@out@/share/gsettings-schemas/${pname}-${version}"; + GI_TYPELIB_PATH = "@out@/lib/girepository-1.0"; }; }; diff --git a/pkgs/development/libraries/gstreamer/bad/default.nix b/pkgs/development/libraries/gstreamer/bad/default.nix index b854d97983102..a43ec17c2b8c9 100644 --- a/pkgs/development/libraries/gstreamer/bad/default.nix +++ b/pkgs/development/libraries/gstreamer/bad/default.nix @@ -280,7 +280,7 @@ in stdenv.mkDerivation rec { passthru = { propagateEnv = { - GST_PLUGIN_SYSTEM_PATH_1_0 = "%out%/lib/gstreamer-1.0"; + GST_PLUGIN_SYSTEM_PATH_1_0 = "@out@/lib/gstreamer-1.0"; }; }; diff --git a/pkgs/development/libraries/gstreamer/base/default.nix b/pkgs/development/libraries/gstreamer/base/default.nix index c31883aa855fb..02cbe7326f3d1 100644 --- a/pkgs/development/libraries/gstreamer/base/default.nix +++ b/pkgs/development/libraries/gstreamer/base/default.nix @@ -136,7 +136,7 @@ stdenv.mkDerivation rec { passthru = { propagateEnv = { - GST_PLUGIN_SYSTEM_PATH_1_0 = "%out%/lib/gstreamer-1.0"; + 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 diff --git a/pkgs/development/libraries/gstreamer/core/default.nix b/pkgs/development/libraries/gstreamer/core/default.nix index 6ded813d642ce..b49f0f8e5956e 100644 --- a/pkgs/development/libraries/gstreamer/core/default.nix +++ b/pkgs/development/libraries/gstreamer/core/default.nix @@ -102,7 +102,7 @@ stdenv.mkDerivation rec { passthru = { propagateEnv = { - GST_PLUGIN_SYSTEM_PATH_1_0 = "%out%/lib/gstreamer-1.0"; + GST_PLUGIN_SYSTEM_PATH_1_0 = "@out@/lib/gstreamer-1.0"; }; }; diff --git a/pkgs/development/libraries/gstreamer/ges/default.nix b/pkgs/development/libraries/gstreamer/ges/default.nix index aabbe73a670f1..2c2c7495c50c2 100644 --- a/pkgs/development/libraries/gstreamer/ges/default.nix +++ b/pkgs/development/libraries/gstreamer/ges/default.nix @@ -57,7 +57,7 @@ stdenv.mkDerivation rec { passthru = { propagateEnv = { - GST_PLUGIN_SYSTEM_PATH_1_0 = "%out%/lib/gstreamer-1.0"; + GST_PLUGIN_SYSTEM_PATH_1_0 = "@out@/lib/gstreamer-1.0"; }; }; diff --git a/pkgs/development/libraries/gstreamer/good/default.nix b/pkgs/development/libraries/gstreamer/good/default.nix index 8df1a2a20553b..8ef2abf21156e 100644 --- a/pkgs/development/libraries/gstreamer/good/default.nix +++ b/pkgs/development/libraries/gstreamer/good/default.nix @@ -138,7 +138,7 @@ stdenv.mkDerivation rec { passthru = { propagateEnv = { - GST_PLUGIN_SYSTEM_PATH_1_0 = "%out%/lib/gstreamer-1.0"; + GST_PLUGIN_SYSTEM_PATH_1_0 = "@out@/lib/gstreamer-1.0"; }; }; diff --git a/pkgs/development/libraries/gstreamer/libav/default.nix b/pkgs/development/libraries/gstreamer/libav/default.nix index 57816076c2485..b800ac6c321ab 100644 --- a/pkgs/development/libraries/gstreamer/libav/default.nix +++ b/pkgs/development/libraries/gstreamer/libav/default.nix @@ -39,7 +39,7 @@ stdenv.mkDerivation rec { passthru = { propagateEnv = { - GST_PLUGIN_SYSTEM_PATH_1_0 = "%out%/lib/gstreamer-1.0"; + GST_PLUGIN_SYSTEM_PATH_1_0 = "@out@/lib/gstreamer-1.0"; }; }; diff --git a/pkgs/development/libraries/gstreamer/ugly/default.nix b/pkgs/development/libraries/gstreamer/ugly/default.nix index 3edc3a4401e5a..2c4ab2615c32f 100644 --- a/pkgs/development/libraries/gstreamer/ugly/default.nix +++ b/pkgs/development/libraries/gstreamer/ugly/default.nix @@ -57,7 +57,7 @@ stdenv.mkDerivation rec { passthru = { propagateEnv = { - GST_PLUGIN_SYSTEM_PATH_1_0 = "%out%/lib/gstreamer-1.0"; + GST_PLUGIN_SYSTEM_PATH_1_0 = "@out@/lib/gstreamer-1.0"; }; }; diff --git a/pkgs/development/libraries/gstreamer/vaapi/default.nix b/pkgs/development/libraries/gstreamer/vaapi/default.nix index a02c997a88762..2095378654d8d 100644 --- a/pkgs/development/libraries/gstreamer/vaapi/default.nix +++ b/pkgs/development/libraries/gstreamer/vaapi/default.nix @@ -64,7 +64,7 @@ stdenv.mkDerivation rec { passthru = { propagateEnv = { - GST_PLUGIN_SYSTEM_PATH_1_0 = "%out%/lib/gstreamer-1.0"; + GST_PLUGIN_SYSTEM_PATH_1_0 = "@out@/lib/gstreamer-1.0"; }; }; diff --git a/pkgs/development/libraries/gtk/3.x.nix b/pkgs/development/libraries/gtk/3.x.nix index ca08d1334d16e..0ca84923f5e1c 100644 --- a/pkgs/development/libraries/gtk/3.x.nix +++ b/pkgs/development/libraries/gtk/3.x.nix @@ -190,8 +190,8 @@ stdenv.mkDerivation rec { attrPath = "gtk3"; }; propagateEnv = { - XDG_DATA_DIRS = "%out%/share/gsettings-schemas/${pname}-${version}"; - GI_TYPELIB_PATH = "%out%/lib/girepository-1.0"; + XDG_DATA_DIRS = "@out@/share/gsettings-schemas/${pname}-${version}"; + GI_TYPELIB_PATH = "@out@/lib/girepository-1.0"; }; }; diff --git a/pkgs/development/libraries/gvfs/default.nix b/pkgs/development/libraries/gvfs/default.nix index b3e01d4d03fa9..9904e40550ab7 100644 --- a/pkgs/development/libraries/gvfs/default.nix +++ b/pkgs/development/libraries/gvfs/default.nix @@ -121,7 +121,7 @@ stdenv.mkDerivation rec { packageName = pname; }; propagateEnv = { - GIO_EXTRA_MODULES = "%out%/lib/gio/modules"; + GIO_EXTRA_MODULES = "@out@/lib/gio/modules"; }; }; diff --git a/pkgs/development/libraries/librsvg/default.nix b/pkgs/development/libraries/librsvg/default.nix index dc4ef59117b5a..1f45849e04611 100644 --- a/pkgs/development/libraries/librsvg/default.nix +++ b/pkgs/development/libraries/librsvg/default.nix @@ -77,8 +77,8 @@ stdenv.mkDerivation rec { packageName = pname; }; propagateEnv = { - GDK_PIXBUF_MODULE_FILE = "%out%/${gdk-pixbuf.cacheFile}"; - GI_TYPELIB_PATH = "%out%/lib/girepository-1.0"; + GDK_PIXBUF_MODULE_FILE = "@out@/${gdk-pixbuf.cacheFile}"; + GI_TYPELIB_PATH = "@out@/lib/girepository-1.0"; }; }; diff --git a/pkgs/development/libraries/pango/default.nix b/pkgs/development/libraries/pango/default.nix index 28bc5f3bfdc28..0e142cf1023b6 100644 --- a/pkgs/development/libraries/pango/default.nix +++ b/pkgs/development/libraries/pango/default.nix @@ -55,7 +55,7 @@ in stdenv.mkDerivation rec { packageName = pname; }; propagateEnv = { - GI_TYPELIB_PATH = "%out%/lib/girepository-1.0"; + GI_TYPELIB_PATH = "@out@/lib/girepository-1.0"; }; }; diff --git a/pkgs/development/libraries/qt-5/modules/qtbase.nix b/pkgs/development/libraries/qt-5/modules/qtbase.nix index 70e8e8a11ec0b..77eab41278efd 100644 --- a/pkgs/development/libraries/qt-5/modules/qtbase.nix +++ b/pkgs/development/libraries/qt-5/modules/qtbase.nix @@ -163,8 +163,8 @@ stdenv.mkDerivation rec { qtDocPrefix = "share/doc/qt-${qtCompatVersion}"; passthru = { propagateEnv = { - QT_PLUGIN_PATH = "%bin%/${qtPluginPrefix}"; - # QML2_IMPORT_PATH = "%bin%/${qtQmlPrefix}"; + QT_PLUGIN_PATH = "@bin@/${qtPluginPrefix}"; + # QML2_IMPORT_PATH = "@bin@/${qtQmlPrefix}"; }; }; diff --git a/pkgs/development/libraries/qt-5/modules/qtcharts.nix b/pkgs/development/libraries/qt-5/modules/qtcharts.nix index ba6a45c4e5ef1..14ebe8d69948a 100644 --- a/pkgs/development/libraries/qt-5/modules/qtcharts.nix +++ b/pkgs/development/libraries/qt-5/modules/qtcharts.nix @@ -6,8 +6,8 @@ qtModule { outputs = [ "out" "dev" "bin" ]; passthru = { propagateEnv = { - QT_PLUGIN_PATH = "%bin%/${qtbase.qtPluginPrefix}"; - QML2_IMPORT_PATH = "%bin%/${qtbase.qtQmlPrefix}"; + 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 feedbb619c125..889b56f268f45 100644 --- a/pkgs/development/libraries/qt-5/modules/qtdeclarative.nix +++ b/pkgs/development/libraries/qt-5/modules/qtdeclarative.nix @@ -25,8 +25,8 @@ qtModule { ]; passthru = { propagateEnv = { - QT_PLUGIN_PATH = "%bin%/${qtbase.qtPluginPrefix}"; - QML2_IMPORT_PATH = "%bin%/${qtbase.qtQmlPrefix}"; + 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 6988483f4dcc7..6919ed9328f53 100644 --- a/pkgs/development/libraries/qt-5/modules/qtmultimedia.nix +++ b/pkgs/development/libraries/qt-5/modules/qtmultimedia.nix @@ -15,8 +15,8 @@ qtModule { NIX_LDFLAGS = optionalString (stdenv.isDarwin) "-lobjc"; passthru = { propagateEnv = { - QT_PLUGIN_PATH = "%bin%/${qtbase.qtPluginPrefix}"; - QML2_IMPORT_PATH = "%bin%/${qtbase.qtQmlPrefix}"; + 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 4c117005b9b6e..e2794c6ccb7e1 100644 --- a/pkgs/development/libraries/qt-5/modules/qtquickcontrols2.nix +++ b/pkgs/development/libraries/qt-5/modules/qtquickcontrols2.nix @@ -6,8 +6,8 @@ qtModule { outputs = [ "out" "dev" "bin" ]; passthru = { propagateEnv = { - # QT_PLUGIN_PATH = "%bin%/${qtbase.qtPluginPrefix}"; - QML2_IMPORT_PATH = "%bin%/${qtbase.qtQmlPrefix}"; + # 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 3786845c298fa..827d0f4c1ec9f 100644 --- a/pkgs/development/libraries/qt-5/modules/qtsvg.nix +++ b/pkgs/development/libraries/qt-5/modules/qtsvg.nix @@ -6,8 +6,8 @@ qtModule { outputs = [ "out" "dev" "bin" ]; passthru = { propagateEnv = { - QT_PLUGIN_PATH = "%bin%/${qtbase.qtPluginPrefix}"; - # QML2_IMPORT_PATH = "%bin%/${qtbase.qtQmlPrefix}"; + 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 1d191b031bd40..0a848b2b11b87 100644 --- a/pkgs/development/libraries/qt-5/modules/qtwayland.nix +++ b/pkgs/development/libraries/qt-5/modules/qtwayland.nix @@ -8,8 +8,8 @@ qtModule { outputs = [ "out" "dev" "bin" ]; passthru = { propagateEnv = { - QT_PLUGIN_PATH = "%bin%/${qtbase.qtPluginPrefix}"; - QML2_IMPORT_PATH = "%bin%/${qtbase.qtQmlPrefix}"; + QT_PLUGIN_PATH = "@bin@/${qtbase.qtPluginPrefix}"; + QML2_IMPORT_PATH = "@bin@/${qtbase.qtQmlPrefix}"; }; }; } From dda939a20d3a8830efe396b60cc9694114a27e79 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Mon, 13 Apr 2020 11:51:45 +0300 Subject: [PATCH 17/31] Support single value env keys - for GDK_PIXBUF_MODULE_FILE --- pkgs/build-support/neowrap.nix | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/pkgs/build-support/neowrap.nix b/pkgs/build-support/neowrap.nix index 2c78a6878c875..e063e795beb81 100644 --- a/pkgs/build-support/neowrap.nix +++ b/pkgs/build-support/neowrap.nix @@ -25,6 +25,11 @@ let wrapOut = { XDG_DATA_DIRS = "$out/share"; }; + # If you want an environment variable have a single value and that's it, + # put it here: + singleValue = [ + "GDK_PIXBUF_MODULE_FILE" + ]; }; # 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 @@ -109,7 +114,16 @@ let # TODO: make sure this works with any separator according to encyclopedia.separators sep = encyclopedia.separators.${key} or ":"; # default separator used for most wrappings in - "--prefix ${key} ${sep} ${builtins.concatStringsSep sep value}" + if builtins.elem key encyclopedia.singleValue then + if (builtins.length value) > 1 then + abort "neowrap.nix: there are two derivations in all of the \ + inputs of: ${builtins.toJSON allPkgs} that set ${key} to a value via a passthru, this \ + needs to be fixed via the passthrus of the derivations from this list: ${builtins.toJSON envPkgs}" + else + # Should this be "--set" ? + "--set-default ${key} ${builtins.elemAt value 0}" + else + "--prefix ${key} ${sep} ${builtins.concatStringsSep sep value}" ) ) envInfoWithLocal; # makeWrapperArgs_ = builtins.trace "makeWrapperArgs is ${(builtins.toJSON makeWrapperArgs)}" makeWrapperArgs; From 8999768c461d3940e2817270b8bdea578852571b Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Mon, 13 Apr 2020 23:35:56 +0300 Subject: [PATCH 18/31] Enable to refer to the unwrapped (real) drv of the wrapped drv --- pkgs/build-support/neowrap.nix | 1 + pkgs/top-level/all-packages.nix | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pkgs/build-support/neowrap.nix b/pkgs/build-support/neowrap.nix index e063e795beb81..6e59ca5e1b9fb 100644 --- a/pkgs/build-support/neowrap.nix +++ b/pkgs/build-support/neowrap.nix @@ -131,6 +131,7 @@ let symlinkJoin { name = "runtime-env"; paths = pkgList; + passthru.unwrapped = pkgList; buildInputs = [ makeWrapper ]; postBuild = '' diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 679e35ee99623..4ba15d4939437 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -21194,9 +21194,9 @@ in pianobooster = qt5.callPackage ../applications/audio/pianobooster { }; - picard = callPackage ../applications/audio/picard { }; + picard-oldy-wrapped = callPackage ../applications/audio/picard { }; - picard-newly-unwrapped = (picard.override { + picard-newly-unwrapped = (picard-oldy-wrapped.override { qt5 = qt5 // { wrapQtAppsHook = null; }; From 230044533d5b8e9e0921a3c93778b3457d5b0544 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Tue, 14 Apr 2020 14:02:02 +0300 Subject: [PATCH 19/31] some comments improvements --- pkgs/build-support/neowrap.nix | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pkgs/build-support/neowrap.nix b/pkgs/build-support/neowrap.nix index 6e59ca5e1b9fb..429f1d3179c56 100644 --- a/pkgs/build-support/neowrap.nix +++ b/pkgs/build-support/neowrap.nix @@ -4,6 +4,7 @@ , extraPkgsByOverride ? [] }: +# A single pkg or a list of pkgs mainly packaged pkgList: let @@ -25,7 +26,7 @@ let wrapOut = { XDG_DATA_DIRS = "$out/share"; }; - # If you want an environment variable have a single value and that's it, + # If you want an environment variable to have a single value and that's it, # put it here: singleValue = [ "GDK_PIXBUF_MODULE_FILE" @@ -52,7 +53,7 @@ let ) pkgs; allPkgs = (lib.lists.flatten pkgList) ++ extraPkgsByOverride ++ extraPkgs; allInputs = lib.lists.unique (lib.lists.flatten (getAllInputs allPkgs [])); - # allInputs_ = builtins.trace "${builtins.toJSON allInputs}" allInputs; + # 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: @@ -84,8 +85,11 @@ let ; envInfo = 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: replaceAllOutputs { inherit pkg; From 32dd55378acafd6695f327bcb976bee70444079f Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Tue, 14 Apr 2020 14:06:23 +0300 Subject: [PATCH 20/31] Use envInfo as was once envInfoFolded - for readability --- pkgs/build-support/neowrap.nix | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/pkgs/build-support/neowrap.nix b/pkgs/build-support/neowrap.nix index 429f1d3179c56..ab2cb5d2a5423 100644 --- a/pkgs/build-support/neowrap.nix +++ b/pkgs/build-support/neowrap.nix @@ -36,7 +36,7 @@ let # 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 = + getAllInputs = pkgs: pkgsFound: map ( @@ -83,7 +83,7 @@ let envStr; } ; - envInfo = map ( + envInfo = lib.attrsets.foldAttrs (n: a: [n] ++ a) [] (map ( pkg: # for every package in envPkgs, do the following for every env key and value (lib.attrsets.mapAttrs ( @@ -97,10 +97,8 @@ let envStr = value; } ) pkg.propagateEnv) - ) envPkgs; + ) envPkgs); # envInfo_ = builtins.trace "envInfo is ${(builtins.toJSON envInfo)}" envInfo; - envInfoFolded = lib.attrsets.foldAttrs (n: a: [n] ++ a) [] envInfo; - # envInfoFolded_ = builtins.trace "envInfoFolded is ${(builtins.toJSON envInfoFolded)}" envInfoFolded; # Where we add stuff according to encyclopedia.wrapOut envInfoWithLocal = lib.attrsets.mapAttrs ( name: @@ -109,7 +107,7 @@ let values ++ (lib.lists.flatten encyclopedia.wrapOut.${name}) else values - ) envInfoFolded; + ) envInfo; # envInfoWithLocal_ = builtins.trace "envInfoWithLocal is ${(builtins.toJSON envInfoWithLocal)}" envInfoWithLocal; makeWrapperArgs = lib.attrsets.mapAttrsToList ( key: From 277ac5440c569a7b5c5fca2954f3d6589795d242 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Tue, 14 Apr 2020 16:37:52 +0300 Subject: [PATCH 21/31] Instead of using many values in env vars, enable to use a link argument that configures this behavior --- pkgs/build-support/neowrap.nix | 131 ++++++++++++++++++++++++-------- pkgs/top-level/all-packages.nix | 9 ++- 2 files changed, 103 insertions(+), 37 deletions(-) diff --git a/pkgs/build-support/neowrap.nix b/pkgs/build-support/neowrap.nix index ab2cb5d2a5423..5d5571dec11b2 100644 --- a/pkgs/build-support/neowrap.nix +++ b/pkgs/build-support/neowrap.nix @@ -1,6 +1,7 @@ { lib , symlinkJoin , makeWrapper +, lndir , extraPkgsByOverride ? [] }: @@ -10,7 +11,19 @@ pkgList: let wrapper = { extraPkgs ? [], - extraMakeWrapperArgs ? "" + extraMakeWrapperArgs ? "", + # An attribute set that tells the builder how to handle links per file / + # directory found in every key of propagateEnv. E.g: + link ? { + # TODO: use byEnvKey and byPath packages + # Tells the builder to link the files in every directory that propagates + # XDG_DATA_DIRS TODO: for e.g XDG_DATA_DIRS, use the value in + # encyclopedia.wrapOut to decide to where to actually link the files to. + XDG_DATA_DIRS = "link"; + # Tells the builder to simply link all the files of a package that propagets this env var + GI_TYPELIB_PATH = "linkPkg"; + }, + # link ? {} }: let # Where we keep general knowledge about known to be used environmental variables @@ -22,10 +35,18 @@ let }; # 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 - # args. You can put a list as a value as well. + # values. wrapOut = { XDG_DATA_DIRS = "$out/share"; }; + # 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"; + }; # If you want an environment variable to have a single value and that's it, # put it here: singleValue = [ @@ -83,7 +104,12 @@ let envStr; } ; - envInfo = lib.attrsets.foldAttrs (n: a: [n] ++ a) [] (map ( + # 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 = map ( + 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 ( @@ -91,55 +117,94 @@ let name: # env var value value: - replaceAllOutputs { - inherit pkg; - outputs = pkg.outputs; - envStr = value; - } + let + real_value = replaceAllOutputs { + inherit pkg; + outputs = pkg.outputs; + envStr = value; + }; + in + if builtins.hasAttr name link then + if builtins.hasAttr name encyclopedia.linkPaths then + { + 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 + real_value ) pkg.propagateEnv) ) envPkgs); - # envInfo_ = builtins.trace "envInfo is ${(builtins.toJSON envInfo)}" envInfo; - # Where we add stuff according to encyclopedia.wrapOut - envInfoWithLocal = lib.attrsets.mapAttrs ( - name: - values: - if builtins.hasAttr name encyclopedia.wrapOut then - values ++ (lib.lists.flatten encyclopedia.wrapOut.${name}) - else - values - ) envInfo; - # envInfoWithLocal_ = builtins.trace "envInfoWithLocal is ${(builtins.toJSON envInfoWithLocal)}" envInfoWithLocal; - makeWrapperArgs = lib.attrsets.mapAttrsToList ( + # ) envPkgs; + envInfo_ = builtins.trace "envInfo is ${(builtins.toJSON envInfo)}" envInfo; + makeWrapperArgs = lib.lists.flatten (lib.attrsets.mapAttrsToList ( key: value: (let - # TODO: make sure this works with any separator according to encyclopedia.separators sep = encyclopedia.separators.${key} or ":"; # default separator used for most wrappings in - if builtins.elem key encyclopedia.singleValue then - if (builtins.length value) > 1 then - abort "neowrap.nix: there are two derivations in all of the \ - inputs of: ${builtins.toJSON allPkgs} that set ${key} to a value via a passthru, this \ - needs to be fixed via the passthrus of the derivations from this list: ${builtins.toJSON envPkgs}" + # To filter out envInfo changed via the `link` 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 - # Should this be "--set" ? - "--set-default ${key} ${builtins.elemAt value 0}" + "--prefix ${key} ${sep} ${builtins.concatStringsSep sep value}" + else + # removed by lib.lists.remove at the beginning + "--prefix ${key} ${sep} ${(builtins.elemAt value 0).linkTo}" + ) + ) + # Before calculating makeWrapperArgs, we need to add values to env vars + # according to encyclopedia.wrapOut: + (lib.attrsets.mapAttrs ( + name: + values: + if builtins.hasAttr name encyclopedia.wrapOut && builtins.isList values then + if builtins.elem encyclopedia.wrapOut.${name} values then + values + else + values ++ [encyclopedia.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 ${v.linkFrom} ${v.linkTo}" + ) values) else - "--prefix ${key} ${sep} ${builtins.concatStringsSep sep value}" + # removed by lib.lists.flatten at the beginning + [] ) - ) envInfoWithLocal; - # makeWrapperArgs_ = builtins.trace "makeWrapperArgs is ${(builtins.toJSON makeWrapperArgs)}" makeWrapperArgs; + ) + envInfo + ); + linkCmds_ = builtins.trace "linkCmds is ${builtins.toJSON linkCmds}" linkCmds; in symlinkJoin { name = "runtime-env"; paths = pkgList; passthru.unwrapped = pkgList; - buildInputs = [ makeWrapper ]; + buildInputs = [ makeWrapper lndir ]; postBuild = '' for i in $out/bin/*; do - wrapProgram "$i" ${(builtins.concatStringsSep " " makeWrapperArgs)} + wrapProgram "$i" ${builtins.concatStringsSep " " makeWrapperArgs_} done + ${builtins.concatStringsSep "\n" linkCmds_} ''; }; in diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 4ba15d4939437..e2a1f40801477 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -659,10 +659,11 @@ in archivemount = callPackage ../tools/filesystems/archivemount { }; - arandr = callPackage ../tools/X11/arandr { }; + arandr-oldy-wrapped = callPackage ../tools/X11/arandr { }; - arandr-newly-unwrapped = arandr.override { wrapGAppsHook = null; }; - arandr-newly-wrapped = wrapGApps arandr-newly-unwrapped { }; + arandr-newly-wrapped = wrapGApps (arandr-oldy-wrapped.override { + wrapGAppsHook = null; + }) { }; inherit (callPackages ../servers/nosql/arangodb { stdenv = gcc8Stdenv; @@ -22286,7 +22287,7 @@ in wrapNeovim = callPackage ../applications/editors/neovim/wrapper.nix { }; - wrapGeneric = callPackage ../build-support/neowrap.nix {}; + wrapGeneric = callPackage ../build-support/neowrap.nix { lndir = xorg.lndir; }; wrapGApps = wrapGeneric.override { extraPkgsByOverride = [ dconf From 0ed98f435ddf92597d97cbefabdc4aa17db66cd3 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Tue, 14 Apr 2020 17:06:51 +0300 Subject: [PATCH 22/31] Make it possible to lndir whole packages by env --- pkgs/build-support/neowrap.nix | 47 ++++++++++++++++++++++------------ 1 file changed, 31 insertions(+), 16 deletions(-) diff --git a/pkgs/build-support/neowrap.nix b/pkgs/build-support/neowrap.nix index 5d5571dec11b2..4f856220deb00 100644 --- a/pkgs/build-support/neowrap.nix +++ b/pkgs/build-support/neowrap.nix @@ -14,16 +14,19 @@ let extraMakeWrapperArgs ? "", # An attribute set that tells the builder how to handle links per file / # directory found in every key of propagateEnv. E.g: - link ? { - # TODO: use byEnvKey and byPath packages + /*** example value *** + linkByEnv = { # Tells the builder to link the files in every directory that propagates - # XDG_DATA_DIRS TODO: for e.g XDG_DATA_DIRS, use the value in - # encyclopedia.wrapOut to decide to where to actually link the files to. + # XDG_DATA_DIRS. XDG_DATA_DIRS = "link"; - # Tells the builder to simply link all the files of a package that propagets this env var + # 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 `out` is chosen unconditionally. Useful for + # python / other languages wrappings GI_TYPELIB_PATH = "linkPkg"; }, - # link ? {} + */ + linkByEnv ? {}, }: let # Where we keep general knowledge about known to be used environmental variables @@ -124,12 +127,21 @@ let envStr = value; }; in - if builtins.hasAttr name link then + if builtins.hasAttr name linkByEnv then if builtins.hasAttr name encyclopedia.linkPaths then - { - linkTo = encyclopedia.linkPaths.${name}; - linkFrom = real_value; - } + if linkByEnv.${name} == "link" then + { + linkType = "normal"; + linkTo = encyclopedia.linkPaths.${name}; + linkFrom = real_value; + } + else # linkByEnv.${name} == "linkPkg" + { + linkType = "pkg"; + linkTo = "$out"; + # "out" is not always the default + linkFrom = pkg.out; + } 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 @@ -144,7 +156,7 @@ let (let sep = encyclopedia.separators.${key} or ":"; # default separator used for most wrappings in - # To filter out envInfo changed via the `link` argument + # 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 @@ -155,8 +167,11 @@ let else "--prefix ${key} ${sep} ${builtins.concatStringsSep sep value}" else - # removed by lib.lists.remove at the beginning - "--prefix ${key} ${sep} ${(builtins.elemAt value 0).linkTo}" + # 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 + "--prefix ${key} ${sep} ${encyclopedia.linkPaths.${key}}" ) ) # Before calculating makeWrapperArgs, we need to add values to env vars @@ -183,7 +198,7 @@ let if builtins.isAttrs (builtins.elemAt values 0) then (map ( v: - "mkdir -p ${v.linkTo} && lndir ${v.linkFrom} ${v.linkTo}" + "mkdir -p ${v.linkTo} && lndir -silent ${v.linkFrom} ${v.linkTo}" ) values) else # removed by lib.lists.flatten at the beginning @@ -201,10 +216,10 @@ let buildInputs = [ makeWrapper lndir ]; postBuild = '' + ${builtins.concatStringsSep "\n" linkCmds_} for i in $out/bin/*; do wrapProgram "$i" ${builtins.concatStringsSep " " makeWrapperArgs_} done - ${builtins.concatStringsSep "\n" linkCmds_} ''; }; in From 270ffc2c785f62b888f2376c33102f7e78036ece Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Tue, 14 Apr 2020 19:16:48 +0300 Subject: [PATCH 23/31] Test and make picard work as well with new features --- pkgs/build-support/neowrap.nix | 10 +++++++--- pkgs/top-level/all-packages.nix | 11 ++++++----- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/pkgs/build-support/neowrap.nix b/pkgs/build-support/neowrap.nix index 4f856220deb00..8dffd4eadf6dd 100644 --- a/pkgs/build-support/neowrap.nix +++ b/pkgs/build-support/neowrap.nix @@ -2,6 +2,7 @@ , symlinkJoin , makeWrapper , lndir +, pkgs , extraPkgsByOverride ? [] }: @@ -21,11 +22,13 @@ let 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 `out` is chosen unconditionally. Useful for + # result as every pkg's all outputs are used unconditionally. Useful for # python / other languages wrappings GI_TYPELIB_PATH = "linkPkg"; }, */ + # TODO: Decide what to do when `linkPkg` is used here and the file + # nix-support/propagated-build-inputs has different values per package linkByEnv ? {}, }: let @@ -49,6 +52,8 @@ let 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}"; }; # If you want an environment variable to have a single value and that's it, # put it here: @@ -139,8 +144,7 @@ let { linkType = "pkg"; linkTo = "$out"; - # "out" is not always the default - linkFrom = pkg.out; + linkFrom = pkg; } 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" diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index e2a1f40801477..98414a12966fc 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -21197,14 +21197,15 @@ in picard-oldy-wrapped = callPackage ../applications/audio/picard { }; - picard-newly-unwrapped = (picard-oldy-wrapped.override { + picard-newly-wrapped = wrapGeneric ( + (picard-oldy-wrapped.override { qt5 = qt5 // { wrapQtAppsHook = null; }; - }).overrideAttrs(oldAttrs: { - preFixup = ""; - }); - picard-newly-wrapped = wrapGeneric picard-newly-unwrapped {}; + }).overrideAttrs(oldAttrs: { + preFixup = ""; + }) + ) { }; picocom = callPackage ../tools/misc/picocom { inherit (darwin.apple_sdk.frameworks) IOKit; From aea2b5a2a61247b80f0e3acbd5ef8fb47e87c946 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Wed, 15 Apr 2020 11:31:14 +0300 Subject: [PATCH 24/31] Prepare support for python wrappings --- pkgs/build-support/neowrap.nix | 72 +++++++++++++++---- .../python-modules/Babel/default.nix | 7 +- .../python-modules/alabaster/default.nix | 7 +- .../python-modules/certifi/default.nix | 6 ++ .../python-modules/chardet/default.nix | 7 +- .../python-modules/cycler/default.nix | 6 ++ .../python-modules/dateutil/default.nix | 7 +- .../python-modules/dbus/default.nix | 6 ++ .../python-modules/docutils/default.nix | 5 ++ .../python-modules/html5lib/default.nix | 6 ++ .../python-modules/idna/default.nix | 8 ++- .../python-modules/imagesize/default.nix | 6 ++ .../python-modules/jinja2/default.nix | 6 ++ .../python-modules/kiwisolver/default.nix | 6 ++ .../python-modules/matplotlib/default.nix | 10 ++- .../python-modules/mock/default.nix | 5 ++ .../python-modules/numpy/default.nix | 3 + .../python-modules/pyparsing/default.nix | 7 +- pkgs/development/python-modules/pyqt/5.x.nix | 6 ++ .../python-modules/pytz/default.nix | 5 ++ .../python-modules/requests/default.nix | 7 +- .../python-modules/setuptools/default.nix | 5 ++ .../python-modules/simplejson/default.nix | 6 ++ .../python-modules/six/default.nix | 6 ++ .../snowballstemmer/default.nix | 8 ++- .../python-modules/sphinx/default.nix | 5 ++ .../python-modules/tkinter/default.nix | 5 ++ .../python-modules/tornado/default.nix | 5 ++ .../python-modules/urllib3/default.nix | 7 +- .../python-modules/whoosh/default.nix | 7 +- pkgs/top-level/all-packages.nix | 28 +++++++- 31 files changed, 250 insertions(+), 30 deletions(-) diff --git a/pkgs/build-support/neowrap.nix b/pkgs/build-support/neowrap.nix index 8dffd4eadf6dd..e0cca9a630bfd 100644 --- a/pkgs/build-support/neowrap.nix +++ b/pkgs/build-support/neowrap.nix @@ -26,6 +26,11 @@ let # 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 @@ -54,12 +59,26 @@ let 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 + ]; }; # 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 @@ -70,24 +89,48 @@ let pkgsFound: map ( pkg: - if (builtins.typeOf pkg) == "set" then - if builtins.hasAttr "buildInputs" pkg || builtins.hasAttr "propagatedBuildInputs" pkg then - # builtins.trace "pkg is of type ${builtins.typeOf pkg} and it's ${builtins.toJSON pkg}, with inputs: ${builtins.toJSON (pkg.buildInputs ++ pkg.propagatedBuildInputs)}" (getAllInputs (pkg.buildInputs ++ pkg.propagatedBuildInputs) (pkgsFound ++ [ pkg ])) - (getAllInputs (pkg.buildInputs ++ pkg.propagatedBuildInputs) (pkgsFound ++ [ pkg ])) - else - pkgsFound ++ [ pkg ] + if builtins.isAttrs pkg then + let + inEncyclopedia = lib.lists.any ( + knownPkg: + # From some reason, pkg == knownPkg doesn't work :/ don't know + # why... Never the less this should be good enough + pkg.name == knownPkg.name + ) encyclopedia.skipDivingInto; + inEncyclopedia_ = builtins.trace "${pkg.name} in Encyclopedia: ${builtins.toJSON inEncyclopedia}" inEncyclopedia; + diveCheck = ( + if inEncyclopedia then + false + else + (pkg.buildInputs != [] || pkg.propagatedBuildInputs != []) + ); + in + if diveCheck then + let + # deeperPkgs = builtins.trace "inspecting ${pkg.name}" pkg.buildInputs ++ pkg.propagatedBuildInputs; + deeperPkgs = pkg.buildInputs ++ pkg.propagatedBuildInputs; + currentPkgs = pkgsFound ++ pkgs; + in + (getAllInputs deeperPkgs currentPkgs) + else + pkgsFound ++ [ pkg ] else - # builtins.trace "pkg is not a set but a ${builtins.typeOf pkg} at ${builtins.toJSON pkg}, current pkgsFound is ${builtins.toJSON pkgsFound}" pkgsFound - pkgsFound - ) pkgs; + [] + ) pkgs + ; allPkgs = (lib.lists.flatten pkgList) ++ extraPkgsByOverride ++ extraPkgs; + allPkgs_ = builtins.trace "allPkgs is: ${builtins.toJSON allPkgs}" allPkgs; allInputs = lib.lists.unique (lib.lists.flatten (getAllInputs allPkgs [])); - # allInputs_ = builtins.trace "allInputs is: ${builtins.toJSON allInputs}" allInputs; + 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: - (builtins.hasAttr "propagateEnv" pkg) + if builtins.isAttrs pkg then + (builtins.hasAttr "propagateEnv" pkg) + else + false ) allInputs; + 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 @@ -144,7 +187,8 @@ let { linkType = "pkg"; linkTo = "$out"; - linkFrom = pkg; + # Should this be `pkg.dev` or simply `pkg` ? + linkFrom = pkg.out; } 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" @@ -220,9 +264,9 @@ let buildInputs = [ makeWrapper lndir ]; postBuild = '' - ${builtins.concatStringsSep "\n" linkCmds_} + ${builtins.concatStringsSep "\n" linkCmds} for i in $out/bin/*; do - wrapProgram "$i" ${builtins.concatStringsSep " " makeWrapperArgs_} + wrapProgram "$i" ${builtins.concatStringsSep " " makeWrapperArgs} done ''; }; diff --git a/pkgs/development/python-modules/Babel/default.nix b/pkgs/development/python-modules/Babel/default.nix index 1074d2eef48c8..9d91662d17ade 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 = { + 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..aba74687248d0 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 = { + 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..7a151b98a733b 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 = { + 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..0f1655c72a9fa 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 = { + 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..6952a98e20124 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 = { + 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..89e77d1f435b6 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 = { + 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..a20933aaebdda 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 = { + 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/docutils/default.nix b/pkgs/development/python-modules/docutils/default.nix index 8c1fb3720ca12..2d66650e6781d 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 = { + 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..b9e76977564ac 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 = { + 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..cdbac84c8e15b 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 = { + 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..83f1ff8a0751a 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 = { + 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..c0b5177322665 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 = { + 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..0acea1206eaf6 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 = { + 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..9afeacd98c601 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 = { + 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..2387c4395fb9c 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 = { + PYTHONPATH = "@out@/${python.sitePackages}"; + }; + }; meta = with lib; { description = "Mock objects for Python"; diff --git a/pkgs/development/python-modules/numpy/default.nix b/pkgs/development/python-modules/numpy/default.nix index a863ef60d4aa7..bb53408e868da 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 = { + PYTHONPATH = "@out@/${python.sitePackages}"; + }; }; # Disable test diff --git a/pkgs/development/python-modules/pyparsing/default.nix b/pkgs/development/python-modules/pyparsing/default.nix index 4acc4fa804b36..1974676003a04 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 = { + 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..513d41ba26332 100644 --- a/pkgs/development/python-modules/pyqt/5.x.nix +++ b/pkgs/development/python-modules/pyqt/5.x.nix @@ -135,6 +135,12 @@ in buildPythonPackage rec { ${python.interpreter} -c "${imports}" ''; + passthru = { + propagateEnv = { + 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..357b77e26c2ed 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 = { + 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..c470804620005 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 = { + 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..8e12821d37d9b 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 = { + 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..cf2d1978710e2 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 = { + 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..66894b21e7b90 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 = { + 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..d0f66c1114a4a 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 = { + 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..393bd9bee763e 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 = { + 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..0fcae34eadaf2 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 = { + 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..5e9cf5d2932fe 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 = { + 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..4fa4ed10523f7 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 = { + PYTHONPATH = "@out@/${python.sitePackages}"; + }; + }; meta = with stdenv.lib; { description = "Fast, pure-Python full text indexing, search, and spell diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 98414a12966fc..6a7fcc6166223 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -21195,15 +21195,37 @@ in pianobooster = qt5.callPackage ../applications/audio/pianobooster { }; + test-new-py-env = wrapGeneric python3 { + linkByEnv = { + PYTHONPATH = "linkPkg"; + }; + extraPkgs = with python3.pkgs; [ + # Not 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; - }; + qt5 = qt5 // { + wrapQtAppsHook = null; + }; }).overrideAttrs(oldAttrs: { preFixup = ""; + dontWrapPythonPrograms = true; }) ) { }; From e6f9600513a92ee24cf96e7db6706cfb8655fd7d Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Wed, 15 Apr 2020 19:31:18 +0300 Subject: [PATCH 25/31] Improve getAllInputs recursiveness --- pkgs/build-support/neowrap.nix | 41 ++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/pkgs/build-support/neowrap.nix b/pkgs/build-support/neowrap.nix index e0cca9a630bfd..022fce03efe43 100644 --- a/pkgs/build-support/neowrap.nix +++ b/pkgs/build-support/neowrap.nix @@ -77,7 +77,9 @@ let 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 + 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 @@ -91,24 +93,29 @@ let pkg: if builtins.isAttrs pkg then let - inEncyclopedia = lib.lists.any ( - knownPkg: - # From some reason, pkg == knownPkg doesn't work :/ don't know - # why... Never the less this should be good enough - pkg.name == knownPkg.name - ) encyclopedia.skipDivingInto; - inEncyclopedia_ = builtins.trace "${pkg.name} in Encyclopedia: ${builtins.toJSON inEncyclopedia}" inEncyclopedia; - diveCheck = ( - if inEncyclopedia then - false - else - (pkg.buildInputs != [] || pkg.propagatedBuildInputs != []) - ); + 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 diveCheck then + if !(inEncyclopedia pkg) && hasInputs then let - # deeperPkgs = builtins.trace "inspecting ${pkg.name}" pkg.buildInputs ++ pkg.propagatedBuildInputs; - deeperPkgs = pkg.buildInputs ++ pkg.propagatedBuildInputs; + # 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) From f50caf8299acb8a138e0a20b1eb887ab00b8826b Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Wed, 15 Apr 2020 20:09:03 +0300 Subject: [PATCH 26/31] Make sure picard and arandr dont wrap python scripts, letting wrapGeneric do the job --- pkgs/applications/audio/picard/default.nix | 1 + pkgs/tools/X11/arandr/default.nix | 2 ++ pkgs/top-level/all-packages.nix | 3 --- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/applications/audio/picard/default.nix b/pkgs/applications/audio/picard/default.nix index 8a5c947d3d39a..0c612338361f4 100644 --- a/pkgs/applications/audio/picard/default.nix +++ b/pkgs/applications/audio/picard/default.nix @@ -45,6 +45,7 @@ in pythonPackages.buildPythonApplication rec { substituteInPlace setup.cfg --replace "‘" "'" ''; + dontWrapPythonPrograms = (qt5.wrapQtAppsHook == null); # In order to spare double wrapping, we use: preFixup = '' makeWrapperArgs+=("''${qtWrapperArgs[@]}") 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 6a7fcc6166223..ea6d2e744ef85 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -21223,9 +21223,6 @@ in qt5 = qt5 // { wrapQtAppsHook = null; }; - }).overrideAttrs(oldAttrs: { - preFixup = ""; - dontWrapPythonPrograms = true; }) ) { }; From 2ca4dc7d8bb92e21119b69cf8ce005032229e158 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Wed, 15 Apr 2020 20:42:10 +0300 Subject: [PATCH 27/31] Add propagateEnv for more python deps of picard and arandr --- pkgs/development/python-modules/discid/default.nix | 7 ++++++- pkgs/development/python-modules/mutagen/default.nix | 7 +++++++ pkgs/development/python-modules/pycairo/default.nix | 8 +++++++- pkgs/development/python-modules/pygobject/3.nix | 5 ++++- 4 files changed, 24 insertions(+), 3 deletions(-) diff --git a/pkgs/development/python-modules/discid/default.nix b/pkgs/development/python-modules/discid/default.nix index 2684d4a06a911..de5a1af770acb 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 = { + PYTHONPATH = "@out@/${python.sitePackages}"; + }; + }; patchPhase = let extension = stdenv.hostPlatform.extensions.sharedLibrary; in diff --git a/pkgs/development/python-modules/mutagen/default.nix b/pkgs/development/python-modules/mutagen/default.nix index 304aeead76ff0..2883ce1949400 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 = { + PYTHONPATH = "@out@/${python.sitePackages}"; + }; + }; + meta = with lib; { description = "Python multimedia tagging library"; diff --git a/pkgs/development/python-modules/pycairo/default.nix b/pkgs/development/python-modules/pycairo/default.nix index fbefd7efefa66..70de08fe3df35 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 = { + 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..4edbc003f08e6 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 = { + PYTHONPATH = "@out@/${python.sitePackages}"; + }; }; meta = with stdenv.lib; { From 8c74d6aae3ad2193c604c35b6f4d3de863609f66 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Wed, 15 Apr 2020 20:52:19 +0300 Subject: [PATCH 28/31] Move wrapOut to wrapper arguments, out of encyclopedia --- pkgs/build-support/neowrap.nix | 24 ++++++++++++++---------- pkgs/top-level/all-packages.nix | 24 ++++++++++++++++++------ 2 files changed, 32 insertions(+), 16 deletions(-) diff --git a/pkgs/build-support/neowrap.nix b/pkgs/build-support/neowrap.nix index 022fce03efe43..9bcbb011d6a5f 100644 --- a/pkgs/build-support/neowrap.nix +++ b/pkgs/build-support/neowrap.nix @@ -35,6 +35,16 @@ let # 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 @@ -44,12 +54,6 @@ let separators = { # XDG_DATA_DIRS = ":"; }; - # 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. - wrapOut = { - XDG_DATA_DIRS = "$out/share"; - }; # 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 @@ -230,15 +234,15 @@ let ) ) # Before calculating makeWrapperArgs, we need to add values to env vars - # according to encyclopedia.wrapOut: + # according to the `wrapOut` argument: (lib.attrsets.mapAttrs ( name: values: - if builtins.hasAttr name encyclopedia.wrapOut && builtins.isList values then - if builtins.elem encyclopedia.wrapOut.${name} values then + if builtins.hasAttr name wrapOut && builtins.isList values then + if builtins.elem wrapOut.${name} values then values else - values ++ [encyclopedia.wrapOut.${name}] + values ++ [wrapOut.${name}] else values ) envInfo) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index ea6d2e744ef85..92a1cba3a097f 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -661,9 +661,16 @@ in arandr-oldy-wrapped = callPackage ../tools/X11/arandr { }; - arandr-newly-wrapped = wrapGApps (arandr-oldy-wrapped.override { - wrapGAppsHook = null; - }) { }; + arandr-newly-wrapped = wrapGApps ( + arandr-oldy-wrapped.override { + wrapGAppsHook = null; + }) { + wrapOut = { + XDG_DATA_DIRS = "$out/share"; + PYTHONPATH = "$out/${python3.sitePackages}"; + }; + } + ; inherit (callPackages ../servers/nosql/arangodb { stdenv = gcc8Stdenv; @@ -21219,12 +21226,17 @@ in picard-oldy-wrapped = callPackage ../applications/audio/picard { }; picard-newly-wrapped = wrapGeneric ( - (picard-oldy-wrapped.override { + picard-oldy-wrapped.override { qt5 = qt5 // { wrapQtAppsHook = null; }; - }) - ) { }; + }) { + wrapOut = { + XDG_DATA_DIRS = "$out/share"; + PYTHONPATH = "$out/${python3.sitePackages}"; + }; + } + ; picocom = callPackage ../tools/misc/picocom { inherit (darwin.apple_sdk.frameworks) IOKit; From 3a8e032374cb6d7f49ed32d95dc14a92b5cc479e Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Wed, 15 Apr 2020 20:53:59 +0300 Subject: [PATCH 29/31] Improve comments for debug statements / variables --- pkgs/build-support/neowrap.nix | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pkgs/build-support/neowrap.nix b/pkgs/build-support/neowrap.nix index 9bcbb011d6a5f..8f297c30b0004 100644 --- a/pkgs/build-support/neowrap.nix +++ b/pkgs/build-support/neowrap.nix @@ -130,8 +130,10 @@ let ) 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 ( @@ -141,6 +143,7 @@ let 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 %% @@ -170,7 +173,6 @@ let # 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 = map ( 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 @@ -207,7 +209,7 @@ let real_value ) pkg.propagateEnv) ) envPkgs); - # ) 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: @@ -266,6 +268,7 @@ let ) envInfo ); + # Useful for debugging, not evaluated if not used. linkCmds_ = builtins.trace "linkCmds is ${builtins.toJSON linkCmds}" linkCmds; in symlinkJoin { From 73bc870797f3696a38814000fbbff731d34282a0 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Thu, 16 Apr 2020 12:00:16 +0300 Subject: [PATCH 30/31] sed 's/PYTHONPATH/NIX_PYTHONPATH/g' as @FRidh suggested --- pkgs/development/python-modules/Babel/default.nix | 2 +- pkgs/development/python-modules/alabaster/default.nix | 2 +- pkgs/development/python-modules/certifi/default.nix | 2 +- pkgs/development/python-modules/chardet/default.nix | 2 +- pkgs/development/python-modules/cycler/default.nix | 2 +- pkgs/development/python-modules/dateutil/default.nix | 2 +- pkgs/development/python-modules/dbus/default.nix | 2 +- pkgs/development/python-modules/discid/default.nix | 2 +- pkgs/development/python-modules/docutils/default.nix | 2 +- pkgs/development/python-modules/html5lib/default.nix | 2 +- pkgs/development/python-modules/idna/default.nix | 2 +- pkgs/development/python-modules/imagesize/default.nix | 2 +- pkgs/development/python-modules/jinja2/default.nix | 2 +- pkgs/development/python-modules/kiwisolver/default.nix | 2 +- pkgs/development/python-modules/matplotlib/default.nix | 2 +- pkgs/development/python-modules/mock/default.nix | 2 +- pkgs/development/python-modules/mutagen/default.nix | 2 +- pkgs/development/python-modules/numpy/default.nix | 2 +- pkgs/development/python-modules/pycairo/default.nix | 2 +- pkgs/development/python-modules/pygobject/3.nix | 2 +- pkgs/development/python-modules/pyparsing/default.nix | 2 +- pkgs/development/python-modules/pyqt/5.x.nix | 6 +++--- pkgs/development/python-modules/pytz/default.nix | 2 +- pkgs/development/python-modules/requests/default.nix | 2 +- pkgs/development/python-modules/setuptools/default.nix | 2 +- pkgs/development/python-modules/simplejson/default.nix | 2 +- pkgs/development/python-modules/six/default.nix | 2 +- pkgs/development/python-modules/snowballstemmer/default.nix | 2 +- pkgs/development/python-modules/sphinx/default.nix | 2 +- pkgs/development/python-modules/tornado/default.nix | 2 +- pkgs/development/python-modules/urllib3/default.nix | 2 +- pkgs/development/python-modules/whoosh/default.nix | 2 +- pkgs/top-level/all-packages.nix | 4 ++-- 33 files changed, 36 insertions(+), 36 deletions(-) diff --git a/pkgs/development/python-modules/Babel/default.nix b/pkgs/development/python-modules/Babel/default.nix index 9d91662d17ade..d25ad2a4ba71a 100644 --- a/pkgs/development/python-modules/Babel/default.nix +++ b/pkgs/development/python-modules/Babel/default.nix @@ -31,7 +31,7 @@ buildPythonPackage rec { ]; passthru = { propagateEnv = { - PYTHONPATH = "@out@/${python.sitePackages}"; + NIX_PYTHONPATH = "@out@/${python.sitePackages}"; }; }; diff --git a/pkgs/development/python-modules/alabaster/default.nix b/pkgs/development/python-modules/alabaster/default.nix index aba74687248d0..1c4be72668d87 100644 --- a/pkgs/development/python-modules/alabaster/default.nix +++ b/pkgs/development/python-modules/alabaster/default.nix @@ -16,7 +16,7 @@ buildPythonPackage rec { doCheck = false; passthru = { propagateEnv = { - PYTHONPATH = "@out@/${python.sitePackages}"; + NIX_PYTHONPATH = "@out@/${python.sitePackages}"; }; }; diff --git a/pkgs/development/python-modules/certifi/default.nix b/pkgs/development/python-modules/certifi/default.nix index 7a151b98a733b..fc85208742044 100644 --- a/pkgs/development/python-modules/certifi/default.nix +++ b/pkgs/development/python-modules/certifi/default.nix @@ -14,7 +14,7 @@ buildPythonPackage rec { }; passthru = { propagateEnv = { - PYTHONPATH = "@out@/${python.sitePackages}"; + NIX_PYTHONPATH = "@out@/${python.sitePackages}"; }; }; diff --git a/pkgs/development/python-modules/chardet/default.nix b/pkgs/development/python-modules/chardet/default.nix index 0f1655c72a9fa..7794df8e2d76b 100644 --- a/pkgs/development/python-modules/chardet/default.nix +++ b/pkgs/development/python-modules/chardet/default.nix @@ -11,7 +11,7 @@ buildPythonPackage rec { }; passthru = { propagateEnv = { - PYTHONPATH = "@out@/${python.sitePackages}"; + NIX_PYTHONPATH = "@out@/${python.sitePackages}"; }; }; diff --git a/pkgs/development/python-modules/cycler/default.nix b/pkgs/development/python-modules/cycler/default.nix index 6952a98e20124..ea267d1d37736 100644 --- a/pkgs/development/python-modules/cycler/default.nix +++ b/pkgs/development/python-modules/cycler/default.nix @@ -29,7 +29,7 @@ buildPythonPackage rec { passthru = { propagateEnv = { - PYTHONPATH = "@out@/${python.sitePackages}"; + NIX_PYTHONPATH = "@out@/${python.sitePackages}"; }; }; diff --git a/pkgs/development/python-modules/dateutil/default.nix b/pkgs/development/python-modules/dateutil/default.nix index 89e77d1f435b6..93062a57fa071 100644 --- a/pkgs/development/python-modules/dateutil/default.nix +++ b/pkgs/development/python-modules/dateutil/default.nix @@ -19,7 +19,7 @@ buildPythonPackage rec { doCheck = false; passthru = { propagateEnv = { - PYTHONPATH = "@out@/${python.sitePackages}"; + NIX_PYTHONPATH = "@out@/${python.sitePackages}"; }; }; diff --git a/pkgs/development/python-modules/dbus/default.nix b/pkgs/development/python-modules/dbus/default.nix index a20933aaebdda..23a4e1c3421e3 100644 --- a/pkgs/development/python-modules/dbus/default.nix +++ b/pkgs/development/python-modules/dbus/default.nix @@ -21,7 +21,7 @@ buildPythonPackage rec { passthru = { propagateEnv = { - PYTHONPATH = "@out@/${python.sitePackages}"; + NIX_PYTHONPATH = "@out@/${python.sitePackages}"; }; }; diff --git a/pkgs/development/python-modules/discid/default.nix b/pkgs/development/python-modules/discid/default.nix index de5a1af770acb..d37c0ebea5f20 100644 --- a/pkgs/development/python-modules/discid/default.nix +++ b/pkgs/development/python-modules/discid/default.nix @@ -10,7 +10,7 @@ buildPythonPackage rec { }; passthru = { propagateEnv = { - PYTHONPATH = "@out@/${python.sitePackages}"; + NIX_PYTHONPATH = "@out@/${python.sitePackages}"; }; }; diff --git a/pkgs/development/python-modules/docutils/default.nix b/pkgs/development/python-modules/docutils/default.nix index 2d66650e6781d..54db9e15cd893 100644 --- a/pkgs/development/python-modules/docutils/default.nix +++ b/pkgs/development/python-modules/docutils/default.nix @@ -23,7 +23,7 @@ buildPythonPackage rec { ''; passthru = { propagateEnv = { - PYTHONPATH = "@out@/${python.sitePackages}"; + NIX_PYTHONPATH = "@out@/${python.sitePackages}"; }; }; diff --git a/pkgs/development/python-modules/html5lib/default.nix b/pkgs/development/python-modules/html5lib/default.nix index b9e76977564ac..6ebf1b77c8882 100644 --- a/pkgs/development/python-modules/html5lib/default.nix +++ b/pkgs/development/python-modules/html5lib/default.nix @@ -32,7 +32,7 @@ buildPythonPackage rec { ''; passthru = { propagateEnv = { - PYTHONPATH = "@out@/${python.sitePackages}"; + NIX_PYTHONPATH = "@out@/${python.sitePackages}"; }; }; diff --git a/pkgs/development/python-modules/idna/default.nix b/pkgs/development/python-modules/idna/default.nix index cdbac84c8e15b..54d357750d5d8 100644 --- a/pkgs/development/python-modules/idna/default.nix +++ b/pkgs/development/python-modules/idna/default.nix @@ -14,7 +14,7 @@ buildPythonPackage rec { }; passthru = { propagateEnv = { - PYTHONPATH = "@out@/${python.sitePackages}"; + NIX_PYTHONPATH = "@out@/${python.sitePackages}"; }; }; diff --git a/pkgs/development/python-modules/imagesize/default.nix b/pkgs/development/python-modules/imagesize/default.nix index 83f1ff8a0751a..a711eff68f981 100644 --- a/pkgs/development/python-modules/imagesize/default.nix +++ b/pkgs/development/python-modules/imagesize/default.nix @@ -14,7 +14,7 @@ buildPythonPackage rec { }; passthru = { propagateEnv = { - PYTHONPATH = "@out@/${python.sitePackages}"; + NIX_PYTHONPATH = "@out@/${python.sitePackages}"; }; }; diff --git a/pkgs/development/python-modules/jinja2/default.nix b/pkgs/development/python-modules/jinja2/default.nix index c0b5177322665..28d77b90ff6d4 100644 --- a/pkgs/development/python-modules/jinja2/default.nix +++ b/pkgs/development/python-modules/jinja2/default.nix @@ -27,7 +27,7 @@ buildPythonPackage rec { ''; passthru = { propagateEnv = { - PYTHONPATH = "@out@/${python.sitePackages}"; + NIX_PYTHONPATH = "@out@/${python.sitePackages}"; }; }; diff --git a/pkgs/development/python-modules/kiwisolver/default.nix b/pkgs/development/python-modules/kiwisolver/default.nix index 0acea1206eaf6..1a1d341fe586f 100644 --- a/pkgs/development/python-modules/kiwisolver/default.nix +++ b/pkgs/development/python-modules/kiwisolver/default.nix @@ -21,7 +21,7 @@ buildPythonPackage rec { doCheck = false; passthru = { propagateEnv = { - PYTHONPATH = "@out@/${python.sitePackages}"; + NIX_PYTHONPATH = "@out@/${python.sitePackages}"; }; }; diff --git a/pkgs/development/python-modules/matplotlib/default.nix b/pkgs/development/python-modules/matplotlib/default.nix index 9afeacd98c601..822283ee91b18 100644 --- a/pkgs/development/python-modules/matplotlib/default.nix +++ b/pkgs/development/python-modules/matplotlib/default.nix @@ -48,7 +48,7 @@ buildPythonPackage rec { passthru = { propagateEnv = { - PYTHONPATH = "@out@/${python.sitePackages}"; + NIX_PYTHONPATH = "@out@/${python.sitePackages}"; }; }; diff --git a/pkgs/development/python-modules/mock/default.nix b/pkgs/development/python-modules/mock/default.nix index 2387c4395fb9c..b07843c684e1a 100644 --- a/pkgs/development/python-modules/mock/default.nix +++ b/pkgs/development/python-modules/mock/default.nix @@ -30,7 +30,7 @@ buildPythonPackage rec { ''; passthru = { propagateEnv = { - PYTHONPATH = "@out@/${python.sitePackages}"; + NIX_PYTHONPATH = "@out@/${python.sitePackages}"; }; }; diff --git a/pkgs/development/python-modules/mutagen/default.nix b/pkgs/development/python-modules/mutagen/default.nix index 2883ce1949400..dacc2f5fd3a0b 100644 --- a/pkgs/development/python-modules/mutagen/default.nix +++ b/pkgs/development/python-modules/mutagen/default.nix @@ -28,7 +28,7 @@ buildPythonPackage rec { LC_ALL = "en_US.UTF-8"; passthru = { propagateEnv = { - PYTHONPATH = "@out@/${python.sitePackages}"; + NIX_PYTHONPATH = "@out@/${python.sitePackages}"; }; }; diff --git a/pkgs/development/python-modules/numpy/default.nix b/pkgs/development/python-modules/numpy/default.nix index bb53408e868da..9986b081a9147 100644 --- a/pkgs/development/python-modules/numpy/default.nix +++ b/pkgs/development/python-modules/numpy/default.nix @@ -71,7 +71,7 @@ in buildPythonPackage rec { blas = blas; inherit blasImplementation cfg; propagateEnv = { - PYTHONPATH = "@out@/${python.sitePackages}"; + NIX_PYTHONPATH = "@out@/${python.sitePackages}"; }; }; diff --git a/pkgs/development/python-modules/pycairo/default.nix b/pkgs/development/python-modules/pycairo/default.nix index 70de08fe3df35..03a3aaf60e2c7 100644 --- a/pkgs/development/python-modules/pycairo/default.nix +++ b/pkgs/development/python-modules/pycairo/default.nix @@ -28,7 +28,7 @@ buildPythonPackage rec { passthru = { propagateEnv = { - PYTHONPATH = "@out@/${python.sitePackages}"; + NIX_PYTHONPATH = "@out@/${python.sitePackages}"; }; }; diff --git a/pkgs/development/python-modules/pygobject/3.nix b/pkgs/development/python-modules/pygobject/3.nix index 4edbc003f08e6..a0916d6444833 100644 --- a/pkgs/development/python-modules/pygobject/3.nix +++ b/pkgs/development/python-modules/pygobject/3.nix @@ -29,7 +29,7 @@ buildPythonPackage rec { attrPath = "python3.pkgs.${pname}3"; }; propagateEnv = { - PYTHONPATH = "@out@/${python.sitePackages}"; + NIX_PYTHONPATH = "@out@/${python.sitePackages}"; }; }; diff --git a/pkgs/development/python-modules/pyparsing/default.nix b/pkgs/development/python-modules/pyparsing/default.nix index 1974676003a04..5dae0cc9e3a58 100644 --- a/pkgs/development/python-modules/pyparsing/default.nix +++ b/pkgs/development/python-modules/pyparsing/default.nix @@ -25,7 +25,7 @@ buildPythonPackage rec { ''; passthru = { propagateEnv = { - PYTHONPATH = "@out@/${python.sitePackages}"; + NIX_PYTHONPATH = "@out@/${python.sitePackages}"; }; }; diff --git a/pkgs/development/python-modules/pyqt/5.x.nix b/pkgs/development/python-modules/pyqt/5.x.nix index 513d41ba26332..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 @@ -137,7 +137,7 @@ in buildPythonPackage rec { passthru = { propagateEnv = { - PYTHONPATH = "@out@/${python.sitePackages}"; + NIX_PYTHONPATH = "@out@/${python.sitePackages}"; }; }; diff --git a/pkgs/development/python-modules/pytz/default.nix b/pkgs/development/python-modules/pytz/default.nix index 357b77e26c2ed..dd46a80162901 100644 --- a/pkgs/development/python-modules/pytz/default.nix +++ b/pkgs/development/python-modules/pytz/default.nix @@ -14,7 +14,7 @@ buildPythonPackage rec { ''; passthru = { propagateEnv = { - PYTHONPATH = "@out@/${python.sitePackages}"; + NIX_PYTHONPATH = "@out@/${python.sitePackages}"; }; }; diff --git a/pkgs/development/python-modules/requests/default.nix b/pkgs/development/python-modules/requests/default.nix index c470804620005..064c5c4446052 100644 --- a/pkgs/development/python-modules/requests/default.nix +++ b/pkgs/development/python-modules/requests/default.nix @@ -12,7 +12,7 @@ buildPythonPackage rec { }; passthru = { propagateEnv = { - PYTHONPATH = "@out@/${python.sitePackages}"; + NIX_PYTHONPATH = "@out@/${python.sitePackages}"; }; }; diff --git a/pkgs/development/python-modules/setuptools/default.nix b/pkgs/development/python-modules/setuptools/default.nix index 8e12821d37d9b..c35f819bab44d 100644 --- a/pkgs/development/python-modules/setuptools/default.nix +++ b/pkgs/development/python-modules/setuptools/default.nix @@ -57,7 +57,7 @@ in buildPythonPackage rec { ''; passthru = { propagateEnv = { - PYTHONPATH = "@out@/${python.sitePackages}"; + NIX_PYTHONPATH = "@out@/${python.sitePackages}"; }; }; diff --git a/pkgs/development/python-modules/simplejson/default.nix b/pkgs/development/python-modules/simplejson/default.nix index cf2d1978710e2..6de9b8ace649b 100644 --- a/pkgs/development/python-modules/simplejson/default.nix +++ b/pkgs/development/python-modules/simplejson/default.nix @@ -27,7 +27,7 @@ buildPythonPackage rec { ''; passthru = { propagateEnv = { - PYTHONPATH = "@out@/${python.sitePackages}"; + NIX_PYTHONPATH = "@out@/${python.sitePackages}"; }; }; diff --git a/pkgs/development/python-modules/six/default.nix b/pkgs/development/python-modules/six/default.nix index 66894b21e7b90..29b700d900fb1 100644 --- a/pkgs/development/python-modules/six/default.nix +++ b/pkgs/development/python-modules/six/default.nix @@ -21,7 +21,7 @@ buildPythonPackage rec { ''; passthru = { propagateEnv = { - PYTHONPATH = "@out@/${python.sitePackages}"; + NIX_PYTHONPATH = "@out@/${python.sitePackages}"; }; }; diff --git a/pkgs/development/python-modules/snowballstemmer/default.nix b/pkgs/development/python-modules/snowballstemmer/default.nix index d0f66c1114a4a..499b8b77b05a8 100644 --- a/pkgs/development/python-modules/snowballstemmer/default.nix +++ b/pkgs/development/python-modules/snowballstemmer/default.nix @@ -14,7 +14,7 @@ buildPythonPackage rec { passthru = { propagateEnv = { - PYTHONPATH = "@out@/${python.sitePackages}"; + NIX_PYTHONPATH = "@out@/${python.sitePackages}"; }; }; diff --git a/pkgs/development/python-modules/sphinx/default.nix b/pkgs/development/python-modules/sphinx/default.nix index 393bd9bee763e..b3d0821583409 100644 --- a/pkgs/development/python-modules/sphinx/default.nix +++ b/pkgs/development/python-modules/sphinx/default.nix @@ -41,7 +41,7 @@ buildPythonPackage rec { LC_ALL = "en_US.UTF-8"; passthru = { propagateEnv = { - PYTHONPATH = "@out@/${python.sitePackages}"; + NIX_PYTHONPATH = "@out@/${python.sitePackages}"; }; }; diff --git a/pkgs/development/python-modules/tornado/default.nix b/pkgs/development/python-modules/tornado/default.nix index 0fcae34eadaf2..44aea604aa440 100644 --- a/pkgs/development/python-modules/tornado/default.nix +++ b/pkgs/development/python-modules/tornado/default.nix @@ -39,7 +39,7 @@ buildPythonPackage rec { ''; passthru = { propagateEnv = { - PYTHONPATH = "@out@/${python.sitePackages}"; + NIX_PYTHONPATH = "@out@/${python.sitePackages}"; }; }; diff --git a/pkgs/development/python-modules/urllib3/default.nix b/pkgs/development/python-modules/urllib3/default.nix index 5e9cf5d2932fe..04659a7942612 100644 --- a/pkgs/development/python-modules/urllib3/default.nix +++ b/pkgs/development/python-modules/urllib3/default.nix @@ -12,7 +12,7 @@ buildPythonPackage rec { }; passthru = { propagateEnv = { - PYTHONPATH = "@out@/${python.sitePackages}"; + NIX_PYTHONPATH = "@out@/${python.sitePackages}"; }; }; diff --git a/pkgs/development/python-modules/whoosh/default.nix b/pkgs/development/python-modules/whoosh/default.nix index 4fa4ed10523f7..96de28ac55e64 100644 --- a/pkgs/development/python-modules/whoosh/default.nix +++ b/pkgs/development/python-modules/whoosh/default.nix @@ -21,7 +21,7 @@ buildPythonPackage rec { ''; passthru = { propagateEnv = { - PYTHONPATH = "@out@/${python.sitePackages}"; + NIX_PYTHONPATH = "@out@/${python.sitePackages}"; }; }; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 92a1cba3a097f..87371b395f13b 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -667,7 +667,7 @@ in }) { wrapOut = { XDG_DATA_DIRS = "$out/share"; - PYTHONPATH = "$out/${python3.sitePackages}"; + NIX_PYTHONPATH = "$out/${python3.sitePackages}"; }; } ; @@ -21233,7 +21233,7 @@ in }) { wrapOut = { XDG_DATA_DIRS = "$out/share"; - PYTHONPATH = "$out/${python3.sitePackages}"; + NIX_PYTHONPATH = "$out/${python3.sitePackages}"; }; } ; From 2aacb90748d2cfa1d64a8faf492d0ae4fc889394 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Thu, 16 Apr 2020 12:27:35 +0300 Subject: [PATCH 31/31] Improve logic of linkPkg and encyclopedia vs wrapOut --- pkgs/build-support/neowrap.nix | 18 ++++++++++++------ pkgs/top-level/all-packages.nix | 5 ++++- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/pkgs/build-support/neowrap.nix b/pkgs/build-support/neowrap.nix index 8f297c30b0004..88b954779bba8 100644 --- a/pkgs/build-support/neowrap.nix +++ b/pkgs/build-support/neowrap.nix @@ -189,22 +189,25 @@ let }; in if builtins.hasAttr name linkByEnv then - if builtins.hasAttr name encyclopedia.linkPaths then - if linkByEnv.${name} == "link" then + if linkByEnv.${name} == "link" then + if builtins.hasAttr name encyclopedia.linkPaths then { linkType = "normal"; linkTo = encyclopedia.linkPaths.${name}; linkFrom = real_value; } - else # linkByEnv.${name} == "linkPkg" + 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 - 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 real_value ) pkg.propagateEnv) @@ -232,7 +235,10 @@ let if (builtins.elemAt value 0).linkType == "normal" then "--prefix ${key} ${sep} ${(builtins.elemAt value 0).linkTo}" else # (builtins.elemAt value 0).linkType == "pkg" then - "--prefix ${key} ${sep} ${encyclopedia.linkPaths.${key}}" + 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 diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 87371b395f13b..c2d31cc6e340a 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -21207,7 +21207,7 @@ in PYTHONPATH = "linkPkg"; }; extraPkgs = with python3.pkgs; [ - # Not how when you use matplot with and without qt, the environment + # 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. @@ -21235,6 +21235,9 @@ in XDG_DATA_DIRS = "$out/share"; NIX_PYTHONPATH = "$out/${python3.sitePackages}"; }; + linkByEnv = { + NIX_PYTHONPATH = "linkPkg"; + }; } ;