Commit Graph

1055 Commits

Author SHA1 Message Date
Silvan Mosberger
b3ad661e9f nixos/lib/test-driver: Prevent unnecessary rebuilds
E.g. when only Nix files change
2024-06-14 20:42:16 +02:00
Jared Baur
b867cc215f
nixos/systemd-networkd: add PREF64 related options 2024-06-09 20:41:32 -07:00
Martin Weinelt
ab897a8c62
nixos/test-driver: fix return value of subtest function
Mypy since version 1.10.0 complains about this:

> test_driver/driver.py:109: error: No return value expected  [return-value]
2024-06-06 01:07:39 +02:00
Franz Pletz
4e1b4397d9
Merge pull request #312472 from Ma27/networkd-option-rename
nixos/networkd: get rid of *Config attributes in lists
2024-05-30 04:06:01 +02:00
Gaetan Lepage
622ccf42c2 nixosTests.nixos-test-driver: fix ruff check 2024-05-23 14:30:23 +02:00
Dawid Dziurla
f8a88fd22c
nixos/test-driver: adjust to ruff changes 2024-05-22 11:29:02 +02:00
nikstur
cf1909ddd0
Merge pull request #301772 from hertrste/junit-xml-prod
nixos/test-driver: Add Junit XML report creation
2024-05-21 15:07:10 +02:00
Maximilian Bosch
c4fd7cf16d
nixos/networkd: get rid of *Config attributes in lists
This patch is about removing `wireguardPeerConfig`,
`dhcpServerStaticLeaseConfig` - a.k.a. the
AbstractSingletonProxyFactoryBean of nixpkgs - and friends.

As a former colleague said

> worst abstraction ever

I second that. I've written enough networkd config for NixOS systems so
far to have a strong dislike. In fact, these don't even make sense:
`netdevs.wireguardPeers._.wireguardPeerConfig` will be rendered into
the key `[WireGuardPeer]` and every key from `wireguardPeerConfig` is in
there. Since it's INI, there's no place where sections on the same level
as wireguardPeerConfig fit into. Hence, get rid of it all.

For the transition, using the old way is still allowed, but gives a
warning. I think we could drop this after one release.

The tests of rosenpass and systemd-networkd-dhcpserver-static-leases
were broken on the rev before, hence they were updated, but are still
not building.
2024-05-20 17:26:42 +02:00
Donovan Glover
4afa9444ae
nixos/testing: fix markdown link in enableOCR description 2024-05-14 21:22:09 -04:00
Stefan Hertrampf
d07866cddc nixos/test-driver: rm global logger
We remove the global rootlog in favor of instantiating the logger as
required in the __init__.py and pass it down as a parameter (of our
AbstractLogger type).
2024-05-07 15:17:17 +02:00
Stefan Hertrampf
303618c7e1 nixos/test-driver: enable XML log selectively
Previously, the XML logging was always present and only created an
output file if a special environment variable was present. We now only
create the XML logger if the environment variable is present, saving us
from logging to XML internally if it is not required.
2024-05-07 15:17:17 +02:00
Stefan Hertrampf
9e8d6bbe24 nixos/test-driver: add junit-xml logger
We add a new logger that allows generating a junit-xml compatible report
listing the subtests used in the nixos integration test. Junit-xml is a
widely used standard for test reports. The report can be used for quick
evaluation of which subtest failed.
2024-05-07 15:17:16 +02:00
Stefan Hertrampf
9d90df51a9 nixos/test-driver: Separate XML and Terminal log
We use the newly AbstractLogger class and separate the XML and Terminal
logging that is currently mixed into one class. We restore the old
behavior by introducing a CompositeLogger that takes care of logging
both to terminal and XML.
2024-05-07 15:17:16 +02:00
Stefan Hertrampf
b505db6f6d nixos/test-driver: add AbstractLogger interface 2024-05-07 15:17:15 +02:00
Jared Baur
38907ef84d
nixos/systemd-lib: fix assertRangeOrOneOf when value is not comparable
We cannot compare non-numerical values to a min or max value in a range.
2024-05-06 10:41:20 -07:00
stove
a7931adab8 nixos/lib/qemu-common: add riscv{32,64}-linux to qemu guest matrix 2024-04-29 14:05:39 +02:00
Florian Klink
5a2d4496d3
Merge pull request #297726 from r-vdp/systemd-unit-names
systemd: add a name option to all systemd units
2024-04-23 12:58:51 +03:00
Stefan Hertrampf
a6160e5763 nixos/test-driver: use function instead of var
Use a proper function to enable serial log printing instead of setting
class member variables directly.
2024-04-22 13:35:25 +02:00
Stefan Hertrampf
c2c525f5bc nixos/test-driver: add junit-xml python package 2024-04-22 13:35:24 +02:00
Stefan Hertrampf
0d015895de nixos/test-driver: separate the subtest log call
We do not use the generic "nested" function but introduce a separate
subtest log call. This will later allow us to track subtests and account
logs to specific subtests.
2024-04-22 13:35:24 +02:00
Ryan Hendrickson
61153af068
Merge pull request #298983 from illustris/mysql
nixos/systemd-lib: fix restart/reloadTriggers when passing paths
2024-04-21 17:45:16 -04:00
illustris
4a9c962aca
nixos/systemd-lib: fix restart/reloadTriggers when passing paths
When passing a path to restartTriggers or reloadTriggers, X-Restart/Reload-Triggers
will get populated by the absolute path of the file on the machine where the
config is evaluated. This patch corrects this behavior.
2024-04-21 09:40:17 +05:30
r-vdp
9258f57625
systemd: add a name option to all systemd units
This allows us to set things like dependencies in a way that we can
catch typos at eval time.
So instead of
```nix
systemd.services.foo.wants = [ "bar.service" ];
```
we can write
```nix
systemd.services.foo.wants = [ config.systemd.services.bar.name ];
```
which will throw an error if no such service has been defined.

