From c13f5d955ba44e28c4b2b241eaa5cf92748d7021 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Thu, 19 Dec 2024 13:11:40 -0800 Subject: add a few more rules to justfile --- justfile | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'justfile') diff --git a/justfile b/justfile index 842e16d..ac8dc64 100644 --- a/justfile +++ b/justfile @@ -6,7 +6,7 @@ nixaddr := "" hostname := lowercase(`hostname -s`) default: - just --list + @just --list [group('nix')] [doc('update dependencies')] @@ -24,6 +24,33 @@ test-nix: fmt: nix fmt +# Nix Store can contains corrupted entries if the nix store object has been modified unexpectedly. +# This command will verify all the store entries, +# and we need to fix the corrupted entries manually via `sudo nix store delete ...` +[group('nix')] +[doc('verify all the store entries')] +verify-store: + nix store verify --all + +[group('nix')] +[doc('garbage collect all unused nix store entries (system-wide and home-manager)')] +gc: + # garbage collect all unused nix store entries(system-wide) + sudo nix-collect-garbage --delete-older-than 7d + # garbage collect all unused nix store entries(for the user - home-manager) + # https://github.com/NixOS/nix/issues/8508 + nix-collect-garbage --delete-older-than 7d + +[group('nix')] +[doc('list recent version')] +history: + nix profile history --profile /nix/var/nix/profiles/system + +[group('nix')] +[doc('show all the auto gc roots in the nix store')] +gcroot: + ls -al /nix/var/nix/gcroots/auto/ + [group('secrets')] [doc('edit a secret')] [macos] -- cgit 1.4.1