offlineimap: Add package option (#4021)

This commit is contained in:
Austin Lund 2023-06-13 18:41:25 +10:00 committed by GitHub
parent d437f0d4e0
commit cbbceb4894
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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" ];
} ''