mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-10 03:23:29 +03:00
treewide: format all inactive Nix files
After final improvements to the official formatter implementation, this commit now performs the first treewide reformat of Nix files using it. This is part of the implementation of RFC 166. Only "inactive" files are reformatted, meaning only files that aren't being touched by any PR with activity in the past 2 months. This is to avoid conflicts for PRs that might soon be merged. Later we can do a full treewide reformat to get the rest, which should not cause as many conflicts. A CI check has already been running for some time to ensure that new and already-formatted files are formatted, so the files being reformatted here should also stay formatted. This commit was automatically created and can be verified using nix-builda08b3a4d19
.tar.gz \ --argstr baseRevb32a094368
result/bin/apply-formatting $NIXPKGS_PATH
This commit is contained in:
parent
b32a094368
commit
4f0dadbf38
21293 changed files with 701351 additions and 428307 deletions
|
@ -1,11 +1,21 @@
|
|||
{ lib }:
|
||||
let
|
||||
|
||||
evalTest = module: lib.evalModules {
|
||||
modules = testModules ++ [ module ];
|
||||
class = "nixosTest";
|
||||
};
|
||||
runTest = module: (evalTest ({ config, ... }: { imports = [ module ]; result = config.test; })).config.result;
|
||||
evalTest =
|
||||
module:
|
||||
lib.evalModules {
|
||||
modules = testModules ++ [ module ];
|
||||
class = "nixosTest";
|
||||
};
|
||||
runTest =
|
||||
module:
|
||||
(evalTest (
|
||||
{ config, ... }:
|
||||
{
|
||||
imports = [ module ];
|
||||
result = config.test;
|
||||
}
|
||||
)).config.result;
|
||||
|
||||
testModules = [
|
||||
./call-test.nix
|
||||
|
|
|
@ -1,4 +1,10 @@
|
|||
{ config, lib, moduleType, hostPkgs, ... }:
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
moduleType,
|
||||
hostPkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (lib) mkOption types;
|
||||
in
|
||||
|
|
|
@ -1,4 +1,9 @@
|
|||
{ config, options, lib, ... }:
|
||||
{
|
||||
config,
|
||||
options,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (lib) mkIf mkOption types;
|
||||
in
|
||||
|
|
|
@ -15,14 +15,14 @@ in
|
|||
options = {
|
||||
maintainers = lib.mkOption {
|
||||
type = types.listOf types.raw;
|
||||
default = [];
|
||||
default = [ ];
|
||||
description = ''
|
||||
The [list of maintainers](https://nixos.org/manual/nixpkgs/stable/#var-meta-maintainers) for this test.
|
||||
'';
|
||||
};
|
||||
timeout = lib.mkOption {
|
||||
type = types.nullOr types.int;
|
||||
default = 3600; # 1 hour
|
||||
default = 3600; # 1 hour
|
||||
description = ''
|
||||
The [{option}`test`](#test-opt-test)'s [`meta.timeout`](https://nixos.org/manual/nixpkgs/stable/#var-meta-timeout) in seconds.
|
||||
'';
|
||||
|
@ -43,7 +43,7 @@ in
|
|||
};
|
||||
};
|
||||
};
|
||||
default = {};
|
||||
default = { };
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -2,20 +2,33 @@
|
|||
|
||||
let
|
||||
inherit (lib)
|
||||
attrNames concatMap concatMapStrings flip forEach head
|
||||
listToAttrs mkDefault mkOption nameValuePair optionalString
|
||||
range toLower types zipListsWith zipLists
|
||||
attrNames
|
||||
concatMap
|
||||
concatMapStrings
|
||||
flip
|
||||
forEach
|
||||
head
|
||||
listToAttrs
|
||||
mkDefault
|
||||
mkOption
|
||||
nameValuePair
|
||||
optionalString
|
||||
range
|
||||
toLower
|
||||
types
|
||||
zipListsWith
|
||||
zipLists
|
||||
;
|
||||
|
||||
nodeNumbers =
|
||||
listToAttrs
|
||||
(zipListsWith
|
||||
nameValuePair
|
||||
(attrNames nodes)
|
||||
(range 1 254)
|
||||
);
|
||||
nodeNumbers = listToAttrs (zipListsWith nameValuePair (attrNames nodes) (range 1 254));
|
||||
|
||||
networkModule = { config, nodes, pkgs, ... }:
|
||||
networkModule =
|
||||
{
|
||||
config,
|
||||
nodes,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
qemu-common = import ../qemu-common.nix { inherit lib pkgs; };
|
||||
|
||||
|
@ -31,7 +44,8 @@ let
|
|||
|
||||
# Automatically assign IP addresses to requested interfaces.
|
||||
assignIPs = lib.filter (i: i.assignIP) interfaces;
|
||||
ipInterfaces = forEach assignIPs (i:
|
||||
ipInterfaces = forEach assignIPs (
|
||||
i:
|
||||
nameValuePair i.name {
|
||||
ipv4.addresses = [
|
||||
{
|
||||
|
@ -45,47 +59,59 @@ let
|
|||
prefixLength = 64;
|
||||
}
|
||||
];
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
qemuOptions = lib.flatten (forEach interfacesNumbered ({ fst, snd }:
|
||||
qemu-common.qemuNICFlags snd fst.vlan config.virtualisation.test.nodeNumber));
|
||||
udevRules = forEach interfacesNumbered ({ fst, snd }:
|
||||
qemuOptions = lib.flatten (
|
||||
forEach interfacesNumbered (
|
||||
{ fst, snd }: qemu-common.qemuNICFlags snd fst.vlan config.virtualisation.test.nodeNumber
|
||||
)
|
||||
);
|
||||
udevRules = forEach interfacesNumbered (
|
||||
{ fst, snd }:
|
||||
# MAC Addresses for QEMU network devices are lowercase, and udev string comparison is case-sensitive.
|
||||
''SUBSYSTEM=="net",ACTION=="add",ATTR{address}=="${toLower(qemu-common.qemuNicMac fst.vlan config.virtualisation.test.nodeNumber)}",NAME="${fst.name}"'');
|
||||
''SUBSYSTEM=="net",ACTION=="add",ATTR{address}=="${toLower (qemu-common.qemuNicMac fst.vlan config.virtualisation.test.nodeNumber)}",NAME="${fst.name}"''
|
||||
);
|
||||
|
||||
networkConfig =
|
||||
{
|
||||
networking.hostName = mkDefault config.virtualisation.test.nodeName;
|
||||
networkConfig = {
|
||||
networking.hostName = mkDefault config.virtualisation.test.nodeName;
|
||||
|
||||
networking.interfaces = listToAttrs ipInterfaces;
|
||||
networking.interfaces = listToAttrs ipInterfaces;
|
||||
|
||||
networking.primaryIPAddress =
|
||||
optionalString (ipInterfaces != [ ]) (head (head ipInterfaces).value.ipv4.addresses).address;
|
||||
networking.primaryIPAddress =
|
||||
optionalString (ipInterfaces != [ ])
|
||||
(head (head ipInterfaces).value.ipv4.addresses).address;
|
||||
|
||||
networking.primaryIPv6Address =
|
||||
optionalString (ipInterfaces != [ ]) (head (head ipInterfaces).value.ipv6.addresses).address;
|
||||
networking.primaryIPv6Address =
|
||||
optionalString (ipInterfaces != [ ])
|
||||
(head (head ipInterfaces).value.ipv6.addresses).address;
|
||||
|
||||
# Put the IP addresses of all VMs in this machine's
|
||||
# /etc/hosts file. If a machine has multiple
|
||||
# interfaces, use the IP address corresponding to
|
||||
# the first interface (i.e. the first network in its
|
||||
# virtualisation.vlans option).
|
||||
networking.extraHosts = flip concatMapStrings (attrNames nodes)
|
||||
(m':
|
||||
let
|
||||
config = nodes.${m'};
|
||||
hostnames =
|
||||
optionalString (config.networking.domain != null) "${config.networking.hostName}.${config.networking.domain} " +
|
||||
"${config.networking.hostName}\n";
|
||||
in
|
||||
optionalString (config.networking.primaryIPAddress != "")
|
||||
"${config.networking.primaryIPAddress} ${hostnames}" +
|
||||
optionalString (config.networking.primaryIPv6Address != "")
|
||||
("${config.networking.primaryIPv6Address} ${hostnames}"));
|
||||
# Put the IP addresses of all VMs in this machine's
|
||||
# /etc/hosts file. If a machine has multiple
|
||||
# interfaces, use the IP address corresponding to
|
||||
# the first interface (i.e. the first network in its
|
||||
# virtualisation.vlans option).
|
||||
networking.extraHosts = flip concatMapStrings (attrNames nodes) (
|
||||
m':
|
||||
let
|
||||
config = nodes.${m'};
|
||||
hostnames =
|
||||
optionalString (
|
||||
config.networking.domain != null
|
||||
) "${config.networking.hostName}.${config.networking.domain} "
|
||||
+ "${config.networking.hostName}\n";
|
||||
in
|
||||
optionalString (
|
||||
config.networking.primaryIPAddress != ""
|
||||
) "${config.networking.primaryIPAddress} ${hostnames}"
|
||||
+ optionalString (config.networking.primaryIPv6Address != "") (
|
||||
"${config.networking.primaryIPv6Address} ${hostnames}"
|
||||
)
|
||||
);
|
||||
|
||||
virtualisation.qemu.options = qemuOptions;
|
||||
boot.initrd.services.udev.rules = concatMapStrings (x: x + "\n") udevRules;
|
||||
};
|
||||
virtualisation.qemu.options = qemuOptions;
|
||||
boot.initrd.services.udev.rules = concatMapStrings (x: x + "\n") udevRules;
|
||||
};
|
||||
|
||||
in
|
||||
{
|
||||
|
@ -97,50 +123,60 @@ let
|
|||
};
|
||||
};
|
||||
|
||||
nodeNumberModule = (regular@{ config, name, ... }: {
|
||||
options = {
|
||||
virtualisation.test.nodeName = mkOption {
|
||||
internal = true;
|
||||
default = name;
|
||||
# We need to force this in specilisations, otherwise it'd be
|
||||
# readOnly = true;
|
||||
description = ''
|
||||
The `name` in `nodes.<name>`; stable across `specialisations`.
|
||||
'';
|
||||
};
|
||||
virtualisation.test.nodeNumber = mkOption {
|
||||
internal = true;
|
||||
type = types.int;
|
||||
readOnly = true;
|
||||
default = nodeNumbers.${config.virtualisation.test.nodeName};
|
||||
description = ''
|
||||
A unique number assigned for each node in `nodes`.
|
||||
'';
|
||||
};
|
||||
nodeNumberModule = (
|
||||
regular@{ config, name, ... }:
|
||||
{
|
||||
options = {
|
||||
virtualisation.test.nodeName = mkOption {
|
||||
internal = true;
|
||||
default = name;
|
||||
# We need to force this in specilisations, otherwise it'd be
|
||||
# readOnly = true;
|
||||
description = ''
|
||||
The `name` in `nodes.<name>`; stable across `specialisations`.
|
||||
'';
|
||||
};
|
||||
virtualisation.test.nodeNumber = mkOption {
|
||||
internal = true;
|
||||
type = types.int;
|
||||
readOnly = true;
|
||||
default = nodeNumbers.${config.virtualisation.test.nodeName};
|
||||
description = ''
|
||||
A unique number assigned for each node in `nodes`.
|
||||
'';
|
||||
};
|
||||
|
||||
# specialisations override the `name` module argument,
|
||||
# so we push the real `virtualisation.test.nodeName`.
|
||||
specialisation = mkOption {
|
||||
type = types.attrsOf (types.submodule {
|
||||
options.configuration = mkOption {
|
||||
type = types.submoduleWith {
|
||||
modules = [
|
||||
{
|
||||
config.virtualisation.test.nodeName =
|
||||
# assert regular.config.virtualisation.test.nodeName != "configuration";
|
||||
regular.config.virtualisation.test.nodeName;
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
});
|
||||
# specialisations override the `name` module argument,
|
||||
# so we push the real `virtualisation.test.nodeName`.
|
||||
specialisation = mkOption {
|
||||
type = types.attrsOf (
|
||||
types.submodule {
|
||||
options.configuration = mkOption {
|
||||
type = types.submoduleWith {
|
||||
modules = [
|
||||
{
|
||||
config.virtualisation.test.nodeName =
|
||||
# assert regular.config.virtualisation.test.nodeName != "configuration";
|
||||
regular.config.virtualisation.test.nodeName;
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
);
|
||||
};
|
||||
};
|
||||
};
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
in
|
||||
{
|
||||
config = {
|
||||
extraBaseModules = { imports = [ networkModule nodeNumberModule ]; };
|
||||
extraBaseModules = {
|
||||
imports = [
|
||||
networkModule
|
||||
nodeNumberModule
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -9,7 +9,10 @@ in
|
|||
imports = [
|
||||
../../modules/virtualisation/qemu-vm.nix
|
||||
../../modules/testing/test-instrumentation.nix # !!! should only get added for automated test runs
|
||||
{ key = "no-manual"; documentation.nixos.enable = false; }
|
||||
{
|
||||
key = "no-manual";
|
||||
documentation.nixos.enable = false;
|
||||
}
|
||||
{
|
||||
key = "no-revision";
|
||||
# Make the revision metadata constant, in order to avoid needless retesting.
|
||||
|
@ -22,11 +25,16 @@ in
|
|||
label = mkForce "test";
|
||||
};
|
||||
}
|
||||
({ config, ... }: {
|
||||
# Don't pull in switch-to-configuration by default, except when specialisations or early boot shenanigans are involved.
|
||||
# This is mostly a Hydra optimization, so we don't rebuild all the tests every time switch-to-configuration-ng changes.
|
||||
key = "no-switch-to-configuration";
|
||||
system.switch.enable = mkDefault (config.isSpecialisation || config.specialisation != {} || config.virtualisation.installBootLoader);
|
||||
})
|
||||
(
|
||||
{ config, ... }:
|
||||
{
|
||||
# Don't pull in switch-to-configuration by default, except when specialisations or early boot shenanigans are involved.
|
||||
# This is mostly a Hydra optimization, so we don't rebuild all the tests every time switch-to-configuration-ng changes.
|
||||
key = "no-switch-to-configuration";
|
||||
system.switch.enable = mkDefault (
|
||||
config.isSpecialisation || config.specialisation != { } || config.virtualisation.installBootLoader
|
||||
);
|
||||
}
|
||||
)
|
||||
];
|
||||
}
|
||||
|
|
|
@ -1,4 +1,10 @@
|
|||
testModuleArgs@{ config, lib, hostPkgs, nodes, ... }:
|
||||
testModuleArgs@{
|
||||
config,
|
||||
lib,
|
||||
hostPkgs,
|
||||
nodes,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
inherit (lib)
|
||||
|
@ -7,7 +13,8 @@ let
|
|||
mapAttrs
|
||||
mkDefault
|
||||
mkIf
|
||||
mkOption mkForce
|
||||
mkOption
|
||||
mkForce
|
||||
optional
|
||||
optionalAttrs
|
||||
types
|
||||
|
@ -16,8 +23,8 @@ let
|
|||
inherit (hostPkgs.stdenv) hostPlatform;
|
||||
|
||||
guestSystem =
|
||||
if hostPlatform.isLinux
|
||||
then hostPlatform.system
|
||||
if hostPlatform.isLinux then
|
||||
hostPlatform.system
|
||||
else
|
||||
let
|
||||
hostToGuest = {
|
||||
|
@ -27,39 +34,43 @@ let
|
|||
|
||||
supportedHosts = lib.concatStringsSep ", " (lib.attrNames hostToGuest);
|
||||
|
||||
message =
|
||||
"NixOS Test: don't know which VM guest system to pair with VM host system: ${hostPlatform.system}. Perhaps you intended to run the tests on a Linux host, or one of the following systems that may run NixOS tests: ${supportedHosts}";
|
||||
message = "NixOS Test: don't know which VM guest system to pair with VM host system: ${hostPlatform.system}. Perhaps you intended to run the tests on a Linux host, or one of the following systems that may run NixOS tests: ${supportedHosts}";
|
||||
in
|
||||
hostToGuest.${hostPlatform.system} or (throw message);
|
||||
|
||||
baseOS =
|
||||
import ../eval-config.nix {
|
||||
inherit lib;
|
||||
system = null; # use modularly defined system
|
||||
inherit (config.node) specialArgs;
|
||||
modules = [ config.defaults ];
|
||||
baseModules = (import ../../modules/module-list.nix) ++
|
||||
[
|
||||
./nixos-test-base.nix
|
||||
{ key = "nodes"; _module.args.nodes = config.nodesCompat; }
|
||||
({ config, ... }:
|
||||
{
|
||||
virtualisation.qemu.package = testModuleArgs.config.qemu.package;
|
||||
virtualisation.host.pkgs = hostPkgs;
|
||||
})
|
||||
({ options, ... }: {
|
||||
key = "nodes.nix-pkgs";
|
||||
config = optionalAttrs (!config.node.pkgsReadOnly) (
|
||||
mkIf (!options.nixpkgs.pkgs.isDefined) {
|
||||
# TODO: switch to nixpkgs.hostPlatform and make sure containers-imperative test still evaluates.
|
||||
nixpkgs.system = guestSystem;
|
||||
}
|
||||
);
|
||||
})
|
||||
testModuleArgs.config.extraBaseModules
|
||||
];
|
||||
};
|
||||
hostToGuest.${hostPlatform.system} or (throw message);
|
||||
|
||||
baseOS = import ../eval-config.nix {
|
||||
inherit lib;
|
||||
system = null; # use modularly defined system
|
||||
inherit (config.node) specialArgs;
|
||||
modules = [ config.defaults ];
|
||||
baseModules = (import ../../modules/module-list.nix) ++ [
|
||||
./nixos-test-base.nix
|
||||
{
|
||||
key = "nodes";
|
||||
_module.args.nodes = config.nodesCompat;
|
||||
}
|
||||
(
|
||||
{ config, ... }:
|
||||
{
|
||||
virtualisation.qemu.package = testModuleArgs.config.qemu.package;
|
||||
virtualisation.host.pkgs = hostPkgs;
|
||||
}
|
||||
)
|
||||
(
|
||||
{ options, ... }:
|
||||
{
|
||||
key = "nodes.nix-pkgs";
|
||||
config = optionalAttrs (!config.node.pkgsReadOnly) (
|
||||
mkIf (!options.nixpkgs.pkgs.isDefined) {
|
||||
# TODO: switch to nixpkgs.hostPlatform and make sure containers-imperative test still evaluates.
|
||||
nixpkgs.system = guestSystem;
|
||||
}
|
||||
);
|
||||
}
|
||||
)
|
||||
testModuleArgs.config.extraBaseModules
|
||||
];
|
||||
};
|
||||
|
||||
in
|
||||
|
||||
|
@ -148,14 +159,16 @@ in
|
|||
|
||||
config = {
|
||||
_module.args.nodes = config.nodesCompat;
|
||||
nodesCompat =
|
||||
mapAttrs
|
||||
(name: config: config // {
|
||||
config = lib.warnIf (lib.oldestSupportedReleaseIsAtLeast 2211)
|
||||
nodesCompat = mapAttrs (
|
||||
name: config:
|
||||
config
|
||||
// {
|
||||
config =
|
||||
lib.warnIf (lib.oldestSupportedReleaseIsAtLeast 2211)
|
||||
"Module argument `nodes.${name}.config` is deprecated. Use `nodes.${name}` instead."
|
||||
config;
|
||||
})
|
||||
config.nodes;
|
||||
}
|
||||
) config.nodes;
|
||||
|
||||
passthru.nodes = config.nodesCompat;
|
||||
|
||||
|
|
|
@ -1,4 +1,9 @@
|
|||
{ config, lib, hostPkgs, ... }:
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
hostPkgs,
|
||||
...
|
||||
}:
|
||||
{
|
||||
config = {
|
||||
# default pkgs for use in VMs
|
||||
|
|
|
@ -1,4 +1,9 @@
|
|||
{ config, hostPkgs, lib, ... }:
|
||||
{
|
||||
config,
|
||||
hostPkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (lib) types mkOption;
|
||||
in
|
||||
|
@ -41,7 +46,8 @@ in
|
|||
rawTestDerivation = hostPkgs.stdenv.mkDerivation {
|
||||
name = "vm-test-run-${config.name}";
|
||||
|
||||
requiredSystemFeatures = [ "nixos-test" ]
|
||||
requiredSystemFeatures =
|
||||
[ "nixos-test" ]
|
||||
++ lib.optionals hostPkgs.stdenv.hostPlatform.isLinux [ "kvm" ]
|
||||
++ lib.optionals hostPkgs.stdenv.hostPlatform.isDarwin [ "apple-virt" ];
|
||||
|
||||
|
@ -58,7 +64,8 @@ in
|
|||
|
||||
meta = config.meta;
|
||||
};
|
||||
test = lib.lazyDerivation { # lazyDerivation improves performance when only passthru items and/or meta are used.
|
||||
test = lib.lazyDerivation {
|
||||
# lazyDerivation improves performance when only passthru items and/or meta are used.
|
||||
derivation = config.rawTestDerivation;
|
||||
inherit (config) passthru meta;
|
||||
};
|
||||
|
|
|
@ -1,4 +1,11 @@
|
|||
testModuleArgs@{ config, lib, hostPkgs, nodes, moduleType, ... }:
|
||||
testModuleArgs@{
|
||||
config,
|
||||
lib,
|
||||
hostPkgs,
|
||||
nodes,
|
||||
moduleType,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (lib) mkOption types;
|
||||
inherit (types) either str functionTo;
|
||||
|
@ -37,48 +44,50 @@ in
|
|||
withoutTestScriptReferences.testScript = lib.mkForce "testscript omitted";
|
||||
|
||||
testScriptString =
|
||||
if lib.isFunction config.testScript
|
||||
then
|
||||
config.testScript
|
||||
{
|
||||
nodes =
|
||||
lib.mapAttrs
|
||||
(k: v:
|
||||
if v.virtualisation.useNixStoreImage
|
||||
then
|
||||
# prevent infinite recursion when testScript would
|
||||
# reference v's toplevel
|
||||
config.withoutTestScriptReferences.nodesCompat.${k}
|
||||
else
|
||||
# reuse memoized config
|
||||
v
|
||||
)
|
||||
config.nodesCompat;
|
||||
}
|
||||
else config.testScript;
|
||||
if lib.isFunction config.testScript then
|
||||
config.testScript {
|
||||
nodes = lib.mapAttrs (
|
||||
k: v:
|
||||
if v.virtualisation.useNixStoreImage then
|
||||
# prevent infinite recursion when testScript would
|
||||
# reference v's toplevel
|
||||
config.withoutTestScriptReferences.nodesCompat.${k}
|
||||
else
|
||||
# reuse memoized config
|
||||
v
|
||||
) config.nodesCompat;
|
||||
}
|
||||
else
|
||||
config.testScript;
|
||||
|
||||
defaults = { config, name, ... }: {
|
||||
# Make sure all derivations referenced by the test
|
||||
# script are available on the nodes. When the store is
|
||||
# accessed through 9p, this isn't important, since
|
||||
# everything in the store is available to the guest,
|
||||
# but when building a root image it is, as all paths
|
||||
# that should be available to the guest has to be
|
||||
# copied to the image.
|
||||
virtualisation.additionalPaths =
|
||||
lib.optional
|
||||
# A testScript may evaluate nodes, which has caused
|
||||
# infinite recursions. The demand cycle involves:
|
||||
# testScript -->
|
||||
# nodes -->
|
||||
# toplevel -->
|
||||
# additionalPaths -->
|
||||
# hasContext testScript' -->
|
||||
# testScript (ad infinitum)
|
||||
# If we don't need to build an image, we can break this
|
||||
# cycle by short-circuiting when useNixStoreImage is false.
|
||||
(config.virtualisation.useNixStoreImage && builtins.hasContext testModuleArgs.config.testScriptString && testModuleArgs.config.includeTestScriptReferences)
|
||||
(hostPkgs.writeStringReferencesToFile testModuleArgs.config.testScriptString);
|
||||
};
|
||||
defaults =
|
||||
{ config, name, ... }:
|
||||
{
|
||||
# Make sure all derivations referenced by the test
|
||||
# script are available on the nodes. When the store is
|
||||
# accessed through 9p, this isn't important, since
|
||||
# everything in the store is available to the guest,
|
||||
# but when building a root image it is, as all paths
|
||||
# that should be available to the guest has to be
|
||||
# copied to the image.
|
||||
virtualisation.additionalPaths =
|
||||
lib.optional
|
||||
# A testScript may evaluate nodes, which has caused
|
||||
# infinite recursions. The demand cycle involves:
|
||||
# testScript -->
|
||||
# nodes -->
|
||||
# toplevel -->
|
||||
# additionalPaths -->
|
||||
# hasContext testScript' -->
|
||||
# testScript (ad infinitum)
|
||||
# If we don't need to build an image, we can break this
|
||||
# cycle by short-circuiting when useNixStoreImage is false.
|
||||
(
|
||||
config.virtualisation.useNixStoreImage
|
||||
&& builtins.hasContext testModuleArgs.config.testScriptString
|
||||
&& testModuleArgs.config.includeTestScriptReferences
|
||||
)
|
||||
(hostPkgs.writeStringReferencesToFile testModuleArgs.config.testScriptString);
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue