File tree Expand file tree Collapse file tree 1 file changed +79
-0
lines changed
Expand file tree Collapse file tree 1 file changed +79
-0
lines changed Original file line number Diff line number Diff line change 1+ {
2+ description = "A Nix-flake-based Rust development environment" ;
3+
4+ inputs = {
5+ nixpkgs . url = "https://flakehub.com/f/NixOS/nixpkgs/0.1" ; # unstable Nixpkgs
6+ fenix = {
7+ url = "https://flakehub.com/f/nix-community/fenix/0.1" ;
8+ inputs . nixpkgs . follows = "nixpkgs" ;
9+ } ;
10+ } ;
11+
12+ outputs =
13+ { self , ... } @inputs :
14+
15+ let
16+ supportedSystems = [
17+ "x86_64-linux"
18+ "aarch64-linux"
19+ "x86_64-darwin"
20+ "aarch64-darwin"
21+ ] ;
22+ forEachSupportedSystem =
23+ f :
24+ inputs . nixpkgs . lib . genAttrs supportedSystems (
25+ system :
26+ f {
27+ pkgs = import inputs . nixpkgs {
28+ inherit system ;
29+ overlays = [
30+ inputs . self . overlays . default
31+ ] ;
32+ } ;
33+ }
34+ ) ;
35+ in
36+ {
37+ overlays . default = final : prev : {
38+ rustToolchain = inputs . fenix . packages . ${ prev . stdenv . hostPlatform . system } . fromToolchainFile {
39+ dir = ./. ;
40+ } ;
41+ # combine (
42+ # with latest;
43+ # [
44+ # clippy
45+ # rustc
46+ # cargo
47+ # rustfmt
48+ # rust-src
49+ # rustc-dev
50+ # llvm-tools-preview
51+ # ]
52+ # );
53+ } ;
54+
55+ devShells = forEachSupportedSystem (
56+ { pkgs } :
57+ {
58+ default = pkgs . mkShellNoCC {
59+ packages = with pkgs ; [
60+ rustToolchain
61+ openssl
62+ pkg-config
63+ cargo-deny
64+ cargo-edit
65+ cargo-watch
66+ rust-analyzer
67+ clang
68+ ] ;
69+
70+ env = {
71+ CARGO_HOME = "/home/erin/.cargo" ;
72+ # Required by rust-analyzer
73+ RUST_SRC_PATH = "${ pkgs . rustToolchain } /lib/rustlib/src/rust/library" ;
74+ } ;
75+ } ;
76+ }
77+ ) ;
78+ } ;
79+ }
You can’t perform that action at this time.
0 commit comments