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:
parent
2ac770c007
commit
59a4c43e9b
4 changed files with 37 additions and 6 deletions
|
@ -7,6 +7,12 @@ let
|
||||||
cfg = config.programs.bacon;
|
cfg = config.programs.bacon;
|
||||||
|
|
||||||
settingsFormat = pkgs.formats.toml { };
|
settingsFormat = pkgs.formats.toml { };
|
||||||
|
|
||||||
|
configDir = if pkgs.stdenv.isDarwin then
|
||||||
|
"Library/Application Support/org.dystroy.bacon"
|
||||||
|
else
|
||||||
|
"${config.xdg.configHome}/bacon";
|
||||||
|
|
||||||
in {
|
in {
|
||||||
meta.maintainers = [ hm.maintainers.shimunn ];
|
meta.maintainers = [ hm.maintainers.shimunn ];
|
||||||
|
|
||||||
|
@ -34,7 +40,8 @@ in {
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
home.packages = [ cfg.package ];
|
home.packages = [ cfg.package ];
|
||||||
|
|
||||||
xdg.configFile."bacon/prefs.toml".source =
|
home.file."${configDir}/prefs.toml" = mkIf (cfg.settings != { }) {
|
||||||
settingsFormat.generate "prefs.toml" cfg.settings;
|
source = settingsFormat.generate "prefs.toml" cfg.settings;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,10 @@
|
||||||
{ ... }: {
|
{ pkgs, ... }:
|
||||||
|
let
|
||||||
|
configDir = if pkgs.stdenv.isDarwin then
|
||||||
|
"Library/Application Support/org.dystroy.bacon"
|
||||||
|
else
|
||||||
|
".config/bacon";
|
||||||
|
in {
|
||||||
programs.bacon = {
|
programs.bacon = {
|
||||||
enable = true;
|
enable = true;
|
||||||
settings = {
|
settings = {
|
||||||
|
@ -17,7 +23,7 @@
|
||||||
};
|
};
|
||||||
test.stubs.bacon = { };
|
test.stubs.bacon = { };
|
||||||
nmt.script = ''
|
nmt.script = ''
|
||||||
assertFileExists home-files/.config/bacon/prefs.toml
|
assertFileExists 'home-files/${configDir}/prefs.toml'
|
||||||
assertFileContent home-files/.config/bacon/prefs.toml ${./expected.toml}
|
assertFileContent 'home-files/${configDir}/prefs.toml' ${./expected.toml}
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1,4 @@
|
||||||
{ bacon-program = ./bacon.nix; }
|
{
|
||||||
|
bacon-program = ./bacon.nix;
|
||||||
|
bacon-empty-config = ./empty-config.nix;
|
||||||
|
}
|
||||||
|
|
15
tests/modules/programs/bacon/empty-config.nix
Normal file
15
tests/modules/programs/bacon/empty-config.nix
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
{ pkgs, ... }:
|
||||||
|
let
|
||||||
|
configDir = if pkgs.stdenv.isDarwin then
|
||||||
|
"Library/Application Support/org.dystroy.bacon"
|
||||||
|
else
|
||||||
|
".config/bacon";
|
||||||
|
in {
|
||||||
|
programs.bacon.enable = true;
|
||||||
|
|
||||||
|
test.stubs.bacon = { };
|
||||||
|
|
||||||
|
nmt.script = ''
|
||||||
|
assertPathNotExists 'home-files/${configDir}/prefs.toml'
|
||||||
|
'';
|
||||||
|
}
|
Loading…
Reference in a new issue