blob: 904be028208a4d7a9f737ea406524adddb02b1ec (
plain)
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
|
{
description = "Kernel development environments";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
};
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, rust-overlay, fenix, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages."${system}";
linuxCommonDependencies = with pkgs; [
gnumake
perl
bison
flex
gmp
libmpc
mpfr
pahole
nettools
bc
rsync
openssl
cpio
elfutils
zstd
python3Minimal
zlib
kmod
ubootTools
llvmPackages.bintools
llvmPackages.clang
llvmPackages.llvm
# For make menuconfig
ncurses
];
rust-analyzer = fenix.packages."${system}".rust-analyzer;
rustc_1_76 = rust-overlay.packages."${system}".rust_1_76_0.override {
extensions = [
"rust-src"
"rustfmt"
"clippy"
];
};
rust-bindgen_0_65_1 = let
rustPlatform_1_76 = pkgs.makeRustPlatform {
cargo = rustc_1_76;
rustc = rustc_1_76;
};
rust-bindgen-unwrapped_0_65_1 = pkgs.callPackage ./bindgen/0.65.1.nix {
rustPlatform = rustPlatform_1_76;
};
in
pkgs.rust-bindgen.override {
rust-bindgen-unwrapped = rust-bindgen-unwrapped_0_65_1;
};
in
{
devShells.default = self.devShells."${system}".linux_6_8;
devShells.linux_6_8 = pkgs.mkShell {
packages = [
rustc_1_76
rust-bindgen_0_65_1
rust-analyzer
] ++ linuxCommonDependencies;
# To force LLVM build mode. This should create less problems
# with Rust interop.
LLVM = "1";
# Disable all automatically applied hardening. The Linux
# kernel will take care of itself.
NIX_HARDENING_ENABLE = "";
};
}
);
}
|