Commit 3362ec86 authored by Robert Hensing's avatar Robert Hensing
Browse files

nixosTests.nixos-rebuild-target-host: Use modular entrypoint

Modernize it. This allows the test to be extended, and pkgs to be
reused (later) to speed up evaluations a bit.
I believe this also makes it run on darwin hosts, but my linux-builder's
disk is too small to fit the massive closure of this test.

(cherry picked from commit 8c06d2cf667106dd440e7c140e70051dc1c321cb)
parent 499f5e10
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -700,7 +700,7 @@ in {
  nixos-generate-config = handleTest ./nixos-generate-config.nix {};
  nixos-rebuild-install-bootloader = handleTestOn ["x86_64-linux"] ./nixos-rebuild-install-bootloader.nix {};
  nixos-rebuild-specialisations = handleTestOn ["x86_64-linux"] ./nixos-rebuild-specialisations.nix {};
  nixos-rebuild-target-host = handleTest ./nixos-rebuild-target-host.nix {};
  nixos-rebuild-target-host = runTest ./nixos-rebuild-target-host.nix;
  nixpkgs = pkgs.callPackage ../modules/misc/nixpkgs/test.nix { inherit evalMinimalConfig; };
  nixseparatedebuginfod = handleTest ./nixseparatedebuginfod.nix {};
  node-red = handleTest ./node-red.nix {};
+10 −6
Original line number Diff line number Diff line
import ./make-test-python.nix ({ pkgs, ... }: {
{ hostPkgs, ... }: {
  name = "nixos-rebuild-target-host";

  # TODO: remove overlay from  nixos/modules/profiles/installation-device.nix
  #        make it a _small package instead, then remove pkgsReadOnly = false;.
  node.pkgsReadOnly = false;

  nodes = {
    deployer = { lib, ... }: let
    deployer = { lib, pkgs, ... }: let
      inherit (import ./ssh-keys.nix pkgs) snakeOilPrivateKey snakeOilPublicKey;
    in {
      imports = [ ../modules/profiles/installation-device.nix ];
@@ -71,13 +75,13 @@ import ./make-test-python.nix ({ pkgs, ... }: {
        StrictHostKeyChecking=no
      '';

      targetConfigJSON = pkgs.writeText "target-configuration.json"
      targetConfigJSON = hostPkgs.writeText "target-configuration.json"
        (builtins.toJSON nodes.target.system.build.targetConfig);

      targetNetworkJSON = pkgs.writeText "target-network.json"
      targetNetworkJSON = hostPkgs.writeText "target-network.json"
        (builtins.toJSON nodes.target.system.build.networkConfig);

      configFile = hostname: pkgs.writeText "configuration.nix" ''
      configFile = hostname: hostPkgs.writeText "configuration.nix" ''
        { lib, modulesPath, ... }: {
          imports = [
            (modulesPath + "/virtualisation/qemu-vm.nix")
@@ -140,4 +144,4 @@ import ./make-test-python.nix ({ pkgs, ... }: {
        deployer.succeed(f"mkdir -p {tmp_dir}")
        deployer.succeed(f"TMPDIR={tmp_dir} nixos-rebuild switch -I nixos-config=/root/configuration-1.nix --target-host root@target &>/dev/console")
    '';
})
}