nvi: fix darwin build

This commit is contained in:
aleksana
2025-11-16 21:33:53 +08:00
parent 92a65c64f8
commit 57f9f08679
2 changed files with 29 additions and 3 deletions

View File

@@ -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
)

View File

@@ -2,8 +2,10 @@
lib, lib,
stdenv, stdenv,
fetchurl, fetchurl,
fetchpatch,
ncurses, ncurses,
db, db,
libiconv,
}: }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
@@ -17,12 +19,18 @@ stdenv.mkDerivation rec {
patches = patches =
# Apply patches from debian package # 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 = [ buildInputs = [
ncurses ncurses
db db
]; ]
++ lib.optionals stdenv.hostPlatform.isDarwin [ libiconv ];
preConfigure = '' preConfigure = ''
cd build.unix cd build.unix
@@ -35,6 +43,8 @@ stdenv.mkDerivation rec {
"--enable-widechar" "--enable-widechar"
]; ];
env.NIX_LDFLAGS = lib.optionalString stdenv.hostPlatform.isDarwin "-liconv";
meta = { meta = {
description = "Berkeley Vi Editor"; description = "Berkeley Vi Editor";
longDescription = '' longDescription = ''
@@ -53,6 +63,5 @@ stdenv.mkDerivation rec {
suominen suominen
aleksana aleksana
]; ];
broken = stdenv.hostPlatform.isDarwin; # never built on Hydra https://hydra.nixos.org/job/nixpkgs/trunk/nvi.x86_64-darwin
}; };
} }