Skip to content

Commit

Permalink
tests.nixpkgs-check-by-name: Add test for alternate callPackage's
Browse files Browse the repository at this point in the history
Tests that alternate callPackage's don't give an error, so pkgs/by-name
is only required for pkgs.callPackage itself
  • Loading branch information
infinisil committed Jan 10, 2024
1 parent d659d5f commit be26d74
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkgs/test/nixpkgs-check-by-name/tests/mock-nixpkgs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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"; };
};

Expand Down
Original file line number Diff line number Diff line change
@@ -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;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import ../mock-nixpkgs.nix { root = ./.; }
Empty file.

0 comments on commit be26d74

Please sign in to comment.