git.iko.soy/typeable/nixpkgs
on master help sign in
nixos/testing: only create `nixos-run-vms` for `nixos-build-vms(8)`

This is the case when the test-script is empty. `nixos-build-vms(8)` is primarily supposed to be used as tool to test changes or to reproduce bugs (IMHO) where "just spinning up a few VMs" is the primary use-case. In the ongoing discussion about these changes[1] it was suggested to only expose it when needed (i.e. in the case I described above) to keep the API surface as slim as possible. [1] https://github.com/NixOS/nixpkgs/pull/133675#discussion_r688112485

commit1ba3f7927f9a8a982994ff6bdf1adc3949812128 authorMaximilian Bosch <maximilian@mbosch.me> dateFri 13 Aug 2021, 17:35 (5 years ago) parente1ec5ac
1 file changed+7−5
nixos/lib/testing-python.nix+7−5
nixos/lib/testing-python.nix+7−5
@@ -187,11 +187,13 @@ rec {
187187 --set testScript "$out/test-script" \
188188 --set vlans '${toString vlans}'
189189
190− ln -s ${testDriver}/bin/nixos-test-driver $out/bin/nixos-run-vms
191− wrapProgram $out/bin/nixos-run-vms \
192− --set startScripts "''${vmStartScripts[*]}" \
193− --set testScript "${pkgs.writeText "start-all" "start_all(); join_all();"}" \
194− --set vlans '${toString vlans}'
190+ ${lib.optionalString (testScript == "") ''
191+ ln -s ${testDriver}/bin/nixos-test-driver $out/bin/nixos-run-vms
192+ wrapProgram $out/bin/nixos-run-vms \
193+ --set startScripts "''${vmStartScripts[*]}" \
194+ --set testScript "${pkgs.writeText "start-all" "start_all(); join_all();"}" \
195+ --set vlans '${toString vlans}'
196+ ''}
195197 '');
196198
197199 # Make a full-blown test