forked from mirrors/nixpkgs
nixos/resolvconf: add package
Expose the package that provides the system-wide `resolvconf` command (either openresolv or systemd) to allow implementation-agnostic modules.
This commit is contained in:
parent
0d68d7c857
commit
203696f098
|
@ -50,7 +50,20 @@ in
|
|||
default = !(config.environment.etc ? "resolv.conf");
|
||||
defaultText = literalExpression ''!(config.environment.etc ? "resolv.conf")'';
|
||||
description = ''
|
||||
DNS configuration is managed by resolvconf.
|
||||
Whether DNS configuration is managed by resolvconf.
|
||||
'';
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
default = pkgs.openresolv;
|
||||
defaultText = literalExpression "pkgs.openresolv";
|
||||
description = ''
|
||||
The package that provides the system-wide resolvconf command. Defaults to <literal>openresolv</literal>
|
||||
if this module is enabled. Otherwise, can be used by other modules (for example <option>services.resolved</option>) to
|
||||
provide a compatibility layer.
|
||||
|
||||
This option generally shouldn't be set by the user.
|
||||
'';
|
||||
};
|
||||
|
||||
|
@ -119,10 +132,12 @@ in
|
|||
exit 1
|
||||
''
|
||||
else configText;
|
||||
|
||||
environment.systemPackages = [ cfg.package ];
|
||||
}
|
||||
|
||||
(mkIf cfg.enable {
|
||||
environment.systemPackages = [ pkgs.openresolv ];
|
||||
networking.resolvconf.package = pkgs.openresolv;
|
||||
|
||||
systemd.services.resolvconf = {
|
||||
description = "resolvconf update";
|
||||
|
@ -134,7 +149,7 @@ in
|
|||
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
ExecStart = "${pkgs.openresolv}/bin/resolvconf -u";
|
||||
ExecStart = "${cfg.package}/bin/resolvconf -u";
|
||||
RemainAfterExit = true;
|
||||
};
|
||||
};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ config, lib, ... }:
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
let
|
||||
|
@ -178,6 +178,8 @@ in
|
|||
# If networkmanager is enabled, ask it to interface with resolved.
|
||||
networking.networkmanager.dns = "systemd-resolved";
|
||||
|
||||
networking.resolvconf.package = pkgs.systemd;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue