Skip to content

Commit 1ea8bf8

Browse files
committed
Add Nix flake
1 parent d7f24a4 commit 1ea8bf8

File tree

4 files changed

+63
-1
lines changed

4 files changed

+63
-1
lines changed

.envrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
use flake --impure

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@ node_modules
1414
.settings
1515
bin
1616
examples/**/*.lock
17-
*.hprof
17+
*.hprof
18+
.direnv/

flake.lock

Lines changed: 27 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: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
description = "A Nix-flake-based development environment";
3+
4+
inputs.nixpkgs.url = "github:NixOS/nixpkgs/release-23.05";
5+
6+
outputs = { self, nixpkgs }:
7+
let
8+
javaVersion = 11;
9+
nodeVersion = 18;
10+
overlays = [
11+
(final: prev: rec {
12+
jdk = prev."jdk${toString javaVersion}";
13+
nodejs = prev."nodejs-${toString nodeVersion}_x";
14+
pnpm = prev.nodePackages.pnpm;
15+
})
16+
];
17+
supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
18+
forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f {
19+
pkgs = import nixpkgs { inherit overlays system; };
20+
});
21+
in
22+
{
23+
devShells = forEachSupportedSystem ({ pkgs }: {
24+
default = pkgs.mkShell {
25+
NIX_LD_LIBRARY_PATH = nixpkgs.lib.makeLibraryPath [
26+
pkgs.stdenv.cc.cc.lib
27+
];
28+
NIX_LD = nixpkgs.lib.fileContents "${pkgs.stdenv.cc}/nix-support/dynamic-linker";
29+
packages = with pkgs; [ jdk nodejs pnpm stdenv ];
30+
};
31+
});
32+
};
33+
}

0 commit comments

Comments
 (0)