3
0
Fork 0
forked from mirrors/nixpkgs

treewide: use optionalString

This commit is contained in:
Felix Buehler 2023-02-06 21:49:02 +01:00
parent 7f610b4d3f
commit cdb39a86e0
118 changed files with 225 additions and 281 deletions

View file

@ -13,7 +13,7 @@ in pkgs.lib.listToAttrs (builtins.map ({ predictable, withNetworkd }: {
name = pkgs.lib.optionalString (!predictable) "un" + "predictable" name = pkgs.lib.optionalString (!predictable) "un" + "predictable"
+ pkgs.lib.optionalString withNetworkd "Networkd"; + pkgs.lib.optionalString withNetworkd "Networkd";
value = makeTest { value = makeTest {
name = "${if predictable then "" else "un"}predictableInterfaceNames${if withNetworkd then "-with-networkd" else ""}"; name = "${lib.optionalString (!predictable) "un"}predictableInterfaceNames${lib.optionalString withNetworkd "-with-networkd"}";
meta = {}; meta = {};
nodes.machine = { lib, ... }: { nodes.machine = { lib, ... }: {

View file

@ -19,9 +19,9 @@ stdenv.mkDerivation rec {
prePatch = '' prePatch = ''
sed -e s,/bin/ln,ln,g -i src/Makefile sed -e s,/bin/ln,ln,g -i src/Makefile
sed -e 's,^CXXFLAGS=-O2,CXXFLAGS=-O2 -D PATH_ESPEAK_DATA=\\\"$(DATADIR)\\\",' -i src/Makefile sed -e 's,^CXXFLAGS=-O2,CXXFLAGS=-O2 -D PATH_ESPEAK_DATA=\\\"$(DATADIR)\\\",' -i src/Makefile
'' + (if portaudio.api_version == 19 then '' '' + (lib.optionalString (portaudio.api_version == 19) ''
cp src/portaudio19.h src/portaudio.h cp src/portaudio19.h src/portaudio.h
'' else ""); '');
configurePhase = '' configurePhase = ''
cd src cd src

View file

@ -10,11 +10,11 @@ stdenv.mkDerivation {
}; };
nativeBuildInputs = [ cmake ]; nativeBuildInputs = [ cmake ];
buildInputs = [ eigen ffmpeg ]; buildInputs = [ eigen ffmpeg ];
fixupPhase = if stdenv.isDarwin then '' fixupPhase = lib.optionalString stdenv.isDarwin ''
install_name_tool -change libmusly.dylib $out/lib/libmusly.dylib $out/bin/musly install_name_tool -change libmusly.dylib $out/lib/libmusly.dylib $out/bin/musly
install_name_tool -change libmusly_resample.dylib $out/lib/libmusly_resample.dylib $out/bin/musly install_name_tool -change libmusly_resample.dylib $out/lib/libmusly_resample.dylib $out/bin/musly
install_name_tool -change libmusly_resample.dylib $out/lib/libmusly_resample.dylib $out/lib/libmusly.dylib install_name_tool -change libmusly_resample.dylib $out/lib/libmusly_resample.dylib $out/lib/libmusly.dylib
'' else ""; '';
meta = with lib; { meta = with lib; {
homepage = "https://www.musly.org"; homepage = "https://www.musly.org";

View file

@ -15,9 +15,9 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ pkg-config wrapGAppsHook ]; nativeBuildInputs = [ pkg-config wrapGAppsHook ];
buildInputs = [ lightdm gtk3 glib ]; buildInputs = [ lightdm gtk3 glib ];
postUnpack = if conf != "" then '' postUnpack = lib.optionalString (conf != "") ''
cp ${builtins.toFile "config.h" conf} source/config.h cp ${builtins.toFile "config.h" conf} source/config.h
'' else ""; '';
buildPhase = '' buildPhase = ''
mkdir -p $out/bin $out/share/xgreeters mkdir -p $out/bin $out/share/xgreeters

View file

@ -27,18 +27,18 @@ rec {
postPatch = (if tex == null then '' postPatch = (if tex == null then ''
gunzip < ${fullFontsSrc} | (cd TeXmacs && tar xvf -) gunzip < ${fullFontsSrc} | (cd TeXmacs && tar xvf -)
'' else if extraFonts then '' '' else lib.optionalString extraFonts ''
gunzip < ${extraFontsSrc} | (cd TeXmacs && tar xvf -) gunzip < ${extraFontsSrc} | (cd TeXmacs && tar xvf -)
'' else "") + '') +
(if chineseFonts then '' (lib.optionalString chineseFonts ''
gunzip < ${chineseFontsSrc} | (cd TeXmacs && tar xvf -) gunzip < ${chineseFontsSrc} | (cd TeXmacs && tar xvf -)
'' else "") + '') +
(if japaneseFonts then '' (lib.optionalString japaneseFonts ''
gunzip < ${japaneseFontsSrc} | (cd TeXmacs && tar xvf -) gunzip < ${japaneseFontsSrc} | (cd TeXmacs && tar xvf -)
'' else "") + '') +
(if koreanFonts then '' (lib.optionalString koreanFonts ''
gunzip < ${koreanFontsSrc} | (cd TeXmacs && tar xvf -) gunzip < ${koreanFontsSrc} | (cd TeXmacs && tar xvf -)
'' else ""); '');
meta = { meta = {

View file

@ -317,8 +317,8 @@ rec {
lib.warnIf (wrapManual != null) '' lib.warnIf (wrapManual != null) ''
vim.customize: wrapManual is deprecated: the manual is now included by default if `name == "vim"`. vim.customize: wrapManual is deprecated: the manual is now included by default if `name == "vim"`.
${if wrapManual == true && name != "vim" then "Set `standalone = false` to include the manual." ${if wrapManual == true && name != "vim" then "Set `standalone = false` to include the manual."
else if wrapManual == false && name == "vim" then "Set `standalone = true` to get the *vim wrappers only." else lib.optionalString (wrapManual == false && name == "vim") "Set `standalone = true` to get the *vim wrappers only."
else ""}'' }''
lib.warnIf (wrapGui != null) lib.warnIf (wrapGui != null)
"vim.customize: wrapGui is deprecated: gvim is now automatically included if present" "vim.customize: wrapGui is deprecated: gvim is now automatically included if present"
lib.throwIfNot (vimExecutableName == null && gvimExecutableName == null) lib.throwIfNot (vimExecutableName == null && gvimExecutableName == null)
@ -330,7 +330,7 @@ rec {
else throw "at least one of vimrcConfig and vimrcFile must be specified"; else throw "at least one of vimrcConfig and vimrcFile must be specified";
bin = runCommand "${name}-bin" { nativeBuildInputs = [ makeWrapper ]; } '' bin = runCommand "${name}-bin" { nativeBuildInputs = [ makeWrapper ]; } ''
vimrc=${lib.escapeShellArg vimrc} vimrc=${lib.escapeShellArg vimrc}
gvimrc=${if gvimrcFile != null then lib.escapeShellArg gvimrcFile else ""} gvimrc=${lib.optionalString (gvimrcFile != null) (lib.escapeShellArg gvimrcFile)}
mkdir -p "$out/bin" mkdir -p "$out/bin"
for exe in ${ for exe in ${

View file

@ -34,11 +34,11 @@ in stdenv.mkDerivation rec {
wrapVifmMedia = "wrapProgram $out/share/vifm/vifm-media --prefix PATH : ${path}"; wrapVifmMedia = "wrapProgram $out/share/vifm/vifm-media --prefix PATH : ${path}";
in '' in ''
${if mediaSupport then wrapVifmMedia else ""} ${lib.optionalString mediaSupport wrapVifmMedia}
''; '';
meta = with lib; { meta = with lib; {
description = "A vi-like file manager${if isFullPackage then "; Includes support for optional features" else ""}"; description = "A vi-like file manager${lib.optionalString isFullPackage "; Includes support for optional features"}";
maintainers = with maintainers; [ raskin ]; maintainers = with maintainers; [ raskin ];
platforms = if mediaSupport then platforms.linux else platforms.unix; platforms = if mediaSupport then platforms.linux else platforms.unix;
license = licenses.gpl2; license = licenses.gpl2;

View file

@ -87,10 +87,10 @@ stdenv.mkDerivation rec {
'' else '' '' else ''
substituteInPlace extern/clew/src/clew.c --replace '"libOpenCL.so"' '"${ocl-icd}/lib/libOpenCL.so"' substituteInPlace extern/clew/src/clew.c --replace '"libOpenCL.so"' '"${ocl-icd}/lib/libOpenCL.so"'
'') + '') +
(if hipSupport then '' (lib.optionalString hipSupport ''
substituteInPlace extern/hipew/src/hipew.c --replace '"/opt/rocm/hip/lib/libamdhip64.so"' '"${hip}/lib/libamdhip64.so"' substituteInPlace extern/hipew/src/hipew.c --replace '"/opt/rocm/hip/lib/libamdhip64.so"' '"${hip}/lib/libamdhip64.so"'
substituteInPlace extern/hipew/src/hipew.c --replace '"opt/rocm/hip/bin"' '"${hip}/bin"' substituteInPlace extern/hipew/src/hipew.c --replace '"opt/rocm/hip/bin"' '"${hip}/bin"'
'' else ""); '');
cmakeFlags = cmakeFlags =
[ [

View file

@ -46,7 +46,7 @@ in writeScript "update-${pname}" ''
grep "^[0-9]" | \ grep "^[0-9]" | \
sort --version-sort | \ sort --version-sort | \
grep -v "funnelcake" | \ grep -v "funnelcake" | \
grep -e "${if isBeta then "b" else ""}\([[:digit:]]\|[[:digit:]][[:digit:]]\)$" | ${if isBeta then "" else "grep -v \"b\" |"} \ grep -e "${lib.optionalString isBeta "b"}\([[:digit:]]\|[[:digit:]][[:digit:]]\)$" | ${lib.optionalString (not isBeta) "grep -v \"b\" |"} \
tail -1` tail -1`
curl --silent -o $HOME/shasums "$url$version/SHA256SUMS" curl --silent -o $HOME/shasums "$url$version/SHA256SUMS"

View file

@ -70,7 +70,7 @@ let
++ lib.optional libvaSupport libva ++ lib.optional libvaSupport libva
++ [ gtk3 ]; ++ [ gtk3 ];
suffix = if channel != "stable" then "-" + channel else ""; suffix = lib.optionalString (channel != "stable") "-${channel}";
crashpadHandlerBinary = if lib.versionAtLeast version "94" crashpadHandlerBinary = if lib.versionAtLeast version "94"
then "chrome_crashpad_handler" then "chrome_crashpad_handler"

View file

@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
preBuild = '' preBuild = ''
sed -i 's|zlib-1.2.8/zlib.h|zlib.h|g' *.c *.h sed -i 's|zlib-1.2.8/zlib.h|zlib.h|g' *.c *.h
${if stdenv.cc.isClang then "sed -i 's|g++|clang++|g' Makefile.std" else ""} ${lib.optionalString stdenv.cc.isClang "sed -i 's|g++|clang++|g' Makefile.std"}
makeFlagsArray+=( makeFlagsArray+=(
ZLIB=-lz ZLIB=-lz

View file

@ -76,11 +76,10 @@ stdenv.mkDerivation rec {
# tagged releases don't have "unknown" # tagged releases don't have "unknown"
# kicad nightlies use git describe --dirty # kicad nightlies use git describe --dirty
# nix removes .git, so its approximated here # nix removes .git, so its approximated here
postPatch = if (!stable) then '' postPatch = lib.optionalString (!stable) ''
substituteInPlace cmake/KiCadVersion.cmake \ substituteInPlace cmake/KiCadVersion.cmake \
--replace "unknown" "${builtins.substring 0 10 src.rev}" --replace "unknown" "${builtins.substring 0 10 src.rev}"
'' '';
else "";
makeFlags = optionals (debug) [ "CFLAGS+=-Og" "CFLAGS+=-ggdb" ]; makeFlags = optionals (debug) [ "CFLAGS+=-Og" "CFLAGS+=-ggdb" ];

View file

@ -214,7 +214,7 @@ stdenv.mkDerivation rec {
description = (if (stable) description = (if (stable)
then "Open Source Electronics Design Automation suite" then "Open Source Electronics Design Automation suite"
else "Open Source EDA suite, development build") else "Open Source EDA suite, development build")
+ (if (!with3d) then ", without 3D models" else ""); + (lib.optionalString (!with3d) ", without 3D models");
homepage = "https://www.kicad.org/"; homepage = "https://www.kicad.org/";
longDescription = '' longDescription = ''
KiCad is an open source software suite for Electronic Design Automation. KiCad is an open source software suite for Electronic Design Automation.

View file

@ -66,10 +66,10 @@ let
buildIde = args.buildIde or (!coqAtLeast "8.14"); buildIde = args.buildIde or (!coqAtLeast "8.14");
ideFlags = optionalString (buildIde && !coqAtLeast "8.10") ideFlags = optionalString (buildIde && !coqAtLeast "8.10")
"-lablgtkdir ${ocamlPackages.lablgtk}/lib/ocaml/*/site-lib/lablgtk2 -coqide opt"; "-lablgtkdir ${ocamlPackages.lablgtk}/lib/ocaml/*/site-lib/lablgtk2 -coqide opt";
csdpPatch = if csdp != null then '' csdpPatch = lib.optionalString (csdp != null) ''
substituteInPlace plugins/micromega/sos.ml --replace "; csdp" "; ${csdp}/bin/csdp" substituteInPlace plugins/micromega/sos.ml --replace "; csdp" "; ${csdp}/bin/csdp"
substituteInPlace plugins/micromega/coq_micromega.ml --replace "System.is_in_system_path \"csdp\"" "true" substituteInPlace plugins/micromega/coq_micromega.ml --replace "System.is_in_system_path \"csdp\"" "true"
'' else ""; '';
ocamlPackages = if !isNull customOCamlPackages then customOCamlPackages ocamlPackages = if !isNull customOCamlPackages then customOCamlPackages
else with versions; switch coq-version [ else with versions; switch coq-version [
{ case = range "8.16" "8.17"; out = ocamlPackages_4_14; } { case = range "8.16" "8.17"; out = ocamlPackages_4_14; }
@ -158,7 +158,7 @@ self = stdenv.mkDerivation {
UNAME=$(type -tp uname) UNAME=$(type -tp uname)
RM=$(type -tp rm) RM=$(type -tp rm)
substituteInPlace tools/beautify-archive --replace "/bin/rm" "$RM" substituteInPlace tools/beautify-archive --replace "/bin/rm" "$RM"
${if !coqAtLeast "8.7" then "substituteInPlace configure.ml --replace \"md5 -q\" \"md5sum\"" else ""} ${lib.optionalString (!coqAtLeast "8.7") "substituteInPlace configure.ml --replace \"md5 -q\" \"md5sum\""}
${csdpPatch} ${csdpPatch}
''; '';
@ -196,7 +196,7 @@ self = stdenv.mkDerivation {
categories = [ "Development" "Science" "Math" "IDE" "GTK" ]; categories = [ "Development" "Science" "Math" "IDE" "GTK" ];
}); });
postInstall = let suffix = if coqAtLeast "8.14" then "-core" else ""; in optionalString (!coqAtLeast "8.17") '' postInstall = let suffix = optionalString (coqAtLeast "8.14") "-core"; in optionalString (!coqAtLeast "8.17") ''
cp bin/votour $out/bin/ cp bin/votour $out/bin/
'' + '' '' + ''
ln -s $out/lib/coq${suffix} $OCAMLFIND_DESTDIR/coq${suffix} ln -s $out/lib/coq${suffix} $OCAMLFIND_DESTDIR/coq${suffix}
@ -227,12 +227,12 @@ if coqAtLeast "8.17" then self.overrideAttrs(_: {
buildPhase = '' buildPhase = ''
runHook preBuild runHook preBuild
make dunestrap make dunestrap
dune build -p coq-core,coq-stdlib,coq,coqide-server${if buildIde then ",coqide" else ""} -j $NIX_BUILD_CORES dune build -p coq-core,coq-stdlib,coq,coqide-server${lib.optionalString buildIde ",coqide"} -j $NIX_BUILD_CORES
runHook postBuild runHook postBuild
''; '';
installPhase = '' installPhase = ''
runHook preInstall runHook preInstall
dune install --prefix $out coq-core coq-stdlib coq coqide-server${if buildIde then " coqide" else ""} dune install --prefix $out coq-core coq-stdlib coq coqide-server${lib.optionalString buildIde " coqide"}
runHook postInstall runHook postInstall
''; '';
}) else self }) else self

View file

@ -18,7 +18,7 @@ let
src = sage-with-env.env.lib.src; src = sage-with-env.env.lib.src;
runAllTests = files == null; runAllTests = files == null;
testArgs = if runAllTests then "--all" else testFileList; testArgs = if runAllTests then "--all" else testFileList;
patienceSpecifier = if longTests then "--long" else ""; patienceSpecifier = lib.optionalString longTests "--long";
timeSpecifier = if timeLimit == null then "" else "--short ${toString timeLimit}"; timeSpecifier = if timeLimit == null then "" else "--short ${toString timeLimit}";
relpathToArg = relpath: lib.escapeShellArg "${src}/${relpath}"; # paths need to be absolute relpathToArg = relpath: lib.escapeShellArg "${src}/${relpath}"; # paths need to be absolute
testFileList = lib.concatStringsSep " " (map relpathToArg files); testFileList = lib.concatStringsSep " " (map relpathToArg files);

View file

@ -16,7 +16,7 @@ let
# getAttr-like helper for optional append to string: # getAttr-like helper for optional append to string:
# "Hello" + appendByAttr "a" " " {a = "world";} = "Hello world" # "Hello" + appendByAttr "a" " " {a = "world";} = "Hello world"
# "Hello" + appendByAttr "a" " " {} = "Hello" # "Hello" + appendByAttr "a" " " {} = "Hello"
appendByAttr = attr: sep: x: if hasAttr attr x then sep + (getAttr attr x) else ""; appendByAttr = attr: sep: x: lib.optionalString (hasAttr attr x) (sep + (getAttr attr x));
# Are there any OM dependencies at all? # Are there any OM dependencies at all?
ifDeps = length pkg.omdeps != 0; ifDeps = length pkg.omdeps != 0;

View file

@ -63,8 +63,8 @@ stdenv.mkDerivation (self: {
preBuild = '' preBuild = ''
makeFlagsArray+=( makeFlagsArray+=(
XWAYLAND=${if enableXWayland then "-DXWAYLAND" else ""} XWAYLAND=${lib.optionalString enableXWayland "-DXWAYLAND"}
XLIBS=${if enableXWayland then "xcb\\ xcb-icccm" else ""} XLIBS=${lib.optionalString enableXWayland "xcb\\ xcb-icccm"}
) )
''; '';

View file

@ -83,12 +83,12 @@ stdenv.mkDerivation {
'' + (if stdenv.hostPlatform.parsed.kernel.execFormat.name == "elf" then '' '' + (if stdenv.hostPlatform.parsed.kernel.execFormat.name == "elf" then ''
patchelf --set-soname libblas${canonicalExtension} $out/lib/libblas${canonicalExtension} patchelf --set-soname libblas${canonicalExtension} $out/lib/libblas${canonicalExtension}
patchelf --set-rpath "$(patchelf --print-rpath $out/lib/libblas${canonicalExtension}):${lib.getLib blasProvider'}/lib" $out/lib/libblas${canonicalExtension} patchelf --set-rpath "$(patchelf --print-rpath $out/lib/libblas${canonicalExtension}):${lib.getLib blasProvider'}/lib" $out/lib/libblas${canonicalExtension}
'' else if stdenv.hostPlatform.isDarwin then '' '' else lib.optionalString (stdenv.hostPlatform.isDarwin) ''
install_name_tool \ install_name_tool \
-id $out/lib/libblas${canonicalExtension} \ -id $out/lib/libblas${canonicalExtension} \
-add_rpath ${lib.getLib blasProvider'}/lib \ -add_rpath ${lib.getLib blasProvider'}/lib \
$out/lib/libblas${canonicalExtension} $out/lib/libblas${canonicalExtension}
'' else "") + '' '') + ''
if [ "$out/lib/libblas${canonicalExtension}" != "$out/lib/libblas${stdenv.hostPlatform.extensions.sharedLibrary}" ]; then if [ "$out/lib/libblas${canonicalExtension}" != "$out/lib/libblas${stdenv.hostPlatform.extensions.sharedLibrary}" ]; then
ln -s $out/lib/libblas${canonicalExtension} "$out/lib/libblas${stdenv.hostPlatform.extensions.sharedLibrary}" ln -s $out/lib/libblas${canonicalExtension} "$out/lib/libblas${stdenv.hostPlatform.extensions.sharedLibrary}"
@ -115,12 +115,12 @@ EOF
'' + (if stdenv.hostPlatform.parsed.kernel.execFormat.name == "elf" then '' '' + (if stdenv.hostPlatform.parsed.kernel.execFormat.name == "elf" then ''
patchelf --set-soname libcblas${canonicalExtension} $out/lib/libcblas${canonicalExtension} patchelf --set-soname libcblas${canonicalExtension} $out/lib/libcblas${canonicalExtension}
patchelf --set-rpath "$(patchelf --print-rpath $out/lib/libcblas${canonicalExtension}):${lib.getLib blasProvider'}/lib" $out/lib/libcblas${canonicalExtension} patchelf --set-rpath "$(patchelf --print-rpath $out/lib/libcblas${canonicalExtension}):${lib.getLib blasProvider'}/lib" $out/lib/libcblas${canonicalExtension}
'' else if stdenv.hostPlatform.isDarwin then '' '' else lib.optionalString stdenv.hostPlatform.isDarwin ''
install_name_tool \ install_name_tool \
-id $out/lib/libcblas${canonicalExtension} \ -id $out/lib/libcblas${canonicalExtension} \
-add_rpath ${lib.getLib blasProvider'}/lib \ -add_rpath ${lib.getLib blasProvider'}/lib \
$out/lib/libcblas${canonicalExtension} $out/lib/libcblas${canonicalExtension}
'' else "") + '' '') + ''
if [ "$out/lib/libcblas${canonicalExtension}" != "$out/lib/libcblas${stdenv.hostPlatform.extensions.sharedLibrary}" ]; then if [ "$out/lib/libcblas${canonicalExtension}" != "$out/lib/libcblas${stdenv.hostPlatform.extensions.sharedLibrary}" ]; then
ln -s $out/lib/libcblas${canonicalExtension} "$out/lib/libcblas${stdenv.hostPlatform.extensions.sharedLibrary}" ln -s $out/lib/libcblas${canonicalExtension} "$out/lib/libcblas${stdenv.hostPlatform.extensions.sharedLibrary}"
fi fi

View file

@ -54,10 +54,10 @@ stdenv.mkDerivation {
cp -L "$liblapack" $out/lib/liblapack${canonicalExtension} cp -L "$liblapack" $out/lib/liblapack${canonicalExtension}
chmod +w $out/lib/liblapack${canonicalExtension} chmod +w $out/lib/liblapack${canonicalExtension}
'' + (if stdenv.hostPlatform.parsed.kernel.execFormat.name == "elf" then '' '' + (lib.optionalString (stdenv.hostPlatform.parsed.kernel.execFormat.name == "elf") ''
patchelf --set-soname liblapack${canonicalExtension} $out/lib/liblapack${canonicalExtension} patchelf --set-soname liblapack${canonicalExtension} $out/lib/liblapack${canonicalExtension}
patchelf --set-rpath "$(patchelf --print-rpath $out/lib/liblapack${canonicalExtension}):${lapackProvider'}/lib" $out/lib/liblapack${canonicalExtension} patchelf --set-rpath "$(patchelf --print-rpath $out/lib/liblapack${canonicalExtension}):${lapackProvider'}/lib" $out/lib/liblapack${canonicalExtension}
'' else "") + '' '') + ''
if [ "$out/lib/liblapack${canonicalExtension}" != "$out/lib/liblapack${stdenv.hostPlatform.extensions.sharedLibrary}" ]; then if [ "$out/lib/liblapack${canonicalExtension}" != "$out/lib/liblapack${stdenv.hostPlatform.extensions.sharedLibrary}" ]; then
ln -s $out/lib/liblapack${canonicalExtension} "$out/lib/liblapack${stdenv.hostPlatform.extensions.sharedLibrary}" ln -s $out/lib/liblapack${canonicalExtension} "$out/lib/liblapack${stdenv.hostPlatform.extensions.sharedLibrary}"
@ -83,10 +83,10 @@ EOF
cp -L "$liblapacke" $out/lib/liblapacke${canonicalExtension} cp -L "$liblapacke" $out/lib/liblapacke${canonicalExtension}
chmod +w $out/lib/liblapacke${canonicalExtension} chmod +w $out/lib/liblapacke${canonicalExtension}
'' + (if stdenv.hostPlatform.parsed.kernel.execFormat.name == "elf" then '' '' + (lib.optionalString (stdenv.hostPlatform.parsed.kernel.execFormat.name == "elf") ''
patchelf --set-soname liblapacke${canonicalExtension} $out/lib/liblapacke${canonicalExtension} patchelf --set-soname liblapacke${canonicalExtension} $out/lib/liblapacke${canonicalExtension}
patchelf --set-rpath "$(patchelf --print-rpath $out/lib/liblapacke${canonicalExtension}):${lib.getLib lapackProvider'}/lib" $out/lib/liblapacke${canonicalExtension} patchelf --set-rpath "$(patchelf --print-rpath $out/lib/liblapacke${canonicalExtension}):${lib.getLib lapackProvider'}/lib" $out/lib/liblapacke${canonicalExtension}
'' else "") + '' '') + ''
if [ -f "$out/lib/liblapacke.so.3" ]; then if [ -f "$out/lib/liblapacke.so.3" ]; then
ln -s $out/lib/liblapacke.so.3 $out/lib/liblapacke.so ln -s $out/lib/liblapacke.so.3 $out/lib/liblapacke.so

View file

@ -92,9 +92,8 @@ let
else ""; else "";
expand-response-params = expand-response-params =
if buildPackages ? stdenv && buildPackages.stdenv.hasCC && buildPackages.stdenv.cc != "/dev/null" lib.optionalString (buildPackages ? stdenv && buildPackages.stdenv.hasCC && buildPackages.stdenv.cc != "/dev/null")
then import ../expand-response-params { inherit (buildPackages) stdenv; } (import ../expand-response-params { inherit (buildPackages) stdenv; });
else "";
in in

View file

@ -118,10 +118,10 @@ stdenv.mkDerivation (fBuildAttrs // {
# Remove all built in external workspaces, Bazel will recreate them when building # Remove all built in external workspaces, Bazel will recreate them when building
rm -rf $bazelOut/external/{bazel_tools,\@bazel_tools.marker} rm -rf $bazelOut/external/{bazel_tools,\@bazel_tools.marker}
${if removeRulesCC then "rm -rf $bazelOut/external/{rules_cc,\\@rules_cc.marker}" else ""} ${lib.optionalString removeRulesCC "rm -rf $bazelOut/external/{rules_cc,\\@rules_cc.marker}"}
rm -rf $bazelOut/external/{embedded_jdk,\@embedded_jdk.marker} rm -rf $bazelOut/external/{embedded_jdk,\@embedded_jdk.marker}
${if removeLocalConfigCc then "rm -rf $bazelOut/external/{local_config_cc,\\@local_config_cc.marker}" else ""} ${lib.optionalString removeLocalConfigCc "rm -rf $bazelOut/external/{local_config_cc,\\@local_config_cc.marker}"}
${if removeLocal then "rm -rf $bazelOut/external/{local_*,\\@local_*.marker}" else ""} ${lib.optionalString removeLocal "rm -rf $bazelOut/external/{local_*,\\@local_*.marker}"}
# Clear markers # Clear markers
find $bazelOut/external -name '@*\.marker' -exec sh -c 'echo > {}' \; find $bazelOut/external -name '@*\.marker' -exec sh -c 'echo > {}' \;

View file

@ -212,7 +212,7 @@ in stdenv.mkDerivation {
cd $out cd $out
${extraBuildCommands} ${extraBuildCommands}
cd $out cd $out
${if isMultiBuild then extraBuildCommandsMulti else ""} ${lib.optionalString isMultiBuild extraBuildCommandsMulti}
''; '';
preferLocalBuild = true; preferLocalBuild = true;
allowSubstitutes = false; allowSubstitutes = false;

View file

@ -1,4 +1,4 @@
{ stdenv, buildEnv, writeText, pkgs, pkgsi686Linux }: { stdenv, lib, buildEnv, writeText, pkgs, pkgsi686Linux }:
{ name { name
, profile ? "" , profile ? ""
@ -237,7 +237,7 @@ in stdenv.mkDerivation {
cd $out cd $out
${extraBuildCommands} ${extraBuildCommands}
cd $out cd $out
${if isMultiBuild then extraBuildCommandsMulti else ""} ${lib.optionalString isMultiBuild extraBuildCommandsMulti}
''; '';
preferLocalBuild = true; preferLocalBuild = true;
allowSubstitutes = false; allowSubstitutes = false;

View file

@ -59,9 +59,7 @@ let
suffixSalt = replaceStrings ["-" "."] ["_" "_"] targetPlatform.config; suffixSalt = replaceStrings ["-" "."] ["_" "_"] targetPlatform.config;
expand-response-params = expand-response-params =
if (buildPackages.stdenv.hasCC or false) && buildPackages.stdenv.cc != "/dev/null" lib.optionalString ((buildPackages.stdenv.hasCC or false) && buildPackages.stdenv.cc != "/dev/null") (import ../expand-response-params { inherit (buildPackages) stdenv; });
then import ../expand-response-params { inherit (buildPackages) stdenv; }
else "";
useGccForLibs = isClang useGccForLibs = isClang
&& libcxx == null && libcxx == null

View file

@ -35,4 +35,4 @@ let
({prefix, path}: "DOCKER_CREDENTIALS" == prefix) ({prefix, path}: "DOCKER_CREDENTIALS" == prefix)
builtins.nixPath); builtins.nixPath);
in in
if (pathParts != []) then (builtins.head pathParts).path else "" lib.optionalString (pathParts != []) ((builtins.head pathParts).path)

View file

@ -1,9 +1,9 @@
{stdenv, fossil, cacert}: {stdenv, lib, fossil, cacert}:
{name ? null, url, rev, sha256}: {name ? null, url, rev, sha256}:
stdenv.mkDerivation { stdenv.mkDerivation {
name = "fossil-archive" + (if name != null then "-${name}" else ""); name = "fossil-archive" + (lib.optionalString (name != null) "-${name}");
builder = ./builder.sh; builder = ./builder.sh;
nativeBuildInputs = [fossil cacert]; nativeBuildInputs = [fossil cacert];

View file

@ -7,9 +7,7 @@
short = builtins.substring 0 7 rev; short = builtins.substring 0 7 rev;
appendShort = if (builtins.match "[a-f0-9]*" rev) != null appendShort = lib.optionalString ((builtins.match "[a-f0-9]*" rev) != null) "-${short}";
then "-${short}"
else "";
in "${if matched == null then base else builtins.head matched}${appendShort}"; in "${if matched == null then base else builtins.head matched}${appendShort}";
in in
{ url, rev ? "HEAD", md5 ? "", sha256 ? "", hash ? "", leaveDotGit ? deepClone { url, rev ? "HEAD", md5 ? "", sha256 ? "", hash ? "", leaveDotGit ? deepClone

View file

@ -12,13 +12,13 @@ if md5 != null then
else else
# TODO: statically check if mercurial as the https support if the url starts woth https. # TODO: statically check if mercurial as the https support if the url starts woth https.
stdenvNoCC.mkDerivation { stdenvNoCC.mkDerivation {
name = "hg-archive" + (if name != null then "-${name}" else ""); name = "hg-archive" + (lib.optionalString (name != null) "-${name}");
builder = ./builder.sh; builder = ./builder.sh;
nativeBuildInputs = [mercurial]; nativeBuildInputs = [mercurial];
impureEnvVars = lib.fetchers.proxyImpureEnvVars; impureEnvVars = lib.fetchers.proxyImpureEnvVars;
subrepoClause = if fetchSubrepos then "S" else ""; subrepoClause = lib.optionalString fetchSubrepos "S";
outputHashAlgo = "sha256"; outputHashAlgo = "sha256";
outputHashMode = "recursive"; outputHashMode = "recursive";

View file

@ -18,7 +18,7 @@
let let
args' = if relative != null then { args' = if relative != null then {
stripLen = 1 + lib.length (lib.splitString "/" relative) + stripLen; stripLen = 1 + lib.length (lib.splitString "/" relative) + stripLen;
extraPrefix = if extraPrefix != null then extraPrefix else ""; extraPrefix = lib.optionalString (extraPrefix != null) extraPrefix;
} else { } else {
inherit stripLen extraPrefix; inherit stripLen extraPrefix;
}; };

View file

@ -36,6 +36,6 @@ stdenvNoCC.mkDerivation {
inherit perl; inherit perl;
inherit (builtins) storeDir; inherit (builtins) storeDir;
shell = lib.getBin shell + (shell.shellPath or ""); shell = lib.getBin shell + (shell.shellPath or "");
signingUtils = if darwinCodeSign then signingUtils else ""; signingUtils = lib.optionalString darwinCodeSign signingUtils;
}; };
} }

View file

@ -10,7 +10,7 @@
directory, so the Makefile of the package should support DESTDIR. directory, so the Makefile of the package should support DESTDIR.
*/ */
{ src, stdenv { src, lib, stdenv
, name ? "binary-tarball" , name ? "binary-tarball"
, ... } @ args: , ... } @ args:
@ -30,7 +30,7 @@ stdenv.mkDerivation (
// args // // args //
{ {
name = name + (if src ? version then "-" + src.version else ""); name = name + (lib.optionalString (src ? version) "-${src.version}");
postHook = '' postHook = ''
mkdir -p $out/nix-support mkdir -p $out/nix-support

View file

@ -24,7 +24,7 @@ vmTools.runInLinuxImage (stdenv.mkDerivation (
// removeAttrs args ["vmTools" "lib"] // // removeAttrs args ["vmTools" "lib"] //
{ {
name = name + "-" + diskImage.name + (if src ? version then "-" + src.version else ""); name = name + "-" + diskImage.name + (lib.optionalString (src ? version) "-${src.version}");
# !!! cut&paste from rpm-build.nix # !!! cut&paste from rpm-build.nix
postHook = '' postHook = ''

View file

@ -11,7 +11,7 @@ rec {
makeSourceTarball = sourceTarball; # compatibility makeSourceTarball = sourceTarball; # compatibility
binaryTarball = args: import ./binary-tarball.nix ( binaryTarball = args: import ./binary-tarball.nix (
{ inherit stdenv; { inherit lib stdenv;
} // args); } // args);
mvnBuild = args: import ./maven-build.nix ( mvnBuild = args: import ./maven-build.nix (
@ -38,7 +38,7 @@ rec {
} // args); } // args);
rpmBuild = args: import ./rpm-build.nix ( rpmBuild = args: import ./rpm-build.nix (
{ inherit vmTools; { inherit lib vmTools;
} // args); } // args);
debBuild = args: import ./debian-build.nix ( debBuild = args: import ./debian-build.nix (

View file

@ -22,7 +22,7 @@ in
stdenv.mkDerivation ( { stdenv.mkDerivation ( {
inherit name src; inherit name src;
phases = "setupPhase unpackPhase patchPhase mvnCompile ${if doTestCompile then "mvnTestCompile mvnTestJar" else ""} ${if doTest then "mvnTest" else ""} ${if doJavadoc then "mvnJavadoc" else ""} ${if doCheckstyle then "mvnCheckstyle" else ""} mvnJar mvnAssembly mvnRelease finalPhase"; phases = "setupPhase unpackPhase patchPhase mvnCompile ${lib.optionalString doTestCompile "mvnTestCompile mvnTestJar"} ${lib.optionalString doTest "mvnTest"} ${lib.optionalString doJavadoc "mvnJavadoc"} ${lib.optionalString doCheckstyle "mvnCheckstyle"} mvnJar mvnAssembly mvnRelease finalPhase";
setupPhase = '' setupPhase = ''
runHook preSetupPhase runHook preSetupPhase
@ -88,9 +88,9 @@ stdenv.mkDerivation ( {
echo "$releaseName" > $out/nix-support/hydra-release-name echo "$releaseName" > $out/nix-support/hydra-release-name
${if doRelease then '' ${lib.optionalString doRelease ''
echo "file zip $out/release/$releaseName.zip" >> $out/nix-support/hydra-build-products echo "file zip $out/release/$releaseName.zip" >> $out/nix-support/hydra-build-products
'' else ""} ''}
''; '';
finalPhase = '' finalPhase = ''

View file

@ -85,7 +85,7 @@ stdenv.mkDerivation (
// removeAttrs args [ "lib" ] # Propagating lib causes the evaluation to fail, because lib is a function that can't be converted to a string // removeAttrs args [ "lib" ] # Propagating lib causes the evaluation to fail, because lib is a function that can't be converted to a string
// { // {
name = name + (if src ? version then "-" + src.version else ""); name = name + (lib.optionalString (src ? version) "-${src.version}");
postHook = '' postHook = ''
. ${./functions.sh} . ${./functions.sh}
@ -167,7 +167,7 @@ stdenv.mkDerivation (
echo "building out of source tree, from \`$PWD'..." echo "building out of source tree, from \`$PWD'..."
${if preConfigure != null then preConfigure else ""} ${lib.optionalString (preConfigure != null) preConfigure}
''; '';
} }
else {}) else {})

View file

@ -3,7 +3,7 @@
{ name ? "rpm-build" { name ? "rpm-build"
, diskImage , diskImage
, src, vmTools , src, lib, vmTools
, ... } @ args: , ... } @ args:
vmTools.buildRPM ( vmTools.buildRPM (
@ -11,7 +11,7 @@ vmTools.buildRPM (
removeAttrs args ["vmTools"] // removeAttrs args ["vmTools"] //
{ {
name = name + "-" + diskImage.name + (if src ? version then "-" + src.version else ""); name = name + "-" + diskImage.name + (lib.optionalString (src ? version) "-${src.version}");
preBuild = '' preBuild = ''
. ${./functions.sh} . ${./functions.sh}

View file

@ -299,7 +299,7 @@ crate_: lib.makeOverridable
); );
libName = if crate ? libName then crate.libName else crate.crateName; libName = if crate ? libName then crate.libName else crate.crateName;
libPath = if crate ? libPath then crate.libPath else ""; libPath = lib.optionalString (crate ? libPath) crate.libPath;
# Seed the symbol hashes with something unique every time. # Seed the symbol hashes with something unique every time.
# https://doc.rust-lang.org/1.0.0/rustc/metadata/loader/index.html#frobbing-symbols # https://doc.rust-lang.org/1.0.0/rustc/metadata/loader/index.html#frobbing-symbols

View file

@ -406,7 +406,7 @@ rec {
eval "$origPostHook" eval "$origPostHook"
''; '';
origPostHook = if attrs ? postHook then attrs.postHook else ""; origPostHook = lib.optionalString (attrs ? postHook) attrs.postHook;
/* Don't run Nix-specific build steps like patchelf. */ /* Don't run Nix-specific build steps like patchelf. */
fixupPhase = "true"; fixupPhase = "true";

View file

@ -186,10 +186,10 @@ stdenv.mkDerivation ({
--replace "-install_name \\\$rpath/\\\$soname" "-install_name ''${!outputLib}/lib/\\\$soname" --replace "-install_name \\\$rpath/\\\$soname" "-install_name ''${!outputLib}/lib/\\\$soname"
'' ''
+ ( + (
if targetPlatform != hostPlatform || stdenv.cc.libc != null then lib.optionalString (targetPlatform != hostPlatform || stdenv.cc.libc != null)
# On NixOS, use the right path to the dynamic linker instead of # On NixOS, use the right path to the dynamic linker instead of
# `/lib/ld*.so'. # `/lib/ld*.so'.
let (let
libc = if libcCross != null then libcCross else stdenv.cc.libc; libc = if libcCross != null then libcCross else stdenv.cc.libc;
in in
( (
@ -207,8 +207,8 @@ stdenv.mkDerivation ({
'' ''
sed -i gcc/config/linux.h -e '1i#undef LOCAL_INCLUDE_DIR' sed -i gcc/config/linux.h -e '1i#undef LOCAL_INCLUDE_DIR'
'' ''
))
) )
else "")
+ lib.optionalString targetPlatform.isAvr '' + lib.optionalString targetPlatform.isAvr ''
makeFlagsArray+=( makeFlagsArray+=(
'-s' # workaround for hitting hydra log limit '-s' # workaround for hitting hydra log limit

View file

@ -195,10 +195,10 @@ stdenv.mkDerivation ({
--replace "-install_name \\\$rpath/\\\$soname" "-install_name ''${!outputLib}/lib/\\\$soname" --replace "-install_name \\\$rpath/\\\$soname" "-install_name ''${!outputLib}/lib/\\\$soname"
'' ''
+ ( + (
if targetPlatform != hostPlatform || stdenv.cc.libc != null then lib.optionalString (targetPlatform != hostPlatform || stdenv.cc.libc != null)
# On NixOS, use the right path to the dynamic linker instead of # On NixOS, use the right path to the dynamic linker instead of
# `/lib/ld*.so'. # `/lib/ld*.so'.
let (let
libc = if libcCross != null then libcCross else stdenv.cc.libc; libc = if libcCross != null then libcCross else stdenv.cc.libc;
in in
( (
@ -216,8 +216,8 @@ stdenv.mkDerivation ({
'' ''
sed -i gcc/config/linux.h -e '1i#undef LOCAL_INCLUDE_DIR' sed -i gcc/config/linux.h -e '1i#undef LOCAL_INCLUDE_DIR'
'' ''
))
) )
else "")
+ lib.optionalString targetPlatform.isAvr '' + lib.optionalString targetPlatform.isAvr ''
makeFlagsArray+=( makeFlagsArray+=(
'-s' # workaround for hitting hydra log limit '-s' # workaround for hitting hydra log limit

View file

@ -226,10 +226,10 @@ stdenv.mkDerivation ({
--replace "-install_name \\\$rpath/\\\$soname" "-install_name ''${!outputLib}/lib/\\\$soname" --replace "-install_name \\\$rpath/\\\$soname" "-install_name ''${!outputLib}/lib/\\\$soname"
'' ''
+ ( + (
if targetPlatform != hostPlatform || stdenv.cc.libc != null then lib.optionalString (targetPlatform != hostPlatform || stdenv.cc.libc != null)
# On NixOS, use the right path to the dynamic linker instead of # On NixOS, use the right path to the dynamic linker instead of
# `/lib/ld*.so'. # `/lib/ld*.so'.
let (let
libc = if libcCross != null then libcCross else stdenv.cc.libc; libc = if libcCross != null then libcCross else stdenv.cc.libc;
in in
( (
@ -248,7 +248,7 @@ stdenv.mkDerivation ({
sed -i gcc/config/linux.h -e '1i#undef LOCAL_INCLUDE_DIR' sed -i gcc/config/linux.h -e '1i#undef LOCAL_INCLUDE_DIR'
'' ''
) )
else "") ))
+ lib.optionalString targetPlatform.isAvr '' + lib.optionalString targetPlatform.isAvr ''
makeFlagsArray+=( makeFlagsArray+=(
'-s' # workaround for hitting hydra log limit '-s' # workaround for hitting hydra log limit

View file

@ -246,10 +246,10 @@ stdenv.mkDerivation ({
--replace "-install_name \\\$rpath/\\\$soname" "-install_name ''${!outputLib}/lib/\\\$soname" --replace "-install_name \\\$rpath/\\\$soname" "-install_name ''${!outputLib}/lib/\\\$soname"
'' ''
+ ( + (
if targetPlatform != hostPlatform || stdenv.cc.libc != null then lib.optionalString (targetPlatform != hostPlatform || stdenv.cc.libc != null)
# On NixOS, use the right path to the dynamic linker instead of # On NixOS, use the right path to the dynamic linker instead of
# `/lib/ld*.so'. # `/lib/ld*.so'.
let (let
libc = if libcCross != null then libcCross else stdenv.cc.libc; libc = if libcCross != null then libcCross else stdenv.cc.libc;
in in
( (
@ -267,8 +267,8 @@ stdenv.mkDerivation ({
'' ''
sed -i gcc/config/linux.h -e '1i#undef LOCAL_INCLUDE_DIR' sed -i gcc/config/linux.h -e '1i#undef LOCAL_INCLUDE_DIR'
'' ''
) ))
else ""); );
inherit noSysDirs staticCompiler langJava crossStageStatic inherit noSysDirs staticCompiler langJava crossStageStatic
libcCross crossMingw; libcCross crossMingw;

View file

@ -190,10 +190,10 @@ stdenv.mkDerivation ({
--replace "-install_name \\\$rpath/\\\$soname" "-install_name ''${!outputLib}/lib/\\\$soname" --replace "-install_name \\\$rpath/\\\$soname" "-install_name ''${!outputLib}/lib/\\\$soname"
'' ''
+ ( + (
if targetPlatform != hostPlatform || stdenv.cc.libc != null then lib.optionalString (targetPlatform != hostPlatform || stdenv.cc.libc != null)
# On NixOS, use the right path to the dynamic linker instead of # On NixOS, use the right path to the dynamic linker instead of
# `/lib/ld*.so'. # `/lib/ld*.so'.
let (let
libc = if libcCross != null then libcCross else stdenv.cc.libc; libc = if libcCross != null then libcCross else stdenv.cc.libc;
in in
( (
@ -211,8 +211,8 @@ stdenv.mkDerivation ({
'' ''
sed -i gcc/config/linux.h -e '1i#undef LOCAL_INCLUDE_DIR' sed -i gcc/config/linux.h -e '1i#undef LOCAL_INCLUDE_DIR'
'' ''
))
) )
else "")
+ lib.optionalString targetPlatform.isAvr '' + lib.optionalString targetPlatform.isAvr ''
makeFlagsArray+=( makeFlagsArray+=(
'LIMITS_H_TEST=false' 'LIMITS_H_TEST=false'

View file

@ -172,10 +172,10 @@ stdenv.mkDerivation ({
--replace "-install_name \\\$rpath/\\\$soname" "-install_name ''${!outputLib}/lib/\\\$soname" --replace "-install_name \\\$rpath/\\\$soname" "-install_name ''${!outputLib}/lib/\\\$soname"
'' ''
+ ( + (
if targetPlatform != hostPlatform || stdenv.cc.libc != null then lib.optionalString (targetPlatform != hostPlatform || stdenv.cc.libc != null)
# On NixOS, use the right path to the dynamic linker instead of # On NixOS, use the right path to the dynamic linker instead of
# `/lib/ld*.so'. # `/lib/ld*.so'.
let (let
libc = if libcCross != null then libcCross else stdenv.cc.libc; libc = if libcCross != null then libcCross else stdenv.cc.libc;
in in
( (
@ -193,8 +193,8 @@ stdenv.mkDerivation ({
'' ''
sed -i gcc/config/linux.h -e '1i#undef LOCAL_INCLUDE_DIR' sed -i gcc/config/linux.h -e '1i#undef LOCAL_INCLUDE_DIR'
'' ''
))
) )
else "")
+ lib.optionalString targetPlatform.isAvr '' + lib.optionalString targetPlatform.isAvr ''
makeFlagsArray+=( makeFlagsArray+=(
'LIMITS_H_TEST=false' 'LIMITS_H_TEST=false'

View file

@ -186,10 +186,10 @@ stdenv.mkDerivation ({
--replace "-install_name \\\$rpath/\\\$soname" "-install_name ''${!outputLib}/lib/\\\$soname" --replace "-install_name \\\$rpath/\\\$soname" "-install_name ''${!outputLib}/lib/\\\$soname"
'' ''
+ ( + (
if targetPlatform != hostPlatform || stdenv.cc.libc != null then lib.optionalString (targetPlatform != hostPlatform || stdenv.cc.libc != null)
# On NixOS, use the right path to the dynamic linker instead of # On NixOS, use the right path to the dynamic linker instead of
# `/lib/ld*.so'. # `/lib/ld*.so'.
let (let
libc = if libcCross != null then libcCross else stdenv.cc.libc; libc = if libcCross != null then libcCross else stdenv.cc.libc;
in in
( (
@ -207,8 +207,8 @@ stdenv.mkDerivation ({
'' ''
sed -i gcc/config/linux.h -e '1i#undef LOCAL_INCLUDE_DIR' sed -i gcc/config/linux.h -e '1i#undef LOCAL_INCLUDE_DIR'
'' ''
))
) )
else "")
+ lib.optionalString targetPlatform.isAvr '' + lib.optionalString targetPlatform.isAvr ''
makeFlagsArray+=( makeFlagsArray+=(
'LIMITS_H_TEST=false' 'LIMITS_H_TEST=false'

View file

@ -155,12 +155,12 @@ stdenv.mkDerivation rec {
${lib.optionalString (!(GOHOSTARCH == GOARCH && GOOS == GOHOSTOS)) '' ${lib.optionalString (!(GOHOSTARCH == GOARCH && GOOS == GOHOSTOS)) ''
rm -rf pkg/${GOHOSTOS}_${GOHOSTARCH} pkg/tool/${GOHOSTOS}_${GOHOSTARCH} rm -rf pkg/${GOHOSTOS}_${GOHOSTARCH} pkg/tool/${GOHOSTOS}_${GOHOSTARCH}
''} ''}
'' else if (stdenv.hostPlatform != stdenv.targetPlatform) then '' '' else lib.optionalString (stdenv.hostPlatform != stdenv.targetPlatform) ''
rm -rf bin/*_* rm -rf bin/*_*
${lib.optionalString (!(GOHOSTARCH == GOARCH && GOOS == GOHOSTOS)) '' ${lib.optionalString (!(GOHOSTARCH == GOARCH && GOOS == GOHOSTOS)) ''
rm -rf pkg/${GOOS}_${GOARCH} pkg/tool/${GOOS}_${GOARCH} rm -rf pkg/${GOOS}_${GOARCH} pkg/tool/${GOOS}_${GOARCH}
''} ''}
'' else ""); '');
installPhase = '' installPhase = ''
runHook preInstall runHook preInstall

View file

@ -155,12 +155,12 @@ stdenv.mkDerivation rec {
${lib.optionalString (!(GOHOSTARCH == GOARCH && GOOS == GOHOSTOS)) '' ${lib.optionalString (!(GOHOSTARCH == GOARCH && GOOS == GOHOSTOS)) ''
rm -rf pkg/${GOHOSTOS}_${GOHOSTARCH} pkg/tool/${GOHOSTOS}_${GOHOSTARCH} rm -rf pkg/${GOHOSTOS}_${GOHOSTARCH} pkg/tool/${GOHOSTOS}_${GOHOSTARCH}
''} ''}
'' else if (stdenv.hostPlatform != stdenv.targetPlatform) then '' '' else lib.optionalString (stdenv.hostPlatform != stdenv.targetPlatform) ''
rm -rf bin/*_* rm -rf bin/*_*
${lib.optionalString (!(GOHOSTARCH == GOARCH && GOOS == GOHOSTOS)) '' ${lib.optionalString (!(GOHOSTARCH == GOARCH && GOOS == GOHOSTOS)) ''
rm -rf pkg/${GOOS}_${GOARCH} pkg/tool/${GOOS}_${GOARCH} rm -rf pkg/${GOOS}_${GOARCH} pkg/tool/${GOOS}_${GOARCH}
''} ''}
'' else ""); '');
installPhase = '' installPhase = ''
runHook preInstall runHook preInstall

View file

@ -147,12 +147,12 @@ stdenv.mkDerivation rec {
${lib.optionalString (!(GOHOSTARCH == GOARCH && GOOS == GOHOSTOS)) '' ${lib.optionalString (!(GOHOSTARCH == GOARCH && GOOS == GOHOSTOS)) ''
rm -rf pkg/${GOHOSTOS}_${GOHOSTARCH} pkg/tool/${GOHOSTOS}_${GOHOSTARCH} rm -rf pkg/${GOHOSTOS}_${GOHOSTARCH} pkg/tool/${GOHOSTOS}_${GOHOSTARCH}
''} ''}
'' else if (stdenv.hostPlatform != stdenv.targetPlatform) then '' '' else lib.optionalString (stdenv.hostPlatform != stdenv.targetPlatform) ''
rm -rf bin/*_* rm -rf bin/*_*
${lib.optionalString (!(GOHOSTARCH == GOARCH && GOOS == GOHOSTOS)) '' ${lib.optionalString (!(GOHOSTARCH == GOARCH && GOOS == GOHOSTOS)) ''
rm -rf pkg/${GOOS}_${GOARCH} pkg/tool/${GOOS}_${GOARCH} rm -rf pkg/${GOOS}_${GOARCH} pkg/tool/${GOOS}_${GOARCH}
''} ''}
'' else ""); '');
installPhase = '' installPhase = ''
runHook preInstall runHook preInstall

View file

@ -79,8 +79,8 @@ openjdk17.overrideAttrs (oldAttrs: rec {
installPhase = let installPhase = let
buildType = if debugBuild then "fastdebug" else "release"; buildType = if debugBuild then "fastdebug" else "release";
debugSuffix = if debugBuild then "-fastdebug" else ""; debugSuffix = lib.optionalString debugBuild "-fastdebug";
jcefSuffix = if debugBuild then "" else "_jcef"; jcefSuffix = lib.optionalString (!debugBuild) "_jcef";
in '' in ''
runHook preInstall runHook preInstall

View file

@ -1,10 +1,7 @@
{ runCommand, stdenv, llvm, lld, version }: { lib, runCommand, stdenv, llvm, lld, version }:
let let
prefix = prefix = lib.optionalString (stdenv.hostPlatform != stdenv.targetPlatform) "${stdenv.targetPlatform.config}-";
if stdenv.hostPlatform != stdenv.targetPlatform
then "${stdenv.targetPlatform.config}-"
else "";
in runCommand "llvm-binutils-${version}" { in runCommand "llvm-binutils-${version}" {
preferLocalBuild = true; preferLocalBuild = true;
passthru = { passthru = {

View file

@ -1,10 +1,7 @@
{ runCommand, stdenv, llvm, lld, version }: { lib, runCommand, stdenv, llvm, lld, version }:
let let
prefix = prefix = lib.optionalString (stdenv.hostPlatform != stdenv.targetPlatform) "${stdenv.targetPlatform.config}-";
if stdenv.hostPlatform != stdenv.targetPlatform
then "${stdenv.targetPlatform.config}-"
else "";
in runCommand "llvm-binutils-${version}" { in runCommand "llvm-binutils-${version}" {
preferLocalBuild = true; preferLocalBuild = true;
passthru = { passthru = {

View file

@ -1,10 +1,7 @@
{ runCommand, stdenv, llvm, lld, version }: { lib, runCommand, stdenv, llvm, lld, version }:
let let
prefix = prefix = lib.optionalString (stdenv.hostPlatform != stdenv.targetPlatform) "${stdenv.targetPlatform.config}-";
if stdenv.hostPlatform != stdenv.targetPlatform
then "${stdenv.targetPlatform.config}-"
else "";
in runCommand "llvm-binutils-${version}" { in runCommand "llvm-binutils-${version}" {
preferLocalBuild = true; preferLocalBuild = true;
passthru = { passthru = {

View file

@ -1,10 +1,7 @@
{ runCommand, stdenv, llvm, lld, version }: { lib, runCommand, stdenv, llvm, lld, version }:
let let
prefix = prefix = lib.optionalString (stdenv.hostPlatform != stdenv.targetPlatform) "${stdenv.targetPlatform.config}-";
if stdenv.hostPlatform != stdenv.targetPlatform
then "${stdenv.targetPlatform.config}-"
else "";
in runCommand "llvm-binutils-${version}" { in runCommand "llvm-binutils-${version}" {
preferLocalBuild = true; preferLocalBuild = true;
passthru = { passthru = {

View file

@ -1,10 +1,7 @@
{ runCommand, stdenv, llvm, lld, version }: { lib, runCommand, stdenv, llvm, lld, version }:
let let
prefix = prefix = lib.optionalString (stdenv.hostPlatform != stdenv.targetPlatform) "${stdenv.targetPlatform.config}-";
if stdenv.hostPlatform != stdenv.targetPlatform
then "${stdenv.targetPlatform.config}-"
else "";
in runCommand "llvm-binutils-${version}" { in runCommand "llvm-binutils-${version}" {
preferLocalBuild = true; preferLocalBuild = true;
passthru = { passthru = {

View file

@ -1,10 +1,7 @@
{ runCommand, stdenv, llvm, lld, version }: { lib, runCommand, stdenv, llvm, lld, version }:
let let
prefix = prefix = lib.optionalString (stdenv.hostPlatform != stdenv.targetPlatform) "${stdenv.targetPlatform.config}-";
if stdenv.hostPlatform != stdenv.targetPlatform
then "${stdenv.targetPlatform.config}-"
else "";
in runCommand "llvm-binutils-${version}" { in runCommand "llvm-binutils-${version}" {
preferLocalBuild = true; preferLocalBuild = true;
passthru = { passthru = {

View file

@ -1,10 +1,7 @@
{ runCommand, stdenv, llvm, lld, version }: { lib, runCommand, stdenv, llvm, lld, version }:
let let
prefix = prefix = lib.optionalString (stdenv.hostPlatform != stdenv.targetPlatform) "${stdenv.targetPlatform.config}-";
if stdenv.hostPlatform != stdenv.targetPlatform
then "${stdenv.targetPlatform.config}-"
else "";
in runCommand "llvm-binutils-${version}" { in runCommand "llvm-binutils-${version}" {
preferLocalBuild = true; preferLocalBuild = true;
passthru = { passthru = {

View file

@ -1,10 +1,7 @@
{ runCommand, stdenv, llvm, lld, version }: { lib, runCommand, stdenv, llvm, lld, version }:
let let
prefix = prefix = lib.optionalString (stdenv.hostPlatform != stdenv.targetPlatform) "${stdenv.targetPlatform.config}-";
if stdenv.hostPlatform != stdenv.targetPlatform
then "${stdenv.targetPlatform.config}-"
else "";
in runCommand "llvm-binutils-${version}" { in runCommand "llvm-binutils-${version}" {
preferLocalBuild = true; preferLocalBuild = true;
passthru = { passthru = {

View file

@ -1,10 +1,7 @@
{ runCommand, stdenv, llvm, lld, version }: { lib, runCommand, stdenv, llvm, lld, version }:
let let
prefix = prefix = lib.optionalString (stdenv.hostPlatform != stdenv.targetPlatform) "${stdenv.targetPlatform.config}-";
if stdenv.hostPlatform != stdenv.targetPlatform
then "${stdenv.targetPlatform.config}-"
else "";
in runCommand "llvm-binutils-${version}" { in runCommand "llvm-binutils-${version}" {
preferLocalBuild = true; preferLocalBuild = true;
passthru = { passthru = {

View file

@ -1,10 +1,7 @@
{ runCommand, stdenv, llvm, lld, version }: { runCommand, stdenv, llvm, lld, version }:
let let
prefix = prefix = lib.optionalString (stdenv.hostPlatform != stdenv.targetPlatform) "${stdenv.targetPlatform.config}-";
if stdenv.hostPlatform != stdenv.targetPlatform
then "${stdenv.targetPlatform.config}-"
else "";
in runCommand "llvm-binutils-${version}" { in runCommand "llvm-binutils-${version}" {
preferLocalBuild = true; preferLocalBuild = true;
passthru = { passthru = {

View file

@ -188,7 +188,7 @@ stdenv.mkDerivation rec {
lib.concatStringsSep " " lib.concatStringsSep " "
(builtins.map (x: "--with-${x}") enableFeatures ++ (builtins.map (x: "--with-${x}") enableFeatures ++
builtins.map (x: "--without-${x}") disableFeatures) builtins.map (x: "--without-${x}") disableFeatures)
} ${if stdenv.hostPlatform.system == "aarch64-darwin" then "--arch=arm64" else ""} } ${lib.optionalString (stdenv.hostPlatform.system == "aarch64-darwin") "--arch=arm64"}
(cd doc/manual ; make info) (cd doc/manual ; make info)
runHook postBuild runHook postBuild

View file

@ -96,7 +96,7 @@ let
for i in ./scripts/*.sh ./scripts/*.py ./test/*.sh ./test/*.py; do for i in ./scripts/*.sh ./scripts/*.py ./test/*.sh ./test/*.py; do
patchShebangs "$i" patchShebangs "$i"
done done
TERM=xterm ./scripts/tests.sh ${if z3Support then "--no-smt" else ""} TERM=xterm ./scripts/tests.sh ${lib.optionalString z3Support "--no-smt"}
popd popd
''; '';

View file

@ -16,8 +16,7 @@ stdenv.mkDerivation (swift._wrapperParams // {
swiftOs swiftArch swiftOs swiftArch
swiftModuleSubdir swiftLibSubdir swiftModuleSubdir swiftLibSubdir
swiftStaticModuleSubdir swiftStaticLibSubdir; swiftStaticModuleSubdir swiftStaticLibSubdir;
swiftDriver = if useSwiftDriver swiftDriver = lib.optionalString useSwiftDriver "${swift-driver}/bin/swift-driver";
then "${swift-driver}/bin/swift-driver" else "";
passAsFile = [ "buildCommand" ]; passAsFile = [ "buildCommand" ];
buildCommand = '' buildCommand = ''

View file

@ -254,7 +254,7 @@ in package-set { inherit pkgs lib callPackage; } self // {
# a cabal flag with '--flag=myflag'. # a cabal flag with '--flag=myflag'.
developPackage = developPackage =
{ root { root
, name ? if builtins.typeOf root == "path" then builtins.baseNameOf root else "" , name ? lib.optionalString (builtins.typeOf root == "path") (builtins.baseNameOf root)
, source-overrides ? {} , source-overrides ? {}
, overrides ? self: super: {} , overrides ? self: super: {}
, modifier ? drv: drv , modifier ? drv: drv

View file

@ -10,9 +10,8 @@ let
let let
version = pkg.version or ""; version = pkg.version or "";
in in
if isPvpVersion version then lib.optionalString (isPvpVersion version)
''"${name}","${version}","http://hydra.nixos.org/job/nixpkgs/trunk/haskellPackages.${name}.x86_64-linux"'' ''"${name}","${version}","http://hydra.nixos.org/job/nixpkgs/trunk/haskellPackages.${name}.x86_64-linux"'';
else "";
all-haskellPackages = builtins.toFile "all-haskellPackages" (lib.concatStringsSep "\n" (lib.filter (x: x != "") (lib.mapAttrsToList pkgLine haskellPackages))); all-haskellPackages = builtins.toFile "all-haskellPackages" (lib.concatStringsSep "\n" (lib.filter (x: x != "") (lib.mapAttrsToList pkgLine haskellPackages)));
in in
runCommand "hackage-package-list" { } runCommand "hackage-package-list" { }

View file

@ -19,7 +19,7 @@ lib.makePackageOverridable
name = "dhall-directory-package.nix"; name = "dhall-directory-package.nix";
buildCommand = '' buildCommand = ''
dhall-to-nixpkgs directory --fixed-output-derivations --file "${file}" "${src}" ${if document then "--document" else ""} > $out dhall-to-nixpkgs directory --fixed-output-derivations --file "${file}" "${src}" ${lib.optionalString document "--document"} > $out
''; '';
nativeBuildInputs = [ dhall-nixpkgs ]; nativeBuildInputs = [ dhall-nixpkgs ];

View file

@ -186,7 +186,7 @@ let
NIX_LDFLAGS = lib.optionalString stdenv.isDarwin "-lobjc"; NIX_LDFLAGS = lib.optionalString stdenv.isDarwin "-lobjc";
# See https://savannah.gnu.org/bugs/?50339 # See https://savannah.gnu.org/bugs/?50339
F77_INTEGER_8_FLAG = if use64BitIdx then "-fdefault-integer-8" else ""; F77_INTEGER_8_FLAG = lib.optionalString use64BitIdx "-fdefault-integer-8";
configureFlags = [ configureFlags = [
"--with-blas=blas" "--with-blas=blas"

View file

@ -26,7 +26,7 @@ let
inherit self sourceVersion pythonVersion packageOverrides; inherit self sourceVersion pythonVersion packageOverrides;
implementation = "pypy"; implementation = "pypy";
libPrefix = "pypy${pythonVersion}"; libPrefix = "pypy${pythonVersion}";
executable = "pypy${if isPy39OrNewer then lib.versions.majorMinor pythonVersion else if isPy3k then "3" else ""}"; executable = "pypy${if isPy39OrNewer then lib.versions.majorMinor pythonVersion else lib.optionalString isPy3k "3"}";
sitePackages = "site-packages"; sitePackages = "site-packages";
hasDistutilsCxxPatch = false; hasDistutilsCxxPatch = false;
inherit pythonAttr; inherit pythonAttr;

View file

@ -32,7 +32,7 @@ let
inherit self sourceVersion pythonVersion packageOverrides; inherit self sourceVersion pythonVersion packageOverrides;
implementation = "pypy"; implementation = "pypy";
libPrefix = "pypy${pythonVersion}"; libPrefix = "pypy${pythonVersion}";
executable = "pypy${if isPy3k then "3" else ""}"; executable = "pypy${lib.optionalString isPy3k "3"}";
sitePackages = "lib/${libPrefix}/site-packages"; sitePackages = "lib/${libPrefix}/site-packages";
hasDistutilsCxxPatch = false; hasDistutilsCxxPatch = false;

View file

@ -32,7 +32,7 @@ let
inherit self sourceVersion pythonVersion packageOverrides; inherit self sourceVersion pythonVersion packageOverrides;
implementation = "pypy"; implementation = "pypy";
libPrefix = "pypy${pythonVersion}"; libPrefix = "pypy${pythonVersion}";
executable = "pypy${if isPy3k then "3" else ""}"; executable = "pypy${lib.optionalString isPy3k "3"}";
sitePackages = "site-packages"; sitePackages = "site-packages";
hasDistutilsCxxPatch = false; hasDistutilsCxxPatch = false;

View file

@ -55,9 +55,9 @@ let
self.majMinTiny + ( self.majMinTiny + (
if self.patchLevel != null then if self.patchLevel != null then
"-p${self.patchLevel}" "-p${self.patchLevel}"
else if self.tail != "" then else
"-${self.tail}" lib.optionalString (self.tail != "") "-${self.tail}"
else ""); );
}; };
in in
rubyVersion rubyVersion

View file

@ -30,7 +30,7 @@ stdenv.mkDerivation rec {
++ lib.optionals stdenv.isDarwin [ CoreServices Security ]; ++ lib.optionals stdenv.isDarwin [ CoreServices Security ];
configurePhase = '' configurePhase = ''
python configure.py --prefix=$out --with-bzip2 --with-zlib ${extraConfigureFlags}${if stdenv.cc.isClang then " --cc=clang" else "" } python configure.py --prefix=$out --with-bzip2 --with-zlib ${extraConfigureFlags}${lib.optionalString stdenv.cc.isClang " --cc=clang"}
''; '';
enableParallelBuilding = true; enableParallelBuilding = true;

View file

@ -50,7 +50,7 @@ stdenv.mkDerivation rec {
preCheck = '' preCheck = ''
${if stdenv.isDarwin then "export DYLD_LIBRARY_PATH=$(pwd)/src/" else "export LD_LIBRARY_PATH=$(pwd)/src/"} ${if stdenv.isDarwin then "export DYLD_LIBRARY_PATH=$(pwd)/src/" else "export LD_LIBRARY_PATH=$(pwd)/src/"}
${if enablePython then "sed -i -e 's|^#!.*|#!${stdenv.shell}|' python/py.test.sh" else ""} ${lib.optionalString enablePython "sed -i -e 's|^#!.*|#!${stdenv.shell}|' python/py.test.sh"}
''; '';
cmakeFlags = lib.optionals enablePython [ cmakeFlags = lib.optionals enablePython [

View file

@ -25,7 +25,7 @@ stdenv.mkDerivation rec {
hardeningDisable = [ "format" ]; hardeningDisable = [ "format" ];
LDFLAGS = if stdenv.isSunOS then "-lm -lmd -lmp -luutil -lnvpair -lnsl -lidmap -lavl -lsec" else ""; LDFLAGS = lib.optionalString stdenv.isSunOS "-lm -lmd -lmp -luutil -lnvpair -lnsl -lidmap -lavl -lsec";
configureFlags = [ configureFlags = [
"--disable-csharp" "--with-xz" "--disable-csharp" "--with-xz"

View file

@ -169,7 +169,7 @@ stdenv.mkDerivation ({
buildInputs = [ linuxHeaders ] ++ lib.optionals withGd [ gd libpng ] ++ extraBuildInputs; buildInputs = [ linuxHeaders ] ++ lib.optionals withGd [ gd libpng ] ++ extraBuildInputs;
env = { env = {
linuxHeaders = if withLinuxHeaders then linuxHeaders else ""; linuxHeaders = lib.optionalString withLinuxHeaders linuxHeaders;
inherit (stdenv) is64bit; inherit (stdenv) is64bit;
# Needed to install share/zoneinfo/zone.tab. Set to impure /bin/sh to # Needed to install share/zoneinfo/zone.tab. Set to impure /bin/sh to
# prevent a retained dependency on the bootstrap tools in the stdenv-linux # prevent a retained dependency on the bootstrap tools in the stdenv-linux

View file

@ -42,7 +42,7 @@ stdenv.mkDerivation rec {
(lib.enableFeature frontendSupport "dynamic-frontends") (lib.enableFeature frontendSupport "dynamic-frontends")
#(enableFeature mp3xSupport "mp3x") #(enableFeature mp3xSupport "mp3x")
(lib.enableFeature mp3rtpSupport "mp3rtp") (lib.enableFeature mp3rtpSupport "mp3rtp")
(if debugSupport then "--enable-debug=alot" else "") (lib.optionalString debugSupport "--enable-debug=alot")
]; ];
preConfigure = '' preConfigure = ''

View file

@ -269,7 +269,7 @@ stdenv.mkDerivation rec {
(cfg "runstatedir" "/run") (cfg "runstatedir" "/run")
(cfg "init_script" (if isDarwin then "none" else "systemd")) (cfg "init_script" (if isDarwin then "none" else "systemd"))
(cfg "qemu_datadir" (if isDarwin then "${qemu}/share/qemu" else "")) (cfg "qemu_datadir" (lib.optionalString isDarwin "${qemu}/share/qemu"))
(feat "apparmor" isLinux) (feat "apparmor" isLinux)
(feat "attr" isLinux) (feat "attr" isLinux)

View file

@ -156,7 +156,7 @@ stdenv.mkDerivation rec {
else if stdenv.hostPlatform.osxMinVersion == "10.5" then "9" else if stdenv.hostPlatform.osxMinVersion == "10.5" then "9"
else "8" else "8"
else ""}-gcc" else ""}-gcc"
(if stdenv.hostPlatform.isCygwin then "--enable-static-msvcrt" else "") (lib.optionalString stdenv.hostPlatform.isCygwin "--enable-static-msvcrt")
] # Experimental features ] # Experimental features
++ optional experimentalSpatialSvcSupport "--enable-spatial-svc" ++ optional experimentalSpatialSvcSupport "--enable-spatial-svc"
++ optional experimentalFpMbStatsSupport "--enable-fp-mb-stats" ++ optional experimentalFpMbStatsSupport "--enable-fp-mb-stats"

View file

@ -165,7 +165,7 @@ stdenv.mkDerivation rec {
experimentalEmulateHardwareSupport) "experimental") experimentalEmulateHardwareSupport) "experimental")
] ++ optionals (stdenv.isBSD || stdenv.hostPlatform != stdenv.buildPlatform) [ ] ++ optionals (stdenv.isBSD || stdenv.hostPlatform != stdenv.buildPlatform) [
"--force-target=${stdenv.hostPlatform.parsed.cpu.name}-${kernel}-gcc" "--force-target=${stdenv.hostPlatform.parsed.cpu.name}-${kernel}-gcc"
(if stdenv.hostPlatform.isCygwin then "--enable-static-msvcrt" else "") (lib.optionalString stdenv.hostPlatform.isCygwin "--enable-static-msvcrt")
] # Experimental features ] # Experimental features
++ optional experimentalSpatialSvcSupport "--enable-spatial-svc" ++ optional experimentalSpatialSvcSupport "--enable-spatial-svc"
++ optional experimentalFpMbStatsSupport "--enable-fp-mb-stats" ++ optional experimentalFpMbStatsSupport "--enable-fp-mb-stats"

View file

@ -21,10 +21,10 @@ stdenv.mkDerivation rec {
preConfigure = '' preConfigure = ''
substituteInPlace src/Makefile.in \ substituteInPlace src/Makefile.in \
--replace "-L\$(subst /libgfortran.a, ,\$(FRTLIB) )" "-L${gfortran.cc.lib}/lib" --replace "-L\$(subst /libgfortran.a, ,\$(FRTLIB) )" "-L${gfortran.cc.lib}/lib"
'' + (if stdenv.isDarwin then '' '' + (lib.optionalString stdenv.isDarwin ''
substituteInPlace src/Makefile.in \ substituteInPlace src/Makefile.in \
--replace "gfortran -print-file-name=libgfortran.a" "gfortran -print-file-name=libgfortran.dylib" --replace "gfortran -print-file-name=libgfortran.a" "gfortran -print-file-name=libgfortran.dylib"
'' else ""); '');
enableParallelBuilding = false; # broken enableParallelBuilding = false; # broken

View file

@ -16,7 +16,7 @@
}: }:
let let
threadingSuffix = if withOpenMP then "-mt" else ""; threadingSuffix = lib.optionalString withOpenMP "-mt";
blasIntSize = if blas64 then "64" else "32"; blasIntSize = if blas64 then "64" else "32";
in stdenv.mkDerivation rec { in stdenv.mkDerivation rec {
pname = "amd-blis"; pname = "amd-blis";

View file

@ -5,7 +5,7 @@
}: }:
let let
dbg = if debugEnable then "-dbg" else ""; dbg = lib.optionalString debugEnable "-dbg";
debugEnable = p4est-sc-debugEnable; debugEnable = p4est-sc-debugEnable;
mpiSupport = p4est-sc-mpiSupport; mpiSupport = p4est-sc-mpiSupport;
isOpenmpi = mpiSupport && mpi.pname == "openmpi"; isOpenmpi = mpiSupport && mpi.pname == "openmpi";
@ -35,7 +35,7 @@ stdenv.mkDerivation {
''; '';
preConfigure = '' preConfigure = ''
echo "2.8.0" > .tarball-version echo "2.8.0" > .tarball-version
${if mpiSupport then "unset CC" else ""} ${lib.optionalString mpiSupport "unset CC"}
''; '';
configureFlags = [ "--enable-pthread=-pthread" ] configureFlags = [ "--enable-pthread=-pthread" ]

View file

@ -9,7 +9,7 @@
let let
inherit (p4est-sc) debugEnable mpiSupport; inherit (p4est-sc) debugEnable mpiSupport;
dbg = if debugEnable then "-dbg" else ""; dbg = lib.optionalString debugEnable "-dbg";
withMetis = p4est-withMetis; withMetis = p4est-withMetis;
in in
stdenv.mkDerivation { stdenv.mkDerivation {

View file

@ -55,11 +55,11 @@ stdenv.mkDerivation rec {
"--with-fc=mpif90" "--with-fc=mpif90"
"--with-mpi=1" "--with-mpi=1"
''} ''}
${if withp4est then '' ${lib.optionalString withp4est ''
"--with-p4est=1" "--with-p4est=1"
"--with-zlib-include=${zlib.dev}/include" "--with-zlib-include=${zlib.dev}/include"
"--with-zlib-lib=-L${zlib}/lib -lz" "--with-zlib-lib=-L${zlib}/lib -lz"
'' else ""} ''}
"--with-blas=1" "--with-blas=1"
"--with-lapack=1" "--with-lapack=1"
) )

View file

@ -19,14 +19,10 @@ stdenv.mkDerivation rec {
# udns uses a very custom build and hardcodes a .so name in a few places. # udns uses a very custom build and hardcodes a .so name in a few places.
# Instead of fighting with it to apply the standard dylib script, change # Instead of fighting with it to apply the standard dylib script, change
# the right place in the Makefile itself. # the right place in the Makefile itself.
postPatch = postPatch = lib.optionalString stdenv.isDarwin ''
if stdenv.isDarwin
then
''
substituteInPlace Makefile.in \ substituteInPlace Makefile.in \
--replace --soname, -install_name,$out/lib/ --replace --soname, -install_name,$out/lib/
'' '';
else "";
installPhase = '' installPhase = ''
runHook preInstall runHook preInstall

View file

@ -167,7 +167,7 @@ stdenv.mkDerivation ({
echo "file binary-dist \"$(ls $out/*.apk)\"" > $out/nix-support/hydra-build-products echo "file binary-dist \"$(ls $out/*.apk)\"" > $out/nix-support/hydra-build-products
'' ''
else if target == "iphone" then else if target == "iphone" then
if release then '' lib.optionalString release ''
mkdir -p $out/nix-support mkdir -p $out/nix-support
echo "file binary-dist \"$(echo $out/*.ipa)\"" > $out/nix-support/hydra-build-products echo "file binary-dist \"$(echo $out/*.ipa)\"" > $out/nix-support/hydra-build-products
@ -180,7 +180,6 @@ stdenv.mkDerivation ({
echo "doc install \"$out/$appname.html\"" >> $out/nix-support/hydra-build-products echo "doc install \"$out/$appname.html\"" >> $out/nix-support/hydra-build-products
''} ''}
'' ''
else ""
else throw "Target: ${target} is not supported!"} else throw "Target: ${target} is not supported!"}
''; '';

View file

@ -103,10 +103,9 @@ stdenv.mkDerivation {
'' ''
patchelf --set-interpreter ${stdenv.cc.libc}/lib/ld-linux.so.2 android/titanium_prep.linux32 patchelf --set-interpreter ${stdenv.cc.libc}/lib/ld-linux.so.2 android/titanium_prep.linux32
'' ''
else if stdenv.system == "x86_64-linux" then else lib.optionalString (stdenv.system == "x86_64-linux") ''
''
patchelf --set-interpreter ${stdenv.cc.libc}/lib/ld-linux-x86-64.so.2 android/titanium_prep.linux64 patchelf --set-interpreter ${stdenv.cc.libc}/lib/ld-linux-x86-64.so.2 android/titanium_prep.linux64
'' ''
else ""} }
''; '';
} }

View file

@ -105,10 +105,9 @@ stdenv.mkDerivation {
'' ''
patchelf --set-interpreter ${stdenv.cc.libc}/lib/ld-linux.so.2 android/titanium_prep.linux32 patchelf --set-interpreter ${stdenv.cc.libc}/lib/ld-linux.so.2 android/titanium_prep.linux32
'' ''
else if stdenv.system == "x86_64-linux" then else lib.optionalString (stdenv.system == "x86_64-linux") ''
''
patchelf --set-interpreter ${stdenv.cc.libc}/lib/ld-linux-x86-64.so.2 android/titanium_prep.linux64 patchelf --set-interpreter ${stdenv.cc.libc}/lib/ld-linux-x86-64.so.2 android/titanium_prep.linux64
'' ''
else ""} }
''; '';
} }

View file

@ -91,7 +91,7 @@ stdenv.mkDerivation ({
# Do the building # Do the building
export LD=/usr/bin/clang # To avoid problem with -isysroot parameter that is unrecognized by the stock ld. Comparison with an impure build shows that it uses clang instead. Ugly, but it works export LD=/usr/bin/clang # To avoid problem with -isysroot parameter that is unrecognized by the stock ld. Comparison with an impure build shows that it uses clang instead. Ugly, but it works
xcodebuild -target ${_target} -configuration ${_configuration} ${lib.optionalString (scheme != null) "-scheme ${scheme}"} -sdk ${_sdk} TARGETED_DEVICE_FAMILY="1, 2" ONLY_ACTIVE_ARCH=NO CONFIGURATION_TEMP_DIR=$TMPDIR CONFIGURATION_BUILD_DIR=$out ${if generateIPA || generateXCArchive then "-archivePath \"${name}.xcarchive\" archive" else ""} ${if release then '' PROVISIONING_PROFILE=$PROVISIONING_PROFILE OTHER_CODE_SIGN_FLAGS="--keychain $HOME/Library/Keychains/$keychainName-db"'' else ""} ${xcodeFlags} xcodebuild -target ${_target} -configuration ${_configuration} ${lib.optionalString (scheme != null) "-scheme ${scheme}"} -sdk ${_sdk} TARGETED_DEVICE_FAMILY="1, 2" ONLY_ACTIVE_ARCH=NO CONFIGURATION_TEMP_DIR=$TMPDIR CONFIGURATION_BUILD_DIR=$out ${lib.optionalString (generateIPA || generateXCArchive) "-archivePath \"${name}.xcarchive\" archive"} ${lib.optionalString release '' PROVISIONING_PROFILE=$PROVISIONING_PROFILE OTHER_CODE_SIGN_FLAGS="--keychain $HOME/Library/Keychains/$keychainName-db"''} ${xcodeFlags}
${lib.optionalString release '' ${lib.optionalString release ''
${lib.optionalString generateIPA '' ${lib.optionalString generateIPA ''

View file

@ -268,11 +268,7 @@ final: prev: {
nativeBuildInputs = [ pkgs.buildPackages.makeWrapper ]; nativeBuildInputs = [ pkgs.buildPackages.makeWrapper ];
postFixup = '' postFixup = ''
wrapProgram "$out/bin/makam" --prefix PATH : ${lib.makeBinPath [ nodejs ]} wrapProgram "$out/bin/makam" --prefix PATH : ${lib.makeBinPath [ nodejs ]}
${ ${lib.optionalString stdenv.isLinux "patchelf --set-interpreter ${stdenv.cc.libc}/lib/ld-linux-x86-64.so.2 \"$out/lib/node_modules/makam/makam-bin-linux64\""}
if stdenv.isLinux
then "patchelf --set-interpreter ${stdenv.cc.libc}/lib/ld-linux-x86-64.so.2 \"$out/lib/node_modules/makam/makam-bin-linux64\""
else ""
}
''; '';
}; };

View file

@ -46,7 +46,7 @@ in buildPythonPackage rec {
${lib.optionalString mpiSupport "export OMPI_MCA_rmaps_base_oversubscribe=yes"} ${lib.optionalString mpiSupport "export OMPI_MCA_rmaps_base_oversubscribe=yes"}
''; '';
preBuild = if mpiSupport then "export CC=${mpi}/bin/mpicc" else ""; preBuild = lib.optionalString mpiSupport "export CC=${mpi}/bin/mpicc";
nativeBuildInputs = [ nativeBuildInputs = [
cython cython

View file

@ -70,10 +70,10 @@ buildPythonPackage rec {
typing typing
]; ];
configurePhase = if !(pythonOlder "3.5") then '' configurePhase = lib.optionalString (! pythonOlder "3.5") ''
substituteInPlace setup.py \ substituteInPlace setup.py \
--replace "'typing'," "" --replace "'typing'," ""
'' else ""; '';
checkPhase = '' checkPhase = ''
pytest --ignore tests/test_cli.py \ pytest --ignore tests/test_cli.py \

View file

@ -75,7 +75,7 @@ let
tfFeature = x: if x then "1" else "0"; tfFeature = x: if x then "1" else "0";
version = "2.11.0"; version = "2.11.0";
variant = if cudaSupport then "-gpu" else ""; variant = lib.optionalString cudaSupport "-gpu";
pname = "tensorflow${variant}"; pname = "tensorflow${variant}";
pythonEnv = python.withPackages (_: pythonEnv = python.withPackages (_:

View file

@ -66,9 +66,8 @@ let
name; name;
copyIfBundledByPath = { bundledByPath ? false, ...}: copyIfBundledByPath = { bundledByPath ? false, ...}:
(if bundledByPath then (lib.optionalString bundledByPath (
assert gemFiles.gemdir != null; "cp -a ${gemFiles.gemdir}/* $out/" #*/ assert gemFiles.gemdir != null; "cp -a ${gemFiles.gemdir}/* $out/") #*/
else ""
); );
maybeCopyAll = pkgname: if pkgname == null then "" else maybeCopyAll = pkgname: if pkgname == null then "" else

View file

@ -27,10 +27,10 @@ let
CXXFLAGS="-O2 -fno-strict-aliasing" CXXFLAGS="-O2 -fno-strict-aliasing"
--mandir=$out/share/man --mandir=$out/share/man
${if sysconfDir == "" then "" else "--sysconfdir=${sysconfDir}"} ${if sysconfDir == "" then "" else "--sysconfdir=${sysconfDir}"}
${if static then "LDFLAGS=-static" else ""} ${lib.optionalString static "LDFLAGS=-static"}
--with${if static == true || popt == null then "" else "out"}-included-popt ${lib.withFeature (static == true || popt == null) "included-popt"}
--with${if avahi != null then "" else "out"}-avahi ${lib.withFeature (avahi != null) "avahi"}
--with${if gtk3 != null then "" else "out"}-gtk ${lib.withFeature (gtk3 != null) "gtk"}
--without-gnome --without-gnome
--enable-rfc2553 --enable-rfc2553
--disable-Werror # a must on gcc 4.6 --disable-Werror # a must on gcc 4.6

View file

@ -151,7 +151,7 @@ let
(builtins.filter (builtins.filter
({ prefix, path }: "NETRC" == prefix) ({ prefix, path }: "NETRC" == prefix)
builtins.nixPath); builtins.nixPath);
netrc_file = if (pathParts != [ ]) then (builtins.head pathParts).path else ""; netrc_file = lib.optionalString (pathParts != [ ]) (builtins.head pathParts).path;
in in
pkgs.runCommand file pkgs.runCommand file
{ {

View file

@ -457,9 +457,9 @@ lib.composeManyExtensions [
preConfigure = lib.concatStringsSep "\n" [ preConfigure = lib.concatStringsSep "\n" [
(old.preConfigure or "") (old.preConfigure or "")
(if (lib.versionAtLeast stdenv.hostPlatform.darwinMinVersion "11" && stdenv.isDarwin) then '' (lib.optionalString (lib.versionAtLeast stdenv.hostPlatform.darwinMinVersion "11" && stdenv.isDarwin) ''
MACOSX_DEPLOYMENT_TARGET=10.16 MACOSX_DEPLOYMENT_TARGET=10.16
'' else "") '')
]; ];
preBuild = old.preBuild or "" + '' preBuild = old.preBuild or "" + ''
@ -720,7 +720,7 @@ lib.composeManyExtensions [
(old.propagatedBuildInputs or [ ]) (old.propagatedBuildInputs or [ ])
++ lib.optionals mpiSupport [ self.mpi4py self.openssh ] ++ lib.optionals mpiSupport [ self.mpi4py self.openssh ]
; ;
preBuild = if mpiSupport then "export CC=${mpi}/bin/mpicc" else ""; preBuild = lib.optionalString mpiSupport "export CC=${mpi}/bin/mpicc";
HDF5_DIR = "${pkgs.hdf5}"; HDF5_DIR = "${pkgs.hdf5}";
HDF5_MPI = if mpiSupport then "ON" else "OFF"; HDF5_MPI = if mpiSupport then "ON" else "OFF";
# avoid strict pinning of numpy # avoid strict pinning of numpy

View file

@ -202,7 +202,7 @@ let
--run "$out/share/factorio/update-config.sh" \ --run "$out/share/factorio/update-config.sh" \
--argv0 "" \ --argv0 "" \
--add-flags "-c \$HOME/.factorio/config.cfg" \ --add-flags "-c \$HOME/.factorio/config.cfg" \
${if mods!=[] then "--add-flags --mod-directory=${modDir}" else ""} ${lib.optionalString (mods!=[]) "--add-flags --mod-directory=${modDir}"}
# TODO Currently, every time a mod is changed/added/removed using the # TODO Currently, every time a mod is changed/added/removed using the
# modlist, a new derivation will take up the entire footprint of the # modlist, a new derivation will take up the entire footprint of the

View file

@ -14,8 +14,7 @@ stdenv.mkDerivation {
fetchurl { inherit url sha256; }; fetchurl { inherit url sha256; };
shell = stdenv.shell; shell = stdenv.shell;
arch = if stdenv.hostPlatform.system == "x86_64-linux" then "x64" arch = if stdenv.hostPlatform.system == "x86_64-linux" then "x64"
else if stdenv.hostPlatform.system == "i686-linux" then "x86" else lib.optionalString (stdenv.hostPlatform.system == "i686-linux") "x86";
else "";
unpackPhase = '' unpackPhase = ''
mkdir oilrush mkdir oilrush
cd oilrush cd oilrush

View file

@ -27,7 +27,7 @@ stdenv.mkDerivation rec {
wrapGAppsHook wrapGAppsHook
]; ];
NIX_CFLAGS_COMPILE = if isMobile then "-DSTYLUS_BASED" else ""; NIX_CFLAGS_COMPILE = lib.optionalString isMobile "-DSTYLUS_BASED";
buildInputs = [ gtk3 libX11 ]; buildInputs = [ gtk3 libX11 ];

View file

@ -23,7 +23,7 @@
# to see what will break when upgrading. Consider a new versioned attribute. # to see what will break when upgrading. Consider a new versioned attribute.
let let
installationPath = if stdenv.hostPlatform.system == "x86_64-linux" then "x86_64" else "i386"; installationPath = if stdenv.hostPlatform.system == "x86_64-linux" then "x86_64" else "i386";
appendPath = if stdenv.hostPlatform.system == "x86_64-linux" then "64" else ""; appendPath = lib.optionalString (stdenv.hostPlatform.system == "x86_64-linux") "64";
libPath = lib.makeLibraryPath [ cups libusb-compat-0_1 ] + ":$out/lib:${stdenv.cc.cc.lib}/lib${appendPath}"; libPath = lib.makeLibraryPath [ cups libusb-compat-0_1 ] + ":$out/lib:${stdenv.cc.cc.lib}/lib${appendPath}";
in stdenv.mkDerivation rec { in stdenv.mkDerivation rec {
pname = "samsung-UnifiedLinuxDriver"; pname = "samsung-UnifiedLinuxDriver";

Some files were not shown because too many files have changed in this diff Show more