Skip to content

Commit

Permalink
Refactored
Browse files Browse the repository at this point in the history
  • Loading branch information
alejandro-angulo committed Aug 20, 2024
1 parent 41f7b71 commit becaf70
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions modules/home-manager/lazygit.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,32 @@
lib,
pkgs,
...
}: let
}:
let
inherit (lib) ctp;
inherit (config.catppuccin) sources;
inherit (pkgs.stdenv.hostPlatform) isDarwin;

cfg = config.programs.lazygit.catppuccin;
enable = cfg.enable && config.programs.lazygit.enable;

# NOTE: On MacOS specifically, k9s expects its configuration to be in
# `~/Library/Application Support` when not using XDG
enableXdgConfig = !pkgs.stdenv.hostPlatform.isDarwin || config.xdg.enable;

configDirectory =
if (isDarwin && !config.xdg.enable)
then "${config.home.homeDirectory}/Library/Application Support/lazygit"
else "${config.xdg.configHome}/lazygit";
in {
options.programs.lazygit.catppuccin =
lib.ctp.mkCatppuccinOpt {name = "lazygit";}
// {
accent = ctp.mkAccentOpt "lazygit";
};
if enableXdgConfig then
"${config.home.homeDirectory}/Library/Application Support"
else
"${config.xdg.configHome}";
configFile = "${configDirectory}/lazygit/config.yml";
in
{
options.programs.lazygit.catppuccin = lib.ctp.mkCatppuccinOpt { name = "lazygit"; } // {
accent = ctp.mkAccentOpt "lazygit";
};

config.home.sessionVariables = lib.mkIf enable {
# Ensure that the default config file is still sourced
LG_CONFIG_FILE = "${sources.lazygit}/themes-mergable/${cfg.flavor}/${cfg.accent}.yml,${configDirectory}/config.yml";
LG_CONFIG_FILE = "${sources.lazygit}/themes-mergable/${cfg.flavor}/${cfg.accent}.yml,${configFile}";
};
}

0 comments on commit becaf70

Please sign in to comment.