Repository navigation
Expand file tree
/
Copy pathflake.nix
More file actions
80 lines (73 loc) · 2.48 KB
/
Copy pathflake.nix
File metadata and controls
80 lines (73 loc) · 2.48 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
{
description = "rs4a developer environment";
inputs = {
flake-utils.url = "github:numtide/flake-utils";
mkhelp = {
url = "github:apljungquist/mkhelp-rs";
inputs.rust-overlay.follows = "rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
nixpkgs.url = "github:NixOS/nixpkgs/25.11";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{
self,
flake-utils,
mkhelp,
nixpkgs,
rust-overlay,
...
}:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ (import rust-overlay) ];
};
rustToolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
rustPlatform = pkgs.makeRustPlatform {
rustc = rustToolchain;
cargo = rustToolchain;
};
buildWorkspaceMember = dir: pkgs.callPackage ./nix/default.nix { inherit rustPlatform dir; };
acap-native-sdk = pkgs.callPackage ./nix/acap-native-sdk.nix { };
in
{
formatter = pkgs.nixfmt-rfc-style;
checks = self.packages.${system};
packages = {
inherit acap-native-sdk;
cli4a = buildWorkspaceMember "cli4a";
device-finder = buildWorkspaceMember "device-finder";
device-inventory = buildWorkspaceMember "device-inventory";
device-manager = buildWorkspaceMember "device-manager";
firmware-inventory = buildWorkspaceMember "firmware-inventory";
};
devShells.default = pkgs.mkShell {
nativeBuildInputs = with pkgs; [
clang
fd
git
mkhelp.packages.${system}.default
nixfmt-rfc-style
rustToolchain
];
shellHook = ''
# Prevent cargo from finding programs in the default cargo home by **appending** it to the path because
# otherwise cargo will **prepend** it to the path e.g. when looking for clippy.
export PATH="$PATH:$HOME/.cargo/bin"
# Tell rust-analyzer where to find the standard library
export RUST_SRC_PATH="${rustToolchain}/lib/rustlib/src/rust/library"
# Some aspects of the SDK are known to break when extracted to a location different from `/opt/axis`:
# - `acap-build`
export ACAP_SDK_LOCATION="${acap-native-sdk}"
'';
};
}
);
}