-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
83 lines (73 loc) · 2.28 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
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
{
description = "embedano";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/release-22.05";
utils.url = "github:numtide/flake-utils";
cardano-node.url = "github:input-output-hk/cardano-node/1.35.4";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs = {
nixpkgs.follows = "nixpkgs";
flake-utils.follows = "utils";
};
};
};
outputs = inputs@{ self, nixpkgs, utils, rust-overlay, cardano-node, ... }:
(utils.lib.eachSystem [ utils.lib.system.x86_64-linux utils.lib.system.x86_64-darwin] (system:
let
pkgs = import nixpkgs { inherit system; overlays = [ rust-overlay.overlays.default ]; };
# rust = pkgs.rust-bin.stable."1.65.0";
rust = pkgs.rust-bin.nightly.latest.default;
rustDevShell = pkgs.mkShell {
buildInputs = [
cardano-node.packages.${system}.cardano-cli
cardano-node.packages.${system}.bech32
pkgs.nixpkgs-fmt
pkgs.pkg-config
pkgs.libusb
(rust.override {
extensions = [ "rust-analyzer" "rust-src" ];
# targets: Cortex-M3, Cortex-M4/M7 and Cortex-M4F/M7F
targets = [
"thumbv7m-none-eabi"
"thumbv7em-none-eabi"
"thumbv7em-none-eabihf"
];
})
];
};
qemuDevShell = rustDevShell.overrideAttrs (o: {
buildInputs = o.buildInputs ++ [ pkgs.qemu ];
});
in
{
devShells = {
default = rustDevShell;
withQemu = qemuDevShell;
};
checks = {
qemu-example-check = pkgs.runCommand "test-command"
{
buildInputs = [ rust ];
}
''
echo $(cargo version)
cd ${./.}/examples/qemu-example
cargo fmt --check
touch $out
'';
sdk-check = pkgs.runCommand "test-command"
{
buildInputs = [ rust ];
}
''
echo $(cargo version)
cd ${./.}/cardano-embedded-sdk
cargo fmt --check
touch $out
'';
};
})) // {
herculesCI.ciSystems = [ "x86_64-linux" ];
};
}