diff --git a/pkgs/applications/audio/easyabc/default.nix b/pkgs/applications/audio/easyabc/default.nix new file mode 100644 index 000000000000000..9f45d045241325a --- /dev/null +++ b/pkgs/applications/audio/easyabc/default.nix @@ -0,0 +1,65 @@ +{ lib, fetchFromGitHub, substituteAll, makeWrapper, python39, fluidsynth, soundfont-fluid, wrapGAppsHook, abcmidi, abcm2ps, ghostscript }: + +# requires python39 due to https://stackoverflow.com/a/71902541 https://github.com/jwdj/EasyABC/issues/52 +python39.pkgs.buildPythonApplication { + pname = "easyabc"; + version = "1.3.8.6"; + + src = fetchFromGitHub { + owner = "jwdj"; + repo = "easyabc"; + rev = "6461b2c14280cb64224fc5299c31cfeef9b7d43c"; + hash = "sha256-leC3A4HQMeJNeZXArb3YAYr2mddGPcws618NrRh2Q1Y="; + }; + + nativeBuildInputs = [ wrapGAppsHook ]; + + propagatedBuildInputs = with python39.pkgs; [ + cx_Freeze + wxPython_4_2 + pygame + ]; + + # apparently setup.py only supports Windows and Darwin + # everything is very non-standard in this project + dontBuild = true; + format = "other"; + + # https://discourse.nixos.org/t/packaging-mcomix3-python-gtk-missing-gsettings-schemas-issue/10190/2 + strictDeps = false; + + patches = [ + (substituteAll { + src = ./hardcoded-paths.patch; + fluidsynth = "${fluidsynth}/lib/libfluidsynth.so"; + soundfont = "${soundfont-fluid}/share/soundfonts/FluidR3_GM2-2.sf2"; + ghostscript = "${ghostscript}/bin/gs"; + }) + ]; + + installPhase = '' + runHook preInstall + + mkdir -p $out/share/easyabc + mv * $out/share/easyabc + + ln -s ${abcmidi}/bin/abc2midi $out/share/easyabc/bin/abc2midi + ln -s ${abcmidi}/bin/midi2abc $out/share/easyabc/bin/midi2abc + ln -s ${abcmidi}/bin/abc2abc $out/share/easyabc/bin/abc2abc + ln -s ${abcm2ps}/bin/abcm2ps $out/share/easyabc/bin/abcm2ps + + makeWrapper ${python39.interpreter} $out/bin/easyabc \ + --set PYTHONPATH "$PYTHONPATH:$out/share/easyabc" \ + --add-flags "-O $out/share/easyabc/easy_abc.py" + + runHook postInstall + ''; + + meta = { + description = "ABC music notation editor"; + homepage = "https://easyabc.sourceforge.net/"; + license = lib.licenses.gpl2Plus; + platforms = lib.platforms.linux; + maintainers = with lib.maintainers; [ mausch ]; + }; +} diff --git a/pkgs/applications/audio/easyabc/hardcoded-paths.patch b/pkgs/applications/audio/easyabc/hardcoded-paths.patch new file mode 100644 index 000000000000000..e3ac1e58d7a9a9b --- /dev/null +++ b/pkgs/applications/audio/easyabc/hardcoded-paths.patch @@ -0,0 +1,43 @@ +--- + easy_abc.py | 4 ++++ + fluidsynth.py | 2 ++ + 2 files changed, 6 insertions(+) + +diff --git a/easy_abc.py b/easy_abc.py +index 5be3e6a..40c999a 100644 +--- a/easy_abc.py ++++ b/easy_abc.py +@@ -3960,6 +3960,8 @@ class MainFrame(wx.Frame): + else: + default_soundfont_path = '/usr/share/sounds/sf2/FluidR3_GM.sf2' + ++ default_soundfont_path = '@soundfont@' ++ + soundfont_path = settings.get('soundfont_path', default_soundfont_path) + self.uses_fluidsynth = False + if fluidsynth_available and soundfont_path and os.path.exists(soundfont_path): +@@ -8367,6 +8369,8 @@ class MainFrame(wx.Frame): + gs_path = '/usr/bin/pstopdf' + settings['gs_path'] = gs_path + ++ settings['gs_path'] = '@ghostscript@' ++ + # 1.3.6.1 [SS] 2015-01-12 2015-01-22 + gs_path = settings['gs_path'] #eliminate trailing \n + if gs_path and (os.path.exists(gs_path) == False): +diff --git a/fluidsynth.py b/fluidsynth.py +index 529ebbf..b5d9377 100644 +--- a/fluidsynth.py ++++ b/fluidsynth.py +@@ -44,6 +44,8 @@ if platform.system() == 'Windows': + else: + lib_locations = ['./libfluidsynth.so.3', 'libfluidsynth.so.3', './libfluidsynth.so.2', 'libfluidsynth.so.2'] + ++lib_locations = ['@fluidsynth@'] ++ + i = 0 + while i < len(lib_locations): + try: +-- +2.38.5 + diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 587345e59742ed3..03c9ce3db4a3338 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -4797,6 +4797,8 @@ with pkgs; earlyoom = callPackage ../os-specific/linux/earlyoom { }; + easyabc = callPackage ../applications/audio/easyabc { }; + easycrypt = callPackage ../applications/science/logic/easycrypt { }; easycrypt-runtest = callPackage ../applications/science/logic/easycrypt/runtest.nix { };