From e17e5e4f48116763e7c544147cd5d27f94a63623 Mon Sep 17 00:00:00 2001 From: Utkarsh Gupta Date: Fri, 14 Apr 2023 15:06:38 +0530 Subject: [PATCH] bottom: use xdg.configHome on Darwin Both locations are supported, see https://clementtsang.github.io/bottom/nightly/configuration/config-file/default-config/ --- modules/programs/bottom.nix | 10 ++-------- tests/modules/programs/bottom/empty-settings.nix | 9 ++------- tests/modules/programs/bottom/example-settings.nix | 9 ++------- 3 files changed, 6 insertions(+), 22 deletions(-) diff --git a/modules/programs/bottom.nix b/modules/programs/bottom.nix index 459a3132c..cb09256c8 100644 --- a/modules/programs/bottom.nix +++ b/modules/programs/bottom.nix @@ -8,11 +8,6 @@ let tomlFormat = pkgs.formats.toml { }; - configDir = if pkgs.stdenv.isDarwin then - "Library/Application Support" - else - config.xdg.configHome; - in { options = { programs.bottom = { @@ -32,8 +27,7 @@ in { default = { }; description = '' Configuration written to - $XDG_CONFIG_HOME/bottom/bottom.toml on Linux or - $HOME/Library/Application Support/bottom/bottom.toml on Darwin. + $XDG_CONFIG_HOME/bottom/bottom.toml. See for the default configuration. @@ -57,7 +51,7 @@ in { config = mkIf cfg.enable { home.packages = [ cfg.package ]; - home.file."${configDir}/bottom/bottom.toml" = mkIf (cfg.settings != { }) { + xdg.configFile."bottom/bottom.toml" = mkIf (cfg.settings != { }) { source = tomlFormat.generate "bottom.toml" cfg.settings; }; }; diff --git a/tests/modules/programs/bottom/empty-settings.nix b/tests/modules/programs/bottom/empty-settings.nix index 15c03c11a..71799c831 100644 --- a/tests/modules/programs/bottom/empty-settings.nix +++ b/tests/modules/programs/bottom/empty-settings.nix @@ -9,13 +9,8 @@ with lib; package = config.lib.test.mkStubPackage { }; }; - nmt.script = let - configDir = if pkgs.stdenv.isDarwin then - "home-files/Library/Application Support" - else - "home-files/.config"; - in '' - assertPathNotExists ${configDir}/bottom + nmt.script = '' + assertPathNotExists home-files/.config/bottom ''; }; } diff --git a/tests/modules/programs/bottom/example-settings.nix b/tests/modules/programs/bottom/example-settings.nix index 1777b5264..a0ed11085 100644 --- a/tests/modules/programs/bottom/example-settings.nix +++ b/tests/modules/programs/bottom/example-settings.nix @@ -18,14 +18,9 @@ with lib; }; }; - nmt.script = let - configDir = if pkgs.stdenv.isDarwin then - "home-files/Library/Application Support" - else - "home-files/.config"; - in '' + nmt.script = '' assertFileContent \ - "${configDir}/bottom/bottom.toml" \ + "home-files/.config/bottom/bottom.toml" \ ${./example-settings-expected.toml} ''; };