nixos/containers: don't create veths if not configured #49392
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Previously, setting "privateNetwork = true" without specifying host and
local addresses would create unconfigured interfaces: ve-$INSTANCE on the host
and eth0 inside the container.
These changes is rebased part of the original PR #3021.
Motivation for this change
I have quite a few containers running on my home server and most of them use macvlans to connect to my local network. As a result, I'm left with a bunch of useless interfaces both on the host and inside containers (
ve-$INSTANCE
andeth0
). It's not critical, but it would be nice to get rid of them.Things done
I tried to run tests from
nixos/tests/containers
using$ nix-build nixos/tests/container-<test>
and looking at result/log.html. Some tests failed, but they also fail for me on the current master, so I'm not sure how to check if proposed changes break anything.sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)nix path-info -S
before and after)