diff options
Diffstat (limited to 'pkgs/test/nixpkgs-check-by-name/src/eval.nix')
-rw-r--r-- | pkgs/test/nixpkgs-check-by-name/src/eval.nix | 47 |
1 files changed, 35 insertions, 12 deletions
diff --git a/pkgs/test/nixpkgs-check-by-name/src/eval.nix b/pkgs/test/nixpkgs-check-by-name/src/eval.nix index 7c0ae755215..bf9f19d8e46 100644 --- a/pkgs/test/nixpkgs-check-by-name/src/eval.nix +++ b/pkgs/test/nixpkgs-check-by-name/src/eval.nix @@ -18,19 +18,42 @@ let callPackage = fn: args: let result = super.callPackage fn args; + variantInfo._attributeVariant = { + # These names are used by the deserializer on the Rust side + CallPackage.path = + if builtins.isPath fn then + toString fn + else + null; + CallPackage.empty_arg = + args == { }; + }; in if builtins.isAttrs result then # If this was the last overlay to be applied, we could just only return the `_callPackagePath`, # but that's not the case because stdenv has another overlays on top of user-provided ones. # So to not break the stdenv build we need to return the mostly proper result here - result // { - _callPackagePath = fn; - } + result // variantInfo else # It's very rare that callPackage doesn't return an attribute set, but it can occur. - { - _callPackagePath = fn; + variantInfo; + + _internalCallByNamePackageFile = file: + let + result = super._internalCallByNamePackageFile file; + variantInfo._attributeVariant = { + # This name is used by the deserializer on the Rust side + AutoCalled = null; }; + in + if builtins.isAttrs result then + # If this was the last overlay to be applied, we could just only return the `_callPackagePath`, + # but that's not the case because stdenv has another overlays on top of user-provided ones. + # So to not break the stdenv build we need to return the mostly proper result here + result // variantInfo + else + # It's very rare that callPackage doesn't return an attribute set, but it can occur. + variantInfo; }; pkgs = import nixpkgsPath { @@ -39,14 +62,14 @@ let overlays = [ callPackageOverlay ]; }; - attrInfo = attr: { + attrInfo = attr: + let + value = pkgs.${attr}; + in + { # These names are used by the deserializer on the Rust side - call_package_path = - if pkgs.${attr} ? _callPackagePath && builtins.isPath pkgs.${attr}._callPackagePath then - toString pkgs.${attr}._callPackagePath - else - null; - is_derivation = pkgs.lib.isDerivation pkgs.${attr}; + variant = value._attributeVariant or { Other = null; }; + is_derivation = pkgs.lib.isDerivation value; }; attrInfos = builtins.listToAttrs (map (name: { |