summaryrefslogtreecommitdiff
path: root/tests/services-offlineimap.nix
blob: a88e186f9bb39c786ca4ff5bdaf225f34957468b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
{ config, lib, pkgs, ... }:

with lib;

let
  offlineimap = pkgs.runCommand "offlineimap-0.0.0" {} "mkdir -p $out";
in

{
  services.offlineimap.enable = true;
  services.offlineimap.package = offlineimap;
  services.offlineimap.runQuick = true;
  services.offlineimap.extraConfig = ''
    [general]
    accounts = test
    ui = quiet

    [Account test]
    localrepository = testLocal
    remoterepository = testRemote
    autorefresh = 2
    maxage = 2017-07-01

    [Repository testLocal]
    type = GmailMaildir

    [Repository testRemote]
    type = Gmail
    ssl = yes
    starttls = no
    expunge = yes
  '';

  test = ''
    echo >&2 "checking offlineimap service in ~/Library/LaunchAgents"
    grep "org.nixos.offlineimap" ${config.out}/user/Library/LaunchAgents/org.nixos.offlineimap.plist
    grep "bin/offlineimap" ${config.out}/user/Library/LaunchAgents/org.nixos.offlineimap.plist
    grep "\-q" ${config.out}/user/Library/LaunchAgents/org.nixos.offlineimap.plist

    echo >&2 "checking config in /etc/offlineimaprc"
    grep "accounts\ \=\ test" ${config.out}/etc/offlineimaprc
  '';
}