1{
2 config,
3 lib,
4 pkgs,
5 ...
6}:
7
8let
9 cfg = config.programs.lazygit;
10
11 settingsFormat = pkgs.formats.yaml { };
12in
13{
14 options.programs.lazygit = {
15 enable = lib.mkEnableOption "lazygit, a simple terminal UI for git commands";
16
17 package = lib.mkPackageOption pkgs "lazygit" { };
18
19 settings = lib.mkOption {
20 inherit (settingsFormat) type;
21 default = { };
22 description = ''
23 Lazygit configuration.
24
25 See <https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md> for documentation.
26 '';
27 };
28 };
29
30 config = lib.mkIf cfg.enable {
31 environment = {
32 systemPackages = [ cfg.package ];
33 etc = lib.mkIf (cfg.settings != { }) {
34 "xdg/lazygit/config.yml".source = settingsFormat.generate "lazygit-config.yml" cfg.settings;
35 };
36 };
37 };
38
39 meta = {
40 maintainers = with lib.maintainers; [ linsui ];
41 };
42}