feat(neovide): make a neovide test wrapper
This commit is contained in:
parent
607e6a486d
commit
ed5ab6c568
6 changed files with 57 additions and 25 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1 +1,2 @@
|
|||
result
|
||||
repl-result-out
|
||||
|
|
6
flake.lock
generated
6
flake.lock
generated
|
@ -2,11 +2,11 @@
|
|||
"nodes": {
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1739866667,
|
||||
"narHash": "sha256-EO1ygNKZlsAC9avfcwHkKGMsmipUk1Uc0TbrEZpkn64=",
|
||||
"lastModified": 1740367490,
|
||||
"narHash": "sha256-WGaHVAjcrv+Cun7zPlI41SerRtfknGQap281+AakSAw=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "73cf49b8ad837ade2de76f87eb53fc85ed5d4680",
|
||||
"rev": "0196c0175e9191c474c26ab5548db27ef5d34b05",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
|
@ -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>
|
||||
Date: Tue, 11 Feb 2025 16:42:07 +0000
|
||||
Subject: [PATCH] feat(env): add NEOVIDE_CONFIG env var
|
||||
|
||||
---
|
||||
src/settings/config.rs | 11 ++++++++---
|
||||
1 file changed, 8 insertions(+), 3 deletions(-)
|
||||
src/settings/config.rs | 12 +++++++++---
|
||||
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
|
||||
index 705f046..bd8c764 100644
|
||||
index 705f046..db8d910 100644
|
||||
--- a/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 {
|
||||
|
@ -19,16 +20,30 @@ index 705f046..bd8c764 100644
|
|||
- config_path.push(CONFIG_FILE);
|
||||
- config_path
|
||||
+ env::var("NEOVIDE_CONFIG")
|
||||
+ .ok()
|
||||
+ .map(PathBuf::from)
|
||||
+ .filter(|path| path.is_file() && path.exists())
|
||||
+ .unwrap_or_else(|| {
|
||||
+ eprintln!("Not a valid config path! Using XDG_CONFIG_HOME.");
|
||||
+ neovide_config_dir().join("config.toml")
|
||||
+ })
|
||||
+ .ok()
|
||||
+ .map(PathBuf::from)
|
||||
+ .filter(|path| path.exists() && path.is_file())
|
||||
+ .unwrap_or_else(|| {
|
||||
+ let mut path = neovide_config_dir();
|
||||
+ path.push(CONFIG_FILE);
|
||||
+ path
|
||||
+ })
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, Default, Clone)]
|
||||
--
|
||||
2.47.2
|
||||
diff --git a/website/docs/config-file.md b/website/docs/config-file.md
|
||||
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
|
||||
|
||||
|
|
|
@ -1,8 +1,19 @@
|
|||
{neovide, ...}:
|
||||
neovide.overrideAttrs (finalAttrs: {
|
||||
patches =
|
||||
(finalAttrs.patches or [])
|
||||
++ [
|
||||
./0001-feat-env-add-NEOVIDE_CONFIG-env-var.patch
|
||||
];
|
||||
})
|
||||
{symlinkJoin, makeWrapper, neovide, ...}:
|
||||
let
|
||||
custom-neovide = neovide.overrideAttrs (finalAttrs: {
|
||||
patches =
|
||||
(finalAttrs.patches or [])
|
||||
++ [
|
||||
./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}
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
inputs,
|
||||
system,
|
||||
zoxide,
|
||||
... # fuck you nixpkgs
|
||||
... # ffs nixpkgs
|
||||
}: let
|
||||
xonsh =
|
||||
python3
|
||||
|
|
5
test_dirs/neovide/config.toml
Normal file
5
test_dirs/neovide/config.toml
Normal file
|
@ -0,0 +1,5 @@
|
|||
[font]
|
||||
size = 18
|
||||
|
||||
[font.normal]
|
||||
family = "Monospace"
|
Loading…
Add table
Add a link
Reference in a new issue