35 Commits
Author SHA1 Message Date
Pol Dellaiera be36232d8a nixos/rnsd: init 2026-07-24 17:48:55 +02:00
rnhmjoj 13f0bd5f92 Revert "Revert #481473 "nixos/network-interfaces: remove network-setup""
This reverts commit 85a509502d.
2026-05-01 22:56:25 +02:00
Will Fancher 85a509502d Revert #481473 "nixos/network-interfaces: remove network-setup"
Reverts #481473, fixes #509254

Turns out this breaks scripted networking with systemd stage 1. Even
if we assumed that systemd stage 1 wasn't now the default, I still
think that makes this worthy of a revert, in the absence of a fix. But
now that systemd stage 1 is the default, this is also a channel
blocker.

The problem is that wantedBy = [ "foo.device" ]; doesn't work as
hoped. If the device appears in stage 1, then the systemd device unit
becomes active in stage 1 without pulling in any dependency for
configuring it (because that only exists in stage 2). When we
transition to stage 2, systemd maintains its information about unit
state between stages and remembers that the device units were already
active. They do not become reactivated, and consequently their new
stage 2 dependencies do not get pulled in.

The fix is probably to do this with SYSTEMD_WANTS= in udev rules,
rather than with wantedBy. The udev rules will re-fire during stage 2,
though I'm not 100% clear on exactly which events that includes
(e.g. if we'll get new add events or if we need to look for a
different ACTION or anything like that). This is going to require some
experimentation and testing that I don't have time for today.

Given that this is addressing a channel blocker, I think this revert
should be merged if a fix can't be merged instead before the next
unstable-small eval. In either case, staging-nixos should be merged to
master right after.
2026-04-12 17:03:36 -04:00
rnhmjoj 355908755a nixos/network-interfaces: remove network-setup
This change solves some big design flaws in the scripted networking
backend.

1. When the module was reworked in 072c1dcc4a to use the new systemd
  targets, network-setup.service was used to:

  a. order the services and link network.target to the boot sequence

  b. perform some perform final network configuration, specifically
     setting the default gateways and nameservers (/etc/resolv.conf).

  Later (ec00b4bb11) however, network-setup.service was made
  optional: if resolvconf is not used and a default gateway is not set,
  the service is not be defined (because it would result in an empty
  script). Doing so, however, has the unintended effect of unlinking
  network.target from multi-uset.target, meaning no network
  configuration at all is performed.

  Note: this can be easily seen by adding `networking.resolvconf.enable
  = false` to the nixosTests.networking.scripted.static test.

