From 1cd3aa6401d66c359c098219390d3503eba45a62 Mon Sep 17 00:00:00 2001 From: Zhaofeng Li Date: Fri, 3 Jun 2022 23:51:32 -0700 Subject: [PATCH] eval.nix: Accept path-likes in meta.nixpkgs as well This fixes usage with Niv. --- src/nix/hive/eval.nix | 2 +- src/nix/hive/tests/mod.rs | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/nix/hive/eval.nix b/src/nix/hive/eval.nix index ac15f8c..48e4bc0 100644 --- a/src/nix/hive/eval.nix +++ b/src/nix/hive/eval.nix @@ -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) diff --git a/src/nix/hive/tests/mod.rs b/src/nix/hive/tests/mod.rs index 67700e6..323eaf0 100644 --- a/src/nix/hive/tests/mod.rs +++ b/src/nix/hive/tests/mod.rs @@ -319,6 +319,22 @@ fn test_nixpkgs_system() { "#); } +#[test] +fn test_nixpkgs_path_like() { + TempHive::valid(r#" + { + meta = { + nixpkgs = { + outPath = ; + }; + }; + test = { pkgs, ... }: { + boot.isContainer = true; + }; + } + "#); +} + #[test] fn test_nixpkgs_overlay_meta_nixpkgs() { // Only set overlays in meta.nixpkgs