qutebrowser: init qt6 variant

This commit is contained in:
Timothy DeHerrera 2022-10-06 17:13:00 -06:00
parent ae830d5410
commit c6c52c521f
No known key found for this signature in database
GPG key ID: E44213186BC9AFE2
2 changed files with 40 additions and 14 deletions

View file

@ -1,5 +1,5 @@
{ stdenv, lib, fetchurl, fetchzip, python3
, mkDerivationWith, wrapQtAppsHook, wrapGAppsHook, qtbase, qtwebengine, glib-networking
{ stdenv, lib, fetchurl, fetchzip, fetchFromGitHub, python3
, wrapQtAppsHook, glib-networking
, asciidoc, docbook_xml_dtd_45, docbook_xsl, libxml2
, libxslt, gst_all_1 ? null
, withPdfReader ? true
@ -7,35 +7,56 @@
, backend ? "webengine"
, pipewireSupport ? stdenv.isLinux
, pipewire_0_2
}:
, qtwayland
, mkDerivationWith ? null
, qtbase ? null
, qtwebengine ? null
, wrapGAppsHook ? null
}: let
isQt6 = mkDerivationWith == null;
assert withMediaPlayback -> gst_all_1 != null;
let
python3Packages = python3.pkgs;
pdfjs = let
version = "2.14.305";
in
fetchzip rec {
fetchzip {
url = "https://github.com/mozilla/pdf.js/releases/download/v${version}/pdfjs-${version}-dist.zip";
hash = "sha256-E7t+0AUndrgi4zfJth0w28RmWLqLyXMUCnueNf/gNi4=";
stripRoot = false;
};
backendPackage =
if backend == "webengine" then python3Packages.pyqtwebengine else
if backend == "webengine" then if isQt6 then python3Packages.pyqt6-webengine else python3Packages.pyqtwebengine else
if backend == "webkit" then python3Packages.pyqt5_with_qtwebkit else
throw ''
Unknown qutebrowser backend "${backend}".
Valid choices are qtwebengine (recommended) or qtwebkit.
'';
in mkDerivationWith python3Packages.buildPythonApplication rec {
pname = "qutebrowser";
version = "2.5.2";
buildPythonApplication = if isQt6 then python3Packages.buildPythonApplication else mkDerivationWith python3Packages.buildPythonApplication;
pname = "qutebrowser";
version = if isQt6 then "unstable-2022-09-16" else "2.5.2";
in
assert withMediaPlayback -> gst_all_1 != null;
assert isQt6 -> backend != "webkit";
buildPythonApplication {
inherit pname version;
src = if isQt6 then
# comes from qt6-v2 branch of upstream
# https://github.com/qutebrowser/qutebrowser/issues/7202
fetchFromGitHub {
owner = "qutebrowser";
repo = "qutebrowser";
rev = "5e11e6c7d413cf5c77056ba871a545aae1cfd66a";
sha256 = "sha256-5HNzPO07lUQe/Q3Nb4JiS9kb9GMQ5/FqM5029vLNNWo=";
}
# the release tarballs are different from the git checkout!
src = fetchurl {
else fetchurl {
url = "https://github.com/qutebrowser/qutebrowser/releases/download/v${version}/${pname}-${version}.tar.gz";
hash = "sha256-qb/OFN3EA94N6y7t+YPCMc4APgdZmV7H706jTkl06Qg=";
};
@ -66,6 +87,7 @@ in mkDerivationWith python3Packages.buildPythonApplication rec {
adblock
]
++ lib.optional (pythonOlder "3.9") importlib-resources
++ lib.optional stdenv.isLinux qtwayland
);
patches = [
@ -94,14 +116,15 @@ in mkDerivationWith python3Packages.buildPythonApplication rec {
# Install icons
for i in 16 24 32 48 64 128 256 512; do
install -Dm644 "icons/qutebrowser-''${i}x''${i}.png" \
install -Dm644 "qutebrowser/icons/qutebrowser-''${i}x''${i}.png" \
"$out/share/icons/hicolor/''${i}x''${i}/apps/qutebrowser.png"
done
install -Dm644 icons/qutebrowser.svg \
install -Dm644 ${if isQt6 then "qutebrowser/" else ""}icons/qutebrowser.svg \
"$out/share/icons/hicolor/scalable/apps/qutebrowser.svg"
# Install scripts
sed -i "s,/usr/bin/,$out/bin/,g" scripts/open_url_in_instance.sh
${if isQt6 then "rm -rf scripts/{testbrowser,dev}" else ""}
install -Dm755 -t "$out/share/qutebrowser/scripts/" $(find scripts -type f)
install -Dm755 -t "$out/share/qutebrowser/userscripts/" misc/userscripts/*

View file

@ -31057,6 +31057,9 @@ with pkgs;
};
qutebrowser = libsForQt5.callPackage ../applications/networking/browsers/qutebrowser { };
qutebrowser-qt6 = callPackage ../applications/networking/browsers/qutebrowser {
inherit (qt6Packages) qtbase qtwebengine wrapQtAppsHook qtwayland;
};
qxw = callPackage ../applications/editors/qxw {};