{
  config,
  lib,
  pkgs,
  ...
}:

{
  imports = [ ];

  options.me = {
    rust.enable = lib.mkOption {
      type = lib.types.bool;
      default = false;
      example = true;
      description = "Whether we want to install rust.";
    };
  };

  config = lib.mkIf config.me.rust.enable (
    lib.mkMerge [
      {
        environment.systemPackages = with pkgs; [
          rustup
          lldb # for lldb-vscode
          musl # for building static binaries
          rust-analyzer
          cargo-semver-checks
          # ? cargo-bloat
          # ? cargo-outdated
          # ? cargo-public-api
        ];

        home-manager.users.talexander =
          { pkgs, ... }:
          {
            home.file = {
              ".cargo/config.toml" = {
                source = ./files/cargo_config.toml;
              };
              # # TODO: Figure out what to do with credentials.
              # ".cargo/credentials.toml" = {
              #   source = ./files/cargo_credentials.toml;
              # };
            };
          };

      }
    ]
  );
}

# TODO: Install clippy, cranelift, rust-src
# TODO: Install rust targets x86_64-unknown-linux-musl and wasm32-unknown-unknown