2021-01-25 08:26:54 +00:00
|
|
|
{ lib, fetchurl, fetchzip, python3
|
2019-07-17 10:20:06 +01:00
|
|
|
, mkDerivationWith, wrapQtAppsHook, wrapGAppsHook, qtbase, glib-networking
|
2018-01-02 12:15:20 +00:00
|
|
|
, asciidoc, docbook_xml_dtd_45, docbook_xsl, libxml2
|
|
|
|
, libxslt, gst_all_1 ? null
|
2020-07-17 09:45:02 +01:00
|
|
|
, withPdfReader ? true
|
|
|
|
, withMediaPlayback ? true
|
2020-07-28 09:21:31 +01:00
|
|
|
, backend ? "webengine"
|
2017-04-04 17:21:27 +01:00
|
|
|
}:
|
2015-06-23 02:25:25 +01:00
|
|
|
|
2018-01-02 12:15:20 +00:00
|
|
|
assert withMediaPlayback -> gst_all_1 != null;
|
2017-10-13 18:15:19 +01:00
|
|
|
|
2016-08-23 17:18:22 +01:00
|
|
|
let
|
2020-09-16 20:00:04 +01:00
|
|
|
python3Packages = python3.pkgs;
|
2018-12-21 13:08:30 +00:00
|
|
|
pdfjs = let
|
2020-10-16 11:06:26 +01:00
|
|
|
version = "2.6.347";
|
2018-12-21 13:08:30 +00:00
|
|
|
in
|
|
|
|
fetchzip rec {
|
|
|
|
name = "pdfjs-${version}";
|
|
|
|
url = "https://github.com/mozilla/pdf.js/releases/download/v${version}/${name}-dist.zip";
|
2020-10-16 11:06:26 +01:00
|
|
|
sha256 = "0d016fyg81cq464li01xlkf9rxrb3rpsvmk5gh9m4d5yzmcakkfm";
|
2018-12-21 13:08:30 +00:00
|
|
|
stripRoot = false;
|
2016-08-23 17:18:22 +01:00
|
|
|
};
|
|
|
|
|
2020-07-17 09:45:02 +01:00
|
|
|
backendPackage =
|
|
|
|
if backend == "webengine" then python3Packages.pyqtwebengine else
|
|
|
|
if backend == "webkit" then python3Packages.pyqt5_with_qtwebkit else
|
|
|
|
throw ''
|
|
|
|
Unknown qutebrowser backend "${backend}".
|
|
|
|
Valid choices are qtwebengine (recommended) or qtwebkit.
|
|
|
|
'';
|
|
|
|
|
2019-07-17 10:20:06 +01:00
|
|
|
in mkDerivationWith python3Packages.buildPythonApplication rec {
|
2018-07-05 17:31:19 +01:00
|
|
|
pname = "qutebrowser";
|
2021-01-29 18:04:17 +00:00
|
|
|
version = "2.0.1";
|
2015-06-23 02:25:25 +01:00
|
|
|
|
2018-01-18 10:17:13 +00:00
|
|
|
# the release tarballs are different from the git checkout!
|
2016-01-10 11:04:16 +00:00
|
|
|
src = fetchurl {
|
2018-07-05 17:31:19 +01:00
|
|
|
url = "https://github.com/qutebrowser/qutebrowser/releases/download/v${version}/${pname}-${version}.tar.gz";
|
2021-01-29 18:04:17 +00:00
|
|
|
sha256 = "0hmj19bp5dihzpphxz77377yfmygj498am0h23kxg5m3y5hqv65a";
|
2015-06-28 00:22:48 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
# Needs tox
|
|
|
|
doCheck = false;
|
|
|
|
|
2016-08-15 09:36:12 +01:00
|
|
|
buildInputs = [
|
2017-10-13 18:15:19 +01:00
|
|
|
qtbase
|
2018-02-25 02:23:58 +00:00
|
|
|
glib-networking
|
2018-01-02 12:15:20 +00:00
|
|
|
] ++ lib.optionals withMediaPlayback (with gst_all_1; [
|
|
|
|
gst-plugins-base gst-plugins-good
|
|
|
|
gst-plugins-bad gst-plugins-ugly gst-libav
|
2018-12-26 17:35:58 +00:00
|
|
|
]);
|
2016-08-15 09:36:12 +01:00
|
|
|
|
|
|
|
nativeBuildInputs = [
|
2019-07-17 10:20:06 +01:00
|
|
|
wrapQtAppsHook wrapGAppsHook asciidoc
|
2018-01-02 12:15:20 +00:00
|
|
|
docbook_xml_dtd_45 docbook_xsl libxml2 libxslt
|
2016-08-15 09:36:12 +01:00
|
|
|
];
|
2016-01-10 10:07:15 +00:00
|
|
|
|
2021-01-29 18:04:17 +00:00
|
|
|
propagatedBuildInputs = with python3Packages; ([
|
2020-07-17 09:45:02 +01:00
|
|
|
pyyaml backendPackage jinja2 pygments
|
2018-09-12 01:41:03 +01:00
|
|
|
# scripts and userscripts libs
|
|
|
|
tldextract beautifulsoup4
|
|
|
|
pyreadability pykeepass stem
|
2021-01-29 18:04:17 +00:00
|
|
|
# extensive ad blocking
|
|
|
|
adblock
|
|
|
|
]
|
|
|
|
++ lib.optional (pythonOlder "3.9") importlib-resources
|
|
|
|
);
|
2015-06-28 00:22:48 +01:00
|
|
|
|
2020-07-17 09:45:02 +01:00
|
|
|
patches = [ ./fix-restart.patch ];
|
2019-02-24 12:40:41 +00:00
|
|
|
|
2019-07-17 10:20:06 +01:00
|
|
|
dontWrapGApps = true;
|
|
|
|
dontWrapQtApps = true;
|
|
|
|
|
2016-08-15 09:36:12 +01:00
|
|
|
postPatch = ''
|
2020-07-16 17:49:57 +01:00
|
|
|
substituteInPlace qutebrowser/misc/quitter.py --subst-var-by qutebrowser "$out/bin/qutebrowser"
|
2019-02-24 12:40:41 +00:00
|
|
|
|
2018-09-11 19:33:25 +01:00
|
|
|
sed -i "s,/usr/share/,$out/share/,g" qutebrowser/utils/standarddir.py
|
2018-01-02 12:15:20 +00:00
|
|
|
'' + lib.optionalString withPdfReader ''
|
2016-08-23 17:18:22 +01:00
|
|
|
sed -i "s,/usr/share/pdf.js,${pdfjs},g" qutebrowser/browser/pdfjs.py
|
2016-08-15 09:36:12 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
postBuild = ''
|
|
|
|
a2x -f manpage doc/qutebrowser.1.asciidoc
|
|
|
|
'';
|
|
|
|
|
2016-06-19 13:42:13 +01:00
|
|
|
postInstall = ''
|
2016-08-15 09:36:12 +01:00
|
|
|
install -Dm644 doc/qutebrowser.1 "$out/share/man/man1/qutebrowser.1"
|
2019-07-19 16:54:11 +01:00
|
|
|
install -Dm644 misc/org.qutebrowser.qutebrowser.desktop \
|
|
|
|
"$out/share/applications/org.qutebrowser.qutebrowser.desktop"
|
2018-09-05 18:06:18 +01:00
|
|
|
|
|
|
|
# Install icons
|
2016-08-15 09:36:12 +01:00
|
|
|
for i in 16 24 32 48 64 128 256 512; do
|
|
|
|
install -Dm644 "icons/qutebrowser-''${i}x''${i}.png" \
|
|
|
|
"$out/share/icons/hicolor/''${i}x''${i}/apps/qutebrowser.png"
|
|
|
|
done
|
|
|
|
install -Dm644 icons/qutebrowser.svg \
|
|
|
|
"$out/share/icons/hicolor/scalable/apps/qutebrowser.svg"
|
2018-09-05 18:06:18 +01:00
|
|
|
|
|
|
|
# Install scripts
|
2018-09-12 01:41:03 +01:00
|
|
|
sed -i "s,/usr/bin/,$out/bin/,g" scripts/open_url_in_instance.sh
|
|
|
|
install -Dm755 -t "$out/share/qutebrowser/scripts/" $(find scripts -type f)
|
2016-08-15 09:36:12 +01:00
|
|
|
install -Dm755 -t "$out/share/qutebrowser/userscripts/" misc/userscripts/*
|
2018-09-05 18:06:18 +01:00
|
|
|
|
2018-09-12 01:41:03 +01:00
|
|
|
# Patch python scripts
|
2018-09-05 18:06:18 +01:00
|
|
|
buildPythonPath "$out $propagatedBuildInputs"
|
2018-09-12 01:41:03 +01:00
|
|
|
scripts=$(grep -rl python "$out"/share/qutebrowser/{user,}scripts/)
|
|
|
|
for i in $scripts; do
|
|
|
|
patchPythonScript "$i"
|
2018-09-05 18:06:18 +01:00
|
|
|
done
|
2015-09-22 18:33:52 +01:00
|
|
|
'';
|
|
|
|
|
2019-07-17 10:20:06 +01:00
|
|
|
postFixup = ''
|
|
|
|
wrapProgram $out/bin/qutebrowser \
|
|
|
|
"''${gappsWrapperArgs[@]}" \
|
2020-07-17 09:45:02 +01:00
|
|
|
"''${qtWrapperArgs[@]}" \
|
|
|
|
--add-flags '--backend ${backend}'
|
2019-07-17 10:20:06 +01:00
|
|
|
'';
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "https://github.com/The-Compiler/qutebrowser";
|
2015-06-28 00:22:48 +01:00
|
|
|
description = "Keyboard-focused browser with a minimal GUI";
|
2018-09-12 01:41:03 +01:00
|
|
|
license = licenses.gpl3Plus;
|
2019-10-03 05:09:51 +01:00
|
|
|
maintainers = with maintainers; [ jagajaga rnhmjoj ebzzry ];
|
2015-06-23 02:25:25 +01:00
|
|
|
};
|
|
|
|
}
|