about summary refs log tree commit diff
path: root/pkgs/by-name/ge/gearlever/package.nix
blob: ff238a7b6a7f5d27c5e333368ddf5143efb458f5 (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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
{
  lib,
  python3Packages,
  fetchFromGitHub,
  stdenv,
  meson,
  ninja,
  pkg-config,
  gobject-introspection,
  wrapGAppsHook4,
  desktop-file-utils,
  libadwaita,
  file,
  p7zip,
  which,
  appimage-run,
  gtk4,
  bintools,
}:

python3Packages.buildPythonApplication rec {
  pname = "gearlever";
  version = "2.0.1";
  pyproject = false; # Built with meson

  src = fetchFromGitHub {
    owner = "mijorus";
    repo = "gearlever";
    rev = version;
    hash = "sha256-f4rQXenJCZiDC9MRQkjy0mOiNkWzOPSS05GXHXlhUao=";
  };

  postPatch =
    # https://github.com/NixOS/nixpkgs/issues/302605
    # But since the author only builds on flatpak, we don't expect much on it...
    ''
      substituteInPlace build-aux/meson/postinstall.py \
        --replace-fail 'gtk-update-icon-cache' 'gtk4-update-icon-cache'
    ''
    # Some attempts to overcome flatpak assumptions
    + ''
      substituteInPlace src/lib/utils.py \
        --replace-fail '/run/host/os-release' '/etc/os-release'

      substituteInPlace src/lib/terminal.py \
        --replace-fail "cmd = ['flatpak-spawn', '--host', *command]" "cmd = [*command]"
    ''
    # Use gtk4 instead of gtk3 to get smaller closure size
    + ''
      substituteInPlace src/providers/AppImageProvider.py \
        --replace-fail "gtk-launch" "gtk4-launch"
    ''
    # We don't have `arch` in coreutils, so just return a string in advance
    + ''
      substituteInPlace src/AppDetails.py \
        --replace-fail "sandbox_sh(['arch'])" '"${stdenv.hostPlatform.uname.processor}"'
    '';

  nativeBuildInputs = [
    meson
    ninja
    pkg-config
    gobject-introspection
    wrapGAppsHook4
    desktop-file-utils
  ];

  buildInputs = [ libadwaita ];

  dependencies = with python3Packages; [
    pygobject3
    dbus-python
    pyxdg
    requests
  ];

  dontWrapGApps = true;

  makeWrapperArgs = [
    "\${gappsWrapperArgs[@]}"
    "--prefix PATH : ${
      lib.makeBinPath [
        file
        p7zip
        which
        appimage-run
        desktop-file-utils # update-desktop-database
        gtk4.dev # gtk4-launch
        bintools # readelf
      ]
    }"
  ];

  meta = {
    description = "Manage AppImages with ease";
    longDescription = ''
      Features:

      - Integrate AppImages into your app menu with just one click
      - Drag and drop files directly from your file manager
      - Keep all the AppImages organized in a custom folder
      - Open new AppImages directly with Gear lever
      - Manage updates: keep older versions installed or replace
        them with the latest release
      - Save CLI apps with their executable name automatically
      - Modern and Fresh UI
    '';
    homepage = "https://mijorus.it/projects/gearlever";
    license = with lib.licenses; [
      gpl3Plus
      cc0
    ];
    mainProgram = "gearlever";
    maintainers = with lib.maintainers; [ aleksana ];
    platforms = lib.platforms.linux;
  };
}