@@ -54,7 +54,23 @@
5454let
5555 requiredOctavePackages' = computeRequiredOctavePackages requiredOctavePackages;
5656
57−in stdenv.mkDerivation {
57+ # Must use attrs.nativeBuildInputs before they are removed by the removeAttrs
58+ # below, or everything fails.
59+ nativeBuildInputs' = [
60+ octave
61+ writeRequiredOctavePackagesHook
62+ ]
63+ ++ nativeBuildInputs;
64+
65+ # This step is required because when
66+ # a = { test = [ "a" "b" ]; }; b = { test = [ "c" "d" ]; };
67+ # (a // b).test = [ "c" "d" ];
68+ # This used to mean that if a package defined extra nativeBuildInputs, it
69+ # would override the ones for building an Octave package (the hook and Octave
70+ # itself, causing everything to fail.
71+ attrs' = builtins.removeAttrs attrs [ "nativeBuildInputs" ];
72+
73+in stdenv.mkDerivation ({
5874 packageName = "${fullLibName}";
5975 # The name of the octave package ends up being
6076 # "octave-version-package-version"
@@ -77,11 +93,7 @@ in stdenv.mkDerivation {
7793
7894 requiredOctavePackages = requiredOctavePackages';
7995
80− nativeBuildInputs = [
81− octave
82− writeRequiredOctavePackagesHook
83− ]
84− ++ nativeBuildInputs;
96+ nativeBuildInputs = nativeBuildInputs';
8597
8698 buildInputs = buildInputs ++ requiredOctavePackages';
8799
@@ -110,4 +122,4 @@ in stdenv.mkDerivation {
110122 dontInstall = true;
111123
112124 inherit meta;
113−}
125+} // attrs')