NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
16.52k stars 13k forks source link

Package request: vfkit #306179

Open msgilligan opened 2 months ago

msgilligan commented 2 months ago

Project description

vfkit - Simple command line tool to start VMs through macOS Virtualization Framework

This is (apparently) required by Podman 5.0.x and Darwin. See: https://github.com/NixOS/nixpkgs/issues/305868

Metadata

cfergeau commented 2 months ago

This is (apparently) required by Podman 5.0.x and Darwin. See: #305868

I can confirm this is required by podman 5 on macOS in order to start the virtual machine podman machine uses to run containers

msgilligan commented 2 months ago

This is (apparently) required by Podman 5.0.x and Darwin. See: #305868

I can confirm this is required

The reason I said "apparently" was because although I had observed that I needed to install vfkit to get Podman to work, I wasn't 100% sure there wasn't an alternative configuration.

anthr76 commented 2 months ago

I know the PR is closed but it's worth mentioning it didn't work.

marsam commented 1 month ago

I know the PR is closed but it's worth mentioning it didn't work.

yeah, I could build it with our Darwin SDK, but it seems to disable too many features to make it usable.

I think you can use the following:

# pkgs/by-name/vf/vfkit/package.nix
{ lib, fetchurl, stdenvNoCC, testers }:

stdenvNoCC.mkDerivation (finalAttrs: {
  pname = "vfkit";
  version = "0.5.1";

  src = fetchurl {
    url = "https://github.com/crc-org/vfkit/releases/download/v${finalAttrs.version}/vfkit";
    hash = "sha256-at+KsvsKO359d4VUvcSuio2ej5hM6//U4Mj/jqXwhEc=";
  };

  dontUnpack = true;

  installPhase = ''
    runHook preInstall

    install -Dm755 $src $out/bin/vfkit

    runHook postInstall
  '';

  passthru.tests = {
    version = testers.testVersion {
      package = finalAttrs.finalPackage;
    };
  };

  meta = {
    description = "Simple command line tool to start VMs through virtualization framework";
    homepage = "https://github.com/crc-org/vfkit";
    license = lib.licenses.asl20;
    maintainers = [ ];
    platforms = lib.platforms.darwin;
    # Source build will be possible after darwin SDK 12.0 bump
    # https://github.com/NixOS/nixpkgs/pull/229210
    sourceProvenance = [ lib.sourceTypes.binaryNativeCode ];
    mainProgram = "vfkit";
  };
})
afh commented 1 month ago

Could you elaborate a bit on which features needed to be disabled and why, @marsam?