feat(neovide): make a neovide test wrapper

This commit is contained in:
Artur Manuel 2025-02-26 14:04:33 +00:00
commit ed5ab6c568
Signed by: amadaluzia
SSH key fingerprint: SHA256:Zwg7gBuZyaG48ucAZneJwltiXu0+tJb7c3lYt9AYlLg
6 changed files with 57 additions and 25 deletions

1
.gitignore vendored
View file

@ -1 +1,2 @@
result result
repl-result-out

6
flake.lock generated
View file

@ -2,11 +2,11 @@
"nodes": { "nodes": {
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1739866667, "lastModified": 1740367490,
"narHash": "sha256-EO1ygNKZlsAC9avfcwHkKGMsmipUk1Uc0TbrEZpkn64=", "narHash": "sha256-WGaHVAjcrv+Cun7zPlI41SerRtfknGQap281+AakSAw=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "73cf49b8ad837ade2de76f87eb53fc85ed5d4680", "rev": "0196c0175e9191c474c26ab5548db27ef5d34b05",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -1,17 +1,18 @@
From 7973ea6a0e2e94a3b31a4c7b87834d49b7f195bb Mon Sep 17 00:00:00 2001 From 02d68470c717b6e076566555af4978762d3588ad Mon Sep 17 00:00:00 2001
From: Artur Manuel <balkenix@outlook.com> From: Artur Manuel <balkenix@outlook.com>
Date: Tue, 11 Feb 2025 16:42:07 +0000 Date: Tue, 11 Feb 2025 16:42:07 +0000
Subject: [PATCH] feat(env): add NEOVIDE_CONFIG env var Subject: [PATCH] feat(env): add NEOVIDE_CONFIG env var
--- ---
src/settings/config.rs | 11 ++++++++--- src/settings/config.rs | 12 +++++++++---
1 file changed, 8 insertions(+), 3 deletions(-) website/docs/config-file.md | 2 ++
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/src/settings/config.rs b/src/settings/config.rs diff --git a/src/settings/config.rs b/src/settings/config.rs
index 705f046..bd8c764 100644 index 705f046..db8d910 100644
--- a/src/settings/config.rs --- a/src/settings/config.rs
+++ b/src/settings/config.rs +++ b/src/settings/config.rs
@@ -28,9 +28,14 @@ fn neovide_config_dir() -> PathBuf { @@ -28,9 +28,15 @@ fn neovide_config_dir() -> PathBuf {
} }
pub fn config_path() -> PathBuf { pub fn config_path() -> PathBuf {
@ -19,16 +20,30 @@ index 705f046..bd8c764 100644
- config_path.push(CONFIG_FILE); - config_path.push(CONFIG_FILE);
- config_path - config_path
+ env::var("NEOVIDE_CONFIG") + env::var("NEOVIDE_CONFIG")
+ .ok() + .ok()
+ .map(PathBuf::from) + .map(PathBuf::from)
+ .filter(|path| path.is_file() && path.exists()) + .filter(|path| path.exists() && path.is_file())
+ .unwrap_or_else(|| { + .unwrap_or_else(|| {
+ eprintln!("Not a valid config path! Using XDG_CONFIG_HOME."); + let mut path = neovide_config_dir();
+ neovide_config_dir().join("config.toml") + path.push(CONFIG_FILE);
+ }) + path
+ })
} }
#[derive(Debug, Deserialize, Default, Clone)] #[derive(Debug, Deserialize, Default, Clone)]
-- diff --git a/website/docs/config-file.md b/website/docs/config-file.md
2.47.2 index bd877ae..6b609ef 100644
--- a/website/docs/config-file.md
+++ b/website/docs/config-file.md
@@ -20,6 +20,8 @@ There are two types of settings:
| macOS | `$XDG_CONFIG_HOME/neovide/config.toml` or `$HOME/.config/neovide/config.toml` | `/Users/Alice/Library/Application Support/neovide/config.toml` |
| Windows | `{FOLDERID_RoamingAppData}/neovide/config.toml` | `C:\Users\Alice\AppData\Roaming/neovide/config.toml` |
+You may use a different location by modifying the `$NEOVIDE_CONFIG`.
+
## Available settings
Settings currently available in the config file with default values:
--
2.48.1

View file

@ -1,8 +1,19 @@
{neovide, ...}: {symlinkJoin, makeWrapper, neovide, ...}:
neovide.overrideAttrs (finalAttrs: { let
patches = custom-neovide = neovide.overrideAttrs (finalAttrs: {
(finalAttrs.patches or []) patches =
++ [ (finalAttrs.patches or [])
./0001-feat-env-add-NEOVIDE_CONFIG-env-var.patch ++ [
]; ./0001-feat-env-add-NEOVIDE_CONFIG-env-var.patch
}) ];
});
in
symlinkJoin {
name = "neovide";
paths = [custom-neovide];
nativeBuildInputs = [makeWrapper];
postBuild = ''
wrapProgram $out/bin/neovide \
--set-default NEOVIDE_CONFIG ${../../test_dirs/neovide/config.toml}
'';
}

View file

@ -6,7 +6,7 @@
inputs, inputs,
system, system,
zoxide, zoxide,
... # fuck you nixpkgs ... # ffs nixpkgs
}: let }: let
xonsh = xonsh =
python3 python3

View file

@ -0,0 +1,5 @@
[font]
size = 18
[font.normal]
family = "Monospace"