1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-24 22:11:15 +02:00

Fix pkgs.nixVersions and installTests

... by moving our stuff out of the way from upstream's
`nixComponents` and `nixDependencies` attrsets.

(I prefer not to use overlays, but let's make it work this way
first)
This commit is contained in:
Robert Hensing 2025-04-20 22:20:52 +02:00
parent f6df573a91
commit b257ea94e3
5 changed files with 59 additions and 59 deletions

View file

@ -143,14 +143,14 @@
# without "polluting" the top level "`pkgs`" attrset.
# This also has the benefit of providing us with a distinct set of packages
# we can iterate over.
nixComponents =
nixComponents2 =
lib.makeScopeWithSplicing'
{
inherit (final) splicePackages;
inherit (final.nixDependencies) newScope;
inherit (final.nixDependencies2) newScope;
}
{
otherSplices = final.generateSplicesForMkScope "nixComponents";
otherSplices = final.generateSplicesForMkScope "nixComponents2";
f = import ./packaging/components.nix {
inherit (final) lib;
inherit officialRelease;
@ -161,22 +161,22 @@
};
# The dependencies are in their own scope, so that they don't have to be
# in Nixpkgs top level `pkgs` or `nixComponents`.
nixDependencies =
# in Nixpkgs top level `pkgs` or `nixComponents2`.
nixDependencies2 =
lib.makeScopeWithSplicing'
{
inherit (final) splicePackages;
inherit (final) newScope; # layered directly on pkgs, unlike nixComponents above
inherit (final) newScope; # layered directly on pkgs, unlike nixComponents2 above
}
{
otherSplices = final.generateSplicesForMkScope "nixDependencies";
otherSplices = final.generateSplicesForMkScope "nixDependencies2";
f = import ./packaging/dependencies.nix {
inherit inputs stdenv;
pkgs = final;
};
};
nix = final.nixComponents.nix-cli;
nix = final.nixComponents2.nix-cli;
# See https://github.com/NixOS/nixpkgs/pull/214409
# Remove when fixed in this flake's nixpkgs
@ -277,7 +277,7 @@
# memory leaks with detect_leaks=0.
"" = rec {
nixpkgs = nixpkgsFor.${system}.native;
nixComponents = nixpkgs.nixComponents.overrideScope (
nixComponents = nixpkgs.nixComponents2.overrideScope (
nixCompFinal: nixCompPrev: {
mesonComponentOverrides = _finalAttrs: prevAttrs: {
mesonFlags =
@ -305,7 +305,7 @@
nixpkgsPrefix:
{
nixpkgs,
nixComponents ? nixpkgs.nixComponents,
nixComponents ? nixpkgs.nixComponents2,
}:
flatMapAttrs nixComponents (
pkgName: pkg:
@ -335,9 +335,9 @@
binaryTarball = self.hydraJobs.binaryTarball.${system};
# TODO probably should be `nix-cli`
nix = self.packages.${system}.nix-everything;
nix-manual = nixpkgsFor.${system}.native.nixComponents.nix-manual;
nix-internal-api-docs = nixpkgsFor.${system}.native.nixComponents.nix-internal-api-docs;
nix-external-api-docs = nixpkgsFor.${system}.native.nixComponents.nix-external-api-docs;
nix-manual = nixpkgsFor.${system}.native.nixComponents2.nix-manual;
nix-internal-api-docs = nixpkgsFor.${system}.native.nixComponents2.nix-internal-api-docs;
nix-external-api-docs = nixpkgsFor.${system}.native.nixComponents2.nix-external-api-docs;
}
# We need to flatten recursive attribute sets of derivations to pass `flake check`.
//
@ -391,9 +391,9 @@
}:
{
# These attributes go right into `packages.<system>`.
"${pkgName}" = nixpkgsFor.${system}.native.nixComponents.${pkgName};
"${pkgName}-static" = nixpkgsFor.${system}.native.pkgsStatic.nixComponents.${pkgName};
"${pkgName}-llvm" = nixpkgsFor.${system}.native.pkgsLLVM.nixComponents.${pkgName};
"${pkgName}" = nixpkgsFor.${system}.native.nixComponents2.${pkgName};
"${pkgName}-static" = nixpkgsFor.${system}.native.pkgsStatic.nixComponents2.${pkgName};
"${pkgName}-llvm" = nixpkgsFor.${system}.native.pkgsLLVM.nixComponents2.${pkgName};
}
// lib.optionalAttrs supportsCross (
flatMapAttrs (lib.genAttrs crossSystems (_: { })) (
@ -401,7 +401,7 @@
{ }:
{
# These attributes go right into `packages.<system>`.
"${pkgName}-${crossSystem}" = nixpkgsFor.${system}.cross.${crossSystem}.nixComponents.${pkgName};
"${pkgName}-${crossSystem}" = nixpkgsFor.${system}.cross.${crossSystem}.nixComponents2.${pkgName};
}
)
)
@ -411,7 +411,7 @@
{
# These attributes go right into `packages.<system>`.
"${pkgName}-${stdenvName}" =
nixpkgsFor.${system}.nativeForStdenv.${stdenvName}.nixComponents.${pkgName};
nixpkgsFor.${system}.nativeForStdenv.${stdenvName}.nixComponents2.${pkgName};
}
)
)