diff options
| author | Arpit Chakladar <arpitchakladar+git@gmail.com> | 2026-08-29 02:02:23 +0530 |
|---|---|---|
| committer | Arpit Chakladar <arpitchakladar+git@gmail.com> | 2026-08-29 03:50:32 +0530 |
| commit | 41bdeb88009dd232808edee9fc0e4ae94358d8d6 (patch) | |
| tree | c1a41f54e086064dac178ebed24d36ab34087c32 /modules/file-management/yazi/default.nix | |
| parent | 530299d97926d45939f831dc3ea5e444d2839d08 (diff) | |
| download | home-manager-config-41bdeb88009dd232808edee9fc0e4ae94358d8d6.tar.gz home-manager-config-41bdeb88009dd232808edee9fc0e4ae94358d8d6.zip | |
refactor: moving script into modules that makes sense
- instead of collecting all scripts into modules/scripts we are moving
them to modules that makes sense (yazi-file-chooser.sh into yazi)
Diffstat (limited to 'modules/file-management/yazi/default.nix')
| -rw-r--r-- | modules/file-management/yazi/default.nix | 88 |
1 files changed, 58 insertions, 30 deletions
diff --git a/modules/file-management/yazi/default.nix b/modules/file-management/yazi/default.nix index 8d59446..d704614 100644 --- a/modules/file-management/yazi/default.nix +++ b/modules/file-management/yazi/default.nix @@ -1,5 +1,29 @@ # Terminal file manager with native previews -{ config, lib, ... }: +{ + config, + lib, + pkgs, + ... +}: +let + inherit ((import ../../lib/script.nix { inherit lib pkgs; })) mkScriptModule; + yaziFileChooser = mkScriptModule { + scope = [ + "file-management" + "yazi" + ]; + name = "yazi-file-chooser"; + path = ./yazi-file-chooser.sh; + description = "Yazi-based file chooser for XDG Desktop Portal"; + deps = [ + pkgs.bash + config.file-management.yazi.package + config.terminal.kitty.package + ]; + extraLinks = [ "~/.config/xdg-desktop-portal-termfilechooser/config" ]; + inherit config; + }; +in { imports = [ ./theme.nix @@ -15,40 +39,44 @@ defaultText = lib.literalExpression "config.programs.yazi.finalPackage"; description = "The yazi package to use. Defaults to the wrapped finalPackage from programs.yazi."; }; - }; + } + // yaziFileChooser.options.file-management.yazi; - config = lib.mkIf config.file-management.yazi.enable { - programs.yazi = { - enable = true; - shellWrapperName = "yy"; - enableZshIntegration = config.terminal.zsh.enable; - settings = { - mgr = { - show_hidden = true; + config = lib.mkMerge [ + (lib.mkIf config.file-management.yazi.enable { + programs.yazi = { + enable = true; + shellWrapperName = "yy"; + enableZshIntegration = config.terminal.zsh.enable; + settings = { + mgr = { + show_hidden = true; + }; }; }; - }; - home.file.".local/share/icons/hicolor/scalable/apps/yazi.png" = { - source = config.lib.file.mkOutOfStoreSymlink "${config.file-management.yazi.package}/share/pixmaps/yazi.png"; - }; + home.file.".local/share/icons/hicolor/scalable/apps/yazi.png" = { + source = config.lib.file.mkOutOfStoreSymlink "${config.file-management.yazi.package}/share/pixmaps/yazi.png"; + }; - xdg.desktopEntries."yazi" = { - name = "Yazi"; - exec = "${lib.getExe config.terminal.kitty.package} --class yazi -e ${lib.getExe config.file-management.yazi.package}"; - icon = "yazi"; - categories = [ "Utility" ]; - comment = "Terminal file manager"; - terminal = false; - type = "Application"; - }; + xdg.desktopEntries."yazi" = { + name = "Yazi"; + exec = "${lib.getExe config.terminal.kitty.package} --class yazi -e ${lib.getExe config.file-management.yazi.package}"; + icon = "yazi"; + categories = [ "Utility" ]; + comment = "Terminal file manager"; + terminal = false; + type = "Application"; + }; - xdg.mimeApps.defaultApplications = { - "inode/directory" = "yazi.desktop"; - }; + xdg.mimeApps.defaultApplications = { + "inode/directory" = "yazi.desktop"; + }; - home.sessionVariables = { - TERMCMD = lib.mkIf config.terminal.kitty.enable "${lib.getExe config.terminal.kitty.package} --class file-explorer --title 'Yazi'"; - }; - }; + home.sessionVariables = { + TERMCMD = lib.mkIf config.terminal.kitty.enable "${lib.getExe config.terminal.kitty.package} --class file-explorer --title 'Yazi'"; + }; + }) + yaziFileChooser.config + ]; } |
