formiko: add module

This commit is contained in:
Aguirre Matteo 2025-09-17 21:13:12 -03:00 committed by Austin Horstman
parent 9f408dc51c
commit 9093a3f200
4 changed files with 93 additions and 0 deletions

View file

@ -0,0 +1,53 @@
{
lib,
pkgs,
config,
...
}:
let
inherit (lib)
mkIf
mkEnableOption
mkPackageOption
mkOption
;
cfg = config.programs.formiko;
iniFormat = pkgs.formats.ini { };
in
{
meta.maintainers = with lib.hm.maintainers; [ aguirre-matteo ];
options.programs.formiko = {
enable = mkEnableOption "formiko";
package = mkPackageOption pkgs "formiko" { nullable = true; };
settings = mkOption {
inherit (iniFormat) type;
default = { };
example = {
main = {
preview = 0;
parser = "json";
auto_scroll = true;
writer = "tiny";
};
editor = {
period_save = true;
check_spelling = false;
auto_indent = false;
};
};
description = ''
Configuration settings for formiko. All the available options
can be found by looking at ~/.config/formiko.ini.
'';
};
};
config = mkIf cfg.enable {
home.packages = mkIf (cfg.package != null) [ cfg.package ];
xdg.configFile."formiko.ini" = mkIf (cfg.settings != { }) {
source = iniFormat.generate "formiko.ini" cfg.settings;
};
};
}