fresh-editor: init module
This commit is contained in:
parent
27b60942b7
commit
2d7b64e32f
5 changed files with 77 additions and 0 deletions
14
modules/misc/news/2026/01/2026-01-10_10-44-00.nix
Normal file
14
modules/misc/news/2026/01/2026-01-10_10-44-00.nix
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
{ config, ... }:
|
||||
{
|
||||
time = "2026-01-10T10:44:00+00:00";
|
||||
condition = config.programs.fresh-editor.enable;
|
||||
message = ''
|
||||
|
||||
A new module is available: 'programs.fresh-editor'
|
||||
|
||||
Fresh is a terminal-based text editor: easy, powerful and fast. It is
|
||||
engineered for speed. It delivers a low-latency experience, with text
|
||||
appearing instantly. The editor is designed to be light and fast, reliably
|
||||
opening and editing huge files up to multi-gigabyte sizes without slowdown.
|
||||
'';
|
||||
}
|
||||
47
modules/programs/fresh-editor.nix
Normal file
47
modules/programs/fresh-editor.nix
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
{
|
||||
lib,
|
||||
pkgs,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (lib)
|
||||
mkIf
|
||||
mkEnableOption
|
||||
mkPackageOption
|
||||
mkOption
|
||||
;
|
||||
|
||||
cfg = config.programs.fresh-editor;
|
||||
jsonFormat = pkgs.formats.json { };
|
||||
in
|
||||
{
|
||||
meta.maintainers = with lib.maintainers; [ drupol ];
|
||||
options.programs.fresh-editor = {
|
||||
enable = mkEnableOption "fresh-editor";
|
||||
package = mkPackageOption pkgs "fresh-editor" { nullable = true; };
|
||||
settings = mkOption {
|
||||
inherit (jsonFormat) type;
|
||||
default = { };
|
||||
example = {
|
||||
version = 1;
|
||||
theme = "dark";
|
||||
editor = {
|
||||
tab_size = 4;
|
||||
line_numbers = true;
|
||||
};
|
||||
};
|
||||
description = ''
|
||||
Configuration settings for fresh-editor. Find more configuration options in the user guide at:
|
||||
<https://github.com/sinelaw/fresh/blob/master/docs/USER_GUIDE.md>
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = mkIf (cfg.package != null) [ cfg.package ];
|
||||
xdg.configFile."fresh/config.json" = mkIf (cfg.settings != { }) {
|
||||
source = jsonFormat.generate "config.json" cfg.settings;
|
||||
};
|
||||
};
|
||||
}
|
||||
3
tests/modules/programs/fresh-editor/config.json
Normal file
3
tests/modules/programs/fresh-editor/config.json
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"foo": "bar"
|
||||
}
|
||||
3
tests/modules/programs/fresh-editor/default.nix
Normal file
3
tests/modules/programs/fresh-editor/default.nix
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
fresh-editor = ./fresh-editor-settings.nix;
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
programs.fresh-editor = {
|
||||
enable = true;
|
||||
settings = builtins.fromJSON (builtins.readFile ./config.json);
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertFileContent home-files/.config/fresh/config.json ${./config.json}
|
||||
'';
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue