Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nixos/networkd: mark units option as internal #74624

Merged
merged 1 commit into from Feb 2, 2020

Conversation

Ma27
Copy link
Member

@Ma27 Ma27 commented Nov 29, 2019

Motivation for this change

The options at systemd.network (links, netdevs and networks) are
directly mapped to the three different unit types of systemd-networkd(8).

However there's also the option systemd.network.units which is
basically used as a container for generated unit-configs that are linked
to /etc/systemd/networkd[1].

This should not be exposed to the user as it's unclear whether or not it
should be used directly which can be pretty confusing which is why I decided to
declare this option as internal (including all sub-options as internal
doesn't seem to be propagated to submodules).

[1]

systemd.network.units = mapAttrs' (n: v: nameValuePair "${n}.link" (linkToUnit n v)) cfg.links
// mapAttrs' (n: v: nameValuePair "${n}.netdev" (netdevToUnit n v)) cfg.netdevs
// mapAttrs' (n: v: nameValuePair "${n}.network" (networkToUnit n v)) cfg.networks;
environment.etc = unitFiles;

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nix-review --run "nix-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.
Notify maintainers

cc @

The options at `systemd.network` (`links`, `netdevs` and `networks`) are
directly mapped to the three different unit types of `systemd-networkd(8)`.

However there's also the option `systemd.network.units` which is
basically used as a container for generated unit-configs that are linked
to `/etc/systemd/networkd`[1].

This should not be exposed to the user as it's unclear whether or not it
should be used directly which can be pretty confusing which is why I decided to
declare this option as internal (including all sub-options as `internal`
doesn't seem to be propagated to submodules).

[1] https://github.com/NixOS/nixpkgs/blob/9db75ed88fd87e17ec448ad7a43b62acb4842854/nixos/modules/system/boot/networkd.nix#L933-L937
Copy link
Member

@fpletz fpletz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks reasonable to me since unit options should be able to be overridden via netdevs, links and networks.

cc @arianvp

@flokli flokli requested a review from arianvp December 27, 2019 15:21
@arianvp
Copy link
Member

arianvp commented Dec 27, 2019

Do we do the same for systemd units?

@Ma27
Copy link
Member Author

Ma27 commented Dec 28, 2019

Do we do the same for systemd units?

IIRC no. While I'm not sure if that option should be declared as internal as it exists for a long time, I've seen people who are new to networkd getting confused by the units option in the networkd module.

@Ma27
Copy link
Member Author

Ma27 commented Jan 17, 2020

@arianvp do you have any further objections? This is stale for a while now 😅

@Ma27 Ma27 merged commit 0f10495 into NixOS:master Feb 2, 2020
@Ma27 Ma27 deleted the networkd-units-internal branch February 2, 2020 07:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants