-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lima: 0.13.0 -> 0.14.2 #206285
lima: 0.13.0 -> 0.14.2 #206285
Conversation
Result of 2 packages built:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Built and tested successfully (via colima and docker/docker-compose) on x86_64-darwin
.
But ofborg says lima.passthru.tests on aarch64-darwin
failed:
> building
> mkdir -p _output/bin
> cp -a ./cmd/lima _output/bin/lima
> # The hostagent must be compiled with CGO_ENABLED=1 so that net.LookupIP() in the DNS server
> # calls the native resolver library and not the simplistic version in the Go library.
> CGO_ENABLED=1 go build -ldflags="-s -w -X github.com/lima-vm/lima/pkg/version.Version=v0.14.1" -tags "no_vz" -o _output/bin/limactl ./cmd/limactl
> codesign --entitlements vz.entitlements -s - ./_output/bin/limactl
> libc++abi: terminating with uncaught exception of type std::runtime_error: file is already signed. pass -f to sign regardless.
> make: *** [Makefile:182: codesign] Abort trap: 6
I have a little feeling that it may be because the binary was already built and not cleaned up or something like that. I added a |
Actually what happens is that go binary built on |
Co-authored-by: Sandro <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Builds and works on my aarch64-darwin
machine.
Until fixed upstream. Source: NixOS/nixpkgs#206285
Thanks for this.
I assume this is because https://github.com/lima-vm/lima/blob/baca0e7ecd1b3515f471d2eb60fdbb0864e9a487/Makefile#L19 |
Yeah you're right, looks like xcrun is only running at |
I'm not that familiar with nix, and especially not with darwin/macOS, but I wanted to share what I tried just in case it's helpful. I was naively hoping that an overlay like: (final: prev: {
lima = prev.lima.override (old: { xcbuild = old.xcbuild.override(_: { sdkVer = "13.0"; }); });
}) would get things building, but unfortunately it errors with:
I think
|
Thanks for the help @jonathanlking will look into the way you did if I can make it work. I'm also a bit concerned how to implement this to be available for users using nix on machine prior to 13.0 as well as after. |
|
Could be an idea also. |
Using 13.x SDK should work even on older version of macos. It only makes new APIs available, but if the program doesn't call them (or only calls them after checking the host os version), it shouldn't cause issues. Lima uses
Of course, |
@roblabla great insight, thanks ! |
#206285 (comment) |
Hey, I did a tiny bit more exploring earlier today (again, please take what I'm saying with extreme caution!). Something concerning me was the I think prior to lima-vm/lima@2679326 there was no dependency on macOS frameworks? (I'm not super confident about this claim). I think you might need to use a different
on #176661. Anyway, there is certainly no FYI I found a copy of My feeling at the moment is that a |
@dennajort Yes, this is on macOS 13.0.1 running on an M1 |
I tried this as well, but it doesn't help, as the
That's what I concluded after trying the |
@jonathanlking @dhess diff --git a/pkgs/applications/virtualization/lima/default.nix b/pkgs/applications/virtualization/lima/default.nix
index 29dd9b27232..a282e4c30de 100644
--- a/pkgs/applications/virtualization/lima/default.nix
+++ b/pkgs/applications/virtualization/lima/default.nix
@@ -7,6 +7,8 @@
, xcbuild
, sigtool
, makeWrapper
+, Virtualization
+, Cocoa
}:
buildGoModule rec {
@@ -22,6 +24,8 @@ buildGoModule rec {
vendorSha256 = "sha256-l53MTxLY/uid+0U/eY96l0aBWKImST1gN2BARilh2K0=";
+ buildInputs = lib.optionals stdenv.isDarwin [ Virtualization Cocoa ];
+
nativeBuildInputs = [ makeWrapper installShellFiles ]
++ lib.optionals stdenv.isDarwin [ xcbuild.xcrun sigtool ];
@@ -29,7 +33,8 @@ buildGoModule rec {
postPatch = ''
substituteInPlace Makefile \
--replace 'binaries: clean' 'binaries:' \
- --replace 'codesign --entitlements vz.entitlements -s -' 'codesign --force --entitlements vz.entitlements -s -'
+ --replace 'codesign --entitlements vz.entitlements -s -' 'codesign --force --entitlements vz.entitlements -s -' \
+ --replace 'MACOS_SDK_VERSION=$(shell xcrun --show-sdk-version | cut -d . -f 1)' 'MACOS_SDK_VERSION=13'
'';
# It attaches entitlements with codesign and strip removes those, diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 8fa2336e176..601d86d8f43 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -36777,8 +36777,9 @@ with pkgs;
colima = callPackage ../applications/virtualization/colima { };
- lima = callPackage ../applications/virtualization/lima {
+ lima = darwin.apple_sdk_11_0.callPackage ../applications/virtualization/lima {
inherit (darwin) sigtool;
+ inherit (darwin.apple_sdk_11_0.frameworks) Virtualization Cocoa;
};
logtop = callPackage ../tools/misc/logtop { }; This then leads to the next errors: vendor/github.com/Code-Hex/vz/v3/virtualization_helper.h:25:9: warning: macOS 12.3 API has been disabled [-W#pragma-messages]
vendor/github.com/Code-Hex/vz/v3/virtualization_helper.h:32:9: warning: macOS 13 API has been disabled [-W#pragma-messages]
virtualization_12.m:14:52: error: property 'canStop' not found on object of type 'VZVirtualMachine *'
virtualization_12.m:27:42: warning: instance method '-stopWithCompletionHandler:' not found (return type defaults to 'id') [-Wobjc-method-access]
/nix/store/lv5xsqihygkhyb9djf840nhlymi7j77m-apple-framework-Virtualization-11.0.0/Library/Frameworks/Virtualization.framework/Headers/VZVirtualMachine.h:57:12: note: receiver is instance of class declared here
virtualization_12.m:42:18: error: unknown receiver 'VZGenericPlatformConfiguration'; did you mean 'VZSerialPortConfiguration'?
/nix/store/lv5xsqihygkhyb9djf840nhlymi7j77m-apple-framework-Virtualization-11.0.0/Library/Frameworks/Virtualization.framework/Headers/VZVirtualMachineConfiguration.h:16:8: note: 'VZSerialPortConfiguration' declared here
virtualization_12.m:42:56: error: 'init' is unavailable
/nix/store/lv5xsqihygkhyb9djf840nhlymi7j77m-apple-framework-Virtualization-11.0.0/Library/Frameworks/Virtualization.framework/Headers/VZSerialPortConfiguration.h:26:1: note: 'init' has been explicitly marked unavailable here
virtualization_12.m:55:50: warning: instance method '-setDirectorySharingDevices:' not found (return type defaults to 'id') [-Wobjc-method-access]
/nix/store/lv5xsqihygkhyb9djf840nhlymi7j77m-apple-framework-Virtualization-11.0.0/Library/Frameworks/Virtualization.framework/Headers/VZVirtualMachineConfiguration.h:46:12: note: receiver is instance of class declared here
virtualization_12.m:70:88: error: expected expression
virtualization_12.m:70:63: error: use of undeclared identifier 'VZPlatformConfiguration' According to this pr it should be possible to use vz on sdk 11.0, however the guarding in https://github.com/Code-Hex/vz/blob/957dfd2add9a0badf25dee8cd1dc01a79e8fee06/virtualization_12.m#L9-L20 Even if get all that to work, it seems fragile to me because the root problem is that we are two major sdk versions behind. So I guess a binary version of lima is indeed the better approach for those who want the bleeding edge experimental vz emulation. |
I opened a pr for the lima binary derivation #209171. |
Thanks for your help on that ! |
Yes. Bumping the apple sdk is hard work, however (see the monthly macOS roundup: https://discourse.nixos.org/t/nix-macos-monthly/12330), so don't expect that to happen anytime soon. |
Result of 2 packages built:
|
|
@SuperSandro2000, I think this is ready to merge. |
@ofborg build lima colima |
Description of changes
Updates performed
codesign
command--force
codesign
due to golang signingaarch64-darwin
binaries by defaultTo inspect upstream changes
Things done
sandbox = true
set innix.conf
? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)nixos/doc/manual/md-to-db.sh
to update generated release notes