Nix Darwinのロゴ

Nix Darwin

コミュニティ
jpoehnelt
nix-darwin

Manage macOS system defaults, Homebrew casks, Lix or Nix daemon settings, and Home Manager packages and dotfiles with a nix-darwin flake. Use when adding packages or casks, changing macOS defaults or launchd agents, debugging flake evaluation or brew bundle failures, or activating changes from an agent shell.

概要

公開者jpoehnelt
リポジトリskills
スキル名nix-darwin
スター
23
フォーク
1
同梱ファイル
指示のみ
ライセンスMIT
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 指示だけで完結

    モデルに必要なものはすべて指示に含まれているため、別途同期するファイルはありません。

  • オープンソース

    jpoehneltがGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキル「Nix Darwin」をTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/jpoehnelt/skills/tree/main/nix-darwin
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/jpoehnelt/skills.git /tmp/skills
mkdir -p .claude/skills
cp -r /tmp/skills/nix-darwin .claude/skills/nix-darwin
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでNix Darwinを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあるとすぐに、モデルが自動的にNix Darwinを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Nix Darwinは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、スキルを使わない間は指示の読み込みにトークンを消費しません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

macOS configuration with nix-darwin

Declare all macOS system settings, packages, and dotfiles in the flake instead of running imperative installers or mutating local preference files by hand.

Repo facts (from AGENTS.md or CLAUDE.md): the flake directory path, the shared nix-darwin module path, the shared Home Manager module path, the per-host override directory, and how local secrets are stored.

Place each setting in the right layer

  • Put macOS system.defaults, PAM settings, /etc files, and GUI Homebrew casks in the nix-darwin module.
  • Put CLI packages, dotfiles, shell aliases, home.sessionVariables, and user launchd.agents in the Home Manager module.
  • Put user PATH additions in programs.zsh.initContent or zprofile instead of relying only on home.sessionPath in ~/.zshenv. macOS /etc/zprofile runs path_helper after ~/.zshenv, and login -pf preserves __HM_SESS_VARS_SOURCED.
  • Put machine-specific hardware mappings, computer names, and host-only packages in the host module.
  • Prefer Nix packages for CLI tools and language toolchains. Prefer Homebrew casks for GUI .app bundles that auto-update or need macOS code-signing entitlements.

Evaluate and build

  1. Stage any new file before evaluating the flake. Nix flakes ignore untracked Git files and fail with a missing-file error:
    bash
    git -C <flake-dir> add --intent-to-add <new-file>
  2. Check attribute names and option paths with nix eval before building the full system closure:
    bash
    nix eval <flake-dir>#darwinConfigurations.<host>.pkgs.<pkg>.version
  3. Build the host system closure without root privileges to catch module type errors and missing options early:
    bash
    nix build --no-link --print-out-paths <flake-dir>#darwinConfigurations.<host>.system
  4. If a macOS preference key has no typed option under system.defaults.<domain>, place it under system.defaults.CustomUserPreferences.<domain>.

Activate from an agent shell

An agent background shell has no controlling terminal app, so pam_tid.so skips Touch ID and sudo darwin-rebuild switch hangs waiting for a password on standard input.

  1. For Home Manager changes (CLI packages, dotfiles, environment variables, and user launchd agents), build and run the user activation package directly without sudo:
    bash
    HOST="$(scutil --get LocalHostName)"
    SYS_PATH="$(nix build --no-link --print-out-paths "<flake-dir>#darwinConfigurations.${HOST}.system")"
    ln -sfn "$(readlink -f "$SYS_PATH/etc/profiles/per-user/$USER")" "$HOME/.local/state/nix/profiles/profile"
    HM_ACTIVATE="$(nix build --no-link --print-out-paths "<flake-dir>#darwinConfigurations.${HOST}.config.home-manager.users.${USER}.home.activationPackage")"
    "$HM_ACTIVATE/activate"
    Use full paths such as /usr/bin/open, /usr/bin/pgrep, /usr/bin/defaults, and /usr/bin/security inside home.activation scripts, which run with a minimal PATH.
  2. For system.defaults changes that belong to the current user (such as com.apple.dock, com.apple.finder, or com.apple.screencapture), write the same plist key with defaults write and restart the affected service (killall Dock, killall Finder, or killall SystemUIServer) so the change takes effect immediately.
  3. For Homebrew casks, add the cask to homebrew.casks and run brew install --cask <cask> so the app installs right away. Pass --adopt if the .app bundle already exists in /Applications.
  4. For root-only changes (/etc, PAM, system daemons, or .pkg casks that prompt for sudo), ask the operator to run sudo darwin-rebuild switch in their terminal after nix build succeeds.

Secrets and Homebrew drift

  • Never write tokens or credentials into .nix files. Everything copied into /nix/store is world-readable on the machine and tracked in Git.
  • Store secrets in the macOS Keychain with security add-generic-password -U -a "$USER" -s "<service>" -w "<secret>". Read them at Home Manager activation or shell startup with security find-generic-password -a "$USER" -s "<service>" -w.
  • Set homebrew.onActivation.cleanup = "zap" when you want activation to remove undeclared Homebrew formulae and casks. Check brew list --formula and brew list --cask before enabling it for the first time.
  • If an external installer such as Lix or the Determinate Nix Installer manages the Nix daemon (nix.enable = false), put custom daemon settings in environment.etc."nix/nix.custom.conf" instead of nix.settings.

Verify

  • nix build --no-link <flake-dir>#darwinConfigurations.<host>.system exits 0 with no deprecation warnings.
  • User activation ($HM_ACTIVATE/activate) exits 0.
  • Installed binaries resolve on PATH, or changed preferences appear in defaults read.
  • git diff contains no plaintext tokens or machine-private credentials.

よくある質問

AIスキル「Nix Darwin」では何ができますか?

Manage macOS system defaults, Homebrew casks, Lix or Nix daemon settings, and Home Manager packages and dotfiles with a nix-darwin flake. Use when adding packages or casks, changing macOS defaults or launchd agents, debugging flake evaluation or brew bundle failures, or activating changes from an agent shell.

TypingMindでNix Darwinを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Nix Darwinはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにNix Darwinをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/jpoehnelt/skills/tree/main/nix-darwinを貼り付けてください。TypingMindがSKILL.mdを読み込み、チャットごとに有効にできるスキルとしてインストールします。

Nix Darwinを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストの内容がこのスキルの用途に合ったときに、このスキルを読み込めます。

Nix Darwinで使えるAIモデルの数に制限はありますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもNix Darwinを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Nix Darwin」は無料ですか?

はい。jpoehneltがMITライセンスのもとでGitHubに公開しています。ご利用のAIプロバイダーに支払うのは、使用したトークンの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