mirror of
https://github.com/nix-community/home-manager
synced 2024-11-22 20:53:14 +00:00
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
This commit is contained in:
parent
417015af0d
commit
9a3a5b4402
2 changed files with 4 additions and 22 deletions
|
@ -3,8 +3,6 @@ let
|
||||||
cfg = config.programs.rio;
|
cfg = config.programs.rio;
|
||||||
|
|
||||||
settingsFormat = pkgs.formats.toml { };
|
settingsFormat = pkgs.formats.toml { };
|
||||||
|
|
||||||
inherit (pkgs.stdenv.hostPlatform) isDarwin;
|
|
||||||
in {
|
in {
|
||||||
options.programs.rio = {
|
options.programs.rio = {
|
||||||
enable = lib.mkEnableOption null // {
|
enable = lib.mkEnableOption null // {
|
||||||
|
@ -20,8 +18,7 @@ in {
|
||||||
type = settingsFormat.type;
|
type = settingsFormat.type;
|
||||||
default = { };
|
default = { };
|
||||||
description = ''
|
description = ''
|
||||||
Configuration written to <filename>$XDG_CONFIG_HOME/rio/config.toml</filename> on Linux or
|
Configuration written to <filename>$XDG_CONFIG_HOME/rio/config.toml</filename>. See
|
||||||
<filename>$HOME/Library/Application Support/rio/config.toml</filename> on Darwin. See
|
|
||||||
<link xlink:href="https://raphamorim.io/rio/docs/#configuration-file"/> for options.
|
<link xlink:href="https://raphamorim.io/rio/docs/#configuration-file"/> for options.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
@ -34,19 +31,11 @@ in {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Only manage configuration if not empty
|
# 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
|
xdg.configFile."rio/config.toml".source = if lib.isPath cfg.settings then
|
||||||
cfg.settings
|
cfg.settings
|
||||||
else
|
else
|
||||||
settingsFormat.generate "rio.toml" cfg.settings;
|
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;
|
|
||||||
})
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,6 @@
|
||||||
{ config, pkgs, ... }:
|
{ config, pkgs, ... }:
|
||||||
|
|
||||||
let
|
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" ''
|
expected = pkgs.writeText "rio-expected.toml" ''
|
||||||
cursor = "_"
|
cursor = "_"
|
||||||
padding-x = 0
|
padding-x = 0
|
||||||
|
@ -26,7 +19,7 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
nmt.script = ''
|
nmt.script = ''
|
||||||
assertFileExists home-files/"${path}"
|
assertFileExists home-files/.config/rio/config.toml
|
||||||
assertFileContent home-files/"${path}" '${expected}'
|
assertFileContent home-files/.config/rio/config.toml '${expected}'
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue