bacon: fix configuration file location on Darwin

bacon reads its preferences from a different directory on Darwin.
Fix the path to read out of:
~/Library/Application\ Support/org.dystroy.bacon/prefs.toml
Linux behavior should be unchanged.
This commit is contained in:
Chris Pick 2025-01-01 07:51:47 -05:00 committed by GitHub
parent 2ac770c007
commit 59a4c43e9b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 37 additions and 6 deletions

View file

@ -7,6 +7,12 @@ let
cfg = config.programs.bacon;
settingsFormat = pkgs.formats.toml { };
configDir = if pkgs.stdenv.isDarwin then
"Library/Application Support/org.dystroy.bacon"
else
"${config.xdg.configHome}/bacon";
in {
meta.maintainers = [ hm.maintainers.shimunn ];
@ -34,7 +40,8 @@ in {
config = mkIf cfg.enable {
home.packages = [ cfg.package ];
xdg.configFile."bacon/prefs.toml".source =
settingsFormat.generate "prefs.toml" cfg.settings;
home.file."${configDir}/prefs.toml" = mkIf (cfg.settings != { }) {
source = settingsFormat.generate "prefs.toml" cfg.settings;
};
};
}