-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
55 lines (53 loc) · 1.75 KB
/
flake.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
{
description = "Rust environment";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
utils.url = "github:numtide/flake-utils";
rust-overlay.url = "github:oxalica/rust-overlay";
mach-nix.url = "mach-nix/3.4.0";
};
outputs = { self, nixpkgs, utils, rust-overlay, mach-nix, ... }:
utils.lib.eachDefaultSystem (system:
let
overlays = [
(import rust-overlay)
(self: super: {
renode = super.callPackage ./renode.nix {};
})
];
pkgs = import nixpkgs {
inherit system overlays;
};
rust-toolchain = pkgs.rust-bin.selectLatestNightlyWith
(toolchain: toolchain.default.override {
extensions = [ "rust-src" ];
targets = [ "thumbv7em-none-eabihf" "thumbv7em-none-eabi" ];
});
renode-python = mach-nix.lib.${system}.mkPython {
requirements = builtins.readFile "${pkgs.renode}/opt/renode/tests/requirements.txt";
};
renode-test-script = pkgs.writeScriptBin "renode-test" ''
python -u ${pkgs.renode}/opt/renode/tests/run_tests.py \
--robot-framework-remote-server-full-directory=${pkgs.renode}/bin \
--robot-framework-remote-server-name=renode \
--css-file=${pkgs.renode}/opt/renode/tests/robot.css \
--runner=none \
-r test-results $@
'';
in
{
# `nix develop`
devShell = pkgs.mkShell {
buildInputs = with pkgs;
[
rust-toolchain
renode
gcc-arm-embedded # gdb
renode-python
renode-test-script
];
RENODE_PATH = "${pkgs.renode}/opt/renode/";
};
}
);
}