mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-27 01:13:05 +00:00
commit
779b7ff3d8
@ -4154,6 +4154,16 @@
|
||||
githubId = 3425311;
|
||||
name = "Antoine Eiche";
|
||||
};
|
||||
lexuge = {
|
||||
name = "Harry Ying";
|
||||
email = "lexugeyky@outlook.com";
|
||||
github = "LEXUGE";
|
||||
githubId = 13804737;
|
||||
keys = [{
|
||||
longkeyid = "rsa4096/0xAE53B4C2E58EDD45";
|
||||
fingerprint = "7FE2 113A A08B 695A C8B8 DDE6 AE53 B4C2 E58E DD45";
|
||||
}];
|
||||
};
|
||||
lheckemann = {
|
||||
email = "git@sphalerite.org";
|
||||
github = "lheckemann";
|
||||
|
@ -709,6 +709,7 @@
|
||||
./services/networking/shorewall6.nix
|
||||
./services/networking/shout.nix
|
||||
./services/networking/sniproxy.nix
|
||||
./services/networking/smartdns.nix
|
||||
./services/networking/smokeping.nix
|
||||
./services/networking/softether.nix
|
||||
./services/networking/spacecookie.nix
|
||||
|
61
nixos/modules/services/networking/smartdns.nix
Normal file
61
nixos/modules/services/networking/smartdns.nix
Normal file
@ -0,0 +1,61 @@
|
||||
{ lib, pkgs, config, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
inherit (lib.types) attrsOf coercedTo listOf oneOf str int bool;
|
||||
cfg = config.services.smartdns;
|
||||
|
||||
confFile = pkgs.writeText "smartdns.conf" (with generators;
|
||||
toKeyValue {
|
||||
mkKeyValue = mkKeyValueDefault {
|
||||
mkValueString = v:
|
||||
if isBool v then
|
||||
if v then "yes" else "no"
|
||||
else
|
||||
mkValueStringDefault { } v;
|
||||
} " ";
|
||||
listsAsDuplicateKeys =
|
||||
true; # Allowing duplications because we need to deal with multiple entries with the same key.
|
||||
} cfg.settings);
|
||||
in {
|
||||
options.services.smartdns = {
|
||||
enable = mkEnableOption "SmartDNS DNS server";
|
||||
|
||||
bindPort = mkOption {
|
||||
type = types.port;
|
||||
default = 53;
|
||||
description = "DNS listening port number.";
|
||||
};
|
||||
|
||||
settings = mkOption {
|
||||
type =
|
||||
let atom = oneOf [ str int bool ];
|
||||
in attrsOf (coercedTo atom toList (listOf atom));
|
||||
example = literalExample ''
|
||||
{
|
||||
bind = ":5353 -no-rule -group example";
|
||||
cache-size = 4096;
|
||||
server-tls = [ "8.8.8.8:853" "1.1.1.1:853" ];
|
||||
server-https = "https://cloudflare-dns.com/dns-query -exclude-default-group";
|
||||
prefetch-domain = true;
|
||||
speed-check-mode = "ping,tcp:80";
|
||||
};
|
||||
'';
|
||||
description = ''
|
||||
A set that will be generated into configuration file, see the <link xlink:href="https://github.com/pymumu/smartdns/blob/master/ReadMe_en.md#configuration-parameter">SmartDNS README</link> for details of configuration parameters.
|
||||
You could override the options here like <option>services.smartdns.bindPort</option> by writing <literal>settings.bind = ":5353 -no-rule -group example";</literal>.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
services.smartdns.settings.bind = mkDefault ":${toString cfg.bindPort}";
|
||||
|
||||
systemd.packages = [ pkgs.smartdns ];
|
||||
systemd.services.smartdns.wantedBy = [ "multi-user.target" ];
|
||||
environment.etc."smartdns/smartdns.conf".source = confFile;
|
||||
environment.etc."default/smartdns".source =
|
||||
"${pkgs.smartdns}/etc/default/smartdns";
|
||||
};
|
||||
}
|
38
pkgs/tools/networking/smartdns/default.nix
Normal file
38
pkgs/tools/networking/smartdns/default.nix
Normal file
@ -0,0 +1,38 @@
|
||||
{ stdenv, fetchFromGitHub, openssl }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "smartdns";
|
||||
version =
|
||||
"30"; # This would be used later in the next release as the FHS commit integrated into realse 31.
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "pymumu";
|
||||
repo = pname;
|
||||
rev = "3ad7cd7f454eec2fbdf338c0eb0541da301f1e73";
|
||||
sha256 = "1y9p8gxpj2k4a10maggkxg8l55jvr7x1wyxi69waxf56ggh2dvv0";
|
||||
};
|
||||
|
||||
buildInputs = [ openssl ];
|
||||
|
||||
makeFlags = [
|
||||
"PREFIX=${placeholder "out"}"
|
||||
"SYSTEMDSYSTEMUNITDIR=${placeholder "out"}/lib/systemd/system"
|
||||
"RUNSTATEDIR=/run"
|
||||
];
|
||||
|
||||
installFlags = [ "SYSCONFDIR=${placeholder "out"}/etc" ];
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
description =
|
||||
"A local DNS server to obtain the fastest website IP for the best Internet experience";
|
||||
longDescription = ''
|
||||
SmartDNS is a local DNS server. SmartDNS accepts DNS query requests from local clients, obtains DNS query results from multiple upstream DNS servers, and returns the fastest access results to clients.
|
||||
Avoiding DNS pollution and improving network access speed, supports high-performance ad filtering.
|
||||
Unlike dnsmasq's all-servers, smartdns returns the fastest access resolution.
|
||||
'';
|
||||
homepage = "https://github.com/pymumu/smartdns";
|
||||
maintainers = [ maintainers.lexuge ];
|
||||
license = licenses.gpl3Plus;
|
||||
platforms = platforms.linux;
|
||||
};
|
||||
}
|
@ -6540,6 +6540,8 @@ in
|
||||
conf = config.slstatus.conf or null;
|
||||
};
|
||||
|
||||
smartdns = callPackage ../tools/networking/smartdns { };
|
||||
|
||||
smartmontools = callPackage ../tools/system/smartmontools {
|
||||
inherit (darwin.apple_sdk.frameworks) IOKit ApplicationServices;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user