diff --git a/common/home.nix b/common/home.nix index 0b66090..c4ac135 100644 --- a/common/home.nix +++ b/common/home.nix @@ -84,7 +84,6 @@ g = "lazygit"; d = "lazydocker"; k = "kubectl"; - colima-start = "colima start --cpu 4 --memory 8 --vm-type=vz --vz-rosetta"; }; }; diff --git a/files/colima/colima.yaml b/files/colima/colima.yaml new file mode 100644 index 0000000..5b8c9b2 --- /dev/null +++ b/files/colima/colima.yaml @@ -0,0 +1,288 @@ +# Number of CPUs to be allocated to the virtual machine. +# Default: 2 +cpu: 4 + +# Size of the disk in GiB to be allocated to the virtual machine for container data. +# NOTE: value can only be increased after virtual machine has been created. +# +# Default: 100 +disk: 100 + +# Size of the memory in GiB to be allocated to the virtual machine. +# Default: 2 +memory: 8 + +# Architecture of the virtual machine (x86_64, aarch64, host). +# +# NOTE: value cannot be changed after virtual machine is created. +# Default: host +arch: host + +# Container runtime to be used (docker, containerd). +# +# NOTE: value cannot be changed after virtual machine is created. +# Default: docker +runtime: docker + +# AI model runner (docker, ramalama). +# Both require krunkit VM type for GPU access. +# docker: Uses Docker Model Runner. +# ramalama: Uses Ramalama. +# +# Default: docker +modelRunner: "" + +# Set custom hostname for the virtual machine. +# Default: colima +# colima-profile_name for other profiles +hostname: colima + +# Kubernetes configuration for the virtual machine. +kubernetes: + # Enable kubernetes. + # Default: false + enabled: false + + # Kubernetes version to use. + # This needs to exactly match a k3s version https://github.com/k3s-io/k3s/releases + # Default: latest stable release + version: v1.33.3+k3s1 + + # Additional args to pass to k3s https://docs.k3s.io/cli/server + # Default: traefik is disabled + k3sArgs: + - --disable=traefik + + # Kubernetes port to listen on + # A common port is 6443, though left unbound to ensure no port conflicts + # Default: pick random unbound port + port: 0 + +# Auto-activate on the Host for client access. +# Setting to true does the following on startup +# - sets as active Docker context (for Docker runtime). +# - sets as active Kubernetes context (if Kubernetes is enabled). +# - sets as active Incus remote (for Incus runtime). +# Default: true +autoActivate: true + +# Network configurations for the virtual machine. +network: + # Assign reachable IP address to the virtual machine. + # NOTE: this is currently macOS only and ignored on Linux. + # Default: false + address: false + + # Network mode for the virtual machine (shared, bridged). + # NOTE: this is currently macOS only and ignored on Linux. + # Default: shared + mode: shared + + # Network interface to use for bridged mode. + # This is only used when mode is set to bridged. + # NOTE: this is currently macOS only and ignored on Linux. + # Default: en0 + interface: en0 + + # Use the assigned IP address as the preferred route for the VM. + # Note: this only has an effect when `address` is set to true. + # Default: false + preferredRoute: false + + # Custom DNS resolvers for the virtual machine. + # + # EXAMPLE + # dns: [8.8.8.8, 1.1.1.1] + # + # Default: [] + dns: [] + + # DNS hostnames to resolve to custom targets using the internal resolver. + # This setting has no effect if a custom DNS resolver list is supplied above. + # It does not configure the /etc/hosts files of any machine or container. + # The value can be an IP address or another host. + # + # EXAMPLE + # dnsHosts: + # example.com: 1.2.3.4 + dnsHosts: + host.docker.internal: host.lima.internal + + # Replicate host IP addresses in the VM. This enables port forwarding to specific + # host IP addresses. + # e.g. `docker run --port 10.0.1.2:8080:8080 alpine` would only forward to the + # specified IP address. + # + # Default: false + hostAddresses: false + + # Custom gateway address for the virtual machine. + # The last octet needs to be 2. + # + # EXAMPLE + # gatewayAddress: 192.168.10.2 + # + # Default: 192.168.5.2 + gatewayAddress: null + +# ===================================================================== # +# ADVANCED CONFIGURATION +# ===================================================================== # + +# Forward the host's SSH agent to the virtual machine. +# Default: false +forwardAgent: false + +# Docker daemon configuration that maps directly to daemon.json. +# https://docs.docker.com/engine/reference/commandline/dockerd/#daemon-configuration-file. +# NOTE: some settings may affect Colima's ability to start docker. e.g. `hosts`. +# +# EXAMPLE - disable buildkit +# docker: +# features: +# buildkit: false +# +# EXAMPLE - add insecure registries +# docker: +# insecure-registries: +# - myregistry.com:5000 +# - host.docker.internal:5000 +# +# Colima default behaviour: buildkit enabled +# Default: {} +docker: {} + +# Virtual Machine type (krunkit, qemu, vz) +# NOTE: this is macOS 13 only. For Linux and macOS <13.0, qemu is always used. +# +# vz is macOS virtualization framework and requires macOS 13. +# krunkit runs super‑light VMs on macOS/ARM64 with a focus on GPU access. It is experimental. +# +# NOTE: value cannot be changed after virtual machine is created. +# Default: qemu +vmType: vz + +# Port forwarder for the virtual machine (ssh, grpc, none). +# ssh is more stable but supports only TCP. +# grpc supports both TCP and UDP, but is experimental. +# none disables port forwarding. +# +# Default: ssh +portForwarder: ssh + +# Utilise rosetta for amd64 emulation (requires m1 mac and vmType `vz`) +# Default: false +rosetta: false + +# Enable foreign architecture emulation via binfmt (e.g. amd64 on arm64, arm64 on amd64) +# Default: true +binfmt: true + +# Enable nested virtualization for the virtual machine (requires m3 mac and vmType `vz`) +# Default: false +nestedVirtualization: false + +# Volume mount driver for the virtual machine (virtiofs, 9p, sshfs). +# +# virtiofs is limited to macOS and vmType `vz`. It is the fastest of the options. +# +# 9p is the recommended and the most stable option for vmType `qemu`. +# +# sshfs is faster than 9p but the least reliable of the options (when there are lots +# of concurrent reads or writes). +# +# NOTE: value cannot be changed after virtual machine is created. +# Default: virtiofs (for vz), sshfs (for qemu) +mountType: virtiofs + +# Propagate inotify file events to the VM. +# NOTE: this is experimental. +mountInotify: false + +# The CPU type for the virtual machine (requires vmType `qemu`). +# Options available for host emulation can be checked with: `qemu-system-$(arch) -cpu help`. +# Instructions are also supported by appending to the cpu type e.g. "qemu64,+ssse3". +# Default: host +cpuType: host + +# Custom provision scripts for the virtual machine. +# Provisioning scripts are executed on startup and therefore needs to be idempotent. +# +# EXAMPLE - script executed as root +# provision: +# - mode: system +# script: apt-get install htop vim +# +# EXAMPLE - script executed as user +# provision: +# - mode: user +# script: | +# [ -f ~/.provision ] && exit 0; +# echo provisioning as $USER... +# touch ~/.provision +# +# EXAMPLE - script executed after VM boot, before container runtimes start +# provision: +# - mode: after-boot +# script: echo "VM is up, containers not yet started" +# +# EXAMPLE - script executed after VM and container runtimes are ready +# provision: +# - mode: ready +# script: echo "everything is ready" +# +# Default: [] +provision: [] + +# Modify ~/.ssh/config automatically to include a SSH config for the virtual machine. +# SSH config will still be generated in $COLIMA_HOME/ssh_config regardless. +# Default: true +sshConfig: true + +# The port number for the SSH server for the virtual machine. +# When set to 0, a random available port is used. +# +# Default: 0 +sshPort: 0 + +# Configure volume mounts for the virtual machine. +# Colima mounts user's home directory by default to provide a familiar +# user experience. +# +# EXAMPLE +# mounts: +# - location: ~/secrets +# writable: false +# - location: ~/projects +# writable: true +# +# Colima default behaviour: $HOME is mounted as writable. +# Default: [] +mounts: [] + +# Specify a custom disk image for the virtual machine. +# When not specified, Colima downloads an appropriate disk image from Github at +# https://github.com/abiosoft/colima-core/releases. +# The file path to a custom disk image can be specified to override the behaviour. +# +# Default: "" +diskImage: "" + +# Use the custom disk image even if it does NOT match a supported release image. +# WARNING: This bypasses validating the image and is a completely unsupported! +forceDiskImage: false + +# Size of the disk in GiB for the root filesystem of the virtual machine. +# This value is ignored if no runtime is in use. i.e. `none` runtime. +# Default: 20 +rootDisk: 20 + +# Environment variables for the virtual machine. +# +# EXAMPLE +# env: +# KEY: value +# ANOTHER_KEY: another value +# +# Default: {} +env: {} diff --git a/flake.lock b/flake.lock index 8d14d4d..b77ad16 100644 --- a/flake.lock +++ b/flake.lock @@ -7,11 +7,11 @@ ] }, "locked": { - "lastModified": 1794278858, - "narHash": "sha256-rkrJwLgLSHBnXfgoSKIDa+2LLGdTqynsV3GAxOTGhUU=", + "lastModified": 1794715309, + "narHash": "sha256-awkBBs5ctFKgEYjpNGpi3t/VqF589n5EWfdinRb2gNI=", "owner": "nix-community", "repo": "home-manager", - "rev": "82ce401aa350502897c3f2e85f384d61cd3b0b6d", + "rev": "a1293da7dd8e497e08d26173f97e2976b36a31ea", "type": "github" }, "original": { @@ -25,11 +25,11 @@ "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1794567171, - "narHash": "sha256-X/o2488F+hfeV8NLhcp9oqdRLORdYTIueP+gZ9EoFNM=", + "lastModified": 1794799779, + "narHash": "sha256-ASX2PlNoMvZuf9o/mZQw9+qwbqPw/SMU2a8DIZQDO6k=", "owner": "tw93", "repo": "mole", - "rev": "4abf1058879572bb4c073685efc3572b552bf248", + "rev": "ee7be609c70a568d7bc386b1442963f47c6a33ed", "type": "github" }, "original": { @@ -77,11 +77,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1794495034, - "narHash": "sha256-E0hYoioqUtM2XmPPvYYpJgdADF5AW9oOoPSEiM9dTHQ=", + "lastModified": 1794644783, + "narHash": "sha256-3GnIGIy15bMduoS9RnWqKTmsJLWThla42UFtm0S7+us=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "2074cc672349f14240fb7ea90d509e0b643e9dd4", + "rev": "5d2b81a7a3be3e2f832879028e4d60abbf58e9a0", "type": "github" }, "original": { diff --git a/home/home.nix b/home/home.nix index 4ddc159..0ec401c 100644 --- a/home/home.nix +++ b/home/home.nix @@ -27,6 +27,7 @@ let file = { # Writable symlinks into the repo ".config/zed" = link "secrets/zed"; + ".colima/_templates/default.yaml" = link "files/colima/colima.yaml"; ".agents" = link "files/agents"; ".config/opencode/AGENTS.md" = link "secrets/opencode/AGENTS.md";