From e69fbc243a1004bb6c216597d4c5b8779dd28f1b Mon Sep 17 00:00:00 2001 From: Benedikt Rips Date: Mon, 5 Jan 2026 23:00:13 +0100 Subject: [PATCH] lazygit: deduplicate platform-dependent files --- modules/programs/lazygit.nix | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/modules/programs/lazygit.nix b/modules/programs/lazygit.nix index b499d6cb5..b14eeba70 100644 --- a/modules/programs/lazygit.nix +++ b/modules/programs/lazygit.nix @@ -11,8 +11,11 @@ let yamlFormat = pkgs.formats.yaml { }; - inherit (pkgs.stdenv.hostPlatform) isDarwin; - + configDir = + if pkgs.stdenv.hostPlatform.isDarwin && !config.xdg.enable then + "Library/Application Support" + else + config.xdg.configHome; in { meta.maintainers = [ @@ -71,17 +74,10 @@ in config = mkIf cfg.enable { home.packages = mkIf (cfg.package != null) [ cfg.package ]; - home.file."Library/Application Support/lazygit/config.yml" = - mkIf (cfg.settings != { } && (isDarwin && !config.xdg.enable)) - { - source = yamlFormat.generate "lazygit-config" cfg.settings; - }; - - xdg.configFile."lazygit/config.yml" = - mkIf (cfg.settings != { } && !(isDarwin && !config.xdg.enable)) - { - source = yamlFormat.generate "lazygit-config" cfg.settings; - }; + home.file."${configDir}/lazygit/config.yml" = { + enable = cfg.settings != { }; + source = yamlFormat.generate "lazygit-config" cfg.settings; + }; programs = let