octavePackages: buildOctavePackage respects user-provided hooks

octavePackages: Allow user to provide extra steps and information
This commit is contained in:
Karl Hallsby 2021-10-30 12:58:33 -05:00
parent 355010ed9e
commit e80c50b44d

View file

@ -54,7 +54,23 @@
let
requiredOctavePackages' = computeRequiredOctavePackages requiredOctavePackages;
in stdenv.mkDerivation {
# Must use attrs.nativeBuildInputs before they are removed by the removeAttrs
# below, or everything fails.
nativeBuildInputs' = [
octave
writeRequiredOctavePackagesHook
]
++ nativeBuildInputs;
# This step is required because when
# a = { test = [ "a" "b" ]; }; b = { test = [ "c" "d" ]; };
# (a // b).test = [ "c" "d" ];
# This used to mean that if a package defined extra nativeBuildInputs, it
# would override the ones for building an Octave package (the hook and Octave
# itself, causing everything to fail.
attrs' = builtins.removeAttrs attrs [ "nativeBuildInputs" ];
in stdenv.mkDerivation ({
packageName = "${fullLibName}";
# The name of the octave package ends up being
# "octave-version-package-version"
@ -77,11 +93,7 @@ in stdenv.mkDerivation {
requiredOctavePackages = requiredOctavePackages';
nativeBuildInputs = [
octave
writeRequiredOctavePackagesHook
]
++ nativeBuildInputs;
nativeBuildInputs = nativeBuildInputs';
buildInputs = buildInputs ++ requiredOctavePackages';
@ -110,4 +122,4 @@ in stdenv.mkDerivation {
dontInstall = true;
inherit meta;
}
} // attrs')