mailnag: implement a withPlugins interface
This commit is contained in:
parent
ddb962bec4
commit
6c3d919edf
@ -15,86 +15,91 @@
|
|||||||
, gobject-introspection
|
, gobject-introspection
|
||||||
# Available plugins (can be overriden)
|
# Available plugins (can be overriden)
|
||||||
, availablePlugins
|
, availablePlugins
|
||||||
# Plugins to install
|
# Used in the withPlugins interface at passthru, can be overrided directly, or
|
||||||
, plugins ? [ "goa" ]
|
# prefarably via e.g: `mailnag.withPlugins(["goa"])`
|
||||||
|
, mailnag
|
||||||
|
, userPlugins ? [ ]
|
||||||
|
, pluginsDeps ? [ ]
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
python3Packages.buildPythonApplication rec {
|
||||||
# Get the list of plugins the user wants
|
pname = "mailnag";
|
||||||
userPlugins = lib.attrVals plugins availablePlugins;
|
version = "2.0.0";
|
||||||
# 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 {
|
|
||||||
pname = "mailnag";
|
|
||||||
version = "2.0.0";
|
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "pulb";
|
owner = "pulb";
|
||||||
repo = "mailnag";
|
repo = "mailnag";
|
||||||
rev = "v${version}";
|
rev = "v${version}";
|
||||||
sha256 = "0q97v9i96br22z3h6r2mz79i68ib8m8x42yxky78szfrf8j60i30";
|
sha256 = "0q97v9i96br22z3h6r2mz79i68ib8m8x42yxky78szfrf8j60i30";
|
||||||
};
|
};
|
||||||
|
|
||||||
buildInputs = [
|
buildInputs = [
|
||||||
gtk3
|
gtk3
|
||||||
gdk-pixbuf
|
gdk-pixbuf
|
||||||
glib
|
glib
|
||||||
libnotify
|
libnotify
|
||||||
gst_all_1.gstreamer
|
gst_all_1.gstreamer
|
||||||
gst_all_1.gst-plugins-base
|
gst_all_1.gst-plugins-base
|
||||||
gst_all_1.gst-plugins-good
|
gst_all_1.gst-plugins-good
|
||||||
gst_all_1.gst-plugins-bad
|
gst_all_1.gst-plugins-bad
|
||||||
gobject-introspection
|
gobject-introspection
|
||||||
libsecret
|
libsecret
|
||||||
] ++ pluginsDeps;
|
] ++ pluginsDeps;
|
||||||
|
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = [
|
||||||
gettext
|
gettext
|
||||||
wrapGAppsHook
|
wrapGAppsHook
|
||||||
# To later add plugins to
|
# To later add plugins to
|
||||||
xorg.lndir
|
xorg.lndir
|
||||||
];
|
];
|
||||||
|
|
||||||
propagatedBuildInputs = with python3Packages; [
|
propagatedBuildInputs = with python3Packages; [
|
||||||
gsettings-desktop-schemas
|
gsettings-desktop-schemas
|
||||||
pygobject3
|
pygobject3
|
||||||
dbus-python
|
dbus-python
|
||||||
pyxdg
|
pyxdg
|
||||||
];
|
];
|
||||||
|
|
||||||
passthru = {
|
passthru = {
|
||||||
inherit availablePlugins;
|
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
|
# See https://nixos.org/nixpkgs/manual/#ssec-gnome-common-issues-double-wrapped
|
||||||
dontWrapGApps = true;
|
dontWrapGApps = true;
|
||||||
|
|
||||||
preFixup = ''
|
preFixup = ''
|
||||||
substituteInPlace $out/${python3Packages.python.sitePackages}/Mailnag/common/dist_cfg.py \
|
substituteInPlace $out/${python3Packages.python.sitePackages}/Mailnag/common/dist_cfg.py \
|
||||||
--replace "/usr/" $out/
|
--replace "/usr/" $out/
|
||||||
for desktop_file in $out/share/applications/*.desktop; do
|
for desktop_file in $out/share/applications/*.desktop; do
|
||||||
substituteInPlace "$desktop_file" \
|
substituteInPlace "$desktop_file" \
|
||||||
--replace "/usr/bin" $out/bin
|
--replace "/usr/bin" $out/bin
|
||||||
done
|
done
|
||||||
makeWrapperArgs+=("''${gappsWrapperArgs[@]}")
|
makeWrapperArgs+=("''${gappsWrapperArgs[@]}")
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# Actually install plugins
|
# Actually install plugins
|
||||||
postInstall = ''
|
postInstall = ''
|
||||||
for plug in ${builtins.toString userPlugins}; do
|
for plug in ${builtins.toString userPlugins}; do
|
||||||
lndir $plug/${python3Packages.python.sitePackages} $out/${python3Packages.python.sitePackages}
|
lndir $plug/${python3Packages.python.sitePackages} $out/${python3Packages.python.sitePackages}
|
||||||
done
|
done
|
||||||
'';
|
'';
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
description = "An extensible mail notification daemon";
|
description = "An extensible mail notification daemon";
|
||||||
homepage = "https://github.com/pulb/mailnag";
|
homepage = "https://github.com/pulb/mailnag";
|
||||||
license = licenses.gpl2;
|
license = licenses.gpl2;
|
||||||
platforms = platforms.linux;
|
platforms = platforms.linux;
|
||||||
maintainers = with maintainers; [ doronbehar ];
|
maintainers = with maintainers; [ doronbehar ];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -5213,6 +5213,9 @@ in
|
|||||||
goa = callPackage ../applications/networking/mailreaders/mailnag/goa-plugin.nix { };
|
goa = callPackage ../applications/networking/mailreaders/mailnag/goa-plugin.nix { };
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
mailnagWithPlugins = mailnag.withPlugins(
|
||||||
|
builtins.attrValues mailnag.availablePlugins
|
||||||
|
);
|
||||||
|
|
||||||
mailsend = callPackage ../tools/networking/mailsend { };
|
mailsend = callPackage ../tools/networking/mailsend { };
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user