treewide: move env variable(s) into env for structuredAttrs (F-G) (#490354)

This commit is contained in:
Jo 2026-02-19 12:39:03 +00:00 committed by GitHub
commit 8fb7372c5a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
29 changed files with 181 additions and 151 deletions

View file

@ -75,7 +75,7 @@ buildGoModule (finalAttrs: {
];
# Passing boringcrypto to GOEXPERIMENT variable to build with goboring library
GOEXPERIMENT = "boringcrypto";
env.GOEXPERIMENT = "boringcrypto";
# https://github.com/rancher/rke2/blob/104ddbf3de65ab5490aedff36df2332d503d90fe/scripts/build-binary#L27-L39
ldflags =

View file

@ -13,9 +13,11 @@ stdenv.mkDerivation {
dontUnpack = true;
CGO_ENABLED = 0;
GOFLAGS = "-trimpath";
GO111MODULE = "off";
env = {
CGO_ENABLED = 0;
GOFLAGS = "-trimpath";
GO111MODULE = "off";
};
buildPhase = ''
runHook preBuild

View file

@ -100,7 +100,7 @@ stdenv.mkDerivation (finalAttrs: {
];
# these fail inside of the sandbox due to missing access
# to the FUSE device
GTEST_FILTER =
env.GTEST_FILTER =
let
disabledTests = [
"dwarfs/tools_test.end_to_end/*"

View file

@ -169,7 +169,7 @@ stdenv.mkDerivation (finalAttrs: {
++ attrs.nativeBuildInputs or [ ];
strictDeps = true;
${"GCC5_${targetArch}_PREFIX"} = stdenv.cc.targetPrefix;
env.${"GCC5_${targetArch}_PREFIX"} = stdenv.cc.targetPrefix;
prePatch = ''
rm -rf BaseTools

View file

@ -38,7 +38,7 @@ stdenv.mkDerivation (finalAttrs: {
nativeBuildInputs = [ makeWrapper ];
buildInputs = [ libpng ];
GSEXE = "${ghostscript}/bin/gs";
env.GSEXE = "${ghostscript}/bin/gs";
configureFlags = [ "--enable-transfig" ];

View file

@ -56,8 +56,10 @@ rustPlatform.buildRustPackage rec {
];
buildInputs = [ openssl ];
FFPWA_EXECUTABLES = ""; # .desktop entries generated without any store path references
FFPWA_SYSDATA = "${placeholder "out"}/share/firefoxpwa";
env = {
FFPWA_EXECUTABLES = ""; # .desktop entries generated without any store path references
FFPWA_SYSDATA = "${placeholder "out"}/share/firefoxpwa";
};
completions = "target/${stdenv.targetPlatform.config}/release/completions";
gtk_modules = map (x: x + x.gtkModule) [ libcanberra-gtk3 ];

View file

@ -19,7 +19,7 @@ rustPlatform.buildRustPackage (finalAttrs: {
cargoHash = "sha256-kH5YTadpaUXDma+7SfBJxrOIsd9Gm0EU3MfhFmQ3U80=";
# integration tests are not run but the macros need this variable to be set
GHC_VERSIONS = "";
env.GHC_VERSIONS = "";
checkFlags = "--test \"unit\"";
meta = {

View file

@ -228,14 +228,16 @@ let
chmod 777 ee/frontend_islands/yarn.lock
'';
# One of the patches uses this variable - if it's unset, execution
# of rake tasks fails.
GITLAB_LOG_PATH = "log";
FOSS_ONLY = !gitlabEnterprise;
SKIP_FRONTEND_ISLANDS_BUILD = lib.optionalString (!gitlabEnterprise) "true";
env = {
# One of the patches uses this variable - if it's unset, execution
# of rake tasks fails.
GITLAB_LOG_PATH = "log";
FOSS_ONLY = !gitlabEnterprise;
SKIP_FRONTEND_ISLANDS_BUILD = lib.optionalString (!gitlabEnterprise) "true";
SKIP_YARN_INSTALL = 1;
NODE_OPTIONS = "--max-old-space-size=8192";
SKIP_YARN_INSTALL = 1;
NODE_OPTIONS = "--max-old-space-size=8192";
};
postConfigure = ''
# Some rake tasks try to run yarn automatically, which won't work

View file

@ -26,7 +26,7 @@ in
maven.buildMavenPackage rec {
pname = "global-platform-pro";
version = "25.10.20";
GPPRO_VERSION = "v25.10.20-0-g72f85b9"; # git describe --tags --always --long --dirty
env.GPPRO_VERSION = "v25.10.20-0-g72f85b9"; # git describe --tags --always --long --dirty
src = fetchFromGitHub {
owner = "martinpaljak";

View file

@ -43,12 +43,14 @@ rustPlatform.buildRustPackage rec {
(lib.getDev openssl)
];
# Required for golem-wasm-rpc's build.rs to find the required protobuf files
# https://github.com/golemcloud/wasm-rpc/blob/v1.0.6/wasm-rpc/build.rs#L7
GOLEM_WASM_AST_ROOT = "../golem-wasm-ast-1.1.0";
# Required for golem-examples's build.rs to find the required Wasm Interface Type (WIT) files
# https://github.com/golemcloud/golem-examples/blob/v1.0.6/build.rs#L9
GOLEM_WIT_ROOT = "../golem-wit-1.1.0";
env = {
# Required for golem-wasm-rpc's build.rs to find the required protobuf files
# https://github.com/golemcloud/wasm-rpc/blob/v1.0.6/wasm-rpc/build.rs#L7
GOLEM_WASM_AST_ROOT = "../golem-wasm-ast-1.1.0";
# Required for golem-examples's build.rs to find the required Wasm Interface Type (WIT) files
# https://github.com/golemcloud/golem-examples/blob/v1.0.6/build.rs#L9
GOLEM_WIT_ROOT = "../golem-wit-1.1.0";
};
cargoHash = "sha256-zf/L7aNsfQXCdGpzvBZxgoatAGB92bvIuj59jANrXIc=";

View file

@ -27,9 +27,11 @@ stdenv.mkDerivation (finalAttrs: {
})
];
GIT_COMMIT = finalAttrs.src.rev;
GIT_VERSION = finalAttrs.version;
GIT_DATE = "2023-02-14";
env = {
GIT_COMMIT = finalAttrs.src.rev;
GIT_VERSION = finalAttrs.version;
GIT_DATE = "2023-02-14";
};
buildInputs = [ libftdi ];

View file

@ -16,7 +16,7 @@ rustPlatform.buildRustPackage (finalAttrs: {
hash = "sha256-w1NoWgaUBny//3t1S5z/juPOYFomwJKtTq/M4qKoNv0=";
};
GIT_COMMIT_HASH = finalAttrs.src.rev;
env.GIT_COMMIT_HASH = finalAttrs.src.rev;
cargoHash = "sha256-N+c2jnJ7a+Nh2UibkaOByh4tKDX52VovYIpeHTpawXo=";

View file

@ -17,7 +17,7 @@ let
# redirects to the following url:
licenseUrl = "https://www.microsoft.com/en-us/legal/terms-of-use";
in
stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: {
pname = "kinect-audio-setup";
# On update: Make sure that the `firmwareURL` is still in sync with upstream.
@ -26,7 +26,7 @@ stdenv.mkDerivation rec {
version = "0.5";
# This is an MSI or CAB file
FIRMWARE = requireFile {
env.FIRMWARE = requireFile {
name = "UACFirmware";
sha256 = "08a2vpgd061cmc6h3h8i6qj3sjvjr1fwcnwccwywqypz3icn8xw1";
message = ''
@ -40,7 +40,7 @@ stdenv.mkDerivation rec {
src = fetchgit {
url = "git://git.ao2.it/kinect-audio-setup.git";
rev = "v${version}";
rev = "v${finalAttrs.version}";
hash = "sha256-bFwmWh822KvFwP/0Gu097nF5K2uCwCLMB1RtP7k+Zt0=";
};
@ -77,7 +77,7 @@ stdenv.mkDerivation rec {
install -Dm755 kinect_upload_fw/kinect_upload_fw $out/libexec/
# 7z extract "assume yes on all queries" "only extract/keep files/directories matching UACFIRMWARE.* recursively"
7z e -y -r "${FIRMWARE}" "UACFirmware.*" >/dev/null
7z e -y -r "${finalAttrs.env.FIRMWARE}" "UACFirmware.*" >/dev/null
# The filename is bound to change with the Firmware SDK
mv UACFirmware.* $out/lib/firmware/UACFirmware
@ -93,4 +93,4 @@ stdenv.mkDerivation rec {
platforms = lib.platforms.linux;
license = lib.licenses.unfree;
};
}
})

View file

@ -150,8 +150,10 @@ buildPythonApplication rec {
"fortify3"
];
env.CGO_ENABLED = 0;
GOFLAGS = "-trimpath";
env = {
CGO_ENABLED = 0;
GOFLAGS = "-trimpath";
};
configurePhase = ''
export GOCACHE=$TMPDIR/go-cache

View file

@ -25,7 +25,7 @@ rustPlatform.buildRustPackage (finalAttrs: {
installShellCompletion artifacts/mmtc.{bash,fish} --zsh artifacts/_mmtc
'';
GEN_ARTIFACTS = "artifacts";
env.GEN_ARTIFACTS = "artifacts";
meta = {
description = "Minimal mpd terminal client that aims to be simple yet highly configurable";

View file

@ -26,8 +26,6 @@ stdenv.mkDerivation rec {
"dev"
];
GTEST_DIR = "${gtest.src}/googletest";
nativeBuildInputs = [
pkg-config
];
@ -45,13 +43,15 @@ stdenv.mkDerivation rec {
libepoxy
];
env =
lib.optionalAttrs stdenv.cc.isGNU {
NIX_CFLAGS_COMPILE = "-std=c++17"; # needed for latest gtest
}
// lib.optionalAttrs stdenv.hostPlatform.isDarwin {
NIX_LDFLAGS = "-framework OpenGL";
};
env = {
GTEST_DIR = "${gtest.src}/googletest";
}
// lib.optionalAttrs stdenv.cc.isGNU {
NIX_CFLAGS_COMPILE = "-std=c++17"; # needed for latest gtest
}
// lib.optionalAttrs stdenv.hostPlatform.isDarwin {
NIX_LDFLAGS = "-framework OpenGL";
};
enableParallelBuilding = true;

View file

@ -27,8 +27,10 @@ stdenv.mkDerivation (finalAttrs: {
doCheck = true;
FFLAGS = [ "-std=legacy" ];
FCFLAGS = [ "-std=legacy" ];
env = {
FFLAGS = toString [ "-std=legacy" ];
FCFLAGS = toString [ "-std=legacy" ];
};
meta = {
description = "Fortran API to manipulate netcdf files";

View file

@ -66,12 +66,14 @@ stdenv.mkDerivation (finalAttrs: {
gettext
];
# https://github.com/NixOS/nixpkgs/pull/98471#issuecomment-703100014 . We set
# these for all platforms, since upstream's gettext crate behavior might
# change in the future.
GETTEXT_LIB_DIR = "${lib.getLib gettext}/lib";
GETTEXT_INCLUDE_DIR = "${lib.getDev gettext}/include";
GETTEXT_BIN_DIR = "${lib.getBin gettext}/bin";
env = {
# https://github.com/NixOS/nixpkgs/pull/98471#issuecomment-703100014 . We set
# these for all platforms, since upstream's gettext crate behavior might
# change in the future.
GETTEXT_LIB_DIR = "${lib.getLib gettext}/lib";
GETTEXT_INCLUDE_DIR = "${lib.getDev gettext}/include";
GETTEXT_BIN_DIR = "${lib.getBin gettext}/bin";
};
makeFlags = [ "prefix=$(out)" ];
enableParallelBuilding = true;

View file

@ -15,7 +15,7 @@ rustPlatform.buildRustPackage (finalAttrs: {
hash = "sha256-7i76JPg6MAk4/sO8/JI4ody4iYFJPeLkD2SWncFhT4o=";
};
GIT_HASH = "000000000000000000000000000000000000000000000000000";
env.GIT_HASH = "000000000000000000000000000000000000000000000000000";
checkFlags = [
# skip failing test due to nix build timestamps

View file

@ -46,8 +46,10 @@ stdenv.mkDerivation {
"PREFIX=${placeholder "out"}"
];
FONTCONFIG_FILE = "${fontconfig.out}/etc/fonts/fonts.conf";
FONTCONFIG_PATH = "${fontconfig.out}/etc/fonts/";
env = {
FONTCONFIG_FILE = "${fontconfig.out}/etc/fonts/fonts.conf";
FONTCONFIG_PATH = "${fontconfig.out}/etc/fonts/";
};
postPatch = ''
substituteInPlace cpp/src/Options.cpp \

View file

@ -77,7 +77,7 @@ stdenv.mkDerivation (finalAttrs: {
enableParallelBuilding = true;
GIT_VERSION = finalAttrs.version;
env.GIT_VERSION = finalAttrs.version;
dontConfigure = true;

View file

@ -20,7 +20,7 @@ stdenv.mkDerivation (finalAttrs: {
nativeBuildInputs = [ gfortran ];
buildInputs = [ zlib ];
FFLAGS = [
env.FFLAGS = toString [
"-std=legacy" # fix build with gfortran 10
];

View file

@ -25,7 +25,7 @@ rustPlatform.buildRustPackage (finalAttrs: {
installShellCompletion artifacts/sagoin.{bash,fish} --zsh artifacts/_sagoin
'';
GEN_ARTIFACTS = "artifacts";
env.GEN_ARTIFACTS = "artifacts";
meta = {
description = "Command-line submission tool for the UMD CS Submit Server";

View file

@ -19,15 +19,18 @@ let
rev = "3f863a3f35f31b61982d813835d8637b3d93d87a";
hash = "sha256-BsxP3GrS98ubIAkFx/c4pB1i97ZZL2TijS+2ORnooww=";
};
in
buildBazelPackage rec {
pname = "verible";
# These environment variables are read in bazel/build-version.py to create
# a build string shown in the tools --version output.
# If env variables not set, it would attempt to extract it from .git/.
GIT_DATE = "2025-08-29";
GIT_VERSION = "v0.0-4023-gc1271a00";
in
buildBazelPackage {
pname = "verible";
env = {
# These environment variables are read in bazel/build-version.py to create
# a build string shown in the tools --version output.
# If env variables not set, it would attempt to extract it from .git/.
inherit GIT_DATE GIT_VERSION;
};
# Derive nix package version from GIT_VERSION: "v1.2-345-abcde" -> "1.2.345"
version = builtins.concatStringsSep "." (

View file

@ -35,6 +35,15 @@ let
django = prev.django_5;
};
};
GI_TYPELIB_PATH = lib.makeSearchPathOutput "out" "lib/girepository-1.0" [
pango
harfbuzz
librsvg
gdk-pixbuf
glib
gobject-introspection
];
in
python.pkgs.buildPythonApplication rec {
pname = "weblate";
@ -197,14 +206,10 @@ python.pkgs.buildPythonApplication rec {
};
# We don't just use wrapGAppsNoGuiHook because we need to expose GI_TYPELIB_PATH
GI_TYPELIB_PATH = lib.makeSearchPathOutput "out" "lib/girepository-1.0" [
pango
harfbuzz
librsvg
gdk-pixbuf
glib
gobject-introspection
];
env = {
inherit GI_TYPELIB_PATH;
};
makeWrapperArgs = [ "--set GI_TYPELIB_PATH \"$GI_TYPELIB_PATH\"" ];
nativeCheckInputs =

View file

@ -90,9 +90,6 @@ effectiveStdenv.mkDerivation rec {
++ lib.optionals ncclSupport [ "-DUSE_NCCL=ON" ]
++ lib.optionals rLibrary [ "-DR_LIB=ON" ];
# on Darwin, cmake uses find_library to locate R instead of using the PATH
env.NIX_LDFLAGS = "-L${R}/lib/R/lib";
preConfigure = lib.optionals rLibrary ''
substituteInPlace cmake/RPackageInstall.cmake.in --replace "CMD INSTALL" "CMD INSTALL -l $out/library"
export R_LIBS_SITE="$R_LIBS_SITE''${R_LIBS_SITE:+:}$out/library"
@ -106,70 +103,75 @@ effectiveStdenv.mkDerivation rec {
ctest --force-new-ctest-process ${lib.optionalString cudaSupport "-E TestXGBoostLib"}
'';
# Disable finicky tests from dmlc core that fail in Hydra. XGboost team
# confirmed xgboost itself does not use this part of the dmlc code.
GTEST_FILTER =
let
# Upstream Issue: https://github.com/xtensor-stack/xsimd/issues/456
xsimdTests = lib.optionals effectiveStdenv.hostPlatform.isDarwin [
"ThreadGroup.TimerThread"
"ThreadGroup.TimerThreadSimple"
];
networkingTest = [
"AllgatherTest.Basic"
"AllgatherTest.VAlgo"
"AllgatherTest.VBasic"
"AllgatherTest.VRing"
"AllreduceGlobal.Basic"
"AllreduceGlobal.Small"
"AllreduceTest.Basic"
"AllreduceTest.BitOr"
"AllreduceTest.Restricted"
"AllreduceTest.Sum"
"Approx.PartitionerColumnSplit"
"BroadcastTest.Basic"
"CPUHistogram.BuildHistColSplit"
"CPUHistogram.BuildHistColumnSplit"
"CPUPredictor.CategoricalPredictLeafColumnSplit"
"CPUPredictor.CategoricalPredictionColumnSplit"
"ColumnSplit/ColumnSplitTrainingTest*"
"ColumnSplit/TestApproxColumnSplit*"
"ColumnSplit/TestHistColumnSplit*"
"ColumnSplitObjective/TestColumnSplit*"
"Cpu/ColumnSplitTrainingTest*"
"CommGroupTest.Basic"
"CommTest.Channel"
"CpuPredictor.BasicColumnSplit"
"CpuPredictor.IterationRangeColmnSplit"
"CpuPredictor.LesserFeaturesColumnSplit"
"CpuPredictor.SparseColumnSplit"
"DistributedMetric/TestDistributedMetric.BinaryAUCRowSplit/Dist_*"
"InitEstimation.FitStumpColumnSplit"
"MetaInfo.GetSetFeatureColumnSplit"
"Quantile.ColumnSplit"
"Quantile.ColumnSplitBasic"
"Quantile.ColumnSplitSorted"
"Quantile.ColumnSplitSortedBasic"
"Quantile.Distributed"
"Quantile.DistributedBasic"
"Quantile.SameOnAllWorkers"
"Quantile.SortedDistributed"
"Quantile.SortedDistributedBasic"
"QuantileHist.MultiPartitionerColumnSplit"
"QuantileHist.PartitionerColumnSplit"
"Stats.SampleMean"
"Stats.WeightedSampleMean"
"SimpleDMatrix.ColumnSplit"
"TrackerAPITest.CAPI"
"TrackerTest.AfterShutdown"
"TrackerTest.Bootstrap"
"TrackerTest.GetHostAddress"
"TrackerTest.Print"
"VectorAllgatherV.Basic"
];
excludedTests = xsimdTests ++ networkingTest;
in
"-${builtins.concatStringsSep ":" excludedTests}";
env = {
# on Darwin, cmake uses find_library to locate R instead of using the PATH
NIX_LDFLAGS = "-L${R}/lib/R/lib";
# Disable finicky tests from dmlc core that fail in Hydra. XGboost team
# confirmed xgboost itself does not use this part of the dmlc code.
GTEST_FILTER =
let
# Upstream Issue: https://github.com/xtensor-stack/xsimd/issues/456
xsimdTests = lib.optionals effectiveStdenv.hostPlatform.isDarwin [
"ThreadGroup.TimerThread"
"ThreadGroup.TimerThreadSimple"
];
networkingTest = [
"AllgatherTest.Basic"
"AllgatherTest.VAlgo"
"AllgatherTest.VBasic"
"AllgatherTest.VRing"
"AllreduceGlobal.Basic"
"AllreduceGlobal.Small"
"AllreduceTest.Basic"
"AllreduceTest.BitOr"
"AllreduceTest.Restricted"
"AllreduceTest.Sum"
"Approx.PartitionerColumnSplit"
"BroadcastTest.Basic"
"CPUHistogram.BuildHistColSplit"
"CPUHistogram.BuildHistColumnSplit"
"CPUPredictor.CategoricalPredictLeafColumnSplit"
"CPUPredictor.CategoricalPredictionColumnSplit"
"ColumnSplit/ColumnSplitTrainingTest*"
"ColumnSplit/TestApproxColumnSplit*"
"ColumnSplit/TestHistColumnSplit*"
"ColumnSplitObjective/TestColumnSplit*"
"Cpu/ColumnSplitTrainingTest*"
"CommGroupTest.Basic"
"CommTest.Channel"
"CpuPredictor.BasicColumnSplit"
"CpuPredictor.IterationRangeColmnSplit"
"CpuPredictor.LesserFeaturesColumnSplit"
"CpuPredictor.SparseColumnSplit"
"DistributedMetric/TestDistributedMetric.BinaryAUCRowSplit/Dist_*"
"InitEstimation.FitStumpColumnSplit"
"MetaInfo.GetSetFeatureColumnSplit"
"Quantile.ColumnSplit"
"Quantile.ColumnSplitBasic"
"Quantile.ColumnSplitSorted"
"Quantile.ColumnSplitSortedBasic"
"Quantile.Distributed"
"Quantile.DistributedBasic"
"Quantile.SameOnAllWorkers"
"Quantile.SortedDistributed"
"Quantile.SortedDistributedBasic"
"QuantileHist.MultiPartitionerColumnSplit"
"QuantileHist.PartitionerColumnSplit"
"Stats.SampleMean"
"Stats.WeightedSampleMean"
"SimpleDMatrix.ColumnSplit"
"TrackerAPITest.CAPI"
"TrackerTest.AfterShutdown"
"TrackerTest.Bootstrap"
"TrackerTest.GetHostAddress"
"TrackerTest.Print"
"VectorAllgatherV.Basic"
];
excludedTests = xsimdTests ++ networkingTest;
in
"-${builtins.concatStringsSep ":" excludedTests}";
};
installPhase = ''
runHook preInstall

View file

@ -45,14 +45,16 @@ stdenv.mkDerivation rec {
];
# Ensure C/Fortran code is position-independent.
env.NIX_CFLAGS_COMPILE = toString [
"-fPIC"
"-Ofast"
];
FCFLAGS = [
"-fPIC"
"-Ofast"
];
env = {
NIX_CFLAGS_COMPILE = toString [
"-fPIC"
"-Ofast"
];
FCFLAGS = toString [
"-fPIC"
"-Ofast"
];
};
enableParallelBuilding = true;

View file

@ -29,7 +29,7 @@ stdenv.mkDerivation rec {
# FILECMD was added in libtool 2.4.7; previous versions hardwired `/usr/bin/file`
# https://lists.gnu.org/archive/html/autotools-announce/2022-03/msg00000.html
FILECMD = "${file}/bin/file";
env.FILECMD = "${file}/bin/file";
postPatch =
# libtool commit da2e352735722917bf0786284411262195a6a3f6 changed

View file

@ -57,7 +57,7 @@ stdenv.mkDerivation rec {
# May have some issues with root compilation because the bootstrap tool
# cannot be used as a login shell for now.
FORCE_UNSAFE_CONFIGURE = lib.optionalString (
env.FORCE_UNSAFE_CONFIGURE = lib.optionalString (
stdenv.hostPlatform.system == "armv7l-linux" || stdenv.hostPlatform.isSunOS
) "1";