programs/lieer: add activation script

This commit is contained in:
Tad Fisher 2024-01-09 12:58:55 -08:00
parent e13aa9e287
commit 8be95502b6
No known key found for this signature in database
GPG key ID: 3A7425F7E7B22251
2 changed files with 13 additions and 0 deletions

View file

@ -31,6 +31,10 @@ let
({ account = account.address; } // account.lieer.settings); ({ account = account.address; } // account.lieer.settings);
}; };
activationScript = account: ''
$DRY_RUN_CMD mkdir -m700 -p $VERBOSE_ARG "${account.maildir.absPath}"/mail/{cur,new,tmp}
'';
settingsOpts = { settingsOpts = {
drop_non_existing_label = mkOption { drop_non_existing_label = mkOption {
type = types.bool; type = types.bool;
@ -288,6 +292,13 @@ in {
programs.notmuch.new.ignore = [ "/.*[.](json|lock|bak)$/" ]; programs.notmuch.new.ignore = [ "/.*[.](json|lock|bak)$/" ];
home.file = listToAttrs (map configFile lieerAccounts); home.file = listToAttrs (map configFile lieerAccounts);
# Lieer requires the maildir structure to exist before syncing will work.
# Normally this is done via 'gmi init', but 'gmi init' bails out if the
# config file alreasy exists.
home.activation.initLieer =
hm.dag.entryBetween [ "linkGeneration" ] [ "writeBoundary" ]
(concatMapStringsSep "\n" activationScript lieerAccounts);
} }
]); ]);
} }

View file

@ -20,6 +20,8 @@ with lib;
assertFileContent home-files/Mail/hm@example.com/.gmailieer.json ${ assertFileContent home-files/Mail/hm@example.com/.gmailieer.json ${
./lieer-expected.json ./lieer-expected.json
} }
assertFileContains activate \
'$DRY_RUN_CMD mkdir -m700 -p $VERBOSE_ARG "/home/hm-user/Mail/hm@example.com"/mail/{cur,new,tmp}'
''; '';
}; };
} }