plugins/lsp: enable auto-installing rustfmt

This commit is contained in:
Katherine Jamison 2024-11-07 11:19:58 -07:00
parent b0ebcaa177
commit aabbd60633
No known key found for this signature in database

View file

@ -30,6 +30,16 @@ in
# TODO: make nullable # TODO: make nullable
rustcPackage = mkPackageOption pkgs "rustc" { }; 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 { config = mkIf cfg.enable {
warnings = warnings =
@ -56,7 +66,8 @@ in
extraPackages = extraPackages =
with pkgs; with pkgs;
(optional ((isBool cfg.installCargo) && cfg.installCargo) cfg.cargoPackage) optional (isBool cfg.installCargo && cfg.installCargo) cfg.cargoPackage
++ (optional ((isBool cfg.installRustc) && cfg.installRustc) cfg.rustcPackage); ++ optional (isBool cfg.installRustc && cfg.installRustc) cfg.rustcPackage
++ optional (isBool cfg.installRustfmt && cfg.installRustfmt) cfg.rustfmtPackage;
}; };
} }