-
-
Save msteen/87d241a1073d62a44b2f2d7320cae0d7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let | |
macInterfaces = filterAttrs (name: interface: interface.macAddress != null) config.networking.interfaces; | |
extraUdevRules = pkgs.writeTextDir "10-mac-network.rules" (concatStrings (mapAttrsToList (name: interface: '' | |
ACTION=="add", SUBSYSTEM=="net", ATTR{address}=="${interface.macAddress}", NAME="${name}" | |
'') macInterfaces)); | |
in mkIf (!config.networking.usePredictableInterfaceNames && macInterfaces != {}) { | |
boot.kernelParams = [ "net.ifnames=0" "biosdevname=0" ]; | |
boot.initrd.extraUdevRulesCommands = '' | |
cp -v ${extraUdevRules}/*.rules $out/ | |
''; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment