✅️2025/2/2 homebrewをnix-darwin経由で入れる
あとできていないところの大部分はGUIアプリを入れる部分
nix-darwinでhomebrew caskを扱えるのでそれで入れたい
nix-darwinにhomebrewを扱う設定があるが、homebrew自体を入れる方法が用意されていない code:error
nix run nix-darwin -- switch --flake .#mrsekut
building the system configuration...
Password:
error: Using the homebrew module requires homebrew installed, aborting activation
Homebrew doesn't seem to be installed. Please install homebrew separately.
You can install homebrew using the following command:
error: Recipe nix-darwin-apply failed on line 32 with exit code 2
docsでも名言されていた
code:nix-darwin/modules/homebrew.nix
options.homebrew = {
enable = mkEnableOption ''
{command}nix-darwin to manage installing/updating/upgrading Homebrew taps, formulae,
and casks, as well as Mac App Store apps and Docker containers, using Homebrew Bundle.
Note that enabling this option does not install Homebrew, see the Homebrew
まじかよmrsekut.icon
ただまあ、Justfileにhomebrewのinstallコマンドを一つ書けば済むのに
わざわざこんな大仰なものを入れる必要があるか微妙だ
darwin-applyする際に、存在チェックして入れたりpath指定すればいいだけ
ひとまず試してみて、少しでも詰まるならjustfileにしようmrsekut.icon
一部理解していないところはあるが入った
githubで検索かけて出てきたこれのリポジトリを参考にした
code:nix
"homebrew/homebrew-core" = inputs.homebrew-core;
"homebrew/homebrew-cask" = inputs.homebrew-cask;
"homebrew/homebrew-bundle" = inputs.homebrew-bundle;
が、今欲しいのは、caskのみなので、なくても動くなら他2つは不要
一つずつ消したりしながら試す
coreはなくても動いたmrsekut.icon
なんで必要なのかわからんが、ないと動かなかった
code:error
fatal: could not create work tree dir '/opt/homebrew/Library/Taps/homebrew/homebrew-bundle': Permission denied
Error: Failure while executing; git clone https://github.com/Homebrew/homebrew-bundle /opt/homebrew/Library/Taps/homebrew/homebrew-bundle --origin=origin --template= --config core.fsmonitor=false exited with 128.
Error: Failure while executing; /nix/store/svc8bj75bki9i4xm75k220mqcb7lljzb-brew tap homebrew/bundle exited with 1.
error: Recipe nix-darwin-apply failed on line 32 with exit code 1
試しにforkを入れてみた
ちゃんと入ったmrsekut.icon*3
嬉しい
コードから読み取るのが難しいが
homebrew.nix内の
homebrewはnix-darwinのものである
あとは個別にGUIアプリをcasks経由で入れていけばいいmrsekut.icon
大方移行できた
https://gyazo.com/54dc6292b2fcfd73f1b318f52325e49a
いったん手動で入れたGUIアプリを、「アプリケーション」ディレクトリから消して、darwin経由で入れた
根本の設定ファイル自体は残っているので、どのアプリの再インストール後の設定も大変ではなかった
Chromeも、以前開いていたタブとか全部残っていたし
次