1{
2 lib,
3 stdenv,
4 appstream,
5 blueprint-compiler,
6 desktop-file-utils,
7 fetchFromGitHub,
8 gjs,
9 glib,
10 gtk4,
11 gtksourceview5,
12 libadwaita,
13 libspelling,
14 meson,
15 ninja,
16 nix-update-script,
17 pkg-config,
18 wrapGAppsHook4,
19}:
20
21stdenv.mkDerivation (finalAttrs: {
22 pname = "commit";
23 version = "4.3";
24
25 src = fetchFromGitHub {
26 owner = "sonnyp";
27 repo = "Commit";
28 tag = "v${finalAttrs.version}";
29 hash = "sha256-yNzMFOd0IN5EUKG7ztCEbQzQ9RHc+D4iC1OiBauMSwE=";
30 fetchSubmodules = true;
31 };
32
33 patches = [
34 # Instead of using the absolute path in command snippets,
35 # assume `re.sonny.Commit` is already in PATH. This prevents
36 # configurations from breaking when our store path changes
37 ./command-from-path.patch
38 ];
39
40 # gjs uses the invocation name to add gresource files
41 # to get around this, we set the entry point name manually
42 #
43 # `/usr/bin/env` is also used quite a bit
44 postPatch = ''
45 sed -i "1 a imports.package._findEffectiveEntryPointName = () => 're.sonny.Commit';" src/bin.js
46 patchShebangs {,.}*
47 '';
48
49 strictDeps = true;
50
51 nativeBuildInputs = [
52 appstream
53 blueprint-compiler
54 desktop-file-utils # for `desktop-file-validate` & `update-desktop-database`
55 gjs
56 glib # for `glib-compile-schemas`
57 gtk4 # for `gtk-update-icon-cache`
58 meson
59 ninja
60 pkg-config
61 wrapGAppsHook4
62 ];
63
64 buildInputs = [
65 gjs
66 gtksourceview5
67 libadwaita
68 libspelling
69 ];
70
71 doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform;
72
73 passthru = {
74 updateScript = nix-update-script { };
75 };
76
77 meta = {
78 description = "Commit message editor";
79 homepage = "https://github.com/sonnyp/Commit";
80 license = lib.licenses.gpl3Only;
81 teams = [ lib.teams.gnome-circle ];
82 mainProgram = "re.sonny.Commit";
83 platforms = lib.platforms.linux;
84 };
85})