diff options
Diffstat (limited to 'pkgs/by-name/za/zapret/package.nix')
-rw-r--r-- | pkgs/by-name/za/zapret/package.nix | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/pkgs/by-name/za/zapret/package.nix b/pkgs/by-name/za/zapret/package.nix index 658d525bf36f..470f65d1b267 100644 --- a/pkgs/by-name/za/zapret/package.nix +++ b/pkgs/by-name/za/zapret/package.nix @@ -13,40 +13,40 @@ gawk }: -stdenv.mkDerivation { +stdenv.mkDerivation (finalAttrs: { pname = "zapret"; - version = "0-unstable-2024-08-01"; + version = "67"; src = fetchFromGitHub { owner = "bol-van"; repo = "zapret"; - rev = "9cf72b7c68f6a7c80dfddc6c1cf6d6db32718376"; - hash = "sha256-8cqKCNYLLkZXlwrybKUPG6fLd7gmf8zV9tjWoTxAwIY="; + rev = "refs/tags/v${finalAttrs.version}"; + hash = "sha256-4TgM0NkvVvdSEJ01SULu+GqpfqokTTErHAt3QkxkLIs="; }; buildInputs = [ libcap zlib libnetfilter_queue libnfnetlink ]; nativeBuildInputs = [ iptables nftables gawk ]; - buildPhase = '' - mkdir -p $out/bin - - make TGT=$out/bin - ''; + makeFlags = [ "TGT=${placeholder "out"}/bin" ]; installPhase = '' + runHook preInstall + mkdir -p $out/usr/share/zapret/init.d/sysv mkdir -p $out/usr/share/docs cp $src/blockcheck.sh $out/bin/blockcheck substituteInPlace $out/bin/blockcheck \ - --replace "ZAPRET_BASE=\"\$EXEDIR\"" "ZAPRET_BASE=$out/usr/share/zapret" + --replace-fail '$(cd "$EXEDIR"; pwd)' "$out/usr/share/zapret" + + ln -s ../../../bin/blockcheck $out/usr/share/zapret/blockcheck cp $src/init.d/sysv/functions $out/usr/share/zapret/init.d/sysv/functions cp $src/init.d/sysv/zapret $out/usr/share/zapret/init.d/sysv/init.d substituteInPlace $out/usr/share/zapret/init.d/sysv/functions \ - --replace "ZAPRET_BASE=\$(readlink -f \"\$EXEDIR/../..\")" "ZAPRET_BASE=$out/usr/share/zapret" + --replace-fail "/opt/zapret" "\"$out/usr/share/zapret\"" touch $out/usr/share/zapret/config @@ -57,6 +57,8 @@ stdenv.mkDerivation { cp $src/common/* $out/usr/share/zapret/common cp $src/ipset/* $out/usr/share/zapret/ipset + rm -f $out/usr/share/zapret/ipset/zapret-hosts-user-exclude.txt.default + mkdir -p $out/usr/share/zapret/nfq ln -s ../../../../bin/nfqws $out/usr/share/zapret/nfq/nfqws @@ -67,16 +69,18 @@ stdenv.mkDerivation { done ln -s ../usr/share/zapret/init.d/sysv/init.d $out/bin/zapret + + runHook postInstall ''; - meta = with lib; { + meta = { description = "DPI bypass multi platform"; homepage = "https://github.com/bol-van/zapret"; - license = licenses.mit; - maintainers = with maintainers; [ nishimara ]; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ nishimara ]; mainProgram = "zapret"; # probably gonna work on darwin, but untested - broken = stdenv.isDarwin; + broken = stdenv.hostPlatform.isDarwin; }; -} +}) |