-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathdefault.nix
More file actions
81 lines (68 loc) · 1.66 KB
/
default.nix
File metadata and controls
81 lines (68 loc) · 1.66 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
76
77
78
79
80
81
{ pkgs
, root-src
, compile-rust
, components
, get-root-subtree
, build-config
, patch-yaml-schema
, patch-manifest
, ...
}:
let
lib = pkgs.lib;
make-for-target = target:
let
exe = compile-rust rec {
inherit target;
pname = "genvm-modules-bin";
version = "0.1.0";
profile = "release-with-debug";
cargoLock.lockFile = ./implementation/Cargo.lock;
src = get-root-subtree [
"modules/implementation"
"modules/interfaces"
"executor/common"
"executor/sdk-rs"
];
sourceRoot = "./source/modules/implementation";
extraLibs = [
components.${target}.liblua
] ++ (if target == "arm64-macos" then [ components.${target}.libiconv ] else [ components.${target}.libc ]);
LUA_LIB_NAME = "lua";
GENVM_PROFILE = build-config.executor-version;
};
in pkgs.stdenvNoCC.mkDerivation rec {
name = "genvm-modules-${target}";
srcs = [
exe
./install
];
dontUnpack = true;
dontConfigure = true;
dontBuild = true;
nativeBuildInputs = [ pkgs.makeWrapper patch-yaml-schema patch-manifest ];
installPhase = ''
mkdir -p $out/bin
cp ${exe} "$out/bin/genvm-modules"
for src in $srcs; do
if [[ "$src" != "${exe}" ]]
then
cp --no-preserve=ownership -r "$src/." "$out/."
fi
done
chmod -R u+w "$out"
patch-yaml-schema --tag ${build-config.executor-version} "$out"
patch-manifest --tag ${build-config.executor-version} "$out/data/manifest.yaml"
'';
};
in {
amd64-linux = {
modules = make-for-target "amd64-linux";
};
arm64-linux = {
modules = make-for-target "arm64-linux";
};
arm64-macos = {
modules = make-for-target "arm64-macos";
};
}