feat: add NixOS support, Go, and Ruby on Rails; remove Rust
- Add nixos/ directory with declarative flake.nix and home.nix for NixOS - Make all setup scripts NixOS-aware with proper detection and early exit - Update bashrc, zshrc, and aliases with Go, Ruby on Rails, and Nix profile paths - Replace Rust/Cargo references in shell configs with rbenv/Ruby on Rails - Update README with NixOS quick start and full documentation
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
# 00-system-prep.sh
|
||||
# Updates system and sets up Flathub.
|
||||
# Relies on DISTRO and PACKAGE_MANAGER being set by the caller.
|
||||
# Supports NixOS, Fedora (dnf), and Debian/Ubuntu (apt).
|
||||
|
||||
echo "--- Starting System Preparation ---"
|
||||
|
||||
@@ -11,23 +12,32 @@ if [ -z "$DISTRO" ] || [ -z "$PACKAGE_MANAGER" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Update system before installing packages
|
||||
echo "Updating system packages..."
|
||||
if [ "$PACKAGE_MANAGER" == "dnf" ]; then
|
||||
sudo dnf update -y && sudo dnf upgrade -y
|
||||
elif [ "$PACKAGE_MANAGER" == "apt" ]; then
|
||||
sudo apt update && sudo apt upgrade -y
|
||||
else
|
||||
echo "WARNING: Unknown package manager '$PACKAGE_MANAGER'. Skipping system update."
|
||||
# ── NixOS path: system updates are declarative via flake ──
|
||||
if [ "$DISTRO" == "nixos" ]; then
|
||||
echo "NixOS detected: system updates are managed declaratively via flake.nix."
|
||||
echo "Run 'nixos-rebuild switch --flake ~/dotfiles/nixos#nixos' to apply changes."
|
||||
echo "Skipping imperative system update."
|
||||
fi
|
||||
|
||||
# Setup Flatpak
|
||||
# ── Traditional distro path ────────────────────────────────
|
||||
if [ "$DISTRO" != "nixos" ]; then
|
||||
echo "Updating system packages..."
|
||||
if [ "$PACKAGE_MANAGER" == "dnf" ]; then
|
||||
sudo dnf update -y && sudo dnf upgrade -y
|
||||
elif [ "$PACKAGE_MANAGER" == "apt" ]; then
|
||||
sudo apt update && sudo apt upgrade -y
|
||||
else
|
||||
echo "WARNING: Unknown package manager '$PACKAGE_MANAGER'. Skipping system update."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Setup Flatpak (works on NixOS too if enabled in flake.nix)
|
||||
echo "Setting up Flathub repository..."
|
||||
if command -v flatpak &> /dev/null; then
|
||||
flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
|
||||
else
|
||||
echo "WARNING: flatpak command not found. Skipping Flathub setup."
|
||||
echo "Ensure Flatpak is installed via 01-package-install.sh or manually."
|
||||
echo "Ensure Flatpak is installed via your package manager or flake.nix."
|
||||
fi
|
||||
|
||||
echo "--- System Preparation Finished ---"
|
||||
|
||||
Reference in New Issue
Block a user