diff --git a/docs/nixos-with-flakes/other-useful-tips.md b/docs/nixos-with-flakes/other-useful-tips.md index 3b39651..94568e0 100644 --- a/docs/nixos-with-flakes/other-useful-tips.md +++ b/docs/nixos-with-flakes/other-useful-tips.md @@ -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? diff --git a/docs/zh/nixos-with-flakes/other-useful-tips.md b/docs/zh/nixos-with-flakes/other-useful-tips.md index e2b4fb6..e3f9e2b 100644 --- a/docs/zh/nixos-with-flakes/other-useful-tips.md +++ b/docs/zh/nixos-with-flakes/other-useful-tips.md @@ -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}