eval.nix: Inherit pkgs.system in evalConfig

This commit is contained in:
Zhaofeng Li 2021-12-18 14:35:06 -08:00
parent bd4493da73
commit 8f77184d58
2 changed files with 18 additions and 0 deletions

View file

@ -428,6 +428,8 @@ let
system.activationScripts.colmena-chown-keys = lib.mkIf (length commands != 0) script; system.activationScripts.colmena-chown-keys = lib.mkIf (length commands != 0) script;
}; };
in evalConfig { in evalConfig {
inherit (npkgs) system;
modules = [ modules = [
assertionModule assertionModule
nixpkgsModule nixpkgsModule

View file

@ -267,6 +267,22 @@ fn test_eval_non_existent_pkg() {
// Nixpkgs config tests // Nixpkgs config tests
#[test]
fn test_nixpkgs_system() {
TempHive::valid(r#"
{
meta = {
nixpkgs = import <nixpkgs> {
system = "armv5tel-linux";
};
};
test = { pkgs, ... }: {
boot.isContainer = assert pkgs.system == "armv5tel-linux"; true;
};
}
"#);
}
#[test] #[test]
fn test_nixpkgs_overlay_meta_nixpkgs() { fn test_nixpkgs_overlay_meta_nixpkgs() {
// Only set overlays in meta.nixpkgs // Only set overlays in meta.nixpkgs