about summary refs log tree commit diff
path: root/justfile
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2024-12-19 13:11:40 -0800
committerFranck Cuny <franck@fcuny.net>2024-12-19 13:11:40 -0800
commitc13f5d955ba44e28c4b2b241eaa5cf92748d7021 (patch)
tree975c9e832f8dd5856a21e79e754692858474fc6a /justfile
parentadd a default recipe to just (diff)
downloadworld-c13f5d955ba44e28c4b2b241eaa5cf92748d7021.tar.gz
add a few more rules to justfile
Diffstat (limited to 'justfile')
-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]