-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
61 lines (54 loc) · 1.77 KB
/
flake.nix
File metadata and controls
61 lines (54 loc) · 1.77 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
{
description = "Development shell for the comtains Rust byte-set project";
inputs = {
nixpkgs.url = "nixpkgs/nixos-24.05";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachSystem [
"x86_64-linux"
"aarch64-linux"
"aarch64-darwin"
] (system:
let
pkgs = import nixpkgs { inherit system; };
inherit (pkgs) lib;
rustPackages = with pkgs; [
rustc
cargo
rustfmt
clippy
];
baseInputs = with pkgs; [
pkg-config
openssl
zlib
cmake
python3
];
valgrindPackage =
if (system == "aarch64-darwin") then null else pkgs.valgrind;
in {
devShells.default = pkgs.mkShell {
buildInputs =
rustPackages
++ baseInputs
++ lib.optional (valgrindPackage != null) valgrindPackage;
shellHook = ''
export CARGO_HOME="''${CARGO_HOME:-$PWD/.cargo}"
export PATH="$CARGO_HOME/bin:$PATH"
if [ "${system}" = "aarch64-darwin" ]; then
echo "⚠️ Valgrind/Callgrind is unavailable on Apple Silicon macOS."
echo " The iai-callgrind benchmarks will compile but cannot be executed."
else
if ! command -v iai-callgrind-runner >/dev/null 2>&1; then
echo "Installing iai-callgrind-runner (once per shell) ..."
cargo install --locked --version 0.15.2 iai-callgrind-runner
fi
export IAI_CALLGRIND_RUNNER="$(command -v iai-callgrind-runner)"
echo "IAI_CALLGRIND_RUNNER=$IAI_CALLGRIND_RUNNER"
fi
'';
};
});
}