at 24.11-pre 2.1 kB view raw
1{ config, lib, pkgs, ... }: 2 3let 4 cfg = config.programs.yazi; 5 6 settingsFormat = pkgs.formats.toml { }; 7 8 files = [ "yazi" "theme" "keymap" ]; 9in 10{ 11 options.programs.yazi = { 12 enable = lib.mkEnableOption "yazi terminal file manager"; 13 14 package = lib.mkPackageOption pkgs "yazi" { }; 15 16 settings = lib.mkOption { 17 type = with lib.types; submodule { 18 options = (lib.listToAttrs (map 19 (name: lib.nameValuePair name (lib.mkOption { 20 inherit (settingsFormat) type; 21 default = { }; 22 description = '' 23 Configuration included in `${name}.toml`. 24 25 See https://yazi-rs.github.io/docs/configuration/${name}/ for documentation. 26 ''; 27 })) 28 files)); 29 }; 30 default = { }; 31 description = '' 32 Configuration included in `$YAZI_CONFIG_HOME`. 33 ''; 34 }; 35 36 initLua = lib.mkOption { 37 type = with lib.types; nullOr path; 38 default = null; 39 description = '' 40 The init.lua for Yazi itself. 41 ''; 42 example = lib.literalExpression "./init.lua"; 43 }; 44 45 plugins = lib.mkOption { 46 type = with lib.types; attrsOf (oneOf [ path package ]); 47 default = { }; 48 description = '' 49 Lua plugins. 50 51 See https://yazi-rs.github.io/docs/plugins/overview/ for documentation. 52 ''; 53 example = lib.literalExpression '' 54 { 55 foo = ./foo; 56 bar = pkgs.bar; 57 } 58 ''; 59 }; 60 61 flavors = lib.mkOption { 62 type = with lib.types; attrsOf (oneOf [ path package ]); 63 default = { }; 64 description = '' 65 Pre-made themes. 66 67 See https://yazi-rs.github.io/docs/flavors/overview/ for documentation. 68 ''; 69 example = lib.literalExpression '' 70 { 71 foo = ./foo; 72 bar = pkgs.bar; 73 } 74 ''; 75 }; 76 77 }; 78 79 config = lib.mkIf cfg.enable { 80 environment.systemPackages = [ 81 (cfg.package.override { 82 inherit (cfg) settings initLua plugins flavors; 83 }) 84 ]; 85 }; 86 87 meta = { 88 maintainers = with lib.maintainers; [ linsui ]; 89 }; 90}