tor: cleanup

This commit is contained in:
Saterfield990 2025-07-07 09:55:34 +03:00
parent 60a6246f2b
commit 3283402efe

View File

@ -15,6 +15,7 @@
scrypt, scrypt,
nixosTests, nixosTests,
writeShellScript, writeShellScript,
versionCheckHook,
# for update.nix # for update.nix
writeScript, writeScript,
@ -27,6 +28,7 @@
gnused, gnused,
nix, nix,
}: }:
let let
tor-client-auth-gen = writeShellScript "tor-client-auth-gen" '' tor-client-auth-gen = writeShellScript "tor-client-auth-gen" ''
PATH="${ PATH="${
@ -48,13 +50,14 @@ let
base64 -d | tail --bytes=32 | base32 | tr -d = base64 -d | tail --bytes=32 | base32 | tr -d =
''; '';
in in
stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: {
pname = "tor"; pname = "tor";
version = "0.4.8.17"; version = "0.4.8.17";
src = fetchurl { src = fetchurl {
url = "https://dist.torproject.org/${pname}-${version}.tar.gz"; url = "https://dist.torproject.org/tor-${finalAttrs.version}.tar.gz";
sha256 = "sha256-ebRyXh1LiHueaP0JsNIkN3fVzjzUceU4WDvPb52M21Y="; hash = "sha256-ebRyXh1LiHueaP0JsNIkN3fVzjzUceU4WDvPb52M21Y=";
}; };
outputs = [ outputs = [
@ -63,6 +66,7 @@ stdenv.mkDerivation rec {
]; ];
nativeBuildInputs = [ pkg-config ]; nativeBuildInputs = [ pkg-config ];
buildInputs = buildInputs =
[ [
libevent libevent
@ -98,8 +102,7 @@ stdenv.mkDerivation rec {
postPatch = '' postPatch = ''
substituteInPlace contrib/client-tools/torify \ substituteInPlace contrib/client-tools/torify \
--replace 'pathfind torsocks' true \ --replace-fail 'exec torsocks' 'exec ${torsocks}/bin/torsocks'
--replace 'exec torsocks' 'exec ${torsocks}/bin/torsocks'
patchShebangs ./scripts/maint/checkShellScripts.sh patchShebangs ./scripts/maint/checkShellScripts.sh
''; '';
@ -117,6 +120,10 @@ stdenv.mkDerivation rec {
ln -s ${tor-client-auth-gen} $out/bin/tor-client-auth-gen ln -s ${tor-client-auth-gen} $out/bin/tor-client-auth-gen
''; '';
doInstallCheck = true;
nativeInstallCheckInputs = [ versionCheckHook ];
versionCheckProgramArg = "--version";
passthru = { passthru = {
tests.tor = nixosTests.tor; tests.tor = nixosTests.tor;
updateScript = import ./update.nix { updateScript = import ./update.nix {
@ -135,10 +142,9 @@ stdenv.mkDerivation rec {
}; };
}; };
meta = with lib; { meta = {
homepage = "https://www.torproject.org/"; homepage = "https://www.torproject.org/";
description = "Anonymizing overlay network"; description = "Anonymizing overlay network";
longDescription = '' longDescription = ''
Tor helps improve your privacy by bouncing your communications around a Tor helps improve your privacy by bouncing your communications around a
network of relays run by volunteers all around the world: it makes it network of relays run by volunteers all around the world: it makes it
@ -148,17 +154,16 @@ stdenv.mkDerivation rec {
instant messaging clients, remote login, and other applications based on instant messaging clients, remote login, and other applications based on
the TCP protocol. the TCP protocol.
''; '';
license = with lib.licenses; [
license = with licenses; [
bsd3 bsd3
gpl3Only gpl3Only
]; ];
mainProgram = "tor";
maintainers = with maintainers; [ maintainers = with lib.maintainers; [
thoughtpolice thoughtpolice
joachifm joachifm
prusnak prusnak
]; ];
platforms = platforms.unix; platforms = lib.platforms.unix;
}; };
} })