diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index b361e9ee5e41..c982382101eb 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -212,6 +212,7 @@ ./programs/kbdlight.nix ./programs/kclock.nix ./programs/kdeconnect.nix + ./programs/lazygit.nix ./programs/less.nix ./programs/liboping.nix ./programs/light.nix diff --git a/nixos/modules/programs/lazygit.nix b/nixos/modules/programs/lazygit.nix new file mode 100644 index 000000000000..3e36a0e0c4a8 --- /dev/null +++ b/nixos/modules/programs/lazygit.nix @@ -0,0 +1,37 @@ +{ config, lib, pkgs, ... }: + +let + cfg = config.programs.lazygit; + + settingsFormat = pkgs.formats.yaml { }; +in +{ + options.programs.lazygit = { + enable = lib.mkEnableOption "lazygit, a simple terminal UI for git commands"; + + package = lib.mkPackageOption pkgs "lazygit" { }; + + settings = lib.mkOption { + inherit (settingsFormat) type; + default = { }; + description = '' + Lazygit configuration. + + See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md for documentation. + ''; + }; + }; + + config = lib.mkIf cfg.enable { + environment = { + systemPackages = [ cfg.package ]; + etc = lib.mkIf (cfg.settings != { }) { + "xdg/lazygit/config.yml".source = settingsFormat.generate "lazygit-config.yml" cfg.settings; + }; + }; + }; + + meta = { + maintainers = with lib.maintainers; [ linsui ]; + }; +}