acr-cli: init at 0.14 (#359508)
[NixPkgs.git] / pkgs / by-name / re / renoise / package.nix
blobdd350e02249afc0a2ea36fe577a780771daeabb8
1 { lib
2 , stdenv
3 , writeScript
4 , alsa-lib
5 , fetchurl
6 , libjack2
7 , libX11
8 , libXcursor
9 , libXext
10 , libXinerama
11 , libXrandr
12 , libXtst
13 , mpg123
14 , pipewire
15 , releasePath ? null
18 # To use the full release version:
19 # 1) Sign into https://backstage.renoise.com and download the release version to some stable location.
20 # 2) Override the releasePath attribute to point to the location of the newly downloaded bundle.
21 # Note: Renoise creates an individual build for each license which screws somewhat with the
22 # use of functions like requireFile as the hash will be different for every user.
23 let
24   platforms = {
25     x86_64-linux = {
26       archSuffix = "x86_64";
27       hash = "sha256-b+YXBVnxu54HfC/tWapcs/ZYzwBOJswYbEbEU3SVNss=";
28     };
29     aarch64-linux = {
30       archSuffix = "arm64";
31       hash = "sha256-l54FAtT+Rj4Mv3GuOF0/9WuKdJowgbZDZYo7VCh6Flg=";
32     };
33   };
35 in stdenv.mkDerivation rec {
36   pname = "renoise";
37   version = "3.4.4";
39   src = if releasePath != null then
40     releasePath
41   else
42     let
43       platform = platforms.${stdenv.system} or (throw "unsupported system ${stdenv.hostPlatform.system}");
44       urlVersion = lib.replaceStrings [ "." ] [ "_" ] version;
45     in fetchurl {
46       urls = [
47         "https://files.renoise.com/demo/Renoise_${urlVersion}_Demo_Linux_${platform.archSuffix}.tar.gz"
48         "https://files.renoise.com/demo/archive/Renoise_${urlVersion}_Demo_Linux_${platform.archSuffix}.tar.gz"
49       ];
50       hash = platform.hash;
51     };
53   buildInputs = [
54     alsa-lib
55     libjack2
56     libX11
57     libXcursor
58     libXext
59     libXinerama
60     libXrandr
61     libXtst
62     pipewire
63   ];
65   installPhase = ''
66     cp -r Resources $out
68     mkdir -p $out/lib/
70     cp renoise $out/renoise
72     for path in ${toString buildInputs}; do
73       ln -s $path/lib/*.so* $out/lib/
74     done
76     ln -s ${lib.getLib stdenv.cc.cc}/lib/libstdc++.so.6 $out/lib/
78     mkdir $out/bin
79     ln -s $out/renoise $out/bin/renoise
81     # Desktop item
82     mkdir -p $out/share/applications
83     cp -r Installer/renoise.desktop $out/share/applications/renoise.desktop
85     # Desktop item icons
86     mkdir -p $out/share/icons/hicolor/{48x48,64x64,128x128}/apps
87     cp Installer/renoise-48.png $out/share/icons/hicolor/48x48/apps/renoise.png
88     cp Installer/renoise-64.png $out/share/icons/hicolor/64x64/apps/renoise.png
89     cp Installer/renoise-128.png $out/share/icons/hicolor/128x128/apps/renoise.png
90   '';
92   postFixup = ''
93     patchelf \
94       --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
95       --set-rpath ${mpg123}/lib:$out/lib \
96       $out/renoise
98     for path in $out/AudioPluginServer*; do
99       patchelf \
100         --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
101         --set-rpath $out/lib \
102         $path
103     done
105     substituteInPlace $out/share/applications/renoise.desktop \
106       --replace Exec=renoise Exec=$out/bin/renoise
107   '';
109   passthru.updateScript = writeScript "update-renoise" ''
110     #!/usr/bin/env nix-shell
111     #!nix-shell -I nixpkgs=./. -i bash -p curl htmlq common-updater-scripts
112     set -euo pipefail
114     new_version="$(
115       curl 'https://files.renoise.com/demo/' \
116         | htmlq a --text \
117         | grep -E '^Renoise_([0-9]+_?)+_Demo_Linux_x86_64\.tar\.gz$' \
118         | grep -Eo '[0-9]+(_[0-9]+)*' \
119         | head -n1 \
120         | tr _ .
121     )"
122     hash_x86_64="$(nix-prefetch-url "https://files.renoise.com/demo/Renoise_$(echo "$new_version" | tr . _)_Demo_Linux_x86_64.tar.gz")"
123     hash_arm64="$( nix-prefetch-url "https://files.renoise.com/demo/Renoise_$(echo "$new_version" | tr . _)_Demo_Linux_arm64.tar.gz")"
124     sri_x86_64="$(nix --extra-experimental-features nix-command hash to-sri --type sha256 "$hash_x86_64")"
125     sri_arm64="$( nix --extra-experimental-features nix-command hash to-sri --type sha256 "$hash_arm64")"
126     update-source-version renoise "$new_version" "$sri_x86_64" --system="x86_64-linux"  --ignore-same-version
127     update-source-version renoise "$new_version" "$sri_arm64"  --system="aarch64-linux" --ignore-same-version
128   '';
130   meta = {
131     description = "Modern tracker-based DAW";
132     homepage = "https://www.renoise.com/";
133     sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
134     license = lib.licenses.unfree;
135     maintainers = with lib.maintainers; [ uakci ];
136     platforms = lib.attrNames platforms;
137     mainProgram = "renoise";
138   };