-
Notifications
You must be signed in to change notification settings - Fork 2
/
shell.nix
53 lines (48 loc) · 1.8 KB
/
shell.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
{ pkgs ? (import <nixpkgs> {}) }:
with pkgs.lib;
let
# https://github.com/rescript-lang/rescript-vscode
rescript-lsp = pkgs.fetchzip rec {
name = "rescript-vscode-1.1.2";
url = "https://github.com/rescript-lang/rescript-vscode/releases/download/1.1.2/${name}.vsix";
sha256 = "1xniz8qz7ccdaqvrajpmmgrjq8xzl5jd8r4acpbdab2jbgwxa9cv";
# Changing this will *not* be take into account if this derivation
# has already been evaluated successfully. You need to remove it
# manually from the nix store first:
# sudo nix-store --delete --ignore-liveness /nix/store/<path-to-rescripte-vscode-1.1.2-out>
postFetch = ''
unzip $downloadedFile -d $out
# Patch binary
# https://nixos.wiki/wiki/Packaging/Binaries
patchelf \
--set-interpreter "$(cat ${pkgs.gcc}/nix-support/dynamic-linker)" \
"$out/extension/server/analysis_binaries/linux/rescript-editor-analysis.exe"
'';
};
# Set emacs variable `lsp-rescript-server-command' with the path of
# `server.js` from rescript-vscode.
# https://github.com/jjlee/rescript-mode
emacs-lsp-rescript-server-cmd = ''
(customize-set-variable
'lsp-rescript-server-command
'("${pkgs.nodejs}/bin/node" "${rescript-lsp}/extension/server/out/server.js" "--stdio"))
'';
emacs-wrapper = pkgs.writeShellScriptBin "emacs" ''
${pkgs.emacs}/bin/emacs --eval=${strings.escapeShellArg emacs-lsp-rescript-server-cmd} "$@"
'';
in
pkgs.mkShell {
buildInputs = [
pkgs.nodejs pkgs.python3Minimal
emacs-wrapper
pkgs.opam
pkgs.stdenv.cc.cc
];
shellHook = ''
echo "rescript-vscode path: "
echo ${rescript-lsp}
# For patchelf of ninja.exe in rescritp-compiler
echo "libstdc++.so.6: "
echo ${pkgs.stdenv.cc.cc.lib}/lib
'';
}