Files
home-manager/modules/programs/iamb.nix
Austin Horstman 01ea51d706 treewide: use inherit for attribute assignments
This change converts redundant attribute assignments of the form `a =
a;` or `a = someSet.a;` into cleaner `inherit` statements. This reduces
verbosity and follows common Nix style for bringing attributes into
scope.

Statix Codes: W03 (manual_inherit), W04 (manual_inherit_from)

Also include statix and the rule in our configuration.
2026-04-08 14:47:48 -05:00

59 lines
1.3 KiB
Nix

{
config,
lib,
pkgs,
...
}:
let
cfg = config.programs.iamb;
tomlFormat = pkgs.formats.toml { };
configDir =
if pkgs.stdenv.isDarwin && !config.xdg.enable then
"Library/Application Support"
else
config.xdg.configHome;
in
{
options.programs.iamb = {
enable = lib.mkEnableOption "iamb";
package = lib.mkPackageOption pkgs "iamb" { nullable = true; };
settings = lib.mkOption {
inherit (tomlFormat) type;
default = { };
example = lib.literalExpression ''
{
default_profile = "personal";
settings = {
notifications.enabled = true;
image_preview.protocol = {
type = "kitty";
size = {
height = 10;
width = 66;
};
};
};
}
'';
description = ''
Configuration written to
{file}`$XDG_CONFIG_HOME/iamb/config.toml`.
See <https://iamb.chat/configure.html> for the full list
of options.
'';
};
};
config = lib.mkIf cfg.enable {
home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
home.file."${configDir}/iamb/config.toml" = lib.mkIf (cfg.settings != { }) {
source = tomlFormat.generate "iamb-config" cfg.settings;
};
};
}