2022-12-17 10:02:37 +00:00
|
|
|
{ lib
|
|
|
|
, fetchFromGitHub
|
|
|
|
, mkYarnPackage
|
|
|
|
, buildGoModule
|
|
|
|
, makeWrapper
|
|
|
|
, v2ray
|
|
|
|
, v2ray-geoip
|
|
|
|
, v2ray-domain-list-community
|
|
|
|
, symlinkJoin
|
|
|
|
}:
|
|
|
|
let
|
|
|
|
pname = "v2raya";
|
2023-03-24 00:07:29 +00:00
|
|
|
version = "2.0.2";
|
2023-02-22 10:55:15 +00:00
|
|
|
|
2022-12-17 10:02:37 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "v2rayA";
|
|
|
|
repo = "v2rayA";
|
|
|
|
rev = "v${version}";
|
2023-03-24 00:07:29 +00:00
|
|
|
sha256 = "sha256-C7N23s/GA66gQ5SVXtXcM9lXIjScR3pLYCrf0w2nHfY=";
|
2022-12-17 10:02:37 +00:00
|
|
|
};
|
2023-02-22 10:55:15 +00:00
|
|
|
|
2022-12-17 10:02:37 +00:00
|
|
|
web = mkYarnPackage {
|
|
|
|
inherit pname version;
|
|
|
|
src = "${src}/gui";
|
|
|
|
yarnNix = ./yarn.nix;
|
|
|
|
packageJSON = ./package.json;
|
|
|
|
yarnLock = ./yarn.lock;
|
|
|
|
buildPhase = ''
|
|
|
|
export NODE_OPTIONS=--openssl-legacy-provider
|
|
|
|
ln -s $src/postcss.config.js postcss.config.js
|
|
|
|
OUTPUT_DIR=$out yarn --offline build
|
|
|
|
'';
|
|
|
|
distPhase = "true";
|
|
|
|
dontInstall = true;
|
|
|
|
dontFixup = true;
|
|
|
|
};
|
2023-02-22 10:55:15 +00:00
|
|
|
|
|
|
|
assetsDir = symlinkJoin {
|
|
|
|
name = "assets";
|
|
|
|
paths = [ v2ray-geoip v2ray-domain-list-community ];
|
|
|
|
};
|
|
|
|
|
2022-12-17 10:02:37 +00:00
|
|
|
in
|
|
|
|
buildGoModule {
|
|
|
|
inherit pname version;
|
2023-02-22 10:55:15 +00:00
|
|
|
|
2022-12-17 10:02:37 +00:00
|
|
|
src = "${src}/service";
|
2023-03-24 00:07:29 +00:00
|
|
|
vendorSha256 = "sha256-vnhqI9G/p+SLLA4sre2wfmg1RKIYZmzeL0pSTbHb+Ck=";
|
2023-02-22 10:55:15 +00:00
|
|
|
|
2022-12-17 10:02:37 +00:00
|
|
|
ldflags = [
|
|
|
|
"-s"
|
|
|
|
"-w"
|
|
|
|
"-X github.com/v2rayA/v2rayA/conf.Version=${version}"
|
|
|
|
];
|
2023-02-22 10:55:15 +00:00
|
|
|
|
2022-12-17 10:02:37 +00:00
|
|
|
subPackages = [ "." ];
|
2023-02-22 10:55:15 +00:00
|
|
|
|
2022-12-17 10:02:37 +00:00
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
|
|
preBuild = ''
|
|
|
|
cp -a ${web} server/router/web
|
|
|
|
'';
|
2023-02-22 10:55:15 +00:00
|
|
|
|
2022-12-17 10:02:37 +00:00
|
|
|
postInstall = ''
|
|
|
|
install -Dm 444 ${src}/install/universal/v2raya.desktop -t $out/share/applications
|
|
|
|
install -Dm 444 ${src}/install/universal/v2raya.png -t $out/share/icons/hicolor/512x512/apps
|
|
|
|
substituteInPlace $out/share/applications/v2raya.desktop \
|
|
|
|
--replace 'Icon=/usr/share/icons/hicolor/512x512/apps/v2raya.png' 'Icon=v2raya'
|
|
|
|
|
|
|
|
wrapProgram $out/bin/v2rayA \
|
|
|
|
--prefix PATH ":" "${lib.makeBinPath [ v2ray ]}" \
|
2023-02-22 10:55:15 +00:00
|
|
|
--prefix XDG_DATA_DIRS ":" ${assetsDir}/share
|
2022-12-17 10:02:37 +00:00
|
|
|
'';
|
2023-02-22 10:55:15 +00:00
|
|
|
|
2022-12-17 10:02:37 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "A Linux web GUI client of Project V which supports V2Ray, Xray, SS, SSR, Trojan and Pingtunnel";
|
|
|
|
homepage = "https://github.com/v2rayA/v2rayA";
|
|
|
|
mainProgram = "v2rayA";
|
|
|
|
license = licenses.agpl3Only;
|
|
|
|
platforms = platforms.linux;
|
|
|
|
maintainers = with maintainers; [ elliot ];
|
|
|
|
};
|
|
|
|
}
|