zapret: add information about commit and version

This commit is contained in:
Nishimara 2025-06-05 21:05:42 +03:00
parent 41a901e46c
commit b58ef718f9
No known key found for this signature in database

View file

@ -21,8 +21,16 @@ stdenv.mkDerivation (finalAttrs: {
src = fetchFromGitHub {
owner = "bol-van";
repo = "zapret";
leaveDotGit = true;
postFetch = ''
cd "$out"
git rev-parse --short HEAD > $out/COMMIT
find "$out" -name .git -print0 | xargs -0 rm -rf
'';
tag = "v${finalAttrs.version}";
hash = "sha256-OeOnzqYyRAQNRtjtPHwzDL/csuTAUgIRJKsPVr3iBac=";
hash = "sha256-cwwj0xGEiR3sg2WheurtQo6Hy5JAARcZJNHEHMfAoOE=";
};
buildInputs = [
@ -31,12 +39,17 @@ stdenv.mkDerivation (finalAttrs: {
libnetfilter_queue
libnfnetlink
];
nativeBuildInputs = [
iptables
nftables
gawk
];
preBuild = ''
makeFlagsArray+=("CFLAGS=-DZAPRET_GH_VER=${finalAttrs.src.tag} -DZAPRET_GH_HASH=`cat $src/COMMIT`")
'';
makeFlags = [ "TGT=${placeholder "out"}/bin" ];
installPhase = ''
@ -88,12 +101,10 @@ stdenv.mkDerivation (finalAttrs: {
meta = {
description = "DPI bypass multi platform";
homepage = "https://github.com/bol-van/zapret";
changelog = "https://github.com/bol-van/zapret/releases/tag/v${finalAttrs.version}";
changelog = "https://github.com/bol-van/zapret/releases/tag/${finalAttrs.src.tag}";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ nishimara ];
mainProgram = "zapret";
# probably gonna work on darwin, but untested
broken = stdenv.hostPlatform.isDarwin;
platforms = lib.platforms.linux;
};
})