packages/sonnyp-commit: init at 3.2.0

This commit is contained in:
Max Headroom 2023-03-04 09:10:14 +01:00
parent 7b481bc519
commit 7419112028
3 changed files with 98 additions and 0 deletions

View file

@ -0,0 +1,32 @@
By default, commit displays something along of "git config core.editors /nix/store/[...]/bin/re.sonny.Commit"
as command to set it as git editor. Since this would break on upgrades, just use the non-versioned binary
diff --git a/src/welcome.js b/src/welcome.js
index c410e2d..62e46ba 100644
--- a/src/welcome.js
+++ b/src/welcome.js
@@ -70,24 +70,7 @@ export default function Welcome({ application }) {
}
function getCommand() {
- const FLATPAK_ID = GLib.getenv("FLATPAK_ID");
- const { programInvocationName } = system;
-
- if (FLATPAK_ID) {
- return `flatpak run --file-forwarding ${FLATPAK_ID} @@`;
- }
-
- // re.sonny.Commit
- if (programInvocationName === GLib.path_get_basename(programInvocationName)) {
- return programInvocationName;
- }
-
- // ./re.sonny.commit
- // /home/sonny/re.sonny.Commit
- return GLib.canonicalize_filename(
- programInvocationName,
- GLib.get_current_dir(),
- );
+ return "re.sonny.Commit";
}
function getRange(key) {

View file

@ -0,0 +1,64 @@
{ stdenv
, lib
, desktop-file-utils
, meson
, ninja
, gettext
, pkg-config
, gtk4
, gtksourceview5
, gobject-introspection
, wrapGAppsHook4
, fetchFromGitHub
, gjs
, libadwaita
}:
stdenv.mkDerivation rec {
pname = "commit";
version = "3.2.0";
src = fetchFromGitHub {
owner = "sonnyp";
repo = "Commit";
rev = "v${version}";
hash = "sha256-nnjHuE7MzCuoPfCb4MA00BIzLPbhgR6mbeWYagmNjME=";
};
patches = [
./always-use-latest.patch
];
nativeBuildInputs = [
desktop-file-utils
gettext
meson
ninja
pkg-config
wrapGAppsHook4
];
buildInputs = [
gjs
gtk4
gtksourceview5
libadwaita
gobject-introspection
];
postPatch = ''
substituteInPlace src/re.sonny.Commit \
--replace "/usr/bin/env -S gjs" ${gjs}/bin/gjs
'';
dontPatchShebangs = true;
meta = with lib; {
homepage = "https://commit.sonny.re/";
description = "Commit message editor";
maintainers = [ maintainers.Cogitri ];
license = licenses.gpl3Plus;
platforms = platforms.linux;
};
}

View file

@ -68,6 +68,8 @@ in
neovim-gtk = pkgs.callPackage ./apps/neovim-gtk { };
sonnyp-commit = pkgs.callPackage ./apps/sonnyp-commit { };
steam-metro-skin = import ./data/misc/steam-metro-skin { inherit (pkgs) fetchzip; };
ungoogled-chromium = sandbox ./nixpak/ungoogled-chromium { };