From cbbceb4894acb9750388e0cf535aa7a5663b207c Mon Sep 17 00:00:00 2001 From: Austin Lund Date: Tue, 13 Jun 2023 18:41:25 +1000 Subject: [PATCH] offlineimap: Add package option (#4021) --- modules/programs/offlineimap.nix | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/modules/programs/offlineimap.nix b/modules/programs/offlineimap.nix index c5b800599..0cddb4f9b 100644 --- a/modules/programs/offlineimap.nix +++ b/modules/programs/offlineimap.nix @@ -30,7 +30,7 @@ let genOfflineImapScript = account: with account; pkgs.writeShellScriptBin "offlineimap-${name}" '' - exec ${pkgs.offlineimap}/bin/offlineimap -a${account.name} "$@" + exec ${cfg.package}/bin/offlineimap -a${account.name} "$@" ''; accountStr = account: @@ -90,6 +90,16 @@ in { programs.offlineimap = { enable = mkEnableOption "OfflineIMAP"; + package = mkPackageOption pkgs "offlineimap" { + example = '' + pkgs.offlineimap.overridePythonAttrs ( old: { + propagatedBuildInputs = old.propagatedBuildInputs + ++ (with pkgs.python3Packages; [ + requests_oauthlib xdg gpgme]); + })''; + extraDescription = "Can be used to specify extensions."; + }; + pythonFile = mkOption { type = types.lines; default = '' @@ -153,12 +163,12 @@ in { }; config = mkIf cfg.enable { - home.packages = [ pkgs.offlineimap ]; + home.packages = [ cfg.package ]; xdg.configFile."offlineimap/get_settings.py".text = cfg.pythonFile; xdg.configFile."offlineimap/get_settings.pyc".source = "${ pkgs.runCommandLocal "get_settings-compile" { - nativeBuildInputs = [ pkgs.offlineimap ]; + nativeBuildInputs = [ cfg.package ]; pythonFile = cfg.pythonFile; passAsFile = [ "pythonFile" ]; } ''