about summary refs log tree commit diff
path: root/home/rust/default.nix
blob: 2f9ef800e5abafb66aa6c87958b62a93ee3f700c (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.beta.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" ];
  };
}