2. The network-addresses-*.service are linked to network.target, which,
   in turn, is linked to multi-uset.target. This means that if a
   hardware interface is not found, the boot will hang until this
   service times out (issue #154737).

To solve issue 1. this change removes network-target entirely while

  - moving the default gateway setup into the relative
    network-addresses-*.service unit;

  - moving the nameservers setup into networking.localCommands;
    (incidentally, this also fixes issue #445496)

  - directly linking network.target to multi-user.target.

To solve issue 2. this removes the Wants=network.target dependency of
network-addresses-*.service and solely relies on the underlying
interface unit (*-netdev.service for virtual, *.device for physical) to
start the service.

Note: for NixOS containers, the dependency is kept, because the .device
unit are not available in this case.

Finally, if an interface is the default gateway, network-online.target
is added as an extra dependency, so the target is not reached until the
interface has been plugged in and configured.
2026-03-14 18:11:31 +01:00
Svenum 40b42e9f70 nixos/network-interfaces: Add iplvan support 2026-02-27 09:17:46 +01:00
Maximilian Güntner 7fdbf426c3 nixos/tests/networking: add eap tests 2026-01-30 11:57:00 +01:00
Michele Guerini RoccoandGitHub 3b68917c9f nixos/network-interfaces: allow setting virtualOwner to null (#479944) 2026-01-15 22:07:44 +00:00
NAHO a2ed7e8d88 nixos: remove optional builtins prefixes from prelude functions
Remove optional builtins prefixes from prelude functions by running:

    builtins=(
      abort
      baseNameOf
      break
      derivation
      derivationStrict
      dirOf
      false
      fetchGit
      fetchMercurial
      fetchTarball
      fetchTree
      fromTOML
      import
      isNull
      map
      null
      placeholder
      removeAttrs
      scopedImport
      throw
      toString
      true
    )

    fd \
      --exclude doc/manual/release-notes \
      --type file \
      . \
      nixos \
      --exec-batch sed --in-place --regexp-extended "
        s/\<builtins\.($(
          printf '%s\n' "${builtins[@]}" |
            paste --delimiter '|' --serial -
        ))\>/\1/g
      "

    nix fmt
2026-01-15 16:07:55 +01:00
Lin Jian 17256403d0 nixos/network-interfaces: allow setting virtualOwner to null
null will not set owner, allowing any user to access the virtual
device.  Previously, this behavior can be achieved by using
systemd.network.netdevs.* options direcly and leaving
systemd.network.netdevs.<name>.tapConfig.User unset.  With this patch,
this behavior can be achieved using the generic
networking.interfaces.* options by setting
networking.interfaces.<name>.virtualOwner to null.

If needed, we can change the default value from "root" to null in the
future to be consistent with systemd-networkd's default behavior.
2026-01-15 20:55:30 +08:00
Philip Taron 9d6ee21262 nixos: pass stdenv into qemu-common
We also don't export it from `vmTools` anymore.
2026-01-05 09:57:13 -08:00
Pol Dellaiera 016fb4b018 nixos/meshtasticd: init 2025-12-09 08:12:20 +01:00
Wolfgang Walther 5a0711127c treewide: run nixfmt 1.0.0 2025-07-24 13:55:40 +02:00
rnhmjoj 632c8f720e nixos/tests/networking: add rnhmjoj as maintainer 2025-07-11 09:44:49 +02:00
rnhmjoj 4e5205a68a nixos/networking-interfaces: add IPIP tunnels 2025-07-11 09:44:49 +02:00
rnhmjoj 1c5b9429ea nixos/tests/networking: test both 6in4 and UDP-encapsulated tunnels 2025-07-11 09:44:48 +02:00
rnhmjoj 1a8c90128b nixos/network-interfaces: add option to set source address 2025-07-11 09:44:48 +02:00
Martin WeineltandK900 b9559be8c4 nixos/tests/livekit: test local ingress service integration 2025-06-23 18:35:25 +03:00
rnhmjoj 54a6949722 nixos/tests/networking: test hostname via DHCP 2025-05-05 21:59:33 +02:00
Henry-Hiles c8f4df349c livekit: add test 2025-04-29 01:02:53 -04: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](https://github.com/NixOS/nixpkgs/tree/8616af08d915377bd930395f3b700a0e93d08728/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
Jared Baur f38d462b9b nixosTests.networking.networkd.bond: fix flakiness
We need to do the virtio link setup prior to `network.target`, since
systemd-networkd orders itself before `network.target`. So in order for
the bond to properly enslave the two virtio links, they should be
configured as a part of `network-pre.target`.
2025-01-31 18:54:59 -08:00
K900 441c242855 nixos/tests: fix bonding test 2025-01-21 13:44:36 +03:00
rnhmjoj a00e827110 nixos/tests/networkmanager: test NM is started at boot 2024-12-28 12:11:01 +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 https://github.com/infinisil/treewide-nixpkgs-reformat-script/archive/a08b3a4d199c6124ac5b36a889d9099b4383463f.tar.gz \
      --argstr baseRev b32a094368
    result/bin/apply-formatting $NIXPKGS_PATH
2024-12-10 20:26:33 +01:00
misuzu 92df50f4d0 nixos/tests/networking: fix flaky scripted.dhcpSimple test
The underlying issue is unknown, but starting
the router first and then the client makes the test not flaky.
2024-12-04 20:18:46 +02:00
Egor Savkin 8bda6ea01c tests: network: update nixosTests.networking.scripted.virtual to match correct behavior
First, `stop network-addresses-X` should clean up the addresses without deleting the interfaces. And only `stop tap0-netdev` should fully delete the interfaces.

Signed-off-by: Egor Savkin <es@m-labs.hk>
2024-12-02 10:57:42 +08:00
rnhmjoj 9cb83c2af4 nixos/tests/networking: fix GRE test
More fallout from c6f6c282.
2024-11-30 09:51:44 +01:00
rnhmjoj 127dcca388 nixos/tests/networking: test nameservers via DHCP 2024-10-15 11:53:05 +02:00
Vladimír Čunát a3c0b3b215 Revert "nixos/tests/networking: test nameservers via DHCP"
This reverts commit bad5251e87.

https://github.com/NixOS/nixpkgs/pull/348305#issuecomment-2410165312
Should've known that commit starting with `bad` will be no good.
Fixes nixosTests.networking.networkd.dhcpSimple
https://hydra.nixos.org/build/274843085/nixlog/8/tail
2024-10-14 08:48:30 +02:00
rnhmjoj bad5251e87 nixos/tests/networking: test nameservers via DHCP 2024-09-16 08:07:55 +02:00
Jörg Thalheimandaleksana 5356420466 treewide: remove unused with statements from maintainer lists
$ find -type f -name '*.nix' -print0 | xargs -P "$(nproc)" -0 sed -i \
  -e 's!with lib.maintainers; \[ *\];![ ];!' \
  -e 's!with maintainers; \[ *\];![ ];!'
2024-07-29 10:06:20 +08:00
Janik H.andYaya 76cd1d2211 maintainers: drop janik
I guess my time has come as well...

With this commit, I'm not just dropping my maintainer entry, but I'm also
resigning from my duties as a board observer and NixCon project lead.
I also terminated my Summer of Nix contract today.
I'll also stop hosting the local NixOS meetup.

The only "project" I'll finish under the NixOS Foundation umbrella is
Google Summer of Code because the mentees aren't even remotely
responsible for why I'm leaving, and it would be unfair to leave them
hanging.

I'm grateful for all the things I was able to learn, for all the experiences
I could gather, and for all the friends I made along the way.
NixOS is what makes computers bearable for me, so I'll go and work on
some fork (*something something* you always meet twice in life).
2024-07-02 02:36:42 +02:00
Janik H. b1fd84f6ec nixosTests.networking: start network-online.target manually
this is done to avoid future problems for when `network-online.target` doesn't depend on `multi-user.target`
2024-04-18 00:27:45 +02:00
Janik H. 52e01114be nixosTests.networking: refactor and add NetworkManager support 2024-04-17 21:20:11 +02:00
Janik H. 080c08d3c1 nixosTests.networking: split router into a separate file and remove with lib; antipattern
this commit also does a tiny bit more, namely:
- removing unnecessary ping's to the hosts own ip
- and simplifying a few pieces of code like changing `{ inherit (pkgs) lib pkgs; };` to `{ inherit lib pkgs; };`
2024-04-02 02:33:48 +02:00