git.iko.soy/typeable/nixpkgs
on master help sign in
pianoteq.{stage-trial,standard-trial,stage-6,stage-7}: init at 7.3.0
commit3fbc8ee273086dce176c2c0e58d9d8aeebd0ee37 authorMauricio Scheffer <mauricioscheffer@gmail.com> dateSun 10 May 2020, 00:50 (7 years ago) parent00adfcb
2 files changed+202
pkgs/applications/audio/pianoteq/default.nix+200 pkgs/top-level/all-packages.nix+2
pkgs/applications/audio/pianoteq/default.nixnew file+200
@@ -0,0 +1,200 @@
1+{ lib, stdenv, curl, gnugrep, jq, xorg, alsa-lib, freetype, p7zip, autoPatchelfHook, writeShellScript, zlib, libjack2, makeWrapper }:
2+let
3+ versionForFile = v: builtins.replaceStrings ["."] [""] v;
4+
5+ mkPianoteq = { name, src, version, archdir, ... }:
6+ stdenv.mkDerivation rec {
7+ inherit src version;
8+
9+ pname = "pianoteq-${name}";
10+
11+ unpackPhase = ''
12+ ${p7zip}/bin/7z x $src
13+ '';
14+
15+ nativeBuildInputs = [
16+ autoPatchelfHook
17+ makeWrapper
18+ ];
19+
20+ buildInputs = [
21+ stdenv.cc.cc.lib
22+ xorg.libX11 # libX11.so.6
23+ xorg.libXext # libXext.so.6
24+ alsa-lib # libasound.so.2
25+ freetype # libfreetype.so.6
26+ ];
27+
28+ installPhase = ''
29+ mkdir -p $out/bin
30+ mv -t $out/bin Pianoteq*/${archdir}/*
31+ for f in $out/bin/Pianoteq*; do
32+ if [ -x "$f" ] && [ -f "$f" ]; then
33+ wrapProgram "$f" --prefix LD_LIBRARY_PATH : ${
34+ lib.makeLibraryPath (buildInputs ++ [
35+ xorg.libXcursor
36+ xorg.libXinerama
37+ xorg.libXrandr
38+ libjack2
39+ zlib
40+ ])
41+ }
42+ fi
43+ done
44+ '';
45+
46+ meta = with lib; {
47+ homepage = "https://www.modartt.com/pianoteq";
48+ description = "Software synthesizer that features real-time MIDI-control of digital physically modeled pianos and related instruments";
49+ license = licenses.unfree;
50+ platforms = [ "x86_64-linux" ]; # TODO extract binary according to each platform?
51+ maintainers = [ maintainers.mausch ];
52+ };
53+ };
54+
55+ fetchWithCurlScript = { name, sha256, script, impureEnvVars ? [] }:
56+ stdenv.mkDerivation {
57+ inherit name;
58+ builder = writeShellScript "builder.sh" ''
59+ source $stdenv/setup
60+
61+ curlVersion=$(${curl}/bin/curl -V | head -1 | cut -d' ' -f2)
62+
63+ # Curl flags to handle redirects, not use EPSV, handle cookies for
64+ # servers to need them during redirects, and work on SSL without a
65+ # certificate (this isn't a security problem because we check the
66+ # cryptographic hash of the output anyway).
67+ curl=(
68+ ${curl}/bin/curl
69+ --location
70+ --max-redirs 20
71+ --retry 3
72+ --disable-epsv
73+ --cookie-jar cookies
74+ --insecure
75+ --user-agent "curl/$curlVersion Nixpkgs/${lib.trivial.release}"
76+ $NIX_CURL_FLAGS
77+ )
78+
79+ ${script}
80+
81+ '';
82+ nativeBuildInputs = [ curl ];
83+ outputHashAlgo = "sha256";
84+ outputHash = sha256;
85+
86+ impureEnvVars = lib.fetchers.proxyImpureEnvVars ++ impureEnvVars ++ [
87+ # This variable allows the user to pass additional options to curl
88+ "NIX_CURL_FLAGS"
89+ ];
90+ };
91+
92+ fetchPianoteqTrial = { name, sha256 }:
93+ fetchWithCurlScript {
94+ inherit name sha256;
95+ script = ''
96+ "''${curl[@]}" --silent --request POST \
97+ --cookie cookies \
98+ --header "modartt-json: request" \
99+ --header "origin: https://www.modartt.com" \
100+ --header "content-type: application/json; charset=UTF-8" \
101+ --header "accept: application/json, text/javascript, */*" \
102+ --data-raw '{"file": "${name}", "get": "url"}' \
103+ https://www.modartt.com/json/download -o /dev/null
104+ json=$(
105+ "''${curl[@]}" --silent --request POST \
106+ --cookie cookies \
107+ --header "modartt-json: request" \
108+ --header "origin: https://www.modartt.com" \
109+ --header "content-type: application/json; charset=UTF-8" \
110+ --header "accept: application/json, text/javascript, */*" \
111+ --data-raw '{"file": "${name}", "get": "url"}' \
112+ https://www.modartt.com/json/download
113+ )
114+ url=$(echo $json | ${jq}/bin/jq -r .url)
115+ "''${curl[@]}" --progress-bar --cookie cookies -o $out "$url"
116+ '';
117+ };
118+
119+ fetchPianoteqWithLogin = { name, sha256 }:
120+ fetchWithCurlScript {
121+ inherit name sha256;
122+
123+ impureEnvVars = [ "NIX_MODARTT_USERNAME" "NIX_MODARTT_PASSWORD" ];
124+
125+ script = ''
126+ if [ -z "''${NIX_MODARTT_USERNAME}" -o -z "''${NIX_MODARTT_PASSWORD}" ]; then
127+ echo "Error: Downloading a personal Pianoteq instance requires the nix building process (nix-daemon in multi user mode) to have the NIX_MODARTT_USERNAME and NIX_MODARTT_PASSWORD env vars set." >&2
128+ exit 1
129+ fi
130+
131+ "''${curl[@]}" -s -o /dev/null "https://www.modartt.com/user_area"
132+
133+ ${jq}/bin/jq -n "{connect: 1, login: \"''${NIX_MODARTT_USERNAME}\", password: \"''${NIX_MODARTT_PASSWORD}\"}" > login.json
134+
135+ "''${curl[@]}" --silent --request POST \
136+ --cookie cookies \
137+ --referer "https://www.modartt.com/user_area" \
138+ --header "modartt-json: request" \
139+ --header "origin: https://www.modartt.com" \
140+ --header "content-type: application/json; charset=UTF-8" \
141+ --header "accept: application/json, text/javascript, */*" \
142+ --data @login.json \
143+ https://www.modartt.com/json/session
144+
145+ json=$(
146+ "''${curl[@]}" --silent --request POST \
147+ --cookie cookies \
148+ --header "modartt-json: request" \
149+ --header "origin: https://www.modartt.com" \
150+ --header "content-type: application/json; charset=UTF-8" \
151+ --header "accept: application/json, text/javascript, */*" \
152+ --data-raw '{"file": "${name}", "get": "url"}' \
153+ https://www.modartt.com/json/download
154+ )
155+ url=$(echo $json | ${jq}/bin/jq -r .url)
156+
157+ "''${curl[@]}" --progress-bar --cookie cookies -o $out "$url"
158+ '';
159+ };
160+
161+in {
162+ # TODO currently can't install more than one because `lame` clashes
163+ stage-trial = mkPianoteq rec {
164+ name = "stage-trial";
165+ version = "7.3.0";
166+ archdir = "x86-64bit";
167+ src = fetchPianoteqTrial {
168+ name = "pianoteq_stage_linux_trial_v${versionForFile version}.7z";
169+ sha256 = "12zbr54ng7cb4ngl1qrf5h0gs8c42d6d3j08492xr14m9x9y132k";
170+ };
171+ };
172+ standard-trial = mkPianoteq rec {
173+ name = "standard-trial";
174+ version = "7.3.0";
175+ archdir = "x86-64bit";
176+ src = fetchPianoteqTrial {
177+ name = "pianoteq_linux_trial_v${versionForFile version}.7z";
178+ sha256 = "04sh45hm3y3y6kfj3p32fi6p95r9fc6xf4r5i74laylms4f6gr6d";
179+ };
180+ };
181+ stage-6 = mkPianoteq rec {
182+ name = "stage-6";
183+ version = "6.7.3";
184+ archdir = "amd64";
185+ src = fetchPianoteqWithLogin {
186+ name = "pianoteq_stage_linux_v${versionForFile version}.7z";
187+ sha256 = "0jy0hkdynhwv0zhrqkby0hdphgmcc09wxmy74rhg9afm1pzl91jy";
188+ };
189+ };
190+ stage-7 = mkPianoteq rec {
191+ name = "stage-7";
192+ version = "7.3.0";
193+ archdir = "x86-64bit";
194+ src = fetchPianoteqWithLogin {
195+ name = "pianoteq_stage_linux_v${versionForFile version}.7z";
196+ sha256 = "05w7sv9v38r6ljz9xai816w5z2qqwx88hcfjm241fvgbs54125hx";
197+ };
198+ };
199+ # TODO other paid binaries, I don't own that so I don't know their hash.
200+}
pkgs/top-level/all-packages.nix+2
@@ -26163,6 +26163,8 @@ in
2616326163
2616426164 pianobooster = qt5.callPackage ../applications/audio/pianobooster { };
2616526165
26166+ pianoteq = callPackage ../applications/audio/pianoteq { };
26167+
2616626168 picard = callPackage ../applications/audio/picard { };
2616726169
2616826170 picocom = callPackage ../tools/misc/picocom {