-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
64 lines (55 loc) · 1.76 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
60
61
62
63
64
{
description = "Rust toolchain";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
rust-overlay.url = "github:oxalica/rust-overlay";
};
outputs = { self, nixpkgs, rust-overlay }:
let
overlays = [
(import rust-overlay)
(self: super: {
rustToolchain = super.rust-bin.stable.latest.default;
})
];
allSystems = [
"aarch64-darwin" # 64-bit macOS ARM
"aarch64-linux" # 64-bit Linux ARM
"x86_64-linux" # 64-bit Linux Intel/AMD
"x86_64-darwin" # 64-bit macOS Intel
];
forAllSystems = f: nixpkgs.lib.genAttrs allSystems (system: f {
pkgs = import nixpkgs { inherit overlays system; };
});
in
{
devShells = forAllSystems ({ pkgs }: {
default = pkgs.mkShell {
buildInputs = with pkgs; ([
# packages provided by the Rust overlay include:
# cargo, Clippy, cargo-fmt, rustdoc, rustfmt
rustToolchain
] ++ lib.optionals stdenv.isDarwin [
darwin.apple_sdk.frameworks.Security
libiconv # solves the "missing -liconv" issue when running cargo
]);
RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
packages = with pkgs; [
just
tokei
];
shellHook = ''
echo "
Rust Toolchain = ${pkgs.rustToolchain}/bin
Rust Source Path = $RUST_SRC_PATH
"
# health checks for Nix flake inputs
nix run "github:DeterminateSystems/flake-checker"
# rustup default stable
# rustup component add rust-src
git submodule update --init
'';
};
});
};
}