mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-01-06 04:53:27 +00:00
571c71e6f7
We are migrating packages that meet below requirements: 1. using `callPackage` 2. called path is a directory 3. overriding set is empty (`{ }`) 4. not containing path expressions other than relative path (to makenixpkgs-vet happy) 5. not referenced by nix files outside of the directory, other than`pkgs/top-level/all-packages.nix` 6. not referencing nix files outside of the directory 7. not referencing `default.nix` (since it's changed to `package.nix`) 8. `outPath` doesn't change after migration The tool is here: https://github.com/Aleksanaa/by-name-migrate.
68 lines
1.4 KiB
Nix
68 lines
1.4 KiB
Nix
{ lib
|
|
, stdenvNoCC
|
|
, buildGoModule
|
|
, fetchFromGitHub
|
|
, dbip-country-lite
|
|
}:
|
|
|
|
let
|
|
generator = buildGoModule rec {
|
|
pname = "sing-geoip";
|
|
version = "20240312";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "SagerNet";
|
|
repo = pname;
|
|
rev = "refs/tags/${version}";
|
|
hash = "sha256-nIrbiECK25GyuPEFqMvPdZUShC2JC1NI60Y10SsoWyY=";
|
|
};
|
|
|
|
vendorHash = "sha256-WH0eMg06qCiVcy4H+vBtYrmLMA2KJRCPGXiEnatW+LU=";
|
|
|
|
postPatch = ''
|
|
sed -i -e '/func main()/,/^}/d' main.go
|
|
cat ${./main.go} >> main.go
|
|
'';
|
|
|
|
meta = with lib; {
|
|
description = "GeoIP data for sing-box";
|
|
homepage = "https://github.com/SagerNet/sing-geoip";
|
|
license = licenses.gpl3Plus;
|
|
maintainers = with maintainers; [ linsui ];
|
|
mainProgram = "sing-geoip";
|
|
};
|
|
};
|
|
in
|
|
stdenvNoCC.mkDerivation {
|
|
inherit (generator) pname;
|
|
inherit (dbip-country-lite) version;
|
|
|
|
dontUnpack = true;
|
|
|
|
nativeBuildInputs = [ generator ];
|
|
|
|
buildPhase = ''
|
|
runHook preBuild
|
|
|
|
sing-geoip ${dbip-country-lite.mmdb}
|
|
|
|
runHook postBuild
|
|
'';
|
|
|
|
installPhase = ''
|
|
runHook preInstall
|
|
|
|
install -Dm644 geoip.db $out/share/sing-box/geoip.db
|
|
install -Dm644 geoip-cn.db $out/share/sing-box/geoip-cn.db
|
|
install -Dm644 rule-set/* -t $out/share/sing-box/rule-set
|
|
|
|
runHook postInstall
|
|
'';
|
|
|
|
passthru = { inherit generator; };
|
|
|
|
meta = generator.meta // {
|
|
inherit (dbip-country-lite.meta) license;
|
|
};
|
|
}
|