From b4d731a1cc85562647b2b770ba65db4ed5f0ca4d Mon Sep 17 00:00:00 2001 From: Zahary Karadjov Date: Thu, 30 Mar 2023 19:37:29 +0300 Subject: [PATCH] Make it possible to run the local simulation on nixOS --- installer/nix/shell.nix | 7 +++++-- scripts/detect_platform.sh | 8 ++++++++ scripts/geth_binaries.sh | 2 ++ scripts/launch_local_testnet.sh | 1 + 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/installer/nix/shell.nix b/installer/nix/shell.nix index e464e0108..e5919b610 100644 --- a/installer/nix/shell.nix +++ b/installer/nix/shell.nix @@ -7,8 +7,11 @@ mkShell { git gnumake - # For installing ganache for local simulations - nodePackages.ganache-cli + # For the local simulation + openssl # for generating the JWT file + lsof # for killing processes by port + killall # for killing processes manually + curl # for working with the node APIs ] ++ lib.optionals (!stdenv.isDarwin) [ lsb-release ]; diff --git a/scripts/detect_platform.sh b/scripts/detect_platform.sh index 411eaa563..9c8f09998 100644 --- a/scripts/detect_platform.sh +++ b/scripts/detect_platform.sh @@ -17,4 +17,12 @@ fi # Architecture detection ARCH="$(uname -m)" +patchelf_when_on_nixos () { + if [ -f /etc/NIXOS ]; then + nix-shell \ + -p stdenv.cc \ + --command 'patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) "'$1'"' + fi +} + fi diff --git a/scripts/geth_binaries.sh b/scripts/geth_binaries.sh index 69e7cf487..cc536fa4f 100644 --- a/scripts/geth_binaries.sh +++ b/scripts/geth_binaries.sh @@ -51,6 +51,7 @@ download_geth_stable() { mkdir -p "$(dirname "$STABLE_GETH_BINARY")" mv "$tmp_extract_dir/geth$EXE_EXTENSION" "$STABLE_GETH_BINARY" chmod +x "$STABLE_GETH_BINARY" + patchelf_when_on_nixos "$STABLE_GETH_BINARY" fi } @@ -96,6 +97,7 @@ download_status_geth_binary() { mkdir -p "$(dirname "$BINARY_FS_PATH")" mv "$tmp_extract_dir/geth$EXE_EXTENSION" "$BINARY_FS_PATH" chmod +x "$BINARY_FS_PATH" + patchelf_when_on_nixos "$BINARY_FS_PATH" fi } diff --git a/scripts/launch_local_testnet.sh b/scripts/launch_local_testnet.sh index 76de709b2..e97039a2d 100755 --- a/scripts/launch_local_testnet.sh +++ b/scripts/launch_local_testnet.sh @@ -577,6 +577,7 @@ download_nimbus_eth1() { mkdir -p "$(dirname "$NIMBUS_ETH1_BINARY")" mv "$tmp_extract_dir/build/nimbus$EXE_EXTENSION" "$NIMBUS_ETH1_BINARY" chmod +x "$NIMBUS_ETH1_BINARY" + patchelf_when_on_nixos "$NIMBUS_ETH1_BINARY" fi }