From 9a3a5b4402e49ac62badff01b095f222724500a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20S=C3=A1nchez?= Date: Fri, 8 Mar 2024 13:18:28 +0000 Subject: [PATCH] rio: use XDG config for both linux and darwin `rio` now uses the same config location for both Linux and macOS: > MacOS and Linux configuration file path is `~/.config/rio/config.toml`. Ref: https://raphamorim.io/rio/docs/configuration-file --- modules/programs/rio.nix | 15 ++------------- tests/modules/programs/rio/example-settings.nix | 11 ++--------- 2 files changed, 4 insertions(+), 22 deletions(-) diff --git a/modules/programs/rio.nix b/modules/programs/rio.nix index 6d66c99d..67b7752c 100644 --- a/modules/programs/rio.nix +++ b/modules/programs/rio.nix @@ -3,8 +3,6 @@ let cfg = config.programs.rio; settingsFormat = pkgs.formats.toml { }; - - inherit (pkgs.stdenv.hostPlatform) isDarwin; in { options.programs.rio = { enable = lib.mkEnableOption null // { @@ -20,8 +18,7 @@ in { type = settingsFormat.type; default = { }; description = '' - Configuration written to $XDG_CONFIG_HOME/rio/config.toml on Linux or - $HOME/Library/Application Support/rio/config.toml on Darwin. See + Configuration written to $XDG_CONFIG_HOME/rio/config.toml. See for options. ''; }; @@ -34,19 +31,11 @@ in { } # Only manage configuration if not empty - (lib.mkIf (cfg.settings != { } && !isDarwin) { + (lib.mkIf (cfg.settings != { }) { xdg.configFile."rio/config.toml".source = if lib.isPath cfg.settings then cfg.settings else settingsFormat.generate "rio.toml" cfg.settings; }) - - (lib.mkIf (cfg.settings != { } && isDarwin) { - home.file."Library/Application Support/rio/config.toml".source = - if lib.isPath cfg.settings then - cfg.settings - else - settingsFormat.generate "rio.toml" cfg.settings; - }) ]); } diff --git a/tests/modules/programs/rio/example-settings.nix b/tests/modules/programs/rio/example-settings.nix index f3e116f0..68fec357 100644 --- a/tests/modules/programs/rio/example-settings.nix +++ b/tests/modules/programs/rio/example-settings.nix @@ -1,13 +1,6 @@ { config, pkgs, ... }: let - inherit (pkgs.stdenv.hostPlatform) isDarwin; - - path = if isDarwin then - "Library/Application Support/rio/config.toml" - else - ".config/rio/config.toml"; - expected = pkgs.writeText "rio-expected.toml" '' cursor = "_" padding-x = 0 @@ -26,7 +19,7 @@ in { }; nmt.script = '' - assertFileExists home-files/"${path}" - assertFileContent home-files/"${path}" '${expected}' + assertFileExists home-files/.config/rio/config.toml + assertFileContent home-files/.config/rio/config.toml '${expected}' ''; }