just: cleanup commands
This commit is contained in:
@@ -1,30 +1,35 @@
|
||||
host := `hostname`
|
||||
key_services := "github gradescope"
|
||||
|
||||
# Rebuild the system and switch immediately
|
||||
rebuild:
|
||||
sudo nixos-rebuild switch --flake .#{{host}}
|
||||
|
||||
# Update flake.lock
|
||||
update:
|
||||
sudo nix flake update
|
||||
nix flake update
|
||||
|
||||
# Clean up old generations and optimize store
|
||||
gc:
|
||||
sudo nix-env --delete-generations +3
|
||||
sudo nix-store --gc
|
||||
sudo nix-collect-garbage -d
|
||||
sudo nix-store --optimise
|
||||
sudo nixos-rebuild boot --flake .#{{host}}
|
||||
|
||||
# Generate high-strength, post-quantum ready SSH keys without passphrases
|
||||
# Generate Ed25519 SSH keys for each configured service
|
||||
gen-keys:
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
mkdir -p ~/.ssh
|
||||
|
||||
chmod 700 ~/.ssh
|
||||
|
||||
for service in {{key_services}}; do
|
||||
FILE="$HOME/.ssh/id_$service"
|
||||
|
||||
if [ -f "$FILE" ]; then
|
||||
echo "skipping: $FILE already exists."
|
||||
else
|
||||
echo "generating: $FILE"
|
||||
ssh-keygen -t ed25519 -a 100 -o -f "$FILE" -N ""
|
||||
file="$HOME/.ssh/id_$service"
|
||||
if [ -f "$file" ]; then
|
||||
echo "skipping: $file already exists"
|
||||
continue
|
||||
fi
|
||||
echo "generating: $file"
|
||||
ssh-keygen -t ed25519 -f "$file" -N "" -C "$service@$(hostname -s)"
|
||||
done
|
||||
|
||||
|
||||
Reference in New Issue
Block a user