37 lines
623 B
Bash
Executable File
37 lines
623 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -euo pipefail
|
|
|
|
RED='\033[0;31m'
|
|
GREEN='\033[0;32m'
|
|
YELLOW='\033[1;33m'
|
|
BLUE='\033[0;34m'
|
|
NC='\033[0m'
|
|
|
|
print_info() {
|
|
echo -e "${BLUE}📘${NC} $1"
|
|
}
|
|
|
|
print_success() {
|
|
echo -e "${GREEN}✅${NC} $1"
|
|
}
|
|
|
|
print_error() {
|
|
echo -e "${RED}❌${NC} $1"
|
|
}
|
|
|
|
print_warning() {
|
|
echo -e "${YELLOW}⚡${NC} $1"
|
|
}
|
|
|
|
HOSTNAME="${1:-tahani}"
|
|
|
|
print_info "Applying configuration for $HOSTNAME"
|
|
|
|
if [[ "$EUID" -ne 0 ]]; then
|
|
sudo nixos-rebuild switch --flake ".#$HOSTNAME" "${@:2}"
|
|
else
|
|
nixos-rebuild switch --flake ".#$HOSTNAME" "${@:2}"
|
|
fi
|
|
|
|
print_success "Configuration applied successfully" |