From 7923c691527d2ee85fe028c6e780ac3bf8606f06 Mon Sep 17 00:00:00 2001 From: NitroSniper Date: Thu, 12 Sep 2024 23:37:22 +0100 Subject: [PATCH] neovide: add module Neovide is a simple, no-nonsense, cross-platform graphical user interface for Neovim See . Used ruff's module as reference during creation. --- modules/lib/maintainers.nix | 6 +++ modules/misc/news.nix | 11 +++++ modules/modules.nix | 1 + modules/programs/neovide.nix | 52 ++++++++++++++++++++ tests/default.nix | 1 + tests/modules/programs/neovide/default.nix | 1 + tests/modules/programs/neovide/expected.toml | 15 ++++++ tests/modules/programs/neovide/neovide.nix | 34 +++++++++++++ 8 files changed, 121 insertions(+) create mode 100644 modules/programs/neovide.nix create mode 100644 tests/modules/programs/neovide/default.nix create mode 100644 tests/modules/programs/neovide/expected.toml create mode 100644 tests/modules/programs/neovide/neovide.nix diff --git a/modules/lib/maintainers.nix b/modules/lib/maintainers.nix index 832e025d3..70f480d06 100644 --- a/modules/lib/maintainers.nix +++ b/modules/lib/maintainers.nix @@ -276,6 +276,12 @@ github = "nilp0inter"; githubId = 1224006; }; + NitroSniper = { + name = "Nitro Sniper"; + email = "nitro@ortin.dev"; + github = "NitroSniper"; + githubId = 44097331; + }; seylerius = { email = "sable@seyleri.us"; name = "Sable Seyler"; diff --git a/modules/misc/news.nix b/modules/misc/news.nix index eae438e26..655546ff3 100644 --- a/modules/misc/news.nix +++ b/modules/misc/news.nix @@ -1713,6 +1713,17 @@ in { An unofficial GUI wrapper around the Tailscale CLI client. ''; } + + { + time = "2024-09-13T09:50:49+00:00"; + message = '' + A new module is available: 'programs.neovide'. + + Neovide is a simple, no-nonsense, cross-platform graphical user + interface for Neovim (an aggressively refactored and updated Vim + editor). + ''; + } ]; }; } diff --git a/modules/modules.nix b/modules/modules.nix index 7223fb4bf..ed2e177f2 100644 --- a/modules/modules.nix +++ b/modules/modules.nix @@ -167,6 +167,7 @@ let ./programs/ncspot.nix ./programs/ne.nix ./programs/neomutt.nix + ./programs/neovide.nix ./programs/neovim.nix ./programs/newsboat.nix ./programs/nheko.nix diff --git a/modules/programs/neovide.nix b/modules/programs/neovide.nix new file mode 100644 index 000000000..3b40fb3eb --- /dev/null +++ b/modules/programs/neovide.nix @@ -0,0 +1,52 @@ +{ config, lib, pkgs, ... }: + +let + + cfg = config.programs.neovide; + settingsFormat = pkgs.formats.toml { }; + +in { + meta.maintainers = [ lib.hm.maintainers.NitroSniper ]; + + options.programs.neovide = { + enable = lib.mkEnableOption "Neovide, No Nonsense Neovim Client in Rust"; + + package = lib.mkPackageOption pkgs "neovide" { }; + + settings = lib.mkOption { + type = settingsFormat.type; + example = lib.literalExpression '' + { + fork = false; + frame = "full"; + idle = true; + maximized = false; + neovim-bin = "/usr/bin/nvim"; + no-multigrid = false; + srgb = false; + tabs = true; + theme = "auto"; + title-hidden = true; + vsync = true; + wsl = false; + + font = { + normal = []; + size = 14.0; + }; + } + ''; + description = '' + Neovide configuration. + For available settings see . + For any option not found will need to be done in your neovim's config instead. + ''; + }; + }; + + config = lib.mkIf cfg.enable { + home.packages = [ cfg.package ]; + xdg.configFile."neovide/config.toml".source = + settingsFormat.generate "config.toml" cfg.settings; + }; +} diff --git a/tests/default.nix b/tests/default.nix index 82aa2f6c4..2008014b7 100644 --- a/tests/default.nix +++ b/tests/default.nix @@ -110,6 +110,7 @@ in import nmtSrc { ./modules/programs/ncmpcpp ./modules/programs/ne ./modules/programs/neomutt + ./modules/programs/neovide ./modules/programs/neovim ./modules/programs/newsboat ./modules/programs/nheko diff --git a/tests/modules/programs/neovide/default.nix b/tests/modules/programs/neovide/default.nix new file mode 100644 index 000000000..f11bc33bc --- /dev/null +++ b/tests/modules/programs/neovide/default.nix @@ -0,0 +1 @@ +{ neovide-program = ./neovide.nix; } diff --git a/tests/modules/programs/neovide/expected.toml b/tests/modules/programs/neovide/expected.toml new file mode 100644 index 000000000..0c3f0b20b --- /dev/null +++ b/tests/modules/programs/neovide/expected.toml @@ -0,0 +1,15 @@ +fork = false +frame = "full" +idle = true +maximized = false +neovim-bin = "/usr/bin/nvim" +no-multigrid = false +srgb = false +tabs = true +theme = "auto" +title-hidden = true +vsync = true +wsl = false +[font] +normal = [] +size = 14.0 diff --git a/tests/modules/programs/neovide/neovide.nix b/tests/modules/programs/neovide/neovide.nix new file mode 100644 index 000000000..774964f01 --- /dev/null +++ b/tests/modules/programs/neovide/neovide.nix @@ -0,0 +1,34 @@ +{ ... }: + +{ + programs.neovide = { + enable = true; + + settings = { + fork = false; + frame = "full"; + idle = true; + maximized = false; + neovim-bin = "/usr/bin/nvim"; + no-multigrid = false; + srgb = false; + tabs = true; + theme = "auto"; + title-hidden = true; + vsync = true; + wsl = false; + + font = { + normal = [ ]; + size = 14.0; + }; + }; + }; + + test.stubs.neovide = { }; + + nmt.script = '' + assertFileExists home-files/.config/neovide/config.toml + assertFileContent home-files/.config/neovide/config.toml ${./expected.toml} + ''; +}