{ lib, rustPlatform, fetchFromGitHub, curl, pkg-config, wrapGAppsHook, atk, bzip2, cairo, gdk-pixbuf, glib, gtk3, libusb, libxkbcommon, openssl, pango, udev, vulkan-loader, zlib, stdenv, darwin, wayland, autoPatchelfHook, makeWrapper, libGL, }: rustPlatform.buildRustPackage rec { pname = "pineflash"; version = "1cbe5547e19789e26faaef176c3d22a51e457e88"; src = fetchFromGitHub { owner = "Spagett1"; repo = "PineFlash"; rev = version; hash = "sha256-Cw2P/CNP6hn44RogAtqlXXNlDygE+ax3oUZ6F2tlFBw="; fetchSubmodules = true; }; cargoHash = "sha256-x+7lqnv8UF1hcRkj4Uu7RCSDDx0vHOKumFfyRn6M/ao="; nativeBuildInputs = [ curl pkg-config wrapGAppsHook autoPatchelfHook makeWrapper ]; buildInputs = [ atk bzip2 cairo curl gdk-pixbuf glib gtk3 libusb libxkbcommon openssl pango udev vulkan-loader zlib ] ++ lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.AppKit darwin.apple_sdk.frameworks.CoreFoundation darwin.apple_sdk.frameworks.CoreGraphics darwin.apple_sdk.frameworks.CoreServices darwin.apple_sdk.frameworks.Foundation darwin.apple_sdk.frameworks.Metal darwin.apple_sdk.frameworks.QuartzCore darwin.apple_sdk.frameworks.Security darwin.apple_sdk.frameworks.SystemConfiguration ] ++ lib.optionals stdenv.isLinux [ wayland ]; patches = [ # remove when merged: https://github.com/Spagett1/pineflash/pull/86 ./fix-nix-issues.patch ]; preFixup = '' wrapProgram $out/bin/pineflash \ --prefix LD_LIBRARY_PATH : ${ lib.makeLibraryPath [ wayland libGL libxkbcommon ] } \ --set RUST_SRC_PATH "${rustPlatform.rustLibSrc}" ''; meta = { description = "A tool to flash ironos to the pinecil soldering iron and possibly other pine64 devices in the future"; homepage = "https://github.com/Spagett1/PineFlash"; license = lib.licenses.gpl3Only; maintainers = with lib.maintainers; [ ]; mainProgram = "pineflash"; }; }