3
0
Fork 0
forked from mirrors/nixpkgs

treewide: ensure pre/post phase hooks are strings

Some derivations use lib.optional or lib.optionals when setting pre/post
phase hooks. Ensure the proper lib.optionalString is used.
This commit is contained in:
Sebastián Mancilla 2021-08-17 20:14:20 -04:00
parent 1d87f9866c
commit 8f94a33b38
34 changed files with 46 additions and 46 deletions

View file

@ -122,7 +122,7 @@ ImageExifTool = buildPerlPackage {
};
buildInputs = lib.optional stdenv.isDarwin shortenPerlShebang;
postInstall = lib.optional stdenv.isDarwin ''
postInstall = lib.optionalString stdenv.isDarwin ''
shortenPerlShebang $out/bin/exiftool
'';
};

View file

@ -91,7 +91,7 @@ in stdenv.mkDerivation rec {
# When building with zest GUI, patch plugins
# and standalone executable to properly locate zest
postFixup = lib.optional (guiModule == "zest") ''
postFixup = lib.optionalString (guiModule == "zest") ''
patchelf --set-rpath "${mruby-zest}:$(patchelf --print-rpath "$out/lib/lv2/ZynAddSubFX.lv2/ZynAddSubFX_ui.so")" \
"$out/lib/lv2/ZynAddSubFX.lv2/ZynAddSubFX_ui.so"

View file

@ -53,7 +53,7 @@ stdenv.mkDerivation rec {
++ optionals withWallet [ db48 sqlite ]
++ optionals withGui [ qrencode qtbase qttools ];
postInstall = optional withGui ''
postInstall = optionalString withGui ''
install -Dm644 ${desktop} $out/share/applications/bitcoin-qt.desktop
substituteInPlace $out/share/applications/bitcoin-qt.desktop --replace "Icon=bitcoin128" "Icon=bitcoin"
install -Dm644 share/pixmaps/bitcoin256.png $out/share/pixmaps/bitcoin.png

View file

@ -29,7 +29,7 @@ rustPlatform.buildRustPackage rec {
# FIXME: GLFW (X11) requires DISPLAY env variable for all tests
doCheck = false;
postInstall = optional stdenv.isLinux ''
postInstall = optionalString stdenv.isLinux ''
mkdir -p $out/share/applications
cp $src/rx.desktop $out/share/applications
wrapProgram $out/bin/rx --prefix LD_LIBRARY_PATH : ${libGL}/lib

View file

@ -78,7 +78,7 @@ stdenv.mkDerivation rec {
"-Dman-pages=enabled"
];
preFixup = lib.optional withMediaPlayer ''
preFixup = lib.optionalString withMediaPlayer ''
cp $src/resources/custom_modules/mediaplayer.py $out/bin/waybar-mediaplayer.py
wrapProgram $out/bin/waybar-mediaplayer.py \

View file

@ -10,7 +10,7 @@ stdenv.mkDerivation rec {
buildInputs = [ libX11 ];
preConfigure = [ ''sed -i "s@PREFIX = /usr/local@PREFIX = $out@g" config.mk'' ];
preConfigure = ''sed -i "s@PREFIX = /usr/local@PREFIX = $out@g" config.mk'';
meta = {
description = "Prints or set the window manager name property of the root window";

View file

@ -104,7 +104,7 @@ let
server = source: generic {
type = "murmur";
postPatch = lib.optional iceSupport ''
postPatch = lib.optionalString iceSupport ''
grep -Rl '/usr/share/Ice' . | xargs sed -i 's,/usr/share/Ice/,${zeroc-ice.dev}/share/ice/,g'
'';

View file

@ -60,13 +60,13 @@ stdenv.mkDerivation rec {
else ["--without-mpi"]);
postInstall = lib.optionals (python != null) [ ''
postInstall = lib.optionalString (python != null) ''
## standardise python neuron install dir if any
if [[ -d $out/lib/python ]]; then
mkdir -p ''${out}/${python.sitePackages}
mv ''${out}/lib/python/* ''${out}/${python.sitePackages}/
fi
''];
'';
propagatedBuildInputs = [ readline ncurses which libtool ];

View file

@ -64,7 +64,7 @@ assert lib.assertMsg (!(sanitizeAddress && sanitizeThreads))
"'sanitizeAddress' and 'sanitizeThreads' are mutually exclusive, use one.";
let
inherit (lib) optional optionals;
inherit (lib) optional optionals optionalString;
in
stdenv.mkDerivation rec {
pname = "kicad-base";
@ -172,7 +172,7 @@ stdenv.mkDerivation rec {
dontStrip = debug;
postInstall = optional (withI18n) ''
postInstall = optionalString (withI18n) ''
mkdir -p $out/share
lndir ${i18n}/share $out/share
'';

View file

@ -9,7 +9,7 @@ stdenv.mkDerivation rec {
sha256 = "1iwa17s8ipj6a2b8zss5csb1k5y9s5js38syvq932rxcinbyjsl4";
};
postPatch = lib.optional (stdenv.hostPlatform.libc == "glibc") ''
postPatch = lib.optionalString (stdenv.hostPlatform.libc == "glibc") ''
sed -ie '/sys\/sysctl.h/d' ATOOLS/Org/Run_Parameter.C
'';

View file

@ -31,7 +31,7 @@ buildPythonApplication rec {
];
doCheck = true;
preCheck = lib.optional stdenv.isDarwin ''
preCheck = lib.optionalString stdenv.isDarwin ''
export DYLD_FRAMEWORK_PATH=/System/Library/Frameworks
'';

View file

@ -69,7 +69,7 @@ let
# so that it can be used to regenerate documentation.
patches = lib.optionals disableGraphviz [ graphvizPatch ./gvc-compat.patch ];
configureFlags = lib.optional disableGraphviz "--disable-graphviz";
preBuild = lib.optional disableGraphviz "buildFlagsArray+=(\"VALAC=$(pwd)/compiler/valac\")";
preBuild = lib.optionalString disableGraphviz "buildFlagsArray+=(\"VALAC=$(pwd)/compiler/valac\")";
outputs = [ "out" "devdoc" ];

View file

@ -20,7 +20,7 @@ callPackage ./generic.nix {
})
];
preConfigure = lib.optional stdenv.buildPlatform.isDarwin ''
preConfigure = lib.optionalString stdenv.buildPlatform.isDarwin ''
rm BUILD
'';
}

View file

@ -13,7 +13,7 @@
let
gtk = if withGtk3 then gtk3 else gtk2;
inherit (lib) optional;
inherit (lib) optional optionalString;
in
stdenv.mkDerivation rec {
pname = if extraOnly
@ -37,7 +37,7 @@ stdenv.mkDerivation rec {
installFlags = [ "sysconfdir=${placeholder "out"}/etc" ];
# libfm-extra is pulled in by menu-cache and thus leads to a collision for libfm
postInstall = optional (!extraOnly) ''
postInstall = optionalString (!extraOnly) ''
rm $out/lib/libfm-extra.so $out/lib/libfm-extra.so.* $out/lib/libfm-extra.la $out/lib/pkgconfig/libfm-extra.pc
'';

View file

@ -28,7 +28,7 @@ stdenv.mkDerivation rec {
strictDeps = true;
postConfigure = lib.optionals enableThreading ''
postConfigure = lib.optionalString enableThreading ''
perl scripts/config.pl set MBEDTLS_THREADING_C # Threading abstraction layer
perl scripts/config.pl set MBEDTLS_THREADING_PTHREAD # POSIX thread wrapper layer for the threading layer.
'';

View file

@ -28,7 +28,7 @@ stdenv.mkDerivation rec {
# Remove a test that fails to statically link (undefined reference to png and
# freetype symbols)
postConfigure = lib.optionals static ''
postConfigure = lib.optionalString static ''
sed -e '/freetype freetype.c/d' -i ../tests/examples/CMakeLists.txt
'';

View file

@ -28,7 +28,7 @@ stdenv.mkDerivation {
buildInputs = [ libX11 libXaw ];
buildFlags = [ "without_doc" ];
postInstall = lib.optional (!stdenv.isDarwin) "chmod +x $out/lib/*.so.*"; # ??
postInstall = lib.optionalString (!stdenv.isDarwin) "chmod +x $out/lib/*.so.*"; # ??
meta = with lib; {
description = "A type 1 font rasterizer library for UNIX/X11";

View file

@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
sourceRoot=$sourceRoot/cpp
'';
prePatch = lib.optional stdenv.isDarwin ''
prePatch = lib.optionalString stdenv.isDarwin ''
substituteInPlace config/Make.rules.Darwin \
--replace xcrun ""
'';

View file

@ -35,7 +35,7 @@ in stdenv.mkDerivation rec {
NIX_CFLAGS_COMPILE = "-Wno-error=class-memaccess -Wno-error=deprecated-copy";
prePatch = lib.optional stdenv.isDarwin ''
prePatch = lib.optionalString stdenv.isDarwin ''
substituteInPlace Make.rules.Darwin \
--replace xcrun ""
'';

View file

@ -15,7 +15,7 @@ buildPythonPackage rec {
LC_ALL="en_US.UTF-8";
postPatch = lib.optional stdenv.isDarwin ''
postPatch = lib.optionalString stdenv.isDarwin ''
# Fake the impure dependencies pbpaste and pbcopy
mkdir bin
echo '#!${stdenv.shell}' > bin/pbpaste

View file

@ -36,7 +36,7 @@ buildPythonPackage rec {
];
# Required flags from https://github.com/cvxgrp/cvxpy/releases/tag/v1.1.11
preBuild = lib.optional useOpenmp ''
preBuild = lib.optionalString useOpenmp ''
export CFLAGS="-fopenmp"
export LDFLAGS="-lgomp"
'';

View file

@ -25,7 +25,7 @@ let
++ lib.optionals (lang == "ru") [ pymorphy2 ]
++ lib.optionals (pname == "fr_dep_news_trf") [ sentencepiece ];
postPatch = lib.optionals (pname == "fr_dep_news_trf") ''
postPatch = lib.optionalString (pname == "fr_dep_news_trf") ''
substituteInPlace meta.json \
--replace "sentencepiece==0.1.91" "sentencepiece>=0.1.91"
'';

View file

@ -102,7 +102,7 @@ stdenv.mkDerivation rec {
];
# make install attempts to use the just-built cmake
preInstall = lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) ''
preInstall = lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) ''
sed -i 's|bin/cmake|${buildPackages.cmakeMinimal}/bin/cmake|g' Makefile
'';

View file

@ -16,10 +16,10 @@ stdenv.mkDerivation {
propagatedBuildInputs = [ m4 ];
preConfigure = lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
"ac_cv_func_malloc_0_nonnull=yes"
"ac_cv_func_realloc_0_nonnull=yes"
];
preConfigure = lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) ''
ac_cv_func_malloc_0_nonnull=yes
ac_cv_func_realloc_0_nonnull=yes
'';
doCheck = false; # fails 2 out of 46 tests

View file

@ -18,10 +18,10 @@ stdenv.mkDerivation {
propagatedBuildInputs = [ m4 ];
preConfigure = lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
"ac_cv_func_malloc_0_nonnull=yes"
"ac_cv_func_realloc_0_nonnull=yes"
];
preConfigure = lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) ''
ac_cv_func_malloc_0_nonnull=yes
ac_cv_func_realloc_0_nonnull=yes
'';
postConfigure = lib.optionalString (stdenv.isDarwin || stdenv.isCygwin) ''
sed -i Makefile -e 's/-no-undefined//;'

View file

@ -33,10 +33,10 @@ stdenv.mkDerivation rec {
buildInputs = [ bison ];
propagatedBuildInputs = [ m4 ];
preConfigure = lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
"export ac_cv_func_malloc_0_nonnull=yes"
"export ac_cv_func_realloc_0_nonnull=yes"
];
preConfigure = lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) ''
export ac_cv_func_malloc_0_nonnull=yes
export ac_cv_func_realloc_0_nonnull=yes
'';
postConfigure = lib.optionalString (stdenv.isDarwin || stdenv.isCygwin) ''
sed -i Makefile -e 's/-no-undefined//;'

View file

@ -15,7 +15,7 @@ let
buildInputs = lib.optional build-manual [ transfig ghostscript tex ];
preConfigure = lib.optional build-manual ''
preConfigure = lib.optionalString build-manual ''
sed -i "s/build_manual=no/build_manual=yes/g" DIST
'';

View file

@ -68,7 +68,7 @@ mkDerivation rec {
--replace 'LLVM_CXXFLAGS ~= s,-gsplit-dwarf,' '${lib.concatStringsSep "\n" ["LLVM_CXXFLAGS ~= s,-gsplit-dwarf," " LLVM_CXXFLAGS += -fno-rtti"]}'
'';
preBuild = optional withDocumentation ''
preBuild = optionalString withDocumentation ''
ln -s ${getLib qtbase}/$qtDocPrefix $NIX_QT5_TMP/share
'';

View file

@ -834,7 +834,7 @@ self: super: {
});
vim-xdebug = super.vim-xdebug.overrideAttrs (old: {
postInstall = false;
postInstall = null;
});
vim-xkbswitch = super.vim-xkbswitch.overrideAttrs (old: {

View file

@ -32,7 +32,7 @@ stdenv.mkDerivation rec {
outputs = [ "out" "dev" ];
postInstall = optional nftablesCompat ''
postInstall = optionalString nftablesCompat ''
rm $out/sbin/{iptables,iptables-restore,iptables-save,ip6tables,ip6tables-restore,ip6tables-save}
ln -sv xtables-nft-multi $out/bin/iptables
ln -sv xtables-nft-multi $out/bin/iptables-restore

View file

@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
};
# We have no LTO on i686 since commit 22284b0
postPatch = lib.optional stdenv.isi686 ''
postPatch = lib.optionalString stdenv.isi686 ''
substituteInPlace chelper/__init__.py \
--replace "-flto -fwhole-program " ""
'';

View file

@ -16,7 +16,7 @@ self = stdenv.mkDerivation rec {
sha256 = "1fhv16zr46pxm1j8vb8x8mh3nwzglg01arz8gnazbmjqldr5idpq";
};
preConfigure = lib.optional stdenv.isDarwin ''
preConfigure = lib.optionalString stdenv.isDarwin ''
ln -s /bin/ps $TMPDIR/ps
export PATH=$PATH:$TMPDIR
'';

View file

@ -35,7 +35,7 @@ stdenv.mkDerivation rec {
"/usr/local/lib/pkgconfig" "/nonexistent"
'';
preBuild = lib.optional stdenv.isDarwin ''
preBuild = lib.optionalString stdenv.isDarwin ''
substituteInPlace config.h --replace \
"#define HAVE_STRUCT_STAT_ST_BIRTHTIME 1" \
"#undef HAVE_STRUCT_STAT_ST_BIRTHTIME"

View file

@ -44,7 +44,7 @@ stdenv.mkDerivation rec {
installFlags = [ "DBDIR=$(TMPDIR)/db" "SYSCONFDIR=${placeholder "out"}/etc" ];
# Check that the udev plugin got built.
postInstall = lib.optional (udev != null) "[ -e ${placeholder "out"}/lib/dhcpcd/dev/udev.so ]";
postInstall = lib.optionalString (udev != null) "[ -e ${placeholder "out"}/lib/dhcpcd/dev/udev.so ]";
meta = with lib; {
description = "A client for the Dynamic Host Configuration Protocol (DHCP)";