From c313786f52321a8691cdd42c736fb14cde331260 Mon Sep 17 00:00:00 2001 From: jetcookies <226018678+jetcookies@users.noreply.github.com> Date: Mon, 16 Feb 2026 01:46:30 +0800 Subject: [PATCH] build(package.nix): revert to stable version '0.3.1' --- package.nix | 85 +++++++++++++++++++++++++++-------------------------- 1 file changed, 44 insertions(+), 41 deletions(-) diff --git a/package.nix b/package.nix index a6e54c8..666d8ce 100644 --- a/package.nix +++ b/package.nix @@ -1,80 +1,83 @@ { lib, - stdenv, rustPlatform, + buildNpmPackage, fetchFromGitHub, makeDesktopItem, pkg-config, + cargo-tauri, + wrapGAppsHook3, copyDesktopItems, - makeWrapper, + glib, + gtk3, + openssl, hidapi, pcsclite, udev, - alsa-lib, - libxkbcommon, - wayland, - libGL, - vulkan-loader, - libx11, - libxcb, - - withGLES ? false, + webkitgtk_4_1, }: -assert withGLES -> stdenv.hostPlatform.isLinux; rustPlatform.buildRustPackage (finalAttrs: { pname = "picoforge"; - version = "0.3.1-unstable-2026-02-08"; + version = "0.3.1"; src = fetchFromGitHub { owner = "librekeys"; repo = "picoforge"; - rev = "430aec1f3429ee8b89470f78d6db8c22c5de7db4"; - hash = "sha256-BWLLmINoKC+nIuY8KWfzhOnYtuo2KrbHd2jdappPyuE="; + rev = "v${finalAttrs.version}"; + hash = "sha256-v3N/E80mS8KZafWJ5T6BD3+O9LL+iwNXFEThbo4Lf0Y="; }; - cargoHash = "sha256-be0ycwwDxlBaKxQsTGidZC0loFh91HXMpr0jMHfbAd4="; + cargoRoot = "src-tauri"; + buildAndTestSubdir = finalAttrs.cargoRoot; + + cargoHash = "sha256-DB54egPebUniP/yjEZc+/AY9vOChJRBA+tqnbISmEgg="; + + postPatch = '' + sed -i src-tauri/tauri.conf.json -e '/beforeBuildCommand/d' + ''; nativeBuildInputs = [ pkg-config + cargo-tauri.hook + wrapGAppsHook3 copyDesktopItems - ] - ++ lib.optionals stdenv.hostPlatform.isLinux [ - makeWrapper ]; - gpu-lib = if withGLES then libGL else vulkan-loader; - buildInputs = [ + glib + gtk3 + openssl hidapi pcsclite udev - ] - ++ lib.optionals stdenv.hostPlatform.isLinux [ - alsa-lib - libxkbcommon - wayland - finalAttrs.gpu-lib - libx11 - libxcb + webkitgtk_4_1 ]; - postInstall = '' - install -Dm644 ${finalAttrs.src}/static/appIcons/in.suyogtandel.picoforge.svg $out/share/icons/hicolor/scalable/apps/picoforge.svg + frontendDist = buildNpmPackage { + name = "${finalAttrs.pname}-${finalAttrs.version}-frontend-dist"; + inherit (finalAttrs) src; + + npmDepsHash = "sha256-yCs/Fvtf0m5eW/m+Revzn3q1P7wwkwinUBHLOcV06/M="; + + installPhase = '' + runHook preInstall + + mkdir -p $out + cp -r build/* $out + + runHook postInstall + ''; + }; + + preBuild = '' + cp -r ${finalAttrs.frontendDist} build ''; - postFixup = lib.optionalString stdenv.hostPlatform.isLinux '' - wrapProgram $out/bin/picoforge --prefix LD_LIBRARY_PATH : "${ - lib.makeLibraryPath [ - wayland - libxkbcommon - finalAttrs.gpu-lib - libx11 - libxcb - ] - }" + postInstall = '' + install -Dm644 ${finalAttrs.src}/static/in.suyogtandel.picoforge.svg $out/share/icons/hicolor/scalable/apps/picoforge.svg ''; desktopItems = [