nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 stdenvNoCC,
3 lib,
4 fetchzip,
5 dpkg,
6 patchelf,
7 buildFHSEnv,
8 writeShellScript,
9 makeBinaryWrapper,
10}:
11
12let
13 pname = "aja-desktop-software";
14 version = "17.1.3";
15 meta = {
16 description = "Graphical utilities for interacting with AJA desktop video cards";
17 homepage = "https://www.aja.com/products/aja-control-room";
18 license = lib.licenses.unfree; # https://www.aja.com/software-license-agreement
19 maintainers = [ lib.maintainers.lukegb ];
20 platforms = [ "x86_64-linux" ];
21 sourceProvenance = [
22 lib.sourceTypes.binaryNativeCode
23 lib.sourceTypes.binaryFirmware
24 ];
25 };
26
27 unwrapped = stdenvNoCC.mkDerivation {
28 pname = "${pname}-unwrapped";
29 inherit version;
30
31 src = fetchzip {
32 url = "https://www.aja.com/assets/support/files/9895/en/AJA-Desktop-Software-Installer_Linux-Ubuntu_v${version}_Release.zip";
33 hash = "sha256-TxDcYIhEcpPnpoqpey5vSvUltLT/3xwBfOhAP81Q9+E=";
34 };
35
36 unpackCmd = "dpkg -x $curSrc/ajaretail_*.deb source";
37
38 nativeBuildInputs = [
39 dpkg
40 patchelf
41 ];
42
43 installPhase = ''
44 runHook preInstall
45
46 mkdir -p $out/share
47 mv usr/share/applications $out/share/applications
48 mv usr/share/doc $out/share/doc
49
50 mv etc $out/etc
51
52 mv opt $out/opt
53
54 ln -s $out/opt/aja/bin $out/bin
55
56 # For some reason ajanmos doesn't have /opt/aja/lib in its rpath...
57 patchelf $out/opt/aja/bin/ajanmos --add-rpath $out/opt/aja/lib
58
59 runHook postInstall
60 '';
61
62 dontPatchELF = true;
63
64 inherit meta;
65 };
66in
67buildFHSEnv {
68 inherit pname version;
69
70 targetPkgs =
71 pkgs:
72 [ unwrapped ]
73 ++ (with pkgs; [
74 ocl-icd
75 libGL
76 udev
77 libpulseaudio
78 zstd
79 glib
80 fontconfig
81 freetype
82 libxcb
83 libx11
84 libxcb-wm
85 libxcb-image
86 libxcb-keysyms
87 libxcb-render-util
88 libsm
89 libice
90 libxkbcommon
91 dbus
92 avahi
93 ]);
94
95 nativeBuildInputs = [
96 makeBinaryWrapper
97 ];
98
99 unshareIpc = false;
100 unsharePid = false;
101
102 runScript = writeShellScript "aja" ''
103 exec_binary="$1"
104 shift
105 export QT_PLUGIN_PATH="${unwrapped}/opt/aja/plugins"
106 exec "${unwrapped}/opt/aja/bin/$exec_binary" "$@"
107 '';
108
109 extraInstallCommands = ''
110 mkdir -p $out/libexec/aja-desktop
111 mv $out/bin/${pname} $out/libexec/aja-desktop/${pname}
112
113 for binary in controlpanel controlroom ajanmos systemtest; do
114 makeWrapper "$out/libexec/aja-desktop/${pname}" "$out/bin/aja-$binary" \
115 --add-flags "$binary"
116 done
117 '';
118
119 passthru = {
120 inherit unwrapped;
121 };
122
123 meta = meta // {
124 mainProgram = "aja-controlpanel";
125 };
126}