aerc: fix config paths on darwin

This commit is contained in:
Benjamin Lee 2023-10-22 01:49:52 -07:00 committed by GitHub
parent 81ab146262
commit 219d268a69
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 7 deletions

View file

@ -24,6 +24,11 @@ let
aerc-accounts = aerc-accounts =
attrsets.filterAttrs (_: v: v.aerc.enable) config.accounts.email.accounts; attrsets.filterAttrs (_: v: v.aerc.enable) config.accounts.email.accounts;
configDir = if pkgs.stdenv.isDarwin then
"Library/Preferences/aerc"
else
"${config.xdg.configHome}/aerc";
in { in {
meta.maintainers = with lib.hm.maintainers; [ lukasngl ]; meta.maintainers = with lib.hm.maintainers; [ lukasngl ];
@ -121,12 +126,12 @@ in {
mkStyleset = attrsets.mapAttrs' (k: v: mkStyleset = attrsets.mapAttrs' (k: v:
let value = if isString v then v else toINI { global = v; }; let value = if isString v then v else toINI { global = v; };
in { in {
name = "aerc/stylesets/${k}"; name = "${configDir}/stylesets/${k}";
value.text = joinCfg [ header value ]; value.text = joinCfg [ header value ];
}); });
mkTemplates = attrsets.mapAttrs' (k: v: { mkTemplates = attrsets.mapAttrs' (k: v: {
name = "aerc/templates/${k}"; name = "${configDir}/templates/${k}";
value.text = v; value.text = v;
}); });
@ -190,8 +195,8 @@ in {
home.packages = [ cfg.package ]; home.packages = [ cfg.package ];
xdg.configFile = { home.file = {
"aerc/accounts.conf" = mkIf genAccountsConf { "${configDir}/accounts.conf" = mkIf genAccountsConf {
text = joinCfg [ text = joinCfg [
header header
(mkINI cfg.extraAccounts) (mkINI cfg.extraAccounts)
@ -200,7 +205,7 @@ in {
]; ];
}; };
"aerc/aerc.conf" = mkIf genAercConf { "${configDir}/aerc.conf" = mkIf genAercConf {
text = joinCfg [ text = joinCfg [
header header
(mkINI cfg.extraConfig) (mkINI cfg.extraConfig)
@ -208,7 +213,7 @@ in {
]; ];
}; };
"aerc/binds.conf" = mkIf genBindsConf { "${configDir}/binds.conf" = mkIf genBindsConf {
text = joinCfg [ text = joinCfg [
header header
(mkINI cfg.extraBinds) (mkINI cfg.extraBinds)

View file

@ -4,7 +4,11 @@ with lib;
{ {
config = { config = {
nmt.script = let dir = "home-files/.config/aerc"; nmt.script = let
dir = if pkgs.stdenv.isDarwin then
"home-files/Library/Preferences/aerc"
else
"home-files/.config/aerc";
in '' in ''
assertFileContent ${dir}/accounts.conf ${./extraAccounts.expected} assertFileContent ${dir}/accounts.conf ${./extraAccounts.expected}
assertFileContent ${dir}/binds.conf ${./extraBinds.expected} assertFileContent ${dir}/binds.conf ${./extraBinds.expected}