diff --git a/flake.nix b/flake.nix index 127dba5..886dafd 100644 --- a/flake.nix +++ b/flake.nix @@ -30,8 +30,8 @@ "x86_64-darwin" ]; forAllSystems = nixpkgs.lib.genAttrs systems; - user = "nomad"; - hostname = "unkown"; + user = "nomad2"; + hostname = "unkown2"; in { packages = diff --git a/home/nomad/unkown.nix b/home/nomad/unkown.nix index 64a7958..f828a61 100644 --- a/home/nomad/unkown.nix +++ b/home/nomad/unkown.nix @@ -41,7 +41,7 @@ } ]; monitor = [ - "eDP-1,2560x1600@60,0x0,1.25" + "eDP-1,1920x1080@60,0x0,1" "DP-2,1920x1080@60,auto,1" ]; diff --git a/hosts/common/users/default.nix b/hosts/common/users/default.nix index 74bfb03..2643cc1 100644 --- a/hosts/common/users/default.nix +++ b/hosts/common/users/default.nix @@ -1,3 +1,4 @@ +{ user, ... }: { - imports = [ ./nomad.nix ]; + imports = [ ./${user}.nix ]; } diff --git a/install.sh b/install.sh index 3e4bed1..20803a1 100755 --- a/install.sh +++ b/install.sh @@ -18,6 +18,7 @@ $ENDCOLOR echo echo + # Define the flake file path flake_file="./flake.nix" config_file="./hosts/unkown/configuration.nix" # Specify the correct path for your host's configuration file @@ -27,6 +28,35 @@ monitor_config_file="./home/nomad/unkown.nix" read -p "Enter the new username: " new_user read -p "Enter the new hostname: " new_hostname +if [ ! -f "./hosts/common/users/nomad.nix" ]; then + echo "Source file nomad.nix does not exist!" + exit 1 +fi + +# Check if the new file already exists +if [ -f "./hosts/common/users/$new_user.nix" ]; then + read -p "File $new_user.nix already exists. Overwrite? (y/n) " choice + if [ "$choice" != "y" ]; then + echo "Aborting." + exit 1 + fi +fi + +# Copy the file +echo "$YELLOW Creating user configuration for $new_user... $ENDCOLOR" +cp "./hosts/common/users/nomad.nix" "./hosts/common/users/$new_user.nix" + +echo "$YELLOW Creating user home configuration for $new_user... $ENDCOLOR" +mkdir "./home/$new_user" +sleep 0.2 +cp "./home/nomad/home.nix" "./home/$new_user/home.nix" +cp "./home/nomad/unkown.nix" "./home/$new_user/$new_hostname.nix" +cp -r "./home/nomad/dotfiles/" "./home/$new_user/" + +echo "$GREEN User configuration for $new_user created successfully! $ENDCOLOR" + + + # Replace the 'user' and 'hostname' values in the flake.nix file sed -i "s/user = \".*\";/user = \"$new_user\";/" "$flake_file" sed -i "s/hostname = \".*\";/hostname = \"$new_hostname\";/" "$flake_file"