nym: init at 0.6.0

authored by

hyperfekt and committed by
Emery Hemingway
faa134cd 27b9b7b3

+93
+54
pkgs/applications/networking/nym/default.nix
··· 1 + { lib 2 + , rustPlatform 3 + , fetchFromGitHub 4 + , pkgconfig 5 + , openssl 6 + , libredirect 7 + , writeText 8 + }: 9 + 10 + rustPlatform.buildRustPackage rec { 11 + pname = "nym"; 12 + version = "0.6.0"; 13 + 14 + src = fetchFromGitHub { 15 + owner = "nymtech"; 16 + repo = "nym"; 17 + rev = "v${version}"; 18 + sha256 = "1q9i24mzys6a9kp9n0bnxr3iwzblabmc6iif3ah75gffyf0cipk4"; 19 + }; 20 + 21 + cargoSha256 = "0qas544bs4wyllvqf2r5mvqxs1nviwcvxa3rzq10dvjyjm1xyh3k"; 22 + 23 + nativeBuildInputs = [ pkgconfig ]; 24 + 25 + buildInputs = [ openssl ]; 26 + 27 + /* 28 + Nym's test presence::converting_mixnode_presence_into_topology_mixnode::it_returns_resolved_ip_on_resolvable_hostname tries to resolve nymtech.net. 29 + Since there is no external DNS resolution available in the build sandbox, we point cargo and its children (that's what we remove the 'unsetenv' call for) to a hosts file in which we statically resolve nymtech.net. 30 + */ 31 + preCheck = '' 32 + export LD_PRELOAD=${libredirect.overrideAttrs (drv: { 33 + postPatch = "sed -i -e /unsetenv/d libredirect.c"; 34 + })}/lib/libredirect.so 35 + export NIX_REDIRECTS=/etc/hosts=${writeText "nym_resolve_test_hosts" "127.0.0.1 nymtech.net"} 36 + ''; 37 + 38 + postCheck = "unset NIX_REDIRECTS LD_PRELOAD"; 39 + 40 + 41 + passthru.updateScript = ./update.sh; 42 + 43 + meta = with lib; { 44 + description = "A mixnet providing IP-level privacy"; 45 + longDescription = '' 46 + Nym routes IP packets through other participating nodes to hide their source and destination. 47 + In contrast with Tor, it prevents timing attacks at the cost of latency. 48 + ''; 49 + homepage = "https://nymtech.net"; 50 + license = licenses.asl20; 51 + maintainers = [ maintainers.ehmry ]; 52 + platforms = with platforms; intersectLists (linux ++ darwin) (x86 ++ x86_64); # see https://github.com/nymtech/nym/issues/179 for architectures 53 + }; 54 + }
+37
pkgs/applications/networking/nym/update.sh
··· 1 + #!/usr/bin/env nix-shell 2 + #!nix-shell -i bash -p curl jq nix-prefetch 3 + 4 + # adapted from rust-analyzer 5 + 6 + set -euo pipefail 7 + cd "$(dirname "$0")" 8 + nixpkgs=../../../.. 9 + 10 + owner=$(sed -nE 's/.*\bowner = "(.*)".*/\1/p' ./default.nix) 11 + repo=$(sed -nE 's/.*\brepo = "(.*)".*/\1/p' ./default.nix) 12 + rev=$( 13 + curl -s "https://api.github.com/repos/$owner/$repo/releases" | 14 + jq 'map(select(.prerelease | not)) | .[0].tag_name' --raw-output 15 + ) 16 + version=${rev:1} 17 + old_version=$(sed -nE 's/.*\bversion = "(.*)".*/\1/p' ./default.nix) 18 + if grep -q 'cargoSha256 = ""' ./default.nix; then 19 + old_version='broken' 20 + fi 21 + if [[ "$version" == "$old_version" ]]; then 22 + echo "Up to date: $version" 23 + exit 24 + fi 25 + echo "$old_version -> $version" 26 + 27 + sha256=$(nix-prefetch -f "$nixpkgs" nym.src --rev "$rev") 28 + # Clear cargoSha256 to avoid inconsistency. 29 + sed -e "s/version = \".*\"/version = \"$version\"/" \ 30 + -e "s/sha256 = \".*\"/sha256 = \"$sha256\"/" \ 31 + -e "s/cargoSha256 = \".*\"/cargoSha256 = \"\"/" \ 32 + --in-place ./default.nix 33 + 34 + echo "Prebuilding for cargoSha256" 35 + cargo_sha256=$(nix-prefetch "{ sha256 }: (import $nixpkgs {}).nym.cargoDeps.overrideAttrs (_: { outputHash = sha256; })") 36 + sed "s/cargoSha256 = \".*\"/cargoSha256 = \"$cargo_sha256\"/" \ 37 + --in-place ./default.nix
+2
pkgs/top-level/all-packages.nix
··· 5520 5520 5521 5521 nylon = callPackage ../tools/networking/nylon { }; 5522 5522 5523 + nym = callPackage ../applications/networking/nym { }; 5524 + 5523 5525 nzbget = callPackage ../tools/networking/nzbget { }; 5524 5526 5525 5527 oathToolkit = callPackage ../tools/security/oath-toolkit { };