nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchzip,
5 makeDesktopItem,
6 nix-update-script,
7
8 copyDesktopItems,
9 icoutils,
10 makeWrapper,
11
12 ffmpeg,
13 gtk2,
14 hunspell,
15 mono,
16 mpv,
17 tesseract4,
18}:
19
20stdenv.mkDerivation rec {
21 pname = "subtitleedit";
22 version = "4.0.14";
23
24 src = fetchzip {
25 url = "https://github.com/SubtitleEdit/subtitleedit/releases/download/${version}/SE${
26 lib.replaceStrings [ "." ] [ "" ] version
27 }.zip";
28 hash = "sha256-vaANk5xK8a3SQf5Qacxv3wj3HHtro5LLxZviaIKYkdI=";
29 stripRoot = false;
30 };
31
32 nativeBuildInputs = [
33 copyDesktopItems
34 icoutils
35 makeWrapper
36 ];
37
38 runtimeLibs = lib.makeLibraryPath [
39 gtk2
40 hunspell
41 mpv
42 tesseract4
43 ];
44
45 runtimeBins = lib.makeBinPath [
46 ffmpeg
47 hunspell
48 tesseract4
49 ];
50
51 installPhase = ''
52 runHook preInstall
53
54 mkdir -p $out/bin
55 mkdir -p $out/share/icons/hicolor/{16x16,32x32,48x48,256x256}/apps
56
57 cp -r * $out/bin/
58 ln -s ${hunspell.out}/lib/libhunspell*.so $out/bin/libhunspell.so
59 makeWrapper "${mono}/bin/mono" $out/bin/subtitleedit \
60 --add-flags "$out/bin/SubtitleEdit.exe" \
61 --prefix LD_LIBRARY_PATH : ${runtimeLibs} \
62 --prefix PATH : ${runtimeBins}
63
64 wrestool -x -t 14 SubtitleEdit.exe > subtitleedit.ico
65 icotool -x -i 3 -o $out/share/icons/hicolor/16x16/apps/subtitleedit.png subtitleedit.ico
66 icotool -x -i 6 -o $out/share/icons/hicolor/32x32/apps/subtitleedit.png subtitleedit.ico
67 icotool -x -i 9 -o $out/share/icons/hicolor/48x48/apps/subtitleedit.png subtitleedit.ico
68 icotool -x -i 10 -o $out/share/icons/hicolor/256x256/apps/subtitleedit.png subtitleedit.ico
69
70 runHook postInstall
71 '';
72
73 desktopItems = [
74 (makeDesktopItem {
75 name = pname;
76 desktopName = "Subtitle Edit";
77 exec = "subtitleedit";
78 icon = "subtitleedit";
79 comment = meta.description;
80 categories = [ "AudioVideo" ];
81 })
82 ];
83
84 passthru.updateScript = nix-update-script { };
85
86 meta = {
87 description = "Subtitle editor";
88 longDescription = ''
89 With Subtitle Edit you can easily adjust a subtitle if it is out of sync with
90 the video in several different ways. You can also use it for making
91 new subtitles from scratch (using the time-line /waveform/spectrogram)
92 or for translating subtitles.
93 '';
94 homepage = "https://nikse.dk/subtitleedit";
95 license = lib.licenses.gpl3Plus;
96 platforms = lib.platforms.all;
97 sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
98 maintainers = [ ];
99 };
100}