eval.nix: Accept path-likes in meta.nixpkgs as well

This fixes usage with Niv.
This commit is contained in:
Zhaofeng Li 2022-06-03 23:51:32 -07:00
parent b87da69558
commit 1cd3aa6401
2 changed files with 17 additions and 1 deletions

View file

@ -80,7 +80,7 @@ let
}
'';
in
if typeOf pkgConf == "path" then
if typeOf pkgConf == "path" || (typeOf pkgConf == "set" && pkgConf ? outPath) then
if hermetic then throw (uninitializedError "a path to Nixpkgs")
# The referenced file might return an initialized Nixpkgs attribute set directly
else mkNixpkgs configName (import pkgConf)

View file

@ -319,6 +319,22 @@ fn test_nixpkgs_system() {
"#);
}
#[test]
fn test_nixpkgs_path_like() {
TempHive::valid(r#"
{
meta = {
nixpkgs = {
outPath = <nixpkgs>;
};
};
test = { pkgs, ... }: {
boot.isContainer = true;
};
}
"#);
}
#[test]
fn test_nixpkgs_overlay_meta_nixpkgs() {
// Only set overlays in meta.nixpkgs