diff options
-rw-r--r-- | justfile | 29 | ||||
-rw-r--r-- | nix/users/fcuny/shell.nix | 2 |
2 files changed, 29 insertions, 2 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] diff --git a/nix/users/fcuny/shell.nix b/nix/users/fcuny/shell.nix index e690437..69b771f 100644 --- a/nix/users/fcuny/shell.nix +++ b/nix/users/fcuny/shell.nix @@ -41,7 +41,7 @@ in set fish_greeting "" ''; shellAbbrs = { - ncg = "nix-collect-garbage -d"; + ncg = "nix-collect-garbage -7d"; c = "clear"; }; shellAliases = { |