mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-24 22:53:42 +00:00
6afb255d97
these changes were generated with nixq 0.0.2, by running nixq ">> lib.mdDoc[remove] Argument[keep]" --batchmode nixos/**.nix nixq ">> mdDoc[remove] Argument[keep]" --batchmode nixos/**.nix nixq ">> Inherit >> mdDoc[remove]" --batchmode nixos/**.nix two mentions of the mdDoc function remain in nixos/, both of which are inside of comments. Since lib.mdDoc is already defined as just id, this commit is a no-op as far as Nix (and the built manual) is concerned.
52 lines
1.3 KiB
Nix
52 lines
1.3 KiB
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
let
|
|
cfg = config.programs.yazi;
|
|
|
|
settingsFormat = pkgs.formats.toml { };
|
|
|
|
names = [ "yazi" "theme" "keymap" ];
|
|
in
|
|
{
|
|
options.programs.yazi = {
|
|
enable = lib.mkEnableOption "yazi terminal file manager";
|
|
|
|
package = lib.mkPackageOption pkgs "yazi" { };
|
|
|
|
settings = lib.mkOption {
|
|
type = with lib.types; submodule {
|
|
options = lib.listToAttrs (map
|
|
(name: lib.nameValuePair name (lib.mkOption {
|
|
inherit (settingsFormat) type;
|
|
default = { };
|
|
description = ''
|
|
Configuration included in `${name}.toml`.
|
|
|
|
See https://yazi-rs.github.io/docs/configuration/${name}/ for documentation.
|
|
'';
|
|
}))
|
|
names);
|
|
};
|
|
default = { };
|
|
description = ''
|
|
Configuration included in `$YAZI_CONFIG_HOME`.
|
|
'';
|
|
};
|
|
};
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
environment = {
|
|
systemPackages = [ cfg.package ];
|
|
variables.YAZI_CONFIG_HOME = "/etc/yazi/";
|
|
etc = lib.attrsets.mergeAttrsList (map
|
|
(name: lib.optionalAttrs (cfg.settings.${name} != { }) {
|
|
"yazi/${name}.toml".source = settingsFormat.generate "${name}.toml" cfg.settings.${name};
|
|
})
|
|
names);
|
|
};
|
|
};
|
|
meta = {
|
|
maintainers = with lib.maintainers; [ linsui ];
|
|
};
|
|
}
|