3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/applications/networking/browsers/qutebrowser/default.nix

114 lines
3.4 KiB
Nix
Raw Normal View History

{ stdenv, lib, fetchurl, fetchzip, python3Packages
, mkDerivationWith, wrapQtAppsHook, wrapGAppsHook, qtbase, glib-networking
, asciidoc, docbook_xml_dtd_45, docbook_xsl, libxml2
, libxslt, gst_all_1 ? null
, withPdfReader ? true
, withMediaPlayback ? true
}:
2015-06-23 02:25:25 +01:00
assert withMediaPlayback -> gst_all_1 != null;
2016-08-23 17:18:22 +01:00
let
pdfjs = let
2019-11-26 13:04:38 +00:00
version = "2.3.200";
in
fetchzip rec {
name = "pdfjs-${version}";
url = "https://github.com/mozilla/pdf.js/releases/download/v${version}/${name}-dist.zip";
2019-11-26 13:04:38 +00:00
sha256 = "1fpxsw0hzahccyng08acvc7g0gk29j2x701p6w6fg1718mvcrm1q";
stripRoot = false;
2016-08-23 17:18:22 +01:00
};
in mkDerivationWith python3Packages.buildPythonApplication rec {
pname = "qutebrowser";
2020-06-26 10:48:14 +01:00
version = "1.13.0";
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!
src = fetchurl {
url = "https://github.com/qutebrowser/qutebrowser/releases/download/v${version}/${pname}-${version}.tar.gz";
2020-06-26 10:48:14 +01:00
sha256 = "1xq0a0mcssc1ss4fvhhwr75dhlh3nr9w46i2gmqczzh5cynk1sfk";
};
# 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
]);
nativeBuildInputs = [
wrapQtAppsHook wrapGAppsHook asciidoc
docbook_xml_dtd_45 docbook_xsl libxml2 libxslt
];
propagatedBuildInputs = with python3Packages; [
pyyaml pyqt5 pyqtwebengine jinja2 pygments
pypeg2 cssutils pyopengl attrs setuptools
2018-09-12 01:41:03 +01:00
# scripts and userscripts libs
tldextract beautifulsoup4
pyreadability pykeepass stem
];
patches = [
./fix-restart.patch
];
dontWrapGApps = true;
dontWrapQtApps = true;
postPatch = ''
substituteInPlace qutebrowser/app.py --subst-var-by qutebrowser "$out/bin/qutebrowser"
sed -i "s,/usr/share/,$out/share/,g" qutebrowser/utils/standarddir.py
'' + lib.optionalString withPdfReader ''
2016-08-23 17:18:22 +01: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/org.qutebrowser.qutebrowser.desktop \
"$out/share/applications/org.qutebrowser.qutebrowser.desktop"
2018-09-05 18:06:18 +01: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 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)
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
'';
postFixup = ''
wrapProgram $out/bin/qutebrowser \
"''${gappsWrapperArgs[@]}" \
"''${qtWrapperArgs[@]}"
'';
2018-09-12 01:41:03 +01:00
meta = with stdenv.lib; {
homepage = "https://github.com/The-Compiler/qutebrowser";
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
};
}