lazygit: use xdg.configHome on Darwin

If XDG_CONFIG_HOME is set then lazygit will use it. We therefore write
to that directory if Home Manager is managing the XDG directory
variables.
This commit is contained in:
Utkarsh Gupta 2023-04-14 17:15:24 +05:30 committed by Robert Helgesson
parent ae79840bc7
commit cd690d2021
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89

View file

@ -34,8 +34,10 @@ in {
'';
description = ''
Configuration written to
<filename>$XDG_CONFIG_HOME/lazygit/config.yml</filename> on Linux
or <filename>~/Library/Application Support/lazygit/config.yml</filename> on Darwin. See
<filename>$XDG_CONFIG_HOME/lazygit/config.yml</filename>
on Linux or on Darwin if <xref linkend="opt-xdg.enable"/> is set, otherwise
<filename>~/Library/Application Support/lazygit/config.yml</filename>.
See
<link xlink:href="https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md"/>
for supported values.
'';
@ -46,12 +48,12 @@ in {
home.packages = [ cfg.package ];
home.file."Library/Application Support/lazygit/config.yml" =
mkIf (cfg.settings != { } && isDarwin) {
mkIf (cfg.settings != { } && (isDarwin && !config.xdg.enable)) {
source = yamlFormat.generate "lazygit-config" cfg.settings;
};
xdg.configFile."lazygit/config.yml" =
mkIf (cfg.settings != { } && !isDarwin) {
mkIf (cfg.settings != { } && !(isDarwin && !config.xdg.enable)) {
source = yamlFormat.generate "lazygit-config" cfg.settings;
};
};