From 913f94af3cfb1b7f9bfd0598e45b86549c9f5dd1 Mon Sep 17 00:00:00 2001 From: Erwin Boskma Date: Fri, 10 Mar 2023 12:56:36 +0100 Subject: [PATCH] Add cargo module --- home-manager/modules/cargo/default.nix | 27 ++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 home-manager/modules/cargo/default.nix diff --git a/home-manager/modules/cargo/default.nix b/home-manager/modules/cargo/default.nix new file mode 100644 index 0000000..396b84e --- /dev/null +++ b/home-manager/modules/cargo/default.nix @@ -0,0 +1,27 @@ +{ 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; + }; + }; +}