|
|
|
@ -34123,58 +34123,6 @@ with pkgs; |
|
|
|
|
}; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
/* |
|
|
|
|
* Run a NixOS VM network test using this evaluation of Nixpkgs. |
|
|
|
|
* |
|
|
|
|
* It is mostly equivalent to `import ./make-test-python.nix` from the |
|
|
|
|
* NixOS manual[1], except that your `pkgs` will be used instead of |
|
|
|
|
* letting NixOS invoke Nixpkgs again. If a test machine needs to |
|
|
|
|
* set NixOS options under `nixpkgs`, it must set only the |
|
|
|
|
* `nixpkgs.pkgs` option. For the details, see the Nixpkgs |
|
|
|
|
* `pkgs.nixos` documentation. |
|
|
|
|
* |
|
|
|
|
* Parameter: |
|
|
|
|
* A NixOS VM test network, or path to it. Example: |
|
|
|
|
* |
|
|
|
|
* { lib, ... }: |
|
|
|
|
* { name = "my-test"; |
|
|
|
|
* nodes = { |
|
|
|
|
* machine-1 = someNixOSConfiguration; |
|
|
|
|
* machine-2 = ...; |
|
|
|
|
* } |
|
|
|
|
* } |
|
|
|
|
* |
|
|
|
|
* Result: |
|
|
|
|
* A derivation that runs the VM test. |
|
|
|
|
* |
|
|
|
|
* [1]: For writing NixOS tests, see |
|
|
|
|
* https://nixos.org/nixos/manual/index.html#sec-nixos-tests |
|
|
|
|
*/ |
|
|
|
|
nixosTest = |
|
|
|
|
let |
|
|
|
|
/* The nixos/lib/testing-python.nix module, preapplied with arguments that |
|
|
|
|
* make sense for this evaluation of Nixpkgs. |
|
|
|
|
*/ |
|
|
|
|
nixosTesting = |
|
|
|
|
(import ../../nixos/lib/testing-python.nix { |
|
|
|
|
inherit (stdenv.hostPlatform) system; |
|
|
|
|
inherit pkgs; |
|
|
|
|
extraConfigurations = [( |
|
|
|
|
{ lib, ... }: { |
|
|
|
|
config.nixpkgs.pkgs = lib.mkDefault pkgs; |
|
|
|
|
} |
|
|
|
|
)]; |
|
|
|
|
}); |
|
|
|
|
in |
|
|
|
|
test: |
|
|
|
|
let |
|
|
|
|
loadedTest = if builtins.typeOf test == "path" |
|
|
|
|
then import test |
|
|
|
|
else test; |
|
|
|
|
calledTest = lib.toFunction loadedTest pkgs; |
|
|
|
|
in |
|
|
|
|
nixosTesting.makeTest calledTest; |
|
|
|
|
|
|
|
|
|
nixosOptionsDoc = attrs: |
|
|
|
|
(import ../../nixos/lib/make-options-doc) |
|
|
|
|
({ inherit pkgs lib; } // attrs); |
|
|
|
|