Commit graph

96 commits

Author SHA1 Message Date
Wolfgang Walther f2640ee208
top-level: return __splicedPackages 2025-10-31 20:34:05 +01:00
Wolfgang Walther 91a8fee3aa
treewide: remove redundant parentheses
Auto-fixed by nixf-diagnose.
2025-10-05 10:52:03 +02:00
Wolfgang Walther 535b720589
Merge branch 'master' into staging-next 2025-07-24 14:27:50 +02:00
Wolfgang Walther 5a0711127c
treewide: run nixfmt 1.0.0 2025-07-24 13:55:40 +02:00
Martin Weinelt f5a40e1102 nixos/testing: fix pyflakes builtins with bash 5.3p0
Printing the file contents with `< file` does not seem to work anymore.
2025-07-23 13:13:55 +02:00
Maximilian Bosch b4b7218254
nixos/testing: enable ssh backdoor by default if debug hook is enabled
You usually want both, so it makes sense to have the former imply the
latter. If this is not desired, it can still be modified within a test.
2025-07-18 17:39:03 +02:00
Jacek Galowicz d6b326d659
test-driver: Implement debugging breakpoint hooks
Co-authored-by: Maximilian Bosch <maximilian@mbosch.me>
2025-07-18 17:39:01 +02:00
Robert Hensing 0e32661202 nixos/testing: Add test attribute to please discoverTests 2025-07-07 22:23:55 +02:00
Robert Hensing 7845abc842
NixOS test framework: add overriding methods (#421480) 2025-07-06 13:40:24 +02:00
Robert Hensing f2b3aeb383 nixos.runTest: Add extendNixOS 2025-07-06 13:39:15 +02:00
Robert Hensing 63e2606ddf nixos.runTest: Add extend, overrideTestDerivation 2025-07-06 13:39:15 +02:00
John Titor c87464cb0c
Revert "treewide: migrate nixos modules to networking.hosts"
This reverts commit cd64f1bd87.
2025-06-09 00:10:05 +05:30
John Titor 7c873c2d00
Revert "nixos/lib/testing: fix network module"
This reverts commit 35fb55d21b.
2025-06-08 23:54:55 +05:30
John Titor 4a842aed37 nixos/lib/testing: fix network module
This fixes acme tests.

Signed-off-by: John Titor <50095635+JohnRTitor@users.noreply.github.com>
2025-06-08 16:12:54 +05:30
John Titor cd64f1bd87 treewide: migrate nixos modules to networking.hosts
Signed-off-by: John Titor <50095635+JohnRTitor@users.noreply.github.com>
2025-06-07 23:09:46 +05:30
Peder Bergebakken Sundt c77ac9dfc3 treewide: fix typos 2025-06-02 16:07:07 +02:00
Robert Hensing eed414caf1
Fix running NixOS tests on darwin (#405599) 2025-05-15 09:47:30 +02:00
Maximilian Bosch c6978e8a58
nixos/test-driver: exit early if /dev/vhost-vsock isn't available
Right now it wrongly seems as if you can set
`sshBackdoor.enable = true;` for each test and not only for debugging
purposes.

This is wrong however since you'd need to pass /dev/vhost-vsock into the
sandbox for this (which is also a prerequisite for #392117).

To make that clear, two things were changed:

* add a warning to the manual to communicate this.
* exit both interactive and non-interactive driver early if
  /dev/vhost-vsock is missing and the ssh backdoor is enabled.

  If that's the case, we pass a CLI flag to the driver already in the
  interactive case. This change also sets the flag for the
  non-interactive case.

  That way we also get a better error if somebody tries to enable this
  on a system that doesn't support that.
2025-05-13 11:14:13 +02:00
Maximilian Bosch b8b86834b7
nixos/test-driver: move sshBackdoor cfg from test-instrumentation to driver
That way, we don't need to duplicate the sshBackdoor options on NixOS-level.

Suggested-by: Jacek Galowicz <jacek@galowicz.de>
2025-05-10 10:40:35 +02:00
Maximilian Bosch 12c544e008
nixos/testing: improve wording of vsockOffset description
Co-authored-by: Jacek Galowicz <jacek@galowicz.de>
2025-05-10 10:28:44 +02:00
Robert Hensing ee83bfa879 nixos/testing: Drop darwin from default hydraPlatforms
Litmus test: the following attribute disappears

    nix eval -f pkgs/top-level/release.nix tests.testers.nixosTest-example.x86_64-darwin.outPath
2025-05-09 19:25:46 +02:00
Robert Hensing 0433bf6a90 nixos/testing/meta.nix: lib.mkOption -> mkOption 2025-05-09 16:27:05 +02:00
Robert Hensing 51d915e451 nixos/testing: Add meta.hydraPlatforms 2025-05-09 16:27:05 +02:00
Robert Hensing 18e2327aa7 Revert "nixos/lib/testing: avoid generating darwin VM tests"
This reverts commit 72155225aa.
2025-05-09 16:00:18 +02:00
Maximilian Bosch a9adfc631a
nixos/test-driver: allow assigning other vsock number ranges
I'm a little annoyed at myself that I only realized this _after_ #392030
got merged. But I realized that if something else is using AF_VSOCK or
you simply have another interactive test running (e.g. by another user
on a larger builder), starting up VMs in the driver fails with

    qemu-system-x86_64: -device vhost-vsock-pci,guest-cid=3: vhost-vsock: unable to set guest cid: Address already in use

Multi-user setups are broken anyways because you usually don't have
permissions to remove the VM state from another user and thus starting
the driver fails with

    PermissionError: [Errno 13] Permission denied: PosixPath('/tmp/vm-state-machine')

but this is something you can work around at least.

I was considering to generate random offsets, but that's not feasible
given we need to know the numbers at eval time to inject them into the
QEMU args. Also, while we could do this via the test-driver, we should
also probe if the vsock numbers are unused making the code even more
complex for a use-case I consider rather uncommon.

Hence the solution is to do

    sshBackdoor.vsockOffset = 23542;

when encountering conflicts.
2025-05-09 11:54:00 +02:00
Jacek Galowicz 8b3baa1402
nixos/test-driver: add backdoor based on systemd-ssh-proxy & AF_VSOCK (#392030) 2025-05-09 08:03:55 +02:00
Maximilian Bosch 8869265f93
nixos/test-driver: printout instructions on how to connect via AF_VSOCK 2025-05-08 10:51:39 +02:00
Vladimír Čunát 1a41b5c78e
nixos/lib/testing: avoid generating darwin VM tests (#393977) 2025-04-27 09:29:26 +02:00
Maximilian Bosch b1394ba443
nixos/test-driver: improve wording of the enable option of SSH backdoor
Co-authored-by: Ryan Lahfa <masterancpp@gmail.com>
2025-04-26 12:20:10 +02:00
Maximilian Bosch 1bd8073958
nixos/test-driver: add backdoor based on systemd-ssh-proxy & AF_VSOCK
With this it's possible to trivially SSH into running machines from the
test-driver. This is especially useful when running VM tests
interactively on a remote system.

This is based on `systemd-ssh-proxy(1)`, so there's no need to configure
any additional networking on the host-side.

Suggested-by: Ryan Lahfa <masterancpp@gmail.com>
2025-04-26 11:35:47 +02:00
Silvan Mosberger 374e6bcc40 treewide: Format all Nix files
Format all Nix files using the officially approved formatter,
making the CI check introduced in the previous commit succeed:

  nix-build ci -A fmt.check

This is the next step of the of the [implementation](https://github.com/NixOS/nixfmt/issues/153)
of the accepted [RFC 166](https://github.com/NixOS/rfcs/pull/166).

This commit will lead to merge conflicts for a number of PRs,
up to an estimated ~1100 (~33%) among the PRs with activity in the past 2
months, but that should be lower than what it would be without the previous
[partial treewide format](https://github.com/NixOS/nixpkgs/pull/322537).

Merge conflicts caused by this commit can now automatically be resolved while rebasing using the
[auto-rebase script](8616af08d9/maintainers/scripts/auto-rebase).

If you run into any problems regarding any of this, please reach out to the
[formatting team](https://nixos.org/community/teams/formatting/) by
pinging @NixOS/nix-formatting.
2025-04-01 20:10:43 +02:00
Vladimír Čunát 72155225aa
nixos/lib/testing: avoid generating darwin VM tests
We're getting 2x5 darwin VM jobs that aren't schedulable
on our current Hydra.nixos.org, which makes them hang around
and delay advancing of all `nixpkgs-*` channels.
To me that's quite an annoying effect, as it can be like an extra day
of additional delay without any benefit that I can really perceive.
(unless someone like me keeps manually cancelling the jobs all the time)
2025-03-29 19:32:31 +01:00
Silvan Mosberger 4f0dadbf38 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-build a08b3a4d19.tar.gz \
      --argstr baseRev b32a094368
    result/bin/apply-formatting $NIXPKGS_PATH
2024-12-10 20:26:33 +01:00
Will Fancher 37ee6ba681 Revert "NixOS apply script"
Reverts #344407

This has broken nixos-rebuild switch so that it no longer updates the profile, which has bad consequences including not updating the systemd-boot menu with new generations.
2024-11-01 20:18:09 -04:00
Robert Hensing 7902cea1de nixos: Update documentation to refer to bin/apply 2024-10-30 00:21:21 +01:00
Sandro Jäckel 729a6f3bd7
nixos/lib/testing: remove alias usage 2024-10-26 14:30:45 +02:00
Robert Hensing 729225e355 treewide: lib.isInOldestRelease -> lib.oldestSupportedReleaseIsAtLeast 2024-10-08 11:14:24 +02:00
K900 2bc5aac960 nixos/lib/testing: enable stc by default for installBootLoader VMs 2024-09-12 15:44:02 +03:00
K900 4cfbbb3c1d nixos/tests: don't include switch-to-configuration in DUT by default 2024-09-08 17:04:44 +03:00
Frédéric Christ c6f6c28218 nixos/testing: Add ipv6 configuration
This contribution enables a working IPv6 setup by default. This works
analog to the current automatic IPv4 setup.
2024-07-18 10:22:32 +02:00
Donovan Glover 4afa9444ae
nixos/testing: fix markdown link in enableOCR description 2024-05-14 21:22:09 -04:00
Jacek Galowicz 8d3a38e8b1 NixOS Integration tests: Re-enable for macOS 2024-04-12 13:41:27 +02:00
Cole Helbling dbc967d14d Revert "NixOS Integration Tests: Enable again for darwin" 2024-04-10 12:52:12 -07:00
Jacek Galowicz e4bf075cff NixOS Integration Tests: Enable again for darwin 2024-04-10 17:59:11 +02:00
K900 7b602cff5c nixos/tests/installer: avoid create_machine, clean up
- use normal VM nodes for target, with some extra trickery
- rename preBootCommands to postBootCommands to match its actual intent
- rename VMs to installer and target, so they're not all called machine
- set platforms on non-UEFI tests properly
- add missing packages for systemd-boot test
- fix initrd secrets leaking into the store and having wrong paths
2024-04-03 16:16:11 +03:00
Philip Taron ebde306504
nixos/lib, doc: remove references to mdDoc (#300738)
* doc: remove references to mdDoc in nixos/doc/manual/development/option-declarations.section.md

* nixos/lib: remove mdDoc in nixos/lib/make-options-doc/default.nix

* nixos/lib: remove mdDoc in nixos/lib/systemd-types.nix

* nixos/lib: remove mdDoc in nixos/lib/systemd-unit-options.nix

* nixos/lib: remove mdDoc in nixos/lib/testing/driver.nix

* nixos/lib: remove mdDoc in nixos/lib/testing/interactive.nix

* nixos/lib: remove mdDoc in nixos/lib/testing/meta.nix

* nixos/lib: remove mdDoc in nixos/lib/testing/name.nix

* nixos/lib: remove mdDoc in nixos/lib/testing/network.nix

* nixos/lib: remove mdDoc in nixos/lib/testing/nodes.nix

* nixos/lib: remove mdDoc in nixos/lib/testing/run.nix

* nixos/lib: remove mdDoc in nixos/lib/testing/testScript.nix
2024-04-01 16:58:23 -07:00
Gabriella Gonzalez b8698cd8d6
macOS support for NixOS tests (#282401)
Closes #193336
Closes #261694
Related to #108984

The goal here was to get the following flake to build and run on
`aarch64-darwin`:

```nix
{ inputs.nixpkgs.url = <this branch>;

  outputs = { nixpkgs, ... }: {
    checks.aarch64-darwin.default =
      nixpkgs.legacyPackages.aarch64-darwin.nixosTest {
        name = "test";

        nodes.machine = { };

        testScript = "";
      };
  };
}
```

… and after this change it does.  There's no longer a need for the
user to set `nodes.*.nixpkgs.pkgs` or
`nodes.*.virtualisation.host.pkgs` as the correct values are inferred
from the host system.
2024-03-02 06:33:14 +01:00
K900 d93db9066a nixos/lib/testing: remove yet another source of unnecessary test rebuilds 2024-02-27 23:35:05 +03:00
K900 bde7471aa2 nixos/lib/testing: remove another source of unnecessary test rebuilds 2024-02-27 18:00:58 +03:00
Robert Hensing ae5cb919f5 nixos/testing/nodes: Do allow aliases
Aliases exist for a reason. Sure it is nice to make sure that
some aliases aren't used within Nixpkgs, but this creates two problems
which are far worse than your failing to meet your neatness compulsions.

- Users encounter missing attributes, https://github.com/NixOS/nixpkgs/issues/264577
  wasting their time, stalling their progress, and even occupying others
  time that would be better spent on fixing *real* issues.

- Hydra doesn't treat evaluation errors seriously enough, with the
  effect that actual relevant test failures are masked by evaluation
  failures such as those caused by this no aliases business.

- We don't even have the infrastructure to get rid of aliases, because
  all warnings in package attributes are disallowed by Nixpkgs CI
  tooling, last I checked.

Before re-disabling this, make sure that

- An actually helpful deprecation process is in place.

- Aliases are still allowed when `nixos-lib.runTests` and
  `pkgs.testers.runNixOSTest` are invoked by external projects.
  For instance, `all-tests.nix` could provide such an
  override (e.g. with `newScope`).
2023-11-06 12:30:28 +01:00