From 7419112028ef9e62502079cef57a3dc4b672b238 Mon Sep 17 00:00:00 2001 From: Max Date: Sat, 4 Mar 2023 09:10:14 +0100 Subject: [PATCH] packages/sonnyp-commit: init at 3.2.0 --- .../sonnyp-commit/always-use-latest.patch | 32 ++++++++++ packages/apps/sonnyp-commit/default.nix | 64 +++++++++++++++++++ packages/packages.nix | 2 + 3 files changed, 98 insertions(+) create mode 100644 packages/apps/sonnyp-commit/always-use-latest.patch create mode 100644 packages/apps/sonnyp-commit/default.nix diff --git a/packages/apps/sonnyp-commit/always-use-latest.patch b/packages/apps/sonnyp-commit/always-use-latest.patch new file mode 100644 index 0000000..b794bf0 --- /dev/null +++ b/packages/apps/sonnyp-commit/always-use-latest.patch @@ -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) { diff --git a/packages/apps/sonnyp-commit/default.nix b/packages/apps/sonnyp-commit/default.nix new file mode 100644 index 0000000..27118e4 --- /dev/null +++ b/packages/apps/sonnyp-commit/default.nix @@ -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; + }; +} diff --git a/packages/packages.nix b/packages/packages.nix index 62cbdd1..03fb384 100644 --- a/packages/packages.nix +++ b/packages/packages.nix @@ -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 { };