tests: refactor to carry the package set as an argument

This way, the package set will be possible to pass without re-importing
all the time

+1 -3
nixos/lib/build-vms.nix
···
-
{ system, minimal ? false, config ? {} }:
-
-
let pkgs = import ../.. { inherit system config; }; in
+
{ system, pkgs, minimal ? false, config ? {} }:
with pkgs.lib;
with import ../lib/qemu-flags.nix { inherit pkgs; };
+2 -2
nixos/lib/testing.nix
···
-
{ system, minimal ? false, config ? {} }:
+
{ system, pkgs, minimal ? false, config ? {} }:
-
with import ./build-vms.nix { inherit system minimal config; };
+
with import ./build-vms.nix { inherit system pkgs minimal config; };
with pkgs;
let
+5 -1
nixos/modules/installer/tools/nixos-build-vms/build-vms.nix
···
{ system ? builtins.currentSystem
+
, config ? {}
, networkExpr
}:
let nodes = import networkExpr; in
-
with import ../../../../lib/testing.nix { inherit system; };
+
with import ../../../../lib/testing.nix {
+
inherit system;
+
pkgs = import ../.. { inherit system config; }
+
};
(makeTest { inherit nodes; testScript = ""; }).driver
+5 -2
nixos/tests/boot.nix
···
-
{ system ? builtins.currentSystem }:
+
{ system ? builtins.currentSystem,
+
config ? {},
+
pkgs ? import ../.. { inherit system config; }
+
}:
-
with import ../lib/testing.nix { inherit system; };
+
with import ../lib/testing.nix { inherit system pkgs; };
with pkgs.lib;
let
+5 -2
nixos/tests/buildbot.nix
···
-
{ system ? builtins.currentSystem }:
+
{ system ? builtins.currentSystem,
+
config ? {},
+
pkgs ? import ../.. { inherit system config; }
+
}:
-
with import ../lib/testing.nix { inherit system; };
+
with import ../lib/testing.nix { inherit system pkgs; };
let
# Test ensures buildbot master comes up correctly and workers can connect
+5 -2
nixos/tests/certmgr.nix
···
-
{ system ? builtins.currentSystem }:
+
{ system ? builtins.currentSystem,
+
config ? {},
+
pkgs ? import ../.. { inherit system config; }
+
}:
-
with import ../lib/testing.nix { inherit system; };
+
with import ../lib/testing.nix { inherit system pkgs; };
let
mkSpec = { host, service ? null, action }: {
inherit action;
+3 -2
nixos/tests/chromium.nix
···
{ system ? builtins.currentSystem
-
, pkgs ? import ../.. { inherit system; }
+
, config ? {}
+
, pkgs ? import ../.. { inherit system config; }
, channelMap ? {
stable = pkgs.chromium;
beta = pkgs.chromiumBeta;
···
}
}:
-
with import ../lib/testing.nix { inherit system; };
+
with import ../lib/testing.nix { inherit system pkgs; };
with pkgs.lib;
mapAttrs (channel: chromiumPkg: makeTest rec {
+5 -2
nixos/tests/cloud-init.nix
···
-
{ system ? builtins.currentSystem }:
+
{ system ? builtins.currentSystem,
+
config ? {},
+
pkgs ? import ../.. { inherit system config; }
+
}:
-
with import ../lib/testing.nix { inherit system; };
+
with import ../lib/testing.nix { inherit system pkgs; };
with pkgs.lib;
let
+5 -2
nixos/tests/ec2.nix
···
-
{ system ? builtins.currentSystem }:
+
{ system ? builtins.currentSystem,
+
config ? {},
+
pkgs ? import ../.. { inherit system config; }
+
}:
-
with import ../lib/testing.nix { inherit system; };
+
with import ../lib/testing.nix { inherit system pkgs; };
with pkgs.lib;
let
+8 -2
nixos/tests/elk.nix
···
-
{ system ? builtins.currentSystem, enableUnfree ? false }:
-
with import ../lib/testing.nix { inherit system; };
+
{ system ? builtins.currentSystem,
+
config ? {},
+
pkgs ? import ../.. { inherit system config; },
+
enableUnfree ? false
+
}:
+
+
with import ../lib/testing.nix { inherit system pkgs; };
with pkgs.lib;
+
let
esUrl = "http://localhost:9200";
+5 -2
nixos/tests/gitea.nix
···
-
{ system ? builtins.currentSystem }:
+
{ system ? builtins.currentSystem,
+
config ? {},
+
pkgs ? import ../.. { inherit system config; }
+
}:
-
with import ../lib/testing.nix { inherit system; };
+
with import ../lib/testing.nix { inherit system pkgs; };
with pkgs.lib;
{
+5 -2
nixos/tests/installer.nix
···
-
{ system ? builtins.currentSystem }:
+
{ system ? builtins.currentSystem,
+
config ? {},
+
pkgs ? import ../.. { inherit system config; }
+
}:
-
with import ../lib/testing.nix { inherit system; };
+
with import ../lib/testing.nix { inherit system pkgs; };
with pkgs.lib;
let
+6 -2
nixos/tests/kafka.nix
···
-
{ system ? builtins.currentSystem }:
-
with import ../lib/testing.nix { inherit system; };
+
{ system ? builtins.currentSystem,
+
config ? {},
+
pkgs ? import ../.. { inherit system config; }
+
}:
+
+
with import ../lib/testing.nix { inherit system pkgs; };
with pkgs.lib;
let
+5 -2
nixos/tests/keymap.nix
···
-
{ system ? builtins.currentSystem }:
+
{ system ? builtins.currentSystem,
+
config ? {},
+
pkgs ? import ../.. { inherit system config; }
+
}:
-
with import ../lib/testing.nix { inherit system; };
+
with import ../lib/testing.nix { inherit system pkgs; };
let
readyFile = "/tmp/readerReady";
+5 -2
nixos/tests/kubernetes/base.nix
···
-
{ system ? builtins.currentSystem }:
+
{ system ? builtins.currentSystem,
+
config ? {},
+
pkgs ? import ../.. { inherit system config; }
+
}:
-
with import ../../lib/testing.nix { inherit system; };
+
with import ../../lib/testing.nix { inherit system pkgs; };
with pkgs.lib;
let
+6 -2
nixos/tests/make-test.nix
···
-
f: { system ? builtins.currentSystem, ... } @ args:
+
f: {
+
system ? builtins.currentSystem,
+
pkgs ? import ../.. { inherit system; config = {}; },
+
...
+
} @ args:
-
with import ../lib/testing.nix { inherit system; };
+
with import ../lib/testing.nix { inherit system pkgs; };
makeTest (if pkgs.lib.isFunction f then f (args // { inherit pkgs; inherit (pkgs) lib; }) else f)
+3 -1
nixos/tests/networking.nix
···
{ system ? builtins.currentSystem
+
, config ? {}
+
, pkgs ? import ../.. { inherit system config; },
# bool: whether to use networkd in the tests
, networkd }:
-
with import ../lib/testing.nix { inherit system; };
+
with import ../lib/testing.nix { inherit system pkgs; };
with pkgs.lib;
let
+7 -4
nixos/tests/nextcloud/default.nix
···
-
{ system ? builtins.currentSystem }:
+
{ system ? builtins.currentSystem,
+
config ? {},
+
pkgs ? import ../../.. { inherit system config; }
+
}:
{
-
basic = import ./basic.nix { inherit system; };
-
with-postgresql-and-redis = import ./with-postgresql-and-redis.nix { inherit system; };
-
with-mysql-and-memcached = import ./with-mysql-and-memcached.nix { inherit system; };
+
basic = import ./basic.nix { inherit system pkgs; };
+
with-postgresql-and-redis = import ./with-postgresql-and-redis.nix { inherit system pkgs; };
+
with-mysql-and-memcached = import ./with-mysql-and-memcached.nix { inherit system pkgs; };
}
+7 -2
nixos/tests/postgresql.nix
···
-
{ system ? builtins.currentSystem }:
-
with import ../lib/testing.nix { inherit system; };
+
{ system ? builtins.currentSystem,
+
config ? {},
+
pkgs ? import ../.. { inherit system config; }
+
}:
+
+
with import ../lib/testing.nix { inherit system pkgs; };
with pkgs.lib;
+
let
postgresql-versions = pkgs.callPackages ../../pkgs/servers/sql/postgresql { };
test-sql = pkgs.writeText "postgresql-test" ''
+5 -2
nixos/tests/predictable-interface-names.nix
···
-
{ system ? builtins.currentSystem }:
+
{ system ? builtins.currentSystem,
+
config ? {},
+
pkgs ? import ../.. { inherit system config; }
+
}:
let
-
inherit (import ../lib/testing.nix { inherit system; }) makeTest pkgs;
+
inherit (import ../lib/testing.nix { inherit system pkgs; }) makeTest;
in pkgs.lib.listToAttrs (pkgs.lib.crossLists (predictable: withNetworkd: {
name = pkgs.lib.optionalString (!predictable) "un" + "predictable"
+ pkgs.lib.optionalString withNetworkd "Networkd";
+7 -2
nixos/tests/rspamd.nix
···
-
{ system ? builtins.currentSystem }:
-
with import ../lib/testing.nix { inherit system; };
+
{ system ? builtins.currentSystem,
+
config ? {},
+
pkgs ? import ../.. { inherit system config; }
+
}:
+
+
with import ../lib/testing.nix { inherit system pkgs; };
with pkgs.lib;
+
let
initMachine = ''
startAll
+6 -2
nixos/tests/rsyslogd.nix
···
-
{ system ? builtins.currentSystem }:
+
{ system ? builtins.currentSystem,
+
config ? {},
+
pkgs ? import ../.. { inherit system config; }
+
}:
-
with import ../lib/testing.nix { inherit system; };
+
with import ../lib/testing.nix { inherit system pkgs; };
with pkgs.lib;
+
{
test1 = makeTest {
name = "rsyslogd-test1";
+5 -2
nixos/tests/run-in-machine.nix
···
-
{ system ? builtins.currentSystem }:
+
{ system ? builtins.currentSystem,
+
config ? {},
+
pkgs ? import ../.. { inherit system config; }
+
}:
-
with import ../lib/testing.nix { inherit system; };
+
with import ../lib/testing.nix { inherit system pkgs; };
let
output = runInMachine {
+5 -2
nixos/tests/sddm.nix
···
-
{ system ? builtins.currentSystem }:
+
{ system ? builtins.currentSystem,
+
config ? {},
+
pkgs ? import ../.. { inherit system config; }
+
}:
-
with import ../lib/testing.nix { inherit system; };
+
with import ../lib/testing.nix { inherit system pkgs; };
let
inherit (pkgs) lib;
+7 -2
nixos/tests/virtualbox.nix
···
-
{ system ? builtins.currentSystem, debug ? false, enableUnfree ? false }:
+
{ system ? builtins.currentSystem,
+
config ? {},
+
pkgs ? import ../.. { inherit system config; },
+
debug ? false,
+
enableUnfree ? false
+
}:
-
with import ../lib/testing.nix { inherit system; };
+
with import ../lib/testing.nix { inherit system pkgs; };
with pkgs.lib;
let
+5 -2
nixos/tests/zfs.nix
···
-
{ system ? builtins.currentSystem }:
+
{ system ? builtins.currentSystem,
+
config ? {},
+
pkgs ? import ../.. { inherit system config; }
+
}:
-
with import ../lib/testing.nix { inherit system; };
+
with import ../lib/testing.nix { inherit system pkgs; };
let