|
| 1 | +{ |
| 2 | + stdenv, |
| 3 | + lib, |
| 4 | + fetchFromGitHub, |
| 5 | + nix-update-script, |
| 6 | + cmake, |
| 7 | + pkg-config, |
| 8 | + writableTmpDirAsHomeHook, |
| 9 | + libx11, |
| 10 | + libxrandr, |
| 11 | + libxinerama, |
| 12 | + libxext, |
| 13 | + libxcursor, |
| 14 | + libxtst, |
| 15 | + freetype, |
| 16 | + fontconfig, |
| 17 | + webkitgtk_4_1, |
| 18 | + curl, |
| 19 | + alsa-lib, |
| 20 | + libsysprof-capture, |
| 21 | + pcre2, |
| 22 | + util-linux, |
| 23 | + libselinux, |
| 24 | + libsepol, |
| 25 | + libthai, |
| 26 | + libdatrie, |
| 27 | + libxdmcp, |
| 28 | + libdeflate, |
| 29 | + lerc, |
| 30 | + xz, |
| 31 | + libwebp, |
| 32 | + libxkbcommon, |
| 33 | + libepoxy, |
| 34 | + sqlite, |
| 35 | + |
| 36 | + buildStandalone ? true, |
| 37 | +}: |
| 38 | +stdenv.mkDerivation (finalAttrs: { |
| 39 | + name = "filtr"; |
| 40 | + version = "1.1.0"; |
| 41 | + |
| 42 | + src = fetchFromGitHub { |
| 43 | + owner = "tiagolr"; |
| 44 | + repo = "filtr"; |
| 45 | + tag = "v${finalAttrs.version}"; |
| 46 | + fetchSubmodules = true; |
| 47 | + hash = "sha256-LRVwJ/Eh+XeNGnlbd2c56hWV8StHZGhxy0XLjGZ0toY="; |
| 48 | + }; |
| 49 | + |
| 50 | + nativeBuildInputs = [ |
| 51 | + cmake |
| 52 | + pkg-config |
| 53 | + writableTmpDirAsHomeHook |
| 54 | + ]; |
| 55 | + |
| 56 | + buildInputs = [ |
| 57 | + libx11 |
| 58 | + libxrandr |
| 59 | + libxinerama |
| 60 | + libxext |
| 61 | + libxcursor |
| 62 | + libxtst |
| 63 | + freetype |
| 64 | + fontconfig |
| 65 | + webkitgtk_4_1 |
| 66 | + curl |
| 67 | + alsa-lib |
| 68 | + libsysprof-capture |
| 69 | + pcre2 |
| 70 | + util-linux |
| 71 | + libselinux |
| 72 | + libsepol |
| 73 | + libthai |
| 74 | + libdatrie |
| 75 | + libxdmcp |
| 76 | + libdeflate |
| 77 | + lerc |
| 78 | + xz |
| 79 | + libwebp |
| 80 | + libxkbcommon |
| 81 | + libepoxy |
| 82 | + sqlite |
| 83 | + ]; |
| 84 | + |
| 85 | + # JUCE dlopens these at runtime, standalone executable crashes without them |
| 86 | + NIX_LDFLAGS = [ |
| 87 | + "-lX11" |
| 88 | + "-lXext" |
| 89 | + "-lXcomposite" |
| 90 | + "-lXcursor" |
| 91 | + "-lXinerama" |
| 92 | + "-lXrandr" |
| 93 | + "-lXrender" |
| 94 | + "-lXtst" |
| 95 | + "-lXdmcp" |
| 96 | + ]; |
| 97 | + |
| 98 | + # Fontconfig error: Cannot load default config file: No such file: (null) |
| 99 | + env.FONTCONFIG_FILE = "${fontconfig.out}/etc/fonts/fonts.conf"; |
| 100 | + |
| 101 | + postPatch = '' |
| 102 | + substituteInPlace CMakeLists.txt \ |
| 103 | + --replace-fail "juce::juce_recommended_lto_flags" "# Not forcing LTO" |
| 104 | +
|
| 105 | + substituteInPlace CMakeLists.txt \ |
| 106 | + --replace-fail "COPY_PLUGIN_AFTER_BUILD TRUE" "COPY_PLUGIN_AFTER_BUILD FALSE" |
| 107 | + ''; |
| 108 | + |
| 109 | + cmakeFlags = [ |
| 110 | + (lib.cmakeFeature "CMAKE_AR" (lib.getExe' stdenv.cc.cc "gcc-ar")) |
| 111 | + (lib.cmakeFeature "CMAKE_RANLIB" (lib.getExe' stdenv.cc.cc "gcc-ranlib")) |
| 112 | + (lib.cmakeBool "BUILD_STANDALONE" buildStandalone) |
| 113 | + ]; |
| 114 | + |
| 115 | + installPhase = '' |
| 116 | + runHook preInstall |
| 117 | +
|
| 118 | + pushd FILTR_artefacts/Release |
| 119 | + ${lib.optionalString buildStandalone '' |
| 120 | + install -Dm755 Standalone/FILT-R -t $out/bin |
| 121 | + ''} |
| 122 | +
|
| 123 | + mkdir -p $out/lib/{vst3,lv2} |
| 124 | + cp -r VST3/FILT-R.vst3 $out/lib/vst3 |
| 125 | + cp -r LV2/FILT-R.lv2 $out/lib/lv2 |
| 126 | + popd |
| 127 | +
|
| 128 | + runHook postInstall |
| 129 | + ''; |
| 130 | + |
| 131 | + passthru.updateScript = nix-update-script { }; |
| 132 | + |
| 133 | + meta = { |
| 134 | + description = "Envelope based filter modulator"; |
| 135 | + homepage = "https://github.com/tiagolr/filtr"; |
| 136 | + platforms = [ "x86_64-linux" ]; |
| 137 | + license = lib.licenses.gpl3Plus; |
| 138 | + maintainers = [ lib.maintainers.mrtnvgr ]; |
| 139 | + mainProgram = lib.optionalString buildStandalone "FILT-R"; |
| 140 | + }; |
| 141 | +}) |
0 commit comments