diff options
Diffstat (limited to 'modules/file-management')
| -rw-r--r-- | modules/file-management/eza/default.nix | 12 | ||||
| -rw-r--r-- | modules/file-management/ouch/default.nix | 11 | ||||
| -rw-r--r-- | modules/file-management/usb/default.nix | 7 | ||||
| -rw-r--r-- | modules/file-management/yazi/default.nix | 36 |
4 files changed, 44 insertions, 22 deletions
diff --git a/modules/file-management/eza/default.nix b/modules/file-management/eza/default.nix index f22b435..b4f2b3a 100644 --- a/modules/file-management/eza/default.nix +++ b/modules/file-management/eza/default.nix @@ -1,5 +1,13 @@ # Modern ls replacement with icons and colors -{ config, lib, ... }: +{ + config, + lib, + pkgs, + ... +}: +let + cfg = config.file-management.eza; +in { options.file-management.eza = { enable = lib.mkEnableOption "Enables eza."; @@ -12,7 +20,7 @@ }; }; - config = lib.mkIf config.file-management.eza.enable { + config = lib.mkIf cfg.enable { programs.eza = { enable = true; icons = "always"; diff --git a/modules/file-management/ouch/default.nix b/modules/file-management/ouch/default.nix index c8986fe..461e3cf 100644 --- a/modules/file-management/ouch/default.nix +++ b/modules/file-management/ouch/default.nix @@ -1,10 +1,13 @@ # CLI tool for compressing and decompressing various formats { - pkgs, - lib, config, + lib, + pkgs, ... }: +let + cfg = config.file-management.ouch; +in { options.file-management.ouch = { enable = lib.mkEnableOption "Enables ouch."; @@ -18,7 +21,7 @@ }; }; - config = lib.mkIf config.file-management.ouch.enable { - home.packages = [ config.file-management.ouch.package ]; + config = lib.mkIf cfg.enable { + home.packages = [ cfg.package ]; }; } diff --git a/modules/file-management/usb/default.nix b/modules/file-management/usb/default.nix index 4b8deb9..4596266 100644 --- a/modules/file-management/usb/default.nix +++ b/modules/file-management/usb/default.nix @@ -5,6 +5,9 @@ pkgs, ... }: +let + cfg = config.file-management.usb; +in { options.file-management.usb = { enable = lib.mkEnableOption "Enables USB device mounting tools."; @@ -22,7 +25,7 @@ }; }; - config = lib.mkIf config.file-management.usb.enable { - home.packages = [ config.file-management.usb.package ]; + config = lib.mkIf cfg.enable { + home.packages = [ cfg.package ]; }; } diff --git a/modules/file-management/yazi/default.nix b/modules/file-management/yazi/default.nix index ba1c020..3ba7045 100644 --- a/modules/file-management/yazi/default.nix +++ b/modules/file-management/yazi/default.nix @@ -6,11 +6,13 @@ ... }: let + cfg = config.file-management.yazi; + yaziFileChooserScript = pkgs.writeShellApplication { name = "yazi-file-chooser"; runtimeInputs = [ config.terminal.bash.package - config.file-management.yazi.package + cfg.package config.terminal.kitty.package ]; text = builtins.readFile ./file-chooser.sh; @@ -32,19 +34,25 @@ in description = "The yazi package to use. Defaults to the wrapped finalPackage from programs.yazi."; }; - file-chooser = { - enable = lib.mkEnableOption "Enables the yazi-file-chooser script."; - package = lib.mkOption { - type = lib.types.package; - readOnly = true; - default = yaziFileChooserScript; - description = "The yazi-file-chooser script package."; + file-chooser = lib.mkOption { + type = lib.types.submodule { + options = { + enable = lib.mkEnableOption "Enables the yazi-file-chooser script."; + package = lib.mkOption { + type = lib.types.package; + readOnly = true; + default = yaziFileChooserScript; + description = "The yazi-file-chooser script package."; + }; + }; }; + default = { }; + description = "File chooser integration configuration."; }; }; config = lib.mkMerge [ - (lib.mkIf config.file-management.yazi.enable { + (lib.mkIf cfg.enable { programs.yazi = { enable = true; shellWrapperName = "yy"; @@ -57,17 +65,17 @@ in }; home.file.".local/share/icons/hicolor/scalable/apps/yazi.png" = { - source = config.lib.file.mkOutOfStoreSymlink "${config.file-management.yazi.package}/share/pixmaps/yazi.png"; + source = lib.file.mkOutOfStoreSymlink "${cfg.package}/share/pixmaps/yazi.png"; }; home.sessionVariables = { TERMCMD = lib.mkIf config.terminal.kitty.enable "${lib.getExe config.terminal.kitty.package} --class file-explorer --title 'Yazi'"; }; }) - (lib.mkIf (config.file-management.yazi.enable && config.terminal.kitty.enable) { + (lib.mkIf (cfg.enable && config.terminal.kitty.enable) { xdg.desktopEntries."yazi" = { name = "Yazi"; - exec = "${lib.getExe config.terminal.kitty.package} --class yazi -e ${lib.getExe config.file-management.yazi.package}"; + exec = "${lib.getExe config.terminal.kitty.package} --class yazi -e ${lib.getExe cfg.package}"; icon = "yazi"; categories = [ "Utility" ]; comment = "Terminal file manager"; @@ -84,9 +92,9 @@ in "application/x-rar-compressed" = "yazi.desktop"; }; }) - (lib.mkIf config.file-management.yazi.file-chooser.enable { + (lib.mkIf cfg.file-chooser.enable { home.file.".config/xdg-desktop-portal-termfilechooser/config" = { - source = lib.getExe config.file-management.yazi.file-chooser.package; + source = lib.getExe cfg.file-chooser.package; }; }) ]; |
