tests.nixpkgs-check-by-name: Add test for alternate callPackage's

Tests that alternate callPackage's don't give an error, so pkgs/by-name
is only required for pkgs.callPackage itself
This commit is contained in:
Silvan Mosberger 2024-01-10 19:55:24 +01:00
parent d659d5f8ac
commit be26d74840
4 changed files with 20 additions and 1 deletions

View file

@ -30,7 +30,9 @@ let
# The base fixed-point function to populate the resulting attribute set
pkgsFun = self: {
inherit lib;
callPackage = lib.callPackageWith self;
newScope = extra: lib.callPackageWith (self // extra);
callPackage = self.newScope { };
callPackages = lib.callPackagesWith self;
someDrv = { type = "derivation"; };
};

View file

@ -0,0 +1,16 @@
self: super: {
alternateCallPackage = self.myScope.callPackage ({ myScopeValue, someDrv }:
assert myScopeValue;
someDrv
) { };
myScope = self.lib.makeScope self.newScope (self: {
myScopeValue = true;
});
myPackages = self.callPackages ({ someDrv }: {
a = someDrv;
b = someDrv;
}) { };
inherit (self.myPackages) a b;
}

View file

@ -0,0 +1 @@
import ../mock-nixpkgs.nix { root = ./.; }