Get rid of some cruft, and un-nest systemd
This commit is contained in:
parent
2c20446df3
commit
763670e46a
@ -246,18 +246,7 @@ in {
|
|||||||
verbose = mkEnableOption "Keep verbose logs.";
|
verbose = mkEnableOption "Keep verbose logs.";
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable (let
|
config = mkIf cfg.enable {
|
||||||
upgrade-perms = cfg.dns.listen-port <= 1024 || cfg.http.listen-port <= 1024;
|
|
||||||
in {
|
|
||||||
users = mkIf upgrade-perms {
|
|
||||||
users.${cfg.user} = {
|
|
||||||
isSystemUser = true;
|
|
||||||
group = cfg.user;
|
|
||||||
};
|
|
||||||
|
|
||||||
groups.${cfg.user} = { members = [ cfg.user ]; };
|
|
||||||
};
|
|
||||||
|
|
||||||
fudo = {
|
fudo = {
|
||||||
secrets.host-secrets.${hostname} = {
|
secrets.host-secrets.${hostname} = {
|
||||||
adguard-dns-proxy-admin-password = {
|
adguard-dns-proxy-admin-password = {
|
||||||
@ -266,12 +255,12 @@ in {
|
|||||||
user = "root";
|
user = "root";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
|
||||||
systemd.services.adguard-dns-proxy =
|
systemd.services.adguard-dns-proxy =
|
||||||
let configFile = "/run/adguard-dns-proxy/config.yaml";
|
let configFile = "/run/adguard-dns-proxy/config.yaml";
|
||||||
in {
|
in {
|
||||||
description =
|
description = "DNS proxy for ad filtering and DNS-over-HTTPS lookups.";
|
||||||
"DNS proxy for ad filtering and DNS-over-HTTPS lookups.";
|
|
||||||
wantedBy = [ "default.target" ];
|
wantedBy = [ "default.target" ];
|
||||||
after = [ "syslog.target" "network.target" ];
|
after = [ "syslog.target" "network.target" ];
|
||||||
requires = [ "syslog.target" "network.target" ];
|
requires = [ "syslog.target" "network.target" ];
|
||||||
@ -288,7 +277,9 @@ in {
|
|||||||
"--port ${toString cfg.http.listen-port}"
|
"--port ${toString cfg.http.listen-port}"
|
||||||
"--config $RUNTIME_DIRECTORY/config.yaml"
|
"--config $RUNTIME_DIRECTORY/config.yaml"
|
||||||
];
|
];
|
||||||
AmbientCapabilities = [ "CAP_NET_BIND_SERVICE" ];
|
AmbientCapabilities = optional
|
||||||
|
(cfg.dns.listen-port <= 1024 || cfg.http.listen-port <= 1024)
|
||||||
|
[ "CAP_NET_BIND_SERVICE" ];
|
||||||
DynamicUser = true;
|
DynamicUser = true;
|
||||||
RuntimeDirectory = "adguard-dns-proxy";
|
RuntimeDirectory = "adguard-dns-proxy";
|
||||||
};
|
};
|
||||||
@ -329,5 +320,4 @@ in {
|
|||||||
# in "${pkgs.adguardhome}/bin/adguardhome ${arg-string}";
|
# in "${pkgs.adguardhome}/bin/adguardhome ${arg-string}";
|
||||||
# };
|
# };
|
||||||
};
|
};
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user