From 8be95502b6f904d5699303b69e4b06cfd377e58c Mon Sep 17 00:00:00 2001 From: Tad Fisher Date: Tue, 9 Jan 2024 12:58:55 -0800 Subject: [PATCH] programs/lieer: add activation script --- modules/programs/lieer.nix | 11 +++++++++++ tests/modules/programs/lieer/lieer.nix | 2 ++ 2 files changed, 13 insertions(+) diff --git a/modules/programs/lieer.nix b/modules/programs/lieer.nix index 80993f90a..5d6597c01 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 5e7847464..4aaa53778 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}' ''; }; }