vim: fix build on darwin

This commit is contained in:
sempiternal-aurora
2026-07-01 22:00:13 +10:00
parent 27f813249b
commit ade4a26bc1
3 changed files with 29 additions and 3 deletions
+13
View File
@@ -14,6 +14,8 @@
url = "https://raw.githubusercontent.com/archlinux/svntogit-packages/68f6d131750aa778807119e03eed70286a17b1cb/trunk/archlinux.vim";
sha256 = "18ifhv5q9prd175q3vxbqf6qyvkk6bc7d2lhqdk0q78i68kv9y0c";
},
# TODO: Clean up on `staging`
llvmPackages,
}:
let
@@ -37,6 +39,10 @@ stdenv.mkDerivation {
nativeBuildInputs = [
gettext
pkg-config
]
# TODO: Clean up on `staging`.
++ lib.optionals stdenv.hostPlatform.isDarwin [
llvmPackages.lld
];
buildInputs = [
ncurses
@@ -44,6 +50,13 @@ stdenv.mkDerivation {
gawk
];
# workaround for ld64 hardening issue
#
# TODO: Clean up on `staging`
env = lib.optionalAttrs stdenv.hostPlatform.isDarwin {
NIX_CFLAGS_COMPILE = "-fuse-ld=lld";
};
strictDeps = true;
configureFlags = [
+10 -2
View File
@@ -48,6 +48,9 @@
darwinSupport ? config.vim.darwin or false, # Enable Darwin support
ftNixSupport ? config.vim.ftNix or true, # Add nix indentation support from vim-nix (not needed for basic syntax highlighting)
sodiumSupport ? config.vim.sodium or true, # Enable sodium based encryption
# TODO: Clean up on `staging`
llvmPackages,
}:
let
@@ -169,7 +172,9 @@ stdenv.mkDerivation {
++ lib.optional nlsSupport gettext
++ lib.optional perlSupport perl
++ lib.optional (guiSupport == "gtk3") wrapGAppsHook3
++ lib.optional waylandSupport wayland-scanner;
++ lib.optional waylandSupport wayland-scanner
# TODO: Clean up on `staging`
++ lib.optional stdenv.hostPlatform.isDarwin llvmPackages.lld;
buildInputs = [
ncurses
@@ -196,7 +201,10 @@ stdenv.mkDerivation {
++ lib.optional sodiumSupport libsodium;
# error: '__declspec' attributes are not enabled; use '-fdeclspec' or '-fms-extensions' to enable support for __declspec attributes
env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.hostPlatform.isDarwin "-fdeclspec";
# workaround for ld64 hardening issue
#
# TODO: Clean up on `staging`
env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.hostPlatform.isDarwin "-fdeclspec -fuse-ld=lld";
preConfigure = lib.optionalString ftNixSupport ''
cp ${vimPlugins.vim-nix.src}/ftplugin/nix.vim runtime/ftplugin/nix.vim
+6 -1
View File
@@ -17,6 +17,8 @@
# This can be set to one of the `darwin.xcode_*` packages as well.
# If set, this should be a path to Xcode.app, e.g. `"/Applications/Xcode.app"`.
withXcodePath ? null,
# TODO: Clean up on `staging`
llvmPackages,
}:
# Try to match MacVim's documented script interface compatibility
@@ -48,6 +50,8 @@ stdenv.mkDerivation (finalAttrs: {
nativeBuildInputs = [
pkg-config
# TODO: Clean up on `staging`
llvmPackages.lld
];
buildInputs = [
# MacVim references up to MAC_OS_VERSION_14_0 in its source
@@ -188,7 +192,8 @@ stdenv.mkDerivation (finalAttrs: {
# macvim obj-c log macro triggers -Wformat-security (seems like a bug? it's a string literal!)
hardeningDisable = common.hardeningDisable ++ [ "format" ];
# os_log also enables -Werror,-Wformat by default
env.NIX_CFLAGS_COMPILE = "-DOS_LOG_FORMAT_WARNINGS";
# TODO: Clean up on `staging`
env.NIX_CFLAGS_COMPILE = "-DOS_LOG_FORMAT_WARNINGS -fuse-ld=lld";
# We rely on the user's Xcode install to build. It may be located in an arbitrary place, and
# it's not clear what system-level components it may require, so for now we'll just allow full