2018-01-02 12:15:20 +00:00
|
|
|
{ stdenv, lib, fetchurl, fetchzip, python3Packages
|
2018-02-25 02:23:58 +00:00
|
|
|
, makeWrapper, 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
|
|
|
|
, withPdfReader ? true
|
|
|
|
, withMediaPlayback ? true
|
2017-10-13 17:15:19 +00:00
|
|
|
, withWebEngineDefault ? true
|
2017-04-04 16:21:27 +00:00
|
|
|
}:
|
2015-06-23 01:25:25 +00:00
|
|
|
|
2018-01-02 12:15:20 +00:00
|
|
|
assert withMediaPlayback -> gst_all_1 != null;
|
2017-10-13 17:15:19 +00:00
|
|
|
|
2016-08-23 16:18:22 +00:00
|
|
|
let
|
|
|
|
pdfjs = stdenv.mkDerivation rec {
|
|
|
|
name = "pdfjs-${version}";
|
2018-07-05 16:31:19 +00:00
|
|
|
version = "1.10.100";
|
2015-06-23 01:25:25 +00:00
|
|
|
|
2018-01-02 12:15:20 +00:00
|
|
|
src = fetchzip {
|
2018-07-05 16:31:19 +00:00
|
|
|
url = "https://github.com/mozilla/pdf.js/releases/download/${version}/${name}-dist.zip";
|
|
|
|
sha256 = "04df4cf6i6chnggfjn6m1z9vb89f01a0l9fj5rk21yr9iirq9rkq";
|
2018-01-02 12:15:20 +00:00
|
|
|
stripRoot = false;
|
2016-08-23 16:18:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
buildCommand = ''
|
|
|
|
mkdir $out
|
2018-01-02 12:15:20 +00:00
|
|
|
cp -r $src $out
|
2016-08-23 16:18:22 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2018-01-02 12:15:20 +00:00
|
|
|
in python3Packages.buildPythonApplication rec {
|
2018-07-05 16:31:19 +00:00
|
|
|
pname = "qutebrowser";
|
2018-09-05 14:35:12 +00:00
|
|
|
version = "1.4.2";
|
2015-06-23 01:25:25 +00: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 16:31:19 +00:00
|
|
|
url = "https://github.com/qutebrowser/qutebrowser/releases/download/v${version}/${pname}-${version}.tar.gz";
|
2018-09-05 14:35:12 +00:00
|
|
|
sha256 = "1pnj47mllg1x34qakxs7s59x8mj262nfhdxgihsb2h2ywjq4fpgx";
|
2015-06-27 23:22:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
# Needs tox
|
|
|
|
doCheck = false;
|
|
|
|
|
2016-08-15 08:36:12 +00:00
|
|
|
buildInputs = [
|
2017-10-13 17:15:19 +00: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
|
|
|
|
]) ++ lib.optional (!withWebEngineDefault) python3Packages.qtwebkit-plugins;
|
2016-08-15 08:36:12 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = [
|
2018-01-02 12:15:20 +00:00
|
|
|
makeWrapper wrapGAppsHook asciidoc
|
|
|
|
docbook_xml_dtd_45 docbook_xsl libxml2 libxslt
|
2016-08-15 08:36:12 +00:00
|
|
|
];
|
2016-01-10 10:07:15 +00:00
|
|
|
|
2018-01-02 12:15:20 +00:00
|
|
|
propagatedBuildInputs = with python3Packages; [
|
|
|
|
pyyaml pyqt5 jinja2 pygments
|
|
|
|
pypeg2 cssutils pyopengl attrs
|
2015-06-27 23:22:48 +00:00
|
|
|
];
|
|
|
|
|
2016-08-15 08:36:12 +00:00
|
|
|
postPatch = ''
|
2018-09-11 18:33:25 +00: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 16:18:22 +00:00
|
|
|
sed -i "s,/usr/share/pdf.js,${pdfjs},g" qutebrowser/browser/pdfjs.py
|
2016-08-15 08:36:12 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
postBuild = ''
|
|
|
|
a2x -f manpage doc/qutebrowser.1.asciidoc
|
|
|
|
'';
|
|
|
|
|
2016-06-19 12:42:13 +00:00
|
|
|
postInstall = ''
|
2016-08-15 08:36:12 +00:00
|
|
|
install -Dm644 doc/qutebrowser.1 "$out/share/man/man1/qutebrowser.1"
|
2017-10-13 17:15:19 +00:00
|
|
|
install -Dm644 misc/qutebrowser.desktop \
|
2016-08-15 08:36:12 +00:00
|
|
|
"$out/share/applications/qutebrowser.desktop"
|
2018-09-05 17:06:18 +00:00
|
|
|
|
|
|
|
# Install icons
|
2016-08-15 08:36:12 +00: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 17:06:18 +00:00
|
|
|
|
|
|
|
# Install scripts
|
|
|
|
sed -i "s,/usr/bin/qutebrowser,$out/bin/qutebrowser,g" scripts/open_url_in_instance.sh
|
|
|
|
install -Dm755 -t "$out/share/qutebrowser/scripts/" scripts/open_url_in_instance.sh
|
2016-08-15 08:36:12 +00:00
|
|
|
install -Dm755 -t "$out/share/qutebrowser/userscripts/" misc/userscripts/*
|
2018-09-05 17:06:18 +00:00
|
|
|
|
|
|
|
# Install and patch python scripts
|
|
|
|
buildPythonPath "$out $propagatedBuildInputs"
|
|
|
|
for i in importer dictcli keytester utils; do
|
|
|
|
install -Dm755 -t "$out/share/qutebrowser/scripts/" scripts/$i.py
|
|
|
|
patchPythonScript "$out/share/qutebrowser/scripts/$i.py"
|
|
|
|
done
|
2015-09-22 17:33:52 +00:00
|
|
|
'';
|
|
|
|
|
2017-10-13 17:15:19 +00:00
|
|
|
postFixup = lib.optionalString (! withWebEngineDefault) ''
|
|
|
|
wrapProgram $out/bin/qutebrowser --add-flags "--backend webkit"
|
2016-08-22 17:07:24 +00:00
|
|
|
'';
|
|
|
|
|
2015-06-27 23:22:48 +00:00
|
|
|
meta = {
|
2017-08-01 20:03:30 +00:00
|
|
|
homepage = https://github.com/The-Compiler/qutebrowser;
|
2015-06-27 23:22:48 +00:00
|
|
|
description = "Keyboard-focused browser with a minimal GUI";
|
|
|
|
license = stdenv.lib.licenses.gpl3Plus;
|
2015-06-27 23:38:01 +00:00
|
|
|
maintainers = [ stdenv.lib.maintainers.jagajaga ];
|
2015-06-23 01:25:25 +00:00
|
|
|
};
|
|
|
|
}
|