1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-11-08 11:36:05 +01:00

retext: add module

This commit is contained in:
Aguirre Matteo 2025-09-18 07:58:27 -03:00 committed by Robert Helgesson
parent bf7056c6a2
commit b5698ed57d
5 changed files with 100 additions and 0 deletions

View file

@ -0,0 +1,11 @@
{
time = "2025-09-18T14:46:18+00:00";
condition = true;
message = ''
A new module is available: `programs.retext`
ReText is a simple but powerful editor for markup languages. It is based on
Markups module which supports Markdown, reStructuredText, Textile and
AsciiDoc. One can also add support for custom markups using Python modules.
'';
}

View file

@ -0,0 +1,53 @@
{
lib,
pkgs,
config,
...
}:
let
inherit (lib)
mkIf
mkEnableOption
mkPackageOption
mkOption
;
cfg = config.programs.retext;
iniFormat = pkgs.formats.ini { };
in
{
meta.maintainers = with lib.hm.maintainers; [ aguirre-matteo ];
options.programs.retext = {
enable = mkEnableOption "retext";
package = mkPackageOption pkgs "retext" { nullable = true; };
settings = mkOption {
inherit (iniFormat) type;
default = { };
example = {
General = {
documentStatsEnabled = true;
lineNumbersEnabled = true;
relativeLineNumbers = true;
useWebEngine = true;
};
ColorScheme = {
htmlTags = "green";
htmlSymbols = "#ff8800";
htmlComments = "#abc";
};
};
description = ''
Configuration settings for retext. All the available options can be found
here: <https://github.com/retext-project/retext/blob/master/configuration.md>.
'';
};
};
config = mkIf cfg.enable {
home.packages = mkIf (cfg.package != null) [ cfg.package ];
xdg.configFile."ReText Project/ReText.conf" = mkIf (cfg.settings != { }) {
source = iniFormat.generate "ReText.conf" cfg.settings;
};
};
}

View file

@ -0,0 +1,10 @@
[ColorScheme]
htmlComments=#abc
htmlSymbols=#ff8800
htmlTags=green
[General]
documentStatsEnabled=true
lineNumbersEnabled=true
relativeLineNumbers=true
useWebEngine=true

View file

@ -0,0 +1 @@
{ retext-example-config = ./example-config.nix; }

View file

@ -0,0 +1,25 @@
{
programs.retext = {
enable = true;
settings = {
General = {
documentStatsEnabled = true;
lineNumbersEnabled = true;
relativeLineNumbers = true;
useWebEngine = true;
};
ColorScheme = {
htmlTags = "green";
htmlSymbols = "#ff8800";
htmlComments = "#abc";
};
};
};
nmt.script = ''
assertFileExists "home-files/.config/ReText Project/ReText.conf"
assertFileContent "home-files/.config/ReText Project/ReText.conf" \
${./ReText.conf}
'';
}