nixpkgs/pkgs/applications/networking/browsers/qutebrowser/default.nix

107 lines
3.3 KiB
Nix
Raw Normal View History

{ stdenv, lib, fetchurl, fetchzip, python3Packages
, makeWrapper, wrapGAppsHook, qtbase, glib-networking
, asciidoc, docbook_xml_dtd_45, docbook_xsl, libxml2
, libxslt, gst_all_1 ? null
, withPdfReader ? true
, withMediaPlayback ? true
, withWebEngineDefault ? true
}:
2015-06-23 01:25:25 +00:00
assert withMediaPlayback -> gst_all_1 != null;
2016-08-23 16:18:22 +00:00
let
pdfjs = stdenv.mkDerivation rec {
name = "pdfjs-${version}";
version = "1.10.100";
2015-06-23 01:25:25 +00:00
src = fetchzip {
url = "https://github.com/mozilla/pdf.js/releases/download/${version}/${name}-dist.zip";
sha256 = "04df4cf6i6chnggfjn6m1z9vb89f01a0l9fj5rk21yr9iirq9rkq";
stripRoot = false;
2016-08-23 16:18:22 +00:00
};
buildCommand = ''
mkdir $out
cp -r $src $out
2016-08-23 16:18:22 +00:00
'';
};
in python3Packages.buildPythonApplication rec {
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!
src = fetchurl {
url = "https://github.com/qutebrowser/qutebrowser/releases/download/v${version}/${pname}-${version}.tar.gz";
2018-09-05 14:35:12 +00:00
sha256 = "1pnj47mllg1x34qakxs7s59x8mj262nfhdxgihsb2h2ywjq4fpgx";
};
# Needs tox
doCheck = false;
buildInputs = [
qtbase
glib-networking
] ++ 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;
nativeBuildInputs = [
makeWrapper wrapGAppsHook asciidoc
docbook_xml_dtd_45 docbook_xsl libxml2 libxslt
];
propagatedBuildInputs = with python3Packages; [
pyyaml pyqt5 jinja2 pygments
pypeg2 cssutils pyopengl attrs
];
postPatch = ''
sed -i "s,/usr/share/,$out/share/,g" qutebrowser/utils/standarddir.py
'' + lib.optionalString withPdfReader ''
2016-08-23 16:18:22 +00:00
sed -i "s,/usr/share/pdf.js,${pdfjs},g" qutebrowser/browser/pdfjs.py
'';
postBuild = ''
a2x -f manpage doc/qutebrowser.1.asciidoc
'';
postInstall = ''
install -Dm644 doc/qutebrowser.1 "$out/share/man/man1/qutebrowser.1"
install -Dm644 misc/qutebrowser.desktop \
"$out/share/applications/qutebrowser.desktop"
2018-09-05 17:06:18 +00:00
# Install icons
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
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
'';
postFixup = lib.optionalString (! withWebEngineDefault) ''
wrapProgram $out/bin/qutebrowser --add-flags "--backend webkit"
2016-08-22 17:07:24 +00:00
'';
meta = {
homepage = https://github.com/The-Compiler/qutebrowser;
description = "Keyboard-focused browser with a minimal GUI";
license = stdenv.lib.licenses.gpl3Plus;
maintainers = [ stdenv.lib.maintainers.jagajaga ];
2015-06-23 01:25:25 +00:00
};
}