Skip to content

Instantly share code, notes, and snippets.

@hermannolafs
Created July 4, 2024 12:36
Show Gist options
  • Save hermannolafs/6771bb1af4ab44747997d30877f442db to your computer and use it in GitHub Desktop.
Save hermannolafs/6771bb1af4ab44747997d30877f442db to your computer and use it in GitHub Desktop.
Starting minikube with qemu, installed with Nix, on Apple Silicon.
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
nix-darwin.url = "github:LnL7/nix-darwin";
nix-darwin.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = inputs@{ self, nix-darwin, nixpkgs }:
let
configuration = { pkgs, ... }: {
environment.pathsToLink = ["/share/qemu"]; # Solves issue with missing path in qemu
environment = {
systemPackages = with pkgs; [
# Local container development
minikube
qemu
edk2
];
};
services.nix-daemon.enable = true;
nix.settings.experimental-features = "nix-command flakes";
nixpkgs = {
hostPlatform = "aarch64-darwin";
config.allowUnfree = true;
};
};
in
{
# Build darwin flake using:
# $ darwin-rebuild build --flake .#simple
darwinConfigurations."simple" = nix-darwin.lib.darwinSystem {
modules = [ configuration ];
};
};
}
# Make sure your nix config installs minikube, qemy and edk2 as described below.
# If you are not using nix, you probably are not experiencing the same path issue this solves.
start-minikube:
minikube start --driver=qemu \
--qemu-firmware-path=/run/current-system/sw/share/qemu/edk2-aarch64-code.fd \
--cpus=4 \
--memory=8g
stop-minikube:
minikube stop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment