31 lines
688 B
Nix
31 lines
688 B
Nix
{
|
|
config,
|
|
pkgs,
|
|
lib,
|
|
...
|
|
}:
|
|
let
|
|
cfg = config.programs.matugen;
|
|
in
|
|
{
|
|
# https://github.com/Theaninova/matugen/blob/add-home-manager-module/hm-module.nix
|
|
options.programs.matugen =
|
|
with lib;
|
|
with types;
|
|
{
|
|
enable = mkEnableOption "matugen";
|
|
package = mkPackageOption pkgs "matugen" { };
|
|
settings = mkOption {
|
|
type = attrsOf anything;
|
|
description = "Settings to write to config.toml.";
|
|
};
|
|
};
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
home.packages = [ cfg.package ];
|
|
xdg.configFile."matugen/config.toml".source = lib.mkIf (cfg.settings != null) (
|
|
(pkgs.formats.toml { }).generate "matugen" cfg.settings
|
|
);
|
|
};
|
|
}
|