mirror of
https://github.com/nix-community/home-manager.git
synced 2025-11-08 19:46:05 +01:00
retext: add module
This commit is contained in:
parent
bf7056c6a2
commit
b5698ed57d
5 changed files with 100 additions and 0 deletions
11
modules/misc/news/2025/09/2025-09-18_07-58-37.nix
Normal file
11
modules/misc/news/2025/09/2025-09-18_07-58-37.nix
Normal 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.
|
||||
'';
|
||||
}
|
||||
53
modules/programs/retext.nix
Normal file
53
modules/programs/retext.nix
Normal 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;
|
||||
};
|
||||
};
|
||||
}
|
||||
10
tests/modules/programs/retext/ReText.conf
Normal file
10
tests/modules/programs/retext/ReText.conf
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
[ColorScheme]
|
||||
htmlComments=#abc
|
||||
htmlSymbols=#ff8800
|
||||
htmlTags=green
|
||||
|
||||
[General]
|
||||
documentStatsEnabled=true
|
||||
lineNumbersEnabled=true
|
||||
relativeLineNumbers=true
|
||||
useWebEngine=true
|
||||
1
tests/modules/programs/retext/default.nix
Normal file
1
tests/modules/programs/retext/default.nix
Normal file
|
|
@ -0,0 +1 @@
|
|||
{ retext-example-config = ./example-config.nix; }
|
||||
25
tests/modules/programs/retext/example-config.nix
Normal file
25
tests/modules/programs/retext/example-config.nix
Normal 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}
|
||||
'';
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue