treewide: env.NIX_CFLAGS_COMPILE use toString on result of optionals

env values must be strings
This commit is contained in:
Artturin 2023-02-20 17:36:06 +02:00
parent 226e149145
commit 3251013cc1
39 changed files with 70 additions and 70 deletions

View File

@ -63,11 +63,11 @@ stdenv.mkDerivation rec {
"-DWARNINGS_ARE_ERRORS=ON"
];
env.NIX_CFLAGS_COMPILE = lib.optionals (stdenv.cc.isGNU && lib.versionAtLeast stdenv.cc.version "12") [
env.NIX_CFLAGS_COMPILE = toString (lib.optionals (stdenv.cc.isGNU && lib.versionAtLeast stdenv.cc.version "12") [
# Needed with GCC 12 but breaks on darwin (with clang) or aarch64 (old gcc)
"-Wno-error=mismatched-new-delete"
"-Wno-error=use-after-free"
];
]);
postInstall = lib.optionalString stdenv.hostPlatform.isDarwin ''
# Normal CMake install phase on Darwin only installs the binary, the user is expected to use CPack to build a

View File

@ -117,9 +117,9 @@ stdenv.mkDerivation rec {
cmakeFlags = [ "-DOCPN_BUNDLE_DOCS=true" ];
env.NIX_CFLAGS_COMPILE = lib.optionals (!stdenv.hostPlatform.isx86) [
env.NIX_CFLAGS_COMPILE = toString (lib.optionals (!stdenv.hostPlatform.isx86) [
"-DSQUISH_USE_SSE=0"
];
]);
postInstall = lib.optionals stdenv.isDarwin ''
mkdir -p $out/Applications

View File

@ -29,7 +29,7 @@ stdenv.mkDerivation rec {
cmakeFlags = [ "-DNoVoip=True" ]; # libtgvoip required
env.NIX_CFLAGS_COMPILE = lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [ "-U__ARM_NEON__" ];
env.NIX_CFLAGS_COMPILE = toString (lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [ "-U__ARM_NEON__" ]);
meta = with lib; {
homepage = "https://github.com/ars3niy/tdlib-purple";

View File

@ -175,11 +175,11 @@ stdenv.mkDerivation rec {
WITH_X11 = true;
};
env.NIX_CFLAGS_COMPILE = lib.optionals stdenv.isDarwin [
env.NIX_CFLAGS_COMPILE = toString (lib.optionals stdenv.isDarwin [
"-DTARGET_OS_IPHONE=0"
"-DTARGET_OS_WATCH=0"
"-include AudioToolbox/AudioToolbox.h"
];
]);
NIX_LDFLAGS = lib.optionals stdenv.isDarwin [
"-framework AudioToolbox"

View File

@ -80,10 +80,10 @@ stdenv.mkDerivation rec {
# guile warning
GUILE_AUTO_COMPILE="0";
env.NIX_CFLAGS_COMPILE = lib.optionals (stdenv.cc.isGNU && lib.versionAtLeast stdenv.cc.version "12") [
env.NIX_CFLAGS_COMPILE = toString (lib.optionals (stdenv.cc.isGNU && lib.versionAtLeast stdenv.cc.version "12") [
# Needed with GCC 12 but breaks on darwin (with clang) or older gcc
"-Wno-error=use-after-free"
];
]);
# `make check` target does not define its prerequisites but expects them to
# have already been built. The list of targets below was built through trial

View File

@ -69,9 +69,9 @@ stdenv.mkDerivation rec {
"-DUNITTEST=ON"
] ++ lib.optionals pulseSupport [ "-DUSE_PULSEAUDIO:BOOL=TRUE" ];
env.NIX_CFLAGS_COMPILE = lib.optionals (stdenv.isDarwin && stdenv.isx86_64) [
env.NIX_CFLAGS_COMPILE = toString (lib.optionals (stdenv.isDarwin && stdenv.isx86_64) [
"-DAPPLE_OLD_XCODE"
];
]);
doCheck = true;

View File

@ -19,7 +19,7 @@ in stdenv.mkDerivation {
cmakeFlags = [ "-DSoapySDR_DIR=${soapysdr}/share/cmake/SoapySDR/" ];
env.NIX_CFLAGS_COMPILE = lib.optionals stdenv.isDarwin [ "-include sys/select.h" ];
env.NIX_CFLAGS_COMPILE = toString (lib.optionals stdenv.isDarwin [ "-include sys/select.h" ]);
meta = with lib; {
homepage = "https://github.com/pothosware/SoapyRemote";

View File

@ -60,13 +60,13 @@ stdenv.mkDerivation rec {
--prefix PATH : "$out/share/cbmc" \
'';
env.NIX_CFLAGS_COMPILE = lib.optionals stdenv.cc.isGNU [
env.NIX_CFLAGS_COMPILE = toString (lib.optionals stdenv.cc.isGNU [
# Needed with GCC 12 but breaks on darwin (with clang)
"-Wno-error=maybe-uninitialized"
] ++ lib.optionals stdenv.cc.isClang [
# fix "argument unused during compilation"
"-Wno-unused-command-line-argument"
];
]);
# TODO: add jbmc support
cmakeFlags = [ "-DWITH_JBMC=OFF" "-Dsat_impl=cadical" "-Dcadical_INCLUDE_DIR=${cadical.dev}/include" ];

View File

@ -13,10 +13,10 @@ stdenv.mkDerivation rec {
makeFlags = [ "PREFIX=$(out)" ];
env.NIX_CFLAGS_COMPILE = lib.optionals stdenv.cc.isGNU [
env.NIX_CFLAGS_COMPILE = toString (lib.optionals stdenv.cc.isGNU [
# Needed with GCC 12
"-Wno-error=maybe-uninitialized"
];
]);
preInstall = ''
mkdir -p $out/bin

View File

@ -171,7 +171,7 @@ stdenv.mkDerivation rec {
optional (!threadSupport) "sb-thread" ++
optionals disableImmobileSpace [ "immobile-space" "immobile-code" "compact-instance-header" ];
env.NIX_CFLAGS_COMPILE = lib.optionals (lib.versionOlder version "2.1.10") [
env.NIX_CFLAGS_COMPILE = toString (lib.optionals (lib.versionOlder version "2.1.10") [
# Workaround build failure on -fno-common toolchains like upstream
# clang-13. Without the change build fails as:
# duplicate symbol '_static_code_space_free_pointer' in: alloc.o traceroot.o
@ -179,7 +179,7 @@ stdenv.mkDerivation rec {
"-fcommon"
]
# Fails to find `O_LARGEFILE` otherwise.
++ [ "-D_GNU_SOURCE" ];
++ [ "-D_GNU_SOURCE" ]);
buildPhase = ''
runHook preBuild

View File

@ -36,10 +36,10 @@ stdenv.mkDerivation rec {
"--enable-remote-bitbang"
];
env.NIX_CFLAGS_COMPILE = lib.optionals stdenv.cc.isGNU [
env.NIX_CFLAGS_COMPILE = toString (lib.optionals stdenv.cc.isGNU [
"-Wno-error=cpp"
"-Wno-error=strict-prototypes" # fixes build failure with hidapi 0.10.0
];
]);
postInstall = lib.optionalString stdenv.isLinux ''
mkdir -p "$out/etc/udev/rules.d"

View File

@ -30,10 +30,10 @@ buildGoModule {
export GOARCH=$(go env GOHOSTARCH)
'';
env.NIX_CFLAGS_COMPILE = lib.optionals stdenv.cc.isGNU [
env.NIX_CFLAGS_COMPILE = toString (lib.optionals stdenv.cc.isGNU [
# Needed with GCC 12 but breaks on darwin (with clang)
"-Wno-error=stringop-overflow"
];
]);
buildPhase = ''
ninjaBuildPhase

View File

@ -44,10 +44,10 @@ stdenv.mkDerivation rec {
};
};
env.NIX_CFLAGS_COMPILE = lib.optionals stdenv.isDarwin [
env.NIX_CFLAGS_COMPILE = toString (lib.optionals stdenv.isDarwin [
"-DTARGET_OS_IPHONE=0"
"-DTARGET_OS_WATCH=0"
];
]);
meta = with lib; {
homepage = "https://gitlab.gnome.org/GNOME/gtk-frdp";

View File

@ -56,10 +56,10 @@ mkDerivation rec {
"-DMBGL_WITH_QT_HEADLESS=OFF"
];
env.NIX_CFLAGS_COMPILE = lib.optionals (stdenv.cc.isGNU && lib.versionAtLeast stdenv.cc.version "12") [
env.NIX_CFLAGS_COMPILE = toString (lib.optionals (stdenv.cc.isGNU && lib.versionAtLeast stdenv.cc.version "12") [
# Needed with GCC 12 but problematic with some old GCCs
"-Wno-error=use-after-free"
];
]);
meta = with lib; {
description = "Open-source alternative to Mapbox GL Native";

View File

@ -323,10 +323,10 @@ self = stdenv.mkDerivation {
done
'';
env.NIX_CFLAGS_COMPILE = lib.optionals stdenv.isDarwin [ "-fno-common" ] ++ lib.optionals enableOpenCL [
env.NIX_CFLAGS_COMPILE = toString (lib.optionals stdenv.isDarwin [ "-fno-common" ] ++ lib.optionals enableOpenCL [
"-UPIPE_SEARCH_DIR"
"-DPIPE_SEARCH_DIR=\"${placeholder "opencl"}/lib/gallium-pipe\""
];
]);
passthru = {
inherit (libglvnd) driverLink;

View File

@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
"-DPYTHON_INCLUDE_DIR=${python3}/include/${python3.libPrefix}"
];
env.NIX_CFLAGS_COMPILE = lib.optionals stdenv.isDarwin [ "-D_GNU_SOURCE" ];
env.NIX_CFLAGS_COMPILE = toString (lib.optionals stdenv.isDarwin [ "-D_GNU_SOURCE" ]);
nativeBuildInputs = [ cmake gcc ];
buildInputs = [ boost eigen libxml2 mpi python3 python3.pkgs.numpy ];

View File

@ -102,7 +102,7 @@ qtModule {
--replace "-Wl,-fatal_warnings" ""
'') + postPatch;
env.NIX_CFLAGS_COMPILE = lib.optionals stdenv.cc.isGNU [
env.NIX_CFLAGS_COMPILE = toString (lib.optionals stdenv.cc.isGNU [
# with gcc8, -Wclass-memaccess became part of -Wall and this exceeds the logging limit
"-Wno-class-memaccess"
] ++ lib.optionals (stdenv.hostPlatform.gcc.arch or "" == "sandybridge") [
@ -111,7 +111,7 @@ qtModule {
"-march=westmere"
] ++ lib.optionals stdenv.cc.isClang [
"-Wno-elaborated-enum-base"
];
]);
preConfigure = ''
export NINJAFLAGS=-j$NIX_BUILD_CORES

View File

@ -40,7 +40,7 @@ stdenv.mkDerivation rec {
"tools"
];
env.NIX_CFLAGS_COMPILE = lib.optionals stdenv.cc.isGNU [
env.NIX_CFLAGS_COMPILE = toString (lib.optionals stdenv.cc.isGNU [
"-Wno-error=deprecated-copy"
"-Wno-error=pessimizing-move"
# Needed with GCC 12
@ -49,7 +49,7 @@ stdenv.mkDerivation rec {
] ++ lib.optionals stdenv.cc.isClang [
"-Wno-error=unused-private-field"
"-faligned-allocation"
];
]);
cmakeFlags = [
"-DPORTABLE=1"

View File

@ -37,9 +37,9 @@ buildPythonPackage rec {
rapidfuzz-cpp
];
env.NIX_CFLAGS_COMPILE = lib.optionals (stdenv.cc.isClang && stdenv.isDarwin) [
env.NIX_CFLAGS_COMPILE = toString (lib.optionals (stdenv.cc.isClang && stdenv.isDarwin) [
"-fno-lto" # work around https://github.com/NixOS/nixpkgs/issues/19098
];
]);
propagatedBuildInputs = [
rapidfuzz

View File

@ -52,9 +52,9 @@ buildPythonPackage rec {
export CMAKE_ARGS="-DCMAKE_CXX_COMPILER_AR=$AR -DCMAKE_CXX_COMPILER_RANLIB=$RANLIB"
'';
env.NIX_CFLAGS_COMPILE = lib.optionals (stdenv.cc.isClang && stdenv.isDarwin) [
env.NIX_CFLAGS_COMPILE = toString (lib.optionals (stdenv.cc.isClang && stdenv.isDarwin) [
"-fno-lto" # work around https://github.com/NixOS/nixpkgs/issues/19098
];
]);
propagatedBuildInputs = [
numpy

View File

@ -136,9 +136,9 @@ stdenv.mkDerivation ((builtins.removeAttrs attrs ["source"]) // {
# As of ruby 3.0, ruby headers require -fdeclspec when building with clang
# Introduced in https://github.com/ruby/ruby/commit/0958e19ffb047781fe1506760c7cbd8d7fe74e57
env.NIX_CFLAGS_COMPILE = lib.optionals (stdenv.cc.isClang && lib.versionAtLeast ruby.version.major "3") [
env.NIX_CFLAGS_COMPILE = toString (lib.optionals (stdenv.cc.isClang && lib.versionAtLeast ruby.version.major "3") [
"-fdeclspec"
];
]);
buildPhase = attrs.buildPhase or ''
runHook preBuild

View File

@ -41,9 +41,9 @@ stdenv.mkDerivation rec {
"-DMOLD_USE_SYSTEM_MIMALLOC:BOOL=ON"
];
env.NIX_CFLAGS_COMPILE = lib.optionals stdenv.isDarwin [
env.NIX_CFLAGS_COMPILE = toString (lib.optionals stdenv.isDarwin [
"-faligned-allocation"
];
]);
passthru.tests.version = testers.testVersion { package = mold; };

View File

@ -30,7 +30,7 @@ stdenv.mkDerivation rec {
hardeningDisable = [ "format" ];
env.NIX_CFLAGS_COMPILE = lib.optionals (stdenv.cc.isGNU && lib.versionAtLeast stdenv.cc.version "12") [
env.NIX_CFLAGS_COMPILE = toString (lib.optionals (stdenv.cc.isGNU && lib.versionAtLeast stdenv.cc.version "12") [
# Needed with GCC 12 but problematic with some old GCCs
"-Wno-error=address"
"-Wno-error=use-after-free"
@ -38,7 +38,7 @@ stdenv.mkDerivation rec {
"-Wno-error=deprecated-declarations"
# Avoid GL_GLEXT_VERSION double definition
" -DNO_SDL_GLEXT"
];
]);
# To avoid problems finding SDL_types.h.
configureFlags = [ "CFLAGS=-I${lib.getDev SDL}/include/SDL" ];

View File

@ -76,9 +76,9 @@ stdenv.mkDerivation rec {
installFlags = [ "DESTDIR=${placeholder "out"}" ];
env.NIX_CFLAGS_COMPILE = lib.optionals stdenv.cc.isGNU [
env.NIX_CFLAGS_COMPILE = toString (lib.optionals stdenv.cc.isGNU [
"-Wno-error=strict-prototypes"
];
]);
enableParallelBuilding = true;

View File

@ -86,9 +86,9 @@ stdenv.mkDerivation rec {
];
# Flag needed by GCC 12 but unrecognized by GCC 9 (aarch64-linux default now)
env.NIX_CFLAGS_COMPILE = lib.optionals (with stdenv; cc.isGNU && lib.versionAtLeast cc.version "12") [
env.NIX_CFLAGS_COMPILE = toString (lib.optionals (with stdenv; cc.isGNU && lib.versionAtLeast cc.version "12") [
"-Wno-error=mismatched-new-delete"
];
]);
patchPhase = ''
patchShebangs scripts

View File

@ -42,10 +42,10 @@ let
python3
];
env.NIX_CFLAGS_COMPILE = lib.optionals (stdenv.cc.isGNU && lib.versionAtLeast stdenv.cc.version "12") [
env.NIX_CFLAGS_COMPILE = toString (lib.optionals (stdenv.cc.isGNU && lib.versionAtLeast stdenv.cc.version "12") [
# Needed with GCC 12 but breaks on darwin (with clang) or older gcc
"-Wno-error=maybe-uninitialized"
];
]);
meta = with lib; {
homepage = "https://github.com/ClusterLabs/resource-agents";

View File

@ -21,9 +21,9 @@ stdenv.mkDerivation rec {
];
# Configure phase requires 64-bit time_t even on 32-bit platforms.
env.NIX_CFLAGS_COMPILE = lib.optionals stdenv.hostPlatform.is32bit [
env.NIX_CFLAGS_COMPILE = toString (lib.optionals stdenv.hostPlatform.is32bit [
"-D_TIME_BITS=64" "-D_FILE_OFFSET_BITS=64"
];
]);
configureFlags = [
"--disable-silent-rules"

View File

@ -38,7 +38,7 @@ buildGoModule rec {
# uses go-systemd, which uses libsystemd headers
# https://github.com/coreos/go-systemd/issues/351
env.NIX_CFLAGS_COMPILE = lib.optionals stdenv.isLinux [ "-I${lib.getDev systemd}/include" ];
env.NIX_CFLAGS_COMPILE = toString (lib.optionals stdenv.isLinux [ "-I${lib.getDev systemd}/include" ]);
# tries to access /sys: https://github.com/grafana/agent/issues/333
preBuild = ''

View File

@ -32,7 +32,7 @@ stdenv.mkDerivation rec {
hardeningEnable = [ "pie" ];
env.NIX_CFLAGS_COMPILE = lib.optionals stdenv.cc.isClang [ "-std=c11" ];
env.NIX_CFLAGS_COMPILE = toString (lib.optionals stdenv.cc.isClang [ "-std=c11" ]);
# darwin currently lacks a pure `pgrep` which is extensively used here
doCheck = !stdenv.isDarwin;

View File

@ -24,7 +24,7 @@ buildGoPackage rec {
sha256 = "0mm3hfr778c7djza8gr1clwa8wca4d3ldh9hlg80avw4x664y5zi";
};
env.NIX_CFLAGS_COMPILE = lib.optionals stdenv.cc.isGNU [ "-Wno-error=deprecated-copy" "-Wno-error=redundant-move" "-Wno-error=pessimizing-move" ];
env.NIX_CFLAGS_COMPILE = toString (lib.optionals stdenv.cc.isGNU [ "-Wno-error=deprecated-copy" "-Wno-error=redundant-move" "-Wno-error=pessimizing-move" ]);
inherit nativeBuildInputs buildInputs;

View File

@ -64,12 +64,12 @@ stdenv.mkDerivation rec {
--replace windres.exe ${stdenv.cc.targetPrefix}windres
'';
env.NIX_CFLAGS_COMPILE = lib.optionals stdenv.isDarwin [
env.NIX_CFLAGS_COMPILE = toString (lib.optionals stdenv.isDarwin [
"-Wno-deprecated-copy-dtor"
] ++ lib.optionals stdenv.hostPlatform.isMinGW [
"-Wno-conversion"
"-Wno-unused-macros"
];
]);
inherit makefile;

View File

@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
sha256 = "sha256-i6V2Owb8GcTcWowgb/BmdupOSFsYiCF2SbC9hXa26uY=";
};
env.NIX_CFLAGS_COMPILE = lib.optionals stdenv.cc.isGNU [ "-std=c++11" ];
env.NIX_CFLAGS_COMPILE = toString (lib.optionals stdenv.cc.isGNU [ "-std=c++11" ]);
nativeBuildInputs = [ cmake pkg-config ];
buildInputs = [ libtiff ];

View File

@ -14,10 +14,10 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ cmake ];
env.NIX_CFLAGS_COMPILE = lib.optionals stdenv.cc.isGNU [
env.NIX_CFLAGS_COMPILE = toString (lib.optionals stdenv.cc.isGNU [
# Needed with GCC 12 but breaks on darwin (with clang)
"-std=c++14"
];
]);
installPhase = ''
mkdir -p $out/bin

View File

@ -14,7 +14,7 @@ edk2.mkDerivation "ShellPkg/ShellPkg.dsc" (finalAttrs: {
++ lib.optionals stdenv.cc.isClang [ llvmPackages.bintools llvmPackages.llvm ];
strictDeps = true;
env.NIX_CFLAGS_COMPILE = lib.optionals stdenv.cc.isClang [ "-fno-pic" "-Qunused-arguments" ];
env.NIX_CFLAGS_COMPILE = toString (lib.optionals stdenv.cc.isClang [ "-fno-pic" "-Qunused-arguments" ]);
# Set explicitly to use Python 3 from nixpkgs. Otherwise, the build system will detect and try to
# use `/usr/bin/python3` on Darwin when sandboxing is disabled.

View File

@ -19,13 +19,13 @@ stdenv.mkDerivation rec {
cmakeFlags = [ "-DFLB_METRICS=ON" "-DFLB_HTTP_SERVER=ON" "-DFLB_OUT_PGSQL=ON" ];
# _FORTIFY_SOURCE requires compiling with optimization (-O)
env.NIX_CFLAGS_COMPILE = lib.optionals stdenv.cc.isGNU [ "-O" ]
env.NIX_CFLAGS_COMPILE = toString (lib.optionals stdenv.cc.isGNU [ "-O" ]
# Workaround build failure on -fno-common toolchains:
# ld: /monkey/mk_tls.h:81: multiple definition of `mk_tls_server_timeout';
# flb_config.c.o:include/monkey/mk_tls.h:81: first defined here
# TODO: drop when upstream gets a fix for it:
# https://github.com/fluent/fluent-bit/issues/5537
++ lib.optionals stdenv.isDarwin [ "-fcommon" ];
++ lib.optionals stdenv.isDarwin [ "-fcommon" ]);
outputs = [ "out" "dev" ];

View File

@ -31,10 +31,10 @@ rustPlatform.buildRustPackage rec {
Foundation
];
env.NIX_CFLAGS_COMPILE = lib.optionals stdenv.isDarwin [
env.NIX_CFLAGS_COMPILE = toString (lib.optionals stdenv.isDarwin [
"-framework"
"AppKit"
];
]);
postInstall = ''
installShellCompletion --cmd topgrade \

View File

@ -41,9 +41,9 @@ rustPlatform.buildRustPackage rec {
# Needed to get openssl-sys to use pkg-config.
OPENSSL_NO_VENDOR = 1;
env.NIX_CFLAGS_COMPILE = lib.optionals stdenv.isDarwin [
env.NIX_CFLAGS_COMPILE = toString (lib.optionals stdenv.isDarwin [
"-framework" "AppKit"
];
]);
# Requires network access
doCheck = false;

View File

@ -18,10 +18,10 @@ stdenv.mkDerivation {
nativeBuildInputs = [ cmake perl ];
buildInputs = [ libubox json_c ];
env.NIX_CFLAGS_COMPILE = lib.optionals (stdenv.cc.isGNU && lib.versionAtLeast stdenv.cc.version "12") [
env.NIX_CFLAGS_COMPILE = toString (lib.optionals (stdenv.cc.isGNU && lib.versionAtLeast stdenv.cc.version "12") [
# Needed with GCC 12 but breaks on darwin (with clang) or older gcc
"-Wno-error=dangling-pointer"
];
]);
meta = with lib; {
description = "Tiny QMI command line utility";

View File

@ -21,10 +21,10 @@ stdenv.mkDerivation rec {
buildInputs = lib.optionals stdenv.isDarwin [ CoreServices CoreFoundation ];
env.NIX_CFLAGS_COMPILE = lib.optionals (stdenv.cc.isGNU && lib.versionAtLeast stdenv.cc.version "12") [
env.NIX_CFLAGS_COMPILE = toString (lib.optionals (stdenv.cc.isGNU && lib.versionAtLeast stdenv.cc.version "12") [
# Needed with GCC 12 but breaks on darwin (with clang) or older gcc
"-Wno-error=mismatched-new-delete"
];
]);
postPatch = lib.optionalString stdenv.isAarch64 ''
substituteInPlace Makefile \