Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix loading Nix Flake shell via direnv, update readme #6807

Merged
merged 3 commits into from
Jan 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 3 additions & 13 deletions .envrc
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
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")"
if ! has nix_direnv_version || ! nix_direnv_version 3.0.6; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there something specific/special about version 3.0.6 or is this a way of pinning a semi-arbitrary version?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's the same version we've been using in all of our infra-* repositories for our Nix Flake shell for a few months now:
https://github.com/status-im/infra-template/blob/3c85b88671a8b48c5d267801bf0ad678f0e739d4/.envrc#L1-L3

So it's known to be stable.

source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/3.0.6/direnvrc" "sha256-RYcUJaRMf8oF5LznDrlCXbkOQrywm0HDv1VjYGaJGdM="
fi
use flake
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ jobs:
if: ${{ !cancelled() }} && github.event_name == 'pull_request'
run: |
excluded_files="config.yaml"
excluded_extensions="ans|bin|cfg|json|json\\.template|md|png|service|ssz|txt|lock|nix"
excluded_extensions="ans|bin|cfg|yml|json|json\\.template|md|png|service|ssz|txt|lock|nix|gitignore|envrc"

current_year=$(date +"%Y")
problematic_files=()
Expand Down
5 changes: 3 additions & 2 deletions nix/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@ https://github.com/NixOS/nix/issues/4423

It can be also done without even cloning the repo:
```sh
nix build 'github:status-im/nimbus-eth2?submodules=1'
nix build 'github:status-im/nimbus-eth2?submodules=1#'
```
The trailing `#` is required due to [URI parsing bug in Nix](https://github.com/NixOS/nix/issues/6633).

## Running

```sh
nix run 'github:status-im/nimbus-eth2?submodules=1'
nix run 'github:status-im/nimbus-eth2?submodules=1#'
```
Loading