Files
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

152 lines
3.0 KiB
Nix

{
lib,
stdenv,
buildGoModule,
fetchFromGitHub,
autoPatchelfHook,
copyDesktopItems,
nodejs,
pkg-config,
pnpm_10,
wails,
webkitgtk_4_1,
makeDesktopItem,
nix-update-script,
}:
let
pname = "gui-for-singbox";
version = "1.9.9";
src = fetchFromGitHub {
owner = "GUI-for-Cores";
repo = "GUI.for.SingBox";
tag = "v${version}";
hash = "sha256-6Y0eEJmPBp+J1r6LCxYEM6i3fdCYSo4LrimpqwOCVT8=";
};
metaCommon = {
homepage = "https://github.com/GUI-for-Cores/GUI.for.SingBox";
hydraPlatforms = [ ]; # https://gui-for-cores.github.io/guide/#note
license = with lib.licenses; [ gpl3Plus ];
maintainers = [ ];
};
frontend = stdenv.mkDerivation (finalAttrs: {
inherit pname version src;
sourceRoot = "${finalAttrs.src.name}/frontend";
nativeBuildInputs = [
nodejs
pnpm_10.configHook
];
pnpmDeps = pnpm_10.fetchDeps {
inherit (finalAttrs)
pname
version
src
sourceRoot
;
fetcherVersion = 2;
hash = "sha256-kSIPkXD0Wxe8TaKDd4DUAL7pkQeU8xyLY9K3lFSAODI=";
};
buildPhase = ''
runHook preBuild
pnpm run build-only
runHook postBuild
'';
installPhase = ''
runHook preInstall
cp -r dist $out
runHook postInstall
'';
meta = metaCommon // {
description = "GUI program developed by vue3";
platforms = lib.platforms.all;
};
});
in
buildGoModule {
inherit pname version src;
patches = [ ./xdg-path-and-restart-patch.patch ];
# As we need the $out reference, we can't use `replaceVars` here.
postPatch = ''
substituteInPlace bridge/bridge.go \
--subst-var out
'';
vendorHash = "sha256-UArCB5U2bF5HXFDU1oCfm+SaURe6e9gyCx+UjtWI/ug=";
nativeBuildInputs = [
autoPatchelfHook
copyDesktopItems
pkg-config
wails
];
buildInputs = [ webkitgtk_4_1 ];
preBuild = ''
cp -r ${frontend} frontend/dist
'';
buildPhase = ''
runHook preBuild
wails build -m -s -trimpath -skipbindings -devtools -tags webkit2_41 -o GUI.for.SingBox
runHook postBuild
'';
desktopItems = [
(makeDesktopItem {
name = "gui-for-singbox";
exec = "GUI.for.SingBox";
icon = "gui-for-singbox";
genericName = "GUI.for.SingBox";
desktopName = "GUI.for.SingBox";
categories = [ "Network" ];
keywords = [ "Proxy" ];
})
];
installPhase = ''
runHook preInstall
install -Dm 0755 build/bin/GUI.for.SingBox $out/bin/GUI.for.SingBox
install -Dm 0644 build/appicon.png $out/share/icons/hicolor/256x256/apps/gui-for-singbox.png
runHook postInstall
'';
passthru = {
inherit frontend;
updateScript = nix-update-script {
extraArgs = [
"--version-regex"
"^v([0-9.]+)$"
"--subpackage"
"frontend"
];
};
};
meta = metaCommon // {
description = "SingBox GUI program developed by vue3 + wails";
mainProgram = "GUI.for.SingBox";
platforms = lib.platforms.linux;
};
}