treewide: fix search location of crates inside cargoDepsCopy
This is needed because the previous commit moved crates one layer deeper in the vendor directory of rust packages when using fetchCargoVendor
This commit is contained in:
@@ -19,7 +19,7 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
inherit (cargo-tauri) version src;
|
||||
|
||||
postPatch = lib.optionalString stdenv.hostPlatform.isLinux ''
|
||||
substituteInPlace $cargoDepsCopy/libappindicator-sys-*/src/lib.rs \
|
||||
substituteInPlace $cargoDepsCopy/*/libappindicator-sys-*/src/lib.rs \
|
||||
--replace "libayatana-appindicator3.so.1" "${libayatana-appindicator}/lib/libayatana-appindicator3.so.1"
|
||||
'';
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ rustPlatform.buildRustPackage (finalAttrs: {
|
||||
patches = [ ./missing-unsafe-block.patch ];
|
||||
|
||||
postPatch = ''
|
||||
pushd $cargoDepsCopy/librclone-sys-*
|
||||
pushd $cargoDepsCopy/*/librclone-sys-*
|
||||
oldHash=$(sha256sum build.rs | cut -d " " -f 1)
|
||||
patch -p2 < ${./librclone-path.patch}
|
||||
substituteInPlace build.rs \
|
||||
|
||||
@@ -64,17 +64,17 @@ rustPlatform.buildRustPackage {
|
||||
sed -i -e '/Mihomo Alpha/d' ./src/components/setting/mods/clash-core-viewer.tsx
|
||||
|
||||
# Set service.sock path
|
||||
substituteInPlace $cargoDepsCopy/clash_verge_service_ipc-*/src/lib.rs \
|
||||
substituteInPlace $cargoDepsCopy/*/clash_verge_service_ipc-*/src/lib.rs \
|
||||
--replace-fail "/tmp/verge/clash-verge-service.sock" "/run/clash-verge-rev/service.sock"
|
||||
# Set verge-mihomo.sock path
|
||||
substituteInPlace src-tauri/src/utils/dirs.rs \
|
||||
--replace-fail 'once("/tmp")' 'once(&std::env::var("XDG_RUNTIME_DIR").unwrap_or_else(|_| std::env::var("UID").map(|uid| format!("/run/user/{}", uid)).unwrap_or_else(|_| "/tmp".to_string())))' \
|
||||
--replace-fail 'join("verge")' 'join("clash-verge-rev")'
|
||||
|
||||
substituteInPlace $cargoDepsCopy/libappindicator-sys-*/src/lib.rs \
|
||||
substituteInPlace $cargoDepsCopy/*/libappindicator-sys-*/src/lib.rs \
|
||||
--replace-fail "libayatana-appindicator3.so.1" "${libayatana-appindicator}/lib/libayatana-appindicator3.so.1"
|
||||
|
||||
substituteInPlace $cargoDepsCopy/sysproxy-*/src/linux.rs \
|
||||
substituteInPlace $cargoDepsCopy/*/sysproxy-*/src/linux.rs \
|
||||
--replace-fail '"gsettings"' '"${glib.bin}/bin/gsettings"' \
|
||||
--replace-fail '"kreadconfig5"' '"${libsForQt5.kconfig}/bin/kreadconfig5"' \
|
||||
--replace-fail '"kreadconfig6"' '"${kdePackages.kconfig}/bin/kreadconfig6"' \
|
||||
|
||||
@@ -120,7 +120,7 @@ rustPlatform.buildRustPackage (finalAttrs: {
|
||||
# remove updater
|
||||
rm -rf updater
|
||||
|
||||
substituteInPlace $cargoDepsCopy/libappindicator-sys-*/src/lib.rs \
|
||||
substituteInPlace $cargoDepsCopy/*/libappindicator-sys-*/src/lib.rs \
|
||||
--replace-fail "libayatana-appindicator3.so.1" "${libayatana-appindicator}/lib/libayatana-appindicator3.so.1"
|
||||
|
||||
# disable pre-build script and disable auto-updater
|
||||
|
||||
@@ -21,7 +21,7 @@ rustPlatform.buildRustPackage (finalAttrs: {
|
||||
|
||||
# ../../ is cargoDepsCopy, and obviously does not contain monoio's README.md
|
||||
postPatch = ''
|
||||
substituteInPlace $cargoDepsCopy/monoio-0.2.4/src/lib.rs \
|
||||
substituteInPlace $cargoDepsCopy/*/monoio-0.2.4/src/lib.rs \
|
||||
--replace-fail '#![doc = include_str!("../../README.md")]' ""
|
||||
'';
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ rustPlatform.buildRustPackage (finalAttrs: {
|
||||
#
|
||||
# For seccompiler: fix hardcoded /usr/local/lib path to libseccomp.lib, this makes sure rustc can find seccomp across stdenv's(including pkgsStatic).
|
||||
postPatch = ''
|
||||
substituteInPlace $cargoDepsCopy/aws-lc-sys-*/aws-lc/crypto/asn1/a_bitstr.c \
|
||||
substituteInPlace $cargoDepsCopy/*/aws-lc-sys-*/aws-lc/crypto/asn1/a_bitstr.c \
|
||||
--replace-warn '(len > INT_MAX - 1)' '(len < 0 || len > INT_MAX - 1)'
|
||||
|
||||
substituteInPlace src/cpu-template-helper/build.rs \
|
||||
|
||||
@@ -26,7 +26,7 @@ rustPlatform.buildRustPackage {
|
||||
# Drop when Lightway bumps wolfSSL past commit 5c2c459, or > 5.8.4.
|
||||
postPatch = ''
|
||||
patch -Np1 \
|
||||
-d $cargoDepsCopy/wolfssl-sys-2.0.0/wolfssl-src \
|
||||
-d $cargoDepsCopy/*/wolfssl-sys-2.0.0/wolfssl-src \
|
||||
-i ${./backport-darwin-address-calc-fix.patch}
|
||||
'';
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ rustPlatform.buildRustPackage (finalAttrs: {
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace $cargoDepsCopy/libappindicator-sys-*/src/lib.rs \
|
||||
substituteInPlace $cargoDepsCopy/*/libappindicator-sys-*/src/lib.rs \
|
||||
--replace-fail "libayatana-appindicator3.so.1" "${libayatana-appindicator}/lib/libayatana-appindicator3.so.1"
|
||||
'';
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ rustPlatform.buildRustPackage (finalAttrs: {
|
||||
doInstallCheck = true;
|
||||
|
||||
postPatch = ''
|
||||
alvr_session=$(echo $cargoDepsCopy/alvr_session-*/)
|
||||
alvr_session=$(echo $cargoDepsCopy/*/alvr_session-*/)
|
||||
substituteInPlace "$alvr_session/build.rs" \
|
||||
--replace-fail \
|
||||
'alvr_filesystem::workspace_dir().join("openvr/headers/openvr_driver.h")' \
|
||||
|
||||
@@ -62,7 +62,7 @@ rustPlatform.buildRustPackage rec {
|
||||
};
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace $cargoDepsCopy/libappindicator-sys-*/src/lib.rs \
|
||||
substituteInPlace $cargoDepsCopy/*/libappindicator-sys-*/src/lib.rs \
|
||||
--replace-fail "libayatana-appindicator3.so.1" "${libayatana-appindicator}/lib/libayatana-appindicator3.so.1"
|
||||
|
||||
# disable updater
|
||||
|
||||
@@ -127,24 +127,24 @@ rustPlatform.buildRustPackage (finalAttrs: {
|
||||
# patch build-time dependency downloads
|
||||
(
|
||||
# add support for file:// urls
|
||||
patch -d $cargoDepsCopy/lindera-dictionary-*/ -p1 < ${./lindera-dictionary-support-file-paths.patch}
|
||||
patch -d $cargoDepsCopy/*/lindera-dictionary-*/ -p1 < ${./lindera-dictionary-support-file-paths.patch}
|
||||
|
||||
# patch urls
|
||||
${lib.pipe finalAttrs.passthru.lindera-srcs [
|
||||
(lib.mapAttrsToList (
|
||||
key: src: ''
|
||||
# compgen is only in bashInteractive
|
||||
declare -a expanded_glob=($cargoDepsCopy/${src.vendorDir}/build.rs)
|
||||
declare -a expanded_glob=($cargoDepsCopy/*/${src.vendorDir}/build.rs)
|
||||
if [[ "''${#expanded_glob[@]}" -eq 0 ]]; then
|
||||
echo >&2 "ERROR: '$cargoDepsCopy/${src.vendorDir}/build.rs' not found! (pagefind.passthru.lindera-srcs.${key})"
|
||||
echo >&2 "ERROR: '$cargoDepsCopy/*/${src.vendorDir}/build.rs' not found! (pagefind.passthru.lindera-srcs.${key})"
|
||||
false
|
||||
elif [[ "''${#expanded_glob[@]}" -gt 1 ]]; then
|
||||
echo >&2 "ERROR: '$cargoDepsCopy/${src.vendorDir}/build.rs' matches more than one file! (pagefind.passthru.lindera-srcs.${key})"
|
||||
echo >&2 "ERROR: '$cargoDepsCopy/*/${src.vendorDir}/build.rs' matches more than one file! (pagefind.passthru.lindera-srcs.${key})"
|
||||
printf >&2 "match: %s\n" "''${expanded_glob[@]}"
|
||||
false
|
||||
fi
|
||||
echo "patching $cargoDepsCopy/${src.vendorDir}/build.rs..."
|
||||
substituteInPlace $cargoDepsCopy/${src.vendorDir}/build.rs --replace-fail "${src.url}" "file://${src}"
|
||||
echo "patching $cargoDepsCopy/*/${src.vendorDir}/build.rs..."
|
||||
substituteInPlace $cargoDepsCopy/*/${src.vendorDir}/build.rs --replace-fail "${src.url}" "file://${src}"
|
||||
unset expanded_glob
|
||||
''
|
||||
))
|
||||
|
||||
@@ -29,7 +29,7 @@ rustPlatform.buildRustPackage (finalAttrs: {
|
||||
};
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace $cargoDepsCopy/libappindicator-sys-*/src/lib.rs \
|
||||
substituteInPlace $cargoDepsCopy/*/libappindicator-sys-*/src/lib.rs \
|
||||
--replace-fail "libayatana-appindicator3.so.1" "${libayatana-appindicator}/lib/libayatana-appindicator3.so.1"
|
||||
|
||||
substituteInPlace src-tauri/tauri.conf.json \
|
||||
|
||||
@@ -36,7 +36,7 @@ rustPlatform.buildRustPackage rec {
|
||||
|
||||
# from https://github.com/NixOS/nixpkgs/blob/04e40bca2a68d7ca85f1c47f00598abb062a8b12/pkgs/by-name/ca/cargo-tauri/test-app.nix#L23-L26
|
||||
postPatch = lib.optionalString stdenv.hostPlatform.isLinux ''
|
||||
substituteInPlace $cargoDepsCopy/libappindicator-sys-*/src/lib.rs \
|
||||
substituteInPlace $cargoDepsCopy/*/libappindicator-sys-*/src/lib.rs \
|
||||
--replace-fail "libayatana-appindicator3.so.1" "${libayatana-appindicator}/lib/libayatana-appindicator3.so.1"
|
||||
'';
|
||||
|
||||
|
||||
@@ -162,12 +162,12 @@ flutter329.buildFlutterApplication rec {
|
||||
postPatch = ''
|
||||
cd flutter
|
||||
if [ $cargoDepsCopy ]; then # That will be inherited to buildDartPackage and it doesn't have cargoDepsCopy
|
||||
substituteInPlace $cargoDepsCopy/libappindicator-sys-*/src/lib.rs \
|
||||
substituteInPlace $cargoDepsCopy/*/libappindicator-sys-*/src/lib.rs \
|
||||
--replace-fail "libayatana-appindicator3.so.1" "${lib.getLib libayatana-appindicator}/lib/libayatana-appindicator3.so.1"
|
||||
# Disable static linking of ffmpeg since https://github.com/21pages/hwcodec/commit/1873c34e3da070a462540f61c0b782b7ab15dc84
|
||||
sed -i 's/static=//g' $cargoDepsCopy/hwcodec-*/build.rs
|
||||
sed -e '1i #include <cstdint>' -i $cargoDepsCopy/webm-1.1.0/src/sys/libwebm/mkvparser/mkvparser.cc
|
||||
sed -e '1i #include <cstdint>' -i $cargoDepsCopy/webm-sys-1.0.4/libwebm/mkvparser/mkvparser.cc
|
||||
sed -i 's/static=//g' $cargoDepsCopy/*/hwcodec-*/build.rs
|
||||
sed -e '1i #include <cstdint>' -i $cargoDepsCopy/*/webm-1.1.0/src/sys/libwebm/mkvparser/mkvparser.cc
|
||||
sed -e '1i #include <cstdint>' -i $cargoDepsCopy/*/webm-sys-1.0.4/libwebm/mkvparser/mkvparser.cc
|
||||
fi
|
||||
|
||||
substituteInPlace ../Cargo.toml --replace-fail ", \"staticlib\", \"rlib\"" ""
|
||||
|
||||
@@ -112,8 +112,8 @@ rustPlatform.buildRustPackage (finalAttrs: {
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
sed -e '1i #include <cstdint>' -i $cargoDepsCopy/webm-1.1.0/src/sys/libwebm/mkvparser/mkvparser.cc
|
||||
sed -e '1i #include <cstdint>' -i $cargoDepsCopy/webm-sys-1.0.4/libwebm/mkvparser/mkvparser.cc
|
||||
sed -e '1i #include <cstdint>' -i $cargoDepsCopy/*/webm-1.1.0/src/sys/libwebm/mkvparser/mkvparser.cc
|
||||
sed -e '1i #include <cstdint>' -i $cargoDepsCopy/*/webm-sys-1.0.4/libwebm/mkvparser/mkvparser.cc
|
||||
'';
|
||||
|
||||
# Add static ui resources and libsciter to same folder as binary so that it
|
||||
|
||||
@@ -85,7 +85,7 @@ rustPlatform.buildRustPackage rec {
|
||||
''
|
||||
+ lib.optionalString stdenv.hostPlatform.isLinux ''
|
||||
# Both libappindicator-rs and SlimeVR need to know where Nix's appindicator lib is.
|
||||
substituteInPlace $cargoDepsCopy/libappindicator-sys-*/src/lib.rs \
|
||||
substituteInPlace $cargoDepsCopy/*/libappindicator-sys-*/src/lib.rs \
|
||||
--replace-fail "libayatana-appindicator3.so.1" "${libayatana-appindicator}/lib/libayatana-appindicator3.so.1"
|
||||
substituteInPlace gui/src-tauri/src/tray.rs \
|
||||
--replace-fail "libayatana-appindicator3.so.1" "${libayatana-appindicator}/lib/libayatana-appindicator3.so.1"
|
||||
|
||||
@@ -47,7 +47,7 @@ rustPlatform.buildRustPackage (finalAttrs: {
|
||||
CPM_SOURCE_CACHE = "./build";
|
||||
|
||||
postPatch = ''
|
||||
install -D ${cpm-cmake}/share/cpm/CPM.cmake $(echo $cargoDepsCopy/stereokit-sys-*/StereoKit)/build/cpm/CPM_0.32.2.cmake
|
||||
install -D ${cpm-cmake}/share/cpm/CPM.cmake $(echo $cargoDepsCopy/*/stereokit-sys-*/StereoKit)/build/cpm/CPM_0.32.2.cmake
|
||||
'';
|
||||
|
||||
passthru.updateScript = nix-update-script { };
|
||||
|
||||
@@ -33,7 +33,7 @@ rustPlatform.buildRustPackage (finalAttrs: {
|
||||
|
||||
postPatch = ''
|
||||
# Fix sudo crate's hardcoded /usr/bin/sudo
|
||||
substituteInPlace $cargoDepsCopy/sudo-0.6.0/src/lib.rs \
|
||||
substituteInPlace $cargoDepsCopy/*/sudo-0.6.0/src/lib.rs \
|
||||
--replace-fail 'Command::new("/usr/bin/sudo")' 'Command::new("sudo")'
|
||||
'';
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ rustPlatform.buildRustPackage rec {
|
||||
};
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace $cargoDepsCopy/libappindicator-sys-*/src/lib.rs \
|
||||
substituteInPlace $cargoDepsCopy/*/libappindicator-sys-*/src/lib.rs \
|
||||
--replace-fail "libayatana-appindicator3.so.1" "${libayatana-appindicator}/lib/libayatana-appindicator3.so.1"
|
||||
'';
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ rustPlatform.buildRustPackage (finalAttrs: {
|
||||
--replace-fail '"npm run webpack-prod"' '""'
|
||||
''
|
||||
+ lib.optionalString stdenv.hostPlatform.isLinux ''
|
||||
substituteInPlace $cargoDepsCopy/libappindicator-sys-*/src/lib.rs \
|
||||
substituteInPlace $cargoDepsCopy/*/libappindicator-sys-*/src/lib.rs \
|
||||
--replace-fail "libayatana-appindicator3.so.1" "${libayatana-appindicator}/lib/libayatana-appindicator3.so.1"
|
||||
'';
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ rustPlatform.buildRustPackage {
|
||||
|
||||
postPatch = ''
|
||||
# Force vek to build in unstable mode
|
||||
cat <<'EOF' | tee "$cargoDepsCopy"/vek-*/build.rs
|
||||
cat <<'EOF' | tee "$cargoDepsCopy"/*/vek-*/build.rs
|
||||
fn main() {
|
||||
println!("cargo:rustc-check-cfg=cfg(nightly)");
|
||||
println!("cargo:rustc-cfg=nightly");
|
||||
|
||||
@@ -40,7 +40,7 @@ rustPlatform.buildRustPackage (finalAttrs: {
|
||||
cp -r --no-preserve=all ${openjtalk-src} ./openjtalk
|
||||
substitute ${./openjtalk.patch} ./openjtalk.patch \
|
||||
--replace-fail "@openjtalk_src@" "$(pwd)/openjtalk"
|
||||
patch -d $cargoDepsCopy/open_jtalk-sys-* -p1 < ./openjtalk.patch
|
||||
patch -d $cargoDepsCopy/*/open_jtalk-sys-* -p1 < ./openjtalk.patch
|
||||
'';
|
||||
|
||||
cargoBuildFlags = [ "-p voicevox_core_c_api" ];
|
||||
|
||||
@@ -27,7 +27,7 @@ rustPlatform.buildRustPackage {
|
||||
export GOCACHE=$TMPDIR/go-cache
|
||||
export GOPATH="$TMPDIR/go"
|
||||
export GOPROXY=off
|
||||
cp -r --reflink=auto "$goModules" "$cargoDepsCopy/go-srp-$goSrpVersion/go/vendor"
|
||||
cp -r --reflink=auto "$goModules" $(echo "$cargoDepsCopy"/*/"go-srp-$goSrpVersion")/go/vendor
|
||||
'';
|
||||
|
||||
goModules =
|
||||
|
||||
@@ -125,7 +125,7 @@ rustPlatform.buildRustPackage (finalAttrs: {
|
||||
|
||||
postPatch = ''
|
||||
# Dynamically link WebRTC instead of static
|
||||
substituteInPlace $cargoDepsCopy/webrtc-sys-*/build.rs \
|
||||
substituteInPlace $cargoDepsCopy/*/webrtc-sys-*/build.rs \
|
||||
--replace-fail "cargo:rustc-link-lib=static=webrtc" "cargo:rustc-link-lib=dylib=webrtc"
|
||||
|
||||
# The generate-licenses script wants a specific version of cargo-about eventhough
|
||||
|
||||
@@ -114,7 +114,7 @@ let
|
||||
| sponge src-tauri/tauri.conf.json
|
||||
''
|
||||
+ lib.optionalString stdenv.hostPlatform.isLinux ''
|
||||
substituteInPlace $cargoDepsCopy/libappindicator-sys-*/src/lib.rs \
|
||||
substituteInPlace $cargoDepsCopy/*/libappindicator-sys-*/src/lib.rs \
|
||||
--replace-fail "libayatana-appindicator3.so.1" "${libayatana-appindicator}/lib/libayatana-appindicator3.so.1"
|
||||
'';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user