From c34d372d36f6160163e32fffdf62bde0a4f0b268 Mon Sep 17 00:00:00 2001 From: micnncim Date: Thu, 5 Sep 2024 23:39:57 +0900 Subject: [PATCH] Add vfkit package See https://github.com/NixOS/nixpkgs/issues/305868 and https://github.com/NixOS/nixpkgs/pull/334907 for more information. Signed-off-by: micnncim --- default.nix | 1 + pkgs/vfkit/default.nix | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 pkgs/vfkit/default.nix diff --git a/default.nix b/default.nix index dd9cde0..30a7ca4 100644 --- a/default.nix +++ b/default.nix @@ -22,4 +22,5 @@ mockgen = pkgs.callPackage ./pkgs/mockgen { }; slack-cli = pkgs.callPackage ./pkgs/slack-cli { }; tfcmt = pkgs.callPackage ./pkgs/tfcmt { }; + vfkit = pkgs.lib.optionalAttrs pkgs.stdenv.isDarwin (pkgs.callPackage ./pkgs/vfkit { }); } diff --git a/pkgs/vfkit/default.nix b/pkgs/vfkit/default.nix new file mode 100644 index 0000000..d0ec3ec --- /dev/null +++ b/pkgs/vfkit/default.nix @@ -0,0 +1,34 @@ +# https://github.com/NixOS/nixpkgs/issues/305868 +# https://github.com/NixOS/nixpkgs/pull/334907 + +{ pkgs, lib, fetchurl }: + +pkgs.stdenv.mkDerivation rec { + pname = "vfkit"; + version = "0.5.1"; + + src = fetchurl { + url = "https://github.com/crc-org/vfkit/releases/download/v${version}/vfkit"; + hash = "sha256-at+KsvsKO359d4VUvcSuio2ej5hM6//U4Mj/jqXwhEc="; + }; + + dontUnpack = true; + + installPhase = '' + runHook preInstall + install -Dm755 $src $out/bin/vfkit + runHook postInstall + ''; + + meta = { + description = "Simple command line tool to start VMs through the macOS Virtualization framework"; + homepage = "https://github.com/crc-org/vfkit"; + license = lib.licenses.asl20; + maintainers = with lib.maintainers; [ sarcasticadmin ]; + 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"; + }; +}