Skip to content

Commit

Permalink
build(nix): Add Nix Flakes & nix-direnv dev shell
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinNikov committed Mar 12, 2024
1 parent 5ade0e9 commit 00ff88a
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 2 deletions.
9 changes: 9 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# shellcheck shell=bash
if ! has nix_direnv_version || ! nix_direnv_version 2.2.1; then
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.2.1/direnvrc" "sha256-zelF0vLbEl5uaqrfIzbgNzJWGmLzCmYAkInj/LNxvKs="
fi

dotenv_if_exists

use flake
nix_direnv_watch_file ./shell.nix
16 changes: 14 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,17 @@ node_modules
.DS_Store
.env
/messages
dist
.jest
.jest

# yarn
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

# direnv
.direnv

# nix
result
48 changes: 48 additions & 0 deletions flake.lock

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

27 changes: 27 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
description = "Validator Ejector";

inputs = {
nixpkgs.url = github:NixOS/nixpkgs/nixos-unstable;

flake-parts = {
url = "github:hercules-ci/flake-parts";
inputs.nixpkgs-lib.follows = "nixpkgs";
};
};

outputs = inputs @ {flake-parts, ...}:
flake-parts.lib.mkFlake {inherit inputs;} {
systems = ["x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"];
perSystem = {pkgs, ...}: let
nodejs = pkgs.nodejs_20;
yarn = pkgs.yarn.override {inherit nodejs;};
in {
devShells.default = pkgs.mkShellNoCC {
packages = [nodejs yarn];
};

packages.validator-ejector = pkgs.callPackage ./packages/validator-ejector {};
};
};
}

0 comments on commit 00ff88a

Please sign in to comment.