From 4f6ec19dbc322d7ce8df9108b76e0db79682353e Mon Sep 17 00:00:00 2001 From: John Ericson Date: Tue, 2 Mar 2021 22:33:53 +0000 Subject: [PATCH 1/2] buildEnv: Support `nativeBuildInputs` too Since #112276, we should always put `makeWrapper` in `nativeBuildInputs`. But `buildEnv` was saying put it in `buildInputs`. That's wrong! Fix the instructions, and make the right thing possible. --- pkgs/build-support/buildenv/default.nix | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pkgs/build-support/buildenv/default.nix b/pkgs/build-support/buildenv/default.nix index 7f2427777f9..5fafc36273a 100644 --- a/pkgs/build-support/buildenv/default.nix +++ b/pkgs/build-support/buildenv/default.nix @@ -36,8 +36,9 @@ lib.makeOverridable , # Shell commands to run after building the symlink tree. postBuild ? "" -, # Additional inputs. Handy e.g. if using makeWrapper in `postBuild`. - buildInputs ? [] +# Additional inputs +, nativeBuildInputs ? [] # Handy e.g. if using makeWrapper in `postBuild`. +, buildInputs ? [] , passthru ? {} , meta ? {} @@ -53,7 +54,8 @@ in runCommand name rec { inherit manifest ignoreCollisions checkCollisionContents passthru - meta pathsToLink extraPrefix postBuild buildInputs; + meta pathsToLink extraPrefix postBuild + nativeBuildInputs buildInputs; pkgs = builtins.toJSON (map (drv: { paths = # First add the usual output(s): respect if user has chosen explicitly, From 07ecf87693fec1032c19ba1f5b41dc9cf260abb2 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Tue, 2 Mar 2021 22:33:53 +0000 Subject: [PATCH 2/2] treewide: Fix various tools wrappers "with packages" Now that `buildEnv` is ready, always put `makeWrapper` in `nativeBuildInputs`, rather than `buildInputs` or (worse) mucking around with setup hooks by hand. (C.f. #112276, which didn't catch these because the manual setup hook sourcing is such a hack to being with!) Fixes #114687 --- .../haskell-modules/with-packages-wrapper.nix | 3 +-- pkgs/development/interpreters/octave/build-env.nix | 7 ++----- pkgs/development/interpreters/perl/wrapper.nix | 5 ++--- pkgs/development/interpreters/python/wrapper.nix | 13 +++++++++---- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/pkgs/development/haskell-modules/with-packages-wrapper.nix b/pkgs/development/haskell-modules/with-packages-wrapper.nix index 32fa46fd04a..0e566aa2e6e 100644 --- a/pkgs/development/haskell-modules/with-packages-wrapper.nix +++ b/pkgs/development/haskell-modules/with-packages-wrapper.nix @@ -57,9 +57,8 @@ symlinkJoin { # as a dedicated drv attribute, like `compiler-name` name = ghc.name + "-with-packages"; paths = paths ++ [ghc]; + nativeBuildInputs = [ makeWrapper ]; postBuild = '' - . ${makeWrapper}/nix-support/setup-hook - # wrap compiler executables with correct env variables for prg in ${ghcCommand} ${ghcCommand}i ${ghcCommand}-${ghc.version} ${ghcCommand}i-${ghc.version}; do diff --git a/pkgs/development/interpreters/octave/build-env.nix b/pkgs/development/interpreters/octave/build-env.nix index fee53b716da..433026f0a7e 100644 --- a/pkgs/development/interpreters/octave/build-env.nix +++ b/pkgs/development/interpreters/octave/build-env.nix @@ -20,17 +20,14 @@ in buildEnv { inherit ignoreCollisions; extraOutputsToInstall = [ "out" ] ++ extraOutputsToInstall; - buildInputs = [ makeWrapper texinfo wrapOctave ]; + nativeBuildInputs = [ makeWrapper ]; + buildInputs = [ texinfo wrapOctave ]; # During "build" we must first unlink the /share symlink to octave's /share # Then, we can re-symlink the all of octave/share, except for /share/octave # in env/share/octave, re-symlink everything from octave/share/octave and then # perform the pkg install. postBuild = '' - . "${makeWrapper}/nix-support/setup-hook" - # The `makeWrapper` used here is the one defined in - # ${makeWrapper}/nix-support/setup-hook - if [ -L "$out/bin" ]; then unlink $out/bin mkdir -p "$out/bin" diff --git a/pkgs/development/interpreters/perl/wrapper.nix b/pkgs/development/interpreters/perl/wrapper.nix index da95b5a8964..e1909a15e05 100644 --- a/pkgs/development/interpreters/perl/wrapper.nix +++ b/pkgs/development/interpreters/perl/wrapper.nix @@ -17,11 +17,10 @@ let inherit ignoreCollisions; extraOutputsToInstall = [ "out" ] ++ extraOutputsToInstall; + nativeBuildInputs = [ makeWrapper ]; + # we create wrapper for the binaries in the different packages postBuild = '' - - . "${makeWrapper}/nix-support/setup-hook" - if [ -L "$out/bin" ]; then unlink "$out/bin" fi diff --git a/pkgs/development/interpreters/python/wrapper.nix b/pkgs/development/interpreters/python/wrapper.nix index 61ad4a8a6ad..514930db359 100644 --- a/pkgs/development/interpreters/python/wrapper.nix +++ b/pkgs/development/interpreters/python/wrapper.nix @@ -1,10 +1,15 @@ -{ lib, stdenv, python, buildEnv, makeWrapper +{ lib, stdenv, buildEnv, makeWrapper + +# manually pased +, python +, requiredPythonModules + +# extra opts , extraLibs ? [] , extraOutputsToInstall ? [] , postBuild ? "" , ignoreCollisions ? false , permitUserSite ? false -, requiredPythonModules # Wrap executables with the given argument. , makeWrapperArgs ? [] , }: @@ -22,9 +27,9 @@ let inherit ignoreCollisions; extraOutputsToInstall = [ "out" ] ++ extraOutputsToInstall; - postBuild = '' - . "${makeWrapper}/nix-support/setup-hook" + nativeBuildInputs = [ makeWrapper ]; + postBuild = '' if [ -L "$out/bin" ]; then unlink "$out/bin" fi