This commit is contained in:
Ryan Yin 2024-08-28 12:03:23 +08:00
parent 2f284cef80
commit 889d848005
2 changed files with 10 additions and 2 deletions

View file

@ -86,8 +86,12 @@ To clean up historical versions and free up storage space, use the following com
# Delete all historical versions older than 7 days
sudo nix profile wipe-history --older-than 7d --profile /nix/var/nix/profiles/system
# Run garbage collection after wiping history
# Wiping history won't garbage collect the unused packages, you need to run the gc command manually as root:
sudo nix-collect-garbage --delete-old
# Due to the following issue, you need to run the gc command as per user to delete home-manager's historical data:
# https://github.com/NixOS/nix/issues/8508
nix-collect-garbage --delete-old
```
## Why some packages are installed?

View file

@ -78,8 +78,12 @@ nix profile history --profile /nix/var/nix/profiles/system
```shell
# 清理 7 天之前的所有历史版本
sudo nix profile wipe-history --older-than 7d --profile /nix/var/nix/profiles/system
# 清理历史版本并不会删除数据,还需要手动 gc 下
# 清理历史版本并不会删除数据,还需要以 root 身份运行 gc 命令来删除所有未使用的包
sudo nix-collect-garbage --delete-old
# 因为如下 issue还需要以当前用户身份运行 gc 命令来删除 home-manager 的历史版本和包
# https://github.com/NixOS/nix/issues/8508
nix-collect-garbage --delete-old
```
## 查询为什么某个包被安装了 {#why-some-packages-are-installed}