From 57f9f08679204269026ff0a63568f16466edabe5 Mon Sep 17 00:00:00 2001 From: aleksana Date: Sun, 16 Nov 2025 21:33:53 +0800 Subject: [PATCH] nvi: fix darwin build --- pkgs/by-name/nv/nvi/macports-patches.nix | 17 +++++++++++++++++ pkgs/by-name/nv/nvi/package.nix | 15 ++++++++++++--- 2 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 pkgs/by-name/nv/nvi/macports-patches.nix diff --git a/pkgs/by-name/nv/nvi/macports-patches.nix b/pkgs/by-name/nv/nvi/macports-patches.nix new file mode 100644 index 000000000000..501a74b4e8da --- /dev/null +++ b/pkgs/by-name/nv/nvi/macports-patches.nix @@ -0,0 +1,17 @@ +let + url = "https://github.com/macports/macports-ports/raw/abae7e550897dc13b7a48763a7a022b709d8793f/editors/nvi/files"; + hashes = { + "dynamic_lookup-11.patch" = "sha256-eXLSMUtslSXLYd1HZRD6pfqcYMIA3EtixWL1yvx4ook="; + "patch-common_key.h.diff" = "sha256-AAO/2lHpmFJMYb9fyQrWnGPaJYLdwhrp87tbHu5hr/k="; + "patch-dist_port.h.in.diff" = "sha256-GPKgIm9pDGtN6CNqbX3+hANkZbYFql5K5JyjCr5TIKI="; + "patch-ex_script.c.diff" = "sha256-IUuJ7b6A5O3q6qQCwZsrc9Bt1LpjU3DgxHTwtMp16Qc="; + "patch-includes.diff" = "sha256-j3V4LmcJEFqnTlTHFZFd8NtycEa+GKM+ZIUwZHjq15w="; + }; +in +builtins.attrValues ( + builtins.mapAttrs (n: v: { + url = "${url}/${n}"; + hash = v; + extraPrefix = ""; + }) hashes +) diff --git a/pkgs/by-name/nv/nvi/package.nix b/pkgs/by-name/nv/nvi/package.nix index 202c304039a9..48b381611940 100644 --- a/pkgs/by-name/nv/nvi/package.nix +++ b/pkgs/by-name/nv/nvi/package.nix @@ -2,8 +2,10 @@ lib, stdenv, fetchurl, + fetchpatch, ncurses, db, + libiconv, }: stdenv.mkDerivation rec { @@ -17,12 +19,18 @@ stdenv.mkDerivation rec { patches = # Apply patches from debian package - map fetchurl (import ./debian-patches.nix); + (map fetchurl (import ./debian-patches.nix)) + ++ + # Also select patches from macports + # They don't interfere with Linux build + # https://github.com/macports/macports-ports/tree/master/editors/nvi/files + (map fetchpatch (import ./macports-patches.nix)); buildInputs = [ ncurses db - ]; + ] + ++ lib.optionals stdenv.hostPlatform.isDarwin [ libiconv ]; preConfigure = '' cd build.unix @@ -35,6 +43,8 @@ stdenv.mkDerivation rec { "--enable-widechar" ]; + env.NIX_LDFLAGS = lib.optionalString stdenv.hostPlatform.isDarwin "-liconv"; + meta = { description = "Berkeley Vi Editor"; longDescription = '' @@ -53,6 +63,5 @@ stdenv.mkDerivation rec { suominen aleksana ]; - broken = stdenv.hostPlatform.isDarwin; # never built on Hydra https://hydra.nixos.org/job/nixpkgs/trunk/nvi.x86_64-darwin }; }