summaryrefslogtreecommitdiff
path: root/pkgs/by-name/co/commit/package.nix
blob: 96e15a4e80238e8fbc97395746e29c11ca67eba2 (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
{
  lib,
  stdenv,
  appstream,
  blueprint-compiler,
  desktop-file-utils,
  fetchFromGitHub,
  gjs,
  glib,
  gtk4,
  gtksourceview5,
  libadwaita,
  libspelling,
  meson,
  ninja,
  nix-update-script,
  pkg-config,
  wrapGAppsHook4,
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "commit";
  version = "4.3";

  src = fetchFromGitHub {
    owner = "sonnyp";
    repo = "Commit";
    tag = "v${finalAttrs.version}";
    hash = "sha256-yNzMFOd0IN5EUKG7ztCEbQzQ9RHc+D4iC1OiBauMSwE=";
    fetchSubmodules = true;
  };

  patches = [
    # Instead of using the absolute path in command snippets,
    # assume `re.sonny.Commit` is already in PATH. This prevents
    # configurations from breaking when our store path changes
    ./command-from-path.patch
  ];

  # gjs uses the invocation name to add gresource files
  # to get around this, we set the entry point name manually
  #
  # `/usr/bin/env` is also used quite a bit
  postPatch = ''
    sed -i "1 a imports.package._findEffectiveEntryPointName = () => 're.sonny.Commit';" src/bin.js
    patchShebangs {,.}*
  '';

  strictDeps = true;

  nativeBuildInputs = [
    appstream
    blueprint-compiler
    desktop-file-utils # for `desktop-file-validate` & `update-desktop-database`
    gjs
    glib # for `glib-compile-schemas`
    gtk4 # for `gtk-update-icon-cache`
    meson
    ninja
    pkg-config
    wrapGAppsHook4
  ];

  buildInputs = [
    gjs
    gtksourceview5
    libadwaita
    libspelling
  ];

  doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform;

  passthru = {
    updateScript = nix-update-script { };
  };

  meta = {
    description = "Commit message editor";
    homepage = "https://github.com/sonnyp/Commit";
    license = lib.licenses.gpl3Only;
    maintainers = lib.teams.gnome-circle.members;
    mainProgram = "re.sonny.Commit";
    platforms = lib.platforms.linux;
  };
})