Skip to content

macvim: 179 -> 181#454837

Merged
emilazy merged 8 commits intoNixOS:masterfrom
lilyball:push-rknvkztwnpqy
Oct 23, 2025
Merged

macvim: 179 -> 181#454837
emilazy merged 8 commits intoNixOS:masterfrom
lilyball:push-rknvkztwnpqy

Conversation

@lilyball
Copy link
Member

@lilyball lilyball commented Oct 23, 2025

This fixes the various ways in which the MacVim package was broken, and then updates it to r181.

One of the changes here is Python support has been disabled by default, with an enablePython configuration option added to reenable it. Enabling Python also requires overriding the python3 input to fix the breakage (e.g. by disabling static libpython and symlinking in libpython${pythonVersion}.dylib into the correct location).

This also adds me back to the maintainer list and marks myself as maintainer of this package.

Changelogs:

Fixes #399964.

Things done

  • Built on platform:
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • Tested, as applicable:
  • Ran nixpkgs-review on this PR. See nixpkgs-review usage.
  • Tested basic functionality of all binary files, usually in ./result/bin/.
  • Nixpkgs Release Notes
    • Package update: when the change is major or breaking.
  • NixOS Release Notes
    • Module addition: when adding a new NixOS module.
    • Module update: when the change is significant.
  • Fits CONTRIBUTING.md, pkgs/README.md, maintainers/README.md and other READMEs.

Add a 👍 reaction to pull requests you find important.

Xcode 26.0 sets `*_DEPLOYMENT_TARGET` env vars for all platforms in
shell script build phases, which breaks invocations of clang from those
phases, as they target the wrong platform.
We don't provide `eview` so we need to get rid of that manpage, and
there's also a bad `man/man1/mvim.1` symlink that goes nowhere.
Pass `-headerpad_max_install_names` again. This is something we used to
do, and then the flag got removed at some point. For some reason we need
to provide it both to configure and to Xcode.
We need to resign the binary after running `install_name_tool` or it
will have an invalid code signature.
MacVim currently fails to link against nixpkgs python because Xcode's
clang doesn't understand the LLVM bitcode in the
`libpython${pythonVersion}.a` static library. I'm not sure what this
static library is for when `lib/libpython${pythonVersion}.dylib` exists,
but I don't know of a way to tell MacVim to ignore it. Linking against
python works if we rebuild python to skip the static library but that
doesn't seem like a proper solution, so until a permanent solution is
found, just disable python by default.

Also mark macvim as no longer broken.
Updates macvim to r181, including bumping the Ruby version to 3.4 since
that's what MacVim r181 is built against.

There's still 3 CVEs in the `knownVulnerabilities` list that are newer
than this release, but this is the latest MacVim release available right
now.
@lilyball
Copy link
Member Author

I'm tempted to re-add myself as maintainer for this package again, but I'd have to add myself back to the maintainer list first.

@lilyball lilyball mentioned this pull request Oct 23, 2025
13 tasks
@nixpkgs-ci nixpkgs-ci bot added 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 6.topic: vim Advanced text editor labels Oct 23, 2025
@nixpkgs-ci nixpkgs-ci bot added the 9.needs: reviewer This PR currently has no reviewers requested and needs attention. label Oct 23, 2025
@lilyball
Copy link
Member Author

I went ahead and added commits to put myself back into the maintainer list.

@nixpkgs-ci nixpkgs-ci bot added the 8.has: maintainer-list (update) This PR changes `maintainers/maintainer-list.nix` label Oct 23, 2025
Copy link
Member

@SuperSandro2000 SuperSandro2000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

otherwise LGTM

Comment on lines +173 to +175
--replace-warn " -L${stdenv.cc.libc}/lib" "" \
--replace-warn " -L${darwin.libunwind}/lib" "" \
--replace-warn " -L${libiconv}/lib" ""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
--replace-warn " -L${stdenv.cc.libc}/lib" "" \
--replace-warn " -L${darwin.libunwind}/lib" "" \
--replace-warn " -L${libiconv}/lib" ""
--replace-fail " -L${stdenv.cc.libc}/lib" "" \
--replace-fail " -L${darwin.libunwind}/lib" "" \
--replace-fail " -L${libiconv}/lib" ""

we probably want to fail to build if anything about this changes

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I basically don’t think these should be an issue at all these days. We do build our own libiconv, but I doubt it hurts anything – stdenv already propagates it, so it’s almost surely on the linker path even if we substitute this away. stdenv.cc.libc and darwin.libunwind are stub packages and we link against the system versions of those libraries using the stubs in the SDK. I can’t imagine these can’t just be removed without issue.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just tweaked them to be --replace-warn since I noticed there was a warning about using bare --replace, but I didn't feel like checking if the replacements were actually still finding anything to replace (since this is a rather old hack and stuff has changed since then). I can try deleting them outright and seeing what happens, though if I'm going to end up actually switching over to the nixpkgs toolchain for building this (in a future PR) then this will all get replaced anyway.

