/ modules / common / rust.nix
rust.nix
 1  {
 2    config,
 3    lib,
 4    pkgs,
 5    ...
 6  }:
 7  let
 8    inherit (lib) attrValues makeLibraryPath mkIf;
 9  in
10  {
11    environment.variables = {
12      CARGO_NET_GIT_FETCH_WITH_CLI = "true";
13  
14      LIBRARY_PATH = mkIf config.isDarwin (
15        makeLibraryPath (attrValues {
16          inherit (pkgs) libiconv;
17        })
18      );
19    };
20  
21    environment.systemPackages = attrValues {
22      inherit (pkgs)
23        cargo-deny
24        cargo-expand
25        cargo-fuzz
26        cargo-nextest
27        evcxr
28        taplo
29        ;
30  
31      fenix = pkgs.fenix.complete.withComponents [
32        "cargo"
33        "clippy"
34        "rust-src"
35        "rustc"
36        "rustfmt"
37      ];
38    };
39  }