k3s/pkg/containerd/utility_linux.go
Ada de59b6327c Add nix-snapshotter support to the embedded containerd
Add support for the "nix" snapshotter, which enables running container
images built with nix2container. Nix images reference store paths
directly, avoiding layer tarballs and enabling deduplication through
the nix store.

Changes:
- Register nix-snapshotter as a builtin containerd plugin
- Add NixSupported() validation (checks nix-store is in PATH)
- Configure nix-snapshotter image service proxy in V2/V3 templates
  with containerd_address for CRI image operations
- Add Transfer service unpack_config with differ=walking for
  multi-arch support
- Use containerd state dir for socket path (rootless compatible)
- Disable NRI in rootless mode to prevent bind failures

Usage: k3s server --snapshotter nix

Signed-off-by: Ada <ada@6bit.com>
Co-Authored-By: Joshua Perry <josh@6bit.com>
Signed-off-by: Ada <ada@6bit.com>
2026-03-06 12:36:57 -08:00

32 lines
824 B
Go

//go:build linux
package containerd
import (
"errors"
"os/exec"
"github.com/containerd/containerd/v2/plugins/snapshots/overlay/overlayutils"
fuseoverlayfs "github.com/containerd/fuse-overlayfs-snapshotter/v2"
stargz "github.com/containerd/stargz-snapshotter/service"
"github.com/pdtpartners/nix-snapshotter/pkg/nix"
)
func OverlaySupported(root string) error {
return overlayutils.Supported(root)
}
func FuseoverlayfsSupported(root string) error {
return fuseoverlayfs.Supported(root)
}
func StargzSupported(root string) error {
return stargz.Supported(root)
}
func NixSupported(root string) error {
if _, err := exec.LookPath("nix-store"); err != nil {
return errors.New("nix-store not found in PATH: install nix (https://nixos.org/download) to use the nix snapshotter")
}
return nix.Supported(root)
}