たぶん「Guix で home-manager を入れるには?」という意味ですよね?
結論:home-manager は Nix 専用なので Guix では使いません。Guix には同等の仕組みとして Guix Home(guix home
)が用意されています。これでユーザー環境(dotfiles・サービス・パッケージ)を宣言的に管理できます。
すぐ始める手順
-
Guix を最新化
guix pull
hash -r
-
初期ファイルを作成(テンプレ)
mkdir -p ~/.config/guix
guix home import > ~/.config/guix/home.scm
# うまく import できない場合は空ファイルを作って手で書いてOK
-
home.scm
を編集(最小例)
;; ~/.config/guix/home.scm
(use-modules (gnu) (gnu home) (gnu home services)
(gnu home services shells)
(gnu packages)
(gnu packages shells)
(gnu packages version-control)
(gnu packages vim)
(gnu packages curl))
(home-environment
(packages (list git vim curl htop))
(services
(list
(service home-bash-service-type
(home-bash-configuration
(aliases '(("g" . "git")
("v" . "vim")))))
;; Zsh 派なら:
;; (service home-zsh-service-type (home-zsh-configuration))
)))
-
反映(reconfigure)
guix home reconfigure ~/.config/guix/home.scm
-
新しいシェルで確認
which git
やecho $PATH
、エイリアスなどが設定どおりになっていればOK。
よくある追加例
-
Dotfiles を配置
(use-modules (gnu home services files)) ... (services (list (simple-service 'dotfiles home-files-service-type `(("gitconfig" ,(plain-file "gitconfig" "[user]\n name = Your Name\n email = you@example.com\n")) (".vimrc" ,(plain-file "vimrc" "set number\n"))))))
-
Home Shepherd サービス(ユーザー常駐)
(use-modules (gnu home services shepherd)) ... (services (append (list (service home-shepherd-service-type (home-shepherd-configuration (services (list (shepherd-service (provision '(my-timer)) (start #~(lambda () (system* #$(file-append coreutils "/bin/sleep") "infinity"))) (stop #~(lambda (_sig) #t)))))))) ...))
Nix の Home Manager から来た人向けメモ
-
home.packages
→packages
-
programs.*
/services.*
→ Guix Home の各 home--service-type* -
home.file
→home-files-service-type
(上の dotfiles 例)
困ったとき
-
guix repl
で(use-modules ...)
のモジュールミスを確認 -
guix search <pkg>
でパッケージ名を探す -
guix home describe
で適用済み世代、guix home roll-back
で巻き戻し可能
必要なら、あなたの希望(使いたいシェル・パッケージ・常駐させたいもの)を教えてくれれば、完成済みの home.scm
をこちらで用意します。