|
1 | 1 | { |
2 | | - description = "Nll crate"; |
| 2 | + description = "A devShell example"; |
3 | 3 |
|
4 | | - nixConfig = { |
5 | | - extra-substituters = [ "https://espresso-systems-private.cachix.org" ]; |
6 | | - extra-trusted-public-keys = [ |
7 | | - "espresso-systems-private.cachix.org-1:LHYk03zKQCeZ4dvg3NctyCq88e44oBZVug5LpYKjPRI=" |
8 | | - ]; |
9 | | - }; |
| 4 | + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; |
| 5 | + inputs.rust-overlay.url = "github:oxalica/rust-overlay"; |
| 6 | + inputs.flake-utils.url = "github:numtide/flake-utils"; |
10 | 7 |
|
11 | | - inputs = { |
12 | | - nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; |
13 | | - utils.url = "github:numtide/flake-utils"; |
14 | | - flake-compat = { |
15 | | - url = "github:edolstra/flake-compat"; |
16 | | - flake = false; |
17 | | - }; |
18 | | - fenix = { |
19 | | - url = "github:nix-community/fenix"; |
20 | | - inputs.nixpkgs.follows = "nixpkgs"; |
21 | | - }; |
22 | | - }; |
23 | | - |
24 | | - outputs = |
25 | | - { self, nixpkgs, flake-compat, utils, fenix }: |
26 | | - utils.lib.eachDefaultSystem (system: |
| 8 | + outputs = { nixpkgs, rust-overlay, flake-utils, ... }: |
| 9 | + flake-utils.lib.eachDefaultSystem (system: |
27 | 10 | let |
28 | | - fenixStable = fenix.packages.${system}.stable.withComponents [ |
29 | | - "cargo" |
30 | | - "clippy" |
31 | | - "rust-src" |
32 | | - "rustc" |
33 | | - "rustfmt" |
34 | | - "llvm-tools-preview" |
35 | | - ]; |
36 | | - |
37 | | - CARGO_TARGET_DIR = "target_dirs/nix_rustc"; |
38 | | - |
39 | | - rustOverlay = final: prev: { |
40 | | - rustc = fenixStable; |
41 | | - cargo = fenixStable; |
42 | | - rust-src = fenixStable; |
43 | | - }; |
44 | | - |
| 11 | + overlays = [ (import rust-overlay) ]; |
45 | 12 | pkgs = import nixpkgs { |
46 | | - inherit system; |
47 | | - overlays = [ rustOverlay ]; |
| 13 | + inherit system overlays; |
48 | 14 | }; |
49 | | - |
50 | | - buildDeps = with pkgs; |
51 | | - [ |
52 | | - nixpkgs-fmt |
53 | | - fenix.packages.${system}.rust-analyzer |
54 | | - ] ++ lib.optionals stdenv.isDarwin [ |
55 | | - darwin.apple_sdk.frameworks.Security |
56 | | - pkgs.libiconv |
57 | | - darwin.apple_sdk.frameworks.SystemConfiguration |
| 15 | + in |
| 16 | + with pkgs; |
| 17 | + { |
| 18 | + CARGO_TARGET_DIR = "target_dirs/nix_rustc"; |
| 19 | + devShells.default = mkShell { |
| 20 | + buildInputs = [ |
| 21 | + just |
| 22 | + rust-bin.stable.latest.default |
58 | 23 | ]; |
59 | | - in { |
60 | | - devShell = pkgs.mkShell { |
61 | | - inherit CARGO_TARGET_DIR; |
62 | | - buildInputs = [ fenixStable ] ++ buildDeps; |
63 | 24 | }; |
64 | | - |
65 | | - }); |
| 25 | + } |
| 26 | + ); |
66 | 27 | } |
0 commit comments