1376 Commits

Author SHA1 Message Date
nixpkgs-ci[bot]
09c3691947 Merge master into staging-nixos 2026-06-01 19:40:02 +00: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
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 bcb6399e15.
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
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](dd51e81af9/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
Jared Baur
68e2e2bde3 nixos/test-driver: fix eval with noUserModules
When "non-user" modules are not placed in baseModules or
extraModules (arguments of eval-config.nix), noUserModules.evalModules
breaks if the options defined in those modules are consumed. In order
to restore noUserModules functionality for NixOS VM (and now nspawn)
tests, the modules implementing test behavior are moved to baseModules.
2026-05-09 18:31:52 -07:00
nixpkgs-ci[bot]
1debf4679f Merge master into staging-nixos 2026-05-04 18:34:56 +00:00
Robert Hensing
04b6aa5544 nixos/*: remove unused let bindings (#515686) 2026-05-04 13:12:07 +00:00
nixpkgs-ci[bot]
40cc662a5d Merge master into staging-nixos 2026-05-03 18:20:16 +00:00
Jacek Galowicz
948c5d0da2 nixos-test-driver: fix vlan/bridge cleanup 2026-05-03 17:45:52 +02:00
Maximilian Bosch
5342316c89 Nixos test driver: Use ty and ruff instead of mypy and pyflakes on test scripts (#509615) 2026-05-03 14:07:49 +00:00
Maximilian Bosch
3e075f434a nixos/lib/nixos-test-script-prepend: fix log definition
It's an instance of AbstractLogger, not a function.
2026-05-03 15:57:18 +02:00
Jacek Galowicz
5b78f85154 nixos-test-driver: don't make warnings in the linter errors at this
point
2026-05-02 15:40:03 +02:00
Jacek Galowicz
79100aff14 nixos/test-driver: fix duplicate names in type check
ignore the NixOS configuration's hostname and only use the test driver
attribute for the type hints. This allows for setting a different host
name than the node name in the test without trigggering type errors in
the typecheck phase.

co-authored-by: phanirithvij <phanirithvij2000@gmail.com>
2026-05-02 15:40:03 +02:00
Jacek Galowicz
392f3f8fc1 nixos-test-driver: Use ty anf ruff instead of mypy and pyflakes 2026-05-02 15:40:02 +02:00
Stefan Frijters
340a2d6969 nixos/lib/make-single-disk-zfs-image: use structuredAttrs instead of passAsFile 2026-05-02 14:23:04 +02:00
Stefan Frijters
90a2d70abe nixos/lib/make-multi-disk-zfs-image: use structuredAttrs instead of passAsFile 2026-05-02 14:22:47 +02:00
Jacek Galowicz
7a50142dfd nixos/test-driver: deprecate referring to the only node via variable machine (#511859) 2026-05-02 11:49:33 +00:00
Michael Daniels
2e87c2f8f4 nixos/*: remove unused let bindings
Generated using deadnix (with some manual work); split from #514611.
2026-05-01 20:39:14 -04:00
sternenseemann
222ed18540 nixos/lib/systemd-lib: make unitNameType work with e.g. Rust regex
The unitNameType regex currently makes the Tvix CI (and likely Snix
in the future) fail since "sysroot-nix-.ro\\x2dstore.mount" will
fail the check since it doesn't interpret the single backslash
as part of the bracket expression.

POSIX doesn't require escaping the backslash in bracket exprs:
> The special characters '.', '*', '[', and '\\' ( <period>, <asterisk>,
> <left-square-bracket>, and <backslash>, respectively) shall lose their
> special meaning within a bracket expression.

However, Rust uses the backslash for escaping in bracket exprs,
so it also needs to be escaped:
> [\[\]]        Escaping in character classes (matching [ or ])

Making the Regex work with both POSIX-like regexes and Rust's regex
syntax is possible in this case, so let's do it.
2026-05-01 18:09:28 +02:00
nixpkgs-ci[bot]
a1b94b7259 Merge master into staging-nixos 2026-04-26 18:16:37 +00:00
Florian Klink
af59f21843 nixos/systemd-networkd: add new options for v260 (#513521) 2026-04-26 12:26:37 +00:00
nixpkgs-ci[bot]
bc33d9febb Merge master into staging-nixos 2026-04-26 12:17:21 +00:00
Florian Klink
fbebe4cdf5 nixos/systemd-networkd: Allow three value variant in ipv6AcceptRAConfig.RouteMetric option (#507540) 2026-04-26 11:55:37 +00:00
x7c2d
12f553550f nixos/systemd-networkd: add new options for v260
systemd 260 introduces some new linkConfig options to configure ethernet
devices and a new [MobileNetwork] section (and options) to configure
cellular network connections using a new integration with ModemManager.

- https://github.com/systemd/systemd/releases/tag/v260
2026-04-26 00:06:57 +01:00
Maximilian Bosch
9b2a6da44f nixos-test-driver: don't assert on vhost_vsock (#512730) 2026-04-24 09:57:16 +00:00
nixpkgs-ci[bot]
6714212dd9 Merge master into staging-nixos 2026-04-23 18:26:38 +00:00
Vladimír Čunát
ea9c3ae589 nixos-test-driver: reduce unnecessary rebuilds for now 2026-04-23 14:43:46 +02:00
Jacek Galowicz
133e3555ff nixos-test-driver: only use sharedMemory qemu config setting on linux 2026-04-23 11:09:46 +01:00
Jacek Galowicz
6668b5b381 nixos-test-driver: use hostPkgs to write config files to store 2026-04-23 11:09:45 +01:00
Jacek Galowicz
6c0ab2edd5 nixos-test-driver: only depend on vsock things on linux 2026-04-23 11:09:45 +01:00
Jacek Galowicz
b35551e838 nixos-test-driver: don't assert on vhost_vsock as tests without VMs
would be just fine without it
2026-04-23 09:43:12 +00:00
Jacek Galowicz
50718e1e0c nixos/test-driver: fix driverInteractive test_script invocation (#511896) 2026-04-22 19:34:36 +00:00
Robert Hensing
b13c0022ba nixos-test-driver: Add extra required features (#511413) 2026-04-21 07:45:53 +00:00
Maximilian Bosch
9b42f787bb nixos/test-driver: fix driverInteractive test_script invocation
See https://github.com/NixOS/nixpkgs/pull/510385/changes/BASE..f1bcb61731224bd8440510fc620d3c51f3e51c85
2026-04-21 00:24:25 +02:00
Maximilian Bosch
4c907dbb68 Revert "nixos-test-driver: use info/error/debug log feature more"
This reverts commit a2ff6e406e.

Pushed by accident to staging-nixos: https://matrix.to/#/%21UNVBThoJtlIiVwiDjU%3Anixos.org/%24UUtlLXPAwZaoeDXDT0wHC1PRZIWVhRNNgyvkKTVRG24?via=nixos.org&via=matrix.org&via=tchncs.de
2026-04-20 22:11:01 +02:00
Jacek Galowicz
1ecef5cad6 nixos-test-driver: require "/dev/net" in tests that need containers 2026-04-20 18:35:34 +01:00
Maximilian Bosch
4797207171 nixos/test-driver: deprecate using machine variable when only VM has a different name
For backwards-compat reason it's legal to do

    runTest {
      nodes.foo = { /* ... */ };
      testScript = ''
        machine.start()
        # do your thing
      '';
    }

