Mail: send proper notifications
This commit is contained in:
parent
b26f2fce58
commit
37aed2697d
4 changed files with 246 additions and 26 deletions
240
flake.lock
240
flake.lock
|
@ -16,6 +16,22 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"advisory-db_2": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1683272394,
|
||||
"narHash": "sha256-4XQZbSZ8XYAeASpr0Er8mNPnjbYLJwvaB+VyH+bt6DE=",
|
||||
"owner": "rustsec",
|
||||
"repo": "advisory-db",
|
||||
"rev": "50bed3ba4066e6255dab434dc845e7f655812ce1",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "rustsec",
|
||||
"repo": "advisory-db",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"agenix": {
|
||||
"inputs": {
|
||||
"darwin": "darwin",
|
||||
|
@ -77,6 +93,30 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"crane_2": {
|
||||
"inputs": {
|
||||
"flake-compat": "flake-compat_2",
|
||||
"flake-utils": "flake-utils_4",
|
||||
"nixpkgs": [
|
||||
"maildir-notify-daemon",
|
||||
"nixpkgs"
|
||||
],
|
||||
"rust-overlay": "rust-overlay_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1683505101,
|
||||
"narHash": "sha256-VBU64Jfu2V4sUR5+tuQS9erBRAe/QEYUxdVMcJGMZZs=",
|
||||
"owner": "ipetkov",
|
||||
"repo": "crane",
|
||||
"rev": "7b5bd9e5acb2bb0cfba2d65f34d8568a894cdb6c",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "ipetkov",
|
||||
"repo": "crane",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"darwin": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
|
@ -104,9 +144,7 @@
|
|||
"advisory-db": "advisory-db",
|
||||
"crane": "crane",
|
||||
"flake-utils": "flake-utils_2",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
"nixpkgs": "nixpkgs"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1676919660,
|
||||
|
@ -126,9 +164,7 @@
|
|||
"inputs": {
|
||||
"fenix": "fenix",
|
||||
"flake-utils": "flake-utils_3",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
"nixpkgs": "nixpkgs_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1659395338,
|
||||
|
@ -219,6 +255,22 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-compat_2": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1673956053,
|
||||
"narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils": {
|
||||
"locked": {
|
||||
"lastModified": 1667395993,
|
||||
|
@ -264,6 +316,42 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils_4": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1681202837,
|
||||
"narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "cfacdce06f30d2b68473a46042957675eebb3401",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils_5": {
|
||||
"inputs": {
|
||||
"systems": "systems_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1681202837,
|
||||
"narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "cfacdce06f30d2b68473a46042957675eebb3401",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"home-manager": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
|
@ -346,6 +434,27 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"maildir-notify-daemon": {
|
||||
"inputs": {
|
||||
"advisory-db": "advisory-db_2",
|
||||
"crane": "crane_2",
|
||||
"flake-utils": "flake-utils_5",
|
||||
"nixpkgs": "nixpkgs_3"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1683946606,
|
||||
"narHash": "sha256-nzI8XDjf7Q0NZdVuxEvkkU4x0w229DmJZAN2yB92oMc=",
|
||||
"owner": "lelgenio",
|
||||
"repo": "maildir-notify-daemon",
|
||||
"rev": "f609cbd6dd6accce8f24594bc2e13822023e3d79",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "lelgenio",
|
||||
"repo": "maildir-notify-daemon",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"material-wifi-icons": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
|
@ -384,17 +493,18 @@
|
|||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1682669017,
|
||||
"narHash": "sha256-Vi+p4y3wnl0/4gcwTdmCO398kKlDaUrNROtf3GOD2NY=",
|
||||
"lastModified": 1683777345,
|
||||
"narHash": "sha256-V2p/A4RpEGqEZussOnHYMU6XglxBJGCODdzoyvcwig8=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "7449971a3ecf857b4a554cf79b1d9dcc1a4647d8",
|
||||
"rev": "635a306fc8ede2e34cb3dd0d6d0a5d49362150ed",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"id": "nixpkgs",
|
||||
"ref": "nixos-22.11",
|
||||
"type": "indirect"
|
||||
"owner": "NixOS",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-unstable": {
|
||||
|
@ -412,6 +522,52 @@
|
|||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1683408522,
|
||||
"narHash": "sha256-9kcPh6Uxo17a3kK3XCHhcWiV1Yu1kYj22RHiymUhMkU=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "897876e4c484f1e8f92009fd11b7d988a121a4e7",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"id": "nixpkgs",
|
||||
"ref": "nixos-unstable",
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"nixpkgs_3": {
|
||||
"locked": {
|
||||
"lastModified": 1683777345,
|
||||
"narHash": "sha256-V2p/A4RpEGqEZussOnHYMU6XglxBJGCODdzoyvcwig8=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "635a306fc8ede2e34cb3dd0d6d0a5d49362150ed",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_4": {
|
||||
"locked": {
|
||||
"lastModified": 1682669017,
|
||||
"narHash": "sha256-Vi+p4y3wnl0/4gcwTdmCO398kKlDaUrNROtf3GOD2NY=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "7449971a3ecf857b4a554cf79b1d9dcc1a4647d8",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"id": "nixpkgs",
|
||||
"ref": "nixos-22.11",
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"nur": {
|
||||
"locked": {
|
||||
"lastModified": 1682820334,
|
||||
|
@ -486,9 +642,10 @@
|
|||
"home-manager": "home-manager",
|
||||
"hyprland": "hyprland",
|
||||
"lipsum": "lipsum",
|
||||
"maildir-notify-daemon": "maildir-notify-daemon",
|
||||
"material-wifi-icons": "material-wifi-icons",
|
||||
"nix-index-database": "nix-index-database",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"nixpkgs": "nixpkgs_4",
|
||||
"nixpkgs-unstable": "nixpkgs-unstable",
|
||||
"nur": "nur",
|
||||
"plymouth-themes": "plymouth-themes",
|
||||
|
@ -542,6 +699,33 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"rust-overlay_2": {
|
||||
"inputs": {
|
||||
"flake-utils": [
|
||||
"maildir-notify-daemon",
|
||||
"crane",
|
||||
"flake-utils"
|
||||
],
|
||||
"nixpkgs": [
|
||||
"maildir-notify-daemon",
|
||||
"crane",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1683080331,
|
||||
"narHash": "sha256-nGDvJ1DAxZIwdn6ww8IFwzoHb2rqBP4wv/65Wt5vflk=",
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"rev": "d59c3fa0cba8336e115b376c2d9e91053aa59e56",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"sea-orm-cli": {
|
||||
"locked": {
|
||||
"lastModified": 1659947860,
|
||||
|
@ -558,6 +742,36 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"systems_2": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"utils": {
|
||||
"locked": {
|
||||
"lastModified": 1667395993,
|
||||
|
|
11
flake.nix
11
flake.nix
|
@ -50,14 +50,9 @@
|
|||
dzgui.inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
||||
# my stuff
|
||||
dhist = {
|
||||
url = "github:lelgenio/dhist";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
demoji = {
|
||||
url = "github:lelgenio/demoji";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
dhist.url = "github:lelgenio/dhist";
|
||||
demoji.url = "github:lelgenio/demoji";
|
||||
maildir-notify-daemon.url = "github:lelgenio/maildir-notify-daemon";
|
||||
};
|
||||
outputs = inputs@{ nixpkgs, nixpkgs-unstable, home-manager, nur, ... }:
|
||||
let
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
new-packages = (final: prev: packages // {
|
||||
dhist = inputs.dhist.packages.${prev.system}.dhist;
|
||||
demoji = inputs.demoji.packages.${prev.system}.default;
|
||||
maildir-notify-daemon = inputs.maildir-notify-daemon.packages.${prev.system}.default;
|
||||
dzgui = inputs.dzgui.packages.${prev.system}.dzgui;
|
||||
mpvpaper = inputs.wegank.packages.${prev.system}.mpvpaper;
|
||||
|
||||
|
|
|
@ -4,9 +4,6 @@ let
|
|||
|
||||
downloadEmails = "${pkgs.offlineimap}/bin/offlineimap";
|
||||
afterSync = "${pkgs.notmuch}/bin/notmuch new";
|
||||
onNewEmails = ''
|
||||
${pkgs.libnotify}/bin/notify-send "You've got mail!"
|
||||
'';
|
||||
|
||||
defaultAccountSettings = { boxes, }: {
|
||||
astroid.enable = true;
|
||||
|
@ -14,7 +11,6 @@ let
|
|||
enable = true;
|
||||
inherit boxes;
|
||||
onNotify = downloadEmails;
|
||||
onNotifyPost = onNewEmails;
|
||||
};
|
||||
offlineimap = {
|
||||
enable = true;
|
||||
|
@ -77,8 +73,22 @@ in
|
|||
Install = { WantedBy = [ "timers.target" ]; };
|
||||
};
|
||||
|
||||
systemd.user.services.maildir-notify-daemon = {
|
||||
Unit = {
|
||||
Description = "Desktop notification for new email";
|
||||
PartOf = [ "graphical-session.target" ];
|
||||
After = [ "graphical-session.target" ];
|
||||
};
|
||||
Service = {
|
||||
ExecStart = toString (pkgs.writeShellScript "maildir-notify-daemon-service" ''
|
||||
exec ${pkgs.maildir-notify-daemon}/bin/maildir-notify-daemon $HOME/Maildir/*/*/new
|
||||
'');
|
||||
Restart = "on-failure";
|
||||
};
|
||||
Install = { WantedBy = [ "sway-session.target" ]; };
|
||||
};
|
||||
|
||||
programs.notmuch.enable = true;
|
||||
programs.notmuch.hooks.postInsert = onNewEmails;
|
||||
|
||||
programs.msmtp.enable = true;
|
||||
|
||||
|
|
Reference in a new issue