Not all cases can be done like this (eg template services), but in a lot
of cases this will allow to avoid typos.

There is a matching option on the unit option
(`systemd.units."foo.service".name`) as well.
2024-04-15 11:32:45 +02:00
Astrid Yu
ed854ed0e3 nixos/networkd: add [Bridge] section to netdev conf
This setting was missing from netdev.

This commit additionally adds a test using the new
section, ensuring that STP can be enabled.
2024-04-14 15:16:44 -07: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
nikstur
80cafa6a29
Merge pull request #302590 from nikstur/repart-image-label-length
nixos/image/repart: assert maximum label length
2024-04-08 18:48:53 +02:00
nikstur
4c397ea6de systemd-lib: include GPTMaxLabelLength constant 2024-04-08 16:42:25 +02:00
Jacek Galowicz
aaef13b238
Merge pull request #301799 from alyssais/QEMU_OPTS
nixos/test-driver: don't add QEMU_OPTS twice
2024-04-05 14:56:09 +02:00
Alyssa Ross
4491b9ec0d
nixos/test-driver: don't add QEMU_OPTS twice
As the TODO says, this is already included by the script.

If adding a device, including this again here would result in either
two devices being added, or, if they were explicitly named, an error
due to reuse of the name.
2024-04-05 12:30:36 +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
Florian Klink
27968a064c
Merge pull request #299652 from philiptaron/issue-208242/nixos/lib/systemd
Avoid top-level `with ...;` in `nixos/lib/systemd*`
2024-04-01 17:19:15 +02:00
Silvan Mosberger
1f7ac8f58b
Merge pull request #296384 from pennae/remove-docbook-docs-support
nixos/docs: remove docbook support machinery
2024-03-28 18:03:31 +01:00
pennae
02aff756c3 nixos/doc: remove optionsDocBook
these were deprecated in 23.11 and slated for removal in 24.05. 24.05 is
soon enough, so we should probably make good on this promise.
2024-03-28 17:21:37 +01:00
Philip Taron
546fc67242
Avoid top-level with ...; in nixos/lib/utils.nix 2024-03-27 22:04:17 -07:00
Philip Taron
ad920b32c2
Avoid top-level with ...; in nixos/lib/systemd-unit-options.nix 2024-03-27 22:00:34 -07:00
Philip Taron
7d130cf752
Avoid top-level with ...; in nixos/lib/systemd-types.nix 2024-03-27 21:56:52 -07:00
Philip Taron
d509d28475
Avoid top-level with ...; in nixos/lib/systemd-network-units.nix 2024-03-27 21:43:22 -07:00
Philip Taron
f290c5901b
Avoid top-level with ...; in nixos/lib/systemd-lib.nix 2024-03-27 21:42:17 -07:00
Will Fancher
7935db1456 nixos/tests: Remove unnecesary wait from initrdBackdoor 2024-03-26 23:40:05 -04:00
Martin Weinelt
a4b6e457b8
nixos/lib: Support derivations in escapeSystemdExecArg
They can be transformed into their outpath string, which is useful for
config generators.
2024-03-23 15:59:50 +01:00
Johannes Kirschbauer
9a21db7be8
doc: write improved documentation for nixosOptionsDoc (#295279)
* doc: write improved documentation for nixosOptionsDoc

* Apply suggestions from @infinisil

Co-authored-by: Silvan Mosberger <github@infinisil.com>

* doc: minor fixup

---------

Co-authored-by: Silvan Mosberger <github@infinisil.com>
2024-03-21 16:07:18 +01:00
Will Fancher
486e837cbe
Merge pull request #293710 from B4dM4n/networkd-policy-rule-port-range
nixos/networkd: allow RoutingPolicyRule port ranges
2024-03-17 12:36:30 -07:00
K900
77536af43b nixos/iso-image: extremely cursed performance optimization for Hydra
Right now the worst case chain of events for building an ISO on Hydra is

    - copy everything to squashfs builder
    - run squashfs builder
    - download squashfs from builder
    - compress squashfs
    - upload squashfs to S3
    - copy squashfs to ISO builder
    - run ISO builder
    - download ISO from builder
    - compress ISO
    - upload ISO to S3

This inlines the squashfs build into the ISO build, which makes it

    - copy everything to ISO builder
    - run ISO builder
    - download ISO from builder
    - compress ISO
    - upload ISO to S3

Which should reduce queue runner load by $alot per ISO, which we have four of on small channels
(one release, one test per arch) and a lot more than four of on large channels (with various desktops)
2024-03-12 15:41:59 +03:00
K900
7764fc5335 nixos/lib/test-driver: fix mypy errors after staging-next merge 2024-03-08 15:33:48 +03:00
Fabian Möller
f753e58e6e
nixos/networkd: allow RoutingPolicyRule port ranges
Linux and Systemd allow port ranges to be used in routing policy rules.

https://www.freedesktop.org/software/systemd/man/latest/systemd.network.html#SourcePort=
2024-03-06 09:11:54 +01: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
Arian van Putten
b75a29cb6c nixos/lib/make-disk-image.nix: fix systemd-boot-builder clobbering /homeless-shelter
systemd-boot-builder.py calls nix-env --list-generations which creates
$HOME/.nix-defexpr/channels/nixos if it doesn't exist. This would cause a folder
/homeless-shelter to show up in the final image which in turn breaks nix builds
in the target image if sandboxing is turned off (as /homeless-shelter is never
allowed to exist).
2024-03-01 12:52:48 +01:00