{coq,rocq}Packages.mk{Coq,Rocq}Derivation: move env variables into env for structuredAttrs (#492142)

This commit is contained in:
Philip Taron 2026-07-06 13:57:26 +00:00 committed by GitHub
commit 9195f26f08
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 24 additions and 7 deletions

View file

@ -98,6 +98,7 @@ let
"dropAttrs" "dropAttrs"
"dropDerivationAttrs" "dropDerivationAttrs"
"keepAttrs" "keepAttrs"
"env"
] ]
++ dropAttrs ++ dropAttrs
) keepAttrs; ) keepAttrs;
@ -162,8 +163,8 @@ let
"COQPLUGININSTALL=$(OCAMLFIND_DESTDIR)" "COQPLUGININSTALL=$(OCAMLFIND_DESTDIR)"
]; ];
docdir-flags = [ "COQDOCINSTALL=$(out)/share/coq/${coq.coq-version}/user-contrib" ]; docdir-flags = [ "COQDOCINSTALL=$(out)/share/coq/${coq.coq-version}/user-contrib" ];
COQUSERCONTRIB = "$out/lib/coq/${coq.coq-version}/user-contrib";
in in
stdenv.mkDerivation ( stdenv.mkDerivation (
removeAttrs ( removeAttrs (
{ {
@ -187,6 +188,15 @@ stdenv.mkDerivation (
args.overrideBuildInputs or ([ coq ] ++ (args.buildInputs or [ ]) ++ extraBuildInputs); args.overrideBuildInputs or ([ coq ] ++ (args.buildInputs or [ ]) ++ extraBuildInputs);
inherit enableParallelBuilding; inherit enableParallelBuilding;
env =
optionalAttrs setCOQBIN {
COQBIN = "${coq}/bin/";
}
// optionalAttrs (args ? useMelquiondRemake) {
inherit COQUSERCONTRIB;
}
// (args.env or { });
meta = meta =
( (
{ {
@ -208,7 +218,6 @@ stdenv.mkDerivation (
// (args.meta or { }); // (args.meta or { });
} }
// (optionalAttrs setCOQBIN { COQBIN = "${coq}/bin/"; })
// (optionalAttrs (!args ? installPhase && !args ? useMelquiondRemake) { // (optionalAttrs (!args ? installPhase && !args ? useMelquiondRemake) {
installFlags = coqlib-flags ++ docdir-flags ++ extraInstallFlags; installFlags = coqlib-flags ++ docdir-flags ++ extraInstallFlags;
}) })
@ -226,8 +235,7 @@ stdenv.mkDerivation (
runHook postInstall runHook postInstall
''; '';
}) })
// (optionalAttrs (args ? useMelquiondRemake) rec { // (optionalAttrs (args ? useMelquiondRemake) {
COQUSERCONTRIB = "$out/lib/coq/${coq.coq-version}/user-contrib";
preConfigurePhases = [ "autoconf" ]; preConfigurePhases = [ "autoconf" ];
configureFlags = [ "--libdir=${COQUSERCONTRIB}/${useMelquiondRemake.logpath or ""}" ]; configureFlags = [ "--libdir=${COQUSERCONTRIB}/${useMelquiondRemake.logpath or ""}" ];
buildPhase = "./remake -j$NIX_BUILD_CORES"; buildPhase = "./remake -j$NIX_BUILD_CORES";

View file

@ -98,6 +98,7 @@ let
"dropAttrs" "dropAttrs"
"dropDerivationAttrs" "dropDerivationAttrs"
"keepAttrs" "keepAttrs"
"env"
] ]
++ dropAttrs ++ dropAttrs
) keepAttrs; ) keepAttrs;
@ -162,6 +163,7 @@ let
"COQPLUGININSTALL=$(OCAMLFIND_DESTDIR)" "COQPLUGININSTALL=$(OCAMLFIND_DESTDIR)"
]; ];
docdir-flags = [ "COQDOCINSTALL=$(out)/share/coq/${rocq-core.rocq-version}/user-contrib" ]; docdir-flags = [ "COQDOCINSTALL=$(out)/share/coq/${rocq-core.rocq-version}/user-contrib" ];
COQUSERCONTRIB = "$out/lib/coq/${rocq-core.rocq-version}/user-contrib";
in in
stdenv.mkDerivation ( stdenv.mkDerivation (
@ -187,6 +189,15 @@ stdenv.mkDerivation (
args.overrideBuildInputs or ([ rocq-core ] ++ (args.buildInputs or [ ]) ++ extraBuildInputs); args.overrideBuildInputs or ([ rocq-core ] ++ (args.buildInputs or [ ]) ++ extraBuildInputs);
inherit enableParallelBuilding; inherit enableParallelBuilding;
env =
optionalAttrs setROCQBIN {
ROCQBIN = "${rocq-core}/bin/";
}
// optionalAttrs (args ? useMelquiondRemake) {
inherit COQUSERCONTRIB;
}
// (args.env or { });
meta = meta =
( (
{ {
@ -208,7 +219,6 @@ stdenv.mkDerivation (
// (args.meta or { }); // (args.meta or { });
} }
// (optionalAttrs setROCQBIN { ROCQBIN = "${rocq-core}/bin/"; })
// (optionalAttrs (!args ? installPhase && !args ? useMelquiondRemake) { // (optionalAttrs (!args ? installPhase && !args ? useMelquiondRemake) {
installFlags = rocqlib-flags ++ docdir-flags ++ extraInstallFlags; installFlags = rocqlib-flags ++ docdir-flags ++ extraInstallFlags;
}) })
@ -226,8 +236,7 @@ stdenv.mkDerivation (
runHook postInstall runHook postInstall
''; '';
}) })
// (optionalAttrs (args ? useMelquiondRemake) rec { // (optionalAttrs (args ? useMelquiondRemake) {
COQUSERCONTRIB = "$out/lib/coq/${rocq-core.rocq-version}/user-contrib";
preConfigurePhases = [ "autoconf" ]; preConfigurePhases = [ "autoconf" ];
configureFlags = [ "--libdir=${COQUSERCONTRIB}/${useMelquiondRemake.logpath or ""}" ]; configureFlags = [ "--libdir=${COQUSERCONTRIB}/${useMelquiondRemake.logpath or ""}" ];
buildPhase = "./remake -j$NIX_BUILD_CORES"; buildPhase = "./remake -j$NIX_BUILD_CORES";