Skip to content

Commit

Permalink
plugins/lsp: enable auto-installing rustfmt
Browse files Browse the repository at this point in the history
  • Loading branch information
AxerTheAxe committed Nov 7, 2024
1 parent b0ebcaa commit aabbd60
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions plugins/lsp/language-servers/rust-analyzer.nix
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,16 @@ in

# TODO: make nullable
rustcPackage = mkPackageOption pkgs "rustc" { };

installRustfmt = mkOption {
type = with types; nullOr bool;
default = null;
example = true;
description = "Whether to install `rustfmt`.";
};

# TODO: make nullable
rustfmtPackage = mkPackageOption pkgs "rustfmt" { };
};
config = mkIf cfg.enable {
warnings =
Expand All @@ -56,7 +66,8 @@ in

extraPackages =
with pkgs;
(optional ((isBool cfg.installCargo) && cfg.installCargo) cfg.cargoPackage)
++ (optional ((isBool cfg.installRustc) && cfg.installRustc) cfg.rustcPackage);
optional (isBool cfg.installCargo && cfg.installCargo) cfg.cargoPackage
++ optional (isBool cfg.installRustc && cfg.installRustc) cfg.rustcPackage
++ optional (isBool cfg.installRustfmt && cfg.installRustfmt) cfg.rustfmtPackage;
};
}

0 comments on commit aabbd60

Please sign in to comment.