1416 Commits

Author SHA1 Message Date
Maximilian Bosch 483f2db40a nixos/testing: allow meta.teams in tests, fix maintainer pings for tests (#540388) 2026-07-21 21:42:07 +00:00
Robert Schütz aeba2fa7b6 nixos/systemd: allow listenStreams to contain ports 2026-07-10 10:55:22 -07:00
Maximilian Bosch 93b2178163 nixos/testing: allow meta.teams in tests, fix maintainer pings for tests
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"
      ];
    }
2026-07-10 16:29:13 +02:00
Vladimír Čunát 4bddd7068b Merge master into staging-next 2026-07-08 16:42:08 +02:00
Martin Weinelt e97294ecc7 nixos/nixpkgs: add zstd flavored nixexprs tarballs (#535272) 2026-07-08 14:23:04 +00:00
Martin Weinelt 54dc8286f9 {nixos/channel,make-tarball.nix}: argue for unbounded compression threads 2026-07-08 10:34:14 +02:00
nixpkgs-ci[bot] 1b4836a2ba Merge master into staging-next 2026-07-05 06:14:54 +00:00
Maximilian Bosch 26bafa1f8d nixos/test-driver: deprecate shell_interact() (#535097) 2026-06-29 13:05:59 +00:00
Maximilian Bosch 5da4d05168 nixos/test-driver: keep nspawn notify socket drained after boot (#533429) 2026-06-29 10:33:21 +00:00
K900 caea65bc86 Merge remote-tracking branch 'origin/master' into staging-next 2026-06-27 17:13:58 +03:00
Maximilian Bosch 59249b1624 nixos/test-driver: show deprecation warnings in the REPL
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
2026-06-26 12:27:42 +02:00
Maximilian Bosch b9706678ac nixos/test-driver: deprecate shell_interact()
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.
2026-06-26 12:27:41 +02:00
Martin Weinelt 290af9f23f nixos/channel: apply reproducibility fixes from make-tarball.nix
These changes are ported from 72e89d7461, f7672530de and
e309661586.
2026-06-26 11:22:20 +02:00
Martin Weinelt 69353cef31 nixos/channel: add zstd flavored nixexprs tarball
This can significantly speed up consumption of nixexprs because zstd
decompress is generally 10x faster than xz.
2026-06-26 11:22:19 +02:00
Emily 77b50cc00f nixos/lib/qemu-common: drop x86_64-darwin support 2026-06-26 07:55:10 +01:00
Emily c11129861a nixos/testing: drop x86_64-darwin support 2026-06-26 07:55:10 +01:00
Maximilian Bosch 534768de33 nixos-test-driver: drop unneeded qemu dep (#523313) 2026-06-25 22:56:27 +00:00
cinereal be55bcfa50 nixos/test-driver: keep nspawn notify socket drained after boot
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
2026-06-25 23:38:28 +02:00
Arian van Putten 711b692108 nixos/virtualisation/nspawn-container: add virtualisation.credentials support (#535258) 2026-06-25 15:37:09 +00:00
Arian van Putten 612ff7f23c nixos/test-driver: support state_dir for container tests
Assisted-by: Claude <noreply@anthropic.com>
2026-06-25 13:44:57 +02:00
K900 dc0f4cd301 Merge remote-tracking branch 'origin/staging-next' into staging 2026-06-24 16:12:11 +03:00
Maximilian Bosch 1b9913d415 nixos/tests: Load root profile in nspawn tests (#534299) 2026-06-24 08:07:38 +00:00
Nina Fromm 0dc4ca4c71 nixos/tests: Load root profile in nspawn tests
This is currently a hacky workarround, but bettern than nothing until we come up
with a better solution.
2026-06-24 09:36:11 +02:00
K900 3aebc40624 nixos/test-driver: abort if we didn't connect to the backdoor in 5 minutes
This is a lot of minutes, but less than the 1 hour it would normally take
to time out the entire build.
2026-06-23 21:43:33 +03:00
Martin Weinelt be9a0ac992 nixos/test-driver: properly tokenize udev rule
When running a container test the udev linter complains, that tokens
should be separate by a comma followed by a space.
2026-06-20 20:19:18 +02:00
nixpkgs-ci[bot] 3a1e0e088b Merge staging-next into staging 2026-06-12 00:51:20 +00:00
Florian Klink ee1573e79c nixos/lib/utils: fix escapeSystemdPath for paths with "." segments (#529688) 2026-06-11 22:49:35 +00:00
r-vdp 68d32ed6cb vmTools: fix img collision with pkgs.img, add kernelModules arg
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.
2026-06-11 18:21:30 +03:00
Ilan Joselevich 8f68c76d48 nixos/lib/utils: fix escapeSystemdPath for paths with "." segments
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
2026-06-10 02:03:37 +03:00
nixpkgs-ci[bot] 94f781f42d Merge staging-next into staging 2026-06-09 13:02:07 +00:00
Arthur Gautier 648b2e9555 nixos/test-driver: add utils to manipulate efi variables (#456099) 2026-06-05 16:16:08 +00:00
Arthur Gautier 6aac77f21c nixos/test-driver: rework timeout for wait_for_console_text (#526952) 2026-06-05 16:15:50 +00:00
Doron Behar 48995a6ef9 nixos/virtualisation: (Aarch64) remove -device virtio-gpu-pci
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.
2026-06-03 13:50:32 +03:00
Arthur Gautier 4e5b779a75 nixos/test-driver: rework timeout for wait_for_console_text
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.
2026-06-01 19:12:06 -07:00
nixpkgs-ci[bot] a0ee92dfa2 Merge staging-next into staging 2026-06-02 00:49:58 +00:00
nixpkgs-ci[bot] 09c3691947 Merge master into staging-nixos 2026-06-01 19:40:02 +00:00
nixpkgs-ci[bot] d644c92282 Merge staging-next into staging 2026-06-01 19:39:24 +00:00
Arthur Gautier 956eb0479a nixos/test-driver: add utils to manipulate efi variables
```python
machine.create_efi_vars()
machine.write_efi_vars([
    EfiVariable(
        uuid.UUID("65a72bd9-f42b-4039-8084-66cd1702cb24"),
        "AbrNextBoot",
        b"a",
        flags=EfiVariable.Flags.NON_VOLATILE
    )
])

machine.start()
```
2026-05-30 22:22:03 -07:00
Philip Munksgaard 8e5d6f456d nixos/test-driver: add defaultText to pythonTestDriverPackage
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").
2026-05-29 11:17:25 +02:00
Florian Klink b62d8df99d nixos/systemd-lib: use structuredAttrs instead of passAsFile for makeUnit (#498934) 2026-05-28 13:55:04 +00:00
Benjamin Sparks e20cd6adb0 nixos-test-driver: adher to select's interface
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.
2026-05-28 00:01:49 +02:00
Jacek Galowicz cdb35b67b3 nixos-test-driver: drop unneeded qemu dep 2026-05-23 21:40:22 +02:00
nixpkgs-ci[bot] 567e4259e4 Merge master into staging-nixos 2026-05-22 12:51:42 +00:00
zowoq 9e0eff34c5 nixos/test-driver: change run name to distinguish between different kinds of tests
Co-Authored-By: Jeremy Fleischman <me@jfly.fyi>
2026-05-22 19:24:35 +10:00
Jeremy Fleischman b0ac1aa864 nixos/test-driver: remove redundant self.pid state from NspawnMachine
We can access it via `self.process`, and this avoids bugs where we
weren't keeping the 2 in sync.
2026-05-22 01:53:43 -07:00
Jeremy Fleischman 11855b765c nixos/test-driver: null out self.pid when shutting down the container
Without this, we end up with `self.pid` set to the pid of a dead
process, and `self.process == None`. This causes us to blow [this
assert](https://github.com/jfly/nixpkgs/blob/dd51e81af9226ee80e6f0891f4649e12ea15dfd0/nixos/lib/test-driver/src/test_driver/machine/__init__.py#L1496)
in `NspawnMachine.release`.

It would probably be cleaner to just get rid of `self.pid`. It's
redundant given that we have `self.process`. I'll do that in a followup
commit.

This was discovered here:
https://github.com/NixOS/nixpkgs/pull/522886#discussion_r3285395646, and
will be protected against future regression by a test introduced in that
PR.
2026-05-22 01:53:43 -07:00
nixpkgs-ci[bot] d7f7172553 Merge master into staging-nixos 2026-05-14 18:39:31 +00:00
Maximilian Bosch 9c752701c0 nixos/test-driver: fix eval with noUserModules (#518544) 2026-05-14 18:06:39 +00:00
Maximilian Bosch df044b3abd nixos/lib/make-{single,multi}-disk-zfs-image: use structuredAttrs instead of passAsFile (#515828) 2026-05-14 17:59:40 +00:00
Maximilian Bosch d25390cc3e nixos-test-driver: fix vlan/bridge cleanup (#515874) 2026-05-14 17:26:56 +00:00