v2ray-rules-dat: use finalAttrs, modernize

(cherry picked from commit d41c971bce)
This commit is contained in:
Moraxyc 2026-06-18 11:04:42 +08:00 committed by github-actions[bot]
commit b0f28e8d48

View file

@ -1,37 +1,43 @@
{
lib,
stdenvNoCC,
fetchurl,
lib,
}:
let
stdenvNoCC.mkDerivation (finalAttrs: {
pname = "v2ray-rules-dat";
version = "202606122311";
geoipDat = fetchurl {
url = "https://github.com/Loyalsoldier/v2ray-rules-dat/releases/download/${version}/geoip.dat";
hash = "sha256-iGGpeUaWtIH7AEPueCssQOgL/Ia7nkLFvWnAj1SDsbU=";
};
geositeDat = fetchurl {
url = "https://github.com/Loyalsoldier/v2ray-rules-dat/releases/download/${version}/geosite.dat";
hash = "sha256-/c/3OjfALveNnHS9NxonTeOiZyud6U/X4WHrGZSOs7Q=";
};
in
stdenvNoCC.mkDerivation {
pname = "v2ray-rules-dat";
inherit version;
__structuredAttrs = true;
strictDeps = true;
src = null;
dontUnpack = true;
installPhase = ''
install -Dm444 ${geoipDat} $out/share/v2ray/geoip.dat
install -Dm444 ${geositeDat} $out/share/v2ray/geosite.dat
runHook preInstall
install -Dm444 ${finalAttrs.passthru.geoipDat} $out/share/v2ray/geoip.dat
install -Dm444 ${finalAttrs.passthru.geositeDat} $out/share/v2ray/geosite.dat
runHook postInstall
'';
passthru = {
geoipDat = fetchurl {
url = "https://github.com/Loyalsoldier/v2ray-rules-dat/releases/download/${finalAttrs.version}/geoip.dat";
hash = "sha256-iGGpeUaWtIH7AEPueCssQOgL/Ia7nkLFvWnAj1SDsbU=";
};
geositeDat = fetchurl {
url = "https://github.com/Loyalsoldier/v2ray-rules-dat/releases/download/${finalAttrs.version}/geosite.dat";
hash = "sha256-/c/3OjfALveNnHS9NxonTeOiZyud6U/X4WHrGZSOs7Q=";
};
};
meta = {
description = "Enhanced edition of V2Ray rules dat files";
homepage = "https://github.com/Loyalsoldier/v2ray-rules-dat";
changelog = "https://github.com/Loyalsoldier/v2ray-rules-dat/releases/tag/${finalAttrs.version}";
license = lib.licenses.gpl3Only;
maintainers = with lib.maintainers; [ nix-julia ];
};
}
})