fresh-editor: init module

This commit is contained in:
Pol Dellaiera 2026-01-10 10:43:56 +01:00 committed by Austin Horstman
parent 27b60942b7
commit 2d7b64e32f
5 changed files with 77 additions and 0 deletions

View 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.
'';
}

View 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;
};
};
}

View file

@ -0,0 +1,3 @@
{
"foo": "bar"
}

View file

@ -0,0 +1,3 @@
{
fresh-editor = ./fresh-editor-settings.nix;
}

View file

@ -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}
'';
}