2026-10-11 14:01:12 +02:00
|
|
|
{
|
|
|
|
|
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";
|
2026-10-27 07:57:15 +01:00
|
|
|
version = "0.16.0";
|
2026-10-11 14:01:12 +02:00
|
|
|
|
|
|
|
|
# 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}";
|
2026-10-27 07:57:15 +01:00
|
|
|
hash = "sha256-uaZmzQb4B1zZ2XrZHjHzI/uEVGdoYRFeh10GHIxzjDA=";
|
2026-10-11 14:01:12 +02:00
|
|
|
};
|
|
|
|
|
|
2026-10-27 07:57:15 +01:00
|
|
|
cargoHash = "sha256-O1tUKAWSvLmOEUbpVub8bczHpoXH6XxXKSPGRVkjsHs=";
|
2026-10-11 14:01:12 +02:00
|
|
|
|
|
|
|
|
# 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;
|
|
|
|
|
};
|
|
|
|
|
})
|