about summary refs log tree commit diff
path: root/home/rust/default.nix
blob: 9d86ca759e06a9d0713d5795bd3b339465b34a66 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
{ lib, config, pkgs, ... }:
let
  cfg = config.my.home.rust;
  ruststable = (pkgs.rust-bin.stable.latest.default.override {
    extensions = [
      "rust-src"
      "rust-analyzer-preview"
      "rust-analysis"
      "rustfmt-preview"
    ];
  });
in
{
  options.my.home.rust = with lib; {
    enable = mkEnableOption "rust configuration";
  };

  config = lib.mkIf cfg.enable {
    home.packages = with pkgs; [ ruststable ];
    home.sessionVariables.CARGO_HOME = "${config.xdg.dataHome}/cargo";
    home.sessionPath = [ "$CARGO_HOME/bin" ];
  };
}