diff options
-rw-r--r-- | overlays/afew.nix | 12 | ||||
-rw-r--r-- | user-profiles/feeds/module.nix | 32 |
2 files changed, 37 insertions, 7 deletions
diff --git a/overlays/afew.nix b/overlays/afew.nix new file mode 100644 index 00000000..5075d678 --- /dev/null +++ b/overlays/afew.nix | |||
@@ -0,0 +1,12 @@ | |||
1 | final: prev: { | ||
2 | afew = prev.afew.overrideAttrs (oldAttrs: { | ||
3 | src = prev.fetchgit { | ||
4 | url = "https://github.com/gkleen/afew.git"; | ||
5 | rev = "7b96c73000152188bf8ec9168721f26f5bd01aa6"; | ||
6 | sha256 = "09pmfyxq2j0rqvdisahpxpskvxckksx6gq9axdc83ppkws25iprm"; | ||
7 | leaveDotGit = true; | ||
8 | }; | ||
9 | |||
10 | nativeBuildInputs = oldAttrs.nativeBuildInputs or [] ++ [ final.git ]; | ||
11 | }); | ||
12 | } | ||
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" = { |