Skip to content

Commit 4e168fd

Browse files
Added Nix flake with developer dependencies
1 parent a1c81fd commit 4e168fd

4 files changed

Lines changed: 104 additions & 0 deletions

File tree

.envrc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Install nix-direnv which provides significantly faster Nix integration
2+
if ! has nix_direnv_version || ! nix_direnv_version 3.1.0; then
3+
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/3.1.0/direnvrc" "sha256-yMJ2OVMzrFaDPn7q8nCBZFRYpL/f0RcHzhmw/i6btJM="
4+
fi
5+
6+
# Apply the devShell configured in flake.nix
7+
use flake
8+
9+
# this line sources your `.envrc.local` file
10+
source_env_if_exists .envrc.local

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
node_modules
22
dist
3+
.direnv/

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: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
{
2+
description = "ndc-nodejs-lambda development dependencies";
3+
4+
inputs = {
5+
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
6+
systems.url = "github:nix-systems/default";
7+
};
8+
9+
outputs =
10+
{
11+
self,
12+
nixpkgs,
13+
systems,
14+
}:
15+
let
16+
# Our default package set is configured to build for the same platform the flake is evaluated
17+
# on. So we leave `crossSystem` set to the default, which is `crossSystem = localSystem`. With
18+
# this package set if we're building on Linux we get Linux binaries, if we're building on Mac
19+
# we get Mac binaries, etc.
20+
mkPkgs =
21+
localSystem:
22+
import nixpkgs {
23+
system = localSystem;
24+
};
25+
26+
# Helper to define system-specific flake outputs.
27+
perSystem =
28+
callback:
29+
nixpkgs.lib.genAttrs (import systems) (
30+
system:
31+
callback {
32+
inherit system;
33+
pkgs = mkPkgs system;
34+
}
35+
);
36+
in
37+
{
38+
devShells = perSystem (
39+
{ pkgs, system }:
40+
{
41+
default = pkgs.mkShell {
42+
packages = [
43+
pkgs.nixfmt
44+
pkgs.nodejs_20
45+
];
46+
};
47+
}
48+
);
49+
};
50+
}

0 commit comments

Comments
 (0)