From 562f879cd173525076b79fc9b04de77004ad37c8 Mon Sep 17 00:00:00 2001 From: Arthur Gautier Date: Wed, 14 Jun 2023 23:12:44 -0700 Subject: [PATCH] runNixOSTest: adds support for lib.extend When lib overrides were used, before this commit, they would not be made available in the configuration evaluation of nixosTest's nodes. Sample code: ``` nix let pkgs = import ./. { overlays = [ (new: old: { lib = old.lib.extend (self: super: { sorry_dave = builtins.trace "There are no pod bay doors" "sorry dave"; }); }) ]; }; in pkgs.testers.runNixOSTest { name = "demo lib overlay"; nodes = { machine = { lib, ... }: { environment.etc."got-lib-overlay".text = lib.sorry_dave; }; }; testScript = { nodes }: '' start_all() machine.succeed('grep dave /etc/got-lib-overlay') ''; } ``` --- pkgs/build-support/testers/default.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkgs/build-support/testers/default.nix b/pkgs/build-support/testers/default.nix index 190ce72d0e63..d380dc6f30e1 100644 --- a/pkgs/build-support/testers/default.nix +++ b/pkgs/build-support/testers/default.nix @@ -97,7 +97,9 @@ # See doc/builders/testers.chapter.md or # https://nixos.org/manual/nixpkgs/unstable/#tester-runNixOSTest runNixOSTest = - let nixos = import ../../../nixos/lib {}; + let nixos = import ../../../nixos/lib { + inherit lib; + }; in testModule: nixos.runTest { _file = "pkgs.runNixOSTest implementation";