Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / applications / video / shotcut / default.nix
blob5abc6c47a1346240af447423596fc6d795965cc0
1 { lib
2 , fetchFromGitHub
3 , mkDerivation
4 , SDL2
5 , frei0r
6 , ladspaPlugins
7 , gettext
8 , mlt
9 , jack1
10 , pkg-config
11 , qtbase
12 , qtmultimedia
13 , qtx11extras
14 , qtwebsockets
15 , qtquickcontrols2
16 , qtgraphicaleffects
17 , qmake
18 , qttools
19 , gitUpdater
22 assert lib.versionAtLeast mlt.version "6.24.0";
24 mkDerivation rec {
25   pname = "shotcut";
26   version = "21.09.20";
28   src = fetchFromGitHub {
29     owner = "mltframework";
30     repo = "shotcut";
31     rev = "v${version}";
32     sha256 = "1y46n5gmlayfl46l0vhg5g5dbbc0sg909mxb68sia0clkaas8xrh";
33   };
35   nativeBuildInputs = [ pkg-config qmake ];
36   buildInputs = [
37     SDL2
38     frei0r
39     ladspaPlugins
40     gettext
41     mlt
42     qtbase
43     qtmultimedia
44     qtx11extras
45     qtwebsockets
46     qtquickcontrols2
47     qtgraphicaleffects
48   ];
50   env.NIX_CFLAGS_COMPILE = "-I${mlt.dev}/include/mlt++ -I${mlt.dev}/include/mlt";
51   qmakeFlags = [
52     "QMAKE_LRELEASE=${lib.getDev qttools}/bin/lrelease"
53     "SHOTCUT_VERSION=${version}"
54     "DEFINES+=SHOTCUT_NOUPGRADE"
55   ];
57   prePatch = ''
58     sed 's_shotcutPath, "melt[^"]*"_"${mlt}/bin/melt"_' -i src/jobs/meltjob.cpp
59     sed 's_shotcutPath, "ffmpeg"_"${mlt.ffmpeg}/bin/ffmpeg"_' -i src/jobs/ffmpegjob.cpp
60     sed 's_qApp->applicationDirPath(), "ffmpeg"_"${mlt.ffmpeg}/bin/ffmpeg"_' -i src/docks/encodedock.cpp
61     NICE=$(type -P nice)
62     sed "s_/usr/bin/nice_''${NICE}_" -i src/jobs/meltjob.cpp src/jobs/ffmpegjob.cpp
63   '';
65   qtWrapperArgs = [
66     "--prefix FREI0R_PATH : ${frei0r}/lib/frei0r-1"
67     "--prefix LADSPA_PATH : ${ladspaPlugins}/lib/ladspa"
68     "--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ jack1 SDL2 ]}"
69     "--prefix PATH : ${mlt}/bin"
70   ];
72   postInstall = ''
73     mkdir -p $out/share/shotcut
74     cp -r src/qml $out/share/shotcut/
75   '';
77   passthru.updateScript = gitUpdater {
78     rev-prefix = "v";
79   };
81   meta = with lib; {
82     description = "A free, open source, cross-platform video editor";
83     longDescription = ''
84       An official binary for Shotcut, which includes all the
85       dependencies pinned to specific versions, is provided on
86       http://shotcut.org.
88       If you encounter problems with this version, please contact the
89       nixpkgs maintainer(s). If you wish to report any bugs upstream,
90       please use the official build from shotcut.org instead.
91     '';
92     homepage = "https://shotcut.org";
93     license = licenses.gpl3Plus;
94     maintainers = with maintainers; [ goibhniu woffs peti ];
95     platforms = platforms.linux;
96   };