Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 qtbase, 6 qmake, 7 qtwebsockets, 8 minizinc, 9 makeWrapper, 10 copyDesktopItems, 11 makeDesktopItem, 12 imagemagick, 13}: 14 15let 16 executableLoc = 17 if stdenv.hostPlatform.isDarwin then 18 "$out/Applications/MiniZincIDE.app/Contents/MacOS/MiniZincIDE" 19 else 20 "$out/bin/MiniZincIDE"; 21in 22stdenv.mkDerivation rec { 23 pname = "minizinc-ide"; 24 version = "2.9.3"; 25 26 src = fetchFromGitHub { 27 owner = "MiniZinc"; 28 repo = "MiniZincIDE"; 29 rev = version; 30 hash = "sha256-wYS46keOPPQLs0fFeSeb2wz+VX6A1UUGjiGzHZhPxVk="; 31 fetchSubmodules = true; 32 }; 33 34 nativeBuildInputs = [ 35 qmake 36 makeWrapper 37 copyDesktopItems 38 imagemagick 39 ]; 40 buildInputs = [ 41 qtbase 42 qtwebsockets 43 ]; 44 45 desktopItems = [ 46 (makeDesktopItem { 47 name = "MiniZincIDE"; 48 desktopName = "MiniZincIDE"; 49 icon = "minizinc"; 50 comment = meta.description; 51 exec = "MiniZincIDE"; 52 type = "Application"; 53 terminal = false; 54 categories = [ 55 "Science" 56 "Development" 57 "Education" 58 ]; 59 }) 60 ]; 61 62 sourceRoot = "${src.name}/MiniZincIDE"; 63 64 dontWrapQtApps = true; 65 66 postInstall = 67 lib.optionalString stdenv.hostPlatform.isDarwin '' 68 mkdir -p $out/Applications 69 mv $out/bin/MiniZincIDE.app $out/Applications/ 70 '' 71 + '' 72 wrapProgram ${executableLoc} \ 73 --prefix PATH ":" ${lib.makeBinPath [ minizinc ]} \ 74 --set QT_QPA_PLATFORM_PLUGIN_PATH "${qtbase}/lib/qt-6/plugins/platforms" 75 76 for size in 16 24 32 48 64 128 256 512; do 77 mkdir -p $out/share/icons/hicolor/"$size"x"$size"/apps 78 magick -background none ${src}/MiniZincIDE/images/mznicon.png -resize "$size"x"$size" $out/share/icons/hicolor/"$size"x"$size"/apps/minizinc.png 79 done 80 ''; 81 82 meta = with lib; { 83 homepage = "https://www.minizinc.org/"; 84 description = "IDE for MiniZinc, a medium-level constraint modelling language"; 85 mainProgram = "MiniZincIDE"; 86 longDescription = '' 87 MiniZinc is a medium-level constraint modelling 88 language. It is high-level enough to express most 89 constraint problems easily, but low-level enough 90 that it can be mapped onto existing solvers easily and consistently. 91 It is a subset of the higher-level language Zinc. 92 ''; 93 license = licenses.mpl20; 94 platforms = platforms.unix; 95 maintainers = [ maintainers.dtzWill ]; 96 }; 97}