nixos-config/home-manager/modules/cargo/default.nix

31 lines
624 B
Nix
Raw Normal View History

2024-02-05 11:46:52 +01:00
{
pkgs,
config,
lib,
...
}:
2023-03-10 12:56:36 +01:00
with lib;
let
cfg = config.eboskma.programs.cargo;
tomlFormat = pkgs.formats.toml { };
2024-02-05 11:46:52 +01:00
cargoConfig = types.submodule { freeformType = tomlFormat.type; };
2023-03-10 12:56:36 +01:00
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;
};
};
}