65 lines
1.5 KiB
Nix
65 lines
1.5 KiB
Nix
{
|
|
lib,
|
|
buildGoModule,
|
|
fetchFromGitHub,
|
|
nodejs,
|
|
npmHooks,
|
|
fetchNpmDeps,
|
|
nix-update-script,
|
|
}:
|
|
|
|
buildGoModule rec {
|
|
pname = "godns";
|
|
version = "3.1.9";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "TimothyYe";
|
|
repo = "godns";
|
|
rev = "refs/tags/v${version}";
|
|
hash = "sha256-e39T6pOFD9FrbXVtD/qPN74HQqJcTl3a3enTPVqpsuY=";
|
|
};
|
|
|
|
vendorHash = "sha256-zz33xHIZ2jhD2s3v2vum0ELG7GTqe5SsADUrO5yqumw=";
|
|
npmDeps = fetchNpmDeps {
|
|
src = "${src}/web";
|
|
hash = "sha256-Y35CcUubO3QmbEwWBFXoWKLgvE8dp/mFE/szRigJvLo=";
|
|
};
|
|
|
|
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 = "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";
|
|
};
|
|
}
|