nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 95 lines 2.3 kB view raw
1{ 2 stdenv, 3 lib, 4 fetchFromGitHub, 5 cmake, 6 qt6, 7 assimp, 8 opencascade-occt, 9 ctestCheckHook, 10 copyDesktopItems, 11 makeDesktopItem, 12 # options 13 withAssimp ? true, 14}: 15stdenv.mkDerivation (finalAttrs: { 16 version = "0.9.0"; 17 pname = "mayo"; 18 19 src = fetchFromGitHub { 20 owner = "fougue"; 21 repo = "mayo"; 22 tag = "v${finalAttrs.version}"; 23 hash = "sha256-A2ODbbOyoWIhKOWGzSQS2gUF8kpWlN8hN8CdeumAUps="; 24 }; 25 26 cmakeFlags = [ 27 (lib.cmakeOptionType "string" "Mayo_VersionMajor" (lib.versions.major finalAttrs.version)) 28 (lib.cmakeOptionType "string" "Mayo_VersionMinor" (lib.versions.minor finalAttrs.version)) 29 (lib.cmakeOptionType "string" "Mayo_VersionPatch" (lib.versions.patch finalAttrs.version)) 30 (lib.cmakeBool "Mayo_BuildTests" finalAttrs.doCheck) 31 ] 32 ++ lib.optional withAssimp "-DMayo_BuildPluginAssimp=ON"; 33 34 strictDeps = true; 35 buildInputs = [ 36 qt6.qtbase 37 qt6.qtsvg 38 opencascade-occt 39 ] 40 ++ lib.optional withAssimp assimp; 41 42 nativeBuildInputs = [ 43 qt6.wrapQtAppsHook 44 copyDesktopItems 45 cmake 46 ]; 47 desktopItems = [ 48 (makeDesktopItem { 49 name = "mayo"; 50 exec = "mayo"; 51 desktopName = "Mayo"; 52 icon = "mayo"; 53 comment = finalAttrs.meta.description; 54 categories = [ 55 "Graphics" 56 "3DGraphics" 57 "Engineering" 58 ]; 59 }) 60 ]; 61 62 doCheck = true; 63 nativeCheckInputs = [ 64 ctestCheckHook 65 ]; 66 67 installPhase = '' 68 runHook preInstall 69 70 install -Dm755 mayo $out/bin/mayo 71 install -Dm755 mayo-conv $out/bin/mayo-conv 72 73 pushd .. 74 install -Dm444 images/appicon.svg "$out/share/icons/hicolor/scalable/apps/mayo.svg" 75 install -Dm444 images/appicon_256.png "$out/share/icons/hicolor/256x256/apps/mayo.png" 76 '' 77 + lib.optionalString stdenv.hostPlatform.isDarwin '' 78 install -Dm444 images/appicons.icns "$out/Applications/Mayo.app/Contents/Resources/mayo.icns" 79 '' 80 + '' 81 popd 82 83 runHook postInstall 84 ''; 85 86 meta = { 87 description = "3D CAD viewer and converter based on Qt + OpenCascade"; 88 mainProgram = "mayo"; 89 changelog = "https://github.com/fougue/mayo/releases/tag/v${finalAttrs.version}"; 90 homepage = "https://github.com/fougue/mayo"; 91 maintainers = [ lib.maintainers.gigahawk ]; 92 platforms = with lib.platforms; linux ++ darwin; 93 license = lib.licenses.bsd2; 94 }; 95})