-
Notifications
You must be signed in to change notification settings - Fork 2
/
flake.nix
73 lines (66 loc) · 2.3 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
{
description = "melange-jest Nix Flake";
inputs.nix-filter.url = "github:numtide/nix-filter";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.nixpkgs = {
url = "github:nix-ocaml/nix-overlays";
inputs.flake-utils.follows = "flake-utils";
};
outputs = { self, nixpkgs, flake-utils, nix-filter }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages."${system}".extend (self: super: {
ocamlPackages = super.ocaml-ng.ocamlPackages_5_2;
});
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-T0oSCDJtwK0vNwoQQBgRtgcrz/1/gfIEUaz2uHgVKKY=";
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";
src = ./.;
nativeBuildInputs = with pkgs.ocamlPackages; [ melange ];
propagatedBuildInputs = with pkgs.ocamlPackages; [ melange ];
doCheck = true;
nativeCheckInputs = [ reason nodejs_latest yarn cacert ];
checkInputs = [ melange-webapi cacert checkPhaseNodePackages ];
checkPhase = ''
dune build @all -p melange-jest --display=short
ln -sfn "${checkPhaseNodePackages}/node_modules" ./node_modules
./node_modules/.bin/jest
'';
};
mkShell = { buildInputs ? [ ] }: pkgs.mkShell {
inputsFrom = [ melange-jest ];
nativeBuildInputs = with pkgs; [
yarn
nodejs_latest
] ++ (with pkgs.ocamlPackages; [
ocamlformat
merlin
reason
]);
inherit buildInputs;
};
in
rec {
packages.default = melange-jest;
devShells = {
default = mkShell { };
release = mkShell {
buildInputs = with pkgs; [ cacert curl ocamlPackages.dune-release git ];
};
};
});
}