summaryrefslogtreecommitdiff
path: root/pkgs/applications/editors/leo-editor/default.nix
blob: 51ca0eda2f00faee2fd0ae81c807152ef1206e48 (about) (plain)
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
{
  lib,
  mkDerivation,
  python3,
  fetchFromGitHub,
  makeWrapper,
  wrapQtAppsHook,
  makeDesktopItem,
}:

mkDerivation rec {
  pname = "leo-editor";
  version = "6.8.4";

  src = fetchFromGitHub {
    owner = "leo-editor";
    repo = "leo-editor";
    rev = version;
    sha256 = "sha256-CSugdfkAMy6VFdNdSGR+iCrK/XhwseoiMQ4mfgu4F/E=";
  };

  dontBuild = true;

  nativeBuildInputs = [
    wrapQtAppsHook
    makeWrapper
    python3
  ];
  propagatedBuildInputs = with python3.pkgs; [
    pyqt6
    docutils
  ];

  desktopItem = makeDesktopItem {
    name = "leo-editor";
    exec = "leo %U";
    icon = "leoapp32";
    type = "Application";
    comment = meta.description;
    desktopName = "Leo";
    genericName = "Text Editor";
    categories = [
      "Application"
      "Development"
      "IDE"
    ];
    startupNotify = false;
    mimeTypes = [
      "text/plain"
      "text/asp"
      "text/x-c"
      "text/x-script.elisp"
      "text/x-fortran"
      "text/html"
      "application/inf"
      "text/x-java-source"
      "application/x-javascript"
      "application/javascript"
      "text/ecmascript"
      "application/x-ksh"
      "text/x-script.ksh"
      "application/x-tex"
      "text/x-script.rexx"
      "text/x-pascal"
      "text/x-script.perl"
      "application/postscript"
      "text/x-script.scheme"
      "text/x-script.guile"
      "text/sgml"
      "text/x-sgml"
      "application/x-bsh"
      "application/x-sh"
      "application/x-shar"
      "text/x-script.sh"
      "application/x-tcl"
      "text/x-script.tcl"
      "application/x-texinfo"
      "application/xml"
      "text/xml"
      "text/x-asm"
    ];
  };

  installPhase = ''
    mkdir -p "$out/share/icons/hicolor/32x32/apps"
    cp leo/Icons/leoapp32.png "$out/share/icons/hicolor/32x32/apps"

    mkdir -p "$out/share/applications"
    cp $desktopItem/share/applications/* $out/share/applications

    mkdir -p $out/share/leo-editor
    mv * $out/share/leo-editor

    makeWrapper ${python3.interpreter} $out/bin/leo \
      --set PYTHONPATH "$PYTHONPATH:$out/share/leo-editor" \
      --add-flags "-O $out/share/leo-editor/launchLeo.py"

    wrapQtApp $out/bin/leo
  '';

  meta = with lib; {
    homepage = "https://leo-editor.github.io/leo-editor/";
    description = "Powerful folding editor";
    longDescription = "Leo is a PIM, IDE and outliner that accelerates the work flow of programmers, authors and web designers.";
    license = licenses.mit;
    maintainers = with maintainers; [
      leonardoce
      kashw2
    ];
    mainProgram = "leo";
  };
}