mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-02-20 11:05:14 +00:00
nixos/stage-1: install networkd link files
Renaming an interface must be done in stage-1: otherwise udev will report the interface as ready and network daemons (networkd, dhcpcd, etc.) will bring it up. Once up the interface can't be changed and the renaming will fail. Note: link files are read directly by udev, so they can be used even without networkd enabled.
This commit is contained in:
parent
15d6eacb15
commit
65325292da
@ -205,13 +205,22 @@ let
|
||||
''; # */
|
||||
|
||||
|
||||
# Networkd link files are used early by udev to set up interfaces early.
|
||||
# This must be done in stage 1 to avoid race conditions between udev and
|
||||
# network daemons.
|
||||
linkUnits = pkgs.runCommand "link-units" {
|
||||
allowedReferences = [ extraUtils ];
|
||||
preferLocalBuild = true;
|
||||
} ''
|
||||
} (''
|
||||
mkdir -p $out
|
||||
cp -v ${udev}/lib/systemd/network/*.link $out/
|
||||
'';
|
||||
'' + (
|
||||
let
|
||||
links = filterAttrs (n: v: hasSuffix ".link" n) config.systemd.network.units;
|
||||
files = mapAttrsToList (n: v: "${v.unit}/${n}") links;
|
||||
in
|
||||
concatMapStringsSep "\n" (file: "cp -v ${file} $out/") files
|
||||
));
|
||||
|
||||
udevRules = pkgs.runCommand "udev-rules" {
|
||||
allowedReferences = [ extraUtils ];
|
||||
|
Loading…
Reference in New Issue
Block a user