Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib 2, buildGoModule 3, fetchFromGitHub 4, substituteAll 5, v2ray-domain-list-community 6}: 7 8let 9 patch = substituteAll { 10 src = ./main.go; 11 geosite_data = "${v2ray-domain-list-community}/share/v2ray/geosite.dat"; 12 }; 13in 14buildGoModule rec { 15 pname = "sing-geosite"; 16 inherit (v2ray-domain-list-community) version; 17 18 src = fetchFromGitHub { 19 owner = "SagerNet"; 20 repo = "sing-geosite"; 21 rev = "4a32d56c1705f77668beb5828df0b0a051efdeb9"; 22 hash = "sha256-P/EBcwJI2G9327BNi84R+q6BABx9DEKpN6ETTp8Q4NU="; 23 }; 24 25 vendorHash = "sha256-uQOmUXT2wd40DwwTCMnFFKd47eu+BPBDjiCGtUNFoKY="; 26 27 patchPhase = '' 28 sed -i -e '/func main()/,/^}/d' -e '/"io"/a "io/ioutil"' main.go 29 cat ${patch} >> main.go 30 ''; 31 32 buildPhase = '' 33 runHook preBuild 34 go run -v . 35 runHook postBuild 36 ''; 37 38 installPhase = '' 39 runHook preInstall 40 install -Dm644 geosite.db $out/share/sing-box/geosite.db 41 runHook postInstall 42 ''; 43 44 meta = with lib; { 45 description = "community managed domain list"; 46 homepage = "https://github.com/SagerNet/sing-geosite"; 47 license = licenses.gpl3Plus; 48 maintainers = with maintainers; [ linsui ]; 49 }; 50}