From f833d2a35409a6c2b79954505d42ad62f3cd7c04 Mon Sep 17 00:00:00 2001 From: Benjamin Lee Date: Sun, 22 Oct 2023 01:49:52 -0700 Subject: [PATCH] aerc: fix config paths on darwin --- modules/programs/aerc.nix | 17 +++++++++++------ tests/modules/programs/aerc/settings.nix | 6 +++++- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/modules/programs/aerc.nix b/modules/programs/aerc.nix index 67cbdfe7e..0bfaa8f4a 100644 --- a/modules/programs/aerc.nix +++ b/modules/programs/aerc.nix @@ -24,6 +24,11 @@ let aerc-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 { meta.maintainers = with lib.hm.maintainers; [ lukasngl ]; @@ -121,12 +126,12 @@ in { mkStyleset = attrsets.mapAttrs' (k: v: let value = if isString v then v else toINI { global = v; }; in { - name = "aerc/stylesets/${k}"; + name = "${configDir}/stylesets/${k}"; value.text = joinCfg [ header value ]; }); mkTemplates = attrsets.mapAttrs' (k: v: { - name = "aerc/templates/${k}"; + name = "${configDir}/templates/${k}"; value.text = v; }); @@ -190,8 +195,8 @@ in { home.packages = [ cfg.package ]; - xdg.configFile = { - "aerc/accounts.conf" = mkIf genAccountsConf { + home.file = { + "${configDir}/accounts.conf" = mkIf genAccountsConf { text = joinCfg [ header (mkINI cfg.extraAccounts) @@ -200,7 +205,7 @@ in { ]; }; - "aerc/aerc.conf" = mkIf genAercConf { + "${configDir}/aerc.conf" = mkIf genAercConf { text = joinCfg [ header (mkINI cfg.extraConfig) @@ -208,7 +213,7 @@ in { ]; }; - "aerc/binds.conf" = mkIf genBindsConf { + "${configDir}/binds.conf" = mkIf genBindsConf { text = joinCfg [ header (mkINI cfg.extraBinds) diff --git a/tests/modules/programs/aerc/settings.nix b/tests/modules/programs/aerc/settings.nix index fa385655a..aa89cc4af 100644 --- a/tests/modules/programs/aerc/settings.nix +++ b/tests/modules/programs/aerc/settings.nix @@ -4,7 +4,11 @@ with lib; { 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 '' assertFileContent ${dir}/accounts.conf ${./extraAccounts.expected} assertFileContent ${dir}/binds.conf ${./extraBinds.expected}