From 7a7bc19384c1798c4a530d62c0260be987309baa Mon Sep 17 00:00:00 2001 From: nayeko <196556004+nayeko@users.noreply.github.com> Date: Sat, 15 Feb 2025 01:47:37 +0000 Subject: [PATCH 1/3] gui-for-singbox: add update script --- pkgs/by-name/gu/gui-for-singbox/package.nix | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pkgs/by-name/gu/gui-for-singbox/package.nix b/pkgs/by-name/gu/gui-for-singbox/package.nix index 1ba42e4decf9..761a4bce8484 100644 --- a/pkgs/by-name/gu/gui-for-singbox/package.nix +++ b/pkgs/by-name/gu/gui-for-singbox/package.nix @@ -13,6 +13,7 @@ makeDesktopItem, copyDesktopItems, replaceVars, + nix-update-script, }: let pname = "gui-for-singbox"; @@ -127,6 +128,16 @@ buildGoModule { runHook postInstall ''; + passthru = { + inherit frontend; + updateScript = nix-update-script { + extraArgs = [ + "--subpackage" + "frontend" + ]; + }; + }; + meta = { description = "SingBox GUI program developed by vue3 + wails"; homepage = "https://github.com/GUI-for-Cores/GUI.for.SingBox"; From 14788b087235eb58d151b883274e7b09f751e7d0 Mon Sep 17 00:00:00 2001 From: nayeko <196556004+nayeko@users.noreply.github.com> Date: Sat, 15 Feb 2025 01:48:51 +0000 Subject: [PATCH 2/3] gui-for-singbox: refactor --- pkgs/by-name/gu/gui-for-singbox/package.nix | 55 ++++++++++----------- 1 file changed, 27 insertions(+), 28 deletions(-) diff --git a/pkgs/by-name/gu/gui-for-singbox/package.nix b/pkgs/by-name/gu/gui-for-singbox/package.nix index 761a4bce8484..cc840fae3962 100644 --- a/pkgs/by-name/gu/gui-for-singbox/package.nix +++ b/pkgs/by-name/gu/gui-for-singbox/package.nix @@ -12,12 +12,12 @@ autoPatchelfHook, makeDesktopItem, copyDesktopItems, - replaceVars, nix-update-script, }: + let pname = "gui-for-singbox"; - version = "1.9.0"; + version = "1.9.2"; src = fetchFromGitHub { owner = "GUI-for-Cores"; @@ -26,6 +26,14 @@ let hash = "sha256-5zd4CVWVR+E3E097Xjd/V6QFRV9Ye2UQvBalAQ9zqXc="; }; + metaCommon = { + description = "SingBox GUI program developed by vue3 + wails"; + homepage = "https://github.com/GUI-for-Cores/GUI.for.SingBox"; + license = with lib.licenses; [ gpl3Plus ]; + maintainers = with lib.maintainers; [ ]; + platforms = lib.platforms.linux; + }; + frontend = stdenv.mkDerivation (finalAttrs: { inherit pname version src; @@ -53,19 +61,15 @@ let installPhase = '' runHook preInstall - cp -r ./dist $out + cp -r dist $out runHook postInstall ''; - meta = { - description = "GUI program developed by vue3"; - license = with lib.licenses; [ gpl3Plus ]; - maintainers = with lib.maintainers; [ ]; - platforms = lib.platforms.linux; - }; + meta = metaCommon; }); in + buildGoModule { inherit pname version src; @@ -91,6 +95,18 @@ buildGoModule { libsoup_3 ]; + preBuild = '' + cp -r ${frontend} frontend/dist + ''; + + buildPhase = '' + runHook preBuild + + wails build -m -s -trimpath -skipbindings -devtools -tags webkit2_40 -o GUI.for.SingBox + + runHook postBuild + ''; + desktopItems = [ (makeDesktopItem { name = "gui-for-singbox"; @@ -107,22 +123,10 @@ buildGoModule { }) ]; - preBuild = '' - cp -r ${frontend} ./frontend/dist - ''; - - buildPhase = '' - runHook preBuild - - wails build -m -s -trimpath -skipbindings -devtools -tags webkit2_40 -o GUI.for.SingBox - - runHook postBuild - ''; - installPhase = '' runHook preInstall - install -Dm 0755 ./build/bin/GUI.for.SingBox $out/bin/GUI.for.SingBox + install -Dm 0755 build/bin/GUI.for.SingBox $out/bin/GUI.for.SingBox install -Dm 0644 build/appicon.png $out/share/pixmaps/gui-for-singbox.png runHook postInstall @@ -138,12 +142,7 @@ buildGoModule { }; }; - meta = { - description = "SingBox GUI program developed by vue3 + wails"; - homepage = "https://github.com/GUI-for-Cores/GUI.for.SingBox"; + meta = metaCommon // { mainProgram = "GUI.for.SingBox"; - license = with lib.licenses; [ gpl3Plus ]; - maintainers = with lib.maintainers; [ ]; - platforms = lib.platforms.linux; }; } From 00f89f127fe13b3df3efd2d62f9f6c53c9a24c80 Mon Sep 17 00:00:00 2001 From: nayeko <196556004+nayeko@users.noreply.github.com> Date: Sat, 15 Feb 2025 01:49:14 +0000 Subject: [PATCH 3/3] gui-for-singbox: 1.9.0 -> 1.9.3 --- pkgs/by-name/gu/gui-for-singbox/package.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkgs/by-name/gu/gui-for-singbox/package.nix b/pkgs/by-name/gu/gui-for-singbox/package.nix index cc840fae3962..3508b7719516 100644 --- a/pkgs/by-name/gu/gui-for-singbox/package.nix +++ b/pkgs/by-name/gu/gui-for-singbox/package.nix @@ -17,13 +17,13 @@ let pname = "gui-for-singbox"; - version = "1.9.2"; + version = "1.9.3"; src = fetchFromGitHub { owner = "GUI-for-Cores"; repo = "GUI.for.SingBox"; tag = "v${version}"; - hash = "sha256-5zd4CVWVR+E3E097Xjd/V6QFRV9Ye2UQvBalAQ9zqXc="; + hash = "sha256-3ZSQoSXa9ma+r6y/xQGPjDw3BryH/s3TEEN2KptN+f8="; }; metaCommon = { @@ -45,7 +45,7 @@ let pnpmDeps = pnpm_9.fetchDeps { inherit (finalAttrs) pname version src; sourceRoot = "${finalAttrs.src.name}/frontend"; - hash = "sha256-dLI1YMzs9lLk9lJBkBgc6cpirM79khy0g5VaOVEzUAc="; + hash = "sha256-IljvA3vVD7RXULPWvKJPp4fi094SDDPs/AlxJKOk6OY="; }; sourceRoot = "${finalAttrs.src.name}/frontend"; @@ -81,7 +81,7 @@ buildGoModule { --replace-fail '@basepath@' "$out" ''; - vendorHash = "sha256-OrysyJF+lUMf+0vWmOZHjxUdE6fQCKArmpV4alXxtYs="; + vendorHash = "sha256-Ft3qkxCAkNIqTapqT4g8w0L8VV3z30GwWb17kGr03jw="; nativeBuildInputs = [ wails