nixpkgs/pkgs/applications/misc/lenmus/default.nix
Artturin e0464e4788 treewide: replace stdenv.is with stdenv.hostPlatform.is
In preparation for the deprecation of `stdenv.isX`.

These shorthands are not conducive to cross-compilation because they
hide the platforms.

Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way

One example of why this is bad and especially affects compiler packages
https://www.github.com/NixOS/nixpkgs/pull/343059

There are too many files to go through manually but a treewide should
get users thinking when they see a `hostPlatform.isX` in a place where it
doesn't make sense.

```
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is"
fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is"
```
2024-09-25 00:04:37 +03:00

99 lines
2.2 KiB
Nix

{ lib
, stdenv
, fetchFromGitHub
, cmake
, pkg-config
, makeWrapper
, boost
, portmidi
, sqlite
, freetype
, libpng
, pngpp
, zlib
, wxGTK32
, wxsqlite3
, fluidsynth
, fontconfig
, darwin
, soundfont-fluid
, openlilylib-fonts
}:
let
inherit (darwin.apple_sdk.frameworks) Cocoa;
in
stdenv.mkDerivation rec {
pname = "lenmus";
version = "6.0.1";
src = fetchFromGitHub {
owner = "lenmus";
repo = "lenmus";
rev = "Release_${version}";
sha256 = "sha256-qegOAc6vs2+6VViDHVjv0q+qjLZyTT7yPF3hFpTt5zE=";
};
postPatch = ''
substituteInPlace CMakeLists.txt \
--replace "/usr" "${placeholder "out"}"
sed -i 's/fixup_bundle.*")/")/g' CMakeLists.txt
'';
nativeBuildInputs = [
cmake
pkg-config
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
makeWrapper
];
buildInputs = [
boost
portmidi
sqlite
freetype
libpng
pngpp
zlib
wxGTK32
wxsqlite3
fluidsynth
fontconfig
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
Cocoa
];
preConfigure = ''
mkdir res/fonts
ln -s ${openlilylib-fonts.bravura}/share/lilypond/*/fonts/otf/Bravura.otf res/fonts/Bravura.otf
ln -s ${soundfont-fluid}/share/soundfonts/FluidR3_GM2-2.sf2 res/sounds/FluidR3_GM.sf2
'';
cmakeFlags = [
"-DCMAKE_INSTALL_PREFIX=${placeholder "out"}"
"-DLENMUS_INSTALL_SOUNDFONT=ON"
"-DMAN_INSTALL_DIR=${placeholder "out"}/share/man"
];
postInstall = lib.optionalString stdenv.hostPlatform.isDarwin ''
mkdir -p $out/{Applications,bin}
mv $out/lenmus.app $out/Applications
mv $out/Resources $out/Applications/lenmus.app/Contents
makeWrapper $out/{Applications/lenmus.app/Contents/MacOS,bin}/lenmus
'';
meta = with lib; {
description = "LenMus Phonascus is a program for learning music";
longDescription = ''
LenMus Phonascus is a free open source program (GPL v3) for learning music.
It allows you to focus on specific skills and exercises, on both theory and aural training.
The different activities can be customized to meet your needs
'';
homepage = "http://www.lenmus.org/";
license = licenses.gpl3Plus;
maintainers = with maintainers; [ ramkromberg ];
platforms = with platforms; unix;
mainProgram = "lenmus";
};
}