Skip to content

Commit 3cf4f6c

Browse files
committed
build(nix): Add Nix Flake & Direnv-based dev shell environment
1 parent 5411569 commit 3cf4f6c

File tree

8 files changed

+134
-2
lines changed

8 files changed

+134
-2
lines changed

.direnv/.gitkeep

Whitespace-only changes.

.editorconfig

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# EditorConfig file: http://EditorConfig.org
2+
root = true
3+
4+
[*]
5+
charset = utf-8
6+
end_of_line = lf
7+
insert_final_newline = true
8+
trim_trailing_whitespace = true
9+
indent_style = space
10+
indent_size = 2
11+
max_line_length = 80
12+
13+
[*.{d,h,hpp,c,cpp,cxx,cs,hs,java,kt,py,rs,sol}]
14+
indent_size = 4
15+
16+
[{Makefile,go.mod,go.sum,*.go,.gitmodules}]
17+
indent_style = tab
18+
indent_size = 4

.envrc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# shellcheck shell=bash
2+
3+
if ! has nix_direnv_version || ! nix_direnv_version 2.1.1; then
4+
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.1.1/direnvrc" "sha256-b6qJ4r34rbE23yWjMqbmu3ia2z4b2wIlZUksBke/ol0="
5+
fi
6+
7+
dotenv_if_exists
8+
nix_direnv_watch_file shell.nix
9+
use flake

.gitignore

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# "dotenv" environment variable files
2+
# Each developer can create a personal .env file with
3+
# local settings overrides (e.g. WEB3_URL)
4+
.env
5+
.env.development.local
6+
.env.test.local
7+
.env.production.local
8+
.env.local
9+
10+
# Cached profile files created by direnv
11+
.direnv/*
12+
!.direnv/.gitkeep
13+
14+
# Nix
15+
result

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
# nix-solana-development
2-
A Nix flake oferring Solana development tools
1+
# nix-blockchain-development
2+
3+
A Nix flake offering blockchain development tools

flake.lock

Lines changed: 43 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
description = "nix-blockchain-development";
3+
4+
inputs = {
5+
nixpkgs.url = "github:NixOS/nixpkgs/nixos-22.05";
6+
flake-utils.url = github:numtide/flake-utils;
7+
};
8+
9+
outputs = {
10+
self,
11+
nixpkgs,
12+
flake-utils,
13+
}:
14+
flake-utils.lib.simpleFlake {
15+
inherit self nixpkgs;
16+
name = "nix-blockchain-development";
17+
shell = ./shell.nix;
18+
};
19+
}

shell.nix

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{pkgs}:
2+
with pkgs; let
3+
nodejs = nodejs-16_x;
4+
corepack = callPackage ./nix/corepack-shims {inherit nodejs;};
5+
in
6+
mkShell {
7+
buildInputs = [
8+
# For priting the direnv banner
9+
figlet
10+
11+
# For formatting Nix files
12+
alejandra
13+
14+
# For an easy way to launch all required blockchain simulations
15+
# and tailed log files
16+
tmux
17+
tmuxinator
18+
19+
# Node.js dev environment for unit tests
20+
nodejs
21+
corepack
22+
];
23+
24+
shellHook = ''
25+
figlet "nix-blockchain-development"
26+
'';
27+
}

0 commit comments

Comments
 (0)