-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpartitions.nix
103 lines (100 loc) · 2.75 KB
/
partitions.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
98
99
100
101
102
103
{ pkgs, cargoLock, rustPlatform }:
let
mkExample = { rustPlatform, product, example, features, target }: rustPlatform.buildRustPackage {
inherit cargoLock;
pname = example;
version = "0.1.0";
src = ./.;
meta.mainProgram = example;
buildPhase = ''
cargo build --release --target "${target}" -p ${product} --example=${example} --features=${pkgs.lib.concatStringsSep "," features}
'';
doCheck = target != "armv7a-none-eabi";
checkPhase = ''
cargo test --target "${target}" -p ${product} --example=${example} --features=${pkgs.lib.concatStringsSep "," features} --frozen
'';
installPhase = ''
mkdir -p "$out"/{bin,lib}
if [[ "${target}" = "armv7a-none-eabi" ]]
then
cp "target/${target}"/release/examples/*.a "$out/lib"
else
cp "target/${target}/release/examples/${example}" "$out/bin"
fi
'';
};
in
rec
{
echo-linux = rustPlatform.buildRustPackage rec {
inherit cargoLock;
target = "x86_64-unknown-linux-musl";
pname = "echo-linux";
version = "0.1.0";
src = ./.;
buildPhase = ''
cargo build --release --target ${target} -p ${pname}
'';
doCheck = false;
installPhase = ''
mkdir -p "$out"/bin
cp target/${target}/release/echo "$out/bin"
'';
meta.mainProgram = "echo";
};
echo-xng = rustPlatform.buildRustPackage rec {
inherit cargoLock;
target = "armv7a-none-eabi";
pname = "echo-xng";
version = "0.1.0";
src = ./.;
buildPhase = ''
cargo build --release --target ${target} -p ${pname}
'';
doCheck = false;
installPhase = ''
mkdir -p "$out"/lib
cp "target/${target}"/release/*.a "$out/lib"
'';
};
a653rs-router-linux = rustPlatform.buildRustPackage rec {
inherit cargoLock;
pname = "a653rs-router-linux";
target = "x86_64-unknown-linux-musl";
version = "0.1.0";
src = ./.;
buildPhase = ''
cargo build \
--release \
--target ${target} \
--package ${pname} \
--features partition,log,trace \
--bin partition
'';
doCheck = true;
installPhase = ''
mkdir -p "$out/bin"
cp "target/${target}"/release/partition "$out/bin/router"
'';
};
a653rs-router-zynq7000 = rustPlatform.buildRustPackage rec {
inherit cargoLock;
pname = "a653rs-router-zynq7000";
target = "armv7a-none-eabi";
version = "0.1.0";
src = ./.;
buildPhase = ''
cargo build \
--release \
--target ${target} \
--package ${pname} \
--features partition \
--example partition
'';
doCheck = false;
installPhase = ''
mkdir -p "$out/lib"
cp "target/${target}"/release/examples/libpartition.a "$out/lib/librouter.a"
'';
};
}