-
Notifications
You must be signed in to change notification settings - Fork 249
Expand file tree
/
Copy pathflake.nix
More file actions
82 lines (75 loc) · 2.2 KB
/
flake.nix
File metadata and controls
82 lines (75 loc) · 2.2 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
76
77
78
79
80
81
82
{
description = "F*";
inputs = {
flake-utils.url = "flake-utils";
nixpkgs.url = "nixpkgs/nixos-unstable";
};
outputs =
{
flake-utils,
nixpkgs,
self,
}:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = import nixpkgs {
inherit system;
};
ocamlPackages = pkgs.ocaml-ng.ocamlPackages_5_3;
z3 = pkgs.callPackage (import ./.nix/z3.nix) { };
version = self.rev or "dirty";
# Create OCaml library path with .so files for CAML_LD_LIBRARY_PATH
ocamlLibraryPath = pkgs.symlinkJoin {
name = "ocaml-shared-libs";
paths = [
"${ocamlPackages.num}/lib/ocaml/${ocamlPackages.ocaml.version}/site-lib/num"
"${ocamlPackages.zarith}/lib/ocaml/${ocamlPackages.ocaml.version}/site-lib/stublibs"
"${ocamlPackages.stdint}/lib/ocaml/${ocamlPackages.ocaml.version}/site-lib/stublibs"
];
};
fstar = ocamlPackages.callPackage ./.nix/fstar.nix {
inherit version z3 ocamlLibraryPath;
};
emacs = pkgs.writeScriptBin "emacs-fstar" ''
#!${pkgs.stdenv.shell}
export PATH="${fstar}/bin:$PATH"
export EMACSLOADPATH=
${
(pkgs.emacsPackagesFor pkgs.emacs).emacsWithPackages (
epkgs: with epkgs.melpaPackages; [ fstar-mode ]
)
}/bin/emacs -q "$@"
'';
in
{
packages = {
inherit
z3
fstar
emacs
ocamlPackages
;
default = fstar;
# fstar with tests enabled
check = fstar.overrideAttrs (old: {
doCheck = true;
});
};
apps.emacs = {
type = "app";
program = "${emacs}/bin/emacs-fstar";
};
devShells.default = pkgs.mkShell {
name = "${fstar.name}-dev";
inputsFrom = [ fstar ];
buildInputs = [ z3 ];
shellHook = ''
export CAML_LD_LIBRARY_PATH="${ocamlLibraryPath}"
export FSTAR_SOURCES_ROOT="$(pwd)"
export PATH="$FSTAR_SOURCES_ROOT/bin/:$PATH"
'';
};
}
);
}