nixos/services.coredns: remove with lib;
This commit is contained in:
parent
6c6b5e7f80
commit
c4bbbbbb10
@ -1,39 +1,36 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.services.coredns;
|
||||
configFile = pkgs.writeText "Corefile" cfg.config;
|
||||
in {
|
||||
options.services.coredns = {
|
||||
enable = mkEnableOption "Coredns dns server";
|
||||
enable = lib.mkEnableOption "Coredns dns server";
|
||||
|
||||
config = mkOption {
|
||||
config = lib.mkOption {
|
||||
default = "";
|
||||
example = ''
|
||||
. {
|
||||
whoami
|
||||
}
|
||||
'';
|
||||
type = types.lines;
|
||||
type = lib.types.lines;
|
||||
description = ''
|
||||
Verbatim Corefile to use.
|
||||
See <https://coredns.io/manual/toc/#configuration> for details.
|
||||
'';
|
||||
};
|
||||
|
||||
package = mkPackageOption pkgs "coredns" { };
|
||||
package = lib.mkPackageOption pkgs "coredns" { };
|
||||
|
||||
extraArgs = mkOption {
|
||||
extraArgs = lib.mkOption {
|
||||
default = [];
|
||||
example = [ "-dns.port=53" ];
|
||||
type = types.listOf types.str;
|
||||
type = lib.types.listOf lib.types.str;
|
||||
description = "Extra arguments to pass to coredns.";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
config = lib.mkIf cfg.enable {
|
||||
systemd.services.coredns = {
|
||||
description = "Coredns dns server";
|
||||
after = [ "network.target" ];
|
||||
@ -46,7 +43,7 @@ in {
|
||||
AmbientCapabilities = "cap_net_bind_service";
|
||||
NoNewPrivileges = true;
|
||||
DynamicUser = true;
|
||||
ExecStart = "${getBin cfg.package}/bin/coredns -conf=${configFile} ${lib.escapeShellArgs cfg.extraArgs}";
|
||||
ExecStart = "${lib.getBin cfg.package}/bin/coredns -conf=${configFile} ${lib.escapeShellArgs cfg.extraArgs}";
|
||||
ExecReload = "${pkgs.coreutils}/bin/kill -SIGUSR1 $MAINPID";
|
||||
Restart = "on-failure";
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user