dot

NixOS dotfiles
git clone https://git.echoz.io/dot.git
Log | Files | Refs

filters.nix (1764B)


      1 {
      2   lib,
      3   pkgs,
      4 
      5   user,
      6 
      7   mkNixPak,
      8   ...
      9 }:
     10 {
     11   home-manager.users.${user}.programs.aerc.extraConfig.filters = {
     12     "text/plain" = "colorize";
     13     "text/calendar" = "calendar";
     14     "message/rfc822" = "colorize";
     15     "message/delivery-status" = "colorize";
     16     ".headers" = "colorize";
     17 
     18     "text/html" = builtins.toString (
     19       lib.getExe
     20         (mkNixPak {
     21           config.app.package = pkgs.writeShellScriptBin "w3m-html-filter" ''
     22             export LC_ALL=C.UTF-8
     23             exec ${lib.getExe pkgs.w3m} -dump -T text/html -no-cookie -config /dev/null \
     24               | ${lib.getExe pkgs.perl} -CS -ne 's/[\p{M}\p{Cf}]//g; s/[ \t\p{Zs}]+$//; print unless /^[ \t\p{Zs}]*$/ && $p; $p=/^[ \t\p{Zs}]*$/;'
     25           '';
     26           config.dbus.enable = false;
     27           config.bubblewrap.network = false;
     28           config.bubblewrap.bindEntireStore = false;
     29         }).config.script
     30     );
     31 
     32     "application/pdf" = builtins.toString (
     33       lib.getExe
     34         (mkNixPak {
     35           config.app.package = pkgs.writeShellScriptBin "w3m-pdf-filter" ''
     36             exec ${pkgs.poppler-utils}/bin/pdftotext -layout - -
     37           '';
     38           config.dbus.enable = false;
     39           config.bubblewrap.network = false;
     40           config.bubblewrap.bindEntireStore = false;
     41         }).config.script
     42     );
     43 
     44     "application/vnd.openxmlformats-officedocument.wordprocessingml.document" = builtins.toString (
     45       lib.getExe
     46         (mkNixPak {
     47           config.app.package = pkgs.writeShellScriptBin "w3m-pdf-filter" ''
     48             exec ${lib.getExe pkgs.pandoc} -f docx -t plain
     49           '';
     50           config.dbus.enable = false;
     51           config.bubblewrap.network = false;
     52           config.bubblewrap.bindEntireStore = false;
     53         }).config.script
     54     );
     55   };
     56 }