New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
smartdns: init at 30 #80931
smartdns: init at 30 #80931
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be 2 commits:
maintainers: add lexuge
smartdns: init at 29
I have squashed the commits. |
@jtojnar I think |
Verified that the FHS branch works correctly with the following patch: --- a/pkgs/tools/networking/smartdns/default.nix
+++ b/pkgs/tools/networking/smartdns/default.nix
@@ -4,41 +4,28 @@ stdenv.mkDerivation rec {
pname = "smartdns";
version = "30";
- src = fetchFromGitHub {
- owner = "pymumu";
- repo = pname;
- rev = "Release${version}";
- sha256 = "1zj1ajvdnpmdal87j7fyn0xdd0ydjii1nvgwgacv2j311b6fdrk7";
- };
-
- patches = [
- # TODO: A patch is needed by now since the upstream doesn't follow the FHS guideline. It should not be the case in the future.
- (fetchpatch {
- url =
- "https://git.archlinux.org/svntogit/community.git/plain/trunk/systemd.patch?h=packages/smartdns&id=c15e81742c93e24c47de59a956f1d0d0f7156f0a";
- name = "systemd.nix";
- sha256 = "0jxzsgxz6y1a4mvwk6d5carxv4nxsswpfs1a6jkplzy2gr0g8281";
- })
- ];
-
- patchFlags = [ "-p1" "systemd/smartdns.service" ];
+ # src = fetchFromGitHub {
+ # owner = "pymumu";
+ # repo = pname;
+ # rev = "Release${version}";
+ # sha256 = "1zj1ajvdnpmdal87j7fyn0xdd0ydjii1nvgwgacv2j311b6fdrk7";
+ # };
- postPatch = ''
- substituteInPlace systemd/smartdns.service --replace /usr/bin/smartdns $out/bin/smartdns
- '';
+ src = /home/jtojnar/Projects/smartdns;
- buildInputs = [ openssl ];
+ buildInputs = [
+ openssl
+ ];
- makeFlags = [ "-C" "src" ];
+ makeFlags = [
+ "PREFIX=${placeholder "out"}"
+ "SYSTEMDSYSTEMUNITDIR=${placeholder "out"}/lib/systemd/system"
+ "RUNSTATEDIR=/run"
+ ];
- # TODO: Manual installation is needed by now due to upstream issue.
- installPhase = ''
- runHook preInstall
- install -Dm644 systemd/smartdns.service $out/etc/systemd/system/smartdns.service
- install -Dm644 etc/default/smartdns $out/etc/default/smartdns
- install -Dm755 src/smartdns $out/bin/smartdns
- runHook postInstall
- '';
+ installFlags = [
+ "SYSCONFDIR=${placeholder "out"}/etc"
+ ];
meta = with stdenv.lib; {
description = |
@jtojnar But somehow the newly merged PR is not in the recent release, which means I should not use release version but use commit sha256 to pin the src? |
@jonringer I have updated the commits with the newest commits in smartdns. |
Any update here? |
example = literalExample '' | ||
settings = { | ||
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"; | ||
}; | ||
''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just use
example = literalExample '' | |
settings = { | |
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"; | |
}; | |
''; | |
example = { | |
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"; | |
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This wouldn't render correctly in the manual
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good to me!
Great. What should I do next then? |
Let's wait a bit for @jtojnar's approval |
Thanks for a lot of help! @jonringer @infinisil |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/modifying-environement-etc-file-from-multiple-imports/6375/2 |
Motivation for this change
For Mainland China NixOS users like me. It is very troublesome to have a fast while un-polluted DNS server. Some local servers like stubby + dnsmasq isn't fast enough in terms of either resolving or using the result. And SmartDNS, A local DNS server to obtain the fastest website IP for the best Internet experience, is capable to solve this issue. Thus I packaged it.
Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)