2024-09-14 18:47:09 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
stdenv,
|
|
|
|
buildGoModule,
|
|
|
|
fetchFromGitHub,
|
|
|
|
fetchYarnDeps,
|
|
|
|
symlinkJoin,
|
|
|
|
|
|
|
|
yarnConfigHook,
|
|
|
|
yarnBuildHook,
|
|
|
|
nodejs,
|
|
|
|
|
|
|
|
makeWrapper,
|
|
|
|
v2ray,
|
|
|
|
v2ray-geoip,
|
|
|
|
v2ray-domain-list-community,
|
2022-12-06 15:32:04 +00:00
|
|
|
}:
|
|
|
|
let
|
|
|
|
pname = "v2raya";
|
2024-09-28 17:51:32 +00:00
|
|
|
version = "2.2.5.8";
|
2023-02-03 02:21:56 +00:00
|
|
|
|
2022-12-06 15:32:04 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "v2rayA";
|
|
|
|
repo = "v2rayA";
|
2024-09-14 18:47:09 +00:00
|
|
|
rev = "refs/tags/v${version}";
|
2024-09-28 17:51:32 +00:00
|
|
|
hash = "sha256-yFN7mG5qS7BAuCSvSSZFFiyytd7XZ4kJvctc8cU72Oc=";
|
2023-07-15 09:26:24 +00:00
|
|
|
postFetch = "sed -i -e 's/npmmirror/yarnpkg/g' $out/gui/yarn.lock";
|
2022-12-06 15:32:04 +00:00
|
|
|
};
|
2023-02-03 02:21:56 +00:00
|
|
|
|
2024-09-14 18:47:09 +00:00
|
|
|
web = stdenv.mkDerivation {
|
|
|
|
inherit pname version src;
|
2023-07-15 09:26:24 +00:00
|
|
|
|
2024-09-14 18:47:09 +00:00
|
|
|
sourceRoot = "${src.name}/gui";
|
2023-07-15 09:26:24 +00:00
|
|
|
|
|
|
|
offlineCache = fetchYarnDeps {
|
2024-09-14 18:47:09 +00:00
|
|
|
yarnLock = "${src}/gui/yarn.lock";
|
|
|
|
hash = "sha256-AZIYkW2u1l9IaDpR9xiKNpc0sGAarLKwHf5kGnzdpKw=";
|
2023-07-15 09:26:24 +00:00
|
|
|
};
|
|
|
|
|
2024-09-14 18:47:09 +00:00
|
|
|
env.OUTPUT_DIR = placeholder "out";
|
2023-07-15 09:26:24 +00:00
|
|
|
|
2024-09-14 18:47:09 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
yarnConfigHook
|
|
|
|
yarnBuildHook
|
|
|
|
nodejs
|
|
|
|
];
|
2022-12-06 15:32:04 +00:00
|
|
|
};
|
2023-02-03 02:21:56 +00:00
|
|
|
|
|
|
|
assetsDir = symlinkJoin {
|
|
|
|
name = "assets";
|
2024-09-14 18:47:09 +00:00
|
|
|
paths = [
|
|
|
|
v2ray-geoip
|
|
|
|
v2ray-domain-list-community
|
|
|
|
];
|
2023-02-03 02:21:56 +00:00
|
|
|
};
|
|
|
|
|
2022-12-06 15:32:04 +00:00
|
|
|
in
|
|
|
|
buildGoModule {
|
2024-09-14 18:47:09 +00:00
|
|
|
inherit pname version src;
|
|
|
|
|
|
|
|
sourceRoot = "${src.name}/service";
|
2023-02-03 02:21:56 +00:00
|
|
|
|
2024-09-28 17:51:32 +00:00
|
|
|
vendorHash = "sha256-Oa7YmxcZr5scbhNeqGxJOkryL2uHQQ3RkLGWJaIXq3s=";
|
2023-02-03 02:21:56 +00:00
|
|
|
|
2022-12-06 15:32:04 +00:00
|
|
|
ldflags = [
|
|
|
|
"-s"
|
|
|
|
"-w"
|
|
|
|
"-X github.com/v2rayA/v2rayA/conf.Version=${version}"
|
|
|
|
];
|
2023-02-03 02:21:56 +00:00
|
|
|
|
2022-12-06 15:32:04 +00:00
|
|
|
subPackages = [ "." ];
|
2023-02-03 02:21:56 +00:00
|
|
|
|
2022-12-06 15:32:04 +00:00
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
2024-09-14 18:47:09 +00:00
|
|
|
|
2022-12-06 15:32:04 +00:00
|
|
|
preBuild = ''
|
|
|
|
cp -a ${web} server/router/web
|
|
|
|
'';
|
2023-02-03 02:21:56 +00:00
|
|
|
|
2022-12-06 15:32:04 +00:00
|
|
|
postInstall = ''
|
2024-09-14 18:47:09 +00:00
|
|
|
install -Dm 444 ../install/universal/v2raya.desktop -t $out/share/applications
|
|
|
|
install -Dm 444 ../install/universal/v2raya.png -t $out/share/icons/hicolor/512x512/apps
|
2022-12-06 15:32:04 +00:00
|
|
|
substituteInPlace $out/share/applications/v2raya.desktop \
|
2024-09-14 18:47:09 +00:00
|
|
|
--replace-fail 'Icon=/usr/share/icons/hicolor/512x512/apps/v2raya.png' 'Icon=v2raya'
|
2022-12-06 15:32:04 +00:00
|
|
|
|
|
|
|
wrapProgram $out/bin/v2rayA \
|
|
|
|
--prefix PATH ":" "${lib.makeBinPath [ v2ray ]}" \
|
2023-02-03 02:21:56 +00:00
|
|
|
--prefix XDG_DATA_DIRS ":" ${assetsDir}/share
|
2022-12-06 15:32:04 +00:00
|
|
|
'';
|
2023-02-03 02:21:56 +00:00
|
|
|
|
2022-12-06 15:32:04 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "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;
|
2024-03-06 20:28:49 +00:00
|
|
|
maintainers = with maintainers; [ ChaosAttractor ];
|
2022-12-06 15:32:04 +00:00
|
|
|
};
|
|
|
|
}
|