Make it possible to run the local simulation on nixOS

This commit is contained in:
Zahary Karadjov 2023-03-30 19:37:29 +03:00
parent f71a279d17
commit b4d731a1cc
No known key found for this signature in database
GPG Key ID: C8936F8A3073D609
4 changed files with 16 additions and 2 deletions

View File

@ -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
];

View File

@ -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

View File

@ -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
}

View File

@ -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
}