1 { lib, fetchFromGitHub, symlinkJoin, buildGoModule, makeWrapper, nixosTests
3 , v2ray-geoip, v2ray-domain-list-community
4 , assets ? [ v2ray-geoip v2ray-domain-list-community ]
11 src = fetchFromGitHub {
15 hash = "sha256-9YPFgsU1XpdT+fRaJmEB3z5sKjkrG3aiRIV3r4cDLfE=";
18 # `nix-update` doesn't support `vendorHash` yet.
19 # https://github.com/Mic92/nix-update/pull/95
20 vendorHash = "sha256-Z+jM02SzmpuZ3PXXqrLDIOWDhIh8AxMUr1S4A+du5LU=";
22 ldflags = [ "-s" "-w" ];
24 subPackages = [ "main" ];
26 nativeBuildInputs = [ makeWrapper ];
30 install -Dm555 "$GOPATH"/bin/main $out/bin/v2ray
31 install -Dm444 release/config/systemd/system/v2ray{,@}.service -t $out/lib/systemd/system
32 install -Dm444 release/config/*.json -t $out/etc/v2ray
36 assetsDrv = symlinkJoin {
37 name = "v2ray-assets";
42 wrapProgram $out/bin/v2ray \
43 --suffix XDG_DATA_DIRS : $assetsDrv/share
44 substituteInPlace $out/lib/systemd/system/*.service \
45 --replace User=nobody DynamicUser=yes \
46 --replace /usr/local/bin/ $out/bin/ \
47 --replace /usr/local/etc/ /etc/
51 updateScript = nix-update-script { };
52 tests.simple-vmess-proxy-test = nixosTests.v2ray;
56 homepage = "https://www.v2fly.org/en_US/";
57 description = "Platform for building proxies to bypass network restrictions";
58 mainProgram = "v2ray";
59 license = with lib.licenses; [ mit ];
60 maintainers = with lib.maintainers; [ servalcatty ];