Flake-based direnv setup for nixOS users
This commit is contained in:
parent
fad3ed64cf
commit
e47387d41f
|
@ -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 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
|
|
@ -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 =
|
||||
[
|
||||
figlet
|
||||
git
|
||||
gnumake
|
||||
rocksdb
|
||||
]
|
||||
++ lib.optionals (!stdenv.isDarwin) [
|
||||
lsb-release
|
||||
];
|
||||
|
||||
shellHook = ''
|
||||
# By default, the Nix wrapper scripts for executing the system compilers
|
||||
# will erase `-march=native` because this introduces impurity in the build.
|
||||
# For the purposes of compiling Nimbus, this behavior is not desired:
|
||||
export NIX_ENFORCE_NO_NATIVE=0
|
||||
|
||||
figlet "Welcome to Nimbus-eth1"
|
||||
'';
|
||||
}
|
Loading…
Reference in New Issue