-
Notifications
You must be signed in to change notification settings - Fork 0
/
warpgate.nix
97 lines (88 loc) · 2.15 KB
/
warpgate.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
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
{ stdenv
, lib
, fetchFromGitHub
, makeWrapper
, rustPlatform
, rust-jemalloc-sys
, nodejs
, yarn
, fetchYarnDeps
, yarn2nix-moretea
, jre
, cargo
}:
let
pname = "warpgate";
version = "0.10.2";
hash = "sha256-WqYE18MHE+A3D4SsAj0Y2ZDmuXHm5s2MuBoRXfIrDPI=";
yarnOfflineCache = fetchYarnDeps {
yarnLock = "${src}/warpgate-web/yarn.lock";
hash = "sha256-tYJvyYDzXQTQigr/uPIgDGHaTBk1EYiu8kNI5EN75DI=";
};
src = fetchFromGitHub {
owner = "warp-tech";
repo = pname;
rev = "v${version}";
hash = hash;
};
warpgate-protocol-http = rustPlatform.buildRustPackage {
inherit pname version src;
cargoLock = {
lockFile = ./Cargo.lock;
};
};
warpgate-ui = stdenv.mkDerivation {
name = "warpgate-web";
src = "${src}";
nativeBuildInputs = [
nodejs
yarn
yarn2nix-moretea.fixup_yarn_lock
jre
cargo
];
configurePhase = ''
export HOME=$(mktemp -d)
'';
buildPhase = ''
yarn --cwd warpgate-web config --offline set yarn-offline-mirror ${yarnOfflineCache}
fixup_yarn_lock ./warpgate-web/yarn.lock
yarn --cwd warpgate-web install --offline \
--frozen-lockfile \
--ignore-engines --ignore-scripts
patchShebangs .
yarn --cwd warpgate-web openapi:schema:gateway
${warpgate-protocol-http}/bin/warpgate-protocol-http > src/gateway/lib/openapi-schema.json
yarn openapi:client:gateway
yarn build
'';
installPhase = ''
mkdir $out
mv build/* $out
'';
};
in
rustPlatform.buildRustPackage rec {
inherit pname version src ;
cargoLock = {
lockFile = ./Cargo.lock;
};
sourceRoot = "${src.name}/warpgate";
preBuild = ''
mkdir -p warpgate-web/build
cp -r ${warpgate-ui}/* warpgate-web/build
'';
nativeBuildInputs = [
makeWrapper
];
buildInputs = [
rust-jemalloc-sys
];
meta = with lib; {
description = "Smart SSH, HTTPS and MySQL bastion that requires no additional client-side software";
homepage = "https://github.com/warp-tech/warpgate";
license = licenses.asl20;
maintainers = with maintainers; [ tcheronneau ];
platforms = platforms.all;
};
}