Unverified Commit 090dd6f6 authored by Aleksana's avatar Aleksana Committed by GitHub
Browse files

nvi: cleanup and fix darwin build (#462214)

parents 6401b723 57f9f086
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
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
)
+31 −7
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@
  fetchpatch,
  ncurses,
  db,
  libiconv,
}:

stdenv.mkDerivation rec {
@@ -13,31 +14,54 @@ stdenv.mkDerivation rec {

  src = fetchurl {
    url = "https://deb.debian.org/debian/pool/main/n/nvi/nvi_${version}.orig.tar.gz";
    sha256 = "13cp9iz017bk6ryi05jn7drbv7a5dyr201zqd3r4r8srj644ihwb";
    hash = "sha256-i8NIiJFZo0zyaPgHILJvRZ29cjtWFhB9NnOdAH5Ml40=";
  };

  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
  '';

  configureScript = "../dist/configure";

  configureFlags = [
    "vi_cv_path_preserve=/tmp"
    "--enable-widechar"
  ];

  meta = with lib; {
  env.NIX_LDFLAGS = lib.optionalString stdenv.hostPlatform.isDarwin "-liconv";

  meta = {
    description = "Berkeley Vi Editor";
    license = licenses.free;
    platforms = platforms.unix;
    broken = stdenv.hostPlatform.isDarwin; # never built on Hydra https://hydra.nixos.org/job/nixpkgs/trunk/nvi.x86_64-darwin
    longDescription = ''
      nvi ("new vi") is a re-implementation of the
      classic Berkeley text editor vi, written by
      Keith Bostic at UC Berkeley for 4BSD. Created
      to replace Unix-derived code in BSD, it provides
      a clean, unencumbered version of the original
      editor and is the default vi on all major BSD
      systems as well as MINIX.
    '';
    license = lib.licenses.bsd3;
    platforms = lib.platforms.unix;
    mainProgram = "vi";
    maintainers = with lib.maintainers; [
      suominen
      aleksana
    ];
  };
}