-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathflake.nix
More file actions
76 lines (71 loc) · 2.07 KB
/
flake.nix
File metadata and controls
76 lines (71 loc) · 2.07 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
70
71
72
73
74
75
{
inputs = {
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:nixos/nixpkgs";
opam-repository = {
url = "github:ocaml/opam-repository";
flake = false;
};
opam-nix = {
url = "github:tweag/opam-nix";
inputs.opam-repository.follows = "opam-repository";
};
magic-trace-src = {
url = "https://github.com/janestreet/magic-trace/releases/download/v1.1.0/magic-trace";
flake = false;
};
#eio = {
# url = "github:ocaml-multicore/eio";
# flake = false;
#};
};
outputs = { self, flake-utils, opam-nix, nixpkgs, opam-repository, magic-trace-src}:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
magic-trace = pkgs.stdenv.mkDerivation {
name = "magic-trace";
src = magic-trace-src;
dontUnpack = true;
buildInputs = [pkgs.makeWrapper];
installPhase = ''
mkdir -p $out/bin
cp $src $out/bin/magic-trace
chmod +x $out/bin/magic-trace
'';
postFixup = ''
wrapProgram $out/bin/magic-trace \
--set PATH ${pkgs.lib.makeBinPath [
pkgs.fzf
pkgs.linuxPackages_latest.perf
]}
'';
};
on = opam-nix.lib.${system};
devPackagesQuery = {
ocaml-lsp-server = "*";
ocamlformat = "0.25.1";
utop = "*";
};
repos = [
opam-repository
];
query = devPackagesQuery // {
ocaml-base-compiler = "5.1.0";
ocamlfind = "1.9.5";
};
scope = on.buildDuneProject { inherit repos; } "ocons" ./. query;
devPackages = builtins.attrValues
(pkgs.lib.getAttrs (builtins.attrNames query) scope);
in
{
defaultPackage = scope.ocons;
devShell = pkgs.mkShell {
inputsFrom = [scope.ocons];
buildInputs = devPackages ++ [
pkgs.linuxPackages_latest.perf
magic-trace
];
};
});
}