Files
omnixy/scripts/omnixy-build-system
theArctesian d8947e67b7 documentation
2025-09-25 07:50:48 -07:00

39 lines
971 B
Bash
Executable File

#!/usr/bin/env bash
# Unix-style system builder - does one thing well
set -e
build_system() {
local flake_path="${1:-/etc/nixos}"
local config_name="${2:-omnixy}"
cd "$flake_path"
if [[ "${OMNIXY_QUIET:-}" == "1" ]]; then
sudo nixos-rebuild switch --flake ".#$config_name" >/dev/null 2>&1
else
echo "Building system configuration..."
sudo nixos-rebuild switch --flake ".#$config_name"
echo "System build complete"
fi
}
main() {
case "${1:-}" in
--help|-h)
echo "Usage: omnixy-build-system [flake-path] [config-name]"
echo "Builds and switches to NixOS configuration"
echo "Default: /etc/nixos omnixy"
exit 0
;;
--dry-run|-n)
shift
cd "${1:-/etc/nixos}"
nixos-rebuild build --flake ".#${2:-omnixy}"
;;
*)
build_system "$1" "$2"
;;
esac
}
main "$@"