-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathflake.nix
59 lines (52 loc) · 1.71 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
50
51
52
53
54
55
56
57
58
59
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
fenix.url = "github:nix-community/fenix/monthly";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils, ... }@inputs: flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ inputs.fenix.overlays.default ];
};
buildDependencies = with pkgs; [];
runtimeDependencies = with pkgs; [
mold
lld
sccache
pkg-config
];
components = [
"rustc"
"cargo"
"clippy"
"rustfmt"
"rust-analyzer"
"rust-src"
"llvm-tools-preview"
# Nightly
"rustc-codegen-cranelift-preview"
"miri"
];
nightly = pkgs.fenix.complete.withComponents components;
stable = pkgs.fenix.stable.withComponents ( nixpkgs.lib.sublist 0 (builtins.length components - 3) components );
in {
devShells.default = pkgs.mkShell rec {
nativeBuildInputs = with pkgs; [
nightly
# stable
fenix.targets.x86_64-unknown-linux-gnu.latest.rust-std
rustup
cargo-msrv
openssl.dev
] ++ buildDependencies;
buildInputs = runtimeDependencies;
RUST_SRC_PATH = "${pkgs.fenix.complete.rust-src}/lib/rustlib/src/rust/library";
RUSTC_WRAPPER = "sccache";
RUSTFLAGS = "-Ctarget-cpu=native -Clink-arg=-fuse-ld=mold";
MSRVFLAGS = "-Clink-arg=-fuse-ld=mold"; # RUSTFLAGS=$MSRVFLAGS cargo msrv
LD_LIBRARY_PATH = with pkgs; lib.makeLibraryPath nativeBuildInputs;
};
});
}