diff options
Diffstat (limited to 'pkgs/by-name/go/godns/package.nix')
-rw-r--r-- | pkgs/by-name/go/godns/package.nix | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/pkgs/by-name/go/godns/package.nix b/pkgs/by-name/go/godns/package.nix new file mode 100644 index 000000000000..0e5e155523d6 --- /dev/null +++ b/pkgs/by-name/go/godns/package.nix @@ -0,0 +1,64 @@ +{ lib +, buildGoModule +, fetchFromGitHub +, nodejs +, npmHooks +, fetchNpmDeps +, nix-update-script +}: + +buildGoModule rec { + pname = "godns"; + version = "3.1.5"; + + src = fetchFromGitHub { + owner = "TimothyYe"; + repo = "godns"; + rev = "refs/tags/v${version}"; + hash = "sha256-kdClyeU0hR0ymVLn9xe/kYVJE/9P/hAz/5UwRAQ2KCU="; + }; + + vendorHash = "sha256-kSREFNIGH0MXiyKMp1LmrLkhKBhovvNRz46LTXT2XME="; + npmDeps = fetchNpmDeps { + src = "${src}/web"; + hash = "sha256-2yeqLly0guU/kpX+yH/QOoDGzyJTxkTaCt8EleJhybU="; + }; + + npmRoot = "web"; + nativeBuildInputs = [ + nodejs + npmHooks.npmConfigHook + ]; + + overrideModAttrs = oldAttrs: { + # Do not add `npmConfigHook` to `goModules` + nativeBuildInputs = lib.remove npmHooks.npmConfigHook oldAttrs.nativeBuildInputs; + # Do not run `preBuild` when building `goModules` + preBuild = null; + }; + + # Some tests require internet access, broken in sandbox + doCheck = false; + + preBuild = '' + npm --prefix="$npmRoot" run build + go generate ./... + ''; + + ldflags = [ + "-s" + "-w" + "-X main.Version=${version}" + ]; + + passthru.updateScript = nix-update-script { }; + + meta = with lib; { + description = "A dynamic DNS client tool supports AliDNS, Cloudflare, Google Domains, DNSPod, HE.net & DuckDNS & DreamHost, etc"; + homepage = "https://github.com/TimothyYe/godns"; + changelog = "https://github.com/TimothyYe/godns/releases/tag/v${version}"; + license = licenses.asl20; + maintainers = with maintainers; [ yinfeng ]; + mainProgram = "godns"; + }; +} |