[Unit]
Description=BuildKit Daemon (Rootless)
After=containerd.service

[Service]
Type=simple
{% if buildkit.containerd_worker %}
ExecStart={{ xdg_dir.libexec_dir }}/nsenter_containerd_rootless.sh /usr/bin/buildkitd --addr=unix://{{ ansible_env.XDG_RUNTIME_DIR }}/buildkit-{{ buildkit.containerd_namespace }}/buildkitd.sock --root={{ xdg_dir.data_home }}/buildkit-{{ buildkit.containerd_namespace }} --containerd-worker-namespace={{ buildkit.containerd_namespace }} --containerd-worker-snapshotter={{ buildkit.containerd_snapshotter }}
{% else %}
ExecStart={{ xdg_dir.libexec_dir }}/nsenter_containerd_rootless.sh /usr/bin/buildkitd
{% endif %}
ExecReload=/bin/kill -s HUP $MAINPID
RestartSec=2
Restart=on-failure
KillMode=mixed
