|
8 | 8 | };
|
9 | 9 |
|
10 | 10 | # Flake outputs
|
11 |
| - outputs = { self, nixpkgs, rust-overlay }: |
12 |
| - let |
13 |
| - # Overlays enable you to customize the Nixpkgs attribute set |
14 |
| - overlays = [ |
15 |
| - # Makes a `rust-bin` attribute available in Nixpkgs |
16 |
| - (import rust-overlay) |
17 |
| - # Provides a `rustToolchain` attribute for Nixpkgs that we can use to |
18 |
| - # create a Rust environment |
19 |
| - (self: super: { |
20 |
| - rustToolchain = super. rust-bin.stable.latest.default.override { |
21 |
| - targets = [ "wasm32-unknown-unknown" ]; |
22 |
| - extensions = [ "rustfmt" "llvm-tools-preview" ]; |
23 |
| - }; |
24 |
| - }) |
25 |
| - ]; |
26 |
| - |
27 |
| - # Systems supported |
28 |
| - allSystems = [ |
29 |
| - "x86_64-linux" # 64-bit Intel/AMD Linux |
30 |
| - "aarch64-linux" # 64-bit ARM Linux |
31 |
| - "x86_64-darwin" # 64-bit Intel macOS |
32 |
| - "aarch64-darwin" # 64-bit ARM macOS |
33 |
| - ]; |
| 11 | + outputs = { |
| 12 | + self, |
| 13 | + nixpkgs, |
| 14 | + rust-overlay, |
| 15 | + }: let |
| 16 | + # Overlays enable you to customize the Nixpkgs attribute set |
| 17 | + overlays = [ |
| 18 | + # Makes a `rust-bin` attribute available in Nixpkgs |
| 19 | + (import rust-overlay) |
| 20 | + # Provides a `rustToolchain` attribute for Nixpkgs that we can use to |
| 21 | + # create a Rust environment |
| 22 | + (self: super: { |
| 23 | + rustToolchain = super.rust-bin.stable.latest.default.override { |
| 24 | + targets = ["wasm32-unknown-unknown"]; |
| 25 | + extensions = ["rustfmt" "llvm-tools-preview"]; |
| 26 | + }; |
| 27 | + }) |
| 28 | + ]; |
34 | 29 |
|
35 |
| - # Helper to provide system-specific attributes |
36 |
| - forAllSystems = f: nixpkgs.lib.genAttrs allSystems (system: f { |
37 |
| - pkgs = import nixpkgs { inherit overlays system; }; |
38 |
| - }); |
| 30 | + # Systems supported |
| 31 | + allSystems = [ |
| 32 | + "x86_64-linux" # 64-bit Intel/AMD Linux |
| 33 | + "aarch64-linux" # 64-bit ARM Linux |
| 34 | + "x86_64-darwin" # 64-bit Intel macOS |
| 35 | + "aarch64-darwin" # 64-bit ARM macOS |
| 36 | + ]; |
39 | 37 |
|
40 |
| - in |
41 |
| - { |
42 |
| - # Development environment output |
43 |
| - devShells = forAllSystems ({ pkgs }: { |
44 |
| - default = pkgs.mkShell { |
45 |
| - # The Nix packages provided in the environment |
46 |
| - packages = (with pkgs; [ |
| 38 | + # Helper to provide system-specific attributes |
| 39 | + forAllSystems = f: |
| 40 | + nixpkgs.lib.genAttrs allSystems (system: |
| 41 | + f { |
| 42 | + pkgs = import nixpkgs {inherit overlays system;}; |
| 43 | + }); |
| 44 | + in { |
| 45 | + # Development environment output |
| 46 | + devShells = forAllSystems ({pkgs}: { |
| 47 | + default = pkgs.mkShell { |
| 48 | + # The Nix packages provided in the environment |
| 49 | + packages = |
| 50 | + (with pkgs; [ |
47 | 51 | # The package provided by our custom overlay. Includes cargo, Clippy, cargo-fmt,
|
48 | 52 | # rustdoc, rustfmt, and other tools.
|
49 | 53 | rustToolchain
|
50 | 54 |
|
51 |
| - cargo-llvm-cov |
52 | 55 | cargo-nextest
|
53 | 56 |
|
54 | 57 | just
|
55 | 58 | openssl
|
56 | 59 | pkg-config
|
57 |
| - ]) ++ pkgs.lib.optionals pkgs.stdenv.isDarwin (with pkgs; [ |
58 |
| - libiconv |
| 60 | + ]) |
| 61 | + ++ pkgs.lib.optionals pkgs.stdenv.isDarwin (with pkgs; [ |
| 62 | + libiconv |
59 | 63 | darwin.apple_sdk.frameworks.Security
|
60 | 64 | ]);
|
61 | 65 |
|
62 |
| - TARGET_CC = "${pkgs.stdenv.cc}/bin/${pkgs.stdenv.cc.targetPrefix}cc"; |
63 |
| - LIBCLANG_PATH = "${pkgs.libclang.lib}/lib"; |
64 |
| - }; |
65 |
| - }); |
66 |
| - }; |
| 66 | + TARGET_CC = "${pkgs.stdenv.cc}/bin/${pkgs.stdenv.cc.targetPrefix}cc"; |
| 67 | + LIBCLANG_PATH = "${pkgs.libclang.lib}/lib"; |
| 68 | + }; |
| 69 | + }); |
| 70 | + }; |
67 | 71 | }
|
0 commit comments