nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at 22.05 106 lines 2.7 kB view raw
1{ lib 2, stdenv 3, buildPythonPackage 4, python 5, pythonOlder 6, fetchFromGitLab 7, substituteAll 8, bubblewrap 9, exiftool 10, ffmpeg 11, mailcap 12, wrapGAppsHook 13, gdk-pixbuf 14, gobject-introspection 15, librsvg 16, poppler_gi 17, mutagen 18, pygobject3 19, pycairo 20, dolphinIntegration ? false, plasma5Packages 21}: 22 23buildPythonPackage rec { 24 pname = "mat2"; 25 version = "0.12.4"; 26 27 disabled = pythonOlder "3.5"; 28 29 src = fetchFromGitLab { 30 domain = "0xacab.org"; 31 owner = "jvoisin"; 32 repo = "mat2"; 33 rev = version; 34 hash = "sha256-HjPr4pb0x2Sdq8ALaZeQRnGHmNAoEV8XUGbhOjY00jc="; 35 }; 36 37 patches = [ 38 # hardcode paths to some binaries 39 (substituteAll ({ 40 src = ./paths.patch; 41 exiftool = "${exiftool}/bin/exiftool"; 42 ffmpeg = "${ffmpeg}/bin/ffmpeg"; 43 } // lib.optionalAttrs dolphinIntegration { 44 kdialog = "${plasma5Packages.kdialog}/bin/kdialog"; 45 })) 46 # the executable shouldn't be called .mat2-wrapped 47 ./executable-name.patch 48 # hardcode path to mat2 executable 49 ./tests.patch 50 # fix gobject-introspection typelib path for Nautilus extension 51 (substituteAll { 52 src = ./fix_poppler.patch; 53 poppler_path = "${poppler_gi}/lib/girepository-1.0"; 54 }) 55 ] ++ lib.optionals (stdenv.hostPlatform.isLinux) [ 56 (substituteAll { 57 src = ./bubblewrap-path.patch; 58 bwrap = "${bubblewrap}/bin/bwrap"; 59 }) 60 ]; 61 62 postPatch = '' 63 substituteInPlace dolphin/mat2.desktop \ 64 --replace "@mat2@" "$out/bin/mat2" \ 65 --replace "@mat2svg@" "$out/share/icons/hicolor/scalable/apps/mat2.svg" 66 ''; 67 68 nativeBuildInputs = [ 69 wrapGAppsHook 70 ]; 71 72 buildInputs = [ 73 gdk-pixbuf 74 gobject-introspection 75 librsvg 76 poppler_gi 77 ]; 78 79 propagatedBuildInputs = [ 80 mutagen 81 pygobject3 82 pycairo 83 ]; 84 85 postInstall = '' 86 install -Dm 444 data/mat2.svg -t "$out/share/icons/hicolor/scalable/apps" 87 install -Dm 444 doc/mat2.1 -t "$out/share/man/man1" 88 install -Dm 444 nautilus/mat2.py -t "$out/share/nautilus-python/extensions" 89 buildPythonPath "$out $pythonPath $propagatedBuildInputs" 90 patchPythonScript "$out/share/nautilus-python/extensions/mat2.py" 91 '' + lib.optionalString dolphinIntegration '' 92 install -Dm 444 dolphin/mat2.desktop -t "$out/share/kservices5/ServiceMenus" 93 ''; 94 95 checkPhase = '' 96 ${python.interpreter} -m unittest discover -v 97 ''; 98 99 meta = with lib; { 100 description = "A handy tool to trash your metadata"; 101 homepage = "https://0xacab.org/jvoisin/mat2"; 102 changelog = "https://0xacab.org/jvoisin/mat2/-/blob/${version}/CHANGELOG.md"; 103 license = licenses.lgpl3Plus; 104 maintainers = with maintainers; [ dotlambda ]; 105 }; 106}