{ lib, rustPlatform, fetchFromGitHub, makeWrapper, nix-update-script, # Not linked at build time — dlopen'd by the app at runtime (see postFixup). dbus, libglvnd, libx11, libxcursor, libxi, libxrandr, libxkbcommon, vulkan-loader, wayland, }: let # PhotoCraft reaches the windowing/graphics stack exclusively through # dlopen (wayland-sys, x11-dl, ash → libvulkan, glutin → libEGL/libGL): # Cargo.lock contains no native *-sys crate, so the build needs zero # buildInputs and these libraries are provided via LD_LIBRARY_PATH instead # (same pattern as neovide). dbus.lib is dlopen'd by rfd's xdg-desktop-portal # backend — without it, file dialogs fall back to zenity. runtimeLibs = [ dbus.lib libglvnd libx11 libxcursor libxi libxrandr libxkbcommon vulkan-loader wayland ]; in rustPlatform.buildRustPackage (finalAttrs: { pname = "photocraft"; version = "0.7.0"; # AppStream date of the GitHub release — bump together with `version`. releaseDate = "2026-10-11"; src = fetchFromGitHub { owner = "storytold"; repo = "photocraft"; tag = "v${finalAttrs.version}"; hash = "sha256-XyRDSkGAw1W9kF61nujHkgIR7TkTjrQbbcu+tSxWjXU="; }; cargoHash = "sha256-kpNg04RP5XbtW2rMaXUmGIKRJIqJmi7fmTbs5qHTLto="; # Match the official release builds (CI builds with `--features heif`): # HEIC/HEIF reading via pure-Rust heic-rs — no native C dependency. # Scoped per binary so the CLI ships the same codec set as the app. buildFeatures = [ "photocraft/heif" "photocraft-cli/heif" ]; # The workspace default also builds xtask; ship only the two user-facing # binaries (desktop app + headless CLI with batch and MCP support). cargoBuildFlags = [ "-p" "photocraft" "-p" "photocraft-cli" ]; # ~260 test binaries, and the corpus tests additionally fetch external # files (cargo xtask corpus). Skip the suite in the package build. doCheck = false; nativeBuildInputs = [makeWrapper]; postInstall = '' install -Dm644 packaging/linux/ai.storyteller.photocraft.desktop \ -t $out/share/applications mkdir -p $out/share/metainfo substitute packaging/linux/ai.storyteller.photocraft.metainfo.xml.in \ $out/share/metainfo/ai.storyteller.photocraft.metainfo.xml \ --replace-fail @VERSION@ ${finalAttrs.version} \ --replace-fail @DATE@ ${finalAttrs.releaseDate} install -Dm644 packaging/linux/ai.storyteller.photocraft.mime.xml \ $out/share/mime/packages/ai.storyteller.photocraft.xml mkdir -p $out/share/icons cp -R assets/app-icon/hicolor $out/share/icons chmod -R u+w $out/share/icons ''; postFixup = '' wrapProgram $out/bin/photocraft \ --prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath runtimeLibs} ''; # Update with: nix run github:NixOS/nixpkgs#nix-update -- --flake photocraft # (bumps version, src hash and cargoHash in one run) passthru.updateScript = nix-update-script {}; meta = { description = "Open-source, clean-room reimplementation of Adobe Photoshop in pure Rust"; homepage = "https://getartcraft.com/apps/photocraft"; changelog = "https://github.com/storytold/photocraft/releases/tag/v${finalAttrs.version}"; license = with lib.licenses; [asl20 mit]; mainProgram = "photocraft"; platforms = lib.platforms.linux; }; })