nixos/udev: add option to install rules in initrd
Note: this moves the example rule used to rename network interfaces in the new udev.initrdRules option, which is required since 115cdd1c.
This commit is contained in:
parent
65325292da
commit
8e59a682a5
@ -202,12 +202,26 @@ in
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
extraRules = mkOption {
|
initrdRules = mkOption {
|
||||||
default = "";
|
default = "";
|
||||||
example = ''
|
example = ''
|
||||||
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:1D:60:B9:6D:4F", KERNEL=="eth*", NAME="my_fast_network_card"
|
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:1D:60:B9:6D:4F", KERNEL=="eth*", NAME="my_fast_network_card"
|
||||||
'';
|
'';
|
||||||
type = types.lines;
|
type = types.lines;
|
||||||
|
description = ''
|
||||||
|
<command>udev</command> rules to include in the initrd
|
||||||
|
<emphasis>only</emphasis>. They'll be written into file
|
||||||
|
<filename>99-local.rules</filename>. Thus they are read and applied
|
||||||
|
after the essential initrd rules.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
extraRules = mkOption {
|
||||||
|
default = "";
|
||||||
|
example = ''
|
||||||
|
ENV{ID_VENDOR_ID}=="046d", ENV{ID_MODEL_ID}=="0825", ENV{PULSE_IGNORE}="1"
|
||||||
|
'';
|
||||||
|
type = types.lines;
|
||||||
description = ''
|
description = ''
|
||||||
Additional <command>udev</command> rules. They'll be written
|
Additional <command>udev</command> rules. They'll be written
|
||||||
into file <filename>99-local.rules</filename>. Thus they are
|
into file <filename>99-local.rules</filename>. Thus they are
|
||||||
@ -284,6 +298,13 @@ in
|
|||||||
|
|
||||||
boot.kernelParams = mkIf (!config.networking.usePredictableInterfaceNames) [ "net.ifnames=0" ];
|
boot.kernelParams = mkIf (!config.networking.usePredictableInterfaceNames) [ "net.ifnames=0" ];
|
||||||
|
|
||||||
|
boot.initrd.extraUdevRulesCommands = optionalString (cfg.initrdRules != "")
|
||||||
|
''
|
||||||
|
cat <<'EOF' > $out/99-local.rules
|
||||||
|
${cfg.initrdRules}
|
||||||
|
EOF
|
||||||
|
'';
|
||||||
|
|
||||||
environment.etc =
|
environment.etc =
|
||||||
{
|
{
|
||||||
"udev/rules.d".source = udevRules;
|
"udev/rules.d".source = udevRules;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user