diff --git a/modules/programs/astroid.nix b/modules/programs/astroid.nix index 296e8dc5e..4e79ea4d3 100644 --- a/modules/programs/astroid.nix +++ b/modules/programs/astroid.nix @@ -42,7 +42,8 @@ let template = fromJSON (readFile ./astroid-config-template.json); astroidConfig = foldl' recursiveUpdate template [ { - astroid.notmuch_config = "${config.xdg.configHome}/notmuch/notmuchrc"; + astroid.notmuch_config = + "${config.xdg.configHome}/notmuch/default/config"; accounts = mapAttrs (n: accountAttr) astroidAccounts; crypto.gpg.path = "${pkgs.gnupg}/bin/gpg"; } diff --git a/modules/programs/notmuch.nix b/modules/programs/notmuch.nix index b93cc6a5e..9c1c9f5c0 100644 --- a/modules/programs/notmuch.nix +++ b/modules/programs/notmuch.nix @@ -167,29 +167,29 @@ in { home.packages = [ pkgs.notmuch ]; home.sessionVariables = { - NOTMUCH_CONFIG = "${config.xdg.configHome}/notmuch/notmuchrc"; + NOTMUCH_CONFIG = "${config.xdg.configHome}/notmuch/default/config"; NMBGIT = "${config.xdg.dataHome}/notmuch/nmbug"; }; - xdg.configFile."notmuch/notmuchrc".text = - let toIni = generators.toINI { mkKeyValue = mkIniKeyValue; }; - in '' - # Generated by Home Manager. - - '' + toIni notmuchIni; - - home.file = let + xdg.configFile = let hook = name: cmds: { - "${notmuchIni.database.path}/.notmuch/hooks/${name}".source = - pkgs.writeShellScript name '' - export PATH="${pkgs.notmuch}/bin''${PATH:+:}$PATH" - export NOTMUCH_CONFIG="${config.xdg.configHome}/notmuch/notmuchrc" - export NMBGIT="${config.xdg.dataHome}/notmuch/nmbug" + "notmuch/default/hooks/${name}".source = pkgs.writeShellScript name '' + export PATH="${pkgs.notmuch}/bin''${PATH:+:}$PATH" + export NOTMUCH_CONFIG="${config.xdg.configHome}/notmuch/default/config" + export NMBGIT="${config.xdg.dataHome}/notmuch/nmbug" - ${cmds} - ''; + ${cmds} + ''; }; - in optionalAttrs (cfg.hooks.preNew != "") (hook "pre-new" cfg.hooks.preNew) + in { + "notmuch/default/config".text = + let toIni = generators.toINI { mkKeyValue = mkIniKeyValue; }; + in '' + # Generated by Home Manager. + + '' + toIni notmuchIni; + } + // optionalAttrs (cfg.hooks.preNew != "") (hook "pre-new" cfg.hooks.preNew) // optionalAttrs (cfg.hooks.postNew != "") (hook "post-new" cfg.hooks.postNew) // optionalAttrs (cfg.hooks.postInsert != "") diff --git a/modules/services/imapnotify.nix b/modules/services/imapnotify.nix index d33124522..6a464ec8c 100644 --- a/modules/services/imapnotify.nix +++ b/modules/services/imapnotify.nix @@ -27,7 +27,7 @@ let Type = "simple"; } // optionalAttrs account.notmuch.enable { Environment = - "NOTMUCH_CONFIG=${config.xdg.configHome}/notmuch/notmuchrc"; + "NOTMUCH_CONFIG=${config.xdg.configHome}/notmuch/default/config"; }; Install = { WantedBy = [ "default.target" ]; }; diff --git a/modules/services/lieer.nix b/modules/services/lieer.nix index 6960db452..e5f307616 100644 --- a/modules/services/lieer.nix +++ b/modules/services/lieer.nix @@ -27,7 +27,7 @@ let ExecStart = "${config.programs.lieer.package}/bin/gmi sync"; WorkingDirectory = account.maildir.absPath; Environment = - "NOTMUCH_CONFIG=${config.xdg.configHome}/notmuch/notmuchrc"; + "NOTMUCH_CONFIG=${config.xdg.configHome}/notmuch/default/config"; }; }; }; diff --git a/tests/modules/services/lieer/lieer-service-expected.service b/tests/modules/services/lieer/lieer-service-expected.service index 1d282eb98..89859f824 100644 --- a/tests/modules/services/lieer/lieer-service-expected.service +++ b/tests/modules/services/lieer/lieer-service-expected.service @@ -1,5 +1,5 @@ [Service] -Environment=NOTMUCH_CONFIG=/home/hm-user/.config/notmuch/notmuchrc +Environment=NOTMUCH_CONFIG=/home/hm-user/.config/notmuch/default/config ExecStart=@gmailieer@/bin/gmi sync Type=oneshot WorkingDirectory=/home/hm-user/Mail/hm@example.com