With this patch I essentially get the expected list of maintainers for changes in
nixos-tests.
The downside of this approach is that the CI facility assumes that
there's at most a single definition of `meta.maintainers`, however it
can be more in a module-system context.
For simplicity, just use the first definition location for the time
being.
Verified with
let
lib = import ./lib;
maintainers = import ./ci/eval/compare/maintainers.nix { inherit lib; };
in
maintainers {
changedFiles = [
"nixos/tests/matrix/matrix-authentication-service.nix"
];
affectedAttrPaths = map (lib.splitString ".") [
"nixosTests.matrix-authentication-service"
];
}
Apparently this wasn't the case before, but now it is
In [3]: machine.shell_interact()
??? Warning (DeprecationWarning): Use the SSH backdoor instead
File "<ipython-input-3-4e72ea6a987e>", line 1
Reviewing #512771 got me thinking and I'm not sure I see a good reason
to keep this method given the SSH backdoor functionality has a much
better UX.
I'd propose we deprecate it, await 26.11 to see if people complain and
remove it alltogether after that.
The nspawn test machine passes a driver-owned AF_UNIX SOCK_DGRAM socket as the
container's NOTIFY_SOCKET (systemd-nspawn --notify-ready=yes). The driver only
drained it while waiting for the initial READY=1 during boot.
A container's PID 1 re-sends READY=1 on every `systemctl daemon-reexec` (the
same Manager.Reexecute that switch-to-configuration issues whenever the systemd
package changed). With nothing draining the socket after boot, its receive
buffer fills and PID 1 blocks in sendmsg() to NOTIFY_SOCKET (wchan
unix_wait_for_peer) while re-executing, so it never finishes re-initializing.
From then on every in-container `systemctl` call hangs or fails with
'Transport endpoint is not connected', which hangs wait_for_unit /
switch-to-configuration for the full timeout. QEMU nodes have no such notify
socket and are unaffected.
Drain the notify socket in a dedicated daemon thread for the container's whole
lifetime so PID 1 never blocks on the re-exec READY=1 send. Readiness and the
leader PID are now read from that thread's state instead of polling the socket
inline during boot.
Assisted-by: Claude:claude-opus-4-8
Commit 31d1d80b3f ("lib/systems: move kernel configuration out of
the platform structure") changed all-packages.nix from
vmTools = callPackage ../build-support/vm {
img = stdenv.hostPlatform.linux-kernel.target;
};
to
vmTools = callPackage ../build-support/vm { };
and changed the function default to `img ? kernel.target`. Since
`pkgs.img` exists, `callPackage` now auto-fills the `img` argument
with that attribute and the default is never used.
Anything going through `runInLinuxVM` (make-disk-image,
nixosTests.bootspec.*, etc.) then fails with:
qemu: could not open kernel file
'/nix/store/...-linux-.../...-img-0.5.11': No such file or directory
Rename `img` to `kernelImage` so it no longer collides with a
top-level package.
The same commit also broke callers that override `kernel` with an
`aggregateModules` tree (the in-tree zfs image builders, disko), since
that has no `.target`. The single `kernel` argument was being used for
two unrelated things: the boot image for `qemu -kernel` and the module
tree for the initrd. Split the latter out into a new `kernelModules`
argument (defaulting to `kernel`), point the zfs image builders at it,
and throw a clear error explaining the migration when `kernel.target`
is missing.
escapeSystemdPath relied on lib.strings.normalizePath, which only
collapses duplicate slashes and does not drop "." path components the
way systemd's path_simplify() does. A path like /mnt/./foo was thus
escaped to mnt-.-foo instead of mnt-foo, and systemd refused the
generated unit ("Where= setting doesn't match unit name").
Reimplement the simplification to match `systemd-escape --path` exactly:
drop "." and empty components, collapse a leading ".." run in an
absolute path to the root, and throw on any input systemd-escape
rejects (a non-leading "..", or a relative path that reduces to
nothing). Parity is checked against the systemd-escape binary over a
battery of edge cases and fuzzed inputs. While here, hoist the constant
escape table and partial applications out of the per-call lambda so
they are built once rather than on every call, making the function
~2.5x faster.
Resolves: https://github.com/NixOS/nixpkgs/issues/515270
Assisted-by: Claude:claude-opus-4-8
In 9e78baf, Aarch64 machines were added the `-device virtio-gpu-pci`
argument, to mirror `-vga std` option that was added unconditionally to
virtualised x86_64 machines. This also enabled screenshots on aarch64
machines to be taken in tests. Since then, in a7ca287, the `-vga std`
option was removed, because that is the default value of this option
embedded in QEMU since version 2.2.
Removing it from the hard-coded list of qemu options makes it possible
for the user to choose their own `-vga` value. Similarly, for Aarch
virtualised machines, choosing unconditionally the `-device virtio-gpu-pci`
option instead of e.g `-device virtio-gpu-gl-pci`, can be bothersome too - see:
https://discourse.nixos.org/t/test-an-aarch64-linux-vm-wayland-compositor-from-an-x86-64-linux-host/77416/2
This commit is similar to 44c6c2ef16 which
was reverted in #527048.
Before this commit, `wait_for_console_text` would read one line every
900ms before trying again to read the next line.
This commit fixes that behavior by greedily reading all buffer that is
available for match trying to find a match rather than reading one per
retry iteration.
In effect this moves the loop inside the `console_matches` helper and
makes the behavior of `wait_for_console_text` with timeout behave the
same way as with timeout.
This also provides a test that showcases the problem.
After d95261b435, the following flake.nix fails:
```nix
{
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
outputs = { nixpkgs, ... }: {
nixosConfigurations.demo = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
({ lib, ... }: {
boot.loader.grub.enable = false;
fileSystems."/" = { device = "none"; fsType = "tmpfs"; };
nixpkgs.config.packageOverrides =
lib.mkIf false (_: { });
})
];
};
};
}
```
This is the error:
```
$ nix build /tmp/tmp.vWEVitTgK9/#nixosConfigurations.demo.config.system.build.toplevel
evaluation warning: system.stateVersion is not set, defaulting to 26.05. Read why this matters on https://nixos.org/manual/nixos/stable/options.html#opt-system.stateVersion.
error:
… while calling the 'derivationStrict' builtin
at <nix/derivation-internal.nix>:37:12:
36|
37| strict = derivationStrict drvAttrs;
| ^
38|
… while evaluating derivation 'nixos-system-nixos-26.05.20260409.4c1018d'
whose name attribute is located at /nix/store/anvdcc2arw7kqrvwnidvhw6ypkkvws68-source/pkgs/stdenv/generic/make-derivation.nix:541:11
… while evaluating attribute 'buildCommand' of derivation 'nixos-system-nixos-26.05.20260409.4c1018d'
at /nix/store/anvdcc2arw7kqrvwnidvhw6ypkkvws68-source/nixos/modules/system/activation/top-level.nix:64:7:
63| passAsFile = [ "extraDependencies" ];
64| buildCommand = systemBuilder;
| ^
65|
… while evaluating the option `environment.etc.dbus-1.source':
… while evaluating the default value of option `pythonTestDriverPackage`
… while evaluating the module argument `hostPkgs' in "/nix/store/anvdcc2arw7kqrvwnidvhw6ypkkvws68-source/nixos/lib/testing/driver.nix":
… noting that argument `hostPkgs` is not externally provided, so querying `_module.args` instead, requiring `config`
… while evaluating the option `hostPkgs':
(stack trace truncated; use '--show-trace' to show the full, detailed trace)
error: The option `hostPkgs' was accessed but has no value defined. Try setting the option.
```
Setting a `defaultText` fixes the issue.
I've also added a regression test under `nixos/tests/nixos-test-driver/` and
fixed a typo in the option description ("implemetnation").
TL;DR add `assert` to correct location for type-narrowing
typeshed recently updated their definition of `select` in https://github.com/python/typeshed/commit/bcb6399e155cb6444150fe98dfd9c24eb0343016.
The result is that the members of the lists passed to `select` now
require an upper bound of `FileDescriptorLike`.
The `self.shell` variable is typed as `socket | None`, but previously
passed checking against typeshed due to the missing upper-bound.
Despite the source code including a type-narrowing `assert`, `ty` does
not make use of it within the inner function that `select` is used in,
meaning `self.shell` wasn't narrowed at the appropriate place.
Now that typeshed has added this upper-bound, type-checking starts to fail, as evidenced in
https://github.com/NixOS/nixpkgs/pull/523288#issuecomment-4529738483.
So the correct fix is just to add the `assert` into the inner function.