From 1c7b48b83bbb749a382199cedb769ac4bd9cfe95 Mon Sep 17 00:00:00 2001 From: toasterofbread Date: Sat, 3 Aug 2024 09:45:30 +0100 Subject: [PATCH] Add NO_PATCH option to flake.nix [noci] --- README.md | 4 ++++ flake.nix | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2190cf5..a9d871c 100644 --- a/README.md +++ b/README.md @@ -6,3 +6,7 @@ Short for spmp-server This library isn't intended to be used outside of [SpMp](https://github.com/toasterofbread/spmp), but if you want to, go ahead. Available on Maven Central: https://central.sonatype.com/artifact/dev.toastbits/spms + +## Options + +To skip patching outputted binaries when building in the Nix environment, set the environment variable `NO_PATCH` to 1. diff --git a/flake.nix b/flake.nix index 5941b97..3e9ea6d 100644 --- a/flake.nix +++ b/flake.nix @@ -63,7 +63,9 @@ export PATH="$KONAN_DATA_DIR/bin:$PATH" PATCH_KOTLIN_BINARY_SCRIPT="patchelf --set-interpreter \$(cat \$NIX_CC/nix-support/dynamic-linker) --set-rpath ${custom_pkgs.kotlin-native-toolchain-env}/dependencies/x86_64-unknown-linux-gnu-gcc-8.3.0-glibc-2.19-kernel-4.9-2/x86_64-unknown-linux-gnu/sysroot/lib64 \$1" - echo "$PATCH_KOTLIN_BINARY_SCRIPT" > $KONAN_DATA_DIR/bin/${kotlin_binary_patch_command} + echo '[ "''${NO_PATCH:-0}" -eq 1 ] && exit 1' > $KONAN_DATA_DIR/bin/${kotlin_binary_patch_command} + echo "$PATCH_KOTLIN_BINARY_SCRIPT" >> $KONAN_DATA_DIR/bin/${kotlin_binary_patch_command} + chmod +x $KONAN_DATA_DIR/bin/${kotlin_binary_patch_command} chmod -R u+w $KONAN_DATA_DIR