Flake-based build environment for Nix users (#3534)
This commit is contained in:
parent
fb6e6d9cf4
commit
a47cf5aa2c
|
@ -0,0 +1,16 @@
|
|||
NBS_ONLY_LOAD_ENV_VARS=1 source env.sh
|
||||
|
||||
if command -v nix > /dev/null
|
||||
then
|
||||
export NIMBUS_NIX_ENV=1
|
||||
|
||||
cd installer/nix
|
||||
# watch_file tells direnv that changes to any of the watched files
|
||||
# should trigger a re-evalution of the environment
|
||||
watch_file flake.nix
|
||||
watch_file flake.lock
|
||||
watch_file shell.nix
|
||||
|
||||
mkdir -p .flake-profiles
|
||||
eval "$(nix print-dev-env --profile ".flake-profiles/profile")"
|
||||
fi
|
|
@ -22,6 +22,7 @@ build/
|
|||
# Each developer can create a personal .env file with
|
||||
# local settings overrides (e.g. WEB3_URL)
|
||||
.env
|
||||
.direnv/
|
||||
|
||||
# Ignore dynamic, static libs and libtool archive files
|
||||
*.so
|
||||
|
|
4
env.sh
4
env.sh
|
@ -7,9 +7,10 @@ ABS_PATH="$(cd ${REL_PATH}; pwd)"
|
|||
|
||||
# Activate nvm only when this file is sourced without arguments:
|
||||
if [ -z "$*" ]; then
|
||||
if ! command -v ganache-cli > /dev/null; then
|
||||
if command -v nvm > /dev/null; then
|
||||
nvm use
|
||||
command -v ganache-cli > /dev/null || { npm install -g ganache-cli; }
|
||||
npm install -g ganache-cli
|
||||
else
|
||||
echo <<EOF
|
||||
In order to use Ganache (a development ETH1 chain), please install NVM with:
|
||||
|
@ -20,6 +21,7 @@ if [ -z "$*" ]; then
|
|||
EOF
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# The user env file allows you to specify personal overrides for some
|
||||
# settings such as WEB3_URL, CPU_LIMIT, etc:
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
# Local file unique for each user
|
||||
.flake-profiles/
|
|
@ -0,0 +1,43 @@
|
|||
{
|
||||
"nodes": {
|
||||
"flake-utils": {
|
||||
"locked": {
|
||||
"lastModified": 1659877975,
|
||||
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1659446231,
|
||||
"narHash": "sha256-hekabNdTdgR/iLsgce5TGWmfIDZ86qjPhxDg/8TlzhE=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "eabc38219184cc3e04a974fe31857d8e0eac098d",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-21.11",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
description = "nimbus-eth2";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = github:NixOS/nixpkgs/nixos-21.11;
|
||||
flake-utils.url = github:numtide/flake-utils;
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, flake-utils }:
|
||||
flake-utils.lib.simpleFlake {
|
||||
inherit self nixpkgs;
|
||||
name = "nimbus-eth2";
|
||||
shell = ./shell.nix;
|
||||
};
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
{ pkgs ? import <nixpkgs> { } }: with pkgs;
|
||||
mkShell {
|
||||
buildInputs = [
|
||||
llvmPackages_14.clang-unwrapped
|
||||
figlet
|
||||
git
|
||||
gnumake
|
||||
|
||||
# For installing ganache for local simulations
|
||||
nodePackages.ganache-cli
|
||||
] ++ lib.optionals (!stdenv.isDarwin) [
|
||||
lsb-release
|
||||
];
|
||||
|
||||
shellHook = ''
|
||||
# We use clang unwrapped because the compiler wrappers under Nix
|
||||
# ignore -march=native in order to keep the build deterministic
|
||||
export PATH=${llvmPackages_14.clang-unwrapped}/bin:$PATH
|
||||
export CC=clang
|
||||
|
||||
figlet "Welcome to Nimbus-eth2"
|
||||
'';
|
||||
}
|
|
@ -1 +1 @@
|
|||
Subproject commit 11df74552d3a3abe2c722c536c8075ef6814d5fa
|
||||
Subproject commit 27d314d65c9078924b3239fe4e2f5af0c512b28c
|
|
@ -1 +1 @@
|
|||
Subproject commit 07e37730c627c19848e8662352976afe7e15bb1f
|
||||
Subproject commit dc535cd4627e6c1ec023ee6d6d0c3e5d66d414e5
|
Loading…
Reference in New Issue