infrastructure

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

home.nix (3803B)


      1 { config, pkgs, ... }:
      2 
      3 {
      4   home-manager.backupFileExtension = "backup";
      5   home-manager.users.silas =
      6     {
      7       pkgs,
      8       lib,
      9       config,
     10       ...
     11     }:
     12     {
     13       home.stateVersion = "24.11";
     14       home.shellAliases = {
     15         paperless-manage = "sudo -u paperless /var/lib/paperless/paperless-manage";
     16       };
     17 
     18       programs.emacs = {
     19         enable = true;
     20         package = pkgs.emacs-pgtk;
     21         extraConfig = builtins.readFile ./init.el;
     22         extraPackages = ep: [
     23           ep.magit
     24           ep.expand-region
     25           ep.hyperbole
     26           ep.notmuch
     27           ep.pdf-tools
     28           (ep.treesit-grammars.with-grammars (g: [
     29             g.tree-sitter-python
     30             g.tree-sitter-rust
     31             g.tree-sitter-nix
     32           ]))
     33         ];
     34       };
     35 
     36       services.mbsync = {
     37         enable = true;
     38         frequency = "*:0/5";
     39         postExec = "${pkgs.notmuch}/bin/notmuch new";
     40       };
     41 
     42       programs.mbsync = {
     43         enable = true;
     44         extraConfig = ''
     45           IMAPAccount silasbrack
     46           Host mail.silasbrack.com
     47           User silas@silasbrack.com
     48           PassCmd "cat /run/secrets/silas_at_silasbrack_dot_com_password"
     49           TLSType IMAPS
     50 
     51           IMAPStore silasbrack-remote
     52           Account silasbrack
     53 
     54           MaildirStore silasbrack-local
     55           Path ~/Mail/silasbrack/
     56           Inbox ~/Mail/silasbrack/INBOX
     57           SubFolders Verbatim
     58 
     59           Channel silasbrack
     60           Far :silasbrack-remote:
     61           Near :silasbrack-local:
     62           Patterns *
     63           Create Both
     64           Expunge Both
     65           SyncState *
     66 
     67 
     68           IMAPAccount gmail
     69           Host imap.gmail.com
     70           Port 993
     71           User silasbrack@gmail.com
     72           PassCmd "cat /run/secrets/silasbrack_at_gmail_dot_com_app_password"
     73           TLSType IMAPS
     74 
     75           IMAPStore gmail-remote
     76           Account gmail
     77 
     78           MaildirStore gmail-local
     79           Path ~/Mail/gmail/
     80           SubFolders Verbatim
     81 
     82           Channel gmail
     83           Far :gmail-remote:
     84           Near :gmail-local:
     85           Patterns * ![Gmail]* "[Gmail]/Sent Mail" "[Gmail]/Starred" "[Gmail]/All Mail" "[Gmail]/Trash"
     86           Expunge None
     87           CopyArrivalDate yes
     88           Sync All
     89           Create Both
     90           SyncState *
     91         '';
     92       };
     93 
     94       programs.msmtp = {
     95         enable = true;
     96         configContent = ''
     97           defaults
     98           tls on
     99 
    100           account silasbrack
    101           host mail.silasbrack.com
    102           port 465
    103           tls_starttls off
    104           auth on
    105           user silas@silasbrack.com
    106           from silas@silasbrack.com
    107           passwordeval "cat /run/secrets/silas_at_silasbrack_dot_com_password"
    108 
    109           account default : silasbrack
    110         '';
    111       };
    112 
    113       accounts.email.maildirBasePath = "Mail";
    114       accounts.email.accounts.silasbrack = {
    115         primary = true;
    116         address = "silas@silasbrack.com";
    117         realName = "Silas Brack";
    118         notmuch.enable = true;
    119       };
    120 
    121       programs.notmuch = {
    122         enable = true;
    123         new.tags = [ "new" ];
    124         search.excludeTags = [ "deleted" "spam" ];
    125         hooks.postNew = ''
    126           notmuch tag +inbox -new -- tag:new AND folder:silasbrack/INBOX
    127           notmuch tag +sent -new -- tag:new AND folder:silasbrack/Sent
    128           notmuch tag +trash -new -- tag:new AND folder:silasbrack/Trash
    129           notmuch tag +spam -new -- tag:new AND folder:silasbrack/Junk
    130           notmuch tag +inbox -new -- tag:new AND folder:gmail/INBOX
    131           notmuch tag +sent -new -- "tag:new AND folder:gmail/[Gmail]/Sent Mail"
    132           notmuch tag +trash -new -- "tag:new AND folder:gmail/[Gmail]/Trash"
    133           notmuch tag +starred -new -- "tag:new AND folder:gmail/[Gmail]/Starred"
    134           notmuch tag -new -- tag:new
    135         '';
    136       };
    137     };
    138 }