From 54afd66cb5c9a2b5f3efb6bb58c02b1141af06b4 Mon Sep 17 00:00:00 2001 From: David Caldwell Date: Wed, 10 Jan 2024 11:32:19 -0800 Subject: [PATCH] Add nix packages for commit-patch and commit-patch buffer --- commit-patch-buffer.nix | 22 ++++++++++++++++++++++ commit-patch.nix | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 commit-patch-buffer.nix create mode 100644 commit-patch.nix diff --git a/commit-patch-buffer.nix b/commit-patch-buffer.nix new file mode 100644 index 0000000..1ccfc30 --- /dev/null +++ b/commit-patch-buffer.nix @@ -0,0 +1,22 @@ +with import {}; +with { commit-patch' = import ./commit-patch.nix; }; + +{ commit-patch ? commit-patch' +, emacs ? pkgs.emacs-nox +}: + +let + trivialBuild = pkgs.callPackage "${}/pkgs/build-support/emacs/trivial.nix" { emacs = emacs; }; +in + +trivialBuild { + pname = "commit-patch-buffer"; + inherit (commit-patch) src version; + + propagatedUserEnvPkgs = [ commit-patch patchutils ]; + + meta = { + inherit (commit-patch.meta) homepage license; + description = "Commit diff buffers using commit-patch"; + }; +} diff --git a/commit-patch.nix b/commit-patch.nix new file mode 100644 index 0000000..8b0fc5f --- /dev/null +++ b/commit-patch.nix @@ -0,0 +1,39 @@ +with import {}; + +stdenv.mkDerivation rec { + name = "commit-patch"; + version = "2.6.2"; + src = fetchurl { + url = "https://porkrind.org/commit-patch/commit-patch-${version}.tar.gz"; + sha256 = "0v11vjyisk243zi0ym90bnqb229j7iaqx1lwqdkszxzn1yxwq4ck"; + }; + + buildInputs = [ perl patchutils makeWrapper ]; + + phases = "unpackPhase installPhase postFixup"; + + installFlags = [ "PREFIX=$(out)" ]; + + # If it weren't fatpacked we could do this for IPC::Run: + # postFixup = '' + # wrapProgram $out/bin/commit-patch --set PERL5LIB \ + # ${with perlPackages; makePerlPath ([ + # IPCRun + # ])} \ + # --prefix PATH ":" \ + # "${lib.makeBinPath [ perl patchutils ]}" + # ''; + + postFixup = '' + perl -pi -e 's,#!/usr/bin/perl,#!${perl}/bin/perl,' $out/bin/commit-patch + wrapProgram $out/bin/commit-patch \ + --prefix PATH ":" \ + "${lib.makeBinPath [ perl patchutils ]}" + ''; + + meta = with lib; { + license = licenses.gpl2; + homepage = "https://porkrind.org/commit-patch"; + description = "Commit patches to Darcs, Git, Mercurial, Bazaar, Monotone, Subversion, or CVS"; + }; +} -- 2.51.2