Skip to content

Commit 54afd66

Browse files
committed
Add nix packages for commit-patch and commit-patch buffer
1 parent 572ee6a commit 54afd66

File tree

2 files changed

+61
-0
lines changed

2 files changed

+61
-0
lines changed

commit-patch-buffer.nix

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
with import <nixpkgs>{};
2+
with { commit-patch' = import ./commit-patch.nix; };
3+
4+
{ commit-patch ? commit-patch'
5+
, emacs ? pkgs.emacs-nox
6+
}:
7+
8+
let
9+
trivialBuild = pkgs.callPackage "${<nixpkgs>}/pkgs/build-support/emacs/trivial.nix" { emacs = emacs; };
10+
in
11+
12+
trivialBuild {
13+
pname = "commit-patch-buffer";
14+
inherit (commit-patch) src version;
15+
16+
propagatedUserEnvPkgs = [ commit-patch patchutils ];
17+
18+
meta = {
19+
inherit (commit-patch.meta) homepage license;
20+
description = "Commit diff buffers using commit-patch";
21+
};
22+
}

commit-patch.nix

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
with import <nixpkgs> {};
2+
3+
stdenv.mkDerivation rec {
4+
name = "commit-patch";
5+
version = "2.6.2";
6+
src = fetchurl {
7+
url = "https://porkrind.org/commit-patch/commit-patch-${version}.tar.gz";
8+
sha256 = "0v11vjyisk243zi0ym90bnqb229j7iaqx1lwqdkszxzn1yxwq4ck";
9+
};
10+
11+
buildInputs = [ perl patchutils makeWrapper ];
12+
13+
phases = "unpackPhase installPhase postFixup";
14+
15+
installFlags = [ "PREFIX=$(out)" ];
16+
17+
# If it weren't fatpacked we could do this for IPC::Run:
18+
# postFixup = ''
19+
# wrapProgram $out/bin/commit-patch --set PERL5LIB \
20+
# ${with perlPackages; makePerlPath ([
21+
# IPCRun
22+
# ])} \
23+
# --prefix PATH ":" \
24+
# "${lib.makeBinPath [ perl patchutils ]}"
25+
# '';
26+
27+
postFixup = ''
28+
perl -pi -e 's,#!/usr/bin/perl,#!${perl}/bin/perl,' $out/bin/commit-patch
29+
wrapProgram $out/bin/commit-patch \
30+
--prefix PATH ":" \
31+
"${lib.makeBinPath [ perl patchutils ]}"
32+
'';
33+
34+
meta = with lib; {
35+
license = licenses.gpl2;
36+
homepage = "https://porkrind.org/commit-patch";
37+
description = "Commit patches to Darcs, Git, Mercurial, Bazaar, Monotone, Subversion, or CVS";
38+
};
39+
}

0 commit comments

Comments
 (0)