summary refs log tree commit diff
path: root/pkgs/applications/misc/sticky/default.nix
blob: 0d1026f053fd5179af57224473a0f9b498f23fab (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
{ lib
, python3
, fetchFromGitHub
, wrapGAppsHook
, cinnamon
, glib
, gspell
, gtk3
, gobject-introspection
, gitUpdater
}:

python3.pkgs.buildPythonApplication rec {
  pname = "sticky";
  version = "1.16";
  format = "other";

  src = fetchFromGitHub {
    owner = "linuxmint";
    repo = pname;
    rev = version;
    hash = "sha256-+opzjvSdGwwn1imNzSsfD9rfs4naSXzcMBJRPhKW2WM=";
  };

  postPatch = ''
    sed -i -e "s|/usr/share|$out/share|" usr/lib/sticky/*.py
  '';

  nativeBuildInputs = [
    gobject-introspection
    wrapGAppsHook
  ];

  buildInputs = [
    glib
    cinnamon.xapp
    gspell
  ];

  propagatedBuildInputs = with python3.pkgs; [
    pygobject3
    xapp
  ];

  postBuild = ''
    glib-compile-schemas usr/share/glib-2.0/schemas
  '';

  # hook for gobject-introspection doesn't like strictDeps
  # https://github.com/NixOS/nixpkgs/issues/56943
  strictDeps = false;

  # no tests
  doCheck = false;

  dontWrapGApps = true;

  installPhase = ''
    runHook preInstall

    mkdir -p $out/bin
    mv usr/lib $out
    mv usr/share $out
    patchShebangs $out/lib/sticky
    mv $out/lib/sticky/sticky.py $out/bin/sticky
    sed -i -e "1aimport sys;sys.path.append('$out/lib/sticky')" $out/bin/sticky

    runHook postInstall
  '';

  # Arguments to be passed to `makeWrapper`, only used by buildPython*
  preFixup = ''
    makeWrapperArgs+=("''${gappsWrapperArgs[@]}")
  '';

  passthru = {
    updateScript = gitUpdater {
      ignoredVersions = ''master.*'';
    };
  };

  meta = with lib; {
    description = "A sticky notes app for the linux desktop";
    homepage = "https://github.com/linuxmint/sticky";
    license = licenses.gpl2Only;
    platforms = platforms.linux;
    maintainers = with maintainers; [ linsui bobby285271 ];
  };
}