Skip to content

Commit

Permalink
Merge pull request #9 from EspressoSystems/nix
Browse files Browse the repository at this point in the history
Repo configuration
  • Loading branch information
nomaxg authored Aug 8, 2023
2 parents e892e79 + 6e7a843 commit 9eb4764
Show file tree
Hide file tree
Showing 4 changed files with 213 additions and 0 deletions.
9 changes: 9 additions & 0 deletions CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# These owners will be the default owners for everything in the repo. Unless a
# later match takes precedence, they will be requested for review when someone
# opens a pull request.

* @nomaxg @sveitser @jbearer

# Dependabot PRs
*.toml @nomaxg @sveitser
*.lock @nomaxg @sveitser
128 changes: 128 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

63 changes: 63 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
description = "A Nix-flake-based Go 1.17 development environment";

inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.flake-compat.url = "github:edolstra/flake-compat";
inputs.flake-compat.flake = false;

inputs.foundry.url = "github:shazow/foundry.nix/monthly"; # Use monthly branch for permanent releases

outputs = { self, flake-utils, nixpkgs, foundry, ... }:
let
goVersion = 19; # Change this to update the whole stack
overlays = [
(final: prev: {
go = prev."go_1_${toString goVersion}";
# Overlaying nodejs here to ensure nodePackages use the desired
# version of nodejs.
nodejs = prev.nodejs-16_x;
pnpm = prev.nodePackages.pnpm;
yarn = prev.nodePackages.yarn;
})
foundry.overlay
];
in
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit overlays system;
config = {
permittedInsecurePackages = [ "nodejs-16.20.1" ];
};
};
in
{
devShells.default = pkgs.mkShell {
packages = with pkgs; [
go
# goimports, godoc, etc.
gotools
# https://github.com/golangci/golangci-lint
golangci-lint

# Node
pnpm
yarn # `pnpm build` fails without this

# Foundry, and tools like the anvil dev node
foundry-bin

# Docker
docker-compose # provides the `docker-compose` command

# Python
(python3.withPackages (ps: with ps; [ ]))
jq

# geth node
go-ethereum
];
};
});
}
13 changes: 13 additions & 0 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
(import
(
let
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
in
fetchTarball {
url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
sha256 = lock.nodes.flake-compat.locked.narHash;
}
)
{
src = ./.;
}).shellNix

0 comments on commit 9eb4764

Please sign in to comment.