diff options
Diffstat (limited to 'nixpkgs/pkgs/applications/networking/mailreaders/mailnag/default.nix')
-rw-r--r-- | nixpkgs/pkgs/applications/networking/mailreaders/mailnag/default.nix | 104 |
1 files changed, 80 insertions, 24 deletions
diff --git a/nixpkgs/pkgs/applications/networking/mailreaders/mailnag/default.nix b/nixpkgs/pkgs/applications/networking/mailreaders/mailnag/default.nix index 8341cc63092..6d315049d24 100644 --- a/nixpkgs/pkgs/applications/networking/mailreaders/mailnag/default.nix +++ b/nixpkgs/pkgs/applications/networking/mailreaders/mailnag/default.nix @@ -1,49 +1,105 @@ -{ stdenv, fetchurl, gettext, gtk3, pythonPackages -, gdk-pixbuf, libnotify, gst_all_1 -, libgnome-keyring3 -, wrapGAppsHook, gnome3 -# otherwise passwords are stored unencrypted -, withGnomeKeyring ? true +{ lib +, callPackage +, fetchFromGitHub +, gettext +, xorg # for lndir +, gtk3 +, python3Packages +, gdk-pixbuf +, libnotify +, gst_all_1 +, libsecret +, wrapGAppsHook +, gsettings-desktop-schemas +, glib +, gobject-introspection +# Available plugins (can be overriden) +, availablePlugins +# Used in the withPlugins interface at passthru, can be overrided directly, or +# prefarably via e.g: `mailnag.withPlugins(["goa"])` +, mailnag +, userPlugins ? [ ] +, pluginsDeps ? [ ] }: -let - inherit (pythonPackages) python; -in pythonPackages.buildPythonApplication rec { +python3Packages.buildPythonApplication rec { pname = "mailnag"; - version = "1.3.0"; + version = "2.0.0"; - src = fetchurl { - url = "https://github.com/pulb/mailnag/archive/v${version}.tar.gz"; - sha256 = "0cp5pad6jzd5c14pddbi9ap5bi78wjhk1x2p0gbblmvmcasw309s"; + src = fetchFromGitHub { + owner = "pulb"; + repo = "mailnag"; + rev = "v${version}"; + sha256 = "0q97v9i96br22z3h6r2mz79i68ib8m8x42yxky78szfrf8j60i30"; }; buildInputs = [ - gtk3 gdk-pixbuf libnotify gst_all_1.gstreamer - gst_all_1.gst-plugins-base gst_all_1.gst-plugins-good + gtk3 + 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 - gnome3.adwaita-icon-theme - ] ++ stdenv.lib.optional withGnomeKeyring libgnome-keyring3; + gobject-introspection + libsecret + ] ++ pluginsDeps; nativeBuildInputs = [ gettext wrapGAppsHook + # To later add plugins to + xorg.lndir ]; - propagatedBuildInputs = with pythonPackages; [ - pygobject3 dbus-python pyxdg + propagatedBuildInputs = with python3Packages; [ + gsettings-desktop-schemas + pygobject3 + dbus-python + pyxdg ]; - buildPhase = ""; + 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 + dontWrapGApps = true; - installPhase = "${python}/bin/python setup.py install --prefix=$out"; + 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[@]}") + ''; - doCheck = false; + # Actually install plugins + postInstall = '' + for plug in ${builtins.toString userPlugins}; do + lndir $plug/${python3Packages.python.sitePackages} $out/${python3Packages.python.sitePackages} + done + ''; - meta = with stdenv.lib; { + meta = with lib; { description = "An extensible mail notification daemon"; homepage = "https://github.com/pulb/mailnag"; license = licenses.gpl2; platforms = platforms.linux; - maintainers = with maintainers; [ ]; + maintainers = with maintainers; [ doronbehar ]; }; } |