2025年8月14日木曜日

home-manager は Nix 専用なので Guix では使いません

 たぶん「Guix で home-manager を入れるには?」という意味ですよね?

結論:home-manager は Nix 専用なので Guix では使いません。Guix には同等の仕組みとして Guix Homeguix home)が用意されています。これでユーザー環境(dotfiles・サービス・パッケージ)を宣言的に管理できます。

すぐ始める手順

  1. Guix を最新化

guix pull
hash -r
  1. 初期ファイルを作成(テンプレ)

mkdir -p ~/.config/guix
guix home import > ~/.config/guix/home.scm
# うまく import できない場合は空ファイルを作って手で書いてOK
  1. 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))
   )))
  1. 反映(reconfigure)

guix home reconfigure ~/.config/guix/home.scm
  1. 新しいシェルで確認
    which gitecho $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.packagespackages

  • programs.*/services.* → Guix Home の各 home--service-type*

  • home.filehome-files-service-type(上の dotfiles 例)

困ったとき

  • guix repl(use-modules ...) のモジュールミスを確認

  • guix search <pkg> でパッケージ名を探す

  • guix home describe で適用済み世代、guix home roll-back で巻き戻し可能

必要なら、あなたの希望(使いたいシェル・パッケージ・常駐させたいもの)を教えてくれれば、完成済みの home.scm をこちらで用意します。

PLCがネットワーク経路を見失って固まった

 あなたの状況、典型的には「PLCがネットワーク経路を見失って固まった」ケースです。整理すると: ProxmoxでGPUを別PCに割り当てようとした LANとWi-Fiで疎通不能に PLCの電源OFF→ONで復旧 原因の可能性 1. ARP/MACテー...