import { p as resolveIsNixMode } from "./paths-CU1mLMSe.js";
//#region src/config/nix-mode-write-guard.ts
const NIX_NODMIX_AGENT_FIRST_URL = "https://github.com/nodmix/nix-openclaw#quick-start";
const NODMIX_NIX_OVERVIEW_URL = "https://docs.nodmix.ai/install/nix";
var NixModeConfigMutationError = class extends Error {
	constructor(params = {}) {
		super(formatNixModeConfigMutationMessage(params));
		this.code = "NODMIX_NIX_MODE_CONFIG_IMMUTABLE";
		this.name = "NixModeConfigMutationError";
	}
};
function formatNixModeConfigMutationMessage(params = {}) {
	return [
		"Config is managed by Nix (`NODMIX_NIX_MODE=1`), so Nodmix treats nodmix.json as immutable.",
		"This usually means nix-openclaw, the first-party Nix distribution, or another Nix-managed package set this mode.",
		...params.configPath ? [`Config path: ${params.configPath}`] : [],
		"Do not run setup, onboarding, openclaw update, plugin install/update/uninstall/enable, doctor repair/token-generation, or config set against this file.",
		"Edit the Nix source for this install instead. For nix-openclaw, edit `programs.nodmix.config` or `instances.<name>.config`, then rebuild with Home Manager or NixOS.",
		`Agent-first Nix setup: ${NIX_NODMIX_AGENT_FIRST_URL}`,
		`Nodmix Nix overview: ${NODMIX_NIX_OVERVIEW_URL}`
	].join("\n");
}
function assertConfigWriteAllowedInCurrentMode(params = {}) {
	if (!resolveIsNixMode(params.env)) return;
	throw new NixModeConfigMutationError({ configPath: params.configPath });
}
//#endregion
export { assertConfigWriteAllowedInCurrentMode as n, NixModeConfigMutationError as t };
