nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 autoPatchelfHook,
3 common-updater-scripts,
4 curl,
5 fetchurl,
6 ffmpeg,
7 lib,
8 stdenv,
9 qt5,
10 openssl,
11 pkg-config,
12 rubyPackages,
13 writeShellApplication,
14 zlib,
15
16 withJava ? true,
17 jre_headless,
18}:
19stdenv.mkDerivation (
20 finalAttrs:
21 let
22 inherit (finalAttrs) version;
23 # Using two URLs as the first one will break as soon as a new version is released
24 srcs.bin = fetchurl {
25 urls = [
26 "http://www.makemkv.com/download/makemkv-bin-${version}.tar.gz"
27 "http://www.makemkv.com/download/old/makemkv-bin-${version}.tar.gz"
28 ];
29 hash = "sha256-we5yCukbJ2p8ib6GEUbFuTRjGDHo1sj0U0BkNXJOkr0=";
30 };
31 srcs.oss = fetchurl {
32 urls = [
33 "http://www.makemkv.com/download/makemkv-oss-${version}.tar.gz"
34 "http://www.makemkv.com/download/old/makemkv-oss-${version}.tar.gz"
35 ];
36 hash = "sha256-vIuwhK46q81QPVu5PvwnPgRuT9RmPTmpg2zgwEf+6CM=";
37 };
38 in
39 {
40 pname = "makemkv";
41 version = "1.18.3";
42
43 srcs = lib.attrValues finalAttrs.passthru.srcs;
44 sourceRoot = "makemkv-oss-${version}";
45 patches = [ ./r13y.patch ];
46
47 enableParallelBuilding = true;
48 nativeBuildInputs = [
49 autoPatchelfHook
50 pkg-config
51 qt5.wrapQtAppsHook
52 ];
53 buildInputs = [
54 ffmpeg
55 openssl
56 qt5.qtbase
57 zlib
58 ];
59 runtimeDependencies = [ (lib.getLib curl) ];
60
61 qtWrapperArgs =
62 let
63 binPath = lib.makeBinPath [ jre_headless ];
64 in
65 lib.optionals withJava [ "--prefix PATH : ${binPath}" ];
66
67 installPhase = ''
68 runHook preInstall
69
70 install -Dm555 -t "$out"/bin out/{makemkv,mmccextr,mmgplsrv} \
71 ../makemkv-bin-"$version"/bin/amd64/makemkvcon
72 install -D -t "$out"/lib out/lib{driveio,makemkv,mmbd}.so.*
73 install -D -t "$out"/share/MakeMKV ../makemkv-bin-"$version"/src/share/*
74 install -Dm444 -t "$out"/share/applications ../makemkv-oss-"$version"/makemkvgui/share/makemkv.desktop
75 install -Dm444 -t "$out"/share/icons/hicolor/16x16/apps ../makemkv-oss-"$version"/makemkvgui/share/icons/16x16/*
76 install -Dm444 -t "$out"/share/icons/hicolor/32x32/apps ../makemkv-oss-"$version"/makemkvgui/share/icons/32x32/*
77 install -Dm444 -t "$out"/share/icons/hicolor/64x64/apps ../makemkv-oss-"$version"/makemkvgui/share/icons/64x64/*
78 install -Dm444 -t "$out"/share/icons/hicolor/128x128/apps ../makemkv-oss-"$version"/makemkvgui/share/icons/128x128/*
79 install -Dm444 -t "$out"/share/icons/hicolor/256x256/apps ../makemkv-oss-"$version"/makemkvgui/share/icons/256x256/*
80
81 runHook postInstall
82 '';
83
84 passthru = {
85 inherit srcs;
86 updateScript = lib.getExe (writeShellApplication {
87 name = "update-makemkv";
88 runtimeInputs = [
89 common-updater-scripts
90 curl
91 rubyPackages.nokogiri
92 ];
93 runtimeEnv.oldVersion = version;
94 text = ''
95 get_version() {
96 # shellcheck disable=SC2016
97 curl --fail --silent 'https://forum.makemkv.com/forum/viewtopic.php?f=3&t=224' \
98 | nokogiri -e 'puts $_.css("head title").first.text.match(/\bMakeMKV (\d+\.\d+\.\d+) /)[1]'
99 }
100 newVersion=$(get_version)
101 if [ "$oldVersion" == "$newVersion" ]; then
102 echo "$0: New version same as old version, nothing to do." >&2
103 exit
104 fi
105 update-source-version makemkv "$newVersion" --source-key=passthru.srcs.bin
106 update-source-version makemkv "$newVersion" --source-key=passthru.srcs.oss --ignore-same-version
107 '';
108 });
109 };
110
111 meta = {
112 description = "Convert blu-ray and dvd to mkv";
113 longDescription = ''
114 makemkv is a one-click QT application that transcodes an encrypted
115 blu-ray or DVD disc into a more portable set of mkv files, preserving
116 subtitles, chapter marks, all video and audio tracks.
117
118 Program is time-limited -- it will stop functioning after 60 days. You
119 can always download the latest version from makemkv.com that will reset the
120 expiration date.
121 '';
122 sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
123 license = [
124 lib.licenses.unfree
125 lib.licenses.lgpl21
126 ];
127 homepage = "https://makemkv.com";
128 platforms = [ "x86_64-linux" ];
129 maintainers = with lib.maintainers; [ jchw ];
130 };
131 }
132)