-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Yazi "extraConfig" Attribute #4706
Comments
As manual say
Could you give some examples of compatibility issue? |
Update 1: I succesfully managed to fix my nix language in the "settings" attribute, but there's no change to yazi after rebuilding.
I can't yet fix the code below, so any help would be great for this:
Sure, the "extraConfig" attribute would still be convenient, as there are 312 lines in the theme.toml alone, but not needed anymore. I'll close the issue immediately after I resolve the code snippet. |
This should do the trick: opener = {
edit = [
{ exec = "$EDITOR \"$@\""; block = true; for = "unix"; }
{ exec = "code \"%*\""; orphan = true; for = "windows"; }
];
}; Or: opener.edit = [
{
exec = "$EDITOR \"$@\"";
block = true;
for = "unix";
}
{
exec = "code \"%*\"";
orphan = true;
for = "windows";
}
]; Just as a nix syntax refresher: [ 1 2 3 4 ] {
name = "John";
age = 21;
} [
{ foo = "bar"; hi = "hello"; }
{ bar = "foo"; }
] JSON equivalent: [ 1, 2, 3, 4 ] {
"name": "John",
"age": 21
} [
{ "foo": "bar", "hi": "hello" },
{ "bar": "foo" }
] The main differences are:
|
And keep in mind you can easily write TOML (or any text file, really) either inside a nix string, or including a TOML file: {
xdg.configFile."yazi/theme.toml".text = ''
[foo]
bar=true
'';
} {
xdg.configFile."yazi/theme.toml".source = ./file-on-the-same-dir.toml;
} |
Hey, @Misterio77! Sorry for the notification, but I can't seem to make this work. Perhaps you might know why.
I've tried |
No prob! Maybe you have extra single quotes? As a rule of thumb, if the format requires additional escaping, nix handles it for you, just write the nix string without bothering with TOML rules. exec = "shell 'dragon -x -i -T \"$1\"' --confirm" This (the exact same) should do the trick: exec = "shell 'dragon -x -i -T \"$1\"' --confirm"; Otherwise, see if you can manually make a TOML that works, and I can show you the equivalent nix :) |
Yeah the example I provided should work, then. If you specifically want to use multiline string like the toml example does, this is the nix equivalent: exec = ''
shell 'dragon -x -i -T "$1"' --confirm
''; |
That worked, thank you! I realized a bit later that by setting the nixos declarative keymap option, it overwrote the nondeclarative one, so I had to convert the TOML file into nix language. For anyone who might find this issue in the future, you can check it below: |
Yazi supports lua scripting (mentioned in yazi's tips, plugins, and for example here), so it would be pretty good to have option to set it from home manager. Sure, extraConfigFiles."init.lua".text = ''
-- lua things go here
''; update: here is open PR in nixPkgs for |
Description
Using the “settings” attribute to configure the yazi home manager module is not optimal, as it is based on nix and has compatibility issues. A better alternative would be to implement the “extraConfig” attribute, which would allow for more adaptable and effective configuration possibilities.
Maintainers
@XYenon
Note: Thank you for your previous assistance with yazi. I really appreciate it.
The text was updated successfully, but these errors were encountered: