about summary refs log tree commit diff
path: root/pkgs/applications/graphics/antimony/default.nix
blob: b55e6a8a5bb0067ce455604a4ced42f9b04ac68c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
{ lib, stdenv, fetchFromGitHub, libpng, python3
, libGLU, libGL, qtbase, wrapQtAppsHook, ncurses
, cmake, flex, lemon
, makeDesktopItem, copyDesktopItems
}:

let
  gitRev    = "8b805c674adad536f9dd552b4be75fadcb3c7db6";
  gitBranch = "develop";
  gitTag    = "0.9.3";
in
  stdenv.mkDerivation {
    pname = "antimony";
    version = "2022-11-23";

    src = fetchFromGitHub {
      owner  = "mkeeter";
      repo   = "antimony";
      rev    = gitRev;
      sha256 = "NmOuBewfHqtAim2cNP62LXgRjVWuVUGweV46sY1qjGk=";
    };

    patches = [ ./paths-fix.patch ];

    postPatch = ''
       sed -i "s,/usr/local,$out,g" \
       app/CMakeLists.txt app/app/app.cpp app/app/main.cpp
       sed -i "s,python3,${python3.executable}," CMakeLists.txt
    '';

    postInstall = lib.optionalString stdenv.hostPlatform.isLinux ''
      install -Dm644 $src/deploy/icon.svg $out/share/icons/hicolor/scalable/apps/antimony.svg
      install -Dm644 ${./mimetype.xml} $out/share/mime/packages/antimony.xml
    '';

    buildInputs = [
      libpng python3 python3.pkgs.boost
      libGLU libGL qtbase ncurses
    ];

    nativeBuildInputs = [ cmake flex lemon wrapQtAppsHook copyDesktopItems ];

    desktopItems = [
      (makeDesktopItem {
        name = "antimony";
        desktopName = "Antimony";
        comment="Tree-based Modeler";
        genericName = "CAD Application";
        exec = "antimony %f";
        icon = "antimony";
        categories = [ "Graphics" "Science" "Engineering" ];
        mimeTypes = [ "application/x-extension-sb" "application/x-antimony" ];
        startupWMClass = "antimony";
      })
    ];

    cmakeFlags= [
      "-DGITREV=${gitRev}"
      "-DGITTAG=${gitTag}"
      "-DGITBRANCH=${gitBranch}"
    ];

    meta = with lib; {
      description = "Computer-aided design (CAD) tool from a parallel universe";
      mainProgram = "antimony";
      homepage    = "https://github.com/mkeeter/antimony";
      license     = licenses.mit;
      maintainers = with maintainers; [ rnhmjoj ];
      platforms   = platforms.linux;
    };
  }