feat(pkgs): add photocraft 0.7.0

Native buildRustPackage for PhotoCraft, the open-source clean-room
Photoshop reimplementation in pure Rust
(https://github.com/storytold/photocraft).

- builds desktop app + photocraft-cli (convert/batch/MCP) from the
  v0.7.0 release tag
- heif feature enabled for parity with official release builds
  (pure-Rust heic-rs, no native C deps)
- zero buildInputs: the workspace has no native *-sys crates; all
  windowing/graphics/D-Bus access is dlopen'd at runtime and provided
  via LD_LIBRARY_PATH (neovide pattern), incl. dbus.lib so rfd's
  xdg-desktop-portal file dialogs work instead of the zenity fallback
- installs upstream .desktop, hicolor icons (16-512 + svg), AppStream
  metainfo (version/date substituted) and MIME registrations
- passthru.updateScript = nix-update-script; verified with
  'nix-update -F photocraft' (handles version + src hash + cargoHash)

GPU verified on RX 7900 XTX / Wayland after the flake input update.
This commit is contained in:
m3ta-chiron committed 2026-10-11 14:01:12 +02:00
1 parent b857f5d038
commit ebd79d5ca5
3 files changed
+112

No files matched your search

+110
View File
@@ -0,0 +1,110 @@
{
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 <releases> 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 <repo-root> 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;
};
})