summary refs log tree commit diff
path: root/pkgs/applications/misc/plots/default.nix
blob: 01a60baa2ab3494e5760ba3a284905922cbf152d (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
72
73
74
75
76
77
{ fetchFromGitHub
, gobject-introspection
, lib
, libadwaita
, python3
, wrapGAppsHook
, lmmath
}:
python3.pkgs.buildPythonApplication rec {
  pname = "plots";
  version = "0.8.5";

  src = fetchFromGitHub {
    owner = "alexhuntley";
    repo = "Plots";
    rev = "v${version}";
    hash = "sha256-GjNpaorxkkhZsqrKq4kO5nqF5+4I4tmSc023AZpY8Sw=";
  };

  nativeBuildInputs = [
    gobject-introspection
    wrapGAppsHook
  ];

  propagatedBuildInputs = [
    libadwaita
    (python3.withPackages (p: with p; [
      numpy
      pygobject3
      lark
      jinja2
      freetype-py
      pyopengl
      pycairo
      pyglm
    ]))
  ];

  nativeCheckInputs = [
    (python3.withPackages (p: with p; [
      pytest
    ]))
  ];

  dontWrapGApps = true;

  preFixup = ''
    makeWrapperArgs+=("''${gappsWrapperArgs[@]}")
  '';

  postInstall = ''
    install -D ${lmmath}/share/fonts/opentype/latinmodern-math.otf -t $out/share/fonts/

    install -D res/com.github.alexhuntley.Plots.metainfo.xml -t $out/share/metainfo/
    install -D res/com.github.alexhuntley.Plots.desktop -t $out/share/applications/
    install -D res/com.github.alexhuntley.Plots.svg -t $out/share/icons/hicolor/scalable/apps/
    install -D res/com.github.alexhuntley.Plots-symbolic.svg -t $out/share/icons/hicolor/symbolic/apps/

    for lang_dir in help/*; do
      lang=$(basename "$lang_dir")
      install -D -t $out/share/help/$lang/plots/ $lang_dir/*
    done
  '';

  meta = with lib; {
    description = "Graph plotting app for GNOME";
    longDescription = ''
      Plots is a graph plotting app for GNOME.
      Plots makes it easy to visualise mathematical formulae.
      In addition to basic arithmetic operations, it supports trigonometric, hyperbolic, exponential and logarithmic functions, as well as arbitrary sums and products.
      It can display polar equations, and both implicit and explicit Cartesian equations.
    '';
    homepage = "https://github.com/alexhuntley/Plots";
    license = licenses.gpl3Plus;
    maintainers = with maintainers; [ sund3RRR ];
  };
}