-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
105 lines (101 loc) · 3 KB
/
flake.nix
File metadata and controls
105 lines (101 loc) · 3 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
{
description = "A reproducible development environment for ASPFuzz";
# Flake inputs
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; # also valid: "nixpkgs"
flake-utils.url = "github:numtide/flake-utils";
rust-overlay = {
url = "github:oxalica/rust-overlay"; # A helper for Rust + Nix
inputs = {
nixpkgs.follows = "nixpkgs";
};
};
};
# Flake outputs
outputs = {
self,
nixpkgs,
flake-utils,
rust-overlay,
}:
flake-utils.lib.eachDefaultSystem (
system: let
# Overlays enable you to customize the Nixpkgs attribute set
overlays = [
# Makes a `rust-bin` attribute available in Nixpkgs
(import rust-overlay)
# Provides a `rustToolchain` attribute for Nixpkgs that we can use to
# create a Rust environment
(
self: super: {
rustToolchain = super.rust-bin.selectLatestNightlyWith (toolchain:
toolchain.default.override {
extensions = ["rust-src" "llvm-tools-preview" "rust-analyzer"];
});
}
)
];
pkgs = import nixpkgs {inherit overlays system;};
# Must match rustc's LLVM version (rustc --version --verbose)
# libafl_qemu_build requires llvm-config >= rustc's LLVM for bindgen
llvm = pkgs.llvmPackages_22;
python = pkgs.python3;
python_pkgs = pkgs.python3Packages;
# Things needed to build the software
nativeBuildInputs = with pkgs; [
rustToolchain
just
gcc-arm-embedded
git
llvm.clang
pkg-config
rust-bindgen-unwrapped
llvm.libllvm
llvm.libclang
libgit2
cmake
meson
ninja
python_pkgs.libfdt
python_pkgs.black
python_pkgs.sphinx
python_pkgs.sphinx-rtd-theme
python
];
# Runtime dependencies
buildInputs = with pkgs; [
nettle
zlib
z3
glib
libgcrypt
llvm.libcxx
pixman
libx11
];
in
with pkgs; {
formatter = alejandra;
# Development environment output
devShells.default = mkShell {
inherit nativeBuildInputs buildInputs;
hardeningDisable = ["fortify"];
# The Nix packages provided in the environment
packages =
(with pkgs; [
# DevTools
zsh
qemu-utils # For the qemu_systemmode example in LibAFL
# getting Rustanalyzer to work
openssl
libz
cargo-watch
])
++ pkgs.lib.optionals pkgs.stdenv.isDarwin (with pkgs; [libiconv]);
LIBCLANG_PATH = "${llvm.libclang.lib}/lib";
CC = "${llvm.clang.out}/clang";
CXX = "${llvm.clang.out}/clang++";
};
}
);
}