diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2021-09-08 15:19:50 +0200 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2021-09-08 15:19:50 +0200 |
commit | d8232b77c7fe48b3796d59e6914373f2bd1bd91e (patch) | |
tree | 0110fc4f84a1b1bce377522399f413538aa9378f /user-profiles/feeds | |
parent | 227b60d10f60517bbc0b21126e4cc02ad134583c (diff) | |
download | nixos-d8232b77c7fe48b3796d59e6914373f2bd1bd91e.tar nixos-d8232b77c7fe48b3796d59e6914373f2bd1bd91e.tar.gz nixos-d8232b77c7fe48b3796d59e6914373f2bd1bd91e.tar.bz2 nixos-d8232b77c7fe48b3796d59e6914373f2bd1bd91e.tar.xz nixos-d8232b77c7fe48b3796d59e6914373f2bd1bd91e.zip |
feeds: afew
Diffstat (limited to 'user-profiles/feeds')
-rw-r--r-- | user-profiles/feeds/module.nix | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/user-profiles/feeds/module.nix b/user-profiles/feeds/module.nix index 854083ee..da992b8c 100644 --- a/user-profiles/feeds/module.nix +++ b/user-profiles/feeds/module.nix | |||
@@ -5,7 +5,6 @@ with lib; | |||
5 | let | 5 | let |
6 | inherit (flakeInputs.home-manager.lib) hm; | 6 | inherit (flakeInputs.home-manager.lib) hm; |
7 | 7 | ||
8 | configPath = "${config.xdg.configHome}/feeds/notmuchrc"; | ||
9 | databasePath = "${config.xdg.dataHome}/feeds"; | 8 | databasePath = "${config.xdg.dataHome}/feeds"; |
10 | 9 | ||
11 | imm = | 10 | imm = |
@@ -131,6 +130,30 @@ let | |||
131 | 130 | ||
132 | search = { exclude_tags = ["deleted"]; }; | 131 | search = { exclude_tags = ["deleted"]; }; |
133 | }; | 132 | }; |
133 | configPath = pkgs.writeText "notmuchrc" (generators.toINI { mkKeyValue = mkIniKeyValue; } notmuchIni); | ||
134 | |||
135 | afewConfigDir = pkgs.symlinkJoin { | ||
136 | name = "afew-config"; | ||
137 | paths = [ | ||
138 | (pkgs.writeTextDir "config" '' | ||
139 | [InboxFilter] | ||
140 | '') | ||
141 | ]; | ||
142 | }; | ||
143 | |||
144 | notmuchHooksDir = | ||
145 | let | ||
146 | afewHook = pkgs.writeShellScript "afew" '' | ||
147 | exec -- ${pkgs.afew}/bin/afew -c ${afewConfigDir} -C ${configPath} --tag --new -vv | ||
148 | ''; | ||
149 | in pkgs.linkFarm "notmuch-hooks" [ | ||
150 | { name = "post-new"; | ||
151 | path = afewHook; | ||
152 | } | ||
153 | { name = "post-insert"; | ||
154 | path = afewHook; | ||
155 | } | ||
156 | ]; | ||
134 | in { | 157 | in { |
135 | config = { | 158 | config = { |
136 | home.packages = [ immWrapped ]; | 159 | home.packages = [ immWrapped ]; |
@@ -138,12 +161,6 @@ in { | |||
138 | home.activation.createImm = hm.dag.entryAfter ["writeBoundary"] '' | 161 | home.activation.createImm = hm.dag.entryAfter ["writeBoundary"] '' |
139 | $DRY_RUN_CMD mkdir -p $VERBOSE_ARG ${config.xdg.configHome}/imm | 162 | $DRY_RUN_CMD mkdir -p $VERBOSE_ARG ${config.xdg.configHome}/imm |
140 | ''; | 163 | ''; |
141 | |||
142 | xdg.configFile."feeds/notmuchrc".text = | ||
143 | let toIni = generators.toINI { mkKeyValue = mkIniKeyValue; }; | ||
144 | in '' | ||
145 | # Generated by Home Manager. | ||
146 | '' + toIni notmuchIni; | ||
147 | 164 | ||
148 | home.activation.createFeedsDatabase = hm.dag.entryAfter ["linkGeneration" "writeBoundary"] '' | 165 | home.activation.createFeedsDatabase = hm.dag.entryAfter ["linkGeneration" "writeBoundary"] '' |
149 | $DRY_RUN_CMD mkdir -p -m 0750 $VERBOSE_ARG ${databasePath} | 166 | $DRY_RUN_CMD mkdir -p -m 0750 $VERBOSE_ARG ${databasePath} |
@@ -155,6 +172,7 @@ in { | |||
155 | fi | 172 | fi |
156 | NOTMUCH_CONFIG=${configPath} $DRY_RUN_CMD ${pkgs.notmuch}/bin/notmuch new $NOTMUCH_VERBOSE_ARG | 173 | NOTMUCH_CONFIG=${configPath} $DRY_RUN_CMD ${pkgs.notmuch}/bin/notmuch new $NOTMUCH_VERBOSE_ARG |
157 | fi | 174 | fi |
175 | $DRY_RUN_CMD ln -Tsf $VERBOSE_ARG ${notmuchHooksDir} ${databasePath}/.notmuch/hooks | ||
158 | ''; | 176 | ''; |
159 | 177 | ||
160 | systemd.user.services."logrotate-imm" = { | 178 | systemd.user.services."logrotate-imm" = { |