From 89db988ed2399c9970dffae03e50fa9f13e9690a Mon Sep 17 00:00:00 2001 From: linsui Date: Mon, 8 Apr 2024 20:41:09 +0800 Subject: [PATCH] nixos/lazygit: init Update nixos/modules/programs/lazygit.nix Co-authored-by: Aleksana Update nixos/modules/programs/lazygit.nix Co-authored-by: Aleksana --- nixos/modules/module-list.nix | 1 + nixos/modules/programs/lazygit.nix | 37 ++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 nixos/modules/programs/lazygit.nix 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 ]; + }; +}