-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdefault.nix
More file actions
48 lines (48 loc) · 1.32 KB
/
default.nix
File metadata and controls
48 lines (48 loc) · 1.32 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
{ ocaml
, ocamlPackages
, trivialBuild
, ocp-indent
, emacs
, tuareg
, merlin
, smartparens
, multiple-cursors
, lib
, nix-filter }:
let
duneProjectContents = builtins.readFile ./dune-project;
version = builtins.head (builtins.match "\.*\\(version ([[:digit:]\.]+)\\)\.*" duneProjectContents) + ".git";
pname = "gopcaml-mode";
ocamlPackage = ocamlPackages.buildDunePackage rec {
inherit version pname;
duneVersion = "3";
src = nix-filter.lib {
root = ./.;
include =
[ "parser" ] ++
(map nix-filter.lib.matchName
[ "dune" "dune-project"])
++ (map nix-filter.lib.matchExt [ "ml" "el" "mli" "opam"]);
};
buildInputs = with ocamlPackages; [
ppx_let ppx_deriving ppx_sexp_conv ecaml core
];
postInstall = ''
path="$out/lib/ocaml/${ocaml.version}/site-lib/${pname}/gopcaml.so"
sed -i "s/\(gopcaml-library-path\) nil/\1\ \"''${path//\//\\/}\"/g" $out/share/emacs/site-lisp/gopcaml-mode.el
'';
};
in (trivialBuild {
inherit version pname;
src = ocamlPackage;
unpackPhase = ''
cp $src/share/emacs/site-lisp/*.el .
'';
# optional dependencies
buildInputs = [ smartparens multiple-cursors ];
packageRequires = [ ocp-indent tuareg merlin ];
meta = with lib; {
license = licenses.gpl3;
inherit (emacs.meta) platforms;
};
})