nixpkgs/pkgs/applications/networking/qv2ray/default.nix
Artturin e0464e4788 treewide: replace stdenv.is with stdenv.hostPlatform.is
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"
```
2024-09-25 00:04:37 +03:00

83 lines
1.8 KiB
Nix

{ lib
, stdenv
, mkDerivation
, fetchFromGitHub
, symlinkJoin
, qttools
, cmake
, grpc
, protobuf
, openssl
, pkg-config
, c-ares
, libGL
, zlib
, curl
, v2ray
, v2ray-geoip, v2ray-domain-list-community
, assets ? [ v2ray-geoip v2ray-domain-list-community ]
}:
mkDerivation rec {
pname = "qv2ray";
version = "unstable-2023-07-11";
src = fetchFromGitHub {
owner = "Qv2ray";
repo = "Qv2ray";
rev = "b3080564809dd8aef864a54ca1b79f0984fe986b";
hash = "sha256-LwBjuX5x3kQcdEfPLEirWpkMqOigkhNoh/VNmBfPAzw=";
fetchSubmodules = true;
};
postPatch = lib.optionals stdenv.hostPlatform.isDarwin ''
substituteInPlace cmake/platforms/macos.cmake \
--replace \''${QV2RAY_QtX_DIR}/../../../bin/macdeployqt macdeployqt
'';
assetsDrv = symlinkJoin {
name = "v2ray-assets";
paths = assets;
};
cmakeFlags = [
"-DQV2RAY_DISABLE_AUTO_UPDATE=on"
"-DQV2RAY_USE_V5_CORE=on"
"-DQV2RAY_TRANSLATION_PATH=${placeholder "out"}/share/qv2ray/lang"
"-DQV2RAY_DEFAULT_VASSETS_PATH='${assetsDrv}/share/v2ray'"
"-DQV2RAY_DEFAULT_VCORE_PATH='${v2ray}/bin/v2ray'"
];
preConfigure = ''
export _QV2RAY_BUILD_INFO_="Qv2ray Nixpkgs"
export _QV2RAY_BUILD_EXTRA_INFO_="(Nixpkgs build) nixpkgs"
'';
buildInputs = [
libGL
zlib
grpc
protobuf
openssl
c-ares
];
nativeBuildInputs = [
cmake
pkg-config
qttools
curl
];
meta = with lib; {
description = "GUI frontend to v2ray";
homepage = "https://github.com/Qv2ray/Qv2ray";
license = licenses.gpl3Plus;
maintainers = with maintainers; [ poscat rewine ];
platforms = platforms.all;
# never built on aarch64-darwin, x86_64-darwin since update to unstable-2022-09-25
broken = stdenv.hostPlatform.isDarwin;
mainProgram = "qv2ray";
};
}