From 8ad58c00a89c33ff240651788e27d2e3296d140f Mon Sep 17 00:00:00 2001 From: Stefan Frijters Date: Thu, 19 Feb 2026 17:04:41 +0100 Subject: [PATCH 1/2] coqPackages.mkCoqDerivation: move env variables into env for structuredAttrs --- pkgs/build-support/coq/default.nix | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/pkgs/build-support/coq/default.nix b/pkgs/build-support/coq/default.nix index 33305b6dd1a0..3c9670f4f65e 100644 --- a/pkgs/build-support/coq/default.nix +++ b/pkgs/build-support/coq/default.nix @@ -98,6 +98,7 @@ let "dropAttrs" "dropDerivationAttrs" "keepAttrs" + "env" ] ++ dropAttrs ) keepAttrs; @@ -162,8 +163,8 @@ let "COQPLUGININSTALL=$(OCAMLFIND_DESTDIR)" ]; docdir-flags = [ "COQDOCINSTALL=$(out)/share/coq/${coq.coq-version}/user-contrib" ]; + COQUSERCONTRIB = "$out/lib/coq/${coq.coq-version}/user-contrib"; in - stdenv.mkDerivation ( removeAttrs ( { @@ -187,6 +188,15 @@ stdenv.mkDerivation ( args.overrideBuildInputs or ([ coq ] ++ (args.buildInputs or [ ]) ++ extraBuildInputs); inherit enableParallelBuilding; + env = + optionalAttrs setCOQBIN { + COQBIN = "${coq}/bin/"; + } + // optionalAttrs (args ? useMelquiondRemake) { + inherit COQUSERCONTRIB; + } + // (args.env or { }); + meta = ( { @@ -208,7 +218,6 @@ stdenv.mkDerivation ( // (args.meta or { }); } - // (optionalAttrs setCOQBIN { COQBIN = "${coq}/bin/"; }) // (optionalAttrs (!args ? installPhase && !args ? useMelquiondRemake) { installFlags = coqlib-flags ++ docdir-flags ++ extraInstallFlags; }) @@ -226,8 +235,7 @@ stdenv.mkDerivation ( runHook postInstall ''; }) - // (optionalAttrs (args ? useMelquiondRemake) rec { - COQUSERCONTRIB = "$out/lib/coq/${coq.coq-version}/user-contrib"; + // (optionalAttrs (args ? useMelquiondRemake) { preConfigurePhases = [ "autoconf" ]; configureFlags = [ "--libdir=${COQUSERCONTRIB}/${useMelquiondRemake.logpath or ""}" ]; buildPhase = "./remake -j$NIX_BUILD_CORES"; From 0f8356544c25e5fc17afcdd7598dcbea63d93da9 Mon Sep 17 00:00:00 2001 From: Stefan Frijters Date: Mon, 23 Mar 2026 11:46:06 +0100 Subject: [PATCH 2/2] rocqPackages.mkRocqDerivation: move env variables into env --- pkgs/build-support/rocq/default.nix | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/pkgs/build-support/rocq/default.nix b/pkgs/build-support/rocq/default.nix index a6b751a53b23..7a7c5fba7b25 100644 --- a/pkgs/build-support/rocq/default.nix +++ b/pkgs/build-support/rocq/default.nix @@ -98,6 +98,7 @@ let "dropAttrs" "dropDerivationAttrs" "keepAttrs" + "env" ] ++ dropAttrs ) keepAttrs; @@ -162,6 +163,7 @@ let "COQPLUGININSTALL=$(OCAMLFIND_DESTDIR)" ]; docdir-flags = [ "COQDOCINSTALL=$(out)/share/coq/${rocq-core.rocq-version}/user-contrib" ]; + COQUSERCONTRIB = "$out/lib/coq/${rocq-core.rocq-version}/user-contrib"; in stdenv.mkDerivation ( @@ -187,6 +189,15 @@ stdenv.mkDerivation ( args.overrideBuildInputs or ([ rocq-core ] ++ (args.buildInputs or [ ]) ++ extraBuildInputs); inherit enableParallelBuilding; + env = + optionalAttrs setROCQBIN { + ROCQBIN = "${rocq-core}/bin/"; + } + // optionalAttrs (args ? useMelquiondRemake) { + inherit COQUSERCONTRIB; + } + // (args.env or { }); + meta = ( { @@ -208,7 +219,6 @@ stdenv.mkDerivation ( // (args.meta or { }); } - // (optionalAttrs setROCQBIN { ROCQBIN = "${rocq-core}/bin/"; }) // (optionalAttrs (!args ? installPhase && !args ? useMelquiondRemake) { installFlags = rocqlib-flags ++ docdir-flags ++ extraInstallFlags; }) @@ -226,8 +236,7 @@ stdenv.mkDerivation ( runHook postInstall ''; }) - // (optionalAttrs (args ? useMelquiondRemake) rec { - COQUSERCONTRIB = "$out/lib/coq/${rocq-core.rocq-version}/user-contrib"; + // (optionalAttrs (args ? useMelquiondRemake) { preConfigurePhases = [ "autoconf" ]; configureFlags = [ "--libdir=${COQUSERCONTRIB}/${useMelquiondRemake.logpath or ""}" ]; buildPhase = "./remake -j$NIX_BUILD_CORES";