From 3d44d5c2ce00d994f0ed02f5c472b330a1215802 Mon Sep 17 00:00:00 2001 From: summersamara Date: Thu, 11 Jul 2024 00:31:03 +0200 Subject: [PATCH 01/13] visual-hexdiff: init at 0.0.53 --- pkgs/by-name/vi/visual-hexdiff/package.nix | 49 ++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 pkgs/by-name/vi/visual-hexdiff/package.nix diff --git a/pkgs/by-name/vi/visual-hexdiff/package.nix b/pkgs/by-name/vi/visual-hexdiff/package.nix new file mode 100644 index 0000000000000..065111f5ff095 --- /dev/null +++ b/pkgs/by-name/vi/visual-hexdiff/package.nix @@ -0,0 +1,49 @@ +{ + stdenv, + lib, + fetchurl, + fetchpatch, + ncurses, +}: +stdenv.mkDerivation { + pname = "visual-hexdiff"; + version = "0.0.53"; + + src = fetchurl { + url = "mirror://ubuntu/pool/universe/h/hexdiff/hexdiff_0.0.53.orig.tar.gz"; + sha256 = "sha256-M1bmkW63pHlfl9zNWEq0EGN1rpVGo+BTUKM9ot4HWqo="; + }; + + prePatch = '' + substituteInPlace sel_file.c \ + --replace 'wprintw(win, txt_aide_fs[foo]);' 'wprintw(win, "%s", txt_aide_fs[foo]);' + ''; + + patches = [ + (fetchpatch { + url = "mirror://ubuntu/pool/universe/h/hexdiff/hexdiff_0.0.53-0ubuntu4.diff.gz"; + sha256 = "sha256-X5ONNp9jeACxsulyowDQJ6REX6bty6L4in0/+rq8Wz4="; + decode = "gunzip --stdout"; + name = "hexdiff_0.0.53-0ubuntu4.diff"; + stripLen = 1; + }) + ]; + + buildInputs = [ ncurses ]; + + preInstall = '' + mkdir -p $out/bin/ + ''; + + makeFlags = [ "PREFIX=$(out)" ]; + + meta = with lib; { + description = "Visual hexadecimal difference editor"; + homepage = "http://tboudet.free.fr/hexdiff/"; + license = licenses.wtfpl; + maintainers = with maintainers; [ erictapen ]; + mainProgram = "hexdiff"; + platforms = platforms.all; + }; + +} From e331c90739f197cb02b2a1fd7a12d9905f12c53f Mon Sep 17 00:00:00 2001 From: summersamara <126388106+summersamara@users.noreply.github.com> Date: Fri, 19 Jul 2024 15:25:34 +0200 Subject: [PATCH 02/13] Fixup Co-authored-by: Kerstin --- pkgs/by-name/vi/visual-hexdiff/package.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/by-name/vi/visual-hexdiff/package.nix b/pkgs/by-name/vi/visual-hexdiff/package.nix index 065111f5ff095..60f7b873fb967 100644 --- a/pkgs/by-name/vi/visual-hexdiff/package.nix +++ b/pkgs/by-name/vi/visual-hexdiff/package.nix @@ -13,7 +13,7 @@ stdenv.mkDerivation { url = "mirror://ubuntu/pool/universe/h/hexdiff/hexdiff_0.0.53.orig.tar.gz"; sha256 = "sha256-M1bmkW63pHlfl9zNWEq0EGN1rpVGo+BTUKM9ot4HWqo="; }; - +# Fix compiler error that wants a string literal as format string for `wprintw` prePatch = '' substituteInPlace sel_file.c \ --replace 'wprintw(win, txt_aide_fs[foo]);' 'wprintw(win, "%s", txt_aide_fs[foo]);' From 15ebd6c89502de8652e244fcffffe5788814f2f6 Mon Sep 17 00:00:00 2001 From: summersamara <126388106+summersamara@users.noreply.github.com> Date: Fri, 19 Jul 2024 15:25:45 +0200 Subject: [PATCH 03/13] Fixup Co-authored-by: Kerstin --- pkgs/by-name/vi/visual-hexdiff/package.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/by-name/vi/visual-hexdiff/package.nix b/pkgs/by-name/vi/visual-hexdiff/package.nix index 60f7b873fb967..24adfd6f4a89c 100644 --- a/pkgs/by-name/vi/visual-hexdiff/package.nix +++ b/pkgs/by-name/vi/visual-hexdiff/package.nix @@ -20,6 +20,7 @@ stdenv.mkDerivation { ''; patches = [ + # Some changes the debian/ubuntu developers made over the original source code (fetchpatch { url = "mirror://ubuntu/pool/universe/h/hexdiff/hexdiff_0.0.53-0ubuntu4.diff.gz"; sha256 = "sha256-X5ONNp9jeACxsulyowDQJ6REX6bty6L4in0/+rq8Wz4="; From bec44da823f7acda7b7b744036cd80ba58d14777 Mon Sep 17 00:00:00 2001 From: summersamara <126388106+summersamara@users.noreply.github.com> Date: Tue, 19 Nov 2024 01:28:03 +0100 Subject: [PATCH 04/13] Use postPatch instead of prePatch to apply fix Co-authored-by: Sandro --- pkgs/by-name/vi/visual-hexdiff/package.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/by-name/vi/visual-hexdiff/package.nix b/pkgs/by-name/vi/visual-hexdiff/package.nix index 24adfd6f4a89c..862c2b05bd19b 100644 --- a/pkgs/by-name/vi/visual-hexdiff/package.nix +++ b/pkgs/by-name/vi/visual-hexdiff/package.nix @@ -13,10 +13,10 @@ stdenv.mkDerivation { url = "mirror://ubuntu/pool/universe/h/hexdiff/hexdiff_0.0.53.orig.tar.gz"; sha256 = "sha256-M1bmkW63pHlfl9zNWEq0EGN1rpVGo+BTUKM9ot4HWqo="; }; -# Fix compiler error that wants a string literal as format string for `wprintw` - prePatch = '' + postPatch = '' + # Fix compiler error that wants a string literal as format string for `wprintw` substituteInPlace sel_file.c \ - --replace 'wprintw(win, txt_aide_fs[foo]);' 'wprintw(win, "%s", txt_aide_fs[foo]);' + --replace-fail 'wprintw(win, txt_aide_fs[foo]);' 'wprintw(win, "%s", txt_aide_fs[foo]);' ''; patches = [ From dd5fda8f0b8c3fae4bd3cf7898759e377f8f0fe5 Mon Sep 17 00:00:00 2001 From: summersamara <126388106+summersamara@users.noreply.github.com> Date: Tue, 19 Nov 2024 01:29:36 +0100 Subject: [PATCH 05/13] use attribute instead of hardcoded version in package url Co-authored-by: Sandro --- pkgs/by-name/vi/visual-hexdiff/package.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/by-name/vi/visual-hexdiff/package.nix b/pkgs/by-name/vi/visual-hexdiff/package.nix index 862c2b05bd19b..9bdbd693af29f 100644 --- a/pkgs/by-name/vi/visual-hexdiff/package.nix +++ b/pkgs/by-name/vi/visual-hexdiff/package.nix @@ -10,7 +10,7 @@ stdenv.mkDerivation { version = "0.0.53"; src = fetchurl { - url = "mirror://ubuntu/pool/universe/h/hexdiff/hexdiff_0.0.53.orig.tar.gz"; + url = "mirror://ubuntu/pool/universe/h/hexdiff/hexdiff_${version}.orig.tar.gz"; sha256 = "sha256-M1bmkW63pHlfl9zNWEq0EGN1rpVGo+BTUKM9ot4HWqo="; }; postPatch = '' From 06f8b75c3c00f5344106b0d43a837fc052821994 Mon Sep 17 00:00:00 2001 From: summersamara <126388106+summersamara@users.noreply.github.com> Date: Tue, 19 Nov 2024 01:30:15 +0100 Subject: [PATCH 06/13] use hash instead of sha256 attribute Co-authored-by: Sandro --- pkgs/by-name/vi/visual-hexdiff/package.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/by-name/vi/visual-hexdiff/package.nix b/pkgs/by-name/vi/visual-hexdiff/package.nix index 9bdbd693af29f..d2efa177a6ab6 100644 --- a/pkgs/by-name/vi/visual-hexdiff/package.nix +++ b/pkgs/by-name/vi/visual-hexdiff/package.nix @@ -11,7 +11,7 @@ stdenv.mkDerivation { src = fetchurl { url = "mirror://ubuntu/pool/universe/h/hexdiff/hexdiff_${version}.orig.tar.gz"; - sha256 = "sha256-M1bmkW63pHlfl9zNWEq0EGN1rpVGo+BTUKM9ot4HWqo="; + hash = "sha256-M1bmkW63pHlfl9zNWEq0EGN1rpVGo+BTUKM9ot4HWqo="; }; postPatch = '' # Fix compiler error that wants a string literal as format string for `wprintw` From f6f1f031038f646fc0ac4b3059621913ca102151 Mon Sep 17 00:00:00 2001 From: summersamara <126388106+summersamara@users.noreply.github.com> Date: Tue, 19 Nov 2024 01:30:39 +0100 Subject: [PATCH 07/13] remove empty line Co-authored-by: Sandro --- pkgs/by-name/vi/visual-hexdiff/package.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/pkgs/by-name/vi/visual-hexdiff/package.nix b/pkgs/by-name/vi/visual-hexdiff/package.nix index d2efa177a6ab6..bcc3d2bfb6600 100644 --- a/pkgs/by-name/vi/visual-hexdiff/package.nix +++ b/pkgs/by-name/vi/visual-hexdiff/package.nix @@ -46,5 +46,4 @@ stdenv.mkDerivation { mainProgram = "hexdiff"; platforms = platforms.all; }; - } From 7b7a0d946313d262bbac3273ca0353a290fc32d3 Mon Sep 17 00:00:00 2001 From: summersamara Date: Tue, 19 Nov 2024 01:38:19 +0100 Subject: [PATCH 08/13] Add link to the changelogs associated with patch --- pkgs/by-name/vi/visual-hexdiff/package.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/by-name/vi/visual-hexdiff/package.nix b/pkgs/by-name/vi/visual-hexdiff/package.nix index bcc3d2bfb6600..af4b81f8a5e8b 100644 --- a/pkgs/by-name/vi/visual-hexdiff/package.nix +++ b/pkgs/by-name/vi/visual-hexdiff/package.nix @@ -21,6 +21,7 @@ stdenv.mkDerivation { patches = [ # Some changes the debian/ubuntu developers made over the original source code + # See https://changelogs.ubuntu.com/changelogs/pool/universe/h/hexdiff/hexdiff_0.0.53-0ubuntu4/changelog (fetchpatch { url = "mirror://ubuntu/pool/universe/h/hexdiff/hexdiff_0.0.53-0ubuntu4.diff.gz"; sha256 = "sha256-X5ONNp9jeACxsulyowDQJ6REX6bty6L4in0/+rq8Wz4="; From ac305d6920651ad456e0b17f25aa916012cad95a Mon Sep 17 00:00:00 2001 From: summersamara Date: Tue, 19 Nov 2024 01:58:13 +0100 Subject: [PATCH 09/13] Hardcode version in package url as version attribute doesn't work reverts https://github.com/NixOS/nixpkgs/pull/327172/commits/dd5fda8f0b8c3fae4bd3cf7898759e377f8f0fe5 --- pkgs/by-name/vi/visual-hexdiff/package.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/by-name/vi/visual-hexdiff/package.nix b/pkgs/by-name/vi/visual-hexdiff/package.nix index af4b81f8a5e8b..34474f73f1282 100644 --- a/pkgs/by-name/vi/visual-hexdiff/package.nix +++ b/pkgs/by-name/vi/visual-hexdiff/package.nix @@ -10,7 +10,7 @@ stdenv.mkDerivation { version = "0.0.53"; src = fetchurl { - url = "mirror://ubuntu/pool/universe/h/hexdiff/hexdiff_${version}.orig.tar.gz"; + url = "mirror://ubuntu/pool/universe/h/hexdiff/hexdiff_0.0.53.orig.tar.gz"; hash = "sha256-M1bmkW63pHlfl9zNWEq0EGN1rpVGo+BTUKM9ot4HWqo="; }; postPatch = '' From 7caf0ad318a0005a4885d6fb8ee4e3edf0aac4e0 Mon Sep 17 00:00:00 2001 From: summersamara Date: Tue, 19 Nov 2024 02:08:56 +0100 Subject: [PATCH 10/13] Fix indent style issue: use spaces not tabs --- pkgs/by-name/vi/visual-hexdiff/package.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/by-name/vi/visual-hexdiff/package.nix b/pkgs/by-name/vi/visual-hexdiff/package.nix index 34474f73f1282..eda76f08c3edf 100644 --- a/pkgs/by-name/vi/visual-hexdiff/package.nix +++ b/pkgs/by-name/vi/visual-hexdiff/package.nix @@ -14,7 +14,7 @@ stdenv.mkDerivation { hash = "sha256-M1bmkW63pHlfl9zNWEq0EGN1rpVGo+BTUKM9ot4HWqo="; }; postPatch = '' - # Fix compiler error that wants a string literal as format string for `wprintw` + # Fix compiler error that wants a string literal as format string for `wprintw` substituteInPlace sel_file.c \ --replace-fail 'wprintw(win, txt_aide_fs[foo]);' 'wprintw(win, "%s", txt_aide_fs[foo]);' ''; From 0f8228bc40652c48325b3445760be20cc6c97992 Mon Sep 17 00:00:00 2001 From: summersamara Date: Sat, 23 Nov 2024 16:24:42 +0100 Subject: [PATCH 11/13] Try to fix issue on Darwin --- pkgs/by-name/vi/visual-hexdiff/package.nix | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/pkgs/by-name/vi/visual-hexdiff/package.nix b/pkgs/by-name/vi/visual-hexdiff/package.nix index eda76f08c3edf..b127f08698266 100644 --- a/pkgs/by-name/vi/visual-hexdiff/package.nix +++ b/pkgs/by-name/vi/visual-hexdiff/package.nix @@ -13,11 +13,6 @@ stdenv.mkDerivation { url = "mirror://ubuntu/pool/universe/h/hexdiff/hexdiff_0.0.53.orig.tar.gz"; hash = "sha256-M1bmkW63pHlfl9zNWEq0EGN1rpVGo+BTUKM9ot4HWqo="; }; - postPatch = '' - # Fix compiler error that wants a string literal as format string for `wprintw` - substituteInPlace sel_file.c \ - --replace-fail 'wprintw(win, txt_aide_fs[foo]);' 'wprintw(win, "%s", txt_aide_fs[foo]);' - ''; patches = [ # Some changes the debian/ubuntu developers made over the original source code @@ -31,6 +26,16 @@ stdenv.mkDerivation { }) ]; + postPatch = '' + # Fix compiler error that wants a string literal as format string for `wprintw` + substituteInPlace sel_file.c \ + --replace-fail 'wprintw(win, txt_aide_fs[foo]);' 'wprintw(win, "%s", txt_aide_fs[foo]);' + '' + lib.optionalString stdenv.hostPlatform.isDarwin '' + # Fix compiler error on Darwin: conflicting types for 'strdup' + substituteInPlace sel_file.c \ + --replace-fail 'char *strdup(char *);' ' ' + ''; + buildInputs = [ ncurses ]; preInstall = '' From 561232db155676bf6961358cfff4bf418e8d94cb Mon Sep 17 00:00:00 2001 From: summersamara Date: Sat, 23 Nov 2024 16:51:37 +0100 Subject: [PATCH 12/13] fix format --- pkgs/by-name/vi/visual-hexdiff/package.nix | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/pkgs/by-name/vi/visual-hexdiff/package.nix b/pkgs/by-name/vi/visual-hexdiff/package.nix index b127f08698266..3e374ae7d9970 100644 --- a/pkgs/by-name/vi/visual-hexdiff/package.nix +++ b/pkgs/by-name/vi/visual-hexdiff/package.nix @@ -26,15 +26,17 @@ stdenv.mkDerivation { }) ]; - postPatch = '' - # Fix compiler error that wants a string literal as format string for `wprintw` - substituteInPlace sel_file.c \ - --replace-fail 'wprintw(win, txt_aide_fs[foo]);' 'wprintw(win, "%s", txt_aide_fs[foo]);' - '' + lib.optionalString stdenv.hostPlatform.isDarwin '' - # Fix compiler error on Darwin: conflicting types for 'strdup' - substituteInPlace sel_file.c \ - --replace-fail 'char *strdup(char *);' ' ' - ''; + postPatch = + '' + # Fix compiler error that wants a string literal as format string for `wprintw` + substituteInPlace sel_file.c \ + --replace-fail 'wprintw(win, txt_aide_fs[foo]);' 'wprintw(win, "%s", txt_aide_fs[foo]);' + '' + + lib.optionalString stdenv.hostPlatform.isDarwin '' + # Fix compiler error on Darwin: conflicting types for 'strdup' + substituteInPlace sel_file.c \ + --replace-fail 'char *strdup(char *);' ' ' + ''; buildInputs = [ ncurses ]; From aef0614650a9efacb8ca8fe86ee24504199632f4 Mon Sep 17 00:00:00 2001 From: summersamara <126388106+summersamara@users.noreply.github.com> Date: Mon, 2 Dec 2024 22:41:35 +0100 Subject: [PATCH 13/13] update supported platforms Co-authored-by: Arne Keller <2012gdwu+github@posteo.de> --- pkgs/by-name/vi/visual-hexdiff/package.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/by-name/vi/visual-hexdiff/package.nix b/pkgs/by-name/vi/visual-hexdiff/package.nix index 3e374ae7d9970..d4665c986fac9 100644 --- a/pkgs/by-name/vi/visual-hexdiff/package.nix +++ b/pkgs/by-name/vi/visual-hexdiff/package.nix @@ -52,6 +52,6 @@ stdenv.mkDerivation { license = licenses.wtfpl; maintainers = with maintainers; [ erictapen ]; mainProgram = "hexdiff"; - platforms = platforms.all; + platforms = platforms.unix; }; }