-
Notifications
You must be signed in to change notification settings - Fork 2
/
flake.nix
89 lines (75 loc) · 3.25 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# Author: phga <[email protected]>
{
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
outputs = { self, nixpkgs }@inputs: {
packages.x86_64-linux.default =
with import nixpkgs { system = "x86_64-linux"; };
stdenv.mkDerivation rec {
pname = "pianoteq";
version = "7.5.4";
icon = fetchurl {
name = "pianoteq_icon_128";
url = "https://www.pianoteq.com/images/logo/pianoteq_icon_128.png";
sha256 = "sha256-lO5kz2aIpJ108L9w2BHnRmq6wQP+6rF0lqifgor8xtM=";
};
# IMPORTANT: Use the following command to retrive the correct hash.
# Otherwise the file is not found in the nix store (Add it first ofc)
# nix hash to-sri --type sha256 `sha256sum pianoteq_linux_v754.7z`
src = requireFile {
name = "pianoteq_linux_v754.7z";
message = "Download the file from: https://www.modartt.com/download?file=pianoteq_linux_v754.7z and add it to the nix store manually: nix-store --add-fixed sha256 ./pianoteq_linux_v754.7z";
sha256 = "sha256-TA9CiuT21fQedlMUGz7bNNxYun5ArmRjvIxjOGqXDCs=";
};
# Alternative: Downloaded manually and place in this directory
# src = ./pianoteq_linux_v754.7z;
desktopItems = [
(makeDesktopItem {
name = "pianoteq7";
desktopName = "Pianoteq 7";
exec = "pianoteq7";
icon = "pianoteq_icon_128";
})
];
nativeBuildInputs = [
p7zip
copyDesktopItems
];
libPath = lib.makeLibraryPath [
alsa-lib
freetype
xorg.libX11
xorg.libXext
stdenv.cc.cc.lib
libjack2
lv2
];
unpackCmd = "7z x ${src}";
# `runHook postInstall` is mandatory otherwise postInstall won't run
installPhase = ''
install -Dm 755 x86-64bit/Pianoteq\ 7 $out/bin/pianoteq7
install -Dm 755 x86-64bit/Pianoteq\ 7.lv2/Pianoteq_7.so \
$out/lib/lv2/Pianoteq\ 7.lv2/Pianoteq_7.so
patchelf --set-interpreter "$(< $NIX_CC/nix-support/dynamic-linker)" \
--set-rpath $libPath "$out/bin/pianoteq7"
cd x86-64bit/Pianoteq\ 7.lv2/
for i in *.ttl; do
install -D "$i" "$out/lib/lv2/Pianoteq 7.lv2/$i"
done
runHook postInstall
'';
# This also works instead of the following
# makeWrapper $out/bin/pianoteq7 $out/bin/pianoteq7_wrapped --prefix LD_LIBRARY_PATH : "$libPath"
fixupPhase = '':'';
# Runs copyDesktopItems hook.
# Alternatively call copyDesktopItems manually in installPhase/fixupPhase
postInstall = ''
install -Dm 444 ${icon} $out/share/icons/hicolor/128x128/apps/pianoteq_icon_128.png
'';
meta = {
homepage = "https://www.modartt.com/";
description = "Pianoteq is a virtual instrument which in contrast to other virtual instruments is physically modelled and thus can simulate the playability and complex behaviour of real acoustic instruments. Because there are no samples, the file size is just a tiny fraction of that required by other virtual instruments.";
platforms = lib.platforms.linux;
};
};
};
}