adds mennos-laptop as host, adds nextcloud, adds nil and nixd for zed

language servers to work. updates setup to support 25.04
This commit is contained in:
2025-08-27 13:55:31 +02:00
parent 2caea9b483
commit 46a9f3e99b
12 changed files with 111 additions and 202 deletions

View File

@@ -4,7 +4,7 @@ set -euo pipefail
IFS=$'\n\t'
# Constants
readonly NIXOS_RELEASE="25.05" # Home Manager release version (Must match NixOS version)
readonly NIXOS_RELEASE="25.05" # Home Manager release version (Must match NixOS version)
readonly GIT_REPO="https://git.mvl.sh/vleeuwenmenno/dotfiles.git" # Dotfiles repository URL
readonly DOTFILES_PATH="${HOME}/.dotfiles" # Dotfiles directory
readonly SETUP_MARKER="${HOME}/.dotfiles-setup" # Setup marker file indicates setup has been run
@@ -52,7 +52,7 @@ printfe() {
"magenta")
color=$magenta
;;
"cyan")
"cyan")
color=$cyan
;;
"grey")
@@ -69,7 +69,7 @@ printfe() {
fi
printf $grey"%s" "$(date +'%H:%M:%S')"$normal
case $color in
$green | $cyan | $blue | $magenta | $normal)
printf "$green INF $normal"
@@ -113,11 +113,11 @@ die() {
request_sudo() {
log_info "This script requires sudo privileges to run, please enter your password."
sudo -v || die "Failed to obtain sudo privileges"
# Keep sudo credentials refreshed in the background
(while true; do sudo -v; sleep 50; done) &
SUDO_KEEPALIVE_PID=$!
# Ensure we kill the keepalive process when the script exits
trap 'kill $SUDO_KEEPALIVE_PID 2>/dev/null || true' EXIT
}
@@ -170,7 +170,7 @@ update_home_manager_flake() {
local hostname="$1"
local isServer="$2"
local flake_file="$DOTFILES_PATH/config/home-manager/flake.nix"
# Create new configuration entry
local new_config=" \"$hostname\" = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
@@ -185,10 +185,10 @@ update_home_manager_flake() {
# Create temporary file
local temp_file=$(mktemp)
# Find the line number where homeConfigurations = { appears
local config_line=$(grep -n "homeConfigurations = {" "$flake_file" | cut -d: -f1)
if [ -z "$config_line" ]; then
rm "$temp_file"
die "Could not find homeConfigurations in flake.nix"
@@ -196,10 +196,10 @@ update_home_manager_flake() {
# Copy the file up to the line after homeConfigurations = {
head -n "$config_line" "$flake_file" > "$temp_file"
# Add the new configuration
echo "$new_config" >> "$temp_file"
# Add the rest of the file starting from the line after homeConfigurations = {
tail -n +"$((config_line + 1))" "$flake_file" >> "$temp_file"
@@ -223,7 +223,7 @@ install_nix() {
log_info "Nix not detected, installing Nix..."
curl --proto '=https' --tlsv1.2 -sSf -L "https://install.determinate.systems/nix?version=${NIXOS_RELEASE}" -o install-nix.sh || \
die "Failed to download Nix installer"
sh install-nix.sh install --no-confirm || die "Failed to install Nix"
rm install-nix.sh || die "Failed to remove Nix installer"
. /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh || die "Failed to source Nix profile"
@@ -403,10 +403,10 @@ check_compatibility() {
check_command_availibility "dnf"
;;
Ubuntu)
# Check if we are running either 22.04, 24.04 or 24.10
if ! grep -q "Ubuntu 22.04" /etc/os-release && ! grep -q "Ubuntu 24.04" /etc/os-release && ! grep -q "Ubuntu 24.10" /etc/os-release; then
# Check if we are running either 22.04, 24.04, 24.10 or 25.04
if ! grep -q "Ubuntu 22.04" /etc/os-release && ! grep -q "Ubuntu 24.04" /etc/os-release && ! grep -q "Ubuntu 24.10" /etc/os-release && ! grep -q "Ubuntu 25.04" /etc/os-release; then
log_warning "Unsupported Ubuntu version detected. Setup may not work as expected."
log_warning "Supported versions are: Ubuntu 22.04, 24.04, 24.10"
log_warning "Supported versions are: Ubuntu 22.04, 24.04, 24.10, 25.04"
fi
log_success "Detected Ubuntu. Proceeding with setup..."
check_command_availibility "apt"
@@ -485,7 +485,7 @@ main() {
git clone "$GIT_REPO" "$DOTFILES_PATH" || die "Failed to clone dotfiles repository"
echo ""
fi
if [ "$continue_flag" = "--continue" ]; then
log_info "Continuing setup..."
else