Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions modules/yazi/check.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
pkgs,
self,
}:

let
yaziWrapped =
(self.wrapperModules.yazi.apply {
inherit pkgs;
}).wrapper;

in
pkgs.runCommand "yazi-test" { } ''
"${yaziWrapped}/bin/yazi" --version | grep -q "${yaziWrapped.version}"
touch $out
''
65 changes: 65 additions & 0 deletions modules/yazi/module.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{
wlib,
lib,
...
}:
wlib.wrapModule (
{ config, ... }:
let
tomlFmt = config.pkgs.formats.toml { };
in
{
options = {
settings = lib.mkOption {
type = tomlFmt.type;
default = { };
description = ''
Yazi configuration for yazi.toml.
See https://yazi-rs.github.io/docs/configuration/yazi
'';
};

keymap = lib.mkOption {
type = tomlFmt.type;
default = { };
description = ''
Yazi configuration for keymap.toml.
See <https://yazi-rs.github.io/docs/configuration/keymap>
'';
};

theme = lib.mkOption {
type = tomlFmt.type;
default = { };
description = ''
Yazi configuration for theme.toml.
See <https://yazi-rs.github.io/docs/configuration/theme>
'';
};

extraFlags = lib.mkOption {
type = lib.types.attrsOf lib.types.unspecified; # TODO add list handling
default = { };
description = "Extra flags to pass to yazi.";
};
};

config =
let
settingsToml = tomlFmt.generate "yazi.toml" config.settings;
keymapToml = tomlFmt.generate "keymap.toml" config.keymap;
themeToml = tomlFmt.generate "theme.toml" config.theme;
Comment on lines +49 to +51
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would be nice if those files could also be exported via a wlib.types.file option. Take a look here https://github.com/Lassulus/wrappers/blob/main/modules/mpv/module.nix#L15


yaziConfigDir = config.pkgs.linkFarmFromDrvs "yazi-config-directory" [
settingsToml
keymapToml
themeToml
];
in
{
flags = config.extraFlags;
package = lib.mkDefault config.pkgs.yazi;
env.YAZI_CONFIG_HOME = "${yaziConfigDir}";
};
}
)