nixos-test-driver: Make overridable

This commit is contained in:
Jacek Galowicz
2026-03-26 10:22:42 +01:00
parent 1a180b6dbe
commit d95261b435
4 changed files with 19 additions and 6 deletions

View File

@@ -64,6 +64,7 @@ let
eval = nixos-lib.evalTest {
# Avoid evaluating a NixOS config prototype.
config.node.type = types.deferredModule;
config.hostPkgs = pkgs;
options._module.args = mkOption { internal = true; };
};
in

View File

@@ -211,6 +211,9 @@
"test-opt-nodeDefaults": [
"index.html#test-opt-nodeDefaults"
],
"test-opt-pythonTestDriverPackage": [
"index.html#test-opt-pythonTestDriverPackage"
],
"test-opt-rawTestDerivationArg": [
"index.html#test-opt-rawTestDerivationArg"
],

View File

@@ -9,15 +9,10 @@ let
# Reifies and correctly wraps the python test driver for
# the respective qemu version and with or without ocr support
testDriver = hostPkgs.python3Packages.callPackage ../test-driver {
testDriver = config.pythonTestDriverPackage.override {
inherit (config) enableOCR extraPythonPackages;
qemu_pkg = config.qemu.package;
imagemagick_light = hostPkgs.imagemagick_light.override { inherit (hostPkgs) libtiff; };
tesseract4 = hostPkgs.tesseract4.override { enableLanguages = [ "eng" ]; };
enableNspawn = config.containers != { };
# We want `pkgs.systemd`, *not* `python3Packages.system`.
systemd = hostPkgs.systemd;
};
vlans = map (
@@ -135,6 +130,12 @@ let
in
{
options = {
pythonTestDriverPackage = mkOption {
description = "Package containing the python NixOS test driver implemetnation";
type = types.package;
default = hostPkgs.nixos-test-driver;
readOnly = true;
};
driver = mkOption {
description = "Package containing a script that runs the test.";

View File

@@ -146,6 +146,14 @@ with pkgs;
inherit (nix-update) nix-update-script;
nixos-test-driver = pkgs.python3Packages.callPackage ../../nixos/lib/test-driver {
qemu_pkg = pkgs.qemu;
imagemagick_light = pkgs.imagemagick_light.override { inherit (pkgs) libtiff; };
tesseract4 = pkgs.tesseract4.override { enableLanguages = [ "eng" ]; };
# We want `pkgs.systemd`, *not* `python3Packages.system`.
systemd = pkgs.systemd;
};
### Push NixOS tests inside the fixed point
# See also allTestsForSystem in nixos/release.nix