From 8f77184d58a1fab748a64ebae749d6fe31646b6b Mon Sep 17 00:00:00 2001 From: Zhaofeng Li Date: Sat, 18 Dec 2021 14:35:06 -0800 Subject: [PATCH] eval.nix: Inherit pkgs.system in evalConfig --- src/nix/hive/eval.nix | 2 ++ src/nix/hive/tests/mod.rs | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/src/nix/hive/eval.nix b/src/nix/hive/eval.nix index 30a57e8..8e17b48 100644 --- a/src/nix/hive/eval.nix +++ b/src/nix/hive/eval.nix @@ -428,6 +428,8 @@ let system.activationScripts.colmena-chown-keys = lib.mkIf (length commands != 0) script; }; in evalConfig { + inherit (npkgs) system; + modules = [ assertionModule nixpkgsModule diff --git a/src/nix/hive/tests/mod.rs b/src/nix/hive/tests/mod.rs index e4c7d62..773c94b 100644 --- a/src/nix/hive/tests/mod.rs +++ b/src/nix/hive/tests/mod.rs @@ -267,6 +267,22 @@ fn test_eval_non_existent_pkg() { // Nixpkgs config tests +#[test] +fn test_nixpkgs_system() { + TempHive::valid(r#" + { + meta = { + nixpkgs = import { + system = "armv5tel-linux"; + }; + }; + test = { pkgs, ... }: { + boot.isContainer = assert pkgs.system == "armv5tel-linux"; true; + }; + } + "#); +} + #[test] fn test_nixpkgs_overlay_meta_nixpkgs() { // Only set overlays in meta.nixpkgs