16 "x86_64-linux" = "linux_x86_64";
17 "i686-linux" = "linux_x86";
18 "aarch64-linux" = "linux_arm64";
19 "armv7l-linux" = "arm_armhf_raspberry_pi";
20 "x86_64-darwin" = "macos";
21 "aarch64-darwin" = "macos";
23 bindir = platforms."${stdenv.hostPlatform.system}" or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
25 stdenv.mkDerivation (finalAttrs: {
31 "https://www.warmplace.ru/soft/sunvox/sunvox-${finalAttrs.version}.zip"
32 # Upstream removes downloads of older versions, please save bumped versions to archive.org
33 # FIXME At the time of writing, archive.org is still recovering from the recent attacks and has not yet re-opened the page saving functionality
34 # https://blog.archive.org/2024/10/21/internet-archive-services-update-2024-10-21/
36 hash = "sha256-7DZyoOz3jDYsuGqbs0PRs6jdWCxBhSDUKk8KVJQm/3o=";
39 nativeBuildInputs = lib.optionals stdenv.hostPlatform.isLinux [
41 ] ++ lib.optionals stdenv.hostPlatform.isDarwin [
45 buildInputs = lib.optionals stdenv.hostPlatform.isLinux [
53 runtimeDependencies = lib.optionals stdenv.hostPlatform.isLinux [
63 # Delete platform-specific data for all the platforms we're not building for
64 find sunvox -mindepth 1 -maxdepth 1 -type d -not -name "${bindir}" -exec rm -r {} \;
66 mkdir -p $out/{bin,share/sunvox}
67 mv * $out/share/sunvox/
69 '' + lib.optionalString stdenv.hostPlatform.isLinux ''
70 for binary in $(find $out/share/sunvox/sunvox/${bindir}/ -type f -executable); do
71 mv $binary $out/bin/$(basename $binary)
74 # Cleanup, make sure we didn't miss anything
75 find $out/share/sunvox/sunvox -type f -name readme.txt -delete
76 rmdir $out/share/sunvox/sunvox/${bindir} $out/share/sunvox/sunvox
77 '' + lib.optionalString stdenv.hostPlatform.isDarwin ''
78 mkdir $out/Applications
79 ln -s $out/share/sunvox/sunvox/${bindir}/SunVox.app $out/Applications/
80 ln -s $out/share/sunvox/sunvox/${bindir}/reset_sunvox $out/bin/
82 # Need to use a wrapper, binary checks for files relative to the path it was called via
83 makeWrapper $out/Applications/SunVox.app/Contents/MacOS/SunVox $out/bin/sunvox
90 description = "Small, fast and powerful modular synthesizer with pattern-based sequencer";
91 license = licenses.unfreeRedistributable;
92 sourceProvenance = with sourceTypes; [ binaryNativeCode ];
93 homepage = "https://www.warmplace.ru/soft/sunvox/";
94 maintainers = with maintainers; [ puffnfresh OPNA2608 ];
95 platforms = lib.attrNames platforms;