-
-
Notifications
You must be signed in to change notification settings - Fork 14.1k
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
gnome: switch to makeScopeWithSplicing #154751
Conversation
Use gnome-power-manager as an example, it won't cross build without this pr applied:
And it is obvious that glib from hostPlatform instead of buildPlatform was used, despite that it is in nativeBuildInputs. |
cc @Mindavi as I think you might also be interested. |
Thanks for doing this! Always make me very happy to see others fixing cross compilation issues. |
After the removal of aliases, cross evaluation is failing on throw. While they are outside the scope, they seem to be brought back in by the spliced package sets. |
Can we detect that the attrset is being spliced and hide the aliases in that case as well? |
This ugly patch seems to work: --- a/pkgs/desktops/gnome/default.nix
+++ b/pkgs/desktops/gnome/default.nix
@@ -1,12 +1,12 @@
-{ config, pkgs, lib, splicePackages, newScope
+{ config, pkgs, lib, splicePackages, newScope, isSpliced ? false
, pkgsBuildBuild, pkgsBuildHost, pkgsBuildTarget, pkgsHostHost, pkgsTargetTarget }:
lib.makeScopeWithSplicing splicePackages newScope {
- selfBuildBuild = pkgsBuildBuild.gnome;
- selfBuildHost = pkgsBuildHost.gnome;
- selfBuildTarget = pkgsBuildTarget.gnome;
- selfHostHost = pkgsHostHost.gnome;
- selfTargetTarget = pkgsTargetTarget.gnome or {};
+ selfBuildBuild = pkgsBuildBuild.gnome.override { isSpliced = true; };
+ selfBuildHost = pkgsBuildHost.gnome.override { isSpliced = true; };
+ selfBuildTarget = pkgsBuildTarget.gnome.override { isSpliced = true; };
+ selfHostHost = pkgsHostHost.gnome.override { isSpliced = true; };
+ selfTargetTarget = if pkgsTargetTarget ? gnome then pkgsTargetTarget.gnome.override { isSpliced = true; } else { };
} (self: { }) (spliced0: { })
(self: let inherit (self) callPackage; in {
updateScript = callPackage ./update.nix { };
@@ -288,7 +288,7 @@ lib.makeScopeWithSplicing splicePackages newScope {
gnome-autoar = callPackage ./misc/gnome-autoar { };
gnome-packagekit = callPackage ./misc/gnome-packagekit { };
-}) // lib.optionalAttrs (config.allowAliases or true) {
+}) // lib.optionalAttrs (config.allowAliases or true && !isSpliced) {
#### Legacy aliases. They need to be outside the scope or they will shadow the attributes from parent scope.
bijiben = throw "The ‘gnome.bijiben’ alias was removed on 2022-01-13. Please use ‘gnome.gnome-notes’ directly."; # added 2018-09-26 |
This seems to be a viable fix, really ugly though. Let's keep this pr as a draft until we really figure out the proper way to deal with the conflict between makeScope and splicing. |
Well, applying the aliases on top of the scope is really ugly too. And so is the splicing code. |
Hmm as jank as splicing is, I am surprised the throwing attributes would effect the other attributes. |
The issue is that the We are intentionally moving them outside the scope to avoid the shadowing while leaving them accessible as attributes under |
The gnome scope no longer exists. |
Motivation for this change
makeScope breaks splicing thus makes cross compilation hard in package sets like gnome, by switching to makeScopeWithSplicing, the situation can be dramatically improved.
Things done
sandbox = true
set innix.conf
? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)nixos/doc/manual/md-to-db.sh
to update generated release notes