From 16f0d689deae07f24967d0ab95c014d6d3a317a4 Mon Sep 17 00:00:00 2001 From: linsui Date: Sun, 23 Oct 2022 21:46:02 +0800 Subject: [PATCH] Add gnome theme for qt6 --- nixos/modules/config/qt5.nix | 10 +++++++++- pkgs/data/themes/adwaita-qt/default.nix | 19 +++++++++++++++---- .../libraries/qgnomeplatform/default.nix | 18 +++++++++++++++--- pkgs/top-level/all-packages.nix | 8 ++++++++ 4 files changed, 47 insertions(+), 8 deletions(-) diff --git a/nixos/modules/config/qt5.nix b/nixos/modules/config/qt5.nix index cb3180d7b96a..7225388f99d2 100644 --- a/nixos/modules/config/qt5.nix +++ b/nixos/modules/config/qt5.nix @@ -12,7 +12,13 @@ let isLxqt = cfg.platformTheme == "lxqt"; isKde = cfg.platformTheme == "kde"; - packages = if isQGnome then [ pkgs.qgnomeplatform pkgs.adwaita-qt ] + packages = + if isQGnome then [ + pkgs.qgnomeplatform + pkgs.adwaita-qt + pkgs.qgnomeplatform-qt6 + pkgs.adwaita-qt6 + ] else if isQtStyle then [ pkgs.libsForQt5.qtstyleplugins ] else if isQt5ct then [ pkgs.libsForQt5.qt5ct ] else if isLxqt then [ pkgs.lxqt.lxqt-qtplugin pkgs.lxqt.lxqt-config ] @@ -40,6 +46,7 @@ in example = "gnome"; relatedPackages = [ "qgnomeplatform" + "qgnomeplatform-qt6" ["libsForQt5" "qtstyleplugins"] ["libsForQt5" "qt5ct"] ["lxqt" "lxqt-qtplugin"] @@ -71,6 +78,7 @@ in example = "adwaita"; relatedPackages = [ "adwaita-qt" + "adwaita-qt6" ["libsForQt5" "qtstyleplugins"] ]; description = lib.mdDoc '' diff --git a/pkgs/data/themes/adwaita-qt/default.nix b/pkgs/data/themes/adwaita-qt/default.nix index 79690fa4e6af..2a5d768b1ae3 100644 --- a/pkgs/data/themes/adwaita-qt/default.nix +++ b/pkgs/data/themes/adwaita-qt/default.nix @@ -1,16 +1,17 @@ -{ mkDerivation -, stdenv +{ stdenv , lib , fetchFromGitHub , nix-update-script , cmake , ninja , qtbase +, qtwayland , qt5 , xorg +, useQt6 ? false }: -mkDerivation rec { +stdenv.mkDerivation rec { pname = "adwaita-qt"; version = "1.4.1"; @@ -30,9 +31,19 @@ mkDerivation rec { buildInputs = [ qtbase - qt5.qtx11extras ] ++ lib.optionals stdenv.isLinux [ xorg.libxcb + ] ++ lib.optionals (!useQt6) [ + qt5.qtx11extras + ] ++ lib.optionals useQt6 [ + qtwayland + ]; + + # Qt setup hook complains about missing `wrapQtAppsHook` otherwise. + dontWrapQtApps = true; + + cmakeFlags = lib.optionals useQt6 [ + "-DUSE_QT6=true" ]; postPatch = '' diff --git a/pkgs/development/libraries/qgnomeplatform/default.nix b/pkgs/development/libraries/qgnomeplatform/default.nix index 7f03baba0f4a..12a41104cfd3 100644 --- a/pkgs/development/libraries/qgnomeplatform/default.nix +++ b/pkgs/development/libraries/qgnomeplatform/default.nix @@ -1,19 +1,22 @@ -{ mkDerivation +{ stdenv , lib , fetchFromGitHub , nix-update-script , cmake , pkg-config , adwaita-qt +, adwaita-qt6 , glib , gtk3 , qtbase +, qtwayland , pantheon , substituteAll , gsettings-desktop-schemas +, useQt6 ? false }: -mkDerivation rec { +stdenv.mkDerivation rec { pname = "qgnomeplatform"; version = "0.8.4"; @@ -38,15 +41,24 @@ mkDerivation rec { ]; buildInputs = [ - adwaita-qt glib gtk3 qtbase + ] ++ lib.optionals (!useQt6) [ + adwaita-qt + ] ++ lib.optionals useQt6 [ + adwaita-qt6 + qtwayland ]; + # Qt setup hook complains about missing `wrapQtAppsHook` otherwise. + dontWrapQtApps = true; + cmakeFlags = [ "-DGLIB_SCHEMAS_DIR=${glib.getSchemaPath gsettings-desktop-schemas}" "-DQT_PLUGINS_DIR=${placeholder "out"}/${qtbase.qtPluginPrefix}" + ] ++ lib.optionals useQt6 [ + "-DUSE_QT6=true" ]; passthru = { diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 4402528916f6..3a9775e72eb7 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -22554,6 +22554,10 @@ with pkgs; qgnomeplatform = libsForQt5.callPackage ../development/libraries/qgnomeplatform { }; + qgnomeplatform-qt6 = qt6Packages.callPackage ../development/libraries/qgnomeplatform { + useQt6 = true; + }; + randomx = darwin.apple_sdk_11_0.callPackage ../development/libraries/randomx { }; remodel = callPackage ../development/tools/remodel { @@ -26425,6 +26429,10 @@ with pkgs; adwaita-qt = libsForQt5.callPackage ../data/themes/adwaita-qt { }; + adwaita-qt6 = qt6Packages.callPackage ../data/themes/adwaita-qt { + useQt6 = true; + }; + adw-gtk3 = callPackage ../data/themes/adw-gtk3 { }; agave = callPackage ../data/fonts/agave { };