Ubuntu に「Rust Tools apt repo」をインストールする
昨今、様々なツールが Rust で提供されています。 一例ですが、下記などです。
余談ですが、Rustで進化するPayPayのスケーラビリティ によると PayPay も「Java + NodeJS」から「Rust」へ移行しているそうです。
Rust Tools apt repo (GitHub リポジトリはこちら) を利用すると、Debian / Ubuntu へ apt を利用して幾つかの Rust 製ツールをインストール出来ます。 Rust 製ツールであれば Cargo で管理出来ますが、OS のパッケージも Rust 製ツールも全てを apt で扱えれば管理が楽になります。 今回はこの Rust Tools apt repo を Ubuntu で利用出来るようにする手順をメモしておきます。
検証環境¶
対象 | バージョン |
---|---|
Ubuntu | 24.04.2 LTS |
Rust Tools apt repo で管理可能なツール¶
Rust Tools apt repo で管理可能なツールは現時点で下記です。
ツール名 | 説明 | URL |
---|---|---|
bat | A cat(1) clone with syntax highlighting and Git integration. | https://github.com/sharkdp/bat |
delta | A syntax-highlighting pager for git, diff, and grep output | https://github.com/dandavison/delta |
dust | du + rust = dust. Like du but more intuitive. | https://github.com/bootandy/dust |
fd | fd is a program to find entries in your filesystem. It is a simple, fast and user-friendly alternative to find. | https://github.com/sharkdp/fd |
hanko | hanko keeps your Git allowed signers file up to date with signing keys configured on software development platforms like GitHub and GitLab. | https://github.com/SRv6d/hanko |
hexyl | hexyl is a hex viewer for the terminal. It uses a colored output to distinguish different categories of bytes (NULL bytes, printable ASCII characters, ASCII whitespace characters, other ASCII characters and non-ASCII). | https://github.com/sharkdp/hexyl |
hyperfine | A command-line benchmarking tool. | https://github.com/sharkdp/hyperfine |
lsd | This project is a rewrite of GNU ls with lots of added features like colors, icons, tree-view, more formatting options etc. The project is heavily inspired by the super colorls project. | https://github.com/lsd-rs/lsd |
numbat | Numbat is a statically typed programming language for scientific computations with first class support for physical dimensions and units. | https://github.com/sharkdp/numbat |
pastel | pastel is a command-line tool to generate, analyze, convert and manipulate colors. | https://github.com/sharkdp/pastel |
ripgrep | ripgrep is a line-oriented search tool that recursively searches the current directory for a regex pattern. | https://github.com/BurntSushi/ripgrep |
watchexec | watchexec is a simple, standalone tool that watches a path and runs a command whenever it detects modifications. | https://github.com/watchexec/watchexec |
xh | xh is a friendly and fast tool for sending HTTP requests. | https://github.com/ducaale/xh |
zoxide | zoxide is a smarter cd command, inspired by z and autojump. | https://github.com/ajeetdsouza/zoxide |
インストール¶
以下を実行してリポジトリを追加します。
curl -fsSL https://apt.cli.rs/pubkey.asc | sudo tee -a /usr/share/keyrings/rust-tools.asc &&
curl -fsSL https://apt.cli.rs/rust-tools.list | sudo tee /etc/apt/sources.list.d/rust-tools.list &&
sudo apt update
これで準備 OK です。
Rust Tools apt repo から lsd のインストールを試してみる¶
Rust Tools apt repo から試しに lsd をインストールしてみます。
apt -y install lsd
lsd は GNU ls を改良したツールだそうです。 実行すると以下の結果になりました。