-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathdefault.nix
51 lines (44 loc) · 1.04 KB
/
default.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
{ lib
, nixosTests
, stdenv
, fetchFromGitHub
, makeWrapper
, nodejs
, pkgs
}:
stdenv.mkDerivation rec {
pname = "hoon-language-server";
version = "0.1.2";
nativeBuildInputs = [
nodejs
makeWrapper
];
src = ./.;
buildPhase =
let
nodeDependencies = ((import ./node-composition.nix {
inherit pkgs nodejs;
inherit (stdenv.hostPlatform) system;
}).nodeDependencies.override (old: {
# access to path '/nix/store/...-source' is forbidden in restricted mode
src = ./.;
dontNpmInstall = true;
}));
in
''
runHook preBuild
rm -rf node_modules
ln -s ${nodeDependencies}/lib/node_modules .
export PATH="${nodeDependencies}/bin:$PATH"
npm run build
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir -p $out/share
cp -a . $out/share/hoon-language-server
makeWrapper ${nodejs}/bin/node $out/bin/hoon-language-server \
--add-flags $out/share/hoon-language-server/out/server.js
runHook postInstall
'';
}