networking: add dhcpClientId option to set DHCP Client ID
This commit is contained in:
parent
8b720b9662
commit
05a5979906
4 changed files with 37 additions and 0 deletions
|
|
@ -18,6 +18,9 @@ let
|
|||
*${lib.escapeShellArg srv}*)
|
||||
networksetup -setdnsservers ${lib.escapeShellArgs ([ srv ] ++ (emptyList cfg.dns))}
|
||||
networksetup -setsearchdomains ${lib.escapeShellArgs ([ srv ] ++ (emptyList cfg.search))}
|
||||
${optionalString (cfg.dhcpClientId != null) ''
|
||||
networksetup -setdhcp ${lib.escapeShellArgs [ srv cfg.dhcpClientId ]}
|
||||
''}
|
||||
;;
|
||||
esac
|
||||
'') cfg.knownNetworkServices}
|
||||
|
|
@ -133,6 +136,21 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
networking.dhcpClientId = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
example = "my-client-id";
|
||||
description = ''
|
||||
The DHCP client identifier to use when requesting an IP address from a DHCP server.
|
||||
|
||||
If this option is set, it will be used by the system when requesting an IP address.
|
||||
If not set, no changes will be made.
|
||||
|
||||
Set to the string "empty" to clear any previously configured client ID
|
||||
and restore the system default behavior.
|
||||
'';
|
||||
};
|
||||
|
||||
networking.dns = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [];
|
||||
|
|
@ -162,6 +180,7 @@ in
|
|||
warnings = [
|
||||
(mkIf (cfg.knownNetworkServices == [] && cfg.dns != []) "networking.knownNetworkServices is empty, dns servers will not be configured.")
|
||||
(mkIf (cfg.knownNetworkServices == [] && cfg.search != []) "networking.knownNetworkServices is empty, dns searchdomains will not be configured.")
|
||||
(mkIf (cfg.knownNetworkServices == [] && cfg.dhcpClientId != null) "networking.knownNetworkServices is empty, dhcp client ID will not be configured.")
|
||||
];
|
||||
|
||||
system.activationScripts.networking.text = ''
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue