-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
49 lines (44 loc) · 1.31 KB
/
flake.nix
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
{
inputs = {
utils.url = "github:numtide/flake-utils";
naersk.url = "github:nmattia/naersk";
rust-overlay.url = "github:oxalica/rust-overlay";
};
outputs = { self, nixpkgs, utils, naersk, rust-overlay }:
utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs {
inherit system;
overlays = [
rust-overlay.overlay
];
};
# Get a specific rust version
rust = pkgs.rust-bin.nightly."2021-03-19".rust.override {
extensions = [ "rust-src" "rust-analysis" "llvm-tools-preview" "clippy"];
};
bootimage = pkgs.callPackage ./nix/bootimage.nix {};
# Override the version used in naersk
naersk-lib = naersk.lib."${system}".override {
cargo = rust;
rustc = rust;
};
in rec {
# `nix build`
packages.kernel = naersk-lib.buildPackage {
pname = "kernel";
root = ./.;
};
defaultPackage = packages.kernel;
# `nix run`
apps.kernel = utils.lib.mkApp {
drv = packages.kernel;
};
defaultApp = apps.kernel;
# `nix develop`
devShell = pkgs.mkShell {
# supply the specific rust version
nativeBuildInputs = [ rust bootimage ];
RUST_SRC_PATH = "${rust}/lib/rustlib/src/rust/src";
};
});
}