cargo: add module
This commit is contained in:
parent
c220f242cd
commit
86ff0ef506
6 changed files with 94 additions and 0 deletions
43
modules/programs/cargo.nix
Normal file
43
modules/programs/cargo.nix
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
{
|
||||
lib,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (lib) mkEnableOption;
|
||||
|
||||
tomlFormat = pkgs.formats.toml { };
|
||||
|
||||
cfg = config.programs.cargo;
|
||||
in
|
||||
{
|
||||
meta.maintainers = [ lib.maintainers.friedrichaltheide ];
|
||||
|
||||
options = {
|
||||
programs = {
|
||||
cargo = {
|
||||
enable = mkEnableOption "management of cargo config";
|
||||
|
||||
settings = lib.mkOption {
|
||||
inherit (tomlFormat) type;
|
||||
default = { };
|
||||
description = ''
|
||||
Available configuration options for the .cargo/config see:
|
||||
https://doc.rust-lang.org/cargo/reference/config.html
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
home = {
|
||||
file = {
|
||||
".cargo/config.toml" = {
|
||||
source = tomlFormat.generate "config.toml" cfg.settings;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue