-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
69 lines (69 loc) · 1.98 KB
/
Copy pathflake.nix
File metadata and controls
69 lines (69 loc) · 1.98 KB
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
{
description = "A flake for the Compiler Playground";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-25.05";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
let
systems = [ "x86_64-linux" ];
in
flake-utils.lib.eachSystem systems (system:
let
pkgs = import nixpkgs { inherit system; };
ocamlPackages = pkgs.ocaml-ng.ocamlPackages_4_14;
in
{
formatter = pkgs.nixpkgs-fmt;
packages = {
playground = pkgs.stdenv.mkDerivation {
pname = "playground";
version = "0.1.0";
src = self;
nativeBuildInputs = (
with pkgs;
[ ]
) ++ (
with ocamlPackages;
[
ocaml
dune_3
ocaml-lsp
ocamlformat
menhir
]
);
buildPhase = ''
dune build
'';
installPhase = ''
cp -r _build/default/ $out/
cp $out/bin/main.exe $out/bin/${self.packages.${system}.playground.pname}
'';
};
runtime = pkgs.stdenv.mkDerivation {
pname = "runtime";
version = "0.1.0";
src = self;
nativeBuildInputs = with pkgs; [ gcc gnumake ];
buildPhase = ''
make -C runtime/c/
'';
installPhase = ''
mkdir -p $out/runtime/include
cp runtime/c/libruntime.a $out/runtime/libruntime.a
cp runtime/c/runtime.h $out/runtime/include/runtime.h
'';
};
all = pkgs.symlinkJoin {
pname = "all";
version = "0.1.0";
paths = [
self.packages.${system}.playground
self.packages.${system}.runtime
];
};
default = self.packages.${system}.all;
};
});
}