Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

qt6: use makeScopeWithSplicing #265524

Merged
merged 4 commits into from
Nov 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 27 additions & 15 deletions pkgs/development/libraries/qt-6/default.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{ newScope
, lib
, stdenv
, generateSplicesForMkScope
, makeScopeWithSplicing'
, fetchurl
, fetchpatch
, fetchpatch2
Expand All @@ -12,6 +14,7 @@
, overrideSDK
, buildPackages
, python3
, config

# options
, developerBuild ? false
Expand All @@ -24,10 +27,11 @@ let
mirror = "mirror://qt";
};

addPackages = self: with self;
addPackages = self:
let
callPackage = self.newScope ({
inherit qtModule srcs python3;
inherit (self) qtModule;
inherit srcs python3;
stdenv = if stdenv.isDarwin then darwin.apple_sdk_11_0.stdenv else stdenv;
});
in
Expand Down Expand Up @@ -58,7 +62,9 @@ let
];
};
env = callPackage ./qt-env.nix { };
full = env "qt-full-${qtbase.version}" ([
full = callPackage ({ env, qtbase }: env "qt-full-${qtbase.version}"
# `with self` is ok to use here because having these spliced is unnecessary
( with self;[
qt3d
qt5compat
qtcharts
Expand Down Expand Up @@ -96,7 +102,7 @@ let
qtwebengine
qtwebsockets
qtwebview
] ++ lib.optionals (!stdenv.isDarwin) [ qtwayland libglvnd ]);
] ++ lib.optionals (!stdenv.isDarwin) [ qtwayland libglvnd ])) { };

qt3d = callPackage ./modules/qt3d.nix { };
qt5compat = callPackage ./modules/qt5compat.nix { };
Expand Down Expand Up @@ -149,11 +155,11 @@ let
GameController ImageCaptureCore LocalAuthentication
MediaAccessibility MediaPlayer MetalKit Network OpenDirectory Quartz
ReplayKit SecurityInterface Vision;
qtModule = qtModule.override {
qtModule = callPackage ({ qtModule }: qtModule.override {
stdenv = if stdenv.isDarwin
then overrideSDK stdenv { darwinMinVersion = "10.13"; darwinSdkVersion = "11.0"; }
else stdenv;
};
}) { };
xcbuild = buildPackages.xcbuild.override {
productBuildVer = "20A2408";
};
Expand All @@ -163,26 +169,32 @@ let
inherit (darwin.apple_sdk_11_0.frameworks) WebKit;
};

wrapQtAppsHook = makeSetupHook
wrapQtAppsHook = callPackage ({ makeBinaryWrapper }: makeSetupHook
{
name = "wrap-qt6-apps-hook";
propagatedBuildInputs = [ buildPackages.makeBinaryWrapper ];
} ./hooks/wrap-qt-apps-hook.sh;
propagatedBuildInputs = [ makeBinaryWrapper ];
} ./hooks/wrap-qt-apps-hook.sh) { };

qmake = makeSetupHook
qmake = callPackage ({ qtbase }: makeSetupHook
{
name = "qmake6-hook";
propagatedBuildInputs = [ self.qtbase.dev ];
propagatedBuildInputs = [ qtbase.dev ];
substitutions = {
inherit debug;
fix_qmake_libtool = ./hooks/fix-qmake-libtool.sh;
};
} ./hooks/qmake-hook.sh;
} ./hooks/qmake-hook.sh) { };
} // lib.optionalAttrs config.allowAliases {
# Convert to a throw on 03-01-2023 and backport the change.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure when is exactly 03-01-2023, but isn't it already passed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Meant 2024 :P

I have it in my calendar so no need to fix the typo

# Warnings show up in various cli tool outputs, throws do not.
# Remove completely before 24.05
overrideScope' = lib.warnIf (lib.isInOldestRelease 2311) "qt6 now uses makeScopeWithSplicing which does not have \"overrideScope'\", use \"overrideScope\"." self.overrideScope;
};

# TODO(@Artturin): convert to makeScopeWithSplicing'
# simple example of how to do that in 5568a4d25ca406809530420996d57e0876ca1a01
baseScope = lib.makeScope newScope addPackages;
baseScope = makeScopeWithSplicing' {
otherSplices = generateSplicesForMkScope "qt6";
f = addPackages;
};

bootstrapScope = baseScope.overrideScope(final: prev: {
qtbase = prev.qtbase.override { qttranslations = null; };
Expand Down
2 changes: 1 addition & 1 deletion pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -24662,7 +24662,7 @@ with pkgs;
qt6 = recurseIntoAttrs (callPackage ../development/libraries/qt-6 { });

qt6Packages = recurseIntoAttrs (import ./qt6-packages.nix {
inherit lib pkgs qt6;
inherit lib __splicedPackages makeScopeWithSplicing' generateSplicesForMkScope pkgsBuildHost;
stdenv = if stdenv.isDarwin then darwin.apple_sdk_11_0.stdenv else stdenv;
});

Expand Down
5 changes: 3 additions & 2 deletions pkgs/top-level/qt5-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,9 @@ in (noExtraAttrs (kdeFrameworks // plasmaMobileGear // plasma5 // plasma5.thirdP

yuview = callPackage ../applications/video/yuview { };
}) // lib.optionalAttrs pkgs.config.allowAliases {
# remove after 23.11 branch-off and backport removal to 23.11
# 23.11 will have a warning for this in `makeScope` itself
# Convert to a throw on 01-01-2023.
# Warnings show up in various cli tool outputs, throws do not.
# Remove completely before 24.05
overrideScope' = lib.warn "libsForQt5 now uses makeScopeWithSplicing which does not have \"overrideScope'\", use \"overrideScope\"." self.overrideScope;
}));
}
31 changes: 24 additions & 7 deletions pkgs/top-level/qt6-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,27 @@
# this file.

{ lib
, pkgs
, qt6
, __splicedPackages
, makeScopeWithSplicing'
, generateSplicesForMkScope
, stdenv
, pkgsBuildHost
}:

(lib.makeScope pkgs.newScope ( self:

let
callPackage = self.callPackage;
pkgs = __splicedPackages;
# qt6 set should not be pre-spliced to prevent spliced packages being a part of an unspliced set
# 'pkgsCross.aarch64-multiplatform.pkgsBuildTarget.targetPackages.qt6Packages.qtbase' should not have a `__spliced` but if qt6 is pre-spliced then it will have one.
# pkgsBuildHost == pkgs
qt6 = pkgsBuildHost.qt6;
in
(qt6 // {

makeScopeWithSplicing' {
otherSplices = generateSplicesForMkScope "qt6Packages";
f = (self: let
inherit (self) callPackage;
noExtraAttrs = set: lib.attrsets.removeAttrs set [ "extend" "override" "overrideScope" "overrideScope'" "overrideDerivation" ];
in (noExtraAttrs qt6) // {
inherit stdenv;

# LIBRARIES
Expand Down Expand Up @@ -45,4 +55,11 @@ in
qt6Support = true;
suffix = "qt6";
};
})))

} // lib.optionalAttrs pkgs.config.allowAliases {
# Convert to a throw on 01-01-2023.
# Warnings show up in various cli tool outputs, throws do not.
# Remove completely before 24.05
overrideScope' = lib.warn "qt6Packages now uses makeScopeWithSplicing which does not have \"overrideScope'\", use \"overrideScope\"." self.overrideScope;
});
}