about summary refs log tree commit diff
path: root/pkgs/applications/office/timeline/default.nix
blob: 9f8bb5b563d57a80d5e4120af795503386e43f46 (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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
{ lib
, fetchurl
, python3
, gettext
, makeDesktopItem
, copyDesktopItems
, wrapGAppsHook
}:

python3.pkgs.buildPythonApplication rec {
  pname = "timeline";
  version = "2.6.0";
  format = "other";

  src = fetchurl {
    url = "mirror://sourceforge/thetimelineproj/${pname}-${version}.zip";
    sha256 = "sha256-qwH2mt3Va62QJKJGOpt5WV3QksqQaRGEif4CcPC5F2E=";
  };

  nativeBuildInputs = [ python3.pkgs.wrapPython copyDesktopItems wrapGAppsHook ];

  pythonPath = with python3.pkgs; [
    wxpython
    humblewx
    icalendar
    markdown
  ];

  nativeCheckInputs = [
    gettext
    python3.pkgs.mock
  ];

  desktopItems = [
    (makeDesktopItem {
      desktopName = "Timeline";
      name = "timeline";
      comment = "Display and navigate information on a timeline";
      icon = "timeline";
      exec = "timeline";
      categories = [ "Office" "Calendar" ];
    })
  ];

  dontBuild = true;
  doCheck = false;

  patchPhase = ''
    sed -i "s|_ROOT =.*|_ROOT = \"$out/usr/share/timeline/\"|" source/timelinelib/config/paths.py
  '';

  installPhase = ''
    runHook preInstall

    site_packages=$out/${python3.pkgs.python.sitePackages}
    install -D -m755 source/timeline.py $out/bin/timeline
    mkdir -p $site_packages
    cp -r source/timelinelib $site_packages/

    mkdir -p $out/usr/share/timeline/locale
    cp -r icons $out/usr/share/timeline/
    cp -r translations/ $out/usr/share/timeline/

    mkdir -p $out/share/icons/hicolor/{48x48,32x32,16x16}/apps
    cp icons/48.png $out/share/icons/hicolor/48x48/apps/timeline.png
    cp icons/32.png $out/share/icons/hicolor/32x32/apps/timeline.png
    cp icons/16.png $out/share/icons/hicolor/16x16/apps/timeline.png

    runHook postInstall
  '';

  # tests fail because they need an x server
  # Unable to access the X Display, is $DISPLAY set properly?
  checkPhase = ''
    runHook preCheck
    ${python3.interpreter} tools/execute-specs.py
    runHook postCheck
  '';

  dontWrapGApps = true;

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

  meta = with lib; {
    homepage = "https://thetimelineproj.sourceforge.net/";
    changelog = "https://thetimelineproj.sourceforge.net/changelog.html";
    description = "Display and navigate information on a timeline";
    mainProgram = "timeline";
    license = with licenses; [ gpl3Only cc-by-sa-30 ];
    platforms = with platforms; unix;
    maintainers = with maintainers; [ davidak ];
  };
}