v2raya: remove mkYarnPackage usage (#341901)

This commit is contained in:
Peder Bergebakken Sundt
2024-09-18 02:26:27 +02:00
committed by GitHub
2 changed files with 39 additions and 99 deletions
+39 -40
View File
@@ -1,13 +1,19 @@
{ lib
, fetchFromGitHub
, mkYarnPackage
, buildGoModule
, makeWrapper
, v2ray
, v2ray-geoip
, v2ray-domain-list-community
, symlinkJoin
, fetchYarnDeps
{
lib,
stdenv,
buildGoModule,
fetchFromGitHub,
fetchYarnDeps,
symlinkJoin,
yarnConfigHook,
yarnBuildHook,
nodejs,
makeWrapper,
v2ray,
v2ray-geoip,
v2ray-domain-list-community,
}:
let
pname = "v2raya";
@@ -16,52 +22,44 @@ let
src = fetchFromGitHub {
owner = "v2rayA";
repo = "v2rayA";
rev = "v${version}";
rev = "refs/tags/v${version}";
hash = "sha256-tXVyroQ2yXwLe+OulvVQYgfd9EcC87S0L8d7w5gLnMI=";
postFetch = "sed -i -e 's/npmmirror/yarnpkg/g' $out/gui/yarn.lock";
};
guiSrc = "${src}/gui";
web = mkYarnPackage {
inherit pname version;
web = stdenv.mkDerivation {
inherit pname version src;
src = guiSrc;
packageJSON = ./package.json;
sourceRoot = "${src.name}/gui";
offlineCache = fetchYarnDeps {
yarnLock = "${guiSrc}/yarn.lock";
sha256 = "sha256-AZIYkW2u1l9IaDpR9xiKNpc0sGAarLKwHf5kGnzdpKw=";
yarnLock = "${src}/gui/yarn.lock";
hash = "sha256-AZIYkW2u1l9IaDpR9xiKNpc0sGAarLKwHf5kGnzdpKw=";
};
buildPhase = ''
runHook preBuild
OUTPUT_DIR=$out yarn --offline build
runHook postBuild
'';
env.OUTPUT_DIR = placeholder "out";
configurePhase = ''
runHook preConfigure
cp -r $node_modules node_modules
chmod +w node_modules
runHook postConfigure
'';
distPhase = "true";
dontInstall = true;
dontFixup = true;
nativeBuildInputs = [
yarnConfigHook
yarnBuildHook
nodejs
];
};
assetsDir = symlinkJoin {
name = "assets";
paths = [ v2ray-geoip v2ray-domain-list-community ];
paths = [
v2ray-geoip
v2ray-domain-list-community
];
};
in
buildGoModule {
inherit pname version;
inherit pname version src;
sourceRoot = "${src.name}/service";
src = "${src}/service";
vendorHash = "sha256-8MSNTKeN0N2/yaHnXsKmxzw9vRy+E5q60IpwLycqC2I=";
ldflags = [
@@ -73,15 +71,16 @@ buildGoModule {
subPackages = [ "." ];
nativeBuildInputs = [ makeWrapper ];
preBuild = ''
cp -a ${web} server/router/web
'';
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
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
substituteInPlace $out/share/applications/v2raya.desktop \
--replace 'Icon=/usr/share/icons/hicolor/512x512/apps/v2raya.png' 'Icon=v2raya'
--replace-fail 'Icon=/usr/share/icons/hicolor/512x512/apps/v2raya.png' 'Icon=v2raya'
wrapProgram $out/bin/v2rayA \
--prefix PATH ":" "${lib.makeBinPath [ v2ray ]}" \
-59
View File
@@ -1,59 +0,0 @@
{
"name": "v2raya",
"version": "0.1.0",
"private": true,
"license": "GPL-3.0",
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"resolutions": {
"@achrinza/node-ipc": "^10",
"@achrinza/event-pubsub": "^5"
},
"dependencies": {
"@achrinza/node-ipc": "^10.1.10",
"@mdi/font": "^5.8.55",
"@nuintun/qrcode": "^3.3.0",
"@vue/babel-preset-app": "^4.2.2",
"axios": "^0.21.1",
"buefy": "^0.9.22",
"clipboard": "^2.0.4",
"dayjs": "^1.10.6",
"js-base64": "^2.5.1",
"nanoid": "^3.1.23",
"normalize.css": "^8.0.1",
"pace-js": "^1.2.4",
"qrcode": "^1.4.2",
"register-service-worker": "^1.6.2",
"vue": "^2.7.14",
"vue-i18n": "^8.15.3",
"vue-router": "^3.0.6",
"vue-virtual-scroller": "^1.0.10",
"vuex": "^3.0.1",
"webpack-iconfont-plugin-nodejs": "^1.0.16"
},
"devDependencies": {
"@babel/core": "^7.12.16",
"@babel/eslint-parser": "^7.12.16",
"@vue/cli-plugin-babel": "~5.0.8",
"@vue/cli-plugin-eslint": "~5.0.8",
"@vue/cli-plugin-router": "~5.0.8",
"@vue/cli-plugin-vuex": "~5.0.8",
"@vue/cli-service": "~5.0.8",
"@vue/eslint-config-prettier": "^5.0.0",
"compression-webpack-plugin": "^10.0.0",
"css-loader": "^5.2.0",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-vue": "^8.0.3",
"highlight.js": "^11.4.0",
"prettier": "^2.4.1",
"sass": "^1.19.0",
"sass-loader": "^8.0.0",
"terser-webpack-plugin": "^5.3.6",
"urijs": "^1.19.11"
}
}