diff --git a/modules/programs/lieer.nix b/modules/programs/lieer.nix index 80993f90..5d6597c0 100644 --- a/modules/programs/lieer.nix +++ b/modules/programs/lieer.nix @@ -31,6 +31,10 @@ let ({ account = account.address; } // account.lieer.settings); }; + activationScript = account: '' + $DRY_RUN_CMD mkdir -m700 -p $VERBOSE_ARG "${account.maildir.absPath}"/mail/{cur,new,tmp} + ''; + settingsOpts = { drop_non_existing_label = mkOption { type = types.bool; @@ -288,6 +292,13 @@ in { programs.notmuch.new.ignore = [ "/.*[.](json|lock|bak)$/" ]; 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); } ]); } diff --git a/tests/modules/programs/lieer/lieer.nix b/tests/modules/programs/lieer/lieer.nix index 5e784746..4aaa5377 100644 --- a/tests/modules/programs/lieer/lieer.nix +++ b/tests/modules/programs/lieer/lieer.nix @@ -20,6 +20,8 @@ with lib; assertFileContent home-files/Mail/hm@example.com/.gmailieer.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}' ''; }; }