Files
pixlit-nix/pixlit.nix
2026-05-16 16:08:25 -04:00

78 lines
2.1 KiB
Nix

{ lib
, python3Packages
, gobject-introspection
, wrapGAppsHook4
, libadwaita
, gtk4
, gdk-pixbuf
}:
python3Packages.buildPythonApplication {
pname = "pixlit";
version = "1.0.0";
src = ./.;
format = "other"; # plain script — no setup.py / pyproject.toml
# No compile step needed for pure Python
dontBuild = true;
nativeBuildInputs = [
gobject-introspection
wrapGAppsHook4
];
buildInputs = [
gtk4
libadwaita
gdk-pixbuf
];
propagatedBuildInputs = with python3Packages; [
pillow
pillow-heif # registers HEIC/HEIF opener with Pillow
pygobject3
];
installPhase = ''
runHook preInstall
# Binary
install -Dm755 pixlit.py $out/bin/pixlit
# Icons
install -Dm644 pixlit.svg \
$out/share/icons/hicolor/scalable/apps/pixlit.svg
for size in 128 256 512; do
install -Dm644 pixlit-''${size}.png \
$out/share/icons/hicolor/''${size}x''${size}/apps/pixlit.png
done
# Desktop entry
install -Dm644 /dev/stdin $out/share/applications/pixlit.desktop <<EOF
[Desktop Entry]
Name=Pixlit
Comment=Convert images between HEIC, JPEG, PNG, and WebP
Exec=pixlit
Icon=pixlit
Terminal=false
Type=Application
Categories=Graphics;Photography;
MimeType=image/heic;image/heif;image/jpeg;image/png;image/webp;
StartupNotify=true
EOF
runHook postInstall
'';
meta = with lib; {
description = "Image converter supporting HEIC, JPEG, PNG, and WebP";
license = licenses.mit;
platforms = platforms.linux;
mainProgram = "pixlit";
maintainers = [];
};
}