about summary refs log tree commit diff
path: root/justfile
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--justfile29
1 files changed, 28 insertions, 1 deletions
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 <store-path-1> <store-path-2> ...`
+[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]