From 29ce3a9fa590dc8bd77937fb486a67a307473c83 Mon Sep 17 00:00:00 2001 From: Dan Date: Mon, 29 Dec 2025 00:08:18 -0500 Subject: [PATCH] Fix learner-add.sh for NixOS compatibility - Use 'users' group instead of per-user groups - Remove shell specification (NixOS has different paths) - Use 'ip' command instead of 'hostname -I' for IP detection --- scripts/learner-add.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/learner-add.sh b/scripts/learner-add.sh index 030d6ea..6fc27c7 100755 --- a/scripts/learner-add.sh +++ b/scripts/learner-add.sh @@ -65,7 +65,8 @@ create_user() { log_info "Creating user '$username'..." # Create user with home directory - useradd -m -s /bin/bash "$username" + # NixOS: don't specify shell (uses default), group is 'users' + useradd -m -g users "$username" # Set up SSH key local ssh_dir="/home/$username/.ssh" @@ -73,7 +74,7 @@ create_user() { echo "$ssh_key" > "$ssh_dir/authorized_keys" chmod 700 "$ssh_dir" chmod 600 "$ssh_dir/authorized_keys" - chown -R "$username:$username" "$ssh_dir" + chown -R "$username:users" "$ssh_dir" log_info "User created with SSH access" } @@ -109,7 +110,7 @@ setup_plugin_directory() { fi # Set ownership - chown -R "$username:$username" "$user_plugins_dir" + chown -R "$username:users" "$user_plugins_dir" # Make plugin dir readable by maubot group chmod 755 "/home/$username" @@ -243,7 +244,8 @@ create_maubot_symlink() { print_onboarding() { local username="$1" local server_ip - server_ip=$(hostname -I | awk '{print $1}') + # NixOS: use ip command instead of hostname -I + server_ip=$(ip -4 addr show scope global | grep -oP '(?<=inet\s)\d+(\.\d+){3}' | head -1) echo "" echo "=========================================="