diff --git a/pkgs/by-name/gs/gst-thumbnailers/package.nix b/pkgs/by-name/gs/gst-thumbnailers/package.nix index 2ae9a3cd9b18..939c0567e5e3 100644 --- a/pkgs/by-name/gs/gst-thumbnailers/package.nix +++ b/pkgs/by-name/gs/gst-thumbnailers/package.nix @@ -13,23 +13,27 @@ fontconfig, libglycin, glycin-loaders, + writableTmpDirAsHomeHook, + shared-mime-info, + callPackage, + nix-update-script, }: stdenv.mkDerivation (finalAttrs: { pname = "gst-thumbnailers"; - version = "1.0.alpha.1"; + version = "1.0.0"; src = fetchFromGitLab { domain = "gitlab.gnome.org"; owner = "GNOME"; repo = "gst-thumbnailers"; tag = finalAttrs.version; - hash = "sha256-LOdD8ECSK+QuXkE8jjIg5IfZSQ5FcIi3hmZ2vAaaBKI="; + hash = "sha256-QxOdjtPnX4ulGsenASQzKJckbIqfSU7FeR+iW1ZL878="; }; cargoDeps = rustPlatform.fetchCargoVendor { inherit (finalAttrs) pname version src; - hash = "sha256-PIqEEijKe+wsX6idqoIB591h1Yj4mixwXDKDN4caO9I="; + hash = "sha256-irXwoGGcVeZza02Ob5HTkeTBD3PaXmfJ4vuqXk9BadA="; }; nativeBuildInputs = [ @@ -52,11 +56,38 @@ stdenv.mkDerivation (finalAttrs: { glycin-loaders ]; + strictDeps = true; + __structuredAttrs = true; + + doCheck = true; + + nativeCheckInputs = [ + # fontconfig tries to write to `~/.cache/fontconfig` + writableTmpDirAsHomeHook + ]; + + # Fix missing glycin loaders (glycin-loaders) and incorrectly detected + # MIME types (shared-mime-info). + preCheck = '' + export XDG_DATA_DIRS=${glycin-loaders}/share:${shared-mime-info}/share:$XDG_DATA_DIRS + ''; + + mesonCheckFlags = [ "-v" ]; + + passthru = { + tests.thumbnailers = callPackage ./tests.nix { }; + updateScript = nix-update-script { }; + }; + meta = { description = "Generate thumbnailer for video and audio files"; homepage = "https://gitlab.gnome.org/GNOME/gst-thumbnailers"; + changelog = "https://gitlab.gnome.org/GNOME/gst-thumbnailers/-/blob/${finalAttrs.src.tag}/NEWS"; license = lib.licenses.gpl3Plus; - maintainers = [ lib.maintainers.aleksana ]; + maintainers = with lib.maintainers; [ + aleksana + thunze + ]; platforms = lib.platforms.linux; }; }) diff --git a/pkgs/by-name/gs/gst-thumbnailers/tests.nix b/pkgs/by-name/gs/gst-thumbnailers/tests.nix new file mode 100644 index 000000000000..f66fd6bf764d --- /dev/null +++ b/pkgs/by-name/gs/gst-thumbnailers/tests.nix @@ -0,0 +1,46 @@ +{ + stdenv, + gst-thumbnailers, + shared-mime-info, + writableTmpDirAsHomeHook, +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "gst-thumbnailers-test"; + inherit (gst-thumbnailers) version src; + + sourceRoot = "${finalAttrs.src.name}/tests"; + + nativeBuildInputs = [ + # fontconfig tries to write to `~/.cache/fontconfig` + writableTmpDirAsHomeHook + ]; + + # Fix incorrectly detected MIME types + preBuild = '' + export XDG_DATA_DIRS=${shared-mime-info}/share:$XDG_DATA_DIRS + ''; + + buildPhase = '' + runHook preBuild + + mkdir -p $out + + for file in *.{flac,mp3,mkv,webm}; do + case "$file" in + *.flac|*.mp3) thumbnailer=gst-audio-thumbnailer ;; + *.mkv|*.webm) thumbnailer=gst-video-thumbnailer ;; + esac + + for size in 128 256 512 1024; do + input="file://$(realpath "$file")" + output="$out/$(basename "$file")-$size.png" + + ${gst-thumbnailers}/bin/$thumbnailer -i "$input" -o "$output" -s $size + file -E "$output" + done + done + + runHook postBuild + ''; +})