nix-config/modules/home/macchina/default.nix

63 lines
1.2 KiB
Nix
Raw Normal View History

2024-05-07 03:17:46 -04:00
{
lib,
pkgs,
config,
...
}:
with lib; let
cfg = config.programs.macchina;
tomlFormat = pkgs.formats.toml {};
in {
options.programs.macchina = {
enable = mkEnableOption "macchina";
package = mkPackageOption pkgs "macchina" {};
config = mkOption {
inherit (tomlFormat) type;
default = {};
example = {
theme = "Mezora";
show = [
"Kernel"
"Machine"
"OperatingSystem"
"Resolution"
"Uptime"
"LocalIP"
"Packages"
"ProcessorLoad"
"Memory"
"Battery"
];
};
description = ''
Macchina configuration.
'';
};
themes = with types;
mkOption {
inherit (tomlFormat) type;
default = {};
};
};
config = mkIf cfg.enable {
home.packages = [cfg.package];
xdg.configFile =
{
"macchina/macchina.toml".source =
tomlFormat.generate "macchina.toml" cfg.config;
}
// (
attrsets.concatMapAttrs (name: value: {
"macchina/themes/${name}.toml".source =
tomlFormat.generate "${name}.toml" value;
})
cfg.themes
);
};
}