mirror of
https://github.com/nix-community/home-manager.git
synced 2025-11-08 19:46:05 +01:00
anvil-editor: add module
This commit is contained in:
parent
2574bb4496
commit
f2cda99e4a
6 changed files with 135 additions and 0 deletions
75
modules/programs/anvil-editor.nix
Normal file
75
modules/programs/anvil-editor.nix
Normal file
|
|
@ -0,0 +1,75 @@
|
||||||
|
{
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
inherit (lib)
|
||||||
|
mkIf
|
||||||
|
mkEnableOption
|
||||||
|
mkPackageOption
|
||||||
|
mkOption
|
||||||
|
;
|
||||||
|
|
||||||
|
cfg = config.programs.anvil-editor;
|
||||||
|
tomlFormat = pkgs.formats.toml { };
|
||||||
|
jsonFormat = pkgs.formats.json { };
|
||||||
|
in
|
||||||
|
{
|
||||||
|
meta.maintainers = with lib.hm.maintainers; [ aguirre-matteo ];
|
||||||
|
options.programs.anvil-editor = {
|
||||||
|
enable = mkEnableOption "anvil-editor";
|
||||||
|
package = mkPackageOption pkgs "anvil-editor" { nullable = true; };
|
||||||
|
settings = mkOption {
|
||||||
|
inherit (tomlFormat) type;
|
||||||
|
default = { };
|
||||||
|
example = {
|
||||||
|
general.exec = [
|
||||||
|
"aad"
|
||||||
|
"ado"
|
||||||
|
];
|
||||||
|
layout.column-tag = "New Cut Paste Snarf Zerox Delcol";
|
||||||
|
typesetting.replace-cr-with-tofu = false;
|
||||||
|
env = {
|
||||||
|
FOO = "BAR";
|
||||||
|
BAR = "FOO";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
description = ''
|
||||||
|
Configuration settings for anvil-editor. All available options can be found here:
|
||||||
|
<https://anvil-editor.net/reference/config/#settingstoml>.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
style = mkOption {
|
||||||
|
inherit (jsonFormat) type;
|
||||||
|
default = { };
|
||||||
|
example = {
|
||||||
|
TagFgColor = "#fefefe";
|
||||||
|
TagBgColor = "#263859";
|
||||||
|
BodyBgColor = "#17223b";
|
||||||
|
ScrollFgColor = "#17223b";
|
||||||
|
ScrollBgColor = "#6b778d";
|
||||||
|
GutterWidth = 14;
|
||||||
|
WinBorderColor = "#000000";
|
||||||
|
};
|
||||||
|
description = ''
|
||||||
|
Style settings for anvil-editor. All available options can be found here:
|
||||||
|
<https://anvil-editor.net/reference/config/#stylejs>.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
home.packages = mkIf (cfg.package != null) [ cfg.package ];
|
||||||
|
home.file = {
|
||||||
|
".anvil/settings.toml" = mkIf (cfg.settings != { }) {
|
||||||
|
source = tomlFormat.generate "anvil-settings.toml" cfg.settings;
|
||||||
|
};
|
||||||
|
|
||||||
|
".anvil/style.js" = mkIf (cfg.style != { }) {
|
||||||
|
source = jsonFormat.generate "anvil-style.js" cfg.style;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -11,6 +11,7 @@ let
|
||||||
"alacritty"
|
"alacritty"
|
||||||
"alot"
|
"alot"
|
||||||
"antidote"
|
"antidote"
|
||||||
|
"anvil-editor"
|
||||||
"aria2"
|
"aria2"
|
||||||
"atuin"
|
"atuin"
|
||||||
"autojump"
|
"autojump"
|
||||||
|
|
|
||||||
1
tests/modules/programs/anvil-editor/default.nix
Normal file
1
tests/modules/programs/anvil-editor/default.nix
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
{ anvil-editor-settings = ./settings.nix; }
|
||||||
37
tests/modules/programs/anvil-editor/settings.nix
Normal file
37
tests/modules/programs/anvil-editor/settings.nix
Normal file
|
|
@ -0,0 +1,37 @@
|
||||||
|
{
|
||||||
|
programs.anvil-editor = {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
general.exec = [
|
||||||
|
"aad"
|
||||||
|
"ado"
|
||||||
|
];
|
||||||
|
layout.column-tag = "New Cut Paste Snarf Zerox Delcol";
|
||||||
|
typesetting.replace-cr-with-tofu = false;
|
||||||
|
env = {
|
||||||
|
FOO = "BAR";
|
||||||
|
BAR = "FOO";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
style = {
|
||||||
|
TagFgColor = "#fefefe";
|
||||||
|
TagBgColor = "#263859";
|
||||||
|
BodyBgColor = "#17223b";
|
||||||
|
ScrollFgColor = "#17223b";
|
||||||
|
ScrollBgColor = "#6b778d";
|
||||||
|
GutterWidth = 14;
|
||||||
|
WinBorderColor = "#000000";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
nmt.script = ''
|
||||||
|
assertFileExists home-files/.anvil/settings.toml
|
||||||
|
assertFileExists home-files/.anvil/style.js
|
||||||
|
|
||||||
|
assertFileContent home-files/.anvil/settings.toml \
|
||||||
|
${./settings.toml}
|
||||||
|
assertFileContent home-files/.anvil/style.js \
|
||||||
|
${./style.js}
|
||||||
|
'';
|
||||||
|
}
|
||||||
12
tests/modules/programs/anvil-editor/settings.toml
Normal file
12
tests/modules/programs/anvil-editor/settings.toml
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
[env]
|
||||||
|
BAR = "FOO"
|
||||||
|
FOO = "BAR"
|
||||||
|
|
||||||
|
[general]
|
||||||
|
exec = ["aad", "ado"]
|
||||||
|
|
||||||
|
[layout]
|
||||||
|
column-tag = "New Cut Paste Snarf Zerox Delcol"
|
||||||
|
|
||||||
|
[typesetting]
|
||||||
|
replace-cr-with-tofu = false
|
||||||
9
tests/modules/programs/anvil-editor/style.js
Normal file
9
tests/modules/programs/anvil-editor/style.js
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
"BodyBgColor": "#17223b",
|
||||||
|
"GutterWidth": 14,
|
||||||
|
"ScrollBgColor": "#6b778d",
|
||||||
|
"ScrollFgColor": "#17223b",
|
||||||
|
"TagBgColor": "#263859",
|
||||||
|
"TagFgColor": "#fefefe",
|
||||||
|
"WinBorderColor": "#000000"
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue