lol
1{
2 lib,
3 buildGoModule,
4 fetchFromGitHub,
5 nodejs,
6 npmHooks,
7 fetchNpmDeps,
8 nix-update-script,
9}:
10
11buildGoModule rec {
12 pname = "godns";
13 version = "3.3.3";
14
15 src = fetchFromGitHub {
16 owner = "TimothyYe";
17 repo = "godns";
18 tag = "v${version}";
19 hash = "sha256-go6LUVr53ioCpzWwShe7Ol2p57HH/cAcsD+g7I0ix2E=";
20 };
21
22 vendorHash = "sha256-FHao4E0hhmnM224f8CowcHFAN2fmcR7TN08ldKZ5DUw=";
23 npmDeps = fetchNpmDeps {
24 src = "${src}/web";
25 hash = "sha256-D0R9CUMlm+oesfD+Gr+Cqi37XETMhQ9n9MSKJOYqe9g=";
26 };
27
28 npmRoot = "web";
29 nativeBuildInputs = [
30 nodejs
31 npmHooks.npmConfigHook
32 ];
33
34 overrideModAttrs = oldAttrs: {
35 # Do not add `npmConfigHook` to `goModules`
36 nativeBuildInputs = lib.remove npmHooks.npmConfigHook oldAttrs.nativeBuildInputs;
37 # Do not run `preBuild` when building `goModules`
38 preBuild = null;
39 };
40
41 # Some tests require internet access, broken in sandbox
42 doCheck = false;
43
44 preBuild = ''
45 npm --prefix="$npmRoot" run build
46 go generate ./...
47 '';
48
49 ldflags = [
50 "-s"
51 "-w"
52 "-X main.Version=${version}"
53 ];
54
55 passthru.updateScript = nix-update-script { };
56
57 meta = {
58 description = "Dynamic DNS client tool supports AliDNS, Cloudflare, Google Domains, DNSPod, HE.net & DuckDNS & DreamHost, etc";
59 homepage = "https://github.com/TimothyYe/godns";
60 changelog = "https://github.com/TimothyYe/godns/releases/tag/v${version}";
61 license = lib.licenses.asl20;
62 maintainers = with lib.maintainers; [ yinfeng ];
63 mainProgram = "godns";
64 };
65}