Files
nixpkgs/pkgs/by-name/v2/v2ray/package.nix
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

79 lines
1.8 KiB
Nix

{
lib,
fetchFromGitHub,
symlinkJoin,
buildGoModule,
makeWrapper,
nixosTests,
nix-update-script,
v2ray-geoip,
v2ray-domain-list-community,
assets ? [
v2ray-geoip
v2ray-domain-list-community
],
}:
buildGoModule rec {
pname = "v2ray-core";
version = "5.40.0";
src = fetchFromGitHub {
owner = "v2fly";
repo = "v2ray-core";
rev = "v${version}";
hash = "sha256-pb9kZEdGkT2B1MhNnneAi4oP3aqYkgY86dodInorSbA=";
};
# `nix-update` doesn't support `vendorHash` yet.
# https://github.com/Mic92/nix-update/pull/95
vendorHash = "sha256-lphbRsPc8lSf8BzcfcFnh3Z+Wa9wJe98I3VE5ZoQHBE=";
ldflags = [
"-s"
"-w"
];
subPackages = [ "main" ];
nativeBuildInputs = [ makeWrapper ];
installPhase = ''
runHook preInstall
install -Dm555 "$GOPATH"/bin/main $out/bin/v2ray
install -Dm444 release/config/systemd/system/v2ray{,@}.service -t $out/lib/systemd/system
install -Dm444 release/config/*.json -t $out/etc/v2ray
runHook postInstall
'';
assetsDrv = symlinkJoin {
name = "v2ray-assets";
paths = assets;
};
postFixup = ''
wrapProgram $out/bin/v2ray \
--suffix XDG_DATA_DIRS : $assetsDrv/share
substituteInPlace $out/lib/systemd/system/*.service \
--replace User=nobody DynamicUser=yes \
--replace /usr/local/bin/ $out/bin/ \
--replace /usr/local/etc/ /etc/
'';
passthru = {
updateScript = nix-update-script { };
tests.simple-vmess-proxy-test = nixosTests.v2ray;
};
meta = {
homepage = "https://www.v2fly.org/en_US/";
description = "Platform for building proxies to bypass network restrictions";
mainProgram = "v2ray";
license = with lib.licenses; [ mit ];
maintainers = with lib.maintainers; [
servalcatty
ryan4yin
];
};
}