Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(home-manager/lazygit): support darwin without XDG #313

Merged
merged 3 commits into from
Aug 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions modules/home-manager/lazygit.nix
Original file line number Diff line number Diff line change
@@ -1,9 +1,26 @@
{ config, lib, ... }:
{
config,
lib,
pkgs,
...
}:
let
inherit (lib) ctp;
inherit (config.catppuccin) sources;

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 enableXdgConfig then
config.xdg.configHome
else
"${config.home.homeDirectory}/Library/Application Support";
configFile = "${configDirectory}/lazygit/config.yml";
in
{
options.programs.lazygit.catppuccin = lib.ctp.mkCatppuccinOpt { name = "lazygit"; } // {
Expand All @@ -12,6 +29,6 @@ in

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,${config.xdg.configHome}/lazygit/config.yml";
LG_CONFIG_FILE = "${sources.lazygit}/themes-mergable/${cfg.flavor}/${cfg.accent}.yml,${configFile}";
};
}