-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathflake.nix
More file actions
71 lines (66 loc) · 2.09 KB
/
Copy pathflake.nix
File metadata and controls
71 lines (66 loc) · 2.09 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
# Copyright lowRISC Contributors.
# Licensed under the MIT License, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
# 25.11 has no LLVM 22, which the pinned nightly needs (see below).
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = {
nixpkgs,
nixpkgs-unstable,
flake-utils,
rust-overlay,
...
}:
flake-utils.lib.eachDefaultSystem (
system: let
pkgs = import nixpkgs {
inherit system;
overlays = [rust-overlay.overlays.default];
};
unstable = import nixpkgs-unstable {inherit system;};
# The eBPF crate needs nightly (`build-std`), so use one nightly
# toolchain for the whole tree, as CI does. Which nightly is pinned by
# the rust-overlay input in flake.lock; bump it with
# `nix flake update rust-overlay`, keeping the LLVM below in step.
rustToolchain = pkgs.rust-bin.selectLatestNightlyWith (
toolchain:
toolchain.default.override {
extensions = ["rust-src"];
}
);
# bpf-linker must be built against the same LLVM major as the
# toolchain above, or it cannot read the bitcode rustc emits.
llvmPackages = unstable.llvmPackages_22;
bpf-linker = unstable.bpf-linker.override {
rustc = {
inherit llvmPackages;
inherit (llvmPackages) llvm;
};
};
in {
devShells = {
default = pkgs.mkShell {
buildInputs = with pkgs; [udev];
nativeBuildInputs = [
rustToolchain
pkgs.pkg-config
bpf-linker
# For llvm-objdump
llvmPackages.bintools
# To aid testing
pkgs.runc
];
};
};
formatter = pkgs.alejandra;
}
);
}