Skip to content

Commit

Permalink
eval.nix: Accept path-likes in meta.nixpkgs as well
Browse files Browse the repository at this point in the history
This fixes usage with Niv.
  • Loading branch information
zhaofengli committed Jun 4, 2022
1 parent b87da69 commit 1cd3aa6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/nix/hive/eval.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
16 changes: 16 additions & 0 deletions src/nix/hive/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1cd3aa6

Please sign in to comment.