forked from genlayerlabs/genvm
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdefault.nix
More file actions
75 lines (65 loc) · 1.63 KB
/
default.nix
File metadata and controls
75 lines (65 loc) · 1.63 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
{ pkgs
, root-src
, compile-rust
, components
, get-root-subtree
, build-config
, patch-yaml-schema
, ...
}:
let
lib = pkgs.lib;
make-for-target = target:
let
exe = compile-rust rec {
inherit target;
pname = "genvm-bin";
version = build-config.executor-version;
cargoLock.lockFile = ./Cargo.lock;
src = get-root-subtree [
"executor/src"
"modules/interfaces"
"executor/common"
"executor/third-party"
"executor/Cargo.toml"
"executor/Cargo.lock"
"doc/schemas"
];
sourceRoot = "./source/executor";
extraLibs = if target == "arm64-macos" then [ components.${target}.libiconv ] else [ components.${target}.libc ];
GENVM_PROFILE = build-config.executor-version;
};
in pkgs.stdenvNoCC.mkDerivation rec {
name = "genvm-executor-${target}";
srcs = [
exe
./install
];
dontUnpack = true;
dontConfigure = true;
dontBuild = true;
nativeBuildInputs = [ pkgs.makeWrapper patch-yaml-schema ];
installPhase = ''
mkdir -p $out/executor/${build-config.executor-version}/bin
cp ${exe} "$out/executor/${build-config.executor-version}/bin/genvm"
for src in $srcs; do
if [[ "$src" != "${exe}" ]]
then
cp --no-preserve=ownership -r "$src/." "$out/executor/${build-config.executor-version}/."
fi
done
chmod -R u+w "$out"
patch-yaml-schema --tag ${build-config.executor-version} "$out"
'';
};
in {
amd64-linux-executor = {
executor = make-for-target "amd64-linux";
};
arm64-linux-executor = {
executor = make-for-target "arm64-linux";
};
arm64-macos-executor = {
executor = make-for-target "arm64-macos";
};
}