# Note: The shell script build phase in question uses /bin/zsh.
+ ''
substituteInPlace src/MacVim/MacVim.xcodeproj/project.pbxproj \
--replace-fail 'make \' $'for x in ''${(k)parameters}; do if [[ $x = *_DEPLOYMENT_TARGET ]]; then [[ $x = MACOSX_DEPLOYMENT_TARGET ]] || unset $x; fi; done\nmake \\'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At some point I would recommend doing a patch instead 😅

Comment on lines +81 to +92
++ optionals enablePython [
"--enable-python3interp=dynamic"
]
++ [
"--enable-perlinterp=dynamic"
"--enable-rubyinterp=dynamic"
"--enable-tclinterp=yes"
"--without-local-dir"
"--with-luajit"
"--with-lua-prefix=${luajit}"
]
++ optionals enablePython [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe reorder things to only have one condition

src = fetchFromGitHub {
owner = "macvim-dev";
repo = "macvim";
rev = "release-${finalAttrs.version}";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
rev = "release-${finalAttrs.version}";
tag = "release-${finalAttrs.version}";

@nixpkgs-ci nixpkgs-ci bot removed the 9.needs: reviewer This PR currently has no reviewers requested and needs attention. label Oct 23, 2025
Copy link
Member

@emilazy emilazy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, I doubt that most of the contortions in this build are necessary these days, now that we have actual SDKs and modern Clang. I expect this can be made into a relatively normal package with at most making things like ibtool(1) available – which could be obtained either impurely or from our darwin.xcode package. That would also likely make it a lot less fragile with regards to the toolchain churn that has affected it a lot.

I won’t block on this, but I would strongly suggest trying it to increase future maintainability – the mixing of toolchains here is inherently fragile, and should be completely unnecessary. Our SDKs contain the same headers and stubs that the native toolchain links against, and all the frameworks are available. All we are missing is the proprietary tools for things like Interface Builder files and Metal – but those don’t depend on the compiler toolchain, so can be pulled into a build with fewer hacks than are used here currently.

Comment on lines +173 to +175
--replace-warn " -L${stdenv.cc.libc}/lib" "" \
--replace-warn " -L${darwin.libunwind}/lib" "" \
--replace-warn " -L${libiconv}/lib" ""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I basically don’t think these should be an issue at all these days. We do build our own libiconv, but I doubt it hurts anything – stdenv already propagates it, so it’s almost surely on the linker path even if we substitute this away. stdenv.cc.libc and darwin.libunwind are stub packages and we link against the system versions of those libraries using the stubs in the SDK. I can’t imagine these can’t just be removed without issue.

python3
];
]
++ optional enablePython python3;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using the Nixpkgs toolchain would presumably fix this.

Comment on lines +227 to +229
+ optionalString stdenv.isAarch64 ''
# Resign the binary and set the linker-signed flag.
rcodesign sign --code-signature-flags linker-signed $exe
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason not to use autoSignDarwinBinariesHook here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The answer is that I didn't know about that hook. That said, we only need to resign one binary, and it looks like that hook is going to check every single file to see if it needs a signature, so that's going to end up doing a lot more work for the same effect.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough. I’m surprised if install_name_tool is breaking the signature, as ours doesn’t, but maybe this is something weird with the Xcode toolchain being used here.

@lilyball
Copy link
Member Author

I really need to look more into the nixpkgs toolchain changes. This PR came about by just trying to get the darn thing working again, but if we can actually swap over to the nixpkgs toolchain and still expose ibtool and have things work, that would be a lot better. At the moment I think my priority is "unbreak this package", but I'll experiment with the toolchain stuff as soon as I find the time. I already attempted to switch this over to xcbuild but there's some frustrating blockers there.

Copy link
Member

@emilazy emilazy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems fine as an incremental improvement. I didn’t test the build, because it scares me.

xcbuild being inadequate could indeed be a problem. Swift Build includes a FOSS implementation of the Xcode build system which should solve this, but it’s waiting on @reckenrode to finish his Swift 6.2 work for 26.05 before it’ll be available for us. I am not sure if our SDK can be used with the Xcode xcodebuild(1); I think in theory it should be possible, but IIRC Randy had to adjust the SDK to work with Swift Build, so there may be annoying complications. Still, it’s probably worth trying, or even just patching around xcbuild issues for now; I doubt the contortions for that could be worse than the ones this currently has to use. Otherwise, Swift Build should do the trick.

FWIW, it looks like the r181.2 prerelease isn’t affected by any of the remaining vulnerabilities, so we could probably bump to that.

Comment on lines +227 to +229
+ optionalString stdenv.isAarch64 ''
# Resign the binary and set the linker-signed flag.
rcodesign sign --code-signature-flags linker-signed $exe
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough. I’m surprised if install_name_tool is breaking the signature, as ours doesn’t, but maybe this is something weird with the Xcode toolchain being used here.

@emilazy emilazy added this pull request to the merge queue Oct 23, 2025
Merged via the queue into NixOS:master with commit 7ae51e0 Oct 23, 2025
28 of 32 checks passed
@lilyball lilyball deleted the push-rknvkztwnpqy branch October 24, 2025 02:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: vim Advanced text editor 8.has: maintainer-list (update) This PR changes `maintainers/maintainer-list.nix` 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Build failure: macvim

3 participants

Comments