Skip to content

Commit

Permalink
nix flake support
Browse files Browse the repository at this point in the history
  • Loading branch information
fidgetingbits committed Dec 31, 2023
1 parent a53aeb1 commit fb0e102
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 0 deletions.
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/.direnv/
/.emscripten_cache/
/.make-work/
/.metals/
/.vscode-test/
Expand Down
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.

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

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

outputs = { self, nixpkgs }:
let
overlays = [
(final: prev: rec {
nodejs = prev.nodejs-18_x;
yarn = (prev.yarn.override { inherit nodejs; });
})
];
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; config.allowUnfree = true; };
});
in
{
devShells = forEachSupportedSystem
({ pkgs }: {
default = pkgs.mkShell
{
packages = with pkgs; [ nodejs yarn emscripten python310 steam-run vsce ];
shellHook = ''
if [ ! -d $(pwd)/.emscripten_cache ]; then
cp -R ${pkgs.emscripten}/share/emscripten/cache/ $(pwd)/.emscripten_cache
chmod u+rwX -R $(pwd)/.emscripten_cache
export EM_CACHE=$(pwd)/.emscripten_cache
fi
'';
};
});
};
}

0 comments on commit fb0e102

Please sign in to comment.