mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-01-08 14:03:29 +00:00
e0464e4788
In preparation for the deprecation of `stdenv.isX`. These shorthands are not conducive to cross-compilation because they hide the platforms. Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way One example of why this is bad and especially affects compiler packages https://www.github.com/NixOS/nixpkgs/pull/343059 There are too many files to go through manually but a treewide should get users thinking when they see a `hostPlatform.isX` in a place where it doesn't make sense. ``` fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is" fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is" ```
83 lines
2.2 KiB
Nix
83 lines
2.2 KiB
Nix
{ lib
|
|
, stdenv
|
|
, cscope
|
|
, fetchFromGitHub
|
|
, fetchpatch
|
|
, git
|
|
, libevent
|
|
, libopus
|
|
, libsodium
|
|
, libtoxcore
|
|
, libvpx
|
|
, msgpack
|
|
, pkg-config
|
|
, python3
|
|
, python3Packages
|
|
}:
|
|
|
|
stdenv.mkDerivation rec {
|
|
pname = "tuntox";
|
|
version = "0.0.10";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "gjedeer";
|
|
repo = pname;
|
|
rev = version;
|
|
sha256 = "sha256-c/0OxUH8iw8nRuVg4Fszf6Z/JiEV+m0B2ofzy81uFu8=";
|
|
};
|
|
|
|
nativeBuildInputs = [ cscope git pkg-config ];
|
|
|
|
buildInputs = [ libopus libtoxcore libsodium libevent libvpx msgpack python3 ];
|
|
|
|
pythonBuildInputs = with python3Packages; [
|
|
jinja2
|
|
requests
|
|
];
|
|
|
|
patches = [
|
|
# https://github.com/gjedeer/tuntox/pull/67
|
|
(fetchpatch {
|
|
url = "https://github.com/gjedeer/tuntox/compare/a646402f42e120c7148d4de29dbdf5b09027a80a..365d2e5cbc0e3655fb64c204db0515f5f4cdf5a4.patch";
|
|
sha256 = "sha256-P3uIRnV+pBi3s3agGYUMt2PZU4CRxx/DUR8QPVQ+UN8=";
|
|
})
|
|
];
|
|
|
|
postPatch = ''
|
|
substituteInPlace gitversion.h --replace '7d45afdf7d00a95a8c3687175e2b1669fa1f7745' '365d2e5cbc0e3655fb64c204db0515f5f4cdf5a4'
|
|
'' + lib.optionalString stdenv.hostPlatform.isLinux ''
|
|
substituteInPlace Makefile --replace ' -static ' ' '
|
|
substituteInPlace Makefile --replace 'CC=gcc' ' '
|
|
'' + lib.optionalString stdenv.hostPlatform.isDarwin ''
|
|
substituteInPlace Makefile.mac --replace '.git/HEAD .git/index' ' '
|
|
substituteInPlace Makefile.mac --replace '/usr/local/lib/libtoxcore.a' '${libtoxcore}/lib/libtoxcore.a'
|
|
substituteInPlace Makefile.mac --replace '/usr/local/lib/libsodium.a' '${libsodium}/lib/libsodium.dylib'
|
|
substituteInPlace Makefile.mac --replace 'CC=gcc' ' '
|
|
'';
|
|
|
|
buildPhase = ''
|
|
'' + lib.optionalString stdenv.hostPlatform.isLinux ''
|
|
make
|
|
'' + lib.optionalString stdenv.hostPlatform.isDarwin ''
|
|
make -f Makefile.mac tuntox
|
|
'';
|
|
|
|
installPhase = ''
|
|
mkdir -p $out/bin
|
|
mv tuntox $out/bin/
|
|
'';
|
|
|
|
doCheck = false;
|
|
|
|
meta = with lib; {
|
|
description = "Tunnel TCP connections over the Tox protocol";
|
|
mainProgram = "tuntox";
|
|
homepage = "https://github.com/gjedeer/tuntox";
|
|
license = licenses.gpl3;
|
|
maintainers = with maintainers; [
|
|
willcohen
|
|
];
|
|
platforms = platforms.unix;
|
|
};
|
|
}
|