-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathdefault.nix
More file actions
90 lines (75 loc) · 2.12 KB
/
Copy pathdefault.nix
File metadata and controls
90 lines (75 loc) · 2.12 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
82
83
84
85
86
87
88
89
90
{ pkgs
, root-src
, compile-rust
, get-root-subtree
, build-config
, patch-yaml-schema
, patch-rpath
, host-system
, host-system-as-genvm
, compiled-libs
, ...
}@args:
let
manifests-data = import ../runners/support/views/release.nix args;
lib = pkgs.lib;
make-for-target = target:
let
exe = compile-rust rec {
inherit target;
pname = "genvm-executor";
version = build-config.executor-version;
cargoLock.lockFile = ./Cargo.lock;
src = get-root-subtree [
"executor/src"
"modules/interfaces"
"executor/crates"
"executor/third-party"
"executor/Cargo.toml"
"executor/Cargo.lock"
"doc/schemas"
];
sourceRoot = "./source/executor";
extraLibs = compiled-libs.${target};
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
patch-rpath
];
installPhase = ''
mkdir -p $out/executor/${build-config.executor-version}/bin
mkdir -p $out/executor/${build-config.executor-version}/data
cp "${manifests-data.latest}" "$out/executor/${build-config.executor-version}/data/latest.json"
cp "${manifests-data.all}" "$out/executor/${build-config.executor-version}/data/all.json"
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"
patch-rpath --codesign \
--rpath '$ORIGIN/../lib' \
--rpath '$ORIGIN/../../../lib' \
"$out/executor/${build-config.executor-version}/bin/genvm"
'';
};
in {
executor = make-for-target host-system-as-genvm;
executor-amd64-linux = make-for-target "amd64-linux";
executor-arm64-linux = make-for-target "arm64-linux";
executor-arm64-macos = make-for-target "arm64-macos";
}