diff --git a/install-server.sh b/install-server.sh new file mode 100644 index 0000000..31e145e --- /dev/null +++ b/install-server.sh @@ -0,0 +1,76 @@ +#!/bin/bash +set -e + +echo -e "\n\nEverything is now getting setup. This process will take a few minutes...\n\n" + +sudo apt update && sudo apt install gpg jq -y && sudo apt clean + +#remove unattended upgrades +sudo apt-get remove --purge unattended-upgrades || true + +#Install tailscale +curl -fsSL https://tailscale.com/install.sh | sh + +#Install nix package manager +sh <(curl -L https://nixos.org/nix/install) --daemon --yes + +# Load the Nix environment +. /etc/profile.d/nix.sh + +# Install packages from a pinned version of Nixpkgs +nix-env -iA \ + -f https://github.com/NixOS/nixpkgs/archive/53f3c92b4d1f5f297258954c5026e39c45afd180.tar.gz \ + libvirt qemu bridge-utils virt-manager dnsmasq + +# Find the Nix-installed dnsmasq binary +DNSMASQ_BIN=$(which dnsmasq) +LIBVIRTD_BIN=$(which libvirtd) + + +if [[ -z "$DNSMASQ_BIN" || -z "$LIBVIRTD_BIN" ]]; then + echo "Error: One or both binaries (dnsmasq, libvirtd) not found after installation!" + exit 1 +fi + +# Create a systemd service for dnsmasq +echo "Creating systemd service for dnsmasq..." +sudo bash -c "cat > /etc/systemd/system/dnsmasq-nix.service" < /etc/systemd/system/libvirtd-nix.service" <