All of this with root
(sudo -i
)
nix run nixpkgs#home-manager.out -- expire-generations "$(date)"
nix-store --gc --print-roots | egrep -v "^(/nix/var|/run/\w+-system|\{memory|/proc)" | awk '{ print $1 }' | grep -vE 'home-manager|flake-registry\.json'
nix-collect-garbage --delete-old