2
0
Fork 0
mirror of https://git.asonix.dog/asonix/pict-rs synced 2024-11-20 11:21:14 +00:00

Attempt to set up nix-based docker for pict-rs

There's a bug when converting APNG files to WEBP files, which
imagemagick delegates to ffmpeg. When doing 'nix build' and running the
result, or running pict-rs in the dev shell, it works fine. In the
container, this doesn't work at all. imagemagick complains that there's
no media to convert, implying ffmpeg has output a zero-sized file.

This work is helping to narrow down exactly what pict-rs needs to run,
though. This still needs to be tested against h264, h265, vp8, vp9 and
av1.
This commit is contained in:
asonix 2024-04-21 14:28:20 -05:00
parent 97159e0030
commit f082e48ed8
4 changed files with 49 additions and 5 deletions

View file

@ -15,13 +15,29 @@
in in
{ {
packages = rec { packages = rec {
imagemagick7_pict-rs = pkgs.callPackage ./nix/pkgs/imagemagick_pict-rs {};
ffmpeg6_pict-rs = pkgs.callPackage ./nix/pkgs/ffmpeg_pict-rs {};
pict-rs = pkgs.callPackage ./pict-rs.nix { pict-rs = pkgs.callPackage ./pict-rs.nix {
inherit (pkgs.darwin.apple_sdk.frameworks) Security; inherit (pkgs.darwin.apple_sdk.frameworks) Security;
inherit imagemagick7_pict-rs ffmpeg6_pict-rs;
}; };
default = pict-rs; default = pict-rs;
}; };
docker = pkgs.dockerTools.buildLayeredImage {
name = "pict-rs";
tag = "latest";
contents = [ pkgs.tini self.packages.${system}.pict-rs ];
config = {
Entrypoint = [ "/bin/tini" "--" "/bin/pict-rs" ];
Cmd = [ "run" ];
};
};
apps = rec { apps = rec {
dev = flake-utils.lib.mkApp { drv = self.packages.${system}.pict-rs; }; dev = flake-utils.lib.mkApp { drv = self.packages.${system}.pict-rs; };
default = dev; default = dev;
@ -36,9 +52,9 @@
curl curl
diesel-cli diesel-cli
exiftool exiftool
ffmpeg_6-full
garage garage
imagemagick self.packages.${system}.imagemagick7_pict-rs
self.packages.${system}.ffmpeg6_pict-rs
jq jq
minio-client minio-client
rust-analyzer rust-analyzer

View file

@ -0,0 +1,5 @@
{ ffmpeg_6-headless }:
ffmpeg_6-headless.override {
withWebp = true;
}

View file

@ -0,0 +1,23 @@
{ imagemagick7 }:
imagemagick7.override {
bzip2Support = true;
zlibSupport = true;
libX11Support = false;
libXtSupport = false;
fontconfigSupport = false;
freetypeSupport = false;
libjpegSupport = true;
djvulibreSupport = false;
lcms2Support = false;
openexrSupport = false;
libjxlSupport = true;
libpngSupport = true;
liblqr1Support = false;
librsvgSupport = false;
libtiffSupport = false;
libxml2Support = false;
openjpegSupport = true;
libwebpSupport = true;
libheifSupport = true;
}

View file

@ -1,6 +1,6 @@
{ exiftool { exiftool
, ffmpeg_6-full , ffmpeg6_pict-rs
, imagemagick , imagemagick7_pict-rs
, lib , lib
, makeWrapper , makeWrapper
, nixosTests , nixosTests
@ -27,7 +27,7 @@ rustPlatform.buildRustPackage {
postInstall = '' postInstall = ''
wrapProgram $out/bin/pict-rs \ wrapProgram $out/bin/pict-rs \
--prefix PATH : "${lib.makeBinPath [ imagemagick ffmpeg_6-full exiftool ]}" --prefix PATH : "${lib.makeBinPath [ imagemagick7_pict-rs ffmpeg6_pict-rs exiftool ]}"
''; '';
passthru.tests = { inherit (nixosTests) pict-rs; }; passthru.tests = { inherit (nixosTests) pict-rs; };