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