1 { config, lib, pkgs, ... }:
4 cfg = config.programs.yazi;
6 settingsFormat = pkgs.formats.toml { };
8 names = [ "yazi" "theme" "keymap" ];
11 options.programs.yazi = {
12 enable = lib.mkEnableOption (lib.mdDoc "yazi terminal file manager");
14 package = lib.mkPackageOptionMD pkgs "yazi" { };
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;
22 description = lib.mdDoc ''
23 Configuration included in `${name}.toml`.
25 See https://github.com/sxyazi/yazi/blob/v${cfg.package.version}/config/docs/${name}.md for documentation.
31 description = lib.mdDoc ''
32 Configuration included in `$YAZI_CONFIG_HOME`.
37 config = lib.mkIf cfg.enable {
39 systemPackages = [ cfg.package ];
40 variables.YAZI_CONFIG_HOME = "/etc/yazi/";
41 etc = lib.attrsets.mergeAttrsList (map
42 (name: lib.optionalAttrs (cfg.settings.${name} != { }) {
43 "yazi/${name}.toml".source = settingsFormat.generate "${name}.toml" cfg.settings.${name};
49 maintainers = with lib.maintainers; [ linsui ];
50 # The version of the package is used in the doc.
51 buildDocsInSandbox = false;