Skip to content

Commit

Permalink
set up node_modules from nix
Browse files Browse the repository at this point in the history
  • Loading branch information
anmonteiro committed Feb 2, 2024
1 parent a7ed7b8 commit f9d7f2e
Show file tree
Hide file tree
Showing 4 changed files with 7,381 additions and 3,700 deletions.
19 changes: 17 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,21 @@
];
inherit (pkgs) nodejs_latest lib stdenv darwin yarn cacert;

checkPhaseNodePackages = pkgs.buildNpmPackage {
name = "melange-jest-deps";
version = "0.0.0-dev";

src = ./.;
dontNpmBuild = true;
npmDepsHash = "sha256-FJEGqD2SwkGur+dSWtMW1Jr3Rmh68nQGUtEoprkXSfo=";
installPhase = ''
runHook preInstall
mkdir -p "$out"
cp -r ./node_modules "$out/node_modules"
runHook postInstall
'';
};

melange-jest = with pkgs.ocamlPackages; buildDunePackage {
pname = "melange-jest";
version = "dev";
Expand All @@ -34,10 +49,10 @@
propagatedBuildInputs = with pkgs.ocamlPackages; [ melange ];
doCheck = true;
nativeCheckInputs = [ reason nodejs_latest yarn cacert ];
checkInputs = [ melange-webapi cacert ];
checkInputs = [ melange-webapi cacert checkPhaseNodePackages ];
checkPhase = ''
dune build @all -p melange-jest --display=short
yarn install --no-default-rc --frozen-lockfile --check-files --cache-folder .ycache && rm -rf .ycache
ln -sfn "${checkPhaseNodePackages}/node_modules" ./node_modules
./node_modules/.bin/jest
'';
};
Expand Down
Loading

0 comments on commit f9d7f2e

Please sign in to comment.