nixos-config/home-manager/modules/cargo/default.nix
2023-03-10 12:56:36 +01:00

27 lines
622 B
Nix

{ pkgs, config, lib, ... }:
with lib;
let
cfg = config.eboskma.programs.cargo;
tomlFormat = pkgs.formats.toml { };
cargoConfig = types.submodule {
freeformType = tomlFormat.type;
};
in
{
options.eboskma.programs.cargo = {
enable = mkEnableOption "cargo";
settings = mkOption {
description = "Cargo configuration according to https://doc.rust-lang.org/cargo/reference/config.html";
default = { };
type = cargoConfig;
};
};
config = mkIf cfg.enable {
home.file.".cargo/config.toml" = {
source = tomlFormat.generate "cargo-config.toml" cfg.settings;
};
};
}