Guix

提供: ArchWiki
2021年8月9日 (月) 11:26時点におけるKusanaginoturugi (トーク | 投稿記録)による版 (→‎Guix のアンインストール: 翻訳)
ナビゲーションに移動 検索に移動
警告: Guix は Arch の公式パッケージマネージャではありません。まだ開発途上です。一部のパッケージは、ビルドに失敗する可能性があります。

GNU Guix はトランザクションを使用してユーザー環境を再現できるパッケージマネージャです。Guix をスタンドアロンで使って完全な GNU ディストリビューションとして使用することもできますが、Arch に Guix パッケージマネージャをインストールすることで伝統的な成熟した Unix ライク環境をベースとすることが可能です。

Guix で使えるパッケージコマンドについては Guix マニュアル を読んでください。

インストール

On Arch Linux you can install Guix either using the AUR or manually as described in the Guix Manual. Installing using the AUR has the advantage that pacman is aware of the package and the extra files in the /usr file tree. But contrarily to other AUR packages, uninstalling the package does not unwind the entire Guix installation. Since Guix is a package manager by itself and it can also update itself, you still have to manually uninstall the files installed via Guix (no matter whether you installed the AUR package or the manual installation). Therefore, after updating Guix once, the AUR advantage really turns into a disadvantage, as there will be many unnecessary files in the /usr file tree that are part of the Guix AUR package but that are never used by Guix anymore. Therefore, consider using the manual installation.

Manual Installation

For the manual installation, see chapter Installation of the Guix manual. The easiest way is to use the shell installer script linked in there.

As of July 2019 this script installs files into the following locations:

  • /gnu/store, /var/guix (the Guix store)
  • /usr/local/share/info, /usr/local/bin, (only symlinks)
  • /root/.config/guix (a symlink to the current profile)

Furthermore it installs and enables a systemd service called guix-daemon.service, and creates users guixbuilder01 ... guixbuilder10 and a group guixbuild.

After running the script, create a new file called /etc/profile.d/guix.sh:

# Arrange so that ~/.config/guix/current paths end up first in 
# the particular path list.
for profile in "$HOME/.guix-profile" "$HOME/.config/guix/current"
do
  if [ -f "$profile/etc/profile" ]
  then
    # Load the user profile's settings.
    GUIX_PROFILE="$profile" ; \
    . "$profile/etc/profile"
  else
    # At least define this one so that basic things just work
    # when the user installs their first package.
    export PATH="$profile/bin${PATH:+:$PATH}"
    export INFOPATH="$profile/share/info${INFOPATH:+:$INFOPATH}"
  fi
done

unset profile

export GUIX_LOCPATH=$HOME/.guix-profile/lib/locale

Now start a new login shell (alternatively reboot your machine) and you can start using Guix:

# guix install glibc-locales

AUR Package Installation

ノート: /bin/sh が Bash でない場合、ビルドのチェックに失敗します。デフォルトの Arch では問題ありません。
ノート: 2018年5月13日の時点では、BUILDDIR 環境変数が tmpfs 上のディレクトリを指していると、makepkg でのビルド中に guix-environment-container テストが失敗します。

GNU Guix は AUR の guixAUR パッケージでインストールできます。PKGBUILD に書かれているように、まずは Guix のディストリビュータによって配布されている PGP 鍵を追加する必要があります。

Guix makes builds more reproducible by running the build process using an unprivileged build user account. Therefore if you want to be able to build n packages simultaneously (e.g. for serving multiple users at the same time) you should create n build user accounts. as Guix should be able to build simultaneously. The following command does this the way described in Guix manual:

# groupadd --system guixbuild
# uncomment and type e.g.  10  for   n below  -->  have ten users  
# for i in `seq -w 1 n`;
  do
    useradd -g guixbuild -G guixbuild           \
            -d /var/empty -s `which nologin`    \
            -c "Guix build user $i" --system    \
            guixbuilder$i;
  done

Start and enable guix-daemon.service.

You may want to authorize Guix to download and use binary packages (‘substitutes’) from the Guix Official Substitute Server:

# guix archive --authorize < /usr/share/guix/ci.guix.gnu.org.pub

/tmp の外側でパッケージをビルド

/tmp に十分な容量がないなどの理由でビルドする時の TMPDIR を変えたい場合、ユニットファイルに変更を加える必要があります (詳しくは Guix マニュアル を参照)。/tmp の代わりに /tmpdir を使用してビルドするには、以下を実行:

# systemctl edit guix-daemon.service

そして以下の行を追加してください:

[Service]
Environment=TMPDIR=/tmpdir

Guix のアンインストール

guix-daemon.service を無効化します。AUR パッケージから Guix をインストールした場合は、pacman で Guix を削除してください。

/etc/systemd/system/guix-daemon.service/etc/systemd/system/guix-daemon.service.d/etc/profile.d/guix.sh が存在していたら削除してください。

それから Guix のビルド用ユーザーやグループも削除してください。

# for i in `seq -w 1 n`; do userdel guixbuilder$i; done
# groupdel guixbuild

Guix のファイルが保存されている /gnu, /var/guix, /var/log/guix なども削除してください。guix-daemon.service を編集していた場合、/etc/systemd/system/guix-daemon.service.d も削除すると良いでしょう。