Skip to content

Commit

Permalink
Add Nix flake
Browse files Browse the repository at this point in the history
  • Loading branch information
deepy committed Aug 29, 2023
1 parent d7f24a4 commit 1ea8bf8
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 1 deletion.
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake --impure
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ node_modules
.settings
bin
examples/**/*.lock
*.hprof
*.hprof
.direnv/
27 changes: 27 additions & 0 deletions flake.lock

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

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

inputs.nixpkgs.url = "github:NixOS/nixpkgs/release-23.05";

outputs = { self, nixpkgs }:
let
javaVersion = 11;
nodeVersion = 18;
overlays = [
(final: prev: rec {
jdk = prev."jdk${toString javaVersion}";
nodejs = prev."nodejs-${toString nodeVersion}_x";
pnpm = prev.nodePackages.pnpm;
})
];
supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f {
pkgs = import nixpkgs { inherit overlays system; };
});
in
{
devShells = forEachSupportedSystem ({ pkgs }: {
default = pkgs.mkShell {
NIX_LD_LIBRARY_PATH = nixpkgs.lib.makeLibraryPath [
pkgs.stdenv.cc.cc.lib
];
NIX_LD = nixpkgs.lib.fileContents "${pkgs.stdenv.cc}/nix-support/dynamic-linker";
packages = with pkgs; [ jdk nodejs pnpm stdenv ];
};
});
};
}

0 comments on commit 1ea8bf8

Please sign in to comment.