This makes several places in the codebase unnecessarily complex and is
something people shouldn't be using anyways. Additionally, I was
reminded by people that this can actually be confusing when you expect
the variable to be named differently.

Hence, deprecate this behavior and kill it in a few releases down the
road.
2026-04-19 20:01:32 +02:00
Jacek Galowicz
a2ff6e406e nixos-test-driver: use info/error/debug log feature more 2026-04-19 18:02:46 +01:00
Maximilian Bosch
f3b69f2a71 nixos/test-driver: colorized warnings 2026-04-19 12:17:18 +02:00
Michael Daniels
ece6acc1e3 nixos-test-driver: fix handling of type-check-disabled case
f1bcb61731 did not handle this correctly,
causing failures (e.g. https://hydra.nixos.org/build/326659503/nixlog/2/tail)
2026-04-18 16:18:17 -04:00
Jacek Galowicz
f1bcb61731 nixos-test-driver: use configuration file instead of scattered env vars 2026-04-17 14:55:56 +01:00
Jacek Galowicz
b998b489db nixos-test-driver: don't prepare sandbox environemnt outside of sandbox. (#510559) 2026-04-17 13:00:19 +00:00
Jacek Galowicz
b55b2eff0f nixos/test-driver: add remaining tests to passthru.tests (#510699) 2026-04-17 11:59:11 +00:00