mailnag: enable to configure plugins
Add an availablePlugins attrset with all plugins available. Make mailnag's expression accept a "plugins" argument specifying plugins to install, from `availablePlugins`. Prevent double wrapping (nor related to plugins). Install plugins using xorg.lndir.
This commit is contained in:
parent
b7ce309e6c
commit
7ff82bfee6
@ -1,8 +1,10 @@
|
|||||||
{ stdenv
|
{ lib
|
||||||
|
, callPackage
|
||||||
, fetchFromGitHub
|
, fetchFromGitHub
|
||||||
, gettext
|
, gettext
|
||||||
|
, xorg # for lndir
|
||||||
, gtk3
|
, gtk3
|
||||||
, pythonPackages
|
, python3Packages
|
||||||
, gdk-pixbuf
|
, gdk-pixbuf
|
||||||
, libnotify
|
, libnotify
|
||||||
, gst_all_1
|
, gst_all_1
|
||||||
@ -11,57 +13,90 @@
|
|||||||
, gsettings-desktop-schemas
|
, gsettings-desktop-schemas
|
||||||
, glib
|
, glib
|
||||||
, gobject-introspection
|
, gobject-introspection
|
||||||
|
# Plugins to install
|
||||||
|
, plugins ? [ "goa" ]
|
||||||
}:
|
}:
|
||||||
|
|
||||||
pythonPackages.buildPythonApplication rec {
|
let
|
||||||
pname = "mailnag";
|
availablePlugins = {
|
||||||
version = "2.0.0";
|
# More are listed here: https://github.com/pulb/mailnag/#desktop-integration
|
||||||
|
goa = callPackage ./goa-plugin.nix { };
|
||||||
src = fetchFromGitHub {
|
|
||||||
owner = "pulb";
|
|
||||||
repo = "mailnag";
|
|
||||||
rev = "v${version}";
|
|
||||||
sha256 = "0q97v9i96br22z3h6r2mz79i68ib8m8x42yxky78szfrf8j60i30";
|
|
||||||
};
|
};
|
||||||
preFixup = ''
|
# Get the list of plugins the user wants
|
||||||
substituteInPlace $out/${pythonPackages.python.sitePackages}/Mailnag/common/dist_cfg.py \
|
userPlugins = lib.attrVals plugins availablePlugins;
|
||||||
--replace "/usr/" $out/
|
# goa plugin requires gio's gnome-online-accounts which requires making sure
|
||||||
for desktop_file in $out/share/applications/*.desktop; do
|
# mailnag runs with GI_TYPELIB_PATH containing the path to Goa-1.0.typelib.
|
||||||
substituteInPlace "$desktop_file" \
|
# This is handled best by adding the plugins' deps to buildInputs and let
|
||||||
--replace "/usr/bin" $out/bin
|
# wrapGAppsHook handle that.
|
||||||
done
|
pluginsDeps = lib.flatten (lib.catAttrs "buildInputs" userPlugins);
|
||||||
'';
|
in
|
||||||
|
python3Packages.buildPythonApplication rec {
|
||||||
|
pname = "mailnag";
|
||||||
|
version = "2.0.0";
|
||||||
|
|
||||||
buildInputs = [
|
src = fetchFromGitHub {
|
||||||
gtk3
|
owner = "pulb";
|
||||||
gdk-pixbuf
|
repo = "mailnag";
|
||||||
glib
|
rev = "v${version}";
|
||||||
libnotify
|
sha256 = "0q97v9i96br22z3h6r2mz79i68ib8m8x42yxky78szfrf8j60i30";
|
||||||
gst_all_1.gstreamer
|
};
|
||||||
gst_all_1.gst-plugins-base
|
|
||||||
gst_all_1.gst-plugins-good
|
|
||||||
gst_all_1.gst-plugins-bad
|
|
||||||
gobject-introspection
|
|
||||||
libsecret
|
|
||||||
];
|
|
||||||
|
|
||||||
nativeBuildInputs = [
|
buildInputs = [
|
||||||
gettext
|
gtk3
|
||||||
wrapGAppsHook
|
gdk-pixbuf
|
||||||
];
|
glib
|
||||||
|
libnotify
|
||||||
|
gst_all_1.gstreamer
|
||||||
|
gst_all_1.gst-plugins-base
|
||||||
|
gst_all_1.gst-plugins-good
|
||||||
|
gst_all_1.gst-plugins-bad
|
||||||
|
gobject-introspection
|
||||||
|
libsecret
|
||||||
|
] ++ pluginsDeps;
|
||||||
|
|
||||||
propagatedBuildInputs = with pythonPackages; [
|
nativeBuildInputs = [
|
||||||
gsettings-desktop-schemas
|
gettext
|
||||||
pygobject3
|
wrapGAppsHook
|
||||||
dbus-python
|
# To later add plugins to
|
||||||
pyxdg
|
xorg.lndir
|
||||||
];
|
];
|
||||||
|
|
||||||
meta = with stdenv.lib; {
|
propagatedBuildInputs = with python3Packages; [
|
||||||
description = "An extensible mail notification daemon";
|
gsettings-desktop-schemas
|
||||||
homepage = "https://github.com/pulb/mailnag";
|
pygobject3
|
||||||
license = licenses.gpl2;
|
dbus-python
|
||||||
platforms = platforms.linux;
|
pyxdg
|
||||||
maintainers = with maintainers; [ doronbehar ];
|
];
|
||||||
};
|
|
||||||
}
|
passthru = {
|
||||||
|
inherit availablePlugins;
|
||||||
|
};
|
||||||
|
|
||||||
|
# See https://nixos.org/nixpkgs/manual/#ssec-gnome-common-issues-double-wrapped
|
||||||
|
dontWrapGApps = true;
|
||||||
|
|
||||||
|
preFixup = ''
|
||||||
|
substituteInPlace $out/${python3Packages.python.sitePackages}/Mailnag/common/dist_cfg.py \
|
||||||
|
--replace "/usr/" $out/
|
||||||
|
for desktop_file in $out/share/applications/*.desktop; do
|
||||||
|
substituteInPlace "$desktop_file" \
|
||||||
|
--replace "/usr/bin" $out/bin
|
||||||
|
done
|
||||||
|
makeWrapperArgs+=("''${gappsWrapperArgs[@]}")
|
||||||
|
'';
|
||||||
|
|
||||||
|
# Actually install plugins
|
||||||
|
postInstall = ''
|
||||||
|
for plug in ${builtins.toString userPlugins}; do
|
||||||
|
lndir $plug/${python3Packages.python.sitePackages} $out/${python3Packages.python.sitePackages}
|
||||||
|
done
|
||||||
|
'';
|
||||||
|
|
||||||
|
meta = with lib; {
|
||||||
|
description = "An extensible mail notification daemon";
|
||||||
|
homepage = "https://github.com/pulb/mailnag";
|
||||||
|
license = licenses.gpl2;
|
||||||
|
platforms = platforms.linux;
|
||||||
|
maintainers = with maintainers; [ doronbehar ];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
@ -0,0 +1,31 @@
|
|||||||
|
{ stdenv
|
||||||
|
, fetchFromGitHub
|
||||||
|
, python3Packages
|
||||||
|
, gobject-introspection
|
||||||
|
, gnome-online-accounts
|
||||||
|
}:
|
||||||
|
|
||||||
|
python3Packages.buildPythonPackage rec {
|
||||||
|
pname = "mailnag-goa-plugin";
|
||||||
|
version = "2.0.0";
|
||||||
|
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = "pulb";
|
||||||
|
repo = "mailnag-goa-plugin";
|
||||||
|
rev = "v${version}";
|
||||||
|
sha256 = "0bij6cy96nhq7xzslx0fnhmiac629h0x4wgy67k4i4npwqw10680";
|
||||||
|
};
|
||||||
|
|
||||||
|
buildInputs = [
|
||||||
|
gobject-introspection
|
||||||
|
gnome-online-accounts
|
||||||
|
];
|
||||||
|
|
||||||
|
meta = with stdenv.lib; {
|
||||||
|
description = "Mailnag GNOME Online Accounts plugin.";
|
||||||
|
homepage = "https://github.com/pulb/mailnag-goa-plugin";
|
||||||
|
license = licenses.gpl2;
|
||||||
|
platforms = platforms.linux;
|
||||||
|
maintainers = with maintainers; [ doronbehar ];
|
||||||
|
};
|
||||||
|
}
|
@ -5206,9 +5206,7 @@ in
|
|||||||
|
|
||||||
mailhog = callPackage ../servers/mail/mailhog {};
|
mailhog = callPackage ../servers/mail/mailhog {};
|
||||||
|
|
||||||
mailnag = callPackage ../applications/networking/mailreaders/mailnag {
|
mailnag = callPackage ../applications/networking/mailreaders/mailnag { };
|
||||||
pythonPackages = python3Packages;
|
|
||||||
};
|
|
||||||
|
|
||||||
mailsend = callPackage ../tools/networking/mailsend { };
|
mailsend = callPackage ../tools/networking/mailsend { };
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user