imapnotify: move test

Also add test for the systemd service.
This commit is contained in:
Robert Helgesson 2023-07-09 09:34:18 +02:00
parent fad475553a
commit b70db52ff0
No known key found for this signature in database
GPG Key ID: 36BDAA14C2797E89
8 changed files with 55 additions and 2 deletions

View File

@ -146,8 +146,8 @@ import nmt {
./modules/xresources
] ++ lib.optionals isDarwin [
./modules/launchd
./modules/services/imapnotify-darwin
./modules/targets-darwin
./modules/programs/goimapnotify
] ++ lib.optionals isLinux [
./modules/config/i18n
./modules/i18n/input-method
@ -205,6 +205,7 @@ import nmt {
./modules/services/gpg-agent
./modules/services/gromit-mpx
./modules/services/home-manager-auto-upgrade
./modules/services/imapnotify
./modules/services/kanshi
./modules/services/lieer
./modules/services/mopidy

View File

@ -1 +0,0 @@
{ goimapnotify-launchd = ./launchd.nix; }

View File

@ -0,0 +1 @@
{ imapnotify-launchd = ./launchd.nix; }

View File

@ -0,0 +1 @@
{ imapnotify = ./imapnotify.nix; }

View File

@ -0,0 +1,39 @@
{ config, lib, pkgs, ... }:
with lib;
{
imports = [ ../../accounts/email-test-accounts.nix ];
accounts.email.accounts = {
"hm@example.com" = {
notmuch.enable = true;
imap.port = 993;
imapnotify = {
enable = true;
boxes = [ "Inbox" ];
onNotify = ''
${pkgs.notmuch}/bin/notmuch new
'';
};
};
};
services.imapnotify = {
enable = true;
package = (config.lib.test.mkStubPackage {
name = "goimapnotify";
outPath = "@goimapnotify@";
});
};
test.stubs.notmuch = { };
nmt.script = ''
serviceFile="home-files/.config/systemd/user/imapnotify-hm-example.com.service"
serviceFileNormalized="$(normalizeStorePaths "$serviceFile")"
assertFileExists $serviceFile
assertFileContent $serviceFileNormalized ${./imapnotify.service}
'';
}

View File

@ -0,0 +1,12 @@
[Install]
WantedBy=default.target
[Service]
Environment=NOTMUCH_CONFIG=/home/hm-user/.config/notmuch/default/config
ExecStart=@goimapnotify@/bin/goimapnotify -conf '/nix/store/00000000000000000000000000000000-imapnotify-hm-example.com-config.json'
Restart=always
RestartSec=30
Type=simple
[Unit]
Description=imapnotify for hm-example.com