mailnag: implement a withPlugins interface

This commit is contained in:
Doron Behar 2020-08-15 11:23:06 +03:00 committed by Jon
parent ddb962bec4
commit 6c3d919edf
2 changed files with 80 additions and 72 deletions

View File

@ -15,20 +15,14 @@
, gobject-introspection
# Available plugins (can be overriden)
, availablePlugins
# Plugins to install
, plugins ? [ "goa" ]
# Used in the withPlugins interface at passthru, can be overrided directly, or
# prefarably via e.g: `mailnag.withPlugins(["goa"])`
, mailnag
, userPlugins ? [ ]
, pluginsDeps ? [ ]
}:
let
# Get the list of plugins the user wants
userPlugins = lib.attrVals plugins availablePlugins;
# goa plugin requires gio's gnome-online-accounts which requires making sure
# mailnag runs with GI_TYPELIB_PATH containing the path to Goa-1.0.typelib.
# This is handled best by adding the plugins' deps to buildInputs and let
# wrapGAppsHook handle that.
pluginsDeps = lib.flatten (lib.catAttrs "buildInputs" userPlugins);
in
python3Packages.buildPythonApplication rec {
python3Packages.buildPythonApplication rec {
pname = "mailnag";
version = "2.0.0";
@ -68,6 +62,17 @@ in
passthru = {
inherit availablePlugins;
withPlugins =
plugs:
let
# goa plugin requires gio's gnome-online-accounts which requires making sure
# mailnag runs with GI_TYPELIB_PATH containing the path to Goa-1.0.typelib.
# This is handled best by adding the plugins' deps to buildInputs and let
# wrapGAppsHook handle that.
pluginsDeps = lib.flatten (lib.catAttrs "buildInputs" plugs);
self = mailnag;
in
self.override { userPlugins = plugs; };
};
# See https://nixos.org/nixpkgs/manual/#ssec-gnome-common-issues-double-wrapped
@ -97,4 +102,4 @@ in
platforms = platforms.linux;
maintainers = with maintainers; [ doronbehar ];
};
}
}

View File

@ -5213,6 +5213,9 @@ in
goa = callPackage ../applications/networking/mailreaders/mailnag/goa-plugin.nix { };
};
};
mailnagWithPlugins = mailnag.withPlugins(
builtins.attrValues mailnag.availablePlugins
);
mailsend = callPackage ../tools/networking/mailsend { };